ts-twitch-api 0.2.1 → 0.2.3
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 +140 -4
- package/dist/index.d.cts +950 -68
- package/dist/index.d.ts +950 -68
- package/dist/index.js +140 -4
- package/package.json +5 -5
package/dist/index.js
CHANGED
|
@@ -47,10 +47,17 @@ var TwitchApi = class {
|
|
|
47
47
|
options.headers.set("Client-Id", clientId || this._clientId);
|
|
48
48
|
}
|
|
49
49
|
const response = await fetch(url, options);
|
|
50
|
+
const status = response.status;
|
|
51
|
+
let data = null;
|
|
52
|
+
if (status === 200 && path === "/schedule/icalendar") {
|
|
53
|
+
data = await response.text();
|
|
54
|
+
} else if (status !== 204) {
|
|
55
|
+
data = await response.json();
|
|
56
|
+
}
|
|
50
57
|
return {
|
|
51
58
|
ok: response.ok,
|
|
52
|
-
status
|
|
53
|
-
data
|
|
59
|
+
status,
|
|
60
|
+
data
|
|
54
61
|
};
|
|
55
62
|
}
|
|
56
63
|
ads = {
|
|
@@ -1329,6 +1336,44 @@ var TwitchApi = class {
|
|
|
1329
1336
|
body,
|
|
1330
1337
|
options
|
|
1331
1338
|
}),
|
|
1339
|
+
/**
|
|
1340
|
+
* BETA Retrieves emotes available to the user across all channels.
|
|
1341
|
+
*
|
|
1342
|
+
* __Authorization:__
|
|
1343
|
+
*
|
|
1344
|
+
* * Requires a user access token that includes the **user:read:emotes** scope.
|
|
1345
|
+
* * Query parameter `user_id` must match the `user_id` in the user access token.
|
|
1346
|
+
*
|
|
1347
|
+
* __URL:__
|
|
1348
|
+
*
|
|
1349
|
+
* `GET https://api.twitch.tv/helix/chat/emotes/user`
|
|
1350
|
+
*
|
|
1351
|
+
* __Response Codes:__
|
|
1352
|
+
*
|
|
1353
|
+
* _200 OK_
|
|
1354
|
+
*
|
|
1355
|
+
* Successfully retrieved the emotes.
|
|
1356
|
+
*
|
|
1357
|
+
* _400 Bad Request_
|
|
1358
|
+
*
|
|
1359
|
+
* * The _user\_id_ query parameter is required.
|
|
1360
|
+
* * The ID in the _user\_id_ query parameter is not valid.
|
|
1361
|
+
*
|
|
1362
|
+
* _401 Unauthorized_
|
|
1363
|
+
*
|
|
1364
|
+
* * The ID in _user\_id_ must match the user ID in the user access token.
|
|
1365
|
+
* * The Authorization header is required and must contain a user access token.
|
|
1366
|
+
* * The user access token must include the **user:read:emotes** scope.
|
|
1367
|
+
* * The access token is not valid.
|
|
1368
|
+
* * The client ID specified in the Client-Id header does not match the client ID specified in the access token.
|
|
1369
|
+
*
|
|
1370
|
+
* @see https://dev.twitch.tv/docs/api/reference#get-user-emotes
|
|
1371
|
+
*/
|
|
1372
|
+
getUserEmotes: async (params, options = {}) => this.callApi({
|
|
1373
|
+
path: "/chat/emotes/user",
|
|
1374
|
+
params,
|
|
1375
|
+
options
|
|
1376
|
+
}),
|
|
1332
1377
|
/**
|
|
1333
1378
|
* Sends an announcement to the broadcaster’s chat room.
|
|
1334
1379
|
*
|
|
@@ -1905,6 +1950,8 @@ var TwitchApi = class {
|
|
|
1905
1950
|
/**
|
|
1906
1951
|
* Gets an organization’s list of entitlements that have been granted to a game, a user, or both.
|
|
1907
1952
|
*
|
|
1953
|
+
* **NOTE:** Entitlements returned in the response body data are not guaranteed to be sorted by any field returned by the API. To retrieve **CLAIMED** or **FULFILLED** entitlements, use the `fulfillment_status` query parameter to filter results. To retrieve entitlements for a specific game, use the `game_id` query parameter to filter results.
|
|
1954
|
+
*
|
|
1908
1955
|
* The following table identifies the request parameters that you may specify based on the type of access token used.
|
|
1909
1956
|
*
|
|
1910
1957
|
* | Access token type | Parameter | Description |
|
|
@@ -2618,7 +2665,7 @@ var TwitchApi = class {
|
|
|
2618
2665
|
*
|
|
2619
2666
|
* __Authorization:__
|
|
2620
2667
|
*
|
|
2621
|
-
* If you use [
|
|
2668
|
+
* 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.
|
|
2622
2669
|
*
|
|
2623
2670
|
* 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.
|
|
2624
2671
|
*
|
|
@@ -3599,6 +3646,95 @@ var TwitchApi = class {
|
|
|
3599
3646
|
params,
|
|
3600
3647
|
options
|
|
3601
3648
|
}),
|
|
3649
|
+
/**
|
|
3650
|
+
* BETA Gets a list of unban requests for a broadcaster’s channel.
|
|
3651
|
+
*
|
|
3652
|
+
* __Authorization:__
|
|
3653
|
+
*
|
|
3654
|
+
* * Requires a user access token that includes the **moderator:read:unban\_requests** or **moderator:manage:unban\_requests** scope.
|
|
3655
|
+
* * Query parameter `moderator_id` must match the `user_id` in the [user access token](https://dev.twitch.tv/docs/authentication/#user-access-tokens).
|
|
3656
|
+
*
|
|
3657
|
+
* __URL:__
|
|
3658
|
+
*
|
|
3659
|
+
* `GET https://api.twitch.tv/helix/moderation/unban_requests`
|
|
3660
|
+
*
|
|
3661
|
+
* __Response Codes:__
|
|
3662
|
+
*
|
|
3663
|
+
* _200 OK_
|
|
3664
|
+
*
|
|
3665
|
+
* Successfully retrieved the list of unban requests.
|
|
3666
|
+
*
|
|
3667
|
+
* _400 Bad Request_
|
|
3668
|
+
*
|
|
3669
|
+
* * The _broadcaster\_id_ query parameter is required.
|
|
3670
|
+
* * The ID in the _broadcaster\_id_ query parameter is not valid.
|
|
3671
|
+
* * The _moderator\_id_ query parameter is required.
|
|
3672
|
+
* * The ID in the _moderator\_id_ query parameter is not valid.
|
|
3673
|
+
* * The pagination cursor is not valid.
|
|
3674
|
+
*
|
|
3675
|
+
* _401 Unauthorized_
|
|
3676
|
+
*
|
|
3677
|
+
* * The ID in _moderator\_id_ must match the user ID in the user access token.
|
|
3678
|
+
* * The Authorization header is required and must contain a user access token.
|
|
3679
|
+
* * The user access token must include the **moderator:read:unban\_requests** or **moderator:manage:unban\_requests** scope.
|
|
3680
|
+
* * The access token is not valid.
|
|
3681
|
+
* * The client ID specified in the Client-Id header does not match the client ID specified in the access token.
|
|
3682
|
+
*
|
|
3683
|
+
* @see https://dev.twitch.tv/docs/api/reference#get-unban-requests
|
|
3684
|
+
*/
|
|
3685
|
+
getUnbanRequests: async (params, options = {}) => this.callApi({
|
|
3686
|
+
path: "/moderation/unban_requests",
|
|
3687
|
+
params,
|
|
3688
|
+
options
|
|
3689
|
+
}),
|
|
3690
|
+
/**
|
|
3691
|
+
* BETA Resolves an unban request by approving or denying it.
|
|
3692
|
+
*
|
|
3693
|
+
* __Authorization:__
|
|
3694
|
+
*
|
|
3695
|
+
* * Requires a user access token that includes the **moderator:manage:unban\_requests** scope.
|
|
3696
|
+
* * Query parameter `moderator_id` must match the `user_id` in the [user access token](https://dev.twitch.tv/docs/authentication/#user-access-tokens).
|
|
3697
|
+
*
|
|
3698
|
+
* __URL:__
|
|
3699
|
+
*
|
|
3700
|
+
* `PATCH https://api.twitch.tv/helix/moderation/unban_requests`
|
|
3701
|
+
*
|
|
3702
|
+
* __Response Codes:__
|
|
3703
|
+
*
|
|
3704
|
+
* _200 OK_
|
|
3705
|
+
*
|
|
3706
|
+
* Successfully resolved the unban request.
|
|
3707
|
+
*
|
|
3708
|
+
* _400 Bad Request_
|
|
3709
|
+
*
|
|
3710
|
+
* * The _broadcaster\_id_ query parameter is required.
|
|
3711
|
+
* * The ID in the _broadcaster\_id_ query parameter is not valid.
|
|
3712
|
+
* * The _moderator\_id_ query parameter is required.
|
|
3713
|
+
* * The ID in the _moderator\_id_ query parameter is not valid.
|
|
3714
|
+
* * The pagination cursor is not valid.
|
|
3715
|
+
* * The broadcaster is not receiving unban requests
|
|
3716
|
+
* * Invalid requested update
|
|
3717
|
+
*
|
|
3718
|
+
* _401 Unauthorized_
|
|
3719
|
+
*
|
|
3720
|
+
* * The ID in _moderator\_id_ must match the user ID in the user access token.
|
|
3721
|
+
* * The Authorization header is required and must contain a user access token.
|
|
3722
|
+
* * The user access token must include the **moderator:manage:unban\_requests** scope.
|
|
3723
|
+
* * The access token is not valid.
|
|
3724
|
+
* * The client ID specified in the Client-Id header does not match the client ID specified in the access token.
|
|
3725
|
+
*
|
|
3726
|
+
* _404 Not Found_
|
|
3727
|
+
*
|
|
3728
|
+
* The unban request ID was not found.
|
|
3729
|
+
*
|
|
3730
|
+
* @see https://dev.twitch.tv/docs/api/reference#resolve-unban-requests
|
|
3731
|
+
*/
|
|
3732
|
+
resolveUnbanRequests: async (params, options = {}) => this.callApi({
|
|
3733
|
+
path: "/moderation/unban_requests",
|
|
3734
|
+
method: "PATCH",
|
|
3735
|
+
params,
|
|
3736
|
+
options
|
|
3737
|
+
}),
|
|
3602
3738
|
/**
|
|
3603
3739
|
* Gets the broadcaster’s list of non-private, blocked words or phrases. These are the terms that the broadcaster or moderator added manually or that were denied by AutoMod.
|
|
3604
3740
|
*
|
|
@@ -4209,7 +4345,7 @@ var TwitchApi = class {
|
|
|
4209
4345
|
*
|
|
4210
4346
|
* _200 OK_
|
|
4211
4347
|
*
|
|
4212
|
-
* Successfully retrieved the broadcaster
|
|
4348
|
+
* Successfully retrieved the broadcaster's polls.
|
|
4213
4349
|
*
|
|
4214
4350
|
* _400 Bad Request_
|
|
4215
4351
|
*
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "ts-twitch-api",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.3",
|
|
4
4
|
"description": "Very simple TwitchApi class and TypeScript interfaces for all Twitch API endpoints",
|
|
5
5
|
"author": "DmitryScaletta",
|
|
6
6
|
"license": "MIT",
|
|
@@ -34,9 +34,9 @@
|
|
|
34
34
|
"gen": "pnpm dlx openapi-typescript https://github.com/DmitryScaletta/twitch-api-swagger/raw/main/openapi.json --output twitch-api.generated.ts"
|
|
35
35
|
},
|
|
36
36
|
"devDependencies": {
|
|
37
|
-
"@types/node": "^20.11.
|
|
38
|
-
"tsup": "^8.0.
|
|
39
|
-
"tsx": "^4.7.
|
|
40
|
-
"typescript": "^5.
|
|
37
|
+
"@types/node": "^20.11.28",
|
|
38
|
+
"tsup": "^8.0.2",
|
|
39
|
+
"tsx": "^4.7.1",
|
|
40
|
+
"typescript": "^5.4.2"
|
|
41
41
|
}
|
|
42
42
|
}
|