@rocksky/sdk 0.3.0 → 0.4.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.
Files changed (51) hide show
  1. package/README.md +44 -254
  2. package/dist/agent.d.ts +77 -0
  3. package/dist/agent.d.ts.map +1 -0
  4. package/dist/client.d.ts +26 -113
  5. package/dist/client.d.ts.map +1 -1
  6. package/dist/dedup.d.ts +38 -0
  7. package/dist/dedup.d.ts.map +1 -0
  8. package/dist/errors.d.ts +3 -23
  9. package/dist/errors.d.ts.map +1 -1
  10. package/dist/generated/types.d.ts +106 -8
  11. package/dist/generated/types.d.ts.map +1 -1
  12. package/dist/hash.d.ts +7 -0
  13. package/dist/hash.d.ts.map +1 -0
  14. package/dist/index.d.ts +16 -17
  15. package/dist/index.d.ts.map +1 -1
  16. package/dist/index.js +6648 -1288
  17. package/dist/jetstream.d.ts +17 -0
  18. package/dist/jetstream.d.ts.map +1 -0
  19. package/package.json +15 -11
  20. package/src/agent.ts +232 -0
  21. package/src/client.ts +82 -226
  22. package/src/dedup.ts +207 -0
  23. package/src/errors.ts +6 -43
  24. package/src/generated/types.ts +115 -8
  25. package/src/hash.ts +22 -0
  26. package/src/index.ts +16 -86
  27. package/src/jetstream.ts +122 -0
  28. package/src/http.ts +0 -195
  29. package/src/namespaces/_helpers.ts +0 -27
  30. package/src/namespaces/actor.ts +0 -93
  31. package/src/namespaces/album.ts +0 -34
  32. package/src/namespaces/apikey.ts +0 -50
  33. package/src/namespaces/artist.ts +0 -68
  34. package/src/namespaces/charts.ts +0 -38
  35. package/src/namespaces/dropbox.ts +0 -53
  36. package/src/namespaces/feed.ts +0 -112
  37. package/src/namespaces/googledrive.ts +0 -41
  38. package/src/namespaces/graph.ts +0 -62
  39. package/src/namespaces/like.ts +0 -46
  40. package/src/namespaces/mirror.ts +0 -27
  41. package/src/namespaces/player.ts +0 -125
  42. package/src/namespaces/playlist.ts +0 -95
  43. package/src/namespaces/scrobble.ts +0 -41
  44. package/src/namespaces/shout.ts +0 -99
  45. package/src/namespaces/song.ts +0 -60
  46. package/src/namespaces/spotify.ts +0 -56
  47. package/src/namespaces/stats.ts +0 -27
  48. package/src/paginate.ts +0 -90
  49. package/src/pipe.ts +0 -146
  50. package/src/realtime.ts +0 -408
  51. package/src/types.ts +0 -41
@@ -1,41 +0,0 @@
1
- import type {
2
- DownloadFileParams,
3
- GetFileParams,
4
- GetFilesParams,
5
- } from "../generated/types.js";
6
- import type { RequestOptions } from "../types.js";
7
- import type { Call } from "./_helpers.js";
8
-
9
- export class GoogleDriveNamespace {
10
- constructor(private readonly call: Call) {}
11
-
12
- getFile(params: GetFileParams, opts?: RequestOptions) {
13
- return this.call("app.rocksky.googledrive.getFile", "GET", {
14
- params,
15
- requireAuth: true,
16
- ...opts,
17
- });
18
- }
19
-
20
- getFiles(
21
- params: GetFilesParams = {},
22
- opts?: RequestOptions,
23
- ) {
24
- return this.call("app.rocksky.googledrive.getFiles", "GET", {
25
- params,
26
- requireAuth: true,
27
- ...opts,
28
- });
29
- }
30
-
31
- downloadFile(
32
- params: DownloadFileParams,
33
- opts?: RequestOptions,
34
- ) {
35
- return this.call("app.rocksky.googledrive.downloadFile", "GET", {
36
- params,
37
- requireAuth: true,
38
- ...opts,
39
- });
40
- }
41
- }
@@ -1,62 +0,0 @@
1
- import type {
2
- FollowAccountParams,
3
- GetFollowersParams,
4
- GetFollowsParams,
5
- GetKnownFollowersParams,
6
- UnfollowAccountParams,
7
- } from "../generated/types.js";
8
- import type { RequestOptions } from "../types.js";
9
- import type { Call } from "./_helpers.js";
10
-
11
- export type FollowListParams = GetFollowersParams;
12
- export type KnownFollowersParams = GetKnownFollowersParams;
13
-
14
- export class GraphNamespace {
15
- constructor(private readonly call: Call) {}
16
-
17
- followAccount(
18
- params: FollowAccountParams,
19
- opts?: RequestOptions,
20
- ) {
21
- return this.call("app.rocksky.graph.followAccount", "POST", {
22
- params,
23
- requireAuth: true,
24
- ...opts,
25
- });
26
- }
27
-
28
- unfollowAccount(
29
- params: UnfollowAccountParams,
30
- opts?: RequestOptions,
31
- ) {
32
- return this.call("app.rocksky.graph.unfollowAccount", "POST", {
33
- params,
34
- requireAuth: true,
35
- ...opts,
36
- });
37
- }
38
-
39
- getFollowers(params: GetFollowersParams, opts?: RequestOptions) {
40
- return this.call("app.rocksky.graph.getFollowers", "GET", {
41
- params,
42
- ...opts,
43
- });
44
- }
45
-
46
- getFollows(params: GetFollowsParams, opts?: RequestOptions) {
47
- return this.call("app.rocksky.graph.getFollows", "GET", {
48
- params,
49
- ...opts,
50
- });
51
- }
52
-
53
- getKnownFollowers(
54
- params: GetKnownFollowersParams,
55
- opts?: RequestOptions,
56
- ) {
57
- return this.call("app.rocksky.graph.getKnownFollowers", "GET", {
58
- params,
59
- ...opts,
60
- });
61
- }
62
- }
@@ -1,46 +0,0 @@
1
- import type {
2
- DislikeShoutInput,
3
- DislikeSongInput,
4
- LikeShoutInput,
5
- LikeSongInput,
6
- } from "../generated/types.js";
7
- import type { RequestOptions } from "../types.js";
8
- import type { Call } from "./_helpers.js";
9
-
10
- export type LikeInput = LikeSongInput;
11
-
12
- export class LikeNamespace {
13
- constructor(private readonly call: Call) {}
14
-
15
- likeSong(input: LikeSongInput = {}, opts?: RequestOptions) {
16
- return this.call("app.rocksky.like.likeSong", "POST", {
17
- body: input,
18
- requireAuth: true,
19
- ...opts,
20
- });
21
- }
22
-
23
- dislikeSong(input: DislikeSongInput = {}, opts?: RequestOptions) {
24
- return this.call("app.rocksky.like.dislikeSong", "POST", {
25
- body: input,
26
- requireAuth: true,
27
- ...opts,
28
- });
29
- }
30
-
31
- likeShout(input: LikeShoutInput = {}, opts?: RequestOptions) {
32
- return this.call("app.rocksky.like.likeShout", "POST", {
33
- body: input,
34
- requireAuth: true,
35
- ...opts,
36
- });
37
- }
38
-
39
- dislikeShout(input: DislikeShoutInput = {}, opts?: RequestOptions) {
40
- return this.call("app.rocksky.like.dislikeShout", "POST", {
41
- body: input,
42
- requireAuth: true,
43
- ...opts,
44
- });
45
- }
46
- }
@@ -1,27 +0,0 @@
1
- import type { PutMirrorSourceInput } from "../generated/types.js";
2
- import type { RequestOptions } from "../types.js";
3
- import type { Call } from "./_helpers.js";
4
-
5
- export type { PutMirrorSourceInput };
6
-
7
- export class MirrorNamespace {
8
- constructor(private readonly call: Call) {}
9
-
10
- getMirrorSources(opts?: RequestOptions) {
11
- return this.call("app.rocksky.mirror.getMirrorSources", "GET", {
12
- requireAuth: true,
13
- ...opts,
14
- });
15
- }
16
-
17
- putMirrorSource(
18
- input: PutMirrorSourceInput,
19
- opts?: RequestOptions,
20
- ) {
21
- return this.call("app.rocksky.mirror.putMirrorSource", "POST", {
22
- body: input,
23
- requireAuth: true,
24
- ...opts,
25
- });
26
- }
27
- }
@@ -1,125 +0,0 @@
1
- import type {
2
- AddDirectoryToQueueParams,
3
- AddItemsToQueueParams,
4
- GetCurrentlyPlayingParams,
5
- GetPlaybackQueueParams,
6
- NextParams,
7
- PauseParams,
8
- PlayDirectoryParams,
9
- PlayFileParams,
10
- PlayParams,
11
- PreviousParams,
12
- SeekParams,
13
- } from "../generated/types.js";
14
- import type { RequestOptions } from "../types.js";
15
- import type { Call } from "./_helpers.js";
16
-
17
- export class PlayerNamespace {
18
- constructor(private readonly call: Call) {}
19
-
20
- getCurrentlyPlaying(
21
- params: GetCurrentlyPlayingParams = {},
22
- opts?: RequestOptions,
23
- ) {
24
- return this.call("app.rocksky.player.getCurrentlyPlaying", "GET", {
25
- params,
26
- ...opts,
27
- });
28
- }
29
-
30
- getPlaybackQueue(
31
- params: GetPlaybackQueueParams = {},
32
- opts?: RequestOptions,
33
- ) {
34
- return this.call("app.rocksky.player.getPlaybackQueue", "GET", {
35
- params,
36
- ...opts,
37
- });
38
- }
39
-
40
- play(params: PlayParams = {}, opts?: RequestOptions) {
41
- return this.call("app.rocksky.player.play", "POST", {
42
- params,
43
- requireAuth: true,
44
- ...opts,
45
- });
46
- }
47
-
48
- pause(params: PauseParams = {}, opts?: RequestOptions) {
49
- return this.call("app.rocksky.player.pause", "POST", {
50
- params,
51
- requireAuth: true,
52
- ...opts,
53
- });
54
- }
55
-
56
- next(params: NextParams = {}, opts?: RequestOptions) {
57
- return this.call("app.rocksky.player.next", "POST", {
58
- params,
59
- requireAuth: true,
60
- ...opts,
61
- });
62
- }
63
-
64
- previous(params: PreviousParams = {}, opts?: RequestOptions) {
65
- return this.call("app.rocksky.player.previous", "POST", {
66
- params,
67
- requireAuth: true,
68
- ...opts,
69
- });
70
- }
71
-
72
- seek(
73
- params: SeekParams,
74
- opts?: RequestOptions,
75
- ) {
76
- return this.call("app.rocksky.player.seek", "POST", {
77
- params,
78
- requireAuth: true,
79
- ...opts,
80
- });
81
- }
82
-
83
- playFile(
84
- params: PlayFileParams,
85
- opts?: RequestOptions,
86
- ) {
87
- return this.call("app.rocksky.player.playFile", "POST", {
88
- params,
89
- requireAuth: true,
90
- ...opts,
91
- });
92
- }
93
-
94
- playDirectory(
95
- params: PlayDirectoryParams,
96
- opts?: RequestOptions,
97
- ) {
98
- return this.call("app.rocksky.player.playDirectory", "POST", {
99
- params,
100
- requireAuth: true,
101
- ...opts,
102
- });
103
- }
104
-
105
- addItemsToQueue(
106
- params: AddItemsToQueueParams,
107
- opts?: RequestOptions,
108
- ) {
109
- return this.call("app.rocksky.player.addItemsToQueue", "POST", {
110
- params,
111
- requireAuth: true,
112
- ...opts,
113
- });
114
- }
115
-
116
- addDirectoryToQueue(
117
- params: AddDirectoryToQueueParams,
118
- opts?: RequestOptions,
119
- ) {
120
- return this.call("app.rocksky.player.addDirectoryToQueue", "POST", {
121
- params,
122
- ...opts,
123
- });
124
- }
125
- }
@@ -1,95 +0,0 @@
1
- import type {
2
- CreatePlaylistParams,
3
- GetPlaylistParams,
4
- GetPlaylistsParams,
5
- InsertDirectoryParams,
6
- InsertFilesParams,
7
- RemovePlaylistParams,
8
- RemoveTrackParams,
9
- StartPlaylistParams,
10
- } from "../generated/types.js";
11
- import type { RequestOptions } from "../types.js";
12
- import type { Call } from "./_helpers.js";
13
-
14
- export class PlaylistNamespace {
15
- constructor(private readonly call: Call) {}
16
-
17
- getPlaylists(
18
- params: GetPlaylistsParams = {},
19
- opts?: RequestOptions,
20
- ) {
21
- return this.call("app.rocksky.playlist.getPlaylists", "GET", {
22
- params,
23
- ...opts,
24
- });
25
- }
26
-
27
- getPlaylist(params: GetPlaylistParams, opts?: RequestOptions) {
28
- return this.call("app.rocksky.playlist.getPlaylist", "GET", {
29
- params,
30
- ...opts,
31
- });
32
- }
33
-
34
- createPlaylist(
35
- params: CreatePlaylistParams,
36
- opts?: RequestOptions,
37
- ) {
38
- return this.call("app.rocksky.playlist.createPlaylist", "POST", {
39
- params,
40
- requireAuth: true,
41
- ...opts,
42
- });
43
- }
44
-
45
- removePlaylist(params: RemovePlaylistParams, opts?: RequestOptions) {
46
- return this.call("app.rocksky.playlist.removePlaylist", "POST", {
47
- params,
48
- requireAuth: true,
49
- ...opts,
50
- });
51
- }
52
-
53
- startPlaylist(
54
- params: StartPlaylistParams,
55
- opts?: RequestOptions,
56
- ) {
57
- return this.call("app.rocksky.playlist.startPlaylist", "POST", {
58
- params,
59
- requireAuth: true,
60
- ...opts,
61
- });
62
- }
63
-
64
- insertDirectory(
65
- params: InsertDirectoryParams,
66
- opts?: RequestOptions,
67
- ) {
68
- return this.call("app.rocksky.playlist.insertDirectory", "POST", {
69
- params,
70
- requireAuth: true,
71
- ...opts,
72
- });
73
- }
74
-
75
- insertFiles(
76
- params: InsertFilesParams,
77
- opts?: RequestOptions,
78
- ) {
79
- return this.call("app.rocksky.playlist.insertFiles", "POST", {
80
- params,
81
- requireAuth: true,
82
- ...opts,
83
- });
84
- }
85
-
86
- removeTrack(
87
- params: RemoveTrackParams,
88
- opts?: RequestOptions,
89
- ) {
90
- return this.call("app.rocksky.playlist.removeTrack", "POST", {
91
- params,
92
- ...opts,
93
- });
94
- }
95
- }
@@ -1,41 +0,0 @@
1
- import type {
2
- CreateScrobbleInput,
3
- GetScrobbleParams,
4
- GetScrobblesParams,
5
- } from "../generated/types.js";
6
- import type { RequestOptions } from "../types.js";
7
- import type { Call } from "./_helpers.js";
8
-
9
- export type { CreateScrobbleInput, GetScrobblesParams };
10
-
11
- export class ScrobbleNamespace {
12
- constructor(private readonly call: Call) {}
13
-
14
- createScrobble(
15
- input: CreateScrobbleInput,
16
- opts?: RequestOptions,
17
- ) {
18
- return this.call("app.rocksky.scrobble.createScrobble", "POST", {
19
- body: input,
20
- requireAuth: true,
21
- ...opts,
22
- });
23
- }
24
-
25
- getScrobble(params: GetScrobbleParams, opts?: RequestOptions) {
26
- return this.call("app.rocksky.scrobble.getScrobble", "GET", {
27
- params,
28
- ...opts,
29
- });
30
- }
31
-
32
- getScrobbles(
33
- params: GetScrobblesParams = {},
34
- opts?: RequestOptions,
35
- ) {
36
- return this.call("app.rocksky.scrobble.getScrobbles", "GET", {
37
- params,
38
- ...opts,
39
- });
40
- }
41
- }
@@ -1,99 +0,0 @@
1
- import type {
2
- CreateShoutInput,
3
- GetAlbumShoutsParams,
4
- GetArtistShoutsParams,
5
- GetProfileShoutsParams,
6
- GetShoutRepliesParams,
7
- GetTrackShoutsParams,
8
- RemoveShoutParams,
9
- ReplyShoutInput,
10
- ReportShoutInput,
11
- } from "../generated/types.js";
12
- import type { RequestOptions } from "../types.js";
13
- import type { Call } from "./_helpers.js";
14
-
15
- export class ShoutNamespace {
16
- constructor(private readonly call: Call) {}
17
-
18
- createShout(
19
- input: CreateShoutInput = {},
20
- opts?: RequestOptions,
21
- ) {
22
- return this.call("app.rocksky.shout.createShout", "POST", {
23
- body: input,
24
- requireAuth: true,
25
- ...opts,
26
- });
27
- }
28
-
29
- replyShout(
30
- input: ReplyShoutInput,
31
- opts?: RequestOptions,
32
- ) {
33
- return this.call("app.rocksky.shout.replyShout", "POST", {
34
- body: input,
35
- requireAuth: true,
36
- ...opts,
37
- });
38
- }
39
-
40
- reportShout(
41
- input: ReportShoutInput,
42
- opts?: RequestOptions,
43
- ) {
44
- return this.call("app.rocksky.shout.reportShout", "POST", {
45
- body: input,
46
- requireAuth: true,
47
- ...opts,
48
- });
49
- }
50
-
51
- removeShout(params: RemoveShoutParams, opts?: RequestOptions) {
52
- return this.call("app.rocksky.shout.removeShout", "POST", {
53
- params,
54
- requireAuth: true,
55
- ...opts,
56
- });
57
- }
58
-
59
- getShoutReplies(params: GetShoutRepliesParams, opts?: RequestOptions) {
60
- return this.call("app.rocksky.shout.getShoutReplies", "GET", {
61
- params,
62
- ...opts,
63
- });
64
- }
65
-
66
- getProfileShouts(
67
- params: GetProfileShoutsParams,
68
- opts?: RequestOptions,
69
- ) {
70
- return this.call("app.rocksky.shout.getProfileShouts", "GET", {
71
- params,
72
- ...opts,
73
- });
74
- }
75
-
76
- getTrackShouts(
77
- params: GetTrackShoutsParams,
78
- opts?: RequestOptions,
79
- ) {
80
- return this.call("app.rocksky.shout.getTrackShouts", "GET", {
81
- params,
82
- ...opts,
83
- });
84
- }
85
-
86
- getArtistShouts(params: GetArtistShoutsParams, opts?: RequestOptions) {
87
- return this.call("app.rocksky.shout.getArtistShouts", "GET", {
88
- params,
89
- ...opts,
90
- });
91
- }
92
-
93
- getAlbumShouts(params: GetAlbumShoutsParams, opts?: RequestOptions) {
94
- return this.call("app.rocksky.shout.getAlbumShouts", "GET", {
95
- params,
96
- ...opts,
97
- });
98
- }
99
- }
@@ -1,60 +0,0 @@
1
- import type {
2
- CreateSongInput,
3
- GetSongParams,
4
- GetSongRecentListenersParams,
5
- GetSongsParams,
6
- MatchSongParams,
7
- } from "../generated/types.js";
8
- import type { RequestOptions } from "../types.js";
9
- import type { Call } from "./_helpers.js";
10
-
11
- export type {
12
- CreateSongInput,
13
- GetSongParams,
14
- GetSongRecentListenersParams,
15
- GetSongsParams,
16
- MatchSongParams,
17
- };
18
-
19
- export class SongNamespace {
20
- constructor(private readonly call: Call) {}
21
-
22
- getSong(params: GetSongParams, opts?: RequestOptions) {
23
- return this.call("app.rocksky.song.getSong", "GET", {
24
- params,
25
- ...opts,
26
- });
27
- }
28
-
29
- getSongs(params: GetSongsParams = {}, opts?: RequestOptions) {
30
- return this.call("app.rocksky.song.getSongs", "GET", {
31
- params,
32
- ...opts,
33
- });
34
- }
35
-
36
- getSongRecentListeners(
37
- params: GetSongRecentListenersParams,
38
- opts?: RequestOptions,
39
- ) {
40
- return this.call("app.rocksky.song.getSongRecentListeners", "GET", {
41
- params,
42
- ...opts,
43
- });
44
- }
45
-
46
- matchSong(params: MatchSongParams, opts?: RequestOptions) {
47
- return this.call("app.rocksky.song.matchSong", "GET", {
48
- params,
49
- ...opts,
50
- });
51
- }
52
-
53
- createSong(input: CreateSongInput, opts?: RequestOptions) {
54
- return this.call("app.rocksky.song.createSong", "POST", {
55
- body: input,
56
- requireAuth: true,
57
- ...opts,
58
- });
59
- }
60
- }
@@ -1,56 +0,0 @@
1
- import type {
2
- GetCurrentlyPlayingParams,
3
- SeekParams,
4
- } from "../generated/types.js";
5
- import type { RequestOptions } from "../types.js";
6
- import type { Call } from "./_helpers.js";
7
-
8
- export class SpotifyNamespace {
9
- constructor(private readonly call: Call) {}
10
-
11
- getCurrentlyPlaying(
12
- params: GetCurrentlyPlayingParams = {},
13
- opts?: RequestOptions,
14
- ) {
15
- return this.call("app.rocksky.spotify.getCurrentlyPlaying", "GET", {
16
- params,
17
- ...opts,
18
- });
19
- }
20
-
21
- play(opts?: RequestOptions) {
22
- return this.call("app.rocksky.spotify.play", "POST", {
23
- requireAuth: true,
24
- ...opts,
25
- });
26
- }
27
-
28
- pause(opts?: RequestOptions) {
29
- return this.call("app.rocksky.spotify.pause", "POST", {
30
- requireAuth: true,
31
- ...opts,
32
- });
33
- }
34
-
35
- next(opts?: RequestOptions) {
36
- return this.call("app.rocksky.spotify.next", "POST", {
37
- requireAuth: true,
38
- ...opts,
39
- });
40
- }
41
-
42
- previous(opts?: RequestOptions) {
43
- return this.call("app.rocksky.spotify.previous", "POST", {
44
- requireAuth: true,
45
- ...opts,
46
- });
47
- }
48
-
49
- seek(params: SeekParams, opts?: RequestOptions) {
50
- return this.call("app.rocksky.spotify.seek", "POST", {
51
- params,
52
- requireAuth: true,
53
- ...opts,
54
- });
55
- }
56
- }
@@ -1,27 +0,0 @@
1
- import type {
2
- GetStatsParams,
3
- GetWrappedParams,
4
- } from "../generated/types.js";
5
- import type { RequestOptions } from "../types.js";
6
- import type { Call } from "./_helpers.js";
7
-
8
- export class StatsNamespace {
9
- constructor(private readonly call: Call) {}
10
-
11
- getStats(params: GetStatsParams, opts?: RequestOptions) {
12
- return this.call("app.rocksky.stats.getStats", "GET", {
13
- params,
14
- ...opts,
15
- });
16
- }
17
-
18
- getWrapped(
19
- params: GetWrappedParams,
20
- opts?: RequestOptions,
21
- ) {
22
- return this.call("app.rocksky.stats.getWrapped", "GET", {
23
- params,
24
- ...opts,
25
- });
26
- }
27
- }