This is an example of how to get entitlements for all users of a game.
client, err := helix.NewClient(&helix.Options{
ClientID: "your-client-id",
})
if err != nil {
// handle error
}
resp, err := client.GetDropsEntitlements(&helix.GetDropEntitlementsParams{
GameID: "your-game-id",
})
if err != nil {
// handle error
}
fmt.Printf("%+v\n", resp)
This is an example of how to get entitlements for a specific user.
client, err := helix.NewClient(&helix.Options{
ClientID: "your-client-id",
})
if err != nil {
// handle error
}
resp, err := client.GetDropsEntitlements(&helix.GetDropEntitlementsParams{
UserID: "your-game-id",
})
if err != nil {
// handle error
}
fmt.Printf("%+v\n", resp)
This is an example of how to get multiple pages of entitlement results.
client, err := helix.NewClient(&helix.Options{
ClientID: "your-client-id",
})
if err != nil {
// handle error
}
// First page
resp, err := client.GetDropsEntitlements(&helix.GetDropEntitlementsParams{
GameID: "your-game-id",
After: "",
First: 50,
})
if err != nil {
// handle error
}
fmt.Printf("%+v\n", resp)
// Next page
resp, err = client.GetDropsEntitlements(&helix.GetDropEntitlementsParams{
GameID: "your-game-id",
After: resp.Data.Pagination.Cursor,
First: 50,
})
if err != nil {
// handle error
}
fmt.Printf("%+v\n", resp)
This is an example of how to get entitlements for a specific fulfillment status.
client, err := helix.NewClient(&helix.Options{
ClientID: "your-client-id",
})
if err != nil {
// handle error
}
resp, err := client.GetDropsEntitlements(&helix.GetDropEntitlementsParams{
UserID: "your-game-id",
FulfillmentStatus: "CLAIMED"
})
if err != nil {
// handle error
}
fmt.Printf("%+v\n", resp)
This is an example of how to update drops entitlements status.
client, err := helix.NewClient(&helix.Options{
ClientID: "your-client-id",
})
if err != nil {
// handle error
}
resp, err := client.UpdateDropsEntitlements(&helix.UpdateDropsEntitlementsParams{
EntitlementIDs: ["entitlement-id-1", "entitlement-id-2"],
FulfillmentStatus: "FULFILLED",
})
if err != nil {
// handle error
}
// Check which of the requested ids were updated
for _, es := range resp.Data.EntitlementSets {
if es.Status == "SUCCESS" {
fmt.Printf("%+v\n", es.IDs)
}
}