getSingle static method

Future<PcoServicesServiceType?> getSingle(
  1. String id,
  2. {PcoServicesServiceTypeQuery? query,
  3. bool includeTimePreferenceOptions = false}
)

Will get a single PcoServicesServiceType object using a path like this: /services/v2/service_types/[id]

Available Query Filters:

  • no_parent

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<PcoServicesServiceType?> getSingle(
  String id, {
  PcoServicesServiceTypeQuery? query,
  bool includeTimePreferenceOptions = false,
}) async {
  query ??= PcoServicesServiceTypeQuery();

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