Types

type NylasResponse<Data = any> = {
  request_id: string;
  data?: Data;
  error?: {
    message: string;
    type: string;
  };
};
type OpenHours = {
  days: number[];
  exDates: string[];
  timezone: string;
  start: string;
  end: string;
};
type MeetingBuffer = {
  before: number;
  after: number;
};
type Rules = {
  availability_method: 'max-fairness' | 'max-availability' | 'collective';
  buffer: MeetingBuffer;
  default_open_hours?: OpenHours[];
  round_robin_group_id: string;
};
type Configuration = {
  id: string;
  version: string;
  participants: Participant[];
  availability: Availability;
  event_booking: EventBooking;
  scheduler: Scheduler;
};
type Participant = {
  name: string;
  email: string;
  is_organizer?: boolean;
  availability?: ParticipantAvailability;
  booking?: ParticipantBooking;
};
type ParticipantAvailability = {
  calendar_ids: string[];
  open_hours?: OpenHours[];
};
type ParticipantBooking = {
  calendar_id: string;
};
type Availability = {
  duration_minutes: number;
  interval_minutes?: number;
  round_to?: number;
  availability_rules?: Rules;
};
type EventBooking = {
  title: string;
  description?: string;
  location?: string;
  booking_type: BookingType;
  additional_fields?: { [key: string]: any };
  hide_participants: boolean;
};
type Scheduler = {
  available_days_in_future: number;
  min_cancellation_notice: number;
};
enum BookingType {
  InstantBooking = 'booking',
  PreBooking = 'pre-booking',
}