Polyjuice Client v0.4.4 Polyjuice.Client.API protocol View Source

Protocol for calling the Matrix client API.

Link to this section Summary

Functions

Call a Matrix client API.

Get the client's user and device IDs.

Execute a function in a queue for a room.

Generate a unique transaction ID.

Link to this section Types

Link to this section Functions

Link to this function

call(client_api, endpoint)

View Source
call(client_api :: t(), endpoint :: Polyjuice.Client.Endpoint.Proto.t()) ::
  any()

Call a Matrix client API.

This is a lower-level function; generally, clients will want to call one of the higher-level functions from Polyjuice.Client or one of its submodules.

Link to this function

get_user_and_device(client_api)

View Source
get_user_and_device(client_api :: t()) ::
  {String.t() | nil, String.t() | nil}

Get the client's user and device IDs.

Link to this function

room_queue(client_api, room_id, func)

View Source
room_queue(client_api :: t(), room_id :: String.t(), func :: function()) ::
  any()

Execute a function in a queue for a room.

This is to make sure that, for example, messages are sent in order.

Link to this function

stop(client_api, reason \\ :normal, timeout \\ :infinity)

View Source
stop(Polyjuice.Client.t(), reason :: term(), timeout()) :: :ok

Stop the client.

Link to this function

transaction_id(client_api)

View Source
transaction_id(client_api :: t()) :: String.t()

Generate a unique transaction ID.