import { normalizeWebinarLocator, pickAuthInput, request } from '../core.ts' import { asRecord, slimWebinar } from '../shape.ts' /** * Fetch one Zoom webinar by id or `zoom.us/w/{id}` URL. * * @example * import getZoomWebinar from 'kody:@kody/zoom/webinars/get' * const webinar = await getZoomWebinar({ webinarId: '22222222222' }) */ export default async function getZoomWebinar(params: Record = {}) { const auth = pickAuthInput(params) const { webinarId, occurrenceId } = normalizeWebinarLocator(params) const response = await request>({ ...auth, path: `/webinars/${webinarId}`, query: occurrenceId ? { occurrence_id: occurrenceId } : undefined, throwOnError: true, }) return { ...slimWebinar(asRecord(response.data)), auth: response.auth, } }