o
    `g                     @  s   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 deZdS )    )annotations)AnyDictOptionalUnioncast)
deprecated)HeadersQueryParamsTimeout   )BasePostgrestClient) DEFAULT_POSTGREST_CLIENT_HEADERS DEFAULT_POSTGREST_CLIENT_TIMEOUT)CountMethod
SyncClient)__version__   )SyncRequestBuilderSyncRPCFilterRequestBuilderc                   @  s   e Zd ZdZdeedddd5ddZ		d6d7ddZd8ddZd9ddZ	d9ddZ
d:d d!Zd:d"d#Zed$d%ed&d;d(d)Z		*	*d<d=d3d4ZdS )>SyncPostgrestClientzPostgREST client.publicTNschemaheaderstimeoutverifyproxybase_urlstrr   r   Dict[str, str]r   Union[int, float, Timeout]r   boolr   Optional[str]returnNonec             	   C  s*   t j| ||||||d tt| j| _d S )Nr   )r   __init__r   r   session)selfr   r   r   r   r   r    r*   Q/var/www/html/propose/venv/lib/python3.10/site-packages/postgrest/_sync/client.pyr'      s   
	zSyncPostgrestClient.__init__r   c              	   C  s   t |||||dddS )NT)r   r   r   r   r   follow_redirectshttp2r   )r)   r   r   r   r   r   r*   r*   r+   create_session-   s   z"SyncPostgrestClient.create_sessionc                 C  s   | S Nr*   r)   r*   r*   r+   	__enter__?   s   zSyncPostgrestClient.__enter__c                 C  s   |    d S r/   )aclose)r)   exc_typeexctbr*   r*   r+   __exit__B   s   zSyncPostgrestClient.__exit__c                 C  s   | j   dS )z&Close the underlying HTTP connections.N)r(   r2   r0   r*   r*   r+   r2   E   s   zSyncPostgrestClient.aclosetableSyncRequestBuilder[_TableT]c                 C  s   t t | jd| S )zPerform a table operation.

        Args:
            table: The name of the table
        Returns:
            :class:`AsyncRequestBuilder`
        /)r   _TableTr(   r)   r7   r*   r*   r+   from_I   s   zSyncPostgrestClient.from_c                 C  
   |  |S zAlias to :meth:`from_`.r<   r;   r*   r*   r+   r7   S   s   
zSyncPostgrestClient.tablez0.2.0z1.0.0zUse self.from_() insteadr   c                 C  r=   r>   r?   r;   r*   r*   r+   
from_tableW   s   
zSyncPostgrestClient.from_tableFfuncparamsdictcountOptional[CountMethod]headget SyncRPCFilterRequestBuilder[Any]c                 C  sR   |rdn|rdnd}|rt dd| int  }tt | jd| ||t |d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)   rA   rB   rD   rF   rG   methodr   r*   r*   r+   rpc\   s
   zSyncPostgrestClient.rpc)r   r    r   r    r   r!   r   r"   r   r#   r   r$   r%   r&   )TN)r   r    r   r!   r   r"   r   r#   r   r$   r%   r   )r%   r   )r%   r&   )r7   r    r%   r8   )r7   r    r%   r   )NFF)rA   r    rB   rC   rD   rE   rF   r#   rG   r#   r%   rH   )__name__
__module____qualname____doc__r   r   r'   r.   r1   r6   r2   r<   r7   r   r   r@   rO   r*   r*   r*   r+   r      s,    





r   N)
__future__r   typingr   r   r   r   r   deprecationr   httpxr	   r
   r   base_clientr   	constantsr   r   typesr   utilsr   versionr   request_builderr   r   r    r:   r   r*   r*   r*   r+   <module>   s    