@adyen/api-library
Version:
The Adyen API Library for NodeJS enables you to work with Adyen APIs.
70 lines • 3.25 kB
JavaScript
;
/*
* The version of the OpenAPI document: v2
*
*
* NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
* https://openapi-generator.tech
* Do not edit this class manually.
*/
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.GrantOffersApi = void 0;
const getJsonResponse_1 = __importDefault(require("../../helpers/getJsonResponse"));
const service_1 = __importDefault(require("../../service"));
const resource_1 = __importDefault(require("../resource"));
const objectSerializer_1 = require("../../typings/balancePlatform/objectSerializer");
/**
* API handler for GrantOffersApi
*/
class GrantOffersApi extends service_1.default {
constructor(client) {
super(client);
this.API_BASEPATH = "https://balanceplatform-api-test.adyen.com/bcl/v2";
this.baseUrl = this.createBaseUrl(this.API_BASEPATH);
}
/**
* @summary Get all available grant offers
* @param requestOptions {@link IRequest.Options }
* @param accountHolderId {@link string } (Required) The unique identifier of the grant account.
* @return {@link GrantOffers }
*
* @deprecated since Configuration API v2
* Use the `/grantOffers` endpoint from the [Capital API](https://docs.adyen.com/api-explorer/capital/latest/get/grantOffers) instead.
*/
async getAllAvailableGrantOffers(accountHolderId, requestOptions) {
const endpoint = `${this.baseUrl}/grantOffers`;
const resource = new resource_1.default(this, endpoint);
const hasDefinedQueryParams = accountHolderId;
if (hasDefinedQueryParams) {
if (!requestOptions)
requestOptions = {};
if (!requestOptions.params)
requestOptions.params = {};
if (accountHolderId)
requestOptions.params["accountHolderId"] = accountHolderId;
}
const response = await (0, getJsonResponse_1.default)(resource, "", { ...requestOptions, method: "GET" });
return objectSerializer_1.ObjectSerializer.deserialize(response, "GrantOffers");
}
/**
* @summary Get a grant offer
* @param grantOfferId {@link string } The unique identifier of the grant offer.
* @param requestOptions {@link IRequest.Options }
* @return {@link GrantOffer }
*
* @deprecated since Configuration API v2
* Use the `/grantOffers/{id}` endpoint from the [Capital API](https://docs.adyen.com/api-explorer/capital/latest/get/grantOffers/(id)) instead.
*/
async getGrantOffer(grantOfferId, requestOptions) {
const endpoint = `${this.baseUrl}/grantOffers/{grantOfferId}`
.replace("{" + "grantOfferId" + "}", encodeURIComponent(String(grantOfferId)));
const resource = new resource_1.default(this, endpoint);
const response = await (0, getJsonResponse_1.default)(resource, "", { ...requestOptions, method: "GET" });
return objectSerializer_1.ObjectSerializer.deserialize(response, "GrantOffer");
}
}
exports.GrantOffersApi = GrantOffersApi;
//# sourceMappingURL=grantOffersApi.js.map