package channelpoints import ( "encoding/json" "net/url" "github.com/google/go-querystring/query" ) type GetCustomRewardParams struct { // The ID of the broadcaster whose custom rewards you want to get. This ID must match the user ID found in the OAuth token. BroadcasterID string `url:"broadcaster_id"` // A list of IDs to filter the rewards by. To specify more than one ID, include this parameter for each reward you want to get. // For example, id=1234&id=5678. You may specify a maximum of 50 IDs. // // Duplicate IDs are ignored. The response contains only the IDs that were found. If none of the IDs were found, the response is 404 Not Found. IDs []string `url:"id,omitempty"` // A Boolean value that determines whether the response contains only the custom rewards that the app may manage // (the app is identified by the ID in the Client-Id header). Set to true to get only the custom rewards that the app may manage. // The default is false. OnlyManageableRewards *bool `url:"only_manageable_rewards,omitempty"` } type GetCustomRewardResponse struct { // A list of custom rewards. The list is in ascending order by id. If the broadcaster hasn’t created custom rewards, the list is empty. Data []CustomReward `json:"data"` } // Gets a list of custom rewards that the specified broadcaster created. // // NOTE: A channel may offer a maximum of 50 rewards, which includes both enabled and disabled rewards. // // Requires a user access token that includes the channel:read:redemptions or channel:manage:redemptions scope. func (c *ChannelPoints) GetCustomReward(params *GetCustomRewardParams) (*GetCustomRewardResponse, error) { v, _ := query.Values(params) endpoint := c.baseUrl.ResolveReference(&url.URL{Path: "channel_points/custom_rewards", RawQuery: v.Encode()}) resp, err := c.client.Get(endpoint.String()) if err != nil { return nil, err } defer resp.Body.Close() var data GetCustomRewardResponse if err := json.NewDecoder(resp.Body).Decode(&data); err != nil { return nil, err } return &data, nil }