A decentralized music tracking and discovery platform built on AT Protocol 馃幍
at fix/spotify 63 lines 1.3 kB view raw
1import axios from "axios"; 2import { API_URL } from "../consts"; 3 4export const getPlaylists = async ( 5 did: string, 6): Promise< 7 { 8 id: string; 9 name: string; 10 picture: string; 11 description?: string; 12 uri?: string; 13 spotifyLink?: string; 14 tidalLink?: string; 15 appleMusicLink?: string; 16 trackCount: number; 17 }[] 18> => { 19 const response = await axios.get(`${API_URL}/users/${did}/playlists`); 20 return response.data; 21}; 22 23export const getPlaylist = async ( 24 did: string, 25 rkey: string, 26): Promise<{ 27 id: string; 28 name: string; 29 picture: string; 30 description?: string; 31 uri?: string; 32 spotifyLink?: string; 33 tidalLink?: string; 34 appleMusicLink?: string; 35 curatedBy: { 36 id: string; 37 displayName: string; 38 did: string; 39 avatar: string; 40 handle: string; 41 }; 42 trackCount: number; 43 tracks: { 44 id: string; 45 trackNumber: number; 46 album: string; 47 albumArt: string; 48 albumArtist: string; 49 title: string; 50 artist: string; 51 createdAt: string; 52 uri: string; 53 albumUri: string; 54 artistUri: string; 55 duration: number; 56 discNumber: number; 57 }[]; 58}> => { 59 const response = await axios.get( 60 `${API_URL}/users/${did}/app.rocksky.playlist/${rkey}`, 61 ); 62 return response.data; 63};