diff options
Diffstat (limited to 'src/client.cpp')
-rw-r--r-- | src/client.cpp | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/src/client.cpp b/src/client.cpp index 0a4cf2a..3a01c90 100644 --- a/src/client.cpp +++ b/src/client.cpp | |||
@@ -384,4 +384,37 @@ namespace twitter { | |||
384 | return result; | 384 | return result; |
385 | } | 385 | } |
386 | 386 | ||
387 | std::list<user> client::hydrateUsers(std::set<user_id> ids) const | ||
388 | { | ||
389 | std::list<user> result; | ||
390 | |||
391 | while (!ids.empty()) | ||
392 | { | ||
393 | std::set<user_id> cur; | ||
394 | |||
395 | for (int i = 0; i < 100 && !ids.empty(); i++) | ||
396 | { | ||
397 | cur.insert(*std::begin(ids)); | ||
398 | ids.erase(std::begin(ids)); | ||
399 | } | ||
400 | |||
401 | std::string datastr = "user_id=" + | ||
402 | OAuth::PercentEncode(implode(std::begin(cur), std::end(cur), ",")); | ||
403 | |||
404 | std::string response = | ||
405 | post(auth_, | ||
406 | "https://api.twitter.com/1.1/users/lookup.json", | ||
407 | datastr).perform(); | ||
408 | |||
409 | nlohmann::json rjs = nlohmann::json::parse(response); | ||
410 | |||
411 | for (auto& single : rjs) | ||
412 | { | ||
413 | result.emplace_back(single.dump()); | ||
414 | } | ||
415 | } | ||
416 | |||
417 | return result; | ||
418 | } | ||
419 | |||
387 | }; | 420 | }; |