getFromServiceType static method

Future<PcoCollection<PcoServicesPublicView>> getFromServiceType(
  1. String serviceTypeId,
  2. {String? id,
  3. PcoServicesPublicViewQuery? query,
  4. bool getAll = false}
)

Will get a PcoCollection of PcoServicesPublicView objects (expecting many) using a path like this: /services/v2/service_types/$serviceTypeId/public_view

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<PcoServicesPublicView>> getFromServiceType(
  String serviceTypeId, {
  String? id,
  PcoServicesPublicViewQuery? query,
  bool getAll = false,
}) async {
  query ??= PcoServicesPublicViewQuery();
  if (getAll) query.getAll = true;

  var url = '/services/v2/service_types/$serviceTypeId/public_view';
  if (id != null) url += '/$id';
  return PcoCollection.fromApiCall<PcoServicesPublicView>(url,
      query: query, apiVersion: kApiVersion);
}