B
    `:                 @   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                s0   t t| | ||d| _djf | 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__ Z/home/dcms/DCMS/lib/python3.7/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)_versionZread_limitspagestream)r   r   r   r   r   r   Z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<ZDateCreatedzDateCreated>Z	PageTokenr   ZPageSizeGET)methoduriparams)	r   Zofr   iso8601_datetimer   r   r   	MediaPager   )	r   r   r   r   Z
page_tokenZ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   domainZtwiliorequestr$   r   )r   
target_urlr&   r   r   r   get_page   s    

zMediaList.get_pagec             C   s   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   r+   r   r   r   get   s
    	zMediaList.getc             C   s   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   r+   )r,   r   r   )r   r+   r   r   r   __call__   s
    	zMediaList.__call__c             C   s   dS )zz
        Provide a friendly representation

        :returns: Machine friendly representation
        :rtype: str
        z<Twilio.Api.V2010.MediaList>r   )r   r   r   r   __repr__   s    zMediaList.__repr__)__name__
__module____qualname__r   r   Zunsetr   r   r   r*   r-   r.   r/   __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   r&   Zsolution)r   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
   r   )MediaInstancer   r   )r   payloadr   r   r   get_instance   s
    	zMediaPage.get_instancec             C   s   dS )zz
        Provide a friendly representation

        :returns: Machine friendly representation
        :rtype: str
        z<Twilio.Api.V2010.MediaPage>r   )r   r   r   r   r/      s    zMediaPage.__repr__)r0   r1   r2   r   r6   r/   r3   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                s2   t t| | |||d| _djf | 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
        )r
   r   r+   z?/Accounts/{account_sid}/Messages/{message_sid}/Media/{sid}.jsonN)r   r,   r   r   r   r   )r   r   r
   r   r+   )r   r   r   r      s    zMediaContext.__init__c             C   s   | j jd| jdS )z|
        Deletes the MediaInstance

        :returns: True if delete succeeds, False otherwise
        :rtype: bool
        DELETE)r    r!   )r   deleter   )r   r   r   r   r8      s    zMediaContext.deletec             C   s8   | j jd| jd}t| j || jd | jd | jd dS )z
        Fetch the MediaInstance

        :returns: The fetched MediaInstance
        :rtype: twilio.rest.api.v2010.account.message.media.MediaInstance
        r   )r    r!   r
   r   r+   )r
   r   r+   )r   fetchr   r4   r   )r   r5   r   r   r   r9     s    zMediaContext.fetchc             C   s$   d dd | j D }d|S )zz
        Provide a friendly representation

        :returns: Machine friendly representation
        :rtype: str
         c             s   s   | ]\}}d  ||V  qdS )z{}={}N)r   ).0kvr   r   r   	<genexpr>  s    z(MediaContext.__repr__.<locals>.<genexpr>z"<Twilio.Api.V2010.MediaContext {}>)joinr   itemsr   )r   contextr   r   r   r/     s    zMediaContext.__repr__)r0   r1   r2   r   r8   r9   r/   r3   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 )r4   Nc          	      s~   t t| | |d|dt|dt|d|d|d|dd| _d	| _|||pr| 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_sidr+   r!   )r
   rB   r   rC   rD   r+   r!   N)r
   r   r+   )	r   r4   r   r-   r   Zrfc2822_datetime_properties_contextr   )r   r   r5   r
   r   r+   )r   r   r   r   "  s    zMediaInstance.__init__c             C   s6   | j dkr0t| 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   r+   )r
   r   r+   )rF   r,   r   r   )r   r   r   r   _proxy>  s    	
zMediaInstance._proxyc             C   s
   | j d S )ze
        :returns: The SID of the Account that created this resource
        :rtype: unicode
        r
   )rE   )r   r   r   r   r
   P  s    zMediaInstance.account_sidc             C   s
   | j d S )zV
        :returns: The default mime-type of the media
        :rtype: unicode
        rB   )rE   )r   r   r   r   rB   X  s    zMediaInstance.content_typec             C   s
   | j d S )zu
        :returns: The RFC 2822 date and time in GMT that this resource was created
        :rtype: datetime
        r   )rE   )r   r   r   r   r   `  s    zMediaInstance.date_createdc             C   s
   | j d S )zz
        :returns: The RFC 2822 date and time in GMT that this resource was last updated
        :rtype: datetime
        rC   )rE   )r   r   r   r   rC   h  s    zMediaInstance.date_updatedc             C   s
   | j d S )zb
        :returns: The SID of the resource that created the media
        :rtype: unicode
        rD   )rE   )r   r   r   r   rD   p  s    zMediaInstance.parent_sidc             C   s
   | j d S )zc
        :returns: The unique string that identifies this resource
        :rtype: unicode
        r+   )rE   )r   r   r   r   r+   x  s    zMediaInstance.sidc             C   s
   | j d S )zr
        :returns: The URI of this resource, relative to `https://api.twilio.com`
        :rtype: unicode
        r!   )rE   )r   r   r   r   r!     s    zMediaInstance.uric             C   s
   | j  S )z|
        Deletes the MediaInstance

        :returns: True if delete succeeds, False otherwise
        :rtype: bool
        )rG   r8   )r   r   r   r   r8     s    zMediaInstance.deletec             C   s
   | j  S )z
        Fetch the MediaInstance

        :returns: The fetched MediaInstance
        :rtype: twilio.rest.api.v2010.account.message.media.MediaInstance
        )rG   r9   )r   r   r   r   r9     s    zMediaInstance.fetchc             C   s$   d dd | j D }d|S )zz
        Provide a friendly representation

        :returns: Machine friendly representation
        :rtype: str
        r:   c             s   s   | ]\}}d  ||V  qdS )z{}={}N)r   )r;   r<   r=   r   r   r   r>     s    z)MediaInstance.__repr__.<locals>.<genexpr>z#<Twilio.Api.V2010.MediaInstance {}>)r?   r   r@   r   )r   rA   r   r   r   r/     s    zMediaInstance.__repr__)N)r0   r1   r2   r   propertyrG   r
   rB   r   rC   rD   r+   r!   r8   r9   r/   r3   r   r   )r   r   r4      s   		r4   N)__doc__Ztwilio.baser   r   r   Ztwilio.base.instance_contextr   Ztwilio.base.instance_resourcer   Ztwilio.base.list_resourcer   Ztwilio.base.pager   r	   r$   r,   r4   r   r   r   r   <module>   s    )-9