@in.pulse-crm/sdk 2.9.3 → 2.9.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.
package/.prettierrc CHANGED
@@ -1,4 +1,4 @@
1
- {
2
- "tabWidth": 4,
3
- "useTabs": true
4
- }
1
+ {
2
+ "tabWidth": 4,
3
+ "useTabs": true
4
+ }
@@ -1,5 +1,3 @@
1
- /// <reference types="node" />
2
- /// <reference types="node" />
3
1
  import ApiClient from "./api-client";
4
2
  import { File, UploadFileOptions } from "./types/files.types";
5
3
  declare class FilesClient extends ApiClient {
@@ -1,5 +1,3 @@
1
- /// <reference types="node" />
2
- /// <reference types="node" />
3
1
  export interface UploadFileOptions {
4
2
  /**
5
3
  * Nome da instância onde o arquivo está armazenado.
@@ -38,6 +38,16 @@ export interface WppMessage {
38
38
  fileType?: string | null;
39
39
  fileSize?: string | null;
40
40
  }
41
+ export interface ForwardMessagesData {
42
+ messageIds: number[];
43
+ whatsappTargets?: Array<{
44
+ id: string;
45
+ isGroup: boolean;
46
+ }>;
47
+ internalTargets?: Array<{
48
+ id: number;
49
+ }>;
50
+ }
41
51
  export interface WppChat {
42
52
  id: number;
43
53
  instance: string;
@@ -1,6 +1,6 @@
1
1
  import ApiClient from "./api-client";
2
2
  import { RequestFilters } from "./types";
3
- import { CreateScheduleDTO, SendMessageData, WppChatsAndMessages, WppChatWithDetailsAndMessages, WppContact, WppContactWithCustomer, WppMessage, WppSchedule, WppWallet } from "./types/whatsapp.types";
3
+ import { CreateScheduleDTO, ForwardMessagesData, 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>;
@@ -18,6 +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
+ forwardMessages(data: ForwardMessagesData): Promise<void>;
21
22
  updateContact(contactId: number, name: string, customerId?: number | null): Promise<WppContact>;
22
23
  deleteContact(contactId: number): Promise<void>;
23
24
  getSectors(): Promise<{
@@ -94,6 +94,11 @@ 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 forwardMessages(data) {
98
+ const url = "/api/whatsapp/messages/forward";
99
+ const body = data;
100
+ await this.ax.post(url, body);
101
+ }
97
102
  async updateContact(contactId, name, customerId) {
98
103
  const url = `/api/whatsapp/contacts/${contactId}`;
99
104
  const body = { name };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@in.pulse-crm/sdk",
3
- "version": "2.9.3",
3
+ "version": "2.9.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",
@@ -41,6 +41,11 @@ export interface WppMessage {
41
41
  fileType?: string | null;
42
42
  fileSize?: string | null;
43
43
  }
44
+ export interface ForwardMessagesData {
45
+ messageIds: number[];
46
+ whatsappTargets?: Array<{ id: string; isGroup: boolean }>;
47
+ internalTargets?: Array<{ id: number }>;
48
+ }
44
49
 
45
50
  export interface WppChat {
46
51
  id: number;
@@ -3,6 +3,7 @@ import { RequestFilters } from "./types";
3
3
  import { DataResponse, MessageResponse } from "./types/response.types";
4
4
  import {
5
5
  CreateScheduleDTO,
6
+ ForwardMessagesData,
6
7
  SendMessageData,
7
8
  WppChatsAndMessages,
8
9
  WppChatWithDetailsAndMessages,
@@ -169,7 +170,13 @@ export default class WhatsappClient extends ApiClient {
169
170
 
170
171
  return res.data;
171
172
  }
173
+ public async forwardMessages(data: ForwardMessagesData) {
174
+ const url = "/api/whatsapp/messages/forward";
175
+
176
+ const body = data;
172
177
 
178
+ await this.ax.post<MessageResponse>(url, body);
179
+ }
173
180
  public async updateContact(contactId: number, name: string, customerId?: number | null) {
174
181
  const url = `/api/whatsapp/contacts/${contactId}`;
175
182
  const body: Record<string, any> = { name };
package/tsconfig.json CHANGED
@@ -1,17 +1,17 @@
1
- {
2
- "compilerOptions": {
3
- "target": "es2022" /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */,
4
- "module": "commonjs" /* Specify what module code is generated. */,
5
- "esModuleInterop": true /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */,
6
- "forceConsistentCasingInFileNames": true /* Ensure that casing is correct in imports. */,
7
- "strict": true /* Enable all strict type-checking options. */,
8
- "skipLibCheck": true /* Skip type checking all .d.ts files. */,
9
- "noUnusedLocals": false,
10
- "outDir": "./dist", /* Redirect output structure to the directory. */
11
- "declaration": true
12
- },
13
- "include": [
14
- "src/index.ts",
15
- "src/**/*.{ts}"
16
- ]
1
+ {
2
+ "compilerOptions": {
3
+ "target": "es2022" /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */,
4
+ "module": "commonjs" /* Specify what module code is generated. */,
5
+ "esModuleInterop": true /* Emit additional JavaScript to ease support for importing CommonJS modules. This enables 'allowSyntheticDefaultImports' for type compatibility. */,
6
+ "forceConsistentCasingInFileNames": true /* Ensure that casing is correct in imports. */,
7
+ "strict": true /* Enable all strict type-checking options. */,
8
+ "skipLibCheck": true /* Skip type checking all .d.ts files. */,
9
+ "noUnusedLocals": false,
10
+ "outDir": "./dist", /* Redirect output structure to the directory. */
11
+ "declaration": true
12
+ },
13
+ "include": [
14
+ "src/index.ts",
15
+ "src/**/*.{ts}"
16
+ ]
17
17
  }