getSelectedBackgroundFromServiceTypeAndPlanAndItem static method

Future<PcoCollection<PcoServicesAttachment>> getSelectedBackgroundFromServiceTypeAndPlanAndItem(
  1. String serviceTypeId,
  2. String planId,
  3. String itemId, {
  4. PcoServicesAttachmentQuery? query,
  5. bool getAll = false,
  6. bool includeZooms = false,
})

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

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<PcoServicesAttachment>>
    getSelectedBackgroundFromServiceTypeAndPlanAndItem(
  String serviceTypeId,
  String planId,
  String itemId, {
  PcoServicesAttachmentQuery? query,
  bool getAll = false,
  bool includeZooms = false,
}) async {
  query ??= PcoServicesAttachmentQuery();
  if (getAll) query.getAll = true;

  if (includeZooms) query.include.add('zooms');
  var url =
      '/services/v2/service_types/$serviceTypeId/plans/$planId/items/$itemId/selected_background';

  return PcoCollection.fromApiCall<PcoServicesAttachment>(url,
      query: query, apiVersion: kApiVersion);
}