ts-twitch-api 0.2.4 → 0.2.6
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/dist/index.cjs +114 -16
- package/dist/index.d.cts +699 -1451
- package/dist/index.d.ts +699 -1451
- package/dist/index.js +111 -13
- package/package.json +5 -6
package/dist/index.js
CHANGED
|
@@ -1337,6 +1337,43 @@ var TwitchApi = class {
|
|
|
1337
1337
|
body,
|
|
1338
1338
|
options
|
|
1339
1339
|
}),
|
|
1340
|
+
/**
|
|
1341
|
+
* NEW Retrieves the active shared chat session for a channel.
|
|
1342
|
+
*
|
|
1343
|
+
* __Authorization:__
|
|
1344
|
+
*
|
|
1345
|
+
* Requires an [app access token](https://dev.twitch.tv/docs/cli/token-command/#app-access-token) or [user access token](https://dev.twitch.tv/docs/authentication/#user-access-tokens).
|
|
1346
|
+
*
|
|
1347
|
+
* __URL:__
|
|
1348
|
+
*
|
|
1349
|
+
* `GET https://api.twitch.tv/helix/shared_chat/session`
|
|
1350
|
+
*
|
|
1351
|
+
* __Response Codes:__
|
|
1352
|
+
*
|
|
1353
|
+
* _200 OK_
|
|
1354
|
+
*
|
|
1355
|
+
* Successfully retrieved the shared chat session. Returns an empty array if the broadcaster\_id in the request isn’t in a shared chat session.
|
|
1356
|
+
*
|
|
1357
|
+
* _400 Bad Request_
|
|
1358
|
+
*
|
|
1359
|
+
* The ID in the `broadcaster_id` query parameter is not valid.
|
|
1360
|
+
*
|
|
1361
|
+
* _401 Unauthorized_
|
|
1362
|
+
*
|
|
1363
|
+
* * The OAuth token is not valid.
|
|
1364
|
+
* * The Authorization header is required and must contain a user access token.
|
|
1365
|
+
*
|
|
1366
|
+
* _500 Internal Server Error_
|
|
1367
|
+
*
|
|
1368
|
+
* Internal Server Error.
|
|
1369
|
+
*
|
|
1370
|
+
* @see https://dev.twitch.tv/docs/api/reference#get-shared-chat-session
|
|
1371
|
+
*/
|
|
1372
|
+
getSharedChatSession: (params, options = {}) => this.callApi({
|
|
1373
|
+
path: "/shared_chat/session",
|
|
1374
|
+
params,
|
|
1375
|
+
options
|
|
1376
|
+
}),
|
|
1340
1377
|
/**
|
|
1341
1378
|
* NEW Retrieves emotes available to the user across all channels.
|
|
1342
1379
|
*
|
|
@@ -1378,6 +1415,8 @@ var TwitchApi = class {
|
|
|
1378
1415
|
/**
|
|
1379
1416
|
* Sends an announcement to the broadcaster’s chat room.
|
|
1380
1417
|
*
|
|
1418
|
+
* **Rate Limits**: One announcement may be sent every 2 seconds.
|
|
1419
|
+
*
|
|
1381
1420
|
* __Authorization:__
|
|
1382
1421
|
*
|
|
1383
1422
|
* Requires a [user access token](https://dev.twitch.tv/docs/authentication#user-access-tokens) that includes the **moderator:manage:announcements** scope.
|
|
@@ -1406,6 +1445,10 @@ var TwitchApi = class {
|
|
|
1406
1445
|
* * The OAuth token is not valid.
|
|
1407
1446
|
* * The client ID specified in the Client-Id header does not match the client ID specified in the OAuth token.
|
|
1408
1447
|
*
|
|
1448
|
+
* _429 Too Many Requests_
|
|
1449
|
+
*
|
|
1450
|
+
* The sender has exceeded the number of announcements they may send to this **broadcaster\_id** within a given window.
|
|
1451
|
+
*
|
|
1409
1452
|
* @see https://dev.twitch.tv/docs/api/reference#send-chat-announcement
|
|
1410
1453
|
*/
|
|
1411
1454
|
sendChatAnnouncement: (params, body, options = {}) => this.callApi({
|
|
@@ -1420,7 +1463,7 @@ var TwitchApi = class {
|
|
|
1420
1463
|
*
|
|
1421
1464
|
* Twitch’s Shoutout feature is a great way for you to show support for other broadcasters and help them grow. Viewers who do not follow the other broadcaster will see a pop-up Follow button in your chat that they can click to follow the other broadcaster. [Learn More](https://help.twitch.tv/s/article/shoutouts)
|
|
1422
1465
|
*
|
|
1423
|
-
* **Rate Limits
|
|
1466
|
+
* **Rate Limits**: The broadcaster may send a Shoutout once every 2 minutes. They may send the same broadcaster a Shoutout once every 60 minutes.
|
|
1424
1467
|
*
|
|
1425
1468
|
* To receive notifications when a Shoutout is sent or received, subscribe to the [channel.shoutout.create](https://dev.twitch.tv/docs/eventsub/eventsub-subscription-types#channelshoutoutcreate) and [channel.shoutout.receive](https://dev.twitch.tv/docs/eventsub/eventsub-subscription-types#channelshoutoutreceive) subscription types. The **channel.shoutout.create** event includes cooldown periods that indicate when the broadcaster may send another Shoutout without exceeding the endpoint’s rate limit.
|
|
1426
1469
|
*
|
|
@@ -1476,6 +1519,11 @@ var TwitchApi = class {
|
|
|
1476
1519
|
/**
|
|
1477
1520
|
* NEW Sends a message to the broadcaster’s chat room.
|
|
1478
1521
|
*
|
|
1522
|
+
* **NOTE:** When sending messages to a Shared Chat session, behaviors differ depending on your authentication token type:
|
|
1523
|
+
*
|
|
1524
|
+
* * When using an _App Access Token_, messages will only be sent to the source channel (defined by the `broadcaster_id` parameter) by default starting on May 19, 2025\. Messages can be sent to all channels by using the `for_source_only` parameter and setting it to `false`.
|
|
1525
|
+
* * When using a _User Access Token_, messages will be sent to all channels in the shared chat session, including the source channel. This behavior cannot be changed with this token type.
|
|
1526
|
+
*
|
|
1479
1527
|
* __Authorization:__
|
|
1480
1528
|
*
|
|
1481
1529
|
* Requires an [app access token](https://dev.twitch.tv/docs/authentication#app-access-tokens) or [user access token](https://dev.twitch.tv/docs/authentication#user-access-tokens) that includes the `user:write:chat` scope. If app access token used, then additionally requires `user:bot` scope from chatting user, and either `channel:bot` scope from broadcaster or moderator status.
|
|
@@ -1498,6 +1546,7 @@ var TwitchApi = class {
|
|
|
1498
1546
|
* * The ID in the _sender\_id_ query parameter is not valid.
|
|
1499
1547
|
* * The _text_ query parameter is required.
|
|
1500
1548
|
* * The ID in the _reply\_parent\_message\_id_ query parameter is not valid.
|
|
1549
|
+
* * Cannot set \*for\_source\_only\* if User Access Token is used.
|
|
1501
1550
|
*
|
|
1502
1551
|
* _401 Unauthorized_
|
|
1503
1552
|
*
|
|
@@ -1654,6 +1703,8 @@ var TwitchApi = class {
|
|
|
1654
1703
|
/**
|
|
1655
1704
|
* Gets one or more video clips that were captured from streams. For information about clips, see [How to use clips](https://help.twitch.tv/s/article/how-to-use-clips).
|
|
1656
1705
|
*
|
|
1706
|
+
* When using pagination for clips, note that the maximum number of results returned over multiple requests will be approximately 1,000\. If additional results are necessary, paginate over different query parameters such as multiple `started_at` and `ended_at` timeframes to refine the search.
|
|
1707
|
+
*
|
|
1657
1708
|
* __Authorization:__
|
|
1658
1709
|
*
|
|
1659
1710
|
* Requires an [app access token](https://dev.twitch.tv/docs/authentication#app-access-tokens) or [user access token](https://dev.twitch.tv/docs/authentication#user-access-tokens).
|
|
@@ -1697,7 +1748,7 @@ var TwitchApi = class {
|
|
|
1697
1748
|
};
|
|
1698
1749
|
conduits = {
|
|
1699
1750
|
/**
|
|
1700
|
-
* NEW Gets the [conduits](https://dev.twitch.tv/docs/eventsub/handling-conduit-events) for a client ID.
|
|
1751
|
+
* NEW Gets the [conduits](https://dev.twitch.tv/docs/eventsub/handling-conduit-events/) for a client ID.
|
|
1701
1752
|
*
|
|
1702
1753
|
* __Authorization:__
|
|
1703
1754
|
*
|
|
@@ -1724,7 +1775,7 @@ var TwitchApi = class {
|
|
|
1724
1775
|
options
|
|
1725
1776
|
}),
|
|
1726
1777
|
/**
|
|
1727
|
-
* NEW Creates a new [conduit](https://dev.twitch.tv/docs/eventsub/handling-conduit-events).
|
|
1778
|
+
* NEW Creates a new [conduit](https://dev.twitch.tv/docs/eventsub/handling-conduit-events/).
|
|
1728
1779
|
*
|
|
1729
1780
|
* __Authorization:__
|
|
1730
1781
|
*
|
|
@@ -1761,7 +1812,7 @@ var TwitchApi = class {
|
|
|
1761
1812
|
options
|
|
1762
1813
|
}),
|
|
1763
1814
|
/**
|
|
1764
|
-
* NEW Updates a [conduit’s](https://dev.twitch.tv/docs/eventsub/handling-conduit-events) shard count. To delete shards, update the count to a lower number, and the shards above the count will be deleted. For example, if the existing shard count is 100, by resetting shard count to 50, shards 50-99 are disabled.
|
|
1815
|
+
* NEW Updates a [conduit’s](https://dev.twitch.tv/docs/eventsub/handling-conduit-events/) shard count. To delete shards, update the count to a lower number, and the shards above the count will be deleted. For example, if the existing shard count is 100, by resetting shard count to 50, shards 50-99 are disabled.
|
|
1765
1816
|
*
|
|
1766
1817
|
* __Authorization:__
|
|
1767
1818
|
*
|
|
@@ -1800,7 +1851,7 @@ var TwitchApi = class {
|
|
|
1800
1851
|
options
|
|
1801
1852
|
}),
|
|
1802
1853
|
/**
|
|
1803
|
-
* NEW Deletes a specified [conduit](https://dev.twitch.tv/docs/eventsub/handling-conduit-events/). Note that it may take some time for Eventsub subscriptions on a deleted [conduit](https://dev.twitch.tv/docs/eventsub/handling-conduit-events) to show as disabled when calling [Get Eventsub Subscriptions](https://dev.twitch.tv/docs/api/reference/#get-eventsub-subscriptions).
|
|
1854
|
+
* NEW Deletes a specified [conduit](https://dev.twitch.tv/docs/eventsub/handling-conduit-events/). Note that it may take some time for Eventsub subscriptions on a deleted [conduit](https://dev.twitch.tv/docs/eventsub/handling-conduit-events/) to show as disabled when calling [Get Eventsub Subscriptions](https://dev.twitch.tv/docs/api/reference/#get-eventsub-subscriptions).
|
|
1804
1855
|
*
|
|
1805
1856
|
* __Authorization:__
|
|
1806
1857
|
*
|
|
@@ -1838,7 +1889,7 @@ var TwitchApi = class {
|
|
|
1838
1889
|
options
|
|
1839
1890
|
}),
|
|
1840
1891
|
/**
|
|
1841
|
-
* NEW Gets a lists of all shards for a [conduit](https://dev.twitch.tv/docs/eventsub/handling-conduit-events).
|
|
1892
|
+
* NEW Gets a lists of all shards for a [conduit](https://dev.twitch.tv/docs/eventsub/handling-conduit-events/).
|
|
1842
1893
|
*
|
|
1843
1894
|
* __Authorization:__
|
|
1844
1895
|
*
|
|
@@ -1875,7 +1926,7 @@ var TwitchApi = class {
|
|
|
1875
1926
|
options
|
|
1876
1927
|
}),
|
|
1877
1928
|
/**
|
|
1878
|
-
* NEW Updates shard(s) for a [conduit](https://dev.twitch.tv/docs/eventsub/handling-conduit-events).
|
|
1929
|
+
* NEW Updates shard(s) for a [conduit](https://dev.twitch.tv/docs/eventsub/handling-conduit-events/).
|
|
1879
1930
|
*
|
|
1880
1931
|
* **NOTE:** Shard IDs are indexed starting at 0, so a conduit with a `shard_count` of 5 will have shards with IDs 0 through 4.
|
|
1881
1932
|
*
|
|
@@ -1969,7 +2020,7 @@ var TwitchApi = class {
|
|
|
1969
2020
|
*
|
|
1970
2021
|
* __Authorization:__
|
|
1971
2022
|
*
|
|
1972
|
-
* Requires an [app access token](https://dev.twitch.tv/docs/authentication#app-access-tokens) or [user access token](https://dev.twitch.tv/docs/authentication#user-access-tokens). The
|
|
2023
|
+
* Requires an [app access token](https://dev.twitch.tv/docs/authentication#app-access-tokens) or [user access token](https://dev.twitch.tv/docs/authentication#user-access-tokens). The Client ID associated with the access token must be owned by a user who is a member of the [organization](https://dev.twitch.tv/docs/docs/companies/) that holds ownership of the game.
|
|
1973
2024
|
*
|
|
1974
2025
|
* __URL:__
|
|
1975
2026
|
*
|
|
@@ -2021,7 +2072,7 @@ var TwitchApi = class {
|
|
|
2021
2072
|
*
|
|
2022
2073
|
* __Authorization:__
|
|
2023
2074
|
*
|
|
2024
|
-
* Requires an [app access token](https://dev.twitch.tv/docs/authentication#app-access-tokens) or [user access token](https://dev.twitch.tv/docs/authentication#user-access-tokens). The
|
|
2075
|
+
* Requires an [app access token](https://dev.twitch.tv/docs/authentication#app-access-tokens) or [user access token](https://dev.twitch.tv/docs/authentication#user-access-tokens). The Client ID associated with the access token must be owned by a user who is a member of the [organization](https://dev.twitch.tv/docs/docs/companies/) that holds ownership of the game.
|
|
2025
2076
|
*
|
|
2026
2077
|
* __URL:__
|
|
2027
2078
|
*
|
|
@@ -2567,7 +2618,7 @@ var TwitchApi = class {
|
|
|
2567
2618
|
*
|
|
2568
2619
|
* If you use [WebSockets to receive events](https://dev.twitch.tv/docs/eventsub/handling-websocket-events), the request must specify a user access token. The request will fail if you use an app access token. If the subscription type requires user authorization, the token must include the required scope. However, if the subscription type doesn’t include user authorization, the token may include any scopes or no scopes.
|
|
2569
2620
|
*
|
|
2570
|
-
* If you use [Conduits](https://dev.twitch.tv/docs/eventsub/handling-conduit-events) to receive events, the request must specify an app access token. The request will fail if you use a user access token.
|
|
2621
|
+
* If you use [Conduits](https://dev.twitch.tv/docs/eventsub/handling-conduit-events/) to receive events, the request must specify an app access token. The request will fail if you use a user access token.
|
|
2571
2622
|
*
|
|
2572
2623
|
* __URL:__
|
|
2573
2624
|
*
|
|
@@ -2666,13 +2717,13 @@ var TwitchApi = class {
|
|
|
2666
2717
|
*
|
|
2667
2718
|
* __Authorization:__
|
|
2668
2719
|
*
|
|
2669
|
-
* If you use [Webhooks](https://dev.twitch.tv/docs/eventsub/handling-webhook-events) or [Conduits](https://dev.twitch.tv/docs/eventsub/handling-conduit-events) to receive events, the request must specify an app access token. The request will fail if you use a user access token.
|
|
2720
|
+
* If you use [Webhooks](https://dev.twitch.tv/docs/eventsub/handling-webhook-events) or [Conduits](https://dev.twitch.tv/docs/eventsub/handling-conduit-events/) to receive events, the request must specify an app access token. The request will fail if you use a user access token.
|
|
2670
2721
|
*
|
|
2671
2722
|
* If you use [WebSockets to receive events](https://dev.twitch.tv/docs/eventsub/handling-websocket-events), the request must specify a user access token. The request will fail if you use an app access token. The token may include any scopes.
|
|
2672
2723
|
*
|
|
2673
2724
|
* __Request Query Parameters:__
|
|
2674
2725
|
*
|
|
2675
|
-
* Use the _status_, _type_, and
|
|
2726
|
+
* Use the _status_, _type_, _user\_id_, and _subscription\_id_ query parameters to filter the list of subscriptions that are returned. The filters are mutually exclusive; the request fails if you specify more than one filter.
|
|
2676
2727
|
*
|
|
2677
2728
|
* __URL:__
|
|
2678
2729
|
*
|
|
@@ -3280,6 +3331,45 @@ var TwitchApi = class {
|
|
|
3280
3331
|
path: "/hypetrain/events",
|
|
3281
3332
|
params,
|
|
3282
3333
|
options
|
|
3334
|
+
}),
|
|
3335
|
+
/**
|
|
3336
|
+
* BETA Get the status of a Hype Train for the specified broadcaster.
|
|
3337
|
+
*
|
|
3338
|
+
* __Authorization:__
|
|
3339
|
+
*
|
|
3340
|
+
* * Requires an [user access token](https://dev.twitch.tv/docs/authentication/#user-access-tokens).
|
|
3341
|
+
* * Requires OAuth Scope: `channel:read:hype_train`.
|
|
3342
|
+
* * Requires that `broadcaster_id` and `user_id` match in the User-Access token.
|
|
3343
|
+
*
|
|
3344
|
+
* __URL:__
|
|
3345
|
+
*
|
|
3346
|
+
* `GET https://api.twitch.tv/helix/hypetrain/status`
|
|
3347
|
+
*
|
|
3348
|
+
* __Response Codes:__
|
|
3349
|
+
*
|
|
3350
|
+
* _200 OK_
|
|
3351
|
+
*
|
|
3352
|
+
* Successfully retrieved the status object.
|
|
3353
|
+
*
|
|
3354
|
+
* _400 Bad Request_
|
|
3355
|
+
*
|
|
3356
|
+
* The ID in the `broadcaster_id` query parameter is not valid.
|
|
3357
|
+
*
|
|
3358
|
+
* _401 Unauthorized_
|
|
3359
|
+
*
|
|
3360
|
+
* * The OAuth token is not valid.
|
|
3361
|
+
* * The Authorization header is required and must contain a user access token.
|
|
3362
|
+
*
|
|
3363
|
+
* _500 Internal Server Error_
|
|
3364
|
+
*
|
|
3365
|
+
* Internal Server Error.
|
|
3366
|
+
*
|
|
3367
|
+
* @see https://dev.twitch.tv/docs/api/reference#get-hype-train-status
|
|
3368
|
+
*/
|
|
3369
|
+
getHypeTrainStatus: (params, options = {}) => this.callApi({
|
|
3370
|
+
path: "/hypetrain/status",
|
|
3371
|
+
params,
|
|
3372
|
+
options
|
|
3283
3373
|
})
|
|
3284
3374
|
};
|
|
3285
3375
|
moderation = {
|
|
@@ -3693,7 +3783,7 @@ var TwitchApi = class {
|
|
|
3693
3783
|
*
|
|
3694
3784
|
* __Authorization:__
|
|
3695
3785
|
*
|
|
3696
|
-
* * Requires a user access token that includes the **moderator:manage:unban
|
|
3786
|
+
* * Requires a user access token that includes the **moderator:manage:unban\_requests** scope.
|
|
3697
3787
|
* * Query parameter `moderator_id` must match the `user_id` in the[user access token](https://dev.twitch.tv/docs/authentication/#user-access-tokens).
|
|
3698
3788
|
*
|
|
3699
3789
|
* __URL:__
|
|
@@ -5149,6 +5239,10 @@ var TwitchApi = class {
|
|
|
5149
5239
|
* * The access token is not valid.
|
|
5150
5240
|
* * The client ID specified in the Client-Id header must match the client ID specified in the access token.
|
|
5151
5241
|
*
|
|
5242
|
+
* _403 Forbidden_
|
|
5243
|
+
*
|
|
5244
|
+
* The user must complete additional steps in order to stream. Present the user with the returned error message.
|
|
5245
|
+
*
|
|
5152
5246
|
* @see https://dev.twitch.tv/docs/api/reference#get-stream-key
|
|
5153
5247
|
*/
|
|
5154
5248
|
getStreamKey: (params, options = {}) => this.callApi({
|
|
@@ -5635,6 +5729,10 @@ var TwitchApi = class {
|
|
|
5635
5729
|
* * The access token is not valid.
|
|
5636
5730
|
* * The ID specified in the Client-Id header does not match the client ID specified in the access token.
|
|
5637
5731
|
*
|
|
5732
|
+
* _429 Too Many Requests_
|
|
5733
|
+
*
|
|
5734
|
+
* The app exceeded the number of requests that it may make.
|
|
5735
|
+
*
|
|
5638
5736
|
* @see https://dev.twitch.tv/docs/api/reference#update-user
|
|
5639
5737
|
*/
|
|
5640
5738
|
updateUser: (params = null, options = {}) => this.callApi({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ts-twitch-api",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.6",
|
|
4
4
|
"description": "Very simple TwitchApi class and TypeScript interfaces for all Twitch API endpoints",
|
|
5
5
|
"author": "DmitryScaletta",
|
|
6
6
|
"license": "MIT",
|
|
@@ -29,14 +29,13 @@
|
|
|
29
29
|
],
|
|
30
30
|
"type": "module",
|
|
31
31
|
"devDependencies": {
|
|
32
|
-
"@types/node": "^
|
|
33
|
-
"tsup": "^8.0
|
|
34
|
-
"
|
|
35
|
-
"typescript": "^5.4.2"
|
|
32
|
+
"@types/node": "^24.3.0",
|
|
33
|
+
"tsup": "^8.5.0",
|
|
34
|
+
"typescript": "^5.9.2"
|
|
36
35
|
},
|
|
37
36
|
"scripts": {
|
|
38
37
|
"build": "pnpm build:src && tsup",
|
|
39
|
-
"build:src": "node
|
|
38
|
+
"build:src": "node ./scripts/build.ts",
|
|
40
39
|
"gen": "pnpm dlx openapi-typescript@6 https://github.com/DmitryScaletta/twitch-api-swagger/raw/main/openapi.json --output twitch-api.generated.ts"
|
|
41
40
|
}
|
|
42
41
|
}
|