aboutsummaryrefslogtreecommitdiff
path: root/lib/csapi/users.h
blob: 3ff10db6afcf8cee85896641203f88f56ffc5ea3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
/******************************************************************************
 * THIS FILE IS GENERATED - ANY EDITS WILL BE OVERWRITTEN
 */

#pragma once

#include "jobs/basejob.h"

#include <QtCore/QVector>
#include "converters.h"

namespace QMatrixClient
{
    // Operations

    /// Searches the user directory.
    /// 
    /// This API performs a server-side search over all users registered on the server.
    /// It searches user ID and displayname case-insensitively for users that you share a room with or that are in public rooms.
    class SearchUserDirectoryJob : public BaseJob
    {
        public:
            // Inner data structures

            /// This API performs a server-side search over all users registered on the server.
            /// It searches user ID and displayname case-insensitively for users that you share a room with or that are in public rooms.
            struct User
            {
                /// The user's matrix user ID.
                QString userId;
                /// The display name of the user, if one exists.
                QString displayName;
                /// The avatar url, as an MXC, if one exists.
                QString avatarUrl;
            };

            // Construction/destruction

            /*! 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<int> limit = none);
            ~SearchUserDirectoryJob() override;

            // Result properties

            /// Ordered by rank and then whether or not profile info is available.
            const QVector<User>& results() const;
            /// Indicates if the result list has been truncated by the limit.
            bool limited() const;

        protected:
            Status parseJson(const QJsonDocument& data) override;

        private:
            class Private;
            QScopedPointer<Private> d;
    };
} // namespace QMatrixClient