@dodi-smart/nuki-graphql-api
Version: 
Nuki GraphQL API
208 lines • 6.59 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.SmartlockAuthService = void 0;
class SmartlockAuthService {
    constructor(httpRequest) {
        this.httpRequest = httpRequest;
    }
    /**
     * Get a list of smartlock authorizations for your smartlocks
     * @param accountUserId Filter for account users:  set to a positive number will filter for authorizations with this specific accountUserId, set to a negative number will filter without set accountUserId
     * @param types Filter for authorization's types (comma-separated eg: 0,2,3)
     * @returns SmartlockAuth successful operation
     * @throws ApiError
     */
    getSmartlocksAuths(accountUserId, types) {
        return this.httpRequest.request({
            method: 'GET',
            url: '/smartlock/auth',
            query: {
                'accountUserId': accountUserId,
                'types': types,
            },
            errors: {
                401: `Not authorized`,
            },
        });
    }
    /**
     * Creates asynchronous smartlock authorizations
     * @param requestBody Smartlock authorization create representation
     * @returns void
     * @throws ApiError
     */
    createSmartlocksAuth(requestBody) {
        return this.httpRequest.request({
            method: 'PUT',
            url: '/smartlock/auth',
            body: requestBody,
            mediaType: '*/*',
            errors: {
                400: `Bad parameter`,
                402: `Account not payed`,
                409: `Parameter conflicts`,
                426: `Account upgrade required`,
            },
        });
    }
    /**
     * Updates smartlock authorizations asynchronously
     * @param requestBody Smartlock authorization update representations
     * @returns void
     * @throws ApiError
     */
    updateSmartlocksAuth(requestBody) {
        return this.httpRequest.request({
            method: 'POST',
            url: '/smartlock/auth',
            body: requestBody,
            mediaType: '*/*',
            errors: {
                400: `Bad parameter`,
                401: `Not authorized`,
                403: `Forbidden`,
                409: `Parameter conflicts`,
                423: `Locked`,
            },
        });
    }
    /**
     * Deletes smartlock authorizations asynchronously
     * @param requestBody Smartlock authorization IDs to delete
     * @returns void
     * @throws ApiError
     */
    deleteSmartlocksAuth(requestBody) {
        return this.httpRequest.request({
            method: 'DELETE',
            url: '/smartlock/auth',
            body: requestBody,
            mediaType: '*/*',
            errors: {
                400: `Bad parameter`,
                401: `Not authorized`,
                403: `Forbidden`,
                423: `Locked`,
            },
        });
    }
    /**
     * Get a list of smartlock authorizations
     * @param smartlockId The smartlock id
     * @param types Filter for smartlock authorization's types (comma-separated eg: 0,2,3)
     * @returns SmartlockAuth successful operation
     * @throws ApiError
     */
    getSmartlockAuths(smartlockId, types) {
        return this.httpRequest.request({
            method: 'GET',
            url: '/smartlock/{smartlockId}/auth',
            path: {
                'smartlockId': smartlockId,
            },
            query: {
                'types': types,
            },
            errors: {
                401: `Not authorized`,
                403: `Forbidden`,
            },
        });
    }
    /**
     * Creates asynchronous a smartlock authorization
     * @param smartlockId The smartlock id
     * @param requestBody Smartlock authorization create representation
     * @returns void
     * @throws ApiError
     */
    createSmartlockAuth(smartlockId, requestBody) {
        return this.httpRequest.request({
            method: 'PUT',
            url: '/smartlock/{smartlockId}/auth',
            path: {
                'smartlockId': smartlockId,
            },
            body: requestBody,
            mediaType: '*/*',
            errors: {
                400: `Bad parameter`,
                402: `Account not payed`,
                409: `Parameter conflicts`,
                426: `Account upgrade required`,
            },
        });
    }
    /**
     * Get a smartlock authorization
     * @param smartlockId The smartlock id
     * @param id The smartlock auth unique id
     * @returns SmartlockAuth successful operation
     * @throws ApiError
     */
    getSmartlockAuth(smartlockId, id) {
        return this.httpRequest.request({
            method: 'GET',
            url: '/smartlock/{smartlockId}/auth/{id}',
            path: {
                'smartlockId': smartlockId,
                'id': id,
            },
            errors: {
                401: `Not authorized`,
                403: `Forbidden`,
            },
        });
    }
    /**
     * Updates asynchronous a smartlock authorization
     * @param smartlockId The smartlock id
     * @param id The smartlock authorization unique id
     * @param requestBody Smartlock authorization update representation
     * @returns void
     * @throws ApiError
     */
    updateSmartlockAuth(smartlockId, id, requestBody) {
        return this.httpRequest.request({
            method: 'POST',
            url: '/smartlock/{smartlockId}/auth/{id}',
            path: {
                'smartlockId': smartlockId,
                'id': id,
            },
            body: requestBody,
            mediaType: '*/*',
            errors: {
                400: `Bad parameter`,
                401: `Not authorized`,
                403: `Forbidden`,
                409: `Parameter conflicts`,
                423: `Locked`,
            },
        });
    }
    /**
     * Deletes asynchronous a smartlock authorization
     * @param smartlockId The smartlock id
     * @param id The smartlock authorization unique id
     * @returns void
     * @throws ApiError
     */
    deleteSmartlockAuth(smartlockId, id) {
        return this.httpRequest.request({
            method: 'DELETE',
            url: '/smartlock/{smartlockId}/auth/{id}',
            path: {
                'smartlockId': smartlockId,
                'id': id,
            },
            errors: {
                401: `Not authorized`,
                403: `Forbidden`,
                423: `Locked`,
            },
        });
    }
}
exports.SmartlockAuthService = SmartlockAuthService;
//# sourceMappingURL=SmartlockAuthService.js.map