CorvoNfse.Resources.Webhooks.Deliveries (Corvo NFS-e v0.1.1)

Copy Markdown View Source

Webhook delivery inspection: list, iterate, stats and retry (/v1/webhooks/deliveries/...).

Summary

Functions

Lazily iterates every delivery across pages.

Lists delivery attempts (GET /v1/webhooks/deliveries).

Requeues a delivery (POST /v1/webhooks/deliveries/:id/retry).

Delivery counters for the last hours (GET /v1/webhooks/deliveries/stats).

Types

list_option()

@type list_option() ::
  {:hours, pos_integer()}
  | {:environment, CorvoNfse.Types.Webhook.environment()}
  | {:limit, pos_integer()}
  | {:cursor, String.t()}

stats_option()

@type stats_option() ::
  {:hours, pos_integer()}
  | {:environment, CorvoNfse.Types.Webhook.environment()}

Functions

iterate(client, opts \\ [])

@spec iterate(CorvoNfse.Client.t(), [list_option()]) ::
  {:ok, Enumerable.t()} | {:error, CorvoNfse.Error.t()}

Lazily iterates every delivery across pages.

The first page is fetched eagerly: {:error, error} means it failed and nothing was produced; {:ok, stream} yields deliveries one by one. A failure in a later page raises the %CorvoNfse.Error{} while consuming the stream.

list(client, opts \\ [])

@spec list(CorvoNfse.Client.t(), [list_option()]) ::
  {:ok, CorvoNfse.Types.Common.page()} | {:error, CorvoNfse.Error.t()}

Lists delivery attempts (GET /v1/webhooks/deliveries).

retry(client, delivery_id)

@spec retry(CorvoNfse.Client.t(), String.t()) ::
  {:ok, map()} | {:error, CorvoNfse.Error.t()}

Requeues a delivery (POST /v1/webhooks/deliveries/:id/retry).

stats(client, opts \\ [])

@spec stats(CorvoNfse.Client.t(), [stats_option()]) ::
  {:ok, map()} | {:error, CorvoNfse.Error.t()}

Delivery counters for the last hours (GET /v1/webhooks/deliveries/stats).