npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

upbanking-ts

v1.0.0

Published

TypeScript SDK for the Up Banking API

Downloads

4

Readme

Up Banking SDK

A TypeScript SDK for easy integration with the Up Banking API. This SDK provides a simple and intuitive interface to access Up's financial services, including account management, transaction tracking, and more.

Installation

npm install upbanking-ts

Quick Start

import { UpBankingSDK } from 'upbanking-ts';

const upSdk = new UpBankingSDK('YOUR_API_KEY');

// List all accounts
const accounts = await upSdk.accounts.list();
console.log(accounts);

API Documentation

Accounts

List Accounts

Retrieves a list of all accounts.

const accounts = await upSdk.accounts.list(params?: ListAccountsParams);

Parameters:

  • params (optional): An object containing filter and pagination options.
    • page[size]: Number of results per page.
    • filter[accountType]: Filter by account type ('SAVER', 'TRANSACTIONAL', or 'HOME_LOAN').
    • filter[ownershipType]: Filter by ownership type ('INDIVIDUAL' or 'JOINT').

Get Account

Retrieves details of a specific account.

const account = await upSdk.accounts.get(accountId: string);

Transactions

List Transactions

Retrieves a list of all transactions.

const transactions = await upSdk.transactions.list(params?: ListTransactionsParams);

Parameters:

  • params (optional): An object containing filter and pagination options.
    • page[size]: Number of results per page.
    • filter[status]: Filter by status ('HELD' or 'SETTLED').
    • filter[since]: Filter transactions after this date.
    • filter[until]: Filter transactions before this date.
    • filter[category]: Filter by category ID.
    • filter[tag]: Filter by tag.

Get Transaction

Retrieves details of a specific transaction.

const transaction = await upSdk.transactions.get(transactionId: string);

List Transactions for Account

Retrieves transactions for a specific account.

const transactions = await upSdk.transactions.listForAccount(accountId: string, params?: ListTransactionsParams);

Add Tags to Transaction

Adds tags to a transaction.

await upSdk.transactions.addTags(transactionId: string, tags: TagInputResource[]);

Remove Tags from Transaction

Removes tags from a transaction.

await upSdk.transactions.removeTags(transactionId: string, tags: TagInputResource[]);

Categorize Transaction

Categorizes a transaction.

await upSdk.transactions.categorizeTransaction(transactionId: string, categoryId: string | null);

Categories

List Categories

Retrieves a list of all categories.

const categories = await upSdk.categories.list(params?: ListCategoriesParams);

Get Category

Retrieves details of a specific category.

const category = await upSdk.categories.get(categoryId: string);

Tags

List Tags

Retrieves a list of all tags.

const tags = await upSdk.tags.list(params?: ListTagsParams);

Webhooks

List Webhooks

Retrieves a list of all webhooks.

const webhooks = await upSdk.webhooks.list(params?: ListWebhooksParams);

Create Webhook

Creates a new webhook.

const webhook = await upSdk.webhooks.create(webhook: WebhookInputResource);

Get Webhook

Retrieves details of a specific webhook.

const webhook = await upSdk.webhooks.get(webhookId: string);

Delete Webhook

Deletes a webhook.

await upSdk.webhooks.delete(webhookId: string);

Ping Webhook

Pings a webhook.

const response = await upSdk.webhooks.ping(webhookId: string);

List Webhook Logs

Retrieves logs for a specific webhook.

const logs = await upSdk.webhooks.listLogs(webhookId: string, params?: ListWebhookLogsParams);

Attachments

List Attachments

Retrieves a list of all attachments.

const attachments = await upSdk.attachments.list(params?: ListAttachmentsParams);

Get Attachment

Retrieves details of a specific attachment.

const attachment = await upSdk.attachments.get(attachmentId: string);

Utility

Ping

Pings the Up Banking API.

const response = await upSdk.ping();

Error Handling

The SDK uses a custom UpApiError class for error handling:

try {
  const account = await upSdk.accounts.get('non-existent-id');
} catch (error) {
  if (error instanceof UpApiError) {
    console.error(`API Error: ${error.status} - ${error.title}`);
    console.error(`Details: ${error.detail}`);
  } else {
    console.error('An unexpected error occurred:', error);
  }
}

Pagination

For endpoints that return paginated results, you can specify pagination parameters in the params object:

const transactions = await upSdk.transactions.list({
  'page[size]': 50,
});

Rate Limiting

The SDK automatically handles rate limiting. You can monitor rate limit warnings:

upSdk.on('rateLimitWarning', (remainingRequests) => {
  console.warn(`Rate limit warning: ${remainingRequests} requests remaining`);
});

For more detailed information about the Up Banking API, please refer to the official Up API documentation. This readme may or may not have being generated with ChatGPT.