-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathqparserequest.h
82 lines (72 loc) · 3.06 KB
/
qparserequest.h
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
#ifndef QPARSEREQUEST_H
#define QPARSEREQUEST_H
#include <QObject>
#include <QList>
#include <QPair>
#include <QString>
#include "qparse.h"
#include "qparsetypes.h"
class QParseObject;
/*! It represent a request to perform to PARSE.
* It can be a query, posting a file or object, retrieving single object
*
* Submit a request to QParse singleton and use the QParseReply to collect results
*
*/
class QParseRequest : public QObject {
Q_OBJECT
//! the parse class name involved to this request
Q_PROPERTY( QString parseClassName MEMBER parseClassName CONSTANT )
//! the target object of this request (if null the request target is the whole PARSE class)
Q_PROPERTY( QParseObject* parseObject MEMBER parseObject )
//! the Parse File object of this request (if set and valid)
Q_PROPERTY( QParseFile* parseFile MEMBER parseFile )
//! the cache control
Q_PROPERTY( QParse::CacheControl cacheControl MEMBER cacheControl )
public:
/*! constructor
* \param parseClassName is the name of the Parse class used for creating the endpoint on the underlying
* REST API request.
* \note Some has special meaning for Parse and they will be handled by QParse:
* like _Users, login, logout
* but you don't worry about that because they are related to special classes
* which implementation is already provided by QParse library
* \warning it's responsability to the creator of QParseRequest to destroy it, but NEVER delete it explicity.
* Instead, you MUST call the deleteLater() method on the associated QParseReply.
*/
QParseRequest( QString parseClassName );
/*! constructor a Parse File request
* \param QParseFile is the target of the request operation
* \warning it's responsability to the creator of QParseRequest to destroy it, but NEVER delete it explicity.
* Instead, you MUST call the deleteLater() method on the associated QParseReply.
*/
QParseRequest( QParseFile* parseFile );
//! return the class name used on PARSE for the target of this request
QString getParseClassName() const;
QParseObject *getParseObject() const;
void setParseObject(QParseObject *value);
QParseFile* getParseFile() const;
void setParseFile(QParseFile* value);
QParse::CacheControl getCacheControl() const;
void setCacheControl(const QParse::CacheControl &value);
/*! add the option and its value to the request
* \param name is the name of option (like 'include', 'where', etc)
* \param value is the value of the option to send
* \warning it does not check for duplications
*/
void addOption( QString name, QString value );
//! return the list of all options added so far
QList< QPair<QString,QString> > getOptions();
private:
//! this is used to create the correct endpoint to network request
QString parseClassName;
//! the target object of this request
QParseObject* parseObject;
//! the parse file object of this request (if any)
QParseFile* parseFile;
//! the cache control to use
QParse::CacheControl cacheControl;
//! these are used for get network requests
QList< QPair<QString,QString> > params;
};
#endif // QPARSEREQUEST