Struct dementia::Homeserver [−][src]
pub struct Homeserver { /* fields omitted */ }
Represents a Matrix homeserver to which an access token has been created
Methods
impl Homeserver
[src]
impl Homeserver
pub fn new(server_url: &str) -> HomeserverBuilder<(), (), ()>
[src]
pub fn new(server_url: &str) -> HomeserverBuilder<(), (), ()>
Start creating a new Homeserver object
This does not create a stateful connection.
It only constructs a request
object and saves the URL of the Homeserver.
server_name
– The homeserver URL without trailing slash, e. g.https://matrix.org
access_token
– The access token
pub fn connect(server_url: &str, access_token: &str) -> Self
[src]
pub fn connect(server_url: &str, access_token: &str) -> Self
Create a new Homeserver object
This does not create a stateful connection.
It only constructs a request
object and saves the URL of the Homeserver.
server_name
– The homeserver URL without trailing slash, e. g.https://matrix.org
access_token
– The access token
pub fn login_and_connect(
server_url: &str,
username: &str,
password: &str
) -> Self
[src]
pub fn login_and_connect(
server_url: &str,
username: &str,
password: &str
) -> Self
Create a new Homeserver object from username an password combination
This does not create a stateful connection.
It only constructs a request
object and saves the URL of the Homeserver.
server_name
– The homeserver URL without trailing slash, e. g.https://matrix.org
username
– The username without homeserver part, e. g.bot
password
– The password
Panics
If the server does not support or allow simple username and password login, this function panics.
pub fn get_access_token(&self) -> String
[src]
pub fn get_access_token(&self) -> String
Returns the access token
This is especially usefull, if you authenticated via username and password and want to retrieve the access token for later use.
pub fn join_room(&self, room_name: String) -> Option<Room>
[src]
pub fn join_room(&self, room_name: String) -> Option<Room>
Creates a Matrix room object
This joins the room. If the room has already been joined, this function can be called anyway to only create the room object.
If the room cannot be joined, None
is returned
pub fn create_room(&self, room_name: String) -> Option<Room>
[src]
pub fn create_room(&self, room_name: String) -> Option<Room>
Creates a new Matrix room on the server and returns a Matrix room object
The room will be created with the preset public_chat
.
Thus, everyone can join the room.
If the room cannot be created or already exists, None
is returned.
pub fn get_invites(&mut self) -> Vec<String>
[src]
pub fn get_invites(&mut self) -> Vec<String>
Get all current invites from the server
Returns a list of all room, the bot has been invited to.
Auto Trait Implementations
impl !Send for Homeserver
impl !Send for Homeserver
impl !Sync for Homeserver
impl !Sync for Homeserver