Struct glitch_in_the_matrix::MatrixClient
[−]
[src]
pub struct MatrixClient { /* fields omitted */ }
A connection to a Matrix homeserver.
Methods
impl MatrixClient
[src]
fn login(username: &str, password: &str, url: &str) -> MatrixResult<Self>
Log in to a Matrix homeserver, and return a client object.
fn join(&mut self, roomid: &str) -> MatrixResult<JoinReply>
Join a room by identifier or alias.
fn update_presence(&mut self, p: Presence) -> MatrixResult<()>
Update our presence status.
fn read_receipt(&mut self, roomid: &str, eventid: &str) -> MatrixResult<()>
Send a read receipt for a given event ID.
fn send(&mut self, roomid: &str, msg: Message) -> MatrixResult<SendReply>
Send a message to a room ID.
fn send_simple<T: Into<String>>(
&mut self,
roomid: &str,
msg: T
) -> MatrixResult<SendReply>
&mut self,
roomid: &str,
msg: T
) -> MatrixResult<SendReply>
Wrapper function that sends a Message::Notice
with the specified unformatted text
to the given room ID. Provided for convenience purposes.
fn send_html<T: Into<String>, U: Into<Option<String>>>(
&mut self,
roomid: &str,
msg: T,
unformatted: U
) -> MatrixResult<SendReply>
&mut self,
roomid: &str,
msg: T,
unformatted: U
) -> MatrixResult<SendReply>
Wrapper function that sends a Message::Notice
with the specified HTML-formatted text
(and accompanying unformatted text, if given) to the given room ID.
fn upload<T: Read>(
&mut self,
data: &mut T,
ct: ContentType
) -> MatrixResult<UploadReply>
&mut self,
data: &mut T,
ct: ContentType
) -> MatrixResult<UploadReply>
fn user_id(&self) -> &str
Get the client's MXID.
fn set_set_presence(&mut self, v: bool)
Set whether polling the sync
API marks us as online.
fn set_presence(&self) -> bool
Ascertain whether polling the sync
API marks us as online.
fn sync(&mut self, timeout: u64) -> MatrixResult<SyncReply>
Poll the Matrix server for new events since the last call to sync()
.
It is recommended to call this in a loop. The Matrix server will block until new events arrive, up to a given timeout value.
fn req(
&mut self,
meth: Method,
endpoint: &str,
params: Vec<String>
) -> RequestBuilder
&mut self,
meth: Method,
endpoint: &str,
params: Vec<String>
) -> RequestBuilder
Make an arbitrary HTTP request to the Matrix API.
/_matrix/client/r0
is filled in for you, so yourendpoint
is something like/sync
.params
is a list ofkey=value
HTTP parameters, liketimeout=30
.
Returns a RequestBuilder
which you can use for your own nefarious ends.
Trait Implementations
impl Drop for MatrixClient
[src]
fn drop(&mut self)
Invalidates our access token, so we don't have millions of devices. Also sets us as offline.