Fix build: synchronize Request API, fix GmailSynchronizer, and migrate UI to Qt6 Widgets
This commit is contained in:
@@ -0,0 +1,62 @@
|
||||
#ifndef REQUEST_H
|
||||
#define REQUEST_H
|
||||
|
||||
#include <QObject>
|
||||
#include <QUrl>
|
||||
#include <QMap>
|
||||
#include <QByteArray>
|
||||
#include <QNetworkRequest>
|
||||
|
||||
enum class RequestType {
|
||||
GmailApi,
|
||||
GraphApi,
|
||||
Imap,
|
||||
Custom
|
||||
};
|
||||
|
||||
class Request : public QObject
|
||||
{
|
||||
Q_OBJECT
|
||||
public:
|
||||
enum class Method {
|
||||
GET,
|
||||
POST,
|
||||
PUT,
|
||||
DELETE,
|
||||
PATCH
|
||||
};
|
||||
|
||||
explicit Request(QObject *parent = nullptr);
|
||||
Request(Method method, const QUrl &url, const QByteArray &body = QByteArray());
|
||||
~Request() override = default;
|
||||
|
||||
void setMethod(Method method);
|
||||
Method method() const;
|
||||
|
||||
void setUrl(const QUrl &url);
|
||||
QUrl url() const;
|
||||
|
||||
void setHeader(const QString &key, const QString &value);
|
||||
QMap<QString, QString> headers() const;
|
||||
|
||||
void setBody(const QByteArray &body);
|
||||
QByteArray body() const;
|
||||
|
||||
void setType(RequestType type);
|
||||
RequestType type() const;
|
||||
|
||||
void setAccountId(const QString &accountId);
|
||||
QString accountId() const;
|
||||
|
||||
QNetworkRequest toNetworkRequest() const;
|
||||
|
||||
private:
|
||||
Method m_method = Method::GET;
|
||||
QUrl m_url;
|
||||
QMap<QString, QString> m_headers;
|
||||
QByteArray m_body;
|
||||
RequestType m_requestType = RequestType::Custom;
|
||||
QString m_accountId;
|
||||
};
|
||||
|
||||
#endif // REQUEST_H
|
||||
Reference in New Issue
Block a user