getFromFormAndFormSubmission static method

Future<PcoCollection<PcoPeopleForm>> getFromFormAndFormSubmission(
  1. String formId,
  2. String formSubmissionId, {
  3. PcoPeopleFormQuery? query,
  4. bool getAll = false,
  5. bool includeCampus = false,
})

Will get a PcoCollection of PcoPeopleForm objects (expecting one) using a path like this: /people/v2/forms/$formId/form_submissions/$formSubmissionId/form

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<PcoPeopleForm>> getFromFormAndFormSubmission(
  String formId,
  String formSubmissionId, {
  PcoPeopleFormQuery? query,
  bool getAll = false,
  bool includeCampus = false,
}) async {
  query ??= PcoPeopleFormQuery();
  if (getAll) query.getAll = true;

  if (includeCampus) query.include.add('campus');
  var url =
      '/people/v2/forms/$formId/form_submissions/$formSubmissionId/form';

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