iot.d.ts 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519
  1. declare namespace IOT {
  2. // MQTT
  3. namespace API {
  4. namespace MODEL {
  5. type QueryPamars = {
  6. modelLabel?: string // 模型名称
  7. transportType: TransportEnum
  8. } & Partial<COMMON.QueryParams>
  9. interface Model {
  10. id?: string
  11. modelTemplateId?: string
  12. modelLabel: string,
  13. transportType: string,
  14. payloadType: string,
  15. deviceType: string,
  16. modelDescription: string,
  17. rts: boolean // 用来标志是否具备视频流能力
  18. }
  19. interface ModelDot extends Model {
  20. id: string,
  21. createAt: string,
  22. updateAt: string,
  23. deleted: boolean,
  24. tenantId: string
  25. }
  26. interface plugin {
  27. id: string
  28. 'modelId': string,
  29. 'modelPluginType': 'JS',
  30. 'modelPluginBody': string
  31. }
  32. }
  33. namespace MODELATTR {
  34. interface ModelAttr {
  35. id?: string
  36. attributeKey: string
  37. attributeLabel: string
  38. dataType: string
  39. dataUnit: string
  40. scope: string
  41. expr: string
  42. }
  43. }
  44. namespace MODELTEMPLATE {
  45. interface modelTemplate {
  46. id: string
  47. templateLabel: string
  48. templateAttribute: {
  49. id: string
  50. attributeKey: string
  51. attributeLabel: string
  52. dataType: string
  53. dataUnit: string
  54. scope: string
  55. expr: string
  56. modelId: string
  57. key: string
  58. }[]
  59. templatePlugin: any
  60. templateCmd: any
  61. }
  62. }
  63. namespace CMD {
  64. interface Cmd {
  65. id: string,
  66. cmdCode: string
  67. 'cmdLabel': string,
  68. 'cmdParams': {
  69. id: string
  70. 'paramLabel': string,
  71. 'dataType': string,
  72. 'required': boolean,
  73. 'dataUnit': string,
  74. 'minValue': any,
  75. 'maxValue': any,
  76. 'scope': string,
  77. 'description': string
  78. }[],
  79. 'cmdResponses': {
  80. 'paramLabel': string,
  81. 'dataType': string,
  82. 'required': boolean,
  83. 'dataUnit': string,
  84. 'minValue': any,
  85. 'maxValue': any,
  86. 'scope': string,
  87. 'description': string
  88. }[],
  89. 'modelId': string,
  90. canRemove: boolean // 用来标志是否可以被删除,具备该值且者该值为true的情况下 命令是不能有删除按钮
  91. }
  92. }
  93. namespace DEVICE {
  94. type QueryPamars = {
  95. page: number
  96. pageSize: number
  97. deviceStatus?: DeviceTypeEnum
  98. modelId?: string
  99. searchKey?: string
  100. searchValue?: string
  101. }
  102. type BodyParams = {
  103. modelId: string
  104. deviceCode: string
  105. deviceLabel: string
  106. deviceAuthType: string
  107. deviceSecret: string
  108. confirmSecret: string
  109. }
  110. type SubBodyParams = {
  111. gatewayId: string,
  112. modelId: string
  113. deviceCode: string
  114. deviceLabel: string
  115. }
  116. interface Device {
  117. id: string
  118. deviceLabel: string
  119. deviceCode: string
  120. deviceDescription: string
  121. modelId: string
  122. modelLabel: string
  123. deviceStatus: string
  124. deviceNodeType: string
  125. lastConnectTs: string
  126. lastActivityTs: string
  127. authType: 'SECRET' | 'X509CERT'
  128. deviceAddr: string
  129. }
  130. interface DeviceTag {
  131. deviceId: string,
  132. tagLabel: string
  133. tagValue: string
  134. }
  135. interface Count {
  136. 'TOTAL': string,
  137. 'DISABLED': string,
  138. 'INIT': string,
  139. 'CONNECT': string,
  140. 'DISCONNECT': string
  141. }
  142. interface Msg {
  143. 'id': string,
  144. 'deviceId': string,
  145. 'status': DeviceMsgEnum, // 消息状态 值有QUEUED 队列中,SENT 已发送,DELIVERED 设备收到 SUCCESSFUL 成功 TIMEOUT 超时 FAILED 失败
  146. 'msgPayload': string,
  147. 'msgLabel': string,
  148. 'topic': string,
  149. 'msgId': number
  150. }
  151. interface Cmd {
  152. id: string
  153. 'status': DeviceMsgEnum,
  154. 'msgId': number,
  155. 'cmdCode': string,
  156. 'cmdLabel': string,
  157. 'cmdPayload': any // '{"method":null,"params":null}',
  158. 'deviceId': string
  159. }
  160. interface Group {
  161. 'groupLabel': string, // 分组名字
  162. 'upperGroupId': string, // 上级分组id
  163. 'id': string, // 分组id
  164. }
  165. interface GroupQueryParams {
  166. page: number,
  167. pageSize: number,
  168. modelId?: string,
  169. searchKey?: string,
  170. deviceGroupId: string,
  171. searchValue?: string,
  172. }
  173. interface Topology {
  174. gatewayDevice: {
  175. 'id': string,
  176. 'modelLabel': string,
  177. 'deviceCode': string,
  178. 'deviceLabel': string,
  179. 'deviceDescription': string,
  180. 'modelId': string,
  181. 'deviceStatus': string,
  182. 'deviceNodeType': string,
  183. 'lastConnectTs': string,
  184. 'lastActivityTs': string,
  185. 'gatewayId': string
  186. }[],
  187. model: {
  188. 'id': string,
  189. 'modelLabel': string,
  190. 'transportType': string,
  191. 'payloadType': string,
  192. 'deviceType': string,
  193. 'modelDescription': string,
  194. }[],
  195. subDevice: {
  196. 'id': string,
  197. 'modelLabel': string,
  198. 'deviceCode': string,
  199. 'deviceLabel': string,
  200. 'deviceDescription': string,
  201. 'modelId': string,
  202. 'deviceStatus': string,
  203. 'deviceNodeType': string,
  204. 'lastConnectTs': string,
  205. 'lastActivityTs': string,
  206. 'gatewayId': string
  207. }[]
  208. }
  209. interface Session {
  210. 'id': string,
  211. offlineNum: number
  212. onlineNum: number
  213. sessionEntities: {
  214. 'createAt': 1683171293012,
  215. 'updateAt': string,
  216. 'deviceId': string,
  217. 'sessionType': 'CONNECT' | 'DISCONNECT',
  218. 'connectTime': string,
  219. 'activityTime': string
  220. }[]
  221. }
  222. interface Attr {
  223. hum?: {
  224. 'deviceId':string,
  225. 'ts': string,
  226. 'key': string,
  227. 'keyLabel': string,
  228. 'stringValue': any,
  229. 'doubleValue': any,
  230. 'longValue': number,
  231. 'booleanValue': null,
  232. 'jsonValue': null,
  233. 'dataUnit': string,
  234. 'scope': null,
  235. 'dataType': string
  236. }[]
  237. [key: string]: any
  238. }
  239. interface Ota {
  240. 'deviceId': string,
  241. 'otaTime': number, // 设备当前ota 升级名称,如果是0 说明从未升级过,有值的情况是 毫秒数字
  242. 'msgId': any,
  243. 'status': any, // QUEUED,SENT,DELIVERED,SUCCESSFUL,TIMEOUT,FAILED
  244. 'otaPkgId': string, // ota包id
  245. 'otaPkgLabel': string, // 设备当前ota 名称,如果是-- 说明从未升级过
  246. 'otaPkgVersion': string // 设备当前ota 版本,如果是-- 说明从未升级过
  247. }
  248. interface OtaQueryParams {
  249. page: number
  250. pageSize: number
  251. deviceId: string
  252. otaLabel: string
  253. otaVersion: string
  254. otaStatus: 'QUEUED' | 'SENT' | 'DELIVERED' | 'SUCCESSFUL' | 'TIMEOUT' | 'FAILED' | ''
  255. }
  256. }
  257. namespace EVENT {
  258. interface Event {
  259. 'id': string,
  260. 'entityId': string,
  261. 'eventName': string,
  262. 'eventPayload': string,
  263. 'eventType': string,
  264. 'eventTs': bigint,
  265. 'success': boolean
  266. }
  267. interface QueryParams {
  268. deviceId: string
  269. lastId: string
  270. startTime: string,
  271. page: string
  272. success?: boolean
  273. pageSize: string
  274. eventType: EventTypeEnum
  275. endTime: string
  276. }
  277. }
  278. namespace RULE {
  279. interface ForwardRuleQueryParams {
  280. page: number,
  281. pageSize: number,
  282. ruleLabel?: string,
  283. id: string,
  284. subjectResource: SubjectResourceEnum,
  285. subjectEvent: SubjectEventEnum,
  286. status: boolean,
  287. }
  288. interface ForwardRuleBody {
  289. subjectResource: SubjectResourceEnum,
  290. subjectEvent: SubjectEventEnum,
  291. ruleLabel: string,
  292. ruleDescription?: string,
  293. forwardRuleTargets: Array
  294. }
  295. interface ForwardRule {
  296. 'id': null,
  297. 'ruleLabel': string,
  298. 'ruleDescription': string,
  299. 'subjectResource': SubjectResourceEnum,
  300. 'subjectEvent': SubjectEventEnum,
  301. 'entityId': null,
  302. 'forwardRuleTargets': null,
  303. 'status': false
  304. }
  305. interface LinkRuleBody {
  306. ruleLabel: string
  307. ruleDescription: string
  308. conditionLogic: string
  309. conditions: Array
  310. actions: Array
  311. }
  312. interface LinkRule {
  313. 'ruleLabel': string,
  314. 'ruleDescription': string,
  315. 'conditionLogic': string,
  316. 'conditions': Array
  317. actions: Array
  318. status: boolean
  319. }
  320. }
  321. namespace DATA {
  322. interface QueryParams {
  323. page: number,
  324. pageSize: number,
  325. deviceId: string
  326. modelId: string
  327. attributeKey: string,
  328. startTime: string,
  329. endTime
  330. }
  331. interface History {
  332. 'deviceId': string,
  333. 'ts': 1681181164001,
  334. 'key': string,
  335. 'keyLabel': string,
  336. 'stringValue': string,
  337. 'doubleValue': null,
  338. 'longValue': null,
  339. 'booleanValue': null,
  340. 'jsonValue': null,
  341. 'dataUnit': null,
  342. 'scope': null
  343. }
  344. interface OpenApi {
  345. id: string
  346. 'apiUrl': string,
  347. 'apiLabel': string,
  348. 'apiDescription':string,
  349. 'apiParameters': string,
  350. 'apiParametersDescription': string,
  351. 'apiResponse': string,
  352. 'apiResponseDescription': string
  353. }
  354. }
  355. namespace DEVOPS {
  356. type statsType = 'transportSuccessCounter' | 'transportFailCounter'
  357. | 'transportTotalCounter' | 'toTransportSuccessCounter' | 'toTransportFailCounter'
  358. | 'toTransportTotalCounter'| 'transportReqSuccessCounter'| 'transportReqFailCounter'| 'transportReqTotalCounter'
  359. interface Notice {
  360. entityId: string,
  361. id: string
  362. noticeDescription: string
  363. noticeEntityId: string
  364. noticeLabel: string
  365. }
  366. }
  367. namespace TASK {
  368. interface Task {
  369. 'taskLabel': string,
  370. 'taskConfig': {
  371. cmdParameters: Record<string, any>
  372. taskType: 'DEVICE_CMD' |'DEVICE_MSG' |'DEVICE_DISCONNECT'
  373. }, // 任务配置
  374. 'status': number, // 任务状态
  375. 'taskDescription': string,
  376. 'cornDescr': string // corn 表达式
  377. }
  378. interface Statistics {
  379. 'TOTAL': number,
  380. 'DISABLE': number,
  381. 'ENABLE': number
  382. }
  383. interface TrackTask {
  384. 'id': string,
  385. 'taskId': string, // 任务id
  386. 'ts': bigint, // 执行时间
  387. 'params': null, // 任务参数
  388. 'ret': null, // 任务结果
  389. }
  390. }
  391. namespace SYS {
  392. interface Sys {
  393. 'id': string,
  394. 'sysLabel': string,
  395. 'sysIcon': string, // 系统图片,上传时候限制大小为3M 并且base64 编码
  396. 'sysTheme': string,
  397. mqttServerUrl: string // 'MQTT 服务地址'
  398. coapServerUrl: string // 'COAP 服务地址'
  399. httpServerUrl: string // 'HTTP 服务地址'
  400. 'mailConf': {
  401. 'host': string,
  402. 'port': number,
  403. 'protocol': string,
  404. 'username': string,
  405. 'password': string
  406. }
  407. }
  408. interface Notice {
  409. 'id': string,
  410. 'source': 0 | 1, // 通知数据来源 0 通知 1 告警
  411. 'label': string, // 通知方式名称
  412. 'notification': null, // 通知配置
  413. 'status': boolean, // 状态 true 是启用 false 是停用
  414. notification: {
  415. methodType: 'EMAIL' | 'WEBHOOK',
  416. to: string
  417. cc: string[]
  418. hookUrl: string
  419. hookMethod: 'POST' | 'GET'
  420. customHeaders: Record<string, string>
  421. }
  422. }
  423. }
  424. namespace OTA {
  425. interface QueryParams {
  426. page: number
  427. pageSize: number
  428. label: string
  429. version: string
  430. pkgType: 'FILE_URL' | 'FILE_ZIP' | ''
  431. }
  432. interface BodyParams {
  433. label: string
  434. version: string
  435. pkgUrl: string
  436. pkgType: 'FILE_URL' | 'FILE_ZIP',
  437. }
  438. interface Detail {
  439. 'id'?: string,
  440. 'createAt': number,
  441. 'updateAt': null,
  442. 'version': string,
  443. 'pkgType': 'FILE_URL' | 'FILE_ZIP',
  444. 'pkgUrl': string,
  445. 'label': string,
  446. }
  447. }
  448. namespace THIRDDEVICE {
  449. interface QueryParams {
  450. 'deviceCode'?: string, // 设备编码 唯一标志 必须填写
  451. 'deviceLabel'?: string, // 设备名称 必须填写
  452. 'deviceType'?: string, // 设备类型
  453. 'deviceDesc'?: string, // 设备描述
  454. 'deviceAddr'?: string, // 设备地址
  455. }
  456. interface Detail {
  457. 'deviceCode': string, // 设备编码 唯一标志
  458. 'deviceLabel': string, // 设备名称
  459. 'deviceType': string, // 设备类型
  460. 'deviceStatus': string, // 设备状态
  461. 'deviceStatusDesc': string, // 设备状态描述
  462. 'deviceDesc': string, // 设备描述
  463. 'deviceAddr': string, // 设备地址
  464. 'deviceData': string, // 设备数据,json 或者字符串,可以点击放大查看 或者其他展示方式
  465. }
  466. }
  467. }
  468. }