コード例 #1
0
ファイル: send_event.py プロジェクト: samuelyi/synapse
    async def _serialize_payload(  # type: ignore[override]
        event_id: str,
        store: "DataStore",
        event: EventBase,
        context: EventContext,
        requester: Requester,
        ratelimit: bool,
        extra_users: List[UserID],
    ) -> JsonDict:
        """
        Args:
            event_id
            store
            requester
            event
            context
            ratelimit
            extra_users: Any extra users to notify about event
        """
        serialized_context = await context.serialize(event, store)

        payload = {
            "event": event.get_pdu_json(),
            "room_version": event.room_version.identifier,
            "event_format_version": event.format_version,
            "internal_metadata": event.internal_metadata.get_dict(),
            "outlier": event.internal_metadata.is_outlier(),
            "rejected_reason": event.rejected_reason,
            "context": serialized_context,
            "requester": requester.serialize(),
            "ratelimit": ratelimit,
            "extra_users": [u.to_string() for u in extra_users],
        }

        return payload
コード例 #2
0
 async def _serialize_payload(  # type: ignore
     knock_event_id: str,
     txn_id: Optional[str],
     requester: Requester,
     content: JsonDict,
 ):
     """
     Args:
         knock_event_id: The ID of the knock to be rescinded.
         txn_id: An optional transaction ID supplied by the client.
         requester: The user making the rescind request, according to the access token.
         content: The content to include in the rescind event.
     """
     return {
         "txn_id": txn_id,
         "requester": requester.serialize(),
         "content": content,
     }
コード例 #3
0
ファイル: membership.py プロジェクト: waylon531/synapse
 async def _serialize_payload(  # type: ignore
     invite_event_id: str,
     txn_id: Optional[str],
     requester: Requester,
     content: JsonDict,
 ):
     """
     Args:
         invite_event_id: ID of the invite to be rejected
         txn_id: optional transaction ID supplied by the client
         requester: user making the rejection request, according to the access token
         content: additional content to include in the rejection event.
            Normally an empty dict.
     """
     return {
         "txn_id": txn_id,
         "requester": requester.serialize(),
         "content": content,
     }
コード例 #4
0
 async def _serialize_payload(  # type: ignore
     requester: Requester,
     room_id: str,
     user_id: str,
     remote_room_hosts: List[str],
     content: JsonDict,
 ):
     """
     Args:
         requester: The user making the request, according to the access token.
         room_id: The ID of the room to knock on.
         user_id: The ID of the knocking user.
         remote_room_hosts: Servers to try and send the knock via.
         content: The event content to use for the knock event.
     """
     return {
         "requester": requester.serialize(),
         "remote_room_hosts": remote_room_hosts,
         "content": content,
     }
コード例 #5
0
    async def _serialize_payload(  # type: ignore[override]
        invite_event_id: str,
        txn_id: Optional[str],
        requester: Requester,
        content: JsonDict,
    ) -> JsonDict:
        """
        Args:
            invite_event_id: The ID of the invite to be rejected.
            txn_id: Optional transaction ID supplied by the client
            requester: User making the rejection request, according to the access token
            content: Additional content to include in the rejection event.
               Normally an empty dict.

        Returns:
            A dict representing the payload of the request.
        """
        return {
            "txn_id": txn_id,
            "requester": requester.serialize(),
            "content": content,
        }
コード例 #6
0
    async def _serialize_payload(  # type: ignore
        requester: Requester,
        room_id: str,
        user_id: str,
        remote_room_hosts: List[str],
        content: JsonDict,
    ) -> JsonDict:
        """
        Args:
            requester: The user making the request according to the access token
            room_id: The ID of the room.
            user_id: The ID of the user.
            remote_room_hosts: Servers to try and join via
            content: The event content to use for the join event

        Returns:
            A dict representing the payload of the request.
        """
        return {
            "requester": requester.serialize(),
            "remote_room_hosts": remote_room_hosts,
            "content": content,
        }