libQuotient
A Qt library for building matrix clients
Loading...
Searching...
No Matches
users.h
Go to the documentation of this file.
1// THIS FILE IS GENERATED - ANY EDITS WILL BE OVERWRITTEN
2
3#pragma once
4
5#include <Quotient/jobs/basejob.h>
6
7namespace Quotient {
8
9//! \brief Searches the user directory.
10//!
11//! Performs a search for users. The homeserver may
12//! determine which subset of users are searched, however the homeserver
13//! MUST at a minimum consider the users the requesting user shares a
14//! room with and those who reside in public rooms (known to the homeserver).
15//! The search MUST consider local users to the homeserver, and SHOULD
16//! query remote users as part of the search.
17//!
18//! The search is performed case-insensitively on user IDs and display
19//! names preferably using a collation determined based upon the
20//! `Accept-Language` header provided in the request, if present.
22public:
23 // Inner data structures
24
26 //! The user's matrix user ID.
28
29 //! The display name of the user, if one exists.
31
32 //! The avatar url, as an [`mxc://` URI](/client-server-api/#matrix-content-mxc-uris), if
33 //! one exists.
35 };
36
37 // Construction/destruction
38
39 //! \param searchTerm
40 //! The term to search for
41 //!
42 //! \param limit
43 //! The maximum number of results to return. Defaults to 10.
45 std::optional<int> limit = std::nullopt);
46
47 // Result properties
48
49 //! Ordered by rank and then whether or not profile info is available.
50 QVector<User> results() const { return loadFromJson<QVector<User>>("results"_L1); }
51
52 //! Indicates if the result list has been truncated by the limit.
53 bool limited() const { return loadFromJson<bool>("limited"_L1); }
54
55 struct Response {
56 //! Ordered by rank and then whether or not profile info is available.
58
59 //! Indicates if the result list has been truncated by the limit.
60 bool limited{};
61 };
62};
63
65constexpr inline auto doCollectResponse<JobT> =
66 [](JobT* j) -> SearchUserDirectoryJob::Response { return { j->results(), j->limited() }; };
67
68template <>
71 {
72 fillFromJson(jo.value("user_id"_L1), result.userId);
73 fillFromJson(jo.value("display_name"_L1), result.displayName);
74 fillFromJson(jo.value("avatar_url"_L1), result.avatarUrl);
75 }
76};
77
78} // namespace Quotient
Searches the user directory.
Definition users.h:21
#define QUOTIENT_API