Search catalogs for integrations matching the given filters.
(
self,
query: Optional[str] = None,
tag: Optional[str] = None,
author: Optional[str] = None,
)
| 262 | # -- Search / info ---------------------------------------------------- |
| 263 | |
| 264 | def search( |
| 265 | self, |
| 266 | query: Optional[str] = None, |
| 267 | tag: Optional[str] = None, |
| 268 | author: Optional[str] = None, |
| 269 | ) -> List[Dict[str, Any]]: |
| 270 | """Search catalogs for integrations matching the given filters.""" |
| 271 | results: List[Dict[str, Any]] = [] |
| 272 | for item in self._get_merged_integrations(): |
| 273 | author_val = item.get("author", "") |
| 274 | if not isinstance(author_val, str): |
| 275 | author_val = str(author_val) if author_val is not None else "" |
| 276 | if author and author_val.lower() != author.lower(): |
| 277 | continue |
| 278 | if tag: |
| 279 | raw_tags = item.get("tags", []) |
| 280 | tags_list = raw_tags if isinstance(raw_tags, list) else [] |
| 281 | if tag.lower() not in [t.lower() for t in tags_list if isinstance(t, str)]: |
| 282 | continue |
| 283 | if query: |
| 284 | raw_tags = item.get("tags", []) |
| 285 | tags_list = raw_tags if isinstance(raw_tags, list) else [] |
| 286 | name_val = item.get("name", "") |
| 287 | desc_val = item.get("description", "") |
| 288 | id_val = item.get("id", "") |
| 289 | haystack = " ".join( |
| 290 | [ |
| 291 | str(name_val) if name_val else "", |
| 292 | str(desc_val) if desc_val else "", |
| 293 | str(id_val) if id_val else "", |
| 294 | ] |
| 295 | + [t for t in tags_list if isinstance(t, str)] |
| 296 | ).lower() |
| 297 | if query.lower() not in haystack: |
| 298 | continue |
| 299 | results.append(item) |
| 300 | return results |
| 301 | |
| 302 | def get_integration_info( |
| 303 | self, integration_id: str |