wuzapi 1.7.6 → 1.7.7
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 +4 -0
- package/dist/modules/session.d.ts +5 -1
- package/dist/modules/session.js +11 -0
- package/dist/modules/session.js.map +1 -1
- package/dist/types/session.d.ts +7 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -320,6 +320,9 @@ await client.session.requestHistory();
|
|
|
320
320
|
|
|
321
321
|
// Configure proxy
|
|
322
322
|
await client.session.setProxy("socks5://user:pass@proxy:port", true);
|
|
323
|
+
|
|
324
|
+
// Set historyfor user
|
|
325
|
+
await client.session.setHistoryCount(100); // use 0 for disabled
|
|
323
326
|
```
|
|
324
327
|
|
|
325
328
|
### S3 Storage
|
|
@@ -676,6 +679,7 @@ const newUser = await client.admin.addUser(
|
|
|
676
679
|
mediaDelivery: "both",
|
|
677
680
|
retentionDays: 30,
|
|
678
681
|
},
|
|
682
|
+
history: 20, // Number of messages to save in the database, defaults to 0, which is disabled
|
|
679
683
|
},
|
|
680
684
|
{ token: "admin-token" }
|
|
681
685
|
);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { BaseClient } from '../client.js';
|
|
2
|
-
import { ConnectRequest, ConnectResponse, DisconnectResponse, LogoutResponse, StatusResponse, QRCodeResponse, S3TestResponse, PairPhoneResponse, HistoryResponse, ProxyResponse } from '../types/session.js';
|
|
2
|
+
import { ConnectRequest, ConnectResponse, DisconnectResponse, LogoutResponse, StatusResponse, QRCodeResponse, S3TestResponse, PairPhoneResponse, HistoryResponse, ProxyResponse, HistoryCountResponse } from '../types/session.js';
|
|
3
3
|
import { S3Config, RequestOptions, S3ConfigResponse } from '../types/common.js';
|
|
4
4
|
export declare class SessionModule extends BaseClient {
|
|
5
5
|
/**
|
|
@@ -48,6 +48,10 @@ export declare class SessionModule extends BaseClient {
|
|
|
48
48
|
* Request history sync from WhatsApp servers
|
|
49
49
|
*/
|
|
50
50
|
requestHistory(options?: RequestOptions): Promise<HistoryResponse>;
|
|
51
|
+
/**
|
|
52
|
+
* Set history count for WhatsApp synchronization
|
|
53
|
+
*/
|
|
54
|
+
setHistoryCount(history: number, options?: RequestOptions): Promise<HistoryCountResponse>;
|
|
51
55
|
/**
|
|
52
56
|
* Set proxy configuration
|
|
53
57
|
*/
|
package/dist/modules/session.js
CHANGED
|
@@ -73,6 +73,17 @@ class SessionModule extends client.BaseClient {
|
|
|
73
73
|
async requestHistory(options) {
|
|
74
74
|
return this.get("/session/history", options);
|
|
75
75
|
}
|
|
76
|
+
/**
|
|
77
|
+
* Set history count for WhatsApp synchronization
|
|
78
|
+
*/
|
|
79
|
+
async setHistoryCount(history, options) {
|
|
80
|
+
const request = { history };
|
|
81
|
+
return this.post(
|
|
82
|
+
"/session/history",
|
|
83
|
+
request,
|
|
84
|
+
options
|
|
85
|
+
);
|
|
86
|
+
}
|
|
76
87
|
/**
|
|
77
88
|
* Set proxy configuration
|
|
78
89
|
*/
|
|
@@ -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 S3TestResponse,\n PairPhoneRequest,\n PairPhoneResponse,\n HistoryResponse,\n ProxyRequest,\n ProxyResponse,\n} from \"../types/session.js\";\nimport { S3Config, RequestOptions, S3ConfigResponse } 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":";;;
|
|
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 S3TestResponse,\n PairPhoneRequest,\n PairPhoneResponse,\n HistoryResponse,\n ProxyRequest,\n ProxyResponse,\n HistoryCountRequest,\n HistoryCountResponse,\n} from \"../types/session.js\";\nimport { S3Config, RequestOptions, S3ConfigResponse } 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 history count for WhatsApp synchronization\n */\n async setHistoryCount(\n history: number,\n options?: RequestOptions\n ): Promise<HistoryCountResponse> {\n const request: HistoryCountRequest = { history };\n return this.post<HistoryCountResponse>(\n \"/session/history\",\n request,\n options\n );\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":";;;AAmBO,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;A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