U
    ^g%i:M                     @   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 - Preview
    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                       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 )CommandInstancez
    :ivar sid:
    :ivar account_sid:
    :ivar device_sid:
    :ivar sim_sid:
    :ivar command:
    :ivar command_mode:
    :ivar status:
    :ivar direction:
    :ivar date_created:
    :ivar date_updated:
    :ivar url:
    N)versionpayloadsidc                    s   t  | |d| _|d| _|d| _|d| _|d| _|d| _|d| _	|d| _
t|d	| _t|d
| _|d| _d|p| ji| _d | _d S )Nr   account_sid
device_sidsim_sidcommandcommand_modestatus	directiondate_createddate_updatedurl)super__init__getr   r   r   r   r   r   r   r   r
   Ziso8601_datetimer   r   r   	_solution_context)selfr   r   r   	__class__ c/var/www/html/api-medvista/venv/lib/python3.8/site-packages/twilio/rest/preview/wireless/command.pyr    (   s(     zCommandInstance.__init__CommandContextreturnc                 C   s&   | j dk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: CommandContext for this CommandInstance
        Nr   r   )r#   r)   _versionr"   r$   r'   r'   r(   _proxyB   s    
zCommandInstance._proxyc                 C   s
   | j  S )[
        Fetch the CommandInstance


        :returns: The fetched CommandInstance
        )r/   fetchr.   r'   r'   r(   r1   Q   s    zCommandInstance.fetchc                    s   | j  I dH S )u
        Asynchronous coroutine to fetch the CommandInstance


        :returns: The fetched CommandInstance
        N)r/   fetch_asyncr.   r'   r'   r(   r3   Z   s    zCommandInstance.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vr'   r'   r(   	<genexpr>i   s     z+CommandInstance.__repr__.<locals>.<genexpr>z,<Twilio.Preview.Wireless.CommandInstance {}>joinr"   itemsr8   r$   contextr'   r'   r(   __repr__c   s    zCommandInstance.__repr__)N)__name__
__module____qualname____doc__r   r   strr   r   r    propertyr/   r1   r3   rC   __classcell__r'   r'   r%   r(   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 )r)   )r   r   c                    s*   t  | d|i| _djf | j| _dS )z
        Initialize the CommandContext

        :param version: Version that contains the resource
        :param sid:
        r   z/Commands/{sid}N)r   r    r"   r8   _uri)r$   r   r   r%   r'   r(   r    o   s
     zCommandContext.__init__r*   c                 C   s<   t i }d|d< | jjd| j|d}t| j|| jd dS )r0   application/jsonAcceptGETmethoduriheadersr   r,   )r   ofr-   r1   rK   r   r"   r$   rR   r   r'   r'   r(   r1   ~   s    
zCommandContext.fetchc                    sB   t i }d|d< | jjd| j|dI dH }t| j|| jd dS )r2   rL   rM   rN   rO   Nr   r,   )r   rS   r-   r3   rK   r   r"   rT   r'   r'   r(   r3      s    
  zCommandContext.fetch_asyncc                 C   s$   d dd | j D }d|S )r4   r5   c                 s   s   | ]\}}d  ||V  qdS r6   r7   r9   r'   r'   r(   r=      s     z*CommandContext.__repr__.<locals>.<genexpr>z+<Twilio.Preview.Wireless.CommandContext {}>r>   rA   r'   r'   r(   rC      s    zCommandContext.__repr__)rD   rE   rF   r   rH   r    r   r1   r3   rC   rJ   r'   r'   r%   r(   r)   m   s   r)   c                   @   s2   e Zd Zeeef edddZedddZdS )CommandPage)r   r+   c                 C   s   t | j|S )zm
        Build an instance of CommandInstance

        :param payload: Payload response from the API
        )r   r-   )r$   r   r'   r'   r(   get_instance   s    zCommandPage.get_instancer*   c                 C   s   dS )r4   z%<Twilio.Preview.Wireless.CommandPage>r'   r.   r'   r'   r(   rC      s    zCommandPage.__repr__N)	rD   rE   rF   r   rH   r   r   rV   rC   r'   r'   r'   r(   rU      s   rU   c                
       s  e Zd Zed fddZejejejejejejfe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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d	d	feee	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d	d	feee	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d	d	feee	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d	d	feee	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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ee	f edddZej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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 )%CommandList)r   c                    s   t  | d| _dS )zi
        Initialize the CommandList

        :param version: Version that contains the resource

        z	/CommandsN)r   r    rK   )r$   r   r%   r'   r(   r       s    zCommandList.__init__)r   devicesimcallback_methodcallback_urlr   include_sidr+   c              
   C   sZ   t |||||||d}t ddi}	d|	d< d|	d< | jjd| j||	d}
t| j|
S )a  
        Create the CommandInstance

        :param command:
        :param device:
        :param sim:
        :param callback_method:
        :param callback_url:
        :param command_mode:
        :param include_sid:

        :returns: The created CommandInstance
        CommandDeviceSimZCallbackMethodZCallbackUrlZCommandModeZ
IncludeSidContent-Type!application/x-www-form-urlencodedrL   rM   POSTrP   rQ   datarR   )r   rS   r-   createrK   r   r$   r   rX   rY   rZ   r[   r   r\   re   rR   r   r'   r'   r(   rf      s(       zCommandList.createc              
      s`   t |||||||d}t ddi}	d|	d< d|	d< | jjd| j||	dI dH }
t| j|
S )	a$  
        Asynchronously create the CommandInstance

        :param command:
        :param device:
        :param sim:
        :param callback_method:
        :param callback_url:
        :param command_mode:
        :param include_sid:

        :returns: The created CommandInstance
        r]   ra   rb   rL   rM   rc   rd   N)r   rS   r-   create_asyncrK   r   rg   r'   r'   r(   rh     s(       zCommandList.create_asyncN)rX   rY   r   r   limit	page_sizer+   c           	      C   s8   | j ||}| j|||||d d}| j ||d S )a  
        Streams CommandInstance 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 device:
        :param str sim:
        :param str status:
        :param str direction:
        :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
        rj   rX   rY   r   r   rj   ri   )r-   read_limitspagestream	r$   rX   rY   r   r   ri   rj   Zlimitsrm   r'   r'   r(   rn   0  s    zCommandList.streamc           	         s>   | j ||}| j|||||d dI dH }| j ||d S )a  
        Asynchronously streams CommandInstance 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 device:
        :param str sim:
        :param str status:
        :param str direction:
        :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
        rj   rk   Nri   )r-   rl   
page_asyncstream_asyncro   r'   r'   r(   rq   W  s    zCommandList.stream_asyncc              	   C   s   t | j||||||dS )af  
        Lists CommandInstance records from the API as a list.
        Unlike stream(), this operation is eager and will load `limit` records into
        memory before returning.

        :param str device:
        :param str sim:
        :param str status:
        :param str direction:
        :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
        rX   rY   r   r   ri   rj   )listrn   r$   rX   rY   r   r   ri   rj   r'   r'   r(   rs   ~  s    zCommandList.listc              	      s,   dd | j ||||||dI dH 2 I dH S )au  
        Asynchronously lists CommandInstance records from the API as a list.
        Unlike stream(), this operation is eager and will load `limit` records into
        memory before returning.

        :param str device:
        :param str sim:
        :param str status:
        :param str direction:
        :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'   )r:   recordr'   r'   r(   
<listcomp>  s   z*CommandList.list_async.<locals>.<listcomp>rr   N)rq   rt   r'   r'   r(   
list_async  s    
zCommandList.list_async)rX   rY   r   r   
page_tokenpage_numberrj   r+   c              
   C   sR   t |||||||d}t ddi}	d|	d< | jjd| j||	d}
t| j|
S )a  
        Retrieve a single page of CommandInstance records from the API.
        Request is executed immediately

        :param device:
        :param sim:
        :param status:
        :param direction:
        :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 CommandInstance
        r_   r`   StatusZ	DirectionZ	PageTokenr   ZPageSizera   rb   rL   rM   rN   rP   rQ   paramsrR   )r   rS   r-   rm   rK   rU   r$   rX   rY   r   r   rx   ry   rj   re   rR   responser'   r'   r(   rm     s&       zCommandList.pagec              
      sX   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 CommandInstance records from the API.
        Request is executed immediately

        :param device:
        :param sim:
        :param status:
        :param direction:
        :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 CommandInstance
        rz   ra   rb   rL   rM   rN   r|   N)r   rS   r-   rp   rK   rU   r~   r'   r'   r(   rp     s&       zCommandList.page_async)
target_urlr+   c                 C   s   | j jjd|}t| j |S )z
        Retrieve a specific page of CommandInstance records from the API.
        Request is executed immediately

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

        :returns: Page of CommandInstance
        rN   )r-   domaintwiliorequestrU   r$   r   r   r'   r'   r(   get_page%  s    	zCommandList.get_pagec                    s$   | j jjd|I dH }t| j |S )a  
        Asynchronously retrieve a specific page of CommandInstance records from the API.
        Request is executed immediately

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

        :returns: Page of CommandInstance
        rN   N)r-   r   r   Zrequest_asyncrU   r   r'   r'   r(   get_page_async1  s    	zCommandList.get_page_async)r   r+   c                 C   s   t | j|dS zB
        Constructs a CommandContext

        :param sid:
        r,   r)   r-   r$   r   r'   r'   r(   r!   =  s    zCommandList.getc                 C   s   t | j|dS r   r   r   r'   r'   r(   __call__E  s    zCommandList.__call__r*   c                 C   s   dS )r4   z%<Twilio.Preview.Wireless.CommandList>r'   r.   r'   r'   r(   rC   M  s    zCommandList.__repr__) rD   rE   rF   r   r    r   unsetrH   r   objectr   rf   rh   r   intr   rn   r	   rq   r   rs   rw   rU   rm   rp   r   r   r)   r!   r   rC   rJ   r'   r'   r%   r(   rW      s  





2





1



)



)



(



)






/






-rW   N)rG   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   r)   rU   rW   r'   r'   r'   r(   <module>   s   $TE