@ray-js/api 1.2.0-beta.1 → 1.2.1
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 +17 -17
- package/@types/HomeKit.d.ts +358 -0
- package/@types/MiniKit.d.ts +2 -2
- package/@types/all-kits.d.ts +1 -0
- package/lib/HomeKit-3.1.4.d.ts +7 -0
- package/lib/HomeKit-3.1.4.js +8 -0
- package/lib/all-kits.d.ts +1 -0
- package/lib/all-kits.js +1 -0
- package/package.json +5 -5
package/@types/BaseKit.d.ts
CHANGED
@@ -112,7 +112,7 @@ declare namespace ty {
|
|
112
112
|
*/
|
113
113
|
export function startAccelerometer(params?: {
|
114
114
|
/** 监听加速度数据回调函数的执行频率 */
|
115
|
-
interval?:
|
115
|
+
interval?: keyof typeof AccelerometerInterval
|
116
116
|
complete?: () => void
|
117
117
|
success?: (params: null) => void
|
118
118
|
failure?: (params: {
|
@@ -269,7 +269,7 @@ declare namespace ty {
|
|
269
269
|
*/
|
270
270
|
export function startDeviceMotionListening(params?: {
|
271
271
|
/** 监听加速度数据回调函数的执行频率 */
|
272
|
-
interval?:
|
272
|
+
interval?: keyof typeof DeviceMotionInterval
|
273
273
|
complete?: () => void
|
274
274
|
success?: (params: null) => void
|
275
275
|
failure?: (params: {
|
@@ -322,7 +322,7 @@ declare namespace ty {
|
|
322
322
|
*/
|
323
323
|
export function startGyroscope(params?: {
|
324
324
|
/** 监听陀螺仪数据回调函数的执行频率 */
|
325
|
-
interval?:
|
325
|
+
interval?: keyof typeof GyroscopeInterval
|
326
326
|
complete?: () => void
|
327
327
|
success?: (params: null) => void
|
328
328
|
failure?: (params: {
|
@@ -999,8 +999,8 @@ declare namespace ty {
|
|
999
999
|
bluetoothEnabled: boolean
|
1000
1000
|
locationEnabled: boolean
|
1001
1001
|
wifiEnabled: boolean
|
1002
|
-
theme?:
|
1003
|
-
deviceOrientation?:
|
1002
|
+
theme?: keyof typeof Themes
|
1003
|
+
deviceOrientation?: keyof typeof Orientation
|
1004
1004
|
/** 设备等级(低:low-中:middle-高:high) */
|
1005
1005
|
deviceLevel: string
|
1006
1006
|
}) => void
|
@@ -1047,8 +1047,8 @@ declare namespace ty {
|
|
1047
1047
|
bluetoothEnabled: boolean
|
1048
1048
|
locationEnabled: boolean
|
1049
1049
|
wifiEnabled: boolean
|
1050
|
-
theme?:
|
1051
|
-
deviceOrientation?:
|
1050
|
+
theme?: keyof typeof Themes
|
1051
|
+
deviceOrientation?: keyof typeof Orientation
|
1052
1052
|
/** 设备等级(低:low-中:middle-高:high) */
|
1053
1053
|
deviceLevel: string
|
1054
1054
|
}
|
@@ -1891,11 +1891,11 @@ declare namespace ty {
|
|
1891
1891
|
/** 小部件样式,默认middle */
|
1892
1892
|
style?: string
|
1893
1893
|
/** 版本类型,默认release */
|
1894
|
-
versionType?:
|
1894
|
+
versionType?: keyof typeof WidgetVersionType
|
1895
1895
|
/** 版本号 */
|
1896
1896
|
version?: string
|
1897
1897
|
/** 展示位置,默认bottom */
|
1898
|
-
position?:
|
1898
|
+
position?: keyof typeof WidgetPosition
|
1899
1899
|
/** 点击空白处是否关闭 */
|
1900
1900
|
autoDismiss?: boolean
|
1901
1901
|
/**
|
@@ -1914,7 +1914,7 @@ declare namespace ty {
|
|
1914
1914
|
|
1915
1915
|
export type DeviceMotionBean = {
|
1916
1916
|
/** 监听加速度数据回调函数的执行频率 */
|
1917
|
-
interval?:
|
1917
|
+
interval?: keyof typeof DeviceMotionInterval
|
1918
1918
|
}
|
1919
1919
|
|
1920
1920
|
export type DownLoadBean = {
|
@@ -1980,7 +1980,7 @@ declare namespace ty {
|
|
1980
1980
|
|
1981
1981
|
export type GyroscopeBean = {
|
1982
1982
|
/** 监听陀螺仪数据回调函数的执行频率 */
|
1983
|
-
interval?:
|
1983
|
+
interval?: keyof typeof GyroscopeInterval
|
1984
1984
|
}
|
1985
1985
|
|
1986
1986
|
export type ChooseImageBean = {
|
@@ -2194,7 +2194,7 @@ declare namespace ty {
|
|
2194
2194
|
/** 超时时间,单位为毫秒 */
|
2195
2195
|
timeout?: number
|
2196
2196
|
/** HTTP 请求方法 */
|
2197
|
-
method?:
|
2197
|
+
method?: keyof typeof HTTPMethod
|
2198
2198
|
/** 返回的数据格式 */
|
2199
2199
|
dataType?: any
|
2200
2200
|
/** 返回的数据类型 */
|
@@ -2348,8 +2348,8 @@ declare namespace ty {
|
|
2348
2348
|
bluetoothEnabled: boolean
|
2349
2349
|
locationEnabled: boolean
|
2350
2350
|
wifiEnabled: boolean
|
2351
|
-
theme?:
|
2352
|
-
deviceOrientation?:
|
2351
|
+
theme?: keyof typeof Themes
|
2352
|
+
deviceOrientation?: keyof typeof Orientation
|
2353
2353
|
/** 设备等级(低:low-中:middle-高:high) */
|
2354
2354
|
deviceLevel: string
|
2355
2355
|
}
|
@@ -2668,11 +2668,11 @@ declare namespace ty {
|
|
2668
2668
|
/** 小部件样式,默认middle */
|
2669
2669
|
style?: string
|
2670
2670
|
/** 版本类型,默认release */
|
2671
|
-
versionType?:
|
2671
|
+
versionType?: keyof typeof WidgetVersionType
|
2672
2672
|
/** 版本号 */
|
2673
2673
|
version?: string
|
2674
2674
|
/** 展示位置,默认bottom */
|
2675
|
-
position?:
|
2675
|
+
position?: keyof typeof WidgetPosition
|
2676
2676
|
/** 点击空白处是否关闭 */
|
2677
2677
|
autoDismiss?: boolean
|
2678
2678
|
/**
|
@@ -3095,7 +3095,7 @@ declare namespace ty {
|
|
3095
3095
|
/** 超时时间,单位为毫秒 */
|
3096
3096
|
timeout?: number
|
3097
3097
|
/** HTTP 请求方法 */
|
3098
|
-
method?:
|
3098
|
+
method?: keyof typeof HTTPMethod
|
3099
3099
|
/** 返回的数据格式 */
|
3100
3100
|
dataType?: any
|
3101
3101
|
/** 返回的数据类型 */
|
@@ -0,0 +1,358 @@
|
|
1
|
+
/**
|
2
|
+
* HomeKit
|
3
|
+
*
|
4
|
+
* @version 3.1.4
|
5
|
+
*/
|
6
|
+
declare namespace ty.home {
|
7
|
+
// /**
|
8
|
+
// * 请求接口,获取本地设备时区信息,并写入缓存
|
9
|
+
// */
|
10
|
+
// export function getLocalDeviceConfigWithDevId(params: {
|
11
|
+
// /** 设备ID */
|
12
|
+
// devId: string
|
13
|
+
// complete?: () => void
|
14
|
+
// success?: (params: null) => void
|
15
|
+
// fail?: (params: {
|
16
|
+
// errorMsg: string
|
17
|
+
// errorCode: string | number
|
18
|
+
// innerError: {
|
19
|
+
// errorCode: string | number
|
20
|
+
// errorMsg: string
|
21
|
+
// }
|
22
|
+
// }) => void
|
23
|
+
// }): void
|
24
|
+
|
25
|
+
// /**
|
26
|
+
// * 修改家庭信息
|
27
|
+
// */
|
28
|
+
// export function updateHomeInfoData(params: {
|
29
|
+
// /** 家庭名称 */
|
30
|
+
// homeName: string
|
31
|
+
// /** 家庭id */
|
32
|
+
// homeId: string
|
33
|
+
// /** 经度 */
|
34
|
+
// longitude: string
|
35
|
+
// /** 维度 */
|
36
|
+
// latitude: string
|
37
|
+
// /** 详细地址 */
|
38
|
+
// address: string
|
39
|
+
// /**
|
40
|
+
// * 是否是管理员
|
41
|
+
// * true 是管理员; false 非管理员
|
42
|
+
// */
|
43
|
+
// admin: boolean
|
44
|
+
// complete?: () => void
|
45
|
+
// success?: (params: null) => void
|
46
|
+
// fail?: (params: {
|
47
|
+
// errorMsg: string
|
48
|
+
// errorCode: string | number
|
49
|
+
// innerError: {
|
50
|
+
// errorCode: string | number
|
51
|
+
// errorMsg: string
|
52
|
+
// }
|
53
|
+
// }) => void
|
54
|
+
// }): void
|
55
|
+
|
56
|
+
/**
|
57
|
+
* 获取当前家庭信息
|
58
|
+
*/
|
59
|
+
export function getCurrentHomeInfo(params?: {
|
60
|
+
complete?: () => void
|
61
|
+
success?: (params: {
|
62
|
+
/** 家庭名称 */
|
63
|
+
homeName: string
|
64
|
+
/** 家庭id */
|
65
|
+
homeId: string
|
66
|
+
/** 经度 */
|
67
|
+
longitude: string
|
68
|
+
/** 维度 */
|
69
|
+
latitude: string
|
70
|
+
/** 详细地址 */
|
71
|
+
address: string
|
72
|
+
/**
|
73
|
+
* 是否是管理员
|
74
|
+
* true 是管理员; false 非管理员
|
75
|
+
*/
|
76
|
+
admin: boolean
|
77
|
+
}) => void
|
78
|
+
fail?: (params: {
|
79
|
+
errorMsg: string
|
80
|
+
errorCode: string | number
|
81
|
+
innerError: {
|
82
|
+
errorCode: string | number
|
83
|
+
errorMsg: string
|
84
|
+
}
|
85
|
+
}) => void
|
86
|
+
}): void
|
87
|
+
|
88
|
+
/**
|
89
|
+
* 获取设备房间信息
|
90
|
+
*/
|
91
|
+
export function getDeviceRoomInfo(params: {
|
92
|
+
/**
|
93
|
+
* deviceId
|
94
|
+
* 设备 id
|
95
|
+
*/
|
96
|
+
deviceId: string
|
97
|
+
complete?: () => void
|
98
|
+
success?: (params: {
|
99
|
+
/** The room ID. */
|
100
|
+
roomId: number
|
101
|
+
/** The room name. */
|
102
|
+
name: string
|
103
|
+
}) => void
|
104
|
+
fail?: (params: {
|
105
|
+
errorMsg: string
|
106
|
+
errorCode: string | number
|
107
|
+
innerError: {
|
108
|
+
errorCode: string | number
|
109
|
+
errorMsg: string
|
110
|
+
}
|
111
|
+
}) => void
|
112
|
+
}): void
|
113
|
+
|
114
|
+
// /**
|
115
|
+
// * 获取群组房间信息
|
116
|
+
// */
|
117
|
+
// export function getGroupRoomInfo(params: {
|
118
|
+
// /**
|
119
|
+
// * groupId
|
120
|
+
// * 群组 id
|
121
|
+
// */
|
122
|
+
// groupId: string
|
123
|
+
// complete?: () => void
|
124
|
+
// success?: (params: {
|
125
|
+
// /** The room ID. */
|
126
|
+
// roomId: number
|
127
|
+
// /** The room name. */
|
128
|
+
// name: string
|
129
|
+
// }) => void
|
130
|
+
// fail?: (params: {
|
131
|
+
// errorMsg: string
|
132
|
+
// errorCode: string | number
|
133
|
+
// innerError: {
|
134
|
+
// errorCode: string | number
|
135
|
+
// errorMsg: string
|
136
|
+
// }
|
137
|
+
// }) => void
|
138
|
+
// }): void
|
139
|
+
|
140
|
+
/**
|
141
|
+
* 获取当前维度下的设备id列表
|
142
|
+
*/
|
143
|
+
export function getDeviceIdList(params: {
|
144
|
+
/** 维度id */
|
145
|
+
ownerId: number
|
146
|
+
complete?: () => void
|
147
|
+
success?: (params: {
|
148
|
+
/** 设备id列表 */
|
149
|
+
devIds: string[]
|
150
|
+
}) => void
|
151
|
+
fail?: (params: {
|
152
|
+
errorMsg: string
|
153
|
+
errorCode: string | number
|
154
|
+
innerError: {
|
155
|
+
errorCode: string | number
|
156
|
+
errorMsg: string
|
157
|
+
}
|
158
|
+
}) => void
|
159
|
+
}): void
|
160
|
+
|
161
|
+
/**
|
162
|
+
* 获取当前维度下的设备id列表
|
163
|
+
*/
|
164
|
+
export function getRoomList(params: {
|
165
|
+
/** 维度id */
|
166
|
+
ownerId: number
|
167
|
+
complete?: () => void
|
168
|
+
success?: (params: {
|
169
|
+
/** 房间列表 */
|
170
|
+
roomDatas: RoomData[]
|
171
|
+
}) => void
|
172
|
+
fail?: (params: {
|
173
|
+
errorMsg: string
|
174
|
+
errorCode: string | number
|
175
|
+
innerError: {
|
176
|
+
errorCode: string | number
|
177
|
+
errorMsg: string
|
178
|
+
}
|
179
|
+
}) => void
|
180
|
+
}): void
|
181
|
+
|
182
|
+
// /**
|
183
|
+
// * 验证码校验成功
|
184
|
+
// */
|
185
|
+
// export function onTicketSuccess(params?: {
|
186
|
+
// /** ticket */
|
187
|
+
// map?: Record<string, string>
|
188
|
+
// complete?: () => void
|
189
|
+
// success?: (params: {
|
190
|
+
// /** ticket */
|
191
|
+
// map?: Record<string, string>
|
192
|
+
// }) => void
|
193
|
+
// fail?: (params: {
|
194
|
+
// errorMsg: string
|
195
|
+
// errorCode: string | number
|
196
|
+
// innerError: {
|
197
|
+
// errorCode: string | number
|
198
|
+
// errorMsg: string
|
199
|
+
// }
|
200
|
+
// }) => void
|
201
|
+
// }): void
|
202
|
+
|
203
|
+
// /**
|
204
|
+
// * 【废弃】打开推荐场景详情页面
|
205
|
+
// *请用deviceKit包下同名方法替代
|
206
|
+
// *详细文档链接:https://wiki.tuya-inc.com:7799/page/1456192108871295013
|
207
|
+
// */
|
208
|
+
// export function openRecommendSceneDetail(params: {
|
209
|
+
// /** 来源 */
|
210
|
+
// source: string
|
211
|
+
// /** 场景模型 */
|
212
|
+
// sceneModel: Record<string, any>
|
213
|
+
// complete?: () => void
|
214
|
+
// success?: (params: {
|
215
|
+
// /** 返回状态,默认返回 true */
|
216
|
+
// status?: boolean
|
217
|
+
// /** 成功返回的类型。0-未操作,1-保存成功,2-点击不感兴趣 */
|
218
|
+
// type: number
|
219
|
+
// /** 返回的场景数据,可能为空 */
|
220
|
+
// data?: Record<string, any>
|
221
|
+
// }) => void
|
222
|
+
// fail?: (params: {
|
223
|
+
// errorMsg: string
|
224
|
+
// errorCode: string | number
|
225
|
+
// innerError: {
|
226
|
+
// errorCode: string | number
|
227
|
+
// errorMsg: string
|
228
|
+
// }
|
229
|
+
// }) => void
|
230
|
+
// }): void
|
231
|
+
|
232
|
+
// /**
|
233
|
+
// * 【废弃】跳转一键执行和自动化页面
|
234
|
+
// *请用deviceKit包下同名方法替代
|
235
|
+
// */
|
236
|
+
// export function openDeviceExecutionAndAnutomation(params: {
|
237
|
+
// /**
|
238
|
+
// * deviceId
|
239
|
+
// * 设备 id
|
240
|
+
// */
|
241
|
+
// deviceId: string
|
242
|
+
// /** 页面标题,Android 需要 */
|
243
|
+
// title?: string
|
244
|
+
// complete?: () => void
|
245
|
+
// success?: (params: null) => void
|
246
|
+
// fail?: (params: {
|
247
|
+
// errorMsg: string
|
248
|
+
// errorCode: string | number
|
249
|
+
// innerError: {
|
250
|
+
// errorCode: string | number
|
251
|
+
// errorMsg: string
|
252
|
+
// }
|
253
|
+
// }) => void
|
254
|
+
// }): void
|
255
|
+
|
256
|
+
export type RoomData = {
|
257
|
+
/** 房间id */
|
258
|
+
roomId: number
|
259
|
+
/** 房间名称 */
|
260
|
+
name: string
|
261
|
+
/** 房间下的设备id */
|
262
|
+
deviceIds: string[]
|
263
|
+
}
|
264
|
+
|
265
|
+
export type HomeInfoData = {
|
266
|
+
/** 家庭名称 */
|
267
|
+
homeName: string
|
268
|
+
/** 家庭id */
|
269
|
+
homeId: string
|
270
|
+
/** 经度 */
|
271
|
+
longitude: string
|
272
|
+
/** 维度 */
|
273
|
+
latitude: string
|
274
|
+
/** 详细地址 */
|
275
|
+
address: string
|
276
|
+
/**
|
277
|
+
* 是否是管理员
|
278
|
+
* true 是管理员; false 非管理员
|
279
|
+
*/
|
280
|
+
admin: boolean
|
281
|
+
}
|
282
|
+
|
283
|
+
export type GetDeviceRoomInfoParams = {
|
284
|
+
/**
|
285
|
+
* deviceId
|
286
|
+
* 设备 id
|
287
|
+
*/
|
288
|
+
deviceId: string
|
289
|
+
}
|
290
|
+
|
291
|
+
export type GetDeviceRoomInfoResponse = {
|
292
|
+
/** The room ID. */
|
293
|
+
roomId: number
|
294
|
+
/** The room name. */
|
295
|
+
name: string
|
296
|
+
}
|
297
|
+
|
298
|
+
export type GroupRoomInfoParams = {
|
299
|
+
/**
|
300
|
+
* groupId
|
301
|
+
* 群组 id
|
302
|
+
*/
|
303
|
+
groupId: string
|
304
|
+
}
|
305
|
+
|
306
|
+
export type GroupRoomInfoResponse = {
|
307
|
+
/** The room ID. */
|
308
|
+
roomId: number
|
309
|
+
/** The room name. */
|
310
|
+
name: string
|
311
|
+
}
|
312
|
+
|
313
|
+
export type OwnerId = {
|
314
|
+
/** 维度id */
|
315
|
+
ownerId: number
|
316
|
+
}
|
317
|
+
|
318
|
+
export type DeviceIdList = {
|
319
|
+
/** 设备id列表 */
|
320
|
+
devIds: string[]
|
321
|
+
}
|
322
|
+
|
323
|
+
export type RoomList = {
|
324
|
+
/** 房间列表 */
|
325
|
+
roomDatas: RoomData[]
|
326
|
+
}
|
327
|
+
|
328
|
+
export type TicketModel = {
|
329
|
+
/** ticket */
|
330
|
+
map?: Record<string, string>
|
331
|
+
}
|
332
|
+
|
333
|
+
export type RecommendSceneParams = {
|
334
|
+
/** 来源 */
|
335
|
+
source: string
|
336
|
+
/** 场景模型 */
|
337
|
+
sceneModel: Record<string, any>
|
338
|
+
}
|
339
|
+
|
340
|
+
export type RecommendSceneCallBack = {
|
341
|
+
/** 返回状态,默认返回 true */
|
342
|
+
status?: boolean
|
343
|
+
/** 成功返回的类型。0-未操作,1-保存成功,2-点击不感兴趣 */
|
344
|
+
type: number
|
345
|
+
/** 返回的场景数据,可能为空 */
|
346
|
+
data?: Record<string, any>
|
347
|
+
}
|
348
|
+
|
349
|
+
export type OpenDeviceExecutionAndAnutomationParams = {
|
350
|
+
/**
|
351
|
+
* deviceId
|
352
|
+
* 设备 id
|
353
|
+
*/
|
354
|
+
deviceId: string
|
355
|
+
/** 页面标题,Android 需要 */
|
356
|
+
title?: string
|
357
|
+
}
|
358
|
+
}
|
package/@types/MiniKit.d.ts
CHANGED
@@ -325,7 +325,7 @@ declare namespace ty {
|
|
325
325
|
/** data 请求入参 */
|
326
326
|
data?: Record<string, any>
|
327
327
|
/** method 请求方法 */
|
328
|
-
method?:
|
328
|
+
method?: keyof typeof HighwayMethod
|
329
329
|
complete?: () => void
|
330
330
|
success?: (params: {
|
331
331
|
/**
|
@@ -1245,7 +1245,7 @@ declare namespace ty {
|
|
1245
1245
|
/** data 请求入参 */
|
1246
1246
|
data?: Record<string, any>
|
1247
1247
|
/** method 请求方法 */
|
1248
|
-
method?:
|
1248
|
+
method?: keyof typeof HighwayMethod
|
1249
1249
|
}
|
1250
1250
|
|
1251
1251
|
export type HighwayRequestResponse = {
|
package/@types/all-kits.d.ts
CHANGED
@@ -0,0 +1,7 @@
|
|
1
|
+
/// <reference path="../@types/PlayNetKit.d.ts" />
|
2
|
+
export declare const home: {
|
3
|
+
getCurrentHomeInfo: typeof ty.home.getCurrentHomeInfo;
|
4
|
+
getDeviceIdList: typeof ty.home.getDeviceIdList;
|
5
|
+
getRoomList: typeof ty.home.getRoomList;
|
6
|
+
getDeviceRoomInfo: typeof ty.home.getDeviceRoomInfo;
|
7
|
+
};
|
@@ -0,0 +1,8 @@
|
|
1
|
+
/// <reference path="../@types/PlayNetKit.d.ts" />
|
2
|
+
import { factory } from './utils';
|
3
|
+
export var home = {
|
4
|
+
getCurrentHomeInfo: factory('getCurrentHomeInfo'),
|
5
|
+
getDeviceIdList: factory('getDeviceIdList'),
|
6
|
+
getRoomList: factory('getRoomList'),
|
7
|
+
getDeviceRoomInfo: factory('getDeviceRoomInfo')
|
8
|
+
};
|
package/lib/all-kits.d.ts
CHANGED
package/lib/all-kits.js
CHANGED
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@ray-js/api",
|
3
|
-
"version": "1.2.
|
3
|
+
"version": "1.2.1",
|
4
4
|
"description": "Ray universal api",
|
5
5
|
"keywords": [
|
6
6
|
"ray"
|
@@ -26,13 +26,13 @@
|
|
26
26
|
"build:kit:api": "node scripts/api-creator.mjs"
|
27
27
|
},
|
28
28
|
"dependencies": {
|
29
|
-
"@ray-js/framework": "^1.2.
|
30
|
-
"@ray-js/router": "^1.2.
|
29
|
+
"@ray-js/framework": "^1.2.1",
|
30
|
+
"@ray-js/router": "^1.2.1",
|
31
31
|
"@ray-js/wechat": "^0.0.16",
|
32
32
|
"base64-browser": "^1.0.1"
|
33
33
|
},
|
34
34
|
"devDependencies": {
|
35
|
-
"@ray-js/cli": "^1.2.
|
35
|
+
"@ray-js/cli": "^1.2.1",
|
36
36
|
"art-template": "^4.13.2",
|
37
37
|
"fs-extra": "^10.1.0",
|
38
38
|
"miniprogram-api-typings": "^3.4.3",
|
@@ -44,6 +44,6 @@
|
|
44
44
|
"email": "tuyafe@tuya.com"
|
45
45
|
}
|
46
46
|
],
|
47
|
-
"gitHead": "
|
47
|
+
"gitHead": "2bfdb0b62fdd4fa36e82f661712fc57eccb51f4c",
|
48
48
|
"repository": {}
|
49
49
|
}
|