INNER CODE UNIT · TypeScript
q
rowboatlabs/rowboat · apps/harbor/packages/server/src/connectors/cal/index.ts:68
const q = new URLSearchParams(Object.entries(query).filter(([, v]) => v !== undefined).map(([k, v]) => [k, String(v)]));
return ((await this.call(`/bookings?${q}`, VERSIONS.bookings)) as Booking[] | undefined) ?? [];
}
async eventTypes(): Promise<EventType[]> {
const me = await this.profile();
const q = me.username ? `?username=${encodeURIComponent(me.username)}` : '';
return ((await this.call(`/event-types${q}`, VERSIONS.eventTypes)) as EventType[] | undefined) ?? [];
}
async eventType(slug: string): Promise<EventType> {
const types = await this.eventTypes();
const found = types.find((t) => t.slug.toLowerCase() === slug.toLowerCase());
if (!found) throw new UsageError(`There's no event type "${slug}". Yours: ${types.map((t) => t.slug).join(', ') || 'none'}.`);
return found;
}
async slots(eventTypeId: number, start: string, end: string, timeZone: string): Promise<Record<string, { start: string }[]>> {