@open-wa/wa-automate-types-only 4.55.2 → 4.57.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -4,7 +4,7 @@ import { Chat, LiveLocationChangedEvent, ChatState, ChatMuteDuration, GroupChatC
4
4
  import { Contact, NumberCheck } from './model/contact';
5
5
  import { Message, MessageInfo, PollData } from './model/message';
6
6
  import { AxiosRequestConfig } from 'axios';
7
- import { NewCommunityGroup, ParticipantChangedEventModel, GenericGroupChangeEvent } from './model/group-metadata';
7
+ import { NewCommunityGroup, ParticipantChangedEventModel, GenericGroupChangeEvent, GroupMetadata } from './model/group-metadata';
8
8
  import { ConfigObject, STATE, LicenseType, Webhook, EventPayload } from './model';
9
9
  import PQueue, { DefaultAddOptions, Options } from 'p-queue';
10
10
  import { HealthCheck, SessionInfo } from './model/sessionInfo';
@@ -98,6 +98,10 @@ export declare class Client {
98
98
  * @returns SessionInfo
99
99
  */
100
100
  getSessionInfo(): SessionInfo;
101
+ /**
102
+ * Easily resize page on the fly. Useful if you're showing screenshots in a web-app.
103
+ */
104
+ resizePage(width?: number, height?: number): Promise<boolean>;
101
105
  /**
102
106
  * Get the config which was used to set up the client. Sensitive details (like devTools username and password, and browserWSEndpoint) are scrubbed
103
107
  *
@@ -766,8 +770,10 @@ export declare class Client {
766
770
  * @param to chat id - a group chat is required
767
771
  * @param name the name of the poll
768
772
  * @param options an array of poll options
773
+ * @param quotedMsgId A message to quote when sending the poll
774
+ * @param allowMultiSelect Whether or not to allow multiple selections. default false
769
775
  */
770
- sendPoll(to: GroupChatId, name: string, options: string[]): Promise<MessageId>;
776
+ sendPoll(to: GroupChatId, name: string, options: string[], quotedMsgId?: MessageId, allowMultiSelect?: boolean): Promise<MessageId>;
771
777
  /**
772
778
  * Sends a video to given chat as a gif, with caption or not, using base64
773
779
  * @param to chat id `xxxxx@c.us`
@@ -808,9 +814,12 @@ export declare class Client {
808
814
  getFeatures(): Promise<any>;
809
815
  /**
810
816
  * Returns a PNG DataURL screenshot of the session
817
+ * @param chatId Chat ID to open before taking a snapshot
818
+ * @param width Width of the viewport for the snapshot. Height also required if you want to resize.
819
+ * @param height Height of the viewport for the snapshot. Width also required if you want to resize.
811
820
  * @returns `Promise<DataURL>`
812
821
  */
813
- getSnapshot(chatId?: ChatId): Promise<DataURL>;
822
+ getSnapshot(chatId?: ChatId, width?: number, height?: number): Promise<DataURL>;
814
823
  /**
815
824
  * Returns some metrics of the session/page.
816
825
  * @returns `Promise<any>`
@@ -1033,6 +1042,11 @@ export declare class Client {
1033
1042
  * @returns array of groups
1034
1043
  */
1035
1044
  getAllGroups(withNewMessagesOnly?: boolean): Promise<Chat[]>;
1045
+ /**
1046
+ * Retrieve all commmunity Ids
1047
+ * @returns array of group ids
1048
+ */
1049
+ getAllCommunities(): Promise<GroupId[]>;
1036
1050
  /**
1037
1051
  * Retrieves group members as [Id] objects
1038
1052
  * @param groupId group id
@@ -1043,6 +1057,56 @@ export declare class Client {
1043
1057
  * @param groupId group id
1044
1058
  */
1045
1059
  getGroupInfo(groupId: GroupChatId): Promise<any>;
1060
+ /**
1061
+ * Returns the community metadata. Like group metadata but with a `subGroups` property which is the group metadata of the community subgroups.
1062
+ * @param communityId community id
1063
+ */
1064
+ getCommunityInfo(communityId: GroupChatId): Promise<GroupMetadata & {
1065
+ subGroups: GroupMetadata[];
1066
+ }>;
1067
+ /**
1068
+ *
1069
+ * Accepts a request from a recipient to join a group. Takes the message ID of the request message.
1070
+ *
1071
+ * @param {string} messageId
1072
+ */
1073
+ acceptGroupJoinRequest(messageId: MessageId): Promise<boolean>;
1074
+ /**
1075
+ * Retrieves community members Ids
1076
+ * @param communityId community id
1077
+ */
1078
+ getCommunityParticipantIds(communityId: GroupChatId): Promise<{
1079
+ id: GroupChatId;
1080
+ participants: ContactId[];
1081
+ subgroup: boolean;
1082
+ }[]>;
1083
+ /**
1084
+ * Retrieves community admin Ids
1085
+ * @param communityId community id
1086
+ */
1087
+ getCommunityAdminIds(communityId: GroupChatId): Promise<{
1088
+ id: GroupChatId;
1089
+ admins: ContactId[];
1090
+ subgroup: boolean;
1091
+ }[]>;
1092
+ /**
1093
+ * Retrieves community members as Contact objects
1094
+ * @param communityId community id
1095
+ */
1096
+ getCommunityParticipants(communityId: GroupChatId): Promise<{
1097
+ id: GroupChatId;
1098
+ participants: Contact[];
1099
+ subgroup: boolean;
1100
+ }[]>;
1101
+ /**
1102
+ * Retrieves community admins as Contact objects
1103
+ * @param communityId community id
1104
+ */
1105
+ getCommunityAdmins(communityId: GroupChatId): Promise<{
1106
+ id: GroupChatId;
1107
+ admins: Contact[];
1108
+ subgroup: boolean;
1109
+ }[]>;
1046
1110
  /** Joins a group via the invite link, code, or message
1047
1111
  * @param link This param is the string which includes the invite link or code. The following work:
1048
1112
  * - Follow this link to join my WA group: https://chat.whatsapp.com/DHTGJUfFJAV9MxOpZO1fBZ
@@ -1708,6 +1772,14 @@ export declare class Client {
1708
1772
  */
1709
1773
  sendGiphyAsSticker(to: ChatId, giphyMediaUrl: URL | string): Promise<MessageId | string | boolean>;
1710
1774
  /**
1775
+ * @deprecated
1776
+ *
1777
+ * :::danger
1778
+ *
1779
+ * Status features are broken for now. Please join our discord community for updates.
1780
+ *
1781
+ * :::
1782
+ *
1711
1783
  * [REQUIRES A TEXT STORY LICENSE-KEY](https://gum.co/open-wa)
1712
1784
  *
1713
1785
  * Sends a formatted text story.
@@ -1725,6 +1797,14 @@ export declare class Client {
1725
1797
  */
1726
1798
  postTextStatus(text: Content, textRgba: string, backgroundRgba: string, font: number): Promise<MessageId | string | boolean>;
1727
1799
  /**
1800
+ * @deprecated
1801
+ *
1802
+ * :::danger
1803
+ *
1804
+ * Status features are broken for now. Please join our discord community for updates.
1805
+ *
1806
+ * :::
1807
+ *
1728
1808
  * [REQUIRES AN IMAGE STORY LICENSE-KEY](https://gum.co/open-wa)
1729
1809
  *
1730
1810
  * Posts an image story.
@@ -1734,6 +1814,14 @@ export declare class Client {
1734
1814
  */
1735
1815
  postImageStatus(data: DataURL, caption: Content): Promise<MessageId | string | boolean>;
1736
1816
  /**
1817
+ * @deprecated
1818
+ *
1819
+ * :::danger
1820
+ *
1821
+ * Status features are broken for now. Please join our discord community for updates.
1822
+ *
1823
+ * :::
1824
+ *
1737
1825
  * [REQUIRES A VIDEO STORY LICENSE-KEY](https://gum.co/open-wa)
1738
1826
  *
1739
1827
  * Posts a video story.
@@ -1,4 +1,4 @@
1
- import { ChatId, ContactId, MessageId } from "./aliases";
1
+ import { ChatId, ContactId, MessageId, GroupChatId } from "./aliases";
2
2
  import { Button, Row, Section } from "./button";
3
3
  import { Chat } from "./chat";
4
4
  import { Contact } from "./contact";
@@ -156,7 +156,7 @@ export interface Message {
156
156
  *
157
157
  * If this is `true` then you need to determine within your own code whether or not to accept the user to the group which is indicated with `quotedRemoteJid` using `addParticipant`.
158
158
  */
159
- isGroupJoinRequest?: boolean;
159
+ isGroupJoinRequest?: GroupChatId;
160
160
  /**
161
161
  * The ID of the message sender
162
162
  */
@@ -168,7 +168,7 @@ export interface Message {
168
168
  /**
169
169
  * The parent group ID (community ID - communities are just groups made up of other groups) of the group represented by `quotedRemoteJid`
170
170
  */
171
- quotedParentGroupJid?: string;
171
+ quotedParentGroupJid?: GroupChatId;
172
172
  mediaData: unknown;
173
173
  shareDuration: number;
174
174
  isAnimated: boolean;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@open-wa/wa-automate-types-only",
3
- "version": "4.55.2",
3
+ "version": "4.57.0",
4
4
  "description": "Types generated from the @open-wa/wa-automate package",
5
5
  "scripts": {
6
6
  "build": "tsc",