|
Sonde v1.1.0
Embeddable Model Context Protocol server for Qt applications
|
A client asking to start a session, for the application to approve or refuse (see Server::setSessionApproval()). More...
#include <session.h>
Public Member Functions | |
| SessionRequest ()=default | |
| An invalid request; every operation on it does nothing. | |
| bool | isValid () const |
| Whether this refers to a request. | |
| QString | clientName () const |
| clientInfo's "name", as the client says. | |
| QString | clientVersion () const |
| clientInfo's "version", as the client says. | |
| QJsonObject | clientInfo () const |
| The whole clientInfo the client sent with initialize. | |
| QString | transport () const |
| "local" or "http". | |
| SessionPeer | peer () const |
| What the operating system says about the client. | |
| bool | isAnswered () const |
| Whether it was answered, or can no longer be. | |
| void | approve () const |
| Lets the client in: initialize is answered, and Server::sessionStarted follows. | |
| void | deny (const QString &reason={ }) const |
Refuses the client: initialize fails with reason (or "The user refused
this client"), and the session ends. | |
| void | onCancelled (std::function< void()> callback) const |
Registers callback to run, on the server's thread, if the request ends without an answer from the application: the client went away, or the time ran out. | |
Private Member Functions | |
| SessionRequest (std::shared_ptr< SessionRequestPrivate > state) | |
| Wraps the shared state (created by the server). | |
Private Attributes | |
| std::shared_ptr< SessionRequestPrivate > | d |
| Shared request state. | |
Friends | |
| class | SessionRequestPrivate |
A client asking to start a session, for the application to approve or refuse (see Server::setSessionApproval()).
A value type: copies share the request. The first approve() or deny() on any copy answers it; later ones do nothing, and so do those after the request ended without an answer (the client went away, or Server's limits().approvalTimeout passed). Call them on the server's thread.
| void Sonde::SessionRequest::onCancelled | ( | std::function< void()> | callback | ) | const |
Registers callback to run, on the server's thread, if the request ends without an answer from the application: the client went away, or the time ran out.
Close a dialog that asks about it, for example. Ignored once the request is answered.