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.cjs
CHANGED
|
@@ -18,11 +18,11 @@ var __copyProps = (to, from, except, desc) => {
|
|
|
18
18
|
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
|
|
19
19
|
|
|
20
20
|
// index.ts
|
|
21
|
-
var
|
|
22
|
-
__export(
|
|
21
|
+
var index_exports = {};
|
|
22
|
+
__export(index_exports, {
|
|
23
23
|
TwitchApi: () => TwitchApi
|
|
24
24
|
});
|
|
25
|
-
module.exports = __toCommonJS(
|
|
25
|
+
module.exports = __toCommonJS(index_exports);
|
|
26
26
|
|
|
27
27
|
// twitch-api.ts
|
|
28
28
|
var BASE_URL = "https://api.twitch.tv/helix";
|
|
@@ -1363,6 +1363,43 @@ var TwitchApi = class {
|
|
|
1363
1363
|
body,
|
|
1364
1364
|
options
|
|
1365
1365
|
}),
|
|
1366
|
+
/**
|
|
1367
|
+
* NEW Retrieves the active shared chat session for a channel.
|
|
1368
|
+
*
|
|
1369
|
+
* __Authorization:__
|
|
1370
|
+
*
|
|
1371
|
+
* 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).
|
|
1372
|
+
*
|
|
1373
|
+
* __URL:__
|
|
1374
|
+
*
|
|
1375
|
+
* `GET https://api.twitch.tv/helix/shared_chat/session`
|
|
1376
|
+
*
|
|
1377
|
+
* __Response Codes:__
|
|
1378
|
+
*
|
|
1379
|
+
* _200 OK_
|
|
1380
|
+
*
|
|
1381
|
+
* Successfully retrieved the shared chat session. Returns an empty array if the broadcaster\_id in the request isn’t in a shared chat session.
|
|
1382
|
+
*
|
|
1383
|
+
* _400 Bad Request_
|
|
1384
|
+
*
|
|
1385
|
+
* The ID in the `broadcaster_id` query parameter is not valid.
|
|
1386
|
+
*
|
|
1387
|
+
* _401 Unauthorized_
|
|
1388
|
+
*
|
|
1389
|
+
* * The OAuth token is not valid.
|
|
1390
|
+
* * The Authorization header is required and must contain a user access token.
|
|
1391
|
+
*
|
|
1392
|
+
* _500 Internal Server Error_
|
|
1393
|
+
*
|
|
1394
|
+
* Internal Server Error.
|
|
1395
|
+
*
|
|
1396
|
+
* @see https://dev.twitch.tv/docs/api/reference#get-shared-chat-session
|
|
1397
|
+
*/
|
|
1398
|
+
getSharedChatSession: (params, options = {}) => this.callApi({
|
|
1399
|
+
path: "/shared_chat/session",
|
|
1400
|
+
params,
|
|
1401
|
+
options
|
|
1402
|
+
}),
|
|
1366
1403
|
/**
|
|
1367
1404
|
* NEW Retrieves emotes available to the user across all channels.
|
|
1368
1405
|
*
|
|
@@ -1404,6 +1441,8 @@ var TwitchApi = class {
|
|
|
1404
1441
|
/**
|
|
1405
1442
|
* Sends an announcement to the broadcaster’s chat room.
|
|
1406
1443
|
*
|
|
1444
|
+
* **Rate Limits**: One announcement may be sent every 2 seconds.
|
|
1445
|
+
*
|
|
1407
1446
|
* __Authorization:__
|
|
1408
1447
|
*
|
|
1409
1448
|
* Requires a [user access token](https://dev.twitch.tv/docs/authentication#user-access-tokens) that includes the **moderator:manage:announcements** scope.
|
|
@@ -1432,6 +1471,10 @@ var TwitchApi = class {
|
|
|
1432
1471
|
* * The OAuth token is not valid.
|
|
1433
1472
|
* * The client ID specified in the Client-Id header does not match the client ID specified in the OAuth token.
|
|
1434
1473
|
*
|
|
1474
|
+
* _429 Too Many Requests_
|
|
1475
|
+
*
|
|
1476
|
+
* The sender has exceeded the number of announcements they may send to this **broadcaster\_id** within a given window.
|
|
1477
|
+
*
|
|
1435
1478
|
* @see https://dev.twitch.tv/docs/api/reference#send-chat-announcement
|
|
1436
1479
|
*/
|
|
1437
1480
|
sendChatAnnouncement: (params, body, options = {}) => this.callApi({
|
|
@@ -1446,7 +1489,7 @@ var TwitchApi = class {
|
|
|
1446
1489
|
*
|
|
1447
1490
|
* 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)
|
|
1448
1491
|
*
|
|
1449
|
-
* **Rate Limits
|
|
1492
|
+
* **Rate Limits**: The broadcaster may send a Shoutout once every 2 minutes. They may send the same broadcaster a Shoutout once every 60 minutes.
|
|
1450
1493
|
*
|
|
1451
1494
|
* 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.
|
|
1452
1495
|
*
|
|
@@ -1502,6 +1545,11 @@ var TwitchApi = class {
|
|
|
1502
1545
|
/**
|
|
1503
1546
|
* NEW Sends a message to the broadcaster’s chat room.
|
|
1504
1547
|
*
|
|
1548
|
+
* **NOTE:** When sending messages to a Shared Chat session, behaviors differ depending on your authentication token type:
|
|
1549
|
+
*
|
|
1550
|
+
* * 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`.
|
|
1551
|
+
* * 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.
|
|
1552
|
+
*
|
|
1505
1553
|
* __Authorization:__
|
|
1506
1554
|
*
|
|
1507
1555
|
* 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.
|
|
@@ -1524,6 +1572,7 @@ var TwitchApi = class {
|
|
|
1524
1572
|
* * The ID in the _sender\_id_ query parameter is not valid.
|
|
1525
1573
|
* * The _text_ query parameter is required.
|
|
1526
1574
|
* * The ID in the _reply\_parent\_message\_id_ query parameter is not valid.
|
|
1575
|
+
* * Cannot set \*for\_source\_only\* if User Access Token is used.
|
|
1527
1576
|
*
|
|
1528
1577
|
* _401 Unauthorized_
|
|
1529
1578
|
*
|
|
@@ -1680,6 +1729,8 @@ var TwitchApi = class {
|
|
|
1680
1729
|
/**
|
|
1681
1730
|
* 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).
|
|
1682
1731
|
*
|
|
1732
|
+
* 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.
|
|
1733
|
+
*
|
|
1683
1734
|
* __Authorization:__
|
|
1684
1735
|
*
|
|
1685
1736
|
* 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).
|
|
@@ -1723,7 +1774,7 @@ var TwitchApi = class {
|
|
|
1723
1774
|
};
|
|
1724
1775
|
conduits = {
|
|
1725
1776
|
/**
|
|
1726
|
-
* NEW Gets the [conduits](https://dev.twitch.tv/docs/eventsub/handling-conduit-events) for a client ID.
|
|
1777
|
+
* NEW Gets the [conduits](https://dev.twitch.tv/docs/eventsub/handling-conduit-events/) for a client ID.
|
|
1727
1778
|
*
|
|
1728
1779
|
* __Authorization:__
|
|
1729
1780
|
*
|
|
@@ -1750,7 +1801,7 @@ var TwitchApi = class {
|
|
|
1750
1801
|
options
|
|
1751
1802
|
}),
|
|
1752
1803
|
/**
|
|
1753
|
-
* NEW Creates a new [conduit](https://dev.twitch.tv/docs/eventsub/handling-conduit-events).
|
|
1804
|
+
* NEW Creates a new [conduit](https://dev.twitch.tv/docs/eventsub/handling-conduit-events/).
|
|
1754
1805
|
*
|
|
1755
1806
|
* __Authorization:__
|
|
1756
1807
|
*
|
|
@@ -1787,7 +1838,7 @@ var TwitchApi = class {
|
|
|
1787
1838
|
options
|
|
1788
1839
|
}),
|
|
1789
1840
|
/**
|
|
1790
|
-
* 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.
|
|
1841
|
+
* 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.
|
|
1791
1842
|
*
|
|
1792
1843
|
* __Authorization:__
|
|
1793
1844
|
*
|
|
@@ -1826,7 +1877,7 @@ var TwitchApi = class {
|
|
|
1826
1877
|
options
|
|
1827
1878
|
}),
|
|
1828
1879
|
/**
|
|
1829
|
-
* 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).
|
|
1880
|
+
* 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).
|
|
1830
1881
|
*
|
|
1831
1882
|
* __Authorization:__
|
|
1832
1883
|
*
|
|
@@ -1864,7 +1915,7 @@ var TwitchApi = class {
|
|
|
1864
1915
|
options
|
|
1865
1916
|
}),
|
|
1866
1917
|
/**
|
|
1867
|
-
* NEW Gets a lists of all shards for a [conduit](https://dev.twitch.tv/docs/eventsub/handling-conduit-events).
|
|
1918
|
+
* NEW Gets a lists of all shards for a [conduit](https://dev.twitch.tv/docs/eventsub/handling-conduit-events/).
|
|
1868
1919
|
*
|
|
1869
1920
|
* __Authorization:__
|
|
1870
1921
|
*
|
|
@@ -1901,7 +1952,7 @@ var TwitchApi = class {
|
|
|
1901
1952
|
options
|
|
1902
1953
|
}),
|
|
1903
1954
|
/**
|
|
1904
|
-
* NEW Updates shard(s) for a [conduit](https://dev.twitch.tv/docs/eventsub/handling-conduit-events).
|
|
1955
|
+
* NEW Updates shard(s) for a [conduit](https://dev.twitch.tv/docs/eventsub/handling-conduit-events/).
|
|
1905
1956
|
*
|
|
1906
1957
|
* **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.
|
|
1907
1958
|
*
|
|
@@ -1995,7 +2046,7 @@ var TwitchApi = class {
|
|
|
1995
2046
|
*
|
|
1996
2047
|
* __Authorization:__
|
|
1997
2048
|
*
|
|
1998
|
-
* 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
|
|
2049
|
+
* 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.
|
|
1999
2050
|
*
|
|
2000
2051
|
* __URL:__
|
|
2001
2052
|
*
|
|
@@ -2047,7 +2098,7 @@ var TwitchApi = class {
|
|
|
2047
2098
|
*
|
|
2048
2099
|
* __Authorization:__
|
|
2049
2100
|
*
|
|
2050
|
-
* 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
|
|
2101
|
+
* 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.
|
|
2051
2102
|
*
|
|
2052
2103
|
* __URL:__
|
|
2053
2104
|
*
|
|
@@ -2593,7 +2644,7 @@ var TwitchApi = class {
|
|
|
2593
2644
|
*
|
|
2594
2645
|
* 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.
|
|
2595
2646
|
*
|
|
2596
|
-
* 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.
|
|
2647
|
+
* 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.
|
|
2597
2648
|
*
|
|
2598
2649
|
* __URL:__
|
|
2599
2650
|
*
|
|
@@ -2692,13 +2743,13 @@ var TwitchApi = class {
|
|
|
2692
2743
|
*
|
|
2693
2744
|
* __Authorization:__
|
|
2694
2745
|
*
|
|
2695
|
-
* 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.
|
|
2746
|
+
* 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.
|
|
2696
2747
|
*
|
|
2697
2748
|
* 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.
|
|
2698
2749
|
*
|
|
2699
2750
|
* __Request Query Parameters:__
|
|
2700
2751
|
*
|
|
2701
|
-
* Use the _status_, _type_, and
|
|
2752
|
+
* 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.
|
|
2702
2753
|
*
|
|
2703
2754
|
* __URL:__
|
|
2704
2755
|
*
|
|
@@ -3306,6 +3357,45 @@ var TwitchApi = class {
|
|
|
3306
3357
|
path: "/hypetrain/events",
|
|
3307
3358
|
params,
|
|
3308
3359
|
options
|
|
3360
|
+
}),
|
|
3361
|
+
/**
|
|
3362
|
+
* BETA Get the status of a Hype Train for the specified broadcaster.
|
|
3363
|
+
*
|
|
3364
|
+
* __Authorization:__
|
|
3365
|
+
*
|
|
3366
|
+
* * Requires an [user access token](https://dev.twitch.tv/docs/authentication/#user-access-tokens).
|
|
3367
|
+
* * Requires OAuth Scope: `channel:read:hype_train`.
|
|
3368
|
+
* * Requires that `broadcaster_id` and `user_id` match in the User-Access token.
|
|
3369
|
+
*
|
|
3370
|
+
* __URL:__
|
|
3371
|
+
*
|
|
3372
|
+
* `GET https://api.twitch.tv/helix/hypetrain/status`
|
|
3373
|
+
*
|
|
3374
|
+
* __Response Codes:__
|
|
3375
|
+
*
|
|
3376
|
+
* _200 OK_
|
|
3377
|
+
*
|
|
3378
|
+
* Successfully retrieved the status object.
|
|
3379
|
+
*
|
|
3380
|
+
* _400 Bad Request_
|
|
3381
|
+
*
|
|
3382
|
+
* The ID in the `broadcaster_id` query parameter is not valid.
|
|
3383
|
+
*
|
|
3384
|
+
* _401 Unauthorized_
|
|
3385
|
+
*
|
|
3386
|
+
* * The OAuth token is not valid.
|
|
3387
|
+
* * The Authorization header is required and must contain a user access token.
|
|
3388
|
+
*
|
|
3389
|
+
* _500 Internal Server Error_
|
|
3390
|
+
*
|
|
3391
|
+
* Internal Server Error.
|
|
3392
|
+
*
|
|
3393
|
+
* @see https://dev.twitch.tv/docs/api/reference#get-hype-train-status
|
|
3394
|
+
*/
|
|
3395
|
+
getHypeTrainStatus: (params, options = {}) => this.callApi({
|
|
3396
|
+
path: "/hypetrain/status",
|
|
3397
|
+
params,
|
|
3398
|
+
options
|
|
3309
3399
|
})
|
|
3310
3400
|
};
|
|
3311
3401
|
moderation = {
|
|
@@ -3719,7 +3809,7 @@ var TwitchApi = class {
|
|
|
3719
3809
|
*
|
|
3720
3810
|
* __Authorization:__
|
|
3721
3811
|
*
|
|
3722
|
-
* * Requires a user access token that includes the **moderator:manage:unban
|
|
3812
|
+
* * Requires a user access token that includes the **moderator:manage:unban\_requests** scope.
|
|
3723
3813
|
* * Query parameter `moderator_id` must match the `user_id` in the[user access token](https://dev.twitch.tv/docs/authentication/#user-access-tokens).
|
|
3724
3814
|
*
|
|
3725
3815
|
* __URL:__
|
|
@@ -5175,6 +5265,10 @@ var TwitchApi = class {
|
|
|
5175
5265
|
* * The access token is not valid.
|
|
5176
5266
|
* * The client ID specified in the Client-Id header must match the client ID specified in the access token.
|
|
5177
5267
|
*
|
|
5268
|
+
* _403 Forbidden_
|
|
5269
|
+
*
|
|
5270
|
+
* The user must complete additional steps in order to stream. Present the user with the returned error message.
|
|
5271
|
+
*
|
|
5178
5272
|
* @see https://dev.twitch.tv/docs/api/reference#get-stream-key
|
|
5179
5273
|
*/
|
|
5180
5274
|
getStreamKey: (params, options = {}) => this.callApi({
|
|
@@ -5661,6 +5755,10 @@ var TwitchApi = class {
|
|
|
5661
5755
|
* * The access token is not valid.
|
|
5662
5756
|
* * The ID specified in the Client-Id header does not match the client ID specified in the access token.
|
|
5663
5757
|
*
|
|
5758
|
+
* _429 Too Many Requests_
|
|
5759
|
+
*
|
|
5760
|
+
* The app exceeded the number of requests that it may make.
|
|
5761
|
+
*
|
|
5664
5762
|
* @see https://dev.twitch.tv/docs/api/reference#update-user
|
|
5665
5763
|
*/
|
|
5666
5764
|
updateUser: (params = null, options = {}) => this.callApi({
|