getFromServiceTypeAndPlanAndItem static method

Future<PcoCollection<PcoServicesItemTime>> getFromServiceTypeAndPlanAndItem(
  1. String serviceTypeId,
  2. String planId,
  3. String itemId, {
  4. String? id,
  5. PcoServicesItemTimeQuery? query,
  6. bool getAll = false,
})

Will get a PcoCollection of PcoServicesItemTime objects (expecting many) using a path like this: /services/v2/service_types/$serviceTypeId/plans/$planId/items/$itemId/item_times

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<PcoServicesItemTime>>
    getFromServiceTypeAndPlanAndItem(
  String serviceTypeId,
  String planId,
  String itemId, {
  String? id,
  PcoServicesItemTimeQuery? query,
  bool getAll = false,
}) async {
  query ??= PcoServicesItemTimeQuery();
  if (getAll) query.getAll = true;

  var url =
      '/services/v2/service_types/$serviceTypeId/plans/$planId/items/$itemId/item_times';
  if (id != null) url += '/$id';
  return PcoCollection.fromApiCall<PcoServicesItemTime>(url,
      query: query, apiVersion: kApiVersion);
}