RTを叩くやつ(#65)

This commit is contained in:
keita
2021-03-14 23:17:42 +09:00
parent f35598c8ae
commit 33cb1f3e18
2 changed files with 39 additions and 0 deletions
+21
View File
@@ -0,0 +1,21 @@
#include <cocoatweet/api/status/retweet.h>
#include <iostream>
namespace CocoaTweet::API::Statuses {
Retweet::Retweet(){}
void Retweet::id(const std::string& _id){
contentType_ = "application/x-www-form-urlencoded";
url_ = "https://api.twitter.com/1.1/statuses/retweet/" + _id + ".json";
}
CocoaTweet::API::Model::Tweet Retweet::process(std::weak_ptr<CocoaTweet::OAuth::OAuth1> _oauth){
CocoaTweet::API::Model::Tweet tweet;
HttpPost::process(_oauth,
[&tweet](const unsigned int _responseCode, const std::string& _rcv) {
tweet = CocoaTweet::API::Model::Tweet(_responseCode, _rcv);
});
return tweet;
}
}
+18
View File
@@ -0,0 +1,18 @@
#ifndef COCOATWEET_API_STATUS_RETWEET_H_
#define COCOATWEET_API_STATUS_RETWEET_H_
#include <cocoatweet/api/interface/httpPost.h>
#include <cocoatweet/api/model/tweet.h>
namespace CocoaTweet::API::Statuses {
class Retweet : public CocoaTweet::API::Interface::HttpPost{
public:
Retweet();
void id(const std::string& _id);
CocoaTweet::API::Model::Tweet process(std::weak_ptr<CocoaTweet::OAuth::OAuth1> _oauth);
};
}
#endif