@in.pulse-crm/sdk 2.6.5 → 2.6.7

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.
@@ -1,7 +1,7 @@
1
1
  import ApiClient from "./api-client";
2
2
  import { InternalChat, InternalChatMember, InternalGroup, InternalMessage, InternalSendMessageData } from "./types/internal.types";
3
3
  export default class InternalChatClient extends ApiClient {
4
- createInternalChat(participants: number[], isGroup?: boolean, groupName?: string): Promise<InternalChat>;
4
+ createInternalChat(participants: number[], isGroup?: boolean, groupName?: string | null, groupId?: string | null): Promise<InternalChat>;
5
5
  getInternalChatsBySession(token?: string | null): Promise<{
6
6
  chats: (InternalChat & {
7
7
  participants: InternalChatMember[];
@@ -6,8 +6,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const api_client_1 = __importDefault(require("./api-client"));
7
7
  const form_data_1 = __importDefault(require("form-data"));
8
8
  class InternalChatClient extends api_client_1.default {
9
- async createInternalChat(participants, isGroup = false, groupName = "") {
10
- const body = { participants, isGroup, groupName };
9
+ async createInternalChat(participants, isGroup = false, groupName = null, groupId = null) {
10
+ const body = { participants, isGroup, groupName, groupId };
11
11
  const { data: res } = await this.httpClient.post(`/api/internal/chats`, body);
12
12
  return res.data;
13
13
  }
@@ -1,6 +1,6 @@
1
1
  import ApiClient from "./api-client";
2
2
  import { RequestFilters } from "./types";
3
- import { CreateScheduleDTO, MonitorChat, SendMessageData, WppChatsAndMessages, WppChatWithDetailsAndMessages, WppContact, WppContactWithCustomer, WppMessage, WppSchedule, WppWallet } from "./types/whatsapp.types";
3
+ import { CreateScheduleDTO, SendMessageData, WppChatsAndMessages, WppChatWithDetailsAndMessages, WppContact, WppContactWithCustomer, WppMessage, WppSchedule, WppWallet } from "./types/whatsapp.types";
4
4
  export default class WhatsappClient extends ApiClient {
5
5
  getChatsBySession(messages?: boolean, contact?: boolean, token?: string | null): Promise<WppChatsAndMessages>;
6
6
  getChatById(id: number): Promise<WppChatWithDetailsAndMessages>;
@@ -24,7 +24,7 @@ export default class WhatsappClient extends ApiClient {
24
24
  name: string;
25
25
  }[]>;
26
26
  setAuth(token: string): void;
27
- getChatsMonitor(): Promise<MonitorChat[]>;
27
+ getChatsMonitor(): Promise<WppChatsAndMessages>;
28
28
  transferAttendance(id: number, userId: number): Promise<void>;
29
29
  /**
30
30
  * Obtém os detalhes de um agendamento.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@in.pulse-crm/sdk",
3
- "version": "2.6.5",
3
+ "version": "2.6.7",
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",
@@ -13,15 +13,14 @@ type GetChatsResponse = DataResponse<{
13
13
  chats: (InternalChat & { participants: InternalChatMember[] })[];
14
14
  messages: InternalMessage[];
15
15
  }>;
16
- type GetMonitorInternalChatsResponse = DataResponse<[]>;
17
-
18
16
  export default class InternalChatClient extends ApiClient {
19
17
  public async createInternalChat(
20
18
  participants: number[],
21
19
  isGroup: boolean = false,
22
- groupName: string = "",
20
+ groupName: string | null = null,
21
+ groupId: string | null = null,
23
22
  ) {
24
- const body = { participants, isGroup, groupName };
23
+ const body = { participants, isGroup, groupName, groupId };
25
24
 
26
25
  const { data: res } = await this.httpClient.post<
27
26
  DataResponse<InternalChat>
@@ -94,13 +93,10 @@ export default class InternalChatClient extends ApiClient {
94
93
  }
95
94
  public async getInternalChatsMonitor() {
96
95
  const url = `/api/internal/monitor/chats`;
97
-
98
- const { data: res } =
99
- await this.httpClient.get<GetChatsResponse>(url);
96
+ const { data: res } = await this.httpClient.get<GetChatsResponse>(url);
100
97
 
101
98
  return res.data;
102
99
  }
103
-
104
100
  public setAuth(token: string) {
105
101
  this.httpClient.defaults.headers.common["Authorization"] =
106
102
  `Bearer ${token}`;
@@ -3,7 +3,6 @@ import { RequestFilters } from "./types";
3
3
  import { DataResponse, MessageResponse } from "./types/response.types";
4
4
  import {
5
5
  CreateScheduleDTO,
6
- MonitorChat,
7
6
  SendMessageData,
8
7
  WppChatsAndMessages,
9
8
  WppChatWithDetailsAndMessages,
@@ -19,7 +18,6 @@ type GetChatsResponse = DataResponse<WppChatsAndMessages>;
19
18
  type GetChatResponse = DataResponse<WppChatWithDetailsAndMessages>;
20
19
  type GetMessageResponse = DataResponse<WppMessage>;
21
20
  type MarkChatAsReadResponse = DataResponse<WppMessage[]>;
22
- type GetMonitorChatsResponse = DataResponse<MonitorChat[]>;
23
21
 
24
22
  export default class WhatsappClient extends ApiClient {
25
23
  public async getChatsBySession(
@@ -194,7 +192,7 @@ export default class WhatsappClient extends ApiClient {
194
192
  const url = `/api/whatsapp/session/monitor`;
195
193
 
196
194
  const { data: res } =
197
- await this.httpClient.get<GetMonitorChatsResponse>(url);
195
+ await this.httpClient.get<GetChatsResponse>(url);
198
196
 
199
197
  return res.data;
200
198
  }