lighter-sdk 0.1.0__py3-none-any.whl

Sign up to get free protection for your applications and to get access to all the features.
Files changed (125) hide show
  1. lighter/__init__.py +140 -0
  2. lighter/api/__init__.py +11 -0
  3. lighter/api/account_api.py +2371 -0
  4. lighter/api/block_api.py +863 -0
  5. lighter/api/candlestick_api.py +718 -0
  6. lighter/api/info_api.py +282 -0
  7. lighter/api/order_api.py +2734 -0
  8. lighter/api/root_api.py +529 -0
  9. lighter/api/transaction_api.py +3525 -0
  10. lighter/api_client.py +784 -0
  11. lighter/api_response.py +21 -0
  12. lighter/configuration.py +475 -0
  13. lighter/exceptions.py +199 -0
  14. lighter/models/__init__.py +112 -0
  15. lighter/models/account.py +110 -0
  16. lighter/models/account_api_keys.py +104 -0
  17. lighter/models/account_market_stats.py +98 -0
  18. lighter/models/account_metadata.py +94 -0
  19. lighter/models/account_pn_l.py +106 -0
  20. lighter/models/account_position.py +112 -0
  21. lighter/models/account_stats.py +102 -0
  22. lighter/models/accounts.py +106 -0
  23. lighter/models/api_key.py +98 -0
  24. lighter/models/block.py +124 -0
  25. lighter/models/blocks.py +106 -0
  26. lighter/models/bridge_supported_network.py +96 -0
  27. lighter/models/candlestick.py +106 -0
  28. lighter/models/candlesticks.py +106 -0
  29. lighter/models/contract_address.py +94 -0
  30. lighter/models/current_height.py +96 -0
  31. lighter/models/cursor.py +92 -0
  32. lighter/models/deposit_history.py +106 -0
  33. lighter/models/deposit_history_item.py +105 -0
  34. lighter/models/detailed_account.py +152 -0
  35. lighter/models/detailed_accounts.py +106 -0
  36. lighter/models/detailed_candlestick.py +108 -0
  37. lighter/models/enriched_tx.py +129 -0
  38. lighter/models/exchange_stats.py +110 -0
  39. lighter/models/fee_bucket.py +96 -0
  40. lighter/models/funding.py +98 -0
  41. lighter/models/fundings.py +106 -0
  42. lighter/models/is_whitelisted.py +98 -0
  43. lighter/models/l1_provider_info.py +98 -0
  44. lighter/models/layer2_basic_info.py +100 -0
  45. lighter/models/liquidation.py +100 -0
  46. lighter/models/market_info.py +116 -0
  47. lighter/models/next_nonce.py +96 -0
  48. lighter/models/order.py +159 -0
  49. lighter/models/order_book.py +119 -0
  50. lighter/models/order_book_depth.py +115 -0
  51. lighter/models/order_book_detail.py +151 -0
  52. lighter/models/order_book_details.py +104 -0
  53. lighter/models/order_book_orders.py +117 -0
  54. lighter/models/order_book_stats.py +102 -0
  55. lighter/models/order_books.py +104 -0
  56. lighter/models/orders.py +106 -0
  57. lighter/models/pn_l_entry.py +94 -0
  58. lighter/models/position_funding.py +111 -0
  59. lighter/models/price_level.py +94 -0
  60. lighter/models/public_pool.py +128 -0
  61. lighter/models/public_pool_info.py +100 -0
  62. lighter/models/public_pool_share.py +96 -0
  63. lighter/models/public_pools.py +106 -0
  64. lighter/models/req_get_account.py +101 -0
  65. lighter/models/req_get_account_active_orders.py +96 -0
  66. lighter/models/req_get_account_api_keys.py +94 -0
  67. lighter/models/req_get_account_by_l1_address.py +92 -0
  68. lighter/models/req_get_account_inactive_orders.py +103 -0
  69. lighter/models/req_get_account_orders.py +99 -0
  70. lighter/models/req_get_account_pending_txs.py +106 -0
  71. lighter/models/req_get_account_pn_l.py +118 -0
  72. lighter/models/req_get_account_txs.py +111 -0
  73. lighter/models/req_get_block.py +101 -0
  74. lighter/models/req_get_block_txs.py +101 -0
  75. lighter/models/req_get_by_account.py +101 -0
  76. lighter/models/req_get_candlesticks.py +109 -0
  77. lighter/models/req_get_deposit_history.py +106 -0
  78. lighter/models/req_get_fee_bucket.py +92 -0
  79. lighter/models/req_get_fundings.py +107 -0
  80. lighter/models/req_get_l1_tx.py +92 -0
  81. lighter/models/req_get_latest_deposit.py +92 -0
  82. lighter/models/req_get_next_nonce.py +94 -0
  83. lighter/models/req_get_order_book_details.py +92 -0
  84. lighter/models/req_get_order_book_orders.py +95 -0
  85. lighter/models/req_get_order_books.py +92 -0
  86. lighter/models/req_get_public_pools.py +109 -0
  87. lighter/models/req_get_range_with_cursor.py +95 -0
  88. lighter/models/req_get_range_with_index.py +95 -0
  89. lighter/models/req_get_range_with_index_sortable.py +107 -0
  90. lighter/models/req_get_recent_trades.py +95 -0
  91. lighter/models/req_get_trades.py +126 -0
  92. lighter/models/req_get_tx.py +101 -0
  93. lighter/models/req_get_withdraw_history.py +106 -0
  94. lighter/models/req_is_whitelisted.py +92 -0
  95. lighter/models/result_code.py +94 -0
  96. lighter/models/simple_order.py +102 -0
  97. lighter/models/status.py +94 -0
  98. lighter/models/sub_accounts.py +106 -0
  99. lighter/models/ticker.py +103 -0
  100. lighter/models/trade.py +125 -0
  101. lighter/models/trades.py +106 -0
  102. lighter/models/tx.py +121 -0
  103. lighter/models/tx_hash.py +96 -0
  104. lighter/models/tx_hashes.py +96 -0
  105. lighter/models/txs.py +104 -0
  106. lighter/models/validator_info.py +94 -0
  107. lighter/models/withdraw_history.py +110 -0
  108. lighter/models/withdraw_history_cursor.py +94 -0
  109. lighter/models/withdraw_history_item.py +114 -0
  110. lighter/models/zk_lighter_info.py +92 -0
  111. lighter/py.typed +0 -0
  112. lighter/rest.py +215 -0
  113. lighter/signer_client.py +440 -0
  114. lighter/signers/signer-amd64.so +0 -0
  115. lighter/signers/signer-arm64.dylib +0 -0
  116. lighter/transactions/__init__.py +3 -0
  117. lighter/transactions/cancel_order.py +27 -0
  118. lighter/transactions/create_order.py +33 -0
  119. lighter/transactions/withdraw.py +25 -0
  120. lighter/ws_client.py +160 -0
  121. lighter_sdk-0.1.0.dist-info/LICENSE +201 -0
  122. lighter_sdk-0.1.0.dist-info/METADATA +26 -0
  123. lighter_sdk-0.1.0.dist-info/RECORD +125 -0
  124. lighter_sdk-0.1.0.dist-info/WHEEL +5 -0
  125. lighter_sdk-0.1.0.dist-info/top_level.txt +1 -0
@@ -0,0 +1,94 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+
5
+
6
+ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
7
+
8
+ The version of the OpenAPI document:
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, StrictInt
21
+ from typing import Any, ClassVar, Dict, List
22
+ from typing import Optional, Set
23
+ from typing_extensions import Self
24
+
25
+ class ReqGetNextNonce(BaseModel):
26
+ """
27
+ ReqGetNextNonce
28
+ """ # noqa: E501
29
+ account_index: StrictInt
30
+ api_key_index: StrictInt
31
+ __properties: ClassVar[List[str]] = ["account_index", "api_key_index"]
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 ReqGetNextNonce 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
+ return _dict
73
+
74
+ @classmethod
75
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
76
+ """Create an instance of ReqGetNextNonce from a dict"""
77
+ if obj is None:
78
+ return None
79
+
80
+ if not isinstance(obj, dict):
81
+ return cls.model_validate(obj)
82
+
83
+ # raise errors for additional fields in the input
84
+ for _key in obj.keys():
85
+ if _key not in cls.__properties:
86
+ raise ValueError("Error due to additional fields (not defined in ReqGetNextNonce) in the input: " + _key)
87
+
88
+ _obj = cls.model_validate({
89
+ "account_index": obj.get("account_index"),
90
+ "api_key_index": obj.get("api_key_index")
91
+ })
92
+ return _obj
93
+
94
+
@@ -0,0 +1,92 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+
5
+
6
+ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
7
+
8
+ The version of the OpenAPI document:
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, StrictInt
21
+ from typing import Any, ClassVar, Dict, List, Optional
22
+ from typing import Optional, Set
23
+ from typing_extensions import Self
24
+
25
+ class ReqGetOrderBookDetails(BaseModel):
26
+ """
27
+ ReqGetOrderBookDetails
28
+ """ # noqa: E501
29
+ market_id: Optional[StrictInt] = None
30
+ __properties: ClassVar[List[str]] = ["market_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 ReqGetOrderBookDetails 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 ReqGetOrderBookDetails 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
+ # raise errors for additional fields in the input
83
+ for _key in obj.keys():
84
+ if _key not in cls.__properties:
85
+ raise ValueError("Error due to additional fields (not defined in ReqGetOrderBookDetails) in the input: " + _key)
86
+
87
+ _obj = cls.model_validate({
88
+ "market_id": obj.get("market_id")
89
+ })
90
+ return _obj
91
+
92
+
@@ -0,0 +1,95 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+
5
+
6
+ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
7
+
8
+ The version of the OpenAPI document:
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_extensions import Annotated
23
+ from typing import Optional, Set
24
+ from typing_extensions import Self
25
+
26
+ class ReqGetOrderBookOrders(BaseModel):
27
+ """
28
+ ReqGetOrderBookOrders
29
+ """ # noqa: E501
30
+ market_id: StrictInt
31
+ limit: Annotated[int, Field(le=100, strict=True, ge=1)]
32
+ __properties: ClassVar[List[str]] = ["market_id", "limit"]
33
+
34
+ model_config = ConfigDict(
35
+ populate_by_name=True,
36
+ validate_assignment=True,
37
+ protected_namespaces=(),
38
+ )
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 ReqGetOrderBookOrders 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
+
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 ReqGetOrderBookOrders 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
+ # raise errors for additional fields in the input
85
+ for _key in obj.keys():
86
+ if _key not in cls.__properties:
87
+ raise ValueError("Error due to additional fields (not defined in ReqGetOrderBookOrders) in the input: " + _key)
88
+
89
+ _obj = cls.model_validate({
90
+ "market_id": obj.get("market_id"),
91
+ "limit": obj.get("limit")
92
+ })
93
+ return _obj
94
+
95
+
@@ -0,0 +1,92 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+
5
+
6
+ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
7
+
8
+ The version of the OpenAPI document:
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, StrictInt
21
+ from typing import Any, ClassVar, Dict, List, Optional
22
+ from typing import Optional, Set
23
+ from typing_extensions import Self
24
+
25
+ class ReqGetOrderBooks(BaseModel):
26
+ """
27
+ ReqGetOrderBooks
28
+ """ # noqa: E501
29
+ market_id: Optional[StrictInt] = None
30
+ __properties: ClassVar[List[str]] = ["market_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 ReqGetOrderBooks 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 ReqGetOrderBooks 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
+ # raise errors for additional fields in the input
83
+ for _key in obj.keys():
84
+ if _key not in cls.__properties:
85
+ raise ValueError("Error due to additional fields (not defined in ReqGetOrderBooks) in the input: " + _key)
86
+
87
+ _obj = cls.model_validate({
88
+ "market_id": obj.get("market_id")
89
+ })
90
+ return _obj
91
+
92
+
@@ -0,0 +1,109 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+
5
+
6
+ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
7
+
8
+ The version of the OpenAPI document:
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, field_validator
21
+ from typing import Any, ClassVar, Dict, List, Optional
22
+ from typing_extensions import Annotated
23
+ from typing import Optional, Set
24
+ from typing_extensions import Self
25
+
26
+ class ReqGetPublicPools(BaseModel):
27
+ """
28
+ ReqGetPublicPools
29
+ """ # noqa: E501
30
+ filter: Optional[StrictStr] = None
31
+ index: StrictInt
32
+ limit: Annotated[int, Field(le=100, strict=True, ge=1)]
33
+ account_index: Optional[StrictInt] = None
34
+ __properties: ClassVar[List[str]] = ["filter", "index", "limit", "account_index"]
35
+
36
+ @field_validator('filter')
37
+ def filter_validate_enum(cls, value):
38
+ """Validates the enum"""
39
+ if value is None:
40
+ return value
41
+
42
+ if value not in set(['all', 'user', 'protocol', 'account_index']):
43
+ raise ValueError("must be one of enum values ('all', 'user', 'protocol', 'account_index')")
44
+ return value
45
+
46
+ model_config = ConfigDict(
47
+ populate_by_name=True,
48
+ validate_assignment=True,
49
+ protected_namespaces=(),
50
+ )
51
+
52
+
53
+ def to_str(self) -> str:
54
+ """Returns the string representation of the model using alias"""
55
+ return pprint.pformat(self.model_dump(by_alias=True))
56
+
57
+ def to_json(self) -> str:
58
+ """Returns the JSON representation of the model using alias"""
59
+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
60
+ return json.dumps(self.to_dict())
61
+
62
+ @classmethod
63
+ def from_json(cls, json_str: str) -> Optional[Self]:
64
+ """Create an instance of ReqGetPublicPools from a JSON string"""
65
+ return cls.from_dict(json.loads(json_str))
66
+
67
+ def to_dict(self) -> Dict[str, Any]:
68
+ """Return the dictionary representation of the model using alias.
69
+
70
+ This has the following differences from calling pydantic's
71
+ `self.model_dump(by_alias=True)`:
72
+
73
+ * `None` is only added to the output dict for nullable fields that
74
+ were set at model initialization. Other fields with value `None`
75
+ are ignored.
76
+ """
77
+ excluded_fields: Set[str] = set([
78
+ ])
79
+
80
+ _dict = self.model_dump(
81
+ by_alias=True,
82
+ exclude=excluded_fields,
83
+ exclude_none=True,
84
+ )
85
+ return _dict
86
+
87
+ @classmethod
88
+ def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
89
+ """Create an instance of ReqGetPublicPools from a dict"""
90
+ if obj is None:
91
+ return None
92
+
93
+ if not isinstance(obj, dict):
94
+ return cls.model_validate(obj)
95
+
96
+ # raise errors for additional fields in the input
97
+ for _key in obj.keys():
98
+ if _key not in cls.__properties:
99
+ raise ValueError("Error due to additional fields (not defined in ReqGetPublicPools) in the input: " + _key)
100
+
101
+ _obj = cls.model_validate({
102
+ "filter": obj.get("filter"),
103
+ "index": obj.get("index"),
104
+ "limit": obj.get("limit"),
105
+ "account_index": obj.get("account_index")
106
+ })
107
+ return _obj
108
+
109
+
@@ -0,0 +1,95 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+
5
+
6
+ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
7
+
8
+ The version of the OpenAPI document:
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, Optional
22
+ from typing_extensions import Annotated
23
+ from typing import Optional, Set
24
+ from typing_extensions import Self
25
+
26
+ class ReqGetRangeWithCursor(BaseModel):
27
+ """
28
+ ReqGetRangeWithCursor
29
+ """ # noqa: E501
30
+ cursor: Optional[StrictStr] = None
31
+ limit: Annotated[int, Field(le=100, strict=True, ge=1)]
32
+ __properties: ClassVar[List[str]] = ["cursor", "limit"]
33
+
34
+ model_config = ConfigDict(
35
+ populate_by_name=True,
36
+ validate_assignment=True,
37
+ protected_namespaces=(),
38
+ )
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 ReqGetRangeWithCursor 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
+
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 ReqGetRangeWithCursor 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
+ # raise errors for additional fields in the input
85
+ for _key in obj.keys():
86
+ if _key not in cls.__properties:
87
+ raise ValueError("Error due to additional fields (not defined in ReqGetRangeWithCursor) in the input: " + _key)
88
+
89
+ _obj = cls.model_validate({
90
+ "cursor": obj.get("cursor"),
91
+ "limit": obj.get("limit")
92
+ })
93
+ return _obj
94
+
95
+
@@ -0,0 +1,95 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+
5
+
6
+ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
7
+
8
+ The version of the OpenAPI document:
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, Optional
22
+ from typing_extensions import Annotated
23
+ from typing import Optional, Set
24
+ from typing_extensions import Self
25
+
26
+ class ReqGetRangeWithIndex(BaseModel):
27
+ """
28
+ ReqGetRangeWithIndex
29
+ """ # noqa: E501
30
+ index: Optional[StrictInt] = None
31
+ limit: Annotated[int, Field(le=100, strict=True, ge=1)]
32
+ __properties: ClassVar[List[str]] = ["index", "limit"]
33
+
34
+ model_config = ConfigDict(
35
+ populate_by_name=True,
36
+ validate_assignment=True,
37
+ protected_namespaces=(),
38
+ )
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 ReqGetRangeWithIndex 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
+
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 ReqGetRangeWithIndex 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
+ # raise errors for additional fields in the input
85
+ for _key in obj.keys():
86
+ if _key not in cls.__properties:
87
+ raise ValueError("Error due to additional fields (not defined in ReqGetRangeWithIndex) in the input: " + _key)
88
+
89
+ _obj = cls.model_validate({
90
+ "index": obj.get("index"),
91
+ "limit": obj.get("limit")
92
+ })
93
+ return _obj
94
+
95
+