Skip to content

Instantly share code, notes, and snippets.

@fprimex
Last active April 19, 2017 14:37
Show Gist options
  • Save fprimex/d35109d4f769e7a24dd17675509d64e7 to your computer and use it in GitHub Desktop.
Save fprimex/d35109d4f769e7a24dd17675509d64e7 to your computer and use it in GitHub Desktop.
package main
import (
"fmt"
"log"
"github.com/fprimex/zdesk-go"
"github.com/tidwall/gjson"
)
func main() {
// Create a client object. The client has no state, so it can be persisted
// and re-used. It is also safe to use concurrently due to its lack of state.
// There is also a DefaultClient() method that reads an environment variable.
// Please see the documentation for more information and details.
client, err := zdesk.NewClient("brent@fprimex.com/token", "TOKEN")
if err != nil {
log.Fatal(err)
}
// You can find the service ID in the Fastly web console.
//var serviceID = "SU1Z0isxPaozGVKXdv0eY"
// Get the latest active version
t, err := client.TicketShow(&zdesk.TicketShowInput{
ID: "137",
})
if err != nil {
log.Fatal(err)
}
fmt.Printf("%s\n", gjson.GetBytes(t, "ticket.subject"))
//m1 := t.(map[string]interface{})
//t1 := m1["ticket"]
//m2 := t1.(map[string]interface{})
//fmt.Printf("%s\n", m2["subject"])
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment