Unofficial Golang client for the Discourse.org REST API: https://meta.discourse.org/t/discourse-api-documentation/22706.
Requires Go 1.5.3
The recommended way of installing the client is via go get
. Simply run the following command to add the package.
go get github.com/FrenchBen/godisco/
Below is an example of how to use this library
package main
import (
"github.com/FrenchBen/godisco"
"github.com/Sirupsen/logrus"
)
func main() {
discourseClient, err := godisco.NewClient("https://discourse.example.com", "api_token", "api_username")
if err != nil {
logrus.Fatal(err)
}
discourseUser, err := godisco.GetUser(discourseClient, "SomeDiscourseUserName")
if err != nil {
logrus.Error(err)
}
logrus.Infof("User Info: %v", discourseUser)
}
To view more the token and fields sent with the request, set your log level to debug:
logrus.SetLevel(logrus.DebugLevel)
This source is licensed under an MIT License, see the LICENSE file for full details. If you use this code, it would be great to hear from you.