@toando/apis
v1.6.3
Published
Api definitions for interacting with toando products
Readme
@toando/apis
Official, auto-generated TypeScript/JavaScript client SDK containing ConnectRPC compatible service definitions for all Toando APIs.
Source Definitions
This package is automatically generated from protocol buffers definitions using the Buf CLI. If you need to view the raw .proto structures, visit the parent GitHub repository.
Installation
Install the package via npm, yarn, or pnpm alongside the required ConnectRPC runtime dependencies:
npm install @toando/apis @connectrpc/connect @connectrpc/connect-nodeQuick Start (ConnectRPC Example)
Here is a quick example of how to import the auto-generated definitions and fetch a resource using a client.
import { createClient } from "@connectrpc/connect";
import { createConnectTransport } from "@connectrpc/connect-node";
// Import generated service definitions
import { BookService } from "@toando/apis/books/v1alpha1/book_pb.js";
// Setup transport
const transport = createConnectTransport({
baseUrl: "https://backend.books:8080",
httpVersion: "2"
});
// Instantiate type-safe client
const client = createClient(BookService, transport);
// Use client RPCs
const response = await client.getBook({ id: "example_book_id" });