Source code for hydrogram.raw.functions.account.upload_theme
# 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]classUploadTheme(TLObject):# type: ignore"""Upload theme Details: - Layer: ``181`` - ID: ``1C3DB333`` Parameters: file (:obj:`InputFile <hydrogram.raw.base.InputFile>`): Previously uploaded theme file with platform-specific colors for UI components, can be left unset when creating themes that only modify the wallpaper or accent colors. file_name (``str``): File name mime_type (``str``): MIME type, must be application/x-tgtheme-{format}, where format depends on the client thumb (:obj:`InputFile <hydrogram.raw.base.InputFile>`, *optional*): Thumbnail Returns: :obj:`Document <hydrogram.raw.base.Document>` """__slots__:List[str]=["file","file_name","mime_type","thumb"]ID=0x1c3db333QUALNAME="functions.account.UploadTheme"def__init__(self,*,file:"raw.base.InputFile",file_name:str,mime_type:str,thumb:"raw.base.InputFile"=None)->None:self.file=file# InputFileself.file_name=file_name# stringself.mime_type=mime_type# stringself.thumb=thumb# flags.0?InputFile@staticmethoddefread(b:BytesIO,*args:Any)->"UploadTheme":flags=Int.read(b)file=TLObject.read(b)thumb=TLObject.read(b)ifflags&(1<<0)elseNonefile_name=String.read(b)mime_type=String.read(b)returnUploadTheme(file=file,file_name=file_name,mime_type=mime_type,thumb=thumb)defwrite(self,*args)->bytes:b=BytesIO()b.write(Int(self.ID,False))flags=0flags|=(1<<0)ifself.thumbisnotNoneelse0b.write(Int(flags))b.write(self.file.write())ifself.thumbisnotNone:b.write(self.thumb.write())b.write(String(self.file_name))b.write(String(self.mime_type))returnb.getvalue()