File: freshrssapi.h

package info (click to toggle)
newsboat 2.38-0.1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 7,540 kB
  • sloc: cpp: 90,216; xml: 606; sh: 429; makefile: 369; ruby: 258; python: 239; ansic: 211; php: 63; awk: 59; perl: 38
file content (50 lines) | stat: -rw-r--r-- 1,448 bytes parent folder | download | duplicates (2)
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
47
48
49
50
#ifndef NEWSBOAT_FRESHRSSAPI_H_
#define NEWSBOAT_FRESHRSSAPI_H_

#include <libxml/tree.h>

#include "remoteapi.h"
#include "rss/feed.h"
#include "utils.h"

class CurlHandle;

using HTTPMethod = newsboat::utils::HTTPMethod;

namespace newsboat {

class FreshRssApi : public RemoteApi {
public:
	explicit FreshRssApi(ConfigContainer& c);
	~FreshRssApi() 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:
	std::vector<std::string> get_tags(xmlNode* node);
	std::string get_new_token();
	bool refresh_token();
	std::string retrieve_auth();
	std::string post_content(const std::string& url,
		const std::string& postdata);
	bool star_article(const std::string& guid, bool star);
	bool share_article(const std::string& guid, bool share);
	bool mark_article_read_with_token(const std::string& guid,
		bool read,
		const std::string& token);
	std::string auth;
	std::string auth_header;
	bool token_expired;
	std::string token;
};

} // namespace newsboat

#endif /* NEWSBOAT_FRESHRSSAPI_H_ */