# 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 .raw_client import AsyncRawScriptsClient, RawScriptsClient


class ScriptsClient:
    def __init__(self, *, client_wrapper: SyncClientWrapper):
        self._raw_client = RawScriptsClient(client_wrapper=client_wrapper)

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

        Returns
        -------
        RawScriptsClient
        """
        return self._raw_client

    def run_script(
        self, script_id: str, *, request_options: typing.Optional[RequestOptions] = None
    ) -> typing.Optional[typing.Any]:
        """
        Run a script

        Parameters
        ----------
        script_id : str
            The unique identifier of the script

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

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

        Examples
        --------
        from skyvern import Skyvern

        client = Skyvern(
            api_key="YOUR_API_KEY",
        )
        client.scripts.run_script(
            script_id="s_abc123",
        )
        """
        _response = self._raw_client.run_script(script_id, request_options=request_options)
        return _response.data


class AsyncScriptsClient:
    def __init__(self, *, client_wrapper: AsyncClientWrapper):
        self._raw_client = AsyncRawScriptsClient(client_wrapper=client_wrapper)

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

        Returns
        -------
        AsyncRawScriptsClient
        """
        return self._raw_client

    async def run_script(
        self, script_id: str, *, request_options: typing.Optional[RequestOptions] = None
    ) -> typing.Optional[typing.Any]:
        """
        Run a script

        Parameters
        ----------
        script_id : str
            The unique identifier of the script

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

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

        Examples
        --------
        import asyncio

        from skyvern import AsyncSkyvern

        client = AsyncSkyvern(
            api_key="YOUR_API_KEY",
        )


        async def main() -> None:
            await client.scripts.run_script(
                script_id="s_abc123",
            )


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