o
    ÚtBh  ã                   @   s,   d dl mZ d dlmZ G dd„ deƒZdS )é    )ÚHttpMethodEnum)ÚHttpRequestc                   @   sŒ   e Zd ZdZdd„ Zdd„ Zdd„ Zi i fdd	„Zi i fd
d„Zi i i i fdd„Z	i i i i fdd„Z
i i i i fdd„Zi i i i fdd„ZdS )Ú
HttpClientz°An interface for the methods that an HTTP Client must implement

    This class should not be instantiated but should be used as a base class
    for HTTP Client classes.

    c                 C   ó   t dƒ‚)zäExecute a given HttpRequest to get a string response back

        Args:
            request (HttpRequest): The given HttpRequest to execute.

        Returns:
            HttpResponse: The response of the HttpRequest.

        úPlease Implement this method©ÚNotImplementedError©ÚselfÚrequest© r   ún/var/www/html/riverr-enterprise-integrations-main/venv/lib/python3.10/site-packages/square/http/http_client.pyÚexecute_as_string   ó   
zHttpClient.execute_as_stringc                 C   r   )zäExecute a given HttpRequest to get a binary response back

        Args:
            request (HttpRequest): The given HttpRequest to execute.

        Returns:
            HttpResponse: The response of the HttpRequest.

        r   r   r	   r   r   r   Úexecute_as_binary   r   zHttpClient.execute_as_binaryc                 C   r   )zùConverts the Response object of the HttpClient into an
        HttpResponse object.

        Args:
            response (dynamic): The original response object.

        Returns:
            HttpResponse: The converted HttpResponse object.

        r   r   )r
   ÚresponseÚbinaryr   r   r   Úconvert_response(   s   zHttpClient.convert_responsec                 C   ó   t tj|||ddƒS )a¢  Create a simple GET HttpRequest object for the given parameters

        Args:
            query_url (string): The URL to send the request to.
            headers (dict, optional): The headers for the HTTP Request.
            query_parameters (dict, optional): Query parameters to add in the
                URL.

        Returns:
            HttpRequest: The generated HttpRequest for the given paremeters.

        N)r   r   ÚGET©r
   Ú	query_urlÚheadersÚquery_parametersr   r   r   Úget5   ó   ûzHttpClient.getc                 C   r   )a£  Create a simple HEAD HttpRequest object for the given parameters

        Args:
            query_url (string): The URL to send the request to.
            headers (dict, optional): The headers for the HTTP Request.
            query_parameters (dict, optional): Query parameters to add in the
                URL.

        Returns:
            HttpRequest: The generated HttpRequest for the given paremeters.

        N)r   r   ÚHEADr   r   r   r   ÚheadK   r   zHttpClient.headc                 C   ó   t tj|||||ƒS )aW  Create a simple POST HttpRequest object for the given parameters

        Args:
            query_url (string): The URL to send the request to.
            headers (dict, optional): The headers for the HTTP Request.
            query_parameters (dict, optional): Query parameters to add in the
                URL.
            parameters (dict, optional): Form or body parameters to be included
                in the body.
            files (dict, optional): Files to be sent with the request.

        Returns:
            HttpRequest: The generated HttpRequest for the given paremeters.

        )r   r   ÚPOST©r
   r   r   r   Ú
parametersÚfilesr   r   r   Úposta   ó   ûzHttpClient.postc                 C   r   )aV  Create a simple PUT HttpRequest object for the given parameters

        Args:
            query_url (string): The URL to send the request to.
            headers (dict, optional): The headers for the HTTP Request.
            query_parameters (dict, optional): Query parameters to add in the
                URL.
            parameters (dict, optional): Form or body parameters to be included
                in the body.
            files (dict, optional): Files to be sent with the request.

        Returns:
            HttpRequest: The generated HttpRequest for the given paremeters.

        )r   r   ÚPUTr    r   r   r   Úput|   r$   zHttpClient.putc                 C   r   )aX  Create a simple PATCH HttpRequest object for the given parameters

        Args:
            query_url (string): The URL to send the request to.
            headers (dict, optional): The headers for the HTTP Request.
            query_parameters (dict, optional): Query parameters to add in the
                URL.
            parameters (dict, optional): Form or body parameters to be included
                in the body.
            files (dict, optional): Files to be sent with the request.

        Returns:
            HttpRequest: The generated HttpRequest for the given paremeters.

        )r   r   ÚPATCHr    r   r   r   Úpatch—   r$   zHttpClient.patchc                 C   r   )aY  Create a simple DELETE HttpRequest object for the given parameters

        Args:
            query_url (string): The URL to send the request to.
            headers (dict, optional): The headers for the HTTP Request.
            query_parameters (dict, optional): Query parameters to add in the
                URL.
            parameters (dict, optional): Form or body parameters to be
                included in the body.
            files (dict, optional): Files to be sent with the request.

        Returns:
            HttpRequest: The generated HttpRequest for the given paremeters.

        )r   r   ÚDELETEr    r   r   r   Údelete²   r$   zHttpClient.deleteN)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   r   r   r   r   r#   r&   r(   r*   r   r   r   r   r      s>    
þ
þ
ü
ü
üür   N)Úsquare.http.http_method_enumr   Úsquare.http.http_requestr   Úobjectr   r   r   r   r   Ú<module>   s   