getAllFromServiceType static method

Future<PcoCollection<PcoServicesPlan>> getAllFromServiceType(
  1. String serviceTypeId, {
  2. String? id,
  3. PcoServicesPlanQuery? query,
  4. bool includeAllRelated = false,
  5. bool includeContributors = false,
  6. bool includeMySchedules = false,
  7. bool includePlanTimes = false,
  8. bool includeSeries = false,
})

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

Available Query Filters:

  • after filter to plans with a time beginning after the after parameter

  • before filter to plans with a time beginning before the before parameter

  • future

  • no_dates

  • past

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<PcoServicesPlan>> getAllFromServiceType(
  String serviceTypeId, {
  String? id,
  PcoServicesPlanQuery? query,
  bool includeAllRelated = false,
  bool includeContributors = false,
  bool includeMySchedules = false,
  bool includePlanTimes = false,
  bool includeSeries = false,
}) async {
  query ??= PcoServicesPlanQuery();
  query.getAll = true;
  if (includeAllRelated) query.include.addAll(PcoServicesPlan.canInclude);
  if (includeContributors) query.include.add('contributors');
  if (includeMySchedules) query.include.add('my_schedules');
  if (includePlanTimes) query.include.add('plan_times');
  if (includeSeries) query.include.add('series');
  var url = '/services/v2/service_types/$serviceTypeId/plans';
  if (id != null) url += '/$id';
  return PcoCollection.fromApiCall<PcoServicesPlan>(url,
      query: query, apiVersion: kApiVersion);
}