o
    ˷ee                     @   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 )zCloud 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   U/var/www/ideatree/venv/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.zProject 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$   

