Update code in endpoints/button.get.py
This commit is contained in:
parent
48c1e2db47
commit
84cf1ee079
@ -1,23 +1,21 @@
|
||||
from fastapi import APIRouter, HTTPException
|
||||
from fastapi.responses import JSONResponse
|
||||
from fastapi.requests import Request
|
||||
|
||||
router = APIRouter()
|
||||
|
||||
buttons = [] # In-memory storage
|
||||
|
||||
@router.get("/button")
|
||||
async def get_button():
|
||||
async def button_demo(request: Request):
|
||||
"""Demo button endpoint"""
|
||||
if request.method != "GET":
|
||||
raise HTTPException(status_code=405, detail="Method not allowed")
|
||||
|
||||
return {
|
||||
"message": "Button retrieved successfully",
|
||||
"button": {
|
||||
"id": "btn_123",
|
||||
"label": "Click Me",
|
||||
"color": "blue",
|
||||
"enabled": True
|
||||
},
|
||||
"message": "Button clicked successfully",
|
||||
"method": "GET",
|
||||
"_verb": "get",
|
||||
"status": "active",
|
||||
"features": {
|
||||
"clickable": True,
|
||||
"visible": True
|
||||
"enabled": True,
|
||||
"click_count": 1
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user