Suite of AT Protocol TypeScript libraries built on web standards
21
fork

Configure Feed

Select the types of activity you want to include in your feed.

at lex 49 lines 1.2 kB view raw
1/** 2 * # XRPC Client 3 * 4 * TypeScript client library for talking to AT Protocol services, 5 * with Lexicon schema validation. 6 * 7 * @example Fetching an XRPC endpoint 8 * ```typescript 9 * import { LexiconDoc } from '@atp/lexicon' 10 * import { XrpcClient } from '@atp/xrpc' 11 * 12 * const pingLexicon = { 13 * lexicon: 1, 14 * id: 'io.example.ping', 15 * defs: { 16 * main: { 17 * type: 'query', 18 * description: 'Ping the server', 19 * parameters: { 20 * type: 'params', 21 * properties: { message: { type: 'string' } }, 22 * }, 23 * output: { 24 * encoding: 'application/json', 25 * schema: { 26 * type: 'object', 27 * required: ['message'], 28 * properties: { message: { type: 'string' } }, 29 * }, 30 * }, 31 * }, 32 * }, 33 * } satisfies LexiconDoc 34 * 35 * const xrpc = new XrpcClient('https://ping.example.com', [ 36 * pingLexicon, 37 * ]) 38 * 39 * const res1 = await xrpc.call('io.example.ping', { 40 * message: 'hello world', 41 * }) 42 * res1.body // => {message: 'hello world'} 43 * ``` 44 * @module 45 */ 46export * from "./client.ts"; 47export * from "./agent.ts"; 48export * from "./types.ts"; 49export * from "./util.ts";