mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-12 09:33:32 +01:00
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:
@@ -18,8 +18,8 @@ export class ThreadsAPI {
|
||||
* @param threadId - The id of the thread to join
|
||||
* @param options - The options for joining the thread
|
||||
*/
|
||||
public async join(threadId: Snowflake, { signal }: Pick<RequestData, 'signal'> = {}) {
|
||||
await this.rest.put(Routes.threadMembers(threadId, '@me'), { signal });
|
||||
public async join(threadId: Snowflake, { auth, signal }: Pick<RequestData, 'auth' | '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 options - The options for adding the member to the thread
|
||||
*/
|
||||
public async addMember(threadId: Snowflake, userId: Snowflake, { signal }: Pick<RequestData, 'signal'> = {}) {
|
||||
await this.rest.put(Routes.threadMembers(threadId, userId), { signal });
|
||||
public async addMember(
|
||||
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 options - The options for leaving the thread
|
||||
*/
|
||||
public async leave(threadId: Snowflake, { signal }: Pick<RequestData, 'signal'> = {}) {
|
||||
await this.rest.delete(Routes.threadMembers(threadId, '@me'), { signal });
|
||||
public async leave(threadId: Snowflake, { auth, signal }: Pick<RequestData, 'auth' | '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 options - The options for removing the member from the thread
|
||||
*/
|
||||
public async removeMember(threadId: Snowflake, userId: Snowflake, { signal }: Pick<RequestData, 'signal'> = {}) {
|
||||
await this.rest.delete(Routes.threadMembers(threadId, userId), { signal });
|
||||
public async removeMember(
|
||||
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 options - The options for fetching the member
|
||||
*/
|
||||
public async getMember(threadId: Snowflake, userId: Snowflake, { signal }: Pick<RequestData, 'signal'> = {}) {
|
||||
return this.rest.get(Routes.threadMembers(threadId, userId), { signal }) as Promise<APIThreadMember>;
|
||||
public async getMember(
|
||||
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 options - The options for fetching the members
|
||||
*/
|
||||
public async getAllMembers(threadId: Snowflake, { signal }: Pick<RequestData, 'signal'> = {}) {
|
||||
return this.rest.get(Routes.threadMembers(threadId), { signal }) as Promise<RESTGetAPIChannelThreadMembersResult>;
|
||||
public async getAllMembers(threadId: Snowflake, { auth, signal }: Pick<RequestData, 'auth' | 'signal'> = {}) {
|
||||
return this.rest.get(Routes.threadMembers(threadId), {
|
||||
auth,
|
||||
signal,
|
||||
}) as Promise<RESTGetAPIChannelThreadMembersResult>;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user