Current section

Files

Jump to
mollie_api lib mollie_api api clients_api.ex
Raw

lib/mollie_api/api/clients_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.ClientsAPI do
@moduledoc """
API calls for all endpoints tagged `ClientsAPI`.
"""
alias MollieAPI.Connection
import MollieAPI.RequestBuilder
@doc """
Get client
Retrieve a single client by its ID.
### Parameters
- `connection` (MollieAPI.Connection): Connection to server
- `organization_id` (String.t): Provide the ID of the related organization.
- `opts` (keyword): Optional parameters
- `:embed` (String.t): This endpoint allows embedding related API items by appending the following values via the `embed` query string parameter.
- `:"idempotency-key"` (String.t): A unique key to ensure idempotent requests. This key should be a UUID v4 string.
### Returns
- `{:ok, MollieAPI.Model.GetClient200Response.t}` on success
- `{:error, Tesla.Env.t}` on failure
"""
@spec get_client(Tesla.Env.client, String.t, keyword()) :: {:ok, MollieAPI.Model.ErrorResponse.t} | {:ok, MollieAPI.Model.GetClient200Response.t} | {:error, Tesla.Env.t}
def get_client(connection, organization_id, opts \\ []) do
optional_params = %{
:embed => :query,
:"idempotency-key" => :headers
}
request =
%{}
|> method(:get)
|> url("/v2/clients/#{organization_id}")
|> add_optional_params(optional_params, opts)
|> Enum.into([])
connection
|> Connection.request(request)
|> evaluate_response([
{200, MollieAPI.Model.GetClient200Response},
{404, MollieAPI.Model.ErrorResponse},
{429, MollieAPI.Model.ErrorResponse}
])
end
@doc """
List clients
Retrieve a list of all clients linked to your account. The results are paginated.
### Parameters
- `connection` (MollieAPI.Connection): Connection to server
- `opts` (keyword): Optional parameters
- `:embed` (String.t): This endpoint allows embedding related API items by appending the following values via the `embed` query string parameter.
- `: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.
- `:"idempotency-key"` (String.t): A unique key to ensure idempotent requests. This key should be a UUID v4 string.
### Returns
- `{:ok, MollieAPI.Model.ListClients200Response.t}` on success
- `{:error, Tesla.Env.t}` on failure
"""
@spec list_clients(Tesla.Env.client, keyword()) :: {:ok, MollieAPI.Model.ErrorResponse.t} | {:ok, MollieAPI.Model.ListClients200Response.t} | {:error, Tesla.Env.t}
def list_clients(connection, opts \\ []) do
optional_params = %{
:embed => :query,
:from => :query,
:limit => :query,
:"idempotency-key" => :headers
}
request =
%{}
|> method(:get)
|> url("/v2/clients")
|> add_optional_params(optional_params, opts)
|> Enum.into([])
connection
|> Connection.request(request)
|> evaluate_response([
{200, MollieAPI.Model.ListClients200Response},
{400, MollieAPI.Model.ErrorResponse},
{404, MollieAPI.Model.ErrorResponse},
{429, MollieAPI.Model.ErrorResponse}
])
end
end