move every interface to top level and get rid of sdk client grouping (#2490)

This commit is contained in:
Shuchang Zheng
2025-05-27 23:38:14 -07:00
committed by GitHub
parent 1e16559141
commit abab86619c
33 changed files with 3358 additions and 3563 deletions

View File

@@ -47,6 +47,7 @@ from .types import (
ContextParameterSource_Workflow,
ContextParameterValue,
ContextParameterYaml,
CreateCredentialRequestCredential,
CredentialParameter,
CredentialParameterYaml,
CredentialResponse,
@@ -138,6 +139,12 @@ from .types import (
ForLoopBlockYamlLoopBlocksItem_UploadToS3,
ForLoopBlockYamlLoopBlocksItem_Validation,
ForLoopBlockYamlLoopBlocksItem_Wait,
GetRunResponse,
GetRunResponse_AnthropicCua,
GetRunResponse_OpenaiCua,
GetRunResponse_TaskV1,
GetRunResponse_TaskV2,
GetRunResponse_WorkflowRun,
HttpValidationError,
LoginBlock,
LoginBlockDataSchema,
@@ -319,17 +326,7 @@ from .types import (
WorkflowStatus,
)
from .errors import BadRequestError, ForbiddenError, NotFoundError, UnprocessableEntityError
from . import agent, artifacts, browser_session, credentials, workflows
from .agent import (
AgentGetRunResponse,
AgentGetRunResponse_AnthropicCua,
AgentGetRunResponse_OpenaiCua,
AgentGetRunResponse_TaskV1,
AgentGetRunResponse_TaskV2,
AgentGetRunResponse_WorkflowRun,
)
from .client import AsyncSkyvern, Skyvern
from .credentials import CreateCredentialRequestCredential
from .environment import SkyvernEnvironment
from .version import __version__
@@ -346,12 +343,6 @@ __all__ = [
"ActionBlockParametersItem_Output",
"ActionBlockParametersItem_Workflow",
"ActionBlockYaml",
"AgentGetRunResponse",
"AgentGetRunResponse_AnthropicCua",
"AgentGetRunResponse_OpenaiCua",
"AgentGetRunResponse_TaskV1",
"AgentGetRunResponse_TaskV2",
"AgentGetRunResponse_WorkflowRun",
"Artifact",
"ArtifactType",
"AsyncSkyvern",
@@ -481,6 +472,12 @@ __all__ = [
"ForLoopBlockYamlLoopBlocksItem_Validation",
"ForLoopBlockYamlLoopBlocksItem_Wait",
"ForbiddenError",
"GetRunResponse",
"GetRunResponse_AnthropicCua",
"GetRunResponse_OpenaiCua",
"GetRunResponse_TaskV1",
"GetRunResponse_TaskV2",
"GetRunResponse_WorkflowRun",
"HttpValidationError",
"LoginBlock",
"LoginBlockDataSchema",
@@ -665,9 +662,4 @@ __all__ = [
"WorkflowRunResponseOutput",
"WorkflowStatus",
"__version__",
"agent",
"artifacts",
"browser_session",
"credentials",
"workflows",
]

View File

@@ -1,19 +0,0 @@
# This file was auto-generated by Fern from our API Definition.
from .types import (
AgentGetRunResponse,
AgentGetRunResponse_AnthropicCua,
AgentGetRunResponse_OpenaiCua,
AgentGetRunResponse_TaskV1,
AgentGetRunResponse_TaskV2,
AgentGetRunResponse_WorkflowRun,
)
__all__ = [
"AgentGetRunResponse",
"AgentGetRunResponse_AnthropicCua",
"AgentGetRunResponse_OpenaiCua",
"AgentGetRunResponse_TaskV1",
"AgentGetRunResponse_TaskV2",
"AgentGetRunResponse_WorkflowRun",
]

File diff suppressed because it is too large Load Diff

View File

@@ -1,19 +0,0 @@
# This file was auto-generated by Fern from our API Definition.
from .agent_get_run_response import (
AgentGetRunResponse,
AgentGetRunResponse_AnthropicCua,
AgentGetRunResponse_OpenaiCua,
AgentGetRunResponse_TaskV1,
AgentGetRunResponse_TaskV2,
AgentGetRunResponse_WorkflowRun,
)
__all__ = [
"AgentGetRunResponse",
"AgentGetRunResponse_AnthropicCua",
"AgentGetRunResponse_OpenaiCua",
"AgentGetRunResponse_TaskV1",
"AgentGetRunResponse_TaskV2",
"AgentGetRunResponse_WorkflowRun",
]

View File

@@ -1,2 +0,0 @@
# This file was auto-generated by Fern from our API Definition.

View File

@@ -1,165 +0,0 @@
# This file was auto-generated by Fern from our API Definition.
from ..core.client_wrapper import SyncClientWrapper
import typing
from ..core.request_options import RequestOptions
from ..types.artifact import Artifact
from ..core.jsonable_encoder import jsonable_encoder
from ..core.pydantic_utilities import parse_obj_as
from ..errors.not_found_error import NotFoundError
from ..errors.unprocessable_entity_error import UnprocessableEntityError
from json.decoder import JSONDecodeError
from ..core.api_error import ApiError
from ..core.client_wrapper import AsyncClientWrapper
class ArtifactsClient:
def __init__(self, *, client_wrapper: SyncClientWrapper):
self._client_wrapper = client_wrapper
def get_artifact(self, artifact_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> Artifact:
"""
Get an artifact
Parameters
----------
artifact_id : str
request_options : typing.Optional[RequestOptions]
Request-specific configuration.
Returns
-------
Artifact
Successfully retrieved artifact
Examples
--------
from skyvern import Skyvern
client = Skyvern(
api_key="YOUR_API_KEY",
)
client.artifacts.get_artifact(
artifact_id="artifact_id",
)
"""
_response = self._client_wrapper.httpx_client.request(
f"v1/artifacts/{jsonable_encoder(artifact_id)}",
method="GET",
request_options=request_options,
)
try:
if 200 <= _response.status_code < 300:
return typing.cast(
Artifact,
parse_obj_as(
type_=Artifact, # type: ignore
object_=_response.json(),
),
)
if _response.status_code == 404:
raise NotFoundError(
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(
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, body=_response.text)
raise ApiError(status_code=_response.status_code, body=_response_json)
class AsyncArtifactsClient:
def __init__(self, *, client_wrapper: AsyncClientWrapper):
self._client_wrapper = client_wrapper
async def get_artifact(
self, artifact_id: str, *, request_options: typing.Optional[RequestOptions] = None
) -> Artifact:
"""
Get an artifact
Parameters
----------
artifact_id : str
request_options : typing.Optional[RequestOptions]
Request-specific configuration.
Returns
-------
Artifact
Successfully retrieved artifact
Examples
--------
import asyncio
from skyvern import AsyncSkyvern
client = AsyncSkyvern(
api_key="YOUR_API_KEY",
)
async def main() -> None:
await client.artifacts.get_artifact(
artifact_id="artifact_id",
)
asyncio.run(main())
"""
_response = await self._client_wrapper.httpx_client.request(
f"v1/artifacts/{jsonable_encoder(artifact_id)}",
method="GET",
request_options=request_options,
)
try:
if 200 <= _response.status_code < 300:
return typing.cast(
Artifact,
parse_obj_as(
type_=Artifact, # type: ignore
object_=_response.json(),
),
)
if _response.status_code == 404:
raise NotFoundError(
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(
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, body=_response.text)
raise ApiError(status_code=_response.status_code, body=_response_json)

View File

@@ -1,2 +0,0 @@
# This file was auto-generated by Fern from our API Definition.

View File

@@ -1,631 +0,0 @@
# This file was auto-generated by Fern from our API Definition.
import typing
from ..core.client_wrapper import SyncClientWrapper
from ..core.request_options import RequestOptions
from ..types.browser_session_response import BrowserSessionResponse
from ..core.pydantic_utilities import parse_obj_as
from ..errors.forbidden_error import ForbiddenError
from ..errors.unprocessable_entity_error import UnprocessableEntityError
from json.decoder import JSONDecodeError
from ..core.api_error import ApiError
from ..core.jsonable_encoder import jsonable_encoder
from ..errors.not_found_error import NotFoundError
from ..core.client_wrapper import AsyncClientWrapper
# this is used as the default value for optional parameters
OMIT = typing.cast(typing.Any, ...)
class BrowserSessionClient:
def __init__(self, *, client_wrapper: SyncClientWrapper):
self._client_wrapper = client_wrapper
def get_browser_sessions(
self, *, request_options: typing.Optional[RequestOptions] = None
) -> typing.List[BrowserSessionResponse]:
"""
Get all active browser sessions for the organization
Parameters
----------
request_options : typing.Optional[RequestOptions]
Request-specific configuration.
Returns
-------
typing.List[BrowserSessionResponse]
Successfully retrieved all active browser sessions
Examples
--------
from skyvern import Skyvern
client = Skyvern(
api_key="YOUR_API_KEY",
)
client.browser_session.get_browser_sessions()
"""
_response = self._client_wrapper.httpx_client.request(
"v1/browser_sessions",
method="GET",
request_options=request_options,
)
try:
if 200 <= _response.status_code < 300:
return typing.cast(
typing.List[BrowserSessionResponse],
parse_obj_as(
type_=typing.List[BrowserSessionResponse], # type: ignore
object_=_response.json(),
),
)
if _response.status_code == 403:
raise ForbiddenError(
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(
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, body=_response.text)
raise ApiError(status_code=_response.status_code, body=_response_json)
def create_browser_session(
self, *, timeout: typing.Optional[int] = OMIT, request_options: typing.Optional[RequestOptions] = None
) -> BrowserSessionResponse:
"""
Create a new browser session
Parameters
----------
timeout : typing.Optional[int]
Timeout in minutes for the session. Timeout is applied after the session is started. Must be between 5 and 10080. Defaults to 60.
request_options : typing.Optional[RequestOptions]
Request-specific configuration.
Returns
-------
BrowserSessionResponse
Successfully created browser session
Examples
--------
from skyvern import Skyvern
client = Skyvern(
api_key="YOUR_API_KEY",
)
client.browser_session.create_browser_session()
"""
_response = self._client_wrapper.httpx_client.request(
"v1/browser_sessions",
method="POST",
json={
"timeout": timeout,
},
headers={
"content-type": "application/json",
},
request_options=request_options,
omit=OMIT,
)
try:
if 200 <= _response.status_code < 300:
return typing.cast(
BrowserSessionResponse,
parse_obj_as(
type_=BrowserSessionResponse, # type: ignore
object_=_response.json(),
),
)
if _response.status_code == 403:
raise ForbiddenError(
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(
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, body=_response.text)
raise ApiError(status_code=_response.status_code, body=_response_json)
def close_browser_session(
self, browser_session_id: str, *, request_options: typing.Optional[RequestOptions] = None
) -> typing.Optional[typing.Any]:
"""
Close a browser session
Parameters
----------
browser_session_id : str
The ID of the browser session to close. completed_at will be set when the browser session is closed. browser_session_id starts with `pbs_`
request_options : typing.Optional[RequestOptions]
Request-specific configuration.
Returns
-------
typing.Optional[typing.Any]
Successfully closed browser session
Examples
--------
from skyvern import Skyvern
client = Skyvern(
api_key="YOUR_API_KEY",
)
client.browser_session.close_browser_session(
browser_session_id="pbs_123456",
)
"""
_response = self._client_wrapper.httpx_client.request(
f"v1/browser_sessions/{jsonable_encoder(browser_session_id)}/close",
method="POST",
request_options=request_options,
)
try:
if 200 <= _response.status_code < 300:
return typing.cast(
typing.Optional[typing.Any],
parse_obj_as(
type_=typing.Optional[typing.Any], # type: ignore
object_=_response.json(),
),
)
if _response.status_code == 403:
raise ForbiddenError(
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(
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, body=_response.text)
raise ApiError(status_code=_response.status_code, body=_response_json)
def get_browser_session(
self, browser_session_id: str, *, request_options: typing.Optional[RequestOptions] = None
) -> BrowserSessionResponse:
"""
Get details about a specific browser session by ID
Parameters
----------
browser_session_id : str
The ID of the browser session. browser_session_id starts with `pbs_`
request_options : typing.Optional[RequestOptions]
Request-specific configuration.
Returns
-------
BrowserSessionResponse
Successfully retrieved browser session details
Examples
--------
from skyvern import Skyvern
client = Skyvern(
api_key="YOUR_API_KEY",
)
client.browser_session.get_browser_session(
browser_session_id="pbs_123456",
)
"""
_response = self._client_wrapper.httpx_client.request(
f"v1/browser_sessions/{jsonable_encoder(browser_session_id)}",
method="GET",
request_options=request_options,
)
try:
if 200 <= _response.status_code < 300:
return typing.cast(
BrowserSessionResponse,
parse_obj_as(
type_=BrowserSessionResponse, # type: ignore
object_=_response.json(),
),
)
if _response.status_code == 403:
raise ForbiddenError(
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(
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(
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, body=_response.text)
raise ApiError(status_code=_response.status_code, body=_response_json)
class AsyncBrowserSessionClient:
def __init__(self, *, client_wrapper: AsyncClientWrapper):
self._client_wrapper = client_wrapper
async def get_browser_sessions(
self, *, request_options: typing.Optional[RequestOptions] = None
) -> typing.List[BrowserSessionResponse]:
"""
Get all active browser sessions for the organization
Parameters
----------
request_options : typing.Optional[RequestOptions]
Request-specific configuration.
Returns
-------
typing.List[BrowserSessionResponse]
Successfully retrieved all active browser sessions
Examples
--------
import asyncio
from skyvern import AsyncSkyvern
client = AsyncSkyvern(
api_key="YOUR_API_KEY",
)
async def main() -> None:
await client.browser_session.get_browser_sessions()
asyncio.run(main())
"""
_response = await self._client_wrapper.httpx_client.request(
"v1/browser_sessions",
method="GET",
request_options=request_options,
)
try:
if 200 <= _response.status_code < 300:
return typing.cast(
typing.List[BrowserSessionResponse],
parse_obj_as(
type_=typing.List[BrowserSessionResponse], # type: ignore
object_=_response.json(),
),
)
if _response.status_code == 403:
raise ForbiddenError(
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(
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, body=_response.text)
raise ApiError(status_code=_response.status_code, body=_response_json)
async def create_browser_session(
self, *, timeout: typing.Optional[int] = OMIT, request_options: typing.Optional[RequestOptions] = None
) -> BrowserSessionResponse:
"""
Create a new browser session
Parameters
----------
timeout : typing.Optional[int]
Timeout in minutes for the session. Timeout is applied after the session is started. Must be between 5 and 10080. Defaults to 60.
request_options : typing.Optional[RequestOptions]
Request-specific configuration.
Returns
-------
BrowserSessionResponse
Successfully created browser session
Examples
--------
import asyncio
from skyvern import AsyncSkyvern
client = AsyncSkyvern(
api_key="YOUR_API_KEY",
)
async def main() -> None:
await client.browser_session.create_browser_session()
asyncio.run(main())
"""
_response = await self._client_wrapper.httpx_client.request(
"v1/browser_sessions",
method="POST",
json={
"timeout": timeout,
},
headers={
"content-type": "application/json",
},
request_options=request_options,
omit=OMIT,
)
try:
if 200 <= _response.status_code < 300:
return typing.cast(
BrowserSessionResponse,
parse_obj_as(
type_=BrowserSessionResponse, # type: ignore
object_=_response.json(),
),
)
if _response.status_code == 403:
raise ForbiddenError(
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(
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, body=_response.text)
raise ApiError(status_code=_response.status_code, body=_response_json)
async def close_browser_session(
self, browser_session_id: str, *, request_options: typing.Optional[RequestOptions] = None
) -> typing.Optional[typing.Any]:
"""
Close a browser session
Parameters
----------
browser_session_id : str
The ID of the browser session to close. completed_at will be set when the browser session is closed. browser_session_id starts with `pbs_`
request_options : typing.Optional[RequestOptions]
Request-specific configuration.
Returns
-------
typing.Optional[typing.Any]
Successfully closed browser session
Examples
--------
import asyncio
from skyvern import AsyncSkyvern
client = AsyncSkyvern(
api_key="YOUR_API_KEY",
)
async def main() -> None:
await client.browser_session.close_browser_session(
browser_session_id="pbs_123456",
)
asyncio.run(main())
"""
_response = await self._client_wrapper.httpx_client.request(
f"v1/browser_sessions/{jsonable_encoder(browser_session_id)}/close",
method="POST",
request_options=request_options,
)
try:
if 200 <= _response.status_code < 300:
return typing.cast(
typing.Optional[typing.Any],
parse_obj_as(
type_=typing.Optional[typing.Any], # type: ignore
object_=_response.json(),
),
)
if _response.status_code == 403:
raise ForbiddenError(
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(
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, body=_response.text)
raise ApiError(status_code=_response.status_code, body=_response_json)
async def get_browser_session(
self, browser_session_id: str, *, request_options: typing.Optional[RequestOptions] = None
) -> BrowserSessionResponse:
"""
Get details about a specific browser session by ID
Parameters
----------
browser_session_id : str
The ID of the browser session. browser_session_id starts with `pbs_`
request_options : typing.Optional[RequestOptions]
Request-specific configuration.
Returns
-------
BrowserSessionResponse
Successfully retrieved browser session details
Examples
--------
import asyncio
from skyvern import AsyncSkyvern
client = AsyncSkyvern(
api_key="YOUR_API_KEY",
)
async def main() -> None:
await client.browser_session.get_browser_session(
browser_session_id="pbs_123456",
)
asyncio.run(main())
"""
_response = await self._client_wrapper.httpx_client.request(
f"v1/browser_sessions/{jsonable_encoder(browser_session_id)}",
method="GET",
request_options=request_options,
)
try:
if 200 <= _response.status_code < 300:
return typing.cast(
BrowserSessionResponse,
parse_obj_as(
type_=BrowserSessionResponse, # type: ignore
object_=_response.json(),
),
)
if _response.status_code == 403:
raise ForbiddenError(
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(
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(
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, body=_response.text)
raise ApiError(status_code=_response.status_code, body=_response_json)

File diff suppressed because it is too large Load Diff

View File

@@ -1,5 +0,0 @@
# This file was auto-generated by Fern from our API Definition.
from .types import CreateCredentialRequestCredential
__all__ = ["CreateCredentialRequestCredential"]

View File

@@ -1,800 +0,0 @@
# This file was auto-generated by Fern from our API Definition.
import typing
from ..core.client_wrapper import SyncClientWrapper
import datetime as dt
from ..core.request_options import RequestOptions
from ..types.totp_code import TotpCode
from ..core.pydantic_utilities import parse_obj_as
from ..errors.unprocessable_entity_error import UnprocessableEntityError
from json.decoder import JSONDecodeError
from ..core.api_error import ApiError
from ..types.credential_response import CredentialResponse
from ..types.credential_type import CredentialType
from .types.create_credential_request_credential import CreateCredentialRequestCredential
from ..core.serialization import convert_and_respect_annotation_metadata
from ..core.jsonable_encoder import jsonable_encoder
from ..core.client_wrapper import AsyncClientWrapper
# this is used as the default value for optional parameters
OMIT = typing.cast(typing.Any, ...)
class CredentialsClient:
def __init__(self, *, client_wrapper: SyncClientWrapper):
self._client_wrapper = client_wrapper
def send_totp_code(
self,
*,
totp_identifier: str,
content: str,
task_id: typing.Optional[str] = OMIT,
workflow_id: typing.Optional[str] = OMIT,
workflow_run_id: typing.Optional[str] = OMIT,
source: typing.Optional[str] = OMIT,
expired_at: typing.Optional[dt.datetime] = OMIT,
request_options: typing.Optional[RequestOptions] = None,
) -> TotpCode:
"""
Forward a TOTP (2FA, MFA) email or sms message containing the code to Skyvern. This endpoint stores the code in database so that Skyvern can use it while running tasks/workflows.
Parameters
----------
totp_identifier : str
The identifier of the TOTP code. It can be the email address, phone number, or the identifier of the user.
content : str
The content of the TOTP code. It can be the email content that contains the TOTP code, or the sms message that contains the TOTP code. Skyvern will automatically extract the TOTP code from the content.
task_id : typing.Optional[str]
The task_id the totp code is for. It can be the task_id of the task that the TOTP code is for.
workflow_id : typing.Optional[str]
The workflow ID the TOTP code is for. It can be the workflow ID of the workflow that the TOTP code is for.
workflow_run_id : typing.Optional[str]
The workflow run id that the TOTP code is for. It can be the workflow run id of the workflow run that the TOTP code is for.
source : typing.Optional[str]
An optional field. The source of the TOTP code. e.g. email, sms, etc.
expired_at : typing.Optional[dt.datetime]
The timestamp when the TOTP code expires
request_options : typing.Optional[RequestOptions]
Request-specific configuration.
Returns
-------
TotpCode
Successful Response
Examples
--------
from skyvern import Skyvern
client = Skyvern(
api_key="YOUR_API_KEY",
)
client.credentials.send_totp_code(
totp_identifier="john.doe@example.com",
content="Hello, your verification code is 123456",
)
"""
_response = self._client_wrapper.httpx_client.request(
"v1/credentials/totp",
method="POST",
json={
"totp_identifier": totp_identifier,
"task_id": task_id,
"workflow_id": workflow_id,
"workflow_run_id": workflow_run_id,
"source": source,
"content": content,
"expired_at": expired_at,
},
headers={
"content-type": "application/json",
},
request_options=request_options,
omit=OMIT,
)
try:
if 200 <= _response.status_code < 300:
return typing.cast(
TotpCode,
parse_obj_as(
type_=TotpCode, # type: ignore
object_=_response.json(),
),
)
if _response.status_code == 422:
raise UnprocessableEntityError(
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, body=_response.text)
raise ApiError(status_code=_response.status_code, body=_response_json)
def get_credentials(
self,
*,
page: typing.Optional[int] = None,
page_size: typing.Optional[int] = None,
request_options: typing.Optional[RequestOptions] = None,
) -> typing.List[CredentialResponse]:
"""
Retrieves a paginated list of credentials for the current organization
Parameters
----------
page : typing.Optional[int]
Page number for pagination
page_size : typing.Optional[int]
Number of items per page
request_options : typing.Optional[RequestOptions]
Request-specific configuration.
Returns
-------
typing.List[CredentialResponse]
Successful Response
Examples
--------
from skyvern import Skyvern
client = Skyvern(
api_key="YOUR_API_KEY",
)
client.credentials.get_credentials()
"""
_response = self._client_wrapper.httpx_client.request(
"v1/credentials",
method="GET",
params={
"page": page,
"page_size": page_size,
},
request_options=request_options,
)
try:
if 200 <= _response.status_code < 300:
return typing.cast(
typing.List[CredentialResponse],
parse_obj_as(
type_=typing.List[CredentialResponse], # type: ignore
object_=_response.json(),
),
)
if _response.status_code == 422:
raise UnprocessableEntityError(
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, body=_response.text)
raise ApiError(status_code=_response.status_code, body=_response_json)
def create_credential(
self,
*,
name: str,
credential_type: CredentialType,
credential: CreateCredentialRequestCredential,
request_options: typing.Optional[RequestOptions] = None,
) -> CredentialResponse:
"""
Creates a new credential for the current organization
Parameters
----------
name : str
Name of the credential
credential_type : CredentialType
Type of credential to create
credential : CreateCredentialRequestCredential
The credential data to store
request_options : typing.Optional[RequestOptions]
Request-specific configuration.
Returns
-------
CredentialResponse
Successful Response
Examples
--------
from skyvern import NonEmptyPasswordCredential, Skyvern
client = Skyvern(
api_key="YOUR_API_KEY",
)
client.credentials.create_credential(
name="My Credential",
credential_type="password",
credential=NonEmptyPasswordCredential(
password="securepassword123",
username="user@example.com",
totp="JBSWY3DPEHPK3PXP",
),
)
"""
_response = self._client_wrapper.httpx_client.request(
"v1/credentials",
method="POST",
json={
"name": name,
"credential_type": credential_type,
"credential": convert_and_respect_annotation_metadata(
object_=credential, annotation=CreateCredentialRequestCredential, direction="write"
),
},
headers={
"content-type": "application/json",
},
request_options=request_options,
omit=OMIT,
)
try:
if 200 <= _response.status_code < 300:
return typing.cast(
CredentialResponse,
parse_obj_as(
type_=CredentialResponse, # type: ignore
object_=_response.json(),
),
)
if _response.status_code == 422:
raise UnprocessableEntityError(
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, body=_response.text)
raise ApiError(status_code=_response.status_code, body=_response_json)
def delete_credential(self, credential_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> None:
"""
Deletes a specific credential by its ID
Parameters
----------
credential_id : str
The unique identifier of the credential to delete
request_options : typing.Optional[RequestOptions]
Request-specific configuration.
Returns
-------
None
Examples
--------
from skyvern import Skyvern
client = Skyvern(
api_key="YOUR_API_KEY",
)
client.credentials.delete_credential(
credential_id="cred_1234567890",
)
"""
_response = self._client_wrapper.httpx_client.request(
f"v1/credentials/{jsonable_encoder(credential_id)}/delete",
method="POST",
request_options=request_options,
)
try:
if 200 <= _response.status_code < 300:
return
if _response.status_code == 422:
raise UnprocessableEntityError(
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, body=_response.text)
raise ApiError(status_code=_response.status_code, body=_response_json)
def get_credential(
self, credential_id: str, *, request_options: typing.Optional[RequestOptions] = None
) -> CredentialResponse:
"""
Retrieves a specific credential by its ID
Parameters
----------
credential_id : str
The unique identifier of the credential
request_options : typing.Optional[RequestOptions]
Request-specific configuration.
Returns
-------
CredentialResponse
Successful Response
Examples
--------
from skyvern import Skyvern
client = Skyvern(
api_key="YOUR_API_KEY",
)
client.credentials.get_credential(
credential_id="cred_1234567890",
)
"""
_response = self._client_wrapper.httpx_client.request(
f"v1/credentials/{jsonable_encoder(credential_id)}",
method="GET",
request_options=request_options,
)
try:
if 200 <= _response.status_code < 300:
return typing.cast(
CredentialResponse,
parse_obj_as(
type_=CredentialResponse, # type: ignore
object_=_response.json(),
),
)
if _response.status_code == 422:
raise UnprocessableEntityError(
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, body=_response.text)
raise ApiError(status_code=_response.status_code, body=_response_json)
class AsyncCredentialsClient:
def __init__(self, *, client_wrapper: AsyncClientWrapper):
self._client_wrapper = client_wrapper
async def send_totp_code(
self,
*,
totp_identifier: str,
content: str,
task_id: typing.Optional[str] = OMIT,
workflow_id: typing.Optional[str] = OMIT,
workflow_run_id: typing.Optional[str] = OMIT,
source: typing.Optional[str] = OMIT,
expired_at: typing.Optional[dt.datetime] = OMIT,
request_options: typing.Optional[RequestOptions] = None,
) -> TotpCode:
"""
Forward a TOTP (2FA, MFA) email or sms message containing the code to Skyvern. This endpoint stores the code in database so that Skyvern can use it while running tasks/workflows.
Parameters
----------
totp_identifier : str
The identifier of the TOTP code. It can be the email address, phone number, or the identifier of the user.
content : str
The content of the TOTP code. It can be the email content that contains the TOTP code, or the sms message that contains the TOTP code. Skyvern will automatically extract the TOTP code from the content.
task_id : typing.Optional[str]
The task_id the totp code is for. It can be the task_id of the task that the TOTP code is for.
workflow_id : typing.Optional[str]
The workflow ID the TOTP code is for. It can be the workflow ID of the workflow that the TOTP code is for.
workflow_run_id : typing.Optional[str]
The workflow run id that the TOTP code is for. It can be the workflow run id of the workflow run that the TOTP code is for.
source : typing.Optional[str]
An optional field. The source of the TOTP code. e.g. email, sms, etc.
expired_at : typing.Optional[dt.datetime]
The timestamp when the TOTP code expires
request_options : typing.Optional[RequestOptions]
Request-specific configuration.
Returns
-------
TotpCode
Successful Response
Examples
--------
import asyncio
from skyvern import AsyncSkyvern
client = AsyncSkyvern(
api_key="YOUR_API_KEY",
)
async def main() -> None:
await client.credentials.send_totp_code(
totp_identifier="john.doe@example.com",
content="Hello, your verification code is 123456",
)
asyncio.run(main())
"""
_response = await self._client_wrapper.httpx_client.request(
"v1/credentials/totp",
method="POST",
json={
"totp_identifier": totp_identifier,
"task_id": task_id,
"workflow_id": workflow_id,
"workflow_run_id": workflow_run_id,
"source": source,
"content": content,
"expired_at": expired_at,
},
headers={
"content-type": "application/json",
},
request_options=request_options,
omit=OMIT,
)
try:
if 200 <= _response.status_code < 300:
return typing.cast(
TotpCode,
parse_obj_as(
type_=TotpCode, # type: ignore
object_=_response.json(),
),
)
if _response.status_code == 422:
raise UnprocessableEntityError(
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, body=_response.text)
raise ApiError(status_code=_response.status_code, body=_response_json)
async def get_credentials(
self,
*,
page: typing.Optional[int] = None,
page_size: typing.Optional[int] = None,
request_options: typing.Optional[RequestOptions] = None,
) -> typing.List[CredentialResponse]:
"""
Retrieves a paginated list of credentials for the current organization
Parameters
----------
page : typing.Optional[int]
Page number for pagination
page_size : typing.Optional[int]
Number of items per page
request_options : typing.Optional[RequestOptions]
Request-specific configuration.
Returns
-------
typing.List[CredentialResponse]
Successful Response
Examples
--------
import asyncio
from skyvern import AsyncSkyvern
client = AsyncSkyvern(
api_key="YOUR_API_KEY",
)
async def main() -> None:
await client.credentials.get_credentials()
asyncio.run(main())
"""
_response = await self._client_wrapper.httpx_client.request(
"v1/credentials",
method="GET",
params={
"page": page,
"page_size": page_size,
},
request_options=request_options,
)
try:
if 200 <= _response.status_code < 300:
return typing.cast(
typing.List[CredentialResponse],
parse_obj_as(
type_=typing.List[CredentialResponse], # type: ignore
object_=_response.json(),
),
)
if _response.status_code == 422:
raise UnprocessableEntityError(
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, body=_response.text)
raise ApiError(status_code=_response.status_code, body=_response_json)
async def create_credential(
self,
*,
name: str,
credential_type: CredentialType,
credential: CreateCredentialRequestCredential,
request_options: typing.Optional[RequestOptions] = None,
) -> CredentialResponse:
"""
Creates a new credential for the current organization
Parameters
----------
name : str
Name of the credential
credential_type : CredentialType
Type of credential to create
credential : CreateCredentialRequestCredential
The credential data to store
request_options : typing.Optional[RequestOptions]
Request-specific configuration.
Returns
-------
CredentialResponse
Successful Response
Examples
--------
import asyncio
from skyvern import AsyncSkyvern, NonEmptyPasswordCredential
client = AsyncSkyvern(
api_key="YOUR_API_KEY",
)
async def main() -> None:
await client.credentials.create_credential(
name="My Credential",
credential_type="password",
credential=NonEmptyPasswordCredential(
password="securepassword123",
username="user@example.com",
totp="JBSWY3DPEHPK3PXP",
),
)
asyncio.run(main())
"""
_response = await self._client_wrapper.httpx_client.request(
"v1/credentials",
method="POST",
json={
"name": name,
"credential_type": credential_type,
"credential": convert_and_respect_annotation_metadata(
object_=credential, annotation=CreateCredentialRequestCredential, direction="write"
),
},
headers={
"content-type": "application/json",
},
request_options=request_options,
omit=OMIT,
)
try:
if 200 <= _response.status_code < 300:
return typing.cast(
CredentialResponse,
parse_obj_as(
type_=CredentialResponse, # type: ignore
object_=_response.json(),
),
)
if _response.status_code == 422:
raise UnprocessableEntityError(
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, body=_response.text)
raise ApiError(status_code=_response.status_code, body=_response_json)
async def delete_credential(
self, credential_id: str, *, request_options: typing.Optional[RequestOptions] = None
) -> None:
"""
Deletes a specific credential by its ID
Parameters
----------
credential_id : str
The unique identifier of the credential to delete
request_options : typing.Optional[RequestOptions]
Request-specific configuration.
Returns
-------
None
Examples
--------
import asyncio
from skyvern import AsyncSkyvern
client = AsyncSkyvern(
api_key="YOUR_API_KEY",
)
async def main() -> None:
await client.credentials.delete_credential(
credential_id="cred_1234567890",
)
asyncio.run(main())
"""
_response = await self._client_wrapper.httpx_client.request(
f"v1/credentials/{jsonable_encoder(credential_id)}/delete",
method="POST",
request_options=request_options,
)
try:
if 200 <= _response.status_code < 300:
return
if _response.status_code == 422:
raise UnprocessableEntityError(
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, body=_response.text)
raise ApiError(status_code=_response.status_code, body=_response_json)
async def get_credential(
self, credential_id: str, *, request_options: typing.Optional[RequestOptions] = None
) -> CredentialResponse:
"""
Retrieves a specific credential by its ID
Parameters
----------
credential_id : str
The unique identifier of the credential
request_options : typing.Optional[RequestOptions]
Request-specific configuration.
Returns
-------
CredentialResponse
Successful Response
Examples
--------
import asyncio
from skyvern import AsyncSkyvern
client = AsyncSkyvern(
api_key="YOUR_API_KEY",
)
async def main() -> None:
await client.credentials.get_credential(
credential_id="cred_1234567890",
)
asyncio.run(main())
"""
_response = await self._client_wrapper.httpx_client.request(
f"v1/credentials/{jsonable_encoder(credential_id)}",
method="GET",
request_options=request_options,
)
try:
if 200 <= _response.status_code < 300:
return typing.cast(
CredentialResponse,
parse_obj_as(
type_=CredentialResponse, # type: ignore
object_=_response.json(),
),
)
if _response.status_code == 422:
raise UnprocessableEntityError(
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, body=_response.text)
raise ApiError(status_code=_response.status_code, body=_response_json)

View File

@@ -1,5 +0,0 @@
# This file was auto-generated by Fern from our API Definition.
from .create_credential_request_credential import CreateCredentialRequestCredential
__all__ = ["CreateCredentialRequestCredential"]

View File

@@ -52,6 +52,7 @@ from .context_parameter_source import (
)
from .context_parameter_value import ContextParameterValue
from .context_parameter_yaml import ContextParameterYaml
from .create_credential_request_credential import CreateCredentialRequestCredential
from .credential_parameter import CredentialParameter
from .credential_parameter_yaml import CredentialParameterYaml
from .credential_response import CredentialResponse
@@ -153,6 +154,14 @@ from .for_loop_block_yaml_loop_blocks_item import (
ForLoopBlockYamlLoopBlocksItem_Validation,
ForLoopBlockYamlLoopBlocksItem_Wait,
)
from .get_run_response import (
GetRunResponse,
GetRunResponse_AnthropicCua,
GetRunResponse_OpenaiCua,
GetRunResponse_TaskV1,
GetRunResponse_TaskV2,
GetRunResponse_WorkflowRun,
)
from .http_validation_error import HttpValidationError
from .login_block import LoginBlock
from .login_block_data_schema import LoginBlockDataSchema
@@ -402,6 +411,7 @@ __all__ = [
"ContextParameterSource_Workflow",
"ContextParameterValue",
"ContextParameterYaml",
"CreateCredentialRequestCredential",
"CredentialParameter",
"CredentialParameterYaml",
"CredentialResponse",
@@ -493,6 +503,12 @@ __all__ = [
"ForLoopBlockYamlLoopBlocksItem_UploadToS3",
"ForLoopBlockYamlLoopBlocksItem_Validation",
"ForLoopBlockYamlLoopBlocksItem_Wait",
"GetRunResponse",
"GetRunResponse_AnthropicCua",
"GetRunResponse_OpenaiCua",
"GetRunResponse_TaskV1",
"GetRunResponse_TaskV2",
"GetRunResponse_WorkflowRun",
"HttpValidationError",
"LoginBlock",
"LoginBlockDataSchema",

View File

@@ -2,6 +2,7 @@
from ..core.pydantic_utilities import UniversalBaseModel
import typing
from .run_engine import RunEngine
from ..core.pydantic_utilities import IS_PYDANTIC_V2
import pydantic
@@ -11,6 +12,7 @@ class ActionBlockYaml(UniversalBaseModel):
continue_on_failure: typing.Optional[bool] = None
url: typing.Optional[str] = None
title: typing.Optional[str] = None
engine: typing.Optional[RunEngine] = None
navigation_goal: typing.Optional[str] = None
error_code_mapping: typing.Optional[typing.Dict[str, typing.Optional[str]]] = None
max_retries: typing.Optional[int] = None

View File

@@ -1,7 +1,7 @@
# This file was auto-generated by Fern from our API Definition.
import typing
from ...types.non_empty_password_credential import NonEmptyPasswordCredential
from ...types.non_empty_credit_card_credential import NonEmptyCreditCardCredential
from .non_empty_password_credential import NonEmptyPasswordCredential
from .non_empty_credit_card_credential import NonEmptyCreditCardCredential
CreateCredentialRequestCredential = typing.Union[NonEmptyPasswordCredential, NonEmptyCreditCardCredential]

View File

@@ -2,6 +2,7 @@
from ..core.pydantic_utilities import UniversalBaseModel
import typing
from .run_engine import RunEngine
from .extraction_block_yaml_data_schema import ExtractionBlockYamlDataSchema
from ..core.pydantic_utilities import IS_PYDANTIC_V2
import pydantic
@@ -13,6 +14,7 @@ class ExtractionBlockYaml(UniversalBaseModel):
data_extraction_goal: str
url: typing.Optional[str] = None
title: typing.Optional[str] = None
engine: typing.Optional[RunEngine] = None
data_schema: typing.Optional[ExtractionBlockYamlDataSchema] = None
max_retries: typing.Optional[int] = None
max_steps_per_run: typing.Optional[int] = None

View File

@@ -2,6 +2,7 @@
from ..core.pydantic_utilities import UniversalBaseModel
import typing
from .run_engine import RunEngine
from ..core.pydantic_utilities import IS_PYDANTIC_V2
import pydantic
@@ -12,6 +13,7 @@ class FileDownloadBlockYaml(UniversalBaseModel):
navigation_goal: str
url: typing.Optional[str] = None
title: typing.Optional[str] = None
engine: typing.Optional[RunEngine] = None
error_code_mapping: typing.Optional[typing.Dict[str, typing.Optional[str]]] = None
max_retries: typing.Optional[int] = None
max_steps_per_run: typing.Optional[int] = None

View File

@@ -3,6 +3,7 @@
from __future__ import annotations
from ..core.pydantic_utilities import UniversalBaseModel
import typing
from .run_engine import RunEngine
from .task_block_yaml_data_schema import TaskBlockYamlDataSchema
from ..core.pydantic_utilities import IS_PYDANTIC_V2
import pydantic
@@ -10,7 +11,6 @@ from .file_storage_type import FileStorageType
import typing_extensions
from ..core.serialization import FieldMetadata
from .file_type import FileType
from .run_engine import RunEngine
from .extraction_block_yaml_data_schema import ExtractionBlockYamlDataSchema
from ..core.pydantic_utilities import update_forward_refs
@@ -21,6 +21,7 @@ class ForLoopBlockYamlLoopBlocksItem_Task(UniversalBaseModel):
continue_on_failure: typing.Optional[bool] = None
url: typing.Optional[str] = None
title: typing.Optional[str] = None
engine: typing.Optional[RunEngine] = None
navigation_goal: typing.Optional[str] = None
data_extraction_goal: typing.Optional[str] = None
data_schema: typing.Optional[TaskBlockYamlDataSchema] = None
@@ -225,6 +226,7 @@ class ForLoopBlockYamlLoopBlocksItem_Action(UniversalBaseModel):
continue_on_failure: typing.Optional[bool] = None
url: typing.Optional[str] = None
title: typing.Optional[str] = None
engine: typing.Optional[RunEngine] = None
navigation_goal: typing.Optional[str] = None
error_code_mapping: typing.Optional[typing.Dict[str, typing.Optional[str]]] = None
max_retries: typing.Optional[int] = None
@@ -284,6 +286,7 @@ class ForLoopBlockYamlLoopBlocksItem_Extraction(UniversalBaseModel):
data_extraction_goal: str
url: typing.Optional[str] = None
title: typing.Optional[str] = None
engine: typing.Optional[RunEngine] = None
data_schema: typing.Optional[ExtractionBlockYamlDataSchema] = None
max_retries: typing.Optional[int] = None
max_steps_per_run: typing.Optional[int] = None
@@ -306,6 +309,7 @@ class ForLoopBlockYamlLoopBlocksItem_Login(UniversalBaseModel):
continue_on_failure: typing.Optional[bool] = None
url: typing.Optional[str] = None
title: typing.Optional[str] = None
engine: typing.Optional[RunEngine] = None
navigation_goal: typing.Optional[str] = None
error_code_mapping: typing.Optional[typing.Dict[str, typing.Optional[str]]] = None
max_retries: typing.Optional[int] = None
@@ -351,6 +355,7 @@ class ForLoopBlockYamlLoopBlocksItem_FileDownload(UniversalBaseModel):
navigation_goal: str
url: typing.Optional[str] = None
title: typing.Optional[str] = None
engine: typing.Optional[RunEngine] = None
error_code_mapping: typing.Optional[typing.Dict[str, typing.Optional[str]]] = None
max_retries: typing.Optional[int] = None
max_steps_per_run: typing.Optional[int] = None

View File

@@ -1,20 +1,20 @@
# This file was auto-generated by Fern from our API Definition.
from __future__ import annotations
from ...core.pydantic_utilities import UniversalBaseModel
from ..core.pydantic_utilities import UniversalBaseModel
import typing
from ...types.run_status import RunStatus
from ...types.task_run_response_output import TaskRunResponseOutput
from ...types.file_info import FileInfo
from .run_status import RunStatus
from .task_run_response_output import TaskRunResponseOutput
from .file_info import FileInfo
import datetime as dt
from ...types.task_run_request import TaskRunRequest
from ...core.pydantic_utilities import IS_PYDANTIC_V2
from .task_run_request import TaskRunRequest
from ..core.pydantic_utilities import IS_PYDANTIC_V2
import pydantic
from ...types.workflow_run_response_output import WorkflowRunResponseOutput
from ...types.workflow_run_request import WorkflowRunRequest
from .workflow_run_response_output import WorkflowRunResponseOutput
from .workflow_run_request import WorkflowRunRequest
class AgentGetRunResponse_TaskV1(UniversalBaseModel):
class GetRunResponse_TaskV1(UniversalBaseModel):
run_type: typing.Literal["task_v1"] = "task_v1"
run_id: str
status: RunStatus
@@ -38,7 +38,7 @@ class AgentGetRunResponse_TaskV1(UniversalBaseModel):
extra = pydantic.Extra.allow
class AgentGetRunResponse_TaskV2(UniversalBaseModel):
class GetRunResponse_TaskV2(UniversalBaseModel):
run_type: typing.Literal["task_v2"] = "task_v2"
run_id: str
status: RunStatus
@@ -62,7 +62,7 @@ class AgentGetRunResponse_TaskV2(UniversalBaseModel):
extra = pydantic.Extra.allow
class AgentGetRunResponse_OpenaiCua(UniversalBaseModel):
class GetRunResponse_OpenaiCua(UniversalBaseModel):
run_type: typing.Literal["openai_cua"] = "openai_cua"
run_id: str
status: RunStatus
@@ -86,7 +86,7 @@ class AgentGetRunResponse_OpenaiCua(UniversalBaseModel):
extra = pydantic.Extra.allow
class AgentGetRunResponse_AnthropicCua(UniversalBaseModel):
class GetRunResponse_AnthropicCua(UniversalBaseModel):
run_type: typing.Literal["anthropic_cua"] = "anthropic_cua"
run_id: str
status: RunStatus
@@ -110,7 +110,7 @@ class AgentGetRunResponse_AnthropicCua(UniversalBaseModel):
extra = pydantic.Extra.allow
class AgentGetRunResponse_WorkflowRun(UniversalBaseModel):
class GetRunResponse_WorkflowRun(UniversalBaseModel):
run_type: typing.Literal["workflow_run"] = "workflow_run"
run_id: str
status: RunStatus
@@ -134,10 +134,10 @@ class AgentGetRunResponse_WorkflowRun(UniversalBaseModel):
extra = pydantic.Extra.allow
AgentGetRunResponse = typing.Union[
AgentGetRunResponse_TaskV1,
AgentGetRunResponse_TaskV2,
AgentGetRunResponse_OpenaiCua,
AgentGetRunResponse_AnthropicCua,
AgentGetRunResponse_WorkflowRun,
GetRunResponse = typing.Union[
GetRunResponse_TaskV1,
GetRunResponse_TaskV2,
GetRunResponse_OpenaiCua,
GetRunResponse_AnthropicCua,
GetRunResponse_WorkflowRun,
]

View File

@@ -2,6 +2,7 @@
from ..core.pydantic_utilities import UniversalBaseModel
import typing
from .run_engine import RunEngine
from ..core.pydantic_utilities import IS_PYDANTIC_V2
import pydantic
@@ -11,6 +12,7 @@ class LoginBlockYaml(UniversalBaseModel):
continue_on_failure: typing.Optional[bool] = None
url: typing.Optional[str] = None
title: typing.Optional[str] = None
engine: typing.Optional[RunEngine] = None
navigation_goal: typing.Optional[str] = None
error_code_mapping: typing.Optional[typing.Dict[str, typing.Optional[str]]] = None
max_retries: typing.Optional[int] = None

View File

@@ -2,6 +2,7 @@
from ..core.pydantic_utilities import UniversalBaseModel
import typing
from .run_engine import RunEngine
from .task_block_yaml_data_schema import TaskBlockYamlDataSchema
from ..core.pydantic_utilities import IS_PYDANTIC_V2
import pydantic
@@ -12,6 +13,7 @@ class TaskBlockYaml(UniversalBaseModel):
continue_on_failure: typing.Optional[bool] = None
url: typing.Optional[str] = None
title: typing.Optional[str] = None
engine: typing.Optional[RunEngine] = None
navigation_goal: typing.Optional[str] = None
data_extraction_goal: typing.Optional[str] = None
data_schema: typing.Optional[TaskBlockYamlDataSchema] = None

View File

@@ -3,6 +3,7 @@
from __future__ import annotations
from ..core.pydantic_utilities import UniversalBaseModel
import typing
from .run_engine import RunEngine
from ..core.pydantic_utilities import IS_PYDANTIC_V2
import pydantic
from .extraction_block_yaml_data_schema import ExtractionBlockYamlDataSchema
@@ -10,7 +11,6 @@ from .file_storage_type import FileStorageType
import typing_extensions
from ..core.serialization import FieldMetadata
from .file_type import FileType
from .run_engine import RunEngine
from .task_block_yaml_data_schema import TaskBlockYamlDataSchema
from ..core.pydantic_utilities import update_forward_refs
@@ -21,6 +21,7 @@ class WorkflowDefinitionYamlBlocksItem_Action(UniversalBaseModel):
continue_on_failure: typing.Optional[bool] = None
url: typing.Optional[str] = None
title: typing.Optional[str] = None
engine: typing.Optional[RunEngine] = None
navigation_goal: typing.Optional[str] = None
error_code_mapping: typing.Optional[typing.Dict[str, typing.Optional[str]]] = None
max_retries: typing.Optional[int] = None
@@ -81,6 +82,7 @@ class WorkflowDefinitionYamlBlocksItem_Extraction(UniversalBaseModel):
data_extraction_goal: str
url: typing.Optional[str] = None
title: typing.Optional[str] = None
engine: typing.Optional[RunEngine] = None
data_schema: typing.Optional[ExtractionBlockYamlDataSchema] = None
max_retries: typing.Optional[int] = None
max_steps_per_run: typing.Optional[int] = None
@@ -104,6 +106,7 @@ class WorkflowDefinitionYamlBlocksItem_FileDownload(UniversalBaseModel):
navigation_goal: str
url: typing.Optional[str] = None
title: typing.Optional[str] = None
engine: typing.Optional[RunEngine] = None
error_code_mapping: typing.Optional[typing.Dict[str, typing.Optional[str]]] = None
max_retries: typing.Optional[int] = None
max_steps_per_run: typing.Optional[int] = None
@@ -206,6 +209,7 @@ class WorkflowDefinitionYamlBlocksItem_Login(UniversalBaseModel):
continue_on_failure: typing.Optional[bool] = None
url: typing.Optional[str] = None
title: typing.Optional[str] = None
engine: typing.Optional[RunEngine] = None
navigation_goal: typing.Optional[str] = None
error_code_mapping: typing.Optional[typing.Dict[str, typing.Optional[str]]] = None
max_retries: typing.Optional[int] = None
@@ -307,6 +311,7 @@ class WorkflowDefinitionYamlBlocksItem_Task(UniversalBaseModel):
continue_on_failure: typing.Optional[bool] = None
url: typing.Optional[str] = None
title: typing.Optional[str] = None
engine: typing.Optional[RunEngine] = None
navigation_goal: typing.Optional[str] = None
data_extraction_goal: typing.Optional[str] = None
data_schema: typing.Optional[TaskBlockYamlDataSchema] = None

View File

@@ -1,2 +0,0 @@
# This file was auto-generated by Fern from our API Definition.

View File

@@ -1,637 +0,0 @@
# This file was auto-generated by Fern from our API Definition.
import typing
from ..core.client_wrapper import SyncClientWrapper
from ..core.request_options import RequestOptions
from ..types.workflow import Workflow
from ..core.pydantic_utilities import parse_obj_as
from ..errors.unprocessable_entity_error import UnprocessableEntityError
from json.decoder import JSONDecodeError
from ..core.api_error import ApiError
from ..types.workflow_create_yaml_request import WorkflowCreateYamlRequest
from ..core.serialization import convert_and_respect_annotation_metadata
from ..core.jsonable_encoder import jsonable_encoder
from ..core.client_wrapper import AsyncClientWrapper
# this is used as the default value for optional parameters
OMIT = typing.cast(typing.Any, ...)
class WorkflowsClient:
def __init__(self, *, client_wrapper: SyncClientWrapper):
self._client_wrapper = client_wrapper
def get_workflows(
self,
*,
page: typing.Optional[int] = None,
page_size: typing.Optional[int] = None,
only_saved_tasks: typing.Optional[bool] = None,
only_workflows: typing.Optional[bool] = None,
title: typing.Optional[str] = None,
template: typing.Optional[bool] = None,
request_options: typing.Optional[RequestOptions] = None,
) -> typing.List[Workflow]:
"""
Get all workflows with the latest version for the organization.
Parameters
----------
page : typing.Optional[int]
page_size : typing.Optional[int]
only_saved_tasks : typing.Optional[bool]
only_workflows : typing.Optional[bool]
title : typing.Optional[str]
template : typing.Optional[bool]
request_options : typing.Optional[RequestOptions]
Request-specific configuration.
Returns
-------
typing.List[Workflow]
Successful Response
Examples
--------
from skyvern import Skyvern
client = Skyvern(
api_key="YOUR_API_KEY",
)
client.workflows.get_workflows()
"""
_response = self._client_wrapper.httpx_client.request(
"v1/workflows",
method="GET",
params={
"page": page,
"page_size": page_size,
"only_saved_tasks": only_saved_tasks,
"only_workflows": only_workflows,
"title": title,
"template": template,
},
request_options=request_options,
)
try:
if 200 <= _response.status_code < 300:
return typing.cast(
typing.List[Workflow],
parse_obj_as(
type_=typing.List[Workflow], # type: ignore
object_=_response.json(),
),
)
if _response.status_code == 422:
raise UnprocessableEntityError(
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, body=_response.text)
raise ApiError(status_code=_response.status_code, body=_response_json)
def create_workflow(
self,
*,
json_definition: typing.Optional[WorkflowCreateYamlRequest] = OMIT,
yaml_definition: typing.Optional[str] = OMIT,
request_options: typing.Optional[RequestOptions] = None,
) -> Workflow:
"""
Create a new workflow
Parameters
----------
json_definition : typing.Optional[WorkflowCreateYamlRequest]
Workflow definition in JSON format
yaml_definition : typing.Optional[str]
Workflow definition in YAML format
request_options : typing.Optional[RequestOptions]
Request-specific configuration.
Returns
-------
Workflow
Successfully created workflow
Examples
--------
from skyvern import Skyvern
client = Skyvern(
api_key="YOUR_API_KEY",
)
client.workflows.create_workflow()
"""
_response = self._client_wrapper.httpx_client.request(
"v1/workflows",
method="POST",
json={
"json_definition": convert_and_respect_annotation_metadata(
object_=json_definition, annotation=WorkflowCreateYamlRequest, direction="write"
),
"yaml_definition": yaml_definition,
},
request_options=request_options,
omit=OMIT,
)
try:
if 200 <= _response.status_code < 300:
return typing.cast(
Workflow,
parse_obj_as(
type_=Workflow, # type: ignore
object_=_response.json(),
),
)
if _response.status_code == 422:
raise UnprocessableEntityError(
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, body=_response.text)
raise ApiError(status_code=_response.status_code, body=_response_json)
def update_workflow(
self,
workflow_id: str,
*,
json_definition: typing.Optional[WorkflowCreateYamlRequest] = OMIT,
yaml_definition: typing.Optional[str] = OMIT,
request_options: typing.Optional[RequestOptions] = None,
) -> Workflow:
"""
Update a workflow
Parameters
----------
workflow_id : str
The ID of the workflow to update. Workflow ID starts with `wpid_`.
json_definition : typing.Optional[WorkflowCreateYamlRequest]
Workflow definition in JSON format
yaml_definition : typing.Optional[str]
Workflow definition in YAML format
request_options : typing.Optional[RequestOptions]
Request-specific configuration.
Returns
-------
Workflow
Successfully updated workflow
Examples
--------
from skyvern import Skyvern
client = Skyvern(
api_key="YOUR_API_KEY",
)
client.workflows.update_workflow(
workflow_id="wpid_123",
)
"""
_response = self._client_wrapper.httpx_client.request(
f"v1/workflows/{jsonable_encoder(workflow_id)}",
method="POST",
json={
"json_definition": convert_and_respect_annotation_metadata(
object_=json_definition, annotation=WorkflowCreateYamlRequest, direction="write"
),
"yaml_definition": yaml_definition,
},
request_options=request_options,
omit=OMIT,
)
try:
if 200 <= _response.status_code < 300:
return typing.cast(
Workflow,
parse_obj_as(
type_=Workflow, # type: ignore
object_=_response.json(),
),
)
if _response.status_code == 422:
raise UnprocessableEntityError(
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, body=_response.text)
raise ApiError(status_code=_response.status_code, body=_response_json)
def delete_workflow(
self, workflow_id: str, *, request_options: typing.Optional[RequestOptions] = None
) -> typing.Optional[typing.Any]:
"""
Delete a workflow
Parameters
----------
workflow_id : str
The ID of the workflow to delete. Workflow ID starts with `wpid_`.
request_options : typing.Optional[RequestOptions]
Request-specific configuration.
Returns
-------
typing.Optional[typing.Any]
Successfully deleted workflow
Examples
--------
from skyvern import Skyvern
client = Skyvern(
api_key="YOUR_API_KEY",
)
client.workflows.delete_workflow(
workflow_id="wpid_123",
)
"""
_response = self._client_wrapper.httpx_client.request(
f"v1/workflows/{jsonable_encoder(workflow_id)}/delete",
method="POST",
request_options=request_options,
)
try:
if 200 <= _response.status_code < 300:
return 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(
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, body=_response.text)
raise ApiError(status_code=_response.status_code, body=_response_json)
class AsyncWorkflowsClient:
def __init__(self, *, client_wrapper: AsyncClientWrapper):
self._client_wrapper = client_wrapper
async def get_workflows(
self,
*,
page: typing.Optional[int] = None,
page_size: typing.Optional[int] = None,
only_saved_tasks: typing.Optional[bool] = None,
only_workflows: typing.Optional[bool] = None,
title: typing.Optional[str] = None,
template: typing.Optional[bool] = None,
request_options: typing.Optional[RequestOptions] = None,
) -> typing.List[Workflow]:
"""
Get all workflows with the latest version for the organization.
Parameters
----------
page : typing.Optional[int]
page_size : typing.Optional[int]
only_saved_tasks : typing.Optional[bool]
only_workflows : typing.Optional[bool]
title : typing.Optional[str]
template : typing.Optional[bool]
request_options : typing.Optional[RequestOptions]
Request-specific configuration.
Returns
-------
typing.List[Workflow]
Successful Response
Examples
--------
import asyncio
from skyvern import AsyncSkyvern
client = AsyncSkyvern(
api_key="YOUR_API_KEY",
)
async def main() -> None:
await client.workflows.get_workflows()
asyncio.run(main())
"""
_response = await self._client_wrapper.httpx_client.request(
"v1/workflows",
method="GET",
params={
"page": page,
"page_size": page_size,
"only_saved_tasks": only_saved_tasks,
"only_workflows": only_workflows,
"title": title,
"template": template,
},
request_options=request_options,
)
try:
if 200 <= _response.status_code < 300:
return typing.cast(
typing.List[Workflow],
parse_obj_as(
type_=typing.List[Workflow], # type: ignore
object_=_response.json(),
),
)
if _response.status_code == 422:
raise UnprocessableEntityError(
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, body=_response.text)
raise ApiError(status_code=_response.status_code, body=_response_json)
async def create_workflow(
self,
*,
json_definition: typing.Optional[WorkflowCreateYamlRequest] = OMIT,
yaml_definition: typing.Optional[str] = OMIT,
request_options: typing.Optional[RequestOptions] = None,
) -> Workflow:
"""
Create a new workflow
Parameters
----------
json_definition : typing.Optional[WorkflowCreateYamlRequest]
Workflow definition in JSON format
yaml_definition : typing.Optional[str]
Workflow definition in YAML format
request_options : typing.Optional[RequestOptions]
Request-specific configuration.
Returns
-------
Workflow
Successfully created workflow
Examples
--------
import asyncio
from skyvern import AsyncSkyvern
client = AsyncSkyvern(
api_key="YOUR_API_KEY",
)
async def main() -> None:
await client.workflows.create_workflow()
asyncio.run(main())
"""
_response = await self._client_wrapper.httpx_client.request(
"v1/workflows",
method="POST",
json={
"json_definition": convert_and_respect_annotation_metadata(
object_=json_definition, annotation=WorkflowCreateYamlRequest, direction="write"
),
"yaml_definition": yaml_definition,
},
request_options=request_options,
omit=OMIT,
)
try:
if 200 <= _response.status_code < 300:
return typing.cast(
Workflow,
parse_obj_as(
type_=Workflow, # type: ignore
object_=_response.json(),
),
)
if _response.status_code == 422:
raise UnprocessableEntityError(
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, body=_response.text)
raise ApiError(status_code=_response.status_code, body=_response_json)
async def update_workflow(
self,
workflow_id: str,
*,
json_definition: typing.Optional[WorkflowCreateYamlRequest] = OMIT,
yaml_definition: typing.Optional[str] = OMIT,
request_options: typing.Optional[RequestOptions] = None,
) -> Workflow:
"""
Update a workflow
Parameters
----------
workflow_id : str
The ID of the workflow to update. Workflow ID starts with `wpid_`.
json_definition : typing.Optional[WorkflowCreateYamlRequest]
Workflow definition in JSON format
yaml_definition : typing.Optional[str]
Workflow definition in YAML format
request_options : typing.Optional[RequestOptions]
Request-specific configuration.
Returns
-------
Workflow
Successfully updated workflow
Examples
--------
import asyncio
from skyvern import AsyncSkyvern
client = AsyncSkyvern(
api_key="YOUR_API_KEY",
)
async def main() -> None:
await client.workflows.update_workflow(
workflow_id="wpid_123",
)
asyncio.run(main())
"""
_response = await self._client_wrapper.httpx_client.request(
f"v1/workflows/{jsonable_encoder(workflow_id)}",
method="POST",
json={
"json_definition": convert_and_respect_annotation_metadata(
object_=json_definition, annotation=WorkflowCreateYamlRequest, direction="write"
),
"yaml_definition": yaml_definition,
},
request_options=request_options,
omit=OMIT,
)
try:
if 200 <= _response.status_code < 300:
return typing.cast(
Workflow,
parse_obj_as(
type_=Workflow, # type: ignore
object_=_response.json(),
),
)
if _response.status_code == 422:
raise UnprocessableEntityError(
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, body=_response.text)
raise ApiError(status_code=_response.status_code, body=_response_json)
async def delete_workflow(
self, workflow_id: str, *, request_options: typing.Optional[RequestOptions] = None
) -> typing.Optional[typing.Any]:
"""
Delete a workflow
Parameters
----------
workflow_id : str
The ID of the workflow to delete. Workflow ID starts with `wpid_`.
request_options : typing.Optional[RequestOptions]
Request-specific configuration.
Returns
-------
typing.Optional[typing.Any]
Successfully deleted workflow
Examples
--------
import asyncio
from skyvern import AsyncSkyvern
client = AsyncSkyvern(
api_key="YOUR_API_KEY",
)
async def main() -> None:
await client.workflows.delete_workflow(
workflow_id="wpid_123",
)
asyncio.run(main())
"""
_response = await self._client_wrapper.httpx_client.request(
f"v1/workflows/{jsonable_encoder(workflow_id)}/delete",
method="POST",
request_options=request_options,
)
try:
if 200 <= _response.status_code < 300:
return 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(
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, body=_response.text)
raise ApiError(status_code=_response.status_code, body=_response_json)