# 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.base_output import BaseOutput
from .raw_client import AsyncRawBasesClient, RawBasesClient


class BasesClient:
    def __init__(self, *, client_wrapper: SyncClientWrapper):
        self._raw_client = RawBasesClient(client_wrapper=client_wrapper)

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

        Returns
        -------
        RawBasesClient
        """
        return self._raw_client

    def list_bases(
        self,
        *,
        app_id: str,
        base_name: typing.Optional[str] = None,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> typing.List[BaseOutput]:
        """
        Retrieve a list of bases filtered by app_id and base_name.

        Args:
            request (Request): The incoming request.
            app_id (str): The ID of the app to filter by.
            base_name (Optional[str], optional): The name of the base to filter by. Defaults to None.

        Returns:
            List[BaseOutput]: A list of BaseOutput objects representing the filtered bases.

        Raises:
            HTTPException: If there was an error retrieving the bases.

        Parameters
        ----------
        app_id : str

        base_name : typing.Optional[str]

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

        Returns
        -------
        typing.List[BaseOutput]
            Successful Response

        Examples
        --------
        from agenta import AgentaApi

        client = AgentaApi(
            api_key="YOUR_API_KEY",
        )
        client.bases.list_bases(
            app_id="app_id",
        )
        """
        _response = self._raw_client.list_bases(
            app_id=app_id, base_name=base_name, request_options=request_options
        )
        return _response.data


class AsyncBasesClient:
    def __init__(self, *, client_wrapper: AsyncClientWrapper):
        self._raw_client = AsyncRawBasesClient(client_wrapper=client_wrapper)

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

        Returns
        -------
        AsyncRawBasesClient
        """
        return self._raw_client

    async def list_bases(
        self,
        *,
        app_id: str,
        base_name: typing.Optional[str] = None,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> typing.List[BaseOutput]:
        """
        Retrieve a list of bases filtered by app_id and base_name.

        Args:
            request (Request): The incoming request.
            app_id (str): The ID of the app to filter by.
            base_name (Optional[str], optional): The name of the base to filter by. Defaults to None.

        Returns:
            List[BaseOutput]: A list of BaseOutput objects representing the filtered bases.

        Raises:
            HTTPException: If there was an error retrieving the bases.

        Parameters
        ----------
        app_id : str

        base_name : typing.Optional[str]

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

        Returns
        -------
        typing.List[BaseOutput]
            Successful Response

        Examples
        --------
        import asyncio

        from agenta import AsyncAgentaApi

        client = AsyncAgentaApi(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.bases.list_bases(
                app_id="app_id",
            )


        asyncio.run(main())
        """
        _response = await self._raw_client.list_bases(
            app_id=app_id, base_name=base_name, request_options=request_options
        )
        return _response.data
