About the Libraries
The v3 JS libraries allow your Epicenter application to make calls to the Epicenter backend using API adapters implemented by the epicenter-libs package (github.com/forio/epicenter-libs).
What are API adapters?
The adapters enable your application to communicate with the Epicenter backend. Each adapter exposes TypeScript functions that make REST API calls behind the scenes.
Using the adapters in your code
To use an adapter, you must add the epicenter-libs package to your project by running npm install epicenter-libs and then import the adapter as shown in this example:
import { accountAdapter } from 'epicenter-libs';
For a detailed description of the adapters, see the Developer Reference.
Entity keys
Most entities in the JS libraries have GUID identifiers known as keys. For example, a group object has a groupKey property.
Pagination
The adapter methods handle pagination for you when making requests to the Epicenter API. To consume a paginated response, use the first, max, and count properties of a GenericSearchOptions object.
It is recommended to use the adapter methods whenever possible, but you can also make calls to the API using the Router directly. In this case, when making a request to a paginated endpoint, pass a RoutingOptions object with the paginated property set to true.
import { Router } from 'epicenter-libs';
const groups = await new Router()
.get('/group/search', { paginated: true })
.then(({ body }) => body);
The example above is equivalent to a call to the groupAdapter.query() function, which should be used.
Developer tutorials
Forio offers hands-on developer tutorials that illustrate how to use the adapters in an application and allow you to experiment with the code.