@neuroinfoapi-client/bun 2.6.1 → 2.8.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 +24 -1
- package/package.json +4 -5
package/README.md
CHANGED
|
@@ -9,7 +9,7 @@ A comprehensive TypeScript/JavaScript client that provides full access to NeuroI
|
|
|
9
9
|
|
|
10
10
|
## Features
|
|
11
11
|
|
|
12
|
-
- HTTP access to streams, VODs, schedules, subathons, blog and X feeds
|
|
12
|
+
- HTTP access to streams, VODs, schedules, subathons, shop products, blog and X feeds
|
|
13
13
|
- Full TypeScript support with typed API responses and event payloads
|
|
14
14
|
- HTTP Bearer authentication with an optional token in the constructor
|
|
15
15
|
- Type-safe HTTP error handling through `{ data, error }`
|
|
@@ -122,6 +122,7 @@ if (error) {
|
|
|
122
122
|
All methods below return `Promise<ApiResult<T>>`:
|
|
123
123
|
|
|
124
124
|
- `getCurrentStream()` — current Twitch stream state
|
|
125
|
+
- `getScheduleLinkedStreams()` — Twitch channels watched right now because a schedule entry takes place on them (e.g. `(on secretneuroaccount)` or collab partners)
|
|
125
126
|
- `getAllVods()` — all Twitch VODs
|
|
126
127
|
- `getVod(id)` — a VOD by stream ID
|
|
127
128
|
- `getSchedule(week, year?)` — schedule for a specific week and optional year
|
|
@@ -133,6 +134,8 @@ All methods below return `Promise<ApiResult<T>>`:
|
|
|
133
134
|
- `getSubathon(year)` — subathon data for a year
|
|
134
135
|
- `getSubathonYears()` — available subathon years
|
|
135
136
|
- `getBlogFeed(raw?)` — Neuro-sama blog feed; requires an API token
|
|
137
|
+
- `getShopProducts(currency?)` — shop catalog; requires an API token
|
|
138
|
+
- `getShopProduct(id, currency?)` — one shop product; requires an API token
|
|
136
139
|
- `getXFeed(user)` — cached X feed for `NeurosamaAI`, `EvilNeuroAI`, or `Vedal987`; requires an API token
|
|
137
140
|
|
|
138
141
|
## Schedule Search Pagination
|
|
@@ -235,15 +238,35 @@ Available WebSocket events:
|
|
|
235
238
|
- `streamOffline`
|
|
236
239
|
- `streamUpdate`
|
|
237
240
|
- `secretneuroaccountOnline`
|
|
241
|
+
- `scheduleLinkedStreamOnline`
|
|
242
|
+
- `scheduleLinkedStreamUpdate`
|
|
243
|
+
- `scheduleLinkedStreamOffline`
|
|
238
244
|
- `streamRaidIncoming`
|
|
239
245
|
- `streamRaidOutgoing`
|
|
240
246
|
- `scheduleUpdate`
|
|
241
247
|
- `subathonUpdate`
|
|
242
248
|
- `subathonGoalUpdate`
|
|
249
|
+
- `shopProductsUpdate`
|
|
243
250
|
- `blogFeedUpdate`
|
|
244
251
|
- `xFeedNewEntries`
|
|
245
252
|
- `xFeedUpdate` (deprecated alias for `xFeedNewEntries`)
|
|
246
253
|
|
|
254
|
+
The `scheduleLinkedStream*` events cover Twitch channels linked in schedule entries, e.g. `(on secretneuroaccount) Evil Stream` (`linkType: "on"`) or collab partners (`linkType: "collab"`); see the [WebSocket docs](https://github.com/Appstun/NeuroInfoAPI-Docs/blob/master/websocket.md#schedule-linked-stream-events).
|
|
255
|
+
Import `Utils` from the package to check their fields:
|
|
256
|
+
|
|
257
|
+
Helpers: `isLinkTypeOn`/`isLinkTypeCollab`, `isTriggerStreamStart`/`isTriggerFetch`/`isTriggerScheduleTime`, `isReasonStreamEnd`/`isReasonNoShow`/`isReasonScheduleRemoved`/`isReasonTimeout`, `didLinkedStreamHappen` (`streamEnd` or `timeout`) and `isLinkedStreamLive`, which also narrows `stream` to the live data.
|
|
258
|
+
|
|
259
|
+
```ts
|
|
260
|
+
wsClient.on("scheduleLinkedStreamOnline", (data) => {
|
|
261
|
+
if (Utils.isTriggerScheduleTime(data) && !Utils.isLinkedStreamLive(data)) return; // scheduled time reached, but not live yet
|
|
262
|
+
if (Utils.isLinkedStreamLive(data)) console.log(`${data.channel.displayName} is live: ${data.stream.title}`);
|
|
263
|
+
});
|
|
264
|
+
|
|
265
|
+
wsClient.on("scheduleLinkedStreamOffline", (data) => {
|
|
266
|
+
if (Utils.isReasonNoShow(data)) console.log(`${data.channel.displayName} did not stream`);
|
|
267
|
+
});
|
|
268
|
+
```
|
|
269
|
+
|
|
247
270
|
**Heartbeat:** The server must send WebSocket protocol ping frames. Bun responds automatically with pong; this package sends no JSON heartbeat messages. The client waits a fixed **90 seconds** for the next server ping; each incoming protocol ping restarts that timer. If the ping is missing, the connection is terminated and automatic reconnect runs when enabled. Disable timeout monitoring with `heartbeatMonitoring: false`. `heartbeatIntervalMs` and `heartbeatTimeoutMs` apply only to Native and are ignored here, both in constructor options and when assigned on the client instance. Automatic protocol pongs remain active when `heartbeatMonitoring: false`. Ticket authentication does not change this heartbeat behavior. The `_pong` event reports heartbeat activity: an incoming server protocol ping that the runtime automatically answers, or an incoming JSON pong. It also fires with `heartbeatMonitoring: false`; that option disables timeout monitoring, not protocol replies or event notifications. This event does not confirm that the server received the reply.
|
|
248
271
|
|
|
249
272
|
## Unsubscribe and clean up
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@neuroinfoapi-client/bun",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.8.0",
|
|
4
4
|
"description": "A client for interacting with the NeuroInfoAPI (Bun edition)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -20,7 +20,6 @@
|
|
|
20
20
|
"scripts": {
|
|
21
21
|
"build": "tsc -b",
|
|
22
22
|
"typecheck": "tsc -p tsconfig.json --noEmit",
|
|
23
|
-
"publishPackage": "powershell -NoProfile -ExecutionPolicy Bypass -File ../../scripts/publishAsk.ps1 -Package bun",
|
|
24
23
|
"deprecatePackage": "powershell -NoProfile -ExecutionPolicy Bypass -File ../../scripts/deprecateAsk.ps1 -Package bun"
|
|
25
24
|
},
|
|
26
25
|
"keywords": [
|
|
@@ -34,16 +33,16 @@
|
|
|
34
33
|
"author": "Appstun",
|
|
35
34
|
"license": "MIT",
|
|
36
35
|
"bugs": {
|
|
37
|
-
"url": "https://github.com/NeuroInfoAPI/NPM-
|
|
36
|
+
"url": "https://github.com/NeuroInfoAPI/NPM-Packages/issues"
|
|
38
37
|
},
|
|
39
38
|
"repository": {
|
|
40
39
|
"type": "git",
|
|
41
|
-
"url": "https://github.com/NeuroInfoAPI/NPM-
|
|
40
|
+
"url": "https://github.com/NeuroInfoAPI/NPM-Packages.git",
|
|
42
41
|
"directory": "packages/bun"
|
|
43
42
|
},
|
|
44
43
|
"homepage": "https://neuroinfoapi.dev/api/docs",
|
|
45
44
|
"dependencies": {
|
|
46
|
-
"@neuroinfoapi-client/core": "2.
|
|
45
|
+
"@neuroinfoapi-client/core": "2.8.0"
|
|
47
46
|
},
|
|
48
47
|
"devDependencies": {
|
|
49
48
|
"@types/bun": "^1.4.4"
|