lfk-client-js/dist/services/DonationService.js
Nicolai Ort f4905b8df6
All checks were successful
continuous-integration/drone Build is passing
🚀New lib version v1.0.0 [CI SKIP]
2023-04-18 18:05:41 +00:00

122 lines
4.2 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).
* @param page
* @param pageSize
* @result any
* @throws ApiError
*/
static async donationControllerGetAll(page, pageSize) {
const result = await (0, request_1.request)({
method: 'GET',
path: `/api/donations`,
query: {
'page': page,
'page_size': pageSize,
},
});
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
* @result 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
* @result any
* @result 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
* @result 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
* @result 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
* @result 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
* @result 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;