READMEとかmain.cのサンプルとか変更
This commit is contained in:
@@ -6,9 +6,10 @@ This is a library for using Twitter API from C++
|
||||
- libssl
|
||||
|
||||
# Features
|
||||
you can use these endpoint
|
||||
- statuses/update
|
||||
- favorites/create
|
||||
|
||||
Now, only post a tweet.
|
||||
|
||||
# How
|
||||
## API Key Registration
|
||||
@@ -56,8 +57,11 @@ CocoaTweet::API::API api(key);
|
||||
|
||||
```
|
||||
|
||||
## Post Tweet
|
||||
post tweet
|
||||
## Use API
|
||||
```
|
||||
// Post a tweet
|
||||
api.status().Update("Hello, World!!\nTweet from Cocoa Twitter Library");
|
||||
|
||||
// Fav. to tweet
|
||||
api.favorite().Create("tweet id");
|
||||
```
|
||||
|
||||
+13
-9
@@ -2,20 +2,24 @@
|
||||
#include "cocoatweet/api/api.h"
|
||||
|
||||
auto main() -> int {
|
||||
// キーオブジェクトを作成
|
||||
// Generate Key object
|
||||
// auto consumerKey = "your consumer key";
|
||||
// auto consumerSecret = "your consumer secret";
|
||||
// auto accessToken = "your access token";
|
||||
// auto accessTokenSecret = "your access token secret";
|
||||
// CocoaTweet::OAuth::Key key = CocoaTweet::OAuth::Key(consumerKey, consumerSecret,
|
||||
// accessToken, accessTokenSecret);
|
||||
// CocoaTweet::OAuth::Key key = CocoaTweet::OAuth::Key(consumerKey,
|
||||
// consumerSecret,
|
||||
// accessToken,
|
||||
// accessTokenSecret);
|
||||
|
||||
// jsonファイルから各種キーを読み込むことも可能
|
||||
CocoaTweet::OAuth::Key key = CocoaTweet::OAuth::Key::fromJsonFile("apikey.json");
|
||||
|
||||
// 作成したキーオブジェクトを用いてAPIを立ち上げる.
|
||||
// 内部的にはキーオブジェクトを使用してOAuth認証機を立ち上げている.
|
||||
CocoaTweet::API::API api(key);
|
||||
// also can generate Key object from JSON file
|
||||
// CocoaTweet::OAuth::Key key = CocoaTweet::OAuth::Key::fromJsonFile("api_key.json");
|
||||
|
||||
api.status().Update("Hello Twitter World from Cocoa Twitter Library");
|
||||
// Generate API Entry object using Key object
|
||||
// CocoaTweet::API::API api(key);
|
||||
|
||||
// Now, you can use a twitter api
|
||||
// api.status().Update("Hello Twitter World from Cocoa Twitter Library");
|
||||
// api.favorite().Create("tweet id you want to fav.");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user