Rebuild fern client sdk to 1.06 (#4331)

This commit is contained in:
Marc Kelechava
2025-12-19 12:16:02 -08:00
committed by GitHub
parent 08ca5a0b45
commit 9788138861
50 changed files with 2169 additions and 909 deletions

View File

@@ -283,6 +283,7 @@ if typing.TYPE_CHECKING:
PromptAction,
PromptBranchCriteria,
ProxyLocation,
RetryRunWebhookRequest,
RunEngine,
RunSdkActionRequestAction,
RunSdkActionRequestAction_AiAct,
@@ -352,6 +353,7 @@ if typing.TYPE_CHECKING:
TotpType,
UploadFileAction,
UploadFileActionData,
UploadFileResponse,
UploadToS3Block,
UploadToS3BlockYaml,
UrlBlock,
@@ -496,7 +498,7 @@ if typing.TYPE_CHECKING:
WorkflowStatus,
)
from .errors import BadRequestError, ConflictError, ForbiddenError, NotFoundError, UnprocessableEntityError
from . import scripts, workflows
from . import scripts
from .client import AsyncSkyvern, Skyvern
from .environment import SkyvernEnvironment
from .version import __version__
@@ -782,6 +784,7 @@ _dynamic_imports: typing.Dict[str, str] = {
"PromptAction": ".types",
"PromptBranchCriteria": ".types",
"ProxyLocation": ".types",
"RetryRunWebhookRequest": ".types",
"RunEngine": ".types",
"RunSdkActionRequestAction": ".types",
"RunSdkActionRequestAction_AiAct": ".types",
@@ -854,6 +857,7 @@ _dynamic_imports: typing.Dict[str, str] = {
"UnprocessableEntityError": ".errors",
"UploadFileAction": ".types",
"UploadFileActionData": ".types",
"UploadFileResponse": ".types",
"UploadToS3Block": ".types",
"UploadToS3BlockYaml": ".types",
"UrlBlock": ".types",
@@ -998,7 +1002,6 @@ _dynamic_imports: typing.Dict[str, str] = {
"WorkflowStatus": ".types",
"__version__": ".version",
"scripts": ".scripts",
"workflows": ".workflows",
}
@@ -1305,6 +1308,7 @@ __all__ = [
"PromptAction",
"PromptBranchCriteria",
"ProxyLocation",
"RetryRunWebhookRequest",
"RunEngine",
"RunSdkActionRequestAction",
"RunSdkActionRequestAction_AiAct",
@@ -1377,6 +1381,7 @@ __all__ = [
"UnprocessableEntityError",
"UploadFileAction",
"UploadFileActionData",
"UploadFileResponse",
"UploadToS3Block",
"UploadToS3BlockYaml",
"UrlBlock",
@@ -1521,5 +1526,4 @@ __all__ = [
"WorkflowStatus",
"__version__",
"scripts",
"workflows",
]

View File

@@ -6,6 +6,7 @@ import datetime as dt
import typing
import httpx
from . import core
from .core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
from .core.request_options import RequestOptions
from .environment import SkyvernEnvironment
@@ -19,6 +20,7 @@ from .types.create_script_response import CreateScriptResponse
from .types.credential_response import CredentialResponse
from .types.get_run_response import GetRunResponse
from .types.proxy_location import ProxyLocation
from .types.retry_run_webhook_request import RetryRunWebhookRequest
from .types.run_engine import RunEngine
from .types.run_sdk_action_request_action import RunSdkActionRequestAction
from .types.run_sdk_action_response import RunSdkActionResponse
@@ -30,6 +32,7 @@ from .types.task_run_request_data_extraction_schema import TaskRunRequestDataExt
from .types.task_run_request_proxy_location import TaskRunRequestProxyLocation
from .types.task_run_response import TaskRunResponse
from .types.totp_code import TotpCode
from .types.upload_file_response import UploadFileResponse
from .types.workflow import Workflow
from .types.workflow_create_yaml_request import WorkflowCreateYamlRequest
from .types.workflow_run_request_proxy_location import WorkflowRunRequestProxyLocation
@@ -39,7 +42,6 @@ from .types.workflow_status import WorkflowStatus
if typing.TYPE_CHECKING:
from .scripts.client import AsyncScriptsClient, ScriptsClient
from .workflows.client import AsyncWorkflowsClient, WorkflowsClient
# this is used as the default value for optional parameters
OMIT = typing.cast(typing.Any, ...)
@@ -110,7 +112,6 @@ class Skyvern:
timeout=_defaulted_timeout,
)
self._raw_client = RawSkyvern(client_wrapper=self._client_wrapper)
self._workflows: typing.Optional[WorkflowsClient] = None
self._scripts: typing.Optional[ScriptsClient] = None
@property
@@ -793,7 +794,7 @@ class Skyvern:
self,
run_id: str,
*,
webhook_url: typing.Optional[str] = None,
request: typing.Optional[RetryRunWebhookRequest] = None,
request_options: typing.Optional[RequestOptions] = None,
) -> typing.Optional[typing.Any]:
"""
@@ -804,6 +805,8 @@ class Skyvern:
run_id : str
The id of the task run or the workflow run.
request : typing.Optional[RetryRunWebhookRequest]
request_options : typing.Optional[RequestOptions]
Request-specific configuration.
@@ -814,16 +817,17 @@ class Skyvern:
Examples
--------
from skyvern import Skyvern
from skyvern import RetryRunWebhookRequest, Skyvern
client = Skyvern(
api_key="YOUR_API_KEY",
)
client.retry_run_webhook(
run_id="tsk_123",
request=RetryRunWebhookRequest(),
)
"""
_response = self._raw_client.retry_run_webhook(run_id, webhook_url=webhook_url, request_options=request_options)
_response = self._raw_client.retry_run_webhook(run_id, request=request, request_options=request_options)
return _response.data
def get_run_timeline(
@@ -859,6 +863,35 @@ class Skyvern:
_response = self._raw_client.get_run_timeline(run_id, request_options=request_options)
return _response.data
def upload_file(
self, *, file: core.File, request_options: typing.Optional[RequestOptions] = None
) -> UploadFileResponse:
"""
Parameters
----------
file : core.File
See core.File for more documentation
request_options : typing.Optional[RequestOptions]
Request-specific configuration.
Returns
-------
UploadFileResponse
Successful Response
Examples
--------
from skyvern import Skyvern
client = Skyvern(
api_key="YOUR_API_KEY",
)
client.upload_file()
"""
_response = self._raw_client.upload_file(file=file, request_options=request_options)
return _response.data
def list_browser_profiles(
self, *, include_deleted: typing.Optional[bool] = None, request_options: typing.Optional[RequestOptions] = None
) -> typing.List[BrowserProfile]:
@@ -1860,14 +1893,6 @@ class Skyvern:
)
return _response.data
@property
def workflows(self):
if self._workflows is None:
from .workflows.client import WorkflowsClient # noqa: E402
self._workflows = WorkflowsClient(client_wrapper=self._client_wrapper)
return self._workflows
@property
def scripts(self):
if self._scripts is None:
@@ -1943,7 +1968,6 @@ class AsyncSkyvern:
timeout=_defaulted_timeout,
)
self._raw_client = AsyncRawSkyvern(client_wrapper=self._client_wrapper)
self._workflows: typing.Optional[AsyncWorkflowsClient] = None
self._scripts: typing.Optional[AsyncScriptsClient] = None
@property
@@ -2708,7 +2732,7 @@ class AsyncSkyvern:
self,
run_id: str,
*,
webhook_url: typing.Optional[str] = None,
request: typing.Optional[RetryRunWebhookRequest] = None,
request_options: typing.Optional[RequestOptions] = None,
) -> typing.Optional[typing.Any]:
"""
@@ -2719,6 +2743,8 @@ class AsyncSkyvern:
run_id : str
The id of the task run or the workflow run.
request : typing.Optional[RetryRunWebhookRequest]
request_options : typing.Optional[RequestOptions]
Request-specific configuration.
@@ -2731,7 +2757,7 @@ class AsyncSkyvern:
--------
import asyncio
from skyvern import AsyncSkyvern
from skyvern import AsyncSkyvern, RetryRunWebhookRequest
client = AsyncSkyvern(
api_key="YOUR_API_KEY",
@@ -2741,14 +2767,13 @@ class AsyncSkyvern:
async def main() -> None:
await client.retry_run_webhook(
run_id="tsk_123",
request=RetryRunWebhookRequest(),
)
asyncio.run(main())
"""
_response = await self._raw_client.retry_run_webhook(
run_id, webhook_url=webhook_url, request_options=request_options
)
_response = await self._raw_client.retry_run_webhook(run_id, request=request, request_options=request_options)
return _response.data
async def get_run_timeline(
@@ -2792,6 +2817,43 @@ class AsyncSkyvern:
_response = await self._raw_client.get_run_timeline(run_id, request_options=request_options)
return _response.data
async def upload_file(
self, *, file: core.File, request_options: typing.Optional[RequestOptions] = None
) -> UploadFileResponse:
"""
Parameters
----------
file : core.File
See core.File for more documentation
request_options : typing.Optional[RequestOptions]
Request-specific configuration.
Returns
-------
UploadFileResponse
Successful Response
Examples
--------
import asyncio
from skyvern import AsyncSkyvern
client = AsyncSkyvern(
api_key="YOUR_API_KEY",
)
async def main() -> None:
await client.upload_file()
asyncio.run(main())
"""
_response = await self._raw_client.upload_file(file=file, request_options=request_options)
return _response.data
async def list_browser_profiles(
self, *, include_deleted: typing.Optional[bool] = None, request_options: typing.Optional[RequestOptions] = None
) -> typing.List[BrowserProfile]:
@@ -3957,14 +4019,6 @@ class AsyncSkyvern:
)
return _response.data
@property
def workflows(self):
if self._workflows is None:
from .workflows.client import AsyncWorkflowsClient # noqa: E402
self._workflows = AsyncWorkflowsClient(client_wrapper=self._client_wrapper)
return self._workflows
@property
def scripts(self):
if self._scripts is None:

View File

@@ -22,10 +22,10 @@ class BaseClientWrapper:
def get_headers(self) -> typing.Dict[str, str]:
headers: typing.Dict[str, str] = {
"User-Agent": "skyvern/1.0.3",
"User-Agent": "skyvern/1.0.6",
"X-Fern-Language": "Python",
"X-Fern-SDK-Name": "skyvern",
"X-Fern-SDK-Version": "1.0.3",
"X-Fern-SDK-Version": "1.0.6",
**(self.get_custom_headers() or {}),
}
if self._api_key is not None:

View File

@@ -4,6 +4,7 @@ import datetime as dt
import typing
from json.decoder import JSONDecodeError
from . import core
from .core.api_error import ApiError
from .core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
from .core.http_response import AsyncHttpResponse, HttpResponse
@@ -25,6 +26,7 @@ from .types.create_script_response import CreateScriptResponse
from .types.credential_response import CredentialResponse
from .types.get_run_response import GetRunResponse
from .types.proxy_location import ProxyLocation
from .types.retry_run_webhook_request import RetryRunWebhookRequest
from .types.run_engine import RunEngine
from .types.run_sdk_action_request_action import RunSdkActionRequestAction
from .types.run_sdk_action_response import RunSdkActionResponse
@@ -36,6 +38,7 @@ from .types.task_run_request_data_extraction_schema import TaskRunRequestDataExt
from .types.task_run_request_proxy_location import TaskRunRequestProxyLocation
from .types.task_run_response import TaskRunResponse
from .types.totp_code import TotpCode
from .types.upload_file_response import UploadFileResponse
from .types.workflow import Workflow
from .types.workflow_create_yaml_request import WorkflowCreateYamlRequest
from .types.workflow_run_request_proxy_location import WorkflowRunRequestProxyLocation
@@ -960,7 +963,7 @@ class RawSkyvern:
self,
run_id: str,
*,
webhook_url: typing.Optional[str] = None,
request: typing.Optional[RetryRunWebhookRequest] = None,
request_options: typing.Optional[RequestOptions] = None,
) -> HttpResponse[typing.Optional[typing.Any]]:
"""
@@ -971,6 +974,8 @@ class RawSkyvern:
run_id : str
The id of the task run or the workflow run.
request : typing.Optional[RetryRunWebhookRequest]
request_options : typing.Optional[RequestOptions]
Request-specific configuration.
@@ -979,18 +984,17 @@ class RawSkyvern:
HttpResponse[typing.Optional[typing.Any]]
Successful Response
"""
request_kwargs: dict[str, typing.Any] = {}
if webhook_url is not None:
request_kwargs = {
"json": {"webhook_url": webhook_url},
"headers": {"content-type": "application/json"},
"omit": OMIT,
}
_response = self._client_wrapper.httpx_client.request(
f"v1/runs/{jsonable_encoder(run_id)}/retry_webhook",
method="POST",
json=convert_and_respect_annotation_metadata(
object_=request, annotation=RetryRunWebhookRequest, direction="write"
),
headers={
"content-type": "application/json",
},
request_options=request_options,
**request_kwargs,
omit=OMIT,
)
try:
if _response is None or not _response.text.strip():
@@ -1092,6 +1096,60 @@ class RawSkyvern:
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
def upload_file(
self, *, file: core.File, request_options: typing.Optional[RequestOptions] = None
) -> HttpResponse[UploadFileResponse]:
"""
Parameters
----------
file : core.File
See core.File for more documentation
request_options : typing.Optional[RequestOptions]
Request-specific configuration.
Returns
-------
HttpResponse[UploadFileResponse]
Successful Response
"""
_response = self._client_wrapper.httpx_client.request(
"v1/upload_file",
method="POST",
data={},
files={
"file": file,
},
request_options=request_options,
omit=OMIT,
force_multipart=True,
)
try:
if 200 <= _response.status_code < 300:
_data = typing.cast(
UploadFileResponse,
parse_obj_as(
type_=UploadFileResponse, # type: ignore
object_=_response.json(),
),
)
return HttpResponse(response=_response, data=_data)
if _response.status_code == 422:
raise UnprocessableEntityError(
headers=dict(_response.headers),
body=typing.cast(
typing.Optional[typing.Any],
parse_obj_as(
type_=typing.Optional[typing.Any], # type: ignore
object_=_response.json(),
),
),
)
_response_json = _response.json()
except JSONDecodeError:
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
def list_browser_profiles(
self, *, include_deleted: typing.Optional[bool] = None, request_options: typing.Optional[RequestOptions] = None
) -> HttpResponse[typing.List[BrowserProfile]]:
@@ -3492,7 +3550,7 @@ class AsyncRawSkyvern:
self,
run_id: str,
*,
webhook_url: typing.Optional[str] = None,
request: typing.Optional[RetryRunWebhookRequest] = None,
request_options: typing.Optional[RequestOptions] = None,
) -> AsyncHttpResponse[typing.Optional[typing.Any]]:
"""
@@ -3503,6 +3561,8 @@ class AsyncRawSkyvern:
run_id : str
The id of the task run or the workflow run.
request : typing.Optional[RetryRunWebhookRequest]
request_options : typing.Optional[RequestOptions]
Request-specific configuration.
@@ -3511,18 +3571,17 @@ class AsyncRawSkyvern:
AsyncHttpResponse[typing.Optional[typing.Any]]
Successful Response
"""
request_kwargs: dict[str, typing.Any] = {}
if webhook_url is not None:
request_kwargs = {
"json": {"webhook_url": webhook_url},
"headers": {"content-type": "application/json"},
"omit": OMIT,
}
_response = await self._client_wrapper.httpx_client.request(
f"v1/runs/{jsonable_encoder(run_id)}/retry_webhook",
method="POST",
json=convert_and_respect_annotation_metadata(
object_=request, annotation=RetryRunWebhookRequest, direction="write"
),
headers={
"content-type": "application/json",
},
request_options=request_options,
**request_kwargs,
omit=OMIT,
)
try:
if _response is None or not _response.text.strip():
@@ -3624,6 +3683,60 @@ class AsyncRawSkyvern:
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
async def upload_file(
self, *, file: core.File, request_options: typing.Optional[RequestOptions] = None
) -> AsyncHttpResponse[UploadFileResponse]:
"""
Parameters
----------
file : core.File
See core.File for more documentation
request_options : typing.Optional[RequestOptions]
Request-specific configuration.
Returns
-------
AsyncHttpResponse[UploadFileResponse]
Successful Response
"""
_response = await self._client_wrapper.httpx_client.request(
"v1/upload_file",
method="POST",
data={},
files={
"file": file,
},
request_options=request_options,
omit=OMIT,
force_multipart=True,
)
try:
if 200 <= _response.status_code < 300:
_data = typing.cast(
UploadFileResponse,
parse_obj_as(
type_=UploadFileResponse, # type: ignore
object_=_response.json(),
),
)
return AsyncHttpResponse(response=_response, data=_data)
if _response.status_code == 422:
raise UnprocessableEntityError(
headers=dict(_response.headers),
body=typing.cast(
typing.Optional[typing.Any],
parse_obj_as(
type_=typing.Optional[typing.Any], # type: ignore
object_=_response.json(),
),
),
)
_response_json = _response.json()
except JSONDecodeError:
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
async def list_browser_profiles(
self, *, include_deleted: typing.Optional[bool] = None, request_options: typing.Optional[RequestOptions] = None
) -> AsyncHttpResponse[typing.List[BrowserProfile]]:

View File

@@ -310,6 +310,7 @@ if typing.TYPE_CHECKING:
from .prompt_action import PromptAction
from .prompt_branch_criteria import PromptBranchCriteria
from .proxy_location import ProxyLocation
from .retry_run_webhook_request import RetryRunWebhookRequest
from .run_engine import RunEngine
from .run_sdk_action_request_action import (
RunSdkActionRequestAction,
@@ -385,6 +386,7 @@ if typing.TYPE_CHECKING:
from .totp_type import TotpType
from .upload_file_action import UploadFileAction
from .upload_file_action_data import UploadFileActionData
from .upload_file_response import UploadFileResponse
from .upload_to_s3block import UploadToS3Block
from .upload_to_s3block_yaml import UploadToS3BlockYaml
from .url_block import UrlBlock
@@ -818,6 +820,7 @@ _dynamic_imports: typing.Dict[str, str] = {
"PromptAction": ".prompt_action",
"PromptBranchCriteria": ".prompt_branch_criteria",
"ProxyLocation": ".proxy_location",
"RetryRunWebhookRequest": ".retry_run_webhook_request",
"RunEngine": ".run_engine",
"RunSdkActionRequestAction": ".run_sdk_action_request_action",
"RunSdkActionRequestAction_AiAct": ".run_sdk_action_request_action",
@@ -887,6 +890,7 @@ _dynamic_imports: typing.Dict[str, str] = {
"TotpType": ".totp_type",
"UploadFileAction": ".upload_file_action",
"UploadFileActionData": ".upload_file_action_data",
"UploadFileResponse": ".upload_file_response",
"UploadToS3Block": ".upload_to_s3block",
"UploadToS3BlockYaml": ".upload_to_s3block_yaml",
"UrlBlock": ".url_block",
@@ -1330,6 +1334,7 @@ __all__ = [
"PromptAction",
"PromptBranchCriteria",
"ProxyLocation",
"RetryRunWebhookRequest",
"RunEngine",
"RunSdkActionRequestAction",
"RunSdkActionRequestAction_AiAct",
@@ -1399,6 +1404,7 @@ __all__ = [
"TotpType",
"UploadFileAction",
"UploadFileActionData",
"UploadFileResponse",
"UploadToS3Block",
"UploadToS3BlockYaml",
"UrlBlock",

View File

@@ -3,9 +3,7 @@
import typing
import pydantic
import typing_extensions
from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel
from ..core.serialization import FieldMetadata
class PromptAction(UniversalBaseModel):
@@ -18,9 +16,7 @@ class PromptAction(UniversalBaseModel):
The prompt to send to the LLM
"""
schema_: typing_extensions.Annotated[
typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]], FieldMetadata(alias="schema")
] = pydantic.Field(default=None)
response_schema: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = pydantic.Field(default=None)
"""
Optional JSON schema to structure the response
"""

View File

@@ -0,0 +1,22 @@
# This file was auto-generated by Fern from our API Definition.
import typing
import pydantic
from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel
class RetryRunWebhookRequest(UniversalBaseModel):
webhook_url: typing.Optional[str] = pydantic.Field(default=None)
"""
Optional webhook URL to send the payload to instead of the stored configuration
"""
if IS_PYDANTIC_V2:
model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
else:
class Config:
frozen = True
smart_union = True
extra = pydantic.Extra.allow

View File

@@ -5,9 +5,7 @@ from __future__ import annotations
import typing
import pydantic
import typing_extensions
from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel
from ..core.serialization import FieldMetadata
from .act_action_data import ActActionData
from .click_action_data import ClickActionData
from .extract_action_data import ExtractActionData
@@ -172,9 +170,7 @@ class RunSdkActionRequestAction_Prompt(UniversalBaseModel):
type: typing.Literal["prompt"] = "prompt"
prompt: str
schema_: typing_extensions.Annotated[
typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]], FieldMetadata(alias="schema")
] = None
response_schema: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = None
model: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = None
if IS_PYDANTIC_V2:

View File

@@ -0,0 +1,29 @@
# This file was auto-generated by Fern from our API Definition.
import typing
import pydantic
import typing_extensions
from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel
from ..core.serialization import FieldMetadata
class UploadFileResponse(UniversalBaseModel):
s3uri: typing_extensions.Annotated[str, FieldMetadata(alias="s3_uri")] = pydantic.Field()
"""
S3 URI where the file was uploaded
"""
presigned_url: str = pydantic.Field()
"""
Presigned URL to access the uploaded file
"""
if IS_PYDANTIC_V2:
model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
else:
class Config:
frozen = True
smart_union = True
extra = pydantic.Extra.allow

View File

@@ -1,4 +0,0 @@
# This file was auto-generated by Fern from our API Definition.
# isort: skip_file

View File

@@ -1,127 +0,0 @@
# 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

View File

@@ -1,136 +0,0 @@
# This file was auto-generated by Fern from our API Definition.
import typing
from json.decoder import JSONDecodeError
from ..core.api_error import ApiError
from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
from ..core.http_response import AsyncHttpResponse, HttpResponse
from ..core.jsonable_encoder import jsonable_encoder
from ..core.pydantic_utilities import parse_obj_as
from ..core.request_options import RequestOptions
from ..errors.unprocessable_entity_error import UnprocessableEntityError
class RawWorkflowsClient:
def __init__(self, *, client_wrapper: SyncClientWrapper):
self._client_wrapper = client_wrapper
def set_workflow_template_status(
self, workflow_permanent_id: str, *, is_template: bool, request_options: typing.Optional[RequestOptions] = None
) -> HttpResponse[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
-------
HttpResponse[typing.Dict[str, typing.Optional[typing.Any]]]
Successful Response
"""
_response = self._client_wrapper.httpx_client.request(
f"v1/workflows/{jsonable_encoder(workflow_permanent_id)}/template",
method="PUT",
params={
"is_template": is_template,
},
request_options=request_options,
)
try:
if 200 <= _response.status_code < 300:
_data = typing.cast(
typing.Dict[str, typing.Optional[typing.Any]],
parse_obj_as(
type_=typing.Dict[str, typing.Optional[typing.Any]], # type: ignore
object_=_response.json(),
),
)
return HttpResponse(response=_response, data=_data)
if _response.status_code == 422:
raise UnprocessableEntityError(
headers=dict(_response.headers),
body=typing.cast(
typing.Optional[typing.Any],
parse_obj_as(
type_=typing.Optional[typing.Any], # type: ignore
object_=_response.json(),
),
),
)
_response_json = _response.json()
except JSONDecodeError:
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
class AsyncRawWorkflowsClient:
def __init__(self, *, client_wrapper: AsyncClientWrapper):
self._client_wrapper = client_wrapper
async def set_workflow_template_status(
self, workflow_permanent_id: str, *, is_template: bool, request_options: typing.Optional[RequestOptions] = None
) -> AsyncHttpResponse[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
-------
AsyncHttpResponse[typing.Dict[str, typing.Optional[typing.Any]]]
Successful Response
"""
_response = await self._client_wrapper.httpx_client.request(
f"v1/workflows/{jsonable_encoder(workflow_permanent_id)}/template",
method="PUT",
params={
"is_template": is_template,
},
request_options=request_options,
)
try:
if 200 <= _response.status_code < 300:
_data = typing.cast(
typing.Dict[str, typing.Optional[typing.Any]],
parse_obj_as(
type_=typing.Dict[str, typing.Optional[typing.Any]], # type: ignore
object_=_response.json(),
),
)
return AsyncHttpResponse(response=_response, data=_data)
if _response.status_code == 422:
raise UnprocessableEntityError(
headers=dict(_response.headers),
body=typing.cast(
typing.Optional[typing.Any],
parse_obj_as(
type_=typing.Optional[typing.Any], # type: ignore
object_=_response.json(),
),
),
)
_response_json = _response.json()
except JSONDecodeError:
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)