getFromMedia static method

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

Will get a PcoCollection of PcoServicesAttachment objects (expecting many) using a path like this: /services/v2/media/$mediaId/attachments

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>> getFromMedia(
  String mediaId, {
  String? id,
  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/media/$mediaId/attachments';
  if (id != null) url += '/$id';
  return PcoCollection.fromApiCall<PcoServicesAttachment>(url,
      query: query, apiVersion: kApiVersion);
}