This repository has been archived on 2023-11-06. You can view files and clone it, but cannot push or open issues or pull requests.
lfk-client-node/dist/services/TrackService.js
Nicolai Ort f48e6bcfc3
All checks were successful
continuous-integration/drone Build is passing
🚀New lib version v1.0.0 [CI SKIP]
2023-04-18 18:05:50 +00:00

91 lines
2.5 KiB
JavaScript

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.TrackService = void 0;
const request_1 = require("../core/request");
class TrackService {
/**
* Get all
* Lists all tracks.
* @param page
* @param pageSize
* @returns ResponseTrack
* @throws ApiError
*/
static async trackControllerGetAll(page, pageSize) {
const result = await (0, request_1.request)({
method: 'GET',
path: `/api/tracks`,
query: {
'page': page,
'page_size': pageSize,
},
});
return result.body;
}
/**
* Post
* Create a new track. <br> Please remember that the track's distance must be greater than 0.
* @param requestBody CreateTrack
* @returns ResponseTrack
* @throws ApiError
*/
static async trackControllerPost(requestBody) {
const result = await (0, request_1.request)({
method: 'POST',
path: `/api/tracks`,
body: requestBody,
});
return result.body;
}
/**
* Get one
* Lists all information about the track whose id got provided.
* @param id
* @returns ResponseTrack
* @throws ApiError
*/
static async trackControllerGetOne(id) {
const result = await (0, request_1.request)({
method: 'GET',
path: `/api/tracks/${id}`,
});
return result.body;
}
/**
* Put
* Update the track whose id you provided. <br> Please remember that ids can't be changed.
* @param id
* @param requestBody UpdateTrack
* @returns ResponseTrack
* @throws ApiError
*/
static async trackControllerPut(id, requestBody) {
const result = await (0, request_1.request)({
method: 'PUT',
path: `/api/tracks/${id}`,
body: requestBody,
});
return result.body;
}
/**
* Remove
* Delete the track whose id you provided. <br> If no track with this id exists it will just return 204(no content).
* @param id
* @param force
* @returns ResponseTrack
* @returns ResponseEmpty
* @throws ApiError
*/
static async trackControllerRemove(id, force) {
const result = await (0, request_1.request)({
method: 'DELETE',
path: `/api/tracks/${id}`,
query: {
'force': force,
},
});
return result.body;
}
}
exports.TrackService = TrackService;