getFromListAndRule static method

Future<PcoCollection<PcoPeopleCondition>> getFromListAndRule(
  1. String listId,
  2. String ruleId, {
  3. String? id,
  4. PcoPeopleConditionQuery? query,
  5. bool getAll = false,
  6. bool includeCreatedBy = false,
})

Will get a PcoCollection of PcoPeopleCondition objects (expecting many) using a path like this: /people/v2/lists/$listId/rules/$ruleId/conditions

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<PcoPeopleCondition>> getFromListAndRule(
  String listId,
  String ruleId, {
  String? id,
  PcoPeopleConditionQuery? query,
  bool getAll = false,
  bool includeCreatedBy = false,
}) async {
  query ??= PcoPeopleConditionQuery();
  if (getAll) query.getAll = true;

  if (includeCreatedBy) query.include.add('created_by');
  var url = '/people/v2/lists/$listId/rules/$ruleId/conditions';
  if (id != null) url += '/$id';
  return PcoCollection.fromApiCall<PcoPeopleCondition>(url,
      query: query, apiVersion: kApiVersion);
}