getAllFromServiceType static method

Future<PcoCollection<PcoServicesTeam>> getAllFromServiceType(
  1. String serviceTypeId, {
  2. String? id,
  3. PcoServicesTeamQuery? query,
  4. bool includeAllRelated = false,
  5. bool includePeople = false,
  6. bool includePersonTeamPositionAssignments = false,
  7. bool includeServiceType = false,
  8. bool includeTeamLeaders = false,
  9. bool includeTeamPositions = false,
})

Will get a PcoCollection containing ALL PcoServicesTeam objects (expecting many) using a path like this: /services/v2/service_types/$serviceTypeId/teams

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<PcoServicesTeam>> getAllFromServiceType(
  String serviceTypeId, {
  String? id,
  PcoServicesTeamQuery? query,
  bool includeAllRelated = false,
  bool includePeople = false,
  bool includePersonTeamPositionAssignments = false,
  bool includeServiceType = false,
  bool includeTeamLeaders = false,
  bool includeTeamPositions = false,
}) async {
  query ??= PcoServicesTeamQuery();
  query.getAll = true;
  if (includeAllRelated) query.include.addAll(PcoServicesTeam.canInclude);
  if (includePeople) query.include.add('people');
  if (includePersonTeamPositionAssignments)
    query.include.add('person_team_position_assignments');
  if (includeServiceType) query.include.add('service_type');
  if (includeTeamLeaders) query.include.add('team_leaders');
  if (includeTeamPositions) query.include.add('team_positions');
  var url = '/services/v2/service_types/$serviceTypeId/teams';
  if (id != null) url += '/$id';
  return PcoCollection.fromApiCall<PcoServicesTeam>(url,
      query: query, apiVersion: kApiVersion);
}