# 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 .raw_client import AsyncRawManageEntitiesClient, RawManageEntitiesClient
from .types.list_all_entities_request_sort_by import ListAllEntitiesRequestSortBy
from .types.list_all_entities_request_status import ListAllEntitiesRequestStatus
from .types.list_all_entities_response import ListAllEntitiesResponse


class ManageEntitiesClient:
    def __init__(self, *, client_wrapper: SyncClientWrapper):
        self._raw_client = RawManageEntitiesClient(client_wrapper=client_wrapper)

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

        Returns
        -------
        RawManageEntitiesClient
        """
        return self._raw_client

    def list_all_entities(
        self,
        *,
        page: typing.Optional[int] = None,
        page_limit: typing.Optional[int] = None,
        name: typing.Optional[str] = None,
        status: typing.Optional[ListAllEntitiesRequestStatus] = None,
        sort_by: typing.Optional[ListAllEntitiesRequestSortBy] = None,
        sort_option: typing.Optional[str] = None,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> ListAllEntitiesResponse:
        """
        This method returns a list of entities from all entity collections.
        This is an internal API primarily used by the search interface.

        Parameters
        ----------
        page : typing.Optional[int]
            A number that identifies the page to retrieve.

            **Default**: `1`.

        page_limit : typing.Optional[int]
            The number of items to return on each page.

            **Default**: `10`.
            **Max**: `50`.

        name : typing.Optional[str]
            Filter entities by name.

        status : typing.Optional[ListAllEntitiesRequestStatus]
            Filter entities by status.

        sort_by : typing.Optional[ListAllEntitiesRequestSortBy]
            Field to sort by.

        sort_option : typing.Optional[str]
            The sorting direction. The following options are available:
            - `asc`
            - `desc`

            **Default**: `desc`.

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

        Returns
        -------
        ListAllEntitiesResponse
            The entities have been successfully retrieved.

        Examples
        --------
        from twelvelabs import TwelveLabs

        client = TwelveLabs(
            api_key="YOUR_API_KEY",
        )
        client.manage_entities.list_all_entities(
            page=1,
            page_limit=10,
            name="foo",
            status="processing",
            sort_by="created_at",
            sort_option="desc",
        )
        """
        _response = self._raw_client.list_all_entities(
            page=page,
            page_limit=page_limit,
            name=name,
            status=status,
            sort_by=sort_by,
            sort_option=sort_option,
            request_options=request_options,
        )
        return _response.data


class AsyncManageEntitiesClient:
    def __init__(self, *, client_wrapper: AsyncClientWrapper):
        self._raw_client = AsyncRawManageEntitiesClient(client_wrapper=client_wrapper)

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

        Returns
        -------
        AsyncRawManageEntitiesClient
        """
        return self._raw_client

    async def list_all_entities(
        self,
        *,
        page: typing.Optional[int] = None,
        page_limit: typing.Optional[int] = None,
        name: typing.Optional[str] = None,
        status: typing.Optional[ListAllEntitiesRequestStatus] = None,
        sort_by: typing.Optional[ListAllEntitiesRequestSortBy] = None,
        sort_option: typing.Optional[str] = None,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> ListAllEntitiesResponse:
        """
        This method returns a list of entities from all entity collections.
        This is an internal API primarily used by the search interface.

        Parameters
        ----------
        page : typing.Optional[int]
            A number that identifies the page to retrieve.

            **Default**: `1`.

        page_limit : typing.Optional[int]
            The number of items to return on each page.

            **Default**: `10`.
            **Max**: `50`.

        name : typing.Optional[str]
            Filter entities by name.

        status : typing.Optional[ListAllEntitiesRequestStatus]
            Filter entities by status.

        sort_by : typing.Optional[ListAllEntitiesRequestSortBy]
            Field to sort by.

        sort_option : typing.Optional[str]
            The sorting direction. The following options are available:
            - `asc`
            - `desc`

            **Default**: `desc`.

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

        Returns
        -------
        ListAllEntitiesResponse
            The entities have been successfully retrieved.

        Examples
        --------
        import asyncio

        from twelvelabs import AsyncTwelveLabs

        client = AsyncTwelveLabs(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.manage_entities.list_all_entities(
                page=1,
                page_limit=10,
                name="foo",
                status="processing",
                sort_by="created_at",
                sort_option="desc",
            )


        asyncio.run(main())
        """
        _response = await self._raw_client.list_all_entities(
            page=page,
            page_limit=page_limit,
            name=name,
            status=status,
            sort_by=sort_by,
            sort_option=sort_option,
            request_options=request_options,
        )
        return _response.data
