54 lines
1.3 KiB
Go
54 lines
1.3 KiB
Go
package itglue
|
|
|
|
import (
|
|
"fmt"
|
|
"time"
|
|
)
|
|
|
|
type FlexibleAssetData struct {
|
|
ID string `json:"id"`
|
|
Type string `json:"type"`
|
|
Attributes struct {
|
|
Name string `json:"name"`
|
|
Description string `json:"description"`
|
|
CreatedAt time.Time `json:"created-at"`
|
|
UpdatedAt time.Time `json:"updated-at"`
|
|
Icon string `json:"icon"`
|
|
Enabled bool `json:"enabled"`
|
|
} `json:"attributes"`
|
|
Relationships struct {
|
|
} `json:"relationships"`
|
|
}
|
|
|
|
type FlexibleAsset struct {
|
|
Data struct{ FlexibleAssetData } `json:"data"`
|
|
Meta struct{ Metadata } `json:"metadata"`
|
|
Links struct{ Links } `json:"links"`
|
|
}
|
|
|
|
type FlexibleAssetList struct {
|
|
Data []struct{ FlexibleAssetData } `json:"data"`
|
|
Meta struct{ Metadata } `json:"metadata"`
|
|
Links struct{ Links } `json:"links"`
|
|
}
|
|
|
|
func (itg *ITGAPI) GetFlexibleAssets(flexibleAssetTypeID int) error {
|
|
req := itg.NewRequest("/flexible_assets", "GET", nil)
|
|
err := req.Do()
|
|
if err != nil {
|
|
return fmt.Errorf("request failed for %s: %s", req.RestAction, err)
|
|
}
|
|
|
|
fmt.Println(string(req.Body))
|
|
/*
|
|
flexibleAssets := &FlexibleAssetList{}
|
|
err = json.Unmarshal(req.Body, flexibleAssets)
|
|
if err != nil {
|
|
return nil, fmt.Errorf("could not get flexible asset: %s", err)
|
|
}
|
|
|
|
return flexibleAssets, nil
|
|
*/
|
|
return nil
|
|
}
|