-
Notifications
You must be signed in to change notification settings - Fork 16
/
lapi.h
38 lines (29 loc) · 933 Bytes
/
lapi.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
#ifndef LAPI_H
#define LAPI_H
#include <QObject>
#include <QtNetwork>
#include "promise.h"
class Lapi : public QObject
{
Q_OBJECT
public:
explicit Lapi(QString token = "", QObject *parent = 0);
Promise* validate();
Promise* fetchUserInfo();
Promise* fetchWorkbin(const QString &id);
Promise* fetchAnnouncement();
Promise* fetchModules();
QString getWorkBinDownloadUrl(const QString&);
void setToken(const QString&);
QNetworkAccessManager* getManager();
public slots:
private:
QString token;
QNetworkAccessManager* manager;
QNetworkRequest genRequest(const QString& service, const QString& additionalQuery = QString(""));
void ajaxGet(const QNetworkRequest& re,
const std::function<void(QVariant)>&,
const std::function<void(QNetworkReply::NetworkError)>&);
Promise* ajaxGet(const QNetworkRequest& re);
};
#endif // LAPI_H