Skip to content

Commit

Permalink
Added de_json classes for types
Browse files Browse the repository at this point in the history
  • Loading branch information
coder2020official committed Jun 20, 2024
1 parent c7130d5 commit e256a71
Showing 1 changed file with 43 additions and 0 deletions.
43 changes: 43 additions & 0 deletions telebot/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -10123,6 +10123,12 @@ class RevenueWithdrawalStatePending(RevenueWithdrawalState):
def __init__(self, type, **kwargs):
self.type: str = type

@classmethod
def de_json(cls, json_string):
if json_string is None: return None
obj = cls.check_json(json_string)
return cls(**obj)


class RevenueWithdrawalStateSucceeded(RevenueWithdrawalState):
"""
Expand All @@ -10148,6 +10154,13 @@ def __init__(self, type, date, url, **kwargs):
self.date: int = date
self.url: str = url

@classmethod
def de_json(cls, json_string):
if json_string is None: return None
obj = cls.check_json(json_string)
return cls(**obj)



class RevenueWithdrawalStateFailed(RevenueWithdrawalState):
"""
Expand All @@ -10165,6 +10178,12 @@ class RevenueWithdrawalStateFailed(RevenueWithdrawalState):
def __init__(self, type, **kwargs):
self.type: str = type

@classmethod
def de_json(cls, json_string):
if json_string is None: return None
obj = cls.check_json(json_string)
return cls(**obj)


class TransactionPartner(JsonDeserializable):
"""
Expand Down Expand Up @@ -10214,6 +10233,15 @@ def __init__(self, type, withdrawal_state=None, **kwargs):
self.type: str = type
self.withdrawal_state: Optional[RevenueWithdrawalState] = withdrawal_state

@classmethod
def de_json(cls, json_string):
if json_string is None: return None
obj = cls.check_json(json_string)
if 'withdrawal_state' in obj:
obj['withdrawal_state'] = RevenueWithdrawalState.de_json(obj['withdrawal_state'])
return cls(**obj)



class TransactionPartnerUser(TransactionPartner):
"""
Expand All @@ -10234,6 +10262,14 @@ class TransactionPartnerUser(TransactionPartner):
def __init__(self, type, user, **kwargs):
self.type: str = type
self.user: User = user

@classmethod
def de_json(cls, json_string):
if json_string is None: return None
obj = cls.check_json(json_string)
obj['user'] = User.de_json(obj['user'])
return cls(**obj)


class TransactionPartnerOther(TransactionPartner):
"""
Expand All @@ -10251,6 +10287,13 @@ class TransactionPartnerOther(TransactionPartner):
def __init__(self, type, **kwargs):
self.type: str = type

@classmethod
def de_json(cls, json_string):
if json_string is None: return None
obj = cls.check_json(json_string)
return cls(**obj)



class StarTransaction(JsonDeserializable):
"""
Expand Down

0 comments on commit e256a71

Please sign in to comment.