getAllFromTeam static method

Future<PcoCollection<PcoServicesPlanPerson>> getAllFromTeam(
  1. String teamId, {
  2. String? id,
  3. PcoServicesPlanPersonQuery? query,
  4. bool includeAllRelated = false,
  5. bool includeDeclinedPlanTimes = false,
  6. bool includePerson = false,
  7. bool includePlan = false,
  8. bool includeTeam = false,
})

Will get a PcoCollection containing ALL PcoServicesPlanPerson objects (expecting many) using a path like this: /services/v2/teams/$teamId/plan_people

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.

This function forces the query.getAll to be true.

Implementation

static Future<PcoCollection<PcoServicesPlanPerson>> getAllFromTeam(
  String teamId, {
  String? id,
  PcoServicesPlanPersonQuery? query,
  bool includeAllRelated = false,
  bool includeDeclinedPlanTimes = false,
  bool includePerson = false,
  bool includePlan = false,
  bool includeTeam = false,
}) async {
  query ??= PcoServicesPlanPersonQuery();
  query.getAll = true;
  if (includeAllRelated)
    query.include.addAll(PcoServicesPlanPerson.canInclude);
  if (includeDeclinedPlanTimes) query.include.add('declined_plan_times');
  if (includePerson) query.include.add('person');
  if (includePlan) query.include.add('plan');
  if (includeTeam) query.include.add('team');
  var url = '/services/v2/teams/$teamId/plan_people';
  if (id != null) url += '/$id';
  return PcoCollection.fromApiCall<PcoServicesPlanPerson>(url,
      query: query, apiVersion: kApiVersion);
}