getAllFromTeam static method

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

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

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.

This function forces the query.getAll to be true.

Implementation

static Future<PcoCollection<PcoServicesTeamLeader>> getAllFromTeam(
  String teamId, {
  String? id,
  PcoServicesTeamLeaderQuery? query,
  bool includeAllRelated = false,
  bool includePeople = false,
  bool includeTeam = false,
}) async {
  query ??= PcoServicesTeamLeaderQuery();
  query.getAll = true;
  if (includeAllRelated)
    query.include.addAll(PcoServicesTeamLeader.canInclude);
  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);
}