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

defmodule FinFeedAPISECRESTAPI.Api.XBRLConversion do
  @moduledoc """
  API calls for all endpoints tagged `XBRLConversion`.
  """

  alias FinFeedAPISECRESTAPI.Connection
  import FinFeedAPISECRESTAPI.RequestBuilder

  @doc """
  Convert XBRL data to JSON format
  Converts XBRL data to JSON format using one of three possible input methods.  ### Input Methods  1. HTML URL (htm-url)    - URL of the filing ending with .htm or .html    - Both filing URLs and index page URLs are accepted    - Example: https://www.sec.gov/Archives/edgar/data/1318605/000156459021004599/tsla-10k_20201231.htm  2. XBRL URL (xbrl-url)    - URL of the XBRL file ending with .xml    - Can be found in the dataFiles array from Query API    - Example: https://www.sec.gov/Archives/edgar/data/1318605/000156459021004599/tsla-10k_20201231_htm.xml  3. Accession Number (accession-no)    - The SEC filing accession number    - Example: 0001564590-21-004599  :::note Only one of the three parameters should be provided. If multiple parameters are provided, the priority order is: 1. htm-url 2. xbrl-url 3. accession-no :::  ### Supported Filing Types  - Annual Reports (10-K) - Quarterly Reports (10-Q) - Current Reports (8-K) - Registration Statements (S-1, S-3) - Foreign Private Issuer Reports (20-F, 40-F)  ### Response Format  The API returns a JSON object containing: - Financial statements (Income Statement, Balance Sheet, Cash Flow Statement) - Accounting policies and footnotes - Company information - Filing metadata  ### Example Response ```json {   \"StatementsOfIncome\": {     \"RevenueFromContractWithCustomerExcludingAssessedTax\": [       {         \"decimals\": \"-6\",         \"unitRef\": \"U_USD\",         \"period\": {           \"startDate\": \"2023-07-01\",           \"endDate\": \"2024-06-30\"         },         \"value\": \"245122000000\"       }     ]   } } ```

  ### Parameters

  - `connection` (FinFeedAPISECRESTAPI.Connection): Connection to server
  - `opts` (keyword): Optional parameters
    - `:"htm-url"` (String.t): URL of the filing ending with .htm or .html
    - `:"xbrl-url"` (String.t): URL of the XBRL file ending with .xml
    - `:"accession-no"` (String.t): SEC filing accession number

  ### Returns

  - `{:ok, %{}}` on success
  - `{:error, Tesla.Env.t}` on failure
  """
  @spec v1_xbrl_converter_get(Tesla.Env.client, keyword()) :: {:ok, nil} | {:ok, %{optional(String.t) => any()}} | {:ok, FinFeedAPISECRESTAPI.Model.MvcValidationProblemDetails.t} | {:ok, FinFeedAPISECRESTAPI.Model.MvcProblemDetails.t} | {:error, Tesla.Env.t}
  def v1_xbrl_converter_get(connection, opts \\ []) do
    optional_params = %{
      :"htm-url" => :query,
      :"xbrl-url" => :query,
      :"accession-no" => :query
    }

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

    connection
    |> Connection.request(request)
    |> evaluate_response([
      {200, false},
      {400, FinFeedAPISECRESTAPI.Model.MvcValidationProblemDetails},
      {404, false},
      {500, FinFeedAPISECRESTAPI.Model.MvcProblemDetails}
    ])
  end
end
