Zendesk API client library for Go
$ go get github.com/nukosuke/go-zendesk
package main
import (
"context"
"github.com/nukosuke/go-zendesk/zendesk"
)
func main() {
// You can set custom *http.Client here
client := zendesk.NewClient(nil)
// example.zendesk.com
client.SetSubdomain("example")
// Authenticate with API token
client.SetCredential(zendesk.NewAPITokenCredential("[email protected]", "apitoken"))
// Authenticate with agent password
client.SetCredential(zendesk.NewBasicAuthCredential("[email protected]", "password"))
// Create resource
client.CreateGroup(context.Background(), zendesk.Group{
Name: "support team",
})
}
To authenticate using OAuth, simply use the excellent
x/oauth2 package to create an HTTP
client and pass it to the
NewClient
.
go-zendesk has a mock package generated by golang/mock. You can simulate the response from Zendesk API with it.
MIT License.
See the file LICENSE.