25 lines
553 B
C
25 lines
553 B
C
|
#ifndef HTTPCLIENT_H
|
||
|
#define HTTPCLIENT_H
|
||
|
|
||
|
#include <QObject>
|
||
|
#include <QJsonObject>
|
||
|
|
||
|
class QNetworkAccessManager;
|
||
|
class QNetworkReply;
|
||
|
|
||
|
class HttpClient : public QObject {
|
||
|
Q_OBJECT
|
||
|
|
||
|
public:
|
||
|
explicit HttpClient(QObject *parent = nullptr);
|
||
|
QJsonObject get(const QString &url);
|
||
|
QJsonObject post(const QString &url, const QJsonObject &json);
|
||
|
QJsonObject put(const QString &url, const QJsonObject &json);
|
||
|
|
||
|
private:
|
||
|
QNetworkAccessManager *networkManager;
|
||
|
QJsonObject processReply(QNetworkReply *reply);
|
||
|
};
|
||
|
|
||
|
#endif // HTTPCLIENT_H
|