View Source MatrixAppService.Client (MatrixAppService v0.3.1)
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
Return a client for the application service.
Create a new alias for a Matrix room.
Create a Matrix room.
Get room ID and additional information, given a room's alias
Get the data on an account.
Get user profile.
Get a state event from a room.
Join a room.
Modify avatar url for the user.
Put the data on an account.
Modify display name for the user.
Send a redact event to a room.
Register a new Matrix user.
Search a Matrix user in the User Directory.
Send a message to a Matrix room.
Send a state event to a room.
Upload a file to the media repository.
Link to this section Types
@type client_options() :: {:base_url, String.t()} | create_options()
@type create_options() :: [ access_token: String.t() | nil, user_id: String.t() | nil, device_id: String.t() | nil, storage: Polyjuice.Client.Storage.t() | nil ]
Link to this section Functions
Return 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:
:base_url: homerver URL:acces_token: access token:device_id: device ID:user_id: user ID:storage: aPolyjuice.Client.Storage.t/0
Create a new alias for a Matrix room.
Arguments:
room_id: room IDroom_alias: room aliasclient_options: seeclient/1(optional)
Create a Matrix room.
Arguments:
options: seePolyjuice.Client.Room.create_room/2client_options: seeclient/1(optional)
Get room ID and additional information, given a room's alias
Arguments:
room_alias: the alias to look forclient_options: seeclient/1(optional)
Get the data on an account.
Arguments:
user_id: the ID of the user whose profile should be retrieved. If ommited, it defaults to the user_id represented by the clientevent_type: the type of event queriedclient_options: seeclient/1(optional)
Get user profile.
Arguments:
user_id: the ID of the user whose profile should be retrieved. If ommited, it defaults to the user_id represented by the clientclient_options: seeclient/1(optional)
get_state(room_id, event_type \\ nil, state_key \\ "", client_options \\ [])
View SourceGet a state event from a room.
Arguments:
room_id: the ID of the user whose profile should be retrieved. If ommited, it defaults to the user_id represented by the client.event_type: the type of eventstate_key: the event state keyclient_options: seeclient/1(optional)
If event_type is not provided, returns a list of events.
If event_type and state_key are provided, returns an event content.
state_key can be omitted but this will return events that have a blank state
key, not events that have "any state key".
Join a room.
Arguments:
room_id: the room IDclient_options: seeclient/1(optional)
Modify avatar url for the user.
Arguments:
user_id: the ID of the user whose profile should be retrieved. If ommited, it defaults to the user_id represented by the clientavatar_url: anmxc:URL specifying the location of the new profileclient_options: seeclient/1(optional)
Put the data on an account.
Arguments:
user_id: the ID of the user whose profile should be retrieved. If ommited, it defaults to the user_id represented by the clientevent_type: the type of event querieddata: the new dataclient_options: seeclient/1(optional)
Modify display name for the user.
Arguments:
user_id: the ID of the user whose profile should be retrieved. If ommited, it defaults to the user_id represented by the clientdisplayname: the new displaynameclient_options: seeclient/1(optional)
redact_message(room_id, event, reason \\ nil, client_options \\ [])
View SourceSend a redact event to a room.
Arguments:
room_id: the ID of the user whose profile should be retrieved. If ommited, it defaults to the user_id represented by the client.event: the redact eventreason: the reason (optional)client_options: seeclient/1(optional)
Register a new Matrix user.
Arguments:
options: 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"
client_options: seeclient/1(optional)
Search a Matrix user in the User Directory.
Arguments:
search_term: the search term for the userlimit: a search limit number, defaults tofalse(unlimited)client_options: seeclient/1(optional)
Send a message to a Matrix room.
Arguments:
room_id: room IDmsg: seePolyjuice.Client.Room.send_message/3client_options: seeclient/1(optional)
send_state_event(room_id, event_type, state_key, event_content, client_options \\ [])
View SourceSend a state event to a room.
Arguments:
room_id: the ID of the user whose profile should be retrieved. If ommited, it defaults to the user_id represented by the client.event_type: the type of eventstate_key: the event state keyevent_content: the event contentclient_options: seeclient/1(optional)
Upload a file to the media repository.
Arguments:
data:Polyjuice.Client.Media.upload/3options:Polyjuice.Client.Media.upload/3client_options: seeclient/1(optional)