Search interface for Tangled running on a Slice
1// Generated TypeScript client for AT Protocol records
2// Generated at: 2025-09-28 02:23:16 UTC
3// Lexicons: 7
4
5/**
6 * @example Usage
7 * ```ts
8 * import { AtProtoClient } from "./generated_client.ts";
9 *
10 * const client = new AtProtoClient(
11 * 'https://api.slices.network',
12 * 'at://did:plc:bcgltzqazw5tb6k2g3ttenbj/network.slices.slice/3lymhhbxald2z'
13 * );
14 *
15 * // Get records from the app.bsky.actor.profile collection
16 * const records = await client.app.bsky.actor.profile.getRecords();
17 *
18 * // Get a specific record
19 * const record = await client.app.bsky.actor.profile.getRecord({
20 * uri: 'at://did:plc:example/app.bsky.actor.profile/3abc123'
21 * });
22 *
23 * // Get records with filtering and search
24 * const filteredRecords = await client.app.bsky.actor.profile.getRecords({
25 * where: {
26 * text: { contains: "example search term" }
27 * }
28 * });
29 *
30 * // Use slice-level methods for cross-collection queries with type safety
31 * const sliceRecords = await client.network.slices.slice.getSliceRecords<AppBskyActorProfile>({
32 * where: {
33 * collection: { eq: 'app.bsky.actor.profile' }
34 * }
35 * });
36 *
37 * // Search across multiple collections using union types
38 * const multiCollectionRecords = await client.network.slices.slice.getSliceRecords<AppBskyActorProfile | AppBskyActorProfile>({
39 * where: {
40 * collection: { in: ['app.bsky.actor.profile', 'app.bsky.actor.profile'] },
41 * text: { contains: 'example search term' },
42 * did: { in: ['did:plc:user1', 'did:plc:user2'] }
43 * },
44 * limit: 20
45 * });
46 *
47 * // Serve the records as JSON
48 * Deno.serve(async () => new Response(JSON.stringify(records.records.map(r => r.value))));
49 * ```
50 */
51
52import {
53 type AuthProvider,
54 type BlobRef,
55 type CountRecordsResponse,
56 type GetRecordParams,
57 type GetRecordsResponse,
58 type IndexedRecordFields,
59 type RecordResponse,
60 SlicesClient,
61 type SortField,
62 type WhereCondition,
63} from "@slices/client";
64import type { OAuthClient } from "@slices/oauth";
65
66export type ComAtprotoLabelDefsLabelValue =
67 | "!hide"
68 | "!no-promote"
69 | "!warn"
70 | "!no-unauthenticated"
71 | "dmca-violation"
72 | "doxxing"
73 | "porn"
74 | "sexual"
75 | "nudity"
76 | "nsfl"
77 | "gore"
78 | (string & Record<string, never>);
79
80export type ComAtprotoLabelDefsBlurs =
81 | "content"
82 | "media"
83 | "none"
84 | (string & Record<string, never>);
85
86export type ComAtprotoLabelDefsSeverity =
87 | "inform"
88 | "alert"
89 | "none"
90 | (string & Record<string, never>);
91
92export type ComAtprotoLabelDefsDefaultSetting =
93 | "ignore"
94 | "warn"
95 | "hide"
96 | (string & Record<string, never>);
97
98export interface AppBskyActorProfile {
99 /** Small image to be displayed next to posts from account. AKA, 'profile picture' */
100 avatar?: BlobRef;
101 /** Larger horizontal image to display behind profile view. */
102 banner?: BlobRef;
103 /** Self-label values, specific to the Bluesky application, on the overall account. */
104 labels?: ComAtprotoLabelDefs["SelfLabels"] | {
105 $type: string;
106 [key: string]: unknown;
107 };
108 createdAt?: string;
109 pinnedPost?: ComAtprotoRepoStrongRef;
110 /** Free-form profile description text. */
111 description?: string;
112 displayName?: string;
113 joinedViaStarterPack?: ComAtprotoRepoStrongRef;
114}
115
116export type AppBskyActorProfileSortFields =
117 | "createdAt"
118 | "description"
119 | "displayName";
120
121export interface ShTangledRepo {
122 /** name of the repo */
123 name: string;
124 /** knot where the repo was created */
125 knot: string;
126 /** CI runner to send jobs to and receive results from */
127 spindle?: string;
128 description?: string;
129 /** source of the repo */
130 source?: string;
131 /** List of labels that this repo subscribes to */
132 labels?: string[];
133 createdAt: string;
134}
135
136export type ShTangledRepoSortFields =
137 | "name"
138 | "knot"
139 | "spindle"
140 | "description"
141 | "source"
142 | "createdAt";
143
144export interface ShTangledFeedStar {
145 subject: string;
146 createdAt: string;
147}
148
149export type ShTangledFeedStarSortFields = "subject" | "createdAt";
150
151export interface ShTangledActorProfile {
152 /** Free-form profile description text. */
153 description?: string;
154 links?: string[];
155 stats?: string[];
156 /** Include link to this account on Bluesky. */
157 bluesky: boolean;
158 /** Free-form location text. */
159 location?: string;
160 /** Any ATURI, it is up to appviews to validate these fields. */
161 pinnedRepositories?: string[];
162}
163
164export type ShTangledActorProfileSortFields = "description" | "location";
165
166export interface ShTangledRepoIssue {
167 repo: string;
168 title: string;
169 body?: string;
170 createdAt: string;
171}
172
173export type ShTangledRepoIssueSortFields =
174 | "repo"
175 | "title"
176 | "body"
177 | "createdAt";
178
179export interface ComAtprotoLabelDefsLabel {
180 /** Optionally, CID specifying the specific version of 'uri' resource this label applies to. */
181 cid?: string;
182 /** Timestamp when this label was created. */
183 cts: string;
184 /** Timestamp at which this label expires (no longer applies). */
185 exp?: string;
186 /** If true, this is a negation label, overwriting a previous label. */
187 neg?: boolean;
188 /** Signature of dag-cbor encoded label. */
189 sig?: string;
190 /** DID of the actor who created this label. */
191 src: string;
192 /** AT URI of the record, repository (account), or other resource that this label applies to. */
193 uri: string;
194 /** The short string name of the value or type of this label. */
195 val: string;
196 /** The AT Protocol version of the label object. */
197 ver?: number;
198}
199
200export interface ComAtprotoLabelDefsSelfLabel {
201 /** The short string name of the value or type of this label. */
202 val: string;
203}
204
205export interface ComAtprotoLabelDefsSelfLabels {
206 values: ComAtprotoLabelDefs["SelfLabel"][];
207}
208
209export interface ComAtprotoLabelDefsLabelValueDefinition {
210 /** What should this label hide in the UI, if applied? 'content' hides all of the target; 'media' hides the images/video/audio; 'none' hides nothing. */
211 blurs: ComAtprotoLabelDefsBlurs;
212 locales: ComAtprotoLabelDefs["LabelValueDefinitionStrings"][];
213 /** How should a client visually convey this label? 'inform' means neutral and informational; 'alert' means negative and warning; 'none' means show nothing. */
214 severity: ComAtprotoLabelDefsSeverity;
215 /** Does the user need to have adult content enabled in order to configure this label? */
216 adultOnly?: boolean;
217 /** The value of the label being defined. Must only include lowercase ascii and the '-' character ([a-z-]+). */
218 identifier: string;
219 /** The default setting for this label. */
220 defaultSetting?: ComAtprotoLabelDefsDefaultSetting;
221}
222
223export interface ComAtprotoLabelDefsLabelValueDefinitionStrings {
224 /** The code of the language these strings are written in. */
225 lang: string;
226 /** A short human-readable name for the label. */
227 name: string;
228 /** A longer description of what the label means and why it might be applied. */
229 description: string;
230}
231
232export interface ComAtprotoRepoStrongRef {
233 cid: string;
234 uri: string;
235}
236
237export interface ComAtprotoLabelDefs {
238 readonly Label: ComAtprotoLabelDefsLabel;
239 readonly SelfLabel: ComAtprotoLabelDefsSelfLabel;
240 readonly LabelValue: ComAtprotoLabelDefsLabelValue;
241 readonly SelfLabels: ComAtprotoLabelDefsSelfLabels;
242 readonly LabelValueDefinition: ComAtprotoLabelDefsLabelValueDefinition;
243 readonly LabelValueDefinitionStrings:
244 ComAtprotoLabelDefsLabelValueDefinitionStrings;
245}
246
247class ProfileActorBskyAppClient {
248 private readonly client: SlicesClient;
249
250 constructor(client: SlicesClient) {
251 this.client = client;
252 }
253
254 async getRecords(
255 params?: {
256 limit?: number;
257 cursor?: string;
258 where?: {
259 [K in AppBskyActorProfileSortFields | IndexedRecordFields]?:
260 WhereCondition;
261 };
262 orWhere?: {
263 [K in AppBskyActorProfileSortFields | IndexedRecordFields]?:
264 WhereCondition;
265 };
266 sortBy?: SortField<AppBskyActorProfileSortFields>[];
267 },
268 ): Promise<GetRecordsResponse<AppBskyActorProfile>> {
269 return await this.client.getRecords("app.bsky.actor.profile", params);
270 }
271
272 async getRecord(
273 params: GetRecordParams,
274 ): Promise<RecordResponse<AppBskyActorProfile>> {
275 return await this.client.getRecord("app.bsky.actor.profile", params);
276 }
277
278 async countRecords(
279 params?: {
280 limit?: number;
281 cursor?: string;
282 where?: {
283 [K in AppBskyActorProfileSortFields | IndexedRecordFields]?:
284 WhereCondition;
285 };
286 orWhere?: {
287 [K in AppBskyActorProfileSortFields | IndexedRecordFields]?:
288 WhereCondition;
289 };
290 sortBy?: SortField<AppBskyActorProfileSortFields>[];
291 },
292 ): Promise<CountRecordsResponse> {
293 return await this.client.countRecords("app.bsky.actor.profile", params);
294 }
295
296 async createRecord(
297 record: AppBskyActorProfile,
298 useSelfRkey?: boolean,
299 ): Promise<{ uri: string; cid: string }> {
300 return await this.client.createRecord(
301 "app.bsky.actor.profile",
302 record,
303 useSelfRkey,
304 );
305 }
306
307 async updateRecord(
308 rkey: string,
309 record: AppBskyActorProfile,
310 ): Promise<{ uri: string; cid: string }> {
311 return await this.client.updateRecord(
312 "app.bsky.actor.profile",
313 rkey,
314 record,
315 );
316 }
317
318 async deleteRecord(rkey: string): Promise<void> {
319 return await this.client.deleteRecord("app.bsky.actor.profile", rkey);
320 }
321}
322
323class ActorBskyAppClient {
324 readonly profile: ProfileActorBskyAppClient;
325 private readonly client: SlicesClient;
326
327 constructor(client: SlicesClient) {
328 this.client = client;
329 this.profile = new ProfileActorBskyAppClient(client);
330 }
331}
332
333class BskyAppClient {
334 readonly actor: ActorBskyAppClient;
335 private readonly client: SlicesClient;
336
337 constructor(client: SlicesClient) {
338 this.client = client;
339 this.actor = new ActorBskyAppClient(client);
340 }
341}
342
343class AppClient {
344 readonly bsky: BskyAppClient;
345 private readonly client: SlicesClient;
346
347 constructor(client: SlicesClient) {
348 this.client = client;
349 this.bsky = new BskyAppClient(client);
350 }
351}
352
353class IssueRepoTangledShClient {
354 private readonly client: SlicesClient;
355
356 constructor(client: SlicesClient) {
357 this.client = client;
358 }
359
360 async getRecords(
361 params?: {
362 limit?: number;
363 cursor?: string;
364 where?: {
365 [K in ShTangledRepoIssueSortFields | IndexedRecordFields]?:
366 WhereCondition;
367 };
368 orWhere?: {
369 [K in ShTangledRepoIssueSortFields | IndexedRecordFields]?:
370 WhereCondition;
371 };
372 sortBy?: SortField<ShTangledRepoIssueSortFields>[];
373 },
374 ): Promise<GetRecordsResponse<ShTangledRepoIssue>> {
375 return await this.client.getRecords("sh.tangled.repo.issue", params);
376 }
377
378 async getRecord(
379 params: GetRecordParams,
380 ): Promise<RecordResponse<ShTangledRepoIssue>> {
381 return await this.client.getRecord("sh.tangled.repo.issue", params);
382 }
383
384 async countRecords(
385 params?: {
386 limit?: number;
387 cursor?: string;
388 where?: {
389 [K in ShTangledRepoIssueSortFields | IndexedRecordFields]?:
390 WhereCondition;
391 };
392 orWhere?: {
393 [K in ShTangledRepoIssueSortFields | IndexedRecordFields]?:
394 WhereCondition;
395 };
396 sortBy?: SortField<ShTangledRepoIssueSortFields>[];
397 },
398 ): Promise<CountRecordsResponse> {
399 return await this.client.countRecords("sh.tangled.repo.issue", params);
400 }
401
402 async createRecord(
403 record: ShTangledRepoIssue,
404 useSelfRkey?: boolean,
405 ): Promise<{ uri: string; cid: string }> {
406 return await this.client.createRecord(
407 "sh.tangled.repo.issue",
408 record,
409 useSelfRkey,
410 );
411 }
412
413 async updateRecord(
414 rkey: string,
415 record: ShTangledRepoIssue,
416 ): Promise<{ uri: string; cid: string }> {
417 return await this.client.updateRecord(
418 "sh.tangled.repo.issue",
419 rkey,
420 record,
421 );
422 }
423
424 async deleteRecord(rkey: string): Promise<void> {
425 return await this.client.deleteRecord("sh.tangled.repo.issue", rkey);
426 }
427}
428
429class RepoTangledShClient {
430 readonly issue: IssueRepoTangledShClient;
431 private readonly client: SlicesClient;
432
433 constructor(client: SlicesClient) {
434 this.client = client;
435 this.issue = new IssueRepoTangledShClient(client);
436 }
437
438 async getRecords(
439 params?: {
440 limit?: number;
441 cursor?: string;
442 where?: {
443 [K in ShTangledRepoSortFields | IndexedRecordFields]?: WhereCondition;
444 };
445 orWhere?: {
446 [K in ShTangledRepoSortFields | IndexedRecordFields]?: WhereCondition;
447 };
448 sortBy?: SortField<ShTangledRepoSortFields>[];
449 },
450 ): Promise<GetRecordsResponse<ShTangledRepo>> {
451 return await this.client.getRecords("sh.tangled.repo", params);
452 }
453
454 async getRecord(
455 params: GetRecordParams,
456 ): Promise<RecordResponse<ShTangledRepo>> {
457 return await this.client.getRecord("sh.tangled.repo", params);
458 }
459
460 async countRecords(
461 params?: {
462 limit?: number;
463 cursor?: string;
464 where?: {
465 [K in ShTangledRepoSortFields | IndexedRecordFields]?: WhereCondition;
466 };
467 orWhere?: {
468 [K in ShTangledRepoSortFields | IndexedRecordFields]?: WhereCondition;
469 };
470 sortBy?: SortField<ShTangledRepoSortFields>[];
471 },
472 ): Promise<CountRecordsResponse> {
473 return await this.client.countRecords("sh.tangled.repo", params);
474 }
475
476 async createRecord(
477 record: ShTangledRepo,
478 useSelfRkey?: boolean,
479 ): Promise<{ uri: string; cid: string }> {
480 return await this.client.createRecord(
481 "sh.tangled.repo",
482 record,
483 useSelfRkey,
484 );
485 }
486
487 async updateRecord(
488 rkey: string,
489 record: ShTangledRepo,
490 ): Promise<{ uri: string; cid: string }> {
491 return await this.client.updateRecord("sh.tangled.repo", rkey, record);
492 }
493
494 async deleteRecord(rkey: string): Promise<void> {
495 return await this.client.deleteRecord("sh.tangled.repo", rkey);
496 }
497}
498
499class StarFeedTangledShClient {
500 private readonly client: SlicesClient;
501
502 constructor(client: SlicesClient) {
503 this.client = client;
504 }
505
506 async getRecords(
507 params?: {
508 limit?: number;
509 cursor?: string;
510 where?: {
511 [K in ShTangledFeedStarSortFields | IndexedRecordFields]?:
512 WhereCondition;
513 };
514 orWhere?: {
515 [K in ShTangledFeedStarSortFields | IndexedRecordFields]?:
516 WhereCondition;
517 };
518 sortBy?: SortField<ShTangledFeedStarSortFields>[];
519 },
520 ): Promise<GetRecordsResponse<ShTangledFeedStar>> {
521 return await this.client.getRecords("sh.tangled.feed.star", params);
522 }
523
524 async getRecord(
525 params: GetRecordParams,
526 ): Promise<RecordResponse<ShTangledFeedStar>> {
527 return await this.client.getRecord("sh.tangled.feed.star", params);
528 }
529
530 async countRecords(
531 params?: {
532 limit?: number;
533 cursor?: string;
534 where?: {
535 [K in ShTangledFeedStarSortFields | IndexedRecordFields]?:
536 WhereCondition;
537 };
538 orWhere?: {
539 [K in ShTangledFeedStarSortFields | IndexedRecordFields]?:
540 WhereCondition;
541 };
542 sortBy?: SortField<ShTangledFeedStarSortFields>[];
543 },
544 ): Promise<CountRecordsResponse> {
545 return await this.client.countRecords("sh.tangled.feed.star", params);
546 }
547
548 async createRecord(
549 record: ShTangledFeedStar,
550 useSelfRkey?: boolean,
551 ): Promise<{ uri: string; cid: string }> {
552 return await this.client.createRecord(
553 "sh.tangled.feed.star",
554 record,
555 useSelfRkey,
556 );
557 }
558
559 async updateRecord(
560 rkey: string,
561 record: ShTangledFeedStar,
562 ): Promise<{ uri: string; cid: string }> {
563 return await this.client.updateRecord("sh.tangled.feed.star", rkey, record);
564 }
565
566 async deleteRecord(rkey: string): Promise<void> {
567 return await this.client.deleteRecord("sh.tangled.feed.star", rkey);
568 }
569}
570
571class FeedTangledShClient {
572 readonly star: StarFeedTangledShClient;
573 private readonly client: SlicesClient;
574
575 constructor(client: SlicesClient) {
576 this.client = client;
577 this.star = new StarFeedTangledShClient(client);
578 }
579}
580
581class ProfileActorTangledShClient {
582 private readonly client: SlicesClient;
583
584 constructor(client: SlicesClient) {
585 this.client = client;
586 }
587
588 async getRecords(
589 params?: {
590 limit?: number;
591 cursor?: string;
592 where?: {
593 [K in ShTangledActorProfileSortFields | IndexedRecordFields]?:
594 WhereCondition;
595 };
596 orWhere?: {
597 [K in ShTangledActorProfileSortFields | IndexedRecordFields]?:
598 WhereCondition;
599 };
600 sortBy?: SortField<ShTangledActorProfileSortFields>[];
601 },
602 ): Promise<GetRecordsResponse<ShTangledActorProfile>> {
603 return await this.client.getRecords("sh.tangled.actor.profile", params);
604 }
605
606 async getRecord(
607 params: GetRecordParams,
608 ): Promise<RecordResponse<ShTangledActorProfile>> {
609 return await this.client.getRecord("sh.tangled.actor.profile", params);
610 }
611
612 async countRecords(
613 params?: {
614 limit?: number;
615 cursor?: string;
616 where?: {
617 [K in ShTangledActorProfileSortFields | IndexedRecordFields]?:
618 WhereCondition;
619 };
620 orWhere?: {
621 [K in ShTangledActorProfileSortFields | IndexedRecordFields]?:
622 WhereCondition;
623 };
624 sortBy?: SortField<ShTangledActorProfileSortFields>[];
625 },
626 ): Promise<CountRecordsResponse> {
627 return await this.client.countRecords("sh.tangled.actor.profile", params);
628 }
629
630 async createRecord(
631 record: ShTangledActorProfile,
632 useSelfRkey?: boolean,
633 ): Promise<{ uri: string; cid: string }> {
634 return await this.client.createRecord(
635 "sh.tangled.actor.profile",
636 record,
637 useSelfRkey,
638 );
639 }
640
641 async updateRecord(
642 rkey: string,
643 record: ShTangledActorProfile,
644 ): Promise<{ uri: string; cid: string }> {
645 return await this.client.updateRecord(
646 "sh.tangled.actor.profile",
647 rkey,
648 record,
649 );
650 }
651
652 async deleteRecord(rkey: string): Promise<void> {
653 return await this.client.deleteRecord("sh.tangled.actor.profile", rkey);
654 }
655}
656
657class ActorTangledShClient {
658 readonly profile: ProfileActorTangledShClient;
659 private readonly client: SlicesClient;
660
661 constructor(client: SlicesClient) {
662 this.client = client;
663 this.profile = new ProfileActorTangledShClient(client);
664 }
665}
666
667class TangledShClient {
668 readonly repo: RepoTangledShClient;
669 readonly feed: FeedTangledShClient;
670 readonly actor: ActorTangledShClient;
671 private readonly client: SlicesClient;
672
673 constructor(client: SlicesClient) {
674 this.client = client;
675 this.repo = new RepoTangledShClient(client);
676 this.feed = new FeedTangledShClient(client);
677 this.actor = new ActorTangledShClient(client);
678 }
679}
680
681class ShClient {
682 readonly tangled: TangledShClient;
683 private readonly client: SlicesClient;
684
685 constructor(client: SlicesClient) {
686 this.client = client;
687 this.tangled = new TangledShClient(client);
688 }
689}
690
691export class AtProtoClient extends SlicesClient {
692 readonly app: AppClient;
693 readonly sh: ShClient;
694 readonly oauth?: OAuthClient | AuthProvider;
695
696 constructor(
697 baseUrl: string,
698 sliceUri: string,
699 oauthClient?: OAuthClient | AuthProvider,
700 ) {
701 super(baseUrl, sliceUri, oauthClient);
702 this.app = new AppClient(this);
703 this.sh = new ShClient(this);
704 this.oauth = oauthClient;
705 }
706}