aboutsummaryrefslogtreecommitdiff
path: root/jobs
diff options
context:
space:
mode:
Diffstat (limited to 'jobs')
-rw-r--r--jobs/generated/inviting.cpp14
-rw-r--r--jobs/generated/inviting.h11
-rw-r--r--jobs/generated/kicking.cpp20
-rw-r--r--jobs/generated/kicking.h12
-rw-r--r--jobs/{{base}}.cpp.mustache63
-rw-r--r--jobs/{{base}}.h.mustache46
6 files changed, 53 insertions, 113 deletions
diff --git a/jobs/generated/inviting.cpp b/jobs/generated/inviting.cpp
index 1e0c29a3..164a2b2b 100644
--- a/jobs/generated/inviting.cpp
+++ b/jobs/generated/inviting.cpp
@@ -5,25 +5,23 @@
#include "inviting.h"
-
#include "../converters.h"
#include <QtCore/QStringBuilder>
using namespace QMatrixClient;
-
-
static const auto basePath = QStringLiteral("/_matrix/client/r0");
InviteUserJob::InviteUserJob(QString roomId, QString user_id)
: BaseJob(HttpVerb::Post, "InviteUserJob",
- basePath % "/rooms/" % roomId % "/invite",
- Query {},
- Data { { "user_id", toJson(user_id) } }
+ basePath % "/rooms/" % roomId % "/invite",
+ Query { },
+ Data {
+ { "user_id", toJson(user_id) }
+ }
)
{ }
-
-
+
diff --git a/jobs/generated/inviting.h b/jobs/generated/inviting.h
index 84cce06e..8cfc9118 100644
--- a/jobs/generated/inviting.h
+++ b/jobs/generated/inviting.h
@@ -5,30 +5,21 @@
#pragma once
-
#include "../basejob.h"
-
-
#include <QtCore/QString>
-
-
namespace QMatrixClient
{
-
// Operations
- /**
-
- */
class InviteUserJob : public BaseJob
{
public:
InviteUserJob(QString roomId, QString user_id);
+
};
-
} // namespace QMatrixClient
diff --git a/jobs/generated/kicking.cpp b/jobs/generated/kicking.cpp
index 4f9d6580..3e2ef5be 100644
--- a/jobs/generated/kicking.cpp
+++ b/jobs/generated/kicking.cpp
@@ -5,28 +5,24 @@
#include "kicking.h"
-
#include "../converters.h"
#include <QtCore/QStringBuilder>
using namespace QMatrixClient;
-
-
static const auto basePath = QStringLiteral("/_matrix/client/r0");
KickJob::KickJob(QString roomId, QString user_id, QString reason)
- : BaseJob(HttpVerb::Post, "KickJob"
- , basePath % "/rooms/" % roomId % "/kick"
- , Query { }
- , Data {
- { "user_id", toJson(user_id) },
- { "reason", toJson(reason) }
- }
+ : BaseJob(HttpVerb::Post, "KickJob",
+ basePath % "/rooms/" % roomId % "/kick",
+ Query { },
+ Data {
+ { "user_id", toJson(user_id) },
+ { "reason", toJson(reason) }
+ }
)
{ }
-
-
+
diff --git a/jobs/generated/kicking.h b/jobs/generated/kicking.h
index a746db8b..6ef19fcd 100644
--- a/jobs/generated/kicking.h
+++ b/jobs/generated/kicking.h
@@ -5,31 +5,21 @@
#pragma once
-
#include "../basejob.h"
-
-
#include <QtCore/QString>
-
-
namespace QMatrixClient
{
-
// Operations
- /**
-
- */
class KickJob : public BaseJob
{
public:
KickJob(QString roomId, QString user_id, QString reason);
-
+
};
-
} // namespace QMatrixClient
diff --git a/jobs/{{base}}.cpp.mustache b/jobs/{{base}}.cpp.mustache
index c9b0eb5e..0d01e6dd 100644
--- a/jobs/{{base}}.cpp.mustache
+++ b/jobs/{{base}}.cpp.mustache
@@ -1,76 +1,63 @@
{{#@filePartial}}preamble{{/@filePartial}}
#include "{{filenameBase}}.h"
-
{{#operations}}
#include "../converters.h"
#include <QtCore/QStringBuilder>
using namespace QMatrixClient;
-
- {{#returns?}}
+{{# returns?}}
class {{#@cap}}{{operationId}}{{/@cap}}Job::Private
{
public:
- {{#returns}}
- {{type}} {{name}};
- {{/returns}}
+ {{#returns}}{{type}} {{name}};{{/returns}}
};
- {{/returns?}}
-
+{{/ returns?}}
static const auto basePath = QStringLiteral("{{basePathWithoutHost}}");
-
- {{#operation}}
-{{#@cap}}{{operationId}}{{/@cap}}Job::{{#@cap}}{{operationId}}{{/@cap}}Job(const ConnectionData* connection{{#allParams}}, {{!}}
- {{#avoidCopy?}}const {{dataType}}&{{/avoidCopy?}}{{^avoidCopy?}}{{dataType}}{{/avoidCopy?}} {{paramName}}
- {{/allParams}})
- : BaseJob(connection, HttpVerb::{{#@cap}}{{#@tolower}}{{httpMethod}}{{/@tolower}}{{/@cap}}, "{{#@cap}}{{operationId}}{{/@cap}}Job"
- , basePath{{#pathParts}} % {{part}}{{/pathParts}}
- , Query { {{#queryParams}}
- { "{{baseName}}", toJson({{paramName}}).toString() }{{#hasMore}}, {{/hasMore}}
- {{/queryParams}} }
- , Data { {{#bodyParams}}
- { "{{baseName}}", toJson({{paramName}}) }{{#hasMore}}, {{/hasMore}}
- {{/bodyParams}} }
- {{#skipAuth}}, false{{/skipAuth}}
+{{# operation}}
+{{#@cap}}{{operationId}}{{/@cap}}Job::{{#@cap}}{{operationId}}{{/@cap}}Job({{#allParams}}{{#avoidCopy?}}const {{dataType}}&{{/avoidCopy?}}{{^avoidCopy?}}{{dataType}}{{/avoidCopy?}} {{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}})
+ : BaseJob(HttpVerb::{{#@cap}}{{#@tolower}}{{httpMethod}}{{/@tolower}}{{/@cap}}, "{{#@cap}}{{operationId}}{{/@cap}}Job",
+ basePath{{#pathParts}} % {{part}}{{/pathParts}},
+ Query {{^queryParams}}{ }{{/queryParams}}{{#queryParams?}}{
+ {{#queryParams}}{ "{{baseName}}", toJson({{paramName}}).toString() }{{#hasMore}},
+ {{/hasMore}}{{/queryParams}}
+ }{{/queryParams?}},
+ Data {{^bodyParams}}{ }{{/bodyParams}}{{#bodyParams?}}{
+ {{#bodyParams}}{ "{{baseName}}", toJson({{paramName}}) }{{#hasMore}},
+ {{/hasMore}}{{/bodyParams}}
+ }{{/bodyParams?}}{{#skipAuth}}, false{{/skipAuth}}
){{#returns?}}, d(new Private){{/returns?}}
{ }
- {{/operation}}
-
- {{#returns?}}
+{{/ operation}}
+{{# returns?}}
{{className}}Job::~{{className}}Job()
{
delete d;
}
-
- {{#returns}}
+{{# returns}}
{{type}} {{className}}Job::{{name}}() const
{
return d->{{name}};
}
- {{/returns}}
-
- {{#returnFile?}}
+{{/ returns}}
+{{# returnFile?}}
BaseJob::Status {{className}}Job::parseReply(QByteArray data)
{
{{#returns}}{{name}}{{/returns}} = data;
return Success;
}
- {{/returnFile?}}
- {{^returnFile?}}
+{{/ returnFile?}}{{^returnFile?}}
BaseJob::Status {{className}}Job::parseJson(const QJsonDocument& data)
{
auto json = data.object();
{{#returns}}
- {{#required?}}
- if (!json.contains("{{name}}")
- return { JsonParseError, "{{name}} not found in the response" };
- {{/required?}}
+ {{#required?}}if (!json.contains("{{name}}")
+ return { JsonParseError, "{{name}} not found in the response" };{{/required?}}
d->{{name}} = fromJson<{{type}}>(json.value("{{name}}"));
{{/returns}}
return Success;
}
- {{/returnFile?}}
- {{/returns?}}
+{{/ returnFile?}}
+{{/ returns?}}
{{/operations}}
diff --git a/jobs/{{base}}.h.mustache b/jobs/{{base}}.h.mustache
index 6fb9caef..e19cf03d 100644
--- a/jobs/{{base}}.h.mustache
+++ b/jobs/{{base}}.h.mustache
@@ -2,22 +2,14 @@
#pragma once
-{{#operations}}
-#include "../basejob.h"
-{{/operations}}
-
+{{#operations}}#include "../basejob.h"{{/operations}}
{{#imports}}
#include {{.}}
{{/imports}}
-
-{{#models}}
-#include <QtCore/QJsonValue> {{! FIXME: This should probably go inside imports }}
-{{/models}}
-
+{{#models}}#include <QtCore/QJsonValue>{{/models}}{{! FIXME: This should probably go inside imports }}
namespace QMatrixClient
{
-{{#models}}
- // Data structures
+{{#models}} // Data structures
{{#model}}
struct {{classname}}
{
@@ -25,41 +17,27 @@ namespace QMatrixClient
{{datatype}} {{name}};
{{/vars}}
operator QJsonValue() const { return {}; }
- };
- {{/model}}
+ };{{/model}}
{{/models}}
-{{#operations}}
- // Operations
+{{#operations}} // Operations
{{#operation}}
class {{#@cap}}{{operationId}}{{/@cap}}Job : public BaseJob
{
public:
- {{#@cap}}{{operationId}}{{/@cap}}Job(const ConnectionData* connection
- {{#allParams}}
- , {{!}}
- {{#avoidCopy?}}const {{dataType}}&{{/avoidCopy?}}
- {{^avoidCopy?}}{{dataType}}{{/avoidCopy?}} {{paramName}}
- {{/allParams}});
- {{#returns?}}
+ {{#@cap}}{{operationId}}{{/@cap}}Job({{#allParams}}{{#avoidCopy?}}const {{dataType}}&{{/avoidCopy?}}{{^avoidCopy?}}{{dataType}}{{/avoidCopy?}} {{paramName}}{{#hasMore}}, {{/hasMore}}{{/allParams}});
+ {{#returns?}}
virtual {{className}}Job();
- {{#returns}}
- {{type}} {{name}}() const;
- {{/returns}}
+ {{#returns}}{{type}} {{name}}() const;{{/returns}}
protected:
- {{#returnFile?}}
- Status parseReply(QByteArray data) override;
- {{/returnFile?}}
- {{^returnFile}}
- Status parseJson(const JsonDocument& data) override;
- {{/returnFile}}
+ {{#returnFile?}}Status parseReply(QByteArray data) override;{{/returnFile?}}
+ {{^returnFile}}Status parseJson(const JsonDocument& data) override;{{/returnFile}}
private:
class Private;
Private* d;
- {{/returns?}}
- };
- {{/operation}}
+ {{/returns?}}
+ };{{/operation}}
{{/operations}}
} // namespace QMatrixClient