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