getFromAttendanceType static method

Future<PcoCollection<PcoCheckInsEvent>> getFromAttendanceType(
  1. String attendanceTypeId,
  2. {String? id,
  3. PcoCheckInsEventQuery? query,
  4. bool getAll = false,
  5. bool includeAllRelated = false,
  6. bool includeAttendanceTypes = false,
  7. bool includeEventPeriods = false}
)

Will get a PcoCollection of PcoCheckInsEvent objects (expecting many) using a path like this: /check-ins/v2/attendance_types/$attendanceTypeId/event

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<PcoCheckInsEvent>> getFromAttendanceType(
  String attendanceTypeId, {
  String? id,
  PcoCheckInsEventQuery? query,
  bool getAll = false,
  bool includeAllRelated = false,
  bool includeAttendanceTypes = false,
  bool includeEventPeriods = false,
}) async {
  query ??= PcoCheckInsEventQuery();
  if (getAll) query.getAll = true;
  if (includeAllRelated) query.include.addAll(PcoCheckInsEvent.canInclude);
  if (includeAttendanceTypes) query.include.add('attendance_types');
  if (includeEventPeriods) query.include.add('event_periods');
  var url = '/check-ins/v2/attendance_types/$attendanceTypeId/event';
  if (id != null) url += '/$id';
  return PcoCollection.fromApiCall<PcoCheckInsEvent>(url,
      query: query, apiVersion: kApiVersion);
}