diff --git a/.roe-main-release-version b/.roe-main-release-version index c235ea0..8465440 100644 --- a/.roe-main-release-version +++ b/.roe-main-release-version @@ -1 +1 @@ -1-0-91 +1-0-93 diff --git a/README.md b/README.md index 18c70aa..d1fca6f 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ A Python SDK for the [Roe](https://www.roe-ai.com/) API. -> **v1.1.7** - SDK operation coverage is synchronized across Python, +> **v1.1.8** - SDK operation coverage is synchronized across Python, > TypeScript, and Go. See `SDK_EXAMPLES.md` for copy-ready examples and > use cases. diff --git a/SDK_EXAMPLES.md b/SDK_EXAMPLES.md index fe4b6b0..15f7320 100644 --- a/SDK_EXAMPLES.md +++ b/SDK_EXAMPLES.md @@ -143,6 +143,20 @@ result = client.agents.jobs.delete_data( ) ``` +#### `agents_jobs_webhook_resend_create` + +Resend agent job webhook + +```python +from roe import RoeClient + +client = RoeClient() + +result = client.agents.jobs.resend_webhook( + job_id="job_id", # required +) +``` + #### `agents_jobs_status_retrieve` Get agent job status. diff --git a/openapi/openapi.yml b/openapi/openapi.yml index 513c00e..6e8ec47 100644 --- a/openapi/openapi.yml +++ b/openapi/openapi.yml @@ -1551,6 +1551,58 @@ paths: schema: $ref: '#/components/schemas/ErrorDetailResponse' description: Agent job not found + /v1/agents/jobs/{job_id}/webhook/resend/: + post: + operationId: agents_jobs_webhook_resend_create + description: Re-send the completion webhook for a job. Useful for replaying + a callback during integration work. Sends to every active webhook on the agent, + or to one of them when `webhook_id` is given. The job is not re-run and its + status is unchanged. + summary: Resend agent job webhook + parameters: + - in: path + name: job_id + schema: + type: string + format: uuid + required: true + - name: organization_id + in: query + required: false + schema: + type: string + format: uuid + description: Organization ID. This is required for access control. It can + be provided via query or request body depending on the endpoint. + tags: + - agents + - sdk + requestBody: + content: + application/json: + schema: + $ref: '#/components/schemas/ResendAgentJobWebhookRequest' + security: + - apiKeyAuth: [] + responses: + '200': + content: + application/json: + schema: + $ref: '#/components/schemas/AgentJobWebhookResendResponse' + description: '' + '400': + content: + application/json: + schema: + $ref: '#/components/schemas/ApiErrorResponse' + description: Job has not reached a terminal status + '404': + content: + application/json: + schema: + $ref: '#/components/schemas/ErrorDetailResponse' + description: Job not found /v1/agents/jobs/results/: post: operationId: agents_jobs_results_create @@ -4489,6 +4541,18 @@ components: minItems: 1 required: - job_ids + AgentJobWebhookResendResponse: + type: object + properties: + status: + type: string + queued: + type: integer + description: How many deliveries were queued. 0 means the agent has no active + webhook subscription, which is the usual reason a callback never arrives. + required: + - queued + - status AgentRunAsyncManyRequest: type: object description: Serializer for agent async many execution requests. @@ -5957,6 +6021,17 @@ components: * `core` - core * `watch` - watch * `edge` - edge + ResendAgentJobWebhookRequest: + type: object + description: Serializer for re-sending a job's completion webhook. + properties: + webhook_id: + type: + - string + - 'null' + format: uuid + description: Send to only this webhook. Omit to send to every active webhook + on the agent. ResolveRequest: type: object description: |- diff --git a/openapi/wrappers.yml b/openapi/wrappers.yml index 5247129..f6c1aa6 100644 --- a/openapi/wrappers.yml +++ b/openapi/wrappers.yml @@ -594,6 +594,17 @@ apis: location: path annotation: str coerce: uuid + - kind: body + method_name: resend_webhook + docstring: '' + method: POST + path: /v1/agents/jobs/{job_id}/webhook/resend/ + endpoint_module: roe._generated.api.agents.agents_jobs_webhook_resend_create + parameters: + - name: job_id + location: path + annotation: str + coerce: uuid - kind: body method_name: cancel_all docstring: '' diff --git a/pyproject.toml b/pyproject.toml index 39f4c1b..bd34ab2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "roe-ai" -version = "1.1.7" +version = "1.1.8" authors = [ { name = "Roe", email = "founders@roe-ai.com" }, ] diff --git a/src/roe/_generated/api/agents/agents_jobs_webhook_resend_create.py b/src/roe/_generated/api/agents/agents_jobs_webhook_resend_create.py new file mode 100644 index 0000000..585feb0 --- /dev/null +++ b/src/roe/_generated/api/agents/agents_jobs_webhook_resend_create.py @@ -0,0 +1,255 @@ +from http import HTTPStatus +from typing import Any, cast +from urllib.parse import quote + +import httpx + +from ...client import AuthenticatedClient, Client +from ...types import Response, UNSET +from ... import errors + +from ...models.agent_job_webhook_resend_response import AgentJobWebhookResendResponse +from ...models.api_error_response import ApiErrorResponse +from ...models.error_detail_response import ErrorDetailResponse +from ...models.resend_agent_job_webhook_request import ResendAgentJobWebhookRequest +from ...types import UNSET, Unset +from typing import cast +from uuid import UUID + + + +def _get_kwargs( + job_id: UUID, + *, + body: ResendAgentJobWebhookRequest | Unset = UNSET, + organization_id: UUID | Unset = UNSET, + +) -> dict[str, Any]: + headers: dict[str, Any] = {} + + + + + params: dict[str, Any] = {} + + json_organization_id: str | Unset = UNSET + if not isinstance(organization_id, Unset): + json_organization_id = str(organization_id) + params["organization_id"] = json_organization_id + + + params = {k: v for k, v in params.items() if v is not UNSET and v is not None} + + + _kwargs: dict[str, Any] = { + "method": "post", + "url": "/v1/agents/jobs/{job_id}/webhook/resend/".format(job_id=quote(str(job_id), safe=""),), + "params": params, + } + + + if not isinstance(body, Unset): + _kwargs["json"] = body.to_dict() + + + headers["Content-Type"] = "application/json" + + _kwargs["headers"] = headers + return _kwargs + + + +def _parse_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> AgentJobWebhookResendResponse | ApiErrorResponse | ErrorDetailResponse | None: + if response.status_code == 200: + response_200 = AgentJobWebhookResendResponse.from_dict(response.json()) + + + + return response_200 + + if response.status_code == 400: + response_400 = ApiErrorResponse.from_dict(response.json()) + + + + return response_400 + + if response.status_code == 404: + response_404 = ErrorDetailResponse.from_dict(response.json()) + + + + return response_404 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response(*, client: AuthenticatedClient | Client, response: httpx.Response) -> Response[AgentJobWebhookResendResponse | ApiErrorResponse | ErrorDetailResponse]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + job_id: UUID, + *, + client: AuthenticatedClient, + body: ResendAgentJobWebhookRequest | Unset = UNSET, + organization_id: UUID | Unset = UNSET, + +) -> Response[AgentJobWebhookResendResponse | ApiErrorResponse | ErrorDetailResponse]: + """ Resend agent job webhook + + Re-send the completion webhook for a job. Useful for replaying a callback during integration work. + Sends to every active webhook on the agent, or to one of them when `webhook_id` is given. The job is + not re-run and its status is unchanged. + + Args: + job_id (UUID): + organization_id (UUID | Unset): + body (ResendAgentJobWebhookRequest | Unset): Serializer for re-sending a job's completion + webhook. + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[AgentJobWebhookResendResponse | ApiErrorResponse | ErrorDetailResponse] + """ + + + kwargs = _get_kwargs( + job_id=job_id, +body=body, +organization_id=organization_id, + + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + +def sync( + job_id: UUID, + *, + client: AuthenticatedClient, + body: ResendAgentJobWebhookRequest | Unset = UNSET, + organization_id: UUID | Unset = UNSET, + +) -> AgentJobWebhookResendResponse | ApiErrorResponse | ErrorDetailResponse | None: + """ Resend agent job webhook + + Re-send the completion webhook for a job. Useful for replaying a callback during integration work. + Sends to every active webhook on the agent, or to one of them when `webhook_id` is given. The job is + not re-run and its status is unchanged. + + Args: + job_id (UUID): + organization_id (UUID | Unset): + body (ResendAgentJobWebhookRequest | Unset): Serializer for re-sending a job's completion + webhook. + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + AgentJobWebhookResendResponse | ApiErrorResponse | ErrorDetailResponse + """ + + + return sync_detailed( + job_id=job_id, +client=client, +body=body, +organization_id=organization_id, + + ).parsed + +async def asyncio_detailed( + job_id: UUID, + *, + client: AuthenticatedClient, + body: ResendAgentJobWebhookRequest | Unset = UNSET, + organization_id: UUID | Unset = UNSET, + +) -> Response[AgentJobWebhookResendResponse | ApiErrorResponse | ErrorDetailResponse]: + """ Resend agent job webhook + + Re-send the completion webhook for a job. Useful for replaying a callback during integration work. + Sends to every active webhook on the agent, or to one of them when `webhook_id` is given. The job is + not re-run and its status is unchanged. + + Args: + job_id (UUID): + organization_id (UUID | Unset): + body (ResendAgentJobWebhookRequest | Unset): Serializer for re-sending a job's completion + webhook. + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[AgentJobWebhookResendResponse | ApiErrorResponse | ErrorDetailResponse] + """ + + + kwargs = _get_kwargs( + job_id=job_id, +body=body, +organization_id=organization_id, + + ) + + response = await client.get_async_httpx_client().request( + **kwargs + ) + + return _build_response(client=client, response=response) + +async def asyncio( + job_id: UUID, + *, + client: AuthenticatedClient, + body: ResendAgentJobWebhookRequest | Unset = UNSET, + organization_id: UUID | Unset = UNSET, + +) -> AgentJobWebhookResendResponse | ApiErrorResponse | ErrorDetailResponse | None: + """ Resend agent job webhook + + Re-send the completion webhook for a job. Useful for replaying a callback during integration work. + Sends to every active webhook on the agent, or to one of them when `webhook_id` is given. The job is + not re-run and its status is unchanged. + + Args: + job_id (UUID): + organization_id (UUID | Unset): + body (ResendAgentJobWebhookRequest | Unset): Serializer for re-sending a job's completion + webhook. + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + AgentJobWebhookResendResponse | ApiErrorResponse | ErrorDetailResponse + """ + + + return (await asyncio_detailed( + job_id=job_id, +client=client, +body=body, +organization_id=organization_id, + + )).parsed diff --git a/src/roe/_generated/models/__init__.py b/src/roe/_generated/models/__init__.py index 35179ee..11cc6ba 100644 --- a/src/roe/_generated/models/__init__.py +++ b/src/roe/_generated/models/__init__.py @@ -17,6 +17,7 @@ from .agent_job_single_status import AgentJobSingleStatus from .agent_job_status import AgentJobStatus from .agent_job_status_many_request import AgentJobStatusManyRequest +from .agent_job_webhook_resend_response import AgentJobWebhookResendResponse from .agent_run_async_many_request import AgentRunAsyncManyRequest from .agent_tag import AgentTag from .agent_version import AgentVersion @@ -122,6 +123,7 @@ from .qdrant_cleanup_error_response import QdrantCleanupErrorResponse from .regenerate_request import RegenerateRequest from .relevance_enum import RelevanceEnum +from .resend_agent_job_webhook_request import ResendAgentJobWebhookRequest from .resolve_request import ResolveRequest from .resolve_request_refs_item import ResolveRequestRefsItem from .review_status_enum import ReviewStatusEnum @@ -179,6 +181,7 @@ "AgentJobSingleStatus", "AgentJobStatus", "AgentJobStatusManyRequest", + "AgentJobWebhookResendResponse", "AgentRunAsyncManyRequest", "AgentsCreateResponse400", "AgentsJobsListOrderingItem", @@ -284,6 +287,7 @@ "QdrantCleanupErrorResponse", "RegenerateRequest", "RelevanceEnum", + "ResendAgentJobWebhookRequest", "ResolveRequest", "ResolveRequestRefsItem", "ReviewStatusEnum", diff --git a/src/roe/_generated/models/agent_job_webhook_resend_response.py b/src/roe/_generated/models/agent_job_webhook_resend_response.py new file mode 100644 index 0000000..bdd3519 --- /dev/null +++ b/src/roe/_generated/models/agent_job_webhook_resend_response.py @@ -0,0 +1,85 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import Any, TypeVar, BinaryIO, TextIO, TYPE_CHECKING, Generator + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +from ..types import UNSET, Unset + + + + + + + +T = TypeVar("T", bound="AgentJobWebhookResendResponse") + + + +@_attrs_define +class AgentJobWebhookResendResponse: + """ + Attributes: + status (str): + queued (int): How many deliveries were queued. 0 means the agent has no active webhook subscription, which is + the usual reason a callback never arrives. + """ + + status: str + queued: int + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + + + + + def to_dict(self) -> dict[str, Any]: + status = self.status + + queued = self.queued + + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update({ + "status": status, + "queued": queued, + }) + + return field_dict + + + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) + status = d.pop("status") + + queued = d.pop("queued") + + agent_job_webhook_resend_response = cls( + status=status, + queued=queued, + ) + + + agent_job_webhook_resend_response.additional_properties = d + return agent_job_webhook_resend_response + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/src/roe/_generated/models/resend_agent_job_webhook_request.py b/src/roe/_generated/models/resend_agent_job_webhook_request.py new file mode 100644 index 0000000..4585312 --- /dev/null +++ b/src/roe/_generated/models/resend_agent_job_webhook_request.py @@ -0,0 +1,105 @@ +from __future__ import annotations + +from collections.abc import Mapping +from typing import Any, TypeVar, BinaryIO, TextIO, TYPE_CHECKING, Generator + +from attrs import define as _attrs_define +from attrs import field as _attrs_field + +from ..types import UNSET, Unset + +from ..types import UNSET, Unset +from typing import cast +from uuid import UUID + + + + + + +T = TypeVar("T", bound="ResendAgentJobWebhookRequest") + + + +@_attrs_define +class ResendAgentJobWebhookRequest: + """ Serializer for re-sending a job's completion webhook. + + Attributes: + webhook_id (None | Unset | UUID): Send to only this webhook. Omit to send to every active webhook on the agent. + """ + + webhook_id: None | Unset | UUID = UNSET + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + + + + + def to_dict(self) -> dict[str, Any]: + webhook_id: None | str | Unset + if isinstance(self.webhook_id, Unset): + webhook_id = UNSET + elif isinstance(self.webhook_id, UUID): + webhook_id = str(self.webhook_id) + else: + webhook_id = self.webhook_id + + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update({ + }) + if webhook_id is not UNSET: + field_dict["webhook_id"] = webhook_id + + return field_dict + + + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) + def _parse_webhook_id(data: object) -> None | Unset | UUID: + if data is None: + return data + if isinstance(data, Unset): + return data + try: + if not isinstance(data, str): + raise TypeError() + webhook_id_type_0 = UUID(data) + + + + return webhook_id_type_0 + except (TypeError, ValueError, AttributeError, KeyError): + pass + return cast(None | Unset | UUID, data) + + webhook_id = _parse_webhook_id(d.pop("webhook_id", UNSET)) + + + resend_agent_job_webhook_request = cls( + webhook_id=webhook_id, + ) + + + resend_agent_job_webhook_request.additional_properties = d + return resend_agent_job_webhook_request + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/uv.lock b/uv.lock index 646927a..5548057 100644 --- a/uv.lock +++ b/uv.lock @@ -454,7 +454,7 @@ wheels = [ [[package]] name = "roe-ai" -version = "1.1.7" +version = "1.1.8" source = { editable = "." } dependencies = [ { name = "attrs" },