soundcloud-api-ts 1.2.0 → 1.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 +51 -0
- package/dist/chunk-ALTJSKVN.mjs +57 -0
- package/dist/chunk-ALTJSKVN.mjs.map +1 -0
- package/dist/chunk-DZRZLIAH.js +59 -0
- package/dist/chunk-DZRZLIAH.js.map +1 -0
- package/dist/index.d.mts +1955 -106
- package/dist/index.d.ts +1955 -106
- package/dist/index.js +841 -95
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +838 -95
- package/dist/index.mjs.map +1 -1
- package/dist/types/index.d.mts +348 -16
- package/dist/types/index.d.ts +348 -16
- package/dist/types/index.js +8 -0
- package/dist/types/index.mjs +1 -1
- package/package.json +1 -1
package/dist/types/index.d.mts
CHANGED
|
@@ -1,223 +1,555 @@
|
|
|
1
|
-
/**
|
|
1
|
+
/**
|
|
2
|
+
* OAuth 2.0 token response returned by SoundCloud's `/oauth2/token` endpoint.
|
|
3
|
+
*
|
|
4
|
+
* @see https://developers.soundcloud.com/docs/api/explorer/open-api#/oauth2/post_oauth2_token
|
|
5
|
+
*/
|
|
2
6
|
interface SoundCloudToken {
|
|
7
|
+
/** The OAuth 2.0 access token used to authenticate API requests */
|
|
3
8
|
access_token: string;
|
|
9
|
+
/** Number of seconds until the access token expires */
|
|
4
10
|
expires_in: number;
|
|
11
|
+
/** Token used to obtain a new access token when the current one expires */
|
|
5
12
|
refresh_token: string;
|
|
13
|
+
/** OAuth scope granted (e.g. "*" for full access) */
|
|
6
14
|
scope: string;
|
|
15
|
+
/** Token type, typically "bearer" */
|
|
7
16
|
token_type: string;
|
|
8
17
|
}
|
|
9
|
-
/**
|
|
18
|
+
/**
|
|
19
|
+
* Represents a SoundCloud user profile.
|
|
20
|
+
*
|
|
21
|
+
* @see https://developers.soundcloud.com/docs/api/explorer/open-api#/users/get_users__user_id_
|
|
22
|
+
*/
|
|
10
23
|
interface SoundCloudUser {
|
|
24
|
+
/** URL to the user's avatar image */
|
|
11
25
|
avatar_url: string;
|
|
26
|
+
/** The user's city (may be empty string if not set) */
|
|
12
27
|
city: string;
|
|
28
|
+
/** The user's country (may be empty string if not set) */
|
|
13
29
|
country: string;
|
|
30
|
+
/** ISO 8601 timestamp of when the user account was created */
|
|
14
31
|
created_at: string;
|
|
32
|
+
/** The user's profile description / bio */
|
|
15
33
|
description: string;
|
|
34
|
+
/** The user's Discogs username, or null if not set */
|
|
16
35
|
discogs_name: string | null;
|
|
36
|
+
/** The user's first name */
|
|
17
37
|
first_name: string;
|
|
38
|
+
/** Total number of followers */
|
|
18
39
|
followers_count: number;
|
|
40
|
+
/** Total number of users this user is following */
|
|
19
41
|
followings_count: number;
|
|
42
|
+
/** The user's full name (first + last) */
|
|
20
43
|
full_name: string;
|
|
44
|
+
/** The user's unique numeric ID on SoundCloud */
|
|
21
45
|
id: number;
|
|
22
46
|
/** URN identifier (e.g. "soundcloud:users:123") */
|
|
23
47
|
urn: string;
|
|
48
|
+
/** Resource type, always "user" */
|
|
24
49
|
kind: string;
|
|
50
|
+
/** ISO 8601 timestamp of the last profile modification */
|
|
25
51
|
last_modified: string;
|
|
52
|
+
/** The user's last name */
|
|
26
53
|
last_name: string;
|
|
54
|
+
/** Total number of public likes (favorites) */
|
|
27
55
|
likes_count: number;
|
|
56
|
+
/** Whether the user is currently online */
|
|
28
57
|
online: boolean;
|
|
58
|
+
/** URL-friendly slug for the user's profile (e.g. "artist-name") */
|
|
29
59
|
permalink: string;
|
|
60
|
+
/** Full URL to the user's SoundCloud profile page */
|
|
30
61
|
permalink_url: string;
|
|
62
|
+
/** The user's subscription plan (e.g. "Free", "Pro") */
|
|
31
63
|
plan: string;
|
|
64
|
+
/** Total number of public playlists */
|
|
32
65
|
playlist_count: number;
|
|
66
|
+
/** Total number of public favorites */
|
|
33
67
|
public_favorites_count: number;
|
|
68
|
+
/** Total number of reposts */
|
|
34
69
|
reposts_count: number;
|
|
70
|
+
/** The user's active subscriptions */
|
|
35
71
|
subscriptions: SoundCloudSubscription[];
|
|
72
|
+
/** Total number of public tracks */
|
|
36
73
|
track_count: number;
|
|
74
|
+
/** API resource URI for this user */
|
|
37
75
|
uri: string;
|
|
76
|
+
/** The user's display name */
|
|
38
77
|
username: string;
|
|
78
|
+
/** The user's website URL, or null if not set */
|
|
39
79
|
website: string | null;
|
|
80
|
+
/** Display title for the user's website, or null if not set */
|
|
40
81
|
website_title: string | null;
|
|
41
|
-
/**
|
|
82
|
+
/**
|
|
83
|
+
* Comment count for this user.
|
|
84
|
+
* @deprecated Always returns 0 in current API responses.
|
|
85
|
+
*/
|
|
42
86
|
comments_count: number;
|
|
87
|
+
/** The user's Myspace username, or null if not set */
|
|
43
88
|
myspace_name: string | null;
|
|
44
89
|
}
|
|
45
|
-
/**
|
|
90
|
+
/**
|
|
91
|
+
* Extended user profile returned by the `/me` endpoint, including private account details.
|
|
92
|
+
*
|
|
93
|
+
* @see https://developers.soundcloud.com/docs/api/explorer/open-api#/me/get_me
|
|
94
|
+
*/
|
|
46
95
|
interface SoundCloudMe extends SoundCloudUser {
|
|
96
|
+
/** The user's locale setting (e.g. "en"), or null if not set */
|
|
47
97
|
locale: string | null;
|
|
98
|
+
/** Whether the user's primary email address has been confirmed */
|
|
48
99
|
primary_email_confirmed: boolean;
|
|
100
|
+
/** Number of private (unlisted) playlists */
|
|
49
101
|
private_playlists_count: number;
|
|
102
|
+
/** Number of private (unlisted) tracks */
|
|
50
103
|
private_tracks_count: number;
|
|
104
|
+
/** Upload quota information for the authenticated user */
|
|
51
105
|
quota: SoundCloudQuota;
|
|
106
|
+
/** Remaining upload time in seconds, or null if unlimited */
|
|
52
107
|
upload_seconds_left: number | null;
|
|
53
108
|
}
|
|
109
|
+
/**
|
|
110
|
+
* Upload quota details for the authenticated user.
|
|
111
|
+
*
|
|
112
|
+
* @see https://developers.soundcloud.com/docs/api/explorer/open-api#/me/get_me
|
|
113
|
+
*/
|
|
54
114
|
interface SoundCloudQuota {
|
|
115
|
+
/** Whether the user has an unlimited upload quota (e.g. Pro plan) */
|
|
55
116
|
unlimited_upload_quota: boolean;
|
|
117
|
+
/** Total upload time consumed in seconds */
|
|
56
118
|
upload_seconds_used: number;
|
|
119
|
+
/** Remaining upload time in seconds, or null if unlimited */
|
|
57
120
|
upload_seconds_left: number | null;
|
|
58
121
|
}
|
|
122
|
+
/**
|
|
123
|
+
* A subscription associated with a SoundCloud user account.
|
|
124
|
+
*
|
|
125
|
+
* @see https://developers.soundcloud.com/docs/api/explorer/open-api#/users
|
|
126
|
+
*/
|
|
59
127
|
interface SoundCloudSubscription {
|
|
128
|
+
/** The subscription product details */
|
|
60
129
|
product: SoundCloudSubscriptionProduct;
|
|
130
|
+
/** Whether the subscription auto-renews (may be absent) */
|
|
61
131
|
recurring?: boolean;
|
|
62
132
|
}
|
|
133
|
+
/**
|
|
134
|
+
* Product details for a SoundCloud subscription.
|
|
135
|
+
*
|
|
136
|
+
* @see https://developers.soundcloud.com/docs/api/explorer/open-api#/users
|
|
137
|
+
*/
|
|
63
138
|
interface SoundCloudSubscriptionProduct {
|
|
139
|
+
/** Unique product identifier (e.g. "creator-pro-unlimited") */
|
|
64
140
|
id: string;
|
|
141
|
+
/** Human-readable product name (e.g. "Pro Unlimited") */
|
|
65
142
|
name: string;
|
|
66
143
|
}
|
|
67
|
-
/**
|
|
144
|
+
/**
|
|
145
|
+
* Represents a SoundCloud track (audio upload).
|
|
146
|
+
*
|
|
147
|
+
* @see https://developers.soundcloud.com/docs/api/explorer/open-api#/tracks/get_tracks__track_id_
|
|
148
|
+
*/
|
|
68
149
|
interface SoundCloudTrack {
|
|
150
|
+
/** Access level for the track (e.g. "playable", "preview", "blocked") */
|
|
69
151
|
access: string;
|
|
152
|
+
/** URL to the track's artwork image (may be empty string if none) */
|
|
70
153
|
artwork_url: string;
|
|
154
|
+
/** ISO country codes where the track is available, or null if unrestricted */
|
|
71
155
|
available_country_codes: string[] | null;
|
|
156
|
+
/** Beats per minute of the track (0 if not set) */
|
|
72
157
|
bpm: number;
|
|
158
|
+
/** Total number of comments on this track */
|
|
73
159
|
comment_count: number;
|
|
160
|
+
/** Whether commenting is enabled on this track */
|
|
74
161
|
commentable: boolean;
|
|
162
|
+
/** ISO 8601 timestamp of when the track was uploaded */
|
|
75
163
|
created_at: string;
|
|
164
|
+
/** The track's description text */
|
|
76
165
|
description: string;
|
|
166
|
+
/** Total number of downloads */
|
|
77
167
|
download_count: number;
|
|
168
|
+
/** URL to download the original file (requires authentication) */
|
|
78
169
|
download_url: string;
|
|
170
|
+
/** Whether the track is downloadable */
|
|
79
171
|
downloadable: boolean;
|
|
172
|
+
/** Duration of the track in milliseconds */
|
|
80
173
|
duration: number;
|
|
174
|
+
/** Who can embed this track (e.g. "all", "me", "none") */
|
|
81
175
|
embeddable_by: string;
|
|
176
|
+
/** Total number of favorites/likes */
|
|
82
177
|
favoritings_count: number;
|
|
178
|
+
/** Music genre of the track (e.g. "Electronic") */
|
|
83
179
|
genre: string;
|
|
180
|
+
/** The track's unique numeric ID on SoundCloud */
|
|
84
181
|
id: number;
|
|
182
|
+
/** International Standard Recording Code, or null if not set */
|
|
85
183
|
isrc: string | null;
|
|
184
|
+
/** Musical key signature (e.g. "C major"), or null if not set */
|
|
86
185
|
key_signature: string | null;
|
|
186
|
+
/** Resource type, always "track" */
|
|
87
187
|
kind: string;
|
|
188
|
+
/** Record label name */
|
|
88
189
|
label_name: string;
|
|
190
|
+
/** Creative Commons license type (e.g. "all-rights-reserved", "cc-by") */
|
|
89
191
|
license: string;
|
|
90
|
-
/**
|
|
192
|
+
/** Artist name when different from the uploader, or null */
|
|
91
193
|
metadata_artist: string | null;
|
|
194
|
+
/** Monetization model applied to this track, or null */
|
|
92
195
|
monetization_model: string | null;
|
|
196
|
+
/** Full URL to the track's SoundCloud page */
|
|
93
197
|
permalink_url: string;
|
|
198
|
+
/** Total number of plays */
|
|
94
199
|
playback_count: number;
|
|
200
|
+
/** Content policy applied to this track, or null */
|
|
95
201
|
policy: string | null;
|
|
202
|
+
/** Label for the purchase/buy button */
|
|
96
203
|
purchase_title: string;
|
|
204
|
+
/** External purchase URL */
|
|
97
205
|
purchase_url: string;
|
|
206
|
+
/** Release identifier string, or null */
|
|
98
207
|
release: string | null;
|
|
208
|
+
/** Day of the release date (1-31) */
|
|
99
209
|
release_day: number;
|
|
210
|
+
/** Month of the release date (1-12) */
|
|
100
211
|
release_month: number;
|
|
212
|
+
/** Year of the release date */
|
|
101
213
|
release_year: number;
|
|
214
|
+
/** Total number of reposts */
|
|
102
215
|
reposts_count: number;
|
|
216
|
+
/** Secret URI for private tracks, or null for public tracks */
|
|
103
217
|
secret_uri: string | null;
|
|
218
|
+
/** Sharing setting: "public" or "private" */
|
|
104
219
|
sharing: string;
|
|
220
|
+
/** URL to the audio stream (requires authentication) */
|
|
105
221
|
stream_url: string;
|
|
222
|
+
/** Whether the track is streamable */
|
|
106
223
|
streamable: boolean;
|
|
224
|
+
/** Space-separated list of tags (tags with spaces are wrapped in quotes) */
|
|
107
225
|
tag_list: string;
|
|
226
|
+
/** The track's title */
|
|
108
227
|
title: string;
|
|
228
|
+
/** API resource URI for this track */
|
|
109
229
|
uri: string;
|
|
110
230
|
/** URN identifier (e.g. "soundcloud:tracks:123") */
|
|
111
231
|
urn: string;
|
|
232
|
+
/** The user who uploaded this track */
|
|
112
233
|
user: SoundCloudUser;
|
|
234
|
+
/** Whether the authenticated user has liked this track */
|
|
113
235
|
user_favorite: boolean;
|
|
236
|
+
/** Number of times the authenticated user has played this track, or null */
|
|
114
237
|
user_playback_count: number | null;
|
|
238
|
+
/** URL to the track's waveform image data */
|
|
115
239
|
waveform_url: string;
|
|
116
240
|
}
|
|
117
|
-
/**
|
|
241
|
+
/**
|
|
242
|
+
* Represents a SoundCloud playlist (also known as a "set").
|
|
243
|
+
*
|
|
244
|
+
* @see https://developers.soundcloud.com/docs/api/explorer/open-api#/playlists/get_playlists__playlist_id_
|
|
245
|
+
*/
|
|
118
246
|
interface SoundCloudPlaylist {
|
|
247
|
+
/** URL to the playlist's artwork image */
|
|
119
248
|
artwork_url: string;
|
|
249
|
+
/** ISO 8601 timestamp of when the playlist was created */
|
|
120
250
|
created_at: string;
|
|
251
|
+
/** The playlist's description text */
|
|
121
252
|
description: string;
|
|
253
|
+
/** Whether tracks in the playlist are downloadable */
|
|
122
254
|
downloadable: boolean;
|
|
255
|
+
/** Total duration of all tracks in the playlist in milliseconds */
|
|
123
256
|
duration: number;
|
|
257
|
+
/** European Article Number (barcode) for the release */
|
|
124
258
|
ean: string;
|
|
259
|
+
/** Who can embed this playlist (e.g. "all", "me", "none") */
|
|
125
260
|
embeddable_by: string;
|
|
261
|
+
/** Music genre of the playlist */
|
|
126
262
|
genre: string;
|
|
263
|
+
/** The playlist's unique numeric ID on SoundCloud */
|
|
127
264
|
id: number;
|
|
265
|
+
/** Resource type, always "playlist" */
|
|
128
266
|
kind: string;
|
|
267
|
+
/** Label user object, or null if no label is associated */
|
|
129
268
|
label: SoundCloudUser | null;
|
|
269
|
+
/** Numeric ID of the associated label, or null */
|
|
130
270
|
label_id: number | null;
|
|
271
|
+
/** Name of the associated record label */
|
|
131
272
|
label_name: string;
|
|
273
|
+
/** ISO 8601 timestamp of the last modification */
|
|
132
274
|
last_modified: string;
|
|
275
|
+
/** Creative Commons license type */
|
|
133
276
|
license: string;
|
|
277
|
+
/** Total number of likes on this playlist */
|
|
134
278
|
likes_count: number;
|
|
279
|
+
/** URL-friendly slug for the playlist */
|
|
135
280
|
permalink: string;
|
|
281
|
+
/** Full URL to the playlist's SoundCloud page */
|
|
136
282
|
permalink_url: string;
|
|
283
|
+
/** Type of playlist (e.g. "album", "ep", "compilation") */
|
|
137
284
|
playlist_type: string;
|
|
285
|
+
/** Label for the purchase/buy button */
|
|
138
286
|
purchase_title: string;
|
|
287
|
+
/** External purchase URL */
|
|
139
288
|
purchase_url: string;
|
|
289
|
+
/** Release identifier string */
|
|
140
290
|
release: string;
|
|
291
|
+
/** Day of the release date (1-31) */
|
|
141
292
|
release_day: number;
|
|
293
|
+
/** Month of the release date (1-12) */
|
|
142
294
|
release_month: number;
|
|
295
|
+
/** Year of the release date */
|
|
143
296
|
release_year: number;
|
|
297
|
+
/** Sharing setting: "public" or "private" */
|
|
144
298
|
sharing: string;
|
|
299
|
+
/** Whether the playlist contains streamable tracks */
|
|
145
300
|
streamable: boolean;
|
|
301
|
+
/** Space-separated list of tags */
|
|
146
302
|
tag_list: string;
|
|
303
|
+
/** Comma-separated tags string, or null */
|
|
147
304
|
tags: string | null;
|
|
305
|
+
/** The playlist's title */
|
|
148
306
|
title: string;
|
|
307
|
+
/** Total number of tracks in the playlist */
|
|
149
308
|
track_count: number;
|
|
309
|
+
/** Array of tracks in the playlist (may be empty if not fetched) */
|
|
150
310
|
tracks: SoundCloudTrack[];
|
|
311
|
+
/** API URI to fetch the playlist's tracks, or null */
|
|
151
312
|
tracks_uri: string | null;
|
|
313
|
+
/** Playlist set type (e.g. "album", "playlist") */
|
|
152
314
|
type: string;
|
|
315
|
+
/** API resource URI for this playlist */
|
|
153
316
|
uri: string;
|
|
154
317
|
/** URN identifier (e.g. "soundcloud:playlists:123") */
|
|
155
318
|
urn: string;
|
|
319
|
+
/** The user who created this playlist */
|
|
156
320
|
user: SoundCloudUser;
|
|
321
|
+
/** Numeric ID of the playlist creator */
|
|
157
322
|
user_id: number;
|
|
323
|
+
/** URN of the playlist creator */
|
|
158
324
|
user_urn: string;
|
|
159
325
|
}
|
|
160
|
-
/**
|
|
326
|
+
/**
|
|
327
|
+
* Represents a comment on a SoundCloud track.
|
|
328
|
+
*
|
|
329
|
+
* @see https://developers.soundcloud.com/docs/api/explorer/open-api#/tracks/get_tracks__track_id__comments
|
|
330
|
+
*/
|
|
161
331
|
interface SoundCloudComment {
|
|
332
|
+
/** The comment text body */
|
|
162
333
|
body: string;
|
|
334
|
+
/** ISO 8601 timestamp of when the comment was posted */
|
|
163
335
|
created_at: string;
|
|
336
|
+
/** The comment's unique numeric ID */
|
|
164
337
|
id: number;
|
|
338
|
+
/** Resource type, always "comment" */
|
|
165
339
|
kind: string;
|
|
340
|
+
/** Position in the track's waveform in milliseconds where the comment was placed */
|
|
166
341
|
timestamp: number;
|
|
342
|
+
/** URN of the track this comment belongs to */
|
|
167
343
|
track_urn: string;
|
|
344
|
+
/** API resource URI for this comment */
|
|
168
345
|
uri: string;
|
|
346
|
+
/** URN identifier for this comment */
|
|
169
347
|
urn: string;
|
|
348
|
+
/** The user who posted this comment */
|
|
170
349
|
user: SoundCloudCommentUser;
|
|
350
|
+
/** URN of the user who posted this comment */
|
|
171
351
|
user_urn: string;
|
|
172
352
|
}
|
|
173
|
-
/**
|
|
353
|
+
/**
|
|
354
|
+
* Minimal user object embedded in comment responses.
|
|
355
|
+
*
|
|
356
|
+
* @see https://developers.soundcloud.com/docs/api/explorer/open-api#/tracks/get_tracks__track_id__comments
|
|
357
|
+
*/
|
|
174
358
|
interface SoundCloudCommentUser {
|
|
359
|
+
/** URL to the user's avatar image */
|
|
175
360
|
avatar_url: string;
|
|
361
|
+
/** Total number of followers */
|
|
176
362
|
followers_count: number;
|
|
363
|
+
/** Total number of users this user is following */
|
|
177
364
|
followings_count: number;
|
|
365
|
+
/** Resource type, always "user" */
|
|
178
366
|
kind: string;
|
|
367
|
+
/** ISO 8601 timestamp of the last profile modification */
|
|
179
368
|
last_modified: string;
|
|
369
|
+
/** URL-friendly slug for the user's profile */
|
|
180
370
|
permalink: string;
|
|
371
|
+
/** Full URL to the user's SoundCloud profile page */
|
|
181
372
|
permalink_url: string;
|
|
373
|
+
/** Total number of reposts */
|
|
182
374
|
reposts_count: number;
|
|
375
|
+
/** API resource URI for this user */
|
|
183
376
|
uri: string;
|
|
377
|
+
/** URN identifier for this user */
|
|
184
378
|
urn: string;
|
|
379
|
+
/** The user's display name */
|
|
185
380
|
username: string;
|
|
186
381
|
}
|
|
187
|
-
/**
|
|
382
|
+
/**
|
|
383
|
+
* Stream URLs for a SoundCloud track, containing various format options.
|
|
384
|
+
*
|
|
385
|
+
* @see https://developers.soundcloud.com/docs/api/explorer/open-api#/tracks/get_tracks__track_id__streams
|
|
386
|
+
*/
|
|
188
387
|
interface SoundCloudStreams {
|
|
388
|
+
/** HLS stream URL for AAC at 160kbps (may be undefined if unavailable) */
|
|
189
389
|
hls_aac_160_url?: string;
|
|
390
|
+
/** HLS stream URL for MP3 at 128kbps (may be undefined if unavailable) */
|
|
190
391
|
hls_mp3_128_url?: string;
|
|
191
|
-
/**
|
|
392
|
+
/**
|
|
393
|
+
* Direct HTTP MP3 stream URL at 128kbps.
|
|
394
|
+
* @deprecated Use HLS URLs instead; this field may not be available for all tracks.
|
|
395
|
+
*/
|
|
192
396
|
http_mp3_128_url?: string;
|
|
397
|
+
/** Preview MP3 stream URL at 128kbps for non-full-access tracks (may be undefined) */
|
|
193
398
|
preview_mp3_128_url?: string;
|
|
194
399
|
}
|
|
195
|
-
/**
|
|
400
|
+
/**
|
|
401
|
+
* An external web profile / link displayed on a user's SoundCloud page.
|
|
402
|
+
*
|
|
403
|
+
* @see https://developers.soundcloud.com/docs/api/explorer/open-api#/users/get_users__user_id__web_profiles
|
|
404
|
+
*/
|
|
196
405
|
interface SoundCloudWebProfile {
|
|
406
|
+
/** ISO 8601 timestamp of when the web profile link was created */
|
|
197
407
|
created_at: string;
|
|
408
|
+
/** Resource type, always "web-profile" */
|
|
198
409
|
kind: string;
|
|
410
|
+
/** Service name (e.g. "twitter", "instagram", "personal") */
|
|
199
411
|
service: string;
|
|
412
|
+
/** Display title for this link */
|
|
200
413
|
title: string;
|
|
414
|
+
/** The external URL */
|
|
201
415
|
url: string;
|
|
416
|
+
/** URN identifier for this web profile entry */
|
|
202
417
|
urn: string;
|
|
418
|
+
/** Username on the external service */
|
|
203
419
|
username: string;
|
|
204
420
|
}
|
|
205
|
-
/**
|
|
421
|
+
/**
|
|
422
|
+
* A single activity item from the user's activity feed.
|
|
423
|
+
*
|
|
424
|
+
* @see https://developers.soundcloud.com/docs/api/explorer/open-api#/me/get_me_activities
|
|
425
|
+
*/
|
|
206
426
|
interface SoundCloudActivity {
|
|
427
|
+
/** Type of activity (e.g. "track", "track-repost", "playlist") */
|
|
207
428
|
type: string;
|
|
429
|
+
/** ISO 8601 timestamp of when the activity occurred */
|
|
208
430
|
created_at: string;
|
|
431
|
+
/** The track or playlist that is the subject of this activity */
|
|
209
432
|
origin: SoundCloudTrack | SoundCloudPlaylist;
|
|
210
433
|
}
|
|
211
|
-
/**
|
|
434
|
+
/**
|
|
435
|
+
* Response from the activities endpoints, with polling support via `future_href`.
|
|
436
|
+
*
|
|
437
|
+
* @see https://developers.soundcloud.com/docs/api/explorer/open-api#/me/get_me_activities
|
|
438
|
+
*/
|
|
212
439
|
interface SoundCloudActivitiesResponse {
|
|
440
|
+
/** Array of activity items in this page */
|
|
213
441
|
collection: SoundCloudActivity[];
|
|
442
|
+
/** URL to fetch the next page of older activities */
|
|
214
443
|
next_href: string;
|
|
444
|
+
/** URL to poll for new activities since this response */
|
|
215
445
|
future_href: string;
|
|
216
446
|
}
|
|
217
|
-
/**
|
|
447
|
+
/**
|
|
448
|
+
* Generic cursor-paginated response from the SoundCloud API.
|
|
449
|
+
* Most list endpoints return this shape with `collection` and `next_href`.
|
|
450
|
+
*
|
|
451
|
+
* @see https://developers.soundcloud.com/docs/api/explorer/open-api
|
|
452
|
+
*/
|
|
218
453
|
interface SoundCloudPaginatedResponse<T> {
|
|
454
|
+
/** Array of items in this page */
|
|
219
455
|
collection: T[];
|
|
456
|
+
/** URL to fetch the next page, or null/empty when there are no more pages */
|
|
220
457
|
next_href: string;
|
|
221
458
|
}
|
|
222
459
|
|
|
223
|
-
|
|
460
|
+
/**
|
|
461
|
+
* Shape of error response bodies returned by the SoundCloud API.
|
|
462
|
+
*
|
|
463
|
+
* The API returns varying combinations of these fields depending on the endpoint
|
|
464
|
+
* and error type. All fields are optional.
|
|
465
|
+
*
|
|
466
|
+
* @example
|
|
467
|
+
* ```json
|
|
468
|
+
* {
|
|
469
|
+
* "code": 401,
|
|
470
|
+
* "message": "invalid_client",
|
|
471
|
+
* "link": "https://developers.soundcloud.com/docs/api/explorer/open-api",
|
|
472
|
+
* "status": "401 - Unauthorized",
|
|
473
|
+
* "errors": [{"error_message": "invalid_client"}],
|
|
474
|
+
* "error": null,
|
|
475
|
+
* "error_code": "invalid_client"
|
|
476
|
+
* }
|
|
477
|
+
* ```
|
|
478
|
+
*
|
|
479
|
+
* @see https://developers.soundcloud.com/docs/api/explorer/open-api
|
|
480
|
+
*/
|
|
481
|
+
interface SoundCloudErrorBody {
|
|
482
|
+
/** HTTP status code echoed in the response body */
|
|
483
|
+
code?: number;
|
|
484
|
+
/** Error message from SoundCloud (e.g. "invalid_client", "404 - Not Found") */
|
|
485
|
+
message?: string;
|
|
486
|
+
/** Human-readable status string (e.g. "401 - Unauthorized") */
|
|
487
|
+
status?: string;
|
|
488
|
+
/** Link to SoundCloud API documentation */
|
|
489
|
+
link?: string;
|
|
490
|
+
/** Array of individual error detail objects */
|
|
491
|
+
errors?: Array<{
|
|
492
|
+
error_message?: string;
|
|
493
|
+
}>;
|
|
494
|
+
/** Generic error field — typically null in SoundCloud responses */
|
|
495
|
+
error?: string | null;
|
|
496
|
+
/** Machine-readable error code (e.g. "invalid_client") */
|
|
497
|
+
error_code?: string;
|
|
498
|
+
/** OAuth error description, present in `/oauth2/token` error responses */
|
|
499
|
+
error_description?: string;
|
|
500
|
+
}
|
|
501
|
+
/**
|
|
502
|
+
* Error class thrown when a SoundCloud API request fails.
|
|
503
|
+
*
|
|
504
|
+
* Provides structured access to HTTP status, error codes, and convenience
|
|
505
|
+
* getters for common error categories.
|
|
506
|
+
*
|
|
507
|
+
* @example
|
|
508
|
+
* ```ts
|
|
509
|
+
* import { SoundCloudError } from 'tsd-soundcloud';
|
|
510
|
+
*
|
|
511
|
+
* try {
|
|
512
|
+
* await sc.tracks.getTrack(999999999);
|
|
513
|
+
* } catch (err) {
|
|
514
|
+
* if (err instanceof SoundCloudError) {
|
|
515
|
+
* if (err.isNotFound) console.log('Track not found');
|
|
516
|
+
* if (err.isRateLimited) console.log('Rate limited, retry later');
|
|
517
|
+
* console.log(err.status, err.message);
|
|
518
|
+
* }
|
|
519
|
+
* }
|
|
520
|
+
* ```
|
|
521
|
+
*/
|
|
522
|
+
declare class SoundCloudError extends Error {
|
|
523
|
+
/** HTTP status code of the failed response (e.g. 401, 404, 429) */
|
|
524
|
+
readonly status: number;
|
|
525
|
+
/** HTTP status text of the failed response (e.g. "Unauthorized", "Not Found") */
|
|
526
|
+
readonly statusText: string;
|
|
527
|
+
/** Machine-readable error code from SoundCloud (e.g. "invalid_client"), if present */
|
|
528
|
+
readonly errorCode?: string;
|
|
529
|
+
/** Link to SoundCloud API documentation, if included in the error response */
|
|
530
|
+
readonly docsLink?: string;
|
|
531
|
+
/** Individual error messages extracted from the response body's `errors` array */
|
|
532
|
+
readonly errors: string[];
|
|
533
|
+
/** The full parsed error response body, if available */
|
|
534
|
+
readonly body?: SoundCloudErrorBody;
|
|
535
|
+
/**
|
|
536
|
+
* Creates a new SoundCloudError.
|
|
537
|
+
*
|
|
538
|
+
* @param status - HTTP status code
|
|
539
|
+
* @param statusText - HTTP status text
|
|
540
|
+
* @param body - Parsed JSON error response body from SoundCloud, if available
|
|
541
|
+
*/
|
|
542
|
+
constructor(status: number, statusText: string, body?: SoundCloudErrorBody);
|
|
543
|
+
/** True if status is 401 Unauthorized (invalid or expired token) */
|
|
544
|
+
get isUnauthorized(): boolean;
|
|
545
|
+
/** True if status is 403 Forbidden (insufficient permissions) */
|
|
546
|
+
get isForbidden(): boolean;
|
|
547
|
+
/** True if status is 404 Not Found (resource does not exist) */
|
|
548
|
+
get isNotFound(): boolean;
|
|
549
|
+
/** True if status is 429 Too Many Requests (rate limit exceeded) */
|
|
550
|
+
get isRateLimited(): boolean;
|
|
551
|
+
/** True if status is 5xx (SoundCloud server error) */
|
|
552
|
+
get isServerError(): boolean;
|
|
553
|
+
}
|
|
554
|
+
|
|
555
|
+
export { type SoundCloudActivitiesResponse, type SoundCloudActivity, type SoundCloudComment, type SoundCloudCommentUser, SoundCloudError, type SoundCloudMe, type SoundCloudPaginatedResponse, type SoundCloudPlaylist, type SoundCloudQuota, type SoundCloudStreams, type SoundCloudSubscription, type SoundCloudSubscriptionProduct, type SoundCloudToken, type SoundCloudTrack, type SoundCloudUser, type SoundCloudWebProfile };
|