U
    hRf*                     @   s   d Z ddl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 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 - Frontline
    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.
    )AnyDictOptionalUnion)	serializevalues)InstanceContext)InstanceResource)ListResource)Versionc                       s  e Zd 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jejejejfeeef eeef edef eeef d dddZejejejejfeeef eeef edef eeef d dddZedddZ  ZS )UserInstancec                   @   s   e Zd ZdZdZdS )UserInstance.StateTypeactiveZdeactivatedN)__name__
__module____qualname__ZACTIVEZDEACTIVATED r   r   E/tmp/pip-unpacked-wheel-74se_viw/twilio/rest/frontline_api/v1/user.py	StateType   s   r   N)versionpayloadsidc                    sz   t  | |d| _|d| _|d| _|d| _|d| _|d| _|d| _	d|pj| ji| _
d | _d S )Nr   identityfriendly_nameavatarstateis_availableurl)super__init__getr   r   r   r   r   r   r   	_solution_context)selfr   r   r   	__class__r   r   r   '   s     zUserInstance.__init__UserContext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: UserContext for this UserInstance
        Nr   r   )r"   r&   _versionr!   r#   r   r   r   _proxy9   s    
zUserInstance._proxyc                 C   s
   | j  S )U
        Fetch the UserInstance


        :returns: The fetched UserInstance
        )r,   fetchr+   r   r   r   r.   H   s    zUserInstance.fetchc                    s   | j  I dH S )o
        Asynchronous coroutine to fetch the UserInstance


        :returns: The fetched UserInstance
        N)r,   fetch_asyncr+   r   r   r   r0   Q   s    zUserInstance.fetch_asyncr   r   r   r   r   r(   c                 C   s   | j j||||dS )   
        Update the UserInstance

        :param friendly_name: The string that you assigned to describe the User.
        :param avatar: The avatar URL which will be shown in Frontline application.
        :param state:
        :param is_available: Whether the User is available for new conversations. Set to `false` to prevent User from receiving new inbound conversations if you are using [Pool Routing](https://www.twilio.com/docs/frontline/handle-incoming-conversations#3-pool-routing).

        :returns: The updated UserInstance
        r   r   r   r   )r,   updater#   r   r   r   r   r   r   r   r4   Z   s    zUserInstance.updatec                    s   | j j||||dI dH S ):  
        Asynchronous coroutine to update the UserInstance

        :param friendly_name: The string that you assigned to describe the User.
        :param avatar: The avatar URL which will be shown in Frontline application.
        :param state:
        :param is_available: Whether the User is available for new conversations. Set to `false` to prevent User from receiving new inbound conversations if you are using [Pool Routing](https://www.twilio.com/docs/frontline/handle-incoming-conversations#3-pool-routing).

        :returns: The updated UserInstance
        r3   N)r,   update_asyncr5   r   r   r   r7   r   s    zUserInstance.update_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(UserInstance.__repr__.<locals>.<genexpr>z(<Twilio.FrontlineApi.V1.UserInstance {}>joinr!   itemsr<   r#   contextr   r   r   __repr__   s    zUserInstance.__repr__)N)r   r   r   objectr   r   r   strr   r   r   propertyr,   r.   r0   r   unsetr   boolr4   r7   rG   __classcell__r   r   r$   r   r      sD     
 	







r   c                       s   e Zd Zeed fddZedddZedddZe	j
e	j
e	j
e	j
feeef eeef ed	ef eeef ed
ddZe	j
e	j
e	j
e	j
feeef eeef ed	ef eeef 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 UserContext

        :param version: Version that contains the resource
        :param sid: The SID of the User resource to update. This value can be either the `sid` or the `identity` of the User resource to update.
        r   z/Users/{sid}N)r   r   r!   r<   _uri)r#   r   r   r$   r   r   r      s
     zUserContext.__init__r'   c                 C   s(   | j jd| jd}t| j || jd dS )r-   GETmethodurir   r)   )r*   r.   rN   r   r!   r#   r   r   r   r   r.      s    zUserContext.fetchc                    s.   | j jd| jdI dH }t| j || jd dS )r/   rO   rP   Nr   r)   )r*   r0   rN   r   r!   rS   r   r   r   r0      s    zUserContext.fetch_asyncr   r1   c                 C   sD   t |||t|d}| jjd| j|d}t| j|| jd dS )r2   ZFriendlyNameZAvatarStateZIsAvailablePOSTrQ   rR   datar   r)   )	r   ofr   boolean_to_stringr*   r4   rN   r   r!   r#   r   r   r   r   rX   r   r   r   r   r4      s    	zUserContext.updatec                    sJ   t |||t|d}| jjd| j|dI dH }t| j|| jd dS )r6   rT   rV   rW   Nr   r)   )	r   rY   r   rZ   r*   r7   rN   r   r!   r[   r   r   r   r7      s    	zUserContext.update_asyncc                 C   s$   d dd | j D }d|S )r8   r9   c                 s   s   | ]\}}d  ||V  qdS r:   r;   r=   r   r   r   rA     s     z'UserContext.__repr__.<locals>.<genexpr>z'<Twilio.FrontlineApi.V1.UserContext {}>rB   rE   r   r   r   rG     s    zUserContext.__repr__)r   r   r   r   rI   r   r   r.   r0   r   rK   r   rH   rL   r4   r7   rG   rM   r   r   r$   r   r&      s4   



$



"r&   c                       sP   e Zd Zed fddZeedddZeedddZed	d
dZ	  Z
S )UserList)r   c                    s   t  | dS )zf
        Initialize the UserList

        :param version: Version that contains the resource

        N)r   r   )r#   r   r$   r   r   r     s    zUserList.__init__)r   r(   c                 C   s   t | j|dS z
        Constructs a UserContext

        :param sid: The SID of the User resource to update. This value can be either the `sid` or the `identity` of the User resource to update.
        r)   r&   r*   r#   r   r   r   r   r    $  s    zUserList.getc                 C   s   t | j|dS r]   r^   r_   r   r   r   __call__,  s    zUserList.__call__r'   c                 C   s   dS )r8   z!<Twilio.FrontlineApi.V1.UserList>r   r+   r   r   r   rG   4  s    zUserList.__repr__)r   r   r   r   r   rI   r&   r    r`   rG   rM   r   r   r$   r   r\     s   	r\   N)__doc__typingr   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   r   r&   r\   r   r   r   r   <module>   s   } 