@doubao-apps/create 0.0.27 → 0.0.28
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/36.js +1 -1
- package/dist/cli.js +10 -10
- package/dist/template-empty/AGENTS.md +20 -20
- package/dist/template-empty/package.json +2 -2
- package/dist/template-empty/references/reference/open-api/01-/345/237/272/347/241/200-/350/264/246/345/217/267-/347/263/273/347/273/237.md +2943 -0
- package/dist/template-empty/references/reference/open-api/02-/350/267/257/347/224/261.md +63 -0
- package/dist/template-empty/{.ai/reference/open-api/05- → references/reference/open-api/03-}/347/225/214/351/235/242-/350/276/223/345/205/245.md +30 -0
- package/dist/template-empty/references/reference/open-api/04-/346/225/260/346/215/256/345/210/206/346/236/220.md +67 -0
- package/dist/{template-starter/.ai/reference/open-api/16-ui- → template-empty/references/reference/open-api/12-ui-}/350/276/223/345/205/245.md +0 -16
- package/dist/template-empty/references/reference/open-api/README.md +32 -0
- package/dist/template-empty/{.ai → references}/reference/open-api.md +420 -10
- package/dist/template-starter/AGENTS.md +20 -20
- package/dist/template-starter/README.md +48 -33
- package/dist/template-starter/package.json +2 -2
- package/dist/template-starter/references/reference/open-api/01-/345/237/272/347/241/200-/350/264/246/345/217/267-/347/263/273/347/273/237.md +2943 -0
- package/dist/template-starter/references/reference/open-api/02-/350/267/257/347/224/261.md +63 -0
- package/dist/template-starter/{.ai/reference/open-api/05- → references/reference/open-api/03-}/347/225/214/351/235/242-/350/276/223/345/205/245.md +30 -0
- package/dist/template-starter/references/reference/open-api/04-/346/225/260/346/215/256/345/210/206/346/236/220.md +67 -0
- package/dist/{template-empty/.ai/reference/open-api/16-ui- → template-starter/references/reference/open-api/12-ui-}/350/276/223/345/205/245.md +0 -16
- package/dist/template-starter/references/reference/open-api/README.md +32 -0
- package/dist/template-starter/{.ai → references}/reference/open-api.md +420 -10
- package/package.json +1 -1
- package/dist/template-empty/.ai/guides/system-prompt.md +0 -331
- package/dist/template-empty/.ai/reference/open-api/01-/345/237/272/347/241/200-/350/264/246/345/217/267-/347/263/273/347/273/237.md +0 -699
- package/dist/template-empty/.ai/reference/open-api/02-/345/255/230/345/202/250.md +0 -409
- package/dist/template-empty/.ai/reference/open-api/03-/350/267/257/347/224/261.md +0 -165
- package/dist/template-empty/.ai/reference/open-api/04-/347/225/214/351/235/242-/344/272/244/344/272/222.md +0 -432
- package/dist/template-empty/.ai/reference/open-api/06-/347/275/221/347/273/234.md +0 -148
- package/dist/template-empty/.ai/reference/open-api/07-/345/252/222/344/275/223.md +0 -346
- package/dist/template-empty/.ai/reference/open-api/08-/345/274/200/346/224/276/350/203/275/345/212/233-/344/270/232/345/212/241/350/203/275/345/212/233.md +0 -546
- package/dist/template-empty/.ai/reference/open-api/README.md +0 -36
- package/dist/template-starter/.ai/guides/system-prompt.md +0 -331
- package/dist/template-starter/.ai/reference/open-api/01-/345/237/272/347/241/200-/350/264/246/345/217/267-/347/263/273/347/273/237.md +0 -699
- package/dist/template-starter/.ai/reference/open-api/02-/345/255/230/345/202/250.md +0 -409
- package/dist/template-starter/.ai/reference/open-api/03-/350/267/257/347/224/261.md +0 -165
- package/dist/template-starter/.ai/reference/open-api/04-/347/225/214/351/235/242-/344/272/244/344/272/222.md +0 -432
- package/dist/template-starter/.ai/reference/open-api/06-/347/275/221/347/273/234.md +0 -148
- package/dist/template-starter/.ai/reference/open-api/07-/345/252/222/344/275/223.md +0 -346
- package/dist/template-starter/.ai/reference/open-api/08-/345/274/200/346/224/276/350/203/275/345/212/233-/344/270/232/345/212/241/350/203/275/345/212/233.md +0 -546
- package/dist/template-starter/.ai/reference/open-api/README.md +0 -36
- /package/dist/template-empty/{.ai → references}/examples/common-patterns.md +0 -0
- /package/dist/template-empty/{.ai → references}/examples/component-basics.md +0 -0
- /package/dist/template-empty/{.ai → references}/guides/best-practices.md +0 -0
- /package/dist/template-empty/{.ai → references}/guides/component-development.md +0 -0
- /package/dist/template-empty/{.ai → references}/guides/performance-optimization.md +0 -0
- /package/dist/template-empty/{.ai → references}/guides/troubleshooting.md +0 -0
- /package/dist/template-empty/{.ai → references}/reference/components-quick-ref.md +0 -0
- /package/dist/template-empty/{.ai → references}/reference/framework-api-quick-ref.md +0 -0
- /package/dist/template-empty/{.ai/reference/open-api/09- → references/reference/open-api/05-}/350/256/276/345/244/207-/350/223/235/347/211/231.md" +0 -0
- /package/dist/template-empty/{.ai/reference/open-api/10- → references/reference/open-api/06-}/350/256/276/345/244/207-wi-fi.md" +0 -0
- /package/dist/template-empty/{.ai/reference/open-api/11- → references/reference/open-api/07-}/350/256/276/345/244/207-/345/212/240/351/200/237/345/272/246/350/256/241.md" +0 -0
- /package/dist/template-empty/{.ai/reference/open-api/12- → references/reference/open-api/08-}/350/256/276/345/244/207-ibeacon.md" +0 -0
- /package/dist/template-empty/{.ai/reference/open-api/13- → references/reference/open-api/09-}/350/256/276/345/244/207-/347/275/227/347/233/230.md" +0 -0
- /package/dist/template-empty/{.ai/reference/open-api/14- → references/reference/open-api/10-}/350/256/276/345/244/207-/350/256/276/345/244/207/346/226/271/345/220/221.md" +0 -0
- /package/dist/template-empty/{.ai/reference/open-api/15- → references/reference/open-api/11-}/350/256/276/345/244/207-/351/231/200/350/236/272/344/273/252.md" +0 -0
- /package/dist/template-empty/{.ai/reference/open-api/17- → references/reference/open-api/13-}/350/256/276/345/244/207-/347/275/221/347/273/234.md" +0 -0
- /package/dist/template-empty/{.ai/reference/open-api/18- → references/reference/open-api/14-}/350/256/276/345/244/207-/347/237/255/344/277/241.md" +0 -0
- /package/dist/template-empty/{.ai/reference/open-api/19- → references/reference/open-api/15-}/350/256/276/345/244/207-/346/227/240/351/232/234/347/242/215.md" +0 -0
- /package/dist/template-empty/{.ai/reference/open-api/20- → references/reference/open-api/16-}/350/256/276/345/244/207-/347/224/265/346/261/240.md" +0 -0
- /package/dist/template-empty/{.ai/reference/open-api/21- → references/reference/open-api/17-}/350/256/276/345/244/207-/346/227/245/345/216/206.md" +0 -0
- /package/dist/template-empty/{.ai/reference/open-api/22- → references/reference/open-api/18-}/350/256/276/345/244/207-/345/211/252/350/264/264/346/235/277.md" +0 -0
- /package/dist/template-empty/{.ai/reference/open-api/23- → references/reference/open-api/19-}/350/256/276/345/244/207-/350/201/224/347/263/273/344/272/272.md" +0 -0
- /package/dist/template-empty/{.ai/reference/open-api/24- → references/reference/open-api/20-}/350/256/276/345/244/207-/345/212/240/345/257/206.md" +0 -0
- /package/dist/template-empty/{.ai/reference/open-api/25- → references/reference/open-api/21-}/350/256/276/345/244/207-/347/224/265/350/257/235.md" +0 -0
- /package/dist/template-empty/{.ai/reference/open-api/26- → references/reference/open-api/22-}/350/256/276/345/244/207-/346/211/253/347/240/201.md" +0 -0
- /package/dist/template-empty/{.ai/reference/open-api/27- → references/reference/open-api/23-}/350/256/276/345/244/207-/345/261/217/345/271/225.md" +0 -0
- /package/dist/template-empty/{.ai/reference/open-api/28- → references/reference/open-api/24-}/350/256/276/345/244/207-/351/234/207/345/212/250.md" +0 -0
- /package/dist/template-empty/{.ai → references}/rules/dos-and-donts.md +0 -0
- /package/dist/template-starter/{.ai → references}/examples/common-patterns.md +0 -0
- /package/dist/template-starter/{.ai → references}/examples/component-basics.md +0 -0
- /package/dist/template-starter/{.ai → references}/guides/best-practices.md +0 -0
- /package/dist/template-starter/{.ai → references}/guides/component-development.md +0 -0
- /package/dist/template-starter/{.ai → references}/guides/performance-optimization.md +0 -0
- /package/dist/template-starter/{.ai → references}/guides/troubleshooting.md +0 -0
- /package/dist/template-starter/{.ai → references}/reference/components-quick-ref.md +0 -0
- /package/dist/template-starter/{.ai → references}/reference/framework-api-quick-ref.md +0 -0
- /package/dist/template-starter/{.ai/reference/open-api/09- → references/reference/open-api/05-}/350/256/276/345/244/207-/350/223/235/347/211/231.md" +0 -0
- /package/dist/template-starter/{.ai/reference/open-api/10- → references/reference/open-api/06-}/350/256/276/345/244/207-wi-fi.md" +0 -0
- /package/dist/template-starter/{.ai/reference/open-api/11- → references/reference/open-api/07-}/350/256/276/345/244/207-/345/212/240/351/200/237/345/272/246/350/256/241.md" +0 -0
- /package/dist/template-starter/{.ai/reference/open-api/12- → references/reference/open-api/08-}/350/256/276/345/244/207-ibeacon.md" +0 -0
- /package/dist/template-starter/{.ai/reference/open-api/13- → references/reference/open-api/09-}/350/256/276/345/244/207-/347/275/227/347/233/230.md" +0 -0
- /package/dist/template-starter/{.ai/reference/open-api/14- → references/reference/open-api/10-}/350/256/276/345/244/207-/350/256/276/345/244/207/346/226/271/345/220/221.md" +0 -0
- /package/dist/template-starter/{.ai/reference/open-api/15- → references/reference/open-api/11-}/350/256/276/345/244/207-/351/231/200/350/236/272/344/273/252.md" +0 -0
- /package/dist/template-starter/{.ai/reference/open-api/17- → references/reference/open-api/13-}/350/256/276/345/244/207-/347/275/221/347/273/234.md" +0 -0
- /package/dist/template-starter/{.ai/reference/open-api/18- → references/reference/open-api/14-}/350/256/276/345/244/207-/347/237/255/344/277/241.md" +0 -0
- /package/dist/template-starter/{.ai/reference/open-api/19- → references/reference/open-api/15-}/350/256/276/345/244/207-/346/227/240/351/232/234/347/242/215.md" +0 -0
- /package/dist/template-starter/{.ai/reference/open-api/20- → references/reference/open-api/16-}/350/256/276/345/244/207-/347/224/265/346/261/240.md" +0 -0
- /package/dist/template-starter/{.ai/reference/open-api/21- → references/reference/open-api/17-}/350/256/276/345/244/207-/346/227/245/345/216/206.md" +0 -0
- /package/dist/template-starter/{.ai/reference/open-api/22- → references/reference/open-api/18-}/350/256/276/345/244/207-/345/211/252/350/264/264/346/235/277.md" +0 -0
- /package/dist/template-starter/{.ai/reference/open-api/23- → references/reference/open-api/19-}/350/256/276/345/244/207-/350/201/224/347/263/273/344/272/272.md" +0 -0
- /package/dist/template-starter/{.ai/reference/open-api/24- → references/reference/open-api/20-}/350/256/276/345/244/207-/345/212/240/345/257/206.md" +0 -0
- /package/dist/template-starter/{.ai/reference/open-api/25- → references/reference/open-api/21-}/350/256/276/345/244/207-/347/224/265/350/257/235.md" +0 -0
- /package/dist/template-starter/{.ai/reference/open-api/26- → references/reference/open-api/22-}/350/256/276/345/244/207-/346/211/253/347/240/201.md" +0 -0
- /package/dist/template-starter/{.ai/reference/open-api/27- → references/reference/open-api/23-}/350/256/276/345/244/207-/345/261/217/345/271/225.md" +0 -0
- /package/dist/template-starter/{.ai/reference/open-api/28- → references/reference/open-api/24-}/350/256/276/345/244/207-/351/234/207/345/212/250.md" +0 -0
- /package/dist/template-starter/{.ai → references}/rules/dos-and-donts.md +0 -0
|
@@ -0,0 +1,2943 @@
|
|
|
1
|
+
# Open API: 基础 / 账号 / 系统
|
|
2
|
+
|
|
3
|
+
账号、授权、宿主基础信息、窗口信息和定位。
|
|
4
|
+
|
|
5
|
+
[返回目录](./README.md) | [返回速查](../open-api.md)
|
|
6
|
+
|
|
7
|
+
## 速查
|
|
8
|
+
|
|
9
|
+
| API | 说明 |
|
|
10
|
+
| --- | --- |
|
|
11
|
+
| [getAccountInfo](#getaccountinfo) | 异步获取账号信息。 |
|
|
12
|
+
| [getAccountInfoSync](#getaccountinfosync) | 同步获取账号信息。<br><br>同步 API。 |
|
|
13
|
+
| [authorize](#authorize) | 初始化授权。<br><br>按 scope 申请授权。 |
|
|
14
|
+
| [canIUse](#caniuse) | 检测当前宿主是否支持指定 API 或能力。<br><br>用于兼容性判断。 |
|
|
15
|
+
| [getLocation](#getlocation) | 获取设备当前的地理位置信息。<br><br>可能涉及定位授权。 |
|
|
16
|
+
| [showModal](#showmodal) | 显示模态对话框。 |
|
|
17
|
+
| [showLoading](#showloading) | 显示 loading 提示框。<br><br>需调用 hideLoading 关闭。 |
|
|
18
|
+
| [hideToast](#hidetoast) | 隐藏当前 Toast。 |
|
|
19
|
+
| [hideLoading](#hideloading) | 隐藏当前 loading。 |
|
|
20
|
+
| [showActionSheet](#showactionsheet) | 显示操作菜单。 |
|
|
21
|
+
| [getMenuButtonBoundingClientRect](#getmenubuttonboundingclientrect) | 获取菜单按钮的布局位置信息。 |
|
|
22
|
+
| [enableAlertBeforeUnload](#enablealertbeforeunload) | 开启页面返回前提醒。<br><br>配合 disableAlertBeforeUnload 使用。 |
|
|
23
|
+
| [disableAlertBeforeUnload](#disablealertbeforeunload) | 关闭页面返回前提醒。 |
|
|
24
|
+
| [showToast](#showtoast) | 显示 Toast 提示。<br><br>duration 和 icon 可控制提示表现。 |
|
|
25
|
+
| [dispatchActionDirective](#dispatchactiondirective) | 描述用户行为,约束模型行为并指定后续执行路径。<br><br>适用于卡片交互后向模型补充结构化动作上下文,例如按钮点击、选项选择或表单提交。 |
|
|
26
|
+
| [expiredWidget](#expiredwidget) | 更新过期的 widget 为固定卡片。 |
|
|
27
|
+
| [loginWithDoubaoWidget](#loginwithdoubaowidget) | 发起豆包 Widget 登录。 |
|
|
28
|
+
| [login](#login) | 发起登录并获取登录凭证。 |
|
|
29
|
+
| [postLoginResult](#postloginresult) | 回传 MCP 授权登录凭证。 |
|
|
30
|
+
| [createSignOrder](#createsignorder) | 创建签约订单。 |
|
|
31
|
+
| [getOrderPaymentWithSign](#getorderpaymentwithsign) | 使用签名信息拉起收银台完成订单支付。 |
|
|
32
|
+
| [getOrderPayment](#getorderpayment) | 拉起收银台完成订单支付。 |
|
|
33
|
+
| [requestCombineOrder](#requestcombineorder) | 请求创建合单订单。 |
|
|
34
|
+
| [requestOrder](#requestorder) | 发起订单支付流程。 |
|
|
35
|
+
| [sign](#sign) | 拉起签约流程。 |
|
|
36
|
+
| [getPrivacySetting](#getprivacysetting) | 获取隐私设置状态。 |
|
|
37
|
+
| [sendQueryMessage](#sendquerymessage) | 以用户身份发送一条消息。<br><br>返回 void,不是 Promise。 |
|
|
38
|
+
| [setAdditionalContext](#setadditionalcontext) | 设置全局上下文供大模型理解。<br><br>设置全局上下文。 |
|
|
39
|
+
| [updateModelContext](#updatemodelcontext) | 向 Agent 捐赠上下文。 |
|
|
40
|
+
| [updateWidget](#updatewidget) | 更新指定卡片。 |
|
|
41
|
+
| [saveImageToPhotosAlbum](#saveimagetophotosalbum) | 保存图片到系统相册。 |
|
|
42
|
+
| [previewImage](#previewimage) | 预览图片。 |
|
|
43
|
+
| [getImageInfo](#getimageinfo) | 获取图片信息。 |
|
|
44
|
+
| [chooseImage](#chooseimage) | 选择图片。 |
|
|
45
|
+
| [compressImage](#compressimage) | 压缩图片。 |
|
|
46
|
+
| [request](#request) | 发起网络请求。<br><br>返回 statusCode、header 和 data。 |
|
|
47
|
+
| [openApp](#openapp) | 通过 deep link 等方式打开外部应用。 |
|
|
48
|
+
| [navigateTo](#navigateto) | 保留当前页面,跳转到应用内的某个页面。 |
|
|
49
|
+
| [redirectTo](#redirectto) | 关闭当前页面,跳转到应用内的某个页面。 |
|
|
50
|
+
| [reLaunch](#relaunch) | 关闭所有页面并跳转到应用内页面。 |
|
|
51
|
+
| [navigateBack](#navigateback) | 关闭当前页面,返回上一页面或多级页面。 |
|
|
52
|
+
| [exitApp](#exitapp) | 退出当前所有页面。<br><br>会退出当前所有页面。 |
|
|
53
|
+
| [setStorage](#setstorage) | 将数据写入本地缓存。 |
|
|
54
|
+
| [setStorageSync](#setstoragesync) | 将数据写入本地缓存。<br><br>同步 API。 |
|
|
55
|
+
| [getStorage](#getstorage) | 从本地缓存读取数据。 |
|
|
56
|
+
| [getStorageSync](#getstoragesync) | 从本地缓存同步读取数据。<br><br>同步 API。 |
|
|
57
|
+
| [removeStorage](#removestorage) | 删除本地缓存中指定 key 的数据。 |
|
|
58
|
+
| [removeStorageSync](#removestoragesync) | 删除本地缓存中指定 key 的数据。<br><br>同步 API。 |
|
|
59
|
+
| [clearStorage](#clearstorage) | 清空本地缓存。 |
|
|
60
|
+
| [clearStorageSync](#clearstoragesync) | 清空本地缓存。<br><br>同步 API。 |
|
|
61
|
+
| [getStorageInfo](#getstorageinfo) | 获取本地缓存信息。 |
|
|
62
|
+
| [getStorageInfoSync](#getstorageinfosync) | 同步获取本地缓存信息。<br><br>同步 API。 |
|
|
63
|
+
| [getWindowInfoSync](#getwindowinfosync) | 获取窗口信息。<br><br>同步 API。 |
|
|
64
|
+
| [getSystemSetting](#getsystemsetting) | 获取设备设置。 |
|
|
65
|
+
| [getAppBaseInfoSync](#getappbaseinfosync) | 获取应用基础信息。<br><br>同步 API。 |
|
|
66
|
+
| [getWindowInfo](#getwindowinfo) | 获取窗口信息。 |
|
|
67
|
+
| [getAppBaseInfo](#getappbaseinfo) | 获取应用基础信息。 |
|
|
68
|
+
|
|
69
|
+
## API 详情
|
|
70
|
+
|
|
71
|
+
<a id="getaccountinfo"></a>
|
|
72
|
+
### getAccountInfo()
|
|
73
|
+
|
|
74
|
+
> **getAccountInfo**(`params`?): `Promise`\<[`GetAccountInfoResult`](#getaccountinforesult)\>
|
|
75
|
+
|
|
76
|
+
异步获取账号信息。
|
|
77
|
+
|
|
78
|
+
#### Parameters
|
|
79
|
+
|
|
80
|
+
• **params?**
|
|
81
|
+
|
|
82
|
+
#### Returns
|
|
83
|
+
|
|
84
|
+
`Promise`\<[`GetAccountInfoResult`](#getaccountinforesult)\>
|
|
85
|
+
|
|
86
|
+
#### Example
|
|
87
|
+
|
|
88
|
+
```typescript
|
|
89
|
+
import { getAccountInfo } from '@doubao-apps/framework/api';
|
|
90
|
+
|
|
91
|
+
const result = await getAccountInfo();
|
|
92
|
+
console.log(result.miniProgram.appId);
|
|
93
|
+
```
|
|
94
|
+
|
|
95
|
+
<a id="getaccountinfosync"></a>
|
|
96
|
+
### getAccountInfoSync()
|
|
97
|
+
|
|
98
|
+
> **getAccountInfoSync**(`params`?): [`GetAccountInfoResult`](#getaccountinforesult)
|
|
99
|
+
|
|
100
|
+
同步获取账号信息。
|
|
101
|
+
|
|
102
|
+
#### Parameters
|
|
103
|
+
|
|
104
|
+
• **params?**
|
|
105
|
+
|
|
106
|
+
#### Returns
|
|
107
|
+
|
|
108
|
+
[`GetAccountInfoResult`](#getaccountinforesult)
|
|
109
|
+
|
|
110
|
+
#### Example
|
|
111
|
+
|
|
112
|
+
```typescript
|
|
113
|
+
import { getAccountInfoSync } from '@doubao-apps/framework/api';
|
|
114
|
+
|
|
115
|
+
const result = getAccountInfoSync();
|
|
116
|
+
console.log(result.miniProgram.appId, result.miniProgram.envVersion, result.miniProgram.version);
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
<a id="authorize"></a>
|
|
120
|
+
### authorize()
|
|
121
|
+
|
|
122
|
+
> **authorize**(`params`): `Promise`\<`object`\>
|
|
123
|
+
|
|
124
|
+
初始化授权
|
|
125
|
+
|
|
126
|
+
#### Parameters
|
|
127
|
+
|
|
128
|
+
• **params**: [`AuthorizeRequest`](#authorizerequest)
|
|
129
|
+
|
|
130
|
+
授权参数
|
|
131
|
+
|
|
132
|
+
#### Returns
|
|
133
|
+
|
|
134
|
+
`Promise`\<`object`\>
|
|
135
|
+
|
|
136
|
+
Promise 对象,授权成功时会返回授权结果
|
|
137
|
+
|
|
138
|
+
#### Remarks
|
|
139
|
+
|
|
140
|
+
按 scope 申请授权。
|
|
141
|
+
|
|
142
|
+
<a id="caniuse"></a>
|
|
143
|
+
### canIUse()
|
|
144
|
+
|
|
145
|
+
> **canIUse**(`params`): `Promise`\<[`CanIUseResult`](#caniuseresult)\>
|
|
146
|
+
|
|
147
|
+
检测当前宿主是否支持指定 API 或能力。
|
|
148
|
+
|
|
149
|
+
#### Parameters
|
|
150
|
+
|
|
151
|
+
• **params**: [`CanIUseParams`](#caniuseparams)
|
|
152
|
+
|
|
153
|
+
#### Returns
|
|
154
|
+
|
|
155
|
+
`Promise`\<[`CanIUseResult`](#caniuseresult)\>
|
|
156
|
+
|
|
157
|
+
#### Remarks
|
|
158
|
+
|
|
159
|
+
用于兼容性判断。
|
|
160
|
+
|
|
161
|
+
<a id="getlocation"></a>
|
|
162
|
+
### getLocation()
|
|
163
|
+
|
|
164
|
+
> **getLocation**(`params`?): `Promise`\<[`GetLocationResponse`](#getlocationresponse)\>
|
|
165
|
+
|
|
166
|
+
获取设备当前的地理位置信息。
|
|
167
|
+
|
|
168
|
+
#### Parameters
|
|
169
|
+
|
|
170
|
+
• **params?**: [`GetLocationParams`](#getlocationparams)
|
|
171
|
+
|
|
172
|
+
#### Returns
|
|
173
|
+
|
|
174
|
+
`Promise`\<[`GetLocationResponse`](#getlocationresponse)\>
|
|
175
|
+
|
|
176
|
+
返回一个 Promise,成功时解析为包含地理位置信息的对象,包含:
|
|
177
|
+
- `latitude`: number - 纬度。
|
|
178
|
+
- `longitude`: number - 经度。
|
|
179
|
+
- `timestamp`: string - 时间戳。
|
|
180
|
+
- `speed`: number - 行进速度,单位:米/秒。
|
|
181
|
+
- `accuracy`: number - 定位精度,单位:米。
|
|
182
|
+
参考 [GetLocationResponse](#getlocationresponse)。
|
|
183
|
+
|
|
184
|
+
#### Throws
|
|
185
|
+
|
|
186
|
+
如果调用失败(例如,用户拒绝权限、定位服务关闭等),则抛出此错误。
|
|
187
|
+
|
|
188
|
+
#### Remarks
|
|
189
|
+
|
|
190
|
+
可能涉及定位授权。
|
|
191
|
+
|
|
192
|
+
#### Example
|
|
193
|
+
|
|
194
|
+
```typescript
|
|
195
|
+
import { getLocation } from '@doubao-apps/framework';
|
|
196
|
+
|
|
197
|
+
async function fetchLocation() {
|
|
198
|
+
try {
|
|
199
|
+
const locationData = await getLocation();
|
|
200
|
+
console.log('纬度:', locationData.latitude);
|
|
201
|
+
console.log('经度:', locationData.longitude);
|
|
202
|
+
console.log('时间戳:', locationData.timestamp);
|
|
203
|
+
console.log('行进速度:', locationData.speed);
|
|
204
|
+
console.log('定位精度:', locationData.accuracy);
|
|
205
|
+
} catch (error) {
|
|
206
|
+
console.error('获取位置失败:', error);
|
|
207
|
+
// 处理错误,例如提示用户开启定位权限
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
fetchLocation();
|
|
212
|
+
```
|
|
213
|
+
|
|
214
|
+
<a id="showmodal"></a>
|
|
215
|
+
### showModal()
|
|
216
|
+
|
|
217
|
+
> **showModal**(`params`): `Promise`\<[`ShowModalResult`](#showmodalresult)\>
|
|
218
|
+
|
|
219
|
+
显示模态对话框。
|
|
220
|
+
|
|
221
|
+
#### Parameters
|
|
222
|
+
|
|
223
|
+
• **params**: [`ShowModalParams`](#showmodalparams)
|
|
224
|
+
|
|
225
|
+
#### Returns
|
|
226
|
+
|
|
227
|
+
`Promise`\<[`ShowModalResult`](#showmodalresult)\>
|
|
228
|
+
|
|
229
|
+
#### Example
|
|
230
|
+
|
|
231
|
+
```ts
|
|
232
|
+
import { showModal } from '@doubao-apps/framework/api';
|
|
233
|
+
|
|
234
|
+
const result = await showModal({
|
|
235
|
+
title: '提示',
|
|
236
|
+
content: '确认删除这条记录吗?',
|
|
237
|
+
confirmText: '删除',
|
|
238
|
+
cancelText: '取消'
|
|
239
|
+
});
|
|
240
|
+
|
|
241
|
+
if (result.action === 'confirm') {
|
|
242
|
+
console.log('用户确认删除');
|
|
243
|
+
}
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
<a id="showloading"></a>
|
|
247
|
+
### showLoading()
|
|
248
|
+
|
|
249
|
+
> **showLoading**(`params`?): `Promise`\<`object`\>
|
|
250
|
+
|
|
251
|
+
显示 loading 提示框。
|
|
252
|
+
|
|
253
|
+
#### Parameters
|
|
254
|
+
|
|
255
|
+
• **params?**: [`ShowLoadingParams`](#showloadingparams)
|
|
256
|
+
|
|
257
|
+
#### Returns
|
|
258
|
+
|
|
259
|
+
`Promise`\<`object`\>
|
|
260
|
+
|
|
261
|
+
#### Remarks
|
|
262
|
+
|
|
263
|
+
需调用 hideLoading 关闭。
|
|
264
|
+
|
|
265
|
+
<a id="hidetoast"></a>
|
|
266
|
+
### hideToast()
|
|
267
|
+
|
|
268
|
+
> **hideToast**(`params`?): `Promise`\<`object`\>
|
|
269
|
+
|
|
270
|
+
隐藏当前 Toast。
|
|
271
|
+
|
|
272
|
+
#### Parameters
|
|
273
|
+
|
|
274
|
+
• **params?**: [`HideInteractionParams`](#hideinteractionparams)
|
|
275
|
+
|
|
276
|
+
#### Returns
|
|
277
|
+
|
|
278
|
+
`Promise`\<`object`\>
|
|
279
|
+
|
|
280
|
+
<a id="hideloading"></a>
|
|
281
|
+
### hideLoading()
|
|
282
|
+
|
|
283
|
+
> **hideLoading**(`params`?): `Promise`\<`object`\>
|
|
284
|
+
|
|
285
|
+
隐藏当前 loading。
|
|
286
|
+
|
|
287
|
+
#### Parameters
|
|
288
|
+
|
|
289
|
+
• **params?**: [`HideInteractionParams`](#hideinteractionparams)
|
|
290
|
+
|
|
291
|
+
#### Returns
|
|
292
|
+
|
|
293
|
+
`Promise`\<`object`\>
|
|
294
|
+
|
|
295
|
+
<a id="showactionsheet"></a>
|
|
296
|
+
### showActionSheet()
|
|
297
|
+
|
|
298
|
+
> **showActionSheet**(`params`): `Promise`\<[`ShowActionSheetResult`](#showactionsheetresult)\>
|
|
299
|
+
|
|
300
|
+
显示操作菜单。
|
|
301
|
+
|
|
302
|
+
#### Parameters
|
|
303
|
+
|
|
304
|
+
• **params**: [`ShowActionSheetParams`](#showactionsheetparams)
|
|
305
|
+
|
|
306
|
+
#### Returns
|
|
307
|
+
|
|
308
|
+
`Promise`\<[`ShowActionSheetResult`](#showactionsheetresult)\>
|
|
309
|
+
|
|
310
|
+
#### Example
|
|
311
|
+
|
|
312
|
+
```ts
|
|
313
|
+
import { showActionSheet } from '@doubao-apps/framework/api';
|
|
314
|
+
|
|
315
|
+
const result = await showActionSheet({
|
|
316
|
+
itemList: ['编辑', '删除']
|
|
317
|
+
});
|
|
318
|
+
|
|
319
|
+
console.log(result.tapIndex);
|
|
320
|
+
```
|
|
321
|
+
|
|
322
|
+
<a id="getmenubuttonboundingclientrect"></a>
|
|
323
|
+
### getMenuButtonBoundingClientRect()
|
|
324
|
+
|
|
325
|
+
> **getMenuButtonBoundingClientRect**(`params`?): [`MenuButtonBoundingClientRect`](#menubuttonboundingclientrect)
|
|
326
|
+
|
|
327
|
+
获取菜单按钮的布局位置信息。
|
|
328
|
+
|
|
329
|
+
#### Parameters
|
|
330
|
+
|
|
331
|
+
• **params?**
|
|
332
|
+
|
|
333
|
+
#### Returns
|
|
334
|
+
|
|
335
|
+
[`MenuButtonBoundingClientRect`](#menubuttonboundingclientrect)
|
|
336
|
+
|
|
337
|
+
返回菜单按钮相对屏幕左上角的坐标和尺寸,字段见 [MenuButtonBoundingClientRect](#menubuttonboundingclientrect)。
|
|
338
|
+
|
|
339
|
+
#### Example
|
|
340
|
+
|
|
341
|
+
```ts
|
|
342
|
+
import { getMenuButtonBoundingClientRect } from '@doubao-apps/framework/api';
|
|
343
|
+
|
|
344
|
+
const rect = getMenuButtonBoundingClientRect();
|
|
345
|
+
|
|
346
|
+
console.log(rect.width, rect.height);
|
|
347
|
+
console.log(rect.top, rect.right, rect.bottom, rect.left);
|
|
348
|
+
```
|
|
349
|
+
|
|
350
|
+
<a id="enablealertbeforeunload"></a>
|
|
351
|
+
### enableAlertBeforeUnload()
|
|
352
|
+
|
|
353
|
+
> **enableAlertBeforeUnload**(`params`): `Promise`\<`object`\>
|
|
354
|
+
|
|
355
|
+
开启页面返回前提醒。
|
|
356
|
+
当用户在小程序非最底层页面点击左上角返回按钮、左上角首页按钮或 Android 系统 back 键时,弹起询问弹窗
|
|
357
|
+
|
|
358
|
+
返回询问对话框只会对调用的当前页面生效,通过手势滑动返回时不会弹起询问对话框
|
|
359
|
+
|
|
360
|
+
#### Parameters
|
|
361
|
+
|
|
362
|
+
• **params**: [`EnableAlertBeforeUnloadParams`](#enablealertbeforeunloadparams)
|
|
363
|
+
|
|
364
|
+
#### Returns
|
|
365
|
+
|
|
366
|
+
`Promise`\<`object`\>
|
|
367
|
+
|
|
368
|
+
#### Remarks
|
|
369
|
+
|
|
370
|
+
配合 disableAlertBeforeUnload 使用。
|
|
371
|
+
|
|
372
|
+
<a id="disablealertbeforeunload"></a>
|
|
373
|
+
### disableAlertBeforeUnload()
|
|
374
|
+
|
|
375
|
+
> **disableAlertBeforeUnload**(`params`?): `Promise`\<`object`\>
|
|
376
|
+
|
|
377
|
+
关闭页面返回前提醒。
|
|
378
|
+
|
|
379
|
+
#### Parameters
|
|
380
|
+
|
|
381
|
+
• **params?**: `Record`\<`string`, `never`\>
|
|
382
|
+
|
|
383
|
+
#### Returns
|
|
384
|
+
|
|
385
|
+
`Promise`\<`object`\>
|
|
386
|
+
|
|
387
|
+
<a id="showtoast"></a>
|
|
388
|
+
### showToast()
|
|
389
|
+
|
|
390
|
+
> **showToast**(`params`): `Promise`\<`object`\>
|
|
391
|
+
|
|
392
|
+
显示 Toast 提示。
|
|
393
|
+
|
|
394
|
+
参数 `options` 包含以下字段:
|
|
395
|
+
- `message`: 提示的内容。
|
|
396
|
+
- `type`: Toast 的类型,可选值为 'success' 或 'error'。
|
|
397
|
+
- `duration`: 提示的延迟时间,单位毫秒,默认为 2000。
|
|
398
|
+
- `icon`: 图标,可选值为 'success', 'error', 'warn'。
|
|
399
|
+
- `customIcon`: 自定义图标的 URL 或 base64 字符串。
|
|
400
|
+
|
|
401
|
+
#### Parameters
|
|
402
|
+
|
|
403
|
+
• **params**: [`ShowToastParams`](#showtoastparams)
|
|
404
|
+
|
|
405
|
+
#### Returns
|
|
406
|
+
|
|
407
|
+
`Promise`\<`object`\>
|
|
408
|
+
|
|
409
|
+
返回一个 Promise,在 Toast 显示结束时 resolve。
|
|
410
|
+
|
|
411
|
+
#### Remarks
|
|
412
|
+
|
|
413
|
+
duration 和 icon 可控制提示表现。
|
|
414
|
+
|
|
415
|
+
#### Example
|
|
416
|
+
|
|
417
|
+
```typescript
|
|
418
|
+
import { showToast } from '@doubao-apps/framework';
|
|
419
|
+
|
|
420
|
+
// 显示一个成功的 Toast
|
|
421
|
+
showToast({
|
|
422
|
+
message: '操作成功',
|
|
423
|
+
type: 'success',
|
|
424
|
+
icon: 'success',
|
|
425
|
+
duration: 1500
|
|
426
|
+
}).then(() => {
|
|
427
|
+
console.log('Toast 显示完毕');
|
|
428
|
+
});
|
|
429
|
+
|
|
430
|
+
// 显示一个错误的 Toast
|
|
431
|
+
showToast({
|
|
432
|
+
message: '网络错误',
|
|
433
|
+
type: 'error',
|
|
434
|
+
icon: 'error'
|
|
435
|
+
});
|
|
436
|
+
```
|
|
437
|
+
|
|
438
|
+
<a id="dispatchactiondirective"></a>
|
|
439
|
+
### dispatchActionDirective()
|
|
440
|
+
|
|
441
|
+
> **dispatchActionDirective**(`params`): `Promise`\<`object`\>
|
|
442
|
+
|
|
443
|
+
描述用户行为,约束模型行为并指定后续执行路径。
|
|
444
|
+
|
|
445
|
+
#### Parameters
|
|
446
|
+
|
|
447
|
+
• **params**: [`DispatchActionDirectiveParams`](#dispatchactiondirectiveparams)
|
|
448
|
+
|
|
449
|
+
动作描述、预期行为及工具调用约束参数。
|
|
450
|
+
|
|
451
|
+
#### Returns
|
|
452
|
+
|
|
453
|
+
`Promise`\<`object`\>
|
|
454
|
+
|
|
455
|
+
返回一个 Promise,在动作指令成功下发时解析。
|
|
456
|
+
|
|
457
|
+
#### Remarks
|
|
458
|
+
|
|
459
|
+
适用于卡片交互后向模型补充结构化动作上下文,例如按钮点击、选项选择或表单提交。
|
|
460
|
+
|
|
461
|
+
<a id="expiredwidget"></a>
|
|
462
|
+
### expiredWidget()
|
|
463
|
+
|
|
464
|
+
> **expiredWidget**(`__namedParameters`): `Promise`\<`object`\>
|
|
465
|
+
|
|
466
|
+
更新过期的 widget 为固定卡片
|
|
467
|
+
|
|
468
|
+
#### Parameters
|
|
469
|
+
|
|
470
|
+
• **\_\_namedParameters**: [`ExpiredWidgetParams`](#expiredwidgetparams)
|
|
471
|
+
|
|
472
|
+
#### Returns
|
|
473
|
+
|
|
474
|
+
`Promise`\<`object`\>
|
|
475
|
+
|
|
476
|
+
#### Description
|
|
477
|
+
|
|
478
|
+
用于将状态已经过期的 widget 实例转换为固定的卡片
|
|
479
|
+
|
|
480
|
+
#### Example
|
|
481
|
+
|
|
482
|
+
```ts
|
|
483
|
+
expiredWidget({
|
|
484
|
+
widgetInstanceId: 'instance_123',
|
|
485
|
+
schema: '${pageId}?key=value'
|
|
486
|
+
});
|
|
487
|
+
```
|
|
488
|
+
|
|
489
|
+
<a id="loginwithdoubaowidget"></a>
|
|
490
|
+
### loginWithDoubaoWidget()
|
|
491
|
+
|
|
492
|
+
> **loginWithDoubaoWidget**(`params`): `Promise`\<[`LoginWithWidgetResult`](#loginwithwidgetresult)\>
|
|
493
|
+
|
|
494
|
+
发起豆包 Widget 登录。
|
|
495
|
+
|
|
496
|
+
#### Parameters
|
|
497
|
+
|
|
498
|
+
• **params**: [`LoginWithWidgetRequest`](#loginwithwidgetrequest)
|
|
499
|
+
|
|
500
|
+
Widget 登录参数。
|
|
501
|
+
|
|
502
|
+
#### Returns
|
|
503
|
+
|
|
504
|
+
`Promise`\<[`LoginWithWidgetResult`](#loginwithwidgetresult)\>
|
|
505
|
+
|
|
506
|
+
返回登录结果。
|
|
507
|
+
|
|
508
|
+
<a id="login"></a>
|
|
509
|
+
### login()
|
|
510
|
+
|
|
511
|
+
> **login**(`params`?): `Promise`\<[`LoginResult`](#loginresult)\>
|
|
512
|
+
|
|
513
|
+
发起登录并获取登录凭证。
|
|
514
|
+
|
|
515
|
+
#### Parameters
|
|
516
|
+
|
|
517
|
+
• **params?**: [`LoginRequest`](#loginrequest)
|
|
518
|
+
|
|
519
|
+
登录参数。
|
|
520
|
+
|
|
521
|
+
#### Returns
|
|
522
|
+
|
|
523
|
+
`Promise`\<[`LoginResult`](#loginresult)\>
|
|
524
|
+
|
|
525
|
+
返回包含登录凭证 code 的 Promise。
|
|
526
|
+
|
|
527
|
+
<a id="postloginresult"></a>
|
|
528
|
+
### postLoginResult()
|
|
529
|
+
|
|
530
|
+
> **postLoginResult**(`params`): `Promise`\<`object`\>
|
|
531
|
+
|
|
532
|
+
回传 MCP 授权登录凭证。
|
|
533
|
+
|
|
534
|
+
#### Parameters
|
|
535
|
+
|
|
536
|
+
• **params**: [`PostLoginResultRequest`](#postloginresultrequest)
|
|
537
|
+
|
|
538
|
+
登录结果回传参数。
|
|
539
|
+
|
|
540
|
+
#### Returns
|
|
541
|
+
|
|
542
|
+
`Promise`\<`object`\>
|
|
543
|
+
|
|
544
|
+
返回回传完成的 Promise。
|
|
545
|
+
|
|
546
|
+
<a id="createsignorder"></a>
|
|
547
|
+
### createSignOrder()
|
|
548
|
+
|
|
549
|
+
> **createSignOrder**(`params`): `Promise`\<[`CreateSignOrderResult`](#createsignorderresult)\>
|
|
550
|
+
|
|
551
|
+
创建签约订单。
|
|
552
|
+
|
|
553
|
+
#### Parameters
|
|
554
|
+
|
|
555
|
+
• **params**: [`CreateSignOrderParams`](#createsignorderparams)
|
|
556
|
+
|
|
557
|
+
签约订单参数
|
|
558
|
+
|
|
559
|
+
#### Returns
|
|
560
|
+
|
|
561
|
+
`Promise`\<[`CreateSignOrderResult`](#createsignorderresult)\>
|
|
562
|
+
|
|
563
|
+
返回一个 Promise,解析为签约订单结果。
|
|
564
|
+
|
|
565
|
+
<a id="getorderpaymentwithsign"></a>
|
|
566
|
+
### getOrderPaymentWithSign()
|
|
567
|
+
|
|
568
|
+
> **getOrderPaymentWithSign**(`params`): `Promise`\<[`GetOrderPaymentResult`](#getorderpaymentresult)\>
|
|
569
|
+
|
|
570
|
+
使用签名信息拉起收银台完成订单支付。
|
|
571
|
+
|
|
572
|
+
#### Parameters
|
|
573
|
+
|
|
574
|
+
• **params**: [`GetOrderPaymentWithSignParams`](#getorderpaymentwithsignparams)
|
|
575
|
+
|
|
576
|
+
签名支付参数
|
|
577
|
+
|
|
578
|
+
#### Returns
|
|
579
|
+
|
|
580
|
+
`Promise`\<[`GetOrderPaymentResult`](#getorderpaymentresult)\>
|
|
581
|
+
|
|
582
|
+
返回一个 Promise,成功时解析为订单支付结果。
|
|
583
|
+
|
|
584
|
+
<a id="getorderpayment"></a>
|
|
585
|
+
### getOrderPayment()
|
|
586
|
+
|
|
587
|
+
> **getOrderPayment**(`params`): `Promise`\<[`GetOrderPaymentResult`](#getorderpaymentresult)\>
|
|
588
|
+
|
|
589
|
+
拉起收银台完成订单支付。
|
|
590
|
+
|
|
591
|
+
#### Parameters
|
|
592
|
+
|
|
593
|
+
• **params**: [`GetOrderPaymentParams`](#getorderpaymentparams)
|
|
594
|
+
|
|
595
|
+
支付参数
|
|
596
|
+
|
|
597
|
+
#### Returns
|
|
598
|
+
|
|
599
|
+
`Promise`\<[`GetOrderPaymentResult`](#getorderpaymentresult)\>
|
|
600
|
+
|
|
601
|
+
返回一个 Promise,成功时解析为订单支付结果。
|
|
602
|
+
|
|
603
|
+
<a id="requestcombineorder"></a>
|
|
604
|
+
### requestCombineOrder()
|
|
605
|
+
|
|
606
|
+
> **requestCombineOrder**(`params`): `Promise`\<[`RequestCombineOrderResult`](#requestcombineorderresult)\>
|
|
607
|
+
|
|
608
|
+
请求创建合单订单。
|
|
609
|
+
|
|
610
|
+
#### Parameters
|
|
611
|
+
|
|
612
|
+
• **params**: [`RequestCombineOrderParams`](#requestcombineorderparams)
|
|
613
|
+
|
|
614
|
+
合单订单参数
|
|
615
|
+
|
|
616
|
+
#### Returns
|
|
617
|
+
|
|
618
|
+
`Promise`\<[`RequestCombineOrderResult`](#requestcombineorderresult)\>
|
|
619
|
+
|
|
620
|
+
返回一个 Promise,解析为合单订单结果。
|
|
621
|
+
|
|
622
|
+
<a id="requestorder"></a>
|
|
623
|
+
### requestOrder()
|
|
624
|
+
|
|
625
|
+
> **requestOrder**(`params`): `Promise`\<[`RequestOrderResult`](#requestorderresult)\>
|
|
626
|
+
|
|
627
|
+
发起订单支付流程。
|
|
628
|
+
|
|
629
|
+
#### Parameters
|
|
630
|
+
|
|
631
|
+
• **params**: [`RequestOrderParams`](#requestorderparams)
|
|
632
|
+
|
|
633
|
+
订单支付请求参数。
|
|
634
|
+
|
|
635
|
+
#### Returns
|
|
636
|
+
|
|
637
|
+
`Promise`\<[`RequestOrderResult`](#requestorderresult)\>
|
|
638
|
+
|
|
639
|
+
返回订单支付请求结果。
|
|
640
|
+
|
|
641
|
+
<a id="sign"></a>
|
|
642
|
+
### sign()
|
|
643
|
+
|
|
644
|
+
> **sign**(`params`): `Promise`\<[`SignResult`](#signresult)\>
|
|
645
|
+
|
|
646
|
+
拉起签约流程。
|
|
647
|
+
|
|
648
|
+
#### Parameters
|
|
649
|
+
|
|
650
|
+
• **params**: [`SignParams`](#signparams)
|
|
651
|
+
|
|
652
|
+
签约参数
|
|
653
|
+
|
|
654
|
+
#### Returns
|
|
655
|
+
|
|
656
|
+
`Promise`\<[`SignResult`](#signresult)\>
|
|
657
|
+
|
|
658
|
+
返回一个 Promise,解析为签约结果。
|
|
659
|
+
|
|
660
|
+
<a id="getprivacysetting"></a>
|
|
661
|
+
### getPrivacySetting()
|
|
662
|
+
|
|
663
|
+
> **getPrivacySetting**(`params`?): `Promise`\<[`PrivacySettingResult`](#privacysettingresult)\>
|
|
664
|
+
|
|
665
|
+
获取隐私设置状态。
|
|
666
|
+
|
|
667
|
+
#### Parameters
|
|
668
|
+
|
|
669
|
+
• **params?**
|
|
670
|
+
|
|
671
|
+
#### Returns
|
|
672
|
+
|
|
673
|
+
`Promise`\<[`PrivacySettingResult`](#privacysettingresult)\>
|
|
674
|
+
|
|
675
|
+
返回隐私设置状态。
|
|
676
|
+
|
|
677
|
+
<a id="sendquerymessage"></a>
|
|
678
|
+
### sendQueryMessage()
|
|
679
|
+
|
|
680
|
+
> **sendQueryMessage**(`params`): `void`
|
|
681
|
+
|
|
682
|
+
以用户身份发送一条消息
|
|
683
|
+
|
|
684
|
+
由于会自动获取页面上下文来确定向哪个 bot 发送消息,因此只能在卡片或页面中调用
|
|
685
|
+
|
|
686
|
+
#### Parameters
|
|
687
|
+
|
|
688
|
+
• **params**: [`SendQueryMessageParams`](#sendquerymessageparams)
|
|
689
|
+
|
|
690
|
+
#### Returns
|
|
691
|
+
|
|
692
|
+
`void`
|
|
693
|
+
|
|
694
|
+
#### Example
|
|
695
|
+
|
|
696
|
+
```ts
|
|
697
|
+
await sendQueryMessage({ content: '订阅消息', type: 'text' })
|
|
698
|
+
```
|
|
699
|
+
|
|
700
|
+
<a id="setadditionalcontext"></a>
|
|
701
|
+
### setAdditionalContext()
|
|
702
|
+
|
|
703
|
+
> **setAdditionalContext**(`params`): `Promise`\<`object`\>
|
|
704
|
+
|
|
705
|
+
设置全局上下文供大模型理解
|
|
706
|
+
|
|
707
|
+
#### Parameters
|
|
708
|
+
|
|
709
|
+
• **params**: [`SetAdditionalContextParams`](#setadditionalcontextparams)
|
|
710
|
+
|
|
711
|
+
#### Returns
|
|
712
|
+
|
|
713
|
+
`Promise`\<`object`\>
|
|
714
|
+
|
|
715
|
+
#### Remarks
|
|
716
|
+
|
|
717
|
+
设置全局上下文。
|
|
718
|
+
|
|
719
|
+
<a id="updatemodelcontext"></a>
|
|
720
|
+
### updateModelContext()
|
|
721
|
+
|
|
722
|
+
> **updateModelContext**(`params`): `Promise`\<`object`\>
|
|
723
|
+
|
|
724
|
+
向 Agent 捐赠上下文
|
|
725
|
+
|
|
726
|
+
#### Parameters
|
|
727
|
+
|
|
728
|
+
• **params**: [`UpdateModelContextParams`](#updatemodelcontextparams)
|
|
729
|
+
|
|
730
|
+
#### Returns
|
|
731
|
+
|
|
732
|
+
`Promise`\<`object`\>
|
|
733
|
+
|
|
734
|
+
<a id="updatewidget"></a>
|
|
735
|
+
### updateWidget()
|
|
736
|
+
|
|
737
|
+
> **updateWidget**(`params`): `Promise`\<`object`\>
|
|
738
|
+
|
|
739
|
+
更新指定卡片
|
|
740
|
+
|
|
741
|
+
#### Parameters
|
|
742
|
+
|
|
743
|
+
• **params**: [`UpdateWidgetParams`](#updatewidgetparams)
|
|
744
|
+
|
|
745
|
+
#### Returns
|
|
746
|
+
|
|
747
|
+
`Promise`\<`object`\>
|
|
748
|
+
|
|
749
|
+
<a id="saveimagetophotosalbum"></a>
|
|
750
|
+
### saveImageToPhotosAlbum()
|
|
751
|
+
|
|
752
|
+
> **saveImageToPhotosAlbum**(`params`): `Promise`\<`object`\>
|
|
753
|
+
|
|
754
|
+
保存图片到系统相册。
|
|
755
|
+
|
|
756
|
+
需要先确保应用已具备写入系统相册的权限。
|
|
757
|
+
|
|
758
|
+
#### Parameters
|
|
759
|
+
|
|
760
|
+
• **params**: [`SaveImageToPhotosAlbumParams`](#saveimagetophotosalbumparams)
|
|
761
|
+
|
|
762
|
+
#### Returns
|
|
763
|
+
|
|
764
|
+
`Promise`\<`object`\>
|
|
765
|
+
|
|
766
|
+
#### Example
|
|
767
|
+
|
|
768
|
+
```typescript
|
|
769
|
+
import { saveImageToPhotosAlbum } from '@doubao-apps/framework/api';
|
|
770
|
+
|
|
771
|
+
await saveImageToPhotosAlbum({
|
|
772
|
+
filePath: '/path/to/image.png'
|
|
773
|
+
});
|
|
774
|
+
```
|
|
775
|
+
|
|
776
|
+
<a id="previewimage"></a>
|
|
777
|
+
### previewImage()
|
|
778
|
+
|
|
779
|
+
> **previewImage**(`params`): `Promise`\<`object`\>
|
|
780
|
+
|
|
781
|
+
预览图片。
|
|
782
|
+
|
|
783
|
+
#### Parameters
|
|
784
|
+
|
|
785
|
+
• **params**: [`PreviewImageParams`](#previewimageparams)
|
|
786
|
+
|
|
787
|
+
#### Returns
|
|
788
|
+
|
|
789
|
+
`Promise`\<`object`\>
|
|
790
|
+
|
|
791
|
+
<a id="getimageinfo"></a>
|
|
792
|
+
### getImageInfo()
|
|
793
|
+
|
|
794
|
+
> **getImageInfo**(`params`): `Promise`\<[`GetImageInfoResult`](#getimageinforesult)\>
|
|
795
|
+
|
|
796
|
+
获取图片信息。
|
|
797
|
+
|
|
798
|
+
#### Parameters
|
|
799
|
+
|
|
800
|
+
• **params**: [`GetImageInfoParams`](#getimageinfoparams)
|
|
801
|
+
|
|
802
|
+
#### Returns
|
|
803
|
+
|
|
804
|
+
`Promise`\<[`GetImageInfoResult`](#getimageinforesult)\>
|
|
805
|
+
|
|
806
|
+
<a id="chooseimage"></a>
|
|
807
|
+
### chooseImage()
|
|
808
|
+
|
|
809
|
+
> **chooseImage**(`params`?): `Promise`\<[`ChooseImageResult`](#chooseimageresult)\>
|
|
810
|
+
|
|
811
|
+
选择图片。
|
|
812
|
+
|
|
813
|
+
#### Parameters
|
|
814
|
+
|
|
815
|
+
• **params?**: [`ChooseImageParams`](#chooseimageparams)
|
|
816
|
+
|
|
817
|
+
#### Returns
|
|
818
|
+
|
|
819
|
+
`Promise`\<[`ChooseImageResult`](#chooseimageresult)\>
|
|
820
|
+
|
|
821
|
+
<a id="compressimage"></a>
|
|
822
|
+
### compressImage()
|
|
823
|
+
|
|
824
|
+
> **compressImage**(`params`): `Promise`\<[`CompressImageResult`](#compressimageresult)\>
|
|
825
|
+
|
|
826
|
+
压缩图片。
|
|
827
|
+
|
|
828
|
+
#### Parameters
|
|
829
|
+
|
|
830
|
+
• **params**: [`CompressImageParams`](#compressimageparams)
|
|
831
|
+
|
|
832
|
+
#### Returns
|
|
833
|
+
|
|
834
|
+
`Promise`\<[`CompressImageResult`](#compressimageresult)\>
|
|
835
|
+
|
|
836
|
+
<a id="request"></a>
|
|
837
|
+
### request()
|
|
838
|
+
|
|
839
|
+
> **request**(`params`): `Promise`\<[`RequestResponse`](#requestresponse)\>
|
|
840
|
+
|
|
841
|
+
发起网络请求。
|
|
842
|
+
|
|
843
|
+
#### Parameters
|
|
844
|
+
|
|
845
|
+
• **params**: [`RequestParams`](#requestparams)
|
|
846
|
+
|
|
847
|
+
请求参数,字段见 [RequestParams](#requestparams)。
|
|
848
|
+
|
|
849
|
+
#### Returns
|
|
850
|
+
|
|
851
|
+
`Promise`\<[`RequestResponse`](#requestresponse)\>
|
|
852
|
+
|
|
853
|
+
返回一个 Promise,解析为 [RequestResponse](#requestresponse)。
|
|
854
|
+
|
|
855
|
+
#### Remarks
|
|
856
|
+
|
|
857
|
+
返回 statusCode、header 和 data。
|
|
858
|
+
|
|
859
|
+
#### Example
|
|
860
|
+
|
|
861
|
+
```typescript
|
|
862
|
+
import { request } from '@doubao-apps/framework/api';
|
|
863
|
+
|
|
864
|
+
const result = await request({
|
|
865
|
+
url: 'https://postman-echo.com/post',
|
|
866
|
+
method: 'POST',
|
|
867
|
+
dataType: 'json',
|
|
868
|
+
header: { 'content-type': 'application/json' },
|
|
869
|
+
data: { hello: 'world' }
|
|
870
|
+
});
|
|
871
|
+
|
|
872
|
+
console.log(result.statusCode, result.data);
|
|
873
|
+
```
|
|
874
|
+
|
|
875
|
+
<a id="openapp"></a>
|
|
876
|
+
### openApp()
|
|
877
|
+
|
|
878
|
+
> **openApp**(`params`): `Promise`\<[`OpenAppResult`](#openappresult)\>
|
|
879
|
+
|
|
880
|
+
通过 deep link 等方式打开外部应用。
|
|
881
|
+
|
|
882
|
+
#### Parameters
|
|
883
|
+
|
|
884
|
+
• **params**: [`OpenAppRequest`](#openapprequest)
|
|
885
|
+
|
|
886
|
+
外部应用打开参数。
|
|
887
|
+
|
|
888
|
+
#### Returns
|
|
889
|
+
|
|
890
|
+
`Promise`\<[`OpenAppResult`](#openappresult)\>
|
|
891
|
+
|
|
892
|
+
返回外部应用打开结果。
|
|
893
|
+
|
|
894
|
+
<a id="navigateto"></a>
|
|
895
|
+
### navigateTo()
|
|
896
|
+
|
|
897
|
+
> **navigateTo**(`params`): `Promise`\<`object`\>
|
|
898
|
+
|
|
899
|
+
保留当前页面,跳转到应用内的某个页面。
|
|
900
|
+
|
|
901
|
+
#### Parameters
|
|
902
|
+
|
|
903
|
+
• **params**: [`NavigateToParams`](#navigatetoparams)
|
|
904
|
+
|
|
905
|
+
#### Returns
|
|
906
|
+
|
|
907
|
+
`Promise`\<`object`\>
|
|
908
|
+
|
|
909
|
+
<a id="redirectto"></a>
|
|
910
|
+
### redirectTo()
|
|
911
|
+
|
|
912
|
+
> **redirectTo**(`params`): `Promise`\<`object`\>
|
|
913
|
+
|
|
914
|
+
关闭当前页面,跳转到应用内的某个页面。
|
|
915
|
+
|
|
916
|
+
#### Parameters
|
|
917
|
+
|
|
918
|
+
• **params**: [`NavigateToParams`](#navigatetoparams)
|
|
919
|
+
|
|
920
|
+
#### Returns
|
|
921
|
+
|
|
922
|
+
`Promise`\<`object`\>
|
|
923
|
+
|
|
924
|
+
<a id="relaunch"></a>
|
|
925
|
+
### reLaunch()
|
|
926
|
+
|
|
927
|
+
> **reLaunch**(`params`): `Promise`\<`object`\>
|
|
928
|
+
|
|
929
|
+
关闭所有页面并跳转到应用内页面。
|
|
930
|
+
|
|
931
|
+
#### Parameters
|
|
932
|
+
|
|
933
|
+
• **params**: [`NavigateToParams`](#navigatetoparams)
|
|
934
|
+
|
|
935
|
+
#### Returns
|
|
936
|
+
|
|
937
|
+
`Promise`\<`object`\>
|
|
938
|
+
|
|
939
|
+
<a id="navigateback"></a>
|
|
940
|
+
### navigateBack()
|
|
941
|
+
|
|
942
|
+
> **navigateBack**(`params`?): `Promise`\<`object`\>
|
|
943
|
+
|
|
944
|
+
关闭当前页面,返回上一页面或多级页面。
|
|
945
|
+
|
|
946
|
+
#### Parameters
|
|
947
|
+
|
|
948
|
+
• **params?**: [`NavigateBackParams`](#navigatebackparams)
|
|
949
|
+
|
|
950
|
+
#### Returns
|
|
951
|
+
|
|
952
|
+
`Promise`\<`object`\>
|
|
953
|
+
|
|
954
|
+
<a id="exitapp"></a>
|
|
955
|
+
### exitApp()
|
|
956
|
+
|
|
957
|
+
> **exitApp**(): `Promise`\<`object`\>
|
|
958
|
+
|
|
959
|
+
退出当前所有页面。
|
|
960
|
+
|
|
961
|
+
#### Returns
|
|
962
|
+
|
|
963
|
+
`Promise`\<`object`\>
|
|
964
|
+
|
|
965
|
+
#### Remarks
|
|
966
|
+
|
|
967
|
+
会退出当前所有页面。
|
|
968
|
+
|
|
969
|
+
<a id="setstorage"></a>
|
|
970
|
+
### setStorage()
|
|
971
|
+
|
|
972
|
+
> **setStorage**\<`TData`\>(`params`): `Promise`\<`object`\>
|
|
973
|
+
|
|
974
|
+
将数据写入本地缓存。
|
|
975
|
+
|
|
976
|
+
#### Type parameters
|
|
977
|
+
|
|
978
|
+
• **TData** = `unknown`
|
|
979
|
+
|
|
980
|
+
#### Parameters
|
|
981
|
+
|
|
982
|
+
• **params**: [`SetStorageParams`](#setstorageparamstdata)\<`TData`\>
|
|
983
|
+
|
|
984
|
+
存储参数,字段见 [SetStorageParams](#setstorageparamstdata)。
|
|
985
|
+
|
|
986
|
+
#### Returns
|
|
987
|
+
|
|
988
|
+
`Promise`\<`object`\>
|
|
989
|
+
|
|
990
|
+
返回一个 Promise,写入完成后 resolve。
|
|
991
|
+
|
|
992
|
+
#### Remarks
|
|
993
|
+
|
|
994
|
+
#### Example
|
|
995
|
+
|
|
996
|
+
```typescript
|
|
997
|
+
import { setStorage } from '@doubao-apps/framework/api';
|
|
998
|
+
|
|
999
|
+
await setStorage({
|
|
1000
|
+
key: 'profile',
|
|
1001
|
+
data: { name: 'Tom', age: 18 },
|
|
1002
|
+
});
|
|
1003
|
+
```
|
|
1004
|
+
|
|
1005
|
+
<a id="setstoragesync"></a>
|
|
1006
|
+
### setStorageSync()
|
|
1007
|
+
|
|
1008
|
+
> **setStorageSync**\<`TData`\>(`params`): `object`
|
|
1009
|
+
|
|
1010
|
+
将数据写入本地缓存。
|
|
1011
|
+
|
|
1012
|
+
#### Type parameters
|
|
1013
|
+
|
|
1014
|
+
• **TData** = `unknown`
|
|
1015
|
+
|
|
1016
|
+
#### Parameters
|
|
1017
|
+
|
|
1018
|
+
• **params**: [`SetStorageParams`](#setstorageparamstdata)\<`TData`\>
|
|
1019
|
+
|
|
1020
|
+
存储参数,字段见 [SetStorageParams](#setstorageparamstdata)。
|
|
1021
|
+
|
|
1022
|
+
#### Returns
|
|
1023
|
+
|
|
1024
|
+
`object`
|
|
1025
|
+
|
|
1026
|
+
同步写入完成后返回。
|
|
1027
|
+
|
|
1028
|
+
#### Remarks
|
|
1029
|
+
|
|
1030
|
+
#### Example
|
|
1031
|
+
|
|
1032
|
+
```typescript
|
|
1033
|
+
import { setStorageSync } from '@doubao-apps/framework/api';
|
|
1034
|
+
|
|
1035
|
+
setStorageSync({
|
|
1036
|
+
key: 'profile',
|
|
1037
|
+
data: { name: 'Tom', age: 18 },
|
|
1038
|
+
});
|
|
1039
|
+
```
|
|
1040
|
+
|
|
1041
|
+
<a id="getstorage"></a>
|
|
1042
|
+
### getStorage()
|
|
1043
|
+
|
|
1044
|
+
> **getStorage**\<`TData`\>(`params`): `Promise`\<[`GetStorageResult`](#getstorageresulttdata)\<`TData`\>\>
|
|
1045
|
+
|
|
1046
|
+
从本地缓存读取数据。
|
|
1047
|
+
|
|
1048
|
+
#### Type parameters
|
|
1049
|
+
|
|
1050
|
+
• **TData** = `unknown`
|
|
1051
|
+
|
|
1052
|
+
#### Parameters
|
|
1053
|
+
|
|
1054
|
+
• **params**: [`GetStorageParams`](#getstorageparams)
|
|
1055
|
+
|
|
1056
|
+
查询参数,字段见 [GetStorageParams](#getstorageparams)。
|
|
1057
|
+
|
|
1058
|
+
#### Returns
|
|
1059
|
+
|
|
1060
|
+
`Promise`\<[`GetStorageResult`](#getstorageresulttdata)\<`TData`\>\>
|
|
1061
|
+
|
|
1062
|
+
返回一个 Promise,解析为 [GetStorageResult](#getstorageresulttdata)。
|
|
1063
|
+
|
|
1064
|
+
#### Remarks
|
|
1065
|
+
|
|
1066
|
+
#### Example
|
|
1067
|
+
|
|
1068
|
+
```typescript
|
|
1069
|
+
import { getStorage } from '@doubao-apps/framework/api';
|
|
1070
|
+
|
|
1071
|
+
const result = await getStorage<{ name: string; age: number }>({
|
|
1072
|
+
key: 'profile',
|
|
1073
|
+
});
|
|
1074
|
+
|
|
1075
|
+
console.log(result.data.name, result.data.age);
|
|
1076
|
+
```
|
|
1077
|
+
|
|
1078
|
+
<a id="getstoragesync"></a>
|
|
1079
|
+
### getStorageSync()
|
|
1080
|
+
|
|
1081
|
+
> **getStorageSync**\<`TData`\>(`params`): [`GetStorageResult`](#getstorageresulttdata)\<`TData`\>
|
|
1082
|
+
|
|
1083
|
+
从本地缓存同步读取数据。
|
|
1084
|
+
|
|
1085
|
+
#### Type parameters
|
|
1086
|
+
|
|
1087
|
+
• **TData** = `unknown`
|
|
1088
|
+
|
|
1089
|
+
#### Parameters
|
|
1090
|
+
|
|
1091
|
+
• **params**: [`GetStorageParams`](#getstorageparams)
|
|
1092
|
+
|
|
1093
|
+
查询参数,字段见 [GetStorageParams](#getstorageparams)。
|
|
1094
|
+
|
|
1095
|
+
#### Returns
|
|
1096
|
+
|
|
1097
|
+
[`GetStorageResult`](#getstorageresulttdata)\<`TData`\>
|
|
1098
|
+
|
|
1099
|
+
返回 [GetStorageResult](#getstorageresulttdata)。
|
|
1100
|
+
|
|
1101
|
+
#### Remarks
|
|
1102
|
+
|
|
1103
|
+
#### Example
|
|
1104
|
+
|
|
1105
|
+
```typescript
|
|
1106
|
+
import { getStorageSync } from '@doubao-apps/framework/api';
|
|
1107
|
+
|
|
1108
|
+
const result = getStorageSync<{ name: string; age: number }>({
|
|
1109
|
+
key: 'profile',
|
|
1110
|
+
});
|
|
1111
|
+
|
|
1112
|
+
console.log(result.data.name, result.data.age);
|
|
1113
|
+
```
|
|
1114
|
+
|
|
1115
|
+
<a id="removestorage"></a>
|
|
1116
|
+
### removeStorage()
|
|
1117
|
+
|
|
1118
|
+
> **removeStorage**(`params`): `Promise`\<`object`\>
|
|
1119
|
+
|
|
1120
|
+
删除本地缓存中指定 key 的数据。
|
|
1121
|
+
|
|
1122
|
+
#### Parameters
|
|
1123
|
+
|
|
1124
|
+
• **params**: [`RemoveStorageParams`](#removestorageparams)
|
|
1125
|
+
|
|
1126
|
+
删除参数,字段见 [RemoveStorageParams](#removestorageparams)。
|
|
1127
|
+
|
|
1128
|
+
#### Returns
|
|
1129
|
+
|
|
1130
|
+
`Promise`\<`object`\>
|
|
1131
|
+
|
|
1132
|
+
返回一个 Promise,删除完成后 resolve。
|
|
1133
|
+
|
|
1134
|
+
#### Example
|
|
1135
|
+
|
|
1136
|
+
```typescript
|
|
1137
|
+
import { removeStorage } from '@doubao-apps/framework/api';
|
|
1138
|
+
|
|
1139
|
+
await removeStorage({ key: 'profile' });
|
|
1140
|
+
```
|
|
1141
|
+
|
|
1142
|
+
<a id="removestoragesync"></a>
|
|
1143
|
+
### removeStorageSync()
|
|
1144
|
+
|
|
1145
|
+
> **removeStorageSync**(`params`?): `object`
|
|
1146
|
+
|
|
1147
|
+
删除本地缓存中指定 key 的数据。
|
|
1148
|
+
|
|
1149
|
+
#### Parameters
|
|
1150
|
+
|
|
1151
|
+
• **params?**: [`RemoveStorageParams`](#removestorageparams)
|
|
1152
|
+
|
|
1153
|
+
删除参数,字段见 [RemoveStorageParams](#removestorageparams)。
|
|
1154
|
+
|
|
1155
|
+
#### Returns
|
|
1156
|
+
|
|
1157
|
+
`object`
|
|
1158
|
+
|
|
1159
|
+
同步删除完成后返回。
|
|
1160
|
+
|
|
1161
|
+
#### Example
|
|
1162
|
+
|
|
1163
|
+
```typescript
|
|
1164
|
+
import { removeStorageSync } from '@doubao-apps/framework/api';
|
|
1165
|
+
|
|
1166
|
+
removeStorageSync({ key: 'profile' });
|
|
1167
|
+
```
|
|
1168
|
+
|
|
1169
|
+
<a id="clearstorage"></a>
|
|
1170
|
+
### clearStorage()
|
|
1171
|
+
|
|
1172
|
+
> **clearStorage**(`params`?): `Promise`\<`object`\>
|
|
1173
|
+
|
|
1174
|
+
清空本地缓存。
|
|
1175
|
+
|
|
1176
|
+
#### Parameters
|
|
1177
|
+
|
|
1178
|
+
• **params?**: `object`
|
|
1179
|
+
|
|
1180
|
+
#### Returns
|
|
1181
|
+
|
|
1182
|
+
`Promise`\<`object`\>
|
|
1183
|
+
|
|
1184
|
+
返回一个 Promise,清空完成后 resolve。
|
|
1185
|
+
|
|
1186
|
+
#### Example
|
|
1187
|
+
|
|
1188
|
+
```typescript
|
|
1189
|
+
import { clearStorage } from '@doubao-apps/framework/api';
|
|
1190
|
+
|
|
1191
|
+
await clearStorage();
|
|
1192
|
+
```
|
|
1193
|
+
|
|
1194
|
+
<a id="clearstoragesync"></a>
|
|
1195
|
+
### clearStorageSync()
|
|
1196
|
+
|
|
1197
|
+
> **clearStorageSync**(`params`?): `object`
|
|
1198
|
+
|
|
1199
|
+
清空本地缓存。
|
|
1200
|
+
|
|
1201
|
+
#### Parameters
|
|
1202
|
+
|
|
1203
|
+
• **params?**: `object`
|
|
1204
|
+
|
|
1205
|
+
#### Returns
|
|
1206
|
+
|
|
1207
|
+
`object`
|
|
1208
|
+
|
|
1209
|
+
同步清空完成后返回。
|
|
1210
|
+
|
|
1211
|
+
#### Example
|
|
1212
|
+
|
|
1213
|
+
```typescript
|
|
1214
|
+
import { clearStorageSync } from '@doubao-apps/framework/api';
|
|
1215
|
+
|
|
1216
|
+
clearStorageSync();
|
|
1217
|
+
```
|
|
1218
|
+
|
|
1219
|
+
<a id="getstorageinfo"></a>
|
|
1220
|
+
### getStorageInfo()
|
|
1221
|
+
|
|
1222
|
+
> **getStorageInfo**(`params`?): `Promise`\<[`GetStorageInfoResult`](#getstorageinforesult)\>
|
|
1223
|
+
|
|
1224
|
+
获取本地缓存信息。
|
|
1225
|
+
|
|
1226
|
+
#### Parameters
|
|
1227
|
+
|
|
1228
|
+
• **params?**
|
|
1229
|
+
|
|
1230
|
+
#### Returns
|
|
1231
|
+
|
|
1232
|
+
`Promise`\<[`GetStorageInfoResult`](#getstorageinforesult)\>
|
|
1233
|
+
|
|
1234
|
+
返回一个 Promise,解析为 [GetStorageInfoResult](#getstorageinforesult)。
|
|
1235
|
+
|
|
1236
|
+
#### Example
|
|
1237
|
+
|
|
1238
|
+
```typescript
|
|
1239
|
+
import { getStorageInfo } from '@doubao-apps/framework/api';
|
|
1240
|
+
|
|
1241
|
+
const result = await getStorageInfo();
|
|
1242
|
+
|
|
1243
|
+
console.log(result.keys, result.currentSize, result.limitSize);
|
|
1244
|
+
```
|
|
1245
|
+
|
|
1246
|
+
<a id="getstorageinfosync"></a>
|
|
1247
|
+
### getStorageInfoSync()
|
|
1248
|
+
|
|
1249
|
+
> **getStorageInfoSync**(`params`?): [`GetStorageInfoResult`](#getstorageinforesult)
|
|
1250
|
+
|
|
1251
|
+
同步获取本地缓存信息。
|
|
1252
|
+
|
|
1253
|
+
#### Parameters
|
|
1254
|
+
|
|
1255
|
+
• **params?**
|
|
1256
|
+
|
|
1257
|
+
#### Returns
|
|
1258
|
+
|
|
1259
|
+
[`GetStorageInfoResult`](#getstorageinforesult)
|
|
1260
|
+
|
|
1261
|
+
返回 [GetStorageInfoResult](#getstorageinforesult)。
|
|
1262
|
+
|
|
1263
|
+
#### Example
|
|
1264
|
+
|
|
1265
|
+
```typescript
|
|
1266
|
+
import { getStorageInfoSync } from '@doubao-apps/framework/api';
|
|
1267
|
+
|
|
1268
|
+
const result = getStorageInfoSync();
|
|
1269
|
+
|
|
1270
|
+
console.log(result.keys, result.currentSize, result.limitSize);
|
|
1271
|
+
```
|
|
1272
|
+
|
|
1273
|
+
<a id="getwindowinfosync"></a>
|
|
1274
|
+
### getWindowInfoSync()
|
|
1275
|
+
|
|
1276
|
+
> **getWindowInfoSync**(`_param`?): [`GetWindowInfoResult`](#getwindowinforesult)
|
|
1277
|
+
|
|
1278
|
+
获取窗口信息。
|
|
1279
|
+
|
|
1280
|
+
#### Parameters
|
|
1281
|
+
|
|
1282
|
+
• **\_param?**
|
|
1283
|
+
|
|
1284
|
+
#### Returns
|
|
1285
|
+
|
|
1286
|
+
[`GetWindowInfoResult`](#getwindowinforesult)
|
|
1287
|
+
|
|
1288
|
+
返回窗口尺寸、状态栏高度和安全区域等信息,字段见 [GetWindowInfoResult](#getwindowinforesult)。
|
|
1289
|
+
|
|
1290
|
+
#### Example
|
|
1291
|
+
|
|
1292
|
+
```typescript
|
|
1293
|
+
import { getWindowInfoSync } from '@doubao-apps/framework/api';
|
|
1294
|
+
|
|
1295
|
+
const result = getWindowInfoSync();
|
|
1296
|
+
|
|
1297
|
+
console.log(result.windowWidth, result.windowHeight);
|
|
1298
|
+
console.log(result.safeArea?.top, result.screenTop);
|
|
1299
|
+
```
|
|
1300
|
+
|
|
1301
|
+
<a id="getsystemsetting"></a>
|
|
1302
|
+
### getSystemSetting()
|
|
1303
|
+
|
|
1304
|
+
> **getSystemSetting**(`params`?): [`GetSystemSettingResult`](#getsystemsettingresult)
|
|
1305
|
+
|
|
1306
|
+
获取设备设置。
|
|
1307
|
+
|
|
1308
|
+
#### Parameters
|
|
1309
|
+
|
|
1310
|
+
• **params?**
|
|
1311
|
+
|
|
1312
|
+
#### Returns
|
|
1313
|
+
|
|
1314
|
+
[`GetSystemSettingResult`](#getsystemsettingresult)
|
|
1315
|
+
|
|
1316
|
+
返回蓝牙、定位、Wi-Fi 系统开关和设备方向等字段,见 [GetSystemSettingResult](#getsystemsettingresult)。
|
|
1317
|
+
|
|
1318
|
+
#### Example
|
|
1319
|
+
|
|
1320
|
+
```typescript
|
|
1321
|
+
import { getSystemSetting } from '@doubao-apps/framework/api';
|
|
1322
|
+
|
|
1323
|
+
const result = getSystemSetting();
|
|
1324
|
+
|
|
1325
|
+
console.log(result.bluetoothEnabled, result.locationEnabled);
|
|
1326
|
+
console.log(result.wifiEnabled, result.deviceOrientation);
|
|
1327
|
+
```
|
|
1328
|
+
|
|
1329
|
+
<a id="getappbaseinfosync"></a>
|
|
1330
|
+
### getAppBaseInfoSync()
|
|
1331
|
+
|
|
1332
|
+
> **getAppBaseInfoSync**(`_params`?): [`GetAppBaseInfoResult`](#getappbaseinforesult)
|
|
1333
|
+
|
|
1334
|
+
获取应用基础信息。
|
|
1335
|
+
|
|
1336
|
+
#### Parameters
|
|
1337
|
+
|
|
1338
|
+
• **\_params?**
|
|
1339
|
+
|
|
1340
|
+
#### Returns
|
|
1341
|
+
|
|
1342
|
+
[`GetAppBaseInfoResult`](#getappbaseinforesult)
|
|
1343
|
+
|
|
1344
|
+
返回 SDK 版本、调试开关、宿主信息、语言和主题等字段,见 [GetAppBaseInfoResult](#getappbaseinforesult)。
|
|
1345
|
+
|
|
1346
|
+
#### Example
|
|
1347
|
+
|
|
1348
|
+
```typescript
|
|
1349
|
+
import { getAppBaseInfoSync } from '@doubao-apps/framework/api';
|
|
1350
|
+
|
|
1351
|
+
const result = getAppBaseInfoSync();
|
|
1352
|
+
|
|
1353
|
+
console.log(result.language, result.SDKVersion, result.theme);
|
|
1354
|
+
console.log(result.host?.appId, result.enableDebug);
|
|
1355
|
+
```
|
|
1356
|
+
|
|
1357
|
+
<a id="getwindowinfo"></a>
|
|
1358
|
+
### getWindowInfo()
|
|
1359
|
+
|
|
1360
|
+
> **getWindowInfo**(`_params`?): `Promise`\<[`GetWindowInfoResult`](#getwindowinforesult)\>
|
|
1361
|
+
|
|
1362
|
+
获取窗口信息。
|
|
1363
|
+
|
|
1364
|
+
#### Parameters
|
|
1365
|
+
|
|
1366
|
+
• **\_params?**
|
|
1367
|
+
|
|
1368
|
+
#### Returns
|
|
1369
|
+
|
|
1370
|
+
`Promise`\<[`GetWindowInfoResult`](#getwindowinforesult)\>
|
|
1371
|
+
|
|
1372
|
+
返回窗口尺寸、状态栏高度和安全区域等信息,字段见 [GetWindowInfoResult](#getwindowinforesult)。
|
|
1373
|
+
|
|
1374
|
+
#### Example
|
|
1375
|
+
|
|
1376
|
+
```typescript
|
|
1377
|
+
import { getWindowInfo } from '@doubao-apps/framework/api';
|
|
1378
|
+
|
|
1379
|
+
const result = await getWindowInfo();
|
|
1380
|
+
|
|
1381
|
+
console.log(result.windowWidth, result.windowHeight);
|
|
1382
|
+
console.log(result.safeArea?.top, result.screenTop);
|
|
1383
|
+
```
|
|
1384
|
+
|
|
1385
|
+
<a id="getappbaseinfo"></a>
|
|
1386
|
+
### getAppBaseInfo()
|
|
1387
|
+
|
|
1388
|
+
> **getAppBaseInfo**(`params`?): `Promise`\<[`GetAppBaseInfoResult`](#getappbaseinforesult)\>
|
|
1389
|
+
|
|
1390
|
+
获取应用基础信息。
|
|
1391
|
+
|
|
1392
|
+
#### Parameters
|
|
1393
|
+
|
|
1394
|
+
• **params?**
|
|
1395
|
+
|
|
1396
|
+
#### Returns
|
|
1397
|
+
|
|
1398
|
+
`Promise`\<[`GetAppBaseInfoResult`](#getappbaseinforesult)\>
|
|
1399
|
+
|
|
1400
|
+
返回 SDK 版本、调试开关、宿主信息、语言和主题等字段,见 [GetAppBaseInfoResult](#getappbaseinforesult)。
|
|
1401
|
+
|
|
1402
|
+
#### Example
|
|
1403
|
+
|
|
1404
|
+
```typescript
|
|
1405
|
+
import { getAppBaseInfo } from '@doubao-apps/framework/api';
|
|
1406
|
+
|
|
1407
|
+
const result = await getAppBaseInfo();
|
|
1408
|
+
|
|
1409
|
+
console.log(result.language, result.SDKVersion, result.theme);
|
|
1410
|
+
console.log(result.host?.appId, result.enableDebug);
|
|
1411
|
+
```
|
|
1412
|
+
|
|
1413
|
+
## 相关类型
|
|
1414
|
+
|
|
1415
|
+
<a id="getaccountinforesult"></a>
|
|
1416
|
+
### GetAccountInfoResult
|
|
1417
|
+
|
|
1418
|
+
获取当前账号信息。
|
|
1419
|
+
|
|
1420
|
+
#### Properties
|
|
1421
|
+
|
|
1422
|
+
##### miniProgram
|
|
1423
|
+
|
|
1424
|
+
> **miniProgram**: [`DoubaoAppAccountInfo`](#doubaoappaccountinfo)
|
|
1425
|
+
|
|
1426
|
+
豆包 App账号信息
|
|
1427
|
+
|
|
1428
|
+
##### plugin?
|
|
1429
|
+
|
|
1430
|
+
> `optional` **plugin**: [`PluginAccountInfo`](#pluginaccountinfo)
|
|
1431
|
+
|
|
1432
|
+
插件账号信息(仅在插件中调用时包含)
|
|
1433
|
+
|
|
1434
|
+
<a id="doubaoappaccountinfo"></a>
|
|
1435
|
+
### DoubaoAppAccountInfo
|
|
1436
|
+
|
|
1437
|
+
豆包 App 账号信息。
|
|
1438
|
+
|
|
1439
|
+
#### Properties
|
|
1440
|
+
|
|
1441
|
+
##### appId
|
|
1442
|
+
|
|
1443
|
+
> **appId**: `string`
|
|
1444
|
+
|
|
1445
|
+
豆包 App appId
|
|
1446
|
+
|
|
1447
|
+
##### envVersion
|
|
1448
|
+
|
|
1449
|
+
> **envVersion**: `"develop"` \| `"trial"` \| `"release"`
|
|
1450
|
+
|
|
1451
|
+
豆包 App 运行环境。
|
|
1452
|
+
|
|
1453
|
+
- develop: 开发版
|
|
1454
|
+
- trial: 体验版
|
|
1455
|
+
- release: 正式版
|
|
1456
|
+
|
|
1457
|
+
##### version
|
|
1458
|
+
|
|
1459
|
+
> **version**: `string`
|
|
1460
|
+
|
|
1461
|
+
线上豆包 App 版本号。
|
|
1462
|
+
|
|
1463
|
+
<a id="pluginaccountinfo"></a>
|
|
1464
|
+
### PluginAccountInfo
|
|
1465
|
+
|
|
1466
|
+
插件账号信息(仅在插件中调用时包含)。
|
|
1467
|
+
|
|
1468
|
+
#### Properties
|
|
1469
|
+
|
|
1470
|
+
##### appId
|
|
1471
|
+
|
|
1472
|
+
> **appId**: `string`
|
|
1473
|
+
|
|
1474
|
+
插件 appId
|
|
1475
|
+
|
|
1476
|
+
##### version
|
|
1477
|
+
|
|
1478
|
+
> **version**: `string`
|
|
1479
|
+
|
|
1480
|
+
插件版本号,'a.b.c' 形式
|
|
1481
|
+
|
|
1482
|
+
<a id="authorizerequest"></a>
|
|
1483
|
+
### AuthorizeRequest
|
|
1484
|
+
|
|
1485
|
+
#### Properties
|
|
1486
|
+
|
|
1487
|
+
##### scope
|
|
1488
|
+
|
|
1489
|
+
> **scope**: [`Scope`](#scope-1)
|
|
1490
|
+
|
|
1491
|
+
授权范围
|
|
1492
|
+
|
|
1493
|
+
<a id="scope-1"></a>
|
|
1494
|
+
<a id="scope"></a>
|
|
1495
|
+
### Scope
|
|
1496
|
+
|
|
1497
|
+
> **Scope**: `"scope.userLocation"` \| `"scope.userFuzzyLocation"` \| `"scope.userLocationBackground"` \| `"scope.payment"` \| `"scope.record"` \| `"scope.bluetooth"` \| `"scope.camera"` \| `"scope.addPhoneContact"` \| `"scope.addPhoneCalendar"`
|
|
1498
|
+
|
|
1499
|
+
<a id="caniuseparams"></a>
|
|
1500
|
+
### CanIUseParams
|
|
1501
|
+
|
|
1502
|
+
#### Properties
|
|
1503
|
+
|
|
1504
|
+
##### schema
|
|
1505
|
+
|
|
1506
|
+
> **schema**: `string`
|
|
1507
|
+
|
|
1508
|
+
<a id="caniuseresult"></a>
|
|
1509
|
+
### CanIUseResult
|
|
1510
|
+
|
|
1511
|
+
#### Properties
|
|
1512
|
+
|
|
1513
|
+
##### result
|
|
1514
|
+
|
|
1515
|
+
> **result**: `boolean`
|
|
1516
|
+
|
|
1517
|
+
<a id="getlocationparams"></a>
|
|
1518
|
+
### GetLocationParams
|
|
1519
|
+
|
|
1520
|
+
#### Properties
|
|
1521
|
+
|
|
1522
|
+
##### maxCacheMs?
|
|
1523
|
+
|
|
1524
|
+
> `optional` **maxCacheMs**: `number`
|
|
1525
|
+
|
|
1526
|
+
缓存时间,单位毫秒,默认为0
|
|
1527
|
+
|
|
1528
|
+
##### mode?
|
|
1529
|
+
|
|
1530
|
+
> `optional` **mode**: `number`
|
|
1531
|
+
|
|
1532
|
+
定位模式
|
|
1533
|
+
0:低功耗
|
|
1534
|
+
1:仅设备
|
|
1535
|
+
2:高精度(默认)
|
|
1536
|
+
|
|
1537
|
+
##### source?
|
|
1538
|
+
|
|
1539
|
+
> `optional` **source**: `string`
|
|
1540
|
+
|
|
1541
|
+
调用业务方
|
|
1542
|
+
|
|
1543
|
+
##### timeoutMs?
|
|
1544
|
+
|
|
1545
|
+
> `optional` **timeoutMs**: `number`
|
|
1546
|
+
|
|
1547
|
+
超时时间,单位毫秒,默认 30000
|
|
1548
|
+
|
|
1549
|
+
<a id="getlocationresponse"></a>
|
|
1550
|
+
### GetLocationResponse
|
|
1551
|
+
|
|
1552
|
+
#### Properties
|
|
1553
|
+
|
|
1554
|
+
##### accuracy
|
|
1555
|
+
|
|
1556
|
+
> **accuracy**: `number`
|
|
1557
|
+
|
|
1558
|
+
定位精度,单位:米
|
|
1559
|
+
|
|
1560
|
+
##### latitude
|
|
1561
|
+
|
|
1562
|
+
> **latitude**: `number`
|
|
1563
|
+
|
|
1564
|
+
纬度
|
|
1565
|
+
|
|
1566
|
+
##### longitude
|
|
1567
|
+
|
|
1568
|
+
> **longitude**: `number`
|
|
1569
|
+
|
|
1570
|
+
经度
|
|
1571
|
+
|
|
1572
|
+
##### speed
|
|
1573
|
+
|
|
1574
|
+
> **speed**: `number`
|
|
1575
|
+
|
|
1576
|
+
行进速度,单位:米/秒
|
|
1577
|
+
|
|
1578
|
+
##### timestamp
|
|
1579
|
+
|
|
1580
|
+
> **timestamp**: `string`
|
|
1581
|
+
|
|
1582
|
+
时间戳
|
|
1583
|
+
|
|
1584
|
+
<a id="showmodalparams"></a>
|
|
1585
|
+
### ShowModalParams
|
|
1586
|
+
|
|
1587
|
+
显示模态对话框的参数。
|
|
1588
|
+
|
|
1589
|
+
#### Properties
|
|
1590
|
+
|
|
1591
|
+
##### cancelText?
|
|
1592
|
+
|
|
1593
|
+
> `optional` **cancelText**: `string`
|
|
1594
|
+
|
|
1595
|
+
取消按钮的文字。
|
|
1596
|
+
|
|
1597
|
+
##### confirmText?
|
|
1598
|
+
|
|
1599
|
+
> `optional` **confirmText**: `string`
|
|
1600
|
+
|
|
1601
|
+
确认按钮的文字。
|
|
1602
|
+
|
|
1603
|
+
##### content
|
|
1604
|
+
|
|
1605
|
+
> **content**: `string`
|
|
1606
|
+
|
|
1607
|
+
模态对话框的内容。
|
|
1608
|
+
|
|
1609
|
+
##### showCancel?
|
|
1610
|
+
|
|
1611
|
+
> `optional` **showCancel**: `boolean`
|
|
1612
|
+
|
|
1613
|
+
是否显示取消按钮,默认 `true`。
|
|
1614
|
+
|
|
1615
|
+
##### tapMaskToDismiss?
|
|
1616
|
+
|
|
1617
|
+
> `optional` **tapMaskToDismiss**: `boolean`
|
|
1618
|
+
|
|
1619
|
+
是否允许点击蒙层关闭对话框,默认 `false`。
|
|
1620
|
+
|
|
1621
|
+
##### title?
|
|
1622
|
+
|
|
1623
|
+
> `optional` **title**: `string`
|
|
1624
|
+
|
|
1625
|
+
模态对话框的标题。
|
|
1626
|
+
|
|
1627
|
+
<a id="showmodalresult"></a>
|
|
1628
|
+
### ShowModalResult
|
|
1629
|
+
|
|
1630
|
+
显示模态对话框的返回结果。
|
|
1631
|
+
|
|
1632
|
+
#### Properties
|
|
1633
|
+
|
|
1634
|
+
##### action
|
|
1635
|
+
|
|
1636
|
+
> **action**: `"confirm"` \| `"cancel"` \| `"mask"`
|
|
1637
|
+
|
|
1638
|
+
用户点击的动作。
|
|
1639
|
+
|
|
1640
|
+
<a id="showloadingparams"></a>
|
|
1641
|
+
### ShowLoadingParams
|
|
1642
|
+
|
|
1643
|
+
显示 loading 提示框的参数。
|
|
1644
|
+
|
|
1645
|
+
<a id="hideinteractionparams"></a>
|
|
1646
|
+
### HideInteractionParams
|
|
1647
|
+
|
|
1648
|
+
隐藏交互提示框的公共参数。
|
|
1649
|
+
|
|
1650
|
+
<a id="showactionsheetparams"></a>
|
|
1651
|
+
### ShowActionSheetParams
|
|
1652
|
+
|
|
1653
|
+
显示操作菜单的参数。
|
|
1654
|
+
|
|
1655
|
+
#### Properties
|
|
1656
|
+
|
|
1657
|
+
##### itemColor?
|
|
1658
|
+
|
|
1659
|
+
> `optional` **itemColor**: `string`
|
|
1660
|
+
|
|
1661
|
+
按钮文字颜色。
|
|
1662
|
+
|
|
1663
|
+
##### itemList
|
|
1664
|
+
|
|
1665
|
+
> **itemList**: `string`[]
|
|
1666
|
+
|
|
1667
|
+
按钮文字数组。
|
|
1668
|
+
|
|
1669
|
+
##### title?
|
|
1670
|
+
|
|
1671
|
+
> `optional` **title**: `string`
|
|
1672
|
+
|
|
1673
|
+
标题
|
|
1674
|
+
|
|
1675
|
+
<a id="showactionsheetresult"></a>
|
|
1676
|
+
### ShowActionSheetResult
|
|
1677
|
+
|
|
1678
|
+
显示操作菜单的返回结果。
|
|
1679
|
+
|
|
1680
|
+
#### Properties
|
|
1681
|
+
|
|
1682
|
+
##### tapIndex
|
|
1683
|
+
|
|
1684
|
+
> **tapIndex**: `number`
|
|
1685
|
+
|
|
1686
|
+
用户点击的按钮序号,从 0 开始。
|
|
1687
|
+
|
|
1688
|
+
<a id="menubuttonboundingclientrect"></a>
|
|
1689
|
+
### MenuButtonBoundingClientRect
|
|
1690
|
+
|
|
1691
|
+
菜单按钮的布局位置信息。
|
|
1692
|
+
|
|
1693
|
+
#### Properties
|
|
1694
|
+
|
|
1695
|
+
##### bottom
|
|
1696
|
+
|
|
1697
|
+
> **bottom**: `number`
|
|
1698
|
+
|
|
1699
|
+
下边界坐标,单位 px。
|
|
1700
|
+
|
|
1701
|
+
##### height
|
|
1702
|
+
|
|
1703
|
+
> **height**: `number`
|
|
1704
|
+
|
|
1705
|
+
高度,单位 px。
|
|
1706
|
+
|
|
1707
|
+
##### left
|
|
1708
|
+
|
|
1709
|
+
> **left**: `number`
|
|
1710
|
+
|
|
1711
|
+
左边界坐标,单位 px。
|
|
1712
|
+
|
|
1713
|
+
##### right
|
|
1714
|
+
|
|
1715
|
+
> **right**: `number`
|
|
1716
|
+
|
|
1717
|
+
右边界坐标,单位 px。
|
|
1718
|
+
|
|
1719
|
+
##### top
|
|
1720
|
+
|
|
1721
|
+
> **top**: `number`
|
|
1722
|
+
|
|
1723
|
+
上边界坐标,单位 px。
|
|
1724
|
+
|
|
1725
|
+
##### width
|
|
1726
|
+
|
|
1727
|
+
> **width**: `number`
|
|
1728
|
+
|
|
1729
|
+
宽度,单位 px。
|
|
1730
|
+
|
|
1731
|
+
<a id="enablealertbeforeunloadparams"></a>
|
|
1732
|
+
### EnableAlertBeforeUnloadParams
|
|
1733
|
+
|
|
1734
|
+
开启返回前提醒的参数。
|
|
1735
|
+
|
|
1736
|
+
#### Properties
|
|
1737
|
+
|
|
1738
|
+
##### message
|
|
1739
|
+
|
|
1740
|
+
> **message**: `string`
|
|
1741
|
+
|
|
1742
|
+
返回前确认弹窗的文案。
|
|
1743
|
+
|
|
1744
|
+
<a id="showtoastparams"></a>
|
|
1745
|
+
### ShowToastParams
|
|
1746
|
+
|
|
1747
|
+
#### Properties
|
|
1748
|
+
|
|
1749
|
+
##### customIcon?
|
|
1750
|
+
|
|
1751
|
+
> `optional` **customIcon**: `string`
|
|
1752
|
+
|
|
1753
|
+
##### duration?
|
|
1754
|
+
|
|
1755
|
+
> `optional` **duration**: `number`
|
|
1756
|
+
|
|
1757
|
+
##### icon?
|
|
1758
|
+
|
|
1759
|
+
> `optional` **icon**: `"success"` \| `"error"` \| `"warn"`
|
|
1760
|
+
|
|
1761
|
+
##### message
|
|
1762
|
+
|
|
1763
|
+
> **message**: `string`
|
|
1764
|
+
|
|
1765
|
+
##### type?
|
|
1766
|
+
|
|
1767
|
+
> `optional` **type**: `"default"` \| `"success"` \| `"error"` \| `"warning"`
|
|
1768
|
+
|
|
1769
|
+
<a id="dispatchactiondirectiveparams"></a>
|
|
1770
|
+
### DispatchActionDirectiveParams
|
|
1771
|
+
|
|
1772
|
+
下发动作指令的请求参数。
|
|
1773
|
+
|
|
1774
|
+
#### Properties
|
|
1775
|
+
|
|
1776
|
+
##### actionDescribe
|
|
1777
|
+
|
|
1778
|
+
> **actionDescribe**: `string`
|
|
1779
|
+
|
|
1780
|
+
自然语言描述,例如:用户点击支付按钮并完成话费支付
|
|
1781
|
+
|
|
1782
|
+
##### actionType
|
|
1783
|
+
|
|
1784
|
+
> **actionType**: [`ActionDirectiveType`](#actiondirectivetype)
|
|
1785
|
+
|
|
1786
|
+
动作类型,参见 [ActionDirectiveType](#actiondirectivetype)
|
|
1787
|
+
|
|
1788
|
+
##### expectedAction
|
|
1789
|
+
|
|
1790
|
+
> **expectedAction**: `string`
|
|
1791
|
+
|
|
1792
|
+
自然语言描述,例如:调用话费账单查询工具,基于工具返回回复用户。如果有卡片需要引用卡片
|
|
1793
|
+
|
|
1794
|
+
##### responseHint?
|
|
1795
|
+
|
|
1796
|
+
> `optional` **responseHint**: `string`
|
|
1797
|
+
|
|
1798
|
+
自然语言描述,例如:严格参照提供的工具入参来调用工具,不要调用除bill_check以外的其他工具,只能严格基于bill_check工具返回结果进行回复
|
|
1799
|
+
|
|
1800
|
+
##### toolName?
|
|
1801
|
+
|
|
1802
|
+
> `optional` **toolName**: `string`
|
|
1803
|
+
|
|
1804
|
+
mcp名称,如果expectedAction里预期要调用工具,需要在这里写明调用工具的mcp name
|
|
1805
|
+
|
|
1806
|
+
##### toolParams?
|
|
1807
|
+
|
|
1808
|
+
> `optional` **toolParams**: `Record`\<`string`, `string`\>
|
|
1809
|
+
|
|
1810
|
+
mcp入参,如果expectedAction里预期要调用工具,需要在这里写明调用工具的入参
|
|
1811
|
+
|
|
1812
|
+
##### widgetInstanceId
|
|
1813
|
+
|
|
1814
|
+
> **widgetInstanceId**: `string`
|
|
1815
|
+
|
|
1816
|
+
会话消息关联的卡片ID
|
|
1817
|
+
|
|
1818
|
+
<a id="actiondirectivetype"></a>
|
|
1819
|
+
### ActionDirectiveType
|
|
1820
|
+
|
|
1821
|
+
用户动作指令类型。
|
|
1822
|
+
|
|
1823
|
+
#### Enumeration Members
|
|
1824
|
+
|
|
1825
|
+
##### BUTTON\_CLICK
|
|
1826
|
+
|
|
1827
|
+
> **BUTTON\_CLICK**: `"button_click"`
|
|
1828
|
+
|
|
1829
|
+
按钮点击
|
|
1830
|
+
|
|
1831
|
+
##### FORM\_SUBMIT
|
|
1832
|
+
|
|
1833
|
+
> **FORM\_SUBMIT**: `"form_submit"`
|
|
1834
|
+
|
|
1835
|
+
表单提交(复杂的信息提交场景)
|
|
1836
|
+
|
|
1837
|
+
##### OPTION\_SELECT
|
|
1838
|
+
|
|
1839
|
+
> **OPTION\_SELECT**: `"option_select"`
|
|
1840
|
+
|
|
1841
|
+
选择(下拉列表场景)
|
|
1842
|
+
|
|
1843
|
+
<a id="expiredwidgetparams"></a>
|
|
1844
|
+
### ExpiredWidgetParams
|
|
1845
|
+
|
|
1846
|
+
#### Properties
|
|
1847
|
+
|
|
1848
|
+
##### detailText?
|
|
1849
|
+
|
|
1850
|
+
> `optional` **detailText**: `string`
|
|
1851
|
+
|
|
1852
|
+
点击失效卡要跳转的页面 detailText
|
|
1853
|
+
|
|
1854
|
+
##### schema?
|
|
1855
|
+
|
|
1856
|
+
> `optional` **schema**: `string`
|
|
1857
|
+
|
|
1858
|
+
点击失效卡要跳转的页面 schema,格式与 navigateTo 的 url 相同
|
|
1859
|
+
|
|
1860
|
+
##### title?
|
|
1861
|
+
|
|
1862
|
+
> `optional` **title**: `string`
|
|
1863
|
+
|
|
1864
|
+
点击失效卡要跳转的页面 title
|
|
1865
|
+
|
|
1866
|
+
##### widgetInstanceId
|
|
1867
|
+
|
|
1868
|
+
> **widgetInstanceId**: `string`
|
|
1869
|
+
|
|
1870
|
+
卡片实例 ID,在卡片环境通过getWidgetInstanceId来获取,其他环境(比如页面)需要通过传参或通信的方式传递过去
|
|
1871
|
+
|
|
1872
|
+
<a id="loginwithwidgetrequest"></a>
|
|
1873
|
+
### LoginWithWidgetRequest
|
|
1874
|
+
|
|
1875
|
+
#### Properties
|
|
1876
|
+
|
|
1877
|
+
##### loginType
|
|
1878
|
+
|
|
1879
|
+
> **loginType**: [`LoginType`](#logintype-1)
|
|
1880
|
+
|
|
1881
|
+
Login type identifier
|
|
1882
|
+
|
|
1883
|
+
<a id="loginwithwidgetresult"></a>
|
|
1884
|
+
### LoginWithWidgetResult
|
|
1885
|
+
|
|
1886
|
+
#### Properties
|
|
1887
|
+
|
|
1888
|
+
##### result
|
|
1889
|
+
|
|
1890
|
+
> **result**: `boolean`
|
|
1891
|
+
|
|
1892
|
+
Whether the login is successful
|
|
1893
|
+
|
|
1894
|
+
<a id="logintype-1"></a>
|
|
1895
|
+
<a id="logintype"></a>
|
|
1896
|
+
### LoginType
|
|
1897
|
+
|
|
1898
|
+
> **LoginType**: `0` \| `1` \| `2` \| `3`
|
|
1899
|
+
|
|
1900
|
+
Widget 登录类型。
|
|
1901
|
+
|
|
1902
|
+
- `0`: 隐私协议登录
|
|
1903
|
+
- `1`: 仅登录
|
|
1904
|
+
- `2`: 先登录再隐私协议,两次弹窗
|
|
1905
|
+
- `3`: 登录和隐私协议合并,一次弹窗
|
|
1906
|
+
|
|
1907
|
+
<a id="loginrequest"></a>
|
|
1908
|
+
### LoginRequest
|
|
1909
|
+
|
|
1910
|
+
#### Properties
|
|
1911
|
+
|
|
1912
|
+
##### timeout?
|
|
1913
|
+
|
|
1914
|
+
> `optional` **timeout**: `number`
|
|
1915
|
+
|
|
1916
|
+
Timeout in milliseconds
|
|
1917
|
+
|
|
1918
|
+
<a id="loginresult"></a>
|
|
1919
|
+
### LoginResult
|
|
1920
|
+
|
|
1921
|
+
#### Properties
|
|
1922
|
+
|
|
1923
|
+
##### code
|
|
1924
|
+
|
|
1925
|
+
> **code**: `string`
|
|
1926
|
+
|
|
1927
|
+
Login credential code
|
|
1928
|
+
|
|
1929
|
+
<a id="postloginresultrequest"></a>
|
|
1930
|
+
### PostLoginResultRequest
|
|
1931
|
+
|
|
1932
|
+
#### Properties
|
|
1933
|
+
|
|
1934
|
+
##### code?
|
|
1935
|
+
|
|
1936
|
+
> `optional` **code**: `string`
|
|
1937
|
+
|
|
1938
|
+
Authorization login credential, valid when login result is true
|
|
1939
|
+
|
|
1940
|
+
##### result
|
|
1941
|
+
|
|
1942
|
+
> **result**: `boolean`
|
|
1943
|
+
|
|
1944
|
+
Login result, true means success, false means failure
|
|
1945
|
+
|
|
1946
|
+
<a id="createsignorderparams"></a>
|
|
1947
|
+
### CreateSignOrderParams
|
|
1948
|
+
|
|
1949
|
+
#### Properties
|
|
1950
|
+
|
|
1951
|
+
##### data
|
|
1952
|
+
|
|
1953
|
+
> **data**: `string`
|
|
1954
|
+
|
|
1955
|
+
签约订单请求数据。
|
|
1956
|
+
|
|
1957
|
+
##### dbAuthorization
|
|
1958
|
+
|
|
1959
|
+
> **dbAuthorization**: `string`
|
|
1960
|
+
|
|
1961
|
+
签约订单授权信息。
|
|
1962
|
+
|
|
1963
|
+
<a id="createsignorderresult"></a>
|
|
1964
|
+
### CreateSignOrderResult
|
|
1965
|
+
|
|
1966
|
+
> **CreateSignOrderResult**: [`CreateSignOrderSuccessResult`](#createsignordersuccessresult) \| [`CreateSignOrderFailResult`](#createsignorderfailresult)
|
|
1967
|
+
|
|
1968
|
+
<a id="createsignorderfailresult"></a>
|
|
1969
|
+
### CreateSignOrderFailResult
|
|
1970
|
+
|
|
1971
|
+
#### Properties
|
|
1972
|
+
|
|
1973
|
+
##### errLogId?
|
|
1974
|
+
|
|
1975
|
+
> `optional` **errLogId**: `string`
|
|
1976
|
+
|
|
1977
|
+
用于问题排查的错误日志 ID。
|
|
1978
|
+
|
|
1979
|
+
##### errMsg
|
|
1980
|
+
|
|
1981
|
+
> **errMsg**: `string`
|
|
1982
|
+
|
|
1983
|
+
错误信息。
|
|
1984
|
+
|
|
1985
|
+
##### errNo
|
|
1986
|
+
|
|
1987
|
+
> **errNo**: `string`
|
|
1988
|
+
|
|
1989
|
+
错误码。
|
|
1990
|
+
|
|
1991
|
+
<a id="createsignordersuccessresult"></a>
|
|
1992
|
+
### CreateSignOrderSuccessResult
|
|
1993
|
+
|
|
1994
|
+
#### Properties
|
|
1995
|
+
|
|
1996
|
+
##### authOrderId
|
|
1997
|
+
|
|
1998
|
+
> **authOrderId**: `string`
|
|
1999
|
+
|
|
2000
|
+
签约订单 ID。
|
|
2001
|
+
|
|
2002
|
+
##### logId
|
|
2003
|
+
|
|
2004
|
+
> **logId**: `string`
|
|
2005
|
+
|
|
2006
|
+
用于问题排查的日志 ID。
|
|
2007
|
+
|
|
2008
|
+
<a id="getorderpaymentresult"></a>
|
|
2009
|
+
### GetOrderPaymentResult
|
|
2010
|
+
|
|
2011
|
+
#### Properties
|
|
2012
|
+
|
|
2013
|
+
##### logId
|
|
2014
|
+
|
|
2015
|
+
> **logId**: `string`
|
|
2016
|
+
|
|
2017
|
+
用于问题排查的日志 ID。
|
|
2018
|
+
|
|
2019
|
+
##### orderId
|
|
2020
|
+
|
|
2021
|
+
> **orderId**: `string`
|
|
2022
|
+
|
|
2023
|
+
订单 ID。
|
|
2024
|
+
|
|
2025
|
+
<a id="getorderpaymentwithsignparams"></a>
|
|
2026
|
+
### GetOrderPaymentWithSignParams
|
|
2027
|
+
|
|
2028
|
+
#### Properties
|
|
2029
|
+
|
|
2030
|
+
##### orderId
|
|
2031
|
+
|
|
2032
|
+
> **orderId**: `string`
|
|
2033
|
+
|
|
2034
|
+
订单 ID。
|
|
2035
|
+
|
|
2036
|
+
##### signData
|
|
2037
|
+
|
|
2038
|
+
> **signData**: `string`
|
|
2039
|
+
|
|
2040
|
+
支付签名数据。
|
|
2041
|
+
|
|
2042
|
+
##### signDbAuthorization
|
|
2043
|
+
|
|
2044
|
+
> **signDbAuthorization**: `string`
|
|
2045
|
+
|
|
2046
|
+
签名支付授权信息。
|
|
2047
|
+
|
|
2048
|
+
<a id="getorderpaymentparams"></a>
|
|
2049
|
+
### GetOrderPaymentParams
|
|
2050
|
+
|
|
2051
|
+
#### Properties
|
|
2052
|
+
|
|
2053
|
+
##### orderId
|
|
2054
|
+
|
|
2055
|
+
> **orderId**: `string`
|
|
2056
|
+
|
|
2057
|
+
订单 ID。
|
|
2058
|
+
|
|
2059
|
+
<a id="requestcombineorderparams"></a>
|
|
2060
|
+
### RequestCombineOrderParams
|
|
2061
|
+
|
|
2062
|
+
#### Properties
|
|
2063
|
+
|
|
2064
|
+
##### data
|
|
2065
|
+
|
|
2066
|
+
> **data**: `string`
|
|
2067
|
+
|
|
2068
|
+
合单订单请求数据。
|
|
2069
|
+
|
|
2070
|
+
##### dbAuthorization
|
|
2071
|
+
|
|
2072
|
+
> **dbAuthorization**: `string`
|
|
2073
|
+
|
|
2074
|
+
合单订单授权信息。
|
|
2075
|
+
|
|
2076
|
+
<a id="requestcombineorderresult"></a>
|
|
2077
|
+
### RequestCombineOrderResult
|
|
2078
|
+
|
|
2079
|
+
> **RequestCombineOrderResult**: [`RequestCombineOrderSuccessResult`](#requestcombineordersuccessresult) \| [`RequestCombineOrderFailResult`](#requestcombineorderfailresult)
|
|
2080
|
+
|
|
2081
|
+
<a id="requestcombineorderfailresult"></a>
|
|
2082
|
+
### RequestCombineOrderFailResult
|
|
2083
|
+
|
|
2084
|
+
#### Properties
|
|
2085
|
+
|
|
2086
|
+
##### errLogId?
|
|
2087
|
+
|
|
2088
|
+
> `optional` **errLogId**: `string`
|
|
2089
|
+
|
|
2090
|
+
用于问题排查的错误日志 ID。
|
|
2091
|
+
|
|
2092
|
+
##### errMsg
|
|
2093
|
+
|
|
2094
|
+
> **errMsg**: `string`
|
|
2095
|
+
|
|
2096
|
+
错误信息。
|
|
2097
|
+
|
|
2098
|
+
##### errNo
|
|
2099
|
+
|
|
2100
|
+
> **errNo**: `string`
|
|
2101
|
+
|
|
2102
|
+
错误码。
|
|
2103
|
+
|
|
2104
|
+
<a id="requestcombineordersuccessresult"></a>
|
|
2105
|
+
### RequestCombineOrderSuccessResult
|
|
2106
|
+
|
|
2107
|
+
#### Properties
|
|
2108
|
+
|
|
2109
|
+
##### combineOrderId
|
|
2110
|
+
|
|
2111
|
+
> **combineOrderId**: `string`
|
|
2112
|
+
|
|
2113
|
+
合单订单 ID。
|
|
2114
|
+
|
|
2115
|
+
##### logId
|
|
2116
|
+
|
|
2117
|
+
> **logId**: `string`
|
|
2118
|
+
|
|
2119
|
+
用于问题排查的日志 ID。
|
|
2120
|
+
|
|
2121
|
+
<a id="requestorderparams"></a>
|
|
2122
|
+
### RequestOrderParams
|
|
2123
|
+
|
|
2124
|
+
#### Properties
|
|
2125
|
+
|
|
2126
|
+
##### data
|
|
2127
|
+
|
|
2128
|
+
> **data**: `string`
|
|
2129
|
+
|
|
2130
|
+
##### dbAuthorization
|
|
2131
|
+
|
|
2132
|
+
> **dbAuthorization**: `string`
|
|
2133
|
+
|
|
2134
|
+
<a id="requestorderresult"></a>
|
|
2135
|
+
### RequestOrderResult
|
|
2136
|
+
|
|
2137
|
+
#### Properties
|
|
2138
|
+
|
|
2139
|
+
##### logId
|
|
2140
|
+
|
|
2141
|
+
> **logId**: `string`
|
|
2142
|
+
|
|
2143
|
+
##### orderId
|
|
2144
|
+
|
|
2145
|
+
> **orderId**: `string`
|
|
2146
|
+
|
|
2147
|
+
<a id="signparams"></a>
|
|
2148
|
+
### SignParams
|
|
2149
|
+
|
|
2150
|
+
#### Properties
|
|
2151
|
+
|
|
2152
|
+
##### orderId
|
|
2153
|
+
|
|
2154
|
+
> **orderId**: `string`
|
|
2155
|
+
|
|
2156
|
+
签约订单 ID。
|
|
2157
|
+
|
|
2158
|
+
<a id="signresult"></a>
|
|
2159
|
+
### SignResult
|
|
2160
|
+
|
|
2161
|
+
> **SignResult**: [`SignSuccessResult`](#signsuccessresult) \| [`SignFailResult`](#signfailresult)
|
|
2162
|
+
|
|
2163
|
+
<a id="signfailresult"></a>
|
|
2164
|
+
### SignFailResult
|
|
2165
|
+
|
|
2166
|
+
#### Properties
|
|
2167
|
+
|
|
2168
|
+
##### code
|
|
2169
|
+
|
|
2170
|
+
> **code**: `number`
|
|
2171
|
+
|
|
2172
|
+
错误码。
|
|
2173
|
+
|
|
2174
|
+
##### errLogId?
|
|
2175
|
+
|
|
2176
|
+
> `optional` **errLogId**: `string`
|
|
2177
|
+
|
|
2178
|
+
用于问题排查的错误日志 ID。
|
|
2179
|
+
|
|
2180
|
+
##### errMsg
|
|
2181
|
+
|
|
2182
|
+
> **errMsg**: `string`
|
|
2183
|
+
|
|
2184
|
+
错误信息。
|
|
2185
|
+
|
|
2186
|
+
##### errNo
|
|
2187
|
+
|
|
2188
|
+
> **errNo**: `string`
|
|
2189
|
+
|
|
2190
|
+
错误编号。
|
|
2191
|
+
|
|
2192
|
+
<a id="signsuccessresult"></a>
|
|
2193
|
+
### SignSuccessResult
|
|
2194
|
+
|
|
2195
|
+
> **SignSuccessResult**: `Record`\<`string`, `never`\>
|
|
2196
|
+
|
|
2197
|
+
<a id="privacysettingresult"></a>
|
|
2198
|
+
### PrivacySettingResult
|
|
2199
|
+
|
|
2200
|
+
#### Properties
|
|
2201
|
+
|
|
2202
|
+
##### needAuthorization
|
|
2203
|
+
|
|
2204
|
+
> **needAuthorization**: `boolean`
|
|
2205
|
+
|
|
2206
|
+
Whether user authorization for privacy agreement is required
|
|
2207
|
+
|
|
2208
|
+
<a id="sendquerymessageparams"></a>
|
|
2209
|
+
### SendQueryMessageParams
|
|
2210
|
+
|
|
2211
|
+
#### Properties
|
|
2212
|
+
|
|
2213
|
+
##### content
|
|
2214
|
+
|
|
2215
|
+
> **content**: `string`
|
|
2216
|
+
|
|
2217
|
+
要发送的消息。根据类型不同,序列化方式可能不同
|
|
2218
|
+
|
|
2219
|
+
##### type
|
|
2220
|
+
|
|
2221
|
+
> **type**: `"text"`
|
|
2222
|
+
|
|
2223
|
+
消息类型,目前仅支持 text
|
|
2224
|
+
|
|
2225
|
+
<a id="setadditionalcontextparams"></a>
|
|
2226
|
+
### SetAdditionalContextParams
|
|
2227
|
+
|
|
2228
|
+
#### Properties
|
|
2229
|
+
|
|
2230
|
+
##### additionalContext
|
|
2231
|
+
|
|
2232
|
+
> **additionalContext**: `string`
|
|
2233
|
+
|
|
2234
|
+
上下文内容
|
|
2235
|
+
|
|
2236
|
+
##### botId?
|
|
2237
|
+
|
|
2238
|
+
> `optional` **botId**: `string`
|
|
2239
|
+
|
|
2240
|
+
指定 bot id
|
|
2241
|
+
|
|
2242
|
+
<a id="updatemodelcontextparams"></a>
|
|
2243
|
+
### UpdateModelContextParams
|
|
2244
|
+
|
|
2245
|
+
#### Properties
|
|
2246
|
+
|
|
2247
|
+
##### content
|
|
2248
|
+
|
|
2249
|
+
> **content**: `string`
|
|
2250
|
+
|
|
2251
|
+
上下文内容,格式无约束,可以与 MCP 服务下发的上下文格式保持一致
|
|
2252
|
+
|
|
2253
|
+
##### entityId?
|
|
2254
|
+
|
|
2255
|
+
> `optional` **entityId**: `string`
|
|
2256
|
+
|
|
2257
|
+
上下文所属的 entityID,业务侧管理
|
|
2258
|
+
|
|
2259
|
+
##### taskId?
|
|
2260
|
+
|
|
2261
|
+
> `optional` **taskId**: `string`
|
|
2262
|
+
|
|
2263
|
+
上下文所属任务 ID,业务侧定义
|
|
2264
|
+
|
|
2265
|
+
<a id="updatewidgetparams"></a>
|
|
2266
|
+
### UpdateWidgetParams
|
|
2267
|
+
|
|
2268
|
+
#### Properties
|
|
2269
|
+
|
|
2270
|
+
##### widgetData
|
|
2271
|
+
|
|
2272
|
+
> **widgetData**: `string`
|
|
2273
|
+
|
|
2274
|
+
卡片渲染的数据
|
|
2275
|
+
|
|
2276
|
+
##### widgetId?
|
|
2277
|
+
|
|
2278
|
+
> `optional` **widgetId**: `string`
|
|
2279
|
+
|
|
2280
|
+
卡片更新的为新的widgetId
|
|
2281
|
+
|
|
2282
|
+
##### widgetInstanceId
|
|
2283
|
+
|
|
2284
|
+
> **widgetInstanceId**: `string`
|
|
2285
|
+
|
|
2286
|
+
需要更新的widget 实例 ID
|
|
2287
|
+
|
|
2288
|
+
<a id="saveimagetophotosalbumparams"></a>
|
|
2289
|
+
### SaveImageToPhotosAlbumParams
|
|
2290
|
+
|
|
2291
|
+
保存图片到系统相册的请求参数。
|
|
2292
|
+
|
|
2293
|
+
#### Properties
|
|
2294
|
+
|
|
2295
|
+
##### filePath
|
|
2296
|
+
|
|
2297
|
+
> **filePath**: `string`
|
|
2298
|
+
|
|
2299
|
+
需要保存的图片文件路径。支持临时文件路径或持久文件路径,不支持网络图片路径。
|
|
2300
|
+
|
|
2301
|
+
<a id="previewimageparams"></a>
|
|
2302
|
+
### PreviewImageParams
|
|
2303
|
+
|
|
2304
|
+
预览图片的请求参数。
|
|
2305
|
+
|
|
2306
|
+
#### Properties
|
|
2307
|
+
|
|
2308
|
+
##### current?
|
|
2309
|
+
|
|
2310
|
+
> `optional` **current**: `string` \| `number`
|
|
2311
|
+
|
|
2312
|
+
当前显示图片的链接,或当前显示图片的下标,不填则默认为 urls 中的第一张
|
|
2313
|
+
|
|
2314
|
+
##### referrerPolicy?
|
|
2315
|
+
|
|
2316
|
+
> `optional` **referrerPolicy**: `string`
|
|
2317
|
+
|
|
2318
|
+
预览页使用的 Referrer 策略。
|
|
2319
|
+
|
|
2320
|
+
##### showmenu?
|
|
2321
|
+
|
|
2322
|
+
> `optional` **showmenu**: `boolean`
|
|
2323
|
+
|
|
2324
|
+
是否显示长按菜单,菜单支持保存图片至本地相册
|
|
2325
|
+
|
|
2326
|
+
##### urls
|
|
2327
|
+
|
|
2328
|
+
> **urls**: `string`[]
|
|
2329
|
+
|
|
2330
|
+
需要预览的图片链接列表。
|
|
2331
|
+
|
|
2332
|
+
<a id="getimageinfoparams"></a>
|
|
2333
|
+
### GetImageInfoParams
|
|
2334
|
+
|
|
2335
|
+
获取图片信息的请求参数。
|
|
2336
|
+
|
|
2337
|
+
#### Properties
|
|
2338
|
+
|
|
2339
|
+
##### src
|
|
2340
|
+
|
|
2341
|
+
> **src**: `string`
|
|
2342
|
+
|
|
2343
|
+
图片路径,可以是相对路径、临时文件路径、存储文件路径或网络图片路径。
|
|
2344
|
+
|
|
2345
|
+
<a id="getimageinforesult"></a>
|
|
2346
|
+
### GetImageInfoResult
|
|
2347
|
+
|
|
2348
|
+
图片信息结果。
|
|
2349
|
+
|
|
2350
|
+
#### Properties
|
|
2351
|
+
|
|
2352
|
+
##### height
|
|
2353
|
+
|
|
2354
|
+
> **height**: `number`
|
|
2355
|
+
|
|
2356
|
+
图片原始高度,单位 px,不考虑旋转。
|
|
2357
|
+
|
|
2358
|
+
##### orientation
|
|
2359
|
+
|
|
2360
|
+
> **orientation**: [`ImageOrientation`](#imageorientation)
|
|
2361
|
+
|
|
2362
|
+
图片方向。
|
|
2363
|
+
|
|
2364
|
+
##### path
|
|
2365
|
+
|
|
2366
|
+
> **path**: `string`
|
|
2367
|
+
|
|
2368
|
+
图片的本地路径。
|
|
2369
|
+
|
|
2370
|
+
##### type
|
|
2371
|
+
|
|
2372
|
+
> **type**: `string`
|
|
2373
|
+
|
|
2374
|
+
图片格式。
|
|
2375
|
+
|
|
2376
|
+
##### width
|
|
2377
|
+
|
|
2378
|
+
> **width**: `number`
|
|
2379
|
+
|
|
2380
|
+
图片原始宽度,单位 px,不考虑旋转。
|
|
2381
|
+
|
|
2382
|
+
<a id="imageorientation"></a>
|
|
2383
|
+
### ImageOrientation
|
|
2384
|
+
|
|
2385
|
+
> **ImageOrientation**: `"up"` \| `"up-mirrored"` \| `"down"` \| `"down-mirrored"` \| `"left-mirrored"` \| `"right"` \| `"right-mirrored"` \| `"left"`
|
|
2386
|
+
|
|
2387
|
+
图片方向枚举。
|
|
2388
|
+
|
|
2389
|
+
<a id="chooseimageparams"></a>
|
|
2390
|
+
### ChooseImageParams
|
|
2391
|
+
|
|
2392
|
+
选择图片的请求参数。
|
|
2393
|
+
|
|
2394
|
+
#### Properties
|
|
2395
|
+
|
|
2396
|
+
##### count?
|
|
2397
|
+
|
|
2398
|
+
> `optional` **count**: `number`
|
|
2399
|
+
|
|
2400
|
+
最多可选图片张数。
|
|
2401
|
+
|
|
2402
|
+
##### imageId?
|
|
2403
|
+
|
|
2404
|
+
> `optional` **imageId**: `string`
|
|
2405
|
+
|
|
2406
|
+
H5 场景下可复用的 input 元素 ID。
|
|
2407
|
+
|
|
2408
|
+
##### sizeType?
|
|
2409
|
+
|
|
2410
|
+
> `optional` **sizeType**: [`ChooseImageSizeType`](#chooseimagesizetype)[]
|
|
2411
|
+
|
|
2412
|
+
允许返回的图片尺寸类型。
|
|
2413
|
+
|
|
2414
|
+
##### sourceType?
|
|
2415
|
+
|
|
2416
|
+
> `optional` **sourceType**: [`ChooseImageSourceType`](#chooseimagesourcetype)[]
|
|
2417
|
+
|
|
2418
|
+
允许选择的图片来源。
|
|
2419
|
+
|
|
2420
|
+
<a id="chooseimageresult"></a>
|
|
2421
|
+
### ChooseImageResult
|
|
2422
|
+
|
|
2423
|
+
选择图片结果。
|
|
2424
|
+
|
|
2425
|
+
#### Properties
|
|
2426
|
+
|
|
2427
|
+
##### tempFilePaths
|
|
2428
|
+
|
|
2429
|
+
> **tempFilePaths**: `string`[]
|
|
2430
|
+
|
|
2431
|
+
图片临时文件路径列表。
|
|
2432
|
+
|
|
2433
|
+
##### tempFiles
|
|
2434
|
+
|
|
2435
|
+
> **tempFiles**: [`ChooseImageFile`](#chooseimagefile)[]
|
|
2436
|
+
|
|
2437
|
+
图片临时文件信息列表。
|
|
2438
|
+
|
|
2439
|
+
<a id="chooseimagesizetype"></a>
|
|
2440
|
+
### ChooseImageSizeType
|
|
2441
|
+
|
|
2442
|
+
> **ChooseImageSizeType**: `"original"` \| `"compressed"`
|
|
2443
|
+
|
|
2444
|
+
可选的图片尺寸类型。
|
|
2445
|
+
|
|
2446
|
+
<a id="chooseimagesourcetype"></a>
|
|
2447
|
+
### ChooseImageSourceType
|
|
2448
|
+
|
|
2449
|
+
> **ChooseImageSourceType**: `"album"` \| `"camera"` \| `"user"` \| `"environment"`
|
|
2450
|
+
|
|
2451
|
+
可选的图片来源类型。
|
|
2452
|
+
|
|
2453
|
+
<a id="chooseimagefile"></a>
|
|
2454
|
+
### ChooseImageFile
|
|
2455
|
+
|
|
2456
|
+
选择图片返回的单个文件信息。
|
|
2457
|
+
|
|
2458
|
+
#### Properties
|
|
2459
|
+
|
|
2460
|
+
##### originalFileObj?
|
|
2461
|
+
|
|
2462
|
+
> `optional` **originalFileObj**: `File`
|
|
2463
|
+
|
|
2464
|
+
原始浏览器 File 对象。
|
|
2465
|
+
|
|
2466
|
+
##### path
|
|
2467
|
+
|
|
2468
|
+
> **path**: `string`
|
|
2469
|
+
|
|
2470
|
+
本地临时文件路径。
|
|
2471
|
+
|
|
2472
|
+
##### size
|
|
2473
|
+
|
|
2474
|
+
> **size**: `number`
|
|
2475
|
+
|
|
2476
|
+
文件大小,单位 B。
|
|
2477
|
+
|
|
2478
|
+
##### type?
|
|
2479
|
+
|
|
2480
|
+
> `optional` **type**: `string`
|
|
2481
|
+
|
|
2482
|
+
文件 MIME 类型。
|
|
2483
|
+
|
|
2484
|
+
<a id="compressimageparams"></a>
|
|
2485
|
+
### CompressImageParams
|
|
2486
|
+
|
|
2487
|
+
压缩图片的请求参数。
|
|
2488
|
+
|
|
2489
|
+
#### Properties
|
|
2490
|
+
|
|
2491
|
+
##### compressedHeight?
|
|
2492
|
+
|
|
2493
|
+
> `optional` **compressedHeight**: `number`
|
|
2494
|
+
|
|
2495
|
+
压缩后图片高度,单位 px。
|
|
2496
|
+
|
|
2497
|
+
##### compressedWidth?
|
|
2498
|
+
|
|
2499
|
+
> `optional` **compressedWidth**: `number`
|
|
2500
|
+
|
|
2501
|
+
压缩后图片宽度,单位 px。
|
|
2502
|
+
|
|
2503
|
+
##### quality?
|
|
2504
|
+
|
|
2505
|
+
> `optional` **quality**: `number`
|
|
2506
|
+
|
|
2507
|
+
压缩质量,范围 0 - 100,仅对 jpg 生效。
|
|
2508
|
+
|
|
2509
|
+
##### src
|
|
2510
|
+
|
|
2511
|
+
> **src**: `string`
|
|
2512
|
+
|
|
2513
|
+
图片路径。
|
|
2514
|
+
|
|
2515
|
+
<a id="compressimageresult"></a>
|
|
2516
|
+
### CompressImageResult
|
|
2517
|
+
|
|
2518
|
+
压缩图片结果。
|
|
2519
|
+
|
|
2520
|
+
#### Properties
|
|
2521
|
+
|
|
2522
|
+
##### tempFilePath
|
|
2523
|
+
|
|
2524
|
+
> **tempFilePath**: `string`
|
|
2525
|
+
|
|
2526
|
+
压缩后图片的临时文件路径。
|
|
2527
|
+
|
|
2528
|
+
<a id="requestparams"></a>
|
|
2529
|
+
### RequestParams
|
|
2530
|
+
|
|
2531
|
+
网络请求参数。
|
|
2532
|
+
|
|
2533
|
+
#### Properties
|
|
2534
|
+
|
|
2535
|
+
##### data?
|
|
2536
|
+
|
|
2537
|
+
> `optional` **data**: `string` \| `Record`\<`string`, `any`\> \| `ArrayBuffer`
|
|
2538
|
+
|
|
2539
|
+
请求体数据。
|
|
2540
|
+
|
|
2541
|
+
传给服务器的数据最终会是 `String` 或 `ArrayBuffer`:
|
|
2542
|
+
- 若 `data` 是 `string` 或 `ArrayBuffer`,直接使用;
|
|
2543
|
+
- 若 `header['content-type']` 是 `application/x-www-form-urlencoded`,会被编码为 query string,例如:`encodeURIComponent(k)=encodeURIComponent(v)`;
|
|
2544
|
+
- 若 `header['content-type']` 是 `application/json`,会执行 JSON 序列化;
|
|
2545
|
+
- 若 `data` 是普通对象且未命中上述类型,也会执行 JSON 序列化;
|
|
2546
|
+
- 其他类型会调用 `toString()`
|
|
2547
|
+
|
|
2548
|
+
##### dataType?
|
|
2549
|
+
|
|
2550
|
+
> `optional` **dataType**: `"string"` \| `"json"`
|
|
2551
|
+
|
|
2552
|
+
期望返回的数据格式。
|
|
2553
|
+
- `json`: 尝试按 JSON 解析;
|
|
2554
|
+
- `string`: 按字符串返回。
|
|
2555
|
+
|
|
2556
|
+
###### Default
|
|
2557
|
+
|
|
2558
|
+
```ts
|
|
2559
|
+
"json"
|
|
2560
|
+
```
|
|
2561
|
+
|
|
2562
|
+
##### header?
|
|
2563
|
+
|
|
2564
|
+
> `optional` **header**: `Record`\<`string`, `string`\>
|
|
2565
|
+
|
|
2566
|
+
请求 Header。
|
|
2567
|
+
|
|
2568
|
+
###### Default
|
|
2569
|
+
|
|
2570
|
+
```ts
|
|
2571
|
+
{"content-type": "application/json"}
|
|
2572
|
+
```
|
|
2573
|
+
|
|
2574
|
+
##### method?
|
|
2575
|
+
|
|
2576
|
+
> `optional` **method**: [`RequestMethod`](#requestmethod)
|
|
2577
|
+
|
|
2578
|
+
请求方法。
|
|
2579
|
+
|
|
2580
|
+
###### Default
|
|
2581
|
+
|
|
2582
|
+
```ts
|
|
2583
|
+
"GET"
|
|
2584
|
+
```
|
|
2585
|
+
|
|
2586
|
+
##### url
|
|
2587
|
+
|
|
2588
|
+
> **url**: `string`
|
|
2589
|
+
|
|
2590
|
+
请求地址,需为完整的 **HTTPS** URL。
|
|
2591
|
+
|
|
2592
|
+
<a id="requestresponse"></a>
|
|
2593
|
+
### RequestResponse
|
|
2594
|
+
|
|
2595
|
+
网络请求返回结果。
|
|
2596
|
+
|
|
2597
|
+
#### Properties
|
|
2598
|
+
|
|
2599
|
+
##### data?
|
|
2600
|
+
|
|
2601
|
+
> `optional` **data**: `string` \| `Record`\<`string`, `any`\> \| `ArrayBuffer`
|
|
2602
|
+
|
|
2603
|
+
响应数据,类型由 `dataType` 决定。
|
|
2604
|
+
|
|
2605
|
+
##### header
|
|
2606
|
+
|
|
2607
|
+
> **header**: `Record`\<`string`, `string`\>
|
|
2608
|
+
|
|
2609
|
+
HTTP 响应头。
|
|
2610
|
+
|
|
2611
|
+
##### statusCode
|
|
2612
|
+
|
|
2613
|
+
> **statusCode**: `number`
|
|
2614
|
+
|
|
2615
|
+
HTTP 状态码。
|
|
2616
|
+
|
|
2617
|
+
<a id="requestmethod"></a>
|
|
2618
|
+
### RequestMethod
|
|
2619
|
+
|
|
2620
|
+
> **RequestMethod**: `"GET"` \| `"POST"` \| `"PUT"` \| `"DELETE"` \| `"HEAD"` \| `"OPTIONS"` \| `"TRACE"` \| `"CONNECT"`
|
|
2621
|
+
|
|
2622
|
+
<a id="openapprequest"></a>
|
|
2623
|
+
### OpenAppRequest
|
|
2624
|
+
|
|
2625
|
+
#### Properties
|
|
2626
|
+
|
|
2627
|
+
##### fallbackUrl?
|
|
2628
|
+
|
|
2629
|
+
> `optional` **fallbackUrl**: `string`
|
|
2630
|
+
|
|
2631
|
+
Optional fallback URL when deep link fails
|
|
2632
|
+
|
|
2633
|
+
##### targetPackage?
|
|
2634
|
+
|
|
2635
|
+
> `optional` **targetPackage**: `string`
|
|
2636
|
+
|
|
2637
|
+
Optional target package name for Android
|
|
2638
|
+
|
|
2639
|
+
##### uri
|
|
2640
|
+
|
|
2641
|
+
> **uri**: `string`
|
|
2642
|
+
|
|
2643
|
+
Target URI to open, e.g. scheme://path?query
|
|
2644
|
+
|
|
2645
|
+
<a id="openappresult"></a>
|
|
2646
|
+
### OpenAppResult
|
|
2647
|
+
|
|
2648
|
+
#### Properties
|
|
2649
|
+
|
|
2650
|
+
##### status
|
|
2651
|
+
|
|
2652
|
+
> **status**: [`OpenAppStatus`](#openappstatus)
|
|
2653
|
+
|
|
2654
|
+
Execution status from client
|
|
2655
|
+
|
|
2656
|
+
<a id="openappstatus"></a>
|
|
2657
|
+
### OpenAppStatus
|
|
2658
|
+
|
|
2659
|
+
> **OpenAppStatus**: `"deep_link"` \| `"market"` \| `"browser"`
|
|
2660
|
+
|
|
2661
|
+
<a id="navigatetoparams"></a>
|
|
2662
|
+
### NavigateToParams
|
|
2663
|
+
|
|
2664
|
+
#### Properties
|
|
2665
|
+
|
|
2666
|
+
##### url
|
|
2667
|
+
|
|
2668
|
+
> **url**: `string`
|
|
2669
|
+
|
|
2670
|
+
跳转的页面的路径,如 'path?key=value&key2=value2'
|
|
2671
|
+
|
|
2672
|
+
<a id="navigatebackparams"></a>
|
|
2673
|
+
### NavigateBackParams
|
|
2674
|
+
|
|
2675
|
+
#### Properties
|
|
2676
|
+
|
|
2677
|
+
##### delta?
|
|
2678
|
+
|
|
2679
|
+
> `optional` **delta**: `number`
|
|
2680
|
+
|
|
2681
|
+
返回的页面数,如果 delta 大于现有页面数,则返回到页面栈中只剩一个页面为止。
|
|
2682
|
+
|
|
2683
|
+
<a id="setstorageparamstdata"></a>
|
|
2684
|
+
### SetStorageParams<TData>
|
|
2685
|
+
|
|
2686
|
+
#### Type parameters
|
|
2687
|
+
|
|
2688
|
+
• **TData** = `unknown`
|
|
2689
|
+
|
|
2690
|
+
#### Properties
|
|
2691
|
+
|
|
2692
|
+
##### data
|
|
2693
|
+
|
|
2694
|
+
> **data**: `TData`
|
|
2695
|
+
|
|
2696
|
+
待存储的数据
|
|
2697
|
+
|
|
2698
|
+
##### key
|
|
2699
|
+
|
|
2700
|
+
> **key**: `string`
|
|
2701
|
+
|
|
2702
|
+
本地缓存键名
|
|
2703
|
+
|
|
2704
|
+
<a id="getstorageparams"></a>
|
|
2705
|
+
### GetStorageParams
|
|
2706
|
+
|
|
2707
|
+
#### Properties
|
|
2708
|
+
|
|
2709
|
+
##### key
|
|
2710
|
+
|
|
2711
|
+
> **key**: `string`
|
|
2712
|
+
|
|
2713
|
+
本地缓存键名
|
|
2714
|
+
|
|
2715
|
+
<a id="getstorageresulttdata"></a>
|
|
2716
|
+
### GetStorageResult<TData>
|
|
2717
|
+
|
|
2718
|
+
#### Type parameters
|
|
2719
|
+
|
|
2720
|
+
• **TData** = `unknown`
|
|
2721
|
+
|
|
2722
|
+
#### Properties
|
|
2723
|
+
|
|
2724
|
+
##### data
|
|
2725
|
+
|
|
2726
|
+
> **data**: `TData`
|
|
2727
|
+
|
|
2728
|
+
key 对应的数据
|
|
2729
|
+
|
|
2730
|
+
<a id="removestorageparams"></a>
|
|
2731
|
+
### RemoveStorageParams
|
|
2732
|
+
|
|
2733
|
+
#### Properties
|
|
2734
|
+
|
|
2735
|
+
##### key
|
|
2736
|
+
|
|
2737
|
+
> **key**: `string`
|
|
2738
|
+
|
|
2739
|
+
本地缓存键名
|
|
2740
|
+
|
|
2741
|
+
<a id="getstorageinforesult"></a>
|
|
2742
|
+
### GetStorageInfoResult
|
|
2743
|
+
|
|
2744
|
+
#### Properties
|
|
2745
|
+
|
|
2746
|
+
##### currentSize
|
|
2747
|
+
|
|
2748
|
+
> **currentSize**: `number`
|
|
2749
|
+
|
|
2750
|
+
当前占用的空间大小,单位 KB
|
|
2751
|
+
|
|
2752
|
+
##### keys
|
|
2753
|
+
|
|
2754
|
+
> **keys**: `string`[]
|
|
2755
|
+
|
|
2756
|
+
当前 storage 中所有的 key
|
|
2757
|
+
|
|
2758
|
+
##### limitSize
|
|
2759
|
+
|
|
2760
|
+
> **limitSize**: `number`
|
|
2761
|
+
|
|
2762
|
+
限制的空间大小,单位 KB
|
|
2763
|
+
|
|
2764
|
+
<a id="getwindowinforesult"></a>
|
|
2765
|
+
### GetWindowInfoResult
|
|
2766
|
+
|
|
2767
|
+
#### Properties
|
|
2768
|
+
|
|
2769
|
+
##### pixelRatio
|
|
2770
|
+
|
|
2771
|
+
> **pixelRatio**: `number`
|
|
2772
|
+
|
|
2773
|
+
设备像素比
|
|
2774
|
+
|
|
2775
|
+
##### safeArea?
|
|
2776
|
+
|
|
2777
|
+
> `optional` **safeArea**: [`WindowSafeArea`](#windowsafearea)
|
|
2778
|
+
|
|
2779
|
+
安全区域
|
|
2780
|
+
|
|
2781
|
+
##### screenHeight
|
|
2782
|
+
|
|
2783
|
+
> **screenHeight**: `number`
|
|
2784
|
+
|
|
2785
|
+
屏幕高度
|
|
2786
|
+
|
|
2787
|
+
##### screenTop
|
|
2788
|
+
|
|
2789
|
+
> **screenTop**: `number`
|
|
2790
|
+
|
|
2791
|
+
窗口上边缘的 y 值
|
|
2792
|
+
|
|
2793
|
+
##### screenWidth
|
|
2794
|
+
|
|
2795
|
+
> **screenWidth**: `number`
|
|
2796
|
+
|
|
2797
|
+
屏幕宽度
|
|
2798
|
+
|
|
2799
|
+
##### statusBarHeight
|
|
2800
|
+
|
|
2801
|
+
> **statusBarHeight**: `number`
|
|
2802
|
+
|
|
2803
|
+
状态栏高度
|
|
2804
|
+
|
|
2805
|
+
##### windowHeight
|
|
2806
|
+
|
|
2807
|
+
> **windowHeight**: `number`
|
|
2808
|
+
|
|
2809
|
+
可使用窗口高度
|
|
2810
|
+
|
|
2811
|
+
##### windowWidth
|
|
2812
|
+
|
|
2813
|
+
> **windowWidth**: `number`
|
|
2814
|
+
|
|
2815
|
+
可使用窗口宽度
|
|
2816
|
+
|
|
2817
|
+
<a id="windowsafearea"></a>
|
|
2818
|
+
### WindowSafeArea
|
|
2819
|
+
|
|
2820
|
+
#### Properties
|
|
2821
|
+
|
|
2822
|
+
##### bottom
|
|
2823
|
+
|
|
2824
|
+
> **bottom**: `number`
|
|
2825
|
+
|
|
2826
|
+
安全区域右下角纵坐标
|
|
2827
|
+
|
|
2828
|
+
##### height
|
|
2829
|
+
|
|
2830
|
+
> **height**: `number`
|
|
2831
|
+
|
|
2832
|
+
安全区域高度
|
|
2833
|
+
|
|
2834
|
+
##### left
|
|
2835
|
+
|
|
2836
|
+
> **left**: `number`
|
|
2837
|
+
|
|
2838
|
+
安全区域左上角横坐标
|
|
2839
|
+
|
|
2840
|
+
##### right
|
|
2841
|
+
|
|
2842
|
+
> **right**: `number`
|
|
2843
|
+
|
|
2844
|
+
安全区域右下角横坐标
|
|
2845
|
+
|
|
2846
|
+
##### top
|
|
2847
|
+
|
|
2848
|
+
> **top**: `number`
|
|
2849
|
+
|
|
2850
|
+
安全区域左上角纵坐标
|
|
2851
|
+
|
|
2852
|
+
##### width
|
|
2853
|
+
|
|
2854
|
+
> **width**: `number`
|
|
2855
|
+
|
|
2856
|
+
安全区域宽度
|
|
2857
|
+
|
|
2858
|
+
<a id="getsystemsettingresult"></a>
|
|
2859
|
+
### GetSystemSettingResult
|
|
2860
|
+
|
|
2861
|
+
#### Properties
|
|
2862
|
+
|
|
2863
|
+
##### bluetoothEnabled
|
|
2864
|
+
|
|
2865
|
+
> **bluetoothEnabled**: `boolean`
|
|
2866
|
+
|
|
2867
|
+
蓝牙的系统开关
|
|
2868
|
+
|
|
2869
|
+
##### deviceOrientation
|
|
2870
|
+
|
|
2871
|
+
> **deviceOrientation**: [`DeviceOrientation`](#deviceorientation-1)
|
|
2872
|
+
|
|
2873
|
+
设备方向
|
|
2874
|
+
|
|
2875
|
+
##### locationEnabled
|
|
2876
|
+
|
|
2877
|
+
> **locationEnabled**: `boolean`
|
|
2878
|
+
|
|
2879
|
+
地理位置的系统开关
|
|
2880
|
+
|
|
2881
|
+
##### wifiEnabled
|
|
2882
|
+
|
|
2883
|
+
> **wifiEnabled**: `boolean`
|
|
2884
|
+
|
|
2885
|
+
Wi-Fi 的系统开关
|
|
2886
|
+
|
|
2887
|
+
<a id="deviceorientation-1"></a>
|
|
2888
|
+
<a id="deviceorientation"></a>
|
|
2889
|
+
### DeviceOrientation
|
|
2890
|
+
|
|
2891
|
+
> **DeviceOrientation**: `"portrait"` \| `"landscape"`
|
|
2892
|
+
|
|
2893
|
+
<a id="getappbaseinforesult"></a>
|
|
2894
|
+
### GetAppBaseInfoResult
|
|
2895
|
+
|
|
2896
|
+
#### Properties
|
|
2897
|
+
|
|
2898
|
+
##### SDKVersion?
|
|
2899
|
+
|
|
2900
|
+
> `optional` **SDKVersion**: `string`
|
|
2901
|
+
|
|
2902
|
+
客户端基础库版本
|
|
2903
|
+
|
|
2904
|
+
##### enableDebug?
|
|
2905
|
+
|
|
2906
|
+
> `optional` **enableDebug**: `boolean`
|
|
2907
|
+
|
|
2908
|
+
是否已打开调试
|
|
2909
|
+
|
|
2910
|
+
##### host?
|
|
2911
|
+
|
|
2912
|
+
> `optional` **host**: [`AppBaseInfoHost`](#appbaseinfohost)
|
|
2913
|
+
|
|
2914
|
+
当前豆包 App运行的宿主环境
|
|
2915
|
+
|
|
2916
|
+
##### language
|
|
2917
|
+
|
|
2918
|
+
> **language**: `string`
|
|
2919
|
+
|
|
2920
|
+
当前语言
|
|
2921
|
+
|
|
2922
|
+
##### theme?
|
|
2923
|
+
|
|
2924
|
+
> `optional` **theme**: `"light"` \| `"dark"`
|
|
2925
|
+
|
|
2926
|
+
当前主题
|
|
2927
|
+
|
|
2928
|
+
##### version?
|
|
2929
|
+
|
|
2930
|
+
> `optional` **version**: `string`
|
|
2931
|
+
|
|
2932
|
+
宿主版本号
|
|
2933
|
+
|
|
2934
|
+
<a id="appbaseinfohost"></a>
|
|
2935
|
+
### AppBaseInfoHost
|
|
2936
|
+
|
|
2937
|
+
#### Properties
|
|
2938
|
+
|
|
2939
|
+
##### appId
|
|
2940
|
+
|
|
2941
|
+
> **appId**: `string`
|
|
2942
|
+
|
|
2943
|
+
宿主 app 对应的 appId
|