getSingle static method

Future<PcoPeopleListCategory?> getSingle(
  1. String id, {
  2. PcoPeopleListCategoryQuery? query,
  3. bool includeLists = false,
})

Will get a single PcoPeopleListCategory object using a path like this: /people/v2/list_categories/[id]

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<PcoPeopleListCategory?> getSingle(
  String id, {
  PcoPeopleListCategoryQuery? query,
  bool includeLists = false,
}) async {
  query ??= PcoPeopleListCategoryQuery();

  if (includeLists) query.include.add('lists');
  var url = '/people/v2/list_categories/$id';
  var retval = await PcoCollection.fromApiCall<PcoPeopleListCategory>(url,
      query: query, apiVersion: kApiVersion);
  return retval.items.isEmpty ? null : retval.items.first;
}