U
    k7g                     @   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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 - Intelligence
    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	serializevalues)InstanceContext)InstanceResource)ListResource)Version)Pagec                       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edddZedddZd dddZd dddZejejejej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eef eeef eeef edef d d
ddZejejejej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eef eeef eeef edef d d
ddZedddZ  ZS )ServiceInstancec                   @   s   e Zd ZdZdZdZdS )ServiceInstance.HttpMethodGETPOSTNULLN)__name__
__module____qualname__r   r   r    r   r   G/tmp/pip-unpacked-wheel-qtbjxrb6/twilio/rest/intelligence/v2/service.py
HttpMethod   s   r   N)versionpayloadsidc                    s   t  | |d| _|d| _|d| _|d| _|d| _t	|d| _
t	|d| _|d| _|d	| _|d
| _|d| _|d| _|d| _|d| _|d| _t|d| _d
|p| ji| _d | _d S )Naccount_sidauto_redactionmedia_redactionauto_transcribedata_loggingdate_createddate_updatedfriendly_namelanguage_coder   unique_nameurlwebhook_urlwebhook_http_method read_only_attached_operator_sidsr   )super__init__getr    r!   r"   r#   r$   r
   iso8601_datetimer%   r&   r'   r(   r   r)   r*   r+   r,   r-   integerr   	_solution_context)selfr   r   r   	__class__r   r   r/   3   s:     zServiceInstance.__init__ServiceContext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: ServiceContext for this ServiceInstance
        Nr   r   )r4   r8   _versionr3   r5   r   r   r   _proxyV   s    
zServiceInstance._proxyc                 C   s
   | j  S )j
        Deletes the ServiceInstance


        :returns: True if delete succeeds, False otherwise
        )r>   deleter=   r   r   r   r@   e   s    zServiceInstance.deletec                    s   | j  I dH S )
        Asynchronous coroutine that deletes the ServiceInstance


        :returns: True if delete succeeds, False otherwise
        N)r>   delete_asyncr=   r   r   r   rB   n   s    zServiceInstance.delete_asyncc                 C   s
   | j  S )[
        Fetch the ServiceInstance


        :returns: The fetched ServiceInstance
        )r>   fetchr=   r   r   r   rD   w   s    zServiceInstance.fetchc                    s   | j  I dH S )u
        Asynchronous coroutine to fetch the ServiceInstance


        :returns: The fetched ServiceInstance
        N)r>   fetch_asyncr=   r   r   r   rF      s    zServiceInstance.fetch_asyncr   
if_matchr#   r$   r'   r)   r!   r"   r+   r,   r:   c
           
      C   s   | j j|||||||||	d	S )Y  
        Update the ServiceInstance

        :param if_match: The If-Match HTTP request header
        :param auto_transcribe: Instructs the Speech Recognition service to automatically transcribe all recordings made on the account.
        :param data_logging: Data logging allows Twilio to improve the quality of the speech recognition & language understanding services through using customer data to refine, fine tune and evaluate machine learning models. Note: Data logging cannot be activated via API, only via www.twilio.com, as it requires additional consent.
        :param friendly_name: A human readable description of this resource, up to 64 characters.
        :param unique_name: Provides a unique and addressable name to be assigned to this Service, assigned by the developer, to be optionally used in addition to SID.
        :param auto_redaction: Instructs the Speech Recognition service to automatically redact PII from all transcripts made on this service.
        :param media_redaction: Instructs the Speech Recognition service to automatically redact PII from all transcripts media made on this service. The auto_redaction flag must be enabled, results in error otherwise.
        :param webhook_url: The URL Twilio will request when executing the Webhook.
        :param webhook_http_method:

        :returns: The updated ServiceInstance
        	rH   r#   r$   r'   r)   r!   r"   r+   r,   )r>   update
r5   rH   r#   r$   r'   r)   r!   r"   r+   r,   r   r   r   rK      s    zServiceInstance.updatec
           
         s$   | j j|||||||||	d	I dH S )s  
        Asynchronous coroutine to update the ServiceInstance

        :param if_match: The If-Match HTTP request header
        :param auto_transcribe: Instructs the Speech Recognition service to automatically transcribe all recordings made on the account.
        :param data_logging: Data logging allows Twilio to improve the quality of the speech recognition & language understanding services through using customer data to refine, fine tune and evaluate machine learning models. Note: Data logging cannot be activated via API, only via www.twilio.com, as it requires additional consent.
        :param friendly_name: A human readable description of this resource, up to 64 characters.
        :param unique_name: Provides a unique and addressable name to be assigned to this Service, assigned by the developer, to be optionally used in addition to SID.
        :param auto_redaction: Instructs the Speech Recognition service to automatically redact PII from all transcripts made on this service.
        :param media_redaction: Instructs the Speech Recognition service to automatically redact PII from all transcripts media made on this service. The auto_redaction flag must be enabled, results in error otherwise.
        :param webhook_url: The URL Twilio will request when executing the Webhook.
        :param webhook_http_method:

        :returns: The updated ServiceInstance
        rJ   N)r>   update_asyncrL   r   r   r   rN      s    zServiceInstance.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+ServiceInstance.__repr__.<locals>.<genexpr>z+<Twilio.Intelligence.V2.ServiceInstance {}>joinr3   itemsrS   r5   contextr   r   r   __repr__   s    zServiceInstance.__repr__)N)r   r   r   objectr   r   r   strr   r   r/   propertyr>   boolr@   rB   rD   rF   r   unsetr   rK   rN   r^   __classcell__r   r   r6   r   r      sp     
 #			








)








'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	dd	d
Z
e	dddZejejejej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eef eeef eeef edef e	d
ddZejejejej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eef eeef eeef edef e	d
ddZedddZ  ZS )r8   )r   r   c                    s*   t  | d|i| _djf | j| _dS )z
        Initialize the ServiceContext

        :param version: Version that contains the resource
        :param sid: A 34 character string that uniquely identifies this Service.
        r   z/Services/{sid}N)r.   r/   r3   rS   _uri)r5   r   r   r6   r   r   r/      s
     zServiceContext.__init__r9   c                 C   s   | j jd| jdS )r?   DELETEmethoduri)r<   r@   re   r=   r   r   r   r@      s    zServiceContext.deletec                    s   | j jd| jdI dH S )rA   rf   rg   N)r<   rB   re   r=   r   r   r   rB      s    zServiceContext.delete_asyncc                 C   s(   | j jd| jd}t| j || jd dS )rC   r   rg   r   r;   )r<   rD   re   r   r3   r5   r   r   r   r   rD   
  s    zServiceContext.fetchc                    s.   | j jd| jdI dH }t| j || jd dS )rE   r   rg   Nr   r;   )r<   rF   re   r   r3   rj   r   r   r   rF     s    zServiceContext.fetch_asyncr   rG   c
                 C   sn   t t|t|||t|t|||	d}
t d|i}| jjd| j|
|d}t| j|| jd dS )rI   AutoTranscribeDataLoggingFriendlyName
UniqueNameAutoRedactionMediaRedaction
WebhookUrlWebhookHttpMethodIf-Matchr   rh   ri   dataheadersr   r;   )	r   ofr   boolean_to_stringr<   rK   re   r   r3   r5   rH   r#   r$   r'   r)   r!   r"   r+   r,   rv   rw   r   r   r   r   rK   0  s.        zServiceContext.updatec
                    st   t t|t|||t|t|||	d}
t d|i}| jjd| j|
|dI dH }t| j|| jd dS )rM   rk   rt   r   ru   Nr   r;   )	r   rx   r   ry   r<   rN   re   r   r3   rz   r   r   r   rN   c  s.        zServiceContext.update_asyncc                 C   s$   d dd | j D }d|S )rO   rP   c                 s   s   | ]\}}d  ||V  qdS rQ   rR   rT   r   r   r   rX     s     z*ServiceContext.__repr__.<locals>.<genexpr>z*<Twilio.Intelligence.V2.ServiceContext {}>rY   r\   r   r   r   r^     s    zServiceContext.__repr__)r   r   r   r   r`   r/   rb   r@   rB   r   rD   rF   r   rc   r   r_   rK   rN   r^   rd   r   r   r6   r   r8      s`   








5








3r8   c                   @   s2   e Zd Zeeef edddZedddZdS )ServicePage)r   r:   c                 C   s   t | j|S )zm
        Build an instance of ServiceInstance

        :param payload: Payload response from the API
        )r   r<   rj   r   r   r   get_instance  s    zServicePage.get_instancer9   c                 C   s   dS )rO   z$<Twilio.Intelligence.V2.ServicePage>r   r=   r   r   r   r^     s    zServicePage.__repr__N)	r   r   r   r   r`   r   r   r|   r^   r   r   r   r   r{     s   r{   c                       sh  e Zd Zed fddZejejejejejejejejfeee	e
f ee	e
f eee
f eee
f ee	e
f ee	e
f eee
f ede
f ed
ddZejejejejejejejejfeee	e
f ee	e
f eee
f eee
f ee	e
f ee	e
f eee
f ede
f ed
dd	Zd&ee ee ee dddZd'ee ee ee dddZd(ee ee ee dddZd)ee ee ee dddZejejejfee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
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 )*ServiceList)r   c                    s   t  | d| _dS )zi
        Initialize the ServiceList

        :param version: Version that contains the resource

        z	/ServicesN)r.   r/   re   )r5   r   r6   r   r   r/     s    zServiceList.__init__r   )
r)   r#   r$   r'   r(   r!   r"   r+   r,   r:   c
                 C   sf   t |t|t|||t|t|||	d	}
t ddi}| jjd| j|
|d}t| j|S )aK  
        Create the ServiceInstance

        :param unique_name: Provides a unique and addressable name to be assigned to this Service, assigned by the developer, to be optionally used in addition to SID.
        :param auto_transcribe: Instructs the Speech Recognition service to automatically transcribe all recordings made on the account.
        :param data_logging: Data logging allows Twilio to improve the quality of the speech recognition & language understanding services through using customer data to refine, fine tune and evaluate machine learning models. Note: Data logging cannot be activated via API, only via www.twilio.com, as it requires additional consent.
        :param friendly_name: A human readable description of this resource, up to 64 characters.
        :param language_code: The language code set during Service creation determines the Transcription language for all call recordings processed by that Service. The default is en-US if no language code is set. A Service can only support one language code, and it cannot be updated once it's set.
        :param auto_redaction: Instructs the Speech Recognition service to automatically redact PII from all transcripts made on this service.
        :param media_redaction: Instructs the Speech Recognition service to automatically redact PII from all transcripts media made on this service. The auto_redaction flag must be enabled, results in error otherwise.
        :param webhook_url: The URL Twilio will request when executing the Webhook.
        :param webhook_http_method:

        :returns: The created ServiceInstance
        	ro   rl   rm   rn   ZLanguageCoderp   rq   rr   rs   Content-Type!application/x-www-form-urlencodedr   ru   )r   rx   r   ry   r<   createre   r   r5   r)   r#   r$   r'   r(   r!   r"   r+   r,   rv   rw   r   r   r   r   r     s(       zServiceList.createc
                    sl   t |t|t|||t|t|||	d	}
t ddi}| jjd| j|
|dI dH }t| j|S )aZ  
        Asynchronously create the ServiceInstance

        :param unique_name: Provides a unique and addressable name to be assigned to this Service, assigned by the developer, to be optionally used in addition to SID.
        :param auto_transcribe: Instructs the Speech Recognition service to automatically transcribe all recordings made on the account.
        :param data_logging: Data logging allows Twilio to improve the quality of the speech recognition & language understanding services through using customer data to refine, fine tune and evaluate machine learning models. Note: Data logging cannot be activated via API, only via www.twilio.com, as it requires additional consent.
        :param friendly_name: A human readable description of this resource, up to 64 characters.
        :param language_code: The language code set during Service creation determines the Transcription language for all call recordings processed by that Service. The default is en-US if no language code is set. A Service can only support one language code, and it cannot be updated once it's set.
        :param auto_redaction: Instructs the Speech Recognition service to automatically redact PII from all transcripts made on this service.
        :param media_redaction: Instructs the Speech Recognition service to automatically redact PII from all transcripts media made on this service. The auto_redaction flag must be enabled, results in error otherwise.
        :param webhook_url: The URL Twilio will request when executing the Webhook.
        :param webhook_http_method:

        :returns: The created ServiceInstance
        r~   r   r   r   ru   N)r   rx   r   ry   r<   create_asyncre   r   r   r   r   r   r     s(       zServiceList.create_asyncN)limit	page_sizer:   c                 C   s0   | j ||}| j|d d}| j ||d S )a]  
        Streams ServiceInstance 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 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
        r   r   r   )r<   read_limitspagestreamr5   r   r   Zlimitsr   r   r   r   r   "  s    zServiceList.streamc                    s6   | j ||}| j|d dI dH }| j ||d S )al  
        Asynchronously streams ServiceInstance 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 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
        r   r   Nr   )r<   r   
page_asyncstream_asyncr   r   r   r   r   ;  s    zServiceList.stream_asyncc                 C   s   t | j||dS )a  
        Lists ServiceInstance records from the API as a list.
        Unlike stream(), this operation is eager and will load `limit` records into
        memory before returning.

        :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   )listr   r5   r   r   r   r   r   r   T  s    zServiceList.listc                    s$   dd | j ||dI dH 2 I dH S )a	  
        Asynchronously lists ServiceInstance records from the API as a list.
        Unlike stream(), this operation is eager and will load `limit` records into
        memory before returning.

        :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   )rU   recordr   r   r   
<listcomp>  s   z*ServiceList.list_async.<locals>.<listcomp>r   N)r   r   r   r   r   
list_asyncn  s    
zServiceList.list_async)
page_tokenpage_numberr   r:   c                 C   s2   t |||d}| jjd| j|d}t| j|S )as  
        Retrieve a single page of ServiceInstance records from the API.
        Request is executed immediately

        :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 ServiceInstance
        Z	PageTokenr   ZPageSizer   rh   ri   params)r   rx   r<   r   re   r{   r5   r   r   r   rv   responser   r   r   r     s    zServiceList.pagec                    s8   t |||d}| jjd| j|dI dH }t| j|S )a  
        Asynchronously retrieve a single page of ServiceInstance records from the API.
        Request is executed immediately

        :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 ServiceInstance
        r   r   r   N)r   rx   r<   r   re   r{   r   r   r   r   r     s      zServiceList.page_async)
target_urlr:   c                 C   s   | j jjd|}t| j |S )z
        Retrieve a specific page of ServiceInstance records from the API.
        Request is executed immediately

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

        :returns: Page of ServiceInstance
        r   )r<   domaintwiliorequestr{   r5   r   r   r   r   r   get_page  s    	zServiceList.get_pagec                    s$   | j jjd|I dH }t| j |S )a  
        Asynchronously retrieve a specific page of ServiceInstance records from the API.
        Request is executed immediately

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

        :returns: Page of ServiceInstance
        r   N)r<   r   r   Zrequest_asyncr{   r   r   r   r   get_page_async  s    	zServiceList.get_page_async)r   r:   c                 C   s   t | j|dS z
        Constructs a ServiceContext

        :param sid: A 34 character string that uniquely identifies this Service.
        r;   r8   r<   r5   r   r   r   r   r0     s    zServiceList.getc                 C   s   t | j|dS r   r   r   r   r   r   __call__  s    zServiceList.__call__r9   c                 C   s   dS )rO   z$<Twilio.Intelligence.V2.ServiceList>r   r=   r   r   r   r^     s    zServiceList.__repr__)NN)NN)NN)NN)!r   r   r   r   r/   r   rc   r`   r   rb   r_   r   r   r   r   intr   r   r	   r   r   r   r   r{   r   r   r   r   r8   r0   r   r^   rd   r   r   r6   r   r}     s   







4







3        





r}   N)__doc__r   typingr   r   r   r   r   r   r	   Ztwilio.baser
   r   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   r8   r{   r}   r   r   r   r   <module>   s   $ I @