91 lines
2.7 KiB
JavaScript
91 lines
2.7 KiB
JavaScript
"use strict";
|
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
exports.DonorService = void 0;
|
|
const request_1 = require("../core/request");
|
|
class DonorService {
|
|
/**
|
|
* Get all
|
|
* Lists all donor. <br> This includes the donor's current donation amount.
|
|
* @param page
|
|
* @param pageSize
|
|
* @result ResponseDonor
|
|
* @throws ApiError
|
|
*/
|
|
static async donorControllerGetAll(page, pageSize) {
|
|
const result = await (0, request_1.request)({
|
|
method: 'GET',
|
|
path: `/api/donors`,
|
|
query: {
|
|
'page': page,
|
|
'page_size': pageSize,
|
|
},
|
|
});
|
|
return result.body;
|
|
}
|
|
/**
|
|
* Post
|
|
* Create a new donor.
|
|
* @param requestBody CreateDonor
|
|
* @result ResponseDonor
|
|
* @throws ApiError
|
|
*/
|
|
static async donorControllerPost(requestBody) {
|
|
const result = await (0, request_1.request)({
|
|
method: 'POST',
|
|
path: `/api/donors`,
|
|
body: requestBody,
|
|
});
|
|
return result.body;
|
|
}
|
|
/**
|
|
* Get one
|
|
* Lists all information about the donor whose id got provided. <br> This includes the donor's current donation amount.
|
|
* @param id
|
|
* @result ResponseDonor
|
|
* @throws ApiError
|
|
*/
|
|
static async donorControllerGetOne(id) {
|
|
const result = await (0, request_1.request)({
|
|
method: 'GET',
|
|
path: `/api/donors/${id}`,
|
|
});
|
|
return result.body;
|
|
}
|
|
/**
|
|
* Put
|
|
* Update the donor whose id you provided. <br> Please remember that ids can't be changed.
|
|
* @param id
|
|
* @param requestBody UpdateDonor
|
|
* @result ResponseDonor
|
|
* @throws ApiError
|
|
*/
|
|
static async donorControllerPut(id, requestBody) {
|
|
const result = await (0, request_1.request)({
|
|
method: 'PUT',
|
|
path: `/api/donors/${id}`,
|
|
body: requestBody,
|
|
});
|
|
return result.body;
|
|
}
|
|
/**
|
|
* Remove
|
|
* Delete the donor whose id you provided. <br> If no donor with this id exists it will just return 204(no content). <br> If the donor still has donations associated this will fail, please provide the query param ?force=true to delete the donor with all associated donations.
|
|
* @param id
|
|
* @param force
|
|
* @result ResponseDonor
|
|
* @result ResponseEmpty
|
|
* @throws ApiError
|
|
*/
|
|
static async donorControllerRemove(id, force) {
|
|
const result = await (0, request_1.request)({
|
|
method: 'DELETE',
|
|
path: `/api/donors/${id}`,
|
|
query: {
|
|
'force': force,
|
|
},
|
|
});
|
|
return result.body;
|
|
}
|
|
}
|
|
exports.DonorService = DonorService;
|