diff options
author | Kelly Rauchenberger <fefferburbia@gmail.com> | 2018-08-05 11:14:39 -0400 |
---|---|---|
committer | Kelly Rauchenberger <fefferburbia@gmail.com> | 2018-08-05 11:14:39 -0400 |
commit | 38203b745ae1903ba0804ed5532b78d255bea635 (patch) | |
tree | 52f57ce85e65361c534c461abc82fb1ed9768d49 /src/request.h | |
parent | 7c44fd17bb6be54a2ea4b60761e91053ca988977 (diff) | |
download | libtwittercpp-38203b745ae1903ba0804ed5532b78d255bea635.tar.gz libtwittercpp-38203b745ae1903ba0804ed5532b78d255bea635.tar.bz2 libtwittercpp-38203b745ae1903ba0804ed5532b78d255bea635.zip |
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.
Diffstat (limited to 'src/request.h')
-rw-r--r-- | src/request.h | 73 |
1 files changed, 73 insertions, 0 deletions
diff --git a/src/request.h b/src/request.h new file mode 100644 index 0000000..1672d71 --- /dev/null +++ b/src/request.h | |||
@@ -0,0 +1,73 @@ | |||
1 | #ifndef REQUEST_H_9D3C30E2 | ||
2 | #define REQUEST_H_9D3C30E2 | ||
3 | |||
4 | #include <string> | ||
5 | #include <sstream> | ||
6 | #include <curl_easy.h> | ||
7 | #include <curl_header.h> | ||
8 | #include "auth.h" | ||
9 | |||
10 | namespace twitter { | ||
11 | |||
12 | class request | ||
13 | { | ||
14 | public: | ||
15 | |||
16 | explicit request(std::string url); | ||
17 | |||
18 | std::string perform(); | ||
19 | |||
20 | private: | ||
21 | |||
22 | std::ostringstream output_; | ||
23 | curl::curl_ios<std::ostringstream> ios_; | ||
24 | |||
25 | protected: | ||
26 | |||
27 | curl::curl_easy conn_; | ||
28 | }; | ||
29 | |||
30 | class get : public request | ||
31 | { | ||
32 | public: | ||
33 | |||
34 | get( | ||
35 | const auth& tauth, | ||
36 | std::string url); | ||
37 | |||
38 | private: | ||
39 | |||
40 | curl::curl_header headers_; | ||
41 | }; | ||
42 | |||
43 | class post : public request | ||
44 | { | ||
45 | public: | ||
46 | |||
47 | post( | ||
48 | const auth& tauth, | ||
49 | std::string url, | ||
50 | std::string datastr); | ||
51 | |||
52 | private: | ||
53 | |||
54 | curl::curl_header headers_; | ||
55 | }; | ||
56 | |||
57 | class multipost : public request | ||
58 | { | ||
59 | public: | ||
60 | |||
61 | multipost( | ||
62 | const auth& tauth, | ||
63 | std::string url, | ||
64 | const curl_httppost* fields); | ||
65 | |||
66 | private: | ||
67 | |||
68 | curl::curl_header headers_; | ||
69 | }; | ||
70 | |||
71 | } | ||
72 | |||
73 | #endif /* end of include guard: REQUEST_H_9D3C30E2 */ | ||