@rocksky/sdk 0.3.0 → 0.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +44 -254
- package/dist/agent.d.ts +77 -0
- package/dist/agent.d.ts.map +1 -0
- package/dist/client.d.ts +26 -113
- package/dist/client.d.ts.map +1 -1
- package/dist/dedup.d.ts +38 -0
- package/dist/dedup.d.ts.map +1 -0
- package/dist/errors.d.ts +3 -23
- package/dist/errors.d.ts.map +1 -1
- package/dist/generated/types.d.ts +106 -8
- package/dist/generated/types.d.ts.map +1 -1
- package/dist/hash.d.ts +7 -0
- package/dist/hash.d.ts.map +1 -0
- package/dist/index.d.ts +16 -17
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +6648 -1288
- package/dist/jetstream.d.ts +17 -0
- package/dist/jetstream.d.ts.map +1 -0
- package/package.json +15 -11
- package/src/agent.ts +232 -0
- package/src/client.ts +82 -226
- package/src/dedup.ts +207 -0
- package/src/errors.ts +6 -43
- package/src/generated/types.ts +115 -8
- package/src/hash.ts +22 -0
- package/src/index.ts +16 -86
- package/src/jetstream.ts +122 -0
- package/src/http.ts +0 -195
- package/src/namespaces/_helpers.ts +0 -27
- package/src/namespaces/actor.ts +0 -93
- package/src/namespaces/album.ts +0 -34
- package/src/namespaces/apikey.ts +0 -50
- package/src/namespaces/artist.ts +0 -68
- package/src/namespaces/charts.ts +0 -38
- package/src/namespaces/dropbox.ts +0 -53
- package/src/namespaces/feed.ts +0 -112
- package/src/namespaces/googledrive.ts +0 -41
- package/src/namespaces/graph.ts +0 -62
- package/src/namespaces/like.ts +0 -46
- package/src/namespaces/mirror.ts +0 -27
- package/src/namespaces/player.ts +0 -125
- package/src/namespaces/playlist.ts +0 -95
- package/src/namespaces/scrobble.ts +0 -41
- package/src/namespaces/shout.ts +0 -99
- package/src/namespaces/song.ts +0 -60
- package/src/namespaces/spotify.ts +0 -56
- package/src/namespaces/stats.ts +0 -27
- package/src/paginate.ts +0 -90
- package/src/pipe.ts +0 -146
- package/src/realtime.ts +0 -408
- package/src/types.ts +0 -41
package/src/http.ts
DELETED
|
@@ -1,195 +0,0 @@
|
|
|
1
|
-
import {
|
|
2
|
-
RockskyAuthError,
|
|
3
|
-
RockskyHttpError,
|
|
4
|
-
RockskyTimeoutError,
|
|
5
|
-
} from "./errors.js";
|
|
6
|
-
import {
|
|
7
|
-
type AuthProvider,
|
|
8
|
-
DEFAULT_BASE_URL,
|
|
9
|
-
type FetchLike,
|
|
10
|
-
type RequestOptions,
|
|
11
|
-
} from "./types.js";
|
|
12
|
-
|
|
13
|
-
export type XrpcCallOptions = RequestOptions & {
|
|
14
|
-
params?: object;
|
|
15
|
-
body?: unknown;
|
|
16
|
-
requireAuth?: boolean;
|
|
17
|
-
};
|
|
18
|
-
|
|
19
|
-
export type HttpClientConfig = {
|
|
20
|
-
baseUrl: string;
|
|
21
|
-
auth?: AuthProvider;
|
|
22
|
-
fetch: FetchLike;
|
|
23
|
-
headers: Record<string, string>;
|
|
24
|
-
timeoutMs: number;
|
|
25
|
-
retries: number;
|
|
26
|
-
retryDelayMs: number;
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
export function buildConfig(opts: {
|
|
30
|
-
baseUrl?: string;
|
|
31
|
-
auth?: AuthProvider;
|
|
32
|
-
fetch?: FetchLike;
|
|
33
|
-
headers?: Record<string, string>;
|
|
34
|
-
timeoutMs?: number;
|
|
35
|
-
retries?: number;
|
|
36
|
-
retryDelayMs?: number;
|
|
37
|
-
userAgent?: string;
|
|
38
|
-
}): HttpClientConfig {
|
|
39
|
-
const headers: Record<string, string> = {
|
|
40
|
-
accept: "application/json",
|
|
41
|
-
...(opts.userAgent ? { "user-agent": opts.userAgent } : {}),
|
|
42
|
-
...(opts.headers ?? {}),
|
|
43
|
-
};
|
|
44
|
-
return {
|
|
45
|
-
baseUrl: stripTrailingSlash(opts.baseUrl ?? DEFAULT_BASE_URL),
|
|
46
|
-
auth: opts.auth,
|
|
47
|
-
fetch: opts.fetch ?? globalThis.fetch.bind(globalThis),
|
|
48
|
-
headers,
|
|
49
|
-
timeoutMs: opts.timeoutMs ?? 30_000,
|
|
50
|
-
retries: opts.retries ?? 0,
|
|
51
|
-
retryDelayMs: opts.retryDelayMs ?? 300,
|
|
52
|
-
};
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
function stripTrailingSlash(url: string): string {
|
|
56
|
-
return url.endsWith("/") ? url.slice(0, -1) : url;
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
async function resolveAuth(
|
|
60
|
-
provider: AuthProvider | undefined | null,
|
|
61
|
-
): Promise<string | undefined> {
|
|
62
|
-
if (provider == null) return undefined;
|
|
63
|
-
if (typeof provider === "string") return provider;
|
|
64
|
-
return await provider();
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
export function serializeParams(
|
|
68
|
-
params: object | undefined,
|
|
69
|
-
): string {
|
|
70
|
-
if (!params) return "";
|
|
71
|
-
const usp = new URLSearchParams();
|
|
72
|
-
for (const [k, v] of Object.entries(params as Record<string, unknown>)) {
|
|
73
|
-
if (v == null) continue;
|
|
74
|
-
if (Array.isArray(v)) {
|
|
75
|
-
for (const item of v) {
|
|
76
|
-
if (item == null) continue;
|
|
77
|
-
usp.append(k, String(item));
|
|
78
|
-
}
|
|
79
|
-
} else if (typeof v === "boolean") {
|
|
80
|
-
usp.append(k, v ? "true" : "false");
|
|
81
|
-
} else {
|
|
82
|
-
usp.append(k, String(v));
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
const s = usp.toString();
|
|
86
|
-
return s ? `?${s}` : "";
|
|
87
|
-
}
|
|
88
|
-
|
|
89
|
-
export async function xrpcCall<T>(
|
|
90
|
-
config: HttpClientConfig,
|
|
91
|
-
nsid: string,
|
|
92
|
-
method: "GET" | "POST",
|
|
93
|
-
opts: XrpcCallOptions = {},
|
|
94
|
-
): Promise<T> {
|
|
95
|
-
const url =
|
|
96
|
-
`${config.baseUrl}/xrpc/${nsid}` + serializeParams(opts.params);
|
|
97
|
-
|
|
98
|
-
const timeoutMs = opts.timeoutMs ?? config.timeoutMs;
|
|
99
|
-
const retries = opts.retries ?? config.retries;
|
|
100
|
-
|
|
101
|
-
const headers: Record<string, string> = {
|
|
102
|
-
...config.headers,
|
|
103
|
-
...(opts.headers ?? {}),
|
|
104
|
-
};
|
|
105
|
-
|
|
106
|
-
const authProvider = opts.auth === undefined ? config.auth : opts.auth;
|
|
107
|
-
const token = await resolveAuth(authProvider);
|
|
108
|
-
if (token) {
|
|
109
|
-
headers.authorization = `Bearer ${token}`;
|
|
110
|
-
} else if (opts.requireAuth) {
|
|
111
|
-
throw new RockskyAuthError(
|
|
112
|
-
`${nsid} requires authentication — provide an "auth" token`,
|
|
113
|
-
);
|
|
114
|
-
}
|
|
115
|
-
|
|
116
|
-
const init: RequestInit = {
|
|
117
|
-
method,
|
|
118
|
-
headers,
|
|
119
|
-
signal: opts.signal,
|
|
120
|
-
};
|
|
121
|
-
|
|
122
|
-
if (method === "POST" && opts.body !== undefined) {
|
|
123
|
-
headers["content-type"] = "application/json";
|
|
124
|
-
init.body = JSON.stringify(opts.body);
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
let lastErr: unknown;
|
|
128
|
-
for (let attempt = 0; attempt <= retries; attempt++) {
|
|
129
|
-
try {
|
|
130
|
-
return await runOnce<T>(config.fetch, url, init, timeoutMs);
|
|
131
|
-
} catch (err) {
|
|
132
|
-
lastErr = err;
|
|
133
|
-
if (!isRetryable(err) || attempt === retries) throw err;
|
|
134
|
-
await sleep(config.retryDelayMs * Math.pow(2, attempt));
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
throw lastErr;
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
async function runOnce<T>(
|
|
141
|
-
fetchImpl: FetchLike,
|
|
142
|
-
url: string,
|
|
143
|
-
init: RequestInit,
|
|
144
|
-
timeoutMs: number,
|
|
145
|
-
): Promise<T> {
|
|
146
|
-
const controller = new AbortController();
|
|
147
|
-
const upstream = init.signal;
|
|
148
|
-
const onAbort = () => controller.abort(upstream?.reason);
|
|
149
|
-
upstream?.addEventListener("abort", onAbort, { once: true });
|
|
150
|
-
const timer = setTimeout(() => controller.abort(), timeoutMs);
|
|
151
|
-
try {
|
|
152
|
-
const res = await fetchImpl(url, { ...init, signal: controller.signal });
|
|
153
|
-
const text = await res.text();
|
|
154
|
-
const body = parseMaybeJson(text);
|
|
155
|
-
if (!res.ok) {
|
|
156
|
-
throw new RockskyHttpError({
|
|
157
|
-
status: res.status,
|
|
158
|
-
statusText: res.statusText,
|
|
159
|
-
url,
|
|
160
|
-
body,
|
|
161
|
-
});
|
|
162
|
-
}
|
|
163
|
-
return body as T;
|
|
164
|
-
} catch (err) {
|
|
165
|
-
if (err instanceof DOMException && err.name === "AbortError") {
|
|
166
|
-
if (upstream?.aborted) throw err;
|
|
167
|
-
throw new RockskyTimeoutError(timeoutMs);
|
|
168
|
-
}
|
|
169
|
-
throw err;
|
|
170
|
-
} finally {
|
|
171
|
-
clearTimeout(timer);
|
|
172
|
-
upstream?.removeEventListener("abort", onAbort);
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
function parseMaybeJson(text: string): unknown {
|
|
177
|
-
if (!text) return null;
|
|
178
|
-
try {
|
|
179
|
-
return JSON.parse(text);
|
|
180
|
-
} catch {
|
|
181
|
-
return text;
|
|
182
|
-
}
|
|
183
|
-
}
|
|
184
|
-
|
|
185
|
-
function isRetryable(err: unknown): boolean {
|
|
186
|
-
if (err instanceof RockskyTimeoutError) return true;
|
|
187
|
-
if (err instanceof RockskyHttpError) {
|
|
188
|
-
return err.status >= 500 || err.status === 429;
|
|
189
|
-
}
|
|
190
|
-
return false;
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
function sleep(ms: number): Promise<void> {
|
|
194
|
-
return new Promise((r) => setTimeout(r, ms));
|
|
195
|
-
}
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { type HttpClientConfig, xrpcCall } from "../http.js";
|
|
2
|
-
import type { RequestOptions } from "../types.js";
|
|
3
|
-
import type { Endpoints } from "../generated/types.js";
|
|
4
|
-
|
|
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
|
-
}
|
|
23
|
-
|
|
24
|
-
export function makeCall(config: HttpClientConfig): Call {
|
|
25
|
-
return ((nsid: string, method: "GET" | "POST", opts?: CallOpts) =>
|
|
26
|
-
xrpcCall(config, nsid, method, opts ?? {})) as Call;
|
|
27
|
-
}
|
package/src/namespaces/actor.ts
DELETED
|
@@ -1,93 +0,0 @@
|
|
|
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";
|
|
14
|
-
|
|
15
|
-
export type { GetProfileParams };
|
|
16
|
-
export type ActorPagedParams = GetActorScrobblesParams;
|
|
17
|
-
export type ActorRangeParams = GetActorAlbumsParams;
|
|
18
|
-
|
|
19
|
-
export class ActorNamespace {
|
|
20
|
-
constructor(private readonly call: Call) {}
|
|
21
|
-
|
|
22
|
-
getProfile(params: GetProfileParams = {}, opts?: RequestOptions) {
|
|
23
|
-
return this.call("app.rocksky.actor.getProfile", "GET", {
|
|
24
|
-
params,
|
|
25
|
-
...opts,
|
|
26
|
-
});
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
getActorAlbums(params: GetActorAlbumsParams, opts?: RequestOptions) {
|
|
30
|
-
return this.call("app.rocksky.actor.getActorAlbums", "GET", {
|
|
31
|
-
params,
|
|
32
|
-
...opts,
|
|
33
|
-
});
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
getActorArtists(params: GetActorArtistsParams, opts?: RequestOptions) {
|
|
37
|
-
return this.call("app.rocksky.actor.getActorArtists", "GET", {
|
|
38
|
-
params,
|
|
39
|
-
...opts,
|
|
40
|
-
});
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
getActorSongs(params: GetActorSongsParams, opts?: RequestOptions) {
|
|
44
|
-
return this.call("app.rocksky.actor.getActorSongs", "GET", {
|
|
45
|
-
params,
|
|
46
|
-
...opts,
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
getActorScrobbles(
|
|
51
|
-
params: GetActorScrobblesParams,
|
|
52
|
-
opts?: RequestOptions,
|
|
53
|
-
) {
|
|
54
|
-
return this.call("app.rocksky.actor.getActorScrobbles", "GET", {
|
|
55
|
-
params,
|
|
56
|
-
...opts,
|
|
57
|
-
});
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
getActorLovedSongs(
|
|
61
|
-
params: GetActorLovedSongsParams,
|
|
62
|
-
opts?: RequestOptions,
|
|
63
|
-
) {
|
|
64
|
-
return this.call("app.rocksky.actor.getActorLovedSongs", "GET", {
|
|
65
|
-
params,
|
|
66
|
-
...opts,
|
|
67
|
-
});
|
|
68
|
-
}
|
|
69
|
-
|
|
70
|
-
getActorPlaylists(
|
|
71
|
-
params: GetActorPlaylistsParams,
|
|
72
|
-
opts?: RequestOptions,
|
|
73
|
-
) {
|
|
74
|
-
return this.call("app.rocksky.actor.getActorPlaylists", "GET", {
|
|
75
|
-
params,
|
|
76
|
-
...opts,
|
|
77
|
-
});
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
getActorNeighbours(params: GetActorNeighboursParams, opts?: RequestOptions) {
|
|
81
|
-
return this.call("app.rocksky.actor.getActorNeighbours", "GET", {
|
|
82
|
-
params,
|
|
83
|
-
...opts,
|
|
84
|
-
});
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
getActorCompatibility(params: GetActorCompatibilityParams, opts?: RequestOptions) {
|
|
88
|
-
return this.call("app.rocksky.actor.getActorCompatibility", "GET", {
|
|
89
|
-
params,
|
|
90
|
-
...opts,
|
|
91
|
-
});
|
|
92
|
-
}
|
|
93
|
-
}
|
package/src/namespaces/album.ts
DELETED
|
@@ -1,34 +0,0 @@
|
|
|
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";
|
|
8
|
-
|
|
9
|
-
export type { GetAlbumsParams };
|
|
10
|
-
|
|
11
|
-
export class AlbumNamespace {
|
|
12
|
-
constructor(private readonly call: Call) {}
|
|
13
|
-
|
|
14
|
-
getAlbum(params: GetAlbumParams, opts?: RequestOptions) {
|
|
15
|
-
return this.call("app.rocksky.album.getAlbum", "GET", {
|
|
16
|
-
params,
|
|
17
|
-
...opts,
|
|
18
|
-
});
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
getAlbums(params: GetAlbumsParams = {}, opts?: RequestOptions) {
|
|
22
|
-
return this.call("app.rocksky.album.getAlbums", "GET", {
|
|
23
|
-
params,
|
|
24
|
-
...opts,
|
|
25
|
-
});
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
getAlbumTracks(params: GetAlbumTracksParams, opts?: RequestOptions) {
|
|
29
|
-
return this.call("app.rocksky.album.getAlbumTracks", "GET", {
|
|
30
|
-
params,
|
|
31
|
-
...opts,
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
}
|
package/src/namespaces/apikey.ts
DELETED
|
@@ -1,50 +0,0 @@
|
|
|
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";
|
|
9
|
-
|
|
10
|
-
export type { CreateApikeyInput, UpdateApikeyInput };
|
|
11
|
-
export type ListApikeysParams = GetApikeysParams;
|
|
12
|
-
|
|
13
|
-
export class ApikeyNamespace {
|
|
14
|
-
constructor(private readonly call: Call) {}
|
|
15
|
-
|
|
16
|
-
getApikeys(
|
|
17
|
-
params: ListApikeysParams = {},
|
|
18
|
-
opts?: RequestOptions,
|
|
19
|
-
) {
|
|
20
|
-
return this.call("app.rocksky.apikey.getApikeys", "GET", {
|
|
21
|
-
params,
|
|
22
|
-
requireAuth: true,
|
|
23
|
-
...opts,
|
|
24
|
-
});
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
createApikey(input: CreateApikeyInput, opts?: RequestOptions) {
|
|
28
|
-
return this.call("app.rocksky.apikey.createApikey", "POST", {
|
|
29
|
-
body: input,
|
|
30
|
-
requireAuth: true,
|
|
31
|
-
...opts,
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
updateApikey(input: UpdateApikeyInput, opts?: RequestOptions) {
|
|
36
|
-
return this.call("app.rocksky.apikey.updateApikey", "POST", {
|
|
37
|
-
body: input,
|
|
38
|
-
requireAuth: true,
|
|
39
|
-
...opts,
|
|
40
|
-
});
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
removeApikey(params: RemoveApikeyParams, opts?: RequestOptions) {
|
|
44
|
-
return this.call("app.rocksky.apikey.removeApikey", "POST", {
|
|
45
|
-
params,
|
|
46
|
-
requireAuth: true,
|
|
47
|
-
...opts,
|
|
48
|
-
});
|
|
49
|
-
}
|
|
50
|
-
}
|
package/src/namespaces/artist.ts
DELETED
|
@@ -1,68 +0,0 @@
|
|
|
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";
|
|
11
|
-
|
|
12
|
-
export type { GetArtistsParams, GetArtistTracksParams };
|
|
13
|
-
export type ArtistListenersParams = GetArtistListenersParams;
|
|
14
|
-
|
|
15
|
-
export class ArtistNamespace {
|
|
16
|
-
constructor(private readonly call: Call) {}
|
|
17
|
-
|
|
18
|
-
getArtist(params: GetArtistParams, opts?: RequestOptions) {
|
|
19
|
-
return this.call("app.rocksky.artist.getArtist", "GET", {
|
|
20
|
-
params,
|
|
21
|
-
...opts,
|
|
22
|
-
});
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
getArtists(params: GetArtistsParams = {}, opts?: RequestOptions) {
|
|
26
|
-
return this.call("app.rocksky.artist.getArtists", "GET", {
|
|
27
|
-
params,
|
|
28
|
-
...opts,
|
|
29
|
-
});
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
getArtistAlbums(params: GetArtistAlbumsParams, opts?: RequestOptions) {
|
|
33
|
-
return this.call("app.rocksky.artist.getArtistAlbums", "GET", {
|
|
34
|
-
params,
|
|
35
|
-
...opts,
|
|
36
|
-
});
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
getArtistTracks(
|
|
40
|
-
params: GetArtistTracksParams = {},
|
|
41
|
-
opts?: RequestOptions,
|
|
42
|
-
) {
|
|
43
|
-
return this.call("app.rocksky.artist.getArtistTracks", "GET", {
|
|
44
|
-
params,
|
|
45
|
-
...opts,
|
|
46
|
-
});
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
getArtistListeners(
|
|
50
|
-
params: GetArtistListenersParams,
|
|
51
|
-
opts?: RequestOptions,
|
|
52
|
-
) {
|
|
53
|
-
return this.call("app.rocksky.artist.getArtistListeners", "GET", {
|
|
54
|
-
params,
|
|
55
|
-
...opts,
|
|
56
|
-
});
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
getArtistRecentListeners(
|
|
60
|
-
params: GetArtistRecentListenersParams,
|
|
61
|
-
opts?: RequestOptions,
|
|
62
|
-
) {
|
|
63
|
-
return this.call("app.rocksky.artist.getArtistRecentListeners", "GET", {
|
|
64
|
-
params,
|
|
65
|
-
...opts,
|
|
66
|
-
});
|
|
67
|
-
}
|
|
68
|
-
}
|
package/src/namespaces/charts.ts
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
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";
|
|
8
|
-
|
|
9
|
-
export type ScrobblesChartParams = GetScrobblesChartParams;
|
|
10
|
-
export type TopChartParams = GetTopArtistsParams;
|
|
11
|
-
|
|
12
|
-
export class ChartsNamespace {
|
|
13
|
-
constructor(private readonly call: Call) {}
|
|
14
|
-
|
|
15
|
-
getScrobblesChart(
|
|
16
|
-
params: ScrobblesChartParams = {},
|
|
17
|
-
opts?: RequestOptions,
|
|
18
|
-
) {
|
|
19
|
-
return this.call("app.rocksky.charts.getScrobblesChart", "GET", {
|
|
20
|
-
params,
|
|
21
|
-
...opts,
|
|
22
|
-
});
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
getTopArtists(params: GetTopArtistsParams = {}, opts?: RequestOptions) {
|
|
26
|
-
return this.call("app.rocksky.charts.getTopArtists", "GET", {
|
|
27
|
-
params,
|
|
28
|
-
...opts,
|
|
29
|
-
});
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
getTopTracks(params: GetTopTracksParams = {}, opts?: RequestOptions) {
|
|
33
|
-
return this.call("app.rocksky.charts.getTopTracks", "GET", {
|
|
34
|
-
params,
|
|
35
|
-
...opts,
|
|
36
|
-
});
|
|
37
|
-
}
|
|
38
|
-
}
|
|
@@ -1,53 +0,0 @@
|
|
|
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";
|
|
9
|
-
|
|
10
|
-
export class DropboxNamespace {
|
|
11
|
-
constructor(private readonly call: Call) {}
|
|
12
|
-
|
|
13
|
-
getFiles(
|
|
14
|
-
params: GetFilesParams = {},
|
|
15
|
-
opts?: RequestOptions,
|
|
16
|
-
) {
|
|
17
|
-
return this.call("app.rocksky.dropbox.getFiles", "GET", {
|
|
18
|
-
params,
|
|
19
|
-
requireAuth: true,
|
|
20
|
-
...opts,
|
|
21
|
-
});
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
getMetadata(params: GetMetadataParams, opts?: RequestOptions) {
|
|
25
|
-
return this.call("app.rocksky.dropbox.getMetadata", "GET", {
|
|
26
|
-
params,
|
|
27
|
-
requireAuth: true,
|
|
28
|
-
...opts,
|
|
29
|
-
});
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
getTemporaryLink(
|
|
33
|
-
params: GetTemporaryLinkParams,
|
|
34
|
-
opts?: RequestOptions,
|
|
35
|
-
) {
|
|
36
|
-
return this.call("app.rocksky.dropbox.getTemporaryLink", "GET", {
|
|
37
|
-
params,
|
|
38
|
-
requireAuth: true,
|
|
39
|
-
...opts,
|
|
40
|
-
});
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
downloadFile(
|
|
44
|
-
params: DownloadFileParams,
|
|
45
|
-
opts?: RequestOptions,
|
|
46
|
-
) {
|
|
47
|
-
return this.call("app.rocksky.dropbox.downloadFile", "GET", {
|
|
48
|
-
params,
|
|
49
|
-
requireAuth: true,
|
|
50
|
-
...opts,
|
|
51
|
-
});
|
|
52
|
-
}
|
|
53
|
-
}
|
package/src/namespaces/feed.ts
DELETED
|
@@ -1,112 +0,0 @@
|
|
|
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";
|
|
14
|
-
|
|
15
|
-
export type RecommendParams = GetRecommendationsParams;
|
|
16
|
-
|
|
17
|
-
export class FeedNamespace {
|
|
18
|
-
constructor(private readonly call: Call) {}
|
|
19
|
-
|
|
20
|
-
search(params: SearchParams, opts?: RequestOptions) {
|
|
21
|
-
return this.call("app.rocksky.feed.search", "GET", {
|
|
22
|
-
params,
|
|
23
|
-
...opts,
|
|
24
|
-
});
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
getFeed(
|
|
28
|
-
params: GetFeedParams,
|
|
29
|
-
opts?: RequestOptions,
|
|
30
|
-
) {
|
|
31
|
-
return this.call("app.rocksky.feed.getFeed", "GET", {
|
|
32
|
-
params,
|
|
33
|
-
...opts,
|
|
34
|
-
});
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
getFeedGenerators(
|
|
38
|
-
params: GetFeedGeneratorsParams = {},
|
|
39
|
-
opts?: RequestOptions,
|
|
40
|
-
) {
|
|
41
|
-
return this.call("app.rocksky.feed.getFeedGenerators", "GET", {
|
|
42
|
-
params,
|
|
43
|
-
...opts,
|
|
44
|
-
});
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
getFeedGenerator(
|
|
48
|
-
params: GetFeedGeneratorParams,
|
|
49
|
-
opts?: RequestOptions,
|
|
50
|
-
) {
|
|
51
|
-
return this.call("app.rocksky.feed.getFeedGenerator", "GET", {
|
|
52
|
-
params,
|
|
53
|
-
...opts,
|
|
54
|
-
});
|
|
55
|
-
}
|
|
56
|
-
|
|
57
|
-
describeFeedGenerator(opts?: RequestOptions) {
|
|
58
|
-
return this.call("app.rocksky.feed.describeFeedGenerator", "GET", {
|
|
59
|
-
...opts,
|
|
60
|
-
});
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
getFeedSkeleton(
|
|
64
|
-
params: GetFeedSkeletonParams,
|
|
65
|
-
opts?: RequestOptions,
|
|
66
|
-
) {
|
|
67
|
-
return this.call("app.rocksky.feed.getFeedSkeleton", "GET", {
|
|
68
|
-
params,
|
|
69
|
-
...opts,
|
|
70
|
-
});
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
getRecommendations(
|
|
74
|
-
params: GetRecommendationsParams,
|
|
75
|
-
opts?: RequestOptions,
|
|
76
|
-
) {
|
|
77
|
-
return this.call("app.rocksky.feed.getRecommendations", "GET", {
|
|
78
|
-
params,
|
|
79
|
-
...opts,
|
|
80
|
-
});
|
|
81
|
-
}
|
|
82
|
-
|
|
83
|
-
getArtistRecommendations(
|
|
84
|
-
params: GetArtistRecommendationsParams,
|
|
85
|
-
opts?: RequestOptions,
|
|
86
|
-
) {
|
|
87
|
-
return this.call("app.rocksky.feed.getArtistRecommendations", "GET", {
|
|
88
|
-
params,
|
|
89
|
-
...opts,
|
|
90
|
-
});
|
|
91
|
-
}
|
|
92
|
-
|
|
93
|
-
getAlbumRecommendations(
|
|
94
|
-
params: GetAlbumRecommendationsParams,
|
|
95
|
-
opts?: RequestOptions,
|
|
96
|
-
) {
|
|
97
|
-
return this.call("app.rocksky.feed.getAlbumRecommendations", "GET", {
|
|
98
|
-
params,
|
|
99
|
-
...opts,
|
|
100
|
-
});
|
|
101
|
-
}
|
|
102
|
-
|
|
103
|
-
getStories(
|
|
104
|
-
params: GetStoriesParams = {},
|
|
105
|
-
opts?: RequestOptions,
|
|
106
|
-
) {
|
|
107
|
-
return this.call("app.rocksky.feed.getStories", "GET", {
|
|
108
|
-
params,
|
|
109
|
-
...opts,
|
|
110
|
-
});
|
|
111
|
-
}
|
|
112
|
-
}
|