Files
Dorod-Sky/skyvern/client/workflows/client.py
2025-12-17 21:11:39 +00:00

128 lines
3.7 KiB
Python

# 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 AsyncRawWorkflowsClient, RawWorkflowsClient
class WorkflowsClient:
def __init__(self, *, client_wrapper: SyncClientWrapper):
self._raw_client = RawWorkflowsClient(client_wrapper=client_wrapper)
@property
def with_raw_response(self) -> RawWorkflowsClient:
"""
Retrieves a raw implementation of this client that returns raw responses.
Returns
-------
RawWorkflowsClient
"""
return self._raw_client
def set_workflow_template_status(
self, workflow_permanent_id: str, *, is_template: bool, request_options: typing.Optional[RequestOptions] = None
) -> typing.Dict[str, typing.Optional[typing.Any]]:
"""
Set or unset a workflow as a template.
Template status is stored at the workflow_permanent_id level (not per-version),
meaning all versions of a workflow share the same template status.
Parameters
----------
workflow_permanent_id : str
is_template : bool
request_options : typing.Optional[RequestOptions]
Request-specific configuration.
Returns
-------
typing.Dict[str, typing.Optional[typing.Any]]
Successful Response
Examples
--------
from skyvern import Skyvern
client = Skyvern(
api_key="YOUR_API_KEY",
)
client.workflows.set_workflow_template_status(
workflow_permanent_id="workflow_permanent_id",
is_template=True,
)
"""
_response = self._raw_client.set_workflow_template_status(
workflow_permanent_id, is_template=is_template, request_options=request_options
)
return _response.data
class AsyncWorkflowsClient:
def __init__(self, *, client_wrapper: AsyncClientWrapper):
self._raw_client = AsyncRawWorkflowsClient(client_wrapper=client_wrapper)
@property
def with_raw_response(self) -> AsyncRawWorkflowsClient:
"""
Retrieves a raw implementation of this client that returns raw responses.
Returns
-------
AsyncRawWorkflowsClient
"""
return self._raw_client
async def set_workflow_template_status(
self, workflow_permanent_id: str, *, is_template: bool, request_options: typing.Optional[RequestOptions] = None
) -> typing.Dict[str, typing.Optional[typing.Any]]:
"""
Set or unset a workflow as a template.
Template status is stored at the workflow_permanent_id level (not per-version),
meaning all versions of a workflow share the same template status.
Parameters
----------
workflow_permanent_id : str
is_template : bool
request_options : typing.Optional[RequestOptions]
Request-specific configuration.
Returns
-------
typing.Dict[str, 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.workflows.set_workflow_template_status(
workflow_permanent_id="workflow_permanent_id",
is_template=True,
)
asyncio.run(main())
"""
_response = await self._raw_client.set_workflow_template_status(
workflow_permanent_id, is_template=is_template, request_options=request_options
)
return _response.data