@raphaelvserafim/client-api-whatsapp 1.2.0 → 1.4.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.
Files changed (41) hide show
  1. package/README.md +154 -1
  2. package/dist/WhatsApp.d.ts +40 -2
  3. package/dist/WhatsApp.js +36 -1
  4. package/dist/WhatsApp.js.map +1 -1
  5. package/dist/index.d.ts +3 -1
  6. package/dist/index.js +5 -1
  7. package/dist/index.js.map +1 -1
  8. package/dist/services/CallService.d.ts +2 -0
  9. package/dist/services/CallService.js +14 -0
  10. package/dist/services/CallService.js.map +1 -1
  11. package/dist/services/ChatService.d.ts +4 -1
  12. package/dist/services/ChatService.js +27 -2
  13. package/dist/services/ChatService.js.map +1 -1
  14. package/dist/services/CommunityService.d.ts +8 -1
  15. package/dist/services/CommunityService.js +49 -0
  16. package/dist/services/CommunityService.js.map +1 -1
  17. package/dist/services/ContactService.d.ts +6 -0
  18. package/dist/services/ContactService.js +38 -0
  19. package/dist/services/ContactService.js.map +1 -1
  20. package/dist/services/GroupService.d.ts +5 -0
  21. package/dist/services/GroupService.js +13 -0
  22. package/dist/services/GroupService.js.map +1 -1
  23. package/dist/services/InstanceService.d.ts +1 -0
  24. package/dist/services/InstanceService.js +6 -0
  25. package/dist/services/InstanceService.js.map +1 -1
  26. package/dist/services/LabelService.d.ts +1 -0
  27. package/dist/services/LabelService.js +7 -1
  28. package/dist/services/LabelService.js.map +1 -1
  29. package/dist/services/MessageService.d.ts +10 -1
  30. package/dist/services/MessageService.js +65 -0
  31. package/dist/services/MessageService.js.map +1 -1
  32. package/dist/services/NewsletterService.d.ts +23 -0
  33. package/dist/services/NewsletterService.js +129 -0
  34. package/dist/services/NewsletterService.js.map +1 -0
  35. package/dist/services/StatusService.d.ts +14 -0
  36. package/dist/services/StatusService.js +46 -0
  37. package/dist/services/StatusService.js.map +1 -0
  38. package/dist/types/index.d.ts +53 -2
  39. package/dist/types/index.js +2 -0
  40. package/dist/types/index.js.map +1 -1
  41. package/package.json +2 -1
@@ -1 +1 @@
1
- {"version":3,"file":"CallService.js","sourceRoot":"","sources":["../../src/services/CallService.ts"],"names":[],"mappings":";;;AACA,oCAAyE;AAEzE,MAAa,WAAW;IACtB,YAA6B,IAAiB;QAAjB,SAAI,GAAJ,IAAI,CAAa;IAAG,CAAC;IAElD,KAAK,CAAC,IAAI,CAAC,EAAU,EAAE,UAAmB,KAAK;QAC7C,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAe;YACrC,KAAK,EAAE,cAAM,CAAC,IAAI;YAClB,MAAM,EAAE,kBAAU,CAAC,IAAI;YACvB,IAAI,EAAE,EAAE,EAAE,EAAE,OAAO,EAAE;SACtB,CAAC,CAAC;IACL,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,EAAU,EAAE,IAAY;QACnC,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAc;YACpC,KAAK,EAAE,GAAG,cAAM,CAAC,IAAI,IAAI,EAAE,IAAI,IAAI,EAAE;YACrC,MAAM,EAAE,kBAAU,CAAC,MAAM;SAC1B,CAAC,CAAC;IACL,CAAC;CACF;AAjBD,kCAiBC","sourcesContent":["import { IHttpClient } from '../client/IHttpClient';\nimport { Routes, HttpMethod, ApiResponse, CallResponse } from '../types';\n\nexport class CallService {\n constructor(private readonly http: IHttpClient) {}\n\n async call(to: string, isVideo: boolean = false): Promise<CallResponse> {\n return this.http.request<CallResponse>({\n route: Routes.CALL,\n method: HttpMethod.POST,\n body: { to, isVideo },\n });\n }\n\n async reject(id: string, from: string): Promise<ApiResponse> {\n return this.http.request<ApiResponse>({\n route: `${Routes.CALL}/${id}/${from}`,\n method: HttpMethod.DELETE,\n });\n }\n}\n"]}
1
+ {"version":3,"file":"CallService.js","sourceRoot":"","sources":["../../src/services/CallService.ts"],"names":[],"mappings":";;;AACA,oCAAyE;AAEzE,MAAa,WAAW;IACtB,YAA6B,IAAiB;QAAjB,SAAI,GAAJ,IAAI,CAAa;IAAG,CAAC;IAElD,KAAK,CAAC,IAAI,CAAC,EAAU,EAAE,UAAmB,KAAK;QAC7C,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAe;YACrC,KAAK,EAAE,cAAM,CAAC,IAAI;YAClB,MAAM,EAAE,kBAAU,CAAC,IAAI;YACvB,IAAI,EAAE,EAAE,EAAE,EAAE,OAAO,EAAE;SACtB,CAAC,CAAC;IACL,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,EAAU,EAAE,IAAY;QACnC,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAc;YACpC,KAAK,EAAE,GAAG,cAAM,CAAC,IAAI,IAAI,EAAE,IAAI,IAAI,EAAE;YACrC,MAAM,EAAE,kBAAU,CAAC,MAAM;SAC1B,CAAC,CAAC;IACL,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,MAAc,EAAE,QAAgB;QAC3C,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAc;YACpC,KAAK,EAAE,GAAG,cAAM,CAAC,IAAI,SAAS;YAC9B,MAAM,EAAE,kBAAU,CAAC,IAAI;YACvB,IAAI,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE;SAC3B,CAAC,CAAC;IACL,CAAC;IAED,KAAK,CAAC,GAAG,CAAC,MAAc,EAAE,OAAe;QACvC,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAc;YACpC,KAAK,EAAE,GAAG,cAAM,CAAC,IAAI,MAAM;YAC3B,MAAM,EAAE,kBAAU,CAAC,IAAI;YACvB,IAAI,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE;SAC1B,CAAC,CAAC;IACL,CAAC;CACF;AAjCD,kCAiCC","sourcesContent":["import { IHttpClient } from '../client/IHttpClient';\nimport { Routes, HttpMethod, ApiResponse, CallResponse } from '../types';\n\nexport class CallService {\n constructor(private readonly http: IHttpClient) {}\n\n async call(to: string, isVideo: boolean = false): Promise<CallResponse> {\n return this.http.request<CallResponse>({\n route: Routes.CALL,\n method: HttpMethod.POST,\n body: { to, isVideo },\n });\n }\n\n async reject(id: string, from: string): Promise<ApiResponse> {\n return this.http.request<ApiResponse>({\n route: `${Routes.CALL}/${id}/${from}`,\n method: HttpMethod.DELETE,\n });\n }\n\n async accept(callId: string, callFrom: string): Promise<ApiResponse> {\n return this.http.request<ApiResponse>({\n route: `${Routes.CALL}/accept`,\n method: HttpMethod.POST,\n body: { callId, callFrom },\n });\n }\n\n async end(callId: string, peerJid: string): Promise<ApiResponse> {\n return this.http.request<ApiResponse>({\n route: `${Routes.CALL}/end`,\n method: HttpMethod.POST,\n body: { callId, peerJid },\n });\n }\n}\n"]}
@@ -9,8 +9,11 @@ export declare class ChatService {
9
9
  }>;
10
10
  modify(id: string, action: 'markRead' | 'pin', value: boolean): Promise<ApiResponse>;
11
11
  delete(chatId: string): Promise<ApiResponse>;
12
- messages(chatId: string): Promise<{
12
+ messages(chatId: string, page?: number, limit?: number): Promise<{
13
13
  status: number;
14
14
  data: MessageData[];
15
15
  }>;
16
+ presenceSubscribe(jid: string): Promise<ApiResponse>;
17
+ disappearing(jid: string, expiration: number): Promise<ApiResponse>;
18
+ privacy(): Promise<ApiResponse>;
16
19
  }
@@ -26,11 +26,36 @@ class ChatService {
26
26
  params: { chatId },
27
27
  });
28
28
  }
29
- async messages(chatId) {
29
+ async messages(chatId, page, limit) {
30
+ const params = { chatId };
31
+ if (page !== undefined)
32
+ params.page = page;
33
+ if (limit !== undefined)
34
+ params.limit = limit;
30
35
  return this.http.request({
31
36
  route: `${types_1.Routes.CHAT}/messages`,
32
37
  method: types_1.HttpMethod.GET,
33
- params: { chatId },
38
+ params,
39
+ });
40
+ }
41
+ async presenceSubscribe(jid) {
42
+ return this.http.request({
43
+ route: `${types_1.Routes.CHAT}/presence/subscribe`,
44
+ method: types_1.HttpMethod.POST,
45
+ body: { jid },
46
+ });
47
+ }
48
+ async disappearing(jid, expiration) {
49
+ return this.http.request({
50
+ route: `${types_1.Routes.CHAT}/disappearing`,
51
+ method: types_1.HttpMethod.POST,
52
+ body: { jid, expiration },
53
+ });
54
+ }
55
+ async privacy() {
56
+ return this.http.request({
57
+ route: `${types_1.Routes.CHAT}/privacy`,
58
+ method: types_1.HttpMethod.GET,
34
59
  });
35
60
  }
36
61
  }
@@ -1 +1 @@
1
- {"version":3,"file":"ChatService.js","sourceRoot":"","sources":["../../src/services/ChatService.ts"],"names":[],"mappings":";;;AACA,oCAAkF;AAElF,MAAa,WAAW;IACtB,YAA6B,IAAiB;QAAjB,SAAI,GAAJ,IAAI,CAAa;IAAG,CAAC;IAElD,KAAK,CAAC,IAAI;QACR,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAuC;YAC7D,KAAK,EAAE,cAAM,CAAC,IAAI;YAClB,MAAM,EAAE,kBAAU,CAAC,GAAG;SACvB,CAAC,CAAC;IACL,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,EAAU,EAAE,MAA0B,EAAE,KAAc;QACjE,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAc;YACpC,KAAK,EAAE,cAAM,CAAC,IAAI;YAClB,MAAM,EAAE,kBAAU,CAAC,KAAK;YACxB,MAAM,EAAE,EAAE,EAAE,EAAE,MAAM,EAAE,KAAK,EAAE;SAC9B,CAAC,CAAC;IACL,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,MAAc;QACzB,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAc;YACpC,KAAK,EAAE,cAAM,CAAC,IAAI;YAClB,MAAM,EAAE,kBAAU,CAAC,MAAM;YACzB,MAAM,EAAE,EAAE,MAAM,EAAE;SACnB,CAAC,CAAC;IACL,CAAC;IAED,KAAK,CAAC,QAAQ,CAAC,MAAc;QAC3B,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAA0C;YAChE,KAAK,EAAE,GAAG,cAAM,CAAC,IAAI,WAAW;YAChC,MAAM,EAAE,kBAAU,CAAC,GAAG;YACtB,MAAM,EAAE,EAAE,MAAM,EAAE;SACnB,CAAC,CAAC;IACL,CAAC;CACF;AAjCD,kCAiCC","sourcesContent":["import { IHttpClient } from '../client/IHttpClient';\nimport { Routes, HttpMethod, ApiResponse, ChatInfo, MessageData } from '../types';\n\nexport class ChatService {\n constructor(private readonly http: IHttpClient) {}\n\n async list(): Promise<{ status: number; data: ChatInfo[] }> {\n return this.http.request<{ status: number; data: ChatInfo[] }>({\n route: Routes.CHAT,\n method: HttpMethod.GET,\n });\n }\n\n async modify(id: string, action: 'markRead' | 'pin', value: boolean): Promise<ApiResponse> {\n return this.http.request<ApiResponse>({\n route: Routes.CHAT,\n method: HttpMethod.PATCH,\n params: { id, action, value },\n });\n }\n\n async delete(chatId: string): Promise<ApiResponse> {\n return this.http.request<ApiResponse>({\n route: Routes.CHAT,\n method: HttpMethod.DELETE,\n params: { chatId },\n });\n }\n\n async messages(chatId: string): Promise<{ status: number; data: MessageData[] }> {\n return this.http.request<{ status: number; data: MessageData[] }>({\n route: `${Routes.CHAT}/messages`,\n method: HttpMethod.GET,\n params: { chatId },\n });\n }\n}\n"]}
1
+ {"version":3,"file":"ChatService.js","sourceRoot":"","sources":["../../src/services/ChatService.ts"],"names":[],"mappings":";;;AACA,oCAAkF;AAElF,MAAa,WAAW;IACtB,YAA6B,IAAiB;QAAjB,SAAI,GAAJ,IAAI,CAAa;IAAG,CAAC;IAElD,KAAK,CAAC,IAAI;QACR,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAuC;YAC7D,KAAK,EAAE,cAAM,CAAC,IAAI;YAClB,MAAM,EAAE,kBAAU,CAAC,GAAG;SACvB,CAAC,CAAC;IACL,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,EAAU,EAAE,MAA0B,EAAE,KAAc;QACjE,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAc;YACpC,KAAK,EAAE,cAAM,CAAC,IAAI;YAClB,MAAM,EAAE,kBAAU,CAAC,KAAK;YACxB,MAAM,EAAE,EAAE,EAAE,EAAE,MAAM,EAAE,KAA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AAC,IAAI,CAAC,OAAO,CAAc;YACpC,KAAK,EAAE,GAAG,cAAM,CAAC,IAAI,UAAU;YAC/B,MAAM,EAAE,kBAAU,CAAC,GAAG;SACvB,CAAC,CAAC;IACL,CAAC;CACF;AA3DD,kCA2DC","sourcesContent":["import { IHttpClient } from '../client/IHttpClient';\nimport { Routes, HttpMethod, ApiResponse, ChatInfo, MessageData } from '../types';\n\nexport class ChatService {\n constructor(private readonly http: IHttpClient) {}\n\n async list(): Promise<{ status: number; data: ChatInfo[] }> {\n return this.http.request<{ status: number; data: ChatInfo[] }>({\n route: Routes.CHAT,\n method: HttpMethod.GET,\n });\n }\n\n async modify(id: string, action: 'markRead' | 'pin', value: boolean): Promise<ApiResponse> {\n return this.http.request<ApiResponse>({\n route: Routes.CHAT,\n method: HttpMethod.PATCH,\n params: { id, action, value },\n });\n }\n\n async delete(chatId: string): Promise<ApiResponse> {\n return this.http.request<ApiResponse>({\n route: Routes.CHAT,\n method: HttpMethod.DELETE,\n params: { chatId },\n });\n }\n\n async messages(chatId: string, page?: number, limit?: number): Promise<{ status: number; data: MessageData[] }> {\n const params: Record<string, string | number> = { chatId };\n if (page !== undefined) params.page = page;\n if (limit !== undefined) params.limit = limit;\n return this.http.request<{ status: number; data: MessageData[] }>({\n route: `${Routes.CHAT}/messages`,\n method: HttpMethod.GET,\n params,\n });\n }\n\n async presenceSubscribe(jid: string): Promise<ApiResponse> {\n return this.http.request<ApiResponse>({\n route: `${Routes.CHAT}/presence/subscribe`,\n method: HttpMethod.POST,\n body: { jid },\n });\n }\n\n async disappearing(jid: string, expiration: number): Promise<ApiResponse> {\n return this.http.request<ApiResponse>({\n route: `${Routes.CHAT}/disappearing`,\n method: HttpMethod.POST,\n body: { jid, expiration },\n });\n }\n\n async privacy(): Promise<ApiResponse> {\n return this.http.request<ApiResponse>({\n route: `${Routes.CHAT}/privacy`,\n method: HttpMethod.GET,\n });\n }\n}\n"]}
@@ -1,5 +1,5 @@
1
1
  import { IHttpClient } from '../client/IHttpClient';
2
- import { ApiResponse, CommunityInfo, InviteCodeResponse, CommunityCreate, CommunityUpdate, GroupParticipant, GroupParticipantsAction } from '../types';
2
+ import { ApiResponse, CommunityInfo, InviteCodeResponse, CommunityCreate, CommunityUpdate, GroupParticipant, GroupParticipantsAction, CommunityGroupCreate } from '../types';
3
3
  export declare class CommunityService {
4
4
  private readonly http;
5
5
  constructor(http: IHttpClient);
@@ -25,4 +25,11 @@ export declare class CommunityService {
25
25
  data: GroupParticipant[];
26
26
  }>;
27
27
  updateRequestParticipants(id: string, data: GroupParticipantsAction): Promise<ApiResponse>;
28
+ acceptInvite(code: string): Promise<ApiResponse>;
29
+ getInviteInfo(code: string): Promise<ApiResponse>;
30
+ createGroup(id: string, data: CommunityGroupCreate): Promise<ApiResponse>;
31
+ ephemeral(id: string, expiration: number): Promise<ApiResponse>;
32
+ updateSettings(id: string, setting: string): Promise<ApiResponse>;
33
+ memberAddMode(id: string, mode: string): Promise<ApiResponse>;
34
+ joinApproval(id: string, mode: string): Promise<ApiResponse>;
28
35
  }
@@ -71,6 +71,55 @@ class CommunityService {
71
71
  body: data,
72
72
  });
73
73
  }
74
+ async acceptInvite(code) {
75
+ return this.http.request({
76
+ route: `${types_1.Routes.COMMUNITY}/invite/accept`,
77
+ method: types_1.HttpMethod.POST,
78
+ body: { code },
79
+ });
80
+ }
81
+ async getInviteInfo(code) {
82
+ return this.http.request({
83
+ route: `${types_1.Routes.COMMUNITY}/invite/info`,
84
+ method: types_1.HttpMethod.GET,
85
+ params: { code },
86
+ });
87
+ }
88
+ async createGroup(id, data) {
89
+ return this.http.request({
90
+ route: `${types_1.Routes.COMMUNITY}/${id}/group`,
91
+ method: types_1.HttpMethod.POST,
92
+ body: data,
93
+ });
94
+ }
95
+ async ephemeral(id, expiration) {
96
+ return this.http.request({
97
+ route: `${types_1.Routes.COMMUNITY}/${id}/ephemeral`,
98
+ method: types_1.HttpMethod.POST,
99
+ body: { expiration },
100
+ });
101
+ }
102
+ async updateSettings(id, setting) {
103
+ return this.http.request({
104
+ route: `${types_1.Routes.COMMUNITY}/${id}/settings`,
105
+ method: types_1.HttpMethod.PATCH,
106
+ body: { setting },
107
+ });
108
+ }
109
+ async memberAddMode(id, mode) {
110
+ return this.http.request({
111
+ route: `${types_1.Routes.COMMUNITY}/${id}/member-add-mode`,
112
+ method: types_1.HttpMethod.PATCH,
113
+ body: { mode },
114
+ });
115
+ }
116
+ async joinApproval(id, mode) {
117
+ return this.http.request({
118
+ route: `${types_1.Routes.COMMUNITY}/${id}/join-approval`,
119
+ method: types_1.HttpMethod.PATCH,
120
+ body: { mode },
121
+ });
122
+ }
74
123
  }
75
124
  exports.CommunityService = CommunityService;
76
125
  //# sourceMappingURL=CommunityService.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"CommunityService.js","sourceRoot":"","sources":["../../src/services/CommunityService.ts"],"names":[],"mappings":";;;AACA,oCAGkB;AAElB,MAAa,gBAAgB;IAC3B,YAA6B,IAAiB;QAAjB,SAAI,GAAJ,IAAI,CAAa;IAAG,CAAC;IAElD,KAAK,CAAC,IAAI;QACR,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAA4C;YAClE,KAAK,EAAE,cAAM,CAAC,SAAS;YACvB,MAAM,EAAE,kBAAU,CAAC,GAAG;SACvB,CAAC,CAAC;IACL,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,IAAqB;QAChC,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAA0C;YAChE,KAAK,EAAE,cAAM,CAAC,SAAS;YACvB,MAAM,EAAE,kBAAU,CAAC,IAAI;YACvB,IAAI,EAAE,IAAI;SACX,CAAC,CAAC;IACL,CAAC;IAED,KAAK,CAAC,IAAI,CAAC,EAAU;QACnB,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAA0C;YAChE,KAAK,EAAE,GAAG,cAAM,CAAC,SAAS,IAAI,EAAE,EAAE;YAClC,MAAM,EAAE,kBAAU,CAAC,GAAG;SACvB,CAAC,C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AAC,EAAU;QACrC,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAA+C;YACrE,KAAK,EAAE,GAAG,cAAM,CAAC,SAAS,IAAI,EAAE,4BAA4B;YAC5D,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,SAAS,IAAI,EAAE,4BAA4B;YAC5D,MAAM,EAAE,kBAAU,CAAC,GAAG;YACtB,IAAI,EAAE,IAAI;SACX,CAAC,CAAC;IACL,CAAC;CACF;AA7ED,4CA6EC","sourcesContent":["import { IHttpClient } from '../client/IHttpClient';\nimport {\n Routes, HttpMethod, ApiResponse, CommunityInfo, InviteCodeResponse,\n CommunityCreate, CommunityUpdate, GroupParticipant, GroupParticipantsAction,\n} from '../types';\n\nexport class CommunityService {\n constructor(private readonly http: IHttpClient) {}\n\n async list(): Promise<{ status: number; data: CommunityInfo[] }> {\n return this.http.request<{ status: number; data: CommunityInfo[] }>({\n route: Routes.COMMUNITY,\n method: HttpMethod.GET,\n });\n }\n\n async create(data: CommunityCreate): Promise<{ status: number; data: CommunityInfo }> {\n return this.http.request<{ status: number; data: CommunityInfo }>({\n route: Routes.COMMUNITY,\n method: HttpMethod.POST,\n body: data,\n });\n }\n\n async info(id: string): Promise<{ status: number; data: CommunityInfo }> {\n return this.http.request<{ status: number; data: CommunityInfo }>({\n route: `${Routes.COMMUNITY}/${id}`,\n method: HttpMethod.GET,\n });\n }\n\n async update(id: string, data: CommunityUpdate): Promise<ApiResponse> {\n return this.http.request<ApiResponse>({\n route: `${Routes.COMMUNITY}/${id}`,\n method: HttpMethod.PUT,\n body: data,\n });\n }\n\n async leave(id: string): Promise<ApiResponse> {\n return this.http.request<ApiResponse>({\n route: `${Routes.COMMUNITY}/${id}`,\n method: HttpMethod.DELETE,\n });\n }\n\n async updatePicture(id: string, url: string): Promise<ApiResponse> {\n return this.http.request<ApiResponse>({\n route: `${Routes.COMMUNITY}/${id}/picture`,\n method: HttpMethod.PUT,\n body: { url },\n });\n }\n\n async getInviteCode(id: string): Promise<InviteCodeResponse> {\n return this.http.request<InviteCodeResponse>({\n route: `${Routes.COMMUNITY}/${id}/invite`,\n method: HttpMethod.POST,\n });\n }\n\n async removeParticipants(id: string, participants: string[]): Promise<ApiResponse> {\n return this.http.request<ApiResponse>({\n route: `${Routes.COMMUNITY}/${id}/participants`,\n method: HttpMethod.DELETE,\n body: { participants },\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.COMMUNITY}/${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.COMMUNITY}/${id}/request_participants_list`,\n method: HttpMethod.PUT,\n body: data,\n });\n }\n}\n"]}
1
+ {"version":3,"file":"CommunityService.js","sourceRoot":"","sources":["../../src/services/CommunityService.ts"],"names":[],"mappings":";;;AACA,oCAIkB;AAElB,MAAa,gBAAgB;IAC3B,YAA6B,IAAiB;QAAjB,SAAI,GAAJ,IAAI,CAAa;IAAG,CAAC;IAElD,KAAK,CAAC,IAAI;QACR,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAA4C;YAClE,KAAK,EAAE,cAAM,CAAC,SAAS;YACvB,MAAM,EAAE,kBAAU,CAAC,GAAG;SACvB,CAAC,CAAC;IACL,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,IAAqB;QAChC,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAA0C;YAChE,KAAK,EAAE,cAAM,CAAC,SAAS;YACvB,MAAM,EAAE,kBAAU,CAAC,IAAI;YACvB,IAAI,EAAE,IAAI;SACX,CAAC,C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nimport {\n Routes, HttpMethod, ApiResponse, CommunityInfo, InviteCodeResponse,\n CommunityCreate, CommunityUpdate, GroupParticipant, GroupParticipantsAction,\n CommunityGroupCreate,\n} from '../types';\n\nexport class CommunityService {\n constructor(private readonly http: IHttpClient) {}\n\n async list(): Promise<{ status: number; data: CommunityInfo[] }> {\n return this.http.request<{ status: number; data: CommunityInfo[] }>({\n route: Routes.COMMUNITY,\n method: HttpMethod.GET,\n });\n }\n\n async create(data: CommunityCreate): Promise<{ status: number; data: CommunityInfo }> {\n return this.http.request<{ status: number; data: CommunityInfo }>({\n route: Routes.COMMUNITY,\n method: HttpMethod.POST,\n body: data,\n });\n }\n\n async info(id: string): Promise<{ status: number; data: CommunityInfo }> {\n return this.http.request<{ status: number; data: CommunityInfo }>({\n route: `${Routes.COMMUNITY}/${id}`,\n method: HttpMethod.GET,\n });\n }\n\n async update(id: string, data: CommunityUpdate): Promise<ApiResponse> {\n return this.http.request<ApiResponse>({\n route: `${Routes.COMMUNITY}/${id}`,\n method: HttpMethod.PUT,\n body: data,\n });\n }\n\n async leave(id: string): Promise<ApiResponse> {\n return this.http.request<ApiResponse>({\n route: `${Routes.COMMUNITY}/${id}`,\n method: HttpMethod.DELETE,\n });\n }\n\n async updatePicture(id: string, url: string): Promise<ApiResponse> {\n return this.http.request<ApiResponse>({\n route: `${Routes.COMMUNITY}/${id}/picture`,\n method: HttpMethod.PUT,\n body: { url },\n });\n }\n\n async getInviteCode(id: string): Promise<InviteCodeResponse> {\n return this.http.request<InviteCodeResponse>({\n route: `${Routes.COMMUNITY}/${id}/invite`,\n method: HttpMethod.POST,\n });\n }\n\n async removeParticipants(id: string, participants: string[]): Promise<ApiResponse> {\n return this.http.request<ApiResponse>({\n route: `${Routes.COMMUNITY}/${id}/participants`,\n method: HttpMethod.DELETE,\n body: { participants },\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.COMMUNITY}/${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.COMMUNITY}/${id}/request_participants_list`,\n method: HttpMethod.PUT,\n body: data,\n });\n }\n\n async acceptInvite(code: string): Promise<ApiResponse> {\n return this.http.request<ApiResponse>({\n route: `${Routes.COMMUNITY}/invite/accept`,\n method: HttpMethod.POST,\n body: { code },\n });\n }\n\n async getInviteInfo(code: string): Promise<ApiResponse> {\n return this.http.request<ApiResponse>({\n route: `${Routes.COMMUNITY}/invite/info`,\n method: HttpMethod.GET,\n params: { code },\n });\n }\n\n async createGroup(id: string, data: CommunityGroupCreate): Promise<ApiResponse> {\n return this.http.request<ApiResponse>({\n route: `${Routes.COMMUNITY}/${id}/group`,\n method: HttpMethod.POST,\n body: data,\n });\n }\n\n async ephemeral(id: string, expiration: number): Promise<ApiResponse> {\n return this.http.request<ApiResponse>({\n route: `${Routes.COMMUNITY}/${id}/ephemeral`,\n method: HttpMethod.POST,\n body: { expiration },\n });\n }\n\n async updateSettings(id: string, setting: string): Promise<ApiResponse> {\n return this.http.request<ApiResponse>({\n route: `${Routes.COMMUNITY}/${id}/settings`,\n method: HttpMethod.PATCH,\n body: { setting },\n });\n }\n\n async memberAddMode(id: string, mode: string): Promise<ApiResponse> {\n return this.http.request<ApiResponse>({\n route: `${Routes.COMMUNITY}/${id}/member-add-mode`,\n method: HttpMethod.PATCH,\n body: { mode },\n });\n }\n\n async joinApproval(id: string, mode: string): Promise<ApiResponse> {\n return this.http.request<ApiResponse>({\n route: `${Routes.COMMUNITY}/${id}/join-approval`,\n method: HttpMethod.PATCH,\n body: { mode },\n });\n }\n}\n"]}
@@ -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;AAxBD,wCAwBC","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 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"]}
1
+ {"version":3,"file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E;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,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,EAAE,IAAY,EAAE,WAAmB;QACxD,OAAO,IAAI,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,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"]}
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,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ACF;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"],"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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QACjC,OAAO,IAAI,CAAC,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;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"]}
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,I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O,IAAI,CAAC,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"]}
@@ -13,5 +13,6 @@ export declare class LabelService {
13
13
  data: ChatInfo[];
14
14
  }>;
15
15
  addToChat(labelId: string, to: string): Promise<ApiResponse>;
16
+ delete(labelId: string): Promise<ApiResponse>;
16
17
  removeFromChat(labelId: string, to: string): Promise<ApiResponse>;
17
18
  }
@@ -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,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"]}
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,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,oCAIk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BAAU,CAAC,IAAI;YACvB,IAAI,EAAE,EAAE,EAAE,EAAE,MAAM,EAAE;SACrB,CAAC,CAAC;IACL,CAAC;IAED,KAAK,CAAC,kBAAkB,CAAC,EAAU,EAAE,MAAc,EAAE,QAAgB,EAAE,QAAiB,EAAE,OAAgB;QACxG,OAAO,IAAI,CAAC,IAAI,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"]}
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,K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AE,kBAAU,CAAC,IAAI;YACvB,IAAI,EAAE,IAAI;SACX,CAAC,CAAC;IACL,CAAC;IAED,KAAK,CAAC,eAAe,CAAC,IAA4B;QAChD,OAAO,IAAI,CAAC,IAAI,CAAC,OAAO,CAAkB;YACxC,KAAK,EAAE,GAAG,cAAM,CAAC,QAAQ,eAAe;YACxC,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
+ }