getFromAttendanceType static method

Future<PcoCollection<PcoCheckInsHeadcount>> getFromAttendanceType(
  1. String attendanceTypeId, {
  2. String? id,
  3. PcoCheckInsHeadcountQuery? query,
  4. bool getAll = false,
  5. bool includeAllRelated = false,
  6. bool includeAttendanceType = false,
  7. bool includeEventTime = false,
})

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

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<PcoCheckInsHeadcount>> getFromAttendanceType(
  String attendanceTypeId, {
  String? id,
  PcoCheckInsHeadcountQuery? query,
  bool getAll = false,
  bool includeAllRelated = false,
  bool includeAttendanceType = false,
  bool includeEventTime = false,
}) async {
  query ??= PcoCheckInsHeadcountQuery();
  if (getAll) query.getAll = true;
  if (includeAllRelated)
    query.include.addAll(PcoCheckInsHeadcount.canInclude);
  if (includeAttendanceType) query.include.add('attendance_type');
  if (includeEventTime) query.include.add('event_time');
  var url = '/check-ins/v2/attendance_types/$attendanceTypeId/headcounts';
  if (id != null) url += '/$id';
  return PcoCollection.fromApiCall<PcoCheckInsHeadcount>(url,
      query: query, apiVersion: kApiVersion);
}