mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-14 02:23:31 +01:00
feat(core): Add AbortSignal support. (#9042)
* feat: add abort signal to guilds api * feat: add to application commands, channels, and users classes * chore: finish up * chore: centralize types * chore: make requested changes * chore: make requested changes * refactor: consistently use empty objects * Update packages/core/src/api/webhook.ts Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com> * chore: make requested changes * refactor: update `setVoiceState` after rebase * chore: requested changes * refactor: use -types interface for query --------- Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
import type { REST } from '@discordjs/rest';
|
||||
import type { RequestData, REST } from '@discordjs/rest';
|
||||
import {
|
||||
Routes,
|
||||
type RESTGetAPIApplicationRoleConnectionMetadataResult,
|
||||
@@ -15,11 +15,12 @@ export class RoleConnectionsAPI {
|
||||
*
|
||||
* @see {@link https://discord.com/developers/docs/resources/application-role-connection-metadata#get-application-role-connection-metadata-records}
|
||||
* @param applicationId - The id of the application to get role connection metadata records for
|
||||
* @param options - The options to use when fetching the role connection metadata records
|
||||
*/
|
||||
public async getMetadataRecords(applicationId: Snowflake) {
|
||||
return this.rest.get(
|
||||
Routes.applicationRoleConnectionMetadata(applicationId),
|
||||
) as Promise<RESTGetAPIApplicationRoleConnectionMetadataResult>;
|
||||
public async getMetadataRecords(applicationId: Snowflake, { signal }: Pick<RequestData, 'signal'> = {}) {
|
||||
return this.rest.get(Routes.applicationRoleConnectionMetadata(applicationId), {
|
||||
signal,
|
||||
}) as Promise<RESTGetAPIApplicationRoleConnectionMetadataResult>;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -27,14 +28,17 @@ export class RoleConnectionsAPI {
|
||||
*
|
||||
* @see {@link https://discord.com/developers/docs/resources/application-role-connection-metadata#update-application-role-connection-metadata-records}
|
||||
* @param applicationId - The id of the application to update role connection metadata records for
|
||||
* @param options - The new role connection metadata records
|
||||
* @param body - The new role connection metadata records
|
||||
* @param options - The options to use when updating the role connection metadata records
|
||||
*/
|
||||
public async updateMetadataRecords(
|
||||
applicationId: Snowflake,
|
||||
options: RESTPutAPIApplicationCommandPermissionsJSONBody,
|
||||
body: RESTPutAPIApplicationCommandPermissionsJSONBody,
|
||||
{ signal }: Pick<RequestData, 'signal'> = {},
|
||||
) {
|
||||
return this.rest.put(Routes.applicationRoleConnectionMetadata(applicationId), {
|
||||
body: options,
|
||||
body,
|
||||
signal,
|
||||
}) as Promise<RESTPutAPIApplicationRoleConnectionMetadataResult>;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user