TypeScript fetch client

The TypeScript client is available at https://github.com/lab5e/ts-fetch-spanapi. It uses the native fetch API underneath the hood that is natively available in all modern browsers.

Note: If you use a node environment you need to install a fetch dropin library such as node-fetch or GitHub fetch.

Usage

Installation

To install the client, either use npm or yarn

# Span client
npm i -S @lab5e/ts-fetch-spanapi
# User client
npm i -S @lab5e/ts-fetch-userapi

Example fetching collection data

import { CollectionsApi, Configuration } from "@lab5e/ts-fetch-spanapi";

const api = new CollectionsApi(new Configuration({ apiKey: "myToken" }));
const myCollectionData = await api.listCollectionData({
  collectionId: "myCollectionID",
});

console.log(myCollectionData); // { data: [ ... ] }