diff options
author | Kelly Rauchenberger <fefferburbia@gmail.com> | 2016-11-29 16:18:25 -0500 |
---|---|---|
committer | Kelly Rauchenberger <fefferburbia@gmail.com> | 2016-11-29 16:18:25 -0500 |
commit | 7c44fd17bb6be54a2ea4b60761e91053ca988977 (patch) | |
tree | 42f08e0db610617fd0629b117610bfa1a365acaf /src/user.cpp | |
parent | d90a1e74c77ba67f25a812609fd49d479bc464dd (diff) | |
download | libtwittercpp-7c44fd17bb6be54a2ea4b60761e91053ca988977.tar.gz libtwittercpp-7c44fd17bb6be54a2ea4b60761e91053ca988977.tar.bz2 libtwittercpp-7c44fd17bb6be54a2ea4b60761e91053ca988977.zip |
Made tweets, users, and notifications into copyable objects
Notifications are now also mutable. Users and tweets no longer have helper methods for interacting with the client. Fixed a bug (possibly introduced by a change to the Twitter API) that caused non-reply tweets to be marked as unknown notifications.
Diffstat (limited to 'src/user.cpp')
-rw-r--r-- | src/user.cpp | 24 |
1 files changed, 2 insertions, 22 deletions
diff --git a/src/user.cpp b/src/user.cpp index 0b6e93a..f9b02a1 100644 --- a/src/user.cpp +++ b/src/user.cpp | |||
@@ -5,8 +5,8 @@ | |||
5 | 5 | ||
6 | namespace twitter { | 6 | namespace twitter { |
7 | 7 | ||
8 | user::user(const client& tclient, std::string data) try | 8 | user::user(std::string data) try |
9 | : _client(tclient) | 9 | : _valid(true) |
10 | { | 10 | { |
11 | auto json = nlohmann::json::parse(data); | 11 | auto json = nlohmann::json::parse(data); |
12 | _id = json["id"].get<user_id>(); | 12 | _id = json["id"].get<user_id>(); |
@@ -19,25 +19,5 @@ namespace twitter { | |||
19 | { | 19 | { |
20 | std::throw_with_nested(malformed_object("user", data)); | 20 | std::throw_with_nested(malformed_object("user", data)); |
21 | } | 21 | } |
22 | |||
23 | std::set<user_id> user::getFriends() const | ||
24 | { | ||
25 | return _client.getFriends(_id); | ||
26 | } | ||
27 | |||
28 | std::set<user_id> user::getFollowers() const | ||
29 | { | ||
30 | return _client.getFollowers(_id); | ||
31 | } | ||
32 | |||
33 | void user::follow() const | ||
34 | { | ||
35 | _client.follow(_id); | ||
36 | } | ||
37 | |||
38 | void user::unfollow() const | ||
39 | { | ||
40 | _client.unfollow(_id); | ||
41 | } | ||
42 | 22 | ||
43 | }; | 23 | }; |