File tree Expand file tree Collapse file tree 3 files changed +20
-18
lines changed Expand file tree Collapse file tree 3 files changed +20
-18
lines changed Original file line number Diff line number Diff line change 6464 from .models .streams import Stream , VideoMarkers
6565 from .models .videos import Video
6666 from .types_ .eventsub import SubscriptionCreateTransport , SubscriptionResponse , _SubscriptionData
67- from .types_ .options import AdapterOT , ClientOptions , WaitPredicateT
67+ from .types_ .options import ClientOptions , WaitPredicateT
6868 from .types_ .tokens import TokenMappingData
6969
7070
@@ -134,7 +134,7 @@ def __init__(
134134 scopes = scopes ,
135135 session = session ,
136136 )
137- adapter : AdapterOT = options .get ("adapter" , AiohttpAdapter )
137+ adapter : BaseAdapter | type [ BaseAdapter ] = options .get ("adapter" , AiohttpAdapter )
138138 if isinstance (adapter , BaseAdapter ):
139139 adapter .client = self
140140 self ._adapter = adapter
Original file line number Diff line number Diff line change 2323"""
2424
2525from collections .abc import Callable , Coroutine
26- from typing import Any , NotRequired , TypeAlias , TypedDict
26+ from typing import Any , NotRequired , TypedDict
2727
2828import aiohttp
2929
3030from ..authentication import Scopes
31- from ..web import AiohttpAdapter
32-
33- try :
34- from ..web import StarletteAdapter as StarletteAdapter
35-
36- has_starlette = True
37- except ImportError :
38- has_starlette = False
39-
40-
41- if has_starlette :
42- AdapterOT : TypeAlias = type [StarletteAdapter | AiohttpAdapter ] | StarletteAdapter | AiohttpAdapter # type: ignore
43- else :
44- AdapterOT : TypeAlias = type [AiohttpAdapter ] | AiohttpAdapter # type: ignore
31+ from ..web .utils import BaseAdapter
4532
4633
4734class ClientOptions (TypedDict , total = False ):
4835 redirect_uri : str | None
4936 scopes : Scopes | None
5037 session : aiohttp .ClientSession | None
51- adapter : NotRequired [AdapterOT ] # type: ignore
38+ adapter : NotRequired [BaseAdapter ]
5239
5340
5441WaitPredicateT = Callable [..., Coroutine [Any , Any , bool ]]
Original file line number Diff line number Diff line change 3434
3535
3636if TYPE_CHECKING :
37+ import asyncio
38+
3739 from starlette .requests import Request
3840
41+ from ..client import Client
3942 from ..types_ .eventsub import EventSubHeaders
4043
4144
4649
4750
4851class BaseAdapter (abc .ABC ):
52+ client : Client
53+ _runner_task : asyncio .Task [None ] | None
54+ _eventsub_secret : str | None
55+
4956 @abc .abstractmethod
5057 async def event_startup (self ) -> None : ...
5158
@@ -70,6 +77,14 @@ async def oauth_callback(self, request: Any) -> Any: ...
7077 @abc .abstractmethod
7178 async def oauth_redirect (self , request : Any ) -> Any : ...
7279
80+ @property
81+ @abc .abstractmethod
82+ def eventsub_url (self ) -> str : ...
83+
84+ @property
85+ @abc .abstractmethod
86+ def redirect_url (self ) -> str : ...
87+
7388
7489async def verify_message (* , request : Request | web .Request , secret : str ) -> bytes :
7590 body : bytes
You can’t perform that action at this time.
0 commit comments