getFromTag static method

Future<PcoCollection<PcoCalendarTagGroup>> getFromTag(
  1. String tagId, {
  2. String? id,
  3. PcoCalendarTagGroupQuery? query,
  4. bool getAll = false,
  5. bool includeAllRelated = false,
  6. bool includeEvents = false,
  7. bool includeTags = false,
})

Will get a PcoCollection of PcoCalendarTagGroup objects (expecting many) using a path like this: /calendar/v2/tags/$tagId/tag_group

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<PcoCalendarTagGroup>> getFromTag(
  String tagId, {
  String? id,
  PcoCalendarTagGroupQuery? query,
  bool getAll = false,
  bool includeAllRelated = false,
  bool includeEvents = false,
  bool includeTags = false,
}) async {
  query ??= PcoCalendarTagGroupQuery();
  if (getAll) query.getAll = true;
  if (includeAllRelated) query.include.addAll(PcoCalendarTagGroup.canInclude);
  if (includeEvents) query.include.add('events');
  if (includeTags) query.include.add('tags');
  var url = '/calendar/v2/tags/$tagId/tag_group';
  if (id != null) url += '/$id';
  return PcoCollection.fromApiCall<PcoCalendarTagGroup>(url,
      query: query, apiVersion: kApiVersion);
}