o
    f>h: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                       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 )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|pS| 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__ W/var/www/html/venv/lib/python3.10/site-packages/twilio/rest/preview/wireless/command.pyr    (   s&   

zCommandInstance.__init__returnCommandContextc                 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)   _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   $   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vr(   r(   r)   	<genexpr>i       z+CommandInstance.__repr__.<locals>.<genexpr>z,<Twilio.Preview.Wireless.CommandInstance {}>joinr#   itemsr:   r%   contextr(   r(   r)   __repr__c      
zCommandInstance.__repr__N)r*   r+   )r*   r   )__name__
__module____qualname____doc__r   r   strr   r   r    propertyr/   r1   r3   rF   __classcell__r(   r(   r&   r)   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 )r+   r   r   c                    s.   t  | d|i| _djdi | j| _dS )z
        Initialize the CommandContext

        :param version: Version that contains the resource
        :param sid:
        r   z/Commands/{sid}Nr(   )r   r    r#   r:   _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   rP   r   r#   r%   rW   r   r(   r(   r)   r1   ~   s   
zCommandContext.fetchc                    sD   t i }d|d< | jjd| j|dI dH }t| j|| jd dS )r2   rQ   rR   rS   rT   Nr   r,   )r   rX   r-   r3   rP   r   r#   rY   r(   r(   r)   r3      s   
zCommandContext.fetch_asyncc                 C   r4   )r5   r6   c                 s   r7   r8   r9   r;   r(   r(   r)   r?      r@   z*CommandContext.__repr__.<locals>.<genexpr>z+<Twilio.Preview.Wireless.CommandContext {}>rA   rD   r(   r(   r)   rF      rG   zCommandContext.__repr__)rI   rJ   rK   r   rM   r    r   r1   r3   rF   rO   r(   r(   r&   r)   r+   m   s
    r+   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 )CommandPager   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_instancec                 C      dS )r5   z%<Twilio.Preview.Wireless.CommandPage>r(   r.   r(   r(   r)   rF         zCommandPage.__repr__N)	rI   rJ   rK   r   rM   r   r   r[   rF   r(   r(   r(   r)   rZ      s    rZ   c                       s   e Zd Zdef fddZejejejejejejfde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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ddfdeee	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ddfdeee	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ddfdeee	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ddfdeee	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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ee	f defdd Zej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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 )/CommandListr   c                    s   t  | d| _dS )zi
        Initialize the CommandList

        :param version: Version that contains the resource

        z	/CommandsN)r   r    rP   )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SimCallbackMethodCallbackUrlCommandMode
IncludeSidContent-Type!application/x-www-form-urlencodedrQ   rR   POSTrU   rV   datarW   )r   rX   r-   createrP   r   r%   r   r_   r`   ra   rb   r   rc   rp   rW   r   r(   r(   r)   rq      s"   
zCommandList.createc              
      sb   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
        rd   rl   rm   rQ   rR   rn   ro   N)r   rX   r-   create_asyncrP   r   rr   r(   r(   r)   rs     s$   
zCommandList.create_asyncNr   r   limit	page_sizec           	      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
        ru   r_   r`   r   r   ru   rt   )r-   read_limitspagestream	r%   r_   r`   r   r   rt   ru   limitsrx   r(   r(   r)   ry   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
        ru   rv   Nrt   )r-   rw   
page_asyncstream_asyncrz   r(   r(   r)   r}   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
        r_   r`   r   r   rt   ru   )listry   r%   r_   r`   r   r   rt   ru   r(   r(   r)   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 rH   r(   )r<   recordr(   r(   r)   
<listcomp>  s
    z*CommandList.list_async.<locals>.<listcomp>r~   N)r}   r   r(   r(   r)   
list_async  s   
zCommandList.list_async
page_tokenpage_numberc              
   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
        rf   rg   Status	Direction	PageTokenr   PageSizerl   rm   rQ   rR   rS   rU   rV   paramsrW   )r   rX   r-   rx   rP   rZ   r%   r_   r`   r   r   r   r   ru   rp   rW   responser(   r(   r)   rx     s    
zCommandList.pagec              
      sZ   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
        r   rl   rm   rQ   rR   rS   r   N)r   rX   r-   r|   rP   rZ   r   r(   r(   r)   r|     s"   
zCommandList.page_async
target_urlc                 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
        rS   )r-   domaintwiliorequestrZ   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
        rS   N)r-   r   r   request_asyncrZ   r   r(   r(   r)   get_page_async1  s   	zCommandList.get_page_asyncr   c                 C      t | j|dS zB
        Constructs a CommandContext

        :param sid:
        r,   r+   r-   r%   r   r(   r(   r)   r!   =     zCommandList.getc                 C   r   r   r   r   r(   r(   r)   __call__E  r   zCommandList.__call__c                 C   r\   )r5   z%<Twilio.Preview.Wireless.CommandList>r(   r.   r(   r(   r)   rF   M  r]   zCommandList.__repr__) rI   rJ   rK   r   r    r   unsetrM   r   objectr   rq   rs   r   intr   ry   r	   r}   r   r   r   rZ   rx   r|   r   r   r+   r!   r   rF   rO   r(   r(   r&   r)   r^      sr   





	
2





	
1




)




)




(




)






	
/






	
-r^   N)rL   r   typingr   r   r   r   r   r   r	   twilio.baser
   r   twilio.base.instance_contextr   twilio.base.instance_resourcer   twilio.base.list_resourcer   twilio.base.versionr   twilio.base.pager   r   r+   rZ   r^   r(   r(   r(   r)   <module>   s    $TE