feat: add auth option in api methods (#10717)

Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>
Co-authored-by: Denis-Adrian Cristea <didinele.dev@gmail.com>
Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
This commit is contained in:
Almeida
2025-01-24 11:23:17 +00:00
committed by GitHub
parent 54d8750a2d
commit 670667d65b
16 changed files with 482 additions and 256 deletions

View File

@@ -42,9 +42,10 @@ export class ApplicationCommandsAPI {
public async getGlobalCommands( public async getGlobalCommands(
applicationId: Snowflake, applicationId: Snowflake,
query: RESTGetAPIApplicationCommandsQuery = {}, query: RESTGetAPIApplicationCommandsQuery = {},
{ signal }: Pick<RequestData, 'signal'> = {}, { auth, signal }: Pick<RequestData, 'auth' | 'signal'> = {},
) { ) {
return this.rest.get(Routes.applicationCommands(applicationId), { return this.rest.get(Routes.applicationCommands(applicationId), {
auth,
query: makeURLSearchParams(query), query: makeURLSearchParams(query),
signal, signal,
}) as Promise<RESTGetAPIApplicationCommandsResult>; }) as Promise<RESTGetAPIApplicationCommandsResult>;
@@ -61,9 +62,10 @@ export class ApplicationCommandsAPI {
public async createGlobalCommand( public async createGlobalCommand(
applicationId: Snowflake, applicationId: Snowflake,
body: RESTPostAPIApplicationCommandsJSONBody, body: RESTPostAPIApplicationCommandsJSONBody,
{ signal }: Pick<RequestData, 'signal'> = {}, { auth, signal }: Pick<RequestData, 'auth' | 'signal'> = {},
) { ) {
return this.rest.post(Routes.applicationCommands(applicationId), { return this.rest.post(Routes.applicationCommands(applicationId), {
auth,
body, body,
signal, signal,
}) as Promise<RESTPostAPIApplicationCommandsResult>; }) as Promise<RESTPostAPIApplicationCommandsResult>;
@@ -80,9 +82,10 @@ export class ApplicationCommandsAPI {
public async getGlobalCommand( public async getGlobalCommand(
applicationId: Snowflake, applicationId: Snowflake,
commandId: Snowflake, commandId: Snowflake,
{ signal }: Pick<RequestData, 'signal'> = {}, { auth, signal }: Pick<RequestData, 'auth' | 'signal'> = {},
) { ) {
return this.rest.get(Routes.applicationCommand(applicationId, commandId), { return this.rest.get(Routes.applicationCommand(applicationId, commandId), {
auth,
signal, signal,
}) as Promise<RESTGetAPIApplicationCommandResult>; }) as Promise<RESTGetAPIApplicationCommandResult>;
} }
@@ -100,9 +103,10 @@ export class ApplicationCommandsAPI {
applicationId: Snowflake, applicationId: Snowflake,
commandId: Snowflake, commandId: Snowflake,
body: RESTPatchAPIApplicationCommandJSONBody, body: RESTPatchAPIApplicationCommandJSONBody,
{ signal }: Pick<RequestData, 'signal'> = {}, { auth, signal }: Pick<RequestData, 'auth' | 'signal'> = {},
) { ) {
return this.rest.patch(Routes.applicationCommand(applicationId, commandId), { return this.rest.patch(Routes.applicationCommand(applicationId, commandId), {
auth,
body, body,
signal, signal,
}) as Promise<RESTPatchAPIApplicationCommandResult>; }) as Promise<RESTPatchAPIApplicationCommandResult>;
@@ -119,9 +123,9 @@ export class ApplicationCommandsAPI {
public async deleteGlobalCommand( public async deleteGlobalCommand(
applicationId: Snowflake, applicationId: Snowflake,
commandId: Snowflake, commandId: Snowflake,
{ signal }: Pick<RequestData, 'signal'> = {}, { auth, signal }: Pick<RequestData, 'auth' | 'signal'> = {},
) { ) {
await this.rest.delete(Routes.applicationCommand(applicationId, commandId), { signal }); await this.rest.delete(Routes.applicationCommand(applicationId, commandId), { auth, signal });
} }
/** /**
@@ -135,9 +139,10 @@ export class ApplicationCommandsAPI {
public async bulkOverwriteGlobalCommands( public async bulkOverwriteGlobalCommands(
applicationId: Snowflake, applicationId: Snowflake,
body: RESTPutAPIApplicationCommandsJSONBody, body: RESTPutAPIApplicationCommandsJSONBody,
{ signal }: Pick<RequestData, 'signal'> = {}, { auth, signal }: Pick<RequestData, 'auth' | 'signal'> = {},
) { ) {
return this.rest.put(Routes.applicationCommands(applicationId), { return this.rest.put(Routes.applicationCommands(applicationId), {
auth,
body, body,
signal, signal,
}) as Promise<RESTPutAPIApplicationCommandsResult>; }) as Promise<RESTPutAPIApplicationCommandsResult>;
@@ -156,9 +161,10 @@ export class ApplicationCommandsAPI {
applicationId: Snowflake, applicationId: Snowflake,
guildId: Snowflake, guildId: Snowflake,
query: RESTGetAPIApplicationGuildCommandsQuery = {}, query: RESTGetAPIApplicationGuildCommandsQuery = {},
{ signal }: Pick<RequestData, 'signal'> = {}, { auth, signal }: Pick<RequestData, 'auth' | 'signal'> = {},
) { ) {
return this.rest.get(Routes.applicationGuildCommands(applicationId, guildId), { return this.rest.get(Routes.applicationGuildCommands(applicationId, guildId), {
auth,
query: makeURLSearchParams(query), query: makeURLSearchParams(query),
signal, signal,
}) as Promise<RESTGetAPIApplicationGuildCommandsResult>; }) as Promise<RESTGetAPIApplicationGuildCommandsResult>;
@@ -177,9 +183,10 @@ export class ApplicationCommandsAPI {
applicationId: Snowflake, applicationId: Snowflake,
guildId: Snowflake, guildId: Snowflake,
body: RESTPostAPIApplicationGuildCommandsJSONBody, body: RESTPostAPIApplicationGuildCommandsJSONBody,
{ signal }: Pick<RequestData, 'signal'> = {}, { auth, signal }: Pick<RequestData, 'auth' | 'signal'> = {},
) { ) {
return this.rest.post(Routes.applicationGuildCommands(applicationId, guildId), { return this.rest.post(Routes.applicationGuildCommands(applicationId, guildId), {
auth,
body, body,
signal, signal,
}) as Promise<RESTPostAPIApplicationGuildCommandsResult>; }) as Promise<RESTPostAPIApplicationGuildCommandsResult>;
@@ -198,9 +205,10 @@ export class ApplicationCommandsAPI {
applicationId: Snowflake, applicationId: Snowflake,
guildId: Snowflake, guildId: Snowflake,
commandId: Snowflake, commandId: Snowflake,
{ signal }: Pick<RequestData, 'signal'> = {}, { auth, signal }: Pick<RequestData, 'auth' | 'signal'> = {},
) { ) {
return this.rest.get(Routes.applicationGuildCommand(applicationId, guildId, commandId), { return this.rest.get(Routes.applicationGuildCommand(applicationId, guildId, commandId), {
auth,
signal, signal,
}) as Promise<RESTGetAPIApplicationGuildCommandResult>; }) as Promise<RESTGetAPIApplicationGuildCommandResult>;
} }
@@ -220,9 +228,10 @@ export class ApplicationCommandsAPI {
guildId: Snowflake, guildId: Snowflake,
commandId: Snowflake, commandId: Snowflake,
body: RESTPatchAPIApplicationGuildCommandJSONBody, body: RESTPatchAPIApplicationGuildCommandJSONBody,
{ signal }: Pick<RequestData, 'signal'> = {}, { auth, signal }: Pick<RequestData, 'auth' | 'signal'> = {},
) { ) {
return this.rest.patch(Routes.applicationGuildCommand(applicationId, guildId, commandId), { return this.rest.patch(Routes.applicationGuildCommand(applicationId, guildId, commandId), {
auth,
body, body,
signal, signal,
}) as Promise<RESTPatchAPIApplicationGuildCommandResult>; }) as Promise<RESTPatchAPIApplicationGuildCommandResult>;
@@ -241,9 +250,9 @@ export class ApplicationCommandsAPI {
applicationId: Snowflake, applicationId: Snowflake,
guildId: Snowflake, guildId: Snowflake,
commandId: Snowflake, commandId: Snowflake,
{ signal }: Pick<RequestData, 'signal'> = {}, { auth, signal }: Pick<RequestData, 'auth' | 'signal'> = {},
) { ) {
await this.rest.delete(Routes.applicationGuildCommand(applicationId, guildId, commandId), { signal }); await this.rest.delete(Routes.applicationGuildCommand(applicationId, guildId, commandId), { auth, signal });
} }
/** /**
@@ -259,9 +268,10 @@ export class ApplicationCommandsAPI {
applicationId: Snowflake, applicationId: Snowflake,
guildId: Snowflake, guildId: Snowflake,
body: RESTPutAPIApplicationGuildCommandsJSONBody, body: RESTPutAPIApplicationGuildCommandsJSONBody,
{ signal }: Pick<RequestData, 'signal'> = {}, { auth, signal }: Pick<RequestData, 'auth' | 'signal'> = {},
) { ) {
return this.rest.put(Routes.applicationGuildCommands(applicationId, guildId), { return this.rest.put(Routes.applicationGuildCommands(applicationId, guildId), {
auth,
body, body,
signal, signal,
}) as Promise<RESTPutAPIApplicationGuildCommandsResult>; }) as Promise<RESTPutAPIApplicationGuildCommandsResult>;
@@ -280,9 +290,10 @@ export class ApplicationCommandsAPI {
applicationId: Snowflake, applicationId: Snowflake,
guildId: Snowflake, guildId: Snowflake,
commandId: Snowflake, commandId: Snowflake,
{ signal }: Pick<RequestData, 'signal'> = {}, { auth, signal }: Pick<RequestData, 'auth' | 'signal'> = {},
) { ) {
return this.rest.get(Routes.applicationCommandPermissions(applicationId, guildId, commandId), { return this.rest.get(Routes.applicationCommandPermissions(applicationId, guildId, commandId), {
auth,
signal, signal,
}) as Promise<RESTGetAPIApplicationCommandPermissionsResult>; }) as Promise<RESTGetAPIApplicationCommandPermissionsResult>;
} }
@@ -298,9 +309,10 @@ export class ApplicationCommandsAPI {
public async getGuildCommandsPermissions( public async getGuildCommandsPermissions(
applicationId: Snowflake, applicationId: Snowflake,
guildId: Snowflake, guildId: Snowflake,
{ signal }: Pick<RequestData, 'signal'> = {}, { auth, signal }: Pick<RequestData, 'auth' | 'signal'> = {},
) { ) {
return this.rest.get(Routes.guildApplicationCommandsPermissions(applicationId, guildId), { return this.rest.get(Routes.guildApplicationCommandsPermissions(applicationId, guildId), {
auth,
signal, signal,
}) as Promise<RESTGetAPIGuildApplicationCommandsPermissionsResult>; }) as Promise<RESTGetAPIGuildApplicationCommandsPermissionsResult>;
} }

View File

@@ -24,8 +24,8 @@ export class ApplicationsAPI {
* @see {@link https://discord.com/developers/docs/resources/application#get-current-application} * @see {@link https://discord.com/developers/docs/resources/application#get-current-application}
* @param options - The options for fetching the application * @param options - The options for fetching the application
*/ */
public async getCurrent({ signal }: Pick<RequestData, 'signal'> = {}) { public async getCurrent({ auth, signal }: Pick<RequestData, 'auth' | 'signal'> = {}) {
return this.rest.get(Routes.currentApplication(), { signal }) as Promise<RESTGetCurrentApplicationResult>; return this.rest.get(Routes.currentApplication(), { auth, signal }) as Promise<RESTGetCurrentApplicationResult>;
} }
/** /**
@@ -35,8 +35,12 @@ export class ApplicationsAPI {
* @param body - The new application data * @param body - The new application data
* @param options - The options for editing the application * @param options - The options for editing the application
*/ */
public async editCurrent(body: RESTPatchCurrentApplicationJSONBody, { signal }: Pick<RequestData, 'signal'> = {}) { public async editCurrent(
body: RESTPatchCurrentApplicationJSONBody,
{ auth, signal }: Pick<RequestData, 'auth' | 'signal'> = {},
) {
return this.rest.patch(Routes.currentApplication(), { return this.rest.patch(Routes.currentApplication(), {
auth,
body, body,
signal, signal,
}) as Promise<RESTPatchCurrentApplicationResult>; }) as Promise<RESTPatchCurrentApplicationResult>;
@@ -49,8 +53,9 @@ export class ApplicationsAPI {
* @param applicationId - The id of the application to fetch the emojis of * @param applicationId - The id of the application to fetch the emojis of
* @param options - The options for fetching the emojis * @param options - The options for fetching the emojis
*/ */
public async getEmojis(applicationId: Snowflake, { signal }: Pick<RequestData, 'signal'> = {}) { public async getEmojis(applicationId: Snowflake, { auth, signal }: Pick<RequestData, 'auth' | 'signal'> = {}) {
return this.rest.get(Routes.applicationEmojis(applicationId), { return this.rest.get(Routes.applicationEmojis(applicationId), {
auth,
signal, signal,
}) as Promise<RESTGetAPIApplicationEmojisResult>; }) as Promise<RESTGetAPIApplicationEmojisResult>;
} }
@@ -63,8 +68,13 @@ export class ApplicationsAPI {
* @param emojiId - The id of the emoji to fetch * @param emojiId - The id of the emoji to fetch
* @param options - The options for fetching the emoji * @param options - The options for fetching the emoji
*/ */
public async getEmoji(applicationId: Snowflake, emojiId: Snowflake, { signal }: Pick<RequestData, 'signal'> = {}) { public async getEmoji(
applicationId: Snowflake,
emojiId: Snowflake,
{ auth, signal }: Pick<RequestData, 'auth' | 'signal'> = {},
) {
return this.rest.get(Routes.applicationEmoji(applicationId, emojiId), { return this.rest.get(Routes.applicationEmoji(applicationId, emojiId), {
auth,
signal, signal,
}) as Promise<RESTGetAPIApplicationEmojiResult>; }) as Promise<RESTGetAPIApplicationEmojiResult>;
} }
@@ -80,9 +90,10 @@ export class ApplicationsAPI {
public async createEmoji( public async createEmoji(
applicationId: Snowflake, applicationId: Snowflake,
body: RESTPostAPIApplicationEmojiJSONBody, body: RESTPostAPIApplicationEmojiJSONBody,
{ signal }: Pick<RequestData, 'signal'> = {}, { auth, signal }: Pick<RequestData, 'auth' | 'signal'> = {},
) { ) {
return this.rest.post(Routes.applicationEmojis(applicationId), { return this.rest.post(Routes.applicationEmojis(applicationId), {
auth,
body, body,
signal, signal,
}) as Promise<RESTPostAPIApplicationEmojiResult>; }) as Promise<RESTPostAPIApplicationEmojiResult>;
@@ -101,9 +112,10 @@ export class ApplicationsAPI {
applicationId: Snowflake, applicationId: Snowflake,
emojiId: Snowflake, emojiId: Snowflake,
body: RESTPatchAPIApplicationEmojiJSONBody, body: RESTPatchAPIApplicationEmojiJSONBody,
{ signal }: Pick<RequestData, 'signal'> = {}, { auth, signal }: Pick<RequestData, 'auth' | 'signal'> = {},
) { ) {
return this.rest.patch(Routes.applicationEmoji(applicationId, emojiId), { return this.rest.patch(Routes.applicationEmoji(applicationId, emojiId), {
auth,
body, body,
signal, signal,
}) as Promise<RESTPatchAPIApplicationEmojiResult>; }) as Promise<RESTPatchAPIApplicationEmojiResult>;
@@ -117,7 +129,11 @@ export class ApplicationsAPI {
* @param emojiId - The id of the emoji to delete * @param emojiId - The id of the emoji to delete
* @param options - The options for deleting the emoji * @param options - The options for deleting the emoji
*/ */
public async deleteEmoji(applicationId: Snowflake, emojiId: Snowflake, { signal }: Pick<RequestData, 'signal'> = {}) { public async deleteEmoji(
await this.rest.delete(Routes.applicationEmoji(applicationId, emojiId), { signal }); applicationId: Snowflake,
emojiId: Snowflake,
{ auth, signal }: Pick<RequestData, 'auth' | 'signal'> = {},
) {
await this.rest.delete(Routes.applicationEmoji(applicationId, emojiId), { auth, signal });
} }
} }

View File

@@ -63,9 +63,10 @@ export class ChannelsAPI {
public async createMessage( public async createMessage(
channelId: Snowflake, channelId: Snowflake,
{ files, ...body }: CreateMessageOptions, { files, ...body }: CreateMessageOptions,
{ signal }: Pick<RequestData, 'signal'> = {}, { auth, signal }: Pick<RequestData, 'auth' | 'signal'> = {},
) { ) {
return this.rest.post(Routes.channelMessages(channelId), { return this.rest.post(Routes.channelMessages(channelId), {
auth,
files, files,
body, body,
signal, signal,
@@ -85,9 +86,10 @@ export class ChannelsAPI {
channelId: Snowflake, channelId: Snowflake,
messageId: Snowflake, messageId: Snowflake,
{ files, ...body }: EditMessageOptions, { files, ...body }: EditMessageOptions,
{ signal }: Pick<RequestData, 'signal'> = {}, { auth, signal }: Pick<RequestData, 'auth' | 'signal'> = {},
) { ) {
return this.rest.patch(Routes.channelMessage(channelId, messageId), { return this.rest.patch(Routes.channelMessage(channelId, messageId), {
auth,
files, files,
body, body,
signal, signal,
@@ -117,9 +119,10 @@ export class ChannelsAPI {
messageId: Snowflake, messageId: Snowflake,
emoji: string, emoji: string,
query: RESTGetAPIChannelMessageReactionUsersQuery = {}, query: RESTGetAPIChannelMessageReactionUsersQuery = {},
{ signal }: Pick<RequestData, 'signal'> = {}, { auth, signal }: Pick<RequestData, 'auth' | 'signal'> = {},
) { ) {
return this.rest.get(Routes.channelMessageReaction(channelId, messageId, encodeURIComponent(emoji)), { return this.rest.get(Routes.channelMessageReaction(channelId, messageId, encodeURIComponent(emoji)), {
auth,
query: makeURLSearchParams(query), query: makeURLSearchParams(query),
signal, signal,
}) as Promise<RESTGetAPIChannelMessageReactionUsersResult>; }) as Promise<RESTGetAPIChannelMessageReactionUsersResult>;
@@ -146,9 +149,10 @@ export class ChannelsAPI {
channelId: Snowflake, channelId: Snowflake,
messageId: Snowflake, messageId: Snowflake,
emoji: string, emoji: string,
{ signal }: Pick<RequestData, 'signal'> = {}, { auth, signal }: Pick<RequestData, 'auth' | 'signal'> = {},
) { ) {
await this.rest.delete(Routes.channelMessageOwnReaction(channelId, messageId, encodeURIComponent(emoji)), { await this.rest.delete(Routes.channelMessageOwnReaction(channelId, messageId, encodeURIComponent(emoji)), {
auth,
signal, signal,
}); });
} }
@@ -176,9 +180,10 @@ export class ChannelsAPI {
messageId: Snowflake, messageId: Snowflake,
emoji: string, emoji: string,
userId: Snowflake, userId: Snowflake,
{ signal }: Pick<RequestData, 'signal'> = {}, { auth, signal }: Pick<RequestData, 'auth' | 'signal'> = {},
) { ) {
await this.rest.delete(Routes.channelMessageUserReaction(channelId, messageId, encodeURIComponent(emoji), userId), { await this.rest.delete(Routes.channelMessageUserReaction(channelId, messageId, encodeURIComponent(emoji), userId), {
auth,
signal, signal,
}); });
} }
@@ -194,9 +199,9 @@ export class ChannelsAPI {
public async deleteAllMessageReactions( public async deleteAllMessageReactions(
channelId: Snowflake, channelId: Snowflake,
messageId: Snowflake, messageId: Snowflake,
{ signal }: Pick<RequestData, 'signal'> = {}, { auth, signal }: Pick<RequestData, 'auth' | 'signal'> = {},
) { ) {
await this.rest.delete(Routes.channelMessageAllReactions(channelId, messageId), { signal }); await this.rest.delete(Routes.channelMessageAllReactions(channelId, messageId), { auth, signal });
} }
/** /**
@@ -220,9 +225,12 @@ export class ChannelsAPI {
channelId: Snowflake, channelId: Snowflake,
messageId: Snowflake, messageId: Snowflake,
emoji: string, emoji: string,
{ signal }: Pick<RequestData, 'signal'> = {}, { auth, signal }: Pick<RequestData, 'auth' | 'signal'> = {},
) { ) {
await this.rest.delete(Routes.channelMessageReaction(channelId, messageId, encodeURIComponent(emoji)), { signal }); await this.rest.delete(Routes.channelMessageReaction(channelId, messageId, encodeURIComponent(emoji)), {
auth,
signal,
});
} }
/** /**
@@ -246,9 +254,12 @@ export class ChannelsAPI {
channelId: Snowflake, channelId: Snowflake,
messageId: Snowflake, messageId: Snowflake,
emoji: string, emoji: string,
{ signal }: Pick<RequestData, 'signal'> = {}, { auth, signal }: Pick<RequestData, 'auth' | 'signal'> = {},
) { ) {
await this.rest.put(Routes.channelMessageOwnReaction(channelId, messageId, encodeURIComponent(emoji)), { signal }); await this.rest.put(Routes.channelMessageOwnReaction(channelId, messageId, encodeURIComponent(emoji)), {
auth,
signal,
});
} }
/** /**
@@ -258,8 +269,8 @@ export class ChannelsAPI {
* @param channelId - The id of the channel * @param channelId - The id of the channel
* @param options - The options for fetching the channel * @param options - The options for fetching the channel
*/ */
public async get(channelId: Snowflake, { signal }: Pick<RequestData, 'signal'> = {}) { public async get(channelId: Snowflake, { auth, signal }: Pick<RequestData, 'auth' | 'signal'> = {}) {
return this.rest.get(Routes.channel(channelId), { signal }) as Promise<RESTGetAPIChannelResult>; return this.rest.get(Routes.channel(channelId), { auth, signal }) as Promise<RESTGetAPIChannelResult>;
} }
/** /**
@@ -273,9 +284,9 @@ export class ChannelsAPI {
public async edit( public async edit(
channelId: Snowflake, channelId: Snowflake,
body: RESTPatchAPIChannelJSONBody, body: RESTPatchAPIChannelJSONBody,
{ signal }: Pick<RequestData, 'signal'> = {}, { auth, signal }: Pick<RequestData, 'auth' | 'signal'> = {},
) { ) {
return this.rest.patch(Routes.channel(channelId), { body, signal }) as Promise<RESTPatchAPIChannelResult>; return this.rest.patch(Routes.channel(channelId), { auth, body, signal }) as Promise<RESTPatchAPIChannelResult>;
} }
/** /**
@@ -285,8 +296,8 @@ export class ChannelsAPI {
* @param channelId - The id of the channel to delete * @param channelId - The id of the channel to delete
* @param options - The options for deleting the channel * @param options - The options for deleting the channel
*/ */
public async delete(channelId: Snowflake, { signal }: Pick<RequestData, 'signal'> = {}) { public async delete(channelId: Snowflake, { auth, signal }: Pick<RequestData, 'auth' | 'signal'> = {}) {
return this.rest.delete(Routes.channel(channelId), { signal }) as Promise<RESTDeleteAPIChannelResult>; return this.rest.delete(Routes.channel(channelId), { auth, signal }) as Promise<RESTDeleteAPIChannelResult>;
} }
/** /**
@@ -300,9 +311,10 @@ export class ChannelsAPI {
public async getMessages( public async getMessages(
channelId: Snowflake, channelId: Snowflake,
query: RESTGetAPIChannelMessagesQuery = {}, query: RESTGetAPIChannelMessagesQuery = {},
{ signal }: Pick<RequestData, 'signal'> = {}, { auth, signal }: Pick<RequestData, 'auth' | 'signal'> = {},
) { ) {
return this.rest.get(Routes.channelMessages(channelId), { return this.rest.get(Routes.channelMessages(channelId), {
auth,
query: makeURLSearchParams(query), query: makeURLSearchParams(query),
signal, signal,
}) as Promise<RESTGetAPIChannelMessagesResult>; }) as Promise<RESTGetAPIChannelMessagesResult>;
@@ -315,8 +327,8 @@ export class ChannelsAPI {
* @param channelId - The id of the channel to show the typing indicator in * @param channelId - The id of the channel to show the typing indicator in
* @param options - The options for showing the typing indicator * @param options - The options for showing the typing indicator
*/ */
public async showTyping(channelId: Snowflake, { signal }: Pick<RequestData, 'signal'> = {}) { public async showTyping(channelId: Snowflake, { auth, signal }: Pick<RequestData, 'auth' | 'signal'> = {}) {
await this.rest.post(Routes.channelTyping(channelId), { signal }); await this.rest.post(Routes.channelTyping(channelId), { auth, signal });
} }
/** /**
@@ -326,8 +338,8 @@ export class ChannelsAPI {
* @param channelId - The id of the channel to fetch pinned messages from * @param channelId - The id of the channel to fetch pinned messages from
* @param options - The options for fetching the pinned messages * @param options - The options for fetching the pinned messages
*/ */
public async getPins(channelId: Snowflake, { signal }: Pick<RequestData, 'signal'> = {}) { public async getPins(channelId: Snowflake, { auth, signal }: Pick<RequestData, 'auth' | 'signal'> = {}) {
return this.rest.get(Routes.channelPins(channelId), { signal }) as Promise<RESTGetAPIChannelPinsResult>; return this.rest.get(Routes.channelPins(channelId), { auth, signal }) as Promise<RESTGetAPIChannelPinsResult>;
} }
/** /**
@@ -341,9 +353,9 @@ export class ChannelsAPI {
public async pinMessage( public async pinMessage(
channelId: Snowflake, channelId: Snowflake,
messageId: Snowflake, messageId: Snowflake,
{ reason, signal }: Pick<RequestData, 'reason' | 'signal'> = {}, { auth, reason, signal }: Pick<RequestData, 'auth' | 'reason' | 'signal'> = {},
) { ) {
await this.rest.put(Routes.channelPin(channelId, messageId), { reason, signal }); await this.rest.put(Routes.channelPin(channelId, messageId), { auth, reason, signal });
} }
/** /**
@@ -357,9 +369,9 @@ export class ChannelsAPI {
public async deleteMessage( public async deleteMessage(
channelId: Snowflake, channelId: Snowflake,
messageId: Snowflake, messageId: Snowflake,
{ reason, signal }: Pick<RequestData, 'reason' | 'signal'> = {}, { auth, reason, signal }: Pick<RequestData, 'auth' | 'reason' | 'signal'> = {},
) { ) {
await this.rest.delete(Routes.channelMessage(channelId, messageId), { reason, signal }); await this.rest.delete(Routes.channelMessage(channelId, messageId), { auth, reason, signal });
} }
/** /**
@@ -373,9 +385,9 @@ export class ChannelsAPI {
public async bulkDeleteMessages( public async bulkDeleteMessages(
channelId: Snowflake, channelId: Snowflake,
messageIds: Snowflake[], messageIds: Snowflake[],
{ reason, signal }: Pick<RequestData, 'reason' | 'signal'> = {}, { auth, reason, signal }: Pick<RequestData, 'auth' | 'reason' | 'signal'> = {},
): Promise<void> { ): Promise<void> {
await this.rest.post(Routes.channelBulkDelete(channelId), { reason, body: { messages: messageIds }, signal }); await this.rest.post(Routes.channelBulkDelete(channelId), { auth, reason, body: { messages: messageIds }, signal });
} }
/** /**
@@ -386,8 +398,13 @@ export class ChannelsAPI {
* @param messageId - The id of the message to fetch * @param messageId - The id of the message to fetch
* @param options - The options for fetching the message * @param options - The options for fetching the message
*/ */
public async getMessage(channelId: Snowflake, messageId: Snowflake, { signal }: Pick<RequestData, 'signal'> = {}) { public async getMessage(
channelId: Snowflake,
messageId: Snowflake,
{ auth, signal }: Pick<RequestData, 'auth' | 'signal'> = {},
) {
return this.rest.get(Routes.channelMessage(channelId, messageId), { return this.rest.get(Routes.channelMessage(channelId, messageId), {
auth,
signal, signal,
}) as Promise<RESTGetAPIChannelMessageResult>; }) as Promise<RESTGetAPIChannelMessageResult>;
} }
@@ -403,9 +420,10 @@ export class ChannelsAPI {
public async crosspostMessage( public async crosspostMessage(
channelId: Snowflake, channelId: Snowflake,
messageId: Snowflake, messageId: Snowflake,
{ signal }: Pick<RequestData, 'signal'> = {}, { auth, signal }: Pick<RequestData, 'auth' | 'signal'> = {},
) { ) {
return this.rest.post(Routes.channelMessageCrosspost(channelId, messageId), { return this.rest.post(Routes.channelMessageCrosspost(channelId, messageId), {
auth,
signal, signal,
}) as Promise<RESTPostAPIChannelMessageCrosspostResult>; }) as Promise<RESTPostAPIChannelMessageCrosspostResult>;
} }
@@ -421,9 +439,9 @@ export class ChannelsAPI {
public async unpinMessage( public async unpinMessage(
channelId: Snowflake, channelId: Snowflake,
messageId: Snowflake, messageId: Snowflake,
{ reason, signal }: Pick<RequestData, 'reason' | 'signal'> = {}, { auth, reason, signal }: Pick<RequestData, 'auth' | 'reason' | 'signal'> = {},
) { ) {
await this.rest.delete(Routes.channelPin(channelId, messageId), { reason, signal }); await this.rest.delete(Routes.channelPin(channelId, messageId), { auth, reason, signal });
} }
/** /**
@@ -437,9 +455,10 @@ export class ChannelsAPI {
public async followAnnouncements( public async followAnnouncements(
channelId: Snowflake, channelId: Snowflake,
webhookChannelId: Snowflake, webhookChannelId: Snowflake,
{ reason, signal }: Pick<RequestData, 'reason' | 'signal'> = {}, { auth, reason, signal }: Pick<RequestData, 'auth' | 'reason' | 'signal'> = {},
) { ) {
return this.rest.post(Routes.channelFollowers(channelId), { return this.rest.post(Routes.channelFollowers(channelId), {
auth,
body: { webhook_channel_id: webhookChannelId }, body: { webhook_channel_id: webhookChannelId },
reason, reason,
signal, signal,
@@ -457,9 +476,10 @@ export class ChannelsAPI {
public async createInvite( public async createInvite(
channelId: Snowflake, channelId: Snowflake,
body: RESTPostAPIChannelInviteJSONBody, body: RESTPostAPIChannelInviteJSONBody,
{ reason, signal }: Pick<RequestData, 'reason' | 'signal'> = {}, { auth, reason, signal }: Pick<RequestData, 'auth' | 'reason' | 'signal'> = {},
) { ) {
return this.rest.post(Routes.channelInvites(channelId), { return this.rest.post(Routes.channelInvites(channelId), {
auth,
reason, reason,
body, body,
signal, signal,
@@ -473,8 +493,8 @@ export class ChannelsAPI {
* @param channelId - The id of the channel to fetch invites from * @param channelId - The id of the channel to fetch invites from
* @param options - The options for fetching the invites * @param options - The options for fetching the invites
*/ */
public async getInvites(channelId: Snowflake, { signal }: Pick<RequestData, 'signal'> = {}) { public async getInvites(channelId: Snowflake, { auth, signal }: Pick<RequestData, 'auth' | 'signal'> = {}) {
return this.rest.get(Routes.channelInvites(channelId), { signal }) as Promise<RESTGetAPIChannelInvitesResult>; return this.rest.get(Routes.channelInvites(channelId), { auth, signal }) as Promise<RESTGetAPIChannelInvitesResult>;
} }
/** /**
@@ -491,9 +511,10 @@ export class ChannelsAPI {
channelId: Snowflake, channelId: Snowflake,
body: RESTPostAPIChannelThreadsJSONBody, body: RESTPostAPIChannelThreadsJSONBody,
messageId?: Snowflake, messageId?: Snowflake,
{ signal }: Pick<RequestData, 'signal'> = {}, { auth, signal }: Pick<RequestData, 'auth' | 'signal'> = {},
) { ) {
return this.rest.post(Routes.threads(channelId, messageId), { return this.rest.post(Routes.threads(channelId, messageId), {
auth,
body, body,
signal, signal,
}) as Promise<RESTPostAPIChannelThreadsResult>; }) as Promise<RESTPostAPIChannelThreadsResult>;
@@ -510,7 +531,7 @@ export class ChannelsAPI {
public async createForumThread( public async createForumThread(
channelId: Snowflake, channelId: Snowflake,
{ message, ...optionsBody }: StartForumThreadOptions, { message, ...optionsBody }: StartForumThreadOptions,
{ signal }: Pick<RequestData, 'signal'> = {}, { auth, signal }: Pick<RequestData, 'auth' | 'signal'> = {},
) { ) {
const { files, ...messageBody } = message; const { files, ...messageBody } = message;
@@ -519,7 +540,7 @@ export class ChannelsAPI {
message: messageBody, message: messageBody,
}; };
return this.rest.post(Routes.threads(channelId), { files, body, signal }) as Promise<APIThreadChannel>; return this.rest.post(Routes.threads(channelId), { auth, files, body, signal }) as Promise<APIThreadChannel>;
} }
/** /**
@@ -536,9 +557,10 @@ export class ChannelsAPI {
channelId: Snowflake, channelId: Snowflake,
archivedStatus: 'private' | 'public', archivedStatus: 'private' | 'public',
query: RESTGetAPIChannelThreadsArchivedQuery = {}, query: RESTGetAPIChannelThreadsArchivedQuery = {},
{ signal }: Pick<RequestData, 'signal'> = {}, { auth, signal }: Pick<RequestData, 'auth' | 'signal'> = {},
) { ) {
return this.rest.get(Routes.channelThreads(channelId, archivedStatus), { return this.rest.get(Routes.channelThreads(channelId, archivedStatus), {
auth,
query: makeURLSearchParams(query), query: makeURLSearchParams(query),
signal, signal,
}) as Promise<RESTGetAPIChannelUsersThreadsArchivedResult>; }) as Promise<RESTGetAPIChannelUsersThreadsArchivedResult>;
@@ -555,9 +577,10 @@ export class ChannelsAPI {
public async getJoinedPrivateArchivedThreads( public async getJoinedPrivateArchivedThreads(
channelId: Snowflake, channelId: Snowflake,
query: RESTGetAPIChannelThreadsArchivedQuery = {}, query: RESTGetAPIChannelThreadsArchivedQuery = {},
{ signal }: Pick<RequestData, 'signal'> = {}, { auth, signal }: Pick<RequestData, 'auth' | 'signal'> = {},
) { ) {
return this.rest.get(Routes.channelJoinedArchivedThreads(channelId), { return this.rest.get(Routes.channelJoinedArchivedThreads(channelId), {
auth,
query: makeURLSearchParams(query), query: makeURLSearchParams(query),
signal, signal,
}) as Promise<RESTGetAPIChannelUsersThreadsArchivedResult>; }) as Promise<RESTGetAPIChannelUsersThreadsArchivedResult>;
@@ -574,9 +597,10 @@ export class ChannelsAPI {
public async createWebhook( public async createWebhook(
channelId: Snowflake, channelId: Snowflake,
body: RESTPostAPIChannelWebhookJSONBody, body: RESTPostAPIChannelWebhookJSONBody,
{ reason, signal }: Pick<RequestData, 'reason' | 'signal'> = {}, { auth, reason, signal }: Pick<RequestData, 'auth' | 'reason' | 'signal'> = {},
) { ) {
return this.rest.post(Routes.channelWebhooks(channelId), { return this.rest.post(Routes.channelWebhooks(channelId), {
auth,
reason, reason,
body, body,
signal, signal,
@@ -588,9 +612,13 @@ export class ChannelsAPI {
* *
* @see {@link https://discord.com/developers/docs/resources/webhook#get-channel-webhooks} * @see {@link https://discord.com/developers/docs/resources/webhook#get-channel-webhooks}
* @param channelId - The id of the channel * @param channelId - The id of the channel
* @param options - The options for fetching the webhooks
*/ */
public async getWebhooks(channelId: Snowflake) { public async getWebhooks(channelId: Snowflake, { auth, signal }: Pick<RequestData, 'auth' | 'signal'> = {}) {
return this.rest.get(Routes.channelWebhooks(channelId)) as Promise<RESTGetAPIChannelWebhooksResult>; return this.rest.get(Routes.channelWebhooks(channelId), {
auth,
signal,
}) as Promise<RESTGetAPIChannelWebhooksResult>;
} }
/** /**
@@ -606,9 +634,10 @@ export class ChannelsAPI {
channelId: Snowflake, channelId: Snowflake,
overwriteId: Snowflake, overwriteId: Snowflake,
body: RESTPutAPIChannelPermissionJSONBody, body: RESTPutAPIChannelPermissionJSONBody,
{ reason, signal }: Pick<RequestData, 'reason' | 'signal'> = {}, { auth, reason, signal }: Pick<RequestData, 'auth' | 'reason' | 'signal'> = {},
) { ) {
await this.rest.put(Routes.channelPermission(channelId, overwriteId), { await this.rest.put(Routes.channelPermission(channelId, overwriteId), {
auth,
reason, reason,
body, body,
signal, signal,
@@ -626,9 +655,10 @@ export class ChannelsAPI {
public async deletePermissionOverwrite( public async deletePermissionOverwrite(
channelId: Snowflake, channelId: Snowflake,
overwriteId: Snowflake, overwriteId: Snowflake,
{ reason, signal }: Pick<RequestData, 'reason' | 'signal'> = {}, { auth, reason, signal }: Pick<RequestData, 'auth' | 'reason' | 'signal'> = {},
) { ) {
await this.rest.delete(Routes.channelPermission(channelId, overwriteId), { await this.rest.delete(Routes.channelPermission(channelId, overwriteId), {
auth,
reason, reason,
signal, signal,
}); });
@@ -645,9 +675,10 @@ export class ChannelsAPI {
public async sendSoundboardSound( public async sendSoundboardSound(
channelId: Snowflake, channelId: Snowflake,
body: RESTPostAPISoundboardSendSoundJSONBody, body: RESTPostAPISoundboardSendSoundJSONBody,
{ signal }: Pick<RequestData, 'signal'> = {}, { auth, signal }: Pick<RequestData, 'auth' | 'signal'> = {},
) { ) {
return this.rest.post(Routes.sendSoundboardSound(channelId), { return this.rest.post(Routes.sendSoundboardSound(channelId), {
auth,
body, body,
signal, signal,
}) as Promise<RESTPostAPISendSoundboardSoundResult>; }) as Promise<RESTPostAPISendSoundboardSoundResult>;

View File

@@ -122,8 +122,13 @@ export class GuildsAPI {
* @param query - The query options for fetching the guild * @param query - The query options for fetching the guild
* @param options - The options for fetching the guild * @param options - The options for fetching the guild
*/ */
public async get(guildId: Snowflake, query: RESTGetAPIGuildQuery = {}, { signal }: Pick<RequestData, 'signal'> = {}) { public async get(
guildId: Snowflake,
query: RESTGetAPIGuildQuery = {},
{ auth, signal }: Pick<RequestData, 'auth' | 'signal'> = {},
) {
return this.rest.get(Routes.guild(guildId), { return this.rest.get(Routes.guild(guildId), {
auth,
query: makeURLSearchParams(query), query: makeURLSearchParams(query),
signal, signal,
}) as Promise<RESTGetAPIGuildResult>; }) as Promise<RESTGetAPIGuildResult>;
@@ -136,8 +141,9 @@ export class GuildsAPI {
* @param guildId - The id of the guild to fetch the preview from * @param guildId - The id of the guild to fetch the preview from
* @param options - The options for fetching the guild preview * @param options - The options for fetching the guild preview
*/ */
public async getPreview(guildId: Snowflake, { signal }: Pick<RequestData, 'signal'> = {}) { public async getPreview(guildId: Snowflake, { auth, signal }: Pick<RequestData, 'auth' | 'signal'> = {}) {
return this.rest.get(Routes.guildPreview(guildId), { return this.rest.get(Routes.guildPreview(guildId), {
auth,
signal, signal,
}) as Promise<RESTGetAPIGuildPreviewResult>; }) as Promise<RESTGetAPIGuildPreviewResult>;
} }
@@ -149,8 +155,8 @@ export class GuildsAPI {
* @param body - The guild to create * @param body - The guild to create
* @param options - The options for creating the guild * @param options - The options for creating the guild
*/ */
public async create(body: RESTPostAPIGuildsJSONBody, { signal }: Pick<RequestData, 'signal'> = {}) { public async create(body: RESTPostAPIGuildsJSONBody, { auth, signal }: Pick<RequestData, 'auth' | 'signal'> = {}) {
return this.rest.post(Routes.guilds(), { body, signal }) as Promise<RESTPostAPIGuildsResult>; return this.rest.post(Routes.guilds(), { auth, body, signal }) as Promise<RESTPostAPIGuildsResult>;
} }
/** /**
@@ -164,9 +170,10 @@ export class GuildsAPI {
public async edit( public async edit(
guildId: Snowflake, guildId: Snowflake,
body: RESTPatchAPIGuildJSONBody, body: RESTPatchAPIGuildJSONBody,
{ reason, signal }: Pick<RequestData, 'reason' | 'signal'> = {}, { auth, reason, signal }: Pick<RequestData, 'auth' | 'reason' | 'signal'> = {},
) { ) {
return this.rest.patch(Routes.guild(guildId), { return this.rest.patch(Routes.guild(guildId), {
auth,
reason, reason,
body, body,
signal, signal,
@@ -180,8 +187,11 @@ export class GuildsAPI {
* @param guildId - The id of the guild to delete * @param guildId - The id of the guild to delete
* @param options - The options for deleting this guild * @param options - The options for deleting this guild
*/ */
public async delete(guildId: Snowflake, { signal, reason }: Pick<RequestData, 'reason' | 'signal'> = {}) { public async delete(
await this.rest.delete(Routes.guild(guildId), { reason, signal }); guildId: Snowflake,
{ auth, reason, signal }: Pick<RequestData, 'auth' | 'reason' | 'signal'> = {},
) {
await this.rest.delete(Routes.guild(guildId), { auth, reason, signal });
} }
/** /**
@@ -197,9 +207,10 @@ export class GuildsAPI {
guildId: Snowflake, guildId: Snowflake,
userId: Snowflake, userId: Snowflake,
body: RESTPutAPIGuildMemberJSONBody, body: RESTPutAPIGuildMemberJSONBody,
{ signal }: Pick<RequestData, 'signal'> = {}, { auth, signal }: Pick<RequestData, 'auth' | 'signal'> = {},
) { ) {
return this.rest.put(Routes.guildMember(guildId, userId), { return this.rest.put(Routes.guildMember(guildId, userId), {
auth,
body, body,
signal, signal,
}) as Promise<RESTPutAPIGuildMemberResult>; }) as Promise<RESTPutAPIGuildMemberResult>;
@@ -216,9 +227,10 @@ export class GuildsAPI {
public async getMembers( public async getMembers(
guildId: Snowflake, guildId: Snowflake,
query: RESTGetAPIGuildMembersQuery = {}, query: RESTGetAPIGuildMembersQuery = {},
{ signal }: Pick<RequestData, 'signal'> = {}, { auth, signal }: Pick<RequestData, 'auth' | 'signal'> = {},
) { ) {
return this.rest.get(Routes.guildMembers(guildId), { return this.rest.get(Routes.guildMembers(guildId), {
auth,
query: makeURLSearchParams(query), query: makeURLSearchParams(query),
signal, signal,
}) as Promise<RESTGetAPIGuildMembersResult>; }) as Promise<RESTGetAPIGuildMembersResult>;
@@ -231,8 +243,9 @@ export class GuildsAPI {
* @param guildId - The id of the guild to fetch the channels from * @param guildId - The id of the guild to fetch the channels from
* @param options - The options for fetching the guild channels * @param options - The options for fetching the guild channels
*/ */
public async getChannels(guildId: Snowflake, { signal }: Pick<RequestData, 'signal'> = {}) { public async getChannels(guildId: Snowflake, { auth, signal }: Pick<RequestData, 'auth' | 'signal'> = {}) {
return this.rest.get(Routes.guildChannels(guildId), { return this.rest.get(Routes.guildChannels(guildId), {
auth,
signal, signal,
}) as Promise<RESTGetAPIGuildChannelsResult>; }) as Promise<RESTGetAPIGuildChannelsResult>;
} }
@@ -248,9 +261,10 @@ export class GuildsAPI {
public async createChannel( public async createChannel(
guildId: Snowflake, guildId: Snowflake,
body: RESTPostAPIGuildChannelJSONBody, body: RESTPostAPIGuildChannelJSONBody,
{ reason, signal }: Pick<RequestData, 'reason' | 'signal'> = {}, { auth, reason, signal }: Pick<RequestData, 'auth' | 'reason' | 'signal'> = {},
) { ) {
return this.rest.post(Routes.guildChannels(guildId), { return this.rest.post(Routes.guildChannels(guildId), {
auth,
reason, reason,
body, body,
signal, signal,
@@ -268,9 +282,9 @@ export class GuildsAPI {
public async setChannelPositions( public async setChannelPositions(
guildId: Snowflake, guildId: Snowflake,
body: RESTPatchAPIGuildChannelPositionsJSONBody, body: RESTPatchAPIGuildChannelPositionsJSONBody,
{ reason, signal }: Pick<RequestData, 'reason' | 'signal'> = {}, { auth, reason, signal }: Pick<RequestData, 'auth' | 'reason' | 'signal'> = {},
) { ) {
await this.rest.patch(Routes.guildChannels(guildId), { reason, body, signal }); await this.rest.patch(Routes.guildChannels(guildId), { auth, reason, body, signal });
} }
/** /**
@@ -280,8 +294,8 @@ export class GuildsAPI {
* @param guildId - The id of the guild to fetch the active threads from * @param guildId - The id of the guild to fetch the active threads from
* @param options - The options for fetching the active threads * @param options - The options for fetching the active threads
*/ */
public async getActiveThreads(guildId: Snowflake, { signal }: Pick<RequestData, 'signal'> = {}) { public async getActiveThreads(guildId: Snowflake, { auth, signal }: Pick<RequestData, 'auth' | 'signal'> = {}) {
return this.rest.get(Routes.guildActiveThreads(guildId), { signal }) as Promise<RESTGetAPIGuildThreadsResult>; return this.rest.get(Routes.guildActiveThreads(guildId), { auth, signal }) as Promise<RESTGetAPIGuildThreadsResult>;
} }
/** /**
@@ -292,8 +306,12 @@ export class GuildsAPI {
* @param userId - The id of the user to fetch the ban * @param userId - The id of the user to fetch the ban
* @param options - The options for fetching the ban * @param options - The options for fetching the ban
*/ */
public async getMemberBan(guildId: Snowflake, userId: Snowflake, { signal }: Pick<RequestData, 'signal'> = {}) { public async getMemberBan(
return this.rest.get(Routes.guildBan(guildId, userId), { signal }) as Promise<RESTGetAPIGuildBanResult>; guildId: Snowflake,
userId: Snowflake,
{ auth, signal }: Pick<RequestData, 'auth' | 'signal'> = {},
) {
return this.rest.get(Routes.guildBan(guildId, userId), { auth, signal }) as Promise<RESTGetAPIGuildBanResult>;
} }
/** /**
@@ -307,9 +325,10 @@ export class GuildsAPI {
public async getMemberBans( public async getMemberBans(
guildId: Snowflake, guildId: Snowflake,
query: RESTGetAPIGuildBansQuery = {}, query: RESTGetAPIGuildBansQuery = {},
{ signal }: Pick<RequestData, 'signal'> = {}, { auth, signal }: Pick<RequestData, 'auth' | 'signal'> = {},
) { ) {
return this.rest.get(Routes.guildBans(guildId), { return this.rest.get(Routes.guildBans(guildId), {
auth,
query: makeURLSearchParams(query), query: makeURLSearchParams(query),
signal, signal,
}) as Promise<RESTGetAPIGuildBansResult>; }) as Promise<RESTGetAPIGuildBansResult>;
@@ -328,9 +347,9 @@ export class GuildsAPI {
guildId: Snowflake, guildId: Snowflake,
userId: Snowflake, userId: Snowflake,
body: RESTPutAPIGuildBanJSONBody = {}, body: RESTPutAPIGuildBanJSONBody = {},
{ reason, signal }: Pick<RequestData, 'reason' | 'signal'> = {}, { auth, reason, signal }: Pick<RequestData, 'auth' | 'reason' | 'signal'> = {},
) { ) {
await this.rest.put(Routes.guildBan(guildId, userId), { reason, body, signal }); await this.rest.put(Routes.guildBan(guildId, userId), { auth, reason, body, signal });
} }
/** /**
@@ -344,9 +363,9 @@ export class GuildsAPI {
public async unbanUser( public async unbanUser(
guildId: Snowflake, guildId: Snowflake,
userId: Snowflake, userId: Snowflake,
{ reason, signal }: Pick<RequestData, 'reason' | 'signal'> = {}, { auth, reason, signal }: Pick<RequestData, 'auth' | 'reason' | 'signal'> = {},
) { ) {
await this.rest.delete(Routes.guildBan(guildId, userId), { reason, signal }); await this.rest.delete(Routes.guildBan(guildId, userId), { auth, reason, signal });
} }
/** /**
@@ -360,9 +379,10 @@ export class GuildsAPI {
public async bulkBanUsers( public async bulkBanUsers(
guildId: Snowflake, guildId: Snowflake,
body: RESTPostAPIGuildBulkBanJSONBody, body: RESTPostAPIGuildBulkBanJSONBody,
{ reason, signal }: Pick<RequestData, 'reason' | 'signal'> = {}, { auth, reason, signal }: Pick<RequestData, 'auth' | 'reason' | 'signal'> = {},
) { ) {
return this.rest.post(Routes.guildBulkBan(guildId), { return this.rest.post(Routes.guildBulkBan(guildId), {
auth,
reason, reason,
body, body,
signal, signal,
@@ -376,8 +396,8 @@ export class GuildsAPI {
* @param guildId - The id of the guild to fetch the roles from * @param guildId - The id of the guild to fetch the roles from
* @param options - The options for fetching the guild roles * @param options - The options for fetching the guild roles
*/ */
public async getRoles(guildId: Snowflake, { signal }: Pick<RequestData, 'signal'> = {}) { public async getRoles(guildId: Snowflake, { auth, signal }: Pick<RequestData, 'auth' | 'signal'> = {}) {
return this.rest.get(Routes.guildRoles(guildId), { signal }) as Promise<RESTGetAPIGuildRolesResult>; return this.rest.get(Routes.guildRoles(guildId), { auth, signal }) as Promise<RESTGetAPIGuildRolesResult>;
} }
/** /**
@@ -388,8 +408,12 @@ export class GuildsAPI {
* @param roleId - The id of the role to fetch * @param roleId - The id of the role to fetch
* @param options - The options for fetching the guild role * @param options - The options for fetching the guild role
*/ */
public async getRole(guildId: Snowflake, roleId: Snowflake, { signal }: Pick<RequestData, 'signal'> = {}) { public async getRole(
return this.rest.get(Routes.guildRole(guildId, roleId), { signal }) as Promise<RESTGetAPIGuildRoleResult>; guildId: Snowflake,
roleId: Snowflake,
{ auth, signal }: Pick<RequestData, 'auth' | 'signal'> = {},
) {
return this.rest.get(Routes.guildRole(guildId, roleId), { auth, signal }) as Promise<RESTGetAPIGuildRoleResult>;
} }
/** /**
@@ -403,9 +427,14 @@ export class GuildsAPI {
public async createRole( public async createRole(
guildId: Snowflake, guildId: Snowflake,
body: RESTPostAPIGuildRoleJSONBody, body: RESTPostAPIGuildRoleJSONBody,
{ reason, signal }: Pick<RequestData, 'reason' | 'signal'> = {}, { auth, reason, signal }: Pick<RequestData, 'auth' | 'reason' | 'signal'> = {},
) { ) {
return this.rest.post(Routes.guildRoles(guildId), { reason, body, signal }) as Promise<RESTPostAPIGuildRoleResult>; return this.rest.post(Routes.guildRoles(guildId), {
auth,
reason,
body,
signal,
}) as Promise<RESTPostAPIGuildRoleResult>;
} }
/** /**
@@ -419,9 +448,10 @@ export class GuildsAPI {
public async setRolePositions( public async setRolePositions(
guildId: Snowflake, guildId: Snowflake,
body: RESTPatchAPIGuildRolePositionsJSONBody, body: RESTPatchAPIGuildRolePositionsJSONBody,
{ reason, signal }: Pick<RequestData, 'reason' | 'signal'> = {}, { auth, reason, signal }: Pick<RequestData, 'auth' | 'reason' | 'signal'> = {},
) { ) {
return this.rest.patch(Routes.guildRoles(guildId), { return this.rest.patch(Routes.guildRoles(guildId), {
auth,
reason, reason,
body, body,
signal, signal,
@@ -441,9 +471,10 @@ export class GuildsAPI {
guildId: Snowflake, guildId: Snowflake,
roleId: Snowflake, roleId: Snowflake,
body: RESTPatchAPIGuildRoleJSONBody, body: RESTPatchAPIGuildRoleJSONBody,
{ reason, signal }: Pick<RequestData, 'reason' | 'signal'> = {}, { auth, reason, signal }: Pick<RequestData, 'auth' | 'reason' | 'signal'> = {},
) { ) {
return this.rest.patch(Routes.guildRole(guildId, roleId), { return this.rest.patch(Routes.guildRole(guildId, roleId), {
auth,
reason, reason,
body, body,
signal, signal,
@@ -461,9 +492,9 @@ export class GuildsAPI {
public async deleteRole( public async deleteRole(
guildId: Snowflake, guildId: Snowflake,
roleId: Snowflake, roleId: Snowflake,
{ reason, signal }: Pick<RequestData, 'reason' | 'signal'> = {}, { auth, reason, signal }: Pick<RequestData, 'auth' | 'reason' | 'signal'> = {},
) { ) {
await this.rest.delete(Routes.guildRole(guildId, roleId), { reason, signal }); await this.rest.delete(Routes.guildRole(guildId, roleId), { auth, reason, signal });
} }
/** /**
@@ -477,9 +508,10 @@ export class GuildsAPI {
public async editMFALevel( public async editMFALevel(
guildId: Snowflake, guildId: Snowflake,
level: GuildMFALevel, level: GuildMFALevel,
{ reason, signal }: Pick<RequestData, 'reason' | 'signal'> = {}, { auth, reason, signal }: Pick<RequestData, 'auth' | 'reason' | 'signal'> = {},
) { ) {
return this.rest.post(Routes.guildMFA(guildId), { return this.rest.post(Routes.guildMFA(guildId), {
auth,
reason, reason,
signal, signal,
body: { level }, body: { level },
@@ -497,9 +529,10 @@ export class GuildsAPI {
public async getPruneCount( public async getPruneCount(
guildId: Snowflake, guildId: Snowflake,
query: RESTGetAPIGuildPruneCountQuery = {}, query: RESTGetAPIGuildPruneCountQuery = {},
{ signal }: Pick<RequestData, 'signal'> = {}, { auth, signal }: Pick<RequestData, 'auth' | 'signal'> = {},
) { ) {
return this.rest.get(Routes.guildPrune(guildId), { return this.rest.get(Routes.guildPrune(guildId), {
auth,
signal, signal,
query: makeURLSearchParams(query), query: makeURLSearchParams(query),
}) as Promise<RESTGetAPIGuildPruneCountResult>; }) as Promise<RESTGetAPIGuildPruneCountResult>;
@@ -516,9 +549,10 @@ export class GuildsAPI {
public async beginPrune( public async beginPrune(
guildId: Snowflake, guildId: Snowflake,
body: RESTPostAPIGuildPruneJSONBody = {}, body: RESTPostAPIGuildPruneJSONBody = {},
{ reason, signal }: Pick<RequestData, 'reason' | 'signal'> = {}, { auth, reason, signal }: Pick<RequestData, 'auth' | 'reason' | 'signal'> = {},
) { ) {
return this.rest.post(Routes.guildPrune(guildId), { return this.rest.post(Routes.guildPrune(guildId), {
auth,
body, body,
reason, reason,
signal, signal,
@@ -532,8 +566,11 @@ export class GuildsAPI {
* @param guildId - The id of the guild to fetch the voice regions from * @param guildId - The id of the guild to fetch the voice regions from
* @param options - The options for fetching the voice regions * @param options - The options for fetching the voice regions
*/ */
public async getVoiceRegions(guildId: Snowflake, { signal }: Pick<RequestData, 'signal'> = {}) { public async getVoiceRegions(guildId: Snowflake, { auth, signal }: Pick<RequestData, 'auth' | 'signal'> = {}) {
return this.rest.get(Routes.guildVoiceRegions(guildId), { signal }) as Promise<RESTGetAPIGuildVoiceRegionsResult>; return this.rest.get(Routes.guildVoiceRegions(guildId), {
auth,
signal,
}) as Promise<RESTGetAPIGuildVoiceRegionsResult>;
} }
/** /**
@@ -543,8 +580,8 @@ export class GuildsAPI {
* @param guildId - The id of the guild to fetch the invites from * @param guildId - The id of the guild to fetch the invites from
* @param options - The options for fetching the invites * @param options - The options for fetching the invites
*/ */
public async getInvites(guildId: Snowflake, { signal }: Pick<RequestData, 'signal'> = {}) { public async getInvites(guildId: Snowflake, { auth, signal }: Pick<RequestData, 'auth' | 'signal'> = {}) {
return this.rest.get(Routes.guildInvites(guildId), { signal }) as Promise<RESTGetAPIGuildInvitesResult>; return this.rest.get(Routes.guildInvites(guildId), { auth, signal }) as Promise<RESTGetAPIGuildInvitesResult>;
} }
/** /**
@@ -554,8 +591,11 @@ export class GuildsAPI {
* @param guildId - The id of the guild to fetch the integrations from * @param guildId - The id of the guild to fetch the integrations from
* @param options - The options for fetching the integrations * @param options - The options for fetching the integrations
*/ */
public async getIntegrations(guildId: Snowflake, { signal }: Pick<RequestData, 'signal'> = {}) { public async getIntegrations(guildId: Snowflake, { auth, signal }: Pick<RequestData, 'auth' | 'signal'> = {}) {
return this.rest.get(Routes.guildIntegrations(guildId), { signal }) as Promise<RESTGetAPIGuildIntegrationsResult>; return this.rest.get(Routes.guildIntegrations(guildId), {
auth,
signal,
}) as Promise<RESTGetAPIGuildIntegrationsResult>;
} }
/** /**
@@ -569,9 +609,9 @@ export class GuildsAPI {
public async deleteIntegration( public async deleteIntegration(
guildId: Snowflake, guildId: Snowflake,
integrationId: Snowflake, integrationId: Snowflake,
{ reason, signal }: Pick<RequestData, 'reason' | 'signal'> = {}, { auth, reason, signal }: Pick<RequestData, 'auth' | 'reason' | 'signal'> = {},
) { ) {
await this.rest.delete(Routes.guildIntegration(guildId, integrationId), { reason, signal }); await this.rest.delete(Routes.guildIntegration(guildId, integrationId), { auth, reason, signal });
} }
/** /**
@@ -581,8 +621,9 @@ export class GuildsAPI {
* @param guildId - The id of the guild to fetch the widget settings from * @param guildId - The id of the guild to fetch the widget settings from
* @param options - The options for fetching the widget settings * @param options - The options for fetching the widget settings
*/ */
public async getWidgetSettings(guildId: Snowflake, { signal }: Pick<RequestData, 'signal'> = {}) { public async getWidgetSettings(guildId: Snowflake, { auth, signal }: Pick<RequestData, 'auth' | 'signal'> = {}) {
return this.rest.get(Routes.guildWidgetSettings(guildId), { return this.rest.get(Routes.guildWidgetSettings(guildId), {
auth,
signal, signal,
}) as Promise<RESTGetAPIGuildWidgetSettingsResult>; }) as Promise<RESTGetAPIGuildWidgetSettingsResult>;
} }
@@ -598,9 +639,10 @@ export class GuildsAPI {
public async editWidgetSettings( public async editWidgetSettings(
guildId: Snowflake, guildId: Snowflake,
body: RESTPatchAPIGuildWidgetSettingsJSONBody, body: RESTPatchAPIGuildWidgetSettingsJSONBody,
{ reason, signal }: Pick<RequestData, 'reason' | 'signal'> = {}, { auth, reason, signal }: Pick<RequestData, 'auth' | 'reason' | 'signal'> = {},
) { ) {
return this.rest.patch(Routes.guildWidgetSettings(guildId), { return this.rest.patch(Routes.guildWidgetSettings(guildId), {
auth,
reason, reason,
body, body,
signal, signal,
@@ -614,8 +656,8 @@ export class GuildsAPI {
* @param guildId - The id of the guild to fetch the widget from * @param guildId - The id of the guild to fetch the widget from
* @param options - The options for fetching the widget * @param options - The options for fetching the widget
*/ */
public async getWidget(guildId: Snowflake, { signal }: Pick<RequestData, 'signal'> = {}) { public async getWidget(guildId: Snowflake, { auth, signal }: Pick<RequestData, 'auth' | 'signal'> = {}) {
return this.rest.get(Routes.guildWidgetJSON(guildId), { signal }) as Promise<RESTGetAPIGuildWidgetJSONResult>; return this.rest.get(Routes.guildWidgetJSON(guildId), { auth, signal }) as Promise<RESTGetAPIGuildWidgetJSONResult>;
} }
/** /**
@@ -625,8 +667,8 @@ export class GuildsAPI {
* @param guildId - The id of the guild to fetch the vanity url from * @param guildId - The id of the guild to fetch the vanity url from
* @param options - The options for fetching the vanity url * @param options - The options for fetching the vanity url
*/ */
public async getVanityURL(guildId: Snowflake, { signal }: Pick<RequestData, 'signal'> = {}) { public async getVanityURL(guildId: Snowflake, { auth, signal }: Pick<RequestData, 'auth' | 'signal'> = {}) {
return this.rest.get(Routes.guildVanityUrl(guildId), { signal }) as Promise<RESTGetAPIGuildVanityUrlResult>; return this.rest.get(Routes.guildVanityUrl(guildId), { auth, signal }) as Promise<RESTGetAPIGuildVanityUrlResult>;
} }
/** /**
@@ -640,9 +682,10 @@ export class GuildsAPI {
public async getWidgetImage( public async getWidgetImage(
guildId: Snowflake, guildId: Snowflake,
style?: GuildWidgetStyle, style?: GuildWidgetStyle,
{ signal }: Pick<RequestData, 'signal'> = {}, { auth, signal }: Pick<RequestData, 'auth' | 'signal'> = {},
) { ) {
return this.rest.get(Routes.guildWidgetImage(guildId), { return this.rest.get(Routes.guildWidgetImage(guildId), {
auth,
query: makeURLSearchParams({ style }), query: makeURLSearchParams({ style }),
signal, signal,
}) as Promise<RESTGetAPIGuildWidgetImageResult>; }) as Promise<RESTGetAPIGuildWidgetImageResult>;
@@ -655,8 +698,11 @@ export class GuildsAPI {
* @param guildId - The id of the guild to fetch the welcome screen from * @param guildId - The id of the guild to fetch the welcome screen from
* @param options - The options for fetching the welcome screen * @param options - The options for fetching the welcome screen
*/ */
public async getWelcomeScreen(guildId: Snowflake, { signal }: Pick<RequestData, 'signal'> = {}) { public async getWelcomeScreen(guildId: Snowflake, { auth, signal }: Pick<RequestData, 'auth' | 'signal'> = {}) {
return this.rest.get(Routes.guildWelcomeScreen(guildId), { signal }) as Promise<RESTGetAPIGuildWelcomeScreenResult>; return this.rest.get(Routes.guildWelcomeScreen(guildId), {
auth,
signal,
}) as Promise<RESTGetAPIGuildWelcomeScreenResult>;
} }
/** /**
@@ -670,9 +716,10 @@ export class GuildsAPI {
public async editWelcomeScreen( public async editWelcomeScreen(
guildId: Snowflake, guildId: Snowflake,
body?: RESTPatchAPIGuildWelcomeScreenJSONBody, body?: RESTPatchAPIGuildWelcomeScreenJSONBody,
{ reason, signal }: Pick<RequestData, 'reason' | 'signal'> = {}, { auth, reason, signal }: Pick<RequestData, 'auth' | 'reason' | 'signal'> = {},
) { ) {
return this.rest.patch(Routes.guildWelcomeScreen(guildId), { return this.rest.patch(Routes.guildWelcomeScreen(guildId), {
auth,
reason, reason,
body, body,
signal, signal,
@@ -686,8 +733,8 @@ export class GuildsAPI {
* @param guildId - The id of the guild to fetch the emojis from * @param guildId - The id of the guild to fetch the emojis from
* @param options - The options for fetching the emojis * @param options - The options for fetching the emojis
*/ */
public async getEmojis(guildId: Snowflake, { signal }: Pick<RequestData, 'signal'> = {}) { public async getEmojis(guildId: Snowflake, { auth, signal }: Pick<RequestData, 'auth' | 'signal'> = {}) {
return this.rest.get(Routes.guildEmojis(guildId), { signal }) as Promise<RESTGetAPIGuildEmojisResult>; return this.rest.get(Routes.guildEmojis(guildId), { auth, signal }) as Promise<RESTGetAPIGuildEmojisResult>;
} }
/** /**
@@ -698,8 +745,12 @@ export class GuildsAPI {
* @param emojiId - The id of the emoji to fetch * @param emojiId - The id of the emoji to fetch
* @param options - The options for fetching the emoji * @param options - The options for fetching the emoji
*/ */
public async getEmoji(guildId: Snowflake, emojiId: Snowflake, { signal }: Pick<RequestData, 'signal'> = {}) { public async getEmoji(
return this.rest.get(Routes.guildEmoji(guildId, emojiId), { signal }) as Promise<RESTGetAPIGuildEmojiResult>; guildId: Snowflake,
emojiId: Snowflake,
{ auth, signal }: Pick<RequestData, 'auth' | 'signal'> = {},
) {
return this.rest.get(Routes.guildEmoji(guildId, emojiId), { auth, signal }) as Promise<RESTGetAPIGuildEmojiResult>;
} }
/** /**
@@ -713,9 +764,10 @@ export class GuildsAPI {
public async createEmoji( public async createEmoji(
guildId: Snowflake, guildId: Snowflake,
body: RESTPostAPIGuildEmojiJSONBody, body: RESTPostAPIGuildEmojiJSONBody,
{ reason, signal }: Pick<RequestData, 'reason' | 'signal'> = {}, { auth, reason, signal }: Pick<RequestData, 'auth' | 'reason' | 'signal'> = {},
) { ) {
return this.rest.post(Routes.guildEmojis(guildId), { return this.rest.post(Routes.guildEmojis(guildId), {
auth,
reason, reason,
body, body,
signal, signal,
@@ -735,9 +787,10 @@ export class GuildsAPI {
guildId: Snowflake, guildId: Snowflake,
emojiId: Snowflake, emojiId: Snowflake,
body: RESTPatchAPIGuildEmojiJSONBody, body: RESTPatchAPIGuildEmojiJSONBody,
{ reason, signal }: Pick<RequestData, 'reason' | 'signal'> = {}, { auth, reason, signal }: Pick<RequestData, 'auth' | 'reason' | 'signal'> = {},
) { ) {
return this.rest.patch(Routes.guildEmoji(guildId, emojiId), { return this.rest.patch(Routes.guildEmoji(guildId, emojiId), {
auth,
reason, reason,
body, body,
signal, signal,
@@ -755,9 +808,9 @@ export class GuildsAPI {
public async deleteEmoji( public async deleteEmoji(
guildId: Snowflake, guildId: Snowflake,
emojiId: Snowflake, emojiId: Snowflake,
{ reason, signal }: Pick<RequestData, 'reason' | 'signal'> = {}, { auth, reason, signal }: Pick<RequestData, 'auth' | 'reason' | 'signal'> = {},
) { ) {
await this.rest.delete(Routes.guildEmoji(guildId, emojiId), { reason, signal }); await this.rest.delete(Routes.guildEmoji(guildId, emojiId), { auth, reason, signal });
} }
/** /**
@@ -771,9 +824,10 @@ export class GuildsAPI {
public async getScheduledEvents( public async getScheduledEvents(
guildId: Snowflake, guildId: Snowflake,
query: RESTGetAPIGuildScheduledEventsQuery = {}, query: RESTGetAPIGuildScheduledEventsQuery = {},
{ signal }: Pick<RequestData, 'signal'> = {}, { auth, signal }: Pick<RequestData, 'auth' | 'signal'> = {},
) { ) {
return this.rest.get(Routes.guildScheduledEvents(guildId), { return this.rest.get(Routes.guildScheduledEvents(guildId), {
auth,
query: makeURLSearchParams(query), query: makeURLSearchParams(query),
signal, signal,
}) as Promise<RESTGetAPIGuildScheduledEventsResult>; }) as Promise<RESTGetAPIGuildScheduledEventsResult>;
@@ -790,9 +844,10 @@ export class GuildsAPI {
public async createScheduledEvent( public async createScheduledEvent(
guildId: Snowflake, guildId: Snowflake,
body: RESTPostAPIGuildScheduledEventJSONBody, body: RESTPostAPIGuildScheduledEventJSONBody,
{ reason, signal }: Pick<RequestData, 'reason' | 'signal'> = {}, { auth, reason, signal }: Pick<RequestData, 'auth' | 'reason' | 'signal'> = {},
) { ) {
return this.rest.post(Routes.guildScheduledEvents(guildId), { return this.rest.post(Routes.guildScheduledEvents(guildId), {
auth,
reason, reason,
body, body,
signal, signal,
@@ -812,9 +867,10 @@ export class GuildsAPI {
guildId: Snowflake, guildId: Snowflake,
eventId: Snowflake, eventId: Snowflake,
query: RESTGetAPIGuildScheduledEventQuery = {}, query: RESTGetAPIGuildScheduledEventQuery = {},
{ signal }: Pick<RequestData, 'signal'> = {}, { auth, signal }: Pick<RequestData, 'auth' | 'signal'> = {},
) { ) {
return this.rest.get(Routes.guildScheduledEvent(guildId, eventId), { return this.rest.get(Routes.guildScheduledEvent(guildId, eventId), {
auth,
query: makeURLSearchParams(query), query: makeURLSearchParams(query),
signal, signal,
}) as Promise<RESTGetAPIGuildScheduledEventResult>; }) as Promise<RESTGetAPIGuildScheduledEventResult>;
@@ -833,9 +889,10 @@ export class GuildsAPI {
guildId: Snowflake, guildId: Snowflake,
eventId: Snowflake, eventId: Snowflake,
body: RESTPatchAPIGuildScheduledEventJSONBody, body: RESTPatchAPIGuildScheduledEventJSONBody,
{ reason, signal }: Pick<RequestData, 'reason' | 'signal'> = {}, { auth, reason, signal }: Pick<RequestData, 'auth' | 'reason' | 'signal'> = {},
) { ) {
return this.rest.patch(Routes.guildScheduledEvent(guildId, eventId), { return this.rest.patch(Routes.guildScheduledEvent(guildId, eventId), {
auth,
reason, reason,
body, body,
signal, signal,
@@ -853,9 +910,9 @@ export class GuildsAPI {
public async deleteScheduledEvent( public async deleteScheduledEvent(
guildId: Snowflake, guildId: Snowflake,
eventId: Snowflake, eventId: Snowflake,
{ reason, signal }: Pick<RequestData, 'reason' | 'signal'> = {}, { auth, reason, signal }: Pick<RequestData, 'auth' | 'reason' | 'signal'> = {},
) { ) {
await this.rest.delete(Routes.guildScheduledEvent(guildId, eventId), { reason, signal }); await this.rest.delete(Routes.guildScheduledEvent(guildId, eventId), { auth, reason, signal });
} }
/** /**
@@ -871,9 +928,10 @@ export class GuildsAPI {
guildId: Snowflake, guildId: Snowflake,
eventId: Snowflake, eventId: Snowflake,
query: RESTGetAPIGuildScheduledEventUsersQuery = {}, query: RESTGetAPIGuildScheduledEventUsersQuery = {},
{ signal }: Pick<RequestData, 'signal'> = {}, { auth, signal }: Pick<RequestData, 'auth' | 'signal'> = {},
) { ) {
return this.rest.get(Routes.guildScheduledEventUsers(guildId, eventId), { return this.rest.get(Routes.guildScheduledEventUsers(guildId, eventId), {
auth,
query: makeURLSearchParams(query), query: makeURLSearchParams(query),
signal, signal,
}) as Promise<RESTGetAPIGuildScheduledEventUsersResult>; }) as Promise<RESTGetAPIGuildScheduledEventUsersResult>;
@@ -886,8 +944,8 @@ export class GuildsAPI {
* @param guildId - The id of the guild to fetch the templates from * @param guildId - The id of the guild to fetch the templates from
* @param options - The options for fetching the templates * @param options - The options for fetching the templates
*/ */
public async getTemplates(guildId: Snowflake, { signal }: Pick<RequestData, 'signal'> = {}) { public async getTemplates(guildId: Snowflake, { auth, signal }: Pick<RequestData, 'auth' | 'signal'> = {}) {
return this.rest.get(Routes.guildTemplates(guildId), { signal }) as Promise<RESTGetAPIGuildTemplatesResult>; return this.rest.get(Routes.guildTemplates(guildId), { auth, signal }) as Promise<RESTGetAPIGuildTemplatesResult>;
} }
/** /**
@@ -898,8 +956,13 @@ export class GuildsAPI {
* @param templateCode - The code of the template to sync * @param templateCode - The code of the template to sync
* @param options - The options for syncing the template * @param options - The options for syncing the template
*/ */
public async syncTemplate(guildId: Snowflake, templateCode: string, { signal }: Pick<RequestData, 'signal'> = {}) { public async syncTemplate(
guildId: Snowflake,
templateCode: string,
{ auth, signal }: Pick<RequestData, 'auth' | 'signal'> = {},
) {
return this.rest.put(Routes.guildTemplate(guildId, templateCode), { return this.rest.put(Routes.guildTemplate(guildId, templateCode), {
auth,
signal, signal,
}) as Promise<RESTPutAPIGuildTemplateSyncResult>; }) as Promise<RESTPutAPIGuildTemplateSyncResult>;
} }
@@ -917,9 +980,10 @@ export class GuildsAPI {
guildId: Snowflake, guildId: Snowflake,
templateCode: string, templateCode: string,
body: RESTPatchAPIGuildTemplateJSONBody, body: RESTPatchAPIGuildTemplateJSONBody,
{ signal }: Pick<RequestData, 'signal'> = {}, { auth, signal }: Pick<RequestData, 'auth' | 'signal'> = {},
) { ) {
return this.rest.patch(Routes.guildTemplate(guildId, templateCode), { return this.rest.patch(Routes.guildTemplate(guildId, templateCode), {
auth,
body, body,
signal, signal,
}) as Promise<RESTPatchAPIGuildTemplateResult>; }) as Promise<RESTPatchAPIGuildTemplateResult>;
@@ -933,8 +997,12 @@ export class GuildsAPI {
* @param templateCode - The code of the template to delete * @param templateCode - The code of the template to delete
* @param options - The options for deleting the template * @param options - The options for deleting the template
*/ */
public async deleteTemplate(guildId: Snowflake, templateCode: string, { signal }: Pick<RequestData, 'signal'> = {}) { public async deleteTemplate(
await this.rest.delete(Routes.guildTemplate(guildId, templateCode), { signal }); guildId: Snowflake,
templateCode: string,
{ auth, signal }: Pick<RequestData, 'auth' | 'signal'> = {},
) {
await this.rest.delete(Routes.guildTemplate(guildId, templateCode), { auth, signal });
} }
/** /**
@@ -944,8 +1012,8 @@ export class GuildsAPI {
* @param guildId - The id of the guild to fetch the stickers from * @param guildId - The id of the guild to fetch the stickers from
* @param options - The options for fetching the stickers * @param options - The options for fetching the stickers
*/ */
public async getStickers(guildId: Snowflake, { signal }: Pick<RequestData, 'signal'> = {}) { public async getStickers(guildId: Snowflake, { auth, signal }: Pick<RequestData, 'auth' | 'signal'> = {}) {
return this.rest.get(Routes.guildStickers(guildId), { signal }) as Promise<RESTGetAPIGuildStickersResult>; return this.rest.get(Routes.guildStickers(guildId), { auth, signal }) as Promise<RESTGetAPIGuildStickersResult>;
} }
/** /**
@@ -956,8 +1024,15 @@ export class GuildsAPI {
* @param stickerId - The id of the sticker to fetch * @param stickerId - The id of the sticker to fetch
* @param options - The options for fetching the sticker * @param options - The options for fetching the sticker
*/ */
public async getSticker(guildId: Snowflake, stickerId: Snowflake, { signal }: Pick<RequestData, 'signal'> = {}) { public async getSticker(
return this.rest.get(Routes.guildSticker(guildId, stickerId), { signal }) as Promise<RESTGetAPIGuildStickerResult>; guildId: Snowflake,
stickerId: Snowflake,
{ auth, signal }: Pick<RequestData, 'auth' | 'signal'> = {},
) {
return this.rest.get(Routes.guildSticker(guildId, stickerId), {
auth,
signal,
}) as Promise<RESTGetAPIGuildStickerResult>;
} }
/** /**
@@ -971,11 +1046,12 @@ export class GuildsAPI {
public async createSticker( public async createSticker(
guildId: Snowflake, guildId: Snowflake,
{ file, ...body }: CreateStickerOptions, { file, ...body }: CreateStickerOptions,
{ reason, signal }: Pick<RequestData, 'reason' | 'signal'> = {}, { auth, reason, signal }: Pick<RequestData, 'auth' | 'reason' | 'signal'> = {},
) { ) {
const fileData = { ...file, key: 'file' }; const fileData = { ...file, key: 'file' };
return this.rest.post(Routes.guildStickers(guildId), { return this.rest.post(Routes.guildStickers(guildId), {
auth,
appendToFormData: true, appendToFormData: true,
body, body,
files: [fileData], files: [fileData],
@@ -997,9 +1073,10 @@ export class GuildsAPI {
guildId: Snowflake, guildId: Snowflake,
stickerId: Snowflake, stickerId: Snowflake,
body: RESTPatchAPIGuildStickerJSONBody, body: RESTPatchAPIGuildStickerJSONBody,
{ reason, signal }: Pick<RequestData, 'reason' | 'signal'> = {}, { auth, reason, signal }: Pick<RequestData, 'auth' | 'reason' | 'signal'> = {},
) { ) {
return this.rest.patch(Routes.guildSticker(guildId, stickerId), { return this.rest.patch(Routes.guildSticker(guildId, stickerId), {
auth,
reason, reason,
body, body,
signal, signal,
@@ -1017,9 +1094,9 @@ export class GuildsAPI {
public async deleteSticker( public async deleteSticker(
guildId: Snowflake, guildId: Snowflake,
stickerId: Snowflake, stickerId: Snowflake,
{ reason, signal }: Pick<RequestData, 'reason' | 'signal'> = {}, { auth, reason, signal }: Pick<RequestData, 'auth' | 'reason' | 'signal'> = {},
) { ) {
await this.rest.delete(Routes.guildSticker(guildId, stickerId), { reason, signal }); await this.rest.delete(Routes.guildSticker(guildId, stickerId), { auth, reason, signal });
} }
/** /**
@@ -1033,9 +1110,10 @@ export class GuildsAPI {
public async getAuditLogs( public async getAuditLogs(
guildId: Snowflake, guildId: Snowflake,
query: RESTGetAPIAuditLogQuery = {}, query: RESTGetAPIAuditLogQuery = {},
{ signal }: Pick<RequestData, 'signal'> = {}, { auth, signal }: Pick<RequestData, 'auth' | 'signal'> = {},
) { ) {
return this.rest.get(Routes.guildAuditLog(guildId), { return this.rest.get(Routes.guildAuditLog(guildId), {
auth,
query: makeURLSearchParams(query), query: makeURLSearchParams(query),
signal, signal,
}) as Promise<RESTGetAPIAuditLogResult>; }) as Promise<RESTGetAPIAuditLogResult>;
@@ -1048,8 +1126,9 @@ export class GuildsAPI {
* @param guildId - The id of the guild to fetch the auto moderation rules from * @param guildId - The id of the guild to fetch the auto moderation rules from
* @param options - The options for fetching the auto moderation rules * @param options - The options for fetching the auto moderation rules
*/ */
public async getAutoModerationRules(guildId: Snowflake, { signal }: Pick<RequestData, 'signal'> = {}) { public async getAutoModerationRules(guildId: Snowflake, { auth, signal }: Pick<RequestData, 'auth' | 'signal'> = {}) {
return this.rest.get(Routes.guildAutoModerationRules(guildId), { return this.rest.get(Routes.guildAutoModerationRules(guildId), {
auth,
signal, signal,
}) as Promise<RESTGetAPIAutoModerationRulesResult>; }) as Promise<RESTGetAPIAutoModerationRulesResult>;
} }
@@ -1065,9 +1144,10 @@ export class GuildsAPI {
public async getAutoModerationRule( public async getAutoModerationRule(
guildId: Snowflake, guildId: Snowflake,
ruleId: Snowflake, ruleId: Snowflake,
{ signal }: Pick<RequestData, 'signal'> = {}, { auth, signal }: Pick<RequestData, 'auth' | 'signal'> = {},
) { ) {
return this.rest.get(Routes.guildAutoModerationRule(guildId, ruleId), { return this.rest.get(Routes.guildAutoModerationRule(guildId, ruleId), {
auth,
signal, signal,
}) as Promise<RESTGetAPIAutoModerationRuleResult>; }) as Promise<RESTGetAPIAutoModerationRuleResult>;
} }
@@ -1083,9 +1163,10 @@ export class GuildsAPI {
public async createAutoModerationRule( public async createAutoModerationRule(
guildId: Snowflake, guildId: Snowflake,
body: RESTPostAPIAutoModerationRuleJSONBody, body: RESTPostAPIAutoModerationRuleJSONBody,
{ reason, signal }: Pick<RequestData, 'reason' | 'signal'> = {}, { auth, reason, signal }: Pick<RequestData, 'auth' | 'reason' | 'signal'> = {},
) { ) {
return this.rest.post(Routes.guildAutoModerationRules(guildId), { return this.rest.post(Routes.guildAutoModerationRules(guildId), {
auth,
reason, reason,
body, body,
signal, signal,
@@ -1105,9 +1186,10 @@ export class GuildsAPI {
guildId: Snowflake, guildId: Snowflake,
ruleId: Snowflake, ruleId: Snowflake,
body: RESTPatchAPIAutoModerationRuleJSONBody, body: RESTPatchAPIAutoModerationRuleJSONBody,
{ reason, signal }: Pick<RequestData, 'reason' | 'signal'> = {}, { auth, reason, signal }: Pick<RequestData, 'auth' | 'reason' | 'signal'> = {},
) { ) {
return this.rest.patch(Routes.guildAutoModerationRule(guildId, ruleId), { return this.rest.patch(Routes.guildAutoModerationRule(guildId, ruleId), {
auth,
reason, reason,
body, body,
signal, signal,
@@ -1125,9 +1207,9 @@ export class GuildsAPI {
public async deleteAutoModerationRule( public async deleteAutoModerationRule(
guildId: Snowflake, guildId: Snowflake,
ruleId: Snowflake, ruleId: Snowflake,
{ reason, signal }: Pick<RequestData, 'reason' | 'signal'> = {}, { auth, reason, signal }: Pick<RequestData, 'auth' | 'reason' | 'signal'> = {},
) { ) {
await this.rest.delete(Routes.guildAutoModerationRule(guildId, ruleId), { reason, signal }); await this.rest.delete(Routes.guildAutoModerationRule(guildId, ruleId), { auth, reason, signal });
} }
/** /**
@@ -1138,8 +1220,12 @@ export class GuildsAPI {
* @param userId - The id of the user * @param userId - The id of the user
* @param options - The options for fetching the guild member * @param options - The options for fetching the guild member
*/ */
public async getMember(guildId: Snowflake, userId: Snowflake, { signal }: Pick<RequestData, 'signal'> = {}) { public async getMember(
return this.rest.get(Routes.guildMember(guildId, userId), { signal }) as Promise<RESTGetAPIGuildMemberResult>; guildId: Snowflake,
userId: Snowflake,
{ auth, signal }: Pick<RequestData, 'auth' | 'signal'> = {},
) {
return this.rest.get(Routes.guildMember(guildId, userId), { auth, signal }) as Promise<RESTGetAPIGuildMemberResult>;
} }
/** /**
@@ -1153,9 +1239,10 @@ export class GuildsAPI {
public async searchForMembers( public async searchForMembers(
guildId: Snowflake, guildId: Snowflake,
query: RESTGetAPIGuildMembersSearchQuery, query: RESTGetAPIGuildMembersSearchQuery,
{ signal }: Pick<RequestData, 'signal'> = {}, { auth, signal }: Pick<RequestData, 'auth' | 'signal'> = {},
) { ) {
return this.rest.get(Routes.guildMembersSearch(guildId), { return this.rest.get(Routes.guildMembersSearch(guildId), {
auth,
query: makeURLSearchParams(query), query: makeURLSearchParams(query),
signal, signal,
}) as Promise<RESTGetAPIGuildMembersSearchResult>; }) as Promise<RESTGetAPIGuildMembersSearchResult>;
@@ -1174,9 +1261,10 @@ export class GuildsAPI {
guildId: Snowflake, guildId: Snowflake,
userId: Snowflake, userId: Snowflake,
body: RESTPatchAPIGuildMemberJSONBody = {}, body: RESTPatchAPIGuildMemberJSONBody = {},
{ reason, signal }: Pick<RequestData, 'reason' | 'signal'> = {}, { auth, reason, signal }: Pick<RequestData, 'auth' | 'reason' | 'signal'> = {},
) { ) {
return this.rest.patch(Routes.guildMember(guildId, userId), { return this.rest.patch(Routes.guildMember(guildId, userId), {
auth,
reason, reason,
body, body,
signal, signal,
@@ -1194,9 +1282,9 @@ export class GuildsAPI {
public async removeMember( public async removeMember(
guildId: Snowflake, guildId: Snowflake,
userId: Snowflake, userId: Snowflake,
{ reason, signal }: Pick<RequestData, 'reason' | 'signal'> = {}, { auth, reason, signal }: Pick<RequestData, 'auth' | 'reason' | 'signal'> = {},
) { ) {
return this.rest.delete(Routes.guildMember(guildId, userId), { reason, signal }); return this.rest.delete(Routes.guildMember(guildId, userId), { auth, reason, signal });
} }
/** /**
@@ -1212,9 +1300,9 @@ export class GuildsAPI {
guildId: Snowflake, guildId: Snowflake,
userId: Snowflake, userId: Snowflake,
roleId: Snowflake, roleId: Snowflake,
{ reason, signal }: Pick<RequestData, 'reason' | 'signal'> = {}, { auth, reason, signal }: Pick<RequestData, 'auth' | 'reason' | 'signal'> = {},
) { ) {
await this.rest.put(Routes.guildMemberRole(guildId, userId, roleId), { reason, signal }); await this.rest.put(Routes.guildMemberRole(guildId, userId, roleId), { auth, reason, signal });
} }
/** /**
@@ -1230,9 +1318,9 @@ export class GuildsAPI {
guildId: Snowflake, guildId: Snowflake,
userId: Snowflake, userId: Snowflake,
roleId: Snowflake, roleId: Snowflake,
{ reason, signal }: Pick<RequestData, 'reason' | 'signal'> = {}, { auth, reason, signal }: Pick<RequestData, 'auth' | 'reason' | 'signal'> = {},
) { ) {
await this.rest.delete(Routes.guildMemberRole(guildId, userId, roleId), { reason, signal }); await this.rest.delete(Routes.guildMemberRole(guildId, userId, roleId), { auth, reason, signal });
} }
/** /**
@@ -1242,8 +1330,8 @@ export class GuildsAPI {
* @param templateCode - The code of the template * @param templateCode - The code of the template
* @param options - The options for fetching the guild template * @param options - The options for fetching the guild template
*/ */
public async getTemplate(templateCode: string, { signal }: Pick<RequestData, 'signal'> = {}) { public async getTemplate(templateCode: string, { auth, signal }: Pick<RequestData, 'auth' | 'signal'> = {}) {
return this.rest.get(Routes.template(templateCode), { signal }) as Promise<RESTGetAPITemplateResult>; return this.rest.get(Routes.template(templateCode), { auth, signal }) as Promise<RESTGetAPITemplateResult>;
} }
/** /**
@@ -1257,9 +1345,13 @@ export class GuildsAPI {
public async createTemplate( public async createTemplate(
templateCode: string, templateCode: string,
body: RESTPostAPIGuildTemplatesJSONBody, body: RESTPostAPIGuildTemplatesJSONBody,
{ signal }: Pick<RequestData, 'signal'> = {}, { auth, signal }: Pick<RequestData, 'auth' | 'signal'> = {},
) { ) {
return this.rest.post(Routes.template(templateCode), { body, signal }) as Promise<RESTPostAPIGuildTemplatesResult>; return this.rest.post(Routes.template(templateCode), {
auth,
body,
signal,
}) as Promise<RESTPostAPIGuildTemplatesResult>;
} }
/** /**
@@ -1267,9 +1359,10 @@ export class GuildsAPI {
* *
* @see {@link https://discord.com/developers/docs/resources/webhook#get-guild-webhooks} * @see {@link https://discord.com/developers/docs/resources/webhook#get-guild-webhooks}
* @param id - The id of the guild * @param id - The id of the guild
* @param options - The options for fetching the webhooks
*/ */
public async getWebhooks(id: Snowflake) { public async getWebhooks(id: Snowflake, { auth, signal }: Pick<RequestData, 'auth' | 'signal'> = {}) {
return this.rest.get(Routes.guildWebhooks(id)) as Promise<RESTGetAPIGuildWebhooksResult>; return this.rest.get(Routes.guildWebhooks(id), { auth, signal }) as Promise<RESTGetAPIGuildWebhooksResult>;
} }
/** /**
@@ -1279,8 +1372,8 @@ export class GuildsAPI {
* @param guildId - The id of the guild * @param guildId - The id of the guild
* @param options - The options for fetching the guild onboarding * @param options - The options for fetching the guild onboarding
*/ */
public async getOnboarding(guildId: Snowflake, { signal }: Pick<RequestData, 'signal'> = {}) { public async getOnboarding(guildId: Snowflake, { auth, signal }: Pick<RequestData, 'auth' | 'signal'> = {}) {
return this.rest.get(Routes.guildOnboarding(guildId), { signal }) as Promise<RESTGetAPIGuildOnboardingResult>; return this.rest.get(Routes.guildOnboarding(guildId), { auth, signal }) as Promise<RESTGetAPIGuildOnboardingResult>;
} }
/** /**
@@ -1294,9 +1387,10 @@ export class GuildsAPI {
public async editOnboarding( public async editOnboarding(
guildId: Snowflake, guildId: Snowflake,
body: RESTPutAPIGuildOnboardingJSONBody, body: RESTPutAPIGuildOnboardingJSONBody,
{ reason, signal }: Pick<RequestData, 'reason' | 'signal'> = {}, { auth, reason, signal }: Pick<RequestData, 'auth' | 'reason' | 'signal'> = {},
) { ) {
return this.rest.put(Routes.guildOnboarding(guildId), { return this.rest.put(Routes.guildOnboarding(guildId), {
auth,
reason, reason,
body, body,
signal, signal,
@@ -1310,8 +1404,9 @@ export class GuildsAPI {
* @param guildId - The id of the guild to fetch the soundboard sounds for * @param guildId - The id of the guild to fetch the soundboard sounds for
* @param options - The options for fetching the soundboard sounds * @param options - The options for fetching the soundboard sounds
*/ */
public async getSoundboardSounds(guildId: Snowflake, { signal }: Pick<RequestData, 'signal'> = {}) { public async getSoundboardSounds(guildId: Snowflake, { auth, signal }: Pick<RequestData, 'auth' | 'signal'> = {}) {
return this.rest.get(Routes.guildSoundboardSounds(guildId), { return this.rest.get(Routes.guildSoundboardSounds(guildId), {
auth,
signal, signal,
}) as Promise<RESTGetAPIGuildSoundboardSoundsResult>; }) as Promise<RESTGetAPIGuildSoundboardSoundsResult>;
} }
@@ -1327,9 +1422,10 @@ export class GuildsAPI {
public async getSoundboardSound( public async getSoundboardSound(
guildId: Snowflake, guildId: Snowflake,
soundId: Snowflake, soundId: Snowflake,
{ signal }: Pick<RequestData, 'signal'> = {}, { auth, signal }: Pick<RequestData, 'auth' | 'signal'> = {},
) { ) {
return this.rest.get(Routes.guildSoundboardSound(guildId, soundId), { return this.rest.get(Routes.guildSoundboardSound(guildId, soundId), {
auth,
signal, signal,
}) as Promise<RESTGetAPIGuildSoundboardSoundResult>; }) as Promise<RESTGetAPIGuildSoundboardSoundResult>;
} }
@@ -1345,9 +1441,10 @@ export class GuildsAPI {
public async createSoundboardSound( public async createSoundboardSound(
guildId: Snowflake, guildId: Snowflake,
body: RESTPostAPIGuildSoundboardSoundJSONBody, body: RESTPostAPIGuildSoundboardSoundJSONBody,
{ reason, signal }: Pick<RequestData, 'reason' | 'signal'> = {}, { auth, reason, signal }: Pick<RequestData, 'auth' | 'reason' | 'signal'> = {},
) { ) {
return this.rest.post(Routes.guildSoundboardSounds(guildId), { return this.rest.post(Routes.guildSoundboardSounds(guildId), {
auth,
body, body,
reason, reason,
signal, signal,
@@ -1367,9 +1464,10 @@ export class GuildsAPI {
guildId: Snowflake, guildId: Snowflake,
soundId: Snowflake, soundId: Snowflake,
body: RESTPatchAPIGuildSoundboardSoundJSONBody, body: RESTPatchAPIGuildSoundboardSoundJSONBody,
{ reason, signal }: Pick<RequestData, 'reason' | 'signal'> = {}, { auth, reason, signal }: Pick<RequestData, 'auth' | 'reason' | 'signal'> = {},
) { ) {
return this.rest.patch(Routes.guildSoundboardSound(guildId, soundId), { return this.rest.patch(Routes.guildSoundboardSound(guildId, soundId), {
auth,
body, body,
reason, reason,
signal, signal,
@@ -1387,8 +1485,8 @@ export class GuildsAPI {
public async deleteSoundboardSound( public async deleteSoundboardSound(
guildId: Snowflake, guildId: Snowflake,
soundId: Snowflake, soundId: Snowflake,
{ reason, signal }: Pick<RequestData, 'reason' | 'signal'> = {}, { auth, reason, signal }: Pick<RequestData, 'auth' | 'reason' | 'signal'> = {},
) { ) {
await this.rest.delete(Routes.guildSoundboardSound(guildId, soundId), { reason, signal }); await this.rest.delete(Routes.guildSoundboardSound(guildId, soundId), { auth, reason, signal });
} }
} }

View File

@@ -14,8 +14,13 @@ export class InvitesAPI {
* @param query - The options for fetching the invite * @param query - The options for fetching the invite
* @param options - The options for fetching the invite * @param options - The options for fetching the invite
*/ */
public async get(code: string, query: RESTGetAPIInviteQuery = {}, { signal }: Pick<RequestData, 'signal'> = {}) { public async get(
code: string,
query: RESTGetAPIInviteQuery = {},
{ auth, signal }: Pick<RequestData, 'auth' | 'signal'> = {},
) {
return this.rest.get(Routes.invite(code), { return this.rest.get(Routes.invite(code), {
auth,
query: makeURLSearchParams(query), query: makeURLSearchParams(query),
signal, signal,
}) as Promise<RESTGetAPIInviteResult>; }) as Promise<RESTGetAPIInviteResult>;
@@ -28,7 +33,7 @@ export class InvitesAPI {
* @param code - The invite code * @param code - The invite code
* @param options - The options for deleting the invite * @param options - The options for deleting the invite
*/ */
public async delete(code: string, { reason, signal }: Pick<RequestData, 'reason' | 'signal'> = {}) { public async delete(code: string, { auth, reason, signal }: Pick<RequestData, 'auth' | 'reason' | 'signal'> = {}) {
await this.rest.delete(Routes.invite(code), { reason, signal }); await this.rest.delete(Routes.invite(code), { auth, reason, signal });
} }
} }

View File

@@ -25,8 +25,8 @@ export class MonetizationAPI {
* @param applicationId - The application id to fetch SKUs for * @param applicationId - The application id to fetch SKUs for
* @param options - The options for fetching the SKUs. * @param options - The options for fetching the SKUs.
*/ */
public async getSKUs(applicationId: Snowflake, { signal }: Pick<RequestData, 'signal'> = {}) { public async getSKUs(applicationId: Snowflake, { auth, signal }: Pick<RequestData, 'auth' | 'signal'> = {}) {
return this.rest.get(Routes.skus(applicationId), { signal }) as Promise<RESTGetAPISKUsResult>; return this.rest.get(Routes.skus(applicationId), { auth, signal }) as Promise<RESTGetAPISKUsResult>;
} }
/** /**
@@ -40,9 +40,10 @@ export class MonetizationAPI {
public async getSKUSubscriptions( public async getSKUSubscriptions(
skuId: Snowflake, skuId: Snowflake,
query: RESTGetAPISKUSubscriptionsQuery = {}, query: RESTGetAPISKUSubscriptionsQuery = {},
{ signal }: Pick<RequestData, 'signal'> = {}, { auth, signal }: Pick<RequestData, 'auth' | 'signal'> = {},
) { ) {
return this.rest.get(Routes.skuSubscriptions(skuId), { return this.rest.get(Routes.skuSubscriptions(skuId), {
auth,
signal, signal,
query: makeURLSearchParams(query), query: makeURLSearchParams(query),
}) as Promise<RESTGetAPISKUSubscriptionsResult>; }) as Promise<RESTGetAPISKUSubscriptionsResult>;
@@ -59,9 +60,10 @@ export class MonetizationAPI {
public async getSKUSubscription( public async getSKUSubscription(
skuId: Snowflake, skuId: Snowflake,
subscriptionId: Snowflake, subscriptionId: Snowflake,
{ signal }: Pick<RequestData, 'signal'> = {}, { auth, signal }: Pick<RequestData, 'auth' | 'signal'> = {},
) { ) {
return this.rest.get(Routes.skuSubscription(skuId, subscriptionId), { return this.rest.get(Routes.skuSubscription(skuId, subscriptionId), {
auth,
signal, signal,
}) as Promise<RESTGetAPISKUSubscriptionResult>; }) as Promise<RESTGetAPISKUSubscriptionResult>;
} }
@@ -77,9 +79,10 @@ export class MonetizationAPI {
public async getEntitlements( public async getEntitlements(
applicationId: Snowflake, applicationId: Snowflake,
query: RESTGetAPIEntitlementsQuery = {}, query: RESTGetAPIEntitlementsQuery = {},
{ signal }: Pick<RequestData, 'signal'> = {}, { auth, signal }: Pick<RequestData, 'auth' | 'signal'> = {},
) { ) {
return this.rest.get(Routes.entitlements(applicationId), { return this.rest.get(Routes.entitlements(applicationId), {
auth,
signal, signal,
query: makeURLSearchParams(query), query: makeURLSearchParams(query),
}) as Promise<RESTGetAPIEntitlementsResult>; }) as Promise<RESTGetAPIEntitlementsResult>;
@@ -96,9 +99,10 @@ export class MonetizationAPI {
public async getEntitlement( public async getEntitlement(
applicationId: Snowflake, applicationId: Snowflake,
entitlementId: Snowflake, entitlementId: Snowflake,
{ signal }: Pick<RequestData, 'signal'> = {}, { auth, signal }: Pick<RequestData, 'auth' | 'signal'> = {},
) { ) {
return this.rest.get(Routes.entitlement(applicationId, entitlementId), { return this.rest.get(Routes.entitlement(applicationId, entitlementId), {
auth,
signal, signal,
}) as Promise<RESTGetAPIEntitlementResult>; }) as Promise<RESTGetAPIEntitlementResult>;
} }
@@ -114,9 +118,10 @@ export class MonetizationAPI {
public async createTestEntitlement( public async createTestEntitlement(
applicationId: Snowflake, applicationId: Snowflake,
body: RESTPostAPIEntitlementJSONBody, body: RESTPostAPIEntitlementJSONBody,
{ signal }: Pick<RequestData, 'signal'> = {}, { auth, signal }: Pick<RequestData, 'auth' | 'signal'> = {},
) { ) {
return this.rest.post(Routes.entitlements(applicationId), { return this.rest.post(Routes.entitlements(applicationId), {
auth,
body, body,
signal, signal,
}) as Promise<RESTPostAPIEntitlementResult>; }) as Promise<RESTPostAPIEntitlementResult>;
@@ -133,9 +138,9 @@ export class MonetizationAPI {
public async deleteTestEntitlement( public async deleteTestEntitlement(
applicationId: Snowflake, applicationId: Snowflake,
entitlementId: Snowflake, entitlementId: Snowflake,
{ signal }: Pick<RequestData, 'signal'> = {}, { auth, signal }: Pick<RequestData, 'auth' | 'signal'> = {},
) { ) {
await this.rest.delete(Routes.entitlement(applicationId, entitlementId), { signal }); await this.rest.delete(Routes.entitlement(applicationId, entitlementId), { auth, signal });
} }
/** /**
@@ -149,8 +154,8 @@ export class MonetizationAPI {
public async consumeEntitlement( public async consumeEntitlement(
applicationId: Snowflake, applicationId: Snowflake,
entitlementId: Snowflake, entitlementId: Snowflake,
{ signal }: Pick<RequestData, 'signal'> = {}, { auth, signal }: Pick<RequestData, 'auth' | 'signal'> = {},
) { ) {
await this.rest.post(Routes.consumeEntitlement(applicationId, entitlementId), { signal }); await this.rest.post(Routes.consumeEntitlement(applicationId, entitlementId), { auth, signal });
} }
} }

View File

@@ -106,8 +106,9 @@ export class OAuth2API {
* @see {@link https://discord.com/developers/docs/topics/oauth2#get-current-bot-application-information} * @see {@link https://discord.com/developers/docs/topics/oauth2#get-current-bot-application-information}
* @param options - The options for the current bot application information request * @param options - The options for the current bot application information request
*/ */
public async getCurrentBotApplicationInformation({ signal }: Pick<RequestData, 'signal'> = {}) { public async getCurrentBotApplicationInformation({ auth, signal }: Pick<RequestData, 'auth' | 'signal'> = {}) {
return this.rest.get(Routes.oauth2CurrentApplication(), { return this.rest.get(Routes.oauth2CurrentApplication(), {
auth,
signal, signal,
}) as Promise<RESTGetAPIOAuth2CurrentApplicationResult>; }) as Promise<RESTGetAPIOAuth2CurrentApplicationResult>;
} }
@@ -118,8 +119,9 @@ export class OAuth2API {
* @see {@link https://discord.com/developers/docs/topics/oauth2#get-current-authorization-information} * @see {@link https://discord.com/developers/docs/topics/oauth2#get-current-authorization-information}
* @param options - The options for the current authorization information request * @param options - The options for the current authorization information request
*/ */
public async getCurrentAuthorizationInformation({ signal }: Pick<RequestData, 'signal'> = {}) { public async getCurrentAuthorizationInformation({ auth, signal }: Pick<RequestData, 'auth' | 'signal'> = {}) {
return this.rest.get(Routes.oauth2CurrentAuthorization(), { return this.rest.get(Routes.oauth2CurrentAuthorization(), {
auth,
signal, signal,
}) as Promise<RESTGetAPIOAuth2CurrentAuthorizationResult>; }) as Promise<RESTGetAPIOAuth2CurrentAuthorizationResult>;
} }

View File

@@ -27,9 +27,10 @@ export class PollAPI {
messageId: Snowflake, messageId: Snowflake,
answerId: number, answerId: number,
query: RESTGetAPIPollAnswerVotersQuery = {}, query: RESTGetAPIPollAnswerVotersQuery = {},
{ signal }: Pick<RequestData, 'signal'> = {}, { auth, signal }: Pick<RequestData, 'auth' | 'signal'> = {},
) { ) {
return this.rest.get(Routes.pollAnswerVoters(channelId, messageId, answerId), { return this.rest.get(Routes.pollAnswerVoters(channelId, messageId, answerId), {
auth,
signal, signal,
query: makeURLSearchParams(query), query: makeURLSearchParams(query),
}) as Promise<RESTGetAPIPollAnswerVotersResult>; }) as Promise<RESTGetAPIPollAnswerVotersResult>;
@@ -43,8 +44,13 @@ export class PollAPI {
* @param messageId - The id of the message containing the poll * @param messageId - The id of the message containing the poll
* @param options - The options for expiring the poll * @param options - The options for expiring the poll
*/ */
public async expirePoll(channelId: Snowflake, messageId: Snowflake, { signal }: Pick<RequestData, 'signal'> = {}) { public async expirePoll(
channelId: Snowflake,
messageId: Snowflake,
{ auth, signal }: Pick<RequestData, 'auth' | 'signal'> = {},
) {
return this.rest.post(Routes.expirePoll(channelId, messageId), { return this.rest.post(Routes.expirePoll(channelId, messageId), {
auth,
signal, signal,
}) as Promise<RESTPostAPIPollExpireResult>; }) as Promise<RESTPostAPIPollExpireResult>;
} }

View File

@@ -19,8 +19,12 @@ export class RoleConnectionsAPI {
* @param applicationId - The id of the application to get role connection metadata records for * @param applicationId - The id of the application to get role connection metadata records for
* @param options - The options for fetching the role connection metadata records * @param options - The options for fetching the role connection metadata records
*/ */
public async getMetadataRecords(applicationId: Snowflake, { signal }: Pick<RequestData, 'signal'> = {}) { public async getMetadataRecords(
applicationId: Snowflake,
{ auth, signal }: Pick<RequestData, 'auth' | 'signal'> = {},
) {
return this.rest.get(Routes.applicationRoleConnectionMetadata(applicationId), { return this.rest.get(Routes.applicationRoleConnectionMetadata(applicationId), {
auth,
signal, signal,
}) as Promise<RESTGetAPIApplicationRoleConnectionMetadataResult>; }) as Promise<RESTGetAPIApplicationRoleConnectionMetadataResult>;
} }
@@ -36,9 +40,10 @@ export class RoleConnectionsAPI {
public async updateMetadataRecords( public async updateMetadataRecords(
applicationId: Snowflake, applicationId: Snowflake,
body: RESTPutAPIApplicationRoleConnectionMetadataJSONBody, body: RESTPutAPIApplicationRoleConnectionMetadataJSONBody,
{ signal }: Pick<RequestData, 'signal'> = {}, { auth, signal }: Pick<RequestData, 'auth' | 'signal'> = {},
) { ) {
return this.rest.put(Routes.applicationRoleConnectionMetadata(applicationId), { return this.rest.put(Routes.applicationRoleConnectionMetadata(applicationId), {
auth,
body, body,
signal, signal,
}) as Promise<RESTPutAPIApplicationRoleConnectionMetadataResult>; }) as Promise<RESTPutAPIApplicationRoleConnectionMetadataResult>;

View File

@@ -12,8 +12,9 @@ export class SoundboardSoundsAPI {
* @see {@link https://discord.com/developers/docs/resources/soundboard#list-default-soundboard-sounds} * @see {@link https://discord.com/developers/docs/resources/soundboard#list-default-soundboard-sounds}
* @param options - The options for fetching the soundboard default sounds. * @param options - The options for fetching the soundboard default sounds.
*/ */
public async getSoundboardDefaultSounds({ signal }: Pick<RequestData, 'signal'> = {}) { public async getSoundboardDefaultSounds({ auth, signal }: Pick<RequestData, 'auth' | 'signal'> = {}) {
return this.rest.get(Routes.soundboardDefaultSounds(), { return this.rest.get(Routes.soundboardDefaultSounds(), {
auth,
signal, signal,
}) as Promise<RESTGetAPISoundboardDefaultSoundsResult>; }) as Promise<RESTGetAPISoundboardDefaultSoundsResult>;
} }

View File

@@ -23,9 +23,10 @@ export class StageInstancesAPI {
*/ */
public async create( public async create(
body: RESTPostAPIStageInstanceJSONBody, body: RESTPostAPIStageInstanceJSONBody,
{ reason, signal }: Pick<RequestData, 'reason' | 'signal'> = {}, { auth, reason, signal }: Pick<RequestData, 'auth' | 'reason' | 'signal'> = {},
) { ) {
return this.rest.post(Routes.stageInstances(), { return this.rest.post(Routes.stageInstances(), {
auth,
body, body,
reason, reason,
signal, signal,
@@ -39,8 +40,8 @@ export class StageInstancesAPI {
* @param channelId - The id of the channel * @param channelId - The id of the channel
* @param options - The options for fetching the stage instance * @param options - The options for fetching the stage instance
*/ */
public async get(channelId: Snowflake, { signal }: Pick<RequestData, 'signal'> = {}) { public async get(channelId: Snowflake, { auth, signal }: Pick<RequestData, 'auth' | 'signal'> = {}) {
return this.rest.get(Routes.stageInstance(channelId), { signal }) as Promise<RESTGetAPIStageInstanceResult>; return this.rest.get(Routes.stageInstance(channelId), { auth, signal }) as Promise<RESTGetAPIStageInstanceResult>;
} }
/** /**
@@ -54,9 +55,10 @@ export class StageInstancesAPI {
public async edit( public async edit(
channelId: Snowflake, channelId: Snowflake,
body: RESTPatchAPIStageInstanceJSONBody, body: RESTPatchAPIStageInstanceJSONBody,
{ reason, signal }: Pick<RequestData, 'reason' | 'signal'> = {}, { auth, reason, signal }: Pick<RequestData, 'auth' | 'reason' | 'signal'> = {},
) { ) {
return this.rest.patch(Routes.stageInstance(channelId), { return this.rest.patch(Routes.stageInstance(channelId), {
auth,
body, body,
reason, reason,
signal, signal,
@@ -70,7 +72,10 @@ export class StageInstancesAPI {
* @param channelId - The id of the channel * @param channelId - The id of the channel
* @param options - The options for deleting the stage instance * @param options - The options for deleting the stage instance
*/ */
public async delete(channelId: Snowflake, { reason, signal }: Pick<RequestData, 'reason' | 'signal'> = {}) { public async delete(
await this.rest.delete(Routes.stageInstance(channelId), { reason, signal }); channelId: Snowflake,
{ auth, reason, signal }: Pick<RequestData, 'auth' | 'reason' | 'signal'> = {},
) {
await this.rest.delete(Routes.stageInstance(channelId), { auth, reason, signal });
} }
} }

View File

@@ -19,8 +19,8 @@ export class StickersAPI {
* @param packId - The id of the sticker pack * @param packId - The id of the sticker pack
* @param options - The options for fetching the sticker pack * @param options - The options for fetching the sticker pack
*/ */
public async getStickerPack(packId: Snowflake, { signal }: Pick<RequestData, 'signal'> = {}) { public async getStickerPack(packId: Snowflake, { auth, signal }: Pick<RequestData, 'auth' | 'signal'> = {}) {
return this.rest.get(Routes.stickerPack(packId), { signal }) as Promise<RESTGetAPIStickerPackResult>; return this.rest.get(Routes.stickerPack(packId), { auth, signal }) as Promise<RESTGetAPIStickerPackResult>;
} }
/** /**
@@ -29,8 +29,8 @@ export class StickersAPI {
* @see {@link https://discord.com/developers/docs/resources/sticker#list-sticker-packs} * @see {@link https://discord.com/developers/docs/resources/sticker#list-sticker-packs}
* @param options - The options for fetching the sticker packs * @param options - The options for fetching the sticker packs
*/ */
public async getStickers({ signal }: Pick<RequestData, 'signal'> = {}) { public async getStickers({ auth, signal }: Pick<RequestData, 'auth' | 'signal'> = {}) {
return this.rest.get(Routes.stickerPacks(), { signal }) as Promise<RESTGetStickerPacksResult>; return this.rest.get(Routes.stickerPacks(), { auth, signal }) as Promise<RESTGetStickerPacksResult>;
} }
/** /**
@@ -40,7 +40,7 @@ export class StickersAPI {
* @param stickerId - The id of the sticker * @param stickerId - The id of the sticker
* @param options - The options for fetching the sticker * @param options - The options for fetching the sticker
*/ */
public async get(stickerId: Snowflake, { signal }: Pick<RequestData, 'signal'> = {}) { public async get(stickerId: Snowflake, { auth, signal }: Pick<RequestData, 'auth' | 'signal'> = {}) {
return this.rest.get(Routes.sticker(stickerId), { signal }) as Promise<RESTGetAPIStickerResult>; return this.rest.get(Routes.sticker(stickerId), { auth, signal }) as Promise<RESTGetAPIStickerResult>;
} }
} }

View File

@@ -18,8 +18,8 @@ export class ThreadsAPI {
* @param threadId - The id of the thread to join * @param threadId - The id of the thread to join
* @param options - The options for joining the thread * @param options - The options for joining the thread
*/ */
public async join(threadId: Snowflake, { signal }: Pick<RequestData, 'signal'> = {}) { public async join(threadId: Snowflake, { auth, signal }: Pick<RequestData, 'auth' | 'signal'> = {}) {
await this.rest.put(Routes.threadMembers(threadId, '@me'), { signal }); await this.rest.put(Routes.threadMembers(threadId, '@me'), { auth, signal });
} }
/** /**
@@ -30,8 +30,12 @@ export class ThreadsAPI {
* @param userId - The id of the user to add to the thread * @param userId - The id of the user to add to the thread
* @param options - The options for adding the member to the thread * @param options - The options for adding the member to the thread
*/ */
public async addMember(threadId: Snowflake, userId: Snowflake, { signal }: Pick<RequestData, 'signal'> = {}) { public async addMember(
await this.rest.put(Routes.threadMembers(threadId, userId), { signal }); threadId: Snowflake,
userId: Snowflake,
{ auth, signal }: Pick<RequestData, 'auth' | 'signal'> = {},
) {
await this.rest.put(Routes.threadMembers(threadId, userId), { auth, signal });
} }
/** /**
@@ -41,8 +45,8 @@ export class ThreadsAPI {
* @param threadId - The id of the thread to leave * @param threadId - The id of the thread to leave
* @param options - The options for leaving the thread * @param options - The options for leaving the thread
*/ */
public async leave(threadId: Snowflake, { signal }: Pick<RequestData, 'signal'> = {}) { public async leave(threadId: Snowflake, { auth, signal }: Pick<RequestData, 'auth' | 'signal'> = {}) {
await this.rest.delete(Routes.threadMembers(threadId, '@me'), { signal }); await this.rest.delete(Routes.threadMembers(threadId, '@me'), { auth, signal });
} }
/** /**
@@ -53,8 +57,12 @@ export class ThreadsAPI {
* @param userId - The id of the user to remove from the thread * @param userId - The id of the user to remove from the thread
* @param options - The options for removing the member from the thread * @param options - The options for removing the member from the thread
*/ */
public async removeMember(threadId: Snowflake, userId: Snowflake, { signal }: Pick<RequestData, 'signal'> = {}) { public async removeMember(
await this.rest.delete(Routes.threadMembers(threadId, userId), { signal }); threadId: Snowflake,
userId: Snowflake,
{ auth, signal }: Pick<RequestData, 'auth' | 'signal'> = {},
) {
await this.rest.delete(Routes.threadMembers(threadId, userId), { auth, signal });
} }
/** /**
@@ -65,8 +73,12 @@ export class ThreadsAPI {
* @param userId - The id of the user * @param userId - The id of the user
* @param options - The options for fetching the member * @param options - The options for fetching the member
*/ */
public async getMember(threadId: Snowflake, userId: Snowflake, { signal }: Pick<RequestData, 'signal'> = {}) { public async getMember(
return this.rest.get(Routes.threadMembers(threadId, userId), { signal }) as Promise<APIThreadMember>; threadId: Snowflake,
userId: Snowflake,
{ auth, signal }: Pick<RequestData, 'auth' | 'signal'> = {},
) {
return this.rest.get(Routes.threadMembers(threadId, userId), { auth, signal }) as Promise<APIThreadMember>;
} }
/** /**
@@ -76,7 +88,10 @@ export class ThreadsAPI {
* @param threadId - The id of the thread to fetch the members from * @param threadId - The id of the thread to fetch the members from
* @param options - The options for fetching the members * @param options - The options for fetching the members
*/ */
public async getAllMembers(threadId: Snowflake, { signal }: Pick<RequestData, 'signal'> = {}) { public async getAllMembers(threadId: Snowflake, { auth, signal }: Pick<RequestData, 'auth' | 'signal'> = {}) {
return this.rest.get(Routes.threadMembers(threadId), { signal }) as Promise<RESTGetAPIChannelThreadMembersResult>; return this.rest.get(Routes.threadMembers(threadId), {
auth,
signal,
}) as Promise<RESTGetAPIChannelThreadMembersResult>;
} }
} }

View File

@@ -30,8 +30,8 @@ export class UsersAPI {
* @param userId - The id of the user to fetch * @param userId - The id of the user to fetch
* @param options - The options for fetching the user * @param options - The options for fetching the user
*/ */
public async get(userId: Snowflake, { signal }: Pick<RequestData, 'signal'> = {}) { public async get(userId: Snowflake, { auth, signal }: Pick<RequestData, 'auth' | 'signal'> = {}) {
return this.rest.get(Routes.user(userId), { signal }) as Promise<RESTGetAPIUserResult>; return this.rest.get(Routes.user(userId), { auth, signal }) as Promise<RESTGetAPIUserResult>;
} }
/** /**
@@ -40,8 +40,8 @@ export class UsersAPI {
* @see {@link https://discord.com/developers/docs/resources/user#get-current-user} * @see {@link https://discord.com/developers/docs/resources/user#get-current-user}
* @param options - The options for fetching the current user * @param options - The options for fetching the current user
*/ */
public async getCurrent({ signal }: Pick<RequestData, 'signal'> = {}) { public async getCurrent({ auth, signal }: Pick<RequestData, 'auth' | 'signal'> = {}) {
return this.rest.get(Routes.user('@me'), { signal }) as Promise<RESTGetAPICurrentUserResult>; return this.rest.get(Routes.user('@me'), { auth, signal }) as Promise<RESTGetAPICurrentUserResult>;
} }
/** /**
@@ -51,8 +51,12 @@ export class UsersAPI {
* @param query - The query options for fetching the current user's guilds * @param query - The query options for fetching the current user's guilds
* @param options - The options for fetching the guilds * @param options - The options for fetching the guilds
*/ */
public async getGuilds(query: RESTGetAPICurrentUserGuildsQuery = {}, { signal }: Pick<RequestData, 'signal'> = {}) { public async getGuilds(
query: RESTGetAPICurrentUserGuildsQuery = {},
{ auth, signal }: Pick<RequestData, 'auth' | 'signal'> = {},
) {
return this.rest.get(Routes.userGuilds(), { return this.rest.get(Routes.userGuilds(), {
auth,
query: makeURLSearchParams(query), query: makeURLSearchParams(query),
signal, signal,
}) as Promise<RESTGetAPICurrentUserGuildsResult>; }) as Promise<RESTGetAPICurrentUserGuildsResult>;
@@ -65,8 +69,8 @@ export class UsersAPI {
* @param guildId - The id of the guild * @param guildId - The id of the guild
* @param options - The options for leaving the guild * @param options - The options for leaving the guild
*/ */
public async leaveGuild(guildId: Snowflake, { signal }: Pick<RequestData, 'signal'> = {}) { public async leaveGuild(guildId: Snowflake, { auth, signal }: Pick<RequestData, 'auth' | 'signal'> = {}) {
await this.rest.delete(Routes.userGuild(guildId), { signal }); await this.rest.delete(Routes.userGuild(guildId), { auth, signal });
} }
/** /**
@@ -76,8 +80,11 @@ export class UsersAPI {
* @param body - The new data for the current user * @param body - The new data for the current user
* @param options - The options for editing the user * @param options - The options for editing the user
*/ */
public async edit(body: RESTPatchAPICurrentUserJSONBody, { signal }: Pick<RequestData, 'signal'> = {}) { public async edit(
return this.rest.patch(Routes.user('@me'), { body, signal }) as Promise<RESTPatchAPICurrentUserResult>; body: RESTPatchAPICurrentUserJSONBody,
{ auth, signal }: Pick<RequestData, 'auth' | 'signal'> = {},
) {
return this.rest.patch(Routes.user('@me'), { auth, body, signal }) as Promise<RESTPatchAPICurrentUserResult>;
} }
/** /**
@@ -87,8 +94,11 @@ export class UsersAPI {
* @param guildId - The id of the guild * @param guildId - The id of the guild
* @param options - The options for fetching the guild member * @param options - The options for fetching the guild member
*/ */
public async getGuildMember(guildId: Snowflake, { signal }: Pick<RequestData, 'signal'> = {}) { public async getGuildMember(guildId: Snowflake, { auth, signal }: Pick<RequestData, 'auth' | 'signal'> = {}) {
return this.rest.get(Routes.userGuildMember(guildId), { signal }) as Promise<RESTGetCurrentUserGuildMemberResult>; return this.rest.get(Routes.userGuildMember(guildId), {
auth,
signal,
}) as Promise<RESTGetCurrentUserGuildMemberResult>;
} }
/** /**
@@ -102,9 +112,10 @@ export class UsersAPI {
public async editCurrentGuildMember( public async editCurrentGuildMember(
guildId: Snowflake, guildId: Snowflake,
body: RESTPatchAPIGuildMemberJSONBody = {}, body: RESTPatchAPIGuildMemberJSONBody = {},
{ reason, signal }: Pick<RequestData, 'reason' | 'signal'> = {}, { auth, reason, signal }: Pick<RequestData, 'auth' | 'reason' | 'signal'> = {},
) { ) {
return this.rest.patch(Routes.guildMember(guildId, '@me'), { return this.rest.patch(Routes.guildMember(guildId, '@me'), {
auth,
reason, reason,
body, body,
signal, signal,
@@ -118,8 +129,9 @@ export class UsersAPI {
* @param userId - The id of the user to open a DM channel with * @param userId - The id of the user to open a DM channel with
* @param options - The options for opening the DM * @param options - The options for opening the DM
*/ */
public async createDM(userId: Snowflake, { signal }: Pick<RequestData, 'signal'> = {}) { public async createDM(userId: Snowflake, { auth, signal }: Pick<RequestData, 'auth' | 'signal'> = {}) {
return this.rest.post(Routes.userChannels(), { return this.rest.post(Routes.userChannels(), {
auth,
body: { recipient_id: userId }, body: { recipient_id: userId },
signal, signal,
}) as Promise<RESTPostAPICurrentUserCreateDMChannelResult>; }) as Promise<RESTPostAPICurrentUserCreateDMChannelResult>;
@@ -131,8 +143,8 @@ export class UsersAPI {
* @see {@link https://discord.com/developers/docs/resources/user#get-user-connections} * @see {@link https://discord.com/developers/docs/resources/user#get-user-connections}
* @param options - The options for fetching the user's connections * @param options - The options for fetching the user's connections
*/ */
public async getConnections({ signal }: Pick<RequestData, 'signal'> = {}) { public async getConnections({ auth, signal }: Pick<RequestData, 'auth' | 'signal'> = {}) {
return this.rest.get(Routes.userConnections(), { signal }) as Promise<RESTGetAPICurrentUserConnectionsResult>; return this.rest.get(Routes.userConnections(), { auth, signal }) as Promise<RESTGetAPICurrentUserConnectionsResult>;
} }
/** /**
@@ -142,8 +154,12 @@ export class UsersAPI {
* @param applicationId - The id of the application * @param applicationId - The id of the application
* @param options - The options for fetching the role connections * @param options - The options for fetching the role connections
*/ */
public async getApplicationRoleConnection(applicationId: Snowflake, { signal }: Pick<RequestData, 'signal'> = {}) { public async getApplicationRoleConnection(
applicationId: Snowflake,
{ auth, signal }: Pick<RequestData, 'auth' | 'signal'> = {},
) {
return this.rest.get(Routes.userApplicationRoleConnection(applicationId), { return this.rest.get(Routes.userApplicationRoleConnection(applicationId), {
auth,
signal, signal,
}) as Promise<RESTGetAPICurrentUserApplicationRoleConnectionResult>; }) as Promise<RESTGetAPICurrentUserApplicationRoleConnectionResult>;
} }
@@ -159,9 +175,10 @@ export class UsersAPI {
public async updateApplicationRoleConnection( public async updateApplicationRoleConnection(
applicationId: Snowflake, applicationId: Snowflake,
body: RESTPutAPICurrentUserApplicationRoleConnectionJSONBody, body: RESTPutAPICurrentUserApplicationRoleConnectionJSONBody,
{ signal }: Pick<RequestData, 'signal'> = {}, { auth, signal }: Pick<RequestData, 'auth' | 'signal'> = {},
) { ) {
return this.rest.put(Routes.userApplicationRoleConnection(applicationId), { return this.rest.put(Routes.userApplicationRoleConnection(applicationId), {
auth,
body, body,
signal, signal,
}) as Promise<RESTPutAPICurrentUserApplicationRoleConnectionResult>; }) as Promise<RESTPutAPICurrentUserApplicationRoleConnectionResult>;

View File

@@ -22,8 +22,8 @@ export class VoiceAPI {
* @see {@link https://discord.com/developers/docs/resources/voice#list-voice-regions} * @see {@link https://discord.com/developers/docs/resources/voice#list-voice-regions}
* @param options - The options for fetching the voice regions * @param options - The options for fetching the voice regions
*/ */
public async getVoiceRegions({ signal }: Pick<RequestData, 'signal'> = {}) { public async getVoiceRegions({ auth, signal }: Pick<RequestData, 'auth' | 'signal'> = {}) {
return this.rest.get(Routes.voiceRegions(), { signal }) as Promise<RESTGetAPIVoiceRegionsResult>; return this.rest.get(Routes.voiceRegions(), { auth, signal }) as Promise<RESTGetAPIVoiceRegionsResult>;
} }
/** /**
@@ -32,8 +32,13 @@ export class VoiceAPI {
* @see {@link https://discord.com/developers/docs/resources/voice#get-user-voice-state} * @see {@link https://discord.com/developers/docs/resources/voice#get-user-voice-state}
* @param options - The options for fetching user voice state * @param options - The options for fetching user voice state
*/ */
public async getUserVoiceState(guildId: Snowflake, userId: Snowflake, { signal }: Pick<RequestData, 'signal'> = {}) { public async getUserVoiceState(
guildId: Snowflake,
userId: Snowflake,
{ auth, signal }: Pick<RequestData, 'auth' | 'signal'> = {},
) {
return this.rest.get(Routes.guildVoiceState(guildId, userId), { return this.rest.get(Routes.guildVoiceState(guildId, userId), {
auth,
signal, signal,
}) as Promise<RESTGetAPIGuildVoiceStateUserResult>; }) as Promise<RESTGetAPIGuildVoiceStateUserResult>;
} }
@@ -44,8 +49,9 @@ export class VoiceAPI {
* @see {@link https://discord.com/developers/docs/resources/voice#get-current-user-voice-state} * @see {@link https://discord.com/developers/docs/resources/voice#get-current-user-voice-state}
* @param options - The options for fetching user voice state * @param options - The options for fetching user voice state
*/ */
public async getVoiceState(guildId: Snowflake, { signal }: Pick<RequestData, 'signal'> = {}) { public async getVoiceState(guildId: Snowflake, { auth, signal }: Pick<RequestData, 'auth' | 'signal'> = {}) {
return this.rest.get(Routes.guildVoiceState(guildId, '@me'), { return this.rest.get(Routes.guildVoiceState(guildId, '@me'), {
auth,
signal, signal,
}) as Promise<RESTGetAPIGuildVoiceStateCurrentMemberResult>; }) as Promise<RESTGetAPIGuildVoiceStateCurrentMemberResult>;
} }
@@ -63,9 +69,10 @@ export class VoiceAPI {
guildId: Snowflake, guildId: Snowflake,
userId: Snowflake, userId: Snowflake,
body: RESTPatchAPIGuildVoiceStateUserJSONBody, body: RESTPatchAPIGuildVoiceStateUserJSONBody,
{ reason, signal }: Pick<RequestData, 'reason' | 'signal'> = {}, { auth, reason, signal }: Pick<RequestData, 'auth' | 'reason' | 'signal'> = {},
) { ) {
return this.rest.patch(Routes.guildVoiceState(guildId, userId), { return this.rest.patch(Routes.guildVoiceState(guildId, userId), {
auth,
reason, reason,
body, body,
signal, signal,
@@ -83,9 +90,10 @@ export class VoiceAPI {
public async editVoiceState( public async editVoiceState(
guildId: Snowflake, guildId: Snowflake,
body: RESTPatchAPIGuildVoiceStateCurrentMemberJSONBody = {}, body: RESTPatchAPIGuildVoiceStateCurrentMemberJSONBody = {},
{ signal }: Pick<RequestData, 'signal'> = {}, { auth, signal }: Pick<RequestData, 'auth' | 'signal'> = {},
) { ) {
return this.rest.patch(Routes.guildVoiceState(guildId, '@me'), { return this.rest.patch(Routes.guildVoiceState(guildId, '@me'), {
auth,
body, body,
signal, signal,
}) as Promise<RESTPatchAPIGuildVoiceStateCurrentMemberResult>; }) as Promise<RESTPatchAPIGuildVoiceStateCurrentMemberResult>;

View File

@@ -295,7 +295,7 @@ export interface RequestData {
* *
* @defaultValue `true` * @defaultValue `true`
*/ */
auth?: AuthData | boolean; auth?: AuthData | boolean | undefined;
/** /**
* The body to send to this request. * The body to send to this request.
* If providing as BodyInit, set `passThroughBody: true` * If providing as BodyInit, set `passThroughBody: true`