MatrixSDK.Client.StateEvent (matrix_sdk v0.2.0) View Source

Convenience functions for building state events.

Link to this section Summary

Functions

Returns a StateEvent struct of type m.room.join_rules.

Returns a StateEvent struct of type m.room.topic.

Link to this section Types

Specs

t() :: %MatrixSDK.Client.StateEvent{
  content: term(),
  room_id: term(),
  state_key: term(),
  type: term()
}

Link to this section Functions

Link to this function

join_rules(room_id, body)

View Source

Specs

join_rules(binary(), binary()) :: t()

Returns a StateEvent struct of type m.room.join_rules.

Example

iex> MatrixSDK.Client.StateEvent.join_rules("!someroom:matrix.org", "public")
%MatrixSDK.Client.StateEvent{
  content: %{join_rule: "public"},
  type: "m.room.join_rules",
  room_id: "!someroom:matrix.org",
  state_key: ""
}

Specs

topic(binary(), binary()) :: t()

Returns a StateEvent struct of type m.room.topic.

Example

iex> MatrixSDK.Client.StateEvent.topic("!someroom:matrix.org", "Example room topic")
%MatrixSDK.Client.StateEvent{
  content: %{topic: "Example room topic"},
  type: "m.room.topic",
  room_id: "!someroom:matrix.org",
  state_key: ""
}