@kohost/api-client 3.0.0-beta.7 → 3.0.0-beta.71
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/README.md +71 -0
- package/dist/cjs/AMQPClient/index.js +298 -0
- package/dist/cjs/{Client.js → Client/index.js} +1535 -586
- package/dist/cjs/Commands/CheckInReservationCommand.js +19 -0
- package/dist/cjs/Commands/Command.js +34 -0
- package/dist/cjs/Commands/CreateImageUploadEndpointCommand.js +17 -0
- package/dist/cjs/Commands/CreateShortLinkCommand.js +20 -0
- package/dist/cjs/Commands/DiscoverCategoriesCommand.js +20 -0
- package/dist/cjs/Commands/DiscoverReservationSpaceCategoryAvailabilitiesCommand.js +20 -0
- package/dist/cjs/Commands/DiscoverReservationsCommand.js +20 -0
- package/dist/cjs/Commands/DiscoverRoomsCommand.js +37 -0
- package/dist/cjs/Commands/DiscoverUsersCommand.js +19 -0
- package/dist/cjs/Commands/GetMobileKeyCommand.js +24 -0
- package/dist/cjs/Commands/GetProductsCommand.js +17 -0
- package/dist/cjs/Commands/OCRDocumentCommand.js +15 -0
- package/dist/cjs/Commands/SellProductsCommand.js +17 -0
- package/dist/cjs/Commands/SendEmailCommand.js +24 -0
- package/dist/cjs/Commands/SendSMSCommand.js +21 -0
- package/dist/cjs/Commands/SetAlarmCommand.js +17 -0
- package/dist/cjs/Commands/SetCourtesyCommand.js +17 -0
- package/dist/cjs/Commands/SetDimmerCommand.js +17 -0
- package/dist/cjs/Commands/SetLockCommand.js +17 -0
- package/dist/cjs/Commands/SetMediaCommand.js +17 -0
- package/dist/cjs/Commands/SetSceneCommand.js +17 -0
- package/dist/cjs/Commands/SetSwitchCommand.js +17 -0
- package/dist/cjs/Commands/SetThermostatCommand.js +17 -0
- package/dist/cjs/Commands/SetWindowCoveringCommand.js +17 -0
- package/dist/cjs/Commands/UpdateReservationCommand.js +19 -0
- package/dist/cjs/Commands/UpdateUserCommand.js +41 -0
- package/dist/cjs/Commands/UploadImageCommand.js +17 -0
- package/dist/cjs/Commands/index.js +55 -0
- package/dist/cjs/Errors/AppError.js +8 -0
- package/dist/cjs/Errors/AuthenticationError.js +9 -0
- package/dist/cjs/Errors/AuthorizationError.js +9 -0
- package/dist/cjs/Errors/ConflictError.js +9 -0
- package/dist/cjs/Errors/DeviceCommError.js +9 -0
- package/dist/cjs/Errors/LoginError.js +9 -0
- package/dist/cjs/Errors/NotFoundError.js +9 -0
- package/dist/cjs/Errors/RequestError.js +9 -0
- package/dist/cjs/Errors/SystemCommError.js +9 -0
- package/dist/cjs/Errors/TokenExpiredError.js +9 -0
- package/dist/cjs/Errors/UnprocessableRequestError.js +9 -0
- package/dist/cjs/Errors/ValidationError.js +9 -0
- package/dist/cjs/Errors/index.js +16 -0
- package/dist/cjs/Events/ApplicationInUseEvent.js +21 -0
- package/dist/cjs/Events/ApplicationOutOfUseEvent.js +21 -0
- package/dist/cjs/Events/EmailEvent.js +18 -0
- package/dist/cjs/Events/Event.js +55 -0
- package/dist/cjs/Events/SMSEvent.js +18 -0
- package/dist/cjs/Events/SMSSentEvent.js +17 -0
- package/dist/cjs/Events/SceneSetEvent.js +17 -0
- package/dist/cjs/Events/ShortLinkCreatedEvent.js +17 -0
- package/dist/cjs/Events/SystemAlarmUpdatedEvent.js +17 -0
- package/dist/cjs/Events/SystemCameraUpdatedEvent.js +17 -0
- package/dist/cjs/Events/SystemCategoryUpdatedEvent.js +17 -0
- package/dist/cjs/Events/SystemCourtesyUpdatedEvent.js +17 -0
- package/dist/cjs/Events/SystemDimmerUpdatedEvent.js +17 -0
- package/dist/cjs/Events/SystemEntityDeletedEvent.js +17 -0
- package/dist/cjs/Events/SystemGatewayUpdatedEvent.js +17 -0
- package/dist/cjs/Events/SystemLockUpdatedEvent.js +17 -0
- package/dist/cjs/Events/SystemMediaSourceUpdatedEvent.js +17 -0
- package/dist/cjs/Events/SystemMotionSensorUpdatedEvent.js +17 -0
- package/dist/cjs/Events/SystemOrganizationUpdatedEvent.js +17 -0
- package/dist/cjs/Events/SystemProductUpdatedEvent.js +17 -0
- package/dist/cjs/Events/SystemPropertyUpdatedEvent.js +17 -0
- package/dist/cjs/Events/SystemReservationUpdatedEvent.js +17 -0
- package/dist/cjs/Events/SystemSceneControllerUpdatedEvent.js +17 -0
- package/dist/cjs/Events/SystemSpaceUpdatedEvent.js +17 -0
- package/dist/cjs/Events/SystemSwitchUpdatedEvent.js +17 -0
- package/dist/cjs/Events/SystemThermostatUpdatedEvent.js +17 -0
- package/dist/cjs/Events/SystemUserUpdatedEvent.js +17 -0
- package/dist/cjs/Events/SystemWindowCoveringUpdatedEvent.js +17 -0
- package/dist/cjs/Events/index.js +63 -0
- package/dist/cjs/Models/Alarm.js +35 -0
- package/dist/cjs/Models/Camera.js +35 -0
- package/dist/cjs/Models/Category.js +36 -0
- package/dist/cjs/Models/Courtesy.js +39 -0
- package/dist/cjs/Models/Credential.js +35 -0
- package/dist/cjs/Models/Dimmer.js +61 -0
- package/dist/cjs/Models/DiscoveredDevice.js +36 -0
- package/dist/cjs/Models/EmailMessage.js +35 -0
- package/dist/cjs/Models/EnergyReport.js +35 -0
- package/dist/cjs/Models/EnergyReportShard.js +35 -0
- package/dist/cjs/Models/Gateway.js +35 -0
- package/dist/cjs/Models/Identification.js +38 -0
- package/dist/cjs/Models/Kohost.js +96 -0
- package/dist/cjs/Models/Lock.js +39 -0
- package/dist/cjs/Models/MediaFile.js +48 -0
- package/dist/cjs/Models/MediaSource.js +35 -0
- package/dist/cjs/Models/MotionSensor.js +35 -0
- package/dist/cjs/Models/Notification.js +34 -0
- package/dist/cjs/Models/Order.js +97 -0
- package/dist/cjs/Models/Organization.js +34 -0
- package/dist/cjs/Models/Product.js +35 -0
- package/dist/cjs/Models/Property.js +34 -0
- package/dist/cjs/Models/Reservation.js +114 -0
- package/dist/cjs/Models/Room.js +218 -0
- package/dist/cjs/Models/Scene.js +169 -0
- package/dist/cjs/Models/ShortLink.js +35 -0
- package/dist/cjs/Models/SmsMessage.js +35 -0
- package/dist/cjs/Models/Space.js +97 -0
- package/dist/cjs/Models/Switch.js +39 -0
- package/dist/cjs/Models/SystemUser.js +55 -0
- package/dist/cjs/Models/Thermostat.js +86 -0
- package/dist/cjs/Models/Ticket.js +112 -0
- package/dist/cjs/Models/User.js +115 -0
- package/dist/cjs/Models/WindowCovering.js +55 -0
- package/dist/cjs/Models/index.js +72 -0
- package/dist/cjs/SocketIoClient/index.js +74 -0
- package/dist/cjs/defs/deviceTypes.js +15 -0
- package/dist/cjs/defs/formalDeviceTypes.js +6 -0
- package/dist/cjs/defs/index.js +11 -0
- package/dist/cjs/{index.cjs.js → index.js} +7 -1
- package/dist/cjs/schemas/AlarmSchema.d.ts +151 -0
- package/dist/cjs/schemas/CameraSchema.d.ts +142 -0
- package/dist/cjs/schemas/CategorySchema.d.ts +81 -0
- package/dist/cjs/schemas/CourtesySchema.d.ts +141 -0
- package/dist/cjs/schemas/CredentialSchema.d.ts +21 -0
- package/dist/cjs/schemas/DefinitionsSchema.d.ts +10 -0
- package/dist/cjs/schemas/DimmerSchema.d.ts +141 -0
- package/dist/cjs/schemas/DiscoveredDeviceSchema.d.ts +39 -0
- package/dist/cjs/schemas/EmailMessageSchema.d.ts +49 -0
- package/dist/cjs/schemas/EnergyReportSchema.d.ts +57 -0
- package/dist/cjs/schemas/EnergyReportShardSchema.d.ts +61 -0
- package/dist/cjs/schemas/GatewaySchema.d.ts +138 -0
- package/dist/cjs/schemas/IdentificationSchema.d.ts +45 -0
- package/dist/cjs/schemas/LockSchema.d.ts +141 -0
- package/dist/cjs/schemas/MediaFileSchema.d.ts +43 -0
- package/dist/cjs/schemas/MediaSourceSchema.d.ts +237 -0
- package/dist/cjs/schemas/MotionSensorSchema.d.ts +136 -0
- package/dist/cjs/schemas/NotificationSchema.d.ts +54 -0
- package/dist/cjs/schemas/OrderSchema.d.ts +91 -0
- package/dist/cjs/schemas/OrganizationSchema.d.ts +34 -0
- package/dist/cjs/schemas/PaymentSchema.d.ts +33 -0
- package/dist/cjs/schemas/ProductSchema.d.ts +65 -0
- package/dist/cjs/schemas/PropertySchema.d.ts +38 -0
- package/dist/cjs/schemas/ReservationSchema.d.ts +112 -0
- package/dist/cjs/schemas/RoomSchema.d.ts +1066 -0
- package/dist/cjs/schemas/SceneSchema.d.ts +57 -0
- package/dist/cjs/schemas/ShortLinkSchema.d.ts +20 -0
- package/dist/cjs/schemas/SmsMessageSchema.d.ts +40 -0
- package/dist/cjs/schemas/SpaceSchema.d.ts +58 -0
- package/dist/cjs/schemas/SwitchSchema.d.ts +141 -0
- package/dist/cjs/schemas/SystemUserSchema.d.ts +192 -0
- package/dist/cjs/schemas/ThermostatSchema.d.ts +171 -0
- package/dist/cjs/schemas/TicketSchema.d.ts +88 -0
- package/dist/cjs/schemas/UserSchema.d.ts +280 -0
- package/dist/cjs/schemas/WindowCoveringSchema.d.ts +140 -0
- package/dist/cjs/schemas/alarm.json +81 -0
- package/dist/cjs/schemas/camera.json +50 -0
- package/dist/cjs/schemas/category.json +42 -0
- package/dist/cjs/schemas/courtesy.json +48 -0
- package/dist/cjs/schemas/credential.json +37 -0
- package/dist/cjs/schemas/definitions.json +217 -0
- package/dist/cjs/schemas/dimmer.json +45 -0
- package/dist/cjs/schemas/discoveredDevice.json +31 -0
- package/dist/cjs/schemas/emailMessage.json +71 -0
- package/dist/cjs/schemas/energyReport.json +86 -0
- package/dist/cjs/schemas/energyReportShard.json +75 -0
- package/dist/cjs/schemas/gateway.json +34 -0
- package/dist/cjs/schemas/identification.json +61 -0
- package/dist/cjs/schemas/lock.json +44 -0
- package/dist/cjs/schemas/mediaFile.json +70 -0
- package/dist/cjs/schemas/mediaSource.json +187 -0
- package/dist/cjs/schemas/motionSensor.json +32 -0
- package/dist/cjs/schemas/notification.json +29 -0
- package/dist/cjs/schemas/order.json +182 -0
- package/dist/cjs/schemas/organization.json +40 -0
- package/dist/cjs/schemas/payment.json +47 -0
- package/dist/cjs/schemas/product.json +41 -0
- package/dist/cjs/schemas/property.json +333 -0
- package/dist/cjs/schemas/reservation.json +130 -0
- package/dist/cjs/schemas/room.json +98 -0
- package/dist/cjs/schemas/scene.json +121 -0
- package/dist/cjs/schemas/shortLink.json +30 -0
- package/dist/cjs/schemas/smsMessage.json +61 -0
- package/dist/cjs/schemas/space.json +118 -0
- package/dist/cjs/schemas/switch.json +44 -0
- package/dist/cjs/schemas/systemUser.json +98 -0
- package/dist/cjs/schemas/thermostat.json +150 -0
- package/dist/cjs/schemas/ticket.json +141 -0
- package/dist/cjs/schemas/user.json +170 -0
- package/dist/cjs/schemas/windowCovering.json +42 -0
- package/dist/cjs/utils/errorFactory.js +8 -0
- package/dist/cjs/utils/eventFactory.js +10 -0
- package/dist/cjs/utils/getDeviceTypes.js +7 -0
- package/dist/cjs/utils/getFormalDeviceType.js +5 -0
- package/dist/cjs/utils/index.js +11 -0
- package/dist/cjs/utils/schema.js +25 -0
- package/dist/esm/Client.js +1632 -627
- package/dist/esm/Client.js.map +4 -4
- package/dist/esm/Commands.js +521 -113
- package/dist/esm/Commands.js.map +3 -3
- package/dist/esm/Errors.js +73 -22
- package/dist/esm/Errors.js.map +3 -3
- package/dist/esm/Events.js +390 -73
- package/dist/esm/Events.js.map +3 -3
- package/dist/esm/Models.js +3292 -1186
- package/dist/esm/Models.js.map +4 -4
- package/dist/esm/SocketIoClient.js +4846 -0
- package/dist/esm/SocketIoClient.js.map +7 -0
- package/dist/esm/defs.js +146 -101
- package/dist/esm/defs.js.map +4 -4
- package/dist/esm/index.js +17 -10
- package/dist/esm/utils.js +445 -73
- package/dist/esm/utils.js.map +3 -3
- package/dist/useCases/AdminUpdateCustomer.js +1 -1
- package/dist/useCases/AssignSpaceToReservation.js +32 -0
- package/dist/useCases/{AdminCreateProperty.js → BatchNotifyCheckIn.js} +2 -2
- package/dist/useCases/{AdminCreateCustomer.js → CreateCateory.js} +2 -2
- package/dist/useCases/CreateImageUploadEndpoint.js +32 -0
- package/dist/useCases/{DeleteIntegration.js → CreateMediaSource.js} +4 -4
- package/dist/useCases/{AdminListCustomers.js → CreateOrganization.js} +3 -3
- package/dist/useCases/{AdminLoginUser.js → CreateProperty.js} +2 -2
- package/dist/useCases/DeleteCategory.js +32 -0
- package/dist/useCases/DeleteMediaFile.js +32 -0
- package/dist/useCases/DeleteMediaSource.js +32 -0
- package/dist/useCases/{ListIntegrations.js → DescribeCategory.js} +3 -3
- package/dist/useCases/{DeleteSource.js → DescribeLockCredential.js} +3 -3
- package/dist/useCases/{AdminListAdminUsers.js → DescribeMediaSource.js} +3 -3
- package/dist/useCases/DescribeMyAccessCredentials.js +32 -0
- package/dist/useCases/{AdminCreateAdminUser.js → DescribeOrganization.js} +4 -4
- package/dist/useCases/{DescribeIntegration.js → DescribeProduct.js} +2 -2
- package/dist/useCases/{AdminDescribeCustomer.js → DescribeProperty.js} +2 -2
- package/dist/useCases/DescribeReservationEarlyCheckInProducts.js +32 -0
- package/dist/useCases/DescribeReservationLateCheckOutProducts.js +32 -0
- package/dist/useCases/{AdminDescribeProperty.js → DescribeReservationRoomUpgrades.js} +2 -2
- package/dist/useCases/ListCategories.js +32 -0
- package/dist/useCases/ListMediaSources.js +32 -0
- package/dist/useCases/{CreateSource.js → ListMyOrders.js} +4 -4
- package/dist/useCases/{AdminListProperties.js → ListMyTickets.js} +2 -2
- package/dist/useCases/ListOrders.js +32 -0
- package/dist/useCases/{AdminRefreshToken.js → ListOrganizations.js} +3 -3
- package/dist/useCases/ListProperties.js +32 -0
- package/dist/useCases/ListScenes.js +32 -0
- package/dist/useCases/ListTeam.js +32 -0
- package/dist/useCases/ListUserOrders.js +32 -0
- package/dist/useCases/ListUserSpaces.js +32 -0
- package/dist/useCases/LogoutUser.js +32 -0
- package/dist/useCases/PurchaseReservationEarlyCheckInProducts.js +32 -0
- package/dist/useCases/PurchaseReservationLateCheckOutProducts.js +32 -0
- package/dist/useCases/{CreateIntegrationDeviceMapEntry.js → PurchaseReservationRoomUpgrades.js} +2 -2
- package/dist/useCases/RequestLoginLink.js +1 -1
- package/dist/useCases/{CreateIntegration.js → RequestMyKeyToken.js} +2 -2
- package/dist/useCases/RequestPWAToken.js +32 -0
- package/dist/useCases/SendCheckInSMS.js +32 -0
- package/dist/useCases/{SetSource.js → SetDimmer.js} +2 -2
- package/dist/useCases/{DescribeSource.js → SetMediaSource.js} +3 -3
- package/dist/useCases/{UpdateSource.js → SetRoomScene.js} +3 -3
- package/dist/useCases/SetSpaceScene.js +32 -0
- package/dist/useCases/TipUser.js +32 -0
- package/dist/useCases/{AdminUpdateProperty.js → UpdateCategory.js} +2 -2
- package/dist/useCases/{UpdateIntegration.js → UpdateMediaSource.js} +3 -3
- package/dist/useCases/UpdateProperty.js +32 -0
- package/dist/useCases/UpdateReservationExpectedArrivalTime.js +32 -0
- package/dist/useCases/{ListSources.js → UploadImage.js} +4 -4
- package/package.json +36 -10
- package/dist/cjs/Commands.js +0 -585
- package/dist/cjs/Errors.js +0 -176
- package/dist/cjs/Events.js +0 -387
- package/dist/cjs/Models.js +0 -3612
- package/dist/cjs/defs.js +0 -178
- package/dist/cjs/utils.js +0 -250
- package/dist/useCases/AdminRequestLoginLink.js +0 -32
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
const Command = require("./Command");
|
|
2
|
+
const RequestError = require("../Errors/RequestError");
|
|
3
|
+
|
|
4
|
+
class CheckInReservationCommand extends Command {
|
|
5
|
+
constructor({ id }) {
|
|
6
|
+
if (!id) throw new RequestError("document type is required");
|
|
7
|
+
super({ id });
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
get name() {
|
|
11
|
+
return "CheckInReservation";
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
get routingKey() {
|
|
15
|
+
return `reservation.${this.data.id}.checkin`;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
module.exports = CheckInReservationCommand;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
class Command {
|
|
2
|
+
constructor(data) {
|
|
3
|
+
this.data = {};
|
|
4
|
+
if (!data) throw new Error("Command data is required");
|
|
5
|
+
if (typeof data !== "object")
|
|
6
|
+
throw new Error("Command data must be an object");
|
|
7
|
+
|
|
8
|
+
for (const key in data) {
|
|
9
|
+
this.data[key] = data[key];
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
get name() {
|
|
14
|
+
throw new Error("Command name is required");
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
get type() {
|
|
18
|
+
return "Command";
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
get routingKey() {
|
|
22
|
+
return "";
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
get exchange() {
|
|
26
|
+
return "Commands";
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
build() {
|
|
30
|
+
return { data: { ...this.data } };
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
module.exports = Command;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
const Command = require("./Command");
|
|
2
|
+
|
|
3
|
+
class CreateImageUploadEndpointCommand extends Command {
|
|
4
|
+
constructor({ id, expires, ...rest }) {
|
|
5
|
+
super({ id, expires, ...rest });
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
get name() {
|
|
9
|
+
return "CreateImageUploadEndpoint";
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
get routingKey() {
|
|
13
|
+
return "image.createUploadEndpoint";
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
module.exports = CreateImageUploadEndpointCommand;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
const Command = require("./Command");
|
|
2
|
+
const RequestError = require("../Errors/RequestError");
|
|
3
|
+
|
|
4
|
+
class CreateShortLinkCommand extends Command {
|
|
5
|
+
constructor({ title, destination }) {
|
|
6
|
+
if (!title) throw new RequestError("title is required");
|
|
7
|
+
if (!destination) throw new RequestError("destination to is required");
|
|
8
|
+
super({ title, destination });
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
get name() {
|
|
12
|
+
return "CreateShortLink";
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
get routingKey() {
|
|
16
|
+
return "comm.shortlink.create";
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
module.exports = CreateShortLinkCommand;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
const Command = require("./Command");
|
|
2
|
+
|
|
3
|
+
class DiscoverCategoriesCommand extends Command {
|
|
4
|
+
constructor({ id, ...rest }) {
|
|
5
|
+
super({ id, ...rest });
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
get name() {
|
|
9
|
+
return "DiscoverCategories";
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
get routingKey() {
|
|
13
|
+
if (typeof this.data.id === "string")
|
|
14
|
+
return `categories.${this.data.id}.get`;
|
|
15
|
+
if (Array.isArray(this.data.id)) return "categories.batch.get";
|
|
16
|
+
return "categories.get";
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
module.exports = DiscoverCategoriesCommand;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
const { RequestError } = require("../Errors");
|
|
2
|
+
const Command = require("./Command");
|
|
3
|
+
|
|
4
|
+
class DiscoverReservationSpaceCategoryAvailabilitiesCommand extends Command {
|
|
5
|
+
constructor(options) {
|
|
6
|
+
if (!options) throw new RequestError("options are required");
|
|
7
|
+
const { id, ...rest } = options;
|
|
8
|
+
super({ id, ...rest });
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
get name() {
|
|
12
|
+
return "DiscoverReservationSpaceCategoryAvailabilities";
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
get routingKey() {
|
|
16
|
+
return "reservation.discoverRoomUpsells";
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
module.exports = DiscoverReservationSpaceCategoryAvailabilitiesCommand;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
const { RequestError } = require("../Errors");
|
|
2
|
+
const Command = require("./Command");
|
|
3
|
+
|
|
4
|
+
class DiscoverReservationsCommand extends Command {
|
|
5
|
+
constructor(options) {
|
|
6
|
+
if (!options) throw new RequestError("options are required");
|
|
7
|
+
const { id, startDate, endDate, status, ...rest } = options;
|
|
8
|
+
super({ id, startDate, endDate, status, ...rest });
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
get name() {
|
|
12
|
+
return "DiscoverReservations";
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
get routingKey() {
|
|
16
|
+
return "reservation.discover";
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
module.exports = DiscoverReservationsCommand;
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
const Command = require("./Command");
|
|
2
|
+
|
|
3
|
+
class DiscoverRoomsCommand extends Command {
|
|
4
|
+
constructor({
|
|
5
|
+
id,
|
|
6
|
+
types,
|
|
7
|
+
categories,
|
|
8
|
+
startDate,
|
|
9
|
+
endDate,
|
|
10
|
+
serviceStatus,
|
|
11
|
+
housekeepingStatus,
|
|
12
|
+
...rest
|
|
13
|
+
}) {
|
|
14
|
+
super({
|
|
15
|
+
id,
|
|
16
|
+
types,
|
|
17
|
+
categories,
|
|
18
|
+
startDate,
|
|
19
|
+
endDate,
|
|
20
|
+
serviceStatus,
|
|
21
|
+
housekeepingStatus,
|
|
22
|
+
...rest,
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
get name() {
|
|
27
|
+
return "DiscoverRooms";
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
get routingKey() {
|
|
31
|
+
if (typeof this.data.id === "string") return `rooms.${this.data.id}.get`;
|
|
32
|
+
if (Array.isArray(this.data.id)) return "rooms.batch.get";
|
|
33
|
+
return "rooms.get";
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
module.exports = DiscoverRoomsCommand;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
const Command = require("./Command");
|
|
2
|
+
|
|
3
|
+
class DiscoverUsersCommand extends Command {
|
|
4
|
+
constructor({ id, ...rest }) {
|
|
5
|
+
super({ id, ...rest });
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
get name() {
|
|
9
|
+
return "DiscoverUsers";
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
get routingKey() {
|
|
13
|
+
if (typeof this.data.id === "string") return `users.${this.data.id}.get`;
|
|
14
|
+
if (Array.isArray(this.data.id)) return "users.batch.get";
|
|
15
|
+
return "users.get";
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
module.exports = DiscoverUsersCommand;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
const Command = require("./Command");
|
|
2
|
+
|
|
3
|
+
class GetMobileKeyCommand extends Command {
|
|
4
|
+
constructor({
|
|
5
|
+
id,
|
|
6
|
+
phone,
|
|
7
|
+
beginDateTime,
|
|
8
|
+
endDateTime,
|
|
9
|
+
keyToReplace,
|
|
10
|
+
...rest
|
|
11
|
+
}) {
|
|
12
|
+
super({ id, phone, beginDateTime, endDateTime, keyToReplace, ...rest });
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
get name() {
|
|
16
|
+
return "GetMobileKey";
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
get routingKey() {
|
|
20
|
+
return `lock.${this.data.id}.set`;
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
module.exports = GetMobileKeyCommand;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
const Command = require("./Command");
|
|
2
|
+
|
|
3
|
+
class GetProductsCommand extends Command {
|
|
4
|
+
constructor({ id, externalSystemId, ...rest }) {
|
|
5
|
+
super({ id, externalSystemId, ...rest });
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
get name() {
|
|
9
|
+
return "GetProducts";
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
get routingKey() {
|
|
13
|
+
return `product.${this.data.id}.get`;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
module.exports = GetProductsCommand;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
const Command = require("./Command");
|
|
2
|
+
const RequestError = require("../Errors/RequestError");
|
|
3
|
+
|
|
4
|
+
class OCRDocumentCommand extends Command {
|
|
5
|
+
constructor({ type, image }) {
|
|
6
|
+
if (!image) throw new RequestError("document image is required");
|
|
7
|
+
super({ type, image });
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
get name() {
|
|
11
|
+
return "OCRDocument";
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
module.exports = OCRDocumentCommand;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
const Command = require("./Command");
|
|
2
|
+
|
|
3
|
+
class SellProductsCommand extends Command {
|
|
4
|
+
constructor({ reservationId, userId, products, ...rest }) {
|
|
5
|
+
super({ reservationId, userId, products, ...rest });
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
get name() {
|
|
9
|
+
return "SellProducts";
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
get routingKey() {
|
|
13
|
+
return `product.${this.data.id}.sell`;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
module.exports = SellProductsCommand;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
const Command = require("./Command");
|
|
2
|
+
const RequestError = require("../Errors/RequestError");
|
|
3
|
+
|
|
4
|
+
class SendEmailCommand extends Command {
|
|
5
|
+
constructor({ text, html, to, from, subject, ...rest }) {
|
|
6
|
+
if (!to) throw new RequestError("email to is required");
|
|
7
|
+
if (!from) throw new RequestError("email from is required");
|
|
8
|
+
if (!subject) throw new RequestError("email subject is required");
|
|
9
|
+
if (!text && !html)
|
|
10
|
+
throw new RequestError("email text or html is required");
|
|
11
|
+
|
|
12
|
+
super({ text, html, to, from, subject, ...rest });
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
get name() {
|
|
16
|
+
return "SendEmail";
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
get routingKey() {
|
|
20
|
+
return "comm.email.send";
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
module.exports = SendEmailCommand;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
const Command = require("./Command");
|
|
2
|
+
const RequestError = require("../Errors/RequestError");
|
|
3
|
+
|
|
4
|
+
class SendSMSCommand extends Command {
|
|
5
|
+
constructor({ id, body, to, from, ...rest }) {
|
|
6
|
+
if (!body) throw new RequestError("sms body is required");
|
|
7
|
+
if (!to) throw new RequestError("sms to is required");
|
|
8
|
+
if (!from) throw new RequestError("sms from is required");
|
|
9
|
+
super({ id, body, to, from, ...rest });
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
get name() {
|
|
13
|
+
return "SendSMS";
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
get routingKey() {
|
|
17
|
+
return "comm.sms.send";
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
module.exports = SendSMSCommand;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
const Command = require("./Command");
|
|
2
|
+
|
|
3
|
+
class SetAlarmCommand extends Command {
|
|
4
|
+
constructor({ id, zones, areas }) {
|
|
5
|
+
super({ id, zones, areas });
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
get name() {
|
|
9
|
+
return "SetAlarm";
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
get routingKey() {
|
|
13
|
+
return `alarm.${this.data.id}.set`;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
module.exports = SetAlarmCommand;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
const Command = require("./Command");
|
|
2
|
+
|
|
3
|
+
class SetCourtesyCommand extends Command {
|
|
4
|
+
constructor({ id, state }) {
|
|
5
|
+
super({ id, state });
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
get name() {
|
|
9
|
+
return "SetCourtesy";
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
get routingKey() {
|
|
13
|
+
return `courtesy.${this.data.id}.set`;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
module.exports = SetCourtesyCommand;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
const Command = require("./Command");
|
|
2
|
+
|
|
3
|
+
class SetDimmerCommand extends Command {
|
|
4
|
+
constructor({ id, level }) {
|
|
5
|
+
super({ id, level });
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
get name() {
|
|
9
|
+
return "SetDimmer";
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
get routingKey() {
|
|
13
|
+
return `dimmer.${this.data.id}.set`;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
module.exports = SetDimmerCommand;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
const Command = require("./Command");
|
|
2
|
+
|
|
3
|
+
class SetLockCommand extends Command {
|
|
4
|
+
constructor({ id, state }) {
|
|
5
|
+
super({ id, state });
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
get name() {
|
|
9
|
+
return "SetLock";
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
get routingKey() {
|
|
13
|
+
return `lock.${this.data.id}.set`;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
module.exports = SetLockCommand;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
const Command = require("./Command");
|
|
2
|
+
|
|
3
|
+
class SetMediaCommand extends Command {
|
|
4
|
+
constructor({ id, command, ...rest }) {
|
|
5
|
+
super({ id, command, ...rest });
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
get name() {
|
|
9
|
+
return "SetMedia";
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
get routingKey() {
|
|
13
|
+
return `mediaSource.${this.data.id}.set`;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
module.exports = SetMediaCommand;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
const Command = require("./Command");
|
|
2
|
+
|
|
3
|
+
class SetSceneCommand extends Command {
|
|
4
|
+
constructor({ id, devices, ...rest }) {
|
|
5
|
+
super({ id, devices, ...rest });
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
get name() {
|
|
9
|
+
return "SetScene";
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
get routingKey() {
|
|
13
|
+
return `scene.${this.data.id}.set`;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
module.exports = SetSceneCommand;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
const Command = require("./Command");
|
|
2
|
+
|
|
3
|
+
class SetSwitchCommand extends Command {
|
|
4
|
+
constructor({ id, state }) {
|
|
5
|
+
super({ id, state });
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
get name() {
|
|
9
|
+
return "SetSwitch";
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
get routingKey() {
|
|
13
|
+
return `switch.${this.data.id}.set`;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
module.exports = SetSwitchCommand;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
const Command = require("./Command");
|
|
2
|
+
|
|
3
|
+
class SetThermostatCommand extends Command {
|
|
4
|
+
constructor({ id, setpoints, hvacMode, fanMode }) {
|
|
5
|
+
super({ id, setpoints, hvacMode, fanMode });
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
get name() {
|
|
9
|
+
return "SetThermostat";
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
get routingKey() {
|
|
13
|
+
return `thermostat.${this.data.id}.set`;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
module.exports = SetThermostatCommand;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
const Command = require("./Command");
|
|
2
|
+
|
|
3
|
+
class SetWindowCoveringCommand extends Command {
|
|
4
|
+
constructor({ id, position }) {
|
|
5
|
+
super({ id, position });
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
get name() {
|
|
9
|
+
return "SetWindowCovering";
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
get routingKey() {
|
|
13
|
+
return `windowCovering.${this.data.id}.set`;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
module.exports = SetWindowCoveringCommand;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
const Command = require("./Command");
|
|
2
|
+
const RequestError = require("../Errors/RequestError");
|
|
3
|
+
|
|
4
|
+
class UpdateReservationCommand extends Command {
|
|
5
|
+
constructor({ id, ...rest }) {
|
|
6
|
+
if (!id) throw new RequestError("document type is required");
|
|
7
|
+
super({ id, ...rest });
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
get name() {
|
|
11
|
+
return "UpdateReservation";
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
get routingKey() {
|
|
15
|
+
return `reservation.${this.data.id}.update`;
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
module.exports = UpdateReservationCommand;
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
const Command = require("./Command");
|
|
2
|
+
const RequestError = require("../Errors/RequestError");
|
|
3
|
+
|
|
4
|
+
class UpdateUserCommand extends Command {
|
|
5
|
+
constructor({
|
|
6
|
+
id,
|
|
7
|
+
email,
|
|
8
|
+
phone,
|
|
9
|
+
identification,
|
|
10
|
+
address,
|
|
11
|
+
note,
|
|
12
|
+
nationality,
|
|
13
|
+
file,
|
|
14
|
+
payment,
|
|
15
|
+
...rest
|
|
16
|
+
}) {
|
|
17
|
+
if (!id) throw new RequestError("document type is required");
|
|
18
|
+
super({
|
|
19
|
+
id,
|
|
20
|
+
email,
|
|
21
|
+
phone,
|
|
22
|
+
identification,
|
|
23
|
+
address,
|
|
24
|
+
note,
|
|
25
|
+
nationality,
|
|
26
|
+
file,
|
|
27
|
+
payment,
|
|
28
|
+
...rest,
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
get name() {
|
|
33
|
+
return "UpdateUser";
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
get routingKey() {
|
|
37
|
+
return `user.${this.data.id}.update`;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
module.exports = UpdateUserCommand;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
const Command = require("./Command");
|
|
2
|
+
|
|
3
|
+
class UploadImageCommand extends Command {
|
|
4
|
+
constructor({ id, url, file, ...rest }) {
|
|
5
|
+
super({ id, url, file, ...rest });
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
get name() {
|
|
9
|
+
return "UploadImage";
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
get routingKey() {
|
|
13
|
+
return `image.${this.data.id}.upload`;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
module.exports = UploadImageCommand;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
const SetSceneCommand = require("./SetSceneCommand");
|
|
2
|
+
const SetAlarmCommand = require("./SetAlarmCommand");
|
|
3
|
+
const SetDimmerCommand = require("./SetDimmerCommand");
|
|
4
|
+
const SetSwitchCommand = require("./SetSwitchCommand");
|
|
5
|
+
const SetThermostatCommand = require("./SetThermostatCommand");
|
|
6
|
+
const SetLockCommand = require("./SetLockCommand");
|
|
7
|
+
const SetWindowCoveringCommand = require("./SetWindowCoveringCommand");
|
|
8
|
+
const SetCourtesyCommand = require("./SetCourtesyCommand");
|
|
9
|
+
const SetMediaCommand = require("./SetMediaCommand");
|
|
10
|
+
const DiscoverUsersCommand = require("./DiscoverUsersCommand");
|
|
11
|
+
const OCRDocumentCommand = require("./OCRDocumentCommand");
|
|
12
|
+
const CheckInReservationCommand = require("./CheckInReservationCommand");
|
|
13
|
+
const SendEmailCommand = require("./SendEmailCommand");
|
|
14
|
+
const SendSMSCommand = require("./SendSMSCommand");
|
|
15
|
+
const DiscoverReservationsCommand = require("./DiscoverReservationsCommand");
|
|
16
|
+
const DiscoverReservationSpaceCategoryAvailabilitiesCommand = require("./DiscoverReservationSpaceCategoryAvailabilitiesCommand");
|
|
17
|
+
const DiscoverRoomsCommand = require("./DiscoverRoomsCommand");
|
|
18
|
+
const DiscoverCategoriesCommand = require("./DiscoverCategoriesCommand");
|
|
19
|
+
const CreateShortLinkCommand = require("./CreateShortLinkCommand");
|
|
20
|
+
const UpdateReservationCommand = require("./UpdateReservationCommand");
|
|
21
|
+
const UpdateUserCommand = require("./UpdateUserCommand");
|
|
22
|
+
const GetMobileKeyCommand = require("./GetMobileKeyCommand");
|
|
23
|
+
const CreateImageUploadEndpointCommand = require("./CreateImageUploadEndpointCommand");
|
|
24
|
+
const UploadImageCommand = require("./UploadImageCommand");
|
|
25
|
+
const GetProductsCommand = require("./GetProductsCommand");
|
|
26
|
+
const SellProductsCommand = require("./SellProductsCommand");
|
|
27
|
+
|
|
28
|
+
module.exports = {
|
|
29
|
+
SetSceneCommand,
|
|
30
|
+
SetAlarmCommand,
|
|
31
|
+
SetDimmerCommand,
|
|
32
|
+
SetSwitchCommand,
|
|
33
|
+
SetThermostatCommand,
|
|
34
|
+
SetLockCommand,
|
|
35
|
+
SetWindowCoveringCommand,
|
|
36
|
+
SetCourtesyCommand,
|
|
37
|
+
SetMediaCommand,
|
|
38
|
+
OCRDocumentCommand,
|
|
39
|
+
DiscoverUsersCommand,
|
|
40
|
+
CheckInReservationCommand,
|
|
41
|
+
SendSMSCommand,
|
|
42
|
+
SendEmailCommand,
|
|
43
|
+
DiscoverReservationsCommand,
|
|
44
|
+
DiscoverReservationSpaceCategoryAvailabilitiesCommand,
|
|
45
|
+
DiscoverRoomsCommand,
|
|
46
|
+
DiscoverCategoriesCommand,
|
|
47
|
+
CreateShortLinkCommand,
|
|
48
|
+
UpdateReservationCommand,
|
|
49
|
+
UpdateUserCommand,
|
|
50
|
+
GetMobileKeyCommand,
|
|
51
|
+
CreateImageUploadEndpointCommand,
|
|
52
|
+
UploadImageCommand,
|
|
53
|
+
GetProductsCommand,
|
|
54
|
+
SellProductsCommand,
|
|
55
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
const AppError = require("./AppError");
|
|
2
|
+
|
|
3
|
+
module.exports = class AuthenticationError extends AppError {
|
|
4
|
+
constructor(message = "Authentication Error", options = {}) {
|
|
5
|
+
super(message, options);
|
|
6
|
+
this.statusCode = 401;
|
|
7
|
+
Object.setPrototypeOf(this, AuthenticationError.prototype);
|
|
8
|
+
}
|
|
9
|
+
};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
const AppError = require("./AppError");
|
|
2
|
+
|
|
3
|
+
module.exports = class AuthorizationError extends AppError {
|
|
4
|
+
constructor(message = "Authorization Error", options = {}) {
|
|
5
|
+
super(message, options);
|
|
6
|
+
this.statusCode = 403;
|
|
7
|
+
Object.setPrototypeOf(this, AuthorizationError.prototype);
|
|
8
|
+
}
|
|
9
|
+
};
|