o
    ØRWjË  ã                   @  sÜ  d dl mZ d dlmZmZmZ d dlmZmZ d dl	Z	ddl
mZ ddlmZmZmZmZmZmZmZmZmZ ddlmZ dd	lmZmZmZmZmZmZmZm Z  dd
l!m"Z"m#Z#m$Z$m%Z% ddl&m'Z' ddl(m)Z)m*Z* ddl+m,Z,m-Z-m.Z.m/Z/m0Z0m1Z1 ddl2m3Z3m4Z4 ddl5m6Z6 ddl7m8Z8m9Z9 ddl:m;Z; ddl<mZ ddl=mZ ddl>m?Z? ddl@mAZA ddlBmCZC ddlDmEZE ddgZFG dd„ de)ƒZGG dd„ de*ƒZHG dd„ dƒZIG dd„ dƒZJG d d!„ d!ƒZKG d"d#„ d#ƒZLdS )$é    )Úannotations)ÚTYPE_CHECKINGÚMappingÚcast)ÚLiteralÚassert_neverNé   )Ú_legacy_response)	Ú	VideoSizeÚVideoSecondsÚvideo_edit_paramsÚvideo_list_paramsÚvideo_remix_paramsÚvideo_create_paramsÚvideo_extend_paramsÚvideo_create_character_paramsÚvideo_download_content_params)Údeepcopy_with_paths)ÚBodyÚOmitÚQueryÚHeadersÚNotGivenÚ	FileTypesÚomitÚ	not_given)Úextract_filesÚpath_templateÚmaybe_transformÚasync_maybe_transform)Úcached_property)ÚSyncAPIResourceÚAsyncAPIResource)ÚStreamedBinaryAPIResponseÚAsyncStreamedBinaryAPIResponseÚto_streamed_response_wrapperÚ"async_to_streamed_response_wrapperÚ#to_custom_streamed_response_wrapperÚ)async_to_custom_streamed_response_wrapper)ÚSyncConversationCursorPageÚAsyncConversationCursorPage)ÚVideo)ÚAsyncPaginatorÚmake_request_options)Úis_given)r
   )r   )ÚVideoModelParam)ÚVideoDeleteResponse)ÚVideoGetCharacterResponse)ÚVideoCreateCharacterResponseÚVideosÚAsyncVideosc                
   @  óD  e Zd ZedPdd„ƒZedQdd„ƒZeeeeddded	œdRdd„Zeeeeedddedœ	dSd"d#„Z	ed$œdTd&d'„Z
ddded(œdUd)d*„Zeeeddded+œdVd2d3„Zddded(œdWd5d6„Zddded(œdXd;d<„Zeddded=œdYdAdB„Zddded(œdZdDdE„Zddded(œd[dHdI„Zddded(œd\dLdM„Zddded(œd]dNdO„ZdS )^r3   ÚreturnÚVideosWithRawResponsec                 C  ó   t | ƒS ©a  
        This property can be used as a prefix for any HTTP method call to return
        the raw response object instead of the parsed content.

        For more information, see https://www.github.com/openai/openai-python#accessing-raw-response-data-eg-headers
        )r7   ©Úself© r<   úf/home/esfera/Documents/content_generation/venv/lib/python3.10/site-packages/openai/resources/videos.pyÚwith_raw_response2   ó   zVideos.with_raw_responseÚVideosWithStreamingResponsec                 C  r8   ©zÌ
        An alternative to `.with_raw_response` that doesn't eagerly read the response body.

        For more information, see https://www.github.com/openai/openai-python#with_streaming_response
        )r@   r:   r<   r<   r=   Úwith_streaming_response<   ó   zVideos.with_streaming_responseN©Úinput_referenceÚmodelÚsecondsÚsizeÚextra_headersÚextra_queryÚ
extra_bodyÚtimeoutÚpromptÚstrrE   ú)video_create_params.InputReference | OmitrF   úVideoModelParam | OmitrG   úVideoSeconds | OmitrH   úVideoSize | OmitrI   úHeaders | NonerJ   úQuery | NonerK   úBody | NonerL   ú'float | httpx.Timeout | None | NotGivenr+   c       	         C  sv   t |||||dœdggƒ}
tttttf |
ƒdggd�}ddi|p"i ¥}| jdt|
tj	ƒ|t
||||	ddid	�td
�S )á¬  
        Create a new video generation job from a prompt and optional reference assets.

        Args:
          prompt: Text prompt that describes the video to generate.

          input_reference: Optional reference asset upload or reference object that guides generation.

          model: The video generation model to use (allowed values: sora-2, sora-2-pro). Defaults
              to `sora-2`.

          seconds: Clip duration in seconds (allowed values: 4, 8, 12). Defaults to 4 seconds.

          size: Output resolution formatted as width x height (allowed values: 720x1280,
              1280x720, 1024x1792, 1792x1024). Defaults to 720x1280.

          extra_headers: Send extra headers

          extra_query: Add additional query parameters to the request

          extra_body: Add additional JSON properties to the request

          timeout: Override the client-level default timeout for this request, in seconds
        ©rM   rE   rF   rG   rH   rE   ©ÚpathsúContent-Typeúmultipart/form-dataú/videosÚbearer_authT©rI   rJ   rK   rL   Úsecurity©ÚbodyÚfilesÚoptionsÚcast_to)r   r   r   r   rN   ÚobjectÚ_postr   r   ÚVideoCreateParamsr-   r+   ©r;   rM   rE   rF   rG   rH   rI   rJ   rK   rL   rb   rc   r<   r<   r=   ÚcreateE   s0   'ûø

ûõzVideos.create©	rE   rF   rG   rH   Úpoll_interval_msrI   rJ   rK   rL   rl   ú
int | Omitc       
         C  s,   | j ||||||||	|
d�	}| j|j|d�S )ú/Create a video and wait for it to be processed.©	rF   rM   rE   rG   rH   rI   rJ   rK   rL   ©rl   ©rj   ÚpollÚid©r;   rM   rE   rF   rG   rH   rl   rI   rJ   rK   rL   Úvideor<   r<   r=   Úcreate_and_poll‰   s   ÷þzVideos.create_and_pollrp   Úvideo_idc                C  s²   ddi}t |ƒrt|ƒ|d< 	 | jj||d�}| ¡ }|jdks%|jdkrBt |ƒs:|j d¡}|d	ur8t|ƒ}nd
}|  	|d
 ¡ n|jdksL|jdkrN|S t
rVt|jƒ n|S q)úÑWait for the vector store file to finish processing.

        Note: this will return even if the file failed to process, you need to check
        file.last_error and file.status to handle these cases
        úX-Stainless-Poll-HelperÚtrueú X-Stainless-Custom-Poll-IntervalT©rI   Úin_progressÚqueuedúopenai-poll-after-msNéè  Ú	completedÚfailed©r.   rN   r>   ÚretrieveÚparseÚstatusÚheadersÚgetÚintÚ_sleepr   r   ©r;   rw   rl   r‡   Úresponseru   Úfrom_headerr<   r<   r=   rr   «   s,   þ
êzVideos.poll©rI   rJ   rK   rL   c             	   C  ó<   |s	t d|›�ƒ‚| jtd|d�t||||ddid�td�S )ád  
        Fetch the latest metadata for a generated video.

        Args:
          extra_headers: Send extra headers

          extra_query: Add additional query parameters to the request

          extra_body: Add additional JSON properties to the request

          timeout: Override the client-level default timeout for this request, in seconds
        ú7Expected a non-empty value for `video_id` but received ú/videos/{video_id}©rw   r^   Tr_   ©rd   re   ©Ú
ValueErrorÚ_getr   r-   r+   ©r;   rw   rI   rJ   rK   rL   r<   r<   r=   r„   Ò   ó   
û÷zVideos.retrieve©ÚafterÚlimitÚorderrI   rJ   rK   rL   r›   ú
str | Omitrœ   r�   úLiteral['asc', 'desc'] | Omitú!SyncConversationCursorPage[Video]c                C  ó:   | j dtt t||||t|||dœtjƒddid�td�S ©ao  
        List recently generated videos for the current project.

        Args:
          after: Identifier for the last item from the previous pagination request

          limit: Number of items to retrieve

          order: Sort order of results by timestamp. Use `asc` for ascending order or `desc` for
              descending order.

          extra_headers: Send extra headers

          extra_query: Add additional query parameters to the request

          extra_body: Add additional JSON properties to the request

          timeout: Override the client-level default timeout for this request, in seconds
        r]   )r›   rœ   r�   r^   T©rI   rJ   rK   rL   Úqueryr`   )Úpagerd   rF   )Ú_get_api_listr)   r+   r-   r   r   ÚVideoListParams©r;   r›   rœ   r�   rI   rJ   rK   rL   r<   r<   r=   Úlist÷   ó&    ýúóîzVideos.listr0   c             	   C  r�   )áy  
        Permanently delete a completed or failed video and its stored assets.

        Args:
          extra_headers: Send extra headers

          extra_query: Add additional query parameters to the request

          extra_body: Add additional JSON properties to the request

          timeout: Override the client-level default timeout for this request, in seconds
        r‘   r’   r“   r^   Tr_   r”   ©r–   Ú_deleter   r-   r0   r˜   r<   r<   r=   Údelete,  r™   zVideos.deleteÚnameru   r   r2   c          	      C  óp   t ||dœdggƒ}tttttf |ƒdggd�}ddi|pi ¥}| jdt|tj	ƒ|t
||||ddid	�td
�S )áÍ  
        Create a character from an uploaded video.

        Args:
          name: Display name for this API character.

          video: Video file used to create a character.

          extra_headers: Send extra headers

          extra_query: Add additional query parameters to the request

          extra_body: Add additional JSON properties to the request

          timeout: Override the client-level default timeout for this request, in seconds
        ©r¯   ru   ru   rY   r[   r\   ú/videos/charactersr^   Tr_   ra   )r   r   r   r   rN   rf   rg   r   r   ÚVideoCreateCharacterParamsr-   r2   ©	r;   r¯   ru   rI   rJ   rK   rL   rb   rc   r<   r<   r=   Úcreate_characterQ  s*   þû
ûõzVideos.create_character©ÚvariantrI   rJ   rK   rL   r¸   ú3Literal['video', 'thumbnail', 'spritesheet'] | Omitú+_legacy_response.HttpxBinaryResponseContentc             
   C  s\   |s	t d|›�ƒ‚ddi|pi ¥}| jtd|d�t||||td|itjƒddid	�tjd
�S )á  
        Download the generated video bytes or a derived preview asset.

        Streams the rendered video content for the specified video job.

        Args:
          variant: Which downloadable asset to return. Defaults to the MP4 video.

          extra_headers: Send extra headers

          extra_query: Add additional query parameters to the request

          extra_body: Add additional JSON properties to the request

          timeout: Override the client-level default timeout for this request, in seconds
        r‘   ÚAcceptúapplication/binaryú/videos/{video_id}/contentr“   r¸   r^   Tr£   r”   )	r–   r—   r   r-   r   r   ÚVideoDownloadContentParamsr	   ÚHttpxBinaryResponseContent©r;   rw   r¸   rI   rJ   rK   rL   r<   r<   r=   Údownload_content‡  s   
úözVideos.download_contentúvideo_edit_params.Videoc          	      C  r°   )á  
        Create a new video generation job by editing a source video or existing
        generated video.

        Args:
          prompt: Text prompt that describes how to edit the source video.

          video: Reference to the completed video to edit.

          extra_headers: Send extra headers

          extra_query: Add additional query parameters to the request

          extra_body: Add additional JSON properties to the request

          timeout: Override the client-level default timeout for this request, in seconds
        ©rM   ru   ru   rY   r[   r\   ú/videos/editsr^   Tr_   ra   )r   r   r   r   rN   rf   rg   r   r   ÚVideoEditParamsr-   r+   ©	r;   rM   ru   rI   rJ   rK   rL   rb   rc   r<   r<   r=   Úedit³  s*   þû
ûõzVideos.editr   úvideo_extend_params.Videoc          
      C  sr   t |||dœdggƒ}tttttf |ƒdggd�}	ddi|p i ¥}| jdt|tj	ƒ|	t
||||ddid	�td
�S )áj  
        Create an extension of a completed video.

        Args:
          prompt: Updated text prompt that directs the extension generation.

          seconds: Length of the newly generated extension segment in seconds (allowed values: 4,
              8, 12, 16, 20).

          video: Reference to the completed video to extend.

          extra_headers: Send extra headers

          extra_query: Add additional query parameters to the request

          extra_body: Add additional JSON properties to the request

          timeout: Override the client-level default timeout for this request, in seconds
        ©rM   rG   ru   ru   rY   r[   r\   ú/videos/extensionsr^   Tr_   ra   )r   r   r   r   rN   rf   rg   r   r   ÚVideoExtendParamsr-   r+   ©
r;   rM   rG   ru   rI   rJ   rK   rL   rb   rc   r<   r<   r=   Úextendê  s,    ýú
ûõzVideos.extendÚcharacter_idr1   c             	   C  r�   )áF  
        Fetch a character.

        Args:
          extra_headers: Send extra headers

          extra_query: Add additional query parameters to the request

          extra_body: Add additional JSON properties to the request

          timeout: Override the client-level default timeout for this request, in seconds
        ú;Expected a non-empty value for `character_id` but received ú!/videos/characters/{character_id}©rÑ   r^   Tr_   r”   ©r–   r—   r   r-   r1   ©r;   rÑ   rI   rJ   rK   rL   r<   r<   r=   Úget_character%  r™   zVideos.get_characterc             
   C  sJ   |s	t d|›�ƒ‚| jtd|d�td|itjƒt||||ddid�td�S )	á»  
        Create a remix of a completed video using a refreshed prompt.

        Args:
          prompt: Updated text prompt that directs the remix generation.

          extra_headers: Send extra headers

          extra_query: Add additional query parameters to the request

          extra_body: Add additional JSON properties to the request

          timeout: Override the client-level default timeout for this request, in seconds
        r‘   ú/videos/{video_id}/remixr“   rM   r^   Tr_   ©rb   rd   re   )r–   rg   r   r   r   ÚVideoRemixParamsr-   r+   ©r;   rw   rM   rI   rJ   rK   rL   r<   r<   r=   ÚremixJ  s   
ûözVideos.remix)r6   r7   )r6   r@   ©rM   rN   rE   rO   rF   rP   rG   rQ   rH   rR   rI   rS   rJ   rT   rK   rU   rL   rV   r6   r+   ©rM   rN   rE   rO   rF   rP   rG   rQ   rH   rR   rl   rm   rI   rS   rJ   rT   rK   rU   rL   rV   r6   r+   ©rw   rN   rl   rm   r6   r+   ©rw   rN   rI   rS   rJ   rT   rK   rU   rL   rV   r6   r+   )r›   rž   rœ   rm   r�   rŸ   rI   rS   rJ   rT   rK   rU   rL   rV   r6   r    ©rw   rN   rI   rS   rJ   rT   rK   rU   rL   rV   r6   r0   ©r¯   rN   ru   r   rI   rS   rJ   rT   rK   rU   rL   rV   r6   r2   ©rw   rN   r¸   r¹   rI   rS   rJ   rT   rK   rU   rL   rV   r6   rº   ©rM   rN   ru   rÃ   rI   rS   rJ   rT   rK   rU   rL   rV   r6   r+   ©rM   rN   rG   r   ru   rÊ   rI   rS   rJ   rT   rK   rU   rL   rV   r6   r+   ©rÑ   rN   rI   rS   rJ   rT   rK   rU   rL   rV   r6   r1   ©rw   rN   rM   rN   rI   rS   rJ   rT   rK   rU   rL   rV   r6   r+   ©Ú__name__Ú
__module__Ú__qualname__r    r>   rB   r   r   rj   rv   rr   r„   r©   r®   r¶   rÂ   rÉ   rÐ   rØ   rÞ   r<   r<   r<   r=   r3   1   s–    	óHò&ü-÷(õ;÷,ö:ö3ö?õA÷,öc                
   @  r5   )^r4   r6   ÚAsyncVideosWithRawResponsec                 C  r8   r9   )rî   r:   r<   r<   r=   r>   u  r?   zAsyncVideos.with_raw_responseÚ AsyncVideosWithStreamingResponsec                 C  r8   rA   )rï   r:   r<   r<   r=   rB     rC   z#AsyncVideos.with_streaming_responseNrD   rM   rN   rE   rO   rF   rP   rG   rQ   rH   rR   rI   rS   rJ   rT   rK   rU   rL   rV   r+   c       	         Ã  s„   �t |||||dœdggƒ}
tttttf |
ƒdggd�}ddi|p#i ¥}| jdt|
tj	ƒI dH |t
||||	dd	id
�td�I dH S )rW   rX   rE   rY   r[   r\   r]   Nr^   Tr_   ra   )r   r   r   r   rN   rf   rg   r   r   rh   r-   r+   ri   r<   r<   r=   rj   ˆ  s2   €'ûø
ûõzAsyncVideos.createrk   rl   rm   c       
         Ã  s:   �| j ||||||||	|
d�	I dH }| j|j|d�I dH S )rn   ro   Nrp   rq   rt   r<   r<   r=   rv   Ì  s    €÷þzAsyncVideos.create_and_pollrp   rw   c                Ã  sÀ   �ddi}t |ƒrt|ƒ|d< 	 | jj||d�I dH }| ¡ }|jdks)|jdkrIt |ƒs>|j d	¡}|dur<t|ƒ}nd
}|  	|d
 ¡I dH  n|jdksS|jdkrU|S t
r]t|jƒ n|S q)rx   ry   rz   r{   Tr|   Nr}   r~   r   r€   r�   r‚   rƒ   r‹   r<   r<   r=   rr   î  s.   €þ
êzAsyncVideos.pollrŽ   c             	   Ã  óD   �|s
t d|›�ƒ‚| jtd|d�t||||ddid�td�I dH S )	r�   r‘   r’   r“   r^   Tr_   r”   Nr•   r˜   r<   r<   r=   r„     ó   €
û÷zAsyncVideos.retrieverš   r›   rž   rœ   r�   rŸ   ú9AsyncPaginator[Video, AsyncConversationCursorPage[Video]]c                C  r¡   r¢   )r¦   r*   r+   r-   r   r   r§   r¨   r<   r<   r=   r©   :  rª   zAsyncVideos.listr0   c             	   Ã  rð   )	r«   r‘   r’   r“   r^   Tr_   r”   Nr¬   r˜   r<   r<   r=   r®   o  rñ   zAsyncVideos.deleter¯   ru   r   r2   c          	      Ã  ó~   �t ||dœdggƒ}tttttf |ƒdggd�}ddi|p i ¥}| jdt|tj	ƒI dH |t
||||dd	id
�td�I dH S )r±   r²   ru   rY   r[   r\   r³   Nr^   Tr_   ra   )r   r   r   r   rN   rf   rg   r   r   r´   r-   r2   rµ   r<   r<   r=   r¶   ”  s,   €þûûõzAsyncVideos.create_characterr·   r¸   r¹   rº   c             
   Ã  sj   �|s
t d|›�ƒ‚ddi|pi ¥}| jtd|d�t||||td|itjƒI dH dd	id
�tjd�I dH S )r»   r‘   r¼   r½   r¾   r“   r¸   Nr^   Tr£   r”   )	r–   r—   r   r-   r   r   r¿   r	   rÀ   rÁ   r<   r<   r=   rÂ   Ê  s$   €

ÿø
ôzAsyncVideos.download_contentrÃ   c          	      Ã  ró   )rÄ   rÅ   ru   rY   r[   r\   rÆ   Nr^   Tr_   ra   )r   r   r   r   rN   rf   rg   r   r   rÇ   r-   r+   rÈ   r<   r<   r=   rÉ   ø  s,   €þûûõzAsyncVideos.editr   rÊ   c          
      Ã  s€   �t |||dœdggƒ}tttttf |ƒdggd�}	ddi|p!i ¥}| jdt|tj	ƒI dH |	t
||||dd	id
�td�I dH S )rË   rÌ   ru   rY   r[   r\   rÍ   Nr^   Tr_   ra   )r   r   r   r   rN   rf   rg   r   r   rÎ   r-   r+   rÏ   r<   r<   r=   rÐ   /  s.   € ýúûõzAsyncVideos.extendrÑ   r1   c             	   Ã  rð   )	rÒ   rÓ   rÔ   rÕ   r^   Tr_   r”   NrÖ   r×   r<   r<   r=   rØ   j  rñ   zAsyncVideos.get_characterc             
   Ã  sX   �|s
t d|›�ƒ‚| jtd|d�td|itjƒI dH t||||ddid�td	�I dH S )
rÙ   r‘   rÚ   r“   rM   Nr^   Tr_   rÛ   )r–   rg   r   r   r   rÜ   r-   r+   rÝ   r<   r<   r=   rÞ   �  s   €
ûözAsyncVideos.remix)r6   rî   )r6   rï   rß   rà   rá   râ   )r›   rž   rœ   rm   r�   rŸ   rI   rS   rJ   rT   rK   rU   rL   rV   r6   rò   rã   rä   rå   ræ   rç   rè   ré   rê   r<   r<   r<   r=   r4   t  s–    	óHò&ü-÷(õ;÷,ö:ö5ö?õA÷,öc                   @  ó   e Zd Zddd„ZdS )	r7   Úvideosr3   r6   ÚNonec                 C  ó–   || _ t |j¡| _t |j¡| _t |j¡| _t |j¡| _t |j¡| _t |j¡| _t |j	¡| _	t |j
¡| _
t |j¡| _t |j¡| _d S ©N)Ú_videosr	   Úto_raw_response_wrapperrj   r„   r©   r®   r¶   rÂ   rÉ   rÐ   rØ   rÞ   ©r;   rõ   r<   r<   r=   Ú__init__º  ó>   ÿÿÿÿÿÿÿÿÿ
ÿzVideosWithRawResponse.__init__N©rõ   r3   r6   rö   ©rë   rì   rí   rü   r<   r<   r<   r=   r7   ¹  ó    r7   c                   @  rô   )	rî   rõ   r4   r6   rö   c                 C  r÷   rø   )rù   r	   Úasync_to_raw_response_wrapperrj   r„   r©   r®   r¶   rÂ   rÉ   rÐ   rØ   rÞ   rû   r<   r<   r=   rü   Þ  rý   z#AsyncVideosWithRawResponse.__init__N©rõ   r4   r6   rö   rÿ   r<   r<   r<   r=   rî   Ý  r   rî   c                   @  rô   )	r@   rõ   r3   r6   rö   c                 C  ó„   || _ t|jƒ| _t|jƒ| _t|jƒ| _t|jƒ| _t|jƒ| _t|jt	ƒ| _t|j
ƒ| _
t|jƒ| _t|jƒ| _t|jƒ| _d S rø   )rù   r%   rj   r„   r©   r®   r¶   r'   rÂ   r#   rÉ   rÐ   rØ   rÞ   rû   r<   r<   r=   rü     ó@   ÿÿÿÿÿþÿÿÿ
ÿz$VideosWithStreamingResponse.__init__Nrþ   rÿ   r<   r<   r<   r=   r@     r   r@   c                   @  rô   )	rï   rõ   r4   r6   rö   c                 C  r  rø   )rù   r&   rj   r„   r©   r®   r¶   r(   rÂ   r$   rÉ   rÐ   rØ   rÞ   rû   r<   r<   r=   rü   '  r  z)AsyncVideosWithStreamingResponse.__init__Nr  rÿ   r<   r<   r<   r=   rï   &  r   rï   )MÚ
__future__r   Útypingr   r   r   Útyping_extensionsr   r   ÚhttpxÚ r	   Útypesr
   r   r   r   r   r   r   r   r   Ú_filesr   Ú_typesr   r   r   r   r   r   r   r   Ú_utilsr   r   r   r   Ú_compatr    Ú	_resourcer!   r"   Ú	_responser#   r$   r%   r&   r'   r(   Ú
paginationr)   r*   Útypes.videor+   Ú_base_clientr,   r-   Ú_utils._utilsr.   Útypes.video_sizeÚtypes.video_secondsÚtypes.video_model_paramr/   Útypes.video_delete_responser0   Ú"types.video_get_character_responser1   Ú%types.video_create_character_responser2   Ú__all__r3   r4   r7   rî   r@   rï   r<   r<   r<   r=   Ú<module>   sJ   ,(     G    I$$%