get static method

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

Will get a PcoCollection of PcoPeopleMessage objects (expecting many) using a path like this: /people/v2/messages

Available Query Filters:

  • created_after

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>> get({
  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/messages';
  if (id != null) url += '/$id';
  return PcoCollection.fromApiCall<PcoPeopleMessage>(url,
      query: query, apiVersion: kApiVersion);
}