Polyjuice Client v0.2.1 Polyjuice.Client.Room View Source

Room-related functions.

Link to this section Summary

Functions

Send a message to a room.

Update the client's read receipt (of the given type) to the given message in the given room.

Link to this section Functions

Link to this function

join(client_api, room, servers \\ [], third_party_signed \\ nil)

View Source
join(
  client_api :: Polyjuice.Client.API.t(),
  room :: String.t(),
  servers :: [String.t()],
  third_party_join :: map() | nil
) :: Any

Join a room.

Link to this function

send_event(client_api, room, event_type, event)

View Source
send_event(
  client_api :: Polyjuice.Client.API.t(),
  room :: String.t(),
  event_type :: String.t(),
  event :: map()
) :: String.t()

Send an event to a room.

Link to this function

send_message(client_api, room, msg)

View Source
send_message(
  client_api :: Polyjuice.Client.API.t(),
  room :: String.t(),
  msg :: map() | Polyjuice.Client.MsgBuilder.MsgData.t()
) :: String.t()

Send a message to a room.

msg can either be anything that implements the Polyjuice.Client.MsgBuilder.MsgData protocol (which will be sent as an m.message), or a map (which specifies the full message content).

Examples:

Polyjuice.Client.Room.send_message(client, "text message", "!room_id")

Polyjuice.Client.Room.send_message(
  client,
  {"message with formatting", "<i>message</i> with <b>formatting</b>"},
  "!room_id"
)

Polyjuice.Client.Room.send_message(
  client,
  ["Hello, ", Polyjuice.Client.MsgBuilder.mention("@world:example.com")],
  "!room_id"
)

Polyjuice.Client.Room.send_message(
  client,
  %{"msgtype" => "m.notice", "body" => "using full message content"},
  "!room_id"
)
Link to this function

update_read_receipt(client_api, room, event_id, receipt_type \\ "m.read")

View Source
update_read_receipt(
  client_api :: Polyjuice.Client.API.t(),
  room :: String.t(),
  event_id :: String.t(),
  receipt_type :: String.t()
) :: Any

Update the client's read receipt (of the given type) to the given message in the given room.