o
    ¨Ýj6å  ã                   @  sÜ  d dl mZ d dl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%m&Z& ddl'm(Z( ddl)m*Z*m+Z+ ddl,m-Z-m.Z.m/Z/m0Z0m1Z1m2Z2 ddl3m4Z4m5Z5 ddl6m7Z7 ddl8m9Z9m:Z: ddl;mZ ddl<mZ ddl=m>Z> ddl?m@Z@ ddlAmBZB ddlCmDZD ddgZEG dd„ de*ƒZFG dd„ de+ƒZGG dd„ dƒZHG dd„ dƒZIG dd „ d ƒZJG d!d"„ d"ƒZKdS )#é    )ÚannotationsN)ÚTYPE_CHECKINGÚMappingÚcast)ÚLiteralÚassert_neveré   )Ú_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)Úis_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)r
   )r   )ÚVideoModelParam)ÚVideoDeleteResponse)ÚVideoGetCharacterResponse)ÚVideoCreateCharacterResponseÚVideosÚAsyncVideosc                   @  ó¼  e Zd ZedQdd„ƒZedRdd„ƒZe d¡eeeed	d	d	e	d
œdSdd„ƒZ
e d¡d	d	d	e	d œdTd"d#„ƒZe d¡eeed	d	d	e	d$œdUd,d-„ƒZe d¡d	d	d	e	d œdVd/d0„ƒZe d¡d	d	d	e	d œdWd5d6„ƒZe d¡ed	d	d	e	d7œdXd;d<„ƒZe d¡d	d	d	e	d œdYd>d?„ƒZe d¡d	d	d	e	d œdZdBdC„ƒZe d¡d	d	d	e	d œd[dFdG„ƒZe d¡d	d	d	e	d œd\dHdI„ƒZe d¡eeeeed	d	d	e	dJœ	d]dLdM„ƒZe d¡edNœd^dOdP„ƒ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<   úR/var/www/html/chatgpt/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_responseúIThe Sora API is scheduled to permanently shut down on September 24, 2026.N©Úinput_referenceÚmodelÚsecondsÚsizeÚextra_headersÚextra_queryÚ
extra_bodyÚtimeoutÚpromptÚstrrF   ú)video_create_params.InputReference | OmitrG   úVideoModelParam | OmitrH   úVideoSeconds | OmitrI   úVideoSize | OmitrJ   úHeaders | NonerK   úQuery | NonerL   úBody | NonerM   ú(float | httpx2.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
        ©rN   rF   rG   rH   rI   rF   ©ÚpathsúContent-Typeúmultipart/form-dataú/videosÚbearer_authT©rJ   rK   rL   rM   Úsecurity©ÚbodyÚfilesÚoptionsÚcast_to)r   r   r   r   rO   ÚobjectÚ_postr   r   ÚVideoCreateParamsr.   r,   ©r;   rN   rF   rG   rH   rI   rJ   rK   rL   rM   rc   rd   r<   r<   r=   ÚcreateE   s0   (ûø

ûõzVideos.create©rJ   rK   rL   rM   Úvideo_idc             	   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}©rm   r_   Tr`   ©re   rf   ©Ú
ValueErrorÚ_getr   r.   r,   ©r;   rm   rJ   rK   rL   rM   r<   r<   r=   ÚretrieveŠ   ó   
û÷zVideos.retrieve©ÚafterÚlimitÚorderrJ   rK   rL   rM   r{   ú
str | Omitr|   ú
int | Omitr}   ú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©rJ   rK   rL   rM   Úqueryra   )Úpagere   rG   )Ú_get_api_listr*   r,   r.   r   r   ÚVideoListParams©r;   r{   r|   r}   rJ   rK   rL   rM   r<   r<   r=   Úlist°   ó&   !ýúóîzVideos.listr0   c             	   C  rn   )á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
        rp   rq   rr   r_   Tr`   rs   ©ru   Ú_deleter   r.   r0   rw   r<   r<   r=   Údeleteæ   ry   zVideos.deleteÚnameÚvideor   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�   r‘   r‘   rZ   r\   r]   ú/videos/charactersr_   Tr`   rb   )r   r   r   r   rO   rg   rh   r   r   ÚVideoCreateCharacterParamsr.   r2   ©	r;   r�   r‘   rJ   rK   rL   rM   rc   rd   r<   r<   r=   Úcreate_character  s*   þû
ûõzVideos.create_character©ÚvariantrJ   rK   rL   rM   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
        rp   ÚAcceptúapplication/binaryú/videos/{video_id}/contentrr   rš   r_   Tr„   rs   )	ru   rv   r   r.   r   r   ÚVideoDownloadContentParamsr	   ÚHttpxBinaryResponseContent©r;   rm   rš   rJ   rK   rL   rM   r<   r<   r=   Údownload_contentC  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
        ©rN   r‘   r‘   rZ   r\   r]   ú/videos/editsr_   Tr`   rb   )r   r   r   r   rO   rg   rh   r   r   ÚVideoEditParamsr.   r,   ©	r;   rN   r‘   rJ   rK   rL   rM   rc   rd   r<   r<   r=   Úeditp  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
        ©rN   rH   r‘   r‘   rZ   r\   r]   ú/videos/extensionsr_   Tr`   rb   )r   r   r   r   rO   rg   rh   r   r   ÚVideoExtendParamsr.   r,   ©
r;   rN   rH   r‘   rJ   rK   rL   rM   rc   rd   r<   r<   r=   Úextend¨  s,   !ýú
ûõzVideos.extendÚcharacter_idr1   c             	   C  rn   )á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`   rs   ©ru   rv   r   r.   r1   ©r;   r³   rJ   rK   rL   rM   r<   r<   r=   Úget_characterä  ry   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
        rp   ú/videos/{video_id}/remixrr   rN   r_   Tr`   ©rc   re   rf   )ru   rh   r   r   r   ÚVideoRemixParamsr.   r,   ©r;   rm   rN   rJ   rK   rL   rM   r<   r<   r=   Úremix
  s   
ûözVideos.remix©	rF   rG   rH   rI   Úpoll_interval_msrJ   rK   rL   rM   rÂ   c       
         C  s,   | j ||||||||	|
d�	}| j|j|d�S )ú/Create a video and wait for it to be processed.©	rG   rN   rF   rH   rI   rJ   rK   rL   rM   ©rÂ   ©rk   ÚpollÚid©r;   rN   rF   rG   rH   rI   rÂ   rJ   rK   rL   rM   r‘   r<   r<   r=   Úcreate_and_poll4  s   ÷þzVideos.create_and_pollrÅ   c                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©rJ   Úin_progressÚqueuedúopenai-poll-after-msNéè  Ú	completedÚfailed©r   rO   r>   rx   ÚparseÚstatusÚheadersÚgetÚintZ_sleepr   r   ©r;   rm   rÂ   rÙ   Úresponser‘   Zfrom_headerr<   r<   r=   rÇ   U  s,   þ
êzVideos.poll)r6   r7   )r6   r@   ©rN   rO   rF   rP   rG   rQ   rH   rR   rI   rS   rJ   rT   rK   rU   rL   rV   rM   rW   r6   r,   ©rm   rO   rJ   rT   rK   rU   rL   rV   rM   rW   r6   r,   )r{   r~   r|   r   r}   r€   rJ   rT   rK   rU   rL   rV   rM   rW   r6   r�   ©rm   rO   rJ   rT   rK   rU   rL   rV   rM   rW   r6   r0   ©r�   rO   r‘   r   rJ   rT   rK   rU   rL   rV   rM   rW   r6   r2   ©rm   rO   rš   r›   rJ   rT   rK   rU   rL   rV   rM   rW   r6   rœ   ©rN   rO   r‘   r¥   rJ   rT   rK   rU   rL   rV   rM   rW   r6   r,   ©rN   rO   rH   r   r‘   r¬   rJ   rT   rK   rU   rL   rV   rM   rW   r6   r,   ©r³   rO   rJ   rT   rK   rU   rL   rV   rM   rW   r6   r1   ©rm   rO   rN   rO   rJ   rT   rK   rU   rL   rV   rM   rW   r6   r,   ©rN   rO   rF   rP   rG   rQ   rH   rR   rI   rS   rÂ   r   rJ   rT   rK   rU   rL   rV   rM   rW   r6   r,   ©rm   rO   rÂ   r   r6   r,   ©Ú__name__Ú
__module__Ú__qualname__r!   r>   rB   Útyping_extensionsÚ
deprecatedr   r   rk   rx   rŠ   r�   r˜   r¤   r«   r²   rº   rÀ   rÊ   rÇ   r<   r<   r<   r=   r3   1   s®    	óD÷%õ5÷%ö6ö,ö7	õ;÷%ö)ô üc                   @  r5   )_r4   r6   ÚAsyncVideosWithRawResponsec                 C  r8   r9   )rï   r:   r<   r<   r=   r>   {  r?   zAsyncVideos.with_raw_responseÚ AsyncVideosWithStreamingResponsec                 C  r8   rA   )rð   r:   r<   r<   r=   rB   …  rC   z#AsyncVideos.with_streaming_responserD   NrE   rN   rO   rF   rP   rG   rQ   rH   rR   rI   rS   rJ   rT   rK   rU   rL   rV   rM   rW   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 )rX   rY   rF   rZ   r\   r]   r^   Nr_   Tr`   rb   )r   r   r   r   rO   rg   rh   r    r   ri   r.   r,   rj   r<   r<   r=   rk   Ž  s2   €(ûø
ûõzAsyncVideos.createrl   rm   c             	   Ã  óD   �|s
t d|›�ƒ‚| jtd|d�t||||ddid�td�I dH S )	ro   rp   rq   rr   r_   Tr`   rs   Nrt   rw   r<   r<   r=   rx   Ó  ó   €
û÷zAsyncVideos.retrieverz   r{   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Œ   rp   rq   rr   r_   Tr`   rs   Nr�   rw   r<   r<   r=   r�   /  rò   zAsyncVideos.deleter�   r‘   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”   r‘   rZ   r\   r]   r•   Nr_   Tr`   rb   )r   r   r   r   rO   rg   rh   r    r   r–   r.   r2   r—   r<   r<   r=   r˜   U  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�   rp   rž   rŸ   r    rr   rš   Nr_   Tr„   rs   )	ru   rv   r   r.   r    r   r¡   r	   r¢   r£   r<   r<   r=   r¤   Œ  s$   €

ÿø
ôzAsyncVideos.download_contentr¥   c          	      Ã  rô   )r¦   r§   r‘   rZ   r\   r]   r¨   Nr_   Tr`   rb   )r   r   r   r   rO   rg   rh   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®   r‘   rZ   r\   r]   r¯   Nr_   Tr`   rb   )r   r   r   r   rO   rg   rh   r    r   r°   r.   r,   r±   r<   r<   r=   r²   ó  s.   €!ýúûõzAsyncVideos.extendr³   r1   c             	   Ã  rñ   )	r´   rµ   r¶   r·   r_   Tr`   rs   Nr¸   r¹   r<   r<   r=   rº   /  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»   rp   r¼   rr   rN   Nr_   Tr`   r½   )ru   rh   r   r    r   r¾   r.   r,   r¿   r<   r<   r=   rÀ   U  s   €
ûözAsyncVideos.remixrÁ   rÂ   c       
         Ã  s:   �| j ||||||||	|
d�	I dH }| j|j|d�I dH S )rÃ   rÄ   NrÅ   rÆ   rÉ   r<   r<   r=   rÊ     s    €÷þzAsyncVideos.create_and_pollrÅ   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)rË   rÌ   rÍ   rÎ   TrÏ   NrÐ   rÑ   rÒ   rÓ   rÔ   rÕ   rÖ   rÜ   r<   r<   r=   rÇ      s.   €þ
êzAsyncVideos.poll)r6   rï   )r6   rð   rÞ   rß   )r{   r~   r|   r   r}   r€   rJ   rT   rK   rU   rL   rV   rM   rW   r6   ró   rà   rá   râ   rã   rä   rå   ræ   rç   rè   ré   r<   r<   r<   r=   r4   z  s®    	óD÷%õ5÷%ö6ö.ö7	õ;÷%ö)ô ü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	   Zto_raw_response_wrapperrk   rx   rŠ   r�   r˜   r¤   r«   r²   rº   rÀ   ©r;   rö   r<   r<   r=   Ú__init__Æ  óR   ÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿÿ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	   Zasync_to_raw_response_wrapperrk   rx   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&   rk   rx   rŠ   r�   r˜   r(   r¤   r$   r«   r²   rº   rÀ   rû   r<   r<   r=   rü   6  óT   ÿÿÿÿÿÿÿÿÿÿþÿÿÿÿÿÿÿÿÿz$VideosWithStreamingResponse.__init__Nrþ   rÿ   r<   r<   r<   r=   r@   5  r   r@   c                   @  rõ   )	rð   rö   r4   r6   r÷   c                 C  r  rù   )rú   r'   rk   rx   rŠ   r�   r˜   r)   r¤   r%   r«   r²   rº   rÀ   rû   r<   r<   r=   rü   o  r  z)AsyncVideosWithStreamingResponse.__init__Nr  rÿ   r<   r<   r<   r=   rð   n  r   rð   )LÚ
__future__r   rí   Útypingr   r   r   r   r   Zhttpx2Ú r	   Útypesr
   r   r   r   r   r   r   r   r   Ú_filesr   Ú_typesr   r   r   r   r   r   r   r   Z_utilsr   r   r   r   r    Z_compatr!   Z	_resourcer"   r#   Ú	_responser$   r%   r&   r'   r(   r)   Z
paginationr*   r+   Ztypes.videor,   Z_base_clientr-   r.   Ztypes.video_sizeZtypes.video_secondsZtypes.video_model_paramr/   Ztypes.video_delete_responser0   Z"types.video_get_character_responser1   Z%types.video_create_character_responser2   Ú__all__r3   r4   r7   rï   r@   rð   r<   r<   r<   r=   Ú<module>   sJ   ,(     M    O889