Options
All
  • Public
  • Public/Protected
  • All
Menu

Namespace schedulingService

Helper functions for scheduling booking handling

import { schedulingService } from '@oneblink/apps'

Index

Type aliases

SchedulingBooking: { endTime: Date; isReschedule: boolean; location: string; startTime: Date; submissionId: string }

Type declaration

  • endTime: Date

    Date and time the booking ends

  • isReschedule: boolean

    true if the booking has been rescheduled, otherwise false

  • location: string

    Location of booking

  • startTime: Date

    Date and time the booking starts

  • submissionId: string

    The unique identifier for the submission associated with the booking

Functions

  • cancelSchedulingBooking(details: { nylasEditHash: string; reason: string; submissionId: string }): Promise<void>
  • Cancel a booking

    Example

    await schedulingService.cancelSchedulingBooking({
    submissionId: '89c6e98e-f56f-45fc-84fe-c4fc62331d34',
    nylasEditHash: '123abc321abcCBA456abcabc123456',
    reason: 'Busy at time of booking.',
    })
    // Booking Cancelled

    Parameters

    • details: { nylasEditHash: string; reason: string; submissionId: string }
      • nylasEditHash: string

        The nylas edit hash associated with the booking

      • reason: string

        Reason for cancelling the booking

      • submissionId: string

        The unique identifier for the submission associated with the booking

    Returns Promise<void>

  • handleCancelSchedulingBookingQuerystring(options: Record<string, unknown>): { cancellationPolicy?: string; endTime: Date; eventName: string; location: string; nylasEditHash: string; startTime: Date; submissionId: string; timezone: string }
  • Pass in query string parameters after navigation to your app via a valid cancellation link.

    Example

    import queryString from 'query-string'

    const query = queryString.parse(window.location.search)

    const bookingToCancel =
    await schedulingService.handleCancelSchedulingBookingQuerystring(query)

    Parameters

    • options: Record<string, unknown>

    Returns { cancellationPolicy?: string; endTime: Date; eventName: string; location: string; nylasEditHash: string; startTime: Date; submissionId: string; timezone: string }

    • Optional cancellationPolicy?: string

      The policy to display to users when asked why they are cancelling the booking

    • endTime: Date

      The end time of the booking

    • eventName: string

      The event name

    • location: string

      The location of the event

    • nylasEditHash: string

      The nylas edit hash associated with the booking

    • startTime: Date

      The start time of the booking

    • submissionId: string

      The unique identifier for the submission associated with the booking

    • timezone: string

      The timezone the booking was booked in

  • Pass in query string parameters after a redirect back to your app after a booking is processed. Will return a SchedulingBooking and the submission result from the original submission before redirecting to scheduling.bookingUrl. If the booking has been rescheduled, the submission result will not be returned.

    Example

    import queryString from 'query-string'

    const query = queryString.parse(window.location.search)

    const { booking, formSubmissionResult } =
    await schedulingService.handleSchedulingQuerystring(query)

    Parameters

    • options: Record<string, unknown>

    Returns Promise<{ booking: schedulingService.SchedulingBooking; formSubmissionResult?: FormSubmissionResult }>