getFromGroupType static method

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

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

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