thrustlab 0.1.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.
- thrustlab/__init__.py +23 -0
- thrustlab/_async_polling.py +47 -0
- thrustlab/_http.py +166 -0
- thrustlab/_models/__init__.py +211 -0
- thrustlab/_models/api_key.py +184 -0
- thrustlab/_models/api_key_create.py +74 -0
- thrustlab/_models/api_key_with_secret.py +192 -0
- thrustlab/_models/billing_portal_session_resource.py +74 -0
- thrustlab/_models/checkout_session_resource.py +94 -0
- thrustlab/_models/component_brand.py +80 -0
- thrustlab/_models/component_brands_response.py +108 -0
- thrustlab/_models/component_create_body.py +83 -0
- thrustlab/_models/component_create_body_spec_json.py +46 -0
- thrustlab/_models/component_list_response.py +108 -0
- thrustlab/_models/component_patch.py +111 -0
- thrustlab/_models/component_patch_spec_json_type_0.py +46 -0
- thrustlab/_models/component_resource.py +188 -0
- thrustlab/_models/component_resource_spec_json.py +46 -0
- thrustlab/_models/create_webhook_endpoint_v1_webhook_endpoints_post_response_create_webhook_endpoint_v1_webhook_endpoints_post.py +50 -0
- thrustlab/_models/credit_balance_resource.py +135 -0
- thrustlab/_models/credit_bucket_breakdown.py +92 -0
- thrustlab/_models/credit_bucket_breakdown_type.py +9 -0
- thrustlab/_models/credit_usage_event_resource.py +154 -0
- thrustlab/_models/credit_usage_event_resource_credit_type.py +9 -0
- thrustlab/_models/credit_usage_event_resource_type.py +16 -0
- thrustlab/_models/credit_usage_list_response.py +116 -0
- thrustlab/_models/credit_usage_related_resource.py +71 -0
- thrustlab/_models/credit_usage_related_resource_object.py +9 -0
- thrustlab/_models/fire_test_event_v1_webhook_endpoints_public_id_test_post_response_fire_test_event_v1_webhook_endpoints_public_id_test_post.py +48 -0
- thrustlab/_models/get_delivery_v1_webhook_endpoints_public_id_deliveries_delivery_public_id_get_response_get_delivery_v1_webhook_endpoints_public_id_deliveries_delivery_public_id_get.py +49 -0
- thrustlab/_models/get_event_v1_events_event_id_get_response_get_event_v1_events_event_id_get.py +46 -0
- thrustlab/_models/get_webhook_endpoint_v1_webhook_endpoints_public_id_get_response_get_webhook_endpoint_v1_webhook_endpoints_public_id_get.py +48 -0
- thrustlab/_models/http_validation_error.py +79 -0
- thrustlab/_models/list_deliveries_v1_webhook_endpoints_public_id_deliveries_get_response_list_deliveries_v1_webhook_endpoints_public_id_deliveries_get.py +49 -0
- thrustlab/_models/list_events_v1_events_get_response_list_events_v1_events_get.py +46 -0
- thrustlab/_models/list_response_api_key.py +116 -0
- thrustlab/_models/list_webhook_endpoints_v1_webhook_endpoints_get_response_list_webhook_endpoints_v1_webhook_endpoints_get.py +46 -0
- thrustlab/_models/patch_webhook_endpoint_v1_webhook_endpoints_public_id_patch_response_patch_webhook_endpoint_v1_webhook_endpoints_public_id_patch.py +49 -0
- thrustlab/_models/portal_session_in.py +42 -0
- thrustlab/_models/project_create_body.py +103 -0
- thrustlab/_models/project_list_response.py +108 -0
- thrustlab/_models/project_patch.py +113 -0
- thrustlab/_models/project_resource.py +127 -0
- thrustlab/_models/retry_delivery_v1_webhook_endpoints_public_id_deliveries_delivery_public_id_retry_post_response_retry_delivery_v1_webhook_endpoints_public_id_deliveries_delivery_public_id_retry_post.py +49 -0
- thrustlab/_models/rotate_webhook_secret_v1_webhook_endpoints_public_id_rotate_secret_post_response_rotate_webhook_secret_v1_webhook_endpoints_public_id_rotate_secret_post.py +49 -0
- thrustlab/_models/rotor_group_in.py +107 -0
- thrustlab/_models/rotor_group_resource.py +97 -0
- thrustlab/_models/simulation_cancel_body.py +24 -0
- thrustlab/_models/simulation_create_body.py +128 -0
- thrustlab/_models/simulation_inputs.py +66 -0
- thrustlab/_models/simulation_list_response.py +88 -0
- thrustlab/_models/simulation_patch.py +121 -0
- thrustlab/_models/simulation_patch_plot_config_json_type_0_item.py +46 -0
- thrustlab/_models/simulation_resource.py +283 -0
- thrustlab/_models/simulation_resource_error_type_0.py +46 -0
- thrustlab/_models/simulation_resource_plot_config_json_type_0_item.py +46 -0
- thrustlab/_models/simulation_resource_result_type_0.py +46 -0
- thrustlab/_models/starred_component_create_body.py +80 -0
- thrustlab/_models/starred_component_list_response.py +108 -0
- thrustlab/_models/starred_component_resource.py +106 -0
- thrustlab/_models/submission_create_body.py +121 -0
- thrustlab/_models/submission_create_body_data_json.py +46 -0
- thrustlab/_models/submission_list_response.py +108 -0
- thrustlab/_models/submission_patch.py +174 -0
- thrustlab/_models/submission_patch_data_json_type_0.py +46 -0
- thrustlab/_models/submission_resource.py +197 -0
- thrustlab/_models/submission_resource_data_json.py +46 -0
- thrustlab/_models/subscription_create.py +58 -0
- thrustlab/_models/subscription_resource.py +168 -0
- thrustlab/_models/subscription_resource_status.py +12 -0
- thrustlab/_models/subscription_resource_tier.py +12 -0
- thrustlab/_models/sweep_cancel_body.py +42 -0
- thrustlab/_models/sweep_config_in.py +172 -0
- thrustlab/_models/sweep_create_body.py +138 -0
- thrustlab/_models/sweep_inputs.py +66 -0
- thrustlab/_models/sweep_list_response.py +88 -0
- thrustlab/_models/sweep_param_range_in.py +136 -0
- thrustlab/_models/sweep_param_range_in_mode.py +9 -0
- thrustlab/_models/sweep_patch.py +121 -0
- thrustlab/_models/sweep_patch_plot_config_json_type_0_item.py +46 -0
- thrustlab/_models/sweep_point_list_response.py +88 -0
- thrustlab/_models/sweep_point_resource.py +103 -0
- thrustlab/_models/sweep_point_resource_inputs.py +46 -0
- thrustlab/_models/sweep_point_resource_rotors_type_0.py +46 -0
- thrustlab/_models/sweep_resource.py +327 -0
- thrustlab/_models/sweep_resource_error_type_0.py +46 -0
- thrustlab/_models/sweep_resource_plot_config_json_type_0_item.py +46 -0
- thrustlab/_models/sweep_resource_summary_type_0.py +46 -0
- thrustlab/_models/sweep_resource_sweep_config_type_0.py +46 -0
- thrustlab/_models/sweep_rotor_group_in.py +95 -0
- thrustlab/_models/types.py +55 -0
- thrustlab/_models/user_patch.py +73 -0
- thrustlab/_models/user_resource.py +170 -0
- thrustlab/_models/v1_health_v1_health_get_response_v1_health_v1_health_get.py +46 -0
- thrustlab/_models/validation_error.py +90 -0
- thrustlab/_models/webhook_endpoint_create.py +91 -0
- thrustlab/_models/webhook_endpoint_patch.py +144 -0
- thrustlab/_pagination.py +109 -0
- thrustlab/_version.py +3 -0
- thrustlab/client.py +100 -0
- thrustlab/exceptions.py +121 -0
- thrustlab/resources/__init__.py +1 -0
- thrustlab/resources/_base.py +12 -0
- thrustlab/resources/api_keys.py +43 -0
- thrustlab/resources/components.py +60 -0
- thrustlab/resources/credits.py +40 -0
- thrustlab/resources/projects.py +54 -0
- thrustlab/resources/simulations.py +74 -0
- thrustlab/resources/starred_components.py +57 -0
- thrustlab/resources/submissions.py +44 -0
- thrustlab/resources/subscriptions.py +42 -0
- thrustlab/resources/sweeps.py +96 -0
- thrustlab/resources/users.py +13 -0
- thrustlab/resources/webhook_endpoints.py +138 -0
- thrustlab/webhooks.py +121 -0
- thrustlab-0.1.0.dist-info/METADATA +190 -0
- thrustlab-0.1.0.dist-info/RECORD +119 -0
- thrustlab-0.1.0.dist-info/WHEEL +4 -0
- thrustlab-0.1.0.dist-info/licenses/LICENSE +21 -0
|
@@ -0,0 +1,197 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
import datetime
|
|
4
|
+
from collections.abc import Mapping
|
|
5
|
+
from typing import TYPE_CHECKING, Any, TypeVar, cast
|
|
6
|
+
|
|
7
|
+
from attrs import define as _attrs_define
|
|
8
|
+
from attrs import field as _attrs_field
|
|
9
|
+
from dateutil.parser import isoparse
|
|
10
|
+
|
|
11
|
+
from thrustlab._models.types import UNSET, Unset
|
|
12
|
+
|
|
13
|
+
if TYPE_CHECKING:
|
|
14
|
+
from thrustlab._models.submission_resource_data_json import SubmissionResourceDataJson
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
T = TypeVar("T", bound="SubmissionResource")
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
@_attrs_define
|
|
21
|
+
class SubmissionResource:
|
|
22
|
+
"""
|
|
23
|
+
Attributes:
|
|
24
|
+
component_type (str):
|
|
25
|
+
created_at (datetime.datetime):
|
|
26
|
+
credit_reward (int):
|
|
27
|
+
data_json (SubmissionResourceDataJson):
|
|
28
|
+
id (str):
|
|
29
|
+
manufacturer (str):
|
|
30
|
+
name (str):
|
|
31
|
+
notes (None | str):
|
|
32
|
+
reviewed_at (datetime.datetime | None):
|
|
33
|
+
reviewer_notes (None | str):
|
|
34
|
+
source_url (str):
|
|
35
|
+
status (str):
|
|
36
|
+
object_ (str | Unset): Default: 'submission'.
|
|
37
|
+
"""
|
|
38
|
+
|
|
39
|
+
component_type: str
|
|
40
|
+
created_at: datetime.datetime
|
|
41
|
+
credit_reward: int
|
|
42
|
+
data_json: SubmissionResourceDataJson
|
|
43
|
+
id: str
|
|
44
|
+
manufacturer: str
|
|
45
|
+
name: str
|
|
46
|
+
notes: None | str
|
|
47
|
+
reviewed_at: datetime.datetime | None
|
|
48
|
+
reviewer_notes: None | str
|
|
49
|
+
source_url: str
|
|
50
|
+
status: str
|
|
51
|
+
object_: str | Unset = "submission"
|
|
52
|
+
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
|
53
|
+
|
|
54
|
+
def to_dict(self) -> dict[str, Any]:
|
|
55
|
+
component_type = self.component_type
|
|
56
|
+
|
|
57
|
+
created_at = self.created_at.isoformat()
|
|
58
|
+
|
|
59
|
+
credit_reward = self.credit_reward
|
|
60
|
+
|
|
61
|
+
data_json = self.data_json.to_dict()
|
|
62
|
+
|
|
63
|
+
id = self.id
|
|
64
|
+
|
|
65
|
+
manufacturer = self.manufacturer
|
|
66
|
+
|
|
67
|
+
name = self.name
|
|
68
|
+
|
|
69
|
+
notes: None | str
|
|
70
|
+
notes = self.notes
|
|
71
|
+
|
|
72
|
+
reviewed_at: None | str
|
|
73
|
+
if isinstance(self.reviewed_at, datetime.datetime):
|
|
74
|
+
reviewed_at = self.reviewed_at.isoformat()
|
|
75
|
+
else:
|
|
76
|
+
reviewed_at = self.reviewed_at
|
|
77
|
+
|
|
78
|
+
reviewer_notes: None | str
|
|
79
|
+
reviewer_notes = self.reviewer_notes
|
|
80
|
+
|
|
81
|
+
source_url = self.source_url
|
|
82
|
+
|
|
83
|
+
status = self.status
|
|
84
|
+
|
|
85
|
+
object_ = self.object_
|
|
86
|
+
|
|
87
|
+
field_dict: dict[str, Any] = {}
|
|
88
|
+
field_dict.update(self.additional_properties)
|
|
89
|
+
field_dict.update(
|
|
90
|
+
{
|
|
91
|
+
"component_type": component_type,
|
|
92
|
+
"created_at": created_at,
|
|
93
|
+
"credit_reward": credit_reward,
|
|
94
|
+
"data_json": data_json,
|
|
95
|
+
"id": id,
|
|
96
|
+
"manufacturer": manufacturer,
|
|
97
|
+
"name": name,
|
|
98
|
+
"notes": notes,
|
|
99
|
+
"reviewed_at": reviewed_at,
|
|
100
|
+
"reviewer_notes": reviewer_notes,
|
|
101
|
+
"source_url": source_url,
|
|
102
|
+
"status": status,
|
|
103
|
+
}
|
|
104
|
+
)
|
|
105
|
+
if object_ is not UNSET:
|
|
106
|
+
field_dict["object"] = object_
|
|
107
|
+
|
|
108
|
+
return field_dict
|
|
109
|
+
|
|
110
|
+
@classmethod
|
|
111
|
+
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
|
112
|
+
from thrustlab._models.submission_resource_data_json import SubmissionResourceDataJson
|
|
113
|
+
|
|
114
|
+
d = dict(src_dict)
|
|
115
|
+
component_type = d.pop("component_type")
|
|
116
|
+
|
|
117
|
+
created_at = isoparse(d.pop("created_at"))
|
|
118
|
+
|
|
119
|
+
credit_reward = d.pop("credit_reward")
|
|
120
|
+
|
|
121
|
+
data_json = SubmissionResourceDataJson.from_dict(d.pop("data_json"))
|
|
122
|
+
|
|
123
|
+
id = d.pop("id")
|
|
124
|
+
|
|
125
|
+
manufacturer = d.pop("manufacturer")
|
|
126
|
+
|
|
127
|
+
name = d.pop("name")
|
|
128
|
+
|
|
129
|
+
def _parse_notes(data: object) -> None | str:
|
|
130
|
+
if data is None:
|
|
131
|
+
return data
|
|
132
|
+
return cast(None | str, data)
|
|
133
|
+
|
|
134
|
+
notes = _parse_notes(d.pop("notes"))
|
|
135
|
+
|
|
136
|
+
def _parse_reviewed_at(data: object) -> datetime.datetime | None:
|
|
137
|
+
if data is None:
|
|
138
|
+
return data
|
|
139
|
+
try:
|
|
140
|
+
if not isinstance(data, str):
|
|
141
|
+
raise TypeError()
|
|
142
|
+
reviewed_at_type_0 = isoparse(data)
|
|
143
|
+
|
|
144
|
+
return reviewed_at_type_0
|
|
145
|
+
except (TypeError, ValueError, AttributeError, KeyError):
|
|
146
|
+
pass
|
|
147
|
+
return cast(datetime.datetime | None, data)
|
|
148
|
+
|
|
149
|
+
reviewed_at = _parse_reviewed_at(d.pop("reviewed_at"))
|
|
150
|
+
|
|
151
|
+
def _parse_reviewer_notes(data: object) -> None | str:
|
|
152
|
+
if data is None:
|
|
153
|
+
return data
|
|
154
|
+
return cast(None | str, data)
|
|
155
|
+
|
|
156
|
+
reviewer_notes = _parse_reviewer_notes(d.pop("reviewer_notes"))
|
|
157
|
+
|
|
158
|
+
source_url = d.pop("source_url")
|
|
159
|
+
|
|
160
|
+
status = d.pop("status")
|
|
161
|
+
|
|
162
|
+
object_ = d.pop("object", UNSET)
|
|
163
|
+
|
|
164
|
+
submission_resource = cls(
|
|
165
|
+
component_type=component_type,
|
|
166
|
+
created_at=created_at,
|
|
167
|
+
credit_reward=credit_reward,
|
|
168
|
+
data_json=data_json,
|
|
169
|
+
id=id,
|
|
170
|
+
manufacturer=manufacturer,
|
|
171
|
+
name=name,
|
|
172
|
+
notes=notes,
|
|
173
|
+
reviewed_at=reviewed_at,
|
|
174
|
+
reviewer_notes=reviewer_notes,
|
|
175
|
+
source_url=source_url,
|
|
176
|
+
status=status,
|
|
177
|
+
object_=object_,
|
|
178
|
+
)
|
|
179
|
+
|
|
180
|
+
submission_resource.additional_properties = d
|
|
181
|
+
return submission_resource
|
|
182
|
+
|
|
183
|
+
@property
|
|
184
|
+
def additional_keys(self) -> list[str]:
|
|
185
|
+
return list(self.additional_properties.keys())
|
|
186
|
+
|
|
187
|
+
def __getitem__(self, key: str) -> Any:
|
|
188
|
+
return self.additional_properties[key]
|
|
189
|
+
|
|
190
|
+
def __setitem__(self, key: str, value: Any) -> None:
|
|
191
|
+
self.additional_properties[key] = value
|
|
192
|
+
|
|
193
|
+
def __delitem__(self, key: str) -> None:
|
|
194
|
+
del self.additional_properties[key]
|
|
195
|
+
|
|
196
|
+
def __contains__(self, key: str) -> bool:
|
|
197
|
+
return key in self.additional_properties
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from collections.abc import Mapping
|
|
4
|
+
from typing import Any, TypeVar
|
|
5
|
+
|
|
6
|
+
from attrs import define as _attrs_define
|
|
7
|
+
from attrs import field as _attrs_field
|
|
8
|
+
|
|
9
|
+
T = TypeVar("T", bound="SubmissionResourceDataJson")
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
@_attrs_define
|
|
13
|
+
class SubmissionResourceDataJson:
|
|
14
|
+
""" """
|
|
15
|
+
|
|
16
|
+
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
|
17
|
+
|
|
18
|
+
def to_dict(self) -> dict[str, Any]:
|
|
19
|
+
field_dict: dict[str, Any] = {}
|
|
20
|
+
field_dict.update(self.additional_properties)
|
|
21
|
+
|
|
22
|
+
return field_dict
|
|
23
|
+
|
|
24
|
+
@classmethod
|
|
25
|
+
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
|
26
|
+
d = dict(src_dict)
|
|
27
|
+
submission_resource_data_json = cls()
|
|
28
|
+
|
|
29
|
+
submission_resource_data_json.additional_properties = d
|
|
30
|
+
return submission_resource_data_json
|
|
31
|
+
|
|
32
|
+
@property
|
|
33
|
+
def additional_keys(self) -> list[str]:
|
|
34
|
+
return list(self.additional_properties.keys())
|
|
35
|
+
|
|
36
|
+
def __getitem__(self, key: str) -> Any:
|
|
37
|
+
return self.additional_properties[key]
|
|
38
|
+
|
|
39
|
+
def __setitem__(self, key: str, value: Any) -> None:
|
|
40
|
+
self.additional_properties[key] = value
|
|
41
|
+
|
|
42
|
+
def __delitem__(self, key: str) -> None:
|
|
43
|
+
del self.additional_properties[key]
|
|
44
|
+
|
|
45
|
+
def __contains__(self, key: str) -> bool:
|
|
46
|
+
return key in self.additional_properties
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from collections.abc import Mapping
|
|
4
|
+
from typing import Any, TypeVar
|
|
5
|
+
|
|
6
|
+
from attrs import define as _attrs_define
|
|
7
|
+
|
|
8
|
+
T = TypeVar("T", bound="SubscriptionCreate")
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
@_attrs_define
|
|
12
|
+
class SubscriptionCreate:
|
|
13
|
+
"""
|
|
14
|
+
Attributes:
|
|
15
|
+
cancel_url (str):
|
|
16
|
+
price_id (str):
|
|
17
|
+
success_url (str):
|
|
18
|
+
"""
|
|
19
|
+
|
|
20
|
+
cancel_url: str
|
|
21
|
+
price_id: str
|
|
22
|
+
success_url: str
|
|
23
|
+
|
|
24
|
+
def to_dict(self) -> dict[str, Any]:
|
|
25
|
+
cancel_url = self.cancel_url
|
|
26
|
+
|
|
27
|
+
price_id = self.price_id
|
|
28
|
+
|
|
29
|
+
success_url = self.success_url
|
|
30
|
+
|
|
31
|
+
field_dict: dict[str, Any] = {}
|
|
32
|
+
|
|
33
|
+
field_dict.update(
|
|
34
|
+
{
|
|
35
|
+
"cancel_url": cancel_url,
|
|
36
|
+
"price_id": price_id,
|
|
37
|
+
"success_url": success_url,
|
|
38
|
+
}
|
|
39
|
+
)
|
|
40
|
+
|
|
41
|
+
return field_dict
|
|
42
|
+
|
|
43
|
+
@classmethod
|
|
44
|
+
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
|
45
|
+
d = dict(src_dict)
|
|
46
|
+
cancel_url = d.pop("cancel_url")
|
|
47
|
+
|
|
48
|
+
price_id = d.pop("price_id")
|
|
49
|
+
|
|
50
|
+
success_url = d.pop("success_url")
|
|
51
|
+
|
|
52
|
+
subscription_create = cls(
|
|
53
|
+
cancel_url=cancel_url,
|
|
54
|
+
price_id=price_id,
|
|
55
|
+
success_url=success_url,
|
|
56
|
+
)
|
|
57
|
+
|
|
58
|
+
return subscription_create
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from collections.abc import Mapping
|
|
4
|
+
from typing import Any, Literal, TypeVar, cast
|
|
5
|
+
|
|
6
|
+
from attrs import define as _attrs_define
|
|
7
|
+
from attrs import field as _attrs_field
|
|
8
|
+
|
|
9
|
+
from thrustlab._models.subscription_resource_status import SubscriptionResourceStatus
|
|
10
|
+
from thrustlab._models.subscription_resource_tier import SubscriptionResourceTier
|
|
11
|
+
from thrustlab._models.types import UNSET, Unset
|
|
12
|
+
|
|
13
|
+
T = TypeVar("T", bound="SubscriptionResource")
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
@_attrs_define
|
|
17
|
+
class SubscriptionResource:
|
|
18
|
+
"""
|
|
19
|
+
Attributes:
|
|
20
|
+
amount (int):
|
|
21
|
+
billing_interval (str):
|
|
22
|
+
cancel_at_period_end (bool):
|
|
23
|
+
currency (str):
|
|
24
|
+
current_period_end (str):
|
|
25
|
+
current_period_start (str):
|
|
26
|
+
id (str):
|
|
27
|
+
status (SubscriptionResourceStatus):
|
|
28
|
+
stripe_subscription_id (str):
|
|
29
|
+
tier (SubscriptionResourceTier):
|
|
30
|
+
canceled_at (None | str | Unset):
|
|
31
|
+
object_ (Literal['subscription'] | Unset): Default: 'subscription'.
|
|
32
|
+
"""
|
|
33
|
+
|
|
34
|
+
amount: int
|
|
35
|
+
billing_interval: str
|
|
36
|
+
cancel_at_period_end: bool
|
|
37
|
+
currency: str
|
|
38
|
+
current_period_end: str
|
|
39
|
+
current_period_start: str
|
|
40
|
+
id: str
|
|
41
|
+
status: SubscriptionResourceStatus
|
|
42
|
+
stripe_subscription_id: str
|
|
43
|
+
tier: SubscriptionResourceTier
|
|
44
|
+
canceled_at: None | str | Unset = UNSET
|
|
45
|
+
object_: Literal["subscription"] | Unset = "subscription"
|
|
46
|
+
additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
|
|
47
|
+
|
|
48
|
+
def to_dict(self) -> dict[str, Any]:
|
|
49
|
+
amount = self.amount
|
|
50
|
+
|
|
51
|
+
billing_interval = self.billing_interval
|
|
52
|
+
|
|
53
|
+
cancel_at_period_end = self.cancel_at_period_end
|
|
54
|
+
|
|
55
|
+
currency = self.currency
|
|
56
|
+
|
|
57
|
+
current_period_end = self.current_period_end
|
|
58
|
+
|
|
59
|
+
current_period_start = self.current_period_start
|
|
60
|
+
|
|
61
|
+
id = self.id
|
|
62
|
+
|
|
63
|
+
status = self.status.value
|
|
64
|
+
|
|
65
|
+
stripe_subscription_id = self.stripe_subscription_id
|
|
66
|
+
|
|
67
|
+
tier = self.tier.value
|
|
68
|
+
|
|
69
|
+
canceled_at: None | str | Unset
|
|
70
|
+
if isinstance(self.canceled_at, Unset):
|
|
71
|
+
canceled_at = UNSET
|
|
72
|
+
else:
|
|
73
|
+
canceled_at = self.canceled_at
|
|
74
|
+
|
|
75
|
+
object_ = self.object_
|
|
76
|
+
|
|
77
|
+
field_dict: dict[str, Any] = {}
|
|
78
|
+
field_dict.update(self.additional_properties)
|
|
79
|
+
field_dict.update(
|
|
80
|
+
{
|
|
81
|
+
"amount": amount,
|
|
82
|
+
"billing_interval": billing_interval,
|
|
83
|
+
"cancel_at_period_end": cancel_at_period_end,
|
|
84
|
+
"currency": currency,
|
|
85
|
+
"current_period_end": current_period_end,
|
|
86
|
+
"current_period_start": current_period_start,
|
|
87
|
+
"id": id,
|
|
88
|
+
"status": status,
|
|
89
|
+
"stripe_subscription_id": stripe_subscription_id,
|
|
90
|
+
"tier": tier,
|
|
91
|
+
}
|
|
92
|
+
)
|
|
93
|
+
if canceled_at is not UNSET:
|
|
94
|
+
field_dict["canceled_at"] = canceled_at
|
|
95
|
+
if object_ is not UNSET:
|
|
96
|
+
field_dict["object"] = object_
|
|
97
|
+
|
|
98
|
+
return field_dict
|
|
99
|
+
|
|
100
|
+
@classmethod
|
|
101
|
+
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
|
102
|
+
d = dict(src_dict)
|
|
103
|
+
amount = d.pop("amount")
|
|
104
|
+
|
|
105
|
+
billing_interval = d.pop("billing_interval")
|
|
106
|
+
|
|
107
|
+
cancel_at_period_end = d.pop("cancel_at_period_end")
|
|
108
|
+
|
|
109
|
+
currency = d.pop("currency")
|
|
110
|
+
|
|
111
|
+
current_period_end = d.pop("current_period_end")
|
|
112
|
+
|
|
113
|
+
current_period_start = d.pop("current_period_start")
|
|
114
|
+
|
|
115
|
+
id = d.pop("id")
|
|
116
|
+
|
|
117
|
+
status = SubscriptionResourceStatus(d.pop("status"))
|
|
118
|
+
|
|
119
|
+
stripe_subscription_id = d.pop("stripe_subscription_id")
|
|
120
|
+
|
|
121
|
+
tier = SubscriptionResourceTier(d.pop("tier"))
|
|
122
|
+
|
|
123
|
+
def _parse_canceled_at(data: object) -> None | str | Unset:
|
|
124
|
+
if data is None:
|
|
125
|
+
return data
|
|
126
|
+
if isinstance(data, Unset):
|
|
127
|
+
return data
|
|
128
|
+
return cast(None | str | Unset, data)
|
|
129
|
+
|
|
130
|
+
canceled_at = _parse_canceled_at(d.pop("canceled_at", UNSET))
|
|
131
|
+
|
|
132
|
+
object_ = cast(Literal["subscription"] | Unset, d.pop("object", UNSET))
|
|
133
|
+
if object_ != "subscription" and not isinstance(object_, Unset):
|
|
134
|
+
raise ValueError(f"object must match const 'subscription', got '{object_}'")
|
|
135
|
+
|
|
136
|
+
subscription_resource = cls(
|
|
137
|
+
amount=amount,
|
|
138
|
+
billing_interval=billing_interval,
|
|
139
|
+
cancel_at_period_end=cancel_at_period_end,
|
|
140
|
+
currency=currency,
|
|
141
|
+
current_period_end=current_period_end,
|
|
142
|
+
current_period_start=current_period_start,
|
|
143
|
+
id=id,
|
|
144
|
+
status=status,
|
|
145
|
+
stripe_subscription_id=stripe_subscription_id,
|
|
146
|
+
tier=tier,
|
|
147
|
+
canceled_at=canceled_at,
|
|
148
|
+
object_=object_,
|
|
149
|
+
)
|
|
150
|
+
|
|
151
|
+
subscription_resource.additional_properties = d
|
|
152
|
+
return subscription_resource
|
|
153
|
+
|
|
154
|
+
@property
|
|
155
|
+
def additional_keys(self) -> list[str]:
|
|
156
|
+
return list(self.additional_properties.keys())
|
|
157
|
+
|
|
158
|
+
def __getitem__(self, key: str) -> Any:
|
|
159
|
+
return self.additional_properties[key]
|
|
160
|
+
|
|
161
|
+
def __setitem__(self, key: str, value: Any) -> None:
|
|
162
|
+
self.additional_properties[key] = value
|
|
163
|
+
|
|
164
|
+
def __delitem__(self, key: str) -> None:
|
|
165
|
+
del self.additional_properties[key]
|
|
166
|
+
|
|
167
|
+
def __contains__(self, key: str) -> bool:
|
|
168
|
+
return key in self.additional_properties
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
|
|
3
|
+
from collections.abc import Mapping
|
|
4
|
+
from typing import Any, TypeVar
|
|
5
|
+
|
|
6
|
+
from attrs import define as _attrs_define
|
|
7
|
+
|
|
8
|
+
from thrustlab._models.types import UNSET, Unset
|
|
9
|
+
|
|
10
|
+
T = TypeVar("T", bound="SweepCancelBody")
|
|
11
|
+
|
|
12
|
+
|
|
13
|
+
@_attrs_define
|
|
14
|
+
class SweepCancelBody:
|
|
15
|
+
"""
|
|
16
|
+
Attributes:
|
|
17
|
+
save_partial (bool | Unset): Default: False.
|
|
18
|
+
"""
|
|
19
|
+
|
|
20
|
+
save_partial: bool | Unset = False
|
|
21
|
+
|
|
22
|
+
def to_dict(self) -> dict[str, Any]:
|
|
23
|
+
save_partial = self.save_partial
|
|
24
|
+
|
|
25
|
+
field_dict: dict[str, Any] = {}
|
|
26
|
+
|
|
27
|
+
field_dict.update({})
|
|
28
|
+
if save_partial is not UNSET:
|
|
29
|
+
field_dict["save_partial"] = save_partial
|
|
30
|
+
|
|
31
|
+
return field_dict
|
|
32
|
+
|
|
33
|
+
@classmethod
|
|
34
|
+
def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
|
|
35
|
+
d = dict(src_dict)
|
|
36
|
+
save_partial = d.pop("save_partial", UNSET)
|
|
37
|
+
|
|
38
|
+
sweep_cancel_body = cls(
|
|
39
|
+
save_partial=save_partial,
|
|
40
|
+
)
|
|
41
|
+
|
|
42
|
+
return sweep_cancel_body
|