2018-07-23 04:39:46 +00:00
|
|
|
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)
|
|
|
|
}
|
|
|
|
|
2018-08-15 21:15:19 +00:00
|
|
|
//name := &fat.FlexibleAssetTypeData.Attributes.Name
|
2018-07-23 04:39:46 +00:00
|
|
|
}
|
|
|
|
}
|