diff options
Diffstat (limited to 'src/notification.h')
-rw-r--r-- | src/notification.h | 145 |
1 files changed, 145 insertions, 0 deletions
diff --git a/src/notification.h b/src/notification.h new file mode 100644 index 0000000..da83b0f --- /dev/null +++ b/src/notification.h | |||
@@ -0,0 +1,145 @@ | |||
1 | #ifndef NOTIFICATION_H_69AEF4CC | ||
2 | #define NOTIFICATION_H_69AEF4CC | ||
3 | |||
4 | #include <string> | ||
5 | #include <vector> | ||
6 | #include <set> | ||
7 | #include "tweet.h" | ||
8 | #include "user.h" | ||
9 | #include "list.h" | ||
10 | #include "direct_message.h" | ||
11 | |||
12 | namespace twitter { | ||
13 | |||
14 | enum class disconnect_code { | ||
15 | shutdown, | ||
16 | duplicate, | ||
17 | stall, | ||
18 | normal, | ||
19 | token_revoked, | ||
20 | admin_logout, | ||
21 | limit, | ||
22 | exception, | ||
23 | broker, | ||
24 | load, | ||
25 | unknown | ||
26 | }; | ||
27 | |||
28 | class notification { | ||
29 | public: | ||
30 | enum class type { | ||
31 | // Tweet object | ||
32 | tweet, | ||
33 | |||
34 | // User object | ||
35 | update_user, | ||
36 | block, | ||
37 | unblock, | ||
38 | follow, | ||
39 | followed, | ||
40 | unfollow, | ||
41 | |||
42 | // User and tweet | ||
43 | favorite, | ||
44 | favorited, | ||
45 | unfavorite, | ||
46 | unfavorited, | ||
47 | quoted, | ||
48 | |||
49 | // List | ||
50 | list_created, | ||
51 | list_destroyed, | ||
52 | list_updated, | ||
53 | |||
54 | // User and list | ||
55 | list_add, | ||
56 | list_added, | ||
57 | list_remove, | ||
58 | list_removed, | ||
59 | list_subscribe, | ||
60 | list_subscribed, | ||
61 | list_unsubscribe, | ||
62 | list_unsubscribed, | ||
63 | |||
64 | // Warning | ||
65 | stall, | ||
66 | follow_limit, | ||
67 | unknown_warning, | ||
68 | |||
69 | // User ID and tweet ID | ||
70 | deletion, | ||
71 | scrub_location, | ||
72 | |||
73 | // Special | ||
74 | limit, | ||
75 | withhold_status, | ||
76 | withhold_user, | ||
77 | disconnect, | ||
78 | friends, | ||
79 | direct, | ||
80 | |||
81 | // Nothing | ||
82 | unknown, | ||
83 | invalid | ||
84 | }; | ||
85 | |||
86 | type getType() const; | ||
87 | |||
88 | notification(); | ||
89 | notification(std::string data, const user& current_user); | ||
90 | notification(const notification& other); | ||
91 | notification& operator=(const notification& other); | ||
92 | ~notification(); | ||
93 | |||
94 | tweet getTweet() const; | ||
95 | user getUser() const; | ||
96 | list getList() const; | ||
97 | tweet_id getTweetID() const; | ||
98 | user_id getUserID() const; | ||
99 | std::vector<std::string> getCountries() const; | ||
100 | disconnect_code getDisconnectCode() const; | ||
101 | std::set<user_id> getFriends() const; | ||
102 | direct_message getDirectMessage() const; | ||
103 | int getLimit() const; | ||
104 | std::string getWarning() const; | ||
105 | |||
106 | operator bool() const; | ||
107 | |||
108 | private: | ||
109 | union { | ||
110 | tweet _tweet; | ||
111 | user _user; | ||
112 | list _list; | ||
113 | struct { | ||
114 | user _user; | ||
115 | tweet _tweet; | ||
116 | } _user_and_tweet; | ||
117 | struct { | ||
118 | user _user; | ||
119 | list _list; | ||
120 | } _user_and_list; | ||
121 | std::string _warning; | ||
122 | struct { | ||
123 | user_id _user_id; | ||
124 | tweet_id _tweet_id; | ||
125 | } _user_id_and_tweet_id; | ||
126 | int _limit; | ||
127 | struct { | ||
128 | user_id _user_id; | ||
129 | tweet_id _tweet_id; | ||
130 | std::vector<std::string> _countries; | ||
131 | } _withhold_status; | ||
132 | struct { | ||
133 | user_id _user_id; | ||
134 | std::vector<std::string> _countries; | ||
135 | } _withhold_user; | ||
136 | disconnect_code _disconnect; | ||
137 | std::set<user_id> _friends; | ||
138 | direct_message _direct_message; | ||
139 | }; | ||
140 | type _type; | ||
141 | }; | ||
142 | |||
143 | }; | ||
144 | |||
145 | #endif /* end of include guard: NOTIFICATION_H_69AEF4CC */ | ||