getFromLabel static method

Future<PcoCollection<PcoCheckInsEventLabel>> getFromLabel(
  1. String labelId, {
  2. String? id,
  3. PcoCheckInsEventLabelQuery? query,
  4. bool getAll = false,
  5. bool includeAllRelated = false,
  6. bool includeEvent = false,
  7. bool includeLabel = false,
})

Will get a PcoCollection of PcoCheckInsEventLabel objects (expecting many) using a path like this: /check-ins/v2/labels/$labelId/event_labels

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<PcoCheckInsEventLabel>> getFromLabel(
  String labelId, {
  String? id,
  PcoCheckInsEventLabelQuery? query,
  bool getAll = false,
  bool includeAllRelated = false,
  bool includeEvent = false,
  bool includeLabel = false,
}) async {
  query ??= PcoCheckInsEventLabelQuery();
  if (getAll) query.getAll = true;
  if (includeAllRelated)
    query.include.addAll(PcoCheckInsEventLabel.canInclude);
  if (includeEvent) query.include.add('event');
  if (includeLabel) query.include.add('label');
  var url = '/check-ins/v2/labels/$labelId/event_labels';
  if (id != null) url += '/$id';
  return PcoCollection.fromApiCall<PcoCheckInsEventLabel>(url,
      query: query, apiVersion: kApiVersion);
}