mirror of
https://github.com/element-hq/synapse.git
synced 2026-10-26 06:03:11 +00:00
Add field-level doc comments to SerializeEventConfig
This commit is contained in:
1 parent
a3c430256d
commit
d6110fa064
2 files changed
+49
-7
No files matched your search
@@ -99,12 +99,30 @@ pub enum EventFormat {
|
||||
#[pyclass(frozen, skip_from_py_object)]
|
||||
#[derive(Clone)]
|
||||
pub struct SerializeEventConfig {
|
||||
/// Whether to apply the client event format transform (v1/v2/raw). When
|
||||
/// `false`, the federation-format event is returned as-is.
|
||||
as_client_event: bool,
|
||||
/// Which client event format variant to apply (only used when
|
||||
/// `as_client_event` is `true`).
|
||||
event_format: EventFormat,
|
||||
/// The entity requesting the event. Used to gate sender-only fields such as
|
||||
/// `transaction_id` and `delay_id`.
|
||||
requester: Option<Requester>,
|
||||
/// If set, only include these field paths in the output. An empty list
|
||||
/// returns an empty event; `None` returns all fields.
|
||||
///
|
||||
/// The fields can be "dotted" fields, e.g. `content.body`.
|
||||
event_field_allowlist: Option<Vec<String>>,
|
||||
/// Whether to include `invite_room_state` / `knock_room_state` in
|
||||
/// `unsigned`. These are stripped by default and only included for specific
|
||||
/// endpoints (e.g. `/sync` invite/knock handling).
|
||||
include_stripped_room_state: bool,
|
||||
/// When `true`, add server-admin-only metadata to `unsigned`
|
||||
/// (`io.element.synapse.soft_failed`,
|
||||
/// `io.element.synapse.policy_server_spammy`).
|
||||
include_admin_metadata: bool,
|
||||
/// Whether MSC4354 (sticky events) is enabled. When `true`, the remaining
|
||||
/// stickiness TTL is computed and added to `unsigned`.
|
||||
msc4354_enabled: bool,
|
||||
}
|
||||
|
||||
|
||||
@@ -373,19 +373,43 @@ class SerializeEventConfig:
|
||||
msc4354_enabled: bool = False,
|
||||
) -> None: ...
|
||||
@property
|
||||
def as_client_event(self) -> bool: ...
|
||||
def as_client_event(self) -> bool:
|
||||
"""Whether to apply the client event format transform (v1/v2/raw). When
|
||||
``False``, the federation-format event is returned as-is."""
|
||||
|
||||
@property
|
||||
def event_format(self) -> EventFormat: ...
|
||||
def event_format(self) -> EventFormat:
|
||||
"""Which client event format variant to apply (only used when
|
||||
``as_client_event`` is ``True``)."""
|
||||
|
||||
@property
|
||||
def requester(self) -> Requester | None: ...
|
||||
def requester(self) -> Requester | None:
|
||||
"""The entity requesting the event. Used to gate sender-only fields such
|
||||
as ``transaction_id`` and ``delay_id``."""
|
||||
|
||||
@property
|
||||
def event_field_allowlist(self) -> list[str] | None: ...
|
||||
def event_field_allowlist(self) -> list[str] | None:
|
||||
"""If set, only include these field paths in the output. An empty list
|
||||
returns an empty event; ``None`` returns all fields.
|
||||
|
||||
The fields can be "dotted" fields, e.g. ``content.body``."""
|
||||
|
||||
@property
|
||||
def include_stripped_room_state(self) -> bool: ...
|
||||
def include_stripped_room_state(self) -> bool:
|
||||
"""Whether to include ``invite_room_state`` / ``knock_room_state`` in
|
||||
``unsigned``. These are stripped by default and only included for
|
||||
specific endpoints (e.g. ``/sync`` invite/knock handling)."""
|
||||
|
||||
@property
|
||||
def include_admin_metadata(self) -> bool: ...
|
||||
def include_admin_metadata(self) -> bool:
|
||||
"""When ``True``, add server-admin-only metadata to ``unsigned``
|
||||
(``io.element.synapse.soft_failed``,
|
||||
``io.element.synapse.policy_server_spammy``)."""
|
||||
|
||||
@property
|
||||
def msc4354_enabled(self) -> bool: ...
|
||||
def msc4354_enabled(self) -> bool:
|
||||
"""Whether MSC4354 (sticky events) is enabled. When ``True``, the
|
||||
remaining stickiness TTL is computed and added to ``unsigned``."""
|
||||
def for_admin(self) -> SerializeEventConfig:
|
||||
"""Return a copy of this config with ``include_admin_metadata`` enabled."""
|
||||
|
||||
|
||||
Reference in new issue
Block a user