Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: missing properties in group type definition #2227

Merged
merged 3 commits into from
Aug 5, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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 @@ -234,7 +234,7 @@ export class SenderLayer extends ListenerLayer {
* Sends image message
* @category Chat
* @param to Chat id
* @param base64 File path, http link or base64Encoded
* @param base64 A base64-encoded data URI (with mime type)
gekkedev marked this conversation as resolved.
Show resolved Hide resolved
* @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[];
}