open-banking-pfm-sdk
Version:
The Open Banking PFM SDK uses Client classes and with **Promises** to get responses from the Open Banking PFM API in an easier way and structured as data models.
30 lines (29 loc) • 1.28 kB
JavaScript
;
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
const models_1 = require("../models");
const Client_1 = __importDefault(require("./Client"));
class ConsentsClient extends Client_1.default {
constructor() {
super(...arguments);
this._path = '/consent-management';
this._consents = '/consents';
}
processResponse(response) {
return new models_1.ConsentDetail(response);
}
get(id) {
return this.apiCore.doGet(`${this._path}${this._consents}/${id}`, this.processResponse);
}
delete(id) {
return this.apiCore.doDelete(`${this._path}${this._consents}/${id}/cancel`);
}
getList(userId, filter) {
return this.apiCore.doGet(`${this._path}${this._consents}?userId=${userId}${(filter === null || filter === void 0 ? void 0 : filter.type) ? `&type=${filter.type}` : ''}${(filter === null || filter === void 0 ? void 0 : filter.status) ? `&status=${filter.status}` : ''}`, (response) => {
return response.consents.map((consentData) => new models_1.Consent(consentData));
});
}
}
exports.default = ConsentsClient;