diff options
author | n-peugnet <n.peugnet@free.fr> | 2022-10-06 19:27:24 +0200 |
---|---|---|
committer | n-peugnet <n.peugnet@free.fr> | 2022-10-06 19:27:24 +0200 |
commit | d911b207f49e936b3e992200796110f0749ed150 (patch) | |
tree | 96d20ebb4d074a4c1755e21cb316a52d584daee3 /lib/csapi/versions.h | |
parent | 8ad8a74152c5701b6ca1f9a00487ba9257a439b4 (diff) | |
parent | 56c2f2e2b809b9077393eb617828f33d144f5634 (diff) | |
download | libquotient-d911b207f49e936b3e992200796110f0749ed150.tar.gz libquotient-d911b207f49e936b3e992200796110f0749ed150.zip |
New upstream version 0.7.0
Diffstat (limited to 'lib/csapi/versions.h')
-rw-r--r-- | lib/csapi/versions.h | 82 |
1 files changed, 47 insertions, 35 deletions
diff --git a/lib/csapi/versions.h b/lib/csapi/versions.h index 309de184..9f799cb0 100644 --- a/lib/csapi/versions.h +++ b/lib/csapi/versions.h @@ -6,44 +6,56 @@ #include "jobs/basejob.h" - -namespace QMatrixClient -{ - // Operations - - /// Gets the versions of the specification supported by the server. - /// +namespace Quotient { + +/*! \brief Gets the versions of the specification supported by the server. + * + * Gets the versions of the specification supported by the server. + * + * Values will take the form `vX.Y` or `rX.Y.Z` in historical cases. See + * [the Specification Versioning](../#specification-versions) for more + * information. + * + * The server may additionally advertise experimental features it supports + * through `unstable_features`. These features should be namespaced and + * may optionally include version information within their name if desired. + * Features listed here are not for optionally toggling parts of the Matrix + * specification and should only be used to advertise support for a feature + * which has not yet landed in the spec. For example, a feature currently + * undergoing the proposal process may appear here and eventually be taken + * off this list once the feature lands in the spec and the server deems it + * reasonable to do so. Servers may wish to keep advertising features here + * after they've been released into the spec to give clients a chance to + * upgrade appropriately. Additionally, clients should avoid using unstable + * features in their stable releases. + */ +class QUOTIENT_API GetVersionsJob : public BaseJob { +public: /// Gets the versions of the specification supported by the server. - /// - /// Values will take the form ``rX.Y.Z``. - /// - /// Only the latest ``Z`` value will be reported for each supported ``X.Y`` value. - /// i.e. if the server implements ``r0.0.0``, ``r0.0.1``, and ``r1.2.0``, it will report ``r0.0.1`` and ``r1.2.0``. - class GetVersionsJob : public BaseJob - { - public: - explicit GetVersionsJob(); - - /*! Construct a URL without creating a full-fledged job object - * - * This function can be used when a URL for - * GetVersionsJob is necessary but the job - * itself isn't. - */ - static QUrl makeRequestUrl(QUrl baseUrl); + explicit GetVersionsJob(); - ~GetVersionsJob() override; + /*! \brief Construct a URL without creating a full-fledged job object + * + * This function can be used when a URL for GetVersionsJob + * is necessary but the job itself isn't. + */ + static QUrl makeRequestUrl(QUrl baseUrl); - // Result properties + // Result properties - /// The supported versions. - const QStringList& versions() const; + /// The supported versions. + QStringList versions() const + { + return loadFromJson<QStringList>("versions"_ls); + } - protected: - Status parseJson(const QJsonDocument& data) override; + /// Experimental features the server supports. Features not listed here, + /// or the lack of this property all together, indicate that a feature is + /// not supported. + QHash<QString, bool> unstableFeatures() const + { + return loadFromJson<QHash<QString, bool>>("unstable_features"_ls); + } +}; - private: - class Private; - QScopedPointer<Private> d; - }; -} // namespace QMatrixClient +} // namespace Quotient |