1.0.1 • Published 4 years ago

e-conomic-client v1.0.1

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

E-conomic client

A simple wrapper for E-conomic's REST and SOAP APIs.

Usage:

Create a client:

import Client from 'e-conomic-client';

const client = new Client({
  // settings
});

Then either use REST:

const fetchProducts = await client.rest('/products');
const products = await fetchProducts.json();

or SOAP:

const inventory = await client.soap('Product_GetInventoryLocationStatus', {
  productHandle: {
    Number: 102
  }
});

Options

namerequiredtypedefaultdescription
soapEndpointnostringhttps://api.e-conomic.com/secure/api1/EconomicWebService.asmx?WSDL
restEndpointnostringhttps://restapi.e-conomic.com
tokenyesstringN/AYour visma API token
secretyesstringN/AYour visma API secret
fetchnofunctionglobal fetchProvide a fetch function eg. isomorphic unfetch

Methods

rest(path, options)

Calls the e-conomic REST API (docs).
Returns a Promise that resolve into a fetch request.

namerequiredtypedefaultdescription
pathyesstringN/Apath to the resource
optionsnoobjectN/Afetch options

soap(func, args)

Calls the e-conomic SOAP API (docs).
Returns a Promise that resolves into an object.

namerequiredtypedefaultdescription
funcyesstringN/Aname of the SOAP function
argsnoobjectN/Aargument for the request