Current section

Files

Jump to
mollie_api lib mollie_api api terminals_api.ex
Raw

lib/mollie_api/api/terminals_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.TerminalsAPI do
@moduledoc """
API calls for all endpoints tagged `TerminalsAPI`.
"""
alias MollieAPI.Connection
import MollieAPI.RequestBuilder
@doc """
Get terminal
Retrieve a single terminal by its ID.
### Parameters
- `connection` (MollieAPI.Connection): Connection to server
- `terminal_id` (String.t): Provide the ID of the related terminal.
- `opts` (keyword): Optional parameters
- `:testmode` (boolean()): Most API credentials are specifically created for either live mode or test mode. In those cases the `testmode` query parameter must not be sent. For organization-level credentials such as OAuth access tokens, 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.EntityTerminal.t}` on success
- `{:error, Tesla.Env.t}` on failure
"""
@spec get_terminal(Tesla.Env.client, String.t, keyword()) :: {:ok, MollieAPI.Model.ErrorResponse.t} | {:ok, MollieAPI.Model.EntityTerminal.t} | {:error, Tesla.Env.t}
def get_terminal(connection, terminal_id, opts \\ []) do
optional_params = %{
:testmode => :query,
:"idempotency-key" => :headers
}
request =
%{}
|> method(:get)
|> url("/v2/terminals/#{terminal_id}")
|> add_optional_params(optional_params, opts)
|> Enum.into([])
connection
|> Connection.request(request)
|> evaluate_response([
{200, MollieAPI.Model.EntityTerminal},
{404, MollieAPI.Model.ErrorResponse}
])
end
@doc """
List terminals
Retrieve a list of all physical point-of-sale devices. The results are paginated.
### 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.
- `:testmode` (boolean()): Most API credentials are specifically created for either live mode or test mode. In those cases the `testmode` query parameter must not be sent. For organization-level credentials such as OAuth access tokens, 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.ListTerminals200Response.t}` on success
- `{:error, Tesla.Env.t}` on failure
"""
@spec list_terminals(Tesla.Env.client, keyword()) :: {:ok, MollieAPI.Model.ErrorResponse.t} | {:ok, MollieAPI.Model.ListTerminals200Response.t} | {:error, Tesla.Env.t}
def list_terminals(connection, opts \\ []) do
optional_params = %{
:from => :query,
:limit => :query,
:sort => :query,
:testmode => :query,
:"idempotency-key" => :headers
}
request =
%{}
|> method(:get)
|> url("/v2/terminals")
|> add_optional_params(optional_params, opts)
|> Enum.into([])
connection
|> Connection.request(request)
|> evaluate_response([
{200, MollieAPI.Model.ListTerminals200Response},
{400, MollieAPI.Model.ErrorResponse}
])
end
end