Add missing elements from Navidrome API

This commit is contained in:
jeffvli 2023-04-23 19:54:36 -07:00
parent 70c62c8b52
commit 52049ce163
2 changed files with 54 additions and 6 deletions

View file

@ -66,6 +66,7 @@ export const contract = c.router({
getAlbumList: {
method: 'GET',
path: 'album',
query: ndType._parameters.albumList,
responses: {
200: resultWithHeaders(ndType._response.albumList),
},
@ -87,10 +88,19 @@ export const contract = c.router({
getPlaylistList: {
method: 'GET',
path: 'playlist',
query: ndType._parameters.playlistList,
responses: {
200: resultWithHeaders(ndType._response.playlistList),
},
},
getPlaylistSongList: {
method: 'GET',
path: 'playlist/:id/tracks',
query: ndType._parameters.songList,
responses: {
200: resultWithHeaders(ndType._response.playlistSongList),
},
},
getSongDetail: {
method: 'GET',
path: 'song/:id',
@ -109,6 +119,7 @@ export const contract = c.router({
getUserList: {
method: 'GET',
path: 'user',
query: ndType._parameters.userList,
responses: {
200: resultWithHeaders(ndType._response.userList),
},
@ -164,7 +175,9 @@ axiosClient.interceptors.response.use(
},
);
export const ndApiClient = (server: ServerListItem | string) => {
export const ndApiClient = (args: { server: ServerListItem | string; signal?: AbortSignal }) => {
const { server, signal } = args;
return initClient(contract, {
api: async ({ path, method, headers, body }) => {
let baseUrl: string | undefined;
@ -186,6 +199,7 @@ export const ndApiClient = (server: ServerListItem | string) => {
...(token && { 'x-nd-authorization': `Bearer ${token}` }),
},
method: method as Method,
signal,
url: `${baseUrl}/${path}`,
});
return {