@rocksky/sdk 0.2.0 → 0.2.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/client.d.ts +37 -28
- package/dist/client.d.ts.map +1 -1
- package/dist/generated/types.d.ts +120 -0
- package/dist/generated/types.d.ts.map +1 -1
- package/dist/http.d.ts +1 -1
- package/dist/http.d.ts.map +1 -1
- package/dist/index.d.ts +18 -17
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6 -1
- package/dist/namespaces/_helpers.d.ts +10 -4
- package/dist/namespaces/_helpers.d.ts.map +1 -1
- package/dist/namespaces/actor.d.ts +12 -12
- package/dist/namespaces/actor.d.ts.map +1 -1
- package/dist/namespaces/album.d.ts +6 -6
- package/dist/namespaces/album.d.ts.map +1 -1
- package/dist/namespaces/apikey.d.ts +7 -7
- package/dist/namespaces/apikey.d.ts.map +1 -1
- package/dist/namespaces/artist.d.ts +9 -9
- package/dist/namespaces/artist.d.ts.map +1 -1
- package/dist/namespaces/charts.d.ts +6 -6
- package/dist/namespaces/charts.d.ts.map +1 -1
- package/dist/namespaces/dropbox.d.ts +7 -7
- package/dist/namespaces/dropbox.d.ts.map +1 -1
- package/dist/namespaces/feed.d.ts +13 -13
- package/dist/namespaces/feed.d.ts.map +1 -1
- package/dist/namespaces/googledrive.d.ts +6 -6
- package/dist/namespaces/googledrive.d.ts.map +1 -1
- package/dist/namespaces/graph.d.ts +8 -8
- package/dist/namespaces/graph.d.ts.map +1 -1
- package/dist/namespaces/like.d.ts +7 -7
- package/dist/namespaces/like.d.ts.map +1 -1
- package/dist/namespaces/mirror.d.ts +5 -5
- package/dist/namespaces/mirror.d.ts.map +1 -1
- package/dist/namespaces/player.d.ts +14 -14
- package/dist/namespaces/player.d.ts.map +1 -1
- package/dist/namespaces/playlist.d.ts +11 -11
- package/dist/namespaces/playlist.d.ts.map +1 -1
- package/dist/namespaces/scrobble.d.ts +6 -6
- package/dist/namespaces/scrobble.d.ts.map +1 -1
- package/dist/namespaces/shout.d.ts +12 -12
- package/dist/namespaces/shout.d.ts.map +1 -1
- package/dist/namespaces/song.d.ts +8 -8
- package/dist/namespaces/song.d.ts.map +1 -1
- package/dist/namespaces/spotify.d.ts +9 -9
- package/dist/namespaces/spotify.d.ts.map +1 -1
- package/dist/namespaces/stats.d.ts +5 -5
- package/dist/namespaces/stats.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/client.ts +50 -33
- package/src/generated/types.ts +124 -0
- package/src/http.ts +2 -2
- package/src/index.ts +19 -17
- package/src/namespaces/_helpers.ts +23 -13
- package/src/namespaces/actor.ts +21 -21
- package/src/namespaces/album.ts +9 -9
- package/src/namespaces/apikey.ts +11 -11
- package/src/namespaces/artist.ts +15 -15
- package/src/namespaces/charts.ts +9 -9
- package/src/namespaces/dropbox.ts +11 -11
- package/src/namespaces/feed.ts +23 -23
- package/src/namespaces/googledrive.ts +9 -9
- package/src/namespaces/graph.ts +13 -13
- package/src/namespaces/like.ts +11 -11
- package/src/namespaces/mirror.ts +7 -7
- package/src/namespaces/player.ts +25 -25
- package/src/namespaces/playlist.ts +19 -19
- package/src/namespaces/scrobble.ts +9 -9
- package/src/namespaces/shout.ts +21 -21
- package/src/namespaces/song.ts +13 -13
- package/src/namespaces/spotify.ts +15 -15
- package/src/namespaces/stats.ts +7 -7
- package/src/pipe.ts +1 -1
- package/src/realtime.ts +2 -2
package/src/client.ts
CHANGED
|
@@ -1,38 +1,45 @@
|
|
|
1
|
-
import { buildConfig, type HttpClientConfig, xrpcCall } from "./http";
|
|
1
|
+
import { buildConfig, type HttpClientConfig, xrpcCall } from "./http.js";
|
|
2
|
+
import { makeCall } from "./namespaces/_helpers.js";
|
|
2
3
|
import {
|
|
3
4
|
type PaginateArgs,
|
|
4
5
|
paginate as paginateFn,
|
|
5
|
-
} from "./paginate";
|
|
6
|
+
} from "./paginate.js";
|
|
6
7
|
import {
|
|
7
8
|
RealtimeClient,
|
|
8
9
|
type RealtimeOptions,
|
|
9
10
|
createRealtimeClient,
|
|
10
|
-
} from "./realtime";
|
|
11
|
-
import { ActorNamespace } from "./namespaces/actor";
|
|
12
|
-
import { AlbumNamespace } from "./namespaces/album";
|
|
13
|
-
import { ApikeyNamespace } from "./namespaces/apikey";
|
|
14
|
-
import { ArtistNamespace } from "./namespaces/artist";
|
|
15
|
-
import { ChartsNamespace } from "./namespaces/charts";
|
|
16
|
-
import { DropboxNamespace } from "./namespaces/dropbox";
|
|
17
|
-
import { FeedNamespace } from "./namespaces/feed";
|
|
18
|
-
import { GoogleDriveNamespace } from "./namespaces/googledrive";
|
|
19
|
-
import { GraphNamespace } from "./namespaces/graph";
|
|
20
|
-
import { LikeNamespace } from "./namespaces/like";
|
|
21
|
-
import { MirrorNamespace } from "./namespaces/mirror";
|
|
22
|
-
import { PlayerNamespace } from "./namespaces/player";
|
|
23
|
-
import { PlaylistNamespace } from "./namespaces/playlist";
|
|
24
|
-
import { ScrobbleNamespace } from "./namespaces/scrobble";
|
|
25
|
-
import { ShoutNamespace } from "./namespaces/shout";
|
|
26
|
-
import { SongNamespace } from "./namespaces/song";
|
|
27
|
-
import { SpotifyNamespace } from "./namespaces/spotify";
|
|
28
|
-
import { StatsNamespace } from "./namespaces/stats";
|
|
29
|
-
import type {
|
|
11
|
+
} from "./realtime.js";
|
|
12
|
+
import { ActorNamespace } from "./namespaces/actor.js";
|
|
13
|
+
import { AlbumNamespace } from "./namespaces/album.js";
|
|
14
|
+
import { ApikeyNamespace } from "./namespaces/apikey.js";
|
|
15
|
+
import { ArtistNamespace } from "./namespaces/artist.js";
|
|
16
|
+
import { ChartsNamespace } from "./namespaces/charts.js";
|
|
17
|
+
import { DropboxNamespace } from "./namespaces/dropbox.js";
|
|
18
|
+
import { FeedNamespace } from "./namespaces/feed.js";
|
|
19
|
+
import { GoogleDriveNamespace } from "./namespaces/googledrive.js";
|
|
20
|
+
import { GraphNamespace } from "./namespaces/graph.js";
|
|
21
|
+
import { LikeNamespace } from "./namespaces/like.js";
|
|
22
|
+
import { MirrorNamespace } from "./namespaces/mirror.js";
|
|
23
|
+
import { PlayerNamespace } from "./namespaces/player.js";
|
|
24
|
+
import { PlaylistNamespace } from "./namespaces/playlist.js";
|
|
25
|
+
import { ScrobbleNamespace } from "./namespaces/scrobble.js";
|
|
26
|
+
import { ShoutNamespace } from "./namespaces/shout.js";
|
|
27
|
+
import { SongNamespace } from "./namespaces/song.js";
|
|
28
|
+
import { SpotifyNamespace } from "./namespaces/spotify.js";
|
|
29
|
+
import { StatsNamespace } from "./namespaces/stats.js";
|
|
30
|
+
import type { Endpoints } from "./generated/types.js";
|
|
30
31
|
import type {
|
|
31
32
|
AuthProvider,
|
|
32
33
|
ClientOptions,
|
|
33
34
|
FetchLike,
|
|
34
35
|
RequestOptions,
|
|
35
|
-
} from "./types";
|
|
36
|
+
} from "./types.js";
|
|
37
|
+
|
|
38
|
+
type XrpcOpts = {
|
|
39
|
+
params?: Record<string, unknown>;
|
|
40
|
+
body?: unknown;
|
|
41
|
+
requireAuth?: boolean;
|
|
42
|
+
} & RequestOptions;
|
|
36
43
|
|
|
37
44
|
export class RockskyClient {
|
|
38
45
|
readonly config: HttpClientConfig;
|
|
@@ -58,8 +65,7 @@ export class RockskyClient {
|
|
|
58
65
|
|
|
59
66
|
constructor(options: ClientOptions = {}) {
|
|
60
67
|
this.config = buildConfig(options);
|
|
61
|
-
const call
|
|
62
|
-
xrpcCall(this.config, nsid, method, opts ?? {});
|
|
68
|
+
const call = makeCall(this.config);
|
|
63
69
|
|
|
64
70
|
this.actor = new ActorNamespace(call);
|
|
65
71
|
this.album = new AlbumNamespace(call);
|
|
@@ -130,17 +136,28 @@ export class RockskyClient {
|
|
|
130
136
|
return paginateFn(args);
|
|
131
137
|
}
|
|
132
138
|
|
|
133
|
-
/**
|
|
139
|
+
/**
|
|
140
|
+
* Direct escape hatch — call any XRPC endpoint by NSID.
|
|
141
|
+
*
|
|
142
|
+
* Known NSIDs (string literals) are typed via the generated `Endpoints`
|
|
143
|
+
* map; arbitrary strings fall back to `unknown` (override with `<T>`).
|
|
144
|
+
*/
|
|
145
|
+
xrpc<K extends keyof Endpoints>(
|
|
146
|
+
nsid: K,
|
|
147
|
+
method?: "GET" | "POST",
|
|
148
|
+
opts?: XrpcOpts,
|
|
149
|
+
): Promise<Endpoints[K]>;
|
|
134
150
|
xrpc<T = unknown>(
|
|
151
|
+
nsid: string,
|
|
152
|
+
method?: "GET" | "POST",
|
|
153
|
+
opts?: XrpcOpts,
|
|
154
|
+
): Promise<T>;
|
|
155
|
+
xrpc(
|
|
135
156
|
nsid: string,
|
|
136
157
|
method: "GET" | "POST" = "GET",
|
|
137
|
-
opts: {
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
requireAuth?: boolean;
|
|
141
|
-
} & RequestOptions = {},
|
|
142
|
-
): Promise<T> {
|
|
143
|
-
return xrpcCall<T>(this.config, nsid, method, opts);
|
|
158
|
+
opts: XrpcOpts = {},
|
|
159
|
+
): Promise<unknown> {
|
|
160
|
+
return xrpcCall(this.config, nsid, method, opts);
|
|
144
161
|
}
|
|
145
162
|
|
|
146
163
|
static builder(): RockskyClientBuilder {
|
package/src/generated/types.ts
CHANGED
|
@@ -964,6 +964,10 @@ export interface GetFollowsParams {
|
|
|
964
964
|
cursor?: string;
|
|
965
965
|
}
|
|
966
966
|
|
|
967
|
+
export interface GetGlobalStatsParams {
|
|
968
|
+
|
|
969
|
+
}
|
|
970
|
+
|
|
967
971
|
export interface GetKnownFollowersOutput {
|
|
968
972
|
subject: ActorProfileViewBasic;
|
|
969
973
|
followers: ActorProfileViewBasic[];
|
|
@@ -1861,6 +1865,19 @@ export interface StartPlaylistParams {
|
|
|
1861
1865
|
position?: number;
|
|
1862
1866
|
}
|
|
1863
1867
|
|
|
1868
|
+
export interface StatsGlobalStatsView {
|
|
1869
|
+
/** Total scrobbles across all users on Rocksky. */
|
|
1870
|
+
scrobbles?: number;
|
|
1871
|
+
/** Total number of users on Rocksky. */
|
|
1872
|
+
users?: number;
|
|
1873
|
+
/** Total number of artists known to Rocksky. */
|
|
1874
|
+
artists?: number;
|
|
1875
|
+
/** Total number of albums known to Rocksky. */
|
|
1876
|
+
albums?: number;
|
|
1877
|
+
/** Total number of tracks known to Rocksky. */
|
|
1878
|
+
tracks?: number;
|
|
1879
|
+
}
|
|
1880
|
+
|
|
1864
1881
|
export interface StatsView {
|
|
1865
1882
|
/** The total number of scrobbles. */
|
|
1866
1883
|
scrobbles?: number;
|
|
@@ -2017,3 +2034,110 @@ export interface UpdateApikeyInput {
|
|
|
2017
2034
|
/** A new description for the API key. */
|
|
2018
2035
|
description?: string;
|
|
2019
2036
|
}
|
|
2037
|
+
|
|
2038
|
+
/**
|
|
2039
|
+
* Map of every XRPC method (NSID) to the type of its response body.
|
|
2040
|
+
* Endpoints with no output map to `void`. Used by the SDK to type method
|
|
2041
|
+
* return values automatically — callers should not need to reference this
|
|
2042
|
+
* directly.
|
|
2043
|
+
*/
|
|
2044
|
+
export interface Endpoints {
|
|
2045
|
+
"app.rocksky.actor.getActorAlbums": GetActorAlbumsOutput;
|
|
2046
|
+
"app.rocksky.actor.getActorArtists": GetActorArtistsOutput;
|
|
2047
|
+
"app.rocksky.actor.getActorCompatibility": GetActorCompatibilityOutput;
|
|
2048
|
+
"app.rocksky.actor.getActorLovedSongs": GetActorLovedSongsOutput;
|
|
2049
|
+
"app.rocksky.actor.getActorNeighbours": GetActorNeighboursOutput;
|
|
2050
|
+
"app.rocksky.actor.getActorPlaylists": GetActorPlaylistsOutput;
|
|
2051
|
+
"app.rocksky.actor.getActorScrobbles": GetActorScrobblesOutput;
|
|
2052
|
+
"app.rocksky.actor.getActorSongs": GetActorSongsOutput;
|
|
2053
|
+
"app.rocksky.actor.getProfile": ActorProfileViewDetailed;
|
|
2054
|
+
"app.rocksky.album.getAlbum": AlbumViewDetailed;
|
|
2055
|
+
"app.rocksky.album.getAlbums": GetAlbumsOutput;
|
|
2056
|
+
"app.rocksky.album.getAlbumTracks": GetAlbumTracksOutput;
|
|
2057
|
+
"app.rocksky.apikey.createApikey": unknown;
|
|
2058
|
+
"app.rocksky.apikey.getApikeys": GetApikeysOutput;
|
|
2059
|
+
"app.rocksky.apikey.removeApikey": unknown;
|
|
2060
|
+
"app.rocksky.apikey.updateApikey": unknown;
|
|
2061
|
+
"app.rocksky.artist.getArtist": ArtistViewDetailed;
|
|
2062
|
+
"app.rocksky.artist.getArtistAlbums": GetArtistAlbumsOutput;
|
|
2063
|
+
"app.rocksky.artist.getArtistListeners": GetArtistListenersOutput;
|
|
2064
|
+
"app.rocksky.artist.getArtistRecentListeners": GetArtistRecentListenersOutput;
|
|
2065
|
+
"app.rocksky.artist.getArtists": GetArtistsOutput;
|
|
2066
|
+
"app.rocksky.artist.getArtistTracks": GetArtistTracksOutput;
|
|
2067
|
+
"app.rocksky.charts.getScrobblesChart": ChartsView;
|
|
2068
|
+
"app.rocksky.charts.getTopArtists": GetTopArtistsOutput;
|
|
2069
|
+
"app.rocksky.charts.getTopTracks": GetTopTracksOutput;
|
|
2070
|
+
"app.rocksky.dropbox.downloadFile": void;
|
|
2071
|
+
"app.rocksky.dropbox.getFiles": DropboxFileListView;
|
|
2072
|
+
"app.rocksky.dropbox.getMetadata": DropboxFileView;
|
|
2073
|
+
"app.rocksky.dropbox.getTemporaryLink": DropboxTemporaryLinkView;
|
|
2074
|
+
"app.rocksky.feed.describeFeedGenerator": DescribeFeedGeneratorOutput;
|
|
2075
|
+
"app.rocksky.feed.getAlbumRecommendations": FeedRecommendedAlbumsView;
|
|
2076
|
+
"app.rocksky.feed.getArtistRecommendations": FeedRecommendedArtistsView;
|
|
2077
|
+
"app.rocksky.feed.getFeed": FeedView;
|
|
2078
|
+
"app.rocksky.feed.getFeedGenerator": GetFeedGeneratorOutput;
|
|
2079
|
+
"app.rocksky.feed.getFeedGenerators": FeedGeneratorsView;
|
|
2080
|
+
"app.rocksky.feed.getFeedSkeleton": GetFeedSkeletonOutput;
|
|
2081
|
+
"app.rocksky.feed.getRecommendations": FeedRecommendationsView;
|
|
2082
|
+
"app.rocksky.feed.getStories": FeedStoriesView;
|
|
2083
|
+
"app.rocksky.feed.search": FeedSearchResultsView;
|
|
2084
|
+
"app.rocksky.googledrive.downloadFile": void;
|
|
2085
|
+
"app.rocksky.googledrive.getFile": GoogledriveFileView;
|
|
2086
|
+
"app.rocksky.googledrive.getFiles": GoogledriveFileListView;
|
|
2087
|
+
"app.rocksky.graph.followAccount": FollowAccountOutput;
|
|
2088
|
+
"app.rocksky.graph.getFollowers": GetFollowersOutput;
|
|
2089
|
+
"app.rocksky.graph.getFollows": GetFollowsOutput;
|
|
2090
|
+
"app.rocksky.graph.getKnownFollowers": GetKnownFollowersOutput;
|
|
2091
|
+
"app.rocksky.graph.unfollowAccount": UnfollowAccountOutput;
|
|
2092
|
+
"app.rocksky.like.dislikeShout": ShoutView;
|
|
2093
|
+
"app.rocksky.like.dislikeSong": SongViewDetailed;
|
|
2094
|
+
"app.rocksky.like.likeShout": ShoutView;
|
|
2095
|
+
"app.rocksky.like.likeSong": SongViewDetailed;
|
|
2096
|
+
"app.rocksky.mirror.getMirrorSources": GetMirrorSourcesOutput;
|
|
2097
|
+
"app.rocksky.mirror.putMirrorSource": MirrorSourceView;
|
|
2098
|
+
"app.rocksky.player.addDirectoryToQueue": void;
|
|
2099
|
+
"app.rocksky.player.addItemsToQueue": void;
|
|
2100
|
+
"app.rocksky.player.getCurrentlyPlaying": PlayerCurrentlyPlayingViewDetailed;
|
|
2101
|
+
"app.rocksky.player.getPlaybackQueue": PlayerPlaybackQueueViewDetailed;
|
|
2102
|
+
"app.rocksky.player.next": void;
|
|
2103
|
+
"app.rocksky.player.pause": void;
|
|
2104
|
+
"app.rocksky.player.play": void;
|
|
2105
|
+
"app.rocksky.player.playDirectory": void;
|
|
2106
|
+
"app.rocksky.player.playFile": void;
|
|
2107
|
+
"app.rocksky.player.previous": void;
|
|
2108
|
+
"app.rocksky.player.seek": void;
|
|
2109
|
+
"app.rocksky.playlist.createPlaylist": void;
|
|
2110
|
+
"app.rocksky.playlist.getPlaylist": PlaylistViewDetailed;
|
|
2111
|
+
"app.rocksky.playlist.getPlaylists": GetPlaylistsOutput;
|
|
2112
|
+
"app.rocksky.playlist.insertDirectory": void;
|
|
2113
|
+
"app.rocksky.playlist.insertFiles": void;
|
|
2114
|
+
"app.rocksky.playlist.removePlaylist": void;
|
|
2115
|
+
"app.rocksky.playlist.removeTrack": void;
|
|
2116
|
+
"app.rocksky.playlist.startPlaylist": void;
|
|
2117
|
+
"app.rocksky.scrobble.createScrobble": ScrobbleViewBasic;
|
|
2118
|
+
"app.rocksky.scrobble.getScrobble": ScrobbleViewDetailed;
|
|
2119
|
+
"app.rocksky.scrobble.getScrobbles": GetScrobblesOutput;
|
|
2120
|
+
"app.rocksky.shout.createShout": ShoutView;
|
|
2121
|
+
"app.rocksky.shout.getAlbumShouts": GetAlbumShoutsOutput;
|
|
2122
|
+
"app.rocksky.shout.getArtistShouts": GetArtistShoutsOutput;
|
|
2123
|
+
"app.rocksky.shout.getProfileShouts": GetProfileShoutsOutput;
|
|
2124
|
+
"app.rocksky.shout.getShoutReplies": GetShoutRepliesOutput;
|
|
2125
|
+
"app.rocksky.shout.getTrackShouts": GetTrackShoutsOutput;
|
|
2126
|
+
"app.rocksky.shout.removeShout": ShoutView;
|
|
2127
|
+
"app.rocksky.shout.replyShout": ShoutView;
|
|
2128
|
+
"app.rocksky.shout.reportShout": ShoutView;
|
|
2129
|
+
"app.rocksky.song.createSong": SongViewDetailed;
|
|
2130
|
+
"app.rocksky.song.getSong": SongViewDetailed;
|
|
2131
|
+
"app.rocksky.song.getSongRecentListeners": GetSongRecentListenersOutput;
|
|
2132
|
+
"app.rocksky.song.getSongs": GetSongsOutput;
|
|
2133
|
+
"app.rocksky.song.matchSong": SongViewDetailed;
|
|
2134
|
+
"app.rocksky.spotify.getCurrentlyPlaying": PlayerCurrentlyPlayingViewDetailed;
|
|
2135
|
+
"app.rocksky.spotify.next": void;
|
|
2136
|
+
"app.rocksky.spotify.pause": void;
|
|
2137
|
+
"app.rocksky.spotify.play": void;
|
|
2138
|
+
"app.rocksky.spotify.previous": void;
|
|
2139
|
+
"app.rocksky.spotify.seek": void;
|
|
2140
|
+
"app.rocksky.stats.getGlobalStats": StatsGlobalStatsView;
|
|
2141
|
+
"app.rocksky.stats.getStats": StatsView;
|
|
2142
|
+
"app.rocksky.stats.getWrapped": StatsWrappedView;
|
|
2143
|
+
}
|
package/src/http.ts
CHANGED
|
@@ -2,13 +2,13 @@ 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
14
|
params?: object;
|
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,44 @@ export {
|
|
|
44
44
|
type ReconnectOptions,
|
|
45
45
|
type WebSocketCtor,
|
|
46
46
|
type WebSocketLike,
|
|
47
|
-
} from "./realtime";
|
|
47
|
+
} from "./realtime.js";
|
|
48
|
+
|
|
49
|
+
export type * from "./generated/types.js";
|
|
48
50
|
|
|
49
51
|
export type {
|
|
50
52
|
GetProfileParams,
|
|
51
53
|
ActorPagedParams,
|
|
52
54
|
ActorRangeParams,
|
|
53
|
-
} from "./namespaces/actor";
|
|
55
|
+
} from "./namespaces/actor.js";
|
|
54
56
|
export type {
|
|
55
57
|
CreateScrobbleInput,
|
|
56
58
|
GetScrobblesParams,
|
|
57
|
-
} from "./namespaces/scrobble";
|
|
59
|
+
} from "./namespaces/scrobble.js";
|
|
58
60
|
export type {
|
|
59
61
|
GetSongParams,
|
|
60
62
|
GetSongsParams,
|
|
61
63
|
MatchSongParams,
|
|
62
64
|
CreateSongInput,
|
|
63
|
-
} from "./namespaces/song";
|
|
64
|
-
export type { GetAlbumsParams } from "./namespaces/album";
|
|
65
|
+
} from "./namespaces/song.js";
|
|
66
|
+
export type { GetAlbumsParams } from "./namespaces/album.js";
|
|
65
67
|
export type {
|
|
66
68
|
GetArtistsParams,
|
|
67
69
|
ArtistListenersParams,
|
|
68
70
|
GetArtistTracksParams,
|
|
69
|
-
} from "./namespaces/artist";
|
|
71
|
+
} from "./namespaces/artist.js";
|
|
70
72
|
export type {
|
|
71
73
|
ListApikeysParams,
|
|
72
74
|
CreateApikeyInput,
|
|
73
75
|
UpdateApikeyInput,
|
|
74
|
-
} from "./namespaces/apikey";
|
|
76
|
+
} from "./namespaces/apikey.js";
|
|
75
77
|
export type {
|
|
76
78
|
ScrobblesChartParams,
|
|
77
79
|
TopChartParams,
|
|
78
|
-
} from "./namespaces/charts";
|
|
80
|
+
} from "./namespaces/charts.js";
|
|
79
81
|
export type {
|
|
80
82
|
FollowListParams,
|
|
81
83
|
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";
|
|
84
|
+
} from "./namespaces/graph.js";
|
|
85
|
+
export type { RecommendParams } from "./namespaces/feed.js";
|
|
86
|
+
export type { LikeInput } from "./namespaces/like.js";
|
|
87
|
+
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
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
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
|
}
|
package/src/namespaces/actor.ts
CHANGED
|
@@ -8,9 +8,9 @@ import type {
|
|
|
8
8
|
GetActorScrobblesParams,
|
|
9
9
|
GetActorSongsParams,
|
|
10
10
|
GetProfileParams,
|
|
11
|
-
} from "../generated/types";
|
|
12
|
-
import type { RequestOptions } from "../types";
|
|
13
|
-
import type { Call } from "./_helpers";
|
|
11
|
+
} from "../generated/types.js";
|
|
12
|
+
import type { RequestOptions } from "../types.js";
|
|
13
|
+
import type { Call } from "./_helpers.js";
|
|
14
14
|
|
|
15
15
|
export type { GetProfileParams };
|
|
16
16
|
export type ActorPagedParams = GetActorScrobblesParams;
|
|
@@ -19,73 +19,73 @@ export type ActorRangeParams = GetActorAlbumsParams;
|
|
|
19
19
|
export class ActorNamespace {
|
|
20
20
|
constructor(private readonly call: Call) {}
|
|
21
21
|
|
|
22
|
-
getProfile
|
|
23
|
-
return this.call
|
|
22
|
+
getProfile(params: GetProfileParams = {}, opts?: RequestOptions) {
|
|
23
|
+
return this.call("app.rocksky.actor.getProfile", "GET", {
|
|
24
24
|
params,
|
|
25
25
|
...opts,
|
|
26
26
|
});
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
getActorAlbums
|
|
30
|
-
return this.call
|
|
29
|
+
getActorAlbums(params: GetActorAlbumsParams, opts?: RequestOptions) {
|
|
30
|
+
return this.call("app.rocksky.actor.getActorAlbums", "GET", {
|
|
31
31
|
params,
|
|
32
32
|
...opts,
|
|
33
33
|
});
|
|
34
34
|
}
|
|
35
35
|
|
|
36
|
-
getActorArtists
|
|
37
|
-
return this.call
|
|
36
|
+
getActorArtists(params: GetActorArtistsParams, opts?: RequestOptions) {
|
|
37
|
+
return this.call("app.rocksky.actor.getActorArtists", "GET", {
|
|
38
38
|
params,
|
|
39
39
|
...opts,
|
|
40
40
|
});
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
-
getActorSongs
|
|
44
|
-
return this.call
|
|
43
|
+
getActorSongs(params: GetActorSongsParams, opts?: RequestOptions) {
|
|
44
|
+
return this.call("app.rocksky.actor.getActorSongs", "GET", {
|
|
45
45
|
params,
|
|
46
46
|
...opts,
|
|
47
47
|
});
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
-
getActorScrobbles
|
|
50
|
+
getActorScrobbles(
|
|
51
51
|
params: GetActorScrobblesParams,
|
|
52
52
|
opts?: RequestOptions,
|
|
53
53
|
) {
|
|
54
|
-
return this.call
|
|
54
|
+
return this.call("app.rocksky.actor.getActorScrobbles", "GET", {
|
|
55
55
|
params,
|
|
56
56
|
...opts,
|
|
57
57
|
});
|
|
58
58
|
}
|
|
59
59
|
|
|
60
|
-
getActorLovedSongs
|
|
60
|
+
getActorLovedSongs(
|
|
61
61
|
params: GetActorLovedSongsParams,
|
|
62
62
|
opts?: RequestOptions,
|
|
63
63
|
) {
|
|
64
|
-
return this.call
|
|
64
|
+
return this.call("app.rocksky.actor.getActorLovedSongs", "GET", {
|
|
65
65
|
params,
|
|
66
66
|
...opts,
|
|
67
67
|
});
|
|
68
68
|
}
|
|
69
69
|
|
|
70
|
-
getActorPlaylists
|
|
70
|
+
getActorPlaylists(
|
|
71
71
|
params: GetActorPlaylistsParams,
|
|
72
72
|
opts?: RequestOptions,
|
|
73
73
|
) {
|
|
74
|
-
return this.call
|
|
74
|
+
return this.call("app.rocksky.actor.getActorPlaylists", "GET", {
|
|
75
75
|
params,
|
|
76
76
|
...opts,
|
|
77
77
|
});
|
|
78
78
|
}
|
|
79
79
|
|
|
80
|
-
getActorNeighbours
|
|
81
|
-
return this.call
|
|
80
|
+
getActorNeighbours(params: GetActorNeighboursParams, opts?: RequestOptions) {
|
|
81
|
+
return this.call("app.rocksky.actor.getActorNeighbours", "GET", {
|
|
82
82
|
params,
|
|
83
83
|
...opts,
|
|
84
84
|
});
|
|
85
85
|
}
|
|
86
86
|
|
|
87
|
-
getActorCompatibility
|
|
88
|
-
return this.call
|
|
87
|
+
getActorCompatibility(params: GetActorCompatibilityParams, opts?: RequestOptions) {
|
|
88
|
+
return this.call("app.rocksky.actor.getActorCompatibility", "GET", {
|
|
89
89
|
params,
|
|
90
90
|
...opts,
|
|
91
91
|
});
|
package/src/namespaces/album.ts
CHANGED
|
@@ -2,31 +2,31 @@ import type {
|
|
|
2
2
|
GetAlbumParams,
|
|
3
3
|
GetAlbumsParams,
|
|
4
4
|
GetAlbumTracksParams,
|
|
5
|
-
} from "../generated/types";
|
|
6
|
-
import type { RequestOptions } from "../types";
|
|
7
|
-
import type { Call } from "./_helpers";
|
|
5
|
+
} from "../generated/types.js";
|
|
6
|
+
import type { RequestOptions } from "../types.js";
|
|
7
|
+
import type { Call } from "./_helpers.js";
|
|
8
8
|
|
|
9
9
|
export type { GetAlbumsParams };
|
|
10
10
|
|
|
11
11
|
export class AlbumNamespace {
|
|
12
12
|
constructor(private readonly call: Call) {}
|
|
13
13
|
|
|
14
|
-
getAlbum
|
|
15
|
-
return this.call
|
|
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
|
|
22
|
-
return this.call
|
|
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
|
|
29
|
-
return this.call
|
|
28
|
+
getAlbumTracks(params: GetAlbumTracksParams, opts?: RequestOptions) {
|
|
29
|
+
return this.call("app.rocksky.album.getAlbumTracks", "GET", {
|
|
30
30
|
params,
|
|
31
31
|
...opts,
|
|
32
32
|
});
|
package/src/namespaces/apikey.ts
CHANGED
|
@@ -3,9 +3,9 @@ import type {
|
|
|
3
3
|
GetApikeysParams,
|
|
4
4
|
RemoveApikeyParams,
|
|
5
5
|
UpdateApikeyInput,
|
|
6
|
-
} from "../generated/types";
|
|
7
|
-
import type { RequestOptions } from "../types";
|
|
8
|
-
import type { Call } from "./_helpers";
|
|
6
|
+
} from "../generated/types.js";
|
|
7
|
+
import type { RequestOptions } from "../types.js";
|
|
8
|
+
import type { Call } from "./_helpers.js";
|
|
9
9
|
|
|
10
10
|
export type { CreateApikeyInput, UpdateApikeyInput };
|
|
11
11
|
export type ListApikeysParams = GetApikeysParams;
|
|
@@ -13,35 +13,35 @@ export type ListApikeysParams = GetApikeysParams;
|
|
|
13
13
|
export class ApikeyNamespace {
|
|
14
14
|
constructor(private readonly call: Call) {}
|
|
15
15
|
|
|
16
|
-
getApikeys
|
|
16
|
+
getApikeys(
|
|
17
17
|
params: ListApikeysParams = {},
|
|
18
18
|
opts?: RequestOptions,
|
|
19
19
|
) {
|
|
20
|
-
return this.call
|
|
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
|
|
28
|
-
return this.call
|
|
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
|
|
36
|
-
return this.call
|
|
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
|
|
44
|
-
return this.call
|
|
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,
|