lfk-client-js/dist/services/DonationService.js
Nicolai Ort ad90844846
All checks were successful
continuous-integration/drone Build is passing
Fresh dist
2023-02-02 16:14:10 +01:00

116 lines
4.0 KiB
JavaScript

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.DonationService = void 0;
const request_1 = require("../core/request");
class DonationService {
/**
* Get all
* Lists all donations (fixed or distance based) from all donors. <br> This includes the donations's runner's distance ran(if distance donation).
* @returns any
* @throws ApiError
*/
static async donationControllerGetAll() {
const result = await (0, request_1.request)({
method: 'GET',
path: `/api/donations`,
});
return result.body;
}
/**
* Get one
* Lists all information about the donation whose id got provided. This includes the donation's runner's distance ran (if distance donation).
* @param id
* @returns any
* @throws ApiError
*/
static async donationControllerGetOne(id) {
const result = await (0, request_1.request)({
method: 'GET',
path: `/api/donations/${id}`,
});
return result.body;
}
/**
* Remove
* Delete the donation whose id you provided. <br> If no donation with this id exists it will just return 204(no content).
* @param id
* @param force
* @returns any
* @returns ResponseEmpty
* @throws ApiError
*/
static async donationControllerRemove(id, force) {
const result = await (0, request_1.request)({
method: 'DELETE',
path: `/api/donations/${id}`,
query: {
'force': force,
},
});
return result.body;
}
/**
* Post fixed
* Create a fixed donation (not distance donation - use /donations/distance instead). <br> Please rmemember to provide the donation's donors's id and amount.
* @param requestBody CreateFixedDonation
* @returns ResponseDonation
* @throws ApiError
*/
static async donationControllerPostFixed(requestBody) {
const result = await (0, request_1.request)({
method: 'POST',
path: `/api/donations/fixed`,
body: requestBody,
});
return result.body;
}
/**
* Post distance
* Create a distance donation (not fixed donation - use /donations/fixed instead). <br> Please rmemember to provide the donation's donors's and runners ids and amount per distance (kilometer).
* @param requestBody CreateDistanceDonation
* @returns ResponseDistanceDonation
* @throws ApiError
*/
static async donationControllerPostDistance(requestBody) {
const result = await (0, request_1.request)({
method: 'POST',
path: `/api/donations/distance`,
body: requestBody,
});
return result.body;
}
/**
* Put fixed
* Update the fixed donation (not distance donation - use /donations/distance instead) whose id you provided. <br> Please remember that ids can't be changed and amounts must be positive.
* @param id
* @param requestBody UpdateFixedDonation
* @returns ResponseDonation
* @throws ApiError
*/
static async donationControllerPutFixed(id, requestBody) {
const result = await (0, request_1.request)({
method: 'PUT',
path: `/api/donations/fixed/${id}`,
body: requestBody,
});
return result.body;
}
/**
* Put distance
* Update the distance donation (not fixed donation - use /donations/fixed instead) whose id you provided. <br> Please remember that ids can't be changed and amountPerDistance must be positive.
* @param id
* @param requestBody UpdateDistanceDonation
* @returns ResponseDonation
* @throws ApiError
*/
static async donationControllerPutDistance(id, requestBody) {
const result = await (0, request_1.request)({
method: 'PUT',
path: `/api/donations/distance/${id}`,
body: requestBody,
});
return result.body;
}
}
exports.DonationService = DonationService;