A Golang library for the Discourse Forum API
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
.gitignore
.travis.yml
Makefile
README.md
client.go
group.go
user.go

README.md

GoDisco: Discourse REST API Client

Build Status Codecov branch GoDoc Go Report Card

Go package Discourse Logo

About

Unofficial Golang client for the Discourse.org REST API: https://meta.discourse.org/t/discourse-api-documentation/22706.

Requires Go 1.5.3

Installation

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/

Usage

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("http://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)

License

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.