homebridge-config-ui-x
Version:
A web based management, configuration and control platform for Homebridge.
89 lines • 4.04 kB
JavaScript
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
return c > 3 && r && Object.defineProperty(target, key, r), r;
};
var __metadata = (this && this.__metadata) || function (k, v) {
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
};
var __param = (this && this.__param) || function (paramIndex, decorator) {
return function (target, key) { decorator(target, key, paramIndex); }
};
import { Body, Controller, Get, Inject, Param, Put, Request, UseGuards, } from '@nestjs/common';
import { AuthGuard } from '@nestjs/passport';
import { ApiBearerAuth, ApiOperation, ApiParam, ApiTags } from '@nestjs/swagger';
import { AccessorySetCharacteristicDto } from './accessories.dto.js';
import { AccessoriesService } from './accessories.service.js';
let AccessoriesController = class AccessoriesController {
accessoriesService;
constructor(accessoriesService) {
this.accessoriesService = accessoriesService;
}
getAccessories() {
return this.accessoriesService.loadAccessories();
}
getAccessoryLayout(req) {
return this.accessoriesService.getAccessoryLayout(req.user.username);
}
getAccessory(uniqueId) {
return this.accessoriesService.getAccessory(uniqueId);
}
setAccessoryCharacteristic(uniqueId, body) {
return this.accessoriesService.setAccessoryCharacteristic(uniqueId, body.characteristicType, body.value);
}
};
__decorate([
ApiOperation({
summary: 'Return a list of Homebridge accessories.',
description: 'Homebridge must be running in `insecure` mode to access the accessory list.',
}),
Get('/'),
__metadata("design:type", Function),
__metadata("design:paramtypes", []),
__metadata("design:returntype", void 0)
], AccessoriesController.prototype, "getAccessories", null);
__decorate([
ApiOperation({
summary: 'Get the accessory and room layout for the authenticating user.',
}),
Get('/layout'),
__param(0, Request()),
__metadata("design:type", Function),
__metadata("design:paramtypes", [Object]),
__metadata("design:returntype", void 0)
], AccessoriesController.prototype, "getAccessoryLayout", null);
__decorate([
ApiOperation({
summary: 'Get a single accessory and refresh its characteristics.',
description: 'Get the `uniqueId` from `GET /api/accessories`.',
}),
Get('/:uniqueId'),
__param(0, Param('uniqueId')),
__metadata("design:type", Function),
__metadata("design:paramtypes", [String]),
__metadata("design:returntype", void 0)
], AccessoriesController.prototype, "getAccessory", null);
__decorate([
ApiOperation({
summary: 'Set the value of an accessory characteristic.',
description: 'Get the `uniqueId` and `characteristicType` values from `GET /api/accessories`.',
}),
ApiParam({ name: 'uniqueId' }),
Put('/:uniqueId'),
__param(0, Param('uniqueId')),
__param(1, Body()),
__metadata("design:type", Function),
__metadata("design:paramtypes", [Object, AccessorySetCharacteristicDto]),
__metadata("design:returntype", void 0)
], AccessoriesController.prototype, "setAccessoryCharacteristic", null);
AccessoriesController = __decorate([
ApiTags('Accessories'),
ApiBearerAuth(),
UseGuards(AuthGuard()),
Controller('accessories'),
__param(0, Inject(AccessoriesService)),
__metadata("design:paramtypes", [AccessoriesService])
], AccessoriesController);
export { AccessoriesController };
//# sourceMappingURL=accessories.controller.js.map