mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2026-07-11 20:01:38 +00:00
First draft for user / login and logout
This commit is contained in:
parent
ee53086444
commit
15136e2562
5 changed files with 274 additions and 0 deletions
73
docs/controllers/AuthController.yaml
Normal file
73
docs/controllers/AuthController.yaml
Normal file
|
|
@ -0,0 +1,73 @@
|
||||||
|
paths:
|
||||||
|
/login:
|
||||||
|
post:
|
||||||
|
summary: Login to the server
|
||||||
|
description: Logs in a client to the server, returning information about the user and server.
|
||||||
|
requestBody:
|
||||||
|
required: true
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
username:
|
||||||
|
$ref: '../objects/entities/User.yaml#/components/schemas/username'
|
||||||
|
password:
|
||||||
|
$ref: '../objects/entities/User.yaml#/components/schemas/password'
|
||||||
|
required:
|
||||||
|
- username
|
||||||
|
- password
|
||||||
|
responses:
|
||||||
|
'200':
|
||||||
|
description: Success
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
user:
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
$ref: '../objects/entities/User.yaml#/components/schemas/user'
|
||||||
|
'401':
|
||||||
|
description: Unauthorized - Invalid username or password.
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
message:
|
||||||
|
type: string
|
||||||
|
/logout:
|
||||||
|
post:
|
||||||
|
summary: Logout from the server
|
||||||
|
description: Logs out a client from the server. If the socketId parameter is provided, the server removes the socket from the client list.
|
||||||
|
requestBody:
|
||||||
|
required: true
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
socketId:
|
||||||
|
$ref: '../objects/entities/User.yaml#/components/schemas/socketId'
|
||||||
|
responses:
|
||||||
|
'200':
|
||||||
|
description: Success
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
message:
|
||||||
|
type: string
|
||||||
|
example: Successfully logged out.
|
||||||
|
'401':
|
||||||
|
description: Unauthorized
|
||||||
|
content:
|
||||||
|
application/json:
|
||||||
|
schema:
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
message:
|
||||||
|
type: string
|
||||||
18
docs/objects/Bookmarks.yaml
Normal file
18
docs/objects/Bookmarks.yaml
Normal file
|
|
@ -0,0 +1,18 @@
|
||||||
|
components:
|
||||||
|
schemas:
|
||||||
|
time:
|
||||||
|
type: integer
|
||||||
|
description: The time (in ms since POSIX epoch) when the bookmark was created.
|
||||||
|
example: 1616239000
|
||||||
|
bookmark:
|
||||||
|
properties:
|
||||||
|
libraryItemId:
|
||||||
|
$ref: 'LibraryItem.yaml#/components/schemas/libraryItemId'
|
||||||
|
title:
|
||||||
|
type: string
|
||||||
|
description: The title of the bookmark.
|
||||||
|
example: Chapter 1
|
||||||
|
time:
|
||||||
|
$ref: '#/components/schemas/time'
|
||||||
|
createdAt:
|
||||||
|
$ref: '../schemas.yaml#/components/schemas/createdAt'
|
||||||
42
docs/objects/Media.yaml
Normal file
42
docs/objects/Media.yaml
Normal file
|
|
@ -0,0 +1,42 @@
|
||||||
|
components:
|
||||||
|
schemas:
|
||||||
|
mediaProgressId:
|
||||||
|
type: string
|
||||||
|
description: The ID of the media progress.
|
||||||
|
example: e4bb1afb-4a4f-4dd6-8be0-e615d233185b
|
||||||
|
format: uuid
|
||||||
|
mediaProgress:
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
id:
|
||||||
|
$ref: '#/components/schemas/mediaProgressId'
|
||||||
|
libraryItemId:
|
||||||
|
$ref: 'LibraryItem.yaml#/components/schemas/libraryItemId'
|
||||||
|
episodeId:
|
||||||
|
$ref: 'mediaTypes/Podcast.yaml#/components/schemas/podcastId'
|
||||||
|
duration:
|
||||||
|
$ref: '../schemas.yaml#/components/schemas/durationSec'
|
||||||
|
progress:
|
||||||
|
type: number
|
||||||
|
description: The user's progress in the media item.
|
||||||
|
example: 0.5
|
||||||
|
currentTime:
|
||||||
|
type: number
|
||||||
|
description: The user's current time in the media item.
|
||||||
|
example: 0.5
|
||||||
|
isFinished:
|
||||||
|
type: boolean
|
||||||
|
description: Whether the user has finished the media item.
|
||||||
|
example: false
|
||||||
|
hideFromContinueListening:
|
||||||
|
type: boolean
|
||||||
|
description: Whether the media item should be hidden from the continue listening section.
|
||||||
|
example: false
|
||||||
|
lastUpdate:
|
||||||
|
$ref: '../schemas.yaml#/components/schemas/updatedAt'
|
||||||
|
startedAt:
|
||||||
|
$ref: '../schemas.yaml#/components/schemas/createdAt'
|
||||||
|
finishedAt:
|
||||||
|
type: integer
|
||||||
|
description: The time (in ms since POSIX epoch) when the media was finished. Will be null if the media has is not finished.
|
||||||
|
example: 1616239000
|
||||||
55
docs/objects/Permissions.yaml
Normal file
55
docs/objects/Permissions.yaml
Normal file
|
|
@ -0,0 +1,55 @@
|
||||||
|
components:
|
||||||
|
schemas:
|
||||||
|
downloads:
|
||||||
|
type: boolean
|
||||||
|
description: Whether the user has permission to download media.
|
||||||
|
example: true
|
||||||
|
update:
|
||||||
|
type: boolean
|
||||||
|
description: Whether the user has permission to update media.
|
||||||
|
example: true
|
||||||
|
delete:
|
||||||
|
type: boolean
|
||||||
|
description: Whether the user has permission to delete media.
|
||||||
|
example: true
|
||||||
|
upload:
|
||||||
|
type: boolean
|
||||||
|
description: Whether the user has permission to upload media.
|
||||||
|
example: true
|
||||||
|
accessAllLibraries:
|
||||||
|
type: boolean
|
||||||
|
description: Whether the user has permission to access all libraries.
|
||||||
|
example: true
|
||||||
|
accessAllTags:
|
||||||
|
type: boolean
|
||||||
|
description: Whether the user has permission to access all tags.
|
||||||
|
example: true
|
||||||
|
accessExplicitContent:
|
||||||
|
type: boolean
|
||||||
|
description: Whether the user has permission to access explicit content.
|
||||||
|
example: true
|
||||||
|
permissions:
|
||||||
|
type: object
|
||||||
|
properties:
|
||||||
|
downloads:
|
||||||
|
$ref: '#/components/schemas/downloads'
|
||||||
|
update:
|
||||||
|
$ref: '#/components/schemas/update'
|
||||||
|
delete:
|
||||||
|
$ref: '#/components/schemas/delete'
|
||||||
|
upload:
|
||||||
|
$ref: '#/components/schemas/upload'
|
||||||
|
accessAllLibraries:
|
||||||
|
$ref: '#/components/schemas/accessAllLibraries'
|
||||||
|
accessAllTags:
|
||||||
|
$ref: '#/components/schemas/accessAllTags'
|
||||||
|
accessExplicitContent:
|
||||||
|
$ref: '#/components/schemas/accessExplicitContent'
|
||||||
|
required:
|
||||||
|
- downloads
|
||||||
|
- update
|
||||||
|
- delete
|
||||||
|
- upload
|
||||||
|
- accessAllLibraries
|
||||||
|
- accessAllTags
|
||||||
|
- accessExplicitContent
|
||||||
86
docs/objects/entities/User.yaml
Normal file
86
docs/objects/entities/User.yaml
Normal file
|
|
@ -0,0 +1,86 @@
|
||||||
|
components:
|
||||||
|
schemas:
|
||||||
|
username:
|
||||||
|
type: string
|
||||||
|
description: The username to log in with.
|
||||||
|
example: testuser
|
||||||
|
password:
|
||||||
|
type: string
|
||||||
|
description: The password of the user.
|
||||||
|
example: password
|
||||||
|
userId:
|
||||||
|
type: string
|
||||||
|
description: The ID of the user.
|
||||||
|
example: e4bb1afb-4a4f-4dd6-8be0-e615d233185b
|
||||||
|
format: uuid
|
||||||
|
userType:
|
||||||
|
type: string
|
||||||
|
description: The type of the user.
|
||||||
|
example: root
|
||||||
|
token:
|
||||||
|
type: string
|
||||||
|
description: The token of the user.
|
||||||
|
example: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VybmFtZSI6InRlc3R1c2VyIiwiaWF0IjoxNTE2MjM5MDIyfQ.4k1jJ9
|
||||||
|
socketId:
|
||||||
|
type: string
|
||||||
|
description: The socket ID of the user.
|
||||||
|
example: AFcTcb7xBLsSPnIzAAAV
|
||||||
|
isActive:
|
||||||
|
type: boolean
|
||||||
|
description: Whether the user is active.
|
||||||
|
example: true
|
||||||
|
isLocked:
|
||||||
|
type: boolean
|
||||||
|
description: Whether the user is locked.
|
||||||
|
example: false
|
||||||
|
lastSeen:
|
||||||
|
type: integer
|
||||||
|
description: The time (in ms since POSIX epoch) when the user was last seen.
|
||||||
|
example: 1616239000
|
||||||
|
user:
|
||||||
|
type: object
|
||||||
|
description: A user object which includes the user's ID, username, type, token, and media progress.
|
||||||
|
properties:
|
||||||
|
id:
|
||||||
|
$ref: '#/components/schemas/userId'
|
||||||
|
username:
|
||||||
|
$ref: '#/components/schemas/username'
|
||||||
|
type:
|
||||||
|
$ref: '#/components/schemas/userType'
|
||||||
|
token:
|
||||||
|
$ref: '#/components/schemas/token'
|
||||||
|
mediaProgress:
|
||||||
|
description: The user's progress of media.
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
$ref: '../Media.yaml#/components/schemas/mediaProgress'
|
||||||
|
seriesHideFromContinueListening:
|
||||||
|
description: The IDs of series to hide from the user's "Continue Series" shelf.
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
$ref: '../LibraryItem.yaml#/components/schemas/libraryItemId'
|
||||||
|
bookmarks:
|
||||||
|
description: The user's bookmarks.
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
$ref: '../Bookmarks.yaml#/components/schemas/bookmark'
|
||||||
|
lastSeen:
|
||||||
|
$ref: '#/components/schemas/lastSeen'
|
||||||
|
isActive:
|
||||||
|
$ref: '#/components/schemas/isActive'
|
||||||
|
isLocked:
|
||||||
|
$ref: '#/components/schemas/isLocked'
|
||||||
|
createdAt:
|
||||||
|
$ref: '../../schemas.yaml#/components/schemas/createdAt'
|
||||||
|
permissions:
|
||||||
|
$ref: '../Permissions.yaml#/components/schemas/permissions'
|
||||||
|
librariesAccessible:
|
||||||
|
description: The IDs of libraries the user has access to.
|
||||||
|
type: array
|
||||||
|
items:
|
||||||
|
$ref: '../Library.yaml#/components/schemas/libraryId'
|
||||||
|
itemTags:
|
||||||
|
$ref: '../../schemas.yaml#/components/schemas/tags'
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue