Begin work on generate-structs for flexible assets
This commit is contained in:
@ -32,25 +32,16 @@ type FlexibleAssetList struct {
|
||||
Links struct{ Links } `json:"links"`
|
||||
}
|
||||
|
||||
//Rather than a "GetFlexibleAssets", we need to implement getters for each flexible asset type. This should probably be automated and go code should be generated by some external program.
|
||||
func (itg *ITGAPI) GetFlexibleAssets(flexibleAssetTypeID int) error {
|
||||
//GetFlexibleAssetsJSON is a special function. All flexible assets will return different data depending
|
||||
//on which fields make up the flexible asset. Because of this, this function simply returns the JSON bytes.
|
||||
func (itg *ITGAPI) GetFlexibleAssetsJSON(flexibleAssetTypeID int) ([]byte, error) {
|
||||
req := itg.NewRequest("/flexible_assets", "GET", nil)
|
||||
req.RawURLValues = fmt.Sprintf("filter[flexible_asset_type_id]=%d", flexibleAssetTypeID)
|
||||
|
||||
err := req.Do()
|
||||
if err != nil {
|
||||
return fmt.Errorf("request failed for %s: %s", req.RestAction, err)
|
||||
return nil, 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
|
||||
return req.Body, nil
|
||||
}
|
||||
|
Reference in New Issue
Block a user