U
    ^g%i                     @   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 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 - Api
    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values)InstanceContext)InstanceResource)ListResource)Version)Pagec                       s"  e Zd ZG dd deZG dd deZdeeee	f ee
e d fddZed	d
ddZed
ddZed
ddZd d
ddZd d
ddZejejejfeeef eeef eeef d dddZejejejfeeef eeef eeef d dddZed
ddZ  ZS )TriggerInstancec                   @   s   e Zd ZdZdZdZdZdS )TriggerInstance.RecurringZdailyZmonthlyZyearlyZalltimeN)__name__
__module____qualname__ZDAILYZMONTHLYZYEARLYZALLTIME r   r   j/var/www/html/api-medvista/venv/lib/python3.8/site-packages/twilio/rest/api/v2010/account/usage/trigger.py	Recurring   s   r   c                   @   s   e Zd ZdZdZdZdS )TriggerInstance.TriggerFieldcountusageZpriceN)r   r   r   ZCOUNTUSAGEZPRICEr   r   r   r   TriggerField!   s   r   N)versionpayloadaccount_sidsidc                    s   t  | |d| _|d| _|d| _|d| _|d| _t	|d| _
t	|d| _t	|d| _|d	| _|d
| _|d| _|d| _|d| _|d| _|d| _|d| _||p| jd| _d | _d S )Nr    api_versioncallback_methodcallback_urlcurrent_valuedate_created
date_fireddate_updatedfriendly_name	recurringr!   
trigger_bytrigger_valueuriusage_categoryusage_record_urir    r!   )super__init__getr    r"   r#   r$   r%   r
   Zrfc2822_datetimer&   r'   r(   r)   r*   r!   r+   r,   r-   r.   r/   	_solution_context)selfr   r   r    r!   	__class__r   r   r2   9   s:    zTriggerInstance.__init__TriggerContextreturnc                 C   s.   | j dkr(t| j| jd | 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: TriggerContext for this TriggerInstance
        Nr    r!   r0   )r5   r9   _versionr4   r6   r   r   r   _proxya   s    
zTriggerInstance._proxyc                 C   s
   | j  S )j
        Deletes the TriggerInstance


        :returns: True if delete succeeds, False otherwise
        )r>   deleter=   r   r   r   r@   q   s    zTriggerInstance.deletec                    s   | j  I dH S )
        Asynchronous coroutine that deletes the TriggerInstance


        :returns: True if delete succeeds, False otherwise
        N)r>   delete_asyncr=   r   r   r   rB   z   s    zTriggerInstance.delete_asyncc                 C   s
   | j  S )[
        Fetch the TriggerInstance


        :returns: The fetched TriggerInstance
        )r>   fetchr=   r   r   r   rD      s    zTriggerInstance.fetchc                    s   | j  I dH S )u
        Asynchronous coroutine to fetch the TriggerInstance


        :returns: The fetched TriggerInstance
        N)r>   fetch_asyncr=   r   r   r   rF      s    zTriggerInstance.fetch_asyncr#   r$   r)   r;   c                 C   s   | j j|||dS )  
        Update the TriggerInstance

        :param callback_method: The HTTP method we should use to call `callback_url`. Can be: `GET` or `POST` and the default is `POST`.
        :param callback_url: The URL we should call using `callback_method` when the trigger fires.
        :param friendly_name: A descriptive string that you create to describe the resource. It can be up to 64 characters long.

        :returns: The updated TriggerInstance
        r#   r$   r)   )r>   updater6   r#   r$   r)   r   r   r   rJ      s
    zTriggerInstance.updatec                    s   | j j|||dI dH S )  
        Asynchronous coroutine to update the TriggerInstance

        :param callback_method: The HTTP method we should use to call `callback_url`. Can be: `GET` or `POST` and the default is `POST`.
        :param callback_url: The URL we should call using `callback_method` when the trigger fires.
        :param friendly_name: A descriptive string that you create to describe the resource. It can be up to 64 characters long.

        :returns: The updated TriggerInstance
        rI   N)r>   update_asyncrK   r   r   r   rM      s
    zTriggerInstance.update_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vr   r   r   	<genexpr>   s     z+TriggerInstance.__repr__.<locals>.<genexpr>z%<Twilio.Api.V2010.TriggerInstance {}>joinr4   itemsrR   r6   contextr   r   r   __repr__   s    zTriggerInstance.__repr__)N)r   r   r   objectr   r   r   r   strr   r   r2   propertyr>   boolr@   rB   rD   rF   r   unsetr   rJ   rM   r]   __classcell__r   r   r7   r   r      sD    
(			





r   c                       s   e Zd Zeeed fddZedddZedddZe	dd	d
Z
e	dddZejejejfeeef eeef eeef e	dddZejejejfeeef eeef eeef e	dddZedddZ  ZS )r9   )r   r    r!   c                    s,   t  | ||d| _djf | j| _dS )am  
        Initialize the TriggerContext

        :param version: Version that contains the resource
        :param account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the UsageTrigger resources to update.
        :param sid: The Twilio-provided string that uniquely identifies the UsageTrigger resource to update.
        r0   z1/Accounts/{account_sid}/Usage/Triggers/{sid}.jsonNr1   r2   r4   rR   _uri)r6   r   r    r!   r7   r   r   r2      s    zTriggerContext.__init__r:   c                 C   s   t i }| jjd| j|dS )r?   DELETEmethodr-   headers)r   ofr<   r@   re   r6   ri   r   r   r   r@      s    
zTriggerContext.deletec                    s$   t i }| jjd| j|dI dH S )rA   rf   rg   N)r   rj   r<   rB   re   rk   r   r   r   rB      s    
  zTriggerContext.delete_asyncc                 C   sD   t i }d|d< | jjd| j|d}t| j|| jd | jd dS )rC   application/jsonAcceptGETrg   r    r!   r0   )r   rj   r<   rD   re   r   r4   r6   ri   r   r   r   r   rD      s    
zTriggerContext.fetchc                    sJ   t i }d|d< | jjd| j|dI dH }t| j|| jd | jd dS )	rE   rl   rm   rn   rg   Nr    r!   r0   )r   rj   r<   rF   re   r   r4   ro   r   r   r   rF     s    
  zTriggerContext.fetch_asyncrG   c                 C   s`   t |||d}t i }d|d< d|d< | jjd| j||d}t| j|| jd | jd	 d
S )rH   CallbackMethodCallbackUrlFriendlyName!application/x-www-form-urlencodedContent-Typerl   rm   POSTrh   r-   datari   r    r!   r0   )r   rj   r<   rJ   re   r   r4   r6   r#   r$   r)   rx   ri   r   r   r   r   rJ   $  s*    
   zTriggerContext.updatec                    sf   t |||d}t i }d|d< d|d< | jjd| j||dI dH }t| j|| jd	 | jd
 dS )rL   rp   rt   ru   rl   rm   rv   rw   Nr    r!   r0   )r   rj   r<   rM   re   r   r4   ry   r   r   r   rM   L  s*    
   zTriggerContext.update_asyncc                 C   s$   d dd | j D }d|S )rN   rO   c                 s   s   | ]\}}d  ||V  qdS rP   rQ   rS   r   r   r   rW   z  s     z*TriggerContext.__repr__.<locals>.<genexpr>z$<Twilio.Api.V2010.TriggerContext {}>rX   r[   r   r   r   r]   t  s    zTriggerContext.__repr__)r   r   r   r   r_   r2   ra   r@   rB   r   rD   rF   r   rb   r   r^   rJ   rM   r]   rc   r   r   r7   r   r9      s0   


*


(r9   c                   @   s2   e Zd Zeeef edddZedddZdS )TriggerPage)r   r;   c                 C   s   t | j|| jd dS )zm
        Build an instance of TriggerInstance

        :param payload: Payload response from the API
        r    r    )r   r<   r4   )r6   r   r   r   r   get_instance  s
      zTriggerPage.get_instancer:   c                 C   s   dS )rN   z<Twilio.Api.V2010.TriggerPage>r   r=   r   r   r   r]     s    zTriggerPage.__repr__N)	r   r   r   r   r_   r   r   r|   r]   r   r   r   r   rz   ~  s   
rz   c                
       s  e Zd Zeed fddZejejejejfeeeeee	f eee	f ede	f ede	f e
dddZejejejejfeeeeee	f eee	f ede	f ede	f e
dd	d
Zejejejddfede	f ed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de	f ed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de	f ed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de	f ed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de	f ed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de	f ed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 )'TriggerList)r   r    c                    s*   t  | d|i| _djf | j| _dS )z
        Initialize the TriggerList

        :param version: Version that contains the resource
        :param account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that created the UsageTrigger resources to read.

        r    z+/Accounts/{account_sid}/Usage/Triggers.jsonNrd   )r6   r   r    r7   r   r   r2     s     zTriggerList.__init__r   r   )r$   r,   r.   r#   r)   r*   r+   r;   c              
   C   sd   t |||||||d}t ddi}	d|	d< d|	d< | jjd| j||	d}
t| j|
| jd d	S )
a  
        Create the TriggerInstance

        :param callback_url: The URL we should call using `callback_method` when the trigger fires.
        :param trigger_value: The usage value at which the trigger should fire.  For convenience, you can use an offset value such as `+30` to specify a trigger_value that is 30 units more than the current usage value. Be sure to urlencode a `+` as `%2B`.
        :param usage_category: The usage category that the trigger should watch.  Use one of the supported [usage categories](https://www.twilio.com/docs/usage/api/usage-record#usage-categories) for this value.
        :param callback_method: The HTTP method we should use to call `callback_url`. Can be: `GET` or `POST` and the default is `POST`.
        :param friendly_name: A descriptive string that you create to describe the resource. It can be up to 64 characters long.
        :param recurring:
        :param trigger_by:

        :returns: The created TriggerInstance
        rr   ZTriggerValueUsageCategoryrq   rs   r   	TriggerByru   rt   rl   rm   rv   rw   r    r{   )r   rj   r<   createre   r   r4   r6   r$   r,   r.   r#   r)   r*   r+   rx   ri   r   r   r   r   r     s0         zTriggerList.createc              
      sj   t |||||||d}t ddi}	d|	d< d|	d< | jjd| j||	dI dH }
t| j|
| jd	 d
S )a  
        Asynchronously create the TriggerInstance

        :param callback_url: The URL we should call using `callback_method` when the trigger fires.
        :param trigger_value: The usage value at which the trigger should fire.  For convenience, you can use an offset value such as `+30` to specify a trigger_value that is 30 units more than the current usage value. Be sure to urlencode a `+` as `%2B`.
        :param usage_category: The usage category that the trigger should watch.  Use one of the supported [usage categories](https://www.twilio.com/docs/usage/api/usage-record#usage-categories) for this value.
        :param callback_method: The HTTP method we should use to call `callback_url`. Can be: `GET` or `POST` and the default is `POST`.
        :param friendly_name: A descriptive string that you create to describe the resource. It can be up to 64 characters long.
        :param recurring:
        :param trigger_by:

        :returns: The created TriggerInstance
        r~   ru   rt   rl   rm   rv   rw   Nr    r{   )r   rj   r<   create_asyncre   r   r4   r   r   r   r   r     s0         zTriggerList.create_asyncN)r*   r+   r.   limit	page_sizer;   c                 C   s6   | j ||}| j||||d d}| j ||d S )a5  
        Streams TriggerInstance 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 &quot;TriggerInstance.Recurring&quot; recurring: The frequency of recurring UsageTriggers to read. Can be: `daily`, `monthly`, or `yearly` to read recurring UsageTriggers. An empty value or a value of `alltime` reads non-recurring UsageTriggers.
        :param &quot;TriggerInstance.TriggerField&quot; trigger_by: The trigger field of the UsageTriggers to read.  Can be: `count`, `usage`, or `price` as described in the [UsageRecords documentation](https://www.twilio.com/docs/usage/api/usage-record#usage-count-price).
        :param str usage_category: The usage category of the UsageTriggers to read. Must be a supported [usage categories](https://www.twilio.com/docs/usage/api/usage-record#usage-categories).
        :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
        r   r*   r+   r.   r   r   )r<   read_limitspagestreamr6   r*   r+   r.   r   r   Zlimitsr   r   r   r   r   	  s    zTriggerList.streamc                    s<   | j ||}| j||||d dI dH }| j ||d S )aD  
        Asynchronously streams TriggerInstance 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 &quot;TriggerInstance.Recurring&quot; recurring: The frequency of recurring UsageTriggers to read. Can be: `daily`, `monthly`, or `yearly` to read recurring UsageTriggers. An empty value or a value of `alltime` reads non-recurring UsageTriggers.
        :param &quot;TriggerInstance.TriggerField&quot; trigger_by: The trigger field of the UsageTriggers to read.  Can be: `count`, `usage`, or `price` as described in the [UsageRecords documentation](https://www.twilio.com/docs/usage/api/usage-record#usage-count-price).
        :param str usage_category: The usage category of the UsageTriggers to read. Must be a supported [usage categories](https://www.twilio.com/docs/usage/api/usage-record#usage-categories).
        :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
        r   r   Nr   )r<   r   
page_asyncstream_asyncr   r   r   r   r   -  s    zTriggerList.stream_asyncc                 C   s   t | j|||||dS )a  
        Lists TriggerInstance records from the API as a list.
        Unlike stream(), this operation is eager and will load `limit` records into
        memory before returning.

        :param &quot;TriggerInstance.Recurring&quot; recurring: The frequency of recurring UsageTriggers to read. Can be: `daily`, `monthly`, or `yearly` to read recurring UsageTriggers. An empty value or a value of `alltime` reads non-recurring UsageTriggers.
        :param &quot;TriggerInstance.TriggerField&quot; trigger_by: The trigger field of the UsageTriggers to read.  Can be: `count`, `usage`, or `price` as described in the [UsageRecords documentation](https://www.twilio.com/docs/usage/api/usage-record#usage-count-price).
        :param str usage_category: The usage category of the UsageTriggers to read. Must be a supported [usage categories](https://www.twilio.com/docs/usage/api/usage-record#usage-categories).
        :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.   r   r   )listr   r6   r*   r+   r.   r   r   r   r   r   r   Q  s    zTriggerList.listc                    s*   dd | j |||||dI dH 2 I dH S )a  
        Asynchronously lists TriggerInstance records from the API as a list.
        Unlike stream(), this operation is eager and will load `limit` records into
        memory before returning.

        :param &quot;TriggerInstance.Recurring&quot; recurring: The frequency of recurring UsageTriggers to read. Can be: `daily`, `monthly`, or `yearly` to read recurring UsageTriggers. An empty value or a value of `alltime` reads non-recurring UsageTriggers.
        :param &quot;TriggerInstance.TriggerField&quot; trigger_by: The trigger field of the UsageTriggers to read.  Can be: `count`, `usage`, or `price` as described in the [UsageRecords documentation](https://www.twilio.com/docs/usage/api/usage-record#usage-count-price).
        :param str usage_category: The usage category of the UsageTriggers to read. Must be a supported [usage categories](https://www.twilio.com/docs/usage/api/usage-record#usage-categories).
        :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 )Nr   )rT   recordr   r   r   
<listcomp>  s   z*TriggerList.list_async.<locals>.<listcomp>r   N)r   r   r   r   r   
list_asynct  s    
zTriggerList.list_async)r*   r+   r.   
page_tokenpage_numberr   r;   c           
   	   C   sT   t ||||||d}t ddi}d|d< | jjd| j||d}	t| j|	| jS )a  
        Retrieve a single page of TriggerInstance records from the API.
        Request is executed immediately

        :param recurring: The frequency of recurring UsageTriggers to read. Can be: `daily`, `monthly`, or `yearly` to read recurring UsageTriggers. An empty value or a value of `alltime` reads non-recurring UsageTriggers.
        :param trigger_by: The trigger field of the UsageTriggers to read.  Can be: `count`, `usage`, or `price` as described in the [UsageRecords documentation](https://www.twilio.com/docs/usage/api/usage-record#usage-count-price).
        :param usage_category: The usage category of the UsageTriggers to read. Must be a supported [usage categories](https://www.twilio.com/docs/usage/api/usage-record#usage-categories).
        :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 TriggerInstance
        r   r   r   Z	PageTokenr   ZPageSizeru   rt   rl   rm   rn   rh   r-   paramsri   )r   rj   r<   r   re   rz   r4   
r6   r*   r+   r.   r   r   r   rx   ri   responser   r   r   r     s$       zTriggerList.pagec           
   	      sZ   t ||||||d}t ddi}d|d< | jjd| j||dI dH }	t| j|	| jS )	a  
        Asynchronously retrieve a single page of TriggerInstance records from the API.
        Request is executed immediately

        :param recurring: The frequency of recurring UsageTriggers to read. Can be: `daily`, `monthly`, or `yearly` to read recurring UsageTriggers. An empty value or a value of `alltime` reads non-recurring UsageTriggers.
        :param trigger_by: The trigger field of the UsageTriggers to read.  Can be: `count`, `usage`, or `price` as described in the [UsageRecords documentation](https://www.twilio.com/docs/usage/api/usage-record#usage-count-price).
        :param usage_category: The usage category of the UsageTriggers to read. Must be a supported [usage categories](https://www.twilio.com/docs/usage/api/usage-record#usage-categories).
        :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 TriggerInstance
        r   ru   rt   rl   rm   rn   r   N)r   rj   r<   r   re   rz   r4   r   r   r   r   r     s$       zTriggerList.page_async)
target_urlr;   c                 C   s"   | j jjd|}t| j || jS )z
        Retrieve a specific page of TriggerInstance records from the API.
        Request is executed immediately

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

        :returns: Page of TriggerInstance
        rn   )r<   domaintwiliorequestrz   r4   r6   r   r   r   r   r   get_page  s    	zTriggerList.get_pagec                    s(   | j jjd|I dH }t| j || jS )a  
        Asynchronously retrieve a specific page of TriggerInstance records from the API.
        Request is executed immediately

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

        :returns: Page of TriggerInstance
        rn   N)r<   r   r   Zrequest_asyncrz   r4   r   r   r   r   get_page_async  s    	zTriggerList.get_page_async)r!   r;   c                 C   s   t | j| jd |dS z
        Constructs a TriggerContext

        :param sid: The Twilio-provided string that uniquely identifies the UsageTrigger resource to update.
        r    r0   r9   r<   r4   r6   r!   r   r   r   r3     s
      zTriggerList.getc                 C   s   t | j| jd |dS r   r   r   r   r   r   __call__  s
      zTriggerList.__call__r:   c                 C   s   dS )rN   z<Twilio.Api.V2010.TriggerList>r   r=   r   r   r   r]     s    zTriggerList.__repr__) r   r   r   r   r_   r2   r   rb   r   r^   r   r   r   r   intr   r   r	   r   r   r   r   rz   r   r   r   r   r9   r3   r   r]   rc   r   r   r7   r   r}     s   



6



3


&


&


%


&





,





*

r}   N)__doc__r   typingr   r   r   r   r   r   r	   Ztwilio.baser
   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   r9   rz   r}   r   r   r   r   <module>   s   $ 1 6