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,73 @@
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="UserPatch")
12
+
13
+
14
+ @_attrs_define
15
+ class UserPatch:
16
+ """
17
+ Attributes:
18
+ email (None | str | Unset):
19
+ """
20
+
21
+ email: None | str | Unset = UNSET
22
+ additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
23
+
24
+ def to_dict(self) -> dict[str, Any]:
25
+ email: None | str | Unset
26
+ if isinstance(self.email, Unset):
27
+ email = UNSET
28
+ else:
29
+ email = self.email
30
+
31
+ field_dict: dict[str, Any] = {}
32
+ field_dict.update(self.additional_properties)
33
+ field_dict.update({})
34
+ if email is not UNSET:
35
+ field_dict["email"] = email
36
+
37
+ return field_dict
38
+
39
+ @classmethod
40
+ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
41
+ d = dict(src_dict)
42
+
43
+ def _parse_email(data: object) -> None | str | Unset:
44
+ if data is None:
45
+ return data
46
+ if isinstance(data, Unset):
47
+ return data
48
+ return cast(None | str | Unset, data)
49
+
50
+ email = _parse_email(d.pop("email", UNSET))
51
+
52
+ user_patch = cls(
53
+ email=email,
54
+ )
55
+
56
+ user_patch.additional_properties = d
57
+ return user_patch
58
+
59
+ @property
60
+ def additional_keys(self) -> list[str]:
61
+ return list(self.additional_properties.keys())
62
+
63
+ def __getitem__(self, key: str) -> Any:
64
+ return self.additional_properties[key]
65
+
66
+ def __setitem__(self, key: str, value: Any) -> None:
67
+ self.additional_properties[key] = value
68
+
69
+ def __delitem__(self, key: str) -> None:
70
+ del self.additional_properties[key]
71
+
72
+ def __contains__(self, key: str) -> bool:
73
+ return key in self.additional_properties
@@ -0,0 +1,170 @@
1
+ from __future__ import annotations
2
+
3
+ import datetime
4
+ from collections.abc import Mapping
5
+ from typing import 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
+ T = TypeVar("T", bound="UserResource")
14
+
15
+
16
+ @_attrs_define
17
+ class UserResource:
18
+ """
19
+ Attributes:
20
+ created_at (datetime.datetime):
21
+ email (str):
22
+ email_verified (bool):
23
+ id (str):
24
+ tier (str):
25
+ trial_days_remaining (int | None):
26
+ trial_end (datetime.datetime | None):
27
+ trial_start (datetime.datetime | None):
28
+ object_ (str | Unset): Default: 'user'.
29
+ """
30
+
31
+ created_at: datetime.datetime
32
+ email: str
33
+ email_verified: bool
34
+ id: str
35
+ tier: str
36
+ trial_days_remaining: int | None
37
+ trial_end: datetime.datetime | None
38
+ trial_start: datetime.datetime | None
39
+ object_: str | Unset = "user"
40
+ additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
41
+
42
+ def to_dict(self) -> dict[str, Any]:
43
+ created_at = self.created_at.isoformat()
44
+
45
+ email = self.email
46
+
47
+ email_verified = self.email_verified
48
+
49
+ id = self.id
50
+
51
+ tier = self.tier
52
+
53
+ trial_days_remaining: int | None
54
+ trial_days_remaining = self.trial_days_remaining
55
+
56
+ trial_end: None | str
57
+ if isinstance(self.trial_end, datetime.datetime):
58
+ trial_end = self.trial_end.isoformat()
59
+ else:
60
+ trial_end = self.trial_end
61
+
62
+ trial_start: None | str
63
+ if isinstance(self.trial_start, datetime.datetime):
64
+ trial_start = self.trial_start.isoformat()
65
+ else:
66
+ trial_start = self.trial_start
67
+
68
+ object_ = self.object_
69
+
70
+ field_dict: dict[str, Any] = {}
71
+ field_dict.update(self.additional_properties)
72
+ field_dict.update(
73
+ {
74
+ "created_at": created_at,
75
+ "email": email,
76
+ "email_verified": email_verified,
77
+ "id": id,
78
+ "tier": tier,
79
+ "trial_days_remaining": trial_days_remaining,
80
+ "trial_end": trial_end,
81
+ "trial_start": trial_start,
82
+ }
83
+ )
84
+ if object_ is not UNSET:
85
+ field_dict["object"] = object_
86
+
87
+ return field_dict
88
+
89
+ @classmethod
90
+ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
91
+ d = dict(src_dict)
92
+ created_at = isoparse(d.pop("created_at"))
93
+
94
+ email = d.pop("email")
95
+
96
+ email_verified = d.pop("email_verified")
97
+
98
+ id = d.pop("id")
99
+
100
+ tier = d.pop("tier")
101
+
102
+ def _parse_trial_days_remaining(data: object) -> int | None:
103
+ if data is None:
104
+ return data
105
+ return cast(int | None, data)
106
+
107
+ trial_days_remaining = _parse_trial_days_remaining(d.pop("trial_days_remaining"))
108
+
109
+ def _parse_trial_end(data: object) -> datetime.datetime | None:
110
+ if data is None:
111
+ return data
112
+ try:
113
+ if not isinstance(data, str):
114
+ raise TypeError()
115
+ trial_end_type_0 = isoparse(data)
116
+
117
+ return trial_end_type_0
118
+ except (TypeError, ValueError, AttributeError, KeyError):
119
+ pass
120
+ return cast(datetime.datetime | None, data)
121
+
122
+ trial_end = _parse_trial_end(d.pop("trial_end"))
123
+
124
+ def _parse_trial_start(data: object) -> datetime.datetime | None:
125
+ if data is None:
126
+ return data
127
+ try:
128
+ if not isinstance(data, str):
129
+ raise TypeError()
130
+ trial_start_type_0 = isoparse(data)
131
+
132
+ return trial_start_type_0
133
+ except (TypeError, ValueError, AttributeError, KeyError):
134
+ pass
135
+ return cast(datetime.datetime | None, data)
136
+
137
+ trial_start = _parse_trial_start(d.pop("trial_start"))
138
+
139
+ object_ = d.pop("object", UNSET)
140
+
141
+ user_resource = cls(
142
+ created_at=created_at,
143
+ email=email,
144
+ email_verified=email_verified,
145
+ id=id,
146
+ tier=tier,
147
+ trial_days_remaining=trial_days_remaining,
148
+ trial_end=trial_end,
149
+ trial_start=trial_start,
150
+ object_=object_,
151
+ )
152
+
153
+ user_resource.additional_properties = d
154
+ return user_resource
155
+
156
+ @property
157
+ def additional_keys(self) -> list[str]:
158
+ return list(self.additional_properties.keys())
159
+
160
+ def __getitem__(self, key: str) -> Any:
161
+ return self.additional_properties[key]
162
+
163
+ def __setitem__(self, key: str, value: Any) -> None:
164
+ self.additional_properties[key] = value
165
+
166
+ def __delitem__(self, key: str) -> None:
167
+ del self.additional_properties[key]
168
+
169
+ def __contains__(self, key: str) -> bool:
170
+ 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="V1HealthV1HealthGetResponseV1HealthV1HealthGet")
10
+
11
+
12
+ @_attrs_define
13
+ class V1HealthV1HealthGetResponseV1HealthV1HealthGet:
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
+ v1_health_v1_health_get_response_v1_health_v1_health_get = cls()
28
+
29
+ v1_health_v1_health_get_response_v1_health_v1_health_get.additional_properties = d
30
+ return v1_health_v1_health_get_response_v1_health_v1_health_get
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,90 @@
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
+ T = TypeVar("T", bound="ValidationError")
10
+
11
+
12
+ @_attrs_define
13
+ class ValidationError:
14
+ """
15
+ Attributes:
16
+ loc (list[int | str]):
17
+ msg (str):
18
+ type_ (str):
19
+ """
20
+
21
+ loc: list[int | str]
22
+ msg: str
23
+ type_: str
24
+ additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
25
+
26
+ def to_dict(self) -> dict[str, Any]:
27
+ loc = []
28
+ for loc_item_data in self.loc:
29
+ loc_item: int | str
30
+ loc_item = loc_item_data
31
+ loc.append(loc_item)
32
+
33
+ msg = self.msg
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
+ "loc": loc,
42
+ "msg": msg,
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
+ d = dict(src_dict)
52
+ loc = []
53
+ _loc = d.pop("loc")
54
+ for loc_item_data in _loc:
55
+
56
+ def _parse_loc_item(data: object) -> int | str:
57
+ return cast(int | str, data)
58
+
59
+ loc_item = _parse_loc_item(loc_item_data)
60
+
61
+ loc.append(loc_item)
62
+
63
+ msg = d.pop("msg")
64
+
65
+ type_ = d.pop("type")
66
+
67
+ validation_error = cls(
68
+ loc=loc,
69
+ msg=msg,
70
+ type_=type_,
71
+ )
72
+
73
+ validation_error.additional_properties = d
74
+ return validation_error
75
+
76
+ @property
77
+ def additional_keys(self) -> list[str]:
78
+ return list(self.additional_properties.keys())
79
+
80
+ def __getitem__(self, key: str) -> Any:
81
+ return self.additional_properties[key]
82
+
83
+ def __setitem__(self, key: str, value: Any) -> None:
84
+ self.additional_properties[key] = value
85
+
86
+ def __delitem__(self, key: str) -> None:
87
+ del self.additional_properties[key]
88
+
89
+ def __contains__(self, key: str) -> bool:
90
+ return key in self.additional_properties
@@ -0,0 +1,91 @@
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="WebhookEndpointCreate")
12
+
13
+
14
+ @_attrs_define
15
+ class WebhookEndpointCreate:
16
+ """
17
+ Attributes:
18
+ events (list[str]):
19
+ url (str):
20
+ description (None | str | Unset):
21
+ """
22
+
23
+ events: list[str]
24
+ url: str
25
+ description: 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
+ events = self.events
30
+
31
+ url = self.url
32
+
33
+ description: None | str | Unset
34
+ if isinstance(self.description, Unset):
35
+ description = UNSET
36
+ else:
37
+ description = self.description
38
+
39
+ field_dict: dict[str, Any] = {}
40
+ field_dict.update(self.additional_properties)
41
+ field_dict.update(
42
+ {
43
+ "events": events,
44
+ "url": url,
45
+ }
46
+ )
47
+ if description is not UNSET:
48
+ field_dict["description"] = description
49
+
50
+ return field_dict
51
+
52
+ @classmethod
53
+ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
54
+ d = dict(src_dict)
55
+ events = cast(list[str], d.pop("events"))
56
+
57
+ url = d.pop("url")
58
+
59
+ def _parse_description(data: object) -> None | str | Unset:
60
+ if data is None:
61
+ return data
62
+ if isinstance(data, Unset):
63
+ return data
64
+ return cast(None | str | Unset, data)
65
+
66
+ description = _parse_description(d.pop("description", UNSET))
67
+
68
+ webhook_endpoint_create = cls(
69
+ events=events,
70
+ url=url,
71
+ description=description,
72
+ )
73
+
74
+ webhook_endpoint_create.additional_properties = d
75
+ return webhook_endpoint_create
76
+
77
+ @property
78
+ def additional_keys(self) -> list[str]:
79
+ return list(self.additional_properties.keys())
80
+
81
+ def __getitem__(self, key: str) -> Any:
82
+ return self.additional_properties[key]
83
+
84
+ def __setitem__(self, key: str, value: Any) -> None:
85
+ self.additional_properties[key] = value
86
+
87
+ def __delitem__(self, key: str) -> None:
88
+ del self.additional_properties[key]
89
+
90
+ def __contains__(self, key: str) -> bool:
91
+ return key in self.additional_properties
@@ -0,0 +1,144 @@
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="WebhookEndpointPatch")
12
+
13
+
14
+ @_attrs_define
15
+ class WebhookEndpointPatch:
16
+ """
17
+ Attributes:
18
+ description (None | str | Unset):
19
+ enabled (bool | None | Unset):
20
+ events (list[str] | None | Unset):
21
+ url (None | str | Unset):
22
+ """
23
+
24
+ description: None | str | Unset = UNSET
25
+ enabled: bool | None | Unset = UNSET
26
+ events: list[str] | None | Unset = UNSET
27
+ url: None | str | Unset = UNSET
28
+ additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
29
+
30
+ def to_dict(self) -> dict[str, Any]:
31
+ description: None | str | Unset
32
+ if isinstance(self.description, Unset):
33
+ description = UNSET
34
+ else:
35
+ description = self.description
36
+
37
+ enabled: bool | None | Unset
38
+ if isinstance(self.enabled, Unset):
39
+ enabled = UNSET
40
+ else:
41
+ enabled = self.enabled
42
+
43
+ events: list[str] | None | Unset
44
+ if isinstance(self.events, Unset):
45
+ events = UNSET
46
+ elif isinstance(self.events, list):
47
+ events = self.events
48
+
49
+ else:
50
+ events = self.events
51
+
52
+ url: None | str | Unset
53
+ if isinstance(self.url, Unset):
54
+ url = UNSET
55
+ else:
56
+ url = self.url
57
+
58
+ field_dict: dict[str, Any] = {}
59
+ field_dict.update(self.additional_properties)
60
+ field_dict.update({})
61
+ if description is not UNSET:
62
+ field_dict["description"] = description
63
+ if enabled is not UNSET:
64
+ field_dict["enabled"] = enabled
65
+ if events is not UNSET:
66
+ field_dict["events"] = events
67
+ if url is not UNSET:
68
+ field_dict["url"] = url
69
+
70
+ return field_dict
71
+
72
+ @classmethod
73
+ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
74
+ d = dict(src_dict)
75
+
76
+ def _parse_description(data: object) -> None | str | Unset:
77
+ if data is None:
78
+ return data
79
+ if isinstance(data, Unset):
80
+ return data
81
+ return cast(None | str | Unset, data)
82
+
83
+ description = _parse_description(d.pop("description", UNSET))
84
+
85
+ def _parse_enabled(data: object) -> bool | None | Unset:
86
+ if data is None:
87
+ return data
88
+ if isinstance(data, Unset):
89
+ return data
90
+ return cast(bool | None | Unset, data)
91
+
92
+ enabled = _parse_enabled(d.pop("enabled", UNSET))
93
+
94
+ def _parse_events(data: object) -> list[str] | None | Unset:
95
+ if data is None:
96
+ return data
97
+ if isinstance(data, Unset):
98
+ return data
99
+ try:
100
+ if not isinstance(data, list):
101
+ raise TypeError()
102
+ events_type_0 = cast(list[str], data)
103
+
104
+ return events_type_0
105
+ except (TypeError, ValueError, AttributeError, KeyError):
106
+ pass
107
+ return cast(list[str] | None | Unset, data)
108
+
109
+ events = _parse_events(d.pop("events", UNSET))
110
+
111
+ def _parse_url(data: object) -> None | str | Unset:
112
+ if data is None:
113
+ return data
114
+ if isinstance(data, Unset):
115
+ return data
116
+ return cast(None | str | Unset, data)
117
+
118
+ url = _parse_url(d.pop("url", UNSET))
119
+
120
+ webhook_endpoint_patch = cls(
121
+ description=description,
122
+ enabled=enabled,
123
+ events=events,
124
+ url=url,
125
+ )
126
+
127
+ webhook_endpoint_patch.additional_properties = d
128
+ return webhook_endpoint_patch
129
+
130
+ @property
131
+ def additional_keys(self) -> list[str]:
132
+ return list(self.additional_properties.keys())
133
+
134
+ def __getitem__(self, key: str) -> Any:
135
+ return self.additional_properties[key]
136
+
137
+ def __setitem__(self, key: str, value: Any) -> None:
138
+ self.additional_properties[key] = value
139
+
140
+ def __delitem__(self, key: str) -> None:
141
+ del self.additional_properties[key]
142
+
143
+ def __contains__(self, key: str) -> bool:
144
+ return key in self.additional_properties