Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
OpenHarmony
Docs
提交
bc4231a1
D
Docs
项目概览
OpenHarmony
/
Docs
大约 1 年 前同步成功
通知
159
Star
292
Fork
28
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
D
Docs
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
bc4231a1
编写于
12月 22, 2022
作者:
O
openharmony_ci
提交者:
Gitee
12月 22, 2022
浏览文件
操作
浏览文件
下载
差异文件
!12773 增加changelogs
Merge pull request !12773 from Jeam.wang/master
上级
9c19000d
3ad93e8e
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
108 addition
and
0 deletion
+108
-0
zh-cn/release-notes/changelogs/OpenHarmony_3.2.8.1/changelogs-request.md
...otes/changelogs/OpenHarmony_3.2.8.1/changelogs-request.md
+108
-0
未找到文件。
zh-cn/release-notes/changelogs/OpenHarmony_3.2.8.1/changelogs-request.md
0 → 100644
浏览文件 @
bc4231a1
# 上传下载子系统ChangeLog
OpenHarmony 3.2.8.1版本相较于OpenHarmony 3.2.beta3版本,request子系统的API变更如下
## cl.request.1 错误码定义及API部分接口名称变更
-
新增上传下载接口的
[
错误码
](
https://gitee.com/openharmony/docs/blob/master/zh-cn/application-dev/reference/errorcodes/errorcode-request.md
)
处理。
-
错误信息通过AsyncCallback或Promise的error对象返回。其中,参数类型和数量错误信息,通过抛出异常的方式返回。
-
API部分接口需要用新的接口替换,参数不变。
**变更影响**
基于此前版本开发的应用,需适配变更后的新错误码和错误信息返回方式,否则会影响原有业务逻辑。
**关键的接口/组件变更**
| 模块名 | 类名 | 方法/属性/枚举/常量 | 变更类型 |
|--------------|--------------|-----------------------------------------------------------------------------------------------------------------------|-----------|
| ohos.request | request | EXCEPTION_PERMISSION | 新增 |
| ohos.request | request | EXCEPTION_PARAMCHECK | 新增 |
| ohos.request | request | EXCEPTION_UNSUPPORTED | 新增 |
| ohos.request | request | EXCEPTION_FILEIO | 新增 |
| ohos.request | request | EXCEPTION_FILEPATH | 新增 |
| ohos.request | request | EXCEPTION_SERVICE | 新增 |
| ohos.request | request | EXCEPTION_OTHERS | 新增 |
| ohos.request | request | ERROR_OFFLINE | 新增 |
| ohos.request | request | ERROR_UNSUPPORTED_NETWORK_TYPE | 新增 |
| ohos.request | request | function downloadFile(context: BaseContext, config: DownloadConfig, callback: AsyncCallback
<DownloadTask>
): void; | 新增 |
| ohos.request | request | function downloadFile(context: BaseContext, config: DownloadConfig): Promise
<DownloadTask>
; | 新增 |
| ohos.request | request | function uploadFile(context: BaseContext, config: UploadConfig, callback: AsyncCallback
<UploadTask>
): void; | 新增 |
| ohos.request | request | function uploadFile(context: BaseContext, config: UploadConfig): Promise
<UploadTask>
; | 新增 |
| ohos.request | DownloadTask | delete(callback: AsyncCallback
<boolean>
): void; | 新增 |
| ohos.request | DownloadTask | delete(): Promise
<boolean>
; | 新增 |
| ohos.request | DownloadTask | suspend(callback: AsyncCallback
<boolean>
): void; | 新增 |
| ohos.request | DownloadTask | suspend(): Promise
<boolean>
; | 新增 |
| ohos.request | DownloadTask | restore(callback: AsyncCallback
<boolean>
): void; | 新增 |
| ohos.request | DownloadTask | restore(): Promise
<boolean>
; | 新增 |
| ohos.request | DownloadTask | getTaskInfo(callback: AsyncCallback
<DownloadInfo>
): void; | 新增 |
| ohos.request | DownloadTask | getTaskInfo(): Promise
<DownloadInfo>
; | 新增 |
| ohos.request | DownloadTask | getTaskMimeType(callback: AsyncCallback
<string>
): void; | 新增 |
| ohos.request | DownloadTask | getTaskMimeType(): Promise
<string>
; | 新增 |
| ohos.request | UploadTask | delete(callback: AsyncCallback
<boolean>
): void; | 新增 |
| ohos.request | UploadTask | delete(): Promise
<boolean>
; | 新增 |
| ohos.request | request | function download(config: DownloadConfig, callback: AsyncCallback
<DownloadTask>
): void;
<br>
代替接口:function downloadFile(context: BaseContext, config: DownloadConfig, callback: AsyncCallback
<DownloadTask>
): void; | 废弃 |
| ohos.request | request | function download(config: DownloadConfig): Promise
<DownloadTask>
;
<br>
代替接口:function downloadFile(context: BaseContext, config: DownloadConfig): Promise
<DownloadTask>
; | 废弃 |
| ohos.request | request | function download(context: BaseContext, config: DownloadConfig, callback: AsyncCallback
<DownloadTask>
): void;
<br>
代替接口:function downloadFile(context: BaseContext, config: DownloadConfig, callback: AsyncCallback
<DownloadTask>
): void; | 废弃 |
| ohos.request | request | function download(context: BaseContext, config: DownloadConfig): Promise
<DownloadTask>
;
<br>
代替接口:function downloadFile(context: BaseContext, config: DownloadConfig): Promise
<DownloadTask>
; | 废弃 |
| ohos.request | request | function upload(config: UploadConfig, callback: AsyncCallback
<UploadTask>
): void;
<br>
代替接口:function uploadFile(context: BaseContext, config: UploadConfig, callback: AsyncCallback
<UploadTask>
): void; | 废弃 |
| ohos.request | request | function upload(config: UploadConfig): Promise
<UploadTask>
;
<br>
代替接口:function uploadFile(context: BaseContext, config: UploadConfig): Promise
<UploadTask>
; | 废弃 |
| ohos.request | request | function upload(context: BaseContext, config: UploadConfig, callback: AsyncCallback
<UploadTask>
): void;
<br>
代替接口:function uploadFile(context: BaseContext, config: UploadConfig, callback: AsyncCallback
<UploadTask>
): void; | 废弃 |
| ohos.request | request | function upload(context: BaseContext, config: UploadConfig): Promise
<UploadTask>
;
<br>
代替接口:function uploadFile(context: BaseContext, config: UploadConfig): Promise
<UploadTask>
; | 废弃 |
| ohos.request | DownloadTask | remove(callback: AsyncCallback
<boolean>
): void;
<br>
代替接口:delete(callback: AsyncCallback
<boolean>
): void | 废弃 |
| ohos.request | DownloadTask | remove(): Promise
<boolean>
;
<br>
代替接口:delete(): Promise
<boolean>
; | 废弃 |
| ohos.request | DownloadTask | pause(callback: AsyncCallback
<boolean>
): void;
<br>
代替接口:suspend(callback: AsyncCallback
<boolean>
): void; | 废弃 |
| ohos.request | DownloadTask | pause(): Promise
<boolean>
;
<br>
代替接口:suspend(): Promise
<boolean>
; | 废弃 |
| ohos.request | DownloadTask | resume(callback: AsyncCallback
<boolean>
): void;
<br>
代替接口:restore(callback: AsyncCallback
<boolean>
): void; | 废弃 |
| ohos.request | DownloadTask | resume(): Promise
<boolean>
;
<br>
代替接口:restore(): Promise
<boolean>
; | 废弃 |
| ohos.request | DownloadTask | query(callback: AsyncCallback
<DownloadInfo>
): void;
<br>
代替接口:getTaskInfo(callback: AsyncCallback
<DownloadInfo>
): void; | 废弃 |
| ohos.request | DownloadTask | query(): Promise
<DownloadInfo>
;
<br>
代替接口:getTaskInfo(): Promise
<DownloadInfo>
; | 废弃 |
| ohos.request | DownloadTask | queryMimeType(callback: AsyncCallback
<string>
): void;
<br>
代替接口:getTaskMimeType(callback: AsyncCallback
<string>
): void; | 废弃 |
| ohos.request | DownloadTask | queryMimeType(): Promise
<string>
;
<br>
代替接口:getTaskMimeType(): Promise
<string>
; | 废弃 |
| ohos.request | UploadTask | remove(callback: AsyncCallback
<boolean>
): void;
<br>
代替接口:delete(callback: AsyncCallback
<boolean>
): void; | 废弃 |
| ohos.request | UploadTask | remove(): Promise
<boolean>
;
<br>
代替接口:delete(): Promise
<boolean>
; | 废弃 |
| system.request | UploadResponse | code | 废弃 |
| system.request | UploadResponse | data | 废弃 |
| system.request | UploadResponse | headers | 废弃 |
| system.request | DownloadResponse | token | 废弃 |
| system.request | OnDownloadCompleteResponse | uri | 废弃 |
| system.request | RequestFile | filename | 废弃 |
| system.request | RequestFile | name | 废弃 |
| system.request | RequestFile | uri | 废弃 |
| system.request | RequestFile | type | 废弃 |
| system.request | RequestData | name | 废弃 |
| system.request | RequestData | value | 废弃 |
| system.request | UploadRequestOptions | url | 废弃 |
| system.request | UploadRequestOptions | data | 废弃 |
| system.request | UploadRequestOptions | files | 废弃 |
| system.request | UploadRequestOptions | header | 废弃 |
| system.request | UploadRequestOptions | description | 废弃 |
| system.request | UploadRequestOptions | success | 废弃 |
| system.request | UploadRequestOptions | fail | 废弃 |
| system.request | UploadRequestOptions | complete | 废弃 |
| system.request | OnDownloadCompleteOptions | token | 废弃 |
| system.request | OnDownloadCompleteOptions | success | 废弃 |
| system.request | OnDownloadCompleteOptions | fail | 废弃 |
| system.request | OnDownloadCompleteOptions | complete | 废弃 |
| system.request | Request | static upload(options: UploadRequestOptions): void; | 废弃 |
| system.request | Request | static download(options: DownloadRequestOptions): void; | 废弃 |
| system.request | Request | static onDownloadComplete(options: OnDownloadCompleteOptions): void; | 废弃 |
**适配指导**
以downloadFile为例,在新版本上需要使用如下方式进行调用:
```
ts
try
{
request
.
downloadFile
(
globalThis
.
abilityContext
,
{
url
:
'
https://xxxx/xxxxx.hap
'
,
filePath
:
'
xxx/xxxxx.hap
'
},
(
err
,
data
)
=>
{
if
(
err
)
{
console
.
error
(
'
Failed to request the download. Cause:
'
+
JSON
.
stringify
(
err
));
return
;
}
});
}
catch
(
err
)
{
console
.
log
(
"
downloadFile callback fail.
"
+
"
errCode:
"
+
err
.
code
+
"
,errMessage:
"
+
err
.
message
);
}
```
\ No newline at end of file
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录