o
    /h                     @  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d3ddZ	d4d5ddZd6ddZd7ddZ	d7ddZ
d8ddZd8dd Zed!d"ed#d9d%d&Z	'	(	(d:d;d1d2Zd'S )<SyncPostgrestClientzPostgREST client.publicTschemaheaderstimeoutverifybase_urlstrr   r   Dict[str, str]r   Union[int, float, Timeout]r   boolreturnNonec                C  s(   t j| |||||d tt| j| _d S )Nr   )r   __init__r   r   session)selfr   r   r   r   r    r(   O/var/www/html/govbot/env/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   follow_redirectshttp2r   )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__>   s   zSyncPostgrestClient.__exit__c                 C  s   | j   dS )z&Close the underlying HTTP connections.N)r&   r0   r.   r(   r(   r)   r0   A   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'   r5   r(   r(   r)   from_E   s   zSyncPostgrestClient.from_c                 C  
   |  |S zAlias to :meth:`from_`.r:   r9   r(   r(   r)   r5   O   s   
zSyncPostgrestClient.tablez0.2.0z1.0.0zUse self.from_() insteadr   c                 C  r;   r<   r=   r9   r(   r(   r)   
from_tableS   s   
zSyncPostgrestClient.from_tableNF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'   r?   r@   rB   rD   rE   methodr   r(   r(   r)   rpcX   s
   zSyncPostgrestClient.rpc)r   r   r   r   r   r    r   r!   r   r"   r#   r$   )T)
r   r   r   r    r   r!   r   r"   r#   r   )r#   r   )r#   r$   )r5   r   r#   r6   )r5   r   r#   r   )NFF)r?   r   r@   rA   rB   rC   rD   r"   rE   r"   r#   rF   )__name__
__module____qualname____doc__r   r   r%   r,   r/   r4   r0   r:   r5   r   r   r>   rM   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   r8   r   r(   r(   r(   r)   <module>   s    