From 32729d9a7519cd2c4cddb0174b8329c6fd4a4a83 Mon Sep 17 00:00:00 2001 From: Kitsune Ral Date: Sun, 7 Jun 2020 19:46:40 +0200 Subject: Update generated files according to gtad/* changes --- lib/csapi/users.h | 42 +++++++++++++++++++++++------------------- 1 file changed, 23 insertions(+), 19 deletions(-) (limited to 'lib/csapi/users.h') diff --git a/lib/csapi/users.h b/lib/csapi/users.h index de4eb529..adb2a33d 100644 --- a/lib/csapi/users.h +++ b/lib/csapi/users.h @@ -4,19 +4,13 @@ #pragma once -#include "converters.h" - #include "jobs/basejob.h" -#include - namespace Quotient { -// Operations - /*! \brief Searches the user directory. * - * Performs a search for users on the homeserver. The homeserver may + * Performs a search for users. The homeserver may * determine which subset of users are searched, however the homeserver * MUST at a minimum consider the users the requesting user shares a * room with and those who reside in public rooms (known to the homeserver). @@ -31,7 +25,7 @@ class SearchUserDirectoryJob : public BaseJob { public: // Inner data structures - /// Performs a search for users on the homeserver. The homeserver may + /// Performs a search for users. The homeserver may /// determine which subset of users are searched, however the homeserver /// MUST at a minimum consider the users the requesting user shares a /// room with and those who reside in public rooms (known to the @@ -41,7 +35,7 @@ public: /// The search is performed case-insensitively on user IDs and display /// names preferably using a collation determined based upon the /// ``Accept-Language`` header provided in the request, if present. - struct User { + struct SearchUserDirectory200ThirdPartyUser { /// The user's matrix user ID. QString userId; /// The display name of the user, if one exists. @@ -53,31 +47,41 @@ public: // Construction/destruction /*! \brief Searches the user directory. + * * * \param searchTerm * The term to search for + * * \param limit * The maximum number of results to return. Defaults to 10. */ explicit SearchUserDirectoryJob(const QString& searchTerm, Omittable limit = none); - ~SearchUserDirectoryJob() override; - // Result properties /// Ordered by rank and then whether or not profile info is available. - const QVector& results() const; + QVector results() const + { + return loadFromJson>( + "results"_ls); + } /// Indicates if the result list has been truncated by the limit. - bool limited() const; - -protected: - Status parseJson(const QJsonDocument& data) override; + bool limited() const { return loadFromJson("limited"_ls); } +}; -private: - class Private; - QScopedPointer d; +template <> +struct JsonObjectConverter< + SearchUserDirectoryJob::SearchUserDirectory200ThirdPartyUser> { + static void + fillFrom(const QJsonObject& jo, + SearchUserDirectoryJob::SearchUserDirectory200ThirdPartyUser& result) + { + fromJson(jo.value("user_id"_ls), result.userId); + fromJson(jo.value("display_name"_ls), result.displayName); + fromJson(jo.value("avatar_url"_ls), result.avatarUrl); + } }; } // namespace Quotient -- cgit v1.2.3