/
HelixExtension.ts
351 lines (309 loc) · 8.64 KB
/
HelixExtension.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
import { DataObject, rawDataSymbol } from '../DataObject';
import { rtfm } from '../rtfm';
import {
type HelixExtensionConfigurationLocation,
type HelixExtensionData,
type HelixExtensionIconSize,
type HelixExtensionState,
type HelixExtensionSubscriptionsSupportLevel,
} from './HelixExtension.external';
/**
* A Twitch Extension.
*/
@rtfm<HelixExtension>('api', 'HelixExtension', 'id')
export class HelixExtension extends DataObject<HelixExtensionData> {
/**
* The name of the extension's author.
*/
get authorName(): string {
return this[rawDataSymbol].author_name;
}
/**
* Whether bits are enabled for the extension.
*/
get bitsEnabled(): boolean {
return this[rawDataSymbol].bits_enabled;
}
/**
* Whether the extension can be installed.
*/
get installable(): boolean {
return this[rawDataSymbol].can_install;
}
/**
* The location of the extension's configuration.
*/
get configurationLocation(): HelixExtensionConfigurationLocation {
return this[rawDataSymbol].configuration_location;
}
/**
* The extension's description.
*/
get description(): string {
return this[rawDataSymbol].description;
}
/**
* The URL of the extension's terms of service.
*/
get tosUrl(): string {
return this[rawDataSymbol].eula_tos_url;
}
/**
* Whether the extension has support for sending chat messages.
*/
get hasChatSupport(): boolean {
return this[rawDataSymbol].has_chat_support;
}
/**
* The URL of the extension's default sized icon.
*/
get iconUrl(): string {
return this[rawDataSymbol].icon_url;
}
/**
* Gets the URL of the extension's icon in the given size.
*
* @param size The size of the icon.
*/
getIconUrl(size: HelixExtensionIconSize): string {
return this[rawDataSymbol].icon_urls[size];
}
/**
* The extension's ID.
*/
get id(): string {
return this[rawDataSymbol].id;
}
/**
* The extension's name.
*/
get name(): string {
return this[rawDataSymbol].name;
}
/**
* The URL of the extension's privacy policy.
*/
get privacyPolicyUrl(): string {
return this[rawDataSymbol].privacy_policy_url;
}
/**
* Whether the extension requests its users to share their identity with it.
*/
get requestsIdentityLink(): boolean {
return this[rawDataSymbol].request_identity_link;
}
/**
* The URLs of the extension's screenshots.
*/
get screenshotUrls(): string[] {
return this[rawDataSymbol].screenshot_urls;
}
/**
* The extension's activity state.
*/
get state(): HelixExtensionState {
return this[rawDataSymbol].state;
}
/**
* The extension's level of support for subscriptions.
*/
get subscriptionsSupportLevel(): HelixExtensionSubscriptionsSupportLevel {
return this[rawDataSymbol].subscriptions_support_level;
}
/**
* The extension's feature summary.
*/
get summary(): string {
return this[rawDataSymbol].summary;
}
/**
* The extension's support email address.
*/
get supportEmail(): string {
return this[rawDataSymbol].support_email;
}
/**
* The extension's version.
*/
get version(): string {
return this[rawDataSymbol].version;
}
/**
* The extension's feature summary for viewers.
*/
get viewerSummery(): string {
return this[rawDataSymbol].viewer_summary;
}
/**
* The extension's allowed configuration URLs.
*/
get allowedConfigUrls(): string[] {
return this[rawDataSymbol].allowlisted_config_urls;
}
/**
* The extension's allowed panel URLs.
*/
get allowedPanelUrls(): string[] {
return this[rawDataSymbol].allowlisted_panel_urls;
}
/**
* The URL shown when a viewer opens the extension on a mobile device.
*
* If the extension does not have a mobile view, this is null.
*/
get mobileViewerUrl(): string | null {
return this[rawDataSymbol].views.mobile?.viewer_url ?? null;
}
/**
* The URL shown to the viewer when the extension is shown as a panel.
*
* If the extension does not have a panel view, this is null.
*/
get panelViewerUrl(): string | null {
return this[rawDataSymbol].views.panel?.viewer_url ?? null;
}
/**
* The height of the extension panel.
*
* If the extension does not have a panel view, this is null.
*/
get panelHeight(): number | null {
return this[rawDataSymbol].views.panel?.height ?? null;
}
/**
* Whether the extension can link to external content from its panel view.
*
* If the extension does not have a panel view, this is null.
*/
get panelCanLinkExternalContent(): boolean | null {
return this[rawDataSymbol].views.panel?.can_link_external_content ?? null;
}
/**
* The URL shown to the viewer when the extension is shown as a video overlay.
*
* If the extension does not have a overlay view, this is null.
*/
get overlayViewerUrl(): string | null {
return this[rawDataSymbol].views.video_overlay?.viewer_url ?? null;
}
/**
* Whether the extension can link to external content from its overlay view.
*
* If the extension does not have a overlay view, this is null.
*/
get overlayCanLinkExternalContent(): boolean | null {
return this[rawDataSymbol].views.video_overlay?.can_link_external_content ?? null;
}
/**
* The URL shown to the viewer when the extension is shown as a video component.
*
* If the extension does not have a component view, this is null.
*/
get componentViewerUrl(): string | null {
return this[rawDataSymbol].views.component?.viewer_url ?? null;
}
/**
* The aspect width of the extension's component view.
*
* If the extension does not have a component view, this is null.
*/
get componentAspectWidth(): number | null {
return this[rawDataSymbol].views.component?.aspect_width ?? null;
}
/**
* The aspect height of the extension's component view.
*
* If the extension does not have a component view, this is null.
*/
get componentAspectHeight(): number | null {
return this[rawDataSymbol].views.component?.aspect_height ?? null;
}
/**
* The horizontal aspect ratio of the extension's component view.
*
* If the extension does not have a component view, this is null.
*/
get componentAspectRatioX(): number | null {
return this[rawDataSymbol].views.component?.aspect_ratio_x ?? null;
}
/**
* The vertical aspect ratio of the extension's component view.
*
* If the extension does not have a component view, this is null.
*/
get componentAspectRatioY(): number | null {
return this[rawDataSymbol].views.component?.aspect_ratio_y ?? null;
}
/**
* Whether the extension's component view should automatically scale.
*
* If the extension does not have a component view, this is null.
*/
get componentAutoScales(): boolean | null {
return this[rawDataSymbol].views.component?.autoscale ?? null;
}
/**
* The base width of the extension's component view to use for scaling.
*
* If the extension does not have a component view, this is null.
*/
get componentScalePixels(): number | null {
return this[rawDataSymbol].views.component?.scale_pixels ?? null;
}
/**
* The target height of the extension's component view.
*
* If the extension does not have a component view, this is null.
*/
get componentTargetHeight(): number | null {
return this[rawDataSymbol].views.component?.target_height ?? null;
}
/**
* The size of the extension's component view.
*
* If the extension does not have a component view, this is null.
*/
get componentSize(): number | null {
return this[rawDataSymbol].views.component?.size ?? null;
}
/**
* Whether zooming is enabled for the extension's component view.
*
* If the extension does not have a component view, this is null.
*/
get componentZoom(): boolean | null {
return this[rawDataSymbol].views.component?.zoom ?? null;
}
/**
* The zoom pixels of the extension's component view.
*
* If the extension does not have a component view, this is null.
*/
get componentZoomPixels(): number | null {
return this[rawDataSymbol].views.component?.zoom_pixels ?? null;
}
/**
* Whether the extension can link to external content from its component view.
*
* If the extension does not have a component view, this is null.
*/
get componentCanLinkExternalContent(): boolean | null {
return this[rawDataSymbol].views.component?.can_link_external_content ?? null;
}
/**
* The URL shown to the viewer when the extension's configuration page is shown.
*
* If the extension does not have a config view, this is null.
*/
get configViewerUrl(): string | null {
return this[rawDataSymbol].views.config?.viewer_url ?? null;
}
/**
* Whether the extension can link to external content from its config view.
*
* If the extension does not have a config view, this is null.
*/
get configCanLinkExternalContent(): boolean | null {
return this[rawDataSymbol].views.config?.can_link_external_content ?? null;
}
}