|
59 | 59 | from .http import HTTPAsyncIterator
|
60 | 60 | from .models.clips import Clip
|
61 | 61 | from .models.entitlements import Entitlement, EntitlementStatus
|
62 |
| - from .models.eventsub_ import EventsubSubscriptions |
| 62 | + from .models.eventsub_ import EventsubSubscription, EventsubSubscriptions |
63 | 63 | from .models.search import SearchChannel
|
64 | 64 | from .models.streams import Stream, VideoMarkers
|
65 | 65 | from .models.videos import Video
|
@@ -2502,6 +2502,44 @@ async def fetch_eventsub_subscriptions(
|
2502 | 2502 | status=status,
|
2503 | 2503 | )
|
2504 | 2504 |
|
| 2505 | + async def fetch_eventsub_subscription( |
| 2506 | + self, |
| 2507 | + subscription_id: str, |
| 2508 | + *, |
| 2509 | + token_for: str | PartialUser | None = None, |
| 2510 | + ) -> EventsubSubscription | None: |
| 2511 | + """|coro| |
| 2512 | +
|
| 2513 | + Fetches a specific Eventsub Subscription for either webhook or websocket. |
| 2514 | +
|
| 2515 | + .. note:: |
| 2516 | + 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. |
| 2517 | +
|
| 2518 | + Parameters |
| 2519 | + ----------- |
| 2520 | + subscription_id: str |
| 2521 | + The specific subscription ID to fetch. |
| 2522 | + token_for: str | PartialUser | None |
| 2523 | + By default, if this is ignored or set to None then the App Token is used. This is the case when you want to fetch webhook events. |
| 2524 | +
|
| 2525 | + Provide a user ID here for when you want to fetch websocket events tied to a user. |
| 2526 | +
|
| 2527 | + Returns |
| 2528 | + -------- |
| 2529 | + EventsubSubscription |
| 2530 | + """ |
| 2531 | + |
| 2532 | + data = await self._http.get_eventsub_subscription( |
| 2533 | + type=None, |
| 2534 | + max_results=None, |
| 2535 | + token_for=token_for, |
| 2536 | + subscription_id=subscription_id, |
| 2537 | + user_id=None, |
| 2538 | + status=None, |
| 2539 | + ) |
| 2540 | + sub = await data.subscriptions |
| 2541 | + return sub[0] if sub else None |
| 2542 | + |
2505 | 2543 | async def delete_eventsub_subscription(self, id: str, *, token_for: str | PartialUser | None = None) -> None:
|
2506 | 2544 | """|coro|
|
2507 | 2545 |
|
|
0 commit comments