hatchet-sdk 1.16.4__py3-none-any.whl → 1.16.5__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 (27) hide show
  1. hatchet_sdk/clients/rest/__init__.py +32 -0
  2. hatchet_sdk/clients/rest/api/__init__.py +1 -0
  3. hatchet_sdk/clients/rest/api/webhook_api.py +1551 -0
  4. hatchet_sdk/clients/rest/models/__init__.py +31 -0
  5. hatchet_sdk/clients/rest/models/v1_create_webhook_request.py +215 -0
  6. hatchet_sdk/clients/rest/models/v1_create_webhook_request_api_key.py +126 -0
  7. hatchet_sdk/clients/rest/models/v1_create_webhook_request_api_key_all_of_auth_type.py +82 -0
  8. hatchet_sdk/clients/rest/models/v1_create_webhook_request_base.py +98 -0
  9. hatchet_sdk/clients/rest/models/v1_create_webhook_request_basic_auth.py +126 -0
  10. hatchet_sdk/clients/rest/models/v1_create_webhook_request_basic_auth_all_of_auth_type.py +82 -0
  11. hatchet_sdk/clients/rest/models/v1_create_webhook_request_hmac.py +126 -0
  12. hatchet_sdk/clients/rest/models/v1_create_webhook_request_hmac_all_of_auth_type.py +82 -0
  13. hatchet_sdk/clients/rest/models/v1_event.py +7 -0
  14. hatchet_sdk/clients/rest/models/v1_webhook.py +126 -0
  15. hatchet_sdk/clients/rest/models/v1_webhook_api_key_auth.py +90 -0
  16. hatchet_sdk/clients/rest/models/v1_webhook_auth_type.py +38 -0
  17. hatchet_sdk/clients/rest/models/v1_webhook_basic_auth.py +86 -0
  18. hatchet_sdk/clients/rest/models/v1_webhook_hmac_algorithm.py +39 -0
  19. hatchet_sdk/clients/rest/models/v1_webhook_hmac_auth.py +115 -0
  20. hatchet_sdk/clients/rest/models/v1_webhook_hmac_encoding.py +38 -0
  21. hatchet_sdk/clients/rest/models/v1_webhook_list.py +110 -0
  22. hatchet_sdk/clients/rest/models/v1_webhook_receive200_response.py +83 -0
  23. hatchet_sdk/clients/rest/models/v1_webhook_source_name.py +38 -0
  24. {hatchet_sdk-1.16.4.dist-info → hatchet_sdk-1.16.5.dist-info}/METADATA +2 -2
  25. {hatchet_sdk-1.16.4.dist-info → hatchet_sdk-1.16.5.dist-info}/RECORD +27 -8
  26. {hatchet_sdk-1.16.4.dist-info → hatchet_sdk-1.16.5.dist-info}/WHEEL +0 -0
  27. {hatchet_sdk-1.16.4.dist-info → hatchet_sdk-1.16.5.dist-info}/entry_points.txt +0 -0
@@ -204,6 +204,21 @@ from hatchet_sdk.clients.rest.models.v1_cel_debug_response_status import (
204
204
  from hatchet_sdk.clients.rest.models.v1_create_filter_request import (
205
205
  V1CreateFilterRequest,
206
206
  )
207
+ from hatchet_sdk.clients.rest.models.v1_create_webhook_request import (
208
+ V1CreateWebhookRequest,
209
+ )
210
+ from hatchet_sdk.clients.rest.models.v1_create_webhook_request_api_key import (
211
+ V1CreateWebhookRequestAPIKey,
212
+ )
213
+ from hatchet_sdk.clients.rest.models.v1_create_webhook_request_base import (
214
+ V1CreateWebhookRequestBase,
215
+ )
216
+ from hatchet_sdk.clients.rest.models.v1_create_webhook_request_basic_auth import (
217
+ V1CreateWebhookRequestBasicAuth,
218
+ )
219
+ from hatchet_sdk.clients.rest.models.v1_create_webhook_request_hmac import (
220
+ V1CreateWebhookRequestHMAC,
221
+ )
207
222
  from hatchet_sdk.clients.rest.models.v1_dag_children import V1DagChildren
208
223
  from hatchet_sdk.clients.rest.models.v1_event import V1Event
209
224
  from hatchet_sdk.clients.rest.models.v1_event_list import V1EventList
@@ -237,6 +252,22 @@ from hatchet_sdk.clients.rest.models.v1_trigger_workflow_run_request import (
237
252
  from hatchet_sdk.clients.rest.models.v1_update_filter_request import (
238
253
  V1UpdateFilterRequest,
239
254
  )
255
+ from hatchet_sdk.clients.rest.models.v1_webhook import V1Webhook
256
+ from hatchet_sdk.clients.rest.models.v1_webhook_api_key_auth import V1WebhookAPIKeyAuth
257
+ from hatchet_sdk.clients.rest.models.v1_webhook_auth_type import V1WebhookAuthType
258
+ from hatchet_sdk.clients.rest.models.v1_webhook_basic_auth import V1WebhookBasicAuth
259
+ from hatchet_sdk.clients.rest.models.v1_webhook_hmac_algorithm import (
260
+ V1WebhookHMACAlgorithm,
261
+ )
262
+ from hatchet_sdk.clients.rest.models.v1_webhook_hmac_auth import V1WebhookHMACAuth
263
+ from hatchet_sdk.clients.rest.models.v1_webhook_hmac_encoding import (
264
+ V1WebhookHMACEncoding,
265
+ )
266
+ from hatchet_sdk.clients.rest.models.v1_webhook_list import V1WebhookList
267
+ from hatchet_sdk.clients.rest.models.v1_webhook_receive200_response import (
268
+ V1WebhookReceive200Response,
269
+ )
270
+ from hatchet_sdk.clients.rest.models.v1_webhook_source_name import V1WebhookSourceName
240
271
  from hatchet_sdk.clients.rest.models.v1_workflow_run import V1WorkflowRun
241
272
  from hatchet_sdk.clients.rest.models.v1_workflow_run_details import V1WorkflowRunDetails
242
273
  from hatchet_sdk.clients.rest.models.v1_workflow_run_display_name import (
@@ -0,0 +1,215 @@
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
+ from typing import Any, Dict, List, Optional, Set, Union
20
+
21
+ from pydantic import (
22
+ BaseModel,
23
+ ConfigDict,
24
+ Field,
25
+ StrictStr,
26
+ ValidationError,
27
+ field_validator,
28
+ )
29
+ from typing_extensions import Literal, Self
30
+
31
+ from hatchet_sdk.clients.rest.models.v1_create_webhook_request_api_key import (
32
+ V1CreateWebhookRequestAPIKey,
33
+ )
34
+ from hatchet_sdk.clients.rest.models.v1_create_webhook_request_basic_auth import (
35
+ V1CreateWebhookRequestBasicAuth,
36
+ )
37
+ from hatchet_sdk.clients.rest.models.v1_create_webhook_request_hmac import (
38
+ V1CreateWebhookRequestHMAC,
39
+ )
40
+
41
+ V1CREATEWEBHOOKREQUEST_ONE_OF_SCHEMAS = [
42
+ "V1CreateWebhookRequestAPIKey",
43
+ "V1CreateWebhookRequestBasicAuth",
44
+ "V1CreateWebhookRequestHMAC",
45
+ ]
46
+
47
+
48
+ class V1CreateWebhookRequest(BaseModel):
49
+ """
50
+ V1CreateWebhookRequest
51
+ """
52
+
53
+ # data type: V1CreateWebhookRequestBasicAuth
54
+ oneof_schema_1_validator: Optional[V1CreateWebhookRequestBasicAuth] = None
55
+ # data type: V1CreateWebhookRequestAPIKey
56
+ oneof_schema_2_validator: Optional[V1CreateWebhookRequestAPIKey] = None
57
+ # data type: V1CreateWebhookRequestHMAC
58
+ oneof_schema_3_validator: Optional[V1CreateWebhookRequestHMAC] = None
59
+ actual_instance: Optional[
60
+ Union[
61
+ V1CreateWebhookRequestAPIKey,
62
+ V1CreateWebhookRequestBasicAuth,
63
+ V1CreateWebhookRequestHMAC,
64
+ ]
65
+ ] = None
66
+ one_of_schemas: Set[str] = {
67
+ "V1CreateWebhookRequestAPIKey",
68
+ "V1CreateWebhookRequestBasicAuth",
69
+ "V1CreateWebhookRequestHMAC",
70
+ }
71
+
72
+ model_config = ConfigDict(
73
+ validate_assignment=True,
74
+ protected_namespaces=(),
75
+ )
76
+
77
+ def __init__(self, *args, **kwargs) -> None:
78
+ if args:
79
+ if len(args) > 1:
80
+ raise ValueError(
81
+ "If a position argument is used, only 1 is allowed to set `actual_instance`"
82
+ )
83
+ if kwargs:
84
+ raise ValueError(
85
+ "If a position argument is used, keyword arguments cannot be used."
86
+ )
87
+ super().__init__(actual_instance=args[0])
88
+ else:
89
+ super().__init__(**kwargs)
90
+
91
+ @field_validator("actual_instance")
92
+ def actual_instance_must_validate_oneof(cls, v):
93
+ instance = V1CreateWebhookRequest.model_construct()
94
+ error_messages = []
95
+ match = 0
96
+ # validate data type: V1CreateWebhookRequestBasicAuth
97
+ if not isinstance(v, V1CreateWebhookRequestBasicAuth):
98
+ error_messages.append(
99
+ f"Error! Input type `{type(v)}` is not `V1CreateWebhookRequestBasicAuth`"
100
+ )
101
+ else:
102
+ match += 1
103
+ # validate data type: V1CreateWebhookRequestAPIKey
104
+ if not isinstance(v, V1CreateWebhookRequestAPIKey):
105
+ error_messages.append(
106
+ f"Error! Input type `{type(v)}` is not `V1CreateWebhookRequestAPIKey`"
107
+ )
108
+ else:
109
+ match += 1
110
+ # validate data type: V1CreateWebhookRequestHMAC
111
+ if not isinstance(v, V1CreateWebhookRequestHMAC):
112
+ error_messages.append(
113
+ f"Error! Input type `{type(v)}` is not `V1CreateWebhookRequestHMAC`"
114
+ )
115
+ else:
116
+ match += 1
117
+ if match > 1:
118
+ # more than 1 match
119
+ raise ValueError(
120
+ "Multiple matches found when setting `actual_instance` in V1CreateWebhookRequest with oneOf schemas: V1CreateWebhookRequestAPIKey, V1CreateWebhookRequestBasicAuth, V1CreateWebhookRequestHMAC. Details: "
121
+ + ", ".join(error_messages)
122
+ )
123
+ elif match == 0:
124
+ # no match
125
+ raise ValueError(
126
+ "No match found when setting `actual_instance` in V1CreateWebhookRequest with oneOf schemas: V1CreateWebhookRequestAPIKey, V1CreateWebhookRequestBasicAuth, V1CreateWebhookRequestHMAC. Details: "
127
+ + ", ".join(error_messages)
128
+ )
129
+ else:
130
+ return v
131
+
132
+ @classmethod
133
+ def from_dict(cls, obj: Union[str, Dict[str, Any]]) -> Self:
134
+ return cls.from_json(json.dumps(obj))
135
+
136
+ @classmethod
137
+ def from_json(cls, json_str: str) -> Self:
138
+ """Returns the object represented by the json string"""
139
+ instance = cls.model_construct()
140
+ error_messages = []
141
+ match = 0
142
+
143
+ # deserialize data into V1CreateWebhookRequestBasicAuth
144
+ try:
145
+ instance.actual_instance = V1CreateWebhookRequestBasicAuth.from_json(
146
+ json_str
147
+ )
148
+ match += 1
149
+ except (ValidationError, ValueError) as e:
150
+ error_messages.append(str(e))
151
+ # deserialize data into V1CreateWebhookRequestAPIKey
152
+ try:
153
+ instance.actual_instance = V1CreateWebhookRequestAPIKey.from_json(json_str)
154
+ match += 1
155
+ except (ValidationError, ValueError) as e:
156
+ error_messages.append(str(e))
157
+ # deserialize data into V1CreateWebhookRequestHMAC
158
+ try:
159
+ instance.actual_instance = V1CreateWebhookRequestHMAC.from_json(json_str)
160
+ match += 1
161
+ except (ValidationError, ValueError) as e:
162
+ error_messages.append(str(e))
163
+
164
+ if match > 1:
165
+ # more than 1 match
166
+ raise ValueError(
167
+ "Multiple matches found when deserializing the JSON string into V1CreateWebhookRequest with oneOf schemas: V1CreateWebhookRequestAPIKey, V1CreateWebhookRequestBasicAuth, V1CreateWebhookRequestHMAC. Details: "
168
+ + ", ".join(error_messages)
169
+ )
170
+ elif match == 0:
171
+ # no match
172
+ raise ValueError(
173
+ "No match found when deserializing the JSON string into V1CreateWebhookRequest with oneOf schemas: V1CreateWebhookRequestAPIKey, V1CreateWebhookRequestBasicAuth, V1CreateWebhookRequestHMAC. Details: "
174
+ + ", ".join(error_messages)
175
+ )
176
+ else:
177
+ return instance
178
+
179
+ def to_json(self) -> str:
180
+ """Returns the JSON representation of the actual instance"""
181
+ if self.actual_instance is None:
182
+ return "null"
183
+
184
+ if hasattr(self.actual_instance, "to_json") and callable(
185
+ self.actual_instance.to_json
186
+ ):
187
+ return self.actual_instance.to_json()
188
+ else:
189
+ return json.dumps(self.actual_instance)
190
+
191
+ def to_dict(
192
+ self,
193
+ ) -> Optional[
194
+ Union[
195
+ Dict[str, Any],
196
+ V1CreateWebhookRequestAPIKey,
197
+ V1CreateWebhookRequestBasicAuth,
198
+ V1CreateWebhookRequestHMAC,
199
+ ]
200
+ ]:
201
+ """Returns the dict representation of the actual instance"""
202
+ if self.actual_instance is None:
203
+ return None
204
+
205
+ if hasattr(self.actual_instance, "to_dict") and callable(
206
+ self.actual_instance.to_dict
207
+ ):
208
+ return self.actual_instance.to_dict()
209
+ else:
210
+ # primitive type
211
+ return self.actual_instance
212
+
213
+ def to_str(self) -> str:
214
+ """Returns the string representation of the actual instance"""
215
+ return pprint.pformat(self.model_dump())
@@ -0,0 +1,126 @@
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, field_validator
23
+ from typing_extensions import Self
24
+
25
+ from hatchet_sdk.clients.rest.models.v1_webhook_api_key_auth import V1WebhookAPIKeyAuth
26
+ from hatchet_sdk.clients.rest.models.v1_webhook_source_name import V1WebhookSourceName
27
+
28
+
29
+ class V1CreateWebhookRequestAPIKey(BaseModel):
30
+ """
31
+ V1CreateWebhookRequestAPIKey
32
+ """ # noqa: E501
33
+
34
+ source_name: V1WebhookSourceName = Field(
35
+ description="The name of the source for this webhook", alias="sourceName"
36
+ )
37
+ name: StrictStr = Field(description="The name of the webhook")
38
+ event_key_expression: StrictStr = Field(
39
+ description="The CEL expression to use for the event key. This is used to create the event key from the webhook payload.",
40
+ alias="eventKeyExpression",
41
+ )
42
+ auth_type: StrictStr = Field(
43
+ description="The type of authentication to use for the webhook",
44
+ alias="authType",
45
+ )
46
+ auth: V1WebhookAPIKeyAuth
47
+ __properties: ClassVar[List[str]] = [
48
+ "sourceName",
49
+ "name",
50
+ "eventKeyExpression",
51
+ "authType",
52
+ "auth",
53
+ ]
54
+
55
+ @field_validator("auth_type")
56
+ def auth_type_validate_enum(cls, value):
57
+ """Validates the enum"""
58
+ if value not in set(["API_KEY"]):
59
+ raise ValueError("must be one of enum values ('API_KEY')")
60
+ return value
61
+
62
+ model_config = ConfigDict(
63
+ populate_by_name=True,
64
+ validate_assignment=True,
65
+ protected_namespaces=(),
66
+ )
67
+
68
+ def to_str(self) -> str:
69
+ """Returns the string representation of the model using alias"""
70
+ return pprint.pformat(self.model_dump(by_alias=True))
71
+
72
+ def to_json(self) -> str:
73
+ """Returns the JSON representation of the model using alias"""
74
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
75
+ return json.dumps(self.to_dict())
76
+
77
+ @classmethod
78
+ def from_json(cls, json_str: str) -> Optional[Self]:
79
+ """Create an instance of V1CreateWebhookRequestAPIKey from a JSON string"""
80
+ return cls.from_dict(json.loads(json_str))
81
+
82
+ def to_dict(self) -> Dict[str, Any]:
83
+ """Return the dictionary representation of the model using alias.
84
+
85
+ This has the following differences from calling pydantic's
86
+ `self.model_dump(by_alias=True)`:
87
+
88
+ * `None` is only added to the output dict for nullable fields that
89
+ were set at model initialization. Other fields with value `None`
90
+ are ignored.
91
+ """
92
+ excluded_fields: Set[str] = set([])
93
+
94
+ _dict = self.model_dump(
95
+ by_alias=True,
96
+ exclude=excluded_fields,
97
+ exclude_none=True,
98
+ )
99
+ # override the default output from pydantic by calling `to_dict()` of auth
100
+ if self.auth:
101
+ _dict["auth"] = self.auth.to_dict()
102
+ return _dict
103
+
104
+ @classmethod
105
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
106
+ """Create an instance of V1CreateWebhookRequestAPIKey from a dict"""
107
+ if obj is None:
108
+ return None
109
+
110
+ if not isinstance(obj, dict):
111
+ return cls.model_validate(obj)
112
+
113
+ _obj = cls.model_validate(
114
+ {
115
+ "sourceName": obj.get("sourceName"),
116
+ "name": obj.get("name"),
117
+ "eventKeyExpression": obj.get("eventKeyExpression"),
118
+ "authType": obj.get("authType"),
119
+ "auth": (
120
+ V1WebhookAPIKeyAuth.from_dict(obj["auth"])
121
+ if obj.get("auth") is not None
122
+ else None
123
+ ),
124
+ }
125
+ )
126
+ return _obj
@@ -0,0 +1,82 @@
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
+
26
+ class V1CreateWebhookRequestAPIKeyAllOfAuthType(BaseModel):
27
+ """
28
+ V1CreateWebhookRequestAPIKeyAllOfAuthType
29
+ """ # noqa: E501
30
+
31
+ __properties: ClassVar[List[str]] = []
32
+
33
+ model_config = ConfigDict(
34
+ populate_by_name=True,
35
+ validate_assignment=True,
36
+ protected_namespaces=(),
37
+ )
38
+
39
+ def to_str(self) -> str:
40
+ """Returns the string representation of the model using alias"""
41
+ return pprint.pformat(self.model_dump(by_alias=True))
42
+
43
+ def to_json(self) -> str:
44
+ """Returns the JSON representation of the model using alias"""
45
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
46
+ return json.dumps(self.to_dict())
47
+
48
+ @classmethod
49
+ def from_json(cls, json_str: str) -> Optional[Self]:
50
+ """Create an instance of V1CreateWebhookRequestAPIKeyAllOfAuthType from a JSON string"""
51
+ return cls.from_dict(json.loads(json_str))
52
+
53
+ def to_dict(self) -> Dict[str, Any]:
54
+ """Return the dictionary representation of the model using alias.
55
+
56
+ This has the following differences from calling pydantic's
57
+ `self.model_dump(by_alias=True)`:
58
+
59
+ * `None` is only added to the output dict for nullable fields that
60
+ were set at model initialization. Other fields with value `None`
61
+ are ignored.
62
+ """
63
+ excluded_fields: Set[str] = set([])
64
+
65
+ _dict = self.model_dump(
66
+ by_alias=True,
67
+ exclude=excluded_fields,
68
+ exclude_none=True,
69
+ )
70
+ return _dict
71
+
72
+ @classmethod
73
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
74
+ """Create an instance of V1CreateWebhookRequestAPIKeyAllOfAuthType from a dict"""
75
+ if obj is None:
76
+ return None
77
+
78
+ if not isinstance(obj, dict):
79
+ return cls.model_validate(obj)
80
+
81
+ _obj = cls.model_validate({})
82
+ 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.v1_webhook_source_name import V1WebhookSourceName
26
+
27
+
28
+ class V1CreateWebhookRequestBase(BaseModel):
29
+ """
30
+ V1CreateWebhookRequestBase
31
+ """ # noqa: E501
32
+
33
+ source_name: V1WebhookSourceName = Field(
34
+ description="The name of the source for this webhook", alias="sourceName"
35
+ )
36
+ name: StrictStr = Field(description="The name of the webhook")
37
+ event_key_expression: StrictStr = Field(
38
+ description="The CEL expression to use for the event key. This is used to create the event key from the webhook payload.",
39
+ alias="eventKeyExpression",
40
+ )
41
+ __properties: ClassVar[List[str]] = ["sourceName", "name", "eventKeyExpression"]
42
+
43
+ model_config = ConfigDict(
44
+ populate_by_name=True,
45
+ validate_assignment=True,
46
+ protected_namespaces=(),
47
+ )
48
+
49
+ def to_str(self) -> str:
50
+ """Returns the string representation of the model using alias"""
51
+ return pprint.pformat(self.model_dump(by_alias=True))
52
+
53
+ def to_json(self) -> str:
54
+ """Returns the JSON representation of the model using alias"""
55
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
56
+ return json.dumps(self.to_dict())
57
+
58
+ @classmethod
59
+ def from_json(cls, json_str: str) -> Optional[Self]:
60
+ """Create an instance of V1CreateWebhookRequestBase from a JSON string"""
61
+ return cls.from_dict(json.loads(json_str))
62
+
63
+ def to_dict(self) -> Dict[str, Any]:
64
+ """Return the dictionary representation of the model using alias.
65
+
66
+ This has the following differences from calling pydantic's
67
+ `self.model_dump(by_alias=True)`:
68
+
69
+ * `None` is only added to the output dict for nullable fields that
70
+ were set at model initialization. Other fields with value `None`
71
+ are ignored.
72
+ """
73
+ excluded_fields: Set[str] = set([])
74
+
75
+ _dict = self.model_dump(
76
+ by_alias=True,
77
+ exclude=excluded_fields,
78
+ exclude_none=True,
79
+ )
80
+ return _dict
81
+
82
+ @classmethod
83
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
84
+ """Create an instance of V1CreateWebhookRequestBase from a dict"""
85
+ if obj is None:
86
+ return None
87
+
88
+ if not isinstance(obj, dict):
89
+ return cls.model_validate(obj)
90
+
91
+ _obj = cls.model_validate(
92
+ {
93
+ "sourceName": obj.get("sourceName"),
94
+ "name": obj.get("name"),
95
+ "eventKeyExpression": obj.get("eventKeyExpression"),
96
+ }
97
+ )
98
+ return _obj
@@ -0,0 +1,126 @@
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, field_validator
23
+ from typing_extensions import Self
24
+
25
+ from hatchet_sdk.clients.rest.models.v1_webhook_basic_auth import V1WebhookBasicAuth
26
+ from hatchet_sdk.clients.rest.models.v1_webhook_source_name import V1WebhookSourceName
27
+
28
+
29
+ class V1CreateWebhookRequestBasicAuth(BaseModel):
30
+ """
31
+ V1CreateWebhookRequestBasicAuth
32
+ """ # noqa: E501
33
+
34
+ source_name: V1WebhookSourceName = Field(
35
+ description="The name of the source for this webhook", alias="sourceName"
36
+ )
37
+ name: StrictStr = Field(description="The name of the webhook")
38
+ event_key_expression: StrictStr = Field(
39
+ description="The CEL expression to use for the event key. This is used to create the event key from the webhook payload.",
40
+ alias="eventKeyExpression",
41
+ )
42
+ auth_type: StrictStr = Field(
43
+ description="The type of authentication to use for the webhook",
44
+ alias="authType",
45
+ )
46
+ auth: V1WebhookBasicAuth
47
+ __properties: ClassVar[List[str]] = [
48
+ "sourceName",
49
+ "name",
50
+ "eventKeyExpression",
51
+ "authType",
52
+ "auth",
53
+ ]
54
+
55
+ @field_validator("auth_type")
56
+ def auth_type_validate_enum(cls, value):
57
+ """Validates the enum"""
58
+ if value not in set(["BASIC"]):
59
+ raise ValueError("must be one of enum values ('BASIC')")
60
+ return value
61
+
62
+ model_config = ConfigDict(
63
+ populate_by_name=True,
64
+ validate_assignment=True,
65
+ protected_namespaces=(),
66
+ )
67
+
68
+ def to_str(self) -> str:
69
+ """Returns the string representation of the model using alias"""
70
+ return pprint.pformat(self.model_dump(by_alias=True))
71
+
72
+ def to_json(self) -> str:
73
+ """Returns the JSON representation of the model using alias"""
74
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
75
+ return json.dumps(self.to_dict())
76
+
77
+ @classmethod
78
+ def from_json(cls, json_str: str) -> Optional[Self]:
79
+ """Create an instance of V1CreateWebhookRequestBasicAuth from a JSON string"""
80
+ return cls.from_dict(json.loads(json_str))
81
+
82
+ def to_dict(self) -> Dict[str, Any]:
83
+ """Return the dictionary representation of the model using alias.
84
+
85
+ This has the following differences from calling pydantic's
86
+ `self.model_dump(by_alias=True)`:
87
+
88
+ * `None` is only added to the output dict for nullable fields that
89
+ were set at model initialization. Other fields with value `None`
90
+ are ignored.
91
+ """
92
+ excluded_fields: Set[str] = set([])
93
+
94
+ _dict = self.model_dump(
95
+ by_alias=True,
96
+ exclude=excluded_fields,
97
+ exclude_none=True,
98
+ )
99
+ # override the default output from pydantic by calling `to_dict()` of auth
100
+ if self.auth:
101
+ _dict["auth"] = self.auth.to_dict()
102
+ return _dict
103
+
104
+ @classmethod
105
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
106
+ """Create an instance of V1CreateWebhookRequestBasicAuth from a dict"""
107
+ if obj is None:
108
+ return None
109
+
110
+ if not isinstance(obj, dict):
111
+ return cls.model_validate(obj)
112
+
113
+ _obj = cls.model_validate(
114
+ {
115
+ "sourceName": obj.get("sourceName"),
116
+ "name": obj.get("name"),
117
+ "eventKeyExpression": obj.get("eventKeyExpression"),
118
+ "authType": obj.get("authType"),
119
+ "auth": (
120
+ V1WebhookBasicAuth.from_dict(obj["auth"])
121
+ if obj.get("auth") is not None
122
+ else None
123
+ ),
124
+ }
125
+ )
126
+ return _obj