o
    ×èFhe  ã                   @   sÄ   U d Z ddlmZ ddlmZmZ ddlmZ z%ddlm	Z	 e
ƒ  ¡ Ze	j ¡ D ]\ZZe d¡s:eevr:ee
ƒ e< q(W n eyG   edƒ‚w dZeed	< ddede	jfdd„ZG dd„ dƒZd
S )zÚCloud Firestore Async module.

This module contains utilities for asynchronusly accessing the Google Cloud Firestore databases
associated with Firebase apps. This requires the ``google-cloud-firestore`` Python module.
é    )ÚType)ÚAppÚ_utils)ÚBase)Ú	firestoreÚ_zrFailed to import the Cloud Firestore library for Python. Make sure to install the "google-cloud-firestore" module.Ú_firestore_asyncÚ_FIRESTORE_ASYNC_ATTRIBUTENÚappÚreturnc                 C   s   t  | ttj¡}| ¡ S )a÷  Returns an async client that can be used to interact with Google Cloud Firestore.

    Args:
      app: An App instance (optional).

    Returns:
      google.cloud.firestore.Firestore_Async: A `Firestore Async Client`_.

    Raises:
      ValueError: If a project ID is not specified either via options, credentials or
          environment variables, or if the specified project ID is not a valid string.

    .. _Firestore Async Client: https://googleapis.dev/python/firestore/latest/client.html
    )r   Úget_app_servicer	   Ú_FirestoreAsyncClientÚfrom_appÚget)r
   Ú	fs_client© r   úW/var/www/html/loop/nvenv/lib/python3.10/site-packages/firebase_admin/firestore_async.pyÚclient*   s   ÿr   c                   @   sP   e Zd ZdZdee deddfdd„Zdej	fdd	„Z
ed
edd fdd„ƒZdS )r   z5Holds a Google Cloud Firestore Async Client instance.ÚcredentialsÚprojectr   Nc                 C   s   t j||d�| _d S )N)r   r   )r   ÚAsyncClientÚ_client)Úselfr   r   r   r   r   Ú__init__A   s   z_FirestoreAsyncClient.__init__c                 C   s   | j S ©N)r   )r   r   r   r   r   D   s   z_FirestoreAsyncClient.getr
   c                 C   s&   |j  ¡ }|j}|stdƒ‚t||ƒS )z:Creates a new _FirestoreAsyncClient for the specified app.z²Project ID is required to access Firestore. Either set the projectId option, or use service account credentials. Alternatively, set the GOOGLE_CLOUD_PROJECT environment variable.)Ú
credentialÚget_credentialÚ
project_idÚ
ValueErrorr   )Úclsr
   r   r   r   r   r   r   G   s   
ÿ
z_FirestoreAsyncClient.from_app)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   Ústrr   r   r   r   Úclassmethodr   r   r   r   r   r   r   >   s    r   r   )r#   Útypingr   Úfirebase_adminr   r   Úfirebase_admin.credentialsr   Úgoogle.cloudr   ÚglobalsÚkeysÚexistingÚ__dict__ÚitemsÚkeyÚvalueÚ
startswithÚImportErrorr	   r$   Ú__annotations__r   r   r   r   r   r   r   Ú<module>   s$   

€þÿ