0.20240430.1 • Published 9 days ago

@matchi/api v0.20240430.1

Weekly downloads
-
License
-
Repository
-
Last release
9 days ago

@matchi/api

MATCHi API Client

Introduction

This is the MATCHi API client for JavaScript and TypeScript. It is generated from the OpenAPI specification and is intended to be used when building applications that integrates with the MATCHi API.

Installation

npm install @matchi/api # using npm
yarn add @matchi/api # using yarn
bun install @matchi/api # using bun

Get started

import { OpenAPI } from "@matchi/api";

OpenAPI.BASE = MATCHI_API_URL;
OpenAPI.HEADERS = { "x-api-key": MATCHI_API_KEY };

// To use the authenticated endpoints
// set the access token
OpenAPI.TOKEN = MATCHI_ACCESS_TOKEN;

// You can also use a promise to set the access token
const getValidAccessToken = async () => {
  // Get a valid access token
  return MATCHI_ACCESS_TOKEN;
};
OpenAPI.TOKEN = getValidAccessToken;

Usage

Basic usage

// Once you've got the dependency locally, you can inspect the exports to
// see what's available.

// The classes that ends in "Service" are entrypoints for making HTTP calls.
import { AnonymousService } from "@matchi/api";

try {
  // fetch() is used as the underlying HTTP client
  const activities = await AnonymousService.listActivities();
} catch (error) {
  // Handle error
}

Custom timeout

import { AnonymousService } from "@matchi/api";

try {
  // Create a promise that will fetch the activities
  const promise = AnonymousService.listActivities();

  const timeoutId = setTimeout(() => {
    // If the promise hasn't resolved within 1 second, cancel it
    promise.cancel();

    // Throw an error to indicate that the request timed out
    throw new Error("Timeout");
  }, 1000);

  // Wait for the promise to resolve
  const activities = await promise;

  // Clear the timeout, since the promise resolved within 1 second
  clearTimeout(timeoutId);

  return activities;
} catch (error) {
  // Handle error
}
0.20240430.1

9 days ago

0.20240419.1

20 days ago

0.20240416.1

23 days ago

0.20240416.2

23 days ago

0.20240412.1

27 days ago

0.20240410.1

29 days ago

0.20240404.1

1 month ago

0.20240328.1

1 month ago

0.20240318.1

2 months ago

0.20240305.1

2 months ago

0.20240223.1

3 months ago

0.20240220.3

3 months ago

0.20240110.1

4 months ago

0.20240104.1

4 months ago

0.20231220.1

5 months ago

0.20231215.2

5 months ago

0.20231215.1

5 months ago

0.20231220.2

5 months ago

0.20231214.3

5 months ago

0.20231214.1

5 months ago

0.20231214.2

5 months ago

0.20231212.1

5 months ago

0.20231212.2

5 months ago

0.20231207.1

5 months ago

0.20231110.2

6 months ago

0.20231110.1

6 months ago

0.20231106.1

6 months ago

0.20231031.1

6 months ago

0.20231024.1

7 months ago

0.20231023.1

7 months ago

0.20231018.1

7 months ago

0.20231011.1

7 months ago

0.20231006.2

7 months ago