statuses/updateをmediaと一緒に叩くやつ(#56)
This commit is contained in:
@@ -13,6 +13,14 @@ CocoaTweet::API::Model::Tweet Status::Update(const std::string& _status) const {
|
||||
return update.process(oauth_);
|
||||
}
|
||||
|
||||
CocoaTweet::API::Model::Tweet Status::Update(const std::string& _status,
|
||||
std::vector<std::string> _mediaId) const {
|
||||
CocoaTweet::API::Statuses::Update update;
|
||||
update.status(_status);
|
||||
update.mediaId(_mediaId);
|
||||
return update.process(oauth_);
|
||||
}
|
||||
|
||||
CocoaTweet::API::Model::Tweet Status::Destroy(const std::string& _id) const {
|
||||
CocoaTweet::API::Statuses::Destroy destroy;
|
||||
destroy.id(_id);
|
||||
|
||||
@@ -4,6 +4,7 @@
|
||||
#include "cocoatweet/api/interface/groupInterface.h"
|
||||
#include "cocoatweet/oauth/oauth.h"
|
||||
#include <cocoatweet/api/model/tweet.h>
|
||||
#include <vector>
|
||||
|
||||
namespace CocoaTweet::API::Statuses {
|
||||
class Status : public groupInterface {
|
||||
@@ -11,6 +12,10 @@ public:
|
||||
Status() = default;
|
||||
Status(std::shared_ptr<CocoaTweet::OAuth::OAuth1> _oauth);
|
||||
CocoaTweet::API::Model::Tweet Update(const std::string& _status) const;
|
||||
|
||||
CocoaTweet::API::Model::Tweet Update(const std::string& _status,
|
||||
std::vector<std::string> _mediaId) const;
|
||||
|
||||
CocoaTweet::API::Model::Tweet Destroy(const std::string& _id) const;
|
||||
|
||||
private:
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#include "cocoatweet/api/status/update.h"
|
||||
#include <cocoatweet/util/util.h>
|
||||
|
||||
namespace CocoaTweet::API::Statuses {
|
||||
Update::Update() {
|
||||
@@ -11,6 +12,10 @@ void Update::status(const std::string _status) {
|
||||
bodyParam_.insert_or_assign("status", status_);
|
||||
}
|
||||
|
||||
void Update::mediaId(const std::vector<std::string> _media) {
|
||||
bodyParam_.insert_or_assign("media_ids", CocoaTweet::Util::join(_media, ","));
|
||||
}
|
||||
|
||||
CocoaTweet::API::Model::Tweet Update::process(std::weak_ptr<CocoaTweet::OAuth::OAuth1> _oauth) {
|
||||
CocoaTweet::API::Model::Tweet tweet;
|
||||
HttpPost::process(_oauth,
|
||||
|
||||
@@ -4,12 +4,16 @@
|
||||
#include <memory>
|
||||
#include <cocoatweet/api/interface/httpPost.h>
|
||||
#include <cocoatweet/api/model/tweet.h>
|
||||
#include <vector>
|
||||
|
||||
namespace CocoaTweet::API::Statuses {
|
||||
class Update : public CocoaTweet::API::Interface::HttpPost {
|
||||
public:
|
||||
Update();
|
||||
void status(const std::string _status);
|
||||
|
||||
void mediaId(const std::vector<std::string> _media);
|
||||
|
||||
CocoaTweet::API::Model::Tweet process(std::weak_ptr<CocoaTweet::OAuth::OAuth1> _oauth);
|
||||
|
||||
private:
|
||||
|
||||
Reference in New Issue
Block a user