@@ -172,6 +172,33 @@ def __init__(
172172
173173 self .__waiter : asyncio .Event = asyncio .Event ()
174174
175+ @property
176+ def adapter (self ) -> BaseAdapter :
177+ """Property returning the :class:`~twitchio.AiohttpAdapter` or :class:`~twitchio.StarlettepAdapter` the bot is
178+ currently running."""
179+ return self ._adapter
180+
181+ async def set_adapter (self , adapter : BaseAdapter ) -> None :
182+ """|async|
183+
184+ Method which sets and starts a new web adapter which inherits from either :class:`~twitchio.AiohttpAdapter` or
185+ :class:`~twitchio.StarlettepAdapter` or implements the :class:`~twitchio.BaseAdapter` specifications.
186+
187+ Parameters
188+ ----------
189+ adapter: :class:`~twitchio.BaseAdapter`
190+ The new adapter to assign and start.
191+
192+ Returns
193+ -------
194+ None
195+ """
196+ if self ._adapter :
197+ await self ._adapter .close ()
198+
199+ self ._adapter = adapter
200+ await self ._adapter .run ()
201+
175202 @property
176203 def tokens (self ) -> MappingProxyType [str , TokenMappingData ]:
177204 """Property which returns a read-only mapping of the tokens that are managed by the `Client`.
@@ -1643,6 +1670,56 @@ async def fetch_users(
16431670 data = await self ._http .get_users (ids = ids , logins = logins , token_for = token_for )
16441671 return [User (d , http = self ._http ) for d in data ["data" ]]
16451672
1673+ async def fetch_user (
1674+ self ,
1675+ * ,
1676+ id : str | int | None = None ,
1677+ login : str | None = None ,
1678+ token_for : str | PartialUser | None = None ,
1679+ ) -> User | None :
1680+ """|coro|
1681+
1682+ Fetch information about one user.
1683+
1684+ .. note::
1685+
1686+ You may look up a specific user using their user ID or login name.
1687+
1688+ If you don't specify an ID or login name but provide the `token_for` parameter,
1689+ the request returns information about the user associated with the access token.
1690+
1691+ To include the user's verified email address in the response,
1692+ you must have a user access token that includes the `user:read:email` scope.
1693+
1694+ Parameters
1695+ ----------
1696+ id: str | int | None
1697+ The id of the user to fetch information about.
1698+ login: str | None
1699+ The login name of the user to fetch information about.
1700+ token_for: str | PartialUser | None
1701+ |token_for|
1702+
1703+ If this parameter is provided, the token must have the `user:read:email` scope
1704+ in order to request the user's verified email address.
1705+
1706+ Returns
1707+ -------
1708+ :class:`twitchio.User`
1709+ A :class:`twitchio.User` object.
1710+
1711+ Raises
1712+ ------
1713+ ValueError
1714+ Please provide only one of `id` or `login`.
1715+ """
1716+
1717+ if id is not None and login is not None :
1718+ raise ValueError ("Please provide only one of `id` or `login`." )
1719+
1720+ data = await self ._http .get_users (ids = id , logins = login , token_for = token_for )
1721+ return User (data ["data" ][0 ], http = self ._http ) if data ["data" ] else None
1722+
16461723 def search_categories (
16471724 self ,
16481725 query : str ,
@@ -2459,6 +2536,43 @@ async def fetch_eventsub_subscriptions(
24592536 status = status ,
24602537 )
24612538
2539+ async def fetch_eventsub_subscription (
2540+ self ,
2541+ subscription_id : str ,
2542+ * ,
2543+ token_for : str | PartialUser | None = None ,
2544+ ) -> EventsubSubscription | None :
2545+ """|coro|
2546+
2547+ Fetches a specific Eventsub Subscription for either webhook or websocket.
2548+
2549+ .. note::
2550+ 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.
2551+
2552+ Parameters
2553+ -----------
2554+ subscription_id: str
2555+ The specific subscription ID to fetch.
2556+ token_for: str | PartialUser | None
2557+ 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.
2558+
2559+ Provide a user ID here for when you want to fetch websocket events tied to a user.
2560+
2561+ Returns
2562+ --------
2563+ EventsubSubscription | None
2564+ """
2565+
2566+ data = await self ._http .get_eventsub_subscription (
2567+ type = None ,
2568+ max_results = None ,
2569+ token_for = token_for ,
2570+ subscription_id = subscription_id ,
2571+ user_id = None ,
2572+ status = None ,
2573+ )
2574+ return await anext (data .subscriptions , None )
2575+
24622576 async def delete_eventsub_subscription (self , id : str , * , token_for : str | PartialUser | None = None ) -> None :
24632577 """|coro|
24642578
0 commit comments