117 lines
No EOL
3.6 KiB
GDScript
117 lines
No EOL
3.6 KiB
GDScript
@tool
|
||
extends TwitchData
|
||
|
||
# CLASS GOT AUTOGENERATED DON'T CHANGE MANUALLY. CHANGES CAN BE OVERWRITTEN EASILY.
|
||
|
||
class_name TwitchCreatePrediction
|
||
|
||
|
||
|
||
##
|
||
## #/components/schemas/CreatePredictionBody
|
||
class Body extends TwitchData:
|
||
|
||
## The ID of the broadcaster that’s running the prediction. This ID must match the user ID in the user access token.
|
||
@export var broadcaster_id: String:
|
||
set(val):
|
||
broadcaster_id = val
|
||
track_data(&"broadcaster_id", val)
|
||
|
||
## The question that the broadcaster is asking. For example, _Will I finish this entire pizza?_ The title is limited to a maximum of 45 characters.
|
||
@export var title: String:
|
||
set(val):
|
||
title = val
|
||
track_data(&"title", val)
|
||
|
||
## The list of possible outcomes that the viewers may choose from. The list must contain a minimum of 2 choices and up to a maximum of 10 choices.
|
||
@export var outcomes: Array[BodyOutcomes]:
|
||
set(val):
|
||
outcomes = val
|
||
track_data(&"outcomes", val)
|
||
|
||
## The length of time (in seconds) that the prediction will run for. The minimum is 30 seconds and the maximum is 1800 seconds (30 minutes).
|
||
@export var prediction_window: int:
|
||
set(val):
|
||
prediction_window = val
|
||
track_data(&"prediction_window", val)
|
||
var response: BufferedHTTPClient.ResponseData
|
||
|
||
|
||
## Constructor with all required fields.
|
||
static func create(_broadcaster_id: String, _title: String, _outcomes: Array[BodyOutcomes], _prediction_window: int) -> Body:
|
||
var body: Body = Body.new()
|
||
body.broadcaster_id = _broadcaster_id
|
||
body.title = _title
|
||
body.outcomes = _outcomes
|
||
body.prediction_window = _prediction_window
|
||
return body
|
||
|
||
|
||
static func from_json(d: Dictionary) -> Body:
|
||
var result: Body = Body.new()
|
||
if d.get("broadcaster_id", null) != null:
|
||
result.broadcaster_id = d["broadcaster_id"]
|
||
if d.get("title", null) != null:
|
||
result.title = d["title"]
|
||
if d.get("outcomes", null) != null:
|
||
for value in d["outcomes"]:
|
||
result.outcomes.append(BodyOutcomes.from_json(value))
|
||
if d.get("prediction_window", null) != null:
|
||
result.prediction_window = d["prediction_window"]
|
||
return result
|
||
|
||
|
||
|
||
## The list of possible outcomes that the viewers may choose from. The list must contain a minimum of 2 choices and up to a maximum of 10 choices.
|
||
## #/components/schemas/CreatePredictionBody/Outcomes
|
||
class BodyOutcomes extends TwitchData:
|
||
|
||
## The text of one of the outcomes that the viewer may select. The title is limited to a maximum of 25 characters.
|
||
@export var title: String:
|
||
set(val):
|
||
title = val
|
||
track_data(&"title", val)
|
||
|
||
|
||
|
||
## Constructor with all required fields.
|
||
static func create(_title: String) -> BodyOutcomes:
|
||
var body_outcomes: BodyOutcomes = BodyOutcomes.new()
|
||
body_outcomes.title = _title
|
||
return body_outcomes
|
||
|
||
|
||
static func from_json(d: Dictionary) -> BodyOutcomes:
|
||
var result: BodyOutcomes = BodyOutcomes.new()
|
||
if d.get("title", null) != null:
|
||
result.title = d["title"]
|
||
return result
|
||
|
||
|
||
|
||
##
|
||
## #/components/schemas/CreatePredictionResponse
|
||
class Response extends TwitchData:
|
||
|
||
## A list that contains the single prediction that you created.
|
||
@export var data: Array[TwitchPrediction]:
|
||
set(val):
|
||
data = val
|
||
track_data(&"data", val)
|
||
var response: BufferedHTTPClient.ResponseData
|
||
|
||
|
||
## Constructor with all required fields.
|
||
static func create(_data: Array[TwitchPrediction]) -> Response:
|
||
var response: Response = Response.new()
|
||
response.data = _data
|
||
return response
|
||
|
||
|
||
static func from_json(d: Dictionary) -> Response:
|
||
var result: Response = Response.new()
|
||
if d.get("data", null) != null:
|
||
for value in d["data"]:
|
||
result.data.append(TwitchPrediction.from_json(value))
|
||
return result
|
||
|