Press n or j to go to the next uncovered block, b, p or k for the previous block.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 | 42x 42x 4x | import type { ServerApiContext } from "types/serverContext"; import { handleJsonResponse } from "utils"; import { callSpotifyApi } from "utils/spotifyCalls"; interface IgetRecommendations { seed_tracks: string[]; limit?: number; market?: string; context?: ServerApiContext; } export async function getRecommendations({ seed_tracks, limit, market, context, }: IgetRecommendations): Promise<SpotifyApi.TrackObjectFull[] | null> { const res = await callSpotifyApi({ endpoint: `/recommendations?seed_tracks=${seed_tracks.join()}&market=${ market ?? "from_token" }&limit=${ limit ?? 20 }&fields=items(added_at,is_local,track(id,album(name,images,id),artists(name,id,type,uri),name,duration_ms,uri,explicit,is_playable,preview_url,type)),total`, method: "GET", context, }); const data = await handleJsonResponse<{ tracks: SpotifyApi.TrackObjectFull[]; }>(res); Iif (data) { return data?.tracks; } return null; } |