@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
package/src/http.ts CHANGED
@@ -2,16 +2,16 @@ import {
2
2
  RockskyAuthError,
3
3
  RockskyHttpError,
4
4
  RockskyTimeoutError,
5
- } from "./errors";
5
+ } from "./errors.js";
6
6
  import {
7
7
  type AuthProvider,
8
8
  DEFAULT_BASE_URL,
9
9
  type FetchLike,
10
10
  type RequestOptions,
11
- } from "./types";
11
+ } from "./types.js";
12
12
 
13
13
  export type XrpcCallOptions = RequestOptions & {
14
- params?: Record<string, unknown>;
14
+ params?: object;
15
15
  body?: unknown;
16
16
  requireAuth?: boolean;
17
17
  };
@@ -65,11 +65,11 @@ async function resolveAuth(
65
65
  }
66
66
 
67
67
  export function serializeParams(
68
- params: Record<string, unknown> | undefined,
68
+ params: object | undefined,
69
69
  ): string {
70
70
  if (!params) return "";
71
71
  const usp = new URLSearchParams();
72
- for (const [k, v] of Object.entries(params)) {
72
+ for (const [k, v] of Object.entries(params as Record<string, unknown>)) {
73
73
  if (v == null) continue;
74
74
  if (Array.isArray(v)) {
75
75
  for (const item of v) {
package/src/index.ts CHANGED
@@ -2,13 +2,13 @@ export {
2
2
  RockskyClient,
3
3
  RockskyClientBuilder,
4
4
  createClient,
5
- } from "./client";
5
+ } from "./client.js";
6
6
  export {
7
7
  RockskyError,
8
8
  RockskyHttpError,
9
9
  RockskyTimeoutError,
10
10
  RockskyAuthError,
11
- } from "./errors";
11
+ } from "./errors.js";
12
12
  export {
13
13
  pipe,
14
14
  map,
@@ -18,7 +18,7 @@ export {
18
18
  withFallback,
19
19
  catchError,
20
20
  type Op,
21
- } from "./pipe";
21
+ } from "./pipe.js";
22
22
  export {
23
23
  DEFAULT_BASE_URL,
24
24
  type AuthProvider,
@@ -27,13 +27,13 @@ export {
27
27
  type Json,
28
28
  type Pagination,
29
29
  type RequestOptions,
30
- } from "./types";
30
+ } from "./types.js";
31
31
  export {
32
32
  paginate,
33
33
  type PageOpts,
34
34
  type PageResult,
35
35
  type PaginateArgs,
36
- } from "./paginate";
36
+ } from "./paginate.js";
37
37
  export {
38
38
  RealtimeClient,
39
39
  RealtimeClientBuilder,
@@ -44,42 +44,42 @@ export {
44
44
  type ReconnectOptions,
45
45
  type WebSocketCtor,
46
46
  type WebSocketLike,
47
- } from "./realtime";
47
+ } from "./realtime.js";
48
48
 
49
49
  export type {
50
50
  GetProfileParams,
51
51
  ActorPagedParams,
52
52
  ActorRangeParams,
53
- } from "./namespaces/actor";
53
+ } from "./namespaces/actor.js";
54
54
  export type {
55
55
  CreateScrobbleInput,
56
56
  GetScrobblesParams,
57
- } from "./namespaces/scrobble";
57
+ } from "./namespaces/scrobble.js";
58
58
  export type {
59
59
  GetSongParams,
60
60
  GetSongsParams,
61
61
  MatchSongParams,
62
62
  CreateSongInput,
63
- } from "./namespaces/song";
64
- export type { GetAlbumsParams } from "./namespaces/album";
63
+ } from "./namespaces/song.js";
64
+ export type { GetAlbumsParams } from "./namespaces/album.js";
65
65
  export type {
66
66
  GetArtistsParams,
67
67
  ArtistListenersParams,
68
68
  GetArtistTracksParams,
69
- } from "./namespaces/artist";
69
+ } from "./namespaces/artist.js";
70
70
  export type {
71
71
  ListApikeysParams,
72
72
  CreateApikeyInput,
73
73
  UpdateApikeyInput,
74
- } from "./namespaces/apikey";
74
+ } from "./namespaces/apikey.js";
75
75
  export type {
76
76
  ScrobblesChartParams,
77
77
  TopChartParams,
78
- } from "./namespaces/charts";
78
+ } from "./namespaces/charts.js";
79
79
  export type {
80
80
  FollowListParams,
81
81
  KnownFollowersParams,
82
- } from "./namespaces/graph";
83
- export type { RecommendParams } from "./namespaces/feed";
84
- export type { LikeInput } from "./namespaces/like";
85
- export type { PutMirrorSourceInput } from "./namespaces/mirror";
82
+ } from "./namespaces/graph.js";
83
+ export type { RecommendParams } from "./namespaces/feed.js";
84
+ export type { LikeInput } from "./namespaces/like.js";
85
+ export type { PutMirrorSourceInput } from "./namespaces/mirror.js";
@@ -1,17 +1,27 @@
1
- import { type HttpClientConfig, xrpcCall } from "../http";
2
- import type { RequestOptions } from "../types";
1
+ import { type HttpClientConfig, xrpcCall } from "../http.js";
2
+ import type { RequestOptions } from "../types.js";
3
+ import type { Endpoints } from "../generated/types.js";
3
4
 
4
- export type Call = <T>(
5
- nsid: string,
6
- method: "GET" | "POST",
7
- opts?: {
8
- params?: Record<string, unknown>;
9
- body?: unknown;
10
- requireAuth?: boolean;
11
- } & RequestOptions,
12
- ) => Promise<T>;
5
+ type CallOpts = {
6
+ params?: object;
7
+ body?: unknown;
8
+ requireAuth?: boolean;
9
+ } & RequestOptions;
10
+
11
+ export interface Call {
12
+ <K extends keyof Endpoints>(
13
+ nsid: K,
14
+ method: "GET" | "POST",
15
+ opts?: CallOpts,
16
+ ): Promise<Endpoints[K]>;
17
+ <T = unknown>(
18
+ nsid: string,
19
+ method: "GET" | "POST",
20
+ opts?: CallOpts,
21
+ ): Promise<T>;
22
+ }
13
23
 
14
24
  export function makeCall(config: HttpClientConfig): Call {
15
- return (nsid, method, opts) =>
16
- xrpcCall(config, nsid, method, opts ?? {});
25
+ return ((nsid: string, method: "GET" | "POST", opts?: CallOpts) =>
26
+ xrpcCall(config, nsid, method, opts ?? {})) as Call;
17
27
  }
@@ -1,87 +1,91 @@
1
- import type { Call } from "./_helpers";
2
- import type { RequestOptions } from "../types";
1
+ import type {
2
+ GetActorAlbumsParams,
3
+ GetActorArtistsParams,
4
+ GetActorCompatibilityParams,
5
+ GetActorLovedSongsParams,
6
+ GetActorNeighboursParams,
7
+ GetActorPlaylistsParams,
8
+ GetActorScrobblesParams,
9
+ GetActorSongsParams,
10
+ GetProfileParams,
11
+ } from "../generated/types.js";
12
+ import type { RequestOptions } from "../types.js";
13
+ import type { Call } from "./_helpers.js";
3
14
 
4
- export type GetProfileParams = { did?: string };
5
- export type DidParam = { did: string };
6
- export type ActorPagedParams = DidParam & {
7
- limit?: number;
8
- offset?: number;
9
- };
10
- export type ActorRangeParams = ActorPagedParams & {
11
- startDate?: string;
12
- endDate?: string;
13
- };
15
+ export type { GetProfileParams };
16
+ export type ActorPagedParams = GetActorScrobblesParams;
17
+ export type ActorRangeParams = GetActorAlbumsParams;
14
18
 
15
19
  export class ActorNamespace {
16
20
  constructor(private readonly call: Call) {}
17
21
 
18
- getProfile<T = unknown>(params: GetProfileParams = {}, opts?: RequestOptions) {
19
- return this.call<T>("app.rocksky.actor.getProfile", "GET", {
22
+ getProfile(params: GetProfileParams = {}, opts?: RequestOptions) {
23
+ return this.call("app.rocksky.actor.getProfile", "GET", {
20
24
  params,
21
25
  ...opts,
22
26
  });
23
27
  }
24
28
 
25
- getActorAlbums<T = unknown>(params: ActorRangeParams, opts?: RequestOptions) {
26
- return this.call<T>("app.rocksky.actor.getActorAlbums", "GET", {
29
+ getActorAlbums(params: GetActorAlbumsParams, opts?: RequestOptions) {
30
+ return this.call("app.rocksky.actor.getActorAlbums", "GET", {
27
31
  params,
28
32
  ...opts,
29
33
  });
30
34
  }
31
35
 
32
- getActorArtists<T = unknown>(params: ActorRangeParams, opts?: RequestOptions) {
33
- return this.call<T>("app.rocksky.actor.getActorArtists", "GET", {
36
+ getActorArtists(params: GetActorArtistsParams, opts?: RequestOptions) {
37
+ return this.call("app.rocksky.actor.getActorArtists", "GET", {
34
38
  params,
35
39
  ...opts,
36
40
  });
37
41
  }
38
42
 
39
- getActorSongs<T = unknown>(params: ActorRangeParams, opts?: RequestOptions) {
40
- return this.call<T>("app.rocksky.actor.getActorSongs", "GET", {
43
+ getActorSongs(params: GetActorSongsParams, opts?: RequestOptions) {
44
+ return this.call("app.rocksky.actor.getActorSongs", "GET", {
41
45
  params,
42
46
  ...opts,
43
47
  });
44
48
  }
45
49
 
46
- getActorScrobbles<T = unknown>(
47
- params: ActorPagedParams,
50
+ getActorScrobbles(
51
+ params: GetActorScrobblesParams,
48
52
  opts?: RequestOptions,
49
53
  ) {
50
- return this.call<T>("app.rocksky.actor.getActorScrobbles", "GET", {
54
+ return this.call("app.rocksky.actor.getActorScrobbles", "GET", {
51
55
  params,
52
56
  ...opts,
53
57
  });
54
58
  }
55
59
 
56
- getActorLovedSongs<T = unknown>(
57
- params: ActorPagedParams,
60
+ getActorLovedSongs(
61
+ params: GetActorLovedSongsParams,
58
62
  opts?: RequestOptions,
59
63
  ) {
60
- return this.call<T>("app.rocksky.actor.getActorLovedSongs", "GET", {
64
+ return this.call("app.rocksky.actor.getActorLovedSongs", "GET", {
61
65
  params,
62
66
  ...opts,
63
67
  });
64
68
  }
65
69
 
66
- getActorPlaylists<T = unknown>(
67
- params: ActorPagedParams,
70
+ getActorPlaylists(
71
+ params: GetActorPlaylistsParams,
68
72
  opts?: RequestOptions,
69
73
  ) {
70
- return this.call<T>("app.rocksky.actor.getActorPlaylists", "GET", {
74
+ return this.call("app.rocksky.actor.getActorPlaylists", "GET", {
71
75
  params,
72
76
  ...opts,
73
77
  });
74
78
  }
75
79
 
76
- getActorNeighbours<T = unknown>(params: DidParam, opts?: RequestOptions) {
77
- return this.call<T>("app.rocksky.actor.getActorNeighbours", "GET", {
80
+ getActorNeighbours(params: GetActorNeighboursParams, opts?: RequestOptions) {
81
+ return this.call("app.rocksky.actor.getActorNeighbours", "GET", {
78
82
  params,
79
83
  ...opts,
80
84
  });
81
85
  }
82
86
 
83
- getActorCompatibility<T = unknown>(params: DidParam, opts?: RequestOptions) {
84
- return this.call<T>("app.rocksky.actor.getActorCompatibility", "GET", {
87
+ getActorCompatibility(params: GetActorCompatibilityParams, opts?: RequestOptions) {
88
+ return this.call("app.rocksky.actor.getActorCompatibility", "GET", {
85
89
  params,
86
90
  ...opts,
87
91
  });
@@ -1,32 +1,32 @@
1
- import type { Call } from "./_helpers";
2
- import type { RequestOptions } from "../types";
1
+ import type {
2
+ GetAlbumParams,
3
+ GetAlbumsParams,
4
+ GetAlbumTracksParams,
5
+ } from "../generated/types.js";
6
+ import type { RequestOptions } from "../types.js";
7
+ import type { Call } from "./_helpers.js";
3
8
 
4
- export type UriParam = { uri: string };
5
- export type GetAlbumsParams = {
6
- limit?: number;
7
- offset?: number;
8
- genre?: string;
9
- };
9
+ export type { GetAlbumsParams };
10
10
 
11
11
  export class AlbumNamespace {
12
12
  constructor(private readonly call: Call) {}
13
13
 
14
- getAlbum<T = unknown>(params: UriParam, opts?: RequestOptions) {
15
- return this.call<T>("app.rocksky.album.getAlbum", "GET", {
14
+ getAlbum(params: GetAlbumParams, opts?: RequestOptions) {
15
+ return this.call("app.rocksky.album.getAlbum", "GET", {
16
16
  params,
17
17
  ...opts,
18
18
  });
19
19
  }
20
20
 
21
- getAlbums<T = unknown>(params: GetAlbumsParams = {}, opts?: RequestOptions) {
22
- return this.call<T>("app.rocksky.album.getAlbums", "GET", {
21
+ getAlbums(params: GetAlbumsParams = {}, opts?: RequestOptions) {
22
+ return this.call("app.rocksky.album.getAlbums", "GET", {
23
23
  params,
24
24
  ...opts,
25
25
  });
26
26
  }
27
27
 
28
- getAlbumTracks<T = unknown>(params: UriParam, opts?: RequestOptions) {
29
- return this.call<T>("app.rocksky.album.getAlbumTracks", "GET", {
28
+ getAlbumTracks(params: GetAlbumTracksParams, opts?: RequestOptions) {
29
+ return this.call("app.rocksky.album.getAlbumTracks", "GET", {
30
30
  params,
31
31
  ...opts,
32
32
  });
@@ -1,47 +1,47 @@
1
- import type { Call } from "./_helpers";
2
- import type { RequestOptions } from "../types";
1
+ import type {
2
+ CreateApikeyInput,
3
+ GetApikeysParams,
4
+ RemoveApikeyParams,
5
+ UpdateApikeyInput,
6
+ } from "../generated/types.js";
7
+ import type { RequestOptions } from "../types.js";
8
+ import type { Call } from "./_helpers.js";
3
9
 
4
- export type ListApikeysParams = { limit?: number; offset?: number };
5
- export type CreateApikeyInput = { name: string; description?: string };
6
- export type UpdateApikeyInput = {
7
- id: string;
8
- name: string;
9
- description?: string;
10
- };
11
- export type RemoveApikeyParams = { id: string };
10
+ export type { CreateApikeyInput, UpdateApikeyInput };
11
+ export type ListApikeysParams = GetApikeysParams;
12
12
 
13
13
  export class ApikeyNamespace {
14
14
  constructor(private readonly call: Call) {}
15
15
 
16
- getApikeys<T = unknown>(
16
+ getApikeys(
17
17
  params: ListApikeysParams = {},
18
18
  opts?: RequestOptions,
19
19
  ) {
20
- return this.call<T>("app.rocksky.apikey.getApikeys", "GET", {
20
+ return this.call("app.rocksky.apikey.getApikeys", "GET", {
21
21
  params,
22
22
  requireAuth: true,
23
23
  ...opts,
24
24
  });
25
25
  }
26
26
 
27
- createApikey<T = unknown>(input: CreateApikeyInput, opts?: RequestOptions) {
28
- return this.call<T>("app.rocksky.apikey.createApikey", "POST", {
27
+ createApikey(input: CreateApikeyInput, opts?: RequestOptions) {
28
+ return this.call("app.rocksky.apikey.createApikey", "POST", {
29
29
  body: input,
30
30
  requireAuth: true,
31
31
  ...opts,
32
32
  });
33
33
  }
34
34
 
35
- updateApikey<T = unknown>(input: UpdateApikeyInput, opts?: RequestOptions) {
36
- return this.call<T>("app.rocksky.apikey.updateApikey", "POST", {
35
+ updateApikey(input: UpdateApikeyInput, opts?: RequestOptions) {
36
+ return this.call("app.rocksky.apikey.updateApikey", "POST", {
37
37
  body: input,
38
38
  requireAuth: true,
39
39
  ...opts,
40
40
  });
41
41
  }
42
42
 
43
- removeApikey<T = unknown>(params: RemoveApikeyParams, opts?: RequestOptions) {
44
- return this.call<T>("app.rocksky.apikey.removeApikey", "POST", {
43
+ removeApikey(params: RemoveApikeyParams, opts?: RequestOptions) {
44
+ return this.call("app.rocksky.apikey.removeApikey", "POST", {
45
45
  params,
46
46
  requireAuth: true,
47
47
  ...opts,
@@ -1,72 +1,66 @@
1
- import type { Call } from "./_helpers";
2
- import type { RequestOptions } from "../types";
1
+ import type {
2
+ GetArtistAlbumsParams,
3
+ GetArtistListenersParams,
4
+ GetArtistParams,
5
+ GetArtistRecentListenersParams,
6
+ GetArtistsParams,
7
+ GetArtistTracksParams,
8
+ } from "../generated/types.js";
9
+ import type { RequestOptions } from "../types.js";
10
+ import type { Call } from "./_helpers.js";
3
11
 
4
- export type UriParam = { uri: string };
5
- export type ArtistListenersParams = UriParam & {
6
- limit?: number;
7
- offset?: number;
8
- };
9
- export type GetArtistsParams = {
10
- limit?: number;
11
- offset?: number;
12
- names?: string;
13
- genre?: string;
14
- };
15
- export type GetArtistTracksParams = {
16
- uri?: string;
17
- limit?: number;
18
- offset?: number;
19
- };
12
+ export type { GetArtistsParams, GetArtistTracksParams };
13
+ export type ArtistListenersParams = GetArtistListenersParams;
20
14
 
21
15
  export class ArtistNamespace {
22
16
  constructor(private readonly call: Call) {}
23
17
 
24
- getArtist<T = unknown>(params: UriParam, opts?: RequestOptions) {
25
- return this.call<T>("app.rocksky.artist.getArtist", "GET", {
18
+ getArtist(params: GetArtistParams, opts?: RequestOptions) {
19
+ return this.call("app.rocksky.artist.getArtist", "GET", {
26
20
  params,
27
21
  ...opts,
28
22
  });
29
23
  }
30
24
 
31
- getArtists<T = unknown>(params: GetArtistsParams = {}, opts?: RequestOptions) {
32
- return this.call<T>("app.rocksky.artist.getArtists", "GET", {
25
+ getArtists(params: GetArtistsParams = {}, opts?: RequestOptions) {
26
+ return this.call("app.rocksky.artist.getArtists", "GET", {
33
27
  params,
34
28
  ...opts,
35
29
  });
36
30
  }
37
31
 
38
- getArtistAlbums<T = unknown>(params: UriParam, opts?: RequestOptions) {
39
- return this.call<T>("app.rocksky.artist.getArtistAlbums", "GET", {
32
+ getArtistAlbums(params: GetArtistAlbumsParams, opts?: RequestOptions) {
33
+ return this.call("app.rocksky.artist.getArtistAlbums", "GET", {
40
34
  params,
41
35
  ...opts,
42
36
  });
43
37
  }
44
38
 
45
- getArtistTracks<T = unknown>(
39
+ getArtistTracks(
46
40
  params: GetArtistTracksParams = {},
47
41
  opts?: RequestOptions,
48
42
  ) {
49
- return this.call<T>("app.rocksky.artist.getArtistTracks", "GET", {
43
+ return this.call("app.rocksky.artist.getArtistTracks", "GET", {
50
44
  params,
51
45
  ...opts,
52
46
  });
53
47
  }
54
48
 
55
- getArtistListeners<T = unknown>(
56
- params: ArtistListenersParams,
49
+ getArtistListeners(
50
+ params: GetArtistListenersParams,
57
51
  opts?: RequestOptions,
58
52
  ) {
59
- return this.call<T>("app.rocksky.artist.getArtistListeners", "GET", {
53
+ return this.call("app.rocksky.artist.getArtistListeners", "GET", {
60
54
  params,
61
55
  ...opts,
62
56
  });
63
57
  }
64
58
 
65
- getArtistRecentListeners<T = unknown>(
66
- params: ArtistListenersParams,
59
+ getArtistRecentListeners(
60
+ params: GetArtistRecentListenersParams,
67
61
  opts?: RequestOptions,
68
62
  ) {
69
- return this.call<T>("app.rocksky.artist.getArtistRecentListeners", "GET", {
63
+ return this.call("app.rocksky.artist.getArtistRecentListeners", "GET", {
70
64
  params,
71
65
  ...opts,
72
66
  });
@@ -1,45 +1,36 @@
1
- import type { Call } from "./_helpers";
2
- import type { RequestOptions } from "../types";
1
+ import type {
2
+ GetScrobblesChartParams,
3
+ GetTopArtistsParams,
4
+ GetTopTracksParams,
5
+ } from "../generated/types.js";
6
+ import type { RequestOptions } from "../types.js";
7
+ import type { Call } from "./_helpers.js";
3
8
 
4
- export type ScrobblesChartParams = {
5
- did?: string;
6
- artisturi?: string;
7
- albumuri?: string;
8
- songuri?: string;
9
- genre?: string;
10
- from?: string;
11
- to?: string;
12
- };
13
-
14
- export type TopChartParams = {
15
- limit?: number;
16
- offset?: number;
17
- startDate?: string;
18
- endDate?: string;
19
- };
9
+ export type ScrobblesChartParams = GetScrobblesChartParams;
10
+ export type TopChartParams = GetTopArtistsParams;
20
11
 
21
12
  export class ChartsNamespace {
22
13
  constructor(private readonly call: Call) {}
23
14
 
24
- getScrobblesChart<T = unknown>(
15
+ getScrobblesChart(
25
16
  params: ScrobblesChartParams = {},
26
17
  opts?: RequestOptions,
27
18
  ) {
28
- return this.call<T>("app.rocksky.charts.getScrobblesChart", "GET", {
19
+ return this.call("app.rocksky.charts.getScrobblesChart", "GET", {
29
20
  params,
30
21
  ...opts,
31
22
  });
32
23
  }
33
24
 
34
- getTopArtists<T = unknown>(params: TopChartParams = {}, opts?: RequestOptions) {
35
- return this.call<T>("app.rocksky.charts.getTopArtists", "GET", {
25
+ getTopArtists(params: GetTopArtistsParams = {}, opts?: RequestOptions) {
26
+ return this.call("app.rocksky.charts.getTopArtists", "GET", {
36
27
  params,
37
28
  ...opts,
38
29
  });
39
30
  }
40
31
 
41
- getTopTracks<T = unknown>(params: TopChartParams = {}, opts?: RequestOptions) {
42
- return this.call<T>("app.rocksky.charts.getTopTracks", "GET", {
32
+ getTopTracks(params: GetTopTracksParams = {}, opts?: RequestOptions) {
33
+ return this.call("app.rocksky.charts.getTopTracks", "GET", {
43
34
  params,
44
35
  ...opts,
45
36
  });
@@ -1,44 +1,50 @@
1
- import type { Call } from "./_helpers";
2
- import type { RequestOptions } from "../types";
1
+ import type {
2
+ DownloadFileParams,
3
+ GetFilesParams,
4
+ GetMetadataParams,
5
+ GetTemporaryLinkParams,
6
+ } from "../generated/types.js";
7
+ import type { RequestOptions } from "../types.js";
8
+ import type { Call } from "./_helpers.js";
3
9
 
4
10
  export class DropboxNamespace {
5
11
  constructor(private readonly call: Call) {}
6
12
 
7
- getFiles<T = unknown>(
8
- params: { at?: string } = {},
13
+ getFiles(
14
+ params: GetFilesParams = {},
9
15
  opts?: RequestOptions,
10
16
  ) {
11
- return this.call<T>("app.rocksky.dropbox.getFiles", "GET", {
17
+ return this.call("app.rocksky.dropbox.getFiles", "GET", {
12
18
  params,
13
19
  requireAuth: true,
14
20
  ...opts,
15
21
  });
16
22
  }
17
23
 
18
- getMetadata<T = unknown>(params: { path: string }, opts?: RequestOptions) {
19
- return this.call<T>("app.rocksky.dropbox.getMetadata", "GET", {
24
+ getMetadata(params: GetMetadataParams, opts?: RequestOptions) {
25
+ return this.call("app.rocksky.dropbox.getMetadata", "GET", {
20
26
  params,
21
27
  requireAuth: true,
22
28
  ...opts,
23
29
  });
24
30
  }
25
31
 
26
- getTemporaryLink<T = unknown>(
27
- params: { path: string },
32
+ getTemporaryLink(
33
+ params: GetTemporaryLinkParams,
28
34
  opts?: RequestOptions,
29
35
  ) {
30
- return this.call<T>("app.rocksky.dropbox.getTemporaryLink", "GET", {
36
+ return this.call("app.rocksky.dropbox.getTemporaryLink", "GET", {
31
37
  params,
32
38
  requireAuth: true,
33
39
  ...opts,
34
40
  });
35
41
  }
36
42
 
37
- downloadFile<T = unknown>(
38
- params: { fileId: string },
43
+ downloadFile(
44
+ params: DownloadFileParams,
39
45
  opts?: RequestOptions,
40
46
  ) {
41
- return this.call<T>("app.rocksky.dropbox.downloadFile", "GET", {
47
+ return this.call("app.rocksky.dropbox.downloadFile", "GET", {
42
48
  params,
43
49
  requireAuth: true,
44
50
  ...opts,