diff --git a/include/echoion/core/Core.hpp b/include/echoion/core/Core.hpp index 1ae0f78..3989e26 100644 --- a/include/echoion/core/Core.hpp +++ b/include/echoion/core/Core.hpp @@ -56,8 +56,6 @@ namespace Echoion::Core uint64_t clientId) override; Api::Result removeFromQueue(uint64_t queueId) override; Api::Result clearQueue() override; - [[nodiscard]] Api::Result> - getQueueSummaries() const override; Api::Result moveInQueue(uint64_t queueId, uint32_t newPosition) override; diff --git a/include/echoion/core/NetworkClient.hpp b/include/echoion/core/NetworkClient.hpp index 12d7078..fda82e9 100644 --- a/include/echoion/core/NetworkClient.hpp +++ b/include/echoion/core/NetworkClient.hpp @@ -2,14 +2,10 @@ #include #include -#include -#include -#include #include #include #include -#include -#include +#include #include #include #include @@ -45,49 +41,6 @@ namespace Echoion::Core [[nodiscard]] Api::Result request(const Void::Net::Request& req) override; - // Asynchronous requests - [[nodiscard]] std::future> - getAsync(std::string_view url, - const std::vector& headers = {}) - override; - [[nodiscard]] std::future> - postAsync(std::string_view url, std::string_view body, - const std::vector& headers = {}) - override; - [[nodiscard]] std::future> - requestAsync(const Void::Net::Request& req) override; - - // Concurrent batch requests - [[nodiscard]] std::vector> - requestBatch(const std::vector& requests); - - // JSON helpers using Void::Json reflection - template - [[nodiscard]] Api::Result - getJson(std::string_view url, - const std::vector& headers = {}) - { - auto response = get(url, headers); - if (!response) { - return std::unexpected(response.error()); - } - return parseJson(response->body); - } - - template - [[nodiscard]] Api::Result - postJson(std::string_view url, const Body& body, - const std::vector& headers = {}) - { - std::string jsonBody = - Void::Json::serialize(Void::Json::to_json(body)); - auto response = post(url, jsonBody, headers); - if (!response) { - return std::unexpected(response.error()); - } - return parseJson(response->body); - } - // Proxy configuration void setProxy( const std::optional& proxy) override; @@ -97,28 +50,6 @@ namespace Echoion::Core private: - template - [[nodiscard]] static Api::Result - parseJson(const std::string& body) - { - auto parsed = Void::Json::parse(body); - if (!parsed) { - return Api::fail( - Api::ErrorCode::ParseError, - std::format("JSON parse error ({}:{}): {}", - parsed.error().line, parsed.error().col, - parsed.error().message)); - } - auto value = Void::Json::from_json(*parsed); - if (!value) { - return Api::fail( - Api::ErrorCode::ParseError, - std::format("JSON decode error: field '{}': {}", - value.error().field, value.error().message)); - } - return std::move(*value); - } - // Execute with retry/backoff (Void::Retry); single attempt via // Void::Net::HttpClient. [[nodiscard]] Api::Result @@ -140,10 +71,6 @@ namespace Echoion::Core .multiplier = 2.0}}; std::vector retryableStatusCodes_{408, 429, 500, 502, 503, 504}; - - // Worker pool backing the *Async / requestBatch fan-outs, replacing - // a per-call std::async OS-thread spawn with bounded thread reuse. - Void::Concurrency::ThreadPool pool_; }; } // namespace Echoion::Core diff --git a/src/Core.cpp b/src/Core.cpp index b600b49..dbb0702 100644 --- a/src/Core.cpp +++ b/src/Core.cpp @@ -676,30 +676,6 @@ namespace Echoion::Core return musicManager_->getQueue(); } - Api::Result> Core::getQueueSummaries() const - { - if (!initialized_) { - return Api::fail( - Api::ErrorCode::ServiceUnavailable, "Core not initialized"); - } - - auto queue = musicManager_->getQueue(); - if (!queue) { - return std::unexpected(queue.error()); - } - - std::vector summaries; - summaries.reserve(queue->size()); - for (const auto& entry : *queue) { - summaries.push_back( - Api::TrackSummary{.id = entry.track.id, - .title = entry.track.title, - .artist = entry.track.artist, - .duration = entry.track.duration}); - } - return summaries; - } - Api::Result Core::moveInQueue(uint64_t queueId, uint32_t newPosition) { if (!initialized_) { diff --git a/src/NetworkClient.cpp b/src/NetworkClient.cpp index ea7760e..4591694 100644 --- a/src/NetworkClient.cpp +++ b/src/NetworkClient.cpp @@ -92,46 +92,6 @@ namespace Echoion::Core return request(req); } - std::future> - NetworkClient::getAsync(std::string_view url, - const std::vector& headers) - { - return pool_.submit([this, u = std::string(url), headers] { - return get(u, headers); - }); - } - - std::future> - NetworkClient::postAsync(std::string_view url, std::string_view body, - const std::vector& headers) - { - return pool_.submit([this, u = std::string(url), b = std::string(body), - headers] { return post(u, b, headers); }); - } - - std::future> - NetworkClient::requestAsync(const Void::Net::Request& req) - { - return pool_.submit([this, req] { return request(req); }); - } - - std::vector> - NetworkClient::requestBatch( - const std::vector& requests) - { - std::vector>> futures; - futures.reserve(requests.size()); - for (const auto& req : requests) { - futures.push_back(requestAsync(req)); - } - std::vector> results; - results.reserve(requests.size()); - for (auto& f : futures) { - results.push_back(f.get()); - } - return results; - } - void NetworkClient::setProxy( const std::optional& proxy) {