Currently, it is very limited but I have plans to cover the entire API. ForemJS runs asynchronously, so you will have to use
.then() callbacks. I am currently working on documentation, but here are the basics of how it works.
npm i email@example.com
As by SemVer, while the MAJOR version is still 0, breaking changes may occur. The PATCH versions (0.1.x) are going to be adding documentation, and polished up the wrapper as per people's specifications. The next MINOR (0.2.0) version should cover more of the API and get ready for 1.0.0.
const Forem = require('foremjs')
This is a simple process of just requiring the package.
You will have to get a token from your settings page. Now use the following code to create an instance. This is how you will access the API.
const client = new Forem.Client(TOKEN)
You can use
.getArticle(id) to get an article. These are some of the properties carried by the Article class:
.url. You can see the code for the whole list. There is also
.getUser(id), however, it is a bit limited by the API itself. You can get things like
.github for their username.
More features are soon to come, such as posting articles. Thank you so much for reading this article. Maybe my next one will be posted using my wrapper? Seriously, though, if you have any questions, comments, or concerns about this project comment them down below and I will respond as soon as possible.