v1.0.14 (#4770)
This commit is contained in:
@@ -49,8 +49,10 @@ from .types.totp_code import TotpCode
|
||||
from .types.upload_file_response import UploadFileResponse
|
||||
from .types.workflow import Workflow
|
||||
from .types.workflow_create_yaml_request import WorkflowCreateYamlRequest
|
||||
from .types.workflow_run import WorkflowRun
|
||||
from .types.workflow_run_request_proxy_location import WorkflowRunRequestProxyLocation
|
||||
from .types.workflow_run_response import WorkflowRunResponse
|
||||
from .types.workflow_run_status import WorkflowRunStatus
|
||||
from .types.workflow_run_timeline import WorkflowRunTimeline
|
||||
from .types.workflow_status import WorkflowStatus
|
||||
|
||||
@@ -595,10 +597,10 @@ class RawSkyvern:
|
||||
only_templates : typing.Optional[bool]
|
||||
|
||||
search_key : typing.Optional[str]
|
||||
Unified search across workflow title, folder name, and parameter metadata (key, description, default_value).
|
||||
Case-insensitive substring search across: workflow title, folder name, and parameter metadata (key, description, default_value). A workflow is returned if any of these fields match. Soft-deleted parameter definitions are excluded. Takes precedence over the deprecated `title` parameter.
|
||||
|
||||
title : typing.Optional[str]
|
||||
Deprecated: use search_key instead.
|
||||
Deprecated: use search_key instead. Falls back to title-only search if search_key is not provided.
|
||||
|
||||
folder_id : typing.Optional[str]
|
||||
Filter workflows by folder ID
|
||||
@@ -1111,6 +1113,109 @@ class RawSkyvern:
|
||||
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
||||
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
||||
|
||||
def get_workflow_runs(
|
||||
self,
|
||||
*,
|
||||
page: typing.Optional[int] = None,
|
||||
page_size: typing.Optional[int] = None,
|
||||
status: typing.Optional[typing.Union[WorkflowRunStatus, typing.Sequence[WorkflowRunStatus]]] = None,
|
||||
search_key: typing.Optional[str] = None,
|
||||
error_code: typing.Optional[str] = None,
|
||||
request_options: typing.Optional[RequestOptions] = None,
|
||||
) -> HttpResponse[typing.List[WorkflowRun]]:
|
||||
"""
|
||||
List workflow runs across all workflows for the current organization.
|
||||
|
||||
Results are paginated and can be filtered by **status**, **search_key**, and **error_code**. All filters are combined with **AND** logic — a run must match every supplied filter to be returned.
|
||||
|
||||
### search_key
|
||||
|
||||
A case-insensitive substring search that matches against **any** of the following fields:
|
||||
|
||||
| Searched field | Description |
|
||||
|---|---|
|
||||
| `workflow_run_id` | The unique run identifier (e.g. `wr_123…`) |
|
||||
| Parameter **key** | The `key` of any workflow parameter definition associated with the run |
|
||||
| Parameter **description** | The `description` of any workflow parameter definition |
|
||||
| Run parameter **value** | The actual value supplied for any parameter when the run was created |
|
||||
| `extra_http_headers` | Extra HTTP headers attached to the run (searched as raw JSON text) |
|
||||
|
||||
Soft-deleted parameter definitions are excluded from key/description matching. A run is returned if **any** of the fields above contain the search term.
|
||||
|
||||
### error_code
|
||||
|
||||
An **exact-match** filter against the `error_code` field inside each task's `errors` JSON array. A run matches if **any** of its tasks contains an error object with a matching `error_code` value. Error codes are user-defined strings set during workflow execution (e.g. `INVALID_CREDENTIALS`, `LOGIN_FAILED`, `CAPTCHA_DETECTED`).
|
||||
|
||||
### Combining filters
|
||||
|
||||
All query parameters use AND logic:
|
||||
- `?status=failed` — only failed runs
|
||||
- `?status=failed&error_code=LOGIN_FAILED` — failed runs **and** have a LOGIN_FAILED error
|
||||
- `?status=failed&error_code=LOGIN_FAILED&search_key=prod_credential` — all three conditions must match
|
||||
|
||||
Parameters
|
||||
----------
|
||||
page : typing.Optional[int]
|
||||
Page number for pagination.
|
||||
|
||||
page_size : typing.Optional[int]
|
||||
Number of runs to return per page.
|
||||
|
||||
status : typing.Optional[typing.Union[WorkflowRunStatus, typing.Sequence[WorkflowRunStatus]]]
|
||||
Filter by one or more run statuses.
|
||||
|
||||
search_key : typing.Optional[str]
|
||||
Case-insensitive substring search across: workflow run ID, parameter key, parameter description, run parameter value, and extra HTTP headers. A run is returned if any of these fields match. Soft-deleted parameter definitions are excluded from key/description matching.
|
||||
|
||||
error_code : typing.Optional[str]
|
||||
Exact-match filter on the error_code field inside each task's errors JSON array. A run matches if any of its tasks contains an error with a matching error_code. Error codes are user-defined strings set during workflow execution.
|
||||
|
||||
request_options : typing.Optional[RequestOptions]
|
||||
Request-specific configuration.
|
||||
|
||||
Returns
|
||||
-------
|
||||
HttpResponse[typing.List[WorkflowRun]]
|
||||
Successful Response
|
||||
"""
|
||||
_response = self._client_wrapper.httpx_client.request(
|
||||
"v1/workflows/runs",
|
||||
method="GET",
|
||||
params={
|
||||
"page": page,
|
||||
"page_size": page_size,
|
||||
"status": status,
|
||||
"search_key": search_key,
|
||||
"error_code": error_code,
|
||||
},
|
||||
request_options=request_options,
|
||||
)
|
||||
try:
|
||||
if 200 <= _response.status_code < 300:
|
||||
_data = typing.cast(
|
||||
typing.List[WorkflowRun],
|
||||
parse_obj_as(
|
||||
type_=typing.List[WorkflowRun], # 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 get_workflow(
|
||||
self,
|
||||
workflow_permanent_id: str,
|
||||
@@ -2077,6 +2182,82 @@ class RawSkyvern:
|
||||
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
||||
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
||||
|
||||
def update_credential(
|
||||
self,
|
||||
credential_id: str,
|
||||
*,
|
||||
name: str,
|
||||
credential_type: SkyvernForgeSdkSchemasCredentialsCredentialType,
|
||||
credential: CreateCredentialRequestCredential,
|
||||
request_options: typing.Optional[RequestOptions] = None,
|
||||
) -> HttpResponse[CredentialResponse]:
|
||||
"""
|
||||
Overwrites the stored credential data (e.g. username/password) while keeping the same credential_id.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
credential_id : str
|
||||
The unique identifier of the credential to update
|
||||
|
||||
name : str
|
||||
Name of the credential
|
||||
|
||||
credential_type : SkyvernForgeSdkSchemasCredentialsCredentialType
|
||||
Type of credential to create
|
||||
|
||||
credential : CreateCredentialRequestCredential
|
||||
The credential data to store
|
||||
|
||||
request_options : typing.Optional[RequestOptions]
|
||||
Request-specific configuration.
|
||||
|
||||
Returns
|
||||
-------
|
||||
HttpResponse[CredentialResponse]
|
||||
Successful Response
|
||||
"""
|
||||
_response = self._client_wrapper.httpx_client.request(
|
||||
f"v1/credentials/{jsonable_encoder(credential_id)}/update",
|
||||
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:
|
||||
_data = typing.cast(
|
||||
CredentialResponse,
|
||||
parse_obj_as(
|
||||
type_=CredentialResponse, # 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 delete_credential(
|
||||
self, credential_id: str, *, request_options: typing.Optional[RequestOptions] = None
|
||||
) -> HttpResponse[None]:
|
||||
@@ -3545,10 +3726,10 @@ class AsyncRawSkyvern:
|
||||
only_templates : typing.Optional[bool]
|
||||
|
||||
search_key : typing.Optional[str]
|
||||
Unified search across workflow title, folder name, and parameter metadata (key, description, default_value).
|
||||
Case-insensitive substring search across: workflow title, folder name, and parameter metadata (key, description, default_value). A workflow is returned if any of these fields match. Soft-deleted parameter definitions are excluded. Takes precedence over the deprecated `title` parameter.
|
||||
|
||||
title : typing.Optional[str]
|
||||
Deprecated: use search_key instead.
|
||||
Deprecated: use search_key instead. Falls back to title-only search if search_key is not provided.
|
||||
|
||||
folder_id : typing.Optional[str]
|
||||
Filter workflows by folder ID
|
||||
@@ -4061,6 +4242,109 @@ class AsyncRawSkyvern:
|
||||
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
||||
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
||||
|
||||
async def get_workflow_runs(
|
||||
self,
|
||||
*,
|
||||
page: typing.Optional[int] = None,
|
||||
page_size: typing.Optional[int] = None,
|
||||
status: typing.Optional[typing.Union[WorkflowRunStatus, typing.Sequence[WorkflowRunStatus]]] = None,
|
||||
search_key: typing.Optional[str] = None,
|
||||
error_code: typing.Optional[str] = None,
|
||||
request_options: typing.Optional[RequestOptions] = None,
|
||||
) -> AsyncHttpResponse[typing.List[WorkflowRun]]:
|
||||
"""
|
||||
List workflow runs across all workflows for the current organization.
|
||||
|
||||
Results are paginated and can be filtered by **status**, **search_key**, and **error_code**. All filters are combined with **AND** logic — a run must match every supplied filter to be returned.
|
||||
|
||||
### search_key
|
||||
|
||||
A case-insensitive substring search that matches against **any** of the following fields:
|
||||
|
||||
| Searched field | Description |
|
||||
|---|---|
|
||||
| `workflow_run_id` | The unique run identifier (e.g. `wr_123…`) |
|
||||
| Parameter **key** | The `key` of any workflow parameter definition associated with the run |
|
||||
| Parameter **description** | The `description` of any workflow parameter definition |
|
||||
| Run parameter **value** | The actual value supplied for any parameter when the run was created |
|
||||
| `extra_http_headers` | Extra HTTP headers attached to the run (searched as raw JSON text) |
|
||||
|
||||
Soft-deleted parameter definitions are excluded from key/description matching. A run is returned if **any** of the fields above contain the search term.
|
||||
|
||||
### error_code
|
||||
|
||||
An **exact-match** filter against the `error_code` field inside each task's `errors` JSON array. A run matches if **any** of its tasks contains an error object with a matching `error_code` value. Error codes are user-defined strings set during workflow execution (e.g. `INVALID_CREDENTIALS`, `LOGIN_FAILED`, `CAPTCHA_DETECTED`).
|
||||
|
||||
### Combining filters
|
||||
|
||||
All query parameters use AND logic:
|
||||
- `?status=failed` — only failed runs
|
||||
- `?status=failed&error_code=LOGIN_FAILED` — failed runs **and** have a LOGIN_FAILED error
|
||||
- `?status=failed&error_code=LOGIN_FAILED&search_key=prod_credential` — all three conditions must match
|
||||
|
||||
Parameters
|
||||
----------
|
||||
page : typing.Optional[int]
|
||||
Page number for pagination.
|
||||
|
||||
page_size : typing.Optional[int]
|
||||
Number of runs to return per page.
|
||||
|
||||
status : typing.Optional[typing.Union[WorkflowRunStatus, typing.Sequence[WorkflowRunStatus]]]
|
||||
Filter by one or more run statuses.
|
||||
|
||||
search_key : typing.Optional[str]
|
||||
Case-insensitive substring search across: workflow run ID, parameter key, parameter description, run parameter value, and extra HTTP headers. A run is returned if any of these fields match. Soft-deleted parameter definitions are excluded from key/description matching.
|
||||
|
||||
error_code : typing.Optional[str]
|
||||
Exact-match filter on the error_code field inside each task's errors JSON array. A run matches if any of its tasks contains an error with a matching error_code. Error codes are user-defined strings set during workflow execution.
|
||||
|
||||
request_options : typing.Optional[RequestOptions]
|
||||
Request-specific configuration.
|
||||
|
||||
Returns
|
||||
-------
|
||||
AsyncHttpResponse[typing.List[WorkflowRun]]
|
||||
Successful Response
|
||||
"""
|
||||
_response = await self._client_wrapper.httpx_client.request(
|
||||
"v1/workflows/runs",
|
||||
method="GET",
|
||||
params={
|
||||
"page": page,
|
||||
"page_size": page_size,
|
||||
"status": status,
|
||||
"search_key": search_key,
|
||||
"error_code": error_code,
|
||||
},
|
||||
request_options=request_options,
|
||||
)
|
||||
try:
|
||||
if 200 <= _response.status_code < 300:
|
||||
_data = typing.cast(
|
||||
typing.List[WorkflowRun],
|
||||
parse_obj_as(
|
||||
type_=typing.List[WorkflowRun], # 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 get_workflow(
|
||||
self,
|
||||
workflow_permanent_id: str,
|
||||
@@ -5027,6 +5311,82 @@ class AsyncRawSkyvern:
|
||||
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response.text)
|
||||
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
|
||||
|
||||
async def update_credential(
|
||||
self,
|
||||
credential_id: str,
|
||||
*,
|
||||
name: str,
|
||||
credential_type: SkyvernForgeSdkSchemasCredentialsCredentialType,
|
||||
credential: CreateCredentialRequestCredential,
|
||||
request_options: typing.Optional[RequestOptions] = None,
|
||||
) -> AsyncHttpResponse[CredentialResponse]:
|
||||
"""
|
||||
Overwrites the stored credential data (e.g. username/password) while keeping the same credential_id.
|
||||
|
||||
Parameters
|
||||
----------
|
||||
credential_id : str
|
||||
The unique identifier of the credential to update
|
||||
|
||||
name : str
|
||||
Name of the credential
|
||||
|
||||
credential_type : SkyvernForgeSdkSchemasCredentialsCredentialType
|
||||
Type of credential to create
|
||||
|
||||
credential : CreateCredentialRequestCredential
|
||||
The credential data to store
|
||||
|
||||
request_options : typing.Optional[RequestOptions]
|
||||
Request-specific configuration.
|
||||
|
||||
Returns
|
||||
-------
|
||||
AsyncHttpResponse[CredentialResponse]
|
||||
Successful Response
|
||||
"""
|
||||
_response = await self._client_wrapper.httpx_client.request(
|
||||
f"v1/credentials/{jsonable_encoder(credential_id)}/update",
|
||||
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:
|
||||
_data = typing.cast(
|
||||
CredentialResponse,
|
||||
parse_obj_as(
|
||||
type_=CredentialResponse, # 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 delete_credential(
|
||||
self, credential_id: str, *, request_options: typing.Optional[RequestOptions] = None
|
||||
) -> AsyncHttpResponse[None]:
|
||||
|
||||
Reference in New Issue
Block a user