@d4l/collect-lib 1.8.0 → 1.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.mts +24 -1
- package/dist/index.d.ts +24 -1
- package/dist/index.js +22 -0
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +22 -0
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -3753,6 +3753,28 @@ var DonationSDK = class {
|
|
|
3753
3753
|
};
|
|
3754
3754
|
});
|
|
3755
3755
|
}
|
|
3756
|
+
/**
|
|
3757
|
+
* Get the total size of donations which can be restored for a specific program
|
|
3758
|
+
* @param donorIdentity The identity of the donor to use
|
|
3759
|
+
* @param programName The name of the program to get the size for
|
|
3760
|
+
* @returns The total size of the donations and the size of each individual donation that can be restored
|
|
3761
|
+
* @throws Error if the donation service is not available or if there is an internal server error
|
|
3762
|
+
*/
|
|
3763
|
+
async getRestorationSize(donorIdentity, programName) {
|
|
3764
|
+
if (!await this.donationServiceAvailable()) {
|
|
3765
|
+
throw new Error("not_online" /* NOT_ONLINE */);
|
|
3766
|
+
}
|
|
3767
|
+
validateProgramName(programName, donorIdentity);
|
|
3768
|
+
let authenticatedDonationAPI = await this.getAuthenticatedDonationAPI(donorIdentity);
|
|
3769
|
+
try {
|
|
3770
|
+
const [response] = await authenticatedDonationAPI.get({
|
|
3771
|
+
uri: `/donations/${programName}/size`
|
|
3772
|
+
});
|
|
3773
|
+
return response;
|
|
3774
|
+
} catch (e) {
|
|
3775
|
+
throw new Error("internal_server_error" /* INTERNAL_SERVER_ERROR */);
|
|
3776
|
+
}
|
|
3777
|
+
}
|
|
3756
3778
|
async restore(donorIdentity, programName) {
|
|
3757
3779
|
if (!await this.donationServiceAvailable()) {
|
|
3758
3780
|
throw new Error("not_online" /* NOT_ONLINE */);
|