o
    ùT·jGç  ã                   @  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% 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 )$é    )Ú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)Ú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                   @  ó¼  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¡eeeeed	d	d	e	d œ	dTd#d$„ƒZe d¡ed%œdUd'd(„ƒZe d¡d	d	d	e	d)œdVd*d+„ƒZe d¡eeed	d	d	e	d,œdWd3d4„ƒZe d¡d	d	d	e	d)œdXd6d7„ƒZe d¡d	d	d	e	d)œdYd<d=„ƒZe d¡ed	d	d	e	d>œdZdBdC„ƒZe d¡d	d	d	e	d)œd[dEdF„ƒZe d¡d	d	d	e	d)œd\dIdJ„ƒZe d¡d	d	d	e	d)œd]dMdN„ƒZe d¡d	d	d	e	d)œ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<   úZ/home/dinkstrade/pdmp-scanner/venv/lib/python3.10/site-packages/openai/resources/videos.pyÚwith_raw_response3   ó   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=   ÚcreateF   s0   (ûø

ûõzVideos.create©	rF   rG   rH   rI   Úpoll_interval_msrJ   rK   rL   rM   rm   ú
int | Omitc       
         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   ©rm   ©rk   ÚpollÚid©r;   rN   rF   rG   rH   rI   rm   rJ   rK   rL   rM   Úvideor<   r<   r=   Úcreate_and_poll‹   s   ÷þzVideos.create_and_pollrq   Ú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©rJ   Úin_progressÚqueuedúopenai-poll-after-msNéè  Ú	completedÚfailed©r.   rO   r>   ÚretrieveÚparseÚstatusÚheadersÚgetÚintÚ_sleepr   r   ©r;   rx   rm   rˆ   Úresponserv   Úfrom_headerr<   r<   r=   rs   ®   s,   þ
êzVideos.poll©rJ   rK   rL   rM   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}©rx   r_   Tr`   ©re   rf   ©Ú
ValueErrorÚ_getr   r-   r+   ©r;   rx   rJ   rK   rL   rM   r<   r<   r=   r…   Ö   ó   
û÷zVideos.retrieve©ÚafterÚlimitÚorderrJ   rK   rL   rM   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©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  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=   Údelete2  rš   zVideos.deleteÚnamerv   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°   rv   rv   rZ   r\   r]   ú/videos/charactersr_   Tr`   rb   )r   r   r   r   rO   rg   rh   r   r   ÚVideoCreateCharacterParamsr-   r2   ©	r;   r°   rv   rJ   rK   rL   rM   rc   rd   r<   r<   r=   Úcreate_characterX  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
        r’   ÚAcceptúapplication/binaryú/videos/{video_id}/contentr”   r¹   r_   Tr¤   r•   )	r—   r˜   r   r-   r   r   ÚVideoDownloadContentParamsr	   ÚHttpxBinaryResponseContent©r;   rx   r¹   rJ   rK   rL   rM   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
        ©rN   rv   rv   rZ   r\   r]   ú/videos/editsr_   Tr`   rb   )r   r   r   r   rO   rg   rh   r   r   ÚVideoEditParamsr-   r+   ©	r;   rN   rv   rJ   rK   rL   rM   rc   rd   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
        ©rN   rH   rv   rv   rZ   r\   r]   ú/videos/extensionsr_   Tr`   rb   )r   r   r   r   rO   rg   rh   r   r   ÚVideoExtendParamsr-   r+   ©
r;   rN   rH   rv   rJ   rK   rL   rM   rc   rd   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Ò   rJ   rK   rL   rM   r<   r<   r=   Úget_character0  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”   rN   r_   Tr`   ©rc   re   rf   )r—   rh   r   r   r   ÚVideoRemixParamsr-   r+   ©r;   rx   rN   rJ   rK   rL   rM   r<   r<   r=   ÚremixV  s   
ûözVideos.remix)r6   r7   )r6   r@   ©rN   rO   rF   rP   rG   rQ   rH   rR   rI   rS   rJ   rT   rK   rU   rL   rV   rM   rW   r6   r+   ©rN   rO   rF   rP   rG   rQ   rH   rR   rI   rS   rm   rn   rJ   rT   rK   rU   rL   rV   rM   rW   r6   r+   ©rx   rO   rm   rn   r6   r+   ©rx   rO   rJ   rT   rK   rU   rL   rV   rM   rW   r6   r+   )rœ   rŸ   r�   rn   rž   r    rJ   rT   rK   rU   rL   rV   rM   rW   r6   r¡   ©rx   rO   rJ   rT   rK   rU   rL   rV   rM   rW   r6   r0   ©r°   rO   rv   r   rJ   rT   rK   rU   rL   rV   rM   rW   r6   r2   ©rx   rO   r¹   rº   rJ   rT   rK   rU   rL   rV   rM   rW   r6   r»   ©rN   rO   rv   rÄ   rJ   rT   rK   rU   rL   rV   rM   rW   r6   r+   ©rN   rO   rH   r   rv   rË   rJ   rT   rK   rU   rL   rV   rM   rW   r6   r+   ©rÒ   rO   rJ   rT   rK   rU   rL   rV   rM   rW   r6   r1   ©rx   rO   rN   rO   rJ   rT   rK   rU   rL   rV   rM   rW   r6   r+   ©Ú__name__Ú
__module__Ú__qualname__r    r>   rB   Útyping_extensionsÚ
deprecatedr   r   rk   rw   rs   r…   rª   r¯   r·   rÃ   rÊ   rÑ   rÙ   rß   r<   r<   r<   r=   r3   2   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   rn   c       
         Ã  s:   �| j ||||||||	|
d�	I dH }| j|j|d�I dH S )ro   rp   Nrq   rr   ru   r<   r<   r=   rw   Ú  s    €÷þzAsyncVideos.create_and_pollrq   rx   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)ry   rz   r{   r|   Tr}   Nr~   r   r€   r�   r‚   rƒ   r„   rŒ   r<   r<   r=   rs   ý  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ª   K  r«   zAsyncVideos.listr0   c             	   Ã  ró   )	r¬   r’   r“   r”   r_   Tr`   r•   Nr­   r™   r<   r<   r=   r¯   �  rô   zAsyncVideos.deleter°   rv   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³   rv   rZ   r\   r]   r´   Nr_   Tr`   rb   )r   r   r   r   rO   rg   rh   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Æ   rv   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Í   rv   rZ   r\   r]   rÎ   Nr_   Tr`   rb   )r   r   r   r   rO   rg   rh   r   r   rÏ   r-   r+   rÐ   r<   r<   r=   rÑ   E  s.   €!ýúûõzAsyncVideos.extendrÒ   r1   c             	   Ã  ró   )	rÓ   rÔ   rÕ   rÖ   r_   Tr`   r•   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Ú   r’   rÛ   r”   rN   Nr_   Tr`   rÜ   )r—   rh   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�   rn   rž   r    rJ   rT   rK   rU   rL   rV   rM   rW   r6   rõ   rä   rå   ræ   rç   rè   ré   rê   rë   r<   r<   r<   r=   r4   �  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	   Úto_raw_response_wrapperrk   r…   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	   Úasync_to_raw_response_wrapperrk   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%   rk   r…   rª   r¯   r·   r'   rÃ   r#   rÊ   rÑ   rÙ   rß   rþ   r<   r<   r=   rÿ   C  óT   ÿÿÿÿÿÿÿÿÿÿþÿÿÿÿÿÿÿÿÿz$VideosWithStreamingResponse.__init__Nr  r  r<   r<   r<   r=   r@   B  r  r@   c                   @  r÷   )	rò   rø   r4   r6   rù   c                 C  r  rû   )rü   r&   rk   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   rï   Útypingr   r   r   r   r   Úhttpx2Ú 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>   sL   ,(     S    U889