|
| 1 | +# Pyrogram - Telegram MTProto API Client Library for Python |
| 2 | +# Copyright (C) 2017-present Dan <https://github.com/delivrance> |
| 3 | +# |
| 4 | +# This file is part of Pyrogram. |
| 5 | +# |
| 6 | +# Pyrogram is free software: you can redistribute it and/or modify |
| 7 | +# it under the terms of the GNU Lesser General Public License as published |
| 8 | +# by the Free Software Foundation, either version 3 of the License, or |
| 9 | +# (at your option) any later version. |
| 10 | +# |
| 11 | +# Pyrogram is distributed in the hope that it will be useful, |
| 12 | +# but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 14 | +# GNU Lesser General Public License for more details. |
| 15 | +# |
| 16 | +# You should have received a copy of the GNU Lesser General Public License |
| 17 | +# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>. |
| 18 | + |
| 19 | +from io import BytesIO |
| 20 | +from typing import TYPE_CHECKING, List, Optional, Any |
| 21 | + |
| 22 | +from pyrogram.raw.core.primitives import Int, Long, Int128, Int256, Bool, Bytes, String, Double, Vector |
| 23 | +from pyrogram.raw.core import TLObject |
| 24 | + |
| 25 | +if TYPE_CHECKING: |
| 26 | + from pyrogram import raw |
| 27 | + |
| 28 | +# # # # # # # # # # # # # # # # # # # # # # # # |
| 29 | +# !!! WARNING !!! # |
| 30 | +# This is a generated file! # |
| 31 | +# All changes made in this file will be lost! # |
| 32 | +# # # # # # # # # # # # # # # # # # # # # # # # |
| 33 | + |
| 34 | + |
| 35 | +class AccessPointRule(TLObject["raw.base.AccessPointRule"]): |
| 36 | + """Telegram API method. |
| 37 | +
|
| 38 | + Details: |
| 39 | + - Layer: ``223`` |
| 40 | + - ID: ``4679B65F`` |
| 41 | +
|
| 42 | + Parameters: |
| 43 | + phone_prefix_rules: ``str`` |
| 44 | + dc_id: ``int`` ``32-bit`` |
| 45 | + ips: List of :obj:`IpPort <pyrogram.raw.base.IpPort>` |
| 46 | +
|
| 47 | + Returns: |
| 48 | + :obj:`AccessPointRule <pyrogram.raw.base.AccessPointRule>` |
| 49 | + """ |
| 50 | + |
| 51 | + __slots__: List[str] = ["phone_prefix_rules", "dc_id", "ips"] |
| 52 | + |
| 53 | + ID = 0x4679b65f |
| 54 | + QUALNAME = "functions.AccessPointRule" |
| 55 | + |
| 56 | + def __init__(self, *, phone_prefix_rules: str, dc_id: int, ips: List["raw.base.IpPort"]) -> None: |
| 57 | + self.phone_prefix_rules = phone_prefix_rules # string |
| 58 | + self.dc_id = dc_id # int |
| 59 | + self.ips = ips # vector<IpPort> |
| 60 | + |
| 61 | + @staticmethod |
| 62 | + def read(b: BytesIO, *args: Any) -> "AccessPointRule": |
| 63 | + # No flags |
| 64 | + |
| 65 | + phone_prefix_rules = String.read(b) |
| 66 | + |
| 67 | + dc_id = Int.read(b) |
| 68 | + |
| 69 | + ips = TLObject.read(b) |
| 70 | + |
| 71 | + return AccessPointRule(phone_prefix_rules=phone_prefix_rules, dc_id=dc_id, ips=ips) |
| 72 | + |
| 73 | + def write(self, *args) -> bytes: |
| 74 | + b = BytesIO() |
| 75 | + b.write(Int(self.ID, False)) |
| 76 | + |
| 77 | + # No flags |
| 78 | + |
| 79 | + b.write(String(self.phone_prefix_rules)) |
| 80 | + |
| 81 | + b.write(Int(self.dc_id)) |
| 82 | + |
| 83 | + b.write(Vector(self.ips)) |
| 84 | + |
| 85 | + return b.getvalue() |
0 commit comments