@equistamp/api
v1.1.11
Published
<div align="center"> <picture> <img height="40" alt="Equistamp's logo" src="/.github/assets/logoBlue.png"> </picture>
Downloads
2
Readme
Installation
This can be installed from npm:
npm install @equistamp/api
Basic usage
Once you've installed the package, you can create a new API instance with:
import API from '@equistamp/api'
const api = new API({ server: 'https://equistamp.net' })
await api.auth.login({login: '<your user email address>', password: '<your password>'})
Now you can fetch data from various endpoints, e.g.:
await api.auth.me()
await api.models.list()
Endpoints
The API
object represents the available Equistamp endpoints as separate
properties for each endpoint. More information can be found in the docs.
These endpoints have the following methods defined:
create(data: T) => Promise<T>
- receives a JSON object and creates an appropriate entry in the database (if possible)fetch(id: string) => Promise<T>
- fetches the object with the givenid
list(query: FilterConfig) => Promise<SearchResult>
- returns all items that match the filter configurationupdate(item: T & {id: string}) => Promise<string>
- updates the item with the provided idremove((item: T & {id: string}) => Promise<string>
- deletes the given item (when possible)