Use the Client SDK
Ocelloids currently provides an official TypeScript SDK for use in browser, Bun and Node.js environments.
For developers using other languages, we offer two additional repositories that, while not full client libraries, contain useful utilities and code for integration:
- Python Library: py-ocelloids (WIP)
- Go Library: go-ocelloids (WIP)
This guide will walk you through getting started with the Ocelloids Client TypeScript SDK . You can follow it by either cloning a quickstart repository or initializing a new project.
You will need
Bun
to follow this guide.
If you don’t have Bun installed, please
install it
Quickstart Repository
Explore the examples/
directory in the
quickstart project
to find various usage scenarios.
We provide a quickstart repository with a bootstraped project for your convenience.
bun create github.com/sodazone/quickstart-ocelloids-services
Replace <YOUR_API_KEY>
with your API key in the command below. If you don’t have one, go to
Get API Key
OC_API_KEY=<YOUR_API_KEY> bun run index.ts
Expected Output
{
statusCode: 200,
status: "ok",
uptime: 31556952001.881527013,
}
Quickstart New Project
If you prefer to start a new project follow these steps.
- Create your project directory
mkdir ocelloids-quickstart && cd ocelloids-quickstart
- Initialize the project
bun init -y
- Add the client library dependency
bun add @sodazone/ocelloids-client
- Create a simple client script
Replace the contents of index.ts
with the following code.
import { OcelloidsClient } from "@sodazone/ocelloids-client";
const client = new OcelloidsClient({
apiKey: process.env.OC_API_KEY
});
client.health()
.then(console.log)
.catch(console.error);
- Run the client
Replace <YOUR_API_KEY>
with your API key in the command below. If you don’t have one, go to
Get API Key
OC_API_KEY=<YOUR_API_KEY> bun run index.ts
Expected Output
{
statusCode: 200,
status: "ok",
uptime: 31556952001.881527013,
}
Documentation
Refer to the Ocelloids Typescript Client Library documentation site