hatchet-sdk 0.40.0a9__py3-none-any.whl → 0.42.0__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 (152) hide show
  1. hatchet_sdk/clients/admin.py +129 -59
  2. hatchet_sdk/clients/dispatcher/action_listener.py +25 -2
  3. hatchet_sdk/clients/events.py +91 -52
  4. hatchet_sdk/clients/rest/__init__.py +21 -0
  5. hatchet_sdk/clients/rest/api/api_token_api.py +12 -9
  6. hatchet_sdk/clients/rest/api/default_api.py +24 -18
  7. hatchet_sdk/clients/rest/api/event_api.py +32 -24
  8. hatchet_sdk/clients/rest/api/github_api.py +4 -3
  9. hatchet_sdk/clients/rest/api/log_api.py +4 -3
  10. hatchet_sdk/clients/rest/api/metadata_api.py +12 -9
  11. hatchet_sdk/clients/rest/api/rate_limits_api.py +7 -4
  12. hatchet_sdk/clients/rest/api/slack_api.py +8 -6
  13. hatchet_sdk/clients/rest/api/sns_api.py +12 -9
  14. hatchet_sdk/clients/rest/api/step_run_api.py +28 -21
  15. hatchet_sdk/clients/rest/api/tenant_api.py +67 -49
  16. hatchet_sdk/clients/rest/api/user_api.py +24 -18
  17. hatchet_sdk/clients/rest/api/worker_api.py +12 -9
  18. hatchet_sdk/clients/rest/api/workflow_api.py +3073 -936
  19. hatchet_sdk/clients/rest/api/workflow_run_api.py +669 -21
  20. hatchet_sdk/clients/rest/api_client.py +34 -11
  21. hatchet_sdk/clients/rest/configuration.py +161 -36
  22. hatchet_sdk/clients/rest/models/__init__.py +21 -0
  23. hatchet_sdk/clients/rest/models/api_errors.py +3 -3
  24. hatchet_sdk/clients/rest/models/bulk_create_event_request.py +3 -3
  25. hatchet_sdk/clients/rest/models/bulk_create_event_response.py +3 -3
  26. hatchet_sdk/clients/{cloud_rest/models/managed_worker_create_request_build_config_steps_inner.py → rest/models/create_cron_workflow_trigger_request.py} +18 -14
  27. hatchet_sdk/clients/{cloud_rest/models/github_app_list_installations200_response_rows_inner.py → rest/models/cron_workflows.py} +54 -21
  28. hatchet_sdk/clients/{cloud_rest/models/log_list200_response.py → rest/models/cron_workflows_list.py} +13 -22
  29. hatchet_sdk/clients/rest/models/cron_workflows_order_by_field.py +37 -0
  30. hatchet_sdk/clients/rest/models/event_list.py +3 -3
  31. hatchet_sdk/clients/rest/models/get_step_run_diff_response.py +3 -3
  32. hatchet_sdk/clients/rest/models/job.py +3 -3
  33. hatchet_sdk/clients/rest/models/job_run.py +3 -3
  34. hatchet_sdk/clients/rest/models/list_api_tokens_response.py +3 -3
  35. hatchet_sdk/clients/rest/models/list_pull_requests_response.py +3 -3
  36. hatchet_sdk/clients/rest/models/list_slack_webhooks.py +3 -3
  37. hatchet_sdk/clients/rest/models/list_sns_integrations.py +3 -3
  38. hatchet_sdk/clients/rest/models/log_line_list.py +3 -3
  39. hatchet_sdk/clients/rest/models/rate_limit_list.py +3 -3
  40. hatchet_sdk/clients/rest/models/replay_workflow_runs_response.py +3 -3
  41. hatchet_sdk/clients/{cloud_rest/models/log_list200_response_rows_inner.py → rest/models/schedule_workflow_run_request.py} +12 -12
  42. hatchet_sdk/clients/rest/models/scheduled_run_status.py +42 -0
  43. hatchet_sdk/clients/rest/models/scheduled_workflows.py +153 -0
  44. hatchet_sdk/clients/{cloud_rest/models/managed_worker_list200_response.py → rest/models/scheduled_workflows_list.py} +13 -22
  45. hatchet_sdk/clients/rest/models/scheduled_workflows_order_by_field.py +37 -0
  46. hatchet_sdk/clients/rest/models/step_run_archive_list.py +3 -3
  47. hatchet_sdk/clients/rest/models/step_run_event_list.py +3 -3
  48. hatchet_sdk/clients/rest/models/tenant_alert_email_group_list.py +3 -3
  49. hatchet_sdk/clients/rest/models/tenant_invite_list.py +3 -3
  50. hatchet_sdk/clients/rest/models/tenant_list.py +3 -3
  51. hatchet_sdk/clients/rest/models/tenant_member_list.py +3 -3
  52. hatchet_sdk/clients/rest/models/tenant_queue_metrics.py +16 -0
  53. hatchet_sdk/clients/rest/models/tenant_resource_policy.py +3 -3
  54. hatchet_sdk/clients/rest/models/tenant_step_run_queue_metrics.py +1 -1
  55. hatchet_sdk/clients/rest/models/user_tenant_memberships_list.py +3 -3
  56. hatchet_sdk/clients/rest/models/webhook_worker_list_response.py +3 -3
  57. hatchet_sdk/clients/rest/models/webhook_worker_request_list_response.py +3 -3
  58. hatchet_sdk/clients/rest/models/worker.py +20 -9
  59. hatchet_sdk/clients/rest/models/worker_list.py +3 -3
  60. hatchet_sdk/clients/{cloud_rest/models/tenant_billing_state_get200_response_payment_methods_inner.py → rest/models/worker_runtime_info.py} +23 -19
  61. hatchet_sdk/clients/rest/models/worker_runtime_sdks.py +38 -0
  62. hatchet_sdk/clients/rest/models/workflow.py +9 -9
  63. hatchet_sdk/clients/rest/models/workflow_list.py +3 -3
  64. hatchet_sdk/clients/rest/models/workflow_run.py +3 -3
  65. hatchet_sdk/clients/rest/models/workflow_run_list.py +3 -3
  66. hatchet_sdk/clients/rest/models/workflow_run_shape.py +3 -3
  67. hatchet_sdk/clients/rest/models/workflow_runs_metrics.py +1 -5
  68. hatchet_sdk/clients/rest/models/workflow_triggers.py +6 -6
  69. hatchet_sdk/clients/rest/models/workflow_version.py +3 -3
  70. hatchet_sdk/clients/rest/rest.py +3 -3
  71. hatchet_sdk/clients/rest_client.py +200 -21
  72. hatchet_sdk/contracts/dispatcher_pb2.py +71 -67
  73. hatchet_sdk/contracts/dispatcher_pb2.pyi +31 -2
  74. hatchet_sdk/contracts/events_pb2.pyi +2 -0
  75. hatchet_sdk/contracts/workflows_pb2.py +42 -40
  76. hatchet_sdk/contracts/workflows_pb2.pyi +24 -6
  77. hatchet_sdk/features/cron.py +286 -0
  78. hatchet_sdk/features/scheduled.py +248 -0
  79. hatchet_sdk/hatchet.py +80 -79
  80. hatchet_sdk/loader.py +37 -14
  81. hatchet_sdk/utils/serialization.py +15 -0
  82. hatchet_sdk/utils/tracing.py +67 -0
  83. hatchet_sdk/worker/runner/runner.py +158 -112
  84. hatchet_sdk/worker/worker.py +1 -17
  85. hatchet_sdk/workflow.py +4 -0
  86. {hatchet_sdk-0.40.0a9.dist-info → hatchet_sdk-0.42.0.dist-info}/METADATA +8 -2
  87. {hatchet_sdk-0.40.0a9.dist-info → hatchet_sdk-0.42.0.dist-info}/RECORD +89 -143
  88. {hatchet_sdk-0.40.0a9.dist-info → hatchet_sdk-0.42.0.dist-info}/entry_points.txt +1 -1
  89. hatchet_sdk/clients/cloud_rest/__init__.py +0 -186
  90. hatchet_sdk/clients/cloud_rest/api/__init__.py +0 -14
  91. hatchet_sdk/clients/cloud_rest/api/billing_api.py +0 -819
  92. hatchet_sdk/clients/cloud_rest/api/build_api.py +0 -298
  93. hatchet_sdk/clients/cloud_rest/api/feature_flags_api.py +0 -295
  94. hatchet_sdk/clients/cloud_rest/api/github_api.py +0 -1347
  95. hatchet_sdk/clients/cloud_rest/api/log_api.py +0 -971
  96. hatchet_sdk/clients/cloud_rest/api/managed_worker_api.py +0 -2546
  97. hatchet_sdk/clients/cloud_rest/api/metadata_api.py +0 -265
  98. hatchet_sdk/clients/cloud_rest/api/metrics_api.py +0 -1026
  99. hatchet_sdk/clients/cloud_rest/api/tenant_api.py +0 -301
  100. hatchet_sdk/clients/cloud_rest/api/user_api.py +0 -473
  101. hatchet_sdk/clients/cloud_rest/api/workflow_api.py +0 -369
  102. hatchet_sdk/clients/cloud_rest/api_client.py +0 -727
  103. hatchet_sdk/clients/cloud_rest/api_response.py +0 -22
  104. hatchet_sdk/clients/cloud_rest/configuration.py +0 -488
  105. hatchet_sdk/clients/cloud_rest/exceptions.py +0 -200
  106. hatchet_sdk/clients/cloud_rest/models/__init__.py +0 -157
  107. hatchet_sdk/clients/cloud_rest/models/billing_portal_link_get200_response.py +0 -85
  108. hatchet_sdk/clients/cloud_rest/models/build_get200_response.py +0 -121
  109. hatchet_sdk/clients/cloud_rest/models/github_app_list_branches200_response_inner.py +0 -86
  110. hatchet_sdk/clients/cloud_rest/models/github_app_list_installations200_response.py +0 -119
  111. hatchet_sdk/clients/cloud_rest/models/github_app_list_installations200_response_pagination.py +0 -95
  112. hatchet_sdk/clients/cloud_rest/models/github_app_list_installations200_response_rows_inner_metadata.py +0 -98
  113. hatchet_sdk/clients/cloud_rest/models/github_app_list_repos200_response_inner.py +0 -86
  114. hatchet_sdk/clients/cloud_rest/models/infra_as_code_create_request.py +0 -107
  115. hatchet_sdk/clients/cloud_rest/models/log_create_request_inner.py +0 -136
  116. hatchet_sdk/clients/cloud_rest/models/log_create_request_inner_event.py +0 -83
  117. hatchet_sdk/clients/cloud_rest/models/log_create_request_inner_fly.py +0 -100
  118. hatchet_sdk/clients/cloud_rest/models/log_create_request_inner_fly_app.py +0 -86
  119. hatchet_sdk/clients/cloud_rest/models/log_create_request_inner_log.py +0 -83
  120. hatchet_sdk/clients/cloud_rest/models/managed_worker_create_request.py +0 -128
  121. hatchet_sdk/clients/cloud_rest/models/managed_worker_create_request_build_config.py +0 -121
  122. hatchet_sdk/clients/cloud_rest/models/managed_worker_create_request_runtime_config.py +0 -166
  123. hatchet_sdk/clients/cloud_rest/models/managed_worker_events_list200_response.py +0 -119
  124. hatchet_sdk/clients/cloud_rest/models/managed_worker_events_list200_response_rows_inner.py +0 -117
  125. hatchet_sdk/clients/cloud_rest/models/managed_worker_instances_list200_response.py +0 -119
  126. hatchet_sdk/clients/cloud_rest/models/managed_worker_instances_list200_response_rows_inner.py +0 -113
  127. hatchet_sdk/clients/cloud_rest/models/managed_worker_list200_response_rows_inner.py +0 -154
  128. hatchet_sdk/clients/cloud_rest/models/managed_worker_list200_response_rows_inner_build_config.py +0 -151
  129. hatchet_sdk/clients/cloud_rest/models/managed_worker_list200_response_rows_inner_build_config_steps_inner.py +0 -109
  130. hatchet_sdk/clients/cloud_rest/models/managed_worker_list200_response_rows_inner_runtime_configs_inner.py +0 -171
  131. hatchet_sdk/clients/cloud_rest/models/managed_worker_update_request.py +0 -131
  132. hatchet_sdk/clients/cloud_rest/models/metadata_get200_response.py +0 -101
  133. hatchet_sdk/clients/cloud_rest/models/metadata_get400_response.py +0 -105
  134. hatchet_sdk/clients/cloud_rest/models/metadata_get400_response_errors_inner.py +0 -102
  135. hatchet_sdk/clients/cloud_rest/models/metrics_cpu_get200_response_inner.py +0 -108
  136. hatchet_sdk/clients/cloud_rest/models/metrics_cpu_get200_response_inner_histograms_inner.py +0 -102
  137. hatchet_sdk/clients/cloud_rest/models/metrics_cpu_get200_response_inner_histograms_inner_histogram.py +0 -113
  138. hatchet_sdk/clients/cloud_rest/models/metrics_cpu_get200_response_inner_histograms_inner_histogram_buckets_inner.py +0 -93
  139. hatchet_sdk/clients/cloud_rest/models/runtime_config_list_actions200_response.py +0 -83
  140. hatchet_sdk/clients/cloud_rest/models/subscription_upsert200_response.py +0 -114
  141. hatchet_sdk/clients/cloud_rest/models/subscription_upsert_request.py +0 -88
  142. hatchet_sdk/clients/cloud_rest/models/tenant_billing_state_get200_response.py +0 -170
  143. hatchet_sdk/clients/cloud_rest/models/tenant_billing_state_get200_response_coupons_inner.py +0 -137
  144. hatchet_sdk/clients/cloud_rest/models/tenant_billing_state_get200_response_plans_inner.py +0 -103
  145. hatchet_sdk/clients/cloud_rest/models/tenant_billing_state_get200_response_subscription.py +0 -114
  146. hatchet_sdk/clients/cloud_rest/models/workflow_run_events_get_metrics200_response.py +0 -107
  147. hatchet_sdk/clients/cloud_rest/models/workflow_run_events_get_metrics200_response_results_inner.py +0 -105
  148. hatchet_sdk/clients/cloud_rest/rest.py +0 -182
  149. hatchet_sdk/compute/__init__.py +0 -0
  150. hatchet_sdk/compute/configs.py +0 -34
  151. hatchet_sdk/compute/managed_compute.py +0 -111
  152. {hatchet_sdk-0.40.0a9.dist-info → hatchet_sdk-0.42.0.dist-info}/WHEEL +0 -0
@@ -1,114 +0,0 @@
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
-
26
- class SubscriptionUpsert200Response(BaseModel):
27
- """
28
- SubscriptionUpsert200Response
29
- """ # noqa: E501
30
-
31
- plan: Optional[StrictStr] = Field(
32
- default=None,
33
- description="The plan code associated with the tenant subscription.",
34
- )
35
- period: Optional[StrictStr] = Field(
36
- default=None, description="The period associated with the tenant subscription."
37
- )
38
- status: Optional[StrictStr] = Field(
39
- default=None, description="The status of the tenant subscription."
40
- )
41
- note: Optional[StrictStr] = Field(
42
- default=None, description="A note associated with the tenant subscription."
43
- )
44
- __properties: ClassVar[List[str]] = ["plan", "period", "status", "note"]
45
-
46
- @field_validator("status")
47
- def status_validate_enum(cls, value):
48
- """Validates the enum"""
49
- if value is None:
50
- return value
51
-
52
- if value not in set(["active", "pending", "terminated", "canceled"]):
53
- raise ValueError(
54
- "must be one of enum values ('active', 'pending', 'terminated', 'canceled')"
55
- )
56
- return value
57
-
58
- model_config = ConfigDict(
59
- populate_by_name=True,
60
- validate_assignment=True,
61
- protected_namespaces=(),
62
- )
63
-
64
- def to_str(self) -> str:
65
- """Returns the string representation of the model using alias"""
66
- return pprint.pformat(self.model_dump(by_alias=True))
67
-
68
- def to_json(self) -> str:
69
- """Returns the JSON representation of the model using alias"""
70
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
71
- return json.dumps(self.to_dict())
72
-
73
- @classmethod
74
- def from_json(cls, json_str: str) -> Optional[Self]:
75
- """Create an instance of SubscriptionUpsert200Response from a JSON string"""
76
- return cls.from_dict(json.loads(json_str))
77
-
78
- def to_dict(self) -> Dict[str, Any]:
79
- """Return the dictionary representation of the model using alias.
80
-
81
- This has the following differences from calling pydantic's
82
- `self.model_dump(by_alias=True)`:
83
-
84
- * `None` is only added to the output dict for nullable fields that
85
- were set at model initialization. Other fields with value `None`
86
- are ignored.
87
- """
88
- excluded_fields: Set[str] = set([])
89
-
90
- _dict = self.model_dump(
91
- by_alias=True,
92
- exclude=excluded_fields,
93
- exclude_none=True,
94
- )
95
- return _dict
96
-
97
- @classmethod
98
- def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
99
- """Create an instance of SubscriptionUpsert200Response from a dict"""
100
- if obj is None:
101
- return None
102
-
103
- if not isinstance(obj, dict):
104
- return cls.model_validate(obj)
105
-
106
- _obj = cls.model_validate(
107
- {
108
- "plan": obj.get("plan"),
109
- "period": obj.get("period"),
110
- "status": obj.get("status"),
111
- "note": obj.get("note"),
112
- }
113
- )
114
- return _obj
@@ -1,88 +0,0 @@
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 SubscriptionUpsertRequest(BaseModel):
27
- """
28
- SubscriptionUpsertRequest
29
- """ # noqa: E501
30
-
31
- plan: Optional[StrictStr] = Field(default=None, description="The code of the plan.")
32
- period: Optional[StrictStr] = Field(
33
- default=None, description="The period of the plan."
34
- )
35
- __properties: ClassVar[List[str]] = ["plan", "period"]
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 SubscriptionUpsertRequest 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
- return _dict
75
-
76
- @classmethod
77
- def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
78
- """Create an instance of SubscriptionUpsertRequest from a dict"""
79
- if obj is None:
80
- return None
81
-
82
- if not isinstance(obj, dict):
83
- return cls.model_validate(obj)
84
-
85
- _obj = cls.model_validate(
86
- {"plan": obj.get("plan"), "period": obj.get("period")}
87
- )
88
- return _obj
@@ -1,170 +0,0 @@
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
23
- from typing_extensions import Self
24
-
25
- from hatchet_sdk.clients.cloud_rest.models.tenant_billing_state_get200_response_coupons_inner import (
26
- TenantBillingStateGet200ResponseCouponsInner,
27
- )
28
- from hatchet_sdk.clients.cloud_rest.models.tenant_billing_state_get200_response_payment_methods_inner import (
29
- TenantBillingStateGet200ResponsePaymentMethodsInner,
30
- )
31
- from hatchet_sdk.clients.cloud_rest.models.tenant_billing_state_get200_response_plans_inner import (
32
- TenantBillingStateGet200ResponsePlansInner,
33
- )
34
- from hatchet_sdk.clients.cloud_rest.models.tenant_billing_state_get200_response_subscription import (
35
- TenantBillingStateGet200ResponseSubscription,
36
- )
37
-
38
-
39
- class TenantBillingStateGet200Response(BaseModel):
40
- """
41
- TenantBillingStateGet200Response
42
- """ # noqa: E501
43
-
44
- payment_methods: Optional[
45
- List[TenantBillingStateGet200ResponsePaymentMethodsInner]
46
- ] = Field(default=None, alias="paymentMethods")
47
- subscription: TenantBillingStateGet200ResponseSubscription
48
- plans: Optional[List[TenantBillingStateGet200ResponsePlansInner]] = Field(
49
- default=None, description="A list of plans available for the tenant."
50
- )
51
- coupons: Optional[List[TenantBillingStateGet200ResponseCouponsInner]] = Field(
52
- default=None, description="A list of coupons applied to the tenant."
53
- )
54
- __properties: ClassVar[List[str]] = [
55
- "paymentMethods",
56
- "subscription",
57
- "plans",
58
- "coupons",
59
- ]
60
-
61
- model_config = ConfigDict(
62
- populate_by_name=True,
63
- validate_assignment=True,
64
- protected_namespaces=(),
65
- )
66
-
67
- def to_str(self) -> str:
68
- """Returns the string representation of the model using alias"""
69
- return pprint.pformat(self.model_dump(by_alias=True))
70
-
71
- def to_json(self) -> str:
72
- """Returns the JSON representation of the model using alias"""
73
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
74
- return json.dumps(self.to_dict())
75
-
76
- @classmethod
77
- def from_json(cls, json_str: str) -> Optional[Self]:
78
- """Create an instance of TenantBillingStateGet200Response from a JSON string"""
79
- return cls.from_dict(json.loads(json_str))
80
-
81
- def to_dict(self) -> Dict[str, Any]:
82
- """Return the dictionary representation of the model using alias.
83
-
84
- This has the following differences from calling pydantic's
85
- `self.model_dump(by_alias=True)`:
86
-
87
- * `None` is only added to the output dict for nullable fields that
88
- were set at model initialization. Other fields with value `None`
89
- are ignored.
90
- """
91
- excluded_fields: Set[str] = set([])
92
-
93
- _dict = self.model_dump(
94
- by_alias=True,
95
- exclude=excluded_fields,
96
- exclude_none=True,
97
- )
98
- # override the default output from pydantic by calling `to_dict()` of each item in payment_methods (list)
99
- _items = []
100
- if self.payment_methods:
101
- for _item in self.payment_methods:
102
- if _item:
103
- _items.append(_item.to_dict())
104
- _dict["paymentMethods"] = _items
105
- # override the default output from pydantic by calling `to_dict()` of subscription
106
- if self.subscription:
107
- _dict["subscription"] = self.subscription.to_dict()
108
- # override the default output from pydantic by calling `to_dict()` of each item in plans (list)
109
- _items = []
110
- if self.plans:
111
- for _item in self.plans:
112
- if _item:
113
- _items.append(_item.to_dict())
114
- _dict["plans"] = _items
115
- # override the default output from pydantic by calling `to_dict()` of each item in coupons (list)
116
- _items = []
117
- if self.coupons:
118
- for _item in self.coupons:
119
- if _item:
120
- _items.append(_item.to_dict())
121
- _dict["coupons"] = _items
122
- return _dict
123
-
124
- @classmethod
125
- def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
126
- """Create an instance of TenantBillingStateGet200Response from a dict"""
127
- if obj is None:
128
- return None
129
-
130
- if not isinstance(obj, dict):
131
- return cls.model_validate(obj)
132
-
133
- _obj = cls.model_validate(
134
- {
135
- "paymentMethods": (
136
- [
137
- TenantBillingStateGet200ResponsePaymentMethodsInner.from_dict(
138
- _item
139
- )
140
- for _item in obj["paymentMethods"]
141
- ]
142
- if obj.get("paymentMethods") is not None
143
- else None
144
- ),
145
- "subscription": (
146
- TenantBillingStateGet200ResponseSubscription.from_dict(
147
- obj["subscription"]
148
- )
149
- if obj.get("subscription") is not None
150
- else None
151
- ),
152
- "plans": (
153
- [
154
- TenantBillingStateGet200ResponsePlansInner.from_dict(_item)
155
- for _item in obj["plans"]
156
- ]
157
- if obj.get("plans") is not None
158
- else None
159
- ),
160
- "coupons": (
161
- [
162
- TenantBillingStateGet200ResponseCouponsInner.from_dict(_item)
163
- for _item in obj["coupons"]
164
- ]
165
- if obj.get("coupons") is not None
166
- else None
167
- ),
168
- }
169
- )
170
- return _obj
@@ -1,137 +0,0 @@
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, Union
21
-
22
- from pydantic import (
23
- BaseModel,
24
- ConfigDict,
25
- Field,
26
- StrictFloat,
27
- StrictInt,
28
- StrictStr,
29
- field_validator,
30
- )
31
- from typing_extensions import Self
32
-
33
-
34
- class TenantBillingStateGet200ResponseCouponsInner(BaseModel):
35
- """
36
- TenantBillingStateGet200ResponseCouponsInner
37
- """ # noqa: E501
38
-
39
- name: StrictStr = Field(description="The name of the coupon.")
40
- amount_cents: Optional[StrictInt] = Field(
41
- default=None, description="The amount off of the coupon."
42
- )
43
- amount_cents_remaining: Optional[StrictInt] = Field(
44
- default=None, description="The amount remaining on the coupon."
45
- )
46
- amount_currency: Optional[StrictStr] = Field(
47
- default=None, description="The currency of the coupon."
48
- )
49
- frequency: StrictStr = Field(description="The frequency of the coupon.")
50
- frequency_duration: Optional[StrictInt] = Field(
51
- default=None, description="The frequency duration of the coupon."
52
- )
53
- frequency_duration_remaining: Optional[StrictInt] = Field(
54
- default=None, description="The frequency duration remaining of the coupon."
55
- )
56
- percent: Optional[Union[StrictFloat, StrictInt]] = Field(
57
- default=None, description="The percentage off of the coupon."
58
- )
59
- __properties: ClassVar[List[str]] = [
60
- "name",
61
- "amount_cents",
62
- "amount_cents_remaining",
63
- "amount_currency",
64
- "frequency",
65
- "frequency_duration",
66
- "frequency_duration_remaining",
67
- "percent",
68
- ]
69
-
70
- @field_validator("frequency")
71
- def frequency_validate_enum(cls, value):
72
- """Validates the enum"""
73
- if value not in set(["once", "recurring"]):
74
- raise ValueError("must be one of enum values ('once', 'recurring')")
75
- return value
76
-
77
- model_config = ConfigDict(
78
- populate_by_name=True,
79
- validate_assignment=True,
80
- protected_namespaces=(),
81
- )
82
-
83
- def to_str(self) -> str:
84
- """Returns the string representation of the model using alias"""
85
- return pprint.pformat(self.model_dump(by_alias=True))
86
-
87
- def to_json(self) -> str:
88
- """Returns the JSON representation of the model using alias"""
89
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
90
- return json.dumps(self.to_dict())
91
-
92
- @classmethod
93
- def from_json(cls, json_str: str) -> Optional[Self]:
94
- """Create an instance of TenantBillingStateGet200ResponseCouponsInner from a JSON string"""
95
- return cls.from_dict(json.loads(json_str))
96
-
97
- def to_dict(self) -> Dict[str, Any]:
98
- """Return the dictionary representation of the model using alias.
99
-
100
- This has the following differences from calling pydantic's
101
- `self.model_dump(by_alias=True)`:
102
-
103
- * `None` is only added to the output dict for nullable fields that
104
- were set at model initialization. Other fields with value `None`
105
- are ignored.
106
- """
107
- excluded_fields: Set[str] = set([])
108
-
109
- _dict = self.model_dump(
110
- by_alias=True,
111
- exclude=excluded_fields,
112
- exclude_none=True,
113
- )
114
- return _dict
115
-
116
- @classmethod
117
- def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
118
- """Create an instance of TenantBillingStateGet200ResponseCouponsInner from a dict"""
119
- if obj is None:
120
- return None
121
-
122
- if not isinstance(obj, dict):
123
- return cls.model_validate(obj)
124
-
125
- _obj = cls.model_validate(
126
- {
127
- "name": obj.get("name"),
128
- "amount_cents": obj.get("amount_cents"),
129
- "amount_cents_remaining": obj.get("amount_cents_remaining"),
130
- "amount_currency": obj.get("amount_currency"),
131
- "frequency": obj.get("frequency"),
132
- "frequency_duration": obj.get("frequency_duration"),
133
- "frequency_duration_remaining": obj.get("frequency_duration_remaining"),
134
- "percent": obj.get("percent"),
135
- }
136
- )
137
- return _obj
@@ -1,103 +0,0 @@
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, StrictInt, StrictStr
23
- from typing_extensions import Self
24
-
25
-
26
- class TenantBillingStateGet200ResponsePlansInner(BaseModel):
27
- """
28
- TenantBillingStateGet200ResponsePlansInner
29
- """ # noqa: E501
30
-
31
- plan_code: StrictStr = Field(description="The code of the plan.")
32
- name: StrictStr = Field(description="The name of the plan.")
33
- description: StrictStr = Field(description="The description of the plan.")
34
- amount_cents: StrictInt = Field(description="The price of the plan.")
35
- period: Optional[StrictStr] = Field(
36
- default=None, description="The period of the plan."
37
- )
38
- __properties: ClassVar[List[str]] = [
39
- "plan_code",
40
- "name",
41
- "description",
42
- "amount_cents",
43
- "period",
44
- ]
45
-
46
- model_config = ConfigDict(
47
- populate_by_name=True,
48
- validate_assignment=True,
49
- protected_namespaces=(),
50
- )
51
-
52
- def to_str(self) -> str:
53
- """Returns the string representation of the model using alias"""
54
- return pprint.pformat(self.model_dump(by_alias=True))
55
-
56
- def to_json(self) -> str:
57
- """Returns the JSON representation of the model using alias"""
58
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
59
- return json.dumps(self.to_dict())
60
-
61
- @classmethod
62
- def from_json(cls, json_str: str) -> Optional[Self]:
63
- """Create an instance of TenantBillingStateGet200ResponsePlansInner from a JSON string"""
64
- return cls.from_dict(json.loads(json_str))
65
-
66
- def to_dict(self) -> Dict[str, Any]:
67
- """Return the dictionary representation of the model using alias.
68
-
69
- This has the following differences from calling pydantic's
70
- `self.model_dump(by_alias=True)`:
71
-
72
- * `None` is only added to the output dict for nullable fields that
73
- were set at model initialization. Other fields with value `None`
74
- are ignored.
75
- """
76
- excluded_fields: Set[str] = set([])
77
-
78
- _dict = self.model_dump(
79
- by_alias=True,
80
- exclude=excluded_fields,
81
- exclude_none=True,
82
- )
83
- return _dict
84
-
85
- @classmethod
86
- def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
87
- """Create an instance of TenantBillingStateGet200ResponsePlansInner from a dict"""
88
- if obj is None:
89
- return None
90
-
91
- if not isinstance(obj, dict):
92
- return cls.model_validate(obj)
93
-
94
- _obj = cls.model_validate(
95
- {
96
- "plan_code": obj.get("plan_code"),
97
- "name": obj.get("name"),
98
- "description": obj.get("description"),
99
- "amount_cents": obj.get("amount_cents"),
100
- "period": obj.get("period"),
101
- }
102
- )
103
- return _obj