Updated openapi

This commit is contained in:
Eclypsed
2024-04-09 11:37:17 -04:00
parent 8e52bd71c4
commit 998dc81143
4 changed files with 166 additions and 80 deletions

15
.gitignore vendored
View File

@@ -8,4 +8,17 @@ node_modules
!.env.example
vite.config.js.timestamp-*
vite.config.ts.timestamp-*
*.db
*.db
.vscode/*
!.vscode/settings.json
!.vscode/tasks.json
!.vscode/launch.json
!.vscode/extensions.json
!.vscode/*.code-snippets
# Local History for Visual Studio Code
.history/
# Built Visual Studio Code Extensions
*.vsix

View File

@@ -34,37 +34,11 @@ paths:
connections:
type: array
items:
$ref: '#/components/schemas/Connection'
$ref: '#/components/schemas/ConnectionInfo'
'400':
description: Bad Request
'401':
description: Unauthorized
/connections/{connectionId}/info:
get:
summary: Returns unique info from the specified connection
tags:
- Connections
parameters:
- in: path
name: connectionId
schema:
type: string
description: The id of the connection
required: true
responses:
'200':
description: Any info relevant to the connection, such as username, profile picture, etc.
content:
application/json:
schema:
type: object
required:
- info
properties:
info:
$ref: '#/components/schemas/ConnectionInfo'
'401':
description: Unauthorized
/users/{userId}/connections:
get:
summary: Returns all connections for a specified user
@@ -90,7 +64,7 @@ paths:
connections:
type: array
items:
$ref: '#/components/schemas/Connection'
$ref: '#/components/schemas/ConnectionInfo'
'401':
description: Unauthorized
@@ -119,84 +93,184 @@ paths:
recommendations:
type: array
items:
$ref: '#/components/schemas/MediaItem'
oneOf:
- $ref: '#/components/schemas/Song'
- $ref: '#/components/schemas/Album'
- $ref: '#/components/schemas/Artist'
- $ref: '#/components/schemas/Playlist'
discriminator:
propertyName: type
'401':
description: Unauthorized
components:
schemas:
serviceType:
type: string
enum: ['jellyfin', 'youtube-music']
Service:
type: object
required:
- type
- userId
- urlOrigin
properties:
type:
$ref: '#/components/schemas/serviceType'
userId:
type: string
urlOrigin:
type: string
Connection:
ConnectionInfo:
type: object
required:
- id
- userId
- service
- accessToken
- type
properties:
id:
type: string
userId:
type: string
service:
$ref: '#/components/schemas/Service'
accessToken:
type:
type: string
refreshToken:
type: string
expiry:
type: number
ConnectionInfo:
type: object
required:
- connectionId
- serviceType
properties:
connectionId:
type: string
serviceType:
$ref: '#/components/schemas/serviceType'
username:
enum:
- 'jellyfin'
- 'youtube-music'
serverUrl:
type: string
serverName:
type: string
jellyfinUserId:
type: string
username:
type: string
youtubeUserId:
type: string
profilePicture:
type: string
MediaItem:
Song:
type: object
required:
- connectionId
- serviceType
- type
- connection
- id
- name
- type
properties:
connectionId:
connection:
type: string
serviceType:
$ref: '#/components/schemas/serviceType'
type:
type: string
enum: ['song', 'album', 'playlist', 'artist']
id:
type: string
name:
type: string
type:
type: string
enum:
- 'song'
duration:
type: number
thumbnail:
type: string
artists:
type: array
items:
type: object
required:
- id
- name
properties:
id:
type: string
name:
type: string
album:
type: object
required:
- id
- name
properties:
id:
type: string
name:
type: string
createdBy:
type: object
required:
- id
- name
properties:
id:
type: string
name:
type: string
releaseDate:
type: string
Album:
type: object
required:
- connection
- id
- name
- type
properties:
connection:
type: string
id:
type: string
name:
type: string
type:
type: string
enum:
- 'album'
duration:
type: number
thumbnail:
type: string
artists:
type: object
required:
- id
- name
properties:
id:
type: string
name:
type: string
releaseDate:
type: string
Artist:
type: object
required:
- connection
- id
- name
- type
properties:
connection:
type: string
id:
type: string
name:
type: string
type:
type: string
enum:
- 'artist'
thumbnail:
type: string
Playlist:
type: object
required:
- connection
- id
- name
- type
properties:
connection:
type: string
id:
type: string
name:
type: string
type:
type: string
enum:
- 'playlist'
createdBy:
type: object
required:
- id
- name
properties:
id:
type: string
name:
type: string
thumbnail:
type: string

1
src/app.d.ts vendored
View File

@@ -107,7 +107,6 @@ declare global {
name: string
}
thumbnail?: string
description?: string
}
}

View File

@@ -11,10 +11,10 @@
$: serviceData = Services[connectionInfo.type]
const subHeaderItems: string[] = []
if ('username' in connectionInfo) {
if ('username' in connectionInfo && connectionInfo.username) {
subHeaderItems.push(connectionInfo.username)
}
if ('serverName' in connectionInfo) {
if ('serverName' in connectionInfo && connectionInfo.serverName) {
subHeaderItems.push(connectionInfo.serverName)
}
</script>