o
    f>hm                     @   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dedeeef dededee f
 fdd	Z	e
dddZd
efddZd
efddZdddZdddZd
ef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| _|||p<| j
d| _d | _d S )	Nr   content_typedate_createddate_updated
parent_sidr   urir   r   r   )super__init__getr   r   r
   rfc2822_datetimer   r   r   r   r   	_solution_context)selfr   r   r   r   r   	__class__ ^/var/www/html/venv/lib/python3.10/site-packages/twilio/rest/api/v2010/account/message/media.pyr   $   s"   
zMediaInstance.__init__returnMediaContextc                 C   s6   | j du rt| 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   
   | j  S )h
        Deletes the MediaInstance


        :returns: True if delete succeeds, False otherwise
        )r-   deleter,   r'   r'   r(   r0   R      
zMediaInstance.deletec                       | 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(   r4   [      zMediaInstance.delete_asyncc                 C   r.   )W
        Fetch the MediaInstance


        :returns: The fetched MediaInstance
        )r-   fetchr,   r'   r'   r(   r7   d   r1   zMediaInstance.fetchc                    r2   )q
        Asynchronous coroutine to fetch the MediaInstance


        :returns: The fetched MediaInstance
        N)r-   fetch_asyncr,   r'   r'   r(   r9   m   r5   zMediaInstance.fetch_asyncc                 C   $   d dd | j D }d|S )f
        Provide a friendly representation

        :returns: Machine friendly representation
         c                 s        | ]\}}d  ||V  qdS z{}={}Nformat.0kvr'   r'   r(   	<genexpr>|       z)MediaInstance.__repr__.<locals>.<genexpr>z#<Twilio.Api.V2010.MediaInstance {}>joinr"   itemsr@   r$   contextr'   r'   r(   __repr__v      
zMediaInstance.__repr__N)r)   r*   )r)   r   )__name__
__module____qualname____doc__r   r   strr   r   r   propertyr-   boolr0   r4   r7   r9   rL   __classcell__r'   r'   r%   r(   r      s*    
	
	
		r   c                       st   e Zd Zdedededef fddZdefdd	Zdefd
dZde	fddZ
de	fddZdefddZ  ZS )r*   r   r   r   r   c                    s2   t  | |||d| _djdi | 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}.jsonNr'   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+   r0   rX   r$   r\   r'   r'   r(   r0      s   
zMediaContext.deletec                    s&   t i }| jjd| j|dI dH S )r3   rY   rZ   N)r   r]   r+   r4   rX   r^   r'   r'   r(   r4      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 )	r6   application/jsonAcceptGETrZ   r   r   r   r   )r   r]   r+   r7   rX   r   r"   r$   r\   r   r'   r'   r(   r7      s   
zMediaContext.fetchc                    sT   t i }d|d< | jjd| j|dI dH }t| j|| jd | jd | jd d	S )
r8   r_   r`   ra   rZ   Nr   r   r   r   )r   r]   r+   r9   rX   r   r"   rb   r'   r'   r(   r9      s   
zMediaContext.fetch_asyncc                 C   r:   )r;   r<   c                 s   r=   r>   r?   rA   r'   r'   r(   rE      rF   z(MediaContext.__repr__.<locals>.<genexpr>z"<Twilio.Api.V2010.MediaContext {}>rG   rJ   r'   r'   r(   rL      rM   zMediaContext.__repr__)rO   rP   rQ   r   rS   r   rU   r0   r4   r   r7   r9   rL   rV   r'   r'   r%   r(   r*      s    r*   c                   @   s4   e Zd Zdeeef defddZdefddZdS )	MediaPager   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_instancec                 C      dS )r;   z<Twilio.Api.V2010.MediaPage>r'   r,   r'   r'   r(   rL         zMediaPage.__repr__N)	rO   rP   rQ   r   rS   r   r   re   rL   r'   r'   r'   r(   rc      s    rc   c                       s  e Zd Zdededef fddZejejejddfdee	e
f dee	e
f d	ee	e
f d
ee dee dee fddZejejejddfdee	e
f dee	e
f d	ee	e
f d
ee dee dee fddZejejejddfdee	e
f dee	e
f d	ee	e
f d
ee dee dee fddZejejejddfdee	e
f dee	e
f d	ee	e
f d
ee dee dee fddZejejejejejejfdee	e
f dee	e
f d	ee	e
f deee
f deee
f deee
f defddZejejejejejejfdee	e
f dee	e
f d	ee	e
f deee
f deee
f deee
f defddZdedefddZdedefddZd edefd!d"Zd edefd#d$Zdefd%d&Z  ZS )'	MediaListr   r   r   c                    s0   t  | ||d| _djdi | 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.

        rd   z9/Accounts/{account_sid}/Messages/{message_sid}/Media.jsonNr'   rW   )r$   r   r   r   r%   r'   r(   r     s   	zMediaList.__init__Nr   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
        rl   r   ri   rj   rl   rk   )r+   read_limitspagestreamr$   r   ri   rj   rk   rl   limitsro   r'   r'   r(   rp     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
        rl   rm   Nrk   )r+   rn   
page_asyncstream_asyncrq   r'   r'   r(   rt   =  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   ri   rj   rk   rl   )listrp   r$   r   ri   rj   rk   rl   r'   r'   r(   rv   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 rN   r'   )rB   recordr'   r'   r(   
<listcomp>  s
    z(MediaList.list_async.<locals>.<listcomp>ru   N)rt   rw   r'   r'   r(   
list_async  s   
zMediaList.list_async
page_tokenpage_numberc           
   	   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
        DateCreatedzDateCreated<zDateCreated>	PageTokenr   PageSizeContent-Type!application/x-www-form-urlencodedr_   r`   ra   r[   r   paramsr\   )	r   r]   r   iso8601_datetimer+   ro   rX   rc   r"   
r$   r   ri   rj   r{   r|   rl   datar\   responser'   r'   r(   ro     s   
zMediaList.pagec           
   	      sn   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
        r}   r   r   r_   r`   ra   r   N)	r   r]   r   r   r+   rs   rX   rc   r"   r   r'   r'   r(   rs     s    
zMediaList.page_async
target_urlc                 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
        ra   )r+   domaintwiliorequestrc   r"   r$   r   r   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
        ra   N)r+   r   r   request_asyncrc   r"   r   r'   r'   r(   get_page_async  s   	zMediaList.get_page_asyncr   c                 C      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         zMediaList.getc                 C   r   r   r   r   r'   r'   r(   __call__!  r   zMediaList.__call__c                 C   rf   )r;   z<Twilio.Api.V2010.MediaList>r'   r,   r'   r'   r(   rL   .  rg   zMediaList.__repr__)rO   rP   rQ   r   rS   r   r   unsetr   r   objectr   intr   r   rp   r	   rt   r   rv   rz   rc   ro   rs   r   r   r*   r    r   rL   rV   r'   r'   r%   r(   rh     s    



&



&



%



&






,






*rh   N)rR   r   typingr   r   r   r   r   r   r	   twilio.baser
   r   r   twilio.base.instance_contextr   twilio.base.instance_resourcer   twilio.base.list_resourcer   twilio.base.versionr   twilio.base.pager   r   r*   rc   rh   r'   r'   r'   r(   <module>   s    $gk