QtRestClient
3.0.0
A library for generic JSON-based REST-APIs, with a mechanism to map JSON to Qt objects
|
An extension of the RequestBuilder that uses a QAbstractOAuth to create authenticated requests. More...
#include <authrequestbuilder.h>
Public Member Functions | |
AuthRequestBuilder (const QUrl &baseUrl, QAbstractOAuth *oAuth=nullptr, QNetworkAccessManager *nam=nullptr) | |
Constructs a builder with the given base url and an OAuth instance to authenticate requests with. | |
AuthRequestBuilder (const AuthRequestBuilder &other) | |
Copy constructor. | |
AuthRequestBuilder (AuthRequestBuilder &&other) noexcept | |
Move constructor. | |
AuthRequestBuilder & | operator= (const AuthRequestBuilder &other) |
Copy assignment operator. | |
AuthRequestBuilder & | operator= (AuthRequestBuilder &&other) noexcept |
Move assignment operator. | |
AuthRequestBuilder & | setOAuth (QAbstractOAuth *oAuth, bool replaceNam=true) |
Sets the OAuth instance to authenticate requests created via build() or send() | |
Public Member Functions inherited from QtRestClient::RequestBuilder | |
RequestBuilder (const QUrl &baseUrl, QNetworkAccessManager *nam=nullptr) | |
Constructs a builder with the given base url. More... | |
RequestBuilder (const RequestBuilder &other) | |
Copy constructor. | |
RequestBuilder (RequestBuilder &&other) noexcept | |
Move constructor. | |
RequestBuilder & | operator= (const RequestBuilder &other) |
Copy assignment operator. | |
RequestBuilder & | operator= (RequestBuilder &&other) noexcept |
Move assignment operator. | |
RequestBuilder & | setNetworkAccessManager (QNetworkAccessManager *nam) |
Sets the network access manager to be used for send() More... | |
RequestBuilder & | setExtender (IExtender *extender) |
Sets the extender to use for extending the build. More... | |
RequestBuilder & | setCredentials (QString user, QString password={}) |
Sets the credentails of the URL. More... | |
RequestBuilder & | setVersion (QVersionNumber version) |
Sets the version of the API. More... | |
RequestBuilder & | addPath (const QString &pathSegment) |
appends a path segment to the builders path More... | |
RequestBuilder & | addPath (const QStringList &pathSegment) |
appends a path segment to the builders path More... | |
RequestBuilder & | trailingSlash (bool enable=true) |
Enables the trailing slash for the generated URL. More... | |
RequestBuilder & | addParameter (const QString &name, const QString &value) |
Adds a parameter to the URL. More... | |
RequestBuilder & | addParameters (const QUrlQuery ¶meters) |
Adds parameters to the URL. More... | |
RequestBuilder & | setFragment (QString fragment) |
Sets the fragment part of the URL. More... | |
RequestBuilder & | addHeader (const QByteArray &name, const QByteArray &value) |
Adds a HTTP header to be added to the network request. More... | |
RequestBuilder & | addHeaders (const HeaderHash &headers) |
Adds HTTP headers to be added to the network request. More... | |
RequestBuilder & | updateFromRelativeUrl (const QUrl &url, bool mergeQuery=false, bool keepFragment=false) |
Updates the builder from the (relative) URL and includes all of it's elements. More... | |
RequestBuilder & | setAttribute (QNetworkRequest::Attribute attribute, const QVariant &value) |
Sets the given attribute on the generated network request. More... | |
RequestBuilder & | setAttributes (const QHash< QNetworkRequest::Attribute, QVariant > &attributes) |
Sets the given attributes on the generated network request. More... | |
RequestBuilder & | setSslConfig (QSslConfiguration sslConfig) |
Sets the ssl configuration to be used by the network request. More... | |
RequestBuilder & | setBody (QByteArray body, const QByteArray &contentType, bool setAccept=true) |
Sets the content of the generated network request. More... | |
RequestBuilder & | setBody (QCborValue body, bool setAccept=true) |
Sets the content of the generated network request. More... | |
RequestBuilder & | setBody (const QJsonValue &body, bool setAccept=true) |
Sets the content of the generated network request. More... | |
RequestBuilder & | setVerb (QByteArray verb) |
Sets the HTTP-Verb to be used by the generated network request. More... | |
RequestBuilder & | setAccept (const QByteArray &mimeType) |
Sets the "Accept" HTTP-header to the given mimetype. More... | |
RequestBuilder & | setAccept (const QMimeType &mimeType) |
Sets the "Accept" HTTP-header to the given mimetype. More... | |
RequestBuilder & | addPostParameter (const QString &name, const QString &value) |
Adds a post parameter to the body. More... | |
RequestBuilder & | addPostParameters (const QUrlQuery ¶meters) |
Adds post parameters to the body. More... | |
QUrl | buildUrl () const |
Creates a URL from the builder settings. More... | |
QNetworkRequest | build () const |
Creates a network request from the builder settings. More... | |
QNetworkReply * | send () const |
Creates a network request and sends it with the builder settings. More... | |
QFuture< QNetworkReply * > | sendAsync () const |
Asynchronously creates a network request and sends it with the builder settings. More... | |
An extension of the RequestBuilder that uses a QAbstractOAuth to create authenticated requests.
Definition at line 32 of file authrequestbuilder.h.