=begin
#FinFeedAPI SEC REST API

#No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)

The version of the OpenAPI document: v1
Contact: support@apibricks.io
Generated by: https://openapi-generator.tech
Generator version: 7.13.0

=end

require 'cgi'

module OpenapiClient
  class XBRLConversionApi
    attr_accessor :api_client

    def initialize(api_client = ApiClient.default)
      @api_client = api_client
    end
    # 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\"       }     ]   } } ```
    # @param [Hash] opts the optional parameters
    # @option opts [String] :htm_url URL of the filing ending with .htm or .html
    # @option opts [String] :xbrl_url URL of the XBRL file ending with .xml
    # @option opts [String] :accession_no SEC filing accession number
    # @return [Hash<String, Object>]
    def v1_xbrl_converter_get(opts = {})
      data, _status_code, _headers = v1_xbrl_converter_get_with_http_info(opts)
      data
    end

    # 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 &#x60;&#x60;&#x60;json {   \&quot;StatementsOfIncome\&quot;: {     \&quot;RevenueFromContractWithCustomerExcludingAssessedTax\&quot;: [       {         \&quot;decimals\&quot;: \&quot;-6\&quot;,         \&quot;unitRef\&quot;: \&quot;U_USD\&quot;,         \&quot;period\&quot;: {           \&quot;startDate\&quot;: \&quot;2023-07-01\&quot;,           \&quot;endDate\&quot;: \&quot;2024-06-30\&quot;         },         \&quot;value\&quot;: \&quot;245122000000\&quot;       }     ]   } } &#x60;&#x60;&#x60;
    # @param [Hash] opts the optional parameters
    # @option opts [String] :htm_url URL of the filing ending with .htm or .html
    # @option opts [String] :xbrl_url URL of the XBRL file ending with .xml
    # @option opts [String] :accession_no SEC filing accession number
    # @return [Array<(Hash<String, Object>, Integer, Hash)>] Hash<String, Object> data, response status code and response headers
    def v1_xbrl_converter_get_with_http_info(opts = {})
      if @api_client.config.debugging
        @api_client.config.logger.debug 'Calling API: XBRLConversionApi.v1_xbrl_converter_get ...'
      end
      # resource path
      local_var_path = '/v1/xbrl-converter'

      # query parameters
      query_params = opts[:query_params] || {}
      query_params[:'htm-url'] = opts[:'htm_url'] if !opts[:'htm_url'].nil?
      query_params[:'xbrl-url'] = opts[:'xbrl_url'] if !opts[:'xbrl_url'].nil?
      query_params[:'accession-no'] = opts[:'accession_no'] if !opts[:'accession_no'].nil?

      # header parameters
      header_params = opts[:header_params] || {}
      # HTTP header 'Accept' (if needed)
      header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']

      # form parameters
      form_params = opts[:form_params] || {}

      # http body (model)
      post_body = opts[:debug_body]

      # return_type
      return_type = opts[:debug_return_type] || 'Hash<String, Object>'

      # auth_names
      auth_names = opts[:debug_auth_names] || ['APIKey', 'JWT']

      new_options = opts.merge(
        :operation => :"XBRLConversionApi.v1_xbrl_converter_get",
        :header_params => header_params,
        :query_params => query_params,
        :form_params => form_params,
        :body => post_body,
        :auth_names => auth_names,
        :return_type => return_type
      )

      data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
      if @api_client.config.debugging
        @api_client.config.logger.debug "API called: XBRLConversionApi#v1_xbrl_converter_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
      end
      return data, status_code, headers
    end
  end
end
