@in.pulse-crm/sdk 2.5.1 → 2.5.3

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.
@@ -23,4 +23,6 @@ export default class WhatsappClient extends ApiClient {
23
23
  name: string;
24
24
  }[]>;
25
25
  setAuth(token: string): void;
26
+ getChatsMonitor(messages?: boolean, contact?: boolean, token?: string | null): Promise<WppChatsAndMessages>;
27
+ transferAttendance(id: number, userId: number): Promise<void>;
26
28
  }
@@ -105,5 +105,20 @@ class WhatsappClient extends api_client_1.default {
105
105
  this.httpClient.defaults.headers.common["Authorization"] =
106
106
  `Bearer ${token}`;
107
107
  }
108
+ async getChatsMonitor(messages = false, contact = false, token = null) {
109
+ const headers = token
110
+ ? { Authorization: `Bearer ${token}` }
111
+ : undefined;
112
+ const url = `/api/whatsapp/session/monitor?messages=${messages}&contact=${contact}`;
113
+ const { data: res } = await this.httpClient.get(url, {
114
+ headers,
115
+ });
116
+ return res.data;
117
+ }
118
+ async transferAttendance(id, userId) {
119
+ const url = `/api/whatsapp/chats/${id}/transfer`;
120
+ const body = { userId };
121
+ await this.httpClient.post(url, body);
122
+ }
108
123
  }
109
124
  exports.default = WhatsappClient;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@in.pulse-crm/sdk",
3
- "version": "2.5.1",
3
+ "version": "2.5.3",
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",
@@ -185,4 +185,26 @@ export default class WhatsappClient extends ApiClient {
185
185
  this.httpClient.defaults.headers.common["Authorization"] =
186
186
  `Bearer ${token}`;
187
187
  }
188
+ public async getChatsMonitor(
189
+ messages = false,
190
+ contact = false,
191
+ token: string | null = null,
192
+ ) {
193
+ const headers = token
194
+ ? { Authorization: `Bearer ${token}` }
195
+ : undefined;
196
+ const url = `/api/whatsapp/session/monitor?messages=${messages}&contact=${contact}`;
197
+
198
+ const { data: res } = await this.httpClient.get<GetChatsResponse>(url, {
199
+ headers,
200
+ });
201
+
202
+ return res.data;
203
+ }
204
+ public async transferAttendance(id: number, userId: number) {
205
+ const url = `/api/whatsapp/chats/${id}/transfer`;
206
+ const body = { userId };
207
+
208
+ await this.httpClient.post<MessageResponse>(url, body);
209
+ }
188
210
  }
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
  }