1.0.1 • Published 6 years ago
drivewealth-client v1.0.1
drivewealth-client
JavaScript bindings for the DriveWealth API
Usage
Step 1: Install
Install using npm (or download from Github):
$ npm i --save drivewealth-client
Step 2: Include
This library works in a variety of environments:
// Node.js, Browserify
const drivewealth = require("drivewealth-client");
// Babel
import drivewealth from "drivewealth-client";
// RequireJS
requirejs.config({
paths: { drivewealth: "path/to/drivewealth-client" }
});
define(["drivewealth"], function(drivewealth) { ... })
// Browser
<script src="path/to/drivewealth-client.js"></script>
console.log(drivewealth);
Step 3: Setup
You'll need to call the setup function to initialize the library. In this call, pass a function that the library will use to make HTTP requests. The library supports a few out of the box.
drivewealth.setup({
env: drivewealth.ENVIRONMENTS.UAT,
httpImpl: require("node_modules/drivewealth-client/lib/httpImpls/request.js")
});
Step 4: Use
drivewealth.User.login("john.smith", "passw0rd").then(user => {
console.info(`Welcome ${user.firstName}!`)
});