149 lines
2.8 KiB
C++
149 lines
2.8 KiB
C++
#pragma once
|
|
|
|
// Domain event types published on the application event bus. The bus itself
|
|
// is Void::EventBus::EventBus (owned by Core); there is no echoion wrapper.
|
|
|
|
#include "ConfigTypes.hpp"
|
|
#include "PluginTypes.hpp"
|
|
#include "TrackTypes.hpp"
|
|
#include "Types.hpp"
|
|
#include <chrono>
|
|
#include <cstdint>
|
|
#include <optional>
|
|
#include <string>
|
|
|
|
namespace Echoion::Api::Events
|
|
{
|
|
|
|
// Playback events
|
|
struct PlaybackStarted {
|
|
TrackInfo track;
|
|
uint64_t clientId;
|
|
std::chrono::milliseconds position;
|
|
};
|
|
|
|
struct PlaybackPaused {
|
|
TrackInfo track;
|
|
std::chrono::milliseconds position;
|
|
};
|
|
|
|
struct PlaybackResumed {
|
|
TrackInfo track;
|
|
std::chrono::milliseconds position;
|
|
};
|
|
|
|
struct PlaybackStopped {
|
|
std::optional<TrackInfo> lastTrack;
|
|
std::chrono::milliseconds finalPosition;
|
|
};
|
|
|
|
struct PlaybackPositionChanged {
|
|
TrackInfo track;
|
|
std::chrono::milliseconds position;
|
|
std::chrono::milliseconds duration;
|
|
float progressPercent; // 0.0 - 100.0
|
|
};
|
|
|
|
struct TrackFinished {
|
|
TrackInfo track;
|
|
bool autoSkipped;
|
|
std::chrono::milliseconds finalPosition;
|
|
};
|
|
|
|
struct VolumeChanged {
|
|
float oldVolume;
|
|
float newVolume;
|
|
uint64_t changedByClientId;
|
|
};
|
|
|
|
struct ShuffleChanged {
|
|
bool enabled;
|
|
uint64_t changedByClientId;
|
|
};
|
|
|
|
struct RepeatChanged {
|
|
bool enabled;
|
|
uint64_t changedByClientId;
|
|
};
|
|
|
|
// Queue events
|
|
struct TrackQueued {
|
|
TrackInfo track;
|
|
uint64_t queueId;
|
|
uint64_t addedByClientId;
|
|
uint32_t position;
|
|
uint32_t queueLength;
|
|
};
|
|
|
|
struct TrackRemoved {
|
|
TrackInfo track;
|
|
uint64_t queueId;
|
|
uint64_t removedByClientId;
|
|
uint32_t queueLength;
|
|
};
|
|
|
|
struct QueueCleared {
|
|
uint64_t clearedByClientId;
|
|
uint32_t previousLength;
|
|
};
|
|
|
|
struct QueueShuffled {
|
|
uint64_t triggeredByClientId;
|
|
};
|
|
|
|
struct QueueReordered {
|
|
uint64_t queueId;
|
|
uint32_t oldPosition;
|
|
uint32_t newPosition;
|
|
uint64_t changedByClientId;
|
|
};
|
|
|
|
// Playlist events
|
|
struct PlaylistLoadStarted {
|
|
std::string playlistId;
|
|
uint64_t requestedByClientId;
|
|
uint64_t databasePlaylistId = 0;
|
|
};
|
|
|
|
struct PlaylistTrackLoaded {
|
|
std::string playlistId;
|
|
TrackInfo track;
|
|
uint32_t loadedCount;
|
|
uint32_t totalCount;
|
|
uint64_t databasePlaylistId = 0;
|
|
};
|
|
|
|
struct PlaylistLoadCompleted {
|
|
std::string playlistId;
|
|
uint32_t totalTracksLoaded;
|
|
bool success;
|
|
std::optional<std::string> error;
|
|
};
|
|
|
|
// Subscription events
|
|
struct UserSubscribed {
|
|
std::string uid;
|
|
std::string nickname;
|
|
uint64_t clientId;
|
|
};
|
|
|
|
struct UserUnsubscribed {
|
|
std::string uid;
|
|
std::string nickname;
|
|
uint64_t clientId;
|
|
};
|
|
|
|
// Error events
|
|
struct PlaybackError {
|
|
ErrorCode code;
|
|
std::string message;
|
|
std::optional<TrackInfo> track;
|
|
};
|
|
|
|
// Configuration events
|
|
struct ConfigReloaded {
|
|
BotConfig newConfig;
|
|
};
|
|
|
|
} // namespace Echoion::Api::Events
|