
    bf                     R    d dl mZ d dlmZ d dlmZ d dlmZ  G d de          ZdS )   )_DICT_VERSION_SEARCHRESULT)MastodonVersionError)api_version)Mastodonc                       e Zd Zd Z edde          dd            Z eddd          dd	            Z ed
de          dd            ZdS )r   c                     t          d ||||fD                       r&|                     dd          st          d          dS dS )z
        Internal Helper: Throw a MastodonVersionError if version is < 2.8.0 but parameters
        for search that are available only starting with 2.8.0 are specified.
        c              3      K   | ]}|d uV  	d S )N ).0items     ]/home/feoh/.local/pipx/venvs/mastodon-archive/lib/python3.11/site-packages/mastodon/search.py	<genexpr>z=Mastodon.__ensure_search_params_acceptable.<locals>.<genexpr>   s'      QQDt4QQQQQQ    2.8.0Tcachedz2Advanced search parameters require Mastodon 2.8.0+N)anyverify_minimum_versionr   )self
account_idoffsetmin_idmax_ids        r   !__ensure_search_params_acceptablez*Mastodon.__ensure_search_params_acceptable   sp    
 QQZ,PQQQQQ 	a..wt.DD a*+_```	a 	aa ar   z1.1.0r   TNc	           
          |                      dd          r|                     ||||||||          S |                     ||||           |                     ||          S )a  
        Fetch matching hashtags, accounts and statuses. Will perform webfinger
        lookups if resolve is True. Full-text search is only enabled if
        the instance supports it, and is restricted to statuses the logged-in
        user wrote or was mentioned in.

        `result_type` can be one of "accounts", "hashtags" or "statuses", to only
        search for that type of object.

        Specify `account_id` to only get results from the account with that id.

        `offset`, `min_id` and `max_id` can be used to paginate.

        `exclude_unreviewed` can be used to restrict search results for hashtags to only
        those that have been reviewed by moderators. It is on by default. When using the
        v1 search API (pre 2.4.1), it is ignored.

        Will use search_v1 (no tag dicts in return values) on Mastodon versions before
        2.4.1), search_v2 otherwise. Parameters other than resolve are only available
        on Mastodon 2.8.0 or above - this function will throw a MastodonVersionError
        if you try to use them on versions before that. Note that the cached version
        number will be used for this to avoid uneccesary requests.

        Returns a :ref:`search result dict <search result dict>`, with tags as `hashtag dicts`_.
        2.4.1Tr   )resolveresult_typer   r   r   r   exclude_unreviewed)r   )r   	search_v2*_Mastodon__ensure_search_params_acceptable	search_v1)	r   qr   r   r   r   r   r   r   s	            r   searchzMastodon.search   s    6 &&wt&<< 	6>>!W+Zdms  }C  LR  gy>  z  z  z22:vvvVVV>>!W>555r   z2.1.0Fc                 |    |                      t                                }|s|d= |                     dd|          S )z
        Identical to `search_v2()`, except in that it does not return
        tags as :ref:`hashtag dicts <hashtag dicts>`.

        Returns a :ref:`search result dict <search result dict>`.
        r   GETz/api/v1/search)_Mastodon__generate_paramslocals_Mastodon__api_request)r   r#   r   paramss       r   r"   zMastodon.search_v18   sD     ''11 	"y!!!%)96BBBr   r   c	                    |                      ||||           |                     t                                }	|s|	d= |r|                     dd          s|	d= d|	v r|	d         |	d<   |	d= |                     dd	|	          S )
a-  
        Identical to `search_v1()`, except in that it returns tags as
        :ref:`hashtag dicts <hashtag dicts>`, has more parameters, and resolves by default.

        For more details documentation, please see `search()`

        Returns a :ref:`search result dict <search result dict>`.
        r   z3.0.0Tr   r   r   typer&   z/api/v2/search)r!   r'   r(   r   r)   )
r   r#   r   r   r   r   r   r   r   r*   s
             r   r    zMastodon.search_v2E   s     	..z666RRR''11 	"y!! 	-)D)DWUY)D)Z)Z 	-+,F""#M2F6N}%!!%)96BBBr   )TNNNNNT)F)	__name__
__module____qualname__r!   r   r   r$   r"   r    r
   r   r   r   r   
   s        a a a ['#=>>6 6 6 ?>6@ ['7++
C 
C 
C ,+
C ['#=>>C C C ?>C C Cr   r   N)	versionsr   errorsr   utilityr   	internalsr   	Internalsr
   r   r   <module>r5      s    1 0 0 0 0 0 ( ( ( ( ( (             , , , , , ,RC RC RC RC RCy RC RC RC RC RCr   