@kohost/api-client 1.0.0-alpha.1 → 1.0.0-alpha.3
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/.eslintrc.js +10 -0
- package/bitbucket-pipelines.yml +39 -0
- package/commands/Command.js +38 -0
- package/commands/SetAlarmCommand.js +21 -0
- package/commands/SetCourtesyCommand.js +21 -0
- package/commands/SetDimmerCommand.js +21 -0
- package/commands/SetLockCommand.js +21 -0
- package/commands/SetSceneControllerCommand.js +21 -0
- package/commands/SetSwitchCommand.js +21 -0
- package/commands/SetThermostatCommand.js +21 -0
- package/commands/SetWindowCoveringCommand.js +21 -0
- package/commands/VerifyDocumentCommand.js +24 -0
- package/commands/index.js +21 -0
- package/defs/deviceTypes.js +15 -0
- package/defs/formalDeviceTypes.js +6 -0
- package/defs/http.js +7 -0
- package/defs/index.js +11 -0
- package/errors/AppError.js +8 -0
- package/errors/AuthenticationError.js +9 -0
- package/errors/AuthorizationError.js +9 -0
- package/errors/DeviceCommError.js +9 -0
- package/errors/LoginError.js +9 -0
- package/errors/NotFoundError.js +9 -0
- package/errors/RequestError.js +9 -0
- package/errors/SystemCommError.js +9 -0
- package/errors/TokenExpiredError.js +9 -0
- package/errors/UnprocessableRequestError.js +9 -0
- package/errors/ValidationError.js +9 -0
- package/errors/index.js +15 -0
- package/events/Event.js +33 -0
- package/events/SystemCameraUpdatedEvent.js +17 -0
- package/events/SystemCourtesyUpdatedEvent.js +17 -0
- package/events/SystemDimmerUpdatedEvent.js +17 -0
- package/events/SystemLockUpdatedEvent.js +17 -0
- package/events/SystemReservationUpdatedEvent.js +17 -0
- package/events/SystemSceneControllerUpdatedEvent.js +17 -0
- package/events/SystemSourceUpdatedEvent.js +17 -0
- package/events/SystemSpaceUpdatedEvent.js +17 -0
- package/events/SystemSwitchUpdatedEvent.js +17 -0
- package/events/SystemThermostatUpdatedEvent.js +17 -0
- package/events/SystemUserUpdatedEvent.js +17 -0
- package/events/SystemWindowCoveringUpdatedEvent.js +17 -0
- package/events/index.js +28 -0
- package/http/handleResponseError.js +53 -0
- package/http/handleResponseSuccess.js +15 -0
- package/http/index.js +159 -0
- package/index.js +21 -71
- package/models/acl.js +29 -0
- package/models/admin/customer.js +28 -0
- package/models/admin/property.js +28 -0
- package/models/alarm.js +29 -0
- package/models/application.js +28 -0
- package/models/camera.js +29 -0
- package/models/courtesy.js +33 -0
- package/models/dimmer.js +49 -0
- package/models/discoveredDevice.js +30 -0
- package/models/gateway.js +37 -0
- package/models/index.js +56 -0
- package/models/integration.js +76 -0
- package/models/iotGateway.js +29 -0
- package/models/kohost.js +95 -0
- package/models/lock.js +33 -0
- package/models/mediaSource.js +29 -0
- package/models/motionSensor.js +29 -0
- package/models/reservation.js +36 -0
- package/models/room.js +185 -0
- package/models/scene.js +28 -0
- package/models/sceneController.js +29 -0
- package/models/space.js +99 -0
- package/models/switch.js +33 -0
- package/models/thermostat.js +80 -0
- package/models/ticket.js +91 -0
- package/models/user.js +58 -0
- package/models/windowCovering.js +49 -0
- package/package.json +27 -5
- package/prepare.js +4 -0
- package/schemas/acl.json +111 -0
- package/schemas/admin/customer.json +32 -0
- package/schemas/admin/property.json +54 -0
- package/schemas/alarm.json +5 -5
- package/schemas/application.json +24 -0
- package/schemas/camera.json +41 -0
- package/schemas/courtesy.json +5 -6
- package/schemas/definitions/common.json +21 -0
- package/schemas/{device.json → definitions/device.json} +22 -4
- package/schemas/dimmer.json +8 -5
- package/schemas/discoveredDevice.json +43 -0
- package/schemas/gateway.json +45 -13
- package/schemas/identification.json +35 -0
- package/schemas/integration.json +94 -0
- package/schemas/iotGateway.json +29 -0
- package/schemas/lock.json +8 -5
- package/schemas/mediaSource.json +151 -0
- package/schemas/motionSensor.json +26 -0
- package/schemas/payment.json +38 -0
- package/schemas/reservation.json +66 -0
- package/schemas/room.json +138 -0
- package/schemas/scene.json +118 -0
- package/schemas/sceneController.json +18 -6
- package/schemas/space.json +111 -0
- package/schemas/switch.json +8 -5
- package/schemas/thermostat.json +19 -10
- package/schemas/ticket.json +82 -0
- package/schemas/user.json +124 -0
- package/schemas/windowCovering.json +8 -5
- package/tests/unit/models/space.test.js +31 -0
- package/tests/unit/models/thermostat.test.js +146 -0
- package/useCases/http.json +902 -0
- package/utils/getDeviceTypes.js +7 -0
- package/utils/getFormalDeviceType.js +5 -0
- package/utils/schema.js +28 -0
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/draft-07/schema",
|
|
3
|
+
"$id": "https://api.kohost.app/schemas/v3/application.json",
|
|
4
|
+
"title": "Application",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"required": ["id", "active", "name", "publicKey", "hashedPrivateKey"],
|
|
7
|
+
"properties": {
|
|
8
|
+
"id": {
|
|
9
|
+
"$ref": "https://api.kohost.app/schemas/v3/definitions/common.json#/definitions/id"
|
|
10
|
+
},
|
|
11
|
+
"active": {
|
|
12
|
+
"type": "boolean"
|
|
13
|
+
},
|
|
14
|
+
"name": {
|
|
15
|
+
"type": "string"
|
|
16
|
+
},
|
|
17
|
+
"publicKey": {
|
|
18
|
+
"type": "string"
|
|
19
|
+
},
|
|
20
|
+
"hashedPrivateKey": {
|
|
21
|
+
"type": "string"
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/draft-07/schema",
|
|
3
|
+
"$id": "https://api.kohost.app/schemas/v3/camera.json",
|
|
4
|
+
"title": "Camera",
|
|
5
|
+
"description": "Any smart camera",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"properties": {
|
|
8
|
+
"id": {
|
|
9
|
+
"$ref": "https://api.kohost.app/schemas/v3/definitions/device.json#/definitions/id"
|
|
10
|
+
},
|
|
11
|
+
"type": {
|
|
12
|
+
"$ref": "https://api.kohost.app/schemas/v3/definitions/device.json#/definitions/type"
|
|
13
|
+
},
|
|
14
|
+
"systemData": {
|
|
15
|
+
"$ref": "https://api.kohost.app/schemas/v3/definitions/device.json#/definitions/systemData"
|
|
16
|
+
},
|
|
17
|
+
"supportedNotifications": {
|
|
18
|
+
"$ref": "https://api.kohost.app/schemas/v3/definitions/device.json#/definitions/supportedNotifications"
|
|
19
|
+
},
|
|
20
|
+
"notification": {
|
|
21
|
+
"$ref": "https://api.kohost.app/schemas/v3/definitions/device.json#/definitions/notification"
|
|
22
|
+
},
|
|
23
|
+
"streams": {
|
|
24
|
+
"type": "object",
|
|
25
|
+
"additionalProperties": false,
|
|
26
|
+
"properties": {
|
|
27
|
+
"origin": {
|
|
28
|
+
"type": ["string", "null"]
|
|
29
|
+
},
|
|
30
|
+
"local": {
|
|
31
|
+
"type": ["string", "null"]
|
|
32
|
+
},
|
|
33
|
+
"remote": {
|
|
34
|
+
"type": ["string", "null"]
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
},
|
|
39
|
+
"additionalProperties": false,
|
|
40
|
+
"required": ["id", "type", "systemData", "streams"]
|
|
41
|
+
}
|
package/schemas/courtesy.json
CHANGED
|
@@ -4,22 +4,21 @@
|
|
|
4
4
|
"title": "Courtesy",
|
|
5
5
|
"description": "Any smart courtesy system",
|
|
6
6
|
"type": "object",
|
|
7
|
-
"allOf": [{ "$ref": "https://api.kohost.app/schemas/v3/device.json" }],
|
|
8
7
|
"properties": {
|
|
9
8
|
"id": {
|
|
10
|
-
"$ref": "https://api.kohost.app/schemas/v3/device.json#/definitions/id"
|
|
9
|
+
"$ref": "https://api.kohost.app/schemas/v3/definitions/device.json#/definitions/id"
|
|
11
10
|
},
|
|
12
11
|
"type": {
|
|
13
|
-
"$ref": "https://api.kohost.app/schemas/v3/device.json#/definitions/type"
|
|
12
|
+
"$ref": "https://api.kohost.app/schemas/v3/definitions/device.json#/definitions/type"
|
|
14
13
|
},
|
|
15
14
|
"systemData": {
|
|
16
|
-
"$ref": "https://api.kohost.app/schemas/v3/device.json#/definitions/systemData"
|
|
15
|
+
"$ref": "https://api.kohost.app/schemas/v3/definitions/device.json#/definitions/systemData"
|
|
17
16
|
},
|
|
18
17
|
"supportedNotifications": {
|
|
19
|
-
"$ref": "https://api.kohost.app/schemas/v3/device.json#/definitions/supportedNotifications"
|
|
18
|
+
"$ref": "https://api.kohost.app/schemas/v3/definitions/device.json#/definitions/supportedNotifications"
|
|
20
19
|
},
|
|
21
20
|
"notification": {
|
|
22
|
-
"$ref": "https://api.kohost.app/schemas/v3/device.json#/definitions/notification"
|
|
21
|
+
"$ref": "https://api.kohost.app/schemas/v3/definitions/device.json#/definitions/notification"
|
|
23
22
|
},
|
|
24
23
|
"supportedStates": {
|
|
25
24
|
"type": "array",
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/draft-07/schema",
|
|
3
|
+
"$id": "https://api.kohost.app/schemas/v3/definitions/common.json",
|
|
4
|
+
"definitions": {
|
|
5
|
+
"id": {
|
|
6
|
+
"type": "string"
|
|
7
|
+
},
|
|
8
|
+
"systemData": {
|
|
9
|
+
"type": "object",
|
|
10
|
+
"default": {}
|
|
11
|
+
},
|
|
12
|
+
"createdAt": {
|
|
13
|
+
"type": ["string", "object"],
|
|
14
|
+
"format": "date-time"
|
|
15
|
+
},
|
|
16
|
+
"updatedAt": {
|
|
17
|
+
"type": ["string", "object"],
|
|
18
|
+
"format": "date-time"
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
}
|
|
@@ -1,16 +1,34 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "http://json-schema.org/draft-07/schema",
|
|
3
|
-
"$id": "https://api.kohost.app/schemas/v3/device.json",
|
|
3
|
+
"$id": "https://api.kohost.app/schemas/v3/definitions/device.json",
|
|
4
4
|
"definitions": {
|
|
5
5
|
"id": {
|
|
6
|
-
"
|
|
6
|
+
"$ref": "https://api.kohost.app/schemas/v3/definitions/common.json#/definitions/id"
|
|
7
7
|
},
|
|
8
8
|
"systemData": {
|
|
9
|
-
"
|
|
9
|
+
"$ref": "https://api.kohost.app/schemas/v3/definitions/common.json#/definitions/systemData"
|
|
10
10
|
},
|
|
11
11
|
"type": {
|
|
12
|
+
"type": "string",
|
|
13
|
+
"enum": [
|
|
14
|
+
"dimmer",
|
|
15
|
+
"switch",
|
|
16
|
+
"motionSensor",
|
|
17
|
+
"windowCovering",
|
|
18
|
+
"camera",
|
|
19
|
+
"mediaSource",
|
|
20
|
+
"thermostat",
|
|
21
|
+
"lock",
|
|
22
|
+
"courtesy",
|
|
23
|
+
"sceneController"
|
|
24
|
+
]
|
|
25
|
+
},
|
|
26
|
+
"name": {
|
|
12
27
|
"type": "string"
|
|
13
28
|
},
|
|
29
|
+
"subType": {
|
|
30
|
+
"type": ["string", "null"]
|
|
31
|
+
},
|
|
14
32
|
"supportedNotifications": {
|
|
15
33
|
"type": "array",
|
|
16
34
|
"uniqueItems": true,
|
|
@@ -31,7 +49,7 @@
|
|
|
31
49
|
}
|
|
32
50
|
},
|
|
33
51
|
"notification": {
|
|
34
|
-
"type": "object",
|
|
52
|
+
"type": ["object", "null"],
|
|
35
53
|
"properties": {
|
|
36
54
|
"name": {
|
|
37
55
|
"type": "string",
|
package/schemas/dimmer.json
CHANGED
|
@@ -6,19 +6,22 @@
|
|
|
6
6
|
"type": "object",
|
|
7
7
|
"properties": {
|
|
8
8
|
"id": {
|
|
9
|
-
"$ref": "https://api.kohost.app/schemas/v3/device.json#/definitions/id"
|
|
9
|
+
"$ref": "https://api.kohost.app/schemas/v3/definitions/device.json#/definitions/id"
|
|
10
10
|
},
|
|
11
11
|
"type": {
|
|
12
|
-
"$ref": "https://api.kohost.app/schemas/v3/device.json#/definitions/type"
|
|
12
|
+
"$ref": "https://api.kohost.app/schemas/v3/definitions/device.json#/definitions/type"
|
|
13
|
+
},
|
|
14
|
+
"subType": {
|
|
15
|
+
"$ref": "https://api.kohost.app/schemas/v3/definitions/device.json#/definitions/subType"
|
|
13
16
|
},
|
|
14
17
|
"systemData": {
|
|
15
|
-
"$ref": "https://api.kohost.app/schemas/v3/device.json#/definitions/systemData"
|
|
18
|
+
"$ref": "https://api.kohost.app/schemas/v3/definitions/device.json#/definitions/systemData"
|
|
16
19
|
},
|
|
17
20
|
"supportedNotifications": {
|
|
18
|
-
"$ref": "https://api.kohost.app/schemas/v3/device.json#/definitions/supportedNotifications"
|
|
21
|
+
"$ref": "https://api.kohost.app/schemas/v3/definitions/device.json#/definitions/supportedNotifications"
|
|
19
22
|
},
|
|
20
23
|
"notification": {
|
|
21
|
-
"$ref": "https://api.kohost.app/schemas/v3/device.json#/definitions/notification"
|
|
24
|
+
"$ref": "https://api.kohost.app/schemas/v3/definitions/device.json#/definitions/notification"
|
|
22
25
|
},
|
|
23
26
|
"level": {
|
|
24
27
|
"type": "number",
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/draft-07/schema",
|
|
3
|
+
"$id": "https://api.kohost.app/schemas/v3/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", "driver", "deviceData"],
|
|
8
|
+
"properties": {
|
|
9
|
+
"id": {
|
|
10
|
+
"$ref": "https://api.kohost.app/schemas/v3/definitions/common.json#/definitions/id"
|
|
11
|
+
},
|
|
12
|
+
"name": {
|
|
13
|
+
"type": "string"
|
|
14
|
+
},
|
|
15
|
+
"deviceId": {
|
|
16
|
+
"type": "string"
|
|
17
|
+
},
|
|
18
|
+
"type": {
|
|
19
|
+
"type": "string",
|
|
20
|
+
"enum": [
|
|
21
|
+
"dimmer",
|
|
22
|
+
"switch",
|
|
23
|
+
"motionSensor",
|
|
24
|
+
"thermostat",
|
|
25
|
+
"lock",
|
|
26
|
+
"camera",
|
|
27
|
+
"courtesy",
|
|
28
|
+
"source",
|
|
29
|
+
"alarm",
|
|
30
|
+
"windowCovering"
|
|
31
|
+
]
|
|
32
|
+
},
|
|
33
|
+
"driver": {
|
|
34
|
+
"type": "string"
|
|
35
|
+
},
|
|
36
|
+
"integrationId": {
|
|
37
|
+
"type": "string"
|
|
38
|
+
},
|
|
39
|
+
"deviceData": {
|
|
40
|
+
"type": "object"
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
}
|
package/schemas/gateway.json
CHANGED
|
@@ -2,28 +2,60 @@
|
|
|
2
2
|
"$schema": "http://json-schema.org/draft-07/schema",
|
|
3
3
|
"$id": "https://api.kohost.app/schemas/v3/gateway.json",
|
|
4
4
|
"title": "Gateway",
|
|
5
|
-
"description": "Any
|
|
5
|
+
"description": "Any Kohost gateway",
|
|
6
6
|
"type": "object",
|
|
7
7
|
"properties": {
|
|
8
8
|
"id": {
|
|
9
|
-
"$ref": "https://api.kohost.app/schemas/v3/
|
|
9
|
+
"$ref": "https://api.kohost.app/schemas/v3/definitions/common.json#/definitions/id"
|
|
10
10
|
},
|
|
11
|
-
"
|
|
12
|
-
"
|
|
11
|
+
"name": {
|
|
12
|
+
"type": "string"
|
|
13
13
|
},
|
|
14
|
-
"
|
|
15
|
-
"
|
|
14
|
+
"hashedAuthKey": {
|
|
15
|
+
"type": "string"
|
|
16
16
|
},
|
|
17
|
-
"
|
|
18
|
-
"
|
|
17
|
+
"integrations": {
|
|
18
|
+
"type": "array",
|
|
19
|
+
"items": {
|
|
20
|
+
"oneOf": [
|
|
21
|
+
{
|
|
22
|
+
"$ref": "https://api.kohost.app/schemas/v3/integration.json"
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
"$ref": "https://api.kohost.app/schemas/v3/definitions/common.json#/definitions/id"
|
|
26
|
+
}
|
|
27
|
+
]
|
|
28
|
+
},
|
|
29
|
+
"default": []
|
|
19
30
|
},
|
|
20
|
-
"
|
|
21
|
-
"
|
|
31
|
+
"health": {
|
|
32
|
+
"type": "object",
|
|
33
|
+
"properties": {
|
|
34
|
+
"upSince": {
|
|
35
|
+
"type": "string",
|
|
36
|
+
"format": "date-time"
|
|
37
|
+
},
|
|
38
|
+
"lastSeen": {
|
|
39
|
+
"type": "string",
|
|
40
|
+
"format": "date-time"
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
"additionalProperties": false
|
|
22
44
|
},
|
|
23
|
-
"
|
|
24
|
-
"type": "
|
|
45
|
+
"roles": {
|
|
46
|
+
"type": "array",
|
|
47
|
+
"items": {
|
|
48
|
+
"type": "string"
|
|
49
|
+
},
|
|
50
|
+
"default": ["Gateway"]
|
|
51
|
+
},
|
|
52
|
+
"createdAt": {
|
|
53
|
+
"$ref": "https://api.kohost.app/schemas/v3/definitions/common.json#/definitions/createdAt"
|
|
54
|
+
},
|
|
55
|
+
"updatedAt": {
|
|
56
|
+
"$ref": "https://api.kohost.app/schemas/v3/definitions/common.json#/definitions/updatedAt"
|
|
25
57
|
}
|
|
26
58
|
},
|
|
27
59
|
"additionalProperties": false,
|
|
28
|
-
"required": ["id", "
|
|
60
|
+
"required": ["id", "name", "hashedAuthKey", "integrations", "health"]
|
|
29
61
|
}
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/draft-07/schema",
|
|
3
|
+
"$id": "https://api.kohost.app/schemas/v3/identification.json",
|
|
4
|
+
"title": "Identification",
|
|
5
|
+
"type": "object",
|
|
6
|
+
"required": ["type", "number", "expires", "issuingCountry"],
|
|
7
|
+
"properties": {
|
|
8
|
+
"id": {
|
|
9
|
+
"$ref": "https://api.kohost.app/schemas/v3/definitions/common.json#/definitions/id"
|
|
10
|
+
},
|
|
11
|
+
"type": {
|
|
12
|
+
"type": "string",
|
|
13
|
+
"enum": ["driversLicense", "passport", "identityCard"]
|
|
14
|
+
},
|
|
15
|
+
"number": {
|
|
16
|
+
"string": "string"
|
|
17
|
+
},
|
|
18
|
+
"issued": {
|
|
19
|
+
"string": "string",
|
|
20
|
+
"format": "date-time"
|
|
21
|
+
},
|
|
22
|
+
"expires": {
|
|
23
|
+
"string": "string",
|
|
24
|
+
"format": "date-time"
|
|
25
|
+
},
|
|
26
|
+
"issuingCountry": {
|
|
27
|
+
"string": "string",
|
|
28
|
+
"minLength": 2,
|
|
29
|
+
"maxLength": 2
|
|
30
|
+
},
|
|
31
|
+
"systemData": {
|
|
32
|
+
"$ref": "https://api.kohost.app/schemas/v3/definitions/common.json#/definitions/systemData"
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
}
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/draft-07/schema",
|
|
3
|
+
"$id": "https://api.kohost.app/schemas/v3/integration.json",
|
|
4
|
+
"title": "Integration",
|
|
5
|
+
"description": "Integration configuration",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"properties": {
|
|
8
|
+
"id": {
|
|
9
|
+
"$ref": "https://api.kohost.app/schemas/v3/definitions/common.json#/definitions/id"
|
|
10
|
+
},
|
|
11
|
+
"driver": {
|
|
12
|
+
"type": "string",
|
|
13
|
+
"description": "Driver to use for this integration",
|
|
14
|
+
"enum": [
|
|
15
|
+
"aws-kinesis",
|
|
16
|
+
"crestron",
|
|
17
|
+
"igor",
|
|
18
|
+
"lirc",
|
|
19
|
+
"pelican-wireless",
|
|
20
|
+
"salto",
|
|
21
|
+
"se",
|
|
22
|
+
"mews",
|
|
23
|
+
"operaCloud",
|
|
24
|
+
"stay-n-touch"
|
|
25
|
+
]
|
|
26
|
+
},
|
|
27
|
+
"driverVersion": {
|
|
28
|
+
"type": "string",
|
|
29
|
+
"description": "Version of the driver to use for this integration",
|
|
30
|
+
"default": "latest"
|
|
31
|
+
},
|
|
32
|
+
"config": {
|
|
33
|
+
"type": "object",
|
|
34
|
+
"default": {}
|
|
35
|
+
},
|
|
36
|
+
"data": {
|
|
37
|
+
"type": "object",
|
|
38
|
+
"default": {},
|
|
39
|
+
"description": "Data to be used by the driver",
|
|
40
|
+
"additionalProperties": true,
|
|
41
|
+
"properties": {
|
|
42
|
+
"deviceMap": {
|
|
43
|
+
"type": "object",
|
|
44
|
+
"description": "Map of kohost device IDs to device names",
|
|
45
|
+
"additionalProperties": false,
|
|
46
|
+
"patternProperties": {
|
|
47
|
+
"^[a-zA-Z0-9]{8}$": {
|
|
48
|
+
"type": "object",
|
|
49
|
+
"additionalProperties": false,
|
|
50
|
+
"required": ["id", "type", "roomId"],
|
|
51
|
+
"properties": {
|
|
52
|
+
"id": {
|
|
53
|
+
"type": "string",
|
|
54
|
+
"description": "Driver device id"
|
|
55
|
+
},
|
|
56
|
+
"type": {
|
|
57
|
+
"type": "string",
|
|
58
|
+
"description": "Driver device type"
|
|
59
|
+
},
|
|
60
|
+
"roomId": {
|
|
61
|
+
"type": "string",
|
|
62
|
+
"description": "Kohost room id"
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
},
|
|
70
|
+
"health": {
|
|
71
|
+
"type": "object",
|
|
72
|
+
"properties": {
|
|
73
|
+
"upSince": {
|
|
74
|
+
"type": "string",
|
|
75
|
+
"format": "date-time"
|
|
76
|
+
},
|
|
77
|
+
"lastSeen": {
|
|
78
|
+
"type": "string",
|
|
79
|
+
"format": "date-time"
|
|
80
|
+
}
|
|
81
|
+
},
|
|
82
|
+
"default": {},
|
|
83
|
+
"additionalProperties": false
|
|
84
|
+
},
|
|
85
|
+
"createdAt": {
|
|
86
|
+
"$ref": "https://api.kohost.app/schemas/v3/definitions/common.json#/definitions/createdAt"
|
|
87
|
+
},
|
|
88
|
+
"updatedAt": {
|
|
89
|
+
"$ref": "https://api.kohost.app/schemas/v3/definitions/common.json#/definitions/updatedAt"
|
|
90
|
+
}
|
|
91
|
+
},
|
|
92
|
+
"additionalProperties": false,
|
|
93
|
+
"required": ["id", "driver", "driverVersion", "config", "health", "data"]
|
|
94
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/draft-07/schema",
|
|
3
|
+
"$id": "https://api.kohost.app/schemas/v3/iotGateway.json",
|
|
4
|
+
"title": "IoT Gateway",
|
|
5
|
+
"description": "Any smart gateway that is an entrypoint for controlling devices",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"properties": {
|
|
8
|
+
"id": {
|
|
9
|
+
"$ref": "https://api.kohost.app/schemas/v3/definitions/device.json#/definitions/id"
|
|
10
|
+
},
|
|
11
|
+
"type": {
|
|
12
|
+
"$ref": "https://api.kohost.app/schemas/v3/definitions/device.json#/definitions/type"
|
|
13
|
+
},
|
|
14
|
+
"systemData": {
|
|
15
|
+
"$ref": "https://api.kohost.app/schemas/v3/definitions/device.json#/definitions/systemData"
|
|
16
|
+
},
|
|
17
|
+
"supportedNotifications": {
|
|
18
|
+
"$ref": "https://api.kohost.app/schemas/v3/definitions/device.json#/definitions/supportedNotifications"
|
|
19
|
+
},
|
|
20
|
+
"notification": {
|
|
21
|
+
"$ref": "https://api.kohost.app/schemas/v3/definitions/device.json#/definitions/notification"
|
|
22
|
+
},
|
|
23
|
+
"status": {
|
|
24
|
+
"type": "string"
|
|
25
|
+
}
|
|
26
|
+
},
|
|
27
|
+
"additionalProperties": false,
|
|
28
|
+
"required": ["id", "type", "systemData", "status"]
|
|
29
|
+
}
|
package/schemas/lock.json
CHANGED
|
@@ -6,19 +6,22 @@
|
|
|
6
6
|
"type": "object",
|
|
7
7
|
"properties": {
|
|
8
8
|
"id": {
|
|
9
|
-
"$ref": "https://api.kohost.app/schemas/v3/device.json#/definitions/id"
|
|
9
|
+
"$ref": "https://api.kohost.app/schemas/v3/definitions/device.json#/definitions/id"
|
|
10
10
|
},
|
|
11
11
|
"type": {
|
|
12
|
-
"$ref": "https://api.kohost.app/schemas/v3/device.json#/definitions/type"
|
|
12
|
+
"$ref": "https://api.kohost.app/schemas/v3/definitions/device.json#/definitions/type"
|
|
13
|
+
},
|
|
14
|
+
"subType": {
|
|
15
|
+
"$ref": "https://api.kohost.app/schemas/v3/definitions/device.json#/definitions/subType"
|
|
13
16
|
},
|
|
14
17
|
"systemData": {
|
|
15
|
-
"$ref": "https://api.kohost.app/schemas/v3/device.json#/definitions/systemData"
|
|
18
|
+
"$ref": "https://api.kohost.app/schemas/v3/definitions/device.json#/definitions/systemData"
|
|
16
19
|
},
|
|
17
20
|
"supportedNotifications": {
|
|
18
|
-
"$ref": "https://api.kohost.app/schemas/v3/device.json#/definitions/supportedNotifications"
|
|
21
|
+
"$ref": "https://api.kohost.app/schemas/v3/definitions/device.json#/definitions/supportedNotifications"
|
|
19
22
|
},
|
|
20
23
|
"notification": {
|
|
21
|
-
"$ref": "https://api.kohost.app/schemas/v3/device.json#/definitions/notification"
|
|
24
|
+
"$ref": "https://api.kohost.app/schemas/v3/definitions/device.json#/definitions/notification"
|
|
22
25
|
},
|
|
23
26
|
"state": {
|
|
24
27
|
"type": "string",
|
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "http://json-schema.org/draft-07/schema",
|
|
3
|
+
"$id": "https://api.kohost.app/schemas/v3/mediaSource.json",
|
|
4
|
+
"title": "Media Source",
|
|
5
|
+
"description": "Any media source",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"properties": {
|
|
8
|
+
"id": {
|
|
9
|
+
"$ref": "https://api.kohost.app/schemas/v3/definitions/device.json#/definitions/id"
|
|
10
|
+
},
|
|
11
|
+
"type": {
|
|
12
|
+
"$ref": "https://api.kohost.app/schemas/v3/definitions/device.json#/definitions/type"
|
|
13
|
+
},
|
|
14
|
+
"subType": {
|
|
15
|
+
"type": "string",
|
|
16
|
+
"enum": [
|
|
17
|
+
"tv",
|
|
18
|
+
"dvr",
|
|
19
|
+
"appleTv",
|
|
20
|
+
"discPlayer",
|
|
21
|
+
"mediaPlayer",
|
|
22
|
+
"uncontrolledDevice"
|
|
23
|
+
]
|
|
24
|
+
},
|
|
25
|
+
"audio": {
|
|
26
|
+
"type": "boolean"
|
|
27
|
+
},
|
|
28
|
+
"video": {
|
|
29
|
+
"type": "boolean"
|
|
30
|
+
},
|
|
31
|
+
"powerFeedback": {
|
|
32
|
+
"type": "boolean"
|
|
33
|
+
},
|
|
34
|
+
"volumeFeedback": {
|
|
35
|
+
"type": "boolean"
|
|
36
|
+
},
|
|
37
|
+
"command": {
|
|
38
|
+
"type": ["string", "null"],
|
|
39
|
+
"enum": [
|
|
40
|
+
"mute",
|
|
41
|
+
"volumeUp",
|
|
42
|
+
"volumeDown",
|
|
43
|
+
"channelUp",
|
|
44
|
+
"channelDown",
|
|
45
|
+
"number0",
|
|
46
|
+
"number1",
|
|
47
|
+
"number2",
|
|
48
|
+
"number3",
|
|
49
|
+
"number4",
|
|
50
|
+
"number5",
|
|
51
|
+
"number6",
|
|
52
|
+
"number7",
|
|
53
|
+
"number8",
|
|
54
|
+
"number9",
|
|
55
|
+
"lastChannel",
|
|
56
|
+
"display",
|
|
57
|
+
"favoriteChannel",
|
|
58
|
+
"play",
|
|
59
|
+
"stop",
|
|
60
|
+
"pause",
|
|
61
|
+
"fastForward",
|
|
62
|
+
"rewind",
|
|
63
|
+
"instantReplay",
|
|
64
|
+
"record",
|
|
65
|
+
"ac3",
|
|
66
|
+
"pvrMenu",
|
|
67
|
+
"guide",
|
|
68
|
+
"menu",
|
|
69
|
+
"menuUp",
|
|
70
|
+
"menuDown",
|
|
71
|
+
"menuLeft",
|
|
72
|
+
"menuRight",
|
|
73
|
+
"pageUp",
|
|
74
|
+
"pageDown",
|
|
75
|
+
"select",
|
|
76
|
+
"exit",
|
|
77
|
+
"input",
|
|
78
|
+
"power",
|
|
79
|
+
"enterChannel",
|
|
80
|
+
"number10",
|
|
81
|
+
"number11",
|
|
82
|
+
"number12",
|
|
83
|
+
"number13",
|
|
84
|
+
"number14",
|
|
85
|
+
"number15",
|
|
86
|
+
"number16",
|
|
87
|
+
"number10Plus",
|
|
88
|
+
"number20Plus",
|
|
89
|
+
"number100",
|
|
90
|
+
"dash",
|
|
91
|
+
"threeChan",
|
|
92
|
+
"threeD",
|
|
93
|
+
"sixChan",
|
|
94
|
+
"a",
|
|
95
|
+
"add",
|
|
96
|
+
"alarm",
|
|
97
|
+
"am",
|
|
98
|
+
"analog",
|
|
99
|
+
"angle",
|
|
100
|
+
"antenna",
|
|
101
|
+
"antennaEast",
|
|
102
|
+
"antennaWest",
|
|
103
|
+
"aspect",
|
|
104
|
+
"audio1",
|
|
105
|
+
"audio2",
|
|
106
|
+
"audio3",
|
|
107
|
+
"audioDumming",
|
|
108
|
+
"audioLevelDown",
|
|
109
|
+
"audioLevelUp",
|
|
110
|
+
"b",
|
|
111
|
+
"back",
|
|
112
|
+
"c",
|
|
113
|
+
"component1",
|
|
114
|
+
"component2",
|
|
115
|
+
"component3",
|
|
116
|
+
"d",
|
|
117
|
+
"home",
|
|
118
|
+
"list",
|
|
119
|
+
"liveTv",
|
|
120
|
+
"discreteInputCable",
|
|
121
|
+
"powerOff",
|
|
122
|
+
"powerOn",
|
|
123
|
+
"setupMenu",
|
|
124
|
+
"skipForward",
|
|
125
|
+
"skipReverse",
|
|
126
|
+
"video1",
|
|
127
|
+
"video2",
|
|
128
|
+
"video3",
|
|
129
|
+
"video4",
|
|
130
|
+
"video5",
|
|
131
|
+
"details",
|
|
132
|
+
"hdmi1",
|
|
133
|
+
"hdmi2",
|
|
134
|
+
"hdmi3",
|
|
135
|
+
"cecDeviceList",
|
|
136
|
+
"mtsSap"
|
|
137
|
+
]
|
|
138
|
+
},
|
|
139
|
+
"systemData": {
|
|
140
|
+
"$ref": "https://api.kohost.app/schemas/v3/definitions/device.json#/definitions/systemData"
|
|
141
|
+
},
|
|
142
|
+
"supportedNotifications": {
|
|
143
|
+
"$ref": "https://api.kohost.app/schemas/v3/definitions/device.json#/definitions/supportedNotifications"
|
|
144
|
+
},
|
|
145
|
+
"notification": {
|
|
146
|
+
"$ref": "https://api.kohost.app/schemas/v3/definitions/device.json#/definitions/notification"
|
|
147
|
+
}
|
|
148
|
+
},
|
|
149
|
+
"additionalProperties": false,
|
|
150
|
+
"required": ["id", "type", "systemData", "audio", "video"]
|
|
151
|
+
}
|