Skip to content

Unofficial Vala API for posting to forem.com (dev.to) instances

License

Notifications You must be signed in to change notification settings

ThiefMD/forem-vala

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

forem-vala

Unofficial Forem API client library for Vala. Still a work in progress.

Compilation

I recommend including forem-vala as a git submodule and adding forem-vala/src/Forem.vala to your sources list. This will avoid packaging conflicts and remote build system issues until I learn a better way to suggest this.

For libsoup3, use forem-vala/src/Forem3.vala.

Requirements

meson
ninja-build
valac

Building

meson build
cd build
meson configure -Denable_examples=true
ninja
./examples/hello-forem

Examples require update to username and API key, don't check this in

string user = "username";
string key = "api-key";

Quick Start

New Login

string user = "user";
string key = "api-key";

Forem.Client client = new Forem.Client ("https://dev.to/");
if (client.authenticate (
        user,
        key))
{
    print ("Successfully logged in");
} else {
    print ("Could not login");
}

Check Logged in User

string my_username;
if (client.get_authenticated_user (out my_username)) {
    print ("Logged in as: %s", my_username);
}

Publish a Post

string url;
string id;
if (client.publish_post (
    out url,
    out id,
    "# Hello Forem!

Hello from [ThiefMD](https://thiefmd.com)!",
    "Hello Forem!"))
{
    print ("Made post: %s", url);
}

About

Unofficial Vala API for posting to forem.com (dev.to) instances

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published