README
@epilot/entity-client
JavaScript client library for the epilot Core Entity API
Uses openapi-client-axios
Getting Started
Install the package:
npm install --save-dev @epilot/entity-client
Import the package:
import { getClient } from '@epilot/entity-client';
Use the client:
// get typed client
const client = await getClient();
// call operations
const createRes = await client.createEntity(null, { name: "viljami" });
const { id } = creteRes.data;
const getRes = await client.getEntity(id);
const { entity } = getRes.data;
BaseURL & Authorization
To pass an authorization header and set up the API url, you can use axios defaults:
const client = getClient();
client.defaults.baseURL = config.ENTITY_API_URL;
client.defaults.headers['authorization'] = `Bearer ${token}`;