Add GetOrganizationTypes
This commit is contained in:
parent
9fdb1641d9
commit
9ef552cdea
@ -16,18 +16,6 @@ type OrganizationTypeData struct {
|
|||||||
UpdatedAt time.Time `json:"updated-at"`
|
UpdatedAt time.Time `json:"updated-at"`
|
||||||
Synced bool `json:"synced"`
|
Synced bool `json:"synced"`
|
||||||
} `json:"attributes"`
|
} `json:"attributes"`
|
||||||
|
|
||||||
Meta struct {
|
|
||||||
CurrentPage int `json:"current-page"`
|
|
||||||
NextPage interface{} `json:"next-page"`
|
|
||||||
PrevPage interface{} `json:"prev-page"`
|
|
||||||
TotalPages int `json:"total-pages"`
|
|
||||||
TotalCount int `json:"total-count"`
|
|
||||||
Filters struct {
|
|
||||||
} `json:"filters"`
|
|
||||||
} `json:"meta"`
|
|
||||||
Links struct {
|
|
||||||
} `json:"links"`
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//OrganizationData contains the schema of an Organization in IT Glue without the "data" wrapper.
|
//OrganizationData contains the schema of an Organization in IT Glue without the "data" wrapper.
|
||||||
@ -73,24 +61,23 @@ type OrganizationTypeList struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
///organization_types
|
///organization_types
|
||||||
func (itg *ITGAPI) GetOrganizationTypes() error {
|
func (itg *ITGAPI) GetOrganizationTypes() (*OrganizationTypeList, error) {
|
||||||
itgurl, err := itg.BuildURL("/organization_types")
|
itgurl, err := itg.BuildURL("/organization_types")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("could not build URL: %s", err)
|
return nil, fmt.Errorf("could not build URL: %s", err)
|
||||||
}
|
}
|
||||||
body, err := itg.GetRequest(itgurl)
|
body, err := itg.GetRequest(itgurl)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("request failed: %s", err)
|
return nil, fmt.Errorf("request failed: %s", err)
|
||||||
}
|
}
|
||||||
fmt.Println(string(body))
|
|
||||||
|
|
||||||
/*organization := &Organization{}
|
organizationTypes := &OrganizationTypeList{}
|
||||||
err := json.Unmarshal(body, organization)
|
err = json.Unmarshal(body, organizationTypes)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, fmt.Errorf("could not get organization: %s", err)
|
return nil, fmt.Errorf("could not get organization types: %s", err)
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
return nil
|
return organizationTypes, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
//GetOrganizationByID expects an ITG organization ID
|
//GetOrganizationByID expects an ITG organization ID
|
||||||
|
Loading…
Reference in New Issue
Block a user