# Hydrogram - Telegram MTProto API Client Library for Python# Copyright (C) 2023-present Hydrogram <https://hydrogram.org>## This file is part of Hydrogram.## Hydrogram is free software: you can redistribute it and/or modify# it under the terms of the GNU Lesser General Public License as published# by the Free Software Foundation, either version 3 of the License, or# (at your option) any later version.## Hydrogram is distributed in the hope that it will be useful,# but WITHOUT ANY WARRANTY; without even the implied warranty of# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the# GNU Lesser General Public License for more details.## You should have received a copy of the GNU Lesser General Public License# along with Hydrogram. If not, see <http://www.gnu.org/licenses/>.fromioimportBytesIOfromhydrogram.raw.core.primitivesimportInt,Long,Int128,Int256,Bool,Bytes,String,Double,Vectorfromhydrogram.raw.coreimportTLObjectfromhydrogramimportrawfromtypingimportList,Optional,Any# # # # # # # # # # # # # # # # # # # # # # # ## !!! WARNING !!! ## This is a generated file! ## All changes made in this file will be lost! ## # # # # # # # # # # # # # # # # # # # # # # #
[docs]classPage(TLObject):# type: ignore"""Instant view page Constructor of :obj:`~hydrogram.raw.base.Page`. Details: - Layer: ``181`` - ID: ``98657F0D`` Parameters: url (``str``): Original page HTTP URL blocks (List of :obj:`PageBlock <hydrogram.raw.base.PageBlock>`): Page elements (like with HTML elements, only as TL constructors) photos (List of :obj:`Photo <hydrogram.raw.base.Photo>`): Photos in page documents (List of :obj:`Document <hydrogram.raw.base.Document>`): Media in page part (``bool``, *optional*): Indicates that not full page preview is available to the client and it will need to fetch full Instant View from the server using messages.getWebPagePreview. rtl (``bool``, *optional*): Whether the page contains RTL text v2 (``bool``, *optional*): Whether this is an IV v2 page views (``int`` ``32-bit``, *optional*): View count """__slots__:List[str]=["url","blocks","photos","documents","part","rtl","v2","views"]ID=0x98657f0dQUALNAME="types.Page"def__init__(self,*,url:str,blocks:List["raw.base.PageBlock"],photos:List["raw.base.Photo"],documents:List["raw.base.Document"],part:Optional[bool]=None,rtl:Optional[bool]=None,v2:Optional[bool]=None,views:Optional[int]=None)->None:self.url=url# stringself.blocks=blocks# Vector<PageBlock>self.photos=photos# Vector<Photo>self.documents=documents# Vector<Document>self.part=part# flags.0?trueself.rtl=rtl# flags.1?trueself.v2=v2# flags.2?trueself.views=views# flags.3?int@staticmethoddefread(b:BytesIO,*args:Any)->"Page":flags=Int.read(b)part=Trueifflags&(1<<0)elseFalsertl=Trueifflags&(1<<1)elseFalsev2=Trueifflags&(1<<2)elseFalseurl=String.read(b)blocks=TLObject.read(b)photos=TLObject.read(b)documents=TLObject.read(b)views=Int.read(b)ifflags&(1<<3)elseNonereturnPage(url=url,blocks=blocks,photos=photos,documents=documents,part=part,rtl=rtl,v2=v2,views=views)defwrite(self,*args)->bytes:b=BytesIO()b.write(Int(self.ID,False))flags=0flags|=(1<<0)ifself.partelse0flags|=(1<<1)ifself.rtlelse0flags|=(1<<2)ifself.v2else0flags|=(1<<3)ifself.viewsisnotNoneelse0b.write(Int(flags))b.write(String(self.url))b.write(Vector(self.blocks))b.write(Vector(self.photos))b.write(Vector(self.documents))ifself.viewsisnotNone:b.write(Int(self.views))returnb.getvalue()