@raphaelvserafim/client-api-whatsapp 1.0.8 → 1.2.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 +512 -297
- package/dist/WhatsApp.d.ts +142 -31
- package/dist/WhatsApp.js +111 -167
- package/dist/WhatsApp.js.map +1 -1
- package/dist/client/HttpClient.d.ts +6 -0
- package/dist/client/HttpClient.js +29 -0
- package/dist/client/HttpClient.js.map +1 -0
- package/dist/client/IHttpClient.d.ts +9 -0
- package/dist/client/IHttpClient.js +3 -0
- package/dist/client/IHttpClient.js.map +1 -0
- package/dist/errors.d.ts +5 -0
- package/dist/errors.js +13 -0
- package/dist/errors.js.map +1 -0
- package/dist/index.d.ts +14 -1
- package/dist/index.js +33 -3
- package/dist/index.js.map +1 -1
- package/dist/services/ActionService.d.ts +9 -0
- package/dist/services/ActionService.js +32 -0
- package/dist/services/ActionService.js.map +1 -0
- package/dist/services/BusinessService.d.ts +10 -0
- package/dist/services/BusinessService.js +43 -0
- package/dist/services/BusinessService.js.map +1 -0
- package/dist/services/CallService.d.ts +8 -0
- package/dist/services/CallService.js +24 -0
- package/dist/services/CallService.js.map +1 -0
- package/dist/services/ChatService.d.ts +16 -0
- package/dist/services/ChatService.js +38 -0
- package/dist/services/ChatService.js.map +1 -0
- package/dist/services/CommunityService.d.ts +28 -0
- package/dist/services/CommunityService.js +76 -0
- package/dist/services/CommunityService.js.map +1 -0
- package/dist/services/ContactService.d.ts +15 -0
- package/dist/services/ContactService.js +30 -0
- package/dist/services/ContactService.js.map +1 -0
- package/dist/services/GroupService.d.ts +32 -0
- package/dist/services/GroupService.js +104 -0
- package/dist/services/GroupService.js.map +1 -0
- package/dist/services/InstanceService.d.ts +28 -0
- package/dist/services/InstanceService.js +124 -0
- package/dist/services/InstanceService.js.map +1 -0
- package/dist/services/LabelService.d.ts +17 -0
- package/dist/services/LabelService.js +43 -0
- package/dist/services/LabelService.js.map +1 -0
- package/dist/services/MessageService.d.ts +51 -0
- package/dist/services/MessageService.js +106 -0
- package/dist/services/MessageService.js.map +1 -0
- package/dist/types/index.d.ts +155 -11
- package/dist/types/index.js +10 -0
- package/dist/types/index.js.map +1 -1
- package/package.json +6 -11
- package/.babelrc +0 -3
- package/dist/exemple.d.ts +0 -1
- package/dist/exemple.js +0 -264
- package/dist/exemple.js.map +0 -1
- package/src/WhatsApp.ts +0 -245
- package/src/exemple.ts +0 -312
- package/src/index.ts +0 -2
- package/src/types/index.ts +0 -190
- package/tsconfig.compile.json +0 -15
- package/tsconfig.json +0 -35
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"GroupService.js","sourceRoot":"","sources":["../../src/services/GroupService.ts"],"names":[],"mappings":";;;AACA,oCAGkB;AAElB,MAAa,YAAY;IACvB,YAA6B,IAAiB;QAAjB,SAAI,GAAJ,IAAI,CAAa;IAAG,CAAC;IAElD,KAAK,CAAC,IAAI;QACR,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAwC;YAC9D,KAAK,EAAE,cAAM,CAAC,MAAM;YACpB,MAAM,EAAE,kBAAU,CAAC,GAAG;SACvB,CAAC,CAAC;IACL,CAAC;IAED,KAAK,CAAC,IAAI,CAAC,EAAU;QACnB,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAsC;YAC5D,KAAK,EAAE,GAAG,cAAM,CAAC,MAAM,IAAI,EAAE,EAAE;YAC/B,MAAM,EAAE,kBAAU,CAAC,GAAG;SACvB,CAAC,CAAC;IACL,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,IAAY,EAAE,YAAsB;QAC/C,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAsC;YAC5D,KAAK,EAAE,cAAM,CAAC,MAAM;YACpB,MAAM,EAAE,kBAAU,CAAC,IAAI;YACvB,IAAI,EAAE,EAAE,IAAI,EAAE,YAAY,EAAE;SAC7B,CAAC,CAAC;IACL,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,EAAU,E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AC,yBAAyB,CAAC,EAAU,EAAE,IAA6B;QACvE,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAc;YACpC,KAAK,EAAE,GAAG,cAAM,CAAC,MAAM,IAAI,EAAE,4BAA4B;YACzD,MAAM,EAAE,kBAAU,CAAC,GAAG;YACtB,IAAI,EAAE,IAAI;SACX,CAAC,CAAC;IACL,CAAC;CACF;AA7GD,oCA6GC","sourcesContent":["import { IHttpClient } from '../client/IHttpClient';\nimport {\n Routes, HttpMethod, ApiResponse, GroupInfo, InviteCodeResponse,\n GroupParticipant, GroupParticipantsAction,\n} from '../types';\n\nexport class GroupService {\n constructor(private readonly http: IHttpClient) {}\n\n async list(): Promise<{ status: number; data: GroupInfo[] }> {\n return this.http.request<{ status: number; data: GroupInfo[] }>({\n route: Routes.GROUPS,\n method: HttpMethod.GET,\n });\n }\n\n async info(id: string): Promise<{ status: number; data: GroupInfo }> {\n return this.http.request<{ status: number; data: GroupInfo }>({\n route: `${Routes.GROUPS}/${id}`,\n method: HttpMethod.GET,\n });\n }\n\n async create(name: string, participants: string[]): Promise<{ status: number; data: GroupInfo }> {\n return this.http.request<{ status: number; data: GroupInfo }>({\n route: Routes.GROUPS,\n method: HttpMethod.POST,\n body: { name, participants },\n });\n }\n\n async update(id: string, name: string, description: string): Promise<ApiResponse> {\n return this.http.request<ApiResponse>({\n route: `${Routes.GROUPS}/${id}`,\n method: HttpMethod.PUT,\n body: { name, description },\n });\n }\n\n async changeSettings(id: string, setting: 'announcement' | 'not_announcement' | 'locked' | 'unlocked'): Promise<ApiResponse> {\n return this.http.request<ApiResponse>({\n route: `${Routes.GROUPS}/${id}`,\n method: HttpMethod.PATCH,\n params: { setting },\n });\n }\n\n async leave(id: string): Promise<ApiResponse> {\n return this.http.request<ApiResponse>({\n route: `${Routes.GROUPS}/${id}`,\n method: HttpMethod.DELETE,\n });\n }\n\n async getInviteCode(id: string): Promise<InviteCodeResponse> {\n return this.http.request<InviteCodeResponse>({\n route: `${Routes.GROUPS}/${id}/invite`,\n method: HttpMethod.GET,\n });\n }\n\n async updatePicture(id: string, url: string): Promise<ApiResponse> {\n return this.http.request<ApiResponse>({\n route: `${Routes.GROUPS}/${id}/picture`,\n method: HttpMethod.PUT,\n body: { url },\n });\n }\n\n async removePicture(id: string): Promise<ApiResponse> {\n return this.http.request<ApiResponse>({\n route: `${Routes.GROUPS}/${id}/picture`,\n method: HttpMethod.DELETE,\n });\n }\n\n async addParticipants(id: string, participants: string[]): Promise<ApiResponse> {\n return this.http.request<ApiResponse>({\n route: `${Routes.GROUPS}/${id}/participants`,\n method: HttpMethod.POST,\n body: { participants },\n });\n }\n\n async removeParticipants(id: string, participants: string[]): Promise<ApiResponse> {\n return this.http.request<ApiResponse>({\n route: `${Routes.GROUPS}/${id}/participants`,\n method: HttpMethod.DELETE,\n body: { participants },\n });\n }\n\n async updateParticipantRole(id: string, action: 'promote' | 'demote', participants: string[]): Promise<ApiResponse> {\n return this.http.request<ApiResponse>({\n route: `${Routes.GROUPS}/${id}/role`,\n method: HttpMethod.PATCH,\n body: { participants },\n params: { action },\n });\n }\n\n async getRequestParticipants(id: string): Promise<{ status: number; data: GroupParticipant[] }> {\n return this.http.request<{ status: number; data: GroupParticipant[] }>({\n route: `${Routes.GROUPS}/${id}/request_participants_list`,\n method: HttpMethod.GET,\n });\n }\n\n async updateRequestParticipants(id: string, data: GroupParticipantsAction): Promise<ApiResponse> {\n return this.http.request<ApiResponse>({\n route: `${Routes.GROUPS}/${id}/request_participants_list`,\n method: HttpMethod.PUT,\n body: data,\n });\n }\n}\n"]}
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { IHttpClient } from '../client/IHttpClient';
|
|
2
|
+
import { WebhookBody, InfoInstance, Connect, ApiResponse, PairingCodeResponse, MobileRegisterData, WebhookStatistics } from '../types';
|
|
3
|
+
export declare class InstanceService {
|
|
4
|
+
private readonly http;
|
|
5
|
+
constructor(http: IHttpClient);
|
|
6
|
+
connect(): Promise<Connect>;
|
|
7
|
+
info(): Promise<InfoInstance>;
|
|
8
|
+
logout(): Promise<ApiResponse>;
|
|
9
|
+
setting(data: {
|
|
10
|
+
markMessageRead: boolean;
|
|
11
|
+
saveMedia: boolean;
|
|
12
|
+
receiveStatusMessage: boolean;
|
|
13
|
+
receivePresence: boolean;
|
|
14
|
+
}): Promise<ApiResponse>;
|
|
15
|
+
updateWebhook(body: WebhookBody): Promise<ApiResponse>;
|
|
16
|
+
pairingCode(phoneNumber: string): Promise<PairingCodeResponse>;
|
|
17
|
+
addMongoDb(uri: string, dbName: string): Promise<ApiResponse>;
|
|
18
|
+
setProxy(proxy: string): Promise<ApiResponse>;
|
|
19
|
+
restart(): Promise<ApiResponse>;
|
|
20
|
+
updateProfileStatus(text: string): Promise<ApiResponse>;
|
|
21
|
+
updateProfilePicture(url: string): Promise<ApiResponse>;
|
|
22
|
+
removeProfilePicture(): Promise<ApiResponse>;
|
|
23
|
+
updateProfileName(name: string): Promise<ApiResponse>;
|
|
24
|
+
mobileRegisterPrepare(data: MobileRegisterData): Promise<ApiResponse>;
|
|
25
|
+
mobileRequestCode(method: string): Promise<ApiResponse>;
|
|
26
|
+
mobileVerifyCode(code: string): Promise<ApiResponse>;
|
|
27
|
+
webhookStatistics(): Promise<WebhookStatistics>;
|
|
28
|
+
}
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.InstanceService = void 0;
|
|
4
|
+
const types_1 = require("../types");
|
|
5
|
+
class InstanceService {
|
|
6
|
+
constructor(http) {
|
|
7
|
+
this.http = http;
|
|
8
|
+
}
|
|
9
|
+
async connect() {
|
|
10
|
+
return this.http.request({
|
|
11
|
+
route: types_1.Routes.INSTANCES,
|
|
12
|
+
method: types_1.HttpMethod.POST,
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
async info() {
|
|
16
|
+
return this.http.request({
|
|
17
|
+
route: types_1.Routes.INSTANCES,
|
|
18
|
+
method: types_1.HttpMethod.GET,
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
async logout() {
|
|
22
|
+
return this.http.request({
|
|
23
|
+
route: types_1.Routes.INSTANCES,
|
|
24
|
+
method: types_1.HttpMethod.DELETE,
|
|
25
|
+
});
|
|
26
|
+
}
|
|
27
|
+
async setting(data) {
|
|
28
|
+
return this.http.request({
|
|
29
|
+
route: types_1.Routes.INSTANCES,
|
|
30
|
+
method: types_1.HttpMethod.PATCH,
|
|
31
|
+
params: data,
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
async updateWebhook(body) {
|
|
35
|
+
return this.http.request({
|
|
36
|
+
route: types_1.Routes.INSTANCES,
|
|
37
|
+
method: types_1.HttpMethod.PUT,
|
|
38
|
+
body,
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
async pairingCode(phoneNumber) {
|
|
42
|
+
return this.http.request({
|
|
43
|
+
route: `${types_1.Routes.INSTANCES}/pairing-code`,
|
|
44
|
+
method: types_1.HttpMethod.POST,
|
|
45
|
+
body: { phoneNumber },
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
async addMongoDb(uri, dbName) {
|
|
49
|
+
return this.http.request({
|
|
50
|
+
route: `${types_1.Routes.INSTANCES}/mongodb`,
|
|
51
|
+
method: types_1.HttpMethod.POST,
|
|
52
|
+
body: { uri, dbName },
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
async setProxy(proxy) {
|
|
56
|
+
return this.http.request({
|
|
57
|
+
route: `${types_1.Routes.INSTANCES}/proxy`,
|
|
58
|
+
method: types_1.HttpMethod.POST,
|
|
59
|
+
body: { proxy },
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
async restart() {
|
|
63
|
+
return this.http.request({
|
|
64
|
+
route: `${types_1.Routes.INSTANCES}/restart`,
|
|
65
|
+
method: types_1.HttpMethod.POST,
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
async updateProfileStatus(text) {
|
|
69
|
+
return this.http.request({
|
|
70
|
+
route: `${types_1.Routes.INSTANCES}/status`,
|
|
71
|
+
method: types_1.HttpMethod.PUT,
|
|
72
|
+
body: { text },
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
async updateProfilePicture(url) {
|
|
76
|
+
return this.http.request({
|
|
77
|
+
route: `${types_1.Routes.INSTANCES}/profile/picture`,
|
|
78
|
+
method: types_1.HttpMethod.PUT,
|
|
79
|
+
body: { url },
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
async removeProfilePicture() {
|
|
83
|
+
return this.http.request({
|
|
84
|
+
route: `${types_1.Routes.INSTANCES}/profile/picture`,
|
|
85
|
+
method: types_1.HttpMethod.DELETE,
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
async updateProfileName(name) {
|
|
89
|
+
return this.http.request({
|
|
90
|
+
route: `${types_1.Routes.INSTANCES}/profile/name`,
|
|
91
|
+
method: types_1.HttpMethod.PUT,
|
|
92
|
+
body: { name },
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
async mobileRegisterPrepare(data) {
|
|
96
|
+
return this.http.request({
|
|
97
|
+
route: `${types_1.Routes.INSTANCES}/mobile/prepare`,
|
|
98
|
+
method: types_1.HttpMethod.POST,
|
|
99
|
+
body: data,
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
async mobileRequestCode(method) {
|
|
103
|
+
return this.http.request({
|
|
104
|
+
route: `${types_1.Routes.INSTANCES}/mobile/request-code`,
|
|
105
|
+
method: types_1.HttpMethod.POST,
|
|
106
|
+
body: { method },
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
async mobileVerifyCode(code) {
|
|
110
|
+
return this.http.request({
|
|
111
|
+
route: `${types_1.Routes.INSTANCES}/mobile/verify`,
|
|
112
|
+
method: types_1.HttpMethod.POST,
|
|
113
|
+
body: { code },
|
|
114
|
+
});
|
|
115
|
+
}
|
|
116
|
+
async webhookStatistics() {
|
|
117
|
+
return this.http.request({
|
|
118
|
+
route: `${types_1.Routes.INSTANCES}/webhook/statistics`,
|
|
119
|
+
method: types_1.HttpMethod.GET,
|
|
120
|
+
});
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
exports.InstanceService = InstanceService;
|
|
124
|
+
//# sourceMappingURL=InstanceService.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"InstanceService.js","sourceRoot":"","sources":["../../src/services/InstanceService.ts"],"names":[],"mappings":";;;AACA,oCAGkB;AAElB,MAAa,eAAe;IAC1B,YAA6B,IAAiB;QAAjB,SAAI,GAAJ,IAAI,CAAa;IAAG,CAAC;IAElD,KAAK,CAAC,OAAO;QACX,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAU;YAChC,KAAK,EAAE,cAAM,CAAC,SAAS;YACvB,MAAM,EAAE,kBAAU,CAAC,IAAI;SACxB,CAAC,CAAC;IACL,CAAC;IAED,KAAK,CAAC,IAAI;QACR,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAe;YACrC,KAAK,EAAE,cAAM,CAAC,SAAS;YACvB,MAAM,EAAE,kBAAU,CAAC,GAAG;SACvB,CAAC,CAAC;IACL,CAAC;IAED,KAAK,CAAC,MAAM;QACV,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAc;YACpC,KAAK,EAAE,cAAM,CAAC,SAAS;YACvB,MAAM,EAAE,kBAAU,CAAC,MAAM;SAC1B,CAAC,CAAC;IACL,CAAC;IAED,KAAK,CAAC,OAAO,CAAC,IAA+G;QAC3H,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAc;YACpC,KAAK,EAAE,cAAM,CAAC,SAAS;YACvB,MAAM,EAAE,kBAAU,CAAC,KAAK;YACxB,MAAM,EAAE,IAAI;SACb,CAAC,CAAC;IACL,CAAC;IAED,KAAK,CAAC,aAAa,CAAC,IAAiB;QACnC,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAc;YACpC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OAAO,CAAc;YACpC,KAAK,EAAE,GAAG,cAAM,CAAC,SAAS,gBAAgB;YAC1C,MAAM,EAAE,kBAAU,CAAC,IAAI;YACvB,IAAI,EAAE,EAAE,IAAI,EAAE;SACf,CAAC,CAAC;IACL,CAAC;IAED,KAAK,CAAC,iBAAiB;QACrB,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAoB;YAC1C,KAAK,EAAE,GAAG,cAAM,CAAC,SAAS,qBAAqB;YAC/C,MAAM,EAAE,kBAAU,CAAC,GAAG;SACvB,CAAC,CAAC;IACL,CAAC;CACF;AApID,0CAoIC","sourcesContent":["import { IHttpClient } from '../client/IHttpClient';\nimport {\n Routes, HttpMethod, WebhookBody, InfoInstance, Connect,\n ApiResponse, PairingCodeResponse, MobileRegisterData, WebhookStatistics,\n} from '../types';\n\nexport class InstanceService {\n constructor(private readonly http: IHttpClient) {}\n\n async connect(): Promise<Connect> {\n return this.http.request<Connect>({\n route: Routes.INSTANCES,\n method: HttpMethod.POST,\n });\n }\n\n async info(): Promise<InfoInstance> {\n return this.http.request<InfoInstance>({\n route: Routes.INSTANCES,\n method: HttpMethod.GET,\n });\n }\n\n async logout(): Promise<ApiResponse> {\n return this.http.request<ApiResponse>({\n route: Routes.INSTANCES,\n method: HttpMethod.DELETE,\n });\n }\n\n async setting(data: { markMessageRead: boolean; saveMedia: boolean; receiveStatusMessage: boolean; receivePresence: boolean }): Promise<ApiResponse> {\n return this.http.request<ApiResponse>({\n route: Routes.INSTANCES,\n method: HttpMethod.PATCH,\n params: data,\n });\n }\n\n async updateWebhook(body: WebhookBody): Promise<ApiResponse> {\n return this.http.request<ApiResponse>({\n route: Routes.INSTANCES,\n method: HttpMethod.PUT,\n body,\n });\n }\n\n async pairingCode(phoneNumber: string): Promise<PairingCodeResponse> {\n return this.http.request<PairingCodeResponse>({\n route: `${Routes.INSTANCES}/pairing-code`,\n method: HttpMethod.POST,\n body: { phoneNumber },\n });\n }\n\n async addMongoDb(uri: string, dbName: string): Promise<ApiResponse> {\n return this.http.request<ApiResponse>({\n route: `${Routes.INSTANCES}/mongodb`,\n method: HttpMethod.POST,\n body: { uri, dbName },\n });\n }\n\n async setProxy(proxy: string): Promise<ApiResponse> {\n return this.http.request<ApiResponse>({\n route: `${Routes.INSTANCES}/proxy`,\n method: HttpMethod.POST,\n body: { proxy },\n });\n }\n\n async restart(): Promise<ApiResponse> {\n return this.http.request<ApiResponse>({\n route: `${Routes.INSTANCES}/restart`,\n method: HttpMethod.POST,\n });\n }\n\n async updateProfileStatus(text: string): Promise<ApiResponse> {\n return this.http.request<ApiResponse>({\n route: `${Routes.INSTANCES}/status`,\n method: HttpMethod.PUT,\n body: { text },\n });\n }\n\n async updateProfilePicture(url: string): Promise<ApiResponse> {\n return this.http.request<ApiResponse>({\n route: `${Routes.INSTANCES}/profile/picture`,\n method: HttpMethod.PUT,\n body: { url },\n });\n }\n\n async removeProfilePicture(): Promise<ApiResponse> {\n return this.http.request<ApiResponse>({\n route: `${Routes.INSTANCES}/profile/picture`,\n method: HttpMethod.DELETE,\n });\n }\n\n async updateProfileName(name: string): Promise<ApiResponse> {\n return this.http.request<ApiResponse>({\n route: `${Routes.INSTANCES}/profile/name`,\n method: HttpMethod.PUT,\n body: { name },\n });\n }\n\n async mobileRegisterPrepare(data: MobileRegisterData): Promise<ApiResponse> {\n return this.http.request<ApiResponse>({\n route: `${Routes.INSTANCES}/mobile/prepare`,\n method: HttpMethod.POST,\n body: data,\n });\n }\n\n async mobileRequestCode(method: string): Promise<ApiResponse> {\n return this.http.request<ApiResponse>({\n route: `${Routes.INSTANCES}/mobile/request-code`,\n method: HttpMethod.POST,\n body: { method },\n });\n }\n\n async mobileVerifyCode(code: string): Promise<ApiResponse> {\n return this.http.request<ApiResponse>({\n route: `${Routes.INSTANCES}/mobile/verify`,\n method: HttpMethod.POST,\n body: { code },\n });\n }\n\n async webhookStatistics(): Promise<WebhookStatistics> {\n return this.http.request<WebhookStatistics>({\n route: `${Routes.INSTANCES}/webhook/statistics`,\n method: HttpMethod.GET,\n });\n }\n}\n"]}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { IHttpClient } from '../client/IHttpClient';
|
|
2
|
+
import { ApiResponse, LabelInfo, ChatInfo } from '../types';
|
|
3
|
+
export declare class LabelService {
|
|
4
|
+
private readonly http;
|
|
5
|
+
constructor(http: IHttpClient);
|
|
6
|
+
list(): Promise<{
|
|
7
|
+
status: number;
|
|
8
|
+
data: LabelInfo[];
|
|
9
|
+
}>;
|
|
10
|
+
create(name: string, labelId?: string): Promise<ApiResponse>;
|
|
11
|
+
getChats(labelId: string): Promise<{
|
|
12
|
+
status: number;
|
|
13
|
+
data: ChatInfo[];
|
|
14
|
+
}>;
|
|
15
|
+
addToChat(labelId: string, to: string): Promise<ApiResponse>;
|
|
16
|
+
removeFromChat(labelId: string, to: string): Promise<ApiResponse>;
|
|
17
|
+
}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.LabelService = void 0;
|
|
4
|
+
const types_1 = require("../types");
|
|
5
|
+
class LabelService {
|
|
6
|
+
constructor(http) {
|
|
7
|
+
this.http = http;
|
|
8
|
+
}
|
|
9
|
+
async list() {
|
|
10
|
+
return this.http.request({
|
|
11
|
+
route: types_1.Routes.LABELS,
|
|
12
|
+
method: types_1.HttpMethod.GET,
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
async create(name, labelId) {
|
|
16
|
+
return this.http.request({
|
|
17
|
+
route: types_1.Routes.LABELS,
|
|
18
|
+
method: types_1.HttpMethod.POST,
|
|
19
|
+
body: { name, labelId },
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
async getChats(labelId) {
|
|
23
|
+
return this.http.request({
|
|
24
|
+
route: `${types_1.Routes.LABELS}/${labelId}`,
|
|
25
|
+
method: types_1.HttpMethod.GET,
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
async addToChat(labelId, to) {
|
|
29
|
+
return this.http.request({
|
|
30
|
+
route: `${types_1.Routes.LABELS}/${labelId}`,
|
|
31
|
+
method: types_1.HttpMethod.POST,
|
|
32
|
+
body: { to },
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
async removeFromChat(labelId, to) {
|
|
36
|
+
return this.http.request({
|
|
37
|
+
route: `${types_1.Routes.LABELS}/${labelId}/${to}`,
|
|
38
|
+
method: types_1.HttpMethod.DELETE,
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
exports.LabelService = LabelService;
|
|
43
|
+
//# sourceMappingURL=LabelService.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LabelService.js","sourceRoot":"","sources":["../../src/services/LabelService.ts"],"names":[],"mappings":";;;AACA,oCAAgF;AAEhF,MAAa,YAAY;IACvB,YAA6B,IAAiB;QAAjB,SAAI,GAAJ,IAAI,CAAa;IAAG,CAAC;IAElD,KAAK,CAAC,IAAI;QACR,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAwC;YAC9D,KAAK,EAAE,cAAM,CAAC,MAAM;YACpB,MAAM,EAAE,kBAAU,CAAC,GAAG;SACvB,CAAC,CAAC;IACL,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,IAAY,EAAE,OAAgB;QACzC,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAc;YACpC,KAAK,EAAE,cAAM,CAAC,MAAM;YACpB,MAAM,EAAE,kBAAU,CAAC,IAAI;YACvB,IAAI,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE;SACxB,CAAC,CAAC;IACL,CAAC;IAED,KAAK,CAAC,QAAQ,CAAC,OAAe;QAC5B,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAuC;YAC7D,KAAK,EAAE,GAAG,cAAM,CAAC,MAAM,IAAI,OAAO,EAAE;YACpC,MAAM,EAAE,kBAAU,CAAC,GAAG;SACvB,CAAC,CAAC;IACL,CAAC;IAED,KAAK,CAAC,SAAS,CAAC,OAAe,EAAE,EAAU;QACzC,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAc;YACpC,KAAK,EAAE,GAAG,cAAM,CAAC,MAAM,IAAI,OAAO,EAAE;YACpC,MAAM,EAAE,kBAAU,CAAC,IAAI;YACvB,IAAI,EAAE,EAAE,EAAE,EAAE;SACb,CAAC,CAAC;IACL,CAAC;IAED,KAAK,CAAC,cAAc,CAAC,OAAe,EAAE,EAAU;QAC9C,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAc;YACpC,KAAK,EAAE,GAAG,cAAM,CAAC,MAAM,IAAI,OAAO,IAAI,EAAE,EAAE;YAC1C,MAAM,EAAE,kBAAU,CAAC,MAAM;SAC1B,CAAC,CAAC;IACL,CAAC;CACF;AAvCD,oCAuCC","sourcesContent":["import { IHttpClient } from '../client/IHttpClient';\nimport { Routes, HttpMethod, ApiResponse, LabelInfo, ChatInfo } from '../types';\n\nexport class LabelService {\n constructor(private readonly http: IHttpClient) {}\n\n async list(): Promise<{ status: number; data: LabelInfo[] }> {\n return this.http.request<{ status: number; data: LabelInfo[] }>({\n route: Routes.LABELS,\n method: HttpMethod.GET,\n });\n }\n\n async create(name: string, labelId?: string): Promise<ApiResponse> {\n return this.http.request<ApiResponse>({\n route: Routes.LABELS,\n method: HttpMethod.POST,\n body: { name, labelId },\n });\n }\n\n async getChats(labelId: string): Promise<{ status: number; data: ChatInfo[] }> {\n return this.http.request<{ status: number; data: ChatInfo[] }>({\n route: `${Routes.LABELS}/${labelId}`,\n method: HttpMethod.GET,\n });\n }\n\n async addToChat(labelId: string, to: string): Promise<ApiResponse> {\n return this.http.request<ApiResponse>({\n route: `${Routes.LABELS}/${labelId}`,\n method: HttpMethod.POST,\n body: { to },\n });\n }\n\n async removeFromChat(labelId: string, to: string): Promise<ApiResponse> {\n return this.http.request<ApiResponse>({\n route: `${Routes.LABELS}/${labelId}/${to}`,\n method: HttpMethod.DELETE,\n });\n }\n}\n"]}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { IHttpClient } from '../client/IHttpClient';
|
|
2
|
+
import { TypeMessage, StatusPresence, Contact, Section, Location, Buttons, Items, HeaderMedia, SendMessageRoot, ApiResponse, EventData, ListMessagesResponse } from '../types';
|
|
3
|
+
export declare class MessageService {
|
|
4
|
+
private readonly http;
|
|
5
|
+
constructor(http: IHttpClient);
|
|
6
|
+
list(phoneNumber: string, page?: number, limit?: number): Promise<ListMessagesResponse>;
|
|
7
|
+
send(data: {
|
|
8
|
+
type: TypeMessage;
|
|
9
|
+
body: {
|
|
10
|
+
to: string;
|
|
11
|
+
msgId?: string;
|
|
12
|
+
header?: HeaderMedia;
|
|
13
|
+
status?: StatusPresence;
|
|
14
|
+
text?: string;
|
|
15
|
+
url?: string;
|
|
16
|
+
caption?: string;
|
|
17
|
+
mimetype?: string;
|
|
18
|
+
fileName?: string;
|
|
19
|
+
contact?: Contact;
|
|
20
|
+
location?: Location;
|
|
21
|
+
name?: string;
|
|
22
|
+
options?: string[];
|
|
23
|
+
sections?: Section[];
|
|
24
|
+
buttons?: Buttons[];
|
|
25
|
+
footer?: string;
|
|
26
|
+
description?: string;
|
|
27
|
+
title?: string;
|
|
28
|
+
buttonText?: string;
|
|
29
|
+
thumbnailUrl?: string;
|
|
30
|
+
sourceUrl?: string;
|
|
31
|
+
referenceId?: string;
|
|
32
|
+
code?: string;
|
|
33
|
+
key?: string;
|
|
34
|
+
merchantName?: string;
|
|
35
|
+
keyType?: "CNPJ" | "CPF" | "EMAIL" | "PHONE";
|
|
36
|
+
subtotal?: string;
|
|
37
|
+
totalAmount?: string;
|
|
38
|
+
items?: Items[];
|
|
39
|
+
};
|
|
40
|
+
}, reply?: boolean): Promise<SendMessageRoot>;
|
|
41
|
+
forward(to: string, msgId: string): Promise<SendMessageRoot>;
|
|
42
|
+
sendSticker(to: string, url: string): Promise<SendMessageRoot>;
|
|
43
|
+
sendVideoNote(to: string, url: string): Promise<SendMessageRoot>;
|
|
44
|
+
sendPoll(to: string, name: string, values: Array<string | number | boolean>, selectableCount?: number): Promise<SendMessageRoot>;
|
|
45
|
+
sendEvent(data: EventData): Promise<SendMessageRoot>;
|
|
46
|
+
pin(id: string, duration?: number): Promise<ApiResponse>;
|
|
47
|
+
sendCallLink(to: string, type: string, caption?: string): Promise<SendMessageRoot>;
|
|
48
|
+
sendImageBase64(to: string, base64: string, caption?: string): Promise<SendMessageRoot>;
|
|
49
|
+
sendAudioBase64(to: string, base64: string): Promise<SendMessageRoot>;
|
|
50
|
+
sendDocumentBase64(to: string, base64: string, mimetype: string, fileName?: string, caption?: string): Promise<SendMessageRoot>;
|
|
51
|
+
}
|
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.MessageService = void 0;
|
|
4
|
+
const errors_1 = require("../errors");
|
|
5
|
+
const types_1 = require("../types");
|
|
6
|
+
class MessageService {
|
|
7
|
+
constructor(http) {
|
|
8
|
+
this.http = http;
|
|
9
|
+
}
|
|
10
|
+
async list(phoneNumber, page, limit) {
|
|
11
|
+
const params = { phoneNumber };
|
|
12
|
+
if (page !== undefined)
|
|
13
|
+
params.page = page;
|
|
14
|
+
if (limit !== undefined)
|
|
15
|
+
params.limit = limit;
|
|
16
|
+
return this.http.request({
|
|
17
|
+
route: types_1.Routes.MESSAGES,
|
|
18
|
+
method: types_1.HttpMethod.GET,
|
|
19
|
+
params,
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
async send(data, reply = false) {
|
|
23
|
+
if (data.type === types_1.TypeMessage.BUTTON_PIX) {
|
|
24
|
+
const { key, keyType, merchantName, subtotal, totalAmount, items } = data.body;
|
|
25
|
+
if (!key || !keyType || !merchantName || !subtotal || !totalAmount || !items || items.length === 0) {
|
|
26
|
+
throw new errors_1.WhatsAppError("Campos obrigatorios para pagamento via PIX estao ausentes.");
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
const route = reply
|
|
30
|
+
? `${types_1.Routes.MESSAGES}/${data.body.msgId}/${data.type}`
|
|
31
|
+
: `${types_1.Routes.MESSAGES}/${data.type}`;
|
|
32
|
+
return this.http.request({ route, method: types_1.HttpMethod.POST, body: data.body });
|
|
33
|
+
}
|
|
34
|
+
async forward(to, msgId) {
|
|
35
|
+
return this.http.request({
|
|
36
|
+
route: `${types_1.Routes.MESSAGES}/${msgId}/forwarding`,
|
|
37
|
+
method: types_1.HttpMethod.POST,
|
|
38
|
+
body: { to },
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
async sendSticker(to, url) {
|
|
42
|
+
return this.http.request({
|
|
43
|
+
route: `${types_1.Routes.MESSAGES}/sticker`,
|
|
44
|
+
method: types_1.HttpMethod.POST,
|
|
45
|
+
body: { to, url },
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
async sendVideoNote(to, url) {
|
|
49
|
+
return this.http.request({
|
|
50
|
+
route: `${types_1.Routes.MESSAGES}/video-note`,
|
|
51
|
+
method: types_1.HttpMethod.POST,
|
|
52
|
+
body: { to, url },
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
async sendPoll(to, name, values, selectableCount) {
|
|
56
|
+
return this.http.request({
|
|
57
|
+
route: `${types_1.Routes.MESSAGES}/poll`,
|
|
58
|
+
method: types_1.HttpMethod.POST,
|
|
59
|
+
body: { to, name, values, selectableCount },
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
async sendEvent(data) {
|
|
63
|
+
return this.http.request({
|
|
64
|
+
route: `${types_1.Routes.MESSAGES}/event`,
|
|
65
|
+
method: types_1.HttpMethod.POST,
|
|
66
|
+
body: data,
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
async pin(id, duration) {
|
|
70
|
+
return this.http.request({
|
|
71
|
+
route: `${types_1.Routes.MESSAGES}/pin`,
|
|
72
|
+
method: types_1.HttpMethod.POST,
|
|
73
|
+
body: { id, duration },
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
async sendCallLink(to, type, caption) {
|
|
77
|
+
return this.http.request({
|
|
78
|
+
route: `${types_1.Routes.MESSAGES}/call-link`,
|
|
79
|
+
method: types_1.HttpMethod.POST,
|
|
80
|
+
body: { to, type, caption },
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
async sendImageBase64(to, base64, caption) {
|
|
84
|
+
return this.http.request({
|
|
85
|
+
route: `${types_1.Routes.MESSAGES}/base64/image`,
|
|
86
|
+
method: types_1.HttpMethod.POST,
|
|
87
|
+
body: { to, base64, caption },
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
async sendAudioBase64(to, base64) {
|
|
91
|
+
return this.http.request({
|
|
92
|
+
route: `${types_1.Routes.MESSAGES}/base64/audio`,
|
|
93
|
+
method: types_1.HttpMethod.POST,
|
|
94
|
+
body: { to, base64 },
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
async sendDocumentBase64(to, base64, mimetype, fileName, caption) {
|
|
98
|
+
return this.http.request({
|
|
99
|
+
route: `${types_1.Routes.MESSAGES}/base64/document`,
|
|
100
|
+
method: types_1.HttpMethod.POST,
|
|
101
|
+
body: { to, base64, mimetype, fileName, caption },
|
|
102
|
+
});
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
exports.MessageService = MessageService;
|
|
106
|
+
//# sourceMappingURL=MessageService.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"MessageService.js","sourceRoot":"","sources":["../../src/services/MessageService.ts"],"names":[],"mappings":";;;AACA,sCAA0C;AAC1C,oCAIkB;AAElB,MAAa,cAAc;IACzB,YAA6B,IAAiB;QAAjB,SAAI,GAAJ,IAAI,CAAa;IAAG,CAAC;IAElD,KAAK,CAAC,IAAI,CAAC,WAAmB,EAAE,IAAa,EAAE,KAAc;QAC3D,MAAM,MAAM,GAAoC,EAAE,WAAW,EAAE,CAAC;QAChE,IAAI,I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AI,CAAC,OAAO,CAAkB;YACxC,KAAK,EAAE,GAAG,cAAM,CAAC,QAAQ,kBAAkB;YAC3C,MAAM,EAAE,kBAAU,CAAC,IAAI;YACvB,IAAI,EAAE,EAAE,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,EAAE,OAAO,EAAE;SAClD,CAAC,CAAC;IACL,CAAC;CACF;AAhJD,wCAgJC","sourcesContent":["import { IHttpClient } from '../client/IHttpClient';\nimport { WhatsAppError } from '../errors';\nimport {\n Routes, HttpMethod, TypeMessage, StatusPresence, Contact, Section,\n Location, Buttons, Items, HeaderMedia, SendMessageRoot, ApiResponse,\n EventData, ListMessagesResponse,\n} from '../types';\n\nexport class MessageService {\n constructor(private readonly http: IHttpClient) {}\n\n async list(phoneNumber: string, page?: number, limit?: number): Promise<ListMessagesResponse> {\n const params: Record<string, string | number> = { phoneNumber };\n if (page !== undefined) params.page = page;\n if (limit !== undefined) params.limit = limit;\n return this.http.request<ListMessagesResponse>({\n route: Routes.MESSAGES,\n method: HttpMethod.GET,\n params,\n });\n }\n\n async send(\n data: {\n type: TypeMessage;\n body: {\n to: string;\n msgId?: string;\n header?: HeaderMedia;\n status?: StatusPresence;\n text?: string;\n url?: string;\n caption?: string;\n mimetype?: string;\n fileName?: string;\n contact?: Contact;\n location?: Location;\n name?: string;\n options?: string[];\n sections?: Section[];\n buttons?: Buttons[];\n footer?: string;\n description?: string;\n title?: string;\n buttonText?: string;\n thumbnailUrl?: string;\n sourceUrl?: string;\n referenceId?: string;\n code?: string;\n key?: string;\n merchantName?: string;\n keyType?: \"CNPJ\" | \"CPF\" | \"EMAIL\" | \"PHONE\";\n subtotal?: string;\n totalAmount?: string;\n items?: Items[];\n };\n },\n reply: boolean = false,\n ): Promise<SendMessageRoot> {\n if (data.type === TypeMessage.BUTTON_PIX) {\n const { key, keyType, merchantName, subtotal, totalAmount, items } = data.body;\n if (!key || !keyType || !merchantName || !subtotal || !totalAmount || !items || items.length === 0) {\n throw new WhatsAppError(\"Campos obrigatorios para pagamento via PIX estao ausentes.\");\n }\n }\n\n const route = reply\n ? `${Routes.MESSAGES}/${data.body.msgId}/${data.type}`\n : `${Routes.MESSAGES}/${data.type}`;\n\n return this.http.request<SendMessageRoot>({ route, method: HttpMethod.POST, body: data.body });\n }\n\n async forward(to: string, msgId: string): Promise<SendMessageRoot> {\n return this.http.request<SendMessageRoot>({\n route: `${Routes.MESSAGES}/${msgId}/forwarding`,\n method: HttpMethod.POST,\n body: { to },\n });\n }\n\n async sendSticker(to: string, url: string): Promise<SendMessageRoot> {\n return this.http.request<SendMessageRoot>({\n route: `${Routes.MESSAGES}/sticker`,\n method: HttpMethod.POST,\n body: { to, url },\n });\n }\n\n async sendVideoNote(to: string, url: string): Promise<SendMessageRoot> {\n return this.http.request<SendMessageRoot>({\n route: `${Routes.MESSAGES}/video-note`,\n method: HttpMethod.POST,\n body: { to, url },\n });\n }\n\n async sendPoll(to: string, name: string, values: Array<string | number | boolean>, selectableCount?: number): Promise<SendMessageRoot> {\n return this.http.request<SendMessageRoot>({\n route: `${Routes.MESSAGES}/poll`,\n method: HttpMethod.POST,\n body: { to, name, values, selectableCount },\n });\n }\n\n async sendEvent(data: EventData): Promise<SendMessageRoot> {\n return this.http.request<SendMessageRoot>({\n route: `${Routes.MESSAGES}/event`,\n method: HttpMethod.POST,\n body: data,\n });\n }\n\n async pin(id: string, duration?: number): Promise<ApiResponse> {\n return this.http.request<ApiResponse>({\n route: `${Routes.MESSAGES}/pin`,\n method: HttpMethod.POST,\n body: { id, duration },\n });\n }\n\n async sendCallLink(to: string, type: string, caption?: string): Promise<SendMessageRoot> {\n return this.http.request<SendMessageRoot>({\n route: `${Routes.MESSAGES}/call-link`,\n method: HttpMethod.POST,\n body: { to, type, caption },\n });\n }\n\n async sendImageBase64(to: string, base64: string, caption?: string): Promise<SendMessageRoot> {\n return this.http.request<SendMessageRoot>({\n route: `${Routes.MESSAGES}/base64/image`,\n method: HttpMethod.POST,\n body: { to, base64, caption },\n });\n }\n\n async sendAudioBase64(to: string, base64: string): Promise<SendMessageRoot> {\n return this.http.request<SendMessageRoot>({\n route: `${Routes.MESSAGES}/base64/audio`,\n method: HttpMethod.POST,\n body: { to, base64 },\n });\n }\n\n async sendDocumentBase64(to: string, base64: string, mimetype: string, fileName?: string, caption?: string): Promise<SendMessageRoot> {\n return this.http.request<SendMessageRoot>({\n route: `${Routes.MESSAGES}/base64/document`,\n method: HttpMethod.POST,\n body: { to, base64, mimetype, fileName, caption },\n });\n }\n}\n"]}
|
package/dist/types/index.d.ts
CHANGED
|
@@ -15,7 +15,11 @@ export declare enum Routes {
|
|
|
15
15
|
CONTACTS = "contacts",
|
|
16
16
|
GROUPS = "groups",
|
|
17
17
|
ACTIONS = "actions",
|
|
18
|
-
CALL = "call"
|
|
18
|
+
CALL = "call",
|
|
19
|
+
CHAT = "chat",
|
|
20
|
+
LABELS = "labels",
|
|
21
|
+
COMMUNITY = "community",
|
|
22
|
+
BUSINESS = "business"
|
|
19
23
|
}
|
|
20
24
|
export declare enum TypeMessage {
|
|
21
25
|
PRESENCE = "presence",
|
|
@@ -33,7 +37,13 @@ export declare enum TypeMessage {
|
|
|
33
37
|
BUTTON_ACTION = "button_action",
|
|
34
38
|
BUTTON_PIX = "pix",
|
|
35
39
|
POLL = "survey",
|
|
36
|
-
MENU = "list"
|
|
40
|
+
MENU = "list",
|
|
41
|
+
STICKER = "sticker",
|
|
42
|
+
VIDEO_NOTE = "video-note",
|
|
43
|
+
POLL_V2 = "poll",
|
|
44
|
+
EVENT = "event",
|
|
45
|
+
PIN = "pin",
|
|
46
|
+
CALL_LINK = "call-link"
|
|
37
47
|
}
|
|
38
48
|
export declare enum StatusPresence {
|
|
39
49
|
UNAVAILABLE = "unavailable",
|
|
@@ -42,8 +52,13 @@ export declare enum StatusPresence {
|
|
|
42
52
|
RECORDING = "recording",
|
|
43
53
|
PAUSED = "paused"
|
|
44
54
|
}
|
|
55
|
+
export interface ApiResponse {
|
|
56
|
+
status: number;
|
|
57
|
+
message: string;
|
|
58
|
+
}
|
|
45
59
|
export interface WebhookBody {
|
|
46
60
|
allowWebhook: boolean;
|
|
61
|
+
allowNumber?: string;
|
|
47
62
|
webhookMessage: string;
|
|
48
63
|
webhookGroup: string;
|
|
49
64
|
webhookConnection: string;
|
|
@@ -94,6 +109,7 @@ export interface User {
|
|
|
94
109
|
}
|
|
95
110
|
export interface Webhook {
|
|
96
111
|
allowWebhook: boolean;
|
|
112
|
+
allowNumber?: string;
|
|
97
113
|
webhookMessage: string;
|
|
98
114
|
webhookGroup: string;
|
|
99
115
|
webhookConnection: string;
|
|
@@ -103,21 +119,21 @@ export interface Webhook {
|
|
|
103
119
|
}
|
|
104
120
|
export interface SendMessageRoot {
|
|
105
121
|
status: number;
|
|
106
|
-
data:
|
|
122
|
+
data: MessageData;
|
|
107
123
|
}
|
|
108
|
-
export interface
|
|
109
|
-
key:
|
|
110
|
-
message:
|
|
124
|
+
export interface MessageData {
|
|
125
|
+
key: MessageKey;
|
|
126
|
+
message: MessageContent;
|
|
111
127
|
messageTimestamp: string;
|
|
112
128
|
status: string;
|
|
113
129
|
}
|
|
114
|
-
export interface
|
|
130
|
+
export interface MessageKey {
|
|
115
131
|
remoteJid: string;
|
|
116
132
|
fromMe: boolean;
|
|
117
133
|
id: string;
|
|
118
134
|
}
|
|
119
|
-
export interface
|
|
120
|
-
extendedTextMessage
|
|
135
|
+
export interface MessageContent {
|
|
136
|
+
extendedTextMessage?: ExtendedTextMessage;
|
|
121
137
|
}
|
|
122
138
|
export interface ExtendedTextMessage {
|
|
123
139
|
text: string;
|
|
@@ -129,12 +145,16 @@ export interface Connect {
|
|
|
129
145
|
image: string;
|
|
130
146
|
user?: User;
|
|
131
147
|
}
|
|
148
|
+
export interface PairingCodeResponse {
|
|
149
|
+
status: number;
|
|
150
|
+
code: string;
|
|
151
|
+
}
|
|
132
152
|
export interface BusinessProfile {
|
|
133
153
|
wid: string;
|
|
134
154
|
description: string;
|
|
135
|
-
website:
|
|
155
|
+
website: string[];
|
|
136
156
|
category: string;
|
|
137
|
-
business_hours:
|
|
157
|
+
business_hours: Record<string, unknown>;
|
|
138
158
|
}
|
|
139
159
|
export interface Buttons {
|
|
140
160
|
type: "quick_reply" | "cta_copy" | "cta_url" | "cta_call";
|
|
@@ -150,3 +170,127 @@ export interface Items {
|
|
|
150
170
|
price: number;
|
|
151
171
|
quantity: number;
|
|
152
172
|
}
|
|
173
|
+
export interface HeaderMedia {
|
|
174
|
+
title?: string;
|
|
175
|
+
hasMediaAttachment?: boolean;
|
|
176
|
+
imageMessage?: {
|
|
177
|
+
url: string;
|
|
178
|
+
};
|
|
179
|
+
videoMessage?: {
|
|
180
|
+
url: string;
|
|
181
|
+
};
|
|
182
|
+
documentMessage?: {
|
|
183
|
+
url: string;
|
|
184
|
+
mimetype?: string;
|
|
185
|
+
fileName?: string;
|
|
186
|
+
};
|
|
187
|
+
}
|
|
188
|
+
export interface DownloadableMessage {
|
|
189
|
+
mediaKey: string;
|
|
190
|
+
directPath: string;
|
|
191
|
+
url: string;
|
|
192
|
+
}
|
|
193
|
+
export interface Product {
|
|
194
|
+
name: string;
|
|
195
|
+
description?: string;
|
|
196
|
+
originCountryCode?: string;
|
|
197
|
+
currency?: string;
|
|
198
|
+
price?: number;
|
|
199
|
+
images?: {
|
|
200
|
+
url: string;
|
|
201
|
+
}[];
|
|
202
|
+
}
|
|
203
|
+
export interface CommunityCreate {
|
|
204
|
+
name: string;
|
|
205
|
+
subject: string;
|
|
206
|
+
}
|
|
207
|
+
export interface CommunityUpdate {
|
|
208
|
+
subject: string;
|
|
209
|
+
description: string;
|
|
210
|
+
}
|
|
211
|
+
export interface GroupParticipantsAction {
|
|
212
|
+
participants: string[];
|
|
213
|
+
action: 'reject' | 'approve';
|
|
214
|
+
}
|
|
215
|
+
export interface MobileRegisterData {
|
|
216
|
+
phoneNumberCountryCode: string;
|
|
217
|
+
phoneNumberNationalNumber: string;
|
|
218
|
+
phoneNumberMobileCountryCode: string;
|
|
219
|
+
phoneNumberMobileNetworkCode: string;
|
|
220
|
+
}
|
|
221
|
+
export interface EventData {
|
|
222
|
+
to: string;
|
|
223
|
+
name: string;
|
|
224
|
+
description?: string;
|
|
225
|
+
startTime?: string;
|
|
226
|
+
locationName?: string;
|
|
227
|
+
locationAddress?: string;
|
|
228
|
+
}
|
|
229
|
+
export interface RegisteredResponse {
|
|
230
|
+
status: number;
|
|
231
|
+
registered: boolean;
|
|
232
|
+
}
|
|
233
|
+
export interface ContactInfo {
|
|
234
|
+
id: string;
|
|
235
|
+
name?: string;
|
|
236
|
+
notify?: string;
|
|
237
|
+
imgUrl?: string;
|
|
238
|
+
}
|
|
239
|
+
export interface GroupInfo {
|
|
240
|
+
id: string;
|
|
241
|
+
subject: string;
|
|
242
|
+
owner: string;
|
|
243
|
+
creation: number;
|
|
244
|
+
desc?: string;
|
|
245
|
+
participants: GroupParticipant[];
|
|
246
|
+
}
|
|
247
|
+
export interface GroupParticipant {
|
|
248
|
+
id: string;
|
|
249
|
+
admin?: string;
|
|
250
|
+
}
|
|
251
|
+
export interface InviteCodeResponse {
|
|
252
|
+
status: number;
|
|
253
|
+
inviteCode: string;
|
|
254
|
+
}
|
|
255
|
+
export interface ChatInfo {
|
|
256
|
+
id: string;
|
|
257
|
+
name?: string;
|
|
258
|
+
timestamp?: number;
|
|
259
|
+
unreadCount?: number;
|
|
260
|
+
}
|
|
261
|
+
export interface LabelInfo {
|
|
262
|
+
id: string;
|
|
263
|
+
name: string;
|
|
264
|
+
color?: number;
|
|
265
|
+
}
|
|
266
|
+
export interface CommunityInfo {
|
|
267
|
+
id: string;
|
|
268
|
+
name: string;
|
|
269
|
+
subject?: string;
|
|
270
|
+
description?: string;
|
|
271
|
+
participants?: GroupParticipant[];
|
|
272
|
+
}
|
|
273
|
+
export interface CatalogResponse {
|
|
274
|
+
status: number;
|
|
275
|
+
data: Product[];
|
|
276
|
+
cursor?: string;
|
|
277
|
+
}
|
|
278
|
+
export interface WebhookStatistics {
|
|
279
|
+
status: number;
|
|
280
|
+
data: Record<string, unknown>;
|
|
281
|
+
}
|
|
282
|
+
export interface ListMessagesResponse {
|
|
283
|
+
status: number;
|
|
284
|
+
data: MessageData[];
|
|
285
|
+
page?: number;
|
|
286
|
+
limit?: number;
|
|
287
|
+
total?: number;
|
|
288
|
+
}
|
|
289
|
+
export interface DownloadMediaResponse {
|
|
290
|
+
status: number;
|
|
291
|
+
data: string;
|
|
292
|
+
}
|
|
293
|
+
export interface CallResponse {
|
|
294
|
+
status: number;
|
|
295
|
+
data: Record<string, unknown>;
|
|
296
|
+
}
|