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,74 @@
1
+ from __future__ import annotations
2
+
3
+ from collections.abc import Mapping
4
+ from typing import 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
+ T = TypeVar("T", bound="ApiKeyCreate")
12
+
13
+
14
+ @_attrs_define
15
+ class ApiKeyCreate:
16
+ """Request body for POST /v1/api_keys.
17
+
18
+ Attributes:
19
+ name (None | str | Unset):
20
+ """
21
+
22
+ name: None | str | Unset = UNSET
23
+ additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
24
+
25
+ def to_dict(self) -> dict[str, Any]:
26
+ name: None | str | Unset
27
+ if isinstance(self.name, Unset):
28
+ name = UNSET
29
+ else:
30
+ name = self.name
31
+
32
+ field_dict: dict[str, Any] = {}
33
+ field_dict.update(self.additional_properties)
34
+ field_dict.update({})
35
+ if name is not UNSET:
36
+ field_dict["name"] = name
37
+
38
+ return field_dict
39
+
40
+ @classmethod
41
+ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
42
+ d = dict(src_dict)
43
+
44
+ def _parse_name(data: object) -> None | str | Unset:
45
+ if data is None:
46
+ return data
47
+ if isinstance(data, Unset):
48
+ return data
49
+ return cast(None | str | Unset, data)
50
+
51
+ name = _parse_name(d.pop("name", UNSET))
52
+
53
+ api_key_create = cls(
54
+ name=name,
55
+ )
56
+
57
+ api_key_create.additional_properties = d
58
+ return api_key_create
59
+
60
+ @property
61
+ def additional_keys(self) -> list[str]:
62
+ return list(self.additional_properties.keys())
63
+
64
+ def __getitem__(self, key: str) -> Any:
65
+ return self.additional_properties[key]
66
+
67
+ def __setitem__(self, key: str, value: Any) -> None:
68
+ self.additional_properties[key] = value
69
+
70
+ def __delitem__(self, key: str) -> None:
71
+ del self.additional_properties[key]
72
+
73
+ def __contains__(self, key: str) -> bool:
74
+ return key in self.additional_properties
@@ -0,0 +1,192 @@
1
+ from __future__ import annotations
2
+
3
+ import datetime
4
+ from collections.abc import Mapping
5
+ from typing import Any, Literal, 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
+ T = TypeVar("T", bound="ApiKeyWithSecret")
14
+
15
+
16
+ @_attrs_define
17
+ class ApiKeyWithSecret:
18
+ """Returned ONLY from POST /v1/api_keys.
19
+
20
+ Contains the raw key value that the caller must store immediately —
21
+ it cannot be retrieved again.
22
+
23
+ Attributes:
24
+ created_at (datetime.datetime):
25
+ id (str):
26
+ key (str):
27
+ key_prefix (str):
28
+ key_suffix (str):
29
+ last_used_at (datetime.datetime | None | Unset):
30
+ name (None | str | Unset):
31
+ object_ (Literal['api_key'] | Unset): Default: 'api_key'.
32
+ revoked_at (datetime.datetime | None | Unset):
33
+ """
34
+
35
+ created_at: datetime.datetime
36
+ id: str
37
+ key: str
38
+ key_prefix: str
39
+ key_suffix: str
40
+ last_used_at: datetime.datetime | None | Unset = UNSET
41
+ name: None | str | Unset = UNSET
42
+ object_: Literal["api_key"] | Unset = "api_key"
43
+ revoked_at: datetime.datetime | None | Unset = UNSET
44
+ additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
45
+
46
+ def to_dict(self) -> dict[str, Any]:
47
+ created_at = self.created_at.isoformat()
48
+
49
+ id = self.id
50
+
51
+ key = self.key
52
+
53
+ key_prefix = self.key_prefix
54
+
55
+ key_suffix = self.key_suffix
56
+
57
+ last_used_at: None | str | Unset
58
+ if isinstance(self.last_used_at, Unset):
59
+ last_used_at = UNSET
60
+ elif isinstance(self.last_used_at, datetime.datetime):
61
+ last_used_at = self.last_used_at.isoformat()
62
+ else:
63
+ last_used_at = self.last_used_at
64
+
65
+ name: None | str | Unset
66
+ if isinstance(self.name, Unset):
67
+ name = UNSET
68
+ else:
69
+ name = self.name
70
+
71
+ object_ = self.object_
72
+
73
+ revoked_at: None | str | Unset
74
+ if isinstance(self.revoked_at, Unset):
75
+ revoked_at = UNSET
76
+ elif isinstance(self.revoked_at, datetime.datetime):
77
+ revoked_at = self.revoked_at.isoformat()
78
+ else:
79
+ revoked_at = self.revoked_at
80
+
81
+ field_dict: dict[str, Any] = {}
82
+ field_dict.update(self.additional_properties)
83
+ field_dict.update(
84
+ {
85
+ "created_at": created_at,
86
+ "id": id,
87
+ "key": key,
88
+ "key_prefix": key_prefix,
89
+ "key_suffix": key_suffix,
90
+ }
91
+ )
92
+ if last_used_at is not UNSET:
93
+ field_dict["last_used_at"] = last_used_at
94
+ if name is not UNSET:
95
+ field_dict["name"] = name
96
+ if object_ is not UNSET:
97
+ field_dict["object"] = object_
98
+ if revoked_at is not UNSET:
99
+ field_dict["revoked_at"] = revoked_at
100
+
101
+ return field_dict
102
+
103
+ @classmethod
104
+ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
105
+ d = dict(src_dict)
106
+ created_at = isoparse(d.pop("created_at"))
107
+
108
+ id = d.pop("id")
109
+
110
+ key = d.pop("key")
111
+
112
+ key_prefix = d.pop("key_prefix")
113
+
114
+ key_suffix = d.pop("key_suffix")
115
+
116
+ def _parse_last_used_at(data: object) -> datetime.datetime | None | Unset:
117
+ if data is None:
118
+ return data
119
+ if isinstance(data, Unset):
120
+ return data
121
+ try:
122
+ if not isinstance(data, str):
123
+ raise TypeError()
124
+ last_used_at_type_0 = isoparse(data)
125
+
126
+ return last_used_at_type_0
127
+ except (TypeError, ValueError, AttributeError, KeyError):
128
+ pass
129
+ return cast(datetime.datetime | None | Unset, data)
130
+
131
+ last_used_at = _parse_last_used_at(d.pop("last_used_at", UNSET))
132
+
133
+ def _parse_name(data: object) -> None | str | Unset:
134
+ if data is None:
135
+ return data
136
+ if isinstance(data, Unset):
137
+ return data
138
+ return cast(None | str | Unset, data)
139
+
140
+ name = _parse_name(d.pop("name", UNSET))
141
+
142
+ object_ = cast(Literal["api_key"] | Unset, d.pop("object", UNSET))
143
+ if object_ != "api_key" and not isinstance(object_, Unset):
144
+ raise ValueError(f"object must match const 'api_key', got '{object_}'")
145
+
146
+ def _parse_revoked_at(data: object) -> datetime.datetime | None | Unset:
147
+ if data is None:
148
+ return data
149
+ if isinstance(data, Unset):
150
+ return data
151
+ try:
152
+ if not isinstance(data, str):
153
+ raise TypeError()
154
+ revoked_at_type_0 = isoparse(data)
155
+
156
+ return revoked_at_type_0
157
+ except (TypeError, ValueError, AttributeError, KeyError):
158
+ pass
159
+ return cast(datetime.datetime | None | Unset, data)
160
+
161
+ revoked_at = _parse_revoked_at(d.pop("revoked_at", UNSET))
162
+
163
+ api_key_with_secret = cls(
164
+ created_at=created_at,
165
+ id=id,
166
+ key=key,
167
+ key_prefix=key_prefix,
168
+ key_suffix=key_suffix,
169
+ last_used_at=last_used_at,
170
+ name=name,
171
+ object_=object_,
172
+ revoked_at=revoked_at,
173
+ )
174
+
175
+ api_key_with_secret.additional_properties = d
176
+ return api_key_with_secret
177
+
178
+ @property
179
+ def additional_keys(self) -> list[str]:
180
+ return list(self.additional_properties.keys())
181
+
182
+ def __getitem__(self, key: str) -> Any:
183
+ return self.additional_properties[key]
184
+
185
+ def __setitem__(self, key: str, value: Any) -> None:
186
+ self.additional_properties[key] = value
187
+
188
+ def __delitem__(self, key: str) -> None:
189
+ del self.additional_properties[key]
190
+
191
+ def __contains__(self, key: str) -> bool:
192
+ return key in self.additional_properties
@@ -0,0 +1,74 @@
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.types import UNSET, Unset
10
+
11
+ T = TypeVar("T", bound="BillingPortalSessionResource")
12
+
13
+
14
+ @_attrs_define
15
+ class BillingPortalSessionResource:
16
+ """
17
+ Attributes:
18
+ url (str):
19
+ object_ (Literal['billing_portal_session'] | Unset): Default: 'billing_portal_session'.
20
+ """
21
+
22
+ url: str
23
+ object_: Literal["billing_portal_session"] | Unset = "billing_portal_session"
24
+ additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
25
+
26
+ def to_dict(self) -> dict[str, Any]:
27
+ url = self.url
28
+
29
+ object_ = self.object_
30
+
31
+ field_dict: dict[str, Any] = {}
32
+ field_dict.update(self.additional_properties)
33
+ field_dict.update(
34
+ {
35
+ "url": url,
36
+ }
37
+ )
38
+ if object_ is not UNSET:
39
+ field_dict["object"] = object_
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
+ url = d.pop("url")
47
+
48
+ object_ = cast(Literal["billing_portal_session"] | Unset, d.pop("object", UNSET))
49
+ if object_ != "billing_portal_session" and not isinstance(object_, Unset):
50
+ raise ValueError(f"object must match const 'billing_portal_session', got '{object_}'")
51
+
52
+ billing_portal_session_resource = cls(
53
+ url=url,
54
+ object_=object_,
55
+ )
56
+
57
+ billing_portal_session_resource.additional_properties = d
58
+ return billing_portal_session_resource
59
+
60
+ @property
61
+ def additional_keys(self) -> list[str]:
62
+ return list(self.additional_properties.keys())
63
+
64
+ def __getitem__(self, key: str) -> Any:
65
+ return self.additional_properties[key]
66
+
67
+ def __setitem__(self, key: str, value: Any) -> None:
68
+ self.additional_properties[key] = value
69
+
70
+ def __delitem__(self, key: str) -> None:
71
+ del self.additional_properties[key]
72
+
73
+ def __contains__(self, key: str) -> bool:
74
+ return key in self.additional_properties
@@ -0,0 +1,94 @@
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.types import UNSET, Unset
10
+
11
+ T = TypeVar("T", bound="CheckoutSessionResource")
12
+
13
+
14
+ @_attrs_define
15
+ class CheckoutSessionResource:
16
+ """
17
+ Attributes:
18
+ checkout_url (str):
19
+ object_ (Literal['checkout_session'] | Unset): Default: 'checkout_session'.
20
+ subscription_id (None | str | Unset):
21
+ """
22
+
23
+ checkout_url: str
24
+ object_: Literal["checkout_session"] | Unset = "checkout_session"
25
+ subscription_id: None | str | Unset = UNSET
26
+ additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
27
+
28
+ def to_dict(self) -> dict[str, Any]:
29
+ checkout_url = self.checkout_url
30
+
31
+ object_ = self.object_
32
+
33
+ subscription_id: None | str | Unset
34
+ if isinstance(self.subscription_id, Unset):
35
+ subscription_id = UNSET
36
+ else:
37
+ subscription_id = self.subscription_id
38
+
39
+ field_dict: dict[str, Any] = {}
40
+ field_dict.update(self.additional_properties)
41
+ field_dict.update(
42
+ {
43
+ "checkout_url": checkout_url,
44
+ }
45
+ )
46
+ if object_ is not UNSET:
47
+ field_dict["object"] = object_
48
+ if subscription_id is not UNSET:
49
+ field_dict["subscription_id"] = subscription_id
50
+
51
+ return field_dict
52
+
53
+ @classmethod
54
+ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
55
+ d = dict(src_dict)
56
+ checkout_url = d.pop("checkout_url")
57
+
58
+ object_ = cast(Literal["checkout_session"] | Unset, d.pop("object", UNSET))
59
+ if object_ != "checkout_session" and not isinstance(object_, Unset):
60
+ raise ValueError(f"object must match const 'checkout_session', got '{object_}'")
61
+
62
+ def _parse_subscription_id(data: object) -> None | str | Unset:
63
+ if data is None:
64
+ return data
65
+ if isinstance(data, Unset):
66
+ return data
67
+ return cast(None | str | Unset, data)
68
+
69
+ subscription_id = _parse_subscription_id(d.pop("subscription_id", UNSET))
70
+
71
+ checkout_session_resource = cls(
72
+ checkout_url=checkout_url,
73
+ object_=object_,
74
+ subscription_id=subscription_id,
75
+ )
76
+
77
+ checkout_session_resource.additional_properties = d
78
+ return checkout_session_resource
79
+
80
+ @property
81
+ def additional_keys(self) -> list[str]:
82
+ return list(self.additional_properties.keys())
83
+
84
+ def __getitem__(self, key: str) -> Any:
85
+ return self.additional_properties[key]
86
+
87
+ def __setitem__(self, key: str, value: Any) -> None:
88
+ self.additional_properties[key] = value
89
+
90
+ def __delitem__(self, key: str) -> None:
91
+ del self.additional_properties[key]
92
+
93
+ def __contains__(self, key: str) -> bool:
94
+ 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
+ from thrustlab._models.types import UNSET, Unset
10
+
11
+ T = TypeVar("T", bound="ComponentBrand")
12
+
13
+
14
+ @_attrs_define
15
+ class ComponentBrand:
16
+ """
17
+ Attributes:
18
+ count (int):
19
+ name (str):
20
+ object_ (str | Unset): Default: 'component_brand'.
21
+ """
22
+
23
+ count: int
24
+ name: str
25
+ object_: str | Unset = "component_brand"
26
+ additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
27
+
28
+ def to_dict(self) -> dict[str, Any]:
29
+ count = self.count
30
+
31
+ name = self.name
32
+
33
+ object_ = self.object_
34
+
35
+ field_dict: dict[str, Any] = {}
36
+ field_dict.update(self.additional_properties)
37
+ field_dict.update(
38
+ {
39
+ "count": count,
40
+ "name": name,
41
+ }
42
+ )
43
+ if object_ is not UNSET:
44
+ field_dict["object"] = object_
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
+ count = d.pop("count")
52
+
53
+ name = d.pop("name")
54
+
55
+ object_ = d.pop("object", UNSET)
56
+
57
+ component_brand = cls(
58
+ count=count,
59
+ name=name,
60
+ object_=object_,
61
+ )
62
+
63
+ component_brand.additional_properties = d
64
+ return component_brand
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.component_brand import ComponentBrand
13
+
14
+
15
+ T = TypeVar("T", bound="ComponentBrandsResponse")
16
+
17
+
18
+ @_attrs_define
19
+ class ComponentBrandsResponse:
20
+ """
21
+ Attributes:
22
+ data (list[ComponentBrand]):
23
+ has_more (bool):
24
+ next_cursor (None | str):
25
+ object_ (str | Unset): Default: 'list'.
26
+ """
27
+
28
+ data: list[ComponentBrand]
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.component_brand import ComponentBrand
64
+
65
+ d = dict(src_dict)
66
+ data = []
67
+ _data = d.pop("data")
68
+ for data_item_data in _data:
69
+ data_item = ComponentBrand.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
+ component_brands_response = cls(
85
+ data=data,
86
+ has_more=has_more,
87
+ next_cursor=next_cursor,
88
+ object_=object_,
89
+ )
90
+
91
+ component_brands_response.additional_properties = d
92
+ return component_brands_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
@@ -0,0 +1,83 @@
1
+ from __future__ import annotations
2
+
3
+ from collections.abc import Mapping
4
+ from typing import TYPE_CHECKING, Any, TypeVar
5
+
6
+ from attrs import define as _attrs_define
7
+ from attrs import field as _attrs_field
8
+
9
+ if TYPE_CHECKING:
10
+ from thrustlab._models.component_create_body_spec_json import ComponentCreateBodySpecJson
11
+
12
+
13
+ T = TypeVar("T", bound="ComponentCreateBody")
14
+
15
+
16
+ @_attrs_define
17
+ class ComponentCreateBody:
18
+ """
19
+ Attributes:
20
+ name (str):
21
+ spec_json (ComponentCreateBodySpecJson):
22
+ type_ (str):
23
+ """
24
+
25
+ name: str
26
+ spec_json: ComponentCreateBodySpecJson
27
+ type_: str
28
+ additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
29
+
30
+ def to_dict(self) -> dict[str, Any]:
31
+ name = self.name
32
+
33
+ spec_json = self.spec_json.to_dict()
34
+
35
+ type_ = self.type_
36
+
37
+ field_dict: dict[str, Any] = {}
38
+ field_dict.update(self.additional_properties)
39
+ field_dict.update(
40
+ {
41
+ "name": name,
42
+ "spec_json": spec_json,
43
+ "type": type_,
44
+ }
45
+ )
46
+
47
+ return field_dict
48
+
49
+ @classmethod
50
+ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
51
+ from thrustlab._models.component_create_body_spec_json import ComponentCreateBodySpecJson
52
+
53
+ d = dict(src_dict)
54
+ name = d.pop("name")
55
+
56
+ spec_json = ComponentCreateBodySpecJson.from_dict(d.pop("spec_json"))
57
+
58
+ type_ = d.pop("type")
59
+
60
+ component_create_body = cls(
61
+ name=name,
62
+ spec_json=spec_json,
63
+ type_=type_,
64
+ )
65
+
66
+ component_create_body.additional_properties = d
67
+ return component_create_body
68
+
69
+ @property
70
+ def additional_keys(self) -> list[str]:
71
+ return list(self.additional_properties.keys())
72
+
73
+ def __getitem__(self, key: str) -> Any:
74
+ return self.additional_properties[key]
75
+
76
+ def __setitem__(self, key: str, value: Any) -> None:
77
+ self.additional_properties[key] = value
78
+
79
+ def __delitem__(self, key: str) -> None:
80
+ del self.additional_properties[key]
81
+
82
+ def __contains__(self, key: str) -> bool:
83
+ return key in self.additional_properties