getFromPerson static method

Future<PcoCollection<PcoServicesTeamLeader>> getFromPerson(
  1. String personId, {
  2. String? id,
  3. PcoServicesTeamLeaderQuery? query,
  4. bool getAll = false,
  5. bool includeAllRelated = false,
  6. bool includePeople = false,
  7. bool includeTeam = false,

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

Available Query Filters:

  • not_archived
  • not_deleted

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.


static Future<PcoCollection<PcoServicesTeamLeader>> getFromPerson(
  String personId, {
  String? id,
  PcoServicesTeamLeaderQuery? query,
  bool getAll = false,
  bool includeAllRelated = false,
  bool includePeople = false,
  bool includeTeam = false,
}) async {
  query ??= PcoServicesTeamLeaderQuery();
  if (getAll) query.getAll = true;
  if (includeAllRelated)
  if (includePeople) query.include.add('people');
  if (includeTeam) query.include.add('team');
  var url = '/services/v2/people/$personId/team_leaders';
  if (id != null) url += '/$id';
  return PcoCollection.fromApiCall<PcoServicesTeamLeader>(url,
      query: query, apiVersion: kApiVersion);