Operator
C++ library for plugging into matrix.org
|
low-level Client-Server API over HTTP. More...
#include <http_client.hh>
Public Member Functions | |
HTTPClientAPI (HTTP::Adapter &, const std::string &server) | |
void | versions (const callback_t< const std::vector< std::string > &> &callback) |
get the versions of the specification supported by the server. More... | |
void | login (const std::string &username, const std::string &password, const callback_t< const std::string &, const std::string &> &callback) |
log in using username and password More... | |
void | loginWith3PID (const std::string &medium, const std::string &address, const std::string &password, const callback_t< const std::string &, const std::string &> &) |
log in using third party ID and pasword. More... | |
void | loginWithToken (const std::string &token) |
log in with an access token that has previously been obtained. | |
void | registerAccount (const std::string &username, const std::string &password, const callback_t< std::string, std::string > &) |
register a new account. More... | |
void | logout (const callback_t<> &) |
log out. More... | |
bool | isLoggedIn () const |
determine if the client is currently logged in. | |
const std::string & | getToken () const |
return the access token for the client session. | |
void | sync (const std::string &since, const std::string &filter, bool full_state, std::string set_presence, size_t timeout, const callback_t< const std::string &, nlohmann::json, nlohmann::json > &) |
get events from the server. More... | |
void | roomMessages (const std::string &roomId, const std::string &from, const std::string &to, const std::string &dir, int limit, const callback_t< const std::string &, const std::string &, const std::vector< nlohmann::json > &> &) |
get messages/state events from a room. More... | |
void | sendMessage (const std::string &roomId, const std::string &eventType, const std::string &txnId, const nlohmann::json &content, const callback_t< const std::string &> &) |
send a message event to a room. More... | |
Protected Attributes | |
HTTP::Adapter & | adapter |
std::string | baseurl |
low-level Client-Server API over HTTP.
void HTTPClientAPI::login | ( | const std::string & | username, |
const std::string & | password, | ||
const callback_t< const std::string &, const std::string &> & | callback | ||
) |
log in using username and password
[in] | username | The username to log in as |
[in] | password | The password to use |
[out] | callback | The callback will receive the user's Matrix ID and the server name |
void HTTPClientAPI::loginWith3PID | ( | const std::string & | medium, |
const std::string & | address, | ||
const std::string & | password, | ||
const callback_t< const std::string &, const std::string &> & | callback | ||
) |
log in using third party ID and pasword.
void HTTPClientAPI::logout | ( | const callback_t<> & | callback | ) |
log out.
void Operator::Client::HTTPClientAPI::registerAccount | ( | const std::string & | username, |
const std::string & | password, | ||
const callback_t< std::string, std::string > & | |||
) |
register a new account.
void HTTPClientAPI::roomMessages | ( | const std::string & | roomId, |
const std::string & | from, | ||
const std::string & | to, | ||
const std::string & | dir, | ||
int | limit, | ||
const callback_t< const std::string &, const std::string &, const std::vector< nlohmann::json > &> & | callback | ||
) |
get messages/state events from a room.
void HTTPClientAPI::sendMessage | ( | const std::string & | roomId, |
const std::string & | eventType, | ||
const std::string & | txnId, | ||
const nlohmann::json & | content, | ||
const callback_t< const std::string &> & | callback | ||
) |
send a message event to a room.
void HTTPClientAPI::sync | ( | const std::string & | since, |
const std::string & | filter, | ||
bool | full_state, | ||
std::string | set_presence, | ||
size_t | timeout, | ||
const callback_t< const std::string &, nlohmann::json, nlohmann::json > & | |||
) |
get events from the server.
void HTTPClientAPI::versions | ( | const callback_t< const std::vector< std::string > &> & | callback | ) |
get the versions of the specification supported by the server.
[out] | callback | The callback will receive a vector of version strings. |