Polyjuice Client v0.1.0 Polyjuice.Client View Source

Matrix client functions.

Link to this section Summary

Functions

The r0 client URL prefix

The unstable client URL prefix

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 Types

Link to this type

t()

View Source
t() :: %Polyjuice.Client{access_token: String.t(), base_url: String.t()}

Link to this section Functions

The r0 client URL prefix

The unstable client URL prefix

Link to this function

send_event(client_api, event_type, event, room)

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

Send an event to a room.

Link to this function

send_message(client_api, msg, room)

View Source
send_message(
  client_api :: Polyjuice.Client.API.t(),
  msg :: map() | Polyjuice.Client.MsgBuilder.MsgData.t(),
  room :: String.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.send_message(client, "text message", "!room_id")

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

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

Polyjuice.Client.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.