@in.pulse-crm/sdk 2.14.4 → 2.14.6

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.
@@ -21,6 +21,7 @@ declare class FilesClient extends ApiClient {
21
21
  * @returns {string} URL de download do arquivo.
22
22
  */
23
23
  getFileDownloadUrl(id: number, baseUrl?: string): string;
24
+ getFileByHash(instance: string, hash: string): Promise<File>;
24
25
  /**
25
26
  * Faz o upload de um arquivo.
26
27
  * @param {UploadFileOptions} props - Opções para o upload do arquivo.
@@ -37,6 +37,10 @@ class FilesClient extends api_client_1.default {
37
37
  getFileDownloadUrl(id, baseUrl) {
38
38
  return (baseUrl || this.ax.defaults.baseURL) + `/api/files/${id}`;
39
39
  }
40
+ async getFileByHash(instance, hash) {
41
+ const { data: res } = await this.ax.get(`/api/files/exists?instance=${instance}&hash=${hash}`);
42
+ return res.data;
43
+ }
40
44
  /**
41
45
  * Faz o upload de um arquivo.
42
46
  * @param {UploadFileOptions} props - Opções para o upload do arquivo.
@@ -1,3 +1,13 @@
1
+ export interface FileExistsByHashResponse {
2
+ /**
3
+ * Indica se um arquivo com o hash especificado existe.
4
+ */
5
+ exists: boolean;
6
+ /**
7
+ * Os dados do arquivo encontrado, caso exista.
8
+ */
9
+ file?: File;
10
+ }
1
11
  export interface UploadFileOptions {
2
12
  /**
3
13
  * Nome da instância onde o arquivo está armazenado.
@@ -141,16 +141,20 @@ export type WppChatWithDetailsAndMessages = WppChatWithDetails & {
141
141
  messages: WppMessage[];
142
142
  };
143
143
  export interface SendMessageData {
144
- sendAsChatOwner?: boolean;
145
- contactId: number;
146
144
  text: string;
147
- quotedId?: number | null;
145
+ contactId: number;
148
146
  chatId?: number | null;
147
+ quotedId?: number | null;
148
+ isForwarded?: boolean;
149
+ sendAsChatOwner?: boolean;
150
+ sendAsAudio?: boolean;
151
+ sendAsDocument?: boolean;
152
+ fileId?: number;
149
153
  }
150
154
  export interface SendFileMessageData extends SendMessageData {
151
155
  fileId: number;
152
- sendAsDocument?: boolean;
153
- sendAsAudio?: boolean;
156
+ sendAsDocument: boolean;
157
+ sendAsAudio: boolean;
154
158
  }
155
159
  export interface MonitorChat {
156
160
  id: string;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@in.pulse-crm/sdk",
3
- "version": "2.14.4",
3
+ "version": "2.14.6",
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",
@@ -42,6 +42,14 @@ class FilesClient extends ApiClient {
42
42
  return (baseUrl || this.ax.defaults.baseURL) + `/api/files/${id}`;
43
43
  }
44
44
 
45
+ public async getFileByHash(instance: string, hash: string): Promise<File> {
46
+ const { data: res } = await this.ax.get<DataResponse<File>>(
47
+ `/api/files/exists?instance=${instance}&hash=${hash}`,
48
+ );
49
+
50
+ return res.data;
51
+ }
52
+
45
53
  /**
46
54
  * Faz o upload de um arquivo.
47
55
  * @param {UploadFileOptions} props - Opções para o upload do arquivo.
@@ -1,3 +1,14 @@
1
+ export interface FileExistsByHashResponse {
2
+ /**
3
+ * Indica se um arquivo com o hash especificado existe.
4
+ */
5
+ exists: boolean;
6
+ /**
7
+ * Os dados do arquivo encontrado, caso exista.
8
+ */
9
+ file?: File;
10
+ }
11
+
1
12
  export interface UploadFileOptions {
2
13
  /**
3
14
  * Nome da instância onde o arquivo está armazenado.
@@ -154,17 +154,21 @@ export type WppChatWithDetailsAndMessages = WppChatWithDetails & {
154
154
  };
155
155
 
156
156
  export interface SendMessageData {
157
- sendAsChatOwner?: boolean;
158
- contactId: number;
159
157
  text: string;
160
- quotedId?: number | null;
158
+ contactId: number;
161
159
  chatId?: number | null;
160
+ quotedId?: number | null;
161
+ isForwarded?: boolean;
162
+ sendAsChatOwner?: boolean;
163
+ sendAsAudio?: boolean;
164
+ sendAsDocument?: boolean;
165
+ fileId?: number;
162
166
  }
163
167
 
164
168
  export interface SendFileMessageData extends SendMessageData {
165
169
  fileId: number;
166
- sendAsDocument?: boolean;
167
- sendAsAudio?: boolean;
170
+ sendAsDocument: boolean;
171
+ sendAsAudio: boolean;
168
172
  }
169
173
 
170
174
  export interface MonitorChat {