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

defmodule CoinAPIMarketDataRESTAPI.Api.OrderBookL3 do
  @moduledoc """
  API calls for all endpoints tagged `OrderBookL3`.
  """

  alias CoinAPIMarketDataRESTAPI.Connection
  import CoinAPIMarketDataRESTAPI.RequestBuilder

  @doc """
  Current order books

  ### Parameters

  - `connection` (CoinAPIMarketDataRESTAPI.Connection): Connection to server
  - `opts` (keyword): Optional parameters
    - `:filter_symbol_id` (String.t): Comma or semicolon delimited parts of symbol identifier used to filter the response.
    - `:limit_levels` (integer()): The maximum number of levels to include in the response.

  ### Returns

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

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

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

  @doc """
  Current order book by symbol_id
  Retrieves the current order book for the specified symbol.

  ### Parameters

  - `connection` (CoinAPIMarketDataRESTAPI.Connection): Connection to server
  - `symbol_id` (String.t): The symbol ID (from the Metadata -> Symbols)
  - `opts` (keyword): Optional parameters
    - `:limit_levels` (integer()): The maximum number of levels to include in the response.

  ### Returns

  - `{:ok, CoinAPIMarketDataRESTAPI.Model.V1OrderBookBase.t}` on success
  - `{:error, Tesla.Env.t}` on failure
  """
  @spec v1_orderbooks3_symbol_id_current_get(Tesla.Env.client, String.t, keyword()) :: {:ok, CoinAPIMarketDataRESTAPI.Model.V1OrderBookBase.t} | {:error, Tesla.Env.t}
  def v1_orderbooks3_symbol_id_current_get(connection, symbol_id, opts \\ []) do
    optional_params = %{
      :limit_levels => :query
    }

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

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