UNPKG

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.

23 lines (22 loc) 1.09 kB
"use strict"; 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 UsersClient extends Client_1.default { processResponse(response) { return new models_1.UserDetail(response); } get(id) { return this.apiCore.doGet(`/open-finances/users/${id}`, this.processResponse); } getFinancialEntities(isBankAggregation) { let params = ''; if (isBankAggregation !== undefined && isBankAggregation !== null) params = `?isBankAggregation=${isBankAggregation ? 'true' : 'false'}`; return this.apiCore.doGet(`/open-finances/financialEntities${params}`, (response) => response.map((financialEntity) => new models_1.FinancialEntity(Object.assign(Object.assign({}, financialEntity), { imagePath: this.assetsUrl + financialEntity.imagePath })))); } } exports.default = UsersClient;