1.0.1 • Published 9 months ago

@blnkfinance/blnk-typescript v1.0.1

Weekly downloads
-
License
MIT
Repository
-
Last release
9 months ago

BLNK SDK

A Node library for consuming the Blnk API

Prerequisites

This project requires NodeJS (version 8 or later) and NPM. Node and NPM are really easy to install. To make sure you have them available on your machine, try running the following command.

Make sure you set up your BLNK server as this SDK requires a BLNK url.

Table of contents

Installation

BEFORE YOU INSTALL: please read the prerequisites

npm install @blnkfinance/blnk-typescript --save

Usage

Importing and Using the SDK

CommonJS

const {BlnkInit} = require(`@blnkfinance/blnk-typescript`);
const blnk = await BlnkInit(`<secret_key_if_set>`, {
    baseUrl: BASE_URL,
});
const {Ledgers, Search, LedgerBalances, Transactions} = blnk;

const ledger = await Ledgers.create({
    name: `Marketing Department Ledger`,
    meta_data: {
      department: `Marketing`,
    },
});

Typescript

import {BlnkInit} from `@blnkfinance/blnk-typescript`;
const blnk = await BlnkInit(`<secret_key_if_set>`, {
    baseUrl: BASE_URL,
});

const {Ledgers, Search, LedgerBalances, Transactions} = blnk;

//meta data type can be passed as a generic type to the create method
const ledger = await Ledgers.create<{department: string}>({
    name: `Marketing Department Ledger`,
    meta_data: {
        department: `Marketing`,
    }
})

//can be called without a generic type
const ledger = await Ledgers.create({
    name: `Marketing Department Ledger`,
})

Issues

Find a bug? Please create an issue here on GitHub!

Authors

1.0.1

9 months ago

1.0.0

9 months ago