@in.pulse-crm/sdk 2.4.8 → 2.4.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/dist/index.d.ts CHANGED
@@ -9,3 +9,4 @@ export { default as SocketClient } from "./socket.client";
9
9
  export { default as UsersClient } from "./users.client";
10
10
  export { default as WhatsappClient } from "./whatsapp.client";
11
11
  export { default as WalletsClient } from "./wallets.client";
12
+ export { default as InternalChat } from "./internal.client";
package/dist/index.js CHANGED
@@ -17,7 +17,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
17
17
  return (mod && mod.__esModule) ? mod : { "default": mod };
18
18
  };
19
19
  Object.defineProperty(exports, "__esModule", { value: true });
20
- exports.WalletsClient = exports.WhatsappClient = exports.UsersClient = exports.SocketClient = exports.SocketServerClient = exports.ReportsClient = exports.InstancesClient = exports.FilesClient = exports.CustomersClient = exports.AuthClient = void 0;
20
+ exports.InternalChat = exports.WalletsClient = exports.WhatsappClient = exports.UsersClient = exports.SocketClient = exports.SocketServerClient = exports.ReportsClient = exports.InstancesClient = exports.FilesClient = exports.CustomersClient = exports.AuthClient = void 0;
21
21
  __exportStar(require("./types"), exports);
22
22
  var auth_client_1 = require("./auth.client");
23
23
  Object.defineProperty(exports, "AuthClient", { enumerable: true, get: function () { return __importDefault(auth_client_1).default; } });
@@ -39,3 +39,5 @@ var whatsapp_client_1 = require("./whatsapp.client");
39
39
  Object.defineProperty(exports, "WhatsappClient", { enumerable: true, get: function () { return __importDefault(whatsapp_client_1).default; } });
40
40
  var wallets_client_1 = require("./wallets.client");
41
41
  Object.defineProperty(exports, "WalletsClient", { enumerable: true, get: function () { return __importDefault(wallets_client_1).default; } });
42
+ var internal_client_1 = require("./internal.client");
43
+ Object.defineProperty(exports, "InternalChat", { enumerable: true, get: function () { return __importDefault(internal_client_1).default; } });
@@ -0,0 +1,10 @@
1
+ import ApiClient from "./api-client";
2
+ import { InternalChat } from "./types/internal.types";
3
+ export default class InternalChatClient extends ApiClient {
4
+ getChatsForUser(userId: number, instance: string): Promise<InternalChat[]>;
5
+ getChatById(id: number): Promise<InternalChat>;
6
+ sendMessageToChat(chatId: number, userId: number, content: string): Promise<any>;
7
+ createGroup(name: string, participantIds: number[], userId: number): Promise<InternalChat>;
8
+ updateGroupMembers(groupId: number, add: number[], remove: number[]): Promise<any>;
9
+ setAuth(token: string): void;
10
+ }
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ const api_client_1 = __importDefault(require("./api-client"));
7
+ class InternalChatClient extends api_client_1.default {
8
+ async getChatsForUser(userId, instance) {
9
+ const url = `/api/internal/chats?userId=${userId}&instance=${instance}`;
10
+ const { data: res } = await this.httpClient.get(url);
11
+ return res.data;
12
+ }
13
+ async getChatById(id) {
14
+ const { data: res } = await this.httpClient.get(`/api/internal/chats/${id}`);
15
+ return res.data;
16
+ }
17
+ async sendMessageToChat(chatId, userId, content) {
18
+ const { data: res } = await this.httpClient.post(`/api/internal/chats/${chatId}/messages?userId=${userId}`, {
19
+ content,
20
+ });
21
+ return res;
22
+ }
23
+ async createGroup(name, participantIds, userId) {
24
+ const { data: res } = await this.httpClient.post(`/api/internal/chats/group?userId=${userId}`, { name, participantIds });
25
+ return res.data;
26
+ }
27
+ async updateGroupMembers(groupId, add, remove) {
28
+ const { data: res } = await this.httpClient.put(`/api/internal/chats/group/${groupId}/members`, { add, remove });
29
+ return res.data;
30
+ }
31
+ setAuth(token) {
32
+ this.httpClient.defaults.headers.common["Authorization"] =
33
+ `Bearer ${token}`;
34
+ }
35
+ }
36
+ exports.default = InternalChatClient;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@in.pulse-crm/sdk",
3
- "version": "2.4.8",
3
+ "version": "2.4.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",
@@ -26,8 +26,7 @@
26
26
  "@in.pulse-crm/utils": "^1.3.0",
27
27
  "axios": "^1.8.3",
28
28
  "form-data": "^4.0.2",
29
- "socket.io-client": "^4.8.1",
30
- "tsc": "^2.0.4"
29
+ "socket.io-client": "^4.8.1"
31
30
  },
32
31
  "devDependencies": {
33
32
  "@types/node": "^22.13.10",
package/src/index.ts CHANGED
@@ -1,3 +1,4 @@
1
+ import { InternalChat } from './types/internal.types';
1
2
  export * from "./types";
2
3
  export { default as AuthClient } from "./auth.client";
3
4
  export { default as CustomersClient } from "./customers.client";
@@ -8,4 +9,5 @@ export { default as SocketServerClient } from "./socket-server.client";
8
9
  export { default as SocketClient } from "./socket.client";
9
10
  export { default as UsersClient } from "./users.client";
10
11
  export { default as WhatsappClient } from "./whatsapp.client";
11
- export { default as WalletsClient } from "./wallets.client";
12
+ export { default as WalletsClient } from "./wallets.client";
13
+ export { default as InternalChat } from "./internal.client";
@@ -1,6 +1,6 @@
1
1
  import ApiClient from "./api-client";
2
- import { DataResponse, MessageResponse } from "./types/response.types";
3
- import { InternalChat, InternalMessage } from "./types/internal.types";
2
+ import { DataResponse } from "./types/response.types";
3
+ import { InternalChat } from "./types/internal.types";
4
4
 
5
5
  export default class InternalChatClient extends ApiClient {
6
6
  public async getChatsForUser(userId: number, instance: string) {