@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.
- package/dist/files.client.d.ts +1 -0
- package/dist/files.client.js +4 -0
- package/dist/types/files.types.d.ts +10 -0
- package/dist/types/whatsapp.types.d.ts +9 -5
- package/package.json +1 -1
- package/src/files.client.ts +8 -0
- package/src/types/files.types.ts +11 -0
- package/src/types/whatsapp.types.ts +9 -5
package/dist/files.client.d.ts
CHANGED
|
@@ -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.
|
package/dist/files.client.js
CHANGED
|
@@ -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
|
-
|
|
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
|
|
153
|
-
sendAsAudio
|
|
156
|
+
sendAsDocument: boolean;
|
|
157
|
+
sendAsAudio: boolean;
|
|
154
158
|
}
|
|
155
159
|
export interface MonitorChat {
|
|
156
160
|
id: string;
|
package/package.json
CHANGED
package/src/files.client.ts
CHANGED
|
@@ -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.
|
package/src/types/files.types.ts
CHANGED
|
@@ -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
|
-
|
|
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
|
|
167
|
-
sendAsAudio
|
|
170
|
+
sendAsDocument: boolean;
|
|
171
|
+
sendAsAudio: boolean;
|
|
168
172
|
}
|
|
169
173
|
|
|
170
174
|
export interface MonitorChat {
|