o
    e                     @   s   d Z ddlZddlZddl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 ddlmZ dd	lmZ dd
lmZ eeZG dd de
ZdS )z.
This module provides a client class for MVS.
    N)str)bytes)bce_v1_signer)BceBaseClient)bce_http_client)handler)http_methods)requiredc                   @   s   e Zd ZdZdddZeeefddddZeeefdddd	Z	eeefddd
dZ
eeefddddZedd Z			dddZdS )	MvsClientz
    mvs client
    Nc                 C   s   t | | dS )initN)r   __init__)selfconfig r   PD:\Projects\ConvertPro\env\Lib\site-packages\baidubce/services/mvs/mvs_client.pyr   )   s   zMvsClient.__init__)sourcec                 C   sD   ||d}|dur||d< | j tjtd| ddit||dS )at  
        insert a video.
        :param video_lib: video lib
        :type video_lib: string
        :param source: video source
        :type source: string
        :param notification: notification name
        :type notification: string
        :param description: description for this request
        :type description: string
        :return: **BceResponse**
        r   notificationNdescription/v2/videolib/   Content-Type   application/jsonheadersbodyr   _send_requestr   PUTr   encodejsondumpsr   Z	video_libr   r   r   r   r   r   r   r   insert_video-   s   zMvsClient.insert_videoc                 C   sJ   ||d}|dur||d< | j tjtd| ddiddit||d	S )
a{  
        search video by video.
        :param video_lib: video lib
        :type video_lib: string
        :param source: video source
        :type source: string
        :param notification: notification name
        :type notification: string
        :param description: description for this request
        :type description: string
        :return: **BceResponse**
        r   Nr   r   r   r   s   searchByVideo    r   paramsr   r   r   r   POSTr   r   r   r    r!   r   r   r   search_video_by_videoF   s   zMvsClient.search_video_by_videoc                 C   sB   d|i}|dur||d< | j tjtd| ddit||dS )a#  
        insert an image.
        :param image_lib: image lib
        :type image_lib: string
        :param source: video source
        :type source: string
        :param description: description for this request
        :type description: string
        :return: **BceResponse**
        r   Nr   /v2/imagelib/r   r   r   r   r   Z	image_libr   r   r   r   r   r   r   insert_image`   s   zMvsClient.insert_imagec                 C   sH   d|i}|dur||d< | j tjtd| ddiddit||d	S )
a)  
        search video by video.
        :param video_lib: video lib
        :type video_lib: string
        :param source: video source
        :type source: string
        :param description: description for this request
        :type description: string
        :return: **BceResponse**
        r   Nr   r)   r   r   s   searchByImager#   r$   r&   r*   r   r   r   search_image_by_imagev   s   zMvsClient.search_image_by_imagec                 C   s(   |d u r| j S t| j }|| |S N)r   copyZmerge_non_none_values)r   r   Z
new_configr   r   r   _merge_config   s
   
zMvsClient._merge_configc              
   C   s:   |  | |}|d u rtj}t|tjtj|g|||||S r-   )r/   r   Z
parse_jsonr   send_requestr   signZparse_error)r   Zhttp_methodpathr   r   r%   r   Zbody_parserr   r   r   r      s   
zMvsClient._send_requestr-   )NN)NNNNN)__name__
__module____qualname____doc__r   r	   r   r   r"   r(   r+   r,   staticmethodr/   r   r   r   r   r   r
   %   s"    


r
   )r6   r.   r   loggingbuiltinsr   r   Zbaidubce.authr   Zbaidubce.bce_base_clientr   Zbaidubce.httpr   r   r   Zbaidubce.utilsr	   	getLoggerr3   Z_loggerr
   r   r   r   r   <module>   s   
