# 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.pipeline_sync_response import PipelineSyncResponse
from .raw_client import AsyncRawAdminDataPipelinesClient, RawAdminDataPipelinesClient


class AdminDataPipelinesClient:
    def __init__(self, *, client_wrapper: SyncClientWrapper):
        self._raw_client = RawAdminDataPipelinesClient(client_wrapper=client_wrapper)

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

        Returns
        -------
        RawAdminDataPipelinesClient
        """
        return self._raw_client

    def trigger_airbyte_sync(
        self, *, api_key: typing.Optional[str] = None, request_options: typing.Optional[RequestOptions] = None
    ) -> PipelineSyncResponse:
        """
        Invalidates all pipeline platform caches and re-fetches source definitions for all active workspaces. This ensures the local cache reflects the latest available connectors from the pipeline platform.

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

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

        Returns
        -------
        PipelineSyncResponse
            Successful Response

        Examples
        --------
        from aitronos import Aitronos

        client = Aitronos(
            api_key="YOUR_API_KEY",
            token="YOUR_TOKEN",
        )
        client.admin_data_pipelines.trigger_airbyte_sync()
        """
        _response = self._raw_client.trigger_airbyte_sync(api_key=api_key, request_options=request_options)
        return _response.data


class AsyncAdminDataPipelinesClient:
    def __init__(self, *, client_wrapper: AsyncClientWrapper):
        self._raw_client = AsyncRawAdminDataPipelinesClient(client_wrapper=client_wrapper)

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

        Returns
        -------
        AsyncRawAdminDataPipelinesClient
        """
        return self._raw_client

    async def trigger_airbyte_sync(
        self, *, api_key: typing.Optional[str] = None, request_options: typing.Optional[RequestOptions] = None
    ) -> PipelineSyncResponse:
        """
        Invalidates all pipeline platform caches and re-fetches source definitions for all active workspaces. This ensures the local cache reflects the latest available connectors from the pipeline platform.

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

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

        Returns
        -------
        PipelineSyncResponse
            Successful Response

        Examples
        --------
        import asyncio

        from aitronos import AsyncAitronos

        client = AsyncAitronos(
            api_key="YOUR_API_KEY",
            token="YOUR_TOKEN",
        )


        async def main() -> None:
            await client.admin_data_pipelines.trigger_airbyte_sync()


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