@rocksky/sdk 0.1.0 → 0.2.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 (65) hide show
  1. package/README.md +5 -0
  2. package/dist/generated/types.d.ts +1812 -0
  3. package/dist/generated/types.d.ts.map +1 -0
  4. package/dist/http.d.ts +2 -2
  5. package/dist/http.d.ts.map +1 -1
  6. package/dist/namespaces/_helpers.d.ts +1 -1
  7. package/dist/namespaces/_helpers.d.ts.map +1 -1
  8. package/dist/namespaces/actor.d.ts +13 -23
  9. package/dist/namespaces/actor.d.ts.map +1 -1
  10. package/dist/namespaces/album.d.ts +5 -11
  11. package/dist/namespaces/album.d.ts.map +1 -1
  12. package/dist/namespaces/apikey.d.ts +4 -17
  13. package/dist/namespaces/apikey.d.ts.map +1 -1
  14. package/dist/namespaces/artist.d.ts +8 -23
  15. package/dist/namespaces/artist.d.ts.map +1 -1
  16. package/dist/namespaces/charts.d.ts +6 -18
  17. package/dist/namespaces/charts.d.ts.map +1 -1
  18. package/dist/namespaces/dropbox.d.ts +6 -13
  19. package/dist/namespaces/dropbox.d.ts.map +1 -1
  20. package/dist/namespaces/feed.d.ts +12 -31
  21. package/dist/namespaces/feed.d.ts.map +1 -1
  22. package/dist/namespaces/googledrive.d.ts +5 -10
  23. package/dist/namespaces/googledrive.d.ts.map +1 -1
  24. package/dist/namespaces/graph.d.ts +9 -22
  25. package/dist/namespaces/graph.d.ts.map +1 -1
  26. package/dist/namespaces/like.d.ts +7 -8
  27. package/dist/namespaces/like.d.ts.map +1 -1
  28. package/dist/namespaces/mirror.d.ts +3 -7
  29. package/dist/namespaces/mirror.d.ts.map +1 -1
  30. package/dist/namespaces/player.d.ts +13 -35
  31. package/dist/namespaces/player.d.ts.map +1 -1
  32. package/dist/namespaces/playlist.d.ts +10 -34
  33. package/dist/namespaces/playlist.d.ts.map +1 -1
  34. package/dist/namespaces/scrobble.d.ts +4 -35
  35. package/dist/namespaces/scrobble.d.ts.map +1 -1
  36. package/dist/namespaces/shout.d.ts +11 -32
  37. package/dist/namespaces/shout.d.ts.map +1 -1
  38. package/dist/namespaces/song.d.ts +4 -38
  39. package/dist/namespaces/song.d.ts.map +1 -1
  40. package/dist/namespaces/spotify.d.ts +4 -7
  41. package/dist/namespaces/spotify.d.ts.map +1 -1
  42. package/dist/namespaces/stats.d.ts +4 -8
  43. package/dist/namespaces/stats.d.ts.map +1 -1
  44. package/package.json +1 -1
  45. package/src/generated/types.ts +2019 -0
  46. package/src/http.ts +3 -3
  47. package/src/namespaces/_helpers.ts +1 -1
  48. package/src/namespaces/actor.ts +23 -19
  49. package/src/namespaces/album.ts +9 -9
  50. package/src/namespaces/apikey.ts +9 -9
  51. package/src/namespaces/artist.ts +15 -21
  52. package/src/namespaces/charts.ts +10 -19
  53. package/src/namespaces/dropbox.ts +11 -5
  54. package/src/namespaces/feed.ts +22 -16
  55. package/src/namespaces/googledrive.ts +9 -4
  56. package/src/namespaces/graph.ts +15 -16
  57. package/src/namespaces/like.ts +12 -6
  58. package/src/namespaces/mirror.ts +3 -7
  59. package/src/namespaces/player.ts +25 -27
  60. package/src/namespaces/playlist.ts +19 -9
  61. package/src/namespaces/scrobble.ts +8 -34
  62. package/src/namespaces/shout.ts +21 -12
  63. package/src/namespaces/song.ts +15 -36
  64. package/src/namespaces/spotify.ts +7 -3
  65. package/src/namespaces/stats.ts +7 -3
package/src/http.ts CHANGED
@@ -11,7 +11,7 @@ import {
11
11
  } from "./types";
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) {
@@ -5,7 +5,7 @@ export type Call = <T>(
5
5
  nsid: string,
6
6
  method: "GET" | "POST",
7
7
  opts?: {
8
- params?: Record<string, unknown>;
8
+ params?: object;
9
9
  body?: unknown;
10
10
  requireAuth?: boolean;
11
11
  } & RequestOptions,
@@ -1,16 +1,20 @@
1
- import type { Call } from "./_helpers";
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";
2
12
  import type { RequestOptions } from "../types";
13
+ import type { Call } from "./_helpers";
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) {}
@@ -22,21 +26,21 @@ export class ActorNamespace {
22
26
  });
23
27
  }
24
28
 
25
- getActorAlbums<T = unknown>(params: ActorRangeParams, opts?: RequestOptions) {
29
+ getActorAlbums<T = unknown>(params: GetActorAlbumsParams, opts?: RequestOptions) {
26
30
  return this.call<T>("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) {
36
+ getActorArtists<T = unknown>(params: GetActorArtistsParams, opts?: RequestOptions) {
33
37
  return this.call<T>("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) {
43
+ getActorSongs<T = unknown>(params: GetActorSongsParams, opts?: RequestOptions) {
40
44
  return this.call<T>("app.rocksky.actor.getActorSongs", "GET", {
41
45
  params,
42
46
  ...opts,
@@ -44,7 +48,7 @@ export class ActorNamespace {
44
48
  }
45
49
 
46
50
  getActorScrobbles<T = unknown>(
47
- params: ActorPagedParams,
51
+ params: GetActorScrobblesParams,
48
52
  opts?: RequestOptions,
49
53
  ) {
50
54
  return this.call<T>("app.rocksky.actor.getActorScrobbles", "GET", {
@@ -54,7 +58,7 @@ export class ActorNamespace {
54
58
  }
55
59
 
56
60
  getActorLovedSongs<T = unknown>(
57
- params: ActorPagedParams,
61
+ params: GetActorLovedSongsParams,
58
62
  opts?: RequestOptions,
59
63
  ) {
60
64
  return this.call<T>("app.rocksky.actor.getActorLovedSongs", "GET", {
@@ -64,7 +68,7 @@ export class ActorNamespace {
64
68
  }
65
69
 
66
70
  getActorPlaylists<T = unknown>(
67
- params: ActorPagedParams,
71
+ params: GetActorPlaylistsParams,
68
72
  opts?: RequestOptions,
69
73
  ) {
70
74
  return this.call<T>("app.rocksky.actor.getActorPlaylists", "GET", {
@@ -73,14 +77,14 @@ export class ActorNamespace {
73
77
  });
74
78
  }
75
79
 
76
- getActorNeighbours<T = unknown>(params: DidParam, opts?: RequestOptions) {
80
+ getActorNeighbours<T = unknown>(params: GetActorNeighboursParams, opts?: RequestOptions) {
77
81
  return this.call<T>("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) {
87
+ getActorCompatibility<T = unknown>(params: GetActorCompatibilityParams, opts?: RequestOptions) {
84
88
  return this.call<T>("app.rocksky.actor.getActorCompatibility", "GET", {
85
89
  params,
86
90
  ...opts,
@@ -1,17 +1,17 @@
1
- import type { Call } from "./_helpers";
1
+ import type {
2
+ GetAlbumParams,
3
+ GetAlbumsParams,
4
+ GetAlbumTracksParams,
5
+ } from "../generated/types";
2
6
  import type { RequestOptions } from "../types";
7
+ import type { Call } from "./_helpers";
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) {
14
+ getAlbum<T = unknown>(params: GetAlbumParams, opts?: RequestOptions) {
15
15
  return this.call<T>("app.rocksky.album.getAlbum", "GET", {
16
16
  params,
17
17
  ...opts,
@@ -25,7 +25,7 @@ export class AlbumNamespace {
25
25
  });
26
26
  }
27
27
 
28
- getAlbumTracks<T = unknown>(params: UriParam, opts?: RequestOptions) {
28
+ getAlbumTracks<T = unknown>(params: GetAlbumTracksParams, opts?: RequestOptions) {
29
29
  return this.call<T>("app.rocksky.album.getAlbumTracks", "GET", {
30
30
  params,
31
31
  ...opts,
@@ -1,14 +1,14 @@
1
- import type { Call } from "./_helpers";
1
+ import type {
2
+ CreateApikeyInput,
3
+ GetApikeysParams,
4
+ RemoveApikeyParams,
5
+ UpdateApikeyInput,
6
+ } from "../generated/types";
2
7
  import type { RequestOptions } from "../types";
8
+ import type { Call } from "./_helpers";
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) {}
@@ -1,27 +1,21 @@
1
- import type { Call } from "./_helpers";
1
+ import type {
2
+ GetArtistAlbumsParams,
3
+ GetArtistListenersParams,
4
+ GetArtistParams,
5
+ GetArtistRecentListenersParams,
6
+ GetArtistsParams,
7
+ GetArtistTracksParams,
8
+ } from "../generated/types";
2
9
  import type { RequestOptions } from "../types";
10
+ import type { Call } from "./_helpers";
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) {
18
+ getArtist<T = unknown>(params: GetArtistParams, opts?: RequestOptions) {
25
19
  return this.call<T>("app.rocksky.artist.getArtist", "GET", {
26
20
  params,
27
21
  ...opts,
@@ -35,7 +29,7 @@ export class ArtistNamespace {
35
29
  });
36
30
  }
37
31
 
38
- getArtistAlbums<T = unknown>(params: UriParam, opts?: RequestOptions) {
32
+ getArtistAlbums<T = unknown>(params: GetArtistAlbumsParams, opts?: RequestOptions) {
39
33
  return this.call<T>("app.rocksky.artist.getArtistAlbums", "GET", {
40
34
  params,
41
35
  ...opts,
@@ -53,7 +47,7 @@ export class ArtistNamespace {
53
47
  }
54
48
 
55
49
  getArtistListeners<T = unknown>(
56
- params: ArtistListenersParams,
50
+ params: GetArtistListenersParams,
57
51
  opts?: RequestOptions,
58
52
  ) {
59
53
  return this.call<T>("app.rocksky.artist.getArtistListeners", "GET", {
@@ -63,7 +57,7 @@ export class ArtistNamespace {
63
57
  }
64
58
 
65
59
  getArtistRecentListeners<T = unknown>(
66
- params: ArtistListenersParams,
60
+ params: GetArtistRecentListenersParams,
67
61
  opts?: RequestOptions,
68
62
  ) {
69
63
  return this.call<T>("app.rocksky.artist.getArtistRecentListeners", "GET", {
@@ -1,22 +1,13 @@
1
- import type { Call } from "./_helpers";
1
+ import type {
2
+ GetScrobblesChartParams,
3
+ GetTopArtistsParams,
4
+ GetTopTracksParams,
5
+ } from "../generated/types";
2
6
  import type { RequestOptions } from "../types";
7
+ import type { Call } from "./_helpers";
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) {}
@@ -31,14 +22,14 @@ export class ChartsNamespace {
31
22
  });
32
23
  }
33
24
 
34
- getTopArtists<T = unknown>(params: TopChartParams = {}, opts?: RequestOptions) {
25
+ getTopArtists<T = unknown>(params: GetTopArtistsParams = {}, opts?: RequestOptions) {
35
26
  return this.call<T>("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) {
32
+ getTopTracks<T = unknown>(params: GetTopTracksParams = {}, opts?: RequestOptions) {
42
33
  return this.call<T>("app.rocksky.charts.getTopTracks", "GET", {
43
34
  params,
44
35
  ...opts,
@@ -1,11 +1,17 @@
1
- import type { Call } from "./_helpers";
1
+ import type {
2
+ DownloadFileParams,
3
+ GetFilesParams,
4
+ GetMetadataParams,
5
+ GetTemporaryLinkParams,
6
+ } from "../generated/types";
2
7
  import type { RequestOptions } from "../types";
8
+ import type { Call } from "./_helpers";
3
9
 
4
10
  export class DropboxNamespace {
5
11
  constructor(private readonly call: Call) {}
6
12
 
7
13
  getFiles<T = unknown>(
8
- params: { at?: string } = {},
14
+ params: GetFilesParams = {},
9
15
  opts?: RequestOptions,
10
16
  ) {
11
17
  return this.call<T>("app.rocksky.dropbox.getFiles", "GET", {
@@ -15,7 +21,7 @@ export class DropboxNamespace {
15
21
  });
16
22
  }
17
23
 
18
- getMetadata<T = unknown>(params: { path: string }, opts?: RequestOptions) {
24
+ getMetadata<T = unknown>(params: GetMetadataParams, opts?: RequestOptions) {
19
25
  return this.call<T>("app.rocksky.dropbox.getMetadata", "GET", {
20
26
  params,
21
27
  requireAuth: true,
@@ -24,7 +30,7 @@ export class DropboxNamespace {
24
30
  }
25
31
 
26
32
  getTemporaryLink<T = unknown>(
27
- params: { path: string },
33
+ params: GetTemporaryLinkParams,
28
34
  opts?: RequestOptions,
29
35
  ) {
30
36
  return this.call<T>("app.rocksky.dropbox.getTemporaryLink", "GET", {
@@ -35,7 +41,7 @@ export class DropboxNamespace {
35
41
  }
36
42
 
37
43
  downloadFile<T = unknown>(
38
- params: { fileId: string },
44
+ params: DownloadFileParams,
39
45
  opts?: RequestOptions,
40
46
  ) {
41
47
  return this.call<T>("app.rocksky.dropbox.downloadFile", "GET", {
@@ -1,12 +1,23 @@
1
- import type { Call } from "./_helpers";
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";
2
12
  import type { RequestOptions } from "../types";
13
+ import type { Call } from "./_helpers";
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) {
20
+ search<T = unknown>(params: SearchParams, opts?: RequestOptions) {
10
21
  return this.call<T>("app.rocksky.feed.search", "GET", {
11
22
  params,
12
23
  ...opts,
@@ -14,7 +25,7 @@ export class FeedNamespace {
14
25
  }
15
26
 
16
27
  getFeed<T = unknown>(
17
- params: { feed: string; limit?: number; cursor?: string },
28
+ params: GetFeedParams,
18
29
  opts?: RequestOptions,
19
30
  ) {
20
31
  return this.call<T>("app.rocksky.feed.getFeed", "GET", {
@@ -24,7 +35,7 @@ export class FeedNamespace {
24
35
  }
25
36
 
26
37
  getFeedGenerators<T = unknown>(
27
- params: { size?: number } = {},
38
+ params: GetFeedGeneratorsParams = {},
28
39
  opts?: RequestOptions,
29
40
  ) {
30
41
  return this.call<T>("app.rocksky.feed.getFeedGenerators", "GET", {
@@ -34,7 +45,7 @@ export class FeedNamespace {
34
45
  }
35
46
 
36
47
  getFeedGenerator<T = unknown>(
37
- params: { feed: string },
48
+ params: GetFeedGeneratorParams,
38
49
  opts?: RequestOptions,
39
50
  ) {
40
51
  return this.call<T>("app.rocksky.feed.getFeedGenerator", "GET", {
@@ -50,12 +61,7 @@ export class FeedNamespace {
50
61
  }
51
62
 
52
63
  getFeedSkeleton<T = unknown>(
53
- params: {
54
- feed: string;
55
- limit?: number;
56
- offset?: number;
57
- cursor?: string;
58
- },
64
+ params: GetFeedSkeletonParams,
59
65
  opts?: RequestOptions,
60
66
  ) {
61
67
  return this.call<T>("app.rocksky.feed.getFeedSkeleton", "GET", {
@@ -65,7 +71,7 @@ export class FeedNamespace {
65
71
  }
66
72
 
67
73
  getRecommendations<T = unknown>(
68
- params: RecommendParams,
74
+ params: GetRecommendationsParams,
69
75
  opts?: RequestOptions,
70
76
  ) {
71
77
  return this.call<T>("app.rocksky.feed.getRecommendations", "GET", {
@@ -75,7 +81,7 @@ export class FeedNamespace {
75
81
  }
76
82
 
77
83
  getArtistRecommendations<T = unknown>(
78
- params: RecommendParams,
84
+ params: GetArtistRecommendationsParams,
79
85
  opts?: RequestOptions,
80
86
  ) {
81
87
  return this.call<T>("app.rocksky.feed.getArtistRecommendations", "GET", {
@@ -85,7 +91,7 @@ export class FeedNamespace {
85
91
  }
86
92
 
87
93
  getAlbumRecommendations<T = unknown>(
88
- params: RecommendParams,
94
+ params: GetAlbumRecommendationsParams,
89
95
  opts?: RequestOptions,
90
96
  ) {
91
97
  return this.call<T>("app.rocksky.feed.getAlbumRecommendations", "GET", {
@@ -95,7 +101,7 @@ export class FeedNamespace {
95
101
  }
96
102
 
97
103
  getStories<T = unknown>(
98
- params: { size?: number } = {},
104
+ params: GetStoriesParams = {},
99
105
  opts?: RequestOptions,
100
106
  ) {
101
107
  return this.call<T>("app.rocksky.feed.getStories", "GET", {
@@ -1,10 +1,15 @@
1
- import type { Call } from "./_helpers";
1
+ import type {
2
+ DownloadFileParams,
3
+ GetFileParams,
4
+ GetFilesParams,
5
+ } from "../generated/types";
2
6
  import type { RequestOptions } from "../types";
7
+ import type { Call } from "./_helpers";
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) {
12
+ getFile<T = unknown>(params: GetFileParams, opts?: RequestOptions) {
8
13
  return this.call<T>("app.rocksky.googledrive.getFile", "GET", {
9
14
  params,
10
15
  requireAuth: true,
@@ -13,7 +18,7 @@ export class GoogleDriveNamespace {
13
18
  }
14
19
 
15
20
  getFiles<T = unknown>(
16
- params: { at?: string } = {},
21
+ params: GetFilesParams = {},
17
22
  opts?: RequestOptions,
18
23
  ) {
19
24
  return this.call<T>("app.rocksky.googledrive.getFiles", "GET", {
@@ -24,7 +29,7 @@ export class GoogleDriveNamespace {
24
29
  }
25
30
 
26
31
  downloadFile<T = unknown>(
27
- params: { fileId: string },
32
+ params: DownloadFileParams,
28
33
  opts?: RequestOptions,
29
34
  ) {
30
35
  return this.call<T>("app.rocksky.googledrive.downloadFile", "GET", {
@@ -1,22 +1,21 @@
1
- import type { Call } from "./_helpers";
1
+ import type {
2
+ FollowAccountParams,
3
+ GetFollowersParams,
4
+ GetFollowsParams,
5
+ GetKnownFollowersParams,
6
+ UnfollowAccountParams,
7
+ } from "../generated/types";
2
8
  import type { RequestOptions } from "../types";
9
+ import type { Call } from "./_helpers";
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
17
  followAccount<T = unknown>(
19
- params: { account: string },
18
+ params: FollowAccountParams,
20
19
  opts?: RequestOptions,
21
20
  ) {
22
21
  return this.call<T>("app.rocksky.graph.followAccount", "POST", {
@@ -27,7 +26,7 @@ export class GraphNamespace {
27
26
  }
28
27
 
29
28
  unfollowAccount<T = unknown>(
30
- params: { account: string },
29
+ params: UnfollowAccountParams,
31
30
  opts?: RequestOptions,
32
31
  ) {
33
32
  return this.call<T>("app.rocksky.graph.unfollowAccount", "POST", {
@@ -37,14 +36,14 @@ export class GraphNamespace {
37
36
  });
38
37
  }
39
38
 
40
- getFollowers<T = unknown>(params: FollowListParams, opts?: RequestOptions) {
39
+ getFollowers<T = unknown>(params: GetFollowersParams, opts?: RequestOptions) {
41
40
  return this.call<T>("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) {
46
+ getFollows<T = unknown>(params: GetFollowsParams, opts?: RequestOptions) {
48
47
  return this.call<T>("app.rocksky.graph.getFollows", "GET", {
49
48
  params,
50
49
  ...opts,
@@ -52,7 +51,7 @@ export class GraphNamespace {
52
51
  }
53
52
 
54
53
  getKnownFollowers<T = unknown>(
55
- params: KnownFollowersParams,
54
+ params: GetKnownFollowersParams,
56
55
  opts?: RequestOptions,
57
56
  ) {
58
57
  return this.call<T>("app.rocksky.graph.getKnownFollowers", "GET", {
@@ -1,12 +1,18 @@
1
- import type { Call } from "./_helpers";
1
+ import type {
2
+ DislikeShoutInput,
3
+ DislikeSongInput,
4
+ LikeShoutInput,
5
+ LikeSongInput,
6
+ } from "../generated/types";
2
7
  import type { RequestOptions } from "../types";
8
+ import type { Call } from "./_helpers";
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) {
15
+ likeSong<T = unknown>(input: LikeSongInput = {}, opts?: RequestOptions) {
10
16
  return this.call<T>("app.rocksky.like.likeSong", "POST", {
11
17
  body: input,
12
18
  requireAuth: true,
@@ -14,7 +20,7 @@ export class LikeNamespace {
14
20
  });
15
21
  }
16
22
 
17
- dislikeSong<T = unknown>(input: LikeInput = {}, opts?: RequestOptions) {
23
+ dislikeSong<T = unknown>(input: DislikeSongInput = {}, opts?: RequestOptions) {
18
24
  return this.call<T>("app.rocksky.like.dislikeSong", "POST", {
19
25
  body: input,
20
26
  requireAuth: true,
@@ -22,7 +28,7 @@ export class LikeNamespace {
22
28
  });
23
29
  }
24
30
 
25
- likeShout<T = unknown>(input: LikeInput = {}, opts?: RequestOptions) {
31
+ likeShout<T = unknown>(input: LikeShoutInput = {}, opts?: RequestOptions) {
26
32
  return this.call<T>("app.rocksky.like.likeShout", "POST", {
27
33
  body: input,
28
34
  requireAuth: true,
@@ -30,7 +36,7 @@ export class LikeNamespace {
30
36
  });
31
37
  }
32
38
 
33
- dislikeShout<T = unknown>(input: LikeInput = {}, opts?: RequestOptions) {
39
+ dislikeShout<T = unknown>(input: DislikeShoutInput = {}, opts?: RequestOptions) {
34
40
  return this.call<T>("app.rocksky.like.dislikeShout", "POST", {
35
41
  body: input,
36
42
  requireAuth: true,
@@ -1,12 +1,8 @@
1
- import type { Call } from "./_helpers";
1
+ import type { PutMirrorSourceInput } from "../generated/types";
2
2
  import type { RequestOptions } from "../types";
3
+ import type { Call } from "./_helpers";
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) {}