Skip to content

Commit 8772b61

Browse files
committed
Add new subscription_id param to fetch_eventsub_subs
1 parent 4e01613 commit 8772b61

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed

twitchio/client.py

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2336,6 +2336,7 @@ async def fetch_eventsub_subscriptions(
23362336
token_for: str | PartialUser | None = None,
23372337
type: str | None = None,
23382338
user_id: str | PartialUser | None = None,
2339+
subscription_id: str | None = None,
23392340
status: Literal[
23402341
"enabled",
23412342
"webhook_callback_verification_pending",
@@ -2362,7 +2363,7 @@ async def fetch_eventsub_subscriptions(
23622363
Fetches Eventsub Subscriptions for either webhook or websocket.
23632364
23642365
.. note::
2365-
type, status and user_id are mutually exclusive and only one can be passed, otherwise ValueError will be raised.
2366+
type, status, user_id, and subscription_id are mutually exclusive and only one can be passed, otherwise ValueError will be raised.
23662367
23672368
This endpoint returns disabled WebSocket subscriptions for a minimum of 1 minute as compared to webhooks which returns disabled subscriptions for a minimum of 10 days.
23682369
@@ -2376,6 +2377,8 @@ async def fetch_eventsub_subscriptions(
23762377
Filter subscriptions by subscription type. e.g. ``channel.follow`` For a list of subscription types, see `Subscription Types <https://dev.twitch.tv/docs/eventsub/eventsub-subscription-types/#subscription-types>`_.
23772378
user_id: str | PartialUser | None
23782379
Filter subscriptions by user ID, or PartialUser. The response contains subscriptions where this ID matches a user ID that you specified in the Condition object when you created the subscription.
2380+
subscription_id: str | None
2381+
The specific subscription ID to fetch.
23792382
status: str | None = None
23802383
Filter subscriptions by its status. Possible values are:
23812384
@@ -2430,17 +2433,20 @@ async def fetch_eventsub_subscriptions(
24302433
Raises
24312434
------
24322435
ValueError
2433-
Only one of 'status', 'user_id', or 'type' can be provided.
2436+
Only one of 'status', 'user_id', 'subscription_id', or 'type' can be provided.
24342437
"""
24352438

2436-
provided: int = len([v for v in (type, user_id, status) if v])
2439+
provided: int = len([v for v in (type, user_id, status, subscription_id) if v])
24372440
if provided > 1:
2438-
raise ValueError("Only one of 'status', 'user_id', or 'type' can be provided.")
2441+
raise ValueError("Only one of 'status', 'user_id', 'subscription_id', or 'type' can be provided.")
24392442

24402443
return await self._http.get_eventsub_subscription(
24412444
type=type,
24422445
max_results=max_results,
24432446
token_for=token_for,
2447+
subscription_id=subscription_id,
2448+
user_id=user_id,
2449+
status=status,
24442450
)
24452451

24462452
async def delete_eventsub_subscription(self, id: str, *, token_for: str | PartialUser | None = None) -> None:

twitchio/http.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1486,6 +1486,7 @@ async def get_eventsub_subscription(
14861486
]
14871487
| None = None,
14881488
user_id: str | PartialUser | None = None,
1489+
subscription_id: str | None = None,
14891490
type: str | None = None,
14901491
max_results: int | None = None,
14911492
token_for: str | PartialUser | None = None,
@@ -1498,6 +1499,8 @@ async def get_eventsub_subscription(
14981499
params["status"] = status
14991500
if user_id is not None:
15001501
params["user_id"] = str(user_id)
1502+
if subscription_id is not None:
1503+
params["subscription_id"] = subscription_id
15011504

15021505
route: Route = Route("GET", "eventsub/subscriptions", params=params, token_for=token_for)
15031506

0 commit comments

Comments
 (0)