smallCamelCaseに変更
This commit is contained in:
@@ -118,30 +118,30 @@ CocoaTweet::API::API api(key);
|
|||||||
## Use API
|
## Use API
|
||||||
```
|
```
|
||||||
// Post a tweet
|
// Post a tweet
|
||||||
api.status().Update("Hello, World!!\nTweet from Cocoa Twitter Library");
|
api.status().update("Hello, World!!\nTweet from Cocoa Twitter Library");
|
||||||
|
|
||||||
// Upload a media
|
// Upload a media
|
||||||
auto media1 = api.media().Upload("path/to/file/image.jpeg");
|
auto media1 = api.media().Upload("path/to/file/image.jpeg");
|
||||||
auto media2 = api.media().Upload("path/to/file/image2.png");
|
auto media2 = api.media().Upload("path/to/file/image2.png");
|
||||||
api.status().Update("Upload media from Cocoa Twitter Library", std::vector<std::string>{media1.id(), media2.id()});
|
api.status().update("Upload media from Cocoa Twitter Library", std::vector<std::string>{media1.id(), media2.id()});
|
||||||
|
|
||||||
// Retweet a tweet
|
// Retweet a tweet
|
||||||
api.status().Retweet("tweet id");
|
api.status().retweet("tweet id");
|
||||||
|
|
||||||
// un RT a tweet
|
// un RT a tweet
|
||||||
api.status().Unretweet("tweet id")
|
api.status().unretweet("tweet id")
|
||||||
|
|
||||||
// Delete a tweet
|
// Delete a tweet
|
||||||
api.status().Destroy("tweet id");
|
api.status().destroy("tweet id");
|
||||||
|
|
||||||
// Fav. a tweet
|
// Fav. a tweet
|
||||||
api.favorite().Create("tweet id");
|
api.favorite().create("tweet id");
|
||||||
|
|
||||||
// un Fav. a tweet
|
// un Fav. a tweet
|
||||||
api.favorite().Destroy("tweet id");
|
api.favorite().destroy("tweet id");
|
||||||
|
|
||||||
// get a timeline with screen name
|
// get a timeline with screen name
|
||||||
auto timeline = api.status().UserTimeline("milkcocoa0902");
|
auto timeline = api.status().userTimeline("milkcocoa0902");
|
||||||
|
|
||||||
// send a direct message
|
// send a direct message
|
||||||
// you cau get recipient_id using https://idtwi.com/
|
// you cau get recipient_id using https://idtwi.com/
|
||||||
|
|||||||
@@ -7,13 +7,13 @@ Favorite::Favorite(std::shared_ptr<CocoaTweet::OAuth::OAuth1> _oauth) {
|
|||||||
oauth_ = _oauth;
|
oauth_ = _oauth;
|
||||||
}
|
}
|
||||||
|
|
||||||
CocoaTweet::API::Model::Tweet Favorite::Create(const std::string& _id) const {
|
CocoaTweet::API::Model::Tweet Favorite::create(const std::string& _id) const {
|
||||||
CocoaTweet::API::Favorites::Create create;
|
CocoaTweet::API::Favorites::Create create;
|
||||||
create.id(_id);
|
create.id(_id);
|
||||||
return create.process(oauth_);
|
return create.process(oauth_);
|
||||||
}
|
}
|
||||||
|
|
||||||
CocoaTweet::API::Model::Tweet Favorite::Destroy(const std::string& _id) const {
|
CocoaTweet::API::Model::Tweet Favorite::destroy(const std::string& _id) const {
|
||||||
CocoaTweet::API::Favorites::Destroy destroy;
|
CocoaTweet::API::Favorites::Destroy destroy;
|
||||||
destroy.id(_id);
|
destroy.id(_id);
|
||||||
return destroy.process(oauth_);
|
return destroy.process(oauth_);
|
||||||
|
|||||||
@@ -10,8 +10,8 @@ class Favorite : public groupInterface {
|
|||||||
public:
|
public:
|
||||||
Favorite() = default;
|
Favorite() = default;
|
||||||
Favorite(std::shared_ptr<CocoaTweet::OAuth::OAuth1> _oauth);
|
Favorite(std::shared_ptr<CocoaTweet::OAuth::OAuth1> _oauth);
|
||||||
CocoaTweet::API::Model::Tweet Create(const std::string& _id) const;
|
CocoaTweet::API::Model::Tweet create(const std::string& _id) const;
|
||||||
CocoaTweet::API::Model::Tweet Destroy(const std::string& _id) const;
|
CocoaTweet::API::Model::Tweet destroy(const std::string& _id) const;
|
||||||
};
|
};
|
||||||
} // namespace CocoaTweet::API::Favorites
|
} // namespace CocoaTweet::API::Favorites
|
||||||
|
|
||||||
|
|||||||
@@ -5,7 +5,7 @@ Media::Media(std::shared_ptr<CocoaTweet::OAuth::OAuth1> _oauth) {
|
|||||||
oauth_ = _oauth;
|
oauth_ = _oauth;
|
||||||
}
|
}
|
||||||
|
|
||||||
CocoaTweet::API::Model::MediaStore Media::Upload(const std::string& _media) const {
|
CocoaTweet::API::Model::MediaStore Media::upload(const std::string& _media) const {
|
||||||
CocoaTweet::API::Medias::Upload upload;
|
CocoaTweet::API::Medias::Upload upload;
|
||||||
upload.media(_media);
|
upload.media(_media);
|
||||||
return upload.process(oauth_);
|
return upload.process(oauth_);
|
||||||
|
|||||||
@@ -19,7 +19,7 @@ public:
|
|||||||
/// @param[in] std::shared_ptr<CocoaTweet::OAuth::OAuth1> : pointer to OAuth object
|
/// @param[in] std::shared_ptr<CocoaTweet::OAuth::OAuth1> : pointer to OAuth object
|
||||||
Media(std::shared_ptr<CocoaTweet::OAuth::OAuth1> _oauth);
|
Media(std::shared_ptr<CocoaTweet::OAuth::OAuth1> _oauth);
|
||||||
|
|
||||||
CocoaTweet::API::Model::MediaStore Upload(const std::string& _file) const;
|
CocoaTweet::API::Model::MediaStore upload(const std::string& _file) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -10,13 +10,13 @@ Status::Status(std::shared_ptr<CocoaTweet::OAuth::OAuth1> _oauth) {
|
|||||||
oauth_ = _oauth;
|
oauth_ = _oauth;
|
||||||
}
|
}
|
||||||
|
|
||||||
CocoaTweet::API::Model::Tweet Status::Update(const std::string& _status) const {
|
CocoaTweet::API::Model::Tweet Status::update(const std::string& _status) const {
|
||||||
CocoaTweet::API::Statuses::Update update;
|
CocoaTweet::API::Statuses::Update update;
|
||||||
update.status(_status);
|
update.status(_status);
|
||||||
return update.process(oauth_);
|
return update.process(oauth_);
|
||||||
}
|
}
|
||||||
|
|
||||||
CocoaTweet::API::Model::Tweet Status::Update(const std::string& _status,
|
CocoaTweet::API::Model::Tweet Status::update(const std::string& _status,
|
||||||
const Options _options) const {
|
const Options _options) const {
|
||||||
CocoaTweet::API::Statuses::Update update;
|
CocoaTweet::API::Statuses::Update update;
|
||||||
update.status(_status);
|
update.status(_status);
|
||||||
@@ -60,7 +60,7 @@ CocoaTweet::API::Model::Tweet Status::Update(const std::string& _status,
|
|||||||
return update.process(oauth_);
|
return update.process(oauth_);
|
||||||
}
|
}
|
||||||
|
|
||||||
CocoaTweet::API::Model::Tweet Status::Update(const std::string& _status,
|
CocoaTweet::API::Model::Tweet Status::update(const std::string& _status,
|
||||||
std::vector<std::string> _mediaId) const {
|
std::vector<std::string> _mediaId) const {
|
||||||
CocoaTweet::API::Statuses::Update update;
|
CocoaTweet::API::Statuses::Update update;
|
||||||
update.status(_status);
|
update.status(_status);
|
||||||
@@ -68,25 +68,25 @@ CocoaTweet::API::Model::Tweet Status::Update(const std::string& _status,
|
|||||||
return update.process(oauth_);
|
return update.process(oauth_);
|
||||||
}
|
}
|
||||||
|
|
||||||
CocoaTweet::API::Model::Tweet Status::Destroy(const std::string& _id) const {
|
CocoaTweet::API::Model::Tweet Status::destroy(const std::string& _id) const {
|
||||||
CocoaTweet::API::Statuses::Destroy destroy;
|
CocoaTweet::API::Statuses::Destroy destroy;
|
||||||
destroy.id(_id);
|
destroy.id(_id);
|
||||||
return destroy.process(oauth_);
|
return destroy.process(oauth_);
|
||||||
}
|
}
|
||||||
|
|
||||||
CocoaTweet::API::Model::Tweet Status::Retweet(const std::string& _id) const {
|
CocoaTweet::API::Model::Tweet Status::retweet(const std::string& _id) const {
|
||||||
CocoaTweet::API::Statuses::Retweet retweet;
|
CocoaTweet::API::Statuses::Retweet retweet;
|
||||||
retweet.id(_id);
|
retweet.id(_id);
|
||||||
return retweet.process(oauth_);
|
return retweet.process(oauth_);
|
||||||
}
|
}
|
||||||
|
|
||||||
CocoaTweet::API::Model::Tweet Status::Unretweet(const std::string& _id) const {
|
CocoaTweet::API::Model::Tweet Status::unretweet(const std::string& _id) const {
|
||||||
CocoaTweet::API::Statuses::Unretweet unretweet;
|
CocoaTweet::API::Statuses::Unretweet unretweet;
|
||||||
unretweet.id(_id);
|
unretweet.id(_id);
|
||||||
return unretweet.process(oauth_);
|
return unretweet.process(oauth_);
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<CocoaTweet::API::Model::Tweet> Status::UserTimeline(
|
std::vector<CocoaTweet::API::Model::Tweet> Status::userTimeline(
|
||||||
const std::string& _screenName) const {
|
const std::string& _screenName) const {
|
||||||
CocoaTweet::API::Statuses::UserTimeline userTimeline;
|
CocoaTweet::API::Statuses::UserTimeline userTimeline;
|
||||||
userTimeline.screenName(_screenName);
|
userTimeline.screenName(_screenName);
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ public:
|
|||||||
/// @details this function throws CocoaTweet::Exception::* if something happen
|
/// @details this function throws CocoaTweet::Exception::* if something happen
|
||||||
/// @param[in] const std::string& : tweet text
|
/// @param[in] const std::string& : tweet text
|
||||||
/// @param[out] CocoaTweet::API::Model::Tweet : Tweet result
|
/// @param[out] CocoaTweet::API::Model::Tweet : Tweet result
|
||||||
CocoaTweet::API::Model::Tweet Update(const std::string& _status) const;
|
CocoaTweet::API::Model::Tweet update(const std::string& _status) const;
|
||||||
|
|
||||||
/// @brief send request to statuses/update with specified status
|
/// @brief send request to statuses/update with specified status
|
||||||
/// @details this function throws CocoaTweet::Exception::* if something happen
|
/// @details this function throws CocoaTweet::Exception::* if something happen
|
||||||
@@ -43,7 +43,7 @@ public:
|
|||||||
/// @param[in] const CocoaTweet::API::Statuses::Status::Options option : status update options
|
/// @param[in] const CocoaTweet::API::Statuses::Status::Options option : status update options
|
||||||
/// for more parameters
|
/// for more parameters
|
||||||
/// @param[out] CocoaTweet::API::Model::Tweet : Tweet result
|
/// @param[out] CocoaTweet::API::Model::Tweet : Tweet result
|
||||||
CocoaTweet::API::Model::Tweet Update(const std::string& _status,
|
CocoaTweet::API::Model::Tweet update(const std::string& _status,
|
||||||
const Options _options) const;
|
const Options _options) const;
|
||||||
|
|
||||||
/// @brief send request to statuses/update with specified status
|
/// @brief send request to statuses/update with specified status
|
||||||
@@ -51,19 +51,19 @@ public:
|
|||||||
/// @param[in] const std::string& : tweet text
|
/// @param[in] const std::string& : tweet text
|
||||||
/// @param[in] std::vector<std::string> _mediaId : media id which posted with tweet
|
/// @param[in] std::vector<std::string> _mediaId : media id which posted with tweet
|
||||||
/// @param[out] CocoaTweet::API::Model::Tweet : Tweet result
|
/// @param[out] CocoaTweet::API::Model::Tweet : Tweet result
|
||||||
CocoaTweet::API::Model::Tweet Update(const std::string& _status,
|
CocoaTweet::API::Model::Tweet update(const std::string& _status,
|
||||||
std::vector<std::string> _mediaId) const;
|
std::vector<std::string> _mediaId) const;
|
||||||
|
|
||||||
/// @brief send request to statuses/destroy with specified id
|
/// @brief send request to statuses/destroy with specified id
|
||||||
/// @details this function throws CocoaTweet::Exception::* if something happen
|
/// @details this function throws CocoaTweet::Exception::* if something happen
|
||||||
/// @param[in] const std::string& : tweet id which should be delete
|
/// @param[in] const std::string& : tweet id which should be delete
|
||||||
/// @param[out] CocoaTweet::API::Model::Tweet : Destroy result
|
/// @param[out] CocoaTweet::API::Model::Tweet : Destroy result
|
||||||
CocoaTweet::API::Model::Tweet Destroy(const std::string& _id) const;
|
CocoaTweet::API::Model::Tweet destroy(const std::string& _id) const;
|
||||||
|
|
||||||
CocoaTweet::API::Model::Tweet Retweet(const std::string& _id) const;
|
CocoaTweet::API::Model::Tweet retweet(const std::string& _id) const;
|
||||||
CocoaTweet::API::Model::Tweet Unretweet(const std::string& _id) const;
|
CocoaTweet::API::Model::Tweet unretweet(const std::string& _id) const;
|
||||||
|
|
||||||
std::vector<CocoaTweet::API::Model::Tweet> UserTimeline(const std::string& _screenName) const;
|
std::vector<CocoaTweet::API::Model::Tweet> userTimeline(const std::string& _screenName) const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
Options defaultOpt_;
|
Options defaultOpt_;
|
||||||
|
|||||||
+7
-4
@@ -1,5 +1,8 @@
|
|||||||
#include "cocoatweet/oauth/key.h"
|
#include "cocoatweet/oauth/key.h"
|
||||||
#include "cocoatweet/api/api.h"
|
#include "cocoatweet/api/api.h"
|
||||||
|
#include <cocoatweet/api/directMessage/new.h>
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
auto main() -> int {
|
auto main() -> int {
|
||||||
// Generate Key object
|
// Generate Key object
|
||||||
@@ -19,8 +22,8 @@ auto main() -> int {
|
|||||||
// CocoaTweet::API::API api(key);
|
// CocoaTweet::API::API api(key);
|
||||||
|
|
||||||
// Now, you can use a twitter api
|
// Now, you can use a twitter api
|
||||||
// auto status = api.status().Update("Hello Twitter World via Cocoa Twitter Library");
|
// auto status = api.status().update("Hello Twitter World via Cocoa Twitter Library");
|
||||||
// api.favorite().Create(status.id());
|
// api.favorite().create(status.id());
|
||||||
// api.favorite().Destroy(status.id());
|
// api.favorite().destroy(status.id());
|
||||||
// api.status().Destroy(status.id());
|
// api.status().destroy(status.id());
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user