@rocksky/sdk 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +279 -0
- package/dist/client.d.ts +107 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/errors.d.ts +26 -0
- package/dist/errors.d.ts.map +1 -0
- package/dist/http.d.ts +28 -0
- package/dist/http.d.ts.map +1 -0
- package/dist/index.d.ts +18 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +1492 -0
- package/dist/namespaces/_helpers.d.ts +9 -0
- package/dist/namespaces/_helpers.d.ts.map +1 -0
- package/dist/namespaces/actor.d.ts +30 -0
- package/dist/namespaces/actor.d.ts.map +1 -0
- package/dist/namespaces/album.d.ts +18 -0
- package/dist/namespaces/album.d.ts.map +1 -0
- package/dist/namespaces/apikey.d.ts +27 -0
- package/dist/namespaces/apikey.d.ts.map +1 -0
- package/dist/namespaces/artist.d.ts +31 -0
- package/dist/namespaces/artist.d.ts.map +1 -0
- package/dist/namespaces/charts.d.ts +25 -0
- package/dist/namespaces/charts.d.ts.map +1 -0
- package/dist/namespaces/dropbox.d.ts +19 -0
- package/dist/namespaces/dropbox.d.ts.map +1 -0
- package/dist/namespaces/feed.d.ts +38 -0
- package/dist/namespaces/feed.d.ts.map +1 -0
- package/dist/namespaces/googledrive.d.ts +16 -0
- package/dist/namespaces/googledrive.d.ts.map +1 -0
- package/dist/namespaces/graph.d.ts +28 -0
- package/dist/namespaces/graph.d.ts.map +1 -0
- package/dist/namespaces/like.d.ts +14 -0
- package/dist/namespaces/like.d.ts.map +1 -0
- package/dist/namespaces/mirror.d.ts +15 -0
- package/dist/namespaces/mirror.d.ts.map +1 -0
- package/dist/namespaces/player.d.ts +41 -0
- package/dist/namespaces/player.d.ts.map +1 -0
- package/dist/namespaces/playlist.d.ts +40 -0
- package/dist/namespaces/playlist.d.ts.map +1 -0
- package/dist/namespaces/scrobble.d.ts +43 -0
- package/dist/namespaces/scrobble.d.ts.map +1 -0
- package/dist/namespaces/shout.d.ts +38 -0
- package/dist/namespaces/shout.d.ts.map +1 -0
- package/dist/namespaces/song.d.ts +48 -0
- package/dist/namespaces/song.d.ts.map +1 -0
- package/dist/namespaces/spotify.d.ts +17 -0
- package/dist/namespaces/spotify.d.ts.map +1 -0
- package/dist/namespaces/stats.d.ts +14 -0
- package/dist/namespaces/stats.d.ts.map +1 -0
- package/dist/paginate.d.ts +38 -0
- package/dist/paginate.d.ts.map +1 -0
- package/dist/pipe.d.ts +36 -0
- package/dist/pipe.d.ts.map +1 -0
- package/dist/realtime.d.ts +144 -0
- package/dist/realtime.d.ts.map +1 -0
- package/dist/types.d.ts +29 -0
- package/dist/types.d.ts.map +1 -0
- package/package.json +65 -0
- package/src/client.ts +235 -0
- package/src/errors.ts +47 -0
- package/src/http.ts +195 -0
- package/src/index.ts +85 -0
- package/src/namespaces/_helpers.ts +17 -0
- package/src/namespaces/actor.ts +89 -0
- package/src/namespaces/album.ts +34 -0
- package/src/namespaces/apikey.ts +50 -0
- package/src/namespaces/artist.ts +74 -0
- package/src/namespaces/charts.ts +47 -0
- package/src/namespaces/dropbox.ts +47 -0
- package/src/namespaces/feed.ts +106 -0
- package/src/namespaces/googledrive.ts +36 -0
- package/src/namespaces/graph.ts +63 -0
- package/src/namespaces/like.ts +40 -0
- package/src/namespaces/mirror.ts +31 -0
- package/src/namespaces/player.ts +127 -0
- package/src/namespaces/playlist.ts +85 -0
- package/src/namespaces/scrobble.ts +67 -0
- package/src/namespaces/shout.ts +90 -0
- package/src/namespaces/song.ts +81 -0
- package/src/namespaces/spotify.ts +52 -0
- package/src/namespaces/stats.ts +23 -0
- package/src/paginate.ts +90 -0
- package/src/pipe.ts +146 -0
- package/src/realtime.ts +408 -0
- package/src/types.ts +41 -0
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import type { Call } from "./_helpers";
|
|
2
|
+
import type { RequestOptions } from "../types";
|
|
3
|
+
|
|
4
|
+
export type RecommendParams = { did: string; limit?: number };
|
|
5
|
+
|
|
6
|
+
export class FeedNamespace {
|
|
7
|
+
constructor(private readonly call: Call) {}
|
|
8
|
+
|
|
9
|
+
search<T = unknown>(params: { query: string }, opts?: RequestOptions) {
|
|
10
|
+
return this.call<T>("app.rocksky.feed.search", "GET", {
|
|
11
|
+
params,
|
|
12
|
+
...opts,
|
|
13
|
+
});
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
getFeed<T = unknown>(
|
|
17
|
+
params: { feed: string; limit?: number; cursor?: string },
|
|
18
|
+
opts?: RequestOptions,
|
|
19
|
+
) {
|
|
20
|
+
return this.call<T>("app.rocksky.feed.getFeed", "GET", {
|
|
21
|
+
params,
|
|
22
|
+
...opts,
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
getFeedGenerators<T = unknown>(
|
|
27
|
+
params: { size?: number } = {},
|
|
28
|
+
opts?: RequestOptions,
|
|
29
|
+
) {
|
|
30
|
+
return this.call<T>("app.rocksky.feed.getFeedGenerators", "GET", {
|
|
31
|
+
params,
|
|
32
|
+
...opts,
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
getFeedGenerator<T = unknown>(
|
|
37
|
+
params: { feed: string },
|
|
38
|
+
opts?: RequestOptions,
|
|
39
|
+
) {
|
|
40
|
+
return this.call<T>("app.rocksky.feed.getFeedGenerator", "GET", {
|
|
41
|
+
params,
|
|
42
|
+
...opts,
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
describeFeedGenerator<T = unknown>(opts?: RequestOptions) {
|
|
47
|
+
return this.call<T>("app.rocksky.feed.describeFeedGenerator", "GET", {
|
|
48
|
+
...opts,
|
|
49
|
+
});
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
getFeedSkeleton<T = unknown>(
|
|
53
|
+
params: {
|
|
54
|
+
feed: string;
|
|
55
|
+
limit?: number;
|
|
56
|
+
offset?: number;
|
|
57
|
+
cursor?: string;
|
|
58
|
+
},
|
|
59
|
+
opts?: RequestOptions,
|
|
60
|
+
) {
|
|
61
|
+
return this.call<T>("app.rocksky.feed.getFeedSkeleton", "GET", {
|
|
62
|
+
params,
|
|
63
|
+
...opts,
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
getRecommendations<T = unknown>(
|
|
68
|
+
params: RecommendParams,
|
|
69
|
+
opts?: RequestOptions,
|
|
70
|
+
) {
|
|
71
|
+
return this.call<T>("app.rocksky.feed.getRecommendations", "GET", {
|
|
72
|
+
params,
|
|
73
|
+
...opts,
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
getArtistRecommendations<T = unknown>(
|
|
78
|
+
params: RecommendParams,
|
|
79
|
+
opts?: RequestOptions,
|
|
80
|
+
) {
|
|
81
|
+
return this.call<T>("app.rocksky.feed.getArtistRecommendations", "GET", {
|
|
82
|
+
params,
|
|
83
|
+
...opts,
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
getAlbumRecommendations<T = unknown>(
|
|
88
|
+
params: RecommendParams,
|
|
89
|
+
opts?: RequestOptions,
|
|
90
|
+
) {
|
|
91
|
+
return this.call<T>("app.rocksky.feed.getAlbumRecommendations", "GET", {
|
|
92
|
+
params,
|
|
93
|
+
...opts,
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
getStories<T = unknown>(
|
|
98
|
+
params: { size?: number } = {},
|
|
99
|
+
opts?: RequestOptions,
|
|
100
|
+
) {
|
|
101
|
+
return this.call<T>("app.rocksky.feed.getStories", "GET", {
|
|
102
|
+
params,
|
|
103
|
+
...opts,
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import type { Call } from "./_helpers";
|
|
2
|
+
import type { RequestOptions } from "../types";
|
|
3
|
+
|
|
4
|
+
export class GoogleDriveNamespace {
|
|
5
|
+
constructor(private readonly call: Call) {}
|
|
6
|
+
|
|
7
|
+
getFile<T = unknown>(params: { fileId: string }, opts?: RequestOptions) {
|
|
8
|
+
return this.call<T>("app.rocksky.googledrive.getFile", "GET", {
|
|
9
|
+
params,
|
|
10
|
+
requireAuth: true,
|
|
11
|
+
...opts,
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
|
|
15
|
+
getFiles<T = unknown>(
|
|
16
|
+
params: { at?: string } = {},
|
|
17
|
+
opts?: RequestOptions,
|
|
18
|
+
) {
|
|
19
|
+
return this.call<T>("app.rocksky.googledrive.getFiles", "GET", {
|
|
20
|
+
params,
|
|
21
|
+
requireAuth: true,
|
|
22
|
+
...opts,
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
|
|
26
|
+
downloadFile<T = unknown>(
|
|
27
|
+
params: { fileId: string },
|
|
28
|
+
opts?: RequestOptions,
|
|
29
|
+
) {
|
|
30
|
+
return this.call<T>("app.rocksky.googledrive.downloadFile", "GET", {
|
|
31
|
+
params,
|
|
32
|
+
requireAuth: true,
|
|
33
|
+
...opts,
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
import type { Call } from "./_helpers";
|
|
2
|
+
import type { RequestOptions } from "../types";
|
|
3
|
+
|
|
4
|
+
export type ActorParam = { actor: string };
|
|
5
|
+
export type FollowListParams = ActorParam & {
|
|
6
|
+
limit?: number;
|
|
7
|
+
cursor?: string;
|
|
8
|
+
dids?: string[];
|
|
9
|
+
};
|
|
10
|
+
export type KnownFollowersParams = ActorParam & {
|
|
11
|
+
limit?: number;
|
|
12
|
+
cursor?: string;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
export class GraphNamespace {
|
|
16
|
+
constructor(private readonly call: Call) {}
|
|
17
|
+
|
|
18
|
+
followAccount<T = unknown>(
|
|
19
|
+
params: { account: string },
|
|
20
|
+
opts?: RequestOptions,
|
|
21
|
+
) {
|
|
22
|
+
return this.call<T>("app.rocksky.graph.followAccount", "POST", {
|
|
23
|
+
params,
|
|
24
|
+
requireAuth: true,
|
|
25
|
+
...opts,
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
unfollowAccount<T = unknown>(
|
|
30
|
+
params: { account: string },
|
|
31
|
+
opts?: RequestOptions,
|
|
32
|
+
) {
|
|
33
|
+
return this.call<T>("app.rocksky.graph.unfollowAccount", "POST", {
|
|
34
|
+
params,
|
|
35
|
+
requireAuth: true,
|
|
36
|
+
...opts,
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
getFollowers<T = unknown>(params: FollowListParams, opts?: RequestOptions) {
|
|
41
|
+
return this.call<T>("app.rocksky.graph.getFollowers", "GET", {
|
|
42
|
+
params,
|
|
43
|
+
...opts,
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
getFollows<T = unknown>(params: FollowListParams, opts?: RequestOptions) {
|
|
48
|
+
return this.call<T>("app.rocksky.graph.getFollows", "GET", {
|
|
49
|
+
params,
|
|
50
|
+
...opts,
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
getKnownFollowers<T = unknown>(
|
|
55
|
+
params: KnownFollowersParams,
|
|
56
|
+
opts?: RequestOptions,
|
|
57
|
+
) {
|
|
58
|
+
return this.call<T>("app.rocksky.graph.getKnownFollowers", "GET", {
|
|
59
|
+
params,
|
|
60
|
+
...opts,
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { Call } from "./_helpers";
|
|
2
|
+
import type { RequestOptions } from "../types";
|
|
3
|
+
|
|
4
|
+
export type LikeInput = { uri?: string };
|
|
5
|
+
|
|
6
|
+
export class LikeNamespace {
|
|
7
|
+
constructor(private readonly call: Call) {}
|
|
8
|
+
|
|
9
|
+
likeSong<T = unknown>(input: LikeInput = {}, opts?: RequestOptions) {
|
|
10
|
+
return this.call<T>("app.rocksky.like.likeSong", "POST", {
|
|
11
|
+
body: input,
|
|
12
|
+
requireAuth: true,
|
|
13
|
+
...opts,
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
dislikeSong<T = unknown>(input: LikeInput = {}, opts?: RequestOptions) {
|
|
18
|
+
return this.call<T>("app.rocksky.like.dislikeSong", "POST", {
|
|
19
|
+
body: input,
|
|
20
|
+
requireAuth: true,
|
|
21
|
+
...opts,
|
|
22
|
+
});
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
likeShout<T = unknown>(input: LikeInput = {}, opts?: RequestOptions) {
|
|
26
|
+
return this.call<T>("app.rocksky.like.likeShout", "POST", {
|
|
27
|
+
body: input,
|
|
28
|
+
requireAuth: true,
|
|
29
|
+
...opts,
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
dislikeShout<T = unknown>(input: LikeInput = {}, opts?: RequestOptions) {
|
|
34
|
+
return this.call<T>("app.rocksky.like.dislikeShout", "POST", {
|
|
35
|
+
body: input,
|
|
36
|
+
requireAuth: true,
|
|
37
|
+
...opts,
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import type { Call } from "./_helpers";
|
|
2
|
+
import type { RequestOptions } from "../types";
|
|
3
|
+
|
|
4
|
+
export type PutMirrorSourceInput = {
|
|
5
|
+
provider: string;
|
|
6
|
+
enabled?: boolean;
|
|
7
|
+
externalUsername?: string;
|
|
8
|
+
apiKey?: string;
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export class MirrorNamespace {
|
|
12
|
+
constructor(private readonly call: Call) {}
|
|
13
|
+
|
|
14
|
+
getMirrorSources<T = unknown>(opts?: RequestOptions) {
|
|
15
|
+
return this.call<T>("app.rocksky.mirror.getMirrorSources", "GET", {
|
|
16
|
+
requireAuth: true,
|
|
17
|
+
...opts,
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
putMirrorSource<T = unknown>(
|
|
22
|
+
input: PutMirrorSourceInput,
|
|
23
|
+
opts?: RequestOptions,
|
|
24
|
+
) {
|
|
25
|
+
return this.call<T>("app.rocksky.mirror.putMirrorSource", "POST", {
|
|
26
|
+
body: input,
|
|
27
|
+
requireAuth: true,
|
|
28
|
+
...opts,
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
}
|
|
@@ -0,0 +1,127 @@
|
|
|
1
|
+
import type { Call } from "./_helpers";
|
|
2
|
+
import type { RequestOptions } from "../types";
|
|
3
|
+
|
|
4
|
+
type PlayerId = { playerId?: string };
|
|
5
|
+
|
|
6
|
+
export class PlayerNamespace {
|
|
7
|
+
constructor(private readonly call: Call) {}
|
|
8
|
+
|
|
9
|
+
getCurrentlyPlaying<T = unknown>(
|
|
10
|
+
params: PlayerId & { actor?: string } = {},
|
|
11
|
+
opts?: RequestOptions,
|
|
12
|
+
) {
|
|
13
|
+
return this.call<T>("app.rocksky.player.getCurrentlyPlaying", "GET", {
|
|
14
|
+
params,
|
|
15
|
+
...opts,
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
getPlaybackQueue<T = unknown>(
|
|
20
|
+
params: PlayerId = {},
|
|
21
|
+
opts?: RequestOptions,
|
|
22
|
+
) {
|
|
23
|
+
return this.call<T>("app.rocksky.player.getPlaybackQueue", "GET", {
|
|
24
|
+
params,
|
|
25
|
+
...opts,
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
play<T = unknown>(params: PlayerId = {}, opts?: RequestOptions) {
|
|
30
|
+
return this.call<T>("app.rocksky.player.play", "POST", {
|
|
31
|
+
params,
|
|
32
|
+
requireAuth: true,
|
|
33
|
+
...opts,
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
pause<T = unknown>(params: PlayerId = {}, opts?: RequestOptions) {
|
|
38
|
+
return this.call<T>("app.rocksky.player.pause", "POST", {
|
|
39
|
+
params,
|
|
40
|
+
requireAuth: true,
|
|
41
|
+
...opts,
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
next<T = unknown>(params: PlayerId = {}, opts?: RequestOptions) {
|
|
46
|
+
return this.call<T>("app.rocksky.player.next", "POST", {
|
|
47
|
+
params,
|
|
48
|
+
requireAuth: true,
|
|
49
|
+
...opts,
|
|
50
|
+
});
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
previous<T = unknown>(params: PlayerId = {}, opts?: RequestOptions) {
|
|
54
|
+
return this.call<T>("app.rocksky.player.previous", "POST", {
|
|
55
|
+
params,
|
|
56
|
+
requireAuth: true,
|
|
57
|
+
...opts,
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
seek<T = unknown>(
|
|
62
|
+
params: PlayerId & { position: number },
|
|
63
|
+
opts?: RequestOptions,
|
|
64
|
+
) {
|
|
65
|
+
return this.call<T>("app.rocksky.player.seek", "POST", {
|
|
66
|
+
params,
|
|
67
|
+
requireAuth: true,
|
|
68
|
+
...opts,
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
playFile<T = unknown>(
|
|
73
|
+
params: PlayerId & { fileId: string },
|
|
74
|
+
opts?: RequestOptions,
|
|
75
|
+
) {
|
|
76
|
+
return this.call<T>("app.rocksky.player.playFile", "POST", {
|
|
77
|
+
params,
|
|
78
|
+
requireAuth: true,
|
|
79
|
+
...opts,
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
playDirectory<T = unknown>(
|
|
84
|
+
params: PlayerId & {
|
|
85
|
+
directoryId: string;
|
|
86
|
+
shuffle?: boolean;
|
|
87
|
+
recurse?: boolean;
|
|
88
|
+
position?: number;
|
|
89
|
+
},
|
|
90
|
+
opts?: RequestOptions,
|
|
91
|
+
) {
|
|
92
|
+
return this.call<T>("app.rocksky.player.playDirectory", "POST", {
|
|
93
|
+
params,
|
|
94
|
+
requireAuth: true,
|
|
95
|
+
...opts,
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
addItemsToQueue<T = unknown>(
|
|
100
|
+
params: PlayerId & {
|
|
101
|
+
items: string[];
|
|
102
|
+
position?: number;
|
|
103
|
+
shuffle?: boolean;
|
|
104
|
+
},
|
|
105
|
+
opts?: RequestOptions,
|
|
106
|
+
) {
|
|
107
|
+
return this.call<T>("app.rocksky.player.addItemsToQueue", "POST", {
|
|
108
|
+
params,
|
|
109
|
+
requireAuth: true,
|
|
110
|
+
...opts,
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
|
|
114
|
+
addDirectoryToQueue<T = unknown>(
|
|
115
|
+
params: PlayerId & {
|
|
116
|
+
directory: string;
|
|
117
|
+
position?: number;
|
|
118
|
+
shuffle?: boolean;
|
|
119
|
+
},
|
|
120
|
+
opts?: RequestOptions,
|
|
121
|
+
) {
|
|
122
|
+
return this.call<T>("app.rocksky.player.addDirectoryToQueue", "POST", {
|
|
123
|
+
params,
|
|
124
|
+
...opts,
|
|
125
|
+
});
|
|
126
|
+
}
|
|
127
|
+
}
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
import type { Call } from "./_helpers";
|
|
2
|
+
import type { RequestOptions } from "../types";
|
|
3
|
+
|
|
4
|
+
export class PlaylistNamespace {
|
|
5
|
+
constructor(private readonly call: Call) {}
|
|
6
|
+
|
|
7
|
+
getPlaylists<T = unknown>(
|
|
8
|
+
params: { limit?: number; offset?: number } = {},
|
|
9
|
+
opts?: RequestOptions,
|
|
10
|
+
) {
|
|
11
|
+
return this.call<T>("app.rocksky.playlist.getPlaylists", "GET", {
|
|
12
|
+
params,
|
|
13
|
+
...opts,
|
|
14
|
+
});
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
getPlaylist<T = unknown>(params: { uri: string }, opts?: RequestOptions) {
|
|
18
|
+
return this.call<T>("app.rocksky.playlist.getPlaylist", "GET", {
|
|
19
|
+
params,
|
|
20
|
+
...opts,
|
|
21
|
+
});
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
createPlaylist<T = unknown>(
|
|
25
|
+
params: { name: string; description?: string },
|
|
26
|
+
opts?: RequestOptions,
|
|
27
|
+
) {
|
|
28
|
+
return this.call<T>("app.rocksky.playlist.createPlaylist", "POST", {
|
|
29
|
+
params,
|
|
30
|
+
requireAuth: true,
|
|
31
|
+
...opts,
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
removePlaylist<T = unknown>(params: { uri: string }, opts?: RequestOptions) {
|
|
36
|
+
return this.call<T>("app.rocksky.playlist.removePlaylist", "POST", {
|
|
37
|
+
params,
|
|
38
|
+
requireAuth: true,
|
|
39
|
+
...opts,
|
|
40
|
+
});
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
startPlaylist<T = unknown>(
|
|
44
|
+
params: { uri: string; shuffle?: boolean; position?: number },
|
|
45
|
+
opts?: RequestOptions,
|
|
46
|
+
) {
|
|
47
|
+
return this.call<T>("app.rocksky.playlist.startPlaylist", "POST", {
|
|
48
|
+
params,
|
|
49
|
+
requireAuth: true,
|
|
50
|
+
...opts,
|
|
51
|
+
});
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
insertDirectory<T = unknown>(
|
|
55
|
+
params: { uri: string; directory: string; position?: number },
|
|
56
|
+
opts?: RequestOptions,
|
|
57
|
+
) {
|
|
58
|
+
return this.call<T>("app.rocksky.playlist.insertDirectory", "POST", {
|
|
59
|
+
params,
|
|
60
|
+
requireAuth: true,
|
|
61
|
+
...opts,
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
insertFiles<T = unknown>(
|
|
66
|
+
params: { uri: string; files: string[]; position?: number },
|
|
67
|
+
opts?: RequestOptions,
|
|
68
|
+
) {
|
|
69
|
+
return this.call<T>("app.rocksky.playlist.insertFiles", "POST", {
|
|
70
|
+
params,
|
|
71
|
+
requireAuth: true,
|
|
72
|
+
...opts,
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
removeTrack<T = unknown>(
|
|
77
|
+
params: { uri: string; position: number },
|
|
78
|
+
opts?: RequestOptions,
|
|
79
|
+
) {
|
|
80
|
+
return this.call<T>("app.rocksky.playlist.removeTrack", "POST", {
|
|
81
|
+
params,
|
|
82
|
+
...opts,
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import type { Call } from "./_helpers";
|
|
2
|
+
import type { RequestOptions } from "../types";
|
|
3
|
+
|
|
4
|
+
export type CreateScrobbleInput = {
|
|
5
|
+
title: string;
|
|
6
|
+
artist: string;
|
|
7
|
+
album?: string;
|
|
8
|
+
duration?: number;
|
|
9
|
+
mbId?: string;
|
|
10
|
+
isrc?: string;
|
|
11
|
+
albumArt?: string;
|
|
12
|
+
trackNumber?: number;
|
|
13
|
+
releaseDate?: string;
|
|
14
|
+
year?: number;
|
|
15
|
+
discNumber?: number;
|
|
16
|
+
lyrics?: string;
|
|
17
|
+
composer?: string;
|
|
18
|
+
copyrightMessage?: string;
|
|
19
|
+
label?: string;
|
|
20
|
+
artistPicture?: string;
|
|
21
|
+
spotifyLink?: string;
|
|
22
|
+
lastfmLink?: string;
|
|
23
|
+
tidalLink?: string;
|
|
24
|
+
appleMusicLink?: string;
|
|
25
|
+
youtubeLink?: string;
|
|
26
|
+
deezerLink?: string;
|
|
27
|
+
timestamp?: number;
|
|
28
|
+
};
|
|
29
|
+
|
|
30
|
+
export type GetScrobblesParams = {
|
|
31
|
+
did?: string;
|
|
32
|
+
following?: boolean;
|
|
33
|
+
limit?: number;
|
|
34
|
+
offset?: number;
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
export class ScrobbleNamespace {
|
|
38
|
+
constructor(private readonly call: Call) {}
|
|
39
|
+
|
|
40
|
+
createScrobble<T = unknown>(
|
|
41
|
+
input: CreateScrobbleInput,
|
|
42
|
+
opts?: RequestOptions,
|
|
43
|
+
) {
|
|
44
|
+
return this.call<T>("app.rocksky.scrobble.createScrobble", "POST", {
|
|
45
|
+
body: input,
|
|
46
|
+
requireAuth: true,
|
|
47
|
+
...opts,
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
getScrobble<T = unknown>(params: { uri: string }, opts?: RequestOptions) {
|
|
52
|
+
return this.call<T>("app.rocksky.scrobble.getScrobble", "GET", {
|
|
53
|
+
params,
|
|
54
|
+
...opts,
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
getScrobbles<T = unknown>(
|
|
59
|
+
params: GetScrobblesParams = {},
|
|
60
|
+
opts?: RequestOptions,
|
|
61
|
+
) {
|
|
62
|
+
return this.call<T>("app.rocksky.scrobble.getScrobbles", "GET", {
|
|
63
|
+
params,
|
|
64
|
+
...opts,
|
|
65
|
+
});
|
|
66
|
+
}
|
|
67
|
+
}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
import type { Call } from "./_helpers";
|
|
2
|
+
import type { RequestOptions } from "../types";
|
|
3
|
+
|
|
4
|
+
type UriPage = { uri: string; limit?: number; offset?: number };
|
|
5
|
+
|
|
6
|
+
export class ShoutNamespace {
|
|
7
|
+
constructor(private readonly call: Call) {}
|
|
8
|
+
|
|
9
|
+
createShout<T = unknown>(
|
|
10
|
+
input: { message?: string } = {},
|
|
11
|
+
opts?: RequestOptions,
|
|
12
|
+
) {
|
|
13
|
+
return this.call<T>("app.rocksky.shout.createShout", "POST", {
|
|
14
|
+
body: input,
|
|
15
|
+
requireAuth: true,
|
|
16
|
+
...opts,
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
replyShout<T = unknown>(
|
|
21
|
+
input: { shoutId: string; message: string },
|
|
22
|
+
opts?: RequestOptions,
|
|
23
|
+
) {
|
|
24
|
+
return this.call<T>("app.rocksky.shout.replyShout", "POST", {
|
|
25
|
+
body: input,
|
|
26
|
+
requireAuth: true,
|
|
27
|
+
...opts,
|
|
28
|
+
});
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
reportShout<T = unknown>(
|
|
32
|
+
input: { shoutId: string; reason?: string },
|
|
33
|
+
opts?: RequestOptions,
|
|
34
|
+
) {
|
|
35
|
+
return this.call<T>("app.rocksky.shout.reportShout", "POST", {
|
|
36
|
+
body: input,
|
|
37
|
+
requireAuth: true,
|
|
38
|
+
...opts,
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
removeShout<T = unknown>(params: { id: string }, opts?: RequestOptions) {
|
|
43
|
+
return this.call<T>("app.rocksky.shout.removeShout", "POST", {
|
|
44
|
+
params,
|
|
45
|
+
requireAuth: true,
|
|
46
|
+
...opts,
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
getShoutReplies<T = unknown>(params: UriPage, opts?: RequestOptions) {
|
|
51
|
+
return this.call<T>("app.rocksky.shout.getShoutReplies", "GET", {
|
|
52
|
+
params,
|
|
53
|
+
...opts,
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
getProfileShouts<T = unknown>(
|
|
58
|
+
params: { did: string; limit?: number; offset?: number },
|
|
59
|
+
opts?: RequestOptions,
|
|
60
|
+
) {
|
|
61
|
+
return this.call<T>("app.rocksky.shout.getProfileShouts", "GET", {
|
|
62
|
+
params,
|
|
63
|
+
...opts,
|
|
64
|
+
});
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
getTrackShouts<T = unknown>(
|
|
68
|
+
params: { uri: string },
|
|
69
|
+
opts?: RequestOptions,
|
|
70
|
+
) {
|
|
71
|
+
return this.call<T>("app.rocksky.shout.getTrackShouts", "GET", {
|
|
72
|
+
params,
|
|
73
|
+
...opts,
|
|
74
|
+
});
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
getArtistShouts<T = unknown>(params: UriPage, opts?: RequestOptions) {
|
|
78
|
+
return this.call<T>("app.rocksky.shout.getArtistShouts", "GET", {
|
|
79
|
+
params,
|
|
80
|
+
...opts,
|
|
81
|
+
});
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
getAlbumShouts<T = unknown>(params: UriPage, opts?: RequestOptions) {
|
|
85
|
+
return this.call<T>("app.rocksky.shout.getAlbumShouts", "GET", {
|
|
86
|
+
params,
|
|
87
|
+
...opts,
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
}
|