soundcloud-api-ts 1.0.0 → 1.1.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 +12 -8
- package/package.json +23 -7
package/README.md
CHANGED
|
@@ -1,17 +1,21 @@
|
|
|
1
|
-
# soundcloud-api-
|
|
1
|
+
# soundcloud-api-ts
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/soundcloud-api-ts)
|
|
4
|
+
[](https://www.npmjs.com/package/soundcloud-api-ts)
|
|
5
|
+
[](https://github.com/twin-paws/soundcloud-api-client/blob/main/LICENSE)
|
|
2
6
|
|
|
3
7
|
A TypeScript client for the SoundCloud API. Zero dependencies, uses native `fetch` (Node 18+).
|
|
4
8
|
|
|
5
9
|
## Install
|
|
6
10
|
|
|
7
11
|
```bash
|
|
8
|
-
npm install soundcloud-api-
|
|
12
|
+
npm install soundcloud-api-ts
|
|
9
13
|
```
|
|
10
14
|
|
|
11
15
|
## Quick Start
|
|
12
16
|
|
|
13
17
|
```ts
|
|
14
|
-
import { SoundCloudClient } from "soundcloud-api-
|
|
18
|
+
import { SoundCloudClient } from "soundcloud-api-ts";
|
|
15
19
|
|
|
16
20
|
const sc = new SoundCloudClient({
|
|
17
21
|
clientId: "your-client-id",
|
|
@@ -33,7 +37,7 @@ const streams = await sc.tracks.getStreams(123456);
|
|
|
33
37
|
## OAuth 2.0 Flow
|
|
34
38
|
|
|
35
39
|
```ts
|
|
36
|
-
import { SoundCloudClient, generateCodeVerifier, generateCodeChallenge } from "soundcloud-api-
|
|
40
|
+
import { SoundCloudClient, generateCodeVerifier, generateCodeChallenge } from "soundcloud-api-ts";
|
|
37
41
|
|
|
38
42
|
const sc = new SoundCloudClient({
|
|
39
43
|
clientId: "...",
|
|
@@ -171,7 +175,7 @@ import {
|
|
|
171
175
|
getClientToken, getUserToken, getAuthorizationUrl,
|
|
172
176
|
generateCodeVerifier, generateCodeChallenge,
|
|
173
177
|
getMe, searchTracks,
|
|
174
|
-
} from "soundcloud-api-
|
|
178
|
+
} from "soundcloud-api-ts";
|
|
175
179
|
|
|
176
180
|
const token = await getClientToken("clientId", "clientSecret");
|
|
177
181
|
const me = await getMe(token.access_token);
|
|
@@ -199,7 +203,7 @@ import type {
|
|
|
199
203
|
SoundCloudActivitiesResponse,
|
|
200
204
|
SoundCloudPaginatedResponse,
|
|
201
205
|
TokenOption,
|
|
202
|
-
} from "soundcloud-api-
|
|
206
|
+
} from "soundcloud-api-ts/types";
|
|
203
207
|
```
|
|
204
208
|
|
|
205
209
|
## PKCE (Proof Key for Code Exchange)
|
|
@@ -207,7 +211,7 @@ import type {
|
|
|
207
211
|
For public clients (SPAs, mobile apps), use PKCE:
|
|
208
212
|
|
|
209
213
|
```ts
|
|
210
|
-
import { generateCodeVerifier, generateCodeChallenge } from "soundcloud-api-
|
|
214
|
+
import { generateCodeVerifier, generateCodeChallenge } from "soundcloud-api-ts";
|
|
211
215
|
|
|
212
216
|
const verifier = generateCodeVerifier();
|
|
213
217
|
const challenge = await generateCodeChallenge(verifier);
|
|
@@ -233,7 +237,7 @@ interface SoundCloudPaginatedResponse<T> {
|
|
|
233
237
|
## Utilities
|
|
234
238
|
|
|
235
239
|
```ts
|
|
236
|
-
import { getSoundCloudWidgetUrl } from "soundcloud-api-
|
|
240
|
+
import { getSoundCloudWidgetUrl } from "soundcloud-api-ts";
|
|
237
241
|
|
|
238
242
|
// Generate a SoundCloud embed widget URL
|
|
239
243
|
const widgetUrl = getSoundCloudWidgetUrl(trackId);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "soundcloud-api-ts",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "A TypeScript client for the SoundCloud API",
|
|
5
5
|
"main": "./dist/index.cjs",
|
|
6
6
|
"module": "./dist/index.js",
|
|
@@ -17,23 +17,39 @@
|
|
|
17
17
|
"require": "./dist/types/index.cjs"
|
|
18
18
|
}
|
|
19
19
|
},
|
|
20
|
-
"files": [
|
|
20
|
+
"files": [
|
|
21
|
+
"dist"
|
|
22
|
+
],
|
|
21
23
|
"scripts": {
|
|
22
24
|
"build": "tsup",
|
|
25
|
+
"lint": "eslint src/",
|
|
23
26
|
"typecheck": "tsc --noEmit",
|
|
24
|
-
"prepublishOnly": "npm run build"
|
|
27
|
+
"prepublishOnly": "npm run build",
|
|
28
|
+
"test": "vitest run",
|
|
29
|
+
"test:watch": "vitest"
|
|
25
30
|
},
|
|
26
31
|
"repository": {
|
|
27
32
|
"type": "git",
|
|
28
|
-
"url": "https://github.com/twin-paws/soundcloud-api-
|
|
33
|
+
"url": "https://github.com/twin-paws/soundcloud-api-ts.git"
|
|
29
34
|
},
|
|
30
|
-
"keywords": [
|
|
35
|
+
"keywords": [
|
|
36
|
+
"soundcloud",
|
|
37
|
+
"api",
|
|
38
|
+
"client",
|
|
39
|
+
"typescript",
|
|
40
|
+
"oauth2"
|
|
41
|
+
],
|
|
31
42
|
"license": "MIT",
|
|
32
43
|
"engines": {
|
|
33
|
-
"node": ">=
|
|
44
|
+
"node": ">=20"
|
|
34
45
|
},
|
|
35
46
|
"devDependencies": {
|
|
47
|
+
"@types/node": "^25.2.2",
|
|
48
|
+
"@typescript-eslint/eslint-plugin": "^8.54.0",
|
|
49
|
+
"@typescript-eslint/parser": "^8.54.0",
|
|
50
|
+
"eslint": "^10.0.0",
|
|
51
|
+
"tsup": "^8.0.0",
|
|
36
52
|
"typescript": "^5.3.0",
|
|
37
|
-
"
|
|
53
|
+
"vitest": "^4.0.18"
|
|
38
54
|
}
|
|
39
55
|
}
|