@raphaelvserafim/client-api-whatsapp 1.2.0 → 1.3.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/dist/WhatsApp.d.ts +40 -2
- package/dist/WhatsApp.js +36 -1
- package/dist/WhatsApp.js.map +1 -1
- package/dist/index.d.ts +3 -1
- package/dist/index.js +5 -1
- package/dist/index.js.map +1 -1
- package/dist/services/CallService.d.ts +2 -0
- package/dist/services/CallService.js +14 -0
- package/dist/services/CallService.js.map +1 -1
- package/dist/services/ChatService.d.ts +4 -1
- package/dist/services/ChatService.js +27 -2
- package/dist/services/ChatService.js.map +1 -1
- package/dist/services/CommunityService.d.ts +8 -1
- package/dist/services/CommunityService.js +49 -0
- package/dist/services/CommunityService.js.map +1 -1
- package/dist/services/ContactService.d.ts +6 -0
- package/dist/services/ContactService.js +38 -0
- package/dist/services/ContactService.js.map +1 -1
- package/dist/services/GroupService.d.ts +5 -0
- package/dist/services/GroupService.js +13 -0
- package/dist/services/GroupService.js.map +1 -1
- package/dist/services/InstanceService.d.ts +1 -0
- package/dist/services/InstanceService.js +6 -0
- package/dist/services/InstanceService.js.map +1 -1
- package/dist/services/LabelService.d.ts +1 -0
- package/dist/services/LabelService.js +7 -1
- package/dist/services/LabelService.js.map +1 -1
- package/dist/services/MessageService.d.ts +10 -1
- package/dist/services/MessageService.js +65 -0
- package/dist/services/MessageService.js.map +1 -1
- package/dist/services/NewsletterService.d.ts +23 -0
- package/dist/services/NewsletterService.js +129 -0
- package/dist/services/NewsletterService.js.map +1 -0
- package/dist/services/StatusService.d.ts +14 -0
- package/dist/services/StatusService.js +46 -0
- package/dist/services/StatusService.js.map +1 -0
- package/dist/types/index.d.ts +53 -2
- package/dist/types/index.js +2 -0
- package/dist/types/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -11,5 +11,11 @@ export declare class ContactService {
|
|
|
11
11
|
status: number;
|
|
12
12
|
data: ContactInfo;
|
|
13
13
|
}>;
|
|
14
|
+
add(number: string, name: string): Promise<ApiResponse>;
|
|
15
|
+
remove(number: string): Promise<ApiResponse>;
|
|
14
16
|
block(number: string, action: 'block' | 'unblock'): Promise<ApiResponse>;
|
|
17
|
+
clearSession(number: string): Promise<ApiResponse>;
|
|
18
|
+
getStatus(number: string): Promise<ApiResponse>;
|
|
19
|
+
listBlocked(): Promise<ApiResponse>;
|
|
20
|
+
resolveLids(lids: string[]): Promise<ApiResponse>;
|
|
15
21
|
}
|
|
@@ -18,6 +18,19 @@ class ContactService {
|
|
|
18
18
|
method: types_1.HttpMethod.GET,
|
|
19
19
|
});
|
|
20
20
|
}
|
|
21
|
+
async add(number, name) {
|
|
22
|
+
return this.http.request({
|
|
23
|
+
route: types_1.Routes.CONTACTS,
|
|
24
|
+
method: types_1.HttpMethod.POST,
|
|
25
|
+
body: { number, name },
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
async remove(number) {
|
|
29
|
+
return this.http.request({
|
|
30
|
+
route: `${types_1.Routes.CONTACTS}/${number}`,
|
|
31
|
+
method: types_1.HttpMethod.DELETE,
|
|
32
|
+
});
|
|
33
|
+
}
|
|
21
34
|
async block(number, action) {
|
|
22
35
|
return this.http.request({
|
|
23
36
|
route: `${types_1.Routes.CONTACTS}/${number}`,
|
|
@@ -25,6 +38,31 @@ class ContactService {
|
|
|
25
38
|
params: { action },
|
|
26
39
|
});
|
|
27
40
|
}
|
|
41
|
+
async clearSession(number) {
|
|
42
|
+
return this.http.request({
|
|
43
|
+
route: `${types_1.Routes.CONTACTS}/${number}/session`,
|
|
44
|
+
method: types_1.HttpMethod.DELETE,
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
async getStatus(number) {
|
|
48
|
+
return this.http.request({
|
|
49
|
+
route: `${types_1.Routes.CONTACTS}/${number}/status`,
|
|
50
|
+
method: types_1.HttpMethod.GET,
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
async listBlocked() {
|
|
54
|
+
return this.http.request({
|
|
55
|
+
route: `${types_1.Routes.CONTACTS}/blocked`,
|
|
56
|
+
method: types_1.HttpMethod.GET,
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
async resolveLids(lids) {
|
|
60
|
+
return this.http.request({
|
|
61
|
+
route: `${types_1.Routes.CONTACTS}/resolve-lids`,
|
|
62
|
+
method: types_1.HttpMethod.POST,
|
|
63
|
+
body: { lids },
|
|
64
|
+
});
|
|
65
|
+
}
|
|
28
66
|
}
|
|
29
67
|
exports.ContactService = ContactService;
|
|
30
68
|
//# sourceMappingURL=ContactService.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ContactService.js","sourceRoot":"","sources":["../../src/services/ContactService.ts"],"names":[],"mappings":";;;AACA,oCAAwE;AAExE,MAAa,cAAc;IACzB,YAA6B,IAAiB;QAAjB,SAAI,GAAJ,IAAI,CAAa;IAAG,CAAC;IAElD,KAAK,CAAC,IAAI;QACR,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAA0C;YAChE,KAAK,EAAE,cAAM,CAAC,QAAQ;YACtB,MAAM,EAAE,kBAAU,CAAC,GAAG;SACvB,CAAC,CAAC;IACL,CAAC;IAED,KAAK,CAAC,OAAO,CAAC,EAAU;QACtB,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAwC;YAC9D,KAAK,EAAE,GAAG,cAAM,CAAC,QAAQ,IAAI,EAAE,EAAE;YACjC,MAAM,EAAE,kBAAU,CAAC,GAAG;SACvB,CAAC,CAAC;IACL,CAAC;IAED,KAAK,CAAC,KAAK,CAAC,MAAc,EAAE,MAA2B;QACrD,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAc;YACpC,KAAK,EAAE,GAAG,cAAM,CAAC,QAAQ,IAAI,MAAM,EAAE;YACrC,MAAM,EAAE,kBAAU,CAAC,KAAK;YACxB,MAAM,EAAE,EAAE,MAAM,EAAE;SACnB,CAAC,CAAC;IACL,CAAC;CACF;
|
|
1
|
+
{"version":3,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AAE;SACnB,CAAC,CAAC;IACL,CAAC;IAED,KAAK,CAAC,YAAY,CAAC,MAAc;QAC/B,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAc;YACpC,KAAK,EAAE,GAAG,cAAM,CAAC,QAAQ,IAAI,MAAM,UAAU;YAC7C,MAAM,EAAE,kBAAU,CAAC,MAAM;SAC1B,CAAC,CAAC;IACL,CAAC;IAED,KAAK,CAAC,SAAS,CAAC,MAAc;QAC5B,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAc;YACpC,KAAK,EAAE,GAAG,cAAM,CAAC,QAAQ,IAAI,MAAM,SAAS;YAC5C,MAAM,EAAE,kBAAU,CAAC,GAAG;SACvB,CAAC,CAAC;IACL,CAAC;IAED,KAAK,CAAC,WAAW;QACf,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAc;YACpC,KAAK,EAAE,GAAG,cAAM,CAAC,QAAQ,UAAU;YACnC,MAAM,EAAE,kBAAU,CAAC,GAAG;SACvB,CAAC,CAAC;IACL,CAAC;IAED,KAAK,CAAC,WAAW,CAAC,IAAc;QAC9B,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAc;YACpC,KAAK,EAAE,GAAG,cAAM,CAAC,QAAQ,eAAe;YACxC,MAAM,EAAE,kBAAU,CAAC,IAAI;YACvB,IAAI,EAAE,EAAE,IAAI,EAAE;SACf,CAAC,CAAC;IACL,CAAC;CACF;AApED,wCAoEC","sourcesContent":["import { IHttpClient } from '../client/IHttpClient';\nimport { Routes, HttpMethod, ApiResponse, ContactInfo } from '../types';\n\nexport class ContactService {\n constructor(private readonly http: IHttpClient) {}\n\n async list(): Promise<{ status: number; data: ContactInfo[] }> {\n return this.http.request<{ status: number; data: ContactInfo[] }>({\n route: Routes.CONTACTS,\n method: HttpMethod.GET,\n });\n }\n\n async profile(id: string): Promise<{ status: number; data: ContactInfo }> {\n return this.http.request<{ status: number; data: ContactInfo }>({\n route: `${Routes.CONTACTS}/${id}`,\n method: HttpMethod.GET,\n });\n }\n\n async add(number: string, name: string): Promise<ApiResponse> {\n return this.http.request<ApiResponse>({\n route: Routes.CONTACTS,\n method: HttpMethod.POST,\n body: { number, name },\n });\n }\n\n async remove(number: string): Promise<ApiResponse> {\n return this.http.request<ApiResponse>({\n route: `${Routes.CONTACTS}/${number}`,\n method: HttpMethod.DELETE,\n });\n }\n\n async block(number: string, action: 'block' | 'unblock'): Promise<ApiResponse> {\n return this.http.request<ApiResponse>({\n route: `${Routes.CONTACTS}/${number}`,\n method: HttpMethod.PATCH,\n params: { action },\n });\n }\n\n async clearSession(number: string): Promise<ApiResponse> {\n return this.http.request<ApiResponse>({\n route: `${Routes.CONTACTS}/${number}/session`,\n method: HttpMethod.DELETE,\n });\n }\n\n async getStatus(number: string): Promise<ApiResponse> {\n return this.http.request<ApiResponse>({\n route: `${Routes.CONTACTS}/${number}/status`,\n method: HttpMethod.GET,\n });\n }\n\n async listBlocked(): Promise<ApiResponse> {\n return this.http.request<ApiResponse>({\n route: `${Routes.CONTACTS}/blocked`,\n method: HttpMethod.GET,\n });\n }\n\n async resolveLids(lids: string[]): Promise<ApiResponse> {\n return this.http.request<ApiResponse>({\n route: `${Routes.CONTACTS}/resolve-lids`,\n method: HttpMethod.POST,\n body: { lids },\n });\n }\n}\n"]}
|
|
@@ -18,6 +18,11 @@ export declare class GroupService {
|
|
|
18
18
|
update(id: string, name: string, description: string): Promise<ApiResponse>;
|
|
19
19
|
changeSettings(id: string, setting: 'announcement' | 'not_announcement' | 'locked' | 'unlocked'): Promise<ApiResponse>;
|
|
20
20
|
leave(id: string): Promise<ApiResponse>;
|
|
21
|
+
getMembers(id: string): Promise<{
|
|
22
|
+
status: number;
|
|
23
|
+
data: GroupParticipant[];
|
|
24
|
+
}>;
|
|
25
|
+
getInviteInfo(code: string): Promise<ApiResponse>;
|
|
21
26
|
getInviteCode(id: string): Promise<InviteCodeResponse>;
|
|
22
27
|
updatePicture(id: string, url: string): Promise<ApiResponse>;
|
|
23
28
|
removePicture(id: string): Promise<ApiResponse>;
|
|
@@ -45,6 +45,19 @@ class GroupService {
|
|
|
45
45
|
method: types_1.HttpMethod.DELETE,
|
|
46
46
|
});
|
|
47
47
|
}
|
|
48
|
+
async getMembers(id) {
|
|
49
|
+
return this.http.request({
|
|
50
|
+
route: `${types_1.Routes.GROUPS}/${id}/members`,
|
|
51
|
+
method: types_1.HttpMethod.GET,
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
async getInviteInfo(code) {
|
|
55
|
+
return this.http.request({
|
|
56
|
+
route: `${types_1.Routes.GROUPS}/invite/info`,
|
|
57
|
+
method: types_1.HttpMethod.GET,
|
|
58
|
+
params: { code },
|
|
59
|
+
});
|
|
60
|
+
}
|
|
48
61
|
async getInviteCode(id) {
|
|
49
62
|
return this.http.request({
|
|
50
63
|
route: `${types_1.Routes.GROUPS}/${id}/invite`,
|
|
@@ -1 +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,CAA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EAAE,MAA4B,EAAE,YAAsB;QAC1F,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAc;YACpC,KAAK,EAAE,GAAG,cAAM,CAAC,MAAM,IAAI,EAAE,OAAO;YACpC,MAAM,EAAE,kBAAU,CAAC,KAAK;YACxB,IAAI,EAAE,EAAE,YAAY,EAAE;YACtB,MAAM,EAAE,EAAE,MAAM,EAAE;SACnB,CAAC,CAAC;IACL,CAAC;IAED,KAAK,CAAC,sBAAsB,CAAC,EAAU;QACrC,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAA+C;YACrE,KAAK,EAAE,GAAG,cAAM,CAAC,MAAM,IAAI,EAAE,4BAA4B;YACzD,MAAM,EAAE,kBAAU,CAAC,GAAG;SACvB,CAAC,CAAC;IACL,CAAC;IAED,KAAK,CAAC,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;AA5HD,oCA4HC","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 getMembers(id: string): Promise<{ status: number; data: GroupParticipant[] }> {\n return this.http.request<{ status: number; data: GroupParticipant[] }>({\n route: `${Routes.GROUPS}/${id}/members`,\n method: HttpMethod.GET,\n });\n }\n\n async getInviteInfo(code: string): Promise<ApiResponse> {\n return this.http.request<ApiResponse>({\n route: `${Routes.GROUPS}/invite/info`,\n method: HttpMethod.GET,\n params: { code },\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"]}
|
|
@@ -16,6 +16,7 @@ export declare class InstanceService {
|
|
|
16
16
|
pairingCode(phoneNumber: string): Promise<PairingCodeResponse>;
|
|
17
17
|
addMongoDb(uri: string, dbName: string): Promise<ApiResponse>;
|
|
18
18
|
setProxy(proxy: string): Promise<ApiResponse>;
|
|
19
|
+
resync(): Promise<ApiResponse>;
|
|
19
20
|
restart(): Promise<ApiResponse>;
|
|
20
21
|
updateProfileStatus(text: string): Promise<ApiResponse>;
|
|
21
22
|
updateProfilePicture(url: string): Promise<ApiResponse>;
|
|
@@ -59,6 +59,12 @@ class InstanceService {
|
|
|
59
59
|
body: { proxy },
|
|
60
60
|
});
|
|
61
61
|
}
|
|
62
|
+
async resync() {
|
|
63
|
+
return this.http.request({
|
|
64
|
+
route: `${types_1.Routes.INSTANCES}/resync`,
|
|
65
|
+
method: types_1.HttpMethod.POST,
|
|
66
|
+
});
|
|
67
|
+
}
|
|
62
68
|
async restart() {
|
|
63
69
|
return this.http.request({
|
|
64
70
|
route: `${types_1.Routes.INSTANCES}/restart`,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"InstanceService.js","sourceRoot":"","sources":["../../src/services/InstanceService.ts"],"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M,EAAE,kBAAU,CAAC,GAAG;SACvB,CAAC,CAAC;IACL,CAAC;CACF;
|
|
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,KAAK,EAAE,cAAM,CAAC,SAAS;YACvB,MAAM,EAAE,kBAAU,CAAC,GAAG;YACtB,IAAI;SACL,CAAC,CAAC;IACL,CAAC;IAED,KAAK,CAAC,WAAW,CAAC,WAAmB;QACnC,OAAO,IAAI,CAAC,I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C,IAAI,CAAC,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;AA3ID,0CA2IC","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 resync(): Promise<ApiResponse> {\n return this.http.request<ApiResponse>({\n route: `${Routes.INSTANCES}/resync`,\n method: HttpMethod.POST,\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"]}
|
|
@@ -32,9 +32,15 @@ class LabelService {
|
|
|
32
32
|
body: { to },
|
|
33
33
|
});
|
|
34
34
|
}
|
|
35
|
+
async delete(labelId) {
|
|
36
|
+
return this.http.request({
|
|
37
|
+
route: `${types_1.Routes.LABELS}/${labelId}`,
|
|
38
|
+
method: types_1.HttpMethod.DELETE,
|
|
39
|
+
});
|
|
40
|
+
}
|
|
35
41
|
async removeFromChat(labelId, to) {
|
|
36
42
|
return this.http.request({
|
|
37
|
-
route: `${types_1.Routes.LABELS}/${labelId}/${to}`,
|
|
43
|
+
route: `${types_1.Routes.LABELS}/${labelId}/chat/${to}`,
|
|
38
44
|
method: types_1.HttpMethod.DELETE,
|
|
39
45
|
});
|
|
40
46
|
}
|
|
@@ -1 +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,CAA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AAK,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,MAAM,CAAC,OAAe;QAC1B,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAc;YACpC,KAAK,EAAE,GAAG,cAAM,CAAC,MAAM,IAAI,OAAO,EAAE;YACpC,MAAM,EAAE,kBAAU,CAAC,MAAM;SAC1B,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,SAAS,EAAE,EAAE;YAC/C,MAAM,EAAE,kBAAU,CAAC,MAAM;SAC1B,CAAC,CAAC;IACL,CAAC;CACF;AA9CD,oCA8CC","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 delete(labelId: string): Promise<ApiResponse> {\n return this.http.request<ApiResponse>({\n route: `${Routes.LABELS}/${labelId}`,\n method: HttpMethod.DELETE,\n });\n }\n\n async removeFromChat(labelId: string, to: string): Promise<ApiResponse> {\n return this.http.request<ApiResponse>({\n route: `${Routes.LABELS}/${labelId}/chat/${to}`,\n method: HttpMethod.DELETE,\n });\n }\n}\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { IHttpClient } from '../client/IHttpClient';
|
|
2
|
-
import { TypeMessage, StatusPresence, Contact, Section, Location, Buttons, Items, HeaderMedia, SendMessageRoot, ApiResponse, EventData, ListMessagesResponse } from '../types';
|
|
2
|
+
import { TypeMessage, StatusPresence, Contact, Section, Location, Buttons, Items, HeaderMedia, SendMessageRoot, ApiResponse, EventData, ListMessagesResponse, LiveLocationData, SendContactsData, ProductMessageData, GroupInviteMessageData } from '../types';
|
|
3
3
|
export declare class MessageService {
|
|
4
4
|
private readonly http;
|
|
5
5
|
constructor(http: IHttpClient);
|
|
@@ -48,4 +48,13 @@ export declare class MessageService {
|
|
|
48
48
|
sendImageBase64(to: string, base64: string, caption?: string): Promise<SendMessageRoot>;
|
|
49
49
|
sendAudioBase64(to: string, base64: string): Promise<SendMessageRoot>;
|
|
50
50
|
sendDocumentBase64(to: string, base64: string, mimetype: string, fileName?: string, caption?: string): Promise<SendMessageRoot>;
|
|
51
|
+
sendContacts(data: SendContactsData): Promise<SendMessageRoot>;
|
|
52
|
+
sendLiveLocation(data: LiveLocationData): Promise<SendMessageRoot>;
|
|
53
|
+
unpin(id: string): Promise<ApiResponse>;
|
|
54
|
+
getDetails(messageId: string): Promise<ApiResponse>;
|
|
55
|
+
getMedia(messageId: string, format?: string): Promise<ApiResponse>;
|
|
56
|
+
sendProduct(data: ProductMessageData): Promise<SendMessageRoot>;
|
|
57
|
+
sendGroupInvite(data: GroupInviteMessageData): Promise<SendMessageRoot>;
|
|
58
|
+
requestPhone(to: string): Promise<ApiResponse>;
|
|
59
|
+
createCallLink(type: string): Promise<ApiResponse>;
|
|
51
60
|
}
|
|
@@ -101,6 +101,71 @@ class MessageService {
|
|
|
101
101
|
body: { to, base64, mimetype, fileName, caption },
|
|
102
102
|
});
|
|
103
103
|
}
|
|
104
|
+
async sendContacts(data) {
|
|
105
|
+
return this.http.request({
|
|
106
|
+
route: `${types_1.Routes.MESSAGES}/contacts`,
|
|
107
|
+
method: types_1.HttpMethod.POST,
|
|
108
|
+
body: data,
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
async sendLiveLocation(data) {
|
|
112
|
+
return this.http.request({
|
|
113
|
+
route: `${types_1.Routes.MESSAGES}/live-location`,
|
|
114
|
+
method: types_1.HttpMethod.POST,
|
|
115
|
+
body: data,
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
async unpin(id) {
|
|
119
|
+
return this.http.request({
|
|
120
|
+
route: `${types_1.Routes.MESSAGES}/unpin`,
|
|
121
|
+
method: types_1.HttpMethod.POST,
|
|
122
|
+
body: { id },
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
async getDetails(messageId) {
|
|
126
|
+
return this.http.request({
|
|
127
|
+
route: `${types_1.Routes.MESSAGES}/${messageId}`,
|
|
128
|
+
method: types_1.HttpMethod.GET,
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
async getMedia(messageId, format) {
|
|
132
|
+
const params = {};
|
|
133
|
+
if (format)
|
|
134
|
+
params.format = format;
|
|
135
|
+
return this.http.request({
|
|
136
|
+
route: `${types_1.Routes.MESSAGES}/${messageId}/media`,
|
|
137
|
+
method: types_1.HttpMethod.GET,
|
|
138
|
+
params,
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
async sendProduct(data) {
|
|
142
|
+
return this.http.request({
|
|
143
|
+
route: `${types_1.Routes.MESSAGES}/product`,
|
|
144
|
+
method: types_1.HttpMethod.POST,
|
|
145
|
+
body: data,
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
async sendGroupInvite(data) {
|
|
149
|
+
return this.http.request({
|
|
150
|
+
route: `${types_1.Routes.MESSAGES}/group-invite`,
|
|
151
|
+
method: types_1.HttpMethod.POST,
|
|
152
|
+
body: data,
|
|
153
|
+
});
|
|
154
|
+
}
|
|
155
|
+
async requestPhone(to) {
|
|
156
|
+
return this.http.request({
|
|
157
|
+
route: `${types_1.Routes.MESSAGES}/request-phone`,
|
|
158
|
+
method: types_1.HttpMethod.POST,
|
|
159
|
+
body: { to },
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
async createCallLink(type) {
|
|
163
|
+
return this.http.request({
|
|
164
|
+
route: `${types_1.Routes.MESSAGES}/create-call-link`,
|
|
165
|
+
method: types_1.HttpMethod.POST,
|
|
166
|
+
body: { type },
|
|
167
|
+
});
|
|
168
|
+
}
|
|
104
169
|
}
|
|
105
170
|
exports.MessageService = MessageService;
|
|
106
171
|
//# sourceMappingURL=MessageService.js.map
|
|
@@ -1 +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,IAAI,KAA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,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"]}
|
|
1
|
+
{"version":3,"file":"MessageService.js","sourceRoot":"","sources":["../../src/services/MessageService.ts"],"names":[],"mappings":";;;AACA,sCAA0C;AAC1C,oCAKkB;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,IAAI,KAAK,SAAS;YAAE,MAAM,CAAC,IAAI,GAAG,IAAI,CAAC;QAC3C,IAAI,KAAK,KAAK,SAAS;YAAE,MAAM,CAAC,KAAK,GAAG,KAAK,CAAC;QAC9C,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAuB;YAC7C,KAAK,EAAE,cAAM,CAAC,QAAQ;YACtB,MAAM,EAAE,kBAAU,CAAC,GAAG;YACtB,MAAM;SACP,CAAC,CAAC;IACL,CAAC;IAED,KAAK,CAAC,IAAI,CACR,IAiCC,EACD,QAAiB,KAAK;QAEtB,IAAI,IAAI,CAAC,IAAI,KAAK,mBAAW,CAAC,UAAU,EAAE,CAAC;YACzC,MAAM,EAAE,GAAG,EAAE,OAAO,EAAE,YAAY,EAAE,QAAQ,EAAE,WAAW,EAAE,KAAK,EAAE,GAAG,IAAI,CAAC,IAAI,CAAC;YAC/E,IAAI,CAAC,GAAG,IAAI,CAAC,OAAO,IAAI,CAAC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xC,MAAM,EAAE,kBAAU,CAAC,IAAI;YACvB,IAAI,EAAE,IAAI;SACX,CAAC,CAAC;IACL,CAAC;IAED,KAAK,CAAC,YAAY,CAAC,EAAU;QAC3B,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAc;YACpC,KAAK,EAAE,GAAG,cAAM,CAAC,QAAQ,gBAAgB;YACzC,MAAM,EAAE,kBAAU,CAAC,IAAI;YACvB,IAAI,EAAE,EAAE,EAAE,EAAE;SACb,CAAC,CAAC;IACL,CAAC;IAED,KAAK,CAAC,cAAc,CAAC,IAAY;QAC/B,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAc;YACpC,KAAK,EAAE,GAAG,cAAM,CAAC,QAAQ,mBAAmB;YAC5C,MAAM,EAAE,kBAAU,CAAC,IAAI;YACvB,IAAI,EAAE,EAAE,IAAI,EAAE;SACf,CAAC,CAAC;IACL,CAAC;CACF;AAzND,wCAyNC","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, LiveLocationData, SendContactsData,\n ProductMessageData, GroupInviteMessageData,\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 async sendContacts(data: SendContactsData): Promise<SendMessageRoot> {\n return this.http.request<SendMessageRoot>({\n route: `${Routes.MESSAGES}/contacts`,\n method: HttpMethod.POST,\n body: data,\n });\n }\n\n async sendLiveLocation(data: LiveLocationData): Promise<SendMessageRoot> {\n return this.http.request<SendMessageRoot>({\n route: `${Routes.MESSAGES}/live-location`,\n method: HttpMethod.POST,\n body: data,\n });\n }\n\n async unpin(id: string): Promise<ApiResponse> {\n return this.http.request<ApiResponse>({\n route: `${Routes.MESSAGES}/unpin`,\n method: HttpMethod.POST,\n body: { id },\n });\n }\n\n async getDetails(messageId: string): Promise<ApiResponse> {\n return this.http.request<ApiResponse>({\n route: `${Routes.MESSAGES}/${messageId}`,\n method: HttpMethod.GET,\n });\n }\n\n async getMedia(messageId: string, format?: string): Promise<ApiResponse> {\n const params: Record<string, string> = {};\n if (format) params.format = format;\n return this.http.request<ApiResponse>({\n route: `${Routes.MESSAGES}/${messageId}/media`,\n method: HttpMethod.GET,\n params,\n });\n }\n\n async sendProduct(data: ProductMessageData): Promise<SendMessageRoot> {\n return this.http.request<SendMessageRoot>({\n route: `${Routes.MESSAGES}/product`,\n method: HttpMethod.POST,\n body: data,\n });\n }\n\n async sendGroupInvite(data: GroupInviteMessageData): Promise<SendMessageRoot> {\n return this.http.request<SendMessageRoot>({\n route: `${Routes.MESSAGES}/group-invite`,\n method: HttpMethod.POST,\n body: data,\n });\n }\n\n async requestPhone(to: string): Promise<ApiResponse> {\n return this.http.request<ApiResponse>({\n route: `${Routes.MESSAGES}/request-phone`,\n method: HttpMethod.POST,\n body: { to },\n });\n }\n\n async createCallLink(type: string): Promise<ApiResponse> {\n return this.http.request<ApiResponse>({\n route: `${Routes.MESSAGES}/create-call-link`,\n method: HttpMethod.POST,\n body: { type },\n });\n }\n}\n"]}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { IHttpClient } from '../client/IHttpClient';
|
|
2
|
+
import { ApiResponse } from '../types';
|
|
3
|
+
export declare class NewsletterService {
|
|
4
|
+
private readonly http;
|
|
5
|
+
constructor(http: IHttpClient);
|
|
6
|
+
create(name: string, description?: string): Promise<ApiResponse>;
|
|
7
|
+
getMetadata(type: string, id: string): Promise<ApiResponse>;
|
|
8
|
+
getSubscribers(id: string): Promise<ApiResponse>;
|
|
9
|
+
getAdmins(id: string): Promise<ApiResponse>;
|
|
10
|
+
follow(id: string): Promise<ApiResponse>;
|
|
11
|
+
unfollow(id: string): Promise<ApiResponse>;
|
|
12
|
+
updateName(id: string, name: string): Promise<ApiResponse>;
|
|
13
|
+
updateDescription(id: string, description: string): Promise<ApiResponse>;
|
|
14
|
+
updatePicture(id: string, url: string): Promise<ApiResponse>;
|
|
15
|
+
removePicture(id: string): Promise<ApiResponse>;
|
|
16
|
+
transferOwnership(id: string, newOwnerJid: string): Promise<ApiResponse>;
|
|
17
|
+
demoteAdmin(id: string, userJid: string): Promise<ApiResponse>;
|
|
18
|
+
getMessages(id: string, count?: number, since?: number, after?: number): Promise<ApiResponse>;
|
|
19
|
+
react(id: string, serverId: string, reaction: string): Promise<ApiResponse>;
|
|
20
|
+
mute(id: string): Promise<ApiResponse>;
|
|
21
|
+
unmute(id: string): Promise<ApiResponse>;
|
|
22
|
+
delete(id: string): Promise<ApiResponse>;
|
|
23
|
+
}
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.NewsletterService = void 0;
|
|
4
|
+
const types_1 = require("../types");
|
|
5
|
+
class NewsletterService {
|
|
6
|
+
constructor(http) {
|
|
7
|
+
this.http = http;
|
|
8
|
+
}
|
|
9
|
+
async create(name, description) {
|
|
10
|
+
return this.http.request({
|
|
11
|
+
route: types_1.Routes.NEWSLETTER,
|
|
12
|
+
method: types_1.HttpMethod.POST,
|
|
13
|
+
body: { name, description },
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
async getMetadata(type, id) {
|
|
17
|
+
return this.http.request({
|
|
18
|
+
route: `${types_1.Routes.NEWSLETTER}/metadata`,
|
|
19
|
+
method: types_1.HttpMethod.GET,
|
|
20
|
+
params: { type, id },
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
async getSubscribers(id) {
|
|
24
|
+
return this.http.request({
|
|
25
|
+
route: `${types_1.Routes.NEWSLETTER}/${id}/subscribers`,
|
|
26
|
+
method: types_1.HttpMethod.GET,
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
async getAdmins(id) {
|
|
30
|
+
return this.http.request({
|
|
31
|
+
route: `${types_1.Routes.NEWSLETTER}/${id}/admins`,
|
|
32
|
+
method: types_1.HttpMethod.GET,
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
async follow(id) {
|
|
36
|
+
return this.http.request({
|
|
37
|
+
route: `${types_1.Routes.NEWSLETTER}/${id}/follow`,
|
|
38
|
+
method: types_1.HttpMethod.POST,
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
async unfollow(id) {
|
|
42
|
+
return this.http.request({
|
|
43
|
+
route: `${types_1.Routes.NEWSLETTER}/${id}/unfollow`,
|
|
44
|
+
method: types_1.HttpMethod.POST,
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
async updateName(id, name) {
|
|
48
|
+
return this.http.request({
|
|
49
|
+
route: `${types_1.Routes.NEWSLETTER}/${id}/name`,
|
|
50
|
+
method: types_1.HttpMethod.PUT,
|
|
51
|
+
body: { name },
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
async updateDescription(id, description) {
|
|
55
|
+
return this.http.request({
|
|
56
|
+
route: `${types_1.Routes.NEWSLETTER}/${id}/description`,
|
|
57
|
+
method: types_1.HttpMethod.PUT,
|
|
58
|
+
body: { description },
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
async updatePicture(id, url) {
|
|
62
|
+
return this.http.request({
|
|
63
|
+
route: `${types_1.Routes.NEWSLETTER}/${id}/picture`,
|
|
64
|
+
method: types_1.HttpMethod.PUT,
|
|
65
|
+
body: { url },
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
async removePicture(id) {
|
|
69
|
+
return this.http.request({
|
|
70
|
+
route: `${types_1.Routes.NEWSLETTER}/${id}/picture`,
|
|
71
|
+
method: types_1.HttpMethod.DELETE,
|
|
72
|
+
});
|
|
73
|
+
}
|
|
74
|
+
async transferOwnership(id, newOwnerJid) {
|
|
75
|
+
return this.http.request({
|
|
76
|
+
route: `${types_1.Routes.NEWSLETTER}/${id}/owner`,
|
|
77
|
+
method: types_1.HttpMethod.PUT,
|
|
78
|
+
body: { newOwnerJid },
|
|
79
|
+
});
|
|
80
|
+
}
|
|
81
|
+
async demoteAdmin(id, userJid) {
|
|
82
|
+
return this.http.request({
|
|
83
|
+
route: `${types_1.Routes.NEWSLETTER}/${id}/demote`,
|
|
84
|
+
method: types_1.HttpMethod.PUT,
|
|
85
|
+
body: { userJid },
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
async getMessages(id, count, since, after) {
|
|
89
|
+
const params = {};
|
|
90
|
+
if (count !== undefined)
|
|
91
|
+
params.count = count;
|
|
92
|
+
if (since !== undefined)
|
|
93
|
+
params.since = since;
|
|
94
|
+
if (after !== undefined)
|
|
95
|
+
params.after = after;
|
|
96
|
+
return this.http.request({
|
|
97
|
+
route: `${types_1.Routes.NEWSLETTER}/${id}/messages`,
|
|
98
|
+
method: types_1.HttpMethod.GET,
|
|
99
|
+
params,
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
async react(id, serverId, reaction) {
|
|
103
|
+
return this.http.request({
|
|
104
|
+
route: `${types_1.Routes.NEWSLETTER}/${id}/react`,
|
|
105
|
+
method: types_1.HttpMethod.POST,
|
|
106
|
+
body: { serverId, reaction },
|
|
107
|
+
});
|
|
108
|
+
}
|
|
109
|
+
async mute(id) {
|
|
110
|
+
return this.http.request({
|
|
111
|
+
route: `${types_1.Routes.NEWSLETTER}/${id}/mute`,
|
|
112
|
+
method: types_1.HttpMethod.POST,
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
async unmute(id) {
|
|
116
|
+
return this.http.request({
|
|
117
|
+
route: `${types_1.Routes.NEWSLETTER}/${id}/unmute`,
|
|
118
|
+
method: types_1.HttpMethod.POST,
|
|
119
|
+
});
|
|
120
|
+
}
|
|
121
|
+
async delete(id) {
|
|
122
|
+
return this.http.request({
|
|
123
|
+
route: `${types_1.Routes.NEWSLETTER}/${id}`,
|
|
124
|
+
method: types_1.HttpMethod.DELETE,
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
exports.NewsletterService = NewsletterService;
|
|
129
|
+
//# sourceMappingURL=NewsletterService.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"NewsletterService.js","sourceRoot":"","sources":["../../src/services/NewsletterService.ts"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AAC,IAAI;YACvB,IAAI,EAAE,EAAE,QAAQ,EAAE,QAAQ,EAAE;SAC7B,CAAC,CAAC;IACL,CAAC;IAED,KAAK,CAAC,IAAI,CAAC,EAAU;QACnB,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAc;YACpC,KAAK,EAAE,GAAG,cAAM,CAAC,UAAU,IAAI,EAAE,OAAO;YACxC,MAAM,EAAE,kBAAU,CAAC,IAAI;SACxB,CAAC,CAAC;IACL,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,EAAU;QACrB,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAc;YACpC,KAAK,EAAE,GAAG,cAAM,CAAC,UAAU,IAAI,EAAE,SAAS;YAC1C,MAAM,EAAE,kBAAU,CAAC,IAAI;SACxB,CAAC,CAAC;IACL,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,EAAU;QACrB,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAc;YACpC,KAAK,EAAE,GAAG,cAAM,CAAC,UAAU,IAAI,EAAE,EAAE;YACnC,MAAM,EAAE,kBAAU,CAAC,MAAM;SAC1B,CAAC,CAAC;IACL,CAAC;CACF;AAtID,8CAsIC","sourcesContent":["import { IHttpClient } from '../client/IHttpClient';\nimport { Routes, HttpMethod, ApiResponse, NewsletterInfo } from '../types';\n\nexport class NewsletterService {\n constructor(private readonly http: IHttpClient) {}\n\n async create(name: string, description?: string): Promise<ApiResponse> {\n return this.http.request<ApiResponse>({\n route: Routes.NEWSLETTER,\n method: HttpMethod.POST,\n body: { name, description },\n });\n }\n\n async getMetadata(type: string, id: string): Promise<ApiResponse> {\n return this.http.request<ApiResponse>({\n route: `${Routes.NEWSLETTER}/metadata`,\n method: HttpMethod.GET,\n params: { type, id },\n });\n }\n\n async getSubscribers(id: string): Promise<ApiResponse> {\n return this.http.request<ApiResponse>({\n route: `${Routes.NEWSLETTER}/${id}/subscribers`,\n method: HttpMethod.GET,\n });\n }\n\n async getAdmins(id: string): Promise<ApiResponse> {\n return this.http.request<ApiResponse>({\n route: `${Routes.NEWSLETTER}/${id}/admins`,\n method: HttpMethod.GET,\n });\n }\n\n async follow(id: string): Promise<ApiResponse> {\n return this.http.request<ApiResponse>({\n route: `${Routes.NEWSLETTER}/${id}/follow`,\n method: HttpMethod.POST,\n });\n }\n\n async unfollow(id: string): Promise<ApiResponse> {\n return this.http.request<ApiResponse>({\n route: `${Routes.NEWSLETTER}/${id}/unfollow`,\n method: HttpMethod.POST,\n });\n }\n\n async updateName(id: string, name: string): Promise<ApiResponse> {\n return this.http.request<ApiResponse>({\n route: `${Routes.NEWSLETTER}/${id}/name`,\n method: HttpMethod.PUT,\n body: { name },\n });\n }\n\n async updateDescription(id: string, description: string): Promise<ApiResponse> {\n return this.http.request<ApiResponse>({\n route: `${Routes.NEWSLETTER}/${id}/description`,\n method: HttpMethod.PUT,\n body: { description },\n });\n }\n\n async updatePicture(id: string, url: string): Promise<ApiResponse> {\n return this.http.request<ApiResponse>({\n route: `${Routes.NEWSLETTER}/${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.NEWSLETTER}/${id}/picture`,\n method: HttpMethod.DELETE,\n });\n }\n\n async transferOwnership(id: string, newOwnerJid: string): Promise<ApiResponse> {\n return this.http.request<ApiResponse>({\n route: `${Routes.NEWSLETTER}/${id}/owner`,\n method: HttpMethod.PUT,\n body: { newOwnerJid },\n });\n }\n\n async demoteAdmin(id: string, userJid: string): Promise<ApiResponse> {\n return this.http.request<ApiResponse>({\n route: `${Routes.NEWSLETTER}/${id}/demote`,\n method: HttpMethod.PUT,\n body: { userJid },\n });\n }\n\n async getMessages(id: string, count?: number, since?: number, after?: number): Promise<ApiResponse> {\n const params: Record<string, number> = {};\n if (count !== undefined) params.count = count;\n if (since !== undefined) params.since = since;\n if (after !== undefined) params.after = after;\n return this.http.request<ApiResponse>({\n route: `${Routes.NEWSLETTER}/${id}/messages`,\n method: HttpMethod.GET,\n params,\n });\n }\n\n async react(id: string, serverId: string, reaction: string): Promise<ApiResponse> {\n return this.http.request<ApiResponse>({\n route: `${Routes.NEWSLETTER}/${id}/react`,\n method: HttpMethod.POST,\n body: { serverId, reaction },\n });\n }\n\n async mute(id: string): Promise<ApiResponse> {\n return this.http.request<ApiResponse>({\n route: `${Routes.NEWSLETTER}/${id}/mute`,\n method: HttpMethod.POST,\n });\n }\n\n async unmute(id: string): Promise<ApiResponse> {\n return this.http.request<ApiResponse>({\n route: `${Routes.NEWSLETTER}/${id}/unmute`,\n method: HttpMethod.POST,\n });\n }\n\n async delete(id: string): Promise<ApiResponse> {\n return this.http.request<ApiResponse>({\n route: `${Routes.NEWSLETTER}/${id}`,\n method: HttpMethod.DELETE,\n });\n }\n}\n"]}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { IHttpClient } from '../client/IHttpClient';
|
|
2
|
+
import { ApiResponse, StatusTextData, StatusMediaData, StatusMentionData } from '../types';
|
|
3
|
+
export declare class StatusService {
|
|
4
|
+
private readonly http;
|
|
5
|
+
constructor(http: IHttpClient);
|
|
6
|
+
sendText(data: StatusTextData): Promise<ApiResponse>;
|
|
7
|
+
sendImage(data: StatusMediaData): Promise<ApiResponse>;
|
|
8
|
+
sendVideo(data: StatusMediaData): Promise<ApiResponse>;
|
|
9
|
+
sendAudio(data: {
|
|
10
|
+
url: string;
|
|
11
|
+
statusJidList?: string[];
|
|
12
|
+
}): Promise<ApiResponse>;
|
|
13
|
+
mention(data: StatusMentionData): Promise<ApiResponse>;
|
|
14
|
+
}
|