go-itg/organizations.go

37 lines
1.2 KiB
Go

package itglue
import "fmt"
//Organization maps JSON data from the ITG Organization resource to Go struct
type Organization struct {
Data struct {
ID int `json:"id"`
Type string `json:"type"`
Attributes struct {
Name string `json:"name"`
Description string `json:"description"`
OrganizationTypeID int `json:"organization-type-id"`
OrganizationTypeName string `json:"organization-type-name"`
OrganizationStatusID int `json:"organization-status-id"`
OrganizationStatusName string `json:"organization-status-name"`
Logo string `json:"logo"`
QuickNotes string `json:"quick-notes"`
ShortName string `json:"short-name"`
CreatedAt string `json:"created-at"`
UpdatedAt string `json:"updated-at"`
} `json:"attributes"`
} `json:"data"`
}
//GetOrganizationByID expects an ITG organization ID
//Returns a pointer to an Organization struct
func (itg *ITGAPI) GetOrganizationByID(organizationID int) {
URL := itg.BuildURL(fmt.Sprintf("/organizations/%d", organizationID))
body := itg.GetRequest(URL)
fmt.Print(string(body))
//organization := Organization{}
}