Migrate to VoidLibrary (toolchain + API groundwork)
This commit is contained in:
1 parent
5e1e3d66c4
commit
e17cfed56f
38 files changed
+3077
-2505
No files matched your search
@@ -0,0 +1,112 @@
|
||||
#pragma once
|
||||
|
||||
#include "ConfigTypes.hpp"
|
||||
#include "TrackTypes.hpp"
|
||||
#include <functional>
|
||||
#include <map>
|
||||
#include <optional>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
namespace Echoion::Api
|
||||
{
|
||||
|
||||
enum class RpcMethod : uint8_t {
|
||||
// Playback control
|
||||
Play = 0,
|
||||
Pause,
|
||||
Resume,
|
||||
Stop,
|
||||
Skip,
|
||||
Seek,
|
||||
SetVolume,
|
||||
|
||||
// Queue management
|
||||
QueueTrack,
|
||||
RemoveFromQueue,
|
||||
ClearQueue,
|
||||
GetQueue,
|
||||
MoveInQueue,
|
||||
|
||||
// Track info
|
||||
GetCurrentTrack,
|
||||
GetTrackInfo,
|
||||
SearchTracks,
|
||||
|
||||
// Playlist
|
||||
LoadPlaylist,
|
||||
SavePlaylist,
|
||||
GetPlaylists,
|
||||
DeletePlaylist,
|
||||
|
||||
// Configuration
|
||||
GetConfig,
|
||||
SetConfig,
|
||||
ReloadConfig,
|
||||
|
||||
// Plugin/Core management
|
||||
GetStatus,
|
||||
HotReload,
|
||||
Shutdown,
|
||||
|
||||
// Admin
|
||||
Authenticate,
|
||||
Logout,
|
||||
GetAuditLog,
|
||||
ManageUsers,
|
||||
|
||||
// Server info
|
||||
GetServerInfo,
|
||||
RequestLoginToken,
|
||||
ValidateLoginToken
|
||||
};
|
||||
|
||||
struct RpcRequest {
|
||||
uint64_t id;
|
||||
RpcMethod method;
|
||||
std::optional<std::string> params;
|
||||
std::optional<std::string> authToken;
|
||||
std::chrono::system_clock::time_point timestamp;
|
||||
};
|
||||
|
||||
struct RpcResponse {
|
||||
uint64_t requestId;
|
||||
bool success;
|
||||
std::optional<std::string> result;
|
||||
std::optional<std::string>
|
||||
error; // JSON string: {"code":N,"message":"...","source":"..."}
|
||||
std::chrono::system_clock::time_point timestamp;
|
||||
};
|
||||
|
||||
struct RpcNotification {
|
||||
std::string event;
|
||||
std::optional<std::string> data;
|
||||
std::chrono::system_clock::time_point timestamp;
|
||||
};
|
||||
|
||||
using RpcHandler = std::function<RpcResponse(const RpcRequest &)>;
|
||||
|
||||
struct RpcEndpoint {
|
||||
RpcMethod method;
|
||||
std::string name;
|
||||
std::string description;
|
||||
bool requiresAuth;
|
||||
RpcHandler handler;
|
||||
};
|
||||
|
||||
// Hot reload state preservation
|
||||
struct HotReloadState {
|
||||
PlaybackState playback;
|
||||
std::vector<QueueEntry> queue;
|
||||
std::optional<std::string> currentStreamUrl;
|
||||
std::chrono::milliseconds playbackPosition;
|
||||
BotConfig config;
|
||||
std::map<std::string, std::string> sessionData;
|
||||
|
||||
[[nodiscard]] bool shouldPreservePlayback() const noexcept
|
||||
{
|
||||
return playback.isPlaying && playback.currentTrack.has_value();
|
||||
}
|
||||
};
|
||||
|
||||
} // namespace Echoion::Api
|
||||
Reference in new issue
Block a user