2024-11-28 18:34:00 +00:00
|
|
|
#ifndef HTTPCLIENT_H
|
|
|
|
#define HTTPCLIENT_H
|
|
|
|
|
|
|
|
#include <QJsonObject>
|
2024-12-09 08:30:43 +00:00
|
|
|
#include <QObject>
|
2024-11-28 18:34:00 +00:00
|
|
|
|
|
|
|
class QNetworkAccessManager;
|
|
|
|
class QNetworkReply;
|
|
|
|
|
2024-12-09 08:30:43 +00:00
|
|
|
class HttpClient : public QObject
|
|
|
|
{
|
2024-11-28 18:34:00 +00:00
|
|
|
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
|