From 9bddc5d32d320e852d5febbd01c63023bd97dc59 Mon Sep 17 00:00:00 2001 From: kanimaru Date: Thu, 3 Sep 2026 00:58:59 +0200 Subject: [PATCH 1/2] feat: EventListener auto-subscribe, condition editor, example reorg TwitchEventListener now shows its subscription's conditions in the inspector (same UI as TwitchEventsubConfig, shared via a generalized condition/docs property editor) and can subscribe itself at runtime when the EventSub has no matching subscription yet and the conditions are filled. Subscription failures are now reported through TwitchEventsub's new subscription_created/subscription_failed signals and logged with TwitchLogger instead of silently failing. Also moves game_template and overlay_template out of example/ to the addon root, and renames credentials_on_demand/setup.* to cod_setup.*. Co-Authored-By: Claude Sonnet 5 --- .../twitch_event_listener_inspector.gd | 22 + .../twitch_event_listener_inspector.gd.uid | 1 + ... => twitch_eventsub_condition_property.gd} | 0 ...twitch_eventsub_condition_property.gd.uid} | 0 .../twitch_eventsub_config_inspector.gd | 26 +- .../twitch_eventsub_docs_property.gd | 23 + .../twitch_eventsub_docs_property.gd.uid | 1 + .../eventsub/twitch_event_listener.gd | 165 ++- addons/twitcher/eventsub/twitch_eventsub.gd | 24 +- .../twitcher/example/chat/eventsub_chat.tscn | 3 + .../{setup.gd => cod_setup.gd} | 0 .../{setup.gd.uid => cod_setup.gd.uid} | 0 .../{setup.tscn => cod_setup.tscn} | 2 +- .../game_template/device_code_request.gd | 0 .../game_template/device_code_request.gd.uid | 0 .../game_template/device_code_request.tscn | 2 +- .../game_template/game_template.tscn | 6 +- .../game_template_oauth_settings.tres | 0 .../game_template_oauth_token.tres | 0 .../game_template/twitcher_devicecode.gd | 0 .../game_template/twitcher_devicecode.gd.uid | 0 addons/twitcher/generated/twitch_api.gd | 1013 ++++++++--------- .../overlay_template/chat_controller.gd | 0 .../overlay_template/chat_controller.gd.uid | 0 .../overlay_template/chat_controller.tscn | 4 +- .../overlay_template/cheermote.gd | 0 .../overlay_template/cheermote.gd.uid | 0 .../overlay_template/cheermote.tscn | 2 +- .../overlay_template/event_listener.gd | 8 +- .../overlay_template/event_listener.gd.uid | 0 .../overlay_template/moveable_control.gd | 0 .../overlay_template/moveable_control.gd.uid | 0 .../overlay_template/notification.gd | 0 .../overlay_template/notification.gd.uid | 0 .../overlay_template/notification.tscn | 2 +- .../overlay_template/overlay_template.gd | 0 .../overlay_template/overlay_template.gd.uid | 0 .../overlay_template/overlay_template.tscn | 6 +- addons/twitcher/plugin.gd | 4 + .../twitcher/reward/twitch_redeem_listener.gd | 22 +- .../eventsub/test_twitch_event_listener.gd | 172 +++ .../test_twitch_event_listener.gd.uid | 1 + twitch_default_user.tres | 13 + twitch_oauth_token.tres | 7 + 44 files changed, 946 insertions(+), 583 deletions(-) create mode 100644 addons/twitcher/editor/inspector/twitch_event_listener_inspector.gd create mode 100644 addons/twitcher/editor/inspector/twitch_event_listener_inspector.gd.uid rename addons/twitcher/editor/inspector/{twitch_eventsub_config_property.gd => twitch_eventsub_condition_property.gd} (100%) rename addons/twitcher/editor/inspector/{twitch_eventsub_config_property.gd.uid => twitch_eventsub_condition_property.gd.uid} (100%) create mode 100644 addons/twitcher/editor/inspector/twitch_eventsub_docs_property.gd create mode 100644 addons/twitcher/editor/inspector/twitch_eventsub_docs_property.gd.uid rename addons/twitcher/example/credentials_on_demand/{setup.gd => cod_setup.gd} (100%) rename addons/twitcher/example/credentials_on_demand/{setup.gd.uid => cod_setup.gd.uid} (100%) rename addons/twitcher/example/credentials_on_demand/{setup.tscn => cod_setup.tscn} (98%) rename addons/twitcher/{example => }/game_template/device_code_request.gd (100%) rename addons/twitcher/{example => }/game_template/device_code_request.gd.uid (100%) rename addons/twitcher/{example => }/game_template/device_code_request.tscn (98%) rename addons/twitcher/{example => }/game_template/game_template.tscn (89%) rename addons/twitcher/{example => }/game_template/game_template_oauth_settings.tres (100%) rename addons/twitcher/{example => }/game_template/game_template_oauth_token.tres (100%) rename addons/twitcher/{example => }/game_template/twitcher_devicecode.gd (100%) rename addons/twitcher/{example => }/game_template/twitcher_devicecode.gd.uid (100%) rename addons/twitcher/{example => }/overlay_template/chat_controller.gd (100%) rename addons/twitcher/{example => }/overlay_template/chat_controller.gd.uid (100%) rename addons/twitcher/{example => }/overlay_template/chat_controller.tscn (90%) rename addons/twitcher/{example => }/overlay_template/cheermote.gd (100%) rename addons/twitcher/{example => }/overlay_template/cheermote.gd.uid (100%) rename addons/twitcher/{example => }/overlay_template/cheermote.tscn (90%) rename addons/twitcher/{example => }/overlay_template/event_listener.gd (93%) rename addons/twitcher/{example => }/overlay_template/event_listener.gd.uid (100%) rename addons/twitcher/{example => }/overlay_template/moveable_control.gd (100%) rename addons/twitcher/{example => }/overlay_template/moveable_control.gd.uid (100%) rename addons/twitcher/{example => }/overlay_template/notification.gd (100%) rename addons/twitcher/{example => }/overlay_template/notification.gd.uid (100%) rename addons/twitcher/{example => }/overlay_template/notification.tscn (96%) rename addons/twitcher/{example => }/overlay_template/overlay_template.gd (100%) rename addons/twitcher/{example => }/overlay_template/overlay_template.gd.uid (100%) rename addons/twitcher/{example => }/overlay_template/overlay_template.tscn (96%) create mode 100644 test/unit/eventsub/test_twitch_event_listener.gd create mode 100644 test/unit/eventsub/test_twitch_event_listener.gd.uid create mode 100644 twitch_default_user.tres create mode 100644 twitch_oauth_token.tres diff --git a/addons/twitcher/editor/inspector/twitch_event_listener_inspector.gd b/addons/twitcher/editor/inspector/twitch_event_listener_inspector.gd new file mode 100644 index 00000000..8a80b069 --- /dev/null +++ b/addons/twitcher/editor/inspector/twitch_event_listener_inspector.gd @@ -0,0 +1,22 @@ +extends EditorInspectorPlugin + +## Shows the conditions of the selected subscription on a [TwitchEventListener] the same way +## as the [TwitchEventsubConfig] does. + +const EventsubConditionProperty = preload("res://addons/twitcher/editor/inspector/twitch_eventsub_condition_property.gd") +const EventsubDocsProperty = preload("res://addons/twitcher/editor/inspector/twitch_eventsub_docs_property.gd") + +func _can_handle(object: Object) -> bool: + return object is TwitchEventListener + + +func _parse_property(object: Object, type: Variant.Type, name: String, \ + hint_type: PropertyHint, hint_string: String, usage_flags: int, \ + wide: bool) -> bool: + + if name == &"condition": + add_property_editor("condition", EventsubConditionProperty.new(), true) + return true + if name == &"subscription": + add_property_editor("subscription", EventsubDocsProperty.new(), true, "Documentation") + return false diff --git a/addons/twitcher/editor/inspector/twitch_event_listener_inspector.gd.uid b/addons/twitcher/editor/inspector/twitch_event_listener_inspector.gd.uid new file mode 100644 index 00000000..e11b07f5 --- /dev/null +++ b/addons/twitcher/editor/inspector/twitch_event_listener_inspector.gd.uid @@ -0,0 +1 @@ +uid://cl0wxb5me4gro diff --git a/addons/twitcher/editor/inspector/twitch_eventsub_config_property.gd b/addons/twitcher/editor/inspector/twitch_eventsub_condition_property.gd similarity index 100% rename from addons/twitcher/editor/inspector/twitch_eventsub_config_property.gd rename to addons/twitcher/editor/inspector/twitch_eventsub_condition_property.gd diff --git a/addons/twitcher/editor/inspector/twitch_eventsub_config_property.gd.uid b/addons/twitcher/editor/inspector/twitch_eventsub_condition_property.gd.uid similarity index 100% rename from addons/twitcher/editor/inspector/twitch_eventsub_config_property.gd.uid rename to addons/twitcher/editor/inspector/twitch_eventsub_condition_property.gd.uid diff --git a/addons/twitcher/editor/inspector/twitch_eventsub_config_inspector.gd b/addons/twitcher/editor/inspector/twitch_eventsub_config_inspector.gd index 57b02dff..8852b659 100644 --- a/addons/twitcher/editor/inspector/twitch_eventsub_config_inspector.gd +++ b/addons/twitcher/editor/inspector/twitch_eventsub_config_inspector.gd @@ -1,6 +1,7 @@ extends EditorInspectorPlugin -const EventsubConfigProperty = preload("res://addons/twitcher/editor/inspector/twitch_eventsub_config_property.gd") +const EventsubConditionProperty = preload("res://addons/twitcher/editor/inspector/twitch_eventsub_condition_property.gd") +const EventsubDocsProperty = preload("res://addons/twitcher/editor/inspector/twitch_eventsub_docs_property.gd") func _can_handle(object: Object) -> bool: return object is TwitchEventsubConfig @@ -11,27 +12,8 @@ func _parse_property(object: Object, type: Variant.Type, name: String, \ wide: bool) -> bool: if name == &"condition": - add_property_editor("condition", EventsubConfigProperty.new(), true) + add_property_editor("condition", EventsubConditionProperty.new(), true) return true if name == &"type": - add_property_editor("type", ToDocs.new(), true, "Documentation") + add_property_editor("type", EventsubDocsProperty.new(), true, "Documentation") return false - - -class ToDocs extends EditorProperty: - const EXT_LINK = preload("res://addons/twitcher/assets/ext-link.svg") - - var docs = Button.new() - - - func _init() -> void: - docs.text = "To dev.twitch.tv" - docs.icon = EXT_LINK - docs.pressed.connect(_on_to_docs) - add_child(docs) - add_focusable(docs) - - - func _on_to_docs() -> void: - var eventsub_config: TwitchEventsubConfig = get_edited_object() - OS.shell_open(eventsub_config.definition.documentation_link) diff --git a/addons/twitcher/editor/inspector/twitch_eventsub_docs_property.gd b/addons/twitcher/editor/inspector/twitch_eventsub_docs_property.gd new file mode 100644 index 00000000..e8c295bc --- /dev/null +++ b/addons/twitcher/editor/inspector/twitch_eventsub_docs_property.gd @@ -0,0 +1,23 @@ +extends EditorProperty + +## Button that opens the Twitch documentation of the currently selected subscription. +## Works for every object that provides the [TwitchEventsubDefinition] via `definition`. +## (See [TwitchEventsubConfig] and [TwitchEventListener]) + +const EXT_LINK = preload("res://addons/twitcher/assets/ext-link.svg") + +var docs = Button.new() + + +func _init() -> void: + docs.text = "To dev.twitch.tv" + docs.icon = EXT_LINK + docs.pressed.connect(_on_to_docs) + add_child(docs) + add_focusable(docs) + + +func _on_to_docs() -> void: + var target: Object = get_edited_object() + if target == null || target.get_class() == &"EditorDebuggerRemoteObject": return + OS.shell_open(target.definition.documentation_link) diff --git a/addons/twitcher/editor/inspector/twitch_eventsub_docs_property.gd.uid b/addons/twitcher/editor/inspector/twitch_eventsub_docs_property.gd.uid new file mode 100644 index 00000000..a959b727 --- /dev/null +++ b/addons/twitcher/editor/inspector/twitch_eventsub_docs_property.gd.uid @@ -0,0 +1 @@ +uid://dahjdi0pa3vhb diff --git a/addons/twitcher/eventsub/twitch_event_listener.gd b/addons/twitcher/eventsub/twitch_event_listener.gd index 46c9f45e..96c402b4 100644 --- a/addons/twitcher/eventsub/twitch_event_listener.gd +++ b/addons/twitcher/eventsub/twitch_event_listener.gd @@ -5,8 +5,11 @@ extends Twitcher ## Listens to an event and publishes it as signal. ## Usage for easy access of events on test and normal eventsub makes it more obvious what a scene ## is listening before diving in the code. - -## [b]Expects that the signal was already configured in the eventsub or manually subscribed[/b] +## +## The conditions that are needed are defined by the selected [member subscription]. When they are +## filled this node subscribes on its own in case the [TwitchEventsub] doesn't have a fitting +## subscription yet. Otherwise the subscription has to be configured on the [TwitchEventsub] or +## made manually. class_name TwitchEventListener static var _log : TwitchLogger = TwitchLogger.new("TwitchEventListener") @@ -14,14 +17,30 @@ static var _log : TwitchLogger = TwitchLogger.new("TwitchEventListener") @export var eventsub: TwitchEventsub: set = _update_eventsub -## The subscription to listen for (needs to be subscribed by the eventsub node) +## The subscription to listen for. Determines which conditions are needed. @export var subscription: TwitchEventsubDefinition.Type: - set(val): - subscription = val - subscription_definition = TwitchEventsubDefinition.ALL[subscription] - update_configuration_warnings() + set = _update_subscription + +## Conditions to subscribe with. Which conditions are available is defined by the +## [member subscription]. Only used when the [TwitchEventsub] has no fitting subscription yet. +@export var condition: Dictionary = {}: + set = _update_condition + +## Subscribes on ready when the [TwitchEventsub] has no fitting subscription and the +## [member condition] is completely filled. +@export var ensure_subscription_on_ready: bool = true -var subscription_definition: TwitchEventsubDefinition +## Definition of the currently selected [member subscription] +var definition: TwitchEventsubDefinition: + get(): return TwitchEventsubDefinition.ALL[subscription] + +## Definition of the currently selected [member subscription] +## [i]Deprecated: use [member definition] instead[/i] +var subscription_definition: TwitchEventsubDefinition: + get(): return definition + +## Subscription that got created by this node. Null when it didn't subscribe on its own. +var _own_subscription: TwitchEventsubConfig ## Called when the event got received @@ -29,9 +48,12 @@ signal received(data: Dictionary) ## Called when the event got received, with the eventsub data parsed into an object signal typed_data_received(data: Variant) + func _ready() -> void: + # The setter connects to the eventsub if eventsub == null: eventsub = TwitchEventsub.instance - _update_eventsub(eventsub) + if Engine.is_editor_hint(): return + if ensure_subscription_on_ready: ensure_subscription() func _enter_tree() -> void: @@ -43,41 +65,136 @@ func _exit_tree() -> void: func start_listening() -> void: - _ensure_subscription_definition() - _log.d("start listening %s" % subscription_definition.get_readable_name()) - if eventsub != null && not eventsub.event_received.is_connected(_on_received): + if eventsub == null: return + _log.d("start listening %s" % definition.get_readable_name()) + if not eventsub.event_received.is_connected(_on_received): eventsub.event_received.connect(_on_received) + if not eventsub.subscription_failed.is_connected(_on_subscription_failed): + eventsub.subscription_failed.connect(_on_subscription_failed) func stop_listening() -> void: - _ensure_subscription_definition() - _log.d("stop listening %s" % subscription_definition.get_readable_name()) - if eventsub != null && eventsub.event_received.is_connected(_on_received): + if eventsub == null: return + _log.d("stop listening %s" % definition.get_readable_name()) + if eventsub.event_received.is_connected(_on_received): eventsub.event_received.disconnect(_on_received) + if eventsub.subscription_failed.is_connected(_on_subscription_failed): + eventsub.subscription_failed.disconnect(_on_subscription_failed) + + +## Ensures that the [TwitchEventsub] has a subscription that this node can listen to. +## Subscribes on its own when the conditions are filled. Logs an error when there is no +## subscription and none could be created. +func ensure_subscription() -> void: + if eventsub == null: + _log.e("Can't listen to '%s'. No TwitchEventsub found. Assign one or add a TwitchEventsub to the scene tree." % definition.get_readable_name()) + return + + var conditions: Dictionary = get_conditions() + if _find_subscription(conditions) != null: + _log.d("Subscription for '%s' exists already." % definition.get_readable_name()) + return + + var missing_conditions: Array[StringName] = get_missing_conditions() + if not missing_conditions.is_empty(): + if not eventsub.get_subscription_by_type(subscription).is_empty(): + # Subscribed with other conditions. Someone configured it on purpose, so it's fine. + _log.d("Subscription for '%s' is configured with other conditions." % definition.get_readable_name()) + return + _log.e("Can't listen to '%s'. The TwitchEventsub has no subscription for it and this listener can't subscribe on its own, cause following conditions are missing: [%s]" % [definition.get_readable_name(), ", ".join(missing_conditions)]) + return + + _subscribe(conditions) + + +## All conditions of the [member subscription] that have no value yet. +func get_missing_conditions() -> Array[StringName]: + var result: Array[StringName] = [] + var conditions: Dictionary = get_conditions() + for condition_key: StringName in definition.conditions: + if str(conditions.get(condition_key, "")).is_empty(): + result.append(condition_key) + return result + + +## Conditions that are used to subscribe. Resolves the users that got selected within the editor. +func get_conditions() -> Dictionary: + var result: Dictionary = {} + for condition_key: StringName in definition.conditions: + if has_meta(condition_key + "_user"): + var user: TwitchUser = get_meta(condition_key + "_user") + result[condition_key] = user.id + else: + result[condition_key] = str(condition.get(condition_key, "")) + return result + + +func _subscribe(conditions: Dictionary) -> void: + _log.i("No subscription for '%s' found. Subscribing with %s." % [definition.get_readable_name(), conditions]) + _own_subscription = TwitchEventsubConfig.create(definition, conditions) + eventsub.subscribe(_own_subscription) -func _ensure_subscription_definition() -> void: - if subscription_definition == null: - subscription_definition = TwitchEventsubDefinition.ALL[subscription] +## Searches a subscription on the eventsub that fits to the given conditions. Returns the config when found or null. +func _find_subscription(conditions: Dictionary) -> TwitchEventsubConfig: + for config: TwitchEventsubConfig in eventsub.get_subscription_by_type(subscription): + if _normalize_conditions(config.get_conditions()) == _normalize_conditions(conditions): + return config + return null -func _update_eventsub(val: TwitchEventsub): +## Brings the conditions into a comparable form. (Keys can be String or StringName) +func _normalize_conditions(conditions: Dictionary) -> Dictionary: + var result: Dictionary = {} + for key: Variant in conditions: + result[str(key)] = str(conditions[key]) + return result + + +func _update_eventsub(val: TwitchEventsub) -> void: stop_listening() eventsub = val update_configuration_warnings() - if val == null: return start_listening() -func _on_received(event: TwitchEventsub.Event): - if event.type == subscription_definition: +func _update_subscription(val: TwitchEventsubDefinition.Type) -> void: + if subscription == val: return + subscription = val + # Keep the values of the conditions that the new subscription needs too + var new_condition: Dictionary = {} + for condition_key: StringName in definition.conditions: + new_condition[condition_key] = condition.get(condition_key, "") + condition = new_condition + update_configuration_warnings() + notify_property_list_changed() + + +func _update_condition(val: Dictionary) -> void: + condition = val + update_configuration_warnings() + + +func _on_received(event: TwitchEventsub.Event) -> void: + if event.type == definition: + var event_conditions: Dictionary = event.get_condition() + # Has special conditions + if _own_subscription and _normalize_conditions(condition) != _normalize_conditions(event_conditions): + return + # Need for backward compatibility received.emit(event.data) typed_data_received.emit(event.typed_data) +func _on_subscription_failed(failed_subscription: TwitchEventsubConfig, reason: String) -> void: + if failed_subscription != _own_subscription: return + _log.e("Can't listen to '%s'. The subscription failed: %s" % [definition.get_readable_name(), reason]) + + func _get_configuration_warnings() -> PackedStringArray: var result: PackedStringArray = [] - if subscription == null: - result.append("'Subscription' is missing") + var missing_conditions: Array[StringName] = get_missing_conditions() + if not missing_conditions.is_empty(): + result.append("Conditions [%s] are empty. This node can only receive events when the TwitchEventsub is already subscribed to '%s'." % [", ".join(missing_conditions), definition.get_readable_name()]) return result diff --git a/addons/twitcher/eventsub/twitch_eventsub.gd b/addons/twitcher/eventsub/twitch_eventsub.gd index 0c4b96f5..32ffd64a 100644 --- a/addons/twitcher/eventsub/twitch_eventsub.gd +++ b/addons/twitcher/eventsub/twitch_eventsub.gd @@ -64,6 +64,10 @@ class Event extends RefCounted: func _init(notification_message: TwitchNotificationMessage) -> void: message = notification_message + + + func get_condition() -> Dictionary: + return message.payload.subscription.condition ## Will be send as soon as the websocket connection is up and running you can use it to subscribe to events @@ -82,6 +86,12 @@ signal events_revoked(type: StringName, status: String) ## Called when any eventsub message is received for low level access signal message_received(message: Variant) +## Called when a subscription got established at Twitch. +signal subscription_created(subscription: TwitchEventsubConfig) + +## Called when a subscription couldn't be established at Twitch. Reason contains a readable message. +signal subscription_failed(subscription: TwitchEventsubConfig, reason: String) + ## The api used to create the subscriptions (Can be empty will automatically look for first [TwitchAPI] in the ## scene tree) @@ -291,24 +301,32 @@ func _subscribe(subscription: TwitchEventsubConfig) -> String: var eventsub_response = await api.create_eventsub_subscription(data) if eventsub_response.response.response_code == 401: - _log.e("Subscription failed for '%s': Missing authentication for eventsub. The token got not authenticated yet. Please login!" % data.type) + var reason: String = "Missing authentication for eventsub. The token got not authenticated yet. Please login!" + _log.e("Subscription failed for '%s': %s" % [data.type, reason]) + subscription_failed.emit(subscription, reason) _client.close(3000, "Missing Authentication") return "" elif eventsub_response.response.response_code == 403: - _log.e("Subscription failed for '%s': The token is missing proper scopes. [url='%s']Please check documentation[/url]!" % [data.type, subscription.definition.documentation_link]) + var reason: String = "The token is missing proper scopes. [url='%s']Please check documentation[/url]!" % subscription.definition.documentation_link + _log.e("Subscription failed for '%s': %s" % [data.type, reason]) _log.d(eventsub_response.response.response_data.get_string_from_utf8()) + subscription_failed.emit(subscription, reason) _client.close(3003, "Missing Authorization") return "" if eventsub_response.response.response_code < 200 || eventsub_response.response.response_code >= 300: - _log.e("Subscription failed for '%s'. Unknown error %s: %s" % [data.type, eventsub_response.response.response_code, eventsub_response.response.response_data.get_string_from_utf8()]) + var reason: String = "Unknown error %s: %s" % [eventsub_response.response.response_code, eventsub_response.response.response_data.get_string_from_utf8()] + _log.e("Subscription failed for '%s'. %s" % [data.type, reason]) + subscription_failed.emit(subscription, reason) return "" elif eventsub_response.response.response_data.is_empty(): + subscription_failed.emit(subscription, "Twitch responded without any subscription data.") return "" _log.i("Now listening to '%s' events." % data.type) var result = JSON.parse_string(eventsub_response.response.response_data.get_string_from_utf8()) var subscription_id = result.data[0].id subscription.id = subscription_id + subscription_created.emit(subscription) return subscription_id diff --git a/addons/twitcher/example/chat/eventsub_chat.tscn b/addons/twitcher/example/chat/eventsub_chat.tscn index b05c7921..d8197655 100644 --- a/addons/twitcher/example/chat/eventsub_chat.tscn +++ b/addons/twitcher/example/chat/eventsub_chat.tscn @@ -17,6 +17,7 @@ [ext_resource type="Script" uid="uid://ddwa0dm0qhc3s" path="res://addons/twitcher/media/native_image_transformer.gd" id="14_jftlh"] [ext_resource type="Script" uid="uid://dcq1bvfrqimqq" path="res://addons/twitcher/chat/twitch_chat.gd" id="15_jftlh"] [ext_resource type="Script" uid="uid://bf3mvh373suhc" path="res://addons/twitcher/chat/twitch_bot.gd" id="15_pbrhu"] +[ext_resource type="Resource" uid="uid://cyswa57028iwc" path="res://twitch_default_user.tres" id="16_63ovb"] [ext_resource type="Resource" uid="uid://c4scwuk8q0r40" path="res://addons/twitcher/lib/oOuch/default_key_provider.tres" id="16_dvnvn"] [ext_resource type="Script" uid="uid://b52xp7c23ucfk" path="res://addons/twitcher/lib/oOuch/oauth_token.gd" id="17_04pvb"] [ext_resource type="Script" uid="uid://cnmohrdxqihr0" path="res://addons/twitcher/generated/twitch_user.gd" id="18_ctuqi"] @@ -134,6 +135,8 @@ metadata/_custom_type_script = "uid://bmluckfvgm1c2" [node name="TwitchChat" type="Node" parent="." unique_id=33770585 node_paths=PackedStringArray("media_loader", "eventsub", "api")] unique_name_in_owner = true script = ExtResource("15_jftlh") +broadcaster_user = ExtResource("16_63ovb") +sender_user = ExtResource("16_63ovb") media_loader = NodePath("../TwitchService/MediaLoader") eventsub = NodePath("../TwitchService/EventSub") api = NodePath("../TwitchService/API") diff --git a/addons/twitcher/example/credentials_on_demand/setup.gd b/addons/twitcher/example/credentials_on_demand/cod_setup.gd similarity index 100% rename from addons/twitcher/example/credentials_on_demand/setup.gd rename to addons/twitcher/example/credentials_on_demand/cod_setup.gd diff --git a/addons/twitcher/example/credentials_on_demand/setup.gd.uid b/addons/twitcher/example/credentials_on_demand/cod_setup.gd.uid similarity index 100% rename from addons/twitcher/example/credentials_on_demand/setup.gd.uid rename to addons/twitcher/example/credentials_on_demand/cod_setup.gd.uid diff --git a/addons/twitcher/example/credentials_on_demand/setup.tscn b/addons/twitcher/example/credentials_on_demand/cod_setup.tscn similarity index 98% rename from addons/twitcher/example/credentials_on_demand/setup.tscn rename to addons/twitcher/example/credentials_on_demand/cod_setup.tscn index 8e9d1764..d4e2d818 100644 --- a/addons/twitcher/example/credentials_on_demand/setup.tscn +++ b/addons/twitcher/example/credentials_on_demand/cod_setup.tscn @@ -1,6 +1,6 @@ [gd_scene format=3 uid="uid://cyni4hy8v8f5c"] -[ext_resource type="Script" uid="uid://baeg2dog7gy6g" path="res://addons/twitcher/example/credentials_on_demand/setup.gd" id="1_neslu"] +[ext_resource type="Script" uid="uid://baeg2dog7gy6g" path="res://addons/twitcher/example/credentials_on_demand/cod_setup.gd" id="1_neslu"] [ext_resource type="Script" uid="uid://iv0mgv0lu8b0" path="res://addons/twitcher/auth/twitch_auth.gd" id="2_0sosk"] [ext_resource type="Script" uid="uid://dm3xt5ctaxtcy" path="res://addons/twitcher/example/credentials_on_demand/auth.gd" id="2_7cjj4"] [ext_resource type="PackedScene" uid="uid://cfe0kxk8dptag" path="res://addons/twitcher/example/chat_view.tscn" id="3_inbm6"] diff --git a/addons/twitcher/example/game_template/device_code_request.gd b/addons/twitcher/game_template/device_code_request.gd similarity index 100% rename from addons/twitcher/example/game_template/device_code_request.gd rename to addons/twitcher/game_template/device_code_request.gd diff --git a/addons/twitcher/example/game_template/device_code_request.gd.uid b/addons/twitcher/game_template/device_code_request.gd.uid similarity index 100% rename from addons/twitcher/example/game_template/device_code_request.gd.uid rename to addons/twitcher/game_template/device_code_request.gd.uid diff --git a/addons/twitcher/example/game_template/device_code_request.tscn b/addons/twitcher/game_template/device_code_request.tscn similarity index 98% rename from addons/twitcher/example/game_template/device_code_request.tscn rename to addons/twitcher/game_template/device_code_request.tscn index 70f43b2c..3e302574 100644 --- a/addons/twitcher/example/game_template/device_code_request.tscn +++ b/addons/twitcher/game_template/device_code_request.tscn @@ -1,7 +1,7 @@ [gd_scene format=3 uid="uid://d0sdt48uvm1xq"] [ext_resource type="Theme" uid="uid://d145ou7bj00tv" path="res://addons/twitcher/assets/twitcher_theme.tres" id="1_5wvjt"] -[ext_resource type="Script" uid="uid://pcxtxepgjdgg" path="res://addons/twitcher/example/game_template/device_code_request.gd" id="1_hivqr"] +[ext_resource type="Script" uid="uid://pcxtxepgjdgg" path="res://addons/twitcher/game_template/device_code_request.gd" id="1_hivqr"] [sub_resource type="SystemFont" id="SystemFont_hivqr"] font_names = PackedStringArray("Monospace") diff --git a/addons/twitcher/example/game_template/game_template.tscn b/addons/twitcher/game_template/game_template.tscn similarity index 89% rename from addons/twitcher/example/game_template/game_template.tscn rename to addons/twitcher/game_template/game_template.tscn index 66c81c54..0ae48147 100644 --- a/addons/twitcher/example/game_template/game_template.tscn +++ b/addons/twitcher/game_template/game_template.tscn @@ -2,9 +2,9 @@ [ext_resource type="PackedScene" uid="uid://djt5lvmwxbq4a" path="res://addons/twitcher/twitch_service.tscn" id="1_muumb"] [ext_resource type="Resource" uid="uid://3dm6ts8hwlys" path="res://addons/twitcher/auth/preset_game_scopes.tres" id="2_56l04"] -[ext_resource type="Resource" uid="uid://c5jqrbtqy5tkr" path="res://addons/twitcher/example/game_template/game_template_oauth_settings.tres" id="2_aht6s"] -[ext_resource type="Resource" uid="uid://ddrqchmiend4e" path="res://addons/twitcher/example/game_template/game_template_oauth_token.tres" id="3_aht6s"] -[ext_resource type="Script" uid="uid://fmtyexdlsy0x" path="res://addons/twitcher/example/game_template/twitcher_devicecode.gd" id="4_n7r82"] +[ext_resource type="Resource" uid="uid://c5jqrbtqy5tkr" path="res://addons/twitcher/game_template/game_template_oauth_settings.tres" id="2_aht6s"] +[ext_resource type="Resource" uid="uid://ddrqchmiend4e" path="res://addons/twitcher/game_template/game_template_oauth_token.tres" id="3_aht6s"] +[ext_resource type="Script" uid="uid://fmtyexdlsy0x" path="res://addons/twitcher/game_template/twitcher_devicecode.gd" id="4_n7r82"] [sub_resource type="LabelSettings" id="LabelSettings_lhtpo"] font_size = 40 diff --git a/addons/twitcher/example/game_template/game_template_oauth_settings.tres b/addons/twitcher/game_template/game_template_oauth_settings.tres similarity index 100% rename from addons/twitcher/example/game_template/game_template_oauth_settings.tres rename to addons/twitcher/game_template/game_template_oauth_settings.tres diff --git a/addons/twitcher/example/game_template/game_template_oauth_token.tres b/addons/twitcher/game_template/game_template_oauth_token.tres similarity index 100% rename from addons/twitcher/example/game_template/game_template_oauth_token.tres rename to addons/twitcher/game_template/game_template_oauth_token.tres diff --git a/addons/twitcher/example/game_template/twitcher_devicecode.gd b/addons/twitcher/game_template/twitcher_devicecode.gd similarity index 100% rename from addons/twitcher/example/game_template/twitcher_devicecode.gd rename to addons/twitcher/game_template/twitcher_devicecode.gd diff --git a/addons/twitcher/example/game_template/twitcher_devicecode.gd.uid b/addons/twitcher/game_template/twitcher_devicecode.gd.uid similarity index 100% rename from addons/twitcher/example/game_template/twitcher_devicecode.gd.uid rename to addons/twitcher/game_template/twitcher_devicecode.gd.uid diff --git a/addons/twitcher/generated/twitch_api.gd b/addons/twitcher/generated/twitch_api.gd index 15f6e527..b405d9ab 100644 --- a/addons/twitcher/generated/twitch_api.gd +++ b/addons/twitcher/generated/twitch_api.gd @@ -135,7 +135,7 @@ static func get_rfc_3339_date_format(time: Variant) -> String: ## https://dev.twitch.tv/docs/api/reference#start-commercial func start_commercial(body: TwitchStartCommercial.Body) -> TwitchStartCommercial.Response: var path: String = "/channels/commercial?" - + var response: BufferedHTTPClient.ResponseData = await request(path, HTTPClient.METHOD_POST, body, "application/json") var result: Variant = {} @@ -146,19 +146,19 @@ func start_commercial(body: TwitchStartCommercial.Body) -> TwitchStartCommercial var parsed_result: TwitchStartCommercial.Response = TwitchStartCommercial.Response.from_json(result) parsed_result.response = response - + return parsed_result ## Returns ad schedule related information. ## -## broadcaster_id - Provided `broadcaster_id` must match the `user_id` in the auth token. +## broadcaster_id - Provided `broadcaster_id` must match the `user_id` in the auth token. ## ## https://dev.twitch.tv/docs/api/reference#get-ad-schedule func get_ad_schedule(broadcaster_id: String) -> TwitchGetAdSchedule.Response: var path: String = "/channels/ads?" path += "broadcaster_id=" + str(broadcaster_id) + "&" - + var response: BufferedHTTPClient.ResponseData = await request(path, HTTPClient.METHOD_GET, "", "") var result: Variant = {} @@ -169,19 +169,19 @@ func get_ad_schedule(broadcaster_id: String) -> TwitchGetAdSchedule.Response: var parsed_result: TwitchGetAdSchedule.Response = TwitchGetAdSchedule.Response.from_json(result) parsed_result.response = response - + return parsed_result ## Pushes back the timestamp of the upcoming automatic mid-roll ad by 5 minutes. ## -## broadcaster_id - Provided `broadcaster_id` must match the `user_id` in the auth token. +## broadcaster_id - Provided `broadcaster_id` must match the `user_id` in the auth token. ## ## https://dev.twitch.tv/docs/api/reference#snooze-next-ad func snooze_next_ad(broadcaster_id: String) -> TwitchSnoozeNextAd.Response: var path: String = "/channels/ads/schedule/snooze?" path += "broadcaster_id=" + str(broadcaster_id) + "&" - + var response: BufferedHTTPClient.ResponseData = await request(path, HTTPClient.METHOD_POST, "", "") var result: Variant = {} @@ -192,7 +192,7 @@ func snooze_next_ad(broadcaster_id: String) -> TwitchSnoozeNextAd.Response: var parsed_result: TwitchSnoozeNextAd.Response = TwitchSnoozeNextAd.Response.from_json(result) parsed_result.response = response - + return parsed_result @@ -217,7 +217,7 @@ func get_extension_analytics(opt: TwitchGetExtensionAnalytics.Opt) -> TwitchGetE path += "started_at=" + get_rfc_3339_date_format(optionals.started_at) + "&" if optionals.has("type"): path += "type=" + str(optionals.type) + "&" - + var response: BufferedHTTPClient.ResponseData = await request(path, HTTPClient.METHOD_GET, "", "") var result: Variant = {} @@ -233,7 +233,7 @@ func get_extension_analytics(opt: TwitchGetExtensionAnalytics.Opt) -> TwitchGetE if not opt: opt = TwitchGetExtensionAnalytics.Opt.new() opt.after = cursor parsed_result._next_page = get_extension_analytics.bind(opt) - + return parsed_result @@ -258,7 +258,7 @@ func get_game_analytics(opt: TwitchGetGameAnalytics.Opt) -> TwitchGetGameAnalyti path += "started_at=" + get_rfc_3339_date_format(optionals.started_at) + "&" if optionals.has("type"): path += "type=" + str(optionals.type) + "&" - + var response: BufferedHTTPClient.ResponseData = await request(path, HTTPClient.METHOD_GET, "", "") var result: Variant = {} @@ -274,7 +274,7 @@ func get_game_analytics(opt: TwitchGetGameAnalytics.Opt) -> TwitchGetGameAnalyti if not opt: opt = TwitchGetGameAnalytics.Opt.new() opt.after = cursor parsed_result._next_page = get_game_analytics.bind(opt) - + return parsed_result @@ -295,7 +295,7 @@ func get_bits_leaderboard(opt: TwitchGetBitsLeaderboard.Opt) -> TwitchGetBitsLea path += "started_at=" + get_rfc_3339_date_format(optionals.started_at) + "&" if optionals.has("user_id"): path += "user_id=" + str(optionals.user_id) + "&" - + var response: BufferedHTTPClient.ResponseData = await request(path, HTTPClient.METHOD_GET, "", "") var result: Variant = {} @@ -306,7 +306,7 @@ func get_bits_leaderboard(opt: TwitchGetBitsLeaderboard.Opt) -> TwitchGetBitsLea var parsed_result: TwitchGetBitsLeaderboard.Response = TwitchGetBitsLeaderboard.Response.from_json(result) parsed_result.response = response - + return parsed_result @@ -321,7 +321,7 @@ func get_cheermotes(opt: TwitchGetCheermotes.Opt) -> TwitchGetCheermotes.Respons if opt != null: optionals = opt.to_dict() if optionals.has("broadcaster_id"): path += "broadcaster_id=" + str(optionals.broadcaster_id) + "&" - + var response: BufferedHTTPClient.ResponseData = await request(path, HTTPClient.METHOD_GET, "", "") var result: Variant = {} @@ -332,13 +332,13 @@ func get_cheermotes(opt: TwitchGetCheermotes.Opt) -> TwitchGetCheermotes.Respons var parsed_result: TwitchGetCheermotes.Response = TwitchGetCheermotes.Response.from_json(result) parsed_result.response = response - + return parsed_result ## Gets an extension’s list of transactions. ## -## extension_id - The ID of the extension whose list of transactions you want to get. +## extension_id - The ID of the extension whose list of transactions you want to get. ## ## https://dev.twitch.tv/docs/api/reference#get-extension-transactions func get_extension_transactions(opt: TwitchGetExtensionTransactions.Opt, extension_id: String) -> TwitchGetExtensionTransactions.Response: @@ -351,10 +351,10 @@ func get_extension_transactions(opt: TwitchGetExtensionTransactions.Opt, extensi if optionals.has("first"): path += "first=" + str(optionals.first) + "&" if optionals.has("id"): - + for param in optionals.id: - path += "id=" + str(param) + "&" - + path += "id=" + str(param) + "&" + var response: BufferedHTTPClient.ResponseData = await request(path, HTTPClient.METHOD_GET, "", "") var result: Variant = {} @@ -370,21 +370,21 @@ func get_extension_transactions(opt: TwitchGetExtensionTransactions.Opt, extensi if not opt: opt = TwitchGetExtensionTransactions.Opt.new() opt.after = cursor parsed_result._next_page = get_extension_transactions.bind(opt, extension_id) - + return parsed_result ## Gets information about one or more channels. ## -## broadcaster_id - The ID of the broadcaster whose channel you want to get. To specify more than one ID, include this parameter for each broadcaster you want to get. For example, `broadcaster_id=1234&broadcaster_id=5678`. You may specify a maximum of 100 IDs. The API ignores duplicate IDs and IDs that are not found. +## broadcaster_id - The ID of the broadcaster whose channel you want to get. To specify more than one ID, include this parameter for each broadcaster you want to get. For example, `broadcaster_id=1234&broadcaster_id=5678`. You may specify a maximum of 100 IDs. The API ignores duplicate IDs and IDs that are not found. ## ## https://dev.twitch.tv/docs/api/reference#get-channel-information func get_channel_information(broadcaster_id: Array[String]) -> TwitchGetChannelInformation.Response: var path: String = "/channels?" - + for param in broadcaster_id: - path += "broadcaster_id=" + str(param) + "&" - + path += "broadcaster_id=" + str(param) + "&" + var response: BufferedHTTPClient.ResponseData = await request(path, HTTPClient.METHOD_GET, "", "") var result: Variant = {} @@ -395,19 +395,19 @@ func get_channel_information(broadcaster_id: Array[String]) -> TwitchGetChannelI var parsed_result: TwitchGetChannelInformation.Response = TwitchGetChannelInformation.Response.from_json(result) parsed_result.response = response - + return parsed_result ## Updates a channel’s properties. ## -## broadcaster_id - The ID of the broadcaster whose channel you want to update. This ID must match the user ID in the user access token. +## broadcaster_id - The ID of the broadcaster whose channel you want to update. This ID must match the user ID in the user access token. ## ## https://dev.twitch.tv/docs/api/reference#modify-channel-information func modify_channel_information(body: TwitchModifyChannelInformation.Body, broadcaster_id: String) -> BufferedHTTPClient.ResponseData: var path: String = "/channels?" path += "broadcaster_id=" + str(broadcaster_id) + "&" - + var response: BufferedHTTPClient.ResponseData = await request(path, HTTPClient.METHOD_PATCH, body, "application/json") if response.response_code >= 400: @@ -417,13 +417,13 @@ func modify_channel_information(body: TwitchModifyChannelInformation.Body, broad ## Gets the broadcaster’s list editors. ## -## broadcaster_id - The ID of the broadcaster that owns the channel. This ID must match the user ID in the access token. +## broadcaster_id - The ID of the broadcaster that owns the channel. This ID must match the user ID in the access token. ## ## https://dev.twitch.tv/docs/api/reference#get-channel-editors func get_channel_editors(broadcaster_id: String) -> TwitchGetChannelEditors.Response: var path: String = "/channels/editors?" path += "broadcaster_id=" + str(broadcaster_id) + "&" - + var response: BufferedHTTPClient.ResponseData = await request(path, HTTPClient.METHOD_GET, "", "") var result: Variant = {} @@ -434,13 +434,13 @@ func get_channel_editors(broadcaster_id: String) -> TwitchGetChannelEditors.Resp var parsed_result: TwitchGetChannelEditors.Response = TwitchGetChannelEditors.Response.from_json(result) parsed_result.response = response - + return parsed_result ## Gets a list of broadcasters that the specified user follows. You can also use this endpoint to see whether a user follows a specific broadcaster. ## -## user_id - A user’s ID. Returns the list of broadcasters that this user follows. This ID must match the user ID in the user OAuth token. +## user_id - A user’s ID. Returns the list of broadcasters that this user follows. This ID must match the user ID in the user OAuth token. ## ## https://dev.twitch.tv/docs/api/reference#get-followed-channels func get_followed_channels(opt: TwitchGetFollowedChannels.Opt, user_id: String) -> TwitchGetFollowedChannels.Response: @@ -454,7 +454,7 @@ func get_followed_channels(opt: TwitchGetFollowedChannels.Opt, user_id: String) path += "first=" + str(optionals.first) + "&" if optionals.has("broadcaster_id"): path += "broadcaster_id=" + str(optionals.broadcaster_id) + "&" - + var response: BufferedHTTPClient.ResponseData = await request(path, HTTPClient.METHOD_GET, "", "") var result: Variant = {} @@ -470,13 +470,13 @@ func get_followed_channels(opt: TwitchGetFollowedChannels.Opt, user_id: String) if not opt: opt = TwitchGetFollowedChannels.Opt.new() opt.after = cursor parsed_result._next_page = get_followed_channels.bind(opt, user_id) - + return parsed_result ## Gets a list of users that follow the specified broadcaster. You can also use this endpoint to see whether a specific user follows the broadcaster. ## -## broadcaster_id - The broadcaster’s ID. Returns the list of users that follow this broadcaster. +## broadcaster_id - The broadcaster’s ID. Returns the list of users that follow this broadcaster. ## ## https://dev.twitch.tv/docs/api/reference#get-channel-followers func get_channel_followers(opt: TwitchGetChannelFollowers.Opt, broadcaster_id: String) -> TwitchGetChannelFollowers.Response: @@ -490,7 +490,7 @@ func get_channel_followers(opt: TwitchGetChannelFollowers.Opt, broadcaster_id: S if optionals.has("user_id"): path += "user_id=" + str(optionals.user_id) + "&" path += "broadcaster_id=" + str(broadcaster_id) + "&" - + var response: BufferedHTTPClient.ResponseData = await request(path, HTTPClient.METHOD_GET, "", "") var result: Variant = {} @@ -506,19 +506,19 @@ func get_channel_followers(opt: TwitchGetChannelFollowers.Opt, broadcaster_id: S if not opt: opt = TwitchGetChannelFollowers.Opt.new() opt.after = cursor parsed_result._next_page = get_channel_followers.bind(opt, broadcaster_id) - + return parsed_result ## Creates a Custom Reward in the broadcaster’s channel. ## -## broadcaster_id - The ID of the broadcaster to add the custom reward to. This ID must match the user ID found in the OAuth token. +## broadcaster_id - The ID of the broadcaster to add the custom reward to. This ID must match the user ID found in the OAuth token. ## ## https://dev.twitch.tv/docs/api/reference#create-custom-rewards func create_custom_rewards(body: TwitchCreateCustomRewards.Body, broadcaster_id: String) -> TwitchCreateCustomRewards.Response: var path: String = "/channel_points/custom_rewards?" path += "broadcaster_id=" + str(broadcaster_id) + "&" - + var response: BufferedHTTPClient.ResponseData = await request(path, HTTPClient.METHOD_POST, body, "application/json") var result: Variant = {} @@ -529,21 +529,21 @@ func create_custom_rewards(body: TwitchCreateCustomRewards.Body, broadcaster_id: var parsed_result: TwitchCreateCustomRewards.Response = TwitchCreateCustomRewards.Response.from_json(result) parsed_result.response = response - + return parsed_result ## Deletes a custom reward that the broadcaster created. ## -## broadcaster_id - The ID of the broadcaster that created the custom reward. This ID must match the user ID found in the OAuth token. -## id - The ID of the custom reward to delete. +## broadcaster_id - The ID of the broadcaster that created the custom reward. This ID must match the user ID found in the OAuth token. +## id - The ID of the custom reward to delete. ## ## https://dev.twitch.tv/docs/api/reference#delete-custom-reward func delete_custom_reward(id: String, broadcaster_id: String) -> BufferedHTTPClient.ResponseData: var path: String = "/channel_points/custom_rewards?" path += "id=" + str(id) + "&" path += "broadcaster_id=" + str(broadcaster_id) + "&" - + var response: BufferedHTTPClient.ResponseData = await request(path, HTTPClient.METHOD_DELETE, "", "") if response.response_code >= 400: @@ -553,7 +553,7 @@ func delete_custom_reward(id: String, broadcaster_id: String) -> BufferedHTTPCli ## Gets a list of custom rewards that the specified broadcaster created. ## -## broadcaster_id - The ID of the broadcaster whose custom rewards you want to get. This ID must match the user ID found in the OAuth token. +## broadcaster_id - The ID of the broadcaster whose custom rewards you want to get. This ID must match the user ID found in the OAuth token. ## ## https://dev.twitch.tv/docs/api/reference#get-custom-reward func get_custom_reward(opt: TwitchGetCustomReward.Opt, broadcaster_id: String) -> TwitchGetCustomReward.Response: @@ -561,13 +561,13 @@ func get_custom_reward(opt: TwitchGetCustomReward.Opt, broadcaster_id: String) - var optionals: Dictionary[StringName, Variant] = {} if opt != null: optionals = opt.to_dict() if optionals.has("id"): - + for param in optionals.id: - path += "id=" + str(param) + "&" + path += "id=" + str(param) + "&" if optionals.has("only_manageable_rewards"): path += "only_manageable_rewards=" + str(optionals.only_manageable_rewards) + "&" path += "broadcaster_id=" + str(broadcaster_id) + "&" - + var response: BufferedHTTPClient.ResponseData = await request(path, HTTPClient.METHOD_GET, "", "") var result: Variant = {} @@ -578,21 +578,21 @@ func get_custom_reward(opt: TwitchGetCustomReward.Opt, broadcaster_id: String) - var parsed_result: TwitchGetCustomReward.Response = TwitchGetCustomReward.Response.from_json(result) parsed_result.response = response - + return parsed_result ## Updates a custom reward. ## -## broadcaster_id - The ID of the broadcaster that’s updating the reward. This ID must match the user ID found in the OAuth token. -## id - The ID of the reward to update. +## broadcaster_id - The ID of the broadcaster that’s updating the reward. This ID must match the user ID found in the OAuth token. +## id - The ID of the reward to update. ## ## https://dev.twitch.tv/docs/api/reference#update-custom-reward func update_custom_reward(body: TwitchUpdateCustomReward.Body, id: String, broadcaster_id: String) -> TwitchUpdateCustomReward.Response: var path: String = "/channel_points/custom_rewards?" path += "id=" + str(id) + "&" path += "broadcaster_id=" + str(broadcaster_id) + "&" - + var response: BufferedHTTPClient.ResponseData = await request(path, HTTPClient.METHOD_PATCH, body, "application/json") var result: Variant = {} @@ -603,14 +603,14 @@ func update_custom_reward(body: TwitchUpdateCustomReward.Body, id: String, broad var parsed_result: TwitchUpdateCustomReward.Response = TwitchUpdateCustomReward.Response.from_json(result) parsed_result.response = response - + return parsed_result ## Gets a list of redemptions for a custom reward. ## -## broadcaster_id - The ID of the broadcaster that owns the custom reward. This ID must match the user ID found in the user OAuth token. -## reward_id - The ID that identifies the custom reward whose redemptions you want to get. +## broadcaster_id - The ID of the broadcaster that owns the custom reward. This ID must match the user ID found in the user OAuth token. +## reward_id - The ID that identifies the custom reward whose redemptions you want to get. ## ## https://dev.twitch.tv/docs/api/reference#get-custom-reward-redemption func get_custom_reward_redemption(opt: TwitchGetCustomRewardRedemption.Opt, reward_id: String, broadcaster_id: String) -> TwitchGetCustomRewardRedemption.Response: @@ -623,15 +623,15 @@ func get_custom_reward_redemption(opt: TwitchGetCustomRewardRedemption.Opt, rewa if optionals.has("first"): path += "first=" + str(optionals.first) + "&" if optionals.has("id"): - + for param in optionals.id: - path += "id=" + str(param) + "&" + path += "id=" + str(param) + "&" if optionals.has("sort"): path += "sort=" + str(optionals.sort) + "&" if optionals.has("status"): path += "status=" + str(optionals.status) + "&" path += "broadcaster_id=" + str(broadcaster_id) + "&" - + var response: BufferedHTTPClient.ResponseData = await request(path, HTTPClient.METHOD_GET, "", "") var result: Variant = {} @@ -647,25 +647,25 @@ func get_custom_reward_redemption(opt: TwitchGetCustomRewardRedemption.Opt, rewa if not opt: opt = TwitchGetCustomRewardRedemption.Opt.new() opt.after = cursor parsed_result._next_page = get_custom_reward_redemption.bind(opt, reward_id, broadcaster_id) - + return parsed_result ## Updates a redemption’s status. ## -## id - A list of IDs that identify the redemptions to update. To specify more than one ID, include this parameter for each redemption you want to update. For example, `id=1234&id=5678`. You may specify a maximum of 50 IDs. -## broadcaster_id - The ID of the broadcaster that’s updating the redemption. This ID must match the user ID in the user access token. -## reward_id - The ID that identifies the reward that’s been redeemed. +## id - A list of IDs that identify the redemptions to update. To specify more than one ID, include this parameter for each redemption you want to update. For example, `id=1234&id=5678`. You may specify a maximum of 50 IDs. +## broadcaster_id - The ID of the broadcaster that’s updating the redemption. This ID must match the user ID in the user access token. +## reward_id - The ID that identifies the reward that’s been redeemed. ## ## https://dev.twitch.tv/docs/api/reference#update-redemption-status func update_redemption_status(body: TwitchUpdateRedemptionStatus.Body, id: Array[String], reward_id: String, broadcaster_id: String) -> TwitchUpdateRedemptionStatus.Response: var path: String = "/channel_points/custom_rewards/redemptions?" - + for param in id: - path += "id=" + str(param) + "&" + path += "id=" + str(param) + "&" path += "reward_id=" + str(reward_id) + "&" path += "broadcaster_id=" + str(broadcaster_id) + "&" - + var response: BufferedHTTPClient.ResponseData = await request(path, HTTPClient.METHOD_PATCH, body, "application/json") var result: Variant = {} @@ -676,19 +676,19 @@ func update_redemption_status(body: TwitchUpdateRedemptionStatus.Body, id: Array var parsed_result: TwitchUpdateRedemptionStatus.Response = TwitchUpdateRedemptionStatus.Response.from_json(result) parsed_result.response = response - + return parsed_result ## Gets information about the broadcaster’s active charity campaign. ## -## broadcaster_id - The ID of the broadcaster that’s currently running a charity campaign. This ID must match the user ID in the access token. +## broadcaster_id - The ID of the broadcaster that’s currently running a charity campaign. This ID must match the user ID in the access token. ## ## https://dev.twitch.tv/docs/api/reference#get-charity-campaign func get_charity_campaign(broadcaster_id: String) -> TwitchGetCharityCampaign.Response: var path: String = "/charity/campaigns?" path += "broadcaster_id=" + str(broadcaster_id) + "&" - + var response: BufferedHTTPClient.ResponseData = await request(path, HTTPClient.METHOD_GET, "", "") var result: Variant = {} @@ -699,13 +699,13 @@ func get_charity_campaign(broadcaster_id: String) -> TwitchGetCharityCampaign.Re var parsed_result: TwitchGetCharityCampaign.Response = TwitchGetCharityCampaign.Response.from_json(result) parsed_result.response = response - + return parsed_result ## Gets the list of donations that users have made to the broadcaster’s active charity campaign. ## -## broadcaster_id - The ID of the broadcaster that’s currently running a charity campaign. This ID must match the user ID in the access token. +## broadcaster_id - The ID of the broadcaster that’s currently running a charity campaign. This ID must match the user ID in the access token. ## ## https://dev.twitch.tv/docs/api/reference#get-charity-campaign-donations func get_charity_campaign_donations(opt: TwitchGetCharityCampaignDonations.Opt, broadcaster_id: String) -> TwitchGetCharityCampaignDonations.Response: @@ -717,7 +717,7 @@ func get_charity_campaign_donations(opt: TwitchGetCharityCampaignDonations.Opt, if optionals.has("first"): path += "first=" + str(optionals.first) + "&" path += "broadcaster_id=" + str(broadcaster_id) + "&" - + var response: BufferedHTTPClient.ResponseData = await request(path, HTTPClient.METHOD_GET, "", "") var result: Variant = {} @@ -733,14 +733,14 @@ func get_charity_campaign_donations(opt: TwitchGetCharityCampaignDonations.Opt, if not opt: opt = TwitchGetCharityCampaignDonations.Opt.new() opt.after = cursor parsed_result._next_page = get_charity_campaign_donations.bind(opt, broadcaster_id) - + return parsed_result ## Gets the list of users that are connected to the broadcaster’s chat session. ## -## broadcaster_id - The ID of the broadcaster whose list of chatters you want to get. -## moderator_id - The ID of the broadcaster or one of the broadcaster’s moderators. This ID must match the user ID in the user access token. +## broadcaster_id - The ID of the broadcaster whose list of chatters you want to get. +## moderator_id - The ID of the broadcaster or one of the broadcaster’s moderators. This ID must match the user ID in the user access token. ## ## https://dev.twitch.tv/docs/api/reference#get-chatters func get_chatters(opt: TwitchGetChatters.Opt, moderator_id: String, broadcaster_id: String) -> TwitchGetChatters.Response: @@ -753,7 +753,7 @@ func get_chatters(opt: TwitchGetChatters.Opt, moderator_id: String, broadcaster_ if optionals.has("first"): path += "first=" + str(optionals.first) + "&" path += "broadcaster_id=" + str(broadcaster_id) + "&" - + var response: BufferedHTTPClient.ResponseData = await request(path, HTTPClient.METHOD_GET, "", "") var result: Variant = {} @@ -769,19 +769,19 @@ func get_chatters(opt: TwitchGetChatters.Opt, moderator_id: String, broadcaster_ if not opt: opt = TwitchGetChatters.Opt.new() opt.after = cursor parsed_result._next_page = get_chatters.bind(opt, moderator_id, broadcaster_id) - + return parsed_result ## Gets the broadcaster’s list of custom emotes. ## -## broadcaster_id - An ID that identifies the broadcaster whose emotes you want to get. +## broadcaster_id - An ID that identifies the broadcaster whose emotes you want to get. ## ## https://dev.twitch.tv/docs/api/reference#get-channel-emotes func get_channel_emotes(broadcaster_id: String) -> TwitchGetChannelEmotes.Response: var path: String = "/chat/emotes?" path += "broadcaster_id=" + str(broadcaster_id) + "&" - + var response: BufferedHTTPClient.ResponseData = await request(path, HTTPClient.METHOD_GET, "", "") var result: Variant = {} @@ -792,7 +792,7 @@ func get_channel_emotes(broadcaster_id: String) -> TwitchGetChannelEmotes.Respon var parsed_result: TwitchGetChannelEmotes.Response = TwitchGetChannelEmotes.Response.from_json(result) parsed_result.response = response - + return parsed_result @@ -803,7 +803,7 @@ func get_channel_emotes(broadcaster_id: String) -> TwitchGetChannelEmotes.Respon ## https://dev.twitch.tv/docs/api/reference#get-global-emotes func get_global_emotes() -> TwitchGetGlobalEmotes.Response: var path: String = "/chat/emotes/global?" - + var response: BufferedHTTPClient.ResponseData = await request(path, HTTPClient.METHOD_GET, "", "") var result: Variant = {} @@ -814,23 +814,23 @@ func get_global_emotes() -> TwitchGetGlobalEmotes.Response: var parsed_result: TwitchGetGlobalEmotes.Response = TwitchGetGlobalEmotes.Response.from_json(result) parsed_result.response = response - + return parsed_result ## Gets emotes for one or more specified emote sets. ## -## emote_set_id - An ID that identifies the emote set to get. Include this parameter for each emote set you want to get. For example, `emote_set_id=1234&emote_set_id=5678`. You may specify a maximum of 25 IDs. The response contains only the IDs that were found and ignores duplicate IDs. -## -## To get emote set IDs, use the [Get Channel Emotes](https://dev.twitch.tv/docs/api/reference#get-channel-emotes) API. +## emote_set_id - An ID that identifies the emote set to get. Include this parameter for each emote set you want to get. For example, `emote_set_id=1234&emote_set_id=5678`. You may specify a maximum of 25 IDs. The response contains only the IDs that were found and ignores duplicate IDs. +## +## To get emote set IDs, use the [Get Channel Emotes](https://dev.twitch.tv/docs/api/reference#get-channel-emotes) API. ## ## https://dev.twitch.tv/docs/api/reference#get-emote-sets func get_emote_sets(emote_set_id: Array[String]) -> TwitchGetEmoteSets.Response: var path: String = "/chat/emotes/set?" - + for param in emote_set_id: - path += "emote_set_id=" + str(param) + "&" - + path += "emote_set_id=" + str(param) + "&" + var response: BufferedHTTPClient.ResponseData = await request(path, HTTPClient.METHOD_GET, "", "") var result: Variant = {} @@ -841,19 +841,19 @@ func get_emote_sets(emote_set_id: Array[String]) -> TwitchGetEmoteSets.Response: var parsed_result: TwitchGetEmoteSets.Response = TwitchGetEmoteSets.Response.from_json(result) parsed_result.response = response - + return parsed_result ## Gets the broadcaster’s list of custom chat badges. ## -## broadcaster_id - The ID of the broadcaster whose chat badges you want to get. +## broadcaster_id - The ID of the broadcaster whose chat badges you want to get. ## ## https://dev.twitch.tv/docs/api/reference#get-channel-chat-badges func get_channel_chat_badges(broadcaster_id: String) -> TwitchGetChannelChatBadges.Response: var path: String = "/chat/badges?" path += "broadcaster_id=" + str(broadcaster_id) + "&" - + var response: BufferedHTTPClient.ResponseData = await request(path, HTTPClient.METHOD_GET, "", "") var result: Variant = {} @@ -864,7 +864,7 @@ func get_channel_chat_badges(broadcaster_id: String) -> TwitchGetChannelChatBadg var parsed_result: TwitchGetChannelChatBadges.Response = TwitchGetChannelChatBadges.Response.from_json(result) parsed_result.response = response - + return parsed_result @@ -875,7 +875,7 @@ func get_channel_chat_badges(broadcaster_id: String) -> TwitchGetChannelChatBadg ## https://dev.twitch.tv/docs/api/reference#get-global-chat-badges func get_global_chat_badges() -> TwitchGetGlobalChatBadges.Response: var path: String = "/chat/badges/global?" - + var response: BufferedHTTPClient.ResponseData = await request(path, HTTPClient.METHOD_GET, "", "") var result: Variant = {} @@ -886,13 +886,13 @@ func get_global_chat_badges() -> TwitchGetGlobalChatBadges.Response: var parsed_result: TwitchGetGlobalChatBadges.Response = TwitchGetGlobalChatBadges.Response.from_json(result) parsed_result.response = response - + return parsed_result ## Gets the broadcaster’s chat settings. ## -## broadcaster_id - The ID of the broadcaster whose chat settings you want to get. +## broadcaster_id - The ID of the broadcaster whose chat settings you want to get. ## ## https://dev.twitch.tv/docs/api/reference#get-chat-settings func get_chat_settings(opt: TwitchGetChatSettings.Opt, broadcaster_id: String) -> TwitchGetChatSettings.Response: @@ -902,7 +902,7 @@ func get_chat_settings(opt: TwitchGetChatSettings.Opt, broadcaster_id: String) - if optionals.has("moderator_id"): path += "moderator_id=" + str(optionals.moderator_id) + "&" path += "broadcaster_id=" + str(broadcaster_id) + "&" - + var response: BufferedHTTPClient.ResponseData = await request(path, HTTPClient.METHOD_GET, "", "") var result: Variant = {} @@ -913,21 +913,21 @@ func get_chat_settings(opt: TwitchGetChatSettings.Opt, broadcaster_id: String) - var parsed_result: TwitchGetChatSettings.Response = TwitchGetChatSettings.Response.from_json(result) parsed_result.response = response - + return parsed_result ## Updates the broadcaster’s chat settings. ## -## broadcaster_id - The ID of the broadcaster whose chat settings you want to update. -## moderator_id - The ID of a user that has permission to moderate the broadcaster’s chat room, or the broadcaster’s ID if they’re making the update. This ID must match the user ID in the user access token. +## broadcaster_id - The ID of the broadcaster whose chat settings you want to update. +## moderator_id - The ID of a user that has permission to moderate the broadcaster’s chat room, or the broadcaster’s ID if they’re making the update. This ID must match the user ID in the user access token. ## ## https://dev.twitch.tv/docs/api/reference#update-chat-settings func update_chat_settings(body: TwitchUpdateChatSettings.Body, moderator_id: String, broadcaster_id: String) -> TwitchUpdateChatSettings.Response: var path: String = "/chat/settings?" path += "moderator_id=" + str(moderator_id) + "&" path += "broadcaster_id=" + str(broadcaster_id) + "&" - + var response: BufferedHTTPClient.ResponseData = await request(path, HTTPClient.METHOD_PATCH, body, "application/json") var result: Variant = {} @@ -938,19 +938,19 @@ func update_chat_settings(body: TwitchUpdateChatSettings.Body, moderator_id: Str var parsed_result: TwitchUpdateChatSettings.Response = TwitchUpdateChatSettings.Response.from_json(result) parsed_result.response = response - + return parsed_result ## NEW Retrieves the active shared chat session for a channel. ## -## broadcaster_id - The User ID of the channel broadcaster. +## broadcaster_id - The User ID of the channel broadcaster. ## ## https://dev.twitch.tv/docs/api/reference#get-shared-chat-session func get_shared_chat_session(broadcaster_id: String) -> TwitchGetSharedChatSession.Response: var path: String = "/shared_chat/session?" path += "broadcaster_id=" + str(broadcaster_id) + "&" - + var response: BufferedHTTPClient.ResponseData = await request(path, HTTPClient.METHOD_GET, "", "") var result: Variant = {} @@ -961,13 +961,13 @@ func get_shared_chat_session(broadcaster_id: String) -> TwitchGetSharedChatSessi var parsed_result: TwitchGetSharedChatSession.Response = TwitchGetSharedChatSession.Response.from_json(result) parsed_result.response = response - + return parsed_result ## Retrieves emotes available to the user across all channels. ## -## user_id - The ID of the user. This ID must match the user ID in the user access token. +## user_id - The ID of the user. This ID must match the user ID in the user access token. ## ## https://dev.twitch.tv/docs/api/reference#get-user-emotes func get_user_emotes(opt: TwitchGetUserEmotes.Opt, user_id: String) -> TwitchGetUserEmotes.Response: @@ -979,7 +979,7 @@ func get_user_emotes(opt: TwitchGetUserEmotes.Opt, user_id: String) -> TwitchGet path += "after=" + str(optionals.after) + "&" if optionals.has("broadcaster_id"): path += "broadcaster_id=" + str(optionals.broadcaster_id) + "&" - + var response: BufferedHTTPClient.ResponseData = await request(path, HTTPClient.METHOD_GET, "", "") var result: Variant = {} @@ -995,21 +995,21 @@ func get_user_emotes(opt: TwitchGetUserEmotes.Opt, user_id: String) -> TwitchGet if not opt: opt = TwitchGetUserEmotes.Opt.new() opt.after = cursor parsed_result._next_page = get_user_emotes.bind(opt, user_id) - + return parsed_result ## Sends an announcement to the broadcaster’s chat room. ## -## broadcaster_id - The ID of the broadcaster that owns the chat room to send the announcement to. -## moderator_id - The ID of a user who has permission to moderate the broadcaster’s chat room, or the broadcaster’s ID if they’re sending the announcement. This ID must match the user ID in the user access token. +## broadcaster_id - The ID of the broadcaster that owns the chat room to send the announcement to. +## moderator_id - The ID of a user who has permission to moderate the broadcaster’s chat room, or the broadcaster’s ID if they’re sending the announcement. This ID must match the user ID in the user access token. ## ## https://dev.twitch.tv/docs/api/reference#send-chat-announcement func send_chat_announcement(body: TwitchSendChatAnnouncement.Body, moderator_id: String, broadcaster_id: String) -> BufferedHTTPClient.ResponseData: var path: String = "/chat/announcements?" path += "moderator_id=" + str(moderator_id) + "&" path += "broadcaster_id=" + str(broadcaster_id) + "&" - + var response: BufferedHTTPClient.ResponseData = await request(path, HTTPClient.METHOD_POST, body, "application/json") if response.response_code >= 400: @@ -1019,9 +1019,9 @@ func send_chat_announcement(body: TwitchSendChatAnnouncement.Body, moderator_id: ## Sends a Shoutout to the specified broadcaster. ## -## from_broadcaster_id - The ID of the broadcaster that’s sending the Shoutout. -## to_broadcaster_id - The ID of the broadcaster that’s receiving the Shoutout. -## moderator_id - The ID of the broadcaster or a user that is one of the broadcaster’s moderators. This ID must match the user ID in the access token. +## from_broadcaster_id - The ID of the broadcaster that’s sending the Shoutout. +## to_broadcaster_id - The ID of the broadcaster that’s receiving the Shoutout. +## moderator_id - The ID of the broadcaster or a user that is one of the broadcaster’s moderators. This ID must match the user ID in the access token. ## ## https://dev.twitch.tv/docs/api/reference#send-a-shoutout func send_a_shoutout(from_broadcaster_id: String, moderator_id: String, to_broadcaster_id: String) -> BufferedHTTPClient.ResponseData: @@ -1029,7 +1029,7 @@ func send_a_shoutout(from_broadcaster_id: String, moderator_id: String, to_broad path += "from_broadcaster_id=" + str(from_broadcaster_id) + "&" path += "moderator_id=" + str(moderator_id) + "&" path += "to_broadcaster_id=" + str(to_broadcaster_id) + "&" - + var response: BufferedHTTPClient.ResponseData = await request(path, HTTPClient.METHOD_POST, "", "") if response.response_code >= 400: @@ -1044,7 +1044,7 @@ func send_a_shoutout(from_broadcaster_id: String, moderator_id: String, to_broad ## https://dev.twitch.tv/docs/api/reference#send-chat-message func send_chat_message(body: TwitchSendChatMessage.Body) -> TwitchSendChatMessage.Response: var path: String = "/chat/messages?" - + var response: BufferedHTTPClient.ResponseData = await request(path, HTTPClient.METHOD_POST, body, "application/json") var result: Variant = {} @@ -1055,23 +1055,23 @@ func send_chat_message(body: TwitchSendChatMessage.Body) -> TwitchSendChatMessag var parsed_result: TwitchSendChatMessage.Response = TwitchSendChatMessage.Response.from_json(result) parsed_result.response = response - + return parsed_result ## Gets the color used for the user’s name in chat. ## -## user_id - The ID of the user whose username color you want to get. To specify more than one user, include the _user\_id_ parameter for each user to get. For example, `&user_id=1234&user_id=5678`. The maximum number of IDs that you may specify is 100. -## -## The API ignores duplicate IDs and IDs that weren’t found. +## user_id - The ID of the user whose username color you want to get. To specify more than one user, include the _user\_id_ parameter for each user to get. For example, `&user_id=1234&user_id=5678`. The maximum number of IDs that you may specify is 100. +## +## The API ignores duplicate IDs and IDs that weren’t found. ## ## https://dev.twitch.tv/docs/api/reference#get-user-chat-color func get_user_chat_color(user_id: Array[String]) -> TwitchGetUserChatColor.Response: var path: String = "/chat/color?" - + for param in user_id: - path += "user_id=" + str(param) + "&" - + path += "user_id=" + str(param) + "&" + var response: BufferedHTTPClient.ResponseData = await request(path, HTTPClient.METHOD_GET, "", "") var result: Variant = {} @@ -1082,15 +1082,15 @@ func get_user_chat_color(user_id: Array[String]) -> TwitchGetUserChatColor.Respo var parsed_result: TwitchGetUserChatColor.Response = TwitchGetUserChatColor.Response.from_json(result) parsed_result.response = response - + return parsed_result ## Updates the color used for the user’s name in chat. ## -## user_id - The ID of the user whose chat color you want to update. This ID must match the user ID in the access token. -## color - The color to use for the user's name in chat. All users may specify one of the following named color values. -## +## user_id - The ID of the user whose chat color you want to update. This ID must match the user ID in the access token. +## color - The color to use for the user's name in chat. All users may specify one of the following named color values. +## ## * blue ## * blue\_violet ## * cadet\_blue @@ -1106,15 +1106,15 @@ func get_user_chat_color(user_id: Array[String]) -> TwitchGetUserChatColor.Respo ## * sea\_green ## * spring\_green ## * yellow\_green -## -## Turbo and Prime users may specify a named color or a Hex color code like #9146FF. If you use a Hex color code, remember to URL encode it. +## +## Turbo and Prime users may specify a named color or a Hex color code like #9146FF. If you use a Hex color code, remember to URL encode it. ## ## https://dev.twitch.tv/docs/api/reference#update-user-chat-color func update_user_chat_color(color: String, user_id: String) -> BufferedHTTPClient.ResponseData: var path: String = "/chat/color?" path += "color=" + str(color) + "&" path += "user_id=" + str(user_id) + "&" - + var response: BufferedHTTPClient.ResponseData = await request(path, HTTPClient.METHOD_PUT, "", "") if response.response_code >= 400: @@ -1124,7 +1124,7 @@ func update_user_chat_color(color: String, user_id: String) -> BufferedHTTPClien ## Creates a clip from the broadcaster’s stream. ## -## broadcaster_id - The ID of the broadcaster whose stream you want to create a clip from. +## broadcaster_id - The ID of the broadcaster whose stream you want to create a clip from. ## ## https://dev.twitch.tv/docs/api/reference#create-clip func create_clip(opt: TwitchCreateClip.Opt, broadcaster_id: String) -> TwitchCreateClip.Response: @@ -1136,7 +1136,7 @@ func create_clip(opt: TwitchCreateClip.Opt, broadcaster_id: String) -> TwitchCre if optionals.has("title"): path += "title=" + str(optionals.title) + "&" path += "broadcaster_id=" + str(broadcaster_id) + "&" - + var response: BufferedHTTPClient.ResponseData = await request(path, HTTPClient.METHOD_POST, "", "") var result: Variant = {} @@ -1147,7 +1147,7 @@ func create_clip(opt: TwitchCreateClip.Opt, broadcaster_id: String) -> TwitchCre var parsed_result: TwitchCreateClip.Response = TwitchCreateClip.Response.from_json(result) parsed_result.response = response - + return parsed_result @@ -1171,16 +1171,16 @@ func get_clips(opt: TwitchGetClips.Opt) -> TwitchGetClips.Response: if optionals.has("game_id"): path += "game_id=" + str(optionals.game_id) + "&" if optionals.has("id"): - + for param in optionals.id: - path += "id=" + str(param) + "&" + path += "id=" + str(param) + "&" if optionals.has("is_featured"): path += "is_featured=" + str(optionals.is_featured) + "&" if optionals.has("started_at"): path += "started_at=" + get_rfc_3339_date_format(optionals.started_at) + "&" if optionals.has("broadcaster_id"): path += "broadcaster_id=" + str(optionals.broadcaster_id) + "&" - + var response: BufferedHTTPClient.ResponseData = await request(path, HTTPClient.METHOD_GET, "", "") var result: Variant = {} @@ -1196,17 +1196,17 @@ func get_clips(opt: TwitchGetClips.Opt) -> TwitchGetClips.Response: if not opt: opt = TwitchGetClips.Opt.new() opt.after = cursor parsed_result._next_page = get_clips.bind(opt) - + return parsed_result ## NEW Creates a clip from the broadcaster’s VOD. ## -## editor_id - The user ID of the editor for the channel you want to create a clip for. If using the broadcaster’s auth token, this is the same as broadcaster\_id. This must match the user\_id in the user access token. -## broadcaster_id - The user ID for the channel you want to create a clip for. -## vod_id - ID of the VOD the user wants to clip. -## vod_offset - Offset in the VOD to create the clip. See notes above. -## title - The title of the clip. +## editor_id - The user ID of the editor for the channel you want to create a clip for. If using the broadcaster’s auth token, this is the same as broadcaster\_id. This must match the user\_id in the user access token. +## broadcaster_id - The user ID for the channel you want to create a clip for. +## vod_id - ID of the VOD the user wants to clip. +## vod_offset - Offset in the VOD to create the clip. See notes above. +## title - The title of the clip. ## ## https://dev.twitch.tv/docs/api/reference#create-clip-from-vod func create_clip_from_vod(opt: TwitchCreateClipFromVod.Opt, editor_id: String, title: String, vod_id: String, vod_offset: int, broadcaster_id: String) -> TwitchCreateClipFromVod.Response: @@ -1220,7 +1220,7 @@ func create_clip_from_vod(opt: TwitchCreateClipFromVod.Opt, editor_id: String, t if optionals.has("duration"): path += "duration=" + str(optionals.duration) + "&" path += "broadcaster_id=" + str(broadcaster_id) + "&" - + var response: BufferedHTTPClient.ResponseData = await request(path, HTTPClient.METHOD_POST, "", "") var result: Variant = {} @@ -1231,25 +1231,25 @@ func create_clip_from_vod(opt: TwitchCreateClipFromVod.Opt, editor_id: String, t var parsed_result: TwitchCreateClipFromVod.Response = TwitchCreateClipFromVod.Response.from_json(result) parsed_result.response = response - + return parsed_result ## NEW Provides URLs to download the video file(s) for the specified clips. ## -## editor_id - The User ID of the editor for the channel you want to download a clip for. If using the broadcaster’s auth token, this is the same as `broadcaster_id`. This must match the `user_id` in the user access token. -## broadcaster_id - The ID of the broadcaster you want to download clips for. -## clip_id - The ID that identifies the clip you want to download. Include this parameter for each clip you want to download, up to a maximum of 10 clips. For example, `clip_id=SleepyGiftedPeppermintNerfRedBlaster-KbkBXYt3lOk3jy8-&clip_id=WimpyAltruisticKleeKeyboardCat-EiY5yMrEwZ4i4gwC`. +## editor_id - The User ID of the editor for the channel you want to download a clip for. If using the broadcaster’s auth token, this is the same as `broadcaster_id`. This must match the `user_id` in the user access token. +## broadcaster_id - The ID of the broadcaster you want to download clips for. +## clip_id - The ID that identifies the clip you want to download. Include this parameter for each clip you want to download, up to a maximum of 10 clips. For example, `clip_id=SleepyGiftedPeppermintNerfRedBlaster-KbkBXYt3lOk3jy8-&clip_id=WimpyAltruisticKleeKeyboardCat-EiY5yMrEwZ4i4gwC`. ## ## https://dev.twitch.tv/docs/api/reference#get-clips-download func get_clips_download(clip_id: Array[String], editor_id: String, broadcaster_id: String) -> TwitchGetClipsDownload.Response: var path: String = "/clips/downloads?" - + for param in clip_id: - path += "clip_id=" + str(param) + "&" + path += "clip_id=" + str(param) + "&" path += "editor_id=" + str(editor_id) + "&" path += "broadcaster_id=" + str(broadcaster_id) + "&" - + var response: BufferedHTTPClient.ResponseData = await request(path, HTTPClient.METHOD_GET, "", "") var result: Variant = {} @@ -1260,7 +1260,7 @@ func get_clips_download(clip_id: Array[String], editor_id: String, broadcaster_i var parsed_result: TwitchGetClipsDownload.Response = TwitchGetClipsDownload.Response.from_json(result) parsed_result.response = response - + return parsed_result @@ -1271,7 +1271,7 @@ func get_clips_download(clip_id: Array[String], editor_id: String, broadcaster_i ## https://dev.twitch.tv/docs/api/reference#get-conduits func get_conduits() -> TwitchGetConduits.Response: var path: String = "/eventsub/conduits?" - + var response: BufferedHTTPClient.ResponseData = await request(path, HTTPClient.METHOD_GET, "", "") var result: Variant = {} @@ -1282,7 +1282,7 @@ func get_conduits() -> TwitchGetConduits.Response: var parsed_result: TwitchGetConduits.Response = TwitchGetConduits.Response.from_json(result) parsed_result.response = response - + return parsed_result @@ -1293,7 +1293,7 @@ func get_conduits() -> TwitchGetConduits.Response: ## https://dev.twitch.tv/docs/api/reference#create-conduits func create_conduits(body: TwitchCreateConduits.Body) -> TwitchCreateConduits.Response: var path: String = "/eventsub/conduits?" - + var response: BufferedHTTPClient.ResponseData = await request(path, HTTPClient.METHOD_POST, body, "application/json") var result: Variant = {} @@ -1304,7 +1304,7 @@ func create_conduits(body: TwitchCreateConduits.Body) -> TwitchCreateConduits.Re var parsed_result: TwitchCreateConduits.Response = TwitchCreateConduits.Response.from_json(result) parsed_result.response = response - + return parsed_result @@ -1315,7 +1315,7 @@ func create_conduits(body: TwitchCreateConduits.Body) -> TwitchCreateConduits.Re ## https://dev.twitch.tv/docs/api/reference#update-conduits func update_conduits(body: TwitchUpdateConduits.Body) -> TwitchUpdateConduits.Response: var path: String = "/eventsub/conduits?" - + var response: BufferedHTTPClient.ResponseData = await request(path, HTTPClient.METHOD_PATCH, body, "application/json") var result: Variant = {} @@ -1326,19 +1326,19 @@ func update_conduits(body: TwitchUpdateConduits.Body) -> TwitchUpdateConduits.Re var parsed_result: TwitchUpdateConduits.Response = TwitchUpdateConduits.Response.from_json(result) parsed_result.response = response - + return parsed_result ## Deletes a specified conduit. ## -## id - Conduit ID. +## id - Conduit ID. ## ## https://dev.twitch.tv/docs/api/reference#delete-conduit func delete_conduit(id: String) -> BufferedHTTPClient.ResponseData: var path: String = "/eventsub/conduits?" path += "id=" + str(id) + "&" - + var response: BufferedHTTPClient.ResponseData = await request(path, HTTPClient.METHOD_DELETE, "", "") if response.response_code >= 400: @@ -1348,7 +1348,7 @@ func delete_conduit(id: String) -> BufferedHTTPClient.ResponseData: ## Gets a lists of all shards for a conduit. ## -## conduit_id - Conduit ID. +## conduit_id - Conduit ID. ## ## https://dev.twitch.tv/docs/api/reference#get-conduit-shards func get_conduit_shards(opt: TwitchGetConduitShards.Opt, conduit_id: String) -> TwitchGetConduitShards.Response: @@ -1360,7 +1360,7 @@ func get_conduit_shards(opt: TwitchGetConduitShards.Opt, conduit_id: String) -> path += "after=" + str(optionals.after) + "&" if optionals.has("status"): path += "status=" + str(optionals.status) + "&" - + var response: BufferedHTTPClient.ResponseData = await request(path, HTTPClient.METHOD_GET, "", "") var result: Variant = {} @@ -1376,7 +1376,7 @@ func get_conduit_shards(opt: TwitchGetConduitShards.Opt, conduit_id: String) -> if not opt: opt = TwitchGetConduitShards.Opt.new() opt.after = cursor parsed_result._next_page = get_conduit_shards.bind(opt, conduit_id) - + return parsed_result @@ -1387,7 +1387,7 @@ func get_conduit_shards(opt: TwitchGetConduitShards.Opt, conduit_id: String) -> ## https://dev.twitch.tv/docs/api/reference#update-conduit-shards func update_conduit_shards(body: TwitchUpdateConduitShards.Body) -> TwitchUpdateConduitShards.Response: var path: String = "/eventsub/conduits/shards?" - + var response: BufferedHTTPClient.ResponseData = await request(path, HTTPClient.METHOD_PATCH, body, "application/json") var result: Variant = {} @@ -1398,7 +1398,7 @@ func update_conduit_shards(body: TwitchUpdateConduitShards.Body) -> TwitchUpdate var parsed_result: TwitchUpdateConduitShards.Response = TwitchUpdateConduitShards.Response.from_json(result) parsed_result.response = response - + return parsed_result @@ -1413,7 +1413,7 @@ func get_content_classification_labels(opt: TwitchGetContentClassificationLabels if opt != null: optionals = opt.to_dict() if optionals.has("locale"): path += "locale=" + str(optionals.locale) + "&" - + var response: BufferedHTTPClient.ResponseData = await request(path, HTTPClient.METHOD_GET, "", "") var result: Variant = {} @@ -1424,7 +1424,7 @@ func get_content_classification_labels(opt: TwitchGetContentClassificationLabels var parsed_result: TwitchGetContentClassificationLabels.Response = TwitchGetContentClassificationLabels.Response.from_json(result) parsed_result.response = response - + return parsed_result @@ -1446,12 +1446,12 @@ func get_drops_entitlements(opt: TwitchGetDropsEntitlements.Opt) -> TwitchGetDro if optionals.has("game_id"): path += "game_id=" + str(optionals.game_id) + "&" if optionals.has("id"): - + for param in optionals.id: - path += "id=" + str(param) + "&" + path += "id=" + str(param) + "&" if optionals.has("user_id"): path += "user_id=" + str(optionals.user_id) + "&" - + var response: BufferedHTTPClient.ResponseData = await request(path, HTTPClient.METHOD_GET, "", "") var result: Variant = {} @@ -1467,7 +1467,7 @@ func get_drops_entitlements(opt: TwitchGetDropsEntitlements.Opt) -> TwitchGetDro if not opt: opt = TwitchGetDropsEntitlements.Opt.new() opt.after = cursor parsed_result._next_page = get_drops_entitlements.bind(opt) - + return parsed_result @@ -1478,7 +1478,7 @@ func get_drops_entitlements(opt: TwitchGetDropsEntitlements.Opt) -> TwitchGetDro ## https://dev.twitch.tv/docs/api/reference#update-drops-entitlements func update_drops_entitlements(body: TwitchUpdateDropsEntitlements.Body) -> TwitchUpdateDropsEntitlements.Response: var path: String = "/entitlements/drops?" - + var response: BufferedHTTPClient.ResponseData = await request(path, HTTPClient.METHOD_PATCH, body, "application/json") var result: Variant = {} @@ -1489,20 +1489,20 @@ func update_drops_entitlements(body: TwitchUpdateDropsEntitlements.Body) -> Twit var parsed_result: TwitchUpdateDropsEntitlements.Response = TwitchUpdateDropsEntitlements.Response.from_json(result) parsed_result.response = response - + return parsed_result ## Gets the specified configuration segment from the specified extension. ## -## extension_id - The ID of the extension that contains the configuration segment you want to get. -## segment - The type of configuration segment to get. Possible case-sensitive values are: -## +## extension_id - The ID of the extension that contains the configuration segment you want to get. +## segment - The type of configuration segment to get. Possible case-sensitive values are: +## ## * broadcaster ## * developer ## * global -## -## You may specify one or more segments. To specify multiple segments, include the `segment` parameter for each segment to get. For example, `segment=broadcaster&segment=developer`. Ignores duplicate segments. +## +## You may specify one or more segments. To specify multiple segments, include the `segment` parameter for each segment to get. For example, `segment=broadcaster&segment=developer`. Ignores duplicate segments. ## ## https://dev.twitch.tv/docs/api/reference#get-extension-configuration-segment func get_extension_configuration_segment(opt: TwitchGetExtensionConfigurationSegment.Opt, extension_id: String, segment: String) -> TwitchGetExtensionConfigurationSegment.Response: @@ -1513,7 +1513,7 @@ func get_extension_configuration_segment(opt: TwitchGetExtensionConfigurationSeg path += "segment=" + str(segment) + "&" if optionals.has("broadcaster_id"): path += "broadcaster_id=" + str(optionals.broadcaster_id) + "&" - + var response: BufferedHTTPClient.ResponseData = await request(path, HTTPClient.METHOD_GET, "", "") var result: Variant = {} @@ -1524,7 +1524,7 @@ func get_extension_configuration_segment(opt: TwitchGetExtensionConfigurationSeg var parsed_result: TwitchGetExtensionConfigurationSegment.Response = TwitchGetExtensionConfigurationSegment.Response.from_json(result) parsed_result.response = response - + return parsed_result @@ -1535,7 +1535,7 @@ func get_extension_configuration_segment(opt: TwitchGetExtensionConfigurationSeg ## https://dev.twitch.tv/docs/api/reference#set-extension-configuration-segment func set_extension_configuration_segment(body: TwitchSetExtensionConfigurationSegment.Body) -> BufferedHTTPClient.ResponseData: var path: String = "/extensions/configurations?" - + var response: BufferedHTTPClient.ResponseData = await request(path, HTTPClient.METHOD_PUT, body, "application/json") if response.response_code >= 400: @@ -1545,13 +1545,13 @@ func set_extension_configuration_segment(body: TwitchSetExtensionConfigurationSe ## Updates the extension’s required_configuration string. ## -## broadcaster_id - The ID of the broadcaster that installed the extension on their channel. +## broadcaster_id - The ID of the broadcaster that installed the extension on their channel. ## ## https://dev.twitch.tv/docs/api/reference#set-extension-required-configuration func set_extension_required_configuration(body: TwitchSetExtensionRequiredConfiguration.Body, broadcaster_id: String) -> BufferedHTTPClient.ResponseData: var path: String = "/extensions/required_configuration?" path += "broadcaster_id=" + str(broadcaster_id) + "&" - + var response: BufferedHTTPClient.ResponseData = await request(path, HTTPClient.METHOD_PUT, body, "application/json") if response.response_code >= 400: @@ -1566,7 +1566,7 @@ func set_extension_required_configuration(body: TwitchSetExtensionRequiredConfig ## https://dev.twitch.tv/docs/api/reference#send-extension-pubsub-message func send_extension_pubsub_message(body: TwitchSendExtensionPubSubMessage.Body) -> BufferedHTTPClient.ResponseData: var path: String = "/extensions/pubsub?" - + var response: BufferedHTTPClient.ResponseData = await request(path, HTTPClient.METHOD_POST, body, "application/json") if response.response_code >= 400: @@ -1576,7 +1576,7 @@ func send_extension_pubsub_message(body: TwitchSendExtensionPubSubMessage.Body) ## Gets a list of broadcasters that are streaming live and have installed or activated the extension. ## -## extension_id - The ID of the extension to get. Returns the list of broadcasters that are live and that have installed or activated this extension. +## extension_id - The ID of the extension to get. Returns the list of broadcasters that are live and that have installed or activated this extension. ## ## https://dev.twitch.tv/docs/api/reference#get-extension-live-channels func get_extension_live_channels(opt: TwitchGetExtensionLiveChannels.Opt, extension_id: String) -> TwitchGetExtensionLiveChannels.Response: @@ -1588,7 +1588,7 @@ func get_extension_live_channels(opt: TwitchGetExtensionLiveChannels.Opt, extens path += "after=" + str(optionals.after) + "&" if optionals.has("first"): path += "first=" + str(optionals.first) + "&" - + var response: BufferedHTTPClient.ResponseData = await request(path, HTTPClient.METHOD_GET, "", "") var result: Variant = {} @@ -1604,7 +1604,7 @@ func get_extension_live_channels(opt: TwitchGetExtensionLiveChannels.Opt, extens if not opt: opt = TwitchGetExtensionLiveChannels.Opt.new() opt.after = cursor parsed_result._next_page = get_extension_live_channels.bind(opt, extension_id) - + return parsed_result @@ -1615,7 +1615,7 @@ func get_extension_live_channels(opt: TwitchGetExtensionLiveChannels.Opt, extens ## https://dev.twitch.tv/docs/api/reference#get-extension-secrets func get_extension_secrets() -> TwitchGetExtensionSecrets.Response: var path: String = "/extensions/jwt/secrets?" - + var response: BufferedHTTPClient.ResponseData = await request(path, HTTPClient.METHOD_GET, "", "") var result: Variant = {} @@ -1626,13 +1626,13 @@ func get_extension_secrets() -> TwitchGetExtensionSecrets.Response: var parsed_result: TwitchGetExtensionSecrets.Response = TwitchGetExtensionSecrets.Response.from_json(result) parsed_result.response = response - + return parsed_result ## Creates a shared secret used to sign and verify JWT tokens. ## -## extension_id - The ID of the extension to apply the shared secret to. +## extension_id - The ID of the extension to apply the shared secret to. ## ## https://dev.twitch.tv/docs/api/reference#create-extension-secret func create_extension_secret(opt: TwitchCreateExtensionSecret.Opt, extension_id: String) -> TwitchCreateExtensionSecret.Response: @@ -1642,7 +1642,7 @@ func create_extension_secret(opt: TwitchCreateExtensionSecret.Opt, extension_id: path += "extension_id=" + str(extension_id) + "&" if optionals.has("delay"): path += "delay=" + str(optionals.delay) + "&" - + var response: BufferedHTTPClient.ResponseData = await request(path, HTTPClient.METHOD_POST, "", "") var result: Variant = {} @@ -1653,19 +1653,19 @@ func create_extension_secret(opt: TwitchCreateExtensionSecret.Opt, extension_id: var parsed_result: TwitchCreateExtensionSecret.Response = TwitchCreateExtensionSecret.Response.from_json(result) parsed_result.response = response - + return parsed_result ## Sends a message to the specified broadcaster’s chat room. ## -## broadcaster_id - The ID of the broadcaster that has activated the extension. +## broadcaster_id - The ID of the broadcaster that has activated the extension. ## ## https://dev.twitch.tv/docs/api/reference#send-extension-chat-message func send_extension_chat_message(body: TwitchSendExtensionChatMessage.Body, broadcaster_id: String) -> BufferedHTTPClient.ResponseData: var path: String = "/extensions/chat?" path += "broadcaster_id=" + str(broadcaster_id) + "&" - + var response: BufferedHTTPClient.ResponseData = await request(path, HTTPClient.METHOD_POST, body, "application/json") if response.response_code >= 400: @@ -1675,7 +1675,7 @@ func send_extension_chat_message(body: TwitchSendExtensionChatMessage.Body, broa ## Gets information about an extension. ## -## extension_id - The ID of the extension to get. +## extension_id - The ID of the extension to get. ## ## https://dev.twitch.tv/docs/api/reference#get-extensions func get_extensions(opt: TwitchGetExtensions.Opt, extension_id: String) -> TwitchGetExtensions.Response: @@ -1685,7 +1685,7 @@ func get_extensions(opt: TwitchGetExtensions.Opt, extension_id: String) -> Twitc path += "extension_id=" + str(extension_id) + "&" if optionals.has("extension_version"): path += "extension_version=" + str(optionals.extension_version) + "&" - + var response: BufferedHTTPClient.ResponseData = await request(path, HTTPClient.METHOD_GET, "", "") var result: Variant = {} @@ -1696,13 +1696,13 @@ func get_extensions(opt: TwitchGetExtensions.Opt, extension_id: String) -> Twitc var parsed_result: TwitchGetExtensions.Response = TwitchGetExtensions.Response.from_json(result) parsed_result.response = response - + return parsed_result ## Gets information about a released extension. ## -## extension_id - The ID of the extension to get. +## extension_id - The ID of the extension to get. ## ## https://dev.twitch.tv/docs/api/reference#get-released-extensions func get_released_extensions(opt: TwitchGetReleasedExtensions.Opt, extension_id: String) -> TwitchGetReleasedExtensions.Response: @@ -1712,7 +1712,7 @@ func get_released_extensions(opt: TwitchGetReleasedExtensions.Opt, extension_id: path += "extension_id=" + str(extension_id) + "&" if optionals.has("extension_version"): path += "extension_version=" + str(optionals.extension_version) + "&" - + var response: BufferedHTTPClient.ResponseData = await request(path, HTTPClient.METHOD_GET, "", "") var result: Variant = {} @@ -1723,7 +1723,7 @@ func get_released_extensions(opt: TwitchGetReleasedExtensions.Opt, extension_id: var parsed_result: TwitchGetReleasedExtensions.Response = TwitchGetReleasedExtensions.Response.from_json(result) parsed_result.response = response - + return parsed_result @@ -1738,7 +1738,7 @@ func get_extension_bits_products(opt: TwitchGetExtensionBitsProducts.Opt) -> Twi if opt != null: optionals = opt.to_dict() if optionals.has("should_include_all"): path += "should_include_all=" + str(optionals.should_include_all) + "&" - + var response: BufferedHTTPClient.ResponseData = await request(path, HTTPClient.METHOD_GET, "", "") var result: Variant = {} @@ -1749,7 +1749,7 @@ func get_extension_bits_products(opt: TwitchGetExtensionBitsProducts.Opt) -> Twi var parsed_result: TwitchGetExtensionBitsProducts.Response = TwitchGetExtensionBitsProducts.Response.from_json(result) parsed_result.response = response - + return parsed_result @@ -1760,7 +1760,7 @@ func get_extension_bits_products(opt: TwitchGetExtensionBitsProducts.Opt) -> Twi ## https://dev.twitch.tv/docs/api/reference#update-extension-bits-product func update_extension_bits_product(body: TwitchUpdateExtensionBitsProduct.Body) -> TwitchUpdateExtensionBitsProduct.Response: var path: String = "/bits/extensions?" - + var response: BufferedHTTPClient.ResponseData = await request(path, HTTPClient.METHOD_PUT, body, "application/json") var result: Variant = {} @@ -1771,7 +1771,7 @@ func update_extension_bits_product(body: TwitchUpdateExtensionBitsProduct.Body) var parsed_result: TwitchUpdateExtensionBitsProduct.Response = TwitchUpdateExtensionBitsProduct.Response.from_json(result) parsed_result.response = response - + return parsed_result @@ -1782,7 +1782,7 @@ func update_extension_bits_product(body: TwitchUpdateExtensionBitsProduct.Body) ## https://dev.twitch.tv/docs/api/reference#create-eventsub-subscription func create_eventsub_subscription(body: TwitchCreateEventSubSubscription.Body) -> TwitchCreateEventSubSubscription.Response: var path: String = "/eventsub/subscriptions?" - + var response: BufferedHTTPClient.ResponseData = await request(path, HTTPClient.METHOD_POST, body, "application/json") var result: Variant = {} @@ -1793,19 +1793,19 @@ func create_eventsub_subscription(body: TwitchCreateEventSubSubscription.Body) - var parsed_result: TwitchCreateEventSubSubscription.Response = TwitchCreateEventSubSubscription.Response.from_json(result) parsed_result.response = response - + return parsed_result ## Deletes an EventSub subscription. ## -## id - The ID of the subscription to delete. +## id - The ID of the subscription to delete. ## ## https://dev.twitch.tv/docs/api/reference#delete-eventsub-subscription func delete_eventsub_subscription(id: String) -> BufferedHTTPClient.ResponseData: var path: String = "/eventsub/subscriptions?" path += "id=" + str(id) + "&" - + var response: BufferedHTTPClient.ResponseData = await request(path, HTTPClient.METHOD_DELETE, "", "") if response.response_code >= 400: @@ -1832,7 +1832,7 @@ func get_eventsub_subscriptions(opt: TwitchGetEventsubSubscriptions.Opt) -> Twit path += "type=" + str(optionals.type) + "&" if optionals.has("user_id"): path += "user_id=" + str(optionals.user_id) + "&" - + var response: BufferedHTTPClient.ResponseData = await request(path, HTTPClient.METHOD_GET, "", "") var result: Variant = {} @@ -1848,7 +1848,7 @@ func get_eventsub_subscriptions(opt: TwitchGetEventsubSubscriptions.Opt) -> Twit if not opt: opt = TwitchGetEventsubSubscriptions.Opt.new() opt.after = cursor parsed_result._next_page = get_eventsub_subscriptions.bind(opt) - + return parsed_result @@ -1867,7 +1867,7 @@ func get_top_games(opt: TwitchGetTopGames.Opt) -> TwitchGetTopGames.Response: path += "before=" + str(optionals.before) + "&" if optionals.has("first"): path += "first=" + str(optionals.first) + "&" - + var response: BufferedHTTPClient.ResponseData = await request(path, HTTPClient.METHOD_GET, "", "") var result: Variant = {} @@ -1883,7 +1883,7 @@ func get_top_games(opt: TwitchGetTopGames.Opt) -> TwitchGetTopGames.Response: if not opt: opt = TwitchGetTopGames.Opt.new() opt.after = cursor parsed_result._next_page = get_top_games.bind(opt) - + return parsed_result @@ -1897,18 +1897,18 @@ func get_games(opt: TwitchGetGames.Opt) -> TwitchGetGames.Response: var optionals: Dictionary[StringName, Variant] = {} if opt != null: optionals = opt.to_dict() if optionals.has("id"): - + for param in optionals.id: - path += "id=" + str(param) + "&" + path += "id=" + str(param) + "&" if optionals.has("igdb_id"): - + for param in optionals.igdb_id: - path += "igdb_id=" + str(param) + "&" + path += "igdb_id=" + str(param) + "&" if optionals.has("name"): - + for param in optionals.name: - path += "name=" + str(param) + "&" - + path += "name=" + str(param) + "&" + var response: BufferedHTTPClient.ResponseData = await request(path, HTTPClient.METHOD_GET, "", "") var result: Variant = {} @@ -1919,19 +1919,19 @@ func get_games(opt: TwitchGetGames.Opt) -> TwitchGetGames.Response: var parsed_result: TwitchGetGames.Response = TwitchGetGames.Response.from_json(result) parsed_result.response = response - + return parsed_result ## Gets the broadcaster’s list of active goals. ## -## broadcaster_id - The ID of the broadcaster that created the goals. This ID must match the user ID in the user access token. +## broadcaster_id - The ID of the broadcaster that created the goals. This ID must match the user ID in the user access token. ## ## https://dev.twitch.tv/docs/api/reference#get-creator-goals func get_creator_goals(broadcaster_id: String) -> TwitchGetCreatorGoals.Response: var path: String = "/goals?" path += "broadcaster_id=" + str(broadcaster_id) + "&" - + var response: BufferedHTTPClient.ResponseData = await request(path, HTTPClient.METHOD_GET, "", "") var result: Variant = {} @@ -1942,21 +1942,21 @@ func get_creator_goals(broadcaster_id: String) -> TwitchGetCreatorGoals.Response var parsed_result: TwitchGetCreatorGoals.Response = TwitchGetCreatorGoals.Response.from_json(result) parsed_result.response = response - + return parsed_result ## BETA Gets the channel settings for configuration of the Guest Star feature for a particular host. ## -## broadcaster_id - The ID of the broadcaster you want to get guest star settings for. -## moderator_id - The ID of the broadcaster or a user that has permission to moderate the broadcaster’s chat room. This ID must match the user ID in the user access token. +## broadcaster_id - The ID of the broadcaster you want to get guest star settings for. +## moderator_id - The ID of the broadcaster or a user that has permission to moderate the broadcaster’s chat room. This ID must match the user ID in the user access token. ## ## https://dev.twitch.tv/docs/api/reference#get-channel-guest-star-settings func get_channel_guest_star_settings(moderator_id: String, broadcaster_id: String) -> TwitchGetChannelGuestStarSettings.Response: var path: String = "/guest_star/channel_settings?" path += "moderator_id=" + str(moderator_id) + "&" path += "broadcaster_id=" + str(broadcaster_id) + "&" - + var response: BufferedHTTPClient.ResponseData = await request(path, HTTPClient.METHOD_GET, "", "") var result: Variant = {} @@ -1967,19 +1967,19 @@ func get_channel_guest_star_settings(moderator_id: String, broadcaster_id: Strin var parsed_result: TwitchGetChannelGuestStarSettings.Response = TwitchGetChannelGuestStarSettings.Response.from_json(result) parsed_result.response = response - + return parsed_result ## BETA Mutates the channel settings for configuration of the Guest Star feature for a particular host. ## -## broadcaster_id - The ID of the broadcaster you want to update Guest Star settings for. +## broadcaster_id - The ID of the broadcaster you want to update Guest Star settings for. ## ## https://dev.twitch.tv/docs/api/reference#update-channel-guest-star-settings func update_channel_guest_star_settings(body: TwitchUpdateChannelGuestStarSettings.Body, broadcaster_id: String) -> BufferedHTTPClient.ResponseData: var path: String = "/guest_star/channel_settings?" path += "broadcaster_id=" + str(broadcaster_id) + "&" - + var response: BufferedHTTPClient.ResponseData = await request(path, HTTPClient.METHOD_PUT, body, "application/json") if response.response_code >= 400: @@ -1989,15 +1989,15 @@ func update_channel_guest_star_settings(body: TwitchUpdateChannelGuestStarSettin ## BETA Gets information about an ongoing Guest Star session for a particular channel. ## -## broadcaster_id - ID for the user hosting the Guest Star session. -## moderator_id - The ID of the broadcaster or a user that has permission to moderate the broadcaster’s chat room. This ID must match the user ID in the user access token. +## broadcaster_id - ID for the user hosting the Guest Star session. +## moderator_id - The ID of the broadcaster or a user that has permission to moderate the broadcaster’s chat room. This ID must match the user ID in the user access token. ## ## https://dev.twitch.tv/docs/api/reference#get-guest-star-session func get_guest_star_session(moderator_id: String, broadcaster_id: String) -> TwitchGetGuestStarSession.Response: var path: String = "/guest_star/session?" path += "moderator_id=" + str(moderator_id) + "&" path += "broadcaster_id=" + str(broadcaster_id) + "&" - + var response: BufferedHTTPClient.ResponseData = await request(path, HTTPClient.METHOD_GET, "", "") var result: Variant = {} @@ -2008,19 +2008,19 @@ func get_guest_star_session(moderator_id: String, broadcaster_id: String) -> Twi var parsed_result: TwitchGetGuestStarSession.Response = TwitchGetGuestStarSession.Response.from_json(result) parsed_result.response = response - + return parsed_result ## BETA Programmatically creates a Guest Star session on behalf of the broadcaster. ## -## broadcaster_id - The ID of the broadcaster you want to create a Guest Star session for. Provided `broadcaster_id` must match the `user_id` in the auth token. +## broadcaster_id - The ID of the broadcaster you want to create a Guest Star session for. Provided `broadcaster_id` must match the `user_id` in the auth token. ## ## https://dev.twitch.tv/docs/api/reference#create-guest-star-session func create_guest_star_session(broadcaster_id: String) -> TwitchCreateGuestStarSession.Response: var path: String = "/guest_star/session?" path += "broadcaster_id=" + str(broadcaster_id) + "&" - + var response: BufferedHTTPClient.ResponseData = await request(path, HTTPClient.METHOD_POST, "", "") var result: Variant = {} @@ -2031,21 +2031,21 @@ func create_guest_star_session(broadcaster_id: String) -> TwitchCreateGuestStarS var parsed_result: TwitchCreateGuestStarSession.Response = TwitchCreateGuestStarSession.Response.from_json(result) parsed_result.response = response - + return parsed_result ## BETA Programmatically ends a Guest Star session on behalf of the broadcaster. ## -## broadcaster_id - The ID of the broadcaster you want to end a Guest Star session for. Provided `broadcaster_id` must match the `user_id` in the auth token. -## session_id - ID for the session to end on behalf of the broadcaster. +## broadcaster_id - The ID of the broadcaster you want to end a Guest Star session for. Provided `broadcaster_id` must match the `user_id` in the auth token. +## session_id - ID for the session to end on behalf of the broadcaster. ## ## https://dev.twitch.tv/docs/api/reference#end-guest-star-session func end_guest_star_session(session_id: String, broadcaster_id: String) -> TwitchEndGuestStarSession.Response: var path: String = "/guest_star/session?" path += "session_id=" + str(session_id) + "&" path += "broadcaster_id=" + str(broadcaster_id) + "&" - + var response: BufferedHTTPClient.ResponseData = await request(path, HTTPClient.METHOD_DELETE, "", "") var result: Variant = {} @@ -2056,15 +2056,15 @@ func end_guest_star_session(session_id: String, broadcaster_id: String) -> Twitc var parsed_result: TwitchEndGuestStarSession.Response = TwitchEndGuestStarSession.Response.from_json(result) parsed_result.response = response - + return parsed_result ## BETA Provides the caller with a list of pending invites to a Guest Star session. ## -## broadcaster_id - The ID of the broadcaster running the Guest Star session. -## moderator_id - The ID of the broadcaster or a user that has permission to moderate the broadcaster’s chat room. This ID must match the `user_id` in the user access token. -## session_id - The session ID to query for invite status. +## broadcaster_id - The ID of the broadcaster running the Guest Star session. +## moderator_id - The ID of the broadcaster or a user that has permission to moderate the broadcaster’s chat room. This ID must match the `user_id` in the user access token. +## session_id - The session ID to query for invite status. ## ## https://dev.twitch.tv/docs/api/reference#get-guest-star-invites func get_guest_star_invites(moderator_id: String, session_id: String, broadcaster_id: String) -> TwitchGetGuestStarInvites.Response: @@ -2072,7 +2072,7 @@ func get_guest_star_invites(moderator_id: String, session_id: String, broadcaste path += "moderator_id=" + str(moderator_id) + "&" path += "session_id=" + str(session_id) + "&" path += "broadcaster_id=" + str(broadcaster_id) + "&" - + var response: BufferedHTTPClient.ResponseData = await request(path, HTTPClient.METHOD_GET, "", "") var result: Variant = {} @@ -2083,16 +2083,16 @@ func get_guest_star_invites(moderator_id: String, session_id: String, broadcaste var parsed_result: TwitchGetGuestStarInvites.Response = TwitchGetGuestStarInvites.Response.from_json(result) parsed_result.response = response - + return parsed_result ## BETA Sends an invite to a specified guest on behalf of the broadcaster for a Guest Star session in progress. ## -## broadcaster_id - The ID of the broadcaster running the Guest Star session. -## moderator_id - The ID of the broadcaster or a user that has permission to moderate the broadcaster’s chat room. This ID must match the `user_id` in the user access token. -## session_id - The session ID for the invite to be sent on behalf of the broadcaster. -## guest_id - Twitch User ID for the guest to invite to the Guest Star session. +## broadcaster_id - The ID of the broadcaster running the Guest Star session. +## moderator_id - The ID of the broadcaster or a user that has permission to moderate the broadcaster’s chat room. This ID must match the `user_id` in the user access token. +## session_id - The session ID for the invite to be sent on behalf of the broadcaster. +## guest_id - Twitch User ID for the guest to invite to the Guest Star session. ## ## https://dev.twitch.tv/docs/api/reference#send-guest-star-invite func send_guest_star_invite(guest_id: String, moderator_id: String, session_id: String, broadcaster_id: String) -> BufferedHTTPClient.ResponseData: @@ -2101,7 +2101,7 @@ func send_guest_star_invite(guest_id: String, moderator_id: String, session_id: path += "moderator_id=" + str(moderator_id) + "&" path += "session_id=" + str(session_id) + "&" path += "broadcaster_id=" + str(broadcaster_id) + "&" - + var response: BufferedHTTPClient.ResponseData = await request(path, HTTPClient.METHOD_POST, "", "") if response.response_code >= 400: @@ -2111,10 +2111,10 @@ func send_guest_star_invite(guest_id: String, moderator_id: String, session_id: ## BETA Revokes a previously sent invite for a Guest Star session. ## -## broadcaster_id - The ID of the broadcaster running the Guest Star session. -## moderator_id - The ID of the broadcaster or a user that has permission to moderate the broadcaster’s chat room. This ID must match the `user_id` in the user access token. -## session_id - The ID of the session for the invite to be revoked on behalf of the broadcaster. -## guest_id - Twitch User ID for the guest to revoke the Guest Star session invite from. +## broadcaster_id - The ID of the broadcaster running the Guest Star session. +## moderator_id - The ID of the broadcaster or a user that has permission to moderate the broadcaster’s chat room. This ID must match the `user_id` in the user access token. +## session_id - The ID of the session for the invite to be revoked on behalf of the broadcaster. +## guest_id - Twitch User ID for the guest to revoke the Guest Star session invite from. ## ## https://dev.twitch.tv/docs/api/reference#delete-guest-star-invite func delete_guest_star_invite(guest_id: String, moderator_id: String, session_id: String, broadcaster_id: String) -> BufferedHTTPClient.ResponseData: @@ -2123,7 +2123,7 @@ func delete_guest_star_invite(guest_id: String, moderator_id: String, session_id path += "moderator_id=" + str(moderator_id) + "&" path += "session_id=" + str(session_id) + "&" path += "broadcaster_id=" + str(broadcaster_id) + "&" - + var response: BufferedHTTPClient.ResponseData = await request(path, HTTPClient.METHOD_DELETE, "", "") if response.response_code >= 400: @@ -2133,11 +2133,11 @@ func delete_guest_star_invite(guest_id: String, moderator_id: String, session_id ## BETA Allows a previously invited user to be assigned a slot within the active Guest Star session. ## -## broadcaster_id - The ID of the broadcaster running the Guest Star session. -## moderator_id - The ID of the broadcaster or a user that has permission to moderate the broadcaster’s chat room. This ID must match the `user_id` in the user access token. -## session_id - The ID of the Guest Star session in which to assign the slot. -## guest_id - The Twitch User ID corresponding to the guest to assign a slot in the session. This user must already have an invite to this session, and have indicated that they are ready to join. -## slot_id - The slot assignment to give to the user. Must be a numeric identifier between “1” and “N” where N is the max number of slots for the session. Max number of slots allowed for the session is reported by [Get Channel Guest Star Settings](https://dev.twitch.tv/docs/api/reference#get-channel-guest-star-settings). +## broadcaster_id - The ID of the broadcaster running the Guest Star session. +## moderator_id - The ID of the broadcaster or a user that has permission to moderate the broadcaster’s chat room. This ID must match the `user_id` in the user access token. +## session_id - The ID of the Guest Star session in which to assign the slot. +## guest_id - The Twitch User ID corresponding to the guest to assign a slot in the session. This user must already have an invite to this session, and have indicated that they are ready to join. +## slot_id - The slot assignment to give to the user. Must be a numeric identifier between “1” and “N” where N is the max number of slots for the session. Max number of slots allowed for the session is reported by [Get Channel Guest Star Settings](https://dev.twitch.tv/docs/api/reference#get-channel-guest-star-settings). ## ## https://dev.twitch.tv/docs/api/reference#assign-guest-star-slot func assign_guest_star_slot(guest_id: String, moderator_id: String, session_id: String, slot_id: String, broadcaster_id: String) -> BufferedHTTPClient.ResponseData: @@ -2147,7 +2147,7 @@ func assign_guest_star_slot(guest_id: String, moderator_id: String, session_id: path += "session_id=" + str(session_id) + "&" path += "slot_id=" + str(slot_id) + "&" path += "broadcaster_id=" + str(broadcaster_id) + "&" - + var response: BufferedHTTPClient.ResponseData = await request(path, HTTPClient.METHOD_POST, "", "") if response.response_code >= 400: @@ -2157,10 +2157,10 @@ func assign_guest_star_slot(guest_id: String, moderator_id: String, session_id: ## BETA Allows a user to update the assigned slot for a particular user within the active Guest Star session. ## -## broadcaster_id - The ID of the broadcaster running the Guest Star session. -## moderator_id - The ID of the broadcaster or a user that has permission to moderate the broadcaster’s chat room. This ID must match the `user_id` in the user access token. -## session_id - The ID of the Guest Star session in which to update slot settings. -## source_slot_id - The slot assignment previously assigned to a user. +## broadcaster_id - The ID of the broadcaster running the Guest Star session. +## moderator_id - The ID of the broadcaster or a user that has permission to moderate the broadcaster’s chat room. This ID must match the `user_id` in the user access token. +## session_id - The ID of the Guest Star session in which to update slot settings. +## source_slot_id - The slot assignment previously assigned to a user. ## ## https://dev.twitch.tv/docs/api/reference#update-guest-star-slot func update_guest_star_slot(opt: TwitchUpdateGuestStarSlot.Opt, moderator_id: String, session_id: String, source_slot_id: String, broadcaster_id: String) -> BufferedHTTPClient.ResponseData: @@ -2173,7 +2173,7 @@ func update_guest_star_slot(opt: TwitchUpdateGuestStarSlot.Opt, moderator_id: St if optionals.has("destination_slot_id"): path += "destination_slot_id=" + str(optionals.destination_slot_id) + "&" path += "broadcaster_id=" + str(broadcaster_id) + "&" - + var response: BufferedHTTPClient.ResponseData = await request(path, HTTPClient.METHOD_PATCH, "", "") if response.response_code >= 400: @@ -2183,11 +2183,11 @@ func update_guest_star_slot(opt: TwitchUpdateGuestStarSlot.Opt, moderator_id: St ## BETA Allows a caller to remove a slot assignment from a user participating in an active Guest Star session. ## -## broadcaster_id - The ID of the broadcaster running the Guest Star session. -## moderator_id - The ID of the broadcaster or a user that has permission to moderate the broadcaster’s chat room. This ID must match the user ID in the user access token. -## session_id - The ID of the Guest Star session in which to remove the slot assignment. -## guest_id - The Twitch User ID corresponding to the guest to remove from the session. -## slot_id - The slot ID representing the slot assignment to remove from the session. +## broadcaster_id - The ID of the broadcaster running the Guest Star session. +## moderator_id - The ID of the broadcaster or a user that has permission to moderate the broadcaster’s chat room. This ID must match the user ID in the user access token. +## session_id - The ID of the Guest Star session in which to remove the slot assignment. +## guest_id - The Twitch User ID corresponding to the guest to remove from the session. +## slot_id - The slot ID representing the slot assignment to remove from the session. ## ## https://dev.twitch.tv/docs/api/reference#delete-guest-star-slot func delete_guest_star_slot(opt: TwitchDeleteGuestStarSlot.Opt, guest_id: String, moderator_id: String, session_id: String, slot_id: String, broadcaster_id: String) -> BufferedHTTPClient.ResponseData: @@ -2201,7 +2201,7 @@ func delete_guest_star_slot(opt: TwitchDeleteGuestStarSlot.Opt, guest_id: String if optionals.has("should_reinvite_guest"): path += "should_reinvite_guest=" + str(optionals.should_reinvite_guest) + "&" path += "broadcaster_id=" + str(broadcaster_id) + "&" - + var response: BufferedHTTPClient.ResponseData = await request(path, HTTPClient.METHOD_DELETE, "", "") if response.response_code >= 400: @@ -2211,10 +2211,10 @@ func delete_guest_star_slot(opt: TwitchDeleteGuestStarSlot.Opt, guest_id: String ## BETA Allows a user to update slot settings for a particular guest within a Guest Star session. ## -## broadcaster_id - The ID of the broadcaster running the Guest Star session. -## moderator_id - The ID of the broadcaster or a user that has permission to moderate the broadcaster’s chat room. This ID must match the user ID in the user access token. -## session_id - The ID of the Guest Star session in which to update a slot’s settings. -## slot_id - The slot assignment that has previously been assigned to a user. +## broadcaster_id - The ID of the broadcaster running the Guest Star session. +## moderator_id - The ID of the broadcaster or a user that has permission to moderate the broadcaster’s chat room. This ID must match the user ID in the user access token. +## session_id - The ID of the Guest Star session in which to update a slot’s settings. +## slot_id - The slot assignment that has previously been assigned to a user. ## ## https://dev.twitch.tv/docs/api/reference#update-guest-star-slot-settings func update_guest_star_slot_settings(opt: TwitchUpdateGuestStarSlotSettings.Opt, moderator_id: String, session_id: String, slot_id: String, broadcaster_id: String) -> BufferedHTTPClient.ResponseData: @@ -2233,7 +2233,7 @@ func update_guest_star_slot_settings(opt: TwitchUpdateGuestStarSlotSettings.Opt, if optionals.has("volume"): path += "volume=" + str(optionals.volume) + "&" path += "broadcaster_id=" + str(broadcaster_id) + "&" - + var response: BufferedHTTPClient.ResponseData = await request(path, HTTPClient.METHOD_PATCH, "", "") if response.response_code >= 400: @@ -2243,13 +2243,13 @@ func update_guest_star_slot_settings(opt: TwitchUpdateGuestStarSlotSettings.Opt, ## NEW Gets the status of a Hype Train for the specified broadcaster. ## -## broadcaster_id - The User ID of the channel broadcaster. +## broadcaster_id - The User ID of the channel broadcaster. ## ## https://dev.twitch.tv/docs/api/reference#get-hype-train-status func get_hype_train_status(broadcaster_id: String) -> TwitchGetHypeTrainStatus.Response: var path: String = "/hypetrain/status?" path += "broadcaster_id=" + str(broadcaster_id) + "&" - + var response: BufferedHTTPClient.ResponseData = await request(path, HTTPClient.METHOD_GET, "", "") var result: Variant = {} @@ -2260,19 +2260,19 @@ func get_hype_train_status(broadcaster_id: String) -> TwitchGetHypeTrainStatus.R var parsed_result: TwitchGetHypeTrainStatus.Response = TwitchGetHypeTrainStatus.Response.from_json(result) parsed_result.response = response - + return parsed_result ## Checks whether AutoMod would flag the specified message for review. ## -## broadcaster_id - The ID of the broadcaster whose AutoMod settings and list of blocked terms are used to check the message. This ID must match the user ID in the access token. +## broadcaster_id - The ID of the broadcaster whose AutoMod settings and list of blocked terms are used to check the message. This ID must match the user ID in the access token. ## ## https://dev.twitch.tv/docs/api/reference#check-automod-status func check_automod_status(body: TwitchCheckAutoModStatus.Body, broadcaster_id: String) -> TwitchCheckAutoModStatus.Response: var path: String = "/moderation/enforcements/status?" path += "broadcaster_id=" + str(broadcaster_id) + "&" - + var response: BufferedHTTPClient.ResponseData = await request(path, HTTPClient.METHOD_POST, body, "application/json") var result: Variant = {} @@ -2283,7 +2283,7 @@ func check_automod_status(body: TwitchCheckAutoModStatus.Body, broadcaster_id: S var parsed_result: TwitchCheckAutoModStatus.Response = TwitchCheckAutoModStatus.Response.from_json(result) parsed_result.response = response - + return parsed_result @@ -2294,7 +2294,7 @@ func check_automod_status(body: TwitchCheckAutoModStatus.Body, broadcaster_id: S ## https://dev.twitch.tv/docs/api/reference#manage-held-automod-messages func manage_held_automod_messages(body: TwitchManageHeldAutoModMessages.Body) -> BufferedHTTPClient.ResponseData: var path: String = "/moderation/automod/message?" - + var response: BufferedHTTPClient.ResponseData = await request(path, HTTPClient.METHOD_POST, body, "application/json") if response.response_code >= 400: @@ -2304,15 +2304,15 @@ func manage_held_automod_messages(body: TwitchManageHeldAutoModMessages.Body) -> ## Gets the broadcaster’s AutoMod settings. ## -## broadcaster_id - The ID of the broadcaster whose AutoMod settings you want to get. -## moderator_id - The ID of the broadcaster or a user that has permission to moderate the broadcaster’s chat room. This ID must match the user ID in the user access token. +## broadcaster_id - The ID of the broadcaster whose AutoMod settings you want to get. +## moderator_id - The ID of the broadcaster or a user that has permission to moderate the broadcaster’s chat room. This ID must match the user ID in the user access token. ## ## https://dev.twitch.tv/docs/api/reference#get-automod-settings func get_automod_settings(moderator_id: String, broadcaster_id: String) -> TwitchGetAutoModSettings.Response: var path: String = "/moderation/automod/settings?" path += "moderator_id=" + str(moderator_id) + "&" path += "broadcaster_id=" + str(broadcaster_id) + "&" - + var response: BufferedHTTPClient.ResponseData = await request(path, HTTPClient.METHOD_GET, "", "") var result: Variant = {} @@ -2323,21 +2323,21 @@ func get_automod_settings(moderator_id: String, broadcaster_id: String) -> Twitc var parsed_result: TwitchGetAutoModSettings.Response = TwitchGetAutoModSettings.Response.from_json(result) parsed_result.response = response - + return parsed_result ## Updates the broadcaster’s AutoMod settings. ## -## broadcaster_id - The ID of the broadcaster whose AutoMod settings you want to update. -## moderator_id - The ID of the broadcaster or a user that has permission to moderate the broadcaster’s chat room. This ID must match the user ID in the user access token. +## broadcaster_id - The ID of the broadcaster whose AutoMod settings you want to update. +## moderator_id - The ID of the broadcaster or a user that has permission to moderate the broadcaster’s chat room. This ID must match the user ID in the user access token. ## ## https://dev.twitch.tv/docs/api/reference#update-automod-settings func update_automod_settings(body: TwitchUpdateAutoModSettings.Body, moderator_id: String, broadcaster_id: String) -> TwitchUpdateAutoModSettings.Response: var path: String = "/moderation/automod/settings?" path += "moderator_id=" + str(moderator_id) + "&" path += "broadcaster_id=" + str(broadcaster_id) + "&" - + var response: BufferedHTTPClient.ResponseData = await request(path, HTTPClient.METHOD_PUT, body, "application/json") var result: Variant = {} @@ -2348,13 +2348,13 @@ func update_automod_settings(body: TwitchUpdateAutoModSettings.Body, moderator_i var parsed_result: TwitchUpdateAutoModSettings.Response = TwitchUpdateAutoModSettings.Response.from_json(result) parsed_result.response = response - + return parsed_result ## Gets all users that the broadcaster banned or put in a timeout. ## -## broadcaster_id - The ID of the broadcaster whose list of banned users you want to get. This ID must match the user ID in the access token. +## broadcaster_id - The ID of the broadcaster whose list of banned users you want to get. This ID must match the user ID in the access token. ## ## https://dev.twitch.tv/docs/api/reference#get-banned-users func get_banned_users(opt: TwitchGetBannedUsers.Opt, broadcaster_id: String) -> TwitchGetBannedUsers.Response: @@ -2368,11 +2368,11 @@ func get_banned_users(opt: TwitchGetBannedUsers.Opt, broadcaster_id: String) -> if optionals.has("first"): path += "first=" + str(optionals.first) + "&" if optionals.has("user_id"): - + for param in optionals.user_id: - path += "user_id=" + str(param) + "&" + path += "user_id=" + str(param) + "&" path += "broadcaster_id=" + str(broadcaster_id) + "&" - + var response: BufferedHTTPClient.ResponseData = await request(path, HTTPClient.METHOD_GET, "", "") var result: Variant = {} @@ -2388,21 +2388,21 @@ func get_banned_users(opt: TwitchGetBannedUsers.Opt, broadcaster_id: String) -> if not opt: opt = TwitchGetBannedUsers.Opt.new() opt.after = cursor parsed_result._next_page = get_banned_users.bind(opt, broadcaster_id) - + return parsed_result ## Bans a user from participating in a broadcaster’s chat room or puts them in a timeout. ## -## broadcaster_id - The ID of the broadcaster whose chat room the user is being banned from. -## moderator_id - The ID of the broadcaster or a user that has permission to moderate the broadcaster’s chat room. This ID must match the user ID in the user access token. +## broadcaster_id - The ID of the broadcaster whose chat room the user is being banned from. +## moderator_id - The ID of the broadcaster or a user that has permission to moderate the broadcaster’s chat room. This ID must match the user ID in the user access token. ## ## https://dev.twitch.tv/docs/api/reference#ban-user func ban_user(body: TwitchBanUser.Body, moderator_id: String, broadcaster_id: String) -> TwitchBanUser.Response: var path: String = "/moderation/bans?" path += "moderator_id=" + str(moderator_id) + "&" path += "broadcaster_id=" + str(broadcaster_id) + "&" - + var response: BufferedHTTPClient.ResponseData = await request(path, HTTPClient.METHOD_POST, body, "application/json") var result: Variant = {} @@ -2413,15 +2413,15 @@ func ban_user(body: TwitchBanUser.Body, moderator_id: String, broadcaster_id: St var parsed_result: TwitchBanUser.Response = TwitchBanUser.Response.from_json(result) parsed_result.response = response - + return parsed_result ## Removes the ban or timeout that was placed on the specified user. ## -## broadcaster_id - The ID of the broadcaster whose chat room the user is banned from chatting in. -## moderator_id - The ID of the broadcaster or a user that has permission to moderate the broadcaster’s chat room. This ID must match the user ID in the user access token. -## user_id - The ID of the user to remove the ban or timeout from. +## broadcaster_id - The ID of the broadcaster whose chat room the user is banned from chatting in. +## moderator_id - The ID of the broadcaster or a user that has permission to moderate the broadcaster’s chat room. This ID must match the user ID in the user access token. +## user_id - The ID of the user to remove the ban or timeout from. ## ## https://dev.twitch.tv/docs/api/reference#unban-user func unban_user(moderator_id: String, user_id: String, broadcaster_id: String) -> BufferedHTTPClient.ResponseData: @@ -2429,7 +2429,7 @@ func unban_user(moderator_id: String, user_id: String, broadcaster_id: String) - path += "moderator_id=" + str(moderator_id) + "&" path += "user_id=" + str(user_id) + "&" path += "broadcaster_id=" + str(broadcaster_id) + "&" - + var response: BufferedHTTPClient.ResponseData = await request(path, HTTPClient.METHOD_DELETE, "", "") if response.response_code >= 400: @@ -2439,15 +2439,15 @@ func unban_user(moderator_id: String, user_id: String, broadcaster_id: String) - ## Gets a list of unban requests for a broadcaster’s channel. ## -## broadcaster_id - The ID of the broadcaster whose channel is receiving unban requests. -## moderator_id - The ID of the broadcaster or a user that has permission to moderate the broadcaster’s unban requests. This ID must match the user ID in the user access token. -## status - Filter by a status. -## +## broadcaster_id - The ID of the broadcaster whose channel is receiving unban requests. +## moderator_id - The ID of the broadcaster or a user that has permission to moderate the broadcaster’s unban requests. This ID must match the user ID in the user access token. +## status - Filter by a status. +## ## * pending ## * approved ## * denied ## * acknowledged -## * canceled +## * canceled ## ## https://dev.twitch.tv/docs/api/reference#get-unban-requests func get_unban_requests(opt: TwitchGetUnbanRequests.Opt, moderator_id: String, status: String, broadcaster_id: String) -> TwitchGetUnbanRequests.Response: @@ -2463,7 +2463,7 @@ func get_unban_requests(opt: TwitchGetUnbanRequests.Opt, moderator_id: String, s if optionals.has("user_id"): path += "user_id=" + str(optionals.user_id) + "&" path += "broadcaster_id=" + str(broadcaster_id) + "&" - + var response: BufferedHTTPClient.ResponseData = await request(path, HTTPClient.METHOD_GET, "", "") var result: Variant = {} @@ -2479,19 +2479,19 @@ func get_unban_requests(opt: TwitchGetUnbanRequests.Opt, moderator_id: String, s if not opt: opt = TwitchGetUnbanRequests.Opt.new() opt.after = cursor parsed_result._next_page = get_unban_requests.bind(opt, moderator_id, status, broadcaster_id) - + return parsed_result ## Resolves an unban request by approving or denying it. ## -## broadcaster_id - The ID of the broadcaster whose channel is approving or denying the unban request. -## moderator_id - The ID of the broadcaster or a user that has permission to moderate the broadcaster’s unban requests. This ID must match the user ID in the user access token. -## unban_request_id - The ID of the broadcaster or a user that has permission to moderate the broadcaster’s unban requests. This ID must match the user ID in the user access token. -## status - Resolution status. -## +## broadcaster_id - The ID of the broadcaster whose channel is approving or denying the unban request. +## moderator_id - The ID of the broadcaster or a user that has permission to moderate the broadcaster’s unban requests. This ID must match the user ID in the user access token. +## unban_request_id - The ID of the broadcaster or a user that has permission to moderate the broadcaster’s unban requests. This ID must match the user ID in the user access token. +## status - Resolution status. +## ## * approved -## * denied +## * denied ## ## https://dev.twitch.tv/docs/api/reference#resolve-unban-requests func resolve_unban_requests(opt: TwitchResolveUnbanRequests.Opt, moderator_id: String, status: String, unban_request_id: String, broadcaster_id: String) -> TwitchResolveUnbanRequests.Response: @@ -2504,7 +2504,7 @@ func resolve_unban_requests(opt: TwitchResolveUnbanRequests.Opt, moderator_id: S if optionals.has("resolution_text"): path += "resolution_text=" + str(optionals.resolution_text) + "&" path += "broadcaster_id=" + str(broadcaster_id) + "&" - + var response: BufferedHTTPClient.ResponseData = await request(path, HTTPClient.METHOD_PATCH, "", "") var result: Variant = {} @@ -2515,14 +2515,14 @@ func resolve_unban_requests(opt: TwitchResolveUnbanRequests.Opt, moderator_id: S var parsed_result: TwitchResolveUnbanRequests.Response = TwitchResolveUnbanRequests.Response.from_json(result) parsed_result.response = response - + return parsed_result ## Gets the broadcaster’s list of non-private, blocked words or phrases. ## -## broadcaster_id - The ID of the broadcaster whose blocked terms you’re getting. -## moderator_id - The ID of the broadcaster or a user that has permission to moderate the broadcaster’s chat room. This ID must match the user ID in the user access token. +## broadcaster_id - The ID of the broadcaster whose blocked terms you’re getting. +## moderator_id - The ID of the broadcaster or a user that has permission to moderate the broadcaster’s chat room. This ID must match the user ID in the user access token. ## ## https://dev.twitch.tv/docs/api/reference#get-blocked-terms func get_blocked_terms(opt: TwitchGetBlockedTerms.Opt, moderator_id: String, broadcaster_id: String) -> TwitchGetBlockedTerms.Response: @@ -2535,7 +2535,7 @@ func get_blocked_terms(opt: TwitchGetBlockedTerms.Opt, moderator_id: String, bro if optionals.has("first"): path += "first=" + str(optionals.first) + "&" path += "broadcaster_id=" + str(broadcaster_id) + "&" - + var response: BufferedHTTPClient.ResponseData = await request(path, HTTPClient.METHOD_GET, "", "") var result: Variant = {} @@ -2551,21 +2551,21 @@ func get_blocked_terms(opt: TwitchGetBlockedTerms.Opt, moderator_id: String, bro if not opt: opt = TwitchGetBlockedTerms.Opt.new() opt.after = cursor parsed_result._next_page = get_blocked_terms.bind(opt, moderator_id, broadcaster_id) - + return parsed_result ## Adds a word or phrase to the broadcaster’s list of blocked terms. ## -## broadcaster_id - The ID of the broadcaster that owns the list of blocked terms. -## moderator_id - The ID of the broadcaster or a user that has permission to moderate the broadcaster’s chat room. This ID must match the user ID in the user access token. +## broadcaster_id - The ID of the broadcaster that owns the list of blocked terms. +## moderator_id - The ID of the broadcaster or a user that has permission to moderate the broadcaster’s chat room. This ID must match the user ID in the user access token. ## ## https://dev.twitch.tv/docs/api/reference#add-blocked-term func add_blocked_term(body: TwitchAddBlockedTerm.Body, moderator_id: String, broadcaster_id: String) -> TwitchAddBlockedTerm.Response: var path: String = "/moderation/blocked_terms?" path += "moderator_id=" + str(moderator_id) + "&" path += "broadcaster_id=" + str(broadcaster_id) + "&" - + var response: BufferedHTTPClient.ResponseData = await request(path, HTTPClient.METHOD_POST, body, "application/json") var result: Variant = {} @@ -2576,15 +2576,15 @@ func add_blocked_term(body: TwitchAddBlockedTerm.Body, moderator_id: String, bro var parsed_result: TwitchAddBlockedTerm.Response = TwitchAddBlockedTerm.Response.from_json(result) parsed_result.response = response - + return parsed_result ## Removes the word or phrase from the broadcaster’s list of blocked terms. ## -## broadcaster_id - The ID of the broadcaster that owns the list of blocked terms. -## moderator_id - The ID of the broadcaster or a user that has permission to moderate the broadcaster’s chat room. This ID must match the user ID in the user access token. -## id - The ID of the blocked term to remove from the broadcaster’s list of blocked terms. +## broadcaster_id - The ID of the broadcaster that owns the list of blocked terms. +## moderator_id - The ID of the broadcaster or a user that has permission to moderate the broadcaster’s chat room. This ID must match the user ID in the user access token. +## id - The ID of the blocked term to remove from the broadcaster’s list of blocked terms. ## ## https://dev.twitch.tv/docs/api/reference#remove-blocked-term func remove_blocked_term(id: String, moderator_id: String, broadcaster_id: String) -> BufferedHTTPClient.ResponseData: @@ -2592,7 +2592,7 @@ func remove_blocked_term(id: String, moderator_id: String, broadcaster_id: Strin path += "id=" + str(id) + "&" path += "moderator_id=" + str(moderator_id) + "&" path += "broadcaster_id=" + str(broadcaster_id) + "&" - + var response: BufferedHTTPClient.ResponseData = await request(path, HTTPClient.METHOD_DELETE, "", "") if response.response_code >= 400: @@ -2602,8 +2602,8 @@ func remove_blocked_term(id: String, moderator_id: String, broadcaster_id: Strin ## Removes a single chat message or all chat messages from the broadcaster’s chat room. ## -## broadcaster_id - The ID of the broadcaster that owns the chat room to remove messages from. -## moderator_id - The ID of the broadcaster or a user that has permission to moderate the broadcaster’s chat room. This ID must match the user ID in the user access token. +## broadcaster_id - The ID of the broadcaster that owns the chat room to remove messages from. +## moderator_id - The ID of the broadcaster or a user that has permission to moderate the broadcaster’s chat room. This ID must match the user ID in the user access token. ## ## https://dev.twitch.tv/docs/api/reference#delete-chat-messages func delete_chat_messages(opt: TwitchDeleteChatMessages.Opt, moderator_id: String, broadcaster_id: String) -> BufferedHTTPClient.ResponseData: @@ -2614,7 +2614,7 @@ func delete_chat_messages(opt: TwitchDeleteChatMessages.Opt, moderator_id: Strin if optionals.has("message_id"): path += "message_id=" + str(optionals.message_id) + "&" path += "broadcaster_id=" + str(broadcaster_id) + "&" - + var response: BufferedHTTPClient.ResponseData = await request(path, HTTPClient.METHOD_DELETE, "", "") if response.response_code >= 400: @@ -2624,7 +2624,7 @@ func delete_chat_messages(opt: TwitchDeleteChatMessages.Opt, moderator_id: Strin ## Gets a list of channels that the specified user has moderator privileges in. ## -## user_id - A user’s ID. Returns the list of channels that this user has moderator privileges in. This ID must match the user ID in the user OAuth token +## user_id - A user’s ID. Returns the list of channels that this user has moderator privileges in. This ID must match the user ID in the user OAuth token ## ## https://dev.twitch.tv/docs/api/reference#get-moderated-channels func get_moderated_channels(opt: TwitchGetModeratedChannels.Opt, user_id: String) -> TwitchGetModeratedChannels.Response: @@ -2636,7 +2636,7 @@ func get_moderated_channels(opt: TwitchGetModeratedChannels.Opt, user_id: String path += "after=" + str(optionals.after) + "&" if optionals.has("first"): path += "first=" + str(optionals.first) + "&" - + var response: BufferedHTTPClient.ResponseData = await request(path, HTTPClient.METHOD_GET, "", "") var result: Variant = {} @@ -2652,13 +2652,13 @@ func get_moderated_channels(opt: TwitchGetModeratedChannels.Opt, user_id: String if not opt: opt = TwitchGetModeratedChannels.Opt.new() opt.after = cursor parsed_result._next_page = get_moderated_channels.bind(opt, user_id) - + return parsed_result ## Gets all users allowed to moderate the broadcaster’s chat room. ## -## broadcaster_id - The ID of the broadcaster whose list of moderators you want to get. This ID must match the user ID in the access token. +## broadcaster_id - The ID of the broadcaster whose list of moderators you want to get. This ID must match the user ID in the access token. ## ## https://dev.twitch.tv/docs/api/reference#get-moderators func get_moderators(opt: TwitchGetModerators.Opt, broadcaster_id: String) -> TwitchGetModerators.Response: @@ -2670,11 +2670,11 @@ func get_moderators(opt: TwitchGetModerators.Opt, broadcaster_id: String) -> Twi if optionals.has("first"): path += "first=" + str(optionals.first) + "&" if optionals.has("user_id"): - + for param in optionals.user_id: - path += "user_id=" + str(param) + "&" + path += "user_id=" + str(param) + "&" path += "broadcaster_id=" + str(broadcaster_id) + "&" - + var response: BufferedHTTPClient.ResponseData = await request(path, HTTPClient.METHOD_GET, "", "") var result: Variant = {} @@ -2690,21 +2690,21 @@ func get_moderators(opt: TwitchGetModerators.Opt, broadcaster_id: String) -> Twi if not opt: opt = TwitchGetModerators.Opt.new() opt.after = cursor parsed_result._next_page = get_moderators.bind(opt, broadcaster_id) - + return parsed_result ## Adds a moderator to the broadcaster’s chat room. ## -## broadcaster_id - The ID of the broadcaster that owns the chat room. This ID must match the user ID in the access token. -## user_id - The ID of the user to add as a moderator in the broadcaster’s chat room. +## broadcaster_id - The ID of the broadcaster that owns the chat room. This ID must match the user ID in the access token. +## user_id - The ID of the user to add as a moderator in the broadcaster’s chat room. ## ## https://dev.twitch.tv/docs/api/reference#add-channel-moderator func add_channel_moderator(user_id: String, broadcaster_id: String) -> BufferedHTTPClient.ResponseData: var path: String = "/moderation/moderators?" path += "user_id=" + str(user_id) + "&" path += "broadcaster_id=" + str(broadcaster_id) + "&" - + var response: BufferedHTTPClient.ResponseData = await request(path, HTTPClient.METHOD_POST, "", "") if response.response_code >= 400: @@ -2714,15 +2714,15 @@ func add_channel_moderator(user_id: String, broadcaster_id: String) -> BufferedH ## Removes a moderator from the broadcaster’s chat room. ## -## broadcaster_id - The ID of the broadcaster that owns the chat room. This ID must match the user ID in the access token. -## user_id - The ID of the user to remove as a moderator from the broadcaster’s chat room. +## broadcaster_id - The ID of the broadcaster that owns the chat room. This ID must match the user ID in the access token. +## user_id - The ID of the user to remove as a moderator from the broadcaster’s chat room. ## ## https://dev.twitch.tv/docs/api/reference#remove-channel-moderator func remove_channel_moderator(user_id: String, broadcaster_id: String) -> BufferedHTTPClient.ResponseData: var path: String = "/moderation/moderators?" path += "user_id=" + str(user_id) + "&" path += "broadcaster_id=" + str(broadcaster_id) + "&" - + var response: BufferedHTTPClient.ResponseData = await request(path, HTTPClient.METHOD_DELETE, "", "") if response.response_code >= 400: @@ -2732,7 +2732,7 @@ func remove_channel_moderator(user_id: String, broadcaster_id: String) -> Buffer ## Gets a list of the broadcaster’s VIPs. ## -## broadcaster_id - The ID of the broadcaster whose list of VIPs you want to get. This ID must match the user ID in the access token. +## broadcaster_id - The ID of the broadcaster whose list of VIPs you want to get. This ID must match the user ID in the access token. ## ## https://dev.twitch.tv/docs/api/reference#get-vips func get_vips(opt: TwitchGetVips.Opt, broadcaster_id: String) -> TwitchGetVips.Response: @@ -2744,11 +2744,11 @@ func get_vips(opt: TwitchGetVips.Opt, broadcaster_id: String) -> TwitchGetVips.R if optionals.has("first"): path += "first=" + str(optionals.first) + "&" if optionals.has("user_id"): - + for param in optionals.user_id: - path += "user_id=" + str(param) + "&" + path += "user_id=" + str(param) + "&" path += "broadcaster_id=" + str(broadcaster_id) + "&" - + var response: BufferedHTTPClient.ResponseData = await request(path, HTTPClient.METHOD_GET, "", "") var result: Variant = {} @@ -2764,21 +2764,21 @@ func get_vips(opt: TwitchGetVips.Opt, broadcaster_id: String) -> TwitchGetVips.R if not opt: opt = TwitchGetVips.Opt.new() opt.after = cursor parsed_result._next_page = get_vips.bind(opt, broadcaster_id) - + return parsed_result ## Adds the specified user as a VIP in the broadcaster’s channel. ## -## user_id - The ID of the user to give VIP status to. -## broadcaster_id - The ID of the broadcaster that’s adding the user as a VIP. This ID must match the user ID in the access token. +## user_id - The ID of the user to give VIP status to. +## broadcaster_id - The ID of the broadcaster that’s adding the user as a VIP. This ID must match the user ID in the access token. ## ## https://dev.twitch.tv/docs/api/reference#add-channel-vip func add_channel_vip(user_id: String, broadcaster_id: String) -> BufferedHTTPClient.ResponseData: var path: String = "/channels/vips?" path += "user_id=" + str(user_id) + "&" path += "broadcaster_id=" + str(broadcaster_id) + "&" - + var response: BufferedHTTPClient.ResponseData = await request(path, HTTPClient.METHOD_POST, "", "") if response.response_code >= 400: @@ -2788,15 +2788,15 @@ func add_channel_vip(user_id: String, broadcaster_id: String) -> BufferedHTTPCli ## Removes the specified user as a VIP in the broadcaster’s channel. ## -## user_id - The ID of the user to remove VIP status from. -## broadcaster_id - The ID of the broadcaster who owns the channel where the user has VIP status. +## user_id - The ID of the user to remove VIP status from. +## broadcaster_id - The ID of the broadcaster who owns the channel where the user has VIP status. ## ## https://dev.twitch.tv/docs/api/reference#remove-channel-vip func remove_channel_vip(user_id: String, broadcaster_id: String) -> BufferedHTTPClient.ResponseData: var path: String = "/channels/vips?" path += "user_id=" + str(user_id) + "&" path += "broadcaster_id=" + str(broadcaster_id) + "&" - + var response: BufferedHTTPClient.ResponseData = await request(path, HTTPClient.METHOD_DELETE, "", "") if response.response_code >= 400: @@ -2806,15 +2806,15 @@ func remove_channel_vip(user_id: String, broadcaster_id: String) -> BufferedHTTP ## Activates or deactivates the broadcaster’s Shield Mode. ## -## broadcaster_id - The ID of the broadcaster whose Shield Mode you want to activate or deactivate. -## moderator_id - The ID of the broadcaster or a user that is one of the broadcaster’s moderators. This ID must match the user ID in the access token. +## broadcaster_id - The ID of the broadcaster whose Shield Mode you want to activate or deactivate. +## moderator_id - The ID of the broadcaster or a user that is one of the broadcaster’s moderators. This ID must match the user ID in the access token. ## ## https://dev.twitch.tv/docs/api/reference#update-shield-mode-status func update_shield_mode_status(body: TwitchUpdateShieldModeStatus.Body, moderator_id: String, broadcaster_id: String) -> TwitchUpdateShieldModeStatus.Response: var path: String = "/moderation/shield_mode?" path += "moderator_id=" + str(moderator_id) + "&" path += "broadcaster_id=" + str(broadcaster_id) + "&" - + var response: BufferedHTTPClient.ResponseData = await request(path, HTTPClient.METHOD_PUT, body, "application/json") var result: Variant = {} @@ -2825,21 +2825,21 @@ func update_shield_mode_status(body: TwitchUpdateShieldModeStatus.Body, moderato var parsed_result: TwitchUpdateShieldModeStatus.Response = TwitchUpdateShieldModeStatus.Response.from_json(result) parsed_result.response = response - + return parsed_result ## Gets the broadcaster’s Shield Mode activation status. ## -## broadcaster_id - The ID of the broadcaster whose Shield Mode activation status you want to get. -## moderator_id - The ID of the broadcaster or a user that is one of the broadcaster’s moderators. This ID must match the user ID in the access token. +## broadcaster_id - The ID of the broadcaster whose Shield Mode activation status you want to get. +## moderator_id - The ID of the broadcaster or a user that is one of the broadcaster’s moderators. This ID must match the user ID in the access token. ## ## https://dev.twitch.tv/docs/api/reference#get-shield-mode-status func get_shield_mode_status(moderator_id: String, broadcaster_id: String) -> TwitchGetShieldModeStatus.Response: var path: String = "/moderation/shield_mode?" path += "moderator_id=" + str(moderator_id) + "&" path += "broadcaster_id=" + str(broadcaster_id) + "&" - + var response: BufferedHTTPClient.ResponseData = await request(path, HTTPClient.METHOD_GET, "", "") var result: Variant = {} @@ -2850,21 +2850,21 @@ func get_shield_mode_status(moderator_id: String, broadcaster_id: String) -> Twi var parsed_result: TwitchGetShieldModeStatus.Response = TwitchGetShieldModeStatus.Response.from_json(result) parsed_result.response = response - + return parsed_result ## Warns a user in the specified broadcaster’s chat room, preventing them from chat interaction until the warning is acknowledged. ## -## broadcaster_id - The ID of the channel in which the warning will take effect. -## moderator_id - The ID of the twitch user who requested the warning. +## broadcaster_id - The ID of the channel in which the warning will take effect. +## moderator_id - The ID of the twitch user who requested the warning. ## ## https://dev.twitch.tv/docs/api/reference#warn-chat-user func warn_chat_user(body: TwitchWarnChatUser.Body, moderator_id: String, broadcaster_id: String) -> TwitchWarnChatUser.Response: var path: String = "/moderation/warnings?" path += "moderator_id=" + str(moderator_id) + "&" path += "broadcaster_id=" + str(broadcaster_id) + "&" - + var response: BufferedHTTPClient.ResponseData = await request(path, HTTPClient.METHOD_POST, body, "application/json") var result: Variant = {} @@ -2875,21 +2875,21 @@ func warn_chat_user(body: TwitchWarnChatUser.Body, moderator_id: String, broadca var parsed_result: TwitchWarnChatUser.Response = TwitchWarnChatUser.Response.from_json(result) parsed_result.response = response - + return parsed_result ## NEW Adds a suspicious user status to a chatter on the broadcaster’s channel. ## -## broadcaster_id - The user ID of the broadcaster, indicating the channel where the status is being applied. -## moderator_id - The user ID of the moderator who is applying the status. +## broadcaster_id - The user ID of the broadcaster, indicating the channel where the status is being applied. +## moderator_id - The user ID of the moderator who is applying the status. ## ## https://dev.twitch.tv/docs/api/reference#add-suspicious-status-to-chat-user func add_suspicious_status_to_chat_user(body: TwitchAddSuspiciousStatusToChatUser.Body, moderator_id: String, broadcaster_id: String) -> TwitchAddSuspiciousStatusToChatUser.Response: var path: String = "/moderation/suspicious_users?" path += "moderator_id=" + str(moderator_id) + "&" path += "broadcaster_id=" + str(broadcaster_id) + "&" - + var response: BufferedHTTPClient.ResponseData = await request(path, HTTPClient.METHOD_POST, body, "application/json") var result: Variant = {} @@ -2900,15 +2900,15 @@ func add_suspicious_status_to_chat_user(body: TwitchAddSuspiciousStatusToChatUse var parsed_result: TwitchAddSuspiciousStatusToChatUser.Response = TwitchAddSuspiciousStatusToChatUser.Response.from_json(result) parsed_result.response = response - + return parsed_result ## NEW Remove a suspicious user status from a chatter on broadcaster’s channel. ## -## broadcaster_id - The user ID of the broadcaster, indicating the channel where the status is being removed. -## moderator_id - The user ID of the moderator who is removing the status. -## user_id - The ID of the user having the suspicious status removed. +## broadcaster_id - The user ID of the broadcaster, indicating the channel where the status is being removed. +## moderator_id - The user ID of the moderator who is removing the status. +## user_id - The ID of the user having the suspicious status removed. ## ## https://dev.twitch.tv/docs/api/reference#remove-suspicious-status-from-chat-user func remove_suspicious_status_from_chat_user(moderator_id: String, user_id: String, broadcaster_id: String) -> TwitchRemoveSuspiciousStatusFromChatUser.Response: @@ -2916,7 +2916,7 @@ func remove_suspicious_status_from_chat_user(moderator_id: String, user_id: Stri path += "moderator_id=" + str(moderator_id) + "&" path += "user_id=" + str(user_id) + "&" path += "broadcaster_id=" + str(broadcaster_id) + "&" - + var response: BufferedHTTPClient.ResponseData = await request(path, HTTPClient.METHOD_DELETE, "", "") var result: Variant = {} @@ -2927,13 +2927,13 @@ func remove_suspicious_status_from_chat_user(moderator_id: String, user_id: Stri var parsed_result: TwitchRemoveSuspiciousStatusFromChatUser.Response = TwitchRemoveSuspiciousStatusFromChatUser.Response.from_json(result) parsed_result.response = response - + return parsed_result ## Gets a list of polls that the broadcaster created. ## -## broadcaster_id - The ID of the broadcaster that created the polls. This ID must match the user ID in the user access token. +## broadcaster_id - The ID of the broadcaster that created the polls. This ID must match the user ID in the user access token. ## ## https://dev.twitch.tv/docs/api/reference#get-polls func get_polls(opt: TwitchGetPolls.Opt, broadcaster_id: String) -> TwitchGetPolls.Response: @@ -2945,11 +2945,11 @@ func get_polls(opt: TwitchGetPolls.Opt, broadcaster_id: String) -> TwitchGetPoll if optionals.has("first"): path += "first=" + str(optionals.first) + "&" if optionals.has("id"): - + for param in optionals.id: - path += "id=" + str(param) + "&" + path += "id=" + str(param) + "&" path += "broadcaster_id=" + str(broadcaster_id) + "&" - + var response: BufferedHTTPClient.ResponseData = await request(path, HTTPClient.METHOD_GET, "", "") var result: Variant = {} @@ -2965,7 +2965,7 @@ func get_polls(opt: TwitchGetPolls.Opt, broadcaster_id: String) -> TwitchGetPoll if not opt: opt = TwitchGetPolls.Opt.new() opt.after = cursor parsed_result._next_page = get_polls.bind(opt, broadcaster_id) - + return parsed_result @@ -2976,7 +2976,7 @@ func get_polls(opt: TwitchGetPolls.Opt, broadcaster_id: String) -> TwitchGetPoll ## https://dev.twitch.tv/docs/api/reference#create-poll func create_poll(body: TwitchCreatePoll.Body) -> TwitchCreatePoll.Response: var path: String = "/polls?" - + var response: BufferedHTTPClient.ResponseData = await request(path, HTTPClient.METHOD_POST, body, "application/json") var result: Variant = {} @@ -2987,7 +2987,7 @@ func create_poll(body: TwitchCreatePoll.Body) -> TwitchCreatePoll.Response: var parsed_result: TwitchCreatePoll.Response = TwitchCreatePoll.Response.from_json(result) parsed_result.response = response - + return parsed_result @@ -2998,7 +2998,7 @@ func create_poll(body: TwitchCreatePoll.Body) -> TwitchCreatePoll.Response: ## https://dev.twitch.tv/docs/api/reference#end-poll func end_poll(body: TwitchEndPoll.Body) -> TwitchEndPoll.Response: var path: String = "/polls?" - + var response: BufferedHTTPClient.ResponseData = await request(path, HTTPClient.METHOD_PATCH, body, "application/json") var result: Variant = {} @@ -3009,13 +3009,13 @@ func end_poll(body: TwitchEndPoll.Body) -> TwitchEndPoll.Response: var parsed_result: TwitchEndPoll.Response = TwitchEndPoll.Response.from_json(result) parsed_result.response = response - + return parsed_result ## Gets a list of Channel Points Predictions that the broadcaster created. ## -## broadcaster_id - The ID of the broadcaster whose predictions you want to get. This ID must match the user ID in the user access token. +## broadcaster_id - The ID of the broadcaster whose predictions you want to get. This ID must match the user ID in the user access token. ## ## https://dev.twitch.tv/docs/api/reference#get-predictions func get_predictions(opt: TwitchGetPredictions.Opt, broadcaster_id: String) -> TwitchGetPredictions.Response: @@ -3027,11 +3027,11 @@ func get_predictions(opt: TwitchGetPredictions.Opt, broadcaster_id: String) -> T if optionals.has("first"): path += "first=" + str(optionals.first) + "&" if optionals.has("id"): - + for param in optionals.id: - path += "id=" + str(param) + "&" + path += "id=" + str(param) + "&" path += "broadcaster_id=" + str(broadcaster_id) + "&" - + var response: BufferedHTTPClient.ResponseData = await request(path, HTTPClient.METHOD_GET, "", "") var result: Variant = {} @@ -3047,7 +3047,7 @@ func get_predictions(opt: TwitchGetPredictions.Opt, broadcaster_id: String) -> T if not opt: opt = TwitchGetPredictions.Opt.new() opt.after = cursor parsed_result._next_page = get_predictions.bind(opt, broadcaster_id) - + return parsed_result @@ -3058,7 +3058,7 @@ func get_predictions(opt: TwitchGetPredictions.Opt, broadcaster_id: String) -> T ## https://dev.twitch.tv/docs/api/reference#create-prediction func create_prediction(body: TwitchCreatePrediction.Body) -> TwitchCreatePrediction.Response: var path: String = "/predictions?" - + var response: BufferedHTTPClient.ResponseData = await request(path, HTTPClient.METHOD_POST, body, "application/json") var result: Variant = {} @@ -3069,7 +3069,7 @@ func create_prediction(body: TwitchCreatePrediction.Body) -> TwitchCreatePredict var parsed_result: TwitchCreatePrediction.Response = TwitchCreatePrediction.Response.from_json(result) parsed_result.response = response - + return parsed_result @@ -3080,7 +3080,7 @@ func create_prediction(body: TwitchCreatePrediction.Body) -> TwitchCreatePredict ## https://dev.twitch.tv/docs/api/reference#end-prediction func end_prediction(body: TwitchEndPrediction.Body) -> TwitchEndPrediction.Response: var path: String = "/predictions?" - + var response: BufferedHTTPClient.ResponseData = await request(path, HTTPClient.METHOD_PATCH, body, "application/json") var result: Variant = {} @@ -3091,7 +3091,7 @@ func end_prediction(body: TwitchEndPrediction.Body) -> TwitchEndPrediction.Respo var parsed_result: TwitchEndPrediction.Response = TwitchEndPrediction.Response.from_json(result) parsed_result.response = response - + return parsed_result @@ -3108,7 +3108,7 @@ func start_a_raid(opt: TwitchStartARaid.Opt) -> TwitchStartARaid.Response: path += "from_broadcaster_id=" + str(optionals.from_broadcaster_id) + "&" if optionals.has("to_broadcaster_id"): path += "to_broadcaster_id=" + str(optionals.to_broadcaster_id) + "&" - + var response: BufferedHTTPClient.ResponseData = await request(path, HTTPClient.METHOD_POST, "", "") var result: Variant = {} @@ -3119,19 +3119,19 @@ func start_a_raid(opt: TwitchStartARaid.Opt) -> TwitchStartARaid.Response: var parsed_result: TwitchStartARaid.Response = TwitchStartARaid.Response.from_json(result) parsed_result.response = response - + return parsed_result ## Cancel a pending raid. ## -## broadcaster_id - The ID of the broadcaster that initiated the raid. This ID must match the user ID in the user access token. +## broadcaster_id - The ID of the broadcaster that initiated the raid. This ID must match the user ID in the user access token. ## ## https://dev.twitch.tv/docs/api/reference#cancel-a-raid func cancel_a_raid(broadcaster_id: String) -> BufferedHTTPClient.ResponseData: var path: String = "/raids?" path += "broadcaster_id=" + str(broadcaster_id) + "&" - + var response: BufferedHTTPClient.ResponseData = await request(path, HTTPClient.METHOD_DELETE, "", "") if response.response_code >= 400: @@ -3141,7 +3141,7 @@ func cancel_a_raid(broadcaster_id: String) -> BufferedHTTPClient.ResponseData: ## Gets the broadcaster’s streaming schedule. ## -## broadcaster_id - The ID of the broadcaster that owns the streaming schedule you want to get. +## broadcaster_id - The ID of the broadcaster that owns the streaming schedule you want to get. ## ## https://dev.twitch.tv/docs/api/reference#get-channel-stream-schedule func get_channel_stream_schedule(opt: TwitchGetChannelStreamSchedule.Opt, broadcaster_id: String) -> TwitchGetChannelStreamSchedule.Response: @@ -3153,15 +3153,15 @@ func get_channel_stream_schedule(opt: TwitchGetChannelStreamSchedule.Opt, broadc if optionals.has("first"): path += "first=" + str(optionals.first) + "&" if optionals.has("id"): - + for param in optionals.id: - path += "id=" + str(param) + "&" + path += "id=" + str(param) + "&" if optionals.has("start_time"): path += "start_time=" + get_rfc_3339_date_format(optionals.start_time) + "&" if optionals.has("utc_offset"): path += "utc_offset=" + str(optionals.utc_offset) + "&" path += "broadcaster_id=" + str(broadcaster_id) + "&" - + var response: BufferedHTTPClient.ResponseData = await request(path, HTTPClient.METHOD_GET, "", "") var result: Variant = {} @@ -3172,23 +3172,23 @@ func get_channel_stream_schedule(opt: TwitchGetChannelStreamSchedule.Opt, broadc var parsed_result: TwitchGetChannelStreamSchedule.Response = TwitchGetChannelStreamSchedule.Response.from_json(result) parsed_result.response = response - + if parsed_result.data.pagination != null: opt.after = parsed_result.data.pagination.cursor parsed_result.data._next_page = get_channel_stream_schedule.bind(opt, broadcaster_id) - + return parsed_result ## Gets the broadcaster’s streaming schedule as an iCalendar. ## -## broadcaster_id - The ID of the broadcaster that owns the streaming schedule you want to get. +## broadcaster_id - The ID of the broadcaster that owns the streaming schedule you want to get. ## ## https://dev.twitch.tv/docs/api/reference#get-channel-icalendar func get_channel_icalendar(broadcaster_id: String) -> BufferedHTTPClient.ResponseData: var path: String = "/schedule/icalendar?" path += "broadcaster_id=" + str(broadcaster_id) + "&" - + var response: BufferedHTTPClient.ResponseData = await request(path, HTTPClient.METHOD_GET, "", "") if response.response_code >= 400: @@ -3198,7 +3198,7 @@ func get_channel_icalendar(broadcaster_id: String) -> BufferedHTTPClient.Respons ## Updates the broadcaster’s schedule settings, such as scheduling a vacation. ## -## broadcaster_id - The ID of the broadcaster whose schedule settings you want to update. The ID must match the user ID in the user access token. +## broadcaster_id - The ID of the broadcaster whose schedule settings you want to update. The ID must match the user ID in the user access token. ## ## https://dev.twitch.tv/docs/api/reference#update-channel-stream-schedule func update_channel_stream_schedule(opt: TwitchUpdateChannelStreamSchedule.Opt, broadcaster_id: String) -> BufferedHTTPClient.ResponseData: @@ -3214,7 +3214,7 @@ func update_channel_stream_schedule(opt: TwitchUpdateChannelStreamSchedule.Opt, if optionals.has("vacation_start_time"): path += "vacation_start_time=" + get_rfc_3339_date_format(optionals.vacation_start_time) + "&" path += "broadcaster_id=" + str(broadcaster_id) + "&" - + var response: BufferedHTTPClient.ResponseData = await request(path, HTTPClient.METHOD_PATCH, "", "") if response.response_code >= 400: @@ -3224,13 +3224,13 @@ func update_channel_stream_schedule(opt: TwitchUpdateChannelStreamSchedule.Opt, ## Adds a single or recurring broadcast to the broadcaster’s streaming schedule. ## -## broadcaster_id - The ID of the broadcaster that owns the schedule to add the broadcast segment to. This ID must match the user ID in the user access token. +## broadcaster_id - The ID of the broadcaster that owns the schedule to add the broadcast segment to. This ID must match the user ID in the user access token. ## ## https://dev.twitch.tv/docs/api/reference#create-channel-stream-schedule-segment func create_channel_stream_schedule_segment(body: TwitchCreateChannelStreamScheduleSegment.Body, broadcaster_id: String) -> TwitchCreateChannelStreamScheduleSegment.Response: var path: String = "/schedule/segment?" path += "broadcaster_id=" + str(broadcaster_id) + "&" - + var response: BufferedHTTPClient.ResponseData = await request(path, HTTPClient.METHOD_POST, body, "application/json") var result: Variant = {} @@ -3241,21 +3241,21 @@ func create_channel_stream_schedule_segment(body: TwitchCreateChannelStreamSched var parsed_result: TwitchCreateChannelStreamScheduleSegment.Response = TwitchCreateChannelStreamScheduleSegment.Response.from_json(result) parsed_result.response = response - + return parsed_result ## Updates a scheduled broadcast segment. ## -## broadcaster_id - The ID of the broadcaster who owns the broadcast segment to update. This ID must match the user ID in the user access token. -## id - The ID of the broadcast segment to update. +## broadcaster_id - The ID of the broadcaster who owns the broadcast segment to update. This ID must match the user ID in the user access token. +## id - The ID of the broadcast segment to update. ## ## https://dev.twitch.tv/docs/api/reference#update-channel-stream-schedule-segment func update_channel_stream_schedule_segment(body: TwitchUpdateChannelStreamScheduleSegment.Body, id: String, broadcaster_id: String) -> TwitchUpdateChannelStreamScheduleSegment.Response: var path: String = "/schedule/segment?" path += "id=" + str(id) + "&" path += "broadcaster_id=" + str(broadcaster_id) + "&" - + var response: BufferedHTTPClient.ResponseData = await request(path, HTTPClient.METHOD_PATCH, body, "application/json") var result: Variant = {} @@ -3266,21 +3266,21 @@ func update_channel_stream_schedule_segment(body: TwitchUpdateChannelStreamSched var parsed_result: TwitchUpdateChannelStreamScheduleSegment.Response = TwitchUpdateChannelStreamScheduleSegment.Response.from_json(result) parsed_result.response = response - + return parsed_result ## Deletes a broadcast from the broadcaster’s streaming schedule. ## -## broadcaster_id - The ID of the broadcaster that owns the streaming schedule. This ID must match the user ID in the user access token. -## id - The ID of the broadcast segment to remove. +## broadcaster_id - The ID of the broadcaster that owns the streaming schedule. This ID must match the user ID in the user access token. +## id - The ID of the broadcast segment to remove. ## ## https://dev.twitch.tv/docs/api/reference#delete-channel-stream-schedule-segment func delete_channel_stream_schedule_segment(id: String, broadcaster_id: String) -> BufferedHTTPClient.ResponseData: var path: String = "/schedule/segment?" path += "id=" + str(id) + "&" path += "broadcaster_id=" + str(broadcaster_id) + "&" - + var response: BufferedHTTPClient.ResponseData = await request(path, HTTPClient.METHOD_DELETE, "", "") if response.response_code >= 400: @@ -3290,7 +3290,7 @@ func delete_channel_stream_schedule_segment(id: String, broadcaster_id: String) ## Gets the games or categories that match the specified query. ## -## query - The URI-encoded search string. For example, encode _#archery_ as `%23archery` and search strings like _angel of death_ as `angel%20of%20death`. +## query - The URI-encoded search string. For example, encode _#archery_ as `%23archery` and search strings like _angel of death_ as `angel%20of%20death`. ## ## https://dev.twitch.tv/docs/api/reference#search-categories func search_categories(opt: TwitchSearchCategories.Opt, query: String) -> TwitchSearchCategories.Response: @@ -3302,7 +3302,7 @@ func search_categories(opt: TwitchSearchCategories.Opt, query: String) -> Twitch path += "after=" + str(optionals.after) + "&" if optionals.has("first"): path += "first=" + str(optionals.first) + "&" - + var response: BufferedHTTPClient.ResponseData = await request(path, HTTPClient.METHOD_GET, "", "") var result: Variant = {} @@ -3318,13 +3318,13 @@ func search_categories(opt: TwitchSearchCategories.Opt, query: String) -> Twitch if not opt: opt = TwitchSearchCategories.Opt.new() opt.after = cursor parsed_result._next_page = search_categories.bind(opt, query) - + return parsed_result ## Gets the channels that match the specified query and have streamed content within the past 6 months. ## -## query - The URI-encoded search string. For example, encode search strings like _angel of death_ as `angel%20of%20death`. +## query - The URI-encoded search string. For example, encode search strings like _angel of death_ as `angel%20of%20death`. ## ## https://dev.twitch.tv/docs/api/reference#search-channels func search_channels(opt: TwitchSearchChannels.Opt, query: String) -> TwitchSearchChannels.Response: @@ -3338,7 +3338,7 @@ func search_channels(opt: TwitchSearchChannels.Opt, query: String) -> TwitchSear path += "first=" + str(optionals.first) + "&" if optionals.has("live_only"): path += "live_only=" + str(optionals.live_only) + "&" - + var response: BufferedHTTPClient.ResponseData = await request(path, HTTPClient.METHOD_GET, "", "") var result: Variant = {} @@ -3354,19 +3354,19 @@ func search_channels(opt: TwitchSearchChannels.Opt, query: String) -> TwitchSear if not opt: opt = TwitchSearchChannels.Opt.new() opt.after = cursor parsed_result._next_page = search_channels.bind(opt, query) - + return parsed_result ## Gets the channel’s stream key. ## -## broadcaster_id - The ID of the broadcaster that owns the channel. The ID must match the user ID in the access token. +## broadcaster_id - The ID of the broadcaster that owns the channel. The ID must match the user ID in the access token. ## ## https://dev.twitch.tv/docs/api/reference#get-stream-key func get_stream_key(broadcaster_id: String) -> TwitchGetStreamKey.Response: var path: String = "/streams/key?" path += "broadcaster_id=" + str(broadcaster_id) + "&" - + var response: BufferedHTTPClient.ResponseData = await request(path, HTTPClient.METHOD_GET, "", "") var result: Variant = {} @@ -3377,7 +3377,7 @@ func get_stream_key(broadcaster_id: String) -> TwitchGetStreamKey.Response: var parsed_result: TwitchGetStreamKey.Response = TwitchGetStreamKey.Response.from_json(result) parsed_result.response = response - + return parsed_result @@ -3397,24 +3397,24 @@ func get_streams(opt: TwitchGetStreams.Opt) -> TwitchGetStreams.Response: if optionals.has("first"): path += "first=" + str(optionals.first) + "&" if optionals.has("game_id"): - + for param in optionals.game_id: - path += "game_id=" + str(param) + "&" + path += "game_id=" + str(param) + "&" if optionals.has("language"): - + for param in optionals.language: - path += "language=" + str(param) + "&" + path += "language=" + str(param) + "&" if optionals.has("type"): path += "type=" + str(optionals.type) + "&" if optionals.has("user_id"): - + for param in optionals.user_id: - path += "user_id=" + str(param) + "&" + path += "user_id=" + str(param) + "&" if optionals.has("user_login"): - + for param in optionals.user_login: - path += "user_login=" + str(param) + "&" - + path += "user_login=" + str(param) + "&" + var response: BufferedHTTPClient.ResponseData = await request(path, HTTPClient.METHOD_GET, "", "") var result: Variant = {} @@ -3430,13 +3430,13 @@ func get_streams(opt: TwitchGetStreams.Opt) -> TwitchGetStreams.Response: if not opt: opt = TwitchGetStreams.Opt.new() opt.after = cursor parsed_result._next_page = get_streams.bind(opt) - + return parsed_result ## Gets the list of broadcasters that the user follows and that are streaming live. ## -## user_id - The ID of the user whose list of followed streams you want to get. This ID must match the user ID in the access token. +## user_id - The ID of the user whose list of followed streams you want to get. This ID must match the user ID in the access token. ## ## https://dev.twitch.tv/docs/api/reference#get-followed-streams func get_followed_streams(opt: TwitchGetFollowedStreams.Opt, user_id: String) -> TwitchGetFollowedStreams.Response: @@ -3448,7 +3448,7 @@ func get_followed_streams(opt: TwitchGetFollowedStreams.Opt, user_id: String) -> path += "after=" + str(optionals.after) + "&" if optionals.has("first"): path += "first=" + str(optionals.first) + "&" - + var response: BufferedHTTPClient.ResponseData = await request(path, HTTPClient.METHOD_GET, "", "") var result: Variant = {} @@ -3464,7 +3464,7 @@ func get_followed_streams(opt: TwitchGetFollowedStreams.Opt, user_id: String) -> if not opt: opt = TwitchGetFollowedStreams.Opt.new() opt.after = cursor parsed_result._next_page = get_followed_streams.bind(opt, user_id) - + return parsed_result @@ -3475,7 +3475,7 @@ func get_followed_streams(opt: TwitchGetFollowedStreams.Opt, user_id: String) -> ## https://dev.twitch.tv/docs/api/reference#create-stream-marker func create_stream_marker(body: TwitchCreateStreamMarker.Body) -> TwitchCreateStreamMarker.Response: var path: String = "/streams/markers?" - + var response: BufferedHTTPClient.ResponseData = await request(path, HTTPClient.METHOD_POST, body, "application/json") var result: Variant = {} @@ -3486,7 +3486,7 @@ func create_stream_marker(body: TwitchCreateStreamMarker.Body) -> TwitchCreateSt var parsed_result: TwitchCreateStreamMarker.Response = TwitchCreateStreamMarker.Response.from_json(result) parsed_result.response = response - + return parsed_result @@ -3509,7 +3509,7 @@ func get_stream_markers(opt: TwitchGetStreamMarkers.Opt) -> TwitchGetStreamMarke path += "user_id=" + str(optionals.user_id) + "&" if optionals.has("video_id"): path += "video_id=" + str(optionals.video_id) + "&" - + var response: BufferedHTTPClient.ResponseData = await request(path, HTTPClient.METHOD_GET, "", "") var result: Variant = {} @@ -3525,13 +3525,13 @@ func get_stream_markers(opt: TwitchGetStreamMarkers.Opt) -> TwitchGetStreamMarke if not opt: opt = TwitchGetStreamMarkers.Opt.new() opt.after = cursor parsed_result._next_page = get_stream_markers.bind(opt) - + return parsed_result ## Gets a list of users that subscribe to the specified broadcaster. ## -## broadcaster_id - The broadcaster’s ID. This ID must match the user ID in the access token. +## broadcaster_id - The broadcaster’s ID. This ID must match the user ID in the access token. ## ## https://dev.twitch.tv/docs/api/reference#get-broadcaster-subscriptions func get_broadcaster_subscriptions(opt: TwitchGetBroadcasterSubscriptions.Opt, broadcaster_id: String) -> TwitchGetBroadcasterSubscriptions.Response: @@ -3545,11 +3545,11 @@ func get_broadcaster_subscriptions(opt: TwitchGetBroadcasterSubscriptions.Opt, b if optionals.has("first"): path += "first=" + str(optionals.first) + "&" if optionals.has("user_id"): - + for param in optionals.user_id: - path += "user_id=" + str(param) + "&" + path += "user_id=" + str(param) + "&" path += "broadcaster_id=" + str(broadcaster_id) + "&" - + var response: BufferedHTTPClient.ResponseData = await request(path, HTTPClient.METHOD_GET, "", "") var result: Variant = {} @@ -3565,21 +3565,21 @@ func get_broadcaster_subscriptions(opt: TwitchGetBroadcasterSubscriptions.Opt, b if not opt: opt = TwitchGetBroadcasterSubscriptions.Opt.new() opt.after = cursor parsed_result._next_page = get_broadcaster_subscriptions.bind(opt, broadcaster_id) - + return parsed_result ## Checks whether the user subscribes to the broadcaster’s channel. ## -## broadcaster_id - The ID of a partner or affiliate broadcaster. -## user_id - The ID of the user that you’re checking to see whether they subscribe to the broadcaster in _broadcaster\_id_. This ID must match the user ID in the access Token. +## broadcaster_id - The ID of a partner or affiliate broadcaster. +## user_id - The ID of the user that you’re checking to see whether they subscribe to the broadcaster in _broadcaster\_id_. This ID must match the user ID in the access Token. ## ## https://dev.twitch.tv/docs/api/reference#check-user-subscription func check_user_subscription(user_id: String, broadcaster_id: String) -> TwitchCheckUserSubscription.Response: var path: String = "/subscriptions/user?" path += "user_id=" + str(user_id) + "&" path += "broadcaster_id=" + str(broadcaster_id) + "&" - + var response: BufferedHTTPClient.ResponseData = await request(path, HTTPClient.METHOD_GET, "", "") var result: Variant = {} @@ -3590,7 +3590,7 @@ func check_user_subscription(user_id: String, broadcaster_id: String) -> TwitchC var parsed_result: TwitchCheckUserSubscription.Response = TwitchCheckUserSubscription.Response.from_json(result) parsed_result.response = response - + return parsed_result @@ -3608,10 +3608,10 @@ func get_all_stream_tags(opt: TwitchGetAllStreamTags.Opt) -> TwitchGetAllStreamT if optionals.has("first"): path += "first=" + str(optionals.first) + "&" if optionals.has("tag_id"): - + for param in optionals.tag_id: - path += "tag_id=" + str(param) + "&" - + path += "tag_id=" + str(param) + "&" + var response: BufferedHTTPClient.ResponseData = await request(path, HTTPClient.METHOD_GET, "", "") var result: Variant = {} @@ -3627,19 +3627,19 @@ func get_all_stream_tags(opt: TwitchGetAllStreamTags.Opt) -> TwitchGetAllStreamT if not opt: opt = TwitchGetAllStreamTags.Opt.new() opt.after = cursor parsed_result._next_page = get_all_stream_tags.bind(opt) - + return parsed_result ## Gets the list of stream tags that the broadcaster or Twitch added to their channel. ## -## broadcaster_id - The ID of the broadcaster whose stream tags you want to get. +## broadcaster_id - The ID of the broadcaster whose stream tags you want to get. ## ## https://dev.twitch.tv/docs/api/reference#get-stream-tags func get_stream_tags(broadcaster_id: String) -> TwitchGetStreamTags.Response: var path: String = "/streams/tags?" path += "broadcaster_id=" + str(broadcaster_id) + "&" - + var response: BufferedHTTPClient.ResponseData = await request(path, HTTPClient.METHOD_GET, "", "") var result: Variant = {} @@ -3650,19 +3650,19 @@ func get_stream_tags(broadcaster_id: String) -> TwitchGetStreamTags.Response: var parsed_result: TwitchGetStreamTags.Response = TwitchGetStreamTags.Response.from_json(result) parsed_result.response = response - + return parsed_result ## Gets the list of Twitch teams that the broadcaster is a member of. ## -## broadcaster_id - The ID of the broadcaster whose teams you want to get. +## broadcaster_id - The ID of the broadcaster whose teams you want to get. ## ## https://dev.twitch.tv/docs/api/reference#get-channel-teams func get_channel_teams(broadcaster_id: String) -> TwitchGetChannelTeams.Response: var path: String = "/teams/channel?" path += "broadcaster_id=" + str(broadcaster_id) + "&" - + var response: BufferedHTTPClient.ResponseData = await request(path, HTTPClient.METHOD_GET, "", "") var result: Variant = {} @@ -3673,7 +3673,7 @@ func get_channel_teams(broadcaster_id: String) -> TwitchGetChannelTeams.Response var parsed_result: TwitchGetChannelTeams.Response = TwitchGetChannelTeams.Response.from_json(result) parsed_result.response = response - + return parsed_result @@ -3690,7 +3690,7 @@ func get_teams(opt: TwitchGetTeams.Opt) -> TwitchGetTeams.Response: path += "id=" + str(optionals.id) + "&" if optionals.has("name"): path += "name=" + str(optionals.name) + "&" - + var response: BufferedHTTPClient.ResponseData = await request(path, HTTPClient.METHOD_GET, "", "") var result: Variant = {} @@ -3701,7 +3701,7 @@ func get_teams(opt: TwitchGetTeams.Opt) -> TwitchGetTeams.Response: var parsed_result: TwitchGetTeams.Response = TwitchGetTeams.Response.from_json(result) parsed_result.response = response - + return parsed_result @@ -3715,14 +3715,14 @@ func get_users(opt: TwitchGetUsers.Opt) -> TwitchGetUsers.Response: var optionals: Dictionary[StringName, Variant] = {} if opt != null: optionals = opt.to_dict() if optionals.has("id"): - + for param in optionals.id: - path += "id=" + str(param) + "&" + path += "id=" + str(param) + "&" if optionals.has("login"): - + for param in optionals.login: - path += "login=" + str(param) + "&" - + path += "login=" + str(param) + "&" + var response: BufferedHTTPClient.ResponseData = await request(path, HTTPClient.METHOD_GET, "", "") var result: Variant = {} @@ -3733,7 +3733,7 @@ func get_users(opt: TwitchGetUsers.Opt) -> TwitchGetUsers.Response: var parsed_result: TwitchGetUsers.Response = TwitchGetUsers.Response.from_json(result) parsed_result.response = response - + return parsed_result @@ -3748,7 +3748,7 @@ func update_user(opt: TwitchUpdateUser.Opt) -> TwitchUpdateUser.Response: if opt != null: optionals = opt.to_dict() if optionals.has("description"): path += "description=" + str(optionals.description) + "&" - + var response: BufferedHTTPClient.ResponseData = await request(path, HTTPClient.METHOD_PUT, "", "") var result: Variant = {} @@ -3759,21 +3759,21 @@ func update_user(opt: TwitchUpdateUser.Opt) -> TwitchUpdateUser.Response: var parsed_result: TwitchUpdateUser.Response = TwitchUpdateUser.Response.from_json(result) parsed_result.response = response - + return parsed_result ## NEW Gets the authorization scopes that the specified user has granted the application. ## -## user_id - The ID of the user(s) you want to check authorization for. To specify more than one user, include the user\_id parameter for each user to get. For example, `user_id=1234&user_id=5678`. The maximum number of IDs you may specify is 10. +## user_id - The ID of the user(s) you want to check authorization for. To specify more than one user, include the user\_id parameter for each user to get. For example, `user_id=1234&user_id=5678`. The maximum number of IDs you may specify is 10. ## ## https://dev.twitch.tv/docs/api/reference#get-authorization-by-user func get_authorization_by_user(user_id: Array[String]) -> TwitchGetAuthorizationByUser.Response: var path: String = "/authorization/users?" - + for param in user_id: - path += "user_id=" + str(param) + "&" - + path += "user_id=" + str(param) + "&" + var response: BufferedHTTPClient.ResponseData = await request(path, HTTPClient.METHOD_GET, "", "") var result: Variant = {} @@ -3784,13 +3784,13 @@ func get_authorization_by_user(user_id: Array[String]) -> TwitchGetAuthorization var parsed_result: TwitchGetAuthorizationByUser.Response = TwitchGetAuthorizationByUser.Response.from_json(result) parsed_result.response = response - + return parsed_result ## Gets the list of users that the broadcaster has blocked. ## -## broadcaster_id - The ID of the broadcaster whose list of blocked users you want to get. +## broadcaster_id - The ID of the broadcaster whose list of blocked users you want to get. ## ## https://dev.twitch.tv/docs/api/reference#get-user-block-list func get_user_block_list(opt: TwitchGetUserBlockList.Opt, broadcaster_id: String) -> TwitchGetUserBlockList.Response: @@ -3802,7 +3802,7 @@ func get_user_block_list(opt: TwitchGetUserBlockList.Opt, broadcaster_id: String if optionals.has("first"): path += "first=" + str(optionals.first) + "&" path += "broadcaster_id=" + str(broadcaster_id) + "&" - + var response: BufferedHTTPClient.ResponseData = await request(path, HTTPClient.METHOD_GET, "", "") var result: Variant = {} @@ -3818,13 +3818,13 @@ func get_user_block_list(opt: TwitchGetUserBlockList.Opt, broadcaster_id: String if not opt: opt = TwitchGetUserBlockList.Opt.new() opt.after = cursor parsed_result._next_page = get_user_block_list.bind(opt, broadcaster_id) - + return parsed_result ## Blocks the specified user from interacting with or having contact with the broadcaster. ## -## target_user_id - The ID of the user to block. The API ignores the request if the broadcaster has already blocked the user. +## target_user_id - The ID of the user to block. The API ignores the request if the broadcaster has already blocked the user. ## ## https://dev.twitch.tv/docs/api/reference#block-user func block_user(opt: TwitchBlockUser.Opt, target_user_id: String) -> BufferedHTTPClient.ResponseData: @@ -3836,7 +3836,7 @@ func block_user(opt: TwitchBlockUser.Opt, target_user_id: String) -> BufferedHTT path += "reason=" + str(optionals.reason) + "&" if optionals.has("source_context"): path += "source_context=" + str(optionals.source_context) + "&" - + var response: BufferedHTTPClient.ResponseData = await request(path, HTTPClient.METHOD_PUT, "", "") if response.response_code >= 400: @@ -3846,13 +3846,13 @@ func block_user(opt: TwitchBlockUser.Opt, target_user_id: String) -> BufferedHTT ## Removes the user from the broadcaster’s list of blocked users. ## -## target_user_id - The ID of the user to remove from the broadcaster’s list of blocked users. The API ignores the request if the broadcaster hasn’t blocked the user. +## target_user_id - The ID of the user to remove from the broadcaster’s list of blocked users. The API ignores the request if the broadcaster hasn’t blocked the user. ## ## https://dev.twitch.tv/docs/api/reference#unblock-user func unblock_user(target_user_id: String) -> BufferedHTTPClient.ResponseData: var path: String = "/users/blocks?" path += "target_user_id=" + str(target_user_id) + "&" - + var response: BufferedHTTPClient.ResponseData = await request(path, HTTPClient.METHOD_DELETE, "", "") if response.response_code >= 400: @@ -3867,7 +3867,7 @@ func unblock_user(target_user_id: String) -> BufferedHTTPClient.ResponseData: ## https://dev.twitch.tv/docs/api/reference#get-user-extensions func get_user_extensions() -> TwitchGetUserExtensions.Response: var path: String = "/users/extensions/list?" - + var response: BufferedHTTPClient.ResponseData = await request(path, HTTPClient.METHOD_GET, "", "") var result: Variant = {} @@ -3878,7 +3878,7 @@ func get_user_extensions() -> TwitchGetUserExtensions.Response: var parsed_result: TwitchGetUserExtensions.Response = TwitchGetUserExtensions.Response.from_json(result) parsed_result.response = response - + return parsed_result @@ -3893,7 +3893,7 @@ func get_user_active_extensions(opt: TwitchGetUserActiveExtensions.Opt) -> Twitc if opt != null: optionals = opt.to_dict() if optionals.has("user_id"): path += "user_id=" + str(optionals.user_id) + "&" - + var response: BufferedHTTPClient.ResponseData = await request(path, HTTPClient.METHOD_GET, "", "") var result: Variant = {} @@ -3904,7 +3904,7 @@ func get_user_active_extensions(opt: TwitchGetUserActiveExtensions.Opt) -> Twitc var parsed_result: TwitchGetUserActiveExtensions.Response = TwitchGetUserActiveExtensions.Response.from_json(result) parsed_result.response = response - + return parsed_result @@ -3915,7 +3915,7 @@ func get_user_active_extensions(opt: TwitchGetUserActiveExtensions.Opt) -> Twitc ## https://dev.twitch.tv/docs/api/reference#update-user-extensions func update_user_extensions(body: TwitchUpdateUserExtensions.Body) -> TwitchUpdateUserExtensions.Response: var path: String = "/users/extensions?" - + var response: BufferedHTTPClient.ResponseData = await request(path, HTTPClient.METHOD_PUT, body, "application/json") var result: Variant = {} @@ -3926,7 +3926,7 @@ func update_user_extensions(body: TwitchUpdateUserExtensions.Body) -> TwitchUpda var parsed_result: TwitchUpdateUserExtensions.Response = TwitchUpdateUserExtensions.Response.from_json(result) parsed_result.response = response - + return parsed_result @@ -3948,9 +3948,9 @@ func get_videos(opt: TwitchGetVideos.Opt) -> TwitchGetVideos.Response: if optionals.has("game_id"): path += "game_id=" + str(optionals.game_id) + "&" if optionals.has("id"): - + for param in optionals.id: - path += "id=" + str(param) + "&" + path += "id=" + str(param) + "&" if optionals.has("language"): path += "language=" + str(optionals.language) + "&" if optionals.has("period"): @@ -3961,7 +3961,7 @@ func get_videos(opt: TwitchGetVideos.Opt) -> TwitchGetVideos.Response: path += "type=" + str(optionals.type) + "&" if optionals.has("user_id"): path += "user_id=" + str(optionals.user_id) + "&" - + var response: BufferedHTTPClient.ResponseData = await request(path, HTTPClient.METHOD_GET, "", "") var result: Variant = {} @@ -3977,23 +3977,23 @@ func get_videos(opt: TwitchGetVideos.Opt) -> TwitchGetVideos.Response: if not opt: opt = TwitchGetVideos.Opt.new() opt.after = cursor parsed_result._next_page = get_videos.bind(opt) - + return parsed_result ## Deletes one or more videos. ## -## id - The list of videos to delete. To specify more than one video, include the _id_ parameter for each video to delete. For example, `id=1234&id=5678`. You can delete a maximum of 5 videos per request. Ignores invalid video IDs. -## -## If the user doesn’t have permission to delete one of the videos in the list, none of the videos are deleted. +## id - The list of videos to delete. To specify more than one video, include the _id_ parameter for each video to delete. For example, `id=1234&id=5678`. You can delete a maximum of 5 videos per request. Ignores invalid video IDs. +## +## If the user doesn’t have permission to delete one of the videos in the list, none of the videos are deleted. ## ## https://dev.twitch.tv/docs/api/reference#delete-videos func delete_videos(id: Array[String]) -> TwitchDeleteVideos.Response: var path: String = "/videos?" - + for param in id: - path += "id=" + str(param) + "&" - + path += "id=" + str(param) + "&" + var response: BufferedHTTPClient.ResponseData = await request(path, HTTPClient.METHOD_DELETE, "", "") var result: Variant = {} @@ -4004,24 +4004,23 @@ func delete_videos(id: Array[String]) -> TwitchDeleteVideos.Response: var parsed_result: TwitchDeleteVideos.Response = TwitchDeleteVideos.Response.from_json(result) parsed_result.response = response - + return parsed_result ## Sends a whisper message to the specified user. ## -## from_user_id - The ID of the user sending the whisper. This user must have a verified phone number. This ID must match the user ID in the user access token. -## to_user_id - The ID of the user to receive the whisper. +## from_user_id - The ID of the user sending the whisper. This user must have a verified phone number. This ID must match the user ID in the user access token. +## to_user_id - The ID of the user to receive the whisper. ## ## https://dev.twitch.tv/docs/api/reference#send-whisper func send_whisper(body: TwitchSendWhisper.Body, from_user_id: String, to_user_id: String) -> BufferedHTTPClient.ResponseData: var path: String = "/whispers?" path += "from_user_id=" + str(from_user_id) + "&" path += "to_user_id=" + str(to_user_id) + "&" - + var response: BufferedHTTPClient.ResponseData = await request(path, HTTPClient.METHOD_POST, body, "application/json") if response.response_code >= 400: _handle_error("send_whisper", response) return response - diff --git a/addons/twitcher/example/overlay_template/chat_controller.gd b/addons/twitcher/overlay_template/chat_controller.gd similarity index 100% rename from addons/twitcher/example/overlay_template/chat_controller.gd rename to addons/twitcher/overlay_template/chat_controller.gd diff --git a/addons/twitcher/example/overlay_template/chat_controller.gd.uid b/addons/twitcher/overlay_template/chat_controller.gd.uid similarity index 100% rename from addons/twitcher/example/overlay_template/chat_controller.gd.uid rename to addons/twitcher/overlay_template/chat_controller.gd.uid diff --git a/addons/twitcher/example/overlay_template/chat_controller.tscn b/addons/twitcher/overlay_template/chat_controller.tscn similarity index 90% rename from addons/twitcher/example/overlay_template/chat_controller.tscn rename to addons/twitcher/overlay_template/chat_controller.tscn index d9dabad8..c00691a1 100644 --- a/addons/twitcher/example/overlay_template/chat_controller.tscn +++ b/addons/twitcher/overlay_template/chat_controller.tscn @@ -1,9 +1,9 @@ [gd_scene format=3 uid="uid://dkvmn2mlsi7up"] -[ext_resource type="Script" uid="uid://c2s6pe7tvwbj" path="res://addons/twitcher/example/overlay_template/moveable_control.gd" id="1_n6m03"] +[ext_resource type="Script" uid="uid://c2s6pe7tvwbj" path="res://addons/twitcher/overlay_template/moveable_control.gd" id="1_n6m03"] [ext_resource type="Script" uid="uid://dcq1bvfrqimqq" path="res://addons/twitcher/chat/twitch_chat.gd" id="2_cf51l"] [ext_resource type="PackedScene" uid="uid://cfe0kxk8dptag" path="res://addons/twitcher/example/chat_view.tscn" id="4_bh8og"] -[ext_resource type="Script" uid="uid://dd6j2o3vaa5cn" path="res://addons/twitcher/example/overlay_template/chat_controller.gd" id="5_4gcxo"] +[ext_resource type="Script" uid="uid://dd6j2o3vaa5cn" path="res://addons/twitcher/overlay_template/chat_controller.gd" id="5_4gcxo"] [node name="ChatController" type="PanelContainer" unique_id=775166331] anchors_preset = 6 diff --git a/addons/twitcher/example/overlay_template/cheermote.gd b/addons/twitcher/overlay_template/cheermote.gd similarity index 100% rename from addons/twitcher/example/overlay_template/cheermote.gd rename to addons/twitcher/overlay_template/cheermote.gd diff --git a/addons/twitcher/example/overlay_template/cheermote.gd.uid b/addons/twitcher/overlay_template/cheermote.gd.uid similarity index 100% rename from addons/twitcher/example/overlay_template/cheermote.gd.uid rename to addons/twitcher/overlay_template/cheermote.gd.uid diff --git a/addons/twitcher/example/overlay_template/cheermote.tscn b/addons/twitcher/overlay_template/cheermote.tscn similarity index 90% rename from addons/twitcher/example/overlay_template/cheermote.tscn rename to addons/twitcher/overlay_template/cheermote.tscn index d9c6162f..82cd9d69 100644 --- a/addons/twitcher/example/overlay_template/cheermote.tscn +++ b/addons/twitcher/overlay_template/cheermote.tscn @@ -1,6 +1,6 @@ [gd_scene format=3 uid="uid://cftudp18otteu"] -[ext_resource type="Script" uid="uid://bs11kd3horowg" path="res://addons/twitcher/example/overlay_template/cheermote.gd" id="1_nqt04"] +[ext_resource type="Script" uid="uid://bs11kd3horowg" path="res://addons/twitcher/overlay_template/cheermote.gd" id="1_nqt04"] [sub_resource type="PhysicsMaterial" id="PhysicsMaterial_nqt04"] bounce = 0.7 diff --git a/addons/twitcher/example/overlay_template/event_listener.gd b/addons/twitcher/overlay_template/event_listener.gd similarity index 93% rename from addons/twitcher/example/overlay_template/event_listener.gd rename to addons/twitcher/overlay_template/event_listener.gd index 302a36f4..1fd3e780 100644 --- a/addons/twitcher/example/overlay_template/event_listener.gd +++ b/addons/twitcher/overlay_template/event_listener.gd @@ -1,10 +1,10 @@ extends Node const NOTIFICATION = preload("uid://bqwgietymy1b2") -const Notification = preload("uid://deso118lm3wux") +const EventListenerNotification = preload("uid://deso118lm3wux") const CHEERMOTE = preload("uid://cftudp18otteu") -const Cheermote = preload("uid://bs11kd3horowg") +const EventListenerCheermote = preload("uid://bs11kd3horowg") @export var notification_duration_in_s: float = 5 @export var notification_delay_in_between_in_s: float = 1 @@ -64,7 +64,7 @@ func _on_channel_chat_message_event(data: Variant) -> void: func show_cheermotes(cheermote: TwitchESChannelChatMessage.Cheermote) -> void: var cheermote_definition: TwitchCheermoteDefinition = TwitchCheermoteDefinition.new(cheermote.prefix, str(cheermote.tier)) var cheer_result = await TwitchMediaLoader.instance.get_cheer_info(cheermote_definition) - var cheermote_obj: Cheermote = CHEERMOTE.instantiate() + var cheermote_obj: EventListenerCheermote = CHEERMOTE.instantiate() cheermote_obj.sprite_frames = cheer_result.spriteframes cheermote_obj.size = cheermote.bits / 4 cheermote_obj.global_position = Vector2(randf_range(300, 700), randf_range(300, 700)) @@ -73,7 +73,7 @@ func show_cheermotes(cheermote: TwitchESChannelChatMessage.Cheermote) -> void: func _show_notification(display_name: String, user_id: String, text: String) -> void: - var notification: Notification = NOTIFICATION.instantiate() + var notification: EventListenerNotification = NOTIFICATION.instantiate() var user: TwitchUser = await TwitchService.instance.get_user_by_id(user_id) var profile: ImageTexture = await TwitchMediaLoader.instance.load_profile_image(user) diff --git a/addons/twitcher/example/overlay_template/event_listener.gd.uid b/addons/twitcher/overlay_template/event_listener.gd.uid similarity index 100% rename from addons/twitcher/example/overlay_template/event_listener.gd.uid rename to addons/twitcher/overlay_template/event_listener.gd.uid diff --git a/addons/twitcher/example/overlay_template/moveable_control.gd b/addons/twitcher/overlay_template/moveable_control.gd similarity index 100% rename from addons/twitcher/example/overlay_template/moveable_control.gd rename to addons/twitcher/overlay_template/moveable_control.gd diff --git a/addons/twitcher/example/overlay_template/moveable_control.gd.uid b/addons/twitcher/overlay_template/moveable_control.gd.uid similarity index 100% rename from addons/twitcher/example/overlay_template/moveable_control.gd.uid rename to addons/twitcher/overlay_template/moveable_control.gd.uid diff --git a/addons/twitcher/example/overlay_template/notification.gd b/addons/twitcher/overlay_template/notification.gd similarity index 100% rename from addons/twitcher/example/overlay_template/notification.gd rename to addons/twitcher/overlay_template/notification.gd diff --git a/addons/twitcher/example/overlay_template/notification.gd.uid b/addons/twitcher/overlay_template/notification.gd.uid similarity index 100% rename from addons/twitcher/example/overlay_template/notification.gd.uid rename to addons/twitcher/overlay_template/notification.gd.uid diff --git a/addons/twitcher/example/overlay_template/notification.tscn b/addons/twitcher/overlay_template/notification.tscn similarity index 96% rename from addons/twitcher/example/overlay_template/notification.tscn rename to addons/twitcher/overlay_template/notification.tscn index 00a1737d..70802e19 100644 --- a/addons/twitcher/example/overlay_template/notification.tscn +++ b/addons/twitcher/overlay_template/notification.tscn @@ -1,6 +1,6 @@ [gd_scene format=3 uid="uid://bqwgietymy1b2"] -[ext_resource type="Script" uid="uid://deso118lm3wux" path="res://addons/twitcher/example/overlay_template/notification.gd" id="1_kkvsf"] +[ext_resource type="Script" uid="uid://deso118lm3wux" path="res://addons/twitcher/overlay_template/notification.gd" id="1_kkvsf"] [ext_resource type="Texture2D" uid="uid://6nflfslr4a52" path="res://addons/twitcher/assets/no_profile.png" id="2_o42nw"] [ext_resource type="Script" uid="uid://bmluckfvgm1c2" path="res://addons/twitcher/chat/twitch_command.gd" id="3_o42nw"] diff --git a/addons/twitcher/example/overlay_template/overlay_template.gd b/addons/twitcher/overlay_template/overlay_template.gd similarity index 100% rename from addons/twitcher/example/overlay_template/overlay_template.gd rename to addons/twitcher/overlay_template/overlay_template.gd diff --git a/addons/twitcher/example/overlay_template/overlay_template.gd.uid b/addons/twitcher/overlay_template/overlay_template.gd.uid similarity index 100% rename from addons/twitcher/example/overlay_template/overlay_template.gd.uid rename to addons/twitcher/overlay_template/overlay_template.gd.uid diff --git a/addons/twitcher/example/overlay_template/overlay_template.tscn b/addons/twitcher/overlay_template/overlay_template.tscn similarity index 96% rename from addons/twitcher/example/overlay_template/overlay_template.tscn rename to addons/twitcher/overlay_template/overlay_template.tscn index 0dc2bacd..552a878a 100644 --- a/addons/twitcher/example/overlay_template/overlay_template.tscn +++ b/addons/twitcher/overlay_template/overlay_template.tscn @@ -1,15 +1,15 @@ [gd_scene format=3 uid="uid://6121fuoll1yk"] -[ext_resource type="Script" uid="uid://c2on23m2rusqb" path="res://addons/twitcher/example/overlay_template/overlay_template.gd" id="1_3kf1p"] +[ext_resource type="Script" uid="uid://c2on23m2rusqb" path="res://addons/twitcher/overlay_template/overlay_template.gd" id="1_3kf1p"] [ext_resource type="PackedScene" uid="uid://djt5lvmwxbq4a" path="res://addons/twitcher/twitch_service.tscn" id="1_vej8j"] [ext_resource type="Resource" uid="uid://ek3g270xqbad" path="res://addons/twitcher/editor_oauth_setting.tres" id="2_vej8j"] [ext_resource type="Resource" uid="uid://fcmfkstye4bq" path="res://addons/twitcher/auth/preset_overlay_scopes.tres" id="3_3kf1p"] [ext_resource type="Resource" uid="uid://bnpayc6epakvf" path="res://addons/twitcher/editor_oauth_token.tres" id="4_ikl5g"] [ext_resource type="Script" uid="uid://cjug64e3433g0" path="res://addons/twitcher/eventsub/twitch_eventsub_config.gd" id="5_bkaxl"] [ext_resource type="Script" uid="uid://cnmohrdxqihr0" path="res://addons/twitcher/generated/twitch_user.gd" id="7_ikl5g"] -[ext_resource type="Script" uid="uid://codle4s0o0ro4" path="res://addons/twitcher/example/overlay_template/event_listener.gd" id="7_v280k"] +[ext_resource type="Script" uid="uid://codle4s0o0ro4" path="res://addons/twitcher/overlay_template/event_listener.gd" id="7_v280k"] [ext_resource type="Script" uid="uid://bol5ltrjr6ux8" path="res://addons/twitcher/eventsub/twitch_event_listener.gd" id="8_3ux2t"] -[ext_resource type="PackedScene" uid="uid://dkvmn2mlsi7up" path="res://addons/twitcher/example/overlay_template/chat_controller.tscn" id="8_ikl5g"] +[ext_resource type="PackedScene" uid="uid://dkvmn2mlsi7up" path="res://addons/twitcher/overlay_template/chat_controller.tscn" id="8_ikl5g"] [sub_resource type="Resource" id="Resource_bkaxl"] script = ExtResource("7_ikl5g") diff --git a/addons/twitcher/plugin.gd b/addons/twitcher/plugin.gd index 41c109ed..ebcfaee2 100644 --- a/addons/twitcher/plugin.gd +++ b/addons/twitcher/plugin.gd @@ -21,6 +21,7 @@ const TokenInspector = preload("res://addons/twitcher/lib/oOuch/oauth_token_insp const TwitchScopeInspectorPlugin = preload("res://addons/twitcher/editor/inspector/twitch_scope_inspector.gd") const TwitchEventsubInspectorPlugin = preload("res://addons/twitcher/editor/inspector/twitch_eventsub_inspector.gd") const TwitchEventsubConfigInspectorPlugin = preload("res://addons/twitcher/editor/inspector/twitch_eventsub_config_inspector.gd") +const TwitchEventListenerInspectorPlugin = preload("res://addons/twitcher/editor/inspector/twitch_event_listener_inspector.gd") const TwitchMediaLoaderInspector = preload("res://addons/twitcher/editor/inspector/twitch_media_loader_inspector.gd") const TwitchEditorSettings = preload("res://addons/twitcher/editor/twitch_editor_settings.gd") const TwitchUserInspector = preload("res://addons/twitcher/editor/inspector/twitch_user_inspector.gd") @@ -41,6 +42,7 @@ var gif_importer_imagemagick: GifImporterImagemagick = GifImporterImagemagick.ne var gif_importer_native: GifImporterNative = GifImporterNative.new() var eventsub_config_inspector: TwitchEventsubConfigInspectorPlugin = TwitchEventsubConfigInspectorPlugin.new() var eventsub_inspector: TwitchEventsubInspectorPlugin = TwitchEventsubInspectorPlugin.new() +var event_listener_inspector: TwitchEventListenerInspectorPlugin = TwitchEventListenerInspectorPlugin.new() var scope_inspector: TwitchScopeInspectorPlugin = TwitchScopeInspectorPlugin.new() var oauth_setting_inspector: OauthSettingInspector = OauthSettingInspector.new() var token_inspector: TokenInspector = TokenInspector.new() @@ -65,6 +67,7 @@ func _enter_tree(): add_inspector_plugin(eventsub_config_inspector) add_inspector_plugin(eventsub_inspector) + add_inspector_plugin(event_listener_inspector) add_inspector_plugin(scope_inspector) add_inspector_plugin(oauth_setting_inspector) add_inspector_plugin(token_inspector) @@ -90,6 +93,7 @@ func _exit_tree(): remove_inspector_plugin(eventsub_config_inspector) remove_inspector_plugin(eventsub_inspector) + remove_inspector_plugin(event_listener_inspector) remove_inspector_plugin(scope_inspector) remove_inspector_plugin(oauth_setting_inspector) remove_inspector_plugin(token_inspector) diff --git a/addons/twitcher/reward/twitch_redeem_listener.gd b/addons/twitcher/reward/twitch_redeem_listener.gd index a079879e..819c7885 100644 --- a/addons/twitcher/reward/twitch_redeem_listener.gd +++ b/addons/twitcher/reward/twitch_redeem_listener.gd @@ -11,14 +11,14 @@ static var _open_tracked_redemptions: Dictionary[String, TwitchRedemption] = {} ## List of all rewards to listen for. @export var rewards_to_listen: Array[TwitchReward] = [] -## Eventsub to listen for the redemption's. (Can be empty will automatically look for first [TwitchEventsub] +## Eventsub to listen for the redemption's. (Can be empty will automatically look for first [TwitchEventsub] ## in the scene tree) @export var eventsub: TwitchEventsub -## API to fullfill or deny redemptions. (Can be empty will automatically look for first [TwitchAPI] in the +## API to fullfill or deny redemptions. (Can be empty will automatically look for first [TwitchAPI] in the ## scene tree) @export var api: TwitchAPI -## Should the node automatically subscribe to the needed eventsubs in the ready function. +## Should the node automatically subscribe to the needed eventsubs in the ready function. @export var ensure_subscriptions_on_ready: bool = true ## Called when one of the rewards that this node is listenting is getting redeemed @@ -28,11 +28,11 @@ signal redeemed(redemption: TwitchRedemption) func _ready() -> void: if eventsub == null: eventsub = TwitchEventsub.instance if api == null: api = TwitchAPI.instance - + eventsub.event_received.connect(_on_event) if ensure_subscriptions_on_ready: ensure_subscriptions() - - + + func ensure_subscriptions() -> void: var add_subscriptions: Array[TwitchEventsubConfig] = eventsub.get_subscription_by_type( TwitchEventsubDefinition.Type.CHANNEL_CHANNEL_POINTS_CUSTOM_REWARD_REDEMPTION_ADD) @@ -49,8 +49,8 @@ func ensure_subscriptions() -> void: "broadcaster_user_id": broadcaster.id }) eventsub.subscribe(config) - - + + func _on_event(event: TwitchEventsub.Event) -> void: if event.type == TwitchEventsubDefinition.CHANNEL_CHANNEL_POINTS_CUSTOM_REWARD_REDEMPTION_ADD: var redemption_event: TwitchChannelPointsCustomRewardRedemptionAddEvent = TwitchChannelPointsCustomRewardRedemptionAddEvent.from_json(event.data) @@ -70,7 +70,7 @@ func _add_redemption_event(redemption_event: TwitchChannelPointsCustomRewardRede var reward_id: String = redemption_event.reward.id var idx: int = rewards_to_listen.find_custom(_find_by_id.bind(reward_id)) if idx == -1: return - + var reward = rewards_to_listen[idx] var opt = TwitchGetUsers.Opt.new() var user_ids: Array[String] = [redemption_event.broadcaster_user_id, redemption_event.user_id] @@ -89,7 +89,7 @@ func _add_redemption_event(redemption_event: TwitchChannelPointsCustomRewardRede redemption.user_input = redemption_event.user_input redemption._fullfill_callback = fulfill_redemption redemption._cancel_callback = cancel_redemption - + _open_tracked_redemptions[redemption_event.id] = redemption redeemed.emit(redemption) @@ -97,7 +97,7 @@ func _add_redemption_event(redemption_event: TwitchChannelPointsCustomRewardRede func _update_redemption_event(update_event: TwitchChannelPointsCustomRewardRedemptionUpdateEvent) -> void: var redemption: TwitchRedemption = _open_tracked_redemptions[update_event.id] if redemption.status != TwitchRedemption.Status.UNFULFILLED: return - + match update_event.status: TwitchRedemption.Status.FULFILLED: redemption.notify_fullfilled() diff --git a/test/unit/eventsub/test_twitch_event_listener.gd b/test/unit/eventsub/test_twitch_event_listener.gd new file mode 100644 index 00000000..fa527a09 --- /dev/null +++ b/test/unit/eventsub/test_twitch_event_listener.gd @@ -0,0 +1,172 @@ +## Tests for [TwitchEventListener]. +## +## Two things are covered here: the conditions that the selected subscription +## defines (the part the inspector renders) and [method TwitchEventListener.ensure_subscription], +## which decides at runtime whether the node has to subscribe on its own. +## +## No network is involved. [method TwitchEventsub.subscribe] appends to its +## subscription list synchronously and only the transport afterwards needs a +## session, so the decision logic is observable without one. +extends TwitcherTest + +const FOLLOW := TwitchEventsubDefinition.Type.CHANNEL_FOLLOW +const SUBSCRIBE := TwitchEventsubDefinition.Type.CHANNEL_SUBSCRIBE + +const FOLLOW_CONDITION := { + &"broadcaster_user_id": "123", + &"moderator_user_id": "456", +} + + +func _make_listener(type: TwitchEventsubDefinition.Type, condition: Dictionary = {}) -> TwitchEventListener: + var listener: TwitchEventListener = autofree(TwitchEventListener.new()) + listener.subscription = type + listener.condition = condition.duplicate() + return listener + + +func _make_eventsub() -> TwitchEventsub: + var eventsub: TwitchEventsub = add_child_autofree(TwitchEventsub.new()) + # The test client is only added to the tree when the test server is enabled, + # so nothing else would ever free it. + autofree(eventsub.get_test_client()) + return eventsub + + +#region Conditions + +func test_selecting_a_subscription_defines_its_conditions() -> void: + var listener: TwitchEventListener = autofree(TwitchEventListener.new()) + + listener.subscription = FOLLOW + + assert_eq( + listener.condition.keys(), [&"broadcaster_user_id", &"moderator_user_id"], + "the selected type has to define which conditions are editable" + ) + + +func test_switching_the_subscription_keeps_the_values_of_shared_conditions() -> void: + var listener := _make_listener(FOLLOW, FOLLOW_CONDITION) + + listener.subscription = SUBSCRIBE + + assert_eq( + listener.condition, { &"broadcaster_user_id": "123" }, + "channel.subscribe only needs the broadcaster, the moderator has to be dropped" + ) + + +func test_get_conditions_prefers_the_user_that_got_selected_in_the_editor() -> void: + var listener := _make_listener(FOLLOW, FOLLOW_CONDITION) + var user: TwitchUser = TwitchUser.new() + user.id = "999" + listener.set_meta(&"broadcaster_user_id_user", user) + + assert_eq( + listener.get_conditions(), + { &"broadcaster_user_id": "999", &"moderator_user_id": "456" }, + "the resolved user wins over the plain value" + ) + + +func test_missing_conditions_lists_every_empty_condition() -> void: + var listener := _make_listener(FOLLOW, { &"broadcaster_user_id": "123" }) + + assert_eq( + listener.get_missing_conditions(), [&"moderator_user_id"] as Array[StringName], + "a condition without a value can't be used to subscribe" + ) + + +func test_a_configuration_warning_is_shown_for_missing_conditions() -> void: + var complete := _make_listener(FOLLOW, FOLLOW_CONDITION) + var incomplete := _make_listener(FOLLOW) + + assert_eq(complete._get_configuration_warnings().size(), 0, + "filled conditions are fine") + assert_eq(incomplete._get_configuration_warnings().size(), 1, + "empty conditions need a hint that the eventsub has to be configured") + +#endregion + +#region Ensure subscription + +func test_subscribes_when_the_eventsub_has_no_subscription() -> void: + var eventsub := _make_eventsub() + var listener := _make_listener(FOLLOW, FOLLOW_CONDITION) + listener.eventsub = eventsub + + listener.ensure_subscription() + + var subscriptions: Array[TwitchEventsubConfig] = eventsub.get_subscriptions() + assert_eq(subscriptions.size(), 1, "the listener has to subscribe on its own") + assert_eq(subscriptions[0].type, FOLLOW, "subscribed to the wrong type") + assert_eq(subscriptions[0].get_conditions(), FOLLOW_CONDITION, + "the conditions of the node have to be used to subscribe") + + +func test_subscribes_on_ready() -> void: + var eventsub := _make_eventsub() + var listener := _make_listener(FOLLOW, FOLLOW_CONDITION) + listener.eventsub = eventsub + + add_child(listener) + await wait_frames(1) + + assert_eq(eventsub.get_subscriptions().size(), 1, + "a listener that enters the tree has to ensure its subscription") + + +func test_does_not_subscribe_twice_for_the_same_conditions() -> void: + var eventsub := _make_eventsub() + eventsub.subscribe(TwitchEventsubConfig.create( + TwitchEventsubDefinition.CHANNEL_FOLLOW, FOLLOW_CONDITION.duplicate())) + var listener := _make_listener(FOLLOW, FOLLOW_CONDITION) + listener.eventsub = eventsub + + listener.ensure_subscription() + + assert_eq(eventsub.get_subscriptions().size(), 1, + "an existing subscription with the same conditions is enough") + + +func test_subscribes_when_the_existing_subscription_has_other_conditions() -> void: + var eventsub := _make_eventsub() + eventsub.subscribe(TwitchEventsubConfig.create( + TwitchEventsubDefinition.CHANNEL_FOLLOW, + { &"broadcaster_user_id": "999", &"moderator_user_id": "999" })) + var listener := _make_listener(FOLLOW, FOLLOW_CONDITION) + listener.eventsub = eventsub + + listener.ensure_subscription() + + assert_eq(eventsub.get_subscriptions().size(), 2, + "another broadcaster is another subscription") + + +func test_does_not_subscribe_without_conditions() -> void: + var eventsub := _make_eventsub() + var listener := _make_listener(FOLLOW) + listener.eventsub = eventsub + + listener.ensure_subscription() + + assert_eq(eventsub.get_subscriptions().size(), 0, + "without conditions there is nothing to subscribe with") + + +func test_accepts_a_foreign_subscription_when_conditions_are_missing() -> void: + var eventsub := _make_eventsub() + eventsub.subscribe(TwitchEventsubConfig.create( + TwitchEventsubDefinition.CHANNEL_FOLLOW, FOLLOW_CONDITION.duplicate())) + var listener := _make_listener(FOLLOW) + listener.eventsub = eventsub + + listener.ensure_subscription() + + assert_eq(eventsub.get_subscriptions().size(), 1, + "the subscription got configured on the eventsub, that stays supported" + ) + +#endregion diff --git a/test/unit/eventsub/test_twitch_event_listener.gd.uid b/test/unit/eventsub/test_twitch_event_listener.gd.uid new file mode 100644 index 00000000..4cd75c92 --- /dev/null +++ b/test/unit/eventsub/test_twitch_event_listener.gd.uid @@ -0,0 +1 @@ +uid://c4xxk2exfapae diff --git a/twitch_default_user.tres b/twitch_default_user.tres new file mode 100644 index 00000000..200f8489 --- /dev/null +++ b/twitch_default_user.tres @@ -0,0 +1,13 @@ +[gd_resource type="Resource" script_class="TwitchUser" format=3 uid="uid://cyswa57028iwc"] + +[ext_resource type="Script" uid="uid://cnmohrdxqihr0" path="res://addons/twitcher/generated/twitch_user.gd" id="1_rtr0m"] + +[resource] +script = ExtResource("1_rtr0m") +id = "132799162" +login = "kani_dev" +display_name = "kani_dev" +broadcaster_type = "affiliate" +description = "The Kani is a unique lifeform that has developed to a software architect over a long timespan. It's highly interested in gamedev and likes technology. " +profile_image_url = "https://static-cdn.jtvnw.net/jtv_user_pictures/e59c37e4-86d4-4b2c-b054-c0ebe55318e0-profile_image-300x300.png" +created_at = "2016-08-21T18:50:12Z" diff --git a/twitch_oauth_token.tres b/twitch_oauth_token.tres new file mode 100644 index 00000000..d4f35c99 --- /dev/null +++ b/twitch_oauth_token.tres @@ -0,0 +1,7 @@ +[gd_resource type="Resource" script_class="OAuthToken" format=3 uid="uid://cvov0pgka2ibm"] + +[ext_resource type="Resource" uid="uid://c4scwuk8q0r40" path="res://addons/twitcher/lib/oOuch/default_key_provider.tres" id="1_l3uxw"] +[ext_resource type="Script" uid="uid://b52xp7c23ucfk" path="res://addons/twitcher/lib/oOuch/oauth_token.gd" id="2_du741"] + +[resource] +script = ExtResource("2_du741") From d55d41397f50eb3994a0db5de98bd07a61845a7d Mon Sep 17 00:00:00 2001 From: kanimaru Date: Thu, 3 Sep 2026 01:00:06 +0200 Subject: [PATCH 2/2] fix: land the generalized condition property from previous commit The rename in the previous commit staged the file's content at the git-mv snapshot, before it was rewritten to work with any object exposing definition/condition (not just TwitchEventsubConfig). The rewrite itself never made it into that commit. Co-Authored-By: Claude Sonnet 5 --- .../twitch_eventsub_condition_property.gd | 93 ++++++++++++------- 1 file changed, 60 insertions(+), 33 deletions(-) diff --git a/addons/twitcher/editor/inspector/twitch_eventsub_condition_property.gd b/addons/twitcher/editor/inspector/twitch_eventsub_condition_property.gd index f6a1b902..7b29f5e2 100644 --- a/addons/twitcher/editor/inspector/twitch_eventsub_condition_property.gd +++ b/addons/twitcher/editor/inspector/twitch_eventsub_condition_property.gd @@ -1,10 +1,15 @@ extends EditorProperty +## Shows the conditions of an eventsub subscription as inputs. +## Works for every object that provides the [TwitchEventsubDefinition] via `definition` and holds +## the values within a `condition` dictionary. (See [TwitchEventsubConfig] and [TwitchEventListener]) + const USER_CONVERTER = preload("res://addons/twitcher/editor/inspector/user_converter.tscn") const TwitchEditorSettings = preload("res://addons/twitcher/editor/twitch_editor_settings.gd") var _container: Node = GridContainer.new() -var _current_type: TwitchEventsubDefinition.Type +## Guard against rebuilding the inputs while they are rebuild already +var _updating: bool func _init(): _container.columns = 2 @@ -12,45 +17,54 @@ func _init(): set_bottom_editor(_container) +## Object that holds the `definition` and the `condition` dictionary +func _get_target() -> Object: + var target: Object = get_edited_object() + if target == null || target.get_class() == &"EditorDebuggerRemoteObject": return null + return target + + func _cleanup_unused_meta() -> void: - var eventsub_config: TwitchEventsubConfig = get_edited_object(); - if eventsub_config == null: return + var target: Object = _get_target() + if target == null: return - var conditions: Array[StringName] = eventsub_config.definition.conditions - var unused_conditions: Array[StringName] = eventsub_config.get_meta_list() \ + var conditions: Array[StringName] = target.definition.conditions + var unused_conditions: Array = target.get_meta_list() \ .filter(func(cond: StringName): var is_user_property: bool = cond.ends_with("_user") var condition_not_found: bool = conditions.find(cond.trim_suffix("_user")) == -1 return is_user_property && condition_not_found) for unused_condition: StringName in unused_conditions: - eventsub_config.remove_meta(unused_condition) + target.remove_meta(unused_condition) func _update_property() -> void: - var eventsub_config: TwitchEventsubConfig = get_edited_object(); - + if _updating: return + _updating = true _cleanup_unused_meta() _clean_conditions() _create_conditions() + _updating = false func _clean_conditions() -> void: for node in _container.get_children(): + _container.remove_child(node) node.queue_free() func _create_conditions() -> void: - var eventsub_config: TwitchEventsubConfig = get_edited_object(); - if eventsub_config == null || eventsub_config.get_class() == &"EditorDebuggerRemoteObject": return + var target: Object = _get_target() + if target == null: return - for condition_name: StringName in eventsub_config.definition.conditions: - var condition_value = eventsub_config.condition.get_or_add(condition_name, "") + for condition_name: StringName in target.definition.conditions: + var condition_value: String = str(target.condition.get(condition_name, "")) _create_condition_title(condition_name) var editor_token: OAuthToken = TwitchEditorSettings.editor_oauth_token if condition_name.to_lower().ends_with("user_id") and editor_token.is_token_valid(): - _create_editor_supported_input(eventsub_config, condition_name, condition_value) + _create_editor_supported_input(target, condition_name, condition_value) else: _create_manual_input(condition_name, condition_value) @@ -61,15 +75,15 @@ func _create_condition_title(condition_name: String) -> void: _container.add_child(condition_title) -func _create_editor_supported_input(eventsub_config: TwitchEventsubConfig, \ +func _create_editor_supported_input(target: Object, \ condition_name: String, \ condition_value: String) -> void: var user_converter: UserConverter = USER_CONVERTER.instantiate() - user_converter.changed.connect(_on_changed_user.bind(eventsub_config, condition_name)) + user_converter.changed.connect(_on_changed_user.bind(condition_name)) _container.add_child(user_converter) - if eventsub_config.has_meta(condition_name + "_user"): - var user: TwitchUser = eventsub_config.get_meta(condition_name + "_user") + if target.has_meta(condition_name + "_user"): + var user: TwitchUser = target.get_meta(condition_name + "_user") user_converter.update_user(user) elif condition_value != "": user_converter.user_id = condition_value @@ -78,29 +92,42 @@ func _create_editor_supported_input(eventsub_config: TwitchEventsubConfig, \ func _create_manual_input(condition_name: String, condition_value: String) -> void: var input: LineEdit = LineEdit.new() - input.text_submitted.connect(_on_change_text.bind(condition_name, input)) - input.focus_exited.connect(_on_change_text.bind("", condition_name, input)) + input.text_submitted.connect(_on_text_submitted.bind(condition_name)) + input.focus_exited.connect(_on_focus_exited.bind(input, condition_name)) input.text = condition_value input.size_flags_horizontal = Control.SIZE_EXPAND_FILL _container.add_child(input) -func _on_changed_user(user: TwitchUser, \ - eventsub_config: TwitchEventsubConfig, \ - condition_name: StringName) -> void: +func _on_changed_user(user: TwitchUser, condition_name: StringName) -> void: + var target: Object = _get_target() + if target == null: return - var conditions: Dictionary = eventsub_config.condition.duplicate() if user == null: - conditions[condition_name] = "" - eventsub_config.remove_meta(condition_name + "_user") + target.remove_meta(condition_name + "_user") + _change_condition(condition_name, "") else: - conditions[condition_name] = user.id - eventsub_config.set_meta(condition_name + "_user", user) - eventsub_config.condition = conditions - emit_changed(&"condition", eventsub_config.condition) + target.set_meta(condition_name + "_user", user) + _change_condition(condition_name, user.id) + + +func _on_text_submitted(new_text: String, condition_name: StringName) -> void: + _change_condition(condition_name, new_text) + + +func _on_focus_exited(input: LineEdit, condition_name: StringName) -> void: + # Can be triggered while the inputs are rebuild, in that case the value is up to date already. + if _updating || not is_instance_valid(input) || not input.is_inside_tree(): return + _change_condition(condition_name, input.text) + +## Applies the value on a copy of the conditions so that the change is tracked properly by the +## editor. (Needed to mark scenes / resources as changed) +func _change_condition(condition_name: StringName, value: String) -> void: + var target: Object = _get_target() + if target == null: return -func _on_change_text(new_text: String, condition_name: StringName, input: LineEdit) -> void: - var eventsub_config: TwitchEventsubConfig = get_edited_object(); - eventsub_config.condition[condition_name] = input.text - #emit_changed(&"condition", eventsub_config.condition) + var conditions: Dictionary = target.condition.duplicate() + if conditions.get(condition_name, null) == value: return + conditions[condition_name] = value + emit_changed(&"condition", conditions)