Add song detail controller
This commit is contained in:
parent
2cefc092ce
commit
c4fb9a2e72
4 changed files with 37 additions and 3 deletions
|
@ -256,6 +256,15 @@ const getSongList = async (args: SongListArgs) => {
|
||||||
)?.(args);
|
)?.(args);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
const getSongDetail = async (args: SongDetailArgs) => {
|
||||||
|
return (
|
||||||
|
apiController(
|
||||||
|
'getSongDetail',
|
||||||
|
args.apiClientProps.server?.type,
|
||||||
|
) as ControllerEndpoint['getSongDetail']
|
||||||
|
)?.(args);
|
||||||
|
};
|
||||||
|
|
||||||
const getMusicFolderList = async (args: MusicFolderListArgs) => {
|
const getMusicFolderList = async (args: MusicFolderListArgs) => {
|
||||||
return (
|
return (
|
||||||
apiController(
|
apiController(
|
||||||
|
@ -444,6 +453,7 @@ export const controller = {
|
||||||
getPlaylistDetail,
|
getPlaylistDetail,
|
||||||
getPlaylistList,
|
getPlaylistList,
|
||||||
getPlaylistSongList,
|
getPlaylistSongList,
|
||||||
|
getSongDetail,
|
||||||
getSongList,
|
getSongList,
|
||||||
getTopSongList,
|
getTopSongList,
|
||||||
getUserList,
|
getUserList,
|
||||||
|
|
|
@ -11,6 +11,7 @@ import type {
|
||||||
AlbumArtistDetailQuery,
|
AlbumArtistDetailQuery,
|
||||||
TopSongListQuery,
|
TopSongListQuery,
|
||||||
SearchQuery,
|
SearchQuery,
|
||||||
|
SongDetailQuery,
|
||||||
} from './types';
|
} from './types';
|
||||||
|
|
||||||
export const queryKeys = {
|
export const queryKeys = {
|
||||||
|
@ -88,6 +89,10 @@ export const queryKeys = {
|
||||||
root: (serverId: string) => [serverId] as const,
|
root: (serverId: string) => [serverId] as const,
|
||||||
},
|
},
|
||||||
songs: {
|
songs: {
|
||||||
|
detail: (serverId: string, query?: SongDetailQuery) => {
|
||||||
|
if (query) return [serverId, 'songs', 'detail', query] as const;
|
||||||
|
return [serverId, 'songs', 'detail'] as const;
|
||||||
|
},
|
||||||
list: (serverId: string, query?: SongListQuery) => {
|
list: (serverId: string, query?: SongListQuery) => {
|
||||||
if (query) return [serverId, 'songs', 'list', query] as const;
|
if (query) return [serverId, 'songs', 'list', query] as const;
|
||||||
return [serverId, 'songs', 'list'] as const;
|
return [serverId, 'songs', 'list'] as const;
|
||||||
|
|
|
@ -310,8 +310,6 @@ const scrobble = async (args: ScrobbleArgs): Promise<ScrobbleResponse> => {
|
||||||
const search3 = async (args: SearchArgs): Promise<SearchResponse> => {
|
const search3 = async (args: SearchArgs): Promise<SearchResponse> => {
|
||||||
const { query, apiClientProps } = args;
|
const { query, apiClientProps } = args;
|
||||||
|
|
||||||
console.log('search api');
|
|
||||||
|
|
||||||
const res = await ssApiClient(apiClientProps).search3({
|
const res = await ssApiClient(apiClientProps).search3({
|
||||||
query: {
|
query: {
|
||||||
albumCount: query.albumLimit,
|
albumCount: query.albumLimit,
|
||||||
|
|
|
@ -167,7 +167,7 @@ export type Album = {
|
||||||
} & { songs?: Song[] };
|
} & { songs?: Song[] };
|
||||||
|
|
||||||
export type Song = {
|
export type Song = {
|
||||||
album: string;
|
album: string | undefined;
|
||||||
albumArtists: RelatedArtist[];
|
albumArtists: RelatedArtist[];
|
||||||
albumId: string;
|
albumId: string;
|
||||||
artistName: string;
|
artistName: string;
|
||||||
|
@ -971,6 +971,27 @@ export type SearchQuery = {
|
||||||
songStartIndex?: number;
|
songStartIndex?: number;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
export type SearchSongsQuery = {
|
||||||
|
musicFolderId?: string;
|
||||||
|
query?: string;
|
||||||
|
songLimit?: number;
|
||||||
|
songStartIndex?: number;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type SearchAlbumsQuery = {
|
||||||
|
albumLimit?: number;
|
||||||
|
albumStartIndex?: number;
|
||||||
|
musicFolderId?: string;
|
||||||
|
query?: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type SearchAlbumArtistsQuery = {
|
||||||
|
albumArtistLimit?: number;
|
||||||
|
albumArtistStartIndex?: number;
|
||||||
|
musicFolderId?: string;
|
||||||
|
query?: string;
|
||||||
|
};
|
||||||
|
|
||||||
export type SearchArgs = {
|
export type SearchArgs = {
|
||||||
query: SearchQuery;
|
query: SearchQuery;
|
||||||
} & BaseEndpointArgs;
|
} & BaseEndpointArgs;
|
||||||
|
|
Reference in a new issue