This commit is contained in:
keita
2022-04-23 20:57:59 +09:00
parent 9f2c61b7e0
commit 1a1ccdca27
12 changed files with 30 additions and 42 deletions
+1 -2
View File
@@ -142,8 +142,7 @@ void HttpGet::process(std::weak_ptr<CocoaTweet::Authentication::AuthenticatorBas
throw CocoaTweet::Exception::CredentialNotVerifiedException(
message.get<std::string>().c_str());
} else if (error.get<int>() == 348) {
throw CocoaTweet::Exception::InvalidateTokenException(
message.get<std::string>().c_str());
throw CocoaTweet::Exception::InvalidateTokenException(message.get<std::string>().c_str());
} else {
}
}
+1 -2
View File
@@ -159,8 +159,7 @@ void HttpPost::process(std::weak_ptr<CocoaTweet::Authentication::AuthenticatorBa
throw CocoaTweet::Exception::CredentialNotVerifiedException(
message.get<std::string>().c_str());
} else if (error.get<int>() == 348) {
throw CocoaTweet::Exception::InvalidateTokenException(
message.get<std::string>().c_str());
throw CocoaTweet::Exception::InvalidateTokenException(message.get<std::string>().c_str());
}
}
+1 -2
View File
@@ -3,8 +3,7 @@
namespace CocoaTweet::API::Model {
BearerToken::BearerToken() : token_("") {}
BearerToken::BearerToken(const std::string _token)
: token_(_token) {}
BearerToken::BearerToken(const std::string _token) : token_(_token) {}
const std::string& BearerToken::token() const {
return token_;
}
-2
View File
@@ -19,14 +19,12 @@ void AccessToken::oauthToken(const CocoaTweet::API::Model::OAuthToken _token) {
const CocoaTweet::API::Model::OAuthToken AccessToken::process(
std::weak_ptr<CocoaTweet::Authentication::AuthenticatorBase> _oauth) {
auto key = oauth_.lock()->key();
key.authType(CocoaTweet::Authentication::Key::AUTH_TYPE::OAUTH10A);
key.accessToken(oauthToken_.oauthToken());
key.accessTokenSecret(oauthToken_.oauthTokenSecret());
auto oauth = std::make_shared<CocoaTweet::Authentication::OAuth1>(key);
CocoaTweet::API::Model::OAuthToken oauthToken;
HttpPost::process(oauth, [&oauthToken](const std::string& _rcv) {
auto mp = CocoaTweet::Util::parse(_rcv, '&', '=');
-1
View File
@@ -1,5 +1,4 @@
#ifndef COCOATWEET_API_OAUTH1_AUTHENTICATE_H_
#define COCOATWEET_API_OAUTH1_AUTHENTICATE_H_
#endif
@@ -1,6 +1,4 @@
#ifndef COCOATWEET_API_OAUTH1_INVALIDATETOKEN_H_
#define COCOATWEET_API_OAUTH1_INVALIDATETOKEN_H_
#endif
+1 -2
View File
@@ -16,7 +16,6 @@ public:
private:
std::string bearer_;
};
}
} // namespace CocoaTweet::API::OAuth2
#endif
+2 -1
View File
@@ -14,7 +14,8 @@ const std::string OAuth2::token() const {
return token.process(oauth_);
}
const CocoaTweet::API::Model::BearerToken OAuth2::invalidateToken(const std::string& _bearer) const {
const CocoaTweet::API::Model::BearerToken OAuth2::invalidateToken(
const std::string& _bearer) const {
// auto key = oauth_.lock()->key();
// auto oauth = std::make_shared<CocoaTweet::Authentication::Basic>(key);
-2
View File
@@ -27,8 +27,6 @@ std::string urlDecode(const std::string& _str){
int first = 0;
int last = _str.find_first_of('%');
while (first < _str.size()) {
if (last == std::string::npos) {
out << _str.substr(first);
-2
View File
@@ -49,8 +49,6 @@ auto main() -> int {
user = api.user().show("milkcocoa9692");
std::cout << user.id() << std::endl;
// api.directMessage().messageCreate(
// user.id(),
// "これはクソみたいなスパムDMです。\nCocoaTwitterLibraryで、user/"