This commit is contained in:
keita
2021-02-17 10:53:42 +09:00
parent a4df859af9
commit e87f59bd94
4 changed files with 15 additions and 5 deletions
@@ -1,9 +1,10 @@
#include <cocoatweet/api/interface/postInterface.h>
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;
_stream->append(_ptr, realsize);
return realsize;
}
} // namespace CocoaTweet::API
} // namespace CocoaTweet::API::Interface
+1 -1
View File
@@ -16,6 +16,6 @@ protected:
std::string url_;
static size_t curlCallback_(char* _ptr, size_t _size, size_t _nmemb, std::string* _stream);
};
} // namespace CocoaTweet::API
} // namespace CocoaTweet::API::Interface
#endif
+10 -1
View File
@@ -1,12 +1,21 @@
#include "cocoatweet/oauth/key.h"
#include "cocoatweet/api/api.h"
// 下記で使用しているAPI Keyはほぼ本物です.
// (再生成したので使用できないが,こんな感じで登録)
auto main() -> int {
auto consumerKey = "JRKUmkKFWiC3f7K6msLKaNNuP";
auto consumerSecret = "dTGI49MHRqa7XIFiPjwJR27vwolzsRaRXKA48iFlwAv4LK9Vlm";
auto accessToken = "2224351076-uF2XTmYeDdAfIsixuvfrwt8puLiPuwGe4w7RM8I";
auto accessTokenSecret = "dpCctbxzMjQ9AjZ6V7Fs6TIQlpPJo7JEkmjMfSO7QCEpW";
// キーオブジェクトを作成
CocoaTweet::OAuth::Key key(consumerKey, consumerSecret, accessToken, accessTokenSecret);
// 作成したキーオブジェクトを用いてAPIを立ち上げる.
// 内部的にはキーオブジェクトを使用してOAuth認証機を立ち上げている.
CocoaTweet::API::API api(key);
api.status().Update("tweet_from_Cocoa_Twitter_Library");
// クエリ文字列をURLエンコードしてないので,空白とか日本語とかはまだ無理.
api.status().Update("test");
}