本文整理汇总了C++中KQOAuthParameters类的典型用法代码示例。如果您正苦于以下问题:C++ KQOAuthParameters类的具体用法?C++ KQOAuthParameters怎么用?C++ KQOAuthParameters使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了KQOAuthParameters类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: Reply
void TwitterInterface::Reply (const qulonglong replyid, const QString& tweet)
{
KQOAuthParameters param;
param.insert ("status", tweet);
param.insert ("in_reply_to_status_id", QString::number (replyid));
SignedRequest (TwitterRequest::Reply, KQOAuthRequest::POST, param);
}
示例2: DeleteFavorite
void TwitterInterface::DeleteFavorite (const qulonglong id)
{
KQOAuthParameters param;
param.insert ("id", QString::number (id));
SignedRequest (TwitterRequest::DeleteFavorite, KQOAuthRequest::POST, param);
}
示例3: ReportSPAM
void TwitterInterface::ReportSPAM (const QString& username, const qulonglong userid)
{
KQOAuthParameters param;
param.insert ("screen_name", username);
if (userid)
param.insert ("user_id", QString::number (userid));
SignedRequest (TwitterRequest::SpamReport, KQOAuthRequest::POST, param);
}
示例4: KQOAuth2Request
KQOAuthRequest* FoursquareApi::getUserInfo() {
KQOAuth2Request *req = new KQOAuth2Request(this);
if(!checkToken()) {
req->initRequest(KQOAuthRequest::AuthorizedRequest, QUrl(API_BASE + "users/self"));
req->setToken(oauthSettings.value("oauth_token").toString());
KQOAuthParameters params;
params.insert("v","20120501");
req->setAdditionalParameters(params);
req->setHttpMethod(KQOAuthRequest::GET);
}
return req;
}
示例5: setAdditionalParameters
void KQOAuthRequest::setAdditionalParameters(const KQOAuthParameters &additionalParams) {
Q_D(KQOAuthRequest);
QList<QString> additionalKeys = additionalParams.keys();
QList<QString> additionalValues = additionalParams.values();
int i=0;
foreach(QString key, additionalKeys) {
QString value = additionalValues.at(i);
d->additionalParameters.append( qMakePair(key, value) );
i++;
}
示例6: qMakePair
QList< QPair<QString, QString> > KQOAuthManagerPrivate::createQueryParams(const KQOAuthParameters &requestParams) {
QList<QString> requestKeys = requestParams.keys();
QList<QString> requestValues = requestParams.values();
QList< QPair<QString, QString> > result;
for(int i=0; i<requestKeys.size(); i++) {
result.append( qMakePair(requestKeys.at(i),
requestValues.at(i))
);
}
return result;
}
示例7: tr
void TwitterPage::openSearchTimeline()
{
const QString& text = QInputDialog::getText (this, tr ("Twitter search"),
tr ("Search request"), QLineEdit::Normal,
QString ());
if (!text.isEmpty ())
{
KQOAuthParameters param;
param.insert ("q", text.toUtf8 ());
ParentPlugin_->AddTab (ParentPlugin_->SearchTC_,
tr ("Search %1").arg (text),
FeedMode::SearchResult, param);
}
}
示例8: KQOAuthRequest
KQOAuthRequest* VimeoAuth::createSearchRequest(const QString &searchString) {
KQOAuthRequest *xRequest = new KQOAuthRequest(this);
if(!authIsNeeded()) {
QUrl url(API_BASE);
xRequest->initRequest(KQOAuthRequest::AuthorizedRequest, url);
KQOAuthParameters params;
params.insert("format", "xml");
params.insert("method", "vimeo.videos.search");
params.insert("query", searchString);
xRequest->setAdditionalParameters(params);
addAuth(xRequest);
xRequest->setHttpMethod(KQOAuthRequest::GET);
}
return xRequest;
}
示例9: qWarning
void TwitterPage::showFavorites ()
{
const auto idx = Ui_.TwitList_->currentItem ();
if (!idx)
{
qWarning () << Q_FUNC_INFO << "Malformed index";
return;
}
const auto& username = idx->data (Qt::UserRole).value<Tweet_ptr> ()->GetAuthor ()->GetUsername ();
KQOAuthParameters param;
param.insert ("screen_name", username.toUtf8 ().constData ());
ParentPlugin_->AddTab (ParentPlugin_->FavoriteTC_,
tr ("@%1 favorites").arg (username),
FeedMode::Favorites, param);
}
示例10: param
void TwitterPage::scrolledDown (int sliderPos)
{
if (sliderPos == Ui_.TwitList_->verticalScrollBar ()->maximum ())
{
Ui_.TwitList_->verticalScrollBar ()->setSliderPosition (Ui_.TwitList_->verticalScrollBar ()->maximum () - 1);
Ui_.TwitList_->setEnabled (false);
if (!ScreenTwits_.empty ())
{
KQOAuthParameters param (PageDefaultParam_);
param.insert ("max_id", QString::number ((*ScreenTwits_.begin ())->GetId ()));
param.insert ("count", QString::number (XmlSettingsManager::Instance ()->property ("additional_twits").toUInt ()));
Interface_->request (param, PageMode_);
}
}
}
示例11: qWarning
void KQOAuthRequest_XAuth::setXAuthLogin(const QString &username,
const QString &password) {
if (username.isEmpty() || password.isEmpty()) {
qWarning() << "Username or password cannot be empty. Aborting.";
return;
}
xauth_parameters_set = true;
qDebug() << username << password;
KQOAuthParameters xauthParams;
xauthParams.insert("x_auth_username", username);
xauthParams.insert("x_auth_password", password);
xauthParams.insert("x_auth_mode", "client_auth");
setAdditionalParameters(xauthParams);
}
示例12: callApi
void Oauth::callApi(QUrl url, QList< QPair<QString, QString> > params, QString method) {
oauthRequest->initRequest(KQOAuthRequest::AuthorizedRequest, url);
oauthRequest->setConsumerKey(m_sets->getConsumerKey());
oauthRequest->setConsumerSecretKey(m_sets->getConsumerSecret());
oauthRequest->setToken(m_sets->getAccessToken());
oauthRequest->setTokenSecret(m_sets->getAccessTokenSecret());
if (method == "POST") {
oauthRequest->setHttpMethod(KQOAuthRequest::POST);
} else {
oauthRequest->setHttpMethod(KQOAuthRequest::GET);
}
if (params.size() > 0) {
KQOAuthParameters parameters;
QPair<QString, QString> pair;
foreach(pair, params) {
QString key = pair.first;
QString val = pair.second;
parameters.insert(key, val);
}
示例13: Q_ASSERT
void STTweetViewNetwork::sendTweet(const QString &text, STAccount *account, STObjectManager::StatusRef inReplyTo){
Q_ASSERT(!isSending());
KQOAuthParameters param;
param.insert("status", text);
if(inReplyTo)
param.insert("in_reply_to_status_id", QString::number(inReplyTo->id));
QUrl url("https://api.twitter.com/1.1/statuses/update.json");
m_request=new KQOAuthRequest(this);
m_request->initRequest(KQOAuthRequest::AuthorizedRequest, url);
m_request->setAdditionalParameters(param);
m_request->setHttpMethod(KQOAuthRequest::POST);
m_request->setConsumerKey(account->consumerKey());
m_request->setConsumerSecretKey(account->consumerSecret());
m_request->setToken(account->accessToken());
m_request->setTokenSecret(account->accessTokenSecret());
m_manager->executeRequest(m_request);
Q_ASSERT(isSending());
}
示例14: SendTweet
void TwitterInterface::SendTweet (const QString& tweet)
{
KQOAuthParameters param;
param.insert ("status", tweet);
SignedRequest (TwitterRequest::Update, KQOAuthRequest::POST, param);
}
示例15: SignedRequest
void TwitterInterface::SignedRequest (TwitterRequest req,
KQOAuthRequest::RequestHttpMethod method, KQOAuthParameters params)
{
QUrl reqUrl;
if (Token_.isEmpty () || TokenSecret_.isEmpty ())
{
qWarning () << "No access tokens. Aborting.";
return;
}
switch (req)
{
case TwitterRequest::HomeTimeline:
reqUrl = "https://api.twitter.com/1.1/statuses/home_timeline.json";
params.insert ("count", "50");
params.insert ("include_entities", "true");
break;
case TwitterRequest::UserTimeline:
reqUrl = "http://api.twitter.com/1.1/statuses/user_timeline.json";
params.insert ("include_entities", "true");
break;
case TwitterRequest::Search:
reqUrl = "https://api.twitter.com/1.1/search/tweets.json";
params.insert ("count", "50");
params.insert ("include_entities", "true");
break;
case TwitterRequest::Update:
reqUrl = "http://api.twitter.com/1.1/statuses/update.json";
break;
case TwitterRequest::Direct:
reqUrl = "https://api.twitter.com/1.1/direct_messages.json";
case TwitterRequest::Retweet:
reqUrl = QString ("http://api.twitter.com/1.1/statuses/retweet/")
.append (params.value ("id"))
.append (".json");
break;
case TwitterRequest::Reply:
reqUrl = "http://api.twitter.com/1.1/statuses/update.json";
break;
case TwitterRequest::SpamReport:
reqUrl = "http://api.twitter.com/1.1/report_spam.json";
break;
case TwitterRequest::Delete:
reqUrl = QString ("http://api.twitter.com/1.1/statuses/destroy/")
.append (params.value ("id"))
.append (".json");
break;
case TwitterRequest::CreateFavorite:
reqUrl = QString ("https://api.twitter.com/1.1/favorites/create.json");
break;
case TwitterRequest::DeleteFavorite:
reqUrl = QString ("https://api.twitter.com/1.1/favorites/destroy.json");
break;
case TwitterRequest::ListFavorites:
reqUrl = "https://api.twitter.com/1.1/favorites/list.json";
params.insert ("include_entities", "true");
params.insert ("count", "50");
break;
default:
return;
}
OAuthRequest_->initRequest (KQOAuthRequest::AuthorizedRequest, reqUrl);
OAuthRequest_->setHttpMethod (method);
OAuthRequest_->setConsumerKey (ConsumerKey_);
OAuthRequest_->setConsumerSecretKey (ConsumerKeySecret_);
OAuthRequest_->setToken (Token_);
OAuthRequest_->setTokenSecret (TokenSecret_);
OAuthRequest_->setAdditionalParameters (params);
OAuthManager_->executeRequest (OAuthRequest_);
}