Files
Lazuli/src/app.d.ts

154 lines
3.5 KiB
TypeScript
Raw Normal View History

2024-01-21 20:28:37 -05:00
// See https://kit.svelte.dev/docs/types#app
// for information about these interfaces
declare global {
namespace App {
// interface Error {}
2024-01-25 19:50:26 -05:00
interface Locals {
user: User
}
// interface PageData {}
// interface PageState {}
// interface Platform {}
}
2024-01-25 19:50:26 -05:00
interface User {
id: string
username: string
password?: string
}
2024-01-29 12:29:32 -05:00
2024-02-01 18:10:15 -05:00
interface Service {
2024-02-03 02:47:23 -05:00
type: 'jellyfin' | 'youtube-music'
2024-02-01 18:10:15 -05:00
userId: string
urlOrigin: string
}
interface Connection {
id: string
user: User
service: Service
accessToken: string
}
2024-02-03 02:47:23 -05:00
interface MediaItem {
connection: Connection
id: string
name: string
duration: number
thumbnail?: string
}
interface Song extends MediaItem {
artists?: Artist[]
albumId?: string
audio: string
video?: string
releaseDate: string
}
interface Album extends MediaItem {
artists: Artist[]
songs: Song[]
releaseDate: string
}
interface Playlist extends MediaItem {
songs: Song[]
description?: string
}
interface Artist {
id: string
name: string
// Add more here in the future
}
namespace Jellyfin {
// The jellyfin API will not always return the data it says it will, for example /Users/AuthenticateByName says it will
// retrun the ServerName, it wont. This must be fetched from /System/Info.
// So, ONLY DEFINE THE INTERFACES FOR DATA THAT IS GARUNTEED TO BE RETURNED (unless the data value itself is inherently optional)
interface JFService extends Service {
type: 'jellyfin'
username: string
serverName: string
}
interface JFConnection extends Connection {
service: JFService
}
interface AuthData {
User: {
Id: string
}
AccessToken: string
}
interface User {
Name: string
Id: string
}
interface System {
ServerName: string
}
2024-02-03 02:47:23 -05:00
interface MediaItem {
Name: string
Id: string
RunTimeTicks: number
Type: 'Audio' | 'MusicAlbum' | 'Playlist'
ImageTags?: {
Primary?: string
}
}
2024-02-03 02:47:23 -05:00
interface Song extends Jellyfin.MediaItem {
ProductionYear: number
Type: 'Audio'
ArtistItems?: {
Name: string
Id: string
}[]
Album?: string
AlbumId?: string
AlbumPrimaryImageTag?: string
AlbumArtists?: {
Name: string
Id: string
}[]
}
2024-01-29 12:29:32 -05:00
2024-02-03 02:47:23 -05:00
interface Album extends Jellyfin.MediaItem {
ProductionYear: number
Type: 'MusicAlbum'
ArtistItems?: {
Name: string
Id: string
}[]
AlbumArtists?: {
Name: string
Id: string
2024-01-29 12:29:32 -05:00
}[]
}
2024-02-03 02:47:23 -05:00
interface Playlist extends Jellyfin.MediaItem {
Type: 'Playlist'
ChildCount: number
}
2024-01-29 12:29:32 -05:00
}
2024-02-03 02:47:23 -05:00
namespace YouTubeMusic {
interface YTService extends Service {
type: 'youtube-music'
username: string
}
2024-01-29 12:29:32 -05:00
2024-02-03 02:47:23 -05:00
interface YTConnection extends Connection {
service: YTService
}
2024-01-29 12:29:32 -05:00
}
2024-01-21 20:28:37 -05:00
}
export {}