// Generated TypeScript client for AT Protocol records // Generated at: 2025-09-23 20:55:55 UTC // Lexicons: 3 /** * @example Usage * ```ts * import { AtProtoClient } from "./generated_client.ts"; * * const client = new AtProtoClient( * 'https://api.slices.network', * 'at://did:plc:bcgltzqazw5tb6k2g3ttenbj/network.slices.slice/3lzjs5zxpxz2z' * ); * * // Get records from the community.lexicon.calendar.rsvp collection * const records = await client.community.lexicon.calendar.rsvp.getRecords(); * * // Get a specific record * const record = await client.community.lexicon.calendar.rsvp.getRecord({ * uri: 'at://did:plc:example/community.lexicon.calendar.rsvp/3abc123' * }); * * // Get records with filtering and search * const filteredRecords = await client.community.lexicon.calendar.rsvp.getRecords({ * where: { * text: { contains: "example search term" } * } * }); * * // Use slice-level methods for cross-collection queries with type safety * const sliceRecords = await client.network.slices.slice.getSliceRecords({ * where: { * collection: { eq: 'community.lexicon.calendar.rsvp' } * } * }); * * // Search across multiple collections using union types * const multiCollectionRecords = await client.network.slices.slice.getSliceRecords({ * where: { * collection: { in: ['community.lexicon.calendar.rsvp', 'app.bsky.actor.profile'] }, * text: { contains: 'example search term' }, * did: { in: ['did:plc:user1', 'did:plc:user2'] } * }, * limit: 20 * }); * * // Serve the records as JSON * Deno.serve(async () => new Response(JSON.stringify(records.records.map(r => r.value)))); * ``` */ import { type BlobRef, type CountRecordsResponse, type GetRecordParams, type GetRecordsResponse, type IndexedRecordFields, type RecordResponse, SlicesClient, type SortField, type WhereCondition, } from "@slices/client"; import { OAuthClient } from "@slices/oauth"; export type CommunityLexiconCalendarRsvpStatus = | "community.lexicon.calendar.rsvp#interested" | "community.lexicon.calendar.rsvp#going" | "community.lexicon.calendar.rsvp#notgoing" | (string & {}); export type CommunityLexiconCalendarEventMode = | "community.lexicon.calendar.event#hybrid" | "community.lexicon.calendar.event#inperson" | "community.lexicon.calendar.event#virtual" | (string & {}); export type CommunityLexiconCalendarEventStatus = | "community.lexicon.calendar.event#cancelled" | "community.lexicon.calendar.event#planned" | "community.lexicon.calendar.event#postponed" | "community.lexicon.calendar.event#rescheduled" | "community.lexicon.calendar.event#scheduled" | (string & {}); export interface ComAtprotoRepoStrongRef { uri: string; cid: string; } export interface CommunityLexiconCalendarRsvp { subject: ComAtprotoRepoStrongRef; status: CommunityLexiconCalendarRsvpStatus; } export type CommunityLexiconCalendarRsvpSortFields = "status"; export type CommunityLexiconCalendarRsvpInterested = "community.lexicon.calendar.rsvp#interested"; export type CommunityLexiconCalendarRsvpGoing = "community.lexicon.calendar.rsvp#going"; export type CommunityLexiconCalendarRsvpNotgoing = "community.lexicon.calendar.rsvp#notgoing"; export interface CommunityLexiconCalendarEvent { /** The name of the event. */ name: string; /** The description of the event. */ description?: string; /** Client-declared timestamp when the event was created. */ createdAt: string; /** Client-declared timestamp when the event starts. */ startsAt?: string; /** Client-declared timestamp when the event ends. */ endsAt?: string; /** The attendance mode of the event. */ mode?: CommunityLexiconCalendarEvent["Mode"]; /** The status of the event. */ status?: CommunityLexiconCalendarEvent["Status"]; /** The locations where the event takes place. */ locations?: | CommunityLexiconCalendarEvent["Uri"] | CommunityLexiconLocationAddress | CommunityLexiconLocationFsq | CommunityLexiconLocationGeo | CommunityLexiconLocationHthree | { $type: string; [key: string]: unknown }[]; /** URIs associated with the event. */ uris?: CommunityLexiconCalendarEvent["Uri"][]; } export type CommunityLexiconCalendarEventSortFields = | "name" | "description" | "createdAt" | "startsAt" | "endsAt"; export type CommunityLexiconCalendarEventVirtual = "community.lexicon.calendar.event#virtual"; export type CommunityLexiconCalendarEventInperson = "community.lexicon.calendar.event#inperson"; export type CommunityLexiconCalendarEventHybrid = "community.lexicon.calendar.event#hybrid"; export type CommunityLexiconCalendarEventPlanned = "community.lexicon.calendar.event#planned"; export type CommunityLexiconCalendarEventScheduled = "community.lexicon.calendar.event#scheduled"; export type CommunityLexiconCalendarEventRescheduled = "community.lexicon.calendar.event#rescheduled"; export type CommunityLexiconCalendarEventCancelled = "community.lexicon.calendar.event#cancelled"; export type CommunityLexiconCalendarEventPostponed = "community.lexicon.calendar.event#postponed"; export interface CommunityLexiconCalendarEventUri { uri: string; /** The display name of the URI. */ name?: string; } export interface CommunityLexiconCalendarRsvp { readonly Main: CommunityLexiconCalendarRsvp; readonly Interested: CommunityLexiconCalendarRsvpInterested; readonly Going: CommunityLexiconCalendarRsvpGoing; readonly Notgoing: CommunityLexiconCalendarRsvpNotgoing; } export interface CommunityLexiconCalendarEvent { readonly Main: CommunityLexiconCalendarEvent; readonly Mode: CommunityLexiconCalendarEventMode; readonly Virtual: CommunityLexiconCalendarEventVirtual; readonly Inperson: CommunityLexiconCalendarEventInperson; readonly Hybrid: CommunityLexiconCalendarEventHybrid; readonly Status: CommunityLexiconCalendarEventStatus; readonly Planned: CommunityLexiconCalendarEventPlanned; readonly Scheduled: CommunityLexiconCalendarEventScheduled; readonly Rescheduled: CommunityLexiconCalendarEventRescheduled; readonly Cancelled: CommunityLexiconCalendarEventCancelled; readonly Postponed: CommunityLexiconCalendarEventPostponed; readonly Uri: CommunityLexiconCalendarEventUri; } class RsvpCalendarLexiconCommunityClient { private readonly client: SlicesClient; constructor(client: SlicesClient) { this.client = client; } async getRecords( params?: { limit?: number; cursor?: string; where?: { [K in CommunityLexiconCalendarRsvpSortFields | IndexedRecordFields]?: WhereCondition; }; orWhere?: { [K in CommunityLexiconCalendarRsvpSortFields | IndexedRecordFields]?: WhereCondition; }; sortBy?: SortField[]; }, ): Promise> { return await this.client.getRecords( "community.lexicon.calendar.rsvp", params, ); } async getRecord( params: GetRecordParams, ): Promise> { return await this.client.getRecord( "community.lexicon.calendar.rsvp", params, ); } async countRecords( params?: { limit?: number; cursor?: string; where?: { [K in CommunityLexiconCalendarRsvpSortFields | IndexedRecordFields]?: WhereCondition; }; orWhere?: { [K in CommunityLexiconCalendarRsvpSortFields | IndexedRecordFields]?: WhereCondition; }; sortBy?: SortField[]; }, ): Promise { return await this.client.countRecords( "community.lexicon.calendar.rsvp", params, ); } async createRecord( record: CommunityLexiconCalendarRsvp, useSelfRkey?: boolean, ): Promise<{ uri: string; cid: string }> { return await this.client.createRecord( "community.lexicon.calendar.rsvp", record, useSelfRkey, ); } async updateRecord( rkey: string, record: CommunityLexiconCalendarRsvp, ): Promise<{ uri: string; cid: string }> { return await this.client.updateRecord( "community.lexicon.calendar.rsvp", rkey, record, ); } async deleteRecord(rkey: string): Promise { return await this.client.deleteRecord( "community.lexicon.calendar.rsvp", rkey, ); } } class EventCalendarLexiconCommunityClient { private readonly client: SlicesClient; constructor(client: SlicesClient) { this.client = client; } async getRecords( params?: { limit?: number; cursor?: string; where?: { [K in CommunityLexiconCalendarEventSortFields | IndexedRecordFields]?: WhereCondition; }; orWhere?: { [K in CommunityLexiconCalendarEventSortFields | IndexedRecordFields]?: WhereCondition; }; sortBy?: SortField[]; }, ): Promise> { return await this.client.getRecords( "community.lexicon.calendar.event", params, ); } async getRecord( params: GetRecordParams, ): Promise> { return await this.client.getRecord( "community.lexicon.calendar.event", params, ); } async countRecords( params?: { limit?: number; cursor?: string; where?: { [K in CommunityLexiconCalendarEventSortFields | IndexedRecordFields]?: WhereCondition; }; orWhere?: { [K in CommunityLexiconCalendarEventSortFields | IndexedRecordFields]?: WhereCondition; }; sortBy?: SortField[]; }, ): Promise { return await this.client.countRecords( "community.lexicon.calendar.event", params, ); } async createRecord( record: CommunityLexiconCalendarEvent, useSelfRkey?: boolean, ): Promise<{ uri: string; cid: string }> { return await this.client.createRecord( "community.lexicon.calendar.event", record, useSelfRkey, ); } async updateRecord( rkey: string, record: CommunityLexiconCalendarEvent, ): Promise<{ uri: string; cid: string }> { return await this.client.updateRecord( "community.lexicon.calendar.event", rkey, record, ); } async deleteRecord(rkey: string): Promise { return await this.client.deleteRecord( "community.lexicon.calendar.event", rkey, ); } } class CalendarLexiconCommunityClient { readonly rsvp: RsvpCalendarLexiconCommunityClient; readonly event: EventCalendarLexiconCommunityClient; private readonly client: SlicesClient; constructor(client: SlicesClient) { this.client = client; this.rsvp = new RsvpCalendarLexiconCommunityClient(client); this.event = new EventCalendarLexiconCommunityClient(client); } } class LexiconCommunityClient { readonly calendar: CalendarLexiconCommunityClient; private readonly client: SlicesClient; constructor(client: SlicesClient) { this.client = client; this.calendar = new CalendarLexiconCommunityClient(client); } } class CommunityClient { readonly lexicon: LexiconCommunityClient; private readonly client: SlicesClient; constructor(client: SlicesClient) { this.client = client; this.lexicon = new LexiconCommunityClient(client); } } export class AtProtoClient extends SlicesClient { readonly community: CommunityClient; readonly oauth?: OAuthClient; constructor(baseUrl: string, sliceUri: string, oauthClient?: OAuthClient) { super(baseUrl, sliceUri, oauthClient); this.community = new CommunityClient(this); this.oauth = oauthClient; } }