This is questionable... I'm not sure how to use the Hashnode API. We just threw code at the wall until something stuck.
Unofficial Hashnode API client library for Vala. Still a work in progress.
I recommend including hashnode-vala
as a git submodule and adding hashnode-vala/src/Hashnode.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 hashnode-vala/src/Hashnode3.vala
.
meson
ninja-build
valac
meson build
cd build
meson configure -Denable_examples=true
ninja
./examples/hello-hashnode
Examples require update to publication id and Personal Access Token, don't check this in
string publication_id = "publication id";
string key = "personal-access-token";
string publication_id = "publication-id";
string key = "personal-access-token";
Hashnode.Client client = new Hashnode.Client ();
if (client.authenticate (
publication_id,
key))
{
print ("Successfully logged in");
} else {
print ("Could not login");
}
string url;
string id;
if (client.publish_post (
out url,
out id,
"# Hello Hashnode!
Hello from [ThiefMD](https://thiefmd.com)!",
"Hello Hashnode!"))
{
print ("Made post: %s", url);
}