Wings API Client
A small wrapper around @rexlabs/api-client that enables suitable error handling for the Wings API.
Usage
import { createClient } from '@rexlabs/wings-client';
const shouldLogNiceErrors = false;
const wings = createClient('http://api.rex.dev', shouldLogNiceErrors);
// Call this with the Wing's token, once created.
wingsClient.setAuthToken('ahsdkgfjagsd');
// Returns a promise with the response.
wings('Service::method', { ...args }, axiosConfig);
API
| API | Descriptions |
|---|---|
createClient(baseURL, shouldLogNiceErrors) | Creates a wingsClient. |
wingsClient(serviceMethod, requestArgs, axiosConfig) | Calls a Wings API service method. |
stripPrefixes(object) | Strips the "_" prefixes from an object, returning a new object. |
addPrefixes(object) | Adds the "_" prefixes onto the appropriate fields of an object, returning a new object. |
Development
Install dependencies
$ yarn
Available Commands
$ yarn test # runs all units tests
$ yarn test:watch # runs unit tests when files change
$ yarn build # bundles the package for production
Legal
Copyright © 2019 Rex Software All Rights Reserved.