wuzapi 1.6.0 → 1.6.2
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 +311 -53
- package/dist/index.js +7 -3
- package/dist/index.js.map +1 -1
- 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 +3 -3
- package/dist/modules/chat.js +8 -2
- package/dist/modules/chat.js.map +1 -1
- package/dist/modules/group.d.ts +1 -1
- package/dist/modules/group.js +6 -7
- package/dist/modules/group.js.map +1 -1
- package/dist/modules/session.js +1 -1
- package/dist/modules/session.js.map +1 -1
- package/dist/modules/user.d.ts +2 -2
- package/dist/modules/user.js +2 -2
- package/dist/modules/user.js.map +1 -1
- package/dist/modules/webhook.d.ts +12 -4
- package/dist/modules/webhook.js +22 -5
- package/dist/modules/webhook.js.map +1 -1
- package/dist/types/admin.d.ts +40 -7
- package/dist/types/chat.d.ts +2 -4
- package/dist/types/group.d.ts +4 -7
- package/dist/types/index.js +7 -12
- 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 -1
- package/dist/types/webhook.d.ts +71 -14
- package/dist/webhook.js +69 -0
- package/dist/webhook.js.map +1 -0
- package/package.json +1 -1
|
@@ -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":"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"}
|
package/dist/modules/session.js
CHANGED
|
@@ -77,7 +77,7 @@ class SessionModule extends client.BaseClient {
|
|
|
77
77
|
* Set proxy configuration
|
|
78
78
|
*/
|
|
79
79
|
async setProxy(proxyURL, enable = true, options) {
|
|
80
|
-
const request = {
|
|
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 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 = {
|
|
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 } from '../types/user.js';
|
|
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(presenceType: "available" | "unavailable", options?: RequestOptions): Promise<
|
|
24
|
+
sendPresence(presenceType: "available" | "unavailable", options?: RequestOptions): Promise<UserPresenceResponse>;
|
|
25
25
|
}
|
package/dist/modules/user.js
CHANGED
|
@@ -33,8 +33,8 @@ class UserModule extends client.BaseClient {
|
|
|
33
33
|
* Send user presence (available/unavailable status)
|
|
34
34
|
*/
|
|
35
35
|
async sendPresence(presenceType, options) {
|
|
36
|
-
const request = {
|
|
37
|
-
|
|
36
|
+
const request = { type: presenceType };
|
|
37
|
+
return this.post("/user/presence", request, options);
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
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 presenceType: \"available\" | \"unavailable\",\n options?: RequestOptions\n ): Promise<
|
|
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;;"}
|
|
@@ -1,21 +1,29 @@
|
|
|
1
1
|
import { BaseClient } from '../client.js';
|
|
2
2
|
import { RequestOptions } from '../types/common.js';
|
|
3
|
-
import { SetWebhookResponse, GetWebhookResponse, UpdateWebhookResponse, DeleteWebhookResponse } from '../types/webhook.js';
|
|
3
|
+
import { SetWebhookResponse, GetWebhookResponse, UpdateWebhookResponse, DeleteWebhookResponse, WebhookEventType, WebhookEvent } from '../types/webhook.js';
|
|
4
4
|
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?: (WebhookEvent | 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?: (WebhookEvent | string)[], active?: boolean, options?: RequestOptions): Promise<UpdateWebhookResponse>;
|
|
17
17
|
/**
|
|
18
18
|
* Delete webhook configuration
|
|
19
19
|
*/
|
|
20
20
|
deleteWebhook(options?: RequestOptions): Promise<DeleteWebhookResponse>;
|
|
21
|
+
/**
|
|
22
|
+
* Get all available webhook event types
|
|
23
|
+
*/
|
|
24
|
+
static getAvailableEvents(): string[];
|
|
25
|
+
/**
|
|
26
|
+
* Get webhook event types enum for type-safe access
|
|
27
|
+
*/
|
|
28
|
+
static get EventTypes(): typeof WebhookEventType;
|
|
21
29
|
}
|
package/dist/modules/webhook.js
CHANGED
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const client = require("../client.js");
|
|
4
|
+
const webhook = require("../webhook.js");
|
|
4
5
|
class WebhookModule extends client.BaseClient {
|
|
5
6
|
/**
|
|
6
7
|
* Set webhook URL and events to subscribe to
|
|
7
8
|
*/
|
|
8
|
-
async setWebhook(webhookURL, options) {
|
|
9
|
-
const request = { webhookURL };
|
|
9
|
+
async setWebhook(webhookURL, events = ["All"], options) {
|
|
10
|
+
const request = { webhook: webhookURL, events };
|
|
10
11
|
return this.post("/webhook", request, options);
|
|
11
12
|
}
|
|
12
13
|
/**
|
|
@@ -16,10 +17,14 @@ class WebhookModule extends client.BaseClient {
|
|
|
16
17
|
return this.get("/webhook", options);
|
|
17
18
|
}
|
|
18
19
|
/**
|
|
19
|
-
* Update webhook URL
|
|
20
|
+
* Update webhook URL, events, and activation status
|
|
20
21
|
*/
|
|
21
|
-
async updateWebhook(webhookURL, options) {
|
|
22
|
-
const request = {
|
|
22
|
+
async updateWebhook(webhookURL, events, active, options) {
|
|
23
|
+
const request = {
|
|
24
|
+
webhook: webhookURL,
|
|
25
|
+
events,
|
|
26
|
+
Active: active
|
|
27
|
+
};
|
|
23
28
|
return this.put("/webhook", request, options);
|
|
24
29
|
}
|
|
25
30
|
/**
|
|
@@ -28,6 +33,18 @@ class WebhookModule extends client.BaseClient {
|
|
|
28
33
|
async deleteWebhook(options) {
|
|
29
34
|
return this.delete("/webhook", options);
|
|
30
35
|
}
|
|
36
|
+
/**
|
|
37
|
+
* Get all available webhook event types
|
|
38
|
+
*/
|
|
39
|
+
static getAvailableEvents() {
|
|
40
|
+
return webhook.WEBHOOK_EVENTS;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* Get webhook event types enum for type-safe access
|
|
44
|
+
*/
|
|
45
|
+
static get EventTypes() {
|
|
46
|
+
return webhook.WebhookEventType;
|
|
47
|
+
}
|
|
31
48
|
}
|
|
32
49
|
exports.WebhookModule = WebhookModule;
|
|
33
50
|
//# sourceMappingURL=webhook.js.map
|
|
@@ -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 WebhookEventType,\n WebhookEvent,\n WEBHOOK_EVENTS,\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: (WebhookEvent | 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?: (WebhookEvent | 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 /**\n * Get all available webhook event types\n */\n static getAvailableEvents(): string[] {\n return WEBHOOK_EVENTS;\n }\n\n /**\n * Get webhook event types enum for type-safe access\n */\n static get EventTypes(): typeof WebhookEventType {\n return WebhookEventType;\n }\n}\n"],"names":["BaseClient","WEBHOOK_EVENTS","WebhookEventType"],"mappings":";;;;AAcO,MAAM,sBAAsBA,OAAAA,WAAW;AAAA;AAAA;AAAA;AAAA,EAI5C,MAAM,WACJ,YACA,SAAoC,CAAC,KAAK,GAC1C,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;AAAA;AAAA;AAAA;AAAA,EAKA,OAAO,qBAA+B;AACpC,WAAOC,QAAAA;AAAAA,EACT;AAAA;AAAA;AAAA;AAAA,EAKA,WAAW,aAAsC;AAC/C,WAAOC,QAAAA;AAAAA,EACT;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
|
@@ -94,9 +94,7 @@ export interface DownloadMediaResponse {
|
|
|
94
94
|
[key: string]: unknown;
|
|
95
95
|
}
|
|
96
96
|
export interface DeleteMessageRequest {
|
|
97
|
-
Phone: string;
|
|
98
97
|
Id: string;
|
|
99
|
-
Remote?: boolean;
|
|
100
98
|
}
|
|
101
99
|
export interface DeleteMessageResponse {
|
|
102
100
|
Details: string;
|
|
@@ -144,7 +142,7 @@ export interface SendPollRequest {
|
|
|
144
142
|
Id?: string;
|
|
145
143
|
}
|
|
146
144
|
export interface EditMessageRequest {
|
|
145
|
+
Id: string;
|
|
147
146
|
Phone: string;
|
|
148
|
-
|
|
149
|
-
NewText: string;
|
|
147
|
+
Body: string;
|
|
150
148
|
}
|
package/dist/types/group.d.ts
CHANGED
|
@@ -105,13 +105,10 @@ export interface GroupInviteInfoRequest {
|
|
|
105
105
|
Code: string;
|
|
106
106
|
}
|
|
107
107
|
export interface GroupInviteInfoResponse {
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
Owner: string;
|
|
113
|
-
Creation: string;
|
|
114
|
-
ParticipantsCount: number;
|
|
108
|
+
InviteInfo: {
|
|
109
|
+
GroupName: string;
|
|
110
|
+
GroupJID: string;
|
|
111
|
+
};
|
|
115
112
|
}
|
|
116
113
|
export interface GroupUpdateParticipantsRequest {
|
|
117
114
|
GroupJID: string;
|
package/dist/types/index.js
CHANGED
|
@@ -1,14 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
-
|
|
4
|
-
return !!payload.s3;
|
|
5
|
-
}
|
|
6
|
-
function hasBase64Media(payload) {
|
|
7
|
-
return !!payload.base64;
|
|
8
|
-
}
|
|
9
|
-
function hasBothMedia(payload) {
|
|
10
|
-
return hasS3Media(payload) && hasBase64Media(payload);
|
|
11
|
-
}
|
|
3
|
+
const webhook = require("../webhook.js");
|
|
12
4
|
var DisappearingModeInitiator = /* @__PURE__ */ ((DisappearingModeInitiator2) => {
|
|
13
5
|
DisappearingModeInitiator2[DisappearingModeInitiator2["CHANGED_IN_CHAT"] = 0] = "CHANGED_IN_CHAT";
|
|
14
6
|
DisappearingModeInitiator2[DisappearingModeInitiator2["INITIATED_BY_ME"] = 1] = "INITIATED_BY_ME";
|
|
@@ -361,6 +353,12 @@ var TempBanReason = /* @__PURE__ */ ((TempBanReason2) => {
|
|
|
361
353
|
TempBanReason2[TempBanReason2["BROADCAST_LIST"] = 106] = "BROADCAST_LIST";
|
|
362
354
|
return TempBanReason2;
|
|
363
355
|
})(TempBanReason || {});
|
|
356
|
+
exports.WEBHOOK_EVENTS = webhook.WEBHOOK_EVENTS;
|
|
357
|
+
exports.WebhookEventType = webhook.WebhookEventType;
|
|
358
|
+
exports.hasBase64Media = webhook.hasBase64Media;
|
|
359
|
+
exports.hasBothMedia = webhook.hasBothMedia;
|
|
360
|
+
exports.hasS3Media = webhook.hasS3Media;
|
|
361
|
+
exports.isValidWebhookPayload = webhook.isValidWebhookPayload;
|
|
364
362
|
exports.BotPluginSearchProvider = BotPluginSearchProvider;
|
|
365
363
|
exports.BotPluginType = BotPluginType;
|
|
366
364
|
exports.ButtonType = ButtonType;
|
|
@@ -390,7 +388,4 @@ exports.UnavailableType = UnavailableType;
|
|
|
390
388
|
exports.VideoAttribution = VideoAttribution;
|
|
391
389
|
exports.VideoSourceType = VideoSourceType;
|
|
392
390
|
exports.getMessageContent = getMessageContent;
|
|
393
|
-
exports.hasBase64Media = hasBase64Media;
|
|
394
|
-
exports.hasBothMedia = hasBothMedia;
|
|
395
|
-
exports.hasS3Media = hasS3Media;
|
|
396
391
|
//# sourceMappingURL=index.js.map
|