@@ -165,6 +165,20 @@ def encode_presence(self, events, filter, time_now):
165165 return {"events" : filter .filter_presence (formatted )}
166166
167167 def encode_joined (self , rooms , filter , time_now , token_id ):
168+ """
169+ Encode the joined rooms in a sync result
170+
171+ :param list[synapse.handlers.sync.JoinedSyncResult] rooms: list of sync
172+ results for rooms this user is joined to
173+ :param FilterCollection filter: filters to apply to the results
174+ :param int time_now: current time - used as a baseline for age
175+ calculations
176+ :param int token_id: ID of the user's auth token - used for namespacing
177+ of transaction IDs
178+
179+ :return: the joined rooms list, in our response format
180+ :rtype: dict[str, dict[str, object]]
181+ """
168182 joined = {}
169183 for room in rooms :
170184 joined [room .room_id ] = self .encode_room (
@@ -174,6 +188,20 @@ def encode_joined(self, rooms, filter, time_now, token_id):
174188 return joined
175189
176190 def encode_invited (self , rooms , filter , time_now , token_id ):
191+ """
192+ Encode the invited rooms in a sync result
193+
194+ :param list[synapse.handlers.sync.InvitedSyncResult] rooms: list of
195+ sync results for rooms this user is joined to
196+ :param FilterCollection filter: filters to apply to the results
197+ :param int time_now: current time - used as a baseline for age
198+ calculations
199+ :param int token_id: ID of the user's auth token - used for namespacing
200+ of transaction IDs
201+
202+ :return: the invited rooms list, in our response format
203+ :rtype: dict[str, dict[str, object]]
204+ """
177205 invited = {}
178206 for room in rooms :
179207 invite = serialize_event (
@@ -189,6 +217,20 @@ def encode_invited(self, rooms, filter, time_now, token_id):
189217 return invited
190218
191219 def encode_archived (self , rooms , filter , time_now , token_id ):
220+ """
221+ Encode the archived rooms in a sync result
222+
223+ :param list[synapse.handlers.sync.ArchivedSyncResult] rooms: list of
224+ sync results for rooms this user is joined to
225+ :param FilterCollection filter: filters to apply to the results
226+ :param int time_now: current time - used as a baseline for age
227+ calculations
228+ :param int token_id: ID of the user's auth token - used for namespacing
229+ of transaction IDs
230+
231+ :return: the invited rooms list, in our response format
232+ :rtype: dict[str, dict[str, object]]
233+ """
192234 joined = {}
193235 for room in rooms :
194236 joined [room .room_id ] = self .encode_room (
@@ -199,6 +241,20 @@ def encode_archived(self, rooms, filter, time_now, token_id):
199241
200242 @staticmethod
201243 def encode_room (room , filter , time_now , token_id , joined = True ):
244+ """
245+ :param JoinedSyncResult|ArchivedSyncResult room: sync result for a
246+ single room
247+ :param FilterCollection filter: filters to apply to the results
248+ :param int time_now: current time - used as a baseline for age
249+ calculations
250+ :param int token_id: ID of the user's auth token - used for namespacing
251+ of transaction IDs
252+ :param joined: True if the user is joined to this room - will mean
253+ we handle ephemeral events
254+
255+ :return: the room, encoded in our response format
256+ :rtype: dict[str, object]
257+ """
202258 event_map = {}
203259 state_events = filter .filter_room_state (room .state )
204260 state_event_ids = []
0 commit comments