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

13
.gitignore vendored
View File

@@ -9,3 +9,16 @@ node_modules
vite.config.js.timestamp-* vite.config.js.timestamp-*
vite.config.ts.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: connections:
type: array type: array
items: items:
$ref: '#/components/schemas/Connection' $ref: '#/components/schemas/ConnectionInfo'
'400': '400':
description: Bad Request description: Bad Request
'401': '401':
description: Unauthorized 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: /users/{userId}/connections:
get: get:
summary: Returns all connections for a specified user summary: Returns all connections for a specified user
@@ -90,7 +64,7 @@ paths:
connections: connections:
type: array type: array
items: items:
$ref: '#/components/schemas/Connection' $ref: '#/components/schemas/ConnectionInfo'
'401': '401':
description: Unauthorized description: Unauthorized
@@ -119,84 +93,184 @@ paths:
recommendations: recommendations:
type: array type: array
items: 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': '401':
description: Unauthorized description: Unauthorized
components: components:
schemas: schemas:
serviceType: ConnectionInfo:
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:
type: object type: object
required: required:
- id - id
- userId - userId
- service - type
- accessToken
properties: properties:
id: id:
type: string type: string
userId: userId:
type: string type: string
service: type:
$ref: '#/components/schemas/Service'
accessToken:
type: string type: string
refreshToken: enum:
type: string - 'jellyfin'
expiry: - 'youtube-music'
type: number serverUrl:
ConnectionInfo:
type: object
required:
- connectionId
- serviceType
properties:
connectionId:
type: string
serviceType:
$ref: '#/components/schemas/serviceType'
username:
type: string type: string
serverName: serverName:
type: string type: string
jellyfinUserId:
type: string
username:
type: string
youtubeUserId:
type: string
profilePicture: profilePicture:
type: string type: string
MediaItem: Song:
type: object type: object
required: required:
- connectionId - connection
- serviceType
- type
- id - id
- name - name
- type
properties: properties:
connectionId: connection:
type: string type: string
serviceType:
$ref: '#/components/schemas/serviceType'
type:
type: string
enum: ['song', 'album', 'playlist', 'artist']
id: id:
type: string type: string
name: name:
type: string 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: thumbnail:
type: string type: string

1
src/app.d.ts vendored
View File

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

View File

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