getFromSubscriptionAndEvent static method

Future<PcoCollection<PcoWebhooksDelivery>> getFromSubscriptionAndEvent(
  1. String subscriptionId,
  2. String eventId, {
  3. String? id,
  4. PcoWebhooksDeliveryQuery? query,
  5. bool getAll = false,
})

Will get a PcoCollection of PcoWebhooksDelivery objects (expecting many) using a path like this: /webhooks/v2/subscriptions/$subscriptionId/events/$eventId/deliveries

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<PcoWebhooksDelivery>> getFromSubscriptionAndEvent(
  String subscriptionId,
  String eventId, {
  String? id,
  PcoWebhooksDeliveryQuery? query,
  bool getAll = false,
}) async {
  query ??= PcoWebhooksDeliveryQuery();
  if (getAll) query.getAll = true;

  var url =
      '/webhooks/v2/subscriptions/$subscriptionId/events/$eventId/deliveries';
  if (id != null) url += '/$id';
  return PcoCollection.fromApiCall<PcoWebhooksDelivery>(url,
      query: query, apiVersion: kApiVersion);
}