# This file was auto-generated by Fern from our API Definition.

import typing

from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
from ..core.request_options import RequestOptions
from ..types.list_table_extractors_response import ListTableExtractorsResponse
from .raw_client import AsyncRawTableExtractorsClient, RawTableExtractorsClient


class TableExtractorsClient:
    def __init__(self, *, client_wrapper: SyncClientWrapper):
        self._raw_client = RawTableExtractorsClient(client_wrapper=client_wrapper)

    @property
    def with_raw_response(self) -> RawTableExtractorsClient:
        """
        Retrieves a raw implementation of this client that returns raw responses.

        Returns
        -------
        RawTableExtractorsClient
        """
        return self._raw_client

    def list(
        self,
        *,
        request_timeout: typing.Optional[int] = None,
        request_timeout_millis: typing.Optional[int] = None,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> ListTableExtractorsResponse:
        """
        Table extractors are used to extract tabular data from documents during indexing.

        Parameters
        ----------
        request_timeout : typing.Optional[int]
            The API will make a best effort to complete the request in the specified seconds or time out.

        request_timeout_millis : typing.Optional[int]
            The API will make a best effort to complete the request in the specified milliseconds or time out.

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        ListTableExtractorsResponse
            List of supported table extractors.

        Examples
        --------
        from vectara import Vectara
        client = Vectara(api_key="YOUR_API_KEY", client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET", )
        client.table_extractors.list()
        """
        response = self._raw_client.list(
            request_timeout=request_timeout,
            request_timeout_millis=request_timeout_millis,
            request_options=request_options,
        )
        return response.data


class AsyncTableExtractorsClient:
    def __init__(self, *, client_wrapper: AsyncClientWrapper):
        self._raw_client = AsyncRawTableExtractorsClient(client_wrapper=client_wrapper)

    @property
    def with_raw_response(self) -> AsyncRawTableExtractorsClient:
        """
        Retrieves a raw implementation of this client that returns raw responses.

        Returns
        -------
        AsyncRawTableExtractorsClient
        """
        return self._raw_client

    async def list(
        self,
        *,
        request_timeout: typing.Optional[int] = None,
        request_timeout_millis: typing.Optional[int] = None,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> ListTableExtractorsResponse:
        """
        Table extractors are used to extract tabular data from documents during indexing.

        Parameters
        ----------
        request_timeout : typing.Optional[int]
            The API will make a best effort to complete the request in the specified seconds or time out.

        request_timeout_millis : typing.Optional[int]
            The API will make a best effort to complete the request in the specified milliseconds or time out.

        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        ListTableExtractorsResponse
            List of supported table extractors.

        Examples
        --------
        from vectara import AsyncVectara
        import asyncio
        client = AsyncVectara(api_key="YOUR_API_KEY", client_id="YOUR_CLIENT_ID", client_secret="YOUR_CLIENT_SECRET", )
        async def main() -> None:
            await client.table_extractors.list()
        asyncio.run(main())
        """
        response = await self._raw_client.list(
            request_timeout=request_timeout,
            request_timeout_millis=request_timeout_millis,
            request_options=request_options,
        )
        return response.data
