getFromGroupType static method

Future<PcoCollection<PcoGroupsEvent>> getFromGroupType(
  1. String groupTypeId, {
  2. String? id,
  3. PcoGroupsEventQuery? query,
  4. bool getAll = false,
  5. bool includeAllRelated = false,
  6. bool includeGroup = false,
  7. bool includeLocation = false,
})

Will get a PcoCollection of PcoGroupsEvent objects (expecting many) using a path like this: /groups/v2/group_types/$groupTypeId/events

Available Query Filters:

  • canceled
  • not_canceled
  • upcoming

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<PcoGroupsEvent>> getFromGroupType(
  String groupTypeId, {
  String? id,
  PcoGroupsEventQuery? query,
  bool getAll = false,
  bool includeAllRelated = false,
  bool includeGroup = false,
  bool includeLocation = false,
}) async {
  query ??= PcoGroupsEventQuery();
  if (getAll) query.getAll = true;
  if (includeAllRelated) query.include.addAll(PcoGroupsEvent.canInclude);
  if (includeGroup) query.include.add('group');
  if (includeLocation) query.include.add('location');
  var url = '/groups/v2/group_types/$groupTypeId/events';
  if (id != null) url += '/$id';
  return PcoCollection.fromApiCall<PcoGroupsEvent>(url,
      query: query, apiVersion: kApiVersion);
}