U
    hRf\                     @   s   d 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 - Flex
    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ListOptionalUnionIteratorAsyncIterator)deserializevalues)InstanceContext)InstanceResource)ListResource)Version)Pagec                       s   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ejfeeeeeef d d
ddZejfeeeeeef d d
ddZedddZ  ZS )AssessmentsInstancea  
    :ivar account_sid: The unique SID identifier of the Account.
    :ivar assessment_sid: The SID of the assessment
    :ivar offset: Offset of the conversation
    :ivar report: The flag indicating if this assessment is part of report
    :ivar weight: The weightage given to this comment
    :ivar agent_id: The id of the Agent
    :ivar segment_id: Segment Id of conversation
    :ivar user_name: The name of the user.
    :ivar user_email: The email id of the user.
    :ivar answer_text: The answer text selected by user
    :ivar answer_id: The id of the answer selected by user
    :ivar assessment: Assessment Details associated with an assessment
    :ivar timestamp:
    :ivar url:
    N)versionpayloadassessment_sidc                    s   t  | |d| _|d| _t|d| _|d| _t|d| _	|d| _
|d| _|d| _|d	| _|d
| _|d| _|d| _t|d| _|d| _d|p| ji| _d | _d S )Naccount_sidr   offsetreportweightagent_id
segment_id	user_name
user_emailanswer_text	answer_id
assessment	timestampurl)super__init__getr   r   r	   decimalr   r   r   r   r   r   r   r   r   r   r   r    	_solution_context)selfr   r   r   	__class__ G/tmp/pip-unpacked-wheel-74se_viw/twilio/rest/flex_api/v1/assessments.pyr"   *   s&     zAssessmentsInstance.__init__AssessmentsContext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: AssessmentsContext for this AssessmentsInstance
        Nr   r   )r&   r,   _versionr%   r'   r*   r*   r+   _proxyF   s    
zAssessmentsInstance._proxyr   r   r   authorizationr.   c                 C   s   | j j||||dS )[  
        Update the AssessmentsInstance

        :param offset: The offset of the conversation
        :param answer_text: The answer text selected by user
        :param answer_id: The id of the answer selected by user
        :param authorization: The Authorization HTTP request header

        :returns: The updated AssessmentsInstance
        r   r   r   r4   )r2   updater'   r   r   r   r4   r*   r*   r+   r7   U   s    zAssessmentsInstance.updatec                    s   | j j||||dI dH S )u  
        Asynchronous coroutine to update the AssessmentsInstance

        :param offset: The offset of the conversation
        :param answer_text: The answer text selected by user
        :param answer_id: The id of the answer selected by user
        :param authorization: The Authorization HTTP request header

        :returns: The updated AssessmentsInstance
        r6   N)r2   update_asyncr8   r*   r*   r+   r:   m   s    z AssessmentsInstance.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/AssessmentsInstance.__repr__.<locals>.<genexpr>z*<Twilio.FlexApi.V1.AssessmentsInstance {}>joinr%   itemsr?   r'   contextr*   r*   r+   __repr__   s    zAssessmentsInstance.__repr__)N)__name__
__module____qualname____doc__r   r   strr   r   r"   propertyr2   r
   unsetfloatr   objectr7   r:   rJ   __classcell__r*   r*   r(   r+   r      s4    


r   c                       sz   e Zd Zeed fddZejfeeee	ee
f edddZejfeee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 AssessmentsContext

        :param version: Version that contains the resource
        :param assessment_sid: The SID of the assessment to be modified
        r   z8/Insights/QualityManagement/Assessments/{assessment_sid}N)r!   r"   r%   r?   _uri)r'   r   r   r(   r*   r+   r"      s     zAssessmentsContext.__init__r3   c                 C   sL   t |||d}t d|i}| jjd| j||d}t| j|| jd dS )r5   Offset
AnswerTextAnswerIdAuthorizationPOSTmethoduridataheadersr   r/   )r
   ofr0   r7   rU   r   r%   r'   r   r   r   r4   r_   r`   r   r*   r*   r+   r7      s,          zAssessmentsContext.updatec                    sR   t |||d}t d|i}| jjd| j||dI dH }t| j|| jd dS )r9   rV   rZ   r[   r\   Nr   r/   )r
   ra   r0   r:   rU   r   r%   rb   r*   r*   r+   r:      s,          zAssessmentsContext.update_asyncr-   c                 C   s$   d dd | j D }d|S )r;   r<   c                 s   s   | ]\}}d  ||V  qdS r=   r>   r@   r*   r*   r+   rD      s     z.AssessmentsContext.__repr__.<locals>.<genexpr>z)<Twilio.FlexApi.V1.AssessmentsContext {}>rE   rH   r*   r*   r+   rJ      s    zAssessmentsContext.__repr__)rK   rL   rM   r   rO   r"   r
   rQ   rR   r   rS   r   r7   r:   rJ   rT   r*   r*   r(   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 )AssessmentsPage)r   r.   c                 C   s   t | j|S )zq
        Build an instance of AssessmentsInstance

        :param payload: Payload response from the API
        )r   r0   )r'   r   r*   r*   r+   get_instance   s    zAssessmentsPage.get_instancer-   c                 C   s   dS )r;   z#<Twilio.FlexApi.V1.AssessmentsPage>r*   r1   r*   r*   r+   rJ     s    zAssessmentsPage.__repr__N)	rK   rL   rM   r   rO   r   r   rd   rJ   r*   r*   r*   r+   rc      s   rc   c                       s  e Zd Zed fddZejfeeeeeeeeeee	ee
f edddZejfeeeeeeeeeee	ee
f edddZejejd	d	fe	ee
f e	ee
f ee ee ee d
ddZejejd	d	fe	ee
f e	ee
f ee ee ee d
ddZejejd	d	fe	ee
f e	ee
f ee ee ee d
ddZejejd	d	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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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 )%AssessmentsList)r   c                    s   t  | d| _dS )zm
        Initialize the AssessmentsList

        :param version: Version that contains the resource

        z'/Insights/QualityManagement/AssessmentsN)r!   r"   rU   )r'   r   r(   r*   r+   r"     s    zAssessmentsList.__init__)category_sidcategory_namer   r   r   	metric_idmetric_namer   r   questionnaire_sidr4   r.   c                 C   sR   t |||||||||	|
d
}t |dd}| jjd| j||d}t| j|S )a  
        Create the AssessmentsInstance

        :param category_sid: The SID of the category
        :param category_name: The name of the category
        :param segment_id: Segment Id of the conversation
        :param agent_id: The id of the Agent
        :param offset: The offset of the conversation.
        :param metric_id: The question SID selected for assessment
        :param metric_name: The question name of the assessment
        :param answer_text: The answer text selected by user
        :param answer_id: The id of the answer selected by user
        :param questionnaire_sid: Questionnaire SID of the associated question
        :param authorization: The Authorization HTTP request header

        :returns: The created AssessmentsInstance
        
ZCategorySidZCategoryName	SegmentIdZAgentIdrW   ZMetricIdZ
MetricNamerX   rY   ZQuestionnaireSid!application/x-www-form-urlencodedrZ   zContent-Typer[   r\   )r
   ra   r0   createrU   r   r'   rf   rg   r   r   r   rh   ri   r   r   rj   r4   r_   r`   r   r*   r*   r+   ro     s2        zAssessmentsList.createc                    sX   t |||||||||	|
d
}t |dd}| jjd| j||dI dH }t| j|S )a  
        Asynchronously create the AssessmentsInstance

        :param category_sid: The SID of the category
        :param category_name: The name of the category
        :param segment_id: Segment Id of the conversation
        :param agent_id: The id of the Agent
        :param offset: The offset of the conversation.
        :param metric_id: The question SID selected for assessment
        :param metric_name: The question name of the assessment
        :param answer_text: The answer text selected by user
        :param answer_id: The id of the answer selected by user
        :param questionnaire_sid: Questionnaire SID of the associated question
        :param authorization: The Authorization HTTP request header

        :returns: The created AssessmentsInstance
        rk   rm   rn   r[   r\   N)r
   ra   r0   create_asyncrU   r   rp   r*   r*   r+   rq   S  s2        zAssessmentsList.create_asyncN)r4   r   limit	page_sizer.   c                 C   s4   | j ||}| j|||d d}| j ||d S )a  
        Streams AssessmentsInstance 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 authorization: The Authorization HTTP request header
        :param str segment_id: The id of the segment.
        :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
        rs   r4   r   rs   rr   )r0   read_limitspagestreamr'   r4   r   rr   rs   Zlimitsrv   r*   r*   r+   rw     s    zAssessmentsList.streamc                    s:   | j ||}| j|||d dI dH }| j ||d S )a  
        Asynchronously streams AssessmentsInstance 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 authorization: The Authorization HTTP request header
        :param str segment_id: The id of the segment.
        :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
        rs   rt   Nrr   )r0   ru   
page_asyncstream_asyncrx   r*   r*   r+   rz     s    zAssessmentsList.stream_asyncc                 C   s   t | j||||dS )a|  
        Lists AssessmentsInstance records from the API as a list.
        Unlike stream(), this operation is eager and will load `limit` records into
        memory before returning.

        :param str authorization: The Authorization HTTP request header
        :param str segment_id: The id of the segment.
        :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
        r4   r   rr   rs   )listrw   r'   r4   r   rr   rs   r*   r*   r+   r|     s    zAssessmentsList.listc                    s(   dd | j ||||dI dH 2 I dH S )a  
        Asynchronously lists AssessmentsInstance records from the API as a list.
        Unlike stream(), this operation is eager and will load `limit` records into
        memory before returning.

        :param str authorization: The Authorization HTTP request header
        :param str segment_id: The id of the segment.
        :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*   )rA   recordr*   r*   r+   
<listcomp>  s   z.AssessmentsList.list_async.<locals>.<listcomp>r{   N)rz   r}   r*   r*   r+   
list_async  s    
zAssessmentsList.list_async)r4   r   
page_tokenpage_numberrs   r.   c                 C   s6   t |||||d}| jjd| j|d}t| j|S )a  
        Retrieve a single page of AssessmentsInstance records from the API.
        Request is executed immediately

        :param authorization: The Authorization HTTP request header
        :param segment_id: The id of the segment.
        :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 AssessmentsInstance
        rZ   rl   Z	PageTokenr   ZPageSizeGETr]   r^   params)r
   ra   r0   rv   rU   rc   r'   r4   r   r   r   rs   r_   responser*   r*   r+   rv     s    
zAssessmentsList.pagec                    s<   t |||||d}| jjd| j|dI dH }t| j|S )a   
        Asynchronously retrieve a single page of AssessmentsInstance records from the API.
        Request is executed immediately

        :param authorization: The Authorization HTTP request header
        :param segment_id: The id of the segment.
        :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 AssessmentsInstance
        r   r   r   N)r
   ra   r0   ry   rU   rc   r   r*   r*   r+   ry   2  s    
  zAssessmentsList.page_async)
target_urlr.   c                 C   s   | j jjd|}t| j |S )z
        Retrieve a specific page of AssessmentsInstance records from the API.
        Request is executed immediately

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

        :returns: Page of AssessmentsInstance
        r   )r0   domaintwiliorequestrc   r'   r   r   r*   r*   r+   get_pageU  s    	zAssessmentsList.get_pagec                    s$   | j jjd|I dH }t| j |S )a
  
        Asynchronously retrieve a specific page of AssessmentsInstance records from the API.
        Request is executed immediately

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

        :returns: Page of AssessmentsInstance
        r   N)r0   r   r   Zrequest_asyncrc   r   r*   r*   r+   get_page_asynca  s    	zAssessmentsList.get_page_async)r   r.   c                 C   s   t | j|dS zz
        Constructs a AssessmentsContext

        :param assessment_sid: The SID of the assessment to be modified
        r/   r,   r0   r'   r   r*   r*   r+   r#   m  s    zAssessmentsList.getc                 C   s   t | j|dS r   r   r   r*   r*   r+   __call__u  s    zAssessmentsList.__call__r-   c                 C   s   dS )r;   z#<Twilio.FlexApi.V1.AssessmentsList>r*   r1   r*   r*   r+   rJ   }  s    zAssessmentsList.__repr__)!rK   rL   rM   r   r"   r
   rQ   rO   rR   r   rS   r   ro   rq   r   intr   rw   r   rz   r   r|   r   rc   rv   ry   r   r   r,   r#   r   rJ   rT   r*   r*   r(   r+   re     s   
G
=

#

#

"

#




#




#re   N)rN   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,   rc   re   r*   r*   r*   r+   <module>   s   $wi