Skip to content

Commit

Permalink
add endpoint descriptions
Browse files Browse the repository at this point in the history
  • Loading branch information
dni committed Apr 16, 2024
1 parent 19a53e1 commit 3171d04
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
6 changes: 4 additions & 2 deletions views.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@
from lnbits.decorators import check_user_exists
from lnbits.helpers import template_renderer

example_ext_generic = APIRouter()
example_ext_generic = APIRouter(tags=["example"])


@example_ext_generic.get("/", response_class=HTMLResponse)
@example_ext_generic.get(
"/", description="Example generic endpoint", response_class=HTMLResponse
)
async def index(
request: Request,
user: User = Depends(check_user_exists),
Expand Down
11 changes: 7 additions & 4 deletions views_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,13 @@

# views_api.py is for you API endpoints that could be hit by another service

example_ext_api = APIRouter()
example_ext_api = APIRouter(
prefix="/api/v1",
tags=["example"],
)


@example_ext_api.get("/api/v1/test/{test_data}")
async def api_example(test_data: str) -> Example:
@example_ext_api.get("/{example_data}", description="Example API endpoint")
async def api_example(example_data: str) -> Example:
# Do some python things and return the data
return Example(id="1", wallet=test_data)
return Example(id="1", wallet=example_data)

0 comments on commit 3171d04

Please sign in to comment.