Operator
C++ library for plugging into matrix.org
All Classes Namespaces Files Functions Typedefs Pages
Public Member Functions | Protected Attributes | List of all members
Operator::Client::HTTPClient Class Reference

high-level Client-Server API over HTTP. More...

#include <http_client.hh>

Inheritance diagram for Operator::Client::HTTPClient:
Inheritance graph
[legend]
Collaboration diagram for Operator::Client::HTTPClient:
Collaboration graph
[legend]

Public Member Functions

 HTTPClient (HTTP::Adapter &adapter, const std::string &server)
 
void login (const std::string &username, const std::string &password, const callback_t< const std::string &, const std::string &> &callback=noop_callback< const std::string &, const std::string &>)
 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 &> &callback=noop_callback< const std::string &, const std::string &>)
 log in using third party ID and pasword. More...
 
void loginWithToken (const std::string &token)
 
void logout (const callback_t<> &callback=noop_callback<>)
 log out. More...
 
bool isLoggedIn () const
 determine if the client is currently logged in.
 
void startClient ()
 start listening for new events.
 
void stopClient ()
 stop listening for new events.
 
void sendMessage (const Event::MessageEvent &, const callback_t< const std::string &> &=noop_callback< const std::string &>)
 send a message event. More...
 
- Public Member Functions inherited from Operator::Client::Client
RoomgetRoom (const std::string &room_id)
 return the room with the given ID. More...
 
const RoomgetRoom (const std::string &room_id) const throw (std::out_of_range)
 
Roomoperator[] (const std::string &room_id)
 
const Roomoperator[] (const std::string &room_id) const throw (std::out_of_range)
 
void on (const std::string &type, const callback_t< Room &, const Event::Event &> &callback)
 register an event handler. More...
 
template<class T >
void on (const callback_t< Room &, const Event::Event &> &callback)
 register an event handler. More...
 

Protected Attributes

HTTPClientAPI client
 
- Protected Attributes inherited from Operator::Client::Client
std::map< std::string, Roomrooms
 

Additional Inherited Members

- Protected Member Functions inherited from Operator::Client::Client
void trigger (const Event::Event &event)
 call event handlers for the given event.
 
void triggerError (const std::string &event_type, std::shared_ptr< Error::Error > error, const std::string &room_id="")
 
void _setRoomMembership (Room &room, Event::RoomMembership::membership_t membership)
 

Detailed Description

high-level Client-Server API over HTTP.

Examples:
liboperator-glib/examples/echo.cc, and liboperator-qt/examples/echo.cc.

Member Function Documentation

◆ login()

void HTTPClient::login ( const std::string &  username,
const std::string &  password,
const callback_t< const std::string &, const std::string &> &  = noop_callback< const std::string &, const std::string &> 
)
virtual

log in using username and password

Parameters
[in]usernameThe username to log in as
[in]passwordThe password to use
[out]callbackThe callback will receive the user's Matrix ID and the server name
See also
(C-S r0.2.0 section 3.2.1)

Implements Operator::Client::Client.

Examples:
liboperator-glib/examples/echo.cc.

◆ loginWith3PID()

void HTTPClient::loginWith3PID ( const std::string &  medium,
const std::string &  address,
const std::string &  password,
const callback_t< const std::string &, const std::string &> &  = noop_callback< const std::string &, const std::string &> 
)
virtual

log in using third party ID and pasword.

See also
(C-S r0.2.0 section 3.2.1)

Implements Operator::Client::Client.

◆ logout()

void HTTPClient::logout ( const callback_t<> &  = noop_callback<>)
virtual

log out.

See also
(C-S r0.2.0 section 3.2.2)

Implements Operator::Client::Client.

◆ sendMessage()

void HTTPClient::sendMessage ( const Event::MessageEvent message,
const callback_t< const std::string &> &  callback = noop_callback< const std::string &> 
)
virtual

send a message event.

Parameters
[in]messageThe message event to send.
[out]callbackThe callback will receive the resulting event ID.

Implements Operator::Client::Client.


The documentation for this class was generated from the following files: