### Install Project Dependencies Source: https://github.com/withmono/mono-node/blob/main/CONTRIBUTING.md Installs the necessary dependencies for the Mono Node.js project using npm. This is a prerequisite for development. ```sh npm install ``` -------------------------------- ### Install Mono Node.js Library Source: https://github.com/withmono/mono-node/blob/main/README.md Instructions for installing the mono-node package using npm or yarn. This is the first step to integrate Mono's services into your Node.js application. ```sh npm install mono-node --save # or yarn add mono-node ``` -------------------------------- ### Initialize Mono Client and Get Wallet Balance Source: https://github.com/withmono/mono-node/blob/main/README.md Demonstrates how to initialize the Mono client with a secret key and retrieve the wallet balance. It shows basic error handling and result logging. ```js // import the module const { Mono } = require("mono-node"); // set the secret key const monoClient = new Mono({ secretKey: "test_sk_...", }); // get your Mono Wallet balance monoClient.user.walletBalance((err, results) => { // Handle errors if (err) { console.log(err); } if (results){ console.log(results); }; }); ``` -------------------------------- ### Get Financial Institutions Source: https://github.com/withmono/mono-node/blob/main/README.md Fetches the list of available financial institutions supported by Mono. This method requires a callback function to process the results or handle potential errors. ```javascript monoClient.misc.institutions(callback); ``` -------------------------------- ### Mono API Reference Source: https://github.com/withmono/mono-node/blob/main/README.md Comprehensive documentation for Mono API methods available through the Node.js client. This section details each method's purpose, parameters, and usage. ```APIDOC MonoClient: __init__(secretKey: String) secretKey: Your Mono secret key obtained from the dashboard. User Methods: walletBalance(callback: Function) Description: Retrieves the available balance in your Mono wallet. Parameters: callback: A function that receives an error object and the results. Returns: Object containing wallet balance information. Authentication Methods: auth.getAccountId(params: Object, callback: Function) Description: Retrieves the account ID after successful user enrollment via the Mono Connect Widget. Parameters: params: An object containing the 'code' (String) received from the widget. callback: A function that receives an error object and the account ID. Returns: Object containing the account ID. Account Methods: account.unlinkAccount(params: Object, callback: Function) Description: Allows customers to unlink their financial accounts. Parameters: params: An object containing the 'accountId' (String) of the account to unlink. callback: A function that receives an error object and confirmation. Returns: Confirmation of account unlinking. account.getAccountInformation(params: Object, callback: Function) Description: Fetches detailed information about a connected financial account. Parameters: params: An object containing the 'accountId' (String). callback: A function that receives an error object and account details. Returns: Object containing account details. account.getAccountStatement(params: Object, callback: Function) Description: Retrieves bank statements for a connected account. Supports JSON or PDF output and queries 1-12 months of data. Parameters: params: An object containing 'accountId' (String) and 'output' ('json' or 'pdf'). callback: A function that receives an error object and the statement data. Returns: Statement data in the specified format. account.pollPdfAccountStatementStatus(params: Object, callback: Function) Description: Polls the status of a PDF account statement generation job. Parameters: params: An object containing 'accountId' (String) and 'jobId' (String). callback: A function that receives an error object and the job status. Returns: Object indicating the status of the PDF statement job. account.getAccountTransactions(params: Object, callback: Function) Description: Retrieves transactions associated with a connected account. Can filter by transaction type. Parameters: params: An object containing 'accountId' (String) and optionally 'type' (String, e.g., 'credit'). callback: A function that receives an error object and transaction data. Returns: Array of transaction objects. account.getCustomerCredits(params: Object, callback: Function) Description: Fetches historical credit transactions for an account. Parameters: params: An object containing 'accountId' (String). callback: A function that receives an error object and credit data. Returns: Array of credit transaction objects. account.getCustomerDebits(params: Object, callback: Function) Description: Fetches historical debit transactions for an account. Parameters: params: An object containing 'accountId' (String). callback: A function that receives an error object and debit data. Returns: Array of debit transaction objects. account.getIncome(params: Object, callback: Function) Description: Retrieves income-related information for an account. Parameters: params: An object containing 'accountId' (String). callback: A function that receives an error object and income data. Returns: Object containing income information. account.getIdentity(params: Object, callback: Function) Description: Returns a high-level overview of an account's identity data. Parameters: params: An object containing 'accountId' (String). callback: A function that receives an error object and identity data. Returns: Object containing identity overview. account.syncDataManually(params: Object, callback: Function) Description: Initiates a manual synchronization of data for a connected account. Parameters: params: An object containing 'accountId' (String). callback: A function that receives an error object and sync status. Returns: Confirmation of data sync initiation. account.reauthCode(params: Object, callback: Function) Description: Generates a re-authentication code for an account, used to prompt the user for re-authorization. Parameters: params: An object containing 'accountId' (String). callback: A function that receives an error object and the re-auth code. Returns: Object containing the re-authentication code. ``` -------------------------------- ### Mono Node.js API Operations Source: https://github.com/withmono/mono-node/blob/main/README.md Comprehensive documentation for common Mono Node.js API operations, including authentication, account data retrieval, transaction fetching, income estimation, identity verification, data synchronization, re-authentication, and account unlinking. ```APIDOC MonoClient: __init__(apiKey: str) apiKey: Your Mono API key. misc: institutions(callback: function) - Fetches available financial institutions. - Parameters: - callback: Function(err, results) to handle the response. auth: getAccountId({code: str}, callback: function) - Exchanges an authentication code from Mono Connect Widget for an account ID. - Parameters: - code: The authentication code obtained from Mono Connect. - callback: Function(err, results) to handle the response. - Returns: - results.id: The unique account ID. account: getAccountInformation({accountId: str}, callback: function) - Retrieves detailed information for a specific account. - Parameters: - accountId: The ID of the account to retrieve information for. - callback: Function(err, results) to handle the response. - Returns: - results.account: Account details. - results.meta.data_status: Status of data processing (e.g., 'AVAILABLE'). getAccountTransactions({accountId: str, start: str, end: str, paginate: bool}, callback: function) - Fetches transactions for a given account within a specified date range. - Parameters: - accountId: The ID of the account. - start: The start date for fetching transactions (format: 'DD-MM-YYYY'). - end: The end date for fetching transactions (format: 'DD-MM-YYYY'). - paginate: Boolean indicating whether to paginate results. - callback: Function(err, results) to handle the response. - Returns: - results.data: Array of transaction objects. getIncome({accountId: str}, callback: function) - Estimates income for a specified account. - Parameters: - accountId: The ID of the account. - callback: Function(err, results) to handle the response. - Returns: - results.type: Type of income. - results.amount: Estimated income amount. - results.employer: Employer name. getIdentity({accountId: str}, callback: function) - Retrieves identity information for a specified account. - Parameters: - accountId: The ID of the account. - callback: Function(err, results) to handle the response. - Returns: - results.type: Type of identity information. - results.amount: Identity information value. - results.employer: Employer name (if applicable). syncDataManually({accountId: str}, callback: function) - Manually triggers a data synchronization for an account. - Parameters: - accountId: The ID of the account. - callback: Function(err, results) to handle the response. - Returns: - results.status: The status of the data sync operation. reauthCode({accountId: str}, callback: function) - Generates a re-authentication token for an account, valid for 10 minutes. - Parameters: - accountId: The ID of the account. - callback: Function(err, results) to handle the response. - Returns: - results.token: The re-authentication token. unlinkAccount({accountId: str}, callback: function) - Unlinks a bank account from the Mono service. - Parameters: - accountId: The ID of the account to unlink. - callback: Function(err, results) to handle the response. - Returns: - results.message: Confirmation message. Callbacks: function callback(err, results) { // Handle errors if (err) { console.log(err); } // Handle results if (results){ console.log(results); } } Error Handling: The `err` argument passed to the callback is a [Mono API error](https://docs.mono.co/docs/errors). ``` -------------------------------- ### Run Automated Checks Source: https://github.com/withmono/mono-node/blob/main/CONTRIBUTING.md Executes various automated checks for the Mono Node.js project, including type checking with Flow, testing with Jest, linting with ESLint, and code formatting with Prettier. Passing these checks is required for CI builds. ```sh yarn run flow yarn test yarn run lint yarn run prettier ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.