getSingle static method

Future<PcoServicesFolder?> getSingle(
  1. String id, {
  2. PcoServicesFolderQuery? query,
  3. bool includeServiceTypes = false,
})

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

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