getSingle static method

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

Will get a single PcoServicesTeam object using a path like this: /services/v2/teams/[id]

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<PcoServicesTeam?> getSingle(
  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();
  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/teams/$id';
  var retval = await PcoCollection.fromApiCall<PcoServicesTeam>(url,
      query: query, apiVersion: kApiVersion);
  return retval.items.isEmpty ? null : retval.items.first;
}