go-twitch/api/channelpoints/modals.go

154 lines
5.9 KiB
Go
Raw Permalink Normal View History

2024-02-27 22:13:57 -05:00
package channelpoints
import "time"
type CustomReward struct {
// The ID that uniquely identifies the broadcaster.
BroadcasterID string `json:"broadcaster_id"`
// The broadcasters login name.
BroadcasterLogin string `json:"broadcaster_login"`
// The broadcasters display name.
BroadcasterName string `json:"broadcaster_name"`
// The ID that uniquely identifies this custom reward.
ID string `json:"id"`
// The title of the custom reward.
Title string `json:"title"`
// The prompt shown to the viewer when they redeem the reward if user input is required (see the is_user_input_required field).
Prompt string `json:"prompt"`
// The cost of the reward in Channel Points.
Cost int `json:"cost"`
// A set of custom images for the reward.
// This field is set to null if the broadcaster didnt upload images.
CustomImages *CustomRewardImage `json:"custom_images"`
// A set of default images for the reward.
DefaultImage CustomRewardImage `json:"default_image"`
// The background color to use for the reward. The color is in Hex format (for example, #00E5CB).
BackgroundColor string `json:"background_color"`
// A Boolean value that determines whether the reward is enabled.
// Is true if enabled; otherwise, false. Disabled rewards arent shown to the user.
IsEnabled bool `json:"is_enabled"`
// A Boolean value that determines whether the user must enter information when redeeming the reward.
// Is true if the reward requires user input.
IsUserInputRequired bool `json:"is_user_input_required"`
// The settings used to determine whether to apply a maximum to the number to the redemptions allowed per live stream.
MaxPerStreamSetting struct {
// A Boolean value that determines whether the reward applies a limit on the number of redemptions allowed per live stream.
// Is true if the reward applies a limit.
IsEnabled bool `json:"is_enabled"`
// The maximum number of redemptions allowed per live stream.
MaxPerStream int64 `json:"max_per_stream"`
} `json:"max_per_stream_setting"`
// The settings used to determine whether to apply a maximum to the number of redemptions allowed per user per live stream.
MaxPerUserPerStreamSetting struct {
// A Boolean value that determines whether the reward applies a limit on the number of redemptions allowed per user per live stream.
// Is true if the reward applies a limit.
IsEnabled bool `json:"is_enabled"`
// The maximum number of redemptions allowed per user per live stream.
MaxPerUserPerStream int64 `json:"max_per_user_per_stream"`
} `json:"max_per_user_per_stream_setting"`
// The settings used to determine whether to apply a cooldown period between redemptions and the length of the cooldown.
GlobalCooldownSetting struct {
// A Boolean value that determines whether to apply a cooldown period. Is true if a cooldown period is enabled.
IsEnabled bool `json:"is_enabled"`
// The cooldown period, in seconds.
GlobalCooldownSeconds int64 `json:"global_cooldown_seconds"`
} `json:"global_cooldown_setting"`
// A Boolean value that determines whether the reward is currently paused. Is true if the reward is paused. Viewers cant redeem paused rewards.
IsPaused bool `json:"is_paused"`
// A Boolean value that determines whether the reward is currently in stock. Is true if the reward is in stock. Viewers cant redeem out of stock rewards.
IsInStock bool `json:"is_in_stock"`
// A Boolean value that determines whether redemptions should be set to FULFILLED status immediately when a reward is redeemed.
// If false, status is UNFULFILLED and follows the normal request queue process.
ShouldRedemptionsSkipRequestQueue bool `json:"should_redemptions_skip_request_queue"`
// The number of redemptions redeemed during the current live stream. The number counts against the max_per_stream_setting limit.
// This field is null if the broadcasters stream isnt live or max_per_stream_setting isnt enabled.
RedemptionsRedeemedCurrentStream *int `json:"redemptions_redeemed_current_stream"`
// The timestamp of when the cooldown period expires. Is null if the reward isnt in a cooldown state (see the global_cooldown_setting field).
CooldownExpiresAt *time.Time `json:"cooldown_expires_at"`
}
type CustomRewardImage struct {
// The URL to a small version of the image.
URL1X string `json:"url_1x"`
// The URL to a medium version of the image.
URL2X string `json:"url_2x"`
// The URL to a large version of the image.
URL4X string `json:"url_4x"`
}
type RewardRedemptionStatus string
const (
RewardRedemptionStatusCanceled RewardRedemptionStatus = "CANCELED"
RewardRedemptionStatusFulfilled RewardRedemptionStatus = "FULFILLED"
RewardRedemptionStatusUnfulfilled RewardRedemptionStatus = "UNFULFILLED"
)
type CustomRewardRedemption struct {
// The ID that uniquely identifies the broadcaster.
BroadcasterID string `json:"broadcaster_id"`
// The broadcaster's login name.
BroadcasterLogin string `json:"broadcaster_login"`
// The broadcaster's display name.
BroadcasterName string `json:"broadcaster_name"`
// The ID that uniquely identifies this redemption.
ID string `json:"id"`
// The ID that uniquely identifies the user that redeemed the reward.
UserID string `json:"user_id"`
// The user's login name.
UserLogin string `json:"user_login"`
// The user's display name.
UserName string `json:"user_name"`
// The state of the redemption.
Status RewardRedemptionStatus `json:"status"`
//The date and time of when the reward was redeemed, in RFC3339 format.
RedeemedAt time.Time `json:"redeemed_at"`
// The reward that the user redeemed.
Reward struct {
// The ID that uniquely identifies the redeemed reward.
ID string `json:"id"`
// The reward's title.
Title string `json:"title"`
// The prompt displayed to the viewer if user input is required.
Prompt string `json:"prompt"`
// The rewards cost, in Channel Points.
Cost int64 `json:"cost"`
} `json:"reward"`
}