getFromHeadcount static method

Future<PcoCollection<PcoCheckInsEventTime>> getFromHeadcount(
  1. String headcountId, {
  2. PcoCheckInsEventTimeQuery? query,
  3. bool getAll = false,
  4. bool includeAllRelated = false,
  5. bool includeEvent = false,
  6. bool includeEventPeriod = false,
  7. bool includeHeadcounts = false,
})

Will get a PcoCollection of PcoCheckInsEventTime objects (expecting one) using a path like this: /check-ins/v2/headcounts/$headcountId/event_time

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<PcoCheckInsEventTime>> getFromHeadcount(
  String headcountId, {
  PcoCheckInsEventTimeQuery? query,
  bool getAll = false,
  bool includeAllRelated = false,
  bool includeEvent = false,
  bool includeEventPeriod = false,
  bool includeHeadcounts = false,
}) async {
  query ??= PcoCheckInsEventTimeQuery();
  if (getAll) query.getAll = true;
  if (includeAllRelated)
    query.include.addAll(PcoCheckInsEventTime.canInclude);
  if (includeEvent) query.include.add('event');
  if (includeEventPeriod) query.include.add('event_period');
  if (includeHeadcounts) query.include.add('headcounts');
  var url = '/check-ins/v2/headcounts/$headcountId/event_time';

  return PcoCollection.fromApiCall<PcoCheckInsEventTime>(url,
      query: query, apiVersion: kApiVersion);
}