diff options
author | Patrick Cloke <clokep@users.noreply.github.com> | 2021-08-26 07:53:52 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-08-26 11:53:52 +0000 |
commit | 1aa0dad02187c3b972187f5952cfbce336b0ca5c (patch) | |
tree | 6c948ed89be836c765e27bf1a4c109d5df1426d2 /synapse/rest/client/notifications.py | |
parent | Cache the result of fetching the room hierarchy over federation. (#10647) (diff) | |
download | synapse-1aa0dad02187c3b972187f5952cfbce336b0ca5c.tar.xz |
Additional type hints for REST servlets (part 2). (#10674)
Applies the changes from #10665 to additional modules.
Diffstat (limited to 'synapse/rest/client/notifications.py')
-rw-r--r-- | synapse/rest/client/notifications.py | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/synapse/rest/client/notifications.py b/synapse/rest/client/notifications.py index 0ede643c2d..d1d8a984c6 100644 --- a/synapse/rest/client/notifications.py +++ b/synapse/rest/client/notifications.py @@ -13,26 +13,33 @@ # limitations under the License. import logging +from typing import TYPE_CHECKING, Tuple from synapse.events.utils import format_event_for_client_v2_without_room_id +from synapse.http.server import HttpServer from synapse.http.servlet import RestServlet, parse_integer, parse_string +from synapse.http.site import SynapseRequest +from synapse.types import JsonDict from ._base import client_patterns +if TYPE_CHECKING: + from synapse.server import HomeServer + logger = logging.getLogger(__name__) class NotificationsServlet(RestServlet): PATTERNS = client_patterns("/notifications$") - def __init__(self, hs): + def __init__(self, hs: "HomeServer"): super().__init__() self.store = hs.get_datastore() self.auth = hs.get_auth() self.clock = hs.get_clock() self._event_serializer = hs.get_event_client_serializer() - async def on_GET(self, request): + async def on_GET(self, request: SynapseRequest) -> Tuple[int, JsonDict]: requester = await self.auth.get_user_by_req(request) user_id = requester.user.to_string() @@ -87,5 +94,5 @@ class NotificationsServlet(RestServlet): return 200, {"notifications": returned_push_actions, "next_token": next_token} -def register_servlets(hs, http_server): +def register_servlets(hs: "HomeServer", http_server: HttpServer) -> None: NotificationsServlet(hs).register(http_server) |