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

  alias FinFeedAPISECRESTAPI.Connection
  import FinFeedAPISECRESTAPI.RequestBuilder

  @doc """
  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. :::

  ### Parameters

  - `connection` (FinFeedAPISECRESTAPI.Connection): Connection to server
  - `accession_number` (String.t): The SEC filing accession number used to retrieve the filing from EDGAR database.
  - `opts` (keyword): Optional parameters
    - `:type` (DtoExtractorType): Result type (text or html, default: text)

  ### Returns

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

    request =
      %{}
      |> method(:get)
      |> url("/v1/extractor")
      |> add_param(:query, :accession_number, accession_number)
      |> 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

  @doc """
  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. :::

  ### Parameters

  - `connection` (FinFeedAPISECRESTAPI.Connection): Connection to server
  - `accession_number` (String.t): The SEC filing accession number used to retrieve the filing from EDGAR database.
  - `item_number` (String.t): The specific item number to extract (e.g., \"1.01\", \"2.01\", \"7.01\").
  - `opts` (keyword): Optional parameters
    - `:type` (DtoExtractorType): Result type (text or html, default: text)

  ### Returns

  - `{:ok, String.t}` on success
  - `{:error, Tesla.Env.t}` on failure
  """
  @spec v1_extractor_item_get(Tesla.Env.client, String.t, String.t, keyword()) :: {:ok, nil} | {:ok, FinFeedAPISECRESTAPI.Model.MvcValidationProblemDetails.t} | {:ok, FinFeedAPISECRESTAPI.Model.MvcProblemDetails.t} | {:ok, String.t} | {:error, Tesla.Env.t}
  def v1_extractor_item_get(connection, accession_number, item_number, opts \\ []) do
    optional_params = %{
      :type => :query
    }

    request =
      %{}
      |> method(:get)
      |> url("/v1/extractor/item")
      |> add_param(:query, :accession_number, accession_number)
      |> add_param(:query, :item_number, item_number)
      |> 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
