getAllFromServiceTypeAndPlan static method

Future<PcoCollection<PcoServicesNeededPosition>> getAllFromServiceTypeAndPlan(
  1. String serviceTypeId,
  2. String planId, {
  3. String? id,
  4. PcoServicesNeededPositionQuery? query,
  5. bool includeAllRelated = false,
  6. bool includeTeam = false,
  7. bool includeTime = false,
})

Will get a PcoCollection containing ALL PcoServicesNeededPosition objects (expecting many) using a path like this: /services/v2/service_types/$serviceTypeId/plans/$planId/needed_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<PcoServicesNeededPosition>>
    getAllFromServiceTypeAndPlan(
  String serviceTypeId,
  String planId, {
  String? id,
  PcoServicesNeededPositionQuery? query,
  bool includeAllRelated = false,
  bool includeTeam = false,
  bool includeTime = false,
}) async {
  query ??= PcoServicesNeededPositionQuery();
  query.getAll = true;
  if (includeAllRelated)
    query.include.addAll(PcoServicesNeededPosition.canInclude);
  if (includeTeam) query.include.add('team');
  if (includeTime) query.include.add('time');
  var url =
      '/services/v2/service_types/$serviceTypeId/plans/$planId/needed_positions';
  if (id != null) url += '/$id';
  return PcoCollection.fromApiCall<PcoServicesNeededPosition>(url,
      query: query, apiVersion: kApiVersion);
}