Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(guild): Remove deprecated get guild overload #10052

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
35 changes: 5 additions & 30 deletions packages/core/src/api/guild.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,16 +104,6 @@ import {
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
*
Expand All @@ -122,26 +112,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>;
}

/**
Expand Down