o
    e:                     @   s   d 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 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 )za
This code was generated by
\ / _    _  _|   _  _
 | (_)\/(_)(_|\/| |(/_  v1.0.0
      /       /
    )deserialize)	serialize)values)InstanceContext)InstanceResource)ListResource)Pagec                       s   e Zd Z fddZejejejddfddZejejejddfddZejejejejejejfdd	Zd
d Z	dd Z
dd Zdd Z  ZS )	MediaListc                    s4   t t| | ||d| _djdi | j| _dS )a  
        Initialize the MediaList

        :param Version version: Version that contains the resource
        :param account_sid: The SID of the Account that created this resource
        :param message_sid: The unique string that identifies the resource

        :returns: twilio.rest.api.v2010.account.message.media.MediaList
        :rtype: twilio.rest.api.v2010.account.message.media.MediaList
        account_sidmessage_sidz9/Accounts/{account_sid}/Messages/{message_sid}/Media.jsonN )superr	   __init__	_solutionformat_uri)selfversionr   r   	__class__r   ^/var/www/html/venv/lib/python3.10/site-packages/twilio/rest/api/v2010/account/message/media.pyr      s   zMediaList.__init__Nc                 C   s6   | j ||}| j||||d d}| j ||d S )a  
        Streams MediaInstance 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 datetime date_created_before: Only include media that was created on this date
        :param datetime date_created: Only include media that was created on this date
        :param datetime date_created_after: Only include media that was created on this date
        :param int limit: Upper limit for the number of records to return. stream()
                          guarantees to never return more than limit.  Default is no limit
        :param int 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
        :rtype: list[twilio.rest.api.v2010.account.message.media.MediaInstance]
        	page_size)date_created_beforedate_createddate_created_afterr   limit)_versionread_limitspagestream)r   r   r   r   r   r   limitsr   r   r   r   r    %   s   zMediaList.streamc                 C   s   t | j|||||dS )au  
        Lists MediaInstance records from the API as a list.
        Unlike stream(), this operation is eager and will load `limit` records into
        memory before returning.

        :param datetime date_created_before: Only include media that was created on this date
        :param datetime date_created: Only include media that was created on this date
        :param datetime date_created_after: Only include media that was created on this date
        :param int limit: Upper limit for the number of records to return. list() guarantees
                          never to return more than limit.  Default is no limit
        :param int 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: Generator that will yield up to limit results
        :rtype: list[twilio.rest.api.v2010.account.message.media.MediaInstance]
        )r   r   r   r   r   )listr    )r   r   r   r   r   r   r   r   r   r"   E   s   zMediaList.listc           	   	   C   sN   t t|t|t||||d}| jjd| j|d}t| j|| jS )a  
        Retrieve a single page of MediaInstance records from the API.
        Request is executed immediately

        :param datetime date_created_before: Only include media that was created on this date
        :param datetime date_created: Only include media that was created on this date
        :param datetime date_created_after: Only include media that was created on this date
        :param str page_token: PageToken provided by the API
        :param int page_number: Page Number, this value is simply for client state
        :param int page_size: Number of records to return, defaults to 50

        :returns: Page of MediaInstance
        :rtype: twilio.rest.api.v2010.account.message.media.MediaPage
        )zDateCreated<DateCreatedzDateCreated>	PageTokenr   PageSizeGET)methoduriparams)	r   ofr   iso8601_datetimer   r   r   	MediaPager   )	r   r   r   r   
page_tokenpage_numberr   dataresponser   r   r   r   a   s   	zMediaList.pagec                 C   s"   | j jjd|}t| j || jS )a9  
        Retrieve a specific page of MediaInstance records from the API.
        Request is executed immediately

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

        :returns: Page of MediaInstance
        :rtype: twilio.rest.api.v2010.account.message.media.MediaPage
        r&   )r   domaintwiliorequestr,   r   )r   
target_urlr0   r   r   r   get_page   s
   

zMediaList.get_pagec                 C      t | j| jd | jd |dS a  
        Constructs a MediaContext

        :param sid: The unique string that identifies this resource

        :returns: twilio.rest.api.v2010.account.message.media.MediaContext
        :rtype: twilio.rest.api.v2010.account.message.media.MediaContext
        r   r   r   r   sidMediaContextr   r   r   r9   r   r   r   get      	zMediaList.getc                 C   r6   r7   r:   r<   r   r   r   __call__   r>   zMediaList.__call__c                 C      dS )z
        Provide a friendly representation

        :returns: Machine friendly representation
        :rtype: str
        z<Twilio.Api.V2010.MediaList>r   r   r   r   r   __repr__      zMediaList.__repr__)__name__
__module____qualname__r   r   unsetr    r"   r   r5   r=   r?   rC   __classcell__r   r   r   r   r	      s     
 

r	   c                       s,   e Zd Z fddZdd Zdd Z  ZS )r,   c                    s   t t| || || _dS )a  
        Initialize the MediaPage

        :param Version version: Version that contains the resource
        :param Response response: Response from the API
        :param account_sid: The SID of the Account that created this resource
        :param message_sid: The unique string that identifies the resource

        :returns: twilio.rest.api.v2010.account.message.media.MediaPage
        :rtype: twilio.rest.api.v2010.account.message.media.MediaPage
        N)r   r,   r   r   )r   r   r0   solutionr   r   r   r      s   
zMediaPage.__init__c                 C   s   t | j|| jd | jd dS )a  
        Build an instance of MediaInstance

        :param dict payload: Payload response from the API

        :returns: twilio.rest.api.v2010.account.message.media.MediaInstance
        :rtype: twilio.rest.api.v2010.account.message.media.MediaInstance
        r   r   r
   )MediaInstancer   r   r   payloadr   r   r   get_instance   s   	zMediaPage.get_instancec                 C   r@   )rA   z<Twilio.Api.V2010.MediaPage>r   rB   r   r   r   rC      rD   zMediaPage.__repr__)rE   rF   rG   r   rN   rC   rI   r   r   r   r   r,      s    r,   c                       s4   e Zd Z fddZdd Zdd Zdd Z  ZS )	r;   c                    s6   t t| | |||d| _djdi | j| _dS )a  
        Initialize the MediaContext

        :param Version version: Version that contains the resource
        :param account_sid: The SID of the Account that created the resource(s) to fetch
        :param message_sid: The SID of the Message resource that this Media resource belongs to
        :param sid: The unique string that identifies this resource

        :returns: twilio.rest.api.v2010.account.message.media.MediaContext
        :rtype: twilio.rest.api.v2010.account.message.media.MediaContext
        r8   z?/Accounts/{account_sid}/Messages/{message_sid}/Media/{sid}.jsonNr   )r   r;   r   r   r   r   )r   r   r   r   r9   r   r   r   r      s   zMediaContext.__init__c                 C   s   | j jd| jdS )|
        Deletes the MediaInstance

        :returns: True if delete succeeds, False otherwise
        :rtype: bool
        DELETEr'   r(   )r   deleter   rB   r   r   r   rR      s   zMediaContext.deletec                 C   s8   | j jd| jd}t| j || jd | jd | jd dS )
        Fetch the MediaInstance

        :returns: The fetched MediaInstance
        :rtype: twilio.rest.api.v2010.account.message.media.MediaInstance
        r&   rQ   r   r   r9   r8   )r   fetchr   rK   r   rL   r   r   r   rT     s   zMediaContext.fetchc                 C   $   d dd | j D }d|S )rA    c                 s        | ]\}}d  ||V  qdS z{}={}Nr   .0kvr   r   r   	<genexpr>      z(MediaContext.__repr__.<locals>.<genexpr>z"<Twilio.Api.V2010.MediaContext {}>joinr   itemsr   r   contextr   r   r   rC        
zMediaContext.__repr__)rE   rF   rG   r   rR   rT   rC   rI   r   r   r   r   r;      s
    	r;   c                       s   e Zd Zd fdd	Zedd Zedd Zedd	 Zed
d Zedd Z	edd Z
edd Zedd Zdd Zdd Zdd Z  ZS )rK   Nc              	      s~   t t| | |d|dt|dt|d|d|d|dd| _d	| _|||p9| jd d
| _d	S )z
        Initialize the MediaInstance

        :returns: twilio.rest.api.v2010.account.message.media.MediaInstance
        :rtype: twilio.rest.api.v2010.account.message.media.MediaInstance
        r   content_typer   date_updated
parent_sidr9   r(   )r   rf   r   rg   rh   r9   r(   Nr8   )	r   rK   r   r=   r   rfc2822_datetime_properties_contextr   )r   r   rM   r   r   r9   r   r   r   r   "  s   zMediaInstance.__init__c                 C   s6   | j du rt| j| jd | jd | jd d| _ | j S )a/  
        Generate an instance context for the instance, the context is capable of
        performing various actions.  All instance actions are proxied to the context

        :returns: MediaContext for this MediaInstance
        :rtype: twilio.rest.api.v2010.account.message.media.MediaContext
        Nr   r   r9   r8   )rk   r;   r   r   rB   r   r   r   _proxy>  s   
	zMediaInstance._proxyc                 C   
   | j d S )ze
        :returns: The SID of the Account that created this resource
        :rtype: unicode
        r   rj   rB   r   r   r   r   P     
zMediaInstance.account_sidc                 C   rm   )zV
        :returns: The default mime-type of the media
        :rtype: unicode
        rf   rn   rB   r   r   r   rf   X  ro   zMediaInstance.content_typec                 C   rm   )zu
        :returns: The RFC 2822 date and time in GMT that this resource was created
        :rtype: datetime
        r   rn   rB   r   r   r   r   `  ro   zMediaInstance.date_createdc                 C   rm   )zz
        :returns: The RFC 2822 date and time in GMT that this resource was last updated
        :rtype: datetime
        rg   rn   rB   r   r   r   rg   h  ro   zMediaInstance.date_updatedc                 C   rm   )zb
        :returns: The SID of the resource that created the media
        :rtype: unicode
        rh   rn   rB   r   r   r   rh   p  ro   zMediaInstance.parent_sidc                 C   rm   )zc
        :returns: The unique string that identifies this resource
        :rtype: unicode
        r9   rn   rB   r   r   r   r9   x  ro   zMediaInstance.sidc                 C   rm   )zr
        :returns: The URI of this resource, relative to `https://api.twilio.com`
        :rtype: unicode
        r(   rn   rB   r   r   r   r(     ro   zMediaInstance.uric                 C   
   | j  S )rO   )rl   rR   rB   r   r   r   rR        
zMediaInstance.deletec                 C   rp   )rS   )rl   rT   rB   r   r   r   rT     rq   zMediaInstance.fetchc                 C   rU   )rA   rV   c                 s   rW   rX   rY   rZ   r   r   r   r^     r_   z)MediaInstance.__repr__.<locals>.<genexpr>z#<Twilio.Api.V2010.MediaInstance {}>r`   rc   r   r   r   rC     re   zMediaInstance.__repr__)N)rE   rF   rG   r   propertyrl   r   rf   r   rg   rh   r9   r(   rR   rT   rC   rI   r   r   r   r   rK      s*    







		rK   N)__doc__twilio.baser   r   r   twilio.base.instance_contextr   twilio.base.instance_resourcer   twilio.base.list_resourcer   twilio.base.pager   r	   r,   r;   rK   r   r   r   r   <module>   s    )-9