Skip to content

Commit

Permalink
feat(api): add getMemberBans() query options and getMemberBan() (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
D4isDAVID authored May 14, 2023
1 parent 7196fe3 commit 590f5bc
Showing 1 changed file with 26 additions and 4 deletions.
30 changes: 26 additions & 4 deletions packages/core/src/api/guild.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ import type {
RESTGetAPIAuditLogResult,
RESTGetAPIAutoModerationRuleResult,
RESTGetAPIAutoModerationRulesResult,
RESTGetAPIGuildBanResult,
RESTGetAPIGuildBansQuery,
RESTGetAPIGuildBansResult,
RESTGetAPIGuildChannelsResult,
RESTGetAPIGuildEmojiResult,
Expand Down Expand Up @@ -241,12 +243,32 @@ export class GuildsAPI {
/**
* Fetches a guild member ban
*
* @see {@link https://discord.com/developers/docs/resources/guild#get-guild-bans}
* @see {@link https://discord.com/developers/docs/resources/guild#get-guild-ban}
* @param guildId - The id of the guild to fetch the ban from
* @param options - The options for fetching the guild member ban
* @param userId - The id of the user to fetch the ban
* @param options - The options for fetching the ban
*/
public async getMemberBan(guildId: Snowflake, userId: Snowflake, { signal }: Pick<RequestData, 'signal'> = {}) {
return this.rest.get(Routes.guildBan(guildId, userId), { signal }) as Promise<RESTGetAPIGuildBanResult>;
}

/**
* Fetches guild member bans
*
* @see {@link https://discord.com/developers/docs/resources/guild#get-guild-bans}
* @param guildId - The id of the guild to fetch the bans from
* @param query - The query options for fetching the bans
* @param options - The options for fetching the bans
*/
public async getMemberBans(guildId: Snowflake, { signal }: Pick<RequestData, 'signal'> = {}) {
return this.rest.get(Routes.guildBans(guildId), { signal }) as Promise<RESTGetAPIGuildBansResult>;
public async getMemberBans(
guildId: Snowflake,
query: RESTGetAPIGuildBansQuery = {},
{ signal }: Pick<RequestData, 'signal'> = {},
) {
return this.rest.get(Routes.guildBans(guildId), {
query: makeURLSearchParams(query),
signal,
}) as Promise<RESTGetAPIGuildBansResult>;
}

/**
Expand Down

0 comments on commit 590f5bc

Please sign in to comment.