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/ScanService.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

122 lines
3.9 KiB
JavaScript

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.ScanService = void 0;
const request_1 = require("../core/request");
class ScanService {
/**
* Get all
* Lists all scans (normal or track) from all runners. <br> This includes the scan's runner's distance ran.
* @param page
* @param pageSize
* @returns any
* @throws ApiError
*/
static async scanControllerGetAll(page, pageSize) {
const result = await (0, request_1.request)({
method: 'GET',
path: `/api/scans`,
query: {
'page': page,
'page_size': pageSize,
},
});
return result.body;
}
/**
* Post
* Create a new scan (not track scan - use /scans/trackscans instead). <br> Please rmemember to provide the scan's runner's id and distance.
* @param requestBody CreateScan
* @returns ResponseScan
* @throws ApiError
*/
static async scanControllerPost(requestBody) {
const result = await (0, request_1.request)({
method: 'POST',
path: `/api/scans`,
body: requestBody,
});
return result.body;
}
/**
* Get one
* Lists all information about the scan whose id got provided. This includes the scan's runner's distance ran.
* @param id
* @returns any
* @throws ApiError
*/
static async scanControllerGetOne(id) {
const result = await (0, request_1.request)({
method: 'GET',
path: `/api/scans/${id}`,
});
return result.body;
}
/**
* Put
* Update the scan (not track scan use /scans/trackscans/:id instead) whose id you provided. <br> Please remember that ids can't be changed and distances must be positive.
* @param id
* @param requestBody UpdateScan
* @returns ResponseScan
* @throws ApiError
*/
static async scanControllerPut(id, requestBody) {
const result = await (0, request_1.request)({
method: 'PUT',
path: `/api/scans/${id}`,
body: requestBody,
});
return result.body;
}
/**
* Remove
* Delete the scan whose id you provided. <br> If no scan with this id exists it will just return 204(no content).
* @param id
* @param force
* @returns ResponseScan
* @returns ResponseEmpty
* @throws ApiError
*/
static async scanControllerRemove(id, force) {
const result = await (0, request_1.request)({
method: 'DELETE',
path: `/api/scans/${id}`,
query: {
'force': force,
},
});
return result.body;
}
/**
* Post track scans
* Create a new track scan (for "normal" scans use /scans instead). <br> Please remember that to provide the scan's card's station's id.
* @param requestBody CreateTrackScan
* @returns ResponseTrackScan
* @throws ApiError
*/
static async scanControllerPostTrackScans(requestBody) {
const result = await (0, request_1.request)({
method: 'POST',
path: `/api/scans/trackscans`,
body: requestBody,
});
return result.body;
}
/**
* Put track scan
* Update the track scan (not "normal" scan use /scans/trackscans/:id instead) whose id you provided. <br> Please remember that only the validity, runner and track can be changed.
* @param id
* @param requestBody UpdateTrackScan
* @returns ResponseTrackScan
* @throws ApiError
*/
static async scanControllerPutTrackScan(id, requestBody) {
const result = await (0, request_1.request)({
method: 'PUT',
path: `/api/scans/trackscans/${id}`,
body: requestBody,
});
return result.body;
}
}
exports.ScanService = ScanService;