-
Notifications
You must be signed in to change notification settings - Fork 200
06 云端配置
MIOT 云端提供的暂存服务
Export: public
Doc_name: 云端配置
Doc_index: 6
Doc_directory: service
-
miot/service/storage
-
~ICloudStorage
.getUserConfigs(componentId, ...keys) ⇒Promise.getThirdUserConfigs(model, ...keys).setUserConfigs(componentId, data) ⇒Promise.setThirdUserConfigs(model, key, data)-
.setThirdUserConfigsForOneKey(model, key, data) ⇒
[ 'Rromise' ].<any> -
.getThirdUserConfigsForOneKey(model, key) ⇒
[ 'Promise' ].<any> -
._convertParamsForThirdUserConfig(model, key, data) ⇒
*
-
~ICloudStorage
Kind: inner interface of miot/service/storage
-
~ICloudStorage
.getUserConfigs(componentId, ...keys) ⇒Promise.getThirdUserConfigs(model, ...keys).setUserConfigs(componentId, data) ⇒Promise.setThirdUserConfigs(model, key, data)-
.setThirdUserConfigsForOneKey(model, key, data) ⇒
[ 'Rromise' ].<any> -
.getThirdUserConfigsForOneKey(model, key) ⇒
[ 'Promise' ].<any> -
._convertParamsForThirdUserConfig(model, key, data) ⇒
*
Deprecated
读取米家的用户配置信息 /user/get_user_config(获取/user/set_user_config写入的用户配置)
Kind: instance method of ICloudStorage
Returns: Promise - key,value结构数据
| Param | Type | Description |
|---|---|---|
| componentId | number |
厂商APP_ID(Cloud ID),需要向小米申请, 0 和 1 预留 |
| ...keys | number |
保存的数据索引,从0开始 |
Example
getUserConfigs(componentId, k1,k2,k3).then(res => {...})Deprecated
读取三方数据,该接口读取厂商的用户配置信息 /user/get_third_user_config,对应的写的接口为:set_third_user_config。
Kind: instance method of ICloudStorage
| Param | Type | Description |
|---|---|---|
| model | string |
设备Model |
| ...keys | number |
根据key获取配置,如果不传keys 返回用户该厂商的所有配置 |
Example
getThirdUserConfigs(model, k1,k2,k3).then(res => {...})Deprecated
写数据 /user/set_user_config
Kind: instance method of ICloudStorage
| Param | Type | Description |
|---|---|---|
| componentId | string |
厂商APP_ID(Cloud ID),需要向小米申请,0和1预留 |
| data | * |
key,value结构数据 |
Deprecated
写数据 /user/set_user_config, data的数据量不能超过2048字节
Kind: instance method of ICloudStorage
| Param | Type |
|---|---|
| model | string |
| key | number |
| data | json |
写数据 /user/set_user_config 创建或修改设置插件自由存储空间。如果数据超过服务器设置的阈值,自动分段存储到云端。 但是分段存储会占用额外的key,比如key=100时,分出的新段会存储在101,102,103...等后续相邻的key上, 因此如果插件方需要存储多个key-value,建议多个key之间相差较大
Kind: instance method of ICloudStorage
Returns: [ 'Rromise' ].<any> - Promise
成功时:true
失败时:{"code":xxx, "message":"xxx" }
Since: 10023
| Param | Type |
|---|---|
| model | string |
| key | number |
| data | json |
与setThirdUserConfigsForOneKey配套使用,会把分段的数据自动合并后返回,使得分段行为对调用者透明
Kind: instance method of ICloudStorage
Returns: [ 'Promise' ].<any> - 成功时:{key:xxx, data:xxx} data 为set时的数据
失败时:{"code":xxx, "message":"xxx" }
Since: 10023
| Param |
|---|
| model |
| key |
需要考虑存储数据的大小,数据量太大需要分段存储
Kind: instance method of ICloudStorage
Returns: * - datas:[]
| Param |
|---|
| model |
| key |
| data |