polgo-upload-kit 1.1.8 → 1.1.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "polgo-upload-kit",
3
- "version": "1.1.8",
3
+ "version": "1.1.9",
4
4
  "type": "module",
5
5
  "main": "src/polgoUploadClient.js",
6
6
  "scripts": {
@@ -9,6 +9,28 @@ class PolgoUploadClient {
9
9
  this.token = token;
10
10
  }
11
11
 
12
+ async listarArquivos(bucket, diretorio) {
13
+ const queryParams = new URLSearchParams({
14
+ bucket,
15
+ diretorio,
16
+ });
17
+
18
+ const finalUrl = `${this.baseUrl}/listar?${queryParams.toString()}`;
19
+
20
+ try {
21
+ const response = await axios.get(finalUrl, {
22
+ headers: {
23
+ Authorization: `Bearer ${this.token}`,
24
+ },
25
+ });
26
+ console.log("Arquivos listados com sucesso:", response.data);
27
+ return response.data.arquivos || [];
28
+ } catch (error) {
29
+ console.error("Erro ao listar arquivos:", error.message);
30
+ throw new Error(`Falha ao listar arquivos: ${error.message}`);
31
+ }
32
+ }
33
+
12
34
  async uploadFile(bufferArquivo, bucket, options = {}, onProgress) {
13
35
  const mimeType = bufferArquivo.type;
14
36