Release SDK v1.0.3 (#4277)
This commit is contained in:
committed by
GitHub
parent
401af044b4
commit
30bb5a8c71
@@ -137,7 +137,6 @@ if typing.TYPE_CHECKING:
|
||||
FileType,
|
||||
FileUploadBlock,
|
||||
FileUploadBlockYaml,
|
||||
Folder,
|
||||
ForLoopBlock,
|
||||
ForLoopBlockLoopBlocksItem,
|
||||
ForLoopBlockLoopBlocksItem_Action,
|
||||
@@ -300,6 +299,8 @@ if typing.TYPE_CHECKING:
|
||||
Script,
|
||||
ScriptFileCreate,
|
||||
ScriptRunResponse,
|
||||
SecretCredential,
|
||||
SecretCredentialResponse,
|
||||
SelectOption,
|
||||
SelectOptionAction,
|
||||
SelectOptionActionData,
|
||||
@@ -495,7 +496,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__
|
||||
@@ -633,7 +634,6 @@ _dynamic_imports: typing.Dict[str, str] = {
|
||||
"FileType": ".types",
|
||||
"FileUploadBlock": ".types",
|
||||
"FileUploadBlockYaml": ".types",
|
||||
"Folder": ".types",
|
||||
"ForLoopBlock": ".types",
|
||||
"ForLoopBlockLoopBlocksItem": ".types",
|
||||
"ForLoopBlockLoopBlocksItem_Action": ".types",
|
||||
@@ -798,6 +798,8 @@ _dynamic_imports: typing.Dict[str, str] = {
|
||||
"Script": ".types",
|
||||
"ScriptFileCreate": ".types",
|
||||
"ScriptRunResponse": ".types",
|
||||
"SecretCredential": ".types",
|
||||
"SecretCredentialResponse": ".types",
|
||||
"SelectOption": ".types",
|
||||
"SelectOptionAction": ".types",
|
||||
"SelectOptionActionData": ".types",
|
||||
@@ -996,7 +998,6 @@ _dynamic_imports: typing.Dict[str, str] = {
|
||||
"WorkflowStatus": ".types",
|
||||
"__version__": ".version",
|
||||
"scripts": ".scripts",
|
||||
"workflows": ".workflows",
|
||||
}
|
||||
|
||||
|
||||
@@ -1155,7 +1156,6 @@ __all__ = [
|
||||
"FileType",
|
||||
"FileUploadBlock",
|
||||
"FileUploadBlockYaml",
|
||||
"Folder",
|
||||
"ForLoopBlock",
|
||||
"ForLoopBlockLoopBlocksItem",
|
||||
"ForLoopBlockLoopBlocksItem_Action",
|
||||
@@ -1320,6 +1320,8 @@ __all__ = [
|
||||
"Script",
|
||||
"ScriptFileCreate",
|
||||
"ScriptRunResponse",
|
||||
"SecretCredential",
|
||||
"SecretCredentialResponse",
|
||||
"SelectOption",
|
||||
"SelectOptionAction",
|
||||
"SelectOptionActionData",
|
||||
@@ -1518,5 +1520,4 @@ __all__ = [
|
||||
"WorkflowStatus",
|
||||
"__version__",
|
||||
"scripts",
|
||||
"workflows",
|
||||
]
|
||||
|
||||
@@ -39,7 +39,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 +109,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
|
||||
@@ -1851,14 +1849,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:
|
||||
@@ -1934,7 +1924,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
|
||||
@@ -3937,14 +3926,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:
|
||||
|
||||
@@ -22,10 +22,10 @@ class BaseClientWrapper:
|
||||
|
||||
def get_headers(self) -> typing.Dict[str, str]:
|
||||
headers: typing.Dict[str, str] = {
|
||||
"User-Agent": "skyvern/1.0.2",
|
||||
"User-Agent": "skyvern/1.0.3",
|
||||
"X-Fern-Language": "Python",
|
||||
"X-Fern-SDK-Name": "skyvern",
|
||||
"X-Fern-SDK-Version": "1.0.2",
|
||||
"X-Fern-SDK-Version": "1.0.3",
|
||||
**(self.get_custom_headers() or {}),
|
||||
}
|
||||
if self._api_key is not None:
|
||||
|
||||
@@ -148,7 +148,6 @@ if typing.TYPE_CHECKING:
|
||||
from .file_type import FileType
|
||||
from .file_upload_block import FileUploadBlock
|
||||
from .file_upload_block_yaml import FileUploadBlockYaml
|
||||
from .folder import Folder
|
||||
from .for_loop_block import ForLoopBlock
|
||||
from .for_loop_block_loop_blocks_item import (
|
||||
ForLoopBlockLoopBlocksItem,
|
||||
@@ -329,6 +328,8 @@ if typing.TYPE_CHECKING:
|
||||
from .script import Script
|
||||
from .script_file_create import ScriptFileCreate
|
||||
from .script_run_response import ScriptRunResponse
|
||||
from .secret_credential import SecretCredential
|
||||
from .secret_credential_response import SecretCredentialResponse
|
||||
from .select_option import SelectOption
|
||||
from .select_option_action import SelectOptionAction
|
||||
from .select_option_action_data import SelectOptionActionData
|
||||
@@ -671,7 +672,6 @@ _dynamic_imports: typing.Dict[str, str] = {
|
||||
"FileType": ".file_type",
|
||||
"FileUploadBlock": ".file_upload_block",
|
||||
"FileUploadBlockYaml": ".file_upload_block_yaml",
|
||||
"Folder": ".folder",
|
||||
"ForLoopBlock": ".for_loop_block",
|
||||
"ForLoopBlockLoopBlocksItem": ".for_loop_block_loop_blocks_item",
|
||||
"ForLoopBlockLoopBlocksItem_Action": ".for_loop_block_loop_blocks_item",
|
||||
@@ -834,6 +834,8 @@ _dynamic_imports: typing.Dict[str, str] = {
|
||||
"Script": ".script",
|
||||
"ScriptFileCreate": ".script_file_create",
|
||||
"ScriptRunResponse": ".script_run_response",
|
||||
"SecretCredential": ".secret_credential",
|
||||
"SecretCredentialResponse": ".secret_credential_response",
|
||||
"SelectOption": ".select_option",
|
||||
"SelectOptionAction": ".select_option_action",
|
||||
"SelectOptionActionData": ".select_option_action_data",
|
||||
@@ -1182,7 +1184,6 @@ __all__ = [
|
||||
"FileType",
|
||||
"FileUploadBlock",
|
||||
"FileUploadBlockYaml",
|
||||
"Folder",
|
||||
"ForLoopBlock",
|
||||
"ForLoopBlockLoopBlocksItem",
|
||||
"ForLoopBlockLoopBlocksItem_Action",
|
||||
@@ -1345,6 +1346,8 @@ __all__ = [
|
||||
"Script",
|
||||
"ScriptFileCreate",
|
||||
"ScriptRunResponse",
|
||||
"SecretCredential",
|
||||
"SecretCredentialResponse",
|
||||
"SelectOption",
|
||||
"SelectOptionAction",
|
||||
"SelectOptionActionData",
|
||||
|
||||
@@ -11,6 +11,7 @@ ActionType = typing.Union[
|
||||
"select_option",
|
||||
"checkbox",
|
||||
"wait",
|
||||
"hover",
|
||||
"null_action",
|
||||
"solve_captcha",
|
||||
"terminate",
|
||||
|
||||
@@ -4,5 +4,8 @@ import typing
|
||||
|
||||
from .non_empty_credit_card_credential import NonEmptyCreditCardCredential
|
||||
from .non_empty_password_credential import NonEmptyPasswordCredential
|
||||
from .secret_credential import SecretCredential
|
||||
|
||||
CreateCredentialRequestCredential = typing.Union[NonEmptyPasswordCredential, NonEmptyCreditCardCredential]
|
||||
CreateCredentialRequestCredential = typing.Union[
|
||||
NonEmptyPasswordCredential, NonEmptyCreditCardCredential, SecretCredential
|
||||
]
|
||||
|
||||
@@ -4,5 +4,8 @@ import typing
|
||||
|
||||
from .credit_card_credential_response import CreditCardCredentialResponse
|
||||
from .password_credential_response import PasswordCredentialResponse
|
||||
from .secret_credential_response import SecretCredentialResponse
|
||||
|
||||
CredentialResponseCredential = typing.Union[PasswordCredentialResponse, CreditCardCredentialResponse]
|
||||
CredentialResponseCredential = typing.Union[
|
||||
PasswordCredentialResponse, CreditCardCredentialResponse, SecretCredentialResponse
|
||||
]
|
||||
|
||||
@@ -2,4 +2,4 @@
|
||||
|
||||
import typing
|
||||
|
||||
CredentialTypeOutput = typing.Union[typing.Literal["password", "credit_card"], typing.Any]
|
||||
CredentialTypeOutput = typing.Union[typing.Literal["password", "credit_card", "secret"], typing.Any]
|
||||
|
||||
@@ -355,6 +355,7 @@ class ForLoopBlockLoopBlocksItem_HttpRequest(UniversalBaseModel):
|
||||
url: typing.Optional[str] = None
|
||||
headers: typing.Optional[typing.Dict[str, typing.Optional[str]]] = None
|
||||
body: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = None
|
||||
files: typing.Optional[typing.Dict[str, typing.Optional[str]]] = None
|
||||
timeout: typing.Optional[int] = None
|
||||
follow_redirects: typing.Optional[bool] = None
|
||||
parameters: typing.Optional[typing.List[HttpRequestBlockParametersItem]] = None
|
||||
|
||||
@@ -532,6 +532,7 @@ class ForLoopBlockYamlLoopBlocksItem_HttpRequest(UniversalBaseModel):
|
||||
url: typing.Optional[str] = None
|
||||
headers: typing.Optional[typing.Dict[str, typing.Optional[str]]] = None
|
||||
body: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = None
|
||||
files: typing.Optional[typing.Dict[str, typing.Optional[str]]] = None
|
||||
timeout: typing.Optional[int] = None
|
||||
follow_redirects: typing.Optional[bool] = None
|
||||
parameter_keys: typing.Optional[typing.List[str]] = None
|
||||
|
||||
@@ -30,6 +30,7 @@ class HttpRequestBlock(UniversalBaseModel):
|
||||
url: typing.Optional[str] = None
|
||||
headers: typing.Optional[typing.Dict[str, typing.Optional[str]]] = None
|
||||
body: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = None
|
||||
files: typing.Optional[typing.Dict[str, typing.Optional[str]]] = None
|
||||
timeout: typing.Optional[int] = None
|
||||
follow_redirects: typing.Optional[bool] = None
|
||||
parameters: typing.Optional[typing.List[HttpRequestBlockParametersItem]] = None
|
||||
|
||||
@@ -24,6 +24,7 @@ class HttpRequestBlockYaml(UniversalBaseModel):
|
||||
url: typing.Optional[str] = None
|
||||
headers: typing.Optional[typing.Dict[str, typing.Optional[str]]] = None
|
||||
body: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = None
|
||||
files: typing.Optional[typing.Dict[str, typing.Optional[str]]] = None
|
||||
timeout: typing.Optional[int] = None
|
||||
follow_redirects: typing.Optional[bool] = None
|
||||
parameter_keys: typing.Optional[typing.List[str]] = None
|
||||
|
||||
@@ -1,37 +1,26 @@
|
||||
# This file was auto-generated by Fern from our API Definition.
|
||||
|
||||
import datetime as dt
|
||||
import typing
|
||||
|
||||
import pydantic
|
||||
from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel
|
||||
|
||||
|
||||
class Folder(UniversalBaseModel):
|
||||
class SecretCredential(UniversalBaseModel):
|
||||
"""
|
||||
Response model for a folder
|
||||
Generic secret credential.
|
||||
"""
|
||||
|
||||
title: str = pydantic.Field()
|
||||
secret_value: str = pydantic.Field()
|
||||
"""
|
||||
Folder title
|
||||
The secret value
|
||||
"""
|
||||
|
||||
description: typing.Optional[str] = pydantic.Field(default=None)
|
||||
secret_label: typing.Optional[str] = pydantic.Field(default=None)
|
||||
"""
|
||||
Folder description
|
||||
Optional label describing the secret
|
||||
"""
|
||||
|
||||
folder_id: str
|
||||
organization_id: str
|
||||
workflow_count: typing.Optional[int] = pydantic.Field(default=None)
|
||||
"""
|
||||
Number of workflows in this folder
|
||||
"""
|
||||
|
||||
created_at: dt.datetime
|
||||
modified_at: dt.datetime
|
||||
|
||||
if IS_PYDANTIC_V2:
|
||||
model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
|
||||
else:
|
||||
26
skyvern/client/types/secret_credential_response.py
Normal file
26
skyvern/client/types/secret_credential_response.py
Normal file
@@ -0,0 +1,26 @@
|
||||
# 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 SecretCredentialResponse(UniversalBaseModel):
|
||||
"""
|
||||
Response model for secret credentials.
|
||||
"""
|
||||
|
||||
secret_label: typing.Optional[str] = pydantic.Field(default=None)
|
||||
"""
|
||||
Optional label for the stored secret
|
||||
"""
|
||||
|
||||
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
|
||||
@@ -2,4 +2,6 @@
|
||||
|
||||
import typing
|
||||
|
||||
SkyvernForgeSdkSchemasCredentialsCredentialType = typing.Union[typing.Literal["password", "credit_card"], typing.Any]
|
||||
SkyvernForgeSdkSchemasCredentialsCredentialType = typing.Union[
|
||||
typing.Literal["password", "credit_card", "secret"], typing.Any
|
||||
]
|
||||
|
||||
@@ -356,6 +356,7 @@ class WorkflowDefinitionBlocksItem_HttpRequest(UniversalBaseModel):
|
||||
url: typing.Optional[str] = None
|
||||
headers: typing.Optional[typing.Dict[str, typing.Optional[str]]] = None
|
||||
body: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = None
|
||||
files: typing.Optional[typing.Dict[str, typing.Optional[str]]] = None
|
||||
timeout: typing.Optional[int] = None
|
||||
follow_redirects: typing.Optional[bool] = None
|
||||
parameters: typing.Optional[typing.List[HttpRequestBlockParametersItem]] = None
|
||||
|
||||
@@ -267,6 +267,7 @@ class WorkflowDefinitionYamlBlocksItem_HttpRequest(UniversalBaseModel):
|
||||
url: typing.Optional[str] = None
|
||||
headers: typing.Optional[typing.Dict[str, typing.Optional[str]]] = None
|
||||
body: typing.Optional[typing.Dict[str, typing.Optional[typing.Any]]] = None
|
||||
files: typing.Optional[typing.Dict[str, typing.Optional[str]]] = None
|
||||
timeout: typing.Optional[int] = None
|
||||
follow_redirects: typing.Optional[bool] = None
|
||||
parameter_keys: typing.Optional[typing.List[str]] = None
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
# This file was auto-generated by Fern from our API Definition.
|
||||
|
||||
# isort: skip_file
|
||||
|
||||
@@ -1,596 +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 ..types.folder import Folder
|
||||
from ..types.workflow import Workflow
|
||||
from .raw_client import AsyncRawWorkflowsClient, RawWorkflowsClient
|
||||
|
||||
# this is used as the default value for optional parameters
|
||||
OMIT = typing.cast(typing.Any, ...)
|
||||
|
||||
|
||||
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 get_folders(
|
||||
self,
|
||||
*,
|
||||
page: typing.Optional[int] = None,
|
||||
page_size: typing.Optional[int] = None,
|
||||
search: typing.Optional[str] = None,
|
||||
request_options: typing.Optional[RequestOptions] = None,
|
||||
) -> typing.List[Folder]:
|
||||
"""
|
||||
Get all folders for the organization
|
||||
|
||||
Parameters
|
||||
----------
|
||||
page : typing.Optional[int]
|
||||
Page number
|
||||
|
||||
page_size : typing.Optional[int]
|
||||
Number of folders per page
|
||||
|
||||
search : typing.Optional[str]
|
||||
Search folders by title or description
|
||||
|
||||
request_options : typing.Optional[RequestOptions]
|
||||
Request-specific configuration.
|
||||
|
||||
Returns
|
||||
-------
|
||||
typing.List[Folder]
|
||||
Successfully retrieved folders
|
||||
|
||||
Examples
|
||||
--------
|
||||
from skyvern import Skyvern
|
||||
|
||||
client = Skyvern(
|
||||
api_key="YOUR_API_KEY",
|
||||
)
|
||||
client.workflows.get_folders(
|
||||
page=1,
|
||||
page_size=1,
|
||||
search="search",
|
||||
)
|
||||
"""
|
||||
_response = self._raw_client.get_folders(
|
||||
page=page, page_size=page_size, search=search, request_options=request_options
|
||||
)
|
||||
return _response.data
|
||||
|
||||
def create_folder(
|
||||
self,
|
||||
*,
|
||||
title: str,
|
||||
description: typing.Optional[str] = OMIT,
|
||||
request_options: typing.Optional[RequestOptions] = None,
|
||||
) -> Folder:
|
||||
"""
|
||||
Create a new folder to organize workflows
|
||||
|
||||
Parameters
|
||||
----------
|
||||
title : str
|
||||
Folder title
|
||||
|
||||
description : typing.Optional[str]
|
||||
Folder description
|
||||
|
||||
request_options : typing.Optional[RequestOptions]
|
||||
Request-specific configuration.
|
||||
|
||||
Returns
|
||||
-------
|
||||
Folder
|
||||
Successfully created folder
|
||||
|
||||
Examples
|
||||
--------
|
||||
from skyvern import Skyvern
|
||||
|
||||
client = Skyvern(
|
||||
api_key="YOUR_API_KEY",
|
||||
)
|
||||
client.workflows.create_folder(
|
||||
title="title",
|
||||
)
|
||||
"""
|
||||
_response = self._raw_client.create_folder(
|
||||
title=title, description=description, request_options=request_options
|
||||
)
|
||||
return _response.data
|
||||
|
||||
def get_folder(self, folder_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> Folder:
|
||||
"""
|
||||
Get a specific folder by ID
|
||||
|
||||
Parameters
|
||||
----------
|
||||
folder_id : str
|
||||
Folder ID
|
||||
|
||||
request_options : typing.Optional[RequestOptions]
|
||||
Request-specific configuration.
|
||||
|
||||
Returns
|
||||
-------
|
||||
Folder
|
||||
Successfully retrieved folder
|
||||
|
||||
Examples
|
||||
--------
|
||||
from skyvern import Skyvern
|
||||
|
||||
client = Skyvern(
|
||||
api_key="YOUR_API_KEY",
|
||||
)
|
||||
client.workflows.get_folder(
|
||||
folder_id="fld_123",
|
||||
)
|
||||
"""
|
||||
_response = self._raw_client.get_folder(folder_id, request_options=request_options)
|
||||
return _response.data
|
||||
|
||||
def update_folder(
|
||||
self,
|
||||
folder_id: str,
|
||||
*,
|
||||
title: typing.Optional[str] = OMIT,
|
||||
description: typing.Optional[str] = OMIT,
|
||||
request_options: typing.Optional[RequestOptions] = None,
|
||||
) -> Folder:
|
||||
"""
|
||||
Update a folder's title or description
|
||||
|
||||
Parameters
|
||||
----------
|
||||
folder_id : str
|
||||
Folder ID
|
||||
|
||||
title : typing.Optional[str]
|
||||
Folder title
|
||||
|
||||
description : typing.Optional[str]
|
||||
Folder description
|
||||
|
||||
request_options : typing.Optional[RequestOptions]
|
||||
Request-specific configuration.
|
||||
|
||||
Returns
|
||||
-------
|
||||
Folder
|
||||
Successfully updated folder
|
||||
|
||||
Examples
|
||||
--------
|
||||
from skyvern import Skyvern
|
||||
|
||||
client = Skyvern(
|
||||
api_key="YOUR_API_KEY",
|
||||
)
|
||||
client.workflows.update_folder(
|
||||
folder_id="fld_123",
|
||||
)
|
||||
"""
|
||||
_response = self._raw_client.update_folder(
|
||||
folder_id, title=title, description=description, request_options=request_options
|
||||
)
|
||||
return _response.data
|
||||
|
||||
def delete_folder(
|
||||
self,
|
||||
folder_id: str,
|
||||
*,
|
||||
delete_workflows: typing.Optional[bool] = None,
|
||||
request_options: typing.Optional[RequestOptions] = None,
|
||||
) -> typing.Dict[str, typing.Optional[typing.Any]]:
|
||||
"""
|
||||
Delete a folder. Optionally delete all workflows in the folder.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
folder_id : str
|
||||
Folder ID
|
||||
|
||||
delete_workflows : typing.Optional[bool]
|
||||
If true, also delete all workflows in this folder
|
||||
|
||||
request_options : typing.Optional[RequestOptions]
|
||||
Request-specific configuration.
|
||||
|
||||
Returns
|
||||
-------
|
||||
typing.Dict[str, typing.Optional[typing.Any]]
|
||||
Successfully deleted folder
|
||||
|
||||
Examples
|
||||
--------
|
||||
from skyvern import Skyvern
|
||||
|
||||
client = Skyvern(
|
||||
api_key="YOUR_API_KEY",
|
||||
)
|
||||
client.workflows.delete_folder(
|
||||
folder_id="fld_123",
|
||||
delete_workflows=True,
|
||||
)
|
||||
"""
|
||||
_response = self._raw_client.delete_folder(
|
||||
folder_id, delete_workflows=delete_workflows, request_options=request_options
|
||||
)
|
||||
return _response.data
|
||||
|
||||
def update_workflow_folder(
|
||||
self,
|
||||
workflow_permanent_id: str,
|
||||
*,
|
||||
folder_id: typing.Optional[str] = OMIT,
|
||||
request_options: typing.Optional[RequestOptions] = None,
|
||||
) -> Workflow:
|
||||
"""
|
||||
Update a workflow's folder assignment for the latest version
|
||||
|
||||
Parameters
|
||||
----------
|
||||
workflow_permanent_id : str
|
||||
Workflow permanent ID
|
||||
|
||||
folder_id : typing.Optional[str]
|
||||
Folder ID to assign workflow to. Set to null to remove from folder.
|
||||
|
||||
request_options : typing.Optional[RequestOptions]
|
||||
Request-specific configuration.
|
||||
|
||||
Returns
|
||||
-------
|
||||
Workflow
|
||||
Successfully updated workflow folder
|
||||
|
||||
Examples
|
||||
--------
|
||||
from skyvern import Skyvern
|
||||
|
||||
client = Skyvern(
|
||||
api_key="YOUR_API_KEY",
|
||||
)
|
||||
client.workflows.update_workflow_folder(
|
||||
workflow_permanent_id="wpid_123",
|
||||
)
|
||||
"""
|
||||
_response = self._raw_client.update_workflow_folder(
|
||||
workflow_permanent_id, folder_id=folder_id, 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 get_folders(
|
||||
self,
|
||||
*,
|
||||
page: typing.Optional[int] = None,
|
||||
page_size: typing.Optional[int] = None,
|
||||
search: typing.Optional[str] = None,
|
||||
request_options: typing.Optional[RequestOptions] = None,
|
||||
) -> typing.List[Folder]:
|
||||
"""
|
||||
Get all folders for the organization
|
||||
|
||||
Parameters
|
||||
----------
|
||||
page : typing.Optional[int]
|
||||
Page number
|
||||
|
||||
page_size : typing.Optional[int]
|
||||
Number of folders per page
|
||||
|
||||
search : typing.Optional[str]
|
||||
Search folders by title or description
|
||||
|
||||
request_options : typing.Optional[RequestOptions]
|
||||
Request-specific configuration.
|
||||
|
||||
Returns
|
||||
-------
|
||||
typing.List[Folder]
|
||||
Successfully retrieved folders
|
||||
|
||||
Examples
|
||||
--------
|
||||
import asyncio
|
||||
|
||||
from skyvern import AsyncSkyvern
|
||||
|
||||
client = AsyncSkyvern(
|
||||
api_key="YOUR_API_KEY",
|
||||
)
|
||||
|
||||
|
||||
async def main() -> None:
|
||||
await client.workflows.get_folders(
|
||||
page=1,
|
||||
page_size=1,
|
||||
search="search",
|
||||
)
|
||||
|
||||
|
||||
asyncio.run(main())
|
||||
"""
|
||||
_response = await self._raw_client.get_folders(
|
||||
page=page, page_size=page_size, search=search, request_options=request_options
|
||||
)
|
||||
return _response.data
|
||||
|
||||
async def create_folder(
|
||||
self,
|
||||
*,
|
||||
title: str,
|
||||
description: typing.Optional[str] = OMIT,
|
||||
request_options: typing.Optional[RequestOptions] = None,
|
||||
) -> Folder:
|
||||
"""
|
||||
Create a new folder to organize workflows
|
||||
|
||||
Parameters
|
||||
----------
|
||||
title : str
|
||||
Folder title
|
||||
|
||||
description : typing.Optional[str]
|
||||
Folder description
|
||||
|
||||
request_options : typing.Optional[RequestOptions]
|
||||
Request-specific configuration.
|
||||
|
||||
Returns
|
||||
-------
|
||||
Folder
|
||||
Successfully created folder
|
||||
|
||||
Examples
|
||||
--------
|
||||
import asyncio
|
||||
|
||||
from skyvern import AsyncSkyvern
|
||||
|
||||
client = AsyncSkyvern(
|
||||
api_key="YOUR_API_KEY",
|
||||
)
|
||||
|
||||
|
||||
async def main() -> None:
|
||||
await client.workflows.create_folder(
|
||||
title="title",
|
||||
)
|
||||
|
||||
|
||||
asyncio.run(main())
|
||||
"""
|
||||
_response = await self._raw_client.create_folder(
|
||||
title=title, description=description, request_options=request_options
|
||||
)
|
||||
return _response.data
|
||||
|
||||
async def get_folder(self, folder_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> Folder:
|
||||
"""
|
||||
Get a specific folder by ID
|
||||
|
||||
Parameters
|
||||
----------
|
||||
folder_id : str
|
||||
Folder ID
|
||||
|
||||
request_options : typing.Optional[RequestOptions]
|
||||
Request-specific configuration.
|
||||
|
||||
Returns
|
||||
-------
|
||||
Folder
|
||||
Successfully retrieved folder
|
||||
|
||||
Examples
|
||||
--------
|
||||
import asyncio
|
||||
|
||||
from skyvern import AsyncSkyvern
|
||||
|
||||
client = AsyncSkyvern(
|
||||
api_key="YOUR_API_KEY",
|
||||
)
|
||||
|
||||
|
||||
async def main() -> None:
|
||||
await client.workflows.get_folder(
|
||||
folder_id="fld_123",
|
||||
)
|
||||
|
||||
|
||||
asyncio.run(main())
|
||||
"""
|
||||
_response = await self._raw_client.get_folder(folder_id, request_options=request_options)
|
||||
return _response.data
|
||||
|
||||
async def update_folder(
|
||||
self,
|
||||
folder_id: str,
|
||||
*,
|
||||
title: typing.Optional[str] = OMIT,
|
||||
description: typing.Optional[str] = OMIT,
|
||||
request_options: typing.Optional[RequestOptions] = None,
|
||||
) -> Folder:
|
||||
"""
|
||||
Update a folder's title or description
|
||||
|
||||
Parameters
|
||||
----------
|
||||
folder_id : str
|
||||
Folder ID
|
||||
|
||||
title : typing.Optional[str]
|
||||
Folder title
|
||||
|
||||
description : typing.Optional[str]
|
||||
Folder description
|
||||
|
||||
request_options : typing.Optional[RequestOptions]
|
||||
Request-specific configuration.
|
||||
|
||||
Returns
|
||||
-------
|
||||
Folder
|
||||
Successfully updated folder
|
||||
|
||||
Examples
|
||||
--------
|
||||
import asyncio
|
||||
|
||||
from skyvern import AsyncSkyvern
|
||||
|
||||
client = AsyncSkyvern(
|
||||
api_key="YOUR_API_KEY",
|
||||
)
|
||||
|
||||
|
||||
async def main() -> None:
|
||||
await client.workflows.update_folder(
|
||||
folder_id="fld_123",
|
||||
)
|
||||
|
||||
|
||||
asyncio.run(main())
|
||||
"""
|
||||
_response = await self._raw_client.update_folder(
|
||||
folder_id, title=title, description=description, request_options=request_options
|
||||
)
|
||||
return _response.data
|
||||
|
||||
async def delete_folder(
|
||||
self,
|
||||
folder_id: str,
|
||||
*,
|
||||
delete_workflows: typing.Optional[bool] = None,
|
||||
request_options: typing.Optional[RequestOptions] = None,
|
||||
) -> typing.Dict[str, typing.Optional[typing.Any]]:
|
||||
"""
|
||||
Delete a folder. Optionally delete all workflows in the folder.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
folder_id : str
|
||||
Folder ID
|
||||
|
||||
delete_workflows : typing.Optional[bool]
|
||||
If true, also delete all workflows in this folder
|
||||
|
||||
request_options : typing.Optional[RequestOptions]
|
||||
Request-specific configuration.
|
||||
|
||||
Returns
|
||||
-------
|
||||
typing.Dict[str, typing.Optional[typing.Any]]
|
||||
Successfully deleted folder
|
||||
|
||||
Examples
|
||||
--------
|
||||
import asyncio
|
||||
|
||||
from skyvern import AsyncSkyvern
|
||||
|
||||
client = AsyncSkyvern(
|
||||
api_key="YOUR_API_KEY",
|
||||
)
|
||||
|
||||
|
||||
async def main() -> None:
|
||||
await client.workflows.delete_folder(
|
||||
folder_id="fld_123",
|
||||
delete_workflows=True,
|
||||
)
|
||||
|
||||
|
||||
asyncio.run(main())
|
||||
"""
|
||||
_response = await self._raw_client.delete_folder(
|
||||
folder_id, delete_workflows=delete_workflows, request_options=request_options
|
||||
)
|
||||
return _response.data
|
||||
|
||||
async def update_workflow_folder(
|
||||
self,
|
||||
workflow_permanent_id: str,
|
||||
*,
|
||||
folder_id: typing.Optional[str] = OMIT,
|
||||
request_options: typing.Optional[RequestOptions] = None,
|
||||
) -> Workflow:
|
||||
"""
|
||||
Update a workflow's folder assignment for the latest version
|
||||
|
||||
Parameters
|
||||
----------
|
||||
workflow_permanent_id : str
|
||||
Workflow permanent ID
|
||||
|
||||
folder_id : typing.Optional[str]
|
||||
Folder ID to assign workflow to. Set to null to remove from folder.
|
||||
|
||||
request_options : typing.Optional[RequestOptions]
|
||||
Request-specific configuration.
|
||||
|
||||
Returns
|
||||
-------
|
||||
Workflow
|
||||
Successfully updated workflow folder
|
||||
|
||||
Examples
|
||||
--------
|
||||
import asyncio
|
||||
|
||||
from skyvern import AsyncSkyvern
|
||||
|
||||
client = AsyncSkyvern(
|
||||
api_key="YOUR_API_KEY",
|
||||
)
|
||||
|
||||
|
||||
async def main() -> None:
|
||||
await client.workflows.update_workflow_folder(
|
||||
workflow_permanent_id="wpid_123",
|
||||
)
|
||||
|
||||
|
||||
asyncio.run(main())
|
||||
"""
|
||||
_response = await self._raw_client.update_workflow_folder(
|
||||
workflow_permanent_id, folder_id=folder_id, request_options=request_options
|
||||
)
|
||||
return _response.data
|
||||
@@ -1,909 +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.bad_request_error import BadRequestError
|
||||
from ..errors.not_found_error import NotFoundError
|
||||
from ..errors.unprocessable_entity_error import UnprocessableEntityError
|
||||
from ..types.folder import Folder
|
||||
from ..types.workflow import Workflow
|
||||
|
||||
# this is used as the default value for optional parameters
|
||||
OMIT = typing.cast(typing.Any, ...)
|
||||
|
||||
|
||||
class RawWorkflowsClient:
|
||||
def __init__(self, *, client_wrapper: SyncClientWrapper):
|
||||
self._client_wrapper = client_wrapper
|
||||
|
||||
def get_folders(
|
||||
self,
|
||||
*,
|
||||
page: typing.Optional[int] = None,
|
||||
page_size: typing.Optional[int] = None,
|
||||
search: typing.Optional[str] = None,
|
||||
request_options: typing.Optional[RequestOptions] = None,
|
||||
) -> HttpResponse[typing.List[Folder]]:
|
||||
"""
|
||||
Get all folders for the organization
|
||||
|
||||
Parameters
|
||||
----------
|
||||
page : typing.Optional[int]
|
||||
Page number
|
||||
|
||||
page_size : typing.Optional[int]
|
||||
Number of folders per page
|
||||
|
||||
search : typing.Optional[str]
|
||||
Search folders by title or description
|
||||
|
||||
request_options : typing.Optional[RequestOptions]
|
||||
Request-specific configuration.
|
||||
|
||||
Returns
|
||||
-------
|
||||
HttpResponse[typing.List[Folder]]
|
||||
Successfully retrieved folders
|
||||
"""
|
||||
_response = self._client_wrapper.httpx_client.request(
|
||||
"v1/folders",
|
||||
method="GET",
|
||||
params={
|
||||
"page": page,
|
||||
"page_size": page_size,
|
||||
"search": search,
|
||||
},
|
||||
request_options=request_options,
|
||||
)
|
||||
try:
|
||||
if 200 <= _response.status_code < 300:
|
||||
_data = typing.cast(
|
||||
typing.List[Folder],
|
||||
parse_obj_as(
|
||||
type_=typing.List[Folder], # 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 create_folder(
|
||||
self,
|
||||
*,
|
||||
title: str,
|
||||
description: typing.Optional[str] = OMIT,
|
||||
request_options: typing.Optional[RequestOptions] = None,
|
||||
) -> HttpResponse[Folder]:
|
||||
"""
|
||||
Create a new folder to organize workflows
|
||||
|
||||
Parameters
|
||||
----------
|
||||
title : str
|
||||
Folder title
|
||||
|
||||
description : typing.Optional[str]
|
||||
Folder description
|
||||
|
||||
request_options : typing.Optional[RequestOptions]
|
||||
Request-specific configuration.
|
||||
|
||||
Returns
|
||||
-------
|
||||
HttpResponse[Folder]
|
||||
Successfully created folder
|
||||
"""
|
||||
_response = self._client_wrapper.httpx_client.request(
|
||||
"v1/folders",
|
||||
method="POST",
|
||||
json={
|
||||
"title": title,
|
||||
"description": description,
|
||||
},
|
||||
headers={
|
||||
"content-type": "application/json",
|
||||
},
|
||||
request_options=request_options,
|
||||
omit=OMIT,
|
||||
)
|
||||
try:
|
||||
if 200 <= _response.status_code < 300:
|
||||
_data = typing.cast(
|
||||
Folder,
|
||||
parse_obj_as(
|
||||
type_=Folder, # type: ignore
|
||||
object_=_response.json(),
|
||||
),
|
||||
)
|
||||
return HttpResponse(response=_response, data=_data)
|
||||
if _response.status_code == 400:
|
||||
raise BadRequestError(
|
||||
headers=dict(_response.headers),
|
||||
body=typing.cast(
|
||||
typing.Optional[typing.Any],
|
||||
parse_obj_as(
|
||||
type_=typing.Optional[typing.Any], # type: ignore
|
||||
object_=_response.json(),
|
||||
),
|
||||
),
|
||||
)
|
||||
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 get_folder(
|
||||
self, folder_id: str, *, request_options: typing.Optional[RequestOptions] = None
|
||||
) -> HttpResponse[Folder]:
|
||||
"""
|
||||
Get a specific folder by ID
|
||||
|
||||
Parameters
|
||||
----------
|
||||
folder_id : str
|
||||
Folder ID
|
||||
|
||||
request_options : typing.Optional[RequestOptions]
|
||||
Request-specific configuration.
|
||||
|
||||
Returns
|
||||
-------
|
||||
HttpResponse[Folder]
|
||||
Successfully retrieved folder
|
||||
"""
|
||||
_response = self._client_wrapper.httpx_client.request(
|
||||
f"v1/folders/{jsonable_encoder(folder_id)}",
|
||||
method="GET",
|
||||
request_options=request_options,
|
||||
)
|
||||
try:
|
||||
if 200 <= _response.status_code < 300:
|
||||
_data = typing.cast(
|
||||
Folder,
|
||||
parse_obj_as(
|
||||
type_=Folder, # type: ignore
|
||||
object_=_response.json(),
|
||||
),
|
||||
)
|
||||
return HttpResponse(response=_response, data=_data)
|
||||
if _response.status_code == 404:
|
||||
raise NotFoundError(
|
||||
headers=dict(_response.headers),
|
||||
body=typing.cast(
|
||||
typing.Optional[typing.Any],
|
||||
parse_obj_as(
|
||||
type_=typing.Optional[typing.Any], # type: ignore
|
||||
object_=_response.json(),
|
||||
),
|
||||
),
|
||||
)
|
||||
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 update_folder(
|
||||
self,
|
||||
folder_id: str,
|
||||
*,
|
||||
title: typing.Optional[str] = OMIT,
|
||||
description: typing.Optional[str] = OMIT,
|
||||
request_options: typing.Optional[RequestOptions] = None,
|
||||
) -> HttpResponse[Folder]:
|
||||
"""
|
||||
Update a folder's title or description
|
||||
|
||||
Parameters
|
||||
----------
|
||||
folder_id : str
|
||||
Folder ID
|
||||
|
||||
title : typing.Optional[str]
|
||||
Folder title
|
||||
|
||||
description : typing.Optional[str]
|
||||
Folder description
|
||||
|
||||
request_options : typing.Optional[RequestOptions]
|
||||
Request-specific configuration.
|
||||
|
||||
Returns
|
||||
-------
|
||||
HttpResponse[Folder]
|
||||
Successfully updated folder
|
||||
"""
|
||||
_response = self._client_wrapper.httpx_client.request(
|
||||
f"v1/folders/{jsonable_encoder(folder_id)}",
|
||||
method="PUT",
|
||||
json={
|
||||
"title": title,
|
||||
"description": description,
|
||||
},
|
||||
headers={
|
||||
"content-type": "application/json",
|
||||
},
|
||||
request_options=request_options,
|
||||
omit=OMIT,
|
||||
)
|
||||
try:
|
||||
if 200 <= _response.status_code < 300:
|
||||
_data = typing.cast(
|
||||
Folder,
|
||||
parse_obj_as(
|
||||
type_=Folder, # type: ignore
|
||||
object_=_response.json(),
|
||||
),
|
||||
)
|
||||
return HttpResponse(response=_response, data=_data)
|
||||
if _response.status_code == 404:
|
||||
raise NotFoundError(
|
||||
headers=dict(_response.headers),
|
||||
body=typing.cast(
|
||||
typing.Optional[typing.Any],
|
||||
parse_obj_as(
|
||||
type_=typing.Optional[typing.Any], # type: ignore
|
||||
object_=_response.json(),
|
||||
),
|
||||
),
|
||||
)
|
||||
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 delete_folder(
|
||||
self,
|
||||
folder_id: str,
|
||||
*,
|
||||
delete_workflows: typing.Optional[bool] = None,
|
||||
request_options: typing.Optional[RequestOptions] = None,
|
||||
) -> HttpResponse[typing.Dict[str, typing.Optional[typing.Any]]]:
|
||||
"""
|
||||
Delete a folder. Optionally delete all workflows in the folder.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
folder_id : str
|
||||
Folder ID
|
||||
|
||||
delete_workflows : typing.Optional[bool]
|
||||
If true, also delete all workflows in this folder
|
||||
|
||||
request_options : typing.Optional[RequestOptions]
|
||||
Request-specific configuration.
|
||||
|
||||
Returns
|
||||
-------
|
||||
HttpResponse[typing.Dict[str, typing.Optional[typing.Any]]]
|
||||
Successfully deleted folder
|
||||
"""
|
||||
_response = self._client_wrapper.httpx_client.request(
|
||||
f"v1/folders/{jsonable_encoder(folder_id)}",
|
||||
method="DELETE",
|
||||
params={
|
||||
"delete_workflows": delete_workflows,
|
||||
},
|
||||
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 == 404:
|
||||
raise NotFoundError(
|
||||
headers=dict(_response.headers),
|
||||
body=typing.cast(
|
||||
typing.Optional[typing.Any],
|
||||
parse_obj_as(
|
||||
type_=typing.Optional[typing.Any], # type: ignore
|
||||
object_=_response.json(),
|
||||
),
|
||||
),
|
||||
)
|
||||
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 update_workflow_folder(
|
||||
self,
|
||||
workflow_permanent_id: str,
|
||||
*,
|
||||
folder_id: typing.Optional[str] = OMIT,
|
||||
request_options: typing.Optional[RequestOptions] = None,
|
||||
) -> HttpResponse[Workflow]:
|
||||
"""
|
||||
Update a workflow's folder assignment for the latest version
|
||||
|
||||
Parameters
|
||||
----------
|
||||
workflow_permanent_id : str
|
||||
Workflow permanent ID
|
||||
|
||||
folder_id : typing.Optional[str]
|
||||
Folder ID to assign workflow to. Set to null to remove from folder.
|
||||
|
||||
request_options : typing.Optional[RequestOptions]
|
||||
Request-specific configuration.
|
||||
|
||||
Returns
|
||||
-------
|
||||
HttpResponse[Workflow]
|
||||
Successfully updated workflow folder
|
||||
"""
|
||||
_response = self._client_wrapper.httpx_client.request(
|
||||
f"v1/workflows/{jsonable_encoder(workflow_permanent_id)}/folder",
|
||||
method="PUT",
|
||||
json={
|
||||
"folder_id": folder_id,
|
||||
},
|
||||
headers={
|
||||
"content-type": "application/json",
|
||||
},
|
||||
request_options=request_options,
|
||||
omit=OMIT,
|
||||
)
|
||||
try:
|
||||
if 200 <= _response.status_code < 300:
|
||||
_data = typing.cast(
|
||||
Workflow,
|
||||
parse_obj_as(
|
||||
type_=Workflow, # type: ignore
|
||||
object_=_response.json(),
|
||||
),
|
||||
)
|
||||
return HttpResponse(response=_response, data=_data)
|
||||
if _response.status_code == 400:
|
||||
raise BadRequestError(
|
||||
headers=dict(_response.headers),
|
||||
body=typing.cast(
|
||||
typing.Optional[typing.Any],
|
||||
parse_obj_as(
|
||||
type_=typing.Optional[typing.Any], # type: ignore
|
||||
object_=_response.json(),
|
||||
),
|
||||
),
|
||||
)
|
||||
if _response.status_code == 404:
|
||||
raise NotFoundError(
|
||||
headers=dict(_response.headers),
|
||||
body=typing.cast(
|
||||
typing.Optional[typing.Any],
|
||||
parse_obj_as(
|
||||
type_=typing.Optional[typing.Any], # type: ignore
|
||||
object_=_response.json(),
|
||||
),
|
||||
),
|
||||
)
|
||||
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 get_folders(
|
||||
self,
|
||||
*,
|
||||
page: typing.Optional[int] = None,
|
||||
page_size: typing.Optional[int] = None,
|
||||
search: typing.Optional[str] = None,
|
||||
request_options: typing.Optional[RequestOptions] = None,
|
||||
) -> AsyncHttpResponse[typing.List[Folder]]:
|
||||
"""
|
||||
Get all folders for the organization
|
||||
|
||||
Parameters
|
||||
----------
|
||||
page : typing.Optional[int]
|
||||
Page number
|
||||
|
||||
page_size : typing.Optional[int]
|
||||
Number of folders per page
|
||||
|
||||
search : typing.Optional[str]
|
||||
Search folders by title or description
|
||||
|
||||
request_options : typing.Optional[RequestOptions]
|
||||
Request-specific configuration.
|
||||
|
||||
Returns
|
||||
-------
|
||||
AsyncHttpResponse[typing.List[Folder]]
|
||||
Successfully retrieved folders
|
||||
"""
|
||||
_response = await self._client_wrapper.httpx_client.request(
|
||||
"v1/folders",
|
||||
method="GET",
|
||||
params={
|
||||
"page": page,
|
||||
"page_size": page_size,
|
||||
"search": search,
|
||||
},
|
||||
request_options=request_options,
|
||||
)
|
||||
try:
|
||||
if 200 <= _response.status_code < 300:
|
||||
_data = typing.cast(
|
||||
typing.List[Folder],
|
||||
parse_obj_as(
|
||||
type_=typing.List[Folder], # 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 create_folder(
|
||||
self,
|
||||
*,
|
||||
title: str,
|
||||
description: typing.Optional[str] = OMIT,
|
||||
request_options: typing.Optional[RequestOptions] = None,
|
||||
) -> AsyncHttpResponse[Folder]:
|
||||
"""
|
||||
Create a new folder to organize workflows
|
||||
|
||||
Parameters
|
||||
----------
|
||||
title : str
|
||||
Folder title
|
||||
|
||||
description : typing.Optional[str]
|
||||
Folder description
|
||||
|
||||
request_options : typing.Optional[RequestOptions]
|
||||
Request-specific configuration.
|
||||
|
||||
Returns
|
||||
-------
|
||||
AsyncHttpResponse[Folder]
|
||||
Successfully created folder
|
||||
"""
|
||||
_response = await self._client_wrapper.httpx_client.request(
|
||||
"v1/folders",
|
||||
method="POST",
|
||||
json={
|
||||
"title": title,
|
||||
"description": description,
|
||||
},
|
||||
headers={
|
||||
"content-type": "application/json",
|
||||
},
|
||||
request_options=request_options,
|
||||
omit=OMIT,
|
||||
)
|
||||
try:
|
||||
if 200 <= _response.status_code < 300:
|
||||
_data = typing.cast(
|
||||
Folder,
|
||||
parse_obj_as(
|
||||
type_=Folder, # type: ignore
|
||||
object_=_response.json(),
|
||||
),
|
||||
)
|
||||
return AsyncHttpResponse(response=_response, data=_data)
|
||||
if _response.status_code == 400:
|
||||
raise BadRequestError(
|
||||
headers=dict(_response.headers),
|
||||
body=typing.cast(
|
||||
typing.Optional[typing.Any],
|
||||
parse_obj_as(
|
||||
type_=typing.Optional[typing.Any], # type: ignore
|
||||
object_=_response.json(),
|
||||
),
|
||||
),
|
||||
)
|
||||
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 get_folder(
|
||||
self, folder_id: str, *, request_options: typing.Optional[RequestOptions] = None
|
||||
) -> AsyncHttpResponse[Folder]:
|
||||
"""
|
||||
Get a specific folder by ID
|
||||
|
||||
Parameters
|
||||
----------
|
||||
folder_id : str
|
||||
Folder ID
|
||||
|
||||
request_options : typing.Optional[RequestOptions]
|
||||
Request-specific configuration.
|
||||
|
||||
Returns
|
||||
-------
|
||||
AsyncHttpResponse[Folder]
|
||||
Successfully retrieved folder
|
||||
"""
|
||||
_response = await self._client_wrapper.httpx_client.request(
|
||||
f"v1/folders/{jsonable_encoder(folder_id)}",
|
||||
method="GET",
|
||||
request_options=request_options,
|
||||
)
|
||||
try:
|
||||
if 200 <= _response.status_code < 300:
|
||||
_data = typing.cast(
|
||||
Folder,
|
||||
parse_obj_as(
|
||||
type_=Folder, # type: ignore
|
||||
object_=_response.json(),
|
||||
),
|
||||
)
|
||||
return AsyncHttpResponse(response=_response, data=_data)
|
||||
if _response.status_code == 404:
|
||||
raise NotFoundError(
|
||||
headers=dict(_response.headers),
|
||||
body=typing.cast(
|
||||
typing.Optional[typing.Any],
|
||||
parse_obj_as(
|
||||
type_=typing.Optional[typing.Any], # type: ignore
|
||||
object_=_response.json(),
|
||||
),
|
||||
),
|
||||
)
|
||||
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 update_folder(
|
||||
self,
|
||||
folder_id: str,
|
||||
*,
|
||||
title: typing.Optional[str] = OMIT,
|
||||
description: typing.Optional[str] = OMIT,
|
||||
request_options: typing.Optional[RequestOptions] = None,
|
||||
) -> AsyncHttpResponse[Folder]:
|
||||
"""
|
||||
Update a folder's title or description
|
||||
|
||||
Parameters
|
||||
----------
|
||||
folder_id : str
|
||||
Folder ID
|
||||
|
||||
title : typing.Optional[str]
|
||||
Folder title
|
||||
|
||||
description : typing.Optional[str]
|
||||
Folder description
|
||||
|
||||
request_options : typing.Optional[RequestOptions]
|
||||
Request-specific configuration.
|
||||
|
||||
Returns
|
||||
-------
|
||||
AsyncHttpResponse[Folder]
|
||||
Successfully updated folder
|
||||
"""
|
||||
_response = await self._client_wrapper.httpx_client.request(
|
||||
f"v1/folders/{jsonable_encoder(folder_id)}",
|
||||
method="PUT",
|
||||
json={
|
||||
"title": title,
|
||||
"description": description,
|
||||
},
|
||||
headers={
|
||||
"content-type": "application/json",
|
||||
},
|
||||
request_options=request_options,
|
||||
omit=OMIT,
|
||||
)
|
||||
try:
|
||||
if 200 <= _response.status_code < 300:
|
||||
_data = typing.cast(
|
||||
Folder,
|
||||
parse_obj_as(
|
||||
type_=Folder, # type: ignore
|
||||
object_=_response.json(),
|
||||
),
|
||||
)
|
||||
return AsyncHttpResponse(response=_response, data=_data)
|
||||
if _response.status_code == 404:
|
||||
raise NotFoundError(
|
||||
headers=dict(_response.headers),
|
||||
body=typing.cast(
|
||||
typing.Optional[typing.Any],
|
||||
parse_obj_as(
|
||||
type_=typing.Optional[typing.Any], # type: ignore
|
||||
object_=_response.json(),
|
||||
),
|
||||
),
|
||||
)
|
||||
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 delete_folder(
|
||||
self,
|
||||
folder_id: str,
|
||||
*,
|
||||
delete_workflows: typing.Optional[bool] = None,
|
||||
request_options: typing.Optional[RequestOptions] = None,
|
||||
) -> AsyncHttpResponse[typing.Dict[str, typing.Optional[typing.Any]]]:
|
||||
"""
|
||||
Delete a folder. Optionally delete all workflows in the folder.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
folder_id : str
|
||||
Folder ID
|
||||
|
||||
delete_workflows : typing.Optional[bool]
|
||||
If true, also delete all workflows in this folder
|
||||
|
||||
request_options : typing.Optional[RequestOptions]
|
||||
Request-specific configuration.
|
||||
|
||||
Returns
|
||||
-------
|
||||
AsyncHttpResponse[typing.Dict[str, typing.Optional[typing.Any]]]
|
||||
Successfully deleted folder
|
||||
"""
|
||||
_response = await self._client_wrapper.httpx_client.request(
|
||||
f"v1/folders/{jsonable_encoder(folder_id)}",
|
||||
method="DELETE",
|
||||
params={
|
||||
"delete_workflows": delete_workflows,
|
||||
},
|
||||
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 == 404:
|
||||
raise NotFoundError(
|
||||
headers=dict(_response.headers),
|
||||
body=typing.cast(
|
||||
typing.Optional[typing.Any],
|
||||
parse_obj_as(
|
||||
type_=typing.Optional[typing.Any], # type: ignore
|
||||
object_=_response.json(),
|
||||
),
|
||||
),
|
||||
)
|
||||
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 update_workflow_folder(
|
||||
self,
|
||||
workflow_permanent_id: str,
|
||||
*,
|
||||
folder_id: typing.Optional[str] = OMIT,
|
||||
request_options: typing.Optional[RequestOptions] = None,
|
||||
) -> AsyncHttpResponse[Workflow]:
|
||||
"""
|
||||
Update a workflow's folder assignment for the latest version
|
||||
|
||||
Parameters
|
||||
----------
|
||||
workflow_permanent_id : str
|
||||
Workflow permanent ID
|
||||
|
||||
folder_id : typing.Optional[str]
|
||||
Folder ID to assign workflow to. Set to null to remove from folder.
|
||||
|
||||
request_options : typing.Optional[RequestOptions]
|
||||
Request-specific configuration.
|
||||
|
||||
Returns
|
||||
-------
|
||||
AsyncHttpResponse[Workflow]
|
||||
Successfully updated workflow folder
|
||||
"""
|
||||
_response = await self._client_wrapper.httpx_client.request(
|
||||
f"v1/workflows/{jsonable_encoder(workflow_permanent_id)}/folder",
|
||||
method="PUT",
|
||||
json={
|
||||
"folder_id": folder_id,
|
||||
},
|
||||
headers={
|
||||
"content-type": "application/json",
|
||||
},
|
||||
request_options=request_options,
|
||||
omit=OMIT,
|
||||
)
|
||||
try:
|
||||
if 200 <= _response.status_code < 300:
|
||||
_data = typing.cast(
|
||||
Workflow,
|
||||
parse_obj_as(
|
||||
type_=Workflow, # type: ignore
|
||||
object_=_response.json(),
|
||||
),
|
||||
)
|
||||
return AsyncHttpResponse(response=_response, data=_data)
|
||||
if _response.status_code == 400:
|
||||
raise BadRequestError(
|
||||
headers=dict(_response.headers),
|
||||
body=typing.cast(
|
||||
typing.Optional[typing.Any],
|
||||
parse_obj_as(
|
||||
type_=typing.Optional[typing.Any], # type: ignore
|
||||
object_=_response.json(),
|
||||
),
|
||||
),
|
||||
)
|
||||
if _response.status_code == 404:
|
||||
raise NotFoundError(
|
||||
headers=dict(_response.headers),
|
||||
body=typing.cast(
|
||||
typing.Optional[typing.Any],
|
||||
parse_obj_as(
|
||||
type_=typing.Optional[typing.Any], # type: ignore
|
||||
object_=_response.json(),
|
||||
),
|
||||
),
|
||||
)
|
||||
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)
|
||||
Reference in New Issue
Block a user