feat(search): add server-side search tools for products and customers (BLOCKER-1)

This commit is contained in:
Benju1
2025-12-05 03:11:45 +01:00
parent 809e8f0c59
commit 987424f6e3
2 changed files with 101 additions and 0 deletions

View File

@@ -272,6 +272,12 @@ class DolibarrClient:
# CUSTOMER/THIRD PARTY MANAGEMENT
# ============================================================================
async def search_customers(self, sqlfilters: str, limit: int = 20) -> List[Dict[str, Any]]:
"""Search customers using SQL filters."""
params = {"limit": limit, "sqlfilters": sqlfilters}
result = await self.request("GET", "thirdparties", params=params)
return result if isinstance(result, list) else []
async def get_customers(self, limit: int = 100, page: int = 1) -> List[Dict[str, Any]]:
"""Get list of customers/third parties."""
params = {"limit": limit}
@@ -330,6 +336,12 @@ class DolibarrClient:
# PRODUCT MANAGEMENT
# ============================================================================
async def search_products(self, sqlfilters: str, limit: int = 20) -> List[Dict[str, Any]]:
"""Search products using SQL filters."""
params = {"limit": limit, "sqlfilters": sqlfilters}
result = await self.request("GET", "products", params=params)
return result if isinstance(result, list) else []
async def get_products(self, limit: int = 100) -> List[Dict[str, Any]]:
"""Get list of products."""
params = {"limit": limit}