kicksdk-js 0.1.1 → 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/pkg/kicksdk.js CHANGED
@@ -1,7 +1,8 @@
1
1
  /* @ts-self-types="./kicksdk.d.ts" */
2
2
 
3
3
  /**
4
- * Reconnect delays: 1 s doubling to 30 s.
4
+ * Reconnect delays: 1 s doubling to 30 s, and a slower stage for terminal
5
+ * closes (`nextDelayFor`).
5
6
  */
6
7
  export class Backoff {
7
8
  __destroy_into_raw() {
@@ -15,15 +16,77 @@ export class Backoff {
15
16
  wasm.__wbg_backoff_free(ptr, 0);
16
17
  }
17
18
  /**
18
- * From `initialMs`, doubling to `maxMs`.
19
+ * From `initialMs`, doubling to `maxMs` (whole milliseconds).
19
20
  * @param {number | null} [initial_ms]
20
21
  * @param {number | null} [max_ms]
21
22
  */
22
23
  constructor(initial_ms, max_ms) {
23
- const ret = wasm.backoff_new(!isLikeNone(initial_ms), isLikeNone(initial_ms) ? 0 : initial_ms, !isLikeNone(max_ms), isLikeNone(max_ms) ? 0 : max_ms);
24
- this.__wbg_ptr = ret;
25
- BackoffFinalization.register(this, this.__wbg_ptr, this);
26
- return this;
24
+ try {
25
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
26
+ wasm.backoff_new(retptr, isLikeNone(initial_ms) ? 0 : addHeapObject(initial_ms), isLikeNone(max_ms) ? 0 : addHeapObject(max_ms));
27
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
28
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
29
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
30
+ if (r2) {
31
+ throw takeObject(r1);
32
+ }
33
+ this.__wbg_ptr = r0;
34
+ BackoffFinalization.register(this, this.__wbg_ptr, this);
35
+ return this;
36
+ } finally {
37
+ wasm.__wbindgen_add_to_stack_pointer(16);
38
+ }
39
+ }
40
+ /**
41
+ * The wait before reconnecting after a connection ended, ms.
42
+ * `retryAfterMs` is what the end asked for: a `close` action's
43
+ * `retry_after_ms`, `retryAfterMs(code)` for a socket's close code, or 0
44
+ * for a failure without a code. With 0, exactly `nextDelayJittered`.
45
+ * With more (a terminal close), at least that, doubling with each
46
+ * terminal close since `reset()` up to six times it (300000: 5, 10, 20,
47
+ * then 30 minutes), plus up to a quarter more by `random`. Reconnect
48
+ * with a new client id after a terminal close.
49
+ * @param {number} retry_after_ms
50
+ * @param {number} random
51
+ * @returns {number}
52
+ */
53
+ nextDelayFor(retry_after_ms, random) {
54
+ try {
55
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
56
+ wasm.backoff_nextDelayFor(retptr, this.__wbg_ptr, addHeapObject(retry_after_ms), addHeapObject(random));
57
+ var r0 = getDataViewMemory0().getFloat64(retptr + 8 * 0, true);
58
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
59
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
60
+ if (r3) {
61
+ throw takeObject(r2);
62
+ }
63
+ return r0;
64
+ } finally {
65
+ wasm.__wbindgen_add_to_stack_pointer(16);
66
+ }
67
+ }
68
+ /**
69
+ * The next wait, ms, spread over [half of it, all of it] by `random`,
70
+ * drawn uniformly from [0, 1) (`Math.random()`), so that clients dropped
71
+ * together do not all come back together. Out of range is clamped, NaN
72
+ * taken as 0.
73
+ * @param {number} random
74
+ * @returns {number}
75
+ */
76
+ nextDelayJittered(random) {
77
+ try {
78
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
79
+ wasm.backoff_nextDelayJittered(retptr, this.__wbg_ptr, addHeapObject(random));
80
+ var r0 = getDataViewMemory0().getFloat64(retptr + 8 * 0, true);
81
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
82
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
83
+ if (r3) {
84
+ throw takeObject(r2);
85
+ }
86
+ return r0;
87
+ } finally {
88
+ wasm.__wbindgen_add_to_stack_pointer(16);
89
+ }
27
90
  }
28
91
  /**
29
92
  * The next wait, ms.
@@ -34,7 +97,8 @@ export class Backoff {
34
97
  return ret;
35
98
  }
36
99
  /**
37
- * A connection worked.
100
+ * The chat feed subscribed: back to the first wait, and the terminal
101
+ * streak ends.
38
102
  */
39
103
  reset() {
40
104
  wasm.backoff_reset(this.__wbg_ptr);
@@ -44,6 +108,8 @@ if (Symbol.dispose) Backoff.prototype[Symbol.dispose] = Backoff.prototype.free;
44
108
 
45
109
  /**
46
110
  * One connection's protocol. Each method returns the actions to carry out.
111
+ * `now` is whole milliseconds from a clock that only goes forward
112
+ * (`Math.floor(performance.now())`, or `Date.now()`).
47
113
  */
48
114
  export class Session {
49
115
  __destroy_into_raw() {
@@ -61,19 +127,34 @@ export class Session {
61
127
  * @returns {any}
62
128
  */
63
129
  closed() {
64
- const ret = wasm.session_closed(this.__wbg_ptr);
65
- if (ret[2]) {
66
- throw takeFromExternrefTable0(ret[1]);
130
+ try {
131
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
132
+ wasm.session_closed(retptr, this.__wbg_ptr);
133
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
134
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
135
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
136
+ if (r2) {
137
+ throw takeObject(r1);
138
+ }
139
+ return takeObject(r0);
140
+ } finally {
141
+ wasm.__wbindgen_add_to_stack_pointer(16);
67
142
  }
68
- return takeFromExternrefTable0(ret[0]);
69
143
  }
70
144
  /**
71
145
  * When to call `tick` next, in ms, or undefined.
72
146
  * @returns {number | undefined}
73
147
  */
74
148
  deadline() {
75
- const ret = wasm.session_deadline(this.__wbg_ptr);
76
- return ret[0] === 0 ? undefined : ret[1];
149
+ try {
150
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
151
+ wasm.session_deadline(retptr, this.__wbg_ptr);
152
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
153
+ var r2 = getDataViewMemory0().getFloat64(retptr + 8 * 1, true);
154
+ return r0 === 0 ? undefined : r2;
155
+ } finally {
156
+ wasm.__wbindgen_add_to_stack_pointer(16);
157
+ }
77
158
  }
78
159
  /**
79
160
  * Whether Kick accepted the connection.
@@ -89,7 +170,7 @@ export class Session {
89
170
  * @returns {boolean}
90
171
  */
91
172
  isSubscribed(channel) {
92
- const ptr0 = passStringToWasm0(channel, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
173
+ const ptr0 = passStringToWasm0(channel, wasm.__wbindgen_export, wasm.__wbindgen_export2);
93
174
  const len0 = WASM_VECTOR_LEN;
94
175
  const ret = wasm.session_isSubscribed(this.__wbg_ptr, ptr0, len0);
95
176
  return ret !== 0;
@@ -99,7 +180,7 @@ export class Session {
99
180
  * @param {string[]} channels
100
181
  */
101
182
  constructor(channels) {
102
- const ptr0 = passArrayJsValueToWasm0(channels, wasm.__wbindgen_malloc);
183
+ const ptr0 = passArrayJsValueToWasm0(channels, wasm.__wbindgen_export);
103
184
  const len0 = WASM_VECTOR_LEN;
104
185
  const ret = wasm.session_new(ptr0, len0);
105
186
  this.__wbg_ptr = ret;
@@ -113,13 +194,21 @@ export class Session {
113
194
  * @returns {any}
114
195
  */
115
196
  open(token, now) {
116
- const ptr0 = passStringToWasm0(token, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
117
- const len0 = WASM_VECTOR_LEN;
118
- const ret = wasm.session_open(this.__wbg_ptr, ptr0, len0, now);
119
- if (ret[2]) {
120
- throw takeFromExternrefTable0(ret[1]);
197
+ try {
198
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
199
+ const ptr0 = passStringToWasm0(token, wasm.__wbindgen_export, wasm.__wbindgen_export2);
200
+ const len0 = WASM_VECTOR_LEN;
201
+ wasm.session_open(retptr, this.__wbg_ptr, ptr0, len0, addHeapObject(now));
202
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
203
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
204
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
205
+ if (r2) {
206
+ throw takeObject(r1);
207
+ }
208
+ return takeObject(r0);
209
+ } finally {
210
+ wasm.__wbindgen_add_to_stack_pointer(16);
121
211
  }
122
- return takeFromExternrefTable0(ret[0]);
123
212
  }
124
213
  /**
125
214
  * A text frame arrived.
@@ -128,13 +217,21 @@ export class Session {
128
217
  * @returns {any}
129
218
  */
130
219
  receive(text, now) {
131
- const ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
132
- const len0 = WASM_VECTOR_LEN;
133
- const ret = wasm.session_receive(this.__wbg_ptr, ptr0, len0, now);
134
- if (ret[2]) {
135
- throw takeFromExternrefTable0(ret[1]);
220
+ try {
221
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
222
+ const ptr0 = passStringToWasm0(text, wasm.__wbindgen_export, wasm.__wbindgen_export2);
223
+ const len0 = WASM_VECTOR_LEN;
224
+ wasm.session_receive(retptr, this.__wbg_ptr, ptr0, len0, addHeapObject(now));
225
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
226
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
227
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
228
+ if (r2) {
229
+ throw takeObject(r1);
230
+ }
231
+ return takeObject(r0);
232
+ } finally {
233
+ wasm.__wbindgen_add_to_stack_pointer(16);
136
234
  }
137
- return takeFromExternrefTable0(ret[0]);
138
235
  }
139
236
  /**
140
237
  * A new token, after a `refresh_token` action.
@@ -143,13 +240,21 @@ export class Session {
143
240
  * @returns {any}
144
241
  */
145
242
  refresh(token, now) {
146
- const ptr0 = passStringToWasm0(token, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
147
- const len0 = WASM_VECTOR_LEN;
148
- const ret = wasm.session_refresh(this.__wbg_ptr, ptr0, len0, now);
149
- if (ret[2]) {
150
- throw takeFromExternrefTable0(ret[1]);
243
+ try {
244
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
245
+ const ptr0 = passStringToWasm0(token, wasm.__wbindgen_export, wasm.__wbindgen_export2);
246
+ const len0 = WASM_VECTOR_LEN;
247
+ wasm.session_refresh(retptr, this.__wbg_ptr, ptr0, len0, addHeapObject(now));
248
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
249
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
250
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
251
+ if (r2) {
252
+ throw takeObject(r1);
253
+ }
254
+ return takeObject(r0);
255
+ } finally {
256
+ wasm.__wbindgen_add_to_stack_pointer(16);
151
257
  }
152
- return takeFromExternrefTable0(ret[0]);
153
258
  }
154
259
  /**
155
260
  * The clock reached `deadline()`.
@@ -157,32 +262,237 @@ export class Session {
157
262
  * @returns {any}
158
263
  */
159
264
  tick(now) {
160
- const ret = wasm.session_tick(this.__wbg_ptr, now);
161
- if (ret[2]) {
162
- throw takeFromExternrefTable0(ret[1]);
265
+ try {
266
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
267
+ wasm.session_tick(retptr, this.__wbg_ptr, addHeapObject(now));
268
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
269
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
270
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
271
+ if (r2) {
272
+ throw takeObject(r1);
273
+ }
274
+ return takeObject(r0);
275
+ } finally {
276
+ wasm.__wbindgen_add_to_stack_pointer(16);
163
277
  }
164
- return takeFromExternrefTable0(ret[0]);
165
278
  }
166
279
  }
167
280
  if (Symbol.dispose) Session.prototype[Symbol.dispose] = Session.prototype.free;
168
281
 
282
+ /**
283
+ * Kick's webhook key, read once: `new WebhookPublicKey(pem)`, then
284
+ * `key.verify(headers, body, options?)` for each delivery.
285
+ */
286
+ export class WebhookPublicKey {
287
+ __destroy_into_raw() {
288
+ const ptr = this.__wbg_ptr;
289
+ this.__wbg_ptr = 0;
290
+ WebhookPublicKeyFinalization.unregister(this);
291
+ return ptr;
292
+ }
293
+ free() {
294
+ const ptr = this.__destroy_into_raw();
295
+ wasm.__wbg_webhookpublickey_free(ptr, 0);
296
+ }
297
+ /**
298
+ * Reads a PEM key (`BEGIN PUBLIC KEY`, as Kick serves it, or
299
+ * `BEGIN RSA PUBLIC KEY`); throws if it is not one.
300
+ * @param {string} pem
301
+ */
302
+ constructor(pem) {
303
+ try {
304
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
305
+ const ptr0 = passStringToWasm0(pem, wasm.__wbindgen_export, wasm.__wbindgen_export2);
306
+ const len0 = WASM_VECTOR_LEN;
307
+ wasm.webhookpublickey_new(retptr, ptr0, len0);
308
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
309
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
310
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
311
+ if (r2) {
312
+ throw takeObject(r1);
313
+ }
314
+ this.__wbg_ptr = r0;
315
+ WebhookPublicKeyFinalization.register(this, this.__wbg_ptr, this);
316
+ return this;
317
+ } finally {
318
+ wasm.__wbindgen_add_to_stack_pointer(16);
319
+ }
320
+ }
321
+ /**
322
+ * `verifyWebhook`, with this key.
323
+ * @param {WebhookHeaders} headers
324
+ * @param {string | Uint8Array | ArrayBuffer} body
325
+ * @param {VerifyOptions | null} [options]
326
+ * @returns {VerifiedWebhook}
327
+ */
328
+ verify(headers, body, options) {
329
+ try {
330
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
331
+ wasm.webhookpublickey_verify(retptr, this.__wbg_ptr, addHeapObject(headers), addHeapObject(body), isLikeNone(options) ? 0 : addHeapObject(options));
332
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
333
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
334
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
335
+ if (r2) {
336
+ throw takeObject(r1);
337
+ }
338
+ return takeObject(r0);
339
+ } finally {
340
+ wasm.__wbindgen_add_to_stack_pointer(16);
341
+ }
342
+ }
343
+ }
344
+ if (Symbol.dispose) WebhookPublicKey.prototype[Symbol.dispose] = WebhookPublicKey.prototype.free;
345
+
346
+ /**
347
+ * Starts an ad break of 7 to 90 `seconds`; `id` is a UUID you make up
348
+ * (`crypto.randomUUID()`).
349
+ * @param {string} token
350
+ * @param {string} id
351
+ * @param {number} seconds
352
+ * @param {Endpoints | null} [endpoints]
353
+ * @returns {HttpRequest}
354
+ */
355
+ export function adsAdBreakRequest(token, id, seconds, endpoints) {
356
+ try {
357
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
358
+ const ptr0 = passStringToWasm0(token, wasm.__wbindgen_export, wasm.__wbindgen_export2);
359
+ const len0 = WASM_VECTOR_LEN;
360
+ const ptr1 = passStringToWasm0(id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
361
+ const len1 = WASM_VECTOR_LEN;
362
+ wasm.adsAdBreakRequest(retptr, ptr0, len0, ptr1, len1, addHeapObject(seconds), isLikeNone(endpoints) ? 0 : addHeapObject(endpoints));
363
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
364
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
365
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
366
+ if (r2) {
367
+ throw takeObject(r1);
368
+ }
369
+ return takeObject(r0);
370
+ } finally {
371
+ wasm.__wbindgen_add_to_stack_pointer(16);
372
+ }
373
+ }
374
+
375
+ /**
376
+ * Enrolls the channel in ads; `parseDone` reads the answer.
377
+ * @param {string} token
378
+ * @param {Endpoints | null} [endpoints]
379
+ * @returns {HttpRequest}
380
+ */
381
+ export function adsEnrollRequest(token, endpoints) {
382
+ try {
383
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
384
+ const ptr0 = passStringToWasm0(token, wasm.__wbindgen_export, wasm.__wbindgen_export2);
385
+ const len0 = WASM_VECTOR_LEN;
386
+ wasm.adsEnrollRequest(retptr, ptr0, len0, isLikeNone(endpoints) ? 0 : addHeapObject(endpoints));
387
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
388
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
389
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
390
+ if (r2) {
391
+ throw takeObject(r1);
392
+ }
393
+ return takeObject(r0);
394
+ } finally {
395
+ wasm.__wbindgen_add_to_stack_pointer(16);
396
+ }
397
+ }
398
+
399
+ /**
400
+ * Reads an `adsAdBreakRequest` answer.
401
+ * @param {number} status
402
+ * @param {string} body
403
+ * @returns {AdBreak}
404
+ */
405
+ export function adsParseAdBreak(status, body) {
406
+ try {
407
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
408
+ const ptr0 = passStringToWasm0(body, wasm.__wbindgen_export, wasm.__wbindgen_export2);
409
+ const len0 = WASM_VECTOR_LEN;
410
+ wasm.adsParseAdBreak(retptr, addHeapObject(status), ptr0, len0);
411
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
412
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
413
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
414
+ if (r2) {
415
+ throw takeObject(r1);
416
+ }
417
+ return takeObject(r0);
418
+ } finally {
419
+ wasm.__wbindgen_add_to_stack_pointer(16);
420
+ }
421
+ }
422
+
423
+ /**
424
+ * Reads an `adsStatusRequest` answer.
425
+ * @param {number} status
426
+ * @param {string} body
427
+ * @returns {AdStatus}
428
+ */
429
+ export function adsParseStatus(status, body) {
430
+ try {
431
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
432
+ const ptr0 = passStringToWasm0(body, wasm.__wbindgen_export, wasm.__wbindgen_export2);
433
+ const len0 = WASM_VECTOR_LEN;
434
+ wasm.adsParseStatus(retptr, addHeapObject(status), ptr0, len0);
435
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
436
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
437
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
438
+ if (r2) {
439
+ throw takeObject(r1);
440
+ }
441
+ return takeObject(r0);
442
+ } finally {
443
+ wasm.__wbindgen_add_to_stack_pointer(16);
444
+ }
445
+ }
446
+
447
+ /**
448
+ * The channel's ads: enrolled or not, limits, recent ad breaks.
449
+ * @param {string} token
450
+ * @param {Endpoints | null} [endpoints]
451
+ * @returns {HttpRequest}
452
+ */
453
+ export function adsStatusRequest(token, endpoints) {
454
+ try {
455
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
456
+ const ptr0 = passStringToWasm0(token, wasm.__wbindgen_export, wasm.__wbindgen_export2);
457
+ const len0 = WASM_VECTOR_LEN;
458
+ wasm.adsStatusRequest(retptr, ptr0, len0, isLikeNone(endpoints) ? 0 : addHeapObject(endpoints));
459
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
460
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
461
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
462
+ if (r2) {
463
+ throw takeObject(r1);
464
+ }
465
+ return takeObject(r0);
466
+ } finally {
467
+ wasm.__wbindgen_add_to_stack_pointer(16);
468
+ }
469
+ }
470
+
169
471
  /**
170
472
  * An app token request (client credentials).
171
473
  * @param {string} client_id
172
474
  * @param {string} client_secret
173
- * @param {any} endpoints_
475
+ * @param {Endpoints | null} [endpoints]
174
476
  * @returns {any}
175
477
  */
176
- export function appTokenRequest(client_id, client_secret, endpoints_) {
177
- const ptr0 = passStringToWasm0(client_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
178
- const len0 = WASM_VECTOR_LEN;
179
- const ptr1 = passStringToWasm0(client_secret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
180
- const len1 = WASM_VECTOR_LEN;
181
- const ret = wasm.appTokenRequest(ptr0, len0, ptr1, len1, endpoints_);
182
- if (ret[2]) {
183
- throw takeFromExternrefTable0(ret[1]);
478
+ export function appTokenRequest(client_id, client_secret, endpoints) {
479
+ try {
480
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
481
+ const ptr0 = passStringToWasm0(client_id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
482
+ const len0 = WASM_VECTOR_LEN;
483
+ const ptr1 = passStringToWasm0(client_secret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
484
+ const len1 = WASM_VECTOR_LEN;
485
+ wasm.appTokenRequest(retptr, ptr0, len0, ptr1, len1, isLikeNone(endpoints) ? 0 : addHeapObject(endpoints));
486
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
487
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
488
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
489
+ if (r2) {
490
+ throw takeObject(r1);
491
+ }
492
+ return takeObject(r0);
493
+ } finally {
494
+ wasm.__wbindgen_add_to_stack_pointer(16);
184
495
  }
185
- return takeFromExternrefTable0(ret[0]);
186
496
  }
187
497
 
188
498
  /**
@@ -190,94 +500,196 @@ export function appTokenRequest(client_id, client_secret, endpoints_) {
190
500
  * @param {string} session
191
501
  * @param {string} channel_slug
192
502
  * @param {string} username
193
- * @param {any} endpoints_
503
+ * @param {Endpoints | null} [endpoints]
194
504
  * @returns {any}
195
505
  */
196
- export function banRequest(session, channel_slug, username, endpoints_) {
197
- const ptr0 = passStringToWasm0(session, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
198
- const len0 = WASM_VECTOR_LEN;
199
- const ptr1 = passStringToWasm0(channel_slug, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
200
- const len1 = WASM_VECTOR_LEN;
201
- const ptr2 = passStringToWasm0(username, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
202
- const len2 = WASM_VECTOR_LEN;
203
- const ret = wasm.banRequest(ptr0, len0, ptr1, len1, ptr2, len2, endpoints_);
204
- if (ret[2]) {
205
- throw takeFromExternrefTable0(ret[1]);
506
+ export function banRequest(session, channel_slug, username, endpoints) {
507
+ try {
508
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
509
+ const ptr0 = passStringToWasm0(session, wasm.__wbindgen_export, wasm.__wbindgen_export2);
510
+ const len0 = WASM_VECTOR_LEN;
511
+ const ptr1 = passStringToWasm0(channel_slug, wasm.__wbindgen_export, wasm.__wbindgen_export2);
512
+ const len1 = WASM_VECTOR_LEN;
513
+ const ptr2 = passStringToWasm0(username, wasm.__wbindgen_export, wasm.__wbindgen_export2);
514
+ const len2 = WASM_VECTOR_LEN;
515
+ wasm.banRequest(retptr, ptr0, len0, ptr1, len1, ptr2, len2, isLikeNone(endpoints) ? 0 : addHeapObject(endpoints));
516
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
517
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
518
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
519
+ if (r2) {
520
+ throw takeObject(r1);
521
+ }
522
+ return takeObject(r0);
523
+ } finally {
524
+ wasm.__wbindgen_add_to_stack_pointer(16);
525
+ }
526
+ }
527
+
528
+ /**
529
+ * One page of categories (`/public/v2/categories`): by `names` and `tags`
530
+ * (no commas in them), or by `ids`; none of them, all. `limit` is 1 to 1000
531
+ * (Kick's default 25); `cursor` is the previous page's `next_cursor`.
532
+ * @param {string} token
533
+ * @param {readonly string[] | null} [names]
534
+ * @param {readonly string[] | null} [tags]
535
+ * @param {readonly number[] | null} [ids]
536
+ * @param {number | null} [limit]
537
+ * @param {string | null} [cursor]
538
+ * @param {Endpoints | null} [endpoints]
539
+ * @returns {HttpRequest}
540
+ */
541
+ export function categoriesRequest(token, names, tags, ids, limit, cursor, endpoints) {
542
+ try {
543
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
544
+ const ptr0 = passStringToWasm0(token, wasm.__wbindgen_export, wasm.__wbindgen_export2);
545
+ const len0 = WASM_VECTOR_LEN;
546
+ var ptr1 = isLikeNone(cursor) ? 0 : passStringToWasm0(cursor, wasm.__wbindgen_export, wasm.__wbindgen_export2);
547
+ var len1 = WASM_VECTOR_LEN;
548
+ wasm.categoriesRequest(retptr, ptr0, len0, isLikeNone(names) ? 0 : addHeapObject(names), isLikeNone(tags) ? 0 : addHeapObject(tags), isLikeNone(ids) ? 0 : addHeapObject(ids), isLikeNone(limit) ? 0 : addHeapObject(limit), ptr1, len1, isLikeNone(endpoints) ? 0 : addHeapObject(endpoints));
549
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
550
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
551
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
552
+ if (r2) {
553
+ throw takeObject(r1);
554
+ }
555
+ return takeObject(r0);
556
+ } finally {
557
+ wasm.__wbindgen_add_to_stack_pointer(16);
206
558
  }
207
- return takeFromExternrefTable0(ret[0]);
208
559
  }
209
560
 
210
561
  /**
211
562
  * A channel by slug (`kick.com/api/v2`): chatroom id, followers, live state.
212
563
  * @param {string} slug
213
- * @param {any} endpoints_
564
+ * @param {Endpoints | null} [endpoints]
214
565
  * @returns {any}
215
566
  */
216
- export function channelRequest(slug, endpoints_) {
217
- const ptr0 = passStringToWasm0(slug, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
218
- const len0 = WASM_VECTOR_LEN;
219
- const ret = wasm.channelRequest(ptr0, len0, endpoints_);
220
- if (ret[2]) {
221
- throw takeFromExternrefTable0(ret[1]);
567
+ export function channelRequest(slug, endpoints) {
568
+ try {
569
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
570
+ const ptr0 = passStringToWasm0(slug, wasm.__wbindgen_export, wasm.__wbindgen_export2);
571
+ const len0 = WASM_VECTOR_LEN;
572
+ wasm.channelRequest(retptr, ptr0, len0, isLikeNone(endpoints) ? 0 : addHeapObject(endpoints));
573
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
574
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
575
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
576
+ if (r2) {
577
+ throw takeObject(r1);
578
+ }
579
+ return takeObject(r0);
580
+ } finally {
581
+ wasm.__wbindgen_add_to_stack_pointer(16);
222
582
  }
223
- return takeFromExternrefTable0(ret[0]);
224
583
  }
225
584
 
226
585
  /**
227
586
  * A user as a channel sees them.
228
587
  * @param {string} channel_slug
229
588
  * @param {string} username
230
- * @param {any} endpoints_
589
+ * @param {Endpoints | null} [endpoints]
231
590
  * @returns {any}
232
591
  */
233
- export function channelUserRequest(channel_slug, username, endpoints_) {
234
- const ptr0 = passStringToWasm0(channel_slug, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
235
- const len0 = WASM_VECTOR_LEN;
236
- const ptr1 = passStringToWasm0(username, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
237
- const len1 = WASM_VECTOR_LEN;
238
- const ret = wasm.channelUserRequest(ptr0, len0, ptr1, len1, endpoints_);
239
- if (ret[2]) {
240
- throw takeFromExternrefTable0(ret[1]);
592
+ export function channelUserRequest(channel_slug, username, endpoints) {
593
+ try {
594
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
595
+ const ptr0 = passStringToWasm0(channel_slug, wasm.__wbindgen_export, wasm.__wbindgen_export2);
596
+ const len0 = WASM_VECTOR_LEN;
597
+ const ptr1 = passStringToWasm0(username, wasm.__wbindgen_export, wasm.__wbindgen_export2);
598
+ const len1 = WASM_VECTOR_LEN;
599
+ wasm.channelUserRequest(retptr, ptr0, len0, ptr1, len1, isLikeNone(endpoints) ? 0 : addHeapObject(endpoints));
600
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
601
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
602
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
603
+ if (r2) {
604
+ throw takeObject(r1);
605
+ }
606
+ return takeObject(r0);
607
+ } finally {
608
+ wasm.__wbindgen_add_to_stack_pointer(16);
241
609
  }
242
- return takeFromExternrefTable0(ret[0]);
243
610
  }
244
611
 
245
612
  /**
246
613
  * `/channels` for up to 50 user ids.
247
614
  * @param {string} token
248
- * @param {Float64Array} user_ids
249
- * @param {any} endpoints_
615
+ * @param {readonly number[]} user_ids
616
+ * @param {Endpoints | null} [endpoints]
250
617
  * @returns {any}
251
618
  */
252
- export function channelsByIdsRequest(token, user_ids, endpoints_) {
253
- const ptr0 = passStringToWasm0(token, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
254
- const len0 = WASM_VECTOR_LEN;
255
- const ptr1 = passArrayF64ToWasm0(user_ids, wasm.__wbindgen_malloc);
256
- const len1 = WASM_VECTOR_LEN;
257
- const ret = wasm.channelsByIdsRequest(ptr0, len0, ptr1, len1, endpoints_);
258
- if (ret[2]) {
259
- throw takeFromExternrefTable0(ret[1]);
619
+ export function channelsByIdsRequest(token, user_ids, endpoints) {
620
+ try {
621
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
622
+ const ptr0 = passStringToWasm0(token, wasm.__wbindgen_export, wasm.__wbindgen_export2);
623
+ const len0 = WASM_VECTOR_LEN;
624
+ wasm.channelsByIdsRequest(retptr, ptr0, len0, addHeapObject(user_ids), isLikeNone(endpoints) ? 0 : addHeapObject(endpoints));
625
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
626
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
627
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
628
+ if (r2) {
629
+ throw takeObject(r1);
630
+ }
631
+ return takeObject(r0);
632
+ } finally {
633
+ wasm.__wbindgen_add_to_stack_pointer(16);
260
634
  }
261
- return takeFromExternrefTable0(ret[0]);
262
635
  }
263
636
 
264
637
  /**
265
638
  * `/channels` for up to 50 slugs (one unknown slug fails them all).
266
639
  * @param {string} token
267
640
  * @param {string[]} slugs
268
- * @param {any} endpoints_
641
+ * @param {Endpoints | null} [endpoints]
269
642
  * @returns {any}
270
643
  */
271
- export function channelsBySlugsRequest(token, slugs, endpoints_) {
272
- const ptr0 = passStringToWasm0(token, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
273
- const len0 = WASM_VECTOR_LEN;
274
- const ptr1 = passArrayJsValueToWasm0(slugs, wasm.__wbindgen_malloc);
275
- const len1 = WASM_VECTOR_LEN;
276
- const ret = wasm.channelsBySlugsRequest(ptr0, len0, ptr1, len1, endpoints_);
277
- if (ret[2]) {
278
- throw takeFromExternrefTable0(ret[1]);
644
+ export function channelsBySlugsRequest(token, slugs, endpoints) {
645
+ try {
646
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
647
+ const ptr0 = passStringToWasm0(token, wasm.__wbindgen_export, wasm.__wbindgen_export2);
648
+ const len0 = WASM_VECTOR_LEN;
649
+ const ptr1 = passArrayJsValueToWasm0(slugs, wasm.__wbindgen_export);
650
+ const len1 = WASM_VECTOR_LEN;
651
+ wasm.channelsBySlugsRequest(retptr, ptr0, len0, ptr1, len1, isLikeNone(endpoints) ? 0 : addHeapObject(endpoints));
652
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
653
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
654
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
655
+ if (r2) {
656
+ throw takeObject(r1);
657
+ }
658
+ return takeObject(r0);
659
+ } finally {
660
+ wasm.__wbindgen_add_to_stack_pointer(16);
661
+ }
662
+ }
663
+
664
+ /**
665
+ * Sets what is given of the token's channel's category, custom tags (`[]`
666
+ * clears them, up to 10) and stream title. Scope `channel:write`;
667
+ * `parseDone` reads the answer.
668
+ * @param {string} token
669
+ * @param {number | null} [category_id]
670
+ * @param {readonly string[] | null} [custom_tags]
671
+ * @param {string | null} [stream_title]
672
+ * @param {Endpoints | null} [endpoints]
673
+ * @returns {HttpRequest}
674
+ */
675
+ export function channelsUpdateRequest(token, category_id, custom_tags, stream_title, endpoints) {
676
+ try {
677
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
678
+ const ptr0 = passStringToWasm0(token, wasm.__wbindgen_export, wasm.__wbindgen_export2);
679
+ const len0 = WASM_VECTOR_LEN;
680
+ var ptr1 = isLikeNone(stream_title) ? 0 : passStringToWasm0(stream_title, wasm.__wbindgen_export, wasm.__wbindgen_export2);
681
+ var len1 = WASM_VECTOR_LEN;
682
+ wasm.channelsUpdateRequest(retptr, ptr0, len0, isLikeNone(category_id) ? 0 : addHeapObject(category_id), isLikeNone(custom_tags) ? 0 : addHeapObject(custom_tags), ptr1, len1, isLikeNone(endpoints) ? 0 : addHeapObject(endpoints));
683
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
684
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
685
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
686
+ if (r2) {
687
+ throw takeObject(r1);
688
+ }
689
+ return takeObject(r0);
690
+ } finally {
691
+ wasm.__wbindgen_add_to_stack_pointer(16);
279
692
  }
280
- return takeFromExternrefTable0(ret[0]);
281
693
  }
282
694
 
283
695
  /**
@@ -287,43 +699,156 @@ export function channelsBySlugsRequest(token, slugs, endpoints_) {
287
699
  * @returns {string[]}
288
700
  */
289
701
  export function chatChannels(chatroom_id, channel_id) {
290
- const ret = wasm.chatChannels(chatroom_id, !isLikeNone(channel_id), isLikeNone(channel_id) ? 0 : channel_id);
291
- var v1 = getArrayJsValueFromWasm0(ret[0], ret[1]);
292
- wasm.__wbindgen_free(ret[0], ret[1] * 4, 4);
293
- return v1;
702
+ try {
703
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
704
+ wasm.chatChannels(retptr, addHeapObject(chatroom_id), isLikeNone(channel_id) ? 0 : addHeapObject(channel_id));
705
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
706
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
707
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
708
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
709
+ if (r3) {
710
+ throw takeObject(r2);
711
+ }
712
+ var v1 = getArrayJsValueFromWasm0(r0, r1);
713
+ wasm.__wbindgen_export4(r0, r1 * 4, 4);
714
+ return v1;
715
+ } finally {
716
+ wasm.__wbindgen_add_to_stack_pointer(16);
717
+ }
294
718
  }
295
719
 
296
720
  /**
297
721
  * Where a channel's chat is served.
298
722
  * @param {number} channel_id
299
723
  * @param {string} client_id
300
- * @param {any} endpoints_
724
+ * @param {Endpoints | null} [endpoints]
301
725
  * @returns {any}
302
726
  */
303
- export function chatConnectionRequest(channel_id, client_id, endpoints_) {
304
- const ptr0 = passStringToWasm0(client_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
305
- const len0 = WASM_VECTOR_LEN;
306
- const ret = wasm.chatConnectionRequest(channel_id, ptr0, len0, endpoints_);
307
- if (ret[2]) {
308
- throw takeFromExternrefTable0(ret[1]);
727
+ export function chatConnectionRequest(channel_id, client_id, endpoints) {
728
+ try {
729
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
730
+ const ptr0 = passStringToWasm0(client_id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
731
+ const len0 = WASM_VECTOR_LEN;
732
+ wasm.chatConnectionRequest(retptr, addHeapObject(channel_id), ptr0, len0, isLikeNone(endpoints) ? 0 : addHeapObject(endpoints));
733
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
734
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
735
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
736
+ if (r2) {
737
+ throw takeObject(r1);
738
+ }
739
+ return takeObject(r0);
740
+ } finally {
741
+ wasm.__wbindgen_add_to_stack_pointer(16);
742
+ }
743
+ }
744
+
745
+ /**
746
+ * Deletes a message by id. Scope `moderation:chat_message:manage`;
747
+ * `parseDone` reads the answer.
748
+ * @param {string} token
749
+ * @param {string} message_id
750
+ * @param {Endpoints | null} [endpoints]
751
+ * @returns {HttpRequest}
752
+ */
753
+ export function chatDeleteRequest(token, message_id, endpoints) {
754
+ try {
755
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
756
+ const ptr0 = passStringToWasm0(token, wasm.__wbindgen_export, wasm.__wbindgen_export2);
757
+ const len0 = WASM_VECTOR_LEN;
758
+ const ptr1 = passStringToWasm0(message_id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
759
+ const len1 = WASM_VECTOR_LEN;
760
+ wasm.chatDeleteRequest(retptr, ptr0, len0, ptr1, len1, isLikeNone(endpoints) ? 0 : addHeapObject(endpoints));
761
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
762
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
763
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
764
+ if (r2) {
765
+ throw takeObject(r1);
766
+ }
767
+ return takeObject(r0);
768
+ } finally {
769
+ wasm.__wbindgen_add_to_stack_pointer(16);
770
+ }
771
+ }
772
+
773
+ /**
774
+ * Reads a `chatSendRequest` answer.
775
+ * @param {number} status
776
+ * @param {string} body
777
+ * @returns {Sent}
778
+ */
779
+ export function chatParseSend(status, body) {
780
+ try {
781
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
782
+ const ptr0 = passStringToWasm0(body, wasm.__wbindgen_export, wasm.__wbindgen_export2);
783
+ const len0 = WASM_VECTOR_LEN;
784
+ wasm.chatParseSend(retptr, addHeapObject(status), ptr0, len0);
785
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
786
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
787
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
788
+ if (r2) {
789
+ throw takeObject(r1);
790
+ }
791
+ return takeObject(r0);
792
+ } finally {
793
+ wasm.__wbindgen_add_to_stack_pointer(16);
794
+ }
795
+ }
796
+
797
+ /**
798
+ * Sends `content` as the token's user into a channel (`{user:
799
+ * broadcasterUserId}`) or as the app's bot (`'bot'`), as a reply if
800
+ * `replyToMessageId` is given. Scope `chat:write`.
801
+ * @param {string} token
802
+ * @param {ChatSender} sender
803
+ * @param {string} content
804
+ * @param {string | null} [reply_to_message_id]
805
+ * @param {Endpoints | null} [endpoints]
806
+ * @returns {HttpRequest}
807
+ */
808
+ export function chatSendRequest(token, sender, content, reply_to_message_id, endpoints) {
809
+ try {
810
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
811
+ const ptr0 = passStringToWasm0(token, wasm.__wbindgen_export, wasm.__wbindgen_export2);
812
+ const len0 = WASM_VECTOR_LEN;
813
+ const ptr1 = passStringToWasm0(content, wasm.__wbindgen_export, wasm.__wbindgen_export2);
814
+ const len1 = WASM_VECTOR_LEN;
815
+ var ptr2 = isLikeNone(reply_to_message_id) ? 0 : passStringToWasm0(reply_to_message_id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
816
+ var len2 = WASM_VECTOR_LEN;
817
+ wasm.chatSendRequest(retptr, ptr0, len0, addHeapObject(sender), ptr1, len1, ptr2, len2, isLikeNone(endpoints) ? 0 : addHeapObject(endpoints));
818
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
819
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
820
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
821
+ if (r2) {
822
+ throw takeObject(r1);
823
+ }
824
+ return takeObject(r0);
825
+ } finally {
826
+ wasm.__wbindgen_add_to_stack_pointer(16);
309
827
  }
310
- return takeFromExternrefTable0(ret[0]);
311
828
  }
312
829
 
313
830
  /**
314
831
  * Where Kick's realtime is served in general.
315
832
  * @param {string} client_id
316
- * @param {any} endpoints_
833
+ * @param {Endpoints | null} [endpoints]
317
834
  * @returns {any}
318
835
  */
319
- export function connectionRequest(client_id, endpoints_) {
320
- const ptr0 = passStringToWasm0(client_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
321
- const len0 = WASM_VECTOR_LEN;
322
- const ret = wasm.connectionRequest(ptr0, len0, endpoints_);
323
- if (ret[2]) {
324
- throw takeFromExternrefTable0(ret[1]);
836
+ export function connectionRequest(client_id, endpoints) {
837
+ try {
838
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
839
+ const ptr0 = passStringToWasm0(client_id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
840
+ const len0 = WASM_VECTOR_LEN;
841
+ wasm.connectionRequest(retptr, ptr0, len0, isLikeNone(endpoints) ? 0 : addHeapObject(endpoints));
842
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
843
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
844
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
845
+ if (r2) {
846
+ throw takeObject(r1);
847
+ }
848
+ return takeObject(r0);
849
+ } finally {
850
+ wasm.__wbindgen_add_to_stack_pointer(16);
325
851
  }
326
- return takeFromExternrefTable0(ret[0]);
327
852
  }
328
853
 
329
854
  /**
@@ -331,19 +856,102 @@ export function connectionRequest(client_id, endpoints_) {
331
856
  * @param {string} session
332
857
  * @param {number} chatroom_id
333
858
  * @param {string} message_id
334
- * @param {any} endpoints_
859
+ * @param {Endpoints | null} [endpoints]
335
860
  * @returns {any}
336
861
  */
337
- export function deleteMessageRequest(session, chatroom_id, message_id, endpoints_) {
338
- const ptr0 = passStringToWasm0(session, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
339
- const len0 = WASM_VECTOR_LEN;
340
- const ptr1 = passStringToWasm0(message_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
341
- const len1 = WASM_VECTOR_LEN;
342
- const ret = wasm.deleteMessageRequest(ptr0, len0, chatroom_id, ptr1, len1, endpoints_);
343
- if (ret[2]) {
344
- throw takeFromExternrefTable0(ret[1]);
862
+ export function deleteMessageRequest(session, chatroom_id, message_id, endpoints) {
863
+ try {
864
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
865
+ const ptr0 = passStringToWasm0(session, wasm.__wbindgen_export, wasm.__wbindgen_export2);
866
+ const len0 = WASM_VECTOR_LEN;
867
+ const ptr1 = passStringToWasm0(message_id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
868
+ const len1 = WASM_VECTOR_LEN;
869
+ wasm.deleteMessageRequest(retptr, ptr0, len0, addHeapObject(chatroom_id), ptr1, len1, isLikeNone(endpoints) ? 0 : addHeapObject(endpoints));
870
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
871
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
872
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
873
+ if (r2) {
874
+ throw takeObject(r1);
875
+ }
876
+ return takeObject(r0);
877
+ } finally {
878
+ wasm.__wbindgen_add_to_stack_pointer(16);
879
+ }
880
+ }
881
+
882
+ /**
883
+ * Drops reward claims, with an **app** token. `filter`: what is left out
884
+ * is not filtered.
885
+ * @param {string} token
886
+ * @param {ClaimFilter | null} [filter]
887
+ * @param {Endpoints | null} [endpoints]
888
+ * @returns {HttpRequest}
889
+ */
890
+ export function dropsClaimsRequest(token, filter, endpoints) {
891
+ try {
892
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
893
+ const ptr0 = passStringToWasm0(token, wasm.__wbindgen_export, wasm.__wbindgen_export2);
894
+ const len0 = WASM_VECTOR_LEN;
895
+ wasm.dropsClaimsRequest(retptr, ptr0, len0, isLikeNone(filter) ? 0 : addHeapObject(filter), isLikeNone(endpoints) ? 0 : addHeapObject(endpoints));
896
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
897
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
898
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
899
+ if (r2) {
900
+ throw takeObject(r1);
901
+ }
902
+ return takeObject(r0);
903
+ } finally {
904
+ wasm.__wbindgen_add_to_stack_pointer(16);
905
+ }
906
+ }
907
+
908
+ /**
909
+ * Reads a `dropsClaimsRequest` answer.
910
+ * @param {number} status
911
+ * @param {string} body
912
+ * @returns {Claims}
913
+ */
914
+ export function dropsParseClaims(status, body) {
915
+ try {
916
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
917
+ const ptr0 = passStringToWasm0(body, wasm.__wbindgen_export, wasm.__wbindgen_export2);
918
+ const len0 = WASM_VECTOR_LEN;
919
+ wasm.dropsParseClaims(retptr, addHeapObject(status), ptr0, len0);
920
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
921
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
922
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
923
+ if (r2) {
924
+ throw takeObject(r1);
925
+ }
926
+ return takeObject(r0);
927
+ } finally {
928
+ wasm.__wbindgen_add_to_stack_pointer(16);
929
+ }
930
+ }
931
+
932
+ /**
933
+ * Sets 1 to 100 claims' `external_status`; `parseDone` reads the answer.
934
+ * @param {string} token
935
+ * @param {readonly ClaimUpdate[]} updates
936
+ * @param {Endpoints | null} [endpoints]
937
+ * @returns {HttpRequest}
938
+ */
939
+ export function dropsUpdateClaimsRequest(token, updates, endpoints) {
940
+ try {
941
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
942
+ const ptr0 = passStringToWasm0(token, wasm.__wbindgen_export, wasm.__wbindgen_export2);
943
+ const len0 = WASM_VECTOR_LEN;
944
+ wasm.dropsUpdateClaimsRequest(retptr, ptr0, len0, addHeapObject(updates), isLikeNone(endpoints) ? 0 : addHeapObject(endpoints));
945
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
946
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
947
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
948
+ if (r2) {
949
+ throw takeObject(r1);
950
+ }
951
+ return takeObject(r0);
952
+ } finally {
953
+ wasm.__wbindgen_add_to_stack_pointer(16);
345
954
  }
346
- return takeFromExternrefTable0(ret[0]);
347
955
  }
348
956
 
349
957
  /**
@@ -352,366 +960,1472 @@ export function deleteMessageRequest(session, chatroom_id, message_id, endpoints
352
960
  * @returns {string}
353
961
  */
354
962
  export function emoteUrl(id) {
355
- let deferred2_0;
356
- let deferred2_1;
963
+ let deferred3_0;
964
+ let deferred3_1;
357
965
  try {
358
- const ptr0 = passStringToWasm0(id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
966
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
967
+ const ptr0 = passStringToWasm0(id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
359
968
  const len0 = WASM_VECTOR_LEN;
360
- const ret = wasm.emoteUrl(ptr0, len0);
361
- deferred2_0 = ret[0];
362
- deferred2_1 = ret[1];
363
- return getStringFromWasm0(ret[0], ret[1]);
969
+ wasm.emoteUrl(retptr, ptr0, len0);
970
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
971
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
972
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
973
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
974
+ var ptr2 = r0;
975
+ var len2 = r1;
976
+ if (r3) {
977
+ ptr2 = 0; len2 = 0;
978
+ throw takeObject(r2);
979
+ }
980
+ deferred3_0 = ptr2;
981
+ deferred3_1 = len2;
982
+ return getStringFromWasm0(ptr2, len2);
364
983
  } finally {
365
- wasm.__wbindgen_free(deferred2_0, deferred2_1, 1);
984
+ wasm.__wbindgen_add_to_stack_pointer(16);
985
+ wasm.__wbindgen_export4(deferred3_0, deferred3_1, 1);
366
986
  }
367
987
  }
368
988
 
369
989
  /**
370
990
  * Recent chat and the pin, by channel id.
371
991
  * @param {number} channel_id
372
- * @param {any} endpoints_
992
+ * @param {Endpoints | null} [endpoints]
373
993
  * @returns {any}
374
994
  */
375
- export function historyRequest(channel_id, endpoints_) {
376
- const ret = wasm.historyRequest(channel_id, endpoints_);
377
- if (ret[2]) {
378
- throw takeFromExternrefTable0(ret[1]);
995
+ export function historyRequest(channel_id, endpoints) {
996
+ try {
997
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
998
+ wasm.historyRequest(retptr, addHeapObject(channel_id), isLikeNone(endpoints) ? 0 : addHeapObject(endpoints));
999
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1000
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1001
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1002
+ if (r2) {
1003
+ throw takeObject(r1);
1004
+ }
1005
+ return takeObject(r0);
1006
+ } finally {
1007
+ wasm.__wbindgen_add_to_stack_pointer(16);
379
1008
  }
380
- return takeFromExternrefTable0(ret[0]);
381
1009
  }
382
1010
 
383
1011
  /**
384
- * `/livestreams` for any number of user ids: one request per 50.
1012
+ * The top `top` Kicks gifters (1 to 100; Kick's default 10) of the token's
1013
+ * own channel. A user token with `kicks:read`.
385
1014
  * @param {string} token
386
- * @param {Float64Array} user_ids
387
- * @param {any} endpoints_
388
- * @returns {any}
1015
+ * @param {number | null} [top]
1016
+ * @param {Endpoints | null} [endpoints]
1017
+ * @returns {HttpRequest}
389
1018
  */
390
- export function livestreamsRequests(token, user_ids, endpoints_) {
391
- const ptr0 = passStringToWasm0(token, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
392
- const len0 = WASM_VECTOR_LEN;
393
- const ptr1 = passArrayF64ToWasm0(user_ids, wasm.__wbindgen_malloc);
394
- const len1 = WASM_VECTOR_LEN;
395
- const ret = wasm.livestreamsRequests(ptr0, len0, ptr1, len1, endpoints_);
396
- if (ret[2]) {
397
- throw takeFromExternrefTable0(ret[1]);
1019
+ export function kicksLeaderboardRequest(token, top, endpoints) {
1020
+ try {
1021
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1022
+ const ptr0 = passStringToWasm0(token, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1023
+ const len0 = WASM_VECTOR_LEN;
1024
+ wasm.kicksLeaderboardRequest(retptr, ptr0, len0, isLikeNone(top) ? 0 : addHeapObject(top), isLikeNone(endpoints) ? 0 : addHeapObject(endpoints));
1025
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1026
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1027
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1028
+ if (r2) {
1029
+ throw takeObject(r1);
1030
+ }
1031
+ return takeObject(r0);
1032
+ } finally {
1033
+ wasm.__wbindgen_add_to_stack_pointer(16);
398
1034
  }
399
- return takeFromExternrefTable0(ret[0]);
400
1035
  }
401
1036
 
402
1037
  /**
403
- * The signed-in viewer's standing on a channel.
404
- * @param {string} session
405
- * @param {string} channel_slug
406
- * @param {any} endpoints_
407
- * @returns {any}
1038
+ * How many streams are live on Kick.
1039
+ * @param {string} token
1040
+ * @param {Endpoints | null} [endpoints]
1041
+ * @returns {HttpRequest}
408
1042
  */
409
- export function meRequest(session, channel_slug, endpoints_) {
410
- const ptr0 = passStringToWasm0(session, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
411
- const len0 = WASM_VECTOR_LEN;
412
- const ptr1 = passStringToWasm0(channel_slug, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
413
- const len1 = WASM_VECTOR_LEN;
414
- const ret = wasm.meRequest(ptr0, len0, ptr1, len1, endpoints_);
415
- if (ret[2]) {
416
- throw takeFromExternrefTable0(ret[1]);
1043
+ export function livestreamStatsRequest(token, endpoints) {
1044
+ try {
1045
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1046
+ const ptr0 = passStringToWasm0(token, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1047
+ const len0 = WASM_VECTOR_LEN;
1048
+ wasm.livestreamStatsRequest(retptr, ptr0, len0, isLikeNone(endpoints) ? 0 : addHeapObject(endpoints));
1049
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1050
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1051
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1052
+ if (r2) {
1053
+ throw takeObject(r1);
1054
+ }
1055
+ return takeObject(r0);
1056
+ } finally {
1057
+ wasm.__wbindgen_add_to_stack_pointer(16);
1058
+ }
1059
+ }
1060
+
1061
+ /**
1062
+ * One page of the streams live now (`/public/v2/livestreams`), in up to 25
1063
+ * categories and 25 languages (none: all). `limit` is 1 to 1000 (Kick's
1064
+ * default 100); `cursor` is the previous page's `next_cursor`. Kick has no
1065
+ * sort: streams come oldest first.
1066
+ * @param {string} token
1067
+ * @param {readonly number[] | null} [category_ids]
1068
+ * @param {readonly string[] | null} [language_codes]
1069
+ * @param {number | null} [limit]
1070
+ * @param {string | null} [cursor]
1071
+ * @param {Endpoints | null} [endpoints]
1072
+ * @returns {any}
1073
+ */
1074
+ export function livestreamsPageRequest(token, category_ids, language_codes, limit, cursor, endpoints) {
1075
+ try {
1076
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1077
+ const ptr0 = passStringToWasm0(token, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1078
+ const len0 = WASM_VECTOR_LEN;
1079
+ var ptr1 = isLikeNone(cursor) ? 0 : passStringToWasm0(cursor, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1080
+ var len1 = WASM_VECTOR_LEN;
1081
+ wasm.livestreamsPageRequest(retptr, ptr0, len0, isLikeNone(category_ids) ? 0 : addHeapObject(category_ids), isLikeNone(language_codes) ? 0 : addHeapObject(language_codes), isLikeNone(limit) ? 0 : addHeapObject(limit), ptr1, len1, isLikeNone(endpoints) ? 0 : addHeapObject(endpoints));
1082
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1083
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1084
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1085
+ if (r2) {
1086
+ throw takeObject(r1);
1087
+ }
1088
+ return takeObject(r0);
1089
+ } finally {
1090
+ wasm.__wbindgen_add_to_stack_pointer(16);
1091
+ }
1092
+ }
1093
+
1094
+ /**
1095
+ * `/public/v1/users/livestreams` for any number of user ids: one request
1096
+ * per 100.
1097
+ * @param {string} token
1098
+ * @param {readonly number[]} user_ids
1099
+ * @param {Endpoints | null} [endpoints]
1100
+ * @returns {any}
1101
+ */
1102
+ export function livestreamsRequests(token, user_ids, endpoints) {
1103
+ try {
1104
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1105
+ const ptr0 = passStringToWasm0(token, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1106
+ const len0 = WASM_VECTOR_LEN;
1107
+ wasm.livestreamsRequests(retptr, ptr0, len0, addHeapObject(user_ids), isLikeNone(endpoints) ? 0 : addHeapObject(endpoints));
1108
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1109
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1110
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1111
+ if (r2) {
1112
+ throw takeObject(r1);
1113
+ }
1114
+ return takeObject(r0);
1115
+ } finally {
1116
+ wasm.__wbindgen_add_to_stack_pointer(16);
1117
+ }
1118
+ }
1119
+
1120
+ /**
1121
+ * The signed-in viewer's standing on a channel.
1122
+ * @param {string} session
1123
+ * @param {string} channel_slug
1124
+ * @param {Endpoints | null} [endpoints]
1125
+ * @returns {any}
1126
+ */
1127
+ export function meRequest(session, channel_slug, endpoints) {
1128
+ try {
1129
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1130
+ const ptr0 = passStringToWasm0(session, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1131
+ const len0 = WASM_VECTOR_LEN;
1132
+ const ptr1 = passStringToWasm0(channel_slug, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1133
+ const len1 = WASM_VECTOR_LEN;
1134
+ wasm.meRequest(retptr, ptr0, len0, ptr1, len1, isLikeNone(endpoints) ? 0 : addHeapObject(endpoints));
1135
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1136
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1137
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1138
+ if (r2) {
1139
+ throw takeObject(r1);
1140
+ }
1141
+ return takeObject(r0);
1142
+ } finally {
1143
+ wasm.__wbindgen_add_to_stack_pointer(16);
1144
+ }
1145
+ }
1146
+
1147
+ /**
1148
+ * Bans a user for good. Scope `moderation:ban`; `parseDone` reads the answer.
1149
+ * @param {string} token
1150
+ * @param {number} broadcaster_user_id
1151
+ * @param {number} user_id
1152
+ * @param {string | null} [reason]
1153
+ * @param {Endpoints | null} [endpoints]
1154
+ * @returns {HttpRequest}
1155
+ */
1156
+ export function moderationBanRequest(token, broadcaster_user_id, user_id, reason, endpoints) {
1157
+ try {
1158
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1159
+ const ptr0 = passStringToWasm0(token, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1160
+ const len0 = WASM_VECTOR_LEN;
1161
+ var ptr1 = isLikeNone(reason) ? 0 : passStringToWasm0(reason, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1162
+ var len1 = WASM_VECTOR_LEN;
1163
+ wasm.moderationBanRequest(retptr, ptr0, len0, addHeapObject(broadcaster_user_id), addHeapObject(user_id), ptr1, len1, isLikeNone(endpoints) ? 0 : addHeapObject(endpoints));
1164
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1165
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1166
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1167
+ if (r2) {
1168
+ throw takeObject(r1);
1169
+ }
1170
+ return takeObject(r0);
1171
+ } finally {
1172
+ wasm.__wbindgen_add_to_stack_pointer(16);
1173
+ }
1174
+ }
1175
+
1176
+ /**
1177
+ * Times a user out for 1 to 10080 minutes. Scope `moderation:ban`.
1178
+ * @param {string} token
1179
+ * @param {number} broadcaster_user_id
1180
+ * @param {number} user_id
1181
+ * @param {number} minutes
1182
+ * @param {string | null} [reason]
1183
+ * @param {Endpoints | null} [endpoints]
1184
+ * @returns {HttpRequest}
1185
+ */
1186
+ export function moderationTimeoutRequest(token, broadcaster_user_id, user_id, minutes, reason, endpoints) {
1187
+ try {
1188
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1189
+ const ptr0 = passStringToWasm0(token, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1190
+ const len0 = WASM_VECTOR_LEN;
1191
+ var ptr1 = isLikeNone(reason) ? 0 : passStringToWasm0(reason, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1192
+ var len1 = WASM_VECTOR_LEN;
1193
+ wasm.moderationTimeoutRequest(retptr, ptr0, len0, addHeapObject(broadcaster_user_id), addHeapObject(user_id), addHeapObject(minutes), ptr1, len1, isLikeNone(endpoints) ? 0 : addHeapObject(endpoints));
1194
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1195
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1196
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1197
+ if (r2) {
1198
+ throw takeObject(r1);
1199
+ }
1200
+ return takeObject(r0);
1201
+ } finally {
1202
+ wasm.__wbindgen_add_to_stack_pointer(16);
1203
+ }
1204
+ }
1205
+
1206
+ /**
1207
+ * Lifts a ban or a timeout. Scope `moderation:ban`.
1208
+ * @param {string} token
1209
+ * @param {number} broadcaster_user_id
1210
+ * @param {number} user_id
1211
+ * @param {Endpoints | null} [endpoints]
1212
+ * @returns {HttpRequest}
1213
+ */
1214
+ export function moderationUnbanRequest(token, broadcaster_user_id, user_id, endpoints) {
1215
+ try {
1216
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1217
+ const ptr0 = passStringToWasm0(token, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1218
+ const len0 = WASM_VECTOR_LEN;
1219
+ wasm.moderationUnbanRequest(retptr, ptr0, len0, addHeapObject(broadcaster_user_id), addHeapObject(user_id), isLikeNone(endpoints) ? 0 : addHeapObject(endpoints));
1220
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1221
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1222
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1223
+ if (r2) {
1224
+ throw takeObject(r1);
1225
+ }
1226
+ return takeObject(r0);
1227
+ } finally {
1228
+ wasm.__wbindgen_add_to_stack_pointer(16);
1229
+ }
1230
+ }
1231
+
1232
+ /**
1233
+ * Where to send the user's browser to approve the app. `state` (from
1234
+ * `newState()`) must come back unchanged on the redirect; `verifier` is the
1235
+ * `Pkce`'s.
1236
+ * @param {string} client_id
1237
+ * @param {string} redirect_uri
1238
+ * @param {readonly Scope[]} scopes
1239
+ * @param {string} state
1240
+ * @param {string} verifier
1241
+ * @param {Endpoints | null} [endpoints]
1242
+ * @returns {string}
1243
+ */
1244
+ export function oauthAuthorizeUrl(client_id, redirect_uri, scopes, state, verifier, endpoints) {
1245
+ let deferred6_0;
1246
+ let deferred6_1;
1247
+ try {
1248
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1249
+ const ptr0 = passStringToWasm0(client_id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1250
+ const len0 = WASM_VECTOR_LEN;
1251
+ const ptr1 = passStringToWasm0(redirect_uri, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1252
+ const len1 = WASM_VECTOR_LEN;
1253
+ const ptr2 = passStringToWasm0(state, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1254
+ const len2 = WASM_VECTOR_LEN;
1255
+ const ptr3 = passStringToWasm0(verifier, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1256
+ const len3 = WASM_VECTOR_LEN;
1257
+ wasm.oauthAuthorizeUrl(retptr, ptr0, len0, ptr1, len1, addHeapObject(scopes), ptr2, len2, ptr3, len3, isLikeNone(endpoints) ? 0 : addHeapObject(endpoints));
1258
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1259
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1260
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1261
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
1262
+ var ptr5 = r0;
1263
+ var len5 = r1;
1264
+ if (r3) {
1265
+ ptr5 = 0; len5 = 0;
1266
+ throw takeObject(r2);
1267
+ }
1268
+ deferred6_0 = ptr5;
1269
+ deferred6_1 = len5;
1270
+ return getStringFromWasm0(ptr5, len5);
1271
+ } finally {
1272
+ wasm.__wbindgen_add_to_stack_pointer(16);
1273
+ wasm.__wbindgen_export4(deferred6_0, deferred6_1, 1);
1274
+ }
1275
+ }
1276
+
1277
+ /**
1278
+ * A user token for the `code` on the redirect, with the PKCE verifier.
1279
+ * @param {string} client_id
1280
+ * @param {string} client_secret
1281
+ * @param {string} redirect_uri
1282
+ * @param {string} code
1283
+ * @param {string} code_verifier
1284
+ * @param {Endpoints | null} [endpoints]
1285
+ * @returns {HttpRequest}
1286
+ */
1287
+ export function oauthCodeRequest(client_id, client_secret, redirect_uri, code, code_verifier, endpoints) {
1288
+ try {
1289
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1290
+ const ptr0 = passStringToWasm0(client_id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1291
+ const len0 = WASM_VECTOR_LEN;
1292
+ const ptr1 = passStringToWasm0(client_secret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1293
+ const len1 = WASM_VECTOR_LEN;
1294
+ const ptr2 = passStringToWasm0(redirect_uri, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1295
+ const len2 = WASM_VECTOR_LEN;
1296
+ const ptr3 = passStringToWasm0(code, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1297
+ const len3 = WASM_VECTOR_LEN;
1298
+ const ptr4 = passStringToWasm0(code_verifier, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1299
+ const len4 = WASM_VECTOR_LEN;
1300
+ wasm.oauthCodeRequest(retptr, ptr0, len0, ptr1, len1, ptr2, len2, ptr3, len3, ptr4, len4, isLikeNone(endpoints) ? 0 : addHeapObject(endpoints));
1301
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1302
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1303
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1304
+ if (r2) {
1305
+ throw takeObject(r1);
1306
+ }
1307
+ return takeObject(r0);
1308
+ } finally {
1309
+ wasm.__wbindgen_add_to_stack_pointer(16);
1310
+ }
1311
+ }
1312
+
1313
+ /**
1314
+ * Asks Kick about the token it is sent with (a user or an app token).
1315
+ * @param {string} token
1316
+ * @param {Endpoints | null} [endpoints]
1317
+ * @returns {HttpRequest}
1318
+ */
1319
+ export function oauthIntrospectRequest(token, endpoints) {
1320
+ try {
1321
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1322
+ const ptr0 = passStringToWasm0(token, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1323
+ const len0 = WASM_VECTOR_LEN;
1324
+ wasm.oauthIntrospectRequest(retptr, ptr0, len0, isLikeNone(endpoints) ? 0 : addHeapObject(endpoints));
1325
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1326
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1327
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1328
+ if (r2) {
1329
+ throw takeObject(r1);
1330
+ }
1331
+ return takeObject(r0);
1332
+ } finally {
1333
+ wasm.__wbindgen_add_to_stack_pointer(16);
1334
+ }
1335
+ }
1336
+
1337
+ /**
1338
+ * Reads an `oauthIntrospectRequest` answer.
1339
+ * @param {number} status
1340
+ * @param {string} body
1341
+ * @returns {Introspection}
1342
+ */
1343
+ export function oauthParseIntrospect(status, body) {
1344
+ try {
1345
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1346
+ const ptr0 = passStringToWasm0(body, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1347
+ const len0 = WASM_VECTOR_LEN;
1348
+ wasm.oauthParseIntrospect(retptr, addHeapObject(status), ptr0, len0);
1349
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1350
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1351
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1352
+ if (r2) {
1353
+ throw takeObject(r1);
1354
+ }
1355
+ return takeObject(r0);
1356
+ } finally {
1357
+ wasm.__wbindgen_add_to_stack_pointer(16);
1358
+ }
1359
+ }
1360
+
1361
+ /**
1362
+ * Whether a revoke worked; throws with `status` if not.
1363
+ * @param {number} status
1364
+ * @param {string} body
1365
+ */
1366
+ export function oauthParseRevoke(status, body) {
1367
+ try {
1368
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1369
+ const ptr0 = passStringToWasm0(body, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1370
+ const len0 = WASM_VECTOR_LEN;
1371
+ wasm.oauthParseRevoke(retptr, addHeapObject(status), ptr0, len0);
1372
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1373
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1374
+ if (r1) {
1375
+ throw takeObject(r0);
1376
+ }
1377
+ } finally {
1378
+ wasm.__wbindgen_add_to_stack_pointer(16);
1379
+ }
1380
+ }
1381
+
1382
+ /**
1383
+ * Reads an `oauthCodeRequest` or `oauthRefreshRequest` answer.
1384
+ * @param {number} status
1385
+ * @param {string} body
1386
+ * @returns {UserToken}
1387
+ */
1388
+ export function oauthParseUserToken(status, body) {
1389
+ try {
1390
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1391
+ const ptr0 = passStringToWasm0(body, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1392
+ const len0 = WASM_VECTOR_LEN;
1393
+ wasm.oauthParseUserToken(retptr, addHeapObject(status), ptr0, len0);
1394
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1395
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1396
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1397
+ if (r2) {
1398
+ throw takeObject(r1);
1399
+ }
1400
+ return takeObject(r0);
1401
+ } finally {
1402
+ wasm.__wbindgen_add_to_stack_pointer(16);
1403
+ }
1404
+ }
1405
+
1406
+ /**
1407
+ * A PKCE pair from 32 to 96 bytes drawn from a CSPRNG (`newPkce()` draws
1408
+ * them). The verifier is a secret: keep it, never log it.
1409
+ * @param {Uint8Array} random
1410
+ * @returns {Pkce}
1411
+ */
1412
+ export function oauthPkce(random) {
1413
+ try {
1414
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1415
+ wasm.oauthPkce(retptr, addHeapObject(random));
1416
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1417
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1418
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1419
+ if (r2) {
1420
+ throw takeObject(r1);
1421
+ }
1422
+ return takeObject(r0);
1423
+ } finally {
1424
+ wasm.__wbindgen_add_to_stack_pointer(16);
1425
+ }
1426
+ }
1427
+
1428
+ /**
1429
+ * The PKCE pair for a verifier kept from before (43 to 128 characters of
1430
+ * `A-Z a-z 0-9 - . _ ~`).
1431
+ * @param {string} verifier
1432
+ * @returns {Pkce}
1433
+ */
1434
+ export function oauthPkceFromVerifier(verifier) {
1435
+ try {
1436
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1437
+ const ptr0 = passStringToWasm0(verifier, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1438
+ const len0 = WASM_VECTOR_LEN;
1439
+ wasm.oauthPkceFromVerifier(retptr, ptr0, len0);
1440
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1441
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1442
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1443
+ if (r2) {
1444
+ throw takeObject(r1);
1445
+ }
1446
+ return takeObject(r0);
1447
+ } finally {
1448
+ wasm.__wbindgen_add_to_stack_pointer(16);
1449
+ }
1450
+ }
1451
+
1452
+ /**
1453
+ * A new user token (and refresh token) for a refresh token.
1454
+ * @param {string} client_id
1455
+ * @param {string} client_secret
1456
+ * @param {string} refresh_token
1457
+ * @param {Endpoints | null} [endpoints]
1458
+ * @returns {HttpRequest}
1459
+ */
1460
+ export function oauthRefreshRequest(client_id, client_secret, refresh_token, endpoints) {
1461
+ try {
1462
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1463
+ const ptr0 = passStringToWasm0(client_id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1464
+ const len0 = WASM_VECTOR_LEN;
1465
+ const ptr1 = passStringToWasm0(client_secret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1466
+ const len1 = WASM_VECTOR_LEN;
1467
+ const ptr2 = passStringToWasm0(refresh_token, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1468
+ const len2 = WASM_VECTOR_LEN;
1469
+ wasm.oauthRefreshRequest(retptr, ptr0, len0, ptr1, len1, ptr2, len2, isLikeNone(endpoints) ? 0 : addHeapObject(endpoints));
1470
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1471
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1472
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1473
+ if (r2) {
1474
+ throw takeObject(r1);
1475
+ }
1476
+ return takeObject(r0);
1477
+ } finally {
1478
+ wasm.__wbindgen_add_to_stack_pointer(16);
1479
+ }
1480
+ }
1481
+
1482
+ /**
1483
+ * Revokes a token. It goes in the URL: keep the URL out of logs.
1484
+ * @param {string} token
1485
+ * @param {TokenTypeHint | null} [token_type_hint]
1486
+ * @param {Endpoints | null} [endpoints]
1487
+ * @returns {HttpRequest}
1488
+ */
1489
+ export function oauthRevokeRequest(token, token_type_hint, endpoints) {
1490
+ try {
1491
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1492
+ const ptr0 = passStringToWasm0(token, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1493
+ const len0 = WASM_VECTOR_LEN;
1494
+ wasm.oauthRevokeRequest(retptr, ptr0, len0, isLikeNone(token_type_hint) ? 0 : addHeapObject(token_type_hint), isLikeNone(endpoints) ? 0 : addHeapObject(endpoints));
1495
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1496
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1497
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1498
+ if (r2) {
1499
+ throw takeObject(r1);
1500
+ }
1501
+ return takeObject(r0);
1502
+ } finally {
1503
+ wasm.__wbindgen_add_to_stack_pointer(16);
1504
+ }
1505
+ }
1506
+
1507
+ /**
1508
+ * Every scope Kick documents.
1509
+ * @returns {Scope[]}
1510
+ */
1511
+ export function oauthScopes() {
1512
+ try {
1513
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1514
+ wasm.oauthScopes(retptr);
1515
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1516
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1517
+ var v1 = getArrayJsValueFromWasm0(r0, r1);
1518
+ wasm.__wbindgen_export4(r0, r1 * 4, 4);
1519
+ return v1;
1520
+ } finally {
1521
+ wasm.__wbindgen_add_to_stack_pointer(16);
1522
+ }
1523
+ }
1524
+
1525
+ /**
1526
+ * Whether an acting call worked; throws with `status` if not.
1527
+ * @param {number} status
1528
+ * @param {string} body
1529
+ */
1530
+ export function parseAction(status, body) {
1531
+ try {
1532
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1533
+ const ptr0 = passStringToWasm0(body, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1534
+ const len0 = WASM_VECTOR_LEN;
1535
+ wasm.parseAction(retptr, addHeapObject(status), ptr0, len0);
1536
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1537
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1538
+ if (r1) {
1539
+ throw takeObject(r0);
1540
+ }
1541
+ } finally {
1542
+ wasm.__wbindgen_add_to_stack_pointer(16);
1543
+ }
1544
+ }
1545
+
1546
+ /**
1547
+ * Reads an app token answer.
1548
+ * @param {number} status
1549
+ * @param {string} body
1550
+ * @returns {any}
1551
+ */
1552
+ export function parseAppToken(status, body) {
1553
+ try {
1554
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1555
+ const ptr0 = passStringToWasm0(body, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1556
+ const len0 = WASM_VECTOR_LEN;
1557
+ wasm.parseAppToken(retptr, addHeapObject(status), ptr0, len0);
1558
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1559
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1560
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1561
+ if (r2) {
1562
+ throw takeObject(r1);
1563
+ }
1564
+ return takeObject(r0);
1565
+ } finally {
1566
+ wasm.__wbindgen_add_to_stack_pointer(16);
1567
+ }
1568
+ }
1569
+
1570
+ /**
1571
+ * Reads a `categoriesRequest` answer: `{data, next_cursor}`.
1572
+ * @param {number} status
1573
+ * @param {string} body
1574
+ * @returns {Page<Category>}
1575
+ */
1576
+ export function parseCategories(status, body) {
1577
+ try {
1578
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1579
+ const ptr0 = passStringToWasm0(body, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1580
+ const len0 = WASM_VECTOR_LEN;
1581
+ wasm.parseCategories(retptr, addHeapObject(status), ptr0, len0);
1582
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1583
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1584
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1585
+ if (r2) {
1586
+ throw takeObject(r1);
1587
+ }
1588
+ return takeObject(r0);
1589
+ } finally {
1590
+ wasm.__wbindgen_add_to_stack_pointer(16);
1591
+ }
1592
+ }
1593
+
1594
+ /**
1595
+ * Reads a website channel answer.
1596
+ * @param {number} status
1597
+ * @param {string} body
1598
+ * @returns {any}
1599
+ */
1600
+ export function parseChannel(status, body) {
1601
+ try {
1602
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1603
+ const ptr0 = passStringToWasm0(body, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1604
+ const len0 = WASM_VECTOR_LEN;
1605
+ wasm.parseChannel(retptr, addHeapObject(status), ptr0, len0);
1606
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1607
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1608
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1609
+ if (r2) {
1610
+ throw takeObject(r1);
1611
+ }
1612
+ return takeObject(r0);
1613
+ } finally {
1614
+ wasm.__wbindgen_add_to_stack_pointer(16);
1615
+ }
1616
+ }
1617
+
1618
+ /**
1619
+ * Reads a channel user answer.
1620
+ * @param {number} status
1621
+ * @param {string} body
1622
+ * @returns {any}
1623
+ */
1624
+ export function parseChannelUser(status, body) {
1625
+ try {
1626
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1627
+ const ptr0 = passStringToWasm0(body, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1628
+ const len0 = WASM_VECTOR_LEN;
1629
+ wasm.parseChannelUser(retptr, addHeapObject(status), ptr0, len0);
1630
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1631
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1632
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1633
+ if (r2) {
1634
+ throw takeObject(r1);
1635
+ }
1636
+ return takeObject(r0);
1637
+ } finally {
1638
+ wasm.__wbindgen_add_to_stack_pointer(16);
1639
+ }
1640
+ }
1641
+
1642
+ /**
1643
+ * Reads a `/channels` answer.
1644
+ * @param {number} status
1645
+ * @param {string} body
1646
+ * @returns {any}
1647
+ */
1648
+ export function parseChannels(status, body) {
1649
+ try {
1650
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1651
+ const ptr0 = passStringToWasm0(body, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1652
+ const len0 = WASM_VECTOR_LEN;
1653
+ wasm.parseChannels(retptr, addHeapObject(status), ptr0, len0);
1654
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1655
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1656
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1657
+ if (r2) {
1658
+ throw takeObject(r1);
1659
+ }
1660
+ return takeObject(r0);
1661
+ } finally {
1662
+ wasm.__wbindgen_add_to_stack_pointer(16);
1663
+ }
1664
+ }
1665
+
1666
+ /**
1667
+ * Reads either connection answer: `[{provider, url}…]`.
1668
+ * @param {number} status
1669
+ * @param {string} body
1670
+ * @returns {any}
1671
+ */
1672
+ export function parseConnection(status, body) {
1673
+ try {
1674
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1675
+ const ptr0 = passStringToWasm0(body, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1676
+ const len0 = WASM_VECTOR_LEN;
1677
+ wasm.parseConnection(retptr, addHeapObject(status), ptr0, len0);
1678
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1679
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1680
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1681
+ if (r2) {
1682
+ throw takeObject(r1);
1683
+ }
1684
+ return takeObject(r0);
1685
+ } finally {
1686
+ wasm.__wbindgen_add_to_stack_pointer(16);
1687
+ }
1688
+ }
1689
+
1690
+ /**
1691
+ * A message's text and emotes.
1692
+ * @param {string} text
1693
+ * @param {boolean} combine
1694
+ * @returns {any}
1695
+ */
1696
+ export function parseContent(text, combine) {
1697
+ try {
1698
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1699
+ const ptr0 = passStringToWasm0(text, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1700
+ const len0 = WASM_VECTOR_LEN;
1701
+ wasm.parseContent(retptr, ptr0, len0, addHeapObject(combine));
1702
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1703
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1704
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1705
+ if (r2) {
1706
+ throw takeObject(r1);
1707
+ }
1708
+ return takeObject(r0);
1709
+ } finally {
1710
+ wasm.__wbindgen_add_to_stack_pointer(16);
1711
+ }
1712
+ }
1713
+
1714
+ /**
1715
+ * Whether a user-token call whose answer carries nothing worked (any 2xx);
1716
+ * throws with `status` if not.
1717
+ * @param {number} status
1718
+ * @param {string} body
1719
+ */
1720
+ export function parseDone(status, body) {
1721
+ try {
1722
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1723
+ const ptr0 = passStringToWasm0(body, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1724
+ const len0 = WASM_VECTOR_LEN;
1725
+ wasm.parseDone(retptr, addHeapObject(status), ptr0, len0);
1726
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1727
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1728
+ if (r1) {
1729
+ throw takeObject(r0);
1730
+ }
1731
+ } finally {
1732
+ wasm.__wbindgen_add_to_stack_pointer(16);
1733
+ }
1734
+ }
1735
+
1736
+ /**
1737
+ * A feed event, typed: `{type: "chat_message", …}`. `data` as Kick sent it.
1738
+ * @param {string} name
1739
+ * @param {any} data
1740
+ * @returns {any}
1741
+ */
1742
+ export function parseEvent(name, data) {
1743
+ try {
1744
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1745
+ const ptr0 = passStringToWasm0(name, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1746
+ const len0 = WASM_VECTOR_LEN;
1747
+ wasm.parseEvent(retptr, ptr0, len0, addHeapObject(data));
1748
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1749
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1750
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1751
+ if (r2) {
1752
+ throw takeObject(r1);
1753
+ }
1754
+ return takeObject(r0);
1755
+ } finally {
1756
+ wasm.__wbindgen_add_to_stack_pointer(16);
1757
+ }
1758
+ }
1759
+
1760
+ /**
1761
+ * Reads a history answer: `{messages, pinned}`.
1762
+ * @param {number} status
1763
+ * @param {string} body
1764
+ * @returns {any}
1765
+ */
1766
+ export function parseHistory(status, body) {
1767
+ try {
1768
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1769
+ const ptr0 = passStringToWasm0(body, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1770
+ const len0 = WASM_VECTOR_LEN;
1771
+ wasm.parseHistory(retptr, addHeapObject(status), ptr0, len0);
1772
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1773
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1774
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1775
+ if (r2) {
1776
+ throw takeObject(r1);
1777
+ }
1778
+ return takeObject(r0);
1779
+ } finally {
1780
+ wasm.__wbindgen_add_to_stack_pointer(16);
1781
+ }
1782
+ }
1783
+
1784
+ /**
1785
+ * Reads a `kicksLeaderboardRequest` answer.
1786
+ * @param {number} status
1787
+ * @param {string} body
1788
+ * @returns {KicksLeaderboard}
1789
+ */
1790
+ export function parseKicksLeaderboard(status, body) {
1791
+ try {
1792
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1793
+ const ptr0 = passStringToWasm0(body, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1794
+ const len0 = WASM_VECTOR_LEN;
1795
+ wasm.parseKicksLeaderboard(retptr, addHeapObject(status), ptr0, len0);
1796
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1797
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1798
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1799
+ if (r2) {
1800
+ throw takeObject(r1);
1801
+ }
1802
+ return takeObject(r0);
1803
+ } finally {
1804
+ wasm.__wbindgen_add_to_stack_pointer(16);
1805
+ }
1806
+ }
1807
+
1808
+ /**
1809
+ * Reads a `livestreamStatsRequest` answer.
1810
+ * @param {number} status
1811
+ * @param {string} body
1812
+ * @returns {LivestreamStats}
1813
+ */
1814
+ export function parseLivestreamStats(status, body) {
1815
+ try {
1816
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1817
+ const ptr0 = passStringToWasm0(body, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1818
+ const len0 = WASM_VECTOR_LEN;
1819
+ wasm.parseLivestreamStats(retptr, addHeapObject(status), ptr0, len0);
1820
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1821
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1822
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1823
+ if (r2) {
1824
+ throw takeObject(r1);
1825
+ }
1826
+ return takeObject(r0);
1827
+ } finally {
1828
+ wasm.__wbindgen_add_to_stack_pointer(16);
1829
+ }
1830
+ }
1831
+
1832
+ /**
1833
+ * Reads a `livestreamsRequests` answer (or a page's streams alone).
1834
+ * @param {number} status
1835
+ * @param {string} body
1836
+ * @returns {any}
1837
+ */
1838
+ export function parseLivestreams(status, body) {
1839
+ try {
1840
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1841
+ const ptr0 = passStringToWasm0(body, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1842
+ const len0 = WASM_VECTOR_LEN;
1843
+ wasm.parseLivestreams(retptr, addHeapObject(status), ptr0, len0);
1844
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1845
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1846
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1847
+ if (r2) {
1848
+ throw takeObject(r1);
1849
+ }
1850
+ return takeObject(r0);
1851
+ } finally {
1852
+ wasm.__wbindgen_add_to_stack_pointer(16);
1853
+ }
1854
+ }
1855
+
1856
+ /**
1857
+ * Reads a `livestreamsPageRequest` answer: `{data, next_cursor}`.
1858
+ * @param {number} status
1859
+ * @param {string} body
1860
+ * @returns {any}
1861
+ */
1862
+ export function parseLivestreamsPage(status, body) {
1863
+ try {
1864
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1865
+ const ptr0 = passStringToWasm0(body, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1866
+ const len0 = WASM_VECTOR_LEN;
1867
+ wasm.parseLivestreamsPage(retptr, addHeapObject(status), ptr0, len0);
1868
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1869
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1870
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1871
+ if (r2) {
1872
+ throw takeObject(r1);
1873
+ }
1874
+ return takeObject(r0);
1875
+ } finally {
1876
+ wasm.__wbindgen_add_to_stack_pointer(16);
1877
+ }
1878
+ }
1879
+
1880
+ /**
1881
+ * Reads a `me` answer.
1882
+ * @param {number} status
1883
+ * @param {string} body
1884
+ * @returns {any}
1885
+ */
1886
+ export function parseMe(status, body) {
1887
+ try {
1888
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1889
+ const ptr0 = passStringToWasm0(body, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1890
+ const len0 = WASM_VECTOR_LEN;
1891
+ wasm.parseMe(retptr, addHeapObject(status), ptr0, len0);
1892
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1893
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1894
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1895
+ if (r2) {
1896
+ throw takeObject(r1);
1897
+ }
1898
+ return takeObject(r0);
1899
+ } finally {
1900
+ wasm.__wbindgen_add_to_stack_pointer(16);
1901
+ }
1902
+ }
1903
+
1904
+ /**
1905
+ * The PEM from a public key answer.
1906
+ * @param {number} status
1907
+ * @param {string} body
1908
+ * @returns {string}
1909
+ */
1910
+ export function parsePublicKey(status, body) {
1911
+ let deferred3_0;
1912
+ let deferred3_1;
1913
+ try {
1914
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1915
+ const ptr0 = passStringToWasm0(body, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1916
+ const len0 = WASM_VECTOR_LEN;
1917
+ wasm.parsePublicKey(retptr, addHeapObject(status), ptr0, len0);
1918
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1919
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1920
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1921
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
1922
+ var ptr2 = r0;
1923
+ var len2 = r1;
1924
+ if (r3) {
1925
+ ptr2 = 0; len2 = 0;
1926
+ throw takeObject(r2);
1927
+ }
1928
+ deferred3_0 = ptr2;
1929
+ deferred3_1 = len2;
1930
+ return getStringFromWasm0(ptr2, len2);
1931
+ } finally {
1932
+ wasm.__wbindgen_add_to_stack_pointer(16);
1933
+ wasm.__wbindgen_export4(deferred3_0, deferred3_1, 1);
1934
+ }
1935
+ }
1936
+
1937
+ /**
1938
+ * Reads a subscriptions answer.
1939
+ * @param {number} status
1940
+ * @param {string} body
1941
+ * @returns {any}
1942
+ */
1943
+ export function parseSubscriptions(status, body) {
1944
+ try {
1945
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1946
+ const ptr0 = passStringToWasm0(body, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1947
+ const len0 = WASM_VECTOR_LEN;
1948
+ wasm.parseSubscriptions(retptr, addHeapObject(status), ptr0, len0);
1949
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1950
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1951
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1952
+ if (r2) {
1953
+ throw takeObject(r1);
1954
+ }
1955
+ return takeObject(r0);
1956
+ } finally {
1957
+ wasm.__wbindgen_add_to_stack_pointer(16);
1958
+ }
1959
+ }
1960
+
1961
+ /**
1962
+ * The token from a token answer.
1963
+ * @param {number} status
1964
+ * @param {string} body
1965
+ * @returns {string}
1966
+ */
1967
+ export function parseToken(status, body) {
1968
+ let deferred3_0;
1969
+ let deferred3_1;
1970
+ try {
1971
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
1972
+ const ptr0 = passStringToWasm0(body, wasm.__wbindgen_export, wasm.__wbindgen_export2);
1973
+ const len0 = WASM_VECTOR_LEN;
1974
+ wasm.parseToken(retptr, addHeapObject(status), ptr0, len0);
1975
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
1976
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
1977
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
1978
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
1979
+ var ptr2 = r0;
1980
+ var len2 = r1;
1981
+ if (r3) {
1982
+ ptr2 = 0; len2 = 0;
1983
+ throw takeObject(r2);
1984
+ }
1985
+ deferred3_0 = ptr2;
1986
+ deferred3_1 = len2;
1987
+ return getStringFromWasm0(ptr2, len2);
1988
+ } finally {
1989
+ wasm.__wbindgen_add_to_stack_pointer(16);
1990
+ wasm.__wbindgen_export4(deferred3_0, deferred3_1, 1);
417
1991
  }
418
- return takeFromExternrefTable0(ret[0]);
419
1992
  }
420
1993
 
421
1994
  /**
422
- * Whether an acting call worked; throws with `status` if not.
1995
+ * Reads a `usersRequest` answer.
423
1996
  * @param {number} status
424
1997
  * @param {string} body
1998
+ * @returns {User[]}
425
1999
  */
426
- export function parseAction(status, body) {
427
- const ptr0 = passStringToWasm0(body, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
428
- const len0 = WASM_VECTOR_LEN;
429
- const ret = wasm.parseAction(status, ptr0, len0);
430
- if (ret[1]) {
431
- throw takeFromExternrefTable0(ret[0]);
2000
+ export function parseUsers(status, body) {
2001
+ try {
2002
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2003
+ const ptr0 = passStringToWasm0(body, wasm.__wbindgen_export, wasm.__wbindgen_export2);
2004
+ const len0 = WASM_VECTOR_LEN;
2005
+ wasm.parseUsers(retptr, addHeapObject(status), ptr0, len0);
2006
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2007
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2008
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
2009
+ if (r2) {
2010
+ throw takeObject(r1);
2011
+ }
2012
+ return takeObject(r0);
2013
+ } finally {
2014
+ wasm.__wbindgen_add_to_stack_pointer(16);
432
2015
  }
433
2016
  }
434
2017
 
435
2018
  /**
436
- * Reads an app token answer.
437
- * @param {number} status
438
- * @param {string} body
2019
+ * Reads a delivery's body by its type header, without checking anything.
2020
+ * Throws when the body is not that type's shape. `body` is text or bytes.
2021
+ * @param {string} event_type
2022
+ * @param {string | Uint8Array | ArrayBuffer} body
439
2023
  * @returns {any}
440
2024
  */
441
- export function parseAppToken(status, body) {
442
- const ptr0 = passStringToWasm0(body, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
443
- const len0 = WASM_VECTOR_LEN;
444
- const ret = wasm.parseAppToken(status, ptr0, len0);
445
- if (ret[2]) {
446
- throw takeFromExternrefTable0(ret[1]);
2025
+ export function parseWebhook(event_type, body) {
2026
+ try {
2027
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2028
+ const ptr0 = passStringToWasm0(event_type, wasm.__wbindgen_export, wasm.__wbindgen_export2);
2029
+ const len0 = WASM_VECTOR_LEN;
2030
+ wasm.parseWebhook(retptr, ptr0, len0, addHeapObject(body));
2031
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2032
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2033
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
2034
+ if (r2) {
2035
+ throw takeObject(r1);
2036
+ }
2037
+ return takeObject(r0);
2038
+ } finally {
2039
+ wasm.__wbindgen_add_to_stack_pointer(16);
447
2040
  }
448
- return takeFromExternrefTable0(ret[0]);
449
2041
  }
450
2042
 
451
2043
  /**
452
- * Reads a website channel answer.
453
- * @param {number} status
454
- * @param {string} body
2044
+ * Pins a message (the feed's data for it, whole) for 1 to 10080 minutes.
2045
+ * @param {string} session
2046
+ * @param {string} channel_slug
2047
+ * @param {any} message
2048
+ * @param {number} minutes
2049
+ * @param {Endpoints | null} [endpoints]
455
2050
  * @returns {any}
456
2051
  */
457
- export function parseChannel(status, body) {
458
- const ptr0 = passStringToWasm0(body, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
459
- const len0 = WASM_VECTOR_LEN;
460
- const ret = wasm.parseChannel(status, ptr0, len0);
461
- if (ret[2]) {
462
- throw takeFromExternrefTable0(ret[1]);
2052
+ export function pinRequest(session, channel_slug, message, minutes, endpoints) {
2053
+ try {
2054
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2055
+ const ptr0 = passStringToWasm0(session, wasm.__wbindgen_export, wasm.__wbindgen_export2);
2056
+ const len0 = WASM_VECTOR_LEN;
2057
+ const ptr1 = passStringToWasm0(channel_slug, wasm.__wbindgen_export, wasm.__wbindgen_export2);
2058
+ const len1 = WASM_VECTOR_LEN;
2059
+ wasm.pinRequest(retptr, ptr0, len0, ptr1, len1, addHeapObject(message), addHeapObject(minutes), isLikeNone(endpoints) ? 0 : addHeapObject(endpoints));
2060
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2061
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2062
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
2063
+ if (r2) {
2064
+ throw takeObject(r1);
2065
+ }
2066
+ return takeObject(r0);
2067
+ } finally {
2068
+ wasm.__wbindgen_add_to_stack_pointer(16);
463
2069
  }
464
- return takeFromExternrefTable0(ret[0]);
465
2070
  }
466
2071
 
467
2072
  /**
468
- * Reads a channel user answer.
469
- * @param {number} status
470
- * @param {string} body
2073
+ * The webhook signing key request.
2074
+ * @param {Endpoints | null} [endpoints]
471
2075
  * @returns {any}
472
2076
  */
473
- export function parseChannelUser(status, body) {
474
- const ptr0 = passStringToWasm0(body, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
475
- const len0 = WASM_VECTOR_LEN;
476
- const ret = wasm.parseChannelUser(status, ptr0, len0);
477
- if (ret[2]) {
478
- throw takeFromExternrefTable0(ret[1]);
2077
+ export function publicKeyRequest(endpoints) {
2078
+ try {
2079
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2080
+ wasm.publicKeyRequest(retptr, isLikeNone(endpoints) ? 0 : addHeapObject(endpoints));
2081
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2082
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2083
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
2084
+ if (r2) {
2085
+ throw takeObject(r1);
2086
+ }
2087
+ return takeObject(r0);
2088
+ } finally {
2089
+ wasm.__wbindgen_add_to_stack_pointer(16);
479
2090
  }
480
- return takeFromExternrefTable0(ret[0]);
481
2091
  }
482
2092
 
483
2093
  /**
484
- * Reads a `/channels` answer.
485
- * @param {number} status
486
- * @param {string} body
487
- * @returns {any}
2094
+ * The least to wait, ms, before reconnecting after the socket closed with
2095
+ * this code: 300000 (5 minutes) for Kick's terminal codes (3500-3999 and
2096
+ * 4500-4999: a bad token, a ban, a refused request), then reconnect with a
2097
+ * new client id; 0, the ordinary backoff, for the rest (1006, a network
2098
+ * drop, among them).
2099
+ * @param {number} code
2100
+ * @returns {number}
488
2101
  */
489
- export function parseChannels(status, body) {
490
- const ptr0 = passStringToWasm0(body, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
491
- const len0 = WASM_VECTOR_LEN;
492
- const ret = wasm.parseChannels(status, ptr0, len0);
493
- if (ret[2]) {
494
- throw takeFromExternrefTable0(ret[1]);
2102
+ export function retryAfterMs(code) {
2103
+ try {
2104
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2105
+ wasm.retryAfterMs(retptr, addHeapObject(code));
2106
+ var r0 = getDataViewMemory0().getFloat64(retptr + 8 * 0, true);
2107
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
2108
+ var r3 = getDataViewMemory0().getInt32(retptr + 4 * 3, true);
2109
+ if (r3) {
2110
+ throw takeObject(r2);
2111
+ }
2112
+ return r0;
2113
+ } finally {
2114
+ wasm.__wbindgen_add_to_stack_pointer(16);
495
2115
  }
496
- return takeFromExternrefTable0(ret[0]);
497
2116
  }
498
2117
 
499
2118
  /**
500
- * Reads either connection answer: `[{provider, url}…]`.
501
- * @param {number} status
502
- * @param {string} body
503
- * @returns {any}
2119
+ * Accepts 1 to 25 pending redemptions; `rewardsParseFailures` reads the
2120
+ * answer.
2121
+ * @param {string} token
2122
+ * @param {readonly string[]} ids
2123
+ * @param {Endpoints | null} [endpoints]
2124
+ * @returns {HttpRequest}
504
2125
  */
505
- export function parseConnection(status, body) {
506
- const ptr0 = passStringToWasm0(body, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
507
- const len0 = WASM_VECTOR_LEN;
508
- const ret = wasm.parseConnection(status, ptr0, len0);
509
- if (ret[2]) {
510
- throw takeFromExternrefTable0(ret[1]);
2126
+ export function rewardsAcceptRequest(token, ids, endpoints) {
2127
+ try {
2128
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2129
+ const ptr0 = passStringToWasm0(token, wasm.__wbindgen_export, wasm.__wbindgen_export2);
2130
+ const len0 = WASM_VECTOR_LEN;
2131
+ wasm.rewardsAcceptRequest(retptr, ptr0, len0, addHeapObject(ids), isLikeNone(endpoints) ? 0 : addHeapObject(endpoints));
2132
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2133
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2134
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
2135
+ if (r2) {
2136
+ throw takeObject(r1);
2137
+ }
2138
+ return takeObject(r0);
2139
+ } finally {
2140
+ wasm.__wbindgen_add_to_stack_pointer(16);
511
2141
  }
512
- return takeFromExternrefTable0(ret[0]);
513
2142
  }
514
2143
 
515
2144
  /**
516
- * A message's text and emotes.
517
- * @param {string} text
518
- * @param {boolean} combine
519
- * @returns {any}
2145
+ * Creates a reward: `fields` needs `title` and `cost`.
2146
+ * @param {string} token
2147
+ * @param {RewardFields} fields
2148
+ * @param {Endpoints | null} [endpoints]
2149
+ * @returns {HttpRequest}
520
2150
  */
521
- export function parseContent(text, combine) {
522
- const ptr0 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
523
- const len0 = WASM_VECTOR_LEN;
524
- const ret = wasm.parseContent(ptr0, len0, combine);
525
- if (ret[2]) {
526
- throw takeFromExternrefTable0(ret[1]);
2151
+ export function rewardsCreateRequest(token, fields, endpoints) {
2152
+ try {
2153
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2154
+ const ptr0 = passStringToWasm0(token, wasm.__wbindgen_export, wasm.__wbindgen_export2);
2155
+ const len0 = WASM_VECTOR_LEN;
2156
+ wasm.rewardsCreateRequest(retptr, ptr0, len0, addHeapObject(fields), isLikeNone(endpoints) ? 0 : addHeapObject(endpoints));
2157
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2158
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2159
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
2160
+ if (r2) {
2161
+ throw takeObject(r1);
2162
+ }
2163
+ return takeObject(r0);
2164
+ } finally {
2165
+ wasm.__wbindgen_add_to_stack_pointer(16);
527
2166
  }
528
- return takeFromExternrefTable0(ret[0]);
529
2167
  }
530
2168
 
531
2169
  /**
532
- * A feed event, typed: `{type: "chat_message", …}`. `data` as Kick sent it.
533
- * @param {string} name
534
- * @param {any} data
535
- * @returns {any}
2170
+ * Deletes reward `id`; `parseDone` reads the answer.
2171
+ * @param {string} token
2172
+ * @param {string} id
2173
+ * @param {Endpoints | null} [endpoints]
2174
+ * @returns {HttpRequest}
536
2175
  */
537
- export function parseEvent(name, data) {
538
- const ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
539
- const len0 = WASM_VECTOR_LEN;
540
- const ret = wasm.parseEvent(ptr0, len0, data);
541
- if (ret[2]) {
542
- throw takeFromExternrefTable0(ret[1]);
2176
+ export function rewardsDeleteRequest(token, id, endpoints) {
2177
+ try {
2178
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2179
+ const ptr0 = passStringToWasm0(token, wasm.__wbindgen_export, wasm.__wbindgen_export2);
2180
+ const len0 = WASM_VECTOR_LEN;
2181
+ const ptr1 = passStringToWasm0(id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
2182
+ const len1 = WASM_VECTOR_LEN;
2183
+ wasm.rewardsDeleteRequest(retptr, ptr0, len0, ptr1, len1, isLikeNone(endpoints) ? 0 : addHeapObject(endpoints));
2184
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2185
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2186
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
2187
+ if (r2) {
2188
+ throw takeObject(r1);
2189
+ }
2190
+ return takeObject(r0);
2191
+ } finally {
2192
+ wasm.__wbindgen_add_to_stack_pointer(16);
543
2193
  }
544
- return takeFromExternrefTable0(ret[0]);
545
2194
  }
546
2195
 
547
2196
  /**
548
- * Reads a history answer: `{messages, pinned}`.
549
- * @param {number} status
550
- * @param {string} body
551
- * @returns {any}
2197
+ * Every channel-points reward of the token's channel.
2198
+ * @param {string} token
2199
+ * @param {Endpoints | null} [endpoints]
2200
+ * @returns {HttpRequest}
552
2201
  */
553
- export function parseHistory(status, body) {
554
- const ptr0 = passStringToWasm0(body, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
555
- const len0 = WASM_VECTOR_LEN;
556
- const ret = wasm.parseHistory(status, ptr0, len0);
557
- if (ret[2]) {
558
- throw takeFromExternrefTable0(ret[1]);
2202
+ export function rewardsListRequest(token, endpoints) {
2203
+ try {
2204
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2205
+ const ptr0 = passStringToWasm0(token, wasm.__wbindgen_export, wasm.__wbindgen_export2);
2206
+ const len0 = WASM_VECTOR_LEN;
2207
+ wasm.rewardsListRequest(retptr, ptr0, len0, isLikeNone(endpoints) ? 0 : addHeapObject(endpoints));
2208
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2209
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2210
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
2211
+ if (r2) {
2212
+ throw takeObject(r1);
2213
+ }
2214
+ return takeObject(r0);
2215
+ } finally {
2216
+ wasm.__wbindgen_add_to_stack_pointer(16);
559
2217
  }
560
- return takeFromExternrefTable0(ret[0]);
561
2218
  }
562
2219
 
563
2220
  /**
564
- * Reads a `/livestreams` answer.
2221
+ * The redemptions an accept or reject failed for; empty is all done.
565
2222
  * @param {number} status
566
2223
  * @param {string} body
567
- * @returns {any}
2224
+ * @returns {FailedRedemption[]}
568
2225
  */
569
- export function parseLivestreams(status, body) {
570
- const ptr0 = passStringToWasm0(body, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
571
- const len0 = WASM_VECTOR_LEN;
572
- const ret = wasm.parseLivestreams(status, ptr0, len0);
573
- if (ret[2]) {
574
- throw takeFromExternrefTable0(ret[1]);
2226
+ export function rewardsParseFailures(status, body) {
2227
+ try {
2228
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2229
+ const ptr0 = passStringToWasm0(body, wasm.__wbindgen_export, wasm.__wbindgen_export2);
2230
+ const len0 = WASM_VECTOR_LEN;
2231
+ wasm.rewardsParseFailures(retptr, addHeapObject(status), ptr0, len0);
2232
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2233
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2234
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
2235
+ if (r2) {
2236
+ throw takeObject(r1);
2237
+ }
2238
+ return takeObject(r0);
2239
+ } finally {
2240
+ wasm.__wbindgen_add_to_stack_pointer(16);
575
2241
  }
576
- return takeFromExternrefTable0(ret[0]);
577
2242
  }
578
2243
 
579
2244
  /**
580
- * Reads a `me` answer.
2245
+ * Reads a `rewardsRedemptionsRequest` or `rewardsRedemptionsByIdsRequest`
2246
+ * answer.
581
2247
  * @param {number} status
582
2248
  * @param {string} body
583
- * @returns {any}
2249
+ * @returns {RedemptionPage}
584
2250
  */
585
- export function parseMe(status, body) {
586
- const ptr0 = passStringToWasm0(body, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
587
- const len0 = WASM_VECTOR_LEN;
588
- const ret = wasm.parseMe(status, ptr0, len0);
589
- if (ret[2]) {
590
- throw takeFromExternrefTable0(ret[1]);
2251
+ export function rewardsParseRedemptions(status, body) {
2252
+ try {
2253
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2254
+ const ptr0 = passStringToWasm0(body, wasm.__wbindgen_export, wasm.__wbindgen_export2);
2255
+ const len0 = WASM_VECTOR_LEN;
2256
+ wasm.rewardsParseRedemptions(retptr, addHeapObject(status), ptr0, len0);
2257
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2258
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2259
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
2260
+ if (r2) {
2261
+ throw takeObject(r1);
2262
+ }
2263
+ return takeObject(r0);
2264
+ } finally {
2265
+ wasm.__wbindgen_add_to_stack_pointer(16);
591
2266
  }
592
- return takeFromExternrefTable0(ret[0]);
593
2267
  }
594
2268
 
595
2269
  /**
596
- * The PEM from a public key answer.
2270
+ * Reads a `rewardsCreateRequest` or `rewardsUpdateRequest` answer.
597
2271
  * @param {number} status
598
2272
  * @param {string} body
599
- * @returns {string}
2273
+ * @returns {Reward}
600
2274
  */
601
- export function parsePublicKey(status, body) {
602
- let deferred3_0;
603
- let deferred3_1;
2275
+ export function rewardsParseReward(status, body) {
604
2276
  try {
605
- const ptr0 = passStringToWasm0(body, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2277
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2278
+ const ptr0 = passStringToWasm0(body, wasm.__wbindgen_export, wasm.__wbindgen_export2);
606
2279
  const len0 = WASM_VECTOR_LEN;
607
- const ret = wasm.parsePublicKey(status, ptr0, len0);
608
- var ptr2 = ret[0];
609
- var len2 = ret[1];
610
- if (ret[3]) {
611
- ptr2 = 0; len2 = 0;
612
- throw takeFromExternrefTable0(ret[2]);
2280
+ wasm.rewardsParseReward(retptr, addHeapObject(status), ptr0, len0);
2281
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2282
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2283
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
2284
+ if (r2) {
2285
+ throw takeObject(r1);
613
2286
  }
614
- deferred3_0 = ptr2;
615
- deferred3_1 = len2;
616
- return getStringFromWasm0(ptr2, len2);
2287
+ return takeObject(r0);
617
2288
  } finally {
618
- wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
2289
+ wasm.__wbindgen_add_to_stack_pointer(16);
619
2290
  }
620
2291
  }
621
2292
 
622
2293
  /**
623
- * Reads a subscriptions answer.
2294
+ * Reads a `rewardsListRequest` answer.
624
2295
  * @param {number} status
625
2296
  * @param {string} body
626
- * @returns {any}
2297
+ * @returns {Reward[]}
627
2298
  */
628
- export function parseSubscriptions(status, body) {
629
- const ptr0 = passStringToWasm0(body, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
630
- const len0 = WASM_VECTOR_LEN;
631
- const ret = wasm.parseSubscriptions(status, ptr0, len0);
632
- if (ret[2]) {
633
- throw takeFromExternrefTable0(ret[1]);
2299
+ export function rewardsParseRewards(status, body) {
2300
+ try {
2301
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2302
+ const ptr0 = passStringToWasm0(body, wasm.__wbindgen_export, wasm.__wbindgen_export2);
2303
+ const len0 = WASM_VECTOR_LEN;
2304
+ wasm.rewardsParseRewards(retptr, addHeapObject(status), ptr0, len0);
2305
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2306
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2307
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
2308
+ if (r2) {
2309
+ throw takeObject(r1);
2310
+ }
2311
+ return takeObject(r0);
2312
+ } finally {
2313
+ wasm.__wbindgen_add_to_stack_pointer(16);
634
2314
  }
635
- return takeFromExternrefTable0(ret[0]);
636
2315
  }
637
2316
 
638
2317
  /**
639
- * The token from a token answer.
640
- * @param {number} status
641
- * @param {string} body
642
- * @returns {string}
2318
+ * Redemptions by id, whatever their status.
2319
+ * @param {string} token
2320
+ * @param {readonly string[]} ids
2321
+ * @param {string | null} [cursor]
2322
+ * @param {Endpoints | null} [endpoints]
2323
+ * @returns {HttpRequest}
643
2324
  */
644
- export function parseToken(status, body) {
645
- let deferred3_0;
646
- let deferred3_1;
2325
+ export function rewardsRedemptionsByIdsRequest(token, ids, cursor, endpoints) {
647
2326
  try {
648
- const ptr0 = passStringToWasm0(body, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2327
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2328
+ const ptr0 = passStringToWasm0(token, wasm.__wbindgen_export, wasm.__wbindgen_export2);
649
2329
  const len0 = WASM_VECTOR_LEN;
650
- const ret = wasm.parseToken(status, ptr0, len0);
651
- var ptr2 = ret[0];
652
- var len2 = ret[1];
653
- if (ret[3]) {
654
- ptr2 = 0; len2 = 0;
655
- throw takeFromExternrefTable0(ret[2]);
2330
+ var ptr1 = isLikeNone(cursor) ? 0 : passStringToWasm0(cursor, wasm.__wbindgen_export, wasm.__wbindgen_export2);
2331
+ var len1 = WASM_VECTOR_LEN;
2332
+ wasm.rewardsRedemptionsByIdsRequest(retptr, ptr0, len0, addHeapObject(ids), ptr1, len1, isLikeNone(endpoints) ? 0 : addHeapObject(endpoints));
2333
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2334
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2335
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
2336
+ if (r2) {
2337
+ throw takeObject(r1);
656
2338
  }
657
- deferred3_0 = ptr2;
658
- deferred3_1 = len2;
659
- return getStringFromWasm0(ptr2, len2);
2339
+ return takeObject(r0);
660
2340
  } finally {
661
- wasm.__wbindgen_free(deferred3_0, deferred3_1, 1);
2341
+ wasm.__wbindgen_add_to_stack_pointer(16);
662
2342
  }
663
2343
  }
664
2344
 
665
2345
  /**
666
- * Reads a delivery's body by its type header, without checking anything.
667
- * @param {string} event_type
668
- * @param {string} body
669
- * @returns {any}
2346
+ * Redemptions, grouped by reward: of one reward or all, with one `status`
2347
+ * (Kick's default `'pending'`), from `cursor`.
2348
+ * @param {string} token
2349
+ * @param {string | null} [reward_id]
2350
+ * @param {RedemptionStatus | null} [status]
2351
+ * @param {string | null} [cursor]
2352
+ * @param {Endpoints | null} [endpoints]
2353
+ * @returns {HttpRequest}
670
2354
  */
671
- export function parseWebhook(event_type, body) {
672
- const ptr0 = passStringToWasm0(event_type, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
673
- const len0 = WASM_VECTOR_LEN;
674
- const ptr1 = passStringToWasm0(body, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
675
- const len1 = WASM_VECTOR_LEN;
676
- const ret = wasm.parseWebhook(ptr0, len0, ptr1, len1);
677
- if (ret[2]) {
678
- throw takeFromExternrefTable0(ret[1]);
2355
+ export function rewardsRedemptionsRequest(token, reward_id, status, cursor, endpoints) {
2356
+ try {
2357
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2358
+ const ptr0 = passStringToWasm0(token, wasm.__wbindgen_export, wasm.__wbindgen_export2);
2359
+ const len0 = WASM_VECTOR_LEN;
2360
+ var ptr1 = isLikeNone(reward_id) ? 0 : passStringToWasm0(reward_id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
2361
+ var len1 = WASM_VECTOR_LEN;
2362
+ var ptr2 = isLikeNone(cursor) ? 0 : passStringToWasm0(cursor, wasm.__wbindgen_export, wasm.__wbindgen_export2);
2363
+ var len2 = WASM_VECTOR_LEN;
2364
+ wasm.rewardsRedemptionsRequest(retptr, ptr0, len0, ptr1, len1, isLikeNone(status) ? 0 : addHeapObject(status), ptr2, len2, isLikeNone(endpoints) ? 0 : addHeapObject(endpoints));
2365
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2366
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2367
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
2368
+ if (r2) {
2369
+ throw takeObject(r1);
2370
+ }
2371
+ return takeObject(r0);
2372
+ } finally {
2373
+ wasm.__wbindgen_add_to_stack_pointer(16);
679
2374
  }
680
- return takeFromExternrefTable0(ret[0]);
681
2375
  }
682
2376
 
683
2377
  /**
684
- * Pins a message (the feed's data for it, whole) for `minutes`.
685
- * @param {string} session
686
- * @param {string} channel_slug
687
- * @param {any} message
688
- * @param {number} minutes
689
- * @param {any} endpoints_
690
- * @returns {any}
2378
+ * Rejects 1 to 25 pending redemptions; `rewardsParseFailures` reads the
2379
+ * answer.
2380
+ * @param {string} token
2381
+ * @param {readonly string[]} ids
2382
+ * @param {Endpoints | null} [endpoints]
2383
+ * @returns {HttpRequest}
691
2384
  */
692
- export function pinRequest(session, channel_slug, message, minutes, endpoints_) {
693
- const ptr0 = passStringToWasm0(session, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
694
- const len0 = WASM_VECTOR_LEN;
695
- const ptr1 = passStringToWasm0(channel_slug, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
696
- const len1 = WASM_VECTOR_LEN;
697
- const ret = wasm.pinRequest(ptr0, len0, ptr1, len1, message, minutes, endpoints_);
698
- if (ret[2]) {
699
- throw takeFromExternrefTable0(ret[1]);
2385
+ export function rewardsRejectRequest(token, ids, endpoints) {
2386
+ try {
2387
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2388
+ const ptr0 = passStringToWasm0(token, wasm.__wbindgen_export, wasm.__wbindgen_export2);
2389
+ const len0 = WASM_VECTOR_LEN;
2390
+ wasm.rewardsRejectRequest(retptr, ptr0, len0, addHeapObject(ids), isLikeNone(endpoints) ? 0 : addHeapObject(endpoints));
2391
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2392
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2393
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
2394
+ if (r2) {
2395
+ throw takeObject(r1);
2396
+ }
2397
+ return takeObject(r0);
2398
+ } finally {
2399
+ wasm.__wbindgen_add_to_stack_pointer(16);
700
2400
  }
701
- return takeFromExternrefTable0(ret[0]);
702
2401
  }
703
2402
 
704
2403
  /**
705
- * The webhook signing key request.
706
- * @param {any} endpoints_
707
- * @returns {any}
2404
+ * Changes what `fields` sets of reward `id`.
2405
+ * @param {string} token
2406
+ * @param {string} id
2407
+ * @param {RewardFields} fields
2408
+ * @param {Endpoints | null} [endpoints]
2409
+ * @returns {HttpRequest}
708
2410
  */
709
- export function publicKeyRequest(endpoints_) {
710
- const ret = wasm.publicKeyRequest(endpoints_);
711
- if (ret[2]) {
712
- throw takeFromExternrefTable0(ret[1]);
2411
+ export function rewardsUpdateRequest(token, id, fields, endpoints) {
2412
+ try {
2413
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2414
+ const ptr0 = passStringToWasm0(token, wasm.__wbindgen_export, wasm.__wbindgen_export2);
2415
+ const len0 = WASM_VECTOR_LEN;
2416
+ const ptr1 = passStringToWasm0(id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
2417
+ const len1 = WASM_VECTOR_LEN;
2418
+ wasm.rewardsUpdateRequest(retptr, ptr0, len0, ptr1, len1, addHeapObject(fields), isLikeNone(endpoints) ? 0 : addHeapObject(endpoints));
2419
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2420
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2421
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
2422
+ if (r2) {
2423
+ throw takeObject(r1);
2424
+ }
2425
+ return takeObject(r0);
2426
+ } finally {
2427
+ wasm.__wbindgen_add_to_stack_pointer(16);
713
2428
  }
714
- return takeFromExternrefTable0(ret[0]);
715
2429
  }
716
2430
 
717
2431
  /**
@@ -721,120 +2435,136 @@ export function publicKeyRequest(endpoints_) {
721
2435
  * @param {number} chatroom_id
722
2436
  * @param {string} text
723
2437
  * @param {string} message_ref
724
- * @param {any} reply_to
725
- * @param {any} endpoints_
2438
+ * @param {ReplyTo | null} [reply_to]
2439
+ * @param {Endpoints | null} [endpoints]
726
2440
  * @returns {any}
727
2441
  */
728
- export function sendRequest(session, chatroom_id, text, message_ref, reply_to, endpoints_) {
729
- const ptr0 = passStringToWasm0(session, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
730
- const len0 = WASM_VECTOR_LEN;
731
- const ptr1 = passStringToWasm0(text, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
732
- const len1 = WASM_VECTOR_LEN;
733
- const ptr2 = passStringToWasm0(message_ref, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
734
- const len2 = WASM_VECTOR_LEN;
735
- const ret = wasm.sendRequest(ptr0, len0, chatroom_id, ptr1, len1, ptr2, len2, reply_to, endpoints_);
736
- if (ret[2]) {
737
- throw takeFromExternrefTable0(ret[1]);
2442
+ export function sendRequest(session, chatroom_id, text, message_ref, reply_to, endpoints) {
2443
+ try {
2444
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2445
+ const ptr0 = passStringToWasm0(session, wasm.__wbindgen_export, wasm.__wbindgen_export2);
2446
+ const len0 = WASM_VECTOR_LEN;
2447
+ const ptr1 = passStringToWasm0(text, wasm.__wbindgen_export, wasm.__wbindgen_export2);
2448
+ const len1 = WASM_VECTOR_LEN;
2449
+ const ptr2 = passStringToWasm0(message_ref, wasm.__wbindgen_export, wasm.__wbindgen_export2);
2450
+ const len2 = WASM_VECTOR_LEN;
2451
+ wasm.sendRequest(retptr, ptr0, len0, addHeapObject(chatroom_id), ptr1, len1, ptr2, len2, isLikeNone(reply_to) ? 0 : addHeapObject(reply_to), isLikeNone(endpoints) ? 0 : addHeapObject(endpoints));
2452
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2453
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2454
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
2455
+ if (r2) {
2456
+ throw takeObject(r1);
2457
+ }
2458
+ return takeObject(r0);
2459
+ } finally {
2460
+ wasm.__wbindgen_add_to_stack_pointer(16);
738
2461
  }
739
- return takeFromExternrefTable0(ret[0]);
740
2462
  }
741
2463
 
742
2464
  /**
743
- * Subscribes the app to webhook `events` (`[{name, version}]`) for one channel.
2465
+ * Subscribes the app to webhook `events` (`[{name, version?}]`, version 1
2466
+ * when left out) for one channel.
744
2467
  * @param {string} token
745
2468
  * @param {number} broadcaster_user_id
746
- * @param {any} events
747
- * @param {any} endpoints_
2469
+ * @param {ReadonlyArray<{ name: string; version?: number }>} events
2470
+ * @param {Endpoints | null} [endpoints]
748
2471
  * @returns {any}
749
2472
  */
750
- export function subscribeRequest(token, broadcaster_user_id, events, endpoints_) {
751
- const ptr0 = passStringToWasm0(token, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
752
- const len0 = WASM_VECTOR_LEN;
753
- const ret = wasm.subscribeRequest(ptr0, len0, broadcaster_user_id, events, endpoints_);
754
- if (ret[2]) {
755
- throw takeFromExternrefTable0(ret[1]);
2473
+ export function subscribeRequest(token, broadcaster_user_id, events, endpoints) {
2474
+ try {
2475
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2476
+ const ptr0 = passStringToWasm0(token, wasm.__wbindgen_export, wasm.__wbindgen_export2);
2477
+ const len0 = WASM_VECTOR_LEN;
2478
+ wasm.subscribeRequest(retptr, ptr0, len0, addHeapObject(broadcaster_user_id), addHeapObject(events), isLikeNone(endpoints) ? 0 : addHeapObject(endpoints));
2479
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2480
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2481
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
2482
+ if (r2) {
2483
+ throw takeObject(r1);
2484
+ }
2485
+ return takeObject(r0);
2486
+ } finally {
2487
+ wasm.__wbindgen_add_to_stack_pointer(16);
756
2488
  }
757
- return takeFromExternrefTable0(ret[0]);
758
2489
  }
759
2490
 
760
2491
  /**
761
2492
  * Every webhook subscription the app has.
762
2493
  * @param {string} token
763
- * @param {any} endpoints_
2494
+ * @param {Endpoints | null} [endpoints]
764
2495
  * @returns {any}
765
2496
  */
766
- export function subscriptionsRequest(token, endpoints_) {
767
- const ptr0 = passStringToWasm0(token, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
768
- const len0 = WASM_VECTOR_LEN;
769
- const ret = wasm.subscriptionsRequest(ptr0, len0, endpoints_);
770
- if (ret[2]) {
771
- throw takeFromExternrefTable0(ret[1]);
2497
+ export function subscriptionsRequest(token, endpoints) {
2498
+ try {
2499
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2500
+ const ptr0 = passStringToWasm0(token, wasm.__wbindgen_export, wasm.__wbindgen_export2);
2501
+ const len0 = WASM_VECTOR_LEN;
2502
+ wasm.subscriptionsRequest(retptr, ptr0, len0, isLikeNone(endpoints) ? 0 : addHeapObject(endpoints));
2503
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2504
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2505
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
2506
+ if (r2) {
2507
+ throw takeObject(r1);
2508
+ }
2509
+ return takeObject(r0);
2510
+ } finally {
2511
+ wasm.__wbindgen_add_to_stack_pointer(16);
772
2512
  }
773
- return takeFromExternrefTable0(ret[0]);
774
2513
  }
775
2514
 
776
2515
  /**
777
- * Times a user out.
2516
+ * Times a user out for 1 to 10080 minutes.
778
2517
  * @param {string} session
779
2518
  * @param {string} channel_slug
780
2519
  * @param {string} username
781
2520
  * @param {number} minutes
782
- * @param {any} endpoints_
2521
+ * @param {Endpoints | null} [endpoints]
783
2522
  * @returns {any}
784
2523
  */
785
- export function timeoutRequest(session, channel_slug, username, minutes, endpoints_) {
786
- const ptr0 = passStringToWasm0(session, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
787
- const len0 = WASM_VECTOR_LEN;
788
- const ptr1 = passStringToWasm0(channel_slug, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
789
- const len1 = WASM_VECTOR_LEN;
790
- const ptr2 = passStringToWasm0(username, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
791
- const len2 = WASM_VECTOR_LEN;
792
- const ret = wasm.timeoutRequest(ptr0, len0, ptr1, len1, ptr2, len2, minutes, endpoints_);
793
- if (ret[2]) {
794
- throw takeFromExternrefTable0(ret[1]);
2524
+ export function timeoutRequest(session, channel_slug, username, minutes, endpoints) {
2525
+ try {
2526
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2527
+ const ptr0 = passStringToWasm0(session, wasm.__wbindgen_export, wasm.__wbindgen_export2);
2528
+ const len0 = WASM_VECTOR_LEN;
2529
+ const ptr1 = passStringToWasm0(channel_slug, wasm.__wbindgen_export, wasm.__wbindgen_export2);
2530
+ const len1 = WASM_VECTOR_LEN;
2531
+ const ptr2 = passStringToWasm0(username, wasm.__wbindgen_export, wasm.__wbindgen_export2);
2532
+ const len2 = WASM_VECTOR_LEN;
2533
+ wasm.timeoutRequest(retptr, ptr0, len0, ptr1, len1, ptr2, len2, addHeapObject(minutes), isLikeNone(endpoints) ? 0 : addHeapObject(endpoints));
2534
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2535
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2536
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
2537
+ if (r2) {
2538
+ throw takeObject(r1);
2539
+ }
2540
+ return takeObject(r0);
2541
+ } finally {
2542
+ wasm.__wbindgen_add_to_stack_pointer(16);
795
2543
  }
796
- return takeFromExternrefTable0(ret[0]);
797
2544
  }
798
2545
 
799
2546
  /**
800
2547
  * A guest token request for `clientId`.
801
2548
  * @param {string} client_id
802
- * @param {any} endpoints_
2549
+ * @param {Endpoints | null} [endpoints]
803
2550
  * @returns {any}
804
2551
  */
805
- export function tokenRequest(client_id, endpoints_) {
806
- const ptr0 = passStringToWasm0(client_id, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
807
- const len0 = WASM_VECTOR_LEN;
808
- const ret = wasm.tokenRequest(ptr0, len0, endpoints_);
809
- if (ret[2]) {
810
- throw takeFromExternrefTable0(ret[1]);
811
- }
812
- return takeFromExternrefTable0(ret[0]);
813
- }
814
-
815
- /**
816
- * The top live streams, overall or in a category or language: up to 100.
817
- * `sort` is `"viewer_count"` (the default) or `"started_at"`.
818
- * @param {string} token
819
- * @param {number | null | undefined} category_id
820
- * @param {string | null | undefined} language
821
- * @param {string | null | undefined} sort
822
- * @param {number | null | undefined} limit
823
- * @param {any} endpoints_
824
- * @returns {any}
825
- */
826
- export function topLivestreamsRequest(token, category_id, language, sort, limit, endpoints_) {
827
- const ptr0 = passStringToWasm0(token, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
828
- const len0 = WASM_VECTOR_LEN;
829
- var ptr1 = isLikeNone(language) ? 0 : passStringToWasm0(language, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
830
- var len1 = WASM_VECTOR_LEN;
831
- var ptr2 = isLikeNone(sort) ? 0 : passStringToWasm0(sort, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
832
- var len2 = WASM_VECTOR_LEN;
833
- const ret = wasm.topLivestreamsRequest(ptr0, len0, !isLikeNone(category_id), isLikeNone(category_id) ? 0 : category_id, ptr1, len1, ptr2, len2, isLikeNone(limit) ? Number.MAX_SAFE_INTEGER : (limit) >>> 0, endpoints_);
834
- if (ret[2]) {
835
- throw takeFromExternrefTable0(ret[1]);
2552
+ export function tokenRequest(client_id, endpoints) {
2553
+ try {
2554
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2555
+ const ptr0 = passStringToWasm0(client_id, wasm.__wbindgen_export, wasm.__wbindgen_export2);
2556
+ const len0 = WASM_VECTOR_LEN;
2557
+ wasm.tokenRequest(retptr, ptr0, len0, isLikeNone(endpoints) ? 0 : addHeapObject(endpoints));
2558
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2559
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2560
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
2561
+ if (r2) {
2562
+ throw takeObject(r1);
2563
+ }
2564
+ return takeObject(r0);
2565
+ } finally {
2566
+ wasm.__wbindgen_add_to_stack_pointer(16);
836
2567
  }
837
- return takeFromExternrefTable0(ret[0]);
838
2568
  }
839
2569
 
840
2570
  /**
@@ -842,159 +2572,221 @@ export function topLivestreamsRequest(token, category_id, language, sort, limit,
842
2572
  * @param {string} session
843
2573
  * @param {string} channel_slug
844
2574
  * @param {string} username
845
- * @param {any} endpoints_
2575
+ * @param {Endpoints | null} [endpoints]
846
2576
  * @returns {any}
847
2577
  */
848
- export function unbanRequest(session, channel_slug, username, endpoints_) {
849
- const ptr0 = passStringToWasm0(session, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
850
- const len0 = WASM_VECTOR_LEN;
851
- const ptr1 = passStringToWasm0(channel_slug, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
852
- const len1 = WASM_VECTOR_LEN;
853
- const ptr2 = passStringToWasm0(username, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
854
- const len2 = WASM_VECTOR_LEN;
855
- const ret = wasm.unbanRequest(ptr0, len0, ptr1, len1, ptr2, len2, endpoints_);
856
- if (ret[2]) {
857
- throw takeFromExternrefTable0(ret[1]);
2578
+ export function unbanRequest(session, channel_slug, username, endpoints) {
2579
+ try {
2580
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2581
+ const ptr0 = passStringToWasm0(session, wasm.__wbindgen_export, wasm.__wbindgen_export2);
2582
+ const len0 = WASM_VECTOR_LEN;
2583
+ const ptr1 = passStringToWasm0(channel_slug, wasm.__wbindgen_export, wasm.__wbindgen_export2);
2584
+ const len1 = WASM_VECTOR_LEN;
2585
+ const ptr2 = passStringToWasm0(username, wasm.__wbindgen_export, wasm.__wbindgen_export2);
2586
+ const len2 = WASM_VECTOR_LEN;
2587
+ wasm.unbanRequest(retptr, ptr0, len0, ptr1, len1, ptr2, len2, isLikeNone(endpoints) ? 0 : addHeapObject(endpoints));
2588
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2589
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2590
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
2591
+ if (r2) {
2592
+ throw takeObject(r1);
2593
+ }
2594
+ return takeObject(r0);
2595
+ } finally {
2596
+ wasm.__wbindgen_add_to_stack_pointer(16);
858
2597
  }
859
- return takeFromExternrefTable0(ret[0]);
860
2598
  }
861
2599
 
862
2600
  /**
863
2601
  * Removes the pin.
864
2602
  * @param {string} session
865
2603
  * @param {string} channel_slug
866
- * @param {any} endpoints_
2604
+ * @param {Endpoints | null} [endpoints]
867
2605
  * @returns {any}
868
2606
  */
869
- export function unpinRequest(session, channel_slug, endpoints_) {
870
- const ptr0 = passStringToWasm0(session, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
871
- const len0 = WASM_VECTOR_LEN;
872
- const ptr1 = passStringToWasm0(channel_slug, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
873
- const len1 = WASM_VECTOR_LEN;
874
- const ret = wasm.unpinRequest(ptr0, len0, ptr1, len1, endpoints_);
875
- if (ret[2]) {
876
- throw takeFromExternrefTable0(ret[1]);
2607
+ export function unpinRequest(session, channel_slug, endpoints) {
2608
+ try {
2609
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2610
+ const ptr0 = passStringToWasm0(session, wasm.__wbindgen_export, wasm.__wbindgen_export2);
2611
+ const len0 = WASM_VECTOR_LEN;
2612
+ const ptr1 = passStringToWasm0(channel_slug, wasm.__wbindgen_export, wasm.__wbindgen_export2);
2613
+ const len1 = WASM_VECTOR_LEN;
2614
+ wasm.unpinRequest(retptr, ptr0, len0, ptr1, len1, isLikeNone(endpoints) ? 0 : addHeapObject(endpoints));
2615
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2616
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2617
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
2618
+ if (r2) {
2619
+ throw takeObject(r1);
2620
+ }
2621
+ return takeObject(r0);
2622
+ } finally {
2623
+ wasm.__wbindgen_add_to_stack_pointer(16);
877
2624
  }
878
- return takeFromExternrefTable0(ret[0]);
879
2625
  }
880
2626
 
881
2627
  /**
882
2628
  * Removes subscriptions, 50 per request.
883
2629
  * @param {string} token
884
2630
  * @param {string[]} ids
885
- * @param {any} endpoints_
2631
+ * @param {Endpoints | null} [endpoints]
886
2632
  * @returns {any}
887
2633
  */
888
- export function unsubscribeRequests(token, ids, endpoints_) {
889
- const ptr0 = passStringToWasm0(token, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
890
- const len0 = WASM_VECTOR_LEN;
891
- const ptr1 = passArrayJsValueToWasm0(ids, wasm.__wbindgen_malloc);
892
- const len1 = WASM_VECTOR_LEN;
893
- const ret = wasm.unsubscribeRequests(ptr0, len0, ptr1, len1, endpoints_);
894
- if (ret[2]) {
895
- throw takeFromExternrefTable0(ret[1]);
2634
+ export function unsubscribeRequests(token, ids, endpoints) {
2635
+ try {
2636
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2637
+ const ptr0 = passStringToWasm0(token, wasm.__wbindgen_export, wasm.__wbindgen_export2);
2638
+ const len0 = WASM_VECTOR_LEN;
2639
+ const ptr1 = passArrayJsValueToWasm0(ids, wasm.__wbindgen_export);
2640
+ const len1 = WASM_VECTOR_LEN;
2641
+ wasm.unsubscribeRequests(retptr, ptr0, len0, ptr1, len1, isLikeNone(endpoints) ? 0 : addHeapObject(endpoints));
2642
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2643
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2644
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
2645
+ if (r2) {
2646
+ throw takeObject(r1);
2647
+ }
2648
+ return takeObject(r0);
2649
+ } finally {
2650
+ wasm.__wbindgen_add_to_stack_pointer(16);
2651
+ }
2652
+ }
2653
+
2654
+ /**
2655
+ * Users by id, up to 50; none, with a user token: the token's own user.
2656
+ * @param {string} token
2657
+ * @param {readonly number[] | null} [user_ids]
2658
+ * @param {Endpoints | null} [endpoints]
2659
+ * @returns {HttpRequest}
2660
+ */
2661
+ export function usersRequest(token, user_ids, endpoints) {
2662
+ try {
2663
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2664
+ const ptr0 = passStringToWasm0(token, wasm.__wbindgen_export, wasm.__wbindgen_export2);
2665
+ const len0 = WASM_VECTOR_LEN;
2666
+ wasm.usersRequest(retptr, ptr0, len0, isLikeNone(user_ids) ? 0 : addHeapObject(user_ids), isLikeNone(endpoints) ? 0 : addHeapObject(endpoints));
2667
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2668
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2669
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
2670
+ if (r2) {
2671
+ throw takeObject(r1);
2672
+ }
2673
+ return takeObject(r0);
2674
+ } finally {
2675
+ wasm.__wbindgen_add_to_stack_pointer(16);
896
2676
  }
897
- return takeFromExternrefTable0(ret[0]);
898
2677
  }
899
2678
 
900
2679
  /**
901
- * Checks a delivery: `headers` as `[[name, value]…]` or an object, `body` the
902
- * raw text. Returns the typed event, or throws.
2680
+ * Checks a delivery and returns `{headers, event}`, or throws. `headers` as
2681
+ * `[[name, value]…]`, a fetch `Headers` or an object; `body` the raw body,
2682
+ * as text or bytes. The timestamp must be within 5 minutes of this
2683
+ * machine's clock, unless `options` says otherwise: `now` (Unix seconds),
2684
+ * `toleranceSecs`, or `skipFreshness: true` to re-check a stored delivery.
2685
+ *
2686
+ * A receiver checking many deliveries reads the key once, with
2687
+ * `new WebhookPublicKey(pem)`, and calls its `verify`.
903
2688
  * @param {string} public_key_pem
904
- * @param {any} headers
905
- * @param {string} body
906
- * @returns {any}
2689
+ * @param {WebhookHeaders} headers
2690
+ * @param {string | Uint8Array | ArrayBuffer} body
2691
+ * @param {VerifyOptions | null} [options]
2692
+ * @returns {VerifiedWebhook}
907
2693
  */
908
- export function verifyWebhook(public_key_pem, headers, body) {
909
- const ptr0 = passStringToWasm0(public_key_pem, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
910
- const len0 = WASM_VECTOR_LEN;
911
- const ptr1 = passStringToWasm0(body, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
912
- const len1 = WASM_VECTOR_LEN;
913
- const ret = wasm.verifyWebhook(ptr0, len0, headers, ptr1, len1);
914
- if (ret[2]) {
915
- throw takeFromExternrefTable0(ret[1]);
2694
+ export function verifyWebhook(public_key_pem, headers, body, options) {
2695
+ try {
2696
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
2697
+ const ptr0 = passStringToWasm0(public_key_pem, wasm.__wbindgen_export, wasm.__wbindgen_export2);
2698
+ const len0 = WASM_VECTOR_LEN;
2699
+ wasm.verifyWebhook(retptr, ptr0, len0, addHeapObject(headers), addHeapObject(body), isLikeNone(options) ? 0 : addHeapObject(options));
2700
+ var r0 = getDataViewMemory0().getInt32(retptr + 4 * 0, true);
2701
+ var r1 = getDataViewMemory0().getInt32(retptr + 4 * 1, true);
2702
+ var r2 = getDataViewMemory0().getInt32(retptr + 4 * 2, true);
2703
+ if (r2) {
2704
+ throw takeObject(r1);
2705
+ }
2706
+ return takeObject(r0);
2707
+ } finally {
2708
+ wasm.__wbindgen_add_to_stack_pointer(16);
916
2709
  }
917
- return takeFromExternrefTable0(ret[0]);
918
2710
  }
919
2711
  function __wbg_get_imports() {
920
2712
  const import0 = {
921
2713
  __proto__: null,
922
2714
  __wbg_Error_30c8987f7c2ed4e2: function(arg0, arg1) {
923
2715
  const ret = Error(getStringFromWasm0(arg0, arg1));
924
- return ret;
2716
+ return addHeapObject(ret);
925
2717
  },
926
2718
  __wbg_String_8564e559799eccda: function(arg0, arg1) {
927
- const ret = String(arg1);
928
- const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2719
+ const ret = String(getObject(arg1));
2720
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
929
2721
  const len1 = WASM_VECTOR_LEN;
930
2722
  getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
931
2723
  getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
932
2724
  },
933
2725
  __wbg___wbindgen_bigint_get_as_i64_a2383202b9353e4c: function(arg0, arg1) {
934
- const v = arg1;
2726
+ const v = getObject(arg1);
935
2727
  const ret = typeof(v) === 'bigint' ? v : undefined;
936
2728
  getDataViewMemory0().setBigInt64(arg0 + 8 * 1, isLikeNone(ret) ? BigInt(0) : ret, true);
937
2729
  getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
938
2730
  },
939
2731
  __wbg___wbindgen_boolean_get_5b446f51afd21013: function(arg0) {
940
- const v = arg0;
2732
+ const v = getObject(arg0);
941
2733
  const ret = typeof(v) === 'boolean' ? v : undefined;
942
2734
  return isLikeNone(ret) ? 0xFFFFFF : ret ? 1 : 0;
943
2735
  },
944
2736
  __wbg___wbindgen_debug_string_4687d8d8c2017d52: function(arg0, arg1) {
945
- const ret = debugString(arg1);
946
- const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2737
+ const ret = debugString(getObject(arg1));
2738
+ const ptr1 = passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
947
2739
  const len1 = WASM_VECTOR_LEN;
948
2740
  getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
949
2741
  getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
950
2742
  },
951
2743
  __wbg___wbindgen_in_92f62ee1427d9e49: function(arg0, arg1) {
952
- const ret = arg0 in arg1;
2744
+ const ret = getObject(arg0) in getObject(arg1);
953
2745
  return ret;
954
2746
  },
955
2747
  __wbg___wbindgen_is_bigint_b123553bed3bb382: function(arg0) {
956
- const ret = typeof(arg0) === 'bigint';
2748
+ const ret = typeof(getObject(arg0)) === 'bigint';
957
2749
  return ret;
958
2750
  },
959
2751
  __wbg___wbindgen_is_function_1f9d30630b8b1d3d: function(arg0) {
960
- const ret = typeof(arg0) === 'function';
2752
+ const ret = typeof(getObject(arg0)) === 'function';
961
2753
  return ret;
962
2754
  },
963
2755
  __wbg___wbindgen_is_null_e343b7d08827ba72: function(arg0) {
964
- const ret = arg0 === null;
2756
+ const ret = getObject(arg0) === null;
965
2757
  return ret;
966
2758
  },
967
2759
  __wbg___wbindgen_is_object_3c45d4f2dde4e749: function(arg0) {
968
- const val = arg0;
2760
+ const val = getObject(arg0);
969
2761
  const ret = typeof(val) === 'object' && val !== null;
970
2762
  return ret;
971
2763
  },
972
2764
  __wbg___wbindgen_is_string_90b56bc79aad6f6c: function(arg0) {
973
- const ret = typeof(arg0) === 'string';
2765
+ const ret = typeof(getObject(arg0)) === 'string';
974
2766
  return ret;
975
2767
  },
976
2768
  __wbg___wbindgen_is_undefined_8865fb403f8fe9d8: function(arg0) {
977
- const ret = arg0 === undefined;
2769
+ const ret = getObject(arg0) === undefined;
978
2770
  return ret;
979
2771
  },
980
2772
  __wbg___wbindgen_jsval_eq_02babf21faa37971: function(arg0, arg1) {
981
- const ret = arg0 === arg1;
2773
+ const ret = getObject(arg0) === getObject(arg1);
982
2774
  return ret;
983
2775
  },
984
2776
  __wbg___wbindgen_jsval_loose_eq_677f21e468d6b461: function(arg0, arg1) {
985
- const ret = arg0 == arg1;
2777
+ const ret = getObject(arg0) == getObject(arg1);
986
2778
  return ret;
987
2779
  },
988
2780
  __wbg___wbindgen_number_get_2e0e7dee9f701a71: function(arg0, arg1) {
989
- const obj = arg1;
2781
+ const obj = getObject(arg1);
990
2782
  const ret = typeof(obj) === 'number' ? obj : undefined;
991
2783
  getDataViewMemory0().setFloat64(arg0 + 8 * 1, isLikeNone(ret) ? 0 : ret, true);
992
2784
  getDataViewMemory0().setInt32(arg0 + 4 * 0, !isLikeNone(ret), true);
993
2785
  },
994
2786
  __wbg___wbindgen_string_get_0380ccaa2f57f0d9: function(arg0, arg1) {
995
- const obj = arg1;
2787
+ const obj = getObject(arg1);
996
2788
  const ret = typeof(obj) === 'string' ? obj : undefined;
997
- var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
2789
+ var ptr1 = isLikeNone(ret) ? 0 : passStringToWasm0(ret, wasm.__wbindgen_export, wasm.__wbindgen_export2);
998
2790
  var len1 = WASM_VECTOR_LEN;
999
2791
  getDataViewMemory0().setInt32(arg0 + 4 * 1, len1, true);
1000
2792
  getDataViewMemory0().setInt32(arg0 + 4 * 0, ptr1, true);
@@ -1003,33 +2795,37 @@ function __wbg_get_imports() {
1003
2795
  throw new Error(getStringFromWasm0(arg0, arg1));
1004
2796
  },
1005
2797
  __wbg_call_6137034ef55c9d0f: function() { return handleError(function (arg0, arg1) {
1006
- const ret = arg0.call(arg1);
1007
- return ret;
2798
+ const ret = getObject(arg0).call(getObject(arg1));
2799
+ return addHeapObject(ret);
1008
2800
  }, arguments); },
1009
2801
  __wbg_done_b41a1d26cdb37fb6: function(arg0) {
1010
- const ret = arg0.done;
2802
+ const ret = getObject(arg0).done;
1011
2803
  return ret;
1012
2804
  },
1013
2805
  __wbg_entries_fb6397112b1de25f: function(arg0) {
1014
- const ret = Object.entries(arg0);
1015
- return ret;
2806
+ const ret = Object.entries(getObject(arg0));
2807
+ return addHeapObject(ret);
1016
2808
  },
2809
+ __wbg_get_31af05bd4842a84f: function() { return handleError(function (arg0, arg1) {
2810
+ const ret = Reflect.get(getObject(arg0), getObject(arg1));
2811
+ return addHeapObject(ret);
2812
+ }, arguments); },
1017
2813
  __wbg_get_658f6698067d9515: function() { return handleError(function (arg0, arg1) {
1018
- const ret = Reflect.get(arg0, arg1);
1019
- return ret;
2814
+ const ret = Reflect.get(getObject(arg0), getObject(arg1));
2815
+ return addHeapObject(ret);
1020
2816
  }, arguments); },
1021
2817
  __wbg_get_6c896e0571ddae51: function(arg0, arg1) {
1022
- const ret = arg0[arg1 >>> 0];
1023
- return ret;
2818
+ const ret = getObject(arg0)[arg1 >>> 0];
2819
+ return addHeapObject(ret);
1024
2820
  },
1025
2821
  __wbg_get_unchecked_288889d017702237: function(arg0, arg1) {
1026
- const ret = arg0[arg1 >>> 0];
1027
- return ret;
2822
+ const ret = getObject(arg0)[arg1 >>> 0];
2823
+ return addHeapObject(ret);
1028
2824
  },
1029
2825
  __wbg_instanceof_ArrayBuffer_a99f175873e5d9b8: function(arg0) {
1030
2826
  let result;
1031
2827
  try {
1032
- result = arg0 instanceof ArrayBuffer;
2828
+ result = getObject(arg0) instanceof ArrayBuffer;
1033
2829
  } catch (_) {
1034
2830
  result = false;
1035
2831
  }
@@ -1039,7 +2835,7 @@ function __wbg_get_imports() {
1039
2835
  __wbg_instanceof_Map_b2611749102d7ba3: function(arg0) {
1040
2836
  let result;
1041
2837
  try {
1042
- result = arg0 instanceof Map;
2838
+ result = getObject(arg0) instanceof Map;
1043
2839
  } catch (_) {
1044
2840
  result = false;
1045
2841
  }
@@ -1049,7 +2845,7 @@ function __wbg_get_imports() {
1049
2845
  __wbg_instanceof_Uint8Array_828cef2aaacafc31: function(arg0) {
1050
2846
  let result;
1051
2847
  try {
1052
- result = arg0 instanceof Uint8Array;
2848
+ result = getObject(arg0) instanceof Uint8Array;
1053
2849
  } catch (_) {
1054
2850
  result = false;
1055
2851
  }
@@ -1057,102 +2853,116 @@ function __wbg_get_imports() {
1057
2853
  return ret;
1058
2854
  },
1059
2855
  __wbg_isArray_e15a2ff68ffdbef2: function(arg0) {
1060
- const ret = Array.isArray(arg0);
2856
+ const ret = Array.isArray(getObject(arg0));
1061
2857
  return ret;
1062
2858
  },
1063
2859
  __wbg_isSafeInteger_717808ad6a54bd9e: function(arg0) {
1064
- const ret = Number.isSafeInteger(arg0);
2860
+ const ret = Number.isSafeInteger(getObject(arg0));
1065
2861
  return ret;
1066
2862
  },
1067
2863
  __wbg_iterator_e3c31c892080e444: function() {
1068
2864
  const ret = Symbol.iterator;
1069
- return ret;
2865
+ return addHeapObject(ret);
2866
+ },
2867
+ __wbg_keys_440be172f17c0265: function(arg0) {
2868
+ const ret = Object.keys(getObject(arg0));
2869
+ return addHeapObject(ret);
1070
2870
  },
1071
2871
  __wbg_length_7f3c00c40364105e: function(arg0) {
1072
- const ret = arg0.length;
2872
+ const ret = getObject(arg0).length;
1073
2873
  return ret;
1074
2874
  },
1075
2875
  __wbg_length_d4bdea10311bd9cf: function(arg0) {
1076
- const ret = arg0.length;
2876
+ const ret = getObject(arg0).length;
1077
2877
  return ret;
1078
2878
  },
1079
2879
  __wbg_new_1dbf7428bba60a42: function(arg0) {
1080
- const ret = new Uint8Array(arg0);
1081
- return ret;
2880
+ const ret = new Uint8Array(getObject(arg0));
2881
+ return addHeapObject(ret);
1082
2882
  },
1083
2883
  __wbg_new_28744009d011f847: function() {
1084
2884
  const ret = new Map();
1085
- return ret;
2885
+ return addHeapObject(ret);
2886
+ },
2887
+ __wbg_new_2bdcdfcebdfc34d2: function(arg0, arg1) {
2888
+ const ret = new TypeError(getStringFromWasm0(arg0, arg1));
2889
+ return addHeapObject(ret);
1086
2890
  },
1087
2891
  __wbg_new_343a093a3c2ffb4e: function(arg0, arg1) {
1088
2892
  const ret = new Error(getStringFromWasm0(arg0, arg1));
1089
- return ret;
2893
+ return addHeapObject(ret);
1090
2894
  },
1091
2895
  __wbg_new_617a8cdb8bb1130e: function() {
1092
2896
  const ret = new Object();
1093
- return ret;
2897
+ return addHeapObject(ret);
2898
+ },
2899
+ __wbg_new_6ab88fbe741af6b5: function(arg0, arg1) {
2900
+ const ret = new RangeError(getStringFromWasm0(arg0, arg1));
2901
+ return addHeapObject(ret);
1094
2902
  },
1095
2903
  __wbg_new_ee2291f50781bf1d: function() {
1096
2904
  const ret = new Array();
1097
- return ret;
2905
+ return addHeapObject(ret);
1098
2906
  },
1099
2907
  __wbg_next_33784799010f1bbe: function(arg0) {
1100
- const ret = arg0.next;
1101
- return ret;
2908
+ const ret = getObject(arg0).next;
2909
+ return addHeapObject(ret);
1102
2910
  },
1103
2911
  __wbg_next_f4aac29c42af995c: function() { return handleError(function (arg0) {
1104
- const ret = arg0.next();
1105
- return ret;
2912
+ const ret = getObject(arg0).next();
2913
+ return addHeapObject(ret);
1106
2914
  }, arguments); },
2915
+ __wbg_now_aa4ccb83129e9e55: function() {
2916
+ const ret = Date.now();
2917
+ return ret;
2918
+ },
1107
2919
  __wbg_prototypesetcall_bc27214492979395: function(arg0, arg1, arg2) {
1108
- Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), arg2);
2920
+ Uint8Array.prototype.set.call(getArrayU8FromWasm0(arg0, arg1), getObject(arg2));
1109
2921
  },
1110
2922
  __wbg_set_145a351398b48c65: function() { return handleError(function (arg0, arg1, arg2) {
1111
- const ret = Reflect.set(arg0, arg1, arg2);
2923
+ const ret = Reflect.set(getObject(arg0), getObject(arg1), getObject(arg2));
1112
2924
  return ret;
1113
2925
  }, arguments); },
1114
2926
  __wbg_set_6ae97e73113c4f0b: function(arg0, arg1, arg2) {
1115
- const ret = arg0.set(arg1, arg2);
1116
- return ret;
2927
+ const ret = getObject(arg0).set(getObject(arg1), getObject(arg2));
2928
+ return addHeapObject(ret);
1117
2929
  },
1118
2930
  __wbg_set_6be42768c690e380: function(arg0, arg1, arg2) {
1119
- arg0[arg1] = arg2;
2931
+ getObject(arg0)[takeObject(arg1)] = takeObject(arg2);
1120
2932
  },
1121
2933
  __wbg_set_bea140a88be9b277: function(arg0, arg1, arg2) {
1122
- arg0[arg1 >>> 0] = arg2;
2934
+ getObject(arg0)[arg1 >>> 0] = takeObject(arg2);
1123
2935
  },
1124
2936
  __wbg_value_f3c585ee8f5ba40c: function(arg0) {
1125
- const ret = arg0.value;
1126
- return ret;
2937
+ const ret = getObject(arg0).value;
2938
+ return addHeapObject(ret);
1127
2939
  },
1128
2940
  __wbindgen_generic_0000000000000001: function(arg0) {
1129
2941
  // Cast intrinsic for `F64 -> Externref`.
1130
2942
  const ret = arg0;
1131
- return ret;
2943
+ return addHeapObject(ret);
1132
2944
  },
1133
2945
  __wbindgen_generic_0000000000000002: function(arg0) {
1134
2946
  // Cast intrinsic for `I64 -> Externref`.
1135
2947
  const ret = arg0;
1136
- return ret;
2948
+ return addHeapObject(ret);
1137
2949
  },
1138
2950
  __wbindgen_generic_0000000000000003: function(arg0, arg1) {
1139
2951
  // Cast intrinsic for `Ref(String) -> Externref`.
1140
2952
  const ret = getStringFromWasm0(arg0, arg1);
1141
- return ret;
2953
+ return addHeapObject(ret);
1142
2954
  },
1143
2955
  __wbindgen_generic_0000000000000004: function(arg0) {
1144
2956
  // Cast intrinsic for `U64 -> Externref`.
1145
2957
  const ret = BigInt.asUintN(64, arg0);
1146
- return ret;
2958
+ return addHeapObject(ret);
2959
+ },
2960
+ __wbindgen_object_clone_ref: function(arg0) {
2961
+ const ret = getObject(arg0);
2962
+ return addHeapObject(ret);
1147
2963
  },
1148
- __wbindgen_init_externref_table: function() {
1149
- const table = wasm.__wbindgen_externrefs;
1150
- const offset = table.grow(4);
1151
- table.set(0, undefined);
1152
- table.set(offset + 0, undefined);
1153
- table.set(offset + 1, null);
1154
- table.set(offset + 2, true);
1155
- table.set(offset + 3, false);
2964
+ __wbindgen_object_drop_ref: function(arg0) {
2965
+ takeObject(arg0);
1156
2966
  },
1157
2967
  };
1158
2968
  return {
@@ -1167,10 +2977,16 @@ const BackoffFinalization = (typeof FinalizationRegistry === 'undefined')
1167
2977
  const SessionFinalization = (typeof FinalizationRegistry === 'undefined')
1168
2978
  ? { register: () => {}, unregister: () => {} }
1169
2979
  : new FinalizationRegistry(ptr => wasm.__wbg_session_free(ptr, 1));
2980
+ const WebhookPublicKeyFinalization = (typeof FinalizationRegistry === 'undefined')
2981
+ ? { register: () => {}, unregister: () => {} }
2982
+ : new FinalizationRegistry(ptr => wasm.__wbg_webhookpublickey_free(ptr, 1));
2983
+
2984
+ function addHeapObject(obj) {
2985
+ if (heap_next === heap.length) heap.push(heap.length + 1);
2986
+ const idx = heap_next;
2987
+ heap_next = heap[idx];
1170
2988
 
1171
- function addToExternrefTable0(obj) {
1172
- const idx = wasm.__externref_table_alloc();
1173
- wasm.__wbindgen_externrefs.set(idx, obj);
2989
+ heap[idx] = obj;
1174
2990
  return idx;
1175
2991
  }
1176
2992
 
@@ -1239,14 +3055,19 @@ function debugString(val) {
1239
3055
  return className;
1240
3056
  }
1241
3057
 
3058
+ function dropObject(idx) {
3059
+ if (idx < 1028) return;
3060
+ heap[idx] = heap_next;
3061
+ heap_next = idx;
3062
+ }
3063
+
1242
3064
  function getArrayJsValueFromWasm0(ptr, len) {
1243
3065
  ptr = ptr >>> 0;
1244
3066
  const mem = getDataViewMemory0();
1245
3067
  const result = [];
1246
3068
  for (let i = ptr; i < ptr + 4 * len; i += 4) {
1247
- result.push(wasm.__wbindgen_externrefs.get(mem.getUint32(i, true)));
3069
+ result.push(takeObject(mem.getUint32(i, true)));
1248
3070
  }
1249
- wasm.__externref_drop_slice(ptr, len);
1250
3071
  return result;
1251
3072
  }
1252
3073
 
@@ -1263,14 +3084,6 @@ function getDataViewMemory0() {
1263
3084
  return cachedDataViewMemory0;
1264
3085
  }
1265
3086
 
1266
- let cachedFloat64ArrayMemory0 = null;
1267
- function getFloat64ArrayMemory0() {
1268
- if (cachedFloat64ArrayMemory0 === null || cachedFloat64ArrayMemory0.byteLength === 0) {
1269
- cachedFloat64ArrayMemory0 = new Float64Array(wasm.memory.buffer);
1270
- }
1271
- return cachedFloat64ArrayMemory0;
1272
- }
1273
-
1274
3087
  function getStringFromWasm0(ptr, len) {
1275
3088
  return decodeText(ptr >>> 0, len);
1276
3089
  }
@@ -1283,31 +3096,30 @@ function getUint8ArrayMemory0() {
1283
3096
  return cachedUint8ArrayMemory0;
1284
3097
  }
1285
3098
 
3099
+ function getObject(idx) { return heap[idx]; }
3100
+
1286
3101
  function handleError(f, args) {
1287
3102
  try {
1288
3103
  return f.apply(this, args);
1289
3104
  } catch (e) {
1290
- const idx = addToExternrefTable0(e);
1291
- wasm.__wbindgen_exn_store(idx);
3105
+ wasm.__wbindgen_export3(addHeapObject(e));
1292
3106
  }
1293
3107
  }
1294
3108
 
3109
+ let heap = new Array(1024).fill(undefined);
3110
+ heap.push(undefined, null, true, false);
3111
+
3112
+ let heap_next = heap.length;
3113
+
1295
3114
  function isLikeNone(x) {
1296
3115
  return x === undefined || x === null;
1297
3116
  }
1298
3117
 
1299
- function passArrayF64ToWasm0(arg, malloc) {
1300
- const ptr = malloc(arg.length * 8, 8) >>> 0;
1301
- getFloat64ArrayMemory0().set(arg, ptr / 8);
1302
- WASM_VECTOR_LEN = arg.length;
1303
- return ptr;
1304
- }
1305
-
1306
3118
  function passArrayJsValueToWasm0(array, malloc) {
1307
3119
  const ptr = malloc(array.length * 4, 4) >>> 0;
3120
+ const mem = getDataViewMemory0();
1308
3121
  for (let i = 0; i < array.length; i++) {
1309
- const add = addToExternrefTable0(array[i]);
1310
- getDataViewMemory0().setUint32(ptr + 4 * i, add, true);
3122
+ mem.setUint32(ptr + 4 * i, addHeapObject(array[i]), true);
1311
3123
  }
1312
3124
  WASM_VECTOR_LEN = array.length;
1313
3125
  return ptr;
@@ -1350,10 +3162,10 @@ function passStringToWasm0(arg, malloc, realloc) {
1350
3162
  return ptr;
1351
3163
  }
1352
3164
 
1353
- function takeFromExternrefTable0(idx) {
1354
- const value = wasm.__wbindgen_externrefs.get(idx);
1355
- wasm.__externref_table_dealloc(idx);
1356
- return value;
3165
+ function takeObject(idx) {
3166
+ const ret = getObject(idx);
3167
+ dropObject(idx);
3168
+ return ret;
1357
3169
  }
1358
3170
 
1359
3171
  let cachedTextDecoder = new TextDecoder('utf-8', { ignoreBOM: true, fatal: true });
@@ -1391,9 +3203,7 @@ function __wbg_finalize_init(instance, module) {
1391
3203
  wasm = instance.exports;
1392
3204
  wasmModule = module;
1393
3205
  cachedDataViewMemory0 = null;
1394
- cachedFloat64ArrayMemory0 = null;
1395
3206
  cachedUint8ArrayMemory0 = null;
1396
- wasm.__wbindgen_start();
1397
3207
  return wasm;
1398
3208
  }
1399
3209