🏷️ add types for api

This commit is contained in:
oskvr37
2024-07-31 12:25:58 +02:00
parent 7f42ec1889
commit 5295d33e64
4 changed files with 88 additions and 34 deletions
-1
View File
@@ -1,7 +1,6 @@
from typing import TypedDict, Literal
from .api import *
from .playlist import *
from .track import *
TrackArg = Literal["low", "normal", "high", "master"]
+88 -1
View File
@@ -1,4 +1,5 @@
from typing import TypedDict, Optional
from typing import TypedDict, Optional, List, Literal
from .track import Track
class Client(TypedDict):
@@ -15,3 +16,89 @@ class SessionResponse(TypedDict):
channelId: int
partnerId: int
client: Client
class Items(TypedDict):
limit: int
offset: int
totalNumberOfItems: int
class ArtistAlbum(TypedDict):
id: int
name: str
type: Literal["MAIN"]
class Album(TypedDict):
id: int
title: str
duration: int
streamReady: bool
streamStartDate: str
allowStreaming: bool
premiumStreamingOnly: bool
numberOfTracks: int
numberOfVideos: int
numberOfVolumes: int
releaseDate: str
copyright: str
type: str
version: Optional[str]
url: str
cover: str
videoCover: Optional[str]
explicit: bool
upc: str
popularity: int
audioQuality: str
audioModes: List[str]
artist: ArtistAlbum
artists: List[ArtistAlbum]
class AristAlbumsItems(Items):
items: List[Album]
class _AlbumTrack(TypedDict):
item: Track
type: Literal["track"]
class AlbumItems(Items):
items: List[_AlbumTrack]
class _Creator(TypedDict):
id: int
class Playlist(TypedDict):
uuid: str
title: str
numberOfTracks: int
numberOfVideos: int
creator: _Creator
description: str
duration: int
lastUpdated: str
created: str
type: str
publicPlaylist: bool
url: str
image: str
popularity: int
squareImage: str
promotedArtists: List[ArtistAlbum]
lastItemAddedAt: str
class _PlaylistItem(TypedDict):
item: Track
type: Literal["track"]
cut: Literal[None]
class PlaylistItems(Items):
items: _PlaylistItem
View File
-32
View File
@@ -1,32 +0,0 @@
from typing import TypedDict, List, Any
class _Creator(TypedDict):
id: int
class Playlist(TypedDict):
uuid: str
title: str
numberOfTracks: int
numberOfVideos: int
creator: _Creator
description: str
duration: int
lastUpdated: str
created: str
type: str
publicPlaylist: bool
url: str
image: str
popularity: int
squareImage: str
promotedArtists: List[Any] # dont know yet the type
lastItemAddedAt: str
class PlaylistResponse(TypedDict):
limit: int
offset: int
totalNumberOfItems: int
items: List[Playlist]