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

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

  alias CoinAPIIndexesRESTAPI.Connection
  import CoinAPIIndexesRESTAPI.RequestBuilder

  @doc """
  List all exchanges by exchange_id

  ### Parameters

  - `connection` (CoinAPIIndexesRESTAPI.Connection): Connection to server
  - `exchange_id` (String.t): The ID of the exchange.
  - `opts` (keyword): Optional parameters

  ### Returns

  - `{:ok, [%MetadataExchange{}, ...]}` on success
  - `{:error, Tesla.Env.t}` on failure
  """
  @spec api_metadata_exchanges_exchange_id_get(Tesla.Env.client, String.t, keyword()) :: {:ok, [CoinAPIIndexesRESTAPI.Model.MetadataExchange.t]} | {:error, Tesla.Env.t}
  def api_metadata_exchanges_exchange_id_get(connection, exchange_id, _opts \\ []) do
    request =
      %{}
      |> method(:get)
      |> url("/api/metadata/exchanges/#{exchange_id}")
      |> Enum.into([])

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

  @doc """
  List all exchanges
  Get a detailed list of exchanges provided by the system.              :::info Properties of the output are providing aggregated information from across all symbols related to the specific exchange. 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` (CoinAPIIndexesRESTAPI.Connection): Connection to server
  - `opts` (keyword): Optional parameters
    - `:filter_exchange_id` (String.t): Comma or semicolon delimited exchange identifiers used to filter response. (optional, eg. `BITSTAMP;GEMINI`)

  ### Returns

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

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

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