144 lines
No EOL
4.5 KiB
GDScript
144 lines
No EOL
4.5 KiB
GDScript
@tool
|
||
extends TwitchData
|
||
|
||
# CLASS GOT AUTOGENERATED DON'T CHANGE MANUALLY. CHANGES CAN BE OVERWRITTEN EASILY.
|
||
|
||
##
|
||
## #/components/schemas/PredictionOutcome
|
||
class_name TwitchPredictionOutcome
|
||
|
||
## An ID that identifies this outcome.
|
||
@export var id: String:
|
||
set(val):
|
||
id = val
|
||
track_data(&"id", val)
|
||
|
||
## The outcome’s text.
|
||
@export var title: String:
|
||
set(val):
|
||
title = val
|
||
track_data(&"title", val)
|
||
|
||
## The number of unique viewers that chose this outcome.
|
||
@export var users: int:
|
||
set(val):
|
||
users = val
|
||
track_data(&"users", val)
|
||
|
||
## The number of Channel Points spent by viewers on this outcome.
|
||
@export var channel_points: int:
|
||
set(val):
|
||
channel_points = val
|
||
track_data(&"channel_points", val)
|
||
|
||
## A list of viewers who were the top predictors; otherwise, **null** if none.
|
||
@export var top_predictors: Array[TopPredictors]:
|
||
set(val):
|
||
top_predictors = val
|
||
track_data(&"top_predictors", val)
|
||
|
||
## The color that visually identifies this outcome in the UX. Possible values are:
|
||
##
|
||
## * BLUE
|
||
## * PINK
|
||
##
|
||
## If the number of outcomes is two, the color is BLUE for the first outcome and PINK for the second outcome. If there are more than two outcomes, the color is BLUE for all outcomes.
|
||
@export var color: String:
|
||
set(val):
|
||
color = val
|
||
track_data(&"color", val)
|
||
var response: BufferedHTTPClient.ResponseData
|
||
|
||
|
||
## Constructor with all required fields.
|
||
static func create(_id: String, _title: String, _users: int, _channel_points: int, _top_predictors: Array[TopPredictors], _color: String) -> TwitchPredictionOutcome:
|
||
var twitch_prediction_outcome: TwitchPredictionOutcome = TwitchPredictionOutcome.new()
|
||
twitch_prediction_outcome.id = _id
|
||
twitch_prediction_outcome.title = _title
|
||
twitch_prediction_outcome.users = _users
|
||
twitch_prediction_outcome.channel_points = _channel_points
|
||
twitch_prediction_outcome.top_predictors = _top_predictors
|
||
twitch_prediction_outcome.color = _color
|
||
return twitch_prediction_outcome
|
||
|
||
|
||
static func from_json(d: Dictionary) -> TwitchPredictionOutcome:
|
||
var result: TwitchPredictionOutcome = TwitchPredictionOutcome.new()
|
||
if d.get("id", null) != null:
|
||
result.id = d["id"]
|
||
if d.get("title", null) != null:
|
||
result.title = d["title"]
|
||
if d.get("users", null) != null:
|
||
result.users = d["users"]
|
||
if d.get("channel_points", null) != null:
|
||
result.channel_points = d["channel_points"]
|
||
if d.get("top_predictors", null) != null:
|
||
for value in d["top_predictors"]:
|
||
result.top_predictors.append(TopPredictors.from_json(value))
|
||
if d.get("color", null) != null:
|
||
result.color = d["color"]
|
||
return result
|
||
|
||
|
||
|
||
## A list of viewers who were the top predictors; otherwise, **null** if none.
|
||
## #/components/schemas/PredictionOutcome/TopPredictors
|
||
class TopPredictors extends TwitchData:
|
||
|
||
## An ID that identifies the viewer.
|
||
@export var user_id: String:
|
||
set(val):
|
||
user_id = val
|
||
track_data(&"user_id", val)
|
||
|
||
## The viewer’s display name.
|
||
@export var user_name: String:
|
||
set(val):
|
||
user_name = val
|
||
track_data(&"user_name", val)
|
||
|
||
## The viewer’s login name.
|
||
@export var user_login: String:
|
||
set(val):
|
||
user_login = val
|
||
track_data(&"user_login", val)
|
||
|
||
## The number of Channel Points the viewer spent.
|
||
@export var channel_points_used: int:
|
||
set(val):
|
||
channel_points_used = val
|
||
track_data(&"channel_points_used", val)
|
||
|
||
## The number of Channel Points distributed to the viewer.
|
||
@export var channel_points_won: int:
|
||
set(val):
|
||
channel_points_won = val
|
||
track_data(&"channel_points_won", val)
|
||
|
||
|
||
|
||
## Constructor with all required fields.
|
||
static func create(_user_id: String, _user_name: String, _user_login: String, _channel_points_used: int, _channel_points_won: int) -> TopPredictors:
|
||
var top_predictors: TopPredictors = TopPredictors.new()
|
||
top_predictors.user_id = _user_id
|
||
top_predictors.user_name = _user_name
|
||
top_predictors.user_login = _user_login
|
||
top_predictors.channel_points_used = _channel_points_used
|
||
top_predictors.channel_points_won = _channel_points_won
|
||
return top_predictors
|
||
|
||
|
||
static func from_json(d: Dictionary) -> TopPredictors:
|
||
var result: TopPredictors = TopPredictors.new()
|
||
if d.get("user_id", null) != null:
|
||
result.user_id = d["user_id"]
|
||
if d.get("user_name", null) != null:
|
||
result.user_name = d["user_name"]
|
||
if d.get("user_login", null) != null:
|
||
result.user_login = d["user_login"]
|
||
if d.get("channel_points_used", null) != null:
|
||
result.channel_points_used = d["channel_points_used"]
|
||
if d.get("channel_points_won", null) != null:
|
||
result.channel_points_won = d["channel_points_won"]
|
||
return result
|
||
|