"""
Search API namespace.

AUTO-GENERATED by scripts/generate_sdk.py - DO NOT EDIT MANUALLY!
Regenerate with: python scripts/generate_sdk.py --category search
"""
from __future__ import annotations

from typing import Any, Dict, Optional

from ._base import AsyncBaseAPI, BaseAPI


class SearchAPI(BaseAPI):
    """Search namespace: global_search."""

    def global_search(
        self,
        *,
        query: str,
        limit: Optional[int] = 20,
        options: Optional[Dict[str, Any]] = None,
        context: Optional[Dict[str, Any]] = None,
    ) -> Any:
        """Global search

        Search across securities, news, and publications.

        Args:
        query: Search query
        limit: Maximum results"""
        params: Dict[str, Any] = {}
        params["query"] = query
        if limit is not None:
            params["limit"] = limit
        return self._call("search.global", params=params, options=options, context=context)



class AsyncSearchAPI(AsyncBaseAPI):
    """Search namespace: global_search."""

    async def global_search(
        self,
        *,
        query: str,
        limit: Optional[int] = 20,
        options: Optional[Dict[str, Any]] = None,
        context: Optional[Dict[str, Any]] = None,
    ) -> Any:
        """Global search

        Search across securities, news, and publications.

        Args:
        query: Search query
        limit: Maximum results"""
        params: Dict[str, Any] = {}
        params["query"] = query
        if limit is not None:
            params["limit"] = limit
        return await self._call("search.global", params=params, options=options, context=context)


