Feat: Events Frontend, Redux (#1859)

* feat: add params to events api

* feat: add more filters to event query

* fix: count query

* feat: start wiring up events queries

* feat: overwrites for queries

* feat: query for event keys

* feat: wire up event key api

* feat: wire up two queries on fe

* feat: fix more wiring

* feat: display event data

* fix: styling

* feat: sidebar

* fix: types + default viz

* feat: scope filter

* feat: index

* fix: queries

* fix: queries, deduping, popover

* fix: lint

* feat: add filter id col to the event to run table

* feat: add filter id to copy

* feat: wire filter through to the db

* feat: send back triggered run ids over the api

* fix: query

* feat: json obj for triggered runs on the event

* fix: cast trick to rm overwrite

* fix: migration

* fix: rm search

* fix: don't show counts on runs modal

* fix: key

* chore: gen ts

* chore: python

* fix: changelog
This commit is contained in:
Matt Kaye
2025-06-13 14:16:08 -04:00
committed by GitHub
parent a73e34cd92
commit 4348dc99e5
39 changed files with 2093 additions and 529 deletions

View File

@@ -5,6 +5,12 @@ All notable changes to Hatchet's Python SDK will be documented in this changelog
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
## [1.12.1] - 2025-06-13
### Added
- Adds corresponding SDK changes from API changes to events (additional parameters to filter events by, additional data returned)
## [1.12.0] - 2025-06-06
### Added

View File

@@ -10,8 +10,12 @@ from hatchet_sdk.clients.rest.api.event_api import EventApi
from hatchet_sdk.clients.rest.api.workflow_runs_api import WorkflowRunsApi
from hatchet_sdk.clients.rest.api_client import ApiClient
from hatchet_sdk.clients.rest.models.v1_event_list import V1EventList
from hatchet_sdk.clients.rest.models.v1_task_status import V1TaskStatus
from hatchet_sdk.clients.rest.tenacity_utils import tenacity_retry
from hatchet_sdk.clients.v1.api_client import BaseRestClient
from hatchet_sdk.clients.v1.api_client import (
BaseRestClient,
maybe_additional_metadata_to_kv,
)
from hatchet_sdk.config import ClientConfig
from hatchet_sdk.connection import new_conn
from hatchet_sdk.contracts.events_pb2 import (
@@ -211,9 +215,24 @@ class EventClient(BaseRestClient):
keys: list[str] | None = None,
since: datetime.datetime | None = None,
until: datetime.datetime | None = None,
workflow_ids: list[str] | None = None,
workflow_run_statuses: list[V1TaskStatus] | None = None,
event_ids: list[str] | None = None,
additional_metadata: JSONSerializableMapping | None = None,
scopes: list[str] | None = None,
) -> V1EventList:
return await asyncio.to_thread(
self.list, offset=offset, limit=limit, keys=keys, since=since, until=until
self.list,
offset=offset,
limit=limit,
keys=keys,
since=since,
until=until,
workflow_ids=workflow_ids,
workflow_run_statuses=workflow_run_statuses,
event_ids=event_ids,
additional_metadata=additional_metadata,
scopes=scopes,
)
def list(
@@ -223,6 +242,11 @@ class EventClient(BaseRestClient):
keys: list[str] | None = None,
since: datetime.datetime | None = None,
until: datetime.datetime | None = None,
workflow_ids: list[str] | None = None,
workflow_run_statuses: list[V1TaskStatus] | None = None,
event_ids: list[str] | None = None,
additional_metadata: JSONSerializableMapping | None = None,
scopes: list[str] | None = None,
) -> V1EventList:
with self.client() as client:
return self._ea(client).v1_event_list(
@@ -232,4 +256,11 @@ class EventClient(BaseRestClient):
keys=keys,
since=since,
until=until,
workflow_ids=workflow_ids,
workflow_run_statuses=workflow_run_statuses,
event_ids=event_ids,
additional_metadata=maybe_additional_metadata_to_kv(
additional_metadata
),
scopes=scopes,
)

View File

@@ -237,6 +237,7 @@ from hatchet_sdk.clients.rest.models.v1_create_filter_request import (
from hatchet_sdk.clients.rest.models.v1_dag_children import V1DagChildren
from hatchet_sdk.clients.rest.models.v1_event import V1Event
from hatchet_sdk.clients.rest.models.v1_event_list import V1EventList
from hatchet_sdk.clients.rest.models.v1_event_triggered_run import V1EventTriggeredRun
from hatchet_sdk.clients.rest.models.v1_event_workflow_run_summary import (
V1EventWorkflowRunSummary,
)

View File

@@ -39,6 +39,7 @@ from hatchet_sdk.clients.rest.models.event_update_cancel200_response import (
from hatchet_sdk.clients.rest.models.events import Events
from hatchet_sdk.clients.rest.models.replay_event_request import ReplayEventRequest
from hatchet_sdk.clients.rest.models.v1_event_list import V1EventList
from hatchet_sdk.clients.rest.models.v1_task_status import V1TaskStatus
from hatchet_sdk.clients.rest.models.workflow_run_status import WorkflowRunStatus
from hatchet_sdk.clients.rest.rest import RESTResponseType
@@ -2549,6 +2550,269 @@ class EventApi:
_request_auth=_request_auth,
)
@validate_call
def v1_event_key_list(
self,
tenant: Annotated[
str,
Field(
min_length=36, strict=True, max_length=36, description="The tenant id"
),
],
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[
Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]
],
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
_headers: Optional[Dict[StrictStr, Any]] = None,
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
) -> EventKeyList:
"""List event keys
Lists all event keys for a tenant.
:param tenant: The tenant id (required)
:type tenant: str
:param _request_timeout: timeout setting for this request. If one
number provided, it will be total request
timeout. It can also be a pair (tuple) of
(connection, read) timeouts.
:type _request_timeout: int, tuple(int, int), optional
:param _request_auth: set to override the auth_settings for an a single
request; this effectively ignores the
authentication in the spec for a single request.
:type _request_auth: dict, optional
:param _content_type: force content-type for the request.
:type _content_type: str, Optional
:param _headers: set to override the headers for a single
request; this effectively ignores the headers
in the spec for a single request.
:type _headers: dict, optional
:param _host_index: set to override the host_index for a single
request; this effectively ignores the host_index
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
_param = self._v1_event_key_list_serialize(
tenant=tenant,
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
_host_index=_host_index,
)
_response_types_map: Dict[str, Optional[str]] = {
"200": "EventKeyList",
"400": "APIErrors",
"403": "APIErrors",
}
response_data = self.api_client.call_api(
*_param, _request_timeout=_request_timeout
)
response_data.read()
return self.api_client.response_deserialize(
response_data=response_data,
response_types_map=_response_types_map,
).data
@validate_call
def v1_event_key_list_with_http_info(
self,
tenant: Annotated[
str,
Field(
min_length=36, strict=True, max_length=36, description="The tenant id"
),
],
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[
Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]
],
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
_headers: Optional[Dict[StrictStr, Any]] = None,
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
) -> ApiResponse[EventKeyList]:
"""List event keys
Lists all event keys for a tenant.
:param tenant: The tenant id (required)
:type tenant: str
:param _request_timeout: timeout setting for this request. If one
number provided, it will be total request
timeout. It can also be a pair (tuple) of
(connection, read) timeouts.
:type _request_timeout: int, tuple(int, int), optional
:param _request_auth: set to override the auth_settings for an a single
request; this effectively ignores the
authentication in the spec for a single request.
:type _request_auth: dict, optional
:param _content_type: force content-type for the request.
:type _content_type: str, Optional
:param _headers: set to override the headers for a single
request; this effectively ignores the headers
in the spec for a single request.
:type _headers: dict, optional
:param _host_index: set to override the host_index for a single
request; this effectively ignores the host_index
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
_param = self._v1_event_key_list_serialize(
tenant=tenant,
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
_host_index=_host_index,
)
_response_types_map: Dict[str, Optional[str]] = {
"200": "EventKeyList",
"400": "APIErrors",
"403": "APIErrors",
}
response_data = self.api_client.call_api(
*_param, _request_timeout=_request_timeout
)
response_data.read()
return self.api_client.response_deserialize(
response_data=response_data,
response_types_map=_response_types_map,
)
@validate_call
def v1_event_key_list_without_preload_content(
self,
tenant: Annotated[
str,
Field(
min_length=36, strict=True, max_length=36, description="The tenant id"
),
],
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
Tuple[
Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]
],
] = None,
_request_auth: Optional[Dict[StrictStr, Any]] = None,
_content_type: Optional[StrictStr] = None,
_headers: Optional[Dict[StrictStr, Any]] = None,
_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
) -> RESTResponseType:
"""List event keys
Lists all event keys for a tenant.
:param tenant: The tenant id (required)
:type tenant: str
:param _request_timeout: timeout setting for this request. If one
number provided, it will be total request
timeout. It can also be a pair (tuple) of
(connection, read) timeouts.
:type _request_timeout: int, tuple(int, int), optional
:param _request_auth: set to override the auth_settings for an a single
request; this effectively ignores the
authentication in the spec for a single request.
:type _request_auth: dict, optional
:param _content_type: force content-type for the request.
:type _content_type: str, Optional
:param _headers: set to override the headers for a single
request; this effectively ignores the headers
in the spec for a single request.
:type _headers: dict, optional
:param _host_index: set to override the host_index for a single
request; this effectively ignores the host_index
in the spec for a single request.
:type _host_index: int, optional
:return: Returns the result object.
""" # noqa: E501
_param = self._v1_event_key_list_serialize(
tenant=tenant,
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
_host_index=_host_index,
)
_response_types_map: Dict[str, Optional[str]] = {
"200": "EventKeyList",
"400": "APIErrors",
"403": "APIErrors",
}
response_data = self.api_client.call_api(
*_param, _request_timeout=_request_timeout
)
return response_data.response
def _v1_event_key_list_serialize(
self,
tenant,
_request_auth,
_content_type,
_headers,
_host_index,
) -> RequestSerialized:
_host = None
_collection_formats: Dict[str, str] = {}
_path_params: Dict[str, str] = {}
_query_params: List[Tuple[str, str]] = []
_header_params: Dict[str, Optional[str]] = _headers or {}
_form_params: List[Tuple[str, str]] = []
_files: Dict[
str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
] = {}
_body_params: Optional[bytes] = None
# process the path parameters
if tenant is not None:
_path_params["tenant"] = tenant
# process the query parameters
# process the header parameters
# process the form parameters
# process the body parameter
# set the HTTP header `Accept`
if "Accept" not in _header_params:
_header_params["Accept"] = self.api_client.select_header_accept(
["application/json"]
)
# authentication setting
_auth_settings: List[str] = ["cookieAuth", "bearerAuth"]
return self.api_client.param_serialize(
method="GET",
resource_path="/api/v1/stable/tenants/{tenant}/events/keys",
path_params=_path_params,
query_params=_query_params,
header_params=_header_params,
body=_body_params,
post_params=_form_params,
files=_files,
auth_settings=_auth_settings,
collection_formats=_collection_formats,
_host=_host,
_request_auth=_request_auth,
)
@validate_call
def v1_event_list(
self,
@@ -2575,6 +2839,34 @@ class EventApi:
Optional[datetime],
Field(description="Consider events that occurred before this time"),
] = None,
workflow_ids: Annotated[
Optional[
List[Annotated[str, Field(min_length=36, strict=True, max_length=36)]]
],
Field(
description="Filter to events that are associated with a specific workflow run"
),
] = None,
workflow_run_statuses: Annotated[
Optional[List[V1TaskStatus]],
Field(
description="Filter to events that are associated with workflow runs matching a certain status"
),
] = None,
event_ids: Annotated[
Optional[
List[Annotated[str, Field(min_length=36, strict=True, max_length=36)]]
],
Field(description="Filter to specific events by their ids"),
] = None,
additional_metadata: Annotated[
Optional[List[Annotated[str, Field(min_length=1, strict=True)]]],
Field(description="Filter by additional metadata on the events"),
] = None,
scopes: Annotated[
Optional[List[Annotated[str, Field(min_length=1, strict=True)]]],
Field(description="The scopes to filter by"),
] = None,
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
@@ -2603,6 +2895,16 @@ class EventApi:
:type since: datetime
:param until: Consider events that occurred before this time
:type until: datetime
:param workflow_ids: Filter to events that are associated with a specific workflow run
:type workflow_ids: List[str]
:param workflow_run_statuses: Filter to events that are associated with workflow runs matching a certain status
:type workflow_run_statuses: List[V1TaskStatus]
:param event_ids: Filter to specific events by their ids
:type event_ids: List[str]
:param additional_metadata: Filter by additional metadata on the events
:type additional_metadata: List[str]
:param scopes: The scopes to filter by
:type scopes: List[str]
:param _request_timeout: timeout setting for this request. If one
number provided, it will be total request
timeout. It can also be a pair (tuple) of
@@ -2632,6 +2934,11 @@ class EventApi:
keys=keys,
since=since,
until=until,
workflow_ids=workflow_ids,
workflow_run_statuses=workflow_run_statuses,
event_ids=event_ids,
additional_metadata=additional_metadata,
scopes=scopes,
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
@@ -2678,6 +2985,34 @@ class EventApi:
Optional[datetime],
Field(description="Consider events that occurred before this time"),
] = None,
workflow_ids: Annotated[
Optional[
List[Annotated[str, Field(min_length=36, strict=True, max_length=36)]]
],
Field(
description="Filter to events that are associated with a specific workflow run"
),
] = None,
workflow_run_statuses: Annotated[
Optional[List[V1TaskStatus]],
Field(
description="Filter to events that are associated with workflow runs matching a certain status"
),
] = None,
event_ids: Annotated[
Optional[
List[Annotated[str, Field(min_length=36, strict=True, max_length=36)]]
],
Field(description="Filter to specific events by their ids"),
] = None,
additional_metadata: Annotated[
Optional[List[Annotated[str, Field(min_length=1, strict=True)]]],
Field(description="Filter by additional metadata on the events"),
] = None,
scopes: Annotated[
Optional[List[Annotated[str, Field(min_length=1, strict=True)]]],
Field(description="The scopes to filter by"),
] = None,
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
@@ -2706,6 +3041,16 @@ class EventApi:
:type since: datetime
:param until: Consider events that occurred before this time
:type until: datetime
:param workflow_ids: Filter to events that are associated with a specific workflow run
:type workflow_ids: List[str]
:param workflow_run_statuses: Filter to events that are associated with workflow runs matching a certain status
:type workflow_run_statuses: List[V1TaskStatus]
:param event_ids: Filter to specific events by their ids
:type event_ids: List[str]
:param additional_metadata: Filter by additional metadata on the events
:type additional_metadata: List[str]
:param scopes: The scopes to filter by
:type scopes: List[str]
:param _request_timeout: timeout setting for this request. If one
number provided, it will be total request
timeout. It can also be a pair (tuple) of
@@ -2735,6 +3080,11 @@ class EventApi:
keys=keys,
since=since,
until=until,
workflow_ids=workflow_ids,
workflow_run_statuses=workflow_run_statuses,
event_ids=event_ids,
additional_metadata=additional_metadata,
scopes=scopes,
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
@@ -2781,6 +3131,34 @@ class EventApi:
Optional[datetime],
Field(description="Consider events that occurred before this time"),
] = None,
workflow_ids: Annotated[
Optional[
List[Annotated[str, Field(min_length=36, strict=True, max_length=36)]]
],
Field(
description="Filter to events that are associated with a specific workflow run"
),
] = None,
workflow_run_statuses: Annotated[
Optional[List[V1TaskStatus]],
Field(
description="Filter to events that are associated with workflow runs matching a certain status"
),
] = None,
event_ids: Annotated[
Optional[
List[Annotated[str, Field(min_length=36, strict=True, max_length=36)]]
],
Field(description="Filter to specific events by their ids"),
] = None,
additional_metadata: Annotated[
Optional[List[Annotated[str, Field(min_length=1, strict=True)]]],
Field(description="Filter by additional metadata on the events"),
] = None,
scopes: Annotated[
Optional[List[Annotated[str, Field(min_length=1, strict=True)]]],
Field(description="The scopes to filter by"),
] = None,
_request_timeout: Union[
None,
Annotated[StrictFloat, Field(gt=0)],
@@ -2809,6 +3187,16 @@ class EventApi:
:type since: datetime
:param until: Consider events that occurred before this time
:type until: datetime
:param workflow_ids: Filter to events that are associated with a specific workflow run
:type workflow_ids: List[str]
:param workflow_run_statuses: Filter to events that are associated with workflow runs matching a certain status
:type workflow_run_statuses: List[V1TaskStatus]
:param event_ids: Filter to specific events by their ids
:type event_ids: List[str]
:param additional_metadata: Filter by additional metadata on the events
:type additional_metadata: List[str]
:param scopes: The scopes to filter by
:type scopes: List[str]
:param _request_timeout: timeout setting for this request. If one
number provided, it will be total request
timeout. It can also be a pair (tuple) of
@@ -2838,6 +3226,11 @@ class EventApi:
keys=keys,
since=since,
until=until,
workflow_ids=workflow_ids,
workflow_run_statuses=workflow_run_statuses,
event_ids=event_ids,
additional_metadata=additional_metadata,
scopes=scopes,
_request_auth=_request_auth,
_content_type=_content_type,
_headers=_headers,
@@ -2862,6 +3255,11 @@ class EventApi:
keys,
since,
until,
workflow_ids,
workflow_run_statuses,
event_ids,
additional_metadata,
scopes,
_request_auth,
_content_type,
_headers,
@@ -2872,6 +3270,11 @@ class EventApi:
_collection_formats: Dict[str, str] = {
"keys": "multi",
"workflowIds": "multi",
"workflowRunStatuses": "multi",
"eventIds": "multi",
"additionalMetadata": "multi",
"scopes": "multi",
}
_path_params: Dict[str, str] = {}
@@ -2921,6 +3324,26 @@ class EventApi:
else:
_query_params.append(("until", until))
if workflow_ids is not None:
_query_params.append(("workflowIds", workflow_ids))
if workflow_run_statuses is not None:
_query_params.append(("workflowRunStatuses", workflow_run_statuses))
if event_ids is not None:
_query_params.append(("eventIds", event_ids))
if additional_metadata is not None:
_query_params.append(("additionalMetadata", additional_metadata))
if scopes is not None:
_query_params.append(("scopes", scopes))
# process the header parameters
# process the form parameters
# process the body parameter

View File

@@ -201,6 +201,7 @@ from hatchet_sdk.clients.rest.models.v1_create_filter_request import (
from hatchet_sdk.clients.rest.models.v1_dag_children import V1DagChildren
from hatchet_sdk.clients.rest.models.v1_event import V1Event
from hatchet_sdk.clients.rest.models.v1_event_list import V1EventList
from hatchet_sdk.clients.rest.models.v1_event_triggered_run import V1EventTriggeredRun
from hatchet_sdk.clients.rest.models.v1_event_workflow_run_summary import (
V1EventWorkflowRunSummary,
)

View File

@@ -23,6 +23,7 @@ from pydantic import BaseModel, ConfigDict, Field, StrictStr
from typing_extensions import Self
from hatchet_sdk.clients.rest.models.tenant_ui_version import TenantUIVersion
from hatchet_sdk.clients.rest.models.tenant_version import TenantVersion
class CreateTenantRequest(BaseModel):
@@ -37,7 +38,12 @@ class CreateTenantRequest(BaseModel):
description="The UI version of the tenant. Defaults to V0.",
alias="uiVersion",
)
__properties: ClassVar[List[str]] = ["name", "slug", "uiVersion"]
engine_version: Optional[TenantVersion] = Field(
default=None,
description="The engine version of the tenant. Defaults to V0.",
alias="engineVersion",
)
__properties: ClassVar[List[str]] = ["name", "slug", "uiVersion", "engineVersion"]
model_config = ConfigDict(
populate_by_name=True,
@@ -92,6 +98,7 @@ class CreateTenantRequest(BaseModel):
"name": obj.get("name"),
"slug": obj.get("slug"),
"uiVersion": obj.get("uiVersion"),
"engineVersion": obj.get("engineVersion"),
}
)
return _obj

View File

@@ -17,6 +17,7 @@ from __future__ import annotations
import json
import pprint
import re # noqa: F401
from datetime import datetime
from typing import Any, ClassVar, Dict, List, Optional, Set
from pydantic import BaseModel, ConfigDict, Field, StrictStr
@@ -24,6 +25,7 @@ from typing_extensions import Self
from hatchet_sdk.clients.rest.models.api_resource_meta import APIResourceMeta
from hatchet_sdk.clients.rest.models.tenant import Tenant
from hatchet_sdk.clients.rest.models.v1_event_triggered_run import V1EventTriggeredRun
from hatchet_sdk.clients.rest.models.v1_event_workflow_run_summary import (
V1EventWorkflowRunSummary,
)
@@ -51,6 +53,24 @@ class V1Event(BaseModel):
description="Additional metadata for the event.",
alias="additionalMetadata",
)
payload: Optional[Dict[str, Any]] = Field(
default=None,
description="The payload of the event, which can be any JSON-serializable object.",
)
scope: Optional[StrictStr] = Field(
default=None,
description="The scope of the event, which can be used to filter or categorize events.",
)
seen_at: Optional[datetime] = Field(
default=None,
description="The timestamp when the event was seen.",
alias="seenAt",
)
triggered_runs: Optional[List[V1EventTriggeredRun]] = Field(
default=None,
description="The external IDs of the runs that were triggered by this event.",
alias="triggeredRuns",
)
__properties: ClassVar[List[str]] = [
"metadata",
"key",
@@ -58,6 +78,10 @@ class V1Event(BaseModel):
"tenantId",
"workflowRunSummary",
"additionalMetadata",
"payload",
"scope",
"seenAt",
"triggeredRuns",
]
model_config = ConfigDict(
@@ -106,6 +130,13 @@ class V1Event(BaseModel):
# override the default output from pydantic by calling `to_dict()` of workflow_run_summary
if self.workflow_run_summary:
_dict["workflowRunSummary"] = self.workflow_run_summary.to_dict()
# override the default output from pydantic by calling `to_dict()` of each item in triggered_runs (list)
_items = []
if self.triggered_runs:
for _item_triggered_runs in self.triggered_runs:
if _item_triggered_runs:
_items.append(_item_triggered_runs.to_dict())
_dict["triggeredRuns"] = _items
return _dict
@classmethod
@@ -137,6 +168,17 @@ class V1Event(BaseModel):
else None
),
"additionalMetadata": obj.get("additionalMetadata"),
"payload": obj.get("payload"),
"scope": obj.get("scope"),
"seenAt": obj.get("seenAt"),
"triggeredRuns": (
[
V1EventTriggeredRun.from_dict(_item)
for _item in obj["triggeredRuns"]
]
if obj.get("triggeredRuns") is not None
else None
),
}
)
return _obj

View File

@@ -0,0 +1,94 @@
# coding: utf-8
"""
Hatchet API
The Hatchet API
The version of the OpenAPI document: 1.0.0
Generated by OpenAPI Generator (https://openapi-generator.tech)
Do not edit the class manually.
""" # noqa: E501
from __future__ import annotations
import json
import pprint
import re # noqa: F401
from typing import Any, ClassVar, Dict, List, Optional, Set
from pydantic import BaseModel, ConfigDict, Field, StrictStr
from typing_extensions import Annotated, Self
class V1EventTriggeredRun(BaseModel):
"""
V1EventTriggeredRun
""" # noqa: E501
workflow_run_id: Annotated[
str, Field(min_length=36, strict=True, max_length=36)
] = Field(
description="The external ID of the triggered run.", alias="workflowRunId"
)
filter_id: Optional[StrictStr] = Field(
default=None,
description="The ID of the filter that triggered the run, if applicable.",
alias="filterId",
)
__properties: ClassVar[List[str]] = ["workflowRunId", "filterId"]
model_config = ConfigDict(
populate_by_name=True,
validate_assignment=True,
protected_namespaces=(),
)
def to_str(self) -> str:
"""Returns the string representation of the model using alias"""
return pprint.pformat(self.model_dump(by_alias=True))
def to_json(self) -> str:
"""Returns the JSON representation of the model using alias"""
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
return json.dumps(self.to_dict())
@classmethod
def from_json(cls, json_str: str) -> Optional[Self]:
"""Create an instance of V1EventTriggeredRun from a JSON string"""
return cls.from_dict(json.loads(json_str))
def to_dict(self) -> Dict[str, Any]:
"""Return the dictionary representation of the model using alias.
This has the following differences from calling pydantic's
`self.model_dump(by_alias=True)`:
* `None` is only added to the output dict for nullable fields that
were set at model initialization. Other fields with value `None`
are ignored.
"""
excluded_fields: Set[str] = set([])
_dict = self.model_dump(
by_alias=True,
exclude=excluded_fields,
exclude_none=True,
)
return _dict
@classmethod
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
"""Create an instance of V1EventTriggeredRun from a dict"""
if obj is None:
return None
if not isinstance(obj, dict):
return cls.model_validate(obj)
_obj = cls.model_validate(
{"workflowRunId": obj.get("workflowRunId"), "filterId": obj.get("filterId")}
)
return _obj

View File

@@ -1,6 +1,6 @@
[tool.poetry]
name = "hatchet-sdk"
version = "1.12.0"
version = "1.12.1"
description = ""
authors = ["Alexander Belanger <alexander@hatchet.run>"]
readme = "README.md"