diff options
Diffstat (limited to 'src/stream.h')
| -rw-r--r-- | src/stream.h | 71 |
1 files changed, 0 insertions, 71 deletions
| diff --git a/src/stream.h b/src/stream.h deleted file mode 100644 index f6ce91e..0000000 --- a/src/stream.h +++ /dev/null | |||
| @@ -1,71 +0,0 @@ | |||
| 1 | #ifndef STREAM_H_E9146952 | ||
| 2 | #define STREAM_H_E9146952 | ||
| 3 | |||
| 4 | #include <functional> | ||
| 5 | #include <list> | ||
| 6 | #include <string> | ||
| 7 | #include <chrono> | ||
| 8 | #include <thread> | ||
| 9 | #include "bounding_box.h" | ||
| 10 | #include "auth.h" | ||
| 11 | #include "user.h" | ||
| 12 | |||
| 13 | namespace twitter { | ||
| 14 | |||
| 15 | class notification; | ||
| 16 | |||
| 17 | class | ||
| 18 | [[deprecated("The Twitter streaming API will sunset on August 16th, 2018")]] | ||
| 19 | stream { | ||
| 20 | public: | ||
| 21 | |||
| 22 | typedef std::function<void(notification _notification)> notify_callback; | ||
| 23 | |||
| 24 | stream( | ||
| 25 | const auth& tauth, | ||
| 26 | notify_callback callback, | ||
| 27 | bool with_followings = true, | ||
| 28 | bool receive_all_replies = false, | ||
| 29 | std::list<std::string> track = {}, | ||
| 30 | std::list<bounding_box> locations = {}); | ||
| 31 | |||
| 32 | ~stream(); | ||
| 33 | |||
| 34 | stream(const stream& other) = delete; | ||
| 35 | stream(stream&& other) = delete; | ||
| 36 | stream& operator=(const stream& other) = delete; | ||
| 37 | stream& operator=(stream&& other) = delete; | ||
| 38 | |||
| 39 | private: | ||
| 40 | enum class backoff { | ||
| 41 | none, | ||
| 42 | network, | ||
| 43 | http, | ||
| 44 | rate_limit | ||
| 45 | }; | ||
| 46 | |||
| 47 | static std::string generateUrl( | ||
| 48 | bool with_followings, | ||
| 49 | bool receive_all_replies, | ||
| 50 | std::list<std::string> track, | ||
| 51 | std::list<bounding_box> locations); | ||
| 52 | |||
| 53 | void run(std::string url); | ||
| 54 | int progress(); | ||
| 55 | size_t write(char* ptr, size_t size, size_t nmemb); | ||
| 56 | |||
| 57 | const auth& _auth; | ||
| 58 | notify_callback _notify; | ||
| 59 | bool _stop = false; | ||
| 60 | std::string _buffer; | ||
| 61 | time_t _last_write; | ||
| 62 | bool _established = false; | ||
| 63 | backoff _backoff_type = backoff::none; | ||
| 64 | std::chrono::milliseconds _backoff_amount; | ||
| 65 | user _currentUser; | ||
| 66 | std::thread _thread; | ||
| 67 | }; | ||
| 68 | |||
| 69 | } | ||
| 70 | |||
| 71 | #endif /* end of include guard: STREAM_H_E9146952 */ | ||
