kicksdk-js 0.2.0 → 0.3.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.
- package/README.md +79 -3
- package/index.d.ts +13 -2
- package/index.js +51 -6
- package/package.json +1 -1
- package/pkg/kicksdk.d.ts +541 -11
- package/pkg/kicksdk.js +1488 -229
- package/pkg/kicksdk_bg.wasm +0 -0
- package/pkg/kicksdk_bg.wasm.d.ts +49 -1
package/pkg/kicksdk.d.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
|
|
4
4
|
/** Base URLs to use instead of Kick's. Any left out, or undefined, stay Kick's. */
|
|
5
5
|
export interface Endpoints {
|
|
6
|
-
/** The official API: `https://api.kick.com
|
|
6
|
+
/** The official API's host, without a version: `https://api.kick.com`. */
|
|
7
7
|
api?: string | undefined;
|
|
8
8
|
/** OAuth: `https://id.kick.com`. */
|
|
9
9
|
id?: string | undefined;
|
|
@@ -47,6 +47,227 @@ export interface VerifiedWebhook {
|
|
|
47
47
|
event: { type: string; [key: string]: unknown };
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
+
/** A request for `fetch`: what every `…Request` function returns. */
|
|
51
|
+
export interface HttpRequest {
|
|
52
|
+
method: string;
|
|
53
|
+
url: string;
|
|
54
|
+
headers: [string, string][];
|
|
55
|
+
body: string | null;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
/** A user token's scope, as Kick spells it: the 13 Kick documents, or one added since. */
|
|
59
|
+
export type Scope =
|
|
60
|
+
| 'ads:read'
|
|
61
|
+
| 'ads:write'
|
|
62
|
+
| 'channel:read'
|
|
63
|
+
| 'channel:write'
|
|
64
|
+
| 'channel:rewards:read'
|
|
65
|
+
| 'channel:rewards:write'
|
|
66
|
+
| 'chat:write'
|
|
67
|
+
| 'events:subscribe'
|
|
68
|
+
| 'kicks:read'
|
|
69
|
+
| 'moderation:ban'
|
|
70
|
+
| 'moderation:chat_message:manage'
|
|
71
|
+
| 'streamkey:read'
|
|
72
|
+
| 'user:read'
|
|
73
|
+
| (string & {});
|
|
74
|
+
|
|
75
|
+
/**
|
|
76
|
+
* A PKCE pair: `challenge` goes in `oauthAuthorizeUrl`, `verifier` is a
|
|
77
|
+
* secret kept until the user comes back, for `oauthCodeRequest`. Never log it.
|
|
78
|
+
*/
|
|
79
|
+
export interface Pkce {
|
|
80
|
+
verifier: string;
|
|
81
|
+
challenge: string;
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
/** A user token. Both tokens are secrets: never log them. */
|
|
85
|
+
export interface UserToken {
|
|
86
|
+
access_token: string;
|
|
87
|
+
/** For `oauthRefreshRequest`; each refresh gives a new one. */
|
|
88
|
+
refresh_token: string | null;
|
|
89
|
+
/** Seconds until the access token expires. */
|
|
90
|
+
expires_in: number | null;
|
|
91
|
+
/** Seconds until the refresh token expires, from every refresh. */
|
|
92
|
+
refresh_expires_in: number | null;
|
|
93
|
+
token_type: string | null;
|
|
94
|
+
scopes: Scope[];
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/** Which kind of token `oauthRevokeRequest` revokes. */
|
|
98
|
+
export type TokenTypeHint = 'access_token' | 'refresh_token';
|
|
99
|
+
|
|
100
|
+
/** What Kick says about a token. When it is not `active`, nothing else. */
|
|
101
|
+
export interface Introspection {
|
|
102
|
+
active: boolean;
|
|
103
|
+
client_id: string | null;
|
|
104
|
+
/** Unix seconds. */
|
|
105
|
+
exp: number | null;
|
|
106
|
+
scopes: Scope[];
|
|
107
|
+
/** `user` or `app`. */
|
|
108
|
+
token_type: string | null;
|
|
109
|
+
}
|
|
110
|
+
|
|
111
|
+
/** One page of a paginated answer: pass `next_cursor` back for the next. */
|
|
112
|
+
export interface Page<T> {
|
|
113
|
+
data: T[];
|
|
114
|
+
next_cursor: string | null;
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
export interface User {
|
|
118
|
+
user_id: number;
|
|
119
|
+
name: string | null;
|
|
120
|
+
profile_picture: string | null;
|
|
121
|
+
/** Only for a user token with `user:read`, for its own user. */
|
|
122
|
+
email: string | null;
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
export interface Category {
|
|
126
|
+
id: number | null;
|
|
127
|
+
name: string | null;
|
|
128
|
+
thumbnail: string | null;
|
|
129
|
+
/** Only `categoriesRequest` gives them; empty elsewhere. */
|
|
130
|
+
tags: string[];
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
export interface LivestreamStats {
|
|
134
|
+
total_count: number | null;
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
export interface KicksEntry {
|
|
138
|
+
user_id: number;
|
|
139
|
+
username: string | null;
|
|
140
|
+
rank: number | null;
|
|
141
|
+
gifted_amount: number | null;
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
export interface KicksLeaderboard {
|
|
145
|
+
lifetime: KicksEntry[];
|
|
146
|
+
month: KicksEntry[];
|
|
147
|
+
week: KicksEntry[];
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
/** Who `chatSendRequest` sends as: the token's user, into a channel by its broadcaster's user id, or the app's bot. */
|
|
151
|
+
export type ChatSender = { user: number } | 'bot';
|
|
152
|
+
|
|
153
|
+
/** What Kick says about a message sent. */
|
|
154
|
+
export interface Sent {
|
|
155
|
+
is_sent: boolean;
|
|
156
|
+
/** The new message's id, for `chatDeleteRequest`. */
|
|
157
|
+
message_id: string | null;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
export interface Reward {
|
|
161
|
+
id: string;
|
|
162
|
+
title: string | null;
|
|
163
|
+
description: string | null;
|
|
164
|
+
cost: number | null;
|
|
165
|
+
background_color: string | null;
|
|
166
|
+
is_enabled: boolean | null;
|
|
167
|
+
is_paused: boolean | null;
|
|
168
|
+
is_user_input_required: boolean | null;
|
|
169
|
+
should_redemptions_skip_request_queue: boolean | null;
|
|
170
|
+
}
|
|
171
|
+
|
|
172
|
+
/** A reward's settings: what is left out is not sent. Creating needs `title` and `cost`. */
|
|
173
|
+
export interface RewardFields {
|
|
174
|
+
title?: string | undefined;
|
|
175
|
+
cost?: number | undefined;
|
|
176
|
+
description?: string | undefined;
|
|
177
|
+
background_color?: string | undefined;
|
|
178
|
+
is_enabled?: boolean | undefined;
|
|
179
|
+
is_paused?: boolean | undefined;
|
|
180
|
+
is_user_input_required?: boolean | undefined;
|
|
181
|
+
should_redemptions_skip_request_queue?: boolean | undefined;
|
|
182
|
+
}
|
|
183
|
+
|
|
184
|
+
export type RedemptionStatus = 'pending' | 'accepted' | 'rejected';
|
|
185
|
+
|
|
186
|
+
export interface Redemption {
|
|
187
|
+
id: string;
|
|
188
|
+
status: string | null;
|
|
189
|
+
redeemed_at: string | null;
|
|
190
|
+
/** The redeemer's user id. */
|
|
191
|
+
redeemer: number | null;
|
|
192
|
+
user_input: string | null;
|
|
193
|
+
}
|
|
194
|
+
|
|
195
|
+
export interface RedeemedReward {
|
|
196
|
+
id: string;
|
|
197
|
+
title: string | null;
|
|
198
|
+
description: string | null;
|
|
199
|
+
cost: number | null;
|
|
200
|
+
can_manage: boolean | null;
|
|
201
|
+
is_deleted: boolean;
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
export interface RedemptionPage {
|
|
205
|
+
rewards: { reward: RedeemedReward; redemptions: Redemption[] }[];
|
|
206
|
+
next_cursor: string | null;
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
/** A redemption Kick did not accept or reject: `NOT_PENDING`, `NOT_FOUND`, `NOT_OWNED`, `UNKNOWN`. */
|
|
210
|
+
export interface FailedRedemption {
|
|
211
|
+
id: string;
|
|
212
|
+
reason: string | null;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
export interface AdBreak {
|
|
216
|
+
id: string | null;
|
|
217
|
+
ad_break_id: string | null;
|
|
218
|
+
remaining_ad_breaks: number | null;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
export interface AdStatus {
|
|
222
|
+
opted_in: boolean | null;
|
|
223
|
+
ads_blocked: boolean | null;
|
|
224
|
+
auto_ads_active: boolean | null;
|
|
225
|
+
remaining_ad_breaks: number | null;
|
|
226
|
+
limits: { max: number | null; period_seconds: number | null } | null;
|
|
227
|
+
ad_breaks: {
|
|
228
|
+
id: string | null;
|
|
229
|
+
ad_break_id: string | null;
|
|
230
|
+
status: string | null;
|
|
231
|
+
source: string | null;
|
|
232
|
+
break_duration_seconds: number | null;
|
|
233
|
+
created_at: string | null;
|
|
234
|
+
}[];
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
/** What `dropsClaimsRequest` lists by: what is left out is not filtered. */
|
|
238
|
+
export interface ClaimFilter {
|
|
239
|
+
campaign_id?: string | undefined;
|
|
240
|
+
claim_id?: string | undefined;
|
|
241
|
+
user_id?: number | undefined;
|
|
242
|
+
external_status?: string | undefined;
|
|
243
|
+
/** 1 to 1000. */
|
|
244
|
+
limit?: number | undefined;
|
|
245
|
+
cursor?: string | undefined;
|
|
246
|
+
}
|
|
247
|
+
|
|
248
|
+
export interface Claim {
|
|
249
|
+
claim_id: string;
|
|
250
|
+
user_id: number | null;
|
|
251
|
+
campaign_id: string | null;
|
|
252
|
+
reward_id: string | null;
|
|
253
|
+
external_id: string | null;
|
|
254
|
+
external_status: string | null;
|
|
255
|
+
created_at: string | null;
|
|
256
|
+
updated_at: string | null;
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
export interface Claims {
|
|
260
|
+
claims: Claim[];
|
|
261
|
+
/** The next page's, for `ClaimFilter.cursor`. */
|
|
262
|
+
cursor: string | null;
|
|
263
|
+
}
|
|
264
|
+
|
|
265
|
+
/** One claim's new status, for `dropsUpdateClaimsRequest`. */
|
|
266
|
+
export interface ClaimUpdate {
|
|
267
|
+
claim_id: string;
|
|
268
|
+
external_status: string;
|
|
269
|
+
}
|
|
270
|
+
|
|
50
271
|
|
|
51
272
|
|
|
52
273
|
/**
|
|
@@ -153,6 +374,32 @@ export class WebhookPublicKey {
|
|
|
153
374
|
verify(headers: WebhookHeaders, body: string | Uint8Array | ArrayBuffer, options?: VerifyOptions | null): VerifiedWebhook;
|
|
154
375
|
}
|
|
155
376
|
|
|
377
|
+
/**
|
|
378
|
+
* Starts an ad break of 7 to 90 `seconds`; `id` is a UUID you make up
|
|
379
|
+
* (`crypto.randomUUID()`).
|
|
380
|
+
*/
|
|
381
|
+
export function adsAdBreakRequest(token: string, id: string, seconds: number, endpoints?: Endpoints | null): HttpRequest;
|
|
382
|
+
|
|
383
|
+
/**
|
|
384
|
+
* Enrolls the channel in ads; `parseDone` reads the answer.
|
|
385
|
+
*/
|
|
386
|
+
export function adsEnrollRequest(token: string, endpoints?: Endpoints | null): HttpRequest;
|
|
387
|
+
|
|
388
|
+
/**
|
|
389
|
+
* Reads an `adsAdBreakRequest` answer.
|
|
390
|
+
*/
|
|
391
|
+
export function adsParseAdBreak(status: number, body: string): AdBreak;
|
|
392
|
+
|
|
393
|
+
/**
|
|
394
|
+
* Reads an `adsStatusRequest` answer.
|
|
395
|
+
*/
|
|
396
|
+
export function adsParseStatus(status: number, body: string): AdStatus;
|
|
397
|
+
|
|
398
|
+
/**
|
|
399
|
+
* The channel's ads: enrolled or not, limits, recent ad breaks.
|
|
400
|
+
*/
|
|
401
|
+
export function adsStatusRequest(token: string, endpoints?: Endpoints | null): HttpRequest;
|
|
402
|
+
|
|
156
403
|
/**
|
|
157
404
|
* An app token request (client credentials).
|
|
158
405
|
*/
|
|
@@ -163,6 +410,13 @@ export function appTokenRequest(client_id: string, client_secret: string, endpoi
|
|
|
163
410
|
*/
|
|
164
411
|
export function banRequest(session: string, channel_slug: string, username: string, endpoints?: Endpoints | null): any;
|
|
165
412
|
|
|
413
|
+
/**
|
|
414
|
+
* One page of categories (`/public/v2/categories`): by `names` and `tags`
|
|
415
|
+
* (no commas in them), or by `ids`; none of them, all. `limit` is 1 to 1000
|
|
416
|
+
* (Kick's default 25); `cursor` is the previous page's `next_cursor`.
|
|
417
|
+
*/
|
|
418
|
+
export function categoriesRequest(token: string, names?: readonly string[] | null, tags?: readonly string[] | null, ids?: readonly number[] | null, limit?: number | null, cursor?: string | null, endpoints?: Endpoints | null): HttpRequest;
|
|
419
|
+
|
|
166
420
|
/**
|
|
167
421
|
* A channel by slug (`kick.com/api/v2`): chatroom id, followers, live state.
|
|
168
422
|
*/
|
|
@@ -183,6 +437,13 @@ export function channelsByIdsRequest(token: string, user_ids: readonly number[],
|
|
|
183
437
|
*/
|
|
184
438
|
export function channelsBySlugsRequest(token: string, slugs: string[], endpoints?: Endpoints | null): any;
|
|
185
439
|
|
|
440
|
+
/**
|
|
441
|
+
* Sets what is given of the token's channel's category, custom tags (`[]`
|
|
442
|
+
* clears them, up to 10) and stream title. Scope `channel:write`;
|
|
443
|
+
* `parseDone` reads the answer.
|
|
444
|
+
*/
|
|
445
|
+
export function channelsUpdateRequest(token: string, category_id?: number | null, custom_tags?: readonly string[] | null, stream_title?: string | null, endpoints?: Endpoints | null): HttpRequest;
|
|
446
|
+
|
|
186
447
|
/**
|
|
187
448
|
* The feeds for one chat, the chat feed first.
|
|
188
449
|
*/
|
|
@@ -193,6 +454,24 @@ export function chatChannels(chatroom_id: number, channel_id?: number | null): s
|
|
|
193
454
|
*/
|
|
194
455
|
export function chatConnectionRequest(channel_id: number, client_id: string, endpoints?: Endpoints | null): any;
|
|
195
456
|
|
|
457
|
+
/**
|
|
458
|
+
* Deletes a message by id. Scope `moderation:chat_message:manage`;
|
|
459
|
+
* `parseDone` reads the answer.
|
|
460
|
+
*/
|
|
461
|
+
export function chatDeleteRequest(token: string, message_id: string, endpoints?: Endpoints | null): HttpRequest;
|
|
462
|
+
|
|
463
|
+
/**
|
|
464
|
+
* Reads a `chatSendRequest` answer.
|
|
465
|
+
*/
|
|
466
|
+
export function chatParseSend(status: number, body: string): Sent;
|
|
467
|
+
|
|
468
|
+
/**
|
|
469
|
+
* Sends `content` as the token's user into a channel (`{user:
|
|
470
|
+
* broadcasterUserId}`) or as the app's bot (`'bot'`), as a reply if
|
|
471
|
+
* `replyToMessageId` is given. Scope `chat:write`.
|
|
472
|
+
*/
|
|
473
|
+
export function chatSendRequest(token: string, sender: ChatSender, content: string, reply_to_message_id?: string | null, endpoints?: Endpoints | null): HttpRequest;
|
|
474
|
+
|
|
196
475
|
/**
|
|
197
476
|
* Where Kick's realtime is served in general.
|
|
198
477
|
*/
|
|
@@ -203,6 +482,22 @@ export function connectionRequest(client_id: string, endpoints?: Endpoints | nul
|
|
|
203
482
|
*/
|
|
204
483
|
export function deleteMessageRequest(session: string, chatroom_id: number, message_id: string, endpoints?: Endpoints | null): any;
|
|
205
484
|
|
|
485
|
+
/**
|
|
486
|
+
* Drops reward claims, with an **app** token. `filter`: what is left out
|
|
487
|
+
* is not filtered.
|
|
488
|
+
*/
|
|
489
|
+
export function dropsClaimsRequest(token: string, filter?: ClaimFilter | null, endpoints?: Endpoints | null): HttpRequest;
|
|
490
|
+
|
|
491
|
+
/**
|
|
492
|
+
* Reads a `dropsClaimsRequest` answer.
|
|
493
|
+
*/
|
|
494
|
+
export function dropsParseClaims(status: number, body: string): Claims;
|
|
495
|
+
|
|
496
|
+
/**
|
|
497
|
+
* Sets 1 to 100 claims' `external_status`; `parseDone` reads the answer.
|
|
498
|
+
*/
|
|
499
|
+
export function dropsUpdateClaimsRequest(token: string, updates: readonly ClaimUpdate[], endpoints?: Endpoints | null): HttpRequest;
|
|
500
|
+
|
|
206
501
|
/**
|
|
207
502
|
* An emote's image URL.
|
|
208
503
|
*/
|
|
@@ -214,7 +509,27 @@ export function emoteUrl(id: string): string;
|
|
|
214
509
|
export function historyRequest(channel_id: number, endpoints?: Endpoints | null): any;
|
|
215
510
|
|
|
216
511
|
/**
|
|
217
|
-
*
|
|
512
|
+
* The top `top` Kicks gifters (1 to 100; Kick's default 10) of the token's
|
|
513
|
+
* own channel. A user token with `kicks:read`.
|
|
514
|
+
*/
|
|
515
|
+
export function kicksLeaderboardRequest(token: string, top?: number | null, endpoints?: Endpoints | null): HttpRequest;
|
|
516
|
+
|
|
517
|
+
/**
|
|
518
|
+
* How many streams are live on Kick.
|
|
519
|
+
*/
|
|
520
|
+
export function livestreamStatsRequest(token: string, endpoints?: Endpoints | null): HttpRequest;
|
|
521
|
+
|
|
522
|
+
/**
|
|
523
|
+
* One page of the streams live now (`/public/v2/livestreams`), in up to 25
|
|
524
|
+
* categories and 25 languages (none: all). `limit` is 1 to 1000 (Kick's
|
|
525
|
+
* default 100); `cursor` is the previous page's `next_cursor`. Kick has no
|
|
526
|
+
* sort: streams come oldest first.
|
|
527
|
+
*/
|
|
528
|
+
export function livestreamsPageRequest(token: string, category_ids?: readonly number[] | null, language_codes?: readonly string[] | null, limit?: number | null, cursor?: string | null, endpoints?: Endpoints | null): any;
|
|
529
|
+
|
|
530
|
+
/**
|
|
531
|
+
* `/public/v1/users/livestreams` for any number of user ids: one request
|
|
532
|
+
* per 100.
|
|
218
533
|
*/
|
|
219
534
|
export function livestreamsRequests(token: string, user_ids: readonly number[], endpoints?: Endpoints | null): any;
|
|
220
535
|
|
|
@@ -223,6 +538,80 @@ export function livestreamsRequests(token: string, user_ids: readonly number[],
|
|
|
223
538
|
*/
|
|
224
539
|
export function meRequest(session: string, channel_slug: string, endpoints?: Endpoints | null): any;
|
|
225
540
|
|
|
541
|
+
/**
|
|
542
|
+
* Bans a user for good. Scope `moderation:ban`; `parseDone` reads the answer.
|
|
543
|
+
*/
|
|
544
|
+
export function moderationBanRequest(token: string, broadcaster_user_id: number, user_id: number, reason?: string | null, endpoints?: Endpoints | null): HttpRequest;
|
|
545
|
+
|
|
546
|
+
/**
|
|
547
|
+
* Times a user out for 1 to 10080 minutes. Scope `moderation:ban`.
|
|
548
|
+
*/
|
|
549
|
+
export function moderationTimeoutRequest(token: string, broadcaster_user_id: number, user_id: number, minutes: number, reason?: string | null, endpoints?: Endpoints | null): HttpRequest;
|
|
550
|
+
|
|
551
|
+
/**
|
|
552
|
+
* Lifts a ban or a timeout. Scope `moderation:ban`.
|
|
553
|
+
*/
|
|
554
|
+
export function moderationUnbanRequest(token: string, broadcaster_user_id: number, user_id: number, endpoints?: Endpoints | null): HttpRequest;
|
|
555
|
+
|
|
556
|
+
/**
|
|
557
|
+
* Where to send the user's browser to approve the app. `state` (from
|
|
558
|
+
* `newState()`) must come back unchanged on the redirect; `verifier` is the
|
|
559
|
+
* `Pkce`'s.
|
|
560
|
+
*/
|
|
561
|
+
export function oauthAuthorizeUrl(client_id: string, redirect_uri: string, scopes: readonly Scope[], state: string, verifier: string, endpoints?: Endpoints | null): string;
|
|
562
|
+
|
|
563
|
+
/**
|
|
564
|
+
* A user token for the `code` on the redirect, with the PKCE verifier.
|
|
565
|
+
*/
|
|
566
|
+
export function oauthCodeRequest(client_id: string, client_secret: string, redirect_uri: string, code: string, code_verifier: string, endpoints?: Endpoints | null): HttpRequest;
|
|
567
|
+
|
|
568
|
+
/**
|
|
569
|
+
* Asks Kick about the token it is sent with (a user or an app token).
|
|
570
|
+
*/
|
|
571
|
+
export function oauthIntrospectRequest(token: string, endpoints?: Endpoints | null): HttpRequest;
|
|
572
|
+
|
|
573
|
+
/**
|
|
574
|
+
* Reads an `oauthIntrospectRequest` answer.
|
|
575
|
+
*/
|
|
576
|
+
export function oauthParseIntrospect(status: number, body: string): Introspection;
|
|
577
|
+
|
|
578
|
+
/**
|
|
579
|
+
* Whether a revoke worked; throws with `status` if not.
|
|
580
|
+
*/
|
|
581
|
+
export function oauthParseRevoke(status: number, body: string): void;
|
|
582
|
+
|
|
583
|
+
/**
|
|
584
|
+
* Reads an `oauthCodeRequest` or `oauthRefreshRequest` answer.
|
|
585
|
+
*/
|
|
586
|
+
export function oauthParseUserToken(status: number, body: string): UserToken;
|
|
587
|
+
|
|
588
|
+
/**
|
|
589
|
+
* A PKCE pair from 32 to 96 bytes drawn from a CSPRNG (`newPkce()` draws
|
|
590
|
+
* them). The verifier is a secret: keep it, never log it.
|
|
591
|
+
*/
|
|
592
|
+
export function oauthPkce(random: Uint8Array): Pkce;
|
|
593
|
+
|
|
594
|
+
/**
|
|
595
|
+
* The PKCE pair for a verifier kept from before (43 to 128 characters of
|
|
596
|
+
* `A-Z a-z 0-9 - . _ ~`).
|
|
597
|
+
*/
|
|
598
|
+
export function oauthPkceFromVerifier(verifier: string): Pkce;
|
|
599
|
+
|
|
600
|
+
/**
|
|
601
|
+
* A new user token (and refresh token) for a refresh token.
|
|
602
|
+
*/
|
|
603
|
+
export function oauthRefreshRequest(client_id: string, client_secret: string, refresh_token: string, endpoints?: Endpoints | null): HttpRequest;
|
|
604
|
+
|
|
605
|
+
/**
|
|
606
|
+
* Revokes a token. It goes in the URL: keep the URL out of logs.
|
|
607
|
+
*/
|
|
608
|
+
export function oauthRevokeRequest(token: string, token_type_hint?: TokenTypeHint | null, endpoints?: Endpoints | null): HttpRequest;
|
|
609
|
+
|
|
610
|
+
/**
|
|
611
|
+
* Every scope Kick documents.
|
|
612
|
+
*/
|
|
613
|
+
export function oauthScopes(): Scope[];
|
|
614
|
+
|
|
226
615
|
/**
|
|
227
616
|
* Whether an acting call worked; throws with `status` if not.
|
|
228
617
|
*/
|
|
@@ -233,6 +622,11 @@ export function parseAction(status: number, body: string): void;
|
|
|
233
622
|
*/
|
|
234
623
|
export function parseAppToken(status: number, body: string): any;
|
|
235
624
|
|
|
625
|
+
/**
|
|
626
|
+
* Reads a `categoriesRequest` answer: `{data, next_cursor}`.
|
|
627
|
+
*/
|
|
628
|
+
export function parseCategories(status: number, body: string): Page<Category>;
|
|
629
|
+
|
|
236
630
|
/**
|
|
237
631
|
* Reads a website channel answer.
|
|
238
632
|
*/
|
|
@@ -258,6 +652,12 @@ export function parseConnection(status: number, body: string): any;
|
|
|
258
652
|
*/
|
|
259
653
|
export function parseContent(text: string, combine: boolean): any;
|
|
260
654
|
|
|
655
|
+
/**
|
|
656
|
+
* Whether a user-token call whose answer carries nothing worked (any 2xx);
|
|
657
|
+
* throws with `status` if not.
|
|
658
|
+
*/
|
|
659
|
+
export function parseDone(status: number, body: string): void;
|
|
660
|
+
|
|
261
661
|
/**
|
|
262
662
|
* A feed event, typed: `{type: "chat_message", …}`. `data` as Kick sent it.
|
|
263
663
|
*/
|
|
@@ -269,10 +669,25 @@ export function parseEvent(name: string, data: any): any;
|
|
|
269
669
|
export function parseHistory(status: number, body: string): any;
|
|
270
670
|
|
|
271
671
|
/**
|
|
272
|
-
* Reads a
|
|
672
|
+
* Reads a `kicksLeaderboardRequest` answer.
|
|
673
|
+
*/
|
|
674
|
+
export function parseKicksLeaderboard(status: number, body: string): KicksLeaderboard;
|
|
675
|
+
|
|
676
|
+
/**
|
|
677
|
+
* Reads a `livestreamStatsRequest` answer.
|
|
678
|
+
*/
|
|
679
|
+
export function parseLivestreamStats(status: number, body: string): LivestreamStats;
|
|
680
|
+
|
|
681
|
+
/**
|
|
682
|
+
* Reads a `livestreamsRequests` answer (or a page's streams alone).
|
|
273
683
|
*/
|
|
274
684
|
export function parseLivestreams(status: number, body: string): any;
|
|
275
685
|
|
|
686
|
+
/**
|
|
687
|
+
* Reads a `livestreamsPageRequest` answer: `{data, next_cursor}`.
|
|
688
|
+
*/
|
|
689
|
+
export function parseLivestreamsPage(status: number, body: string): any;
|
|
690
|
+
|
|
276
691
|
/**
|
|
277
692
|
* Reads a `me` answer.
|
|
278
693
|
*/
|
|
@@ -293,6 +708,11 @@ export function parseSubscriptions(status: number, body: string): any;
|
|
|
293
708
|
*/
|
|
294
709
|
export function parseToken(status: number, body: string): string;
|
|
295
710
|
|
|
711
|
+
/**
|
|
712
|
+
* Reads a `usersRequest` answer.
|
|
713
|
+
*/
|
|
714
|
+
export function parseUsers(status: number, body: string): User[];
|
|
715
|
+
|
|
296
716
|
/**
|
|
297
717
|
* Reads a delivery's body by its type header, without checking anything.
|
|
298
718
|
* Throws when the body is not that type's shape. `body` is text or bytes.
|
|
@@ -318,6 +738,70 @@ export function publicKeyRequest(endpoints?: Endpoints | null): any;
|
|
|
318
738
|
*/
|
|
319
739
|
export function retryAfterMs(code: number): number;
|
|
320
740
|
|
|
741
|
+
/**
|
|
742
|
+
* Accepts 1 to 25 pending redemptions; `rewardsParseFailures` reads the
|
|
743
|
+
* answer.
|
|
744
|
+
*/
|
|
745
|
+
export function rewardsAcceptRequest(token: string, ids: readonly string[], endpoints?: Endpoints | null): HttpRequest;
|
|
746
|
+
|
|
747
|
+
/**
|
|
748
|
+
* Creates a reward: `fields` needs `title` and `cost`.
|
|
749
|
+
*/
|
|
750
|
+
export function rewardsCreateRequest(token: string, fields: RewardFields, endpoints?: Endpoints | null): HttpRequest;
|
|
751
|
+
|
|
752
|
+
/**
|
|
753
|
+
* Deletes reward `id`; `parseDone` reads the answer.
|
|
754
|
+
*/
|
|
755
|
+
export function rewardsDeleteRequest(token: string, id: string, endpoints?: Endpoints | null): HttpRequest;
|
|
756
|
+
|
|
757
|
+
/**
|
|
758
|
+
* Every channel-points reward of the token's channel.
|
|
759
|
+
*/
|
|
760
|
+
export function rewardsListRequest(token: string, endpoints?: Endpoints | null): HttpRequest;
|
|
761
|
+
|
|
762
|
+
/**
|
|
763
|
+
* The redemptions an accept or reject failed for; empty is all done.
|
|
764
|
+
*/
|
|
765
|
+
export function rewardsParseFailures(status: number, body: string): FailedRedemption[];
|
|
766
|
+
|
|
767
|
+
/**
|
|
768
|
+
* Reads a `rewardsRedemptionsRequest` or `rewardsRedemptionsByIdsRequest`
|
|
769
|
+
* answer.
|
|
770
|
+
*/
|
|
771
|
+
export function rewardsParseRedemptions(status: number, body: string): RedemptionPage;
|
|
772
|
+
|
|
773
|
+
/**
|
|
774
|
+
* Reads a `rewardsCreateRequest` or `rewardsUpdateRequest` answer.
|
|
775
|
+
*/
|
|
776
|
+
export function rewardsParseReward(status: number, body: string): Reward;
|
|
777
|
+
|
|
778
|
+
/**
|
|
779
|
+
* Reads a `rewardsListRequest` answer.
|
|
780
|
+
*/
|
|
781
|
+
export function rewardsParseRewards(status: number, body: string): Reward[];
|
|
782
|
+
|
|
783
|
+
/**
|
|
784
|
+
* Redemptions by id, whatever their status.
|
|
785
|
+
*/
|
|
786
|
+
export function rewardsRedemptionsByIdsRequest(token: string, ids: readonly string[], cursor?: string | null, endpoints?: Endpoints | null): HttpRequest;
|
|
787
|
+
|
|
788
|
+
/**
|
|
789
|
+
* Redemptions, grouped by reward: of one reward or all, with one `status`
|
|
790
|
+
* (Kick's default `'pending'`), from `cursor`.
|
|
791
|
+
*/
|
|
792
|
+
export function rewardsRedemptionsRequest(token: string, reward_id?: string | null, status?: RedemptionStatus | null, cursor?: string | null, endpoints?: Endpoints | null): HttpRequest;
|
|
793
|
+
|
|
794
|
+
/**
|
|
795
|
+
* Rejects 1 to 25 pending redemptions; `rewardsParseFailures` reads the
|
|
796
|
+
* answer.
|
|
797
|
+
*/
|
|
798
|
+
export function rewardsRejectRequest(token: string, ids: readonly string[], endpoints?: Endpoints | null): HttpRequest;
|
|
799
|
+
|
|
800
|
+
/**
|
|
801
|
+
* Changes what `fields` sets of reward `id`.
|
|
802
|
+
*/
|
|
803
|
+
export function rewardsUpdateRequest(token: string, id: string, fields: RewardFields, endpoints?: Endpoints | null): HttpRequest;
|
|
804
|
+
|
|
321
805
|
/**
|
|
322
806
|
* Sends a message, or a reply when `replyTo` is
|
|
323
807
|
* `{message_id, content, sender_id, sender_username}`.
|
|
@@ -345,13 +829,6 @@ export function timeoutRequest(session: string, channel_slug: string, username:
|
|
|
345
829
|
*/
|
|
346
830
|
export function tokenRequest(client_id: string, endpoints?: Endpoints | null): any;
|
|
347
831
|
|
|
348
|
-
/**
|
|
349
|
-
* The top live streams, overall or in a category or language: 1 to 100
|
|
350
|
-
* (100 by default). `sort` is `"viewer_count"` (the default) or
|
|
351
|
-
* `"started_at"`.
|
|
352
|
-
*/
|
|
353
|
-
export function topLivestreamsRequest(token: string, category_id?: number | null, language?: string | null, sort?: 'viewer_count' | 'started_at' | null, limit?: number | null, endpoints?: Endpoints | null): any;
|
|
354
|
-
|
|
355
832
|
/**
|
|
356
833
|
* Lifts a ban or timeout.
|
|
357
834
|
*/
|
|
@@ -367,6 +844,11 @@ export function unpinRequest(session: string, channel_slug: string, endpoints?:
|
|
|
367
844
|
*/
|
|
368
845
|
export function unsubscribeRequests(token: string, ids: string[], endpoints?: Endpoints | null): any;
|
|
369
846
|
|
|
847
|
+
/**
|
|
848
|
+
* Users by id, up to 50; none, with a user token: the token's own user.
|
|
849
|
+
*/
|
|
850
|
+
export function usersRequest(token: string, user_ids?: readonly number[] | null, endpoints?: Endpoints | null): HttpRequest;
|
|
851
|
+
|
|
370
852
|
/**
|
|
371
853
|
* Checks a delivery and returns `{headers, event}`, or throws. `headers` as
|
|
372
854
|
* `[[name, value]…]`, a fetch `Headers` or an object; `body` the raw body,
|
|
@@ -386,6 +868,11 @@ export interface InitOutput {
|
|
|
386
868
|
readonly __wbg_backoff_free: (a: number, b: number) => void;
|
|
387
869
|
readonly __wbg_session_free: (a: number, b: number) => void;
|
|
388
870
|
readonly __wbg_webhookpublickey_free: (a: number, b: number) => void;
|
|
871
|
+
readonly adsAdBreakRequest: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
|
|
872
|
+
readonly adsEnrollRequest: (a: number, b: number, c: number, d: number) => void;
|
|
873
|
+
readonly adsParseAdBreak: (a: number, b: number, c: number, d: number) => void;
|
|
874
|
+
readonly adsParseStatus: (a: number, b: number, c: number, d: number) => void;
|
|
875
|
+
readonly adsStatusRequest: (a: number, b: number, c: number, d: number) => void;
|
|
389
876
|
readonly appTokenRequest: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
390
877
|
readonly backoff_new: (a: number, b: number, c: number) => void;
|
|
391
878
|
readonly backoff_nextDelay: (a: number) => number;
|
|
@@ -393,36 +880,79 @@ export interface InitOutput {
|
|
|
393
880
|
readonly backoff_nextDelayJittered: (a: number, b: number, c: number) => void;
|
|
394
881
|
readonly backoff_reset: (a: number) => void;
|
|
395
882
|
readonly banRequest: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => void;
|
|
883
|
+
readonly categoriesRequest: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number) => void;
|
|
396
884
|
readonly channelRequest: (a: number, b: number, c: number, d: number) => void;
|
|
397
885
|
readonly channelUserRequest: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
398
886
|
readonly channelsByIdsRequest: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
399
887
|
readonly channelsBySlugsRequest: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
888
|
+
readonly channelsUpdateRequest: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => void;
|
|
400
889
|
readonly chatChannels: (a: number, b: number, c: number) => void;
|
|
401
890
|
readonly chatConnectionRequest: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
891
|
+
readonly chatDeleteRequest: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
892
|
+
readonly chatParseSend: (a: number, b: number, c: number, d: number) => void;
|
|
893
|
+
readonly chatSendRequest: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => void;
|
|
402
894
|
readonly connectionRequest: (a: number, b: number, c: number, d: number) => void;
|
|
403
895
|
readonly deleteMessageRequest: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
|
|
896
|
+
readonly dropsClaimsRequest: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
897
|
+
readonly dropsParseClaims: (a: number, b: number, c: number, d: number) => void;
|
|
898
|
+
readonly dropsUpdateClaimsRequest: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
404
899
|
readonly emoteUrl: (a: number, b: number, c: number) => void;
|
|
405
900
|
readonly historyRequest: (a: number, b: number, c: number) => void;
|
|
901
|
+
readonly kicksLeaderboardRequest: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
902
|
+
readonly livestreamStatsRequest: (a: number, b: number, c: number, d: number) => void;
|
|
903
|
+
readonly livestreamsPageRequest: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => void;
|
|
406
904
|
readonly livestreamsRequests: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
407
905
|
readonly meRequest: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
906
|
+
readonly moderationBanRequest: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => void;
|
|
907
|
+
readonly moderationTimeoutRequest: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => void;
|
|
908
|
+
readonly moderationUnbanRequest: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
909
|
+
readonly oauthAuthorizeUrl: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number) => void;
|
|
910
|
+
readonly oauthCodeRequest: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number, k: number, l: number) => void;
|
|
911
|
+
readonly oauthIntrospectRequest: (a: number, b: number, c: number, d: number) => void;
|
|
912
|
+
readonly oauthParseIntrospect: (a: number, b: number, c: number, d: number) => void;
|
|
913
|
+
readonly oauthParseRevoke: (a: number, b: number, c: number, d: number) => void;
|
|
914
|
+
readonly oauthParseUserToken: (a: number, b: number, c: number, d: number) => void;
|
|
915
|
+
readonly oauthPkce: (a: number, b: number) => void;
|
|
916
|
+
readonly oauthPkceFromVerifier: (a: number, b: number, c: number) => void;
|
|
917
|
+
readonly oauthRefreshRequest: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => void;
|
|
918
|
+
readonly oauthRevokeRequest: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
919
|
+
readonly oauthScopes: (a: number) => void;
|
|
408
920
|
readonly parseAction: (a: number, b: number, c: number, d: number) => void;
|
|
409
921
|
readonly parseAppToken: (a: number, b: number, c: number, d: number) => void;
|
|
922
|
+
readonly parseCategories: (a: number, b: number, c: number, d: number) => void;
|
|
410
923
|
readonly parseChannel: (a: number, b: number, c: number, d: number) => void;
|
|
411
924
|
readonly parseChannelUser: (a: number, b: number, c: number, d: number) => void;
|
|
412
925
|
readonly parseChannels: (a: number, b: number, c: number, d: number) => void;
|
|
413
926
|
readonly parseConnection: (a: number, b: number, c: number, d: number) => void;
|
|
414
927
|
readonly parseContent: (a: number, b: number, c: number, d: number) => void;
|
|
928
|
+
readonly parseDone: (a: number, b: number, c: number, d: number) => void;
|
|
415
929
|
readonly parseEvent: (a: number, b: number, c: number, d: number) => void;
|
|
416
930
|
readonly parseHistory: (a: number, b: number, c: number, d: number) => void;
|
|
931
|
+
readonly parseKicksLeaderboard: (a: number, b: number, c: number, d: number) => void;
|
|
932
|
+
readonly parseLivestreamStats: (a: number, b: number, c: number, d: number) => void;
|
|
417
933
|
readonly parseLivestreams: (a: number, b: number, c: number, d: number) => void;
|
|
934
|
+
readonly parseLivestreamsPage: (a: number, b: number, c: number, d: number) => void;
|
|
418
935
|
readonly parseMe: (a: number, b: number, c: number, d: number) => void;
|
|
419
936
|
readonly parsePublicKey: (a: number, b: number, c: number, d: number) => void;
|
|
420
937
|
readonly parseSubscriptions: (a: number, b: number, c: number, d: number) => void;
|
|
421
938
|
readonly parseToken: (a: number, b: number, c: number, d: number) => void;
|
|
939
|
+
readonly parseUsers: (a: number, b: number, c: number, d: number) => void;
|
|
422
940
|
readonly parseWebhook: (a: number, b: number, c: number, d: number) => void;
|
|
423
941
|
readonly pinRequest: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => void;
|
|
424
942
|
readonly publicKeyRequest: (a: number, b: number) => void;
|
|
425
943
|
readonly retryAfterMs: (a: number, b: number) => void;
|
|
944
|
+
readonly rewardsAcceptRequest: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
945
|
+
readonly rewardsCreateRequest: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
946
|
+
readonly rewardsDeleteRequest: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
947
|
+
readonly rewardsListRequest: (a: number, b: number, c: number, d: number) => void;
|
|
948
|
+
readonly rewardsParseFailures: (a: number, b: number, c: number, d: number) => void;
|
|
949
|
+
readonly rewardsParseRedemptions: (a: number, b: number, c: number, d: number) => void;
|
|
950
|
+
readonly rewardsParseReward: (a: number, b: number, c: number, d: number) => void;
|
|
951
|
+
readonly rewardsParseRewards: (a: number, b: number, c: number, d: number) => void;
|
|
952
|
+
readonly rewardsRedemptionsByIdsRequest: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
|
|
953
|
+
readonly rewardsRedemptionsRequest: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => void;
|
|
954
|
+
readonly rewardsRejectRequest: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
955
|
+
readonly rewardsUpdateRequest: (a: number, b: number, c: number, d: number, e: number, f: number, g: number) => void;
|
|
426
956
|
readonly sendRequest: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number, j: number) => void;
|
|
427
957
|
readonly session_closed: (a: number, b: number) => void;
|
|
428
958
|
readonly session_deadline: (a: number, b: number) => void;
|
|
@@ -437,10 +967,10 @@ export interface InitOutput {
|
|
|
437
967
|
readonly subscriptionsRequest: (a: number, b: number, c: number, d: number) => void;
|
|
438
968
|
readonly timeoutRequest: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => void;
|
|
439
969
|
readonly tokenRequest: (a: number, b: number, c: number, d: number) => void;
|
|
440
|
-
readonly topLivestreamsRequest: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number, i: number) => void;
|
|
441
970
|
readonly unbanRequest: (a: number, b: number, c: number, d: number, e: number, f: number, g: number, h: number) => void;
|
|
442
971
|
readonly unpinRequest: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
443
972
|
readonly unsubscribeRequests: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
973
|
+
readonly usersRequest: (a: number, b: number, c: number, d: number, e: number) => void;
|
|
444
974
|
readonly verifyWebhook: (a: number, b: number, c: number, d: number, e: number, f: number) => void;
|
|
445
975
|
readonly webhookpublickey_new: (a: number, b: number, c: number) => void;
|
|
446
976
|
readonly webhookpublickey_verify: (a: number, b: number, c: number, d: number, e: number) => void;
|