JavaScript REST API Client
Install
npm install @autoblocks/client
AutoblocksAPIClient
The AutoblocksAPIClient
allows you to interact with the Autoblocks REST API.
It can be initialized without any arguments if your API key
is set as an environment variable named AUTOBLOCKS_API_KEY
.
JavaScript
import { AutoblocksAPIClient } from '@autoblocks/client';
const client = new AutoblocksAPIClient();
Otherwise, you can pass the API key as an argument:
Python
const client = new AutoblocksAPIClient({
apiKey: 'your-api-key',
});
There are additional arguments that you can use to further configure the client:
- Name
timeout
- Type
- object | undefined
- Description
The timeout for each HTTP request to the Autoblocks REST API. Default value is
{ seconds: 10 }
.The
timeout
property should be an object with the below schema:{ minutes?: number; seconds?: number; milliseconds?: number; }
You can use any combination of the above fields to express a timeout.
For example:
{ hours: 1, minutes: 30 }
Is the same as:
{ hours: 1.5 }
JavaScript
const client = new AutoblocksAPIClient({
timeout: { seconds: 30 },
});
See the REST API documentation for more details on all of the endpoints exposed through this client.