Skip to content
← Public packages

@kentcdodds/cal-com

Cal.com helpers for booking pages, event types, slots, and webhooks.

src/get-event-type.js

23 lines · 1.1 KB · JavaScript
import { getEventType } from './cal-com.js'

/**
 * Read one Cal.com event type by id, slug, or title.
 * With no selector, returns the same payload as `list-event-types`.
 * @param {Object} [input]
 * @param {number|string} [input.id] Event type id (`eventTypeId` accepted as alias).
 *   Non-numeric strings are treated as slug or title.
 * @param {string} [input.slug] Event type slug (`eventTypeSlug` accepted as alias).
 * @param {string} [input.title] Event type title (`name` accepted as alias).
 * @param {boolean} [input.smoke] When true, ignore caller selectors and fetch a
 *   real catalog event type (or return the list when the account has none).
 *   Use this instead of placeholder ids.
 * @returns {Promise<unknown>} Event type detail, or the event-type list when no selector is given.
 * @example
 * import getEventType from 'kody:@kentcdodds/cal-com/get-event-type'
 * const listed = await getEventType()
 * const result = await getEventType({ eventTypeId: listed[0].id })
 * // => { id: ..., title: '30 Min Meeting', length: 30, ... }
 */
export default async function getEventTypeEntrypoint(input = {}) {
  return await getEventType(input)
}