aboutsummaryrefslogtreecommitdiff
path: root/plugins/Plugin.hpp
blob: bc518a866bf7cb3e03999860598f38735b6d10a9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
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);
    };
}