MatrixAppService.Client (MatrixAppService v0.1.0) View Source

Convenience wrapper around Polyjuice.Client.LowLevel.

Library users can use the wrapped functions or call user/1 and pass the returned struct to Polyjuice functions.

Link to this section Summary

Functions

Returns a client for the application service.

Creates a new alias for a Matrix room.

Registers a new Matrix user.

Sends a message to a Matrix room.

Link to this section Types

Specs

client_options() ::
  {:base_url, String.t()} | MatrixAppService.Client.LowLevel.create_opts()

Link to this section Functions

Specs

client([client_options()]) :: Polyjuice.Client.LowLevel.t()

Returns a client for the application service.

By default, the client gets its homeserver URL and access token from configuration. Different options can be provided to override the defaults, those are:

Link to this function

create_alias(room_id, room_alias, client_options \\ [])

View Source

Specs

create_alias(String.t(), String.t(), client_options()) ::
  {:ok, String.t()} | Any

Creates a new alias for a Matrix room.

Arguments:

  1. room_id: room ID
  2. room_alias: room alias
  3. client_options: see client/1
Link to this function

create_room(options \\ [], client_options \\ [])

View Source

Creates a Matrix room.

Arguments:

  1. options: see Polyjuice.Client.Room.create_room/2
  2. client_options: see client/1
Link to this function

register(opts \\ [], client_options \\ [])

View Source

Specs

register(Polyjuice.Client.LowLevel.register_opts(), client_options()) ::
  {:ok, String.t()} | Any

Registers a new Matrix user.

Arguments:

  1. opts: a keyword list that can contain these keys:
    • :inhibit_login: true
    • :device_id: device ID, defaults to "APP_SERVICE"
    • :initial_device_display_name: device name, defaults to "ApplicationService"
    • :kind: kind of account to register, defaults to "user", can also be "guest"
  2. client_options: see client/1
Link to this function

send_message(room_id, msg, client_options \\ [])

View Source

Specs

send_message(String.t(), String.t(), client_options()) ::
  {:ok, String.t()} | Any

Sends a message to a Matrix room.

Arguments:

  1. room_id: room ID
  2. msg: see Polyjuice.Client.Room.send_message/3
  3. client_options: see client/1