go-twitch/eventsub/events/goals.go

69 lines
3.2 KiB
Go
Raw Normal View History

2024-03-05 12:14:18 -05:00
package events
import "time"
type GoalsEvent struct {
// An ID that identifies this event.
Id string `json:"id"`
// An ID that uniquely identifies the broadcaster.
BroadcasterUserId string `json:"broadcaster_user_id"`
// The broadcaster's display name.
BroadcasterUserName string `json:"broadcaster_user_name"`
// The broadcaster's user handle.
BroadcasterUserLogin string `json:"broadcaster_user_login"`
// The type of goal. Possible values are:
//
// follow — The goal is to increase followers.
//
// subscription — The goal is to increase subscriptions. This type shows the net increase or decrease in tier points associated with the subscriptions.
//
// subscription_count — The goal is to increase subscriptions. This type shows the net increase or decrease in the number of subscriptions.
//
// new_subscription — The goal is to increase subscriptions. This type shows only the net increase in tier points associated with the subscriptions
// (it does not account for users that unsubscribed since the goal started).
//
// new_subscription_count — The goal is to increase subscriptions. This type shows only the net increase in the number of subscriptions
// (it does not account for users that unsubscribed since the goal started).
Type string `json:"type"`
// A description of the goal, if specified. The description may contain a maximum of 40 characters.
Description string `json:"description"`
// A Boolean value that indicates whether the broadcaster achieved their goal. Is true if the goal was achieved; otherwise, false.
IsAchieved bool `json:"is_achieved"`
// The goal's current value.
//
// The goal's type determines how this value is increased or decreased.
//
// - If type is follow, this field is set to the broadcaster's current number of followers.
// This number increases with new followers and decreases when users unfollow the broadcaster.
//
// - If type is subscription, this field is increased and decreased by the points value associated with the subscription tier.
// For example, if a tier-two subscription is worth 2 points, this field is increased or decreased by 2, not 1.
//
// - If type is subscription_count, this field is increased by 1 for each new subscription and decreased by 1 for each user that unsubscribes.
//
// - If type is new_subscription, this field is increased by the points value associated with the subscription tier.
// For example, if a tier-two subscription is worth 2 points, this field is increased by 2, not 1.
//
// - If type is new_subscription_count, this field is increased by 1 for each new subscription.
CurrentAmount int `json:"current_amount"`
// The goal's target value. For example, if the broadcaster has 200 followers before creating the goal,
// and their goal is to double that number, this field is set to 400.
TargetAmount int `json:"target_amount"`
// The UTC timestamp in RFC 3339 format, which indicates when the broadcaster created the goal.
StartedAt time.Time `json:"started_at"`
// The UTC timestamp in RFC 3339 format, which indicates when the broadcaster ended the goal.
//
// Only the channel.goal.end event includes this field.
EndedAt time.Time `json:"ended_at"`
}