@in.pulse-crm/sdk 2.8.2 → 2.8.4

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.
@@ -11,27 +11,27 @@ class WhatsappClient extends api_client_1.default {
11
11
  ? { Authorization: `Bearer ${token}` }
12
12
  : undefined;
13
13
  const url = `/api/whatsapp/session/chats?messages=${messages}&contact=${contact}`;
14
- const { data: res } = await this.httpClient.get(url, {
14
+ const { data: res } = await this.ax.get(url, {
15
15
  headers,
16
16
  });
17
17
  return res.data;
18
18
  }
19
19
  async getChatById(id) {
20
- const { data: res } = await this.httpClient.get(`/api/whatsapp/chats/${id}`);
20
+ const { data: res } = await this.ax.get(`/api/whatsapp/chats/${id}`);
21
21
  return res.data;
22
22
  }
23
23
  async getMessageById(id) {
24
- const { data: res } = await this.httpClient.get(`/api/whatsapp/messages/${id}`);
24
+ const { data: res } = await this.ax.get(`/api/whatsapp/messages/${id}`);
25
25
  return res.data;
26
26
  }
27
27
  async getUserWallets(instance, userId) {
28
- const { data: res } = await this.httpClient.get(`/api/wallets?instance=${instance}&userId=${userId}`);
28
+ const { data: res } = await this.ax.get(`/api/wallets?instance=${instance}&userId=${userId}`);
29
29
  return res.data;
30
30
  }
31
31
  async markContactMessagesAsRead(contactId) {
32
32
  const url = "/api/whatsapp/messages/mark-as-read";
33
33
  const body = { contactId };
34
- const { data: res } = await this.httpClient.patch(url, body);
34
+ const { data: res } = await this.ax.patch(url, body);
35
35
  return res.data;
36
36
  }
37
37
  async sendMessage(to, data) {
@@ -47,7 +47,7 @@ class WhatsappClient extends api_client_1.default {
47
47
  data.sendAsDocument && formData.append("sendAsDocument", "true");
48
48
  data.sendAsChatOwner &&
49
49
  formData.append("sendAsChatOwner", String(data.sendAsChatOwner));
50
- const { data: res } = await this.httpClient.post(url, formData, {
50
+ const { data: res } = await this.ax.post(url, formData, {
51
51
  headers: {
52
52
  "Content-Type": "multipart/form-data",
53
53
  },
@@ -57,32 +57,32 @@ class WhatsappClient extends api_client_1.default {
57
57
  async finishChatById(id, resultId) {
58
58
  const url = `/api/whatsapp/chats/${id}/finish`;
59
59
  const body = { resultId };
60
- await this.httpClient.post(url, body);
60
+ await this.ax.post(url, body);
61
61
  }
62
62
  async startChatByContactId(contactId) {
63
63
  const url = `/api/whatsapp/chats`;
64
64
  const body = { contactId };
65
- const { data: res } = await this.httpClient.post(url, body);
65
+ const { data: res } = await this.ax.post(url, body);
66
66
  return res.data;
67
67
  }
68
68
  async getResults() {
69
69
  const url = `/api/whatsapp/results`;
70
- const { data: res } = await this.httpClient.get(url);
70
+ const { data: res } = await this.ax.get(url);
71
71
  return res.data;
72
72
  }
73
73
  async getCustomerContacts(customerId) {
74
74
  const url = `/api/whatsapp/customer/${customerId}/contacts`;
75
- const { data: res } = await this.httpClient.get(url);
75
+ const { data: res } = await this.ax.get(url);
76
76
  return res.data;
77
77
  }
78
78
  async getContactsWithCustomer() {
79
79
  const url = `/api/whatsapp/contacts/customer`;
80
- const { data: res } = await this.httpClient.get(url);
80
+ const { data: res } = await this.ax.get(url);
81
81
  return res.data;
82
82
  }
83
83
  async getContacts() {
84
84
  const url = `/api/whatsapp/contacts`;
85
- const { data: res } = await this.httpClient.get(url);
85
+ const { data: res } = await this.ax.get(url);
86
86
  return res.data;
87
87
  }
88
88
  async createContact(name, phone, customerId) {
@@ -91,37 +91,36 @@ class WhatsappClient extends api_client_1.default {
91
91
  ? `${baseUrl}/customers/${customerId}/contacts`
92
92
  : `${baseUrl}/contacts`;
93
93
  const body = { name, phone };
94
- const { data: res } = await this.httpClient.post(url, body);
94
+ const { data: res } = await this.ax.post(url, body);
95
95
  return res.data;
96
96
  }
97
97
  async updateContact(contactId, name) {
98
98
  const url = `/api/whatsapp/contacts/${contactId}`;
99
99
  const body = { name };
100
- const { data: res } = await this.httpClient.put(url, body);
100
+ const { data: res } = await this.ax.put(url, body);
101
101
  return res.data;
102
102
  }
103
103
  async deleteContact(contactId) {
104
104
  const url = `/api/whatsapp/contacts/${contactId}`;
105
- await this.httpClient.delete(url);
105
+ await this.ax.delete(url);
106
106
  }
107
107
  async getSectors() {
108
108
  const url = `/api/whatsapp/sectors`;
109
- const { data: res } = await this.httpClient.get(url);
109
+ const { data: res } = await this.ax.get(url);
110
110
  return res.data;
111
111
  }
112
112
  setAuth(token) {
113
- this.httpClient.defaults.headers.common["Authorization"] =
114
- `Bearer ${token}`;
113
+ this.ax.defaults.headers.common["Authorization"] = `Bearer ${token}`;
115
114
  }
116
115
  async getChatsMonitor() {
117
116
  const url = `/api/whatsapp/session/monitor`;
118
- const { data: res } = await this.httpClient.get(url);
117
+ const { data: res } = await this.ax.get(url);
119
118
  return res.data;
120
119
  }
121
120
  async transferAttendance(id, userId) {
122
121
  const url = `/api/whatsapp/chats/${id}/transfer`;
123
122
  const body = { userId };
124
- await this.httpClient.post(url, body);
123
+ await this.ax.post(url, body);
125
124
  }
126
125
  /**
127
126
  * Obtém os detalhes de um agendamento.
@@ -157,7 +156,7 @@ class WhatsappClient extends api_client_1.default {
157
156
  baseUrl += `?sectorId=${sectorId}`;
158
157
  }
159
158
  }
160
- const response = await this.httpClient.get(baseUrl);
159
+ const response = await this.ax.get(baseUrl);
161
160
  return response.data;
162
161
  }
163
162
  /**
@@ -166,7 +165,7 @@ class WhatsappClient extends api_client_1.default {
166
165
  * @returns Uma Promise que resolve para um objeto wppSchedule.
167
166
  */
168
167
  async createSchedule(data) {
169
- const response = await this.httpClient.post(`/api/whatsapp/schedules`, data);
168
+ const response = await this.ax.post(`/api/whatsapp/schedules`, data);
170
169
  return response.data;
171
170
  }
172
171
  /**
@@ -176,7 +175,7 @@ class WhatsappClient extends api_client_1.default {
176
175
  * @returns Uma Promise que resolve para um objeto wppSchedule.
177
176
  */
178
177
  async updateSchedule(scheduleId, updatedData) {
179
- const response = await this.httpClient.patch(`/api/whatsapp/schedules/${scheduleId}`, updatedData);
178
+ const response = await this.ax.patch(`/api/whatsapp/schedules/${scheduleId}`, updatedData);
180
179
  return response.data;
181
180
  }
182
181
  /**
@@ -185,7 +184,7 @@ class WhatsappClient extends api_client_1.default {
185
184
  * @returns Uma Promise que resolve para um objeto wppSchedule.
186
185
  */
187
186
  async deleteSchedule(scheduleId) {
188
- const response = await this.httpClient.delete(`/api/whatsapp/schedules/${scheduleId}`);
187
+ const response = await this.ax.delete(`/api/whatsapp/schedules/${scheduleId}`);
189
188
  return response.data;
190
189
  }
191
190
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@in.pulse-crm/sdk",
3
- "version": "2.8.2",
3
+ "version": "2.8.4",
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",
package/src/api-client.ts CHANGED
@@ -2,13 +2,13 @@ import axios, { AxiosInstance, AxiosError } from 'axios';
2
2
  import { ErrorResponse } from './types/response.types';
3
3
 
4
4
  export default class ApiClient {
5
- protected readonly httpClient: AxiosInstance;
5
+ public readonly ax: AxiosInstance;
6
6
  private baseUrl: string;
7
7
 
8
8
  constructor(baseUrl: string) {
9
9
  this.baseUrl = baseUrl;
10
10
 
11
- this.httpClient = axios.create({
11
+ this.ax = axios.create({
12
12
  baseURL: `${this.baseUrl}`,
13
13
  timeout: 60000,
14
14
  headers: {
@@ -20,7 +20,7 @@ export default class ApiClient {
20
20
  }
21
21
 
22
22
  private initializeResponseInterceptor() {
23
- this.httpClient.interceptors.response.use(
23
+ this.ax.interceptors.response.use(
24
24
  null,
25
25
  this.handleError
26
26
  );
@@ -15,7 +15,7 @@ export default class AuthClient extends ApiClient {
15
15
  * @returns Dados de login.
16
16
  */
17
17
  public async login(instance: string, username: string, password: string) {
18
- const { data: res } = await this.httpClient.post<
18
+ const { data: res } = await this.ax.post<
19
19
  DataResponse<LoginData>
20
20
  >(`/api/auth/login`, { LOGIN: username, SENHA: password, instance });
21
21
 
@@ -28,7 +28,7 @@ export default class AuthClient extends ApiClient {
28
28
  * @returns Dados da sessão.
29
29
  */
30
30
  public async fetchSessionData(authToken: string) {
31
- const { data: res } = await this.httpClient
31
+ const { data: res } = await this.ax
32
32
  .get<DataResponse<SessionData>>(`/api/auth/session`, {
33
33
  headers: {
34
34
  authorization: authToken,
@@ -86,7 +86,7 @@ export default class AuthClient extends ApiClient {
86
86
  }
87
87
 
88
88
  public async getOnlineSessions(instance: string) {
89
- const { data: res } = await this.httpClient.get<
89
+ const { data: res } = await this.ax.get<
90
90
  DataResponse<UserOnlineSession[]>
91
91
  >("/api/online-sessions", {
92
92
  params: {
@@ -98,7 +98,7 @@ export default class AuthClient extends ApiClient {
98
98
  }
99
99
 
100
100
  public async initOnlineSession(authToken: string) {
101
- await this.httpClient.post(
101
+ await this.ax.post(
102
102
  "/api/online-sessions",
103
103
  {},
104
104
  {
@@ -110,7 +110,7 @@ export default class AuthClient extends ApiClient {
110
110
  }
111
111
 
112
112
  public async finishOnlineSession(authToken: string) {
113
- await this.httpClient.delete("/api/online-sessions", {
113
+ await this.ax.delete("/api/online-sessions", {
114
114
  headers: {
115
115
  Authorization: authToken,
116
116
  },
@@ -13,7 +13,7 @@ class CustomersClient extends ApiClient {
13
13
  * @returns Uma Promise que resolve para o cliente criado.
14
14
  */
15
15
  public async createCustomer(data: CreateCustomerDTO) {
16
- const response = await this.httpClient.post(`/api/customers`, data);
16
+ const response = await this.ax.post(`/api/customers`, data);
17
17
 
18
18
  return response.data;
19
19
  }
@@ -24,7 +24,7 @@ class CustomersClient extends ApiClient {
24
24
  * @returns Uma Promise que resolve para o cliente obtido.
25
25
  */
26
26
  public async getCustomerById(customerId: number) {
27
- const response = await this.httpClient.get(
27
+ const response = await this.ax.get(
28
28
  `/api/customers/${customerId}`,
29
29
  );
30
30
  return response.data;
@@ -37,7 +37,7 @@ class CustomersClient extends ApiClient {
37
37
  * @returns Uma Promise que resolve para o cliente atualizado.
38
38
  */
39
39
  public async updateCustomer(customerId: number, data: UpdateCustomerDTO) {
40
- const response = await this.httpClient.patch(
40
+ const response = await this.ax.patch(
41
41
  `/api/customers/${customerId}`,
42
42
  data,
43
43
  );
@@ -60,7 +60,7 @@ class CustomersClient extends ApiClient {
60
60
  }
61
61
 
62
62
  const response =
63
- await this.httpClient.get<PaginatedResponse<Customer>>(baseUrl);
63
+ await this.ax.get<PaginatedResponse<Customer>>(baseUrl);
64
64
 
65
65
  return response.data;
66
66
  }
@@ -70,7 +70,7 @@ class CustomersClient extends ApiClient {
70
70
  * @param token - O token de autenticação a ser definido.
71
71
  */
72
72
  public setAuth(token: string) {
73
- this.httpClient.defaults.headers.common["Authorization"] =
73
+ this.ax.defaults.headers.common["Authorization"] =
74
74
  `Bearer ${token}`;
75
75
  }
76
76
  }
@@ -9,7 +9,7 @@ class FilesClient extends ApiClient {
9
9
  * @returns {Promise<Buffer>} Um buffer contendo os dados do arquivo.
10
10
  */
11
11
  public async fetchFile(id: number): Promise<Buffer> {
12
- const response = await this.httpClient.get(`/api/files/${id}`, {
12
+ const response = await this.ax.get(`/api/files/${id}`, {
13
13
  responseType: "arraybuffer",
14
14
  });
15
15
  const buffer = Buffer.from(response.data, "binary");
@@ -25,7 +25,7 @@ class FilesClient extends ApiClient {
25
25
  * @throws Will throw an error if the HTTP request fails.
26
26
  */
27
27
  public async fetchFileMetadata(id: number): Promise<File> {
28
- const { data: res } = await this.httpClient.get<DataResponse<File>>(
28
+ const { data: res } = await this.ax.get<DataResponse<File>>(
29
29
  `/api/files/${id}/metadata`,
30
30
  );
31
31
 
@@ -38,7 +38,7 @@ class FilesClient extends ApiClient {
38
38
  * @returns {string} URL de download do arquivo.
39
39
  */
40
40
  public getFileDownloadUrl(id: number): string {
41
- return this.httpClient.defaults.baseURL + `/api/files/${id}`;
41
+ return this.ax.defaults.baseURL + `/api/files/${id}`;
42
42
  }
43
43
 
44
44
  /**
@@ -56,7 +56,7 @@ class FilesClient extends ApiClient {
56
56
  props.fileName,
57
57
  );
58
58
 
59
- const response = await this.httpClient.post<DataResponse<File>>(
59
+ const response = await this.ax.post<DataResponse<File>>(
60
60
  "/api/files",
61
61
  form,
62
62
  {
@@ -73,7 +73,7 @@ class FilesClient extends ApiClient {
73
73
  * @returns {Promise<void>}
74
74
  */
75
75
  public async deleteFile(id: number): Promise<void> {
76
- await this.httpClient.delete(`/api/files/${id}`);
76
+ await this.ax.delete(`/api/files/${id}`);
77
77
  }
78
78
  }
79
79
 
@@ -19,7 +19,7 @@ class InstancesClient extends ApiClient {
19
19
  query: string,
20
20
  parameters: any[],
21
21
  ): Promise<T> {
22
- const response = await this.httpClient
22
+ const response = await this.ax
23
23
  .post<
24
24
  QueryResponse<T>
25
25
  >(`/api/instances/${instance}/query`, { query, parameters })
@@ -32,7 +32,7 @@ export default class InternalChatClient extends ApiClient {
32
32
  JSON.stringify({ participants, isGroup, groupName, groupId }),
33
33
  );
34
34
 
35
- const { data: res } = await this.httpClient.post<
35
+ const { data: res } = await this.ax.post<
36
36
  DataResponse<InternalChat>
37
37
  >(`/api/internal/chats`, form, {
38
38
  headers: {
@@ -45,7 +45,7 @@ export default class InternalChatClient extends ApiClient {
45
45
 
46
46
  public async deleteInternalChat(chatId: number) {
47
47
  const url = `/api/internal/chats/${chatId}`;
48
- await this.httpClient.delete<DataResponse<InternalChat>>(url);
48
+ await this.ax.delete<DataResponse<InternalChat>>(url);
49
49
  }
50
50
 
51
51
  public async getInternalChatsBySession(token: string | null = null) {
@@ -55,7 +55,7 @@ export default class InternalChatClient extends ApiClient {
55
55
  ? { Authorization: `Bearer ${token}` }
56
56
  : undefined;
57
57
 
58
- const { data: res } = await this.httpClient.get<GetChatsResponse>(url, {
58
+ const { data: res } = await this.ax.get<GetChatsResponse>(url, {
59
59
  headers,
60
60
  });
61
61
 
@@ -65,7 +65,7 @@ export default class InternalChatClient extends ApiClient {
65
65
  public async getInternalGroups() {
66
66
  const url = `/api/internal/groups`;
67
67
  const { data: res } =
68
- await this.httpClient.get<DataResponse<InternalGroup[]>>(url);
68
+ await this.ax.get<DataResponse<InternalGroup[]>>(url);
69
69
 
70
70
  return res.data;
71
71
  }
@@ -81,10 +81,8 @@ export default class InternalChatClient extends ApiClient {
81
81
  data.sendAsDocument && formData.append("sendAsDocument", "true");
82
82
  data.file && formData.append("file", data.file);
83
83
  data.fileId && formData.append("fileId", data.fileId.toString());
84
- if (data.mentions && data.mentions.length > 0) {
85
- formData.append("mentions", JSON.stringify(data.mentions));
86
- }
87
- await this.httpClient.post<DataResponse<InternalMessage>>(
84
+
85
+ await this.ax.post<DataResponse<InternalMessage>>(
88
86
  url,
89
87
  formData,
90
88
  {
@@ -103,7 +101,7 @@ export default class InternalChatClient extends ApiClient {
103
101
  wppGroupId: string | null;
104
102
  },
105
103
  ) {
106
- const { data: res } = await this.httpClient.put<
104
+ const { data: res } = await this.ax.put<
107
105
  DataResponse<InternalGroup>
108
106
  >(`/api/internal/groups/${groupId}`, data);
109
107
  return res.data;
@@ -113,7 +111,7 @@ export default class InternalChatClient extends ApiClient {
113
111
  const formData = new FormData();
114
112
  formData.append("file", file);
115
113
 
116
- const { data: res } = await this.httpClient.put<
114
+ const { data: res } = await this.ax.put<
117
115
  DataResponse<InternalGroup>
118
116
  >(`/api/internal/groups/${groupId}/image`, formData, {
119
117
  headers: {
@@ -125,18 +123,18 @@ export default class InternalChatClient extends ApiClient {
125
123
 
126
124
  public async markChatMessagesAsRead(chatId: number) {
127
125
  const url = `/api/internal/chat/${chatId}/mark-as-read`;
128
- await this.httpClient.patch(url);
126
+ await this.ax.patch(url);
129
127
  }
130
128
 
131
129
  public async getInternalChatsMonitor() {
132
130
  const url = `/api/internal/monitor/chats`;
133
- const { data: res } = await this.httpClient.get<GetChatsResponse>(url);
131
+ const { data: res } = await this.ax.get<GetChatsResponse>(url);
134
132
 
135
133
  return res.data;
136
134
  }
137
135
 
138
136
  public setAuth(token: string) {
139
- this.httpClient.defaults.headers.common["Authorization"] =
137
+ this.ax.defaults.headers.common["Authorization"] =
140
138
  `Bearer ${token}`;
141
139
  }
142
140
  }
@@ -23,7 +23,7 @@ export default class ReadyMessageClient extends ApiClient {
23
23
  JSON.stringify({ TITULO, TEXTO_MENSAGEM,SETOR }),
24
24
  );
25
25
 
26
- const { data: res } = await this.httpClient.post<
26
+ const { data: res } = await this.ax.post<
27
27
  DataResponse<ReadyMessage>
28
28
  >(`/api/ready-messages`, form, {
29
29
  headers: {
@@ -36,13 +36,13 @@ export default class ReadyMessageClient extends ApiClient {
36
36
 
37
37
  public async deleteReadyMessage(chatId: number) {
38
38
  const url = `/api/ready-messages/${chatId}`;
39
- await this.httpClient.delete<DataResponse<ReadyMessage>>(url);
39
+ await this.ax.delete<DataResponse<ReadyMessage>>(url);
40
40
  }
41
41
 
42
42
  public async getReadyMessages() {
43
43
  const url = `/api/ready-messages`;
44
44
  const { data: res } =
45
- await this.httpClient.get<DataResponse<ReadyMessage[]>>(url);
45
+ await this.ax.get<DataResponse<ReadyMessage[]>>(url);
46
46
 
47
47
  return res.data;
48
48
  }
@@ -55,7 +55,7 @@ export default class ReadyMessageClient extends ApiClient {
55
55
  JSON.stringify(ReadyMessage),
56
56
  );
57
57
 
58
- const { data: res } = await this.httpClient.put<
58
+ const { data: res } = await this.ax.put<
59
59
  DataResponse<ReadyMessage>
60
60
  >(`/api/ready-messages/${id}`, formData, {
61
61
  headers: {
@@ -66,7 +66,7 @@ export default class ReadyMessageClient extends ApiClient {
66
66
  }
67
67
 
68
68
  public setAuth(token: string) {
69
- this.httpClient.defaults.headers.common["Authorization"] =
69
+ this.ax.defaults.headers.common["Authorization"] =
70
70
  `Bearer ${token}`;
71
71
  }
72
72
  }
@@ -17,7 +17,7 @@ export default class ReportsClient extends ApiClient {
17
17
  public async getChatsReports() {
18
18
  const url = `/api/reports/chats`;
19
19
  const { data: res } =
20
- await this.httpClient.get<DataResponse<Array<ChatsReport>>>(url);
20
+ await this.ax.get<DataResponse<Array<ChatsReport>>>(url);
21
21
 
22
22
  return res.data;
23
23
  }
@@ -30,7 +30,7 @@ export default class ReportsClient extends ApiClient {
30
30
  */
31
31
  public async generateChatsReport(body: GenerateChatsReportOptions) {
32
32
  const url = `/api/reports/chats`;
33
- const { data: res } = await this.httpClient.post<
33
+ const { data: res } = await this.ax.post<
34
34
  DataResponse<ChatsReport>
35
35
  >(url, body);
36
36
 
@@ -44,7 +44,7 @@ export default class ReportsClient extends ApiClient {
44
44
  */
45
45
  public async deleteChatsReport(chatsReportId: number) {
46
46
  const url = `/api/reports/chats/${chatsReportId}`;
47
- await this.httpClient.delete<MessageResponse>(url);
47
+ await this.ax.delete<MessageResponse>(url);
48
48
  }
49
49
  /**
50
50
  * Desative a report sql by its unique identifier.
@@ -54,7 +54,7 @@ export default class ReportsClient extends ApiClient {
54
54
 
55
55
  public async deleteHistoryReport(reportId: number) {
56
56
  const url = `/api/reports-history/${reportId}`;
57
- await this.httpClient.delete<MessageResponse>(url);
57
+ await this.ax.delete<MessageResponse>(url);
58
58
  }
59
59
  /**
60
60
  * Execute a report sql interactions based on the provided options.
@@ -65,7 +65,7 @@ export default class ReportsClient extends ApiClient {
65
65
 
66
66
  public async executeSqlReport(body: ExecuteSqlReportOptions) {
67
67
  const url = `/api/execute-report-sql`;
68
- const { data: res } = await this.httpClient.post<DataResponse<SQLReportRow[]>>(url, body);
68
+ const { data: res } = await this.ax.post<DataResponse<SQLReportRow[]>>(url, body);
69
69
  return res.data;
70
70
  }
71
71
 
@@ -77,7 +77,7 @@ export default class ReportsClient extends ApiClient {
77
77
  public async getSqlReportsHistory() {
78
78
  const url = `/api/reports-history`;
79
79
  const { data: res } =
80
- await this.httpClient.get<DataResponse<Array<any>>>(url);
80
+ await this.ax.get<DataResponse<Array<any>>>(url);
81
81
 
82
82
  return res.data;
83
83
  }
@@ -90,7 +90,7 @@ export default class ReportsClient extends ApiClient {
90
90
 
91
91
  public async exportReportSql(body: ExportSqlReportOptions) {
92
92
  const url = `/api/export-report-sql`;
93
- const response = await this.httpClient.post(url, body, {
93
+ const response = await this.ax.post(url, body, {
94
94
  responseType: 'blob',
95
95
  });
96
96
  return response.data as Blob;
@@ -105,7 +105,7 @@ export default class ReportsClient extends ApiClient {
105
105
  * of all HTTP requests made by the client.
106
106
  */
107
107
  public setAuth(token: string) {
108
- this.httpClient.defaults.headers.common["Authorization"] =
108
+ this.ax.defaults.headers.common["Authorization"] =
109
109
  `Bearer ${token}`;
110
110
  }
111
111
  }
@@ -26,7 +26,7 @@ export default class SocketServerApi extends ApiClient {
26
26
  * @returns A promise that resolves with the response from the API call.
27
27
  */
28
28
  public emit: EmitSocketEventFn = (event, room, value) => {
29
- return this.httpClient
29
+ return this.ax
30
30
  .post<MessageResponse>(`/api/ws/emit/${room}/${event}`, value)
31
31
  .then((res) => res.data);
32
32
  }
@@ -69,5 +69,4 @@ export interface InternalSendMessageData {
69
69
  text: string;
70
70
  file?: File;
71
71
  fileId?: number;
72
- mentions?: number[]
73
72
  }
@@ -64,6 +64,10 @@ export interface WppChat {
64
64
  priority: WppChatPriority;
65
65
  avatarUrl?: string;
66
66
  isFinished: boolean;
67
+ startedAt: Date;
68
+ finishedAt?: Date | null;
69
+ finishedBy?: number | null;
70
+ isSchedule: boolean;
67
71
  }
68
72
 
69
73
  export interface WppSector {
@@ -158,4 +162,4 @@ export interface Schedule {
158
162
  scheduledBy: number;
159
163
  scheduledFor: number;
160
164
  contact: WppContact;
161
- }
165
+ }
@@ -21,7 +21,7 @@ export default class UsersClient extends ApiClient {
21
21
  }
22
22
 
23
23
  const response =
24
- await this.httpClient.get<PaginatedResponse<User>>(baseUrl);
24
+ await this.ax.get<PaginatedResponse<User>>(baseUrl);
25
25
 
26
26
  return response.data;
27
27
  }
@@ -32,7 +32,7 @@ export default class UsersClient extends ApiClient {
32
32
  * @returns Uma resposta contendo os dados do usuário.
33
33
  */
34
34
  public async getUserById(userId: number) {
35
- const { data: res } = await this.httpClient.get<DataResponse<User>>(
35
+ const { data: res } = await this.ax.get<DataResponse<User>>(
36
36
  `/api/users/${userId}`,
37
37
  );
38
38
 
@@ -47,7 +47,7 @@ export default class UsersClient extends ApiClient {
47
47
  */
48
48
  public async createUser(data: CreateUserDTO) {
49
49
  try {
50
- const { data: res } = await this.httpClient.post<
50
+ const { data: res } = await this.ax.post<
51
51
  DataResponse<User>
52
52
  >(`/api/users`, data);
53
53
 
@@ -66,7 +66,7 @@ export default class UsersClient extends ApiClient {
66
66
  */
67
67
  public async updateUser(userId: string, data: UpdateUserDTO) {
68
68
  try {
69
- const { data: res } = await this.httpClient.patch<
69
+ const { data: res } = await this.ax.patch<
70
70
  DataResponse<User>
71
71
  >(`/api/users/${userId}`, data);
72
72
 
@@ -82,7 +82,7 @@ export default class UsersClient extends ApiClient {
82
82
  * @param token - The authentication token to be used in the `Authorization` header.
83
83
  */
84
84
  public setAuth(token: string) {
85
- this.httpClient.defaults.headers.common["Authorization"] =
85
+ this.ax.defaults.headers.common["Authorization"] =
86
86
  `Bearer ${token}`;
87
87
  }
88
88
  }