0.0.11 • Published 6 months ago
vendus-sdk v0.0.11
Vendus API Unofficial JavaScript API
The documentation for the Vendus API is available here. Not all endpoints are available but feel free to contribute!
Installation
First, install the module with npm (or yarn):
npm install vendus-sdk
Then, depending upon your usage context, add a reference to it:
CommonJS / Node
const vendus = require("vendus-sdk");
ESM / TypeScript
import VendusClient from "vendus-sdk";
Usage
To use this client you must have an API Key from Vendus.
import VendusClient from "vendus-sdk";
const vendus = new VendusClient({
apiKey: process.env.VENDUS_API_KEY,
});
const client = await vendus.clients.createClient({
externalUserId: "test-user",
market: "GB",
locale: "en_US",
});
Error Handling
If a response is returned with a code >= 300, instead of returning the response, the response will be thrown as an error to be caught. The error has the following fields:
{
name: "Request failed",
message: "Request failed with status 404: Not found",
status: 404,
statusText: "Not found",
request: {
url: `https://www.vendus.pt/ws/v1.1/notFound`,
options: fetchOptions,
}
response: "Fetch response object"
}