plato-api-sdk
v1.0.21
Published
Typesafe SDK for Plato API using tRPC client.
Downloads
92
Readme
Plato API SDK
Typed tRPC client for the Plato API.
Install
pnpm add plato-api-sdkThis package uses the existing public npm package name plato-api-sdk.
Usage
import { createPlatoApiClient } from "plato-api-sdk";
const plato = createPlatoApiClient({
baseUrl: "https://your-plato-domain.com",
apiKey: process.env.PLATO_API_KEY,
});
const messages = await plato.v1.connect.listMessages.query({
conversationId: "conversation_id",
});
await plato.v1.connect.send.mutate({
conversationId: "conversation_id",
content: {
en: "Hello from my app",
},
ai: {
agentId: "ai_agent_id",
},
});Types
import type { PlatoApiInputs, PlatoApiOutputs } from "plato-api-sdk";
type SendInput = PlatoApiInputs["v1"]["connect"]["send"];
type SendOutput = PlatoApiOutputs["v1"]["connect"]["send"];Use apiKey for API-key routes. For session or cookie routes, omit apiKey
and pass the needed auth headers through headers.
Publish
pnpm run build
npm publish --access public