# Copyright (c) 2025, JINGROW and contributors
# For license information, please see license.txt

"""
Search whitelist functions - Forward to SaaS using unified HTTP client
"""

import jingrow
import logging
from jingrow.utils.auth import saas_post

logger = logging.getLogger(__name__)


@jingrow.whitelist()
def search_link(**kwargs):
    """Search link - Forward to SaaS"""
    resp = saas_post('/api/action/jingrow.desk.search.search_link', json=kwargs)
    if resp.status_code == 200:
        return resp.json().get("message", [])
    logger.error(f"[search_link] SaaS error: {resp.status_code}")
    return []
