forked from Cutehacks/duperagent
-
Notifications
You must be signed in to change notification settings - Fork 0
/
duperagent.h
71 lines (55 loc) · 1.9 KB
/
duperagent.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
// Copyright 2016 Cutehacks AS. All rights reserved.
// License can be found in the LICENSE file.
#ifndef DUPERAGENT_H
#define DUPERAGENT_H
#include <QtCore/QObject>
#include <QtQml/QJSValue>
#include <QtQml/qqml.h>
#include "qpm.h"
class QQmlEngine;
class QJsEngine;
namespace com { namespace cutehacks { namespace duperagent {
class ResponseType : public QObject {
Q_OBJECT
Q_ENUMS(Types)
public:
enum Types {
Auto = 0,
Text = 1,
Json = 2,
Blob = 3,
ArrayBuffer = 4
};
};
class Request : public QObject
{
Q_OBJECT
public:
Request(QQmlEngine *engine, QObject *parent = 0);
Q_PROPERTY(QJSValue cookie READ cookie WRITE setCookie)
Q_INVOKABLE void config(const QJSValue &);
Q_INVOKABLE QJSValue get(const QJSValue&,
const QJSValue& = QJSValue(),
const QJSValue& = QJSValue()) const;
Q_INVOKABLE QJSValue head(const QJSValue&,
const QJSValue& = QJSValue(),
const QJSValue& = QJSValue()) const;
Q_INVOKABLE QJSValue del(const QJSValue&,
const QJSValue& = QJSValue()) const;
Q_INVOKABLE QJSValue patch(const QJSValue&,
const QJSValue& = QJSValue(),
const QJSValue& = QJSValue()) const;
Q_INVOKABLE QJSValue post(const QJSValue&,
const QJSValue& = QJSValue(),
const QJSValue& = QJSValue()) const;
Q_INVOKABLE QJSValue put(const QJSValue&,
const QJSValue& = QJSValue(),
const QJSValue& = QJSValue()) const;
QJSValue cookie() const;
void setCookie(const QJSValue &);
Q_INVOKABLE void clearCookies();
private:
QQmlEngine *m_engine;
};
} } }
#endif // DUPERAGENT_H