getFromPerson static method

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

Will get a PcoCollection of PcoServicesSchedule objects (expecting many) using a path like this: /services/v2/people/$personId/schedules

Available Query Filters:

  • after Fetch schedules after the included after iso8601 date param. e.g. ?filter=after&after=2020-01-01T00:00:00Z

  • all

  • before Fetch schedules before the included before iso8601 date param. e.g. ?filter=before&before=2020-01-01T00:00:00Z

  • future

  • not_across_organizations

  • past

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>> getFromPerson(
  String personId, {
  String? id,
  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/people/$personId/schedules';
  if (id != null) url += '/$id';
  return PcoCollection.fromApiCall<PcoServicesSchedule>(url,
      query: query, apiVersion: kApiVersion);
}