export type GetApiMusixmatchSpotifyIdLyricsArgs = {id: string}; export type GetApiMusixmatchSpotifyIdLyricsOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Get LRC lyrics from Spotify trackId * * GET /musixmatch/spotify/{id}/lyrics */ export const getApiMusixmatchSpotifyIdLyrics = async (args: GetApiMusixmatchSpotifyIdLyricsArgs, options?: GetApiMusixmatchSpotifyIdLyricsOptions) => { const {baseUrl = "https://api.paxsenix.org", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() const url = `${baseUrl.replace(/\/+$/, '')}/musixmatch/spotify/${encodeURIComponent(String(args.id))}/lyrics${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "GET", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };