o
    ,if                     @   s   d dl mZ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 d d	lmZ G d
d deZdS )    )ListOptional)Entity)ClientResult)ClientValueCollection)ServiceOperationQuery)
EntityType)SearchQuery)SearchRequest)SearchResponsec                   @   s2   e Zd ZdZdddZdd Zdd Zd	d
 ZdS )SearchEntityz
    A top level object representing the Microsoft Search API endpoint. It does not behave as any other resource
    in Graph, but serves as an anchor to the query action.
    Nc                    sl   t t||d}dtt |gi}t| jtt}t| dd|d|}dd   fdd}| j|| |S )	ao  
        Runs the query specified in the request body. Search results are provided in the response.

        :param str query_string: Contains the query terms.
        :param list[str] entity_types: One or more types of resources expected in the response.
            Possible values are: list, site, listItem, message, event, drive, driveItem, externalItem.
        )queryentity_typesrequestsr   Nc                 S   s   d S N )
search_hitr   r   P/var/www/html/corbot_env/lib/python3.10/site-packages/office365/search/entity.py
_patch_hit#   s   z&SearchEntity.query.<locals>._patch_hitc                    s0   | j D ]}|jD ]} fdd|jD  qqd S )Nc                    s   g | ]} |qS r   r   ).0hitr   r   r   
<listcomp>-   s    zASearchEntity.query.<locals>._process_response.<locals>.<listcomp>)valuehitsContainershits)resultitemhcsr   r   r   _process_response)   s
   

z-SearchEntity.query.<locals>._process_response)	r
   r	   r   r   contextr   r   	add_queryafter_query_execute)selfquery_stringr   search_requestpayloadreturn_typeqryr   r   r   r   r      s   	zSearchEntity.queryc                 C      | j |tjgdS )ztSearches Outlook messages. Alias to query method
        :param str query_string: Contains the query terms.
        r   )r   r   messager#   r$   r   r   r   query_messages2      zSearchEntity.query_messagesc                 C   r)   )z{Searches Outlook calendar events. Alias to query method
        :param str query_string: Contains the query terms.
        r*   )r   r   eventr,   r   r   r   query_events8   r.   zSearchEntity.query_eventsc                 C   r)   )zrSearches OneDrive items. Alias to query method
        :param str query_string: Contains the query terms.
        r*   )r   r   	driveItemr,   r   r   r   query_drive_items>   r.   zSearchEntity.query_drive_itemsr   )__name__
__module____qualname____doc__r   r-   r0   r2   r   r   r   r   r      s    
r   N)typingr   r   office365.entityr   office365.runtime.client_resultr   )office365.runtime.client_value_collectionr   +office365.runtime.queries.service_operationr   office365.search.entity_typer   office365.search.queryr	   office365.search.requestr
   office365.search.responser   r   r   r   r   r   <module>   s    