crypticorn 1.0.0__py3-none-any.whl → 1.0.1__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/models/__init__.py +31 -0
- crypticorn/models/action_model.py +205 -0
- crypticorn/models/api_error_identifier.py +81 -0
- crypticorn/models/api_key_model.py +138 -0
- crypticorn/models/bot_model.py +118 -0
- crypticorn/models/create_api_key_response.py +99 -0
- crypticorn/models/deleted.py +87 -0
- crypticorn/models/exchange.py +37 -0
- crypticorn/models/execution_ids.py +91 -0
- crypticorn/models/futures_balance.py +109 -0
- crypticorn/models/futures_balance_error.py +89 -0
- crypticorn/models/futures_trading_action.py +198 -0
- crypticorn/models/get_futures_balance200_response_inner.py +134 -0
- crypticorn/models/http_validation_error.py +95 -0
- crypticorn/models/id.py +87 -0
- crypticorn/models/margin_mode.py +37 -0
- crypticorn/models/market_type.py +37 -0
- crypticorn/models/modified.py +87 -0
- crypticorn/models/notification_model.py +111 -0
- crypticorn/models/notification_type.py +39 -0
- crypticorn/models/order_model.py +266 -0
- crypticorn/models/order_status.py +40 -0
- crypticorn/models/post_futures_action.py +93 -0
- crypticorn/models/strategy_exchange_info.py +90 -0
- crypticorn/models/strategy_model.py +115 -0
- crypticorn/models/tpsl.py +116 -0
- crypticorn/models/trading_action_type.py +39 -0
- crypticorn/models/update_notification.py +91 -0
- crypticorn/models/validation_error.py +99 -0
- crypticorn/models/validation_error_loc_inner.py +138 -0
- {crypticorn-1.0.0.dist-info → crypticorn-1.0.1.dist-info}/METADATA +9 -3
- crypticorn-1.0.1.dist-info/RECORD +38 -0
- {crypticorn-1.0.0.dist-info → crypticorn-1.0.1.dist-info}/WHEEL +1 -1
- crypticorn-1.0.0.dist-info/RECORD +0 -8
- {crypticorn-1.0.0.dist-info → crypticorn-1.0.1.dist-info}/LICENSE.md +0 -0
- {crypticorn-1.0.0.dist-info → crypticorn-1.0.1.dist-info}/top_level.txt +0 -0
@@ -0,0 +1,134 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
|
3
|
+
"""
|
4
|
+
FastAPI
|
5
|
+
|
6
|
+
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
7
|
+
|
8
|
+
The version of the OpenAPI document: 0.1.0
|
9
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
10
|
+
|
11
|
+
Do not edit the class manually.
|
12
|
+
""" # noqa: E501
|
13
|
+
|
14
|
+
|
15
|
+
from __future__ import annotations
|
16
|
+
from inspect import getfullargspec
|
17
|
+
import json
|
18
|
+
import pprint
|
19
|
+
import re # noqa: F401
|
20
|
+
from pydantic import BaseModel, ConfigDict, Field, StrictStr, ValidationError, field_validator
|
21
|
+
from typing import Optional
|
22
|
+
from crypticorn.models.futures_balance import FuturesBalance
|
23
|
+
from crypticorn.models.futures_balance_error import FuturesBalanceError
|
24
|
+
from typing import Union, Any, List, Set, TYPE_CHECKING, Optional, Dict
|
25
|
+
from typing_extensions import Literal, Self
|
26
|
+
from pydantic import Field
|
27
|
+
|
28
|
+
GETFUTURESBALANCE200RESPONSEINNER_ANY_OF_SCHEMAS = ["FuturesBalance", "FuturesBalanceError"]
|
29
|
+
|
30
|
+
class GetFuturesBalance200ResponseInner(BaseModel):
|
31
|
+
"""
|
32
|
+
GetFuturesBalance200ResponseInner
|
33
|
+
"""
|
34
|
+
|
35
|
+
# data type: FuturesBalance
|
36
|
+
anyof_schema_1_validator: Optional[FuturesBalance] = None
|
37
|
+
# data type: FuturesBalanceError
|
38
|
+
anyof_schema_2_validator: Optional[FuturesBalanceError] = None
|
39
|
+
if TYPE_CHECKING:
|
40
|
+
actual_instance: Optional[Union[FuturesBalance, FuturesBalanceError]] = None
|
41
|
+
else:
|
42
|
+
actual_instance: Any = None
|
43
|
+
any_of_schemas: Set[str] = { "FuturesBalance", "FuturesBalanceError" }
|
44
|
+
|
45
|
+
model_config = {
|
46
|
+
"validate_assignment": True,
|
47
|
+
"protected_namespaces": (),
|
48
|
+
}
|
49
|
+
|
50
|
+
def __init__(self, *args, **kwargs) -> None:
|
51
|
+
if args:
|
52
|
+
if len(args) > 1:
|
53
|
+
raise ValueError("If a position argument is used, only 1 is allowed to set `actual_instance`")
|
54
|
+
if kwargs:
|
55
|
+
raise ValueError("If a position argument is used, keyword arguments cannot be used.")
|
56
|
+
super().__init__(actual_instance=args[0])
|
57
|
+
else:
|
58
|
+
super().__init__(**kwargs)
|
59
|
+
|
60
|
+
@field_validator('actual_instance')
|
61
|
+
def actual_instance_must_validate_anyof(cls, v):
|
62
|
+
instance = GetFuturesBalance200ResponseInner.model_construct()
|
63
|
+
error_messages = []
|
64
|
+
# validate data type: FuturesBalance
|
65
|
+
if not isinstance(v, FuturesBalance):
|
66
|
+
error_messages.append(f"Error! Input type `{type(v)}` is not `FuturesBalance`")
|
67
|
+
else:
|
68
|
+
return v
|
69
|
+
|
70
|
+
# validate data type: FuturesBalanceError
|
71
|
+
if not isinstance(v, FuturesBalanceError):
|
72
|
+
error_messages.append(f"Error! Input type `{type(v)}` is not `FuturesBalanceError`")
|
73
|
+
else:
|
74
|
+
return v
|
75
|
+
|
76
|
+
if error_messages:
|
77
|
+
# no match
|
78
|
+
raise ValueError("No match found when setting the actual_instance in GetFuturesBalance200ResponseInner with anyOf schemas: FuturesBalance, FuturesBalanceError. Details: " + ", ".join(error_messages))
|
79
|
+
else:
|
80
|
+
return v
|
81
|
+
|
82
|
+
@classmethod
|
83
|
+
def from_dict(cls, obj: Dict[str, Any]) -> Self:
|
84
|
+
return cls.from_json(json.dumps(obj))
|
85
|
+
|
86
|
+
@classmethod
|
87
|
+
def from_json(cls, json_str: str) -> Self:
|
88
|
+
"""Returns the object represented by the json string"""
|
89
|
+
instance = cls.model_construct()
|
90
|
+
error_messages = []
|
91
|
+
# anyof_schema_1_validator: Optional[FuturesBalance] = None
|
92
|
+
try:
|
93
|
+
instance.actual_instance = FuturesBalance.from_json(json_str)
|
94
|
+
return instance
|
95
|
+
except (ValidationError, ValueError) as e:
|
96
|
+
error_messages.append(str(e))
|
97
|
+
# anyof_schema_2_validator: Optional[FuturesBalanceError] = None
|
98
|
+
try:
|
99
|
+
instance.actual_instance = FuturesBalanceError.from_json(json_str)
|
100
|
+
return instance
|
101
|
+
except (ValidationError, ValueError) as e:
|
102
|
+
error_messages.append(str(e))
|
103
|
+
|
104
|
+
if error_messages:
|
105
|
+
# no match
|
106
|
+
raise ValueError("No match found when deserializing the JSON string into GetFuturesBalance200ResponseInner with anyOf schemas: FuturesBalance, FuturesBalanceError. Details: " + ", ".join(error_messages))
|
107
|
+
else:
|
108
|
+
return instance
|
109
|
+
|
110
|
+
def to_json(self) -> str:
|
111
|
+
"""Returns the JSON representation of the actual instance"""
|
112
|
+
if self.actual_instance is None:
|
113
|
+
return "null"
|
114
|
+
|
115
|
+
if hasattr(self.actual_instance, "to_json") and callable(self.actual_instance.to_json):
|
116
|
+
return self.actual_instance.to_json()
|
117
|
+
else:
|
118
|
+
return json.dumps(self.actual_instance)
|
119
|
+
|
120
|
+
def to_dict(self) -> Optional[Union[Dict[str, Any], FuturesBalance, FuturesBalanceError]]:
|
121
|
+
"""Returns the dict representation of the actual instance"""
|
122
|
+
if self.actual_instance is None:
|
123
|
+
return None
|
124
|
+
|
125
|
+
if hasattr(self.actual_instance, "to_dict") and callable(self.actual_instance.to_dict):
|
126
|
+
return self.actual_instance.to_dict()
|
127
|
+
else:
|
128
|
+
return self.actual_instance
|
129
|
+
|
130
|
+
def to_str(self) -> str:
|
131
|
+
"""Returns the string representation of the actual instance"""
|
132
|
+
return pprint.pformat(self.model_dump())
|
133
|
+
|
134
|
+
|
@@ -0,0 +1,95 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
|
3
|
+
"""
|
4
|
+
FastAPI
|
5
|
+
|
6
|
+
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
7
|
+
|
8
|
+
The version of the OpenAPI document: 0.1.0
|
9
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
10
|
+
|
11
|
+
Do not edit the class manually.
|
12
|
+
""" # noqa: E501
|
13
|
+
|
14
|
+
|
15
|
+
from __future__ import annotations
|
16
|
+
import pprint
|
17
|
+
import re # noqa: F401
|
18
|
+
import json
|
19
|
+
|
20
|
+
from pydantic import BaseModel, ConfigDict
|
21
|
+
from typing import Any, ClassVar, Dict, List, Optional
|
22
|
+
from crypticorn.models.validation_error import ValidationError
|
23
|
+
from typing import Optional, Set
|
24
|
+
from typing_extensions import Self
|
25
|
+
|
26
|
+
class HTTPValidationError(BaseModel):
|
27
|
+
"""
|
28
|
+
HTTPValidationError
|
29
|
+
""" # noqa: E501
|
30
|
+
detail: Optional[List[ValidationError]] = None
|
31
|
+
__properties: ClassVar[List[str]] = ["detail"]
|
32
|
+
|
33
|
+
model_config = ConfigDict(
|
34
|
+
populate_by_name=True,
|
35
|
+
validate_assignment=True,
|
36
|
+
protected_namespaces=(),
|
37
|
+
)
|
38
|
+
|
39
|
+
|
40
|
+
def to_str(self) -> str:
|
41
|
+
"""Returns the string representation of the model using alias"""
|
42
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
43
|
+
|
44
|
+
def to_json(self) -> str:
|
45
|
+
"""Returns the JSON representation of the model using alias"""
|
46
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
47
|
+
return json.dumps(self.to_dict())
|
48
|
+
|
49
|
+
@classmethod
|
50
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
51
|
+
"""Create an instance of HTTPValidationError from a JSON string"""
|
52
|
+
return cls.from_dict(json.loads(json_str))
|
53
|
+
|
54
|
+
def to_dict(self) -> Dict[str, Any]:
|
55
|
+
"""Return the dictionary representation of the model using alias.
|
56
|
+
|
57
|
+
This has the following differences from calling pydantic's
|
58
|
+
`self.model_dump(by_alias=True)`:
|
59
|
+
|
60
|
+
* `None` is only added to the output dict for nullable fields that
|
61
|
+
were set at model initialization. Other fields with value `None`
|
62
|
+
are ignored.
|
63
|
+
"""
|
64
|
+
excluded_fields: Set[str] = set([
|
65
|
+
])
|
66
|
+
|
67
|
+
_dict = self.model_dump(
|
68
|
+
by_alias=True,
|
69
|
+
exclude=excluded_fields,
|
70
|
+
exclude_none=True,
|
71
|
+
)
|
72
|
+
# override the default output from pydantic by calling `to_dict()` of each item in detail (list)
|
73
|
+
_items = []
|
74
|
+
if self.detail:
|
75
|
+
for _item_detail in self.detail:
|
76
|
+
if _item_detail:
|
77
|
+
_items.append(_item_detail.to_dict())
|
78
|
+
_dict['detail'] = _items
|
79
|
+
return _dict
|
80
|
+
|
81
|
+
@classmethod
|
82
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
83
|
+
"""Create an instance of HTTPValidationError from a dict"""
|
84
|
+
if obj is None:
|
85
|
+
return None
|
86
|
+
|
87
|
+
if not isinstance(obj, dict):
|
88
|
+
return cls.model_validate(obj)
|
89
|
+
|
90
|
+
_obj = cls.model_validate({
|
91
|
+
"detail": [ValidationError.from_dict(_item) for _item in obj["detail"]] if obj.get("detail") is not None else None
|
92
|
+
})
|
93
|
+
return _obj
|
94
|
+
|
95
|
+
|
crypticorn/models/id.py
ADDED
@@ -0,0 +1,87 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
|
3
|
+
"""
|
4
|
+
FastAPI
|
5
|
+
|
6
|
+
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
7
|
+
|
8
|
+
The version of the OpenAPI document: 0.1.0
|
9
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
10
|
+
|
11
|
+
Do not edit the class manually.
|
12
|
+
""" # noqa: E501
|
13
|
+
|
14
|
+
|
15
|
+
from __future__ import annotations
|
16
|
+
import pprint
|
17
|
+
import re # noqa: F401
|
18
|
+
import json
|
19
|
+
|
20
|
+
from pydantic import BaseModel, ConfigDict, Field, StrictStr
|
21
|
+
from typing import Any, ClassVar, Dict, List
|
22
|
+
from typing import Optional, Set
|
23
|
+
from typing_extensions import Self
|
24
|
+
|
25
|
+
class ID(BaseModel):
|
26
|
+
"""
|
27
|
+
ID
|
28
|
+
""" # noqa: E501
|
29
|
+
id: StrictStr = Field(description="UID, required in the request body")
|
30
|
+
__properties: ClassVar[List[str]] = ["id"]
|
31
|
+
|
32
|
+
model_config = ConfigDict(
|
33
|
+
populate_by_name=True,
|
34
|
+
validate_assignment=True,
|
35
|
+
protected_namespaces=(),
|
36
|
+
)
|
37
|
+
|
38
|
+
|
39
|
+
def to_str(self) -> str:
|
40
|
+
"""Returns the string representation of the model using alias"""
|
41
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
42
|
+
|
43
|
+
def to_json(self) -> str:
|
44
|
+
"""Returns the JSON representation of the model using alias"""
|
45
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
46
|
+
return json.dumps(self.to_dict())
|
47
|
+
|
48
|
+
@classmethod
|
49
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
50
|
+
"""Create an instance of ID from a JSON string"""
|
51
|
+
return cls.from_dict(json.loads(json_str))
|
52
|
+
|
53
|
+
def to_dict(self) -> Dict[str, Any]:
|
54
|
+
"""Return the dictionary representation of the model using alias.
|
55
|
+
|
56
|
+
This has the following differences from calling pydantic's
|
57
|
+
`self.model_dump(by_alias=True)`:
|
58
|
+
|
59
|
+
* `None` is only added to the output dict for nullable fields that
|
60
|
+
were set at model initialization. Other fields with value `None`
|
61
|
+
are ignored.
|
62
|
+
"""
|
63
|
+
excluded_fields: Set[str] = set([
|
64
|
+
])
|
65
|
+
|
66
|
+
_dict = self.model_dump(
|
67
|
+
by_alias=True,
|
68
|
+
exclude=excluded_fields,
|
69
|
+
exclude_none=True,
|
70
|
+
)
|
71
|
+
return _dict
|
72
|
+
|
73
|
+
@classmethod
|
74
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
75
|
+
"""Create an instance of ID from a dict"""
|
76
|
+
if obj is None:
|
77
|
+
return None
|
78
|
+
|
79
|
+
if not isinstance(obj, dict):
|
80
|
+
return cls.model_validate(obj)
|
81
|
+
|
82
|
+
_obj = cls.model_validate({
|
83
|
+
"id": obj.get("id")
|
84
|
+
})
|
85
|
+
return _obj
|
86
|
+
|
87
|
+
|
@@ -0,0 +1,37 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
|
3
|
+
"""
|
4
|
+
FastAPI
|
5
|
+
|
6
|
+
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
7
|
+
|
8
|
+
The version of the OpenAPI document: 0.1.0
|
9
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
10
|
+
|
11
|
+
Do not edit the class manually.
|
12
|
+
""" # noqa: E501
|
13
|
+
|
14
|
+
|
15
|
+
from __future__ import annotations
|
16
|
+
import json
|
17
|
+
from enum import Enum
|
18
|
+
from typing_extensions import Self
|
19
|
+
|
20
|
+
|
21
|
+
class MarginMode(str, Enum):
|
22
|
+
"""
|
23
|
+
Margin mode for futures trades
|
24
|
+
"""
|
25
|
+
|
26
|
+
"""
|
27
|
+
allowed enum values
|
28
|
+
"""
|
29
|
+
ISOLATED = 'isolated'
|
30
|
+
CROSS = 'cross'
|
31
|
+
|
32
|
+
@classmethod
|
33
|
+
def from_json(cls, json_str: str) -> Self:
|
34
|
+
"""Create an instance of MarginMode from a JSON string"""
|
35
|
+
return cls(json.loads(json_str))
|
36
|
+
|
37
|
+
|
@@ -0,0 +1,37 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
|
3
|
+
"""
|
4
|
+
FastAPI
|
5
|
+
|
6
|
+
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
7
|
+
|
8
|
+
The version of the OpenAPI document: 0.1.0
|
9
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
10
|
+
|
11
|
+
Do not edit the class manually.
|
12
|
+
""" # noqa: E501
|
13
|
+
|
14
|
+
|
15
|
+
from __future__ import annotations
|
16
|
+
import json
|
17
|
+
from enum import Enum
|
18
|
+
from typing_extensions import Self
|
19
|
+
|
20
|
+
|
21
|
+
class MarketType(str, Enum):
|
22
|
+
"""
|
23
|
+
Type of market
|
24
|
+
"""
|
25
|
+
|
26
|
+
"""
|
27
|
+
allowed enum values
|
28
|
+
"""
|
29
|
+
SPOT = 'spot'
|
30
|
+
FUTURES = 'futures'
|
31
|
+
|
32
|
+
@classmethod
|
33
|
+
def from_json(cls, json_str: str) -> Self:
|
34
|
+
"""Create an instance of MarketType from a JSON string"""
|
35
|
+
return cls(json.loads(json_str))
|
36
|
+
|
37
|
+
|
@@ -0,0 +1,87 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
|
3
|
+
"""
|
4
|
+
FastAPI
|
5
|
+
|
6
|
+
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
7
|
+
|
8
|
+
The version of the OpenAPI document: 0.1.0
|
9
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
10
|
+
|
11
|
+
Do not edit the class manually.
|
12
|
+
""" # noqa: E501
|
13
|
+
|
14
|
+
|
15
|
+
from __future__ import annotations
|
16
|
+
import pprint
|
17
|
+
import re # noqa: F401
|
18
|
+
import json
|
19
|
+
|
20
|
+
from pydantic import BaseModel, ConfigDict, Field, StrictInt
|
21
|
+
from typing import Any, ClassVar, Dict, List
|
22
|
+
from typing import Optional, Set
|
23
|
+
from typing_extensions import Self
|
24
|
+
|
25
|
+
class Modified(BaseModel):
|
26
|
+
"""
|
27
|
+
Modified
|
28
|
+
""" # noqa: E501
|
29
|
+
modified: StrictInt = Field(description="Number of modified documents")
|
30
|
+
__properties: ClassVar[List[str]] = ["modified"]
|
31
|
+
|
32
|
+
model_config = ConfigDict(
|
33
|
+
populate_by_name=True,
|
34
|
+
validate_assignment=True,
|
35
|
+
protected_namespaces=(),
|
36
|
+
)
|
37
|
+
|
38
|
+
|
39
|
+
def to_str(self) -> str:
|
40
|
+
"""Returns the string representation of the model using alias"""
|
41
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
42
|
+
|
43
|
+
def to_json(self) -> str:
|
44
|
+
"""Returns the JSON representation of the model using alias"""
|
45
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
46
|
+
return json.dumps(self.to_dict())
|
47
|
+
|
48
|
+
@classmethod
|
49
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
50
|
+
"""Create an instance of Modified from a JSON string"""
|
51
|
+
return cls.from_dict(json.loads(json_str))
|
52
|
+
|
53
|
+
def to_dict(self) -> Dict[str, Any]:
|
54
|
+
"""Return the dictionary representation of the model using alias.
|
55
|
+
|
56
|
+
This has the following differences from calling pydantic's
|
57
|
+
`self.model_dump(by_alias=True)`:
|
58
|
+
|
59
|
+
* `None` is only added to the output dict for nullable fields that
|
60
|
+
were set at model initialization. Other fields with value `None`
|
61
|
+
are ignored.
|
62
|
+
"""
|
63
|
+
excluded_fields: Set[str] = set([
|
64
|
+
])
|
65
|
+
|
66
|
+
_dict = self.model_dump(
|
67
|
+
by_alias=True,
|
68
|
+
exclude=excluded_fields,
|
69
|
+
exclude_none=True,
|
70
|
+
)
|
71
|
+
return _dict
|
72
|
+
|
73
|
+
@classmethod
|
74
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
75
|
+
"""Create an instance of Modified from a dict"""
|
76
|
+
if obj is None:
|
77
|
+
return None
|
78
|
+
|
79
|
+
if not isinstance(obj, dict):
|
80
|
+
return cls.model_validate(obj)
|
81
|
+
|
82
|
+
_obj = cls.model_validate({
|
83
|
+
"modified": obj.get("modified")
|
84
|
+
})
|
85
|
+
return _obj
|
86
|
+
|
87
|
+
|
@@ -0,0 +1,111 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
|
3
|
+
"""
|
4
|
+
FastAPI
|
5
|
+
|
6
|
+
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
7
|
+
|
8
|
+
The version of the OpenAPI document: 0.1.0
|
9
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
10
|
+
|
11
|
+
Do not edit the class manually.
|
12
|
+
""" # noqa: E501
|
13
|
+
|
14
|
+
|
15
|
+
from __future__ import annotations
|
16
|
+
import pprint
|
17
|
+
import re # noqa: F401
|
18
|
+
import json
|
19
|
+
|
20
|
+
from pydantic import BaseModel, ConfigDict, Field, StrictBool, StrictInt, StrictStr
|
21
|
+
from typing import Any, ClassVar, Dict, List, Optional
|
22
|
+
from crypticorn.models.api_error_identifier import ApiErrorIdentifier
|
23
|
+
from crypticorn.models.notification_type import NotificationType
|
24
|
+
from typing import Optional, Set
|
25
|
+
from typing_extensions import Self
|
26
|
+
|
27
|
+
class NotificationModel(BaseModel):
|
28
|
+
"""
|
29
|
+
NotificationModel
|
30
|
+
""" # noqa: E501
|
31
|
+
id: Optional[StrictStr] = None
|
32
|
+
identifier: ApiErrorIdentifier = Field(description="Identifier string. Must match the mapping key in the frontend.")
|
33
|
+
user_id: Optional[StrictStr] = None
|
34
|
+
viewed: Optional[StrictBool] = Field(default=False, description="Whether the notification has been marked as seen")
|
35
|
+
sent: Optional[StrictBool] = Field(default=False, description="Whether the notification has been sent as an email")
|
36
|
+
type: NotificationType = Field(description="The type of the notification.")
|
37
|
+
timestamp: Optional[StrictInt] = Field(default=1741716883, description="Timestamp of creation")
|
38
|
+
__properties: ClassVar[List[str]] = ["id", "identifier", "user_id", "viewed", "sent", "type", "timestamp"]
|
39
|
+
|
40
|
+
model_config = ConfigDict(
|
41
|
+
populate_by_name=True,
|
42
|
+
validate_assignment=True,
|
43
|
+
protected_namespaces=(),
|
44
|
+
)
|
45
|
+
|
46
|
+
|
47
|
+
def to_str(self) -> str:
|
48
|
+
"""Returns the string representation of the model using alias"""
|
49
|
+
return pprint.pformat(self.model_dump(by_alias=True))
|
50
|
+
|
51
|
+
def to_json(self) -> str:
|
52
|
+
"""Returns the JSON representation of the model using alias"""
|
53
|
+
# TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
|
54
|
+
return json.dumps(self.to_dict())
|
55
|
+
|
56
|
+
@classmethod
|
57
|
+
def from_json(cls, json_str: str) -> Optional[Self]:
|
58
|
+
"""Create an instance of NotificationModel from a JSON string"""
|
59
|
+
return cls.from_dict(json.loads(json_str))
|
60
|
+
|
61
|
+
def to_dict(self) -> Dict[str, Any]:
|
62
|
+
"""Return the dictionary representation of the model using alias.
|
63
|
+
|
64
|
+
This has the following differences from calling pydantic's
|
65
|
+
`self.model_dump(by_alias=True)`:
|
66
|
+
|
67
|
+
* `None` is only added to the output dict for nullable fields that
|
68
|
+
were set at model initialization. Other fields with value `None`
|
69
|
+
are ignored.
|
70
|
+
"""
|
71
|
+
excluded_fields: Set[str] = set([
|
72
|
+
])
|
73
|
+
|
74
|
+
_dict = self.model_dump(
|
75
|
+
by_alias=True,
|
76
|
+
exclude=excluded_fields,
|
77
|
+
exclude_none=True,
|
78
|
+
)
|
79
|
+
# set to None if id (nullable) is None
|
80
|
+
# and model_fields_set contains the field
|
81
|
+
if self.id is None and "id" in self.model_fields_set:
|
82
|
+
_dict['id'] = None
|
83
|
+
|
84
|
+
# set to None if user_id (nullable) is None
|
85
|
+
# and model_fields_set contains the field
|
86
|
+
if self.user_id is None and "user_id" in self.model_fields_set:
|
87
|
+
_dict['user_id'] = None
|
88
|
+
|
89
|
+
return _dict
|
90
|
+
|
91
|
+
@classmethod
|
92
|
+
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
|
93
|
+
"""Create an instance of NotificationModel from a dict"""
|
94
|
+
if obj is None:
|
95
|
+
return None
|
96
|
+
|
97
|
+
if not isinstance(obj, dict):
|
98
|
+
return cls.model_validate(obj)
|
99
|
+
|
100
|
+
_obj = cls.model_validate({
|
101
|
+
"id": obj.get("id"),
|
102
|
+
"identifier": obj.get("identifier"),
|
103
|
+
"user_id": obj.get("user_id"),
|
104
|
+
"viewed": obj.get("viewed") if obj.get("viewed") is not None else False,
|
105
|
+
"sent": obj.get("sent") if obj.get("sent") is not None else False,
|
106
|
+
"type": obj.get("type"),
|
107
|
+
"timestamp": obj.get("timestamp") if obj.get("timestamp") is not None else 1741716883
|
108
|
+
})
|
109
|
+
return _obj
|
110
|
+
|
111
|
+
|
@@ -0,0 +1,39 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
|
3
|
+
"""
|
4
|
+
FastAPI
|
5
|
+
|
6
|
+
No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
|
7
|
+
|
8
|
+
The version of the OpenAPI document: 0.1.0
|
9
|
+
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
10
|
+
|
11
|
+
Do not edit the class manually.
|
12
|
+
""" # noqa: E501
|
13
|
+
|
14
|
+
|
15
|
+
from __future__ import annotations
|
16
|
+
import json
|
17
|
+
from enum import Enum
|
18
|
+
from typing_extensions import Self
|
19
|
+
|
20
|
+
|
21
|
+
class NotificationType(str, Enum):
|
22
|
+
"""
|
23
|
+
NotificationType
|
24
|
+
"""
|
25
|
+
|
26
|
+
"""
|
27
|
+
allowed enum values
|
28
|
+
"""
|
29
|
+
ERROR = 'error'
|
30
|
+
SUCCESS = 'success'
|
31
|
+
INFO = 'info'
|
32
|
+
WARNING = 'warning'
|
33
|
+
|
34
|
+
@classmethod
|
35
|
+
def from_json(cls, json_str: str) -> Self:
|
36
|
+
"""Create an instance of NotificationType from a JSON string"""
|
37
|
+
return cls(json.loads(json_str))
|
38
|
+
|
39
|
+
|