U
    ^g%im                     @   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 - Api
    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dZdeeeef ee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 )MediaInstanceal  
    :ivar account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) associated with this Media resource.
    :ivar content_type: The default [MIME type](https://en.wikipedia.org/wiki/Internet_media_type) of the media, for example `image/jpeg`, `image/png`, or `image/gif`.
    :ivar date_created: The date and time in GMT when this Media resource was created, specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format.
    :ivar date_updated: The date and time in GMT when this Media resource was last updated, specified in [RFC 2822](https://www.ietf.org/rfc/rfc2822.txt) format.
    :ivar parent_sid: The SID of the Message resource that is associated with this Media resource.
    :ivar sid: The unique string that identifies this Media resource.
    :ivar uri: The URI of this Media resource, relative to `https://api.twilio.com`.
    N)versionpayloadaccount_sidmessage_sidsidc                    s   t  | |d| _|d| _t|d| _t|d| _|d| _	|d| _
|d| _|||px| j
d| _d | _d S )	Nr   content_typedate_createddate_updated
parent_sidr   urir   r   r   )super__init__getr   r   r
   Zrfc2822_datetimer   r   r   r   r   	_solution_context)selfr   r   r   r   r   	__class__ j/var/www/html/api-medvista/venv/lib/python3.8/site-packages/twilio/rest/api/v2010/account/message/media.pyr   $   s"    zMediaInstance.__init__MediaContextreturnc                 C   s6   | j dkr0t| j| jd | jd | 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: MediaContext for this MediaInstance
        Nr   r   r   r   )r"   r(   _versionr!   r#   r&   r&   r'   _proxyA   s    
zMediaInstance._proxyc                 C   s
   | j  S )h
        Deletes the MediaInstance


        :returns: True if delete succeeds, False otherwise
        )r-   deleter,   r&   r&   r'   r/   R   s    zMediaInstance.deletec                    s   | j  I dH S )
        Asynchronous coroutine that deletes the MediaInstance


        :returns: True if delete succeeds, False otherwise
        N)r-   delete_asyncr,   r&   r&   r'   r1   [   s    zMediaInstance.delete_asyncc                 C   s
   | j  S )W
        Fetch the MediaInstance


        :returns: The fetched MediaInstance
        )r-   fetchr,   r&   r&   r'   r3   d   s    zMediaInstance.fetchc                    s   | j  I dH S )q
        Asynchronous coroutine to fetch the MediaInstance


        :returns: The fetched MediaInstance
        N)r-   fetch_asyncr,   r&   r&   r'   r5   m   s    zMediaInstance.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format.0kvr&   r&   r'   	<genexpr>|   s     z)MediaInstance.__repr__.<locals>.<genexpr>z#<Twilio.Api.V2010.MediaInstance {}>joinr!   itemsr:   r#   contextr&   r&   r'   __repr__v   s    zMediaInstance.__repr__)N)__name__
__module____qualname____doc__r   r   strr   r   r   propertyr-   boolr/   r1   r3   r5   rE   __classcell__r&   r&   r$   r'   r      s     
				r   c                       sn   e Zd Zee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 )r(   )r   r   r   r   c                    s.   t  | |||d| _djf | j| _dS )a  
        Initialize the MediaContext

        :param version: Version that contains the resource
        :param account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) associated with the Media resource.
        :param message_sid: The SID of the Message resource that is associated with the Media resource.
        :param sid: The Twilio-provided string that uniquely identifies the Media resource to fetch.
        r   z?/Accounts/{account_sid}/Messages/{message_sid}/Media/{sid}.jsonNr   r   r!   r:   _uri)r#   r   r   r   r   r$   r&   r'   r      s    	zMediaContext.__init__r)   c                 C   s   t i }| jjd| j|dS )r.   DELETEmethodr   headers)r   ofr+   r/   rO   r#   rS   r&   r&   r'   r/      s    
zMediaContext.deletec                    s$   t i }| jjd| j|dI dH S )r0   rP   rQ   N)r   rT   r+   r1   rO   rU   r&   r&   r'   r1      s    
  zMediaContext.delete_asyncc                 C   sL   t i }d|d< | jjd| j|d}t| j|| jd | jd | jd dS )	r2   application/jsonAcceptGETrQ   r   r   r   r   )r   rT   r+   r3   rO   r   r!   r#   rS   r   r&   r&   r'   r3      s    
zMediaContext.fetchc                    sR   t i }d|d< | jjd| j|dI dH }t| j|| jd | jd | jd d	S )
r4   rV   rW   rX   rQ   Nr   r   r   r   )r   rT   r+   r5   rO   r   r!   rY   r&   r&   r'   r5      s    
  zMediaContext.fetch_asyncc                 C   s$   d dd | j D }d|S )r6   r7   c                 s   s   | ]\}}d  ||V  qdS r8   r9   r;   r&   r&   r'   r?      s     z(MediaContext.__repr__.<locals>.<genexpr>z"<Twilio.Api.V2010.MediaContext {}>r@   rC   r&   r&   r'   rE      s    zMediaContext.__repr__)rF   rG   rH   r   rJ   r   rL   r/   r1   r   r3   r5   rE   rM   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 )	MediaPage)r   r*   c                 C   s   t | j|| jd | jd dS )zk
        Build an instance of MediaInstance

        :param payload: Payload response from the API
        r   r   r   r   )r   r+   r!   )r#   r   r&   r&   r'   get_instance   s    zMediaPage.get_instancer)   c                 C   s   dS )r6   z<Twilio.Api.V2010.MediaPage>r&   r,   r&   r&   r'   rE      s    zMediaPage.__repr__N)	rF   rG   rH   r   rJ   r   r   r\   rE   r&   r&   r&   r'   rZ      s   rZ   c                	       st  e Zd Zeeed fddZejejejdd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dd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dd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dd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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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 ) 	MediaList)r   r   r   c                    s,   t  | ||d| _djf | j| _dS )a_  
        Initialize the MediaList

        :param version: Version that contains the resource
        :param account_sid: The SID of the [Account](https://www.twilio.com/docs/iam/api/account) that is associated with the Media resources.
        :param message_sid: The SID of the Message resource that is associated with the Media resources.

        r[   z9/Accounts/{account_sid}/Messages/{message_sid}/Media.jsonNrN   )r#   r   r   r   r$   r&   r'   r     s    	zMediaList.__init__N)r   date_created_beforedate_created_afterlimit	page_sizer*   c                 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: Only include Media resources that were created on this date. Specify a date as `YYYY-MM-DD` in GMT, for example: `2009-07-06`, to read Media that were created on this date. You can also specify an inequality, such as `StartTime<=YYYY-MM-DD`, to read Media that were created on or before midnight of this date, and `StartTime>=YYYY-MM-DD` to read Media that were created on or after midnight of this date.
        :param datetime date_created_before: Only include Media resources that were created on this date. Specify a date as `YYYY-MM-DD` in GMT, for example: `2009-07-06`, to read Media that were created on this date. You can also specify an inequality, such as `StartTime<=YYYY-MM-DD`, to read Media that were created on or before midnight of this date, and `StartTime>=YYYY-MM-DD` to read Media that were created on or after midnight of this date.
        :param datetime date_created_after: Only include Media resources that were created on this date. Specify a date as `YYYY-MM-DD` in GMT, for example: `2009-07-06`, to read Media that were created on this date. You can also specify an inequality, such as `StartTime<=YYYY-MM-DD`, to read Media that were created on or before midnight of this date, and `StartTime>=YYYY-MM-DD` to read Media that were created on or after midnight of this date.
        :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
        ra   r   r^   r_   ra   r`   )r+   read_limitspagestreamr#   r   r^   r_   r`   ra   Zlimitsrd   r&   r&   r'   re     s    zMediaList.streamc                    s<   | j ||}| j||||d dI dH }| j ||d S )a  
        Asynchronously 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: Only include Media resources that were created on this date. Specify a date as `YYYY-MM-DD` in GMT, for example: `2009-07-06`, to read Media that were created on this date. You can also specify an inequality, such as `StartTime<=YYYY-MM-DD`, to read Media that were created on or before midnight of this date, and `StartTime>=YYYY-MM-DD` to read Media that were created on or after midnight of this date.
        :param datetime date_created_before: Only include Media resources that were created on this date. Specify a date as `YYYY-MM-DD` in GMT, for example: `2009-07-06`, to read Media that were created on this date. You can also specify an inequality, such as `StartTime<=YYYY-MM-DD`, to read Media that were created on or before midnight of this date, and `StartTime>=YYYY-MM-DD` to read Media that were created on or after midnight of this date.
        :param datetime date_created_after: Only include Media resources that were created on this date. Specify a date as `YYYY-MM-DD` in GMT, for example: `2009-07-06`, to read Media that were created on this date. You can also specify an inequality, such as `StartTime<=YYYY-MM-DD`, to read Media that were created on or before midnight of this date, and `StartTime>=YYYY-MM-DD` to read Media that were created on or after midnight of this date.
        :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
        ra   rb   Nr`   )r+   rc   
page_asyncstream_asyncrf   r&   r&   r'   rh   =  s    zMediaList.stream_asyncc                 C   s   t | j|||||dS )a6  
        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: Only include Media resources that were created on this date. Specify a date as `YYYY-MM-DD` in GMT, for example: `2009-07-06`, to read Media that were created on this date. You can also specify an inequality, such as `StartTime<=YYYY-MM-DD`, to read Media that were created on or before midnight of this date, and `StartTime>=YYYY-MM-DD` to read Media that were created on or after midnight of this date.
        :param datetime date_created_before: Only include Media resources that were created on this date. Specify a date as `YYYY-MM-DD` in GMT, for example: `2009-07-06`, to read Media that were created on this date. You can also specify an inequality, such as `StartTime<=YYYY-MM-DD`, to read Media that were created on or before midnight of this date, and `StartTime>=YYYY-MM-DD` to read Media that were created on or after midnight of this date.
        :param datetime date_created_after: Only include Media resources that were created on this date. Specify a date as `YYYY-MM-DD` in GMT, for example: `2009-07-06`, to read Media that were created on this date. You can also specify an inequality, such as `StartTime<=YYYY-MM-DD`, to read Media that were created on or before midnight of this date, and `StartTime>=YYYY-MM-DD` to read Media that were created on or after midnight of this date.
        :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`   ra   )listre   r#   r   r^   r_   r`   ra   r&   r&   r'   rj   a  s    zMediaList.listc                    s*   dd | j |||||dI dH 2 I dH S )aE  
        Asynchronously 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: Only include Media resources that were created on this date. Specify a date as `YYYY-MM-DD` in GMT, for example: `2009-07-06`, to read Media that were created on this date. You can also specify an inequality, such as `StartTime<=YYYY-MM-DD`, to read Media that were created on or before midnight of this date, and `StartTime>=YYYY-MM-DD` to read Media that were created on or after midnight of this date.
        :param datetime date_created_before: Only include Media resources that were created on this date. Specify a date as `YYYY-MM-DD` in GMT, for example: `2009-07-06`, to read Media that were created on this date. You can also specify an inequality, such as `StartTime<=YYYY-MM-DD`, to read Media that were created on or before midnight of this date, and `StartTime>=YYYY-MM-DD` to read Media that were created on or after midnight of this date.
        :param datetime date_created_after: Only include Media resources that were created on this date. Specify a date as `YYYY-MM-DD` in GMT, for example: `2009-07-06`, to read Media that were created on this date. You can also specify an inequality, such as `StartTime<=YYYY-MM-DD`, to read Media that were created on or before midnight of this date, and `StartTime>=YYYY-MM-DD` to read Media that were created on or after midnight of this date.
        :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&   )r<   recordr&   r&   r'   
<listcomp>  s   z(MediaList.list_async.<locals>.<listcomp>ri   N)rh   rk   r&   r&   r'   
list_async  s    
zMediaList.list_async)r   r^   r_   
page_tokenpage_numberra   r*   c           
   	   C   sf   t t|t|t||||d}t ddi}d|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 date_created: Only include Media resources that were created on this date. Specify a date as `YYYY-MM-DD` in GMT, for example: `2009-07-06`, to read Media that were created on this date. You can also specify an inequality, such as `StartTime<=YYYY-MM-DD`, to read Media that were created on or before midnight of this date, and `StartTime>=YYYY-MM-DD` to read Media that were created on or after midnight of this date.
        :param date_created_before: Only include Media resources that were created on this date. Specify a date as `YYYY-MM-DD` in GMT, for example: `2009-07-06`, to read Media that were created on this date. You can also specify an inequality, such as `StartTime<=YYYY-MM-DD`, to read Media that were created on or before midnight of this date, and `StartTime>=YYYY-MM-DD` to read Media that were created on or after midnight of this date.
        :param date_created_after: Only include Media resources that were created on this date. Specify a date as `YYYY-MM-DD` in GMT, for example: `2009-07-06`, to read Media that were created on this date. You can also specify an inequality, such as `StartTime<=YYYY-MM-DD`, to read Media that were created on or before midnight of this date, and `StartTime>=YYYY-MM-DD` to read Media that were created on or after midnight of this date.
        :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 MediaInstance
        ZDateCreatedzDateCreated<zDateCreated>Z	PageTokenr   ZPageSizeContent-Type!application/x-www-form-urlencodedrV   rW   rX   rR   r   paramsrS   )	r   rT   r   iso8601_datetimer+   rd   rO   rZ   r!   
r#   r   r^   r_   ro   rp   ra   datarS   responser&   r&   r'   rd     s$       zMediaList.pagec           
   	      sl   t t|t|t||||d}t ddi}d|d< | jjd| j||dI dH }	t| j|	| jS )	a  
        Asynchronously retrieve a single page of MediaInstance records from the API.
        Request is executed immediately

        :param date_created: Only include Media resources that were created on this date. Specify a date as `YYYY-MM-DD` in GMT, for example: `2009-07-06`, to read Media that were created on this date. You can also specify an inequality, such as `StartTime<=YYYY-MM-DD`, to read Media that were created on or before midnight of this date, and `StartTime>=YYYY-MM-DD` to read Media that were created on or after midnight of this date.
        :param date_created_before: Only include Media resources that were created on this date. Specify a date as `YYYY-MM-DD` in GMT, for example: `2009-07-06`, to read Media that were created on this date. You can also specify an inequality, such as `StartTime<=YYYY-MM-DD`, to read Media that were created on or before midnight of this date, and `StartTime>=YYYY-MM-DD` to read Media that were created on or after midnight of this date.
        :param date_created_after: Only include Media resources that were created on this date. Specify a date as `YYYY-MM-DD` in GMT, for example: `2009-07-06`, to read Media that were created on this date. You can also specify an inequality, such as `StartTime<=YYYY-MM-DD`, to read Media that were created on or before midnight of this date, and `StartTime>=YYYY-MM-DD` to read Media that were created on or after midnight of this date.
        :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 MediaInstance
        rq   rr   rs   rV   rW   rX   rt   N)	r   rT   r   rv   r+   rg   rO   rZ   r!   rw   r&   r&   r'   rg     s$       zMediaList.page_async)
target_urlr*   c                 C   s"   | j jjd|}t| j || jS )z
        Retrieve a specific page of MediaInstance records from the API.
        Request is executed immediately

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

        :returns: Page of MediaInstance
        rX   )r+   domaintwiliorequestrZ   r!   r#   rz   ry   r&   r&   r'   get_page  s    	zMediaList.get_pagec                    s(   | j jjd|I dH }t| j || jS )z
        Asynchronously retrieve a specific page of MediaInstance records from the API.
        Request is executed immediately

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

        :returns: Page of MediaInstance
        rX   N)r+   r{   r|   Zrequest_asyncrZ   r!   r~   r&   r&   r'   get_page_async  s    	zMediaList.get_page_async)r   r*   c                 C   s   t | j| jd | jd |dS z
        Constructs a MediaContext

        :param sid: The Twilio-provided string that uniquely identifies the Media resource to fetch.
        r   r   r   r(   r+   r!   r#   r   r&   r&   r'   r      s    zMediaList.getc                 C   s   t | j| jd | jd |dS r   r   r   r&   r&   r'   __call__!  s    zMediaList.__call__r)   c                 C   s   dS )r6   z<Twilio.Api.V2010.MediaList>r&   r,   r&   r&   r'   rE   .  s    zMediaList.__repr__)rF   rG   rH   r   rJ   r   r   unsetr   r   objectr   intr   r   re   r	   rh   r   rj   rn   rZ   rd   rg   r   r   r(   r    r   rE   rM   r&   r&   r$   r'   r]     s   


&


&


%


&





,





*r]   N)rI   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   r(   rZ   r]   r&   r&   r&   r'   <module>   s   $gk