1/**
2 * GENERATED CODE - DO NOT MODIFY
3 */
4import {
5 createServer as createXrpcServer,
6 Server as XrpcServer,
7 Options as XrpcOptions,
8 AuthVerifier,
9 StreamAuthVerifier,
10} from "@atproto/xrpc-server";
11import { schemas } from "./lexicons";
12import * as ComAtprotoRepoGetRecord from "./types/com/atproto/repo/getRecord";
13import * as ComAtprotoRepoListRecords from "./types/com/atproto/repo/listRecords";
14
15export function createServer(options?: XrpcOptions): Server {
16 return new Server(options);
17}
18
19export class Server {
20 xrpc: XrpcServer;
21 li: LiNS;
22 com: ComNS;
23 app: AppNS;
24
25 constructor(options?: XrpcOptions) {
26 this.xrpc = createXrpcServer(schemas, options);
27 this.li = new LiNS(this);
28 this.com = new ComNS(this);
29 this.app = new AppNS(this);
30 }
31}
32
33export class LiNS {
34 _server: Server;
35 plonk: LiPlonkNS;
36
37 constructor(server: Server) {
38 this._server = server;
39 this.plonk = new LiPlonkNS(server);
40 }
41}
42
43export class LiPlonkNS {
44 _server: Server;
45
46 constructor(server: Server) {
47 this._server = server;
48 }
49}
50
51export class ComNS {
52 _server: Server;
53 atproto: ComAtprotoNS;
54
55 constructor(server: Server) {
56 this._server = server;
57 this.atproto = new ComAtprotoNS(server);
58 }
59}
60
61export class ComAtprotoNS {
62 _server: Server;
63 repo: ComAtprotoRepoNS;
64
65 constructor(server: Server) {
66 this._server = server;
67 this.repo = new ComAtprotoRepoNS(server);
68 }
69}
70
71export class ComAtprotoRepoNS {
72 _server: Server;
73
74 constructor(server: Server) {
75 this._server = server;
76 }
77
78 getRecord<AV extends AuthVerifier>(
79 cfg: ConfigOf<
80 AV,
81 ComAtprotoRepoGetRecord.Handler<ExtractAuth<AV>>,
82 ComAtprotoRepoGetRecord.HandlerReqCtx<ExtractAuth<AV>>
83 >,
84 ) {
85 const nsid = "com.atproto.repo.getRecord"; // @ts-ignore
86 return this._server.xrpc.method(nsid, cfg);
87 }
88
89 listRecords<AV extends AuthVerifier>(
90 cfg: ConfigOf<
91 AV,
92 ComAtprotoRepoListRecords.Handler<ExtractAuth<AV>>,
93 ComAtprotoRepoListRecords.HandlerReqCtx<ExtractAuth<AV>>
94 >,
95 ) {
96 const nsid = "com.atproto.repo.listRecords"; // @ts-ignore
97 return this._server.xrpc.method(nsid, cfg);
98 }
99}
100
101export class AppNS {
102 _server: Server;
103 bsky: AppBskyNS;
104
105 constructor(server: Server) {
106 this._server = server;
107 this.bsky = new AppBskyNS(server);
108 }
109}
110
111export class AppBskyNS {
112 _server: Server;
113 actor: AppBskyActorNS;
114
115 constructor(server: Server) {
116 this._server = server;
117 this.actor = new AppBskyActorNS(server);
118 }
119}
120
121export class AppBskyActorNS {
122 _server: Server;
123
124 constructor(server: Server) {
125 this._server = server;
126 }
127}
128
129type SharedRateLimitOpts<T> = {
130 name: string;
131 calcKey?: (ctx: T) => string;
132 calcPoints?: (ctx: T) => number;
133};
134type RouteRateLimitOpts<T> = {
135 durationMs: number;
136 points: number;
137 calcKey?: (ctx: T) => string;
138 calcPoints?: (ctx: T) => number;
139};
140type HandlerOpts = { blobLimit?: number };
141type HandlerRateLimitOpts<T> = SharedRateLimitOpts<T> | RouteRateLimitOpts<T>;
142type ConfigOf<Auth, Handler, ReqCtx> =
143 | Handler
144 | {
145 auth?: Auth;
146 opts?: HandlerOpts;
147 rateLimit?: HandlerRateLimitOpts<ReqCtx> | HandlerRateLimitOpts<ReqCtx>[];
148 handler: Handler;
149 };
150type ExtractAuth<AV extends AuthVerifier | StreamAuthVerifier> = Extract<
151 Awaited<ReturnType<AV>>,
152 { credentials: unknown }
153>;