o
    f>hA,                     @   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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ejejejejfdeeef deeef dedef deeef d	d f
ddZejejejejfdeeef deeef dedef deeef d	d f
ddZd	efddZ  ZS )UserInstancec                   @   s   e Zd ZdZdZdS )UserInstance.StateTypeactivedeactivatedN)__name__
__module____qualname__ACTIVEDEACTIVATED r   r   T/var/www/html/venv/lib/python3.10/site-packages/twilio/rest/frontline_api/v1/user.py	StateType   s    r   Nversionpayloadsidc                    sz   t  | |d| _|d| _|d| _|d| _|d| _|d| _|d| _	d|p5| 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__returnUserContextc                 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: 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   r0   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   r2   Q   s   zUserInstance.fetch_asyncr   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   r5   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
        r4   N)r.   update_asyncr6   r   r   r   r8   r   s   zUserInstance.update_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>       z(UserInstance.__repr__.<locals>.<genexpr>z(<Twilio.FrontlineApi.V1.UserInstance {}>joinr$   itemsr?   r&   contextr   r   r   __repr__      
zUserInstance.__repr__)N)r)   r*   )r)   r   )r   r   r   objectr   r   r   strr   r   r"   propertyr.   r0   r2   r   unsetr   boolr5   r8   rK   __classcell__r   r   r'   r   r      s\    


	









r   c                       s   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e	j
e	j
e	j
e	j
fd
eeef deeef dedef deeef def
ddZe	j
e	j
e	j
e	j
fd
eeef deeef dedef deeef 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 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}Nr   )r!   r"   r$   r?   _uri)r&   r   r   r'   r   r   r"      s   zUserContext.__init__r)   c                 C   s<   t i }d|d< | jjd| j|d}t| j|| jd dS )r/   application/jsonAcceptGETmethoduriheadersr   r+   )r   ofr,   r0   rS   r   r$   r&   rZ   r   r   r   r   r0      s   
zUserContext.fetchc                    sD   t i }d|d< | jjd| j|dI dH }t| j|| jd dS )r1   rT   rU   rV   rW   Nr   r+   )r   r[   r,   r2   rS   r   r$   r\   r   r   r   r2      s   
zUserContext.fetch_asyncr   r   r   r   r   c                 C   s`   t |||t|d}t i }d|d< d|d< | jjd| j||d}t| j|| jd d	S )
r3   FriendlyNameAvatarStateIsAvailable!application/x-www-form-urlencodedContent-TyperT   rU   POSTrX   rY   datarZ   r   r+   )	r   r[   r   boolean_to_stringr,   r5   rS   r   r$   r&   r   r   r   r   rf   rZ   r   r   r   r   r5      s   

zUserContext.updatec                    sh   t |||t|d}t i }d|d< d|d< | jjd| j||dI dH }t| j|| jd	 d
S )r7   r]   rb   rc   rT   rU   rd   re   Nr   r+   )	r   r[   r   rg   r,   r8   rS   r   r$   rh   r   r   r   r8      s   

zUserContext.update_asyncc                 C   r9   )r:   r;   c                 s   r<   r=   r>   r@   r   r   r   rD   !  rE   z'UserContext.__repr__.<locals>.<genexpr>z'<Twilio.FrontlineApi.V1.UserContext {}>rF   rI   r   r   r   rK     rL   zUserContext.__repr__)r   r   r   r   rN   r"   r   r0   r2   r   rP   r   rM   rQ   r5   r8   rK   rR   r   r   r'   r   r*      sF    




(




&r*   c                       sT   e Zd Zdef 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 )UserListr   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      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#   0     zUserList.getc                 C   rj   rk   rl   rm   r   r   r   __call__8  rn   zUserList.__call__c                 C   s   dS )r:   z!<Twilio.FrontlineApi.V1.UserList>r   r-   r   r   r   rK   @  s   zUserList.__repr__)r   r   r   r   r"   rN   r*   r#   ro   rK   rR   r   r   r'   r   ri   %  s
    	ri   N)__doc__typingr   r   r   r   twilio.baser   r   twilio.base.instance_contextr   twilio.base.instance_resourcer	   twilio.base.list_resourcer
   twilio.base.versionr   r   r*   ri   r   r   r   r   <module>   s    } 