=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 ContentExtractionApi
    attr_accessor :api_client

    def initialize(api_client = ApiClient.default)
      @api_client = api_client
    end
    # Extract and classify SEC filing content
    # Retrieves filing content from the EDGAR database and intelligently classifies it according to form type and item categories.  ### Supported Form Types  Form Type | Description ----------|------------ 8-K      | Current report filing 10-K     | Annual report filing 10-Q     | Quarterly report filing  ### Content Classification - 8-K forms: Content classified by item numbers (e.g., 1.01, 2.01) - 10-K/10-Q forms: Items categorized by their respective part and item structure  :::note Both HTML and plain text documents are supported for content extraction. :::
    # @param accession_number [String] The SEC filing accession number used to retrieve the filing from EDGAR database.
    # @param [Hash] opts the optional parameters
    # @option opts [DTOExtractorType] :type Result type (text or html, default: text)
    # @return [Hash<String, Object>]
    def v1_extractor_get(accession_number, opts = {})
      data, _status_code, _headers = v1_extractor_get_with_http_info(accession_number, opts)
      data
    end

    # Extract and classify SEC filing content
    # Retrieves filing content from the EDGAR database and intelligently classifies it according to form type and item categories.  ### Supported Form Types  Form Type | Description ----------|------------ 8-K      | Current report filing 10-K     | Annual report filing 10-Q     | Quarterly report filing  ### Content Classification - 8-K forms: Content classified by item numbers (e.g., 1.01, 2.01) - 10-K/10-Q forms: Items categorized by their respective part and item structure  :::note Both HTML and plain text documents are supported for content extraction. :::
    # @param accession_number [String] The SEC filing accession number used to retrieve the filing from EDGAR database.
    # @param [Hash] opts the optional parameters
    # @option opts [DTOExtractorType] :type Result type (text or html, default: text)
    # @return [Array<(Hash<String, Object>, Integer, Hash)>] Hash<String, Object> data, response status code and response headers
    def v1_extractor_get_with_http_info(accession_number, opts = {})
      if @api_client.config.debugging
        @api_client.config.logger.debug 'Calling API: ContentExtractionApi.v1_extractor_get ...'
      end
      # verify the required parameter 'accession_number' is set
      if @api_client.config.client_side_validation && accession_number.nil?
        fail ArgumentError, "Missing the required parameter 'accession_number' when calling ContentExtractionApi.v1_extractor_get"
      end
      # resource path
      local_var_path = '/v1/extractor'

      # query parameters
      query_params = opts[:query_params] || {}
      query_params[:'accession_number'] = accession_number
      query_params[:'type'] = opts[:'type'] if !opts[:'type'].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 => :"ContentExtractionApi.v1_extractor_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: ContentExtractionApi#v1_extractor_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
      end
      return data, status_code, headers
    end

    # Extract specific item content from SEC filing
    # Retrieves filing content from the EDGAR database and returns only the text content of the specified item number.  ### Item Number Format  Form Type | Item Format Examples -----------|------------------- 8-K       | 1.01, 2.01, 7.01 10-K      | 1, 2, 3 10-K/10-Q | PartI 1, PartII 2  :::tip For best results, ensure the item number matches exactly with the filing's structure. :::
    # @param accession_number [String] The SEC filing accession number used to retrieve the filing from EDGAR database.
    # @param item_number [String] The specific item number to extract (e.g., \&quot;1.01\&quot;, \&quot;2.01\&quot;, \&quot;7.01\&quot;).
    # @param [Hash] opts the optional parameters
    # @option opts [DTOExtractorType] :type Result type (text or html, default: text)
    # @return [String]
    def v1_extractor_item_get(accession_number, item_number, opts = {})
      data, _status_code, _headers = v1_extractor_item_get_with_http_info(accession_number, item_number, opts)
      data
    end

    # Extract specific item content from SEC filing
    # Retrieves filing content from the EDGAR database and returns only the text content of the specified item number.  ### Item Number Format  Form Type | Item Format Examples -----------|------------------- 8-K       | 1.01, 2.01, 7.01 10-K      | 1, 2, 3 10-K/10-Q | PartI 1, PartII 2  :::tip For best results, ensure the item number matches exactly with the filing&#39;s structure. :::
    # @param accession_number [String] The SEC filing accession number used to retrieve the filing from EDGAR database.
    # @param item_number [String] The specific item number to extract (e.g., \&quot;1.01\&quot;, \&quot;2.01\&quot;, \&quot;7.01\&quot;).
    # @param [Hash] opts the optional parameters
    # @option opts [DTOExtractorType] :type Result type (text or html, default: text)
    # @return [Array<(String, Integer, Hash)>] String data, response status code and response headers
    def v1_extractor_item_get_with_http_info(accession_number, item_number, opts = {})
      if @api_client.config.debugging
        @api_client.config.logger.debug 'Calling API: ContentExtractionApi.v1_extractor_item_get ...'
      end
      # verify the required parameter 'accession_number' is set
      if @api_client.config.client_side_validation && accession_number.nil?
        fail ArgumentError, "Missing the required parameter 'accession_number' when calling ContentExtractionApi.v1_extractor_item_get"
      end
      # verify the required parameter 'item_number' is set
      if @api_client.config.client_side_validation && item_number.nil?
        fail ArgumentError, "Missing the required parameter 'item_number' when calling ContentExtractionApi.v1_extractor_item_get"
      end
      # resource path
      local_var_path = '/v1/extractor/item'

      # query parameters
      query_params = opts[:query_params] || {}
      query_params[:'accession_number'] = accession_number
      query_params[:'item_number'] = item_number
      query_params[:'type'] = opts[:'type'] if !opts[:'type'].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] || 'String'

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

      new_options = opts.merge(
        :operation => :"ContentExtractionApi.v1_extractor_item_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: ContentExtractionApi#v1_extractor_item_get\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
      end
      return data, status_code, headers
    end
  end
end
