getFromCheckInAndLocation static method

Future<PcoCollection<PcoCheckInsLocationEventPeriod>> getFromCheckInAndLocation(
  1. String checkInId,
  2. String locationId, {
  3. String? id,
  4. PcoCheckInsLocationEventPeriodQuery? query,
  5. bool getAll = false,
  6. bool includeAllRelated = false,
  7. bool includeEventPeriod = false,
  8. bool includeLocation = false,
})

Will get a PcoCollection of PcoCheckInsLocationEventPeriod objects (expecting many) using a path like this: /check-ins/v2/check_ins/$checkInId/locations/$locationId/location_event_periods

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<PcoCheckInsLocationEventPeriod>>
    getFromCheckInAndLocation(
  String checkInId,
  String locationId, {
  String? id,
  PcoCheckInsLocationEventPeriodQuery? query,
  bool getAll = false,
  bool includeAllRelated = false,
  bool includeEventPeriod = false,
  bool includeLocation = false,
}) async {
  query ??= PcoCheckInsLocationEventPeriodQuery();
  if (getAll) query.getAll = true;
  if (includeAllRelated)
    query.include.addAll(PcoCheckInsLocationEventPeriod.canInclude);
  if (includeEventPeriod) query.include.add('event_period');
  if (includeLocation) query.include.add('location');
  var url =
      '/check-ins/v2/check_ins/$checkInId/locations/$locationId/location_event_periods';
  if (id != null) url += '/$id';
  return PcoCollection.fromApiCall<PcoCheckInsLocationEventPeriod>(url,
      query: query, apiVersion: kApiVersion);
}