Add support for custom URLs in the retry webhook API (#4329)

This commit is contained in:
Marc Kelechava
2025-12-18 10:38:51 -08:00
committed by GitHub
parent c61bd26c8c
commit 8ebe0f2bfb
6 changed files with 86 additions and 13 deletions

View File

@@ -790,7 +790,11 @@ class Skyvern:
return _response.data
def retry_run_webhook(
self, run_id: str, *, request_options: typing.Optional[RequestOptions] = None
self,
run_id: str,
*,
webhook_url: typing.Optional[str] = None,
request_options: typing.Optional[RequestOptions] = None,
) -> typing.Optional[typing.Any]:
"""
Retry sending the webhook for a run
@@ -819,7 +823,7 @@ class Skyvern:
run_id="tsk_123",
)
"""
_response = self._raw_client.retry_run_webhook(run_id, request_options=request_options)
_response = self._raw_client.retry_run_webhook(run_id, webhook_url=webhook_url, request_options=request_options)
return _response.data
def get_run_timeline(
@@ -2701,7 +2705,11 @@ class AsyncSkyvern:
return _response.data
async def retry_run_webhook(
self, run_id: str, *, request_options: typing.Optional[RequestOptions] = None
self,
run_id: str,
*,
webhook_url: typing.Optional[str] = None,
request_options: typing.Optional[RequestOptions] = None,
) -> typing.Optional[typing.Any]:
"""
Retry sending the webhook for a run
@@ -2738,7 +2746,9 @@ class AsyncSkyvern:
asyncio.run(main())
"""
_response = await self._raw_client.retry_run_webhook(run_id, request_options=request_options)
_response = await self._raw_client.retry_run_webhook(
run_id, webhook_url=webhook_url, request_options=request_options
)
return _response.data
async def get_run_timeline(

View File

@@ -957,7 +957,11 @@ class RawSkyvern:
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
def retry_run_webhook(
self, run_id: str, *, request_options: typing.Optional[RequestOptions] = None
self,
run_id: str,
*,
webhook_url: typing.Optional[str] = None,
request_options: typing.Optional[RequestOptions] = None,
) -> HttpResponse[typing.Optional[typing.Any]]:
"""
Retry sending the webhook for a run
@@ -975,10 +979,18 @@ class RawSkyvern:
HttpResponse[typing.Optional[typing.Any]]
Successful Response
"""
request_kwargs: dict[str, typing.Any] = {}
if webhook_url is not None:
request_kwargs = {
"json": {"webhook_url": webhook_url},
"headers": {"content-type": "application/json"},
"omit": OMIT,
}
_response = self._client_wrapper.httpx_client.request(
f"v1/runs/{jsonable_encoder(run_id)}/retry_webhook",
method="POST",
request_options=request_options,
**request_kwargs,
)
try:
if _response is None or not _response.text.strip():
@@ -3477,7 +3489,11 @@ class AsyncRawSkyvern:
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)
async def retry_run_webhook(
self, run_id: str, *, request_options: typing.Optional[RequestOptions] = None
self,
run_id: str,
*,
webhook_url: typing.Optional[str] = None,
request_options: typing.Optional[RequestOptions] = None,
) -> AsyncHttpResponse[typing.Optional[typing.Any]]:
"""
Retry sending the webhook for a run
@@ -3495,10 +3511,18 @@ class AsyncRawSkyvern:
AsyncHttpResponse[typing.Optional[typing.Any]]
Successful Response
"""
request_kwargs: dict[str, typing.Any] = {}
if webhook_url is not None:
request_kwargs = {
"json": {"webhook_url": webhook_url},
"headers": {"content-type": "application/json"},
"omit": OMIT,
}
_response = await self._client_wrapper.httpx_client.request(
f"v1/runs/{jsonable_encoder(run_id)}/retry_webhook",
method="POST",
request_options=request_options,
**request_kwargs,
)
try:
if _response is None or not _response.text.strip():