# 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.Options do
  @moduledoc """
  API calls for all endpoints tagged `Options`.
  """

  alias CoinAPIMarketDataRESTAPI.Connection
  import CoinAPIMarketDataRESTAPI.RequestBuilder

  @doc """
  Current data by Exchange
  Get current options data for a specific exchange.  Returns option data grouped by underlying asset, quote currency, and expiration time, with quotes for both calls and puts at each strike price.

  ### Parameters

  - `connection` (CoinAPIMarketDataRESTAPI.Connection): Connection to server
  - `exchange_id` (String.t): Exchange identifier (from the Metadata -> Exchanges)
  - `opts` (keyword): Optional parameters

  ### Returns

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

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