@discordjs/rest 0.6.0-dev.1656547798-27d8deb → 0.6.0-dev.1656677085-741b3c8
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/dist/index.d.ts +146 -88
- package/dist/index.js +3 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +3 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +3 -2
package/dist/index.d.ts
CHANGED
|
@@ -38,11 +38,13 @@ interface RequestData {
|
|
|
38
38
|
appendToFormData?: boolean;
|
|
39
39
|
/**
|
|
40
40
|
* If this request needs the `Authorization` header
|
|
41
|
+
*
|
|
41
42
|
* @default true
|
|
42
43
|
*/
|
|
43
44
|
auth?: boolean;
|
|
44
45
|
/**
|
|
45
46
|
* The authorization prefix to use for this request, useful if you use this with bearer tokens
|
|
47
|
+
*
|
|
46
48
|
* @default 'Bot'
|
|
47
49
|
*/
|
|
48
50
|
authPrefix?: 'Bot' | 'Bearer';
|
|
@@ -78,6 +80,7 @@ interface RequestData {
|
|
|
78
80
|
reason?: string;
|
|
79
81
|
/**
|
|
80
82
|
* If this request should be versioned
|
|
83
|
+
*
|
|
81
84
|
* @default true
|
|
82
85
|
*/
|
|
83
86
|
versioned?: boolean;
|
|
@@ -174,30 +177,37 @@ declare class RequestManager extends EventEmitter {
|
|
|
174
177
|
private setupSweepers;
|
|
175
178
|
/**
|
|
176
179
|
* Sets the default agent to use for requests performed by this manager
|
|
177
|
-
*
|
|
180
|
+
*
|
|
181
|
+
* @param agent - The agent to use
|
|
178
182
|
*/
|
|
179
183
|
setAgent(agent: Dispatcher): this;
|
|
180
184
|
/**
|
|
181
185
|
* Sets the authorization token that should be used for requests
|
|
182
|
-
*
|
|
186
|
+
*
|
|
187
|
+
* @param token - The authorization token to use
|
|
183
188
|
*/
|
|
184
189
|
setToken(token: string): this;
|
|
185
190
|
/**
|
|
186
191
|
* Queues a request to be sent
|
|
187
|
-
*
|
|
192
|
+
*
|
|
193
|
+
* @param request - All the information needed to make a request
|
|
194
|
+
*
|
|
188
195
|
* @returns The response from the api request
|
|
189
196
|
*/
|
|
190
197
|
queueRequest(request: InternalRequest): Promise<Dispatcher.ResponseData>;
|
|
191
198
|
/**
|
|
192
199
|
* Creates a new rate limit handler from a hash, based on the hash and the major parameter
|
|
193
|
-
*
|
|
194
|
-
* @param
|
|
200
|
+
*
|
|
201
|
+
* @param hash - The hash for the route
|
|
202
|
+
* @param majorParameter - The major parameter for this handler
|
|
203
|
+
*
|
|
195
204
|
* @private
|
|
196
205
|
*/
|
|
197
206
|
private createHandler;
|
|
198
207
|
/**
|
|
199
208
|
* Formats the request data to a usable format for fetch
|
|
200
|
-
*
|
|
209
|
+
*
|
|
210
|
+
* @param request - The request data
|
|
201
211
|
*/
|
|
202
212
|
private resolveRequest;
|
|
203
213
|
/**
|
|
@@ -210,8 +220,10 @@ declare class RequestManager extends EventEmitter {
|
|
|
210
220
|
clearHandlerSweeper(): void;
|
|
211
221
|
/**
|
|
212
222
|
* Generates route data for an endpoint:method
|
|
213
|
-
*
|
|
214
|
-
* @param
|
|
223
|
+
*
|
|
224
|
+
* @param endpoint - The raw endpoint to generalize
|
|
225
|
+
* @param method - The HTTP method this endpoint is called without
|
|
226
|
+
*
|
|
215
227
|
* @private
|
|
216
228
|
*/
|
|
217
229
|
private static generateRouteData;
|
|
@@ -233,32 +245,38 @@ interface RESTOptions {
|
|
|
233
245
|
/**
|
|
234
246
|
* The authorization prefix to use for requests, useful if you want to use
|
|
235
247
|
* bearer tokens
|
|
248
|
+
*
|
|
236
249
|
* @default 'Bot'
|
|
237
250
|
*/
|
|
238
251
|
authPrefix: 'Bot' | 'Bearer';
|
|
239
252
|
/**
|
|
240
253
|
* The cdn path
|
|
254
|
+
*
|
|
241
255
|
* @default 'https://cdn.discordapp.com'
|
|
242
256
|
*/
|
|
243
257
|
cdn: string;
|
|
244
258
|
/**
|
|
245
259
|
* Additional headers to send for all API requests
|
|
260
|
+
*
|
|
246
261
|
* @default {}
|
|
247
262
|
*/
|
|
248
263
|
headers: Record<string, string>;
|
|
249
264
|
/**
|
|
250
265
|
* The number of invalid REST requests (those that return 401, 403, or 429) in a 10 minute window between emitted warnings (0 for no warnings).
|
|
251
266
|
* That is, if set to 500, warnings will be emitted at invalid request number 500, 1000, 1500, and so on.
|
|
267
|
+
*
|
|
252
268
|
* @default 0
|
|
253
269
|
*/
|
|
254
270
|
invalidRequestWarningInterval: number;
|
|
255
271
|
/**
|
|
256
272
|
* How many requests to allow sending per second (Infinity for unlimited, 50 for the standard global limit used by Discord)
|
|
273
|
+
*
|
|
257
274
|
* @default 50
|
|
258
275
|
*/
|
|
259
276
|
globalRequestsPerSecond: number;
|
|
260
277
|
/**
|
|
261
278
|
* The extra offset to add to rate limits in milliseconds
|
|
279
|
+
*
|
|
262
280
|
* @default 50
|
|
263
281
|
*/
|
|
264
282
|
offset: number;
|
|
@@ -267,42 +285,50 @@ interface RESTOptions {
|
|
|
267
285
|
* When an array of strings, each element is treated as a prefix for the request route
|
|
268
286
|
* (e.g. `/channels` to match any route starting with `/channels` such as `/channels/:id/messages`)
|
|
269
287
|
* for which to throw {@link RateLimitError}s. All other request routes will be queued normally
|
|
288
|
+
*
|
|
270
289
|
* @default null
|
|
271
290
|
*/
|
|
272
291
|
rejectOnRateLimit: string[] | RateLimitQueueFilter | null;
|
|
273
292
|
/**
|
|
274
293
|
* The number of retries for errors with the 500 code, or errors
|
|
275
294
|
* that timeout
|
|
295
|
+
*
|
|
276
296
|
* @default 3
|
|
277
297
|
*/
|
|
278
298
|
retries: number;
|
|
279
299
|
/**
|
|
280
300
|
* The time to wait in milliseconds before a request is aborted
|
|
301
|
+
*
|
|
281
302
|
* @default 15_000
|
|
282
303
|
*/
|
|
283
304
|
timeout: number;
|
|
284
305
|
/**
|
|
285
306
|
* Extra information to add to the user agent
|
|
307
|
+
*
|
|
286
308
|
* @default `Node.js ${process.version}`
|
|
287
309
|
*/
|
|
288
310
|
userAgentAppendix: string;
|
|
289
311
|
/**
|
|
290
312
|
* The version of the API to use
|
|
313
|
+
*
|
|
291
314
|
* @default '10'
|
|
292
315
|
*/
|
|
293
316
|
version: string;
|
|
294
317
|
/**
|
|
295
318
|
* The amount of time in milliseconds that passes between each hash sweep. (defaults to 4h)
|
|
319
|
+
*
|
|
296
320
|
* @default 14_400_000
|
|
297
321
|
*/
|
|
298
322
|
hashSweepInterval: number;
|
|
299
323
|
/**
|
|
300
324
|
* The maximum amount of time a hash can exist in milliseconds without being hit with a request (defaults to 24h)
|
|
325
|
+
*
|
|
301
326
|
* @default 86_400_000
|
|
302
327
|
*/
|
|
303
328
|
hashLifetime: number;
|
|
304
329
|
/**
|
|
305
330
|
* The amount of time in milliseconds that passes between each hash sweep. (defaults to 1h)
|
|
331
|
+
*
|
|
306
332
|
* @default 3_600_000
|
|
307
333
|
*/
|
|
308
334
|
handlerSweepInterval: number;
|
|
@@ -415,52 +441,61 @@ declare class REST extends EventEmitter {
|
|
|
415
441
|
getAgent(): Dispatcher | null;
|
|
416
442
|
/**
|
|
417
443
|
* Sets the default agent to use for requests performed by this instance
|
|
418
|
-
*
|
|
444
|
+
*
|
|
445
|
+
* @param agent - Sets the agent to use
|
|
419
446
|
*/
|
|
420
447
|
setAgent(agent: Dispatcher): this;
|
|
421
448
|
/**
|
|
422
449
|
* Sets the authorization token that should be used for requests
|
|
423
|
-
*
|
|
450
|
+
*
|
|
451
|
+
* @param token - The authorization token to use
|
|
424
452
|
*/
|
|
425
453
|
setToken(token: string): this;
|
|
426
454
|
/**
|
|
427
455
|
* Runs a get request from the api
|
|
428
|
-
*
|
|
429
|
-
* @param
|
|
456
|
+
*
|
|
457
|
+
* @param fullRoute - The full route to query
|
|
458
|
+
* @param options - Optional request options
|
|
430
459
|
*/
|
|
431
460
|
get(fullRoute: RouteLike, options?: RequestData): Promise<unknown>;
|
|
432
461
|
/**
|
|
433
462
|
* Runs a delete request from the api
|
|
434
|
-
*
|
|
435
|
-
* @param
|
|
463
|
+
*
|
|
464
|
+
* @param fullRoute - The full route to query
|
|
465
|
+
* @param options - Optional request options
|
|
436
466
|
*/
|
|
437
467
|
delete(fullRoute: RouteLike, options?: RequestData): Promise<unknown>;
|
|
438
468
|
/**
|
|
439
469
|
* Runs a post request from the api
|
|
440
|
-
*
|
|
441
|
-
* @param
|
|
470
|
+
*
|
|
471
|
+
* @param fullRoute - The full route to query
|
|
472
|
+
* @param options - Optional request options
|
|
442
473
|
*/
|
|
443
474
|
post(fullRoute: RouteLike, options?: RequestData): Promise<unknown>;
|
|
444
475
|
/**
|
|
445
476
|
* Runs a put request from the api
|
|
446
|
-
*
|
|
447
|
-
* @param
|
|
477
|
+
*
|
|
478
|
+
* @param fullRoute - The full route to query
|
|
479
|
+
* @param options - Optional request options
|
|
448
480
|
*/
|
|
449
481
|
put(fullRoute: RouteLike, options?: RequestData): Promise<unknown>;
|
|
450
482
|
/**
|
|
451
483
|
* Runs a patch request from the api
|
|
452
|
-
*
|
|
453
|
-
* @param
|
|
484
|
+
*
|
|
485
|
+
* @param fullRoute - The full route to query
|
|
486
|
+
* @param options - Optional request options
|
|
454
487
|
*/
|
|
455
488
|
patch(fullRoute: RouteLike, options?: RequestData): Promise<unknown>;
|
|
456
489
|
/**
|
|
457
490
|
* Runs a request from the api
|
|
458
|
-
*
|
|
491
|
+
*
|
|
492
|
+
* @param options - Request options
|
|
459
493
|
*/
|
|
460
494
|
request(options: InternalRequest): Promise<unknown>;
|
|
461
495
|
/**
|
|
462
496
|
* Runs a request from the API, yielding the raw Response object
|
|
463
|
-
*
|
|
497
|
+
*
|
|
498
|
+
* @param options - Request options
|
|
464
499
|
*/
|
|
465
500
|
raw(options: InternalRequest): Promise<Dispatcher.ResponseData>;
|
|
466
501
|
}
|
|
@@ -491,6 +526,7 @@ declare type ImageSize = typeof ALLOWED_SIZES[number];
|
|
|
491
526
|
interface BaseImageURLOptions {
|
|
492
527
|
/**
|
|
493
528
|
* The extension to use for the image URL
|
|
529
|
+
*
|
|
494
530
|
* @default 'webp'
|
|
495
531
|
*/
|
|
496
532
|
extension?: ImageExtension;
|
|
@@ -514,6 +550,7 @@ interface ImageURLOptions extends BaseImageURLOptions {
|
|
|
514
550
|
interface MakeURLOptions {
|
|
515
551
|
/**
|
|
516
552
|
* The extension to use for the image URL
|
|
553
|
+
*
|
|
517
554
|
* @default 'webp'
|
|
518
555
|
*/
|
|
519
556
|
extension?: string | undefined;
|
|
@@ -534,131 +571,149 @@ declare class CDN {
|
|
|
534
571
|
constructor(base?: string);
|
|
535
572
|
/**
|
|
536
573
|
* Generates an app asset URL for a client's asset.
|
|
537
|
-
*
|
|
538
|
-
* @param
|
|
539
|
-
* @param
|
|
574
|
+
*
|
|
575
|
+
* @param clientId - The client id that has the asset
|
|
576
|
+
* @param assetHash - The hash provided by Discord for this asset
|
|
577
|
+
* @param options - Optional options for the asset
|
|
540
578
|
*/
|
|
541
579
|
appAsset(clientId: string, assetHash: string, options?: Readonly<BaseImageURLOptions>): string;
|
|
542
580
|
/**
|
|
543
581
|
* Generates an app icon URL for a client's icon.
|
|
544
|
-
*
|
|
545
|
-
* @param
|
|
546
|
-
* @param
|
|
582
|
+
*
|
|
583
|
+
* @param clientId - The client id that has the icon
|
|
584
|
+
* @param iconHash - The hash provided by Discord for this icon
|
|
585
|
+
* @param options - Optional options for the icon
|
|
547
586
|
*/
|
|
548
587
|
appIcon(clientId: string, iconHash: string, options?: Readonly<BaseImageURLOptions>): string;
|
|
549
588
|
/**
|
|
550
589
|
* Generates an avatar URL, e.g. for a user or a webhook.
|
|
551
|
-
*
|
|
552
|
-
* @param
|
|
553
|
-
* @param
|
|
590
|
+
*
|
|
591
|
+
* @param id - The id that has the icon
|
|
592
|
+
* @param avatarHash - The hash provided by Discord for this avatar
|
|
593
|
+
* @param options - Optional options for the avatar
|
|
554
594
|
*/
|
|
555
595
|
avatar(id: string, avatarHash: string, options?: Readonly<ImageURLOptions>): string;
|
|
556
596
|
/**
|
|
557
597
|
* Generates a banner URL, e.g. for a user or a guild.
|
|
558
|
-
*
|
|
559
|
-
* @param
|
|
560
|
-
* @param
|
|
598
|
+
*
|
|
599
|
+
* @param id - The id that has the banner splash
|
|
600
|
+
* @param bannerHash - The hash provided by Discord for this banner
|
|
601
|
+
* @param options - Optional options for the banner
|
|
561
602
|
*/
|
|
562
603
|
banner(id: string, bannerHash: string, options?: Readonly<ImageURLOptions>): string;
|
|
563
604
|
/**
|
|
564
605
|
* Generates an icon URL for a channel, e.g. a group DM.
|
|
565
|
-
*
|
|
566
|
-
* @param
|
|
567
|
-
* @param
|
|
606
|
+
*
|
|
607
|
+
* @param channelId - The channel id that has the icon
|
|
608
|
+
* @param iconHash - The hash provided by Discord for this channel
|
|
609
|
+
* @param options - Optional options for the icon
|
|
568
610
|
*/
|
|
569
611
|
channelIcon(channelId: string, iconHash: string, options?: Readonly<BaseImageURLOptions>): string;
|
|
570
612
|
/**
|
|
571
613
|
* Generates the default avatar URL for a discriminator.
|
|
572
|
-
*
|
|
614
|
+
*
|
|
615
|
+
* @param discriminator - The discriminator modulo 5
|
|
573
616
|
*/
|
|
574
617
|
defaultAvatar(discriminator: number): string;
|
|
575
618
|
/**
|
|
576
619
|
* Generates a discovery splash URL for a guild's discovery splash.
|
|
577
|
-
*
|
|
578
|
-
* @param
|
|
579
|
-
* @param
|
|
620
|
+
*
|
|
621
|
+
* @param guildId - The guild id that has the discovery splash
|
|
622
|
+
* @param splashHash - The hash provided by Discord for this splash
|
|
623
|
+
* @param options - Optional options for the splash
|
|
580
624
|
*/
|
|
581
625
|
discoverySplash(guildId: string, splashHash: string, options?: Readonly<BaseImageURLOptions>): string;
|
|
582
626
|
/**
|
|
583
627
|
* Generates an emoji's URL for an emoji.
|
|
584
|
-
*
|
|
585
|
-
* @param
|
|
628
|
+
*
|
|
629
|
+
* @param emojiId - The emoji id
|
|
630
|
+
* @param extension - The extension of the emoji
|
|
586
631
|
*/
|
|
587
632
|
emoji(emojiId: string, extension?: ImageExtension): string;
|
|
588
633
|
/**
|
|
589
634
|
* Generates a guild member avatar URL.
|
|
590
|
-
*
|
|
591
|
-
* @param
|
|
592
|
-
* @param
|
|
593
|
-
* @param
|
|
635
|
+
*
|
|
636
|
+
* @param guildId - The id of the guild
|
|
637
|
+
* @param userId - The id of the user
|
|
638
|
+
* @param avatarHash - The hash provided by Discord for this avatar
|
|
639
|
+
* @param options - Optional options for the avatar
|
|
594
640
|
*/
|
|
595
641
|
guildMemberAvatar(guildId: string, userId: string, avatarHash: string, options?: Readonly<ImageURLOptions>): string;
|
|
596
642
|
/**
|
|
597
643
|
* Generates a guild member banner URL.
|
|
598
|
-
*
|
|
599
|
-
* @param
|
|
600
|
-
* @param
|
|
601
|
-
* @param
|
|
644
|
+
*
|
|
645
|
+
* @param guildId - The id of the guild
|
|
646
|
+
* @param userId - The id of the user
|
|
647
|
+
* @param bannerHash - The hash provided by Discord for this banner
|
|
648
|
+
* @param options - Optional options for the banner
|
|
602
649
|
*/
|
|
603
650
|
guildMemberBanner(guildId: string, userId: string, bannerHash: string, options?: Readonly<ImageURLOptions>): string;
|
|
604
651
|
/**
|
|
605
652
|
* Generates an icon URL, e.g. for a guild.
|
|
606
|
-
*
|
|
607
|
-
* @param
|
|
608
|
-
* @param
|
|
653
|
+
*
|
|
654
|
+
* @param id - The id that has the icon splash
|
|
655
|
+
* @param iconHash - The hash provided by Discord for this icon
|
|
656
|
+
* @param options - Optional options for the icon
|
|
609
657
|
*/
|
|
610
658
|
icon(id: string, iconHash: string, options?: Readonly<ImageURLOptions>): string;
|
|
611
659
|
/**
|
|
612
660
|
* Generates a URL for the icon of a role
|
|
613
|
-
* @param roleId The id of the role that has the icon
|
|
614
|
-
* @param roleIconHash The hash provided by Discord for this role icon
|
|
615
|
-
* @param options Optional options for the role icon
|
|
661
|
+
* @param roleId - The id of the role that has the icon
|
|
662
|
+
* @param roleIconHash - The hash provided by Discord for this role icon
|
|
663
|
+
* @param options - Optional options for the role icon
|
|
616
664
|
*/
|
|
617
665
|
roleIcon(roleId: string, roleIconHash: string, options?: Readonly<BaseImageURLOptions>): string;
|
|
618
666
|
/**
|
|
619
667
|
* Generates a guild invite splash URL for a guild's invite splash.
|
|
620
|
-
*
|
|
621
|
-
* @param
|
|
622
|
-
* @param
|
|
668
|
+
*
|
|
669
|
+
* @param guildId - The guild id that has the invite splash
|
|
670
|
+
* @param splashHash - The hash provided by Discord for this splash
|
|
671
|
+
* @param options - Optional options for the splash
|
|
623
672
|
*/
|
|
624
673
|
splash(guildId: string, splashHash: string, options?: Readonly<BaseImageURLOptions>): string;
|
|
625
674
|
/**
|
|
626
675
|
* Generates a sticker URL.
|
|
627
|
-
*
|
|
628
|
-
* @param
|
|
676
|
+
*
|
|
677
|
+
* @param stickerId - The sticker id
|
|
678
|
+
* @param extension - The extension of the sticker
|
|
629
679
|
*/
|
|
630
680
|
sticker(stickerId: string, extension?: StickerExtension): string;
|
|
631
681
|
/**
|
|
632
682
|
* Generates a sticker pack banner URL.
|
|
633
|
-
*
|
|
634
|
-
* @param
|
|
683
|
+
*
|
|
684
|
+
* @param bannerId - The banner id
|
|
685
|
+
* @param options - Optional options for the banner
|
|
635
686
|
*/
|
|
636
687
|
stickerPackBanner(bannerId: string, options?: Readonly<BaseImageURLOptions>): string;
|
|
637
688
|
/**
|
|
638
689
|
* Generates a team icon URL for a team's icon.
|
|
639
|
-
*
|
|
640
|
-
* @param
|
|
641
|
-
* @param
|
|
690
|
+
*
|
|
691
|
+
* @param teamId - The team id that has the icon
|
|
692
|
+
* @param iconHash - The hash provided by Discord for this icon
|
|
693
|
+
* @param options - Optional options for the icon
|
|
642
694
|
*/
|
|
643
695
|
teamIcon(teamId: string, iconHash: string, options?: Readonly<BaseImageURLOptions>): string;
|
|
644
696
|
/**
|
|
645
697
|
* Generates a cover image for a guild scheduled event.
|
|
646
|
-
*
|
|
647
|
-
* @param
|
|
648
|
-
* @param
|
|
698
|
+
*
|
|
699
|
+
* @param scheduledEventId - The scheduled event id
|
|
700
|
+
* @param coverHash - The hash provided by discord for this cover image
|
|
701
|
+
* @param options - Optional options for the cover image
|
|
649
702
|
*/
|
|
650
703
|
guildScheduledEventCover(scheduledEventId: string, coverHash: string, options?: Readonly<BaseImageURLOptions>): string;
|
|
651
704
|
/**
|
|
652
705
|
* Constructs the URL for the resource, checking whether or not `hash` starts with `a_` if `dynamic` is set to `true`.
|
|
653
|
-
*
|
|
654
|
-
* @param
|
|
655
|
-
* @param
|
|
706
|
+
*
|
|
707
|
+
* @param route - The base cdn route
|
|
708
|
+
* @param hash - The hash provided by Discord for this icon
|
|
709
|
+
* @param options - Optional options for the link
|
|
656
710
|
*/
|
|
657
711
|
private dynamicMakeURL;
|
|
658
712
|
/**
|
|
659
713
|
* Constructs the URL for the resource
|
|
660
|
-
*
|
|
661
|
-
* @param
|
|
714
|
+
*
|
|
715
|
+
* @param route - The base cdn route
|
|
716
|
+
* @param options - The extension/size options for the link
|
|
662
717
|
*/
|
|
663
718
|
private makeURL;
|
|
664
719
|
}
|
|
@@ -698,12 +753,12 @@ declare class DiscordAPIError extends Error {
|
|
|
698
753
|
url: string;
|
|
699
754
|
requestBody: RequestBody;
|
|
700
755
|
/**
|
|
701
|
-
* @param rawError The error reported by Discord
|
|
702
|
-
* @param code The error code reported by Discord
|
|
703
|
-
* @param status The status code of the response
|
|
704
|
-
* @param method The method of the request that erred
|
|
705
|
-
* @param url The url of the request that erred
|
|
706
|
-
* @param bodyData The unparsed data for the request that errored
|
|
756
|
+
* @param rawError - The error reported by Discord
|
|
757
|
+
* @param code - The error code reported by Discord
|
|
758
|
+
* @param status - The status code of the response
|
|
759
|
+
* @param method - The method of the request that erred
|
|
760
|
+
* @param url - The url of the request that erred
|
|
761
|
+
* @param bodyData - The unparsed data for the request that errored
|
|
707
762
|
*/
|
|
708
763
|
constructor(rawError: DiscordErrorData | OAuthErrorData, code: number | string, status: number, method: string, url: string, bodyData: Pick<InternalRequest, 'files' | 'body'>);
|
|
709
764
|
/**
|
|
@@ -724,11 +779,11 @@ declare class HTTPError extends Error {
|
|
|
724
779
|
url: string;
|
|
725
780
|
requestBody: RequestBody;
|
|
726
781
|
/**
|
|
727
|
-
* @param name The name of the error
|
|
728
|
-
* @param status The status code of the response
|
|
729
|
-
* @param method The method of the request that erred
|
|
730
|
-
* @param url The url of the request that erred
|
|
731
|
-
* @param bodyData The unparsed data for the request that errored
|
|
782
|
+
* @param name - The name of the error
|
|
783
|
+
* @param status - The status code of the response
|
|
784
|
+
* @param method - The method of the request that erred
|
|
785
|
+
* @param url - The url of the request that erred
|
|
786
|
+
* @param bodyData - The unparsed data for the request that errored
|
|
732
787
|
*/
|
|
733
788
|
constructor(name: string, status: number, method: string, url: string, bodyData: Pick<InternalRequest, 'files' | 'body'>);
|
|
734
789
|
}
|
|
@@ -752,13 +807,16 @@ declare class RateLimitError extends Error implements RateLimitData {
|
|
|
752
807
|
/**
|
|
753
808
|
* Creates and populates an URLSearchParams instance from an object, stripping
|
|
754
809
|
* out null and undefined values, while also coercing non-strings to strings.
|
|
755
|
-
*
|
|
810
|
+
*
|
|
811
|
+
* @param options - The options to use
|
|
812
|
+
*
|
|
756
813
|
* @returns A populated URLSearchParams instance
|
|
757
814
|
*/
|
|
758
815
|
declare function makeURLSearchParams(options?: Record<string, unknown>): URLSearchParams$1;
|
|
759
816
|
/**
|
|
760
817
|
* Converts the response to usable data
|
|
761
|
-
*
|
|
818
|
+
*
|
|
819
|
+
* @param res - The fetch response
|
|
762
820
|
*/
|
|
763
821
|
declare function parseResponse(res: Dispatcher.ResponseData): Promise<unknown>;
|
|
764
822
|
|
package/dist/index.js
CHANGED
|
@@ -50,13 +50,13 @@ var require_package = __commonJS({
|
|
|
50
50
|
"package.json"(exports, module2) {
|
|
51
51
|
module2.exports = {
|
|
52
52
|
name: "@discordjs/rest",
|
|
53
|
-
version: "0.6.0-dev.
|
|
53
|
+
version: "0.6.0-dev.1656677085-741b3c8",
|
|
54
54
|
description: "The REST API for discord.js",
|
|
55
55
|
scripts: {
|
|
56
56
|
build: "tsup",
|
|
57
57
|
lint: "prettier --cache --check . && eslint src __tests__ --ext mjs,js,ts --cache",
|
|
58
58
|
format: "prettier --cache --write . && eslint src __tests__ --ext mjs,js,ts --fix --cache",
|
|
59
|
-
docs: "docgen -i src/index.ts -c docs/index.json -o docs/docs.json --typescript",
|
|
59
|
+
docs: "docgen -i src/index.ts -c docs/index.json -o docs/docs.json --typescript && api-extractor run --local",
|
|
60
60
|
prepack: "yarn build && yarn lint",
|
|
61
61
|
changelog: "git cliff --prepend ./CHANGELOG.md -u -c ./cliff.toml -r ../../ --include-path 'packages/rest/*'",
|
|
62
62
|
release: "cliff-jumper"
|
|
@@ -111,6 +111,7 @@ var require_package = __commonJS({
|
|
|
111
111
|
"@discordjs/docgen": "workspace:^",
|
|
112
112
|
"@discordjs/scripts": "workspace:^",
|
|
113
113
|
"@favware/cliff-jumper": "^1.8.3",
|
|
114
|
+
"@microsoft/api-extractor": "^7.28.2",
|
|
114
115
|
eslint: "^8.18.0",
|
|
115
116
|
prettier: "^2.7.1",
|
|
116
117
|
tsup: "^6.1.2",
|