getFromPerson static method
Will get a PcoCollection
of PcoPeopleMessage objects (expecting many)
using a path like this: /people/v2/people/$personId/messages
Available Query Filters:
created_after
received
sent
unread
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<PcoPeopleMessage>> getFromPerson(
String personId, {
String? id,
PcoPeopleMessageQuery? query,
bool getAll = false,
bool includeAllRelated = false,
bool includeMessageGroup = false,
bool includeTo = false,
}) async {
query ??= PcoPeopleMessageQuery();
if (getAll) 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);
}