diff --git a/src/api/Client.ts b/src/api/Client.ts index 2ee408e8ad..ea3ce0456a 100644 --- a/src/api/Client.ts +++ b/src/api/Client.ts @@ -130,6 +130,7 @@ declare module WAPI { const demoteParticipant: (groupId: string, contactId: string) => Promise; const setGroupToAdminsOnly: (groupId: string, onlyAdmins: boolean) => Promise; const setGroupEditToAdminsOnly: (groupId: string, onlyAdmins: boolean) => Promise; + const setGroupApprovalMode: (groupId: string, requireApproval: boolean) => Promise; const setGroupDescription: (groupId: string, description: string) => Promise; const setGroupTitle: (groupId: string, title: string) => Promise; const sendPoll: (groupId: string, name: string, options: string[], quotedMsgId ?: string, allowMultiSelect ?: boolean) => Promise; @@ -3604,6 +3605,20 @@ public async getStatus(contactId: ContactId) : Promise<{ ) as Promise; } + /** + * + * Turn on or off the approval requirement for new members to join a group + * @param groupId '0000000000-00000000@g.us' the group id. + * @param requireApproval set to true to turn on the approval requirement, false to turn off + * @returns boolean true if action completed successfully. + */ + public async setGroupApprovalMode(groupId: GroupChatId, requireApproval: boolean) : Promise { + return await this.pup( + ({ groupId, requireApproval }) => WAPI.setGroupEditToAdminsOnly(groupId, requireApproval), + { groupId, requireApproval } + ) as Promise; + } + /** * Change the group chant description * @param groupId '0000000000-00000000@g.us' the group id.