0.5.0 • Published 4 years ago

@jsextonn/portfolio-api-client v0.5.0

Weekly downloads
-
License
MIT
Repository
github
Last release
4 years ago

Portfolio API NodeJS Client

npm.io

NodeJS client used to interface with Portfolio APIs.

Installation

npm i @jsextonn/portfolio-api-client

Note: Package is currently not distributed with minified version.

Usage

Contact Message Creation

import {
  portfolio,
  Reason,
  CreateContactMessageRequest,
} from "@jsextonn/portfolio-api-client";

const client = portfolio();

const request: CreateContactMessageRequest = {
  body: {
    message: "...",
    reason: Reason.Question,
    sender: {
      alias: "...",
      phone: "...",
      email: "...",
    },
  },
};

// The response entity returned from the web service
const response = await client.contact.createMessage(request);

// The response body
const responseBody = response.data;

// The newly created message, if successful
const message = responseBody.data;

Login

import { portfolio, LoginRequest } from "@jsextonn/portfolio-api-client";

const client = portfolio();

const request: LoginRequest = {
  body: {
    username: "username",
    password: "password",
  },
};

// The response entity returned from the web service
const response = await client.security.login(request);

// The response body
const responseBody = response.data;

// The authentication tokens, if successful
const message = responseBody.data;

Confirm Account

import {
  portfolio,
  UpdatePasswordRequest,
} from "@jsextonn/portfolio-api-client";

const client = portfolio();

const request: UpdatePasswordRequest = {
  body: {
    username: "username",
    oldPassword: "oldPassword",
    newPassword: "newPassword",
  },
};

// The response entity returned from the web service
const response = await client.security.confirmAccount(request);

// The response body
const responseBody = response.data;

// The authentication tokens, if successful
const message = responseBody.data;
0.5.0

4 years ago

0.4.1

4 years ago

0.4.0

4 years ago

0.3.0

4 years ago

0.2.0

4 years ago

0.1.2

4 years ago

0.1.1

4 years ago

0.1.0

4 years ago