This is an auto-generated API client based on the OpenAPI Spec for Cycle. Please do not open any PRs for the generated code under /src/generated. If you have any questions on what changes are made in the latest version, please refer to the spec above.
This client utilizes openapi-typescript to generate the type definitions for our client. The client itself is a pre-built openapi-fetch client for convenience.
Every request should be typesafe, and only endpoints described in the spec will be valid in Typescript as the first parameter to get
, post
, patch
etc.
npm i @cycleplatform/scheduler-api-client
Access keys can be configured on the scheduler service config in the Portal or through Cycle's main API.
import { getClient } from "@cycleplatform/api-client-typescript";
const client = getClient({ accessToken: "<ACCESS TOKEN>" });
const resp = await client.POST("/v1/functions/{containerId}/claim", {
params: {
path: {
containerId: "containerId",
},
},
});
console.log(resp.data);
In some cases it may be necessary to override the default URL of http://env-scheduler
. For example, you may be accessing the scheduler from outside of the Environment.
import { getClient } from "@cycleplatform/api-client-typescript";
const client = getClient({
accessToken: "<ACCESS TOKEN>",
baseUrl: "https://my-scheduler.test.com",
});
const resp = await client.POST("/v1/functions/{containerId}/claim", {
params: {
path: {
containerId: "containerId",
},
},
});
console.log(resp.data);
git submodule update --recursive --remote
To build a local copy of this client, run npm run build:lib
to create a ./dist
folder with the necessary files.
npm run test:ts && npm run test