getAllFromServiceType static method

Future<PcoCollection<PcoServicesTeamPosition>> getAllFromServiceType(
  1. String serviceTypeId, {
  2. String? id,
  3. PcoServicesTeamPositionQuery? query,
  4. bool includeAllRelated = false,
  5. bool includeTags = false,
  6. bool includeTeam = false,
})

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

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<PcoServicesTeamPosition>> getAllFromServiceType(
  String serviceTypeId, {
  String? id,
  PcoServicesTeamPositionQuery? query,
  bool includeAllRelated = false,
  bool includeTags = false,
  bool includeTeam = false,
}) async {
  query ??= PcoServicesTeamPositionQuery();
  query.getAll = true;
  if (includeAllRelated)
    query.include.addAll(PcoServicesTeamPosition.canInclude);
  if (includeTags) query.include.add('tags');
  if (includeTeam) query.include.add('team');
  var url = '/services/v2/service_types/$serviceTypeId/team_positions';
  if (id != null) url += '/$id';
  return PcoCollection.fromApiCall<PcoServicesTeamPosition>(url,
      query: query, apiVersion: kApiVersion);
}