20 #ifndef __OPERATOR_HTTPCLIENT_HH_ 21 #define __OPERATOR_HTTPCLIENT_HH_ 96 return !token.empty();
113 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> &> &);
123 mutable std::string token;
126 void handleLogout(std::unique_ptr<Error::Error>,
short code,
const HTTP::headers_t &, std::unique_ptr<std::istream>,
callback_t<>)
throw ();
142 client.loginWithToken(token);
157 void handleSync(std::shared_ptr<Error::Error>,
const std::string &, nlohmann::json, nlohmann::json)
throw ();
159 std::function<void (const Event::Event &)> trigger_ptr;
160 std::function<void (const std::string &, std::shared_ptr<Error::Error>,
const std::string &)> triggerError_ptr;
164 std::string next_batch;
165 unsigned int txn_counter;
171 #endif // __OPERATOR_HTTPCLIENT_HH_
void loginWithToken(const std::string &token)
log in with an access token that has previously been obtained.
Definition: http_client.cc:202
general "message" events (a.k.a. timeline events)
Definition: event.hh:115
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.
Definition: http_client.cc:129
void registerAccount(const std::string &username, const std::string &password, const callback_t< std::string, std::string > &)
register a new account.
void logout(const callback_t<> &)
log out.
Definition: http_client.cc:206
the client has logged in
Definition: event.hh:236
Matrix client interface for high-level API.This interface is implemented by the high-level API classe...
Definition: client.hh:41
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.
Definition: http_client.cc:313
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.
Definition: http_client.cc:398
HTTP adapter interface.
Definition: http.hh:48
bool isLoggedIn() const
determine if the client is currently logged in.
Definition: http_client.hh:148
bool isLoggedIn() const
determine if the client is currently logged in.
Definition: http_client.hh:95
std::vector< header_t > headers_t
list of HTTP headers.
Definition: http.hh:41
low-level Client-Server API over HTTP.
Definition: http_client.hh:55
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
Definition: http_client.cc:116
high-level Client-Server API over HTTP.
Definition: http_client.hh:131
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.
Definition: http_client.cc:470
const std::string & getToken() const
return the access token for the client session.
Definition: http_client.hh:101
void versions(const callback_t< const std::vector< std::string > &> &callback)
get the versions of the specification supported by the server.
Definition: http_client.cc:111
typename std::function< void(std::shared_ptr< Error::Error > err, T...)> callback_t
general type for callbacks
Definition: structs.hh:43