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 CHANGED
@@ -73,10 +73,17 @@ var TwitchApi = class {
73
73
  options.headers.set("Client-Id", clientId || this._clientId);
74
74
  }
75
75
  const response = await fetch(url, options);
76
+ const status = response.status;
77
+ let data = null;
78
+ if (status === 200 && path === "/schedule/icalendar") {
79
+ data = await response.text();
80
+ } else if (status !== 204) {
81
+ data = await response.json();
82
+ }
76
83
  return {
77
84
  ok: response.ok,
78
- status: response.status,
79
- data: await response.json()
85
+ status,
86
+ data
80
87
  };
81
88
  }
82
89
  ads = {
@@ -1355,6 +1362,44 @@ var TwitchApi = class {
1355
1362
  body,
1356
1363
  options
1357
1364
  }),
1365
+ /**
1366
+ * BETA Retrieves emotes available to the user across all channels.
1367
+ *
1368
+ * __Authorization:__
1369
+ *
1370
+ * * Requires a user access token that includes the **user:read:emotes** scope.
1371
+ * * Query parameter `user_id` must match the `user_id` in the user access token.
1372
+ *
1373
+ * __URL:__
1374
+ *
1375
+ * `GET https://api.twitch.tv/helix/chat/emotes/user`
1376
+ *
1377
+ * __Response Codes:__
1378
+ *
1379
+ * _200 OK_
1380
+ *
1381
+ * Successfully retrieved the emotes.
1382
+ *
1383
+ * _400 Bad Request_
1384
+ *
1385
+ * * The _user\_id_ query parameter is required.
1386
+ * * The ID in the _user\_id_ query parameter is not valid.
1387
+ *
1388
+ * _401 Unauthorized_
1389
+ *
1390
+ * * The ID in _user\_id_ must match the user ID in the user access token.
1391
+ * * The Authorization header is required and must contain a user access token.
1392
+ * * The user access token must include the **user:read:emotes** scope.
1393
+ * * The access token is not valid.
1394
+ * * The client ID specified in the Client-Id header does not match the client ID specified in the access token.
1395
+ *
1396
+ * @see https://dev.twitch.tv/docs/api/reference#get-user-emotes
1397
+ */
1398
+ getUserEmotes: async (params, options = {}) => this.callApi({
1399
+ path: "/chat/emotes/user",
1400
+ params,
1401
+ options
1402
+ }),
1358
1403
  /**
1359
1404
  * Sends an announcement to the broadcaster’s chat room.
1360
1405
  *
@@ -1931,6 +1976,8 @@ var TwitchApi = class {
1931
1976
  /**
1932
1977
  * Gets an organization’s list of entitlements that have been granted to a game, a user, or both.
1933
1978
  *
1979
+ * **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.
1980
+ *
1934
1981
  * The following table identifies the request parameters that you may specify based on the type of access token used.
1935
1982
  *
1936
1983
  * | Access token type | Parameter | Description |
@@ -2644,7 +2691,7 @@ var TwitchApi = class {
2644
2691
  *
2645
2692
  * __Authorization:__
2646
2693
  *
2647
- * If you use [webhooks to receive events](https://dev.twitch.tv/docs/eventsub/handling-webhook-events), the request must specify an app access token. The request will fail if you use a user access token.
2694
+ * 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.
2648
2695
  *
2649
2696
  * 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.
2650
2697
  *
@@ -3625,6 +3672,95 @@ var TwitchApi = class {
3625
3672
  params,
3626
3673
  options
3627
3674
  }),
3675
+ /**
3676
+ * BETA Gets a list of unban requests for a broadcaster’s channel.
3677
+ *
3678
+ * __Authorization:__
3679
+ *
3680
+ * * Requires a user access token that includes the **moderator:read:unban\_requests** or **moderator:manage:unban\_requests** scope.
3681
+ * * Query parameter `moderator_id` must match the `user_id` in the [user access token](https://dev.twitch.tv/docs/authentication/#user-access-tokens).
3682
+ *
3683
+ * __URL:__
3684
+ *
3685
+ * `GET https://api.twitch.tv/helix/moderation/unban_requests`
3686
+ *
3687
+ * __Response Codes:__
3688
+ *
3689
+ * _200 OK_
3690
+ *
3691
+ * Successfully retrieved the list of unban requests.
3692
+ *
3693
+ * _400 Bad Request_
3694
+ *
3695
+ * * The _broadcaster\_id_ query parameter is required.
3696
+ * * The ID in the _broadcaster\_id_ query parameter is not valid.
3697
+ * * The _moderator\_id_ query parameter is required.
3698
+ * * The ID in the _moderator\_id_ query parameter is not valid.
3699
+ * * The pagination cursor is not valid.
3700
+ *
3701
+ * _401 Unauthorized_
3702
+ *
3703
+ * * The ID in _moderator\_id_ must match the user ID in the user access token.
3704
+ * * The Authorization header is required and must contain a user access token.
3705
+ * * The user access token must include the **moderator:read:unban\_requests** or **moderator:manage:unban\_requests** scope.
3706
+ * * The access token is not valid.
3707
+ * * The client ID specified in the Client-Id header does not match the client ID specified in the access token.
3708
+ *
3709
+ * @see https://dev.twitch.tv/docs/api/reference#get-unban-requests
3710
+ */
3711
+ getUnbanRequests: async (params, options = {}) => this.callApi({
3712
+ path: "/moderation/unban_requests",
3713
+ params,
3714
+ options
3715
+ }),
3716
+ /**
3717
+ * BETA Resolves an unban request by approving or denying it.
3718
+ *
3719
+ * __Authorization:__
3720
+ *
3721
+ * * Requires a user access token that includes the **moderator:manage:unban\_requests** scope.
3722
+ * * Query parameter `moderator_id` must match the `user_id` in the [user access token](https://dev.twitch.tv/docs/authentication/#user-access-tokens).
3723
+ *
3724
+ * __URL:__
3725
+ *
3726
+ * `PATCH https://api.twitch.tv/helix/moderation/unban_requests`
3727
+ *
3728
+ * __Response Codes:__
3729
+ *
3730
+ * _200 OK_
3731
+ *
3732
+ * Successfully resolved the unban request.
3733
+ *
3734
+ * _400 Bad Request_
3735
+ *
3736
+ * * The _broadcaster\_id_ query parameter is required.
3737
+ * * The ID in the _broadcaster\_id_ query parameter is not valid.
3738
+ * * The _moderator\_id_ query parameter is required.
3739
+ * * The ID in the _moderator\_id_ query parameter is not valid.
3740
+ * * The pagination cursor is not valid.
3741
+ * * The broadcaster is not receiving unban requests
3742
+ * * Invalid requested update
3743
+ *
3744
+ * _401 Unauthorized_
3745
+ *
3746
+ * * The ID in _moderator\_id_ must match the user ID in the user access token.
3747
+ * * The Authorization header is required and must contain a user access token.
3748
+ * * The user access token must include the **moderator:manage:unban\_requests** scope.
3749
+ * * The access token is not valid.
3750
+ * * The client ID specified in the Client-Id header does not match the client ID specified in the access token.
3751
+ *
3752
+ * _404 Not Found_
3753
+ *
3754
+ * The unban request ID was not found.
3755
+ *
3756
+ * @see https://dev.twitch.tv/docs/api/reference#resolve-unban-requests
3757
+ */
3758
+ resolveUnbanRequests: async (params, options = {}) => this.callApi({
3759
+ path: "/moderation/unban_requests",
3760
+ method: "PATCH",
3761
+ params,
3762
+ options
3763
+ }),
3628
3764
  /**
3629
3765
  * 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.
3630
3766
  *
@@ -4235,7 +4371,7 @@ var TwitchApi = class {
4235
4371
  *
4236
4372
  * _200 OK_
4237
4373
  *
4238
- * Successfully retrieved the broadcaster’s polls.
4374
+ * Successfully retrieved the broadcaster's polls.
4239
4375
  *
4240
4376
  * _400 Bad Request_
4241
4377
  *