Skip to content

Commit

Permalink
docs: Added missing properties in group type definition (#2227)
Browse files Browse the repository at this point in the history
  • Loading branch information
gekkedev authored Aug 5, 2024
1 parent 1272156 commit dca8f1e
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 5 deletions.
12 changes: 8 additions & 4 deletions src/api/layers/group.layer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ export class GroupLayer extends RetrieverLayer {
}

/**
* Revokes group-invite link and generate new one.
* Revokes group-invite link and generates a new one.
* @category Group
* @param chatId
* @returns Invitation link
Expand All @@ -107,10 +107,12 @@ export class GroupLayer extends RetrieverLayer {
}

/**
* Generates group-invite link
* Displays group info from an invitation link (or invitation ID)
* @category Group
* @param inviteCode
* @returns Invite code from group link. Example: CMJYfPFqRyE2GxrnkldYED
* @returns Invite code or group link. Example: CMJYfPFqRyE2GxrnkldYED
* @example getGroupInfoFromInviteLink('https://chat.whatsapp.com/invite/CMJYfPFqRyE2GxrnkldYED')
* @example getGroupInfoFromInviteLink('CMJYfPFqRyE2GxrnkldYED')
*/
public async getGroupInfoFromInviteLink(inviteCode: string) {
inviteCode = inviteCode.replace('chat.whatsapp.com/', '');
Expand Down Expand Up @@ -232,9 +234,11 @@ export class GroupLayer extends RetrieverLayer {
return participants.filter((p) => p.isAdmin).map((p) => p.id);
}
/**
* Join a group with invite code
* Join a group with an invite code or link
* @category Group
* @param inviteCode
* @example joinGroup('https://chat.whatsapp.com/invite/CMJYfPFqRyE2GxrnkldYED')
* @example joinGroup('CMJYfPFqRyE2GxrnkldYED')
*/
public async joinGroup(inviteCode: string) {
inviteCode = inviteCode.replace('chat.whatsapp.com/', '');
Expand Down
2 changes: 1 addition & 1 deletion src/api/layers/sender.layer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ export class SenderLayer extends ListenerLayer {
* Sends image message
* @category Chat
* @param to ID of the chat to send the image to
* @param base64 File path, HTTP link, or a base64-encoded data URI (with mime type)
* @param base64 A base64-encoded data URI (with mime type)
* @param filename
* @param caption
* @param quotedMessageId Quoted message id
Expand Down
25 changes: 25 additions & 0 deletions src/api/model/group-metadata.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,15 @@
import { Wid } from './wid';

export interface GroupMetadata {
/** unique identifier for the group */
id: Wid;
/** timestamp of when the group was created */
creation: number;
owner: Wid;
/** title/name of the group */
subject: string;
subjectTime: number;
/** description of the group */
desc: string;
descId: string;
descTime: number;
Expand All @@ -29,13 +35,32 @@ export interface GroupMetadata {
announce: boolean;
noFrequentlyForwarded: boolean;
ephemeralDuration: number;
membershipApprovalMode: boolean;
memberAddMode: 'admin_add' | string; //TODO: complete the union type and then remove `strong`
reportToAdminMode: boolean;
/** current amount of members including admins */
size: number;
support: boolean;
suspended: boolean;
terminated: boolean;
uniqueShortNameMap: Object; //TODO: type is too generic
isLidAddressingMode: boolean;
isParentGroup: boolean;
isParentGroupClosed: boolean;
defaultSubgroup: boolean;
generalSubgroup: boolean;
generalChatAutoAddDisabled: boolean;
allowNonAdminSubGroupCreation: boolean;
lastActivityTimestamp: number;
lastSeenActivityTimestamp: number;
incognito: boolean;
hasCapi: boolean;
displayCadminPromotion: boolean;
participants: any[];
/** members who applied for membership but still need admin approval */
pendingParticipants: any[];
/** former members who left the group or were kicked out */
pastParticipants: any[];
membershipApprovalRequests: any[];
subgroupSuggestions: any[];
}

0 comments on commit dca8f1e

Please sign in to comment.