crypticorn 2.4.7__py3-none-any.whl → 2.5.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.
- crypticorn/cli/init.py +7 -4
- crypticorn/common/__init__.py +1 -0
- crypticorn/common/auth.py +7 -3
- crypticorn/common/errors.py +21 -0
- crypticorn/common/exceptions.py +83 -0
- crypticorn/common/utils.py +11 -4
- crypticorn/klines/client/__init__.py +10 -3
- crypticorn/klines/client/api/__init__.py +1 -0
- crypticorn/klines/client/api/change_in_timeframe_api.py +331 -0
- crypticorn/klines/client/api/funding_rates_api.py +13 -13
- crypticorn/klines/client/api/health_check_api.py +8 -8
- crypticorn/klines/client/api/ohlcv_data_api.py +38 -26
- crypticorn/klines/client/api/symbols_api.py +26 -20
- crypticorn/klines/client/api/udf_api.py +229 -229
- crypticorn/klines/client/api_client.py +8 -5
- crypticorn/klines/client/configuration.py +80 -37
- crypticorn/klines/client/models/__init__.py +9 -3
- crypticorn/klines/client/models/base_response_list_change_in_timeframe_response.py +123 -0
- crypticorn/klines/client/models/change_in_timeframe_response.py +86 -0
- crypticorn/klines/client/models/market_type.py +35 -0
- crypticorn/klines/client/models/response_get_udf_history.py +198 -0
- crypticorn/klines/client/rest.py +111 -159
- crypticorn/klines/main.py +32 -22
- crypticorn/metrics/main.py +39 -40
- crypticorn/pay/client/__init__.py +0 -3
- crypticorn/pay/client/api/now_payments_api.py +1 -53
- crypticorn/pay/client/models/__init__.py +0 -3
- crypticorn/pay/client/models/payment.py +3 -3
- crypticorn/pay/client/models/scope.py +6 -1
- crypticorn/trade/client/__init__.py +8 -6
- crypticorn/trade/client/api/__init__.py +0 -1
- crypticorn/trade/client/api/api_keys_api.py +167 -273
- crypticorn/trade/client/api/bots_api.py +140 -226
- crypticorn/trade/client/api/exchanges_api.py +31 -51
- crypticorn/trade/client/api/futures_trading_panel_api.py +169 -272
- crypticorn/trade/client/api/notifications_api.py +200 -323
- crypticorn/trade/client/api/orders_api.py +40 -60
- crypticorn/trade/client/api/status_api.py +31 -49
- crypticorn/trade/client/api/strategies_api.py +137 -223
- crypticorn/trade/client/api/trading_actions_api.py +106 -170
- crypticorn/trade/client/api_client.py +111 -153
- crypticorn/trade/client/api_response.py +2 -3
- crypticorn/trade/client/configuration.py +128 -115
- crypticorn/trade/client/exceptions.py +25 -21
- crypticorn/trade/client/models/__init__.py +8 -6
- crypticorn/trade/client/models/action_model.py +108 -54
- crypticorn/trade/client/models/api_error_identifier.py +76 -72
- crypticorn/trade/client/models/api_error_level.py +9 -11
- crypticorn/trade/client/models/api_error_type.py +9 -11
- crypticorn/trade/client/models/bot_model.py +57 -36
- crypticorn/trade/client/models/bot_status.py +9 -11
- crypticorn/trade/client/models/exchange.py +7 -9
- crypticorn/trade/client/models/exchange_key_model.py +43 -32
- crypticorn/trade/client/models/execution_ids.py +18 -18
- crypticorn/trade/client/models/futures_balance.py +43 -27
- crypticorn/trade/client/models/futures_trading_action.py +102 -50
- crypticorn/trade/client/models/http_validation_error.py +19 -15
- crypticorn/trade/client/models/margin_mode.py +7 -9
- crypticorn/trade/client/models/market_type.py +7 -9
- crypticorn/trade/client/models/notification_model.py +52 -32
- crypticorn/trade/client/models/order_model.py +112 -72
- crypticorn/trade/client/models/order_status.py +10 -12
- crypticorn/trade/client/models/post_futures_action.py +20 -16
- crypticorn/trade/client/models/strategy_exchange_info.py +15 -16
- crypticorn/trade/client/models/strategy_model_input.py +61 -33
- crypticorn/trade/client/models/strategy_model_output.py +61 -33
- crypticorn/trade/client/models/tpsl.py +39 -25
- crypticorn/trade/client/models/trading_action_type.py +9 -11
- crypticorn/trade/client/models/validation_error.py +24 -18
- crypticorn/trade/client/models/validation_error_loc_inner.py +37 -16
- crypticorn/trade/client/rest.py +23 -38
- {crypticorn-2.4.7.dist-info → crypticorn-2.5.0.dist-info}/METADATA +1 -1
- {crypticorn-2.4.7.dist-info → crypticorn-2.5.0.dist-info}/RECORD +76 -70
- {crypticorn-2.4.7.dist-info → crypticorn-2.5.0.dist-info}/WHEEL +1 -1
- {crypticorn-2.4.7.dist-info → crypticorn-2.5.0.dist-info}/entry_points.txt +0 -0
- {crypticorn-2.4.7.dist-info → crypticorn-2.5.0.dist-info}/top_level.txt +0 -0
@@ -1,14 +1,14 @@
|
|
1
1
|
# coding: utf-8
|
2
2
|
|
3
3
|
"""
|
4
|
-
|
4
|
+
Trading API
|
5
5
|
|
6
|
-
|
6
|
+
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
7
7
|
|
8
|
-
|
9
|
-
|
8
|
+
The version of the OpenAPI document: 0.1.0
|
9
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
10
10
|
|
11
|
-
|
11
|
+
Do not edit the class manually.
|
12
12
|
""" # noqa: E501
|
13
13
|
|
14
14
|
|
@@ -17,7 +17,15 @@ import pprint
|
|
17
17
|
import re # noqa: F401
|
18
18
|
import json
|
19
19
|
|
20
|
-
from pydantic import
|
20
|
+
from pydantic import (
|
21
|
+
BaseModel,
|
22
|
+
ConfigDict,
|
23
|
+
Field,
|
24
|
+
StrictBool,
|
25
|
+
StrictFloat,
|
26
|
+
StrictInt,
|
27
|
+
StrictStr,
|
28
|
+
)
|
21
29
|
from typing import Any, ClassVar, Dict, List, Optional, Union
|
22
30
|
from typing_extensions import Annotated
|
23
31
|
from crypticorn.trade.client.models.margin_mode import MarginMode
|
@@ -27,10 +35,12 @@ from crypticorn.trade.client.models.trading_action_type import TradingActionType
|
|
27
35
|
from typing import Optional, Set
|
28
36
|
from typing_extensions import Self
|
29
37
|
|
38
|
+
|
30
39
|
class FuturesTradingAction(BaseModel):
|
31
40
|
"""
|
32
41
|
Model for futures trading actions
|
33
|
-
"""
|
42
|
+
""" # noqa: E501
|
43
|
+
|
34
44
|
id: Optional[StrictStr] = None
|
35
45
|
execution_id: Optional[StrictStr] = None
|
36
46
|
open_order_execution_id: Optional[StrictStr] = None
|
@@ -38,17 +48,45 @@ class FuturesTradingAction(BaseModel):
|
|
38
48
|
action_type: TradingActionType = Field(description="The type of action.")
|
39
49
|
market_type: MarketType = Field(description="The type of market the action is for.")
|
40
50
|
strategy_id: StrictStr = Field(description="UID for the strategy.")
|
41
|
-
symbol: StrictStr = Field(
|
51
|
+
symbol: StrictStr = Field(
|
52
|
+
description="Trading symbol or asset pair in format: 'symbol/quote_currency' (see market service for valid symbols)"
|
53
|
+
)
|
42
54
|
is_limit: Optional[StrictBool] = None
|
43
55
|
limit_price: Optional[Union[StrictFloat, StrictInt]] = None
|
44
|
-
allocation: Optional[
|
56
|
+
allocation: Optional[
|
57
|
+
Union[
|
58
|
+
Annotated[float, Field(le=1.0, strict=True)],
|
59
|
+
Annotated[int, Field(le=1, strict=True)],
|
60
|
+
]
|
61
|
+
] = Field(
|
62
|
+
default=None,
|
63
|
+
description="How much of bot's balance to use for the order (for open actions). How much of the reference open order (open_order_execution_id) to close (for close actions). 0=0%, 1=100%.",
|
64
|
+
)
|
45
65
|
take_profit: Optional[List[TPSL]] = None
|
46
66
|
stop_loss: Optional[List[TPSL]] = None
|
47
67
|
expiry_timestamp: Optional[StrictInt] = None
|
48
68
|
position_id: Optional[StrictStr] = None
|
49
69
|
leverage: Optional[Annotated[int, Field(strict=True, ge=1)]]
|
50
70
|
margin_mode: Optional[MarginMode] = None
|
51
|
-
__properties: ClassVar[List[str]] = [
|
71
|
+
__properties: ClassVar[List[str]] = [
|
72
|
+
"id",
|
73
|
+
"execution_id",
|
74
|
+
"open_order_execution_id",
|
75
|
+
"client_order_id",
|
76
|
+
"action_type",
|
77
|
+
"market_type",
|
78
|
+
"strategy_id",
|
79
|
+
"symbol",
|
80
|
+
"is_limit",
|
81
|
+
"limit_price",
|
82
|
+
"allocation",
|
83
|
+
"take_profit",
|
84
|
+
"stop_loss",
|
85
|
+
"expiry_timestamp",
|
86
|
+
"position_id",
|
87
|
+
"leverage",
|
88
|
+
"margin_mode",
|
89
|
+
]
|
52
90
|
|
53
91
|
model_config = ConfigDict(
|
54
92
|
populate_by_name=True,
|
@@ -56,7 +94,6 @@ class FuturesTradingAction(BaseModel):
|
|
56
94
|
protected_namespaces=(),
|
57
95
|
)
|
58
96
|
|
59
|
-
|
60
97
|
def to_str(self) -> str:
|
61
98
|
"""Returns the string representation of the model using alias"""
|
62
99
|
return pprint.pformat(self.model_dump(by_alias=True))
|
@@ -81,8 +118,7 @@ class FuturesTradingAction(BaseModel):
|
|
81
118
|
were set at model initialization. Other fields with value `None`
|
82
119
|
are ignored.
|
83
120
|
"""
|
84
|
-
excluded_fields: Set[str] = set([
|
85
|
-
])
|
121
|
+
excluded_fields: Set[str] = set([])
|
86
122
|
|
87
123
|
_dict = self.model_dump(
|
88
124
|
by_alias=True,
|
@@ -95,73 +131,79 @@ class FuturesTradingAction(BaseModel):
|
|
95
131
|
for _item_take_profit in self.take_profit:
|
96
132
|
if _item_take_profit:
|
97
133
|
_items.append(_item_take_profit.to_dict())
|
98
|
-
_dict[
|
134
|
+
_dict["take_profit"] = _items
|
99
135
|
# override the default output from pydantic by calling `to_dict()` of each item in stop_loss (list)
|
100
136
|
_items = []
|
101
137
|
if self.stop_loss:
|
102
138
|
for _item_stop_loss in self.stop_loss:
|
103
139
|
if _item_stop_loss:
|
104
140
|
_items.append(_item_stop_loss.to_dict())
|
105
|
-
_dict[
|
141
|
+
_dict["stop_loss"] = _items
|
106
142
|
# set to None if id (nullable) is None
|
107
143
|
# and model_fields_set contains the field
|
108
144
|
if self.id is None and "id" in self.model_fields_set:
|
109
|
-
_dict[
|
145
|
+
_dict["id"] = None
|
110
146
|
|
111
147
|
# set to None if execution_id (nullable) is None
|
112
148
|
# and model_fields_set contains the field
|
113
149
|
if self.execution_id is None and "execution_id" in self.model_fields_set:
|
114
|
-
_dict[
|
150
|
+
_dict["execution_id"] = None
|
115
151
|
|
116
152
|
# set to None if open_order_execution_id (nullable) is None
|
117
153
|
# and model_fields_set contains the field
|
118
|
-
if
|
119
|
-
|
154
|
+
if (
|
155
|
+
self.open_order_execution_id is None
|
156
|
+
and "open_order_execution_id" in self.model_fields_set
|
157
|
+
):
|
158
|
+
_dict["open_order_execution_id"] = None
|
120
159
|
|
121
160
|
# set to None if client_order_id (nullable) is None
|
122
161
|
# and model_fields_set contains the field
|
123
162
|
if self.client_order_id is None and "client_order_id" in self.model_fields_set:
|
124
|
-
_dict[
|
163
|
+
_dict["client_order_id"] = None
|
125
164
|
|
126
165
|
# set to None if is_limit (nullable) is None
|
127
166
|
# and model_fields_set contains the field
|
128
167
|
if self.is_limit is None and "is_limit" in self.model_fields_set:
|
129
|
-
_dict[
|
168
|
+
_dict["is_limit"] = None
|
130
169
|
|
131
170
|
# set to None if limit_price (nullable) is None
|
132
171
|
# and model_fields_set contains the field
|
133
172
|
if self.limit_price is None and "limit_price" in self.model_fields_set:
|
134
|
-
_dict[
|
173
|
+
_dict["limit_price"] = None
|
135
174
|
|
136
175
|
# set to None if take_profit (nullable) is None
|
137
176
|
# and model_fields_set contains the field
|
138
177
|
if self.take_profit is None and "take_profit" in self.model_fields_set:
|
139
|
-
_dict[
|
178
|
+
_dict["take_profit"] = None
|
140
179
|
|
141
180
|
# set to None if stop_loss (nullable) is None
|
142
181
|
# and model_fields_set contains the field
|
143
182
|
if self.stop_loss is None and "stop_loss" in self.model_fields_set:
|
144
|
-
_dict[
|
183
|
+
_dict["stop_loss"] = None
|
145
184
|
|
146
185
|
# set to None if expiry_timestamp (nullable) is None
|
147
186
|
# and model_fields_set contains the field
|
148
|
-
if
|
149
|
-
|
187
|
+
if (
|
188
|
+
self.expiry_timestamp is None
|
189
|
+
and "expiry_timestamp" in self.model_fields_set
|
190
|
+
):
|
191
|
+
_dict["expiry_timestamp"] = None
|
150
192
|
|
151
193
|
# set to None if position_id (nullable) is None
|
152
194
|
# and model_fields_set contains the field
|
153
195
|
if self.position_id is None and "position_id" in self.model_fields_set:
|
154
|
-
_dict[
|
196
|
+
_dict["position_id"] = None
|
155
197
|
|
156
198
|
# set to None if leverage (nullable) is None
|
157
199
|
# and model_fields_set contains the field
|
158
200
|
if self.leverage is None and "leverage" in self.model_fields_set:
|
159
|
-
_dict[
|
201
|
+
_dict["leverage"] = None
|
160
202
|
|
161
203
|
# set to None if margin_mode (nullable) is None
|
162
204
|
# and model_fields_set contains the field
|
163
205
|
if self.margin_mode is None and "margin_mode" in self.model_fields_set:
|
164
|
-
_dict[
|
206
|
+
_dict["margin_mode"] = None
|
165
207
|
|
166
208
|
return _dict
|
167
209
|
|
@@ -174,25 +216,35 @@ class FuturesTradingAction(BaseModel):
|
|
174
216
|
if not isinstance(obj, dict):
|
175
217
|
return cls.model_validate(obj)
|
176
218
|
|
177
|
-
_obj = cls.model_validate(
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
219
|
+
_obj = cls.model_validate(
|
220
|
+
{
|
221
|
+
"id": obj.get("id"),
|
222
|
+
"execution_id": obj.get("execution_id"),
|
223
|
+
"open_order_execution_id": obj.get("open_order_execution_id"),
|
224
|
+
"client_order_id": obj.get("client_order_id"),
|
225
|
+
"action_type": obj.get("action_type"),
|
226
|
+
"market_type": obj.get("market_type"),
|
227
|
+
"strategy_id": obj.get("strategy_id"),
|
228
|
+
"symbol": obj.get("symbol"),
|
229
|
+
"is_limit": obj.get("is_limit"),
|
230
|
+
"limit_price": obj.get("limit_price"),
|
231
|
+
"allocation": obj.get("allocation"),
|
232
|
+
"take_profit": (
|
233
|
+
[TPSL.from_dict(_item) for _item in obj["take_profit"]]
|
234
|
+
if obj.get("take_profit") is not None
|
235
|
+
else None
|
236
|
+
),
|
237
|
+
"stop_loss": (
|
238
|
+
[TPSL.from_dict(_item) for _item in obj["stop_loss"]]
|
239
|
+
if obj.get("stop_loss") is not None
|
240
|
+
else None
|
241
|
+
),
|
242
|
+
"expiry_timestamp": obj.get("expiry_timestamp"),
|
243
|
+
"position_id": obj.get("position_id"),
|
244
|
+
"leverage": (
|
245
|
+
obj.get("leverage") if obj.get("leverage") is not None else 1
|
246
|
+
),
|
247
|
+
"margin_mode": obj.get("margin_mode"),
|
248
|
+
}
|
249
|
+
)
|
196
250
|
return _obj
|
197
|
-
|
198
|
-
|
@@ -1,14 +1,14 @@
|
|
1
1
|
# coding: utf-8
|
2
2
|
|
3
3
|
"""
|
4
|
-
|
4
|
+
Trading API
|
5
5
|
|
6
|
-
|
6
|
+
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
7
7
|
|
8
|
-
|
9
|
-
|
8
|
+
The version of the OpenAPI document: 0.1.0
|
9
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
10
10
|
|
11
|
-
|
11
|
+
Do not edit the class manually.
|
12
12
|
""" # noqa: E501
|
13
13
|
|
14
14
|
|
@@ -23,10 +23,12 @@ from crypticorn.trade.client.models.validation_error import ValidationError
|
|
23
23
|
from typing import Optional, Set
|
24
24
|
from typing_extensions import Self
|
25
25
|
|
26
|
+
|
26
27
|
class HTTPValidationError(BaseModel):
|
27
28
|
"""
|
28
29
|
HTTPValidationError
|
29
|
-
"""
|
30
|
+
""" # noqa: E501
|
31
|
+
|
30
32
|
detail: Optional[List[ValidationError]] = None
|
31
33
|
__properties: ClassVar[List[str]] = ["detail"]
|
32
34
|
|
@@ -36,7 +38,6 @@ class HTTPValidationError(BaseModel):
|
|
36
38
|
protected_namespaces=(),
|
37
39
|
)
|
38
40
|
|
39
|
-
|
40
41
|
def to_str(self) -> str:
|
41
42
|
"""Returns the string representation of the model using alias"""
|
42
43
|
return pprint.pformat(self.model_dump(by_alias=True))
|
@@ -61,8 +62,7 @@ class HTTPValidationError(BaseModel):
|
|
61
62
|
were set at model initialization. Other fields with value `None`
|
62
63
|
are ignored.
|
63
64
|
"""
|
64
|
-
excluded_fields: Set[str] = set([
|
65
|
-
])
|
65
|
+
excluded_fields: Set[str] = set([])
|
66
66
|
|
67
67
|
_dict = self.model_dump(
|
68
68
|
by_alias=True,
|
@@ -75,7 +75,7 @@ class HTTPValidationError(BaseModel):
|
|
75
75
|
for _item_detail in self.detail:
|
76
76
|
if _item_detail:
|
77
77
|
_items.append(_item_detail.to_dict())
|
78
|
-
_dict[
|
78
|
+
_dict["detail"] = _items
|
79
79
|
return _dict
|
80
80
|
|
81
81
|
@classmethod
|
@@ -87,9 +87,13 @@ class HTTPValidationError(BaseModel):
|
|
87
87
|
if not isinstance(obj, dict):
|
88
88
|
return cls.model_validate(obj)
|
89
89
|
|
90
|
-
_obj = cls.model_validate(
|
91
|
-
|
92
|
-
|
90
|
+
_obj = cls.model_validate(
|
91
|
+
{
|
92
|
+
"detail": (
|
93
|
+
[ValidationError.from_dict(_item) for _item in obj["detail"]]
|
94
|
+
if obj.get("detail") is not None
|
95
|
+
else None
|
96
|
+
)
|
97
|
+
}
|
98
|
+
)
|
93
99
|
return _obj
|
94
|
-
|
95
|
-
|
@@ -1,14 +1,14 @@
|
|
1
1
|
# coding: utf-8
|
2
2
|
|
3
3
|
"""
|
4
|
-
|
4
|
+
Trading API
|
5
5
|
|
6
|
-
|
6
|
+
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
7
7
|
|
8
|
-
|
9
|
-
|
8
|
+
The version of the OpenAPI document: 0.1.0
|
9
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
10
10
|
|
11
|
-
|
11
|
+
Do not edit the class manually.
|
12
12
|
""" # noqa: E501
|
13
13
|
|
14
14
|
|
@@ -26,12 +26,10 @@ class MarginMode(str, Enum):
|
|
26
26
|
"""
|
27
27
|
allowed enum values
|
28
28
|
"""
|
29
|
-
ISOLATED =
|
30
|
-
CROSS =
|
29
|
+
ISOLATED = "isolated"
|
30
|
+
CROSS = "cross"
|
31
31
|
|
32
32
|
@classmethod
|
33
33
|
def from_json(cls, json_str: str) -> Self:
|
34
34
|
"""Create an instance of MarginMode from a JSON string"""
|
35
35
|
return cls(json.loads(json_str))
|
36
|
-
|
37
|
-
|
@@ -1,14 +1,14 @@
|
|
1
1
|
# coding: utf-8
|
2
2
|
|
3
3
|
"""
|
4
|
-
|
4
|
+
Trading API
|
5
5
|
|
6
|
-
|
6
|
+
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
7
7
|
|
8
|
-
|
9
|
-
|
8
|
+
The version of the OpenAPI document: 0.1.0
|
9
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
10
10
|
|
11
|
-
|
11
|
+
Do not edit the class manually.
|
12
12
|
""" # noqa: E501
|
13
13
|
|
14
14
|
|
@@ -26,12 +26,10 @@ class MarketType(str, Enum):
|
|
26
26
|
"""
|
27
27
|
allowed enum values
|
28
28
|
"""
|
29
|
-
SPOT =
|
30
|
-
FUTURES =
|
29
|
+
SPOT = "spot"
|
30
|
+
FUTURES = "futures"
|
31
31
|
|
32
32
|
@classmethod
|
33
33
|
def from_json(cls, json_str: str) -> Self:
|
34
34
|
"""Create an instance of MarketType from a JSON string"""
|
35
35
|
return cls(json.loads(json_str))
|
36
|
-
|
37
|
-
|
@@ -1,14 +1,14 @@
|
|
1
1
|
# coding: utf-8
|
2
2
|
|
3
3
|
"""
|
4
|
-
|
4
|
+
Trading API
|
5
5
|
|
6
|
-
|
6
|
+
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
7
7
|
|
8
|
-
|
9
|
-
|
8
|
+
The version of the OpenAPI document: 0.1.0
|
9
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
10
10
|
|
11
|
-
|
11
|
+
Do not edit the class manually.
|
12
12
|
""" # noqa: E501
|
13
13
|
|
14
14
|
|
@@ -25,20 +25,42 @@ from crypticorn.trade.client.models.api_error_type import ApiErrorType
|
|
25
25
|
from typing import Optional, Set
|
26
26
|
from typing_extensions import Self
|
27
27
|
|
28
|
+
|
28
29
|
class NotificationModel(BaseModel):
|
29
30
|
"""
|
30
31
|
NotificationModel
|
31
|
-
"""
|
32
|
+
""" # noqa: E501
|
33
|
+
|
32
34
|
created_at: Optional[StrictInt] = None
|
33
35
|
updated_at: Optional[StrictInt] = None
|
34
36
|
id: Optional[StrictStr] = None
|
35
|
-
identifier: ApiErrorIdentifier = Field(
|
36
|
-
|
37
|
-
|
37
|
+
identifier: ApiErrorIdentifier = Field(
|
38
|
+
description="Identifier string. Must match the mapping key in the frontend."
|
39
|
+
)
|
40
|
+
level: ApiErrorLevel = Field(
|
41
|
+
description="Level of the notification. Of type ApiErrorLevel"
|
42
|
+
)
|
43
|
+
type: ApiErrorType = Field(
|
44
|
+
description="Type of the notification. Of type ApiErrorType"
|
45
|
+
)
|
38
46
|
user_id: Optional[StrictStr] = None
|
39
|
-
viewed: Optional[StrictBool] = Field(
|
40
|
-
|
41
|
-
|
47
|
+
viewed: Optional[StrictBool] = Field(
|
48
|
+
default=False, description="Whether the notification has been marked as seen"
|
49
|
+
)
|
50
|
+
sent: Optional[StrictBool] = Field(
|
51
|
+
default=False, description="Whether the notification has been sent as an email"
|
52
|
+
)
|
53
|
+
__properties: ClassVar[List[str]] = [
|
54
|
+
"created_at",
|
55
|
+
"updated_at",
|
56
|
+
"id",
|
57
|
+
"identifier",
|
58
|
+
"level",
|
59
|
+
"type",
|
60
|
+
"user_id",
|
61
|
+
"viewed",
|
62
|
+
"sent",
|
63
|
+
]
|
42
64
|
|
43
65
|
model_config = ConfigDict(
|
44
66
|
populate_by_name=True,
|
@@ -46,7 +68,6 @@ class NotificationModel(BaseModel):
|
|
46
68
|
protected_namespaces=(),
|
47
69
|
)
|
48
70
|
|
49
|
-
|
50
71
|
def to_str(self) -> str:
|
51
72
|
"""Returns the string representation of the model using alias"""
|
52
73
|
return pprint.pformat(self.model_dump(by_alias=True))
|
@@ -71,8 +92,7 @@ class NotificationModel(BaseModel):
|
|
71
92
|
were set at model initialization. Other fields with value `None`
|
72
93
|
are ignored.
|
73
94
|
"""
|
74
|
-
excluded_fields: Set[str] = set([
|
75
|
-
])
|
95
|
+
excluded_fields: Set[str] = set([])
|
76
96
|
|
77
97
|
_dict = self.model_dump(
|
78
98
|
by_alias=True,
|
@@ -82,22 +102,22 @@ class NotificationModel(BaseModel):
|
|
82
102
|
# set to None if created_at (nullable) is None
|
83
103
|
# and model_fields_set contains the field
|
84
104
|
if self.created_at is None and "created_at" in self.model_fields_set:
|
85
|
-
_dict[
|
105
|
+
_dict["created_at"] = None
|
86
106
|
|
87
107
|
# set to None if updated_at (nullable) is None
|
88
108
|
# and model_fields_set contains the field
|
89
109
|
if self.updated_at is None and "updated_at" in self.model_fields_set:
|
90
|
-
_dict[
|
110
|
+
_dict["updated_at"] = None
|
91
111
|
|
92
112
|
# set to None if id (nullable) is None
|
93
113
|
# and model_fields_set contains the field
|
94
114
|
if self.id is None and "id" in self.model_fields_set:
|
95
|
-
_dict[
|
115
|
+
_dict["id"] = None
|
96
116
|
|
97
117
|
# set to None if user_id (nullable) is None
|
98
118
|
# and model_fields_set contains the field
|
99
119
|
if self.user_id is None and "user_id" in self.model_fields_set:
|
100
|
-
_dict[
|
120
|
+
_dict["user_id"] = None
|
101
121
|
|
102
122
|
return _dict
|
103
123
|
|
@@ -110,17 +130,17 @@ class NotificationModel(BaseModel):
|
|
110
130
|
if not isinstance(obj, dict):
|
111
131
|
return cls.model_validate(obj)
|
112
132
|
|
113
|
-
_obj = cls.model_validate(
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
118
|
-
|
119
|
-
|
120
|
-
|
121
|
-
|
122
|
-
|
123
|
-
|
133
|
+
_obj = cls.model_validate(
|
134
|
+
{
|
135
|
+
"created_at": obj.get("created_at"),
|
136
|
+
"updated_at": obj.get("updated_at"),
|
137
|
+
"id": obj.get("id"),
|
138
|
+
"identifier": obj.get("identifier"),
|
139
|
+
"level": obj.get("level"),
|
140
|
+
"type": obj.get("type"),
|
141
|
+
"user_id": obj.get("user_id"),
|
142
|
+
"viewed": obj.get("viewed") if obj.get("viewed") is not None else False,
|
143
|
+
"sent": obj.get("sent") if obj.get("sent") is not None else False,
|
144
|
+
}
|
145
|
+
)
|
124
146
|
return _obj
|
125
|
-
|
126
|
-
|