Favorite/Createのエンドポイント叩くやつ
This commit is contained in:
@@ -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
|
||||||
@@ -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
|
||||||
@@ -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
|
||||||
@@ -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
|
||||||
Reference in New Issue
Block a user