zendesk-go

module
v0.0.58 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 15, 2024 License: MIT

README

zendesk-go

Go Go Reference Go Report Card

zendesk-go logo

Zendesk API client library for Go.

Getting Started

Install
go get github.com/aaronellington/zendesk-go
Create new connection

[!NOTE] You will need to set your Zendesk Credentials in your environment before the below example will work.

package main

import (
	"context"
	"log"
	"os"

	"github.com/aaronellington/zendesk-go/zendesk"
)

func main() {
	ctx := context.Background()

	z := zendesk.NewService(
		os.Getenv("ZENDESK_DEMO_SUBDOMAIN"),
		zendesk.AuthenticationToken{
			Email: os.Getenv("ZENDESK_DEMO_EMAIL"),
			Token: os.Getenv("ZENDESK_DEMO_TOKEN"),
		},
		zendesk.ChatCredentials{
			ClientID:     os.Getenv("ZENDESK_DEMO_CHAT_CLIENT_ID"),
			ClientSecret: os.Getenv("ZENDESK_DEMO_CHAT_CLIENT_SECRET"),
		},
		// Logger is optional, see implementation to see how to add your custom logger here
		zendesk.WithLogger(log.New(os.Stdout, "Zendesk API - ", log.LstdFlags)),
		// Optionally set http.RoundTripper - this is helpful when writing tests
		zendesk.WithRoundTripper(customRoundTripper),
	)

	tags, err := support.Tickets().AddTags(ctx, 6170, zendesk.Tags{
		"foobar",
	})
	if err != nil {
		log.Fatal(err)
	}
	log.Printf("%+v", tags)
}

Directories

Path Synopsis
examples
Zendesk API client library for Go (golang).
Zendesk API client library for Go (golang).

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL