getSignupTeamsFromServiceTypeAndPlan static method

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

Will get a PcoCollection of PcoServicesTeam objects (expecting one) using a path like this: /services/v2/service_types/$serviceTypeId/plans/$planId/signup_teams

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<PcoServicesTeam>>
    getSignupTeamsFromServiceTypeAndPlan(
  String serviceTypeId,
  String planId, {
  PcoServicesTeamQuery? query,
  bool getAll = false,
  bool includeAllRelated = false,
  bool includePeople = false,
  bool includePersonTeamPositionAssignments = false,
  bool includeServiceType = false,
  bool includeTeamLeaders = false,
  bool includeTeamPositions = false,
}) async {
  query ??= PcoServicesTeamQuery();
  if (getAll) 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/plans/$planId/signup_teams';

  return PcoCollection.fromApiCall<PcoServicesTeam>(url,
      query: query, apiVersion: kApiVersion);
}