getFromPerson static method

Future<PcoCollection<PcoPeopleMessageGroup>> getFromPerson(
  1. String personId,
  2. {String? id,
  3. PcoPeopleMessageGroupQuery? query,
  4. bool getAll = false,
  5. bool includeAllRelated = false,
  6. bool includeApp = false,
  7. bool includeFrom = false,
  8. bool includeMessages = false}
)

Will get a PcoCollection of PcoPeopleMessageGroup objects (expecting many) using a path like this: /people/v2/people/$personId/message_groups

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<PcoPeopleMessageGroup>> getFromPerson(
  String personId, {
  String? id,
  PcoPeopleMessageGroupQuery? query,
  bool getAll = false,
  bool includeAllRelated = false,
  bool includeApp = false,
  bool includeFrom = false,
  bool includeMessages = false,
}) async {
  query ??= PcoPeopleMessageGroupQuery();
  if (getAll) query.getAll = true;
  if (includeAllRelated)
    query.include.addAll(PcoPeopleMessageGroup.canInclude);
  if (includeApp) query.include.add('app');
  if (includeFrom) query.include.add('from');
  if (includeMessages) query.include.add('messages');
  var url = '/people/v2/people/$personId/message_groups';
  if (id != null) url += '/$id';
  return PcoCollection.fromApiCall<PcoPeopleMessageGroup>(url,
      query: query, apiVersion: kApiVersion);
}