Packages
mollie_api
0.1.0-20260428
0.1.0-20260722
0.1.0-20260721
0.1.0-20260717
0.1.0-20260716
0.1.0-20260708
0.1.0-20260702
0.1.0-20260629
0.1.0-20260625
0.1.0-20260622
0.1.0-20260619
0.1.0-20260617
0.1.0-20260615
0.1.0-20260611
0.1.0-20260609
0.1.0-20260601
0.1.0-20260529
0.1.0-20260527
0.1.0-20260526
0.1.0-20260525
0.1.0-20260521
0.1.0-20260519
0.1.0-20260515
0.1.0-20260513
0.1.0-20260512
0.1.0-20260507
0.1.0-20260505
0.1.0-20260504
0.1.0-20260430
0.1.0-20260429
0.1.0-20260428
0.1.0-20260427
0.1.0-20260423
0.1.0-20260421
0.1.0-20260420
0.1.0-20260415
0.1.0-20260410
0.1.0-20260409
0.1.0-20260408
0.1.0-20260402
0.1.0-20260401
0.1.0-20260331
0.1.0-20260330
0.1.0-20260327
0.1.0-20260317
0.1.0-20260313
0.1.0-20260310
0.1.0-20260309
0.1.0-20260306
0.1.0-20260305
0.1.0-20260303
0.1.0-20260302
0.1.0-20260226
0.1.0-20260218
0.1.0-20260217
0.1.0-20260210
0.1.0-20260206
0.1.0-20260205
0.1.0-20260204
0.1.0-20260203
0.1.0-20260202
0.1.0-20260130
0.1.0-20260129
0.1.0-20260114
0.1.0-20260109
0.1.0-20260107
0.1.0-20251222
0.1.0-20251125
0.1.0-20251121
0.1.0-20251119
0.1.0-20251118
0.1.0-20251113
An autogenerated Elixir client for the Mollie API, generated from the OpenAPI specification.
Current section
Files
Jump to
Current section
Files
lib/mollie_api/api/webhooks_api.ex
# NOTE: This file is auto generated by OpenAPI Generator 7.17.0 (https://openapi-generator.tech).
# Do not edit this file manually.
defmodule MollieAPI.Api.WebhooksAPI do
@moduledoc """
API calls for all endpoints tagged `WebhooksAPI`.
"""
alias MollieAPI.Connection
import MollieAPI.RequestBuilder
@doc """
Create a webhook
A webhook must have a name, an url and a list of event types. You can also create webhooks in the webhooks settings section of the Dashboard.
### Parameters
- `connection` (MollieAPI.Connection): Connection to server
- `opts` (keyword): Optional parameters
- `:"idempotency-key"` (String.t): A unique key to ensure idempotent requests. This key should be a UUID v4 string.
- `:body` (CreateWebhookRequest):
### Returns
- `{:ok, MollieAPI.Model.CreateWebhook.t}` on success
- `{:error, Tesla.Env.t}` on failure
"""
@spec create_webhook(Tesla.Env.client, keyword()) :: {:ok, MollieAPI.Model.CreateWebhook.t} | {:ok, MollieAPI.Model.ErrorResponse.t} | {:error, Tesla.Env.t}
def create_webhook(connection, opts \\ []) do
optional_params = %{
:"idempotency-key" => :headers,
:body => :body
}
request =
%{}
|> method(:post)
|> url("/v2/webhooks")
|> add_optional_params(optional_params, opts)
|> ensure_body()
|> Enum.into([])
connection
|> Connection.request(request)
|> evaluate_response([
{201, MollieAPI.Model.CreateWebhook},
{422, MollieAPI.Model.ErrorResponse}
])
end
@doc """
Delete a webhook
Delete a single webhook object by its webhook ID.
### Parameters
- `connection` (MollieAPI.Connection): Connection to server
- `webhook_id` (String.t): Provide the ID of the related webhook.
- `opts` (keyword): Optional parameters
- `:"idempotency-key"` (String.t): A unique key to ensure idempotent requests. This key should be a UUID v4 string.
- `:body` (DeleteWebhookRequest):
### Returns
- `{:ok, nil}` on success
- `{:error, Tesla.Env.t}` on failure
"""
@spec delete_webhook(Tesla.Env.client, String.t, keyword()) :: {:ok, nil} | {:ok, MollieAPI.Model.ErrorResponse.t} | {:error, Tesla.Env.t}
def delete_webhook(connection, webhook_id, opts \\ []) do
optional_params = %{
:"idempotency-key" => :headers,
:body => :body
}
request =
%{}
|> method(:delete)
|> url("/v2/webhooks/#{webhook_id}")
|> add_optional_params(optional_params, opts)
|> Enum.into([])
connection
|> Connection.request(request)
|> evaluate_response([
{204, false},
{404, MollieAPI.Model.ErrorResponse},
{422, MollieAPI.Model.ErrorResponse}
])
end
@doc """
Get a webhook
Retrieve a single webhook object by its ID.
### Parameters
- `connection` (MollieAPI.Connection): Connection to server
- `webhook_id` (String.t): Provide the ID of the related webhook.
- `opts` (keyword): Optional parameters
- `:testmode` (boolean()): You can enable test mode by setting the `testmode` query parameter to `true`. Test entities cannot be retrieved when the endpoint is set to live mode, and vice versa.
- `:"idempotency-key"` (String.t): A unique key to ensure idempotent requests. This key should be a UUID v4 string.
### Returns
- `{:ok, MollieAPI.Model.EntityWebhook.t}` on success
- `{:error, Tesla.Env.t}` on failure
"""
@spec get_webhook(Tesla.Env.client, String.t, keyword()) :: {:ok, MollieAPI.Model.EntityWebhook.t} | {:ok, MollieAPI.Model.ErrorResponse.t} | {:error, Tesla.Env.t}
def get_webhook(connection, webhook_id, opts \\ []) do
optional_params = %{
:testmode => :query,
:"idempotency-key" => :headers
}
request =
%{}
|> method(:get)
|> url("/v2/webhooks/#{webhook_id}")
|> add_optional_params(optional_params, opts)
|> Enum.into([])
connection
|> Connection.request(request)
|> evaluate_response([
{200, MollieAPI.Model.EntityWebhook},
{404, MollieAPI.Model.ErrorResponse},
{422, MollieAPI.Model.ErrorResponse}
])
end
@doc """
List all webhooks
Returns a paginated list of your webhooks. If no webhook endpoints are available, the resulting array will be empty. This request should never throw an error.
### Parameters
- `connection` (MollieAPI.Connection): Connection to server
- `opts` (keyword): Optional parameters
- `:from` (String.t): Provide an ID to start the result set from the item with the given ID and onwards. This allows you to paginate the result set.
- `:limit` (integer()): The maximum number of items to return. Defaults to 50 items.
- `:sort` (Sorting): Used for setting the direction of the result set. Defaults to descending order, meaning the results are ordered from newest to oldest.
- `:eventTypes` (WebhookEventTypes): Used to filter out only the webhooks that are subscribed to certain types of events.
- `:testmode` (boolean()): You can enable test mode by setting the `testmode` query parameter to `true`. Test entities cannot be retrieved when the endpoint is set to live mode, and vice versa.
- `:"idempotency-key"` (String.t): A unique key to ensure idempotent requests. This key should be a UUID v4 string.
### Returns
- `{:ok, MollieAPI.Model.ListWebhooks200Response.t}` on success
- `{:error, Tesla.Env.t}` on failure
"""
@spec list_webhooks(Tesla.Env.client, keyword()) :: {:ok, MollieAPI.Model.ErrorResponse.t} | {:ok, MollieAPI.Model.ListWebhooks200Response.t} | {:error, Tesla.Env.t}
def list_webhooks(connection, opts \\ []) do
optional_params = %{
:from => :query,
:limit => :query,
:sort => :query,
:eventTypes => :query,
:testmode => :query,
:"idempotency-key" => :headers
}
request =
%{}
|> method(:get)
|> url("/v2/webhooks")
|> add_optional_params(optional_params, opts)
|> Enum.into([])
connection
|> Connection.request(request)
|> evaluate_response([
{200, MollieAPI.Model.ListWebhooks200Response},
{400, MollieAPI.Model.ErrorResponse}
])
end
@doc """
Test a webhook
Sends a test event to the webhook to verify the endpoint is working as expected.
### Parameters
- `connection` (MollieAPI.Connection): Connection to server
- `webhook_id` (String.t): Provide the ID of the related webhook.
- `opts` (keyword): Optional parameters
- `:"idempotency-key"` (String.t): A unique key to ensure idempotent requests. This key should be a UUID v4 string.
- `:body` (DeleteWebhookRequest):
### Returns
- `{:ok, nil}` on success
- `{:error, Tesla.Env.t}` on failure
"""
@spec test_webhook(Tesla.Env.client, String.t, keyword()) :: {:ok, nil} | {:ok, MollieAPI.Model.ErrorResponse.t} | {:error, Tesla.Env.t}
def test_webhook(connection, webhook_id, opts \\ []) do
optional_params = %{
:"idempotency-key" => :headers,
:body => :body
}
request =
%{}
|> method(:post)
|> url("/v2/webhooks/#{webhook_id}/ping")
|> add_optional_params(optional_params, opts)
|> ensure_body()
|> Enum.into([])
connection
|> Connection.request(request)
|> evaluate_response([
{202, false},
{404, MollieAPI.Model.ErrorResponse},
{422, MollieAPI.Model.ErrorResponse}
])
end
@doc """
Update a webhook
Updates the webhook. You may edit the name, url and the list of subscribed event types.
### Parameters
- `connection` (MollieAPI.Connection): Connection to server
- `webhook_id` (String.t): Provide the ID of the related webhook.
- `opts` (keyword): Optional parameters
- `:"idempotency-key"` (String.t): A unique key to ensure idempotent requests. This key should be a UUID v4 string.
- `:body` (UpdateWebhookRequest):
### Returns
- `{:ok, MollieAPI.Model.EntityWebhook.t}` on success
- `{:error, Tesla.Env.t}` on failure
"""
@spec update_webhook(Tesla.Env.client, String.t, keyword()) :: {:ok, MollieAPI.Model.EntityWebhook.t} | {:ok, MollieAPI.Model.ErrorResponse.t} | {:error, Tesla.Env.t}
def update_webhook(connection, webhook_id, opts \\ []) do
optional_params = %{
:"idempotency-key" => :headers,
:body => :body
}
request =
%{}
|> method(:patch)
|> url("/v2/webhooks/#{webhook_id}")
|> add_optional_params(optional_params, opts)
|> ensure_body()
|> Enum.into([])
connection
|> Connection.request(request)
|> evaluate_response([
{200, MollieAPI.Model.EntityWebhook},
{404, MollieAPI.Model.ErrorResponse},
{422, MollieAPI.Model.ErrorResponse}
])
end
end