Added Links
Added OrganizationStatuses
This commit is contained in:
parent
582b4c205f
commit
99d8b2bede
@ -8,6 +8,9 @@ import (
|
||||
"net/url"
|
||||
)
|
||||
|
||||
//TBD: Implement
|
||||
type Links struct{}
|
||||
|
||||
type Metadata struct {
|
||||
CurrentPage int `json:"current-page"`
|
||||
NextPage interface{} `json:"next-page"`
|
||||
|
51
itglue/organization-statuses.go
Normal file
51
itglue/organization-statuses.go
Normal file
@ -0,0 +1,51 @@
|
||||
package itglue
|
||||
|
||||
import (
|
||||
"encoding/json"
|
||||
"fmt"
|
||||
"time"
|
||||
)
|
||||
|
||||
type OrganizationStatusData struct {
|
||||
ID string `json:"id"`
|
||||
Type string `json:"type"`
|
||||
Attributes struct {
|
||||
Name string `json:"name"`
|
||||
CreatedAt time.Time `json:"created-at"`
|
||||
UpdatedAt time.Time `json:"updated-at"`
|
||||
Synced bool `json:"synced"`
|
||||
} `json:"attributes"`
|
||||
}
|
||||
|
||||
type OrganizationStatus struct {
|
||||
Data struct{ OrganizationStatusData } `json:"data"`
|
||||
Meta struct{ Metadata } `json:"metadata"`
|
||||
Links struct{ Links } `json:"links"`
|
||||
}
|
||||
|
||||
type OrganizationStatusList struct {
|
||||
Data []struct{ OrganizationStatusData } `json:"data"`
|
||||
Meta struct{ Metadata } `json:"metadata"`
|
||||
Links struct{ Links } `json:"links"`
|
||||
}
|
||||
|
||||
func (itg *ITGAPI) GetOrganizationStatuses() (*OrganizationStatusList, error) {
|
||||
itgurl, err := itg.BuildURL("/organization_statuses")
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("could not build URL: %s", err)
|
||||
}
|
||||
body, err := itg.GetRequest(itgurl)
|
||||
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("request failed: %s", err)
|
||||
}
|
||||
|
||||
organizationStatuses := &OrganizationStatusList{}
|
||||
err = json.Unmarshal(body, organizationStatuses)
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("could not get organization types: %s", err)
|
||||
}
|
||||
|
||||
return organizationStatuses, nil
|
||||
|
||||
}
|
@ -18,13 +18,15 @@ type OrganizationTypeData struct {
|
||||
}
|
||||
|
||||
type OrganizationType struct {
|
||||
Data struct{ OrganizationTypeData } `json:"data"`
|
||||
Meta struct{ Metadata } `json:"metadata"`
|
||||
Data struct{ OrganizationTypeData } `json:"data"`
|
||||
Meta struct{ Metadata } `json:"metadata"`
|
||||
Links struct{ Links } `json:"links"`
|
||||
}
|
||||
|
||||
type OrganizationTypeList struct {
|
||||
Data []struct{ OrganizationTypeData } `json:"data"`
|
||||
Meta struct{ Metadata } `json:"metadata"`
|
||||
Data []struct{ OrganizationTypeData } `json:"data"`
|
||||
Meta struct{ Metadata } `json:"metadata"`
|
||||
Links struct{ Links } `json:"links"`
|
||||
}
|
||||
|
||||
///organization_types
|
||||
|
Loading…
Reference in New Issue
Block a user