getSingleFromServiceTypeAndPlanAndItem static method

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

Will get a single PcoServicesAttachment object using a path like this: /services/v2/service_types/$serviceTypeId/plans/$planId/items/$itemId/attachments/[id]

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<PcoServicesAttachment?> getSingleFromServiceTypeAndPlanAndItem(
  String serviceTypeId,
  String planId,
  String itemId,
  String id, {
  PcoServicesAttachmentQuery? query,
  bool includeZooms = false,
}) async {
  query ??= PcoServicesAttachmentQuery();

  if (includeZooms) query.include.add('zooms');
  var url =
      '/services/v2/service_types/$serviceTypeId/plans/$planId/items/$itemId/attachments/$id';
  var retval = await PcoCollection.fromApiCall<PcoServicesAttachment>(url,
      query: query, apiVersion: kApiVersion);
  return retval.items.isEmpty ? null : retval.items.first;
}