getFromEventInstanceAndEventTime static method

Future<PcoCollection<PcoCalendarEvent>> getFromEventInstanceAndEventTime(
  1. String eventInstanceId,
  2. String eventTimeId,
  3. {PcoCalendarEventQuery? query,
  4. bool getAll = false,
  5. bool includeAllRelated = false,
  6. bool includeAttachments = false,
  7. bool includeOwner = false,
  8. bool includeTags = false}
)

Will get a PcoCollection of PcoCalendarEvent objects (expecting one) using a path like this: /calendar/v2/event_instances/$eventInstanceId/event_times/$eventTimeId/event

Getting a PcoCollection is useful even when retrieving a single object because it contains error data and helper functions.

Additional options may be specified by using the query argument, but some query options are also available as boolean flags in this function call too.

Implementation

static Future<PcoCollection<PcoCalendarEvent>>
    getFromEventInstanceAndEventTime(
  String eventInstanceId,
  String eventTimeId, {
  PcoCalendarEventQuery? query,
  bool getAll = false,
  bool includeAllRelated = false,
  bool includeAttachments = false,
  bool includeOwner = false,
  bool includeTags = false,
}) async {
  query ??= PcoCalendarEventQuery();
  if (getAll) query.getAll = true;
  if (includeAllRelated) query.include.addAll(PcoCalendarEvent.canInclude);
  if (includeAttachments) query.include.add('attachments');
  if (includeOwner) query.include.add('owner');
  if (includeTags) query.include.add('tags');
  var url =
      '/calendar/v2/event_instances/$eventInstanceId/event_times/$eventTimeId/event';

  return PcoCollection.fromApiCall<PcoCalendarEvent>(url,
      query: query, apiVersion: kApiVersion);
}