getFromServiceTypeAndPlanAndItem static method

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

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

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

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