A decentralized music tracking and discovery platform built on AT Protocol 馃幍
at fix/spotify 30 lines 779 B view raw
1import { client } from "."; 2import { Scrobble } from "../types/scrobble"; 3 4export const getProfileByDid = async (did: string) => { 5 const response = await client.get("/xrpc/app.rocksky.actor.getProfile", { 6 params: { did }, 7 }); 8 return response.data; 9}; 10 11export const getProfileStatsByDid = async (did: string) => { 12 const response = await client.get("/xrpc/app.rocksky.stats.getStats", { 13 params: { did }, 14 }); 15 return response.data; 16}; 17 18export const getRecentTracksByDid = async ( 19 did: string, 20 offset = 0, 21 limit = 10, 22): Promise<Scrobble[]> => { 23 const response = await client.get<{ scrobbles: Scrobble[] }>( 24 "/xrpc/app.rocksky.actor.getActorScrobbles", 25 { 26 params: { did, offset, limit }, 27 }, 28 ); 29 return response.data.scrobbles || []; 30};