Skip to content

Latest commit

 

History

History
58 lines (44 loc) · 1.73 KB

README.md

File metadata and controls

58 lines (44 loc) · 1.73 KB

gophorem

Go Report Card Go Doc Build status

gophorem

gophorem is a REST API Wrapper for a forem api written in go.

Usage

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.

Getting started

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")

Features

  • 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,

More examples

See the examples package for more examples on forem api usages.

Reference

https://docs.dev.to/api/