KShare/uploaders/customuploader.hpp

37 lines
837 B
C++
Raw Normal View History

2017-04-24 23:14:01 +02:00
#ifndef CUSTOMUPLOADER_HPP
#define CUSTOMUPLOADER_HPP
#include "uploader.hpp"
#include <QJsonObject>
#include <QMap>
#include <QUrl>
2017-05-06 13:21:12 +02:00
enum class HttpMethod { POST };
2017-04-24 23:14:01 +02:00
2017-05-06 13:21:12 +02:00
enum class RequestFormat { X_WWW_FORM_URLENCODED, JSON, PLAIN };
2017-04-24 23:14:01 +02:00
2017-05-06 13:21:12 +02:00
class CustomUploader : public Uploader {
public:
CustomUploader(QString absFilePath);
QString name();
QString description();
std::tuple<QString, QString> format();
void doUpload(QByteArray imgData);
QString getFormatString(bool animated);
QMap<QString, QString> types;
2017-04-24 23:14:01 +02:00
private:
2017-05-21 11:16:00 +02:00
double limit = -1;
QString desc;
QString uName;
RequestFormat rFormat = RequestFormat::JSON;
HttpMethod method = HttpMethod::POST;
QUrl target;
QJsonValue body;
QJsonObject headers;
QString returnPathspec;
QString iFormat;
2017-04-24 23:14:01 +02:00
};
#endif // CUSTOMUPLOADER_HPP