Something went wrong. Try again.
Smoke Signal/Community Events Slices Client https://slices.network/profile/chadtmiller.com/slice/3lzjs5zxpxz2z
Something went wrong. Try again.
12 kB · 398 lines · Created 1y ago
TypeScript
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399// 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<CommunityLexiconCalendarRsvp>({ * where: { * collection: { eq: 'community.lexicon.calendar.rsvp' } * } * }); * * // Search across multiple collections using union types * const multiCollectionRecords = await client.network.slices.slice.getSliceRecords<CommunityLexiconCalendarRsvp | AppBskyActorProfile>({ * 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<CommunityLexiconCalendarRsvpSortFields>[]; }, ): Promise<GetRecordsResponse<CommunityLexiconCalendarRsvp>> { return await this.client.getRecords( "community.lexicon.calendar.rsvp", params, ); }
async getRecord( params: GetRecordParams, ): Promise<RecordResponse<CommunityLexiconCalendarRsvp>> { 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<CommunityLexiconCalendarRsvpSortFields>[]; }, ): Promise<CountRecordsResponse> { 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<void> { 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<CommunityLexiconCalendarEventSortFields>[]; }, ): Promise<GetRecordsResponse<CommunityLexiconCalendarEvent>> { return await this.client.getRecords( "community.lexicon.calendar.event", params, ); }
async getRecord( params: GetRecordParams, ): Promise<RecordResponse<CommunityLexiconCalendarEvent>> { 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<CommunityLexiconCalendarEventSortFields>[]; }, ): Promise<CountRecordsResponse> { 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<void> { 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; }}