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,181 +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 crypticorn.pay.client.models.now_fee_structure import NowFeeStructure
23
- from crypticorn.pay.client.models.now_payment_status import NowPaymentStatus
24
- from typing import Optional, Set
25
- from typing_extensions import Self
26
-
27
-
28
- class NowWebhookPayload(BaseModel):
29
- """
30
- Model for NOWPayments webhook (IPN) payload.
31
- """ # noqa: E501
32
-
33
- actually_paid: Union[StrictFloat, StrictInt] = Field(
34
- description="Actually paid amount"
35
- )
36
- actually_paid_at_fiat: Union[StrictFloat, StrictInt] = Field(
37
- description="Actually paid amount in fiat currency"
38
- )
39
- fee: NowFeeStructure
40
- invoice_id: StrictInt = Field(description="Associated invoice ID")
41
- order_description: StrictStr = Field(description="Order description")
42
- order_id: StrictStr = Field(description="Internal order ID")
43
- outcome_amount: Union[StrictFloat, StrictInt] = Field(description="Outcome amount")
44
- outcome_currency: StrictStr = Field(description="Outcome currency")
45
- parent_payment_id: Optional[StrictInt] = None
46
- pay_address: StrictStr = Field(description="Payment destination address")
47
- pay_amount: Union[StrictFloat, StrictInt] = Field(description="Amount to pay")
48
- pay_currency: StrictStr = Field(description="Payment currency")
49
- payment_id: StrictInt = Field(description="Unique payment identifier")
50
- payment_status: NowPaymentStatus = Field(description="Current payment status")
51
- price_amount: Union[StrictFloat, StrictInt] = Field(
52
- description="Original price amount"
53
- )
54
- price_currency: StrictStr = Field(description="Original price currency")
55
- purchase_id: StrictStr = Field(description="Purchase ID")
56
- updated_at: StrictInt = Field(
57
- description="Payment last update timestamp in milliseconds"
58
- )
59
- additional_properties: Dict[str, Any] = {}
60
- __properties: ClassVar[List[str]] = [
61
- "actually_paid",
62
- "actually_paid_at_fiat",
63
- "fee",
64
- "invoice_id",
65
- "order_description",
66
- "order_id",
67
- "outcome_amount",
68
- "outcome_currency",
69
- "parent_payment_id",
70
- "pay_address",
71
- "pay_amount",
72
- "pay_currency",
73
- "payment_id",
74
- "payment_status",
75
- "price_amount",
76
- "price_currency",
77
- "purchase_id",
78
- "updated_at",
79
- ]
80
-
81
- model_config = ConfigDict(
82
- populate_by_name=True,
83
- validate_assignment=True,
84
- protected_namespaces=(),
85
- )
86
-
87
- def to_str(self) -> str:
88
- """Returns the string representation of the model using alias"""
89
- return pprint.pformat(self.model_dump(by_alias=True))
90
-
91
- def to_json(self) -> str:
92
- """Returns the JSON representation of the model using alias"""
93
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
94
- return json.dumps(self.to_dict())
95
-
96
- @classmethod
97
- def from_json(cls, json_str: str) -> Optional[Self]:
98
- """Create an instance of NowWebhookPayload from a JSON string"""
99
- return cls.from_dict(json.loads(json_str))
100
-
101
- def to_dict(self) -> Dict[str, Any]:
102
- """Return the dictionary representation of the model using alias.
103
-
104
- This has the following differences from calling pydantic's
105
- `self.model_dump(by_alias=True)`:
106
-
107
- * `None` is only added to the output dict for nullable fields that
108
- were set at model initialization. Other fields with value `None`
109
- are ignored.
110
- * Fields in `self.additional_properties` are added to the output dict.
111
- """
112
- excluded_fields: Set[str] = set(
113
- [
114
- "additional_properties",
115
- ]
116
- )
117
-
118
- _dict = self.model_dump(
119
- by_alias=True,
120
- exclude=excluded_fields,
121
- exclude_none=True,
122
- )
123
- # override the default output from pydantic by calling `to_dict()` of fee
124
- if self.fee:
125
- _dict["fee"] = self.fee.to_dict()
126
- # puts key-value pairs in additional_properties in the top level
127
- if self.additional_properties is not None:
128
- for _key, _value in self.additional_properties.items():
129
- _dict[_key] = _value
130
-
131
- # set to None if parent_payment_id (nullable) is None
132
- # and model_fields_set contains the field
133
- if (
134
- self.parent_payment_id is None
135
- and "parent_payment_id" in self.model_fields_set
136
- ):
137
- _dict["parent_payment_id"] = None
138
-
139
- return _dict
140
-
141
- @classmethod
142
- def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
143
- """Create an instance of NowWebhookPayload from a dict"""
144
- if obj is None:
145
- return None
146
-
147
- if not isinstance(obj, dict):
148
- return cls.model_validate(obj)
149
-
150
- _obj = cls.model_validate(
151
- {
152
- "actually_paid": obj.get("actually_paid"),
153
- "actually_paid_at_fiat": obj.get("actually_paid_at_fiat"),
154
- "fee": (
155
- NowFeeStructure.from_dict(obj["fee"])
156
- if obj.get("fee") is not None
157
- else None
158
- ),
159
- "invoice_id": obj.get("invoice_id"),
160
- "order_description": obj.get("order_description"),
161
- "order_id": obj.get("order_id"),
162
- "outcome_amount": obj.get("outcome_amount"),
163
- "outcome_currency": obj.get("outcome_currency"),
164
- "parent_payment_id": obj.get("parent_payment_id"),
165
- "pay_address": obj.get("pay_address"),
166
- "pay_amount": obj.get("pay_amount"),
167
- "pay_currency": obj.get("pay_currency"),
168
- "payment_id": obj.get("payment_id"),
169
- "payment_status": obj.get("payment_status"),
170
- "price_amount": obj.get("price_amount"),
171
- "price_currency": obj.get("price_currency"),
172
- "purchase_id": obj.get("purchase_id"),
173
- "updated_at": obj.get("updated_at"),
174
- }
175
- )
176
- # store additional fields in additional_properties
177
- for _key in obj.keys():
178
- if _key not in cls.__properties:
179
- _obj.additional_properties[_key] = obj.get(_key)
180
-
181
- return _obj
@@ -1,150 +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 (
21
- BaseModel,
22
- ConfigDict,
23
- StrictBool,
24
- StrictFloat,
25
- StrictInt,
26
- StrictStr,
27
- )
28
- from typing import Any, ClassVar, Dict, List, Optional, Union
29
- from crypticorn.pay.client.models.scope import Scope
30
- from typing import Optional, Set
31
- from typing_extensions import Self
32
-
33
-
34
- class PartialProductUpdateModel(BaseModel):
35
- """
36
- PartialProductUpdateModel
37
- """ # noqa: E501
38
-
39
- id: Optional[StrictStr] = None
40
- name: Optional[StrictStr] = None
41
- price: Optional[Union[StrictFloat, StrictInt]] = None
42
- scopes: Optional[List[Scope]] = None
43
- duration: Optional[StrictInt] = None
44
- description: Optional[StrictStr] = None
45
- is_active: Optional[StrictBool] = None
46
- __properties: ClassVar[List[str]] = [
47
- "id",
48
- "name",
49
- "price",
50
- "scopes",
51
- "duration",
52
- "description",
53
- "is_active",
54
- ]
55
-
56
- model_config = ConfigDict(
57
- populate_by_name=True,
58
- validate_assignment=True,
59
- protected_namespaces=(),
60
- )
61
-
62
- def to_str(self) -> str:
63
- """Returns the string representation of the model using alias"""
64
- return pprint.pformat(self.model_dump(by_alias=True))
65
-
66
- def to_json(self) -> str:
67
- """Returns the JSON representation of the model using alias"""
68
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
69
- return json.dumps(self.to_dict())
70
-
71
- @classmethod
72
- def from_json(cls, json_str: str) -> Optional[Self]:
73
- """Create an instance of PartialProductUpdateModel from a JSON string"""
74
- return cls.from_dict(json.loads(json_str))
75
-
76
- def to_dict(self) -> Dict[str, Any]:
77
- """Return the dictionary representation of the model using alias.
78
-
79
- This has the following differences from calling pydantic's
80
- `self.model_dump(by_alias=True)`:
81
-
82
- * `None` is only added to the output dict for nullable fields that
83
- were set at model initialization. Other fields with value `None`
84
- are ignored.
85
- """
86
- excluded_fields: Set[str] = set([])
87
-
88
- _dict = self.model_dump(
89
- by_alias=True,
90
- exclude=excluded_fields,
91
- exclude_none=True,
92
- )
93
- # set to None if id (nullable) is None
94
- # and model_fields_set contains the field
95
- if self.id is None and "id" in self.model_fields_set:
96
- _dict["id"] = None
97
-
98
- # set to None if name (nullable) is None
99
- # and model_fields_set contains the field
100
- if self.name is None and "name" in self.model_fields_set:
101
- _dict["name"] = None
102
-
103
- # set to None if price (nullable) is None
104
- # and model_fields_set contains the field
105
- if self.price is None and "price" in self.model_fields_set:
106
- _dict["price"] = None
107
-
108
- # set to None if scopes (nullable) is None
109
- # and model_fields_set contains the field
110
- if self.scopes is None and "scopes" in self.model_fields_set:
111
- _dict["scopes"] = None
112
-
113
- # set to None if duration (nullable) is None
114
- # and model_fields_set contains the field
115
- if self.duration is None and "duration" in self.model_fields_set:
116
- _dict["duration"] = None
117
-
118
- # set to None if description (nullable) is None
119
- # and model_fields_set contains the field
120
- if self.description is None and "description" in self.model_fields_set:
121
- _dict["description"] = None
122
-
123
- # set to None if is_active (nullable) is None
124
- # and model_fields_set contains the field
125
- if self.is_active is None and "is_active" in self.model_fields_set:
126
- _dict["is_active"] = None
127
-
128
- return _dict
129
-
130
- @classmethod
131
- def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
132
- """Create an instance of PartialProductUpdateModel from a dict"""
133
- if obj is None:
134
- return None
135
-
136
- if not isinstance(obj, dict):
137
- return cls.model_validate(obj)
138
-
139
- _obj = cls.model_validate(
140
- {
141
- "id": obj.get("id"),
142
- "name": obj.get("name"),
143
- "price": obj.get("price"),
144
- "scopes": obj.get("scopes"),
145
- "duration": obj.get("duration"),
146
- "description": obj.get("description"),
147
- "is_active": obj.get("is_active"),
148
- }
149
- )
150
- return _obj
@@ -1,87 +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, 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 Product(BaseModel):
27
- """
28
- Product
29
- """ # noqa: E501
30
-
31
- id: StrictStr
32
- name: StrictStr
33
- price: Union[StrictFloat, StrictInt]
34
- __properties: ClassVar[List[str]] = ["id", "name", "price"]
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 Product 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 Product 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
- {"id": obj.get("id"), "name": obj.get("name"), "price": obj.get("price")}
86
- )
87
- return _obj
@@ -1,128 +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 (
21
- BaseModel,
22
- ConfigDict,
23
- Field,
24
- StrictBool,
25
- StrictFloat,
26
- StrictInt,
27
- StrictStr,
28
- )
29
- from typing import Any, ClassVar, Dict, List, Optional, Union
30
- from crypticorn.pay.client.models.scope import Scope
31
- from typing import Optional, Set
32
- from typing_extensions import Self
33
-
34
-
35
- class ProductModel(BaseModel):
36
- """
37
- ProductModel
38
- """ # noqa: E501
39
-
40
- id: Optional[StrictStr] = None
41
- name: StrictStr = Field(description="Product name")
42
- price: Union[StrictFloat, StrictInt] = Field(description="Product price")
43
- scopes: Optional[List[Scope]] = None
44
- duration: StrictInt = Field(
45
- description="Product duration in days. 0 means unlimited."
46
- )
47
- description: StrictStr = Field(description="Product description")
48
- is_active: StrictBool = Field(description="Product is active")
49
- __properties: ClassVar[List[str]] = [
50
- "id",
51
- "name",
52
- "price",
53
- "scopes",
54
- "duration",
55
- "description",
56
- "is_active",
57
- ]
58
-
59
- model_config = ConfigDict(
60
- populate_by_name=True,
61
- validate_assignment=True,
62
- protected_namespaces=(),
63
- )
64
-
65
- def to_str(self) -> str:
66
- """Returns the string representation of the model using alias"""
67
- return pprint.pformat(self.model_dump(by_alias=True))
68
-
69
- def to_json(self) -> str:
70
- """Returns the JSON representation of the model using alias"""
71
- # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
72
- return json.dumps(self.to_dict())
73
-
74
- @classmethod
75
- def from_json(cls, json_str: str) -> Optional[Self]:
76
- """Create an instance of ProductModel from a JSON string"""
77
- return cls.from_dict(json.loads(json_str))
78
-
79
- def to_dict(self) -> Dict[str, Any]:
80
- """Return the dictionary representation of the model using alias.
81
-
82
- This has the following differences from calling pydantic's
83
- `self.model_dump(by_alias=True)`:
84
-
85
- * `None` is only added to the output dict for nullable fields that
86
- were set at model initialization. Other fields with value `None`
87
- are ignored.
88
- """
89
- excluded_fields: Set[str] = set([])
90
-
91
- _dict = self.model_dump(
92
- by_alias=True,
93
- exclude=excluded_fields,
94
- exclude_none=True,
95
- )
96
- # set to None if id (nullable) is None
97
- # and model_fields_set contains the field
98
- if self.id is None and "id" in self.model_fields_set:
99
- _dict["id"] = None
100
-
101
- # set to None if scopes (nullable) is None
102
- # and model_fields_set contains the field
103
- if self.scopes is None and "scopes" in self.model_fields_set:
104
- _dict["scopes"] = None
105
-
106
- return _dict
107
-
108
- @classmethod
109
- def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
110
- """Create an instance of ProductModel from a dict"""
111
- if obj is None:
112
- return None
113
-
114
- if not isinstance(obj, dict):
115
- return cls.model_validate(obj)
116
-
117
- _obj = cls.model_validate(
118
- {
119
- "id": obj.get("id"),
120
- "name": obj.get("name"),
121
- "price": obj.get("price"),
122
- "scopes": obj.get("scopes"),
123
- "duration": obj.get("duration"),
124
- "description": obj.get("description"),
125
- "is_active": obj.get("is_active"),
126
- }
127
- )
128
- return _obj
@@ -1,108 +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, 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 ProductSubsModel(BaseModel):
27
- """
28
- ProductSubsModel
29
- """ # noqa: E501
30
-
31
- id: Optional[StrictStr] = None
32
- user_id: StrictStr = Field(description="User ID")
33
- product_id: StrictStr = Field(description="Product ID")
34
- access_from: StrictInt = Field(description="Access from timestamp in milliseconds")
35
- access_until: StrictInt = Field(
36
- description="Access until timestamp in milliseconds. 0 means unlimited."
37
- )
38
- __properties: ClassVar[List[str]] = [
39
- "id",
40
- "user_id",
41
- "product_id",
42
- "access_from",
43
- "access_until",
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 ProductSubsModel 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
- # set to None if id (nullable) is None
84
- # and model_fields_set contains the field
85
- if self.id is None and "id" in self.model_fields_set:
86
- _dict["id"] = None
87
-
88
- return _dict
89
-
90
- @classmethod
91
- def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
92
- """Create an instance of ProductSubsModel from a dict"""
93
- if obj is None:
94
- return None
95
-
96
- if not isinstance(obj, dict):
97
- return cls.model_validate(obj)
98
-
99
- _obj = cls.model_validate(
100
- {
101
- "id": obj.get("id"),
102
- "user_id": obj.get("user_id"),
103
- "product_id": obj.get("product_id"),
104
- "access_from": obj.get("access_from"),
105
- "access_until": obj.get("access_until"),
106
- }
107
- )
108
- return _obj