getFromTeam static method

Future<PcoCollection<PcoServicesServiceType>> getFromTeam(
  1. String teamId,
  2. {PcoServicesServiceTypeQuery? query,
  3. bool getAll = false,
  4. bool includeTimePreferenceOptions = false}
)

Will get a PcoCollection of PcoServicesServiceType objects (expecting one) using a path like this: /services/v2/teams/$teamId/service_type

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<PcoServicesServiceType>> getFromTeam(
  String teamId, {
  PcoServicesServiceTypeQuery? query,
  bool getAll = false,
  bool includeTimePreferenceOptions = false,
}) async {
  query ??= PcoServicesServiceTypeQuery();
  if (getAll) query.getAll = true;

  if (includeTimePreferenceOptions)
    query.include.add('time_preference_options');
  var url = '/services/v2/teams/$teamId/service_type';

  return PcoCollection.fromApiCall<PcoServicesServiceType>(url,
      query: query, apiVersion: kApiVersion);
}