Files
Dorod-Sky/skyvern/client/scripts/client.py

114 lines
2.9 KiB
Python
Raw Normal View History

2025-10-21 14:25:45 -07:00
# This file was auto-generated by Fern from our API Definition.
import typing
2025-10-27 16:26:37 -06:00
from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
2025-10-21 14:25:45 -07:00
from ..core.request_options import RequestOptions
2025-10-27 16:26:37 -06:00
from .raw_client import AsyncRawScriptsClient, RawScriptsClient
2025-10-21 14:25:45 -07:00
class ScriptsClient:
def __init__(self, *, client_wrapper: SyncClientWrapper):
2025-10-27 16:26:37 -06:00
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
2025-10-21 14:25:45 -07:00
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",
)
"""
2025-10-27 16:26:37 -06:00
_response = self._raw_client.run_script(script_id, request_options=request_options)
return _response.data
2025-10-21 14:25:45 -07:00
class AsyncScriptsClient:
def __init__(self, *, client_wrapper: AsyncClientWrapper):
2025-10-27 16:26:37 -06:00
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
2025-10-21 14:25:45 -07:00
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())
"""
2025-10-27 16:26:37 -06:00
_response = await self._raw_client.run_script(script_id, request_options=request_options)
return _response.data