feat: replace script args with typed named parameters
- Change execute_script API from positional args list to named params dict - Update service schema, API client, and constants - Add execute_script service documentation to README
This commit is contained in:
@@ -287,19 +287,21 @@ class MediaServerClient:
|
||||
return await self._request("GET", API_SCRIPTS_LIST)
|
||||
|
||||
async def execute_script(
|
||||
self, script_name: str, args: list[str] | None = None
|
||||
self,
|
||||
script_name: str,
|
||||
params: dict[str, str | int | float | bool] | None = None,
|
||||
) -> dict[str, Any]:
|
||||
"""Execute a script on the server.
|
||||
|
||||
Args:
|
||||
script_name: Name of the script to execute
|
||||
args: Optional list of arguments to pass to the script
|
||||
params: Optional named parameters (validated against script schema)
|
||||
|
||||
Returns:
|
||||
Execution result with success, exit_code, stdout, stderr
|
||||
"""
|
||||
endpoint = f"{API_SCRIPTS_EXECUTE}/{script_name}"
|
||||
json_data = {"args": args or []}
|
||||
json_data = {"params": params or {}}
|
||||
return await self._request("POST", endpoint, json_data)
|
||||
|
||||
async def get_media_folders(self) -> dict[str, dict[str, Any]]:
|
||||
|
||||
Reference in New Issue
Block a user