@in.pulse-crm/sdk 2.11.0 → 2.11.2

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.
@@ -9,6 +9,7 @@ export interface InternalMessage {
9
9
  body: string;
10
10
  timestamp: string;
11
11
  isForwarded: boolean;
12
+ isEdited: boolean;
12
13
  status: WppMessageStatus;
13
14
  fileId: number | null;
14
15
  fileName: string | null;
@@ -14,7 +14,7 @@ export default class WhatsappClient extends ApiClient {
14
14
  getUserWallets(instance: string, userId: number): Promise<WppWallet[]>;
15
15
  markContactMessagesAsRead(contactId: number): Promise<WppMessage[]>;
16
16
  sendMessage(to: string, data: SendMessageData): Promise<WppMessage>;
17
- editMessage(messageId: string, newText: string): Promise<void>;
17
+ editMessage(messageId: string, newText: string, isInternal?: boolean): Promise<void>;
18
18
  finishChatById(id: number, resultId: number): Promise<void>;
19
19
  startChatByContactId(contactId: number, template?: any): Promise<void>;
20
20
  getResults(): Promise<{
@@ -54,10 +54,11 @@ class WhatsappClient extends api_client_1.default {
54
54
  });
55
55
  return res.data;
56
56
  }
57
- async editMessage(messageId, newText) {
58
- const url = `/api/whatsapp/messages/${messageId}`;
57
+ async editMessage(messageId, newText, isInternal = false) {
58
+ const type = isInternal ? 'internal' : 'whatsapp';
59
+ const url = `/api/${type}/messages/${messageId}`;
59
60
  const body = { newText };
60
- const { data: res } = await this.ax.put(url, body);
61
+ await this.ax.put(url, body);
61
62
  }
62
63
  async finishChatById(id, resultId) {
63
64
  const url = `/api/whatsapp/chats/${id}/finish`;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@in.pulse-crm/sdk",
3
- "version": "2.11.0",
3
+ "version": "2.11.2",
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",
@@ -10,6 +10,7 @@ export interface InternalMessage {
10
10
  body: string;
11
11
  timestamp: string;
12
12
  isForwarded: boolean;
13
+ isEdited: boolean;
13
14
  status: WppMessageStatus;
14
15
  fileId: number | null;
15
16
  fileName: string | null;
@@ -103,15 +103,15 @@ export default class WhatsappClient extends ApiClient {
103
103
  return res.data;
104
104
  }
105
105
 
106
- public async editMessage(messageId: string, newText: string) {
107
- const url = `/api/whatsapp/messages/${messageId}`;
106
+ public async editMessage(messageId: string, newText: string, isInternal = false) {
107
+ const type = isInternal ? 'internal' : 'whatsapp';
108
+
109
+ const url = `/api/${type}/messages/${messageId}`;
108
110
  const body = { newText };
109
- const { data: res } = await this.ax.put<DataResponse<WppMessage>>(
110
- url,
111
- body,
112
- );
111
+ await this.ax.put(url, body);
113
112
  }
114
113
 
114
+
115
115
  public async finishChatById(id: number, resultId: number) {
116
116
  const url = `/api/whatsapp/chats/${id}/finish`;
117
117
  const body = { resultId };