qTbot 0.87.9547b0c
qTbot is base back end library for your c++ Qt projects.
irequest.h
Go to the documentation of this file.
1//#
2//# Copyright (C) 2023-2024 QuasarApp.
3//# Distributed under the GPLv3 software license, see the accompanying
4//# Everyone is permitted to copy and distribute verbatim copies
5//# of this license document, but changing it is not allowed.
6//#
7
8
9#ifndef IREQUEST_H
10#define IREQUEST_H
11
12#include "qTbot/global.h"
13
14#include <QByteArray>
15#include <QMap>
16#include <QString>
17#include <QHttpMultiPart>
18
19#define REQUEST_UPLOAD_FILE_KEY "_file_"
20
21namespace qTbot {
22
26typedef QHash<QString, QSharedPointer<QJsonObject>> ExtraJsonObjects;
27
33{
34public:
35 iRequest();
36
46 Upload
47 };
48
53 virtual QString makeUpload() const;
54
59 virtual QString baseAddress() const = 0;
60
65 virtual RequestMethod method() const = 0;
66
71 const QString& request() const;
72
77 void setRequest(const QString &newRequest);
78
83 const QMap<QString, QVariant> &args() const;
84
90 void addArg(const QString& key, const QVariant& val);
91
96 void setArgs(const QMap<QString, QVariant> &newArgs);
97
103 QString argsToUrl() const;
104
111 QSharedPointer<QHttpMultiPart> argsToMultipartFormData() const;
112private:
113 QString _request;
114 QMap<QString, QVariant> _args;
115
116};
117
118}
119#endif // IREQUEST_H
The iRequest class Is main interface for all custom requests.
Definition irequest.h:33
RequestMethod
RequestMethod Tgis islist of supported requests types of the requests.
Definition irequest.h:40
@ Post
general post request
Definition irequest.h:44
@ Get
general ger request, all request data sent as a url line
Definition irequest.h:42
virtual QString baseAddress() const =0
baseAddress This method return base domain of remote server.
virtual RequestMethod method() const =0
method returns method of the request.
#define QTBOT_EXPORT
Definition global.h:18
QHash< QString, QSharedPointer< QJsonObject > > ExtraJsonObjects
ExtraJsonObjects hash map of the extra objects of the message.
Definition irequest.h:26