UNPKG

@mft/moneyhub-api-client

Version:
29 lines 1.41 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = ({ config, request }) => { const { resourceServerUrl } = config; const BENEFICIARIES_READ_SCOPE = "beneficiaries:read"; const BENEFICIARIES_DETAIL_READ_SCOPE = "beneficiaries_detail:read"; const getOneBeneficiary = ({ id, userId, scope, }, options) => request(`${resourceServerUrl}/beneficiaries/${id}`, { cc: { sub: userId, scope, }, options, }); const getAllBeneficiaries = ({ params, userId, scope, }, options) => request(`${resourceServerUrl}/beneficiaries`, { searchParams: params, cc: { sub: userId, scope, }, options, }); return { getBeneficiary: ({ id, userId }, options) => getOneBeneficiary({ id, userId, scope: BENEFICIARIES_READ_SCOPE }, options), getBeneficiaryWithDetail: ({ id, userId }, options) => getOneBeneficiary({ id, userId, scope: BENEFICIARIES_DETAIL_READ_SCOPE }, options), getBeneficiaries: ({ userId, params = {} }, options) => getAllBeneficiaries({ params, userId, scope: BENEFICIARIES_READ_SCOPE }, options), getBeneficiariesWithDetail: ({ userId, params = {} }, options) => getAllBeneficiaries({ params, userId, scope: BENEFICIARIES_DETAIL_READ_SCOPE }, options), }; }; //# sourceMappingURL=beneficiaries.js.map