Initial commit for the js version
This commit is contained in:
80
dist/services/TrackService.js
vendored
Normal file
80
dist/services/TrackService.js
vendored
Normal file
@@ -0,0 +1,80 @@
|
||||
"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.
|
||||
* @result ResponseTrack
|
||||
* @throws ApiError
|
||||
*/
|
||||
static async trackControllerGetAll() {
|
||||
const result = await request_1.request({
|
||||
method: 'GET',
|
||||
path: `/api/tracks`,
|
||||
});
|
||||
return result.body;
|
||||
}
|
||||
/**
|
||||
* Post
|
||||
* Create a new track object (id will be generated automagicly).
|
||||
* @param requestBody CreateTrack
|
||||
* @result ResponseTrack
|
||||
* @throws ApiError
|
||||
*/
|
||||
static async trackControllerPost(requestBody) {
|
||||
const result = await request_1.request({
|
||||
method: 'POST',
|
||||
path: `/api/tracks`,
|
||||
body: requestBody,
|
||||
});
|
||||
return result.body;
|
||||
}
|
||||
/**
|
||||
* Get one
|
||||
* Returns a track of a specified id (if it exists)
|
||||
* @param id
|
||||
* @result ResponseTrack
|
||||
* @throws ApiError
|
||||
*/
|
||||
static async trackControllerGetOne(id) {
|
||||
const result = await request_1.request({
|
||||
method: 'GET',
|
||||
path: `/api/tracks/${id}`,
|
||||
});
|
||||
return result.body;
|
||||
}
|
||||
/**
|
||||
* Put
|
||||
* Update a track object (id can't be changed).
|
||||
* @param id
|
||||
* @param requestBody Track
|
||||
* @result ResponseTrack
|
||||
* @throws ApiError
|
||||
*/
|
||||
static async trackControllerPut(id, requestBody) {
|
||||
const result = await request_1.request({
|
||||
method: 'PUT',
|
||||
path: `/api/tracks/${id}`,
|
||||
body: requestBody,
|
||||
});
|
||||
return result.body;
|
||||
}
|
||||
/**
|
||||
* Remove
|
||||
* Delete a specified track (if it exists).
|
||||
* @param id
|
||||
* @result ResponseTrack
|
||||
* @result ResponseEmpty
|
||||
* @throws ApiError
|
||||
*/
|
||||
static async trackControllerRemove(id) {
|
||||
const result = await request_1.request({
|
||||
method: 'DELETE',
|
||||
path: `/api/tracks/${id}`,
|
||||
});
|
||||
return result.body;
|
||||
}
|
||||
}
|
||||
exports.TrackService = TrackService;
|
||||
Reference in New Issue
Block a user