File indexing completed on 2024-04-28 04:55:45
0001 /* 0002 This file is part of Choqok, the KDE micro-blogging client 0003 0004 SPDX-FileCopyrightText: 2017 Andrea Scarpino <scarpino@kde.org> 0005 0006 SPDX-License-Identifier: GPL-2.0-only OR GPL-3.0-only OR LicenseRef-KDE-Accepted-GPL 0007 */ 0008 0009 #ifndef MASTODONOAUTH_H 0010 #define MASTODONOAUTH_H 0011 0012 #include <QOAuth2AuthorizationCodeFlow> 0013 #include <QNetworkAccessManager> 0014 0015 class MastodonAccount; 0016 0017 namespace KIO { 0018 class AccessManager; 0019 } 0020 0021 class MastodonOAuthReplyHandler; 0022 0023 class MastodonOAuth : public QOAuth2AuthorizationCodeFlow 0024 { 0025 Q_OBJECT 0026 public: 0027 explicit MastodonOAuth(MastodonAccount *account); 0028 ~MastodonOAuth(); 0029 0030 QByteArray authorizationHeader(const QUrl &requestUrl, QNetworkAccessManager::Operation method, 0031 const QVariantMap ¶ms = QVariantMap()); 0032 0033 void getToken(const QString &code); 0034 0035 private: 0036 MastodonOAuthReplyHandler *m_replyHandler; 0037 KIO::AccessManager *m_networkAccessManager; 0038 }; 0039 0040 #endif // MASTODONOAUTH_H