getAllFromPerson static method

Future<PcoCollection<PcoCheckInsPersonEvent>> getAllFromPerson(
  1. String personId, {
  2. String? id,
  3. PcoCheckInsPersonEventQuery? query,
  4. bool includeAllRelated = false,
  5. bool includeEvent = false,
  6. bool includeFirstCheckIn = false,
  7. bool includeLastCheckIn = false,
  8. bool includePerson = false,
})

Will get a PcoCollection containing ALL PcoCheckInsPersonEvent objects (expecting many) using a path like this: /check-ins/v2/people/$personId/person_events

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<PcoCheckInsPersonEvent>> getAllFromPerson(
  String personId, {
  String? id,
  PcoCheckInsPersonEventQuery? query,
  bool includeAllRelated = false,
  bool includeEvent = false,
  bool includeFirstCheckIn = false,
  bool includeLastCheckIn = false,
  bool includePerson = false,
}) async {
  query ??= PcoCheckInsPersonEventQuery();
  query.getAll = true;
  if (includeAllRelated)
    query.include.addAll(PcoCheckInsPersonEvent.canInclude);
  if (includeEvent) query.include.add('event');
  if (includeFirstCheckIn) query.include.add('first_check_in');
  if (includeLastCheckIn) query.include.add('last_check_in');
  if (includePerson) query.include.add('person');
  var url = '/check-ins/v2/people/$personId/person_events';
  if (id != null) url += '/$id';
  return PcoCollection.fromApiCall<PcoCheckInsPersonEvent>(url,
      query: query, apiVersion: kApiVersion);
}