package main import ( "fmt" "log" "os" "strconv" "deadbeef.codes/steven/go-itg/itglue" ) var itg *itglue.ITGAPI func init() { apiKey := os.Getenv("itgapikey") if apiKey == "" { log.Fatalf("API key is not set") } itg = itglue.NewITGAPI(apiKey) } func main() { fats, err := itg.GetFlexibleAssetTypes() if err != nil { log.Fatalf("could get get FATs: %s", err) } for _, fat := range fats.Data { fmt.Printf("%s - %s\n", fat.FlexibleAssetTypeData.ID, fat.FlexibleAssetTypeData.Attributes.Name) id, err := strconv.Atoi(fat.ID) if err != nil { log.Fatalf("could not convert %s to integer: %s", fat.ID, err) } fa, err := itg.GetFlexibleAssetsJSON(id) if err != nil { log.Fatalf("could get flexible asset with type ID %d: %s", id, err) } //name := &fat.FlexibleAssetTypeData.Attributes.Name } }