This guide assumes you've already done the following:
An event represents a single entry in a calendar and contains all the usual information such as timing, location, attendance, recurrence etc.
The sort order for events is oldest-first.
See event model in the reference.
When listing events, if no filters are specified then the system will retrieve only events from the primary/default calendar.
token = "<user's token>"
client = LivilApi::Service.new(token)
emails = client.list_events
emails
# => [LivilApi::Event(id: '...', name: 'Meeting with the team', ...), ...]
There are a number of filters which may be applied to the request in order to limit the returned results.
NOTE:
Unless othewise specified below, all filteirng and seraching is performed by the provider APIs. Contents are not scanned by the WorkAPI system.
The event list endpoint supports the following standard parameters:
limit
NOTE:
Sorting and ordering is not currently possible.
For pagination, combine `limit` with the date range filters.
The calendar_ids
filter allows retrieval of events for one or many specified calendars.
events = client.list_events(calendar_ids: ['ABCDE...'])
events
# => [LivilApi::Event(id: '...', ..., calendar: LivilApi::Calendar(id: 'ABCDE...')), ...]
The date range filters by the starts_at
date and time. Any events that begin between those dates will be included in the result set.
events = client.list_events(date_from: '2019-10-01T00:00z', date_until: '2019-12-31T00:00z')
events
# => [LivilApi::Event(id: '...', ..., starts_at: '2019-11-01T10:30z')]
If an event is set to recur, all recurrences are retrieved when filtering by recurring_event_id
.
The calendar_ids
field should contain a single ID, that of the calendar to which the the recurring event belongs.
events = client.list_events(calendar_ids: ['ABCD987...'], recurring_event_id: 'XYZ123...')
events
# => [LivilApi::Event(id: '...', ..., parent_event_id: 'XYZ123...')]
A keyword search is performed on events in the specified calendars (default: all).
events = client.list_events(search_text: 'your subscription')
events
# => [LivilApi::Event(id: '...', description: 'Cancel your subscription with XYZ inc.')]