diff --git a/pyrogram/storage/storage.py b/pyrogram/storage/storage.py index 0689b682..6af890d0 100644 --- a/pyrogram/storage/storage.py +++ b/pyrogram/storage/storage.py @@ -33,51 +33,133 @@ class Storage: self.name = name async def open(self): + """Opens the storage engine.""" raise NotImplementedError async def save(self): + """Saves the current state of the storage engine.""" raise NotImplementedError async def close(self): + """Closes the storage engine.""" raise NotImplementedError async def delete(self): + """Deletes the storage.""" raise NotImplementedError - async def update_peers(self, peers: List[Tuple[int, int, str, str, str]]): + async def update_peers(self, peers: List[Tuple[int, int, str, List[str], str]]): + """ + Update the peers table with the provided information. + + Parameters: + peers (``List[Tuple[int, int, str, List[str], str]]``): A list of tuples containing the + information of the peers to be updated. Each tuple must contain the following + information: + - ``int``: The peer id. + - ``int``: The peer access hash. + - ``str``: The peer type (user, chat or channel). + - List of ``str``: The peer username (if any). + - ``str``: The peer phone number (if any). + """ raise NotImplementedError async def get_peer_by_id(self, peer_id: int): + """Retrieve a peer by its ID. + + Parameters: + peer_id (``int``): + The ID of the peer to retrieve. + """ raise NotImplementedError async def get_peer_by_username(self, username: str): + """Retrieve a peer by its username. + + Parameters: + username (``str``): + The username of the peer to retrieve. + """ raise NotImplementedError async def get_peer_by_phone_number(self, phone_number: str): + """Retrieve a peer by its phone number. + + Parameters: + phone_number (``str``): + The phone number of the peer to retrieve. + """ raise NotImplementedError async def dc_id(self, value: int = object): + """Get or set the DC ID of the current session. + + Parameters: + value (``int``, *optional*): + The DC ID to set. + """ raise NotImplementedError async def api_id(self, value: int = object): + """Get or set the API ID of the current session. + + Parameters: + value (``int``, *optional*): + The API ID to set. + """ raise NotImplementedError async def test_mode(self, value: bool = object): + """Get or set the test mode of the current session. + + Parameters: + value (``bool``, *optional*): + The test mode to set. + """ raise NotImplementedError async def auth_key(self, value: bytes = object): + """Get or set the authorization key of the current session. + + Parameters: + value (``bytes``, *optional*): + The authorization key to set. + """ raise NotImplementedError async def date(self, value: int = object): + """Get or set the date of the current session. + + Parameters: + value (``int``, *optional*): + The date to set. + """ raise NotImplementedError async def user_id(self, value: int = object): + """Get or set the user ID of the current session. + + Parameters: + value (``int``, *optional*): + The user ID to set. + """ raise NotImplementedError async def is_bot(self, value: bool = object): + """Get or set the bot flag of the current session. + + Parameters: + value (``bool``, *optional*): + The bot flag to set. + """ raise NotImplementedError async def export_session_string(self): + """Exports the session string for the current session. + + Returns: + ``str``: The session string for the current session. + """ packed = struct.pack( self.SESSION_STRING_FORMAT, await self.dc_id(),