Working on Vala Client API

Are you a Linux developer interested in crafting next level ghost client experiences on Linux?

Then this project probably isn’t for you… yet…

I’m working on a Vala Client Library for Ghost. Right now, it only has posting and image uploads with what I’m calling the Simple API.

public class HelloGhost {
    public static int main (string[] args) {
        string user = "user@domain.com";
        string password = "password";
        string endpoint = "https://my-blog.ghost";

        Ghost.Client client = new Ghost.Client (endpoint, user, password);
        string id;
        string slug;
        client.authenticate ();

        string file_url;
        if (client.upload_image_simple (
            out file_url,
            "/home/user/Pictures/bread.jpeg"))
        {
            print ("\n** New image at %s\n", file_url);
        }

        if (client.create_post_simple(
            out slug, // Slug URL
            out id, // id of Post
            "Hello world", // Post Title
            "<p>Hello ghost</p><img src='%s' />".printf (file_url), // Post HTML
            false, // true = publish, false = draft
            file_url, // Feature/Cover image URL
            {"Tag 1", "Tag 2"})) // Tags
        {
            print ("\n** New post at %s/%s\n", endpoint, slug);
        }

        return 0;
    }
}

Here’s a more complicated example of finding all images in markdown, uploading them, then converting the post to HTML for posting.

One of the things I’m struggling with is generating card content. I’m hoping someone can help or provide guidance there.

Right now, I plan on continuing the Simple API for list posts, polling posts locally, and updating a post. If we can figure out card content, I hope to expose a more complicated/complete API.