A decentralized music tracking and discovery platform built on AT Protocol 馃幍
rocksky.app
spotify
atproto
lastfm
musicbrainz
scrobbling
listenbrainz
1import axios from "axios";
2import { client } from ".";
3import { API_URL } from "../consts";
4
5export const getFiles = async (id?: string) => {
6 const response = await client.get<{
7 parentDirectory: {
8 id: string;
9 name: string;
10 path: string;
11 fileId: string;
12 };
13 directory: {
14 id: string;
15 name: string;
16 path: string;
17 fileId: string;
18 };
19 directories: {
20 id: string;
21 name: string;
22 fileId: string;
23 path: string;
24 parentId?: string;
25 }[];
26 files: {
27 id: string;
28 name: string;
29 fileId: string;
30 directoryId: string;
31 trackId: string;
32 }[];
33 }>("/xrpc/app.rocksky.dropbox.getFiles", {
34 headers: {
35 Authorization: `Bearer ${localStorage.getItem("token")}`,
36 },
37 params: {
38 at: id,
39 },
40 });
41 return response.data;
42};
43
44export const getFile = async (id: string) => {
45 const response = await client.get<{
46 ".tag": string;
47 id: string;
48 name: string;
49 path_display: string;
50 }>("/xrpc/app.rocksky.dropbox.getFiles", {
51 headers: {
52 Authorization: `Bearer ${localStorage.getItem("token")}`,
53 },
54 params: {
55 path: id,
56 },
57 });
58 return response.data;
59};
60
61export const getTemporaryLink = async (id: string) => {
62 const response = await axios.get<{
63 link: string;
64 }>(`${API_URL}/dropbox/temporary-link`, {
65 headers: {
66 Authorization: `Bearer ${localStorage.getItem("token")}`,
67 },
68 params: {
69 path: id,
70 },
71 });
72 return response.data;
73};