# This file was auto-generated by Fern from our API Definition.

import typing

from .. import core
from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
from ..core.request_options import RequestOptions
from ..types.meta_request import MetaRequest
from ..types.test_set_output_response import TestSetOutputResponse
from ..types.test_set_simple_response import TestSetSimpleResponse
from ..types.testcase_response import TestcaseResponse
from ..types.testset import Testset
from ..types.testset_response import TestsetResponse
from ..types.testsets_response import TestsetsResponse
from .raw_client import AsyncRawTestsetsClient, RawTestsetsClient
from .types.create_testset_from_file_request_file_type import (
    CreateTestsetFromFileRequestFileType,
)
from .types.fetch_testset_to_file_request_file_type import (
    FetchTestsetToFileRequestFileType,
)
from .types.update_testset_from_file_request_file_type import (
    UpdateTestsetFromFileRequestFileType,
)

# this is used as the default value for optional parameters
OMIT = typing.cast(typing.Any, ...)


class TestsetsClient:
    def __init__(self, *, client_wrapper: SyncClientWrapper):
        self._raw_client = RawTestsetsClient(client_wrapper=client_wrapper)

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

        Returns
        -------
        RawTestsetsClient
        """
        return self._raw_client

    def upload_file(
        self,
        *,
        file: core.File,
        upload_type: typing.Optional[str] = OMIT,
        testset_name: typing.Optional[str] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> TestSetSimpleResponse:
        """
        Uploads a CSV or JSON file and saves its data to Postgres.

        Args:
        upload_type : Either a json or csv file.
            file (UploadFile): The CSV or JSON file to upload.
            testset_name (Optional): the name of the testset if provided.

        Returns:
            dict: The result of the upload process.

        Parameters
        ----------
        file : core.File
            See core.File for more documentation

        upload_type : typing.Optional[str]

        testset_name : typing.Optional[str]

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

        Returns
        -------
        TestSetSimpleResponse
            Successful Response

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

        client = AgentaApi(
            api_key="YOUR_API_KEY",
        )
        client.testsets.upload_file()
        """
        _response = self._raw_client.upload_file(
            file=file,
            upload_type=upload_type,
            testset_name=testset_name,
            request_options=request_options,
        )
        return _response.data

    def import_testset(
        self,
        *,
        authorization: typing.Optional[str] = None,
        endpoint: typing.Optional[str] = OMIT,
        testset_name: typing.Optional[str] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> TestSetSimpleResponse:
        """
        Import JSON testset data from an endpoint and save it to Postgres.

        Args:
            endpoint (str): An endpoint URL to import data from.
            testset_name (str): the name of the testset if provided.

        Returns:
            dict: The result of the import process.

        Parameters
        ----------
        authorization : typing.Optional[str]

        endpoint : typing.Optional[str]

        testset_name : typing.Optional[str]

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

        Returns
        -------
        TestSetSimpleResponse
            Successful Response

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

        client = AgentaApi(
            api_key="YOUR_API_KEY",
        )
        client.testsets.import_testset()
        """
        _response = self._raw_client.import_testset(
            authorization=authorization,
            endpoint=endpoint,
            testset_name=testset_name,
            request_options=request_options,
        )
        return _response.data

    def get_testsets(
        self, *, request_options: typing.Optional[RequestOptions] = None
    ) -> typing.List[TestSetOutputResponse]:
        """
        Get all testsets.

        Returns:
        - A list of testset objects.

        Raises:
        - `HTTPException` with status code 404 if no testsets are found.

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

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

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

        client = AgentaApi(
            api_key="YOUR_API_KEY",
        )
        client.testsets.get_testsets()
        """
        _response = self._raw_client.get_testsets(request_options=request_options)
        return _response.data

    def create_testset(
        self,
        *,
        testset: Testset,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> TestsetResponse:
        """
        Parameters
        ----------
        testset : Testset

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

        Returns
        -------
        TestsetResponse
            Successful Response

        Examples
        --------
        from agenta import AgentaApi, Testset

        client = AgentaApi(
            api_key="YOUR_API_KEY",
        )
        client.testsets.create_testset(
            testset=Testset(),
        )
        """
        _response = self._raw_client.create_testset(
            testset=testset, request_options=request_options
        )
        return _response.data

    def delete_testsets(
        self,
        *,
        testset_ids: typing.Sequence[str],
        request_options: typing.Optional[RequestOptions] = None,
    ) -> typing.List[str]:
        """
        Delete specific testsets based on their unique IDs.

        Args:
        testset_ids (List[str]): The unique identifiers of the testsets to delete.

        Returns:
        A list of the deleted testsets' IDs.

        Parameters
        ----------
        testset_ids : typing.Sequence[str]

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

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

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

        client = AgentaApi(
            api_key="YOUR_API_KEY",
        )
        client.testsets.delete_testsets(
            testset_ids=["testset_ids"],
        )
        """
        _response = self._raw_client.delete_testsets(
            testset_ids=testset_ids, request_options=request_options
        )
        return _response.data

    def get_single_testset(
        self,
        testset_id: str,
        *,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> typing.Optional[typing.Any]:
        """
        Fetch a specific testset in Postgres.

        Args:
            testset_id (str): The id of the testset to fetch.

        Returns:
            The requested testset if found, else an HTTPException.

        Parameters
        ----------
        testset_id : str

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

        Returns
        -------
        typing.Optional[typing.Any]
            Successful Response

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

        client = AgentaApi(
            api_key="YOUR_API_KEY",
        )
        client.testsets.get_single_testset(
            testset_id="testset_id",
        )
        """
        _response = self._raw_client.get_single_testset(
            testset_id, request_options=request_options
        )
        return _response.data

    def update_testset(
        self,
        testset_id: str,
        *,
        name: str,
        csvdata: typing.Sequence[typing.Dict[str, typing.Optional[typing.Any]]],
        request_options: typing.Optional[RequestOptions] = None,
    ) -> typing.Optional[typing.Any]:
        """
        Update a testset with given id, update the testset in Postgres.

        Args:
        testset_id (str): id of the test set to be updated.
        csvdata (NewTestset): New data to replace the old testset.

        Returns:
        str: The id of the test set updated.

        Parameters
        ----------
        testset_id : str

        name : str

        csvdata : typing.Sequence[typing.Dict[str, typing.Optional[typing.Any]]]

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

        Returns
        -------
        typing.Optional[typing.Any]
            Successful Response

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

        client = AgentaApi(
            api_key="YOUR_API_KEY",
        )
        client.testsets.update_testset(
            testset_id="testset_id",
            name="name",
            csvdata=[{"key": "value"}],
        )
        """
        _response = self._raw_client.update_testset(
            testset_id, name=name, csvdata=csvdata, request_options=request_options
        )
        return _response.data

    def list_testsets(
        self, *, request_options: typing.Optional[RequestOptions] = None
    ) -> TestsetResponse:
        """
        Parameters
        ----------
        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        TestsetResponse
            Successful Response

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

        client = AgentaApi(
            api_key="YOUR_API_KEY",
        )
        client.testsets.list_testsets()
        """
        _response = self._raw_client.list_testsets(request_options=request_options)
        return _response.data

    def fetch_testset(
        self,
        testset_id: str,
        *,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> TestsetResponse:
        """
        Parameters
        ----------
        testset_id : str

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

        Returns
        -------
        TestsetResponse
            Successful Response

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

        client = AgentaApi(
            api_key="YOUR_API_KEY",
        )
        client.testsets.fetch_testset(
            testset_id="testset_id",
        )
        """
        _response = self._raw_client.fetch_testset(
            testset_id, request_options=request_options
        )
        return _response.data

    def edit_testset(
        self,
        testset_id: str,
        *,
        testset: Testset,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> TestsetResponse:
        """
        Parameters
        ----------
        testset_id : str

        testset : Testset

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

        Returns
        -------
        TestsetResponse
            Successful Response

        Examples
        --------
        from agenta import AgentaApi, Testset

        client = AgentaApi(
            api_key="YOUR_API_KEY",
        )
        client.testsets.edit_testset(
            testset_id="testset_id",
            testset=Testset(),
        )
        """
        _response = self._raw_client.edit_testset(
            testset_id, testset=testset, request_options=request_options
        )
        return _response.data

    def archive_testset(
        self,
        testset_id: str,
        *,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> TestsetResponse:
        """
        Parameters
        ----------
        testset_id : str

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

        Returns
        -------
        TestsetResponse
            Successful Response

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

        client = AgentaApi(
            api_key="YOUR_API_KEY",
        )
        client.testsets.archive_testset(
            testset_id="testset_id",
        )
        """
        _response = self._raw_client.archive_testset(
            testset_id, request_options=request_options
        )
        return _response.data

    def unarchive_testset(
        self,
        testset_id: str,
        *,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> TestsetResponse:
        """
        Parameters
        ----------
        testset_id : str

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

        Returns
        -------
        TestsetResponse
            Successful Response

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

        client = AgentaApi(
            api_key="YOUR_API_KEY",
        )
        client.testsets.unarchive_testset(
            testset_id="testset_id",
        )
        """
        _response = self._raw_client.unarchive_testset(
            testset_id, request_options=request_options
        )
        return _response.data

    def query_testsets(
        self,
        *,
        request: typing.Optional[MetaRequest] = None,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> TestsetsResponse:
        """
        Parameters
        ----------
        request : typing.Optional[MetaRequest]

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

        Returns
        -------
        TestsetsResponse
            Successful Response

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

        client = AgentaApi(
            api_key="YOUR_API_KEY",
        )
        client.testsets.query_testsets()
        """
        _response = self._raw_client.query_testsets(
            request=request, request_options=request_options
        )
        return _response.data

    def create_testset_from_file(
        self,
        *,
        file: core.File,
        file_type: typing.Optional[CreateTestsetFromFileRequestFileType] = OMIT,
        testset_slug: typing.Optional[str] = OMIT,
        testset_name: typing.Optional[str] = OMIT,
        testset_description: typing.Optional[str] = OMIT,
        testset_meta: typing.Optional[typing.List[str]] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> TestsetResponse:
        """
        Parameters
        ----------
        file : core.File
            See core.File for more documentation

        file_type : typing.Optional[CreateTestsetFromFileRequestFileType]

        testset_slug : typing.Optional[str]

        testset_name : typing.Optional[str]

        testset_description : typing.Optional[str]

        testset_meta : typing.Optional[typing.List[str]]

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

        Returns
        -------
        TestsetResponse
            Successful Response

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

        client = AgentaApi(
            api_key="YOUR_API_KEY",
        )
        client.testsets.create_testset_from_file()
        """
        _response = self._raw_client.create_testset_from_file(
            file=file,
            file_type=file_type,
            testset_slug=testset_slug,
            testset_name=testset_name,
            testset_description=testset_description,
            testset_meta=testset_meta,
            request_options=request_options,
        )
        return _response.data

    def update_testset_from_file(
        self,
        testset_id: str,
        *,
        file: core.File,
        file_type: typing.Optional[UpdateTestsetFromFileRequestFileType] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> TestsetResponse:
        """
        Parameters
        ----------
        testset_id : str

        file : core.File
            See core.File for more documentation

        file_type : typing.Optional[UpdateTestsetFromFileRequestFileType]

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

        Returns
        -------
        TestsetResponse
            Successful Response

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

        client = AgentaApi(
            api_key="YOUR_API_KEY",
        )
        client.testsets.update_testset_from_file(
            testset_id="testset_id",
        )
        """
        _response = self._raw_client.update_testset_from_file(
            testset_id, file=file, file_type=file_type, request_options=request_options
        )
        return _response.data

    def fetch_testset_to_file(
        self,
        testset_id: str,
        *,
        file_type: typing.Optional[FetchTestsetToFileRequestFileType] = None,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> TestsetResponse:
        """
        Parameters
        ----------
        testset_id : str

        file_type : typing.Optional[FetchTestsetToFileRequestFileType]

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

        Returns
        -------
        TestsetResponse
            Successful Response

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

        client = AgentaApi(
            api_key="YOUR_API_KEY",
        )
        client.testsets.fetch_testset_to_file(
            testset_id="testset_id",
        )
        """
        _response = self._raw_client.fetch_testset_to_file(
            testset_id, file_type=file_type, request_options=request_options
        )
        return _response.data

    def fetch_testcase(
        self,
        testcase_id: str,
        *,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> TestcaseResponse:
        """
        Parameters
        ----------
        testcase_id : str

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

        Returns
        -------
        TestcaseResponse
            Successful Response

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

        client = AgentaApi(
            api_key="YOUR_API_KEY",
        )
        client.testsets.fetch_testcase(
            testcase_id="testcase_id",
        )
        """
        _response = self._raw_client.fetch_testcase(
            testcase_id, request_options=request_options
        )
        return _response.data


class AsyncTestsetsClient:
    def __init__(self, *, client_wrapper: AsyncClientWrapper):
        self._raw_client = AsyncRawTestsetsClient(client_wrapper=client_wrapper)

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

        Returns
        -------
        AsyncRawTestsetsClient
        """
        return self._raw_client

    async def upload_file(
        self,
        *,
        file: core.File,
        upload_type: typing.Optional[str] = OMIT,
        testset_name: typing.Optional[str] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> TestSetSimpleResponse:
        """
        Uploads a CSV or JSON file and saves its data to Postgres.

        Args:
        upload_type : Either a json or csv file.
            file (UploadFile): The CSV or JSON file to upload.
            testset_name (Optional): the name of the testset if provided.

        Returns:
            dict: The result of the upload process.

        Parameters
        ----------
        file : core.File
            See core.File for more documentation

        upload_type : typing.Optional[str]

        testset_name : typing.Optional[str]

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

        Returns
        -------
        TestSetSimpleResponse
            Successful Response

        Examples
        --------
        import asyncio

        from agenta import AsyncAgentaApi

        client = AsyncAgentaApi(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.testsets.upload_file()


        asyncio.run(main())
        """
        _response = await self._raw_client.upload_file(
            file=file,
            upload_type=upload_type,
            testset_name=testset_name,
            request_options=request_options,
        )
        return _response.data

    async def import_testset(
        self,
        *,
        authorization: typing.Optional[str] = None,
        endpoint: typing.Optional[str] = OMIT,
        testset_name: typing.Optional[str] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> TestSetSimpleResponse:
        """
        Import JSON testset data from an endpoint and save it to Postgres.

        Args:
            endpoint (str): An endpoint URL to import data from.
            testset_name (str): the name of the testset if provided.

        Returns:
            dict: The result of the import process.

        Parameters
        ----------
        authorization : typing.Optional[str]

        endpoint : typing.Optional[str]

        testset_name : typing.Optional[str]

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

        Returns
        -------
        TestSetSimpleResponse
            Successful Response

        Examples
        --------
        import asyncio

        from agenta import AsyncAgentaApi

        client = AsyncAgentaApi(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.testsets.import_testset()


        asyncio.run(main())
        """
        _response = await self._raw_client.import_testset(
            authorization=authorization,
            endpoint=endpoint,
            testset_name=testset_name,
            request_options=request_options,
        )
        return _response.data

    async def get_testsets(
        self, *, request_options: typing.Optional[RequestOptions] = None
    ) -> typing.List[TestSetOutputResponse]:
        """
        Get all testsets.

        Returns:
        - A list of testset objects.

        Raises:
        - `HTTPException` with status code 404 if no testsets are found.

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

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

        Examples
        --------
        import asyncio

        from agenta import AsyncAgentaApi

        client = AsyncAgentaApi(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.testsets.get_testsets()


        asyncio.run(main())
        """
        _response = await self._raw_client.get_testsets(request_options=request_options)
        return _response.data

    async def create_testset(
        self,
        *,
        testset: Testset,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> TestsetResponse:
        """
        Parameters
        ----------
        testset : Testset

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

        Returns
        -------
        TestsetResponse
            Successful Response

        Examples
        --------
        import asyncio

        from agenta import AsyncAgentaApi, Testset

        client = AsyncAgentaApi(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.testsets.create_testset(
                testset=Testset(),
            )


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

    async def delete_testsets(
        self,
        *,
        testset_ids: typing.Sequence[str],
        request_options: typing.Optional[RequestOptions] = None,
    ) -> typing.List[str]:
        """
        Delete specific testsets based on their unique IDs.

        Args:
        testset_ids (List[str]): The unique identifiers of the testsets to delete.

        Returns:
        A list of the deleted testsets' IDs.

        Parameters
        ----------
        testset_ids : typing.Sequence[str]

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

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

        Examples
        --------
        import asyncio

        from agenta import AsyncAgentaApi

        client = AsyncAgentaApi(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.testsets.delete_testsets(
                testset_ids=["testset_ids"],
            )


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

    async def get_single_testset(
        self,
        testset_id: str,
        *,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> typing.Optional[typing.Any]:
        """
        Fetch a specific testset in Postgres.

        Args:
            testset_id (str): The id of the testset to fetch.

        Returns:
            The requested testset if found, else an HTTPException.

        Parameters
        ----------
        testset_id : str

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

        Returns
        -------
        typing.Optional[typing.Any]
            Successful Response

        Examples
        --------
        import asyncio

        from agenta import AsyncAgentaApi

        client = AsyncAgentaApi(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.testsets.get_single_testset(
                testset_id="testset_id",
            )


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

    async def update_testset(
        self,
        testset_id: str,
        *,
        name: str,
        csvdata: typing.Sequence[typing.Dict[str, typing.Optional[typing.Any]]],
        request_options: typing.Optional[RequestOptions] = None,
    ) -> typing.Optional[typing.Any]:
        """
        Update a testset with given id, update the testset in Postgres.

        Args:
        testset_id (str): id of the test set to be updated.
        csvdata (NewTestset): New data to replace the old testset.

        Returns:
        str: The id of the test set updated.

        Parameters
        ----------
        testset_id : str

        name : str

        csvdata : typing.Sequence[typing.Dict[str, typing.Optional[typing.Any]]]

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

        Returns
        -------
        typing.Optional[typing.Any]
            Successful Response

        Examples
        --------
        import asyncio

        from agenta import AsyncAgentaApi

        client = AsyncAgentaApi(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.testsets.update_testset(
                testset_id="testset_id",
                name="name",
                csvdata=[{"key": "value"}],
            )


        asyncio.run(main())
        """
        _response = await self._raw_client.update_testset(
            testset_id, name=name, csvdata=csvdata, request_options=request_options
        )
        return _response.data

    async def list_testsets(
        self, *, request_options: typing.Optional[RequestOptions] = None
    ) -> TestsetResponse:
        """
        Parameters
        ----------
        request_options : typing.Optional[RequestOptions]
            Request-specific configuration.

        Returns
        -------
        TestsetResponse
            Successful Response

        Examples
        --------
        import asyncio

        from agenta import AsyncAgentaApi

        client = AsyncAgentaApi(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.testsets.list_testsets()


        asyncio.run(main())
        """
        _response = await self._raw_client.list_testsets(
            request_options=request_options
        )
        return _response.data

    async def fetch_testset(
        self,
        testset_id: str,
        *,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> TestsetResponse:
        """
        Parameters
        ----------
        testset_id : str

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

        Returns
        -------
        TestsetResponse
            Successful Response

        Examples
        --------
        import asyncio

        from agenta import AsyncAgentaApi

        client = AsyncAgentaApi(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.testsets.fetch_testset(
                testset_id="testset_id",
            )


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

    async def edit_testset(
        self,
        testset_id: str,
        *,
        testset: Testset,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> TestsetResponse:
        """
        Parameters
        ----------
        testset_id : str

        testset : Testset

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

        Returns
        -------
        TestsetResponse
            Successful Response

        Examples
        --------
        import asyncio

        from agenta import AsyncAgentaApi, Testset

        client = AsyncAgentaApi(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.testsets.edit_testset(
                testset_id="testset_id",
                testset=Testset(),
            )


        asyncio.run(main())
        """
        _response = await self._raw_client.edit_testset(
            testset_id, testset=testset, request_options=request_options
        )
        return _response.data

    async def archive_testset(
        self,
        testset_id: str,
        *,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> TestsetResponse:
        """
        Parameters
        ----------
        testset_id : str

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

        Returns
        -------
        TestsetResponse
            Successful Response

        Examples
        --------
        import asyncio

        from agenta import AsyncAgentaApi

        client = AsyncAgentaApi(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.testsets.archive_testset(
                testset_id="testset_id",
            )


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

    async def unarchive_testset(
        self,
        testset_id: str,
        *,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> TestsetResponse:
        """
        Parameters
        ----------
        testset_id : str

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

        Returns
        -------
        TestsetResponse
            Successful Response

        Examples
        --------
        import asyncio

        from agenta import AsyncAgentaApi

        client = AsyncAgentaApi(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.testsets.unarchive_testset(
                testset_id="testset_id",
            )


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

    async def query_testsets(
        self,
        *,
        request: typing.Optional[MetaRequest] = None,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> TestsetsResponse:
        """
        Parameters
        ----------
        request : typing.Optional[MetaRequest]

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

        Returns
        -------
        TestsetsResponse
            Successful Response

        Examples
        --------
        import asyncio

        from agenta import AsyncAgentaApi

        client = AsyncAgentaApi(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.testsets.query_testsets()


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

    async def create_testset_from_file(
        self,
        *,
        file: core.File,
        file_type: typing.Optional[CreateTestsetFromFileRequestFileType] = OMIT,
        testset_slug: typing.Optional[str] = OMIT,
        testset_name: typing.Optional[str] = OMIT,
        testset_description: typing.Optional[str] = OMIT,
        testset_meta: typing.Optional[typing.List[str]] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> TestsetResponse:
        """
        Parameters
        ----------
        file : core.File
            See core.File for more documentation

        file_type : typing.Optional[CreateTestsetFromFileRequestFileType]

        testset_slug : typing.Optional[str]

        testset_name : typing.Optional[str]

        testset_description : typing.Optional[str]

        testset_meta : typing.Optional[typing.List[str]]

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

        Returns
        -------
        TestsetResponse
            Successful Response

        Examples
        --------
        import asyncio

        from agenta import AsyncAgentaApi

        client = AsyncAgentaApi(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.testsets.create_testset_from_file()


        asyncio.run(main())
        """
        _response = await self._raw_client.create_testset_from_file(
            file=file,
            file_type=file_type,
            testset_slug=testset_slug,
            testset_name=testset_name,
            testset_description=testset_description,
            testset_meta=testset_meta,
            request_options=request_options,
        )
        return _response.data

    async def update_testset_from_file(
        self,
        testset_id: str,
        *,
        file: core.File,
        file_type: typing.Optional[UpdateTestsetFromFileRequestFileType] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> TestsetResponse:
        """
        Parameters
        ----------
        testset_id : str

        file : core.File
            See core.File for more documentation

        file_type : typing.Optional[UpdateTestsetFromFileRequestFileType]

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

        Returns
        -------
        TestsetResponse
            Successful Response

        Examples
        --------
        import asyncio

        from agenta import AsyncAgentaApi

        client = AsyncAgentaApi(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.testsets.update_testset_from_file(
                testset_id="testset_id",
            )


        asyncio.run(main())
        """
        _response = await self._raw_client.update_testset_from_file(
            testset_id, file=file, file_type=file_type, request_options=request_options
        )
        return _response.data

    async def fetch_testset_to_file(
        self,
        testset_id: str,
        *,
        file_type: typing.Optional[FetchTestsetToFileRequestFileType] = None,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> TestsetResponse:
        """
        Parameters
        ----------
        testset_id : str

        file_type : typing.Optional[FetchTestsetToFileRequestFileType]

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

        Returns
        -------
        TestsetResponse
            Successful Response

        Examples
        --------
        import asyncio

        from agenta import AsyncAgentaApi

        client = AsyncAgentaApi(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.testsets.fetch_testset_to_file(
                testset_id="testset_id",
            )


        asyncio.run(main())
        """
        _response = await self._raw_client.fetch_testset_to_file(
            testset_id, file_type=file_type, request_options=request_options
        )
        return _response.data

    async def fetch_testcase(
        self,
        testcase_id: str,
        *,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> TestcaseResponse:
        """
        Parameters
        ----------
        testcase_id : str

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

        Returns
        -------
        TestcaseResponse
            Successful Response

        Examples
        --------
        import asyncio

        from agenta import AsyncAgentaApi

        client = AsyncAgentaApi(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.testsets.fetch_testcase(
                testcase_id="testcase_id",
            )


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