40 lines
1.1 KiB
Go
40 lines
1.1 KiB
Go
|
package channelpoints
|
|||
|
|
|||
|
import (
|
|||
|
"net/http"
|
|||
|
"net/url"
|
|||
|
|
|||
|
"github.com/google/go-querystring/query"
|
|||
|
)
|
|||
|
|
|||
|
type DeleteCustomRewardParams struct {
|
|||
|
// The ID of the broadcaster that created the custom reward. This ID must match the user ID found in the OAuth token.
|
|||
|
BroadcasterID string `url:"broadcaster_id"`
|
|||
|
|
|||
|
// The ID of the custom reward to delete.
|
|||
|
ID string `url:"id"`
|
|||
|
}
|
|||
|
|
|||
|
// Deletes a custom reward that the broadcaster created.
|
|||
|
//
|
|||
|
// The app used to create the reward is the only app that may delete it.
|
|||
|
// If the reward’s redemption status is UNFULFILLED at the time the reward is deleted, its redemption status is marked as FULFILLED.
|
|||
|
//
|
|||
|
// / Requires a user access token that includes the channel:manage:redemptions scope.
|
|||
|
func (c *ChannelPoints) DeleteCustomReward(params *DeleteCustomRewardParams) error {
|
|||
|
v, _ := query.Values(params)
|
|||
|
endpoint := c.baseUrl.ResolveReference(&url.URL{Path: "channel_points/custom_rewards", RawQuery: v.Encode()})
|
|||
|
|
|||
|
resp, err := c.client.Do(&http.Request{
|
|||
|
Method: http.MethodDelete,
|
|||
|
URL: endpoint,
|
|||
|
})
|
|||
|
if err != nil {
|
|||
|
return err
|
|||
|
}
|
|||
|
|
|||
|
defer resp.Body.Close()
|
|||
|
|
|||
|
return nil
|
|||
|
}
|