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

Sign up to get free protection for your applications and to get access to all the features.
@@ -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
  *
@@ -810,9 +814,12 @@ export declare class Client {
810
814
  getFeatures(): Promise<any>;
811
815
  /**
812
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.
813
820
  * @returns `Promise<DataURL>`
814
821
  */
815
- getSnapshot(chatId?: ChatId): Promise<DataURL>;
822
+ getSnapshot(chatId?: ChatId, width?: number, height?: number): Promise<DataURL>;
816
823
  /**
817
824
  * Returns some metrics of the session/page.
818
825
  * @returns `Promise<any>`
@@ -1035,6 +1042,11 @@ export declare class Client {
1035
1042
  * @returns array of groups
1036
1043
  */
1037
1044
  getAllGroups(withNewMessagesOnly?: boolean): Promise<Chat[]>;
1045
+ /**
1046
+ * Retrieve all commmunity Ids
1047
+ * @returns array of group ids
1048
+ */
1049
+ getAllCommunities(): Promise<GroupId[]>;
1038
1050
  /**
1039
1051
  * Retrieves group members as [Id] objects
1040
1052
  * @param groupId group id
@@ -1045,6 +1057,56 @@ export declare class Client {
1045
1057
  * @param groupId group id
1046
1058
  */
1047
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
+ }[]>;
1048
1110
  /** Joins a group via the invite link, code, or message
1049
1111
  * @param link This param is the string which includes the invite link or code. The following work:
1050
1112
  * - Follow this link to join my WA group: https://chat.whatsapp.com/DHTGJUfFJAV9MxOpZO1fBZ
@@ -1710,6 +1772,14 @@ export declare class Client {
1710
1772
  */
1711
1773
  sendGiphyAsSticker(to: ChatId, giphyMediaUrl: URL | string): Promise<MessageId | string | boolean>;
1712
1774
  /**
1775
+ * @deprecated
1776
+ *
1777
+ * :::danger
1778
+ *
1779
+ * Status features are broken for now. Please join our discord community for updates.
1780
+ *
1781
+ * :::
1782
+ *
1713
1783
  * [REQUIRES A TEXT STORY LICENSE-KEY](https://gum.co/open-wa)
1714
1784
  *
1715
1785
  * Sends a formatted text story.
@@ -1727,6 +1797,14 @@ export declare class Client {
1727
1797
  */
1728
1798
  postTextStatus(text: Content, textRgba: string, backgroundRgba: string, font: number): Promise<MessageId | string | boolean>;
1729
1799
  /**
1800
+ * @deprecated
1801
+ *
1802
+ * :::danger
1803
+ *
1804
+ * Status features are broken for now. Please join our discord community for updates.
1805
+ *
1806
+ * :::
1807
+ *
1730
1808
  * [REQUIRES AN IMAGE STORY LICENSE-KEY](https://gum.co/open-wa)
1731
1809
  *
1732
1810
  * Posts an image story.
@@ -1736,6 +1814,14 @@ export declare class Client {
1736
1814
  */
1737
1815
  postImageStatus(data: DataURL, caption: Content): Promise<MessageId | string | boolean>;
1738
1816
  /**
1817
+ * @deprecated
1818
+ *
1819
+ * :::danger
1820
+ *
1821
+ * Status features are broken for now. Please join our discord community for updates.
1822
+ *
1823
+ * :::
1824
+ *
1739
1825
  * [REQUIRES A VIDEO STORY LICENSE-KEY](https://gum.co/open-wa)
1740
1826
  *
1741
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.4",
3
+ "version": "4.57.0",
4
4
  "description": "Types generated from the @open-wa/wa-automate package",
5
5
  "scripts": {
6
6
  "build": "tsc",