gophorem is a REST API Wrapper for a forem api written in go.
Import the package into your go file:
import "github.com/ShiraazMoollatjie/gophorem/pkg/gophorem"
Thereafter, create a client and specify your API token:
cl := gophorem.NewClient(gophorem.WithApiKey("MY_API_KEY"))
It is also possible to not use an API key for anonymous operations.
To retrieve a list of articles, simply use the GetArticles
function:
articles, err := cl.GetArticles(gophorem.Defaults())
It is also possible for us to add query parameters. For example, it's useful to retrieve articles for a specific tag
.
The way to do this would be:
al, err := cl.GetArticles(gophorem.Arguments{
"tag": "go",
})
To retrieve a single article, you need to specify the article id
:
article, err := client.GetArticle("167919")
- Authentication via API Key
- Convenience functions to create a devto client
- The entire forem api set of endpoints including:
- Article management
- Listing management
- Webhook management
- Listing podcasts, video articles,
See the examples
package for more examples on forem api usages.