@spider-cloud/spider-client 0.0.34 → 0.0.35

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/client.d.ts CHANGED
@@ -110,14 +110,16 @@ export declare class Spider {
110
110
  /**
111
111
  * Downloads files from the specified user's storage. This will create signed URLS to use.
112
112
  * @param {string} [domain] - The domain for the user's storage. If not provided, downloads all files.
113
- * @param {Object} [options] - The download options
113
+ * @param {Object} [options] - The download options.
114
+ * @param {boolean} [raw] - Return the raw response.
115
+
114
116
  * @returns {Promise<Response>} The response containing the file stream.
115
117
  */
116
118
  downloadFiles(domain?: string, options?: {
117
119
  page?: number;
118
120
  limit?: number;
119
121
  expiresIn?: number;
120
- }): Promise<Response>;
122
+ }, raw?: boolean): Promise<Response>;
121
123
  /**
122
124
  * Retrieves the number of credits available on the account.
123
125
  * @returns {Promise<any>} The current credit balance.
package/dist/client.js CHANGED
@@ -163,10 +163,12 @@ class Spider {
163
163
  /**
164
164
  * Downloads files from the specified user's storage. This will create signed URLS to use.
165
165
  * @param {string} [domain] - The domain for the user's storage. If not provided, downloads all files.
166
- * @param {Object} [options] - The download options
166
+ * @param {Object} [options] - The download options.
167
+ * @param {boolean} [raw] - Return the raw response.
168
+
167
169
  * @returns {Promise<Response>} The response containing the file stream.
168
170
  */
169
- async downloadFiles(domain, options) {
171
+ async downloadFiles(domain, options, raw) {
170
172
  const { page, limit, expiresIn } = options !== null && options !== void 0 ? options : {};
171
173
  const params = new URLSearchParams({
172
174
  ...(domain && { domain }),
@@ -180,8 +182,13 @@ class Spider {
180
182
  method: "GET",
181
183
  headers,
182
184
  });
183
- if (!response.ok) {
184
- this.handleError(response, `Failed to download files`);
185
+ if (!raw) {
186
+ if (response.ok) {
187
+ return response.json();
188
+ }
189
+ else {
190
+ this.handleError(response, `Failed to download files`);
191
+ }
185
192
  }
186
193
  return response;
187
194
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@spider-cloud/spider-client",
3
- "version": "0.0.34",
3
+ "version": "0.0.35",
4
4
  "description": "A Javascript SDK for Spider Cloud services",
5
5
  "scripts": {
6
6
  "test": "jest",