feat(swagger): Add Swagger API reference, and fixes #28

Merged
Gandalf merged 28 commits from develop into main 2026-05-21 20:14:36 +01:00
3 changed files with 47 additions and 3 deletions
Showing only changes of commit 4941b69924 - Show all commits
+4 -2
View File
@@ -93,7 +93,7 @@ function buildMetadataMaps(snapshot) {
* schema:
* type: boolean
* default: false
* description: Admin-only: show all users' downloads
* description: 'Admin-only: show all users'' downloads'
* responses:
* '200':
* description: User downloads
@@ -363,6 +363,8 @@ router.get('/cover-art', requireAuth, async (req, res) => {
* console.log('Downloads:', data.downloads);
* };
* ```
*
* **x-integration-notes:** This endpoint uses Server-Sent Events (SSE) for real-time updates. No CSRF token required since it's a GET request.
* security:
* - CookieAuth: []
* parameters:
@@ -371,7 +373,7 @@ router.get('/cover-art', requireAuth, async (req, res) => {
* schema:
* type: boolean
* default: false
* description: Admin-only: show all users' downloads
* description: 'Admin-only: show all users'' downloads'
* responses:
* '200':
* description: SSE stream established
+42
View File
@@ -65,6 +65,48 @@ router.get('/users', async (req, res) => {
}
});
/**
* @openapi
* /api/emby/users/{id}:
* get:
* tags: [Emby]
* summary: Get user by ID
* description: Get details for a specific Emby user by ID. Requires authentication.
* security:
* - CookieAuth: []
* parameters:
* - name: id
* in: path
* required: true
* schema:
* type: string
* description: Emby user ID
* responses:
* '200':
* description: User data from Emby
* content:
* application/json:
* schema:
* type: object
* '500':
* description: Failed to fetch user from Emby
* content:
* application/json:
* schema:
* $ref: '#/components/schemas/ErrorResponse'
*/
// GET /api/emby/users/:id - get individual user by ID
router.get('/users/:id', async (req, res) => {
try {
const response = await axios.get(`${process.env.EMBY_URL}/Users/${req.params.id}`, {
headers: { 'X-MediaBrowser-Token': process.env.EMBY_API_KEY }
});
res.json(response.data);
} catch (error) {
res.status(500).json({ error: 'Failed to fetch user', details: sanitizeError(error) });
}
});
/**
* @openapi
* /api/emby/session/{sessionId}/user:
+1 -1
View File
@@ -256,7 +256,7 @@ function getRadarrLink(movie) {
* schema:
* type: boolean
* default: false
* description: Admin-only: show all users' history
* description: 'Admin-only: show all users'' history'
* responses:
* '200':
* description: History items