a tool for shared writing and social publishing
at update/delete-blocks 1257 lines 38 kB view raw
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 PubLeafletContent from './types/pub/leaflet/content' 42import * as PubLeafletDocument from './types/pub/leaflet/document' 43import * as PubLeafletGraphSubscription from './types/pub/leaflet/graph/subscription' 44import * as PubLeafletPagesCanvas from './types/pub/leaflet/pages/canvas' 45import * as PubLeafletPagesLinearDocument from './types/pub/leaflet/pages/linearDocument' 46import * as PubLeafletPollDefinition from './types/pub/leaflet/poll/definition' 47import * as PubLeafletPollVote from './types/pub/leaflet/poll/vote' 48import * as PubLeafletPublication from './types/pub/leaflet/publication' 49import * as PubLeafletRichtextFacet from './types/pub/leaflet/richtext/facet' 50import * as PubLeafletThemeBackgroundImage from './types/pub/leaflet/theme/backgroundImage' 51import * as PubLeafletThemeColor from './types/pub/leaflet/theme/color' 52import * as SiteStandardDocument from './types/site/standard/document' 53import * as SiteStandardGraphSubscription from './types/site/standard/graph/subscription' 54import * as SiteStandardPublication from './types/site/standard/publication' 55import * as SiteStandardThemeBasic from './types/site/standard/theme/basic' 56import * as SiteStandardThemeColor from './types/site/standard/theme/color' 57 58export * as AppBskyActorProfile from './types/app/bsky/actor/profile' 59export * as ComAtprotoLabelDefs from './types/com/atproto/label/defs' 60export * as ComAtprotoRepoApplyWrites from './types/com/atproto/repo/applyWrites' 61export * as ComAtprotoRepoCreateRecord from './types/com/atproto/repo/createRecord' 62export * as ComAtprotoRepoDefs from './types/com/atproto/repo/defs' 63export * as ComAtprotoRepoDeleteRecord from './types/com/atproto/repo/deleteRecord' 64export * as ComAtprotoRepoDescribeRepo from './types/com/atproto/repo/describeRepo' 65export * as ComAtprotoRepoGetRecord from './types/com/atproto/repo/getRecord' 66export * as ComAtprotoRepoImportRepo from './types/com/atproto/repo/importRepo' 67export * as ComAtprotoRepoListMissingBlobs from './types/com/atproto/repo/listMissingBlobs' 68export * as ComAtprotoRepoListRecords from './types/com/atproto/repo/listRecords' 69export * as ComAtprotoRepoPutRecord from './types/com/atproto/repo/putRecord' 70export * as ComAtprotoRepoStrongRef from './types/com/atproto/repo/strongRef' 71export * as ComAtprotoRepoUploadBlob from './types/com/atproto/repo/uploadBlob' 72export * as PubLeafletBlocksBlockquote from './types/pub/leaflet/blocks/blockquote' 73export * as PubLeafletBlocksBskyPost from './types/pub/leaflet/blocks/bskyPost' 74export * as PubLeafletBlocksButton from './types/pub/leaflet/blocks/button' 75export * as PubLeafletBlocksCode from './types/pub/leaflet/blocks/code' 76export * as PubLeafletBlocksHeader from './types/pub/leaflet/blocks/header' 77export * as PubLeafletBlocksHorizontalRule from './types/pub/leaflet/blocks/horizontalRule' 78export * as PubLeafletBlocksIframe from './types/pub/leaflet/blocks/iframe' 79export * as PubLeafletBlocksImage from './types/pub/leaflet/blocks/image' 80export * as PubLeafletBlocksMath from './types/pub/leaflet/blocks/math' 81export * as PubLeafletBlocksPage from './types/pub/leaflet/blocks/page' 82export * as PubLeafletBlocksPoll from './types/pub/leaflet/blocks/poll' 83export * as PubLeafletBlocksText from './types/pub/leaflet/blocks/text' 84export * as PubLeafletBlocksUnorderedList from './types/pub/leaflet/blocks/unorderedList' 85export * as PubLeafletBlocksWebsite from './types/pub/leaflet/blocks/website' 86export * as PubLeafletComment from './types/pub/leaflet/comment' 87export * as PubLeafletContent from './types/pub/leaflet/content' 88export * as PubLeafletDocument from './types/pub/leaflet/document' 89export * as PubLeafletGraphSubscription from './types/pub/leaflet/graph/subscription' 90export * as PubLeafletPagesCanvas from './types/pub/leaflet/pages/canvas' 91export * as PubLeafletPagesLinearDocument from './types/pub/leaflet/pages/linearDocument' 92export * as PubLeafletPollDefinition from './types/pub/leaflet/poll/definition' 93export * as PubLeafletPollVote from './types/pub/leaflet/poll/vote' 94export * as PubLeafletPublication from './types/pub/leaflet/publication' 95export * as PubLeafletRichtextFacet from './types/pub/leaflet/richtext/facet' 96export * as PubLeafletThemeBackgroundImage from './types/pub/leaflet/theme/backgroundImage' 97export * as PubLeafletThemeColor from './types/pub/leaflet/theme/color' 98export * as SiteStandardDocument from './types/site/standard/document' 99export * as SiteStandardGraphSubscription from './types/site/standard/graph/subscription' 100export * as SiteStandardPublication from './types/site/standard/publication' 101export * as SiteStandardThemeBasic from './types/site/standard/theme/basic' 102export * as SiteStandardThemeColor from './types/site/standard/theme/color' 103 104export const PUB_LEAFLET_PAGES = { 105 CanvasTextAlignLeft: 'pub.leaflet.pages.canvas#textAlignLeft', 106 CanvasTextAlignCenter: 'pub.leaflet.pages.canvas#textAlignCenter', 107 CanvasTextAlignRight: 'pub.leaflet.pages.canvas#textAlignRight', 108 LinearDocumentTextAlignLeft: 'pub.leaflet.pages.linearDocument#textAlignLeft', 109 LinearDocumentTextAlignCenter: 110 'pub.leaflet.pages.linearDocument#textAlignCenter', 111 LinearDocumentTextAlignRight: 112 'pub.leaflet.pages.linearDocument#textAlignRight', 113 LinearDocumentTextAlignJustify: 114 'pub.leaflet.pages.linearDocument#textAlignJustify', 115} 116 117export class AtpBaseClient extends XrpcClient { 118 app: AppNS 119 com: ComNS 120 pub: PubNS 121 site: SiteNS 122 123 constructor(options: FetchHandler | FetchHandlerOptions) { 124 super(options, schemas) 125 this.app = new AppNS(this) 126 this.com = new ComNS(this) 127 this.pub = new PubNS(this) 128 this.site = new SiteNS(this) 129 } 130 131 /** @deprecated use `this` instead */ 132 get xrpc(): XrpcClient { 133 return this 134 } 135} 136 137export class AppNS { 138 _client: XrpcClient 139 bsky: AppBskyNS 140 141 constructor(client: XrpcClient) { 142 this._client = client 143 this.bsky = new AppBskyNS(client) 144 } 145} 146 147export class AppBskyNS { 148 _client: XrpcClient 149 actor: AppBskyActorNS 150 151 constructor(client: XrpcClient) { 152 this._client = client 153 this.actor = new AppBskyActorNS(client) 154 } 155} 156 157export class AppBskyActorNS { 158 _client: XrpcClient 159 profile: AppBskyActorProfileRecord 160 161 constructor(client: XrpcClient) { 162 this._client = client 163 this.profile = new AppBskyActorProfileRecord(client) 164 } 165} 166 167export class AppBskyActorProfileRecord { 168 _client: XrpcClient 169 170 constructor(client: XrpcClient) { 171 this._client = client 172 } 173 174 async list( 175 params: OmitKey<ComAtprotoRepoListRecords.QueryParams, 'collection'>, 176 ): Promise<{ 177 cursor?: string 178 records: { uri: string; value: AppBskyActorProfile.Record }[] 179 }> { 180 const res = await this._client.call('com.atproto.repo.listRecords', { 181 collection: 'app.bsky.actor.profile', 182 ...params, 183 }) 184 return res.data 185 } 186 187 async get( 188 params: OmitKey<ComAtprotoRepoGetRecord.QueryParams, 'collection'>, 189 ): Promise<{ uri: string; cid: string; value: AppBskyActorProfile.Record }> { 190 const res = await this._client.call('com.atproto.repo.getRecord', { 191 collection: 'app.bsky.actor.profile', 192 ...params, 193 }) 194 return res.data 195 } 196 197 async create( 198 params: OmitKey< 199 ComAtprotoRepoCreateRecord.InputSchema, 200 'collection' | 'record' 201 >, 202 record: Un$Typed<AppBskyActorProfile.Record>, 203 headers?: Record<string, string>, 204 ): Promise<{ uri: string; cid: string }> { 205 const collection = 'app.bsky.actor.profile' 206 const res = await this._client.call( 207 'com.atproto.repo.createRecord', 208 undefined, 209 { 210 collection, 211 rkey: 'self', 212 ...params, 213 record: { ...record, $type: collection }, 214 }, 215 { encoding: 'application/json', headers }, 216 ) 217 return res.data 218 } 219 220 async put( 221 params: OmitKey< 222 ComAtprotoRepoPutRecord.InputSchema, 223 'collection' | 'record' 224 >, 225 record: Un$Typed<AppBskyActorProfile.Record>, 226 headers?: Record<string, string>, 227 ): Promise<{ uri: string; cid: string }> { 228 const collection = 'app.bsky.actor.profile' 229 const res = await this._client.call( 230 'com.atproto.repo.putRecord', 231 undefined, 232 { collection, ...params, record: { ...record, $type: collection } }, 233 { encoding: 'application/json', headers }, 234 ) 235 return res.data 236 } 237 238 async delete( 239 params: OmitKey<ComAtprotoRepoDeleteRecord.InputSchema, 'collection'>, 240 headers?: Record<string, string>, 241 ): Promise<void> { 242 await this._client.call( 243 'com.atproto.repo.deleteRecord', 244 undefined, 245 { collection: 'app.bsky.actor.profile', ...params }, 246 { headers }, 247 ) 248 } 249} 250 251export class ComNS { 252 _client: XrpcClient 253 atproto: ComAtprotoNS 254 255 constructor(client: XrpcClient) { 256 this._client = client 257 this.atproto = new ComAtprotoNS(client) 258 } 259} 260 261export class ComAtprotoNS { 262 _client: XrpcClient 263 repo: ComAtprotoRepoNS 264 265 constructor(client: XrpcClient) { 266 this._client = client 267 this.repo = new ComAtprotoRepoNS(client) 268 } 269} 270 271export class ComAtprotoRepoNS { 272 _client: XrpcClient 273 274 constructor(client: XrpcClient) { 275 this._client = client 276 } 277 278 applyWrites( 279 data?: ComAtprotoRepoApplyWrites.InputSchema, 280 opts?: ComAtprotoRepoApplyWrites.CallOptions, 281 ): Promise<ComAtprotoRepoApplyWrites.Response> { 282 return this._client 283 .call('com.atproto.repo.applyWrites', opts?.qp, data, opts) 284 .catch((e) => { 285 throw ComAtprotoRepoApplyWrites.toKnownErr(e) 286 }) 287 } 288 289 createRecord( 290 data?: ComAtprotoRepoCreateRecord.InputSchema, 291 opts?: ComAtprotoRepoCreateRecord.CallOptions, 292 ): Promise<ComAtprotoRepoCreateRecord.Response> { 293 return this._client 294 .call('com.atproto.repo.createRecord', opts?.qp, data, opts) 295 .catch((e) => { 296 throw ComAtprotoRepoCreateRecord.toKnownErr(e) 297 }) 298 } 299 300 deleteRecord( 301 data?: ComAtprotoRepoDeleteRecord.InputSchema, 302 opts?: ComAtprotoRepoDeleteRecord.CallOptions, 303 ): Promise<ComAtprotoRepoDeleteRecord.Response> { 304 return this._client 305 .call('com.atproto.repo.deleteRecord', opts?.qp, data, opts) 306 .catch((e) => { 307 throw ComAtprotoRepoDeleteRecord.toKnownErr(e) 308 }) 309 } 310 311 describeRepo( 312 params?: ComAtprotoRepoDescribeRepo.QueryParams, 313 opts?: ComAtprotoRepoDescribeRepo.CallOptions, 314 ): Promise<ComAtprotoRepoDescribeRepo.Response> { 315 return this._client.call( 316 'com.atproto.repo.describeRepo', 317 params, 318 undefined, 319 opts, 320 ) 321 } 322 323 getRecord( 324 params?: ComAtprotoRepoGetRecord.QueryParams, 325 opts?: ComAtprotoRepoGetRecord.CallOptions, 326 ): Promise<ComAtprotoRepoGetRecord.Response> { 327 return this._client 328 .call('com.atproto.repo.getRecord', params, undefined, opts) 329 .catch((e) => { 330 throw ComAtprotoRepoGetRecord.toKnownErr(e) 331 }) 332 } 333 334 importRepo( 335 data?: ComAtprotoRepoImportRepo.InputSchema, 336 opts?: ComAtprotoRepoImportRepo.CallOptions, 337 ): Promise<ComAtprotoRepoImportRepo.Response> { 338 return this._client.call( 339 'com.atproto.repo.importRepo', 340 opts?.qp, 341 data, 342 opts, 343 ) 344 } 345 346 listMissingBlobs( 347 params?: ComAtprotoRepoListMissingBlobs.QueryParams, 348 opts?: ComAtprotoRepoListMissingBlobs.CallOptions, 349 ): Promise<ComAtprotoRepoListMissingBlobs.Response> { 350 return this._client.call( 351 'com.atproto.repo.listMissingBlobs', 352 params, 353 undefined, 354 opts, 355 ) 356 } 357 358 listRecords( 359 params?: ComAtprotoRepoListRecords.QueryParams, 360 opts?: ComAtprotoRepoListRecords.CallOptions, 361 ): Promise<ComAtprotoRepoListRecords.Response> { 362 return this._client.call( 363 'com.atproto.repo.listRecords', 364 params, 365 undefined, 366 opts, 367 ) 368 } 369 370 putRecord( 371 data?: ComAtprotoRepoPutRecord.InputSchema, 372 opts?: ComAtprotoRepoPutRecord.CallOptions, 373 ): Promise<ComAtprotoRepoPutRecord.Response> { 374 return this._client 375 .call('com.atproto.repo.putRecord', opts?.qp, data, opts) 376 .catch((e) => { 377 throw ComAtprotoRepoPutRecord.toKnownErr(e) 378 }) 379 } 380 381 uploadBlob( 382 data?: ComAtprotoRepoUploadBlob.InputSchema, 383 opts?: ComAtprotoRepoUploadBlob.CallOptions, 384 ): Promise<ComAtprotoRepoUploadBlob.Response> { 385 return this._client.call( 386 'com.atproto.repo.uploadBlob', 387 opts?.qp, 388 data, 389 opts, 390 ) 391 } 392} 393 394export class PubNS { 395 _client: XrpcClient 396 leaflet: PubLeafletNS 397 398 constructor(client: XrpcClient) { 399 this._client = client 400 this.leaflet = new PubLeafletNS(client) 401 } 402} 403 404export class PubLeafletNS { 405 _client: XrpcClient 406 comment: PubLeafletCommentRecord 407 document: PubLeafletDocumentRecord 408 publication: PubLeafletPublicationRecord 409 blocks: PubLeafletBlocksNS 410 graph: PubLeafletGraphNS 411 pages: PubLeafletPagesNS 412 poll: PubLeafletPollNS 413 richtext: PubLeafletRichtextNS 414 theme: PubLeafletThemeNS 415 416 constructor(client: XrpcClient) { 417 this._client = client 418 this.blocks = new PubLeafletBlocksNS(client) 419 this.graph = new PubLeafletGraphNS(client) 420 this.pages = new PubLeafletPagesNS(client) 421 this.poll = new PubLeafletPollNS(client) 422 this.richtext = new PubLeafletRichtextNS(client) 423 this.theme = new PubLeafletThemeNS(client) 424 this.comment = new PubLeafletCommentRecord(client) 425 this.document = new PubLeafletDocumentRecord(client) 426 this.publication = new PubLeafletPublicationRecord(client) 427 } 428} 429 430export class PubLeafletBlocksNS { 431 _client: XrpcClient 432 433 constructor(client: XrpcClient) { 434 this._client = client 435 } 436} 437 438export class PubLeafletGraphNS { 439 _client: XrpcClient 440 subscription: PubLeafletGraphSubscriptionRecord 441 442 constructor(client: XrpcClient) { 443 this._client = client 444 this.subscription = new PubLeafletGraphSubscriptionRecord(client) 445 } 446} 447 448export class PubLeafletGraphSubscriptionRecord { 449 _client: XrpcClient 450 451 constructor(client: XrpcClient) { 452 this._client = client 453 } 454 455 async list( 456 params: OmitKey<ComAtprotoRepoListRecords.QueryParams, 'collection'>, 457 ): Promise<{ 458 cursor?: string 459 records: { uri: string; value: PubLeafletGraphSubscription.Record }[] 460 }> { 461 const res = await this._client.call('com.atproto.repo.listRecords', { 462 collection: 'pub.leaflet.graph.subscription', 463 ...params, 464 }) 465 return res.data 466 } 467 468 async get( 469 params: OmitKey<ComAtprotoRepoGetRecord.QueryParams, 'collection'>, 470 ): Promise<{ 471 uri: string 472 cid: string 473 value: PubLeafletGraphSubscription.Record 474 }> { 475 const res = await this._client.call('com.atproto.repo.getRecord', { 476 collection: 'pub.leaflet.graph.subscription', 477 ...params, 478 }) 479 return res.data 480 } 481 482 async create( 483 params: OmitKey< 484 ComAtprotoRepoCreateRecord.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.createRecord', 493 undefined, 494 { collection, ...params, record: { ...record, $type: collection } }, 495 { encoding: 'application/json', headers }, 496 ) 497 return res.data 498 } 499 500 async put( 501 params: OmitKey< 502 ComAtprotoRepoPutRecord.InputSchema, 503 'collection' | 'record' 504 >, 505 record: Un$Typed<PubLeafletGraphSubscription.Record>, 506 headers?: Record<string, string>, 507 ): Promise<{ uri: string; cid: string }> { 508 const collection = 'pub.leaflet.graph.subscription' 509 const res = await this._client.call( 510 'com.atproto.repo.putRecord', 511 undefined, 512 { collection, ...params, record: { ...record, $type: collection } }, 513 { encoding: 'application/json', headers }, 514 ) 515 return res.data 516 } 517 518 async delete( 519 params: OmitKey<ComAtprotoRepoDeleteRecord.InputSchema, 'collection'>, 520 headers?: Record<string, string>, 521 ): Promise<void> { 522 await this._client.call( 523 'com.atproto.repo.deleteRecord', 524 undefined, 525 { collection: 'pub.leaflet.graph.subscription', ...params }, 526 { headers }, 527 ) 528 } 529} 530 531export class PubLeafletPagesNS { 532 _client: XrpcClient 533 534 constructor(client: XrpcClient) { 535 this._client = client 536 } 537} 538 539export class PubLeafletPollNS { 540 _client: XrpcClient 541 definition: PubLeafletPollDefinitionRecord 542 vote: PubLeafletPollVoteRecord 543 544 constructor(client: XrpcClient) { 545 this._client = client 546 this.definition = new PubLeafletPollDefinitionRecord(client) 547 this.vote = new PubLeafletPollVoteRecord(client) 548 } 549} 550 551export class PubLeafletPollDefinitionRecord { 552 _client: XrpcClient 553 554 constructor(client: XrpcClient) { 555 this._client = client 556 } 557 558 async list( 559 params: OmitKey<ComAtprotoRepoListRecords.QueryParams, 'collection'>, 560 ): Promise<{ 561 cursor?: string 562 records: { uri: string; value: PubLeafletPollDefinition.Record }[] 563 }> { 564 const res = await this._client.call('com.atproto.repo.listRecords', { 565 collection: 'pub.leaflet.poll.definition', 566 ...params, 567 }) 568 return res.data 569 } 570 571 async get( 572 params: OmitKey<ComAtprotoRepoGetRecord.QueryParams, 'collection'>, 573 ): Promise<{ 574 uri: string 575 cid: string 576 value: PubLeafletPollDefinition.Record 577 }> { 578 const res = await this._client.call('com.atproto.repo.getRecord', { 579 collection: 'pub.leaflet.poll.definition', 580 ...params, 581 }) 582 return res.data 583 } 584 585 async create( 586 params: OmitKey< 587 ComAtprotoRepoCreateRecord.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.createRecord', 596 undefined, 597 { collection, ...params, record: { ...record, $type: collection } }, 598 { encoding: 'application/json', headers }, 599 ) 600 return res.data 601 } 602 603 async put( 604 params: OmitKey< 605 ComAtprotoRepoPutRecord.InputSchema, 606 'collection' | 'record' 607 >, 608 record: Un$Typed<PubLeafletPollDefinition.Record>, 609 headers?: Record<string, string>, 610 ): Promise<{ uri: string; cid: string }> { 611 const collection = 'pub.leaflet.poll.definition' 612 const res = await this._client.call( 613 'com.atproto.repo.putRecord', 614 undefined, 615 { collection, ...params, record: { ...record, $type: collection } }, 616 { encoding: 'application/json', headers }, 617 ) 618 return res.data 619 } 620 621 async delete( 622 params: OmitKey<ComAtprotoRepoDeleteRecord.InputSchema, 'collection'>, 623 headers?: Record<string, string>, 624 ): Promise<void> { 625 await this._client.call( 626 'com.atproto.repo.deleteRecord', 627 undefined, 628 { collection: 'pub.leaflet.poll.definition', ...params }, 629 { headers }, 630 ) 631 } 632} 633 634export class PubLeafletPollVoteRecord { 635 _client: XrpcClient 636 637 constructor(client: XrpcClient) { 638 this._client = client 639 } 640 641 async list( 642 params: OmitKey<ComAtprotoRepoListRecords.QueryParams, 'collection'>, 643 ): Promise<{ 644 cursor?: string 645 records: { uri: string; value: PubLeafletPollVote.Record }[] 646 }> { 647 const res = await this._client.call('com.atproto.repo.listRecords', { 648 collection: 'pub.leaflet.poll.vote', 649 ...params, 650 }) 651 return res.data 652 } 653 654 async get( 655 params: OmitKey<ComAtprotoRepoGetRecord.QueryParams, 'collection'>, 656 ): Promise<{ uri: string; cid: string; value: PubLeafletPollVote.Record }> { 657 const res = await this._client.call('com.atproto.repo.getRecord', { 658 collection: 'pub.leaflet.poll.vote', 659 ...params, 660 }) 661 return res.data 662 } 663 664 async create( 665 params: OmitKey< 666 ComAtprotoRepoCreateRecord.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.createRecord', 675 undefined, 676 { collection, ...params, record: { ...record, $type: collection } }, 677 { encoding: 'application/json', headers }, 678 ) 679 return res.data 680 } 681 682 async put( 683 params: OmitKey< 684 ComAtprotoRepoPutRecord.InputSchema, 685 'collection' | 'record' 686 >, 687 record: Un$Typed<PubLeafletPollVote.Record>, 688 headers?: Record<string, string>, 689 ): Promise<{ uri: string; cid: string }> { 690 const collection = 'pub.leaflet.poll.vote' 691 const res = await this._client.call( 692 'com.atproto.repo.putRecord', 693 undefined, 694 { collection, ...params, record: { ...record, $type: collection } }, 695 { encoding: 'application/json', headers }, 696 ) 697 return res.data 698 } 699 700 async delete( 701 params: OmitKey<ComAtprotoRepoDeleteRecord.InputSchema, 'collection'>, 702 headers?: Record<string, string>, 703 ): Promise<void> { 704 await this._client.call( 705 'com.atproto.repo.deleteRecord', 706 undefined, 707 { collection: 'pub.leaflet.poll.vote', ...params }, 708 { headers }, 709 ) 710 } 711} 712 713export class PubLeafletRichtextNS { 714 _client: XrpcClient 715 716 constructor(client: XrpcClient) { 717 this._client = client 718 } 719} 720 721export class PubLeafletThemeNS { 722 _client: XrpcClient 723 724 constructor(client: XrpcClient) { 725 this._client = client 726 } 727} 728 729export class PubLeafletCommentRecord { 730 _client: XrpcClient 731 732 constructor(client: XrpcClient) { 733 this._client = client 734 } 735 736 async list( 737 params: OmitKey<ComAtprotoRepoListRecords.QueryParams, 'collection'>, 738 ): Promise<{ 739 cursor?: string 740 records: { uri: string; value: PubLeafletComment.Record }[] 741 }> { 742 const res = await this._client.call('com.atproto.repo.listRecords', { 743 collection: 'pub.leaflet.comment', 744 ...params, 745 }) 746 return res.data 747 } 748 749 async get( 750 params: OmitKey<ComAtprotoRepoGetRecord.QueryParams, 'collection'>, 751 ): Promise<{ uri: string; cid: string; value: PubLeafletComment.Record }> { 752 const res = await this._client.call('com.atproto.repo.getRecord', { 753 collection: 'pub.leaflet.comment', 754 ...params, 755 }) 756 return res.data 757 } 758 759 async create( 760 params: OmitKey< 761 ComAtprotoRepoCreateRecord.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.createRecord', 770 undefined, 771 { collection, ...params, record: { ...record, $type: collection } }, 772 { encoding: 'application/json', headers }, 773 ) 774 return res.data 775 } 776 777 async put( 778 params: OmitKey< 779 ComAtprotoRepoPutRecord.InputSchema, 780 'collection' | 'record' 781 >, 782 record: Un$Typed<PubLeafletComment.Record>, 783 headers?: Record<string, string>, 784 ): Promise<{ uri: string; cid: string }> { 785 const collection = 'pub.leaflet.comment' 786 const res = await this._client.call( 787 'com.atproto.repo.putRecord', 788 undefined, 789 { collection, ...params, record: { ...record, $type: collection } }, 790 { encoding: 'application/json', headers }, 791 ) 792 return res.data 793 } 794 795 async delete( 796 params: OmitKey<ComAtprotoRepoDeleteRecord.InputSchema, 'collection'>, 797 headers?: Record<string, string>, 798 ): Promise<void> { 799 await this._client.call( 800 'com.atproto.repo.deleteRecord', 801 undefined, 802 { collection: 'pub.leaflet.comment', ...params }, 803 { headers }, 804 ) 805 } 806} 807 808export class PubLeafletDocumentRecord { 809 _client: XrpcClient 810 811 constructor(client: XrpcClient) { 812 this._client = client 813 } 814 815 async list( 816 params: OmitKey<ComAtprotoRepoListRecords.QueryParams, 'collection'>, 817 ): Promise<{ 818 cursor?: string 819 records: { uri: string; value: PubLeafletDocument.Record }[] 820 }> { 821 const res = await this._client.call('com.atproto.repo.listRecords', { 822 collection: 'pub.leaflet.document', 823 ...params, 824 }) 825 return res.data 826 } 827 828 async get( 829 params: OmitKey<ComAtprotoRepoGetRecord.QueryParams, 'collection'>, 830 ): Promise<{ uri: string; cid: string; value: PubLeafletDocument.Record }> { 831 const res = await this._client.call('com.atproto.repo.getRecord', { 832 collection: 'pub.leaflet.document', 833 ...params, 834 }) 835 return res.data 836 } 837 838 async create( 839 params: OmitKey< 840 ComAtprotoRepoCreateRecord.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.createRecord', 849 undefined, 850 { collection, ...params, record: { ...record, $type: collection } }, 851 { encoding: 'application/json', headers }, 852 ) 853 return res.data 854 } 855 856 async put( 857 params: OmitKey< 858 ComAtprotoRepoPutRecord.InputSchema, 859 'collection' | 'record' 860 >, 861 record: Un$Typed<PubLeafletDocument.Record>, 862 headers?: Record<string, string>, 863 ): Promise<{ uri: string; cid: string }> { 864 const collection = 'pub.leaflet.document' 865 const res = await this._client.call( 866 'com.atproto.repo.putRecord', 867 undefined, 868 { collection, ...params, record: { ...record, $type: collection } }, 869 { encoding: 'application/json', headers }, 870 ) 871 return res.data 872 } 873 874 async delete( 875 params: OmitKey<ComAtprotoRepoDeleteRecord.InputSchema, 'collection'>, 876 headers?: Record<string, string>, 877 ): Promise<void> { 878 await this._client.call( 879 'com.atproto.repo.deleteRecord', 880 undefined, 881 { collection: 'pub.leaflet.document', ...params }, 882 { headers }, 883 ) 884 } 885} 886 887export class PubLeafletPublicationRecord { 888 _client: XrpcClient 889 890 constructor(client: XrpcClient) { 891 this._client = client 892 } 893 894 async list( 895 params: OmitKey<ComAtprotoRepoListRecords.QueryParams, 'collection'>, 896 ): Promise<{ 897 cursor?: string 898 records: { uri: string; value: PubLeafletPublication.Record }[] 899 }> { 900 const res = await this._client.call('com.atproto.repo.listRecords', { 901 collection: 'pub.leaflet.publication', 902 ...params, 903 }) 904 return res.data 905 } 906 907 async get( 908 params: OmitKey<ComAtprotoRepoGetRecord.QueryParams, 'collection'>, 909 ): Promise<{ 910 uri: string 911 cid: string 912 value: PubLeafletPublication.Record 913 }> { 914 const res = await this._client.call('com.atproto.repo.getRecord', { 915 collection: 'pub.leaflet.publication', 916 ...params, 917 }) 918 return res.data 919 } 920 921 async create( 922 params: OmitKey< 923 ComAtprotoRepoCreateRecord.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.createRecord', 932 undefined, 933 { collection, ...params, record: { ...record, $type: collection } }, 934 { encoding: 'application/json', headers }, 935 ) 936 return res.data 937 } 938 939 async put( 940 params: OmitKey< 941 ComAtprotoRepoPutRecord.InputSchema, 942 'collection' | 'record' 943 >, 944 record: Un$Typed<PubLeafletPublication.Record>, 945 headers?: Record<string, string>, 946 ): Promise<{ uri: string; cid: string }> { 947 const collection = 'pub.leaflet.publication' 948 const res = await this._client.call( 949 'com.atproto.repo.putRecord', 950 undefined, 951 { collection, ...params, record: { ...record, $type: collection } }, 952 { encoding: 'application/json', headers }, 953 ) 954 return res.data 955 } 956 957 async delete( 958 params: OmitKey<ComAtprotoRepoDeleteRecord.InputSchema, 'collection'>, 959 headers?: Record<string, string>, 960 ): Promise<void> { 961 await this._client.call( 962 'com.atproto.repo.deleteRecord', 963 undefined, 964 { collection: 'pub.leaflet.publication', ...params }, 965 { headers }, 966 ) 967 } 968} 969 970export class SiteNS { 971 _client: XrpcClient 972 standard: SiteStandardNS 973 974 constructor(client: XrpcClient) { 975 this._client = client 976 this.standard = new SiteStandardNS(client) 977 } 978} 979 980export class SiteStandardNS { 981 _client: XrpcClient 982 document: SiteStandardDocumentRecord 983 publication: SiteStandardPublicationRecord 984 graph: SiteStandardGraphNS 985 theme: SiteStandardThemeNS 986 987 constructor(client: XrpcClient) { 988 this._client = client 989 this.graph = new SiteStandardGraphNS(client) 990 this.theme = new SiteStandardThemeNS(client) 991 this.document = new SiteStandardDocumentRecord(client) 992 this.publication = new SiteStandardPublicationRecord(client) 993 } 994} 995 996export class SiteStandardGraphNS { 997 _client: XrpcClient 998 subscription: SiteStandardGraphSubscriptionRecord 999 1000 constructor(client: XrpcClient) { 1001 this._client = client 1002 this.subscription = new SiteStandardGraphSubscriptionRecord(client) 1003 } 1004} 1005 1006export class SiteStandardGraphSubscriptionRecord { 1007 _client: XrpcClient 1008 1009 constructor(client: XrpcClient) { 1010 this._client = client 1011 } 1012 1013 async list( 1014 params: OmitKey<ComAtprotoRepoListRecords.QueryParams, 'collection'>, 1015 ): Promise<{ 1016 cursor?: string 1017 records: { uri: string; value: SiteStandardGraphSubscription.Record }[] 1018 }> { 1019 const res = await this._client.call('com.atproto.repo.listRecords', { 1020 collection: 'site.standard.graph.subscription', 1021 ...params, 1022 }) 1023 return res.data 1024 } 1025 1026 async get( 1027 params: OmitKey<ComAtprotoRepoGetRecord.QueryParams, 'collection'>, 1028 ): Promise<{ 1029 uri: string 1030 cid: string 1031 value: SiteStandardGraphSubscription.Record 1032 }> { 1033 const res = await this._client.call('com.atproto.repo.getRecord', { 1034 collection: 'site.standard.graph.subscription', 1035 ...params, 1036 }) 1037 return res.data 1038 } 1039 1040 async create( 1041 params: OmitKey< 1042 ComAtprotoRepoCreateRecord.InputSchema, 1043 'collection' | 'record' 1044 >, 1045 record: Un$Typed<SiteStandardGraphSubscription.Record>, 1046 headers?: Record<string, string>, 1047 ): Promise<{ uri: string; cid: string }> { 1048 const collection = 'site.standard.graph.subscription' 1049 const res = await this._client.call( 1050 'com.atproto.repo.createRecord', 1051 undefined, 1052 { collection, ...params, record: { ...record, $type: collection } }, 1053 { encoding: 'application/json', headers }, 1054 ) 1055 return res.data 1056 } 1057 1058 async put( 1059 params: OmitKey< 1060 ComAtprotoRepoPutRecord.InputSchema, 1061 'collection' | 'record' 1062 >, 1063 record: Un$Typed<SiteStandardGraphSubscription.Record>, 1064 headers?: Record<string, string>, 1065 ): Promise<{ uri: string; cid: string }> { 1066 const collection = 'site.standard.graph.subscription' 1067 const res = await this._client.call( 1068 'com.atproto.repo.putRecord', 1069 undefined, 1070 { collection, ...params, record: { ...record, $type: collection } }, 1071 { encoding: 'application/json', headers }, 1072 ) 1073 return res.data 1074 } 1075 1076 async delete( 1077 params: OmitKey<ComAtprotoRepoDeleteRecord.InputSchema, 'collection'>, 1078 headers?: Record<string, string>, 1079 ): Promise<void> { 1080 await this._client.call( 1081 'com.atproto.repo.deleteRecord', 1082 undefined, 1083 { collection: 'site.standard.graph.subscription', ...params }, 1084 { headers }, 1085 ) 1086 } 1087} 1088 1089export class SiteStandardThemeNS { 1090 _client: XrpcClient 1091 1092 constructor(client: XrpcClient) { 1093 this._client = client 1094 } 1095} 1096 1097export class SiteStandardDocumentRecord { 1098 _client: XrpcClient 1099 1100 constructor(client: XrpcClient) { 1101 this._client = client 1102 } 1103 1104 async list( 1105 params: OmitKey<ComAtprotoRepoListRecords.QueryParams, 'collection'>, 1106 ): Promise<{ 1107 cursor?: string 1108 records: { uri: string; value: SiteStandardDocument.Record }[] 1109 }> { 1110 const res = await this._client.call('com.atproto.repo.listRecords', { 1111 collection: 'site.standard.document', 1112 ...params, 1113 }) 1114 return res.data 1115 } 1116 1117 async get( 1118 params: OmitKey<ComAtprotoRepoGetRecord.QueryParams, 'collection'>, 1119 ): Promise<{ uri: string; cid: string; value: SiteStandardDocument.Record }> { 1120 const res = await this._client.call('com.atproto.repo.getRecord', { 1121 collection: 'site.standard.document', 1122 ...params, 1123 }) 1124 return res.data 1125 } 1126 1127 async create( 1128 params: OmitKey< 1129 ComAtprotoRepoCreateRecord.InputSchema, 1130 'collection' | 'record' 1131 >, 1132 record: Un$Typed<SiteStandardDocument.Record>, 1133 headers?: Record<string, string>, 1134 ): Promise<{ uri: string; cid: string }> { 1135 const collection = 'site.standard.document' 1136 const res = await this._client.call( 1137 'com.atproto.repo.createRecord', 1138 undefined, 1139 { collection, ...params, record: { ...record, $type: collection } }, 1140 { encoding: 'application/json', headers }, 1141 ) 1142 return res.data 1143 } 1144 1145 async put( 1146 params: OmitKey< 1147 ComAtprotoRepoPutRecord.InputSchema, 1148 'collection' | 'record' 1149 >, 1150 record: Un$Typed<SiteStandardDocument.Record>, 1151 headers?: Record<string, string>, 1152 ): Promise<{ uri: string; cid: string }> { 1153 const collection = 'site.standard.document' 1154 const res = await this._client.call( 1155 'com.atproto.repo.putRecord', 1156 undefined, 1157 { collection, ...params, record: { ...record, $type: collection } }, 1158 { encoding: 'application/json', headers }, 1159 ) 1160 return res.data 1161 } 1162 1163 async delete( 1164 params: OmitKey<ComAtprotoRepoDeleteRecord.InputSchema, 'collection'>, 1165 headers?: Record<string, string>, 1166 ): Promise<void> { 1167 await this._client.call( 1168 'com.atproto.repo.deleteRecord', 1169 undefined, 1170 { collection: 'site.standard.document', ...params }, 1171 { headers }, 1172 ) 1173 } 1174} 1175 1176export class SiteStandardPublicationRecord { 1177 _client: XrpcClient 1178 1179 constructor(client: XrpcClient) { 1180 this._client = client 1181 } 1182 1183 async list( 1184 params: OmitKey<ComAtprotoRepoListRecords.QueryParams, 'collection'>, 1185 ): Promise<{ 1186 cursor?: string 1187 records: { uri: string; value: SiteStandardPublication.Record }[] 1188 }> { 1189 const res = await this._client.call('com.atproto.repo.listRecords', { 1190 collection: 'site.standard.publication', 1191 ...params, 1192 }) 1193 return res.data 1194 } 1195 1196 async get( 1197 params: OmitKey<ComAtprotoRepoGetRecord.QueryParams, 'collection'>, 1198 ): Promise<{ 1199 uri: string 1200 cid: string 1201 value: SiteStandardPublication.Record 1202 }> { 1203 const res = await this._client.call('com.atproto.repo.getRecord', { 1204 collection: 'site.standard.publication', 1205 ...params, 1206 }) 1207 return res.data 1208 } 1209 1210 async create( 1211 params: OmitKey< 1212 ComAtprotoRepoCreateRecord.InputSchema, 1213 'collection' | 'record' 1214 >, 1215 record: Un$Typed<SiteStandardPublication.Record>, 1216 headers?: Record<string, string>, 1217 ): Promise<{ uri: string; cid: string }> { 1218 const collection = 'site.standard.publication' 1219 const res = await this._client.call( 1220 'com.atproto.repo.createRecord', 1221 undefined, 1222 { collection, ...params, record: { ...record, $type: collection } }, 1223 { encoding: 'application/json', headers }, 1224 ) 1225 return res.data 1226 } 1227 1228 async put( 1229 params: OmitKey< 1230 ComAtprotoRepoPutRecord.InputSchema, 1231 'collection' | 'record' 1232 >, 1233 record: Un$Typed<SiteStandardPublication.Record>, 1234 headers?: Record<string, string>, 1235 ): Promise<{ uri: string; cid: string }> { 1236 const collection = 'site.standard.publication' 1237 const res = await this._client.call( 1238 'com.atproto.repo.putRecord', 1239 undefined, 1240 { collection, ...params, record: { ...record, $type: collection } }, 1241 { encoding: 'application/json', headers }, 1242 ) 1243 return res.data 1244 } 1245 1246 async delete( 1247 params: OmitKey<ComAtprotoRepoDeleteRecord.InputSchema, 'collection'>, 1248 headers?: Record<string, string>, 1249 ): Promise<void> { 1250 await this._client.call( 1251 'com.atproto.repo.deleteRecord', 1252 undefined, 1253 { collection: 'site.standard.publication', ...params }, 1254 { headers }, 1255 ) 1256 } 1257}