update bus mode PATCH endpoint

accepting {mode: value} is a little redundant but I prefer it to modifying the bus endpoint.

added bus mode PATCH example to README

patch bump
This commit is contained in:
2026-04-05 02:26:26 +01:00
parent 6d01b8d2d3
commit a82cbd2bc6
4 changed files with 16 additions and 4 deletions

View File

@@ -1,6 +1,6 @@
"""module for bus mode related endpoints."""
from fastapi import APIRouter, Depends, HTTPException
from fastapi import APIRouter, Body, Depends, HTTPException
from vmr_http.dependencies import get_voicemeeter_client
@@ -25,7 +25,7 @@ _reversed_busmodes = {v: k for k, v in _readable_busmodes.items()}
@router.patch('/{index}/mode')
@router.put('/{index}/mode')
async def update_bus_mode(index: int, mode: str, voicemeeter=Depends(get_voicemeeter_client)):
async def update_bus_mode(index: int, mode: str = Body(..., embed=True), voicemeeter=Depends(get_voicemeeter_client)):
"""Update the bus mode for the specified bus index."""
if mode not in _reversed_busmodes:
raise HTTPException(