interface周りの負債を改善

This commit is contained in:
keita
2021-02-20 22:29:49 +09:00
parent a62d0fe7ff
commit 8600dff037
12 changed files with 36 additions and 8 deletions
+5
View File
@@ -3,7 +3,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";
}
void Destroy::process(std::weak_ptr<CocoaTweet::OAuth::OAuth1> _oauth){
postInterface::process(_oauth, [](const std::string& _srv){std::cout << _srv << std::endl;});
}
} // namespace CocoaTweet::API::Statuses
+1
View File
@@ -11,6 +11,7 @@ class Destroy : public CocoaTweet::API::Interface::postInterface {
public:
Destroy();
void id(const std::string _id);
void process(std::weak_ptr<CocoaTweet::OAuth::OAuth1> _oauth);
};
} // namespace CocoaTweet::API::Statuses
+2 -2
View File
@@ -12,12 +12,12 @@ Status::Status(std::shared_ptr<CocoaTweet::OAuth::OAuth1> _oauth) {
void Status::Update(const std::string& _status) const {
CocoaTweet::API::Statuses::Update update;
update.status(_status);
update.process(oauth_, [](std::string _rcv) { std::cout << _rcv << std::endl; });
update.process(oauth_);
}
void Status::Destroy(const std::string& _id) const {
CocoaTweet::API::Statuses::Destroy destroy;
destroy.id(_id);
destroy.process(oauth_, [](std::string _rcv) { std::cout << _rcv << std::endl; });
destroy.process(oauth_);
}
} // namespace CocoaTweet::API::Statuses
+5
View File
@@ -2,6 +2,7 @@
namespace CocoaTweet::API::Statuses {
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) {
@@ -9,4 +10,8 @@ void Update::status(const std::string _status) {
bodyParam_.insert_or_assign("status", status_);
}
void Update::process(std::weak_ptr<CocoaTweet::OAuth::OAuth1> _oauth){
postInterface::process(_oauth, [](const std::string& _srv){std::cout << _srv << std::endl;});
}
} // namespace CocoaTweet::API::Statuses
+1
View File
@@ -11,6 +11,7 @@ class Update : public CocoaTweet::API::Interface::postInterface {
public:
Update();
void status(const std::string _status);
void process(std::weak_ptr<CocoaTweet::OAuth::OAuth1> _oauth);
private:
std::string status_;