wuzapi 1.5.3 → 1.6.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.
- package/README.md +114 -96
- package/dist/modules/chat.d.ts +3 -3
- package/dist/modules/chat.js +22 -3
- package/dist/modules/chat.js.map +1 -1
- package/dist/modules/group.d.ts +2 -2
- package/dist/modules/group.js +14 -8
- 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 +2 -1
- package/dist/modules/user.js.map +1 -1
- package/dist/types/chat.d.ts +13 -12
- package/dist/types/common.d.ts +1 -1
- package/dist/types/group.d.ts +9 -9
- package/dist/types/session.d.ts +2 -2
- package/dist/types/user.d.ts +1 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -4,7 +4,7 @@ A comprehensive TypeScript client library for the [WuzAPI WhatsApp API](https://
|
|
|
4
4
|
|
|
5
5
|
## 🚀 Features
|
|
6
6
|
|
|
7
|
-
- 🔥 **Full TypeScript Support** - Complete type definitions for all API endpoints
|
|
7
|
+
- 🔥 **Full TypeScript Support** - Complete type definitions for all API endpoints
|
|
8
8
|
- 🏗️ **Modular Architecture** - Organized by functionality (admin, session, chat, user, group, webhook)
|
|
9
9
|
- 🚀 **Promise-based** - Modern async/await support
|
|
10
10
|
- 🛡️ **Error Handling** - Comprehensive error handling with detailed error types
|
|
@@ -52,6 +52,7 @@ await client.chat.sendText({
|
|
|
52
52
|
### Login Options
|
|
53
53
|
|
|
54
54
|
#### Option 1: QR Code (Traditional)
|
|
55
|
+
|
|
55
56
|
```typescript
|
|
56
57
|
// Get QR code for scanning
|
|
57
58
|
const qr = await client.session.getQRCode();
|
|
@@ -59,17 +60,18 @@ console.log("Scan this QR code:", qr.QRCode);
|
|
|
59
60
|
```
|
|
60
61
|
|
|
61
62
|
#### Option 2: Phone Pairing (New!)
|
|
63
|
+
|
|
62
64
|
```typescript
|
|
63
|
-
// Pair using verification code
|
|
64
|
-
await client.session.pairPhone("5491155554444"
|
|
65
|
+
// Pair using phone number (generates verification code)
|
|
66
|
+
await client.session.pairPhone("5491155554444");
|
|
65
67
|
```
|
|
66
68
|
|
|
67
69
|
## 🔧 Configuration
|
|
68
70
|
|
|
69
71
|
```typescript
|
|
70
72
|
interface WuzapiConfig {
|
|
71
|
-
apiUrl: string;
|
|
72
|
-
token?: string;
|
|
73
|
+
apiUrl: string; // Your WuzAPI server URL
|
|
74
|
+
token?: string; // Authentication token (can be provided per request)
|
|
73
75
|
}
|
|
74
76
|
|
|
75
77
|
// Global token approach
|
|
@@ -117,27 +119,29 @@ await client.chat.sendButtons({
|
|
|
117
119
|
});
|
|
118
120
|
|
|
119
121
|
// Send list menu
|
|
120
|
-
await client.chat.sendList(
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
122
|
+
await client.chat.sendList(
|
|
123
|
+
"5491155554444", // Phone
|
|
124
|
+
"View Menu", // Button text
|
|
125
|
+
"Select from menu:", // Description
|
|
126
|
+
"Options", // Top text/title
|
|
127
|
+
[
|
|
128
|
+
{
|
|
129
|
+
// Sections
|
|
130
|
+
Title: "Main Options",
|
|
131
|
+
Rows: [
|
|
132
|
+
{ Title: "Option 1", Desc: "First choice", RowId: "opt1" },
|
|
133
|
+
{ Title: "Option 2", Desc: "Second choice", RowId: "opt2" },
|
|
134
|
+
],
|
|
135
|
+
},
|
|
136
|
+
]
|
|
137
|
+
);
|
|
133
138
|
|
|
134
|
-
// Send poll
|
|
135
|
-
await client.chat.sendPoll(
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
});
|
|
139
|
+
// Send poll (for groups only)
|
|
140
|
+
await client.chat.sendPoll(
|
|
141
|
+
"120362023605733675@g.us", // Group JID
|
|
142
|
+
"What's your favorite color?", // Header
|
|
143
|
+
["Red", "Blue", "Green"] // Options array
|
|
144
|
+
);
|
|
141
145
|
```
|
|
142
146
|
|
|
143
147
|
## 👥 Group Management
|
|
@@ -153,11 +157,7 @@ const group = await client.group.create("My Group", [
|
|
|
153
157
|
const info = await client.group.getInfo(group.JID);
|
|
154
158
|
|
|
155
159
|
// Add participants
|
|
156
|
-
await client.group.updateParticipants(
|
|
157
|
-
group.JID,
|
|
158
|
-
"add",
|
|
159
|
-
["5491155553936"]
|
|
160
|
-
);
|
|
160
|
+
await client.group.updateParticipants(group.JID, "add", ["5491155553936"]);
|
|
161
161
|
|
|
162
162
|
// Set group settings
|
|
163
163
|
await client.group.setName(group.JID, "New Group Name");
|
|
@@ -178,10 +178,7 @@ const info = await client.user.getInfo(["5491155554444"]);
|
|
|
178
178
|
const contacts = await client.user.getContacts();
|
|
179
179
|
|
|
180
180
|
// Send presence status
|
|
181
|
-
await client.user.sendPresence(
|
|
182
|
-
Phone: "5491155554444",
|
|
183
|
-
State: "available",
|
|
184
|
-
});
|
|
181
|
+
await client.user.sendPresence("available");
|
|
185
182
|
```
|
|
186
183
|
|
|
187
184
|
## 🔗 Webhook Setup
|
|
@@ -202,7 +199,7 @@ await client.webhook.updateWebhook("https://new-server.com/webhook");
|
|
|
202
199
|
Check out the complete examples in the `examples/` directory:
|
|
203
200
|
|
|
204
201
|
- **[basic-usage.js](examples/basic-usage.js)** - Getting started, connection, basic operations
|
|
205
|
-
- **[advanced-features.js](examples/advanced-features.js)** - Phone pairing, interactive messages, advanced group management
|
|
202
|
+
- **[advanced-features.js](examples/advanced-features.js)** - Phone pairing, interactive messages, advanced group management
|
|
206
203
|
- **[chatbot-example.js](examples/chatbot-example.js)** - Complete bot with commands and auto-replies
|
|
207
204
|
- **[webhook-events-example.js](examples/webhook-events-example.js)** - Comprehensive webhook event handling
|
|
208
205
|
|
|
@@ -212,7 +209,7 @@ Check out the complete examples in the `examples/` directory:
|
|
|
212
209
|
# Basic usage
|
|
213
210
|
node examples/basic-usage.js
|
|
214
211
|
|
|
215
|
-
# Advanced features
|
|
212
|
+
# Advanced features
|
|
216
213
|
node examples/advanced-features.js
|
|
217
214
|
|
|
218
215
|
# Start chatbot
|
|
@@ -236,11 +233,11 @@ await client.webhook.setWebhook("https://your-server.com/webhook");
|
|
|
236
233
|
// In your webhook handler:
|
|
237
234
|
app.post("/webhook", async (req, res) => {
|
|
238
235
|
const { event } = req.body;
|
|
239
|
-
|
|
236
|
+
|
|
240
237
|
if (event?.Message?.conversation) {
|
|
241
238
|
const message = event.Message.conversation;
|
|
242
239
|
const from = event.Info.RemoteJid.replace("@s.whatsapp.net", "");
|
|
243
|
-
|
|
240
|
+
|
|
244
241
|
if (message.toLowerCase().includes("hello")) {
|
|
245
242
|
await client.chat.sendText({
|
|
246
243
|
Phone: from,
|
|
@@ -248,7 +245,7 @@ app.post("/webhook", async (req, res) => {
|
|
|
248
245
|
});
|
|
249
246
|
}
|
|
250
247
|
}
|
|
251
|
-
|
|
248
|
+
|
|
252
249
|
res.json({ success: true });
|
|
253
250
|
});
|
|
254
251
|
```
|
|
@@ -261,6 +258,7 @@ app.post("/webhook", async (req, res) => {
|
|
|
261
258
|
<summary><strong>📱 Session Module</strong> - Connection and authentication</summary>
|
|
262
259
|
|
|
263
260
|
### Connection
|
|
261
|
+
|
|
264
262
|
```typescript
|
|
265
263
|
// Connect to WhatsApp
|
|
266
264
|
await client.session.connect({
|
|
@@ -279,21 +277,23 @@ await client.session.logout();
|
|
|
279
277
|
```
|
|
280
278
|
|
|
281
279
|
### Authentication
|
|
280
|
+
|
|
282
281
|
```typescript
|
|
283
282
|
// Get QR code for scanning
|
|
284
283
|
const qr = await client.session.getQRCode();
|
|
285
284
|
|
|
286
|
-
// Pair phone using
|
|
287
|
-
await client.session.pairPhone("5491155554444"
|
|
285
|
+
// Pair phone using phone number (generates verification code)
|
|
286
|
+
await client.session.pairPhone("5491155554444");
|
|
288
287
|
|
|
289
288
|
// Request message history sync
|
|
290
289
|
await client.session.requestHistory();
|
|
291
290
|
|
|
292
291
|
// Configure proxy
|
|
293
|
-
await client.session.setProxy("socks5://user:pass@proxy:port");
|
|
292
|
+
await client.session.setProxy("socks5://user:pass@proxy:port", true);
|
|
294
293
|
```
|
|
295
294
|
|
|
296
295
|
### S3 Storage
|
|
296
|
+
|
|
297
297
|
```typescript
|
|
298
298
|
// Configure S3 storage
|
|
299
299
|
await client.session.configureS3({
|
|
@@ -324,6 +324,7 @@ await client.session.deleteS3Config();
|
|
|
324
324
|
<summary><strong>💬 Chat Module</strong> - Send and manage messages</summary>
|
|
325
325
|
|
|
326
326
|
### Basic Messages
|
|
327
|
+
|
|
327
328
|
```typescript
|
|
328
329
|
// Send text message
|
|
329
330
|
await client.chat.sendText({
|
|
@@ -344,6 +345,7 @@ await client.chat.sendText({
|
|
|
344
345
|
```
|
|
345
346
|
|
|
346
347
|
### Media Messages
|
|
348
|
+
|
|
347
349
|
```typescript
|
|
348
350
|
// Send image
|
|
349
351
|
await client.chat.sendImage({
|
|
@@ -380,6 +382,7 @@ await client.chat.sendSticker({
|
|
|
380
382
|
```
|
|
381
383
|
|
|
382
384
|
### Interactive Messages
|
|
385
|
+
|
|
383
386
|
```typescript
|
|
384
387
|
// Send buttons
|
|
385
388
|
await client.chat.sendButtons({
|
|
@@ -393,32 +396,33 @@ await client.chat.sendButtons({
|
|
|
393
396
|
});
|
|
394
397
|
|
|
395
398
|
// Send list message
|
|
396
|
-
await client.chat.sendList(
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
399
|
+
await client.chat.sendList(
|
|
400
|
+
"5491155554444", // Phone
|
|
401
|
+
"View Menu", // Button text
|
|
402
|
+
"Please select from the menu:", // Description
|
|
403
|
+
"Menu Options", // Top text/title
|
|
404
|
+
[
|
|
402
405
|
{
|
|
406
|
+
// Sections
|
|
403
407
|
Title: "Main Course",
|
|
404
408
|
Rows: [
|
|
405
|
-
{ Title: "Pizza",
|
|
406
|
-
{ Title: "Burger",
|
|
409
|
+
{ Title: "Pizza", Desc: "Delicious pizza", RowId: "pizza" },
|
|
410
|
+
{ Title: "Burger", Desc: "Tasty burger", RowId: "burger" },
|
|
407
411
|
],
|
|
408
412
|
},
|
|
409
|
-
]
|
|
410
|
-
|
|
413
|
+
]
|
|
414
|
+
);
|
|
411
415
|
|
|
412
|
-
// Send poll
|
|
413
|
-
await client.chat.sendPoll(
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
});
|
|
416
|
+
// Send poll (for groups only)
|
|
417
|
+
await client.chat.sendPoll(
|
|
418
|
+
"120362023605733675@g.us", // Group JID
|
|
419
|
+
"What's your favorite color?", // Header
|
|
420
|
+
["Red", "Blue", "Green"] // Options array
|
|
421
|
+
);
|
|
419
422
|
```
|
|
420
423
|
|
|
421
424
|
### Message Management
|
|
425
|
+
|
|
422
426
|
```typescript
|
|
423
427
|
// Delete a message
|
|
424
428
|
await client.chat.deleteMessage({
|
|
@@ -456,6 +460,7 @@ await client.chat.sendPresence({
|
|
|
456
460
|
```
|
|
457
461
|
|
|
458
462
|
### Location and Contacts
|
|
463
|
+
|
|
459
464
|
```typescript
|
|
460
465
|
// Send location
|
|
461
466
|
await client.chat.sendLocation({
|
|
@@ -469,11 +474,13 @@ await client.chat.sendLocation({
|
|
|
469
474
|
await client.chat.sendContact({
|
|
470
475
|
Phone: "5491155554444",
|
|
471
476
|
Name: "John Doe",
|
|
472
|
-
Vcard:
|
|
477
|
+
Vcard:
|
|
478
|
+
"BEGIN:VCARD\nVERSION:3.0\nN:Doe;John;;;\nFN:John Doe\nTEL:+1234567890\nEND:VCARD",
|
|
473
479
|
});
|
|
474
480
|
```
|
|
475
481
|
|
|
476
482
|
### Media Download
|
|
483
|
+
|
|
477
484
|
```typescript
|
|
478
485
|
// Download media
|
|
479
486
|
const media = await client.chat.downloadImage({
|
|
@@ -504,11 +511,7 @@ const avatar = await client.user.getAvatar("5491155554444", true); // true for p
|
|
|
504
511
|
const contacts = await client.user.getContacts();
|
|
505
512
|
|
|
506
513
|
// Send user presence (online/offline status)
|
|
507
|
-
await client.user.sendPresence(
|
|
508
|
-
Phone: "5491155554444",
|
|
509
|
-
State: "available", // or "unavailable"
|
|
510
|
-
LastSeen: Date.now(),
|
|
511
|
-
});
|
|
514
|
+
await client.user.sendPresence("available"); // or "unavailable"
|
|
512
515
|
```
|
|
513
516
|
|
|
514
517
|
</details>
|
|
@@ -517,6 +520,7 @@ await client.user.sendPresence({
|
|
|
517
520
|
<summary><strong>👥 Group Module</strong> - Group management</summary>
|
|
518
521
|
|
|
519
522
|
### Basic Group Operations
|
|
523
|
+
|
|
520
524
|
```typescript
|
|
521
525
|
// List all groups
|
|
522
526
|
const groups = await client.group.list();
|
|
@@ -535,6 +539,7 @@ await client.group.leave("120362023605733675@g.us");
|
|
|
535
539
|
```
|
|
536
540
|
|
|
537
541
|
### Group Settings
|
|
542
|
+
|
|
538
543
|
```typescript
|
|
539
544
|
// Set group name
|
|
540
545
|
await client.group.setName("120362023605733675@g.us", "New Group Name");
|
|
@@ -556,6 +561,7 @@ await client.group.setEphemeral("120362023605733675@g.us", "24h"); // '24h', '7d
|
|
|
556
561
|
```
|
|
557
562
|
|
|
558
563
|
### Group Media
|
|
564
|
+
|
|
559
565
|
```typescript
|
|
560
566
|
// Set group photo (JPEG only)
|
|
561
567
|
await client.group.setPhoto(
|
|
@@ -568,15 +574,20 @@ await client.group.removePhoto("120362023605733675@g.us");
|
|
|
568
574
|
```
|
|
569
575
|
|
|
570
576
|
### Invites and Participants
|
|
577
|
+
|
|
571
578
|
```typescript
|
|
572
579
|
// Get invite link
|
|
573
580
|
const invite = await client.group.getInviteLink("120362023605733675@g.us");
|
|
574
581
|
|
|
575
582
|
// Join a group using invite link
|
|
576
|
-
const joinResult = await client.group.join(
|
|
583
|
+
const joinResult = await client.group.join(
|
|
584
|
+
"https://chat.whatsapp.com/XXXXXXXXX"
|
|
585
|
+
);
|
|
577
586
|
|
|
578
587
|
// Get group invite information
|
|
579
|
-
const inviteInfo = await client.group.getInviteInfo(
|
|
588
|
+
const inviteInfo = await client.group.getInviteInfo(
|
|
589
|
+
"https://chat.whatsapp.com/XXXXXXXXX"
|
|
590
|
+
);
|
|
580
591
|
|
|
581
592
|
// Update group participants (add, remove, promote, demote)
|
|
582
593
|
await client.group.updateParticipants(
|
|
@@ -599,27 +610,30 @@ const users = await client.admin.listUsers({ token: "admin-token" });
|
|
|
599
610
|
const user = await client.admin.getUser(2, { token: "admin-token" });
|
|
600
611
|
|
|
601
612
|
// Add new user
|
|
602
|
-
const newUser = await client.admin.addUser(
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
613
|
+
const newUser = await client.admin.addUser(
|
|
614
|
+
{
|
|
615
|
+
name: "John Doe",
|
|
616
|
+
token: "user-token-123",
|
|
617
|
+
webhook: "https://example.com/webhook",
|
|
618
|
+
events: "Message,ReadReceipt",
|
|
619
|
+
proxyConfig: {
|
|
620
|
+
enabled: true,
|
|
621
|
+
proxyURL: "socks5://user:pass@proxy:port",
|
|
622
|
+
},
|
|
623
|
+
s3Config: {
|
|
624
|
+
enabled: true,
|
|
625
|
+
endpoint: "https://s3.amazonaws.com",
|
|
626
|
+
region: "us-east-1",
|
|
627
|
+
bucket: "user-media-bucket",
|
|
628
|
+
accessKey: "AKIA...",
|
|
629
|
+
secretKey: "secret...",
|
|
630
|
+
pathStyle: false,
|
|
631
|
+
mediaDelivery: "both",
|
|
632
|
+
retentionDays: 30,
|
|
633
|
+
},
|
|
621
634
|
},
|
|
622
|
-
|
|
635
|
+
{ token: "admin-token" }
|
|
636
|
+
);
|
|
623
637
|
|
|
624
638
|
// Delete user
|
|
625
639
|
await client.admin.deleteUser(2, { token: "admin-token" });
|
|
@@ -691,22 +705,22 @@ const client = new WuzapiClient({
|
|
|
691
705
|
app.post("/webhook", async (req, res) => {
|
|
692
706
|
try {
|
|
693
707
|
const webhookPayload = req.body;
|
|
694
|
-
|
|
708
|
+
|
|
695
709
|
// Handle S3 media if present
|
|
696
710
|
if (hasS3Media(webhookPayload)) {
|
|
697
711
|
console.log("S3 Media:", webhookPayload.s3.url);
|
|
698
712
|
}
|
|
699
|
-
|
|
713
|
+
|
|
700
714
|
const event = webhookPayload.event || webhookPayload;
|
|
701
|
-
|
|
715
|
+
|
|
702
716
|
// Handle messages
|
|
703
717
|
if (event.Message && event.Info) {
|
|
704
718
|
const messageContent = getMessageContent(event.Message);
|
|
705
719
|
const from = event.Info.RemoteJid.replace("@s.whatsapp.net", "");
|
|
706
|
-
|
|
720
|
+
|
|
707
721
|
if (messageContent?.type === "text") {
|
|
708
722
|
console.log(`Message from ${from}: ${messageContent.content}`);
|
|
709
|
-
|
|
723
|
+
|
|
710
724
|
// Auto-reply
|
|
711
725
|
if (messageContent.content.toLowerCase().includes("hello")) {
|
|
712
726
|
await client.chat.sendText({
|
|
@@ -716,7 +730,7 @@ app.post("/webhook", async (req, res) => {
|
|
|
716
730
|
}
|
|
717
731
|
}
|
|
718
732
|
}
|
|
719
|
-
|
|
733
|
+
|
|
720
734
|
res.json({ success: true });
|
|
721
735
|
} catch (error) {
|
|
722
736
|
console.error("Webhook error:", error);
|
|
@@ -743,7 +757,10 @@ switch (messageContent?.type) {
|
|
|
743
757
|
console.log("Button clicked:", messageContent.content.selectedButtonId);
|
|
744
758
|
break;
|
|
745
759
|
case "listResponse":
|
|
746
|
-
console.log(
|
|
760
|
+
console.log(
|
|
761
|
+
"List selection:",
|
|
762
|
+
messageContent.content.singleSelectReply?.selectedRowId
|
|
763
|
+
);
|
|
747
764
|
break;
|
|
748
765
|
// ... handle other types
|
|
749
766
|
}
|
|
@@ -778,8 +795,9 @@ try {
|
|
|
778
795
|
```
|
|
779
796
|
|
|
780
797
|
### Common Error Codes
|
|
798
|
+
|
|
781
799
|
- **401**: Authentication required
|
|
782
|
-
- **404**: Endpoint not found
|
|
800
|
+
- **404**: Endpoint not found
|
|
783
801
|
- **500**: Server error
|
|
784
802
|
|
|
785
803
|
</details>
|
|
@@ -794,7 +812,7 @@ import { BaseClient } from "wuzapi";
|
|
|
794
812
|
class CustomClient extends BaseClient {
|
|
795
813
|
constructor(config) {
|
|
796
814
|
super(config);
|
|
797
|
-
|
|
815
|
+
|
|
798
816
|
// Add custom interceptors
|
|
799
817
|
this.axios.interceptors.request.use((config) => {
|
|
800
818
|
console.log("Making request:", config.url);
|
package/dist/modules/chat.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { BaseClient } from '../client.js';
|
|
2
2
|
import { RequestOptions } from '../types/common.js';
|
|
3
|
-
import { SendMessageResponse, SendTextRequest, SendTemplateRequest, SendAudioRequest, SendImageRequest, SendDocumentRequest, SendVideoRequest, SendStickerRequest, SendLocationRequest, SendContactRequest, ChatPresenceRequest, MarkReadRequest, ReactRequest, DownloadMediaRequest, DownloadMediaResponse, DeleteMessageRequest, DeleteMessageResponse, SendButtonsRequest,
|
|
3
|
+
import { SendMessageResponse, SendTextRequest, SendTemplateRequest, SendAudioRequest, SendImageRequest, SendDocumentRequest, SendVideoRequest, SendStickerRequest, SendLocationRequest, SendContactRequest, ChatPresenceRequest, MarkReadRequest, ReactRequest, DownloadMediaRequest, DownloadMediaResponse, DeleteMessageRequest, DeleteMessageResponse, SendButtonsRequest, EditMessageRequest, ListSection } from '../types/chat.js';
|
|
4
4
|
export declare class ChatModule extends BaseClient {
|
|
5
5
|
/**
|
|
6
6
|
* Send a text message
|
|
@@ -77,11 +77,11 @@ export declare class ChatModule extends BaseClient {
|
|
|
77
77
|
/**
|
|
78
78
|
* Send list message
|
|
79
79
|
*/
|
|
80
|
-
sendList(
|
|
80
|
+
sendList(phone: string, buttonText: string, description: string, topText: string, sections?: ListSection[], footerText?: string, id?: string, options?: RequestOptions): Promise<SendMessageResponse>;
|
|
81
81
|
/**
|
|
82
82
|
* Send poll message
|
|
83
83
|
*/
|
|
84
|
-
sendPoll(
|
|
84
|
+
sendPoll(groupJID: string, header: string, options: string[], id?: string, requestOptions?: RequestOptions): Promise<SendMessageResponse>;
|
|
85
85
|
/**
|
|
86
86
|
* Edit a message
|
|
87
87
|
*/
|
package/dist/modules/chat.js
CHANGED
|
@@ -153,14 +153,33 @@ class ChatModule extends client.BaseClient {
|
|
|
153
153
|
/**
|
|
154
154
|
* Send list message
|
|
155
155
|
*/
|
|
156
|
-
async sendList(
|
|
156
|
+
async sendList(phone, buttonText, description, topText, sections, footerText, id, options) {
|
|
157
|
+
const request = {
|
|
158
|
+
Phone: phone,
|
|
159
|
+
ButtonText: buttonText,
|
|
160
|
+
Desc: description,
|
|
161
|
+
TopText: topText,
|
|
162
|
+
Sections: sections,
|
|
163
|
+
FooterText: footerText,
|
|
164
|
+
Id: id
|
|
165
|
+
};
|
|
157
166
|
return this.post("/chat/send/list", request, options);
|
|
158
167
|
}
|
|
159
168
|
/**
|
|
160
169
|
* Send poll message
|
|
161
170
|
*/
|
|
162
|
-
async sendPoll(
|
|
163
|
-
|
|
171
|
+
async sendPoll(groupJID, header, options, id, requestOptions) {
|
|
172
|
+
const request = {
|
|
173
|
+
Group: groupJID,
|
|
174
|
+
Header: header,
|
|
175
|
+
Options: options,
|
|
176
|
+
Id: id
|
|
177
|
+
};
|
|
178
|
+
return this.post(
|
|
179
|
+
"/chat/send/poll",
|
|
180
|
+
request,
|
|
181
|
+
requestOptions
|
|
182
|
+
);
|
|
164
183
|
}
|
|
165
184
|
/**
|
|
166
185
|
* Edit a message
|
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 request: DeleteMessageRequest,\n options?: RequestOptions\n ): Promise<DeleteMessageResponse> {\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
|
|
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 request: DeleteMessageRequest,\n options?: RequestOptions\n ): Promise<DeleteMessageResponse> {\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 request: EditMessageRequest,\n options?: RequestOptions\n ): Promise<SendMessageResponse> {\n return this.post<SendMessageResponse>(\"/chat/send/edit\", request, options);\n }\n}\n"],"names":["BaseClient"],"mappings":"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"}
|
package/dist/modules/group.d.ts
CHANGED
|
@@ -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
|
@@ -44,21 +44,27 @@ class GroupModule extends client.BaseClient {
|
|
|
44
44
|
* Create a new group
|
|
45
45
|
*/
|
|
46
46
|
async create(name, participants, options) {
|
|
47
|
-
const request = {
|
|
47
|
+
const request = {
|
|
48
|
+
Name: name,
|
|
49
|
+
Participants: participants
|
|
50
|
+
};
|
|
48
51
|
return this.post("/group/create", request, options);
|
|
49
52
|
}
|
|
50
53
|
/**
|
|
51
54
|
* Set group locked status
|
|
52
55
|
*/
|
|
53
56
|
async setLocked(groupJID, locked, options) {
|
|
54
|
-
const request = {
|
|
57
|
+
const request = { GroupJID: groupJID, Locked: locked };
|
|
55
58
|
return this.post("/group/locked", request, options);
|
|
56
59
|
}
|
|
57
60
|
/**
|
|
58
61
|
* Set disappearing messages timer
|
|
59
62
|
*/
|
|
60
63
|
async setEphemeral(groupJID, duration, options) {
|
|
61
|
-
const request = {
|
|
64
|
+
const request = {
|
|
65
|
+
GroupJID: groupJID,
|
|
66
|
+
Duration: duration
|
|
67
|
+
};
|
|
62
68
|
return this.post(
|
|
63
69
|
"/group/ephemeral",
|
|
64
70
|
request,
|
|
@@ -69,7 +75,7 @@ class GroupModule extends client.BaseClient {
|
|
|
69
75
|
* Remove group photo
|
|
70
76
|
*/
|
|
71
77
|
async removePhoto(groupJID, options) {
|
|
72
|
-
const request = {
|
|
78
|
+
const request = { GroupJID: groupJID };
|
|
73
79
|
return this.post(
|
|
74
80
|
"/group/photo/remove",
|
|
75
81
|
request,
|
|
@@ -107,15 +113,15 @@ class GroupModule extends client.BaseClient {
|
|
|
107
113
|
/**
|
|
108
114
|
* Join a group using invite link
|
|
109
115
|
*/
|
|
110
|
-
async join(
|
|
111
|
-
const request = {
|
|
116
|
+
async join(inviteCode, options) {
|
|
117
|
+
const request = { Code: inviteCode };
|
|
112
118
|
return this.post("/group/join", request, options);
|
|
113
119
|
}
|
|
114
120
|
/**
|
|
115
121
|
* Get group invite information
|
|
116
122
|
*/
|
|
117
|
-
async getInviteInfo(
|
|
118
|
-
const request = {
|
|
123
|
+
async getInviteInfo(inviteCode, options) {
|
|
124
|
+
const request = { Code: inviteCode };
|
|
119
125
|
return this.post(
|
|
120
126
|
"/group/inviteinfo",
|
|
121
127
|
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 GroupInviteLinkRequest,\n GroupInviteLinkResponse,\n GroupInfoRequest,\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 options?: RequestOptions\n ): Promise<GroupInviteLinkResponse> {\n const request: GroupInviteLinkRequest = { GroupJID: groupJID };\n return this.post<GroupInviteLinkResponse>(\n \"/group/invitelink\",\n request,\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 request: GroupInfoRequest = { GroupJID: groupJID };\n return this.post<GroupInfo>(\"/group/info\", request, 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 = { name
|
|
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 GroupInviteLinkRequest,\n GroupInviteLinkResponse,\n GroupInfoRequest,\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 options?: RequestOptions\n ): Promise<GroupInviteLinkResponse> {\n const request: GroupInviteLinkRequest = { GroupJID: groupJID };\n return this.post<GroupInviteLinkResponse>(\n \"/group/invitelink\",\n request,\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 request: GroupInfoRequest = { GroupJID: groupJID };\n return this.post<GroupInfo>(\"/group/info\", request, 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":"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"}
|
|
@@ -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 = { ProxyURL: proxyURL, Enable: 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 = { ProxyURL: 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,UAAU,UAAU,QAAQ,OAAA;AAC5D,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 } 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<void>;
|
|
25
25
|
}
|
package/dist/modules/user.js
CHANGED
|
@@ -32,7 +32,8 @@ class UserModule extends client.BaseClient {
|
|
|
32
32
|
/**
|
|
33
33
|
* Send user presence (available/unavailable status)
|
|
34
34
|
*/
|
|
35
|
-
async sendPresence(
|
|
35
|
+
async sendPresence(presenceType, options) {
|
|
36
|
+
const request = { Type: presenceType };
|
|
36
37
|
await this.post("/user/presence", request, options);
|
|
37
38
|
}
|
|
38
39
|
}
|
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} 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<void> {\n const request: UserPresenceRequest = { Type: presenceType };\n await this.post<void>(\"/user/presence\", request, options);\n }\n}\n"],"names":["BaseClient"],"mappings":";;;AAaO,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,SACe;AACf,UAAM,UAA+B,EAAE,MAAM,aAAA;AAC7C,UAAM,KAAK,KAAW,kBAAkB,SAAS,OAAO;AAAA,EAC1D;AACF;;"}
|
package/dist/types/chat.d.ts
CHANGED
|
@@ -83,11 +83,12 @@ 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;
|
|
@@ -116,7 +117,7 @@ export interface SendButtonsRequest {
|
|
|
116
117
|
}
|
|
117
118
|
export interface ListItem {
|
|
118
119
|
Title: string;
|
|
119
|
-
|
|
120
|
+
Desc?: string;
|
|
120
121
|
RowId: string;
|
|
121
122
|
}
|
|
122
123
|
export interface ListSection {
|
|
@@ -125,22 +126,22 @@ export interface ListSection {
|
|
|
125
126
|
}
|
|
126
127
|
export interface SendListRequest {
|
|
127
128
|
Phone: string;
|
|
128
|
-
Body: string;
|
|
129
|
-
Footer?: string;
|
|
130
|
-
Title: string;
|
|
131
129
|
ButtonText: string;
|
|
132
|
-
|
|
133
|
-
|
|
130
|
+
Desc: string;
|
|
131
|
+
TopText: string;
|
|
132
|
+
Sections?: ListSection[];
|
|
133
|
+
List?: ListItem[];
|
|
134
|
+
FooterText?: string;
|
|
135
|
+
Id?: string;
|
|
134
136
|
}
|
|
135
137
|
export interface ChatPollOption {
|
|
136
138
|
Name: string;
|
|
137
139
|
}
|
|
138
140
|
export interface SendPollRequest {
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
Options:
|
|
142
|
-
|
|
143
|
-
ContextInfo?: SimpleContextInfo;
|
|
141
|
+
Group: string;
|
|
142
|
+
Header: string;
|
|
143
|
+
Options: string[];
|
|
144
|
+
Id?: string;
|
|
144
145
|
}
|
|
145
146
|
export interface EditMessageRequest {
|
|
146
147
|
Phone: string;
|
package/dist/types/common.d.ts
CHANGED
package/dist/types/group.d.ts
CHANGED
|
@@ -50,26 +50,26 @@ export interface GroupNameResponse {
|
|
|
50
50
|
Details: string;
|
|
51
51
|
}
|
|
52
52
|
export interface GroupCreateRequest {
|
|
53
|
-
|
|
54
|
-
|
|
53
|
+
Name: string;
|
|
54
|
+
Participants: string[];
|
|
55
55
|
}
|
|
56
56
|
export type GroupCreateResponse = GroupInfo;
|
|
57
57
|
export interface GroupLockedRequest {
|
|
58
|
-
|
|
59
|
-
|
|
58
|
+
GroupJID: string;
|
|
59
|
+
Locked: boolean;
|
|
60
60
|
}
|
|
61
61
|
export interface GroupLockedResponse {
|
|
62
62
|
Details: string;
|
|
63
63
|
}
|
|
64
64
|
export interface GroupEphemeralRequest {
|
|
65
|
-
|
|
66
|
-
|
|
65
|
+
GroupJID: string;
|
|
66
|
+
Duration: "24h" | "7d" | "90d" | "off";
|
|
67
67
|
}
|
|
68
68
|
export interface GroupEphemeralResponse {
|
|
69
69
|
Details: string;
|
|
70
70
|
}
|
|
71
71
|
export interface GroupPhotoRemoveRequest {
|
|
72
|
-
|
|
72
|
+
GroupJID: string;
|
|
73
73
|
}
|
|
74
74
|
export interface GroupPhotoRemoveResponse {
|
|
75
75
|
Details: string;
|
|
@@ -95,14 +95,14 @@ export interface GroupAnnounceResponse {
|
|
|
95
95
|
Details: string;
|
|
96
96
|
}
|
|
97
97
|
export interface GroupJoinRequest {
|
|
98
|
-
|
|
98
|
+
Code: string;
|
|
99
99
|
}
|
|
100
100
|
export interface GroupJoinResponse {
|
|
101
101
|
GroupJID: string;
|
|
102
102
|
Details: string;
|
|
103
103
|
}
|
|
104
104
|
export interface GroupInviteInfoRequest {
|
|
105
|
-
|
|
105
|
+
Code: string;
|
|
106
106
|
}
|
|
107
107
|
export interface GroupInviteInfoResponse {
|
|
108
108
|
GroupJID: string;
|
package/dist/types/session.d.ts
CHANGED
|
@@ -32,7 +32,6 @@ export interface S3TestResponse {
|
|
|
32
32
|
}
|
|
33
33
|
export interface PairPhoneRequest {
|
|
34
34
|
Phone: string;
|
|
35
|
-
Code: string;
|
|
36
35
|
}
|
|
37
36
|
export interface PairPhoneResponse {
|
|
38
37
|
Details: string;
|
|
@@ -41,7 +40,8 @@ export interface HistoryResponse {
|
|
|
41
40
|
Details: string;
|
|
42
41
|
}
|
|
43
42
|
export interface ProxyRequest {
|
|
44
|
-
|
|
43
|
+
ProxyURL: string;
|
|
44
|
+
Enable: boolean;
|
|
45
45
|
}
|
|
46
46
|
export interface ProxyResponse {
|
|
47
47
|
Details: string;
|
package/dist/types/user.d.ts
CHANGED