func main() { flag.Parse() if apiKey == "" { fmt.Println("Please specify a valid API key") os.Exit(1) } client := destiny.New(apiKey, "github.com/apokalyptik/fof/tools/destiny-cli") var rsp struct { Data struct { Characters []struct { CharacterBase struct { CurrentActivityHash int64 `json:"currentActivityHash"` DateLastPlayed time.Time `json:"dateLastPlayed"` } `json:"characterBase"` } `json:"characters"` } `json:"data"` } if err := client.AccountSummary(destiny.PlatformXBL, "4611686018437911483", &rsp); err != nil { fmt.Println(err.Error()) os.Exit(1) } fmt.Println(rsp) }
func init() { if db, err := bolt.Open("my_bolt.db", 0600, nil); err != nil { log.Fatalf("Error opening bolt database: %s", err.Error()) } else { boltDatabase = db state = stow.NewJSONStore(db, []byte("state")) destinyUsers = stow.NewJSONStore(db, []byte("destiny-users")) destinyAccounts = stow.NewJSONStore(db, []byte("destiny-accounts")) destinyCharacters = stow.NewJSONStore(db, []byte("destiny-characters")) } if fp, err := os.Open("creds.json"); err != nil { log.Fatalf("Unable to open creds.json: %s", err.Error()) } else { dec := json.NewDecoder(fp) if err := dec.Decode(&creds); err != nil { log.Fatalf("Unable to decode creds.json: %s", err.Error()) } } destinyClient = destiny.New( creds["bungieAPI"], "github.com/apokalyptik/fof/micro/services/new/destiny-db", ).Platform(destiny.PlatformXBL) }