|
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 &&)=delete | |
| client_session & | operator= (client_session &&)=delete |
| std::expected< void, 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, 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, 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, session_error > | process_admin_request (RequestType request) |
| Process a request that requires admin privileges. | |
| template<typename RequestType > requires messaging::has_message_traits<RequestType> | |
| std::expected< typename messaging::message_traits< RequestType >::response_type, session_error > | process_request (RequestType request) |
| Process a request using message_traits (does not require auth). | |
| template<typename RequestType > requires messaging::has_message_traits<RequestType> | |
| std::expected< typename messaging::message_traits< RequestType >::response_type, session_error > | process_authenticated_request (RequestType request) |
| Process a request using message_traits (requires authentication). | |
| template<typename RequestType > requires messaging::has_message_traits<RequestType> | |
| std::expected< typename messaging::message_traits< RequestType >::response_type, session_error > | process_admin_request (RequestType request) |
| Process a request using message_traits (requires admin). | |
| bool | subscribe (const std::string &event_type) |
| Subscribe to notifications for an event type. | |
| bool | unsubscribe (const std::string &event_type) |
| Unsubscribe from notifications for an event type. | |
| bool | is_subscribed (const std::string &event_type) const |
| Check if currently subscribed to an event type. | |
| std::set< std::string > | get_subscriptions () const |
| Get the set of currently subscribed event types. | |
| std::vector< pending_notification > | take_pending_notifications () |
| Get all pending notifications and clear the queue. | |
| bool | has_pending_notifications () const |
| Check if there are any pending notifications. | |
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, 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, 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, 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, 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 |

| std::expected< typename messaging::message_traits< RequestType >::response_type, session_error > process_request | ( | RequestType | request | ) |
Process a request using message_traits (does not require auth).
Uses message_traits to automatically determine the response type and message_type enum value from the request type.
| RequestType | Request message type (must have message_traits) |
| request | The request to send |
| std::expected< typename messaging::message_traits< RequestType >::response_type, session_error > process_authenticated_request | ( | RequestType | request | ) |
Process a request using message_traits (requires authentication).
| RequestType | Request message type (must have message_traits) |
| request | The request to send |
| std::expected< typename messaging::message_traits< RequestType >::response_type, session_error > process_admin_request | ( | RequestType | request | ) |
Process a request using message_traits (requires admin).
| RequestType | Request message type (must have message_traits) |
| request | The request to send |
| bool subscribe | ( | const std::string & | event_type | ) |
Subscribe to notifications for an event type.
Delegates to remote_event_adapter to send a SUBSCRIBE protocol message. Received notifications are queued for retrieval via take_pending_notifications().
| event_type | The fully qualified event type name (e.g., "ores.risk.currency_changed") |

| bool unsubscribe | ( | const std::string & | event_type | ) |
Unsubscribe from notifications for an event type.
Delegates to remote_event_adapter to send an UNSUBSCRIBE protocol message.
| event_type | The fully qualified event type name |

| bool is_subscribed | ( | const std::string & | event_type | ) | const |
Check if currently subscribed to an event type.
| event_type | The event type to check |

| std::set< std::string > get_subscriptions | ( | ) | const |
Get the set of currently subscribed event types.

| std::vector< pending_notification > take_pending_notifications | ( | ) |
Get all pending notifications and clear the queue.
Returns notifications in the order they were received. The internal queue is cleared after this call.

| bool has_pending_notifications | ( | ) | const |
Check if there are any pending notifications.