From 788eda9d4a3a2e09d2164ba53214f187f117e72c Mon Sep 17 00:00:00 2001 From: keita Date: Sat, 20 Feb 2021 23:03:29 +0900 Subject: [PATCH] =?UTF-8?q?=E6=95=B4=E5=BD=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/cocoatweet/api/favorite/create.cc | 7 ++++--- src/cocoatweet/api/favorite/destroy.cc | 7 ++++--- src/cocoatweet/api/interface/postInterface.cc | 2 +- src/cocoatweet/api/interface/postInterface.h | 1 - src/cocoatweet/api/status/destroy.cc | 7 ++++--- src/cocoatweet/api/status/update.cc | 7 ++++--- 6 files changed, 17 insertions(+), 14 deletions(-) diff --git a/src/cocoatweet/api/favorite/create.cc b/src/cocoatweet/api/favorite/create.cc index 8e447e6..8ba2e2e 100644 --- a/src/cocoatweet/api/favorite/create.cc +++ b/src/cocoatweet/api/favorite/create.cc @@ -3,14 +3,15 @@ namespace CocoaTweet::API::Favorites { Create::Create() { contentType_ = "application/x-www-form-urlencoded"; - url_ = "https://api.twitter.com/1.1/favorites/create.json"; + url_ = "https://api.twitter.com/1.1/favorites/create.json"; } void Create::id(const std::string& _id) { bodyParam_.insert_or_assign("id", _id); } -void Create::process(std::weak_ptr _oauth){ - postInterface::process(_oauth, [](const std::string& _srv){std::cout << _srv << std::endl;}); +void Create::process(std::weak_ptr _oauth) { + postInterface::process(_oauth, + [](const std::string& _srv) { std::cout << _srv << std::endl; }); } } // namespace CocoaTweet::API::Favorites diff --git a/src/cocoatweet/api/favorite/destroy.cc b/src/cocoatweet/api/favorite/destroy.cc index cae4689..ff0fb5e 100644 --- a/src/cocoatweet/api/favorite/destroy.cc +++ b/src/cocoatweet/api/favorite/destroy.cc @@ -3,14 +3,15 @@ namespace CocoaTweet::API::Favorites { Destroy::Destroy() { contentType_ = "application/x-www-form-urlencoded"; - url_ = "https://api.twitter.com/1.1/favorites/destroy.json"; + url_ = "https://api.twitter.com/1.1/favorites/destroy.json"; } void Destroy::id(const std::string& _id) { bodyParam_.insert_or_assign("id", _id); } -void Destroy::process(std::weak_ptr _oauth){ - postInterface::process(_oauth, [](const std::string& _srv){std::cout << _srv << std::endl;}); +void Destroy::process(std::weak_ptr _oauth) { + postInterface::process(_oauth, + [](const std::string& _srv) { std::cout << _srv << std::endl; }); } } // namespace CocoaTweet::API::Favorites diff --git a/src/cocoatweet/api/interface/postInterface.cc b/src/cocoatweet/api/interface/postInterface.cc index bdf3035..ad49ace 100644 --- a/src/cocoatweet/api/interface/postInterface.cc +++ b/src/cocoatweet/api/interface/postInterface.cc @@ -23,7 +23,7 @@ void postInterface::process(std::weak_ptr _oauth, auto oauth = _oauth.lock(); auto oauthParam = oauth->oauthParam(); auto sigingParam = oauthParam; - if(contentType_ == "application/x-www-form-urlencoded"){ + if (contentType_ == "application/x-www-form-urlencoded") { for (const auto [k, v] : bodyParam_) { sigingParam.insert_or_assign(k, v); } diff --git a/src/cocoatweet/api/interface/postInterface.h b/src/cocoatweet/api/interface/postInterface.h index 71be2c4..eeba218 100644 --- a/src/cocoatweet/api/interface/postInterface.h +++ b/src/cocoatweet/api/interface/postInterface.h @@ -8,7 +8,6 @@ namespace CocoaTweet::API::Interface { class postInterface { public: - protected: std::weak_ptr oauth_; std::map bodyParam_; diff --git a/src/cocoatweet/api/status/destroy.cc b/src/cocoatweet/api/status/destroy.cc index 2424202..61073ea 100644 --- a/src/cocoatweet/api/status/destroy.cc +++ b/src/cocoatweet/api/status/destroy.cc @@ -4,11 +4,12 @@ namespace CocoaTweet::API::Statuses { Destroy::Destroy() {} void Destroy::id(const std::string _id) { contentType_ = "application/x-www-form-urlencoded"; - url_ = "https://api.twitter.com/1.1/statuses/destroy/" + _id + ".json"; + url_ = "https://api.twitter.com/1.1/statuses/destroy/" + _id + ".json"; } -void Destroy::process(std::weak_ptr _oauth){ - postInterface::process(_oauth, [](const std::string& _srv){std::cout << _srv << std::endl;}); +void Destroy::process(std::weak_ptr _oauth) { + postInterface::process(_oauth, + [](const std::string& _srv) { std::cout << _srv << std::endl; }); } } // namespace CocoaTweet::API::Statuses diff --git a/src/cocoatweet/api/status/update.cc b/src/cocoatweet/api/status/update.cc index d09106a..66f71d8 100644 --- a/src/cocoatweet/api/status/update.cc +++ b/src/cocoatweet/api/status/update.cc @@ -3,15 +3,16 @@ namespace CocoaTweet::API::Statuses { Update::Update() { contentType_ = "application/x-www-form-urlencoded"; - url_ = "https://api.twitter.com/1.1/statuses/update.json"; + 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 _oauth){ - postInterface::process(_oauth, [](const std::string& _srv){std::cout << _srv << std::endl;}); +void Update::process(std::weak_ptr _oauth) { + postInterface::process(_oauth, + [](const std::string& _srv) { std::cout << _srv << std::endl; }); } } // namespace CocoaTweet::API::Statuses