
    Yi                     v    S r SSKrSSKJrJrJrJr  SSKJr  SSK	J
r
  SSKJr  SSKJr  \ " S S	5      5       rg)
zSThis module contains a class that holds the parameters of a request to the Bot API.    N)AnyOptionalUnionfinal)	urlencode)TextEncoding)UploadFileDict)RequestParameterc                      \ rS rSrSrSrSS\\\      4S jjr	\
S\\\\\\\   \\\4   4   4   4S j5       r\
S\\\4   4S	 j5       rSS
\\\\4      S\4S jjrSS\S
\\\\4      S\4S jjr\
S\4S j5       r\
S\4S j5       rSrg)RequestData   a  Instances of this class collect the data needed for one request to the Bot API, including
all parameters and files to be sent along with the request.

.. versionadded:: 20.0

Warning:
    How exactly instances of this are created should be considered an implementation detail
    and not part of PTBs public API. Users should exclusively rely on the documented
    attributes, properties and methods.

Attributes:
    contains_files (:obj:`bool`): Whether this object contains files to be uploaded via
        ``multipart/form-data``.
)_parameterscontains_filesN
parametersc                 f    U=(       d    / U l         [        S U R                    5       5      U l        g )Nc              3   8   #    U  H  oR                   v   M     g 7fN)input_files).0params     H/app/.venv/lib/python3.13/site-packages/telegram/request/_requestdata.py	<genexpr>'RequestData.__init__.<locals>.<genexpr>2   s     'XGWe(9(9GWs   )r   anyr   )selfr   s     r   __init__RequestData.__init__0   s(    3=3C$''XtGWGW'X$X    returnc                     U R                    Vs0 s H)  nUR                  c  M  UR                  UR                  _M+     sn$ s  snf )a  Gives the parameters as mapping of parameter name to the parameter value, which can be
a single object of type :obj:`int`, :obj:`float`, :obj:`str` or :obj:`bool` or any
(possibly nested) composition of lists, tuples and dictionaries, where each entry, key
and value is of one of the mentioned types.

Returns:
    dict[:obj:`str`, Union[:obj:`str`, :obj:`int`, list[any], dict[any, any]]]
)r   valuenamer   r   s     r   r   RequestData.parameters4   sE     ))
){{ $EJJ#)
 	
 

   AAc                     U R                    Vs0 s H)  nUR                  c  M  UR                  UR                  _M+     sn$ s  snf )a|  Gives the parameters as mapping of parameter name to the respective JSON encoded
value.

Tip:
    By default, this property uses the standard library's :func:`json.dumps`.
    To use a custom library for JSON encoding, you can directly encode the keys of
    :attr:`parameters` - note that string valued keys should not be JSON encoded.

Returns:
    dict[:obj:`str`, :obj:`str`]
)r   
json_valuer"   r#   s     r   json_parametersRequestData.json_parametersD   sI     ))
) )EJJ((()
 	
 
r%   encode_kwargsc                 f    U(       a  [        U R                  40 UD6$ [        U R                  5      $ )zEncodes the parameters with :func:`urllib.parse.urlencode`.

Args:
    encode_kwargs (dict[:obj:`str`, any], optional): Additional keyword arguments to pass
        along to :func:`urllib.parse.urlencode`.

Returns:
    :obj:`str`
)r   r(   )r   r*   s     r   url_encoded_parameters"RequestData.url_encoded_parametersW   s.     T11C]CC--..r   urlc                 .    U R                  US9nU SU 3$ )aO  Shortcut for attaching the return value of :meth:`url_encoded_parameters` to the
:paramref:`url`.

Args:
    url (:obj:`str`): The URL the parameters will be attached to.
    encode_kwargs (dict[:obj:`str`, any], optional): Additional keyword arguments to pass
        along to :func:`urllib.parse.urlencode`.

Returns:
    :obj:`str`
)r*   ?)r,   )r   r.   r*   url_parameterss       r   parametrized_urlRequestData.parametrized_urle   s)     44=4Qa'((r   c                 |    [         R                  " U R                  5      R                  [        R
                  5      $ )aJ  The :attr:`parameters` as UTF-8 encoded JSON payload.

Tip:
    By default, this property uses the standard library's :func:`json.dumps`.
    To use a custom library for JSON encoding, you can directly encode the keys of
    :attr:`parameters` - note that string valued keys should not be JSON encoded.

Returns:
    :obj:`bytes`
)jsondumpsr(   encoder   UTF_8)r   s    r   json_payloadRequestData.json_payloadt   s*     zz$../66|7I7IJJr   c                 |    0 nU R                    H)  nUR                  nU(       d  M  UR                  U5        M+     U$ )zGives the files contained in this object as mapping of part name to encoded content.

.. versionchanged:: 21.5
    Content may now be a file handle.
)r   multipart_dataupdate)r   r<   r   m_datas       r   r<   RequestData.multipart_data   s?     *,%%E))Fv%%f- & r   r   )__name__
__module____qualname____firstlineno____doc__	__slots__r   listr
   r   propertydictstrr   intr   r   r(   r,   r2   bytesr9   r	   r<   __static_attributes__ r   r   r   r      s    2IY8D1A,B#C Y 
DeCd3ic3h,O&P!PQ 
 
 
c3h 
 
$/HT#s(^4L /X[ /)C )c3h8P )\_ ) Ke K K   r   r   )rD   r5   typingr   r   r   r   urllib.parser   telegram._utils.stringsr   telegram._utils.typesr	   "telegram.request._requestparameterr
   r   rM   r   r   <module>rS      s<   & Z  . . " 0 0 ? p p pr   