@ray-js/api 1.5.0-beta.11 → 1.5.0
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/@types/BaseKit.d.ts +246 -126
- package/@types/BizKit.d.ts +1 -1
- package/@types/MapKit.d.ts +237 -1
- package/@types/MiniKit.d.ts +1 -1
- package/@types/OutdoorKit.d.ts +232 -0
- package/@types/P2PKit.d.ts +24 -2
- package/@types/all-kits.d.ts +1 -0
- package/@types/api-extend.d.ts +8 -2
- package/@types/index.d.ts +87 -0
- package/lib/{BaseKit-3.3.10.d.ts → BaseKit-3.11.0.d.ts} +1 -0
- package/lib/{BaseKit-3.3.10.js → BaseKit-3.11.0.js} +6 -2
- package/lib/BizKit-3.2.7.js +2 -1
- package/lib/DeviceKit-3.3.1.js +2 -1
- package/lib/HomeKit-3.1.4.js +2 -1
- package/lib/{MapKit-3.0.7.d.ts → MapKit-3.4.13.d.ts} +5 -0
- package/lib/{MapKit-3.0.7.js → MapKit-3.4.13.js} +19 -1
- package/lib/MiniKit-3.1.0.js +3 -2
- package/lib/OutdoorKit-1.0.4.d.ts +14 -0
- package/lib/OutdoorKit-1.0.4.js +39 -0
- package/lib/P2PKit-2.0.3.d.ts +1 -0
- package/lib/P2PKit-2.0.3.js +5 -1
- package/lib/PlayNetKit-1.1.3.d.ts +24 -25
- package/lib/PlayNetKit-1.1.3.js +2 -1
- package/lib/all-kits.d.ts +3 -2
- package/lib/all-kits.js +3 -2
- package/lib/cloud/device.d.ts +25 -1
- package/lib/cloud/device.js +15 -1
- package/lib/cloud/doorlock/README.md +62 -0
- package/lib/cloud/doorlock/auth.d.ts +235 -0
- package/lib/cloud/doorlock/auth.js +223 -0
- package/lib/cloud/doorlock/auth.md +323 -0
- package/lib/cloud/doorlock/device.d.ts +137 -0
- package/lib/cloud/doorlock/device.js +187 -0
- package/lib/cloud/doorlock/device.md +265 -0
- package/lib/cloud/doorlock/index.d.ts +10 -0
- package/lib/cloud/doorlock/index.js +20 -0
- package/lib/cloud/doorlock/log.d.ts +113 -0
- package/lib/cloud/doorlock/log.js +53 -0
- package/lib/cloud/doorlock/log.md +153 -0
- package/lib/cloud/doorlock/member-opmode.d.ts +121 -0
- package/lib/cloud/doorlock/member-opmode.js +104 -0
- package/lib/cloud/doorlock/member-opmode.md +279 -0
- package/lib/cloud/doorlock/member.d.ts +110 -0
- package/lib/cloud/doorlock/member.js +72 -0
- package/lib/cloud/doorlock/member.md +276 -0
- package/lib/cloud/doorlock/offline-pwd.d.ts +61 -0
- package/lib/cloud/doorlock/offline-pwd.js +67 -0
- package/lib/cloud/doorlock/offline-pwd.md +155 -0
- package/lib/cloud/doorlock/old.d.ts +36 -0
- package/lib/cloud/doorlock/old.js +102 -0
- package/lib/cloud/doorlock/temp-pwd.d.ts +194 -0
- package/lib/cloud/doorlock/temp-pwd.js +193 -0
- package/lib/cloud/doorlock/temp-pwd.md +362 -0
- package/lib/cloud/doorlock/unlock-method.d.ts +62 -0
- package/lib/cloud/doorlock/unlock-method.js +85 -0
- package/lib/cloud/doorlock/unlock-method.md +121 -0
- package/lib/cloud/doorlock/unlock.d.ts +89 -0
- package/lib/cloud/doorlock/unlock.js +76 -0
- package/lib/cloud/doorlock/unlock.md +222 -0
- package/lib/cloud/index.d.ts +4 -0
- package/lib/cloud/index.js +10 -1
- package/lib/cloud/interface.d.ts +39 -2
- package/lib/cloud/linkage.d.ts +8 -5
- package/lib/cloud/linkage.js +30 -9
- package/lib/cloud/outdoor.d.ts +15 -0
- package/lib/cloud/outdoor.js +25 -0
- package/lib/cloud/recipe/README.md +36 -0
- package/lib/cloud/recipe/basket.d.ts +220 -0
- package/lib/cloud/recipe/basket.js +328 -0
- package/lib/cloud/recipe/basket.md +431 -0
- package/lib/cloud/recipe/category-list.d.ts +71 -0
- package/lib/cloud/recipe/category-list.js +65 -0
- package/lib/cloud/recipe/category-list.md +132 -0
- package/lib/cloud/recipe/custom.d.ts +177 -0
- package/lib/cloud/recipe/custom.js +171 -0
- package/lib/cloud/recipe/custom.md +265 -0
- package/lib/cloud/recipe/index.d.ts +8 -0
- package/lib/cloud/recipe/index.js +8 -0
- package/lib/cloud/recipe/menu.d.ts +170 -0
- package/lib/cloud/recipe/menu.js +76 -0
- package/lib/cloud/recipe/menu.md +276 -0
- package/lib/cloud/recipe/query.d.ts +87 -0
- package/lib/cloud/recipe/query.js +101 -0
- package/lib/cloud/recipe/query.md +112 -0
- package/lib/cloud/recipe/record.d.ts +54 -0
- package/lib/cloud/recipe/record.js +87 -0
- package/lib/cloud/recipe/record.md +115 -0
- package/lib/cloud/recipe/score.d.ts +69 -0
- package/lib/cloud/recipe/score.js +106 -0
- package/lib/cloud/recipe/score.md +112 -0
- package/lib/cloud/recipe/star.d.ts +131 -0
- package/lib/cloud/recipe/star.js +151 -0
- package/lib/cloud/recipe/star.md +196 -0
- package/lib/cloud/recipe/types.d.ts +7 -0
- package/lib/cloud/recipe/types.js +0 -0
- package/lib/cloud/remoteGroup.d.ts +10 -0
- package/lib/cloud/remoteGroup.js +31 -0
- package/lib/constants.js +1 -1
- package/lib/errorCode.d.ts +4 -0
- package/lib/errorCode.js +3 -0
- package/lib/getCdnUrl/index.d.ts +2 -2
- package/lib/getCdnUrl/index.js +1 -2
- package/lib/getCdnUrl/index.wechat.d.ts +2 -2
- package/lib/getCdnUrl/index.wechat.js +1 -2
- package/lib/index.d.ts +1 -0
- package/lib/index.js +1 -0
- package/lib/nativeRouters/common.d.ts +15 -0
- package/lib/nativeRouters/common.js +38 -0
- package/lib/nativeRouters/device.d.ts +59 -0
- package/lib/nativeRouters/device.js +69 -0
- package/lib/nativeRouters/gw.d.ts +23 -0
- package/lib/nativeRouters/gw.js +27 -0
- package/lib/nativeRouters/index.d.ts +6 -1
- package/lib/nativeRouters/index.js +6 -1
- package/lib/nativeRouters/ipc.d.ts +30 -0
- package/lib/nativeRouters/ipc.js +44 -0
- package/lib/nativeRouters/outdoors.d.ts +47 -0
- package/lib/nativeRouters/outdoors.js +41 -0
- package/lib/nativeRouters/remoteGroup.d.ts +22 -0
- package/lib/nativeRouters/remoteGroup.js +11 -0
- package/lib/nativeRouters/root.d.ts +41 -0
- package/lib/nativeRouters/root.js +53 -0
- package/lib/openGroupCreate/index.js +3 -3
- package/lib/panel/i18n/index.d.ts +7 -6
- package/lib/panel/i18n/index.js +26 -11
- package/lib/panel/normalizeNetwork.js +1 -1
- package/lib/utils.d.ts +5 -2
- package/lib/utils.js +46 -20
- package/lib/utils.wechat.d.ts +3 -0
- package/lib/utils.wechat.js +17 -1
- package/lib/viewAPI.d.ts +1 -0
- package/lib/viewAPI.js +4 -3
- package/package.json +9 -8
- package/@types/PlayNetKit.d.ts +0 -444
- package/lib/nativeRouters/scene.d.ts +0 -34
- package/lib/nativeRouters/scene.js +0 -60
@@ -0,0 +1,131 @@
|
|
1
|
+
/**
|
2
|
+
* GetRecipeCollectionListQuery - 获取食谱收藏列表查询条件
|
3
|
+
*/
|
4
|
+
type GetRecipeCollectionListQuery = {
|
5
|
+
pageNo?: number;
|
6
|
+
pageSize?: number;
|
7
|
+
};
|
8
|
+
/**
|
9
|
+
* GetRecipeCollectionListParams - 获取食谱收藏列表请求参数
|
10
|
+
*/
|
11
|
+
type GetRecipeCollectionListParams = {
|
12
|
+
query: GetRecipeCollectionListQuery;
|
13
|
+
devId: string;
|
14
|
+
};
|
15
|
+
/**
|
16
|
+
* RecipeInfo - 食谱信息
|
17
|
+
*/
|
18
|
+
type RecipeInfo = {
|
19
|
+
id: number;
|
20
|
+
mainImg: string;
|
21
|
+
lang: number;
|
22
|
+
langDesc: string;
|
23
|
+
desc: string;
|
24
|
+
cookType: number;
|
25
|
+
extInfo: string;
|
26
|
+
sourceType: number;
|
27
|
+
isMainShow: number;
|
28
|
+
isShowControl: number;
|
29
|
+
isControl: number;
|
30
|
+
name: string;
|
31
|
+
easyLevel: string;
|
32
|
+
easyLevelDesc: string;
|
33
|
+
taste: string;
|
34
|
+
tasteDesc: string;
|
35
|
+
foodType: string;
|
36
|
+
foodTypeDesc: string;
|
37
|
+
gmtCreate: number;
|
38
|
+
gmtModified: number;
|
39
|
+
};
|
40
|
+
/**
|
41
|
+
* GetRecipeCollectionListResult - 获取食谱收藏列表返回结果
|
42
|
+
*/
|
43
|
+
type GetRecipeCollectionListResult = {
|
44
|
+
totalCount: number;
|
45
|
+
pageNo: number;
|
46
|
+
pageSize: number;
|
47
|
+
hasNext: boolean;
|
48
|
+
data: RecipeInfo[];
|
49
|
+
};
|
50
|
+
/**
|
51
|
+
* GetRecipeCollectionListResponse - 获取食谱收藏列表响应
|
52
|
+
*/
|
53
|
+
type GetRecipeCollectionListResponse = GetRecipeCollectionListResult;
|
54
|
+
/**
|
55
|
+
* 获取食谱收藏列表
|
56
|
+
* @param {GetRecipeCollectionListParams} params - 获取食谱收藏列表请求参数
|
57
|
+
* @returns {Promise<GetRecipeCollectionListResponse>} - 获取食谱收藏列表响应的 Promise
|
58
|
+
*/
|
59
|
+
export declare const getRecipeCollectionList: (params: GetRecipeCollectionListParams) => Promise<GetRecipeCollectionListResponse>;
|
60
|
+
/**
|
61
|
+
* AddRecipeToFavoritesParams - 添加食谱收藏参数
|
62
|
+
*/
|
63
|
+
type AddRecipeToFavoritesParams = {
|
64
|
+
menuId: number;
|
65
|
+
devId: string;
|
66
|
+
};
|
67
|
+
/**
|
68
|
+
* AddRecipeToFavoritesResponse - 添加食谱收藏响应
|
69
|
+
*/
|
70
|
+
type AddRecipeToFavoritesResponse = boolean;
|
71
|
+
/**
|
72
|
+
* 添加食谱收藏
|
73
|
+
* @param {AddRecipeToFavoritesParams} params - 添加食谱收藏参数
|
74
|
+
* @returns {Promise<AddRecipeToFavoritesResponse>} - 添加食谱收藏结果的 Promise
|
75
|
+
*/
|
76
|
+
export declare const addRecipeToFavorites: (params: AddRecipeToFavoritesParams) => Promise<AddRecipeToFavoritesResponse>;
|
77
|
+
/**
|
78
|
+
* RemoveRecipeFromFavoritesParams - 取消食谱收藏参数
|
79
|
+
*/
|
80
|
+
type RemoveRecipeFromFavoritesParams = {
|
81
|
+
menuId: number;
|
82
|
+
devId: string;
|
83
|
+
};
|
84
|
+
/**
|
85
|
+
* RemoveRecipeFromFavoritesResponse - 取消食谱收藏响应
|
86
|
+
*/
|
87
|
+
type RemoveRecipeFromFavoritesResponse = boolean;
|
88
|
+
/**
|
89
|
+
* 取消食谱收藏
|
90
|
+
* @param {RemoveRecipeFromFavoritesParams} params - 取消食谱收藏参数
|
91
|
+
* @returns {Promise<RemoveRecipeFromFavoritesResponse>} - 取消食谱收藏结果的 Promise
|
92
|
+
*/
|
93
|
+
export declare const removeRecipeFromFavorites: (params: RemoveRecipeFromFavoritesParams) => Promise<RemoveRecipeFromFavoritesResponse>;
|
94
|
+
/**
|
95
|
+
* CheckRecipeIsStarredParams - 查询食谱是否收藏参数
|
96
|
+
*/
|
97
|
+
type CheckRecipeIsStarredParams = {
|
98
|
+
menuId: number;
|
99
|
+
devId: string;
|
100
|
+
};
|
101
|
+
/**
|
102
|
+
* CheckRecipeIsStarredResponse - 查询食谱是否收藏响应
|
103
|
+
*/
|
104
|
+
type CheckRecipeIsStarredResponse = {
|
105
|
+
isStar: boolean;
|
106
|
+
};
|
107
|
+
/**
|
108
|
+
* 查询食谱是否收藏
|
109
|
+
* @param {CheckRecipeIsStarredParams} params - 查询食谱是否收藏参数
|
110
|
+
* @returns {Promise<CheckRecipeIsStarredResponse>} - 查询食谱是否收藏结果的 Promise
|
111
|
+
*/
|
112
|
+
export declare const checkRecipeIsStarred: (params: CheckRecipeIsStarredParams) => Promise<CheckRecipeIsStarredResponse>;
|
113
|
+
/**
|
114
|
+
* GetRecipeStarCountParams - 查询食谱收藏数量参数
|
115
|
+
*/
|
116
|
+
type GetRecipeStarCountParams = {
|
117
|
+
devId: string;
|
118
|
+
};
|
119
|
+
/**
|
120
|
+
* GetRecipeStarCountResponse - 查询食谱收藏数量响应
|
121
|
+
*/
|
122
|
+
type GetRecipeStarCountResponse = {
|
123
|
+
count: number;
|
124
|
+
};
|
125
|
+
/**
|
126
|
+
* 查询用户已收藏的食谱数量
|
127
|
+
* @param {GetRecipeStarCountParams} params - 查询食谱收藏数量参数
|
128
|
+
* @returns {Promise<GetRecipeStarCountResponse>} - 查询食谱收藏数量结果的 Promise
|
129
|
+
*/
|
130
|
+
export declare const getRecipeStarCount: (params: GetRecipeStarCountParams) => Promise<GetRecipeStarCountResponse>;
|
131
|
+
export {};
|
@@ -0,0 +1,151 @@
|
|
1
|
+
import _objectSpread from "@babel/runtime/helpers/esm/objectSpread2";
|
2
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
3
|
+
const _excluded = ["query"];
|
4
|
+
import { THING } from '../../constants';
|
5
|
+
import requestCloud from '../../requestCloud';
|
6
|
+
// #region 获取食谱收藏列表
|
7
|
+
|
8
|
+
/**
|
9
|
+
* GetRecipeCollectionListQuery - 获取食谱收藏列表查询条件
|
10
|
+
*/
|
11
|
+
|
12
|
+
/**
|
13
|
+
* GetRecipeCollectionListParams - 获取食谱收藏列表请求参数
|
14
|
+
*/
|
15
|
+
|
16
|
+
/**
|
17
|
+
* RecipeInfo - 食谱信息
|
18
|
+
*/
|
19
|
+
|
20
|
+
/**
|
21
|
+
* GetRecipeCollectionListResult - 获取食谱收藏列表返回结果
|
22
|
+
*/
|
23
|
+
|
24
|
+
/**
|
25
|
+
* GetRecipeCollectionListResponse - 获取食谱收藏列表响应
|
26
|
+
*/
|
27
|
+
|
28
|
+
/**
|
29
|
+
* 获取食谱收藏列表
|
30
|
+
* @param {GetRecipeCollectionListParams} params - 获取食谱收藏列表请求参数
|
31
|
+
* @returns {Promise<GetRecipeCollectionListResponse>} - 获取食谱收藏列表响应的 Promise
|
32
|
+
*/
|
33
|
+
export const getRecipeCollectionList = params => {
|
34
|
+
const {
|
35
|
+
query
|
36
|
+
} = params,
|
37
|
+
rest = _objectWithoutProperties(params, _excluded);
|
38
|
+
return requestCloud({
|
39
|
+
api: "".concat(THING, ".m.menu.star.list"),
|
40
|
+
version: '2.0',
|
41
|
+
data: _objectSpread({
|
42
|
+
queryJson: JSON.stringify(query)
|
43
|
+
}, rest)
|
44
|
+
});
|
45
|
+
};
|
46
|
+
|
47
|
+
// #endregion
|
48
|
+
|
49
|
+
// #region 添加食谱收藏
|
50
|
+
|
51
|
+
/**
|
52
|
+
* AddRecipeToFavoritesParams - 添加食谱收藏参数
|
53
|
+
*/
|
54
|
+
|
55
|
+
/**
|
56
|
+
* AddRecipeToFavoritesResponse - 添加食谱收藏响应
|
57
|
+
*/
|
58
|
+
|
59
|
+
// 返回结果,是否添加成功
|
60
|
+
|
61
|
+
/**
|
62
|
+
* 添加食谱收藏
|
63
|
+
* @param {AddRecipeToFavoritesParams} params - 添加食谱收藏参数
|
64
|
+
* @returns {Promise<AddRecipeToFavoritesResponse>} - 添加食谱收藏结果的 Promise
|
65
|
+
*/
|
66
|
+
export const addRecipeToFavorites = params => {
|
67
|
+
return requestCloud({
|
68
|
+
api: "".concat(THING, ".m.menu.star.add"),
|
69
|
+
version: '1.0',
|
70
|
+
data: params
|
71
|
+
});
|
72
|
+
};
|
73
|
+
|
74
|
+
// #endregion
|
75
|
+
|
76
|
+
// #region 取消食谱收藏
|
77
|
+
|
78
|
+
/**
|
79
|
+
* RemoveRecipeFromFavoritesParams - 取消食谱收藏参数
|
80
|
+
*/
|
81
|
+
|
82
|
+
/**
|
83
|
+
* RemoveRecipeFromFavoritesResponse - 取消食谱收藏响应
|
84
|
+
*/
|
85
|
+
|
86
|
+
// 返回结果,是否取消成功
|
87
|
+
|
88
|
+
/**
|
89
|
+
* 取消食谱收藏
|
90
|
+
* @param {RemoveRecipeFromFavoritesParams} params - 取消食谱收藏参数
|
91
|
+
* @returns {Promise<RemoveRecipeFromFavoritesResponse>} - 取消食谱收藏结果的 Promise
|
92
|
+
*/
|
93
|
+
export const removeRecipeFromFavorites = params => {
|
94
|
+
return requestCloud({
|
95
|
+
api: "".concat(THING, ".m.menu.star.delete"),
|
96
|
+
version: '1.0',
|
97
|
+
data: params
|
98
|
+
});
|
99
|
+
};
|
100
|
+
|
101
|
+
// #endregion
|
102
|
+
|
103
|
+
// #region 食谱是否收藏
|
104
|
+
|
105
|
+
/**
|
106
|
+
* CheckRecipeIsStarredParams - 查询食谱是否收藏参数
|
107
|
+
*/
|
108
|
+
|
109
|
+
/**
|
110
|
+
* CheckRecipeIsStarredResponse - 查询食谱是否收藏响应
|
111
|
+
*/
|
112
|
+
|
113
|
+
/**
|
114
|
+
* 查询食谱是否收藏
|
115
|
+
* @param {CheckRecipeIsStarredParams} params - 查询食谱是否收藏参数
|
116
|
+
* @returns {Promise<CheckRecipeIsStarredResponse>} - 查询食谱是否收藏结果的 Promise
|
117
|
+
*/
|
118
|
+
export const checkRecipeIsStarred = params => {
|
119
|
+
return requestCloud({
|
120
|
+
api: "".concat(THING, ".m.menu.star.check"),
|
121
|
+
version: '1.0',
|
122
|
+
data: params
|
123
|
+
});
|
124
|
+
};
|
125
|
+
|
126
|
+
// #endregion
|
127
|
+
|
128
|
+
// #region 食谱收藏数量
|
129
|
+
|
130
|
+
/**
|
131
|
+
* GetRecipeStarCountParams - 查询食谱收藏数量参数
|
132
|
+
*/
|
133
|
+
|
134
|
+
/**
|
135
|
+
* GetRecipeStarCountResponse - 查询食谱收藏数量响应
|
136
|
+
*/
|
137
|
+
|
138
|
+
/**
|
139
|
+
* 查询用户已收藏的食谱数量
|
140
|
+
* @param {GetRecipeStarCountParams} params - 查询食谱收藏数量参数
|
141
|
+
* @returns {Promise<GetRecipeStarCountResponse>} - 查询食谱收藏数量结果的 Promise
|
142
|
+
*/
|
143
|
+
export const getRecipeStarCount = params => {
|
144
|
+
return requestCloud({
|
145
|
+
api: "".concat(THING, ".m.menu.star.count"),
|
146
|
+
version: '1.0',
|
147
|
+
data: params
|
148
|
+
});
|
149
|
+
};
|
150
|
+
|
151
|
+
// #endregion
|
@@ -0,0 +1,196 @@
|
|
1
|
+
## getRecipeCollectionList
|
2
|
+
|
3
|
+
获取食谱收藏列表。
|
4
|
+
|
5
|
+
### 引入
|
6
|
+
|
7
|
+
> @ray-js/ray^1.5.0 以上版本可使用
|
8
|
+
|
9
|
+
```js
|
10
|
+
import { getRecipeCollectionList } from '@ray-js/ray'
|
11
|
+
```
|
12
|
+
|
13
|
+
**参数**
|
14
|
+
|
15
|
+
**GetRecipeCollectionListParams params**
|
16
|
+
|
17
|
+
封装了获取食谱收藏列表的查询条件和设备 ID。
|
18
|
+
|
19
|
+
**参数属性 GetRecipeCollectionListParams**
|
20
|
+
|
21
|
+
| 属性 | 类型 | 默认值 | 必填 | 说明 |
|
22
|
+
| ----- | ------------------------------ | ------ | ---- | -------- |
|
23
|
+
| query | `GetRecipeCollectionListQuery` | | 是 | 查询条件 |
|
24
|
+
| devId | `string` | | 是 | 设备 ID |
|
25
|
+
|
26
|
+
**函数定义示例**
|
27
|
+
|
28
|
+
```typescript
|
29
|
+
/**
|
30
|
+
* 获取食谱收藏列表
|
31
|
+
* @param {GetRecipeCollectionListParams} params - 获取食谱收藏列表请求参数
|
32
|
+
* @returns {Promise<GetRecipeCollectionListResponse>} - 获取食谱收藏列表响应的 Promise 对象
|
33
|
+
*/
|
34
|
+
export const getRecipeCollectionList: (
|
35
|
+
params: GetRecipeCollectionListParams
|
36
|
+
) => Promise<GetRecipeCollectionListResponse>
|
37
|
+
```
|
38
|
+
|
39
|
+
---
|
40
|
+
|
41
|
+
## addRecipeToFavorites
|
42
|
+
|
43
|
+
添加食谱收藏。
|
44
|
+
|
45
|
+
### 引入
|
46
|
+
|
47
|
+
> @ray-js/ray^1.5.0 以上版本可使用
|
48
|
+
|
49
|
+
```js
|
50
|
+
import { addRecipeToFavorites } from '@ray-js/ray'
|
51
|
+
```
|
52
|
+
|
53
|
+
**参数**
|
54
|
+
|
55
|
+
**AddRecipeToFavoritesParams params**
|
56
|
+
|
57
|
+
封装了食谱 ID 和设备 ID。
|
58
|
+
|
59
|
+
**参数属性 AddRecipeToFavoritesParams**
|
60
|
+
|
61
|
+
| 属性 | 类型 | 默认值 | 必填 | 说明 |
|
62
|
+
| ------ | -------- | ------ | ---- | ------- |
|
63
|
+
| menuId | `number` | | 是 | 食谱 ID |
|
64
|
+
| devId | `string` | | 是 | 设备 ID |
|
65
|
+
|
66
|
+
**函数定义示例**
|
67
|
+
|
68
|
+
```typescript
|
69
|
+
/**
|
70
|
+
* 添加食谱收藏
|
71
|
+
* @param {AddRecipeToFavoritesParams} params - 添加食谱收藏参数
|
72
|
+
* @returns {Promise<AddRecipeToFavoritesResponse>} - 添加食谱收藏结果的 Promise 对象
|
73
|
+
*/
|
74
|
+
export const addRecipeToFavorites: (
|
75
|
+
params: AddRecipeToFavoritesParams
|
76
|
+
) => Promise<AddRecipeToFavoritesResponse>
|
77
|
+
```
|
78
|
+
|
79
|
+
---
|
80
|
+
|
81
|
+
## removeRecipeFromFavorites
|
82
|
+
|
83
|
+
取消食谱收藏。
|
84
|
+
|
85
|
+
### 引入
|
86
|
+
|
87
|
+
> @ray-js/ray^1.5.0 以上版本可使用
|
88
|
+
|
89
|
+
```js
|
90
|
+
import { removeRecipeFromFavorites } from '@ray-js/ray'
|
91
|
+
```
|
92
|
+
|
93
|
+
**参数**
|
94
|
+
|
95
|
+
**RemoveRecipeFromFavoritesParams params**
|
96
|
+
|
97
|
+
封装了食谱 ID 和设备 ID。
|
98
|
+
|
99
|
+
**参数属性 RemoveRecipeFromFavoritesParams**
|
100
|
+
|
101
|
+
| 属性 | 类型 | 默认值 | 必填 | 说明 |
|
102
|
+
| ------ | -------- | ------ | ---- | ------- |
|
103
|
+
| menuId | `number` | | 是 | 食谱 ID |
|
104
|
+
| devId | `string` | | 是 | 设备 ID |
|
105
|
+
|
106
|
+
**函数定义示例**
|
107
|
+
|
108
|
+
```typescript
|
109
|
+
/**
|
110
|
+
* 取消食谱收藏
|
111
|
+
* @param {RemoveRecipeFromFavoritesParams} params - 取消食谱收藏参数
|
112
|
+
* @returns {Promise<RemoveRecipeFromFavoritesResponse>} - 取消食谱收藏结果的 Promise 对象
|
113
|
+
*/
|
114
|
+
export const removeRecipeFromFavorites: (
|
115
|
+
params: RemoveRecipeFromFavoritesParams
|
116
|
+
) => Promise<RemoveRecipeFromFavoritesResponse>
|
117
|
+
```
|
118
|
+
|
119
|
+
---
|
120
|
+
|
121
|
+
## checkRecipeIsStarred
|
122
|
+
|
123
|
+
查询食谱是否收藏。
|
124
|
+
|
125
|
+
### 引入
|
126
|
+
|
127
|
+
> @ray-js/ray^1.5.0 以上版本可使用
|
128
|
+
|
129
|
+
```js
|
130
|
+
import { checkRecipeIsStarred } from '@ray-js/ray'
|
131
|
+
```
|
132
|
+
|
133
|
+
**参数**
|
134
|
+
|
135
|
+
**CheckRecipeIsStarredParams params**
|
136
|
+
|
137
|
+
封装了食谱 ID 和设备 ID。
|
138
|
+
|
139
|
+
**参数属性 CheckRecipeIsStarredParams**
|
140
|
+
|
141
|
+
| 属性 | 类型 | 默认值 | 必填 | 说明 |
|
142
|
+
| ------ | -------- | ------ | ---- | ------- |
|
143
|
+
| menuId | `number` | | 是 | 食谱 ID |
|
144
|
+
| devId | `string` | | 是 | 设备 ID |
|
145
|
+
|
146
|
+
**函数定义示例**
|
147
|
+
|
148
|
+
```typescript
|
149
|
+
/**
|
150
|
+
* 查询食谱是否收藏
|
151
|
+
* @param {CheckRecipeIsStarredParams} params - 查询食谱是否收藏参数
|
152
|
+
* @returns {Promise<CheckRecipeIsStarredResponse>} - 查询食谱是否收藏结果的 Promise 对象
|
153
|
+
*/
|
154
|
+
export const checkRecipeIsStarred: (
|
155
|
+
params: CheckRecipeIsStarredParams
|
156
|
+
) => Promise<CheckRecipeIsStarredResponse>
|
157
|
+
```
|
158
|
+
|
159
|
+
---
|
160
|
+
|
161
|
+
## getRecipeStarCount
|
162
|
+
|
163
|
+
查询用户已收藏的食谱数量。
|
164
|
+
|
165
|
+
### 引入
|
166
|
+
|
167
|
+
> @ray-js/ray^1.5.0 以上版本可使用
|
168
|
+
|
169
|
+
```js
|
170
|
+
import { getRecipeStarCount } from '@ray-js/ray'
|
171
|
+
```
|
172
|
+
|
173
|
+
**参数**
|
174
|
+
|
175
|
+
**GetRecipeStarCountParams params**
|
176
|
+
|
177
|
+
封装了设备 ID。
|
178
|
+
|
179
|
+
**参数属性 GetRecipeStarCountParams**
|
180
|
+
|
181
|
+
| 属性 | 类型 | 默认值 | 必填 | 说明 |
|
182
|
+
| ----- | -------- | ------ | ---- | ------- |
|
183
|
+
| devId | `string` | | 是 | 设备 ID |
|
184
|
+
|
185
|
+
**函数定义示例**
|
186
|
+
|
187
|
+
```typescript
|
188
|
+
/**
|
189
|
+
* 查询用户已收藏的食谱数量
|
190
|
+
* @param {GetRecipeStarCountParams} params - 查询食谱收藏数量参数
|
191
|
+
* @returns {Promise<GetRecipeStarCountResponse>} - 查询食谱收藏数量结果的 Promise 对象
|
192
|
+
*/
|
193
|
+
export const getRecipeStarCount: (
|
194
|
+
params: GetRecipeStarCountParams
|
195
|
+
) => Promise<GetRecipeStarCountResponse>
|
196
|
+
```
|
File without changes
|
@@ -0,0 +1,10 @@
|
|
1
|
+
import { IGetZigbeeLocalGroupDeviceList, IGetZigbeeLocalGroupRelation } from './interface';
|
2
|
+
/**
|
3
|
+
* 获取 Zigbee 遥控器群组 localId 列表
|
4
|
+
*/
|
5
|
+
declare const getZigbeeLocalGroupRelation: (params: IGetZigbeeLocalGroupRelation) => Promise<string>;
|
6
|
+
/**
|
7
|
+
* 获取可以加入 Zigbee 遥控器群组的设备列表
|
8
|
+
*/
|
9
|
+
declare const getZigbeeLocalGroupDeviceList: (params: IGetZigbeeLocalGroupDeviceList) => Promise<string>;
|
10
|
+
export { getZigbeeLocalGroupRelation, getZigbeeLocalGroupDeviceList };
|
@@ -0,0 +1,31 @@
|
|
1
|
+
// 遥控器群组接口
|
2
|
+
import { requestCloud } from '../';
|
3
|
+
import { THING } from '../constants';
|
4
|
+
/**
|
5
|
+
* 获取 Zigbee 遥控器群组 localId 列表
|
6
|
+
*/
|
7
|
+
const getZigbeeLocalGroupRelation = params => {
|
8
|
+
return requestCloud({
|
9
|
+
api: "".concat(THING, ".p.remote.local.relation.get"),
|
10
|
+
version: '1.0',
|
11
|
+
data: {
|
12
|
+
devId: params.devId,
|
13
|
+
type: 0
|
14
|
+
}
|
15
|
+
});
|
16
|
+
};
|
17
|
+
|
18
|
+
/**
|
19
|
+
* 获取可以加入 Zigbee 遥控器群组的设备列表
|
20
|
+
*/
|
21
|
+
const getZigbeeLocalGroupDeviceList = params => {
|
22
|
+
return requestCloud({
|
23
|
+
api: "".concat(THING, ".m.device.group.dev.list"),
|
24
|
+
version: '1.0',
|
25
|
+
data: params,
|
26
|
+
extData: {
|
27
|
+
gid: params.homeId
|
28
|
+
}
|
29
|
+
});
|
30
|
+
};
|
31
|
+
export { getZigbeeLocalGroupRelation, getZigbeeLocalGroupDeviceList };
|
package/lib/constants.js
CHANGED
package/lib/errorCode.js
ADDED
package/lib/getCdnUrl/index.d.ts
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
export default function getCdnUrl(path: string): string;
|
2
|
-
export declare function getCdnUrlAsync(path: string): Promise<string>;
|
1
|
+
export default function getCdnUrl(path: string, cdnMap?: Record<string, string>, region?: string): string;
|
2
|
+
export declare function getCdnUrlAsync(path: string, cdnMap?: Record<string, string>, region?: string): Promise<string>;
|
package/lib/getCdnUrl/index.js
CHANGED
@@ -1,2 +1,2 @@
|
|
1
|
-
export default function getCdnUrl(path: string): string;
|
2
|
-
export declare function getCdnUrlAsync(path: string): Promise<string>;
|
1
|
+
export default function getCdnUrl(path: string, cdnMap?: Record<string, string>, region?: string): string;
|
2
|
+
export declare function getCdnUrlAsync(path: string, cdnMap?: Record<string, string>, region?: string): Promise<string>;
|
package/lib/index.d.ts
CHANGED
package/lib/index.js
CHANGED
@@ -0,0 +1,15 @@
|
|
1
|
+
export type ICommon = {
|
2
|
+
success?: () => void;
|
3
|
+
fail?: (err?: {
|
4
|
+
errorMsg: string;
|
5
|
+
errorCode: string | number;
|
6
|
+
innerError: {
|
7
|
+
errorCode: string | number;
|
8
|
+
errorMsg: string;
|
9
|
+
};
|
10
|
+
}) => void;
|
11
|
+
complete?: () => void;
|
12
|
+
} & {
|
13
|
+
[key: string]: string | boolean | number;
|
14
|
+
};
|
15
|
+
export declare function nativeRouter<T extends ICommon>(uri: string, params?: T): Promise<void>;
|
@@ -0,0 +1,38 @@
|
|
1
|
+
import _objectWithoutProperties from "@babel/runtime/helpers/esm/objectWithoutProperties";
|
2
|
+
const _excluded = ["success", "fail", "complete"];
|
3
|
+
import { stringifyUrl } from '../utils';
|
4
|
+
import ErrorCode from '../errorCode';
|
5
|
+
export function nativeRouter(uri, params) {
|
6
|
+
const _ref = params || {},
|
7
|
+
{
|
8
|
+
success,
|
9
|
+
fail,
|
10
|
+
complete
|
11
|
+
} = _ref,
|
12
|
+
rest = _objectWithoutProperties(_ref, _excluded);
|
13
|
+
return new Promise((resolve, reject) => {
|
14
|
+
ty.router({
|
15
|
+
url: stringifyUrl({
|
16
|
+
url: uri,
|
17
|
+
query: rest
|
18
|
+
}),
|
19
|
+
success() {
|
20
|
+
success === null || success === void 0 || success();
|
21
|
+
resolve();
|
22
|
+
},
|
23
|
+
fail(err) {
|
24
|
+
if (+err.errorCode === ErrorCode.NATIVE_ROUTER_ERROR_ENVIRONMENT) {
|
25
|
+
const errMsg = 'Cannot use in this environment. Please use real device preview.';
|
26
|
+
console.warn(errMsg);
|
27
|
+
// 该环境不可使用,请使用真机预览和线上包
|
28
|
+
err.errorMsg = errMsg;
|
29
|
+
}
|
30
|
+
fail === null || fail === void 0 || fail(err);
|
31
|
+
reject(err);
|
32
|
+
},
|
33
|
+
complete() {
|
34
|
+
complete === null || complete === void 0 || complete();
|
35
|
+
}
|
36
|
+
});
|
37
|
+
});
|
38
|
+
}
|