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

Copy Markdown View Source

Webhook configuration and delivery inspection.

Endpoint secret verification lives in CorvoNfse.Webhooks.

CorvoNfse.Resources.Webhooks.create(client, %{
  url: "https://example.com/hooks/corvo",
  events: ["nfse.invoice.authorized"]
})

Summary

Functions

Creates a webhook config (POST /v1/webhooks).

Lists webhook configs (GET /v1/webhooks).

Deletes a webhook config (DELETE /v1/webhooks/:id).

Sends a webhook.test event (POST /v1/webhooks/:id/test).

Types

list_option()

@type list_option() :: {:limit, pos_integer()} | {:cursor, String.t()}

Functions

create(client, params)

@spec create(CorvoNfse.Client.t(), CorvoNfse.Types.Webhook.create_params()) ::
  {:ok, map()} | {:error, CorvoNfse.Error.t()}

Creates a webhook config (POST /v1/webhooks).

The response includes the endpoint secret used to verify signatures - store it before discarding the result.

list(client, opts \\ [])

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

Lists webhook configs (GET /v1/webhooks).

remove(client, id)

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

Deletes a webhook config (DELETE /v1/webhooks/:id).

test(client, id)

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

Sends a webhook.test event (POST /v1/webhooks/:id/test).