各種Exceptionの用意(#53)

Tweetオブジェクトを仮実装(#54)
Tweetオブジェクトのパースに当たり、httpPostのステータスコードを取得(#54)
各種オブジェクトにパースするためにhttpPostに渡すコールバックの引数を変更
This commit is contained in:
keita
2021-02-24 14:19:14 +09:00
parent b4497728b1
commit 1505b0b139
12 changed files with 35 additions and 26 deletions
+7 -2
View File
@@ -6,13 +6,18 @@ Update::Update() {
contentType_ = "application/x-www-form-urlencoded";
url_ = "https://api.twitter.com/1.1/statuses/update.json";
}
void Update::status(const std::string _status) {
status_ = _status;
bodyParam_.insert_or_assign("status", status_);
}
void Update::process(std::weak_ptr<CocoaTweet::OAuth::OAuth1> _oauth) {
HttpPost::process(_oauth, [](const std::string& _srv) { std::cout << _srv << std::endl; });
CocoaTweet::API::Model::Tweet Update::process(std::weak_ptr<CocoaTweet::OAuth::OAuth1> _oauth) {
CocoaTweet::API::Model::Tweet tweet;
HttpPost::process(_oauth, [&tweet](const unsigned int _responseCode, const std::string& _rsv) {
tweet = CocoaTweet::API::Model::Tweet::parse(_responseCode, _rsv);
});
return tweet;
}
} // namespace CocoaTweet::API::Statuses