diff options
Diffstat (limited to 'src/client.h')
| -rw-r--r-- | src/client.h | 66 |
1 files changed, 37 insertions, 29 deletions
| diff --git a/src/client.h b/src/client.h index 2230dbb..c0a63eb 100644 --- a/src/client.h +++ b/src/client.h | |||
| @@ -10,58 +10,66 @@ | |||
| 10 | #include "auth.h" | 10 | #include "auth.h" |
| 11 | #include "configuration.h" | 11 | #include "configuration.h" |
| 12 | #include "util.h" | 12 | #include "util.h" |
| 13 | 13 | #include "timeline.h" | |
| 14 | namespace OAuth { | ||
| 15 | class Consumer; | ||
| 16 | class Token; | ||
| 17 | class Client; | ||
| 18 | }; | ||
| 19 | 14 | ||
| 20 | namespace twitter { | 15 | namespace twitter { |
| 21 | 16 | ||
| 22 | class client { | 17 | class client { |
| 23 | public: | 18 | public: |
| 24 | 19 | ||
| 25 | client(const auth& _auth); | 20 | client(const auth& arg); |
| 26 | ~client(); | 21 | |
| 27 | |||
| 28 | tweet updateStatus(std::string msg, std::list<long> media_ids = {}) const; | 22 | tweet updateStatus(std::string msg, std::list<long> media_ids = {}) const; |
| 29 | long uploadMedia(std::string media_type, const char* data, long data_length) const; | 23 | long uploadMedia(std::string media_type, const char* data, long data_length) const; |
| 30 | 24 | ||
| 31 | tweet replyToTweet(std::string msg, tweet_id in_response_to, std::list<long> media_ids = {}) const; | 25 | tweet replyToTweet(std::string msg, tweet_id in_response_to, std::list<long> media_ids = {}) const; |
| 32 | 26 | ||
| 33 | std::set<user_id> getFriends(user_id id) const; | 27 | std::set<user_id> getFriends(user_id id) const; |
| 34 | std::set<user_id> getFriends(const user& u) const; | 28 | std::set<user_id> getFriends(const user& u) const; |
| 35 | std::set<user_id> getFriends() const; | 29 | std::set<user_id> getFriends() const; |
| 36 | 30 | ||
| 37 | std::set<user_id> getFollowers(user_id id) const; | 31 | std::set<user_id> getFollowers(user_id id) const; |
| 38 | std::set<user_id> getFollowers(const user& u) const; | 32 | std::set<user_id> getFollowers(const user& u) const; |
| 39 | std::set<user_id> getFollowers() const; | 33 | std::set<user_id> getFollowers() const; |
| 40 | 34 | ||
| 41 | void follow(user_id toFollow) const; | 35 | void follow(user_id toFollow) const; |
| 42 | void follow(const user& toFollow) const; | 36 | void follow(const user& toFollow) const; |
| 43 | 37 | ||
| 44 | void unfollow(user_id toUnfollow) const; | 38 | void unfollow(user_id toUnfollow) const; |
| 45 | void unfollow(const user& toUnfollow) const; | 39 | void unfollow(const user& toUnfollow) const; |
| 46 | 40 | ||
| 47 | const user& getUser() const; | 41 | const user& getUser() const; |
| 48 | 42 | ||
| 49 | const configuration& getConfiguration() const; | 43 | const configuration& getConfiguration() const; |
| 50 | 44 | ||
| 45 | timeline& getHomeTimeline() | ||
| 46 | { | ||
| 47 | return homeTimeline_; | ||
| 48 | } | ||
| 49 | |||
| 50 | timeline& getMentionsTimeline() | ||
| 51 | { | ||
| 52 | return mentionsTimeline_; | ||
| 53 | } | ||
| 54 | |||
| 51 | private: | 55 | private: |
| 52 | 56 | ||
| 53 | friend class stream; | 57 | const auth& auth_; |
| 54 | 58 | ||
| 55 | std::unique_ptr<OAuth::Consumer> _oauth_consumer; | 59 | user currentUser_; |
| 56 | std::unique_ptr<OAuth::Token> _oauth_token; | 60 | |
| 57 | std::unique_ptr<OAuth::Client> _oauth_client; | ||
| 58 | |||
| 59 | std::unique_ptr<user> _current_user; | ||
| 60 | |||
| 61 | mutable std::unique_ptr<configuration> _configuration; | 61 | mutable std::unique_ptr<configuration> _configuration; |
| 62 | mutable time_t _last_configuration_update; | 62 | mutable time_t _last_configuration_update; |
| 63 | |||
| 64 | timeline homeTimeline_ { | ||
| 65 | auth_, | ||
| 66 | "https://api.twitter.com/1.1/statuses/home_timeline.json"}; | ||
| 67 | |||
| 68 | timeline mentionsTimeline_ { | ||
| 69 | auth_, | ||
| 70 | "https://api.twitter.com/1.1/statuses/mentions_timeline.json"}; | ||
| 63 | }; | 71 | }; |
| 64 | 72 | ||
| 65 | }; | 73 | }; |
| 66 | 74 | ||
| 67 | #endif /* end of include guard: TWITTER_H_ABFF6A12 */ | 75 | #endif /* end of include guard: TWITTER_H_ABFF6A12 */ |
