aboutsummaryrefslogtreecommitdiff
path: root/plugins/MyAnimeList.hpp
blob: 8f35043a0a106a80d1c6db0fd9bce96ab441e867 (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
#pragma once

#include "Page.hpp"

namespace QuickMedia {
    class MyAnimeListSearchPage : public Page {
    public:
        MyAnimeListSearchPage(Program *program) : Page(program) {}
        const char* get_title() const override { return "Search for anime or manga"; }
        bool search_is_filter() override { return false; }
        bool submit_is_async() const override { return false; }
        SearchResult search(const std::string &str, BodyItems &result_items) override;
        PluginResult submit(const SubmitArgs &args, std::vector<Tab> &result_tabs) override;
    };

    class MyAnimeListDetailsPage : public LazyFetchPage {
    public:
        MyAnimeListDetailsPage(Program *program, std::string url) : LazyFetchPage(program), url(std::move(url)) {}
        const char* get_title() const override { return "Details"; }
        bool submit_is_async() const override { return false; }
        PluginResult submit(const SubmitArgs &args, std::vector<Tab> &result_tabs) override;
        PluginResult lazy_fetch(BodyItems &result_items) override;
    private:
        std::string url;
    };

    class MyAnimeListRecommendationsPage : public LazyFetchPage {
    public:
        MyAnimeListRecommendationsPage(Program *program, std::string url) : LazyFetchPage(program), url(std::move(url)) {}
        const char* get_title() const override { return "Recommendations"; }
        bool submit_is_async() const override { return false; }
        PluginResult submit(const SubmitArgs &args, std::vector<Tab> &result_tabs) override;
        PluginResult lazy_fetch(BodyItems &result_items) override;
    private:
        std::string url;
    };
}