diff --git a/src/cocoatweet/api/favorite/create.cc b/src/cocoatweet/api/favorite/create.cc new file mode 100644 index 0000000..fe28295 --- /dev/null +++ b/src/cocoatweet/api/favorite/create.cc @@ -0,0 +1,11 @@ +#include + +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 diff --git a/src/cocoatweet/api/favorite/create.h b/src/cocoatweet/api/favorite/create.h new file mode 100644 index 0000000..2d1e873 --- /dev/null +++ b/src/cocoatweet/api/favorite/create.h @@ -0,0 +1,16 @@ +#ifndef COCOATWEET_API_FAVORITE_CREATE_H_ +#define COCOATWEET_API_FAVORITE_CREATE_H_ + +#include + +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 diff --git a/src/cocoatweet/api/favorite/favorite.cc b/src/cocoatweet/api/favorite/favorite.cc new file mode 100644 index 0000000..6d8737d --- /dev/null +++ b/src/cocoatweet/api/favorite/favorite.cc @@ -0,0 +1,16 @@ +#include + +#include "cocoatweet/api/favorite/favorite.h" +#include "cocoatweet/api/favorite/create.h" + +namespace CocoaTweet::API::Favorites { +Favorite::Favorite(std::shared_ptr _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 diff --git a/src/cocoatweet/api/favorite/favorite.h b/src/cocoatweet/api/favorite/favorite.h new file mode 100644 index 0000000..33ff8db --- /dev/null +++ b/src/cocoatweet/api/favorite/favorite.h @@ -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 _oauth); + void Create(const std::string& _id) const; +}; +} // namespace CocoaTweet::API::Favorites + +#endif