getCategoryFromList static method

Future<PcoCollection<PcoPeopleListCategory>> getCategoryFromList(
  1. String listId, {
  2. PcoPeopleListCategoryQuery? query,
  3. bool getAll = false,
  4. bool includeLists = false,
})

Will get a PcoCollection of PcoPeopleListCategory objects (expecting one) using a path like this: /people/v2/lists/$listId/category

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<PcoPeopleListCategory>> getCategoryFromList(
  String listId, {
  PcoPeopleListCategoryQuery? query,
  bool getAll = false,
  bool includeLists = false,
}) async {
  query ??= PcoPeopleListCategoryQuery();
  if (getAll) query.getAll = true;

  if (includeLists) query.include.add('lists');
  var url = '/people/v2/lists/$listId/category';

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