6.46.0 • Published 2 months ago

@livepreso/api v6.46.0

Weekly downloads
-
License
UNLICENSED
Repository
-
Last release
2 months ago

API

The single point of entry for interacting with the SalesPreso API. Contains functionality for contacting and authorizing wi the API endpoint, as well as middleware, models and collections for sending and retrieving data.

Install

npm install sp-api

or

yarn add sp-api

Examples

import {Auth, Api} from "@livepreso/api";
import {registerMiddleware} from "@livepreso/api/middleware";
import AuthMiddleware from "@livepreso/api/middlewares/auth";
import RedirectMiddleware from "@livepreso/api/middlewares/redirect";

const middlewares = [
  new AuthMiddleware(),
  new RedirectMiddleware(),
  new JSONMiddleware()
];

middlewares.map(registerMiddleware);

Api.initialize("http://localhost:8000/api/")
  .then(() => {
    return Auth.login("yourlogin", "yourpassword");
  });

Documentation

http://developers.salespreso.com/modules/sp-api/