@ottospace/sdk-ts
v0.1.0
Published
Typed TypeScript SDK for the OttoSpace platform — auto-generated from OpenAPI specs.
Readme
@ottospace/sdk-ts
Typed TypeScript client for the OttoSpace platform — auto-generated from each app's OpenAPI spec.
Install (from a workspace)
pnpm add file:/home/ottospace/sdk-ts # local file dep on the VPS
# or once published:
# pnpm add @ottospace/sdk-tsUsage
import { ottospaceClients } from "@ottospace/sdk-ts";
const { auth, ticket } = ottospaceClients();
// Get the current user
const { data: me } = await auth.GET("/api/v1/me");
console.log(me?.email);
// List my events (organizer-side)
const { data: events } = await ticket.GET("/api/v1/me/events");
events?.forEach(e => console.log(e.title));
// Issue a free ticket (public)
const { data: ticketOut } = await ticket.POST("/api/v1/public/events/{slug}/tickets", {
params: { path: { slug: "otto-launch-party--beta" } },
body: {
ticket_type_id: "...",
buyer_email: "[email protected]",
},
});
console.log("QR:", ticketOut?.qr_token);Custom hosts (dev/staging)
const clients = ottospaceClients({
hosts: {
auth: "http://localhost:8002",
pay: "http://localhost:8003",
ticket: "http://localhost:8004",
},
});Server-side / Bearer auth
import { authClient } from "@ottospace/sdk-ts";
const auth = authClient();
const { data } = await auth.GET("/api/v1/me", {
headers: { authorization: `Bearer ${jwt}` },
});Regenerating after API changes
npm run fetch-specs # pull live OpenAPI from auth/pay/ticket subdomains
npm run regen # regenerate types/*.d.tsType errors surface at compile time across every workspace consuming this package — that's the whole point.
