Skip to main content

Interface: XRPCEndpoint<TInput, TOutput>

Defined in: src/api/types/handlers.ts:106

XRPC endpoint definition.

Remarks

Defines a complete XRPC endpoint with metadata, schemas, and handler. Used for route registration and OpenAPI documentation generation.

Example

export const getSubmissionEndpoint: XRPCEndpoint<
GetSubmissionInput,
GetSubmissionOutput
> = {
method: 'pub.chive.preprint.getSubmission' as NSID,
type: 'query',
description: 'Get preprint by AT URI',
inputSchema: getSubmissionInputSchema,
outputSchema: getSubmissionOutputSchema,
handler: getSubmissionHandler,
auth: 'optional',
rateLimit: 'authenticated',
};

Type Parameters

TInput

Input parameter type

TOutput

Output response type

Properties

auth?

readonly optional auth: AuthRequirement

Defined in: src/api/types/handlers.ts:142

Authentication requirement for this endpoint.

Default Value

'optional'

description

readonly description: string

Defined in: src/api/types/handlers.ts:120

Human-readable description for documentation.


handler

readonly handler: XRPCHandler<TInput, TOutput>

Defined in: src/api/types/handlers.ts:135

Handler function implementing the endpoint logic.


inputSchema

readonly inputSchema: ZodType<TInput>

Defined in: src/api/types/handlers.ts:125

Zod schema for validating input parameters.


method

readonly method: NSID

Defined in: src/api/types/handlers.ts:110

NSID of the XRPC method (e.g., "pub.chive.preprint.getSubmission").


outputSchema

readonly outputSchema: ZodType<TOutput>

Defined in: src/api/types/handlers.ts:130

Zod schema for validating and documenting output.


rateLimit?

readonly optional rateLimit: RateLimitTier

Defined in: src/api/types/handlers.ts:153

Rate limit tier to apply.

Remarks

Determines which rate limit bucket is used. Higher tiers get more requests per minute.

Default Value

'authenticated'

type

readonly type: XRPCType

Defined in: src/api/types/handlers.ts:115

XRPC type: query (GET) or procedure (POST).