Ë
    V¼Sfn  ã                  ój   — d Z ddlmZ ddlmZ ddlmZ ddlmZm	Z	m
Z
 ddlmZmZmZ  G d„ de«      Zy	)
aq  Classes for representing Async aggregation queries for the Google Cloud Firestore API.

A :class:`~google.cloud.firestore_v1.async_aggregation.AsyncAggregationQuery` can be created directly from
a :class:`~google.cloud.firestore_v1.async_collection.AsyncCollection` and that can be
a more common way to create an aggregation query than direct usage of the constructor.
é    )Úannotations)Úgapic_v1)Úretry_async)ÚListÚUnionÚAsyncGenerator)ÚAggregationResultÚ_query_response_to_resultÚBaseAggregationQueryc                  ó¬   ‡ — e Zd ZdZ	 	 dˆ fd„Zdej                  j                  df	 	 	 	 	 dd„Zdej                  j                  df	 	 	 	 	 dd„Z	ˆ xZ
S )	ÚAsyncAggregationQueryz5Represents an aggregation query to the Firestore API.c                ó,   •— t         t        | �  |«       y )N)Úsuperr   Ú__init__)ÚselfÚnested_queryÚ	__class__s     €újC:\Users\user\Documents\project_loop\venv\Lib\site-packages\google/cloud/firestore_v1/async_aggregation.pyr   zAsyncAggregationQuery.__init__'   s   ø€ ô 	Ô# TÑ3°LÕAó    Nc              ƒ  ón   K  — | j                  |||¬«      }|2 �cg c3 d{  –—† }|‘Œ7 Œ6 }}|S c c}w ­w)a�  Runs the aggregation query.

        This sends a ``RunAggregationQuery`` RPC and returns a list of aggregation results in the stream of ``RunAggregationQueryResponse`` messages.

        Args:
            transaction
                (Optional[:class:`~google.cloud.firestore_v1.transaction.Transaction`]):
                An existing transaction that this query will run in.
                If a ``transaction`` is used and it already has write operations
                added, this method cannot be used (i.e. read-after-write is not
                allowed).
            retry (google.api_core.retry.Retry): Designation of what errors, if any,
                should be retried.  Defaults to a system-specified policy.
            timeout (float): The timeout for this request.  Defaults to a
                system-specified value.

        Returns:
            list: The aggregation query results

        )ÚtransactionÚretryÚtimeoutN)Ústream)r   r   r   r   Ústream_resultÚaggregationÚresults          r   ÚgetzAsyncAggregationQuery.get-   sJ   è ø€ ð8 Ÿ™Ø#¨5¸'ð $ó 
ˆð 8E×EÔE¨’+ÐEøÐEˆÐEØˆùò Fùs$   ‚5›0�+¡)
¢+¥0©+«0¬	5c               ó  K  — | j                  |||«      \  }} | j                  j                  j                  d|| j                  j                  dœ|¤Žƒ d{  –—† }|2 3 d{  –—† }t        |«      }|­–— Œ7 Œ 7 Œ6 y­w)aù  Runs the aggregation query.

        This sends a ``RunAggregationQuery`` RPC and then returns an iterator which
        consumes each document returned in the stream of ``RunAggregationQueryResponse``
        messages.

        If a ``transaction`` is used and it already has write operations
        added, this method cannot be used (i.e. read-after-write is not
        allowed).

        Args:
            transaction
                (Optional[:class:`~google.cloud.firestore_v1.transaction.Transaction`]):
                An existing transaction that this query will run in.
            retry (google.api_core.retry.Retry): Designation of what errors, if any,
                should be retried.  Defaults to a system-specified policy.
            timeout (float): The timeout for this request.  Defaults to a
                system-specified value.

        Yields:
            :class:`~google.cloud.firestore_v1.base_aggregation.AggregationResult`:
            The result of aggregations of this query
        )ÚrequestÚmetadataN© )Ú_prep_streamÚ_clientÚ_firestore_apiÚrun_aggregation_queryÚ_rpc_metadatar
   )	r   r   r   r   r    ÚkwargsÚresponse_iteratorÚresponser   s	            r   r   zAsyncAggregationQuery.streamO   s˜   è ø€ ð> ×+Ñ+ØØØó
‰ˆ�ð #T $§,¡,×"=Ñ"=×"SÑ"Sð #
ØØ—\‘\×/Ñ/ñ#
ð ñ#
÷ 
Ðð 0÷ 	ð 	�(Ü.¨xÓ8ˆFØŒLð
øð	øÑ/ùs6   ‚AB ÁA:ÁB Á A>Á$A<Á%A>Á(B Á<A>Á>B )ÚreturnÚNone)r   ú?Union[retries.AsyncRetry, None, gapic_v1.method._MethodDefault]r   úfloat | Noner+   zList[AggregationResult])r   r-   r   r.   r+   z4Union[AsyncGenerator[List[AggregationResult], None]])Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   ÚmethodÚDEFAULTr   r   Ú__classcell__)r   s   @r   r   r   $   sŒ   ø„ Ù?ðBð 
õBð ð �O‰O×#Ñ#Ø $ð ð
ð ð ð ð 
!ó ðH ð �O‰O×#Ñ#Ø $ð-ð
ð-ð ð-ð 
>÷-r   r   N)r2   Ú
__future__r   Úgoogle.api_corer   r   ÚretriesÚtypingr   r   r   Ú*google.cloud.firestore_v1.base_aggregationr	   r
   r   r   r"   r   r   ú<module>r;      s4   ðñõ #å $Ý 2ç .Ñ .÷ñ ôXÐ0õ Xr   