5 #include <Quotient/jobs/basejob.h>
15 struct JsonObjectConverter<BooleanCapability> {
16 static void dumpTo(QJsonObject& jo,
const BooleanCapability& pod)
18 addParam<>(jo,
"enabled"_L1, pod.enabled);
20 static void fillFrom(
const QJsonObject& jo, BooleanCapability& pod)
22 fillFromJson(jo.value(
"enabled"_L1), pod.enabled);
37 QString defaultVersion;
40 QHash<QString, QString> available;
47 std::optional<BooleanCapability> changePassword{};
50 std::optional<RoomVersionsCapability> roomVersions{};
53 std::optional<BooleanCapability> setDisplayname{};
56 std::optional<BooleanCapability> setAvatarUrl{};
59 std::optional<BooleanCapability> thirdPartyIdChanges{};
63 std::optional<BooleanCapability> getLoginToken{};
68 QVariantHash additionalProperties{};
73 explicit GetCapabilitiesJob();
79 static QUrl makeRequestUrl(
const HomeserverData& hsData);
85 Capabilities capabilities()
const {
return loadFromJson<Capabilities>(
"capabilities"_L1); }
88 inline auto collectResponse(
const GetCapabilitiesJob* job) {
return job->capabilities(); }
91 struct QUOTIENT_API JsonObjectConverter<GetCapabilitiesJob::RoomVersionsCapability> {
92 static void fillFrom(
const QJsonObject& jo, GetCapabilitiesJob::RoomVersionsCapability& result)
94 fillFromJson(jo.value(
"default"_L1), result.defaultVersion);
95 fillFromJson(jo.value(
"available"_L1), result.available);
100 struct QUOTIENT_API JsonObjectConverter<GetCapabilitiesJob::Capabilities> {
101 static void fillFrom(QJsonObject jo, GetCapabilitiesJob::Capabilities& result)
103 fillFromJson(jo.take(
"m.change_password"_L1), result.changePassword);
104 fillFromJson(jo.take(
"m.room_versions"_L1), result.roomVersions);
105 fillFromJson(jo.take(
"m.set_displayname"_L1), result.setDisplayname);
106 fillFromJson(jo.take(
"m.set_avatar_url"_L1), result.setAvatarUrl);
107 fillFromJson(jo.take(
"m.3pid_changes"_L1), result.thirdPartyIdChanges);
108 fillFromJson(jo.take(
"m.get_login_token"_L1), result.getLoginToken);
109 fromJson(jo, result.additionalProperties);