getMySchedulesFromServiceTypeAndPlan static method

Future<PcoCollection<PcoServicesSchedule>> getMySchedulesFromServiceTypeAndPlan(
  1. String serviceTypeId,
  2. String planId, {
  3. PcoServicesScheduleQuery? query,
  4. bool getAll = false,
  5. bool includePlanTimes = false,
})

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

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<PcoServicesSchedule>>
    getMySchedulesFromServiceTypeAndPlan(
  String serviceTypeId,
  String planId, {
  PcoServicesScheduleQuery? query,
  bool getAll = false,
  bool includePlanTimes = false,
}) async {
  query ??= PcoServicesScheduleQuery();
  if (getAll) query.getAll = true;

  if (includePlanTimes) query.include.add('plan_times');
  var url =
      '/services/v2/service_types/$serviceTypeId/plans/$planId/my_schedules';

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