API overview
Every function calsdk exports, with links to its options and result.
calsdk is ten functions, and they all work the same way. Each takes one options object, with a provider as calendar, and returns a promise, except iterateEvents, which returns an async iterator. Import them from @cal-sdk/core.
| Function | What it does |
|---|---|
listCalendars | Calendars the user can see |
getEvent | One event by id |
listEvents | One page of events in a time window |
iterateEvents | Every event in a time window, page by page |
createEvent | Create an event or series |
updateEvent | Change an event, an occurrence or a series |
deleteEvent | Delete an event, an occurrence or a series |
getFreeBusy | Busy blocks for one or more calendars |
findFreeTime | Slots when every calendar, across providers, is free |
syncEvents | Changes since a stored cursor |
Common options
Every function except findFreeTime takes these. findFreeTime takes maxRetries and abortSignal, and headers and providerOptions per provider.
- calendarCalendarProvider
- The provider to call, such as
google({ accessToken }). - maxRetries?number= 2
- Retries for rate limits, timeouts, server errors and network failures. Creates only retry rate limits.
- abortSignal?AbortSignal
- Cancels the call, including waits between retries.
- headers?Record<string, string>
- Extra HTTP headers sent with each provider request.
- providerOptions?ProviderOptionsFor<C, Operation>
- Provider-specific input, keyed by provider id. Typed by the provider in calendar.
Common result fields
Every result except findFreeTime's has these. findFreeTime returns slots and warnings.
- warningsWarning[]
- Parts of the request the provider could not honor, or fallbacks used.
- providerMetadata?ProviderMetadata
- Provider-specific output for the call.
- response?{ headers?: Record<string, string>; body?: unknown }
- The raw response, for debugging only.
Other exports
- Types:
CalendarEvent,Calendar,EventTime,EventInput,EventPatch,Attendee,BusyBlock,SyncChange,UpdateScope,SendUpdates,Warning,CalendarProvider,CalendarCapabilitiesand the options and result type of each function. See Types. - Errors:
CalsdkErrorand every subclass. See Errors. WarningsSetting, the type ofglobalThis.CALSDK_WARNINGS. See Warnings.