hatchet-sdk 0.40.0a8__py3-none-any.whl → 0.41.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 (149) 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.pyi +2 -0
  73. hatchet_sdk/contracts/events_pb2.pyi +2 -0
  74. hatchet_sdk/contracts/workflows_pb2.pyi +2 -0
  75. hatchet_sdk/features/cron.py +286 -0
  76. hatchet_sdk/features/scheduled.py +248 -0
  77. hatchet_sdk/hatchet.py +71 -79
  78. hatchet_sdk/loader.py +37 -14
  79. hatchet_sdk/utils/serialization.py +15 -0
  80. hatchet_sdk/utils/tracing.py +67 -0
  81. hatchet_sdk/worker/runner/runner.py +158 -112
  82. hatchet_sdk/worker/worker.py +1 -17
  83. {hatchet_sdk-0.40.0a8.dist-info → hatchet_sdk-0.41.0.dist-info}/METADATA +8 -2
  84. {hatchet_sdk-0.40.0a8.dist-info → hatchet_sdk-0.41.0.dist-info}/RECORD +86 -140
  85. {hatchet_sdk-0.40.0a8.dist-info → hatchet_sdk-0.41.0.dist-info}/entry_points.txt +0 -1
  86. hatchet_sdk/clients/cloud_rest/__init__.py +0 -186
  87. hatchet_sdk/clients/cloud_rest/api/__init__.py +0 -14
  88. hatchet_sdk/clients/cloud_rest/api/billing_api.py +0 -819
  89. hatchet_sdk/clients/cloud_rest/api/build_api.py +0 -298
  90. hatchet_sdk/clients/cloud_rest/api/feature_flags_api.py +0 -295
  91. hatchet_sdk/clients/cloud_rest/api/github_api.py +0 -1347
  92. hatchet_sdk/clients/cloud_rest/api/log_api.py +0 -971
  93. hatchet_sdk/clients/cloud_rest/api/managed_worker_api.py +0 -2546
  94. hatchet_sdk/clients/cloud_rest/api/metadata_api.py +0 -265
  95. hatchet_sdk/clients/cloud_rest/api/metrics_api.py +0 -1026
  96. hatchet_sdk/clients/cloud_rest/api/tenant_api.py +0 -301
  97. hatchet_sdk/clients/cloud_rest/api/user_api.py +0 -473
  98. hatchet_sdk/clients/cloud_rest/api/workflow_api.py +0 -369
  99. hatchet_sdk/clients/cloud_rest/api_client.py +0 -727
  100. hatchet_sdk/clients/cloud_rest/api_response.py +0 -22
  101. hatchet_sdk/clients/cloud_rest/configuration.py +0 -488
  102. hatchet_sdk/clients/cloud_rest/exceptions.py +0 -200
  103. hatchet_sdk/clients/cloud_rest/models/__init__.py +0 -157
  104. hatchet_sdk/clients/cloud_rest/models/billing_portal_link_get200_response.py +0 -85
  105. hatchet_sdk/clients/cloud_rest/models/build_get200_response.py +0 -121
  106. hatchet_sdk/clients/cloud_rest/models/github_app_list_branches200_response_inner.py +0 -86
  107. hatchet_sdk/clients/cloud_rest/models/github_app_list_installations200_response.py +0 -119
  108. hatchet_sdk/clients/cloud_rest/models/github_app_list_installations200_response_pagination.py +0 -95
  109. hatchet_sdk/clients/cloud_rest/models/github_app_list_installations200_response_rows_inner_metadata.py +0 -98
  110. hatchet_sdk/clients/cloud_rest/models/github_app_list_repos200_response_inner.py +0 -86
  111. hatchet_sdk/clients/cloud_rest/models/infra_as_code_create_request.py +0 -107
  112. hatchet_sdk/clients/cloud_rest/models/log_create_request_inner.py +0 -136
  113. hatchet_sdk/clients/cloud_rest/models/log_create_request_inner_event.py +0 -83
  114. hatchet_sdk/clients/cloud_rest/models/log_create_request_inner_fly.py +0 -100
  115. hatchet_sdk/clients/cloud_rest/models/log_create_request_inner_fly_app.py +0 -86
  116. hatchet_sdk/clients/cloud_rest/models/log_create_request_inner_log.py +0 -83
  117. hatchet_sdk/clients/cloud_rest/models/managed_worker_create_request.py +0 -128
  118. hatchet_sdk/clients/cloud_rest/models/managed_worker_create_request_build_config.py +0 -121
  119. hatchet_sdk/clients/cloud_rest/models/managed_worker_create_request_runtime_config.py +0 -166
  120. hatchet_sdk/clients/cloud_rest/models/managed_worker_events_list200_response.py +0 -119
  121. hatchet_sdk/clients/cloud_rest/models/managed_worker_events_list200_response_rows_inner.py +0 -117
  122. hatchet_sdk/clients/cloud_rest/models/managed_worker_instances_list200_response.py +0 -119
  123. hatchet_sdk/clients/cloud_rest/models/managed_worker_instances_list200_response_rows_inner.py +0 -113
  124. hatchet_sdk/clients/cloud_rest/models/managed_worker_list200_response_rows_inner.py +0 -154
  125. hatchet_sdk/clients/cloud_rest/models/managed_worker_list200_response_rows_inner_build_config.py +0 -151
  126. hatchet_sdk/clients/cloud_rest/models/managed_worker_list200_response_rows_inner_build_config_steps_inner.py +0 -109
  127. hatchet_sdk/clients/cloud_rest/models/managed_worker_list200_response_rows_inner_runtime_configs_inner.py +0 -171
  128. hatchet_sdk/clients/cloud_rest/models/managed_worker_update_request.py +0 -131
  129. hatchet_sdk/clients/cloud_rest/models/metadata_get200_response.py +0 -101
  130. hatchet_sdk/clients/cloud_rest/models/metadata_get400_response.py +0 -105
  131. hatchet_sdk/clients/cloud_rest/models/metadata_get400_response_errors_inner.py +0 -102
  132. hatchet_sdk/clients/cloud_rest/models/metrics_cpu_get200_response_inner.py +0 -108
  133. hatchet_sdk/clients/cloud_rest/models/metrics_cpu_get200_response_inner_histograms_inner.py +0 -102
  134. hatchet_sdk/clients/cloud_rest/models/metrics_cpu_get200_response_inner_histograms_inner_histogram.py +0 -113
  135. hatchet_sdk/clients/cloud_rest/models/metrics_cpu_get200_response_inner_histograms_inner_histogram_buckets_inner.py +0 -93
  136. hatchet_sdk/clients/cloud_rest/models/runtime_config_list_actions200_response.py +0 -83
  137. hatchet_sdk/clients/cloud_rest/models/subscription_upsert200_response.py +0 -114
  138. hatchet_sdk/clients/cloud_rest/models/subscription_upsert_request.py +0 -88
  139. hatchet_sdk/clients/cloud_rest/models/tenant_billing_state_get200_response.py +0 -170
  140. hatchet_sdk/clients/cloud_rest/models/tenant_billing_state_get200_response_coupons_inner.py +0 -137
  141. hatchet_sdk/clients/cloud_rest/models/tenant_billing_state_get200_response_plans_inner.py +0 -103
  142. hatchet_sdk/clients/cloud_rest/models/tenant_billing_state_get200_response_subscription.py +0 -114
  143. hatchet_sdk/clients/cloud_rest/models/workflow_run_events_get_metrics200_response.py +0 -107
  144. hatchet_sdk/clients/cloud_rest/models/workflow_run_events_get_metrics200_response_results_inner.py +0 -105
  145. hatchet_sdk/clients/cloud_rest/rest.py +0 -182
  146. hatchet_sdk/compute/__init__.py +0 -0
  147. hatchet_sdk/compute/configs.py +0 -34
  148. hatchet_sdk/compute/managed_compute.py +0 -111
  149. {hatchet_sdk-0.40.0a8.dist-info → hatchet_sdk-0.41.0.dist-info}/WHEEL +0 -0
@@ -1,819 +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
- import warnings
15
- from typing import Any, Dict, List, Optional, Tuple, Union
16
-
17
- from pydantic import Field, StrictFloat, StrictInt, StrictStr, validate_call
18
- from typing_extensions import Annotated
19
-
20
- from hatchet_sdk.clients.cloud_rest.api_client import ApiClient, RequestSerialized
21
- from hatchet_sdk.clients.cloud_rest.api_response import ApiResponse
22
- from hatchet_sdk.clients.cloud_rest.models.billing_portal_link_get200_response import (
23
- BillingPortalLinkGet200Response,
24
- )
25
- from hatchet_sdk.clients.cloud_rest.models.subscription_upsert200_response import (
26
- SubscriptionUpsert200Response,
27
- )
28
- from hatchet_sdk.clients.cloud_rest.models.subscription_upsert_request import (
29
- SubscriptionUpsertRequest,
30
- )
31
- from hatchet_sdk.clients.cloud_rest.rest import RESTResponseType
32
-
33
-
34
- class BillingApi:
35
- """NOTE: This class is auto generated by OpenAPI Generator
36
- Ref: https://openapi-generator.tech
37
-
38
- Do not edit the class manually.
39
- """
40
-
41
- def __init__(self, api_client=None) -> None:
42
- if api_client is None:
43
- api_client = ApiClient.get_default()
44
- self.api_client = api_client
45
-
46
- @validate_call
47
- async def billing_portal_link_get(
48
- self,
49
- tenant: Annotated[
50
- str,
51
- Field(
52
- min_length=36, strict=True, max_length=36, description="The tenant id"
53
- ),
54
- ],
55
- _request_timeout: Union[
56
- None,
57
- Annotated[StrictFloat, Field(gt=0)],
58
- Tuple[
59
- Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]
60
- ],
61
- ] = None,
62
- _request_auth: Optional[Dict[StrictStr, Any]] = None,
63
- _content_type: Optional[StrictStr] = None,
64
- _headers: Optional[Dict[StrictStr, Any]] = None,
65
- _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
66
- ) -> BillingPortalLinkGet200Response:
67
- """Create a link to the billing portal
68
-
69
- Get the billing portal link
70
-
71
- :param tenant: The tenant id (required)
72
- :type tenant: str
73
- :param _request_timeout: timeout setting for this request. If one
74
- number provided, it will be total request
75
- timeout. It can also be a pair (tuple) of
76
- (connection, read) timeouts.
77
- :type _request_timeout: int, tuple(int, int), optional
78
- :param _request_auth: set to override the auth_settings for an a single
79
- request; this effectively ignores the
80
- authentication in the spec for a single request.
81
- :type _request_auth: dict, optional
82
- :param _content_type: force content-type for the request.
83
- :type _content_type: str, Optional
84
- :param _headers: set to override the headers for a single
85
- request; this effectively ignores the headers
86
- in the spec for a single request.
87
- :type _headers: dict, optional
88
- :param _host_index: set to override the host_index for a single
89
- request; this effectively ignores the host_index
90
- in the spec for a single request.
91
- :type _host_index: int, optional
92
- :return: Returns the result object.
93
- """ # noqa: E501
94
-
95
- _param = self._billing_portal_link_get_serialize(
96
- tenant=tenant,
97
- _request_auth=_request_auth,
98
- _content_type=_content_type,
99
- _headers=_headers,
100
- _host_index=_host_index,
101
- )
102
-
103
- _response_types_map: Dict[str, Optional[str]] = {
104
- "200": "BillingPortalLinkGet200Response",
105
- "400": "MetadataGet400Response",
106
- "403": "MetadataGet400Response",
107
- }
108
- response_data = await self.api_client.call_api(
109
- *_param, _request_timeout=_request_timeout
110
- )
111
- await response_data.read()
112
- return self.api_client.response_deserialize(
113
- response_data=response_data,
114
- response_types_map=_response_types_map,
115
- ).data
116
-
117
- @validate_call
118
- async def billing_portal_link_get_with_http_info(
119
- self,
120
- tenant: Annotated[
121
- str,
122
- Field(
123
- min_length=36, strict=True, max_length=36, description="The tenant id"
124
- ),
125
- ],
126
- _request_timeout: Union[
127
- None,
128
- Annotated[StrictFloat, Field(gt=0)],
129
- Tuple[
130
- Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]
131
- ],
132
- ] = None,
133
- _request_auth: Optional[Dict[StrictStr, Any]] = None,
134
- _content_type: Optional[StrictStr] = None,
135
- _headers: Optional[Dict[StrictStr, Any]] = None,
136
- _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
137
- ) -> ApiResponse[BillingPortalLinkGet200Response]:
138
- """Create a link to the billing portal
139
-
140
- Get the billing portal link
141
-
142
- :param tenant: The tenant id (required)
143
- :type tenant: str
144
- :param _request_timeout: timeout setting for this request. If one
145
- number provided, it will be total request
146
- timeout. It can also be a pair (tuple) of
147
- (connection, read) timeouts.
148
- :type _request_timeout: int, tuple(int, int), optional
149
- :param _request_auth: set to override the auth_settings for an a single
150
- request; this effectively ignores the
151
- authentication in the spec for a single request.
152
- :type _request_auth: dict, optional
153
- :param _content_type: force content-type for the request.
154
- :type _content_type: str, Optional
155
- :param _headers: set to override the headers for a single
156
- request; this effectively ignores the headers
157
- in the spec for a single request.
158
- :type _headers: dict, optional
159
- :param _host_index: set to override the host_index for a single
160
- request; this effectively ignores the host_index
161
- in the spec for a single request.
162
- :type _host_index: int, optional
163
- :return: Returns the result object.
164
- """ # noqa: E501
165
-
166
- _param = self._billing_portal_link_get_serialize(
167
- tenant=tenant,
168
- _request_auth=_request_auth,
169
- _content_type=_content_type,
170
- _headers=_headers,
171
- _host_index=_host_index,
172
- )
173
-
174
- _response_types_map: Dict[str, Optional[str]] = {
175
- "200": "BillingPortalLinkGet200Response",
176
- "400": "MetadataGet400Response",
177
- "403": "MetadataGet400Response",
178
- }
179
- response_data = await self.api_client.call_api(
180
- *_param, _request_timeout=_request_timeout
181
- )
182
- await response_data.read()
183
- return self.api_client.response_deserialize(
184
- response_data=response_data,
185
- response_types_map=_response_types_map,
186
- )
187
-
188
- @validate_call
189
- async def billing_portal_link_get_without_preload_content(
190
- self,
191
- tenant: Annotated[
192
- str,
193
- Field(
194
- min_length=36, strict=True, max_length=36, description="The tenant id"
195
- ),
196
- ],
197
- _request_timeout: Union[
198
- None,
199
- Annotated[StrictFloat, Field(gt=0)],
200
- Tuple[
201
- Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]
202
- ],
203
- ] = None,
204
- _request_auth: Optional[Dict[StrictStr, Any]] = None,
205
- _content_type: Optional[StrictStr] = None,
206
- _headers: Optional[Dict[StrictStr, Any]] = None,
207
- _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
208
- ) -> RESTResponseType:
209
- """Create a link to the billing portal
210
-
211
- Get the billing portal link
212
-
213
- :param tenant: The tenant id (required)
214
- :type tenant: str
215
- :param _request_timeout: timeout setting for this request. If one
216
- number provided, it will be total request
217
- timeout. It can also be a pair (tuple) of
218
- (connection, read) timeouts.
219
- :type _request_timeout: int, tuple(int, int), optional
220
- :param _request_auth: set to override the auth_settings for an a single
221
- request; this effectively ignores the
222
- authentication in the spec for a single request.
223
- :type _request_auth: dict, optional
224
- :param _content_type: force content-type for the request.
225
- :type _content_type: str, Optional
226
- :param _headers: set to override the headers for a single
227
- request; this effectively ignores the headers
228
- in the spec for a single request.
229
- :type _headers: dict, optional
230
- :param _host_index: set to override the host_index for a single
231
- request; this effectively ignores the host_index
232
- in the spec for a single request.
233
- :type _host_index: int, optional
234
- :return: Returns the result object.
235
- """ # noqa: E501
236
-
237
- _param = self._billing_portal_link_get_serialize(
238
- tenant=tenant,
239
- _request_auth=_request_auth,
240
- _content_type=_content_type,
241
- _headers=_headers,
242
- _host_index=_host_index,
243
- )
244
-
245
- _response_types_map: Dict[str, Optional[str]] = {
246
- "200": "BillingPortalLinkGet200Response",
247
- "400": "MetadataGet400Response",
248
- "403": "MetadataGet400Response",
249
- }
250
- response_data = await self.api_client.call_api(
251
- *_param, _request_timeout=_request_timeout
252
- )
253
- return response_data.response
254
-
255
- def _billing_portal_link_get_serialize(
256
- self,
257
- tenant,
258
- _request_auth,
259
- _content_type,
260
- _headers,
261
- _host_index,
262
- ) -> RequestSerialized:
263
-
264
- _host = None
265
-
266
- _collection_formats: Dict[str, str] = {}
267
-
268
- _path_params: Dict[str, str] = {}
269
- _query_params: List[Tuple[str, str]] = []
270
- _header_params: Dict[str, Optional[str]] = _headers or {}
271
- _form_params: List[Tuple[str, str]] = []
272
- _files: Dict[str, Union[str, bytes]] = {}
273
- _body_params: Optional[bytes] = None
274
-
275
- # process the path parameters
276
- if tenant is not None:
277
- _path_params["tenant"] = tenant
278
- # process the query parameters
279
- # process the header parameters
280
- # process the form parameters
281
- # process the body parameter
282
-
283
- # set the HTTP header `Accept`
284
- _header_params["Accept"] = self.api_client.select_header_accept(
285
- ["application/json"]
286
- )
287
-
288
- # authentication setting
289
- _auth_settings: List[str] = ["cookieAuth", "bearerAuth"]
290
-
291
- return self.api_client.param_serialize(
292
- method="GET",
293
- resource_path="/api/v1/billing/tenants/{tenant}/billing-portal-link",
294
- path_params=_path_params,
295
- query_params=_query_params,
296
- header_params=_header_params,
297
- body=_body_params,
298
- post_params=_form_params,
299
- files=_files,
300
- auth_settings=_auth_settings,
301
- collection_formats=_collection_formats,
302
- _host=_host,
303
- _request_auth=_request_auth,
304
- )
305
-
306
- @validate_call
307
- async def lago_message_create(
308
- self,
309
- _request_timeout: Union[
310
- None,
311
- Annotated[StrictFloat, Field(gt=0)],
312
- Tuple[
313
- Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]
314
- ],
315
- ] = None,
316
- _request_auth: Optional[Dict[StrictStr, Any]] = None,
317
- _content_type: Optional[StrictStr] = None,
318
- _headers: Optional[Dict[StrictStr, Any]] = None,
319
- _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
320
- ) -> None:
321
- """Receive a webhook message from Lago
322
-
323
- Receive a webhook message from Lago
324
-
325
- :param _request_timeout: timeout setting for this request. If one
326
- number provided, it will be total request
327
- timeout. It can also be a pair (tuple) of
328
- (connection, read) timeouts.
329
- :type _request_timeout: int, tuple(int, int), optional
330
- :param _request_auth: set to override the auth_settings for an a single
331
- request; this effectively ignores the
332
- authentication in the spec for a single request.
333
- :type _request_auth: dict, optional
334
- :param _content_type: force content-type for the request.
335
- :type _content_type: str, Optional
336
- :param _headers: set to override the headers for a single
337
- request; this effectively ignores the headers
338
- in the spec for a single request.
339
- :type _headers: dict, optional
340
- :param _host_index: set to override the host_index for a single
341
- request; this effectively ignores the host_index
342
- in the spec for a single request.
343
- :type _host_index: int, optional
344
- :return: Returns the result object.
345
- """ # noqa: E501
346
-
347
- _param = self._lago_message_create_serialize(
348
- _request_auth=_request_auth,
349
- _content_type=_content_type,
350
- _headers=_headers,
351
- _host_index=_host_index,
352
- )
353
-
354
- _response_types_map: Dict[str, Optional[str]] = {
355
- "200": None,
356
- "400": "MetadataGet400Response",
357
- "403": "MetadataGet400Response",
358
- }
359
- response_data = await self.api_client.call_api(
360
- *_param, _request_timeout=_request_timeout
361
- )
362
- await response_data.read()
363
- return self.api_client.response_deserialize(
364
- response_data=response_data,
365
- response_types_map=_response_types_map,
366
- ).data
367
-
368
- @validate_call
369
- async def lago_message_create_with_http_info(
370
- self,
371
- _request_timeout: Union[
372
- None,
373
- Annotated[StrictFloat, Field(gt=0)],
374
- Tuple[
375
- Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]
376
- ],
377
- ] = None,
378
- _request_auth: Optional[Dict[StrictStr, Any]] = None,
379
- _content_type: Optional[StrictStr] = None,
380
- _headers: Optional[Dict[StrictStr, Any]] = None,
381
- _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
382
- ) -> ApiResponse[None]:
383
- """Receive a webhook message from Lago
384
-
385
- Receive a webhook message from Lago
386
-
387
- :param _request_timeout: timeout setting for this request. If one
388
- number provided, it will be total request
389
- timeout. It can also be a pair (tuple) of
390
- (connection, read) timeouts.
391
- :type _request_timeout: int, tuple(int, int), optional
392
- :param _request_auth: set to override the auth_settings for an a single
393
- request; this effectively ignores the
394
- authentication in the spec for a single request.
395
- :type _request_auth: dict, optional
396
- :param _content_type: force content-type for the request.
397
- :type _content_type: str, Optional
398
- :param _headers: set to override the headers for a single
399
- request; this effectively ignores the headers
400
- in the spec for a single request.
401
- :type _headers: dict, optional
402
- :param _host_index: set to override the host_index for a single
403
- request; this effectively ignores the host_index
404
- in the spec for a single request.
405
- :type _host_index: int, optional
406
- :return: Returns the result object.
407
- """ # noqa: E501
408
-
409
- _param = self._lago_message_create_serialize(
410
- _request_auth=_request_auth,
411
- _content_type=_content_type,
412
- _headers=_headers,
413
- _host_index=_host_index,
414
- )
415
-
416
- _response_types_map: Dict[str, Optional[str]] = {
417
- "200": None,
418
- "400": "MetadataGet400Response",
419
- "403": "MetadataGet400Response",
420
- }
421
- response_data = await self.api_client.call_api(
422
- *_param, _request_timeout=_request_timeout
423
- )
424
- await response_data.read()
425
- return self.api_client.response_deserialize(
426
- response_data=response_data,
427
- response_types_map=_response_types_map,
428
- )
429
-
430
- @validate_call
431
- async def lago_message_create_without_preload_content(
432
- self,
433
- _request_timeout: Union[
434
- None,
435
- Annotated[StrictFloat, Field(gt=0)],
436
- Tuple[
437
- Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]
438
- ],
439
- ] = None,
440
- _request_auth: Optional[Dict[StrictStr, Any]] = None,
441
- _content_type: Optional[StrictStr] = None,
442
- _headers: Optional[Dict[StrictStr, Any]] = None,
443
- _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
444
- ) -> RESTResponseType:
445
- """Receive a webhook message from Lago
446
-
447
- Receive a webhook message from Lago
448
-
449
- :param _request_timeout: timeout setting for this request. If one
450
- number provided, it will be total request
451
- timeout. It can also be a pair (tuple) of
452
- (connection, read) timeouts.
453
- :type _request_timeout: int, tuple(int, int), optional
454
- :param _request_auth: set to override the auth_settings for an a single
455
- request; this effectively ignores the
456
- authentication in the spec for a single request.
457
- :type _request_auth: dict, optional
458
- :param _content_type: force content-type for the request.
459
- :type _content_type: str, Optional
460
- :param _headers: set to override the headers for a single
461
- request; this effectively ignores the headers
462
- in the spec for a single request.
463
- :type _headers: dict, optional
464
- :param _host_index: set to override the host_index for a single
465
- request; this effectively ignores the host_index
466
- in the spec for a single request.
467
- :type _host_index: int, optional
468
- :return: Returns the result object.
469
- """ # noqa: E501
470
-
471
- _param = self._lago_message_create_serialize(
472
- _request_auth=_request_auth,
473
- _content_type=_content_type,
474
- _headers=_headers,
475
- _host_index=_host_index,
476
- )
477
-
478
- _response_types_map: Dict[str, Optional[str]] = {
479
- "200": None,
480
- "400": "MetadataGet400Response",
481
- "403": "MetadataGet400Response",
482
- }
483
- response_data = await self.api_client.call_api(
484
- *_param, _request_timeout=_request_timeout
485
- )
486
- return response_data.response
487
-
488
- def _lago_message_create_serialize(
489
- self,
490
- _request_auth,
491
- _content_type,
492
- _headers,
493
- _host_index,
494
- ) -> RequestSerialized:
495
-
496
- _host = None
497
-
498
- _collection_formats: Dict[str, str] = {}
499
-
500
- _path_params: Dict[str, str] = {}
501
- _query_params: List[Tuple[str, str]] = []
502
- _header_params: Dict[str, Optional[str]] = _headers or {}
503
- _form_params: List[Tuple[str, str]] = []
504
- _files: Dict[str, Union[str, bytes]] = {}
505
- _body_params: Optional[bytes] = None
506
-
507
- # process the path parameters
508
- # process the query parameters
509
- # process the header parameters
510
- # process the form parameters
511
- # process the body parameter
512
-
513
- # set the HTTP header `Accept`
514
- _header_params["Accept"] = self.api_client.select_header_accept(
515
- ["application/json"]
516
- )
517
-
518
- # authentication setting
519
- _auth_settings: List[str] = []
520
-
521
- return self.api_client.param_serialize(
522
- method="POST",
523
- resource_path="/api/v1/billing/lago/webhook",
524
- path_params=_path_params,
525
- query_params=_query_params,
526
- header_params=_header_params,
527
- body=_body_params,
528
- post_params=_form_params,
529
- files=_files,
530
- auth_settings=_auth_settings,
531
- collection_formats=_collection_formats,
532
- _host=_host,
533
- _request_auth=_request_auth,
534
- )
535
-
536
- @validate_call
537
- async def subscription_upsert(
538
- self,
539
- tenant: Annotated[
540
- str,
541
- Field(
542
- min_length=36, strict=True, max_length=36, description="The tenant id"
543
- ),
544
- ],
545
- subscription_upsert_request: Optional[SubscriptionUpsertRequest] = None,
546
- _request_timeout: Union[
547
- None,
548
- Annotated[StrictFloat, Field(gt=0)],
549
- Tuple[
550
- Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]
551
- ],
552
- ] = None,
553
- _request_auth: Optional[Dict[StrictStr, Any]] = None,
554
- _content_type: Optional[StrictStr] = None,
555
- _headers: Optional[Dict[StrictStr, Any]] = None,
556
- _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
557
- ) -> SubscriptionUpsert200Response:
558
- """Create a new subscription
559
-
560
- Update a subscription
561
-
562
- :param tenant: The tenant id (required)
563
- :type tenant: str
564
- :param subscription_upsert_request:
565
- :type subscription_upsert_request: SubscriptionUpsertRequest
566
- :param _request_timeout: timeout setting for this request. If one
567
- number provided, it will be total request
568
- timeout. It can also be a pair (tuple) of
569
- (connection, read) timeouts.
570
- :type _request_timeout: int, tuple(int, int), optional
571
- :param _request_auth: set to override the auth_settings for an a single
572
- request; this effectively ignores the
573
- authentication in the spec for a single request.
574
- :type _request_auth: dict, optional
575
- :param _content_type: force content-type for the request.
576
- :type _content_type: str, Optional
577
- :param _headers: set to override the headers for a single
578
- request; this effectively ignores the headers
579
- in the spec for a single request.
580
- :type _headers: dict, optional
581
- :param _host_index: set to override the host_index for a single
582
- request; this effectively ignores the host_index
583
- in the spec for a single request.
584
- :type _host_index: int, optional
585
- :return: Returns the result object.
586
- """ # noqa: E501
587
-
588
- _param = self._subscription_upsert_serialize(
589
- tenant=tenant,
590
- subscription_upsert_request=subscription_upsert_request,
591
- _request_auth=_request_auth,
592
- _content_type=_content_type,
593
- _headers=_headers,
594
- _host_index=_host_index,
595
- )
596
-
597
- _response_types_map: Dict[str, Optional[str]] = {
598
- "200": "SubscriptionUpsert200Response",
599
- "400": "MetadataGet400Response",
600
- "403": "MetadataGet400Response",
601
- }
602
- response_data = await self.api_client.call_api(
603
- *_param, _request_timeout=_request_timeout
604
- )
605
- await response_data.read()
606
- return self.api_client.response_deserialize(
607
- response_data=response_data,
608
- response_types_map=_response_types_map,
609
- ).data
610
-
611
- @validate_call
612
- async def subscription_upsert_with_http_info(
613
- self,
614
- tenant: Annotated[
615
- str,
616
- Field(
617
- min_length=36, strict=True, max_length=36, description="The tenant id"
618
- ),
619
- ],
620
- subscription_upsert_request: Optional[SubscriptionUpsertRequest] = None,
621
- _request_timeout: Union[
622
- None,
623
- Annotated[StrictFloat, Field(gt=0)],
624
- Tuple[
625
- Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]
626
- ],
627
- ] = None,
628
- _request_auth: Optional[Dict[StrictStr, Any]] = None,
629
- _content_type: Optional[StrictStr] = None,
630
- _headers: Optional[Dict[StrictStr, Any]] = None,
631
- _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
632
- ) -> ApiResponse[SubscriptionUpsert200Response]:
633
- """Create a new subscription
634
-
635
- Update a subscription
636
-
637
- :param tenant: The tenant id (required)
638
- :type tenant: str
639
- :param subscription_upsert_request:
640
- :type subscription_upsert_request: SubscriptionUpsertRequest
641
- :param _request_timeout: timeout setting for this request. If one
642
- number provided, it will be total request
643
- timeout. It can also be a pair (tuple) of
644
- (connection, read) timeouts.
645
- :type _request_timeout: int, tuple(int, int), optional
646
- :param _request_auth: set to override the auth_settings for an a single
647
- request; this effectively ignores the
648
- authentication in the spec for a single request.
649
- :type _request_auth: dict, optional
650
- :param _content_type: force content-type for the request.
651
- :type _content_type: str, Optional
652
- :param _headers: set to override the headers for a single
653
- request; this effectively ignores the headers
654
- in the spec for a single request.
655
- :type _headers: dict, optional
656
- :param _host_index: set to override the host_index for a single
657
- request; this effectively ignores the host_index
658
- in the spec for a single request.
659
- :type _host_index: int, optional
660
- :return: Returns the result object.
661
- """ # noqa: E501
662
-
663
- _param = self._subscription_upsert_serialize(
664
- tenant=tenant,
665
- subscription_upsert_request=subscription_upsert_request,
666
- _request_auth=_request_auth,
667
- _content_type=_content_type,
668
- _headers=_headers,
669
- _host_index=_host_index,
670
- )
671
-
672
- _response_types_map: Dict[str, Optional[str]] = {
673
- "200": "SubscriptionUpsert200Response",
674
- "400": "MetadataGet400Response",
675
- "403": "MetadataGet400Response",
676
- }
677
- response_data = await self.api_client.call_api(
678
- *_param, _request_timeout=_request_timeout
679
- )
680
- await response_data.read()
681
- return self.api_client.response_deserialize(
682
- response_data=response_data,
683
- response_types_map=_response_types_map,
684
- )
685
-
686
- @validate_call
687
- async def subscription_upsert_without_preload_content(
688
- self,
689
- tenant: Annotated[
690
- str,
691
- Field(
692
- min_length=36, strict=True, max_length=36, description="The tenant id"
693
- ),
694
- ],
695
- subscription_upsert_request: Optional[SubscriptionUpsertRequest] = None,
696
- _request_timeout: Union[
697
- None,
698
- Annotated[StrictFloat, Field(gt=0)],
699
- Tuple[
700
- Annotated[StrictFloat, Field(gt=0)], Annotated[StrictFloat, Field(gt=0)]
701
- ],
702
- ] = None,
703
- _request_auth: Optional[Dict[StrictStr, Any]] = None,
704
- _content_type: Optional[StrictStr] = None,
705
- _headers: Optional[Dict[StrictStr, Any]] = None,
706
- _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
707
- ) -> RESTResponseType:
708
- """Create a new subscription
709
-
710
- Update a subscription
711
-
712
- :param tenant: The tenant id (required)
713
- :type tenant: str
714
- :param subscription_upsert_request:
715
- :type subscription_upsert_request: SubscriptionUpsertRequest
716
- :param _request_timeout: timeout setting for this request. If one
717
- number provided, it will be total request
718
- timeout. It can also be a pair (tuple) of
719
- (connection, read) timeouts.
720
- :type _request_timeout: int, tuple(int, int), optional
721
- :param _request_auth: set to override the auth_settings for an a single
722
- request; this effectively ignores the
723
- authentication in the spec for a single request.
724
- :type _request_auth: dict, optional
725
- :param _content_type: force content-type for the request.
726
- :type _content_type: str, Optional
727
- :param _headers: set to override the headers for a single
728
- request; this effectively ignores the headers
729
- in the spec for a single request.
730
- :type _headers: dict, optional
731
- :param _host_index: set to override the host_index for a single
732
- request; this effectively ignores the host_index
733
- in the spec for a single request.
734
- :type _host_index: int, optional
735
- :return: Returns the result object.
736
- """ # noqa: E501
737
-
738
- _param = self._subscription_upsert_serialize(
739
- tenant=tenant,
740
- subscription_upsert_request=subscription_upsert_request,
741
- _request_auth=_request_auth,
742
- _content_type=_content_type,
743
- _headers=_headers,
744
- _host_index=_host_index,
745
- )
746
-
747
- _response_types_map: Dict[str, Optional[str]] = {
748
- "200": "SubscriptionUpsert200Response",
749
- "400": "MetadataGet400Response",
750
- "403": "MetadataGet400Response",
751
- }
752
- response_data = await self.api_client.call_api(
753
- *_param, _request_timeout=_request_timeout
754
- )
755
- return response_data.response
756
-
757
- def _subscription_upsert_serialize(
758
- self,
759
- tenant,
760
- subscription_upsert_request,
761
- _request_auth,
762
- _content_type,
763
- _headers,
764
- _host_index,
765
- ) -> RequestSerialized:
766
-
767
- _host = None
768
-
769
- _collection_formats: Dict[str, str] = {}
770
-
771
- _path_params: Dict[str, str] = {}
772
- _query_params: List[Tuple[str, str]] = []
773
- _header_params: Dict[str, Optional[str]] = _headers or {}
774
- _form_params: List[Tuple[str, str]] = []
775
- _files: Dict[str, Union[str, bytes]] = {}
776
- _body_params: Optional[bytes] = None
777
-
778
- # process the path parameters
779
- if tenant is not None:
780
- _path_params["tenant"] = tenant
781
- # process the query parameters
782
- # process the header parameters
783
- # process the form parameters
784
- # process the body parameter
785
- if subscription_upsert_request is not None:
786
- _body_params = subscription_upsert_request
787
-
788
- # set the HTTP header `Accept`
789
- _header_params["Accept"] = self.api_client.select_header_accept(
790
- ["application/json"]
791
- )
792
-
793
- # set the HTTP header `Content-Type`
794
- if _content_type:
795
- _header_params["Content-Type"] = _content_type
796
- else:
797
- _default_content_type = self.api_client.select_header_content_type(
798
- ["application/json"]
799
- )
800
- if _default_content_type is not None:
801
- _header_params["Content-Type"] = _default_content_type
802
-
803
- # authentication setting
804
- _auth_settings: List[str] = ["cookieAuth", "bearerAuth"]
805
-
806
- return self.api_client.param_serialize(
807
- method="PATCH",
808
- resource_path="/api/v1/billing/tenants/{tenant}/subscription",
809
- path_params=_path_params,
810
- query_params=_query_params,
811
- header_params=_header_params,
812
- body=_body_params,
813
- post_params=_form_params,
814
- files=_files,
815
- auth_settings=_auth_settings,
816
- collection_formats=_collection_formats,
817
- _host=_host,
818
- _request_auth=_request_auth,
819
- )