From a7da00d4f74b0c614971da0978a0f0d6c316fa8b Mon Sep 17 00:00:00 2001 From: Matt C <96466754+buffless-matt@users.noreply.github.com> Date: Fri, 27 May 2022 20:25:57 +1000 Subject: Add storage and module API methods to get monthly active users and their appservices (#12838) --- synapse/module_api/__init__.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) (limited to 'synapse/module_api') diff --git a/synapse/module_api/__init__.py b/synapse/module_api/__init__.py index 95f3b27927..edcf59aa0b 100644 --- a/synapse/module_api/__init__.py +++ b/synapse/module_api/__init__.py @@ -1429,6 +1429,26 @@ class ModuleApi: user_id, spec, {"actions": actions} ) + async def get_monthly_active_users_by_service( + self, start_timestamp: Optional[int] = None, end_timestamp: Optional[int] = None + ) -> List[Tuple[str, str]]: + """Generates list of monthly active users and their services. + Please see corresponding storage docstring for more details. + + Arguments: + start_timestamp: If specified, only include users that were first active + at or after this point + end_timestamp: If specified, only include users that were first active + at or before this point + + Returns: + A list of tuples (appservice_id, user_id) + + """ + return await self._store.get_monthly_active_users_by_service( + start_timestamp, end_timestamp + ) + class PublicRoomListManager: """Contains methods for adding to, removing from and querying whether a room -- cgit 1.5.1