@overlaysymphony/twitch 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (95) hide show
  1. package/README.md +9 -0
  2. package/package.json +40 -0
  3. package/src/authentication/authentication.ts +107 -0
  4. package/src/authentication/index.ts +1 -0
  5. package/src/chat/chat.ts +160 -0
  6. package/src/chat/index.ts +6 -0
  7. package/src/chat/interfaces/events.ts +269 -0
  8. package/src/chat/interfaces/index.ts +9 -0
  9. package/src/chat/parser.ts +265 -0
  10. package/src/eventsub/events/channel.ad_break.begin.ts +51 -0
  11. package/src/eventsub/events/channel.ban.ts +59 -0
  12. package/src/eventsub/events/channel.channel_points_custom_reward._.ts +29 -0
  13. package/src/eventsub/events/channel.channel_points_custom_reward.add.ts +75 -0
  14. package/src/eventsub/events/channel.channel_points_custom_reward.remove.ts +77 -0
  15. package/src/eventsub/events/channel.channel_points_custom_reward.update.ts +77 -0
  16. package/src/eventsub/events/channel.channel_points_custom_reward_redemption._.ts +10 -0
  17. package/src/eventsub/events/channel.channel_points_custom_reward_redemption.add.ts +59 -0
  18. package/src/eventsub/events/channel.channel_points_custom_reward_redemption.update.ts +59 -0
  19. package/src/eventsub/events/channel.charity_campaign.donate.ts +66 -0
  20. package/src/eventsub/events/channel.charity_campaign.progress.ts +67 -0
  21. package/src/eventsub/events/channel.charity_campaign.start.ts +69 -0
  22. package/src/eventsub/events/channel.charity_campaign.stop.ts +69 -0
  23. package/src/eventsub/events/channel.chat.clear.ts +42 -0
  24. package/src/eventsub/events/channel.chat.clear_user_messages.ts +48 -0
  25. package/src/eventsub/events/channel.chat.message_delete.ts +50 -0
  26. package/src/eventsub/events/channel.chat.notification.ts +50 -0
  27. package/src/eventsub/events/channel.cheer.ts +51 -0
  28. package/src/eventsub/events/channel.follow.ts +50 -0
  29. package/src/eventsub/events/channel.goal.begin.ts +51 -0
  30. package/src/eventsub/events/channel.goal.end.ts +55 -0
  31. package/src/eventsub/events/channel.goal.progress.ts +51 -0
  32. package/src/eventsub/events/channel.guest_star_guest.update.ts +66 -0
  33. package/src/eventsub/events/channel.guest_star_session.begin.ts +46 -0
  34. package/src/eventsub/events/channel.guest_star_session.end.ts +48 -0
  35. package/src/eventsub/events/channel.guest_star_settings.update.ts +50 -0
  36. package/src/eventsub/events/channel.hype_train._.ts +12 -0
  37. package/src/eventsub/events/channel.hype_train.begin.ts +57 -0
  38. package/src/eventsub/events/channel.hype_train.end.ts +55 -0
  39. package/src/eventsub/events/channel.hype_train.progress.ts +70 -0
  40. package/src/eventsub/events/channel.moderator.add.ts +45 -0
  41. package/src/eventsub/events/channel.moderator.remove.ts +45 -0
  42. package/src/eventsub/events/channel.poll._.ts +26 -0
  43. package/src/eventsub/events/channel.poll.begin.ts +55 -0
  44. package/src/eventsub/events/channel.poll.end.ts +57 -0
  45. package/src/eventsub/events/channel.poll.progress.ts +55 -0
  46. package/src/eventsub/events/channel.prediction._.ts +25 -0
  47. package/src/eventsub/events/channel.prediction.begin.ts +51 -0
  48. package/src/eventsub/events/channel.prediction.end.ts +55 -0
  49. package/src/eventsub/events/channel.prediction.lock.ts +51 -0
  50. package/src/eventsub/events/channel.prediction.progress.ts +51 -0
  51. package/src/eventsub/events/channel.raid.ts +49 -0
  52. package/src/eventsub/events/channel.shield_mode.begin.ts +50 -0
  53. package/src/eventsub/events/channel.shield_mode.end.ts +50 -0
  54. package/src/eventsub/events/channel.shoutout.create.ts +62 -0
  55. package/src/eventsub/events/channel.shoutout.receive.ts +52 -0
  56. package/src/eventsub/events/channel.subscribe.ts +49 -0
  57. package/src/eventsub/events/channel.subscription.end.ts +49 -0
  58. package/src/eventsub/events/channel.subscription.gift.ts +53 -0
  59. package/src/eventsub/events/channel.subscription.message.ts +67 -0
  60. package/src/eventsub/events/channel.unban.ts +51 -0
  61. package/src/eventsub/events/channel.update.ts +49 -0
  62. package/src/eventsub/events/index.ts +284 -0
  63. package/src/eventsub/events/stream.offline.ts +39 -0
  64. package/src/eventsub/events/stream.online.ts +45 -0
  65. package/src/eventsub/events/user.update.ts +45 -0
  66. package/src/eventsub/events-helpers.ts +29 -0
  67. package/src/eventsub/eventsub.ts +88 -0
  68. package/src/eventsub/index.ts +7 -0
  69. package/src/eventsub/messages.ts +34 -0
  70. package/src/helix/channel-points/custom-rewards.ts +63 -0
  71. package/src/helix/channel-points/index.ts +1 -0
  72. package/src/helix/helix.ts +89 -0
  73. package/src/helix/subscriptions/index.ts +1 -0
  74. package/src/helix/subscriptions/subscriptions.ts +122 -0
  75. package/src/helix/users/index.ts +1 -0
  76. package/src/helix/users/users.ts +42 -0
  77. package/src/helpers/alerts/alerts.ts +60 -0
  78. package/src/helpers/alerts/index.ts +2 -0
  79. package/src/helpers/charity/charity.ts +89 -0
  80. package/src/helpers/charity/index.ts +1 -0
  81. package/src/helpers/goal/goal.ts +38 -0
  82. package/src/helpers/goal/index.ts +1 -0
  83. package/src/helpers/hype-train/hype-train.ts +51 -0
  84. package/src/helpers/hype-train/index.ts +1 -0
  85. package/src/helpers/poll/index.ts +1 -0
  86. package/src/helpers/poll/poll.ts +63 -0
  87. package/src/helpers/prediction/index.ts +1 -0
  88. package/src/helpers/prediction/prediction.ts +66 -0
  89. package/src/helpers/redemption/index.ts +1 -0
  90. package/src/helpers/redemption/redemption.ts +42 -0
  91. package/src/helpers/status/index.ts +1 -0
  92. package/src/helpers/status/status.ts +61 -0
  93. package/src/setupTests.ts +0 -0
  94. package/src/ui/authentication.ts +230 -0
  95. package/src/ui/popup.ts +115 -0
@@ -0,0 +1,50 @@
1
+ import { BaseSubscription } from "../events-helpers.js"
2
+
3
+ type ChannelFollowType = "channel.follow"
4
+ type ChannelFollowVersion = "2"
5
+
6
+ /** The parameters under which an event fires when A user follows. */
7
+ export interface ChannelFollowCondition {
8
+ /** The user ID of the broadcaster. */
9
+ broadcaster_user_id: string
10
+ /** The user ID of the moderator or broadcaster. */
11
+ moderator_user_id: string
12
+ }
13
+
14
+ /** The event information when A user follows. */
15
+ export interface ChannelFollowEvent {
16
+ /** The user ID of the user who followed. */
17
+ user_id: string
18
+ /** The user login of the user who followed. */
19
+ user_login: string
20
+ /** The user name of the user who followed. */
21
+ user_name: string
22
+ /** The user ID of the broadcaster. */
23
+ broadcaster_user_id: string
24
+ /** The user login of the broadcaster. */
25
+ broadcaster_user_login: string
26
+ /** The user name of the broadcaster. */
27
+ broadcaster_user_name: string
28
+ /** The time the follow occurred. */
29
+ followed_at: Date
30
+ }
31
+
32
+ /** The event notification received when A user follows. */
33
+ export type ChannelFollowSubscription = BaseSubscription<
34
+ ChannelFollowType,
35
+ ChannelFollowVersion,
36
+ ChannelFollowCondition
37
+ >
38
+
39
+ export function makeChannelFollowSubscription(
40
+ userId: string,
41
+ ): ChannelFollowSubscription {
42
+ return {
43
+ type: "channel.follow",
44
+ version: "2",
45
+ condition: {
46
+ broadcaster_user_id: userId,
47
+ moderator_user_id: userId,
48
+ },
49
+ }
50
+ }
@@ -0,0 +1,51 @@
1
+ import { BaseSubscription } from "../events-helpers.js"
2
+
3
+ type GoalBeginType = "channel.goal.begin"
4
+ type GoalBeginVersion = "1"
5
+
6
+ /** The parameters under which an event fires when The broadcaster begins a goal. */
7
+ export interface GoalBeginCondition {
8
+ /** The user ID of the broadcaster. */
9
+ broadcaster_user_id: string
10
+ }
11
+
12
+ /** The event information when The broadcaster begins a goal. */
13
+ export interface GoalBeginEvent {
14
+ /** The ID of the goal. */
15
+ id: string
16
+ /** The user ID of the broadcaster. */
17
+ broadcaster_user_id: string
18
+ /** The user name of the broadcaster. */
19
+ broadcaster_user_name: string
20
+ /** The user login of the broadcaster. */
21
+ broadcaster_user_login: string
22
+ /** The type of goal. Possible values are:\nfollow — The goal is to increase followers.\nsubscription — The goal is to increase subscriptions. This type shows the net increase or decrease in tier points associated with the subscriptions.\nsubscription_count — The goal is to increase subscriptions. This type shows the net increase or decrease in the number of subscriptions.\nnew_subscription — The goal is to increase subscriptions. This type shows only the net increase in tier points associated with the subscriptions (it does not account for users that unsubscribed since the goal started).\nnew_subscription_count — The goal is to increase subscriptions. This type shows only the net increase in the number of subscriptions (it does not account for users that unsubscribed since the goal started). */
23
+ type: string
24
+ /** A description of the goal, if specified. The description may contain a maximum of 40 characters. */
25
+ description: string
26
+ /** Integer. The goal's current value.\n\nThe goal's type determines how this value is increased or decreased.\nIf type is follow, this field is set to the broadcaster's current number of followers. This number increases with new followers and decreases when users unfollow the broadcaster.\nIf type is subscription, this field is increased and decreased by the points value associated with the subscription tier. For example, if a tier-two subscription is worth 2 points, this field is increased or decreased by 2, not 1.\nIf type is subscription_count, this field is increased by 1 for each new subscription and decreased by 1 for each user that unsubscribes.\nIf type is new_subscription, this field is increased by the points value associated with the subscription tier. For example, if a tier-two subscription is worth 2 points, this field is increased by 2, not 1.\nIf type is new_subscription_count, this field is increased by 1 for each new subscription. */
27
+ current_amount: number
28
+ /** Integer. The goal's target value. For example, if the broadcaster has 200 followers before creating the goal, and their goal is to double that number, this field is set to 400. */
29
+ target_amount: number
30
+ /** The time the broadcaster created the goal. */
31
+ started_at: Date
32
+ }
33
+
34
+ /** The event notification received when The broadcaster begins a goal. */
35
+ export type GoalBeginSubscription = BaseSubscription<
36
+ GoalBeginType,
37
+ GoalBeginVersion,
38
+ GoalBeginCondition
39
+ >
40
+
41
+ export function makeGoalBeginSubscription(
42
+ userId: string,
43
+ ): GoalBeginSubscription {
44
+ return {
45
+ type: "channel.goal.begin",
46
+ version: "1",
47
+ condition: {
48
+ broadcaster_user_id: userId,
49
+ },
50
+ }
51
+ }
@@ -0,0 +1,55 @@
1
+ import { BaseSubscription } from "../events-helpers.js"
2
+
3
+ type GoalEndType = "channel.goal.end"
4
+ type GoalEndVersion = "1"
5
+
6
+ /** The parameters under which an event fires when The broadcaster ends a goal. */
7
+ export interface GoalEndCondition {
8
+ /** The user ID of the broadcaster. */
9
+ broadcaster_user_id: string
10
+ }
11
+
12
+ /** The event information when The broadcaster ends a goal. */
13
+ export interface GoalEndEvent {
14
+ /** The ID of the goal. */
15
+ id: string
16
+ /** The user ID of the broadcaster. */
17
+ broadcaster_user_id: string
18
+ /** The user name of the broadcaster. */
19
+ broadcaster_user_name: string
20
+ /** The user login of the broadcaster. */
21
+ broadcaster_user_login: string
22
+ /** The type of goal. Possible values are:\nfollow — The goal is to increase followers.\nsubscription — The goal is to increase subscriptions. This type shows the net increase or decrease in tier points associated with the subscriptions.\nsubscription_count — The goal is to increase subscriptions. This type shows the net increase or decrease in the number of subscriptions.\nnew_subscription — The goal is to increase subscriptions. This type shows only the net increase in tier points associated with the subscriptions (it does not account for users that unsubscribed since the goal started).\nnew_subscription_count — The goal is to increase subscriptions. This type shows only the net increase in the number of subscriptions (it does not account for users that unsubscribed since the goal started). */
23
+ type: string
24
+ /** A description of the goal, if specified. The description may contain a maximum of 40 characters. */
25
+ description: string
26
+ /** A Boolean value that indicates whether the broadcaster achieved their goal. Is true if the goal was achieved; otherwise, false. */
27
+ is_achieved: boolean
28
+ /** Integer. The goal's current value.\n\nThe goal's type determines how this value is increased or decreased.\nIf type is follow, this field is set to the broadcaster's current number of followers. This number increases with new followers and decreases when users unfollow the broadcaster.\nIf type is subscription, this field is increased and decreased by the points value associated with the subscription tier. For example, if a tier-two subscription is worth 2 points, this field is increased or decreased by 2, not 1.\nIf type is subscription_count, this field is increased by 1 for each new subscription and decreased by 1 for each user that unsubscribes.\nIf type is new_subscription, this field is increased by the points value associated with the subscription tier. For example, if a tier-two subscription is worth 2 points, this field is increased by 2, not 1.\nIf type is new_subscription_count, this field is increased by 1 for each new subscription. */
29
+ current_amount: number
30
+ /** Integer. The goal's target value. For example, if the broadcaster has 200 followers before creating the goal, and their goal is to double that number, this field is set to 400. */
31
+ target_amount: number
32
+ /** The time the broadcaster created the goal. */
33
+ started_at: Date
34
+ /** The time the broadcaster ended the goal.\n\nOnly the channel.goal.end event includes this field. */
35
+ ended_at: Date
36
+ }
37
+
38
+ /** The event notification received when The broadcaster ends a goal. */
39
+ export type GoalEndSubscription = BaseSubscription<
40
+ GoalEndType,
41
+ GoalEndVersion,
42
+ GoalEndCondition
43
+ >
44
+
45
+ export function makeGoalEndSubscription(
46
+ userId: string,
47
+ ): GoalEndSubscription {
48
+ return {
49
+ type: "channel.goal.end",
50
+ version: "1",
51
+ condition: {
52
+ broadcaster_user_id: userId,
53
+ },
54
+ }
55
+ }
@@ -0,0 +1,51 @@
1
+ import { BaseSubscription } from "../events-helpers.js"
2
+
3
+ type GoalProgressType = "channel.goal.progress"
4
+ type GoalProgressVersion = "1"
5
+
6
+ /** The parameters under which an event fires when Progress (either positive or negative) is made towards the broadcaster's goal. */
7
+ export interface GoalProgressCondition {
8
+ /** The user ID of the broadcaster. */
9
+ broadcaster_user_id: string
10
+ }
11
+
12
+ /** The event information when Progress (either positive or negative) is made towards the broadcaster's goal. */
13
+ export interface GoalProgressEvent {
14
+ /** The ID of the goal. */
15
+ id: string
16
+ /** The user ID of the broadcaster. */
17
+ broadcaster_user_id: string
18
+ /** The user name of the broadcaster. */
19
+ broadcaster_user_name: string
20
+ /** The user login of the broadcaster. */
21
+ broadcaster_user_login: string
22
+ /** The type of goal. Possible values are:\nfollow — The goal is to increase followers.\nsubscription — The goal is to increase subscriptions. This type shows the net increase or decrease in tier points associated with the subscriptions.\nsubscription_count — The goal is to increase subscriptions. This type shows the net increase or decrease in the number of subscriptions.\nnew_subscription — The goal is to increase subscriptions. This type shows only the net increase in tier points associated with the subscriptions (it does not account for users that unsubscribed since the goal started).\nnew_subscription_count — The goal is to increase subscriptions. This type shows only the net increase in the number of subscriptions (it does not account for users that unsubscribed since the goal started). */
23
+ type: string
24
+ /** A description of the goal, if specified. The description may contain a maximum of 40 characters. */
25
+ description: string
26
+ /** Integer. The goal's current value.\n\nThe goal's type determines how this value is increased or decreased.\nIf type is follow, this field is set to the broadcaster's current number of followers. This number increases with new followers and decreases when users unfollow the broadcaster.\nIf type is subscription, this field is increased and decreased by the points value associated with the subscription tier. For example, if a tier-two subscription is worth 2 points, this field is increased or decreased by 2, not 1.\nIf type is subscription_count, this field is increased by 1 for each new subscription and decreased by 1 for each user that unsubscribes.\nIf type is new_subscription, this field is increased by the points value associated with the subscription tier. For example, if a tier-two subscription is worth 2 points, this field is increased by 2, not 1.\nIf type is new_subscription_count, this field is increased by 1 for each new subscription. */
27
+ current_amount: number
28
+ /** Integer. The goal's target value. For example, if the broadcaster has 200 followers before creating the goal, and their goal is to double that number, this field is set to 400. */
29
+ target_amount: number
30
+ /** The time the broadcaster created the goal. */
31
+ started_at: Date
32
+ }
33
+
34
+ /** The event notification received when Progress (either positive or negative) is made towards the broadcaster's goal. */
35
+ export type GoalProgressSubscription = BaseSubscription<
36
+ GoalProgressType,
37
+ GoalProgressVersion,
38
+ GoalProgressCondition
39
+ >
40
+
41
+ export function makeGoalProgressSubscription(
42
+ userId: string,
43
+ ): GoalProgressSubscription {
44
+ return {
45
+ type: "channel.goal.progress",
46
+ version: "1",
47
+ condition: {
48
+ broadcaster_user_id: userId,
49
+ },
50
+ }
51
+ }
@@ -0,0 +1,66 @@
1
+ import { BaseSubscription } from "../events-helpers.js"
2
+
3
+ type ChannelGuestStarGuestUpdateType = "channel.guest_star_guest.update"
4
+ type ChannelGuestStarGuestUpdateVersion = "beta"
5
+
6
+ /** The parameters under which an event fires when A guest or a slot is updated in an active Guest Star session. */
7
+ export interface ChannelGuestStarGuestUpdateCondition {
8
+ /** The user ID of the broadcaster. */
9
+ broadcaster_user_id: string
10
+ /** The user ID of the moderator or broadcaster. */
11
+ moderator_user_id: string
12
+ }
13
+
14
+ /** The event information when A guest or a slot is updated in an active Guest Star session. */
15
+ export interface ChannelGuestStarGuestUpdateEvent {
16
+ /** The user ID of the broadcaster. */
17
+ broadcaster_user_id: string
18
+ /** The user login of the broadcaster. */
19
+ broadcaster_user_login: string
20
+ /** The user name of the broadcaster. */
21
+ broadcaster_user_name: string
22
+ /** ID representing the unique session that was started. */
23
+ session_id: string
24
+ /** The user ID of the moderator who updated the guest's state. null if the update was performed by the guest. */
25
+ moderator_user_id: string
26
+ /** The user login of the moderator. null if the update was performed by the guest. */
27
+ moderator_user_login: string
28
+ /** The user name of the moderator. null if the update was performed by the guest. */
29
+ moderator_user_name: string
30
+ /** The user ID of the guest who transitioned states in the session. null if the slot is now empty. */
31
+ guest_user_id: string
32
+ /** The guest user login. null if the slot is now empty. */
33
+ guest_user_login: string
34
+ /** The guest user name. null if the slot is now empty. */
35
+ guest_user_name: string
36
+ /** The ID of the slot assignment the guest is assigned to. null if the guest is in the INVITED, REMOVED, READY, or ACCEPTED state. */
37
+ slot_id: string
38
+ /** The current state of the user after the update has taken place. null if the slot is now empty. Can otherwise be one of the following:\n - invited — The guest has transitioned to the invite queue. This can take place when the guest was previously assigned a slot, but have been removed from the call and are sent back to the invite queue.\n - accepted — The guest has accepted the invite and is currently in the process of setting up to join the session.\n - ready — The guest has signaled they are ready and can be assigned a slot.\n - backstage — The guest has been assigned a slot in the session, but is not currently seen live in the broadcasting software.\n - live — The guest is now live in the host's broadcasting software.\n - removed — The guest was removed from the call or queue.\n - accepted — The guest has accepted the invite to the call. */
39
+ state: string
40
+ /** Flag that signals whether the host is allowing the slot's video to be seen by participants within the session. null if the guest is not slotted. */
41
+ host_video_enabled: boolean
42
+ /** Flag that signals whether the host is allowing the slot's audio to be heard by participants within the session. null if the guest is not slotted. */
43
+ host_audio_enabled: boolean
44
+ /** Integer. Value between 0-100 that represents the slot's audio level as heard by participants within the session. null if the guest is not slotted. */
45
+ host_volume: number
46
+ }
47
+
48
+ /** The event notification received when A guest or a slot is updated in an active Guest Star session. */
49
+ export type ChannelGuestStarGuestUpdateSubscription = BaseSubscription<
50
+ ChannelGuestStarGuestUpdateType,
51
+ ChannelGuestStarGuestUpdateVersion,
52
+ ChannelGuestStarGuestUpdateCondition
53
+ >
54
+
55
+ export function makeChannelGuestStarGuestUpdateSubscription(
56
+ userId: string,
57
+ ): ChannelGuestStarGuestUpdateSubscription {
58
+ return {
59
+ type: "channel.guest_star_guest.update",
60
+ version: "beta",
61
+ condition: {
62
+ broadcaster_user_id: userId,
63
+ moderator_user_id: userId,
64
+ },
65
+ }
66
+ }
@@ -0,0 +1,46 @@
1
+ import { BaseSubscription } from "../events-helpers.js"
2
+
3
+ type ChannelGuestStarSessionBeginType = "channel.guest_star_session.begin"
4
+ type ChannelGuestStarSessionBeginVersion = "beta"
5
+
6
+ /** The parameters under which an event fires when The broadcaster began a new Guest Star session. */
7
+ export interface ChannelGuestStarSessionBeginCondition {
8
+ /** The user ID of the broadcaster. */
9
+ broadcaster_user_id: string
10
+ /** The user ID of the moderator or broadcaster. */
11
+ moderator_user_id: string
12
+ }
13
+
14
+ /** The event information when The broadcaster began a new Guest Star session. */
15
+ export interface ChannelGuestStarSessionBeginEvent {
16
+ /** The user ID of the broadcaster. */
17
+ broadcaster_user_id: string
18
+ /** The user login of the broadcaster. */
19
+ broadcaster_user_login: string
20
+ /** The user name of the broadcaster. */
21
+ broadcaster_user_name: string
22
+ /** ID representing the unique session that was started. */
23
+ session_id: string
24
+ /** The time the session began. */
25
+ started_at: Date
26
+ }
27
+
28
+ /** The event notification received when The broadcaster began a new Guest Star session. */
29
+ export type ChannelGuestStarSessionBeginSubscription = BaseSubscription<
30
+ ChannelGuestStarSessionBeginType,
31
+ ChannelGuestStarSessionBeginVersion,
32
+ ChannelGuestStarSessionBeginCondition
33
+ >
34
+
35
+ export function makeChannelGuestStarSessionBeginSubscription(
36
+ userId: string,
37
+ ): ChannelGuestStarSessionBeginSubscription {
38
+ return {
39
+ type: "channel.guest_star_session.begin",
40
+ version: "beta",
41
+ condition: {
42
+ broadcaster_user_id: userId,
43
+ moderator_user_id: userId,
44
+ },
45
+ }
46
+ }
@@ -0,0 +1,48 @@
1
+ import { BaseSubscription } from "../events-helpers.js"
2
+
3
+ type ChannelGuestStarSessionEndType = "channel.guest_star_session.end"
4
+ type ChannelGuestStarSessionEndVersion = "beta"
5
+
6
+ /** The parameters under which an event fires when A running Guest Star session ends. */
7
+ export interface ChannelGuestStarSessionEndCondition {
8
+ /** The user ID of the broadcaster. */
9
+ broadcaster_user_id: string
10
+ /** The user ID of the moderator or broadcaster. */
11
+ moderator_user_id: string
12
+ }
13
+
14
+ /** The event information when A running Guest Star session ends. */
15
+ export interface ChannelGuestStarSessionEndEvent {
16
+ /** The user ID of the broadcaster. */
17
+ broadcaster_user_id: string
18
+ /** The user login of the broadcaster. */
19
+ broadcaster_user_login: string
20
+ /** The user name of the broadcaster. */
21
+ broadcaster_user_name: string
22
+ /** ID representing the unique session that was started. */
23
+ session_id: string
24
+ /** The time the session began. */
25
+ started_at: Date
26
+ /** The time the session ended. */
27
+ ended_at: Date
28
+ }
29
+
30
+ /** The event notification received when A running Guest Star session ends. */
31
+ export type ChannelGuestStarSessionEndSubscription = BaseSubscription<
32
+ ChannelGuestStarSessionEndType,
33
+ ChannelGuestStarSessionEndVersion,
34
+ ChannelGuestStarSessionEndCondition
35
+ >
36
+
37
+ export function makeChannelGuestStarSessionEndSubscription(
38
+ userId: string,
39
+ ): ChannelGuestStarSessionEndSubscription {
40
+ return {
41
+ type: "channel.guest_star_session.end",
42
+ version: "beta",
43
+ condition: {
44
+ broadcaster_user_id: userId,
45
+ moderator_user_id: userId,
46
+ },
47
+ }
48
+ }
@@ -0,0 +1,50 @@
1
+ import { BaseSubscription } from "../events-helpers.js"
2
+
3
+ type ChannelGuestStarSettingsUpdateType = "channel.guest_star_settings.update"
4
+ type ChannelGuestStarSettingsUpdateVersion = "beta"
5
+
6
+ /** The parameters under which an event fires when The broadcaster updates preferences for Guest Star. */
7
+ export interface ChannelGuestStarSettingsUpdateCondition {
8
+ /** The user ID of the broadcaster. */
9
+ broadcaster_user_id: string
10
+ /** The user ID of the moderator or broadcaster. */
11
+ moderator_user_id: string
12
+ }
13
+
14
+ /** The event information when The broadcaster updates preferences for Guest Star. */
15
+ export interface ChannelGuestStarSettingsUpdateEvent {
16
+ /** The user ID of the broadcaster. */
17
+ broadcaster_user_id: string
18
+ /** The user login of the broadcaster. */
19
+ broadcaster_user_login: string
20
+ /** The user name of the broadcaster. */
21
+ broadcaster_user_name: string
22
+ /** Flag determining if Guest Star moderators have access to control whether a guest is live once assigned to a slot. */
23
+ is_moderator_send_live_enabled: boolean
24
+ /** Integer. Number of slots the Guest Star call interface will allow the host to add to a call. */
25
+ slot_count: number
26
+ /** Flag determining if browser sources subscribed to sessions on this channel should output audio. */
27
+ is_browser_source_audio_enabled: boolean
28
+ /** This setting determines how the guests within a session should be laid out within a group browser source. Can be one of the following values:\n - tiled — All live guests are tiled within the browser source with the same size.\n - screenshare — All live guests are tiled within the browser source with the same size. If there is an active screen share, it is sized larger than the other guests.\n - horizontal_top — Indicates the group layout will contain all participants in a top-aligned horizontal stack.\n - horizontal_bottom — Indicates the group layout will contain all participants in a bottom-aligned horizontal stack.\n - vertical_left — Indicates the group layout will contain all participants in a left-aligned vertical stack.\n - vertical_right — Indicates the group layout will contain all participants in a right-aligned vertical stack. */
29
+ group_layout: string
30
+ }
31
+
32
+ /** The event notification received when The broadcaster updates preferences for Guest Star. */
33
+ export type ChannelGuestStarSettingsUpdateSubscription = BaseSubscription<
34
+ ChannelGuestStarSettingsUpdateType,
35
+ ChannelGuestStarSettingsUpdateVersion,
36
+ ChannelGuestStarSettingsUpdateCondition
37
+ >
38
+
39
+ export function makeChannelGuestStarSettingsUpdateSubscription(
40
+ userId: string,
41
+ ): ChannelGuestStarSettingsUpdateSubscription {
42
+ return {
43
+ type: "channel.guest_star_settings.update",
44
+ version: "beta",
45
+ condition: {
46
+ broadcaster_user_id: userId,
47
+ moderator_user_id: userId,
48
+ },
49
+ }
50
+ }
@@ -0,0 +1,12 @@
1
+ export interface HypeTrainTopContribution {
2
+ /** The ID of the user that made the contribution. */
3
+ user_id: string
4
+ /** The user’s login name. */
5
+ user_login: string
6
+ /** The user’s display name. */
7
+ user_name: string
8
+ /** The contribution method used. Possible values are:\n bits — Cheering with Bits.\n subscription — Subscription activity like subscribing or gifting subscriptions.\n other — Covers other contribution methods not listed. */
9
+ type: string
10
+ /** Integer. The total amount contributed. If type is bits, total represents the amount of Bits used. If type is subscription, total is 500, 1000, or 2500 to represent tier 1, 2, or 3 subscriptions, respectively. */
11
+ total: number
12
+ }
@@ -0,0 +1,57 @@
1
+ import { BaseSubscription } from "../events-helpers.js"
2
+
3
+ import { HypeTrainTopContribution } from "./channel.hype_train._.js"
4
+
5
+ type HypeTrainBeginType = "channel.hype_train.begin"
6
+ type HypeTrainBeginVersion = "1"
7
+
8
+ /** The parameters under which an event fires when A Hype Train begins. */
9
+ export interface HypeTrainBeginCondition {
10
+ /** The user ID of the broadcaster. */
11
+ broadcaster_user_id: string
12
+ }
13
+
14
+ /** The event information when A Hype Train begins. */
15
+ export interface HypeTrainBeginEvent {
16
+ /** The hype train ID. */
17
+ id: string
18
+ /** The user ID of the broadcaster. */
19
+ broadcaster_user_id: string
20
+ /** The user login of the broadcaster. */
21
+ broadcaster_user_login: string
22
+ /** The user name of the broadcaster. */
23
+ broadcaster_user_name: string
24
+ /** Integer. Total points contributed to the hype train. */
25
+ total: number
26
+ /** Integer. The number of points contributed to the hype train at the current level. */
27
+ progress: number
28
+ /** Integer. The number of points required to reach the next level. */
29
+ goal: number
30
+ /** The contributors with the most points contributed. */
31
+ top_contributions: HypeTrainTopContribution[]
32
+ /** Integer. The starting level of the hype train. */
33
+ level: number
34
+ /** The time the hype train started. */
35
+ started_at: Date
36
+ /** The time the hype train expires. The expiration is extended when the hype train reaches a new level. */
37
+ expires_at: Date
38
+ }
39
+
40
+ /** The event notification received when A Hype Train begins. */
41
+ export type HypeTrainBeginSubscription = BaseSubscription<
42
+ HypeTrainBeginType,
43
+ HypeTrainBeginVersion,
44
+ HypeTrainBeginCondition
45
+ >
46
+
47
+ export function makeHypeTrainBeginSubscription(
48
+ userId: string,
49
+ ): HypeTrainBeginSubscription {
50
+ return {
51
+ type: "channel.hype_train.begin",
52
+ version: "1",
53
+ condition: {
54
+ broadcaster_user_id: userId,
55
+ },
56
+ }
57
+ }
@@ -0,0 +1,55 @@
1
+ import { BaseSubscription } from "../events-helpers.js"
2
+
3
+ import { HypeTrainTopContribution } from "./channel.hype_train._.js"
4
+
5
+ type HypeTrainEndType = "channel.hype_train.end"
6
+ type HypeTrainEndVersion = "1"
7
+
8
+ /** The parameters under which an event fires when A Hype Train ends. */
9
+ export interface HypeTrainEndCondition {
10
+ /** The user ID of the broadcaster. */
11
+ broadcaster_user_id: string
12
+ }
13
+
14
+ /** The event information when A Hype Train ends. */
15
+ export interface HypeTrainEndEvent {
16
+ /** The hype train ID. */
17
+ id: string
18
+ /** The user ID of the broadcaster. */
19
+ broadcaster_user_id: string
20
+ /** The user login of the broadcaster. */
21
+ broadcaster_user_login: string
22
+ /** The user name of the broadcaster. */
23
+ broadcaster_user_name: string
24
+ /** Integer. The final level of the hype train. */
25
+ level: number
26
+ /** Integer. Total points contributed to the hype train. */
27
+ total: number
28
+ /** The contributors with the most points contributed. */
29
+ top_contributions: HypeTrainTopContribution[]
30
+ /** The time the hype train started. */
31
+ started_at: Date
32
+ /** The time the hype train ended. */
33
+ ended_at: Date
34
+ /** The time the hype train cooldown ends so that the next hype train can start. */
35
+ cooldown_ends_at: Date
36
+ }
37
+
38
+ /** The event notification received when A Hype Train ends. */
39
+ export type HypeTrainEndSubscription = BaseSubscription<
40
+ HypeTrainEndType,
41
+ HypeTrainEndVersion,
42
+ HypeTrainEndCondition
43
+ >
44
+
45
+ export function makeHypeTrainEndSubscription(
46
+ userId: string,
47
+ ): HypeTrainEndSubscription {
48
+ return {
49
+ type: "channel.hype_train.end",
50
+ version: "1",
51
+ condition: {
52
+ broadcaster_user_id: userId,
53
+ },
54
+ }
55
+ }
@@ -0,0 +1,70 @@
1
+ import { BaseSubscription } from "../events-helpers.js"
2
+
3
+ import { HypeTrainTopContribution } from "./channel.hype_train._.js"
4
+
5
+ type HypeTrainProgressType = "channel.hype_train.progress"
6
+ type HypeTrainProgressVersion = "1"
7
+
8
+ /** The parameters under which an event fires when A Hype Train makes progress. */
9
+ export interface HypeTrainProgressCondition {
10
+ /** The user ID of the broadcaster. */
11
+ broadcaster_user_id: string
12
+ }
13
+
14
+ /** The event information when A Hype Train makes progress. */
15
+ export interface HypeTrainProgressEvent {
16
+ /** The hype train ID. */
17
+ id: string
18
+ /** The user ID of the broadcaster. */
19
+ broadcaster_user_id: string
20
+ /** The user login of the broadcaster. */
21
+ broadcaster_user_login: string
22
+ /** The user name of the broadcaster. */
23
+ broadcaster_user_name: string
24
+ /** Integer. The current level of the hype train. */
25
+ level: number
26
+ /** Integer. Total points contributed to the hype train. */
27
+ total: number
28
+ /** Integer. The number of points contributed to the hype train at the current level. */
29
+ progress: number
30
+ /** Integer. The number of points required to reach the next level. */
31
+ goal: number
32
+ /** The contributors with the most points contributed. */
33
+ top_contributions: HypeTrainTopContribution[]
34
+ /** The most recent contribution. */
35
+ last_contribution: {
36
+ /** The user ID of the user who made the contribution. */
37
+ user_id: string
38
+ /** The user login name. */
39
+ user_login: string
40
+ /** The user name. */
41
+ user_name: string
42
+ /** The contribution method used. Possible values are:\n bits — Cheering with Bits.\n subscription — Subscription activity like subscribing or gifting subscriptions.\n other — Covers other contribution methods not listed. */
43
+ type: string
44
+ /** Integer. The total amount contributed. If type is bits, total represents the amount of Bits used. If type is subscription, total is 500, 1000, or 2500 to represent tier 1, 2, or 3 subscriptions, respectively. */
45
+ total: number
46
+ }
47
+ /** The time the hype train started. */
48
+ started_at: Date
49
+ /** The time the hype train expires. The expiration is extended when the hype train reaches a new level. */
50
+ expires_at: Date
51
+ }
52
+
53
+ /** The event notification received when A Hype Train makes progress. */
54
+ export type HypeTrainProgressSubscription = BaseSubscription<
55
+ HypeTrainProgressType,
56
+ HypeTrainProgressVersion,
57
+ HypeTrainProgressCondition
58
+ >
59
+
60
+ export function makeHypeTrainProgressSubscription(
61
+ userId: string,
62
+ ): HypeTrainProgressSubscription {
63
+ return {
64
+ type: "channel.hype_train.progress",
65
+ version: "1",
66
+ condition: {
67
+ broadcaster_user_id: userId,
68
+ },
69
+ }
70
+ }
@@ -0,0 +1,45 @@
1
+ import { BaseSubscription } from "../events-helpers.js"
2
+
3
+ type ChannelModeratorAddType = "channel.moderator.add"
4
+ type ChannelModeratorAddVersion = "1"
5
+
6
+ /** The parameters under which an event fires when The broadcaster gives moderator privileges to a user. */
7
+ export interface ChannelModeratorAddCondition {
8
+ /** The user ID of the broadcaster. */
9
+ broadcaster_user_id: string
10
+ }
11
+
12
+ /** The event information when The broadcaster gives moderator privileges to a user. */
13
+ export interface ChannelModeratorAddEvent {
14
+ /** The user ID of the broadcaster. */
15
+ broadcaster_user_id: string
16
+ /** The user login of the broadcaster. */
17
+ broadcaster_user_login: string
18
+ /** The user name of the broadcaster. */
19
+ broadcaster_user_name: string
20
+ /** The user ID of the new moderator. */
21
+ user_id: string
22
+ /** The user login of the new moderator. */
23
+ user_login: string
24
+ /** The user name of the new moderator. */
25
+ user_name: string
26
+ }
27
+
28
+ /** The event notification received when The broadcaster gives moderator privileges to a user. */
29
+ export type ChannelModeratorAddSubscription = BaseSubscription<
30
+ ChannelModeratorAddType,
31
+ ChannelModeratorAddVersion,
32
+ ChannelModeratorAddCondition
33
+ >
34
+
35
+ export function makeChannelModeratorAddSubscription(
36
+ userId: string,
37
+ ): ChannelModeratorAddSubscription {
38
+ return {
39
+ type: "channel.moderator.add",
40
+ version: "1",
41
+ condition: {
42
+ broadcaster_user_id: userId,
43
+ },
44
+ }
45
+ }