aboutsummaryrefslogtreecommitdiff
path: root/include/feedbinapi.h
blob: a497ba0616dea6197b7d4b63c55514d7defb619f (plain) (blame)
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
39
40
41
42
43
44
45
46
#ifndef NEWSBOAT_FEEDBINAPI_H_
#define NEWSBOAT_FEEDBINAPI_H_

#include "remoteapi.h"
#include "rss/feed.h"
#include "3rd-party/json.hpp"
#include "utils.h"

class CurlHandle;

using HTTPMethod = newsboat::utils::HTTPMethod;

namespace newsboat {

class FeedbinApi : public RemoteApi {
public:
	explicit FeedbinApi(ConfigContainer& c);
	~FeedbinApi() override = default;
	bool authenticate() override;
	std::vector<TaggedFeedUrl> get_subscribed_urls() override;
	void add_custom_headers(curl_slist** custom_headers) override;
	bool mark_all_read(const std::string& feedurl) override;
	bool mark_article_read(const std::string& guid, bool read) override;
	bool update_article_flags(const std::string& oldflags,
		const std::string& newflags,
		const std::string& guid) override;
	rsspp::Feed fetch_feed(const std::string& id, CurlHandle& cached_handle);

private:
	virtual nlohmann::json run_op(const std::string& path,
		const nlohmann::json& req_data,
		const HTTPMethod method = HTTPMethod::GET);
	virtual nlohmann::json run_op(const std::string& path,
		const nlohmann::json& req_data,
		CurlHandle& cached_handle,
		const HTTPMethod method = HTTPMethod::GET);
	bool star_article(const std::string& guid, bool star);
	bool mark_entries_read(const std::vector<std::string>& ids, bool read);
	TaggedFeedUrl feed_from_json(const nlohmann::json& jfeed,
		const std::vector<std::string>& tags);
	std::string auth_info;
};

} // namespace newsboat

#endif /* NEWSBOAT_FEEDBINAPI_H_ */