meshtrade 0.0.7__py3-none-any.whl → 0.0.10__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.
Potentially problematic release.
This version of meshtrade might be problematic. Click here for more details.
- buf/validate/validate_pb2.py +450 -0
- buf/validate/validate_pb2.pyi +627 -0
- meshtrade/common/__init__.py +28 -0
- meshtrade/common/config.py +30 -0
- meshtrade/common/grpc_client.py +202 -0
- meshtrade/compliance/client/v1/__init__.py +89 -0
- meshtrade/compliance/client/v1/client_pb2.py +2 -2
- meshtrade/compliance/client/v1/client_pb2_grpc.py +4 -0
- meshtrade/compliance/client/v1/company_pb2.py +2 -2
- meshtrade/compliance/client/v1/company_pb2_grpc.py +4 -0
- meshtrade/compliance/client/v1/company_representative_pb2.py +2 -2
- meshtrade/compliance/client/v1/company_representative_pb2_grpc.py +4 -0
- meshtrade/compliance/client/v1/company_representative_role_pb2.py +2 -2
- meshtrade/compliance/client/v1/company_representative_role_pb2_grpc.py +4 -0
- meshtrade/compliance/client/v1/fund_pb2.py +2 -2
- meshtrade/compliance/client/v1/fund_pb2_grpc.py +4 -0
- meshtrade/compliance/client/v1/identification_document_type_pb2.py +2 -2
- meshtrade/compliance/client/v1/identification_document_type_pb2_grpc.py +4 -0
- meshtrade/compliance/client/v1/industry_classification_pb2.py +2 -2
- meshtrade/compliance/client/v1/industry_classification_pb2_grpc.py +4 -0
- meshtrade/compliance/client/v1/natural_person_connection_type_pb2.py +2 -2
- meshtrade/compliance/client/v1/natural_person_connection_type_pb2_grpc.py +4 -0
- meshtrade/compliance/client/v1/natural_person_pb2.py +2 -2
- meshtrade/compliance/client/v1/natural_person_pb2_grpc.py +4 -0
- meshtrade/compliance/client/v1/pep_status_pb2.py +2 -2
- meshtrade/compliance/client/v1/pep_status_pb2_grpc.py +4 -0
- meshtrade/compliance/client/v1/service_meshpy.py +186 -0
- meshtrade/compliance/client/v1/service_options_meshpy.py +65 -0
- meshtrade/compliance/client/v1/service_pb2.py +20 -10
- meshtrade/compliance/client/v1/service_pb2.pyi +8 -0
- meshtrade/compliance/client/v1/service_pb2_grpc.py +192 -0
- meshtrade/compliance/client/v1/source_of_income_and_wealth_pb2.py +2 -2
- meshtrade/compliance/client/v1/source_of_income_and_wealth_pb2_grpc.py +4 -0
- meshtrade/compliance/client/v1/tax_residency_pb2.py +2 -2
- meshtrade/compliance/client/v1/tax_residency_pb2_grpc.py +4 -0
- meshtrade/compliance/client/v1/trust_pb2.py +2 -2
- meshtrade/compliance/client/v1/trust_pb2_grpc.py +4 -0
- meshtrade/compliance/client/v1/verification_status_pb2.py +2 -2
- meshtrade/compliance/client/v1/verification_status_pb2_grpc.py +4 -0
- meshtrade/iam/api_user/v1/__init__.py +99 -0
- meshtrade/iam/api_user/v1/api_credentials.py +156 -0
- meshtrade/iam/api_user/v1/api_credentials_pb2.py +42 -0
- meshtrade/iam/api_user/v1/api_credentials_pb2.pyi +14 -0
- meshtrade/iam/api_user/v1/api_credentials_pb2_grpc.py +4 -0
- meshtrade/iam/api_user/v1/api_user_pb2.py +48 -0
- meshtrade/iam/api_user/v1/api_user_pb2.pyi +49 -0
- meshtrade/iam/api_user/v1/api_user_pb2_grpc.py +4 -0
- meshtrade/iam/api_user/v1/service.py +58 -0
- meshtrade/iam/api_user/v1/service_meshpy.py +255 -0
- meshtrade/iam/api_user/v1/service_options_meshpy.py +65 -0
- meshtrade/iam/api_user/v1/service_pb2.py +77 -0
- meshtrade/iam/api_user/v1/service_pb2.pyi +63 -0
- meshtrade/iam/api_user/v1/service_pb2_grpc.py +458 -0
- meshtrade/iam/group/v1/__init__.py +63 -0
- meshtrade/iam/group/v1/group_pb2.py +2 -2
- meshtrade/iam/group/v1/group_pb2_grpc.py +4 -0
- meshtrade/iam/group/v1/service_meshpy.py +187 -0
- meshtrade/iam/group/v1/service_options_meshpy.py +65 -0
- meshtrade/iam/group/v1/service_pb2.py +22 -6
- meshtrade/iam/group/v1/service_pb2.pyi +29 -1
- meshtrade/iam/group/v1/service_pb2_grpc.py +170 -0
- meshtrade/iam/role/v1/__init__.py +44 -0
- meshtrade/iam/role/v1/role.py +23 -0
- meshtrade/iam/role/v1/role_pb2.py +40 -0
- meshtrade/{option/v1/auth_pb2.pyi → iam/role/v1/role_pb2.pyi} +16 -0
- meshtrade/iam/role/v1/role_pb2_grpc.py +4 -0
- meshtrade/iam/user/v1/__init__.py +53 -0
- meshtrade/iam/user/v1/service_meshpy.py +151 -0
- meshtrade/iam/user/v1/service_options_meshpy.py +65 -0
- meshtrade/iam/user/v1/service_pb2.py +51 -0
- meshtrade/iam/user/v1/service_pb2.pyi +19 -0
- meshtrade/iam/user/v1/service_pb2_grpc.py +82 -0
- meshtrade/{issuance_hub/instrument/v1/instrument_pb2.py → iam/user/v1/user_pb2.py} +7 -7
- meshtrade/iam/user/v1/user_pb2.pyi +15 -0
- meshtrade/iam/user/v1/user_pb2_grpc.py +4 -0
- meshtrade/ledger/transaction/v1/__init__.py +41 -0
- meshtrade/ledger/transaction/v1/transaction_action_pb2.py +2 -2
- meshtrade/ledger/transaction/v1/transaction_action_pb2_grpc.py +4 -0
- meshtrade/ledger/transaction/v1/transaction_state_pb2.py +2 -2
- meshtrade/ledger/transaction/v1/transaction_state_pb2_grpc.py +4 -0
- meshtrade/option/v1/__init__.py +39 -0
- meshtrade/option/v1/{service_type_pb2.py → method_type_pb2.py} +7 -7
- meshtrade/option/v1/method_type_pb2.pyi +17 -0
- meshtrade/option/v1/method_type_pb2_grpc.py +4 -0
- meshtrade/trading/limit_order/v1/__init__.py +53 -0
- meshtrade/trading/limit_order/v1/limit_order_pb2.py +2 -2
- meshtrade/trading/limit_order/v1/limit_order_pb2_grpc.py +4 -0
- meshtrade/trading/limit_order/v1/service_meshpy.py +151 -0
- meshtrade/trading/limit_order/v1/service_options_meshpy.py +65 -0
- meshtrade/trading/limit_order/v1/service_pb2.py +10 -6
- meshtrade/trading/limit_order/v1/service_pb2.pyi +2 -0
- meshtrade/trading/limit_order/v1/service_pb2_grpc.py +78 -0
- meshtrade/trading/market_order/v1/__init__.py +53 -0
- meshtrade/trading/{direct_order/v1/direct_order_pb2.py → market_order/v1/market_order_pb2.py} +7 -7
- meshtrade/{issuance_hub/instrument/v1/instrument_pb2.pyi → trading/market_order/v1/market_order_pb2.pyi} +1 -1
- meshtrade/trading/market_order/v1/market_order_pb2_grpc.py +4 -0
- meshtrade/trading/market_order/v1/service_meshpy.py +151 -0
- meshtrade/trading/market_order/v1/service_options_meshpy.py +65 -0
- meshtrade/trading/market_order/v1/service_pb2.py +44 -0
- meshtrade/trading/{spot → market_order}/v1/service_pb2.pyi +4 -2
- meshtrade/trading/market_order/v1/service_pb2_grpc.py +78 -0
- meshtrade/type/v1/__init__.py +120 -4
- meshtrade/type/v1/address_pb2.py +2 -2
- meshtrade/type/v1/address_pb2_grpc.py +4 -0
- meshtrade/type/v1/amount.py +2 -8
- meshtrade/type/v1/amount_pb2.py +2 -2
- meshtrade/type/v1/amount_pb2_grpc.py +4 -0
- meshtrade/type/v1/contact_details_pb2.py +2 -2
- meshtrade/type/v1/contact_details_pb2_grpc.py +4 -0
- meshtrade/type/v1/date.py +373 -0
- meshtrade/{trading/spot/v1/spot_pb2.py → type/v1/date_pb2.py} +7 -7
- meshtrade/type/v1/date_pb2.pyi +15 -0
- meshtrade/type/v1/date_pb2_grpc.py +4 -0
- meshtrade/type/v1/decimal_built_in_conversions.py +1 -1
- meshtrade/type/v1/decimal_pb2.py +2 -2
- meshtrade/type/v1/decimal_pb2_grpc.py +4 -0
- meshtrade/type/v1/ledger.py +2 -3
- meshtrade/type/v1/ledger_pb2.py +2 -2
- meshtrade/type/v1/ledger_pb2_grpc.py +4 -0
- meshtrade/type/v1/time_of_day.py +265 -0
- meshtrade/type/v1/time_of_day_pb2.py +37 -0
- meshtrade/type/v1/time_of_day_pb2.pyi +17 -0
- meshtrade/type/v1/time_of_day_pb2_grpc.py +4 -0
- meshtrade/type/v1/token_pb2.py +2 -2
- meshtrade/type/v1/token_pb2_grpc.py +4 -0
- meshtrade/wallet/account/v1/__init__.py +65 -0
- meshtrade/wallet/account/v1/account_pb2.py +2 -2
- meshtrade/wallet/account/v1/account_pb2_grpc.py +4 -0
- meshtrade/wallet/account/v1/service_meshpy.py +204 -0
- meshtrade/wallet/account/v1/service_options_meshpy.py +65 -0
- meshtrade/wallet/account/v1/service_pb2.py +18 -27
- meshtrade/wallet/account/v1/service_pb2.pyi +2 -3
- meshtrade/wallet/account/v1/service_pb2_grpc.py +222 -0
- meshtrade-0.0.10.dist-info/METADATA +95 -0
- meshtrade-0.0.10.dist-info/RECORD +173 -0
- {meshtrade-0.0.7.dist-info → meshtrade-0.0.10.dist-info}/top_level.txt +1 -0
- meshtrade/issuance_hub/instrument/v1/service_pb2.py +0 -49
- meshtrade/issuance_hub/instrument/v1/service_pb2.pyi +0 -46
- meshtrade/option/v1/auth_pb2.py +0 -40
- meshtrade/option/v1/service_type_pb2.pyi +0 -17
- meshtrade/trading/direct_order/v1/__init__.py +0 -0
- meshtrade/trading/direct_order/v1/direct_order_pb2.pyi +0 -11
- meshtrade/trading/direct_order/v1/service_pb2.py +0 -40
- meshtrade/trading/direct_order/v1/service_pb2.pyi +0 -12
- meshtrade/trading/spot/__init__.py +0 -0
- meshtrade/trading/spot/v1/__init__.py +0 -0
- meshtrade/trading/spot/v1/service_pb2.py +0 -40
- meshtrade/trading/spot/v1/spot_pb2.pyi +0 -11
- meshtrade-0.0.7.dist-info/METADATA +0 -35
- meshtrade-0.0.7.dist-info/RECORD +0 -102
- meshtrade-0.0.7.dist-info/licenses/LICENSE +0 -10
- /meshtrade/{iam/role → ledger}/__init__.py +0 -0
- /meshtrade/{trading/direct_order → ledger/transaction}/__init__.py +0 -0
- {meshtrade-0.0.7.dist-info → meshtrade-0.0.10.dist-info}/WHEEL +0 -0
|
@@ -0,0 +1,265 @@
|
|
|
1
|
+
"""
|
|
2
|
+
This module provides helper functions for working with TimeOfDay protobuf messages.
|
|
3
|
+
"""
|
|
4
|
+
|
|
5
|
+
from datetime import datetime, timedelta
|
|
6
|
+
from datetime import time as python_time
|
|
7
|
+
|
|
8
|
+
from .date_pb2 import Date
|
|
9
|
+
from .time_of_day_pb2 import TimeOfDay
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
def new_time_of_day(hours: int = 0, minutes: int = 0, seconds: int = 0, nanos: int = 0) -> TimeOfDay:
|
|
13
|
+
"""Creates a new TimeOfDay from hours, minutes, seconds, and nanos values.
|
|
14
|
+
|
|
15
|
+
Args:
|
|
16
|
+
hours: Hours value (0-23, default 0)
|
|
17
|
+
minutes: Minutes value (0-59, default 0)
|
|
18
|
+
seconds: Seconds value (0-59, default 0)
|
|
19
|
+
nanos: Nanoseconds value (0-999999999, default 0)
|
|
20
|
+
|
|
21
|
+
Returns:
|
|
22
|
+
A TimeOfDay protobuf message
|
|
23
|
+
|
|
24
|
+
Raises:
|
|
25
|
+
ValueError: If the time values are invalid
|
|
26
|
+
"""
|
|
27
|
+
_validate_time_of_day(hours, minutes, seconds, nanos)
|
|
28
|
+
return TimeOfDay(hours=hours, minutes=minutes, seconds=seconds, nanos=nanos)
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
def new_time_of_day_from_python_time(python_time_obj: python_time) -> TimeOfDay:
|
|
32
|
+
"""Creates a TimeOfDay from a Python time object.
|
|
33
|
+
|
|
34
|
+
Args:
|
|
35
|
+
python_time_obj: A Python datetime.time object
|
|
36
|
+
|
|
37
|
+
Returns:
|
|
38
|
+
A TimeOfDay protobuf message
|
|
39
|
+
"""
|
|
40
|
+
return TimeOfDay(
|
|
41
|
+
hours=python_time_obj.hour,
|
|
42
|
+
minutes=python_time_obj.minute,
|
|
43
|
+
seconds=python_time_obj.second,
|
|
44
|
+
nanos=python_time_obj.microsecond * 1000, # Convert microseconds to nanoseconds
|
|
45
|
+
)
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
def new_time_of_day_from_datetime(datetime_obj: datetime) -> TimeOfDay:
|
|
49
|
+
"""Creates a TimeOfDay from a Python datetime object.
|
|
50
|
+
Only extracts the time components, ignoring the date.
|
|
51
|
+
|
|
52
|
+
Args:
|
|
53
|
+
datetime_obj: A Python datetime.datetime object
|
|
54
|
+
|
|
55
|
+
Returns:
|
|
56
|
+
A TimeOfDay protobuf message
|
|
57
|
+
"""
|
|
58
|
+
return new_time_of_day_from_python_time(datetime_obj.time())
|
|
59
|
+
|
|
60
|
+
|
|
61
|
+
def new_time_of_day_from_timedelta(delta: timedelta) -> TimeOfDay:
|
|
62
|
+
"""Creates a TimeOfDay from a timedelta representing time since midnight.
|
|
63
|
+
|
|
64
|
+
Args:
|
|
65
|
+
delta: A timedelta object representing time elapsed since midnight
|
|
66
|
+
|
|
67
|
+
Returns:
|
|
68
|
+
A TimeOfDay protobuf message
|
|
69
|
+
|
|
70
|
+
Raises:
|
|
71
|
+
ValueError: If the timedelta is negative or >= 24 hours
|
|
72
|
+
"""
|
|
73
|
+
if delta.total_seconds() < 0:
|
|
74
|
+
raise ValueError(f"Timedelta cannot be negative: {delta}")
|
|
75
|
+
if delta.total_seconds() >= 24 * 3600:
|
|
76
|
+
raise ValueError(f"Timedelta cannot be 24 hours or more: {delta}")
|
|
77
|
+
|
|
78
|
+
total_seconds = int(delta.total_seconds())
|
|
79
|
+
hours = total_seconds // 3600
|
|
80
|
+
minutes = (total_seconds % 3600) // 60
|
|
81
|
+
seconds = total_seconds % 60
|
|
82
|
+
|
|
83
|
+
# Calculate nanoseconds from microseconds
|
|
84
|
+
nanos = delta.microseconds * 1000
|
|
85
|
+
|
|
86
|
+
return TimeOfDay(hours=hours, minutes=minutes, seconds=seconds, nanos=nanos)
|
|
87
|
+
|
|
88
|
+
|
|
89
|
+
def time_of_day_to_python_time(time_obj: TimeOfDay) -> python_time:
|
|
90
|
+
"""Converts a TimeOfDay protobuf message to a Python time object.
|
|
91
|
+
|
|
92
|
+
Args:
|
|
93
|
+
time_obj: A TimeOfDay protobuf message
|
|
94
|
+
|
|
95
|
+
Returns:
|
|
96
|
+
A Python datetime.time object
|
|
97
|
+
|
|
98
|
+
Raises:
|
|
99
|
+
ValueError: If the time is invalid or represents end of day (24:00:00)
|
|
100
|
+
"""
|
|
101
|
+
if not time_obj:
|
|
102
|
+
raise ValueError("TimeOfDay object is None")
|
|
103
|
+
|
|
104
|
+
try:
|
|
105
|
+
return python_time(
|
|
106
|
+
hour=time_obj.hours,
|
|
107
|
+
minute=time_obj.minutes,
|
|
108
|
+
second=time_obj.seconds,
|
|
109
|
+
microsecond=time_obj.nanos // 1000, # Convert nanoseconds to microseconds
|
|
110
|
+
)
|
|
111
|
+
except ValueError as e:
|
|
112
|
+
raise ValueError(f"Invalid time values: {e}") from e
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
def time_of_day_to_timedelta(time_obj: TimeOfDay) -> timedelta:
|
|
116
|
+
"""Converts a TimeOfDay to a timedelta representing time since midnight.
|
|
117
|
+
|
|
118
|
+
Args:
|
|
119
|
+
time_obj: A TimeOfDay protobuf message
|
|
120
|
+
|
|
121
|
+
Returns:
|
|
122
|
+
A timedelta object representing time elapsed since midnight
|
|
123
|
+
"""
|
|
124
|
+
if not time_obj:
|
|
125
|
+
return timedelta()
|
|
126
|
+
|
|
127
|
+
return timedelta(
|
|
128
|
+
hours=time_obj.hours,
|
|
129
|
+
minutes=time_obj.minutes,
|
|
130
|
+
seconds=time_obj.seconds,
|
|
131
|
+
microseconds=time_obj.nanos // 1000, # Convert nanoseconds to microseconds
|
|
132
|
+
)
|
|
133
|
+
|
|
134
|
+
|
|
135
|
+
def time_of_day_to_datetime_with_date(time_obj: TimeOfDay, date_obj: Date) -> datetime:
|
|
136
|
+
"""Combines a TimeOfDay with a Date to create a datetime object.
|
|
137
|
+
|
|
138
|
+
Args:
|
|
139
|
+
time_obj: A TimeOfDay protobuf message
|
|
140
|
+
date_obj: A Date protobuf message
|
|
141
|
+
|
|
142
|
+
Returns:
|
|
143
|
+
A Python datetime.datetime object
|
|
144
|
+
|
|
145
|
+
Raises:
|
|
146
|
+
ValueError: If either object is None/invalid or if date is incomplete
|
|
147
|
+
"""
|
|
148
|
+
if not time_obj:
|
|
149
|
+
raise ValueError("TimeOfDay object is None")
|
|
150
|
+
if not date_obj:
|
|
151
|
+
raise ValueError("Date object is None")
|
|
152
|
+
|
|
153
|
+
# Import here to avoid circular imports
|
|
154
|
+
from .date import date_is_complete
|
|
155
|
+
|
|
156
|
+
if not date_is_complete(date_obj):
|
|
157
|
+
raise ValueError("Date must be complete")
|
|
158
|
+
|
|
159
|
+
try:
|
|
160
|
+
return datetime(
|
|
161
|
+
year=date_obj.year,
|
|
162
|
+
month=date_obj.month,
|
|
163
|
+
day=date_obj.day,
|
|
164
|
+
hour=time_obj.hours,
|
|
165
|
+
minute=time_obj.minutes,
|
|
166
|
+
second=time_obj.seconds,
|
|
167
|
+
microsecond=time_obj.nanos // 1000, # Convert nanoseconds to microseconds
|
|
168
|
+
)
|
|
169
|
+
except ValueError as e:
|
|
170
|
+
raise ValueError(f"Invalid datetime values: {e}") from e
|
|
171
|
+
|
|
172
|
+
|
|
173
|
+
def time_of_day_is_valid(time_obj: TimeOfDay | None) -> bool:
|
|
174
|
+
"""Checks if a TimeOfDay has valid values according to the protobuf constraints.
|
|
175
|
+
|
|
176
|
+
Args:
|
|
177
|
+
time_obj: A TimeOfDay protobuf message or None
|
|
178
|
+
|
|
179
|
+
Returns:
|
|
180
|
+
True if the time is valid, False otherwise
|
|
181
|
+
"""
|
|
182
|
+
if not time_obj:
|
|
183
|
+
return False
|
|
184
|
+
|
|
185
|
+
try:
|
|
186
|
+
_validate_time_of_day(time_obj.hours, time_obj.minutes, time_obj.seconds, time_obj.nanos)
|
|
187
|
+
return True
|
|
188
|
+
except ValueError:
|
|
189
|
+
return False
|
|
190
|
+
|
|
191
|
+
|
|
192
|
+
def time_of_day_is_midnight(time_obj: TimeOfDay | None) -> bool:
|
|
193
|
+
"""Returns True if the time represents midnight (00:00:00.000000000).
|
|
194
|
+
|
|
195
|
+
Args:
|
|
196
|
+
time_obj: A TimeOfDay protobuf message or None
|
|
197
|
+
|
|
198
|
+
Returns:
|
|
199
|
+
True if the time is midnight, False otherwise
|
|
200
|
+
"""
|
|
201
|
+
if not time_obj:
|
|
202
|
+
return False
|
|
203
|
+
return time_obj.hours == 0 and time_obj.minutes == 0 and time_obj.seconds == 0 and time_obj.nanos == 0
|
|
204
|
+
|
|
205
|
+
|
|
206
|
+
def time_of_day_to_string(time_obj: TimeOfDay | None) -> str:
|
|
207
|
+
"""Returns a string representation of the time in HH:MM:SS.nnnnnnnnn format.
|
|
208
|
+
|
|
209
|
+
Args:
|
|
210
|
+
time_obj: A TimeOfDay protobuf message or None
|
|
211
|
+
|
|
212
|
+
Returns:
|
|
213
|
+
String representation of the time
|
|
214
|
+
"""
|
|
215
|
+
if not time_obj:
|
|
216
|
+
return "<undefined>"
|
|
217
|
+
|
|
218
|
+
if time_obj.nanos == 0:
|
|
219
|
+
return f"{time_obj.hours:02d}:{time_obj.minutes:02d}:{time_obj.seconds:02d}"
|
|
220
|
+
else:
|
|
221
|
+
return f"{time_obj.hours:02d}:{time_obj.minutes:02d}:{time_obj.seconds:02d}.{time_obj.nanos:09d}"
|
|
222
|
+
|
|
223
|
+
|
|
224
|
+
def time_of_day_total_seconds(time_obj: TimeOfDay | None) -> float:
|
|
225
|
+
"""Returns the total number of seconds since midnight as a float.
|
|
226
|
+
|
|
227
|
+
Args:
|
|
228
|
+
time_obj: A TimeOfDay protobuf message or None
|
|
229
|
+
|
|
230
|
+
Returns:
|
|
231
|
+
Total seconds since midnight
|
|
232
|
+
"""
|
|
233
|
+
if not time_obj:
|
|
234
|
+
return 0.0
|
|
235
|
+
|
|
236
|
+
return time_obj.hours * 3600 + time_obj.minutes * 60 + time_obj.seconds + time_obj.nanos / 1e9
|
|
237
|
+
|
|
238
|
+
|
|
239
|
+
def _validate_time_of_day(hours: int, minutes: int, seconds: int, nanos: int) -> None:
|
|
240
|
+
"""Validates the hours, minutes, seconds, and nanos values according to TimeOfDay constraints.
|
|
241
|
+
|
|
242
|
+
Args:
|
|
243
|
+
hours: Hours value
|
|
244
|
+
minutes: Minutes value
|
|
245
|
+
seconds: Seconds value
|
|
246
|
+
nanos: Nanoseconds value
|
|
247
|
+
|
|
248
|
+
Raises:
|
|
249
|
+
ValueError: If the time values are invalid
|
|
250
|
+
"""
|
|
251
|
+
# Hours validation
|
|
252
|
+
if hours < 0 or hours > 23:
|
|
253
|
+
raise ValueError(f"Hours must be between 0 and 23, got {hours}")
|
|
254
|
+
|
|
255
|
+
# Minutes validation
|
|
256
|
+
if minutes < 0 or minutes > 59:
|
|
257
|
+
raise ValueError(f"Minutes must be between 0 and 59, got {minutes}")
|
|
258
|
+
|
|
259
|
+
# Seconds validation
|
|
260
|
+
if seconds < 0 or seconds > 59:
|
|
261
|
+
raise ValueError(f"Seconds must be between 0 and 59, got {seconds}")
|
|
262
|
+
|
|
263
|
+
# Nanos validation
|
|
264
|
+
if nanos < 0 or nanos > 999999999:
|
|
265
|
+
raise ValueError(f"Nanos must be between 0 and 999,999,999, got {nanos}")
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
# -*- coding: utf-8 -*-
|
|
2
|
+
# Generated by the protocol buffer compiler. DO NOT EDIT!
|
|
3
|
+
# NO CHECKED-IN PROTOBUF GENCODE
|
|
4
|
+
# source: meshtrade/type/v1/time_of_day.proto
|
|
5
|
+
# Protobuf Python Version: 6.31.1
|
|
6
|
+
"""Generated protocol buffer code."""
|
|
7
|
+
from google.protobuf import descriptor as _descriptor
|
|
8
|
+
from google.protobuf import descriptor_pool as _descriptor_pool
|
|
9
|
+
from google.protobuf import runtime_version as _runtime_version
|
|
10
|
+
from google.protobuf import symbol_database as _symbol_database
|
|
11
|
+
from google.protobuf.internal import builder as _builder
|
|
12
|
+
_runtime_version.ValidateProtobufRuntimeVersion(
|
|
13
|
+
_runtime_version.Domain.PUBLIC,
|
|
14
|
+
6,
|
|
15
|
+
31,
|
|
16
|
+
1,
|
|
17
|
+
'',
|
|
18
|
+
'meshtrade/type/v1/time_of_day.proto'
|
|
19
|
+
)
|
|
20
|
+
# @@protoc_insertion_point(imports)
|
|
21
|
+
|
|
22
|
+
_sym_db = _symbol_database.Default()
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n#meshtrade/type/v1/time_of_day.proto\x12\x11meshtrade.type.v1\"k\n\tTimeOfDay\x12\x14\n\x05hours\x18\x01 \x01(\x05R\x05hours\x12\x18\n\x07minutes\x18\x02 \x01(\x05R\x07minutes\x12\x18\n\x07seconds\x18\x03 \x01(\x05R\x07seconds\x12\x14\n\x05nanos\x18\x04 \x01(\x05R\x05nanosBF\n\x18\x63o.meshtrade.api.type.v1Z*github.com/meshtrade/api/go/type/v1;typev1b\x06proto3')
|
|
28
|
+
|
|
29
|
+
_globals = globals()
|
|
30
|
+
_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
|
|
31
|
+
_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'meshtrade.type.v1.time_of_day_pb2', _globals)
|
|
32
|
+
if not _descriptor._USE_C_DESCRIPTORS:
|
|
33
|
+
_globals['DESCRIPTOR']._loaded_options = None
|
|
34
|
+
_globals['DESCRIPTOR']._serialized_options = b'\n\030co.meshtrade.api.type.v1Z*github.com/meshtrade/api/go/type/v1;typev1'
|
|
35
|
+
_globals['_TIMEOFDAY']._serialized_start=58
|
|
36
|
+
_globals['_TIMEOFDAY']._serialized_end=165
|
|
37
|
+
# @@protoc_insertion_point(module_scope)
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
from google.protobuf import descriptor as _descriptor
|
|
2
|
+
from google.protobuf import message as _message
|
|
3
|
+
from typing import ClassVar as _ClassVar, Optional as _Optional
|
|
4
|
+
|
|
5
|
+
DESCRIPTOR: _descriptor.FileDescriptor
|
|
6
|
+
|
|
7
|
+
class TimeOfDay(_message.Message):
|
|
8
|
+
__slots__ = ("hours", "minutes", "seconds", "nanos")
|
|
9
|
+
HOURS_FIELD_NUMBER: _ClassVar[int]
|
|
10
|
+
MINUTES_FIELD_NUMBER: _ClassVar[int]
|
|
11
|
+
SECONDS_FIELD_NUMBER: _ClassVar[int]
|
|
12
|
+
NANOS_FIELD_NUMBER: _ClassVar[int]
|
|
13
|
+
hours: int
|
|
14
|
+
minutes: int
|
|
15
|
+
seconds: int
|
|
16
|
+
nanos: int
|
|
17
|
+
def __init__(self, hours: _Optional[int] = ..., minutes: _Optional[int] = ..., seconds: _Optional[int] = ..., nanos: _Optional[int] = ...) -> None: ...
|
meshtrade/type/v1/token_pb2.py
CHANGED
|
@@ -25,14 +25,14 @@ _sym_db = _symbol_database.Default()
|
|
|
25
25
|
from meshtrade.type.v1 import ledger_pb2 as meshtrade_dot_type_dot_v1_dot_ledger__pb2
|
|
26
26
|
|
|
27
27
|
|
|
28
|
-
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x1dmeshtrade/type/v1/token.proto\x12\x11meshtrade.type.v1\x1a\x1emeshtrade/type/v1/ledger.proto\"f\n\x05Token\x12\x12\n\x04\x63ode\x18\x01 \x01(\tR\x04\x63ode\x12\x16\n\x06issuer\x18\x02 \x01(\tR\x06issuer\x12\x31\n\x06ledger\x18\x03 \x01(\x0e\x32\x19.meshtrade.type.v1.LedgerR\
|
|
28
|
+
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n\x1dmeshtrade/type/v1/token.proto\x12\x11meshtrade.type.v1\x1a\x1emeshtrade/type/v1/ledger.proto\"f\n\x05Token\x12\x12\n\x04\x63ode\x18\x01 \x01(\tR\x04\x63ode\x12\x16\n\x06issuer\x18\x02 \x01(\tR\x06issuer\x12\x31\n\x06ledger\x18\x03 \x01(\x0e\x32\x19.meshtrade.type.v1.LedgerR\x06ledgerBF\n\x18\x63o.meshtrade.api.type.v1Z*github.com/meshtrade/api/go/type/v1;typev1b\x06proto3')
|
|
29
29
|
|
|
30
30
|
_globals = globals()
|
|
31
31
|
_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
|
|
32
32
|
_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'meshtrade.type.v1.token_pb2', _globals)
|
|
33
33
|
if not _descriptor._USE_C_DESCRIPTORS:
|
|
34
34
|
_globals['DESCRIPTOR']._loaded_options = None
|
|
35
|
-
_globals['DESCRIPTOR']._serialized_options = b'
|
|
35
|
+
_globals['DESCRIPTOR']._serialized_options = b'\n\030co.meshtrade.api.type.v1Z*github.com/meshtrade/api/go/type/v1;typev1'
|
|
36
36
|
_globals['_TOKEN']._serialized_start=84
|
|
37
37
|
_globals['_TOKEN']._serialized_end=186
|
|
38
38
|
# @@protoc_insertion_point(module_scope)
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
"""Account v1 package."""
|
|
2
|
+
|
|
3
|
+
# ===================================================================
|
|
4
|
+
# AUTO-GENERATED SECTION - ONLY EDIT BELOW THE CLOSING COMMENT BLOCK
|
|
5
|
+
# ===================================================================
|
|
6
|
+
# This section is automatically managed by protoc-gen-meshpy.
|
|
7
|
+
#
|
|
8
|
+
# DO NOT EDIT ANYTHING IN THIS SECTION MANUALLY!
|
|
9
|
+
# Your changes will be overwritten during code generation.
|
|
10
|
+
#
|
|
11
|
+
# To add custom imports and exports, scroll down to the
|
|
12
|
+
# "MANUAL SECTION" indicated below.
|
|
13
|
+
# ===================================================================
|
|
14
|
+
|
|
15
|
+
# Generated protobuf imports
|
|
16
|
+
from .account_pb2 import Account
|
|
17
|
+
from .service_pb2 import (
|
|
18
|
+
CreateAccountRequest,
|
|
19
|
+
GetAccountRequest,
|
|
20
|
+
ListAccountsRequest,
|
|
21
|
+
ListAccountsResponse,
|
|
22
|
+
SearchAccountsRequest,
|
|
23
|
+
SearchAccountsResponse,
|
|
24
|
+
)
|
|
25
|
+
|
|
26
|
+
# Generated service imports
|
|
27
|
+
from .service_meshpy import (
|
|
28
|
+
AccountService,
|
|
29
|
+
AccountServiceGRPCClient,
|
|
30
|
+
AccountServiceGRPCClientInterface,
|
|
31
|
+
)
|
|
32
|
+
from .service_options_meshpy import ClientOptions
|
|
33
|
+
|
|
34
|
+
# ===================================================================
|
|
35
|
+
# END OF AUTO-GENERATED SECTION
|
|
36
|
+
# ===================================================================
|
|
37
|
+
#
|
|
38
|
+
# MANUAL SECTION - ADD YOUR CUSTOM IMPORTS AND EXPORTS BELOW
|
|
39
|
+
#
|
|
40
|
+
# You can safely add your own imports, functions, classes, and exports
|
|
41
|
+
# in this section. They will be preserved across code generation.
|
|
42
|
+
#
|
|
43
|
+
# Example:
|
|
44
|
+
# from my_custom_module import my_function
|
|
45
|
+
#
|
|
46
|
+
# ===================================================================
|
|
47
|
+
|
|
48
|
+
# ===================================================================
|
|
49
|
+
# MODULE EXPORTS
|
|
50
|
+
# ===================================================================
|
|
51
|
+
# Combined auto-generated and manual exports
|
|
52
|
+
__all__ = [
|
|
53
|
+
# Generated exports
|
|
54
|
+
"Account",
|
|
55
|
+
"AccountService",
|
|
56
|
+
"AccountServiceGRPCClient",
|
|
57
|
+
"AccountServiceGRPCClientInterface",
|
|
58
|
+
"ClientOptions",
|
|
59
|
+
"CreateAccountRequest",
|
|
60
|
+
"GetAccountRequest",
|
|
61
|
+
"ListAccountsRequest",
|
|
62
|
+
"ListAccountsResponse",
|
|
63
|
+
"SearchAccountsRequest",
|
|
64
|
+
"SearchAccountsResponse",
|
|
65
|
+
]
|
|
@@ -24,14 +24,14 @@ _sym_db = _symbol_database.Default()
|
|
|
24
24
|
|
|
25
25
|
|
|
26
26
|
|
|
27
|
-
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n)meshtrade/wallet/account/v1/account.proto\x12\x1bmeshtrade.wallet.account.v1\"\x1d\n\x07\x41\x63\x63ount\x12\x12\n\x04name\x18\x01 \x01(\tR\
|
|
27
|
+
DESCRIPTOR = _descriptor_pool.Default().AddSerializedFile(b'\n)meshtrade/wallet/account/v1/account.proto\x12\x1bmeshtrade.wallet.account.v1\"\x1d\n\x07\x41\x63\x63ount\x12\x12\n\x04name\x18\x01 \x01(\tR\x04nameB]\n\"co.meshtrade.api.wallet.account.v1Z7github.com/meshtrade/api/go/wallet/account/v1;accountv1b\x06proto3')
|
|
28
28
|
|
|
29
29
|
_globals = globals()
|
|
30
30
|
_builder.BuildMessageAndEnumDescriptors(DESCRIPTOR, _globals)
|
|
31
31
|
_builder.BuildTopDescriptorsAndMessages(DESCRIPTOR, 'meshtrade.wallet.account.v1.account_pb2', _globals)
|
|
32
32
|
if not _descriptor._USE_C_DESCRIPTORS:
|
|
33
33
|
_globals['DESCRIPTOR']._loaded_options = None
|
|
34
|
-
_globals['DESCRIPTOR']._serialized_options = b'
|
|
34
|
+
_globals['DESCRIPTOR']._serialized_options = b'\n\"co.meshtrade.api.wallet.account.v1Z7github.com/meshtrade/api/go/wallet/account/v1;accountv1'
|
|
35
35
|
_globals['_ACCOUNT']._serialized_start=74
|
|
36
36
|
_globals['_ACCOUNT']._serialized_end=103
|
|
37
37
|
# @@protoc_insertion_point(module_scope)
|
|
@@ -0,0 +1,204 @@
|
|
|
1
|
+
# Code generated by protoc-gen-meshpy. DO NOT EDIT.
|
|
2
|
+
# source: meshtrade/wallet/account/v1/service.proto
|
|
3
|
+
|
|
4
|
+
"""
|
|
5
|
+
AccountService gRPC service wrapper with authentication, timeouts, and resource management.
|
|
6
|
+
|
|
7
|
+
This module provides a high-level gRPC service for the AccountService service that combines
|
|
8
|
+
the service interface with resource management capabilities, providing authentication,
|
|
9
|
+
timeouts, and proper connection handling.
|
|
10
|
+
"""
|
|
11
|
+
|
|
12
|
+
from datetime import timedelta
|
|
13
|
+
from typing import Optional
|
|
14
|
+
|
|
15
|
+
from meshtrade.common import BaseGRPCClient
|
|
16
|
+
from meshtrade.iam.api_user.v1.api_credentials import find_credentials
|
|
17
|
+
|
|
18
|
+
from .account_pb2 import Account
|
|
19
|
+
from .service_options_meshpy import ServiceOptions
|
|
20
|
+
from .service_pb2 import (
|
|
21
|
+
CreateAccountRequest,
|
|
22
|
+
GetAccountRequest,
|
|
23
|
+
ListAccountsRequest,
|
|
24
|
+
ListAccountsResponse,
|
|
25
|
+
SearchAccountsRequest,
|
|
26
|
+
SearchAccountsResponse,
|
|
27
|
+
)
|
|
28
|
+
from .service_pb2_grpc import AccountServiceStub
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
def _create_accountservice_stub(channel):
|
|
32
|
+
"""Factory function to create AccountServiceStub from gRPC channel."""
|
|
33
|
+
return AccountServiceStub(channel)
|
|
34
|
+
|
|
35
|
+
|
|
36
|
+
class AccountService(BaseGRPCClient):
|
|
37
|
+
"""AccountService gRPC service with authentication, timeouts, and resource management.
|
|
38
|
+
|
|
39
|
+
This service provides a complete implementation of the AccountService with proper authentication, timeout handling, and automatic resource cleanup.
|
|
40
|
+
|
|
41
|
+
Full Service documentation: https://meshtrade.github.io/api/docs/api-reference/wallet/account/v1
|
|
42
|
+
|
|
43
|
+
Basic service usage with default SDK Configuration:
|
|
44
|
+
```python
|
|
45
|
+
service = AccountService()
|
|
46
|
+
|
|
47
|
+
with service: # `with` ensures proper clean up of underlying connection after use
|
|
48
|
+
response = service.get_api_user(request)
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
With default configuration API credentials are searched for using the standard discovery hierarchy:
|
|
52
|
+
|
|
53
|
+
1. MESH_API_CREDENTIALS environment variable
|
|
54
|
+
|
|
55
|
+
2. Default credential file location:
|
|
56
|
+
|
|
57
|
+
- Linux: `$XDG_CONFIG_HOME/mesh/credentials.json` or fallback to `$HOME/.config/mesh/credentials.json`
|
|
58
|
+
- macOS: `$HOME/Library/Application Support/mesh/credentials.json`
|
|
59
|
+
- Windows: `C:\\Users\\<user>\\AppData\\Roaming\\mesh\\credentials.json`
|
|
60
|
+
|
|
61
|
+
For more information on authentication: https://meshtrade.github.io/api/docs/architecture/authentication
|
|
62
|
+
|
|
63
|
+
The service may also be configured with custom options:
|
|
64
|
+
```python
|
|
65
|
+
from .service_options_meshpy import ServiceOptions
|
|
66
|
+
from datetime import timedelta
|
|
67
|
+
|
|
68
|
+
options = ServiceOptions(
|
|
69
|
+
url="api.staging.example.com",
|
|
70
|
+
port=443,
|
|
71
|
+
api_key="your-api-key",
|
|
72
|
+
group="groups/your-group-id",
|
|
73
|
+
timeout=timedelta(seconds=60)
|
|
74
|
+
)
|
|
75
|
+
|
|
76
|
+
service = AccountService(options)
|
|
77
|
+
|
|
78
|
+
with service: # `with` ensures proper clean up of underlying connection after use
|
|
79
|
+
response = service.get_api_user(request)
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
For more information on service configuration: https://meshtrade.github.io/api/docs/architecture/sdk-configuration
|
|
83
|
+
"""
|
|
84
|
+
|
|
85
|
+
def __init__(self, options: Optional[ServiceOptions] = None):
|
|
86
|
+
"""Construct and initialize the AccountService service.
|
|
87
|
+
|
|
88
|
+
Full Service documentation: https://meshtrade.github.io/api/docs/api-reference/wallet/account/v1
|
|
89
|
+
|
|
90
|
+
Args:
|
|
91
|
+
options: Optional ServiceOptions for configuring the service.
|
|
92
|
+
If None, service is constructed with default configuration.
|
|
93
|
+
With default configuration API credentials are searched for using the standard discovery hierarchy:
|
|
94
|
+
|
|
95
|
+
1. MESH_API_CREDENTIALS environment variable
|
|
96
|
+
|
|
97
|
+
2. Default credential file location:
|
|
98
|
+
|
|
99
|
+
- Linux: `$XDG_CONFIG_HOME/mesh/credentials.json` or fallback to `$HOME/.config/mesh/credentials.json`
|
|
100
|
+
- macOS: `$HOME/Library/Application Support/mesh/credentials.json`
|
|
101
|
+
- Windows: `C:\\Users\\<user>\\AppData\\Roaming\\mesh\\credentials.json`
|
|
102
|
+
|
|
103
|
+
For more information on authentication: https://meshtrade.github.io/api/docs/architecture/authentication
|
|
104
|
+
|
|
105
|
+
For more information on service configuration: https://meshtrade.github.io/api/docs/architecture/sdk-configuration
|
|
106
|
+
|
|
107
|
+
Example:
|
|
108
|
+
```python
|
|
109
|
+
# construct with default configuration
|
|
110
|
+
service = AccountService()
|
|
111
|
+
|
|
112
|
+
# construct with custom configuration
|
|
113
|
+
options = ServiceOptions(
|
|
114
|
+
url="api.example.com",
|
|
115
|
+
api_key="your-key",
|
|
116
|
+
group="groups/your-group"
|
|
117
|
+
)
|
|
118
|
+
service = AccountService(options)
|
|
119
|
+
```
|
|
120
|
+
"""
|
|
121
|
+
if options is None:
|
|
122
|
+
options = ServiceOptions()
|
|
123
|
+
|
|
124
|
+
# Initialize the base client with all common functionality
|
|
125
|
+
super().__init__(
|
|
126
|
+
service_name="AccountService",
|
|
127
|
+
stub_factory=_create_accountservice_stub,
|
|
128
|
+
find_credentials_func=find_credentials,
|
|
129
|
+
url=options.url,
|
|
130
|
+
port=options.port,
|
|
131
|
+
api_key=options.api_key,
|
|
132
|
+
group=options.group,
|
|
133
|
+
timeout=options.timeout,
|
|
134
|
+
tls=options.tls,
|
|
135
|
+
)
|
|
136
|
+
|
|
137
|
+
def create_account(self, request: CreateAccountRequest, timeout: Optional[timedelta] = None) -> Account:
|
|
138
|
+
"""CreateAccount method.
|
|
139
|
+
|
|
140
|
+
Args:
|
|
141
|
+
request: The CreateAccount request message
|
|
142
|
+
timeout: Optional timeout override for this call
|
|
143
|
+
|
|
144
|
+
Returns:
|
|
145
|
+
The CreateAccount response message
|
|
146
|
+
|
|
147
|
+
Raises:
|
|
148
|
+
grpc.RpcError: If the gRPC call fails
|
|
149
|
+
ValueError: If authentication credentials are missing
|
|
150
|
+
"""
|
|
151
|
+
return self._execute_method("CreateAccount", request, timeout)
|
|
152
|
+
|
|
153
|
+
def get_account(self, request: GetAccountRequest, timeout: Optional[timedelta] = None) -> Account:
|
|
154
|
+
"""GetAccount method.
|
|
155
|
+
|
|
156
|
+
Args:
|
|
157
|
+
request: The GetAccount request message
|
|
158
|
+
timeout: Optional timeout override for this call
|
|
159
|
+
|
|
160
|
+
Returns:
|
|
161
|
+
The GetAccount response message
|
|
162
|
+
|
|
163
|
+
Raises:
|
|
164
|
+
grpc.RpcError: If the gRPC call fails
|
|
165
|
+
ValueError: If authentication credentials are missing
|
|
166
|
+
"""
|
|
167
|
+
return self._execute_method("GetAccount", request, timeout)
|
|
168
|
+
|
|
169
|
+
def list_accounts(self, request: ListAccountsRequest, timeout: Optional[timedelta] = None) -> ListAccountsResponse:
|
|
170
|
+
"""ListAccounts method.
|
|
171
|
+
|
|
172
|
+
Args:
|
|
173
|
+
request: The ListAccounts request message
|
|
174
|
+
timeout: Optional timeout override for this call
|
|
175
|
+
|
|
176
|
+
Returns:
|
|
177
|
+
The ListAccounts response message
|
|
178
|
+
|
|
179
|
+
Raises:
|
|
180
|
+
grpc.RpcError: If the gRPC call fails
|
|
181
|
+
ValueError: If authentication credentials are missing
|
|
182
|
+
"""
|
|
183
|
+
return self._execute_method("ListAccounts", request, timeout)
|
|
184
|
+
|
|
185
|
+
def search_accounts(self, request: SearchAccountsRequest, timeout: Optional[timedelta] = None) -> SearchAccountsResponse:
|
|
186
|
+
"""SearchAccounts method.
|
|
187
|
+
|
|
188
|
+
Args:
|
|
189
|
+
request: The SearchAccounts request message
|
|
190
|
+
timeout: Optional timeout override for this call
|
|
191
|
+
|
|
192
|
+
Returns:
|
|
193
|
+
The SearchAccounts response message
|
|
194
|
+
|
|
195
|
+
Raises:
|
|
196
|
+
grpc.RpcError: If the gRPC call fails
|
|
197
|
+
ValueError: If authentication credentials are missing
|
|
198
|
+
"""
|
|
199
|
+
return self._execute_method("SearchAccounts", request, timeout)
|
|
200
|
+
|
|
201
|
+
|
|
202
|
+
# Create aliases to match expected exports
|
|
203
|
+
AccountServiceGRPCClient = AccountService
|
|
204
|
+
AccountServiceGRPCClientInterface = AccountService
|