getAllFromPerson static method

Future<PcoCollection<PcoPeopleMessage>> getAllFromPerson(
  1. String personId, {
  2. String? id,
  3. PcoPeopleMessageQuery? query,
  4. bool includeAllRelated = false,
  5. bool includeMessageGroup = false,
  6. bool includeTo = false,
})

Will get a PcoCollection containing ALL PcoPeopleMessage objects (expecting many) using a path like this: /people/v2/people/$personId/messages

Available Query Filters:

  • created_after
  • received
  • sent
  • unread

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.

This function forces the query.getAll to be true.

Implementation

static Future<PcoCollection<PcoPeopleMessage>> getAllFromPerson(
  String personId, {
  String? id,
  PcoPeopleMessageQuery? query,
  bool includeAllRelated = false,
  bool includeMessageGroup = false,
  bool includeTo = false,
}) async {
  query ??= PcoPeopleMessageQuery();
  query.getAll = true;
  if (includeAllRelated) query.include.addAll(PcoPeopleMessage.canInclude);
  if (includeMessageGroup) query.include.add('message_group');
  if (includeTo) query.include.add('to');
  var url = '/people/v2/people/$personId/messages';
  if (id != null) url += '/$id';
  return PcoCollection.fromApiCall<PcoPeopleMessage>(url,
      query: query, apiVersion: kApiVersion);
}