getSingleFromTeam static method

Future<PcoServicesPerson?> getSingleFromTeam(
  1. String teamId,
  2. String id, {
  3. PcoServicesPersonQuery? query,
  4. bool includeTeamLeaders = false,
})

Will get a single PcoServicesPerson object using a path like this: /services/v2/teams/$teamId/people/[id]

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<PcoServicesPerson?> getSingleFromTeam(
  String teamId,
  String id, {
  PcoServicesPersonQuery? query,
  bool includeTeamLeaders = false,
}) async {
  query ??= PcoServicesPersonQuery();

  if (includeTeamLeaders) query.include.add('team_leaders');
  var url = '/services/v2/teams/$teamId/people/$id';
  var retval = await PcoCollection.fromApiCall<PcoServicesPerson>(url,
      query: query, apiVersion: kApiVersion);
  return retval.items.isEmpty ? null : retval.items.first;
}