UNPKG

@marceloclp/monzojs

Version:

Unofficial wrapper for the Monzo API written in TypeScript.

34 lines (33 loc) 1.42 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const endpoints_1 = require("./endpoints"); const endpoints = { getAccounts: endpoints_1.getAccounts, uploadAttachment: endpoints_1.uploadAttachment, registerAttachment: endpoints_1.registerAttachment, deregisterAttachment: endpoints_1.deregisterAttachment, getBalance: endpoints_1.getBalance, createFeedItem: endpoints_1.createFeedItem, getPots: endpoints_1.getPots, depositIntoPot: endpoints_1.depositIntoPot, withdrawFromPot: endpoints_1.withdrawFromPot, getReceipt: endpoints_1.getReceipt, createReceipt: endpoints_1.createReceipt, updateReceipt: endpoints_1.updateReceipt, deleteReceipt: endpoints_1.deleteReceipt, getTransaction: endpoints_1.getTransaction, getTransactions: endpoints_1.getTransactions, annotateTransaction: endpoints_1.annotateTransaction, getWebhooks: endpoints_1.getWebhooks, createWebhook: endpoints_1.createWebhook, deleteWebhook: endpoints_1.deleteWebhook, }; const createCallableEndpoint = (accessToken, endpoint) => (params) => endpoints[endpoint](accessToken, params); function MonzoClient(accessToken) { const callableEndpoints = Object.keys(endpoints).map((name) => [ name, createCallableEndpoint(accessToken, name), ]); return Object.fromEntries(callableEndpoints); } exports.default = MonzoClient;