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,106 @@
1
+ from __future__ import annotations
2
+
3
+ import datetime
4
+ from collections.abc import Mapping
5
+ from typing import Any, TypeVar
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="StarredComponentResource")
14
+
15
+
16
+ @_attrs_define
17
+ class StarredComponentResource:
18
+ """
19
+ Attributes:
20
+ component_id (str):
21
+ component_type (str):
22
+ created_at (datetime.datetime):
23
+ id (str):
24
+ project_id (str):
25
+ object_ (str | Unset): Default: 'starred_component'.
26
+ """
27
+
28
+ component_id: str
29
+ component_type: str
30
+ created_at: datetime.datetime
31
+ id: str
32
+ project_id: str
33
+ object_: str | Unset = "starred_component"
34
+ additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
35
+
36
+ def to_dict(self) -> dict[str, Any]:
37
+ component_id = self.component_id
38
+
39
+ component_type = self.component_type
40
+
41
+ created_at = self.created_at.isoformat()
42
+
43
+ id = self.id
44
+
45
+ project_id = self.project_id
46
+
47
+ object_ = self.object_
48
+
49
+ field_dict: dict[str, Any] = {}
50
+ field_dict.update(self.additional_properties)
51
+ field_dict.update(
52
+ {
53
+ "component_id": component_id,
54
+ "component_type": component_type,
55
+ "created_at": created_at,
56
+ "id": id,
57
+ "project_id": project_id,
58
+ }
59
+ )
60
+ if object_ is not UNSET:
61
+ field_dict["object"] = object_
62
+
63
+ return field_dict
64
+
65
+ @classmethod
66
+ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
67
+ d = dict(src_dict)
68
+ component_id = d.pop("component_id")
69
+
70
+ component_type = d.pop("component_type")
71
+
72
+ created_at = isoparse(d.pop("created_at"))
73
+
74
+ id = d.pop("id")
75
+
76
+ project_id = d.pop("project_id")
77
+
78
+ object_ = d.pop("object", UNSET)
79
+
80
+ starred_component_resource = cls(
81
+ component_id=component_id,
82
+ component_type=component_type,
83
+ created_at=created_at,
84
+ id=id,
85
+ project_id=project_id,
86
+ object_=object_,
87
+ )
88
+
89
+ starred_component_resource.additional_properties = d
90
+ return starred_component_resource
91
+
92
+ @property
93
+ def additional_keys(self) -> list[str]:
94
+ return list(self.additional_properties.keys())
95
+
96
+ def __getitem__(self, key: str) -> Any:
97
+ return self.additional_properties[key]
98
+
99
+ def __setitem__(self, key: str, value: Any) -> None:
100
+ self.additional_properties[key] = value
101
+
102
+ def __delitem__(self, key: str) -> None:
103
+ del self.additional_properties[key]
104
+
105
+ def __contains__(self, key: str) -> bool:
106
+ return key in self.additional_properties
@@ -0,0 +1,121 @@
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.submission_create_body_data_json import SubmissionCreateBodyDataJson
13
+
14
+
15
+ T = TypeVar("T", bound="SubmissionCreateBody")
16
+
17
+
18
+ @_attrs_define
19
+ class SubmissionCreateBody:
20
+ """
21
+ Attributes:
22
+ component_type (str):
23
+ data_json (SubmissionCreateBodyDataJson):
24
+ manufacturer (str):
25
+ name (str):
26
+ source_url (str):
27
+ notes (None | str | Unset):
28
+ """
29
+
30
+ component_type: str
31
+ data_json: SubmissionCreateBodyDataJson
32
+ manufacturer: str
33
+ name: str
34
+ source_url: str
35
+ notes: None | str | Unset = UNSET
36
+ additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
37
+
38
+ def to_dict(self) -> dict[str, Any]:
39
+ component_type = self.component_type
40
+
41
+ data_json = self.data_json.to_dict()
42
+
43
+ manufacturer = self.manufacturer
44
+
45
+ name = self.name
46
+
47
+ source_url = self.source_url
48
+
49
+ notes: None | str | Unset
50
+ if isinstance(self.notes, Unset):
51
+ notes = UNSET
52
+ else:
53
+ notes = self.notes
54
+
55
+ field_dict: dict[str, Any] = {}
56
+ field_dict.update(self.additional_properties)
57
+ field_dict.update(
58
+ {
59
+ "component_type": component_type,
60
+ "data_json": data_json,
61
+ "manufacturer": manufacturer,
62
+ "name": name,
63
+ "source_url": source_url,
64
+ }
65
+ )
66
+ if notes is not UNSET:
67
+ field_dict["notes"] = notes
68
+
69
+ return field_dict
70
+
71
+ @classmethod
72
+ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
73
+ from thrustlab._models.submission_create_body_data_json import SubmissionCreateBodyDataJson
74
+
75
+ d = dict(src_dict)
76
+ component_type = d.pop("component_type")
77
+
78
+ data_json = SubmissionCreateBodyDataJson.from_dict(d.pop("data_json"))
79
+
80
+ manufacturer = d.pop("manufacturer")
81
+
82
+ name = d.pop("name")
83
+
84
+ source_url = d.pop("source_url")
85
+
86
+ def _parse_notes(data: object) -> None | str | Unset:
87
+ if data is None:
88
+ return data
89
+ if isinstance(data, Unset):
90
+ return data
91
+ return cast(None | str | Unset, data)
92
+
93
+ notes = _parse_notes(d.pop("notes", UNSET))
94
+
95
+ submission_create_body = cls(
96
+ component_type=component_type,
97
+ data_json=data_json,
98
+ manufacturer=manufacturer,
99
+ name=name,
100
+ source_url=source_url,
101
+ notes=notes,
102
+ )
103
+
104
+ submission_create_body.additional_properties = d
105
+ return submission_create_body
106
+
107
+ @property
108
+ def additional_keys(self) -> list[str]:
109
+ return list(self.additional_properties.keys())
110
+
111
+ def __getitem__(self, key: str) -> Any:
112
+ return self.additional_properties[key]
113
+
114
+ def __setitem__(self, key: str, value: Any) -> None:
115
+ self.additional_properties[key] = value
116
+
117
+ def __delitem__(self, key: str) -> None:
118
+ del self.additional_properties[key]
119
+
120
+ def __contains__(self, key: str) -> bool:
121
+ 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="SubmissionCreateBodyDataJson")
10
+
11
+
12
+ @_attrs_define
13
+ class SubmissionCreateBodyDataJson:
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_create_body_data_json = cls()
28
+
29
+ submission_create_body_data_json.additional_properties = d
30
+ return submission_create_body_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,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.submission_resource import SubmissionResource
13
+
14
+
15
+ T = TypeVar("T", bound="SubmissionListResponse")
16
+
17
+
18
+ @_attrs_define
19
+ class SubmissionListResponse:
20
+ """
21
+ Attributes:
22
+ data (list[SubmissionResource]):
23
+ has_more (bool):
24
+ next_cursor (None | str):
25
+ object_ (str | Unset): Default: 'list'.
26
+ """
27
+
28
+ data: list[SubmissionResource]
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.submission_resource import SubmissionResource
64
+
65
+ d = dict(src_dict)
66
+ data = []
67
+ _data = d.pop("data")
68
+ for data_item_data in _data:
69
+ data_item = SubmissionResource.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
+ submission_list_response = cls(
85
+ data=data,
86
+ has_more=has_more,
87
+ next_cursor=next_cursor,
88
+ object_=object_,
89
+ )
90
+
91
+ submission_list_response.additional_properties = d
92
+ return submission_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
@@ -0,0 +1,174 @@
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.submission_patch_data_json_type_0 import SubmissionPatchDataJsonType0
13
+
14
+
15
+ T = TypeVar("T", bound="SubmissionPatch")
16
+
17
+
18
+ @_attrs_define
19
+ class SubmissionPatch:
20
+ """Withdraw/edit-before-review fields. component_type excluded —
21
+ structural classifier; changing it would invalidate downstream
22
+ review pipelines.
23
+
24
+ Attributes:
25
+ data_json (None | SubmissionPatchDataJsonType0 | Unset):
26
+ manufacturer (None | str | Unset):
27
+ name (None | str | Unset):
28
+ notes (None | str | Unset):
29
+ source_url (None | str | Unset):
30
+ """
31
+
32
+ data_json: None | SubmissionPatchDataJsonType0 | Unset = UNSET
33
+ manufacturer: None | str | Unset = UNSET
34
+ name: None | str | Unset = UNSET
35
+ notes: None | str | Unset = UNSET
36
+ source_url: None | str | Unset = UNSET
37
+ additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
38
+
39
+ def to_dict(self) -> dict[str, Any]:
40
+ from thrustlab._models.submission_patch_data_json_type_0 import SubmissionPatchDataJsonType0
41
+
42
+ data_json: dict[str, Any] | None | Unset
43
+ if isinstance(self.data_json, Unset):
44
+ data_json = UNSET
45
+ elif isinstance(self.data_json, SubmissionPatchDataJsonType0):
46
+ data_json = self.data_json.to_dict()
47
+ else:
48
+ data_json = self.data_json
49
+
50
+ manufacturer: None | str | Unset
51
+ if isinstance(self.manufacturer, Unset):
52
+ manufacturer = UNSET
53
+ else:
54
+ manufacturer = self.manufacturer
55
+
56
+ name: None | str | Unset
57
+ if isinstance(self.name, Unset):
58
+ name = UNSET
59
+ else:
60
+ name = self.name
61
+
62
+ notes: None | str | Unset
63
+ if isinstance(self.notes, Unset):
64
+ notes = UNSET
65
+ else:
66
+ notes = self.notes
67
+
68
+ source_url: None | str | Unset
69
+ if isinstance(self.source_url, Unset):
70
+ source_url = UNSET
71
+ else:
72
+ source_url = self.source_url
73
+
74
+ field_dict: dict[str, Any] = {}
75
+ field_dict.update(self.additional_properties)
76
+ field_dict.update({})
77
+ if data_json is not UNSET:
78
+ field_dict["data_json"] = data_json
79
+ if manufacturer is not UNSET:
80
+ field_dict["manufacturer"] = manufacturer
81
+ if name is not UNSET:
82
+ field_dict["name"] = name
83
+ if notes is not UNSET:
84
+ field_dict["notes"] = notes
85
+ if source_url is not UNSET:
86
+ field_dict["source_url"] = source_url
87
+
88
+ return field_dict
89
+
90
+ @classmethod
91
+ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
92
+ from thrustlab._models.submission_patch_data_json_type_0 import SubmissionPatchDataJsonType0
93
+
94
+ d = dict(src_dict)
95
+
96
+ def _parse_data_json(data: object) -> None | SubmissionPatchDataJsonType0 | Unset:
97
+ if data is None:
98
+ return data
99
+ if isinstance(data, Unset):
100
+ return data
101
+ try:
102
+ if not isinstance(data, dict):
103
+ raise TypeError()
104
+ data_json_type_0 = SubmissionPatchDataJsonType0.from_dict(data)
105
+
106
+ return data_json_type_0
107
+ except (TypeError, ValueError, AttributeError, KeyError):
108
+ pass
109
+ return cast(None | SubmissionPatchDataJsonType0 | Unset, data)
110
+
111
+ data_json = _parse_data_json(d.pop("data_json", UNSET))
112
+
113
+ def _parse_manufacturer(data: object) -> None | str | Unset:
114
+ if data is None:
115
+ return data
116
+ if isinstance(data, Unset):
117
+ return data
118
+ return cast(None | str | Unset, data)
119
+
120
+ manufacturer = _parse_manufacturer(d.pop("manufacturer", UNSET))
121
+
122
+ def _parse_name(data: object) -> None | str | Unset:
123
+ if data is None:
124
+ return data
125
+ if isinstance(data, Unset):
126
+ return data
127
+ return cast(None | str | Unset, data)
128
+
129
+ name = _parse_name(d.pop("name", UNSET))
130
+
131
+ def _parse_notes(data: object) -> None | str | Unset:
132
+ if data is None:
133
+ return data
134
+ if isinstance(data, Unset):
135
+ return data
136
+ return cast(None | str | Unset, data)
137
+
138
+ notes = _parse_notes(d.pop("notes", UNSET))
139
+
140
+ def _parse_source_url(data: object) -> None | str | Unset:
141
+ if data is None:
142
+ return data
143
+ if isinstance(data, Unset):
144
+ return data
145
+ return cast(None | str | Unset, data)
146
+
147
+ source_url = _parse_source_url(d.pop("source_url", UNSET))
148
+
149
+ submission_patch = cls(
150
+ data_json=data_json,
151
+ manufacturer=manufacturer,
152
+ name=name,
153
+ notes=notes,
154
+ source_url=source_url,
155
+ )
156
+
157
+ submission_patch.additional_properties = d
158
+ return submission_patch
159
+
160
+ @property
161
+ def additional_keys(self) -> list[str]:
162
+ return list(self.additional_properties.keys())
163
+
164
+ def __getitem__(self, key: str) -> Any:
165
+ return self.additional_properties[key]
166
+
167
+ def __setitem__(self, key: str, value: Any) -> None:
168
+ self.additional_properties[key] = value
169
+
170
+ def __delitem__(self, key: str) -> None:
171
+ del self.additional_properties[key]
172
+
173
+ def __contains__(self, key: str) -> bool:
174
+ 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="SubmissionPatchDataJsonType0")
10
+
11
+
12
+ @_attrs_define
13
+ class SubmissionPatchDataJsonType0:
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_patch_data_json_type_0 = cls()
28
+
29
+ submission_patch_data_json_type_0.additional_properties = d
30
+ return submission_patch_data_json_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