163 lines
5.2 KiB
GDScript
163 lines
5.2 KiB
GDScript
@tool
|
||
extends TwitchData
|
||
|
||
# CLASS GOT AUTOGENERATED DON'T CHANGE MANUALLY. CHANGES CAN BE OVERWRITTEN EASILY.
|
||
|
||
##
|
||
## #/components/schemas/Stream
|
||
class_name TwitchStream
|
||
|
||
## An ID that identifies the stream. You can use this ID later to look up the video on demand (VOD).
|
||
@export var id: String:
|
||
set(val):
|
||
id = val
|
||
track_data(&"id", val)
|
||
|
||
## The ID of the user that’s broadcasting the stream.
|
||
@export var user_id: String:
|
||
set(val):
|
||
user_id = val
|
||
track_data(&"user_id", val)
|
||
|
||
## The user’s login name.
|
||
@export var user_login: String:
|
||
set(val):
|
||
user_login = val
|
||
track_data(&"user_login", val)
|
||
|
||
## The user’s display name.
|
||
@export var user_name: String:
|
||
set(val):
|
||
user_name = val
|
||
track_data(&"user_name", val)
|
||
|
||
## The ID of the category or game being played.
|
||
@export var game_id: String:
|
||
set(val):
|
||
game_id = val
|
||
track_data(&"game_id", val)
|
||
|
||
## The ID of the category or game being played.
|
||
@export var game_name: String:
|
||
set(val):
|
||
game_name = val
|
||
track_data(&"game_name", val)
|
||
|
||
## The type of stream. Possible values are:
|
||
##
|
||
## * live
|
||
##
|
||
## If an error occurs, this field is set to an empty string.
|
||
@export var type: String:
|
||
set(val):
|
||
type = val
|
||
track_data(&"type", val)
|
||
|
||
## The stream’s title. Is an empty string if not set.
|
||
@export var title: String:
|
||
set(val):
|
||
title = val
|
||
track_data(&"title", val)
|
||
|
||
## The number of users watching the stream.
|
||
@export var viewer_count: int:
|
||
set(val):
|
||
viewer_count = val
|
||
track_data(&"viewer_count", val)
|
||
|
||
## The UTC date and time (in RFC3339 format) of when the broadcast began.
|
||
@export var started_at: String:
|
||
set(val):
|
||
started_at = val
|
||
track_data(&"started_at", val)
|
||
|
||
## The language that the stream uses. This is an ISO 639-1 two-letter language code or _other_ if the stream uses a language not in the list of [supported stream languages](https://help.twitch.tv/s/article/languages-on-twitch#streamlang).
|
||
@export var language: String:
|
||
set(val):
|
||
language = val
|
||
track_data(&"language", val)
|
||
|
||
## A URL to an image of a frame from the last 5 minutes of the stream. Replace the width and height placeholders in the URL (`{width}x{height}`) with the size of the image you want, in pixels.
|
||
@export var thumbnail_url: String:
|
||
set(val):
|
||
thumbnail_url = val
|
||
track_data(&"thumbnail_url", val)
|
||
|
||
## **IMPORTANT** As of February 28, 2023, this field is deprecated and returns only an empty array. If you use this field, please update your code to use the `tags` field.
|
||
##
|
||
## The list of tags that apply to the stream. The list contains IDs only when the channel is steaming live. For a list of possible tags, see [List of All Tags](https://www.twitch.tv/directory/all/tags). The list doesn’t include Category Tags.
|
||
@export var tag_ids: Array[String]:
|
||
set(val):
|
||
tag_ids = val
|
||
track_data(&"tag_ids", val)
|
||
|
||
## The tags applied to the stream.
|
||
@export var tags: Array[String]:
|
||
set(val):
|
||
tags = val
|
||
track_data(&"tags", val)
|
||
|
||
## A Boolean value that indicates whether the stream is meant for mature audiences.
|
||
@export var is_mature: bool:
|
||
set(val):
|
||
is_mature = val
|
||
track_data(&"is_mature", val)
|
||
var response: BufferedHTTPClient.ResponseData
|
||
|
||
|
||
## Constructor with all required fields.
|
||
static func create(_id: String, _user_id: String, _user_login: String, _user_name: String, _game_id: String, _game_name: String, _type: String, _title: String, _viewer_count: int, _started_at: String, _language: String, _thumbnail_url: String, _tag_ids: Array[String], _tags: Array[String], _is_mature: bool) -> TwitchStream:
|
||
var twitch_stream: TwitchStream = TwitchStream.new()
|
||
twitch_stream.id = _id
|
||
twitch_stream.user_id = _user_id
|
||
twitch_stream.user_login = _user_login
|
||
twitch_stream.user_name = _user_name
|
||
twitch_stream.game_id = _game_id
|
||
twitch_stream.game_name = _game_name
|
||
twitch_stream.type = _type
|
||
twitch_stream.title = _title
|
||
twitch_stream.viewer_count = _viewer_count
|
||
twitch_stream.started_at = _started_at
|
||
twitch_stream.language = _language
|
||
twitch_stream.thumbnail_url = _thumbnail_url
|
||
twitch_stream.tag_ids = _tag_ids
|
||
twitch_stream.tags = _tags
|
||
twitch_stream.is_mature = _is_mature
|
||
return twitch_stream
|
||
|
||
|
||
static func from_json(d: Dictionary) -> TwitchStream:
|
||
var result: TwitchStream = TwitchStream.new()
|
||
if d.get("id", null) != null:
|
||
result.id = d["id"]
|
||
if d.get("user_id", null) != null:
|
||
result.user_id = d["user_id"]
|
||
if d.get("user_login", null) != null:
|
||
result.user_login = d["user_login"]
|
||
if d.get("user_name", null) != null:
|
||
result.user_name = d["user_name"]
|
||
if d.get("game_id", null) != null:
|
||
result.game_id = d["game_id"]
|
||
if d.get("game_name", null) != null:
|
||
result.game_name = d["game_name"]
|
||
if d.get("type", null) != null:
|
||
result.type = d["type"]
|
||
if d.get("title", null) != null:
|
||
result.title = d["title"]
|
||
if d.get("viewer_count", null) != null:
|
||
result.viewer_count = d["viewer_count"]
|
||
if d.get("started_at", null) != null:
|
||
result.started_at = d["started_at"]
|
||
if d.get("language", null) != null:
|
||
result.language = d["language"]
|
||
if d.get("thumbnail_url", null) != null:
|
||
result.thumbnail_url = d["thumbnail_url"]
|
||
if d.get("tag_ids", null) != null:
|
||
for value in d["tag_ids"]:
|
||
result.tag_ids.append(value)
|
||
if d.get("tags", null) != null:
|
||
for value in d["tags"]:
|
||
result.tags.append(value)
|
||
if d.get("is_mature", null) != null:
|
||
result.is_mature = d["is_mature"]
|
||
return result
|