Current section

Files

Jump to
mollie_api lib mollie_api api organizations_api.ex
Raw

lib/mollie_api/api/organizations_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.OrganizationsAPI do
@moduledoc """
API calls for all endpoints tagged `OrganizationsAPI`.
"""
alias MollieAPI.Connection
import MollieAPI.RequestBuilder
@doc """
Get current organization
Retrieve the currently authenticated organization. A convenient alias of the [Get organization](get-organization) endpoint. For a complete reference of the organization object, refer to the [Get organization](get-organization) endpoint documentation.
### 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.
### Returns
- `{:ok, MollieAPI.Model.EntityOrganization.t}` on success
- `{:error, Tesla.Env.t}` on failure
"""
@spec get_current_organization(Tesla.Env.client, keyword()) :: {:ok, MollieAPI.Model.EntityOrganization.t} | {:ok, MollieAPI.Model.ErrorResponse.t} | {:error, Tesla.Env.t}
def get_current_organization(connection, opts \\ []) do
optional_params = %{
:"idempotency-key" => :headers
}
request =
%{}
|> method(:get)
|> url("/v2/organizations/me")
|> add_optional_params(optional_params, opts)
|> Enum.into([])
connection
|> Connection.request(request)
|> evaluate_response([
{200, MollieAPI.Model.EntityOrganization},
{429, MollieAPI.Model.ErrorResponse}
])
end
@doc """
Get organization
Retrieve a single organization by its ID. You can normally only retrieve the currently authenticated organization with this endpoint. This is primarily useful for OAuth apps. See also [Get current organization](get-current-organization). If you have a *partner account*', you can retrieve organization details of connected organizations.
### Parameters
- `connection` (MollieAPI.Connection): Connection to server
- `organization_id` (String.t): Provide the ID of the related organization.
- `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.EntityOrganization.t}` on success
- `{:error, Tesla.Env.t}` on failure
"""
@spec get_organization(Tesla.Env.client, String.t, keyword()) :: {:ok, MollieAPI.Model.EntityOrganization.t} | {:ok, MollieAPI.Model.ErrorResponse.t} | {:error, Tesla.Env.t}
def get_organization(connection, organization_id, opts \\ []) do
optional_params = %{
:testmode => :query,
:"idempotency-key" => :headers
}
request =
%{}
|> method(:get)
|> url("/v2/organizations/#{organization_id}")
|> add_optional_params(optional_params, opts)
|> Enum.into([])
connection
|> Connection.request(request)
|> evaluate_response([
{200, MollieAPI.Model.EntityOrganization},
{404, MollieAPI.Model.ErrorResponse},
{429, MollieAPI.Model.ErrorResponse}
])
end
@doc """
Get partner status
Retrieve partnership details about the currently authenticated organization. Only relevant for so-called *partner accounts*.
### 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.
### Returns
- `{:ok, MollieAPI.Model.GetPartnerStatus200Response.t}` on success
- `{:error, Tesla.Env.t}` on failure
"""
@spec get_partner_status(Tesla.Env.client, keyword()) :: {:ok, MollieAPI.Model.ErrorResponse.t} | {:ok, MollieAPI.Model.GetPartnerStatus200Response.t} | {:error, Tesla.Env.t}
def get_partner_status(connection, opts \\ []) do
optional_params = %{
:"idempotency-key" => :headers
}
request =
%{}
|> method(:get)
|> url("/v2/organizations/me/partner")
|> add_optional_params(optional_params, opts)
|> Enum.into([])
connection
|> Connection.request(request)
|> evaluate_response([
{200, MollieAPI.Model.GetPartnerStatus200Response},
{429, MollieAPI.Model.ErrorResponse}
])
end
end