Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
60 changes: 60 additions & 0 deletions openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -2552,6 +2552,47 @@
}
}
},
"/api/v2/webhooks/events": {
"get": {
"tags": [
"Webhooks"
],
"summary": "List Webhook Events",
"description": "List concrete webhook event types clients can subscribe to.",
"operationId": "list_webhook_events_api_v2_webhooks_events_get",
"responses": {
"200": {
"description": "Successful Response",
"content": {
"application/json": {
"schema": {
"items": {
"$ref": "#/components/schemas/WebhookEventTypeDefinition"
},
"type": "array",
"title": "Response List Webhook Events Api V2 Webhooks Events Get"
}
}
}
},
"422": {
"description": "Validation Error",
"content": {
"application/json": {
"schema": {
"$ref": "#/components/schemas/HTTPValidationError"
}
}
}
}
},
"security": [
{
"HTTPBearer": []
}
]
}
},
"/api/v2/webhooks/{webhook_id}": {
"get": {
"tags": [
Expand Down Expand Up @@ -6422,6 +6463,25 @@
"title": "VaultUpdateRequest",
"description": "Partial update; only provided fields are forwarded. Token rotation is separate."
},
"WebhookEventTypeDefinition": {
"properties": {
"type": {
"type": "string",
"title": "Type"
},
"description": {
"type": "string",
"title": "Description"
}
},
"type": "object",
"required": [
"type",
"description"
],
"title": "WebhookEventTypeDefinition",
"description": "A webhook event type clients can subscribe to."
},
"WebhookRecord": {
"properties": {
"id": {
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ build-backend = "hatchling.build"

[project]
name = "hai-agents"
version = "1.0.3"
version = "1.0.4"
description = "Python SDK for H Company's Computer-Use Agents: autonomous agents powered by Holo."
requires-python = ">=3.10"
readme = "README.md"
Expand Down
3 changes: 3 additions & 0 deletions src/hai_agents/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,7 @@
VaultConfigList,
VaultConfigRead,
VaultHealth,
WebhookEventTypeDefinition,
WebhookRecord,
WebhookWithSecret,
)
Expand Down Expand Up @@ -325,6 +326,7 @@
"VaultHealth": ".types",
"WebhookEvent": ".webhook_verification",
"WebhookEventData": ".webhook_verification",
"WebhookEventTypeDefinition": ".types",
"WebhookRecord": ".types",
"WebhookVerificationError": ".webhook_verification",
"WebhookWithSecret": ".types",
Expand Down Expand Up @@ -523,6 +525,7 @@ def __dir__():
"VaultHealth",
"WebhookEvent",
"WebhookEventData",
"WebhookEventTypeDefinition",
"WebhookRecord",
"WebhookVerificationError",
"WebhookWithSecret",
Expand Down
4 changes: 2 additions & 2 deletions src/hai_agents/core/client_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@ def get_headers(self) -> typing.Dict[str, str]:
import platform

headers: typing.Dict[str, str] = {
"User-Agent": "hai_agents/1.0.3",
"User-Agent": "hai_agents/1.0.4",
"X-HCompany-Client-Name": "hai_agents",
"X-HCompany-Client-Version": "1.0.3",
"X-HCompany-Client-Version": "1.0.4",
"X-HCompany-Client-Type": "sdk",
"X-HCompany-Language": "Python",
"X-HCompany-Runtime": f"python/{platform.python_version()}",
Expand Down
3 changes: 3 additions & 0 deletions src/hai_agents/types/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@
from .vault_config_list import VaultConfigList
from .vault_config_read import VaultConfigRead
from .vault_health import VaultHealth
from .webhook_event_type_definition import WebhookEventTypeDefinition
from .webhook_record import WebhookRecord
from .webhook_with_secret import WebhookWithSecret
_dynamic_imports: typing.Dict[str, str] = {
Expand Down Expand Up @@ -245,6 +246,7 @@
"VaultConfigList": ".vault_config_list",
"VaultConfigRead": ".vault_config_read",
"VaultHealth": ".vault_health",
"WebhookEventTypeDefinition": ".webhook_event_type_definition",
"WebhookRecord": ".webhook_record",
"WebhookWithSecret": ".webhook_with_secret",
}
Expand Down Expand Up @@ -388,6 +390,7 @@ def __dir__():
"VaultConfigList",
"VaultConfigRead",
"VaultHealth",
"WebhookEventTypeDefinition",
"WebhookRecord",
"WebhookWithSecret",
]
24 changes: 24 additions & 0 deletions src/hai_agents/types/webhook_event_type_definition.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# This file was auto-generated by Fern from our API Definition.

import typing

import pydantic
from ..core.pydantic_utilities import IS_PYDANTIC_V2, UniversalBaseModel


class WebhookEventTypeDefinition(UniversalBaseModel):
"""
A webhook event type clients can subscribe to.
"""

type: str
description: str

if IS_PYDANTIC_V2:
model_config: typing.ClassVar[pydantic.ConfigDict] = pydantic.ConfigDict(extra="allow", frozen=True) # type: ignore # Pydantic v2
else:

class Config:
frozen = True
smart_union = True
extra = pydantic.Extra.allow
65 changes: 65 additions & 0 deletions src/hai_agents/webhooks/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
from ..core.request_options import RequestOptions
from ..types.page_webhook_record import PageWebhookRecord
from ..types.webhook_event_type_definition import WebhookEventTypeDefinition
from ..types.webhook_record import WebhookRecord
from ..types.webhook_with_secret import WebhookWithSecret
from .raw_client import AsyncRawWebhooksClient, RawWebhooksClient
Expand Down Expand Up @@ -115,6 +116,34 @@ def create_webhook(
)
return _response.data

def list_webhook_events(
self, *, request_options: typing.Optional[RequestOptions] = None
) -> typing.List[WebhookEventTypeDefinition]:
"""
List concrete webhook event types clients can subscribe to.
Parameters
----------
request_options : typing.Optional[RequestOptions]
Request-specific configuration.
Returns
-------
typing.List[WebhookEventTypeDefinition]
Successful Response
Examples
--------
from hai_agents import Client
client = Client(
api_key="YOUR_API_KEY",
)
client.webhooks.list_webhook_events()
"""
_response = self._raw_client.list_webhook_events(request_options=request_options)
return _response.data

def get_webhook(self, webhook_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> WebhookRecord:
"""
Fetch a webhook by id.
Expand Down Expand Up @@ -348,6 +377,42 @@ async def main() -> None:
)
return _response.data

async def list_webhook_events(
self, *, request_options: typing.Optional[RequestOptions] = None
) -> typing.List[WebhookEventTypeDefinition]:
"""
List concrete webhook event types clients can subscribe to.
Parameters
----------
request_options : typing.Optional[RequestOptions]
Request-specific configuration.
Returns
-------
typing.List[WebhookEventTypeDefinition]
Successful Response
Examples
--------
import asyncio
from hai_agents import AsyncClient
client = AsyncClient(
api_key="YOUR_API_KEY",
)
async def main() -> None:
await client.webhooks.list_webhook_events()
asyncio.run(main())
"""
_response = await self._raw_client.list_webhook_events(request_options=request_options)
return _response.data

async def get_webhook(
self, webhook_id: str, *, request_options: typing.Optional[RequestOptions] = None
) -> WebhookRecord:
Expand Down
103 changes: 103 additions & 0 deletions src/hai_agents/webhooks/raw_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
from ..errors.unprocessable_entity_error import UnprocessableEntityError
from ..types.http_validation_error import HttpValidationError
from ..types.page_webhook_record import PageWebhookRecord
from ..types.webhook_event_type_definition import WebhookEventTypeDefinition
from ..types.webhook_record import WebhookRecord
from ..types.webhook_with_secret import WebhookWithSecret
from .types.list_webhooks_request_sort_item import ListWebhooksRequestSortItem
Expand Down Expand Up @@ -168,6 +169,57 @@ def create_webhook(
)
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)

def list_webhook_events(
self, *, request_options: typing.Optional[RequestOptions] = None
) -> HttpResponse[typing.List[WebhookEventTypeDefinition]]:
"""
List concrete webhook event types clients can subscribe to.
Parameters
----------
request_options : typing.Optional[RequestOptions]
Request-specific configuration.
Returns
-------
HttpResponse[typing.List[WebhookEventTypeDefinition]]
Successful Response
"""
_response = self._client_wrapper.httpx_client.request(
"api/v2/webhooks/events",
method="GET",
request_options=request_options,
)
try:
if 200 <= _response.status_code < 300:
_data = typing.cast(
typing.List[WebhookEventTypeDefinition],
parse_obj_as(
type_=typing.List[WebhookEventTypeDefinition], # 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(
HttpValidationError,
parse_obj_as(
type_=HttpValidationError, # 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)
except ValidationError as e:
raise ParsingError(
status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
)
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)

def get_webhook(
self, webhook_id: str, *, request_options: typing.Optional[RequestOptions] = None
) -> HttpResponse[WebhookRecord]:
Expand Down Expand Up @@ -491,6 +543,57 @@ async def create_webhook(
)
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)

async def list_webhook_events(
self, *, request_options: typing.Optional[RequestOptions] = None
) -> AsyncHttpResponse[typing.List[WebhookEventTypeDefinition]]:
"""
List concrete webhook event types clients can subscribe to.
Parameters
----------
request_options : typing.Optional[RequestOptions]
Request-specific configuration.
Returns
-------
AsyncHttpResponse[typing.List[WebhookEventTypeDefinition]]
Successful Response
"""
_response = await self._client_wrapper.httpx_client.request(
"api/v2/webhooks/events",
method="GET",
request_options=request_options,
)
try:
if 200 <= _response.status_code < 300:
_data = typing.cast(
typing.List[WebhookEventTypeDefinition],
parse_obj_as(
type_=typing.List[WebhookEventTypeDefinition], # 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(
HttpValidationError,
parse_obj_as(
type_=HttpValidationError, # 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)
except ValidationError as e:
raise ParsingError(
status_code=_response.status_code, headers=dict(_response.headers), body=_response.json(), cause=e
)
raise ApiError(status_code=_response.status_code, headers=dict(_response.headers), body=_response_json)

async def get_webhook(
self, webhook_id: str, *, request_options: typing.Optional[RequestOptions] = None
) -> AsyncHttpResponse[WebhookRecord]:
Expand Down
2 changes: 1 addition & 1 deletion uv.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.