@mft/mhe-sdk
v1.0.3
Published
An SDK for interacting with MoneyHub Enterprise APIs.
Downloads
9
Maintainers
Keywords
Readme
MHE-SDK
This module provides easy access to the MoneyHub Enterprise API.
Overview
Here are the main processes that this repository is responsible for:
- A simple boilerplate for experimenting with the API.
- Integrated Typescript toolchain
- Providing a live-reloading build system
Example
#!javascript
import MoneyHub from '@mft/mhe-sdk';
MoneyHub.setup({
environment: 'test',
clientId: ''
clientSecret: '',
scopes: ''
});
const refreshToken = 'Refresh token goes here';
MoneyHub.user(refreshToken).accounts().create({
...
}).then((account) => console.log);
Setup Development Environment
Important: This project requires Node v6 to run. I recommend using nvm to install alternate versions of Node.
- Clone this repository
npm install
(using Node v6)npm run start
(to transpile the project intobuild/
and begin execution)
Style Guidelines
The project is written using Typescript and ES6 (ES2015) features only.
The build system is integrated with both TSLint and ESLint, thanks to the tslint.json
and .eslintrc.json
files provided. When the service is started or reloads, all the code is run through both linters and you will see their output.
We intend to code in the AirBnB Javascript Style, and ESLint is configured to use their rules, with a few modifications to suit the context of Typescript code.
For maximum benefit, this project aims to embrace as much of Typescript as possible. Therefore, TSLint will insist upon giving all variables type definitions.
Type definitions
When installing new NPM modules, check if they have an @types
declaration. This package/file is
provided by the community to give standard Javascript modules types from Typescript, allowing for
interoperability.
If you import a module which does not have one, you will have to create your own for Typescript to
detect the module. Examples of these can be found in "src/types".
You can create a simple stub declaration:
declare module 'module-name' {
}
You might end up declaring significant portions of the module's API, but this will ensure more consistent code in the future.
More information about importing type definitions can be found here.