ts-twitch-api 0.2.7 → 0.3.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/dist/index.cjs +155 -6
- package/dist/index.d.cts +513 -47
- package/dist/index.d.ts +513 -47
- package/dist/index.js +155 -6
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -1510,7 +1510,7 @@ var TwitchApi = class {
|
|
|
1510
1510
|
*
|
|
1511
1511
|
* @see https://dev.twitch.tv/docs/api/reference#send-a-shoutout
|
|
1512
1512
|
*/
|
|
1513
|
-
|
|
1513
|
+
sendAShoutout: (params, options = {}) => this.callApi({
|
|
1514
1514
|
path: "/chat/shoutouts",
|
|
1515
1515
|
method: "POST",
|
|
1516
1516
|
params,
|
|
@@ -1651,7 +1651,7 @@ var TwitchApi = class {
|
|
|
1651
1651
|
/**
|
|
1652
1652
|
* Creates a clip from the broadcaster’s stream.
|
|
1653
1653
|
*
|
|
1654
|
-
* This API captures up to 90 seconds of the broadcaster’s stream. The 90 seconds spans the point in the stream from when you called the API. For example, if you call the API at the 4:00 minute mark, the API captures from approximately the
|
|
1654
|
+
* This API captures up to 90 seconds of the broadcaster’s stream. The 90 seconds spans the point in the stream from when you called the API. For example, if you call the API at the 4:00 minute mark, the API captures from approximately the 2:35 mark to approximately the 4:05 minute mark. Twitch tries its best to capture 90 seconds of the stream, but the actual length may be less. This may occur if you begin capturing the clip near the beginning or end of the stream.
|
|
1655
1655
|
*
|
|
1656
1656
|
* By default, Twitch publishes up to the last 30 seconds of the 90 seconds window and provides a default title for the clip. To specify the title and the portion of the 90 seconds window that’s used for the clip, use the URL in the response’s `edit_url` field. You can specify a clip that’s from 5 seconds to 60 seconds in length. The URL is valid for up to 24 hours or until the clip is published, whichever comes first.
|
|
1657
1657
|
*
|
|
@@ -1675,6 +1675,8 @@ var TwitchApi = class {
|
|
|
1675
1675
|
*
|
|
1676
1676
|
* * The _broadcaster\_id_ query parameter is required.
|
|
1677
1677
|
* * The ID in the _broadcaster\_id_ query parameter was not found.
|
|
1678
|
+
* * The category is not clippable.
|
|
1679
|
+
* * The title did not pass AutoMod checks.
|
|
1678
1680
|
*
|
|
1679
1681
|
* _401 Unauthorized_
|
|
1680
1682
|
*
|
|
@@ -1687,6 +1689,7 @@ var TwitchApi = class {
|
|
|
1687
1689
|
*
|
|
1688
1690
|
* * The broadcaster has restricted the ability to capture clips to followers and/or subscribers only.
|
|
1689
1691
|
* * The specified broadcaster has not enabled clips on their channel.
|
|
1692
|
+
* * The user is banned or timed out from the broadcaster’s channel.
|
|
1690
1693
|
*
|
|
1691
1694
|
* _404 Not Found_
|
|
1692
1695
|
*
|
|
@@ -1745,6 +1748,66 @@ var TwitchApi = class {
|
|
|
1745
1748
|
params,
|
|
1746
1749
|
options
|
|
1747
1750
|
}),
|
|
1751
|
+
/**
|
|
1752
|
+
* BETA Creates a clip from a broadcaster’s VOD on behalf of the broadcaster or an editor of the channel. Since a live stream is actively creating a VOD, this endpoint can also be used to create a clip from earlier in the current stream.
|
|
1753
|
+
*
|
|
1754
|
+
* The duration of a clip can be from 5 seconds to 60 seconds in length, with a default of 30 seconds if not specified.
|
|
1755
|
+
*
|
|
1756
|
+
* `vod_offset` indicates where the clip will end. In other words, the clip will start at (`vod_offset` \- `duration`) and end at `vod_offset`. This means that the value of `vod_offset` must greater than or equal to the value of `duration`.
|
|
1757
|
+
*
|
|
1758
|
+
* The URL in the response’s `edit_url` field allows you to edit the clip’s title, feature the clip, create a portrait version of the clip, download the clip media, and share the clip directly to social platforms.
|
|
1759
|
+
*
|
|
1760
|
+
* __Authorization:__
|
|
1761
|
+
*
|
|
1762
|
+
* 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 **editor:manage:clips** or **channel:manage:clips** scope.
|
|
1763
|
+
*
|
|
1764
|
+
* __URL:__
|
|
1765
|
+
*
|
|
1766
|
+
* `POST https://api.twitch.tv/helix/videos/clips`
|
|
1767
|
+
*
|
|
1768
|
+
* __Response Codes:__
|
|
1769
|
+
*
|
|
1770
|
+
* _202 Accepted_
|
|
1771
|
+
*
|
|
1772
|
+
* Successfully started the clip process.
|
|
1773
|
+
*
|
|
1774
|
+
* _400 Bad Request_
|
|
1775
|
+
*
|
|
1776
|
+
* * Validation errors: Invalid source type, missing required fields.
|
|
1777
|
+
* * The broadcaster\_id query parameter is required.
|
|
1778
|
+
* * The ID in the broadcaster\_id query parameter was not found.
|
|
1779
|
+
* * The category is not clippable.
|
|
1780
|
+
* * The title did not pass AutoMod checks.
|
|
1781
|
+
* * Broadcaster is banned.
|
|
1782
|
+
*
|
|
1783
|
+
* _401 Unauthorized_
|
|
1784
|
+
*
|
|
1785
|
+
* * The Authorization header is required and must specify user access token.
|
|
1786
|
+
* * The user access token must include the **editor:manage:clips** or **channel:manage:clips** scope.
|
|
1787
|
+
* * The OAuth token is not valid.
|
|
1788
|
+
* * The ID in the Client-Id header must match the Client ID in the OAuth token.
|
|
1789
|
+
*
|
|
1790
|
+
* _403 Forbidden_
|
|
1791
|
+
*
|
|
1792
|
+
* * The broadcaster has restricted the ability to capture clips to followers and/or subscribers only.
|
|
1793
|
+
* * The specified broadcaster has not enabled clips on their channel.
|
|
1794
|
+
* * The user defined by the _editor\_id_ is not authorized to create Clips.
|
|
1795
|
+
* * The user is banned or timed out from the broadcaster's channel.
|
|
1796
|
+
*
|
|
1797
|
+
* _404 Not Found_
|
|
1798
|
+
*
|
|
1799
|
+
* * The broadcaster in the _broadcaster\_id_ query parameter must be broadcasting live.
|
|
1800
|
+
* * The VOD is not found..
|
|
1801
|
+
* * The _broadcaster\_id_ or the _editor\_id_ does not exist.
|
|
1802
|
+
*
|
|
1803
|
+
* @see https://dev.twitch.tv/docs/api/reference#create-clip-from-vod
|
|
1804
|
+
*/
|
|
1805
|
+
createClipFromVOD: (params, options = {}) => this.callApi({
|
|
1806
|
+
path: "/videos/clips",
|
|
1807
|
+
method: "POST",
|
|
1808
|
+
params,
|
|
1809
|
+
options
|
|
1810
|
+
}),
|
|
1748
1811
|
/**
|
|
1749
1812
|
* NEW Provides URLs to download the video file(s) for the specified clips. For information about clips, see [How to use clips](https://help.twitch.tv/s/article/how-to-use-clips).
|
|
1750
1813
|
*
|
|
@@ -3065,7 +3128,7 @@ var TwitchApi = class {
|
|
|
3065
3128
|
*
|
|
3066
3129
|
* __Response Codes:__
|
|
3067
3130
|
*
|
|
3068
|
-
*
|
|
3131
|
+
* _200 OK_
|
|
3069
3132
|
*
|
|
3070
3133
|
* _400 Bad Request_
|
|
3071
3134
|
*
|
|
@@ -4466,7 +4529,7 @@ var TwitchApi = class {
|
|
|
4466
4529
|
options
|
|
4467
4530
|
}),
|
|
4468
4531
|
/**
|
|
4469
|
-
*
|
|
4532
|
+
* Warns a user in the specified broadcaster’s chat room, preventing them from chat interaction until the warning is acknowledged. New warnings can be issued to a user when they already have a warning in the channel (new warning will replace old warning).
|
|
4470
4533
|
*
|
|
4471
4534
|
* __Authorization:__
|
|
4472
4535
|
*
|
|
@@ -4523,6 +4586,92 @@ var TwitchApi = class {
|
|
|
4523
4586
|
params,
|
|
4524
4587
|
body,
|
|
4525
4588
|
options
|
|
4589
|
+
}),
|
|
4590
|
+
/**
|
|
4591
|
+
* BETA Adds a suspicious user status to a chatter on the broadcaster’s channel.
|
|
4592
|
+
*
|
|
4593
|
+
* __Authorization:__
|
|
4594
|
+
*
|
|
4595
|
+
* 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 **moderator:manage:suspicious\_users** scope.
|
|
4596
|
+
*
|
|
4597
|
+
* __URL:__
|
|
4598
|
+
*
|
|
4599
|
+
* `POST https://api.twitch.tv/helix/moderation/suspicious_users`
|
|
4600
|
+
*
|
|
4601
|
+
* __Response Codes:__
|
|
4602
|
+
*
|
|
4603
|
+
* _200 OK_
|
|
4604
|
+
*
|
|
4605
|
+
* Successfully applied a suspicious user status.
|
|
4606
|
+
*
|
|
4607
|
+
* _400 Bad Request_
|
|
4608
|
+
*
|
|
4609
|
+
* * Validation errors: Missing required fields.
|
|
4610
|
+
* * The ID in the broadcaster\_id query parameter was not found.
|
|
4611
|
+
* * The status specified was invalid. Must either be ACTIVE\_MONITORING or RESTRICTED
|
|
4612
|
+
* * The status update is not allowed for this user.
|
|
4613
|
+
*
|
|
4614
|
+
* _401 Unauthorized_
|
|
4615
|
+
*
|
|
4616
|
+
* * The Authorization header is required and must specify user access token.
|
|
4617
|
+
* * The user access token must include the **moderator:manage:suspicious\_users** scope.
|
|
4618
|
+
* * The OAuth token is not valid.
|
|
4619
|
+
* * The ID in the Client-Id header must match the Client ID in the OAuth token.
|
|
4620
|
+
*
|
|
4621
|
+
* _403 Forbidden_
|
|
4622
|
+
*
|
|
4623
|
+
* * The user in the moderator\_id query parameter is not one of the broadcaster's moderators.
|
|
4624
|
+
*
|
|
4625
|
+
* @see https://dev.twitch.tv/docs/api/reference#add-suspicious-status-to-chat-user
|
|
4626
|
+
*/
|
|
4627
|
+
addSuspiciousStatusToChatUser: (params, body, options = {}) => this.callApi({
|
|
4628
|
+
path: "/moderation/suspicious_users",
|
|
4629
|
+
method: "POST",
|
|
4630
|
+
params,
|
|
4631
|
+
body,
|
|
4632
|
+
options
|
|
4633
|
+
}),
|
|
4634
|
+
/**
|
|
4635
|
+
* BETA Remove a suspicious user status from a chatter on broadcaster’s channel.
|
|
4636
|
+
*
|
|
4637
|
+
* __Authorization:__
|
|
4638
|
+
*
|
|
4639
|
+
* 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 **moderator:manage:suspicious\_users** scope.
|
|
4640
|
+
*
|
|
4641
|
+
* __URL:__
|
|
4642
|
+
*
|
|
4643
|
+
* `DELETE https://api.twitch.tv/helix/moderation/suspicious_users`
|
|
4644
|
+
*
|
|
4645
|
+
* __Response Codes:__
|
|
4646
|
+
*
|
|
4647
|
+
* _200 OK_
|
|
4648
|
+
*
|
|
4649
|
+
* Successfully removed a suspicious user status.
|
|
4650
|
+
*
|
|
4651
|
+
* _400 Bad Request_
|
|
4652
|
+
*
|
|
4653
|
+
* * Validation errors: Missing required fields.
|
|
4654
|
+
* * The ID in the broadcaster\_id query parameter was not found.
|
|
4655
|
+
* * The status update is not allowed for this user.
|
|
4656
|
+
*
|
|
4657
|
+
* _401 Unauthorized_
|
|
4658
|
+
*
|
|
4659
|
+
* * The Authorization header is required and must specify user access token.
|
|
4660
|
+
* * The user access token must include the **moderator:manage:suspicious\_users** scope.
|
|
4661
|
+
* * The OAuth token is not valid.
|
|
4662
|
+
* * The ID in the Client-Id header must match the Client ID in the OAuth token.
|
|
4663
|
+
*
|
|
4664
|
+
* _403 Forbidden_
|
|
4665
|
+
*
|
|
4666
|
+
* * The user in the moderator\_id query parameter is not one of the broadcaster's moderators.
|
|
4667
|
+
*
|
|
4668
|
+
* @see https://dev.twitch.tv/docs/api/reference#remove-suspicious-status-from-chat-user
|
|
4669
|
+
*/
|
|
4670
|
+
removeSuspiciousStatusFromChatUser: (params, options = {}) => this.callApi({
|
|
4671
|
+
path: "/moderation/suspicious_users",
|
|
4672
|
+
method: "DELETE",
|
|
4673
|
+
params,
|
|
4674
|
+
options
|
|
4526
4675
|
})
|
|
4527
4676
|
};
|
|
4528
4677
|
polls = {
|
|
@@ -4853,7 +5002,7 @@ var TwitchApi = class {
|
|
|
4853
5002
|
*
|
|
4854
5003
|
* @see https://dev.twitch.tv/docs/api/reference#start-a-raid
|
|
4855
5004
|
*/
|
|
4856
|
-
|
|
5005
|
+
startARaid: (params = null, options = {}) => this.callApi({
|
|
4857
5006
|
path: "/raids",
|
|
4858
5007
|
method: "POST",
|
|
4859
5008
|
params,
|
|
@@ -4902,7 +5051,7 @@ var TwitchApi = class {
|
|
|
4902
5051
|
*
|
|
4903
5052
|
* @see https://dev.twitch.tv/docs/api/reference#cancel-a-raid
|
|
4904
5053
|
*/
|
|
4905
|
-
|
|
5054
|
+
cancelARaid: (params, options = {}) => this.callApi({
|
|
4906
5055
|
path: "/raids",
|
|
4907
5056
|
method: "DELETE",
|
|
4908
5057
|
params,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ts-twitch-api",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "Very simple TwitchApi class and TypeScript interfaces for all Twitch API endpoints",
|
|
5
5
|
"author": "DmitryScaletta",
|
|
6
6
|
"license": "MIT",
|
|
@@ -36,6 +36,6 @@
|
|
|
36
36
|
"scripts": {
|
|
37
37
|
"build": "pnpm build:src && tsup",
|
|
38
38
|
"build:src": "node ./scripts/build.ts",
|
|
39
|
-
"gen": "
|
|
39
|
+
"gen": "pnpx openapi-typescript@6 https://github.com/DmitryScaletta/twitch-api-swagger/raw/main/openapi.json --output twitch-api.generated.ts"
|
|
40
40
|
}
|
|
41
41
|
}
|