hatchet-sdk 1.0.0__py3-none-any.whl → 1.0.1__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


This version of hatchet-sdk might be problematic. Click here for more details.

Files changed (73) hide show
  1. hatchet_sdk/__init__.py +32 -16
  2. hatchet_sdk/client.py +25 -63
  3. hatchet_sdk/clients/admin.py +203 -142
  4. hatchet_sdk/clients/dispatcher/action_listener.py +42 -42
  5. hatchet_sdk/clients/dispatcher/dispatcher.py +18 -16
  6. hatchet_sdk/clients/durable_event_listener.py +327 -0
  7. hatchet_sdk/clients/rest/__init__.py +12 -1
  8. hatchet_sdk/clients/rest/api/log_api.py +258 -0
  9. hatchet_sdk/clients/rest/api/task_api.py +32 -6
  10. hatchet_sdk/clients/rest/api/workflow_runs_api.py +626 -0
  11. hatchet_sdk/clients/rest/models/__init__.py +12 -1
  12. hatchet_sdk/clients/rest/models/v1_log_line.py +94 -0
  13. hatchet_sdk/clients/rest/models/v1_log_line_level.py +39 -0
  14. hatchet_sdk/clients/rest/models/v1_log_line_list.py +110 -0
  15. hatchet_sdk/clients/rest/models/v1_task_summary.py +80 -64
  16. hatchet_sdk/clients/rest/models/v1_trigger_workflow_run_request.py +95 -0
  17. hatchet_sdk/clients/rest/models/v1_workflow_run_display_name.py +98 -0
  18. hatchet_sdk/clients/rest/models/v1_workflow_run_display_name_list.py +114 -0
  19. hatchet_sdk/clients/rest/models/workflow_run_shape_item_for_workflow_run_details.py +9 -4
  20. hatchet_sdk/clients/rest/models/workflow_runs_metrics.py +5 -1
  21. hatchet_sdk/clients/run_event_listener.py +0 -1
  22. hatchet_sdk/clients/v1/api_client.py +81 -0
  23. hatchet_sdk/context/context.py +86 -159
  24. hatchet_sdk/contracts/dispatcher_pb2_grpc.py +1 -1
  25. hatchet_sdk/contracts/events_pb2.py +2 -2
  26. hatchet_sdk/contracts/events_pb2_grpc.py +1 -1
  27. hatchet_sdk/contracts/v1/dispatcher_pb2.py +36 -0
  28. hatchet_sdk/contracts/v1/dispatcher_pb2.pyi +38 -0
  29. hatchet_sdk/contracts/v1/dispatcher_pb2_grpc.py +145 -0
  30. hatchet_sdk/contracts/v1/shared/condition_pb2.py +39 -0
  31. hatchet_sdk/contracts/v1/shared/condition_pb2.pyi +72 -0
  32. hatchet_sdk/contracts/v1/shared/condition_pb2_grpc.py +29 -0
  33. hatchet_sdk/contracts/v1/workflows_pb2.py +67 -0
  34. hatchet_sdk/contracts/v1/workflows_pb2.pyi +228 -0
  35. hatchet_sdk/contracts/v1/workflows_pb2_grpc.py +234 -0
  36. hatchet_sdk/contracts/workflows_pb2_grpc.py +1 -1
  37. hatchet_sdk/features/cron.py +91 -121
  38. hatchet_sdk/features/logs.py +16 -0
  39. hatchet_sdk/features/metrics.py +75 -0
  40. hatchet_sdk/features/rate_limits.py +45 -0
  41. hatchet_sdk/features/runs.py +221 -0
  42. hatchet_sdk/features/scheduled.py +114 -131
  43. hatchet_sdk/features/workers.py +41 -0
  44. hatchet_sdk/features/workflows.py +55 -0
  45. hatchet_sdk/hatchet.py +463 -165
  46. hatchet_sdk/opentelemetry/instrumentor.py +8 -13
  47. hatchet_sdk/rate_limit.py +33 -39
  48. hatchet_sdk/runnables/contextvars.py +12 -0
  49. hatchet_sdk/runnables/standalone.py +192 -0
  50. hatchet_sdk/runnables/task.py +144 -0
  51. hatchet_sdk/runnables/types.py +138 -0
  52. hatchet_sdk/runnables/workflow.py +771 -0
  53. hatchet_sdk/utils/aio_utils.py +0 -79
  54. hatchet_sdk/utils/proto_enums.py +0 -7
  55. hatchet_sdk/utils/timedelta_to_expression.py +23 -0
  56. hatchet_sdk/utils/typing.py +2 -2
  57. hatchet_sdk/v0/clients/rest_client.py +9 -0
  58. hatchet_sdk/v0/worker/action_listener_process.py +18 -2
  59. hatchet_sdk/waits.py +120 -0
  60. hatchet_sdk/worker/action_listener_process.py +64 -30
  61. hatchet_sdk/worker/runner/run_loop_manager.py +35 -26
  62. hatchet_sdk/worker/runner/runner.py +72 -55
  63. hatchet_sdk/worker/runner/utils/capture_logs.py +3 -11
  64. hatchet_sdk/worker/worker.py +155 -118
  65. hatchet_sdk/workflow_run.py +4 -5
  66. {hatchet_sdk-1.0.0.dist-info → hatchet_sdk-1.0.1.dist-info}/METADATA +1 -2
  67. {hatchet_sdk-1.0.0.dist-info → hatchet_sdk-1.0.1.dist-info}/RECORD +69 -43
  68. {hatchet_sdk-1.0.0.dist-info → hatchet_sdk-1.0.1.dist-info}/entry_points.txt +2 -0
  69. hatchet_sdk/clients/rest_client.py +0 -636
  70. hatchet_sdk/semver.py +0 -30
  71. hatchet_sdk/worker/runner/utils/error_with_traceback.py +0 -6
  72. hatchet_sdk/workflow.py +0 -527
  73. {hatchet_sdk-1.0.0.dist-info → hatchet_sdk-1.0.1.dist-info}/WHEEL +0 -0
@@ -195,8 +195,10 @@ from hatchet_sdk.clients.rest.models.user_tenant_memberships_list import (
195
195
  from hatchet_sdk.clients.rest.models.user_tenant_public import UserTenantPublic
196
196
  from hatchet_sdk.clients.rest.models.v1_cancel_task_request import V1CancelTaskRequest
197
197
  from hatchet_sdk.clients.rest.models.v1_dag_children import V1DagChildren
198
+ from hatchet_sdk.clients.rest.models.v1_log_line import V1LogLine
199
+ from hatchet_sdk.clients.rest.models.v1_log_line_level import V1LogLineLevel
200
+ from hatchet_sdk.clients.rest.models.v1_log_line_list import V1LogLineList
198
201
  from hatchet_sdk.clients.rest.models.v1_replay_task_request import V1ReplayTaskRequest
199
- from hatchet_sdk.clients.rest.models.v1_task import V1Task
200
202
  from hatchet_sdk.clients.rest.models.v1_task_event import V1TaskEvent
201
203
  from hatchet_sdk.clients.rest.models.v1_task_event_list import V1TaskEventList
202
204
  from hatchet_sdk.clients.rest.models.v1_task_event_type import V1TaskEventType
@@ -208,8 +210,17 @@ from hatchet_sdk.clients.rest.models.v1_task_run_status import V1TaskRunStatus
208
210
  from hatchet_sdk.clients.rest.models.v1_task_status import V1TaskStatus
209
211
  from hatchet_sdk.clients.rest.models.v1_task_summary import V1TaskSummary
210
212
  from hatchet_sdk.clients.rest.models.v1_task_summary_list import V1TaskSummaryList
213
+ from hatchet_sdk.clients.rest.models.v1_trigger_workflow_run_request import (
214
+ V1TriggerWorkflowRunRequest,
215
+ )
211
216
  from hatchet_sdk.clients.rest.models.v1_workflow_run import V1WorkflowRun
212
217
  from hatchet_sdk.clients.rest.models.v1_workflow_run_details import V1WorkflowRunDetails
218
+ from hatchet_sdk.clients.rest.models.v1_workflow_run_display_name import (
219
+ V1WorkflowRunDisplayName,
220
+ )
221
+ from hatchet_sdk.clients.rest.models.v1_workflow_run_display_name_list import (
222
+ V1WorkflowRunDisplayNameList,
223
+ )
213
224
  from hatchet_sdk.clients.rest.models.v1_workflow_type import V1WorkflowType
214
225
  from hatchet_sdk.clients.rest.models.webhook_worker import WebhookWorker
215
226
  from hatchet_sdk.clients.rest.models.webhook_worker_create_request import (
@@ -0,0 +1,94 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ Hatchet API
5
+
6
+ The Hatchet API
7
+
8
+ The version of the OpenAPI document: 1.0.0
9
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
10
+
11
+ Do not edit the class manually.
12
+ """ # noqa: E501
13
+
14
+
15
+ from __future__ import annotations
16
+
17
+ import json
18
+ import pprint
19
+ import re # noqa: F401
20
+ from datetime import datetime
21
+ from typing import Any, ClassVar, Dict, List, Optional, Set
22
+
23
+ from pydantic import BaseModel, ConfigDict, Field, StrictStr
24
+ from typing_extensions import Self
25
+
26
+
27
+ class V1LogLine(BaseModel):
28
+ """
29
+ V1LogLine
30
+ """ # noqa: E501
31
+
32
+ created_at: datetime = Field(
33
+ description="The creation date of the log line.", alias="createdAt"
34
+ )
35
+ message: StrictStr = Field(description="The log message.")
36
+ metadata: Dict[str, Any] = Field(description="The log metadata.")
37
+ __properties: ClassVar[List[str]] = ["createdAt", "message", "metadata"]
38
+
39
+ model_config = ConfigDict(
40
+ populate_by_name=True,
41
+ validate_assignment=True,
42
+ protected_namespaces=(),
43
+ )
44
+
45
+ def to_str(self) -> str:
46
+ """Returns the string representation of the model using alias"""
47
+ return pprint.pformat(self.model_dump(by_alias=True))
48
+
49
+ def to_json(self) -> str:
50
+ """Returns the JSON representation of the model using alias"""
51
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
52
+ return json.dumps(self.to_dict())
53
+
54
+ @classmethod
55
+ def from_json(cls, json_str: str) -> Optional[Self]:
56
+ """Create an instance of V1LogLine from a JSON string"""
57
+ return cls.from_dict(json.loads(json_str))
58
+
59
+ def to_dict(self) -> Dict[str, Any]:
60
+ """Return the dictionary representation of the model using alias.
61
+
62
+ This has the following differences from calling pydantic's
63
+ `self.model_dump(by_alias=True)`:
64
+
65
+ * `None` is only added to the output dict for nullable fields that
66
+ were set at model initialization. Other fields with value `None`
67
+ are ignored.
68
+ """
69
+ excluded_fields: Set[str] = set([])
70
+
71
+ _dict = self.model_dump(
72
+ by_alias=True,
73
+ exclude=excluded_fields,
74
+ exclude_none=True,
75
+ )
76
+ return _dict
77
+
78
+ @classmethod
79
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
80
+ """Create an instance of V1LogLine from a dict"""
81
+ if obj is None:
82
+ return None
83
+
84
+ if not isinstance(obj, dict):
85
+ return cls.model_validate(obj)
86
+
87
+ _obj = cls.model_validate(
88
+ {
89
+ "createdAt": obj.get("createdAt"),
90
+ "message": obj.get("message"),
91
+ "metadata": obj.get("metadata"),
92
+ }
93
+ )
94
+ return _obj
@@ -0,0 +1,39 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ Hatchet API
5
+
6
+ The Hatchet API
7
+
8
+ The version of the OpenAPI document: 1.0.0
9
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
10
+
11
+ Do not edit the class manually.
12
+ """ # noqa: E501
13
+
14
+
15
+ from __future__ import annotations
16
+
17
+ import json
18
+ from enum import Enum
19
+
20
+ from typing_extensions import Self
21
+
22
+
23
+ class V1LogLineLevel(str, Enum):
24
+ """
25
+ V1LogLineLevel
26
+ """
27
+
28
+ """
29
+ allowed enum values
30
+ """
31
+ DEBUG = "DEBUG"
32
+ INFO = "INFO"
33
+ WARN = "WARN"
34
+ ERROR = "ERROR"
35
+
36
+ @classmethod
37
+ def from_json(cls, json_str: str) -> Self:
38
+ """Create an instance of V1LogLineLevel from a JSON string"""
39
+ return cls(json.loads(json_str))
@@ -0,0 +1,110 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ Hatchet API
5
+
6
+ The Hatchet API
7
+
8
+ The version of the OpenAPI document: 1.0.0
9
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
10
+
11
+ Do not edit the class manually.
12
+ """ # noqa: E501
13
+
14
+
15
+ from __future__ import annotations
16
+
17
+ import json
18
+ import pprint
19
+ import re # noqa: F401
20
+ from typing import Any, ClassVar, Dict, List, Optional, Set
21
+
22
+ from pydantic import BaseModel, ConfigDict
23
+ from typing_extensions import Self
24
+
25
+ from hatchet_sdk.clients.rest.models.pagination_response import PaginationResponse
26
+ from hatchet_sdk.clients.rest.models.v1_log_line import V1LogLine
27
+
28
+
29
+ class V1LogLineList(BaseModel):
30
+ """
31
+ V1LogLineList
32
+ """ # noqa: E501
33
+
34
+ pagination: Optional[PaginationResponse] = None
35
+ rows: Optional[List[V1LogLine]] = None
36
+ __properties: ClassVar[List[str]] = ["pagination", "rows"]
37
+
38
+ model_config = ConfigDict(
39
+ populate_by_name=True,
40
+ validate_assignment=True,
41
+ protected_namespaces=(),
42
+ )
43
+
44
+ def to_str(self) -> str:
45
+ """Returns the string representation of the model using alias"""
46
+ return pprint.pformat(self.model_dump(by_alias=True))
47
+
48
+ def to_json(self) -> str:
49
+ """Returns the JSON representation of the model using alias"""
50
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
51
+ return json.dumps(self.to_dict())
52
+
53
+ @classmethod
54
+ def from_json(cls, json_str: str) -> Optional[Self]:
55
+ """Create an instance of V1LogLineList from a JSON string"""
56
+ return cls.from_dict(json.loads(json_str))
57
+
58
+ def to_dict(self) -> Dict[str, Any]:
59
+ """Return the dictionary representation of the model using alias.
60
+
61
+ This has the following differences from calling pydantic's
62
+ `self.model_dump(by_alias=True)`:
63
+
64
+ * `None` is only added to the output dict for nullable fields that
65
+ were set at model initialization. Other fields with value `None`
66
+ are ignored.
67
+ """
68
+ excluded_fields: Set[str] = set([])
69
+
70
+ _dict = self.model_dump(
71
+ by_alias=True,
72
+ exclude=excluded_fields,
73
+ exclude_none=True,
74
+ )
75
+ # override the default output from pydantic by calling `to_dict()` of pagination
76
+ if self.pagination:
77
+ _dict["pagination"] = self.pagination.to_dict()
78
+ # override the default output from pydantic by calling `to_dict()` of each item in rows (list)
79
+ _items = []
80
+ if self.rows:
81
+ for _item_rows in self.rows:
82
+ if _item_rows:
83
+ _items.append(_item_rows.to_dict())
84
+ _dict["rows"] = _items
85
+ return _dict
86
+
87
+ @classmethod
88
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
89
+ """Create an instance of V1LogLineList from a dict"""
90
+ if obj is None:
91
+ return None
92
+
93
+ if not isinstance(obj, dict):
94
+ return cls.model_validate(obj)
95
+
96
+ _obj = cls.model_validate(
97
+ {
98
+ "pagination": (
99
+ PaginationResponse.from_dict(obj["pagination"])
100
+ if obj.get("pagination") is not None
101
+ else None
102
+ ),
103
+ "rows": (
104
+ [V1LogLine.from_dict(_item) for _item in obj["rows"]]
105
+ if obj.get("rows") is not None
106
+ else None
107
+ ),
108
+ }
109
+ )
110
+ return _obj
@@ -34,86 +34,98 @@ class V1TaskSummary(BaseModel):
34
34
  """ # noqa: E501
35
35
 
36
36
  metadata: APIResourceMeta
37
- task_id: StrictInt = Field(description="The ID of the task.", alias="taskId")
38
- task_external_id: Annotated[
39
- str, Field(min_length=36, strict=True, max_length=36)
40
- ] = Field(description="The external ID of the task.", alias="taskExternalId")
41
- task_inserted_at: datetime = Field(
42
- description="The timestamp the task was inserted.", alias="taskInsertedAt"
43
- )
44
- status: V1TaskStatus
45
- started_at: Optional[datetime] = Field(
37
+ additional_metadata: Optional[Dict[str, Any]] = Field(
46
38
  default=None,
47
- description="The timestamp the task run started.",
48
- alias="startedAt",
39
+ description="Additional metadata for the task run.",
40
+ alias="additionalMetadata",
49
41
  )
50
- finished_at: Optional[datetime] = Field(
51
- default=None,
52
- description="The timestamp the task run finished.",
53
- alias="finishedAt",
42
+ children: Optional[List[V1TaskSummary]] = Field(
43
+ default=None, description="The list of children tasks"
44
+ )
45
+ created_at: datetime = Field(
46
+ description="The timestamp the task was created.", alias="createdAt"
47
+ )
48
+ display_name: StrictStr = Field(
49
+ description="The display name of the task run.", alias="displayName"
54
50
  )
55
51
  duration: Optional[StrictInt] = Field(
56
52
  default=None, description="The duration of the task run, in milliseconds."
57
53
  )
58
- tenant_id: Annotated[str, Field(min_length=36, strict=True, max_length=36)] = Field(
59
- description="The ID of the tenant.", alias="tenantId"
54
+ error_message: Optional[StrictStr] = Field(
55
+ default=None,
56
+ description="The error message of the task run (for the latest run)",
57
+ alias="errorMessage",
60
58
  )
61
- additional_metadata: Optional[Dict[str, Any]] = Field(
59
+ finished_at: Optional[datetime] = Field(
62
60
  default=None,
63
- description="Additional metadata for the task run.",
64
- alias="additionalMetadata",
61
+ description="The timestamp the task run finished.",
62
+ alias="finishedAt",
65
63
  )
66
- display_name: StrictStr = Field(
67
- description="The display name of the task run.", alias="displayName"
64
+ input: Dict[str, Any] = Field(description="The input of the task run.")
65
+ num_spawned_children: StrictInt = Field(
66
+ description="The number of spawned children tasks", alias="numSpawnedChildren"
68
67
  )
69
- workflow_id: StrictStr = Field(alias="workflowId")
70
68
  output: Dict[str, Any] = Field(
71
69
  description="The output of the task run (for the latest run)"
72
70
  )
73
- error_message: Optional[StrictStr] = Field(
71
+ status: V1TaskStatus
72
+ started_at: Optional[datetime] = Field(
74
73
  default=None,
75
- description="The error message of the task run (for the latest run)",
76
- alias="errorMessage",
74
+ description="The timestamp the task run started.",
75
+ alias="startedAt",
77
76
  )
78
- input: Optional[Dict[str, Any]] = Field(
79
- default=None, description="The input of the task run."
77
+ step_id: Optional[
78
+ Annotated[str, Field(min_length=36, strict=True, max_length=36)]
79
+ ] = Field(default=None, description="The step ID of the task.", alias="stepId")
80
+ task_external_id: Annotated[
81
+ str, Field(min_length=36, strict=True, max_length=36)
82
+ ] = Field(description="The external ID of the task.", alias="taskExternalId")
83
+ task_id: StrictInt = Field(description="The ID of the task.", alias="taskId")
84
+ task_inserted_at: datetime = Field(
85
+ description="The timestamp the task was inserted.", alias="taskInsertedAt"
86
+ )
87
+ tenant_id: Annotated[str, Field(min_length=36, strict=True, max_length=36)] = Field(
88
+ description="The ID of the tenant.", alias="tenantId"
80
89
  )
81
90
  type: V1WorkflowType = Field(
82
91
  description="The type of the workflow (whether it's a DAG or a task)"
83
92
  )
93
+ workflow_id: StrictStr = Field(alias="workflowId")
94
+ workflow_name: Optional[StrictStr] = Field(default=None, alias="workflowName")
95
+ workflow_run_external_id: Optional[StrictStr] = Field(
96
+ default=None,
97
+ description="The external ID of the workflow run",
98
+ alias="workflowRunExternalId",
99
+ )
84
100
  workflow_version_id: Optional[StrictStr] = Field(
85
101
  default=None,
86
102
  description="The version ID of the workflow",
87
103
  alias="workflowVersionId",
88
104
  )
89
- created_at: Optional[datetime] = Field(
90
- default=None,
91
- description="The timestamp the task was created.",
92
- alias="createdAt",
93
- )
94
- children: Optional[List[V1TaskSummary]] = Field(
95
- default=None, description="The list of children tasks"
96
- )
97
105
  __properties: ClassVar[List[str]] = [
98
106
  "metadata",
99
- "taskId",
100
- "taskExternalId",
101
- "taskInsertedAt",
102
- "status",
103
- "startedAt",
104
- "finishedAt",
105
- "duration",
106
- "tenantId",
107
107
  "additionalMetadata",
108
+ "children",
109
+ "createdAt",
108
110
  "displayName",
109
- "workflowId",
110
- "output",
111
+ "duration",
111
112
  "errorMessage",
113
+ "finishedAt",
112
114
  "input",
115
+ "numSpawnedChildren",
116
+ "output",
117
+ "status",
118
+ "startedAt",
119
+ "stepId",
120
+ "taskExternalId",
121
+ "taskId",
122
+ "taskInsertedAt",
123
+ "tenantId",
113
124
  "type",
125
+ "workflowId",
126
+ "workflowName",
127
+ "workflowRunExternalId",
114
128
  "workflowVersionId",
115
- "createdAt",
116
- "children",
117
129
  ]
118
130
 
119
131
  model_config = ConfigDict(
@@ -181,28 +193,32 @@ class V1TaskSummary(BaseModel):
181
193
  if obj.get("metadata") is not None
182
194
  else None
183
195
  ),
184
- "taskId": obj.get("taskId"),
185
- "taskExternalId": obj.get("taskExternalId"),
186
- "taskInsertedAt": obj.get("taskInsertedAt"),
187
- "status": obj.get("status"),
188
- "startedAt": obj.get("startedAt"),
189
- "finishedAt": obj.get("finishedAt"),
190
- "duration": obj.get("duration"),
191
- "tenantId": obj.get("tenantId"),
192
196
  "additionalMetadata": obj.get("additionalMetadata"),
193
- "displayName": obj.get("displayName"),
194
- "workflowId": obj.get("workflowId"),
195
- "output": obj.get("output"),
196
- "errorMessage": obj.get("errorMessage"),
197
- "input": obj.get("input"),
198
- "type": obj.get("type"),
199
- "workflowVersionId": obj.get("workflowVersionId"),
200
- "createdAt": obj.get("createdAt"),
201
197
  "children": (
202
198
  [V1TaskSummary.from_dict(_item) for _item in obj["children"]]
203
199
  if obj.get("children") is not None
204
200
  else None
205
201
  ),
202
+ "createdAt": obj.get("createdAt"),
203
+ "displayName": obj.get("displayName"),
204
+ "duration": obj.get("duration"),
205
+ "errorMessage": obj.get("errorMessage"),
206
+ "finishedAt": obj.get("finishedAt"),
207
+ "input": obj.get("input"),
208
+ "numSpawnedChildren": obj.get("numSpawnedChildren"),
209
+ "output": obj.get("output"),
210
+ "status": obj.get("status"),
211
+ "startedAt": obj.get("startedAt"),
212
+ "stepId": obj.get("stepId"),
213
+ "taskExternalId": obj.get("taskExternalId"),
214
+ "taskId": obj.get("taskId"),
215
+ "taskInsertedAt": obj.get("taskInsertedAt"),
216
+ "tenantId": obj.get("tenantId"),
217
+ "type": obj.get("type"),
218
+ "workflowId": obj.get("workflowId"),
219
+ "workflowName": obj.get("workflowName"),
220
+ "workflowRunExternalId": obj.get("workflowRunExternalId"),
221
+ "workflowVersionId": obj.get("workflowVersionId"),
206
222
  }
207
223
  )
208
224
  return _obj
@@ -0,0 +1,95 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ Hatchet API
5
+
6
+ The Hatchet API
7
+
8
+ The version of the OpenAPI document: 1.0.0
9
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
10
+
11
+ Do not edit the class manually.
12
+ """ # noqa: E501
13
+
14
+
15
+ from __future__ import annotations
16
+
17
+ import json
18
+ import pprint
19
+ import re # noqa: F401
20
+ from typing import Any, ClassVar, Dict, List, Optional, Set
21
+
22
+ from pydantic import BaseModel, ConfigDict, Field, StrictStr
23
+ from typing_extensions import Self
24
+
25
+
26
+ class V1TriggerWorkflowRunRequest(BaseModel):
27
+ """
28
+ V1TriggerWorkflowRunRequest
29
+ """ # noqa: E501
30
+
31
+ workflow_name: StrictStr = Field(
32
+ description="The name of the workflow.", alias="workflowName"
33
+ )
34
+ input: Dict[str, Any]
35
+ additional_metadata: Optional[Dict[str, Any]] = Field(
36
+ default=None, alias="additionalMetadata"
37
+ )
38
+ __properties: ClassVar[List[str]] = ["workflowName", "input", "additionalMetadata"]
39
+
40
+ model_config = ConfigDict(
41
+ populate_by_name=True,
42
+ validate_assignment=True,
43
+ protected_namespaces=(),
44
+ )
45
+
46
+ def to_str(self) -> str:
47
+ """Returns the string representation of the model using alias"""
48
+ return pprint.pformat(self.model_dump(by_alias=True))
49
+
50
+ def to_json(self) -> str:
51
+ """Returns the JSON representation of the model using alias"""
52
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
53
+ return json.dumps(self.to_dict())
54
+
55
+ @classmethod
56
+ def from_json(cls, json_str: str) -> Optional[Self]:
57
+ """Create an instance of V1TriggerWorkflowRunRequest from a JSON string"""
58
+ return cls.from_dict(json.loads(json_str))
59
+
60
+ def to_dict(self) -> Dict[str, Any]:
61
+ """Return the dictionary representation of the model using alias.
62
+
63
+ This has the following differences from calling pydantic's
64
+ `self.model_dump(by_alias=True)`:
65
+
66
+ * `None` is only added to the output dict for nullable fields that
67
+ were set at model initialization. Other fields with value `None`
68
+ are ignored.
69
+ """
70
+ excluded_fields: Set[str] = set([])
71
+
72
+ _dict = self.model_dump(
73
+ by_alias=True,
74
+ exclude=excluded_fields,
75
+ exclude_none=True,
76
+ )
77
+ return _dict
78
+
79
+ @classmethod
80
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
81
+ """Create an instance of V1TriggerWorkflowRunRequest from a dict"""
82
+ if obj is None:
83
+ return None
84
+
85
+ if not isinstance(obj, dict):
86
+ return cls.model_validate(obj)
87
+
88
+ _obj = cls.model_validate(
89
+ {
90
+ "workflowName": obj.get("workflowName"),
91
+ "input": obj.get("input"),
92
+ "additionalMetadata": obj.get("additionalMetadata"),
93
+ }
94
+ )
95
+ return _obj
@@ -0,0 +1,98 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ Hatchet API
5
+
6
+ The Hatchet API
7
+
8
+ The version of the OpenAPI document: 1.0.0
9
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
10
+
11
+ Do not edit the class manually.
12
+ """ # noqa: E501
13
+
14
+
15
+ from __future__ import annotations
16
+
17
+ import json
18
+ import pprint
19
+ import re # noqa: F401
20
+ from typing import Any, ClassVar, Dict, List, Optional, Set
21
+
22
+ from pydantic import BaseModel, ConfigDict, Field, StrictStr
23
+ from typing_extensions import Self
24
+
25
+ from hatchet_sdk.clients.rest.models.api_resource_meta import APIResourceMeta
26
+
27
+
28
+ class V1WorkflowRunDisplayName(BaseModel):
29
+ """
30
+ V1WorkflowRunDisplayName
31
+ """ # noqa: E501
32
+
33
+ metadata: APIResourceMeta
34
+ display_name: StrictStr = Field(alias="displayName")
35
+ __properties: ClassVar[List[str]] = ["metadata", "displayName"]
36
+
37
+ model_config = ConfigDict(
38
+ populate_by_name=True,
39
+ validate_assignment=True,
40
+ protected_namespaces=(),
41
+ )
42
+
43
+ def to_str(self) -> str:
44
+ """Returns the string representation of the model using alias"""
45
+ return pprint.pformat(self.model_dump(by_alias=True))
46
+
47
+ def to_json(self) -> str:
48
+ """Returns the JSON representation of the model using alias"""
49
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
50
+ return json.dumps(self.to_dict())
51
+
52
+ @classmethod
53
+ def from_json(cls, json_str: str) -> Optional[Self]:
54
+ """Create an instance of V1WorkflowRunDisplayName from a JSON string"""
55
+ return cls.from_dict(json.loads(json_str))
56
+
57
+ def to_dict(self) -> Dict[str, Any]:
58
+ """Return the dictionary representation of the model using alias.
59
+
60
+ This has the following differences from calling pydantic's
61
+ `self.model_dump(by_alias=True)`:
62
+
63
+ * `None` is only added to the output dict for nullable fields that
64
+ were set at model initialization. Other fields with value `None`
65
+ are ignored.
66
+ """
67
+ excluded_fields: Set[str] = set([])
68
+
69
+ _dict = self.model_dump(
70
+ by_alias=True,
71
+ exclude=excluded_fields,
72
+ exclude_none=True,
73
+ )
74
+ # override the default output from pydantic by calling `to_dict()` of metadata
75
+ if self.metadata:
76
+ _dict["metadata"] = self.metadata.to_dict()
77
+ return _dict
78
+
79
+ @classmethod
80
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
81
+ """Create an instance of V1WorkflowRunDisplayName from a dict"""
82
+ if obj is None:
83
+ return None
84
+
85
+ if not isinstance(obj, dict):
86
+ return cls.model_validate(obj)
87
+
88
+ _obj = cls.model_validate(
89
+ {
90
+ "metadata": (
91
+ APIResourceMeta.from_dict(obj["metadata"])
92
+ if obj.get("metadata") is not None
93
+ else None
94
+ ),
95
+ "displayName": obj.get("displayName"),
96
+ }
97
+ )
98
+ return _obj