You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

56 lines
1.7 KiB

  1. # Copyright 2014-2016 OpenMarket Ltd
  2. # Copyright 2018 New Vector Ltd
  3. #
  4. # Licensed under the Apache License, Version 2.0 (the "License");
  5. # you may not use this file except in compliance with the License.
  6. # You may obtain a copy of the License at
  7. #
  8. # http://www.apache.org/licenses/LICENSE-2.0
  9. #
  10. # Unless required by applicable law or agreed to in writing, software
  11. # distributed under the License is distributed on an "AS IS" BASIS,
  12. # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13. # See the License for the specific language governing permissions and
  14. # limitations under the License.
  15. import logging
  16. from typing import List, Optional, Tuple
  17. import attr
  18. from synapse.types import PersistedEventPosition
  19. logger = logging.getLogger(__name__)
  20. @attr.s(slots=True, frozen=True, weakref_slot=False, auto_attribs=True)
  21. class RoomsForUser:
  22. room_id: str
  23. sender: str
  24. membership: str
  25. event_id: str
  26. stream_ordering: int
  27. room_version_id: str
  28. @attr.s(slots=True, frozen=True, weakref_slot=False, auto_attribs=True)
  29. class GetRoomsForUserWithStreamOrdering:
  30. room_id: str
  31. event_pos: PersistedEventPosition
  32. @attr.s(slots=True, frozen=True, weakref_slot=False, auto_attribs=True)
  33. class ProfileInfo:
  34. avatar_url: Optional[str]
  35. display_name: Optional[str]
  36. # TODO This is used as a cached value and is mutable.
  37. @attr.s(slots=True, frozen=True, weakref_slot=False, auto_attribs=True)
  38. class MemberSummary:
  39. # A truncated list of (user_id, event_id) tuples for users of a given
  40. # membership type, suitable for use in calculating heroes for a room.
  41. members: List[Tuple[str, str]]
  42. # The total number of users of a given membership type.
  43. count: int