o
    f>hZ                     @   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                       sn   e Zd ZdZ	ddedeeef dee f fddZ	e
dd
dZdddZdddZdef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__ O/var/www/html/venv/lib/python3.10/site-packages/twilio/rest/monitor/v1/alert.pyr)   0   s:   

zAlertInstance.__init__returnAlertContextc                 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-   r4   _versionr,   r.   r1   r1   r2   _proxyT   s   
zAlertInstance._proxyc                 C   s
   | j  S )W
        Fetch the AlertInstance


        :returns: The fetched AlertInstance
        )r8   fetchr7   r1   r1   r2   r:   c   s   
zAlertInstance.fetchc                    s   | j  I dH S )q
        Asynchronous coroutine to fetch the AlertInstance


        :returns: The fetched AlertInstance
        N)r8   fetch_asyncr7   r1   r1   r2   r<   l   s   zAlertInstance.fetch_asyncc                 C   $   d dd | j D }d|S )f
        Provide a friendly representation

        :returns: Machine friendly representation
         c                 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,   itemsrC   r.   contextr1   r1   r2   __repr__u      
zAlertInstance.__repr__N)r3   r4   )r3   r   )__name__
__module____qualname____doc__r   r   strr   r   r)   propertyr8   r:   r<   rO   __classcell__r1   r1   r/   r2   r      s    
$

		r   c                       sP   e Zd Zdedef fddZdefddZdefdd	Zdefd
dZ	  Z
S )r4   r   r   c                    s.   t  | d|i| _djd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}Nr1   )r(   r)   r,   rC   _uri)r.   r   r   r/   r1   r2   r)      s   zAlertContext.__init__r3   c                 C   s<   t i }d|d< | jjd| j|d}t| j|| jd dS )r9   application/jsonAcceptGETmethoduriheadersr   r5   )r   ofr6   r:   rY   r   r,   r.   r`   r   r1   r1   r2   r:      s   
zAlertContext.fetchc                    sD   t i }d|d< | jjd| j|dI dH }t| j|| jd dS )r;   rZ   r[   r\   r]   Nr   r5   )r   ra   r6   r<   rY   r   r,   rb   r1   r1   r2   r<      s   
zAlertContext.fetch_asyncc                 C   r=   )r>   r?   c                 s   r@   rA   rB   rD   r1   r1   r2   rH      rI   z(AlertContext.__repr__.<locals>.<genexpr>z#<Twilio.Monitor.V1.AlertContext {}>rJ   rM   r1   r1   r2   rO      rP   zAlertContext.__repr__)rR   rS   rT   r   rV   r)   r   r:   r<   rO   rX   r1   r1   r/   r2   r4      s
    r4   c                   @   s4   e Zd Zdeeef defddZdefddZdS )	AlertPager   r3   c                 C   s   t | j|S )zk
        Build an instance of AlertInstance

        :param payload: Payload response from the API
        )r   r6   )r.   r   r1   r1   r2   get_instance   s   zAlertPage.get_instancec                 C      dS )r>   z<Twilio.Monitor.V1.AlertPage>r1   r7   r1   r1   r2   rO         zAlertPage.__repr__N)	rR   rS   rT   r   rV   r   r   rd   rO   r1   r1   r1   r2   rc      s    rc   c                       s  e Zd Zdef fddZejejejddfdeee	f dee
e	f dee
e	f dee d	ee d
ee fddZejejejddfdeee	f dee
e	f dee
e	f dee d	ee d
ee fddZejejejddfdeee	f dee
e	f dee
e	f dee d	ee d
ee fddZejejejddfdeee	f dee
e	f dee
e	f dee d	ee d
ee fddZejejejejejejfdeee	f dee
e	f dee
e	f deee	f deee	f d	eee	f d
efddZejejejejejejfdeee	f dee
e	f dee
e	f deee	f deee	f d	eee	f d
efddZded
efddZded
efddZded
efdd Zded
efd!d"Zd
efd#d$Z  ZS )%	AlertListr   c                    s   t  | d| _dS )zg
        Initialize the AlertList

        :param version: Version that contains the resource

        z/AlertsN)r(   r)   rY   )r.   r   r/   r1   r2   r)      s   
zAlertList.__init__Nr   
start_dateend_datelimit	page_sizer3   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
        rk   r   rh   ri   rk   rj   )r6   read_limitspagestreamr.   r   rh   ri   rj   rk   limitsrn   r1   r1   r2   ro      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
        rk   rl   Nrj   )r6   rm   
page_asyncstream_asyncrp   r1   r1   r2   rs     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   rh   ri   rj   rk   )listro   r.   r   rh   ri   rj   rk   r1   r1   r2   ru   ,  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 rQ   r1   )rE   recordr1   r1   r2   
<listcomp>h  s
    z(AlertList.list_async.<locals>.<listcomp>rt   N)rs   rv   r1   r1   r2   
list_asyncO  s   
zAlertList.list_async
page_tokenpage_numberc           
   	   C   s\   t |t|t||||d}t ddi}d|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
        LogLevel	StartDateEndDate	PageTokenr   PageSizeContent-Type!application/x-www-form-urlencodedrZ   r[   r\   r^   r_   paramsr`   )r   ra   r   r+   r6   rn   rY   rc   
r.   r   rh   ri   rz   r{   rk   datar`   responser1   r1   r2   rn   s  s   
zAlertList.pagec           
   	      sd   t |t|t||||d}t ddi}d|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
        r|   r   r   rZ   r[   r\   r   N)r   ra   r   r+   r6   rr   rY   rc   r   r1   r1   r2   rr     s    
zAlertList.page_async
target_urlc                 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
        r\   )r6   domaintwiliorequestrc   r.   r   r   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
        r\   N)r6   r   r   request_asyncrc   r   r1   r1   r2   get_page_async  s   	zAlertList.get_page_asyncr   c                 C      t | j|dS zh
        Constructs a AlertContext

        :param sid: The SID of the Alert resource to fetch.
        r5   r4   r6   r.   r   r1   r1   r2   r*        zAlertList.getc                 C   r   r   r   r   r1   r1   r2   __call__  r   zAlertList.__call__c                 C   re   )r>   z<Twilio.Monitor.V1.AlertList>r1   r7   r1   r1   r2   rO     rf   zAlertList.__repr__)rR   rS   rT   r   r)   r   unsetr   rV   objectr   r   intr   r   ro   r	   rs   r   ru   ry   rc   rn   rr   r   r   r4   r*   r   rO   rX   r1   r1   r/   r2   rg      s    



&



&



%



&






,






*rg   N)rU   r   typingr   r   r   r   r   r   r	   twilio.baser
   r   r   twilio.base.instance_contextr   twilio.base.instance_resourcer   twilio.base.list_resourcer   twilio.base.versionr   twilio.base.pager   r   r4   rc   rg   r1   r1   r1   r2   <module>   s    $fE