a tool for shared writing and social publishing
1/**
2 * GENERATED CODE - DO NOT MODIFY
3 */
4import {
5 XrpcClient,
6 type FetchHandler,
7 type FetchHandlerOptions,
8} from '@atproto/xrpc'
9import { schemas } from './lexicons'
10import { CID } from 'multiformats/cid'
11import { type OmitKey, type Un$Typed } from './util'
12import * as AppBskyActorProfile from './types/app/bsky/actor/profile'
13import * as ComAtprotoLabelDefs from './types/com/atproto/label/defs'
14import * as ComAtprotoRepoApplyWrites from './types/com/atproto/repo/applyWrites'
15import * as ComAtprotoRepoCreateRecord from './types/com/atproto/repo/createRecord'
16import * as ComAtprotoRepoDefs from './types/com/atproto/repo/defs'
17import * as ComAtprotoRepoDeleteRecord from './types/com/atproto/repo/deleteRecord'
18import * as ComAtprotoRepoDescribeRepo from './types/com/atproto/repo/describeRepo'
19import * as ComAtprotoRepoGetRecord from './types/com/atproto/repo/getRecord'
20import * as ComAtprotoRepoImportRepo from './types/com/atproto/repo/importRepo'
21import * as ComAtprotoRepoListMissingBlobs from './types/com/atproto/repo/listMissingBlobs'
22import * as ComAtprotoRepoListRecords from './types/com/atproto/repo/listRecords'
23import * as ComAtprotoRepoPutRecord from './types/com/atproto/repo/putRecord'
24import * as ComAtprotoRepoStrongRef from './types/com/atproto/repo/strongRef'
25import * as ComAtprotoRepoUploadBlob from './types/com/atproto/repo/uploadBlob'
26import * as PubLeafletBlocksBlockquote from './types/pub/leaflet/blocks/blockquote'
27import * as PubLeafletBlocksBskyPost from './types/pub/leaflet/blocks/bskyPost'
28import * as PubLeafletBlocksCode from './types/pub/leaflet/blocks/code'
29import * as PubLeafletBlocksHeader from './types/pub/leaflet/blocks/header'
30import * as PubLeafletBlocksHorizontalRule from './types/pub/leaflet/blocks/horizontalRule'
31import * as PubLeafletBlocksIframe from './types/pub/leaflet/blocks/iframe'
32import * as PubLeafletBlocksImage from './types/pub/leaflet/blocks/image'
33import * as PubLeafletBlocksMath from './types/pub/leaflet/blocks/math'
34import * as PubLeafletBlocksPage from './types/pub/leaflet/blocks/page'
35import * as PubLeafletBlocksPoll from './types/pub/leaflet/blocks/poll'
36import * as PubLeafletBlocksText from './types/pub/leaflet/blocks/text'
37import * as PubLeafletBlocksUnorderedList from './types/pub/leaflet/blocks/unorderedList'
38import * as PubLeafletBlocksWebsite from './types/pub/leaflet/blocks/website'
39import * as PubLeafletComment from './types/pub/leaflet/comment'
40import * as PubLeafletDocument from './types/pub/leaflet/document'
41import * as PubLeafletGraphSubscription from './types/pub/leaflet/graph/subscription'
42import * as PubLeafletPagesCanvas from './types/pub/leaflet/pages/canvas'
43import * as PubLeafletPagesLinearDocument from './types/pub/leaflet/pages/linearDocument'
44import * as PubLeafletPollDefinition from './types/pub/leaflet/poll/definition'
45import * as PubLeafletPollVote from './types/pub/leaflet/poll/vote'
46import * as PubLeafletPublication from './types/pub/leaflet/publication'
47import * as PubLeafletRichtextFacet from './types/pub/leaflet/richtext/facet'
48import * as PubLeafletThemeBackgroundImage from './types/pub/leaflet/theme/backgroundImage'
49import * as PubLeafletThemeColor from './types/pub/leaflet/theme/color'
50
51export * as AppBskyActorProfile from './types/app/bsky/actor/profile'
52export * as ComAtprotoLabelDefs from './types/com/atproto/label/defs'
53export * as ComAtprotoRepoApplyWrites from './types/com/atproto/repo/applyWrites'
54export * as ComAtprotoRepoCreateRecord from './types/com/atproto/repo/createRecord'
55export * as ComAtprotoRepoDefs from './types/com/atproto/repo/defs'
56export * as ComAtprotoRepoDeleteRecord from './types/com/atproto/repo/deleteRecord'
57export * as ComAtprotoRepoDescribeRepo from './types/com/atproto/repo/describeRepo'
58export * as ComAtprotoRepoGetRecord from './types/com/atproto/repo/getRecord'
59export * as ComAtprotoRepoImportRepo from './types/com/atproto/repo/importRepo'
60export * as ComAtprotoRepoListMissingBlobs from './types/com/atproto/repo/listMissingBlobs'
61export * as ComAtprotoRepoListRecords from './types/com/atproto/repo/listRecords'
62export * as ComAtprotoRepoPutRecord from './types/com/atproto/repo/putRecord'
63export * as ComAtprotoRepoStrongRef from './types/com/atproto/repo/strongRef'
64export * as ComAtprotoRepoUploadBlob from './types/com/atproto/repo/uploadBlob'
65export * as PubLeafletBlocksBlockquote from './types/pub/leaflet/blocks/blockquote'
66export * as PubLeafletBlocksBskyPost from './types/pub/leaflet/blocks/bskyPost'
67export * as PubLeafletBlocksCode from './types/pub/leaflet/blocks/code'
68export * as PubLeafletBlocksHeader from './types/pub/leaflet/blocks/header'
69export * as PubLeafletBlocksHorizontalRule from './types/pub/leaflet/blocks/horizontalRule'
70export * as PubLeafletBlocksIframe from './types/pub/leaflet/blocks/iframe'
71export * as PubLeafletBlocksImage from './types/pub/leaflet/blocks/image'
72export * as PubLeafletBlocksMath from './types/pub/leaflet/blocks/math'
73export * as PubLeafletBlocksPage from './types/pub/leaflet/blocks/page'
74export * as PubLeafletBlocksPoll from './types/pub/leaflet/blocks/poll'
75export * as PubLeafletBlocksText from './types/pub/leaflet/blocks/text'
76export * as PubLeafletBlocksUnorderedList from './types/pub/leaflet/blocks/unorderedList'
77export * as PubLeafletBlocksWebsite from './types/pub/leaflet/blocks/website'
78export * as PubLeafletComment from './types/pub/leaflet/comment'
79export * as PubLeafletDocument from './types/pub/leaflet/document'
80export * as PubLeafletGraphSubscription from './types/pub/leaflet/graph/subscription'
81export * as PubLeafletPagesCanvas from './types/pub/leaflet/pages/canvas'
82export * as PubLeafletPagesLinearDocument from './types/pub/leaflet/pages/linearDocument'
83export * as PubLeafletPollDefinition from './types/pub/leaflet/poll/definition'
84export * as PubLeafletPollVote from './types/pub/leaflet/poll/vote'
85export * as PubLeafletPublication from './types/pub/leaflet/publication'
86export * as PubLeafletRichtextFacet from './types/pub/leaflet/richtext/facet'
87export * as PubLeafletThemeBackgroundImage from './types/pub/leaflet/theme/backgroundImage'
88export * as PubLeafletThemeColor from './types/pub/leaflet/theme/color'
89
90export const PUB_LEAFLET_PAGES = {
91 CanvasTextAlignLeft: 'pub.leaflet.pages.canvas#textAlignLeft',
92 CanvasTextAlignCenter: 'pub.leaflet.pages.canvas#textAlignCenter',
93 CanvasTextAlignRight: 'pub.leaflet.pages.canvas#textAlignRight',
94 LinearDocumentTextAlignLeft: 'pub.leaflet.pages.linearDocument#textAlignLeft',
95 LinearDocumentTextAlignCenter:
96 'pub.leaflet.pages.linearDocument#textAlignCenter',
97 LinearDocumentTextAlignRight:
98 'pub.leaflet.pages.linearDocument#textAlignRight',
99}
100
101export class AtpBaseClient extends XrpcClient {
102 app: AppNS
103 com: ComNS
104 pub: PubNS
105
106 constructor(options: FetchHandler | FetchHandlerOptions) {
107 super(options, schemas)
108 this.app = new AppNS(this)
109 this.com = new ComNS(this)
110 this.pub = new PubNS(this)
111 }
112
113 /** @deprecated use `this` instead */
114 get xrpc(): XrpcClient {
115 return this
116 }
117}
118
119export class AppNS {
120 _client: XrpcClient
121 bsky: AppBskyNS
122
123 constructor(client: XrpcClient) {
124 this._client = client
125 this.bsky = new AppBskyNS(client)
126 }
127}
128
129export class AppBskyNS {
130 _client: XrpcClient
131 actor: AppBskyActorNS
132
133 constructor(client: XrpcClient) {
134 this._client = client
135 this.actor = new AppBskyActorNS(client)
136 }
137}
138
139export class AppBskyActorNS {
140 _client: XrpcClient
141 profile: AppBskyActorProfileRecord
142
143 constructor(client: XrpcClient) {
144 this._client = client
145 this.profile = new AppBskyActorProfileRecord(client)
146 }
147}
148
149export class AppBskyActorProfileRecord {
150 _client: XrpcClient
151
152 constructor(client: XrpcClient) {
153 this._client = client
154 }
155
156 async list(
157 params: OmitKey<ComAtprotoRepoListRecords.QueryParams, 'collection'>,
158 ): Promise<{
159 cursor?: string
160 records: { uri: string; value: AppBskyActorProfile.Record }[]
161 }> {
162 const res = await this._client.call('com.atproto.repo.listRecords', {
163 collection: 'app.bsky.actor.profile',
164 ...params,
165 })
166 return res.data
167 }
168
169 async get(
170 params: OmitKey<ComAtprotoRepoGetRecord.QueryParams, 'collection'>,
171 ): Promise<{ uri: string; cid: string; value: AppBskyActorProfile.Record }> {
172 const res = await this._client.call('com.atproto.repo.getRecord', {
173 collection: 'app.bsky.actor.profile',
174 ...params,
175 })
176 return res.data
177 }
178
179 async create(
180 params: OmitKey<
181 ComAtprotoRepoCreateRecord.InputSchema,
182 'collection' | 'record'
183 >,
184 record: Un$Typed<AppBskyActorProfile.Record>,
185 headers?: Record<string, string>,
186 ): Promise<{ uri: string; cid: string }> {
187 const collection = 'app.bsky.actor.profile'
188 const res = await this._client.call(
189 'com.atproto.repo.createRecord',
190 undefined,
191 {
192 collection,
193 rkey: 'self',
194 ...params,
195 record: { ...record, $type: collection },
196 },
197 { encoding: 'application/json', headers },
198 )
199 return res.data
200 }
201
202 async put(
203 params: OmitKey<
204 ComAtprotoRepoPutRecord.InputSchema,
205 'collection' | 'record'
206 >,
207 record: Un$Typed<AppBskyActorProfile.Record>,
208 headers?: Record<string, string>,
209 ): Promise<{ uri: string; cid: string }> {
210 const collection = 'app.bsky.actor.profile'
211 const res = await this._client.call(
212 'com.atproto.repo.putRecord',
213 undefined,
214 { collection, ...params, record: { ...record, $type: collection } },
215 { encoding: 'application/json', headers },
216 )
217 return res.data
218 }
219
220 async delete(
221 params: OmitKey<ComAtprotoRepoDeleteRecord.InputSchema, 'collection'>,
222 headers?: Record<string, string>,
223 ): Promise<void> {
224 await this._client.call(
225 'com.atproto.repo.deleteRecord',
226 undefined,
227 { collection: 'app.bsky.actor.profile', ...params },
228 { headers },
229 )
230 }
231}
232
233export class ComNS {
234 _client: XrpcClient
235 atproto: ComAtprotoNS
236
237 constructor(client: XrpcClient) {
238 this._client = client
239 this.atproto = new ComAtprotoNS(client)
240 }
241}
242
243export class ComAtprotoNS {
244 _client: XrpcClient
245 repo: ComAtprotoRepoNS
246
247 constructor(client: XrpcClient) {
248 this._client = client
249 this.repo = new ComAtprotoRepoNS(client)
250 }
251}
252
253export class ComAtprotoRepoNS {
254 _client: XrpcClient
255
256 constructor(client: XrpcClient) {
257 this._client = client
258 }
259
260 applyWrites(
261 data?: ComAtprotoRepoApplyWrites.InputSchema,
262 opts?: ComAtprotoRepoApplyWrites.CallOptions,
263 ): Promise<ComAtprotoRepoApplyWrites.Response> {
264 return this._client
265 .call('com.atproto.repo.applyWrites', opts?.qp, data, opts)
266 .catch((e) => {
267 throw ComAtprotoRepoApplyWrites.toKnownErr(e)
268 })
269 }
270
271 createRecord(
272 data?: ComAtprotoRepoCreateRecord.InputSchema,
273 opts?: ComAtprotoRepoCreateRecord.CallOptions,
274 ): Promise<ComAtprotoRepoCreateRecord.Response> {
275 return this._client
276 .call('com.atproto.repo.createRecord', opts?.qp, data, opts)
277 .catch((e) => {
278 throw ComAtprotoRepoCreateRecord.toKnownErr(e)
279 })
280 }
281
282 deleteRecord(
283 data?: ComAtprotoRepoDeleteRecord.InputSchema,
284 opts?: ComAtprotoRepoDeleteRecord.CallOptions,
285 ): Promise<ComAtprotoRepoDeleteRecord.Response> {
286 return this._client
287 .call('com.atproto.repo.deleteRecord', opts?.qp, data, opts)
288 .catch((e) => {
289 throw ComAtprotoRepoDeleteRecord.toKnownErr(e)
290 })
291 }
292
293 describeRepo(
294 params?: ComAtprotoRepoDescribeRepo.QueryParams,
295 opts?: ComAtprotoRepoDescribeRepo.CallOptions,
296 ): Promise<ComAtprotoRepoDescribeRepo.Response> {
297 return this._client.call(
298 'com.atproto.repo.describeRepo',
299 params,
300 undefined,
301 opts,
302 )
303 }
304
305 getRecord(
306 params?: ComAtprotoRepoGetRecord.QueryParams,
307 opts?: ComAtprotoRepoGetRecord.CallOptions,
308 ): Promise<ComAtprotoRepoGetRecord.Response> {
309 return this._client
310 .call('com.atproto.repo.getRecord', params, undefined, opts)
311 .catch((e) => {
312 throw ComAtprotoRepoGetRecord.toKnownErr(e)
313 })
314 }
315
316 importRepo(
317 data?: ComAtprotoRepoImportRepo.InputSchema,
318 opts?: ComAtprotoRepoImportRepo.CallOptions,
319 ): Promise<ComAtprotoRepoImportRepo.Response> {
320 return this._client.call(
321 'com.atproto.repo.importRepo',
322 opts?.qp,
323 data,
324 opts,
325 )
326 }
327
328 listMissingBlobs(
329 params?: ComAtprotoRepoListMissingBlobs.QueryParams,
330 opts?: ComAtprotoRepoListMissingBlobs.CallOptions,
331 ): Promise<ComAtprotoRepoListMissingBlobs.Response> {
332 return this._client.call(
333 'com.atproto.repo.listMissingBlobs',
334 params,
335 undefined,
336 opts,
337 )
338 }
339
340 listRecords(
341 params?: ComAtprotoRepoListRecords.QueryParams,
342 opts?: ComAtprotoRepoListRecords.CallOptions,
343 ): Promise<ComAtprotoRepoListRecords.Response> {
344 return this._client.call(
345 'com.atproto.repo.listRecords',
346 params,
347 undefined,
348 opts,
349 )
350 }
351
352 putRecord(
353 data?: ComAtprotoRepoPutRecord.InputSchema,
354 opts?: ComAtprotoRepoPutRecord.CallOptions,
355 ): Promise<ComAtprotoRepoPutRecord.Response> {
356 return this._client
357 .call('com.atproto.repo.putRecord', opts?.qp, data, opts)
358 .catch((e) => {
359 throw ComAtprotoRepoPutRecord.toKnownErr(e)
360 })
361 }
362
363 uploadBlob(
364 data?: ComAtprotoRepoUploadBlob.InputSchema,
365 opts?: ComAtprotoRepoUploadBlob.CallOptions,
366 ): Promise<ComAtprotoRepoUploadBlob.Response> {
367 return this._client.call(
368 'com.atproto.repo.uploadBlob',
369 opts?.qp,
370 data,
371 opts,
372 )
373 }
374}
375
376export class PubNS {
377 _client: XrpcClient
378 leaflet: PubLeafletNS
379
380 constructor(client: XrpcClient) {
381 this._client = client
382 this.leaflet = new PubLeafletNS(client)
383 }
384}
385
386export class PubLeafletNS {
387 _client: XrpcClient
388 comment: PubLeafletCommentRecord
389 document: PubLeafletDocumentRecord
390 publication: PubLeafletPublicationRecord
391 blocks: PubLeafletBlocksNS
392 graph: PubLeafletGraphNS
393 pages: PubLeafletPagesNS
394 poll: PubLeafletPollNS
395 richtext: PubLeafletRichtextNS
396 theme: PubLeafletThemeNS
397
398 constructor(client: XrpcClient) {
399 this._client = client
400 this.blocks = new PubLeafletBlocksNS(client)
401 this.graph = new PubLeafletGraphNS(client)
402 this.pages = new PubLeafletPagesNS(client)
403 this.poll = new PubLeafletPollNS(client)
404 this.richtext = new PubLeafletRichtextNS(client)
405 this.theme = new PubLeafletThemeNS(client)
406 this.comment = new PubLeafletCommentRecord(client)
407 this.document = new PubLeafletDocumentRecord(client)
408 this.publication = new PubLeafletPublicationRecord(client)
409 }
410}
411
412export class PubLeafletBlocksNS {
413 _client: XrpcClient
414
415 constructor(client: XrpcClient) {
416 this._client = client
417 }
418}
419
420export class PubLeafletGraphNS {
421 _client: XrpcClient
422 subscription: PubLeafletGraphSubscriptionRecord
423
424 constructor(client: XrpcClient) {
425 this._client = client
426 this.subscription = new PubLeafletGraphSubscriptionRecord(client)
427 }
428}
429
430export class PubLeafletGraphSubscriptionRecord {
431 _client: XrpcClient
432
433 constructor(client: XrpcClient) {
434 this._client = client
435 }
436
437 async list(
438 params: OmitKey<ComAtprotoRepoListRecords.QueryParams, 'collection'>,
439 ): Promise<{
440 cursor?: string
441 records: { uri: string; value: PubLeafletGraphSubscription.Record }[]
442 }> {
443 const res = await this._client.call('com.atproto.repo.listRecords', {
444 collection: 'pub.leaflet.graph.subscription',
445 ...params,
446 })
447 return res.data
448 }
449
450 async get(
451 params: OmitKey<ComAtprotoRepoGetRecord.QueryParams, 'collection'>,
452 ): Promise<{
453 uri: string
454 cid: string
455 value: PubLeafletGraphSubscription.Record
456 }> {
457 const res = await this._client.call('com.atproto.repo.getRecord', {
458 collection: 'pub.leaflet.graph.subscription',
459 ...params,
460 })
461 return res.data
462 }
463
464 async create(
465 params: OmitKey<
466 ComAtprotoRepoCreateRecord.InputSchema,
467 'collection' | 'record'
468 >,
469 record: Un$Typed<PubLeafletGraphSubscription.Record>,
470 headers?: Record<string, string>,
471 ): Promise<{ uri: string; cid: string }> {
472 const collection = 'pub.leaflet.graph.subscription'
473 const res = await this._client.call(
474 'com.atproto.repo.createRecord',
475 undefined,
476 { collection, ...params, record: { ...record, $type: collection } },
477 { encoding: 'application/json', headers },
478 )
479 return res.data
480 }
481
482 async put(
483 params: OmitKey<
484 ComAtprotoRepoPutRecord.InputSchema,
485 'collection' | 'record'
486 >,
487 record: Un$Typed<PubLeafletGraphSubscription.Record>,
488 headers?: Record<string, string>,
489 ): Promise<{ uri: string; cid: string }> {
490 const collection = 'pub.leaflet.graph.subscription'
491 const res = await this._client.call(
492 'com.atproto.repo.putRecord',
493 undefined,
494 { collection, ...params, record: { ...record, $type: collection } },
495 { encoding: 'application/json', headers },
496 )
497 return res.data
498 }
499
500 async delete(
501 params: OmitKey<ComAtprotoRepoDeleteRecord.InputSchema, 'collection'>,
502 headers?: Record<string, string>,
503 ): Promise<void> {
504 await this._client.call(
505 'com.atproto.repo.deleteRecord',
506 undefined,
507 { collection: 'pub.leaflet.graph.subscription', ...params },
508 { headers },
509 )
510 }
511}
512
513export class PubLeafletPagesNS {
514 _client: XrpcClient
515
516 constructor(client: XrpcClient) {
517 this._client = client
518 }
519}
520
521export class PubLeafletPollNS {
522 _client: XrpcClient
523 definition: PubLeafletPollDefinitionRecord
524 vote: PubLeafletPollVoteRecord
525
526 constructor(client: XrpcClient) {
527 this._client = client
528 this.definition = new PubLeafletPollDefinitionRecord(client)
529 this.vote = new PubLeafletPollVoteRecord(client)
530 }
531}
532
533export class PubLeafletPollDefinitionRecord {
534 _client: XrpcClient
535
536 constructor(client: XrpcClient) {
537 this._client = client
538 }
539
540 async list(
541 params: OmitKey<ComAtprotoRepoListRecords.QueryParams, 'collection'>,
542 ): Promise<{
543 cursor?: string
544 records: { uri: string; value: PubLeafletPollDefinition.Record }[]
545 }> {
546 const res = await this._client.call('com.atproto.repo.listRecords', {
547 collection: 'pub.leaflet.poll.definition',
548 ...params,
549 })
550 return res.data
551 }
552
553 async get(
554 params: OmitKey<ComAtprotoRepoGetRecord.QueryParams, 'collection'>,
555 ): Promise<{
556 uri: string
557 cid: string
558 value: PubLeafletPollDefinition.Record
559 }> {
560 const res = await this._client.call('com.atproto.repo.getRecord', {
561 collection: 'pub.leaflet.poll.definition',
562 ...params,
563 })
564 return res.data
565 }
566
567 async create(
568 params: OmitKey<
569 ComAtprotoRepoCreateRecord.InputSchema,
570 'collection' | 'record'
571 >,
572 record: Un$Typed<PubLeafletPollDefinition.Record>,
573 headers?: Record<string, string>,
574 ): Promise<{ uri: string; cid: string }> {
575 const collection = 'pub.leaflet.poll.definition'
576 const res = await this._client.call(
577 'com.atproto.repo.createRecord',
578 undefined,
579 { collection, ...params, record: { ...record, $type: collection } },
580 { encoding: 'application/json', headers },
581 )
582 return res.data
583 }
584
585 async put(
586 params: OmitKey<
587 ComAtprotoRepoPutRecord.InputSchema,
588 'collection' | 'record'
589 >,
590 record: Un$Typed<PubLeafletPollDefinition.Record>,
591 headers?: Record<string, string>,
592 ): Promise<{ uri: string; cid: string }> {
593 const collection = 'pub.leaflet.poll.definition'
594 const res = await this._client.call(
595 'com.atproto.repo.putRecord',
596 undefined,
597 { collection, ...params, record: { ...record, $type: collection } },
598 { encoding: 'application/json', headers },
599 )
600 return res.data
601 }
602
603 async delete(
604 params: OmitKey<ComAtprotoRepoDeleteRecord.InputSchema, 'collection'>,
605 headers?: Record<string, string>,
606 ): Promise<void> {
607 await this._client.call(
608 'com.atproto.repo.deleteRecord',
609 undefined,
610 { collection: 'pub.leaflet.poll.definition', ...params },
611 { headers },
612 )
613 }
614}
615
616export class PubLeafletPollVoteRecord {
617 _client: XrpcClient
618
619 constructor(client: XrpcClient) {
620 this._client = client
621 }
622
623 async list(
624 params: OmitKey<ComAtprotoRepoListRecords.QueryParams, 'collection'>,
625 ): Promise<{
626 cursor?: string
627 records: { uri: string; value: PubLeafletPollVote.Record }[]
628 }> {
629 const res = await this._client.call('com.atproto.repo.listRecords', {
630 collection: 'pub.leaflet.poll.vote',
631 ...params,
632 })
633 return res.data
634 }
635
636 async get(
637 params: OmitKey<ComAtprotoRepoGetRecord.QueryParams, 'collection'>,
638 ): Promise<{ uri: string; cid: string; value: PubLeafletPollVote.Record }> {
639 const res = await this._client.call('com.atproto.repo.getRecord', {
640 collection: 'pub.leaflet.poll.vote',
641 ...params,
642 })
643 return res.data
644 }
645
646 async create(
647 params: OmitKey<
648 ComAtprotoRepoCreateRecord.InputSchema,
649 'collection' | 'record'
650 >,
651 record: Un$Typed<PubLeafletPollVote.Record>,
652 headers?: Record<string, string>,
653 ): Promise<{ uri: string; cid: string }> {
654 const collection = 'pub.leaflet.poll.vote'
655 const res = await this._client.call(
656 'com.atproto.repo.createRecord',
657 undefined,
658 { collection, ...params, record: { ...record, $type: collection } },
659 { encoding: 'application/json', headers },
660 )
661 return res.data
662 }
663
664 async put(
665 params: OmitKey<
666 ComAtprotoRepoPutRecord.InputSchema,
667 'collection' | 'record'
668 >,
669 record: Un$Typed<PubLeafletPollVote.Record>,
670 headers?: Record<string, string>,
671 ): Promise<{ uri: string; cid: string }> {
672 const collection = 'pub.leaflet.poll.vote'
673 const res = await this._client.call(
674 'com.atproto.repo.putRecord',
675 undefined,
676 { collection, ...params, record: { ...record, $type: collection } },
677 { encoding: 'application/json', headers },
678 )
679 return res.data
680 }
681
682 async delete(
683 params: OmitKey<ComAtprotoRepoDeleteRecord.InputSchema, 'collection'>,
684 headers?: Record<string, string>,
685 ): Promise<void> {
686 await this._client.call(
687 'com.atproto.repo.deleteRecord',
688 undefined,
689 { collection: 'pub.leaflet.poll.vote', ...params },
690 { headers },
691 )
692 }
693}
694
695export class PubLeafletRichtextNS {
696 _client: XrpcClient
697
698 constructor(client: XrpcClient) {
699 this._client = client
700 }
701}
702
703export class PubLeafletThemeNS {
704 _client: XrpcClient
705
706 constructor(client: XrpcClient) {
707 this._client = client
708 }
709}
710
711export class PubLeafletCommentRecord {
712 _client: XrpcClient
713
714 constructor(client: XrpcClient) {
715 this._client = client
716 }
717
718 async list(
719 params: OmitKey<ComAtprotoRepoListRecords.QueryParams, 'collection'>,
720 ): Promise<{
721 cursor?: string
722 records: { uri: string; value: PubLeafletComment.Record }[]
723 }> {
724 const res = await this._client.call('com.atproto.repo.listRecords', {
725 collection: 'pub.leaflet.comment',
726 ...params,
727 })
728 return res.data
729 }
730
731 async get(
732 params: OmitKey<ComAtprotoRepoGetRecord.QueryParams, 'collection'>,
733 ): Promise<{ uri: string; cid: string; value: PubLeafletComment.Record }> {
734 const res = await this._client.call('com.atproto.repo.getRecord', {
735 collection: 'pub.leaflet.comment',
736 ...params,
737 })
738 return res.data
739 }
740
741 async create(
742 params: OmitKey<
743 ComAtprotoRepoCreateRecord.InputSchema,
744 'collection' | 'record'
745 >,
746 record: Un$Typed<PubLeafletComment.Record>,
747 headers?: Record<string, string>,
748 ): Promise<{ uri: string; cid: string }> {
749 const collection = 'pub.leaflet.comment'
750 const res = await this._client.call(
751 'com.atproto.repo.createRecord',
752 undefined,
753 { collection, ...params, record: { ...record, $type: collection } },
754 { encoding: 'application/json', headers },
755 )
756 return res.data
757 }
758
759 async put(
760 params: OmitKey<
761 ComAtprotoRepoPutRecord.InputSchema,
762 'collection' | 'record'
763 >,
764 record: Un$Typed<PubLeafletComment.Record>,
765 headers?: Record<string, string>,
766 ): Promise<{ uri: string; cid: string }> {
767 const collection = 'pub.leaflet.comment'
768 const res = await this._client.call(
769 'com.atproto.repo.putRecord',
770 undefined,
771 { collection, ...params, record: { ...record, $type: collection } },
772 { encoding: 'application/json', headers },
773 )
774 return res.data
775 }
776
777 async delete(
778 params: OmitKey<ComAtprotoRepoDeleteRecord.InputSchema, 'collection'>,
779 headers?: Record<string, string>,
780 ): Promise<void> {
781 await this._client.call(
782 'com.atproto.repo.deleteRecord',
783 undefined,
784 { collection: 'pub.leaflet.comment', ...params },
785 { headers },
786 )
787 }
788}
789
790export class PubLeafletDocumentRecord {
791 _client: XrpcClient
792
793 constructor(client: XrpcClient) {
794 this._client = client
795 }
796
797 async list(
798 params: OmitKey<ComAtprotoRepoListRecords.QueryParams, 'collection'>,
799 ): Promise<{
800 cursor?: string
801 records: { uri: string; value: PubLeafletDocument.Record }[]
802 }> {
803 const res = await this._client.call('com.atproto.repo.listRecords', {
804 collection: 'pub.leaflet.document',
805 ...params,
806 })
807 return res.data
808 }
809
810 async get(
811 params: OmitKey<ComAtprotoRepoGetRecord.QueryParams, 'collection'>,
812 ): Promise<{ uri: string; cid: string; value: PubLeafletDocument.Record }> {
813 const res = await this._client.call('com.atproto.repo.getRecord', {
814 collection: 'pub.leaflet.document',
815 ...params,
816 })
817 return res.data
818 }
819
820 async create(
821 params: OmitKey<
822 ComAtprotoRepoCreateRecord.InputSchema,
823 'collection' | 'record'
824 >,
825 record: Un$Typed<PubLeafletDocument.Record>,
826 headers?: Record<string, string>,
827 ): Promise<{ uri: string; cid: string }> {
828 const collection = 'pub.leaflet.document'
829 const res = await this._client.call(
830 'com.atproto.repo.createRecord',
831 undefined,
832 { collection, ...params, record: { ...record, $type: collection } },
833 { encoding: 'application/json', headers },
834 )
835 return res.data
836 }
837
838 async put(
839 params: OmitKey<
840 ComAtprotoRepoPutRecord.InputSchema,
841 'collection' | 'record'
842 >,
843 record: Un$Typed<PubLeafletDocument.Record>,
844 headers?: Record<string, string>,
845 ): Promise<{ uri: string; cid: string }> {
846 const collection = 'pub.leaflet.document'
847 const res = await this._client.call(
848 'com.atproto.repo.putRecord',
849 undefined,
850 { collection, ...params, record: { ...record, $type: collection } },
851 { encoding: 'application/json', headers },
852 )
853 return res.data
854 }
855
856 async delete(
857 params: OmitKey<ComAtprotoRepoDeleteRecord.InputSchema, 'collection'>,
858 headers?: Record<string, string>,
859 ): Promise<void> {
860 await this._client.call(
861 'com.atproto.repo.deleteRecord',
862 undefined,
863 { collection: 'pub.leaflet.document', ...params },
864 { headers },
865 )
866 }
867}
868
869export class PubLeafletPublicationRecord {
870 _client: XrpcClient
871
872 constructor(client: XrpcClient) {
873 this._client = client
874 }
875
876 async list(
877 params: OmitKey<ComAtprotoRepoListRecords.QueryParams, 'collection'>,
878 ): Promise<{
879 cursor?: string
880 records: { uri: string; value: PubLeafletPublication.Record }[]
881 }> {
882 const res = await this._client.call('com.atproto.repo.listRecords', {
883 collection: 'pub.leaflet.publication',
884 ...params,
885 })
886 return res.data
887 }
888
889 async get(
890 params: OmitKey<ComAtprotoRepoGetRecord.QueryParams, 'collection'>,
891 ): Promise<{
892 uri: string
893 cid: string
894 value: PubLeafletPublication.Record
895 }> {
896 const res = await this._client.call('com.atproto.repo.getRecord', {
897 collection: 'pub.leaflet.publication',
898 ...params,
899 })
900 return res.data
901 }
902
903 async create(
904 params: OmitKey<
905 ComAtprotoRepoCreateRecord.InputSchema,
906 'collection' | 'record'
907 >,
908 record: Un$Typed<PubLeafletPublication.Record>,
909 headers?: Record<string, string>,
910 ): Promise<{ uri: string; cid: string }> {
911 const collection = 'pub.leaflet.publication'
912 const res = await this._client.call(
913 'com.atproto.repo.createRecord',
914 undefined,
915 { collection, ...params, record: { ...record, $type: collection } },
916 { encoding: 'application/json', headers },
917 )
918 return res.data
919 }
920
921 async put(
922 params: OmitKey<
923 ComAtprotoRepoPutRecord.InputSchema,
924 'collection' | 'record'
925 >,
926 record: Un$Typed<PubLeafletPublication.Record>,
927 headers?: Record<string, string>,
928 ): Promise<{ uri: string; cid: string }> {
929 const collection = 'pub.leaflet.publication'
930 const res = await this._client.call(
931 'com.atproto.repo.putRecord',
932 undefined,
933 { collection, ...params, record: { ...record, $type: collection } },
934 { encoding: 'application/json', headers },
935 )
936 return res.data
937 }
938
939 async delete(
940 params: OmitKey<ComAtprotoRepoDeleteRecord.InputSchema, 'collection'>,
941 headers?: Record<string, string>,
942 ): Promise<void> {
943 await this._client.call(
944 'com.atproto.repo.deleteRecord',
945 undefined,
946 { collection: 'pub.leaflet.publication', ...params },
947 { headers },
948 )
949 }
950}