getOptionsFromFormAndField static method

Future<PcoCollection<PcoPeopleFormFieldOption>> getOptionsFromFormAndField(
  1. String formId,
  2. String fieldId,
  3. {PcoPeopleFormFieldOptionQuery? query,
  4. bool getAll = false}
)

Will get a PcoCollection of PcoPeopleFormFieldOption objects (expecting one) using a path like this: /people/v2/forms/$formId/fields/$fieldId/options

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<PcoPeopleFormFieldOption>>
    getOptionsFromFormAndField(
  String formId,
  String fieldId, {
  PcoPeopleFormFieldOptionQuery? query,
  bool getAll = false,
}) async {
  query ??= PcoPeopleFormFieldOptionQuery();
  if (getAll) query.getAll = true;

  var url = '/people/v2/forms/$formId/fields/$fieldId/options';

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