Update example
This commit is contained in:
		
							
								
								
									
										15
									
								
								README.md
									
									
									
									
									
								
							
							
						
						
									
										15
									
								
								README.md
									
									
									
									
									
								
							| @@ -1,5 +1,5 @@ | ||||
| # 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.  | ||||
|  | ||||
| @@ -14,14 +14,21 @@ package main | ||||
|  | ||||
| import ( | ||||
| 	"fmt" | ||||
| 	"log" | ||||
|  | ||||
| 	"deadbeef.codes/steven/go-itg/itglue" | ||||
| ) | ||||
|  | ||||
| func main() { | ||||
| 	itgAPI := itglue.NewITGAPI("ITG.XXXXXXXXXXXXX555555YOURAPIDKEYHERE2222222222222222XXXXXX") | ||||
| 	fmt.Println((*itgAPI).GetOrganizationByID(1234242).Data.Attributes.Name)                     //Returns the name of the Organization with ID 1234242 | ||||
| 	fmt.Println((*itgAPI).GetOrganizationByName("test Org Inc.").Data[0].Attributes.Description) //Returns the description of the Organization with Name "Test Org Inc." | ||||
| 	fmt.Println("Example IT Glue Application") | ||||
| 	itg := itglue.NewITGAPI("ITG.XXXXXXXXXXXXXXXXXXXXXXXX.XXXXXXXXXXXXXXXXXXXXXXXXXXXX-XXXXXXXXXXXX") | ||||
|  | ||||
| 	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) | ||||
|  | ||||
| } | ||||
|  | ||||
| ``` | ||||
		Reference in New Issue
	
	Block a user