# 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.order_deliverables_response import OrderDeliverablesResponse
from ....types.order_id import OrderId
from .raw_client import AsyncRawDeliverablesClient, RawDeliverablesClient


class DeliverablesClient:
    def __init__(self, *, client_wrapper: SyncClientWrapper):
        self._raw_client = RawDeliverablesClient(client_wrapper=client_wrapper)

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

        Returns
        -------
        RawDeliverablesClient
        """
        return self._raw_client

    def list(
        self, order_id: OrderId, *, request_options: typing.Optional[RequestOptions] = None
    ) -> OrderDeliverablesResponse:
        """
        Retrieves the delivered files for a completed order. Returns an empty list if the order is not yet completed.

        Parameters
        ----------
        order_id : OrderId
            The ID of the order.

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

        Returns
        -------
        OrderDeliverablesResponse
            Successful Response

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

        client = ElevenLabs(
            api_key="YOUR_API_KEY",
        )
        client.productions.orders.deliverables.list(
            order_id="order_id",
        )
        """
        _response = self._raw_client.list(order_id, request_options=request_options)
        return _response.data


class AsyncDeliverablesClient:
    def __init__(self, *, client_wrapper: AsyncClientWrapper):
        self._raw_client = AsyncRawDeliverablesClient(client_wrapper=client_wrapper)

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

        Returns
        -------
        AsyncRawDeliverablesClient
        """
        return self._raw_client

    async def list(
        self, order_id: OrderId, *, request_options: typing.Optional[RequestOptions] = None
    ) -> OrderDeliverablesResponse:
        """
        Retrieves the delivered files for a completed order. Returns an empty list if the order is not yet completed.

        Parameters
        ----------
        order_id : OrderId
            The ID of the order.

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

        Returns
        -------
        OrderDeliverablesResponse
            Successful Response

        Examples
        --------
        import asyncio

        from elevenlabs import AsyncElevenLabs

        client = AsyncElevenLabs(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.productions.orders.deliverables.list(
                order_id="order_id",
            )


        asyncio.run(main())
        """
        _response = await self._raw_client.list(order_id, request_options=request_options)
        return _response.data
