All Downloads are FREE. Search and download functionalities are using the official Maven repository.

cpp-qt-client.api-header.mustache Maven / Gradle / Ivy

There is a newer version: 7.9.0
Show newest version
{{>licenseInfo}}
#ifndef {{prefix}}_{{classname}}_H
#define {{prefix}}_{{classname}}_H

#include "{{prefix}}Helpers.h"
#include "{{prefix}}HttpRequest.h"
#include "{{prefix}}ServerConfiguration.h"
#include "{{prefix}}Oauth.h"

{{#imports}}{{{import}}}
{{/imports}}

#include 
#include 
#include 
#include 
#include 

{{#cppNamespaceDeclarations}}
namespace {{this}} {
{{/cppNamespaceDeclarations}}

class {{classname}} : public QObject {
    Q_OBJECT

public:
    {{classname}}(const int timeOut = 0);
    ~{{classname}}();

    void initializeServerConfigs();
    int setDefaultServerValue(int serverIndex,const QString &operation, const QString &variable,const QString &val);
    void setServerIndex(const QString &operation, int serverIndex);
    void setApiKey(const QString &apiKeyName, const QString &apiKey);
    void setBearerToken(const QString &token);
    void setUsername(const QString &username);
    void setPassword(const QString &password);
    void setTimeOut(const int timeOut);
    void setWorkingDirectory(const QString &path);
    void setNetworkAccessManager(QNetworkAccessManager* manager);
    int addServerConfiguration(const QString &operation, const QUrl &url, const QString &description = "", const QMap &variables = QMap());
    void setNewServerForAllOperations(const QUrl &url, const QString &description = "", const QMap &variables =  QMap());
    void setNewServer(const QString &operation, const QUrl &url, const QString &description = "", const QMap &variables =  QMap());
    void addHeaders(const QString &key, const QString &value);
    void enableRequestCompression();
    void enableResponseCompression();
    void abortRequests();
    QString getParamStylePrefix(const QString &style);
    QString getParamStyleSuffix(const QString &style);
    QString getParamStyleDelimiter(const QString &style, const QString &name, bool isExplode);
{{#operations}}{{#operation}}
{{#hasParams}}    /**
    {{#allParams}}
    {{#required}}
    * @param[in]  {{paramName}} {{{dataType}}} [required]
    {{/required}}
    {{^required}}
    * @param[in]  {{paramName}} {{{dataType}}} [optional]
    {{/required}}
    {{/allParams}}
    */{{/hasParams}}
    {{#isDeprecated}}Q_DECL_DEPRECATED {{/isDeprecated}}{{#makeOperationsVirtual}}virtual {{/makeOperationsVirtual}}void {{nickname}}({{#allParams}}{{#required}}const {{{dataType}}} &{{/required}}{{^required}}const ::{{cppNamespace}}::OptionalParam<{{{dataType}}}> &{{/required}}{{paramName}}{{^required}} = ::{{cppNamespace}}::OptionalParam<{{{dataType}}}>(){{/required}}{{^-last}}, {{/-last}}{{/allParams}});
{{/operation}}{{/operations}}

private:
    QMap _serverIndices;
    QMap> _serverConfigs;
    QMap _apiKeys;
    QString _bearerToken;
    QString _username;
    QString _password;
    int _timeOut;
    QString _workingDirectory;
    QNetworkAccessManager* _manager;
    QMap _defaultHeaders;
    bool _isResponseCompressionEnabled;
    bool _isRequestCompressionEnabled;
    {{prefix}}HttpRequestInput _latestInput;
    {{prefix}}HttpRequestWorker *_latestWorker;
    QStringList _latestScope;
    OauthCode _authFlow;
    OauthImplicit _implicitFlow;
    OauthCredentials _credentialFlow;
    OauthPassword _passwordFlow;
    int _OauthMethod = 0;
{{#operations}}{{#operation}}
    void {{nickname}}Callback({{prefix}}HttpRequestWorker *worker);{{/operation}}{{/operations}}

Q_SIGNALS:
{{#operations}}{{#operation}}
    void {{nickname}}Signal({{#returnType}}{{{.}}} summary{{/returnType}});{{/operation}}{{/operations}}
{{#operations}}{{#operation}}{{#addDownloadProgress}}
    void {{nickname}}Progress(qint64 bytesReceived, qint64 bytesTotal);{{/addDownloadProgress}}{{/operation}}{{/operations}}
{{#operations}}{{#operation}}
    void {{nickname}}SignalFull({{prefix}}HttpRequestWorker *worker{{#returnType}}, {{{.}}} summary{{/returnType}});{{/operation}}{{/operations}}
{{#operations}}{{#operation}}
    Q_DECL_DEPRECATED_X("Use {{nickname}}SignalError() instead")
    void {{nickname}}SignalE({{#returnType}}{{{.}}} summary, {{/returnType}}QNetworkReply::NetworkError error_type, QString error_str);
    void {{nickname}}SignalError({{#returnType}}{{{.}}} summary, {{/returnType}}QNetworkReply::NetworkError error_type, const QString &error_str);{{/operation}}{{/operations}}
{{#operations}}{{#operation}}
    Q_DECL_DEPRECATED_X("Use {{nickname}}SignalErrorFull() instead")
    void {{nickname}}SignalEFull({{prefix}}HttpRequestWorker *worker, QNetworkReply::NetworkError error_type, QString error_str);
    void {{nickname}}SignalErrorFull({{prefix}}HttpRequestWorker *worker, QNetworkReply::NetworkError error_type, const QString &error_str);{{/operation}}{{/operations}}

    void abortRequestsSignal();
    void allPendingRequestsCompleted();

public Q_SLOTS:
    void tokenAvailable();
};

{{#cppNamespaceDeclarations}}
} // namespace {{this}}
{{/cppNamespaceDeclarations}}
#endif




© 2015 - 2024 Weber Informatics LLC | Privacy Policy