getFromListCategory static method

Future<PcoCollection<PcoPeopleList>> getFromListCategory(
  1. String listCategoryId,
  2. {String? id,
  3. PcoPeopleListQuery? query,
  4. bool getAll = false,
  5. bool includeAllRelated = false,
  6. bool includeCampus = false,
  7. bool includeCategory = false,
  8. bool includeCreatedBy = false,
  9. bool includeMailchimpSyncStatus = false,
  10. bool includePeople = false,
  11. bool includeRules = false,
  12. bool includeShares = false,
  13. bool includeUpdatedBy = false}
)

Will get a PcoCollection of PcoPeopleList objects (expecting many) using a path like this: /people/v2/list_categories/$listCategoryId/lists

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<PcoPeopleList>> getFromListCategory(
  String listCategoryId, {
  String? id,
  PcoPeopleListQuery? query,
  bool getAll = false,
  bool includeAllRelated = false,
  bool includeCampus = false,
  bool includeCategory = false,
  bool includeCreatedBy = false,
  bool includeMailchimpSyncStatus = false,
  bool includePeople = false,
  bool includeRules = false,
  bool includeShares = false,
  bool includeUpdatedBy = false,
}) async {
  query ??= PcoPeopleListQuery();
  if (getAll) query.getAll = true;
  if (includeAllRelated) query.include.addAll(PcoPeopleList.canInclude);
  if (includeCampus) query.include.add('campus');
  if (includeCategory) query.include.add('category');
  if (includeCreatedBy) query.include.add('created_by');
  if (includeMailchimpSyncStatus) query.include.add('mailchimp_sync_status');
  if (includePeople) query.include.add('people');
  if (includeRules) query.include.add('rules');
  if (includeShares) query.include.add('shares');
  if (includeUpdatedBy) query.include.add('updated_by');
  var url = '/people/v2/list_categories/$listCategoryId/lists';
  if (id != null) url += '/$id';
  return PcoCollection.fromApiCall<PcoPeopleList>(url,
      query: query, apiVersion: kApiVersion);
}