getSingleFromPerson static method

Future<PcoCheckInsPersonEvent?> getSingleFromPerson(
  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 single PcoCheckInsPersonEvent object using a path like this: /check-ins/v2/people/$personId/person_events/[id]

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<PcoCheckInsPersonEvent?> getSingleFromPerson(
  String personId,
  String id, {
  PcoCheckInsPersonEventQuery? query,
  bool includeAllRelated = false,
  bool includeEvent = false,
  bool includeFirstCheckIn = false,
  bool includeLastCheckIn = false,
  bool includePerson = false,
}) async {
  query ??= PcoCheckInsPersonEventQuery();
  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/$id';
  var retval = await PcoCollection.fromApiCall<PcoCheckInsPersonEvent>(url,
      query: query, apiVersion: kApiVersion);
  return retval.items.isEmpty ? null : retval.items.first;
}