@discordjs/rest
Advanced tools
+17
-4
@@ -9,4 +9,4 @@ import * as undici from 'undici'; | ||
| export { ImageSize } from 'discord-api-types/v10'; | ||
| import * as url from 'url'; | ||
| import { AsyncEventEmitter } from '@vladfrangu/async_event_emitter'; | ||
| import * as url from 'url'; | ||
@@ -933,9 +933,22 @@ interface IHandler { | ||
| /** | ||
| * Options for serializing URL search parameters. | ||
| */ | ||
| interface MakeURLSearchParamsOptions { | ||
| /** | ||
| * How array values should be serialized. | ||
| * | ||
| * @defaultValue `'repeat'` | ||
| * @see {@link https://docs.discord.com/developers/reference#array-query-strings} | ||
| */ | ||
| arrayFormat?: 'comma' | 'repeat'; | ||
| } | ||
| /** | ||
| * Creates and populates an URLSearchParams instance from an object, stripping | ||
| * out null and undefined values, while also coercing non-strings to strings. | ||
| * | ||
| * @param options - The options to use | ||
| * @param parameters - The parameters to use | ||
| * @param options - The options for serializing URL search parameters | ||
| * @returns A populated URLSearchParams instance | ||
| */ | ||
| declare function makeURLSearchParams<OptionsType extends object>(options?: Readonly<OptionsType>): url.URLSearchParams; | ||
| declare function makeURLSearchParams<ParametersType extends object>(parameters?: Readonly<ParametersType>, options?: MakeURLSearchParamsOptions): url.URLSearchParams; | ||
| /** | ||
@@ -960,2 +973,2 @@ * Converts the response to usable data | ||
| export { ALLOWED_EXTENSIONS, ALLOWED_SIZES, ALLOWED_STICKER_EXTENSIONS, type APIRequest, type BaseImageURLOptions, BurstHandlerMajorIdKey, CDN, DEPRECATION_WARNING_PREFIX, DefaultRestOptions, DefaultUserAgent, DefaultUserAgentAppendix, DiscordAPIError, type DiscordErrorData, type EmojiURLOptions, type EmojiURLOptionsNotWebp, type EmojiURLOptionsWebp, type GetRateLimitOffsetFunction, HTTPError, type HandlerRequestData, type HashData, type ImageExtension, type ImageURLOptions, type InternalRequest, type InvalidRequestWarningData, type MakeURLOptions, 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 }; | ||
| export { ALLOWED_EXTENSIONS, ALLOWED_SIZES, ALLOWED_STICKER_EXTENSIONS, type APIRequest, type BaseImageURLOptions, BurstHandlerMajorIdKey, CDN, DEPRECATION_WARNING_PREFIX, DefaultRestOptions, DefaultUserAgent, DefaultUserAgentAppendix, DiscordAPIError, type DiscordErrorData, type EmojiURLOptions, type EmojiURLOptionsNotWebp, type EmojiURLOptionsWebp, type GetRateLimitOffsetFunction, HTTPError, type HandlerRequestData, type HashData, type ImageExtension, type ImageURLOptions, type InternalRequest, type InvalidRequestWarningData, type MakeURLOptions, type MakeURLSearchParamsOptions, 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 }; |
+17
-4
@@ -9,4 +9,4 @@ import * as undici from 'undici'; | ||
| export { ImageSize } from 'discord-api-types/v10'; | ||
| import * as url from 'url'; | ||
| import { AsyncEventEmitter } from '@vladfrangu/async_event_emitter'; | ||
| import * as url from 'url'; | ||
@@ -933,9 +933,22 @@ interface IHandler { | ||
| /** | ||
| * Options for serializing URL search parameters. | ||
| */ | ||
| interface MakeURLSearchParamsOptions { | ||
| /** | ||
| * How array values should be serialized. | ||
| * | ||
| * @defaultValue `'repeat'` | ||
| * @see {@link https://docs.discord.com/developers/reference#array-query-strings} | ||
| */ | ||
| arrayFormat?: 'comma' | 'repeat'; | ||
| } | ||
| /** | ||
| * Creates and populates an URLSearchParams instance from an object, stripping | ||
| * out null and undefined values, while also coercing non-strings to strings. | ||
| * | ||
| * @param options - The options to use | ||
| * @param parameters - The parameters to use | ||
| * @param options - The options for serializing URL search parameters | ||
| * @returns A populated URLSearchParams instance | ||
| */ | ||
| declare function makeURLSearchParams<OptionsType extends object>(options?: Readonly<OptionsType>): url.URLSearchParams; | ||
| declare function makeURLSearchParams<ParametersType extends object>(parameters?: Readonly<ParametersType>, options?: MakeURLSearchParamsOptions): url.URLSearchParams; | ||
| /** | ||
@@ -960,2 +973,2 @@ * Converts the response to usable data | ||
| export { ALLOWED_EXTENSIONS, ALLOWED_SIZES, ALLOWED_STICKER_EXTENSIONS, type APIRequest, type BaseImageURLOptions, BurstHandlerMajorIdKey, CDN, DEPRECATION_WARNING_PREFIX, DefaultRestOptions, DefaultUserAgent, DefaultUserAgentAppendix, DiscordAPIError, type DiscordErrorData, type EmojiURLOptions, type EmojiURLOptionsNotWebp, type EmojiURLOptionsWebp, type GetRateLimitOffsetFunction, HTTPError, type HandlerRequestData, type HashData, type ImageExtension, type ImageURLOptions, type InternalRequest, type InvalidRequestWarningData, type MakeURLOptions, 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 }; | ||
| export { ALLOWED_EXTENSIONS, ALLOWED_SIZES, ALLOWED_STICKER_EXTENSIONS, type APIRequest, type BaseImageURLOptions, BurstHandlerMajorIdKey, CDN, DEPRECATION_WARNING_PREFIX, DefaultRestOptions, DefaultUserAgent, DefaultUserAgentAppendix, DiscordAPIError, type DiscordErrorData, type EmojiURLOptions, type EmojiURLOptionsNotWebp, type EmojiURLOptionsWebp, type GetRateLimitOffsetFunction, HTTPError, type HandlerRequestData, type HashData, type ImageExtension, type ImageURLOptions, type InternalRequest, type InvalidRequestWarningData, type MakeURLOptions, type MakeURLSearchParamsOptions, 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 }; |
+24
-5
@@ -130,3 +130,3 @@ "use strict"; | ||
| var import_v10 = require("discord-api-types/v10"); | ||
| var DefaultUserAgent = `DiscordBot (https://discord.js.org, 2.6.2)`; | ||
| var DefaultUserAgent = `DiscordBot (https://discord.js.org, 2.6.3)`; | ||
| var DefaultUserAgentAppendix = (0, import_util.getUserAgentAppendix)(); | ||
@@ -268,6 +268,25 @@ var DefaultRestOptions = { | ||
| __name(serializeSearchParam, "serializeSearchParam"); | ||
| function makeURLSearchParams(options) { | ||
| function makeURLSearchParams(parameters, options = {}) { | ||
| const params = new URLSearchParams(); | ||
| if (!options) return params; | ||
| for (const [key, value] of Object.entries(options)) { | ||
| if (!parameters) return params; | ||
| const { arrayFormat = "repeat" } = options; | ||
| for (const [key, value] of Object.entries(parameters)) { | ||
| if (Array.isArray(value)) { | ||
| const commaSeparatedElements = arrayFormat === "comma" ? [] : null; | ||
| for (const element of value) { | ||
| const serialized2 = serializeSearchParam(element); | ||
| if (serialized2 === null) { | ||
| continue; | ||
| } | ||
| if (commaSeparatedElements) { | ||
| commaSeparatedElements.push(serialized2); | ||
| } else { | ||
| params.append(key, serialized2); | ||
| } | ||
| } | ||
| if (commaSeparatedElements?.length) { | ||
| params.append(key, commaSeparatedElements.join(",")); | ||
| } | ||
| continue; | ||
| } | ||
| const serialized = serializeSearchParam(value); | ||
@@ -1504,3 +1523,3 @@ if (serialized !== null) params.append(key, serialized); | ||
| // src/shared.ts | ||
| var version = "2.6.2"; | ||
| var version = "2.6.3"; | ||
@@ -1507,0 +1526,0 @@ // src/index.ts |
+24
-5
@@ -89,3 +89,3 @@ var __defProp = Object.defineProperty; | ||
| import { APIVersion } from "discord-api-types/v10"; | ||
| var DefaultUserAgent = `DiscordBot (https://discord.js.org, 2.6.2)`; | ||
| var DefaultUserAgent = `DiscordBot (https://discord.js.org, 2.6.3)`; | ||
| var DefaultUserAgentAppendix = getUserAgentAppendix(); | ||
@@ -227,6 +227,25 @@ var DefaultRestOptions = { | ||
| __name(serializeSearchParam, "serializeSearchParam"); | ||
| function makeURLSearchParams(options) { | ||
| function makeURLSearchParams(parameters, options = {}) { | ||
| const params = new URLSearchParams(); | ||
| if (!options) return params; | ||
| for (const [key, value] of Object.entries(options)) { | ||
| if (!parameters) return params; | ||
| const { arrayFormat = "repeat" } = options; | ||
| for (const [key, value] of Object.entries(parameters)) { | ||
| if (Array.isArray(value)) { | ||
| const commaSeparatedElements = arrayFormat === "comma" ? [] : null; | ||
| for (const element of value) { | ||
| const serialized2 = serializeSearchParam(element); | ||
| if (serialized2 === null) { | ||
| continue; | ||
| } | ||
| if (commaSeparatedElements) { | ||
| commaSeparatedElements.push(serialized2); | ||
| } else { | ||
| params.append(key, serialized2); | ||
| } | ||
| } | ||
| if (commaSeparatedElements?.length) { | ||
| params.append(key, commaSeparatedElements.join(",")); | ||
| } | ||
| continue; | ||
| } | ||
| const serialized = serializeSearchParam(value); | ||
@@ -1463,3 +1482,3 @@ if (serialized !== null) params.append(key, serialized); | ||
| // src/shared.ts | ||
| var version = "2.6.2"; | ||
| var version = "2.6.3"; | ||
@@ -1466,0 +1485,0 @@ // src/index.ts |
+17
-4
@@ -9,4 +9,4 @@ import * as undici from 'undici'; | ||
| export { ImageSize } from 'discord-api-types/v10'; | ||
| import * as url from 'url'; | ||
| import { AsyncEventEmitter } from '@vladfrangu/async_event_emitter'; | ||
| import * as url from 'url'; | ||
@@ -933,9 +933,22 @@ interface IHandler { | ||
| /** | ||
| * Options for serializing URL search parameters. | ||
| */ | ||
| interface MakeURLSearchParamsOptions { | ||
| /** | ||
| * How array values should be serialized. | ||
| * | ||
| * @defaultValue `'repeat'` | ||
| * @see {@link https://docs.discord.com/developers/reference#array-query-strings} | ||
| */ | ||
| arrayFormat?: 'comma' | 'repeat'; | ||
| } | ||
| /** | ||
| * Creates and populates an URLSearchParams instance from an object, stripping | ||
| * out null and undefined values, while also coercing non-strings to strings. | ||
| * | ||
| * @param options - The options to use | ||
| * @param parameters - The parameters to use | ||
| * @param options - The options for serializing URL search parameters | ||
| * @returns A populated URLSearchParams instance | ||
| */ | ||
| declare function makeURLSearchParams<OptionsType extends object>(options?: Readonly<OptionsType>): url.URLSearchParams; | ||
| declare function makeURLSearchParams<ParametersType extends object>(parameters?: Readonly<ParametersType>, options?: MakeURLSearchParamsOptions): url.URLSearchParams; | ||
| /** | ||
@@ -960,2 +973,2 @@ * Converts the response to usable data | ||
| export { ALLOWED_EXTENSIONS, ALLOWED_SIZES, ALLOWED_STICKER_EXTENSIONS, type APIRequest, type BaseImageURLOptions, BurstHandlerMajorIdKey, CDN, DEPRECATION_WARNING_PREFIX, DefaultRestOptions, DefaultUserAgent, DefaultUserAgentAppendix, DiscordAPIError, type DiscordErrorData, type EmojiURLOptions, type EmojiURLOptionsNotWebp, type EmojiURLOptionsWebp, type GetRateLimitOffsetFunction, HTTPError, type HandlerRequestData, type HashData, type ImageExtension, type ImageURLOptions, type InternalRequest, type InvalidRequestWarningData, type MakeURLOptions, 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 }; | ||
| export { ALLOWED_EXTENSIONS, ALLOWED_SIZES, ALLOWED_STICKER_EXTENSIONS, type APIRequest, type BaseImageURLOptions, BurstHandlerMajorIdKey, CDN, DEPRECATION_WARNING_PREFIX, DefaultRestOptions, DefaultUserAgent, DefaultUserAgentAppendix, DiscordAPIError, type DiscordErrorData, type EmojiURLOptions, type EmojiURLOptionsNotWebp, type EmojiURLOptionsWebp, type GetRateLimitOffsetFunction, HTTPError, type HandlerRequestData, type HashData, type ImageExtension, type ImageURLOptions, type InternalRequest, type InvalidRequestWarningData, type MakeURLOptions, type MakeURLSearchParamsOptions, 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 }; |
+17
-4
@@ -9,4 +9,4 @@ import * as undici from 'undici'; | ||
| export { ImageSize } from 'discord-api-types/v10'; | ||
| import * as url from 'url'; | ||
| import { AsyncEventEmitter } from '@vladfrangu/async_event_emitter'; | ||
| import * as url from 'url'; | ||
@@ -933,9 +933,22 @@ interface IHandler { | ||
| /** | ||
| * Options for serializing URL search parameters. | ||
| */ | ||
| interface MakeURLSearchParamsOptions { | ||
| /** | ||
| * How array values should be serialized. | ||
| * | ||
| * @defaultValue `'repeat'` | ||
| * @see {@link https://docs.discord.com/developers/reference#array-query-strings} | ||
| */ | ||
| arrayFormat?: 'comma' | 'repeat'; | ||
| } | ||
| /** | ||
| * Creates and populates an URLSearchParams instance from an object, stripping | ||
| * out null and undefined values, while also coercing non-strings to strings. | ||
| * | ||
| * @param options - The options to use | ||
| * @param parameters - The parameters to use | ||
| * @param options - The options for serializing URL search parameters | ||
| * @returns A populated URLSearchParams instance | ||
| */ | ||
| declare function makeURLSearchParams<OptionsType extends object>(options?: Readonly<OptionsType>): url.URLSearchParams; | ||
| declare function makeURLSearchParams<ParametersType extends object>(parameters?: Readonly<ParametersType>, options?: MakeURLSearchParamsOptions): url.URLSearchParams; | ||
| /** | ||
@@ -960,2 +973,2 @@ * Converts the response to usable data | ||
| export { ALLOWED_EXTENSIONS, ALLOWED_SIZES, ALLOWED_STICKER_EXTENSIONS, type APIRequest, type BaseImageURLOptions, BurstHandlerMajorIdKey, CDN, DEPRECATION_WARNING_PREFIX, DefaultRestOptions, DefaultUserAgent, DefaultUserAgentAppendix, DiscordAPIError, type DiscordErrorData, type EmojiURLOptions, type EmojiURLOptionsNotWebp, type EmojiURLOptionsWebp, type GetRateLimitOffsetFunction, HTTPError, type HandlerRequestData, type HashData, type ImageExtension, type ImageURLOptions, type InternalRequest, type InvalidRequestWarningData, type MakeURLOptions, 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 }; | ||
| export { ALLOWED_EXTENSIONS, ALLOWED_SIZES, ALLOWED_STICKER_EXTENSIONS, type APIRequest, type BaseImageURLOptions, BurstHandlerMajorIdKey, CDN, DEPRECATION_WARNING_PREFIX, DefaultRestOptions, DefaultUserAgent, DefaultUserAgentAppendix, DiscordAPIError, type DiscordErrorData, type EmojiURLOptions, type EmojiURLOptionsNotWebp, type EmojiURLOptionsWebp, type GetRateLimitOffsetFunction, HTTPError, type HandlerRequestData, type HashData, type ImageExtension, type ImageURLOptions, type InternalRequest, type InvalidRequestWarningData, type MakeURLOptions, type MakeURLSearchParamsOptions, 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 }; |
+24
-5
@@ -64,3 +64,3 @@ "use strict"; | ||
| var import_v10 = require("discord-api-types/v10"); | ||
| var DefaultUserAgent = `DiscordBot (https://discord.js.org, 2.6.2)`; | ||
| var DefaultUserAgent = `DiscordBot (https://discord.js.org, 2.6.3)`; | ||
| var DefaultUserAgentAppendix = (0, import_util.getUserAgentAppendix)(); | ||
@@ -202,6 +202,25 @@ var DefaultRestOptions = { | ||
| __name(serializeSearchParam, "serializeSearchParam"); | ||
| function makeURLSearchParams(options) { | ||
| function makeURLSearchParams(parameters, options = {}) { | ||
| const params = new URLSearchParams(); | ||
| if (!options) return params; | ||
| for (const [key, value] of Object.entries(options)) { | ||
| if (!parameters) return params; | ||
| const { arrayFormat = "repeat" } = options; | ||
| for (const [key, value] of Object.entries(parameters)) { | ||
| if (Array.isArray(value)) { | ||
| const commaSeparatedElements = arrayFormat === "comma" ? [] : null; | ||
| for (const element of value) { | ||
| const serialized2 = serializeSearchParam(element); | ||
| if (serialized2 === null) { | ||
| continue; | ||
| } | ||
| if (commaSeparatedElements) { | ||
| commaSeparatedElements.push(serialized2); | ||
| } else { | ||
| params.append(key, serialized2); | ||
| } | ||
| } | ||
| if (commaSeparatedElements?.length) { | ||
| params.append(key, commaSeparatedElements.join(",")); | ||
| } | ||
| continue; | ||
| } | ||
| const serialized = serializeSearchParam(value); | ||
@@ -1438,3 +1457,3 @@ if (serialized !== null) params.append(key, serialized); | ||
| // src/shared.ts | ||
| var version = "2.6.2"; | ||
| var version = "2.6.3"; | ||
@@ -1441,0 +1460,0 @@ // src/web.ts |
+24
-5
@@ -21,3 +21,3 @@ var __defProp = Object.defineProperty; | ||
| import { APIVersion } from "discord-api-types/v10"; | ||
| var DefaultUserAgent = `DiscordBot (https://discord.js.org, 2.6.2)`; | ||
| var DefaultUserAgent = `DiscordBot (https://discord.js.org, 2.6.3)`; | ||
| var DefaultUserAgentAppendix = getUserAgentAppendix(); | ||
@@ -159,6 +159,25 @@ var DefaultRestOptions = { | ||
| __name(serializeSearchParam, "serializeSearchParam"); | ||
| function makeURLSearchParams(options) { | ||
| function makeURLSearchParams(parameters, options = {}) { | ||
| const params = new URLSearchParams(); | ||
| if (!options) return params; | ||
| for (const [key, value] of Object.entries(options)) { | ||
| if (!parameters) return params; | ||
| const { arrayFormat = "repeat" } = options; | ||
| for (const [key, value] of Object.entries(parameters)) { | ||
| if (Array.isArray(value)) { | ||
| const commaSeparatedElements = arrayFormat === "comma" ? [] : null; | ||
| for (const element of value) { | ||
| const serialized2 = serializeSearchParam(element); | ||
| if (serialized2 === null) { | ||
| continue; | ||
| } | ||
| if (commaSeparatedElements) { | ||
| commaSeparatedElements.push(serialized2); | ||
| } else { | ||
| params.append(key, serialized2); | ||
| } | ||
| } | ||
| if (commaSeparatedElements?.length) { | ||
| params.append(key, commaSeparatedElements.join(",")); | ||
| } | ||
| continue; | ||
| } | ||
| const serialized = serializeSearchParam(value); | ||
@@ -1395,3 +1414,3 @@ if (serialized !== null) params.append(key, serialized); | ||
| // src/shared.ts | ||
| var version = "2.6.2"; | ||
| var version = "2.6.3"; | ||
@@ -1398,0 +1417,0 @@ // src/web.ts |
+4
-4
| { | ||
| "$schema": "https://json.schemastore.org/package.json", | ||
| "name": "@discordjs/rest", | ||
| "version": "2.6.2", | ||
| "version": "2.6.3", | ||
| "description": "The REST API for discord.js", | ||
@@ -77,8 +77,8 @@ "exports": { | ||
| "@vladfrangu/async_event_emitter": "^2.4.6", | ||
| "discord-api-types": "^0.38.49", | ||
| "discord-api-types": "^0.38.50", | ||
| "magic-bytes.js": "^1.13.0", | ||
| "tslib": "^2.6.3", | ||
| "undici": "^6.27.0", | ||
| "@discordjs/util": "^1.2.0", | ||
| "@discordjs/collection": "^2.1.1" | ||
| "@discordjs/collection": "^2.1.1", | ||
| "@discordjs/util": "^1.2.0" | ||
| }, | ||
@@ -85,0 +85,0 @@ "devDependencies": { |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
807567
1.37%8001
1.29%+ Added
- Removed
Updated