getFromForm static method

Future<PcoCollection<PcoPeopleCampus>> getFromForm(
  1. String formId, {
  2. PcoPeopleCampusQuery? query,
  3. bool getAll = false,
  4. bool includeAllRelated = false,
  5. bool includeLists = false,
  6. bool includeServiceTimes = false,
})

Will get a PcoCollection of PcoPeopleCampus objects (expecting one) using a path like this: /people/v2/forms/$formId/campus

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<PcoPeopleCampus>> getFromForm(
  String formId, {
  PcoPeopleCampusQuery? query,
  bool getAll = false,
  bool includeAllRelated = false,
  bool includeLists = false,
  bool includeServiceTimes = false,
}) async {
  query ??= PcoPeopleCampusQuery();
  if (getAll) query.getAll = true;
  if (includeAllRelated) query.include.addAll(PcoPeopleCampus.canInclude);
  if (includeLists) query.include.add('lists');
  if (includeServiceTimes) query.include.add('service_times');
  var url = '/people/v2/forms/$formId/campus';

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