2017-04-23 15:05:48 +02:00
|
|
|
#ifndef IOUTILS_HPP
|
|
|
|
#define IOUTILS_HPP
|
|
|
|
|
|
|
|
#include <QJsonDocument>
|
|
|
|
#include <QJsonObject>
|
|
|
|
#include <QNetworkAccessManager>
|
|
|
|
#include <QUrl>
|
|
|
|
#include <functional>
|
|
|
|
|
2017-05-06 13:21:12 +02:00
|
|
|
namespace ioutils {
|
2017-10-05 19:21:52 +02:00
|
|
|
extern QNetworkAccessManager networkManager;
|
2019-05-10 00:17:43 +02:00
|
|
|
void addLogEntry(QNetworkReply* reply, QByteArray data, QString result, QString filename);
|
2017-10-05 19:21:52 +02:00
|
|
|
void getJson(QUrl target,
|
|
|
|
QList<QPair<QString, QString>> headers,
|
|
|
|
std::function<void(QJsonDocument, QByteArray, QNetworkReply *)> callback);
|
|
|
|
void postJson(QUrl target,
|
|
|
|
QList<QPair<QString, QString>> headers,
|
|
|
|
QByteArray body,
|
|
|
|
std::function<void(QJsonDocument, QByteArray, QNetworkReply *)> callback);
|
2019-05-10 00:17:43 +02:00
|
|
|
void getData(QUrl target, QList<QPair<QString, QString>> headers, std::function<void(QByteArray, QNetworkReply *)> callback);
|
|
|
|
void postData(QUrl target, QList<QPair<QString, QString>> headers, QByteArray body, std::function<void(QByteArray, QNetworkReply *)> callback);
|
2017-10-05 19:21:52 +02:00
|
|
|
void postMultipart(QUrl target,
|
2017-06-23 16:56:15 +02:00
|
|
|
QList<QPair<QString, QString>> headers,
|
|
|
|
QHttpMultiPart *body,
|
2017-10-05 19:21:52 +02:00
|
|
|
std::function<void(QJsonDocument, QByteArray, QNetworkReply *)> callback);
|
|
|
|
void postMultipartData(QUrl target,
|
|
|
|
QList<QPair<QString, QString>> headers,
|
|
|
|
QHttpMultiPart *body,
|
|
|
|
std::function<void(QByteArray, QNetworkReply *)> callback);
|
|
|
|
QString methodString(QNetworkAccessManager::Operation operation);
|
2019-05-08 22:00:10 +02:00
|
|
|
QString httpString(int responseCode);
|
2018-02-18 02:35:29 +01:00
|
|
|
} // namespace ioutils
|
2017-04-23 15:05:48 +02:00
|
|
|
|
|
|
|
#endif // IOUTILS_HPP
|