Skip to content

Commit

Permalink
feat: Added client.getCommonGroups function
Browse files Browse the repository at this point in the history
  • Loading branch information
icleitoncosta committed Nov 15, 2023
1 parent 394ef17 commit 194c898
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions src/api/layers/retriever.layer.ts
Expand Up @@ -21,6 +21,7 @@ import { SessionToken } from '../../token-store';
import { evaluateAndReturn } from '../helpers';
import {
Chat,
Contact,
ContactStatus,
ProfilePicThumbObj,
WhatsappProfile,
Expand Down Expand Up @@ -594,4 +595,24 @@ export class RetrieverLayer extends SenderLayer {
public async getOrder(msgId: string) {
return evaluateAndReturn(this.page, (msgId) => WPP.order.get(msgId), msgId);
}

/**
* Get all commons groups for the contact
*
* @example
* ```javascript
* const groups_ids = await client.getCommonGroups('[number]@c.us');
* ```
*
* @category Group
* @param groupId Group ID ('000000-000000@g.us')
* @returns Promise
*/
public async getCommonGroups(wid: string) {
return await evaluateAndReturn(
this.page,
({ wid }) => WPP.contact.getCommonGroups(wid),
{ wid }
);
}
}

0 comments on commit 194c898

Please sign in to comment.