getFromTeam static method

Future<PcoCollection<PcoServicesTeamLeader>> getFromTeam(
  1. String teamId, {
  2. String? id,
  3. PcoServicesTeamLeaderQuery? query,
  4. bool getAll = false,
  5. bool includeAllRelated = false,
  6. bool includePeople = false,
  7. bool includeTeam = false,

Will get a PcoCollection of PcoServicesTeamLeader objects (expecting many) using a path like this: /services/v2/teams/$teamId/team_leaders

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.


static Future<PcoCollection<PcoServicesTeamLeader>> getFromTeam(
  String teamId, {
  String? id,
  PcoServicesTeamLeaderQuery? query,
  bool getAll = false,
  bool includeAllRelated = false,
  bool includePeople = false,
  bool includeTeam = false,
}) async {
  query ??= PcoServicesTeamLeaderQuery();
  if (getAll) query.getAll = true;
  if (includeAllRelated)
  if (includePeople) query.include.add('people');
  if (includeTeam) query.include.add('team');
  var url = '/services/v2/teams/$teamId/team_leaders';
  if (id != null) url += '/$id';
  return PcoCollection.fromApiCall<PcoServicesTeamLeader>(url,
      query: query, apiVersion: kApiVersion);