a
    !f                     @   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 - Video
    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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d
ddZ  ZS )CompositionInstancec                   @   s   e Zd ZdZdZdS )CompositionInstance.FormatZmp4ZwebmN)__name__
__module____qualname__ZMP4ZWEBM r   r   a/var/www/html/python-backend/venv/lib/python3.9/site-packages/twilio/rest/video/v1/composition.pyFormat   s   r   c                   @   s    e Zd ZdZdZdZdZdZdS )CompositionInstance.StatusZenqueued
processing	completedZdeletedfailedN)r   r   r   ZENQUEUED
PROCESSINGZ	COMPLETEDZDELETEDZFAILEDr   r   r   r   Status   s
   r   N)versionpayloadsidc                    sB  t  | |d| _|d| _t|d| _t|d| _t|d| _	|d| _
|d| _|d| _|d	| _|d
| _|d| _|d| _|d| _t|d| _|d| _t|d| _|d| _|d| _|d| _|d| _|d| _d|p2| j
i| _d | _d S )Naccount_sidstatusdate_createddate_completeddate_deletedr"   room_sidaudio_sourcesaudio_sources_excludedvideo_layout
resolutiontrimformatbitratesizedurationmedia_external_locationstatus_callbackstatus_callback_methodurllinks)super__init__getr#   r$   r
   iso8601_datetimer%   r&   r'   r"   r(   r)   r*   r+   r,   r-   r.   integerr/   r0   r1   r2   r3   r4   r5   r6   	_solution_context)selfr    r!   r"   	__class__r   r   r8   >   sJ    zCompositionInstance.__init__CompositionContextreturnc                 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: CompositionContext for this CompositionInstance
        Nr"   r"   )r=   rA   _versionr<   r>   r   r   r   _proxyj   s    
zCompositionInstance._proxyc                 C   s
   | j  S )n
        Deletes the CompositionInstance


        :returns: True if delete succeeds, False otherwise
        )rG   deleterF   r   r   r   rI   y   s    zCompositionInstance.deletec                    s   | j  I dH S )
        Asynchronous coroutine that deletes the CompositionInstance


        :returns: True if delete succeeds, False otherwise
        N)rG   delete_asyncrF   r   r   r   rK      s    z CompositionInstance.delete_asyncc                 C   s
   | j  S )c
        Fetch the CompositionInstance


        :returns: The fetched CompositionInstance
        )rG   fetchrF   r   r   r   rM      s    zCompositionInstance.fetchc                    s   | j  I dH S )}
        Asynchronous coroutine to fetch the CompositionInstance


        :returns: The fetched CompositionInstance
        N)rG   fetch_asyncrF   r   r   r   rO      s    zCompositionInstance.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r.   .0kvr   r   r   	<genexpr>       z/CompositionInstance.__repr__.<locals>.<genexpr>z(<Twilio.Video.V1.CompositionInstance {}>joinr<   itemsr.   r>   contextr   r   r   __repr__   s    zCompositionInstance.__repr__)N)r   r   r   objectr   r   r   r   strr   r   r8   propertyrG   boolrI   rK   rM   rO   r_   __classcell__r   r   r?   r   r      s     ,				r   c                       sj   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dddZ  ZS )rA   )r    r"   c                    s.   t  | d|i| _djf i | j| _dS )z
        Initialize the CompositionContext

        :param version: Version that contains the resource
        :param sid: The SID of the Composition resource to fetch.
        r"   z/Compositions/{sid}N)r7   r8   r<   r.   _uri)r>   r    r"   r?   r   r   r8      s    zCompositionContext.__init__rB   c                 C   s   | j jd| jdS )rH   DELETEmethoduri)rE   rI   re   rF   r   r   r   rI      s    zCompositionContext.deletec                    s   | j jd| jdI dH S )rJ   rf   rg   N)rE   rK   re   rF   r   r   r   rK      s    zCompositionContext.delete_asyncc                 C   s(   | j jd| jd}t| j || jd dS )rL   GETrg   r"   rD   )rE   rM   re   r   r<   r>   r!   r   r   r   rM      s    zCompositionContext.fetchc                    s.   | j jd| jdI dH }t| j || jd dS )rN   rj   rg   Nr"   rD   )rE   rO   re   r   r<   rk   r   r   r   rO      s    zCompositionContext.fetch_asyncc                 C   s$   d dd | j D }d|S )rP   rQ   c                 s   s   | ]\}}d  ||V  qdS rR   rS   rT   r   r   r   rX      rY   z.CompositionContext.__repr__.<locals>.<genexpr>z'<Twilio.Video.V1.CompositionContext {}>rZ   r]   r   r   r   r_      s    zCompositionContext.__repr__)r   r   r   r   ra   r8   rc   rI   rK   r   rM   rO   r_   rd   r   r   r?   r   rA      s   rA   c                   @   s2   e Zd Zeeef edddZedddZdS )CompositionPage)r!   rC   c                 C   s   t | j|S )zq
        Build an instance of CompositionInstance

        :param payload: Payload response from the API
        )r   rE   rk   r   r   r   get_instance   s    zCompositionPage.get_instancerB   c                 C   s   dS )rP   z!<Twilio.Video.V1.CompositionPage>r   rF   r   r   r   r_     s    zCompositionPage.__repr__N)	r   r   r   r   ra   r   r   rm   r_   r   r   r   r   rl      s   rl   c                       s  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 e	f ee
e e	f ee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ejfeee	e	f ee
e e	f ee
e e	f ee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d
d
fede	f eee	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d
d
fede	f eee	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d
d
fede	f eee	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d
d
fede	f eee	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ejejfed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ddZejejejejejejejfed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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 )'CompositionList)r    c                    s   t  | d| _dS )zm
        Initialize the CompositionList

        :param version: Version that contains the resource

        z/CompositionsN)r7   r8   re   )r>   r    r?   r   r   r8     s    zCompositionList.__init__r   )
r(   r+   r)   r*   r,   r.   r3   r4   r-   rC   c
                 C   s\   t |t|t|dd t|dd |||||	d	}
| jjd| j|
d}t| j|S )ao  
        Create the CompositionInstance

        :param room_sid: The SID of the Group Room with the media tracks to be used as composition sources.
        :param video_layout: An object that describes the video layout of the composition in terms of regions. See [Specifying Video Layouts](https://www.twilio.com/docs/video/api/compositions-resource#specifying-video-layouts) for more info. Please, be aware that either video_layout or audio_sources have to be provided to get a valid creation request
        :param audio_sources: An array of track names from the same group room to merge into the new composition. Can include zero or more track names. The new composition includes all audio sources specified in `audio_sources` except for those specified in `audio_sources_excluded`. The track names in this parameter can include an asterisk as a wild card character, which will match zero or more characters in a track name. For example, `student*` includes `student` as well as `studentTeam`. Please, be aware that either video_layout or audio_sources have to be provided to get a valid creation request
        :param audio_sources_excluded: An array of track names to exclude. The new composition includes all audio sources specified in `audio_sources` except for those specified in `audio_sources_excluded`. The track names in this parameter can include an asterisk as a wild card character, which will match zero or more characters in a track name. For example, `student*` excludes `student` as well as `studentTeam`. This parameter can also be empty.
        :param resolution: A string that describes the columns (width) and rows (height) of the generated composed video in pixels. Defaults to `640x480`.  The string's format is `{width}x{height}` where:   * 16 <= `{width}` <= 1280 * 16 <= `{height}` <= 1280 * `{width}` * `{height}` <= 921,600  Typical values are:   * HD = `1280x720` * PAL = `1024x576` * VGA = `640x480` * CIF = `320x240`  Note that the `resolution` imposes an aspect ratio to the resulting composition. When the original video tracks are constrained by the aspect ratio, they are scaled to fit. See [Specifying Video Layouts](https://www.twilio.com/docs/video/api/compositions-resource#specifying-video-layouts) for more info.
        :param format:
        :param status_callback: The URL we should call using the `status_callback_method` to send status information to your application on every composition event. If not provided, status callback events will not be dispatched.
        :param status_callback_method: The HTTP method we should use to call `status_callback`. Can be: `POST` or `GET` and the default is `POST`.
        :param trim: Whether to clip the intervals where there is no active media in the composition. The default is `true`. Compositions with `trim` enabled are shorter when the Room is created and no Participant joins for a while as well as if all the Participants leave the room and join later, because those gaps will be removed. See [Specifying Video Layouts](https://www.twilio.com/docs/video/api/compositions-resource#specifying-video-layouts) for more info.

        :returns: The created CompositionInstance
        c                 S   s   | S Nr   er   r   r   <lambda><  rY   z(CompositionList.create.<locals>.<lambda>c                 S   s   | S ro   r   rp   r   r   r   rr   >  rY   	RoomSidZVideoLayoutZAudioSourcesZAudioSourcesExcluded
Resolutionr   ZStatusCallbackZStatusCallbackMethodZTrimPOSTrh   ri   data)	r   ofr   r`   maprE   createre   r   r>   r(   r+   r)   r*   r,   r.   r3   r4   r-   rx   r!   r   r   r   r{     s(    zCompositionList.createc
                    sb   t |t|t|dd t|dd |||||	d	}
| jjd| j|
dI dH }t| j|S )a~  
        Asynchronously create the CompositionInstance

        :param room_sid: The SID of the Group Room with the media tracks to be used as composition sources.
        :param video_layout: An object that describes the video layout of the composition in terms of regions. See [Specifying Video Layouts](https://www.twilio.com/docs/video/api/compositions-resource#specifying-video-layouts) for more info. Please, be aware that either video_layout or audio_sources have to be provided to get a valid creation request
        :param audio_sources: An array of track names from the same group room to merge into the new composition. Can include zero or more track names. The new composition includes all audio sources specified in `audio_sources` except for those specified in `audio_sources_excluded`. The track names in this parameter can include an asterisk as a wild card character, which will match zero or more characters in a track name. For example, `student*` includes `student` as well as `studentTeam`. Please, be aware that either video_layout or audio_sources have to be provided to get a valid creation request
        :param audio_sources_excluded: An array of track names to exclude. The new composition includes all audio sources specified in `audio_sources` except for those specified in `audio_sources_excluded`. The track names in this parameter can include an asterisk as a wild card character, which will match zero or more characters in a track name. For example, `student*` excludes `student` as well as `studentTeam`. This parameter can also be empty.
        :param resolution: A string that describes the columns (width) and rows (height) of the generated composed video in pixels. Defaults to `640x480`.  The string's format is `{width}x{height}` where:   * 16 <= `{width}` <= 1280 * 16 <= `{height}` <= 1280 * `{width}` * `{height}` <= 921,600  Typical values are:   * HD = `1280x720` * PAL = `1024x576` * VGA = `640x480` * CIF = `320x240`  Note that the `resolution` imposes an aspect ratio to the resulting composition. When the original video tracks are constrained by the aspect ratio, they are scaled to fit. See [Specifying Video Layouts](https://www.twilio.com/docs/video/api/compositions-resource#specifying-video-layouts) for more info.
        :param format:
        :param status_callback: The URL we should call using the `status_callback_method` to send status information to your application on every composition event. If not provided, status callback events will not be dispatched.
        :param status_callback_method: The HTTP method we should use to call `status_callback`. Can be: `POST` or `GET` and the default is `POST`.
        :param trim: Whether to clip the intervals where there is no active media in the composition. The default is `true`. Compositions with `trim` enabled are shorter when the Room is created and no Participant joins for a while as well as if all the Participants leave the room and join later, because those gaps will be removed. See [Specifying Video Layouts](https://www.twilio.com/docs/video/api/compositions-resource#specifying-video-layouts) for more info.

        :returns: The created CompositionInstance
        c                 S   s   | S ro   r   rp   r   r   r   rr   o  rY   z.CompositionList.create_async.<locals>.<lambda>c                 S   s   | S ro   r   rp   r   r   r   rr   q  rY   rs   rv   rw   N)	r   ry   r   r`   rz   rE   create_asyncre   r   r|   r   r   r   r}   P  s(    zCompositionList.create_asyncNr   )r$   date_created_afterdate_created_beforer(   limit	page_sizerC   c           	      C   s8   | j ||}| j|||||d d}| j ||d S )a  
        Streams CompositionInstance 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 &quot;CompositionInstance.Status&quot; status: Read only Composition resources with this status. Can be: `enqueued`, `processing`, `completed`, `deleted`, or `failed`.
        :param datetime date_created_after: Read only Composition resources created on or after this [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date-time with time zone.
        :param datetime date_created_before: Read only Composition resources created before this ISO 8601 date-time with time zone.
        :param str room_sid: Read only Composition resources with this Room SID.
        :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   r(   r   r   )rE   read_limitspagestream	r>   r$   r~   r   r(   r   r   Zlimitsr   r   r   r   r     s    zCompositionList.streamc           	         s>   | j ||}| j|||||d dI dH }| j ||d S )a  
        Asynchronously streams CompositionInstance 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 &quot;CompositionInstance.Status&quot; status: Read only Composition resources with this status. Can be: `enqueued`, `processing`, `completed`, `deleted`, or `failed`.
        :param datetime date_created_after: Read only Composition resources created on or after this [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date-time with time zone.
        :param datetime date_created_before: Read only Composition resources created before this ISO 8601 date-time with time zone.
        :param str room_sid: Read only Composition resources with this Room SID.
        :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   )rE   r   
page_asyncstream_asyncr   r   r   r   r     s    zCompositionList.stream_asyncc              	   C   s   t | j||||||dS )a<  
        Lists CompositionInstance records from the API as a list.
        Unlike stream(), this operation is eager and will load `limit` records into
        memory before returning.

        :param &quot;CompositionInstance.Status&quot; status: Read only Composition resources with this status. Can be: `enqueued`, `processing`, `completed`, `deleted`, or `failed`.
        :param datetime date_created_after: Read only Composition resources created on or after this [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date-time with time zone.
        :param datetime date_created_before: Read only Composition resources created before this ISO 8601 date-time with time zone.
        :param str room_sid: Read only Composition resources with this Room SID.
        :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~   r   r(   r   r   )listr   r>   r$   r~   r   r(   r   r   r   r   r   r     s    zCompositionList.listc              	      s,   dd | j ||||||dI dH 2 I dH S )aK  
        Asynchronously lists CompositionInstance records from the API as a list.
        Unlike stream(), this operation is eager and will load `limit` records into
        memory before returning.

        :param &quot;CompositionInstance.Status&quot; status: Read only Composition resources with this status. Can be: `enqueued`, `processing`, `completed`, `deleted`, or `failed`.
        :param datetime date_created_after: Read only Composition resources created on or after this [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date-time with time zone.
        :param datetime date_created_before: Read only Composition resources created before this ISO 8601 date-time with time zone.
        :param str room_sid: Read only Composition resources with this Room SID.
        :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 ro   r   )rU   recordr   r   r   
<listcomp>  s   z.CompositionList.list_async.<locals>.<listcomp>r   N)r   r   r   r   r   
list_async  s    
zCompositionList.list_async)r$   r~   r   r(   
page_tokenpage_numberr   rC   c           
   
   C   sF   t |t|t|||||d}| jjd| j|d}	t| j|	S )a|  
        Retrieve a single page of CompositionInstance records from the API.
        Request is executed immediately

        :param status: Read only Composition resources with this status. Can be: `enqueued`, `processing`, `completed`, `deleted`, or `failed`.
        :param date_created_after: Read only Composition resources created on or after this [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date-time with time zone.
        :param date_created_before: Read only Composition resources created before this ISO 8601 date-time with time zone.
        :param room_sid: Read only Composition resources with this Room SID.
        :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 CompositionInstance
        r   ZDateCreatedAfterZDateCreatedBeforert   Z	PageTokenr   ZPageSizerj   rh   ri   params)r   ry   r   r:   rE   r   re   rl   
r>   r$   r~   r   r(   r   r   r   rx   responser   r   r   r     s    zCompositionList.pagec           
   
      sL   t |t|t|||||d}| jjd| j|dI dH }	t| j|	S )a  
        Asynchronously retrieve a single page of CompositionInstance records from the API.
        Request is executed immediately

        :param status: Read only Composition resources with this status. Can be: `enqueued`, `processing`, `completed`, `deleted`, or `failed`.
        :param date_created_after: Read only Composition resources created on or after this [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) date-time with time zone.
        :param date_created_before: Read only Composition resources created before this ISO 8601 date-time with time zone.
        :param room_sid: Read only Composition resources with this Room SID.
        :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 CompositionInstance
        r   rj   r   N)r   ry   r   r:   rE   r   re   rl   r   r   r   r   r   E  s    zCompositionList.page_async)
target_urlrC   c                 C   s   | j jjd|}t| j |S )z
        Retrieve a specific page of CompositionInstance records from the API.
        Request is executed immediately

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

        :returns: Page of CompositionInstance
        rj   )rE   domaintwiliorequestrl   r>   r   r   r   r   r   get_pagen  s    	zCompositionList.get_pagec                    s$   | j jjd|I dH }t| j |S )a
  
        Asynchronously retrieve a specific page of CompositionInstance records from the API.
        Request is executed immediately

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

        :returns: Page of CompositionInstance
        rj   N)rE   r   r   Zrequest_asyncrl   r   r   r   r   get_page_asyncz  s    	zCompositionList.get_page_async)r"   rC   c                 C   s   t | j|dS zt
        Constructs a CompositionContext

        :param sid: The SID of the Composition resource to fetch.
        rD   rA   rE   r>   r"   r   r   r   r9     s    zCompositionList.getc                 C   s   t | j|dS r   r   r   r   r   r   __call__  s    zCompositionList.__call__rB   c                 C   s   dS )rP   z!<Twilio.Video.V1.CompositionList>r   rF   r   r   r   r_     s    zCompositionList.__repr__)"r   r   r   r   r8   r   unsetra   r   r`   r   rc   r   r{   r}   r   r   intr   r   r	   r   r   r   rl   r   r   r   r   rA   r9   r   r_   rd   r   r   r?   r   rn     s  





6





5



)



)



(



)






)






)rn   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   rA   rl   rn   r   r   r   r   <module>   s   $ X