getSingle static method

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

Will get a single PcoServicesPerson object using a path like this: /services/v2/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?> getSingle(
  String id, {
  PcoServicesPersonQuery? query,
  bool includeTeamLeaders = false,
}) async {
  query ??= PcoServicesPersonQuery();

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