# 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.src_app_http_routes_collection_create_sync_response import SrcAppHttpRoutesCollectionCreateSyncResponse
from ..types.src_app_http_routes_collection_delete_sync_response import SrcAppHttpRoutesCollectionDeleteSyncResponse
from ..types.src_app_http_routes_collection_get_sync_response import SrcAppHttpRoutesCollectionGetSyncResponse
from ..types.src_app_http_routes_collection_list_collection_syncs_response_model import (
    SrcAppHttpRoutesCollectionListCollectionSyncsResponseModel,
)
from ..types.src_app_http_routes_collection_update_sync_response import SrcAppHttpRoutesCollectionUpdateSyncResponse
from ..types.sync_config_input import SyncConfigInput
from .raw_client import AsyncRawSyncsClient, RawSyncsClient

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


class SyncsClient:
    def __init__(self, *, client_wrapper: SyncClientWrapper):
        self._raw_client = RawSyncsClient(client_wrapper=client_wrapper)

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

        Returns
        -------
        RawSyncsClient
        """
        return self._raw_client

    def list(
        self, collection_id: str, table_id: str, *, request_options: typing.Optional[RequestOptions] = None
    ) -> SrcAppHttpRoutesCollectionListCollectionSyncsResponseModel:
        """
        List Sources by Destination, specifically given a collection and table

        Parameters
        ----------
        collection_id : str

        table_id : str

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

        Returns
        -------
        SrcAppHttpRoutesCollectionListCollectionSyncsResponseModel
            Successful Response

        Examples
        --------
        from scoutos import Scout

        client = Scout(
            api_key="YOUR_API_KEY",
        )
        client.syncs.list(
            collection_id="collection_id",
            table_id="table_id",
        )
        """
        _response = self._raw_client.list(collection_id, table_id, request_options=request_options)
        return _response.data

    def get(
        self, sync_id: str, *, request_options: typing.Optional[RequestOptions] = None
    ) -> SrcAppHttpRoutesCollectionGetSyncResponse:
        """
        Parameters
        ----------
        sync_id : str

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

        Returns
        -------
        SrcAppHttpRoutesCollectionGetSyncResponse
            Successful Response

        Examples
        --------
        from scoutos import Scout

        client = Scout(
            api_key="YOUR_API_KEY",
        )
        client.syncs.get(
            sync_id="sync_id",
        )
        """
        _response = self._raw_client.get(sync_id, request_options=request_options)
        return _response.data

    def update(
        self, sync_id: str, *, sync_config: SyncConfigInput, request_options: typing.Optional[RequestOptions] = None
    ) -> SrcAppHttpRoutesCollectionUpdateSyncResponse:
        """
        Parameters
        ----------
        sync_id : str

        sync_config : SyncConfigInput

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

        Returns
        -------
        SrcAppHttpRoutesCollectionUpdateSyncResponse
            Successful Response

        Examples
        --------
        from scoutos import (
            CollectionDestination,
            Mapping,
            Scout,
            SourceSyncGoogleDriveSettings,
            SyncConfigInput,
        )

        client = Scout(
            api_key="YOUR_API_KEY",
        )
        client.syncs.update(
            sync_id="sync_id",
            sync_config=SyncConfigInput(
                source_settings=SourceSyncGoogleDriveSettings(),
                destination=CollectionDestination(
                    collection_id="collection_id",
                    table_id="table_id",
                ),
                mapping=Mapping(),
            ),
        )
        """
        _response = self._raw_client.update(sync_id, sync_config=sync_config, request_options=request_options)
        return _response.data

    def delete(
        self, sync_id: str, *, request_options: typing.Optional[RequestOptions] = None
    ) -> SrcAppHttpRoutesCollectionDeleteSyncResponse:
        """
        Parameters
        ----------
        sync_id : str

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

        Returns
        -------
        SrcAppHttpRoutesCollectionDeleteSyncResponse
            Successful Response

        Examples
        --------
        from scoutos import Scout

        client = Scout(
            api_key="YOUR_API_KEY",
        )
        client.syncs.delete(
            sync_id="sync_id",
        )
        """
        _response = self._raw_client.delete(sync_id, request_options=request_options)
        return _response.data

    def create(
        self, *, sync_config: SyncConfigInput, request_options: typing.Optional[RequestOptions] = None
    ) -> SrcAppHttpRoutesCollectionCreateSyncResponse:
        """
        Parameters
        ----------
        sync_config : SyncConfigInput

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

        Returns
        -------
        SrcAppHttpRoutesCollectionCreateSyncResponse
            Successful Response

        Examples
        --------
        from scoutos import (
            CollectionDestination,
            Mapping,
            Scout,
            SourceSyncGoogleDriveSettings,
            SyncConfigInput,
        )

        client = Scout(
            api_key="YOUR_API_KEY",
        )
        client.syncs.create(
            sync_config=SyncConfigInput(
                source_settings=SourceSyncGoogleDriveSettings(),
                destination=CollectionDestination(
                    collection_id="collection_id",
                    table_id="table_id",
                ),
                mapping=Mapping(),
            ),
        )
        """
        _response = self._raw_client.create(sync_config=sync_config, request_options=request_options)
        return _response.data

    def execute(
        self, sync_id: str, *, request_options: typing.Optional[RequestOptions] = None
    ) -> typing.Optional[typing.Any]:
        """
        Parameters
        ----------
        sync_id : str

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

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

        Examples
        --------
        from scoutos import Scout

        client = Scout(
            api_key="YOUR_API_KEY",
        )
        client.syncs.execute(
            sync_id="sync_id",
        )
        """
        _response = self._raw_client.execute(sync_id, request_options=request_options)
        return _response.data


class AsyncSyncsClient:
    def __init__(self, *, client_wrapper: AsyncClientWrapper):
        self._raw_client = AsyncRawSyncsClient(client_wrapper=client_wrapper)

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

        Returns
        -------
        AsyncRawSyncsClient
        """
        return self._raw_client

    async def list(
        self, collection_id: str, table_id: str, *, request_options: typing.Optional[RequestOptions] = None
    ) -> SrcAppHttpRoutesCollectionListCollectionSyncsResponseModel:
        """
        List Sources by Destination, specifically given a collection and table

        Parameters
        ----------
        collection_id : str

        table_id : str

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

        Returns
        -------
        SrcAppHttpRoutesCollectionListCollectionSyncsResponseModel
            Successful Response

        Examples
        --------
        import asyncio

        from scoutos import AsyncScout

        client = AsyncScout(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.syncs.list(
                collection_id="collection_id",
                table_id="table_id",
            )


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

    async def get(
        self, sync_id: str, *, request_options: typing.Optional[RequestOptions] = None
    ) -> SrcAppHttpRoutesCollectionGetSyncResponse:
        """
        Parameters
        ----------
        sync_id : str

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

        Returns
        -------
        SrcAppHttpRoutesCollectionGetSyncResponse
            Successful Response

        Examples
        --------
        import asyncio

        from scoutos import AsyncScout

        client = AsyncScout(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.syncs.get(
                sync_id="sync_id",
            )


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

    async def update(
        self, sync_id: str, *, sync_config: SyncConfigInput, request_options: typing.Optional[RequestOptions] = None
    ) -> SrcAppHttpRoutesCollectionUpdateSyncResponse:
        """
        Parameters
        ----------
        sync_id : str

        sync_config : SyncConfigInput

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

        Returns
        -------
        SrcAppHttpRoutesCollectionUpdateSyncResponse
            Successful Response

        Examples
        --------
        import asyncio

        from scoutos import (
            AsyncScout,
            CollectionDestination,
            Mapping,
            SourceSyncGoogleDriveSettings,
            SyncConfigInput,
        )

        client = AsyncScout(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.syncs.update(
                sync_id="sync_id",
                sync_config=SyncConfigInput(
                    source_settings=SourceSyncGoogleDriveSettings(),
                    destination=CollectionDestination(
                        collection_id="collection_id",
                        table_id="table_id",
                    ),
                    mapping=Mapping(),
                ),
            )


        asyncio.run(main())
        """
        _response = await self._raw_client.update(sync_id, sync_config=sync_config, request_options=request_options)
        return _response.data

    async def delete(
        self, sync_id: str, *, request_options: typing.Optional[RequestOptions] = None
    ) -> SrcAppHttpRoutesCollectionDeleteSyncResponse:
        """
        Parameters
        ----------
        sync_id : str

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

        Returns
        -------
        SrcAppHttpRoutesCollectionDeleteSyncResponse
            Successful Response

        Examples
        --------
        import asyncio

        from scoutos import AsyncScout

        client = AsyncScout(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.syncs.delete(
                sync_id="sync_id",
            )


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

    async def create(
        self, *, sync_config: SyncConfigInput, request_options: typing.Optional[RequestOptions] = None
    ) -> SrcAppHttpRoutesCollectionCreateSyncResponse:
        """
        Parameters
        ----------
        sync_config : SyncConfigInput

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

        Returns
        -------
        SrcAppHttpRoutesCollectionCreateSyncResponse
            Successful Response

        Examples
        --------
        import asyncio

        from scoutos import (
            AsyncScout,
            CollectionDestination,
            Mapping,
            SourceSyncGoogleDriveSettings,
            SyncConfigInput,
        )

        client = AsyncScout(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.syncs.create(
                sync_config=SyncConfigInput(
                    source_settings=SourceSyncGoogleDriveSettings(),
                    destination=CollectionDestination(
                        collection_id="collection_id",
                        table_id="table_id",
                    ),
                    mapping=Mapping(),
                ),
            )


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

    async def execute(
        self, sync_id: str, *, request_options: typing.Optional[RequestOptions] = None
    ) -> typing.Optional[typing.Any]:
        """
        Parameters
        ----------
        sync_id : str

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

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

        Examples
        --------
        import asyncio

        from scoutos import AsyncScout

        client = AsyncScout(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.syncs.execute(
                sync_id="sync_id",
            )


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