Newer
Older
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#ifndef RESTREQUEST_H
#define RESTREQUEST_H
#include <QJsonObject>
#include <functional>
class RestApi;
class QNetworkReply;
typedef std::function<void (QNetworkReply *,QJsonObject pData, RestApi*)> RestRequestCallback;
class RestRequest
{
public:
enum class methods {
GET,
POST
};
RestRequest(QByteArray,QString, methods,RestRequestCallback);
RestRequest(QByteArray,QString, methods,RestRequestCallback pSuccess, RestRequestCallback pError);
methods getMethod() const;
void setMethod(const methods &pValue);
QString getPath() const;
void setPath(const QString &pValue);
QByteArray getContent() const;
void setContent(const QByteArray &pValue);
RestRequestCallback getSuccess() const;
void setSuccess(const RestRequestCallback &pValue);
RestRequestCallback getError() const;
void setError(const RestRequestCallback &pValue);
QString getMimeType() const;
void setMimeType(const QString &pValue);
bool isRawData();
bool getAbsolutePath() const;
protected:
RestRequest();
QByteArray mContent;
QString mPath;
methods mMethod;
RestRequestCallback mSuccess = nullptr;
RestRequestCallback mError = nullptr;
QString mMimeType = "text/plain";
bool mAbsolutePath = false;
bool mRawData = false;
};
#endif // RESTREQUEST_H