lfk-client-js/dist/services/PermissionService.js
Nicolai Ort 9b6d686d93
All checks were successful
continuous-integration/drone Build is passing
🚀New lib version v0.13.1 [CI SKIP]
2023-02-02 15:19:00 +00:00

85 lines
2.8 KiB
JavaScript

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.PermissionService = void 0;
const request_1 = require("../core/request");
class PermissionService {
/**
* Get all
* Lists all permissions for all users and groups.
* @result ResponsePermission
* @throws ApiError
*/
static async permissionControllerGetAll() {
const result = await (0, request_1.request)({
method: 'GET',
path: `/api/permissions`,
});
return result.body;
}
/**
* Post
* Create a new permission for a existing principal(user/group). <br> If a permission with this target, action and prinicpal already exists that permission will be returned instead of creating a new one.
* @param requestBody CreatePermission
* @result ResponsePermission
* @throws ApiError
*/
static async permissionControllerPost(requestBody) {
const result = await (0, request_1.request)({
method: 'POST',
path: `/api/permissions`,
body: requestBody,
});
return result.body;
}
/**
* Get one
* Lists all information about the permission whose id got provided.
* @param id
* @result ResponsePermission
* @throws ApiError
*/
static async permissionControllerGetOne(id) {
const result = await (0, request_1.request)({
method: 'GET',
path: `/api/permissions/${id}`,
});
return result.body;
}
/**
* Put
* Update a permission object. <br> If updateing the permission object would result in duplicate permission (same target, action and principal) this permission will get deleted and the existing permission will be returned. <br> Please remember that ids can't be changed.
* @param id
* @param requestBody UpdatePermission
* @result ResponsePrincipal
* @throws ApiError
*/
static async permissionControllerPut(id, requestBody) {
const result = await (0, request_1.request)({
method: 'PUT',
path: `/api/permissions/${id}`,
body: requestBody,
});
return result.body;
}
/**
* Remove
* Deletes the permission whose id you provide. <br> If no permission with this id exists it will just return 204(no content).
* @param id
* @param force
* @result ResponsePermission
* @result ResponseEmpty
* @throws ApiError
*/
static async permissionControllerRemove(id, force) {
const result = await (0, request_1.request)({
method: 'DELETE',
path: `/api/permissions/${id}`,
query: {
'force': force,
},
});
return result.body;
}
}
exports.PermissionService = PermissionService;