Add generic query/mutation types
This commit is contained in:
parent
8f042ad448
commit
17cf624f6a
3 changed files with 123 additions and 175 deletions
|
@ -11,7 +11,7 @@ import {
|
||||||
LibraryItem,
|
LibraryItem,
|
||||||
MusicFolderListArgs,
|
MusicFolderListArgs,
|
||||||
MusicFolderListResponse,
|
MusicFolderListResponse,
|
||||||
RatingArgs,
|
SetRatingArgs,
|
||||||
RatingResponse,
|
RatingResponse,
|
||||||
ScrobbleArgs,
|
ScrobbleArgs,
|
||||||
ScrobbleResponse,
|
ScrobbleResponse,
|
||||||
|
@ -208,10 +208,7 @@ const createFavorite = async (args: FavoriteArgs): Promise<FavoriteResponse> =>
|
||||||
throw new Error('Failed to create favorite');
|
throw new Error('Failed to create favorite');
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return null;
|
||||||
id: query.id,
|
|
||||||
type: query.type,
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const removeFavorite = async (args: FavoriteArgs): Promise<FavoriteResponse> => {
|
const removeFavorite = async (args: FavoriteArgs): Promise<FavoriteResponse> => {
|
||||||
|
@ -229,13 +226,10 @@ const removeFavorite = async (args: FavoriteArgs): Promise<FavoriteResponse> =>
|
||||||
throw new Error('Failed to delete favorite');
|
throw new Error('Failed to delete favorite');
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return null;
|
||||||
id: query.id,
|
|
||||||
type: query.type,
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
const setRating = async (args: RatingArgs): Promise<RatingResponse> => {
|
const setRating = async (args: SetRatingArgs): Promise<RatingResponse> => {
|
||||||
const { query, apiClientProps } = args;
|
const { query, apiClientProps } = args;
|
||||||
|
|
||||||
const itemIds = query.item.map((item) => item.id);
|
const itemIds = query.item.map((item) => item.id);
|
||||||
|
|
|
@ -1,50 +1,20 @@
|
||||||
import {
|
import {
|
||||||
JFSortOrder,
|
JFSortOrder,
|
||||||
JFGenreList,
|
|
||||||
JFAlbumList,
|
|
||||||
JFAlbumListSort,
|
JFAlbumListSort,
|
||||||
JFAlbumDetail,
|
|
||||||
JFSongList,
|
|
||||||
JFSongListSort,
|
JFSongListSort,
|
||||||
JFAlbumArtistList,
|
|
||||||
JFAlbumArtistListSort,
|
JFAlbumArtistListSort,
|
||||||
JFAlbumArtistDetail,
|
|
||||||
JFArtistList,
|
|
||||||
JFArtistListSort,
|
JFArtistListSort,
|
||||||
JFPlaylistList,
|
|
||||||
JFPlaylistDetail,
|
|
||||||
JFMusicFolderList,
|
|
||||||
JFPlaylistListSort,
|
JFPlaylistListSort,
|
||||||
} from '/@/renderer/api/jellyfin.types';
|
} from '/@/renderer/api/jellyfin.types';
|
||||||
import {
|
import {
|
||||||
NDSortOrder,
|
NDSortOrder,
|
||||||
NDOrder,
|
NDOrder,
|
||||||
NDGenreList,
|
|
||||||
NDAlbumList,
|
|
||||||
NDAlbumListSort,
|
NDAlbumListSort,
|
||||||
NDAlbumDetail,
|
|
||||||
NDSongList,
|
|
||||||
NDSongDetail,
|
|
||||||
NDAlbumArtistList,
|
|
||||||
NDAlbumArtistListSort,
|
NDAlbumArtistListSort,
|
||||||
NDAlbumArtistDetail,
|
|
||||||
NDDeletePlaylist,
|
|
||||||
NDPlaylistList,
|
|
||||||
NDPlaylistListSort,
|
NDPlaylistListSort,
|
||||||
NDPlaylistDetail,
|
|
||||||
NDSongListSort,
|
NDSongListSort,
|
||||||
NDUserList,
|
|
||||||
NDUserListSort,
|
NDUserListSort,
|
||||||
} from '/@/renderer/api/navidrome.types';
|
} from '/@/renderer/api/navidrome.types';
|
||||||
import {
|
|
||||||
SSAlbumList,
|
|
||||||
SSAlbumDetail,
|
|
||||||
SSAlbumArtistList,
|
|
||||||
SSAlbumArtistDetail,
|
|
||||||
SSMusicFolderList,
|
|
||||||
SSGenreList,
|
|
||||||
SSTopSongList,
|
|
||||||
} from '/@/renderer/api/subsonic.types';
|
|
||||||
|
|
||||||
export enum LibraryItem {
|
export enum LibraryItem {
|
||||||
ALBUM = 'album',
|
ALBUM = 'album',
|
||||||
|
@ -305,14 +275,13 @@ export type MusicFoldersResponse = MusicFolder[];
|
||||||
export type ListSortOrder = NDOrder | JFSortOrder;
|
export type ListSortOrder = NDOrder | JFSortOrder;
|
||||||
|
|
||||||
type BaseEndpointArgs = {
|
type BaseEndpointArgs = {
|
||||||
_serverId?: string;
|
apiClientProps: {
|
||||||
server: ServerListItem | null;
|
server: ServerListItem;
|
||||||
signal?: AbortSignal;
|
signal?: AbortSignal;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
// Genre List
|
// Genre List
|
||||||
export type RawGenreListResponse = NDGenreList | JFGenreList | SSGenreList | undefined;
|
|
||||||
|
|
||||||
export type GenreListResponse = BasePaginatedResponse<Genre[]> | null | undefined;
|
export type GenreListResponse = BasePaginatedResponse<Genre[]> | null | undefined;
|
||||||
|
|
||||||
export type GenreListArgs = { query: GenreListQuery } & BaseEndpointArgs;
|
export type GenreListArgs = { query: GenreListQuery } & BaseEndpointArgs;
|
||||||
|
@ -320,8 +289,6 @@ export type GenreListArgs = { query: GenreListQuery } & BaseEndpointArgs;
|
||||||
export type GenreListQuery = null;
|
export type GenreListQuery = null;
|
||||||
|
|
||||||
// Album List
|
// Album List
|
||||||
export type RawAlbumListResponse = NDAlbumList | SSAlbumList | JFAlbumList | undefined;
|
|
||||||
|
|
||||||
export type AlbumListResponse = BasePaginatedResponse<Album[]> | null | undefined;
|
export type AlbumListResponse = BasePaginatedResponse<Album[]> | null | undefined;
|
||||||
|
|
||||||
export enum AlbumListSort {
|
export enum AlbumListSort {
|
||||||
|
@ -343,31 +310,33 @@ export enum AlbumListSort {
|
||||||
}
|
}
|
||||||
|
|
||||||
export type AlbumListQuery = {
|
export type AlbumListQuery = {
|
||||||
artistIds?: string[];
|
_custom?: {
|
||||||
jfParams?: {
|
jellyfin?: {
|
||||||
albumArtistIds?: string;
|
albumArtistIds?: string;
|
||||||
artistIds?: string;
|
artistIds?: string;
|
||||||
contributingArtistIds?: string;
|
contributingArtistIds?: string;
|
||||||
filters?: string;
|
filters?: string;
|
||||||
genreIds?: string;
|
genreIds?: string;
|
||||||
genres?: string;
|
genres?: string;
|
||||||
isFavorite?: boolean;
|
isFavorite?: boolean;
|
||||||
maxYear?: number; // Parses to years
|
maxYear?: number; // Parses to years
|
||||||
minYear?: number; // Parses to years
|
minYear?: number; // Parses to years
|
||||||
tags?: string;
|
tags?: string;
|
||||||
|
};
|
||||||
|
navidrome?: {
|
||||||
|
artist_id?: string;
|
||||||
|
compilation?: boolean;
|
||||||
|
genre_id?: string;
|
||||||
|
has_rating?: boolean;
|
||||||
|
name?: string;
|
||||||
|
recently_played?: boolean;
|
||||||
|
starred?: boolean;
|
||||||
|
year?: number;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
artistIds?: string[];
|
||||||
limit?: number;
|
limit?: number;
|
||||||
musicFolderId?: string;
|
musicFolderId?: string;
|
||||||
ndParams?: {
|
|
||||||
artist_id?: string;
|
|
||||||
compilation?: boolean;
|
|
||||||
genre_id?: string;
|
|
||||||
has_rating?: boolean;
|
|
||||||
name?: string;
|
|
||||||
recently_played?: boolean;
|
|
||||||
starred?: boolean;
|
|
||||||
year?: number;
|
|
||||||
};
|
|
||||||
searchTerm?: string;
|
searchTerm?: string;
|
||||||
sortBy: AlbumListSort;
|
sortBy: AlbumListSort;
|
||||||
sortOrder: SortOrder;
|
sortOrder: SortOrder;
|
||||||
|
@ -437,8 +406,6 @@ export const albumListSortMap: AlbumListSortMap = {
|
||||||
};
|
};
|
||||||
|
|
||||||
// Album Detail
|
// Album Detail
|
||||||
export type RawAlbumDetailResponse = NDAlbumDetail | SSAlbumDetail | JFAlbumDetail | undefined;
|
|
||||||
|
|
||||||
export type AlbumDetailResponse = Album | null | undefined;
|
export type AlbumDetailResponse = Album | null | undefined;
|
||||||
|
|
||||||
export type AlbumDetailQuery = { id: string };
|
export type AlbumDetailQuery = { id: string };
|
||||||
|
@ -446,8 +413,6 @@ export type AlbumDetailQuery = { id: string };
|
||||||
export type AlbumDetailArgs = { query: AlbumDetailQuery } & BaseEndpointArgs;
|
export type AlbumDetailArgs = { query: AlbumDetailQuery } & BaseEndpointArgs;
|
||||||
|
|
||||||
// Song List
|
// Song List
|
||||||
export type RawSongListResponse = NDSongList | JFSongList | undefined;
|
|
||||||
|
|
||||||
export type SongListResponse = BasePaginatedResponse<Song[]>;
|
export type SongListResponse = BasePaginatedResponse<Song[]>;
|
||||||
|
|
||||||
export enum SongListSort {
|
export enum SongListSort {
|
||||||
|
@ -472,33 +437,35 @@ export enum SongListSort {
|
||||||
}
|
}
|
||||||
|
|
||||||
export type SongListQuery = {
|
export type SongListQuery = {
|
||||||
|
_custom?: {
|
||||||
|
jellyfin?: {
|
||||||
|
artistIds?: string;
|
||||||
|
contributingArtistIds?: string;
|
||||||
|
filters?: string;
|
||||||
|
genreIds?: string;
|
||||||
|
genres?: string;
|
||||||
|
includeItemTypes: 'Audio';
|
||||||
|
isFavorite?: boolean;
|
||||||
|
maxYear?: number; // Parses to years
|
||||||
|
minYear?: number; // Parses to years
|
||||||
|
sortBy?: JFSongListSort;
|
||||||
|
years?: string;
|
||||||
|
};
|
||||||
|
navidrome?: {
|
||||||
|
album_id?: string[];
|
||||||
|
artist_id?: string[];
|
||||||
|
compilation?: boolean;
|
||||||
|
genre_id?: string;
|
||||||
|
has_rating?: boolean;
|
||||||
|
starred?: boolean;
|
||||||
|
title?: string;
|
||||||
|
year?: number;
|
||||||
|
};
|
||||||
|
};
|
||||||
albumIds?: string[];
|
albumIds?: string[];
|
||||||
artistIds?: string[];
|
artistIds?: string[];
|
||||||
jfParams?: {
|
|
||||||
artistIds?: string;
|
|
||||||
contributingArtistIds?: string;
|
|
||||||
filters?: string;
|
|
||||||
genreIds?: string;
|
|
||||||
genres?: string;
|
|
||||||
includeItemTypes: 'Audio';
|
|
||||||
isFavorite?: boolean;
|
|
||||||
maxYear?: number; // Parses to years
|
|
||||||
minYear?: number; // Parses to years
|
|
||||||
sortBy?: JFSongListSort;
|
|
||||||
years?: string;
|
|
||||||
};
|
|
||||||
limit?: number;
|
limit?: number;
|
||||||
musicFolderId?: string;
|
musicFolderId?: string;
|
||||||
ndParams?: {
|
|
||||||
album_id?: string[];
|
|
||||||
artist_id?: string[];
|
|
||||||
compilation?: boolean;
|
|
||||||
genre_id?: string;
|
|
||||||
has_rating?: boolean;
|
|
||||||
starred?: boolean;
|
|
||||||
title?: string;
|
|
||||||
year?: number;
|
|
||||||
};
|
|
||||||
searchTerm?: string;
|
searchTerm?: string;
|
||||||
sortBy: SongListSort;
|
sortBy: SongListSort;
|
||||||
sortOrder: SortOrder;
|
sortOrder: SortOrder;
|
||||||
|
@ -577,8 +544,6 @@ export const songListSortMap: SongListSortMap = {
|
||||||
};
|
};
|
||||||
|
|
||||||
// Song Detail
|
// Song Detail
|
||||||
export type RawSongDetailResponse = NDSongDetail | undefined;
|
|
||||||
|
|
||||||
export type SongDetailResponse = Song | null | undefined;
|
export type SongDetailResponse = Song | null | undefined;
|
||||||
|
|
||||||
export type SongDetailQuery = { id: string };
|
export type SongDetailQuery = { id: string };
|
||||||
|
@ -586,13 +551,7 @@ export type SongDetailQuery = { id: string };
|
||||||
export type SongDetailArgs = { query: SongDetailQuery } & BaseEndpointArgs;
|
export type SongDetailArgs = { query: SongDetailQuery } & BaseEndpointArgs;
|
||||||
|
|
||||||
// Album Artist List
|
// Album Artist List
|
||||||
export type RawAlbumArtistListResponse =
|
export type AlbumArtistListResponse = BasePaginatedResponse<AlbumArtist[]> | null;
|
||||||
| NDAlbumArtistList
|
|
||||||
| SSAlbumArtistList
|
|
||||||
| JFAlbumArtistList
|
|
||||||
| undefined;
|
|
||||||
|
|
||||||
export type AlbumArtistListResponse = BasePaginatedResponse<AlbumArtist[]>;
|
|
||||||
|
|
||||||
export enum AlbumArtistListSort {
|
export enum AlbumArtistListSort {
|
||||||
ALBUM = 'album',
|
ALBUM = 'album',
|
||||||
|
@ -609,13 +568,15 @@ export enum AlbumArtistListSort {
|
||||||
}
|
}
|
||||||
|
|
||||||
export type AlbumArtistListQuery = {
|
export type AlbumArtistListQuery = {
|
||||||
|
_custom?: {
|
||||||
|
navidrome?: {
|
||||||
|
genre_id?: string;
|
||||||
|
name?: string;
|
||||||
|
starred?: boolean;
|
||||||
|
};
|
||||||
|
};
|
||||||
limit?: number;
|
limit?: number;
|
||||||
musicFolderId?: string;
|
musicFolderId?: string;
|
||||||
ndParams?: {
|
|
||||||
genre_id?: string;
|
|
||||||
name?: string;
|
|
||||||
starred?: boolean;
|
|
||||||
};
|
|
||||||
searchTerm?: string;
|
searchTerm?: string;
|
||||||
sortBy: AlbumArtistListSort;
|
sortBy: AlbumArtistListSort;
|
||||||
sortOrder: SortOrder;
|
sortOrder: SortOrder;
|
||||||
|
@ -673,21 +634,14 @@ export const albumArtistListSortMap: AlbumArtistListSortMap = {
|
||||||
};
|
};
|
||||||
|
|
||||||
// Album Artist Detail
|
// Album Artist Detail
|
||||||
export type RawAlbumArtistDetailResponse =
|
|
||||||
| NDAlbumArtistDetail
|
|
||||||
| SSAlbumArtistDetail
|
|
||||||
| JFAlbumArtistDetail
|
|
||||||
| undefined;
|
|
||||||
|
|
||||||
export type AlbumArtistDetailResponse = BasePaginatedResponse<AlbumArtist[]>;
|
export type AlbumArtistDetailResponse = AlbumArtist | null;
|
||||||
|
|
||||||
export type AlbumArtistDetailQuery = { id: string };
|
export type AlbumArtistDetailQuery = { id: string };
|
||||||
|
|
||||||
export type AlbumArtistDetailArgs = { query: AlbumArtistDetailQuery } & BaseEndpointArgs;
|
export type AlbumArtistDetailArgs = { query: AlbumArtistDetailQuery } & BaseEndpointArgs;
|
||||||
|
|
||||||
// Artist List
|
// Artist List
|
||||||
export type RawArtistListResponse = JFArtistList | undefined;
|
|
||||||
|
|
||||||
export type ArtistListResponse = BasePaginatedResponse<Artist[]>;
|
export type ArtistListResponse = BasePaginatedResponse<Artist[]>;
|
||||||
|
|
||||||
export enum ArtistListSort {
|
export enum ArtistListSort {
|
||||||
|
@ -705,13 +659,15 @@ export enum ArtistListSort {
|
||||||
}
|
}
|
||||||
|
|
||||||
export type ArtistListQuery = {
|
export type ArtistListQuery = {
|
||||||
|
_custom?: {
|
||||||
|
navidrome?: {
|
||||||
|
genre_id?: string;
|
||||||
|
name?: string;
|
||||||
|
starred?: boolean;
|
||||||
|
};
|
||||||
|
};
|
||||||
limit?: number;
|
limit?: number;
|
||||||
musicFolderId?: string;
|
musicFolderId?: string;
|
||||||
ndParams?: {
|
|
||||||
genre_id?: string;
|
|
||||||
name?: string;
|
|
||||||
starred?: boolean;
|
|
||||||
};
|
|
||||||
sortBy: ArtistListSort;
|
sortBy: ArtistListSort;
|
||||||
sortOrder: SortOrder;
|
sortOrder: SortOrder;
|
||||||
startIndex: number;
|
startIndex: number;
|
||||||
|
@ -770,31 +726,29 @@ export const artistListSortMap: ArtistListSortMap = {
|
||||||
// Artist Detail
|
// Artist Detail
|
||||||
|
|
||||||
// Favorite
|
// Favorite
|
||||||
export type RawFavoriteResponse = FavoriteResponse | undefined;
|
export type FavoriteResponse = null | undefined;
|
||||||
|
|
||||||
export type FavoriteResponse = { id: string[]; type: LibraryItem };
|
|
||||||
|
|
||||||
export type FavoriteQuery = {
|
export type FavoriteQuery = {
|
||||||
id: string[];
|
id: string[];
|
||||||
|
serverId: string;
|
||||||
type: LibraryItem;
|
type: LibraryItem;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type FavoriteArgs = { query: FavoriteQuery } & BaseEndpointArgs;
|
export type FavoriteArgs = { query: FavoriteQuery } & BaseEndpointArgs;
|
||||||
|
|
||||||
// Rating
|
// Rating
|
||||||
export type RawRatingResponse = RatingResponse | undefined;
|
export type RatingResponse = null | undefined;
|
||||||
|
|
||||||
export type RatingResponse = null;
|
|
||||||
|
|
||||||
export type RatingQuery = {
|
export type RatingQuery = {
|
||||||
item: AnyLibraryItems;
|
item: AnyLibraryItems;
|
||||||
rating: number;
|
rating: number;
|
||||||
|
serverId: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type RatingArgs = { query: RatingQuery } & BaseEndpointArgs;
|
export type SetRatingArgs = { query: RatingQuery } & BaseEndpointArgs;
|
||||||
|
|
||||||
// Add to playlist
|
// Add to playlist
|
||||||
export type RawAddToPlaylistResponse = null | undefined;
|
export type AddToPlaylistResponse = null | undefined;
|
||||||
|
|
||||||
export type AddToPlaylistQuery = {
|
export type AddToPlaylistQuery = {
|
||||||
id: string;
|
id: string;
|
||||||
|
@ -810,7 +764,7 @@ export type AddToPlaylistArgs = {
|
||||||
} & BaseEndpointArgs;
|
} & BaseEndpointArgs;
|
||||||
|
|
||||||
// Remove from playlist
|
// Remove from playlist
|
||||||
export type RawRemoveFromPlaylistResponse = null | undefined;
|
export type RemoveFromPlaylistResponse = null | undefined;
|
||||||
|
|
||||||
export type RemoveFromPlaylistQuery = {
|
export type RemoveFromPlaylistQuery = {
|
||||||
id: string;
|
id: string;
|
||||||
|
@ -820,27 +774,25 @@ export type RemoveFromPlaylistQuery = {
|
||||||
export type RemoveFromPlaylistArgs = { query: RemoveFromPlaylistQuery } & BaseEndpointArgs;
|
export type RemoveFromPlaylistArgs = { query: RemoveFromPlaylistQuery } & BaseEndpointArgs;
|
||||||
|
|
||||||
// Create Playlist
|
// Create Playlist
|
||||||
export type RawCreatePlaylistResponse = CreatePlaylistResponse | undefined;
|
|
||||||
|
|
||||||
export type CreatePlaylistResponse = { id: string; name: string };
|
export type CreatePlaylistResponse = { id: string; name: string };
|
||||||
|
|
||||||
export type CreatePlaylistBody = {
|
export type CreatePlaylistBody = {
|
||||||
|
_custom?: {
|
||||||
|
navidrome?: {
|
||||||
|
owner?: string;
|
||||||
|
ownerId?: string;
|
||||||
|
public?: boolean;
|
||||||
|
rules?: Record<string, any>;
|
||||||
|
sync?: boolean;
|
||||||
|
};
|
||||||
|
};
|
||||||
comment?: string;
|
comment?: string;
|
||||||
name: string;
|
name: string;
|
||||||
ndParams?: {
|
|
||||||
owner?: string;
|
|
||||||
ownerId?: string;
|
|
||||||
public?: boolean;
|
|
||||||
rules?: Record<string, any>;
|
|
||||||
sync?: boolean;
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export type CreatePlaylistArgs = { body: CreatePlaylistBody } & BaseEndpointArgs;
|
export type CreatePlaylistArgs = { body: CreatePlaylistBody } & BaseEndpointArgs;
|
||||||
|
|
||||||
// Update Playlist
|
// Update Playlist
|
||||||
export type RawUpdatePlaylistResponse = UpdatePlaylistResponse | undefined;
|
|
||||||
|
|
||||||
export type UpdatePlaylistResponse = { id: string };
|
export type UpdatePlaylistResponse = { id: string };
|
||||||
|
|
||||||
export type UpdatePlaylistQuery = {
|
export type UpdatePlaylistQuery = {
|
||||||
|
@ -848,16 +800,18 @@ export type UpdatePlaylistQuery = {
|
||||||
};
|
};
|
||||||
|
|
||||||
export type UpdatePlaylistBody = {
|
export type UpdatePlaylistBody = {
|
||||||
|
_custom?: {
|
||||||
|
navidrome?: {
|
||||||
|
owner?: string;
|
||||||
|
ownerId?: string;
|
||||||
|
public?: boolean;
|
||||||
|
rules?: Record<string, any>;
|
||||||
|
sync?: boolean;
|
||||||
|
};
|
||||||
|
};
|
||||||
comment?: string;
|
comment?: string;
|
||||||
genres?: Genre[];
|
genres?: Genre[];
|
||||||
name: string;
|
name: string;
|
||||||
ndParams?: {
|
|
||||||
owner?: string;
|
|
||||||
ownerId?: string;
|
|
||||||
public?: boolean;
|
|
||||||
rules?: Record<string, any>;
|
|
||||||
sync?: boolean;
|
|
||||||
};
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export type UpdatePlaylistArgs = {
|
export type UpdatePlaylistArgs = {
|
||||||
|
@ -866,17 +820,13 @@ export type UpdatePlaylistArgs = {
|
||||||
} & BaseEndpointArgs;
|
} & BaseEndpointArgs;
|
||||||
|
|
||||||
// Delete Playlist
|
// Delete Playlist
|
||||||
export type RawDeletePlaylistResponse = NDDeletePlaylist | undefined;
|
export type DeletePlaylistResponse = null | undefined;
|
||||||
|
|
||||||
export type DeletePlaylistResponse = null;
|
|
||||||
|
|
||||||
export type DeletePlaylistQuery = { id: string };
|
export type DeletePlaylistQuery = { id: string };
|
||||||
|
|
||||||
export type DeletePlaylistArgs = { query: DeletePlaylistQuery } & BaseEndpointArgs;
|
export type DeletePlaylistArgs = { query: DeletePlaylistQuery } & BaseEndpointArgs;
|
||||||
|
|
||||||
// Playlist List
|
// Playlist List
|
||||||
export type RawPlaylistListResponse = NDPlaylistList | JFPlaylistList | undefined;
|
|
||||||
|
|
||||||
export type PlaylistListResponse = BasePaginatedResponse<Playlist[]>;
|
export type PlaylistListResponse = BasePaginatedResponse<Playlist[]>;
|
||||||
|
|
||||||
export enum PlaylistListSort {
|
export enum PlaylistListSort {
|
||||||
|
@ -889,11 +839,13 @@ export enum PlaylistListSort {
|
||||||
}
|
}
|
||||||
|
|
||||||
export type PlaylistListQuery = {
|
export type PlaylistListQuery = {
|
||||||
limit?: number;
|
_custom?: {
|
||||||
ndParams?: {
|
navidrome?: {
|
||||||
owner_id?: string;
|
owner_id?: string;
|
||||||
smart?: boolean;
|
smart?: boolean;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
limit?: number;
|
||||||
searchTerm?: string;
|
searchTerm?: string;
|
||||||
sortBy: PlaylistListSort;
|
sortBy: PlaylistListSort;
|
||||||
sortOrder: SortOrder;
|
sortOrder: SortOrder;
|
||||||
|
@ -936,9 +888,7 @@ export const playlistListSortMap: PlaylistListSortMap = {
|
||||||
};
|
};
|
||||||
|
|
||||||
// Playlist Detail
|
// Playlist Detail
|
||||||
export type RawPlaylistDetailResponse = NDPlaylistDetail | JFPlaylistDetail | undefined;
|
export type PlaylistDetailResponse = Playlist;
|
||||||
|
|
||||||
export type PlaylistDetailResponse = BasePaginatedResponse<Playlist[]>;
|
|
||||||
|
|
||||||
export type PlaylistDetailQuery = {
|
export type PlaylistDetailQuery = {
|
||||||
id: string;
|
id: string;
|
||||||
|
@ -947,8 +897,6 @@ export type PlaylistDetailQuery = {
|
||||||
export type PlaylistDetailArgs = { query: PlaylistDetailQuery } & BaseEndpointArgs;
|
export type PlaylistDetailArgs = { query: PlaylistDetailQuery } & BaseEndpointArgs;
|
||||||
|
|
||||||
// Playlist Songs
|
// Playlist Songs
|
||||||
export type RawPlaylistSongListResponse = JFSongList | undefined;
|
|
||||||
|
|
||||||
export type PlaylistSongListResponse = BasePaginatedResponse<Song[]>;
|
export type PlaylistSongListResponse = BasePaginatedResponse<Song[]>;
|
||||||
|
|
||||||
export type PlaylistSongListQuery = {
|
export type PlaylistSongListQuery = {
|
||||||
|
@ -962,16 +910,12 @@ export type PlaylistSongListQuery = {
|
||||||
export type PlaylistSongListArgs = { query: PlaylistSongListQuery } & BaseEndpointArgs;
|
export type PlaylistSongListArgs = { query: PlaylistSongListQuery } & BaseEndpointArgs;
|
||||||
|
|
||||||
// Music Folder List
|
// Music Folder List
|
||||||
export type RawMusicFolderListResponse = SSMusicFolderList | JFMusicFolderList | undefined;
|
export type MusicFolderListResponse = BasePaginatedResponse<MusicFolder[]>;
|
||||||
|
|
||||||
export type MusicFolderListResponse = BasePaginatedResponse<Playlist[]>;
|
|
||||||
|
|
||||||
export type MusicFolderListArgs = BaseEndpointArgs;
|
export type MusicFolderListArgs = BaseEndpointArgs;
|
||||||
|
|
||||||
// User list
|
// User list
|
||||||
// Playlist List
|
// Playlist List
|
||||||
export type RawUserListResponse = NDUserList | undefined;
|
|
||||||
|
|
||||||
export type UserListResponse = BasePaginatedResponse<User[]>;
|
export type UserListResponse = BasePaginatedResponse<User[]>;
|
||||||
|
|
||||||
export enum UserListSort {
|
export enum UserListSort {
|
||||||
|
@ -979,10 +923,12 @@ export enum UserListSort {
|
||||||
}
|
}
|
||||||
|
|
||||||
export type UserListQuery = {
|
export type UserListQuery = {
|
||||||
limit?: number;
|
_custom?: {
|
||||||
ndParams?: {
|
navidrome?: {
|
||||||
owner_id?: string;
|
owner_id?: string;
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
limit?: number;
|
||||||
searchTerm?: string;
|
searchTerm?: string;
|
||||||
sortBy: UserListSort;
|
sortBy: UserListSort;
|
||||||
sortOrder: SortOrder;
|
sortOrder: SortOrder;
|
||||||
|
@ -1010,8 +956,6 @@ export const userListSortMap: UserListSortMap = {
|
||||||
};
|
};
|
||||||
|
|
||||||
// Top Songs List
|
// Top Songs List
|
||||||
export type RawTopSongListResponse = SSTopSongList | JFSongList | undefined;
|
|
||||||
|
|
||||||
export type TopSongListResponse = BasePaginatedResponse<Song[]>;
|
export type TopSongListResponse = BasePaginatedResponse<Song[]>;
|
||||||
|
|
||||||
export type TopSongListQuery = {
|
export type TopSongListQuery = {
|
||||||
|
@ -1032,7 +976,7 @@ export type ArtistInfoQuery = {
|
||||||
export type ArtistInfoArgs = { query: ArtistInfoQuery } & BaseEndpointArgs;
|
export type ArtistInfoArgs = { query: ArtistInfoQuery } & BaseEndpointArgs;
|
||||||
|
|
||||||
// Scrobble
|
// Scrobble
|
||||||
export type RawScrobbleResponse = null | undefined;
|
export type ScrobbleResponse = null | undefined;
|
||||||
|
|
||||||
export type ScrobbleArgs = {
|
export type ScrobbleArgs = {
|
||||||
query: ScrobbleQuery;
|
query: ScrobbleQuery;
|
||||||
|
|
|
@ -36,6 +36,16 @@ export const queryClient = new QueryClient({
|
||||||
queryCache,
|
queryCache,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
export type QueryHookArgs<T> = {
|
||||||
|
options?: QueryOptions;
|
||||||
|
query: T;
|
||||||
|
serverId?: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
export type MutationHookArgs = {
|
||||||
|
options?: MutationOptions;
|
||||||
|
};
|
||||||
|
|
||||||
export type QueryOptions = {
|
export type QueryOptions = {
|
||||||
cacheTime?: UseQueryOptions['cacheTime'];
|
cacheTime?: UseQueryOptions['cacheTime'];
|
||||||
enabled?: UseQueryOptions['enabled'];
|
enabled?: UseQueryOptions['enabled'];
|
||||||
|
|
Reference in a new issue