# 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.dubbing_transcripts_response_model import DubbingTranscriptsResponseModel
from .raw_client import AsyncRawTranscriptsClient, RawTranscriptsClient
from .types.transcripts_get_request_format_type import TranscriptsGetRequestFormatType


class TranscriptsClient:
    def __init__(self, *, client_wrapper: SyncClientWrapper):
        self._raw_client = RawTranscriptsClient(client_wrapper=client_wrapper)

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

        Returns
        -------
        RawTranscriptsClient
        """
        return self._raw_client

    def get(
        self,
        dubbing_id: str,
        language_code: str,
        format_type: TranscriptsGetRequestFormatType,
        *,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> DubbingTranscriptsResponseModel:
        """
        Fetch the transcript for one of the languages in a dub.

        Parameters
        ----------
        dubbing_id : str
            ID of the dubbing project.

        language_code : str
            ISO-693 language code to retrieve the transcript for. Use 'source' to fetch the transcript of the original media.

        format_type : TranscriptsGetRequestFormatType
            Format to return transcript in. For subtitles use either 'srt' or 'webvtt', and for a full transcript use 'json'. The 'json' format is not yet supported for Dubbing Studio.

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

        Returns
        -------
        DubbingTranscriptsResponseModel
            Successful Response

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

        client = ElevenLabs(
            api_key="YOUR_API_KEY",
        )
        client.dubbing.transcripts.get(
            dubbing_id="dubbing_id",
            language_code="source",
            format_type="srt",
        )
        """
        _response = self._raw_client.get(dubbing_id, language_code, format_type, request_options=request_options)
        return _response.data


class AsyncTranscriptsClient:
    def __init__(self, *, client_wrapper: AsyncClientWrapper):
        self._raw_client = AsyncRawTranscriptsClient(client_wrapper=client_wrapper)

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

        Returns
        -------
        AsyncRawTranscriptsClient
        """
        return self._raw_client

    async def get(
        self,
        dubbing_id: str,
        language_code: str,
        format_type: TranscriptsGetRequestFormatType,
        *,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> DubbingTranscriptsResponseModel:
        """
        Fetch the transcript for one of the languages in a dub.

        Parameters
        ----------
        dubbing_id : str
            ID of the dubbing project.

        language_code : str
            ISO-693 language code to retrieve the transcript for. Use 'source' to fetch the transcript of the original media.

        format_type : TranscriptsGetRequestFormatType
            Format to return transcript in. For subtitles use either 'srt' or 'webvtt', and for a full transcript use 'json'. The 'json' format is not yet supported for Dubbing Studio.

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

        Returns
        -------
        DubbingTranscriptsResponseModel
            Successful Response

        Examples
        --------
        import asyncio

        from elevenlabs import AsyncElevenLabs

        client = AsyncElevenLabs(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.dubbing.transcripts.get(
                dubbing_id="dubbing_id",
                language_code="source",
                format_type="srt",
            )


        asyncio.run(main())
        """
        _response = await self._raw_client.get(dubbing_id, language_code, format_type, request_options=request_options)
        return _response.data
