-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathreddit_agent.h
69 lines (52 loc) · 2.19 KB
/
reddit_agent.h
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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
#ifndef REDDIT_AGENT_H
#define REDDIT_AGENT_H
#include "reddit_types.pb.h"
#include <memory>
#include <jsoncpp/json/json.h>
namespace reddit {
class HttpSession;
class RedditAgent {
public:
~RedditAgent();
static RedditAgent* ConstructNew(const std::string& user_agent);
std::string user_agent() const;
std::string modhash() const;
void clear_modhash();
void set_modhash(const std::string& modhash);
// ====== account stuff ==========
bool Login(const std::string& user, const std::string& pass);
void AccountClearSessions(const std::string& curpass,
const std::string& dest);
void AccountDeleteUser(bool confirm, const std::string& delete_message,
const std::string& passwd, const std::string& user);
LoginResponse AccountLogin(const std::string& passwd, bool rem,
const std::string& user);
Account AccountMe();
void AccountRegister(const std::string& captcha, const std::string& email,
const std::string& iden, const std::string& passwd,
const std::string& user);
void AccountUpdate(const std::string& curpass, const std::string& dest,
const std::string& email, const std::string& newpass);
Account AccountV1Me();
// ====== captcha =========
bool NeedsCaptcha();
std::string NewCaptchaIden();
std::string GetCaptcha(const std::string& iden);
// ====== subreddit =======
Listing SubredditHot(const std::string& subreddit, const std::string& after,
const std::string& before, int count, int limit,
bool show_all);
Listing SubredditNew(const std::string& subreddit, const std::string& after,
const std::string& before, int count, int limit,
bool show_all);
Listing SubredditHot(const std::string& subreddit);
Listing SubredditNew(const std::string& subreddit);
Listing SubredditRandom(const std::string& subreddit);
private:
std::unique_ptr<HttpSession> http_;
std::string modhash_;
RedditAgent();
bool Init(const std::string& user_agent);
};
}; // namespace reddit
#endif