@distilled.cloud/twitch 0.0.0 → 1.0.0-rc.21

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 (214) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +79 -4
  3. package/lib/.lazy.json +1 -0
  4. package/lib/_bundle/lazy.js +4 -0
  5. package/lib/_bundle/sdk.js +2 -0
  6. package/lib/_bundle/sdk.js.map +1 -0
  7. package/lib/credentials.d.ts +31 -0
  8. package/lib/credentials.d.ts.map +1 -0
  9. package/lib/credentials.js +1 -0
  10. package/lib/errors.d.ts +49 -0
  11. package/lib/errors.d.ts.map +1 -0
  12. package/lib/errors.js +1 -0
  13. package/lib/index.d.ts +46 -0
  14. package/lib/index.d.ts.map +1 -0
  15. package/lib/index.js +6 -0
  16. package/lib/pagination.d.ts +10 -0
  17. package/lib/pagination.d.ts.map +1 -0
  18. package/lib/pagination.js +1 -0
  19. package/lib/protocol.d.ts +19 -0
  20. package/lib/protocol.d.ts.map +1 -0
  21. package/lib/protocol.js +1 -0
  22. package/lib/retry.d.ts +50 -0
  23. package/lib/retry.d.ts.map +1 -0
  24. package/lib/retry.js +1 -0
  25. package/lib/services/ads.d.ts +75 -0
  26. package/lib/services/ads.d.ts.map +1 -0
  27. package/lib/services/ads.js +2 -0
  28. package/lib/services/ads.js.map +1 -0
  29. package/lib/services/analytics.d.ts +90 -0
  30. package/lib/services/analytics.d.ts.map +1 -0
  31. package/lib/services/analytics.js +2 -0
  32. package/lib/services/analytics.js.map +1 -0
  33. package/lib/services/bits.d.ts +284 -0
  34. package/lib/services/bits.d.ts.map +1 -0
  35. package/lib/services/bits.js +2 -0
  36. package/lib/services/bits.js.map +1 -0
  37. package/lib/services/ccls.d.ts +26 -0
  38. package/lib/services/ccls.d.ts.map +1 -0
  39. package/lib/services/ccls.js +2 -0
  40. package/lib/services/ccls.js.map +1 -0
  41. package/lib/services/channel_points.d.ts +416 -0
  42. package/lib/services/channel_points.d.ts.map +1 -0
  43. package/lib/services/channel_points.js +2 -0
  44. package/lib/services/channel_points.js.map +1 -0
  45. package/lib/services/channels.d.ts +173 -0
  46. package/lib/services/channels.d.ts.map +1 -0
  47. package/lib/services/channels.js +2 -0
  48. package/lib/services/channels.js.map +1 -0
  49. package/lib/services/charity.d.ts +97 -0
  50. package/lib/services/charity.d.ts.map +1 -0
  51. package/lib/services/charity.js +2 -0
  52. package/lib/services/charity.js.map +1 -0
  53. package/lib/services/chat.d.ts +638 -0
  54. package/lib/services/chat.d.ts.map +1 -0
  55. package/lib/services/chat.js +33 -0
  56. package/lib/services/chat.js.map +1 -0
  57. package/lib/services/clips.d.ts +153 -0
  58. package/lib/services/clips.d.ts.map +1 -0
  59. package/lib/services/clips.js +2 -0
  60. package/lib/services/clips.js.map +1 -0
  61. package/lib/services/conduits.d.ts +172 -0
  62. package/lib/services/conduits.d.ts.map +1 -0
  63. package/lib/services/conduits.js +2 -0
  64. package/lib/services/conduits.js.map +1 -0
  65. package/lib/services/entitlements.d.ts +76 -0
  66. package/lib/services/entitlements.d.ts.map +1 -0
  67. package/lib/services/entitlements.js +2 -0
  68. package/lib/services/entitlements.js.map +1 -0
  69. package/lib/services/eventsub.d.ts +158 -0
  70. package/lib/services/eventsub.d.ts.map +1 -0
  71. package/lib/services/eventsub.js +2 -0
  72. package/lib/services/eventsub.js.map +1 -0
  73. package/lib/services/extensions.d.ts +497 -0
  74. package/lib/services/extensions.d.ts.map +1 -0
  75. package/lib/services/extensions.js +2 -0
  76. package/lib/services/extensions.js.map +1 -0
  77. package/lib/services/games.d.ts +57 -0
  78. package/lib/services/games.d.ts.map +1 -0
  79. package/lib/services/games.js +2 -0
  80. package/lib/services/games.js.map +1 -0
  81. package/lib/services/goals.d.ts +37 -0
  82. package/lib/services/goals.d.ts.map +1 -0
  83. package/lib/services/goals.js +2 -0
  84. package/lib/services/goals.js.map +1 -0
  85. package/lib/services/guest_star.d.ts +314 -0
  86. package/lib/services/guest_star.d.ts.map +1 -0
  87. package/lib/services/guest_star.js +2 -0
  88. package/lib/services/guest_star.js.map +1 -0
  89. package/lib/services/hype_train.d.ts +91 -0
  90. package/lib/services/hype_train.d.ts.map +1 -0
  91. package/lib/services/hype_train.js +2 -0
  92. package/lib/services/hype_train.js.map +1 -0
  93. package/lib/services/index.d.ts +30 -0
  94. package/lib/services/index.d.ts.map +1 -0
  95. package/lib/services/index.js +29 -0
  96. package/lib/services/moderation.d.ts +731 -0
  97. package/lib/services/moderation.d.ts.map +1 -0
  98. package/lib/services/moderation.js +41 -0
  99. package/lib/services/moderation.js.map +1 -0
  100. package/lib/services/polls.d.ts +173 -0
  101. package/lib/services/polls.d.ts.map +1 -0
  102. package/lib/services/polls.js +2 -0
  103. package/lib/services/polls.js.map +1 -0
  104. package/lib/services/predictions.d.ts +221 -0
  105. package/lib/services/predictions.d.ts.map +1 -0
  106. package/lib/services/predictions.js +2 -0
  107. package/lib/services/predictions.js.map +1 -0
  108. package/lib/services/raids.d.ts +34 -0
  109. package/lib/services/raids.d.ts.map +1 -0
  110. package/lib/services/raids.js +2 -0
  111. package/lib/services/raids.js.map +1 -0
  112. package/lib/services/schedule.d.ts +223 -0
  113. package/lib/services/schedule.d.ts.map +1 -0
  114. package/lib/services/schedule.js +2 -0
  115. package/lib/services/schedule.js.map +1 -0
  116. package/lib/services/search.d.ts +89 -0
  117. package/lib/services/search.d.ts.map +1 -0
  118. package/lib/services/search.js +2 -0
  119. package/lib/services/search.js.map +1 -0
  120. package/lib/services/streams.d.ts +235 -0
  121. package/lib/services/streams.d.ts.map +1 -0
  122. package/lib/services/streams.js +2 -0
  123. package/lib/services/streams.js.map +1 -0
  124. package/lib/services/subscriptions.d.ts +96 -0
  125. package/lib/services/subscriptions.d.ts.map +1 -0
  126. package/lib/services/subscriptions.js +2 -0
  127. package/lib/services/subscriptions.js.map +1 -0
  128. package/lib/services/teams.d.ts +90 -0
  129. package/lib/services/teams.d.ts.map +1 -0
  130. package/lib/services/teams.js +2 -0
  131. package/lib/services/teams.js.map +1 -0
  132. package/lib/services/users.d.ts +324 -0
  133. package/lib/services/users.d.ts.map +1 -0
  134. package/lib/services/users.js +2 -0
  135. package/lib/services/users.js.map +1 -0
  136. package/lib/services/videos.d.ts +101 -0
  137. package/lib/services/videos.d.ts.map +1 -0
  138. package/lib/services/videos.js +2 -0
  139. package/lib/services/videos.js.map +1 -0
  140. package/lib/services/whispers.d.ts +17 -0
  141. package/lib/services/whispers.d.ts.map +1 -0
  142. package/lib/services/whispers.js +2 -0
  143. package/lib/services/whispers.js.map +1 -0
  144. package/lib/services.lazy/ads.js +1 -0
  145. package/lib/services.lazy/analytics.js +1 -0
  146. package/lib/services.lazy/bits.js +1 -0
  147. package/lib/services.lazy/ccls.js +1 -0
  148. package/lib/services.lazy/channel_points.js +1 -0
  149. package/lib/services.lazy/channels.js +1 -0
  150. package/lib/services.lazy/charity.js +1 -0
  151. package/lib/services.lazy/chat.js +3 -0
  152. package/lib/services.lazy/clips.js +1 -0
  153. package/lib/services.lazy/conduits.js +1 -0
  154. package/lib/services.lazy/entitlements.js +1 -0
  155. package/lib/services.lazy/eventsub.js +1 -0
  156. package/lib/services.lazy/extensions.js +1 -0
  157. package/lib/services.lazy/games.js +1 -0
  158. package/lib/services.lazy/goals.js +1 -0
  159. package/lib/services.lazy/guest_star.js +1 -0
  160. package/lib/services.lazy/hype_train.js +1 -0
  161. package/lib/services.lazy/index.js +3 -0
  162. package/lib/services.lazy/moderation.js +3 -0
  163. package/lib/services.lazy/polls.js +1 -0
  164. package/lib/services.lazy/predictions.js +1 -0
  165. package/lib/services.lazy/raids.js +1 -0
  166. package/lib/services.lazy/schedule.js +1 -0
  167. package/lib/services.lazy/search.js +1 -0
  168. package/lib/services.lazy/streams.js +1 -0
  169. package/lib/services.lazy/subscriptions.js +1 -0
  170. package/lib/services.lazy/teams.js +1 -0
  171. package/lib/services.lazy/users.js +1 -0
  172. package/lib/services.lazy/videos.js +1 -0
  173. package/lib/services.lazy/whispers.js +1 -0
  174. package/lib/traits.d.ts +10 -0
  175. package/lib/traits.d.ts.map +1 -0
  176. package/lib/traits.js +1 -0
  177. package/package.json +82 -2
  178. package/src/credentials.ts +79 -0
  179. package/src/errors.ts +78 -0
  180. package/src/index.ts +45 -0
  181. package/src/pagination.ts +9 -0
  182. package/src/protocol.ts +43 -0
  183. package/src/retry.ts +69 -0
  184. package/src/services/ads.ts +228 -0
  185. package/src/services/analytics.ts +253 -0
  186. package/src/services/bits.ts +631 -0
  187. package/src/services/ccls.ts +96 -0
  188. package/src/services/channel_points.ts +804 -0
  189. package/src/services/channels.ts +471 -0
  190. package/src/services/charity.ts +250 -0
  191. package/src/services/chat.ts +1547 -0
  192. package/src/services/clips.ts +385 -0
  193. package/src/services/conduits.ts +453 -0
  194. package/src/services/entitlements.ts +219 -0
  195. package/src/services/eventsub.ts +372 -0
  196. package/src/services/extensions.ts +1098 -0
  197. package/src/services/games.ts +184 -0
  198. package/src/services/goals.ts +110 -0
  199. package/src/services/guest_star.ts +762 -0
  200. package/src/services/hype_train.ts +214 -0
  201. package/src/services/index.ts +30 -0
  202. package/src/services/moderation.ts +1817 -0
  203. package/src/services/polls.ts +363 -0
  204. package/src/services/predictions.ts +432 -0
  205. package/src/services/raids.ts +127 -0
  206. package/src/services/schedule.ts +539 -0
  207. package/src/services/search.ts +248 -0
  208. package/src/services/streams.ts +579 -0
  209. package/src/services/subscriptions.ts +247 -0
  210. package/src/services/teams.ts +225 -0
  211. package/src/services/users.ts +729 -0
  212. package/src/services/videos.ts +257 -0
  213. package/src/services/whispers.ts +71 -0
  214. package/src/traits.ts +47 -0
@@ -0,0 +1,385 @@
1
+ import * as API from "@distilled.cloud/core/api";
2
+ // AUTO-GENERATED by scripts/generate.ts from .generated-specs (specs/spec-mirror-twitch/specs/api/reference). Do not edit.
3
+ import * as S from "@distilled.cloud/core/schema-lite";
4
+ import * as __L from "@distilled.cloud/core/schema-lite";
5
+ import { TwitchServiceErrors } from "../errors.ts";
6
+ import { paginateCursor } from "../pagination.ts";
7
+ import { TwitchProtocol, type TwitchOpError, type TwitchOpContext } from "../protocol.ts";
8
+ import * as Retry from "../retry.ts";
9
+ import * as T from "../traits.ts";
10
+ // Schema table, filled on first reach (see __S at the end).
11
+ const __s: any[] = [];
12
+
13
+ export type { TwitchOpError, TwitchOpContext };
14
+
15
+ /** Span facts shared by every operation (com.distilled.telemetry#service). */
16
+ const TELEMETRY = {
17
+ system: "twitch-api",
18
+ responseHeaders: [
19
+ { header: "x-request-id", name: "http.response.header.x-request-id", transform: "list" },
20
+ { header: "request-id", name: "http.response.header.request-id", transform: "list" },
21
+ ],
22
+ prefix: "Twitch",
23
+ service: "Clips",
24
+ propagate: "w3c",
25
+ } as const;
26
+
27
+ export interface CreateClipRequest {
28
+ /** The ID of the broadcaster whose stream you want to create a clip from. */
29
+ broadcaster_id: string;
30
+ /** The title of the clip. */
31
+ title?: string | undefined;
32
+ /** The length of the clip in seconds. Possible values range from 5 to 60 inclusively with a precision of 0.1. The default is 30. */
33
+ duration?: number | undefined;
34
+ }
35
+ export interface CreateClipResponseDataItem {
36
+ /** An ID that uniquely identifies the clip. */
37
+ id?: string | undefined;
38
+ /** A URL that you can use to edit the clip's title, identify the part of the clip to publish, and publish the clip. [Learn More](https://help.twitch.tv/s/article/how-to-use-clips) The URL is valid for up to 24 hours or until the clip is published, whichever comes first. */
39
+ edit_url?: string | undefined;
40
+ }
41
+ /** A list containing the created clip. */
42
+ export type CreateClipResponseDataList = Array<CreateClipResponseDataItem>;
43
+ export interface CreateClipResponse {
44
+ /** A list containing the created clip. */
45
+ data?: CreateClipResponseDataList | undefined;
46
+ }
47
+ export interface CreateClipFromVodRequest {
48
+ /** 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. */
49
+ editor_id: string;
50
+ /** The user ID for the channel you want to create a clip for. */
51
+ broadcaster_id: string;
52
+ /** ID of the VOD the user wants to clip. */
53
+ vod_id: string;
54
+ /** The zero-based offset, in seconds, to where the clip should end in the video (VOD). See this endpoint's description for more information on how to use this parameter. */
55
+ vod_offset: number;
56
+ /** The length of the clip, in seconds. Precision is 0.1. Defaults to 30. Min: 5 seconds, Max: 60 seconds. */
57
+ duration?: number | undefined;
58
+ /** The title of the clip. */
59
+ title: string;
60
+ }
61
+ export interface CreateClipFromVodResponseDataItem {
62
+ /** An ID that uniquely identifies the clip. */
63
+ id?: string | undefined;
64
+ /** A URL you can use to edit the clip's title, feature the clip, create a portrait version of the clip, download the clip media, and share the clip directly to third-party platforms. */
65
+ edit_url?: string | undefined;
66
+ }
67
+ /** A list containing the created clip. */
68
+ export type CreateClipFromVodResponseDataList = Array<CreateClipFromVodResponseDataItem>;
69
+ export interface CreateClipFromVodResponse {
70
+ /** A list containing the created clip. */
71
+ data?: CreateClipFromVodResponseDataList | undefined;
72
+ }
73
+ export type GetClipsRequestIdList = Array<string>;
74
+ export interface GetClipsRequest {
75
+ /** An ID that identifies the broadcaster whose video clips you want to get. Use this parameter to get clips that were captured from the broadcaster's streams. */
76
+ broadcaster_id?: string | undefined;
77
+ /** An ID that identifies the game whose clips you want to get. Use this parameter to get clips that were captured from streams that were playing this game. */
78
+ game_id?: string | undefined;
79
+ /** An ID that identifies the clip to get. To specify more than one ID, include this parameter for each clip you want to get. For example, 'id=foo&id=bar'. You may specify a maximum of 100 IDs. The API ignores duplicate IDs and IDs that aren't found. If you specify *id*, the API ignores the *started_at*, *ended_at*, *is_featured*, *first*, and *after* query parameters, and the response doesn't include a cursor. */
80
+ id?: GetClipsRequestIdList | undefined;
81
+ /** The start date used to filter clips. The API returns only clips within the start and end date window. Specify the date and time in RFC3339 format. The API truncates the start and end times to the minute. */
82
+ started_at?: string | undefined;
83
+ /** The end date used to filter clips. If not specified, the time window is the start date plus one week. Specify the date and time in RFC3339 format. The API ignores this parameter if you don't specify *started_at*. */
84
+ ended_at?: string | undefined;
85
+ /** The maximum number of clips to return per page in the response. The minimum page size is 1 clip per page and the maximum is 100. The default is 20. */
86
+ first?: number | undefined;
87
+ /** The cursor used to get the next page of results. The **Pagination** object in the response contains the cursor's value. [Read More](https://dev.twitch.tv/docs/api/guide.md#pagination) */
88
+ after?: string | undefined;
89
+ /** A Boolean value that determines whether the response includes featured clips. If **true**, returns only clips that are featured. If **false**, returns only clips that aren't featured. All clips are returned if this parameter is not present. */
90
+ is_featured?: boolean | undefined;
91
+ }
92
+ export interface GetClipsResponseDataItem {
93
+ /** An ID that uniquely identifies the clip. */
94
+ id?: string | undefined;
95
+ /** A URL to the clip. */
96
+ url?: string | undefined;
97
+ /** A URL that you can use in an iframe to embed the clip (see [Embedding Video and Clips](https://dev.twitch.tv/docs/embed/video-and-clips.md)). */
98
+ embed_url?: string | undefined;
99
+ /** An ID that identifies the broadcaster that the video was clipped from. */
100
+ broadcaster_id?: string | undefined;
101
+ /** The broadcaster's display name. */
102
+ broadcaster_name?: string | undefined;
103
+ /** An ID that identifies the user that created the clip. */
104
+ creator_id?: string | undefined;
105
+ /** The user's display name. */
106
+ creator_name?: string | undefined;
107
+ /** An ID that identifies the video that the clip came from. This field contains an empty string if the video is not available. */
108
+ video_id?: string | undefined;
109
+ /** The ID of the game that was being played when the clip was created. */
110
+ game_id?: string | undefined;
111
+ /** The ISO 639-1 two-letter language code that the broadcaster broadcasts in. For example, *en* for English. The value is *other* if the broadcaster uses a language that Twitch doesn't support. */
112
+ language?: string | undefined;
113
+ /** The title of the clip. */
114
+ title?: string | undefined;
115
+ /** The number of times the clip has been viewed. */
116
+ view_count?: number | undefined;
117
+ /** The date and time of when the clip was created. The date and time is in RFC3339 format. */
118
+ created_at?: string | undefined;
119
+ /** A URL to a thumbnail image of the clip. */
120
+ thumbnail_url?: string | undefined;
121
+ /** The length of the clip, in seconds. Precision is 0.1. */
122
+ duration?: number | undefined;
123
+ /** The zero-based offset, in seconds, to where the clip starts in the video (VOD). Is **null** if the video is not available or hasn't been created yet from the live stream (see `video_id`). Note that there's a delay between when a clip is created during a broadcast and when the offset is set. During the delay period, `vod_offset` is **null**. The delay is indeterminant but is typically minutes long. */
124
+ vod_offset?: number | null | undefined;
125
+ /** A Boolean value that indicates if the clip is featured or not. */
126
+ is_featured?: boolean | undefined;
127
+ }
128
+ /** The list of video clips. For clips returned by *game_id* or *broadcaster_id*, the list is in descending order by view count. For lists returned by *id*, the order isn't guaranteed to match the order of the input IDs. The list is always empty if the request comes from a region where videos aren't available. */
129
+ export type GetClipsResponseDataList = Array<GetClipsResponseDataItem>;
130
+ /** The information used to page through the list of results. The object is empty if there are no more pages left to page through. [Read More](https://dev.twitch.tv/docs/api/guide.md#pagination) */
131
+ export interface GetClipsResponsePagination {
132
+ /** The cursor used to get the next page of results. Set the request's *after* query parameter to this value. */
133
+ cursor?: string | undefined;
134
+ }
135
+ export interface GetClipsResponse {
136
+ /** The list of video clips. For clips returned by *game_id* or *broadcaster_id*, the list is in descending order by view count. For lists returned by *id*, the order isn't guaranteed to match the order of the input IDs. The list is always empty if the request comes from a region where videos aren't available. */
137
+ data: GetClipsResponseDataList;
138
+ /** The information used to page through the list of results. The object is empty if there are no more pages left to page through. [Read More](https://dev.twitch.tv/docs/api/guide.md#pagination) */
139
+ pagination?: GetClipsResponsePagination | undefined;
140
+ }
141
+ export type GetClipsDownloadRequestClipIdList = Array<string>;
142
+ export interface GetClipsDownloadRequest {
143
+ /** 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. */
144
+ editor_id: string;
145
+ /** The ID of the broadcaster you want to download clips for. */
146
+ broadcaster_id: string;
147
+ /** 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'. */
148
+ clip_id: GetClipsDownloadRequestClipIdList;
149
+ }
150
+ export interface GetClipsDownloadResponseDataItem {
151
+ /** An ID that uniquely identifies the clip. */
152
+ clip_id?: string | undefined;
153
+ /** The landscape URL to download the clip. This field is **null** if the URL is not available. */
154
+ landscape_download_url?: string | null | undefined;
155
+ /** The portrait URL to download the clip. This field is **null** if the URL is not available. */
156
+ portrait_download_url?: string | null | undefined;
157
+ }
158
+ /** List of clips and their download URLs. Clips that weren't found, that the editor may not access, or that belong to a different broadcaster are left out of the list. */
159
+ export type GetClipsDownloadResponseDataList = Array<GetClipsDownloadResponseDataItem>;
160
+ export interface GetClipsDownloadResponse {
161
+ /** List of clips and their download URLs. Clips that weren't found, that the editor may not access, or that belong to a different broadcaster are left out of the list. */
162
+ data?: GetClipsDownloadResponseDataList | undefined;
163
+ }
164
+ export type CreateClipError = TwitchOpError;
165
+ /** Create Clip Creates a clip from the broadcaster's stream. This API captures up to 90 seconds of the broadcaster's stream. The 90 seconds spans the point in the stream from when you called the API. For example, if you call the API at the 4:00 minute mark, the API captures from approximately the 2:35 mark to approximately the 4:05 minute mark. Twitch tries its best to capture 90 seconds of the stream, but the actual length may be less. This may occur if you begin capturing the clip near the beginning or end of the stream. By default, Twitch publishes up to the last 30 seconds of the 90 seconds window and provides a default title for the clip. To specify the title and the portion of the 90 seconds window that's used for the clip, use the URL in the response's `edit_url` field. You can specify a clip that's from 5 seconds to 60 seconds in length. The URL is valid for up to 24 hours or until the clip is published, whichever comes first. Creating a clip is an asynchronous process that can take a short amount of time to complete. To determine whether the clip was successfully created, call [Get Clips](#get-clips) using the clip ID that this request returned. If Get Clips returns the clip, the clip was successfully created. If after 60 seconds Get Clips hasn't returned the clip, assume it failed. Authorization: Requires one of the following: - A [user access token](https://dev.twitch.tv/docs/authentication.md#user-access-tokens) that includes the **clips:edit** scope. Reference: https://dev.twitch.tv/docs/api/reference/clips/#create-clip */
166
+ export const createClip: API.OperationMethod<
167
+ CreateClipRequest,
168
+ CreateClipResponse,
169
+ CreateClipError,
170
+ TwitchOpContext
171
+ > = /*@__PURE__*/ API.make(() => ({
172
+ input: __S(0, __c0, 0) as any as S.Schema<CreateClipRequest>,
173
+ output: __S(10, __c1, 2) as any as S.Schema<CreateClipResponse>,
174
+ errors: [],
175
+ serviceErrors: TwitchServiceErrors,
176
+ protocol: TwitchProtocol,
177
+ retry: Retry.Retry,
178
+ telemetry: TELEMETRY,
179
+ span: "CreateClip",
180
+ }));
181
+
182
+ export type CreateClipFromVodError = TwitchOpError;
183
+ /** Create Clip From VOD Creates a clip from the broadcaster's VOD. Creates a clip from a broadcaster's VOD on behalf of the broadcaster or an editor of the channel. Since a live stream is actively creating a VOD, this endpoint can also be used to create a clip from earlier in the current stream. The duration of a clip can be from 5 seconds to 60 seconds in length, with a default of 30 seconds if not specified. *vod_offset* indicates where the clip will end. In other words, the clip will start at (*vod_offset* - *duration*) and end at *vod_offset*. This means that the value of *vod_offset* must greater than or equal to the value of *duration*. The URL in the response's `edit_url` field allows you to edit the clip's title, feature the clip, create a portrait version of the clip, download the clip media, and share the clip directly to social platforms. Authorization: Requires one of the following: - A [user access token](https://dev.twitch.tv/docs/authentication.md#user-access-tokens) that includes the **editor:manage:clips** or **channel:manage:clips** scope. - An [app access token](https://dev.twitch.tv/docs/authentication.md#app-access-tokens). The application, through prior authorization, must have been granted: - The **editor:manage:clips** or **channel:manage:clips** scope for the user represented by the *editor_id* query parameter. Reference: https://dev.twitch.tv/docs/api/reference/clips/#create-clip-from-vod */
184
+ export const createClipFromVod: API.OperationMethod<
185
+ CreateClipFromVodRequest,
186
+ CreateClipFromVodResponse,
187
+ CreateClipFromVodError,
188
+ TwitchOpContext
189
+ > = /*@__PURE__*/ API.make(() => ({
190
+ input: __S(16, __c2, 0) as any as S.Schema<CreateClipFromVodRequest>,
191
+ output: __S(10, __c1, 2) as any as S.Schema<CreateClipFromVodResponse>,
192
+ errors: [],
193
+ serviceErrors: TwitchServiceErrors,
194
+ protocol: TwitchProtocol,
195
+ retry: Retry.Retry,
196
+ telemetry: TELEMETRY,
197
+ span: "CreateClipFromVod",
198
+ }));
199
+
200
+ export type GetClipsError = TwitchOpError;
201
+ /** Get Clips Gets one or more video clips that were captured from streams. For information about clips, see [How to use clips](https://help.twitch.tv/s/article/how-to-use-clips). You must specify exactly one of the *broadcaster_id*, *game_id* and *id* query parameters; the request fails if you specify none of them or more than one. When using pagination for clips, note that the maximum number of results returned over multiple requests will be approximately 1,000. If additional results are necessary, paginate over different query parameters such as multiple *started_at* and *ended_at* timeframes to refine the search. Authorization: Requires one of the following: - A [user access token](https://dev.twitch.tv/docs/authentication.md#user-access-tokens). - An [app access token](https://dev.twitch.tv/docs/authentication.md#app-access-tokens). Reference: https://dev.twitch.tv/docs/api/reference/clips/#get-clips */
202
+ export const getClips: API.PaginatedOperationMethod<
203
+ GetClipsRequest,
204
+ GetClipsResponse,
205
+ GetClipsError,
206
+ TwitchOpContext,
207
+ GetClipsResponseDataItem
208
+ > = /*@__PURE__*/ API.makePaginated(
209
+ () => ({
210
+ input: __S(24, __c3, 0) as any as S.Schema<GetClipsRequest>,
211
+ output: __S(28, __c3, 4) as any as S.Schema<GetClipsResponse>,
212
+ errors: [],
213
+ serviceErrors: TwitchServiceErrors,
214
+ protocol: TwitchProtocol,
215
+ retry: Retry.Retry,
216
+ telemetry: TELEMETRY,
217
+ span: "GetClips",
218
+ pagination: {
219
+ mode: "cursor",
220
+ inputToken: "after",
221
+ outputToken: "pagination.cursor",
222
+ items: "data",
223
+ pageSize: "first",
224
+ } as const,
225
+ }),
226
+ paginateCursor,
227
+ ) as any;
228
+
229
+ export type GetClipsDownloadError = TwitchOpError;
230
+ /** Get Clips Download Provides URLs to download the video file(s) for the specified clips. For information about clips, see [How to use clips](https://help.twitch.tv/s/article/how-to-use-clips). These links are temporary and should have a long-term expectation to expire. **Rate Limits**: Limited to 100 requests per minute. Authorization: Requires one of the following: - A [user access token](https://dev.twitch.tv/docs/authentication.md#user-access-tokens) that includes the **editor:manage:clips** or **channel:manage:clips** scope. - An [app access token](https://dev.twitch.tv/docs/authentication.md#app-access-tokens). The application, through prior authorization, must have been granted: - The **editor:manage:clips** or **channel:manage:clips** scope for the user represented by the *editor_id* query parameter. Reference: https://dev.twitch.tv/docs/api/reference/clips/#get-clips-download */
231
+ export const getClipsDownload: API.OperationMethod<
232
+ GetClipsDownloadRequest,
233
+ GetClipsDownloadResponse,
234
+ GetClipsDownloadError,
235
+ TwitchOpContext
236
+ > = /*@__PURE__*/ API.make(() => ({
237
+ input: __S(40, __c5, 0) as any as S.Schema<GetClipsDownloadRequest>,
238
+ output: __S(43, __c5, 3) as any as S.Schema<GetClipsDownloadResponse>,
239
+ errors: [],
240
+ serviceErrors: TwitchServiceErrors,
241
+ protocol: TwitchProtocol,
242
+ retry: Retry.Retry,
243
+ telemetry: TELEMETRY,
244
+ span: "GetClipsDownload",
245
+ }));
246
+
247
+ // Schema builders: each runs one schema initializer, on that schema's first use.
248
+ function __c0(j: number): any {
249
+ switch (j) {
250
+ case 0:
251
+ return S.suspend(() =>
252
+ S.Struct({
253
+ broadcaster_id: S.String.pipe(T.Query()),
254
+ title: S.optional(S.String.pipe(T.Query())),
255
+ duration: S.optional(S.Number.pipe(T.Query())),
256
+ }).pipe(T.Http({ method: "POST", uri: "/clips", code: 200 })),
257
+ ).annotate({ identifier: "CreateClipRequest" });
258
+ }
259
+ }
260
+ function __c1(j: number): any {
261
+ switch (j) {
262
+ case 0:
263
+ return S.suspend(() =>
264
+ S.Struct({
265
+ id: S.optional(S.String),
266
+ edit_url: S.optional(S.String),
267
+ }),
268
+ ).annotate({ identifier: "CreateClipResponseDataItem" });
269
+ case 1:
270
+ return S.Array(__S(8, __c1, 0));
271
+ case 2:
272
+ return S.suspend(() =>
273
+ S.Struct({
274
+ data: S.optional(__S(9, __c1, 1)),
275
+ }),
276
+ ).annotate({ identifier: "CreateClipResponse" });
277
+ }
278
+ }
279
+ function __c2(j: number): any {
280
+ switch (j) {
281
+ case 0:
282
+ return S.suspend(() =>
283
+ S.Struct({
284
+ editor_id: S.String.pipe(T.Query()),
285
+ broadcaster_id: S.String.pipe(T.Query()),
286
+ vod_id: S.String.pipe(T.Query()),
287
+ vod_offset: S.Number.pipe(T.Query()),
288
+ duration: S.optional(S.Number.pipe(T.Query())),
289
+ title: S.String.pipe(T.Query()),
290
+ }).pipe(T.Http({ method: "POST", uri: "/videos/clips", code: 200 })),
291
+ ).annotate({ identifier: "CreateClipFromVodRequest" });
292
+ }
293
+ }
294
+ function __c3(j: number): any {
295
+ switch (j) {
296
+ case 0:
297
+ return S.suspend(() =>
298
+ S.Struct({
299
+ broadcaster_id: S.optional(S.String.pipe(T.Query())),
300
+ game_id: S.optional(S.String.pipe(T.Query())),
301
+ id: S.optional(__S(32, __c4, 0).pipe(T.Query())),
302
+ started_at: S.optional(S.String.pipe(T.Query())),
303
+ ended_at: S.optional(S.String.pipe(T.Query())),
304
+ first: S.optional(S.Number.pipe(T.Query())),
305
+ after: S.optional(S.String.pipe(T.Query())),
306
+ is_featured: S.optional(S.Boolean.pipe(T.Query())),
307
+ }).pipe(T.Http({ method: "GET", uri: "/clips", code: 200 })),
308
+ ).annotate({ identifier: "GetClipsRequest" });
309
+ case 1:
310
+ return S.suspend(() =>
311
+ S.Struct({
312
+ id: S.optional(S.String),
313
+ url: S.optional(S.String),
314
+ embed_url: S.optional(S.String),
315
+ broadcaster_id: S.optional(S.String),
316
+ broadcaster_name: S.optional(S.String),
317
+ creator_id: S.optional(S.String),
318
+ creator_name: S.optional(S.String),
319
+ video_id: S.optional(S.String),
320
+ game_id: S.optional(S.String),
321
+ language: S.optional(S.String),
322
+ title: S.optional(S.String),
323
+ view_count: S.optional(S.Number),
324
+ created_at: S.optional(S.String),
325
+ thumbnail_url: S.optional(S.String),
326
+ duration: S.optional(S.Number),
327
+ vod_offset: S.optional(S.NullOr(S.Number)),
328
+ is_featured: S.optional(S.Boolean),
329
+ }),
330
+ ).annotate({ identifier: "GetClipsResponseDataItem" });
331
+ case 2:
332
+ return S.Array(__S(25, __c3, 1));
333
+ case 3:
334
+ return S.suspend(() =>
335
+ S.Struct({
336
+ cursor: S.optional(S.String),
337
+ }),
338
+ ).annotate({ identifier: "GetClipsResponsePagination" });
339
+ case 4:
340
+ return S.suspend(() =>
341
+ S.Struct({
342
+ data: __S(26, __c3, 2),
343
+ pagination: S.optional(__S(27, __c3, 3)),
344
+ }),
345
+ ).annotate({ identifier: "GetClipsResponse" });
346
+ }
347
+ }
348
+ function __c4(j: number): any {
349
+ switch (j) {
350
+ case 0:
351
+ return S.Array(S.String);
352
+ }
353
+ }
354
+ function __c5(j: number): any {
355
+ switch (j) {
356
+ case 0:
357
+ return S.suspend(() =>
358
+ S.Struct({
359
+ editor_id: S.String.pipe(T.Query()),
360
+ broadcaster_id: S.String.pipe(T.Query()),
361
+ clip_id: __S(32, __c4, 0).pipe(T.Query()),
362
+ }).pipe(T.Http({ method: "GET", uri: "/clips/downloads", code: 200 })),
363
+ ).annotate({ identifier: "GetClipsDownloadRequest" });
364
+ case 1:
365
+ return S.suspend(() =>
366
+ S.Struct({
367
+ clip_id: S.optional(S.String),
368
+ landscape_download_url: S.optional(S.NullOr(S.String)),
369
+ portrait_download_url: S.optional(S.NullOr(S.String)),
370
+ }),
371
+ ).annotate({ identifier: "GetClipsDownloadResponseDataItem" });
372
+ case 2:
373
+ return S.Array(__S(41, __c5, 1));
374
+ case 3:
375
+ return S.suspend(() =>
376
+ S.Struct({
377
+ data: S.optional(__S(42, __c5, 2)),
378
+ }),
379
+ ).annotate({ identifier: "GetClipsDownloadResponse" });
380
+ }
381
+ }
382
+ // Schema table: entry i is schema j of builder f, made on first reach.
383
+ function __S(i: number, f: (j: number) => unknown, j: number): any {
384
+ return (__s[i] ??= __L.at(f, j));
385
+ }