From b9b03935baf5e327d47615fade8f52f6046d0bbf Mon Sep 17 00:00:00 2001 From: Yassine Ennebati <4570448+yaziine@users.noreply.github.com> Date: Tue, 10 Sep 2024 13:32:34 +0400 Subject: [PATCH] feat: add partialUpdateMember endpoint (#1344) --- src/channel.ts | 20 ++++++++++++++++++++ src/types.ts | 5 +++++ 2 files changed, 25 insertions(+) diff --git a/src/channel.ts b/src/channel.ts index 63e2b6178..df8bb98f5 100644 --- a/src/channel.ts +++ b/src/channel.ts @@ -37,6 +37,7 @@ import { MuteChannelAPIResponse, PartialUpdateChannel, PartialUpdateChannelAPIResponse, + PartialUpdateMember, PinnedMessagePaginationOptions, PinnedMessagesSort, QueryMembersOptions, @@ -299,6 +300,25 @@ export class Channel} updates + * + * @return {Promise>} Updated member + */ + async partialUpdateMember(user_id: string, updates: PartialUpdateMember) { + if (!user_id) { + throw Error('Please specify the user id'); + } + + return await this.getClient().patch>( + this._channelURL() + `/member/${encodeURIComponent(user_id)}`, + updates, + ); + } + /** * sendReaction - Send a reaction about a message * diff --git a/src/types.ts b/src/types.ts index 0bc702ac0..8e1652392 100644 --- a/src/types.ts +++ b/src/types.ts @@ -2472,6 +2472,11 @@ export type PartialUpdateChannel>; }; +export type PartialUpdateMember = { + set?: Partial>; + unset?: Array>; +}; + export type PartialUserUpdate = { id: string; set?: Partial>;