getSharesFromList static method

Future<PcoCollection<PcoPeopleListShare>> getSharesFromList(
  1. String listId,
  2. {PcoPeopleListShareQuery? query,
  3. bool getAll = false,
  4. bool includePerson = false}
)

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

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<PcoPeopleListShare>> getSharesFromList(
  String listId, {
  PcoPeopleListShareQuery? query,
  bool getAll = false,
  bool includePerson = false,
}) async {
  query ??= PcoPeopleListShareQuery();
  if (getAll) query.getAll = true;

  if (includePerson) query.include.add('person');
  var url = '/people/v2/lists/$listId/shares';

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