crypticorn 2.5.0rc5__py3-none-any.whl → 2.5.2__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 (144) hide show
  1. crypticorn/auth/main.py +2 -0
  2. crypticorn/client.py +60 -69
  3. crypticorn/common/__init__.py +3 -1
  4. crypticorn/common/auth.py +38 -20
  5. crypticorn/common/enums.py +4 -31
  6. crypticorn/common/errors.py +72 -17
  7. crypticorn/common/exceptions.py +29 -15
  8. crypticorn/common/mixins.py +37 -0
  9. crypticorn/common/status_router.py +42 -0
  10. crypticorn/common/urls.py +2 -1
  11. crypticorn/common/utils.py +9 -14
  12. crypticorn/hive/main.py +2 -0
  13. crypticorn/klines/client/__init__.py +10 -43
  14. crypticorn/klines/client/api/__init__.py +1 -1
  15. crypticorn/klines/client/api/change_in_timeframe_api.py +16 -31
  16. crypticorn/klines/client/api/funding_rates_api.py +8 -22
  17. crypticorn/klines/client/api/ohlcv_data_api.py +17 -38
  18. crypticorn/klines/client/api/{health_check_api.py → status_api.py} +18 -23
  19. crypticorn/klines/client/api/symbols_api.py +18 -34
  20. crypticorn/klines/client/api/udf_api.py +48 -59
  21. crypticorn/klines/client/api_client.py +1 -1
  22. crypticorn/klines/client/configuration.py +1 -1
  23. crypticorn/klines/client/exceptions.py +1 -1
  24. crypticorn/klines/client/models/__init__.py +9 -42
  25. crypticorn/klines/client/models/{change_in_timeframe_response.py → change_in_timeframe.py} +5 -5
  26. crypticorn/klines/client/models/{error_response.py → exception_detail.py} +25 -20
  27. crypticorn/klines/client/models/{funding_rate_response.py → funding_rate.py} +5 -5
  28. crypticorn/klines/client/models/{ohlcv_response.py → ohlcv_history.py} +14 -14
  29. crypticorn/klines/client/models/resolution.py +1 -1
  30. crypticorn/klines/client/models/{exchange.py → search_symbol.py} +17 -13
  31. crypticorn/klines/client/models/sort_direction.py +1 -1
  32. crypticorn/klines/client/models/{symbol_group_response.py → symbol_group.py} +5 -5
  33. crypticorn/klines/client/models/{symbol_info_response.py → symbol_info.py} +5 -5
  34. crypticorn/klines/client/models/symbol_type.py +1 -1
  35. crypticorn/klines/client/models/timeframe.py +1 -1
  36. crypticorn/klines/client/models/{udf_config_response.py → udf_config.py} +7 -19
  37. crypticorn/klines/client/rest.py +1 -1
  38. crypticorn/klines/main.py +40 -23
  39. crypticorn/metrics/client/__init__.py +3 -22
  40. crypticorn/metrics/client/api/__init__.py +1 -1
  41. crypticorn/metrics/client/api/exchanges_api.py +53 -97
  42. crypticorn/metrics/client/api/indicators_api.py +26 -52
  43. crypticorn/metrics/client/api/logs_api.py +8 -23
  44. crypticorn/metrics/client/api/marketcap_api.py +36 -88
  45. crypticorn/metrics/client/api/markets_api.py +26 -55
  46. crypticorn/metrics/client/api/{health_check_api.py → status_api.py} +18 -23
  47. crypticorn/metrics/client/api/tokens_api.py +7 -21
  48. crypticorn/metrics/client/api_client.py +1 -1
  49. crypticorn/metrics/client/configuration.py +1 -1
  50. crypticorn/metrics/client/exceptions.py +1 -1
  51. crypticorn/metrics/client/models/__init__.py +2 -21
  52. crypticorn/metrics/client/models/{error_response.py → exception_detail.py} +25 -20
  53. crypticorn/metrics/client/models/severity.py +1 -1
  54. crypticorn/metrics/client/models/time_interval.py +1 -1
  55. crypticorn/metrics/client/models/trading_status.py +1 -1
  56. crypticorn/metrics/client/rest.py +1 -1
  57. crypticorn/metrics/main.py +51 -43
  58. crypticorn/pay/main.py +2 -0
  59. crypticorn/trade/client/__init__.py +1 -5
  60. crypticorn/trade/client/api/exchanges_api.py +6 -6
  61. crypticorn/trade/client/api/trading_actions_api.py +16 -15
  62. crypticorn/trade/client/models/__init__.py +1 -5
  63. crypticorn/trade/client/models/action_model.py +1 -2
  64. crypticorn/trade/client/models/bot_model.py +3 -7
  65. crypticorn/trade/client/models/exchange_key_model.py +2 -11
  66. crypticorn/trade/client/models/execution_ids.py +1 -1
  67. crypticorn/trade/client/models/futures_trading_action.py +1 -2
  68. crypticorn/trade/client/models/notification_model.py +3 -12
  69. crypticorn/trade/client/models/order_model.py +7 -21
  70. crypticorn/trade/client/models/spot_trading_action.py +230 -0
  71. crypticorn/trade/client/models/strategy_exchange_info.py +2 -3
  72. crypticorn/trade/client/models/strategy_model_input.py +1 -2
  73. crypticorn/trade/client/models/strategy_model_output.py +1 -2
  74. crypticorn/trade/client/models/tpsl.py +3 -1
  75. crypticorn/trade/main.py +2 -0
  76. {crypticorn-2.5.0rc5.dist-info → crypticorn-2.5.2.dist-info}/METADATA +7 -5
  77. {crypticorn-2.5.0rc5.dist-info → crypticorn-2.5.2.dist-info}/RECORD +81 -141
  78. {crypticorn-2.5.0rc5.dist-info → crypticorn-2.5.2.dist-info}/WHEEL +1 -1
  79. crypticorn/common/sorter.py +0 -40
  80. crypticorn/klines/client/models/base_response_health_check_response.py +0 -114
  81. crypticorn/klines/client/models/base_response_list_change_in_timeframe_response.py +0 -123
  82. crypticorn/klines/client/models/base_response_list_funding_rate_response.py +0 -118
  83. crypticorn/klines/client/models/base_response_list_str.py +0 -106
  84. crypticorn/klines/client/models/base_response_ohlcv_response.py +0 -114
  85. crypticorn/klines/client/models/health_check_response.py +0 -91
  86. crypticorn/klines/client/models/history_error_response.py +0 -89
  87. crypticorn/klines/client/models/history_no_data_response.py +0 -99
  88. crypticorn/klines/client/models/history_success_response.py +0 -99
  89. crypticorn/klines/client/models/http_validation_error.py +0 -99
  90. crypticorn/klines/client/models/market.py +0 -35
  91. crypticorn/klines/client/models/market_type.py +0 -35
  92. crypticorn/klines/client/models/response_get_history_udf_history_get.py +0 -198
  93. crypticorn/klines/client/models/response_get_udf_history.py +0 -198
  94. crypticorn/klines/client/models/search_symbol_response.py +0 -104
  95. crypticorn/klines/client/models/validation_error.py +0 -105
  96. crypticorn/klines/client/models/validation_error_loc_inner.py +0 -159
  97. crypticorn/metrics/client/models/base_response_dict.py +0 -106
  98. crypticorn/metrics/client/models/base_response_health_check_response.py +0 -114
  99. crypticorn/metrics/client/models/base_response_list_dict.py +0 -106
  100. crypticorn/metrics/client/models/base_response_list_exchange_mapping.py +0 -118
  101. crypticorn/metrics/client/models/base_response_list_str.py +0 -106
  102. crypticorn/metrics/client/models/exchange_mapping.py +0 -134
  103. crypticorn/metrics/client/models/health_check_response.py +0 -91
  104. crypticorn/metrics/client/models/http_validation_error.py +0 -99
  105. crypticorn/metrics/client/models/market.py +0 -35
  106. crypticorn/metrics/client/models/market_type.py +0 -35
  107. crypticorn/metrics/client/models/validation_error.py +0 -105
  108. crypticorn/metrics/client/models/validation_error_loc_inner.py +0 -159
  109. crypticorn/pay/client/models/api_status_res.py +0 -83
  110. crypticorn/pay/client/models/body_create_now_invoice.py +0 -98
  111. crypticorn/pay/client/models/body_create_product.py +0 -98
  112. crypticorn/pay/client/models/body_get_products.py +0 -87
  113. crypticorn/pay/client/models/body_handle_now_webhook.py +0 -98
  114. crypticorn/pay/client/models/body_update_product.py +0 -98
  115. crypticorn/pay/client/models/combined_payment_history.py +0 -101
  116. crypticorn/pay/client/models/create_invoice_req.py +0 -188
  117. crypticorn/pay/client/models/create_invoice_res.py +0 -188
  118. crypticorn/pay/client/models/currency.py +0 -165
  119. crypticorn/pay/client/models/estimate_price_req.py +0 -91
  120. crypticorn/pay/client/models/estimate_price_res.py +0 -102
  121. crypticorn/pay/client/models/get_currencies_res.py +0 -99
  122. crypticorn/pay/client/models/get_payment_status_res.py +0 -222
  123. crypticorn/pay/client/models/get_payments_list_res.py +0 -109
  124. crypticorn/pay/client/models/min_amount_req.py +0 -124
  125. crypticorn/pay/client/models/min_amount_res.py +0 -105
  126. crypticorn/pay/client/models/now_fee_structure.py +0 -104
  127. crypticorn/pay/client/models/now_payment_model.py +0 -124
  128. crypticorn/pay/client/models/now_payment_status.py +0 -42
  129. crypticorn/pay/client/models/now_webhook_payload.py +0 -181
  130. crypticorn/pay/client/models/partial_product_update_model.py +0 -150
  131. crypticorn/pay/client/models/product.py +0 -87
  132. crypticorn/pay/client/models/product_model.py +0 -128
  133. crypticorn/pay/client/models/product_subs_model.py +0 -108
  134. crypticorn/pay/client/models/product_update_model.py +0 -150
  135. crypticorn/pay/client/models/unified_payment_model.py +0 -112
  136. crypticorn/trade/client/models/api_error_identifier.py +0 -104
  137. crypticorn/trade/client/models/api_error_level.py +0 -37
  138. crypticorn/trade/client/models/api_error_type.py +0 -37
  139. crypticorn/trade/client/models/api_key_model.py +0 -156
  140. crypticorn/trade/client/models/exchange.py +0 -35
  141. crypticorn/trade/client/models/market_type.py +0 -35
  142. /crypticorn/common/{pydantic.py → decorators.py} +0 -0
  143. {crypticorn-2.5.0rc5.dist-info → crypticorn-2.5.2.dist-info}/entry_points.txt +0 -0
  144. {crypticorn-2.5.0rc5.dist-info → crypticorn-2.5.2.dist-info}/top_level.txt +0 -0
@@ -1,165 +0,0 @@
1
- # coding: utf-8
2
-
3
- """
4
- Payment API
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 typing import Optional, Set
23
- from typing_extensions import Self
24
-
25
-
26
- class Currency(BaseModel):
27
- """
28
- Model representing a single cryptocurrency supported by the API. This model contains detailed information about each cryptocurrency available for payments, including its identifiers, network details, validation patterns, and configuration settings.
29
- """ # noqa: E501
30
-
31
- id: StrictInt = Field(description="Unique identifier for the currency")
32
- code: StrictStr = Field(description="Currency code/ticker symbol")
33
- name: StrictStr = Field(description="Full name of the currency")
34
- enable: StrictBool = Field(description="Whether the currency is currently enabled")
35
- wallet_regex: StrictStr = Field(
36
- description="Regex pattern for valid wallet addresses"
37
- )
38
- priority: StrictInt = Field(description="Priority ranking of the currency")
39
- extra_id_exists: StrictBool = Field(
40
- description="Whether the currency requires an extra ID/memo/tag"
41
- )
42
- extra_id_regex: Optional[StrictStr] = None
43
- logo_url: StrictStr = Field(description="URL path to currency logo image")
44
- track: StrictBool = Field(description="Whether the currency is being tracked")
45
- cg_id: Optional[StrictStr] = None
46
- is_maxlimit: StrictBool = Field(
47
- description="Whether the currency has a maximum limit"
48
- )
49
- network: Optional[StrictStr] = None
50
- smart_contract: Optional[StrictStr] = None
51
- network_precision: Optional[StrictInt] = None
52
- __properties: ClassVar[List[str]] = [
53
- "id",
54
- "code",
55
- "name",
56
- "enable",
57
- "wallet_regex",
58
- "priority",
59
- "extra_id_exists",
60
- "extra_id_regex",
61
- "logo_url",
62
- "track",
63
- "cg_id",
64
- "is_maxlimit",
65
- "network",
66
- "smart_contract",
67
- "network_precision",
68
- ]
69
-
70
- model_config = ConfigDict(
71
- populate_by_name=True,
72
- validate_assignment=True,
73
- protected_namespaces=(),
74
- )
75
-
76
- def to_str(self) -> str:
77
- """Returns the string representation of the model using alias"""
78
- return pprint.pformat(self.model_dump(by_alias=True))
79
-
80
- def to_json(self) -> str:
81
- """Returns the JSON representation of the model using alias"""
82
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
83
- return json.dumps(self.to_dict())
84
-
85
- @classmethod
86
- def from_json(cls, json_str: str) -> Optional[Self]:
87
- """Create an instance of Currency from a JSON string"""
88
- return cls.from_dict(json.loads(json_str))
89
-
90
- def to_dict(self) -> Dict[str, Any]:
91
- """Return the dictionary representation of the model using alias.
92
-
93
- This has the following differences from calling pydantic's
94
- `self.model_dump(by_alias=True)`:
95
-
96
- * `None` is only added to the output dict for nullable fields that
97
- were set at model initialization. Other fields with value `None`
98
- are ignored.
99
- """
100
- excluded_fields: Set[str] = set([])
101
-
102
- _dict = self.model_dump(
103
- by_alias=True,
104
- exclude=excluded_fields,
105
- exclude_none=True,
106
- )
107
- # set to None if extra_id_regex (nullable) is None
108
- # and model_fields_set contains the field
109
- if self.extra_id_regex is None and "extra_id_regex" in self.model_fields_set:
110
- _dict["extra_id_regex"] = None
111
-
112
- # set to None if cg_id (nullable) is None
113
- # and model_fields_set contains the field
114
- if self.cg_id is None and "cg_id" in self.model_fields_set:
115
- _dict["cg_id"] = None
116
-
117
- # set to None if network (nullable) is None
118
- # and model_fields_set contains the field
119
- if self.network is None and "network" in self.model_fields_set:
120
- _dict["network"] = None
121
-
122
- # set to None if smart_contract (nullable) is None
123
- # and model_fields_set contains the field
124
- if self.smart_contract is None and "smart_contract" in self.model_fields_set:
125
- _dict["smart_contract"] = None
126
-
127
- # set to None if network_precision (nullable) is None
128
- # and model_fields_set contains the field
129
- if (
130
- self.network_precision is None
131
- and "network_precision" in self.model_fields_set
132
- ):
133
- _dict["network_precision"] = None
134
-
135
- return _dict
136
-
137
- @classmethod
138
- def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
139
- """Create an instance of Currency from a dict"""
140
- if obj is None:
141
- return None
142
-
143
- if not isinstance(obj, dict):
144
- return cls.model_validate(obj)
145
-
146
- _obj = cls.model_validate(
147
- {
148
- "id": obj.get("id"),
149
- "code": obj.get("code"),
150
- "name": obj.get("name"),
151
- "enable": obj.get("enable"),
152
- "wallet_regex": obj.get("wallet_regex"),
153
- "priority": obj.get("priority"),
154
- "extra_id_exists": obj.get("extra_id_exists"),
155
- "extra_id_regex": obj.get("extra_id_regex"),
156
- "logo_url": obj.get("logo_url"),
157
- "track": obj.get("track"),
158
- "cg_id": obj.get("cg_id"),
159
- "is_maxlimit": obj.get("is_maxlimit"),
160
- "network": obj.get("network"),
161
- "smart_contract": obj.get("smart_contract"),
162
- "network_precision": obj.get("network_precision"),
163
- }
164
- )
165
- return _obj
@@ -1,91 +0,0 @@
1
- # coding: utf-8
2
-
3
- """
4
- Payment API
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, StrictFloat, StrictInt, StrictStr
21
- from typing import Any, ClassVar, Dict, List, Union
22
- from typing import Optional, Set
23
- from typing_extensions import Self
24
-
25
-
26
- class EstimatePriceReq(BaseModel):
27
- """
28
- Method for calculating the approximate price in cryptocurrency for a given value. This endpoint estimates the cryptocurrency amount for a given fiat currency value, or estimates crypto-to-crypto conversions. https://documenter.getpostman.com/view/7907941/2s93JusNJt#3c86a16e-94ad-4230-a470-4e833766a4c7
29
- """ # noqa: E501
30
-
31
- amount: Union[StrictFloat, StrictInt] = Field(description="Cost value")
32
- currency_from: StrictStr = Field(description="Fiat currency")
33
- currency_to: StrictStr = Field(description="Cryptocurrency")
34
- __properties: ClassVar[List[str]] = ["amount", "currency_from", "currency_to"]
35
-
36
- model_config = ConfigDict(
37
- populate_by_name=True,
38
- validate_assignment=True,
39
- protected_namespaces=(),
40
- )
41
-
42
- def to_str(self) -> str:
43
- """Returns the string representation of the model using alias"""
44
- return pprint.pformat(self.model_dump(by_alias=True))
45
-
46
- def to_json(self) -> str:
47
- """Returns the JSON representation of the model using alias"""
48
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
49
- return json.dumps(self.to_dict())
50
-
51
- @classmethod
52
- def from_json(cls, json_str: str) -> Optional[Self]:
53
- """Create an instance of EstimatePriceReq from a JSON string"""
54
- return cls.from_dict(json.loads(json_str))
55
-
56
- def to_dict(self) -> Dict[str, Any]:
57
- """Return the dictionary representation of the model using alias.
58
-
59
- This has the following differences from calling pydantic's
60
- `self.model_dump(by_alias=True)`:
61
-
62
- * `None` is only added to the output dict for nullable fields that
63
- were set at model initialization. Other fields with value `None`
64
- are ignored.
65
- """
66
- excluded_fields: Set[str] = set([])
67
-
68
- _dict = self.model_dump(
69
- by_alias=True,
70
- exclude=excluded_fields,
71
- exclude_none=True,
72
- )
73
- return _dict
74
-
75
- @classmethod
76
- def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
77
- """Create an instance of EstimatePriceReq from a dict"""
78
- if obj is None:
79
- return None
80
-
81
- if not isinstance(obj, dict):
82
- return cls.model_validate(obj)
83
-
84
- _obj = cls.model_validate(
85
- {
86
- "amount": obj.get("amount"),
87
- "currency_from": obj.get("currency_from"),
88
- "currency_to": obj.get("currency_to"),
89
- }
90
- )
91
- return _obj
@@ -1,102 +0,0 @@
1
- # coding: utf-8
2
-
3
- """
4
- Payment API
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, StrictFloat, StrictInt, StrictStr
21
- from typing import Any, ClassVar, Dict, List, Union
22
- from typing import Optional, Set
23
- from typing_extensions import Self
24
-
25
-
26
- class EstimatePriceRes(BaseModel):
27
- """
28
- Response for the estimate price calculation. Contains the source currency and amount, target currency, and the estimated conversion amount. https://documenter.getpostman.com/view/7907941/2s93JusNJt#3c86a16e-94ad-4230-a470-4e833766a4c7
29
- """ # noqa: E501
30
-
31
- currency_from: StrictStr = Field(description="Source currency")
32
- amount_from: Union[StrictFloat, StrictInt] = Field(
33
- description="Original amount in source currency"
34
- )
35
- currency_to: StrictStr = Field(description="Target cryptocurrency")
36
- estimated_amount: Union[StrictFloat, StrictInt] = Field(
37
- description="Estimated amount in target cryptocurrency"
38
- )
39
- __properties: ClassVar[List[str]] = [
40
- "currency_from",
41
- "amount_from",
42
- "currency_to",
43
- "estimated_amount",
44
- ]
45
-
46
- model_config = ConfigDict(
47
- populate_by_name=True,
48
- validate_assignment=True,
49
- protected_namespaces=(),
50
- )
51
-
52
- def to_str(self) -> str:
53
- """Returns the string representation of the model using alias"""
54
- return pprint.pformat(self.model_dump(by_alias=True))
55
-
56
- def to_json(self) -> str:
57
- """Returns the JSON representation of the model using alias"""
58
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
59
- return json.dumps(self.to_dict())
60
-
61
- @classmethod
62
- def from_json(cls, json_str: str) -> Optional[Self]:
63
- """Create an instance of EstimatePriceRes from a JSON string"""
64
- return cls.from_dict(json.loads(json_str))
65
-
66
- def to_dict(self) -> Dict[str, Any]:
67
- """Return the dictionary representation of the model using alias.
68
-
69
- This has the following differences from calling pydantic's
70
- `self.model_dump(by_alias=True)`:
71
-
72
- * `None` is only added to the output dict for nullable fields that
73
- were set at model initialization. Other fields with value `None`
74
- are ignored.
75
- """
76
- excluded_fields: Set[str] = set([])
77
-
78
- _dict = self.model_dump(
79
- by_alias=True,
80
- exclude=excluded_fields,
81
- exclude_none=True,
82
- )
83
- return _dict
84
-
85
- @classmethod
86
- def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
87
- """Create an instance of EstimatePriceRes from a dict"""
88
- if obj is None:
89
- return None
90
-
91
- if not isinstance(obj, dict):
92
- return cls.model_validate(obj)
93
-
94
- _obj = cls.model_validate(
95
- {
96
- "currency_from": obj.get("currency_from"),
97
- "amount_from": obj.get("amount_from"),
98
- "currency_to": obj.get("currency_to"),
99
- "estimated_amount": obj.get("estimated_amount"),
100
- }
101
- )
102
- return _obj
@@ -1,99 +0,0 @@
1
- # coding: utf-8
2
-
3
- """
4
- Payment API
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
21
- from typing import Any, ClassVar, Dict, List
22
- from crypticorn.pay.client.models.currency import Currency
23
- from typing import Optional, Set
24
- from typing_extensions import Self
25
-
26
-
27
- class GetCurrenciesRes(BaseModel):
28
- """
29
- Response containing list of available cryptocurrencies.
30
- """ # noqa: E501
31
-
32
- currencies: List[Currency] = Field(description="List of supported cryptocurrencies")
33
- __properties: ClassVar[List[str]] = ["currencies"]
34
-
35
- model_config = ConfigDict(
36
- populate_by_name=True,
37
- validate_assignment=True,
38
- protected_namespaces=(),
39
- )
40
-
41
- def to_str(self) -> str:
42
- """Returns the string representation of the model using alias"""
43
- return pprint.pformat(self.model_dump(by_alias=True))
44
-
45
- def to_json(self) -> str:
46
- """Returns the JSON representation of the model using alias"""
47
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
48
- return json.dumps(self.to_dict())
49
-
50
- @classmethod
51
- def from_json(cls, json_str: str) -> Optional[Self]:
52
- """Create an instance of GetCurrenciesRes from a JSON string"""
53
- return cls.from_dict(json.loads(json_str))
54
-
55
- def to_dict(self) -> Dict[str, Any]:
56
- """Return the dictionary representation of the model using alias.
57
-
58
- This has the following differences from calling pydantic's
59
- `self.model_dump(by_alias=True)`:
60
-
61
- * `None` is only added to the output dict for nullable fields that
62
- were set at model initialization. Other fields with value `None`
63
- are ignored.
64
- """
65
- excluded_fields: Set[str] = set([])
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 currencies (list)
73
- _items = []
74
- if self.currencies:
75
- for _item_currencies in self.currencies:
76
- if _item_currencies:
77
- _items.append(_item_currencies.to_dict())
78
- _dict["currencies"] = _items
79
- return _dict
80
-
81
- @classmethod
82
- def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
83
- """Create an instance of GetCurrenciesRes 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
- {
92
- "currencies": (
93
- [Currency.from_dict(_item) for _item in obj["currencies"]]
94
- if obj.get("currencies") is not None
95
- else None
96
- )
97
- }
98
- )
99
- return _obj
@@ -1,222 +0,0 @@
1
- # coding: utf-8
2
-
3
- """
4
- Payment API
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, StrictFloat, StrictInt, StrictStr
21
- from typing import Any, ClassVar, Dict, List, Optional, Union
22
- from typing import Optional, Set
23
- from typing_extensions import Self
24
-
25
-
26
- class GetPaymentStatusRes(BaseModel):
27
- """
28
- Response model for the payment status.
29
- """ # noqa: E501
30
-
31
- payment_id: StrictInt = Field(description="Unique payment identifier")
32
- invoice_id: Optional[StrictInt] = None
33
- payment_status: StrictStr = Field(
34
- description="Current payment status (waiting, confirming, confirmed, sending, partially_paid, finished, failed, refunded, expired)"
35
- )
36
- pay_address: StrictStr = Field(description="Payment destination address")
37
- payin_extra_id: Optional[StrictStr] = None
38
- price_amount: Union[StrictFloat, StrictInt] = Field(
39
- description="Original price amount"
40
- )
41
- price_currency: StrictStr = Field(description="Original price currency")
42
- pay_amount: Union[StrictFloat, StrictInt] = Field(description="Amount to pay")
43
- actually_paid: Union[StrictFloat, StrictInt] = Field(
44
- description="Actually paid amount"
45
- )
46
- pay_currency: StrictStr = Field(description="Payment currency")
47
- order_id: Optional[StrictStr] = None
48
- order_description: Optional[StrictStr] = None
49
- purchase_id: Optional[StrictInt] = None
50
- outcome_amount: Optional[Union[StrictFloat, StrictInt]] = None
51
- outcome_currency: Optional[StrictStr] = None
52
- payout_hash: Optional[StrictStr] = None
53
- payin_hash: Optional[StrictStr] = None
54
- created_at: StrictStr = Field(description="Payment creation timestamp")
55
- updated_at: StrictStr = Field(description="Payment last update timestamp")
56
- burning_percent: Optional[StrictStr] = None
57
- type: StrictStr = Field(description="Type of payment (e.g., crypto2crypto)")
58
- payment_extra_ids: Optional[List[StrictInt]] = None
59
- __properties: ClassVar[List[str]] = [
60
- "payment_id",
61
- "invoice_id",
62
- "payment_status",
63
- "pay_address",
64
- "payin_extra_id",
65
- "price_amount",
66
- "price_currency",
67
- "pay_amount",
68
- "actually_paid",
69
- "pay_currency",
70
- "order_id",
71
- "order_description",
72
- "purchase_id",
73
- "outcome_amount",
74
- "outcome_currency",
75
- "payout_hash",
76
- "payin_hash",
77
- "created_at",
78
- "updated_at",
79
- "burning_percent",
80
- "type",
81
- "payment_extra_ids",
82
- ]
83
-
84
- model_config = ConfigDict(
85
- populate_by_name=True,
86
- validate_assignment=True,
87
- protected_namespaces=(),
88
- )
89
-
90
- def to_str(self) -> str:
91
- """Returns the string representation of the model using alias"""
92
- return pprint.pformat(self.model_dump(by_alias=True))
93
-
94
- def to_json(self) -> str:
95
- """Returns the JSON representation of the model using alias"""
96
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
97
- return json.dumps(self.to_dict())
98
-
99
- @classmethod
100
- def from_json(cls, json_str: str) -> Optional[Self]:
101
- """Create an instance of GetPaymentStatusRes from a JSON string"""
102
- return cls.from_dict(json.loads(json_str))
103
-
104
- def to_dict(self) -> Dict[str, Any]:
105
- """Return the dictionary representation of the model using alias.
106
-
107
- This has the following differences from calling pydantic's
108
- `self.model_dump(by_alias=True)`:
109
-
110
- * `None` is only added to the output dict for nullable fields that
111
- were set at model initialization. Other fields with value `None`
112
- are ignored.
113
- """
114
- excluded_fields: Set[str] = set([])
115
-
116
- _dict = self.model_dump(
117
- by_alias=True,
118
- exclude=excluded_fields,
119
- exclude_none=True,
120
- )
121
- # set to None if invoice_id (nullable) is None
122
- # and model_fields_set contains the field
123
- if self.invoice_id is None and "invoice_id" in self.model_fields_set:
124
- _dict["invoice_id"] = None
125
-
126
- # set to None if payin_extra_id (nullable) is None
127
- # and model_fields_set contains the field
128
- if self.payin_extra_id is None and "payin_extra_id" in self.model_fields_set:
129
- _dict["payin_extra_id"] = None
130
-
131
- # set to None if order_id (nullable) is None
132
- # and model_fields_set contains the field
133
- if self.order_id is None and "order_id" in self.model_fields_set:
134
- _dict["order_id"] = None
135
-
136
- # set to None if order_description (nullable) is None
137
- # and model_fields_set contains the field
138
- if (
139
- self.order_description is None
140
- and "order_description" in self.model_fields_set
141
- ):
142
- _dict["order_description"] = None
143
-
144
- # set to None if purchase_id (nullable) is None
145
- # and model_fields_set contains the field
146
- if self.purchase_id is None and "purchase_id" in self.model_fields_set:
147
- _dict["purchase_id"] = None
148
-
149
- # set to None if outcome_amount (nullable) is None
150
- # and model_fields_set contains the field
151
- if self.outcome_amount is None and "outcome_amount" in self.model_fields_set:
152
- _dict["outcome_amount"] = None
153
-
154
- # set to None if outcome_currency (nullable) is None
155
- # and model_fields_set contains the field
156
- if (
157
- self.outcome_currency is None
158
- and "outcome_currency" in self.model_fields_set
159
- ):
160
- _dict["outcome_currency"] = None
161
-
162
- # set to None if payout_hash (nullable) is None
163
- # and model_fields_set contains the field
164
- if self.payout_hash is None and "payout_hash" in self.model_fields_set:
165
- _dict["payout_hash"] = None
166
-
167
- # set to None if payin_hash (nullable) is None
168
- # and model_fields_set contains the field
169
- if self.payin_hash is None and "payin_hash" in self.model_fields_set:
170
- _dict["payin_hash"] = None
171
-
172
- # set to None if burning_percent (nullable) is None
173
- # and model_fields_set contains the field
174
- if self.burning_percent is None and "burning_percent" in self.model_fields_set:
175
- _dict["burning_percent"] = None
176
-
177
- # set to None if payment_extra_ids (nullable) is None
178
- # and model_fields_set contains the field
179
- if (
180
- self.payment_extra_ids is None
181
- and "payment_extra_ids" in self.model_fields_set
182
- ):
183
- _dict["payment_extra_ids"] = None
184
-
185
- return _dict
186
-
187
- @classmethod
188
- def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
189
- """Create an instance of GetPaymentStatusRes from a dict"""
190
- if obj is None:
191
- return None
192
-
193
- if not isinstance(obj, dict):
194
- return cls.model_validate(obj)
195
-
196
- _obj = cls.model_validate(
197
- {
198
- "payment_id": obj.get("payment_id"),
199
- "invoice_id": obj.get("invoice_id"),
200
- "payment_status": obj.get("payment_status"),
201
- "pay_address": obj.get("pay_address"),
202
- "payin_extra_id": obj.get("payin_extra_id"),
203
- "price_amount": obj.get("price_amount"),
204
- "price_currency": obj.get("price_currency"),
205
- "pay_amount": obj.get("pay_amount"),
206
- "actually_paid": obj.get("actually_paid"),
207
- "pay_currency": obj.get("pay_currency"),
208
- "order_id": obj.get("order_id"),
209
- "order_description": obj.get("order_description"),
210
- "purchase_id": obj.get("purchase_id"),
211
- "outcome_amount": obj.get("outcome_amount"),
212
- "outcome_currency": obj.get("outcome_currency"),
213
- "payout_hash": obj.get("payout_hash"),
214
- "payin_hash": obj.get("payin_hash"),
215
- "created_at": obj.get("created_at"),
216
- "updated_at": obj.get("updated_at"),
217
- "burning_percent": obj.get("burning_percent"),
218
- "type": obj.get("type"),
219
- "payment_extra_ids": obj.get("payment_extra_ids"),
220
- }
221
- )
222
- return _obj