# 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.get_agent_topics_response_model import GetAgentTopicsResponseModel
from .raw_client import AsyncRawTopicsClient, RawTopicsClient


class TopicsClient:
    def __init__(self, *, client_wrapper: SyncClientWrapper):
        self._raw_client = RawTopicsClient(client_wrapper=client_wrapper)

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

        Returns
        -------
        RawTopicsClient
        """
        return self._raw_client

    def get(
        self,
        agent_id: str,
        *,
        from_unix_secs: typing.Optional[int] = None,
        to_unix_secs: typing.Optional[int] = None,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> GetAgentTopicsResponseModel:
        """
        Returns the latest topic discovery run results for a given agent.

        Parameters
        ----------
        agent_id : str
            ID of the agent

        from_unix_secs : typing.Optional[int]
            Start of the window to view topics for. When set with to_unix_secs, per-day topics in the range are aggregated together.

        to_unix_secs : typing.Optional[int]
            End of the window to view topics for.

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

        Returns
        -------
        GetAgentTopicsResponseModel
            Successful Response

        Examples
        --------
        from elevenlabs import ElevenLabs

        client = ElevenLabs(
            api_key="YOUR_API_KEY",
        )
        client.conversational_ai.conversations.topics.get(
            agent_id="agent_id",
            from_unix_secs=1,
            to_unix_secs=1,
        )
        """
        _response = self._raw_client.get(
            agent_id, from_unix_secs=from_unix_secs, to_unix_secs=to_unix_secs, request_options=request_options
        )
        return _response.data


class AsyncTopicsClient:
    def __init__(self, *, client_wrapper: AsyncClientWrapper):
        self._raw_client = AsyncRawTopicsClient(client_wrapper=client_wrapper)

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

        Returns
        -------
        AsyncRawTopicsClient
        """
        return self._raw_client

    async def get(
        self,
        agent_id: str,
        *,
        from_unix_secs: typing.Optional[int] = None,
        to_unix_secs: typing.Optional[int] = None,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> GetAgentTopicsResponseModel:
        """
        Returns the latest topic discovery run results for a given agent.

        Parameters
        ----------
        agent_id : str
            ID of the agent

        from_unix_secs : typing.Optional[int]
            Start of the window to view topics for. When set with to_unix_secs, per-day topics in the range are aggregated together.

        to_unix_secs : typing.Optional[int]
            End of the window to view topics for.

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

        Returns
        -------
        GetAgentTopicsResponseModel
            Successful Response

        Examples
        --------
        import asyncio

        from elevenlabs import AsyncElevenLabs

        client = AsyncElevenLabs(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.conversational_ai.conversations.topics.get(
                agent_id="agent_id",
                from_unix_secs=1,
                to_unix_secs=1,
            )


        asyncio.run(main())
        """
        _response = await self._raw_client.get(
            agent_id, from_unix_secs=from_unix_secs, to_unix_secs=to_unix_secs, request_options=request_options
        )
        return _response.data
