U
    iRfh                     @   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 - Supersim
    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G dd de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 )IpCommandInstancec                   @   s   e Zd ZdZdZdS )IpCommandInstance.DirectionZto_simZfrom_simN)__name__
__module____qualname__ZTO_SIMZFROM_SIM r   r   F/tmp/pip-unpacked-wheel-74se_viw/twilio/rest/supersim/v1/ip_command.py	Direction   s   r   c                   @   s   e Zd ZdZdZdS )IpCommandInstance.PayloadTypetextbinaryN)r   r   r   ZTEXTBINARYr   r   r   r   PayloadType   s   r   c                   @   s   e Zd ZdZdZdZdZdS )IpCommandInstance.StatusZqueuedsentZreceivedfailedN)r   r   r   ZQUEUEDZSENTZRECEIVEDZFAILEDr   r   r   r   Status#   s   r!   N)versionpayloadsidc                    s   t  | |d| _|d| _|d| _|d| _|d| _|d| _|d| _	t
|d| _|d	| _|d
| _t
|d| _t
|d| _|d| _d|p| ji| _d | _d S )Nr$   account_sidsim_sid	sim_iccidstatus	direction	device_ipdevice_portpayload_typer#   date_createddate_updatedurl)super__init__getr$   r%   r&   r'   r(   r)   r*   r
   integerr+   r,   r#   iso8601_datetimer-   r.   r/   	_solution_context)selfr"   r#   r$   	__class__r   r   r1   9   s8     zIpCommandInstance.__init__IpCommandContext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: IpCommandContext for this IpCommandInstance
        Nr$   r$   )r6   r:   _versionr5   r7   r   r   r   _proxy[   s    
zIpCommandInstance._proxyc                 C   s
   | j  S )_
        Fetch the IpCommandInstance


        :returns: The fetched IpCommandInstance
        )r@   fetchr?   r   r   r   rB   j   s    zIpCommandInstance.fetchc                    s   | j  I dH S )y
        Asynchronous coroutine to fetch the IpCommandInstance


        :returns: The fetched IpCommandInstance
        N)r@   fetch_asyncr?   r   r   r   rD   s   s    zIpCommandInstance.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>   s     z-IpCommandInstance.__repr__.<locals>.<genexpr>z)<Twilio.Supersim.V1.IpCommandInstance {}>joinr5   itemsrI   r7   contextr   r   r   __repr__|   s    zIpCommandInstance.__repr__)N)r   r   r   objectr   r   r!   r   r   strr   r   r1   propertyr@   rB   rD   rT   __classcell__r   r   r8   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 IpCommandContext

        :param version: Version that contains the resource
        :param sid: The SID of the IP Command resource to fetch.
        r$   z/IpCommands/{sid}N)r0   r1   r5   rI   _uri)r7   r"   r$   r8   r   r   r1      s
     zIpCommandContext.__init__r;   c                 C   s(   | j jd| jd}t| j || jd dS )rA   GETmethodurir$   r=   )r>   rB   rY   r   r5   r7   r#   r   r   r   rB      s    zIpCommandContext.fetchc                    s.   | j jd| jdI dH }t| j || jd dS )rC   rZ   r[   Nr$   r=   )r>   rD   rY   r   r5   r^   r   r   r   rD      s    zIpCommandContext.fetch_asyncc                 C   s$   d dd | j D }d|S )rE   rF   c                 s   s   | ]\}}d  ||V  qdS rG   rH   rJ   r   r   r   rN      s     z,IpCommandContext.__repr__.<locals>.<genexpr>z(<Twilio.Supersim.V1.IpCommandContext {}>rO   rR   r   r   r   rT      s    zIpCommandContext.__repr__)r   r   r   r   rV   r1   r   rB   rD   rT   rX   r   r   r8   r   r:      s   r:   c                   @   s2   e Zd Zeeef edddZedddZdS )IpCommandPage)r#   r<   c                 C   s   t | j|S )zo
        Build an instance of IpCommandInstance

        :param payload: Payload response from the API
        )r   r>   r^   r   r   r   get_instance   s    zIpCommandPage.get_instancer;   c                 C   s   dS )rE   z"<Twilio.Supersim.V1.IpCommandPage>r   r?   r   r   r   rT      s    zIpCommandPage.__repr__N)	r   r   r   r   rV   r   r   r`   rT   r   r   r   r   r_      s   r_   c                
       sD  e Zd Zed fddZejejejfeeee	d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e	d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	de
f e	d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	de
f e	d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	de
f e	d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	de
f e	d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	de
f e	d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	de
f e	d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 )(IpCommandList)r"   c                    s   t  | d| _dS )zk
        Initialize the IpCommandList

        :param version: Version that contains the resource

        z/IpCommandsN)r0   r1   rY   )r7   r"   r8   r   r   r1      s    zIpCommandList.__init__r   )simr#   r+   r,   callback_urlcallback_methodr<   c           	   	   C   sH   t ||||||d}t ddi}| jjd| j||d}t| j|S )aR  
        Create the IpCommandInstance

        :param sim: The `sid` or `unique_name` of the [Super SIM](https://www.twilio.com/docs/iot/supersim/api/sim-resource) to send the IP Command to.
        :param payload: The data that will be sent to the device. The payload cannot exceed 1300 bytes. If the PayloadType is set to text, the payload is encoded in UTF-8. If PayloadType is set to binary, the payload is encoded in Base64.
        :param device_port: The device port to which the IP Command will be sent.
        :param payload_type:
        :param callback_url: The URL we should call using the `callback_method` after we have sent the IP Command.
        :param callback_method: The HTTP method we should use to call `callback_url`. Can be `GET` or `POST`, and the default is `POST`.

        :returns: The created IpCommandInstance
        SimZPayloadZ
DevicePortr   ZCallbackUrlZCallbackMethodContent-Type!application/x-www-form-urlencodedPOSTr\   r]   dataheaders)r   ofr>   createrY   r   	r7   rb   r#   r+   r,   rc   rd   rk   rl   r   r   r   rn      s"    
   zIpCommandList.createc           	   	      sN   t ||||||d}t ddi}| jjd| j||dI dH }t| j|S )aa  
        Asynchronously create the IpCommandInstance

        :param sim: The `sid` or `unique_name` of the [Super SIM](https://www.twilio.com/docs/iot/supersim/api/sim-resource) to send the IP Command to.
        :param payload: The data that will be sent to the device. The payload cannot exceed 1300 bytes. If the PayloadType is set to text, the payload is encoded in UTF-8. If PayloadType is set to binary, the payload is encoded in Base64.
        :param device_port: The device port to which the IP Command will be sent.
        :param payload_type:
        :param callback_url: The URL we should call using the `callback_method` after we have sent the IP Command.
        :param callback_method: The HTTP method we should use to call `callback_url`. Can be `GET` or `POST`, and the default is `POST`.

        :returns: The created IpCommandInstance
        re   rg   rh   ri   rj   N)r   rm   r>   create_asyncrY   r   ro   r   r   r   rp     s"    
   zIpCommandList.create_asyncNr   r   )rb   r'   r(   r)   limit	page_sizer<   c           	      C   s8   | j ||}| j|||||d d}| j ||d S )aJ  
        Streams IpCommandInstance 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 sim: The SID or unique name of the Sim resource that IP Command was sent to or from.
        :param str sim_iccid: The ICCID of the Sim resource that IP Command was sent to or from.
        :param &quot;IpCommandInstance.Status&quot; status: The status of the IP Command. Can be: `queued`, `sent`, `received` or `failed`. See the [IP Command Status Values](https://www.twilio.com/docs/iot/supersim/api/ipcommand-resource#status-values) for a description of each.
        :param &quot;IpCommandInstance.Direction&quot; direction: The direction of the IP Command. Can be `to_sim` or `from_sim`. The value of `to_sim` is synonymous with the term `mobile terminated`, and `from_sim` is synonymous with the term `mobile originated`.
        :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
        rr   rb   r'   r(   r)   rr   rq   )r>   read_limitspagestream	r7   rb   r'   r(   r)   rq   rr   Zlimitsru   r   r   r   rv   7  s    zIpCommandList.streamc           	         s>   | j ||}| j|||||d dI dH }| j ||d S )aY  
        Asynchronously streams IpCommandInstance 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 sim: The SID or unique name of the Sim resource that IP Command was sent to or from.
        :param str sim_iccid: The ICCID of the Sim resource that IP Command was sent to or from.
        :param &quot;IpCommandInstance.Status&quot; status: The status of the IP Command. Can be: `queued`, `sent`, `received` or `failed`. See the [IP Command Status Values](https://www.twilio.com/docs/iot/supersim/api/ipcommand-resource#status-values) for a description of each.
        :param &quot;IpCommandInstance.Direction&quot; direction: The direction of the IP Command. Can be `to_sim` or `from_sim`. The value of `to_sim` is synonymous with the term `mobile terminated`, and `from_sim` is synonymous with the term `mobile originated`.
        :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
        rr   rs   Nrq   )r>   rt   
page_asyncstream_asyncrw   r   r   r   ry   ^  s    zIpCommandList.stream_asyncc              	   C   s   t | j||||||dS )a  
        Lists IpCommandInstance records from the API as a list.
        Unlike stream(), this operation is eager and will load `limit` records into
        memory before returning.

        :param str sim: The SID or unique name of the Sim resource that IP Command was sent to or from.
        :param str sim_iccid: The ICCID of the Sim resource that IP Command was sent to or from.
        :param &quot;IpCommandInstance.Status&quot; status: The status of the IP Command. Can be: `queued`, `sent`, `received` or `failed`. See the [IP Command Status Values](https://www.twilio.com/docs/iot/supersim/api/ipcommand-resource#status-values) for a description of each.
        :param &quot;IpCommandInstance.Direction&quot; direction: The direction of the IP Command. Can be `to_sim` or `from_sim`. The value of `to_sim` is synonymous with the term `mobile terminated`, and `from_sim` is synonymous with the term `mobile originated`.
        :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
        rb   r'   r(   r)   rq   rr   )listrv   r7   rb   r'   r(   r)   rq   rr   r   r   r   r{     s    zIpCommandList.listc              	      s,   dd | j ||||||dI dH 2 I dH S )a  
        Asynchronously lists IpCommandInstance records from the API as a list.
        Unlike stream(), this operation is eager and will load `limit` records into
        memory before returning.

        :param str sim: The SID or unique name of the Sim resource that IP Command was sent to or from.
        :param str sim_iccid: The ICCID of the Sim resource that IP Command was sent to or from.
        :param &quot;IpCommandInstance.Status&quot; status: The status of the IP Command. Can be: `queued`, `sent`, `received` or `failed`. See the [IP Command Status Values](https://www.twilio.com/docs/iot/supersim/api/ipcommand-resource#status-values) for a description of each.
        :param &quot;IpCommandInstance.Direction&quot; direction: The direction of the IP Command. Can be `to_sim` or `from_sim`. The value of `to_sim` is synonymous with the term `mobile terminated`, and `from_sim` is synonymous with the term `mobile originated`.
        :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   )rK   recordr   r   r   
<listcomp>  s   z,IpCommandList.list_async.<locals>.<listcomp>rz   N)ry   r|   r   r   r   
list_async  s    
zIpCommandList.list_async)rb   r'   r(   r)   
page_tokenpage_numberrr   r<   c           
   
   C   s:   t |||||||d}| jjd| j|d}	t| j|	S )a  
        Retrieve a single page of IpCommandInstance records from the API.
        Request is executed immediately

        :param sim: The SID or unique name of the Sim resource that IP Command was sent to or from.
        :param sim_iccid: The ICCID of the Sim resource that IP Command was sent to or from.
        :param status: The status of the IP Command. Can be: `queued`, `sent`, `received` or `failed`. See the [IP Command Status Values](https://www.twilio.com/docs/iot/supersim/api/ipcommand-resource#status-values) for a description of each.
        :param direction: The direction of the IP Command. Can be `to_sim` or `from_sim`. The value of `to_sim` is synonymous with the term `mobile terminated`, and `from_sim` is synonymous with the term `mobile originated`.
        :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 IpCommandInstance
        rf   ZSimIccidr!   r   Z	PageTokenr   ZPageSizerZ   r\   r]   params)r   rm   r>   ru   rY   r_   
r7   rb   r'   r(   r)   r   r   rr   rk   responser   r   r   ru     s    zIpCommandList.pagec           
   
      s@   t |||||||d}| jjd| j|dI dH }	t| j|	S )a  
        Asynchronously retrieve a single page of IpCommandInstance records from the API.
        Request is executed immediately

        :param sim: The SID or unique name of the Sim resource that IP Command was sent to or from.
        :param sim_iccid: The ICCID of the Sim resource that IP Command was sent to or from.
        :param status: The status of the IP Command. Can be: `queued`, `sent`, `received` or `failed`. See the [IP Command Status Values](https://www.twilio.com/docs/iot/supersim/api/ipcommand-resource#status-values) for a description of each.
        :param direction: The direction of the IP Command. Can be `to_sim` or `from_sim`. The value of `to_sim` is synonymous with the term `mobile terminated`, and `from_sim` is synonymous with the term `mobile originated`.
        :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 IpCommandInstance
        r   rZ   r   N)r   rm   r>   rx   rY   r_   r   r   r   r   rx     s       zIpCommandList.page_async)
target_urlr<   c                 C   s   | j jjd|}t| j |S )z
        Retrieve a specific page of IpCommandInstance records from the API.
        Request is executed immediately

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

        :returns: Page of IpCommandInstance
        rZ   )r>   domaintwiliorequestr_   r7   r   r   r   r   r   get_page"  s    	zIpCommandList.get_pagec                    s$   | j jjd|I dH }t| j |S )a  
        Asynchronously retrieve a specific page of IpCommandInstance records from the API.
        Request is executed immediately

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

        :returns: Page of IpCommandInstance
        rZ   N)r>   r   r   Zrequest_asyncr_   r   r   r   r   get_page_async.  s    	zIpCommandList.get_page_async)r$   r<   c                 C   s   t | j|dS zq
        Constructs a IpCommandContext

        :param sid: The SID of the IP Command resource to fetch.
        r=   r:   r>   r7   r$   r   r   r   r2   :  s    zIpCommandList.getc                 C   s   t | j|dS r   r   r   r   r   r   __call__B  s    zIpCommandList.__call__r;   c                 C   s   dS )rE   z"<Twilio.Supersim.V1.IpCommandList>r   r?   r   r   r   rT   J  s    zIpCommandList.__repr__) r   r   r   r   r1   r   ZunsetrV   intr   rU   r   rn   rp   r   r   rv   r	   ry   r   r{   r   r_   ru   rx   r   r   r:   r2   r   rT   rX   r   r   r8   r   ra      s   


-


*



)



)



(



)






)






)ra   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   r:   r_   ra   r   r   r   r   <module>   s   $mA