#pragma once #include "ugc/loader.hpp" #include "ugc/storage.hpp" #include "ugc/types.hpp" #include "platform/safe_callback.hpp" #include "base/worker_thread.hpp" #include class Index; struct FeatureID; namespace ugc { class Api { public: using UGCCallback = platform::SafeCallback; using UGCCallbackUnsafe = std::function; using UGCJsonToSendCallback = std::function; using OnResultCallback = platform::SafeCallback; using NumberOfUnsynchronizedCallback = std::function; Api(Index const & index, NumberOfUnsynchronizedCallback const & callback); void GetUGC(FeatureID const & id, UGCCallbackUnsafe const & callback); void SetUGCUpdate(FeatureID const & id, UGCUpdate const & ugc, OnResultCallback const & callback = nullptr); void GetUGCToSend(UGCJsonToSendCallback const & callback); void SendingCompleted(); void SaveUGCOnDisk(); Loader & GetLoader(); private: void GetUGCImpl(FeatureID const & id, UGCCallbackUnsafe const & callback); Storage::SettingResult SetUGCUpdateImpl(FeatureID const & id, UGCUpdate const & ugc); void GetUGCToSendImpl(UGCJsonToSendCallback const & callback); void SendingCompletedImpl(); void SaveUGCOnDiskImpl(); base::WorkerThread m_thread; Storage m_storage; Loader m_loader; }; } // namespace ugc