整形
This commit is contained in:
@@ -3,14 +3,15 @@
|
|||||||
namespace CocoaTweet::API::Favorites {
|
namespace CocoaTweet::API::Favorites {
|
||||||
Create::Create() {
|
Create::Create() {
|
||||||
contentType_ = "application/x-www-form-urlencoded";
|
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) {
|
void Create::id(const std::string& _id) {
|
||||||
bodyParam_.insert_or_assign("id", _id);
|
bodyParam_.insert_or_assign("id", _id);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Create::process(std::weak_ptr<CocoaTweet::OAuth::OAuth1> _oauth){
|
void Create::process(std::weak_ptr<CocoaTweet::OAuth::OAuth1> _oauth) {
|
||||||
postInterface::process(_oauth, [](const std::string& _srv){std::cout << _srv << std::endl;});
|
postInterface::process(_oauth,
|
||||||
|
[](const std::string& _srv) { std::cout << _srv << std::endl; });
|
||||||
}
|
}
|
||||||
} // namespace CocoaTweet::API::Favorites
|
} // namespace CocoaTweet::API::Favorites
|
||||||
|
|||||||
@@ -3,14 +3,15 @@
|
|||||||
namespace CocoaTweet::API::Favorites {
|
namespace CocoaTweet::API::Favorites {
|
||||||
Destroy::Destroy() {
|
Destroy::Destroy() {
|
||||||
contentType_ = "application/x-www-form-urlencoded";
|
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) {
|
void Destroy::id(const std::string& _id) {
|
||||||
bodyParam_.insert_or_assign("id", _id);
|
bodyParam_.insert_or_assign("id", _id);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Destroy::process(std::weak_ptr<CocoaTweet::OAuth::OAuth1> _oauth){
|
void Destroy::process(std::weak_ptr<CocoaTweet::OAuth::OAuth1> _oauth) {
|
||||||
postInterface::process(_oauth, [](const std::string& _srv){std::cout << _srv << std::endl;});
|
postInterface::process(_oauth,
|
||||||
|
[](const std::string& _srv) { std::cout << _srv << std::endl; });
|
||||||
}
|
}
|
||||||
} // namespace CocoaTweet::API::Favorites
|
} // namespace CocoaTweet::API::Favorites
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ void postInterface::process(std::weak_ptr<CocoaTweet::OAuth::OAuth1> _oauth,
|
|||||||
auto oauth = _oauth.lock();
|
auto oauth = _oauth.lock();
|
||||||
auto oauthParam = oauth->oauthParam();
|
auto oauthParam = oauth->oauthParam();
|
||||||
auto sigingParam = oauthParam;
|
auto sigingParam = oauthParam;
|
||||||
if(contentType_ == "application/x-www-form-urlencoded"){
|
if (contentType_ == "application/x-www-form-urlencoded") {
|
||||||
for (const auto [k, v] : bodyParam_) {
|
for (const auto [k, v] : bodyParam_) {
|
||||||
sigingParam.insert_or_assign(k, v);
|
sigingParam.insert_or_assign(k, v);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,7 +8,6 @@
|
|||||||
namespace CocoaTweet::API::Interface {
|
namespace CocoaTweet::API::Interface {
|
||||||
class postInterface {
|
class postInterface {
|
||||||
public:
|
public:
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
std::weak_ptr<CocoaTweet::OAuth::OAuth1> oauth_;
|
std::weak_ptr<CocoaTweet::OAuth::OAuth1> oauth_;
|
||||||
std::map<std::string, std::string> bodyParam_;
|
std::map<std::string, std::string> bodyParam_;
|
||||||
|
|||||||
@@ -4,11 +4,12 @@ namespace CocoaTweet::API::Statuses {
|
|||||||
Destroy::Destroy() {}
|
Destroy::Destroy() {}
|
||||||
void Destroy::id(const std::string _id) {
|
void Destroy::id(const std::string _id) {
|
||||||
contentType_ = "application/x-www-form-urlencoded";
|
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<CocoaTweet::OAuth::OAuth1> _oauth){
|
void Destroy::process(std::weak_ptr<CocoaTweet::OAuth::OAuth1> _oauth) {
|
||||||
postInterface::process(_oauth, [](const std::string& _srv){std::cout << _srv << std::endl;});
|
postInterface::process(_oauth,
|
||||||
|
[](const std::string& _srv) { std::cout << _srv << std::endl; });
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace CocoaTweet::API::Statuses
|
} // namespace CocoaTweet::API::Statuses
|
||||||
|
|||||||
@@ -3,15 +3,16 @@
|
|||||||
namespace CocoaTweet::API::Statuses {
|
namespace CocoaTweet::API::Statuses {
|
||||||
Update::Update() {
|
Update::Update() {
|
||||||
contentType_ = "application/x-www-form-urlencoded";
|
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) {
|
void Update::status(const std::string _status) {
|
||||||
status_ = _status;
|
status_ = _status;
|
||||||
bodyParam_.insert_or_assign("status", status_);
|
bodyParam_.insert_or_assign("status", status_);
|
||||||
}
|
}
|
||||||
|
|
||||||
void Update::process(std::weak_ptr<CocoaTweet::OAuth::OAuth1> _oauth){
|
void Update::process(std::weak_ptr<CocoaTweet::OAuth::OAuth1> _oauth) {
|
||||||
postInterface::process(_oauth, [](const std::string& _srv){std::cout << _srv << std::endl;});
|
postInterface::process(_oauth,
|
||||||
|
[](const std::string& _srv) { std::cout << _srv << std::endl; });
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace CocoaTweet::API::Statuses
|
} // namespace CocoaTweet::API::Statuses
|
||||||
|
|||||||
Reference in New Issue
Block a user