
    g3                        d dl mZ d dlmZmZmZmZmZ d dlm	Z	 d dl
mZmZmZ ddlmZ ddlmZmZ ddlmZ dd	lmZ dd
lmZ ddlmZmZ eeef   Z G d de      Zy)    )annotations)AnyDictOptionalUnioncast)
deprecated)HeadersQueryParamsTimeout   )BasePostgrestClient) DEFAULT_POSTGREST_CLIENT_HEADERS DEFAULT_POSTGREST_CLIENT_TIMEOUT)CountMethodAsyncClient)__version__   )AsyncRequestBuilderAsyncRPCFilterRequestBuilderc                      e Zd ZdZdeeddd	 	 	 	 	 	 	 	 	 	 	 	 	 ddZ	 	 d	 	 	 	 	 	 	 	 	 	 	 ddZddZdd	Z	dd
Z
ddZddZ edded      dd       Z	 	 	 d	 	 	 	 	 	 	 	 	 	 	 ddZy)AsyncPostgrestClientzPostgREST client.publicTNschemaheaderstimeoutverifyproxyc          	     z    t        j                  | ||||||       t        t        | j                        | _        y )Nr   )r   __init__r   r   session)selfbase_urlr   r   r   r   r    s          L/var/www/openai/venv/lib/python3.12/site-packages/postgrest/_async/client.pyr"   zAsyncPostgrestClient.__init__   s;     	$$	
 K6    c           	     &    t        |||||dd      S )NT)r%   r   r   r   r    follow_redirectshttp2r   )r$   r%   r   r   r   r    s         r&   create_sessionz#AsyncPostgrestClient.create_session-   s&     !
 	
r'   c                   K   | S wN r$   s    r&   
__aenter__zAsyncPostgrestClient.__aenter__?   s     s   c                @   K   | j                          d {    y 7 wr-   )aclose)r$   exc_typeexctbs       r&   	__aexit__zAsyncPostgrestClient.__aexit__B   s     kkms   c                T   K   | j                   j                          d{    y7 w)z&Close the underlying HTTP connections.N)r#   r2   r/   s    r&   r2   zAsyncPostgrestClient.acloseE   s     ll!!###s   (&(c                B    t        t           | j                  d|       S )zPerform a table operation.

        Args:
            table: The name of the table
        Returns:
            :class:`AsyncRequestBuilder`
        /)r   _TableTr#   r$   tables     r&   from_zAsyncPostgrestClient.from_I   s      #7+DLLAeW+FFr'   c                $    | j                  |      S zAlias to :meth:`from_`.r=   r;   s     r&   r<   zAsyncPostgrestClient.tableS   s    zz%  r'   z0.2.0z1.0.0zUse self.from_() insteadc                $    | j                  |      S r?   r@   r;   s     r&   
from_tablezAsyncPostgrestClient.from_tableW   s     zz%  r'   c                    |rdn|rdnd}|rt        dd| i      n	t               }t        t           | j                  d| ||t	               |      S )a  Perform a stored procedure call.

        Args:
            func: The name of the remote procedure to run.
            params: The parameters to be passed to the remote procedure.
            count: The method to use to get the count of rows returned.
            head: When set to `true`, `data` will not be returned. Useful if you only need the count.
            get: When set to `true`, the function will be called with read-only access mode.
        Returns:
            :class:`AsyncRPCFilterRequestBuilder`
        Example:
            .. code-block:: python

                await client.rpc("foobar", {"arg": "value"}).execute()

        .. versionchanged:: 0.10.9
            This method now returns a :class:`AsyncRPCFilterRequestBuilder`.
        .. versionchanged:: 0.10.2
            This method now returns a :class:`AsyncFilterRequestBuilder` which allows you to
            filter on the RPC's resultset.
        HEADGETPOSTPreferzcount=z/rpc/)json)r
   r   r   r#   r   )r$   funcparamscountheadgetmethodr   s           r&   rpczAsyncPostgrestClient.rpc\   sZ    :  cUv;@'8veW%567gi ,C0LLE$.&';=v
 	
r'   )r%   strr   rP   r   Dict[str, str]r   Union[int, float, Timeout]r   boolr    Optional[str]returnNone)TN)r%   rP   r   rQ   r   rR   r   rS   r    rT   rU   r   )rU   r   )rU   rV   )r<   rP   rU   zAsyncRequestBuilder[_TableT])r<   rP   rU   r   )NFF)rI   rP   rJ   dictrK   zOptional[CountMethod]rL   rS   rM   rS   rU   z!AsyncRPCFilterRequestBuilder[Any])__name__
__module____qualname____doc__r   r   r"   r+   r0   r6   r2   r=   r<   r	   r   rB   rO   r.   r'   r&   r   r      s+    "B.N#77 	7
  7 ,7 7 7 
74 #

  
 ,	

 
 
 

$$G! +/IJ! K! (,$
$
 $
 %	$

 $
 $
 
+$
r'   r   N)
__future__r   typingr   r   r   r   r   deprecationr	   httpxr
   r   r   base_clientr   	constantsr   r   typesr   utilsr   versionr   request_builderr   r   rP   r:   r   r.   r'   r&   <module>rf      sI    " 3 3 " / / -    ! N
sCx.k
. k
r'   