soundcloud-api-ts 1.9.1 → 1.9.3
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/AGENTS.md +197 -0
- package/README.md +5 -1
- package/dist/{chunk-SCUOUK3L.mjs → chunk-G6S6GM75.mjs} +2 -2
- package/dist/{chunk-SCUOUK3L.mjs.map → chunk-G6S6GM75.mjs.map} +1 -1
- package/dist/{chunk-PRQGEYWK.js → chunk-IU4XNEP2.js} +2 -2
- package/dist/{chunk-PRQGEYWK.js.map → chunk-IU4XNEP2.js.map} +1 -1
- package/dist/cli.js +6 -6
- package/dist/cli.mjs +1 -1
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +63 -63
- package/dist/index.mjs +1 -1
- package/llms.txt +195 -0
- package/package.json +4 -2
package/dist/cli.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
'use strict';
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var chunkIU4XNEP2_js = require('./chunk-IU4XNEP2.js');
|
|
5
5
|
require('./chunk-NBKG62HR.js');
|
|
6
6
|
var readline = require('readline');
|
|
7
7
|
var http = require('http');
|
|
@@ -115,7 +115,7 @@ function getClient(config) {
|
|
|
115
115
|
if (!config.clientId || !config.clientSecret) {
|
|
116
116
|
die("Not configured. Run `sc-cli auth` first.");
|
|
117
117
|
}
|
|
118
|
-
const client = new
|
|
118
|
+
const client = new chunkIU4XNEP2_js.SoundCloudClient({
|
|
119
119
|
clientId: config.clientId,
|
|
120
120
|
clientSecret: config.clientSecret,
|
|
121
121
|
redirectUri: "http://localhost:8976/callback"
|
|
@@ -169,7 +169,7 @@ ${col(c.bold + c.cyan, "\u26A1 SoundCloud CLI Setup")}
|
|
|
169
169
|
if (!clientSecret) die("Client Secret is required.");
|
|
170
170
|
const spinner = createSpinner("Verifying credentials\u2026");
|
|
171
171
|
try {
|
|
172
|
-
const client = new
|
|
172
|
+
const client = new chunkIU4XNEP2_js.SoundCloudClient({ clientId, clientSecret });
|
|
173
173
|
const token = await client.auth.getClientToken();
|
|
174
174
|
spinner.stop(`${col(c.green, "\u2714")} Credentials verified!`);
|
|
175
175
|
const config = { clientId, clientSecret, token: token.access_token };
|
|
@@ -185,9 +185,9 @@ async function cmdLogin() {
|
|
|
185
185
|
if (!config.clientId || !config.clientSecret) {
|
|
186
186
|
die("Not configured. Run `sc-cli auth` first.");
|
|
187
187
|
}
|
|
188
|
-
const verifier =
|
|
189
|
-
const challenge = await
|
|
190
|
-
const client = new
|
|
188
|
+
const verifier = chunkIU4XNEP2_js.generateCodeVerifier();
|
|
189
|
+
const challenge = await chunkIU4XNEP2_js.generateCodeChallenge(verifier);
|
|
190
|
+
const client = new chunkIU4XNEP2_js.SoundCloudClient({
|
|
191
191
|
clientId: config.clientId,
|
|
192
192
|
clientSecret: config.clientSecret,
|
|
193
193
|
redirectUri: "http://localhost:8976/callback"
|
package/dist/cli.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { generateCodeVerifier, generateCodeChallenge, SoundCloudClient } from './chunk-
|
|
2
|
+
import { generateCodeVerifier, generateCodeChallenge, SoundCloudClient } from './chunk-G6S6GM75.mjs';
|
|
3
3
|
import './chunk-CYDTNVV3.mjs';
|
|
4
4
|
import * as readline from 'readline';
|
|
5
5
|
import * as http from 'http';
|
package/dist/index.d.mts
CHANGED
|
@@ -1499,7 +1499,7 @@ declare function getAuthorizationUrl(clientId: string, redirectUri: string, opti
|
|
|
1499
1499
|
/**
|
|
1500
1500
|
* Generate a random PKCE code verifier (43+ characters, base64url-encoded).
|
|
1501
1501
|
*
|
|
1502
|
-
* Uses the Web Crypto API (`globalThis.crypto`), compatible with Node
|
|
1502
|
+
* Uses the Web Crypto API (`globalThis.crypto`), compatible with Node 20+ and modern browsers.
|
|
1503
1503
|
*
|
|
1504
1504
|
* @returns A cryptographically random code verifier string
|
|
1505
1505
|
*
|
|
@@ -1519,7 +1519,7 @@ declare function generateCodeVerifier(): string;
|
|
|
1519
1519
|
* Derive the S256 PKCE code challenge from a code verifier.
|
|
1520
1520
|
*
|
|
1521
1521
|
* Computes `BASE64URL(SHA256(verifier))` using the Web Crypto API (SubtleCrypto),
|
|
1522
|
-
* available in Node
|
|
1522
|
+
* available in Node 20+ and modern browsers.
|
|
1523
1523
|
*
|
|
1524
1524
|
* @param verifier - The code verifier string (typically from {@link generateCodeVerifier})
|
|
1525
1525
|
* @returns The base64url-encoded SHA-256 hash of the verifier
|
package/dist/index.d.ts
CHANGED
|
@@ -1499,7 +1499,7 @@ declare function getAuthorizationUrl(clientId: string, redirectUri: string, opti
|
|
|
1499
1499
|
/**
|
|
1500
1500
|
* Generate a random PKCE code verifier (43+ characters, base64url-encoded).
|
|
1501
1501
|
*
|
|
1502
|
-
* Uses the Web Crypto API (`globalThis.crypto`), compatible with Node
|
|
1502
|
+
* Uses the Web Crypto API (`globalThis.crypto`), compatible with Node 20+ and modern browsers.
|
|
1503
1503
|
*
|
|
1504
1504
|
* @returns A cryptographically random code verifier string
|
|
1505
1505
|
*
|
|
@@ -1519,7 +1519,7 @@ declare function generateCodeVerifier(): string;
|
|
|
1519
1519
|
* Derive the S256 PKCE code challenge from a code verifier.
|
|
1520
1520
|
*
|
|
1521
1521
|
* Computes `BASE64URL(SHA256(verifier))` using the Web Crypto API (SubtleCrypto),
|
|
1522
|
-
* available in Node
|
|
1522
|
+
* available in Node 20+ and modern browsers.
|
|
1523
1523
|
*
|
|
1524
1524
|
* @param verifier - The code verifier string (typically from {@link generateCodeVerifier})
|
|
1525
1525
|
* @returns The base64url-encoded SHA-256 hash of the verifier
|
package/dist/index.js
CHANGED
|
@@ -1,257 +1,257 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var chunkIU4XNEP2_js = require('./chunk-IU4XNEP2.js');
|
|
4
4
|
var chunkNBKG62HR_js = require('./chunk-NBKG62HR.js');
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
Object.defineProperty(exports, "SoundCloudClient", {
|
|
9
9
|
enumerable: true,
|
|
10
|
-
get: function () { return
|
|
10
|
+
get: function () { return chunkIU4XNEP2_js.SoundCloudClient; }
|
|
11
11
|
});
|
|
12
12
|
Object.defineProperty(exports, "createPlaylist", {
|
|
13
13
|
enumerable: true,
|
|
14
|
-
get: function () { return
|
|
14
|
+
get: function () { return chunkIU4XNEP2_js.createPlaylist; }
|
|
15
15
|
});
|
|
16
16
|
Object.defineProperty(exports, "createTrackComment", {
|
|
17
17
|
enumerable: true,
|
|
18
|
-
get: function () { return
|
|
18
|
+
get: function () { return chunkIU4XNEP2_js.createTrackComment; }
|
|
19
19
|
});
|
|
20
20
|
Object.defineProperty(exports, "deletePlaylist", {
|
|
21
21
|
enumerable: true,
|
|
22
|
-
get: function () { return
|
|
22
|
+
get: function () { return chunkIU4XNEP2_js.deletePlaylist; }
|
|
23
23
|
});
|
|
24
24
|
Object.defineProperty(exports, "deleteTrack", {
|
|
25
25
|
enumerable: true,
|
|
26
|
-
get: function () { return
|
|
26
|
+
get: function () { return chunkIU4XNEP2_js.deleteTrack; }
|
|
27
27
|
});
|
|
28
28
|
Object.defineProperty(exports, "fetchAll", {
|
|
29
29
|
enumerable: true,
|
|
30
|
-
get: function () { return
|
|
30
|
+
get: function () { return chunkIU4XNEP2_js.fetchAll; }
|
|
31
31
|
});
|
|
32
32
|
Object.defineProperty(exports, "followUser", {
|
|
33
33
|
enumerable: true,
|
|
34
|
-
get: function () { return
|
|
34
|
+
get: function () { return chunkIU4XNEP2_js.followUser; }
|
|
35
35
|
});
|
|
36
36
|
Object.defineProperty(exports, "generateCodeChallenge", {
|
|
37
37
|
enumerable: true,
|
|
38
|
-
get: function () { return
|
|
38
|
+
get: function () { return chunkIU4XNEP2_js.generateCodeChallenge; }
|
|
39
39
|
});
|
|
40
40
|
Object.defineProperty(exports, "generateCodeVerifier", {
|
|
41
41
|
enumerable: true,
|
|
42
|
-
get: function () { return
|
|
42
|
+
get: function () { return chunkIU4XNEP2_js.generateCodeVerifier; }
|
|
43
43
|
});
|
|
44
44
|
Object.defineProperty(exports, "getAuthorizationUrl", {
|
|
45
45
|
enumerable: true,
|
|
46
|
-
get: function () { return
|
|
46
|
+
get: function () { return chunkIU4XNEP2_js.getAuthorizationUrl; }
|
|
47
47
|
});
|
|
48
48
|
Object.defineProperty(exports, "getClientToken", {
|
|
49
49
|
enumerable: true,
|
|
50
|
-
get: function () { return
|
|
50
|
+
get: function () { return chunkIU4XNEP2_js.getClientToken; }
|
|
51
51
|
});
|
|
52
52
|
Object.defineProperty(exports, "getFollowers", {
|
|
53
53
|
enumerable: true,
|
|
54
|
-
get: function () { return
|
|
54
|
+
get: function () { return chunkIU4XNEP2_js.getFollowers; }
|
|
55
55
|
});
|
|
56
56
|
Object.defineProperty(exports, "getFollowings", {
|
|
57
57
|
enumerable: true,
|
|
58
|
-
get: function () { return
|
|
58
|
+
get: function () { return chunkIU4XNEP2_js.getFollowings; }
|
|
59
59
|
});
|
|
60
60
|
Object.defineProperty(exports, "getMe", {
|
|
61
61
|
enumerable: true,
|
|
62
|
-
get: function () { return
|
|
62
|
+
get: function () { return chunkIU4XNEP2_js.getMe; }
|
|
63
63
|
});
|
|
64
64
|
Object.defineProperty(exports, "getMeActivities", {
|
|
65
65
|
enumerable: true,
|
|
66
|
-
get: function () { return
|
|
66
|
+
get: function () { return chunkIU4XNEP2_js.getMeActivities; }
|
|
67
67
|
});
|
|
68
68
|
Object.defineProperty(exports, "getMeActivitiesOwn", {
|
|
69
69
|
enumerable: true,
|
|
70
|
-
get: function () { return
|
|
70
|
+
get: function () { return chunkIU4XNEP2_js.getMeActivitiesOwn; }
|
|
71
71
|
});
|
|
72
72
|
Object.defineProperty(exports, "getMeActivitiesTracks", {
|
|
73
73
|
enumerable: true,
|
|
74
|
-
get: function () { return
|
|
74
|
+
get: function () { return chunkIU4XNEP2_js.getMeActivitiesTracks; }
|
|
75
75
|
});
|
|
76
76
|
Object.defineProperty(exports, "getMeFollowers", {
|
|
77
77
|
enumerable: true,
|
|
78
|
-
get: function () { return
|
|
78
|
+
get: function () { return chunkIU4XNEP2_js.getMeFollowers; }
|
|
79
79
|
});
|
|
80
80
|
Object.defineProperty(exports, "getMeFollowings", {
|
|
81
81
|
enumerable: true,
|
|
82
|
-
get: function () { return
|
|
82
|
+
get: function () { return chunkIU4XNEP2_js.getMeFollowings; }
|
|
83
83
|
});
|
|
84
84
|
Object.defineProperty(exports, "getMeFollowingsTracks", {
|
|
85
85
|
enumerable: true,
|
|
86
|
-
get: function () { return
|
|
86
|
+
get: function () { return chunkIU4XNEP2_js.getMeFollowingsTracks; }
|
|
87
87
|
});
|
|
88
88
|
Object.defineProperty(exports, "getMeLikesPlaylists", {
|
|
89
89
|
enumerable: true,
|
|
90
|
-
get: function () { return
|
|
90
|
+
get: function () { return chunkIU4XNEP2_js.getMeLikesPlaylists; }
|
|
91
91
|
});
|
|
92
92
|
Object.defineProperty(exports, "getMeLikesTracks", {
|
|
93
93
|
enumerable: true,
|
|
94
|
-
get: function () { return
|
|
94
|
+
get: function () { return chunkIU4XNEP2_js.getMeLikesTracks; }
|
|
95
95
|
});
|
|
96
96
|
Object.defineProperty(exports, "getMePlaylists", {
|
|
97
97
|
enumerable: true,
|
|
98
|
-
get: function () { return
|
|
98
|
+
get: function () { return chunkIU4XNEP2_js.getMePlaylists; }
|
|
99
99
|
});
|
|
100
100
|
Object.defineProperty(exports, "getMeTracks", {
|
|
101
101
|
enumerable: true,
|
|
102
|
-
get: function () { return
|
|
102
|
+
get: function () { return chunkIU4XNEP2_js.getMeTracks; }
|
|
103
103
|
});
|
|
104
104
|
Object.defineProperty(exports, "getPlaylist", {
|
|
105
105
|
enumerable: true,
|
|
106
|
-
get: function () { return
|
|
106
|
+
get: function () { return chunkIU4XNEP2_js.getPlaylist; }
|
|
107
107
|
});
|
|
108
108
|
Object.defineProperty(exports, "getPlaylistReposts", {
|
|
109
109
|
enumerable: true,
|
|
110
|
-
get: function () { return
|
|
110
|
+
get: function () { return chunkIU4XNEP2_js.getPlaylistReposts; }
|
|
111
111
|
});
|
|
112
112
|
Object.defineProperty(exports, "getPlaylistTracks", {
|
|
113
113
|
enumerable: true,
|
|
114
|
-
get: function () { return
|
|
114
|
+
get: function () { return chunkIU4XNEP2_js.getPlaylistTracks; }
|
|
115
115
|
});
|
|
116
116
|
Object.defineProperty(exports, "getRelatedTracks", {
|
|
117
117
|
enumerable: true,
|
|
118
|
-
get: function () { return
|
|
118
|
+
get: function () { return chunkIU4XNEP2_js.getRelatedTracks; }
|
|
119
119
|
});
|
|
120
120
|
Object.defineProperty(exports, "getSoundCloudWidgetUrl", {
|
|
121
121
|
enumerable: true,
|
|
122
|
-
get: function () { return
|
|
122
|
+
get: function () { return chunkIU4XNEP2_js.getSoundCloudWidgetUrl; }
|
|
123
123
|
});
|
|
124
124
|
Object.defineProperty(exports, "getTrack", {
|
|
125
125
|
enumerable: true,
|
|
126
|
-
get: function () { return
|
|
126
|
+
get: function () { return chunkIU4XNEP2_js.getTrack; }
|
|
127
127
|
});
|
|
128
128
|
Object.defineProperty(exports, "getTrackComments", {
|
|
129
129
|
enumerable: true,
|
|
130
|
-
get: function () { return
|
|
130
|
+
get: function () { return chunkIU4XNEP2_js.getTrackComments; }
|
|
131
131
|
});
|
|
132
132
|
Object.defineProperty(exports, "getTrackLikes", {
|
|
133
133
|
enumerable: true,
|
|
134
|
-
get: function () { return
|
|
134
|
+
get: function () { return chunkIU4XNEP2_js.getTrackLikes; }
|
|
135
135
|
});
|
|
136
136
|
Object.defineProperty(exports, "getTrackReposts", {
|
|
137
137
|
enumerable: true,
|
|
138
|
-
get: function () { return
|
|
138
|
+
get: function () { return chunkIU4XNEP2_js.getTrackReposts; }
|
|
139
139
|
});
|
|
140
140
|
Object.defineProperty(exports, "getTrackStreams", {
|
|
141
141
|
enumerable: true,
|
|
142
|
-
get: function () { return
|
|
142
|
+
get: function () { return chunkIU4XNEP2_js.getTrackStreams; }
|
|
143
143
|
});
|
|
144
144
|
Object.defineProperty(exports, "getUser", {
|
|
145
145
|
enumerable: true,
|
|
146
|
-
get: function () { return
|
|
146
|
+
get: function () { return chunkIU4XNEP2_js.getUser; }
|
|
147
147
|
});
|
|
148
148
|
Object.defineProperty(exports, "getUserLikesPlaylists", {
|
|
149
149
|
enumerable: true,
|
|
150
|
-
get: function () { return
|
|
150
|
+
get: function () { return chunkIU4XNEP2_js.getUserLikesPlaylists; }
|
|
151
151
|
});
|
|
152
152
|
Object.defineProperty(exports, "getUserLikesTracks", {
|
|
153
153
|
enumerable: true,
|
|
154
|
-
get: function () { return
|
|
154
|
+
get: function () { return chunkIU4XNEP2_js.getUserLikesTracks; }
|
|
155
155
|
});
|
|
156
156
|
Object.defineProperty(exports, "getUserPlaylists", {
|
|
157
157
|
enumerable: true,
|
|
158
|
-
get: function () { return
|
|
158
|
+
get: function () { return chunkIU4XNEP2_js.getUserPlaylists; }
|
|
159
159
|
});
|
|
160
160
|
Object.defineProperty(exports, "getUserToken", {
|
|
161
161
|
enumerable: true,
|
|
162
|
-
get: function () { return
|
|
162
|
+
get: function () { return chunkIU4XNEP2_js.getUserToken; }
|
|
163
163
|
});
|
|
164
164
|
Object.defineProperty(exports, "getUserTracks", {
|
|
165
165
|
enumerable: true,
|
|
166
|
-
get: function () { return
|
|
166
|
+
get: function () { return chunkIU4XNEP2_js.getUserTracks; }
|
|
167
167
|
});
|
|
168
168
|
Object.defineProperty(exports, "getUserWebProfiles", {
|
|
169
169
|
enumerable: true,
|
|
170
|
-
get: function () { return
|
|
170
|
+
get: function () { return chunkIU4XNEP2_js.getUserWebProfiles; }
|
|
171
171
|
});
|
|
172
172
|
Object.defineProperty(exports, "likePlaylist", {
|
|
173
173
|
enumerable: true,
|
|
174
|
-
get: function () { return
|
|
174
|
+
get: function () { return chunkIU4XNEP2_js.likePlaylist; }
|
|
175
175
|
});
|
|
176
176
|
Object.defineProperty(exports, "likeTrack", {
|
|
177
177
|
enumerable: true,
|
|
178
|
-
get: function () { return
|
|
178
|
+
get: function () { return chunkIU4XNEP2_js.likeTrack; }
|
|
179
179
|
});
|
|
180
180
|
Object.defineProperty(exports, "paginate", {
|
|
181
181
|
enumerable: true,
|
|
182
|
-
get: function () { return
|
|
182
|
+
get: function () { return chunkIU4XNEP2_js.paginate; }
|
|
183
183
|
});
|
|
184
184
|
Object.defineProperty(exports, "paginateItems", {
|
|
185
185
|
enumerable: true,
|
|
186
|
-
get: function () { return
|
|
186
|
+
get: function () { return chunkIU4XNEP2_js.paginateItems; }
|
|
187
187
|
});
|
|
188
188
|
Object.defineProperty(exports, "refreshUserToken", {
|
|
189
189
|
enumerable: true,
|
|
190
|
-
get: function () { return
|
|
190
|
+
get: function () { return chunkIU4XNEP2_js.refreshUserToken; }
|
|
191
191
|
});
|
|
192
192
|
Object.defineProperty(exports, "repostPlaylist", {
|
|
193
193
|
enumerable: true,
|
|
194
|
-
get: function () { return
|
|
194
|
+
get: function () { return chunkIU4XNEP2_js.repostPlaylist; }
|
|
195
195
|
});
|
|
196
196
|
Object.defineProperty(exports, "repostTrack", {
|
|
197
197
|
enumerable: true,
|
|
198
|
-
get: function () { return
|
|
198
|
+
get: function () { return chunkIU4XNEP2_js.repostTrack; }
|
|
199
199
|
});
|
|
200
200
|
Object.defineProperty(exports, "resolveUrl", {
|
|
201
201
|
enumerable: true,
|
|
202
|
-
get: function () { return
|
|
202
|
+
get: function () { return chunkIU4XNEP2_js.resolveUrl; }
|
|
203
203
|
});
|
|
204
204
|
Object.defineProperty(exports, "scFetch", {
|
|
205
205
|
enumerable: true,
|
|
206
|
-
get: function () { return
|
|
206
|
+
get: function () { return chunkIU4XNEP2_js.scFetch; }
|
|
207
207
|
});
|
|
208
208
|
Object.defineProperty(exports, "scFetchUrl", {
|
|
209
209
|
enumerable: true,
|
|
210
|
-
get: function () { return
|
|
210
|
+
get: function () { return chunkIU4XNEP2_js.scFetchUrl; }
|
|
211
211
|
});
|
|
212
212
|
Object.defineProperty(exports, "searchPlaylists", {
|
|
213
213
|
enumerable: true,
|
|
214
|
-
get: function () { return
|
|
214
|
+
get: function () { return chunkIU4XNEP2_js.searchPlaylists; }
|
|
215
215
|
});
|
|
216
216
|
Object.defineProperty(exports, "searchTracks", {
|
|
217
217
|
enumerable: true,
|
|
218
|
-
get: function () { return
|
|
218
|
+
get: function () { return chunkIU4XNEP2_js.searchTracks; }
|
|
219
219
|
});
|
|
220
220
|
Object.defineProperty(exports, "searchUsers", {
|
|
221
221
|
enumerable: true,
|
|
222
|
-
get: function () { return
|
|
222
|
+
get: function () { return chunkIU4XNEP2_js.searchUsers; }
|
|
223
223
|
});
|
|
224
224
|
Object.defineProperty(exports, "signOut", {
|
|
225
225
|
enumerable: true,
|
|
226
|
-
get: function () { return
|
|
226
|
+
get: function () { return chunkIU4XNEP2_js.signOut; }
|
|
227
227
|
});
|
|
228
228
|
Object.defineProperty(exports, "unfollowUser", {
|
|
229
229
|
enumerable: true,
|
|
230
|
-
get: function () { return
|
|
230
|
+
get: function () { return chunkIU4XNEP2_js.unfollowUser; }
|
|
231
231
|
});
|
|
232
232
|
Object.defineProperty(exports, "unlikePlaylist", {
|
|
233
233
|
enumerable: true,
|
|
234
|
-
get: function () { return
|
|
234
|
+
get: function () { return chunkIU4XNEP2_js.unlikePlaylist; }
|
|
235
235
|
});
|
|
236
236
|
Object.defineProperty(exports, "unlikeTrack", {
|
|
237
237
|
enumerable: true,
|
|
238
|
-
get: function () { return
|
|
238
|
+
get: function () { return chunkIU4XNEP2_js.unlikeTrack; }
|
|
239
239
|
});
|
|
240
240
|
Object.defineProperty(exports, "unrepostPlaylist", {
|
|
241
241
|
enumerable: true,
|
|
242
|
-
get: function () { return
|
|
242
|
+
get: function () { return chunkIU4XNEP2_js.unrepostPlaylist; }
|
|
243
243
|
});
|
|
244
244
|
Object.defineProperty(exports, "unrepostTrack", {
|
|
245
245
|
enumerable: true,
|
|
246
|
-
get: function () { return
|
|
246
|
+
get: function () { return chunkIU4XNEP2_js.unrepostTrack; }
|
|
247
247
|
});
|
|
248
248
|
Object.defineProperty(exports, "updatePlaylist", {
|
|
249
249
|
enumerable: true,
|
|
250
|
-
get: function () { return
|
|
250
|
+
get: function () { return chunkIU4XNEP2_js.updatePlaylist; }
|
|
251
251
|
});
|
|
252
252
|
Object.defineProperty(exports, "updateTrack", {
|
|
253
253
|
enumerable: true,
|
|
254
|
-
get: function () { return
|
|
254
|
+
get: function () { return chunkIU4XNEP2_js.updateTrack; }
|
|
255
255
|
});
|
|
256
256
|
Object.defineProperty(exports, "SoundCloudError", {
|
|
257
257
|
enumerable: true,
|
package/dist/index.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { SoundCloudClient, createPlaylist, createTrackComment, deletePlaylist, deleteTrack, fetchAll, followUser, generateCodeChallenge, generateCodeVerifier, getAuthorizationUrl, getClientToken, getFollowers, getFollowings, getMe, getMeActivities, getMeActivitiesOwn, getMeActivitiesTracks, getMeFollowers, getMeFollowings, getMeFollowingsTracks, getMeLikesPlaylists, getMeLikesTracks, getMePlaylists, getMeTracks, getPlaylist, getPlaylistReposts, getPlaylistTracks, getRelatedTracks, getSoundCloudWidgetUrl, getTrack, getTrackComments, getTrackLikes, getTrackReposts, getTrackStreams, getUser, getUserLikesPlaylists, getUserLikesTracks, getUserPlaylists, getUserToken, getUserTracks, getUserWebProfiles, likePlaylist, likeTrack, paginate, paginateItems, refreshUserToken, repostPlaylist, repostTrack, resolveUrl, scFetch, scFetchUrl, searchPlaylists, searchTracks, searchUsers, signOut, unfollowUser, unlikePlaylist, unlikeTrack, unrepostPlaylist, unrepostTrack, updatePlaylist, updateTrack } from './chunk-
|
|
1
|
+
export { SoundCloudClient, createPlaylist, createTrackComment, deletePlaylist, deleteTrack, fetchAll, followUser, generateCodeChallenge, generateCodeVerifier, getAuthorizationUrl, getClientToken, getFollowers, getFollowings, getMe, getMeActivities, getMeActivitiesOwn, getMeActivitiesTracks, getMeFollowers, getMeFollowings, getMeFollowingsTracks, getMeLikesPlaylists, getMeLikesTracks, getMePlaylists, getMeTracks, getPlaylist, getPlaylistReposts, getPlaylistTracks, getRelatedTracks, getSoundCloudWidgetUrl, getTrack, getTrackComments, getTrackLikes, getTrackReposts, getTrackStreams, getUser, getUserLikesPlaylists, getUserLikesTracks, getUserPlaylists, getUserToken, getUserTracks, getUserWebProfiles, likePlaylist, likeTrack, paginate, paginateItems, refreshUserToken, repostPlaylist, repostTrack, resolveUrl, scFetch, scFetchUrl, searchPlaylists, searchTracks, searchUsers, signOut, unfollowUser, unlikePlaylist, unlikeTrack, unrepostPlaylist, unrepostTrack, updatePlaylist, updateTrack } from './chunk-G6S6GM75.mjs';
|
|
2
2
|
export { SoundCloudError } from './chunk-CYDTNVV3.mjs';
|
|
3
3
|
//# sourceMappingURL=index.mjs.map
|
|
4
4
|
//# sourceMappingURL=index.mjs.map
|
package/llms.txt
ADDED
|
@@ -0,0 +1,195 @@
|
|
|
1
|
+
# soundcloud-api-ts v1.9.2
|
|
2
|
+
|
|
3
|
+
> A TypeScript client for the SoundCloud API. Zero dependencies, native fetch, full OAuth 2.1 + PKCE support.
|
|
4
|
+
|
|
5
|
+
## Installation
|
|
6
|
+
|
|
7
|
+
npm install soundcloud-api-ts
|
|
8
|
+
|
|
9
|
+
## Quick Start
|
|
10
|
+
|
|
11
|
+
```ts
|
|
12
|
+
import { SoundCloudClient } from 'soundcloud-api-ts';
|
|
13
|
+
|
|
14
|
+
const sc = new SoundCloudClient({
|
|
15
|
+
clientId: 'YOUR_CLIENT_ID',
|
|
16
|
+
clientSecret: 'YOUR_CLIENT_SECRET',
|
|
17
|
+
redirectUri: 'https://example.com/callback', // optional, needed for user auth
|
|
18
|
+
});
|
|
19
|
+
|
|
20
|
+
// Get a client credentials token
|
|
21
|
+
const token = await sc.auth.getClientToken();
|
|
22
|
+
sc.setToken(token.access_token);
|
|
23
|
+
|
|
24
|
+
// Fetch a track
|
|
25
|
+
const track = await sc.tracks.getTrack(123456);
|
|
26
|
+
console.log(track.title);
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
## API Reference
|
|
30
|
+
|
|
31
|
+
All methods accept an optional trailing `{ token?: string }` parameter to override the stored token.
|
|
32
|
+
Paginated responses return `SoundCloudPaginatedResponse<T>` with `collection: T[]` and `next_href?: string`.
|
|
33
|
+
|
|
34
|
+
### Auth (sc.auth)
|
|
35
|
+
|
|
36
|
+
getAuthorizationUrl(options?: { state?: string; codeChallenge?: string }): string
|
|
37
|
+
getClientToken(): Promise<SoundCloudToken>
|
|
38
|
+
getUserToken(code: string, codeVerifier?: string): Promise<SoundCloudToken>
|
|
39
|
+
refreshUserToken(refreshToken: string): Promise<SoundCloudToken>
|
|
40
|
+
signOut(accessToken: string): Promise<void>
|
|
41
|
+
|
|
42
|
+
### PKCE Helpers (standalone exports)
|
|
43
|
+
|
|
44
|
+
generateCodeVerifier(): string
|
|
45
|
+
generateCodeChallenge(verifier: string): Promise<string>
|
|
46
|
+
|
|
47
|
+
### Tracks (sc.tracks)
|
|
48
|
+
|
|
49
|
+
getTrack(trackId: string | number): Promise<SoundCloudTrack>
|
|
50
|
+
getStreams(trackId: string | number): Promise<SoundCloudStreams>
|
|
51
|
+
getComments(trackId: string | number, limit?: number): Promise<SoundCloudPaginatedResponse<SoundCloudComment>>
|
|
52
|
+
createComment(trackId: string | number, body: string, timestamp?: number): Promise<SoundCloudComment>
|
|
53
|
+
getLikes(trackId: string | number, limit?: number): Promise<SoundCloudPaginatedResponse<SoundCloudUser>>
|
|
54
|
+
getReposts(trackId: string | number, limit?: number): Promise<SoundCloudPaginatedResponse<SoundCloudUser>>
|
|
55
|
+
getRelated(trackId: string | number, limit?: number): Promise<SoundCloudTrack[]>
|
|
56
|
+
update(trackId: string | number, params: UpdateTrackParams): Promise<SoundCloudTrack>
|
|
57
|
+
delete(trackId: string | number): Promise<void>
|
|
58
|
+
|
|
59
|
+
### Users (sc.users)
|
|
60
|
+
|
|
61
|
+
getUser(userId: string | number): Promise<SoundCloudUser>
|
|
62
|
+
getFollowers(userId: string | number, limit?: number): Promise<SoundCloudPaginatedResponse<SoundCloudUser>>
|
|
63
|
+
getFollowings(userId: string | number, limit?: number): Promise<SoundCloudPaginatedResponse<SoundCloudUser>>
|
|
64
|
+
getTracks(userId: string | number, limit?: number): Promise<SoundCloudPaginatedResponse<SoundCloudTrack>>
|
|
65
|
+
getPlaylists(userId: string | number, limit?: number): Promise<SoundCloudPaginatedResponse<SoundCloudPlaylist>>
|
|
66
|
+
getLikesTracks(userId: string | number, limit?: number, cursor?: string): Promise<SoundCloudPaginatedResponse<SoundCloudTrack>>
|
|
67
|
+
getLikesPlaylists(userId: string | number, limit?: number): Promise<SoundCloudPaginatedResponse<SoundCloudPlaylist>>
|
|
68
|
+
getWebProfiles(userId: string | number): Promise<SoundCloudWebProfile[]>
|
|
69
|
+
|
|
70
|
+
### Playlists (sc.playlists)
|
|
71
|
+
|
|
72
|
+
getPlaylist(playlistId: string | number): Promise<SoundCloudPlaylist>
|
|
73
|
+
getTracks(playlistId: string | number, limit?: number, offset?: number): Promise<SoundCloudPaginatedResponse<SoundCloudTrack>>
|
|
74
|
+
getReposts(playlistId: string | number, limit?: number): Promise<SoundCloudPaginatedResponse<SoundCloudUser>>
|
|
75
|
+
create(params: CreatePlaylistParams): Promise<SoundCloudPlaylist>
|
|
76
|
+
update(playlistId: string | number, params: UpdatePlaylistParams): Promise<SoundCloudPlaylist>
|
|
77
|
+
delete(playlistId: string | number): Promise<void>
|
|
78
|
+
|
|
79
|
+
### Search (sc.search)
|
|
80
|
+
|
|
81
|
+
tracks(query: string, pageNumber?: number): Promise<SoundCloudPaginatedResponse<SoundCloudTrack>>
|
|
82
|
+
users(query: string, pageNumber?: number): Promise<SoundCloudPaginatedResponse<SoundCloudUser>>
|
|
83
|
+
playlists(query: string, pageNumber?: number): Promise<SoundCloudPaginatedResponse<SoundCloudPlaylist>>
|
|
84
|
+
|
|
85
|
+
### Me — Authenticated User (sc.me)
|
|
86
|
+
|
|
87
|
+
getMe(): Promise<SoundCloudMe>
|
|
88
|
+
getActivities(limit?: number): Promise<SoundCloudActivitiesResponse>
|
|
89
|
+
getActivitiesOwn(limit?: number): Promise<SoundCloudActivitiesResponse>
|
|
90
|
+
getActivitiesTracks(limit?: number): Promise<SoundCloudActivitiesResponse>
|
|
91
|
+
getLikesTracks(limit?: number): Promise<SoundCloudPaginatedResponse<SoundCloudTrack>>
|
|
92
|
+
getLikesPlaylists(limit?: number): Promise<SoundCloudPaginatedResponse<SoundCloudPlaylist>>
|
|
93
|
+
getFollowings(limit?: number): Promise<SoundCloudPaginatedResponse<SoundCloudUser>>
|
|
94
|
+
getFollowingsTracks(limit?: number): Promise<SoundCloudPaginatedResponse<SoundCloudTrack>>
|
|
95
|
+
getFollowers(limit?: number): Promise<SoundCloudPaginatedResponse<SoundCloudUser>>
|
|
96
|
+
getTracks(limit?: number): Promise<SoundCloudPaginatedResponse<SoundCloudTrack>>
|
|
97
|
+
getPlaylists(limit?: number): Promise<SoundCloudPaginatedResponse<SoundCloudPlaylist>>
|
|
98
|
+
follow(userUrn: string | number): Promise<void>
|
|
99
|
+
unfollow(userUrn: string | number): Promise<void>
|
|
100
|
+
|
|
101
|
+
### Likes (sc.likes)
|
|
102
|
+
|
|
103
|
+
likeTrack(trackId: string | number): Promise<boolean>
|
|
104
|
+
unlikeTrack(trackId: string | number): Promise<boolean>
|
|
105
|
+
likePlaylist(playlistId: string | number): Promise<boolean>
|
|
106
|
+
unlikePlaylist(playlistId: string | number): Promise<boolean>
|
|
107
|
+
|
|
108
|
+
### Reposts (sc.reposts)
|
|
109
|
+
|
|
110
|
+
repostTrack(trackId: string | number): Promise<boolean>
|
|
111
|
+
unrepostTrack(trackId: string | number): Promise<boolean>
|
|
112
|
+
repostPlaylist(playlistId: string | number): Promise<boolean>
|
|
113
|
+
unrepostPlaylist(playlistId: string | number): Promise<boolean>
|
|
114
|
+
|
|
115
|
+
### Resolve (sc.resolve)
|
|
116
|
+
|
|
117
|
+
resolveUrl(url: string): Promise<string>
|
|
118
|
+
|
|
119
|
+
### Pagination (instance methods)
|
|
120
|
+
|
|
121
|
+
sc.paginate<T>(firstPage: () => Promise<PaginatedResponse<T>>): AsyncGenerator<T[]>
|
|
122
|
+
sc.paginateItems<T>(firstPage: () => Promise<PaginatedResponse<T>>): AsyncGenerator<T>
|
|
123
|
+
sc.fetchAll<T>(firstPage: () => Promise<PaginatedResponse<T>>, options?: { maxItems?: number }): Promise<T[]>
|
|
124
|
+
|
|
125
|
+
### Client Methods
|
|
126
|
+
|
|
127
|
+
sc.setToken(accessToken: string, refreshToken?: string): void
|
|
128
|
+
sc.clearToken(): void
|
|
129
|
+
sc.accessToken: string | undefined
|
|
130
|
+
sc.refreshToken: string | undefined
|
|
131
|
+
|
|
132
|
+
## Common Patterns
|
|
133
|
+
|
|
134
|
+
### Client Credentials Flow (server-to-server)
|
|
135
|
+
```ts
|
|
136
|
+
const sc = new SoundCloudClient({ clientId: '...', clientSecret: '...' });
|
|
137
|
+
const token = await sc.auth.getClientToken();
|
|
138
|
+
sc.setToken(token.access_token);
|
|
139
|
+
```
|
|
140
|
+
|
|
141
|
+
### User Authorization Flow (with PKCE)
|
|
142
|
+
```ts
|
|
143
|
+
import { SoundCloudClient, generateCodeVerifier, generateCodeChallenge } from 'soundcloud-api-ts';
|
|
144
|
+
|
|
145
|
+
const sc = new SoundCloudClient({ clientId: '...', clientSecret: '...', redirectUri: 'https://...' });
|
|
146
|
+
const verifier = generateCodeVerifier();
|
|
147
|
+
const challenge = await generateCodeChallenge(verifier);
|
|
148
|
+
const authUrl = sc.auth.getAuthorizationUrl({ state: 'random', codeChallenge: challenge });
|
|
149
|
+
// redirect user to authUrl, get code from callback
|
|
150
|
+
const token = await sc.auth.getUserToken(code, verifier);
|
|
151
|
+
sc.setToken(token.access_token, token.refresh_token);
|
|
152
|
+
```
|
|
153
|
+
|
|
154
|
+
### Pagination
|
|
155
|
+
```ts
|
|
156
|
+
// Iterate individual items across all pages
|
|
157
|
+
for await (const track of sc.paginateItems(() => sc.search.tracks('lofi'))) {
|
|
158
|
+
console.log(track.title);
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
// Collect all into an array (with optional limit)
|
|
162
|
+
const all = await sc.fetchAll(() => sc.search.tracks('lofi'), { maxItems: 100 });
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
### Error Handling
|
|
166
|
+
```ts
|
|
167
|
+
import { SoundCloudError } from 'soundcloud-api-ts';
|
|
168
|
+
|
|
169
|
+
try {
|
|
170
|
+
await sc.tracks.getTrack(999);
|
|
171
|
+
} catch (err) {
|
|
172
|
+
if (err instanceof SoundCloudError) {
|
|
173
|
+
if (err.isNotFound) console.log('Not found');
|
|
174
|
+
if (err.isRateLimited) console.log('Rate limited');
|
|
175
|
+
if (err.isUnauthorized) console.log('Bad token');
|
|
176
|
+
console.log(err.status, err.message);
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
```
|
|
180
|
+
|
|
181
|
+
### Auto Token Refresh
|
|
182
|
+
```ts
|
|
183
|
+
const sc = new SoundCloudClient({
|
|
184
|
+
clientId: '...', clientSecret: '...',
|
|
185
|
+
onTokenRefresh: async (client) => {
|
|
186
|
+
const newToken = await client.auth.refreshUserToken(client.refreshToken!);
|
|
187
|
+
client.setToken(newToken.access_token, newToken.refresh_token);
|
|
188
|
+
return newToken;
|
|
189
|
+
},
|
|
190
|
+
});
|
|
191
|
+
```
|
|
192
|
+
|
|
193
|
+
## Full Documentation
|
|
194
|
+
|
|
195
|
+
https://twin-paws.github.io/soundcloud-api-ts/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "soundcloud-api-ts",
|
|
3
|
-
"version": "1.9.
|
|
3
|
+
"version": "1.9.3",
|
|
4
4
|
"description": "TypeScript-first SoundCloud API client for accessing tracks, users, playlists, and search endpoints. Zero dependencies, native fetch, full OAuth 2.1 + PKCE support.",
|
|
5
5
|
"bin": {
|
|
6
6
|
"sc-cli": "./dist/cli.js",
|
|
@@ -22,7 +22,9 @@
|
|
|
22
22
|
}
|
|
23
23
|
},
|
|
24
24
|
"files": [
|
|
25
|
-
"dist"
|
|
25
|
+
"dist",
|
|
26
|
+
"llms.txt",
|
|
27
|
+
"AGENTS.md"
|
|
26
28
|
],
|
|
27
29
|
"scripts": {
|
|
28
30
|
"build": "tsup",
|