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.
Files changed (119) hide show
  1. thrustlab/__init__.py +23 -0
  2. thrustlab/_async_polling.py +47 -0
  3. thrustlab/_http.py +166 -0
  4. thrustlab/_models/__init__.py +211 -0
  5. thrustlab/_models/api_key.py +184 -0
  6. thrustlab/_models/api_key_create.py +74 -0
  7. thrustlab/_models/api_key_with_secret.py +192 -0
  8. thrustlab/_models/billing_portal_session_resource.py +74 -0
  9. thrustlab/_models/checkout_session_resource.py +94 -0
  10. thrustlab/_models/component_brand.py +80 -0
  11. thrustlab/_models/component_brands_response.py +108 -0
  12. thrustlab/_models/component_create_body.py +83 -0
  13. thrustlab/_models/component_create_body_spec_json.py +46 -0
  14. thrustlab/_models/component_list_response.py +108 -0
  15. thrustlab/_models/component_patch.py +111 -0
  16. thrustlab/_models/component_patch_spec_json_type_0.py +46 -0
  17. thrustlab/_models/component_resource.py +188 -0
  18. thrustlab/_models/component_resource_spec_json.py +46 -0
  19. thrustlab/_models/create_webhook_endpoint_v1_webhook_endpoints_post_response_create_webhook_endpoint_v1_webhook_endpoints_post.py +50 -0
  20. thrustlab/_models/credit_balance_resource.py +135 -0
  21. thrustlab/_models/credit_bucket_breakdown.py +92 -0
  22. thrustlab/_models/credit_bucket_breakdown_type.py +9 -0
  23. thrustlab/_models/credit_usage_event_resource.py +154 -0
  24. thrustlab/_models/credit_usage_event_resource_credit_type.py +9 -0
  25. thrustlab/_models/credit_usage_event_resource_type.py +16 -0
  26. thrustlab/_models/credit_usage_list_response.py +116 -0
  27. thrustlab/_models/credit_usage_related_resource.py +71 -0
  28. thrustlab/_models/credit_usage_related_resource_object.py +9 -0
  29. 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
  30. 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
  31. thrustlab/_models/get_event_v1_events_event_id_get_response_get_event_v1_events_event_id_get.py +46 -0
  32. thrustlab/_models/get_webhook_endpoint_v1_webhook_endpoints_public_id_get_response_get_webhook_endpoint_v1_webhook_endpoints_public_id_get.py +48 -0
  33. thrustlab/_models/http_validation_error.py +79 -0
  34. thrustlab/_models/list_deliveries_v1_webhook_endpoints_public_id_deliveries_get_response_list_deliveries_v1_webhook_endpoints_public_id_deliveries_get.py +49 -0
  35. thrustlab/_models/list_events_v1_events_get_response_list_events_v1_events_get.py +46 -0
  36. thrustlab/_models/list_response_api_key.py +116 -0
  37. thrustlab/_models/list_webhook_endpoints_v1_webhook_endpoints_get_response_list_webhook_endpoints_v1_webhook_endpoints_get.py +46 -0
  38. thrustlab/_models/patch_webhook_endpoint_v1_webhook_endpoints_public_id_patch_response_patch_webhook_endpoint_v1_webhook_endpoints_public_id_patch.py +49 -0
  39. thrustlab/_models/portal_session_in.py +42 -0
  40. thrustlab/_models/project_create_body.py +103 -0
  41. thrustlab/_models/project_list_response.py +108 -0
  42. thrustlab/_models/project_patch.py +113 -0
  43. thrustlab/_models/project_resource.py +127 -0
  44. 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
  45. 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
  46. thrustlab/_models/rotor_group_in.py +107 -0
  47. thrustlab/_models/rotor_group_resource.py +97 -0
  48. thrustlab/_models/simulation_cancel_body.py +24 -0
  49. thrustlab/_models/simulation_create_body.py +128 -0
  50. thrustlab/_models/simulation_inputs.py +66 -0
  51. thrustlab/_models/simulation_list_response.py +88 -0
  52. thrustlab/_models/simulation_patch.py +121 -0
  53. thrustlab/_models/simulation_patch_plot_config_json_type_0_item.py +46 -0
  54. thrustlab/_models/simulation_resource.py +283 -0
  55. thrustlab/_models/simulation_resource_error_type_0.py +46 -0
  56. thrustlab/_models/simulation_resource_plot_config_json_type_0_item.py +46 -0
  57. thrustlab/_models/simulation_resource_result_type_0.py +46 -0
  58. thrustlab/_models/starred_component_create_body.py +80 -0
  59. thrustlab/_models/starred_component_list_response.py +108 -0
  60. thrustlab/_models/starred_component_resource.py +106 -0
  61. thrustlab/_models/submission_create_body.py +121 -0
  62. thrustlab/_models/submission_create_body_data_json.py +46 -0
  63. thrustlab/_models/submission_list_response.py +108 -0
  64. thrustlab/_models/submission_patch.py +174 -0
  65. thrustlab/_models/submission_patch_data_json_type_0.py +46 -0
  66. thrustlab/_models/submission_resource.py +197 -0
  67. thrustlab/_models/submission_resource_data_json.py +46 -0
  68. thrustlab/_models/subscription_create.py +58 -0
  69. thrustlab/_models/subscription_resource.py +168 -0
  70. thrustlab/_models/subscription_resource_status.py +12 -0
  71. thrustlab/_models/subscription_resource_tier.py +12 -0
  72. thrustlab/_models/sweep_cancel_body.py +42 -0
  73. thrustlab/_models/sweep_config_in.py +172 -0
  74. thrustlab/_models/sweep_create_body.py +138 -0
  75. thrustlab/_models/sweep_inputs.py +66 -0
  76. thrustlab/_models/sweep_list_response.py +88 -0
  77. thrustlab/_models/sweep_param_range_in.py +136 -0
  78. thrustlab/_models/sweep_param_range_in_mode.py +9 -0
  79. thrustlab/_models/sweep_patch.py +121 -0
  80. thrustlab/_models/sweep_patch_plot_config_json_type_0_item.py +46 -0
  81. thrustlab/_models/sweep_point_list_response.py +88 -0
  82. thrustlab/_models/sweep_point_resource.py +103 -0
  83. thrustlab/_models/sweep_point_resource_inputs.py +46 -0
  84. thrustlab/_models/sweep_point_resource_rotors_type_0.py +46 -0
  85. thrustlab/_models/sweep_resource.py +327 -0
  86. thrustlab/_models/sweep_resource_error_type_0.py +46 -0
  87. thrustlab/_models/sweep_resource_plot_config_json_type_0_item.py +46 -0
  88. thrustlab/_models/sweep_resource_summary_type_0.py +46 -0
  89. thrustlab/_models/sweep_resource_sweep_config_type_0.py +46 -0
  90. thrustlab/_models/sweep_rotor_group_in.py +95 -0
  91. thrustlab/_models/types.py +55 -0
  92. thrustlab/_models/user_patch.py +73 -0
  93. thrustlab/_models/user_resource.py +170 -0
  94. thrustlab/_models/v1_health_v1_health_get_response_v1_health_v1_health_get.py +46 -0
  95. thrustlab/_models/validation_error.py +90 -0
  96. thrustlab/_models/webhook_endpoint_create.py +91 -0
  97. thrustlab/_models/webhook_endpoint_patch.py +144 -0
  98. thrustlab/_pagination.py +109 -0
  99. thrustlab/_version.py +3 -0
  100. thrustlab/client.py +100 -0
  101. thrustlab/exceptions.py +121 -0
  102. thrustlab/resources/__init__.py +1 -0
  103. thrustlab/resources/_base.py +12 -0
  104. thrustlab/resources/api_keys.py +43 -0
  105. thrustlab/resources/components.py +60 -0
  106. thrustlab/resources/credits.py +40 -0
  107. thrustlab/resources/projects.py +54 -0
  108. thrustlab/resources/simulations.py +74 -0
  109. thrustlab/resources/starred_components.py +57 -0
  110. thrustlab/resources/submissions.py +44 -0
  111. thrustlab/resources/subscriptions.py +42 -0
  112. thrustlab/resources/sweeps.py +96 -0
  113. thrustlab/resources/users.py +13 -0
  114. thrustlab/resources/webhook_endpoints.py +138 -0
  115. thrustlab/webhooks.py +121 -0
  116. thrustlab-0.1.0.dist-info/METADATA +190 -0
  117. thrustlab-0.1.0.dist-info/RECORD +119 -0
  118. thrustlab-0.1.0.dist-info/WHEEL +4 -0
  119. thrustlab-0.1.0.dist-info/licenses/LICENSE +21 -0
@@ -0,0 +1,283 @@
1
+ from __future__ import annotations
2
+
3
+ from collections.abc import Mapping
4
+ from typing import TYPE_CHECKING, Any, Literal, TypeVar, cast
5
+
6
+ from attrs import define as _attrs_define
7
+
8
+ if TYPE_CHECKING:
9
+ from thrustlab._models.rotor_group_resource import RotorGroupResource
10
+ from thrustlab._models.simulation_inputs import SimulationInputs
11
+ from thrustlab._models.simulation_resource_error_type_0 import SimulationResourceErrorType0
12
+ from thrustlab._models.simulation_resource_plot_config_json_type_0_item import SimulationResourcePlotConfigJsonType0Item
13
+ from thrustlab._models.simulation_resource_result_type_0 import SimulationResourceResultType0
14
+
15
+
16
+ T = TypeVar("T", bound="SimulationResource")
17
+
18
+
19
+ @_attrs_define
20
+ class SimulationResource:
21
+ """
22
+ Attributes:
23
+ analysis_type (str):
24
+ battery_component_id (str):
25
+ completed_at (None | str):
26
+ created_at (None | str):
27
+ credits_cost (int):
28
+ error (None | SimulationResourceErrorType0):
29
+ id (str):
30
+ inputs (SimulationInputs):
31
+ is_starred (bool):
32
+ name (None | str):
33
+ object_ (Literal['simulation']):
34
+ plot_config_json (list[SimulationResourcePlotConfigJsonType0Item] | None):
35
+ progress (float | None):
36
+ project_id (str):
37
+ result (None | SimulationResourceResultType0):
38
+ rotor_groups (list[RotorGroupResource]):
39
+ status (str):
40
+ """
41
+
42
+ analysis_type: str
43
+ battery_component_id: str
44
+ completed_at: None | str
45
+ created_at: None | str
46
+ credits_cost: int
47
+ error: None | SimulationResourceErrorType0
48
+ id: str
49
+ inputs: SimulationInputs
50
+ is_starred: bool
51
+ name: None | str
52
+ object_: Literal["simulation"]
53
+ plot_config_json: list[SimulationResourcePlotConfigJsonType0Item] | None
54
+ progress: float | None
55
+ project_id: str
56
+ result: None | SimulationResourceResultType0
57
+ rotor_groups: list[RotorGroupResource]
58
+ status: str
59
+
60
+ def to_dict(self) -> dict[str, Any]:
61
+ from thrustlab._models.simulation_resource_error_type_0 import SimulationResourceErrorType0
62
+ from thrustlab._models.simulation_resource_result_type_0 import SimulationResourceResultType0
63
+
64
+ analysis_type = self.analysis_type
65
+
66
+ battery_component_id = self.battery_component_id
67
+
68
+ completed_at: None | str
69
+ completed_at = self.completed_at
70
+
71
+ created_at: None | str
72
+ created_at = self.created_at
73
+
74
+ credits_cost = self.credits_cost
75
+
76
+ error: dict[str, Any] | None
77
+ if isinstance(self.error, SimulationResourceErrorType0):
78
+ error = self.error.to_dict()
79
+ else:
80
+ error = self.error
81
+
82
+ id = self.id
83
+
84
+ inputs = self.inputs.to_dict()
85
+
86
+ is_starred = self.is_starred
87
+
88
+ name: None | str
89
+ name = self.name
90
+
91
+ object_ = self.object_
92
+
93
+ plot_config_json: list[dict[str, Any]] | None
94
+ if isinstance(self.plot_config_json, list):
95
+ plot_config_json = []
96
+ for plot_config_json_type_0_item_data in self.plot_config_json:
97
+ plot_config_json_type_0_item = plot_config_json_type_0_item_data.to_dict()
98
+ plot_config_json.append(plot_config_json_type_0_item)
99
+
100
+ else:
101
+ plot_config_json = self.plot_config_json
102
+
103
+ progress: float | None
104
+ progress = self.progress
105
+
106
+ project_id = self.project_id
107
+
108
+ result: dict[str, Any] | None
109
+ if isinstance(self.result, SimulationResourceResultType0):
110
+ result = self.result.to_dict()
111
+ else:
112
+ result = self.result
113
+
114
+ rotor_groups = []
115
+ for rotor_groups_item_data in self.rotor_groups:
116
+ rotor_groups_item = rotor_groups_item_data.to_dict()
117
+ rotor_groups.append(rotor_groups_item)
118
+
119
+ status = self.status
120
+
121
+ field_dict: dict[str, Any] = {}
122
+
123
+ field_dict.update(
124
+ {
125
+ "analysis_type": analysis_type,
126
+ "battery_component_id": battery_component_id,
127
+ "completed_at": completed_at,
128
+ "created_at": created_at,
129
+ "credits_cost": credits_cost,
130
+ "error": error,
131
+ "id": id,
132
+ "inputs": inputs,
133
+ "is_starred": is_starred,
134
+ "name": name,
135
+ "object": object_,
136
+ "plot_config_json": plot_config_json,
137
+ "progress": progress,
138
+ "project_id": project_id,
139
+ "result": result,
140
+ "rotor_groups": rotor_groups,
141
+ "status": status,
142
+ }
143
+ )
144
+
145
+ return field_dict
146
+
147
+ @classmethod
148
+ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
149
+ from thrustlab._models.rotor_group_resource import RotorGroupResource
150
+ from thrustlab._models.simulation_inputs import SimulationInputs
151
+ from thrustlab._models.simulation_resource_error_type_0 import SimulationResourceErrorType0
152
+ from thrustlab._models.simulation_resource_plot_config_json_type_0_item import SimulationResourcePlotConfigJsonType0Item
153
+ from thrustlab._models.simulation_resource_result_type_0 import SimulationResourceResultType0
154
+
155
+ d = dict(src_dict)
156
+ analysis_type = d.pop("analysis_type")
157
+
158
+ battery_component_id = d.pop("battery_component_id")
159
+
160
+ def _parse_completed_at(data: object) -> None | str:
161
+ if data is None:
162
+ return data
163
+ return cast(None | str, data)
164
+
165
+ completed_at = _parse_completed_at(d.pop("completed_at"))
166
+
167
+ def _parse_created_at(data: object) -> None | str:
168
+ if data is None:
169
+ return data
170
+ return cast(None | str, data)
171
+
172
+ created_at = _parse_created_at(d.pop("created_at"))
173
+
174
+ credits_cost = d.pop("credits_cost")
175
+
176
+ def _parse_error(data: object) -> None | SimulationResourceErrorType0:
177
+ if data is None:
178
+ return data
179
+ try:
180
+ if not isinstance(data, dict):
181
+ raise TypeError()
182
+ error_type_0 = SimulationResourceErrorType0.from_dict(data)
183
+
184
+ return error_type_0
185
+ except (TypeError, ValueError, AttributeError, KeyError):
186
+ pass
187
+ return cast(None | SimulationResourceErrorType0, data)
188
+
189
+ error = _parse_error(d.pop("error"))
190
+
191
+ id = d.pop("id")
192
+
193
+ inputs = SimulationInputs.from_dict(d.pop("inputs"))
194
+
195
+ is_starred = d.pop("is_starred")
196
+
197
+ def _parse_name(data: object) -> None | str:
198
+ if data is None:
199
+ return data
200
+ return cast(None | str, data)
201
+
202
+ name = _parse_name(d.pop("name"))
203
+
204
+ object_ = cast(Literal["simulation"], d.pop("object"))
205
+ if object_ != "simulation":
206
+ raise ValueError(f"object must match const 'simulation', got '{object_}'")
207
+
208
+ def _parse_plot_config_json(data: object) -> list[SimulationResourcePlotConfigJsonType0Item] | None:
209
+ if data is None:
210
+ return data
211
+ try:
212
+ if not isinstance(data, list):
213
+ raise TypeError()
214
+ plot_config_json_type_0 = []
215
+ _plot_config_json_type_0 = data
216
+ for plot_config_json_type_0_item_data in _plot_config_json_type_0:
217
+ plot_config_json_type_0_item = SimulationResourcePlotConfigJsonType0Item.from_dict(
218
+ plot_config_json_type_0_item_data
219
+ )
220
+
221
+ plot_config_json_type_0.append(plot_config_json_type_0_item)
222
+
223
+ return plot_config_json_type_0
224
+ except (TypeError, ValueError, AttributeError, KeyError):
225
+ pass
226
+ return cast(list[SimulationResourcePlotConfigJsonType0Item] | None, data)
227
+
228
+ plot_config_json = _parse_plot_config_json(d.pop("plot_config_json"))
229
+
230
+ def _parse_progress(data: object) -> float | None:
231
+ if data is None:
232
+ return data
233
+ return cast(float | None, data)
234
+
235
+ progress = _parse_progress(d.pop("progress"))
236
+
237
+ project_id = d.pop("project_id")
238
+
239
+ def _parse_result(data: object) -> None | SimulationResourceResultType0:
240
+ if data is None:
241
+ return data
242
+ try:
243
+ if not isinstance(data, dict):
244
+ raise TypeError()
245
+ result_type_0 = SimulationResourceResultType0.from_dict(data)
246
+
247
+ return result_type_0
248
+ except (TypeError, ValueError, AttributeError, KeyError):
249
+ pass
250
+ return cast(None | SimulationResourceResultType0, data)
251
+
252
+ result = _parse_result(d.pop("result"))
253
+
254
+ rotor_groups = []
255
+ _rotor_groups = d.pop("rotor_groups")
256
+ for rotor_groups_item_data in _rotor_groups:
257
+ rotor_groups_item = RotorGroupResource.from_dict(rotor_groups_item_data)
258
+
259
+ rotor_groups.append(rotor_groups_item)
260
+
261
+ status = d.pop("status")
262
+
263
+ simulation_resource = cls(
264
+ analysis_type=analysis_type,
265
+ battery_component_id=battery_component_id,
266
+ completed_at=completed_at,
267
+ created_at=created_at,
268
+ credits_cost=credits_cost,
269
+ error=error,
270
+ id=id,
271
+ inputs=inputs,
272
+ is_starred=is_starred,
273
+ name=name,
274
+ object_=object_,
275
+ plot_config_json=plot_config_json,
276
+ progress=progress,
277
+ project_id=project_id,
278
+ result=result,
279
+ rotor_groups=rotor_groups,
280
+ status=status,
281
+ )
282
+
283
+ return simulation_resource
@@ -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="SimulationResourceErrorType0")
10
+
11
+
12
+ @_attrs_define
13
+ class SimulationResourceErrorType0:
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
+ simulation_resource_error_type_0 = cls()
28
+
29
+ simulation_resource_error_type_0.additional_properties = d
30
+ return simulation_resource_error_type_0
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,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="SimulationResourcePlotConfigJsonType0Item")
10
+
11
+
12
+ @_attrs_define
13
+ class SimulationResourcePlotConfigJsonType0Item:
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
+ simulation_resource_plot_config_json_type_0_item = cls()
28
+
29
+ simulation_resource_plot_config_json_type_0_item.additional_properties = d
30
+ return simulation_resource_plot_config_json_type_0_item
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,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="SimulationResourceResultType0")
10
+
11
+
12
+ @_attrs_define
13
+ class SimulationResourceResultType0:
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
+ simulation_resource_result_type_0 = cls()
28
+
29
+ simulation_resource_result_type_0.additional_properties = d
30
+ return simulation_resource_result_type_0
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,80 @@
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="StarredComponentCreateBody")
10
+
11
+
12
+ @_attrs_define
13
+ class StarredComponentCreateBody:
14
+ """Accepts either prefixed (``proj_<ksuid>`` / ``comp_<ksuid>``) or raw
15
+ UUID strings — resolution happens in the handler so the same body shape
16
+ works during the reference-app transition.
17
+
18
+ Attributes:
19
+ component_id (str):
20
+ component_type (str):
21
+ project_id (str):
22
+ """
23
+
24
+ component_id: str
25
+ component_type: str
26
+ project_id: str
27
+ additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
28
+
29
+ def to_dict(self) -> dict[str, Any]:
30
+ component_id = self.component_id
31
+
32
+ component_type = self.component_type
33
+
34
+ project_id = self.project_id
35
+
36
+ field_dict: dict[str, Any] = {}
37
+ field_dict.update(self.additional_properties)
38
+ field_dict.update(
39
+ {
40
+ "component_id": component_id,
41
+ "component_type": component_type,
42
+ "project_id": project_id,
43
+ }
44
+ )
45
+
46
+ return field_dict
47
+
48
+ @classmethod
49
+ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
50
+ d = dict(src_dict)
51
+ component_id = d.pop("component_id")
52
+
53
+ component_type = d.pop("component_type")
54
+
55
+ project_id = d.pop("project_id")
56
+
57
+ starred_component_create_body = cls(
58
+ component_id=component_id,
59
+ component_type=component_type,
60
+ project_id=project_id,
61
+ )
62
+
63
+ starred_component_create_body.additional_properties = d
64
+ return starred_component_create_body
65
+
66
+ @property
67
+ def additional_keys(self) -> list[str]:
68
+ return list(self.additional_properties.keys())
69
+
70
+ def __getitem__(self, key: str) -> Any:
71
+ return self.additional_properties[key]
72
+
73
+ def __setitem__(self, key: str, value: Any) -> None:
74
+ self.additional_properties[key] = value
75
+
76
+ def __delitem__(self, key: str) -> None:
77
+ del self.additional_properties[key]
78
+
79
+ def __contains__(self, key: str) -> bool:
80
+ return key in self.additional_properties
@@ -0,0 +1,108 @@
1
+ from __future__ import annotations
2
+
3
+ from collections.abc import Mapping
4
+ from typing import TYPE_CHECKING, Any, TypeVar, cast
5
+
6
+ from attrs import define as _attrs_define
7
+ from attrs import field as _attrs_field
8
+
9
+ from thrustlab._models.types import UNSET, Unset
10
+
11
+ if TYPE_CHECKING:
12
+ from thrustlab._models.starred_component_resource import StarredComponentResource
13
+
14
+
15
+ T = TypeVar("T", bound="StarredComponentListResponse")
16
+
17
+
18
+ @_attrs_define
19
+ class StarredComponentListResponse:
20
+ """
21
+ Attributes:
22
+ data (list[StarredComponentResource]):
23
+ has_more (bool):
24
+ next_cursor (None | str):
25
+ object_ (str | Unset): Default: 'list'.
26
+ """
27
+
28
+ data: list[StarredComponentResource]
29
+ has_more: bool
30
+ next_cursor: None | str
31
+ object_: str | Unset = "list"
32
+ additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
33
+
34
+ def to_dict(self) -> dict[str, Any]:
35
+ data = []
36
+ for data_item_data in self.data:
37
+ data_item = data_item_data.to_dict()
38
+ data.append(data_item)
39
+
40
+ has_more = self.has_more
41
+
42
+ next_cursor: None | str
43
+ next_cursor = self.next_cursor
44
+
45
+ object_ = self.object_
46
+
47
+ field_dict: dict[str, Any] = {}
48
+ field_dict.update(self.additional_properties)
49
+ field_dict.update(
50
+ {
51
+ "data": data,
52
+ "has_more": has_more,
53
+ "next_cursor": next_cursor,
54
+ }
55
+ )
56
+ if object_ is not UNSET:
57
+ field_dict["object"] = object_
58
+
59
+ return field_dict
60
+
61
+ @classmethod
62
+ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
63
+ from thrustlab._models.starred_component_resource import StarredComponentResource
64
+
65
+ d = dict(src_dict)
66
+ data = []
67
+ _data = d.pop("data")
68
+ for data_item_data in _data:
69
+ data_item = StarredComponentResource.from_dict(data_item_data)
70
+
71
+ data.append(data_item)
72
+
73
+ has_more = d.pop("has_more")
74
+
75
+ def _parse_next_cursor(data: object) -> None | str:
76
+ if data is None:
77
+ return data
78
+ return cast(None | str, data)
79
+
80
+ next_cursor = _parse_next_cursor(d.pop("next_cursor"))
81
+
82
+ object_ = d.pop("object", UNSET)
83
+
84
+ starred_component_list_response = cls(
85
+ data=data,
86
+ has_more=has_more,
87
+ next_cursor=next_cursor,
88
+ object_=object_,
89
+ )
90
+
91
+ starred_component_list_response.additional_properties = d
92
+ return starred_component_list_response
93
+
94
+ @property
95
+ def additional_keys(self) -> list[str]:
96
+ return list(self.additional_properties.keys())
97
+
98
+ def __getitem__(self, key: str) -> Any:
99
+ return self.additional_properties[key]
100
+
101
+ def __setitem__(self, key: str, value: Any) -> None:
102
+ self.additional_properties[key] = value
103
+
104
+ def __delitem__(self, key: str) -> None:
105
+ del self.additional_properties[key]
106
+
107
+ def __contains__(self, key: str) -> bool:
108
+ return key in self.additional_properties