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 38 39 40 41 42 | 2x | export interface SetListArtistInfo { mbid: string; tmid: number; name: string; sortName: string; disambiguation: string; url: string; } interface SetListArtistResponse { artist: SetListArtistInfo[]; total: number; page: number; itemsPerPage: number; } export async function getSetListArtist( artistName?: string, apiKey?: string ): Promise<SetListArtistInfo | null> { Iif (!artistName || !apiKey) return null; const res = await fetch( `https://api.setlist.fm/rest/1.0/search/artists?artistName=${artistName}&p=1&sort=relevance`, { method: "GET", headers: { accept: "application/json", "x-api-key": apiKey, }, } ); Iif (res.ok) { const data = (await res.json()) as SetListArtistResponse; Iif (data.artist.length > 0) { return data.artist[0]; } return null; } return null; } |