From 2319ff5c2889dcdd8aee52586b2ddd4325979360 Mon Sep 17 00:00:00 2001 From: M SHAH Date: Tue, 14 Feb 2023 01:56:13 +0300 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20feat:=20`getCommunityAdmins`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/api/Client.ts | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/src/api/Client.ts b/src/api/Client.ts index b04239602a..4cec88dac6 100644 --- a/src/api/Client.ts +++ b/src/api/Client.ts @@ -180,6 +180,7 @@ declare module WAPI { ) => Promise; const getBusinessProfilesProducts: (to: string) => Promise; const getCommunityInfo: (groupId: string) => Promise; + const getCommunityAdmins: (groupId: string) => Promise; const getCommunityParticipantIds: (groupId: string) => Promise; const postStatus: (text: string, params: any) => Promise; const deleteStatus: (statusesToDelete: string | string[]) => Promise; @@ -2609,6 +2610,26 @@ public async testCallback(callbackToTest: SimpleListener, testData: any) : Prom }[]>; } + + /** + * Retrieves community admins as Contact objects + * @param communityId community id + */ + public async getCommunityAdmins(communityId: GroupChatId) : Promise<{ + id: GroupChatId, + admins: Contact[], + subgroup: boolean + }[]>{ + return await this.pup( + communityId => WAPI.getCommunityAdmins(communityId), + communityId + ) as Promise<{ + id: GroupChatId, + admins: Contact[], + subgroup: boolean + }[]>; + } + /** Joins a group via the invite link, code, or message * @param link This param is the string which includes the invite link or code. The following work: * - Follow this link to join my WA group: https://chat.whatsapp.com/DHTGJUfFJAV9MxOpZO1fBZ