aboutsummaryrefslogtreecommitdiff
path: root/lib/csapi
diff options
context:
space:
mode:
authorKitsune Ral <Kitsune-Ral@users.sf.net>2018-06-02 13:32:47 +0900
committerKitsune Ral <Kitsune-Ral@users.sf.net>2018-06-02 13:32:47 +0900
commit0dd491fbd189baaabadcab2344a05e3cf3898287 (patch)
tree13b8ebe63ba8b156ddd6ddab8b0ad2845d7c9c42 /lib/csapi
parente7ac6f3480358fd989c8a3090590d665d18e1cec (diff)
downloadlibquotient-0dd491fbd189baaabadcab2344a05e3cf3898287.tar.gz
libquotient-0dd491fbd189baaabadcab2344a05e3cf3898287.zip
csapi: Use Omittable<> container instead of intrusive 'omitted' field
Also: use the latest feature of GTAD, +set/+on, to make gtad.yaml more compact.
Diffstat (limited to 'lib/csapi')
-rw-r--r--lib/csapi/admin.h4
-rw-r--r--lib/csapi/administrative_contact.cpp3
-rw-r--r--lib/csapi/administrative_contact.h2
-rw-r--r--lib/csapi/content-repo.cpp16
-rw-r--r--lib/csapi/content-repo.h11
-rw-r--r--lib/csapi/create_room.cpp6
-rw-r--r--lib/csapi/create_room.h4
-rw-r--r--lib/csapi/event_context.cpp6
-rw-r--r--lib/csapi/event_context.h5
-rw-r--r--lib/csapi/gtad.yaml201
-rw-r--r--lib/csapi/joining.cpp13
-rw-r--r--lib/csapi/joining.h10
-rw-r--r--lib/csapi/list_public_rooms.cpp19
-rw-r--r--lib/csapi/list_public_rooms.h14
-rw-r--r--lib/csapi/message_pagination.cpp6
-rw-r--r--lib/csapi/message_pagination.h5
-rw-r--r--lib/csapi/notifications.cpp6
-rw-r--r--lib/csapi/notifications.h8
-rw-r--r--lib/csapi/pusher.cpp3
-rw-r--r--lib/csapi/pusher.h4
-rw-r--r--lib/csapi/search.cpp15
-rw-r--r--lib/csapi/search.h30
-rw-r--r--lib/csapi/typing.cpp2
-rw-r--r--lib/csapi/typing.h3
-rw-r--r--lib/csapi/users.cpp2
-rw-r--r--lib/csapi/users.h4
-rw-r--r--lib/csapi/{{base}}.cpp.mustache12
-rw-r--r--lib/csapi/{{base}}.h.mustache12
28 files changed, 173 insertions, 253 deletions
diff --git a/lib/csapi/admin.h b/lib/csapi/admin.h
index e57c6cfe..087eabf0 100644
--- a/lib/csapi/admin.h
+++ b/lib/csapi/admin.h
@@ -6,9 +6,9 @@
#include "jobs/basejob.h"
+#include <QtCore/QVector>
#include <QtCore/QHash>
#include "converters.h"
-#include <QtCore/QVector>
namespace QMatrixClient
{
@@ -22,7 +22,7 @@ namespace QMatrixClient
struct ConnectionInfo
{
QString ip;
- qint64 lastSeen;
+ Omittable<qint64> lastSeen;
QString userAgent;
};
diff --git a/lib/csapi/administrative_contact.cpp b/lib/csapi/administrative_contact.cpp
index 7c6c4141..14079179 100644
--- a/lib/csapi/administrative_contact.cpp
+++ b/lib/csapi/administrative_contact.cpp
@@ -72,9 +72,6 @@ namespace QMatrixClient
QJsonObject toJson(const Post3PIDsJob::ThreePidCredentials& pod)
{
QJsonObject _json;
- if (pod.omitted)
- return _json;
-
addToJson<>(_json, "client_secret", pod.clientSecret);
addToJson<>(_json, "id_server", pod.idServer);
addToJson<>(_json, "sid", pod.sid);
diff --git a/lib/csapi/administrative_contact.h b/lib/csapi/administrative_contact.h
index 2fbf5c0a..57d11d34 100644
--- a/lib/csapi/administrative_contact.h
+++ b/lib/csapi/administrative_contact.h
@@ -59,8 +59,6 @@ namespace QMatrixClient
QString clientSecret;
QString idServer;
QString sid;
-
- bool omitted;
};
// Construction/destruction
diff --git a/lib/csapi/content-repo.cpp b/lib/csapi/content-repo.cpp
index 95fc5aed..101f0ee9 100644
--- a/lib/csapi/content-repo.cpp
+++ b/lib/csapi/content-repo.cpp
@@ -156,7 +156,7 @@ class GetContentThumbnailJob::Private
QIODevice* content;
};
-BaseJob::Query queryToGetContentThumbnail(int width, int height, const QString& method)
+BaseJob::Query queryToGetContentThumbnail(Omittable<int> width, Omittable<int> height, const QString& method)
{
BaseJob::Query _q;
_q.addQueryItem("width", QString("%1").arg(width));
@@ -166,14 +166,14 @@ BaseJob::Query queryToGetContentThumbnail(int width, int height, const QString&
return _q;
}
-QUrl GetContentThumbnailJob::makeRequestUrl(QUrl baseUrl, const QString& serverName, const QString& mediaId, int width, int height, const QString& method)
+QUrl GetContentThumbnailJob::makeRequestUrl(QUrl baseUrl, const QString& serverName, const QString& mediaId, Omittable<int> width, Omittable<int> height, const QString& method)
{
return BaseJob::makeRequestUrl(std::move(baseUrl),
basePath % "/thumbnail/" % serverName % "/" % mediaId,
queryToGetContentThumbnail(width, height, method));
}
-GetContentThumbnailJob::GetContentThumbnailJob(const QString& serverName, const QString& mediaId, int width, int height, const QString& method)
+GetContentThumbnailJob::GetContentThumbnailJob(const QString& serverName, const QString& mediaId, Omittable<int> width, Omittable<int> height, const QString& method)
: BaseJob(HttpVerb::Get, "GetContentThumbnailJob",
basePath % "/thumbnail/" % serverName % "/" % mediaId,
queryToGetContentThumbnail(width, height, method),
@@ -205,11 +205,11 @@ BaseJob::Status GetContentThumbnailJob::parseReply(QNetworkReply* reply)
class GetUrlPreviewJob::Private
{
public:
- qint64 matrixImageSize;
+ Omittable<qint64> matrixImageSize;
QString ogImage;
};
-BaseJob::Query queryToGetUrlPreview(const QString& url, qint64 ts)
+BaseJob::Query queryToGetUrlPreview(const QString& url, Omittable<qint64> ts)
{
BaseJob::Query _q;
_q.addQueryItem("url", url);
@@ -217,14 +217,14 @@ BaseJob::Query queryToGetUrlPreview(const QString& url, qint64 ts)
return _q;
}
-QUrl GetUrlPreviewJob::makeRequestUrl(QUrl baseUrl, const QString& url, qint64 ts)
+QUrl GetUrlPreviewJob::makeRequestUrl(QUrl baseUrl, const QString& url, Omittable<qint64> ts)
{
return BaseJob::makeRequestUrl(std::move(baseUrl),
basePath % "/preview_url",
queryToGetUrlPreview(url, ts));
}
-GetUrlPreviewJob::GetUrlPreviewJob(const QString& url, qint64 ts)
+GetUrlPreviewJob::GetUrlPreviewJob(const QString& url, Omittable<qint64> ts)
: BaseJob(HttpVerb::Get, "GetUrlPreviewJob",
basePath % "/preview_url",
queryToGetUrlPreview(url, ts))
@@ -234,7 +234,7 @@ GetUrlPreviewJob::GetUrlPreviewJob(const QString& url, qint64 ts)
GetUrlPreviewJob::~GetUrlPreviewJob() = default;
-qint64 GetUrlPreviewJob::matrixImageSize() const
+Omittable<qint64> GetUrlPreviewJob::matrixImageSize() const
{
return d->matrixImageSize;
}
diff --git a/lib/csapi/content-repo.h b/lib/csapi/content-repo.h
index 63a55c8f..8d73dc51 100644
--- a/lib/csapi/content-repo.h
+++ b/lib/csapi/content-repo.h
@@ -6,6 +6,7 @@
#include "jobs/basejob.h"
+#include "converters.h"
#include <QtCore/QIODevice>
namespace QMatrixClient
@@ -89,14 +90,14 @@ namespace QMatrixClient
class GetContentThumbnailJob : public BaseJob
{
public:
- explicit GetContentThumbnailJob(const QString& serverName, const QString& mediaId, int width = {}, int height = {}, const QString& method = {});
+ explicit GetContentThumbnailJob(const QString& serverName, const QString& mediaId, Omittable<int> width = none, Omittable<int> height = none, const QString& method = {});
/** Construct a URL out of baseUrl and usual parameters passed to
* GetContentThumbnailJob. This function can be used when
* a URL for GetContentThumbnailJob is necessary but the job
* itself isn't.
*/
- static QUrl makeRequestUrl(QUrl baseUrl, const QString& serverName, const QString& mediaId, int width = {}, int height = {}, const QString& method = {});
+ static QUrl makeRequestUrl(QUrl baseUrl, const QString& serverName, const QString& mediaId, Omittable<int> width = none, Omittable<int> height = none, const QString& method = {});
~GetContentThumbnailJob() override;
@@ -116,20 +117,20 @@ namespace QMatrixClient
class GetUrlPreviewJob : public BaseJob
{
public:
- explicit GetUrlPreviewJob(const QString& url, qint64 ts = {});
+ explicit GetUrlPreviewJob(const QString& url, Omittable<qint64> ts = none);
/** Construct a URL out of baseUrl and usual parameters passed to
* GetUrlPreviewJob. This function can be used when
* a URL for GetUrlPreviewJob is necessary but the job
* itself isn't.
*/
- static QUrl makeRequestUrl(QUrl baseUrl, const QString& url, qint64 ts = {});
+ static QUrl makeRequestUrl(QUrl baseUrl, const QString& url, Omittable<qint64> ts = none);
~GetUrlPreviewJob() override;
// Result properties
- qint64 matrixImageSize() const;
+ Omittable<qint64> matrixImageSize() const;
const QString& ogImage() const;
protected:
diff --git a/lib/csapi/create_room.cpp b/lib/csapi/create_room.cpp
index 72c8d547..17a9c60f 100644
--- a/lib/csapi/create_room.cpp
+++ b/lib/csapi/create_room.cpp
@@ -19,9 +19,6 @@ namespace QMatrixClient
QJsonObject toJson(const CreateRoomJob::Invite3pid& pod)
{
QJsonObject _json;
- if (pod.omitted)
- return _json;
-
addToJson<>(_json, "id_server", pod.idServer);
addToJson<>(_json, "medium", pod.medium);
addToJson<>(_json, "address", pod.address);
@@ -31,9 +28,6 @@ namespace QMatrixClient
QJsonObject toJson(const CreateRoomJob::StateEvent& pod)
{
QJsonObject _json;
- if (pod.omitted)
- return _json;
-
addToJson<IfNotEmpty>(_json, "type", pod.type);
addToJson<IfNotEmpty>(_json, "state_key", pod.stateKey);
addToJson<IfNotEmpty>(_json, "content", pod.content);
diff --git a/lib/csapi/create_room.h b/lib/csapi/create_room.h
index c5f5edf5..995d5e73 100644
--- a/lib/csapi/create_room.h
+++ b/lib/csapi/create_room.h
@@ -25,8 +25,6 @@ namespace QMatrixClient
QString idServer;
QString medium;
QString address;
-
- bool omitted;
};
struct StateEvent
@@ -34,8 +32,6 @@ namespace QMatrixClient
QString type;
QString stateKey;
QJsonObject content;
-
- bool omitted;
};
// Construction/destruction
diff --git a/lib/csapi/event_context.cpp b/lib/csapi/event_context.cpp
index d9ab45ca..c7e01391 100644
--- a/lib/csapi/event_context.cpp
+++ b/lib/csapi/event_context.cpp
@@ -23,21 +23,21 @@ class GetEventContextJob::Private
StateEvents state;
};
-BaseJob::Query queryToGetEventContext(int limit)
+BaseJob::Query queryToGetEventContext(Omittable<int> limit)
{
BaseJob::Query _q;
_q.addQueryItem("limit", QString("%1").arg(limit));
return _q;
}
-QUrl GetEventContextJob::makeRequestUrl(QUrl baseUrl, const QString& roomId, const QString& eventId, int limit)
+QUrl GetEventContextJob::makeRequestUrl(QUrl baseUrl, const QString& roomId, const QString& eventId, Omittable<int> limit)
{
return BaseJob::makeRequestUrl(std::move(baseUrl),
basePath % "/rooms/" % roomId % "/context/" % eventId,
queryToGetEventContext(limit));
}
-GetEventContextJob::GetEventContextJob(const QString& roomId, const QString& eventId, int limit)
+GetEventContextJob::GetEventContextJob(const QString& roomId, const QString& eventId, Omittable<int> limit)
: BaseJob(HttpVerb::Get, "GetEventContextJob",
basePath % "/rooms/" % roomId % "/context/" % eventId,
queryToGetEventContext(limit))
diff --git a/lib/csapi/event_context.h b/lib/csapi/event_context.h
index 7929c492..0470ba36 100644
--- a/lib/csapi/event_context.h
+++ b/lib/csapi/event_context.h
@@ -7,6 +7,7 @@
#include "jobs/basejob.h"
#include "events/event.h"
+#include "converters.h"
namespace QMatrixClient
{
@@ -15,14 +16,14 @@ namespace QMatrixClient
class GetEventContextJob : public BaseJob
{
public:
- explicit GetEventContextJob(const QString& roomId, const QString& eventId, int limit = {});
+ explicit GetEventContextJob(const QString& roomId, const QString& eventId, Omittable<int> limit = none);
/** Construct a URL out of baseUrl and usual parameters passed to
* GetEventContextJob. This function can be used when
* a URL for GetEventContextJob is necessary but the job
* itself isn't.
*/
- static QUrl makeRequestUrl(QUrl baseUrl, const QString& roomId, const QString& eventId, int limit = {});
+ static QUrl makeRequestUrl(QUrl baseUrl, const QString& roomId, const QString& eventId, Omittable<int> limit = none);
~GetEventContextJob() override;
diff --git a/lib/csapi/gtad.yaml b/lib/csapi/gtad.yaml
index cb68ad1b..6f9750d0 100644
--- a/lib/csapi/gtad.yaml
+++ b/lib/csapi/gtad.yaml
@@ -9,111 +9,99 @@ analyzer:
origin_server_ts: originServerTimestamp # Instead of originServerTs
start: begin # Because start() is a method in BaseJob
+ # Structure inside `types`:
+ # - swaggerType: <targetTypeSpec>
+ # OR
+ # - swaggerType:
+ # - swaggerFormat: <targetTypeSpec>
+ # - /swaggerFormatRegEx/: <targetTypeSpec>
+ # - //: <targetTypeSpec> # default, if the format doesn't mach anything above
+ # WHERE
+ # targetTypeSpec = targetType OR
+ # { type: targetType, imports: <filename OR [ filenames... ]>, <other attributes...> }
+ # swaggerType can be @apply/@on pair; attributes from the map under @apply
+ # are added to each type from the sequence under @on.
types:
- # Structure:
- # swaggerType: <targetTypeSpec>
- # OR
- # swaggerType:
- # - swaggerFormat: <targetTypeSpec>
- # - /swaggerFormatRegEx/: <targetTypeSpec>
- # - //: <targetTypeSpec> # default, if the format doesn't mach anything above
- # WHERE
- # targetTypeSpec = targetType OR
- # { type: targetType, imports: <filename OR [ filenames... ]>, <other attributes...> }
- integer:
- - int64: qint64
- - int32: qint32
- - //: int
- number:
- - float: float
- - //: double
- boolean: { type: bool, omitted: false }
- string:
+ - +set: &UseOmittable
+ useOmittable:
+ imports: [ '"converters.h"' ]
+ omittedValue: none # See `none` in converters.h
+ +on:
+ - integer:
+ - int64: qint64
+ - int32: qint32
+ - //: int
+ - number:
+ - float: float
+ - //: double
+ - boolean: { type: bool, omittedValue: 'false' }
+ - string:
- byte: &ByteStream
type: QIODevice*
imports: <QtCore/QIODevice>
- binary: *ByteStream
- - date:
- type: QDate
- initializer: QDate::fromString("{{defaultValue}}")
- avoidCopy?: true
- imports: <QtCore/QDate>
- - dateTime:
- type: QDateTime
- initializer: QDateTime::fromString("{{defaultValue}}")
- avoidCopy?: true
- imports: <QtCore/QDateTime>
- - //:
- type: QString
- initializer: QStringLiteral("{{defaultValue}}")
- string?: true
- avoidCopy?: true
- file: *ByteStream
- object:
- - /state_event.yaml$/:
- type: StateEventPtr
- noCopy?: true
- imports: '"events/event.h"'
- - /room_event.yaml$/:
- type: RoomEventPtr
- noCopy?: true
- imports: '"events/event.h"'
- - /event.yaml$/:
- type: EventPtr
- noCopy?: true
- imports: '"events/event.h"'
- - //:
- type: QJsonObject
- avoidCopy?: true
- imports: <QtCore/QJsonObject>
- array:
- - string:
- type: QStringList
- avoidCopy?: true
- imports: <QtCore/QStringList>
- - /^Notification|Result$/:
- type: "std::vector<{{1}}>"
- noCopy?: true
- imports: '"events/event.h"'
- - /m\.room\.member$/:
- type: "EventsArray<RoomMemberEvent>"
- noCopy?: true
- imports: '"events/roommemberevent.h"'
- - /state_event.yaml$/:
- type: StateEvents
- noCopy?: true
- - /room_event.yaml$/:
- type: RoomEvents
- noCopy?: true
- - /event.yaml$/:
- type: Events
- noCopy?: true
- - /.+/:
- type: "QVector<{{1}}>"
- avoidCopy?: true
- imports: <QtCore/QVector>
- - //: { type: QJsonArray, "avoidCopy?": true, imports: <QtCore/QJsonArray> }
- map:
- - RoomState:
- type: "std::unordered_map<QString, {{1}}>"
- noCopy?: true
- imports: <unordered_map>
- - /.+/:
- type: "QHash<QString, {{1}}>"
- avoidCopy?: true
- imports: <QtCore/QHash>
- - //:
- type: QVariantHash
- avoidCopy?: true
- imports: '"variant_converters.h"'
- variant:
- type: QVariant
- avoidCopy?: true
- imports: '"variant_converters.h"'
- schema: # Properties of inline structure definitions
- avoidCopy?: true
- omitted: omitted<{{dataType.name}}>()
- imports: '"converters.h"'
+ - +set: { "avoidCopy?": true }
+ +on:
+ - date:
+ type: QDate
+ initializer: QDate::fromString("{{defaultValue}}")
+ imports: <QtCore/QDate>
+ - dateTime:
+ type: QDateTime
+ initializer: QDateTime::fromString("{{defaultValue}}")
+ imports: <QtCore/QDateTime>
+ - //:
+ type: QString
+ initializer: QStringLiteral("{{defaultValue}}")
+ string?: true
+ - file: *ByteStream
+ - +set: { "avoidCopy?": true }
+ +on:
+ - object: { type: QJsonObject, imports: <QtCore/QJsonObject> }
+ - $ref:
+ - /m\.room\.member$/: pass # This $ref is only used in an array, see below
+ - +set: { "noCopy?": true }
+ +on:
+ - /state_event.yaml$/:
+ { type: StateEventPtr, imports: '"events/event.h"' }
+ - /room_event.yaml$/:
+ { type: RoomEventPtr, imports: '"events/event.h"' }
+ - /event.yaml$/:
+ { type: EventPtr, imports: '"events/event.h"' }
+ - array:
+ - string: { type: QStringList, imports: <QtCore/QStringList> }
+ - +set: { "noCopy?": true}
+ +on:
+ - /^Notification|Result$/:
+ type: "std::vector<{{1}}>"
+ imports: '"events/event.h"'
+ - /m\.room\.member$/:
+ type: "EventsArray<RoomMemberEvent>"
+ imports: '"events/roommemberevent.h"'
+ - /state_event.yaml$/:
+ type: StateEvents
+ - /room_event.yaml$/:
+ type: RoomEvents
+ - /event.yaml$/:
+ type: Events
+ - /.+/: { type: "QVector<{{1}}>", imports: <QtCore/QVector> }
+ - //: { type: QJsonArray, imports: <QtCore/QJsonArray> }
+ # `additionalProperties` in OpenAPI
+ - map:
+ - RoomState:
+ type: "std::unordered_map<QString, {{1}}>"
+ noCopy?: true
+ imports: <unordered_map>
+ - /.+/:
+ type: "QHash<QString, {{1}}>"
+ imports: <QtCore/QHash>
+ - //:
+ type: QVariantHash
+ imports: '"variant_converters.h"'
+ # A sequence `type` in OpenAPI
+ - variant: { type: QVariant, imports: '"variant_converters.h"' }
+ - schema: # Properties of inline structure definitions
+ *UseOmittable
#operations:
@@ -121,12 +109,15 @@ mustache:
definitions:
_scopeRenderer: "{{scopeCamelCase}}Job::"
_literalQuote: '"'
- # Default value for omitted
- omitted: '{}'
- maybeCrefType: "{{#avoidCopy?}}const {{/avoidCopy?}}{{dataType.name}}{{#avoidCopy?}}&{{/avoidCopy?}}{{#noCopy?}}&&{{/noCopy?}}"
+ omittedValue: '{}' # default value to initialize omitted parameters with
+ openOmittable: "{{^required?}}{{#useOmittable}}Omittable<{{/useOmittable}}{{/required?}}"
+ closeOmittable: "{{^required?}}{{#useOmittable}}>{{/useOmittable}}{{/required?}}"
+ maybeOmittableType: "{{>openOmittable}}{{dataType.name}}{{>closeOmittable}}"
+ qualifiedMaybeOmittableType: "{{>openOmittable}}{{dataType.qualifiedName}}{{>closeOmittable}}"
+ maybeCrefType: "{{#avoidCopy?}}const {{/avoidCopy?}}{{>maybeOmittableType}}{{#avoidCopy?}}&{{/avoidCopy?}}{{#noCopy?}}&&{{/noCopy?}}"
qualifiedMaybeCrefType:
- "{{#avoidCopy?}}const {{/avoidCopy?}}{{dataType.qualifiedName}}{{#avoidCopy?}}&{{/avoidCopy?}}{{#noCopy?}}&&{{/noCopy?}}"
- initializeDefaultValue: "{{#defaultValue}}{{#initializer}}{{>initializer}}{{/initializer}}{{/defaultValue}}{{^defaultValue}}{{>omitted}}{{/defaultValue}}"
+ "{{#avoidCopy?}}const {{/avoidCopy?}}{{>qualifiedMaybeOmittableType}}{{#avoidCopy?}}&{{/avoidCopy?}}{{#noCopy?}}&&{{/noCopy?}}"
+ initializeDefaultValue: "{{#defaultValue}}{{#initializer}}{{>initializer}}{{/initializer}}{{/defaultValue}}{{^defaultValue}}{{>omittedValue}}{{/defaultValue}}"
joinedParamDecl: '{{>maybeCrefType}} {{paramName}}{{^required?}} = {{>initializeDefaultValue}}{{/required?}}{{#@join}}, {{/@join}}'
joinedParamDef: '{{>maybeCrefType}} {{paramName}}{{#@join}}, {{/@join}}'
passQueryParams: '{{#queryParams}}{{paramName}}{{#@join}}, {{/@join}}{{/queryParams}}'
diff --git a/lib/csapi/joining.cpp b/lib/csapi/joining.cpp
index 6f8081d0..90aa58c4 100644
--- a/lib/csapi/joining.cpp
+++ b/lib/csapi/joining.cpp
@@ -19,9 +19,6 @@ namespace QMatrixClient
QJsonObject toJson(const JoinRoomByIdJob::ThirdPartySigned& pod)
{
QJsonObject _json;
- if (pod.omitted)
- return _json;
-
addToJson<>(_json, "sender", pod.sender);
addToJson<>(_json, "mxid", pod.mxid);
addToJson<>(_json, "token", pod.token);
@@ -36,7 +33,7 @@ class JoinRoomByIdJob::Private
QString roomId;
};
-JoinRoomByIdJob::JoinRoomByIdJob(const QString& roomId, const ThirdPartySigned& thirdPartySigned)
+JoinRoomByIdJob::JoinRoomByIdJob(const QString& roomId, const Omittable<ThirdPartySigned>& thirdPartySigned)
: BaseJob(HttpVerb::Post, "JoinRoomByIdJob",
basePath % "/rooms/" % roomId % "/join")
, d(new Private)
@@ -70,9 +67,6 @@ namespace QMatrixClient
QJsonObject toJson(const JoinRoomJob::Signed& pod)
{
QJsonObject _json;
- if (pod.omitted)
- return _json;
-
addToJson<>(_json, "sender", pod.sender);
addToJson<>(_json, "mxid", pod.mxid);
addToJson<>(_json, "token", pod.token);
@@ -83,9 +77,6 @@ namespace QMatrixClient
QJsonObject toJson(const JoinRoomJob::ThirdPartySigned& pod)
{
QJsonObject _json;
- if (pod.omitted)
- return _json;
-
addToJson<>(_json, "signed", pod.signedData);
return _json;
}
@@ -97,7 +88,7 @@ class JoinRoomJob::Private
QString roomId;
};
-JoinRoomJob::JoinRoomJob(const QString& roomIdOrAlias, const ThirdPartySigned& thirdPartySigned)
+JoinRoomJob::JoinRoomJob(const QString& roomIdOrAlias, const Omittable<ThirdPartySigned>& thirdPartySigned)
: BaseJob(HttpVerb::Post, "JoinRoomJob",
basePath % "/join/" % roomIdOrAlias)
, d(new Private)
diff --git a/lib/csapi/joining.h b/lib/csapi/joining.h
index d7c7cbb1..7742a0a5 100644
--- a/lib/csapi/joining.h
+++ b/lib/csapi/joining.h
@@ -24,13 +24,11 @@ namespace QMatrixClient
QString mxid;
QString token;
QJsonObject signatures;
-
- bool omitted;
};
// Construction/destruction
- explicit JoinRoomByIdJob(const QString& roomId, const ThirdPartySigned& thirdPartySigned = omitted<ThirdPartySigned>());
+ explicit JoinRoomByIdJob(const QString& roomId, const Omittable<ThirdPartySigned>& thirdPartySigned = none);
~JoinRoomByIdJob() override;
// Result properties
@@ -56,20 +54,16 @@ namespace QMatrixClient
QString mxid;
QString token;
QJsonObject signatures;
-
- bool omitted;
};
struct ThirdPartySigned
{
Signed signedData;
-
- bool omitted;
};
// Construction/destruction
- explicit JoinRoomJob(const QString& roomIdOrAlias, const ThirdPartySigned& thirdPartySigned = omitted<ThirdPartySigned>());
+ explicit JoinRoomJob(const QString& roomIdOrAlias, const Omittable<ThirdPartySigned>& thirdPartySigned = none);
~JoinRoomJob() override;
// Result properties
diff --git a/lib/csapi/list_public_rooms.cpp b/lib/csapi/list_public_rooms.cpp
index b60d14fd..97beba1c 100644
--- a/lib/csapi/list_public_rooms.cpp
+++ b/lib/csapi/list_public_rooms.cpp
@@ -94,10 +94,10 @@ class GetPublicRoomsJob::Private
QVector<PublicRoomsChunk> chunk;
QString nextBatch;
QString prevBatch;
- qint64 totalRoomCountEstimate;
+ Omittable<qint64> totalRoomCountEstimate;
};
-BaseJob::Query queryToGetPublicRooms(int limit, const QString& since, const QString& server)
+BaseJob::Query queryToGetPublicRooms(Omittable<int> limit, const QString& since, const QString& server)
{
BaseJob::Query _q;
_q.addQueryItem("limit", QString("%1").arg(limit));
@@ -108,14 +108,14 @@ BaseJob::Query queryToGetPublicRooms(int limit, const QString& since, const QStr
return _q;
}
-QUrl GetPublicRoomsJob::makeRequestUrl(QUrl baseUrl, int limit, const QString& since, const QString& server)
+QUrl GetPublicRoomsJob::makeRequestUrl(QUrl baseUrl, Omittable<int> limit, const QString& since, const QString& server)
{
return BaseJob::makeRequestUrl(std::move(baseUrl),
basePath % "/publicRooms",
queryToGetPublicRooms(limit, since, server));
}
-GetPublicRoomsJob::GetPublicRoomsJob(int limit, const QString& since, const QString& server)
+GetPublicRoomsJob::GetPublicRoomsJob(Omittable<int> limit, const QString& since, const QString& server)
: BaseJob(HttpVerb::Get, "GetPublicRoomsJob",
basePath % "/publicRooms",
queryToGetPublicRooms(limit, since, server),
@@ -141,7 +141,7 @@ const QString& GetPublicRoomsJob::prevBatch() const
return d->prevBatch;
}
-qint64 GetPublicRoomsJob::totalRoomCountEstimate() const
+Omittable<qint64> GetPublicRoomsJob::totalRoomCountEstimate() const
{
return d->totalRoomCountEstimate;
}
@@ -166,9 +166,6 @@ namespace QMatrixClient
QJsonObject toJson(const QueryPublicRoomsJob::Filter& pod)
{
QJsonObject _json;
- if (pod.omitted)
- return _json;
-
addToJson<IfNotEmpty>(_json, "generic_search_term", pod.genericSearchTerm);
return _json;
}
@@ -209,7 +206,7 @@ class QueryPublicRoomsJob::Private
QVector<PublicRoomsChunk> chunk;
QString nextBatch;
QString prevBatch;
- qint64 totalRoomCountEstimate;
+ Omittable<qint64> totalRoomCountEstimate;
};
BaseJob::Query queryToQueryPublicRooms(const QString& server)
@@ -220,7 +217,7 @@ BaseJob::Query queryToQueryPublicRooms(const QString& server)
return _q;
}
-QueryPublicRoomsJob::QueryPublicRoomsJob(const QString& server, int limit, const QString& since, const Filter& filter)
+QueryPublicRoomsJob::QueryPublicRoomsJob(const QString& server, Omittable<int> limit, const QString& since, const Omittable<Filter>& filter)
: BaseJob(HttpVerb::Post, "QueryPublicRoomsJob",
basePath % "/publicRooms",
queryToQueryPublicRooms(server))
@@ -250,7 +247,7 @@ const QString& QueryPublicRoomsJob::prevBatch() const
return d->prevBatch;
}
-qint64 QueryPublicRoomsJob::totalRoomCountEstimate() const
+Omittable<qint64> QueryPublicRoomsJob::totalRoomCountEstimate() const
{
return d->totalRoomCountEstimate;
}
diff --git a/lib/csapi/list_public_rooms.h b/lib/csapi/list_public_rooms.h
index ae589378..16278bd5 100644
--- a/lib/csapi/list_public_rooms.h
+++ b/lib/csapi/list_public_rooms.h
@@ -6,9 +6,9 @@
#include "jobs/basejob.h"
-#include "converters.h"
#include <QtCore/QVector>
#include <QtCore/QStringList>
+#include "converters.h"
namespace QMatrixClient
{
@@ -66,14 +66,14 @@ namespace QMatrixClient
// Construction/destruction
- explicit GetPublicRoomsJob(int limit = {}, const QString& since = {}, const QString& server = {});
+ explicit GetPublicRoomsJob(Omittable<int> limit = none, const QString& since = {}, const QString& server = {});
/** Construct a URL out of baseUrl and usual parameters passed to
* GetPublicRoomsJob. This function can be used when
* a URL for GetPublicRoomsJob is necessary but the job
* itself isn't.
*/
- static QUrl makeRequestUrl(QUrl baseUrl, int limit = {}, const QString& since = {}, const QString& server = {});
+ static QUrl makeRequestUrl(QUrl baseUrl, Omittable<int> limit = none, const QString& since = {}, const QString& server = {});
~GetPublicRoomsJob() override;
@@ -82,7 +82,7 @@ namespace QMatrixClient
const QVector<PublicRoomsChunk>& chunk() const;
const QString& nextBatch() const;
const QString& prevBatch() const;
- qint64 totalRoomCountEstimate() const;
+ Omittable<qint64> totalRoomCountEstimate() const;
protected:
Status parseJson(const QJsonDocument& data) override;
@@ -100,8 +100,6 @@ namespace QMatrixClient
struct Filter
{
QString genericSearchTerm;
-
- bool omitted;
};
struct PublicRoomsChunk
@@ -119,7 +117,7 @@ namespace QMatrixClient
// Construction/destruction
- explicit QueryPublicRoomsJob(const QString& server = {}, int limit = {}, const QString& since = {}, const Filter& filter = omitted<Filter>());
+ explicit QueryPublicRoomsJob(const QString& server = {}, Omittable<int> limit = none, const QString& since = {}, const Omittable<Filter>& filter = none);
~QueryPublicRoomsJob() override;
// Result properties
@@ -127,7 +125,7 @@ namespace QMatrixClient
const QVector<PublicRoomsChunk>& chunk() const;
const QString& nextBatch() const;
const QString& prevBatch() const;
- qint64 totalRoomCountEstimate() const;
+ Omittable<qint64> totalRoomCountEstimate() const;
protected:
Status parseJson(const QJsonDocument& data) override;
diff --git a/lib/csapi/message_pagination.cpp b/lib/csapi/message_pagination.cpp
index f89ccd03..1ea852de 100644
--- a/lib/csapi/message_pagination.cpp
+++ b/lib/csapi/message_pagination.cpp
@@ -20,7 +20,7 @@ class GetRoomEventsJob::Private
RoomEvents chunk;
};
-BaseJob::Query queryToGetRoomEvents(const QString& from, const QString& to, const QString& dir, int limit, const QString& filter)
+BaseJob::Query queryToGetRoomEvents(const QString& from, const QString& to, const QString& dir, Omittable<int> limit, const QString& filter)
{
BaseJob::Query _q;
_q.addQueryItem("from", from);
@@ -33,14 +33,14 @@ BaseJob::Query queryToGetRoomEvents(const QString& from, const QString& to, cons
return _q;
}
-QUrl GetRoomEventsJob::makeRequestUrl(QUrl baseUrl, const QString& roomId, const QString& from, const QString& dir, const QString& to, int limit, const QString& filter)
+QUrl GetRoomEventsJob::makeRequestUrl(QUrl baseUrl, const QString& roomId, const QString& from, const QString& dir, const QString& to, Omittable<int> limit, const QString& filter)
{
return BaseJob::makeRequestUrl(std::move(baseUrl),
basePath % "/rooms/" % roomId % "/messages",
queryToGetRoomEvents(from, to, dir, limit, filter));
}
-GetRoomEventsJob::GetRoomEventsJob(const QString& roomId, const QString& from, const QString& dir, const QString& to, int limit, const QString& filter)
+GetRoomEventsJob::GetRoomEventsJob(const QString& roomId, const QString& from, const QString& dir, const QString& to, Omittable<int> limit, const QString& filter)
: BaseJob(HttpVerb::Get, "GetRoomEventsJob",
basePath % "/rooms/" % roomId % "/messages",
queryToGetRoomEvents(from, to, dir, limit, filter))
diff --git a/lib/csapi/message_pagination.h b/lib/csapi/message_pagination.h
index c9ede1f1..92b258ea 100644
--- a/lib/csapi/message_pagination.h
+++ b/lib/csapi/message_pagination.h
@@ -7,6 +7,7 @@
#include "jobs/basejob.h"
#include "events/event.h"
+#include "converters.h"
namespace QMatrixClient
{
@@ -15,14 +16,14 @@ namespace QMatrixClient
class GetRoomEventsJob : public BaseJob
{
public:
- explicit GetRoomEventsJob(const QString& roomId, const QString& from, const QString& dir, const QString& to = {}, int limit = {}, const QString& filter = {});
+ explicit GetRoomEventsJob(const QString& roomId, const QString& from, const QString& dir, const QString& to = {}, Omittable<int> limit = none, const QString& filter = {});
/** Construct a URL out of baseUrl and usual parameters passed to
* GetRoomEventsJob. This function can be used when
* a URL for GetRoomEventsJob is necessary but the job
* itself isn't.
*/
- static QUrl makeRequestUrl(QUrl baseUrl, const QString& roomId, const QString& from, const QString& dir, const QString& to = {}, int limit = {}, const QString& filter = {});
+ static QUrl makeRequestUrl(QUrl baseUrl, const QString& roomId, const QString& from, const QString& dir, const QString& to = {}, Omittable<int> limit = none, const QString& filter = {});
~GetRoomEventsJob() override;
diff --git a/lib/csapi/notifications.cpp b/lib/csapi/notifications.cpp
index 17628cc5..4c77d760 100644
--- a/lib/csapi/notifications.cpp
+++ b/lib/csapi/notifications.cpp
@@ -47,7 +47,7 @@ class GetNotificationsJob::Private
std::vector<Notification> notifications;
};
-BaseJob::Query queryToGetNotifications(const QString& from, int limit, const QString& only)
+BaseJob::Query queryToGetNotifications(const QString& from, Omittable<int> limit, const QString& only)
{
BaseJob::Query _q;
if (!from.isEmpty())
@@ -58,14 +58,14 @@ BaseJob::Query queryToGetNotifications(const QString& from, int limit, const QSt
return _q;
}
-QUrl GetNotificationsJob::makeRequestUrl(QUrl baseUrl, const QString& from, int limit, const QString& only)
+QUrl GetNotificationsJob::makeRequestUrl(QUrl baseUrl, const QString& from, Omittable<int> limit, const QString& only)
{
return BaseJob::makeRequestUrl(std::move(baseUrl),
basePath % "/notifications",
queryToGetNotifications(from, limit, only));
}
-GetNotificationsJob::GetNotificationsJob(const QString& from, int limit, const QString& only)
+GetNotificationsJob::GetNotificationsJob(const QString& from, Omittable<int> limit, const QString& only)
: BaseJob(HttpVerb::Get, "GetNotificationsJob",
basePath % "/notifications",
queryToGetNotifications(from, limit, only))
diff --git a/lib/csapi/notifications.h b/lib/csapi/notifications.h
index 2180c658..3a603364 100644
--- a/lib/csapi/notifications.h
+++ b/lib/csapi/notifications.h
@@ -6,10 +6,10 @@
#include "jobs/basejob.h"
+#include "converters.h"
+#include <QtCore/QVector>
#include <QtCore/QJsonObject>
#include "events/event.h"
-#include <QtCore/QVector>
-#include "converters.h"
namespace QMatrixClient
{
@@ -32,14 +32,14 @@ namespace QMatrixClient
// Construction/destruction
- explicit GetNotificationsJob(const QString& from = {}, int limit = {}, const QString& only = {});
+ explicit GetNotificationsJob(const QString& from = {}, Omittable<int> limit = none, const QString& only = {});
/** Construct a URL out of baseUrl and usual parameters passed to
* GetNotificationsJob. This function can be used when
* a URL for GetNotificationsJob is necessary but the job
* itself isn't.
*/
- static QUrl makeRequestUrl(QUrl baseUrl, const QString& from = {}, int limit = {}, const QString& only = {});
+ static QUrl makeRequestUrl(QUrl baseUrl, const QString& from = {}, Omittable<int> limit = none, const QString& only = {});
~GetNotificationsJob() override;
diff --git a/lib/csapi/pusher.cpp b/lib/csapi/pusher.cpp
index 90ac032b..ba5229d3 100644
--- a/lib/csapi/pusher.cpp
+++ b/lib/csapi/pusher.cpp
@@ -97,9 +97,6 @@ namespace QMatrixClient
QJsonObject toJson(const PostPusherJob::PusherData& pod)
{
QJsonObject _json;
- if (pod.omitted)
- return _json;
-
addToJson<IfNotEmpty>(_json, "url", pod.url);
return _json;
}
diff --git a/lib/csapi/pusher.h b/lib/csapi/pusher.h
index 501e93a1..bfea57d1 100644
--- a/lib/csapi/pusher.h
+++ b/lib/csapi/pusher.h
@@ -32,7 +32,7 @@ namespace QMatrixClient
QString deviceDisplayName;
QString profileTag;
QString lang;
- PusherData data;
+ Omittable<PusherData> data;
};
// Construction/destruction
@@ -68,8 +68,6 @@ namespace QMatrixClient
struct PusherData
{
QString url;
-
- bool omitted;
};
// Construction/destruction
diff --git a/lib/csapi/search.cpp b/lib/csapi/search.cpp
index 1cda979f..d43f704b 100644
--- a/lib/csapi/search.cpp
+++ b/lib/csapi/search.cpp
@@ -19,9 +19,6 @@ namespace QMatrixClient
QJsonObject toJson(const SearchJob::IncludeEventContext& pod)
{
QJsonObject _json;
- if (pod.omitted)
- return _json;
-
addToJson<IfNotEmpty>(_json, "before_limit", pod.beforeLimit);
addToJson<IfNotEmpty>(_json, "after_limit", pod.afterLimit);
addToJson<IfNotEmpty>(_json, "include_profile", pod.includeProfile);
@@ -31,9 +28,6 @@ namespace QMatrixClient
QJsonObject toJson(const SearchJob::Group& pod)
{
QJsonObject _json;
- if (pod.omitted)
- return _json;
-
addToJson<IfNotEmpty>(_json, "key", pod.key);
return _json;
}
@@ -41,9 +35,6 @@ namespace QMatrixClient
QJsonObject toJson(const SearchJob::Groupings& pod)
{
QJsonObject _json;
- if (pod.omitted)
- return _json;
-
addToJson<IfNotEmpty>(_json, "group_by", pod.groupBy);
return _json;
}
@@ -51,9 +42,6 @@ namespace QMatrixClient
QJsonObject toJson(const SearchJob::RoomEventsCriteria& pod)
{
QJsonObject _json;
- if (pod.omitted)
- return _json;
-
addToJson<>(_json, "search_term", pod.searchTerm);
addToJson<IfNotEmpty>(_json, "keys", pod.keys);
addToJson<IfNotEmpty>(_json, "filter", pod.filter);
@@ -67,9 +55,6 @@ namespace QMatrixClient
QJsonObject toJson(const SearchJob::Categories& pod)
{
QJsonObject _json;
- if (pod.omitted)
- return _json;
-
addToJson<IfNotEmpty>(_json, "room_events", pod.roomEvents);
return _json;
}
diff --git a/lib/csapi/search.h b/lib/csapi/search.h
index f0fb4546..98a6315f 100644
--- a/lib/csapi/search.h
+++ b/lib/csapi/search.h
@@ -25,25 +25,19 @@ namespace QMatrixClient
struct IncludeEventContext
{
- int beforeLimit;
- int afterLimit;
+ Omittable<int> beforeLimit;
+ Omittable<int> afterLimit;
bool includeProfile;
-
- bool omitted;
};
struct Group
{
QString key;
-
- bool omitted;
};
struct Groupings
{
QVector<Group> groupBy;
-
- bool omitted;
};
struct RoomEventsCriteria
@@ -52,18 +46,14 @@ namespace QMatrixClient
QStringList keys;
QJsonObject filter;
QString orderBy;
- IncludeEventContext eventContext;
+ Omittable<IncludeEventContext> eventContext;
bool includeState;
- Groupings groupings;
-
- bool omitted;
+ Omittable<Groupings> groupings;
};
struct Categories
{
- RoomEventsCriteria roomEvents;
-
- bool omitted;
+ Omittable<RoomEventsCriteria> roomEvents;
};
struct UserProfile
@@ -83,21 +73,21 @@ namespace QMatrixClient
struct Result
{
- double rank;
+ Omittable<double> rank;
RoomEventPtr result;
- EventContext context;
+ Omittable<EventContext> context;
};
struct GroupValue
{
QString nextBatch;
- int order;
+ Omittable<int> order;
QStringList results;
};
struct ResultRoomEvents
{
- qint64 count;
+ Omittable<qint64> count;
std::vector<Result> results;
std::unordered_map<QString, StateEvents> state;
QHash<QString, QHash<QString, GroupValue>> groups;
@@ -106,7 +96,7 @@ namespace QMatrixClient
struct ResultCategories
{
- ResultRoomEvents roomEvents;
+ Omittable<ResultRoomEvents> roomEvents;
};
// Construction/destruction
diff --git a/lib/csapi/typing.cpp b/lib/csapi/typing.cpp
index 898bc149..605e143a 100644
--- a/lib/csapi/typing.cpp
+++ b/lib/csapi/typing.cpp
@@ -12,7 +12,7 @@ using namespace QMatrixClient;
static const auto basePath = QStringLiteral("/_matrix/client/r0");
-SetTypingJob::SetTypingJob(const QString& userId, const QString& roomId, bool typing, int timeout)
+SetTypingJob::SetTypingJob(const QString& userId, const QString& roomId, bool typing, Omittable<int> timeout)
: BaseJob(HttpVerb::Put, "SetTypingJob",
basePath % "/rooms/" % roomId % "/typing/" % userId)
{
diff --git a/lib/csapi/typing.h b/lib/csapi/typing.h
index 7cf27ef6..f4fa36e8 100644
--- a/lib/csapi/typing.h
+++ b/lib/csapi/typing.h
@@ -6,6 +6,7 @@
#include "jobs/basejob.h"
+#include "converters.h"
namespace QMatrixClient
{
@@ -14,6 +15,6 @@ namespace QMatrixClient
class SetTypingJob : public BaseJob
{
public:
- explicit SetTypingJob(const QString& userId, const QString& roomId, bool typing, int timeout = {});
+ explicit SetTypingJob(const QString& userId, const QString& roomId, bool typing, Omittable<int> timeout = none);
};
} // namespace QMatrixClient
diff --git a/lib/csapi/users.cpp b/lib/csapi/users.cpp
index 36cdf3cc..a27be93b 100644
--- a/lib/csapi/users.cpp
+++ b/lib/csapi/users.cpp
@@ -41,7 +41,7 @@ class SearchUserDirectoryJob::Private
bool limited;
};
-SearchUserDirectoryJob::SearchUserDirectoryJob(const QString& searchTerm, int limit)
+SearchUserDirectoryJob::SearchUserDirectoryJob(const QString& searchTerm, Omittable<int> limit)
: BaseJob(HttpVerb::Post, "SearchUserDirectoryJob",
basePath % "/user_directory/search")
, d(new Private)
diff --git a/lib/csapi/users.h b/lib/csapi/users.h
index 203ddc37..ecf1faaf 100644
--- a/lib/csapi/users.h
+++ b/lib/csapi/users.h
@@ -6,8 +6,8 @@
#include "jobs/basejob.h"
-#include "converters.h"
#include <QtCore/QVector>
+#include "converters.h"
namespace QMatrixClient
{
@@ -27,7 +27,7 @@ namespace QMatrixClient
// Construction/destruction
- explicit SearchUserDirectoryJob(const QString& searchTerm, int limit = {});
+ explicit SearchUserDirectoryJob(const QString& searchTerm, Omittable<int> limit = none);
~SearchUserDirectoryJob() override;
// Result properties
diff --git a/lib/csapi/{{base}}.cpp.mustache b/lib/csapi/{{base}}.cpp.mustache
index c6504f42..4abe38eb 100644
--- a/lib/csapi/{{base}}.cpp.mustache
+++ b/lib/csapi/{{base}}.cpp.mustache
@@ -10,10 +10,7 @@ using namespace QMatrixClient;
{{#models.model}}{{#in?}}
QJsonObject QMatrixClient::toJson(const {{qualifiedName}}& pod)
{
- QJsonObject _json;
- if (pod.omitted)
- return _json;
-{{#vars}}
+ QJsonObject _json;{{#vars}}
addToJson<{{^required?}}IfNotEmpty{{/required?}}>(_json, "{{baseName}}", pod.{{nameCamelCase}});{{/vars}}
return _json;
}
@@ -36,10 +33,7 @@ namespace QMatrixClient
{{#model}}{{#in?}}
QJsonObject toJson(const {{qualifiedName}}& pod)
{
- QJsonObject _json;
- if (pod.omitted)
- return _json;
-{{#vars}}
+ QJsonObject _json;{{#vars}}
addToJson<{{^required?}}IfNotEmpty{{/required?}}>(_json, "{{baseName}}", pod.{{nameCamelCase}});{{/vars}}
return _json;
}
@@ -61,7 +55,7 @@ namespace QMatrixClient
class {{camelCaseOperationId}}Job::Private
{
public:{{#allProperties}}
- {{dataType.name}} {{paramName}};{{/allProperties}}
+ {{>maybeOmittableType}} {{paramName}};{{/allProperties}}
};
{{/ allProperties?}}{{/normalResponse?}}{{/responses}}{{#queryParams?}}
BaseJob::Query queryTo{{camelCaseOperationId}}({{#queryParams}}{{>joinedParamDef}}{{/queryParams}})
diff --git a/lib/csapi/{{base}}.h.mustache b/lib/csapi/{{base}}.h.mustache
index 6f08e871..1d24163f 100644
--- a/lib/csapi/{{base}}.h.mustache
+++ b/lib/csapi/{{base}}.h.mustache
@@ -13,10 +13,8 @@ namespace QMatrixClient
{{# model}}
struct {{name}}{{#parents?}} : {{#parents}}{{name}}{{#@join}}, {{/@join}}{{/parents}}{{/parents?}}
{
-{{#vars}} {{dataType.name}} {{nameCamelCase}};
-{{/vars}}{{#in?}}
- bool omitted;
-{{/in?}} };
+{{#vars}} {{>maybeOmittableType}} {{nameCamelCase}};
+{{/vars}} };
{{#in?}}
QJsonObject toJson(const {{name}}& pod);
{{/in?}}{{#out?}}
@@ -34,10 +32,8 @@ namespace QMatrixClient
{{# model}}
struct {{name}}{{#parents?}} : {{#parents}}{{name}}{{#@join}}, {{/@join}}{{/parents}}{{/parents?}}
{
-{{#vars}} {{dataType.name}} {{nameCamelCase}};
-{{/vars}}{{#in?}}
- bool omitted;
-{{/in?}} };
+{{#vars}} {{>maybeOmittableType}} {{nameCamelCase}};
+{{/vars}} };
{{/ model}}
// Construction/destruction
{{/ models}}