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

  alias CoinAPIIndexesRESTAPI.Connection
  import CoinAPIIndexesRESTAPI.RequestBuilder

  @doc """
  List all periods
  Get full list of supported time periods              ### Available periods              Time unit | Period identifiers --------- | ----------- Second | 1SEC, 2SEC, 3SEC, 4SEC, 5SEC, 6SEC, 10SEC, 15SEC, 20SEC, 30SEC Minute | 1MIN, 2MIN, 3MIN, 4MIN, 5MIN, 6MIN, 10MIN, 15MIN, 20MIN, 30MIN Hour | 1HRS, 2HRS, 3HRS, 4HRS, 6HRS, 8HRS, 12HRS Day | 1DAY, 2DAY, 3DAY, 5DAY, 7DAY, 10DAY Month | 1MTH, 2MTH, 3MTH, 4MTH, 6MTH Year | 1YRS, 2YRS, 3YRS, 4YRS, 5YRS              :::tip You can assume that we will not remove any periods from this response, however, we may add new ones. :::

  ### Parameters

  - `connection` (CoinAPIIndexesRESTAPI.Connection): Connection to server
  - `opts` (keyword): Optional parameters

  ### Returns

  - `{:ok, [%MetadataTimeseriesPeriod{}, ...]}` on success
  - `{:error, Tesla.Env.t}` on failure
  """
  @spec v1_metadata_periods_get(Tesla.Env.client, keyword()) :: {:ok, [CoinAPIIndexesRESTAPI.Model.MetadataTimeseriesPeriod.t]} | {:error, Tesla.Env.t}
  def v1_metadata_periods_get(connection, _opts \\ []) do
    request =
      %{}
      |> method(:get)
      |> url("/v1/metadata/periods")
      |> Enum.into([])

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