a
    9g
                     @  s   d dl mZ d dlmZmZ d dlmZmZmZm	Z	m
Z
mZmZmZ d dlmZmZ d dlmZ d dlmZ ddlmZmZ dd	lmZ erdd
lmZ ededZG dd deZG dd deee ZG dd deeee eZdS )    )annotations)ABCabstractmethod)TYPE_CHECKINGAnyClassVarDict	GeneratorGenericOptionalTypeVar)	BaseModel
ConfigDict)model_validator)BotContextController   )	InputFileResponseParameters)
UNSET_TYPE)BotTelegramType)boundc                   @  s0   e Zd ZU eddZded< ded< ded< d	S )
RequestT)arbitrary_types_allowedstrmethodzDict[str, Optional[Any]]datazOptional[Dict[str, InputFile]]filesN)__name__
__module____qualname__r   model_config__annotations__ r#   r#   q/var/www/vosh/data/www/fastworkle.ru/webshop-tgbot-v.1.0/venv/lib/python3.9/site-packages/aiogram/methods/base.pyr      s   

r   c                   @  sF   e Zd ZU ded< dZded< dZded< dZded	< dZd
ed< dS )ResponseboolokNzOptional[TelegramType]resultzOptional[str]descriptionzOptional[int]
error_codezOptional[ResponseParameters]
parameters)r   r   r    r"   r(   r)   r*   r+   r#   r#   r#   r$   r%   &   s
   
r%   c                   @  s   e Zd ZU eddddZeddeddddd	ZerLd
e	d< de	d< n,e
eddddZe
eddddZdddddZddddZdS )TelegramMethodZallowT)extraZpopulate_by_namer   before)modezDict[str, Any])valuesreturnc                 C  s    t |ts|S dd | D S )a  
        Remove UNSET before fields validation.

        We use UNSET as a sentinel value for `parse_mode` and replace it to real value later.
        It isn't a problem when it's just default value for a model field,
        but UNSET might be passing to a model initialization from `Bot.method_name`,
        so we must take care of it and remove it before fields validation.
        c                 S  s    i | ]\}}t |ts||qS r#   )
isinstancer   ).0kvr#   r#   r$   
<dictcomp>B       z/TelegramMethod.remove_unset.<locals>.<dictcomp>)r2   dictitems)clsr0   r#   r#   r$   remove_unset5   s    
zTelegramMethod.remove_unsetzClassVar[type]__returning__zClassVar[str]__api_method__type)r1   c                 C  s   d S Nr#   selfr#   r#   r$   r<   I   s    zTelegramMethod.__returning__r   c                 C  s   d S r?   r#   r@   r#   r#   r$   r=   N   s    zTelegramMethod.__api_method__r   r   )botr1   c                   s   || I d H S r?   r#   rA   rB   r#   r#   r$   emitS   s    zTelegramMethod.emitz"Generator[Any, None, TelegramType]c                 C  s    | j }|std| | S )NzThis method is not mounted to a any bot instance, please call it explicilty with bot instance `await bot(method)`
or mount method to a bot instance `method.as_(bot)` and then call it `await method`)Z_botRuntimeErrorrD   	__await__rC   r#   r#   r$   rF   V   s    zTelegramMethod.__await__N)r   r   r    r   r!   r   classmethodr;   r   r"   propertyr   r<   r=   rD   rF   r#   r#   r#   r$   r,   .   s&   

r,   N) 
__future__r   abcr   r   typingr   r   r   r   r	   r
   r   r   Zpydanticr   r   Zpydantic.functional_validatorsr   Z!aiogram.client.context_controllerr   typesr   r   Z
types.baser   Z
client.botr   r   r   r%   r,   r#   r#   r#   r$   <module>   s   (	