"""File generated by TLObjects' generator. All changes will be ERASED""" from ...tl.tlobject import TLObject from ...tl.tlobject import TLRequest from typing import Optional, List, Union, TYPE_CHECKING import os import struct from datetime import datetime if TYPE_CHECKING: from ...tl.types import TypeDataJSON, TypeInputCheckPasswordSRP, TypeInputInvoice, TypeInputMedia, TypeInputPaymentCredentials, TypeInputPeer, TypeInputSavedStarGift, TypeInputStarsTransaction, TypeInputStorePaymentPurpose, TypeInputUser, TypePaymentRequestedInfo class ApplyGiftCodeRequest(TLRequest): CONSTRUCTOR_ID = 0xf6e26854 SUBCLASS_OF_ID = 0x8af52aac def __init__(self, slug: str): """ :returns Updates: Instance of either UpdatesTooLong, UpdateShortMessage, UpdateShortChatMessage, UpdateShort, UpdatesCombined, Updates, UpdateShortSentMessage. """ self.slug = slug def to_dict(self): return { '_': 'ApplyGiftCodeRequest', 'slug': self.slug } def _bytes(self): return b''.join(( b'Th\xe2\xf6', self.serialize_bytes(self.slug), )) @classmethod def from_reader(cls, reader): _slug = reader.tgread_string() return cls(slug=_slug) class AssignAppStoreTransactionRequest(TLRequest): CONSTRUCTOR_ID = 0x80ed747d SUBCLASS_OF_ID = 0x8af52aac def __init__(self, receipt: bytes, purpose: 'TypeInputStorePaymentPurpose'): """ :returns Updates: Instance of either UpdatesTooLong, UpdateShortMessage, UpdateShortChatMessage, UpdateShort, UpdatesCombined, Updates, UpdateShortSentMessage. """ self.receipt = receipt self.purpose = purpose def to_dict(self): return { '_': 'AssignAppStoreTransactionRequest', 'receipt': self.receipt, 'purpose': self.purpose.to_dict() if isinstance(self.purpose, TLObject) else self.purpose } def _bytes(self): return b''.join(( b'}t\xed\x80', self.serialize_bytes(self.receipt), self.purpose._bytes(), )) @classmethod def from_reader(cls, reader): _receipt = reader.tgread_bytes() _purpose = reader.tgread_object() return cls(receipt=_receipt, purpose=_purpose) class AssignPlayMarketTransactionRequest(TLRequest): CONSTRUCTOR_ID = 0xdffd50d3 SUBCLASS_OF_ID = 0x8af52aac def __init__(self, receipt: 'TypeDataJSON', purpose: 'TypeInputStorePaymentPurpose'): """ :returns Updates: Instance of either UpdatesTooLong, UpdateShortMessage, UpdateShortChatMessage, UpdateShort, UpdatesCombined, Updates, UpdateShortSentMessage. """ self.receipt = receipt self.purpose = purpose def to_dict(self): return { '_': 'AssignPlayMarketTransactionRequest', 'receipt': self.receipt.to_dict() if isinstance(self.receipt, TLObject) else self.receipt, 'purpose': self.purpose.to_dict() if isinstance(self.purpose, TLObject) else self.purpose } def _bytes(self): return b''.join(( b'\xd3P\xfd\xdf', self.receipt._bytes(), self.purpose._bytes(), )) @classmethod def from_reader(cls, reader): _receipt = reader.tgread_object() _purpose = reader.tgread_object() return cls(receipt=_receipt, purpose=_purpose) class BotCancelStarsSubscriptionRequest(TLRequest): CONSTRUCTOR_ID = 0x6dfa0622 SUBCLASS_OF_ID = 0xf5b399ac def __init__(self, user_id: 'TypeInputUser', charge_id: str, restore: Optional[bool]=None): """ :returns Bool: This type has no constructors. """ self.user_id = user_id self.charge_id = charge_id self.restore = restore async def resolve(self, client, utils): self.user_id = utils.get_input_user(await client.get_input_entity(self.user_id)) def to_dict(self): return { '_': 'BotCancelStarsSubscriptionRequest', 'user_id': self.user_id.to_dict() if isinstance(self.user_id, TLObject) else self.user_id, 'charge_id': self.charge_id, 'restore': self.restore } def _bytes(self): return b''.join(( b'"\x06\xfam', struct.pack(': This type has no constructors. """ self.boost_peer = boost_peer async def resolve(self, client, utils): if self.boost_peer: self.boost_peer = utils.get_input_peer(await client.get_input_entity(self.boost_peer)) def to_dict(self): return { '_': 'GetPremiumGiftCodeOptionsRequest', 'boost_peer': self.boost_peer.to_dict() if isinstance(self.boost_peer, TLObject) else self.boost_peer } def _bytes(self): return b''.join(( b"T\xbaW'", struct.pack(': This type has no constructors. """ self.user_id = user_id async def resolve(self, client, utils): if self.user_id: self.user_id = utils.get_input_user(await client.get_input_entity(self.user_id)) def to_dict(self): return { '_': 'GetStarsGiftOptionsRequest', 'user_id': self.user_id.to_dict() if isinstance(self.user_id, TLObject) else self.user_id } def _bytes(self): return b''.join(( b'\xc8k\xc9\xd3', struct.pack('\xfd\x1e\xbd', )) @classmethod def from_reader(cls, reader): return cls() class GetStarsRevenueAdsAccountUrlRequest(TLRequest): CONSTRUCTOR_ID = 0xd1d7efc5 SUBCLASS_OF_ID = 0x4a228b15 def __init__(self, peer: 'TypeInputPeer'): """ :returns payments.StarsRevenueAdsAccountUrl: Instance of StarsRevenueAdsAccountUrl. """ self.peer = peer async def resolve(self, client, utils): self.peer = utils.get_input_peer(await client.get_input_entity(self.peer)) def to_dict(self): return { '_': 'GetStarsRevenueAdsAccountUrlRequest', 'peer': self.peer.to_dict() if isinstance(self.peer, TLObject) else self.peer } def _bytes(self): return b''.join(( b'\xc5\xef\xd7\xd1', self.peer._bytes(), )) @classmethod def from_reader(cls, reader): _peer = reader.tgread_object() return cls(peer=_peer) class GetStarsRevenueStatsRequest(TLRequest): CONSTRUCTOR_ID = 0xd91ffad6 SUBCLASS_OF_ID = 0xa54755f3 def __init__(self, peer: 'TypeInputPeer', dark: Optional[bool]=None): """ :returns payments.StarsRevenueStats: Instance of StarsRevenueStats. """ self.peer = peer self.dark = dark async def resolve(self, client, utils): self.peer = utils.get_input_peer(await client.get_input_entity(self.peer)) def to_dict(self): return { '_': 'GetStarsRevenueStatsRequest', 'peer': self.peer.to_dict() if isinstance(self.peer, TLObject) else self.peer, 'dark': self.dark } def _bytes(self): return b''.join(( b'\xd6\xfa\x1f\xd9', struct.pack('