TreeFrogFramework  2.8
thttpclient.h
Go to the documentation of this file.
1 #pragma once
2 #include <TGlobal>
3 
4 class QNetworkAccessManager;
5 class QNetworkReply;
6 class QNetworkRequest;
7 class QJsonDocument;
8 
9 
11 public:
12  THttpClient();
13  ~THttpClient();
14 
15  QNetworkReply *get(const QUrl &url, int msecs = 5000);
16  QNetworkReply *get(const QNetworkRequest &request, int msecs = 5000);
17  QNetworkReply *post(const QUrl &url, const QJsonDocument &json, int msecs = 5000);
18  QNetworkReply *post(const QNetworkRequest &request, const QByteArray &data, int msecs = 5000);
19  QNetworkReply *put(const QUrl &url, const QJsonDocument &json, int msecs = 5000);
20  QNetworkReply *put(const QNetworkRequest &request, const QByteArray &data, int msecs = 5000);
21  QNetworkReply *deleteResource(const QUrl &url, int msecs = 5000);
22  QNetworkReply *deleteResource(const QNetworkRequest &request, int msecs = 5000);
23 
24  QNetworkAccessManager *manager() { return _manager; }
25 
26 private:
27  QNetworkAccessManager *_manager {nullptr};
28 };
29 
The THttpClient class can send HTTP requests to another server and receive replies.
Definition: thttpclient.h:10
QNetworkAccessManager * manager()
Definition: thttpclient.h:24
#define T_CORE_EXPORT
Definition: tdeclexport.h:28