Skip to main content

Interface: XRPCMethod<TParams, TInput, TOutput>

Defined in: src/api/xrpc/types.ts:92

XRPC method definition.

Remarks​

Defines a complete XRPC method with lexicon reference, auth requirements, and handler function. Used for type-safe route registration.

Example​

const getSubmission: XRPCMethod<GetSubmissionParams, void, Submission> = {
auth: false,
handler: async ({ params, c }) => {
const eprintService = c.get('services').eprint;
const result = await eprintService.getSubmission(params.uri);
return { encoding: 'application/json', body: result };
},
};

Extended by​

Type Parameters​

• TParams = unknown

Query/input parameters type

• TInput = unknown

Request body type (procedures only)

• TOutput = unknown

Response body type

Properties​

auth?​

optional auth: boolean | "optional"

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

Authentication requirement.

Remarks​

  • true: Authentication required (401 if not authenticated)
  • false: No authentication required (public endpoint)
  • 'optional': Authentication optional (different behavior for authed users)

Default Value​

false

handler()​

handler: (ctx) => Promise<XRPCResponse<TOutput>>

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

Handler function implementing the method logic.

Parameters​

ctx​

XRPCContext<TParams, TInput>

Returns​

Promise<XRPCResponse<TOutput>>


lexicon?​

optional lexicon: {} | {}

Defined in: src/api/xrpc/types.ts:103

Lexicon definition for this method (optional if using NSID lookup).


type?​

optional type: "query" | "procedure"

Defined in: src/api/xrpc/types.ts:98

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

Default Value​

'query'