From 69fc8d805396b889b5e8c1c88e8129d93db77d29 Mon Sep 17 00:00:00 2001 From: Kelly Rauchenberger Date: Sat, 20 Aug 2016 13:56:23 -0400 Subject: Updated API to use exceptions and make tweet/user objects more helpful --- src/user.h | 44 +++++++++++++++++++++++++++++++++++--------- 1 file changed, 35 insertions(+), 9 deletions(-) (limited to 'src/user.h') diff --git a/src/user.h b/src/user.h index 1d8be99..f08840b 100644 --- a/src/user.h +++ b/src/user.h @@ -2,26 +2,52 @@ #define USER_H_BF3AB38C #include +#include namespace twitter { + class client; + typedef unsigned long long user_id; class user { public: - user(); - user(std::string data); - user_id getID() const; - std::string getScreenName() const; - std::string getName() const; + user(const client& tclient, std::string data); + + user_id getID() const + { + return _id; + } + + std::string getScreenName() const + { + return _screen_name; + } + + std::string getName() const + { + return _name; + } - operator bool() const; - bool operator==(const user& other) const; - bool operator!=(const user& other) const; + bool operator==(const user& other) const + { + return _id == other._id; + } + + bool operator!=(const user& other) const + { + return _id != other._id; + } + + std::set getFriends() const; + std::set getFollowers() const; + void follow() const; + void unfollow() const; private: - bool _valid = false; + + const client& _client; user_id _id; std::string _screen_name; std::string _name; -- cgit 1.4.1