
    Kh{                       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 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+m,Z,m-Z- ddl.m/Z/m0Z0 ddl1m2Z2 ddl3m4Z4m5Z5 ddl6m7Z7 ddl8mZ ddl9mZ ddl:mZ ddl;m<Z< ddgZ= G d de%      Z> G d de&      Z? G d d      Z@ G d d      ZA G d d      ZB G d d       ZCy)!    )annotations)TYPE_CHECKINGMappingcast)Literalassert_neverN   )_legacy_response)	VideoSize
VideoModelVideoSecondsvideo_list_paramsvideo_remix_paramsvideo_create_paramsvideo_download_content_params)BodyOmitQueryHeadersNotGiven	FileTypesomit	not_given)extract_filesmaybe_transformdeepcopy_minimal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   )r   )VideoDeleteResponseVideosAsyncVideosc            
         e Zd Zedd       Zedd       Zeeeeddded	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 ddZeeeeeddded		 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 ddZ	ed	 	 	 	 	 dd	Z
ddded
	 	 	 	 	 	 	 	 	 	 	 ddZeeeddded	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 ddZddded
	 	 	 	 	 	 	 	 	 	 	 ddZeddded	 	 	 	 	 	 	 	 	 	 	 	 	 ddZddded
	 	 	 	 	 	 	 	 	 	 	 	 	 ddZy)r.   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
        )VideosWithRawResponseselfs    J/var/www/html/venv/lib/python3.12/site-packages/openai/resources/videos.pywith_raw_responsezVideos.with_raw_response-   s     %T**    c                    t        |       S 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
        )VideosWithStreamingResponser4   s    r6   with_streaming_responsezVideos.with_streaming_response7   s     +400r8   Ninput_referencemodelsecondssizeextra_headersextra_query
extra_bodytimeoutc       	           t        |||||d      }
t        t        t        t        t
        f   |
      dgg      }|r
ddi|xs i }| j                  dt        |
t        j                        |t        ||||	      t              S )	  
        Create a video

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

          input_reference: Optional image reference that guides generation.

          model: The video generation model to use. Defaults to `sora-2`.

          seconds: Clip duration in seconds. Defaults to 4 seconds.

          size: Output resolution formatted as width x height. 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
        promptr>   r?   r@   rA   r>   pathsContent-Typemultipart/form-data/videosrB   rC   rD   rE   bodyfilesoptionscast_to)r   r   r   r   strobject_postr   r   VideoCreateParamsr+   r)   r5   rI   r>   r?   r@   rA   rB   rC   rD   rE   rQ   rR   s               r6   createzVideos.create@   s    J   #2"
 d73;#7>HYGZF[\ ,-B\}GZXZ\Mzz ':'L'LM(+Q[el   
 	
r8   	r>   r?   r@   rA   poll_interval_msrB   rC   rD   rE   c       
        p    | j                  ||||||||	|
	      }| j                  |j                  |      S )/Create a video and wait for it to be processed.	r?   rI   r>   r@   rA   rB   rC   rD   rE   r\   rZ   pollidr5   rI   r>   r?   r@   rA   r\   rB   rC   rD   rE   videos               r6   create_and_pollzVideos.create_and_poll~   sT    " +'#!  

 yyHH-  
 	
r8   r`   c                  ddi}t        |      rt        |      |d<   	 | j                  j                  ||      }|j	                         }|j
                  dk(  s|j
                  dk(  rKt        |      s+|j                  j                  d      }|t        |      }nd}| j                  |dz         n>|j
                  d	k(  s|j
                  d
k(  r|S t        rt        |j
                         n|S )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-IntervalrB   in_progressqueuedopenai-poll-after-ms  	completedfailedr,   rU   r7   retrieveparsestatusheadersgetint_sleepr   r   r5   video_idr\   rw   responsere   from_headers          r6   rb   zVideos.poll   s     $=f"E$%:=>N:OG67--66% 7 H
 NN$E||},0H 01"*"2"2"6"67M"NK".+.{+;(+/(,t34,0H  . L- r8   rO   c          	     r    |st        d|      | j                  d| t        ||||      t              S )D  
        Retrieve a 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/rO   rS   rT   
ValueError_getr+   r)   r5   r|   rB   rC   rD   rE   s         r6   rt   zVideos.retrieve   sT    . VW_Vbcddyyxj!(+Q[el   
 	
r8   afterlimitorderrB   rC   rD   rE   c                   | j                  dt        t           t        ||||t	        |||dt
        j                              t              S aC  
        List videos

        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
        rN   )r   r   r   rB   rC   rD   rE   query)pagerS   r?   )_get_api_listr'   r)   r+   r   r   VideoListParamsr5   r   r   r   rB   rC   rD   rE   s           r6   listzVideos.list   sb    @ !!+E2(+'%%!&!&!&
 &55 # " 
 	
r8   c          	     r    |st        d|      | j                  d| t        ||||      t              S )B  
        Delete a 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
        r   r   rO   r   r   _deleter+   r-   r   s         r6   deletezVideos.delete  sT    . VW_Vbcdd||xj!(+Q[el (  
 	
r8   variantrB   rC   rD   rE   c                   |st        d|      ddi|xs i }| j                  d| dt        ||||t        d|it        j
                              t        j                        S )	  Download video content

        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/binaryr   /contentr   r   r   )r   r   r+   r   r   VideoDownloadContentParamsr
   HttpxBinaryResponseContentr5   r|   r   rB   rC   rD   rE   s          r6   download_contentzVideos.download_content=  s    6 VW_Vbcdd!#7QM<ORQyyxj)(+'%%y'&:<Y<t<tu %??  

 
	
r8   c          
         |st        d|      | j                  d| dt        d|it        j                        t        ||||      t              S )  
        Create a video remix

        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   r   /remixrI   rO   rQ   rS   rT   )r   rW   r   r   VideoRemixParamsr+   r)   r5   r|   rI   rB   rC   rD   rE   s          r6   remixzVideos.remixg  sl    4 VW_Vbcddzzxj' (F!35G5X5XY(+Q[el   
 	
r8   )returnr3   )r   r;   rI   rU   r>   FileTypes | Omitr?   VideoModel | Omitr@   VideoSeconds | OmitrA   VideoSize | OmitrB   Headers | NonerC   Query | NonerD   Body | NonerE   'float | httpx.Timeout | None | NotGivenr   r)   rI   rU   r>   r   r?   r   r@   r   rA   r   r\   
int | OmitrB   r   rC   r   rD   r   rE   r   r   r)   r|   rU   r\   r   r   r)   r|   rU   rB   r   rC   r   rD   r   rE   r   r   r)   )r   
str | Omitr   r   r   Literal['asc', 'desc'] | OmitrB   r   rC   r   rD   r   rE   r   r   z!SyncConversationCursorPage[Video]r|   rU   rB   r   rC   r   rD   r   rE   r   r   r-   r|   rU   r   z3Literal['video', 'thumbnail', 'spritesheet'] | OmitrB   r   rC   r   rD   r   rE   r   r   z+_legacy_response.HttpxBinaryResponseContentr|   rU   rI   rU   rB   r   rC   r   rD   r   rE   r   r   r)   __name__
__module____qualname__r   r7   r<   r   r   rZ   rf   rb   rt   r   r   r   r    r8   r6   r.   r.   ,   s*   + + 1 1 -1#''+!% )-$("&;D<
 <
 *	<

 !<
 %<
 <
 &<
 "<
  <
 9<
 
<
D -1#''+!%'+ )-$("&;D 
  
 *	 

 ! 
 % 
  
 % 
 & 
 " 
   
 9 
 
 
L (,	%!%! %	%!
 
%!Z )-$("&;D

 &
 "
  
 9
 

H ! /3 )-$("&;D2
 2
 	2

 -2
 &2
 "2
  2
 92
 
+2
t )-$("&;D

 &
 "
  
 9
 

J HL )-$("&;D(
(
 E	(
 &(
 "(
  (
 9(
 
5(
b )-$("&;D#
#
 	#
 &#
 "#
  #
 9#
 
#
r8   c            
         e Zd Zedd       Zedd       Zeeeeddded	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 ddZeeeeeddded		 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 ddZ	ed	 	 	 	 	 dd	Z
ddded
	 	 	 	 	 	 	 	 	 	 	 ddZeeeddded	 	 	 	 	 	 	 	 	 	 	 	 	 	 	 ddZddded
	 	 	 	 	 	 	 	 	 	 	 ddZeddded	 	 	 	 	 	 	 	 	 	 	 	 	 ddZddded
	 	 	 	 	 	 	 	 	 	 	 	 	 ddZy)r/   c                    t        |       S r2   )AsyncVideosWithRawResponser4   s    r6   r7   zAsyncVideos.with_raw_response  s     *$//r8   c                    t        |       S r:   ) AsyncVideosWithStreamingResponser4   s    r6   r<   z#AsyncVideos.with_streaming_response  s     055r8   Nr=   c       	        >  K   t        |||||d      }
t        t        t        t        t
        f   |
      dgg      }|r
ddi|xs i }| j                  dt        |
t        j                         d{   |t        ||||	      t        	       d{   S 7 %7 w)
rG   rH   r>   rJ   rL   rM   rN   NrO   rP   )r   r   r   r   rU   rV   rW   r   r   rX   r+   r)   rY   s               r6   rZ   zAsyncVideos.create  s     J   #2"
 d73;#7>HYGZF[\ ,-B\}GZXZ\MZZ,T3F3X3XYY(+Q[el    
 
 	
Y
s$   A1B3B
4 BBBBr[   c       
           K   | j                  ||||||||	|
	       d{   }| j                  |j                  |       d{   S 7 )7 w)r^   r_   Nr`   ra   rd   s               r6   rf   zAsyncVideos.create_and_poll  sm     " kk+'#! " 

 

 YYHH-  
 
 	



s!   AA
$AAAAr`   c                 K   ddi}t        |      rt        |      |d<   	 | j                  j                  ||       d{   }|j	                         }|j
                  dk(  s|j
                  dk(  rSt        |      s+|j                  j                  d      }|t        |      }nd	}| j                  |d	z         d{    n>|j
                  d
k(  s|j
                  dk(  r|S t        rt        |j
                         n|S 7 7 Fw)rh   ri   rj   rk   rl   Nrm   rn   ro   rp   rq   rr   rs   r{   s          r6   rb   zAsyncVideos.poll  s	     $=f"E$%:=>N:OG67!33<<% =  H
 NN$E||},0H 01"*"2"2"6"67M"NK".+.{+;(+/(kk"2T"9:::,0H  . L-  ;s%   ?D
DA?D
DAD
D
rO   c          	        K   |st        d|      | j                  d| t        ||||      t               d{   S 7 w)r   r   r   rO   r   Nr   r   s         r6   rt   zAsyncVideos.retrieve(  sb     . VW_VbcddYYxj!(+Q[el   
 
 	
 
   <AAAr   c                   | j                  dt        t           t        ||||t	        |||dt
        j                              t              S r   )r   r(   r)   r+   r   r   r   r   s           r6   r   zAsyncVideos.listI  sb    @ !!,U3(+'%%!&!&!&
 &55 # " 
 	
r8   c          	        K   |st        d|      | j                  d| t        ||||      t               d{   S 7 w)r   r   r   rO   r   Nr   r   s         r6   r   zAsyncVideos.delete}  sb     . VW_Vbcdd\\xj!(+Q[el ( " 
 
 	
 
r   r   c                 K   |st        d|      ddi|xs i }| j                  d| dt        ||||t        d|it        j
                         d{         t        j                  	       d{   S 7 %7 w)
r   r   r   r   r   r   r   Nr   r   )r   r   r+   r   r   r   r
   r   r   s          r6   r   zAsyncVideos.download_content  s     6 VW_Vbcdd!#7QM<ORQYYxj)(+'%1(*G*b*b  %??  
 
 	

s$   AA?A; A?6A=7A?=A?c          
        K   |st        d|      | j                  d| dt        d|it        j                         d{   t        ||||      t               d{   S 7 $7 w)r   r   r   r   rI   NrO   r   )r   rW   r   r   r   r+   r)   r   s          r6   r   zAsyncVideos.remix  s     4 VW_VbcddZZxj',h-?ASAdAdee(+Q[el    
 
 	
e
s$   A A+A'
A+"A)#A+)A+)r   r   )r   r   r   r   r   r   )r   r   r   r   r   r   rB   r   rC   r   rD   r   rE   r   r   z9AsyncPaginator[Video, AsyncConversationCursorPage[Video]]r   r   r   r   r   r8   r6   r/   r/     s+   0 0 6 6 -1#''+!% )-$("&;D<
 <
 *	<

 !<
 %<
 <
 &<
 "<
  <
 9<
 
<
D -1#''+!%'+ )-$("&;D 
  
 *	 

 ! 
 % 
  
 % 
 & 
 " 
   
 9 
 
 
L (,	%!%! %	%!
 
%!Z )-$("&;D

 &
 "
  
 9
 

H ! /3 )-$("&;D2
 2
 	2

 -2
 &2
 "2
  2
 92
 
C2
t )-$("&;D

 &
 "
  
 9
 

J HL )-$("&;D*
*
 E	*
 &*
 "*
  *
 9*
 
5*
f )-$("&;D#
#
 	#
 &#
 "#
  #
 9#
 
#
r8   c                      e Zd ZddZy)r3   c                   || _         t        j                  |j                        | _        t        j                  |j                        | _        t        j                  |j
                        | _        t        j                  |j                        | _        t        j                  |j                        | _        t        j                  |j                        | _        y N)	_videosr
   to_raw_response_wrapperrZ   rt   r   r   r   r   r5   videoss     r6   __init__zVideosWithRawResponse.__init__  s    &>>MM
 )@@OO
 %<<KK
	 '>>MM
 !1 H H##!
 &==LL

r8   Nr   r.   r   Noner   r   r   r   r   r8   r6   r3   r3         
r8   r3   c                      e Zd ZddZy)r   c                   || _         t        j                  |j                        | _        t        j                  |j                        | _        t        j                  |j
                        | _        t        j                  |j                        | _        t        j                  |j                        | _        t        j                  |j                        | _        y r   )	r   r
   async_to_raw_response_wrapperrZ   rt   r   r   r   r   r   s     r6   r   z#AsyncVideosWithRawResponse.__init__	  s    &DDMM
 )FFOO
 %BBKK
	 'DDMM
 !1 N N##!
 &CCLL

r8   Nr   r/   r   r   r   r   r8   r6   r   r     r   r8   r   c                      e Zd ZddZy)r;   c                T   || _         t        |j                        | _        t        |j                        | _        t        |j                        | _        t        |j
                        | _        t        |j                  t              | _        t        |j                        | _	        y r   )
r   r#   rZ   rt   r   r   r%   r   r!   r   r   s     r6   r   z$VideosWithStreamingResponse.__init__!  s    2MM
 5OO
 1KK
	 3MM
 !D##%!
 2LL

r8   Nr   r   r   r8   r6   r;   r;          
r8   r;   c                      e Zd ZddZy)r   c                T   || _         t        |j                        | _        t        |j                        | _        t        |j                        | _        t        |j
                        | _        t        |j                  t              | _        t        |j                        | _	        y r   )
r   r$   rZ   rt   r   r   r&   r   r"   r   r   s     r6   r   z)AsyncVideosWithStreamingResponse.__init__:  s    8MM
 ;OO
 7KK
	 9MM
 !J##*!
 8LL

r8   Nr   r   r   r8   r6   r   r   9  r   r8   r   )D
__future__r   typingr   r   r   typing_extensionsr   r   httpx r
   typesr   r   r   r   r   r   r   _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_modeltypes.video_secondstypes.video_delete_responser-   __all__r.   r/   r3   r   r;   r   r   r8   r6   <module>r      s    # / / 3     V U U \ \ % 9  Q  ? $ ( * . =]
#^
_ ^
B`
" `
F
 
0
 
0
 
2
 
r8   