diff options
Diffstat (limited to 'lib/csapi/third_party_lookup.h')
-rw-r--r-- | lib/csapi/third_party_lookup.h | 270 |
1 files changed, 138 insertions, 132 deletions
diff --git a/lib/csapi/third_party_lookup.h b/lib/csapi/third_party_lookup.h index 3a60432b..91bc79e5 100644 --- a/lib/csapi/third_party_lookup.h +++ b/lib/csapi/third_party_lookup.h @@ -6,15 +6,14 @@ #include "jobs/basejob.h" -#include "csapi/../application-service/definitions/user.h" +#include "converters.h" #include "csapi/../application-service/definitions/location.h" +#include "csapi/../application-service/definitions/protocol.h" +#include "csapi/../application-service/definitions/user.h" #include <QtCore/QHash> #include <QtCore/QVector> -#include "converters.h" -#include "csapi/../application-service/definitions/protocol.h" -namespace QMatrixClient -{ +namespace QMatrixClient { // Operations /// Retrieve metadata about all protocols that a homeserver supports. @@ -25,64 +24,66 @@ namespace QMatrixClient class GetProtocolsJob : public BaseJob { public: - explicit GetProtocolsJob(); + explicit GetProtocolsJob(); - /*! Construct a URL without creating a full-fledged job object - * - * This function can be used when a URL for - * GetProtocolsJob is necessary but the job - * itself isn't. - */ - static QUrl makeRequestUrl(QUrl baseUrl); + /*! Construct a URL without creating a full-fledged job object + * + * This function can be used when a URL for + * GetProtocolsJob is necessary but the job + * itself isn't. + */ + static QUrl makeRequestUrl(QUrl baseUrl); - ~GetProtocolsJob() override; + ~GetProtocolsJob() override; - // Result properties + // Result properties - /// The protocols supported by the homeserver. - const QHash<QString, ThirdPartyProtocol>& data() const; + /// The protocols supported by the homeserver. + const QHash<QString, ThirdPartyProtocol>& data() const; protected: - Status parseJson(const QJsonDocument& data) override; + Status parseJson(const QJsonDocument& data) override; private: - class Private; - QScopedPointer<Private> d; + class Private; + QScopedPointer<Private> d; }; - /// Retrieve metadata about a specific protocol that the homeserver supports. + /// Retrieve metadata about a specific protocol that the homeserver + /// supports. /// - /// Fetches the metadata from the homeserver about a particular third party protocol. + /// Fetches the metadata from the homeserver about a particular third party + /// protocol. class GetProtocolMetadataJob : public BaseJob { public: - /*! Retrieve metadata about a specific protocol that the homeserver supports. - * \param protocol - * The name of the protocol. - */ - explicit GetProtocolMetadataJob(const QString& protocol); + /*! Retrieve metadata about a specific protocol that the homeserver supports. + * \param protocol + * The name of the protocol. + */ + explicit GetProtocolMetadataJob(const QString& protocol); - /*! Construct a URL without creating a full-fledged job object - * - * This function can be used when a URL for - * GetProtocolMetadataJob is necessary but the job - * itself isn't. - */ - static QUrl makeRequestUrl(QUrl baseUrl, const QString& protocol); + /*! Construct a URL without creating a full-fledged job object + * + * This function can be used when a URL for + * GetProtocolMetadataJob is necessary but the job + * itself isn't. + */ + static QUrl makeRequestUrl(QUrl baseUrl, const QString& protocol); - ~GetProtocolMetadataJob() override; + ~GetProtocolMetadataJob() override; - // Result properties + // Result properties - /// The protocol was found and metadata returned. - const ThirdPartyProtocol& data() const; + /// The protocol was found and metadata returned. + const ThirdPartyProtocol& data() const; protected: - Status parseJson(const QJsonDocument& data) override; + Status parseJson(const QJsonDocument& data) override; private: - class Private; - QScopedPointer<Private> d; + class Private; + QScopedPointer<Private> d; }; /// Retrieve Matrix-side portals rooms leading to a third party location. @@ -98,74 +99,79 @@ namespace QMatrixClient class QueryLocationByProtocolJob : public BaseJob { public: - /*! Retrieve Matrix-side portals rooms leading to a third party location. - * \param protocol - * The protocol used to communicate to the third party network. - * \param searchFields - * One or more custom fields to help identify the third party - * location. - */ - explicit QueryLocationByProtocolJob(const QString& protocol, const QString& searchFields = {}); - - /*! Construct a URL without creating a full-fledged job object - * - * This function can be used when a URL for - * QueryLocationByProtocolJob is necessary but the job - * itself isn't. - */ - static QUrl makeRequestUrl(QUrl baseUrl, const QString& protocol, const QString& searchFields = {}); - - ~QueryLocationByProtocolJob() override; - - // Result properties - - /// At least one portal room was found. - const QVector<ThirdPartyLocation>& data() const; + /*! Retrieve Matrix-side portals rooms leading to a third party location. + * \param protocol + * The protocol used to communicate to the third party network. + * \param searchFields + * One or more custom fields to help identify the third party + * location. + */ + explicit QueryLocationByProtocolJob(const QString& protocol, + const QString& searchFields = {}); + + /*! Construct a URL without creating a full-fledged job object + * + * This function can be used when a URL for + * QueryLocationByProtocolJob is necessary but the job + * itself isn't. + */ + static QUrl makeRequestUrl(QUrl baseUrl, const QString& protocol, + const QString& searchFields = {}); + + ~QueryLocationByProtocolJob() override; + + // Result properties + + /// At least one portal room was found. + const QVector<ThirdPartyLocation>& data() const; protected: - Status parseJson(const QJsonDocument& data) override; + Status parseJson(const QJsonDocument& data) override; private: - class Private; - QScopedPointer<Private> d; + class Private; + QScopedPointer<Private> d; }; /// Retrieve the Matrix User ID of a corresponding third party user. /// - /// Retrieve a Matrix User ID linked to a user on the third party service, given - /// a set of user parameters. + /// Retrieve a Matrix User ID linked to a user on the third party service, + /// given a set of user parameters. class QueryUserByProtocolJob : public BaseJob { public: - /*! Retrieve the Matrix User ID of a corresponding third party user. - * \param protocol - * The name of the protocol. - * \param fields - * One or more custom fields that are passed to the AS to help identify the user. - */ - explicit QueryUserByProtocolJob(const QString& protocol, const QString& fields = {}); - - /*! Construct a URL without creating a full-fledged job object - * - * This function can be used when a URL for - * QueryUserByProtocolJob is necessary but the job - * itself isn't. - */ - static QUrl makeRequestUrl(QUrl baseUrl, const QString& protocol, const QString& fields = {}); - - ~QueryUserByProtocolJob() override; - - // Result properties - - /// The Matrix User IDs found with the given parameters. - const QVector<ThirdPartyUser>& data() const; + /*! Retrieve the Matrix User ID of a corresponding third party user. + * \param protocol + * The name of the protocol. + * \param fields + * One or more custom fields that are passed to the AS to help + * identify the user. + */ + explicit QueryUserByProtocolJob(const QString& protocol, + const QString& fields = {}); + + /*! Construct a URL without creating a full-fledged job object + * + * This function can be used when a URL for + * QueryUserByProtocolJob is necessary but the job + * itself isn't. + */ + static QUrl makeRequestUrl(QUrl baseUrl, const QString& protocol, + const QString& fields = {}); + + ~QueryUserByProtocolJob() override; + + // Result properties + + /// The Matrix User IDs found with the given parameters. + const QVector<ThirdPartyUser>& data() const; protected: - Status parseJson(const QJsonDocument& data) override; + Status parseJson(const QJsonDocument& data) override; private: - class Private; - QScopedPointer<Private> d; + class Private; + QScopedPointer<Private> d; }; /// Reverse-lookup third party locations given a Matrix room alias. @@ -175,33 +181,33 @@ namespace QMatrixClient class QueryLocationByAliasJob : public BaseJob { public: - /*! Reverse-lookup third party locations given a Matrix room alias. - * \param alias - * The Matrix room alias to look up. - */ - explicit QueryLocationByAliasJob(const QString& alias); + /*! Reverse-lookup third party locations given a Matrix room alias. + * \param alias + * The Matrix room alias to look up. + */ + explicit QueryLocationByAliasJob(const QString& alias); - /*! Construct a URL without creating a full-fledged job object - * - * This function can be used when a URL for - * QueryLocationByAliasJob is necessary but the job - * itself isn't. - */ - static QUrl makeRequestUrl(QUrl baseUrl, const QString& alias); + /*! Construct a URL without creating a full-fledged job object + * + * This function can be used when a URL for + * QueryLocationByAliasJob is necessary but the job + * itself isn't. + */ + static QUrl makeRequestUrl(QUrl baseUrl, const QString& alias); - ~QueryLocationByAliasJob() override; + ~QueryLocationByAliasJob() override; - // Result properties + // Result properties - /// All found third party locations. - const QVector<ThirdPartyLocation>& data() const; + /// All found third party locations. + const QVector<ThirdPartyLocation>& data() const; protected: - Status parseJson(const QJsonDocument& data) override; + Status parseJson(const QJsonDocument& data) override; private: - class Private; - QScopedPointer<Private> d; + class Private; + QScopedPointer<Private> d; }; /// Reverse-lookup third party users given a Matrix User ID. @@ -210,32 +216,32 @@ namespace QMatrixClient class QueryUserByIDJob : public BaseJob { public: - /*! Reverse-lookup third party users given a Matrix User ID. - * \param userid - * The Matrix User ID to look up. - */ - explicit QueryUserByIDJob(const QString& userid); + /*! Reverse-lookup third party users given a Matrix User ID. + * \param userid + * The Matrix User ID to look up. + */ + explicit QueryUserByIDJob(const QString& userid); - /*! Construct a URL without creating a full-fledged job object - * - * This function can be used when a URL for - * QueryUserByIDJob is necessary but the job - * itself isn't. - */ - static QUrl makeRequestUrl(QUrl baseUrl, const QString& userid); + /*! Construct a URL without creating a full-fledged job object + * + * This function can be used when a URL for + * QueryUserByIDJob is necessary but the job + * itself isn't. + */ + static QUrl makeRequestUrl(QUrl baseUrl, const QString& userid); - ~QueryUserByIDJob() override; + ~QueryUserByIDJob() override; - // Result properties + // Result properties - /// An array of third party users. - const QVector<ThirdPartyUser>& data() const; + /// An array of third party users. + const QVector<ThirdPartyUser>& data() const; protected: - Status parseJson(const QJsonDocument& data) override; + Status parseJson(const QJsonDocument& data) override; private: - class Private; - QScopedPointer<Private> d; + class Private; + QScopedPointer<Private> d; }; } // namespace QMatrixClient |