wuzapi 1.5.4 → 1.6.1
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.
- package/README.md +148 -121
- package/dist/modules/admin.d.ts +2 -6
- package/dist/modules/admin.js +0 -6
- package/dist/modules/admin.js.map +1 -1
- package/dist/modules/chat.d.ts +5 -5
- package/dist/modules/chat.js +30 -5
- package/dist/modules/chat.js.map +1 -1
- package/dist/modules/group.d.ts +3 -3
- package/dist/modules/group.js +20 -15
- package/dist/modules/group.js.map +1 -1
- package/dist/modules/session.d.ts +2 -2
- package/dist/modules/session.js +4 -4
- package/dist/modules/session.js.map +1 -1
- package/dist/modules/user.d.ts +2 -2
- package/dist/modules/user.js +3 -2
- package/dist/modules/user.js.map +1 -1
- package/dist/modules/webhook.d.ts +3 -3
- package/dist/modules/webhook.js +9 -5
- package/dist/modules/webhook.js.map +1 -1
- package/dist/types/admin.d.ts +40 -7
- package/dist/types/chat.d.ts +15 -16
- package/dist/types/common.d.ts +1 -1
- package/dist/types/group.d.ts +13 -16
- package/dist/types/index.js.map +1 -1
- package/dist/types/newsletter.d.ts +41 -12
- package/dist/types/session.d.ts +3 -3
- package/dist/types/user.d.ts +4 -3
- package/dist/types/webhook.d.ts +10 -4
- package/package.json +1 -1
package/dist/modules/chat.js
CHANGED
|
@@ -137,7 +137,8 @@ class ChatModule extends client.BaseClient {
|
|
|
137
137
|
/**
|
|
138
138
|
* Delete a message
|
|
139
139
|
*/
|
|
140
|
-
async deleteMessage(
|
|
140
|
+
async deleteMessage(messageId, options) {
|
|
141
|
+
const request = { Id: messageId };
|
|
141
142
|
return this.post("/chat/delete", request, options);
|
|
142
143
|
}
|
|
143
144
|
/**
|
|
@@ -153,19 +154,43 @@ class ChatModule extends client.BaseClient {
|
|
|
153
154
|
/**
|
|
154
155
|
* Send list message
|
|
155
156
|
*/
|
|
156
|
-
async sendList(
|
|
157
|
+
async sendList(phone, buttonText, description, topText, sections, footerText, id, options) {
|
|
158
|
+
const request = {
|
|
159
|
+
Phone: phone,
|
|
160
|
+
ButtonText: buttonText,
|
|
161
|
+
Desc: description,
|
|
162
|
+
TopText: topText,
|
|
163
|
+
Sections: sections,
|
|
164
|
+
FooterText: footerText,
|
|
165
|
+
Id: id
|
|
166
|
+
};
|
|
157
167
|
return this.post("/chat/send/list", request, options);
|
|
158
168
|
}
|
|
159
169
|
/**
|
|
160
170
|
* Send poll message
|
|
161
171
|
*/
|
|
162
|
-
async sendPoll(
|
|
163
|
-
|
|
172
|
+
async sendPoll(groupJID, header, options, id, requestOptions) {
|
|
173
|
+
const request = {
|
|
174
|
+
Group: groupJID,
|
|
175
|
+
Header: header,
|
|
176
|
+
Options: options,
|
|
177
|
+
Id: id
|
|
178
|
+
};
|
|
179
|
+
return this.post(
|
|
180
|
+
"/chat/send/poll",
|
|
181
|
+
request,
|
|
182
|
+
requestOptions
|
|
183
|
+
);
|
|
164
184
|
}
|
|
165
185
|
/**
|
|
166
186
|
* Edit a message
|
|
167
187
|
*/
|
|
168
|
-
async editMessage(
|
|
188
|
+
async editMessage(messageId, phone, newBody, options) {
|
|
189
|
+
const request = {
|
|
190
|
+
Id: messageId,
|
|
191
|
+
Phone: phone,
|
|
192
|
+
Body: newBody
|
|
193
|
+
};
|
|
169
194
|
return this.post("/chat/send/edit", request, options);
|
|
170
195
|
}
|
|
171
196
|
}
|
package/dist/modules/chat.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"chat.js","sources":["../../src/modules/chat.ts"],"sourcesContent":["import { BaseClient } from \"../client.js\";\nimport { RequestOptions } from \"../types/common.js\";\nimport {\n SendMessageResponse,\n SendTextRequest,\n SendTemplateRequest,\n SendAudioRequest,\n SendImageRequest,\n SendDocumentRequest,\n SendVideoRequest,\n SendStickerRequest,\n SendLocationRequest,\n SendContactRequest,\n ChatPresenceRequest,\n MarkReadRequest,\n ReactRequest,\n DownloadMediaRequest,\n DownloadMediaResponse,\n DeleteMessageRequest,\n DeleteMessageResponse,\n SendButtonsRequest,\n SendListRequest,\n SendPollRequest,\n EditMessageRequest,\n} from \"../types/chat.js\";\n\nexport class ChatModule extends BaseClient {\n /**\n * Send a text message\n */\n async sendText(\n request: SendTextRequest,\n options?: RequestOptions\n ): Promise<SendMessageResponse> {\n return this.post<SendMessageResponse>(\"/chat/send/text\", request, options);\n }\n\n /**\n * Send a template message with buttons\n */\n async sendTemplate(\n request: SendTemplateRequest,\n options?: RequestOptions\n ): Promise<SendMessageResponse> {\n return this.post<SendMessageResponse>(\n \"/chat/send/template\",\n request,\n options\n );\n }\n\n /**\n * Send an audio message\n */\n async sendAudio(\n request: SendAudioRequest,\n options?: RequestOptions\n ): Promise<SendMessageResponse> {\n return this.post<SendMessageResponse>(\"/chat/send/audio\", request, options);\n }\n\n /**\n * Send an image message\n */\n async sendImage(\n request: SendImageRequest,\n options?: RequestOptions\n ): Promise<SendMessageResponse> {\n return this.post<SendMessageResponse>(\"/chat/send/image\", request, options);\n }\n\n /**\n * Send a document message\n */\n async sendDocument(\n request: SendDocumentRequest,\n options?: RequestOptions\n ): Promise<SendMessageResponse> {\n return this.post<SendMessageResponse>(\n \"/chat/send/document\",\n request,\n options\n );\n }\n\n /**\n * Send a video message\n */\n async sendVideo(\n request: SendVideoRequest,\n options?: RequestOptions\n ): Promise<SendMessageResponse> {\n return this.post<SendMessageResponse>(\"/chat/send/video\", request, options);\n }\n\n /**\n * Send a sticker message\n */\n async sendSticker(\n request: SendStickerRequest,\n options?: RequestOptions\n ): Promise<SendMessageResponse> {\n return this.post<SendMessageResponse>(\n \"/chat/send/sticker\",\n request,\n options\n );\n }\n\n /**\n * Send a location message\n */\n async sendLocation(\n request: SendLocationRequest,\n options?: RequestOptions\n ): Promise<SendMessageResponse> {\n return this.post<SendMessageResponse>(\n \"/chat/send/location\",\n request,\n options\n );\n }\n\n /**\n * Send a contact message\n */\n async sendContact(\n request: SendContactRequest,\n options?: RequestOptions\n ): Promise<SendMessageResponse> {\n return this.post<SendMessageResponse>(\n \"/chat/send/contact\",\n request,\n options\n );\n }\n\n /**\n * Send chat presence indication (typing indicator)\n */\n async sendPresence(\n request: ChatPresenceRequest,\n options?: RequestOptions\n ): Promise<void> {\n await this.post<void>(\"/chat/presence\", request, options);\n }\n\n /**\n * Mark messages as read\n */\n async markRead(\n request: MarkReadRequest,\n options?: RequestOptions\n ): Promise<void> {\n await this.post<void>(\"/chat/markread\", request, options);\n }\n\n /**\n * React to a message\n */\n async react(\n request: ReactRequest,\n options?: RequestOptions\n ): Promise<SendMessageResponse> {\n return this.post<SendMessageResponse>(\"/chat/react\", request, options);\n }\n\n /**\n * Download an image from a message\n */\n async downloadImage(\n request: DownloadMediaRequest,\n options?: RequestOptions\n ): Promise<DownloadMediaResponse> {\n return this.post<DownloadMediaResponse>(\n \"/chat/downloadimage\",\n request,\n options\n );\n }\n\n /**\n * Download a video from a message\n */\n async downloadVideo(\n request: DownloadMediaRequest,\n options?: RequestOptions\n ): Promise<DownloadMediaResponse> {\n return this.post<DownloadMediaResponse>(\n \"/chat/downloadvideo\",\n request,\n options\n );\n }\n\n /**\n * Download an audio from a message\n */\n async downloadAudio(\n request: DownloadMediaRequest,\n options?: RequestOptions\n ): Promise<DownloadMediaResponse> {\n return this.post<DownloadMediaResponse>(\n \"/chat/downloadaudio\",\n request,\n options\n );\n }\n\n /**\n * Download a document from a message\n */\n async downloadDocument(\n request: DownloadMediaRequest,\n options?: RequestOptions\n ): Promise<DownloadMediaResponse> {\n return this.post<DownloadMediaResponse>(\n \"/chat/downloaddocument\",\n request,\n options\n );\n }\n\n /**\n * Delete a message\n */\n async deleteMessage(\n
|
|
1
|
+
{"version":3,"file":"chat.js","sources":["../../src/modules/chat.ts"],"sourcesContent":["import { BaseClient } from \"../client.js\";\nimport { RequestOptions } from \"../types/common.js\";\nimport {\n SendMessageResponse,\n SendTextRequest,\n SendTemplateRequest,\n SendAudioRequest,\n SendImageRequest,\n SendDocumentRequest,\n SendVideoRequest,\n SendStickerRequest,\n SendLocationRequest,\n SendContactRequest,\n ChatPresenceRequest,\n MarkReadRequest,\n ReactRequest,\n DownloadMediaRequest,\n DownloadMediaResponse,\n DeleteMessageRequest,\n DeleteMessageResponse,\n SendButtonsRequest,\n SendListRequest,\n SendPollRequest,\n EditMessageRequest,\n ListSection,\n} from \"../types/chat.js\";\n\nexport class ChatModule extends BaseClient {\n /**\n * Send a text message\n */\n async sendText(\n request: SendTextRequest,\n options?: RequestOptions\n ): Promise<SendMessageResponse> {\n return this.post<SendMessageResponse>(\"/chat/send/text\", request, options);\n }\n\n /**\n * Send a template message with buttons\n */\n async sendTemplate(\n request: SendTemplateRequest,\n options?: RequestOptions\n ): Promise<SendMessageResponse> {\n return this.post<SendMessageResponse>(\n \"/chat/send/template\",\n request,\n options\n );\n }\n\n /**\n * Send an audio message\n */\n async sendAudio(\n request: SendAudioRequest,\n options?: RequestOptions\n ): Promise<SendMessageResponse> {\n return this.post<SendMessageResponse>(\"/chat/send/audio\", request, options);\n }\n\n /**\n * Send an image message\n */\n async sendImage(\n request: SendImageRequest,\n options?: RequestOptions\n ): Promise<SendMessageResponse> {\n return this.post<SendMessageResponse>(\"/chat/send/image\", request, options);\n }\n\n /**\n * Send a document message\n */\n async sendDocument(\n request: SendDocumentRequest,\n options?: RequestOptions\n ): Promise<SendMessageResponse> {\n return this.post<SendMessageResponse>(\n \"/chat/send/document\",\n request,\n options\n );\n }\n\n /**\n * Send a video message\n */\n async sendVideo(\n request: SendVideoRequest,\n options?: RequestOptions\n ): Promise<SendMessageResponse> {\n return this.post<SendMessageResponse>(\"/chat/send/video\", request, options);\n }\n\n /**\n * Send a sticker message\n */\n async sendSticker(\n request: SendStickerRequest,\n options?: RequestOptions\n ): Promise<SendMessageResponse> {\n return this.post<SendMessageResponse>(\n \"/chat/send/sticker\",\n request,\n options\n );\n }\n\n /**\n * Send a location message\n */\n async sendLocation(\n request: SendLocationRequest,\n options?: RequestOptions\n ): Promise<SendMessageResponse> {\n return this.post<SendMessageResponse>(\n \"/chat/send/location\",\n request,\n options\n );\n }\n\n /**\n * Send a contact message\n */\n async sendContact(\n request: SendContactRequest,\n options?: RequestOptions\n ): Promise<SendMessageResponse> {\n return this.post<SendMessageResponse>(\n \"/chat/send/contact\",\n request,\n options\n );\n }\n\n /**\n * Send chat presence indication (typing indicator)\n */\n async sendPresence(\n request: ChatPresenceRequest,\n options?: RequestOptions\n ): Promise<void> {\n await this.post<void>(\"/chat/presence\", request, options);\n }\n\n /**\n * Mark messages as read\n */\n async markRead(\n request: MarkReadRequest,\n options?: RequestOptions\n ): Promise<void> {\n await this.post<void>(\"/chat/markread\", request, options);\n }\n\n /**\n * React to a message\n */\n async react(\n request: ReactRequest,\n options?: RequestOptions\n ): Promise<SendMessageResponse> {\n return this.post<SendMessageResponse>(\"/chat/react\", request, options);\n }\n\n /**\n * Download an image from a message\n */\n async downloadImage(\n request: DownloadMediaRequest,\n options?: RequestOptions\n ): Promise<DownloadMediaResponse> {\n return this.post<DownloadMediaResponse>(\n \"/chat/downloadimage\",\n request,\n options\n );\n }\n\n /**\n * Download a video from a message\n */\n async downloadVideo(\n request: DownloadMediaRequest,\n options?: RequestOptions\n ): Promise<DownloadMediaResponse> {\n return this.post<DownloadMediaResponse>(\n \"/chat/downloadvideo\",\n request,\n options\n );\n }\n\n /**\n * Download an audio from a message\n */\n async downloadAudio(\n request: DownloadMediaRequest,\n options?: RequestOptions\n ): Promise<DownloadMediaResponse> {\n return this.post<DownloadMediaResponse>(\n \"/chat/downloadaudio\",\n request,\n options\n );\n }\n\n /**\n * Download a document from a message\n */\n async downloadDocument(\n request: DownloadMediaRequest,\n options?: RequestOptions\n ): Promise<DownloadMediaResponse> {\n return this.post<DownloadMediaResponse>(\n \"/chat/downloaddocument\",\n request,\n options\n );\n }\n\n /**\n * Delete a message\n */\n async deleteMessage(\n messageId: string,\n options?: RequestOptions\n ): Promise<DeleteMessageResponse> {\n const request: DeleteMessageRequest = { Id: messageId };\n return this.post<DeleteMessageResponse>(\"/chat/delete\", request, options);\n }\n\n /**\n * Send interactive buttons message\n */\n async sendButtons(\n request: SendButtonsRequest,\n options?: RequestOptions\n ): Promise<SendMessageResponse> {\n return this.post<SendMessageResponse>(\n \"/chat/send/buttons\",\n request,\n options\n );\n }\n\n /**\n * Send list message\n */\n async sendList(\n phone: string,\n buttonText: string,\n description: string,\n topText: string,\n sections?: ListSection[],\n footerText?: string,\n id?: string,\n options?: RequestOptions\n ): Promise<SendMessageResponse> {\n const request: SendListRequest = {\n Phone: phone,\n ButtonText: buttonText,\n Desc: description,\n TopText: topText,\n Sections: sections,\n FooterText: footerText,\n Id: id,\n };\n return this.post<SendMessageResponse>(\"/chat/send/list\", request, options);\n }\n\n /**\n * Send poll message\n */\n async sendPoll(\n groupJID: string,\n header: string,\n options: string[],\n id?: string,\n requestOptions?: RequestOptions\n ): Promise<SendMessageResponse> {\n const request: SendPollRequest = {\n Group: groupJID,\n Header: header,\n Options: options,\n Id: id,\n };\n return this.post<SendMessageResponse>(\n \"/chat/send/poll\",\n request,\n requestOptions\n );\n }\n\n /**\n * Edit a message\n */\n async editMessage(\n messageId: string,\n phone: string,\n newBody: string,\n options?: RequestOptions\n ): Promise<SendMessageResponse> {\n const request: EditMessageRequest = {\n Id: messageId,\n Phone: phone,\n Body: newBody,\n };\n return this.post<SendMessageResponse>(\"/chat/send/edit\", request, options);\n }\n}\n"],"names":["BaseClient"],"mappings":";;;AA2BO,MAAM,mBAAmBA,OAAAA,WAAW;AAAA;AAAA;AAAA;AAAA,EAIzC,MAAM,SACJ,SACA,SAC8B;AAC9B,WAAO,KAAK,KAA0B,mBAAmB,SAAS,OAAO;AAAA,EAC3E;AAAA;AAAA;AAAA;AAAA,EAKA,MAAM,aACJ,SACA,SAC8B;AAC9B,WAAO,KAAK;AAAA,MACV;AAAA,MACA;AAAA,MACA;AAAA,IAAA;AAAA,EAEJ;AAAA;AAAA;AAAA;AAAA,EAKA,MAAM,UACJ,SACA,SAC8B;AAC9B,WAAO,KAAK,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;AAAA;AAAA;AAAA;AAAA,EAKA,MAAM,YACJ,WACA,OACA,SACA,SAC8B;AAC9B,UAAM,UAA8B;AAAA,MAClC,IAAI;AAAA,MACJ,OAAO;AAAA,MACP,MAAM;AAAA,IAAA;AAER,WAAO,KAAK,KAA0B,mBAAmB,SAAS,OAAO;AAAA,EAC3E;AACF;;"}
|
package/dist/modules/group.d.ts
CHANGED
|
@@ -9,7 +9,7 @@ export declare class GroupModule extends BaseClient {
|
|
|
9
9
|
/**
|
|
10
10
|
* Get group invite link
|
|
11
11
|
*/
|
|
12
|
-
getInviteLink(groupJID: string, options?: RequestOptions): Promise<GroupInviteLinkResponse>;
|
|
12
|
+
getInviteLink(groupJID: string, reset?: boolean, options?: RequestOptions): Promise<GroupInviteLinkResponse>;
|
|
13
13
|
/**
|
|
14
14
|
* Get group information
|
|
15
15
|
*/
|
|
@@ -53,11 +53,11 @@ export declare class GroupModule extends BaseClient {
|
|
|
53
53
|
/**
|
|
54
54
|
* Join a group using invite link
|
|
55
55
|
*/
|
|
56
|
-
join(
|
|
56
|
+
join(inviteCode: string, options?: RequestOptions): Promise<GroupJoinResponse>;
|
|
57
57
|
/**
|
|
58
58
|
* Get group invite information
|
|
59
59
|
*/
|
|
60
|
-
getInviteInfo(
|
|
60
|
+
getInviteInfo(inviteCode: string, options?: RequestOptions): Promise<GroupInviteInfoResponse>;
|
|
61
61
|
/**
|
|
62
62
|
* Update group participants (add/remove/promote/demote)
|
|
63
63
|
*/
|
package/dist/modules/group.js
CHANGED
|
@@ -11,11 +11,10 @@ class GroupModule extends client.BaseClient {
|
|
|
11
11
|
/**
|
|
12
12
|
* Get group invite link
|
|
13
13
|
*/
|
|
14
|
-
async getInviteLink(groupJID, options) {
|
|
15
|
-
const
|
|
16
|
-
return this.
|
|
17
|
-
|
|
18
|
-
request,
|
|
14
|
+
async getInviteLink(groupJID, reset = false, options) {
|
|
15
|
+
const params = `groupJID=${encodeURIComponent(groupJID)}&reset=${reset}`;
|
|
16
|
+
return this.get(
|
|
17
|
+
`/group/invitelink?${params}`,
|
|
19
18
|
options
|
|
20
19
|
);
|
|
21
20
|
}
|
|
@@ -23,8 +22,8 @@ class GroupModule extends client.BaseClient {
|
|
|
23
22
|
* Get group information
|
|
24
23
|
*/
|
|
25
24
|
async getInfo(groupJID, options) {
|
|
26
|
-
const
|
|
27
|
-
return this.
|
|
25
|
+
const params = `groupJID=${encodeURIComponent(groupJID)}`;
|
|
26
|
+
return this.get(`/group/info?${params}`, options);
|
|
28
27
|
}
|
|
29
28
|
/**
|
|
30
29
|
* Change group photo (JPEG only)
|
|
@@ -44,21 +43,27 @@ class GroupModule extends client.BaseClient {
|
|
|
44
43
|
* Create a new group
|
|
45
44
|
*/
|
|
46
45
|
async create(name, participants, options) {
|
|
47
|
-
const request = {
|
|
46
|
+
const request = {
|
|
47
|
+
Name: name,
|
|
48
|
+
Participants: participants
|
|
49
|
+
};
|
|
48
50
|
return this.post("/group/create", request, options);
|
|
49
51
|
}
|
|
50
52
|
/**
|
|
51
53
|
* Set group locked status
|
|
52
54
|
*/
|
|
53
55
|
async setLocked(groupJID, locked, options) {
|
|
54
|
-
const request = {
|
|
56
|
+
const request = { GroupJID: groupJID, Locked: locked };
|
|
55
57
|
return this.post("/group/locked", request, options);
|
|
56
58
|
}
|
|
57
59
|
/**
|
|
58
60
|
* Set disappearing messages timer
|
|
59
61
|
*/
|
|
60
62
|
async setEphemeral(groupJID, duration, options) {
|
|
61
|
-
const request = {
|
|
63
|
+
const request = {
|
|
64
|
+
GroupJID: groupJID,
|
|
65
|
+
Duration: duration
|
|
66
|
+
};
|
|
62
67
|
return this.post(
|
|
63
68
|
"/group/ephemeral",
|
|
64
69
|
request,
|
|
@@ -69,7 +74,7 @@ class GroupModule extends client.BaseClient {
|
|
|
69
74
|
* Remove group photo
|
|
70
75
|
*/
|
|
71
76
|
async removePhoto(groupJID, options) {
|
|
72
|
-
const request = {
|
|
77
|
+
const request = { GroupJID: groupJID };
|
|
73
78
|
return this.post(
|
|
74
79
|
"/group/photo/remove",
|
|
75
80
|
request,
|
|
@@ -107,15 +112,15 @@ class GroupModule extends client.BaseClient {
|
|
|
107
112
|
/**
|
|
108
113
|
* Join a group using invite link
|
|
109
114
|
*/
|
|
110
|
-
async join(
|
|
111
|
-
const request = {
|
|
115
|
+
async join(inviteCode, options) {
|
|
116
|
+
const request = { Code: inviteCode };
|
|
112
117
|
return this.post("/group/join", request, options);
|
|
113
118
|
}
|
|
114
119
|
/**
|
|
115
120
|
* Get group invite information
|
|
116
121
|
*/
|
|
117
|
-
async getInviteInfo(
|
|
118
|
-
const request = {
|
|
122
|
+
async getInviteInfo(inviteCode, options) {
|
|
123
|
+
const request = { Code: inviteCode };
|
|
119
124
|
return this.post(
|
|
120
125
|
"/group/inviteinfo",
|
|
121
126
|
request,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"group.js","sources":["../../src/modules/group.ts"],"sourcesContent":["import { BaseClient } from \"../client.js\";\nimport { RequestOptions } from \"../types/common.js\";\nimport {\n GroupListResponse,\n
|
|
1
|
+
{"version":3,"file":"group.js","sources":["../../src/modules/group.ts"],"sourcesContent":["import { BaseClient } from \"../client.js\";\nimport { RequestOptions } from \"../types/common.js\";\nimport {\n GroupListResponse,\n GroupInviteLinkResponse,\n GroupInfo,\n GroupPhotoRequest,\n GroupPhotoResponse,\n GroupNameRequest,\n GroupNameResponse,\n GroupCreateRequest,\n GroupCreateResponse,\n GroupLockedRequest,\n GroupLockedResponse,\n GroupEphemeralRequest,\n GroupEphemeralResponse,\n GroupPhotoRemoveRequest,\n GroupPhotoRemoveResponse,\n GroupLeaveRequest,\n GroupLeaveResponse,\n GroupTopicRequest,\n GroupTopicResponse,\n GroupAnnounceRequest,\n GroupAnnounceResponse,\n GroupJoinRequest,\n GroupJoinResponse,\n GroupInviteInfoRequest,\n GroupInviteInfoResponse,\n GroupUpdateParticipantsRequest,\n GroupUpdateParticipantsResponse,\n} from \"../types/group.js\";\n\nexport class GroupModule extends BaseClient {\n /**\n * List all subscribed groups\n */\n async list(options?: RequestOptions): Promise<GroupListResponse> {\n return this.get<GroupListResponse>(\"/group/list\", options);\n }\n\n /**\n * Get group invite link\n */\n async getInviteLink(\n groupJID: string,\n reset: boolean = false,\n options?: RequestOptions\n ): Promise<GroupInviteLinkResponse> {\n const params = `groupJID=${encodeURIComponent(groupJID)}&reset=${reset}`;\n return this.get<GroupInviteLinkResponse>(\n `/group/invitelink?${params}`,\n options\n );\n }\n\n /**\n * Get group information\n */\n async getInfo(\n groupJID: string,\n options?: RequestOptions\n ): Promise<GroupInfo> {\n const params = `groupJID=${encodeURIComponent(groupJID)}`;\n return this.get<GroupInfo>(`/group/info?${params}`, options);\n }\n\n /**\n * Change group photo (JPEG only)\n */\n async setPhoto(\n groupJID: string,\n image: string,\n options?: RequestOptions\n ): Promise<GroupPhotoResponse> {\n const request: GroupPhotoRequest = { GroupJID: groupJID, Image: image };\n return this.post<GroupPhotoResponse>(\"/group/photo\", request, options);\n }\n\n /**\n * Change group name\n */\n async setName(\n groupJID: string,\n name: string,\n options?: RequestOptions\n ): Promise<GroupNameResponse> {\n const request: GroupNameRequest = { GroupJID: groupJID, Name: name };\n return this.post<GroupNameResponse>(\"/group/name\", request, options);\n }\n\n /**\n * Create a new group\n */\n async create(\n name: string,\n participants: string[],\n options?: RequestOptions\n ): Promise<GroupCreateResponse> {\n const request: GroupCreateRequest = {\n Name: name,\n Participants: participants,\n };\n return this.post<GroupCreateResponse>(\"/group/create\", request, options);\n }\n\n /**\n * Set group locked status\n */\n async setLocked(\n groupJID: string,\n locked: boolean,\n options?: RequestOptions\n ): Promise<GroupLockedResponse> {\n const request: GroupLockedRequest = { GroupJID: groupJID, Locked: locked };\n return this.post<GroupLockedResponse>(\"/group/locked\", request, options);\n }\n\n /**\n * Set disappearing messages timer\n */\n async setEphemeral(\n groupJID: string,\n duration: \"24h\" | \"7d\" | \"90d\" | \"off\",\n options?: RequestOptions\n ): Promise<GroupEphemeralResponse> {\n const request: GroupEphemeralRequest = {\n GroupJID: groupJID,\n Duration: duration,\n };\n return this.post<GroupEphemeralResponse>(\n \"/group/ephemeral\",\n request,\n options\n );\n }\n\n /**\n * Remove group photo\n */\n async removePhoto(\n groupJID: string,\n options?: RequestOptions\n ): Promise<GroupPhotoRemoveResponse> {\n const request: GroupPhotoRemoveRequest = { GroupJID: groupJID };\n return this.post<GroupPhotoRemoveResponse>(\n \"/group/photo/remove\",\n request,\n options\n );\n }\n\n /**\n * Leave a group\n */\n async leave(\n groupJID: string,\n options?: RequestOptions\n ): Promise<GroupLeaveResponse> {\n const request: GroupLeaveRequest = { GroupJID: groupJID };\n return this.post<GroupLeaveResponse>(\"/group/leave\", request, options);\n }\n\n /**\n * Set group topic/description\n */\n async setTopic(\n groupJID: string,\n topic: string,\n options?: RequestOptions\n ): Promise<GroupTopicResponse> {\n const request: GroupTopicRequest = { GroupJID: groupJID, Topic: topic };\n return this.post<GroupTopicResponse>(\"/group/topic\", request, options);\n }\n\n /**\n * Set group announcement setting (only admins can send messages)\n */\n async setAnnounce(\n groupJID: string,\n announce: boolean,\n options?: RequestOptions\n ): Promise<GroupAnnounceResponse> {\n const request: GroupAnnounceRequest = {\n GroupJID: groupJID,\n Announce: announce,\n };\n return this.post<GroupAnnounceResponse>(\n \"/group/announce\",\n request,\n options\n );\n }\n\n /**\n * Join a group using invite link\n */\n async join(\n inviteCode: string,\n options?: RequestOptions\n ): Promise<GroupJoinResponse> {\n const request: GroupJoinRequest = { Code: inviteCode };\n return this.post<GroupJoinResponse>(\"/group/join\", request, options);\n }\n\n /**\n * Get group invite information\n */\n async getInviteInfo(\n inviteCode: string,\n options?: RequestOptions\n ): Promise<GroupInviteInfoResponse> {\n const request: GroupInviteInfoRequest = { Code: inviteCode };\n return this.post<GroupInviteInfoResponse>(\n \"/group/inviteinfo\",\n request,\n options\n );\n }\n\n /**\n * Update group participants (add/remove/promote/demote)\n */\n async updateParticipants(\n groupJID: string,\n action: \"add\" | \"remove\" | \"promote\" | \"demote\",\n participants: string[],\n options?: RequestOptions\n ): Promise<GroupUpdateParticipantsResponse> {\n const request: GroupUpdateParticipantsRequest = {\n GroupJID: groupJID,\n Action: action,\n Participants: participants,\n };\n return this.post<GroupUpdateParticipantsResponse>(\n \"/group/updateparticipants\",\n request,\n options\n );\n }\n}\n"],"names":["BaseClient"],"mappings":";;;AAgCO,MAAM,oBAAoBA,OAAAA,WAAW;AAAA;AAAA;AAAA;AAAA,EAI1C,MAAM,KAAK,SAAsD;AAC/D,WAAO,KAAK,IAAuB,eAAe,OAAO;AAAA,EAC3D;AAAA;AAAA;AAAA;AAAA,EAKA,MAAM,cACJ,UACA,QAAiB,OACjB,SACkC;AAClC,UAAM,SAAS,YAAY,mBAAmB,QAAQ,CAAC,UAAU,KAAK;AACtE,WAAO,KAAK;AAAA,MACV,qBAAqB,MAAM;AAAA,MAC3B;AAAA,IAAA;AAAA,EAEJ;AAAA;AAAA;AAAA;AAAA,EAKA,MAAM,QACJ,UACA,SACoB;AACpB,UAAM,SAAS,YAAY,mBAAmB,QAAQ,CAAC;AACvD,WAAO,KAAK,IAAe,eAAe,MAAM,IAAI,OAAO;AAAA,EAC7D;AAAA;AAAA;AAAA;AAAA,EAKA,MAAM,SACJ,UACA,OACA,SAC6B;AAC7B,UAAM,UAA6B,EAAE,UAAU,UAAU,OAAO,MAAA;AAChE,WAAO,KAAK,KAAyB,gBAAgB,SAAS,OAAO;AAAA,EACvE;AAAA;AAAA;AAAA;AAAA,EAKA,MAAM,QACJ,UACA,MACA,SAC4B;AAC5B,UAAM,UAA4B,EAAE,UAAU,UAAU,MAAM,KAAA;AAC9D,WAAO,KAAK,KAAwB,eAAe,SAAS,OAAO;AAAA,EACrE;AAAA;AAAA;AAAA;AAAA,EAKA,MAAM,OACJ,MACA,cACA,SAC8B;AAC9B,UAAM,UAA8B;AAAA,MAClC,MAAM;AAAA,MACN,cAAc;AAAA,IAAA;AAEhB,WAAO,KAAK,KAA0B,iBAAiB,SAAS,OA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AAAA;AAAA,EAKA,MAAM,cACJ,YACA,SACkC;AAClC,UAAM,UAAkC,EAAE,MAAM,WAAA;AAChD,WAAO,KAAK;AAAA,MACV;AAAA,MACA;AAAA,MACA;AAAA,IAAA;AAAA,EAEJ;AAAA;AAAA;AAAA;AAAA,EAKA,MAAM,mBACJ,UACA,QACA,cACA,SAC0C;AAC1C,UAAM,UAA0C;AAAA,MAC9C,UAAU;AAAA,MACV,QAAQ;AAAA,MACR,cAAc;AAAA,IAAA;AAEhB,WAAO,KAAK;AAAA,MACV;AAAA,MACA;AAAA,MACA;AAAA,IAAA;AAAA,EAEJ;AACF;;"}
|
|
@@ -43,7 +43,7 @@ export declare class SessionModule extends BaseClient {
|
|
|
43
43
|
/**
|
|
44
44
|
* Pair phone using verification code
|
|
45
45
|
*/
|
|
46
|
-
pairPhone(phone: string,
|
|
46
|
+
pairPhone(phone: string, options?: RequestOptions): Promise<PairPhoneResponse>;
|
|
47
47
|
/**
|
|
48
48
|
* Request history sync from WhatsApp servers
|
|
49
49
|
*/
|
|
@@ -51,5 +51,5 @@ export declare class SessionModule extends BaseClient {
|
|
|
51
51
|
/**
|
|
52
52
|
* Set proxy configuration
|
|
53
53
|
*/
|
|
54
|
-
setProxy(
|
|
54
|
+
setProxy(proxyURL: string, enable?: boolean, options?: RequestOptions): Promise<ProxyResponse>;
|
|
55
55
|
}
|
package/dist/modules/session.js
CHANGED
|
@@ -63,8 +63,8 @@ class SessionModule extends client.BaseClient {
|
|
|
63
63
|
/**
|
|
64
64
|
* Pair phone using verification code
|
|
65
65
|
*/
|
|
66
|
-
async pairPhone(phone,
|
|
67
|
-
const request = { Phone: phone
|
|
66
|
+
async pairPhone(phone, options) {
|
|
67
|
+
const request = { Phone: phone };
|
|
68
68
|
return this.post("/session/pairphone", request, options);
|
|
69
69
|
}
|
|
70
70
|
/**
|
|
@@ -76,8 +76,8 @@ class SessionModule extends client.BaseClient {
|
|
|
76
76
|
/**
|
|
77
77
|
* Set proxy configuration
|
|
78
78
|
*/
|
|
79
|
-
async setProxy(
|
|
80
|
-
const request = {
|
|
79
|
+
async setProxy(proxyURL, enable = true, options) {
|
|
80
|
+
const request = { proxy_url: proxyURL, enable };
|
|
81
81
|
return this.post("/session/proxy", request, options);
|
|
82
82
|
}
|
|
83
83
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"session.js","sources":["../../src/modules/session.ts"],"sourcesContent":["import { BaseClient } from \"../client.js\";\nimport {\n ConnectRequest,\n ConnectResponse,\n DisconnectResponse,\n LogoutResponse,\n StatusResponse,\n QRCodeResponse,\n S3ConfigResponse,\n S3TestResponse,\n PairPhoneRequest,\n PairPhoneResponse,\n HistoryResponse,\n ProxyRequest,\n ProxyResponse,\n} from \"../types/session.js\";\nimport { S3Config, RequestOptions } from \"../types/common.js\";\n\nexport class SessionModule extends BaseClient {\n /**\n * Connect to WhatsApp servers\n */\n async connect(\n request: ConnectRequest,\n options?: RequestOptions\n ): Promise<ConnectResponse> {\n return this.post<ConnectResponse>(\"/session/connect\", request, options);\n }\n\n /**\n * Disconnect from WhatsApp servers\n */\n async disconnect(options?: RequestOptions): Promise<DisconnectResponse> {\n return this.post<DisconnectResponse>(\n \"/session/disconnect\",\n undefined,\n options\n );\n }\n\n /**\n * Logout and finish the session\n */\n async logout(options?: RequestOptions): Promise<LogoutResponse> {\n return this.post<LogoutResponse>(\"/session/logout\", undefined, options);\n }\n\n /**\n * Get session status\n */\n async getStatus(options?: RequestOptions): Promise<StatusResponse> {\n return this.get<StatusResponse>(\"/session/status\", options);\n }\n\n /**\n * Get QR code for scanning\n */\n async getQRCode(options?: RequestOptions): Promise<QRCodeResponse> {\n return this.get<QRCodeResponse>(\"/session/qr\", options);\n }\n\n /**\n * Configure S3 storage\n */\n async configureS3(\n config: S3Config,\n options?: RequestOptions\n ): Promise<S3ConfigResponse> {\n return this.post<S3ConfigResponse>(\"/session/s3/config\", config, options);\n }\n\n /**\n * Get S3 configuration\n */\n async getS3Config(options?: RequestOptions): Promise<S3ConfigResponse> {\n return this.get<S3ConfigResponse>(\"/session/s3/config\", options);\n }\n\n /**\n * Test S3 connection\n */\n async testS3(options?: RequestOptions): Promise<S3TestResponse> {\n return this.post<S3TestResponse>(\"/session/s3/test\", undefined, options);\n }\n\n /**\n * Delete S3 configuration\n */\n async deleteS3Config(options?: RequestOptions): Promise<{ Details: string }> {\n return this.delete<{ Details: string }>(\"/session/s3/config\", options);\n }\n\n /**\n * Pair phone using verification code\n */\n async pairPhone(\n phone: string,\n
|
|
1
|
+
{"version":3,"file":"session.js","sources":["../../src/modules/session.ts"],"sourcesContent":["import { BaseClient } from \"../client.js\";\nimport {\n ConnectRequest,\n ConnectResponse,\n DisconnectResponse,\n LogoutResponse,\n StatusResponse,\n QRCodeResponse,\n S3ConfigResponse,\n S3TestResponse,\n PairPhoneRequest,\n PairPhoneResponse,\n HistoryResponse,\n ProxyRequest,\n ProxyResponse,\n} from \"../types/session.js\";\nimport { S3Config, RequestOptions } from \"../types/common.js\";\n\nexport class SessionModule extends BaseClient {\n /**\n * Connect to WhatsApp servers\n */\n async connect(\n request: ConnectRequest,\n options?: RequestOptions\n ): Promise<ConnectResponse> {\n return this.post<ConnectResponse>(\"/session/connect\", request, options);\n }\n\n /**\n * Disconnect from WhatsApp servers\n */\n async disconnect(options?: RequestOptions): Promise<DisconnectResponse> {\n return this.post<DisconnectResponse>(\n \"/session/disconnect\",\n undefined,\n options\n );\n }\n\n /**\n * Logout and finish the session\n */\n async logout(options?: RequestOptions): Promise<LogoutResponse> {\n return this.post<LogoutResponse>(\"/session/logout\", undefined, options);\n }\n\n /**\n * Get session status\n */\n async getStatus(options?: RequestOptions): Promise<StatusResponse> {\n return this.get<StatusResponse>(\"/session/status\", options);\n }\n\n /**\n * Get QR code for scanning\n */\n async getQRCode(options?: RequestOptions): Promise<QRCodeResponse> {\n return this.get<QRCodeResponse>(\"/session/qr\", options);\n }\n\n /**\n * Configure S3 storage\n */\n async configureS3(\n config: S3Config,\n options?: RequestOptions\n ): Promise<S3ConfigResponse> {\n return this.post<S3ConfigResponse>(\"/session/s3/config\", config, options);\n }\n\n /**\n * Get S3 configuration\n */\n async getS3Config(options?: RequestOptions): Promise<S3ConfigResponse> {\n return this.get<S3ConfigResponse>(\"/session/s3/config\", options);\n }\n\n /**\n * Test S3 connection\n */\n async testS3(options?: RequestOptions): Promise<S3TestResponse> {\n return this.post<S3TestResponse>(\"/session/s3/test\", undefined, options);\n }\n\n /**\n * Delete S3 configuration\n */\n async deleteS3Config(options?: RequestOptions): Promise<{ Details: string }> {\n return this.delete<{ Details: string }>(\"/session/s3/config\", options);\n }\n\n /**\n * Pair phone using verification code\n */\n async pairPhone(\n phone: string,\n options?: RequestOptions\n ): Promise<PairPhoneResponse> {\n const request: PairPhoneRequest = { Phone: phone };\n return this.post<PairPhoneResponse>(\"/session/pairphone\", request, options);\n }\n\n /**\n * Request history sync from WhatsApp servers\n */\n async requestHistory(options?: RequestOptions): Promise<HistoryResponse> {\n return this.get<HistoryResponse>(\"/session/history\", options);\n }\n\n /**\n * Set proxy configuration\n */\n async setProxy(\n proxyURL: string,\n enable: boolean = true,\n options?: RequestOptions\n ): Promise<ProxyResponse> {\n const request: ProxyRequest = { proxy_url: proxyURL, enable: enable };\n return this.post<ProxyResponse>(\"/session/proxy\", request, options);\n }\n}\n"],"names":["BaseClient"],"mappings":";;;AAkBO,MAAM,sBAAsBA,OAAAA,WAAW;AAAA;AAAA;AAAA;AAAA,EAI5C,MAAM,QACJ,SACA,SAC0B;AAC1B,WAAO,KAAK,KAAsB,oBAAoB,SAAS,OAAO;AAAA,EACxE;AAAA;AAAA;AAAA;AAAA,EAKA,MAAM,WAAW,SAAuD;AACtE,WAAO,KAAK;AAAA,MACV;AAAA,MACA;AAAA,MACA;AAAA,IAAA;AAAA,EAEJ;AAAA;AAAA;AAAA;AAAA,EAKA,MAAM,OAAO,SAAmD;AAC9D,WAAO,KAAK,KAAqB,mBAAmB,QAAW,OAAO;AAAA,EACxE;AAAA;AAAA;AAAA;AAAA,EAKA,MAAM,UAAU,SAAmD;AACjE,WAAO,KAAK,IAAoB,mBAAmB,OAAO;AAAA,EAC5D;AAAA;AAAA;AAAA;AAAA,EAKA,MAAM,UAAU,SAAmD;AACjE,WAAO,KAAK,IAAoB,eAAe,OAAO;AAAA,EACxD;AAAA;AAAA;AAAA;AAAA,EAKA,MAAM,YACJ,QACA,SAC2B;AAC3B,WAAO,KAAK,KAAuB,sBAAsB,QAAQ,OAAO;AAAA,EAC1E;AAAA;AAAA;AAAA;AAAA,EAKA,MAAM,YAAY,SAAqD;AACrE,WAAO,KAAK,IAAsB,sBAAsB,OAAO;AAAA,EACjE;AAAA;AAAA;AAAA;AAAA,EAKA,MAAM,OAAO,SAAmD;AAC9D,WAAO,KAAK,KAAqB,oBAAoB,QAAW,OAAO;AAAA,EACzE;AAAA;AAAA;AAAA;AAAA,EAKA,MAAM,eAAe,SAAwD;AAC3E,WAAO,KAAK,OAA4B,sBAAsB,OAAO;AAAA,EACvE;AAAA;AAAA;AAAA;AAAA,EAKA,MAAM,UACJ,OACA,SAC4B;AAC5B,UAAM,UAA4B,EAAE,OAAO,MAAA;AAC3C,WAAO,KAAK,KAAwB,sBAAsB,SAAS,OAAO;AAAA,EAC5E;AAAA;AAAA;AAAA;AAAA,EAKA,MAAM,eAAe,SAAoD;AACvE,WAAO,KAAK,IAAqB,oBAAoB,OAAO;AAAA,EAC9D;AAAA;AAAA;AAAA;AAAA,EAKA,MAAM,SACJ,UACA,SAAkB,MAClB,SACwB;AACxB,UAAM,UAAwB,EAAE,WAAW,UAAU,OAAA;AACrD,WAAO,KAAK,KAAoB,kBAAkB,SAAS,OAAO;AAAA,EACpE;AACF;;"}
|
package/dist/modules/user.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { BaseClient } from '../client.js';
|
|
2
2
|
import { RequestOptions } from '../types/common.js';
|
|
3
|
-
import { UserInfoResponse, UserCheckResponse, UserAvatarResponse, ContactsResponse,
|
|
3
|
+
import { UserInfoResponse, UserCheckResponse, UserAvatarResponse, ContactsResponse, UserPresenceResponse } from '../types/user.js';
|
|
4
4
|
export declare class UserModule extends BaseClient {
|
|
5
5
|
/**
|
|
6
6
|
* Get user details for specified phone numbers
|
|
@@ -21,5 +21,5 @@ export declare class UserModule extends BaseClient {
|
|
|
21
21
|
/**
|
|
22
22
|
* Send user presence (available/unavailable status)
|
|
23
23
|
*/
|
|
24
|
-
sendPresence(
|
|
24
|
+
sendPresence(presenceType: "available" | "unavailable", options?: RequestOptions): Promise<UserPresenceResponse>;
|
|
25
25
|
}
|
package/dist/modules/user.js
CHANGED
|
@@ -32,8 +32,9 @@ class UserModule extends client.BaseClient {
|
|
|
32
32
|
/**
|
|
33
33
|
* Send user presence (available/unavailable status)
|
|
34
34
|
*/
|
|
35
|
-
async sendPresence(
|
|
36
|
-
|
|
35
|
+
async sendPresence(presenceType, options) {
|
|
36
|
+
const request = { type: presenceType };
|
|
37
|
+
return this.post("/user/presence", request, options);
|
|
37
38
|
}
|
|
38
39
|
}
|
|
39
40
|
exports.UserModule = UserModule;
|
package/dist/modules/user.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"user.js","sources":["../../src/modules/user.ts"],"sourcesContent":["import { BaseClient } from \"../client.js\";\nimport { RequestOptions } from \"../types/common.js\";\nimport {\n UserInfoRequest,\n UserInfoResponse,\n UserCheckRequest,\n UserCheckResponse,\n UserAvatarRequest,\n UserAvatarResponse,\n ContactsResponse,\n UserPresenceRequest,\n} from \"../types/user.js\";\n\nexport class UserModule extends BaseClient {\n /**\n * Get user details for specified phone numbers\n */\n async getInfo(\n phones: string[],\n options?: RequestOptions\n ): Promise<UserInfoResponse> {\n const request: UserInfoRequest = { Phone: phones };\n return this.post<UserInfoResponse>(\"/user/info\", request, options);\n }\n\n /**\n * Check if phone numbers are registered WhatsApp users\n */\n async check(\n phones: string[],\n options?: RequestOptions\n ): Promise<UserCheckResponse> {\n const request: UserCheckRequest = { Phone: phones };\n return this.post<UserCheckResponse>(\"/user/check\", request, options);\n }\n\n /**\n * Get user avatar/profile picture\n */\n async getAvatar(\n phone: string,\n preview: boolean = true,\n options?: RequestOptions\n ): Promise<UserAvatarResponse> {\n const request: UserAvatarRequest = { Phone: phone, Preview: preview };\n return this.post<UserAvatarResponse>(\"/user/avatar\", request, options);\n }\n\n /**\n * Get all contacts\n */\n async getContacts(options?: RequestOptions): Promise<ContactsResponse> {\n return this.get<ContactsResponse>(\"/user/contacts\", options);\n }\n\n /**\n * Send user presence (available/unavailable status)\n */\n async sendPresence(\n
|
|
1
|
+
{"version":3,"file":"user.js","sources":["../../src/modules/user.ts"],"sourcesContent":["import { BaseClient } from \"../client.js\";\nimport { RequestOptions } from \"../types/common.js\";\nimport {\n UserInfoRequest,\n UserInfoResponse,\n UserCheckRequest,\n UserCheckResponse,\n UserAvatarRequest,\n UserAvatarResponse,\n ContactsResponse,\n UserPresenceRequest,\n UserPresenceResponse,\n} from \"../types/user.js\";\n\nexport class UserModule extends BaseClient {\n /**\n * Get user details for specified phone numbers\n */\n async getInfo(\n phones: string[],\n options?: RequestOptions\n ): Promise<UserInfoResponse> {\n const request: UserInfoRequest = { Phone: phones };\n return this.post<UserInfoResponse>(\"/user/info\", request, options);\n }\n\n /**\n * Check if phone numbers are registered WhatsApp users\n */\n async check(\n phones: string[],\n options?: RequestOptions\n ): Promise<UserCheckResponse> {\n const request: UserCheckRequest = { Phone: phones };\n return this.post<UserCheckResponse>(\"/user/check\", request, options);\n }\n\n /**\n * Get user avatar/profile picture\n */\n async getAvatar(\n phone: string,\n preview: boolean = true,\n options?: RequestOptions\n ): Promise<UserAvatarResponse> {\n const request: UserAvatarRequest = { Phone: phone, Preview: preview };\n return this.post<UserAvatarResponse>(\"/user/avatar\", request, options);\n }\n\n /**\n * Get all contacts\n */\n async getContacts(options?: RequestOptions): Promise<ContactsResponse> {\n return this.get<ContactsResponse>(\"/user/contacts\", options);\n }\n\n /**\n * Send user presence (available/unavailable status)\n */\n async sendPresence(\n presenceType: \"available\" | \"unavailable\",\n options?: RequestOptions\n ): Promise<UserPresenceResponse> {\n const request: UserPresenceRequest = { type: presenceType };\n return this.post<UserPresenceResponse>(\"/user/presence\", request, options);\n }\n}\n"],"names":["BaseClient"],"mappings":";;;AAcO,MAAM,mBAAmBA,OAAAA,WAAW;AAAA;AAAA;AAAA;AAAA,EAIzC,MAAM,QACJ,QACA,SAC2B;AAC3B,UAAM,UAA2B,EAAE,OAAO,OAAA;AAC1C,WAAO,KAAK,KAAuB,cAAc,SAAS,OAAO;AAAA,EACnE;AAAA;AAAA;AAAA;AAAA,EAKA,MAAM,MACJ,QACA,SAC4B;AAC5B,UAAM,UAA4B,EAAE,OAAO,OAAA;AAC3C,WAAO,KAAK,KAAwB,eAAe,SAAS,OAAO;AAAA,EACrE;AAAA;AAAA;AAAA;AAAA,EAKA,MAAM,UACJ,OACA,UAAmB,MACnB,SAC6B;AAC7B,UAAM,UAA6B,EAAE,OAAO,OAAO,SAAS,QAAA;AAC5D,WAAO,KAAK,KAAyB,gBAAgB,SAAS,OAAO;AAAA,EACvE;AAAA;AAAA;AAAA;AAAA,EAKA,MAAM,YAAY,SAAqD;AACrE,WAAO,KAAK,IAAsB,kBAAkB,OAAO;AAAA,EAC7D;AAAA;AAAA;AAAA;AAAA,EAKA,MAAM,aACJ,cACA,SAC+B;AAC/B,UAAM,UAA+B,EAAE,MAAM,aAAA;AAC7C,WAAO,KAAK,KAA2B,kBAAkB,SAAS,OAAO;AAAA,EAC3E;AACF;;"}
|
|
@@ -5,15 +5,15 @@ export declare class WebhookModule extends BaseClient {
|
|
|
5
5
|
/**
|
|
6
6
|
* Set webhook URL and events to subscribe to
|
|
7
7
|
*/
|
|
8
|
-
setWebhook(webhookURL: string, options?: RequestOptions): Promise<SetWebhookResponse>;
|
|
8
|
+
setWebhook(webhookURL: string, events?: string[], options?: RequestOptions): Promise<SetWebhookResponse>;
|
|
9
9
|
/**
|
|
10
10
|
* Get current webhook configuration
|
|
11
11
|
*/
|
|
12
12
|
getWebhook(options?: RequestOptions): Promise<GetWebhookResponse>;
|
|
13
13
|
/**
|
|
14
|
-
* Update webhook URL
|
|
14
|
+
* Update webhook URL, events, and activation status
|
|
15
15
|
*/
|
|
16
|
-
updateWebhook(webhookURL
|
|
16
|
+
updateWebhook(webhookURL?: string, events?: string[], active?: boolean, options?: RequestOptions): Promise<UpdateWebhookResponse>;
|
|
17
17
|
/**
|
|
18
18
|
* Delete webhook configuration
|
|
19
19
|
*/
|
package/dist/modules/webhook.js
CHANGED
|
@@ -5,8 +5,8 @@ class WebhookModule extends client.BaseClient {
|
|
|
5
5
|
/**
|
|
6
6
|
* Set webhook URL and events to subscribe to
|
|
7
7
|
*/
|
|
8
|
-
async setWebhook(webhookURL, options) {
|
|
9
|
-
const request = { webhookURL };
|
|
8
|
+
async setWebhook(webhookURL, events = ["All"], options) {
|
|
9
|
+
const request = { webhook: webhookURL, events };
|
|
10
10
|
return this.post("/webhook", request, options);
|
|
11
11
|
}
|
|
12
12
|
/**
|
|
@@ -16,10 +16,14 @@ class WebhookModule extends client.BaseClient {
|
|
|
16
16
|
return this.get("/webhook", options);
|
|
17
17
|
}
|
|
18
18
|
/**
|
|
19
|
-
* Update webhook URL
|
|
19
|
+
* Update webhook URL, events, and activation status
|
|
20
20
|
*/
|
|
21
|
-
async updateWebhook(webhookURL, options) {
|
|
22
|
-
const request = {
|
|
21
|
+
async updateWebhook(webhookURL, events, active, options) {
|
|
22
|
+
const request = {
|
|
23
|
+
webhook: webhookURL,
|
|
24
|
+
events,
|
|
25
|
+
Active: active
|
|
26
|
+
};
|
|
23
27
|
return this.put("/webhook", request, options);
|
|
24
28
|
}
|
|
25
29
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"webhook.js","sources":["../../src/modules/webhook.ts"],"sourcesContent":["import { BaseClient } from \"../client.js\";\nimport { RequestOptions } from \"../types/common.js\";\nimport {\n SetWebhookRequest,\n SetWebhookResponse,\n GetWebhookResponse,\n UpdateWebhookRequest,\n UpdateWebhookResponse,\n DeleteWebhookResponse,\n} from \"../types/webhook.js\";\n\nexport class WebhookModule extends BaseClient {\n /**\n * Set webhook URL and events to subscribe to\n */\n async setWebhook(\n webhookURL: string,\n options?: RequestOptions\n ): Promise<SetWebhookResponse> {\n const request: SetWebhookRequest = { webhookURL };\n return this.post<SetWebhookResponse>(\"/webhook\", request, options);\n }\n\n /**\n * Get current webhook configuration\n */\n async getWebhook(options?: RequestOptions): Promise<GetWebhookResponse> {\n return this.get<GetWebhookResponse>(\"/webhook\", options);\n }\n\n /**\n * Update webhook URL\n */\n async updateWebhook(\n webhookURL
|
|
1
|
+
{"version":3,"file":"webhook.js","sources":["../../src/modules/webhook.ts"],"sourcesContent":["import { BaseClient } from \"../client.js\";\nimport { RequestOptions } from \"../types/common.js\";\nimport {\n SetWebhookRequest,\n SetWebhookResponse,\n GetWebhookResponse,\n UpdateWebhookRequest,\n UpdateWebhookResponse,\n DeleteWebhookResponse,\n} from \"../types/webhook.js\";\n\nexport class WebhookModule extends BaseClient {\n /**\n * Set webhook URL and events to subscribe to\n */\n async setWebhook(\n webhookURL: string,\n events: string[] = [\"All\"],\n options?: RequestOptions\n ): Promise<SetWebhookResponse> {\n const request: SetWebhookRequest = { webhook: webhookURL, events };\n return this.post<SetWebhookResponse>(\"/webhook\", request, options);\n }\n\n /**\n * Get current webhook configuration\n */\n async getWebhook(options?: RequestOptions): Promise<GetWebhookResponse> {\n return this.get<GetWebhookResponse>(\"/webhook\", options);\n }\n\n /**\n * Update webhook URL, events, and activation status\n */\n async updateWebhook(\n webhookURL?: string,\n events?: string[],\n active?: boolean,\n options?: RequestOptions\n ): Promise<UpdateWebhookResponse> {\n const request: UpdateWebhookRequest = {\n webhook: webhookURL,\n events,\n Active: active,\n };\n return this.put<UpdateWebhookResponse>(\"/webhook\", request, options);\n }\n\n /**\n * Delete webhook configuration\n */\n async deleteWebhook(\n options?: RequestOptions\n ): Promise<DeleteWebhookResponse> {\n return this.delete<DeleteWebhookResponse>(\"/webhook\", options);\n }\n}\n"],"names":["BaseClient"],"mappings":";;;AAWO,MAAM,sBAAsBA,OAAAA,WAAW;AAAA;AAAA;AAAA;AAAA,EAI5C,MAAM,WACJ,YACA,SAAmB,CAAC,KAAK,GACzB,SAC6B;AAC7B,UAAM,UAA6B,EAAE,SAAS,YAAY,OAAA;AAC1D,WAAO,KAAK,KAAyB,YAAY,SAAS,OAAO;AAAA,EACnE;AAAA;AAAA;AAAA;AAAA,EAKA,MAAM,WAAW,SAAuD;AACtE,WAAO,KAAK,IAAwB,YAAY,OAAO;AAAA,EACzD;AAAA;AAAA;AAAA;AAAA,EAKA,MAAM,cACJ,YACA,QACA,QACA,SACgC;AAChC,UAAM,UAAgC;AAAA,MACpC,SAAS;AAAA,MACT;AAAA,MACA,QAAQ;AAAA,IAAA;AAEV,WAAO,KAAK,IAA2B,YAAY,SAAS,OAAO;AAAA,EACrE;AAAA;AAAA;AAAA;AAAA,EAKA,MAAM,cACJ,SACgC;AAChC,WAAO,KAAK,OAA8B,YAAY,OAAO;AAAA,EAC/D;AACF;;"}
|
package/dist/types/admin.d.ts
CHANGED
|
@@ -1,26 +1,59 @@
|
|
|
1
|
-
import { ProxyConfig, S3Config } from './common.js';
|
|
2
1
|
export interface User {
|
|
3
|
-
id:
|
|
2
|
+
id: string;
|
|
4
3
|
name: string;
|
|
5
4
|
token: string;
|
|
6
5
|
webhook: string;
|
|
7
6
|
jid: string;
|
|
8
7
|
qrcode: string;
|
|
9
8
|
connected: boolean;
|
|
9
|
+
loggedIn: boolean;
|
|
10
10
|
expiration: number;
|
|
11
11
|
events: string;
|
|
12
|
+
proxy_url: string;
|
|
12
13
|
}
|
|
13
14
|
export interface CreateUserRequest {
|
|
14
15
|
name: string;
|
|
15
16
|
token: string;
|
|
16
17
|
webhook?: string;
|
|
17
|
-
events
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
18
|
+
events?: string;
|
|
19
|
+
proxyConfig?: {
|
|
20
|
+
enabled: boolean;
|
|
21
|
+
proxyURL: string;
|
|
22
|
+
};
|
|
23
|
+
s3Config?: {
|
|
24
|
+
enabled: boolean;
|
|
25
|
+
endpoint: string;
|
|
26
|
+
region: string;
|
|
27
|
+
bucket: string;
|
|
28
|
+
accessKey: string;
|
|
29
|
+
secretKey: string;
|
|
30
|
+
pathStyle: boolean;
|
|
31
|
+
publicURL?: string;
|
|
32
|
+
mediaDelivery: "base64" | "s3" | "both";
|
|
33
|
+
retentionDays: number;
|
|
34
|
+
};
|
|
21
35
|
}
|
|
22
36
|
export interface CreateUserResponse {
|
|
23
|
-
id:
|
|
37
|
+
id: string;
|
|
38
|
+
name: string;
|
|
39
|
+
token: string;
|
|
40
|
+
webhook?: string;
|
|
41
|
+
events?: string;
|
|
42
|
+
proxy_config?: {
|
|
43
|
+
enabled: boolean;
|
|
44
|
+
proxy_url: string;
|
|
45
|
+
};
|
|
46
|
+
s3_config?: {
|
|
47
|
+
enabled: boolean;
|
|
48
|
+
endpoint: string;
|
|
49
|
+
region: string;
|
|
50
|
+
bucket: string;
|
|
51
|
+
access_key: string;
|
|
52
|
+
path_style: boolean;
|
|
53
|
+
public_url: string;
|
|
54
|
+
media_delivery: string;
|
|
55
|
+
retention_days: number;
|
|
56
|
+
};
|
|
24
57
|
}
|
|
25
58
|
export interface DeleteUserResponse {
|
|
26
59
|
Details: string;
|
package/dist/types/chat.d.ts
CHANGED
|
@@ -83,19 +83,18 @@ export interface ReactRequest {
|
|
|
83
83
|
}
|
|
84
84
|
export interface DownloadMediaRequest {
|
|
85
85
|
Url: string;
|
|
86
|
+
DirectPath: string;
|
|
86
87
|
MediaKey: string;
|
|
87
88
|
Mimetype: string;
|
|
89
|
+
FileEncSHA256: string;
|
|
88
90
|
FileSHA256: string;
|
|
89
91
|
FileLength: number;
|
|
90
|
-
FileEncSHA256?: string;
|
|
91
92
|
}
|
|
92
93
|
export interface DownloadMediaResponse {
|
|
93
94
|
[key: string]: unknown;
|
|
94
95
|
}
|
|
95
96
|
export interface DeleteMessageRequest {
|
|
96
|
-
Phone: string;
|
|
97
97
|
Id: string;
|
|
98
|
-
Remote?: boolean;
|
|
99
98
|
}
|
|
100
99
|
export interface DeleteMessageResponse {
|
|
101
100
|
Details: string;
|
|
@@ -116,7 +115,7 @@ export interface SendButtonsRequest {
|
|
|
116
115
|
}
|
|
117
116
|
export interface ListItem {
|
|
118
117
|
Title: string;
|
|
119
|
-
|
|
118
|
+
Desc?: string;
|
|
120
119
|
RowId: string;
|
|
121
120
|
}
|
|
122
121
|
export interface ListSection {
|
|
@@ -125,25 +124,25 @@ export interface ListSection {
|
|
|
125
124
|
}
|
|
126
125
|
export interface SendListRequest {
|
|
127
126
|
Phone: string;
|
|
128
|
-
Body: string;
|
|
129
|
-
Footer?: string;
|
|
130
|
-
Title: string;
|
|
131
127
|
ButtonText: string;
|
|
132
|
-
|
|
133
|
-
|
|
128
|
+
Desc: string;
|
|
129
|
+
TopText: string;
|
|
130
|
+
Sections?: ListSection[];
|
|
131
|
+
List?: ListItem[];
|
|
132
|
+
FooterText?: string;
|
|
133
|
+
Id?: string;
|
|
134
134
|
}
|
|
135
135
|
export interface ChatPollOption {
|
|
136
136
|
Name: string;
|
|
137
137
|
}
|
|
138
138
|
export interface SendPollRequest {
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
Options:
|
|
142
|
-
|
|
143
|
-
ContextInfo?: SimpleContextInfo;
|
|
139
|
+
Group: string;
|
|
140
|
+
Header: string;
|
|
141
|
+
Options: string[];
|
|
142
|
+
Id?: string;
|
|
144
143
|
}
|
|
145
144
|
export interface EditMessageRequest {
|
|
145
|
+
Id: string;
|
|
146
146
|
Phone: string;
|
|
147
|
-
|
|
148
|
-
NewText: string;
|
|
147
|
+
Body: string;
|
|
149
148
|
}
|