@discordjs/rest 3.0.0-dev.1752192890-35cc57ab9 → 3.0.0-dev.1752321904-591668099

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.mts CHANGED
@@ -480,13 +480,30 @@ interface ImageURLOptions extends BaseImageURLOptions {
480
480
  */
481
481
  forceStatic?: boolean;
482
482
  }
483
+ /**
484
+ * Options for initializing the {@link CDN} class.
485
+ */
486
+ interface CDNOptions {
487
+ /**
488
+ * The base URL for the CDN.
489
+ *
490
+ * @defaultValue `DefaultRestOptions.cdn`
491
+ */
492
+ cdn?: string | undefined;
493
+ /**
494
+ * The base URL for the media proxy.
495
+ *
496
+ * @defaultValue `DefaultRestOptions.mediaProxy`
497
+ */
498
+ mediaProxy?: string | undefined;
499
+ }
483
500
  /**
484
501
  * The CDN link builder
485
502
  */
486
503
  declare class CDN {
487
504
  private readonly cdn;
488
505
  private readonly mediaProxy;
489
- constructor(cdn?: string, mediaProxy?: string);
506
+ constructor({ cdn, mediaProxy }?: CDNOptions);
490
507
  /**
491
508
  * Generates an app asset URL for a client's asset.
492
509
  *
@@ -898,4 +915,4 @@ declare function calculateUserDefaultAvatarIndex(userId: Snowflake): number;
898
915
  */
899
916
  declare const version: string;
900
917
 
901
- export { ALLOWED_EXTENSIONS, ALLOWED_SIZES, ALLOWED_STICKER_EXTENSIONS, type APIRequest, AUTH_UUID_NAMESPACE, type AuthData, type BaseImageURLOptions, BurstHandlerMajorIdKey, CDN, DefaultRestOptions, DefaultUserAgent, DefaultUserAgentAppendix, DiscordAPIError, type DiscordError, type DiscordErrorData, type DiscordErrorFieldInformation, type DiscordErrorGroupWrapper, type EmojiURLOptions, type EmojiURLOptionsNotWebp, type EmojiURLOptionsWebp, type GetRateLimitOffsetFunction, HTTPError, type HandlerRequestData, type HashData, type IHandler, type ImageExtension, type ImageURLOptions, type InternalRequest, type InvalidRequestWarningData, type OAuthErrorData, OverwrittenMimeTypes, REST, RESTEvents, type RESTOptions, type RateLimitData, RateLimitError, type RateLimitQueueFilter, type RawFile, type RequestBody, type RequestData, type RequestHeaders, RequestMethod, type ResponseLike, type RestEvents, type RestEventsMap, type RouteData, type RouteLike, type StickerExtension, calculateUserDefaultAvatarIndex, makeURLSearchParams, parseResponse, version };
918
+ export { ALLOWED_EXTENSIONS, ALLOWED_SIZES, ALLOWED_STICKER_EXTENSIONS, type APIRequest, AUTH_UUID_NAMESPACE, type AuthData, type BaseImageURLOptions, BurstHandlerMajorIdKey, CDN, type CDNOptions, DefaultRestOptions, DefaultUserAgent, DefaultUserAgentAppendix, DiscordAPIError, type DiscordError, type DiscordErrorData, type DiscordErrorFieldInformation, type DiscordErrorGroupWrapper, type EmojiURLOptions, type EmojiURLOptionsNotWebp, type EmojiURLOptionsWebp, type GetRateLimitOffsetFunction, HTTPError, type HandlerRequestData, type HashData, type IHandler, type ImageExtension, type ImageURLOptions, type InternalRequest, type InvalidRequestWarningData, type OAuthErrorData, OverwrittenMimeTypes, REST, RESTEvents, type RESTOptions, type RateLimitData, RateLimitError, type RateLimitQueueFilter, type RawFile, type RequestBody, type RequestData, type RequestHeaders, RequestMethod, type ResponseLike, type RestEvents, type RestEventsMap, type RouteData, type RouteLike, type StickerExtension, calculateUserDefaultAvatarIndex, makeURLSearchParams, parseResponse, version };
package/dist/index.d.ts CHANGED
@@ -480,13 +480,30 @@ interface ImageURLOptions extends BaseImageURLOptions {
480
480
  */
481
481
  forceStatic?: boolean;
482
482
  }
483
+ /**
484
+ * Options for initializing the {@link CDN} class.
485
+ */
486
+ interface CDNOptions {
487
+ /**
488
+ * The base URL for the CDN.
489
+ *
490
+ * @defaultValue `DefaultRestOptions.cdn`
491
+ */
492
+ cdn?: string | undefined;
493
+ /**
494
+ * The base URL for the media proxy.
495
+ *
496
+ * @defaultValue `DefaultRestOptions.mediaProxy`
497
+ */
498
+ mediaProxy?: string | undefined;
499
+ }
483
500
  /**
484
501
  * The CDN link builder
485
502
  */
486
503
  declare class CDN {
487
504
  private readonly cdn;
488
505
  private readonly mediaProxy;
489
- constructor(cdn?: string, mediaProxy?: string);
506
+ constructor({ cdn, mediaProxy }?: CDNOptions);
490
507
  /**
491
508
  * Generates an app asset URL for a client's asset.
492
509
  *
@@ -898,4 +915,4 @@ declare function calculateUserDefaultAvatarIndex(userId: Snowflake): number;
898
915
  */
899
916
  declare const version: string;
900
917
 
901
- export { ALLOWED_EXTENSIONS, ALLOWED_SIZES, ALLOWED_STICKER_EXTENSIONS, type APIRequest, AUTH_UUID_NAMESPACE, type AuthData, type BaseImageURLOptions, BurstHandlerMajorIdKey, CDN, DefaultRestOptions, DefaultUserAgent, DefaultUserAgentAppendix, DiscordAPIError, type DiscordError, type DiscordErrorData, type DiscordErrorFieldInformation, type DiscordErrorGroupWrapper, type EmojiURLOptions, type EmojiURLOptionsNotWebp, type EmojiURLOptionsWebp, type GetRateLimitOffsetFunction, HTTPError, type HandlerRequestData, type HashData, type IHandler, type ImageExtension, type ImageURLOptions, type InternalRequest, type InvalidRequestWarningData, type OAuthErrorData, OverwrittenMimeTypes, REST, RESTEvents, type RESTOptions, type RateLimitData, RateLimitError, type RateLimitQueueFilter, type RawFile, type RequestBody, type RequestData, type RequestHeaders, RequestMethod, type ResponseLike, type RestEvents, type RestEventsMap, type RouteData, type RouteLike, type StickerExtension, calculateUserDefaultAvatarIndex, makeURLSearchParams, parseResponse, version };
918
+ export { ALLOWED_EXTENSIONS, ALLOWED_SIZES, ALLOWED_STICKER_EXTENSIONS, type APIRequest, AUTH_UUID_NAMESPACE, type AuthData, type BaseImageURLOptions, BurstHandlerMajorIdKey, CDN, type CDNOptions, DefaultRestOptions, DefaultUserAgent, DefaultUserAgentAppendix, DiscordAPIError, type DiscordError, type DiscordErrorData, type DiscordErrorFieldInformation, type DiscordErrorGroupWrapper, type EmojiURLOptions, type EmojiURLOptionsNotWebp, type EmojiURLOptionsWebp, type GetRateLimitOffsetFunction, HTTPError, type HandlerRequestData, type HashData, type IHandler, type ImageExtension, type ImageURLOptions, type InternalRequest, type InvalidRequestWarningData, type OAuthErrorData, OverwrittenMimeTypes, REST, RESTEvents, type RESTOptions, type RateLimitData, RateLimitError, type RateLimitQueueFilter, type RawFile, type RequestBody, type RequestData, type RequestHeaders, RequestMethod, type ResponseLike, type RestEvents, type RestEventsMap, type RouteData, type RouteLike, type StickerExtension, calculateUserDefaultAvatarIndex, makeURLSearchParams, parseResponse, version };
package/dist/index.js CHANGED
@@ -125,7 +125,7 @@ var import_v102 = require("discord-api-types/v10");
125
125
  // src/lib/utils/constants.ts
126
126
  var import_util = require("@discordjs/util");
127
127
  var import_v10 = require("discord-api-types/v10");
128
- var DefaultUserAgent = `DiscordBot (https://discord.js.org, 3.0.0-dev.1752192890-35cc57ab9)`;
128
+ var DefaultUserAgent = `DiscordBot (https://discord.js.org, 3.0.0-dev.1752321904-591668099)`;
129
129
  var DefaultUserAgentAppendix = (0, import_util.getUserAgentAppendix)();
130
130
  var DefaultRestOptions = {
131
131
  agent: null,
@@ -183,13 +183,15 @@ var AUTH_UUID_NAMESPACE = "acc82a4c-f887-417b-a69c-f74096ff7e59";
183
183
 
184
184
  // src/lib/CDN.ts
185
185
  var CDN = class {
186
- constructor(cdn = DefaultRestOptions.cdn, mediaProxy = DefaultRestOptions.mediaProxy) {
187
- this.cdn = cdn;
188
- this.mediaProxy = mediaProxy;
189
- }
190
186
  static {
191
187
  __name(this, "CDN");
192
188
  }
189
+ cdn;
190
+ mediaProxy;
191
+ constructor({ cdn, mediaProxy } = {}) {
192
+ this.cdn = cdn ?? DefaultRestOptions.cdn;
193
+ this.mediaProxy = mediaProxy ?? DefaultRestOptions.mediaProxy;
194
+ }
193
195
  /**
194
196
  * Generates an app asset URL for a client's asset.
195
197
  *
@@ -1175,7 +1177,7 @@ var REST = class _REST extends import_async_event_emitter.AsyncEventEmitter {
1175
1177
  options;
1176
1178
  constructor(options = {}) {
1177
1179
  super();
1178
- this.cdn = new CDN(options.cdn ?? DefaultRestOptions.cdn, options.mediaProxy ?? DefaultRestOptions.mediaProxy);
1180
+ this.cdn = new CDN(options);
1179
1181
  this.options = { ...DefaultRestOptions, ...options };
1180
1182
  this.globalRemaining = Math.max(1, this.options.globalRequestsPerSecond);
1181
1183
  this.agent = options.agent ?? null;
@@ -1458,7 +1460,7 @@ var REST = class _REST extends import_async_event_emitter.AsyncEventEmitter {
1458
1460
  };
1459
1461
 
1460
1462
  // src/shared.ts
1461
- var version = "3.0.0-dev.1752192890-35cc57ab9";
1463
+ var version = "3.0.0-dev.1752321904-591668099";
1462
1464
 
1463
1465
  // src/index.ts
1464
1466
  setDefaultStrategy((0, import_util2.shouldUseGlobalFetchAndWebSocket)() ? fetch : makeRequest);