@spider-cloud/spider-client 0.0.32 → 0.0.33
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 +4 -2
- package/dist/client.js +3 -3
- package/package.json +1 -1
package/dist/client.d.ts
CHANGED
|
@@ -109,13 +109,15 @@ export declare class Spider {
|
|
|
109
109
|
getCrawlState(url: string, params?: GenericParams): Promise<any>;
|
|
110
110
|
/**
|
|
111
111
|
* Downloads files from the specified user's storage.
|
|
112
|
-
* @param {string} userId - The user's ID whose files you want to download.
|
|
113
112
|
* @param {string} [domain] - The domain for the user's storage. If not provided, downloads all files.
|
|
114
113
|
* @param {number} [page] - The page number for pagination.
|
|
115
114
|
* @param {number} [limit] - The number of files to return per page.
|
|
116
115
|
* @returns {Promise<Response>} The response containing the file stream.
|
|
117
116
|
*/
|
|
118
|
-
downloadFiles(
|
|
117
|
+
downloadFiles(domain?: string, options?: {
|
|
118
|
+
page?: number;
|
|
119
|
+
limit?: number;
|
|
120
|
+
}): Promise<Response>;
|
|
119
121
|
/**
|
|
120
122
|
* Retrieves the number of credits available on the account.
|
|
121
123
|
* @returns {Promise<any>} The current credit balance.
|
package/dist/client.js
CHANGED
|
@@ -162,13 +162,13 @@ class Spider {
|
|
|
162
162
|
}
|
|
163
163
|
/**
|
|
164
164
|
* Downloads files from the specified user's storage.
|
|
165
|
-
* @param {string} userId - The user's ID whose files you want to download.
|
|
166
165
|
* @param {string} [domain] - The domain for the user's storage. If not provided, downloads all files.
|
|
167
166
|
* @param {number} [page] - The page number for pagination.
|
|
168
167
|
* @param {number} [limit] - The number of files to return per page.
|
|
169
168
|
* @returns {Promise<Response>} The response containing the file stream.
|
|
170
169
|
*/
|
|
171
|
-
async downloadFiles(
|
|
170
|
+
async downloadFiles(domain, options) {
|
|
171
|
+
const { page, limit } = options !== null && options !== void 0 ? options : {};
|
|
172
172
|
const params = new URLSearchParams({
|
|
173
173
|
...(domain && { domain }),
|
|
174
174
|
...(page && { page: page.toString() }),
|
|
@@ -181,7 +181,7 @@ class Spider {
|
|
|
181
181
|
headers,
|
|
182
182
|
});
|
|
183
183
|
if (!response.ok) {
|
|
184
|
-
this.handleError(response, `download files
|
|
184
|
+
this.handleError(response, `Cannot download files`);
|
|
185
185
|
}
|
|
186
186
|
return response;
|
|
187
187
|
}
|