mirror of
https://github.com/TeamPGM/pyrogram.git
synced 2024-11-27 16:45:19 +00:00
Docstrings for storage class
This commit is contained in:
parent
487117c976
commit
fdf1c98a16
@ -33,51 +33,133 @@ class Storage:
|
|||||||
self.name = name
|
self.name = name
|
||||||
|
|
||||||
async def open(self):
|
async def open(self):
|
||||||
|
"""Opens the storage engine."""
|
||||||
raise NotImplementedError
|
raise NotImplementedError
|
||||||
|
|
||||||
async def save(self):
|
async def save(self):
|
||||||
|
"""Saves the current state of the storage engine."""
|
||||||
raise NotImplementedError
|
raise NotImplementedError
|
||||||
|
|
||||||
async def close(self):
|
async def close(self):
|
||||||
|
"""Closes the storage engine."""
|
||||||
raise NotImplementedError
|
raise NotImplementedError
|
||||||
|
|
||||||
async def delete(self):
|
async def delete(self):
|
||||||
|
"""Deletes the storage."""
|
||||||
raise NotImplementedError
|
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
|
raise NotImplementedError
|
||||||
|
|
||||||
async def get_peer_by_id(self, peer_id: int):
|
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
|
raise NotImplementedError
|
||||||
|
|
||||||
async def get_peer_by_username(self, username: str):
|
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
|
raise NotImplementedError
|
||||||
|
|
||||||
async def get_peer_by_phone_number(self, phone_number: str):
|
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
|
raise NotImplementedError
|
||||||
|
|
||||||
async def dc_id(self, value: int = object):
|
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
|
raise NotImplementedError
|
||||||
|
|
||||||
async def api_id(self, value: int = object):
|
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
|
raise NotImplementedError
|
||||||
|
|
||||||
async def test_mode(self, value: bool = object):
|
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
|
raise NotImplementedError
|
||||||
|
|
||||||
async def auth_key(self, value: bytes = object):
|
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
|
raise NotImplementedError
|
||||||
|
|
||||||
async def date(self, value: int = object):
|
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
|
raise NotImplementedError
|
||||||
|
|
||||||
async def user_id(self, value: int = object):
|
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
|
raise NotImplementedError
|
||||||
|
|
||||||
async def is_bot(self, value: bool = object):
|
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
|
raise NotImplementedError
|
||||||
|
|
||||||
async def export_session_string(self):
|
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(
|
packed = struct.pack(
|
||||||
self.SESSION_STRING_FORMAT,
|
self.SESSION_STRING_FORMAT,
|
||||||
await self.dc_id(),
|
await self.dc_id(),
|
||||||
|
Loading…
Reference in New Issue
Block a user