# NOTE: This file is auto generated by OpenAPI Generator 7.22.0 (https://openapi-generator.tech).
# Do not edit this file manually.
defmodule Spatio.Api.Logos do
@moduledoc """
API calls for all endpoints tagged `Logos`.
"""
alias Spatio.Connection
import Spatio.RequestBuilder
@doc """
Resolve a domain to its logo URL (CDN-cached 24h).
### Parameters
- `connection` (Spatio.Connection): Connection to server
- `domain` (String.t):
- `opts` (keyword): Optional parameters
### Returns
- `{:ok, Spatio.Model.GetDomainLogo200Response.t}` on success
- `{:error, Tesla.Env.t}` on failure
"""
@spec get_domain_logo(Tesla.Env.client, String.t, keyword()) :: {:ok, Spatio.Model.GetDomainLogo200Response.t} | {:ok, Spatio.Model.ApiError.t} | {:error, Tesla.Env.t}
def get_domain_logo(connection, domain, _opts \\ []) do
request =
%{}
|> method(:get)
|> url("/v1/logos/domain/#{domain}")
|> Enum.into([])
connection
|> Connection.request(request)
|> evaluate_response([
{200, Spatio.Model.GetDomainLogo200Response},
{401, Spatio.Model.ApiError}
])
end
@doc """
Resolve an email address to its domain logo URL.
### Parameters
- `connection` (Spatio.Connection): Connection to server
- `email` (String.t):
- `opts` (keyword): Optional parameters
### Returns
- `{:ok, %{}}` on success
- `{:error, Tesla.Env.t}` on failure
"""
@spec get_email_logo(Tesla.Env.client, String.t, keyword()) :: {:ok, %{optional(String.t) => any()}} | {:ok, Spatio.Model.ApiError.t} | {:error, Tesla.Env.t}
def get_email_logo(connection, email, _opts \\ []) do
request =
%{}
|> method(:get)
|> url("/v1/logos/email/#{email}")
|> Enum.into([])
connection
|> Connection.request(request)
|> evaluate_response([
{200, %{}},
{401, Spatio.Model.ApiError}
])
end
@doc """
Batch-resolve a list of domains/emails to logo URLs in one call.
### Parameters
- `connection` (Spatio.Connection): Connection to server
- `request_body` (%{optional(String.t) => any()}):
- `opts` (keyword): Optional parameters
### Returns
- `{:ok, %{}}` on success
- `{:error, Tesla.Env.t}` on failure
"""
@spec get_logos_batch(Tesla.Env.client, %{optional(String.t) => any()}, keyword()) :: {:ok, %{optional(String.t) => any()}} | {:ok, Spatio.Model.ApiError.t} | {:error, Tesla.Env.t}
def get_logos_batch(connection, request_body, _opts \\ []) do
request =
%{}
|> method(:post)
|> url("/v1/logos/batch")
|> add_param(:body, :body, request_body)
|> Enum.into([])
connection
|> Connection.request(request)
|> evaluate_response([
{200, %{}},
{401, Spatio.Model.ApiError}
])
end
end