# 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_handlers_delete_workflow_revision_response import SrcHandlersDeleteWorkflowRevisionResponse
from ..types.src_handlers_list_workflow_revisions_response import SrcHandlersListWorkflowRevisionsResponse
from ..types.src_handlers_promote_workflow_revision_response import SrcHandlersPromoteWorkflowRevisionResponse
from .raw_client import AsyncRawRevisionsClient, RawRevisionsClient


class RevisionsClient:
    def __init__(self, *, client_wrapper: SyncClientWrapper):
        self._raw_client = RawRevisionsClient(client_wrapper=client_wrapper)

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

        Returns
        -------
        RawRevisionsClient
        """
        return self._raw_client

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

        revision_id : str

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

        Returns
        -------
        SrcHandlersDeleteWorkflowRevisionResponse
            Successful Response

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

        client = Scout(
            api_key="YOUR_API_KEY",
        )
        client.revisions.delete(
            workflow_id="workflow_id",
            revision_id="revision_id",
        )
        """
        _response = self._raw_client.delete(workflow_id, revision_id, request_options=request_options)
        return _response.data

    def list(
        self, workflow_id: str, *, request_options: typing.Optional[RequestOptions] = None
    ) -> SrcHandlersListWorkflowRevisionsResponse:
        """
        List all app revisions in the organization

        Parameters
        ----------
        workflow_id : str

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

        Returns
        -------
        SrcHandlersListWorkflowRevisionsResponse
            Successful Response

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

        client = Scout(
            api_key="YOUR_API_KEY",
        )
        client.revisions.list(
            workflow_id="workflow_id",
        )
        """
        _response = self._raw_client.list(workflow_id, request_options=request_options)
        return _response.data

    def update(
        self, workflow_id: str, revision_id: str, *, request_options: typing.Optional[RequestOptions] = None
    ) -> SrcHandlersPromoteWorkflowRevisionResponse:
        """
        Parameters
        ----------
        workflow_id : str

        revision_id : str

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

        Returns
        -------
        SrcHandlersPromoteWorkflowRevisionResponse
            Successful Response

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

        client = Scout(
            api_key="YOUR_API_KEY",
        )
        client.revisions.update(
            workflow_id="workflow_id",
            revision_id="revision_id",
        )
        """
        _response = self._raw_client.update(workflow_id, revision_id, request_options=request_options)
        return _response.data


class AsyncRevisionsClient:
    def __init__(self, *, client_wrapper: AsyncClientWrapper):
        self._raw_client = AsyncRawRevisionsClient(client_wrapper=client_wrapper)

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

        Returns
        -------
        AsyncRawRevisionsClient
        """
        return self._raw_client

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

        revision_id : str

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

        Returns
        -------
        SrcHandlersDeleteWorkflowRevisionResponse
            Successful Response

        Examples
        --------
        import asyncio

        from scoutos import AsyncScout

        client = AsyncScout(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.revisions.delete(
                workflow_id="workflow_id",
                revision_id="revision_id",
            )


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

    async def list(
        self, workflow_id: str, *, request_options: typing.Optional[RequestOptions] = None
    ) -> SrcHandlersListWorkflowRevisionsResponse:
        """
        List all app revisions in the organization

        Parameters
        ----------
        workflow_id : str

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

        Returns
        -------
        SrcHandlersListWorkflowRevisionsResponse
            Successful Response

        Examples
        --------
        import asyncio

        from scoutos import AsyncScout

        client = AsyncScout(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.revisions.list(
                workflow_id="workflow_id",
            )


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

    async def update(
        self, workflow_id: str, revision_id: str, *, request_options: typing.Optional[RequestOptions] = None
    ) -> SrcHandlersPromoteWorkflowRevisionResponse:
        """
        Parameters
        ----------
        workflow_id : str

        revision_id : str

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

        Returns
        -------
        SrcHandlersPromoteWorkflowRevisionResponse
            Successful Response

        Examples
        --------
        import asyncio

        from scoutos import AsyncScout

        client = AsyncScout(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.revisions.update(
                workflow_id="workflow_id",
                revision_id="revision_id",
            )


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