getSingle static method

Future<PcoGroupsGroup?> getSingle(
  1. String id, {
  2. PcoGroupsGroupQuery? query,
  3. bool includeAllRelated = false,
  4. bool includeGroupType = false,
  5. bool includeLocation = false,
})

Will get a single PcoGroupsGroup object using a path like this: /groups/v2/groups/[id]

Available Query Filters:

  • group filter events from specific groups; provide an additional group_id param as a comma-separated list of IDs, ex: ?filter=group&group_id=1,2,3

  • group_type filter events from specific group types; provide an additional group_type_id param as a comma-separated list of IDs, ex: ?filter=group_type&group_type_id=1,2,3

  • my_groups

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<PcoGroupsGroup?> getSingle(
  String id, {
  PcoGroupsGroupQuery? query,
  bool includeAllRelated = false,
  bool includeGroupType = false,
  bool includeLocation = false,
}) async {
  query ??= PcoGroupsGroupQuery();
  if (includeAllRelated) query.include.addAll(PcoGroupsGroup.canInclude);
  if (includeGroupType) query.include.add('group_type');
  if (includeLocation) query.include.add('location');
  var url = '/groups/v2/groups/$id';
  var retval = await PcoCollection.fromApiCall<PcoGroupsGroup>(url,
      query: query, apiVersion: kApiVersion);
  return retval.items.isEmpty ? null : retval.items.first;
}