a
    !fI                     @   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__ e/var/www/html/python-backend/venv/lib/python3.9/site-packages/twilio/rest/preview/wireless/command.pyr    *   s&    
zCommandInstance.__init__CommandContext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: CommandContext for this CommandInstance
        Nr   r   )r$   r*   _versionr#   r%   r(   r(   r)   _proxyD   s    
zCommandInstance._proxyc                 C   s
   | j  S )[
        Fetch the CommandInstance


        :returns: The fetched CommandInstance
        )r0   fetchr/   r(   r(   r)   r2   S   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   \   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>k       z+CommandInstance.__repr__.<locals>.<genexpr>z,<Twilio.Preview.Wireless.CommandInstance {}>joinr#   itemsr9   r%   contextr(   r(   r)   __repr__e   s    zCommandInstance.__repr__)N)__name__
__module____qualname____doc__r   r   strr   r   r    propertyr0   r2   r4   rE   __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 i | 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    p   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   rM   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   rN   rO   Nr   r-   )r.   r4   rM   r   r#   rR   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>      r?   z*CommandContext.__repr__.<locals>.<genexpr>z+<Twilio.Preview.Wireless.CommandContext {}>r@   rC   r(   r(   r)   rE      s    zCommandContext.__repr__)rF   rG   rH   r   rJ   r    r   r2   r4   rE   rL   r(   r(   r&   r)   r*   o   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.   rR   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)   rE      s    zCommandPage.__repr__N)	rF   rG   rH   r   rJ   r   r   rT   rE   r(   r(   r(   r)   rS      s   rS   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    rM   )r%   r   r&   r(   r)   r       s    zCommandList.__init__)r   devicesimcallback_methodcallback_urlr   include_sidr,   c           
   
   C   s:   t |||||||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POSTrP   rQ   data)r   ofr.   createrM   r   
r%   r   rV   rW   rX   rY   r   rZ   ra   r   r(   r(   r)   rc      s     zCommandList.createc           
   
      s@   t |||||||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[   r_   r`   N)r   rb   r.   create_asyncrM   r   rd   r(   r(   r)   re      s     zCommandList.create_asyncN)rV   rW   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
        rg   rV   rW   r   r   rg   rf   )r.   read_limitspagestream	r%   rV   rW   r   r   rf   rg   Zlimitsrj   r(   r(   r)   rk   #  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
        rg   rh   Nrf   )r.   ri   
page_asyncstream_asyncrl   r(   r(   r)   rn   J  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
        rV   rW   r   r   rf   rg   )listrk   r%   rV   rW   r   r   rf   rg   r(   r(   r)   rp   q  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>ro   N)rn   rq   r(   r(   r)   
list_async  s    
zCommandList.list_async)rV   rW   r   r   
page_tokenpage_numberrg   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^   StatusZ	DirectionZ	PageTokenr   ZPageSizerN   rP   rQ   params)r   rb   r.   rj   rM   rS   
r%   rV   rW   r   r   ru   rv   rg   ra   responser(   r(   r)   rj     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
        rw   rN   ry   N)r   rb   r.   rm   rM   rS   r{   r(   r(   r)   rm     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requestrS   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_asyncrS   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)   rE   6  s    zCommandList.__repr__) rF   rG   rH   r   r    r   unsetrJ   r   objectr   rc   re   r   intr   rk   r	   rn   r   rp   rt   rS   rj   rm   r   r   r*   r!   r   rE   rL   r(   r(   r&   r)   rU      s  





.





-



)



)



(



)






)






)rU   N)rI   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*   rS   rU   r(   r(   r(   r)   <module>   s   $U@