@in.pulse-crm/sdk 2.2.7 → 2.2.9

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,3 +1,5 @@
1
+ /// <reference types="node" />
2
+ /// <reference types="node" />
1
3
  import ApiClient from "./api-client";
2
4
  import { File, UploadFileOptions } from "./types/files.types";
3
5
  declare class FilesClient extends ApiClient {
@@ -1,3 +1,5 @@
1
+ /// <reference types="node" />
2
+ /// <reference types="node" />
1
3
  export interface UploadFileOptions {
2
4
  /**
3
5
  * Nome da instância onde o arquivo está armazenado.
@@ -1,6 +1,6 @@
1
1
  import { SocketServerAdminRoom, SocketServerChatRoom, SocketServerReportsRoom, SocketServerRoom } from "./socket-rooms.types";
2
2
  import { MessageResponse } from "./response.types";
3
- import { WppMessageStatus } from "./whatsapp.types";
3
+ import { WppMessage, WppMessageStatus } from "./whatsapp.types";
4
4
  export declare enum SocketEventType {
5
5
  WppChatStarted = "wpp_chat_started",
6
6
  WppChatFinished = "wpp_chat_finished",
@@ -50,7 +50,7 @@ export interface WppChatFinishedEventData {
50
50
  chatId: number;
51
51
  }
52
52
  export interface WppMessageEventData {
53
- messageId: number;
53
+ message: WppMessage;
54
54
  }
55
55
  export interface WppMessageStatusEventData {
56
56
  messageId: number;
@@ -5,7 +5,7 @@ type GetChatsResponse = DataResponse<WppChatsAndMessages>;
5
5
  type GetChatResponse = DataResponse<WppChatWithDetailsAndMessages>;
6
6
  type GetMessageResponse = DataResponse<WppMessage>;
7
7
  export default class WhatsappClient extends ApiClient {
8
- getChatsWithMessages(): Promise<GetChatsResponse>;
8
+ getChatsBySession(token: string, messages?: boolean, contact?: boolean): Promise<GetChatsResponse>;
9
9
  getChatById(id: number): Promise<GetChatResponse>;
10
10
  getMessageById(id: string): Promise<GetMessageResponse>;
11
11
  setAuth(token: string): void;
@@ -5,8 +5,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  const api_client_1 = __importDefault(require("./api-client"));
7
7
  class WhatsappClient extends api_client_1.default {
8
- async getChatsWithMessages() {
9
- const { data } = await this.httpClient.get("/api/whatsapp/chats");
8
+ async getChatsBySession(token, messages = false, contact = false) {
9
+ const url = `/api/whatsapp/session/chats?messages=${messages}&contact=${contact}`;
10
+ const { data } = await this.httpClient.get(url, {
11
+ headers: {
12
+ Authorization: `Bearer ${token}`,
13
+ },
14
+ });
10
15
  return data;
11
16
  }
12
17
  async getChatById(id) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@in.pulse-crm/sdk",
3
- "version": "2.2.7",
3
+ "version": "2.2.9",
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",
@@ -5,7 +5,7 @@ import {
5
5
  SocketServerRoom,
6
6
  } from "./socket-rooms.types";
7
7
  import { MessageResponse } from "./response.types";
8
- import { WppMessageStatus } from "./whatsapp.types";
8
+ import { WppMessage, WppMessageStatus } from "./whatsapp.types";
9
9
 
10
10
  export enum SocketEventType {
11
11
  WppChatStarted = "wpp_chat_started",
@@ -119,7 +119,7 @@ export interface WppChatFinishedEventData {
119
119
  chatId: number;
120
120
  }
121
121
  export interface WppMessageEventData {
122
- messageId: number;
122
+ message: WppMessage;
123
123
  }
124
124
  export interface WppMessageStatusEventData {
125
125
  messageId: number;
@@ -11,10 +11,18 @@ type GetChatResponse = DataResponse<WppChatWithDetailsAndMessages>;
11
11
  type GetMessageResponse = DataResponse<WppMessage>;
12
12
 
13
13
  export default class WhatsappClient extends ApiClient {
14
- public async getChatsWithMessages() {
15
- const { data } = await this.httpClient.get<GetChatsResponse>(
16
- "/api/whatsapp/chats",
17
- );
14
+ public async getChatsBySession(
15
+ token: string,
16
+ messages = false,
17
+ contact = false,
18
+ ) {
19
+ const url = `/api/whatsapp/session/chats?messages=${messages}&contact=${contact}`;
20
+
21
+ const { data } = await this.httpClient.get<GetChatsResponse>(url, {
22
+ headers: {
23
+ Authorization: `Bearer ${token}`,
24
+ },
25
+ });
18
26
 
19
27
  return data;
20
28
  }
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
  }