105 lines
3.4 KiB
JavaScript
105 lines
3.4 KiB
JavaScript
"use strict";
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
exports.UserService = void 0;
|
|
const request_1 = require("../core/request");
|
|
class UserService {
|
|
/**
|
|
* Get all
|
|
* Lists all users. <br> This includes their groups and permissions granted to them.
|
|
* @param page
|
|
* @param pageSize
|
|
* @returns ResponseUser
|
|
* @throws ApiError
|
|
*/
|
|
static async userControllerGetAll(page, pageSize) {
|
|
const result = await (0, request_1.request)({
|
|
method: 'GET',
|
|
path: `/api/users`,
|
|
query: {
|
|
'page': page,
|
|
'page_size': pageSize,
|
|
},
|
|
});
|
|
return result.body;
|
|
}
|
|
/**
|
|
* Post
|
|
* Create a new user. <br> If you want to grant permissions to the user you have to create them seperately by posting to /api/permissions after creating the user.
|
|
* @param requestBody CreateUser
|
|
* @returns ResponseUser
|
|
* @throws ApiError
|
|
*/
|
|
static async userControllerPost(requestBody) {
|
|
const result = await (0, request_1.request)({
|
|
method: 'POST',
|
|
path: `/api/users`,
|
|
body: requestBody,
|
|
});
|
|
return result.body;
|
|
}
|
|
/**
|
|
* Get one
|
|
* Lists all information about the user whose id got provided. <br> Please remember that all permissions granted to the user will show up here.
|
|
* @param id
|
|
* @returns ResponseUser
|
|
* @throws ApiError
|
|
*/
|
|
static async userControllerGetOne(id) {
|
|
const result = await (0, request_1.request)({
|
|
method: 'GET',
|
|
path: `/api/users/${id}`,
|
|
});
|
|
return result.body;
|
|
}
|
|
/**
|
|
* Put
|
|
* Update the user whose id you provided. <br> To change the permissions directly granted to the user please use /api/permissions instead. <br> Please remember that ids can't be changed.
|
|
* @param id
|
|
* @param requestBody UpdateUser
|
|
* @returns ResponseUser
|
|
* @throws ApiError
|
|
*/
|
|
static async userControllerPut(id, requestBody) {
|
|
const result = await (0, request_1.request)({
|
|
method: 'PUT',
|
|
path: `/api/users/${id}`,
|
|
body: requestBody,
|
|
});
|
|
return result.body;
|
|
}
|
|
/**
|
|
* Remove
|
|
* Delete the user whose id you provided. <br> You have to confirm your decision by providing the ?force=true query param. <br> If there are any permissions directly granted to the user they will get deleted as well. <br> If no user with this id exists it will just return 204(no content).
|
|
* @param id
|
|
* @param force
|
|
* @returns ResponseUser
|
|
* @returns ResponseEmpty
|
|
* @throws ApiError
|
|
*/
|
|
static async userControllerRemove(id, force) {
|
|
const result = await (0, request_1.request)({
|
|
method: 'DELETE',
|
|
path: `/api/users/${id}`,
|
|
query: {
|
|
'force': force,
|
|
},
|
|
});
|
|
return result.body;
|
|
}
|
|
/**
|
|
* Get permissions
|
|
* Lists all permissions granted to the user sorted into directly granted and inherited as permission response objects.
|
|
* @param id
|
|
* @returns ResponseUser
|
|
* @throws ApiError
|
|
*/
|
|
static async userControllerGetPermissions(id) {
|
|
const result = await (0, request_1.request)({
|
|
method: 'GET',
|
|
path: `/api/users/${id}/permissions`,
|
|
});
|
|
return result.body;
|
|
}
|
|
}
|
|
exports.UserService = UserService;
|