Favorite/Createのエンドポイント叩くやつ

This commit is contained in:
keita
2021-02-18 16:02:48 +09:00
parent ae2e3bcf9e
commit 8cab7753b2
4 changed files with 59 additions and 0 deletions
+11
View File
@@ -0,0 +1,11 @@
#include <cocoatweet/api/favorite/create.h>
namespace CocoaTweet::API::Favorites {
Create::Create() {
url_ = "https://api.twitter.com/1.1/favorites/create.json";
}
void Create::id(const std::string& _id) {
bodyParam_.insert_or_assign("id", _id);
}
} // namespace CocoaTweet::API::Favorites
+16
View File
@@ -0,0 +1,16 @@
#ifndef COCOATWEET_API_FAVORITE_CREATE_H_
#define COCOATWEET_API_FAVORITE_CREATE_H_
#include <cocoatweet/api/interface/postInterface.h>
namespace CocoaTweet::API::Favorites {
class Create : public CocoaTweet::API::Interface::postInterface {
public:
Create();
void id(const std::string& _id);
private:
};
} // namespace CocoaTweet::API::Favorites
#endif
+16
View File
@@ -0,0 +1,16 @@
#include <iostream>
#include "cocoatweet/api/favorite/favorite.h"
#include "cocoatweet/api/favorite/create.h"
namespace CocoaTweet::API::Favorites {
Favorite::Favorite(std::shared_ptr<CocoaTweet::OAuth::OAuth1> _oauth) {
oauth_ = _oauth;
}
void Favorite::Create(const std::string& _id) const {
CocoaTweet::API::Favorites::Create create;
create.id(_id);
create.process(oauth_, [](std::string _rcv) { std::cout << _rcv << std::endl; });
}
} // namespace CocoaTweet::API::Favorites
+16
View File
@@ -0,0 +1,16 @@
#ifndef COCOATWEET_API_FAVORITE_FAVORITE_H_
#define COCOATWEET_API_FAVORITE_FAVORITE_H_
#include "cocoatweet/api/interface/groupInterface.h"
#include "cocoatweet/oauth/oauth.h"
namespace CocoaTweet::API::Favorites {
class Favorite : public groupInterface {
public:
Favorite() = default;
Favorite(std::shared_ptr<CocoaTweet::OAuth::OAuth1> _oauth);
void Create(const std::string& _id) const;
};
} // namespace CocoaTweet::API::Favorites
#endif