getAllFromTag static method

Future<PcoCollection<PcoCalendarEventInstance>> getAllFromTag(
  1. String tagId, {
  2. String? id,
  3. PcoCalendarEventInstanceQuery? query,
  4. bool includeAllRelated = false,
  5. bool includeEvent = false,
  6. bool includeEventTimes = false,
  7. bool includeResourceBookings = false,
  8. bool includeTags = false,
})

Will get a PcoCollection containing ALL PcoCalendarEventInstance objects (expecting many) using a path like this: /calendar/v2/tags/$tagId/event_instances

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.

This function forces the query.getAll to be true.

Implementation

static Future<PcoCollection<PcoCalendarEventInstance>> getAllFromTag(
  String tagId, {
  String? id,
  PcoCalendarEventInstanceQuery? query,
  bool includeAllRelated = false,
  bool includeEvent = false,
  bool includeEventTimes = false,
  bool includeResourceBookings = false,
  bool includeTags = false,
}) async {
  query ??= PcoCalendarEventInstanceQuery();
  query.getAll = true;
  if (includeAllRelated)
    query.include.addAll(PcoCalendarEventInstance.canInclude);
  if (includeEvent) query.include.add('event');
  if (includeEventTimes) query.include.add('event_times');
  if (includeResourceBookings) query.include.add('resource_bookings');
  if (includeTags) query.include.add('tags');
  var url = '/calendar/v2/tags/$tagId/event_instances';
  if (id != null) url += '/$id';
  return PcoCollection.fromApiCall<PcoCalendarEventInstance>(url,
      query: query, apiVersion: kApiVersion);
}