Skip to content

Commit e256a71

Browse files
Added de_json classes for types
1 parent c7130d5 commit e256a71

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed

telebot/types.py

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10123,6 +10123,12 @@ class RevenueWithdrawalStatePending(RevenueWithdrawalState):
1012310123
def __init__(self, type, **kwargs):
1012410124
self.type: str = type
1012510125

10126+
@classmethod
10127+
def de_json(cls, json_string):
10128+
if json_string is None: return None
10129+
obj = cls.check_json(json_string)
10130+
return cls(**obj)
10131+
1012610132

1012710133
class RevenueWithdrawalStateSucceeded(RevenueWithdrawalState):
1012810134
"""
@@ -10148,6 +10154,13 @@ def __init__(self, type, date, url, **kwargs):
1014810154
self.date: int = date
1014910155
self.url: str = url
1015010156

10157+
@classmethod
10158+
def de_json(cls, json_string):
10159+
if json_string is None: return None
10160+
obj = cls.check_json(json_string)
10161+
return cls(**obj)
10162+
10163+
1015110164

1015210165
class RevenueWithdrawalStateFailed(RevenueWithdrawalState):
1015310166
"""
@@ -10165,6 +10178,12 @@ class RevenueWithdrawalStateFailed(RevenueWithdrawalState):
1016510178
def __init__(self, type, **kwargs):
1016610179
self.type: str = type
1016710180

10181+
@classmethod
10182+
def de_json(cls, json_string):
10183+
if json_string is None: return None
10184+
obj = cls.check_json(json_string)
10185+
return cls(**obj)
10186+
1016810187

1016910188
class TransactionPartner(JsonDeserializable):
1017010189
"""
@@ -10214,6 +10233,15 @@ def __init__(self, type, withdrawal_state=None, **kwargs):
1021410233
self.type: str = type
1021510234
self.withdrawal_state: Optional[RevenueWithdrawalState] = withdrawal_state
1021610235

10236+
@classmethod
10237+
def de_json(cls, json_string):
10238+
if json_string is None: return None
10239+
obj = cls.check_json(json_string)
10240+
if 'withdrawal_state' in obj:
10241+
obj['withdrawal_state'] = RevenueWithdrawalState.de_json(obj['withdrawal_state'])
10242+
return cls(**obj)
10243+
10244+
1021710245

1021810246
class TransactionPartnerUser(TransactionPartner):
1021910247
"""
@@ -10234,6 +10262,14 @@ class TransactionPartnerUser(TransactionPartner):
1023410262
def __init__(self, type, user, **kwargs):
1023510263
self.type: str = type
1023610264
self.user: User = user
10265+
10266+
@classmethod
10267+
def de_json(cls, json_string):
10268+
if json_string is None: return None
10269+
obj = cls.check_json(json_string)
10270+
obj['user'] = User.de_json(obj['user'])
10271+
return cls(**obj)
10272+
1023710273

1023810274
class TransactionPartnerOther(TransactionPartner):
1023910275
"""
@@ -10251,6 +10287,13 @@ class TransactionPartnerOther(TransactionPartner):
1025110287
def __init__(self, type, **kwargs):
1025210288
self.type: str = type
1025310289

10290+
@classmethod
10291+
def de_json(cls, json_string):
10292+
if json_string is None: return None
10293+
obj = cls.check_json(json_string)
10294+
return cls(**obj)
10295+
10296+
1025410297

1025510298
class StarTransaction(JsonDeserializable):
1025610299
"""

0 commit comments

Comments
 (0)