|
ORE Studio 0.0.4
|
Client-side session manager providing auth-aware request handling. More...
#include <client_session.hpp>

Public Member Functions | |
| client_session (const client_session &)=delete | |
| client_session & | operator= (const client_session &)=delete |
| client_session (client_session &&)=default | |
| client_session & | operator= (client_session &&)=default |
| std::expected< void, client_session_error > | connect (client_options options) |
| Connect to the server. | |
| void | disconnect () |
| Disconnect from the server. | |
| bool | is_connected () const noexcept |
| Check if connected to server. | |
| bool | is_logged_in () const noexcept |
| Check if logged in. | |
| void | set_session_info (client_session_info info) |
| Set session info after successful login. | |
| void | clear_session_info () noexcept |
| Clear session info on logout. | |
| bool | is_admin () const noexcept |
| Check if logged in as admin. | |
| const std::optional< client_session_info > & | session_info () const noexcept |
| Get current session info if logged in. | |
| template<Serializable RequestType, Deserializable ResponseType, messaging::message_type RequestMsgType> | |
| std::expected< ResponseType, client_session_error > | process_request (RequestType request) |
| Process a request that does not require authentication. | |
| template<Serializable RequestType, Deserializable ResponseType, messaging::message_type RequestMsgType> | |
| std::expected< ResponseType, client_session_error > | process_authenticated_request (RequestType request) |
| Process a request that requires authentication. | |
| template<Serializable RequestType, Deserializable ResponseType, messaging::message_type RequestMsgType> | |
| std::expected< ResponseType, client_session_error > | process_admin_request (RequestType request) |
| Process a request that requires admin privileges. | |
Client-side session manager providing auth-aware request handling.
This class wraps a net::client and provides:
Designed to be shared between ores.shell and ores.qt clients.
| std::expected< void, client_session_error > connect | ( | client_options | options | ) |
Connect to the server.
| options | Connection options |

| void disconnect | ( | ) |
Disconnect from the server.
Will logout first if logged in.

| void set_session_info | ( | client_session_info | info | ) |
Set session info after successful login.
Called by the application layer after processing a login response.
| info | Session information from login response |

|
noexcept |
Clear session info on logout.
Called by the application layer after logout or disconnect.

| std::expected< ResponseType, client_session_error > process_request | ( | RequestType | request | ) |
Process a request that does not require authentication.
Use this for messages like bootstrap_status_request that don't need login.
| RequestType | Request message type (must be Serializable) |
| ResponseType | Response message type (must be Deserializable) |
| RequestMsgType | The message_type enum value for the request |
| request | The request to send |

| std::expected< ResponseType, client_session_error > process_authenticated_request | ( | RequestType | request | ) |
Process a request that requires authentication.
Checks if logged in before sending. Use this for most requests.
| RequestType | Request message type (must be Serializable) |
| ResponseType | Response message type (must be Deserializable) |
| RequestMsgType | The message_type enum value for the request |
| request | The request to send |

| std::expected< ResponseType, client_session_error > process_admin_request | ( | RequestType | request | ) |
Process a request that requires admin privileges.
Checks if logged in as admin before sending.
| RequestType | Request message type (must be Serializable) |
| ResponseType | Response message type (must be Deserializable) |
| RequestMsgType | The message_type enum value for the request |
| request | The request to send |