From 38203b745ae1903ba0804ed5532b78d255bea635 Mon Sep 17 00:00:00 2001 From: Kelly Rauchenberger Date: Sun, 5 Aug 2018 11:14:39 -0400 Subject: Added timeline polling Because the streaming API will sunset on August 16th, it is essential to implement timeline polling so that the library can still be used to access tweets. This commit breaks the current API even for clients still using the streaming API because the OAuth connection data was pulled from twitter::client into twitter::auth. Other than that, almost everything works the same, and if a client wants to update their libtwitter++ within the next week and a half, they are free to. --- src/auth.h | 44 ++++++++++++++++++++++++++------------------ 1 file changed, 26 insertions(+), 18 deletions(-) (limited to 'src/auth.h') diff --git a/src/auth.h b/src/auth.h index ef07e81..30c178c 100644 --- a/src/auth.h +++ b/src/auth.h @@ -2,28 +2,36 @@ #define AUTH_H_48EF85FD #include +#include "../vendor/liboauthcpp/include/liboauthcpp/liboauthcpp.h" namespace twitter { - + class auth { - public: - void setConsumerKey(std::string _arg); - void setConsumerSecret(std::string _arg); - void setAccessKey(std::string _arg); - void setAccessSecret(std::string _arg); - - std::string getConsumerKey() const; - std::string getConsumerSecret() const; - std::string getAccessKey() const; - std::string getAccessSecret() const; - - private: - std::string _consumer_key; - std::string _consumer_secret; - std::string _access_key; - std::string _access_secret; + public: + + auth( + std::string consumerKey, + std::string consumerSecret, + std::string accessKey, + std::string accessSecret) : + consumer_(std::move(consumerKey), std::move(consumerSecret)), + token_(std::move(accessKey), std::move(accessSecret)), + client_(&consumer_, &token_) + { + } + + const OAuth::Client& getClient() const + { + return client_; + } + + private: + + OAuth::Consumer consumer_; + OAuth::Token token_; + OAuth::Client client_; }; - + }; #endif /* end of include guard: AUTH_H_48EF85FD */ -- cgit 1.4.1