1 #ifndef QTRESTCLIENT_RESTCLIENT_H
2 #define QTRESTCLIENT_RESTCLIENT_H
4 #include "QtRestClient/qtrestclient_global.h"
5 #include "QtRestClient/requestbuilder.h"
7 #include <QtCore/qobject.h>
8 #include <QtCore/qurl.h>
9 #include <QtCore/qurlquery.h>
10 #include <QtCore/qversionnumber.h>
11 #ifdef QT_RESTCLIENT_USE_ASYNC
12 #include <QtCore/qthreadpool.h>
15 #include <QtNetwork/qnetworkrequest.h>
17 #ifndef Q_RESTCLIENT_NO_JSON_SERIALIZER
18 namespace QtJsonSerializer {
28 class RestClientPrivate;
33 friend class RestClientPrivate;
36 Q_PROPERTY(
DataMode dataMode READ dataMode WRITE setDataMode NOTIFY dataModeChanged)
38 Q_PROPERTY(
QUrl baseUrl READ baseUrl WRITE setBaseUrl NOTIFY baseUrlChanged)
40 Q_PROPERTY(
QVersionNumber apiVersion READ apiVersion WRITE setApiVersion NOTIFY apiVersionChanged)
42 Q_PROPERTY(
HeaderHash globalHeaders READ globalHeaders WRITE setGlobalHeaders NOTIFY globalHeadersChanged)
44 Q_PROPERTY(
QUrlQuery globalParameters READ globalParameters WRITE setGlobalParameters NOTIFY globalParametersChanged)
46 Q_PROPERTY(
QHash<
QNetworkRequest::Attribute,
QVariant> requestAttributes READ requestAttributes WRITE setRequestAttributes NOTIFY requestAttributesChanged)
48 Q_PROPERTY(
bool threaded READ isThreaded WRITE setThreaded NOTIFY threadedChanged)
51 Q_PROPERTY(
QSslConfiguration sslConfiguration READ sslConfiguration WRITE setSslConfiguration NOTIFY sslConfigurationChanged)
55 #ifdef QT_RESTCLIENT_USE_ASYNC
56 Q_PROPERTY(
QThreadPool* asyncPool READ asyncPool WRITE setAsyncPool NOTIFY asyncPoolChanged)
72 #ifndef Q_RESTCLIENT_NO_JSON_SERIALIZER
84 #ifndef Q_RESTCLIENT_NO_JSON_SERIALIZER
92 DataMode dataMode()
const;
104 bool isThreaded()
const;
109 #ifdef QT_RESTCLIENT_USE_ASYNC
120 #ifndef Q_RESTCLIENT_NO_JSON_SERIALIZER
129 void setDataMode(DataMode dataMode);
131 void setBaseUrl(
QUrl baseUrl);
135 void setGlobalHeaders(
HeaderHash globalHeaders);
137 void setGlobalParameters(
QUrlQuery globalParameters);
141 void setModernAttributes();
143 void setThreaded(
bool threaded);
148 #ifdef QT_RESTCLIENT_USE_ASYNC
156 void removeGlobalHeader(
const QByteArray &name);
159 void addGlobalParameter(
const QString &name,
const QString &value);
161 void removeGlobalParameter(
const QString &name);
164 void addRequestAttribute(QNetworkRequest::Attribute attribute,
const QVariant &value);
166 void removeRequestAttribute(QNetworkRequest::Attribute attribute);
170 void dataModeChanged(DataMode dataMode, QPrivateSignal);
172 void baseUrlChanged(
QUrl baseUrl, QPrivateSignal);
174 void apiVersionChanged(
QVersionNumber apiVersion, QPrivateSignal);
176 void globalHeadersChanged(
HeaderHash globalHeaders, QPrivateSignal);
178 void globalParametersChanged(
QUrlQuery globalParameters, QPrivateSignal);
182 void threadedChanged(
bool threaded, QPrivateSignal);
184 void sslConfigurationChanged(
QSslConfiguration sslConfiguration, QPrivateSignal);
187 #ifdef QT_RESTCLIENT_USE_ASYNC
188 void asyncPoolChanged(
QThreadPool* asyncPool, QPrivateSignal);
204 #endif // QTRESTCLIENT_RESTCLIENT_H