整形
This commit is contained in:
@@ -1,9 +1,10 @@
|
|||||||
#include <cocoatweet/api/interface/postInterface.h>
|
#include <cocoatweet/api/interface/postInterface.h>
|
||||||
|
|
||||||
namespace CocoaTweet::API::Interface {
|
namespace CocoaTweet::API::Interface {
|
||||||
size_t postInterface::curlCallback_(char* _ptr, size_t _size, size_t _nmemb, std::string* _stream) {
|
size_t postInterface::curlCallback_(char* _ptr, size_t _size, size_t _nmemb,
|
||||||
|
std::string* _stream) {
|
||||||
int realsize = _size * _nmemb;
|
int realsize = _size * _nmemb;
|
||||||
_stream->append(_ptr, realsize);
|
_stream->append(_ptr, realsize);
|
||||||
return realsize;
|
return realsize;
|
||||||
}
|
}
|
||||||
} // namespace CocoaTweet::API
|
} // namespace CocoaTweet::API::Interface
|
||||||
|
|||||||
@@ -16,6 +16,6 @@ protected:
|
|||||||
std::string url_;
|
std::string url_;
|
||||||
static size_t curlCallback_(char* _ptr, size_t _size, size_t _nmemb, std::string* _stream);
|
static size_t curlCallback_(char* _ptr, size_t _size, size_t _nmemb, std::string* _stream);
|
||||||
};
|
};
|
||||||
} // namespace CocoaTweet::API
|
} // namespace CocoaTweet::API::Interface
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@@ -67,7 +67,7 @@ void Update::process(std::weak_ptr<CocoaTweet::OAuth::OAuth1> _oauth,
|
|||||||
CURLcode res;
|
CURLcode res;
|
||||||
std::string rcv;
|
std::string rcv;
|
||||||
curl = curl_easy_init();
|
curl = curl_easy_init();
|
||||||
url_ = url_;// + "?status=" + status_;
|
url_ = url_; // + "?status=" + status_;
|
||||||
std::cout << "URL : " << url_ << std::endl;
|
std::cout << "URL : " << url_ << std::endl;
|
||||||
if (curl) {
|
if (curl) {
|
||||||
curl_easy_setopt(curl, CURLOPT_URL, url_.c_str());
|
curl_easy_setopt(curl, CURLOPT_URL, url_.c_str());
|
||||||
|
|||||||
+10
-1
@@ -1,12 +1,21 @@
|
|||||||
#include "cocoatweet/oauth/key.h"
|
#include "cocoatweet/oauth/key.h"
|
||||||
#include "cocoatweet/api/api.h"
|
#include "cocoatweet/api/api.h"
|
||||||
|
|
||||||
|
// 下記で使用しているAPI Keyはほぼ本物です.
|
||||||
|
// (再生成したので使用できないが,こんな感じで登録)
|
||||||
auto main() -> int {
|
auto main() -> int {
|
||||||
auto consumerKey = "JRKUmkKFWiC3f7K6msLKaNNuP";
|
auto consumerKey = "JRKUmkKFWiC3f7K6msLKaNNuP";
|
||||||
auto consumerSecret = "dTGI49MHRqa7XIFiPjwJR27vwolzsRaRXKA48iFlwAv4LK9Vlm";
|
auto consumerSecret = "dTGI49MHRqa7XIFiPjwJR27vwolzsRaRXKA48iFlwAv4LK9Vlm";
|
||||||
auto accessToken = "2224351076-uF2XTmYeDdAfIsixuvfrwt8puLiPuwGe4w7RM8I";
|
auto accessToken = "2224351076-uF2XTmYeDdAfIsixuvfrwt8puLiPuwGe4w7RM8I";
|
||||||
auto accessTokenSecret = "dpCctbxzMjQ9AjZ6V7Fs6TIQlpPJo7JEkmjMfSO7QCEpW";
|
auto accessTokenSecret = "dpCctbxzMjQ9AjZ6V7Fs6TIQlpPJo7JEkmjMfSO7QCEpW";
|
||||||
|
|
||||||
|
// キーオブジェクトを作成
|
||||||
CocoaTweet::OAuth::Key key(consumerKey, consumerSecret, accessToken, accessTokenSecret);
|
CocoaTweet::OAuth::Key key(consumerKey, consumerSecret, accessToken, accessTokenSecret);
|
||||||
|
|
||||||
|
// 作成したキーオブジェクトを用いてAPIを立ち上げる.
|
||||||
|
// 内部的にはキーオブジェクトを使用してOAuth認証機を立ち上げている.
|
||||||
CocoaTweet::API::API api(key);
|
CocoaTweet::API::API api(key);
|
||||||
api.status().Update("tweet_from_Cocoa_Twitter_Library");
|
|
||||||
|
// クエリ文字列をURLエンコードしてないので,空白とか日本語とかはまだ無理.
|
||||||
|
api.status().Update("test");
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user