summaryrefslogtreecommitdiff
path: root/plugin/src/Caelestia/requests.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'plugin/src/Caelestia/requests.hpp')
-rw-r--r--plugin/src/Caelestia/requests.hpp23
1 files changed, 23 insertions, 0 deletions
diff --git a/plugin/src/Caelestia/requests.hpp b/plugin/src/Caelestia/requests.hpp
new file mode 100644
index 0000000..1db2f4c
--- /dev/null
+++ b/plugin/src/Caelestia/requests.hpp
@@ -0,0 +1,23 @@
+#pragma once
+
+#include <qnetworkaccessmanager.h>
+#include <qobject.h>
+#include <qqmlengine.h>
+
+namespace caelestia {
+
+class Requests : public QObject {
+ Q_OBJECT
+ QML_ELEMENT
+ QML_SINGLETON
+
+public:
+ explicit Requests(QObject* parent = nullptr);
+
+ Q_INVOKABLE void get(const QUrl& url, QJSValue callback, QJSValue onError = QJSValue()) const;
+
+private:
+ QNetworkAccessManager* m_manager;
+};
+
+} // namespace caelestia