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,135 @@
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
+ 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.credit_bucket_breakdown import CreditBucketBreakdown
13
+
14
+
15
+ T = TypeVar("T", bound="CreditBalanceResource")
16
+
17
+
18
+ @_attrs_define
19
+ class CreditBalanceResource:
20
+ """
21
+ Attributes:
22
+ as_of (str):
23
+ breakdown (list[CreditBucketBreakdown]):
24
+ total (int):
25
+ currency (Literal['credit'] | Unset): Default: 'credit'.
26
+ low_balance_threshold (int | None | Unset):
27
+ object_ (Literal['credit_balance'] | Unset): Default: 'credit_balance'.
28
+ """
29
+
30
+ as_of: str
31
+ breakdown: list[CreditBucketBreakdown]
32
+ total: int
33
+ currency: Literal["credit"] | Unset = "credit"
34
+ low_balance_threshold: int | None | Unset = UNSET
35
+ object_: Literal["credit_balance"] | Unset = "credit_balance"
36
+ additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
37
+
38
+ def to_dict(self) -> dict[str, Any]:
39
+ as_of = self.as_of
40
+
41
+ breakdown = []
42
+ for breakdown_item_data in self.breakdown:
43
+ breakdown_item = breakdown_item_data.to_dict()
44
+ breakdown.append(breakdown_item)
45
+
46
+ total = self.total
47
+
48
+ currency = self.currency
49
+
50
+ low_balance_threshold: int | None | Unset
51
+ if isinstance(self.low_balance_threshold, Unset):
52
+ low_balance_threshold = UNSET
53
+ else:
54
+ low_balance_threshold = self.low_balance_threshold
55
+
56
+ object_ = self.object_
57
+
58
+ field_dict: dict[str, Any] = {}
59
+ field_dict.update(self.additional_properties)
60
+ field_dict.update(
61
+ {
62
+ "as_of": as_of,
63
+ "breakdown": breakdown,
64
+ "total": total,
65
+ }
66
+ )
67
+ if currency is not UNSET:
68
+ field_dict["currency"] = currency
69
+ if low_balance_threshold is not UNSET:
70
+ field_dict["low_balance_threshold"] = low_balance_threshold
71
+ if object_ is not UNSET:
72
+ field_dict["object"] = object_
73
+
74
+ return field_dict
75
+
76
+ @classmethod
77
+ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
78
+ from thrustlab._models.credit_bucket_breakdown import CreditBucketBreakdown
79
+
80
+ d = dict(src_dict)
81
+ as_of = d.pop("as_of")
82
+
83
+ breakdown = []
84
+ _breakdown = d.pop("breakdown")
85
+ for breakdown_item_data in _breakdown:
86
+ breakdown_item = CreditBucketBreakdown.from_dict(breakdown_item_data)
87
+
88
+ breakdown.append(breakdown_item)
89
+
90
+ total = d.pop("total")
91
+
92
+ currency = cast(Literal["credit"] | Unset, d.pop("currency", UNSET))
93
+ if currency != "credit" and not isinstance(currency, Unset):
94
+ raise ValueError(f"currency must match const 'credit', got '{currency}'")
95
+
96
+ def _parse_low_balance_threshold(data: object) -> int | None | Unset:
97
+ if data is None:
98
+ return data
99
+ if isinstance(data, Unset):
100
+ return data
101
+ return cast(int | None | Unset, data)
102
+
103
+ low_balance_threshold = _parse_low_balance_threshold(d.pop("low_balance_threshold", UNSET))
104
+
105
+ object_ = cast(Literal["credit_balance"] | Unset, d.pop("object", UNSET))
106
+ if object_ != "credit_balance" and not isinstance(object_, Unset):
107
+ raise ValueError(f"object must match const 'credit_balance', got '{object_}'")
108
+
109
+ credit_balance_resource = cls(
110
+ as_of=as_of,
111
+ breakdown=breakdown,
112
+ total=total,
113
+ currency=currency,
114
+ low_balance_threshold=low_balance_threshold,
115
+ object_=object_,
116
+ )
117
+
118
+ credit_balance_resource.additional_properties = d
119
+ return credit_balance_resource
120
+
121
+ @property
122
+ def additional_keys(self) -> list[str]:
123
+ return list(self.additional_properties.keys())
124
+
125
+ def __getitem__(self, key: str) -> Any:
126
+ return self.additional_properties[key]
127
+
128
+ def __setitem__(self, key: str, value: Any) -> None:
129
+ self.additional_properties[key] = value
130
+
131
+ def __delitem__(self, key: str) -> None:
132
+ del self.additional_properties[key]
133
+
134
+ def __contains__(self, key: str) -> bool:
135
+ return key in self.additional_properties
@@ -0,0 +1,92 @@
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.credit_bucket_breakdown_type import CreditBucketBreakdownType
10
+ from thrustlab._models.types import UNSET, Unset
11
+
12
+ T = TypeVar("T", bound="CreditBucketBreakdown")
13
+
14
+
15
+ @_attrs_define
16
+ class CreditBucketBreakdown:
17
+ """
18
+ Attributes:
19
+ balance (int):
20
+ type_ (CreditBucketBreakdownType):
21
+ expires_at (None | str | Unset):
22
+ """
23
+
24
+ balance: int
25
+ type_: CreditBucketBreakdownType
26
+ expires_at: None | str | Unset = UNSET
27
+ additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
28
+
29
+ def to_dict(self) -> dict[str, Any]:
30
+ balance = self.balance
31
+
32
+ type_ = self.type_.value
33
+
34
+ expires_at: None | str | Unset
35
+ if isinstance(self.expires_at, Unset):
36
+ expires_at = UNSET
37
+ else:
38
+ expires_at = self.expires_at
39
+
40
+ field_dict: dict[str, Any] = {}
41
+ field_dict.update(self.additional_properties)
42
+ field_dict.update(
43
+ {
44
+ "balance": balance,
45
+ "type": type_,
46
+ }
47
+ )
48
+ if expires_at is not UNSET:
49
+ field_dict["expires_at"] = expires_at
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
+ balance = d.pop("balance")
57
+
58
+ type_ = CreditBucketBreakdownType(d.pop("type"))
59
+
60
+ def _parse_expires_at(data: object) -> None | str | Unset:
61
+ if data is None:
62
+ return data
63
+ if isinstance(data, Unset):
64
+ return data
65
+ return cast(None | str | Unset, data)
66
+
67
+ expires_at = _parse_expires_at(d.pop("expires_at", UNSET))
68
+
69
+ credit_bucket_breakdown = cls(
70
+ balance=balance,
71
+ type_=type_,
72
+ expires_at=expires_at,
73
+ )
74
+
75
+ credit_bucket_breakdown.additional_properties = d
76
+ return credit_bucket_breakdown
77
+
78
+ @property
79
+ def additional_keys(self) -> list[str]:
80
+ return list(self.additional_properties.keys())
81
+
82
+ def __getitem__(self, key: str) -> Any:
83
+ return self.additional_properties[key]
84
+
85
+ def __setitem__(self, key: str, value: Any) -> None:
86
+ self.additional_properties[key] = value
87
+
88
+ def __delitem__(self, key: str) -> None:
89
+ del self.additional_properties[key]
90
+
91
+ def __contains__(self, key: str) -> bool:
92
+ return key in self.additional_properties
@@ -0,0 +1,9 @@
1
+ from enum import Enum
2
+
3
+
4
+ class CreditBucketBreakdownType(str, Enum):
5
+ FREE = "free"
6
+ MONTHLY = "monthly"
7
+
8
+ def __str__(self) -> str:
9
+ return str(self.value)
@@ -0,0 +1,154 @@
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
+ from attrs import field as _attrs_field
8
+
9
+ from thrustlab._models.credit_usage_event_resource_credit_type import CreditUsageEventResourceCreditType
10
+ from thrustlab._models.credit_usage_event_resource_type import CreditUsageEventResourceType
11
+ from thrustlab._models.types import UNSET, Unset
12
+
13
+ if TYPE_CHECKING:
14
+ from thrustlab._models.credit_usage_related_resource import CreditUsageRelatedResource
15
+
16
+
17
+ T = TypeVar("T", bound="CreditUsageEventResource")
18
+
19
+
20
+ @_attrs_define
21
+ class CreditUsageEventResource:
22
+ """
23
+ Attributes:
24
+ amount (int):
25
+ balance_after (int):
26
+ created_at (str):
27
+ credit_type (CreditUsageEventResourceCreditType):
28
+ id (str):
29
+ type_ (CreditUsageEventResourceType):
30
+ object_ (Literal['credit_usage_event'] | Unset): Default: 'credit_usage_event'.
31
+ resource (CreditUsageRelatedResource | None | Unset):
32
+ """
33
+
34
+ amount: int
35
+ balance_after: int
36
+ created_at: str
37
+ credit_type: CreditUsageEventResourceCreditType
38
+ id: str
39
+ type_: CreditUsageEventResourceType
40
+ object_: Literal["credit_usage_event"] | Unset = "credit_usage_event"
41
+ resource: CreditUsageRelatedResource | None | Unset = UNSET
42
+ additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
43
+
44
+ def to_dict(self) -> dict[str, Any]:
45
+ from thrustlab._models.credit_usage_related_resource import CreditUsageRelatedResource
46
+
47
+ amount = self.amount
48
+
49
+ balance_after = self.balance_after
50
+
51
+ created_at = self.created_at
52
+
53
+ credit_type = self.credit_type.value
54
+
55
+ id = self.id
56
+
57
+ type_ = self.type_.value
58
+
59
+ object_ = self.object_
60
+
61
+ resource: dict[str, Any] | None | Unset
62
+ if isinstance(self.resource, Unset):
63
+ resource = UNSET
64
+ elif isinstance(self.resource, CreditUsageRelatedResource):
65
+ resource = self.resource.to_dict()
66
+ else:
67
+ resource = self.resource
68
+
69
+ field_dict: dict[str, Any] = {}
70
+ field_dict.update(self.additional_properties)
71
+ field_dict.update(
72
+ {
73
+ "amount": amount,
74
+ "balance_after": balance_after,
75
+ "created_at": created_at,
76
+ "credit_type": credit_type,
77
+ "id": id,
78
+ "type": type_,
79
+ }
80
+ )
81
+ if object_ is not UNSET:
82
+ field_dict["object"] = object_
83
+ if resource is not UNSET:
84
+ field_dict["resource"] = resource
85
+
86
+ return field_dict
87
+
88
+ @classmethod
89
+ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
90
+ from thrustlab._models.credit_usage_related_resource import CreditUsageRelatedResource
91
+
92
+ d = dict(src_dict)
93
+ amount = d.pop("amount")
94
+
95
+ balance_after = d.pop("balance_after")
96
+
97
+ created_at = d.pop("created_at")
98
+
99
+ credit_type = CreditUsageEventResourceCreditType(d.pop("credit_type"))
100
+
101
+ id = d.pop("id")
102
+
103
+ type_ = CreditUsageEventResourceType(d.pop("type"))
104
+
105
+ object_ = cast(Literal["credit_usage_event"] | Unset, d.pop("object", UNSET))
106
+ if object_ != "credit_usage_event" and not isinstance(object_, Unset):
107
+ raise ValueError(f"object must match const 'credit_usage_event', got '{object_}'")
108
+
109
+ def _parse_resource(data: object) -> CreditUsageRelatedResource | None | Unset:
110
+ if data is None:
111
+ return data
112
+ if isinstance(data, Unset):
113
+ return data
114
+ try:
115
+ if not isinstance(data, dict):
116
+ raise TypeError()
117
+ resource_type_0 = CreditUsageRelatedResource.from_dict(data)
118
+
119
+ return resource_type_0
120
+ except (TypeError, ValueError, AttributeError, KeyError):
121
+ pass
122
+ return cast(CreditUsageRelatedResource | None | Unset, data)
123
+
124
+ resource = _parse_resource(d.pop("resource", UNSET))
125
+
126
+ credit_usage_event_resource = cls(
127
+ amount=amount,
128
+ balance_after=balance_after,
129
+ created_at=created_at,
130
+ credit_type=credit_type,
131
+ id=id,
132
+ type_=type_,
133
+ object_=object_,
134
+ resource=resource,
135
+ )
136
+
137
+ credit_usage_event_resource.additional_properties = d
138
+ return credit_usage_event_resource
139
+
140
+ @property
141
+ def additional_keys(self) -> list[str]:
142
+ return list(self.additional_properties.keys())
143
+
144
+ def __getitem__(self, key: str) -> Any:
145
+ return self.additional_properties[key]
146
+
147
+ def __setitem__(self, key: str, value: Any) -> None:
148
+ self.additional_properties[key] = value
149
+
150
+ def __delitem__(self, key: str) -> None:
151
+ del self.additional_properties[key]
152
+
153
+ def __contains__(self, key: str) -> bool:
154
+ return key in self.additional_properties
@@ -0,0 +1,9 @@
1
+ from enum import Enum
2
+
3
+
4
+ class CreditUsageEventResourceCreditType(str, Enum):
5
+ FREE = "free"
6
+ MONTHLY = "monthly"
7
+
8
+ def __str__(self) -> str:
9
+ return str(self.value)
@@ -0,0 +1,16 @@
1
+ from enum import Enum
2
+
3
+
4
+ class CreditUsageEventResourceType(str, Enum):
5
+ ADJUSTMENT = "adjustment"
6
+ BOUNTY_GRANT = "bounty_grant"
7
+ DEBIT = "debit"
8
+ MONTHLY_GRANT = "monthly_grant"
9
+ REFUND = "refund"
10
+ SIGNUP_GRANT = "signup_grant"
11
+ SIMULATION_DEBIT = "simulation_debit"
12
+ SWEEP_DEBIT = "sweep_debit"
13
+ TOPUP = "topup"
14
+
15
+ def __str__(self) -> str:
16
+ return str(self.value)
@@ -0,0 +1,116 @@
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
+ 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.credit_usage_event_resource import CreditUsageEventResource
13
+
14
+
15
+ T = TypeVar("T", bound="CreditUsageListResponse")
16
+
17
+
18
+ @_attrs_define
19
+ class CreditUsageListResponse:
20
+ """
21
+ Attributes:
22
+ data (list[CreditUsageEventResource]):
23
+ has_more (bool):
24
+ next_cursor (None | str | Unset):
25
+ object_ (Literal['list'] | Unset): Default: 'list'.
26
+ """
27
+
28
+ data: list[CreditUsageEventResource]
29
+ has_more: bool
30
+ next_cursor: None | str | Unset = UNSET
31
+ object_: Literal["list"] | 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 | Unset
43
+ if isinstance(self.next_cursor, Unset):
44
+ next_cursor = UNSET
45
+ else:
46
+ next_cursor = self.next_cursor
47
+
48
+ object_ = self.object_
49
+
50
+ field_dict: dict[str, Any] = {}
51
+ field_dict.update(self.additional_properties)
52
+ field_dict.update(
53
+ {
54
+ "data": data,
55
+ "has_more": has_more,
56
+ }
57
+ )
58
+ if next_cursor is not UNSET:
59
+ field_dict["next_cursor"] = next_cursor
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
+ from thrustlab._models.credit_usage_event_resource import CreditUsageEventResource
68
+
69
+ d = dict(src_dict)
70
+ data = []
71
+ _data = d.pop("data")
72
+ for data_item_data in _data:
73
+ data_item = CreditUsageEventResource.from_dict(data_item_data)
74
+
75
+ data.append(data_item)
76
+
77
+ has_more = d.pop("has_more")
78
+
79
+ def _parse_next_cursor(data: object) -> None | str | Unset:
80
+ if data is None:
81
+ return data
82
+ if isinstance(data, Unset):
83
+ return data
84
+ return cast(None | str | Unset, data)
85
+
86
+ next_cursor = _parse_next_cursor(d.pop("next_cursor", UNSET))
87
+
88
+ object_ = cast(Literal["list"] | Unset, d.pop("object", UNSET))
89
+ if object_ != "list" and not isinstance(object_, Unset):
90
+ raise ValueError(f"object must match const 'list', got '{object_}'")
91
+
92
+ credit_usage_list_response = cls(
93
+ data=data,
94
+ has_more=has_more,
95
+ next_cursor=next_cursor,
96
+ object_=object_,
97
+ )
98
+
99
+ credit_usage_list_response.additional_properties = d
100
+ return credit_usage_list_response
101
+
102
+ @property
103
+ def additional_keys(self) -> list[str]:
104
+ return list(self.additional_properties.keys())
105
+
106
+ def __getitem__(self, key: str) -> Any:
107
+ return self.additional_properties[key]
108
+
109
+ def __setitem__(self, key: str, value: Any) -> None:
110
+ self.additional_properties[key] = value
111
+
112
+ def __delitem__(self, key: str) -> None:
113
+ del self.additional_properties[key]
114
+
115
+ def __contains__(self, key: str) -> bool:
116
+ return key in self.additional_properties
@@ -0,0 +1,71 @@
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.credit_usage_related_resource_object import CreditUsageRelatedResourceObject
10
+
11
+ T = TypeVar("T", bound="CreditUsageRelatedResource")
12
+
13
+
14
+ @_attrs_define
15
+ class CreditUsageRelatedResource:
16
+ """
17
+ Attributes:
18
+ id (str):
19
+ object_ (CreditUsageRelatedResourceObject):
20
+ """
21
+
22
+ id: str
23
+ object_: CreditUsageRelatedResourceObject
24
+ additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
25
+
26
+ def to_dict(self) -> dict[str, Any]:
27
+ id = self.id
28
+
29
+ object_ = self.object_.value
30
+
31
+ field_dict: dict[str, Any] = {}
32
+ field_dict.update(self.additional_properties)
33
+ field_dict.update(
34
+ {
35
+ "id": id,
36
+ "object": object_,
37
+ }
38
+ )
39
+
40
+ return field_dict
41
+
42
+ @classmethod
43
+ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
44
+ d = dict(src_dict)
45
+ id = d.pop("id")
46
+
47
+ object_ = CreditUsageRelatedResourceObject(d.pop("object"))
48
+
49
+ credit_usage_related_resource = cls(
50
+ id=id,
51
+ object_=object_,
52
+ )
53
+
54
+ credit_usage_related_resource.additional_properties = d
55
+ return credit_usage_related_resource
56
+
57
+ @property
58
+ def additional_keys(self) -> list[str]:
59
+ return list(self.additional_properties.keys())
60
+
61
+ def __getitem__(self, key: str) -> Any:
62
+ return self.additional_properties[key]
63
+
64
+ def __setitem__(self, key: str, value: Any) -> None:
65
+ self.additional_properties[key] = value
66
+
67
+ def __delitem__(self, key: str) -> None:
68
+ del self.additional_properties[key]
69
+
70
+ def __contains__(self, key: str) -> bool:
71
+ return key in self.additional_properties
@@ -0,0 +1,9 @@
1
+ from enum import Enum
2
+
3
+
4
+ class CreditUsageRelatedResourceObject(str, Enum):
5
+ COMPONENT_SUBMISSION = "component_submission"
6
+ SIMULATION = "simulation"
7
+
8
+ def __str__(self) -> str:
9
+ return str(self.value)
@@ -0,0 +1,48 @@
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(
10
+ "T", bound="FireTestEventV1WebhookEndpointsPublicIdTestPostResponseFireTestEventV1WebhookEndpointsPublicIdTestPost"
11
+ )
12
+
13
+
14
+ @_attrs_define
15
+ class FireTestEventV1WebhookEndpointsPublicIdTestPostResponseFireTestEventV1WebhookEndpointsPublicIdTestPost:
16
+ """ """
17
+
18
+ additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict)
19
+
20
+ def to_dict(self) -> dict[str, Any]:
21
+ field_dict: dict[str, Any] = {}
22
+ field_dict.update(self.additional_properties)
23
+
24
+ return field_dict
25
+
26
+ @classmethod
27
+ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T:
28
+ d = dict(src_dict)
29
+ fire_test_event_v1_webhook_endpoints_public_id_test_post_response_fire_test_event_v1_webhook_endpoints_public_id_test_post = cls()
30
+
31
+ fire_test_event_v1_webhook_endpoints_public_id_test_post_response_fire_test_event_v1_webhook_endpoints_public_id_test_post.additional_properties = d
32
+ return fire_test_event_v1_webhook_endpoints_public_id_test_post_response_fire_test_event_v1_webhook_endpoints_public_id_test_post
33
+
34
+ @property
35
+ def additional_keys(self) -> list[str]:
36
+ return list(self.additional_properties.keys())
37
+
38
+ def __getitem__(self, key: str) -> Any:
39
+ return self.additional_properties[key]
40
+
41
+ def __setitem__(self, key: str, value: Any) -> None:
42
+ self.additional_properties[key] = value
43
+
44
+ def __delitem__(self, key: str) -> None:
45
+ del self.additional_properties[key]
46
+
47
+ def __contains__(self, key: str) -> bool:
48
+ return key in self.additional_properties