Update code in endpoints/button.get.py

This commit is contained in:
Backend IM Bot 2025-03-21 18:53:09 +00:00
parent 48c1e2db47
commit 84cf1ee079

View File

@ -1,23 +1,21 @@
from fastapi import APIRouter, HTTPException from fastapi import APIRouter, HTTPException
from fastapi.responses import JSONResponse from fastapi.requests import Request
router = APIRouter() router = APIRouter()
buttons = [] # In-memory storage
@router.get("/button") @router.get("/button")
async def get_button(): async def button_demo(request: Request):
"""Demo button endpoint""" """Demo button endpoint"""
if request.method != "GET":
raise HTTPException(status_code=405, detail="Method not allowed")
return { return {
"message": "Button retrieved successfully", "message": "Button clicked successfully",
"button": { "method": "GET",
"id": "btn_123", "_verb": "get",
"label": "Click Me", "status": "active",
"color": "blue",
"enabled": True
},
"features": { "features": {
"clickable": True, "enabled": True,
"visible": True "click_count": 1
} }
} }