Unofficial Forem API client library for Vala. Still a work in progress.
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
.
meson
ninja-build
valac
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";
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");
}
string my_username;
if (client.get_authenticated_user (out my_username)) {
print ("Logged in as: %s", my_username);
}
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);
}