aboutsummaryrefslogtreecommitdiff
path: root/plugins/Plugin.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/Plugin.hpp')
-rw-r--r--plugins/Plugin.hpp38
1 files changed, 38 insertions, 0 deletions
diff --git a/plugins/Plugin.hpp b/plugins/Plugin.hpp
new file mode 100644
index 0000000..bc518a8
--- /dev/null
+++ b/plugins/Plugin.hpp
@@ -0,0 +1,38 @@
+#pragma once
+
+#include <string>
+#include <vector>
+#include <memory>
+
+namespace QuickMedia {
+ class BodyItem {
+ public:
+ BodyItem(const std::string &_title): title(_title) {
+
+ }
+
+ std::string title;
+ std::string cover_url;
+ };
+
+ enum class SearchResult {
+ OK,
+ ERR,
+ NET_ERR
+ };
+
+ enum class DownloadResult {
+ OK,
+ ERR,
+ NET_ERR
+ };
+
+ class Plugin {
+ public:
+ virtual ~Plugin() = default;
+
+ virtual SearchResult search(const std::string &text, std::vector<std::unique_ptr<BodyItem>> &result_items) = 0;
+ protected:
+ DownloadResult download_to_string(const std::string &url, std::string &result);
+ };
+} \ No newline at end of file