diff options
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 */ | ||