@kohost/api-client 1.0.0-beta.3 → 1.0.0-beta.5
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/dist/cjs/Client.js +5089 -0
- package/dist/cjs/Commands.js +568 -0
- package/dist/cjs/Errors.js +174 -0
- package/dist/cjs/Events.js +375 -0
- package/dist/cjs/Models.js +3584 -0
- package/dist/cjs/defs.js +175 -0
- package/dist/cjs/index.cjs.js +17 -0
- package/dist/cjs/utils.js +246 -0
- package/dist/esm/Client.js +7428 -0
- package/dist/esm/Client.js.map +7 -0
- package/dist/esm/Commands.js +574 -0
- package/dist/esm/Commands.js.map +7 -0
- package/dist/esm/Errors.js +180 -0
- package/dist/esm/Errors.js.map +7 -0
- package/dist/esm/Events.js +381 -0
- package/dist/esm/Events.js.map +7 -0
- package/dist/esm/Models.js +13220 -0
- package/dist/esm/Models.js.map +7 -0
- package/dist/esm/defs.js +2514 -0
- package/dist/esm/defs.js.map +7 -0
- package/dist/esm/index.js +11 -0
- package/dist/esm/utils.js +7281 -0
- package/dist/esm/utils.js.map +7 -0
- package/dist/useCases/AddDefaultScenesToRooms.js +32 -0
- package/dist/useCases/AddScenesToRoom.js +32 -0
- package/dist/useCases/AdminCreateProperty.js +32 -0
- package/dist/useCases/AdminDescribeProperty.js +32 -0
- package/dist/useCases/AdminListCustomers.js +32 -0
- package/dist/useCases/AdminListProperties.js +32 -0
- package/dist/useCases/AdminUpdateProperty.js +32 -0
- package/dist/useCases/BatchNotifyPreArrival.js +32 -0
- package/dist/useCases/CheckInReservation.js +32 -0
- package/dist/useCases/CheckVerificationCode.js +32 -0
- package/dist/useCases/CreateAlarm.js +32 -0
- package/dist/useCases/CreateCamera.js +32 -0
- package/dist/useCases/CreateCourtesy.js +32 -0
- package/dist/useCases/CreateDefaultScenes.js +32 -0
- package/dist/useCases/CreateDimmer.js +32 -0
- package/dist/useCases/CreateDiscoveredDevice.js +32 -0
- package/dist/useCases/CreateDiscoveredDeviceAssociation.js +32 -0
- package/dist/useCases/CreateIntegration.js +32 -0
- package/dist/useCases/CreateIntegrationDeviceMapEntry.js +32 -0
- package/dist/useCases/CreateLock.js +32 -0
- package/dist/useCases/CreateReservation.js +32 -0
- package/dist/useCases/CreateRoom.js +32 -0
- package/dist/useCases/CreateRoomInSpace.js +32 -0
- package/dist/useCases/CreateSource.js +32 -0
- package/dist/useCases/CreateSpace.js +32 -0
- package/dist/useCases/CreateSwitch.js +32 -0
- package/dist/useCases/CreateThermostat.js +32 -0
- package/dist/useCases/CreateTicket.js +32 -0
- package/dist/useCases/CreateTicketMessage.js +32 -0
- package/dist/useCases/CreateUser.js +32 -0
- package/dist/useCases/CreateWindowCovering.js +32 -0
- package/dist/useCases/DeleteAlarm.js +32 -0
- package/dist/useCases/DeleteCamera.js +32 -0
- package/dist/useCases/DeleteCourtesy.js +32 -0
- package/dist/useCases/DeleteDimmer.js +32 -0
- package/dist/useCases/DeleteDiscoveredDevice.js +32 -0
- package/dist/useCases/DeleteIntegration.js +32 -0
- package/dist/useCases/DeleteLock.js +32 -0
- package/dist/useCases/DeleteReservation.js +32 -0
- package/dist/useCases/DeleteRoom.js +32 -0
- package/dist/useCases/DeleteSource.js +32 -0
- package/dist/useCases/DeleteSpace.js +32 -0
- package/dist/useCases/DeleteSwitch.js +32 -0
- package/dist/useCases/DeleteThermostat.js +32 -0
- package/dist/useCases/DeleteTicket.js +32 -0
- package/dist/useCases/DeleteUser.js +32 -0
- package/dist/useCases/DeleteWindowCovering.js +32 -0
- package/dist/useCases/DescribeAlarm.js +32 -0
- package/dist/useCases/DescribeCamera.js +32 -0
- package/dist/useCases/DescribeCourtesy.js +32 -0
- package/dist/useCases/DescribeDimmer.js +32 -0
- package/dist/useCases/DescribeDiscoveredDevice.js +32 -0
- package/dist/useCases/DescribeIntegration.js +32 -0
- package/dist/useCases/DescribeLock.js +32 -0
- package/dist/useCases/DescribeMyProperty.js +32 -0
- package/dist/useCases/DescribeReservation.js +32 -0
- package/dist/useCases/DescribeReservationCheckinStatus.js +32 -0
- package/dist/useCases/DescribeRoom.js +32 -0
- package/dist/useCases/DescribeSelf.js +32 -0
- package/dist/useCases/DescribeSource.js +32 -0
- package/dist/useCases/DescribeSpace.js +32 -0
- package/dist/useCases/DescribeSwitch.js +32 -0
- package/dist/useCases/DescribeThermostat.js +32 -0
- package/dist/useCases/DescribeTicket.js +32 -0
- package/dist/useCases/DescribeUser.js +32 -0
- package/dist/useCases/DescribeWindowCovering.js +32 -0
- package/dist/useCases/DiscoverReservations.js +32 -0
- package/dist/useCases/EmailUserAccountSetup.js +32 -0
- package/dist/useCases/ListAlarms.js +32 -0
- package/dist/useCases/ListCameras.js +32 -0
- package/dist/useCases/ListCourtesy.js +32 -0
- package/dist/useCases/ListDimmers.js +32 -0
- package/dist/useCases/ListDiscoveredDevices.js +32 -0
- package/dist/useCases/ListIntegrations.js +32 -0
- package/dist/useCases/ListLocks.js +32 -0
- package/dist/useCases/ListMyReservations.js +32 -0
- package/dist/useCases/ListMySpaces.js +32 -0
- package/dist/useCases/ListReservations.js +32 -0
- package/dist/useCases/ListRooms.js +32 -0
- package/dist/useCases/ListRoomsInSpace.js +32 -0
- package/dist/useCases/ListSources.js +32 -0
- package/dist/useCases/ListSpaces.js +32 -0
- package/dist/useCases/ListSwitches.js +32 -0
- package/dist/useCases/ListThermostats.js +32 -0
- package/dist/useCases/ListTickets.js +32 -0
- package/dist/useCases/ListUserReservations.js +32 -0
- package/dist/useCases/ListUsers.js +32 -0
- package/dist/useCases/ListWindowCoverings.js +32 -0
- package/dist/useCases/LoginGateway.js +32 -0
- package/dist/useCases/LoginUser.js +32 -0
- package/dist/useCases/MatchUserIdentification.js +32 -0
- package/dist/useCases/OCRDocument.js +32 -0
- package/dist/useCases/RefreshToken.js +32 -0
- package/dist/useCases/RequestLoginLink.js +32 -0
- package/dist/useCases/SendPreArrivalEmail.js +32 -0
- package/dist/useCases/SendPreArrivalSMS.js +32 -0
- package/dist/useCases/SendVerificationCode.js +32 -0
- package/dist/useCases/SetCamera.js +32 -0
- package/dist/useCases/SetCourtesy.js +32 -0
- package/dist/useCases/SetLock.js +32 -0
- package/dist/useCases/SetSource.js +32 -0
- package/dist/useCases/SetSwitch.js +32 -0
- package/dist/useCases/SetThermostat.js +32 -0
- package/dist/useCases/SetWindowCovering.js +32 -0
- package/dist/useCases/UpdateAlarm.js +32 -0
- package/dist/useCases/UpdateCamera.js +32 -0
- package/dist/useCases/UpdateCourtesy.js +32 -0
- package/dist/useCases/UpdateDimmer.js +32 -0
- package/dist/useCases/UpdateDiscoveredDevice.js +32 -0
- package/dist/useCases/UpdateIntegration.js +32 -0
- package/dist/useCases/UpdateLock.js +32 -0
- package/dist/useCases/UpdateMessageReadStatus.js +32 -0
- package/dist/useCases/UpdateReservation.js +32 -0
- package/dist/useCases/UpdateRoom.js +32 -0
- package/dist/useCases/UpdateSelf.js +32 -0
- package/dist/useCases/UpdateSource.js +32 -0
- package/dist/useCases/UpdateSpace.js +32 -0
- package/dist/useCases/UpdateSwitch.js +32 -0
- package/dist/useCases/UpdateThermostat.js +32 -0
- package/dist/useCases/UpdateTicket.js +32 -0
- package/dist/useCases/UpdateTicketStatus.js +32 -0
- package/dist/useCases/UpdateUser.js +32 -0
- package/dist/useCases/UpdateWindowCovering.js +32 -0
- package/dist/useCases/UpsertDiscoveredDevice.js +32 -0
- package/package.json +26 -7
- package/.eslintrc.js +0 -10
- package/bitbucket-pipelines.yml +0 -71
- package/commands/CheckInReservationCommand.js +0 -23
- package/commands/Command.js +0 -38
- package/commands/DiscoverReservationsCommand.js +0 -24
- package/commands/DiscoverRoomsCommand.js +0 -21
- package/commands/DiscoverUsersCommand.js +0 -21
- package/commands/OCRDocumentCommand.js +0 -20
- package/commands/SendEmailCommand.js +0 -24
- package/commands/SendSMSCommand.js +0 -21
- package/commands/SetAlarmCommand.js +0 -21
- package/commands/SetCourtesyCommand.js +0 -21
- package/commands/SetDimmerCommand.js +0 -21
- package/commands/SetLockCommand.js +0 -21
- package/commands/SetSceneControllerCommand.js +0 -21
- package/commands/SetSwitchCommand.js +0 -21
- package/commands/SetThermostatCommand.js +0 -21
- package/commands/SetWindowCoveringCommand.js +0 -21
- package/commands/index.js +0 -31
- package/defs/deviceTypes.js +0 -15
- package/defs/formalDeviceTypes.js +0 -6
- package/defs/http.js +0 -7
- package/defs/index.js +0 -11
- package/errors/AppError.js +0 -8
- package/errors/AuthenticationError.js +0 -9
- package/errors/AuthorizationError.js +0 -9
- package/errors/DeviceCommError.js +0 -9
- package/errors/LoginError.js +0 -9
- package/errors/NotFoundError.js +0 -9
- package/errors/RequestError.js +0 -9
- package/errors/SystemCommError.js +0 -9
- package/errors/TokenExpiredError.js +0 -9
- package/errors/UnprocessableRequestError.js +0 -9
- package/errors/ValidationError.js +0 -9
- package/errors/index.js +0 -15
- package/events/EmailSentEvent.js +0 -17
- package/events/Event.js +0 -52
- package/events/SMSSentEvent.js +0 -17
- package/events/ShortLinkCreatedEvent.js +0 -17
- package/events/SystemCameraUpdatedEvent.js +0 -17
- package/events/SystemCourtesyUpdatedEvent.js +0 -17
- package/events/SystemDimmerUpdatedEvent.js +0 -17
- package/events/SystemLockUpdatedEvent.js +0 -17
- package/events/SystemReservationUpdatedEvent.js +0 -17
- package/events/SystemSceneControllerUpdatedEvent.js +0 -17
- package/events/SystemSourceUpdatedEvent.js +0 -17
- package/events/SystemSpaceUpdatedEvent.js +0 -17
- package/events/SystemSwitchUpdatedEvent.js +0 -17
- package/events/SystemThermostatUpdatedEvent.js +0 -17
- package/events/SystemUserUpdatedEvent.js +0 -17
- package/events/SystemWindowCoveringUpdatedEvent.js +0 -17
- package/events/index.js +0 -35
- package/http/handleResponseError.js +0 -33
- package/http/handleResponseSuccess.js +0 -15
- package/http/index.js +0 -169
- package/index.js +0 -23
- package/models/acl.js +0 -29
- package/models/admin/customer.js +0 -28
- package/models/admin/property.js +0 -28
- package/models/alarm.js +0 -29
- package/models/application.js +0 -28
- package/models/camera.js +0 -29
- package/models/courtesy.js +0 -33
- package/models/credential.js +0 -29
- package/models/dimmer.js +0 -49
- package/models/discoveredDevice.js +0 -30
- package/models/gateway.js +0 -29
- package/models/identification.js +0 -32
- package/models/index.js +0 -56
- package/models/integration.js +0 -76
- package/models/kohost.js +0 -96
- package/models/lock.js +0 -33
- package/models/mediaSource.js +0 -29
- package/models/motionSensor.js +0 -29
- package/models/product.js +0 -30
- package/models/reservation.js +0 -83
- package/models/room.js +0 -174
- package/models/scene.js +0 -28
- package/models/shortLink.js +0 -29
- package/models/space.js +0 -99
- package/models/switch.js +0 -33
- package/models/thermostat.js +0 -80
- package/models/ticket.js +0 -91
- package/models/user.js +0 -56
- package/models/windowCovering.js +0 -49
- package/prepare.js +0 -4
- package/schemas/acl.json +0 -111
- package/schemas/admin/customer.json +0 -32
- package/schemas/admin/property.json +0 -180
- package/schemas/alarm.json +0 -93
- package/schemas/application.json +0 -24
- package/schemas/camera.json +0 -41
- package/schemas/courtesy.json +0 -37
- package/schemas/credential.json +0 -28
- package/schemas/definitions/common.json +0 -74
- package/schemas/definitions/device.json +0 -76
- package/schemas/dimmer.json +0 -34
- package/schemas/discoveredDevice.json +0 -43
- package/schemas/gateway.json +0 -30
- package/schemas/identification.json +0 -49
- package/schemas/integration.json +0 -94
- package/schemas/lock.json +0 -36
- package/schemas/mediaSource.json +0 -151
- package/schemas/motionSensor.json +0 -26
- package/schemas/payment.json +0 -40
- package/schemas/product.json +0 -36
- package/schemas/reservation.json +0 -71
- package/schemas/room.json +0 -131
- package/schemas/scene.json +0 -118
- package/schemas/shortLink.json +0 -30
- package/schemas/space.json +0 -111
- package/schemas/switch.json +0 -33
- package/schemas/thermostat.json +0 -139
- package/schemas/ticket.json +0 -82
- package/schemas/user.json +0 -176
- package/schemas/windowCovering.json +0 -34
- package/tests/unit/models/space.test.js +0 -31
- package/tests/unit/models/thermostat.test.js +0 -146
- package/tests/unit/models/user.test.js +0 -28
- package/useCases/http.json +0 -1161
- package/utils/getDeviceTypes.js +0 -7
- package/utils/getFormalDeviceType.js +0 -5
- package/utils/schema.js +0 -28
package/schemas/space.json
DELETED
|
@@ -1,111 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "http://json-schema.org/draft-07/schema",
|
|
3
|
-
"$id": "https://api.kohost.app/schemas/v3/space.json",
|
|
4
|
-
"title": "Space",
|
|
5
|
-
"type": "object",
|
|
6
|
-
"properties": {
|
|
7
|
-
"id": {
|
|
8
|
-
"$ref": "https://api.kohost.app/schemas/v3/definitions/common.json#/definitions/id"
|
|
9
|
-
},
|
|
10
|
-
"name": {
|
|
11
|
-
"type": "string",
|
|
12
|
-
"minLength": 1
|
|
13
|
-
},
|
|
14
|
-
"type": {
|
|
15
|
-
"type": ["string"],
|
|
16
|
-
"enum": [
|
|
17
|
-
"classRoom",
|
|
18
|
-
"hotelRoom",
|
|
19
|
-
"office",
|
|
20
|
-
"building",
|
|
21
|
-
"commonArea",
|
|
22
|
-
"other"
|
|
23
|
-
]
|
|
24
|
-
},
|
|
25
|
-
"rooms": {
|
|
26
|
-
"type": "array",
|
|
27
|
-
"items": {
|
|
28
|
-
"type": "string"
|
|
29
|
-
}
|
|
30
|
-
},
|
|
31
|
-
"subGroups": {
|
|
32
|
-
"type": "array",
|
|
33
|
-
"items": {
|
|
34
|
-
"type": "string"
|
|
35
|
-
}
|
|
36
|
-
},
|
|
37
|
-
"eco": {
|
|
38
|
-
"type": "object",
|
|
39
|
-
"additionalProperties": false,
|
|
40
|
-
"default": {
|
|
41
|
-
"active": false,
|
|
42
|
-
"allowed": false
|
|
43
|
-
},
|
|
44
|
-
"properties": {
|
|
45
|
-
"active": {
|
|
46
|
-
"type": "boolean",
|
|
47
|
-
"default": false
|
|
48
|
-
},
|
|
49
|
-
"activatedAt": {
|
|
50
|
-
"type": "string",
|
|
51
|
-
"format": "date-time"
|
|
52
|
-
},
|
|
53
|
-
"allowed": {
|
|
54
|
-
"type": "boolean",
|
|
55
|
-
"default": false
|
|
56
|
-
}
|
|
57
|
-
}
|
|
58
|
-
},
|
|
59
|
-
"features": {
|
|
60
|
-
"type": "array",
|
|
61
|
-
"items": {
|
|
62
|
-
"type": "string"
|
|
63
|
-
}
|
|
64
|
-
},
|
|
65
|
-
"maximumOccupancy": {
|
|
66
|
-
"type": "number",
|
|
67
|
-
"minimum": 1
|
|
68
|
-
},
|
|
69
|
-
"housekeepingStatus": {
|
|
70
|
-
"type": "string",
|
|
71
|
-
"enum": ["clean", "dirty", "inspected", "pickup"]
|
|
72
|
-
},
|
|
73
|
-
"serviceStatus": {
|
|
74
|
-
"type": "string",
|
|
75
|
-
"enum": ["inService", "outOfOrder", "outOfService"]
|
|
76
|
-
},
|
|
77
|
-
"systemData": {
|
|
78
|
-
"$ref": "https://api.kohost.app/schemas/v3/definitions/common.json#/definitions/systemData"
|
|
79
|
-
}
|
|
80
|
-
},
|
|
81
|
-
"if": {
|
|
82
|
-
"properties": { "type": { "const": "hotelRoom" } }
|
|
83
|
-
},
|
|
84
|
-
"then": {
|
|
85
|
-
"required": [
|
|
86
|
-
"name",
|
|
87
|
-
"type",
|
|
88
|
-
"features",
|
|
89
|
-
"maximumOccupancy",
|
|
90
|
-
"housekeepingStatus",
|
|
91
|
-
"serviceStatus"
|
|
92
|
-
],
|
|
93
|
-
"properties": {
|
|
94
|
-
"features": {
|
|
95
|
-
"default": []
|
|
96
|
-
},
|
|
97
|
-
"maximumOccupancy": {
|
|
98
|
-
"default": 2
|
|
99
|
-
},
|
|
100
|
-
"housekeepingStatus": {
|
|
101
|
-
"default": "dirty"
|
|
102
|
-
},
|
|
103
|
-
"serviceStatus": {
|
|
104
|
-
"default": "inService"
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
},
|
|
108
|
-
"else": {
|
|
109
|
-
"required": ["name", "type"]
|
|
110
|
-
}
|
|
111
|
-
}
|
package/schemas/switch.json
DELETED
|
@@ -1,33 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "http://json-schema.org/draft-07/schema",
|
|
3
|
-
"$id": "https://api.kohost.app/schemas/v3/switch.json",
|
|
4
|
-
"title": "Switch",
|
|
5
|
-
"description": "Any smart switch",
|
|
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
|
-
"$ref": "https://api.kohost.app/schemas/v3/definitions/device.json#/definitions/subType"
|
|
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
|
-
"state": {
|
|
24
|
-
"type": "string",
|
|
25
|
-
"enum": ["on", "off"]
|
|
26
|
-
},
|
|
27
|
-
"systemData": {
|
|
28
|
-
"$ref": "https://api.kohost.app/schemas/v3/definitions/device.json#/definitions/systemData"
|
|
29
|
-
}
|
|
30
|
-
},
|
|
31
|
-
"additionalProperties": false,
|
|
32
|
-
"required": ["id", "type", "systemData", "state"]
|
|
33
|
-
}
|
package/schemas/thermostat.json
DELETED
|
@@ -1,139 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "http://json-schema.org/draft-07/schema",
|
|
3
|
-
"$id": "https://api.kohost.app/schemas/v3/thermostat.json",
|
|
4
|
-
"title": "Thermostat",
|
|
5
|
-
"description": "Any smart thermostat",
|
|
6
|
-
"type": "object",
|
|
7
|
-
"properties": {
|
|
8
|
-
"id": {
|
|
9
|
-
"$ref": "https://api.kohost.app/schemas/v3/definitions/device.json#/definitions/id"
|
|
10
|
-
},
|
|
11
|
-
"name": {
|
|
12
|
-
"$ref": "https://api.kohost.app/schemas/v3/definitions/device.json#/definitions/name"
|
|
13
|
-
},
|
|
14
|
-
"type": {
|
|
15
|
-
"$ref": "https://api.kohost.app/schemas/v3/definitions/device.json#/definitions/type",
|
|
16
|
-
"default": "thermostat"
|
|
17
|
-
},
|
|
18
|
-
"subType": {
|
|
19
|
-
"$ref": "https://api.kohost.app/schemas/v3/definitions/device.json#/definitions/subType"
|
|
20
|
-
},
|
|
21
|
-
"supportedNotifications": {
|
|
22
|
-
"$ref": "https://api.kohost.app/schemas/v3/definitions/device.json#/definitions/supportedNotifications"
|
|
23
|
-
},
|
|
24
|
-
"notification": {
|
|
25
|
-
"$ref": "https://api.kohost.app/schemas/v3/definitions/device.json#/definitions/notification"
|
|
26
|
-
},
|
|
27
|
-
"currentTemperature": {
|
|
28
|
-
"type": "number"
|
|
29
|
-
},
|
|
30
|
-
"currentHumidity": {
|
|
31
|
-
"type": "number",
|
|
32
|
-
"minimum": 0,
|
|
33
|
-
"maximum": 99
|
|
34
|
-
},
|
|
35
|
-
"hvacMode": {
|
|
36
|
-
"type": "string",
|
|
37
|
-
"$ref": "#/properties/supportedHvacModes/items"
|
|
38
|
-
},
|
|
39
|
-
"hvacState": {
|
|
40
|
-
"type": "string",
|
|
41
|
-
"enum": ["cooling", "heating", "off"]
|
|
42
|
-
},
|
|
43
|
-
"fanMode": {
|
|
44
|
-
"type": "string",
|
|
45
|
-
"$ref": "#/properties/supportedFanModes/items"
|
|
46
|
-
},
|
|
47
|
-
"fanState": {
|
|
48
|
-
"type": "string",
|
|
49
|
-
"enum": ["off", "low", "medium", "high"]
|
|
50
|
-
},
|
|
51
|
-
"temperatureScale": {
|
|
52
|
-
"type": "string",
|
|
53
|
-
"enum": ["celsius", "fahrenheit"],
|
|
54
|
-
"default": "fahrenheit"
|
|
55
|
-
},
|
|
56
|
-
"humidityScale": {
|
|
57
|
-
"type": ["string", "null"],
|
|
58
|
-
"enum": ["absolute", "relative", null]
|
|
59
|
-
},
|
|
60
|
-
"supportedHvacModes": {
|
|
61
|
-
"type": "array",
|
|
62
|
-
"uniqueItems": true,
|
|
63
|
-
"minItems": 2,
|
|
64
|
-
"items": {
|
|
65
|
-
"enum": ["cool", "heat", "auto", "off"]
|
|
66
|
-
}
|
|
67
|
-
},
|
|
68
|
-
"supportedFanModes": {
|
|
69
|
-
"type": "array",
|
|
70
|
-
"uniqueItems": true,
|
|
71
|
-
"items": {
|
|
72
|
-
"enum": ["auto", "low", "medium", "high", "off"]
|
|
73
|
-
}
|
|
74
|
-
},
|
|
75
|
-
"setpoints": {
|
|
76
|
-
"type": "object",
|
|
77
|
-
"additionalProperties": false,
|
|
78
|
-
"properties": {
|
|
79
|
-
"cool": {
|
|
80
|
-
"$ref": "#/$defs/setpoint"
|
|
81
|
-
},
|
|
82
|
-
"heat": {
|
|
83
|
-
"$ref": "#/$defs/setpoint"
|
|
84
|
-
},
|
|
85
|
-
"auto": {
|
|
86
|
-
"$ref": "#/$defs/setpoint"
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
},
|
|
90
|
-
"batteryLevel": {
|
|
91
|
-
"$ref": "https://api.kohost.app/schemas/v3/definitions/device.json#/definitions/batteryLevel"
|
|
92
|
-
},
|
|
93
|
-
"systemData": {
|
|
94
|
-
"$ref": "https://api.kohost.app/schemas/v3/definitions/device.json#/definitions/systemData",
|
|
95
|
-
"default": {}
|
|
96
|
-
}
|
|
97
|
-
},
|
|
98
|
-
"additionalProperties": false,
|
|
99
|
-
"$defs": {
|
|
100
|
-
"setpoint": {
|
|
101
|
-
"type": "object",
|
|
102
|
-
"additionalProperties": false,
|
|
103
|
-
"properties": {
|
|
104
|
-
"value": {
|
|
105
|
-
"$ref": "#/$defs/setpointValue"
|
|
106
|
-
},
|
|
107
|
-
"min": {
|
|
108
|
-
"$ref": "#/$defs/setpointMinMax"
|
|
109
|
-
},
|
|
110
|
-
"max": {
|
|
111
|
-
"$ref": "#/$defs/setpointMinMax"
|
|
112
|
-
}
|
|
113
|
-
}
|
|
114
|
-
},
|
|
115
|
-
"setpointValue": {
|
|
116
|
-
"type": "number",
|
|
117
|
-
"minimum": 0,
|
|
118
|
-
"maximum": 99
|
|
119
|
-
},
|
|
120
|
-
"setpointMinMax": {
|
|
121
|
-
"type": ["number", "null"],
|
|
122
|
-
"minimum": 0,
|
|
123
|
-
"maximum": 99
|
|
124
|
-
}
|
|
125
|
-
},
|
|
126
|
-
"required": [
|
|
127
|
-
"id",
|
|
128
|
-
"type",
|
|
129
|
-
"systemData",
|
|
130
|
-
"hvacMode",
|
|
131
|
-
"fanMode",
|
|
132
|
-
"hvacState",
|
|
133
|
-
"fanState",
|
|
134
|
-
"setpoints",
|
|
135
|
-
"temperatureScale",
|
|
136
|
-
"supportedHvacModes",
|
|
137
|
-
"supportedFanModes"
|
|
138
|
-
]
|
|
139
|
-
}
|
package/schemas/ticket.json
DELETED
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "http://json-schema.org/draft-07/schema",
|
|
3
|
-
"$id": "https://api.kohost.app/schemas/v3/ticket.json",
|
|
4
|
-
"title": "Ticket",
|
|
5
|
-
"description": "A ticket is a request for help from a user.",
|
|
6
|
-
"type": "object",
|
|
7
|
-
"properties": {
|
|
8
|
-
"id": {
|
|
9
|
-
"$ref": "https://api.kohost.app/schemas/v3/definitions/common.json#/definitions/id"
|
|
10
|
-
},
|
|
11
|
-
"conversation": {
|
|
12
|
-
"type": "array",
|
|
13
|
-
"default": [],
|
|
14
|
-
"items": {
|
|
15
|
-
"type": "object",
|
|
16
|
-
"additionalProperties": false,
|
|
17
|
-
"properties": {
|
|
18
|
-
"id": {
|
|
19
|
-
"type": "string"
|
|
20
|
-
},
|
|
21
|
-
"user": {
|
|
22
|
-
"type": "string"
|
|
23
|
-
},
|
|
24
|
-
"timestamp": {
|
|
25
|
-
"$ref": "https://api.kohost.app/schemas/v3/definitions/common.json#/definitions/createdAt"
|
|
26
|
-
},
|
|
27
|
-
"body": {
|
|
28
|
-
"type": "string"
|
|
29
|
-
},
|
|
30
|
-
"readBy": {
|
|
31
|
-
"type": "array",
|
|
32
|
-
"default": [],
|
|
33
|
-
"items": {
|
|
34
|
-
"type": "string"
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
},
|
|
38
|
-
"required": ["user", "id", "timestamp", "body"]
|
|
39
|
-
}
|
|
40
|
-
},
|
|
41
|
-
"requester": {
|
|
42
|
-
"type": "string"
|
|
43
|
-
},
|
|
44
|
-
"assignedTo": {
|
|
45
|
-
"type": ["string", "null"]
|
|
46
|
-
},
|
|
47
|
-
"status": {
|
|
48
|
-
"type": "string",
|
|
49
|
-
"enum": ["open", "pending", "solved", "closed"],
|
|
50
|
-
"default": "open"
|
|
51
|
-
},
|
|
52
|
-
"tags": {
|
|
53
|
-
"type": "array",
|
|
54
|
-
"default": [],
|
|
55
|
-
"items": {
|
|
56
|
-
"type": "string"
|
|
57
|
-
}
|
|
58
|
-
},
|
|
59
|
-
"createdAt": {
|
|
60
|
-
"$ref": "https://api.kohost.app/schemas/v3/definitions/common.json#/definitions/createdAt"
|
|
61
|
-
},
|
|
62
|
-
"updatedAt": {
|
|
63
|
-
"$ref": "https://api.kohost.app/schemas/v3/definitions/common.json#/definitions/createdAt"
|
|
64
|
-
},
|
|
65
|
-
"solvedAt": {
|
|
66
|
-
"$ref": "https://api.kohost.app/schemas/v3/definitions/common.json#/definitions/createdAt"
|
|
67
|
-
},
|
|
68
|
-
"closedAt": {
|
|
69
|
-
"$ref": "https://api.kohost.app/schemas/v3/definitions/common.json#/definitions/createdAt"
|
|
70
|
-
}
|
|
71
|
-
},
|
|
72
|
-
"required": [
|
|
73
|
-
"id",
|
|
74
|
-
"conversation",
|
|
75
|
-
"requester",
|
|
76
|
-
"status",
|
|
77
|
-
"tags",
|
|
78
|
-
"createdAt",
|
|
79
|
-
"updatedAt"
|
|
80
|
-
],
|
|
81
|
-
"additionalProperties": false
|
|
82
|
-
}
|
package/schemas/user.json
DELETED
|
@@ -1,176 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "http://json-schema.org/draft-07/schema",
|
|
3
|
-
"$id": "https://api.kohost.app/schemas/v3/user.json",
|
|
4
|
-
"title": "User",
|
|
5
|
-
"type": "object",
|
|
6
|
-
"required": ["active", "lastName", "roles"],
|
|
7
|
-
"properties": {
|
|
8
|
-
"id": {
|
|
9
|
-
"$ref": "https://api.kohost.app/schemas/v3/definitions/common.json#/definitions/id"
|
|
10
|
-
},
|
|
11
|
-
"type": {
|
|
12
|
-
"type": "string",
|
|
13
|
-
"default": "user"
|
|
14
|
-
},
|
|
15
|
-
"active": {
|
|
16
|
-
"type": "boolean",
|
|
17
|
-
"default": true
|
|
18
|
-
},
|
|
19
|
-
"firstName": {
|
|
20
|
-
"type": "string"
|
|
21
|
-
},
|
|
22
|
-
"lastName": {
|
|
23
|
-
"type": "string"
|
|
24
|
-
},
|
|
25
|
-
"phone": {
|
|
26
|
-
"type": ["string", "null"],
|
|
27
|
-
"pattern": "^\\+[0-9]{1,14}$"
|
|
28
|
-
},
|
|
29
|
-
"phoneVerified": {
|
|
30
|
-
"type": "boolean"
|
|
31
|
-
},
|
|
32
|
-
"email": {
|
|
33
|
-
"type": ["string", "null"],
|
|
34
|
-
"format": "email"
|
|
35
|
-
},
|
|
36
|
-
"emailVerified": {
|
|
37
|
-
"type": "boolean"
|
|
38
|
-
},
|
|
39
|
-
"address": {
|
|
40
|
-
"$ref": "https://api.kohost.app/schemas/v3/definitions/common.json#/definitions/address"
|
|
41
|
-
},
|
|
42
|
-
"secretKey": {
|
|
43
|
-
"type": "string"
|
|
44
|
-
},
|
|
45
|
-
"photo": {
|
|
46
|
-
"type": "string"
|
|
47
|
-
},
|
|
48
|
-
"jobTitle": {
|
|
49
|
-
"type": "string"
|
|
50
|
-
},
|
|
51
|
-
"dob": {
|
|
52
|
-
"type": "string"
|
|
53
|
-
},
|
|
54
|
-
"gender": {
|
|
55
|
-
"type": "string",
|
|
56
|
-
"enum": ["male", "female"]
|
|
57
|
-
},
|
|
58
|
-
"nationality": {
|
|
59
|
-
"type": "string",
|
|
60
|
-
"minLength": 2,
|
|
61
|
-
"maxLength": 2
|
|
62
|
-
},
|
|
63
|
-
"notes": {
|
|
64
|
-
"type": "array",
|
|
65
|
-
"items": {
|
|
66
|
-
"type": "string"
|
|
67
|
-
}
|
|
68
|
-
},
|
|
69
|
-
"files": {
|
|
70
|
-
"type": "array",
|
|
71
|
-
"items": {
|
|
72
|
-
"$ref": "https://api.kohost.app/schemas/v3/definitions/common.json#/definitions/file"
|
|
73
|
-
}
|
|
74
|
-
},
|
|
75
|
-
"roles": {
|
|
76
|
-
"type": "array",
|
|
77
|
-
"items": {
|
|
78
|
-
"type": "string",
|
|
79
|
-
"enum": [
|
|
80
|
-
"Guest",
|
|
81
|
-
"Staff",
|
|
82
|
-
"Faculty",
|
|
83
|
-
"Student",
|
|
84
|
-
"Visitor",
|
|
85
|
-
"Manager",
|
|
86
|
-
"Administrator",
|
|
87
|
-
"SuperAdmin"
|
|
88
|
-
]
|
|
89
|
-
}
|
|
90
|
-
},
|
|
91
|
-
"identifications": {
|
|
92
|
-
"type": "array",
|
|
93
|
-
"items": {
|
|
94
|
-
"$ref": "https://api.kohost.app/schemas/v3/identification.json#"
|
|
95
|
-
}
|
|
96
|
-
},
|
|
97
|
-
"payments": {
|
|
98
|
-
"type": "array",
|
|
99
|
-
"items": {
|
|
100
|
-
"$ref": "https://api.kohost.app/schemas/v3/payment.json#"
|
|
101
|
-
}
|
|
102
|
-
},
|
|
103
|
-
"preferences": {
|
|
104
|
-
"type": "object",
|
|
105
|
-
"additionalProperties": false,
|
|
106
|
-
"properties": {
|
|
107
|
-
"notifications": {
|
|
108
|
-
"type": "array",
|
|
109
|
-
"items": {
|
|
110
|
-
"type": "string"
|
|
111
|
-
},
|
|
112
|
-
"examples": [["roomControl", "marketing"]]
|
|
113
|
-
},
|
|
114
|
-
"location": {
|
|
115
|
-
"title": "The location Schema",
|
|
116
|
-
"type": "boolean",
|
|
117
|
-
"default": false,
|
|
118
|
-
"examples": [true]
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
},
|
|
122
|
-
"location": {
|
|
123
|
-
"type": "object",
|
|
124
|
-
"required": ["accuracy", "latitude", "longitude", "timestamp"],
|
|
125
|
-
"additionalProperties": false,
|
|
126
|
-
"properties": {
|
|
127
|
-
"accuracy": {
|
|
128
|
-
"type": ["number", "null"]
|
|
129
|
-
},
|
|
130
|
-
"latitude": {
|
|
131
|
-
"type": ["number", "null"]
|
|
132
|
-
},
|
|
133
|
-
"longitude": {
|
|
134
|
-
"type": ["number", "null"]
|
|
135
|
-
},
|
|
136
|
-
"timestamp": {
|
|
137
|
-
"type": ["number", "null"]
|
|
138
|
-
}
|
|
139
|
-
}
|
|
140
|
-
},
|
|
141
|
-
"registeredDevices": {
|
|
142
|
-
"type": "array",
|
|
143
|
-
"items": {
|
|
144
|
-
"type": "object",
|
|
145
|
-
"properties": {
|
|
146
|
-
"userAgent": {
|
|
147
|
-
"type": "string"
|
|
148
|
-
},
|
|
149
|
-
"fingerPrint": {
|
|
150
|
-
"type": "string"
|
|
151
|
-
},
|
|
152
|
-
"ip": {
|
|
153
|
-
"type": "string"
|
|
154
|
-
},
|
|
155
|
-
"registeredAt": {
|
|
156
|
-
"type": "string",
|
|
157
|
-
"format": "date-time"
|
|
158
|
-
},
|
|
159
|
-
"expiresAt": {
|
|
160
|
-
"type": "string",
|
|
161
|
-
"format": "date-time"
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
},
|
|
166
|
-
"createdAt": {
|
|
167
|
-
"$ref": "https://api.kohost.app/schemas/v3/definitions/common.json#/definitions/createdAt"
|
|
168
|
-
},
|
|
169
|
-
"updatedAt": {
|
|
170
|
-
"$ref": "https://api.kohost.app/schemas/v3/definitions/common.json#/definitions/updatedAt"
|
|
171
|
-
},
|
|
172
|
-
"systemData": {
|
|
173
|
-
"$ref": "https://api.kohost.app/schemas/v3/definitions/common.json#/definitions/systemData"
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
}
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"$schema": "http://json-schema.org/draft-07/schema",
|
|
3
|
-
"$id": "https://api.kohost.app/schemas/v3/windowCovering.json",
|
|
4
|
-
"title": "Window Covering",
|
|
5
|
-
"description": "Any smart window covering",
|
|
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
|
-
"$ref": "https://api.kohost.app/schemas/v3/definitions/device.json#/definitions/subType"
|
|
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
|
-
"position": {
|
|
24
|
-
"type": "number",
|
|
25
|
-
"minimum": 0,
|
|
26
|
-
"maximum": 100
|
|
27
|
-
},
|
|
28
|
-
"systemData": {
|
|
29
|
-
"$ref": "https://api.kohost.app/schemas/v3/definitions/device.json#/definitions/systemData"
|
|
30
|
-
}
|
|
31
|
-
},
|
|
32
|
-
"additionalProperties": false,
|
|
33
|
-
"required": ["id", "type", "systemData", "position"]
|
|
34
|
-
}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
const Space = require("../../../models/space");
|
|
2
|
-
|
|
3
|
-
const valid = {
|
|
4
|
-
name: "Test Space",
|
|
5
|
-
};
|
|
6
|
-
|
|
7
|
-
test("throws error if invalid name provided ", () => {
|
|
8
|
-
const data = { ...valid };
|
|
9
|
-
data.name = "";
|
|
10
|
-
expect(() => new Space(data)).toThrow();
|
|
11
|
-
});
|
|
12
|
-
|
|
13
|
-
test("sets defaults based on hotelRoom type ", () => {
|
|
14
|
-
const data = { ...valid, type: "hotelRoom" };
|
|
15
|
-
const space = new Space(data);
|
|
16
|
-
expect(space).toHaveProperty("type", "hotelRoom");
|
|
17
|
-
expect(space).toHaveProperty("maximumOccupancy", 2);
|
|
18
|
-
expect(space).toHaveProperty("housekeepingStatus", "dirty");
|
|
19
|
-
expect(space).toHaveProperty("serviceStatus", "inService");
|
|
20
|
-
expect(space).toHaveProperty("features");
|
|
21
|
-
});
|
|
22
|
-
|
|
23
|
-
test("only sets defaults based on hotelRoom type ", () => {
|
|
24
|
-
const data = { ...valid, type: "classRoom" };
|
|
25
|
-
const space = new Space(data);
|
|
26
|
-
expect(space).not.toHaveProperty("type", "hotelRoom");
|
|
27
|
-
expect(space).not.toHaveProperty("maximumOccupancy");
|
|
28
|
-
expect(space).not.toHaveProperty("housekeepingStatus");
|
|
29
|
-
expect(space).not.toHaveProperty("serviceStatus");
|
|
30
|
-
expect(space).not.toHaveProperty("features");
|
|
31
|
-
});
|