@in.pulse-crm/sdk 2.9.0 → 2.9.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -9,7 +9,7 @@ export default class WhatsappClient extends ApiClient {
9
9
  markContactMessagesAsRead(contactId: number): Promise<WppMessage[]>;
10
10
  sendMessage(to: string, data: SendMessageData): Promise<WppMessage>;
11
11
  finishChatById(id: number, resultId: number): Promise<void>;
12
- startChatByContactId(contactId: number): Promise<WppChatWithDetailsAndMessages>;
12
+ startChatByContactId(contactId: number, template?: any): Promise<WppChatWithDetailsAndMessages>;
13
13
  getResults(): Promise<{
14
14
  id: number;
15
15
  name: string;
@@ -18,7 +18,7 @@ export default class WhatsappClient extends ApiClient {
18
18
  getContactsWithCustomer(): Promise<WppContactWithCustomer[]>;
19
19
  getContacts(): Promise<WppContact[]>;
20
20
  createContact(name: string, phone: string, customerId?: number): Promise<WppContact>;
21
- updateContact(contactId: number, name: string): Promise<WppContact>;
21
+ updateContact(contactId: number, name: string, customerId: number | null): Promise<WppContact>;
22
22
  deleteContact(contactId: number): Promise<void>;
23
23
  getSectors(): Promise<{
24
24
  id: number;
@@ -59,9 +59,9 @@ class WhatsappClient extends api_client_1.default {
59
59
  const body = { resultId };
60
60
  await this.ax.post(url, body);
61
61
  }
62
- async startChatByContactId(contactId) {
62
+ async startChatByContactId(contactId, template) {
63
63
  const url = `/api/whatsapp/chats`;
64
- const body = { contactId };
64
+ const body = { contactId, template };
65
65
  const { data: res } = await this.ax.post(url, body);
66
66
  return res.data;
67
67
  }
@@ -94,9 +94,9 @@ class WhatsappClient extends api_client_1.default {
94
94
  const { data: res } = await this.ax.post(url, body);
95
95
  return res.data;
96
96
  }
97
- async updateContact(contactId, name) {
97
+ async updateContact(contactId, name, customerId) {
98
98
  const url = `/api/whatsapp/contacts/${contactId}`;
99
- const body = { name };
99
+ const body = { name, customerId };
100
100
  const { data: res } = await this.ax.put(url, body);
101
101
  return res.data;
102
102
  }
@@ -132,7 +132,6 @@ class WhatsappClient extends api_client_1.default {
132
132
  const { data: res } = await this.ax.patch(url);
133
133
  return res.data;
134
134
  }
135
- ;
136
135
  /**
137
136
  * Obtém os detalhes de um agendamento.
138
137
  * @param filters - keys de WppSchedule.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@in.pulse-crm/sdk",
3
- "version": "2.9.0",
3
+ "version": "2.9.2",
4
4
  "description": "SDKs for abstraction of api consumption of in.pulse-crm application",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -107,9 +107,9 @@ export default class WhatsappClient extends ApiClient {
107
107
  await this.ax.post<MessageResponse>(url, body);
108
108
  }
109
109
 
110
- public async startChatByContactId(contactId: number) {
110
+ public async startChatByContactId(contactId: number, template?: any) {
111
111
  const url = `/api/whatsapp/chats`;
112
- const body = { contactId };
112
+ const body = { contactId, template };
113
113
 
114
114
  const { data: res } = await this.ax.post<
115
115
  DataResponse<WppChatWithDetailsAndMessages>
@@ -170,9 +170,9 @@ export default class WhatsappClient extends ApiClient {
170
170
  return res.data;
171
171
  }
172
172
 
173
- public async updateContact(contactId: number, name: string) {
173
+ public async updateContact(contactId: number, name: string, customerId: number | null) {
174
174
  const url = `/api/whatsapp/contacts/${contactId}`;
175
- const body = { name };
175
+ const body = { name, customerId };
176
176
 
177
177
  const { data: res } = await this.ax.put<DataResponse<WppContact>>(
178
178
  url,
@@ -216,19 +216,17 @@ export default class WhatsappClient extends ApiClient {
216
216
  }
217
217
  public async getNotifications() {
218
218
  const url = `/api/whatsapp/notifications`;
219
- const { data: res } =
220
- await this.ax.get<DataResponse<any>>(url);
219
+ const { data: res } = await this.ax.get<DataResponse<any>>(url);
221
220
 
222
221
  return res.data;
223
222
  }
224
223
 
225
- public async markAllAsReadNotification () {
226
- const url = `/api/whatsapp/notifications/mark-all-read`;
227
- const { data: res } =
228
- await this.ax.patch<DataResponse<any>>(url);
224
+ public async markAllAsReadNotification() {
225
+ const url = `/api/whatsapp/notifications/mark-all-read`;
226
+ const { data: res } = await this.ax.patch<DataResponse<any>>(url);
229
227
 
230
228
  return res.data;
231
- };
229
+ }
232
230
 
233
231
  /**
234
232
  * Obtém os detalhes de um agendamento.