pokepurple/addons/twitcher/generated/twitch_poll.gd
Mario Steele c11a4ebbc2 Initial Commit
Initial commit of Code Base.
2025-06-12 14:31:14 -05:00

218 lines
No EOL
7.2 KiB
GDScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

@tool
extends TwitchData
# CLASS GOT AUTOGENERATED DON'T CHANGE MANUALLY. CHANGES CAN BE OVERWRITTEN EASILY.
##
## #/components/schemas/Poll
class_name TwitchPoll
## An ID that identifies the poll.
@export var id: String:
set(val):
id = val
track_data(&"id", val)
## An ID that identifies the broadcaster that created the poll.
@export var broadcaster_id: String:
set(val):
broadcaster_id = val
track_data(&"broadcaster_id", val)
## The broadcasters display name.
@export var broadcaster_name: String:
set(val):
broadcaster_name = val
track_data(&"broadcaster_name", val)
## The broadcasters login name.
@export var broadcaster_login: String:
set(val):
broadcaster_login = val
track_data(&"broadcaster_login", val)
## The question that viewers are voting on. For example, _What game should I play next?_ The title may contain a maximum of 60 characters.
@export var title: String:
set(val):
title = val
track_data(&"title", val)
## A list of choices that viewers can choose from. The list will contain a minimum of two choices and up to a maximum of five choices.
@export var choices: Array[Choices]:
set(val):
choices = val
track_data(&"choices", val)
## Not used; will be set to **false**.
@export var bits_voting_enabled: bool:
set(val):
bits_voting_enabled = val
track_data(&"bits_voting_enabled", val)
## Not used; will be set to 0.
@export var bits_per_vote: int:
set(val):
bits_per_vote = val
track_data(&"bits_per_vote", val)
## A Boolean value that indicates whether viewers may cast additional votes using Channel Points. For information about Channel Points, see [Channel Points Guide](https://help.twitch.tv/s/article/channel-points-guide).
@export var channel_points_voting_enabled: bool:
set(val):
channel_points_voting_enabled = val
track_data(&"channel_points_voting_enabled", val)
## The number of points the viewer must spend to cast one additional vote.
@export var channel_points_per_vote: int:
set(val):
channel_points_per_vote = val
track_data(&"channel_points_per_vote", val)
## The polls status. Valid values are:
##
## * ACTIVE — The poll is running.
## * COMPLETED — The poll ended on schedule (see the `duration` field).
## * TERMINATED — The poll was terminated before its scheduled end.
## * ARCHIVED — The poll has been archived and is no longer visible on the channel.
## * MODERATED — The poll was deleted.
## * INVALID — Something went wrong while determining the state.
@export var status: String:
set(val):
status = val
track_data(&"status", val)
## The length of time (in seconds) that the poll will run for.
@export var duration: int:
set(val):
duration = val
track_data(&"duration", val)
## The UTC date and time (in RFC3339 format) of when the poll began.
@export var started_at: String:
set(val):
started_at = val
track_data(&"started_at", val)
## The UTC date and time (in RFC3339 format) of when the poll ended. If `status` is ACTIVE, this field is set to **null**.
@export var ended_at: String:
set(val):
ended_at = val
track_data(&"ended_at", val)
var response: BufferedHTTPClient.ResponseData
## Constructor with all required fields.
static func create(_id: String, _broadcaster_id: String, _broadcaster_name: String, _broadcaster_login: String, _title: String, _choices: Array[Choices], _bits_voting_enabled: bool, _bits_per_vote: int, _channel_points_voting_enabled: bool, _channel_points_per_vote: int, _status: String, _duration: int, _started_at: String, _ended_at: String) -> TwitchPoll:
var twitch_poll: TwitchPoll = TwitchPoll.new()
twitch_poll.id = _id
twitch_poll.broadcaster_id = _broadcaster_id
twitch_poll.broadcaster_name = _broadcaster_name
twitch_poll.broadcaster_login = _broadcaster_login
twitch_poll.title = _title
twitch_poll.choices = _choices
twitch_poll.bits_voting_enabled = _bits_voting_enabled
twitch_poll.bits_per_vote = _bits_per_vote
twitch_poll.channel_points_voting_enabled = _channel_points_voting_enabled
twitch_poll.channel_points_per_vote = _channel_points_per_vote
twitch_poll.status = _status
twitch_poll.duration = _duration
twitch_poll.started_at = _started_at
twitch_poll.ended_at = _ended_at
return twitch_poll
static func from_json(d: Dictionary) -> TwitchPoll:
var result: TwitchPoll = TwitchPoll.new()
if d.get("id", null) != null:
result.id = d["id"]
if d.get("broadcaster_id", null) != null:
result.broadcaster_id = d["broadcaster_id"]
if d.get("broadcaster_name", null) != null:
result.broadcaster_name = d["broadcaster_name"]
if d.get("broadcaster_login", null) != null:
result.broadcaster_login = d["broadcaster_login"]
if d.get("title", null) != null:
result.title = d["title"]
if d.get("choices", null) != null:
for value in d["choices"]:
result.choices.append(Choices.from_json(value))
if d.get("bits_voting_enabled", null) != null:
result.bits_voting_enabled = d["bits_voting_enabled"]
if d.get("bits_per_vote", null) != null:
result.bits_per_vote = d["bits_per_vote"]
if d.get("channel_points_voting_enabled", null) != null:
result.channel_points_voting_enabled = d["channel_points_voting_enabled"]
if d.get("channel_points_per_vote", null) != null:
result.channel_points_per_vote = d["channel_points_per_vote"]
if d.get("status", null) != null:
result.status = d["status"]
if d.get("duration", null) != null:
result.duration = d["duration"]
if d.get("started_at", null) != null:
result.started_at = d["started_at"]
if d.get("ended_at", null) != null:
result.ended_at = d["ended_at"]
return result
## A list of choices that viewers can choose from. The list will contain a minimum of two choices and up to a maximum of five choices.
## #/components/schemas/Poll/Choices
class Choices extends TwitchData:
## An ID that identifies this choice.
@export var id: String:
set(val):
id = val
track_data(&"id", val)
## The choices title. The title may contain a maximum of 25 characters.
@export var title: String:
set(val):
title = val
track_data(&"title", val)
## The total number of votes cast for this choice.
@export var votes: int:
set(val):
votes = val
track_data(&"votes", val)
## The number of votes cast using Channel Points.
@export var channel_points_votes: int:
set(val):
channel_points_votes = val
track_data(&"channel_points_votes", val)
## Not used; will be set to 0.
@export var bits_votes: int:
set(val):
bits_votes = val
track_data(&"bits_votes", val)
## Constructor with all required fields.
static func create(_id: String, _title: String, _votes: int, _channel_points_votes: int, _bits_votes: int) -> Choices:
var choices: Choices = Choices.new()
choices.id = _id
choices.title = _title
choices.votes = _votes
choices.channel_points_votes = _channel_points_votes
choices.bits_votes = _bits_votes
return choices
static func from_json(d: Dictionary) -> Choices:
var result: Choices = Choices.new()
if d.get("id", null) != null:
result.id = d["id"]
if d.get("title", null) != null:
result.title = d["title"]
if d.get("votes", null) != null:
result.votes = d["votes"]
if d.get("channel_points_votes", null) != null:
result.channel_points_votes = d["channel_points_votes"]
if d.get("bits_votes", null) != null:
result.bits_votes = d["bits_votes"]
return result