getAllAttachmentsFromServiceTypeAndPlan static method

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

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

Available Query Filters:

  • attachable_type filter attachments by their attachable_type as specified in the attachable_type parameter. Default: ["ServiceType", "Plan", "Item", "Media", "Song", "Arrangement", "Key"]. e.g. ?filter=attachable_type&attachable_type=Plan,ServiceType

  • extensions filter to attachments with a file extension specified in the extensions parameter. e.g. ?filter=extensions&extensions=pdf,txt

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>>
    getAllAttachmentsFromServiceTypeAndPlan(
  String serviceTypeId,
  String planId, {
  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/all_attachments';

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