aboutsummaryrefslogtreecommitdiff
path: root/lib/csapi/directory.h
blob: c13ca20a67a005a14b0b86b4c4411432b730014a (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
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
/******************************************************************************
 * THIS FILE IS GENERATED - ANY EDITS WILL BE OVERWRITTEN
 */

#pragma once

#include "jobs/basejob.h"

namespace Quotient {

// Operations

/*! \brief Create a new mapping from room alias to room ID.
 *
 */
class SetRoomAliasJob : public BaseJob {
public:
    /*! \brief Create a new mapping from room alias to room ID.
     *
     * \param roomAlias
     *   The room alias to set.
     * \param roomId
     *   The room ID to set.
     */
    explicit SetRoomAliasJob(const QString& roomAlias, const QString& roomId);
};

/*! \brief Get the room ID corresponding to this room alias.
 *
 * Requests that the server resolve a room alias to a room ID.
 *
 * The server will use the federation API to resolve the alias if the
 * domain part of the alias does not correspond to the server's own
 * domain.
 */
class GetRoomIdByAliasJob : public BaseJob {
public:
    /*! \brief Get the room ID corresponding to this room alias.
     *
     * \param roomAlias
     *   The room alias.
     */
    explicit GetRoomIdByAliasJob(const QString& roomAlias);

    /*! \brief Construct a URL without creating a full-fledged job object
     *
     * This function can be used when a URL for GetRoomIdByAliasJob
     * is necessary but the job itself isn't.
     */
    static QUrl makeRequestUrl(QUrl baseUrl, const QString& roomAlias);
    ~GetRoomIdByAliasJob() override;

    // Result properties

    /// The room ID for this room alias.
    const QString& roomId() const;

    /// A list of servers that are aware of this room alias.
    const QStringList& servers() const;

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

private:
    class Private;
    QScopedPointer<Private> d;
};

/*! \brief Remove a mapping of room alias to room ID.
 *
 * Remove a mapping of room alias to room ID.
 *
 * Servers may choose to implement additional access control checks here, for
 * instance that room aliases can only be deleted by their creator or a server
 * administrator.
 */
class DeleteRoomAliasJob : public BaseJob {
public:
    /*! \brief Remove a mapping of room alias to room ID.
     *
     * \param roomAlias
     *   The room alias to remove.
     */
    explicit DeleteRoomAliasJob(const QString& roomAlias);

    /*! \brief Construct a URL without creating a full-fledged job object
     *
     * This function can be used when a URL for DeleteRoomAliasJob
     * is necessary but the job itself isn't.
     */
    static QUrl makeRequestUrl(QUrl baseUrl, const QString& roomAlias);
};

} // namespace Quotient