A decentralized music tracking and discovery platform built on AT Protocol 馃幍 rocksky.app
spotify atproto lastfm musicbrainz scrobbling listenbrainz
at main 72 lines 1.6 kB view raw
1import { client } from "."; 2 3export const getFollows = async ( 4 actor: string, 5 limit: number, 6 dids?: string[], 7 cursor?: string, 8) => { 9 const response = await client.get("/xrpc/app.rocksky.graph.getFollows", { 10 params: { actor, limit: limit > 0 ? limit : 1, dids, cursor }, 11 }); 12 13 return response.data; 14}; 15 16export const getKnownFollowers = async ( 17 actor: string, 18 limit: number, 19 cursor?: string, 20) => { 21 const response = await client.get( 22 "/xrpc/app.rocksky.graph.getKnownFollowers", 23 { 24 params: { actor, limit: limit > 0 ? limit : 1, cursor }, 25 }, 26 ); 27 28 return response.data; 29}; 30 31export const getFollowers = async ( 32 actor: string, 33 limit: number, 34 dids?: string[], 35 cursor?: string, 36) => { 37 const response = await client.get("/xrpc/app.rocksky.graph.getFollowers", { 38 params: { actor, limit: limit > 0 ? limit : 1, dids, cursor }, 39 }); 40 41 return response.data; 42}; 43 44export const followAccount = async (account: string) => { 45 const response = await client.post( 46 "/xrpc/app.rocksky.graph.followAccount", 47 undefined, 48 { 49 params: { account }, 50 headers: { 51 Authorization: `Bearer ${localStorage.getItem("token")}`, 52 }, 53 }, 54 ); 55 56 return response.data; 57}; 58 59export const unfollowAccount = async (account: string) => { 60 const response = await client.post( 61 "/xrpc/app.rocksky.graph.unfollowAccount", 62 undefined, 63 { 64 params: { account }, 65 headers: { 66 Authorization: `Bearer ${localStorage.getItem("token")}`, 67 }, 68 }, 69 ); 70 71 return response.data; 72};