@rivi-software/radiotools-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.
Files changed (2) hide show
  1. package/README.md +64 -0
  2. package/package.json +3 -3
package/README.md ADDED
@@ -0,0 +1,64 @@
1
+ # @rivi-software/radiotools-sdk
2
+
3
+ TypeScript client for the RadioTools listener API: published station content, schedule, now playing, weather and traffic, realtime updates, and playback ingest. Includes ETag caching and retries.
4
+
5
+ ## Install
6
+
7
+ ```bash
8
+ npm install @rivi-software/radiotools-sdk
9
+ ```
10
+
11
+ ## Configuration
12
+
13
+ Create keys in RadioTools under **Settings → API credentials**.
14
+
15
+ | Variable | Purpose |
16
+ | --- | --- |
17
+ | `RADIOTOOLS_BASE_URL` | API base URL |
18
+ | `RADIOTOOLS_STATION_SLUG` | Station to read from |
19
+ | `RADIOTOOLS_API_TOKEN` | Station key (`listener:read`) |
20
+ | `RADIOTOOLS_INGEST_TOKEN` | Integration key named `playback` (`ingest:write`) |
21
+
22
+ Pass the raw `rtm_…` token; the SDK adds the `Bearer ` prefix.
23
+
24
+ ## Usage
25
+
26
+ ```ts
27
+ import { createStationClient, createStationClientFromEnv } from "@rivi-software/radiotools-sdk";
28
+
29
+ const client = createStationClientFromEnv();
30
+ // or
31
+ const explicit = createStationClient({
32
+ baseUrl: "https://api.example.com",
33
+ stationSlug: "my-station",
34
+ apiToken: process.env.RADIOTOOLS_API_TOKEN,
35
+ });
36
+
37
+ const station = await client.getStation();
38
+ const nowPlaying = await client.getNowPlaying();
39
+ const schedule = await client.getSchedule({ fromDate: "2026-10-06", throughDate: "2026-10-12" });
40
+ ```
41
+
42
+ ### Client methods
43
+
44
+ `getStation`, `getSchemas`, `getContent`, `getContentRecord`, `iterateContent`, `getSchedule`, `getPrograms`, `getCurrentBroadcast`, `getNowPlaying`, `getTrackHistory`, `iterateTrackHistory`, `getWeather`, `getTraffic`, `recommendedPollIntervalMs`, `previewEditorial`, `reportPlayback`, `subscribe`.
45
+
46
+ Schedule windows are `YYYY-MM-DD` dates covering 1 to 31 inclusive days.
47
+
48
+ ### Realtime
49
+
50
+ ```ts
51
+ const subscription = client.subscribe({
52
+ /* handlers for public socket events */
53
+ });
54
+ ```
55
+
56
+ ### Playback ingest
57
+
58
+ Requires `RADIOTOOLS_INGEST_TOKEN`. Use `client.reportPlayback(observation)`.
59
+
60
+ ### Errors
61
+
62
+ Failed requests throw `RadioToolsApiError`. Response types and Zod schemas (`sdkSchemas`) are exported for validation.
63
+
64
+ Framework bindings: [React](../sdk-react), [Vue](../sdk-vue), [Svelte](../sdk-svelte), [Next.js](../sdk-next).
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@rivi-software/radiotools-sdk",
3
- "version": "0.2.0",
3
+ "version": "0.2.2",
4
4
  "description": "Customer SDK for radio stations. Published listener reads and playback ingest only.",
5
5
  "license": "MIT",
6
6
  "type": "module",
@@ -19,7 +19,7 @@
19
19
  "zod": "4.6.5"
20
20
  },
21
21
  "devDependencies": {
22
- "@types/bun": "1.2.23",
22
+ "@types/bun": "1.4.2",
23
23
  "typescript": "5.9.3"
24
24
  },
25
25
  "publishConfig": {
@@ -27,7 +27,7 @@
27
27
  },
28
28
  "repository": {
29
29
  "type": "git",
30
- "url": "https://github.com/RIVI-Software/radiotools-sdk.git",
30
+ "url": "https://github.com/rivi-software/radiotools-sdk.git",
31
31
  "directory": "packages/sdk-typescript"
32
32
  }
33
33
  }