81 lines
2.0 KiB
JavaScript
81 lines
2.0 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.
|
|
* @result User
|
|
* @throws ApiError
|
|
*/
|
|
static async userControllerGetAll() {
|
|
const result = await request_1.request({
|
|
method: 'GET',
|
|
path: `/api/users`,
|
|
});
|
|
return result.body;
|
|
}
|
|
/**
|
|
* Post
|
|
* Create a new user object (id will be generated automagicly).
|
|
* @param requestBody CreateUser
|
|
* @result any
|
|
* @throws ApiError
|
|
*/
|
|
static async userControllerPost(requestBody) {
|
|
const result = await request_1.request({
|
|
method: 'POST',
|
|
path: `/api/users`,
|
|
body: requestBody,
|
|
});
|
|
return result.body;
|
|
}
|
|
/**
|
|
* Get one
|
|
* Returns a user of a specified id (if it exists)
|
|
* @param id
|
|
* @result User
|
|
* @throws ApiError
|
|
*/
|
|
static async userControllerGetOne(id) {
|
|
const result = await request_1.request({
|
|
method: 'GET',
|
|
path: `/api/users/${id}`,
|
|
});
|
|
return result.body;
|
|
}
|
|
/**
|
|
* Put
|
|
* Update a user object (id can't be changed).
|
|
* @param id
|
|
* @param requestBody User
|
|
* @result User
|
|
* @throws ApiError
|
|
*/
|
|
static async userControllerPut(id, requestBody) {
|
|
const result = await request_1.request({
|
|
method: 'PUT',
|
|
path: `/api/users/${id}`,
|
|
body: requestBody,
|
|
});
|
|
return result.body;
|
|
}
|
|
/**
|
|
* Remove
|
|
* Delete a specified runner (if it exists).
|
|
* @param id
|
|
* @result User
|
|
* @result ResponseEmpty
|
|
* @throws ApiError
|
|
*/
|
|
static async userControllerRemove(id) {
|
|
const result = await request_1.request({
|
|
method: 'DELETE',
|
|
path: `/api/users/${id}`,
|
|
});
|
|
return result.body;
|
|
}
|
|
}
|
|
exports.UserService = UserService;
|