o
    tBh                     @   s   d dl Z G dd dZdS )    Nc                   @   s6   e Zd ZdZ		dddZdd Zdd Zd	d
 ZdS )ApiResponseam  Http response received.

    Attributes:
        status_code (int): The status code response from the server that
            corresponds to this response.
        reason_phrase (string): The reason phrase returned by the server.
        headers (dict): A dictionary of headers (key : value) that were
            returned with the response
        text (string): The Raw body of the HTTP Response as a string
        request (HttpRequest): The request that resulted in this response.
        body (Object): The data field specified for the response
        errors (Array<String>): Any errors returned by the server

    Nc                 C   sT   |j | _ |j| _|j| _|j| _|j| _|| _|| _t|tu r(|	d| _
dS dS )a  The Constructor

        Args:
            http_response (HttpResponse): The original, raw response from the api
            data (Object): The data field specified for the response
            errors (Array<String>): Any errors returned by the server

        cursorN)status_codereason_phraseheaderstextrequestbodyerrorstypedictgetr   )selfhttp_responser	   r
    r   o/var/www/html/riverr-enterprise-integrations-main/venv/lib/python3.10/site-packages/square/http/api_response.py__init__   s   zApiResponse.__init__c                 C      d| j   ko
dk S   S )z9 Returns true if status code is between 200-300

           i,  r   r   r   r   r   
is_success,      zApiResponse.is_successc                 C   r   )z9 Returns true if status code is between 400-600

        i  iX  r   r   r   r   r   is_error2   r   zApiResponse.is_errorc                 C   s
   d| j  S )Nz<ApiResponse [%s]>)r   r   r   r   r   __repr__8   s   
zApiResponse.__repr__)NN)__name__
__module____qualname____doc__r   r   r   r   r   r   r   r   r      s    
r   )jsonr   r   r   r   r   <module>   s    