assistsx-js 0.1.24 → 0.1.25

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.
@@ -23,6 +23,7 @@ export interface HttpDownloadResponse {
23
23
  statusMessage: string;
24
24
  savePath: string;
25
25
  fileSize: number;
26
+ saveToGallerySuccess?: boolean;
26
27
  headers: Record<string, string>;
27
28
  }
28
29
  /**
@@ -94,10 +95,11 @@ export declare class Http {
94
95
  * @param url 下载 URL
95
96
  * @param savePath 保存路径
96
97
  * @param headers 请求头
98
+ * @param saveToGallery 是否保存到系统相册(仅支持图片和视频文件),默认 false
97
99
  * @param timeout 超时时间(秒),默认30秒
98
100
  * @returns Promise<下载响应>
99
101
  */
100
- httpDownload(url: string, savePath: string, headers?: Record<string, string>, timeout?: number): Promise<HttpDownloadResponse>;
102
+ httpDownload(url: string, savePath: string, headers?: Record<string, string>, saveToGallery?: boolean, timeout?: number): Promise<HttpDownloadResponse>;
101
103
  /**
102
104
  * 配置 OkHttpClient
103
105
  * @param config 配置选项
@@ -144,12 +144,13 @@ export class Http {
144
144
  * @param url 下载 URL
145
145
  * @param savePath 保存路径
146
146
  * @param headers 请求头
147
+ * @param saveToGallery 是否保存到系统相册(仅支持图片和视频文件),默认 false
147
148
  * @param timeout 超时时间(秒),默认30秒
148
149
  * @returns Promise<下载响应>
149
150
  */
150
- async httpDownload(url, savePath, headers, timeout) {
151
+ async httpDownload(url, savePath, headers, saveToGallery, timeout) {
151
152
  var _a;
152
- const response = await this.asyncCall("httpDownload", { url, savePath, headers }, timeout);
153
+ const response = await this.asyncCall("httpDownload", { url, savePath, headers, saveToGallery }, timeout);
153
154
  if (!response.isSuccess()) {
154
155
  throw new Error(((_a = response.data) === null || _a === void 0 ? void 0 : _a.message) || "HTTP download failed");
155
156
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "assistsx-js",
3
- "version": "0.1.24",
3
+ "version": "0.1.25",
4
4
  "description": "assistsx-js自动化开发SDK",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.js",
@@ -32,6 +32,7 @@ export interface HttpDownloadResponse {
32
32
  statusMessage: string;
33
33
  savePath: string;
34
34
  fileSize: number;
35
+ saveToGallerySuccess?: boolean;
35
36
  headers: Record<string, string>;
36
37
  }
37
38
 
@@ -223,6 +224,7 @@ export class Http {
223
224
  * @param url 下载 URL
224
225
  * @param savePath 保存路径
225
226
  * @param headers 请求头
227
+ * @param saveToGallery 是否保存到系统相册(仅支持图片和视频文件),默认 false
226
228
  * @param timeout 超时时间(秒),默认30秒
227
229
  * @returns Promise<下载响应>
228
230
  */
@@ -230,11 +232,12 @@ export class Http {
230
232
  url: string,
231
233
  savePath: string,
232
234
  headers?: Record<string, string>,
235
+ saveToGallery?: boolean,
233
236
  timeout?: number
234
237
  ): Promise<HttpDownloadResponse> {
235
238
  const response = await this.asyncCall(
236
239
  "httpDownload",
237
- { url, savePath, headers },
240
+ { url, savePath, headers, saveToGallery },
238
241
  timeout
239
242
  );
240
243
  if (!response.isSuccess()) {