Update example

This commit is contained in:
Steven Polley 2018-07-22 02:15:24 -06:00
parent 9ef552cdea
commit 3d987bb089

View File

@ -1,5 +1,5 @@
# go-itg # go-itg
IT Glue API Structs + Receivers for the Go IT Glue API Structs + Methods for the Go
This is nowhere near complete, and at least for now, I will only be adding support the functionality required for use within my organization. Feel free to send a pull request if you'd like to contribute anything that's missing. This is nowhere near complete, and at least for now, I will only be adding support the functionality required for use within my organization. Feel free to send a pull request if you'd like to contribute anything that's missing.
@ -14,14 +14,21 @@ package main
import ( import (
"fmt" "fmt"
"log"
"deadbeef.codes/steven/go-itg/itglue" "deadbeef.codes/steven/go-itg/itglue"
) )
func main() { func main() {
itgAPI := itglue.NewITGAPI("ITG.XXXXXXXXXXXXX555555YOURAPIDKEYHERE2222222222222222XXXXXX") fmt.Println("Example IT Glue Application")
fmt.Println((*itgAPI).GetOrganizationByID(1234242).Data.Attributes.Name) //Returns the name of the Organization with ID 1234242 itg := itglue.NewITGAPI("ITG.XXXXXXXXXXXXXXXXXXXXXXXX.XXXXXXXXXXXXXXXXXXXXXXXXXXXX-XXXXXXXXXXXX")
fmt.Println((*itgAPI).GetOrganizationByName("test Org Inc.").Data[0].Attributes.Description) //Returns the description of the Organization with Name "Test Org Inc."
nd, err := itg.GetOrganizationByName("Next Digital Inc.") //Returns an organization list
if err != nil {
log.Fatalf("could not get nd: %s", err)
}
log.Printf("%s - %s\n", nd.Data[0].ID, nd.Data[0].Attributes.Name)
} }
``` ```