getFieldsFromForm static method
Future<PcoCollection<PcoPeopleFormField> >
getFieldsFromForm(
- String formId, {
- PcoPeopleFormFieldQuery? query,
- bool getAll = false,
- bool includeOptions = false,
Will get a PcoCollection
of PcoPeopleFormField objects (expecting one)
using a path like this: /people/v2/forms/$formId/fields
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<PcoPeopleFormField>> getFieldsFromForm(
String formId, {
PcoPeopleFormFieldQuery? query,
bool getAll = false,
bool includeOptions = false,
}) async {
query ??= PcoPeopleFormFieldQuery();
if (getAll) query.getAll = true;
if (includeOptions) query.include.add('options');
var url = '/people/v2/forms/$formId/fields';
return PcoCollection.fromApiCall<PcoPeopleFormField>(url,
query: query, apiVersion: kApiVersion);
}