Skip to content

Commit 4ca90c0

Browse files
committed
Add full NewsAPI integration support for Researcher.
Cover the full NewsAPI v2 surface, register the provider for bot installs, and accept the nested params payload Researcher sends so live calls reach the provider correctly.
1 parent e730f17 commit 4ca90c0

2 files changed

Lines changed: 291 additions & 102 deletions

File tree

flexus_client_kit/ckit_integrations_db.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -288,6 +288,32 @@ def _setup_erp(obj, rcx, _tam=tools_and_methods):
288288
integr_need_mongo=True,
289289
))
290290

291+
elif name == "newsapi":
292+
from flexus_client_kit.integrations import fi_newsapi
293+
newsapi_tool = ckit_cloudtool.CloudTool(
294+
strict=True,
295+
name=fi_newsapi.PROVIDER_NAME,
296+
description=f"{fi_newsapi.PROVIDER_NAME}: data provider. op=help|status|list_methods|call",
297+
parameters={
298+
"type": "object",
299+
"properties": {
300+
"op": {"type": "string", "enum": ["help", "status", "list_methods", "call"]},
301+
"args": {"type": ["object", "null"]},
302+
},
303+
"required": ["op", "args"],
304+
"additionalProperties": False,
305+
},
306+
)
307+
async def _init_newsapi(rcx, setup):
308+
return fi_newsapi.IntegrationNewsapi(rcx)
309+
result.append(IntegrationRecord(
310+
integr_name=fi_newsapi.PROVIDER_NAME,
311+
integr_tools=[newsapi_tool],
312+
integr_init=_init_newsapi,
313+
integr_setup_handlers=lambda obj, rcx, _t=newsapi_tool: [rcx.on_tool_call(_t.name)(obj.called_by_model)],
314+
integr_provider=fi_newsapi.PROVIDER_NAME,
315+
))
316+
291317
else:
292318
# Generic handler for any fi_{name}.py integration that follows the standard pattern.
293319
# Avoids writing an explicit elif branch for every one of the 70+ API providers.

0 commit comments

Comments
 (0)