getFromPersonAndTeamLeader static method

Future<PcoCollection<PcoServicesPerson>> getFromPersonAndTeamLeader(
  1. String personId,
  2. String teamLeaderId, {
  3. String? id,
  4. PcoServicesPersonQuery? query,
  5. bool getAll = false,
  6. bool includeTeamLeaders = false,
})

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

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<PcoServicesPerson>> getFromPersonAndTeamLeader(
  String personId,
  String teamLeaderId, {
  String? id,
  PcoServicesPersonQuery? query,
  bool getAll = false,
  bool includeTeamLeaders = false,
}) async {
  query ??= PcoServicesPersonQuery();
  if (getAll) query.getAll = true;

  if (includeTeamLeaders) query.include.add('team_leaders');
  var url = '/services/v2/people/$personId/team_leaders/$teamLeaderId/people';
  if (id != null) url += '/$id';
  return PcoCollection.fromApiCall<PcoServicesPerson>(url,
      query: query, apiVersion: kApiVersion);
}