Skip to content

Commit

Permalink
🧩 /doc endpoint added
Browse files Browse the repository at this point in the history
  • Loading branch information
Your Name committed Mar 22, 2024
1 parent b47db33 commit 9d1819c
Showing 1 changed file with 42 additions and 1 deletion.
43 changes: 42 additions & 1 deletion src/index.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import uvicorn
from dotenv import load_dotenv
from fastapi import FastAPI, HTTPException, Query
from fastapi.responses import FileResponse
from fastapi.responses import FileResponse, HTMLResponse

app = FastAPI(title="HiFi-RestAPI", version="v1.0")

Expand Down Expand Up @@ -223,6 +223,47 @@ async def get_track(
)


@app.api_route("/doc", methods=["GET"])
async def doc():
return HTMLResponse(
"""
<!doctype html>
<html>
<head>
<title>API Reference</title>
<meta charset="utf-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
</head>
<body>
<!-- Add your own OpenAPI/Swagger spec file URL here: -->
<!-- Note: this includes our proxy, you can remove the following line if you do not need it -->
<!-- data-proxy-url="https://api.scalar.com/request-proxy" -->
<script
id="api-reference"
type="application/json"
data-url="https://tidal.401658.xyz/openapi.json"
data-proxy-url="https://api.scalar.com/request-proxy"
></script>
<!-- You can also set a full configuration object like this -->
<!-- easier for nested objects -->
<script>
var configuration = {
theme: "purple",
};
var apiReference = document.getElementById("api-reference");
apiReference.dataset.configuration = JSON.stringify(configuration);
</script>
<script src="https://cdn.jsdelivr.net/npm/@scalar/api-reference"></script>
</body>
</html>
"""
)


@app.api_route("/song/", methods=["GET"])
async def get_song(q: str, quality: str):
try:
Expand Down

1 comment on commit 9d1819c

@vercel
Copy link

@vercel vercel bot commented on 9d1819c Mar 22, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.