faabiosr / godisco

A Golang library for the Discourse Forum API

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

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.

About

A Golang library for the Discourse Forum API


Languages

Language:Go 97.2%Language:Makefile 2.8%