@open-wa/wa-automate-types-only 4.55.4 → 4.58.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
  *
@@ -545,6 +549,16 @@ export declare class Client {
545
549
  * @param mentions You can optionally add an array of contact IDs to tag only specific people
546
550
  */
547
551
  sendTextWithMentions(to: ChatId, content: Content, hideTags?: boolean, mentions?: ContactId[]): Promise<boolean | MessageId>;
552
+ /**
553
+ * NOTE: This is experimental, most accounts do not have access to this feature in their apps.
554
+ *
555
+ * Edit an existing message
556
+ *
557
+ * @param messageId The message ID to edit
558
+ * @param text The new text content
559
+ * @returns
560
+ */
561
+ editMessage(messageId: MessageId, text: Content): Promise<boolean | MessageId>;
548
562
  /**
549
563
  * [UNTESTED - REQUIRES FEEDBACK]
550
564
  * Sends a payment request message to given chat
@@ -810,9 +824,12 @@ export declare class Client {
810
824
  getFeatures(): Promise<any>;
811
825
  /**
812
826
  * Returns a PNG DataURL screenshot of the session
827
+ * @param chatId Chat ID to open before taking a snapshot
828
+ * @param width Width of the viewport for the snapshot. Height also required if you want to resize.
829
+ * @param height Height of the viewport for the snapshot. Width also required if you want to resize.
813
830
  * @returns `Promise<DataURL>`
814
831
  */
815
- getSnapshot(chatId?: ChatId): Promise<DataURL>;
832
+ getSnapshot(chatId?: ChatId, width?: number, height?: number): Promise<DataURL>;
816
833
  /**
817
834
  * Returns some metrics of the session/page.
818
835
  * @returns `Promise<any>`
@@ -1035,6 +1052,11 @@ export declare class Client {
1035
1052
  * @returns array of groups
1036
1053
  */
1037
1054
  getAllGroups(withNewMessagesOnly?: boolean): Promise<Chat[]>;
1055
+ /**
1056
+ * Retrieve all commmunity Ids
1057
+ * @returns array of group ids
1058
+ */
1059
+ getAllCommunities(): Promise<GroupId[]>;
1038
1060
  /**
1039
1061
  * Retrieves group members as [Id] objects
1040
1062
  * @param groupId group id
@@ -1045,6 +1067,56 @@ export declare class Client {
1045
1067
  * @param groupId group id
1046
1068
  */
1047
1069
  getGroupInfo(groupId: GroupChatId): Promise<any>;
1070
+ /**
1071
+ * Returns the community metadata. Like group metadata but with a `subGroups` property which is the group metadata of the community subgroups.
1072
+ * @param communityId community id
1073
+ */
1074
+ getCommunityInfo(communityId: GroupChatId): Promise<GroupMetadata & {
1075
+ subGroups: GroupMetadata[];
1076
+ }>;
1077
+ /**
1078
+ *
1079
+ * Accepts a request from a recipient to join a group. Takes the message ID of the request message.
1080
+ *
1081
+ * @param {string} messageId
1082
+ */
1083
+ acceptGroupJoinRequest(messageId: MessageId): Promise<boolean>;
1084
+ /**
1085
+ * Retrieves community members Ids
1086
+ * @param communityId community id
1087
+ */
1088
+ getCommunityParticipantIds(communityId: GroupChatId): Promise<{
1089
+ id: GroupChatId;
1090
+ participants: ContactId[];
1091
+ subgroup: boolean;
1092
+ }[]>;
1093
+ /**
1094
+ * Retrieves community admin Ids
1095
+ * @param communityId community id
1096
+ */
1097
+ getCommunityAdminIds(communityId: GroupChatId): Promise<{
1098
+ id: GroupChatId;
1099
+ admins: ContactId[];
1100
+ subgroup: boolean;
1101
+ }[]>;
1102
+ /**
1103
+ * Retrieves community members as Contact objects
1104
+ * @param communityId community id
1105
+ */
1106
+ getCommunityParticipants(communityId: GroupChatId): Promise<{
1107
+ id: GroupChatId;
1108
+ participants: Contact[];
1109
+ subgroup: boolean;
1110
+ }[]>;
1111
+ /**
1112
+ * Retrieves community admins as Contact objects
1113
+ * @param communityId community id
1114
+ */
1115
+ getCommunityAdmins(communityId: GroupChatId): Promise<{
1116
+ id: GroupChatId;
1117
+ admins: Contact[];
1118
+ subgroup: boolean;
1119
+ }[]>;
1048
1120
  /** Joins a group via the invite link, code, or message
1049
1121
  * @param link This param is the string which includes the invite link or code. The following work:
1050
1122
  * - Follow this link to join my WA group: https://chat.whatsapp.com/DHTGJUfFJAV9MxOpZO1fBZ
@@ -1710,6 +1782,14 @@ export declare class Client {
1710
1782
  */
1711
1783
  sendGiphyAsSticker(to: ChatId, giphyMediaUrl: URL | string): Promise<MessageId | string | boolean>;
1712
1784
  /**
1785
+ * @deprecated
1786
+ *
1787
+ * :::danger
1788
+ *
1789
+ * Status features are broken for now. Please join our discord community for updates.
1790
+ *
1791
+ * :::
1792
+ *
1713
1793
  * [REQUIRES A TEXT STORY LICENSE-KEY](https://gum.co/open-wa)
1714
1794
  *
1715
1795
  * Sends a formatted text story.
@@ -1727,6 +1807,14 @@ export declare class Client {
1727
1807
  */
1728
1808
  postTextStatus(text: Content, textRgba: string, backgroundRgba: string, font: number): Promise<MessageId | string | boolean>;
1729
1809
  /**
1810
+ * @deprecated
1811
+ *
1812
+ * :::danger
1813
+ *
1814
+ * Status features are broken for now. Please join our discord community for updates.
1815
+ *
1816
+ * :::
1817
+ *
1730
1818
  * [REQUIRES AN IMAGE STORY LICENSE-KEY](https://gum.co/open-wa)
1731
1819
  *
1732
1820
  * Posts an image story.
@@ -1736,6 +1824,14 @@ export declare class Client {
1736
1824
  */
1737
1825
  postImageStatus(data: DataURL, caption: Content): Promise<MessageId | string | boolean>;
1738
1826
  /**
1827
+ * @deprecated
1828
+ *
1829
+ * :::danger
1830
+ *
1831
+ * Status features are broken for now. Please join our discord community for updates.
1832
+ *
1833
+ * :::
1834
+ *
1739
1835
  * [REQUIRES A VIDEO STORY LICENSE-KEY](https://gum.co/open-wa)
1740
1836
  *
1741
1837
  * 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.58.0",
4
4
  "description": "Types generated from the @open-wa/wa-automate package",
5
5
  "scripts": {
6
6
  "build": "tsc",