mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-09 16:13:31 +01:00
refactor(guild)!: remove deprecated get guild overload (#10052)
BREAKING CHANGE: Removed `GuildsAPI#get` overload that allowed passing options as 2nd parameter --------- Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>
This commit is contained in:
@@ -117,16 +117,6 @@ export interface CreateStickerOptions extends Omit<RESTPostAPIGuildStickerFormDa
|
||||
export class GuildsAPI {
|
||||
public constructor(private readonly rest: REST) {}
|
||||
|
||||
/**
|
||||
* Fetches a guild
|
||||
*
|
||||
* @see {@link https://discord.com/developers/docs/resources/guild#get-guild}
|
||||
* @param guildId - The id of the guild
|
||||
* @param options - The options for fetching the guild
|
||||
* @deprecated Use the overload with a query instead.
|
||||
*/
|
||||
public async get(guildId: Snowflake, { signal }?: Pick<RequestData, 'signal'>): Promise<RESTGetAPIGuildResult>;
|
||||
|
||||
/**
|
||||
* Fetches a guild
|
||||
*
|
||||
@@ -135,26 +125,11 @@ export class GuildsAPI {
|
||||
* @param query - The query options for fetching the guild
|
||||
* @param options - The options for fetching the guild
|
||||
*/
|
||||
public async get(
|
||||
guildId: Snowflake,
|
||||
query?: RESTGetAPIGuildQuery,
|
||||
options?: Pick<RequestData, 'signal'>,
|
||||
): Promise<RESTGetAPIGuildResult>;
|
||||
|
||||
public async get(
|
||||
guildId: Snowflake,
|
||||
queryOrOptions: Pick<RequestData, 'signal'> | RESTGetAPIGuildQuery = {},
|
||||
options: Pick<RequestData, 'signal'> = {},
|
||||
) {
|
||||
const requestData: RequestData = {
|
||||
signal: ('signal' in queryOrOptions ? queryOrOptions : options).signal,
|
||||
};
|
||||
|
||||
if ('with_counts' in queryOrOptions) {
|
||||
requestData.query = makeURLSearchParams(queryOrOptions);
|
||||
}
|
||||
|
||||
return this.rest.get(Routes.guild(guildId), requestData) as Promise<RESTGetAPIGuildResult>;
|
||||
public async get(guildId: Snowflake, query: RESTGetAPIGuildQuery = {}, { signal }: Pick<RequestData, 'signal'> = {}) {
|
||||
return this.rest.get(Routes.guild(guildId), {
|
||||
query: makeURLSearchParams(query),
|
||||
signal,
|
||||
}) as Promise<RESTGetAPIGuildResult>;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user