interfaceをチョットいじった
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
#include <cocoatweet/api/favorite/create.h>
|
||||
|
||||
#include <iostream>
|
||||
namespace CocoaTweet::API::Favorites {
|
||||
Create::Create() {
|
||||
contentType_ = "application/x-www-form-urlencoded";
|
||||
@@ -11,7 +11,7 @@ void Create::id(const std::string& _id) {
|
||||
}
|
||||
|
||||
void Create::process(std::weak_ptr<CocoaTweet::OAuth::OAuth1> _oauth) {
|
||||
postInterface::process(_oauth,
|
||||
HttpPost::process(_oauth,
|
||||
[](const std::string& _srv) { std::cout << _srv << std::endl; });
|
||||
}
|
||||
} // namespace CocoaTweet::API::Favorites
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
#ifndef COCOATWEET_API_FAVORITE_CREATE_H_
|
||||
#define COCOATWEET_API_FAVORITE_CREATE_H_
|
||||
|
||||
#include <cocoatweet/api/interface/postInterface.h>
|
||||
#include <cocoatweet/api/interface/httpPost.h>
|
||||
|
||||
namespace CocoaTweet::API::Favorites {
|
||||
class Create : public CocoaTweet::API::Interface::postInterface {
|
||||
class Create : public CocoaTweet::API::Interface::HttpPost {
|
||||
public:
|
||||
Create();
|
||||
void id(const std::string& _id);
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#include <cocoatweet/api/favorite/destroy.h>
|
||||
|
||||
#include <iostream>
|
||||
namespace CocoaTweet::API::Favorites {
|
||||
Destroy::Destroy() {
|
||||
contentType_ = "application/x-www-form-urlencoded";
|
||||
@@ -11,7 +11,7 @@ void Destroy::id(const std::string& _id) {
|
||||
}
|
||||
|
||||
void Destroy::process(std::weak_ptr<CocoaTweet::OAuth::OAuth1> _oauth) {
|
||||
postInterface::process(_oauth,
|
||||
HttpPost::process(_oauth,
|
||||
[](const std::string& _srv) { std::cout << _srv << std::endl; });
|
||||
}
|
||||
} // namespace CocoaTweet::API::Favorites
|
||||
|
||||
@@ -1,10 +1,10 @@
|
||||
#ifndef COCOATWEET_API_FAVORITE_DESTROY_H_
|
||||
#define COCOATWEET_API_FAVORITE_DESTROY_H_
|
||||
|
||||
#include <cocoatweet/api/interface/postInterface.h>
|
||||
#include <cocoatweet/api/interface/httpPost.h>
|
||||
|
||||
namespace CocoaTweet::API::Favorites {
|
||||
class Destroy : public CocoaTweet::API::Interface::postInterface {
|
||||
class Destroy : public CocoaTweet::API::Interface::HttpPost {
|
||||
public:
|
||||
Destroy();
|
||||
void id(const std::string& _id);
|
||||
|
||||
+3
-3
@@ -1,4 +1,4 @@
|
||||
#include <cocoatweet/api/interface/postInterface.h>
|
||||
#include <cocoatweet/api/interface/httpPost.h>
|
||||
#include "cocoatweet/util/util.h"
|
||||
#include <iterator>
|
||||
#include <memory>
|
||||
@@ -10,14 +10,14 @@ extern "C" {
|
||||
}
|
||||
|
||||
namespace CocoaTweet::API::Interface {
|
||||
size_t postInterface::curlCallback_(char* _ptr, size_t _size, size_t _nmemb,
|
||||
size_t HttpPost::curlCallback_(char* _ptr, size_t _size, size_t _nmemb,
|
||||
std::string* _stream) {
|
||||
int realsize = _size * _nmemb;
|
||||
_stream->append(_ptr, realsize);
|
||||
return realsize;
|
||||
}
|
||||
|
||||
void postInterface::process(std::weak_ptr<CocoaTweet::OAuth::OAuth1> _oauth,
|
||||
void HttpPost::process(std::weak_ptr<CocoaTweet::OAuth::OAuth1> _oauth,
|
||||
std::function<void(std::string)> _callback) {
|
||||
// エンドポイントへのパラメータにOAuthパラメータを付加して署名作成
|
||||
auto oauth = _oauth.lock();
|
||||
+2
-2
@@ -3,11 +3,11 @@
|
||||
|
||||
#include <functional>
|
||||
#include "cocoatweet/oauth/oauth.h"
|
||||
#include <iostream>
|
||||
|
||||
namespace CocoaTweet::API::Interface {
|
||||
class postInterface {
|
||||
class HttpPost {
|
||||
public:
|
||||
|
||||
protected:
|
||||
std::weak_ptr<CocoaTweet::OAuth::OAuth1> oauth_;
|
||||
std::map<std::string, std::string> bodyParam_;
|
||||
@@ -1,5 +1,5 @@
|
||||
#include "cocoatweet/api/status/destroy.h"
|
||||
|
||||
#include <iostream>
|
||||
namespace CocoaTweet::API::Statuses {
|
||||
Destroy::Destroy() {}
|
||||
void Destroy::id(const std::string _id) {
|
||||
@@ -8,7 +8,7 @@ void Destroy::id(const std::string _id) {
|
||||
}
|
||||
|
||||
void Destroy::process(std::weak_ptr<CocoaTweet::OAuth::OAuth1> _oauth) {
|
||||
postInterface::process(_oauth,
|
||||
HttpPost::process(_oauth,
|
||||
[](const std::string& _srv) { std::cout << _srv << std::endl; });
|
||||
}
|
||||
|
||||
|
||||
@@ -3,11 +3,11 @@
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "cocoatweet/api/interface/postInterface.h"
|
||||
#include "cocoatweet/api/interface/httpPost.h"
|
||||
//#include "cocoatweet/oauth/oauth.h"
|
||||
|
||||
namespace CocoaTweet::API::Statuses {
|
||||
class Destroy : public CocoaTweet::API::Interface::postInterface {
|
||||
class Destroy : public CocoaTweet::API::Interface::HttpPost {
|
||||
public:
|
||||
Destroy();
|
||||
void id(const std::string _id);
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
#include "cocoatweet/api/status/update.h"
|
||||
#include <iostream>
|
||||
|
||||
namespace CocoaTweet::API::Statuses {
|
||||
Update::Update() {
|
||||
@@ -11,7 +12,7 @@ void Update::status(const std::string _status) {
|
||||
}
|
||||
|
||||
void Update::process(std::weak_ptr<CocoaTweet::OAuth::OAuth1> _oauth) {
|
||||
postInterface::process(_oauth,
|
||||
HttpPost::process(_oauth,
|
||||
[](const std::string& _srv) { std::cout << _srv << std::endl; });
|
||||
}
|
||||
|
||||
|
||||
@@ -2,12 +2,11 @@
|
||||
#define COCOATWEET_API_STATUSES_UPDATE_H_
|
||||
|
||||
#include <memory>
|
||||
|
||||
#include "cocoatweet/api/interface/postInterface.h"
|
||||
#include "cocoatweet/api/interface/httpPost.h"
|
||||
//#include "cocoatweet/oauth/oauth.h"
|
||||
|
||||
namespace CocoaTweet::API::Statuses {
|
||||
class Update : public CocoaTweet::API::Interface::postInterface {
|
||||
class Update : public CocoaTweet::API::Interface::HttpPost {
|
||||
public:
|
||||
Update();
|
||||
void status(const std::string _status);
|
||||
|
||||
Reference in New Issue
Block a user