@kohost/api-client 3.0.0-beta.5 → 3.0.0-beta.51

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.
Files changed (211) hide show
  1. package/README.md +71 -0
  2. package/dist/cjs/AMQPClient/index.js +290 -0
  3. package/dist/cjs/{Client.js → Client/index.js} +1938 -986
  4. package/dist/cjs/Commands/CheckInReservationCommand.js +19 -0
  5. package/dist/cjs/Commands/Command.js +34 -0
  6. package/dist/cjs/Commands/CreateImageUploadEndpointCommand.js +17 -0
  7. package/dist/cjs/Commands/CreateShortLinkCommand.js +20 -0
  8. package/dist/cjs/Commands/DiscoverReservationRoomTypeUpsellOptionsCommand.js +20 -0
  9. package/dist/cjs/Commands/DiscoverReservationsCommand.js +20 -0
  10. package/dist/cjs/Commands/DiscoverRoomTypesCommand.js +19 -0
  11. package/dist/cjs/Commands/DiscoverRoomsCommand.js +35 -0
  12. package/dist/cjs/Commands/DiscoverUsersCommand.js +19 -0
  13. package/dist/cjs/Commands/GetMobileKeyCommand.js +24 -0
  14. package/dist/cjs/Commands/GetProductsCommand.js +17 -0
  15. package/dist/cjs/Commands/OCRDocumentCommand.js +15 -0
  16. package/dist/cjs/Commands/SellProductsCommand.js +17 -0
  17. package/dist/cjs/Commands/SendEmailCommand.js +24 -0
  18. package/dist/cjs/Commands/SendSMSCommand.js +21 -0
  19. package/dist/cjs/Commands/SetAlarmCommand.js +17 -0
  20. package/dist/cjs/Commands/SetCourtesyCommand.js +17 -0
  21. package/dist/cjs/Commands/SetDimmerCommand.js +17 -0
  22. package/dist/cjs/Commands/SetLockCommand.js +17 -0
  23. package/dist/cjs/Commands/SetMediaCommand.js +17 -0
  24. package/dist/cjs/Commands/SetSceneCommand.js +17 -0
  25. package/dist/cjs/Commands/SetSwitchCommand.js +17 -0
  26. package/dist/cjs/Commands/SetThermostatCommand.js +17 -0
  27. package/dist/cjs/Commands/SetWindowCoveringCommand.js +17 -0
  28. package/dist/cjs/Commands/UpdateReservationCommand.js +19 -0
  29. package/dist/cjs/Commands/UpdateUserCommand.js +41 -0
  30. package/dist/cjs/Commands/UploadImageCommand.js +17 -0
  31. package/dist/cjs/Commands/index.js +55 -0
  32. package/dist/cjs/Errors/AppError.js +8 -0
  33. package/dist/cjs/Errors/AuthenticationError.js +9 -0
  34. package/dist/cjs/Errors/AuthorizationError.js +9 -0
  35. package/dist/cjs/Errors/DeviceCommError.js +9 -0
  36. package/dist/cjs/Errors/LoginError.js +9 -0
  37. package/dist/cjs/Errors/NotFoundError.js +9 -0
  38. package/dist/cjs/Errors/RequestError.js +9 -0
  39. package/dist/cjs/Errors/SystemCommError.js +9 -0
  40. package/dist/cjs/Errors/TokenExpiredError.js +9 -0
  41. package/dist/cjs/Errors/UnprocessableRequestError.js +9 -0
  42. package/dist/cjs/Errors/ValidationError.js +9 -0
  43. package/dist/cjs/Errors/index.js +15 -0
  44. package/dist/cjs/Events/ApplicationInUseEvent.js +17 -0
  45. package/dist/cjs/Events/ApplicationOutOfUseEvent.js +17 -0
  46. package/dist/cjs/Events/EmailEvent.js +18 -0
  47. package/dist/cjs/Events/Event.js +55 -0
  48. package/dist/cjs/Events/SMSEvent.js +18 -0
  49. package/dist/cjs/Events/SMSSentEvent.js +17 -0
  50. package/dist/cjs/Events/ShortLinkCreatedEvent.js +17 -0
  51. package/dist/cjs/Events/SystemAlarmUpdatedEvent.js +17 -0
  52. package/dist/cjs/Events/SystemCameraUpdatedEvent.js +17 -0
  53. package/dist/cjs/Events/SystemCourtesyUpdatedEvent.js +17 -0
  54. package/dist/cjs/Events/SystemDimmerUpdatedEvent.js +17 -0
  55. package/dist/cjs/Events/SystemGatewayUpdatedEvent.js +17 -0
  56. package/dist/cjs/Events/SystemLockUpdatedEvent.js +17 -0
  57. package/dist/cjs/Events/SystemMediaSourceUpdatedEvent.js +17 -0
  58. package/dist/cjs/Events/SystemMotionSensorUpdatedEvent.js +17 -0
  59. package/dist/cjs/Events/SystemProductUpdatedEvent.js +17 -0
  60. package/dist/cjs/Events/SystemReservationUpdatedEvent.js +17 -0
  61. package/dist/cjs/Events/SystemSceneControllerUpdatedEvent.js +17 -0
  62. package/dist/cjs/Events/SystemSpaceTypeUpdatedEvent.js +17 -0
  63. package/dist/cjs/Events/SystemSpaceUpdatedEvent.js +17 -0
  64. package/dist/cjs/Events/SystemSwitchUpdatedEvent.js +17 -0
  65. package/dist/cjs/Events/SystemThermostatUpdatedEvent.js +17 -0
  66. package/dist/cjs/Events/SystemUserUpdatedEvent.js +17 -0
  67. package/dist/cjs/Events/SystemWindowCoveringUpdatedEvent.js +17 -0
  68. package/dist/cjs/Events/index.js +51 -0
  69. package/dist/cjs/Models/Alarm.js +35 -0
  70. package/dist/cjs/Models/Camera.js +35 -0
  71. package/dist/cjs/Models/Courtesy.js +39 -0
  72. package/dist/cjs/Models/Credential.js +35 -0
  73. package/dist/cjs/Models/Dimmer.js +61 -0
  74. package/dist/cjs/Models/DiscoveredDevice.js +36 -0
  75. package/dist/cjs/Models/EmailMessage.js +35 -0
  76. package/dist/cjs/Models/EnergyReport.js +35 -0
  77. package/dist/cjs/Models/EnergyReportShard.js +35 -0
  78. package/dist/cjs/Models/Gateway.js +35 -0
  79. package/dist/cjs/Models/Identification.js +38 -0
  80. package/dist/cjs/Models/Kohost.js +96 -0
  81. package/dist/cjs/Models/Lock.js +39 -0
  82. package/dist/cjs/Models/MediaFile.js +47 -0
  83. package/dist/cjs/Models/MediaSource.js +35 -0
  84. package/dist/cjs/Models/MotionSensor.js +35 -0
  85. package/dist/cjs/Models/Organization.js +34 -0
  86. package/dist/cjs/Models/Product.js +35 -0
  87. package/dist/cjs/Models/Property.js +34 -0
  88. package/dist/cjs/Models/Reservation.js +104 -0
  89. package/dist/cjs/Models/Room.js +218 -0
  90. package/dist/cjs/Models/Scene.js +189 -0
  91. package/dist/cjs/Models/ShortLink.js +35 -0
  92. package/dist/cjs/Models/SmsMessage.js +35 -0
  93. package/dist/cjs/Models/Space.js +97 -0
  94. package/dist/cjs/Models/SpaceType.js +36 -0
  95. package/dist/cjs/Models/Switch.js +39 -0
  96. package/dist/cjs/Models/SystemUser.js +55 -0
  97. package/dist/cjs/Models/Thermostat.js +86 -0
  98. package/dist/cjs/Models/Ticket.js +111 -0
  99. package/dist/cjs/Models/User.js +79 -0
  100. package/dist/cjs/Models/WindowCovering.js +55 -0
  101. package/dist/cjs/Models/index.js +68 -0
  102. package/dist/cjs/SocketIoClient/index.js +74 -0
  103. package/dist/cjs/defs/deviceTypes.js +15 -0
  104. package/dist/cjs/defs/formalDeviceTypes.js +6 -0
  105. package/dist/cjs/defs/index.js +11 -0
  106. package/dist/cjs/{index.cjs.js → index.js} +7 -1
  107. package/dist/cjs/schemas/alarm.json +103 -0
  108. package/dist/cjs/schemas/camera.json +50 -0
  109. package/dist/cjs/schemas/courtesy.json +46 -0
  110. package/dist/cjs/schemas/credential.json +31 -0
  111. package/dist/cjs/schemas/definitions.json +191 -0
  112. package/dist/cjs/schemas/dimmer.json +43 -0
  113. package/dist/cjs/schemas/discoveredDevice.json +31 -0
  114. package/dist/cjs/schemas/emailMessage.json +71 -0
  115. package/dist/cjs/schemas/energyReport.json +86 -0
  116. package/dist/cjs/schemas/energyReportShard.json +75 -0
  117. package/dist/cjs/schemas/gateway.json +35 -0
  118. package/dist/cjs/schemas/identification.json +61 -0
  119. package/dist/cjs/schemas/lock.json +45 -0
  120. package/dist/cjs/schemas/mediaFile.json +67 -0
  121. package/dist/cjs/schemas/mediaSource.json +184 -0
  122. package/dist/cjs/schemas/motionSensor.json +32 -0
  123. package/dist/cjs/schemas/organization.json +36 -0
  124. package/dist/cjs/schemas/payment.json +47 -0
  125. package/dist/cjs/schemas/product.json +40 -0
  126. package/dist/cjs/schemas/property.json +246 -0
  127. package/dist/cjs/schemas/reservation.json +118 -0
  128. package/dist/cjs/schemas/room.json +98 -0
  129. package/dist/cjs/schemas/scene.json +121 -0
  130. package/dist/cjs/schemas/shortLink.json +30 -0
  131. package/dist/cjs/schemas/smsMessage.json +61 -0
  132. package/dist/cjs/schemas/space.json +120 -0
  133. package/dist/cjs/schemas/spaceType.json +30 -0
  134. package/dist/cjs/schemas/switch.json +42 -0
  135. package/dist/cjs/schemas/systemUser.json +95 -0
  136. package/dist/cjs/schemas/thermostat.json +153 -0
  137. package/dist/cjs/schemas/ticket.json +96 -0
  138. package/dist/cjs/schemas/user.json +152 -0
  139. package/dist/cjs/schemas/windowCovering.json +43 -0
  140. package/dist/cjs/utils/errorFactory.js +8 -0
  141. package/dist/cjs/utils/eventFactory.js +10 -0
  142. package/dist/cjs/utils/getDeviceTypes.js +7 -0
  143. package/dist/cjs/utils/getFormalDeviceType.js +5 -0
  144. package/dist/cjs/utils/index.js +11 -0
  145. package/dist/cjs/utils/schema.js +25 -0
  146. package/dist/esm/Client.js +2293 -1205
  147. package/dist/esm/Client.js.map +4 -4
  148. package/dist/esm/Commands.js +478 -73
  149. package/dist/esm/Commands.js.map +3 -3
  150. package/dist/esm/Errors.js +35 -0
  151. package/dist/esm/Errors.js.map +1 -1
  152. package/dist/esm/Events.js +290 -63
  153. package/dist/esm/Events.js.map +3 -3
  154. package/dist/esm/Models.js +3074 -880
  155. package/dist/esm/Models.js.map +4 -4
  156. package/dist/esm/SocketIoClient.js +4748 -0
  157. package/dist/esm/SocketIoClient.js.map +7 -0
  158. package/dist/esm/defs.js +407 -279
  159. package/dist/esm/defs.js.map +4 -4
  160. package/dist/esm/index.js +17 -10
  161. package/dist/esm/utils.js +742 -85
  162. package/dist/esm/utils.js.map +3 -3
  163. package/dist/useCases/{AdminUpdateProperty.js → AdminUpdateCustomer.js} +2 -2
  164. package/dist/useCases/AssignSpaceToReservation.js +32 -0
  165. package/dist/useCases/BatchNotifyCheckIn.js +32 -0
  166. package/dist/useCases/CreateImageUploadEndpoint.js +32 -0
  167. package/dist/useCases/{CreateSource.js → CreateMediaSource.js} +2 -2
  168. package/dist/useCases/{AdminListCustomers.js → CreateOrganization.js} +3 -3
  169. package/dist/useCases/{LoginGateway.js → CreateProperty.js} +2 -2
  170. package/dist/useCases/{AdminCreateProperty.js → CreateSpaceType.js} +2 -2
  171. package/dist/useCases/DeleteMediaFile.js +32 -0
  172. package/dist/useCases/{DeleteSource.js → DeleteMediaSource.js} +2 -2
  173. package/dist/useCases/DeleteSpaceType.js +32 -0
  174. package/dist/useCases/DescribeLockCredential.js +32 -0
  175. package/dist/useCases/{DescribeIntegration.js → DescribeMediaSource.js} +3 -3
  176. package/dist/useCases/DescribeMyAccessCredentials.js +32 -0
  177. package/dist/useCases/{AdminDescribeProperty.js → DescribeOrganization.js} +2 -2
  178. package/dist/useCases/DescribeProduct.js +32 -0
  179. package/dist/useCases/{ListIntegrations.js → DescribeProperty.js} +3 -3
  180. package/dist/useCases/DescribeReservationEarlyCheckInProducts.js +32 -0
  181. package/dist/useCases/DescribeReservationRoomUpgrades.js +32 -0
  182. package/dist/useCases/{DeleteIntegration.js → DescribeSpaceType.js} +2 -2
  183. package/dist/useCases/ListMediaSources.js +32 -0
  184. package/dist/useCases/{AdminListProperties.js → ListMyTickets.js} +2 -2
  185. package/dist/useCases/{UpdateIntegration.js → ListOrganizations.js} +4 -4
  186. package/dist/useCases/ListProperties.js +32 -0
  187. package/dist/useCases/ListScenes.js +32 -0
  188. package/dist/useCases/ListSpaceTypes.js +32 -0
  189. package/dist/useCases/ListTeam.js +32 -0
  190. package/dist/useCases/ListUserSpaces.js +32 -0
  191. package/dist/useCases/LogoutUser.js +32 -0
  192. package/dist/useCases/PurchaseReservationEarlyCheckInProducts.js +32 -0
  193. package/dist/useCases/{CreateIntegrationDeviceMapEntry.js → PurchaseReservationRoomUpgrades.js} +2 -2
  194. package/dist/useCases/RequestLoginLink.js +1 -1
  195. package/dist/useCases/{CreateIntegration.js → RequestMyKeyToken.js} +2 -2
  196. package/dist/useCases/SendCheckInSMS.js +32 -0
  197. package/dist/useCases/{SetSource.js → SetDimmer.js} +2 -2
  198. package/dist/useCases/{DescribeSource.js → SetMediaSource.js} +3 -3
  199. package/dist/useCases/{UpdateSource.js → SetRoomScene.js} +3 -3
  200. package/dist/useCases/SetSpaceScene.js +32 -0
  201. package/dist/useCases/UpdateMediaSource.js +32 -0
  202. package/dist/useCases/UpdateProperty.js +32 -0
  203. package/dist/useCases/UpdateSpaceType.js +32 -0
  204. package/dist/useCases/{ListSources.js → UploadImage.js} +4 -4
  205. package/package.json +36 -10
  206. package/dist/cjs/Commands.js +0 -568
  207. package/dist/cjs/Errors.js +0 -174
  208. package/dist/cjs/Events.js +0 -375
  209. package/dist/cjs/Models.js +0 -3582
  210. package/dist/cjs/defs.js +0 -175
  211. package/dist/cjs/utils.js +0 -246
@@ -0,0 +1,15 @@
1
+ const types = [
2
+ "dimmer",
3
+ "switch",
4
+ "thermostat",
5
+ "lock",
6
+ "windowCovering",
7
+ "courtesy",
8
+ "alarm",
9
+ "camera",
10
+ "mediaSource",
11
+ "motionSensor",
12
+ "gateway",
13
+ ];
14
+
15
+ module.exports = types;
@@ -0,0 +1,6 @@
1
+ const deviceTypes = require("./deviceTypes");
2
+ const formalDeviceTypes = deviceTypes.map(
3
+ (type) => type.charAt(0).toUpperCase() + type.slice(1)
4
+ );
5
+
6
+ module.exports = formalDeviceTypes;
@@ -0,0 +1,11 @@
1
+ const deviceTypes = require("./deviceTypes");
2
+ const formalDeviceTypes = require("./formalDeviceTypes");
3
+ const { defs: httpDefs } = require("../Client");
4
+
5
+ const defs = {
6
+ http: httpDefs,
7
+ deviceTypes,
8
+ formalDeviceTypes,
9
+ };
10
+
11
+ module.exports = defs;
@@ -5,13 +5,19 @@ const Events = require("./Events");
5
5
  const defs = require("./defs");
6
6
  const utils = require("./utils");
7
7
  const Client = require("./Client");
8
+ const SocketIoClient = require("./SocketIoClient");
9
+ const AMQPClient = require("./AMQPClient");
10
+
8
11
  const Kohost = {
9
12
  Models,
10
13
  Errors,
11
14
  Commands,
12
15
  Events,
13
16
  Client,
17
+ SocketIoClient,
18
+ AMQPClient,
14
19
  defs,
15
- utils
20
+ utils: utils,
16
21
  };
22
+
17
23
  module.exports = Kohost;
@@ -0,0 +1,103 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema",
3
+ "$id": "alarm.json",
4
+ "title": "Alarm",
5
+ "description": "Any smart alarm system",
6
+ "type": "object",
7
+ "properties": {
8
+ "id": {
9
+ "$ref": "definitions.json#/definitions/id"
10
+ },
11
+ "name": {
12
+ "type": "string"
13
+ },
14
+ "type": {
15
+ "$ref": "definitions.json#/definitions/type"
16
+ },
17
+ "systemData": {
18
+ "$ref": "definitions.json#/definitions/systemData"
19
+ },
20
+ "supportedNotifications": {
21
+ "$ref": "definitions.json#/definitions/supportedNotifications"
22
+ },
23
+ "notification": {
24
+ "$ref": "definitions.json#/definitions/notification"
25
+ },
26
+ "driver": {
27
+ "$ref": "definitions.json#/definitions/driver"
28
+ },
29
+ "areas": {
30
+ "type": "array",
31
+ "items": {
32
+ "type": "object",
33
+ "properties": {
34
+ "number": {
35
+ "type": "number"
36
+ },
37
+ "name": {
38
+ "type": "string"
39
+ },
40
+ "securityMode": {
41
+ "type": "string",
42
+ "enum": ["arming", "disarming", "armed", "disarmed", "alarm"]
43
+ },
44
+ "readyToArm": {
45
+ "type": "boolean"
46
+ }
47
+ },
48
+ "additionalProperties": false
49
+ }
50
+ },
51
+ "zones": {
52
+ "type": "array",
53
+ "items": {
54
+ "type": "object",
55
+ "properties": {
56
+ "number": {
57
+ "type": "number",
58
+ "minimum": 0
59
+ },
60
+ "name": {
61
+ "type": "string"
62
+ },
63
+ "secure": {
64
+ "type": "boolean"
65
+ },
66
+ "bypassed": {
67
+ "type": "boolean"
68
+ }
69
+ },
70
+ "additionalProperties": false
71
+ }
72
+ },
73
+ "supportedTroubles": {
74
+ "type": "array",
75
+ "uniqueItems": true,
76
+ "items": {
77
+ "type": "string",
78
+ "enum": ["battery", "ac", "phone", "bell", "fire"]
79
+ }
80
+ },
81
+ "troubles": {
82
+ "type": "array",
83
+ "uniqueItems": true,
84
+ "items": {
85
+ "$ref": "#/properties/supportedTroubles/items"
86
+ }
87
+ },
88
+ "watts": {
89
+ "$ref": "definitions.json#/definitions/watts"
90
+ }
91
+ },
92
+ "additionalProperties": false,
93
+ "required": [
94
+ "id",
95
+ "type",
96
+ "systemData",
97
+ "areas",
98
+ "zones",
99
+ "supportedTroubles",
100
+ "troubles",
101
+ "driver"
102
+ ]
103
+ }
@@ -0,0 +1,50 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema",
3
+ "$id": "camera.json",
4
+ "title": "Camera",
5
+ "description": "Any smart camera",
6
+ "type": "object",
7
+ "properties": {
8
+ "id": {
9
+ "$ref": "definitions.json#/definitions/id"
10
+ },
11
+ "name": {
12
+ "type": "string"
13
+ },
14
+ "type": {
15
+ "$ref": "definitions.json#/definitions/type"
16
+ },
17
+ "supportedNotifications": {
18
+ "$ref": "definitions.json#/definitions/supportedNotifications"
19
+ },
20
+ "notification": {
21
+ "$ref": "definitions.json#/definitions/notification"
22
+ },
23
+ "driver": {
24
+ "$ref": "definitions.json#/definitions/driver"
25
+ },
26
+ "liveStreams": {
27
+ "type": "object",
28
+ "additionalProperties": false,
29
+ "properties": {
30
+ "iframe": {
31
+ "type": ["string", "null"]
32
+ },
33
+ "hls": {
34
+ "type": ["string", "null"]
35
+ },
36
+ "webRTC": {
37
+ "type": ["string", "null"]
38
+ }
39
+ }
40
+ },
41
+ "systemData": {
42
+ "$ref": "definitions.json#/definitions/systemData"
43
+ },
44
+ "watts": {
45
+ "$ref": "definitions.json#/definitions/watts"
46
+ }
47
+ },
48
+ "additionalProperties": false,
49
+ "required": ["id", "type", "systemData", "streams", "driver"]
50
+ }
@@ -0,0 +1,46 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema",
3
+ "$id": "courtesy.json",
4
+ "title": "Courtesy",
5
+ "description": "Any smart courtesy system",
6
+ "type": "object",
7
+ "properties": {
8
+ "id": {
9
+ "$ref": "definitions.json#/definitions/id"
10
+ },
11
+ "name": {
12
+ "type": "string"
13
+ },
14
+ "type": {
15
+ "$ref": "definitions.json#/definitions/type"
16
+ },
17
+ "supportedNotifications": {
18
+ "$ref": "definitions.json#/definitions/supportedNotifications"
19
+ },
20
+ "notification": {
21
+ "$ref": "definitions.json#/definitions/notification"
22
+ },
23
+ "driver": {
24
+ "$ref": "definitions.json#/definitions/driver"
25
+ },
26
+ "supportedStates": {
27
+ "type": "array",
28
+ "uniqueItems": true,
29
+ "items": {
30
+ "enum": ["privacy", "service", "none"]
31
+ }
32
+ },
33
+ "state": {
34
+ "type": "string",
35
+ "$ref": "#/properties/supportedStates/items"
36
+ },
37
+ "systemData": {
38
+ "$ref": "definitions.json#/definitions/systemData"
39
+ },
40
+ "watts": {
41
+ "$ref": "definitions.json#/definitions/watts"
42
+ }
43
+ },
44
+ "additionalProperties": false,
45
+ "required": ["id", "type", "driver", "supportedStates", "state"]
46
+ }
@@ -0,0 +1,31 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema",
3
+ "$id": "credential.json",
4
+ "title": "Credential",
5
+ "type": "object",
6
+ "required": ["type", "credential", "expires"],
7
+ "properties": {
8
+ "id": {
9
+ "$ref": "definitions.json#/definitions/id"
10
+ },
11
+ "type": {
12
+ "type": "string",
13
+ "enum": ["verificationCode", "token", "mobileKey"]
14
+ },
15
+ "credential": {
16
+ "type": "string"
17
+ },
18
+ "user": {
19
+ "type": "string"
20
+ },
21
+ "userAgent": {
22
+ "type": "string"
23
+ },
24
+ "expires": {
25
+ "string": "string"
26
+ },
27
+ "systemData": {
28
+ "$ref": "definitions.json#/definitions/systemData"
29
+ }
30
+ }
31
+ }
@@ -0,0 +1,191 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema",
3
+ "$id": "definitions.json",
4
+ "title": "Definitions",
5
+ "definitions": {
6
+ "id": {
7
+ "type": "string",
8
+ "not": {
9
+ "enum": ["global", "system"]
10
+ }
11
+ },
12
+ "systemData": {
13
+ "type": "object",
14
+ "default": {}
15
+ },
16
+ "metadata": {
17
+ "type": "object",
18
+ "default": {}
19
+ },
20
+ "date": {
21
+ "type": ["string", "object"],
22
+ "format": "date-time"
23
+ },
24
+ "createdAt": {
25
+ "type": ["string", "object"],
26
+ "format": "date-time"
27
+ },
28
+ "updatedAt": {
29
+ "type": ["string", "object"],
30
+ "format": "date-time"
31
+ },
32
+ "file": {
33
+ "type": "object",
34
+ "required": ["name", "type", "data"],
35
+ "properties": {
36
+ "name": {
37
+ "type": "string",
38
+ "description": "Name of the file."
39
+ },
40
+ "type": {
41
+ "type": "string",
42
+ "description": "MIME type of the file (e.g. application/pdf)."
43
+ },
44
+ "data": {
45
+ "type": "string",
46
+ "description": "Base64-encoded data of the file."
47
+ }
48
+ }
49
+ },
50
+ "address": {
51
+ "type": "object",
52
+ "properties": {
53
+ "id": {
54
+ "type": "string"
55
+ },
56
+ "line1": {
57
+ "type": "string"
58
+ },
59
+ "line2": {
60
+ "type": "string"
61
+ },
62
+ "line3": {
63
+ "type": "string"
64
+ },
65
+ "city": {
66
+ "type": "string"
67
+ },
68
+ "state": {
69
+ "type": "string"
70
+ },
71
+ "postalCode": {
72
+ "type": "string"
73
+ },
74
+ "countryCode": {
75
+ "type": "string",
76
+ "minLength": 2,
77
+ "maxLength": 2
78
+ }
79
+ }
80
+ },
81
+ "driver": {
82
+ "type": "string",
83
+ "enum": [
84
+ "aws-kinesis",
85
+ "butler",
86
+ "crestron",
87
+ "ecobee",
88
+ "igor",
89
+ "inncom",
90
+ "kohost-k7",
91
+ "kohost-pms",
92
+ "lg",
93
+ "lirc",
94
+ "mews",
95
+ "paxton",
96
+ "pelican-wireless",
97
+ "rebrandly",
98
+ "salto",
99
+ "salto-irn",
100
+ "se",
101
+ "sendgrid",
102
+ "stay-n-touch",
103
+ "twilio",
104
+ "cloudflare-images",
105
+ "cloudflare-stream",
106
+ "insperia-privacy"
107
+ ]
108
+ },
109
+ "type": {
110
+ "type": "string",
111
+ "enum": [
112
+ "alarm",
113
+ "dimmer",
114
+ "switch",
115
+ "motionSensor",
116
+ "windowCovering",
117
+ "camera",
118
+ "mediaSource",
119
+ "thermostat",
120
+ "lock",
121
+ "courtesy",
122
+ "gateway",
123
+ "tv",
124
+ "dvr",
125
+ "appleTv",
126
+ "discPlayer",
127
+ "mediaPlayer",
128
+ "uncontrolledDevice"
129
+ ]
130
+ },
131
+ "name": {
132
+ "type": "string"
133
+ },
134
+ "subType": {
135
+ "type": ["string", "null"]
136
+ },
137
+ "supportedNotifications": {
138
+ "type": "array",
139
+ "uniqueItems": true,
140
+ "items": {
141
+ "enum": [
142
+ "button 1",
143
+ "button 2",
144
+ "button 3",
145
+ "button 4",
146
+ "button 5",
147
+ "idle",
148
+ "powerHasBeedApplied",
149
+ "acMainsDisconnected",
150
+ "acMainsReconnected",
151
+ "replaceBatterySoon",
152
+ "replaceBatteryNow",
153
+ "hardwareFailure",
154
+ "softwareFailure",
155
+ "hardwareFailureWithCode",
156
+ "softwareFailureWithCode",
157
+ "motionDetection",
158
+ "airFilterNeedsCleaned",
159
+ "smokeDetected",
160
+ "outsideSafeTemperatureRange",
161
+ "outsideSafeHumidityRange"
162
+ ]
163
+ }
164
+ },
165
+ "notification": {
166
+ "type": ["object", "null"],
167
+ "properties": {
168
+ "name": {
169
+ "type": "string",
170
+ "$ref": "#/definitions/supportedNotifications/items"
171
+ },
172
+ "timestamp": {
173
+ "type": "number",
174
+ "minimum": 1655907956593
175
+ },
176
+ "description": {
177
+ "type": "string"
178
+ }
179
+ }
180
+ },
181
+ "batteryLevel": {
182
+ "type": "number",
183
+ "minimum": 0,
184
+ "maximum": 100
185
+ },
186
+ "watts": {
187
+ "type": "number",
188
+ "minimum": 0
189
+ }
190
+ }
191
+ }
@@ -0,0 +1,43 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema",
3
+ "$id": "dimmer.json",
4
+ "title": "Dimmer",
5
+ "description": "Any smart dimmer",
6
+ "type": "object",
7
+ "properties": {
8
+ "id": {
9
+ "$ref": "definitions.json#/definitions/id"
10
+ },
11
+ "name": {
12
+ "type": "string"
13
+ },
14
+ "type": {
15
+ "$ref": "definitions.json#/definitions/type"
16
+ },
17
+ "subType": {
18
+ "$ref": "definitions.json#/definitions/subType"
19
+ },
20
+ "supportedNotifications": {
21
+ "$ref": "definitions.json#/definitions/supportedNotifications"
22
+ },
23
+ "notification": {
24
+ "$ref": "definitions.json#/definitions/notification"
25
+ },
26
+ "driver": {
27
+ "$ref": "definitions.json#/definitions/driver"
28
+ },
29
+ "level": {
30
+ "type": "number",
31
+ "minimum": 0,
32
+ "maximum": 100
33
+ },
34
+ "systemData": {
35
+ "$ref": "definitions.json#/definitions/systemData"
36
+ },
37
+ "watts": {
38
+ "$ref": "definitions.json#/definitions/watts"
39
+ }
40
+ },
41
+ "additionalProperties": false,
42
+ "required": ["id", "type", "systemData", "level", "driver"]
43
+ }
@@ -0,0 +1,31 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema",
3
+ "$id": "discoveredDevice.json",
4
+ "title": "Discovered Device",
5
+ "description": "A device that has been discovered by Kohost, but not yet added to the Kohost system.",
6
+ "type": "object",
7
+ "required": ["name", "deviceId", "deviceData"],
8
+ "properties": {
9
+ "id": {
10
+ "$ref": "definitions.json#/definitions/id"
11
+ },
12
+ "name": {
13
+ "type": "string"
14
+ },
15
+ "deviceId": {
16
+ "type": "string"
17
+ },
18
+ "type": {
19
+ "$ref": "definitions.json#/definitions/type"
20
+ },
21
+ "driver": {
22
+ "type": "string"
23
+ },
24
+ "deviceData": {
25
+ "type": "object"
26
+ },
27
+ "ignore": {
28
+ "type": "boolean"
29
+ }
30
+ }
31
+ }
@@ -0,0 +1,71 @@
1
+ {
2
+ "$schema": "http://json-schema.org/draft-07/schema",
3
+ "$id": "emailMessage.json",
4
+ "title": "Email Message",
5
+ "type": "object",
6
+ "required": ["to", "from", "status", "subject"],
7
+ "properties": {
8
+ "id": {
9
+ "$ref": "definitions.json#/definitions/id"
10
+ },
11
+ "type": {
12
+ "type": "string",
13
+ "default": "emailMessage"
14
+ },
15
+ "to": {
16
+ "type": "string",
17
+ "pattern": "^[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\\.[a-zA-Z0-9-.]+$"
18
+ },
19
+ "from": {
20
+ "type": "string",
21
+ "pattern": ".*<[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\\.[a-zA-Z0-9-.]+>.*",
22
+ "description": "Must be in the format of 'Sender <email@example.com>"
23
+ },
24
+ "subject": {
25
+ "type": "string"
26
+ },
27
+ "status": {
28
+ "type": "string",
29
+ "enum": [
30
+ "queued",
31
+ "sending",
32
+ "sent",
33
+ "deferred",
34
+ "delivered",
35
+ "undelivered",
36
+ "bounced",
37
+ "blocked",
38
+ "receiving",
39
+ "received",
40
+ "opened",
41
+ "clicked",
42
+ "unsubscribed",
43
+ "spamReport"
44
+ ]
45
+ },
46
+ "statusMessage": {
47
+ "type": "string"
48
+ },
49
+ "html": {
50
+ "type": "string"
51
+ },
52
+ "text": {
53
+ "type": "string"
54
+ },
55
+ "driver": {
56
+ "type": "string"
57
+ },
58
+ "appData": {
59
+ "type": "object"
60
+ },
61
+ "createdAt": {
62
+ "$ref": "definitions.json#/definitions/date"
63
+ },
64
+ "updatedAt": {
65
+ "$ref": "definitions.json#/definitions/date"
66
+ },
67
+ "systemData": {
68
+ "$ref": "definitions.json#/definitions/systemData"
69
+ }
70
+ }
71
+ }