4.3 KiB
4.3 KiB
API Reorganization Guide
Directory Structure to Create
EchoionApi/include/echoion/api/
├── base/
│ └── Types.hpp # Error, Result, LogLevel, LogEntry, version constants
├── audio/
│ └── AudioTypes.hpp # AudioQuality, AudioFormat, AudioBuffer
├── track/
│ └── TrackTypes.hpp # TrackInfo, QueueEntry, PlaybackState, SearchResult
├── network/
│ └── NetworkTypes.hpp # HttpHeader, HttpRequest, HttpResponse, ProxyConfig
├── plugin/
│ └── PluginTypes.hpp # PluginEventType, PluginEvent, ClientInfo, ChannelInfo
├── config/
│ └── ConfigTypes.hpp # BotConfig, ServerConfig, SecurityConfig, AppConfig
├── rpc/
│ └── RpcTypes.hpp # RpcMethod, RpcRequest, RpcResponse, HotReloadState
├── youtube/
│ └── YouTubeTypes.hpp # YouTubeVideoInfo, YouTubePlaylistInfo, etc.
├── logger/
│ └── LoggerInterface.hpp # ILogger, LoggerRegistry, macros
├── eventbus/
│ └── EventBus.hpp # EventBus, all event types
├── database/
│ └── Database.hpp # Database interface
├── interfaces/
│ ├── CoreInterface.hpp # ICoreInterface, INetworkClient
│ └── PluginInterface.hpp # IPluginInterface
└── utils/
├── Cache.hpp # Cache interface
└── MemoryPool.hpp # MemoryPool interface
Files to Move
From root include/echoion/api/ to subfolders:
| Current Location | New Location |
|---|---|
Types.hpp |
base/Types.hpp |
AudioTypes.hpp |
audio/AudioTypes.hpp |
TrackTypes.hpp |
track/TrackTypes.hpp |
NetworkTypes.hpp |
network/NetworkTypes.hpp |
PluginTypes.hpp |
plugin/PluginTypes.hpp |
ConfigTypes.hpp |
config/ConfigTypes.hpp |
RpcTypes.hpp |
rpc/RpcTypes.hpp |
YouTubeTypes.hpp |
youtube/YouTubeTypes.hpp |
LoggerInterface.hpp |
logger/LoggerInterface.hpp |
EventBus.hpp |
eventbus/EventBus.hpp |
Database.hpp |
database/Database.hpp |
CoreInterface.hpp |
interfaces/CoreInterface.hpp |
Cache.hpp |
utils/Cache.hpp |
MemoryPool.hpp |
utils/MemoryPool.hpp |
Files to Delete
AudioTypesOnly.hppConfigTypesOnly.hppLoggerTypesOnly.hppNetworkTypesOnly.hppPluginTypesOnly.hppRpcTypesOnly.hppTrackTypesOnly.hppYouTubeTypesOnly.hppBaseTypes.hpp
Include Path Changes
For a host adapter (minimal):
Before:
#include <echoion/api.hpp>
After:
#include <Types.hpp>
#include <PluginTypes.hpp>
#include <CoreInterface.hpp>
The CMake target Echoion::ApiPlugin provides the event and host DTO include
paths retained for source compatibility.
For Core:
Before:
#include <echoion/api/EventBus.hpp>
After:
#include <EventBus.hpp>
The CMake target Echoion::ApiEventBus adds eventbus/ to the include path.
CMake Usage
Standalone host needs:
target_link_libraries(EchoionStandalone PRIVATE
Echoion::ApiBase
Echoion::ApiPlugin
Echoion::ApiInterfaces
)
Core uses everything:
target_link_libraries(EchoionCore PUBLIC
Echoion::ApiBase
Echoion::ApiAudio
Echoion::ApiTrack
Echoion::ApiNetwork
Echoion::ApiPlugin
Echoion::ApiConfig
Echoion::ApiRpc
Echoion::ApiYouTube
Echoion::ApiLogger
Echoion::ApiEventBus
Echoion::ApiDatabase
Echoion::ApiInterfaces
Echoion::ApiUtils
)
Commands to Execute
Run these commands in the project root:
# Create directory structure
cd EchoionApi/include/echoion/api
mkdir -p base audio track network plugin config rpc youtube logger eventbus database interfaces utils
# Move files
mv Types.hpp base/
mv AudioTypes.hpp audio/
mv TrackTypes.hpp track/
mv NetworkTypes.hpp network/
mv PluginTypes.hpp plugin/
mv ConfigTypes.hpp config/
mv RpcTypes.hpp rpc/
mv YouTubeTypes.hpp youtube/
mv LoggerInterface.hpp logger/
mv EventBus.hpp eventbus/
mv Database.hpp database/
mv CoreInterface.hpp interfaces/
mv Cache.hpp utils/
mv MemoryPool.hpp utils/
# Remove old files
rm -f *Only.hpp BaseTypes.hpp
# Go back to project root
cd ../../../../..
# Create Export.hpp in interfaces (if not exists)
touch EchoionApi/include/echoion/api/interfaces/Export.hpp