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-04-23 15:05:48 +02:00
|
|
|
extern QNetworkAccessManager networkManager;
|
2017-05-13 22:39:05 +02:00
|
|
|
void getJson(QUrl target, QList<QPair<QString, QString>> headers, std::function<void(QJsonDocument, QByteArray, QNetworkReply *)> callback);
|
2017-06-14 23:34:58 +02:00
|
|
|
void postJson(QUrl target,
|
|
|
|
QList<QPair<QString, QString>> headers,
|
|
|
|
QByteArray body,
|
|
|
|
std::function<void(QJsonDocument, QByteArray, QNetworkReply *)> callback);
|
2017-05-09 17:26:00 +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-06-23 16:56:15 +02:00
|
|
|
void postMultipart(QUrl target,
|
|
|
|
QList<QPair<QString, QString>> headers,
|
|
|
|
QHttpMultiPart *body,
|
|
|
|
std::function<void(QJsonDocument, QByteArray, QNetworkReply *)> callback);
|
|
|
|
void postMultipartData(QUrl target,
|
|
|
|
QList<QPair<QString, QString>> headers,
|
|
|
|
QHttpMultiPart *body,
|
|
|
|
std::function<void(QByteArray, QNetworkReply *)> callback);
|
2017-04-23 15:05:48 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
#endif // IOUTILS_HPP
|