# NOTE: This file is auto generated by OpenAPI Generator 7.14.0 (https://openapi-generator.tech).
# Do not edit this file manually.

defmodule ExchangeRatesRealtimeRESTAPI.Api.Metadata do
  @moduledoc """
  API calls for all endpoints tagged `Metadata`.
  """

  alias ExchangeRatesRealtimeRESTAPI.Connection
  import ExchangeRatesRealtimeRESTAPI.RequestBuilder

  @doc """
  List all assets by asset ID

  ### Parameters

  - `connection` (ExchangeRatesRealtimeRESTAPI.Connection): Connection to server
  - `asset_id` (String.t): The asset ID.
  - `opts` (keyword): Optional parameters

  ### Returns

  - `{:ok, [%V1Asset{}, ...]}` on success
  - `{:error, Tesla.Env.t}` on failure
  """
  @spec v1_assets_asset_id_get(Tesla.Env.client, String.t, keyword()) :: {:ok, [ExchangeRatesRealtimeRESTAPI.Model.V1Asset.t]} | {:error, Tesla.Env.t}
  def v1_assets_asset_id_get(connection, asset_id, _opts \\ []) do
    request =
      %{}
      |> method(:get)
      |> url("/v1/assets/#{asset_id}")
      |> Enum.into([])

    connection
    |> Connection.request(request)
    |> evaluate_response([
      {200, ExchangeRatesRealtimeRESTAPI.Model.V1Asset}
    ])
  end

  @doc """
  List all assets
  Retrieves all assets.              :::info Our asset identifiers are aligned with the ISO 4217 currency codes standard only for fiat money (government or law regulated currency). :::              :::info Properties of the output are providing aggregated information from across all symbols related to the specific asset. If you need to calculate your aggregation (e.g., limiting only the particular type of symbols), you should use /v1/symbols endpoint as a data source. :::

  ### Parameters

  - `connection` (ExchangeRatesRealtimeRESTAPI.Connection): Connection to server
  - `opts` (keyword): Optional parameters
    - `:filter_asset_id` (String.t): Comma or semicolon delimited asset identifiers used to filter response. (optional, eg. `BTC;ETH`).

  ### Returns

  - `{:ok, [%V1Asset{}, ...]}` on success
  - `{:error, Tesla.Env.t}` on failure
  """
  @spec v1_assets_get(Tesla.Env.client, keyword()) :: {:ok, [ExchangeRatesRealtimeRESTAPI.Model.V1Asset.t]} | {:error, Tesla.Env.t}
  def v1_assets_get(connection, opts \\ []) do
    optional_params = %{
      :filter_asset_id => :query
    }

    request =
      %{}
      |> method(:get)
      |> url("/v1/assets")
      |> add_optional_params(optional_params, opts)
      |> Enum.into([])

    connection
    |> Connection.request(request)
    |> evaluate_response([
      {200, ExchangeRatesRealtimeRESTAPI.Model.V1Asset}
    ])
  end

  @doc """
  List all asset icons
  Gets the list of icons (of the given size) for all the assets.

  ### Parameters

  - `connection` (ExchangeRatesRealtimeRESTAPI.Connection): Connection to server
  - `size` (integer()): The size of the icons.
  - `opts` (keyword): Optional parameters

  ### Returns

  - `{:ok, [%V1Icon{}, ...]}` on success
  - `{:error, Tesla.Env.t}` on failure
  """
  @spec v1_assets_icons_size_get(Tesla.Env.client, integer(), keyword()) :: {:ok, [ExchangeRatesRealtimeRESTAPI.Model.V1Icon.t]} | {:error, Tesla.Env.t}
  def v1_assets_icons_size_get(connection, size, _opts \\ []) do
    request =
      %{}
      |> method(:get)
      |> url("/v1/assets/icons/#{size}")
      |> Enum.into([])

    connection
    |> Connection.request(request)
    |> evaluate_response([
      {200, ExchangeRatesRealtimeRESTAPI.Model.V1Icon}
    ])
  end
end
