@epilot/entity-client

JavaScript client library for the epilot Core Entity API

Usage no npm install needed!

<script type="module">
  import epilotEntityClient from 'https://cdn.skypack.dev/@epilot/entity-client';
</script>

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}`;

API Docs:

https://docs.api.epilot.io/entity