@rocksky/sdk 0.1.0 → 0.2.1

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 (74) hide show
  1. package/README.md +5 -0
  2. package/dist/client.d.ts +37 -28
  3. package/dist/client.d.ts.map +1 -1
  4. package/dist/generated/types.d.ts +1932 -0
  5. package/dist/generated/types.d.ts.map +1 -0
  6. package/dist/http.d.ts +3 -3
  7. package/dist/http.d.ts.map +1 -1
  8. package/dist/index.d.ts +17 -17
  9. package/dist/index.d.ts.map +1 -1
  10. package/dist/index.js +6 -1
  11. package/dist/namespaces/_helpers.d.ts +11 -5
  12. package/dist/namespaces/_helpers.d.ts.map +1 -1
  13. package/dist/namespaces/actor.d.ts +15 -25
  14. package/dist/namespaces/actor.d.ts.map +1 -1
  15. package/dist/namespaces/album.d.ts +7 -13
  16. package/dist/namespaces/album.d.ts.map +1 -1
  17. package/dist/namespaces/apikey.d.ts +9 -22
  18. package/dist/namespaces/apikey.d.ts.map +1 -1
  19. package/dist/namespaces/artist.d.ts +11 -26
  20. package/dist/namespaces/artist.d.ts.map +1 -1
  21. package/dist/namespaces/charts.d.ts +8 -20
  22. package/dist/namespaces/charts.d.ts.map +1 -1
  23. package/dist/namespaces/dropbox.d.ts +7 -14
  24. package/dist/namespaces/dropbox.d.ts.map +1 -1
  25. package/dist/namespaces/feed.d.ts +14 -33
  26. package/dist/namespaces/feed.d.ts.map +1 -1
  27. package/dist/namespaces/googledrive.d.ts +6 -11
  28. package/dist/namespaces/googledrive.d.ts.map +1 -1
  29. package/dist/namespaces/graph.d.ts +10 -23
  30. package/dist/namespaces/graph.d.ts.map +1 -1
  31. package/dist/namespaces/like.d.ts +8 -9
  32. package/dist/namespaces/like.d.ts.map +1 -1
  33. package/dist/namespaces/mirror.d.ts +6 -10
  34. package/dist/namespaces/mirror.d.ts.map +1 -1
  35. package/dist/namespaces/player.d.ts +14 -36
  36. package/dist/namespaces/player.d.ts.map +1 -1
  37. package/dist/namespaces/playlist.d.ts +11 -35
  38. package/dist/namespaces/playlist.d.ts.map +1 -1
  39. package/dist/namespaces/scrobble.d.ts +7 -38
  40. package/dist/namespaces/scrobble.d.ts.map +1 -1
  41. package/dist/namespaces/shout.d.ts +12 -33
  42. package/dist/namespaces/shout.d.ts.map +1 -1
  43. package/dist/namespaces/song.d.ts +9 -43
  44. package/dist/namespaces/song.d.ts.map +1 -1
  45. package/dist/namespaces/spotify.d.ts +9 -12
  46. package/dist/namespaces/spotify.d.ts.map +1 -1
  47. package/dist/namespaces/stats.d.ts +5 -9
  48. package/dist/namespaces/stats.d.ts.map +1 -1
  49. package/package.json +1 -1
  50. package/src/client.ts +50 -33
  51. package/src/generated/types.ts +2143 -0
  52. package/src/http.ts +5 -5
  53. package/src/index.ts +17 -17
  54. package/src/namespaces/_helpers.ts +23 -13
  55. package/src/namespaces/actor.ts +37 -33
  56. package/src/namespaces/album.ts +14 -14
  57. package/src/namespaces/apikey.ts +18 -18
  58. package/src/namespaces/artist.ts +26 -32
  59. package/src/namespaces/charts.ts +15 -24
  60. package/src/namespaces/dropbox.ts +19 -13
  61. package/src/namespaces/feed.ts +42 -36
  62. package/src/namespaces/googledrive.ts +15 -10
  63. package/src/namespaces/graph.ts +24 -25
  64. package/src/namespaces/like.ts +17 -11
  65. package/src/namespaces/mirror.ts +8 -12
  66. package/src/namespaces/player.ts +44 -46
  67. package/src/namespaces/playlist.ts +34 -24
  68. package/src/namespaces/scrobble.ts +14 -40
  69. package/src/namespaces/shout.ts +36 -27
  70. package/src/namespaces/song.ts +27 -48
  71. package/src/namespaces/spotify.ts +19 -15
  72. package/src/namespaces/stats.ts +11 -7
  73. package/src/pipe.ts +1 -1
  74. package/src/realtime.ts +2 -2
@@ -1,104 +1,110 @@
1
- import type { Call } from "./_helpers";
2
- import type { RequestOptions } from "../types";
1
+ import type {
2
+ GetAlbumRecommendationsParams,
3
+ GetArtistRecommendationsParams,
4
+ GetFeedGeneratorParams,
5
+ GetFeedGeneratorsParams,
6
+ GetFeedParams,
7
+ GetFeedSkeletonParams,
8
+ GetRecommendationsParams,
9
+ GetStoriesParams,
10
+ SearchParams,
11
+ } from "../generated/types.js";
12
+ import type { RequestOptions } from "../types.js";
13
+ import type { Call } from "./_helpers.js";
3
14
 
4
- export type RecommendParams = { did: string; limit?: number };
15
+ export type RecommendParams = GetRecommendationsParams;
5
16
 
6
17
  export class FeedNamespace {
7
18
  constructor(private readonly call: Call) {}
8
19
 
9
- search<T = unknown>(params: { query: string }, opts?: RequestOptions) {
10
- return this.call<T>("app.rocksky.feed.search", "GET", {
20
+ search(params: SearchParams, opts?: RequestOptions) {
21
+ return this.call("app.rocksky.feed.search", "GET", {
11
22
  params,
12
23
  ...opts,
13
24
  });
14
25
  }
15
26
 
16
- getFeed<T = unknown>(
17
- params: { feed: string; limit?: number; cursor?: string },
27
+ getFeed(
28
+ params: GetFeedParams,
18
29
  opts?: RequestOptions,
19
30
  ) {
20
- return this.call<T>("app.rocksky.feed.getFeed", "GET", {
31
+ return this.call("app.rocksky.feed.getFeed", "GET", {
21
32
  params,
22
33
  ...opts,
23
34
  });
24
35
  }
25
36
 
26
- getFeedGenerators<T = unknown>(
27
- params: { size?: number } = {},
37
+ getFeedGenerators(
38
+ params: GetFeedGeneratorsParams = {},
28
39
  opts?: RequestOptions,
29
40
  ) {
30
- return this.call<T>("app.rocksky.feed.getFeedGenerators", "GET", {
41
+ return this.call("app.rocksky.feed.getFeedGenerators", "GET", {
31
42
  params,
32
43
  ...opts,
33
44
  });
34
45
  }
35
46
 
36
- getFeedGenerator<T = unknown>(
37
- params: { feed: string },
47
+ getFeedGenerator(
48
+ params: GetFeedGeneratorParams,
38
49
  opts?: RequestOptions,
39
50
  ) {
40
- return this.call<T>("app.rocksky.feed.getFeedGenerator", "GET", {
51
+ return this.call("app.rocksky.feed.getFeedGenerator", "GET", {
41
52
  params,
42
53
  ...opts,
43
54
  });
44
55
  }
45
56
 
46
- describeFeedGenerator<T = unknown>(opts?: RequestOptions) {
47
- return this.call<T>("app.rocksky.feed.describeFeedGenerator", "GET", {
57
+ describeFeedGenerator(opts?: RequestOptions) {
58
+ return this.call("app.rocksky.feed.describeFeedGenerator", "GET", {
48
59
  ...opts,
49
60
  });
50
61
  }
51
62
 
52
- getFeedSkeleton<T = unknown>(
53
- params: {
54
- feed: string;
55
- limit?: number;
56
- offset?: number;
57
- cursor?: string;
58
- },
63
+ getFeedSkeleton(
64
+ params: GetFeedSkeletonParams,
59
65
  opts?: RequestOptions,
60
66
  ) {
61
- return this.call<T>("app.rocksky.feed.getFeedSkeleton", "GET", {
67
+ return this.call("app.rocksky.feed.getFeedSkeleton", "GET", {
62
68
  params,
63
69
  ...opts,
64
70
  });
65
71
  }
66
72
 
67
- getRecommendations<T = unknown>(
68
- params: RecommendParams,
73
+ getRecommendations(
74
+ params: GetRecommendationsParams,
69
75
  opts?: RequestOptions,
70
76
  ) {
71
- return this.call<T>("app.rocksky.feed.getRecommendations", "GET", {
77
+ return this.call("app.rocksky.feed.getRecommendations", "GET", {
72
78
  params,
73
79
  ...opts,
74
80
  });
75
81
  }
76
82
 
77
- getArtistRecommendations<T = unknown>(
78
- params: RecommendParams,
83
+ getArtistRecommendations(
84
+ params: GetArtistRecommendationsParams,
79
85
  opts?: RequestOptions,
80
86
  ) {
81
- return this.call<T>("app.rocksky.feed.getArtistRecommendations", "GET", {
87
+ return this.call("app.rocksky.feed.getArtistRecommendations", "GET", {
82
88
  params,
83
89
  ...opts,
84
90
  });
85
91
  }
86
92
 
87
- getAlbumRecommendations<T = unknown>(
88
- params: RecommendParams,
93
+ getAlbumRecommendations(
94
+ params: GetAlbumRecommendationsParams,
89
95
  opts?: RequestOptions,
90
96
  ) {
91
- return this.call<T>("app.rocksky.feed.getAlbumRecommendations", "GET", {
97
+ return this.call("app.rocksky.feed.getAlbumRecommendations", "GET", {
92
98
  params,
93
99
  ...opts,
94
100
  });
95
101
  }
96
102
 
97
- getStories<T = unknown>(
98
- params: { size?: number } = {},
103
+ getStories(
104
+ params: GetStoriesParams = {},
99
105
  opts?: RequestOptions,
100
106
  ) {
101
- return this.call<T>("app.rocksky.feed.getStories", "GET", {
107
+ return this.call("app.rocksky.feed.getStories", "GET", {
102
108
  params,
103
109
  ...opts,
104
110
  });
@@ -1,33 +1,38 @@
1
- import type { Call } from "./_helpers";
2
- import type { RequestOptions } from "../types";
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";
3
8
 
4
9
  export class GoogleDriveNamespace {
5
10
  constructor(private readonly call: Call) {}
6
11
 
7
- getFile<T = unknown>(params: { fileId: string }, opts?: RequestOptions) {
8
- return this.call<T>("app.rocksky.googledrive.getFile", "GET", {
12
+ getFile(params: GetFileParams, opts?: RequestOptions) {
13
+ return this.call("app.rocksky.googledrive.getFile", "GET", {
9
14
  params,
10
15
  requireAuth: true,
11
16
  ...opts,
12
17
  });
13
18
  }
14
19
 
15
- getFiles<T = unknown>(
16
- params: { at?: string } = {},
20
+ getFiles(
21
+ params: GetFilesParams = {},
17
22
  opts?: RequestOptions,
18
23
  ) {
19
- return this.call<T>("app.rocksky.googledrive.getFiles", "GET", {
24
+ return this.call("app.rocksky.googledrive.getFiles", "GET", {
20
25
  params,
21
26
  requireAuth: true,
22
27
  ...opts,
23
28
  });
24
29
  }
25
30
 
26
- downloadFile<T = unknown>(
27
- params: { fileId: string },
31
+ downloadFile(
32
+ params: DownloadFileParams,
28
33
  opts?: RequestOptions,
29
34
  ) {
30
- return this.call<T>("app.rocksky.googledrive.downloadFile", "GET", {
35
+ return this.call("app.rocksky.googledrive.downloadFile", "GET", {
31
36
  params,
32
37
  requireAuth: true,
33
38
  ...opts,
@@ -1,61 +1,60 @@
1
- import type { Call } from "./_helpers";
2
- import type { RequestOptions } from "../types";
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";
3
10
 
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
- };
11
+ export type FollowListParams = GetFollowersParams;
12
+ export type KnownFollowersParams = GetKnownFollowersParams;
14
13
 
15
14
  export class GraphNamespace {
16
15
  constructor(private readonly call: Call) {}
17
16
 
18
- followAccount<T = unknown>(
19
- params: { account: string },
17
+ followAccount(
18
+ params: FollowAccountParams,
20
19
  opts?: RequestOptions,
21
20
  ) {
22
- return this.call<T>("app.rocksky.graph.followAccount", "POST", {
21
+ return this.call("app.rocksky.graph.followAccount", "POST", {
23
22
  params,
24
23
  requireAuth: true,
25
24
  ...opts,
26
25
  });
27
26
  }
28
27
 
29
- unfollowAccount<T = unknown>(
30
- params: { account: string },
28
+ unfollowAccount(
29
+ params: UnfollowAccountParams,
31
30
  opts?: RequestOptions,
32
31
  ) {
33
- return this.call<T>("app.rocksky.graph.unfollowAccount", "POST", {
32
+ return this.call("app.rocksky.graph.unfollowAccount", "POST", {
34
33
  params,
35
34
  requireAuth: true,
36
35
  ...opts,
37
36
  });
38
37
  }
39
38
 
40
- getFollowers<T = unknown>(params: FollowListParams, opts?: RequestOptions) {
41
- return this.call<T>("app.rocksky.graph.getFollowers", "GET", {
39
+ getFollowers(params: GetFollowersParams, opts?: RequestOptions) {
40
+ return this.call("app.rocksky.graph.getFollowers", "GET", {
42
41
  params,
43
42
  ...opts,
44
43
  });
45
44
  }
46
45
 
47
- getFollows<T = unknown>(params: FollowListParams, opts?: RequestOptions) {
48
- return this.call<T>("app.rocksky.graph.getFollows", "GET", {
46
+ getFollows(params: GetFollowsParams, opts?: RequestOptions) {
47
+ return this.call("app.rocksky.graph.getFollows", "GET", {
49
48
  params,
50
49
  ...opts,
51
50
  });
52
51
  }
53
52
 
54
- getKnownFollowers<T = unknown>(
55
- params: KnownFollowersParams,
53
+ getKnownFollowers(
54
+ params: GetKnownFollowersParams,
56
55
  opts?: RequestOptions,
57
56
  ) {
58
- return this.call<T>("app.rocksky.graph.getKnownFollowers", "GET", {
57
+ return this.call("app.rocksky.graph.getKnownFollowers", "GET", {
59
58
  params,
60
59
  ...opts,
61
60
  });
@@ -1,37 +1,43 @@
1
- import type { Call } from "./_helpers";
2
- import type { RequestOptions } from "../types";
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";
3
9
 
4
- export type LikeInput = { uri?: string };
10
+ export type LikeInput = LikeSongInput;
5
11
 
6
12
  export class LikeNamespace {
7
13
  constructor(private readonly call: Call) {}
8
14
 
9
- likeSong<T = unknown>(input: LikeInput = {}, opts?: RequestOptions) {
10
- return this.call<T>("app.rocksky.like.likeSong", "POST", {
15
+ likeSong(input: LikeSongInput = {}, opts?: RequestOptions) {
16
+ return this.call("app.rocksky.like.likeSong", "POST", {
11
17
  body: input,
12
18
  requireAuth: true,
13
19
  ...opts,
14
20
  });
15
21
  }
16
22
 
17
- dislikeSong<T = unknown>(input: LikeInput = {}, opts?: RequestOptions) {
18
- return this.call<T>("app.rocksky.like.dislikeSong", "POST", {
23
+ dislikeSong(input: DislikeSongInput = {}, opts?: RequestOptions) {
24
+ return this.call("app.rocksky.like.dislikeSong", "POST", {
19
25
  body: input,
20
26
  requireAuth: true,
21
27
  ...opts,
22
28
  });
23
29
  }
24
30
 
25
- likeShout<T = unknown>(input: LikeInput = {}, opts?: RequestOptions) {
26
- return this.call<T>("app.rocksky.like.likeShout", "POST", {
31
+ likeShout(input: LikeShoutInput = {}, opts?: RequestOptions) {
32
+ return this.call("app.rocksky.like.likeShout", "POST", {
27
33
  body: input,
28
34
  requireAuth: true,
29
35
  ...opts,
30
36
  });
31
37
  }
32
38
 
33
- dislikeShout<T = unknown>(input: LikeInput = {}, opts?: RequestOptions) {
34
- return this.call<T>("app.rocksky.like.dislikeShout", "POST", {
39
+ dislikeShout(input: DislikeShoutInput = {}, opts?: RequestOptions) {
40
+ return this.call("app.rocksky.like.dislikeShout", "POST", {
35
41
  body: input,
36
42
  requireAuth: true,
37
43
  ...opts,
@@ -1,28 +1,24 @@
1
- import type { Call } from "./_helpers";
2
- import type { RequestOptions } from "../types";
1
+ import type { PutMirrorSourceInput } from "../generated/types.js";
2
+ import type { RequestOptions } from "../types.js";
3
+ import type { Call } from "./_helpers.js";
3
4
 
4
- export type PutMirrorSourceInput = {
5
- provider: string;
6
- enabled?: boolean;
7
- externalUsername?: string;
8
- apiKey?: string;
9
- };
5
+ export type { PutMirrorSourceInput };
10
6
 
11
7
  export class MirrorNamespace {
12
8
  constructor(private readonly call: Call) {}
13
9
 
14
- getMirrorSources<T = unknown>(opts?: RequestOptions) {
15
- return this.call<T>("app.rocksky.mirror.getMirrorSources", "GET", {
10
+ getMirrorSources(opts?: RequestOptions) {
11
+ return this.call("app.rocksky.mirror.getMirrorSources", "GET", {
16
12
  requireAuth: true,
17
13
  ...opts,
18
14
  });
19
15
  }
20
16
 
21
- putMirrorSource<T = unknown>(
17
+ putMirrorSource(
22
18
  input: PutMirrorSourceInput,
23
19
  opts?: RequestOptions,
24
20
  ) {
25
- return this.call<T>("app.rocksky.mirror.putMirrorSource", "POST", {
21
+ return this.call("app.rocksky.mirror.putMirrorSource", "POST", {
26
22
  body: input,
27
23
  requireAuth: true,
28
24
  ...opts,
@@ -1,125 +1,123 @@
1
- import type { Call } from "./_helpers";
2
- import type { RequestOptions } from "../types";
3
-
4
- type PlayerId = { playerId?: string };
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";
5
16
 
6
17
  export class PlayerNamespace {
7
18
  constructor(private readonly call: Call) {}
8
19
 
9
- getCurrentlyPlaying<T = unknown>(
10
- params: PlayerId & { actor?: string } = {},
20
+ getCurrentlyPlaying(
21
+ params: GetCurrentlyPlayingParams = {},
11
22
  opts?: RequestOptions,
12
23
  ) {
13
- return this.call<T>("app.rocksky.player.getCurrentlyPlaying", "GET", {
24
+ return this.call("app.rocksky.player.getCurrentlyPlaying", "GET", {
14
25
  params,
15
26
  ...opts,
16
27
  });
17
28
  }
18
29
 
19
- getPlaybackQueue<T = unknown>(
20
- params: PlayerId = {},
30
+ getPlaybackQueue(
31
+ params: GetPlaybackQueueParams = {},
21
32
  opts?: RequestOptions,
22
33
  ) {
23
- return this.call<T>("app.rocksky.player.getPlaybackQueue", "GET", {
34
+ return this.call("app.rocksky.player.getPlaybackQueue", "GET", {
24
35
  params,
25
36
  ...opts,
26
37
  });
27
38
  }
28
39
 
29
- play<T = unknown>(params: PlayerId = {}, opts?: RequestOptions) {
30
- return this.call<T>("app.rocksky.player.play", "POST", {
40
+ play(params: PlayParams = {}, opts?: RequestOptions) {
41
+ return this.call("app.rocksky.player.play", "POST", {
31
42
  params,
32
43
  requireAuth: true,
33
44
  ...opts,
34
45
  });
35
46
  }
36
47
 
37
- pause<T = unknown>(params: PlayerId = {}, opts?: RequestOptions) {
38
- return this.call<T>("app.rocksky.player.pause", "POST", {
48
+ pause(params: PauseParams = {}, opts?: RequestOptions) {
49
+ return this.call("app.rocksky.player.pause", "POST", {
39
50
  params,
40
51
  requireAuth: true,
41
52
  ...opts,
42
53
  });
43
54
  }
44
55
 
45
- next<T = unknown>(params: PlayerId = {}, opts?: RequestOptions) {
46
- return this.call<T>("app.rocksky.player.next", "POST", {
56
+ next(params: NextParams = {}, opts?: RequestOptions) {
57
+ return this.call("app.rocksky.player.next", "POST", {
47
58
  params,
48
59
  requireAuth: true,
49
60
  ...opts,
50
61
  });
51
62
  }
52
63
 
53
- previous<T = unknown>(params: PlayerId = {}, opts?: RequestOptions) {
54
- return this.call<T>("app.rocksky.player.previous", "POST", {
64
+ previous(params: PreviousParams = {}, opts?: RequestOptions) {
65
+ return this.call("app.rocksky.player.previous", "POST", {
55
66
  params,
56
67
  requireAuth: true,
57
68
  ...opts,
58
69
  });
59
70
  }
60
71
 
61
- seek<T = unknown>(
62
- params: PlayerId & { position: number },
72
+ seek(
73
+ params: SeekParams,
63
74
  opts?: RequestOptions,
64
75
  ) {
65
- return this.call<T>("app.rocksky.player.seek", "POST", {
76
+ return this.call("app.rocksky.player.seek", "POST", {
66
77
  params,
67
78
  requireAuth: true,
68
79
  ...opts,
69
80
  });
70
81
  }
71
82
 
72
- playFile<T = unknown>(
73
- params: PlayerId & { fileId: string },
83
+ playFile(
84
+ params: PlayFileParams,
74
85
  opts?: RequestOptions,
75
86
  ) {
76
- return this.call<T>("app.rocksky.player.playFile", "POST", {
87
+ return this.call("app.rocksky.player.playFile", "POST", {
77
88
  params,
78
89
  requireAuth: true,
79
90
  ...opts,
80
91
  });
81
92
  }
82
93
 
83
- playDirectory<T = unknown>(
84
- params: PlayerId & {
85
- directoryId: string;
86
- shuffle?: boolean;
87
- recurse?: boolean;
88
- position?: number;
89
- },
94
+ playDirectory(
95
+ params: PlayDirectoryParams,
90
96
  opts?: RequestOptions,
91
97
  ) {
92
- return this.call<T>("app.rocksky.player.playDirectory", "POST", {
98
+ return this.call("app.rocksky.player.playDirectory", "POST", {
93
99
  params,
94
100
  requireAuth: true,
95
101
  ...opts,
96
102
  });
97
103
  }
98
104
 
99
- addItemsToQueue<T = unknown>(
100
- params: PlayerId & {
101
- items: string[];
102
- position?: number;
103
- shuffle?: boolean;
104
- },
105
+ addItemsToQueue(
106
+ params: AddItemsToQueueParams,
105
107
  opts?: RequestOptions,
106
108
  ) {
107
- return this.call<T>("app.rocksky.player.addItemsToQueue", "POST", {
109
+ return this.call("app.rocksky.player.addItemsToQueue", "POST", {
108
110
  params,
109
111
  requireAuth: true,
110
112
  ...opts,
111
113
  });
112
114
  }
113
115
 
114
- addDirectoryToQueue<T = unknown>(
115
- params: PlayerId & {
116
- directory: string;
117
- position?: number;
118
- shuffle?: boolean;
119
- },
116
+ addDirectoryToQueue(
117
+ params: AddDirectoryToQueueParams,
120
118
  opts?: RequestOptions,
121
119
  ) {
122
- return this.call<T>("app.rocksky.player.addDirectoryToQueue", "POST", {
120
+ return this.call("app.rocksky.player.addDirectoryToQueue", "POST", {
123
121
  params,
124
122
  ...opts,
125
123
  });
@@ -1,83 +1,93 @@
1
- import type { Call } from "./_helpers";
2
- import type { RequestOptions } from "../types";
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";
3
13
 
4
14
  export class PlaylistNamespace {
5
15
  constructor(private readonly call: Call) {}
6
16
 
7
- getPlaylists<T = unknown>(
8
- params: { limit?: number; offset?: number } = {},
17
+ getPlaylists(
18
+ params: GetPlaylistsParams = {},
9
19
  opts?: RequestOptions,
10
20
  ) {
11
- return this.call<T>("app.rocksky.playlist.getPlaylists", "GET", {
21
+ return this.call("app.rocksky.playlist.getPlaylists", "GET", {
12
22
  params,
13
23
  ...opts,
14
24
  });
15
25
  }
16
26
 
17
- getPlaylist<T = unknown>(params: { uri: string }, opts?: RequestOptions) {
18
- return this.call<T>("app.rocksky.playlist.getPlaylist", "GET", {
27
+ getPlaylist(params: GetPlaylistParams, opts?: RequestOptions) {
28
+ return this.call("app.rocksky.playlist.getPlaylist", "GET", {
19
29
  params,
20
30
  ...opts,
21
31
  });
22
32
  }
23
33
 
24
- createPlaylist<T = unknown>(
25
- params: { name: string; description?: string },
34
+ createPlaylist(
35
+ params: CreatePlaylistParams,
26
36
  opts?: RequestOptions,
27
37
  ) {
28
- return this.call<T>("app.rocksky.playlist.createPlaylist", "POST", {
38
+ return this.call("app.rocksky.playlist.createPlaylist", "POST", {
29
39
  params,
30
40
  requireAuth: true,
31
41
  ...opts,
32
42
  });
33
43
  }
34
44
 
35
- removePlaylist<T = unknown>(params: { uri: string }, opts?: RequestOptions) {
36
- return this.call<T>("app.rocksky.playlist.removePlaylist", "POST", {
45
+ removePlaylist(params: RemovePlaylistParams, opts?: RequestOptions) {
46
+ return this.call("app.rocksky.playlist.removePlaylist", "POST", {
37
47
  params,
38
48
  requireAuth: true,
39
49
  ...opts,
40
50
  });
41
51
  }
42
52
 
43
- startPlaylist<T = unknown>(
44
- params: { uri: string; shuffle?: boolean; position?: number },
53
+ startPlaylist(
54
+ params: StartPlaylistParams,
45
55
  opts?: RequestOptions,
46
56
  ) {
47
- return this.call<T>("app.rocksky.playlist.startPlaylist", "POST", {
57
+ return this.call("app.rocksky.playlist.startPlaylist", "POST", {
48
58
  params,
49
59
  requireAuth: true,
50
60
  ...opts,
51
61
  });
52
62
  }
53
63
 
54
- insertDirectory<T = unknown>(
55
- params: { uri: string; directory: string; position?: number },
64
+ insertDirectory(
65
+ params: InsertDirectoryParams,
56
66
  opts?: RequestOptions,
57
67
  ) {
58
- return this.call<T>("app.rocksky.playlist.insertDirectory", "POST", {
68
+ return this.call("app.rocksky.playlist.insertDirectory", "POST", {
59
69
  params,
60
70
  requireAuth: true,
61
71
  ...opts,
62
72
  });
63
73
  }
64
74
 
65
- insertFiles<T = unknown>(
66
- params: { uri: string; files: string[]; position?: number },
75
+ insertFiles(
76
+ params: InsertFilesParams,
67
77
  opts?: RequestOptions,
68
78
  ) {
69
- return this.call<T>("app.rocksky.playlist.insertFiles", "POST", {
79
+ return this.call("app.rocksky.playlist.insertFiles", "POST", {
70
80
  params,
71
81
  requireAuth: true,
72
82
  ...opts,
73
83
  });
74
84
  }
75
85
 
76
- removeTrack<T = unknown>(
77
- params: { uri: string; position: number },
86
+ removeTrack(
87
+ params: RemoveTrackParams,
78
88
  opts?: RequestOptions,
79
89
  ) {
80
- return this.call<T>("app.rocksky.playlist.removeTrack", "POST", {
90
+ return this.call("app.rocksky.playlist.removeTrack", "POST", {
81
91
  params,
82
92
  ...opts,
83
93
  });