From 055ee555b1d6467e018d0effe5a041621444eb02 Mon Sep 17 00:00:00 2001 From: keita Date: Thu, 18 Feb 2021 16:28:25 +0900 Subject: [PATCH] =?UTF-8?q?README=E3=81=A8=E3=81=8Bmain.c=E3=81=AE?= =?UTF-8?q?=E3=82=B5=E3=83=B3=E3=83=97=E3=83=AB=E3=81=A8=E3=81=8B=E5=A4=89?= =?UTF-8?q?=E6=9B=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 10 +++++++--- src/main.cc | 30 +++++++++++++++++------------- 2 files changed, 24 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index 6925f0c..ef8db86 100644 --- a/README.md +++ b/README.md @@ -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"); ``` diff --git a/src/main.cc b/src/main.cc index bbcb220..4007667 100644 --- a/src/main.cc +++ b/src/main.cc @@ -2,20 +2,24 @@ #include "cocoatweet/api/api.h" auto main() -> int { - // キーオブジェクトを作成 - // 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); + // 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); - // 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."); }