getAllFromServiceTypeAndPlanAndItem static method

Future<PcoCollection<PcoServicesMedia>> getAllFromServiceTypeAndPlanAndItem(
  1. String serviceTypeId,
  2. String planId,
  3. String itemId, {
  4. String? id,
  5. PcoServicesMediaQuery? query,
  6. bool includeAttachments = false,
})

Will get a PcoCollection containing ALL PcoServicesMedia objects (expecting many) using a path like this: /services/v2/service_types/$serviceTypeId/plans/$planId/items/$itemId/media

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.

This function forces the query.getAll to be true.

Implementation

static Future<PcoCollection<PcoServicesMedia>>
    getAllFromServiceTypeAndPlanAndItem(
  String serviceTypeId,
  String planId,
  String itemId, {
  String? id,
  PcoServicesMediaQuery? query,
  bool includeAttachments = false,
}) async {
  query ??= PcoServicesMediaQuery();
  query.getAll = true;

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