lfk-client-js/dist/services/RunnerOrganizationService.js

109 lines
3.7 KiB
JavaScript

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.RunnerOrganizationService = void 0;
const request_1 = require("../core/request");
class RunnerOrganizationService {
/**
* Get all
* Lists all organizations. <br> This includes their address, contact and teams (if existing/associated).
* @param page
* @param pageSize
* @result ResponseRunnerOrganization
* @throws ApiError
*/
static async runnerOrganizationControllerGetAll(page, pageSize) {
const result = await (0, request_1.request)({
method: 'GET',
path: `/api/organizations`,
query: {
'page': page,
'page_size': pageSize,
},
});
return result.body;
}
/**
* Post
* Create a new organsisation.
* @param requestBody CreateRunnerOrganization
* @result ResponseRunnerOrganization
* @throws ApiError
*/
static async runnerOrganizationControllerPost(requestBody) {
const result = await (0, request_1.request)({
method: 'POST',
path: `/api/organizations`,
body: requestBody,
});
return result.body;
}
/**
* Get one
* Lists all information about the organization whose id got provided.
* @param id
* @result ResponseRunnerOrganization
* @throws ApiError
*/
static async runnerOrganizationControllerGetOne(id) {
const result = await (0, request_1.request)({
method: 'GET',
path: `/api/organizations/${id}`,
});
return result.body;
}
/**
* Put
* Update the organization whose id you provided. <br> Please remember that ids can't be changed.
* @param id
* @param requestBody UpdateRunnerOrganization
* @result ResponseRunnerOrganization
* @throws ApiError
*/
static async runnerOrganizationControllerPut(id, requestBody) {
const result = await (0, request_1.request)({
method: 'PUT',
path: `/api/organizations/${id}`,
body: requestBody,
});
return result.body;
}
/**
* Remove
* Delete the organsisation whose id you provided. <br> If the organization still has runners and/or teams associated this will fail. <br> To delete the organization with all associated runners and teams set the force QueryParam to true (cascading deletion might take a while). <br> This won't delete the associated contact. <br> If no organization with this id exists it will just return 204(no content).
* @param id
* @param force
* @result ResponseRunnerOrganization
* @result ResponseEmpty
* @throws ApiError
*/
static async runnerOrganizationControllerRemove(id, force) {
const result = await (0, request_1.request)({
method: 'DELETE',
path: `/api/organizations/${id}`,
query: {
'force': force,
},
});
return result.body;
}
/**
* Get runners
* Lists all runners from this org and it's teams (if you don't provide the ?onlyDirect=true param). <br> This includes the runner's group and distance ran.
* @param id
* @param onlyDirect
* @result ResponseRunner
* @throws ApiError
*/
static async runnerOrganizationControllerGetRunners(id, onlyDirect) {
const result = await (0, request_1.request)({
method: 'GET',
path: `/api/organizations/${id}/runners`,
query: {
'onlyDirect': onlyDirect,
},
});
return result.body;
}
}
exports.RunnerOrganizationService = RunnerOrganizationService;