benji-sdk
v0.1.3
Published
Official TypeScript SDK for the Benji API - Your personal life operating system
Maintainers
Readme
benji-sdk
Official TypeScript SDK for the Benji API.
The package is generated from the Benji OpenAPI spec and is designed to move with the API, so this README stays intentionally lightweight. Use TypeScript autocomplete or listSdkMethods() to explore the current surface area instead of relying on a hand-maintained endpoint list.
Install
pnpm add benji-sdkConfigure
import { configure } from "benji-sdk";
configure({
apiKey: "your-api-key",
});baseUrl is optional. Only pass it when targeting a custom Benji environment.
Typed Usage
import { configure, Todos } from "benji-sdk";
configure({ apiKey: "your-api-key" });
const todos = await Todos.todosList({
body: { screen: "today" },
});Dynamic Usage
This is useful when the API changes quickly and you want a stable way to reach newly generated methods.
import { callSdkMethod, listSdkMethods } from "benji-sdk";
const methods = listSdkMethods({ search: "trip" });
const trips = await callSdkMethod("Trips.tripsList");callSdkMethod() accepts the same options object shape as the generated client, for example:
await callSdkMethod("Todos.todosList", {
body: { screen: "today" },
});Environment Helper
import { initializeFromEnv } from "benji-sdk";
initializeFromEnv();This reads:
BENJI_API_KEYBENJI_BASE_URL
Errors
wrapSdkCall() converts generated client responses into thrown BenjiApiError instances for non-success cases:
import { Todos, wrapSdkCall } from "benji-sdk";
const todo = await wrapSdkCall(
Todos.todosGet({
body: { id: "todo_123" },
}),
);License
MIT
