a
    !fX                     @   s   d Z ddlmZ ddlmZmZmZmZmZmZm	Z	 ddl
mZmZmZ ddlmZ ddlmZ ddlmZ ddlmZ dd	lmZ G d
d deZG dd deZG dd deZG dd deZdS )a  
    This code was generated by
   ___ _ _ _ _ _    _ ____    ____ ____ _    ____ ____ _  _ ____ ____ ____ ___ __   __
    |  | | | | |    | |  | __ |  | |__| | __ | __ |___ |\ | |___ |__/ |__|  | |  | |__/
    |  |_|_| | |___ | |__|    |__| |  | |    |__] |___ | \| |___ |  \ |  |  | |__| |  \

    Twilio - Monitor
    This is the public Twilio REST API.

    NOTE: This class is auto generated by OpenAPI Generator.
    https://openapi-generator.tech
    Do not edit the class manually.
    )datetime)AnyDictListOptionalUnionIteratorAsyncIterator)deserialize	serializevalues)InstanceContext)InstanceResource)ListResource)Version)Pagec                       st   e Zd ZdZdeeeef ee d fddZ	e
dddd	Zd dd
dZd dddZedddZ  ZS )AlertInstancea  
    :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the Alert resource.
    :ivar alert_text: The text of the alert.
    :ivar api_version: The API version used when the alert was generated.  Can be empty for events that don't have a specific API version.
    :ivar date_created: The date and time in GMT when the resource was created specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
    :ivar date_generated: The date and time in GMT when the alert was generated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601#UTC) format.  Due to buffering, this can be different than `date_created`.
    :ivar date_updated: The date and time in GMT when the resource was last updated specified in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format.
    :ivar error_code: The error code for the condition that generated the alert. See the [Error Dictionary](https://www.twilio.com/docs/api/errors) for possible causes and solutions to the error.
    :ivar log_level: The log level.  Can be: `error`, `warning`, `notice`, or `debug`.
    :ivar more_info: The URL of the page in our [Error Dictionary](https://www.twilio.com/docs/api/errors) with more information about the error condition.
    :ivar request_method: The method used by the request that generated the alert. If the alert was generated by a request we made to your server, this is the method we used. If the alert was generated by a request from your application to our API, this is the method your application used.
    :ivar request_url: The URL of the request that generated the alert. If the alert was generated by a request we made to your server, this is the URL on your server that generated the alert. If the alert was generated by a request from your application to our API, this is the URL of the resource requested.
    :ivar request_variables: The variables passed in the request that generated the alert. This value is only returned when a single Alert resource is fetched.
    :ivar resource_sid: The SID of the resource for which the alert was generated.  For instance, if your server failed to respond to an HTTP request during the flow of a particular call, this value would be the SID of the server.  This value is empty if the alert was not generated for a particular resource.
    :ivar response_body: The response body of the request that generated the alert. This value is only returned when a single Alert resource is fetched.
    :ivar response_headers: The response headers of the request that generated the alert. This value is only returned when a single Alert resource is fetched.
    :ivar sid: The unique string that we created to identify the Alert resource.
    :ivar url: The absolute URL of the Alert resource.
    :ivar request_headers: The request headers of the request that generated the alert. This value is only returned when a single Alert resource is fetched.
    :ivar service_sid: The SID of the service or resource that generated the alert. Can be `null`.
    N)versionpayloadsidc                    s  t  | |d| _|d| _|d| _t|d| _t|d| _	t|d| _
|d| _|d| _|d	| _|d
| _|d| _|d| _|d| _|d| _|d| _|d| _|d| _|d| _|d| _d|p| ji| _d | _d S )Naccount_sid
alert_textapi_versiondate_createddate_generateddate_updated
error_code	log_level	more_inforequest_methodrequest_urlrequest_variablesresource_sidresponse_bodyresponse_headersr   urlrequest_headersservice_sid)super__init__getr   r   r   r
   iso8601_datetimer   r   r   r   r   r   r   r    r!   r"   r#   r$   r   r%   r&   r'   	_solution_context)selfr   r   r   	__class__ ]/var/www/html/python-backend/venv/lib/python3.9/site-packages/twilio/rest/monitor/v1/alert.pyr)   2   s:    zAlertInstance.__init__AlertContextreturnc                 C   s&   | j du r t| j| jd d| _ | j S )z
        Generate an instance context for the instance, the context is capable of
        performing various actions. All instance actions are proxied to the context

        :returns: AlertContext for this AlertInstance
        Nr   r   )r-   r3   _versionr,   r.   r1   r1   r2   _proxyV   s    
zAlertInstance._proxyc                 C   s
   | j  S )W
        Fetch the AlertInstance


        :returns: The fetched AlertInstance
        )r9   fetchr8   r1   r1   r2   r;   e   s    zAlertInstance.fetchc                    s   | j  I dH S )q
        Asynchronous coroutine to fetch the AlertInstance


        :returns: The fetched AlertInstance
        N)r9   fetch_asyncr8   r1   r1   r2   r=   n   s    zAlertInstance.fetch_asyncc                 C   s$   d dd | j D }d|S )f
        Provide a friendly representation

        :returns: Machine friendly representation
         c                 s   s   | ]\}}d  ||V  qdS z{}={}Nformat.0kvr1   r1   r2   	<genexpr>}       z)AlertInstance.__repr__.<locals>.<genexpr>z$<Twilio.Monitor.V1.AlertInstance {}>joinr,   itemsrB   r.   contextr1   r1   r2   __repr__w   s    zAlertInstance.__repr__)N)__name__
__module____qualname____doc__r   r   strr   r   r)   propertyr9   r;   r=   rN   __classcell__r1   r1   r/   r2   r      s    $		r   c                       sN   e Zd Zeed fddZedddZedddZedd	d
Z	  Z
S )r3   )r   r   c                    s.   t  | d|i| _djf i | j| _dS )z
        Initialize the AlertContext

        :param version: Version that contains the resource
        :param sid: The SID of the Alert resource to fetch.
        r   z/Alerts/{sid}N)r(   r)   r,   rB   _uri)r.   r   r   r/   r1   r2   r)      s    zAlertContext.__init__r4   c                 C   s(   | j jd| jd}t| j || jd dS )r:   GETmethodurir   r6   )r7   r;   rV   r   r,   r.   r   r1   r1   r2   r;      s    zAlertContext.fetchc                    s.   | j jd| jdI dH }t| j || jd dS )r<   rW   rX   Nr   r6   )r7   r=   rV   r   r,   r[   r1   r1   r2   r=      s    zAlertContext.fetch_asyncc                 C   s$   d dd | j D }d|S )r>   r?   c                 s   s   | ]\}}d  ||V  qdS r@   rA   rC   r1   r1   r2   rG      rH   z(AlertContext.__repr__.<locals>.<genexpr>z#<Twilio.Monitor.V1.AlertContext {}>rI   rL   r1   r1   r2   rN      s    zAlertContext.__repr__)rO   rP   rQ   r   rS   r)   r   r;   r=   rN   rU   r1   r1   r/   r2   r3      s   r3   c                   @   s2   e Zd Zeeef edddZedddZdS )	AlertPage)r   r5   c                 C   s   t | j|S )zk
        Build an instance of AlertInstance

        :param payload: Payload response from the API
        )r   r7   r[   r1   r1   r2   get_instance   s    zAlertPage.get_instancer4   c                 C   s   dS )r>   z<Twilio.Monitor.V1.AlertPage>r1   r8   r1   r1   r2   rN      s    zAlertPage.__repr__N)	rO   rP   rQ   r   rS   r   r   r]   rN   r1   r1   r1   r2   r\      s   r\   c                	       sp  e Zd Zed fddZejejejddfeee	f ee
e	f ee
e	f ee ee ee dddZejejejddfeee	f ee
e	f ee
e	f ee ee ee ddd	Zejejejddfeee	f ee
e	f ee
e	f ee ee ee dd
dZejejejddfeee	f ee
e	f ee
e	f ee ee ee dddZejejejejejejfeee	f ee
e	f ee
e	f eee	f eee	f eee	f edddZejejejejejejfeee	f ee
e	f ee
e	f eee	f eee	f eee	f edddZeedddZeedddZeedddZeedddZedddZ  ZS ) 	AlertList)r   c                    s   t  | d| _dS )zg
        Initialize the AlertList

        :param version: Version that contains the resource

        z/AlertsN)r(   r)   rV   )r.   r   r/   r1   r2   r)      s    zAlertList.__init__N)r   
start_dateend_datelimit	page_sizer5   c                 C   s6   | j ||}| j||||d d}| j ||d S )a  
        Streams AlertInstance records from the API as a generator stream.
        This operation lazily loads records as efficiently as possible until the limit
        is reached.
        The results are returned as a generator, so this operation is memory efficient.

        :param str log_level: Only show alerts for this log-level.  Can be: `error`, `warning`, `notice`, or `debug`.
        :param datetime start_date: Only include alerts that occurred on or after this date and time. Specify the date and time in GMT and format as `YYYY-MM-DD` or `YYYY-MM-DDThh:mm:ssZ`. Queries for alerts older than 30 days are not supported.
        :param datetime end_date: Only include alerts that occurred on or before this date and time. Specify the date and time in GMT and format as `YYYY-MM-DD` or `YYYY-MM-DDThh:mm:ssZ`. Queries for alerts older than 30 days are not supported.
        :param limit: Upper limit for the number of records to return. stream()
                      guarantees to never return more than limit.  Default is no limit
        :param page_size: Number of records to fetch per request, when not set will use
                          the default value of 50 records.  If no page_size is defined
                          but a limit is defined, stream() will attempt to read the
                          limit with the most efficient page size, i.e. min(limit, 1000)

        :returns: Generator that will yield up to limit results
        rb   r   r_   r`   rb   ra   )r7   read_limitspagestreamr.   r   r_   r`   ra   rb   Zlimitsre   r1   r1   r2   rf      s    zAlertList.streamc                    s<   | j ||}| j||||d dI dH }| j ||d S )a  
        Asynchronously streams AlertInstance records from the API as a generator stream.
        This operation lazily loads records as efficiently as possible until the limit
        is reached.
        The results are returned as a generator, so this operation is memory efficient.

        :param str log_level: Only show alerts for this log-level.  Can be: `error`, `warning`, `notice`, or `debug`.
        :param datetime start_date: Only include alerts that occurred on or after this date and time. Specify the date and time in GMT and format as `YYYY-MM-DD` or `YYYY-MM-DDThh:mm:ssZ`. Queries for alerts older than 30 days are not supported.
        :param datetime end_date: Only include alerts that occurred on or before this date and time. Specify the date and time in GMT and format as `YYYY-MM-DD` or `YYYY-MM-DDThh:mm:ssZ`. Queries for alerts older than 30 days are not supported.
        :param limit: Upper limit for the number of records to return. stream()
                      guarantees to never return more than limit.  Default is no limit
        :param page_size: Number of records to fetch per request, when not set will use
                          the default value of 50 records.  If no page_size is defined
                          but a limit is defined, stream() will attempt to read the
                          limit with the most efficient page size, i.e. min(limit, 1000)

        :returns: Generator that will yield up to limit results
        rb   rc   Nra   )r7   rd   
page_asyncstream_asyncrg   r1   r1   r2   ri     s    zAlertList.stream_asyncc                 C   s   t | j|||||dS )aY  
        Lists AlertInstance records from the API as a list.
        Unlike stream(), this operation is eager and will load `limit` records into
        memory before returning.

        :param str log_level: Only show alerts for this log-level.  Can be: `error`, `warning`, `notice`, or `debug`.
        :param datetime start_date: Only include alerts that occurred on or after this date and time. Specify the date and time in GMT and format as `YYYY-MM-DD` or `YYYY-MM-DDThh:mm:ssZ`. Queries for alerts older than 30 days are not supported.
        :param datetime end_date: Only include alerts that occurred on or before this date and time. Specify the date and time in GMT and format as `YYYY-MM-DD` or `YYYY-MM-DDThh:mm:ssZ`. Queries for alerts older than 30 days are not supported.
        :param limit: Upper limit for the number of records to return. list() guarantees
                      never to return more than limit.  Default is no limit
        :param page_size: Number of records to fetch per request, when not set will use
                          the default value of 50 records.  If no page_size is defined
                          but a limit is defined, list() will attempt to read the limit
                          with the most efficient page size, i.e. min(limit, 1000)

        :returns: list that will contain up to limit results
        r   r_   r`   ra   rb   )listrf   r.   r   r_   r`   ra   rb   r1   r1   r2   rk   '  s    zAlertList.listc                    s*   dd | j |||||dI dH 2 I dH S )ah  
        Asynchronously lists AlertInstance records from the API as a list.
        Unlike stream(), this operation is eager and will load `limit` records into
        memory before returning.

        :param str log_level: Only show alerts for this log-level.  Can be: `error`, `warning`, `notice`, or `debug`.
        :param datetime start_date: Only include alerts that occurred on or after this date and time. Specify the date and time in GMT and format as `YYYY-MM-DD` or `YYYY-MM-DDThh:mm:ssZ`. Queries for alerts older than 30 days are not supported.
        :param datetime end_date: Only include alerts that occurred on or before this date and time. Specify the date and time in GMT and format as `YYYY-MM-DD` or `YYYY-MM-DDThh:mm:ssZ`. Queries for alerts older than 30 days are not supported.
        :param limit: Upper limit for the number of records to return. list() guarantees
                      never to return more than limit.  Default is no limit
        :param page_size: Number of records to fetch per request, when not set will use
                          the default value of 50 records.  If no page_size is defined
                          but a limit is defined, list() will attempt to read the limit
                          with the most efficient page size, i.e. min(limit, 1000)

        :returns: list that will contain up to limit results
        c                    s   g | z3 d H W }|q6 S )Nr1   )rD   recordr1   r1   r2   
<listcomp>c  s   z(AlertList.list_async.<locals>.<listcomp>rj   N)ri   rl   r1   r1   r2   
list_asyncJ  s    
zAlertList.list_async)r   r_   r`   
page_tokenpage_numberrb   r5   c           	   	   C   sD   t |t|t||||d}| jjd| j|d}t| j|S )a  
        Retrieve a single page of AlertInstance records from the API.
        Request is executed immediately

        :param log_level: Only show alerts for this log-level.  Can be: `error`, `warning`, `notice`, or `debug`.
        :param start_date: Only include alerts that occurred on or after this date and time. Specify the date and time in GMT and format as `YYYY-MM-DD` or `YYYY-MM-DDThh:mm:ssZ`. Queries for alerts older than 30 days are not supported.
        :param end_date: Only include alerts that occurred on or before this date and time. Specify the date and time in GMT and format as `YYYY-MM-DD` or `YYYY-MM-DDThh:mm:ssZ`. Queries for alerts older than 30 days are not supported.
        :param page_token: PageToken provided by the API
        :param page_number: Page Number, this value is simply for client state
        :param page_size: Number of records to return, defaults to 50

        :returns: Page of AlertInstance
        ZLogLevelZ	StartDateZEndDateZ	PageTokenr   ZPageSizerW   rY   rZ   params)r   ofr   r+   r7   re   rV   r\   	r.   r   r_   r`   rp   rq   rb   dataresponser1   r1   r2   re   n  s    zAlertList.pagec           	   	      sJ   t |t|t||||d}| jjd| j|dI dH }t| j|S )a  
        Asynchronously retrieve a single page of AlertInstance records from the API.
        Request is executed immediately

        :param log_level: Only show alerts for this log-level.  Can be: `error`, `warning`, `notice`, or `debug`.
        :param start_date: Only include alerts that occurred on or after this date and time. Specify the date and time in GMT and format as `YYYY-MM-DD` or `YYYY-MM-DDThh:mm:ssZ`. Queries for alerts older than 30 days are not supported.
        :param end_date: Only include alerts that occurred on or before this date and time. Specify the date and time in GMT and format as `YYYY-MM-DD` or `YYYY-MM-DDThh:mm:ssZ`. Queries for alerts older than 30 days are not supported.
        :param page_token: PageToken provided by the API
        :param page_number: Page Number, this value is simply for client state
        :param page_size: Number of records to return, defaults to 50

        :returns: Page of AlertInstance
        rr   rW   rs   N)r   ru   r   r+   r7   rh   rV   r\   rv   r1   r1   r2   rh     s    zAlertList.page_async)
target_urlr5   c                 C   s   | j jjd|}t| j |S )z
        Retrieve a specific page of AlertInstance records from the API.
        Request is executed immediately

        :param target_url: API-generated URL for the requested results page

        :returns: Page of AlertInstance
        rW   )r7   domaintwiliorequestr\   r.   ry   rx   r1   r1   r2   get_page  s    	zAlertList.get_pagec                    s$   | j jjd|I dH }t| j |S )z
        Asynchronously retrieve a specific page of AlertInstance records from the API.
        Request is executed immediately

        :param target_url: API-generated URL for the requested results page

        :returns: Page of AlertInstance
        rW   N)r7   rz   r{   Zrequest_asyncr\   r}   r1   r1   r2   get_page_async  s    	zAlertList.get_page_async)r   r5   c                 C   s   t | j|dS zh
        Constructs a AlertContext

        :param sid: The SID of the Alert resource to fetch.
        r6   r3   r7   r.   r   r1   r1   r2   r*     s    zAlertList.getc                 C   s   t | j|dS r   r   r   r1   r1   r2   __call__  s    zAlertList.__call__r4   c                 C   s   dS )r>   z<Twilio.Monitor.V1.AlertList>r1   r8   r1   r1   r2   rN     s    zAlertList.__repr__)rO   rP   rQ   r   r)   r   unsetr   rS   objectr   r   intr   r   rf   r	   ri   r   rk   ro   r\   re   rh   r~   r   r3   r*   r   rN   rU   r1   r1   r/   r2   r^      s   


&


&


%


&





&





&r^   N)rR   r   typingr   r   r   r   r   r   r	   Ztwilio.baser
   r   r   Ztwilio.base.instance_contextr   Ztwilio.base.instance_resourcer   Ztwilio.base.list_resourcer   Ztwilio.base.versionr   Ztwilio.base.pager   r   r3   r\   r^   r1   r1   r1   r2   <module>   s   $g@