QtRestClient  3.0.0
A library for generic JSON-based REST-APIs, with a mechanism to map JSON to Qt objects
authrequestbuilder.h
1 #ifndef QTRESTCLIENTAUTH_AUTHREQUESTBUILDER_H
2 #define QTRESTCLIENTAUTH_AUTHREQUESTBUILDER_H
3 
4 #include "QtRestClientAuth/qtrestclientauth_global.h"
5 
6 #include <QtCore/QScopedPointer>
7 #include <QtCore/QLoggingCategory>
8 
9 #include <QtNetworkAuth/qabstractoauth.h>
10 
11 #include <QtRestClient/requestbuilder.h>
12 
13 namespace QtRestClient::Auth {
14 
15 class AuthExtenderPrivate;
17 class Q_RESTCLIENTAUTH_EXPORT AuthExtender : public RequestBuilder::IExtender
18 {
19 public:
22  ~AuthExtender() override;
23 
24  bool requiresBody() const override;
25  void extendRequest(QNetworkRequest &request, QByteArray &verb, QByteArray *body) const override;
26 
27 private:
29 };
30 
32 class Q_RESTCLIENTAUTH_EXPORT AuthRequestBuilder : public RequestBuilder
33 {
34 public:
36  AuthRequestBuilder(const QUrl &baseUrl, QAbstractOAuth *oAuth = nullptr, QNetworkAccessManager *nam = nullptr);
40  AuthRequestBuilder(AuthRequestBuilder &&other) noexcept;
42  AuthRequestBuilder &operator=(const AuthRequestBuilder &other);
44  AuthRequestBuilder &operator=(AuthRequestBuilder &&other) noexcept;
46 
48  AuthRequestBuilder &setOAuth(QAbstractOAuth *oAuth, bool replaceNam = true);
49 
50 private:
51  friend class AuthRestClient;
52  AuthRequestBuilder(RequestBuilder &&extendedBase);
53 };
54 
55 Q_DECLARE_LOGGING_CATEGORY(logAuthExtender)
56 
57 }
58 
59 #endif // QTRESTCLIENTAUTH_AUTHREQUESTBUILDER_H
QUrl
QtRestClient::Auth::AuthExtender
An extender that adds OAuth information to a request.
Definition: authrequestbuilder.h:17
QtRestClient::Auth::AuthRequestBuilder
An extension of the RequestBuilder that uses a QAbstractOAuth to create authenticated requests.
Definition: authrequestbuilder.h:32
QAbstractOAuth
QtRestClient::RequestBuilder
A helper class to build QUrl and QNetworkRequest objects.
Definition: requestbuilder.h:24
QNetworkRequest
QScopedPointer< AuthExtenderPrivate >
QNetworkAccessManager
QByteArray
QtRestClient::Auth::AuthRestClient
An extension of the RestClient that uses a AuthRequestBuilder to create authenticated requests.
Definition: authrestclient.h:13
QtRestClient::RequestBuilder::IExtender
A simple interface to add custom extensions to the building process.
Definition: requestbuilder.h:28
QtRestClient::Auth
The namespace for the QNetworkAuth extensions.
Definition: authrequestbuilder.h:13