utsUnicloudApiJson.json 40.3 KB
Newer Older
D
DCloud_LXH 已提交
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110
{
	"uniCloud_props": {
		"name": "# uniCloud",
		"description": "",
		"param": "## 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| config | [UniCloudInitOptions](#unicloudinitoptions-values) | 是 | - | - |\n### UniCloudInitOptions 属性值 @unicloudinitoptions-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| provider | string | 是 | - | 服务商,目前支持 aliyun、tencent |\n| spaceName | string | 否 | - | 服务空间名 |\n| spaceId | string | 是 | - | 服务空间id |\n| clientSecret | string | 否 | - | 阿里云clientSecret |\n| endpoint | string | 否 | - | 阿里云endpoint |\n",
		"returnValue": "",
		"compatibility": "",
		"tutorial": ""
	},
	"callFunction": {
		"name": "## callFunction(options) @callfunction",
		"description": "请求云函数",
		"param": "### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| options | [UniCloudCallFunctionOptions](#unicloudcallfunctionoptions-values) | 是 | - | - |\n#### UniCloudCallFunctionOptions 属性值 @unicloudcallfunctionoptions-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| name | string (string.CloudFunctionString) | 是 | - | 云函数名 |\n| data | any | 否 | - | 云函数参数 |\n",
		"returnValue": "### 返回值 \n\n| 类型 |\n| :- |\n| Promise<[UniCloudCallFunctionResult](#unicloudcallfunctionresult-values)> | \n\n#### UniCloudCallFunctionResult 属性值 @unicloudcallfunctionresult-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| result | any | 是 | - | 云函数参数 |\n| requestId | string | 否 | - | 云函数请求id |\n",
		"compatibility": "### callFunction 兼容性 \n| 安卓系统版本 | 安卓 uni-app | 安卓 uni-app-x | iOS 系统版本 | iOS uni-app | iOS uni-app-x |\n| :- | :- | :- | :- | :- | :- |\n| 5.0 | √ | 阿里云 3.9,腾讯云 3.91 | - | √ | x |\n",
		"tutorial": "\n### 参见\n[相关 Bug](https://issues.dcloud.net.cn/?mid=api.unicloud.unicloud-call-function.callFunction)\n"
	},
	"unicloud-call-function": {
		"example": "## 示例 \n> [hello uni-app x](https://gitcode.net/dcloud/hello-uni-app-x/-/blob/alpha/pages/API/unicloud-call-function/unicloud-call-function.uvue) \n ```html\n<template>\r\n  <!-- #ifdef APP -->\r\n  <scroll-view style=\"flex: 1\">\r\n  <!-- #endif -->\r\n    <view>\r\n      <page-head :title=\"title\"></page-head>\r\n      <view class=\"uni-padding-wrap uni-common-mt\">\r\n        <view class=\"uni-btn-v uni-common-mt\">\r\n          <button type=\"primary\" @click=\"callFunction\">请求云函数</button>\r\n        </view>\r\n      </view>\r\n    </view>\r\n  <!-- #ifdef APP -->\r\n  </scroll-view>\r\n  <!-- #endif -->\r\n</template>\r\n<script>\r\n  export default {\r\n    data() {\r\n      return {\r\n        title: '请求云函数',\r\n        callFunctionResult: {},\r\n        callFunctionError: {},\r\n        isUniTest: false\r\n      }\r\n    },\r\n    onLoad() {\r\n    },\r\n    onUnload() {\r\n      if(this.isUniTest){\r\n        uni.hideToast()\r\n      }\r\n    },\r\n    methods: {\r\n      notify(content : string, title : string) {\r\n        if (!this.isUniTest) {\r\n          uni.showModal({\r\n            title,\r\n            content,\r\n            showCancel: false\r\n          })\r\n        } else {\r\n          uni.showToast({\r\n            title: content\r\n          })\r\n        }\r\n      },\r\n      callFunction: function () {\r\n        uni.showLoading({\r\n          title: '加载中...'\r\n        })\r\n        uniCloud.callFunction({\r\n          name: 'echo-cf',\r\n          data: {\r\n            num: 1,\r\n            str: 'ABC'\r\n          }\r\n        }).then<void>(res => {\r\n          const result = res.result\r\n          this.callFunctionResult = result\r\n          console.log(JSON.stringify(result))\r\n          uni.hideLoading()\r\n          this.notify(result['showMessage'] as string, '提示')\r\n        }).catch<void>((err : any | null) => {\r\n          const error = err as UniCloudError\r\n          this.callFunctionError = {\r\n            errCode: error.errCode,\r\n            errMsg: error.errMsg\r\n          }\r\n          uni.hideLoading()\r\n          this.notify(error.errMsg, '错误')\r\n        })\r\n      }\r\n    }\r\n  }\r\n</script>\r\n\r\n<style>\r\n</style>\n```"
	},
	"importObject": {
		"name": "## importObject(objectName, options?) @importobject",
		"description": "引用云对象",
		"param": "### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| objectName | string (string.CloudObjectString) | 是 | - | - |\n| options | [UniCloudImportObjectOptions](#unicloudimportobjectoptions-values) | 否 | - | - |\n#### UniCloudImportObjectOptions 属性值 @unicloudimportobjectoptions-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| customUI | boolean | 否 | - | 是否移除自动展示的ui |\n| loadingOptions | [UniCloudImportObjectLoadingOptions](#unicloudimportobjectloadingoptions-values) | 否 | - | loading界面配置 |\n| errorOptions | [UniCloudImportObjectErrorOptions](#unicloudimportobjecterroroptions-values) | 否 | - | 错误提示配置 |\n\n##### UniCloudImportObjectLoadingOptions 属性值 @unicloudimportobjectloadingoptions-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| title | string | 否 | - | 加载框标题 |\n| mask | boolean | 否 | - | 加载框是否显示mask |\n\n##### UniCloudImportObjectErrorOptions 属性值 @unicloudimportobjecterroroptions-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| type | string | 否 | - | 错误提示类型,可以是modal或者toast |\n| retry | boolean | 否 | - | 是否显示重试按钮 |\n",
		"returnValue": "### 返回值 \n\n| 类型 |\n| :- |\n| any | \n",
		"compatibility": "### importObject 兼容性 \n| 安卓系统版本 | 安卓 uni-app | 安卓 uni-app-x | iOS 系统版本 | iOS uni-app | iOS uni-app-x |\n| :- | :- | :- | :- | :- | :- |\n| 5.0 | √ | 阿里云 3.9,腾讯云 3.91 | - | √ | x |\n",
		"tutorial": "\n### 参见\n[相关 Bug](https://issues.dcloud.net.cn/?mid=api.unicloud.unicloud-import-object.importObject)\n"
	},
	"unicloud-import-object": {
		"example": "## 示例 \n> [hello uni-app x](https://gitcode.net/dcloud/hello-uni-app-x/-/blob/alpha/pages/API/unicloud-import-object/unicloud-import-object.uvue) \n ```html\n<template>\r\n  <!-- #ifdef APP -->\r\n  <scroll-view style=\"flex:1\">\r\n  <!-- #endif -->\r\n    <view>\r\n      <page-head :title=\"title\"></page-head>\r\n      <view class=\"uni-padding-wrap uni-common-mt\">\r\n        <view class=\"uni-btn-v uni-common-mt\">\r\n          <button type=\"primary\" @tap=\"addTodo\">添加Todo</button>\r\n        </view>\r\n        <view class=\"uni-btn-v uni-common-mt\">\r\n          <button type=\"primary\" @tap=\"randomFail\">随机触发失败重试</button>\r\n        </view>\r\n        <view class=\"uni-btn-v uni-common-mt\">\r\n          <button type=\"primary\" @tap=\"fail\">云对象失败调用</button>\r\n        </view>\r\n        <view class=\"uni-btn-v uni-common-mt\">\r\n          <button type=\"primary\" @tap=\"success\">云对象成功调用</button>\r\n        </view>\r\n      </view>\r\n    </view>\r\n  <!-- #ifdef APP -->\r\n  </scroll-view>\r\n  <!-- #endif -->\r\n</template>\r\n\r\n<script>\r\n  export default {\r\n    data() {\r\n      return {\r\n        title: '请求云对象',\r\n        todoTitle: '学习编程',\r\n        todoContent: '熟悉uts语法',\r\n        returnTodoTitle: '',\r\n        returnTodoContent: '',\r\n        failErrCode: '',\r\n        successErrCode: -1,\r\n        isUniTest: false\r\n      }\r\n    },\r\n    onUnload() {\r\n      if(this.isUniTest){\r\n        uni.hideToast()\r\n      }\r\n    },\r\n    methods: {\r\n      notify(content : string, title : string) {\r\n        if (!this.isUniTest) {\r\n          uni.showModal({\r\n            title,\r\n            content,\r\n            showCancel: false\r\n          })\r\n        } else {\r\n          uni.showToast({\r\n            title: content\r\n          })\r\n        }\r\n      },\r\n      addTodo() {\r\n        const todo = uniCloud.importObject('todo', {\r\n          customUI: this.isUniTest\r\n        })\r\n        const title = this.todoTitle\r\n        const content = this.todoContent\r\n        todo.add(title, content).then<void>((res : UTSJSONObject) : void => {\r\n          this.returnTodoTitle = res['title'] as string\r\n          this.returnTodoContent = res['content'] as string\r\n          this.notify(res['showMessage'] as string, '提示')\r\n        }).catch<void>((err : any | null) : void => {\r\n          const error = err as UniCloudError\r\n          console.error(error)\r\n        })\r\n      },\r\n      randomFail() {\r\n        const todoObj = uniCloud.importObject('todo', {\r\n          errorOptions: {\r\n            retry: true\r\n          }\r\n        })\r\n        todoObj.randomFail().then<void>((res : UTSJSONObject) : void => {\r\n          this.notify(res['showMessage'] as string, '提示')\r\n        }).catch<void>((err : any | null) : void => {\r\n          const error = err as UniCloudError\r\n          console.error(error)\r\n        })\r\n      },\r\n      fail() {\r\n        const todo = uniCloud.importObject('todo', {\r\n          customUI: this.isUniTest\r\n        })\r\n        todo.fail().then<void>((res : UTSJSONObject) : void => {\r\n          this.notify('todo.fail应调用失败,此处错误的触发了成功回调', '错误')\r\n          console.log('todo.fail: ', res);\r\n        }).catch<void>((err : any | null) : void => {\r\n          const error = err as UniCloudError\r\n          this.failErrCode = error.errCode as string\r\n          console.error(error)\r\n          if (this.isUniTest) {\r\n            uni.showToast({\r\n              title: err.errMsg\r\n            })\r\n          }\r\n        })\r\n      },\r\n      success() {\r\n        const todo = uniCloud.importObject('todo', {\r\n          customUI: this.isUniTest\r\n        })\r\n        todo.success().then<void>((res : UTSJSONObject) : void => {\r\n          this.successErrCode = res['errCode'] as number\r\n          this.notify(res['showMessage'] as string, '提示')\r\n        }).catch<void>((err : any | null) : void => {\r\n          const error = err as UniCloudError\r\n          console.error(error)\r\n        })\r\n      }\r\n    }\r\n  }\r\n</script>\r\n\r\n<style>\r\n\r\n</style>\n```"
	},
	"uploadFile": {
		"name": "## uploadFile(options) @uploadfile",
		"description": "上传文件到云存储",
		"param": "### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| options | [UniCloudUploadFileOptions](#uniclouduploadfileoptions-values) | 是 | - | - |\n#### UniCloudUploadFileOptions 属性值 @uniclouduploadfileoptions-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| filePath | string | 是 | - | 文件路径 |\n| cloudPath | string | 是 | - | 云端路径 |\n| cloudPathAsRealPath | boolean | 否 | - | 是否以云端路径是否为真实路径保存上传的文件 |\n| onUploadProgress | (options: [UniCloudUploadProgress](#uniclouduploadprogress-values)) => any | 否 | - | 上传进度回调 |\n\n##### UniCloudUploadProgress 属性值 @uniclouduploadprogress-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| loaded | number | 是 | - | 已上传大小 |\n| total | number | 是 | - | 总大小 |\n",
		"returnValue": "### 返回值 \n\n| 类型 |\n| :- |\n| Promise<[UniCloudUploadFileResult](#uniclouduploadfileresult-values)> | \n\n#### UniCloudUploadFileResult 属性值 @uniclouduploadfileresult-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| filePath | string | 是 | - | 文件路径 |\n| fileID | string | 是 | - | 文件id |\n",
		"compatibility": "### uploadFile 兼容性 \n| 安卓系统版本 | 安卓 uni-app | 安卓 uni-app-x | iOS 系统版本 | iOS uni-app | iOS uni-app-x |\n| :- | :- | :- | :- | :- | :- |\n| 5.0 | √ | 阿里云 3.9,腾讯云 3.91 | - | √ | x |\n",
		"tutorial": "\n### 参见\n[相关 Bug](https://issues.dcloud.net.cn/?mid=api.unicloud.unicloud-file-api.upload-file)\n"
	},
	"getTempFileURL": {
		"name": "## getTempFileURL(options) @gettempfileurl",
		"description": "获取文件临时URL",
		"param": "### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| options | [UniCloudGetTempFileURLOptions](#unicloudgettempfileurloptions-values) | 是 | - | - |\n#### UniCloudGetTempFileURLOptions 属性值 @unicloudgettempfileurloptions-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| fileList | Array\\<string\\> | 是 | - | 文件列表 |\n",
		"returnValue": "### 返回值 \n\n| 类型 |\n| :- |\n| Promise<[UniCloudGetTempFileURLResult](#unicloudgettempfileurlresult-values)> | \n\n#### UniCloudGetTempFileURLResult 属性值 @unicloudgettempfileurlresult-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| fileList | Array\\<[UniCloudGetTempFileURLResultItem](#unicloudgettempfileurlresultitem-values)\\> | 是 | - | 文件列表 |\n\n##### UniCloudGetTempFileURLResultItem 属性值 @unicloudgettempfileurlresultitem-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| fileID | string | 是 | - | 文件id |\n| tempFileURL | string | 是 | - | 文件临时url |\n",
		"compatibility": "### getTempFileURL 兼容性 \n| 安卓系统版本 | 安卓 uni-app | 安卓 uni-app-x | iOS 系统版本 | iOS uni-app | iOS uni-app-x |\n| :- | :- | :- | :- | :- | :- |\n| 5.0 | √ | 阿里云 3.9,腾讯云 3.91 | - | √ | x |\n",
		"tutorial": "\n### 参见\n[相关 Bug](https://issues.dcloud.net.cn/?mid=api.unicloud.unicloud-file-api.choose-and-upload-file)\n"
	},
	"chooseAndUploadFile": {
		"name": "## chooseAndUploadFile(options) @chooseanduploadfile",
		"description": "选择并上传文件",
		"param": "### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| options | [UniCloudChooseAndUploadFileOptions](#unicloudchooseanduploadfileoptions-values) | 是 | - | - |\n#### UniCloudChooseAndUploadFileOptions 属性值 @unicloudchooseanduploadfileoptions-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| sourceType | Array\\<string\\> | 否 | - | - |\n| count | number | 否 | - | - |\n| sizeType | Array\\<string\\> | 否 | - | - |\n| extension | Array\\<string\\> | 否 | - | - |\n| compressed | boolean | 否 | - | - |\n| maxDuration | number | 否 | - | - |\n| camera | string | 否 | - | - |\n| crop | ChooseImageCropOptions | 否 | - | - |\n| type | string | 是 | - | - |\n| onChooseFile | (arg: [UniCloudChooseFileResult](#unicloudchoosefileresult-values)) => void | 否 | - | - |\n| onUploadProgress | (arg: [UniCloudChooseAndUploadFileProgressEvent](#unicloudchooseanduploadfileprogressevent-values)) => void | 否 | - | - |\n\n##### UniCloudChooseFileResult 属性值 @unicloudchoosefileresult-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| tempFiles | Array\\<[UniCloudChooseFileItem](#unicloudchoosefileitem-values)\\> | 是 | - | - |\n| tempFilePaths | Array\\<string\\> | 是 | - | - |\n\n###### UniCloudChooseFileItem 属性值 @unicloudchoosefileitem-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| name | string | 是 | - | - |\n| path | string | 是 | - | - |\n| cloudPath | string | 是 | - | - |\n| cloudPathAsRealPath | boolean | 否 | - | - |\n| url | string | 否 | - | - |\n| errMsg | string | 否 | - | - |\n\n##### UniCloudChooseAndUploadFileProgressEvent 属性值 @unicloudchooseanduploadfileprogressevent-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| index | number | 是 | - | - |\n| loaded | number | 是 | - | - |\n| total | number | 是 | - | - |\n| tempFilePath | string | 是 | - | - |\n| tempFile | [UniCloudChooseFileItem](#unicloudchoosefileitem-values) | 是 | - | - |\n",
		"returnValue": "### 返回值 \n\n| 类型 |\n| :- |\n| Promise<[UniCloudChooseAndUploadFileResult](#unicloudchooseanduploadfileresult-values)> | \n\n#### UniCloudChooseAndUploadFileResult 属性值 @unicloudchooseanduploadfileresult-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| tempFiles | Array\\<[UniCloudChooseFileItem](#unicloudchoosefileitem-values)\\> | 是 | - | - |\n| tempFilePaths | Array\\<string\\> | 是 | - | - |\n\n##### UniCloudChooseFileItem 属性值 @unicloudchoosefileitem-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| name | string | 是 | - | - |\n| path | string | 是 | - | - |\n| cloudPath | string | 是 | - | - |\n| cloudPathAsRealPath | boolean | 否 | - | - |\n| url | string | 否 | - | - |\n| errMsg | string | 否 | - | - |\n",
		"compatibility": "### chooseAndUploadFile 兼容性 \n| 安卓系统版本 | 安卓 uni-app | 安卓 uni-app-x | iOS 系统版本 | iOS uni-app | iOS uni-app-x |\n| :- | :- | :- | :- | :- | :- |\n| 5.0 | √ | 阿里云 3.9,腾讯云 3.91 | - | √ | x |\n",
		"tutorial": "\n### 参见\n[相关 Bug](https://issues.dcloud.net.cn/?mid=api.unicloud.unicloud-file-api.getTempFileURL)\n"
	},
	"unicloud-file-api": {
		"example": "## 示例 \n> [hello uni-app x](https://gitcode.net/dcloud/hello-uni-app-x/-/blob/alpha/pages/API/unicloud-file-api/unicloud-file-api.uvue) \n ```html\n<template>\r\n  <!-- #ifdef APP -->\r\n  <scroll-view style=\"flex: 1\">\r\n  <!-- #endif -->\r\n    <view>\r\n      <page-head :title=\"title\"></page-head>\r\n      <view class=\"uni-padding-wrap uni-common-mt\">\r\n        <view class=\"uni-btn-v uni-common-mt\">\r\n          <button type=\"primary\" @click=\"uploadFile\">选择文件上传</button>\r\n        </view>\r\n      </view>\r\n    </view>\r\n  <!-- #ifdef APP -->\r\n  </scroll-view>\r\n  <!-- #endif -->\r\n</template>\r\n<script>\r\n  export default {\r\n    data() {\r\n      return {\r\n        title: '云存储'\r\n      }\r\n    },\r\n    onLoad() {\r\n    },\r\n    onUnload() {\r\n    },\r\n    methods: {\r\n      uploadFile: function () {\r\n        uni.chooseImage({\r\n          count: 1,\r\n          success(res) : void {\r\n            uni.showLoading({\r\n              title: '上传中...'\r\n            })\r\n            const tempFilePath = res.tempFilePaths[0]\r\n            uniCloud.uploadFile({\r\n              filePath: tempFilePath,\r\n              cloudPath: 'test.jpg'\r\n            })\r\n              .then<void>(function (res) {\r\n                uni.hideLoading()\r\n                console.log(res)\r\n                uni.showModal({\r\n                  content: '上传成功',\r\n                  showCancel: false\r\n                });\r\n              })\r\n              .catch<void>(function (err : any | null) {\r\n                uni.hideLoading()\r\n                const error = err as UniCloudError\r\n                uni.showModal({\r\n                  content: '上传失败,' + error.errMsg,\r\n                  showCancel: false\r\n                });\r\n              })\r\n            // .finally((_: number) : void => {\r\n            //   uni.hideLoading()\r\n            // })\r\n          },\r\n          fail(err) : void {\r\n            console.error('chooseImage fail: ', err)\r\n          }\r\n        })\r\n      }\r\n    }\r\n  }\r\n</script>\r\n\r\n<style>\r\n</style>\n```"
	},
	"databaseForJQL": {
		"name": "## databaseForJQL() @databaseforjql",
		"description": "获取数据库操作实例",
		"param": "",
		"returnValue": "### 返回值 \n\n| 类型 |\n| :- |\n| [Database](#database-values) | \n\n#### Database 属性值 @database-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| collection | (args?: Array\\<any\\>) => [Collection](#collection-values) | 是 | - | - |\n| command | any | 是 | - | - |\n| Geo | any | 是 | - | - |\n\n##### Collection 属性值 @collection-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| where | (condition: any) => [UniCloudDBFilter](#uniclouddbfilter-values) | 是 | - | - |\n| doc | (docId: string) => [UniCloudDBFilter](#uniclouddbfilter-values) | 是 | - | - |\n| aggregate | () => [UniCloudDBFilter](#uniclouddbfilter-values) | 是 | - | - |\n| foreignKey | (foreignKey: string) => [UniCloudDBFilter](#uniclouddbfilter-values) | 是 | - | - |\n| add | (data: any) => Promise<[UniCloudDBAddResult](#uniclouddbaddresult-values)> | 是 | - | - |\n| get | (arg?: any) => Promise<[UniCloudDBGetResult](#uniclouddbgetresult-values)> | 是 | - | - |\n| count | () => Promise<[UniCloudDBCountResult](#uniclouddbcountresult-values)> | 是 | - | - |\n| getTemp | () => any | 是 | - | - |\n| field | (filed: string) => [UniCloudDBQuery](#uniclouddbquery-values) | 是 | - | - |\n| skip | (num: number) => [UniCloudDBQuery](#uniclouddbquery-values) | 是 | - | - |\n| limit | (num: number) => [UniCloudDBQuery](#uniclouddbquery-values) | 是 | - | - |\n| orderBy | (order: string) => [UniCloudDBQuery](#uniclouddbquery-values) | 是 | - | - |\n\n###### UniCloudDBFilter 属性值 @uniclouddbfilter-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| get | (arg?: any) => Promise<[UniCloudDBGetResult](#uniclouddbgetresult-values)> | 是 | - | - |\n| count | () => Promise<[UniCloudDBCountResult](#uniclouddbcountresult-values)> | 是 | - | - |\n| update | (data: any) => Promise<[UniCloudDBUpdateResult](#uniclouddbupdateresult-values)> | 是 | - | - |\n| remove | () => Promise<[UniCloudDBRemoveResult](#uniclouddbremoveresult-values)> | 是 | - | - |\n| getTemp | () => any | 是 | - | - |\n| where | (condition: any) => [UniCloudDBFilter](#uniclouddbfilter-values) | 是 | - | - |\n| doc | (docId: string) => [UniCloudDBFilter](#uniclouddbfilter-values) | 是 | - | - |\n| field | (filed: string) => [UniCloudDBQuery](#uniclouddbquery-values) | 是 | - | - |\n| skip | (num: number) => [UniCloudDBQuery](#uniclouddbquery-values) | 是 | - | - |\n| limit | (num: number) => [UniCloudDBQuery](#uniclouddbquery-values) | 是 | - | - |\n| orderBy | (order: string) => [UniCloudDBQuery](#uniclouddbquery-values) | 是 | - | - |\n| groupBy | (field: string) => [UniCloudDBQuery](#uniclouddbquery-values) | 是 | - | - |\n| groupField | (field: string) => [UniCloudDBQuery](#uniclouddbquery-values) | 是 | - | - |\n| distinct | (field: string) => [UniCloudDBQuery](#uniclouddbquery-values) | 是 | - | - |\n| geoNear | (options: any) => [UniCloudDBQuery](#uniclouddbquery-values) | 是 | - | - |\n\n###### UniCloudDBGetResult 属性值 @uniclouddbgetresult-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| data | Array\\<any\\> | 是 | - | tResult = {     /** |\n| count | number | 否 | - | SONObject>;     /** |\n| requestId | string | 否 | - | ber \\| null;     / |\n\n###### UniCloudDBCountResult 属性值 @uniclouddbcountresult-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| total | number | 是 | - | tResult = {     /** |\n| requestId | string | 否 | - | al: number;     / |\n\n###### UniCloudDBUpdateResult 属性值 @uniclouddbupdateresult-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| updated | number | 是 | - | eResult = {     /** |\n| requestId | string | 否 | - | ed: number;     / |\n\n###### UniCloudDBRemoveResult 属性值 @uniclouddbremoveresult-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| deleted | number | 是 | - | eResult = {     /** |\n| requestId | string | 否 | - | ed: number;     / |\n\n###### UniCloudDBQuery 属性值 @uniclouddbquery-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| get | (arg?: any) => Promise<[UniCloudDBGetResult](#uniclouddbgetresult-values)> | 是 | - | - |\n| count | () => Promise<[UniCloudDBCountResult](#uniclouddbcountresult-values)> | 是 | - | - |\n| getTemp | () => any | 是 | - | - |\n| field | (filed: string) => [UniCloudDBQuery](#uniclouddbquery-values) | 是 | - | - |\n| skip | (num: number) => [UniCloudDBQuery](#uniclouddbquery-values) | 是 | - | - |\n| limit | (num: number) => [UniCloudDBQuery](#uniclouddbquery-values) | 是 | - | - |\n| orderBy | (order: string) => [UniCloudDBQuery](#uniclouddbquery-values) | 是 | - | - |\n| groupBy | (field: string) => [UniCloudDBQuery](#uniclouddbquery-values) | 是 | - | - |\n| groupField | (field: string) => [UniCloudDBQuery](#uniclouddbquery-values) | 是 | - | - |\n| distinct | (field: string) => [UniCloudDBQuery](#uniclouddbquery-values) | 是 | - | - |\n| geoNear | (options: any) => [UniCloudDBQuery](#uniclouddbquery-values) | 是 | - | - |\n\n###### UniCloudDBAddResult 属性值 @uniclouddbaddresult-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| id | string | 是 | - | dResult = {     /** |\n| requestId | string | 否 | - | string;     / |\n",
		"compatibility": "### databaseForJQL 兼容性 \n| 安卓系统版本 | 安卓 uni-app | 安卓 uni-app-x | iOS 系统版本 | iOS uni-app | iOS uni-app-x |\n| :- | :- | :- | :- | :- | :- |\n| 5.0 | √ | 阿里云 3.91,腾讯云 3.91 | - | √ | x |\n",
		"tutorial": "\n### 参见\n[相关 Bug](https://issues.dcloud.net.cn/?mid=api.unicloud.unicloud-database.databaseForJQL)\n"
	},
	"unicloud-database": {
		"example": "## 示例 \n> [hello uni-app x](https://gitcode.net/dcloud/hello-uni-app-x/-/blob/alpha/pages/API/unicloud-database/unicloud-database.uvue) \n ```html\n<template>\r\n  <!-- #ifdef APP -->\r\n  <scroll-view style=\"flex: 1\">\r\n  <!-- #endif -->\r\n    <view>\r\n      <page-head :title=\"title\"></page-head>\r\n      <view class=\"uni-padding-wrap uni-common-mt\">\r\n        <view class=\"uni-btn-v uni-common-mt\">\r\n          <button type=\"primary\" @click=\"dbAdd\">新增单条数据</button>\r\n          <button type=\"primary\" @click=\"dbBatchAdd\">新增多条数据</button>\r\n          <button type=\"primary\" @click=\"dbUpdate\">更新数据</button>\r\n          <button type=\"primary\" @click=\"dbGet\">where传字符串获取数据</button>\r\n          <button type=\"primary\" @click=\"dbGetWithCommand\">where传对象获取数据</button>\r\n          <button type=\"primary\" @click=\"dbRemove\">删除数据</button>\r\n          <button type=\"primary\" @click=\"dbLookupInit\">初始化联表查询数据</button>\r\n          <button type=\"primary\" @click=\"dbLookup\">联表查询</button>\r\n        </view>\r\n      </view>\r\n    </view>\r\n  <!-- #ifdef APP -->\r\n  </scroll-view>\r\n  <!-- #endif -->\r\n</template>\r\n<script>\r\n  export default {\r\n    data() {\r\n      return {\r\n        title: 'ClientDB',\r\n        addId: '',\r\n        batchAddIds: [] as Array<string>,\r\n        batchAddinserted: 0,\r\n        updateUpdated: 0,\r\n        getData: [] as Array<UTSJSONObject>,\r\n        getWithCommandData: [] as Array<UTSJSONObject>,\r\n        removeDeleted: 0,\r\n        lookupData: [] as Array<UTSJSONObject>,\r\n        isUniTest: false\r\n      }\r\n    },\r\n    onLoad() {\r\n    },\r\n    onUnload() {\r\n      if(this.isUniTest){\r\n        uni.hideToast()\r\n      }\r\n    },\r\n    methods: {\r\n      notify(content : string, title : string) {\r\n        if (!this.isUniTest) {\r\n          uni.showModal({\r\n            title,\r\n            content,\r\n            showCancel: false\r\n          })\r\n        } else {\r\n          uni.showToast({\r\n            title: content\r\n          })\r\n        }\r\n      },\r\n      dbAdd: function () {\r\n        uni.showLoading({\r\n          title: '加载中...'\r\n        })\r\n        const db = uniCloud.databaseForJQL()\r\n        db.collection('type')\r\n          .add({\r\n            num: 1,\r\n            tag: 'default-tag',\r\n            date: new Date(),\r\n            point: new db.Geo.Point(116, 38)\r\n          })\r\n          .then<void>(res => {\r\n            uni.hideLoading()\r\n            console.log(res)\r\n            this.addId = res.id\r\n            this.notify(`新增成功,id: ${res.id}`, '提示')\r\n          })\r\n          .catch<void>((err : any | null) => {\r\n            uni.hideLoading()\r\n            const error = err as UniCloudError\r\n            this.notify(error.errMsg, '错误')\r\n          })\r\n      },\r\n      dbBatchAdd() {\r\n        uni.showLoading({\r\n          title: '加载中...'\r\n        })\r\n        const db = uniCloud.databaseForJQL()\r\n        db.collection('type')\r\n          .add([{\r\n            num: 2,\r\n            tag: 'default-tag',\r\n          }, {\r\n            num: 3,\r\n            tag: 'default-tag',\r\n          }])\r\n          .then<void>((res) => {\r\n            uni.hideLoading()\r\n            console.log(res)\r\n            console.log('JSON.stringify(res.inserted)', JSON.stringify(res.inserted))\r\n            this.batchAddIds = res.ids\r\n            this.batchAddinserted = res.inserted\r\n            this.notify(`新增成功条数${res.inserted}, id列表: ${res.ids.join(',')}`, '提示')\r\n          })\r\n          .catch<void>((err : any | null) => {\r\n            uni.hideLoading()\r\n            const error = err as UniCloudError\r\n            this.notify(error.errMsg, '错误')\r\n          })\r\n      },\r\n      dbGet() {\r\n        uni.showLoading({\r\n          title: '加载中...'\r\n        })\r\n        const db = uniCloud.databaseForJQL()\r\n        db.collection('type')\r\n          .where(\r\n            'tag == \"default-tag\"'\r\n          )\r\n          .field('num, tag')\r\n          .orderBy('num desc')\r\n          .skip(1)\r\n          .limit(2)\r\n          .get()\r\n          .then<void>(res => {\r\n            uni.hideLoading()\r\n            console.log(res)\r\n            this.getData = res.data\r\n            this.notify(`获取成功,取到了${res.data.length}条数据`, '提示')\r\n          })\r\n          .catch<void>((err : any | null) => {\r\n            uni.hideLoading()\r\n            const error = err as UniCloudError\r\n            this.notify(error.errMsg, '错误')\r\n          })\r\n      },\r\n      dbGetWithCommand() {\r\n        uni.showLoading({\r\n          title: '加载中...'\r\n        })\r\n        const db = uniCloud.databaseForJQL()\r\n        db.collection('type')\r\n          .where({\r\n            num: db.command.gt(1)\r\n          })\r\n          .field('num, tag')\r\n          .orderBy('num desc')\r\n          .skip(1)\r\n          .limit(2)\r\n          .get()\r\n          .then<void>(res => {\r\n            uni.hideLoading()\r\n            console.log(res)\r\n            this.getWithCommandData = res.data\r\n            this.notify(`获取成功,取到了${res.data.length}条数据`, '提示')\r\n          })\r\n          .catch<void>((err : any | null) => {\r\n            uni.hideLoading()\r\n            const error = err as UniCloudError\r\n            this.notify(error.errMsg, '错误')\r\n          })\r\n      },\r\n      dbUpdate() {\r\n        uni.showLoading({\r\n          title: '加载中...'\r\n        })\r\n        const db = uniCloud.databaseForJQL()\r\n        db.collection('type')\r\n          .where(\r\n            'tag == \"default-tag\"'\r\n          )\r\n          .update({\r\n            num: 4\r\n          })\r\n          .then<void>(res => {\r\n            uni.hideLoading()\r\n            console.log(res)\r\n            this.updateUpdated = res.updated\r\n            this.notify(`更新成功,更新了${res.updated}条数据`, '提示')\r\n          })\r\n          .catch<void>((err : any | null) => {\r\n            uni.hideLoading()\r\n            const error = err as UniCloudError\r\n            this.notify(error.errMsg, '错误')\r\n          })\r\n      },\r\n      dbRemove() {\r\n        uni.showLoading({\r\n          title: '加载中...'\r\n        })\r\n        const db = uniCloud.databaseForJQL()\r\n        db.collection('type')\r\n          .where(\r\n            'tag == \"default-tag\"'\r\n          )\r\n          .remove()\r\n          .then<void>(res => {\r\n            uni.hideLoading()\r\n            console.log(res)\r\n            this.removeDeleted = res.deleted\r\n            this.notify(`删除成功,删掉了${res.deleted}条数据`, '提示')\r\n          })\r\n          .catch<void>((err : any | null) => {\r\n            uni.hideLoading()\r\n            const error = err as UniCloudError\r\n            this.notify(error.errMsg, '错误')\r\n          })\r\n      },\r\n      dbLookupInit() {\r\n        uni.showLoading({\r\n          title: '加载中...'\r\n        })\r\n        const db = uniCloud.databaseForJQL()\r\n        db.collection('local')\r\n          .where('tag == \"default-tag\"')\r\n          .remove()\r\n          .then(() : Promise<UniCloudDBRemoveResult> => {\r\n            return db.collection('foreign')\r\n              .where('tag == \"default-tag\"')\r\n              .remove()\r\n          })\r\n          .then(() : Promise<UniCloudDBBatchAddResult> => {\r\n            return db.collection('local')\r\n              .add([{\r\n                id: \"local_1\",\r\n                name: \"local_1_name\",\r\n                tag: \"default-tag\",\r\n                foreign_id: \"foreign_1\"\r\n              }, {\r\n                id: \"local_2\",\r\n                name: \"local_2_name\",\r\n                tag: \"default-tag\",\r\n                foreign_id: \"foreign_2\"\r\n              }])\r\n          })\r\n          .then(() : Promise<UniCloudDBBatchAddResult> => {\r\n            return db.collection('foreign')\r\n              .add([{\r\n                id: \"foreign_1\",\r\n                name: \"foreign_1_name\",\r\n                tag: \"default-tag\"\r\n              }, {\r\n                id: \"foreign_2\",\r\n                name: \"foreign_2_name\",\r\n                tag: \"default-tag\"\r\n              }])\r\n          })\r\n          .then<void>((_) : void => {\r\n            uni.hideLoading()\r\n            this.notify('数据初始化成功', '提示')\r\n          })\r\n          .catch<void>((err : any | null) => {\r\n            uni.hideLoading()\r\n            console.error(err)\r\n            const error = err as UniCloudError\r\n            this.notify(error.errMsg, '错误')\r\n          })\r\n      },\r\n      dbLookup() {\r\n        uni.showLoading({\r\n          title: '加载中...'\r\n        })\r\n        const db = uniCloud.databaseForJQL()\r\n        const local = db.collection('local')\r\n          .where('tag == \"default-tag\"')\r\n          .getTemp()\r\n        const foreign = db.collection('foreign')\r\n          .where('tag == \"default-tag\"')\r\n          .getTemp()\r\n        db.collection(local, foreign)\r\n          .get()\r\n          .then<void>(res => {\r\n            uni.hideLoading()\r\n            console.log(res)\r\n            this.lookupData = res.data\r\n            this.notify(`联表查询成功,取到了${res.data.length}条数据`, '提示')\r\n          })\r\n          .catch<void>((err : any | null) => {\r\n            uni.hideLoading()\r\n            const error = err as UniCloudError\r\n            this.notify(error.errMsg, '错误')\r\n          })\r\n      }\r\n    }\r\n  }\r\n</script>\r\n\r\n<style>\r\n</style>\n```"
	},
	"onResponse": {
		"name": "## onResponse(callback) @onresponse",
		"description": "监听响应事件",
		"param": "### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| callback | (arg: [UniCloudResponseEvent](#unicloudresponseevent-values)) => any | 是 | - | - |\n#### UniCloudResponseEvent 属性值 @unicloudresponseevent-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| type | string | 是 | - | 响应事件类型 |\n| name | string | 是 | - | 响应事件由哪个云函数触发 |\n| content | any | 是 | - | 响应结果、错误内容 |\n",
		"returnValue": "",
		"compatibility": "### onResponse 兼容性 \n| 安卓系统版本 | 安卓 uni-app | 安卓 uni-app-x | iOS 系统版本 | iOS uni-app | iOS uni-app-x |\n| :- | :- | :- | :- | :- | :- |\n| 5.0 | √ | 阿里云 3.9,腾讯云 3.91 | - | √ | x |\n",
		"tutorial": "\n### 参见\n[相关 Bug](https://issues.dcloud.net.cn/?mid=api.unicloud.unicloud-utils.get-current-user-info)\n"
	},
	"offResponse": {
		"name": "## offResponse(callback) @offresponse",
		"description": "移除响应事件监听",
		"param": "### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| callback | (arg: [UniCloudResponseEvent](#unicloudresponseevent-values)) => any | 是 | - | - |\n#### UniCloudResponseEvent 属性值 @unicloudresponseevent-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| type | string | 是 | - | 响应事件类型 |\n| name | string | 是 | - | 响应事件由哪个云函数触发 |\n| content | any | 是 | - | 响应结果、错误内容 |\n",
		"returnValue": "",
		"compatibility": "### offResponse 兼容性 \n| 安卓系统版本 | 安卓 uni-app | 安卓 uni-app-x | iOS 系统版本 | iOS uni-app | iOS uni-app-x |\n| :- | :- | :- | :- | :- | :- |\n| 5.0 | √ | 阿里云 3.9,腾讯云 3.91 | - | √ | x |\n",
		"tutorial": "\n### 参见\n[相关 Bug](https://issues.dcloud.net.cn/?mid=api.unicloud.unicloud-utils.on-response)\n"
	},
	"onRefreshToken": {
		"name": "## onRefreshToken(callback) @onrefreshtoken",
		"description": "监听token刷新事件",
		"param": "### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| callback | (arg: [UniCloudResponseEvent](#unicloudresponseevent-values)) => any | 是 | - | - |\n#### UniCloudResponseEvent 属性值 @unicloudresponseevent-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| type | string | 是 | - | 响应事件类型 |\n| name | string | 是 | - | 响应事件由哪个云函数触发 |\n| content | any | 是 | - | 响应结果、错误内容 |\n",
		"returnValue": "",
		"compatibility": "### onRefreshToken 兼容性 \n| 安卓系统版本 | 安卓 uni-app | 安卓 uni-app-x | iOS 系统版本 | iOS uni-app | iOS uni-app-x |\n| :- | :- | :- | :- | :- | :- |\n| 5.0 | √ | 阿里云 3.9,腾讯云 3.91 | - | √ | x |\n",
		"tutorial": "\n### 参见\n[相关 Bug](https://issues.dcloud.net.cn/?mid=api.unicloud.unicloud-utils.off-response)\n"
	},
	"offRefreshToken": {
		"name": "## offRefreshToken(callback) @offrefreshtoken",
		"description": "移除token刷新事件监听",
		"param": "### 参数 \n\n| 名称 | 类型 | 必填 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| callback | (arg: [UniCloudResponseEvent](#unicloudresponseevent-values)) => any | 是 | - | - |\n#### UniCloudResponseEvent 属性值 @unicloudresponseevent-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| type | string | 是 | - | 响应事件类型 |\n| name | string | 是 | - | 响应事件由哪个云函数触发 |\n| content | any | 是 | - | 响应结果、错误内容 |\n",
		"returnValue": "",
		"compatibility": "### offRefreshToken 兼容性 \n| 安卓系统版本 | 安卓 uni-app | 安卓 uni-app-x | iOS 系统版本 | iOS uni-app | iOS uni-app-x |\n| :- | :- | :- | :- | :- | :- |\n| 5.0 | √ | 阿里云 3.9,腾讯云 3.91 | - | √ | x |\n",
		"tutorial": "\n### 参见\n[相关 Bug](https://issues.dcloud.net.cn/?mid=api.unicloud.unicloud-utils.on-refresh-token)\n"
	},
	"getCurrentUserInfo": {
		"name": "## getCurrentUserInfo() @getcurrentuserinfo",
		"description": "获取token内缓存的用户信息",
		"param": "",
		"returnValue": "### 返回值 \n\n| 类型 |\n| :- |\n| [UniCloudUserInfo](#uniclouduserinfo-values) | \n\n#### UniCloudUserInfo 属性值 @uniclouduserinfo-values \n\n| 名称 | 类型 | 必备 | 默认值 | 描述 |\n| :- | :- | :- | :- | :- |\n| uid | string | 否 | - | serInfo = {     / |\n| role | Array\\<string\\> | 是 | - | ing \\| null;     /** |\n| permission | Array\\<string\\> | 是 | - | ay\\<string>;     /** |\n| tokenExpired | number | 是 | - | ay\\<string>;     /** |\n",
		"compatibility": "### getCurrentUserInfo 兼容性 \n| 安卓系统版本 | 安卓 uni-app | 安卓 uni-app-x | iOS 系统版本 | iOS uni-app | iOS uni-app-x |\n| :- | :- | :- | :- | :- | :- |\n| 5.0 | √ | 阿里云 3.9,腾讯云 3.91 | - | √ | x |\n",
		"tutorial": "\n### 参见\n[相关 Bug](https://issues.dcloud.net.cn/?mid=api.unicloud.unicloud-utils.off-refresh-token)\n"
	}
}