U
    k7gxJ                     @   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
   iso8601_datetimer   r   r   	_solution_context)selfr   r   r   	__class__ H/tmp/pip-unpacked-wheel-qtbjxrb6/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
        )r0   fetchr/   r(   r(   r)   r2   Q   s    zCommandInstance.fetchc                    s   | j  I dH S )u
        Asynchronous coroutine to fetch the CommandInstance


        :returns: The fetched CommandInstance
        N)r0   fetch_asyncr/   r(   r(   r)   r4   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#   itemsr9   r%   contextr(   r(   r)   __repr__c   s    zCommandInstance.__repr__)N)__name__
__module____qualname____doc__r   r   strr   r   r    propertyr0   r2   r4   rD   __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#   r9   _uri)r%   r   r   r&   r(   r)   r    o   s
     zCommandContext.__init__r+   c                 C   s(   | j jd| jd}t| j || jd dS )r1   GETmethodurir   r-   )r.   r2   rL   r   r#   r%   r   r(   r(   r)   r2   ~   s    zCommandContext.fetchc                    s.   | j jd| jdI dH }t| j || jd dS )r3   rM   rN   Nr   r-   )r.   r4   rL   r   r#   rQ   r(   r(   r)   r4      s    zCommandContext.fetch_asyncc                 C   s$   d dd | j D }d|S )r5   r6   c                 s   s   | ]\}}d  ||V  qdS r7   r8   r:   r(   r(   r)   r>      s     z*CommandContext.__repr__.<locals>.<genexpr>z+<Twilio.Preview.Wireless.CommandContext {}>r?   rB   r(   r(   r)   rD      s    zCommandContext.__repr__)rE   rF   rG   r   rI   r    r   r2   r4   rD   rK   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.   rQ   r(   r(   r)   get_instance   s    zCommandPage.get_instancer+   c                 C   s   dS )r5   z%<Twilio.Preview.Wireless.CommandPage>r(   r/   r(   r(   r)   rD      s    zCommandPage.__repr__N)	rE   rF   rG   r   rI   r   r   rS   rD   r(   r(   r(   r)   rR      s   rR   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    rL   )r%   r   r&   r(   r)   r       s    zCommandList.__init__)r   devicesimcallback_methodcallback_urlr   include_sidr,   c              
   C   sJ   t |||||||d}t ddi}	| 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-urlencodedPOSTrO   rP   dataheaders)r   ofr.   createrL   r   r%   r   rU   rV   rW   rX   r   rY   rb   rc   r   r(   r(   r)   re      s$       zCommandList.createc              
      sP   t |||||||d}t ddi}	| 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
        rZ   r^   r_   r`   ra   N)r   rd   r.   create_asyncrL   r   rf   r(   r(   r)   rg      s$       zCommandList.create_asyncN)rU   rV   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
        ri   rU   rV   r   r   ri   rh   )r.   read_limitspagestream	r%   rU   rV   r   r   rh   ri   Zlimitsrl   r(   r(   r)   rm   $  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
        ri   rj   Nrh   )r.   rk   
page_asyncstream_asyncrn   r(   r(   r)   rp   K  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
        rU   rV   r   r   rh   ri   )listrm   r%   rU   rV   r   r   rh   ri   r(   r(   r)   rr   r  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>rq   N)rp   rs   r(   r(   r)   
list_async  s    
zCommandList.list_async)rU   rV   r   r   
page_tokenpage_numberri   r,   c           
   
   C   s:   t |||||||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]   ZStatusZ	DirectionZ	PageTokenr   ZPageSizerM   rO   rP   params)r   rd   r.   rl   rL   rR   
r%   rU   rV   r   r   rw   rx   ri   rb   responser(   r(   r)   rl     s    zCommandList.pagec           
   
      s@   t |||||||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
        ry   rM   rz   N)r   rd   r.   ro   rL   rR   r|   r(   r(   r)   ro     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
        rM   )r.   domaintwiliorequestrR   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
        rM   N)r.   r   r   Zrequest_asyncrR   r   r(   r(   r)   get_page_async  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__/  s    zCommandList.__call__r+   c                 C   s   dS )r5   z%<Twilio.Preview.Wireless.CommandList>r(   r/   r(   r(   r)   rD   7  s    zCommandList.__repr__) rE   rF   rG   r   r    r   ZunsetrI   r   objectr   re   rg   r   intr   rm   r	   rp   r   rr   rv   rR   rl   ro   r   r   r*   r!   r   rD   rK   r(   r(   r&   r)   rT      s  





.





-



)



)



(



)






)






)rT   N)rH   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*   rR   rT   r(   r(   r(   r)   <module>   s   $TA