# 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.s3export_storage import S3ExportStorage
from .raw_client import AsyncRawS3Client, RawS3Client

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


class S3Client:
    def __init__(self, *, client_wrapper: SyncClientWrapper):
        self._raw_client = RawS3Client(client_wrapper=client_wrapper)

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

        Returns
        -------
        RawS3Client
        """
        return self._raw_client

    def list(
        self,
        *,
        project: int,
        ordering: typing.Optional[str] = None,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> typing.List[S3ExportStorage]:
        """
        Get a list of all S3 export storage connections.

        Parameters
        ----------
        project : int
            Project ID

        ordering : typing.Optional[str]
            Which field to use when ordering the results.

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

        Returns
        -------
        typing.List[S3ExportStorage]


        Examples
        --------
        from label_studio_sdk import LabelStudio

        client = LabelStudio(
            api_key="YOUR_API_KEY",
        )
        client.export_storage.s3.list(
            project=1,
        )
        """
        _response = self._raw_client.list(project=project, ordering=ordering, request_options=request_options)
        return _response.data

    def create(
        self,
        *,
        aws_access_key_id: typing.Optional[str] = OMIT,
        aws_secret_access_key: typing.Optional[str] = OMIT,
        aws_session_token: typing.Optional[str] = OMIT,
        aws_sse_kms_key_id: typing.Optional[str] = OMIT,
        bucket: typing.Optional[str] = OMIT,
        can_delete_objects: typing.Optional[bool] = OMIT,
        description: typing.Optional[str] = OMIT,
        prefix: typing.Optional[str] = OMIT,
        project: typing.Optional[int] = OMIT,
        region_name: typing.Optional[str] = OMIT,
        s3endpoint: typing.Optional[str] = OMIT,
        title: typing.Optional[str] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> S3ExportStorage:
        """
        Create a new S3 export storage connection to store annotations.

        Parameters
        ----------
        aws_access_key_id : typing.Optional[str]
            AWS_ACCESS_KEY_ID

        aws_secret_access_key : typing.Optional[str]
            AWS_SECRET_ACCESS_KEY

        aws_session_token : typing.Optional[str]
            AWS_SESSION_TOKEN

        aws_sse_kms_key_id : typing.Optional[str]
            AWS SSE KMS Key ID

        bucket : typing.Optional[str]
            S3 bucket name

        can_delete_objects : typing.Optional[bool]
            Deletion from storage enabled.

        description : typing.Optional[str]
            Storage description

        prefix : typing.Optional[str]
            S3 bucket prefix

        project : typing.Optional[int]
            Project ID

        region_name : typing.Optional[str]
            AWS Region

        s3endpoint : typing.Optional[str]
            S3 Endpoint

        title : typing.Optional[str]
            Storage title

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

        Returns
        -------
        S3ExportStorage


        Examples
        --------
        from label_studio_sdk import LabelStudio

        client = LabelStudio(
            api_key="YOUR_API_KEY",
        )
        client.export_storage.s3.create()
        """
        _response = self._raw_client.create(
            aws_access_key_id=aws_access_key_id,
            aws_secret_access_key=aws_secret_access_key,
            aws_session_token=aws_session_token,
            aws_sse_kms_key_id=aws_sse_kms_key_id,
            bucket=bucket,
            can_delete_objects=can_delete_objects,
            description=description,
            prefix=prefix,
            project=project,
            region_name=region_name,
            s3endpoint=s3endpoint,
            title=title,
            request_options=request_options,
        )
        return _response.data

    def validate(
        self,
        *,
        aws_access_key_id: typing.Optional[str] = OMIT,
        aws_secret_access_key: typing.Optional[str] = OMIT,
        aws_session_token: typing.Optional[str] = OMIT,
        aws_sse_kms_key_id: typing.Optional[str] = OMIT,
        bucket: typing.Optional[str] = OMIT,
        can_delete_objects: typing.Optional[bool] = OMIT,
        description: typing.Optional[str] = OMIT,
        id: typing.Optional[int] = OMIT,
        prefix: typing.Optional[str] = OMIT,
        project: typing.Optional[int] = OMIT,
        region_name: typing.Optional[str] = OMIT,
        s3endpoint: typing.Optional[str] = OMIT,
        title: typing.Optional[str] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> None:
        """
        Validate a specific S3 export storage connection.

        Parameters
        ----------
        aws_access_key_id : typing.Optional[str]
            AWS_ACCESS_KEY_ID

        aws_secret_access_key : typing.Optional[str]
            AWS_SECRET_ACCESS_KEY

        aws_session_token : typing.Optional[str]
            AWS_SESSION_TOKEN

        aws_sse_kms_key_id : typing.Optional[str]
            AWS SSE KMS Key ID

        bucket : typing.Optional[str]
            S3 bucket name

        can_delete_objects : typing.Optional[bool]
            Deletion from storage enabled.

        description : typing.Optional[str]
            Storage description

        id : typing.Optional[int]
            Storage ID. If set, storage with specified ID will be updated

        prefix : typing.Optional[str]
            S3 bucket prefix

        project : typing.Optional[int]
            Project ID

        region_name : typing.Optional[str]
            AWS Region

        s3endpoint : typing.Optional[str]
            S3 Endpoint

        title : typing.Optional[str]
            Storage title

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

        Returns
        -------
        None

        Examples
        --------
        from label_studio_sdk import LabelStudio

        client = LabelStudio(
            api_key="YOUR_API_KEY",
        )
        client.export_storage.s3.validate()
        """
        _response = self._raw_client.validate(
            aws_access_key_id=aws_access_key_id,
            aws_secret_access_key=aws_secret_access_key,
            aws_session_token=aws_session_token,
            aws_sse_kms_key_id=aws_sse_kms_key_id,
            bucket=bucket,
            can_delete_objects=can_delete_objects,
            description=description,
            id=id,
            prefix=prefix,
            project=project,
            region_name=region_name,
            s3endpoint=s3endpoint,
            title=title,
            request_options=request_options,
        )
        return _response.data

    def get(self, id: int, *, request_options: typing.Optional[RequestOptions] = None) -> S3ExportStorage:
        """
        Get a specific S3 export storage connection.

        Parameters
        ----------
        id : int

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

        Returns
        -------
        S3ExportStorage


        Examples
        --------
        from label_studio_sdk import LabelStudio

        client = LabelStudio(
            api_key="YOUR_API_KEY",
        )
        client.export_storage.s3.get(
            id=1,
        )
        """
        _response = self._raw_client.get(id, request_options=request_options)
        return _response.data

    def delete(self, id: int, *, request_options: typing.Optional[RequestOptions] = None) -> None:
        """
        Delete a specific S3 export storage connection.

        Parameters
        ----------
        id : int

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

        Returns
        -------
        None

        Examples
        --------
        from label_studio_sdk import LabelStudio

        client = LabelStudio(
            api_key="YOUR_API_KEY",
        )
        client.export_storage.s3.delete(
            id=1,
        )
        """
        _response = self._raw_client.delete(id, request_options=request_options)
        return _response.data

    def update(
        self,
        id: int,
        *,
        aws_access_key_id: typing.Optional[str] = OMIT,
        aws_secret_access_key: typing.Optional[str] = OMIT,
        aws_session_token: typing.Optional[str] = OMIT,
        aws_sse_kms_key_id: typing.Optional[str] = OMIT,
        bucket: typing.Optional[str] = OMIT,
        can_delete_objects: typing.Optional[bool] = OMIT,
        description: typing.Optional[str] = OMIT,
        prefix: typing.Optional[str] = OMIT,
        project: typing.Optional[int] = OMIT,
        region_name: typing.Optional[str] = OMIT,
        s3endpoint: typing.Optional[str] = OMIT,
        title: typing.Optional[str] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> S3ExportStorage:
        """
        Update a specific S3 export storage connection.

        Parameters
        ----------
        id : int

        aws_access_key_id : typing.Optional[str]
            AWS_ACCESS_KEY_ID

        aws_secret_access_key : typing.Optional[str]
            AWS_SECRET_ACCESS_KEY

        aws_session_token : typing.Optional[str]
            AWS_SESSION_TOKEN

        aws_sse_kms_key_id : typing.Optional[str]
            AWS SSE KMS Key ID

        bucket : typing.Optional[str]
            S3 bucket name

        can_delete_objects : typing.Optional[bool]
            Deletion from storage enabled.

        description : typing.Optional[str]
            Storage description

        prefix : typing.Optional[str]
            S3 bucket prefix

        project : typing.Optional[int]
            Project ID

        region_name : typing.Optional[str]
            AWS Region

        s3endpoint : typing.Optional[str]
            S3 Endpoint

        title : typing.Optional[str]
            Storage title

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

        Returns
        -------
        S3ExportStorage


        Examples
        --------
        from label_studio_sdk import LabelStudio

        client = LabelStudio(
            api_key="YOUR_API_KEY",
        )
        client.export_storage.s3.update(
            id=1,
        )
        """
        _response = self._raw_client.update(
            id,
            aws_access_key_id=aws_access_key_id,
            aws_secret_access_key=aws_secret_access_key,
            aws_session_token=aws_session_token,
            aws_sse_kms_key_id=aws_sse_kms_key_id,
            bucket=bucket,
            can_delete_objects=can_delete_objects,
            description=description,
            prefix=prefix,
            project=project,
            region_name=region_name,
            s3endpoint=s3endpoint,
            title=title,
            request_options=request_options,
        )
        return _response.data

    def sync(self, id: int, *, request_options: typing.Optional[RequestOptions] = None) -> S3ExportStorage:
        """
        Sync tasks from an S3 export storage connection.

        Parameters
        ----------
        id : int

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

        Returns
        -------
        S3ExportStorage


        Examples
        --------
        from label_studio_sdk import LabelStudio

        client = LabelStudio(
            api_key="YOUR_API_KEY",
        )
        client.export_storage.s3.sync(
            id=1,
        )
        """
        _response = self._raw_client.sync(id, request_options=request_options)
        return _response.data


class AsyncS3Client:
    def __init__(self, *, client_wrapper: AsyncClientWrapper):
        self._raw_client = AsyncRawS3Client(client_wrapper=client_wrapper)

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

        Returns
        -------
        AsyncRawS3Client
        """
        return self._raw_client

    async def list(
        self,
        *,
        project: int,
        ordering: typing.Optional[str] = None,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> typing.List[S3ExportStorage]:
        """
        Get a list of all S3 export storage connections.

        Parameters
        ----------
        project : int
            Project ID

        ordering : typing.Optional[str]
            Which field to use when ordering the results.

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

        Returns
        -------
        typing.List[S3ExportStorage]


        Examples
        --------
        import asyncio

        from label_studio_sdk import AsyncLabelStudio

        client = AsyncLabelStudio(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.export_storage.s3.list(
                project=1,
            )


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

    async def create(
        self,
        *,
        aws_access_key_id: typing.Optional[str] = OMIT,
        aws_secret_access_key: typing.Optional[str] = OMIT,
        aws_session_token: typing.Optional[str] = OMIT,
        aws_sse_kms_key_id: typing.Optional[str] = OMIT,
        bucket: typing.Optional[str] = OMIT,
        can_delete_objects: typing.Optional[bool] = OMIT,
        description: typing.Optional[str] = OMIT,
        prefix: typing.Optional[str] = OMIT,
        project: typing.Optional[int] = OMIT,
        region_name: typing.Optional[str] = OMIT,
        s3endpoint: typing.Optional[str] = OMIT,
        title: typing.Optional[str] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> S3ExportStorage:
        """
        Create a new S3 export storage connection to store annotations.

        Parameters
        ----------
        aws_access_key_id : typing.Optional[str]
            AWS_ACCESS_KEY_ID

        aws_secret_access_key : typing.Optional[str]
            AWS_SECRET_ACCESS_KEY

        aws_session_token : typing.Optional[str]
            AWS_SESSION_TOKEN

        aws_sse_kms_key_id : typing.Optional[str]
            AWS SSE KMS Key ID

        bucket : typing.Optional[str]
            S3 bucket name

        can_delete_objects : typing.Optional[bool]
            Deletion from storage enabled.

        description : typing.Optional[str]
            Storage description

        prefix : typing.Optional[str]
            S3 bucket prefix

        project : typing.Optional[int]
            Project ID

        region_name : typing.Optional[str]
            AWS Region

        s3endpoint : typing.Optional[str]
            S3 Endpoint

        title : typing.Optional[str]
            Storage title

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

        Returns
        -------
        S3ExportStorage


        Examples
        --------
        import asyncio

        from label_studio_sdk import AsyncLabelStudio

        client = AsyncLabelStudio(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.export_storage.s3.create()


        asyncio.run(main())
        """
        _response = await self._raw_client.create(
            aws_access_key_id=aws_access_key_id,
            aws_secret_access_key=aws_secret_access_key,
            aws_session_token=aws_session_token,
            aws_sse_kms_key_id=aws_sse_kms_key_id,
            bucket=bucket,
            can_delete_objects=can_delete_objects,
            description=description,
            prefix=prefix,
            project=project,
            region_name=region_name,
            s3endpoint=s3endpoint,
            title=title,
            request_options=request_options,
        )
        return _response.data

    async def validate(
        self,
        *,
        aws_access_key_id: typing.Optional[str] = OMIT,
        aws_secret_access_key: typing.Optional[str] = OMIT,
        aws_session_token: typing.Optional[str] = OMIT,
        aws_sse_kms_key_id: typing.Optional[str] = OMIT,
        bucket: typing.Optional[str] = OMIT,
        can_delete_objects: typing.Optional[bool] = OMIT,
        description: typing.Optional[str] = OMIT,
        id: typing.Optional[int] = OMIT,
        prefix: typing.Optional[str] = OMIT,
        project: typing.Optional[int] = OMIT,
        region_name: typing.Optional[str] = OMIT,
        s3endpoint: typing.Optional[str] = OMIT,
        title: typing.Optional[str] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> None:
        """
        Validate a specific S3 export storage connection.

        Parameters
        ----------
        aws_access_key_id : typing.Optional[str]
            AWS_ACCESS_KEY_ID

        aws_secret_access_key : typing.Optional[str]
            AWS_SECRET_ACCESS_KEY

        aws_session_token : typing.Optional[str]
            AWS_SESSION_TOKEN

        aws_sse_kms_key_id : typing.Optional[str]
            AWS SSE KMS Key ID

        bucket : typing.Optional[str]
            S3 bucket name

        can_delete_objects : typing.Optional[bool]
            Deletion from storage enabled.

        description : typing.Optional[str]
            Storage description

        id : typing.Optional[int]
            Storage ID. If set, storage with specified ID will be updated

        prefix : typing.Optional[str]
            S3 bucket prefix

        project : typing.Optional[int]
            Project ID

        region_name : typing.Optional[str]
            AWS Region

        s3endpoint : typing.Optional[str]
            S3 Endpoint

        title : typing.Optional[str]
            Storage title

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

        Returns
        -------
        None

        Examples
        --------
        import asyncio

        from label_studio_sdk import AsyncLabelStudio

        client = AsyncLabelStudio(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.export_storage.s3.validate()


        asyncio.run(main())
        """
        _response = await self._raw_client.validate(
            aws_access_key_id=aws_access_key_id,
            aws_secret_access_key=aws_secret_access_key,
            aws_session_token=aws_session_token,
            aws_sse_kms_key_id=aws_sse_kms_key_id,
            bucket=bucket,
            can_delete_objects=can_delete_objects,
            description=description,
            id=id,
            prefix=prefix,
            project=project,
            region_name=region_name,
            s3endpoint=s3endpoint,
            title=title,
            request_options=request_options,
        )
        return _response.data

    async def get(self, id: int, *, request_options: typing.Optional[RequestOptions] = None) -> S3ExportStorage:
        """
        Get a specific S3 export storage connection.

        Parameters
        ----------
        id : int

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

        Returns
        -------
        S3ExportStorage


        Examples
        --------
        import asyncio

        from label_studio_sdk import AsyncLabelStudio

        client = AsyncLabelStudio(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.export_storage.s3.get(
                id=1,
            )


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

    async def delete(self, id: int, *, request_options: typing.Optional[RequestOptions] = None) -> None:
        """
        Delete a specific S3 export storage connection.

        Parameters
        ----------
        id : int

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

        Returns
        -------
        None

        Examples
        --------
        import asyncio

        from label_studio_sdk import AsyncLabelStudio

        client = AsyncLabelStudio(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.export_storage.s3.delete(
                id=1,
            )


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

    async def update(
        self,
        id: int,
        *,
        aws_access_key_id: typing.Optional[str] = OMIT,
        aws_secret_access_key: typing.Optional[str] = OMIT,
        aws_session_token: typing.Optional[str] = OMIT,
        aws_sse_kms_key_id: typing.Optional[str] = OMIT,
        bucket: typing.Optional[str] = OMIT,
        can_delete_objects: typing.Optional[bool] = OMIT,
        description: typing.Optional[str] = OMIT,
        prefix: typing.Optional[str] = OMIT,
        project: typing.Optional[int] = OMIT,
        region_name: typing.Optional[str] = OMIT,
        s3endpoint: typing.Optional[str] = OMIT,
        title: typing.Optional[str] = OMIT,
        request_options: typing.Optional[RequestOptions] = None,
    ) -> S3ExportStorage:
        """
        Update a specific S3 export storage connection.

        Parameters
        ----------
        id : int

        aws_access_key_id : typing.Optional[str]
            AWS_ACCESS_KEY_ID

        aws_secret_access_key : typing.Optional[str]
            AWS_SECRET_ACCESS_KEY

        aws_session_token : typing.Optional[str]
            AWS_SESSION_TOKEN

        aws_sse_kms_key_id : typing.Optional[str]
            AWS SSE KMS Key ID

        bucket : typing.Optional[str]
            S3 bucket name

        can_delete_objects : typing.Optional[bool]
            Deletion from storage enabled.

        description : typing.Optional[str]
            Storage description

        prefix : typing.Optional[str]
            S3 bucket prefix

        project : typing.Optional[int]
            Project ID

        region_name : typing.Optional[str]
            AWS Region

        s3endpoint : typing.Optional[str]
            S3 Endpoint

        title : typing.Optional[str]
            Storage title

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

        Returns
        -------
        S3ExportStorage


        Examples
        --------
        import asyncio

        from label_studio_sdk import AsyncLabelStudio

        client = AsyncLabelStudio(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.export_storage.s3.update(
                id=1,
            )


        asyncio.run(main())
        """
        _response = await self._raw_client.update(
            id,
            aws_access_key_id=aws_access_key_id,
            aws_secret_access_key=aws_secret_access_key,
            aws_session_token=aws_session_token,
            aws_sse_kms_key_id=aws_sse_kms_key_id,
            bucket=bucket,
            can_delete_objects=can_delete_objects,
            description=description,
            prefix=prefix,
            project=project,
            region_name=region_name,
            s3endpoint=s3endpoint,
            title=title,
            request_options=request_options,
        )
        return _response.data

    async def sync(self, id: int, *, request_options: typing.Optional[RequestOptions] = None) -> S3ExportStorage:
        """
        Sync tasks from an S3 export storage connection.

        Parameters
        ----------
        id : int

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

        Returns
        -------
        S3ExportStorage


        Examples
        --------
        import asyncio

        from label_studio_sdk import AsyncLabelStudio

        client = AsyncLabelStudio(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.export_storage.s3.sync(
                id=1,
            )


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