aboutsummaryrefslogtreecommitdiff
path: root/lib/csapi/administrative_contact.h
blob: 53123e7a35327bd64befd2f03e12edaa64f4fd48 (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
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
/******************************************************************************
 * THIS FILE IS GENERATED - ANY EDITS WILL BE OVERWRITTEN
 */

#pragma once

#include "jobs/basejob.h"

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

namespace QMatrixClient
{
    // Operations

    /// Gets a list of a user's third party identifiers.
    ///
    /// Gets a list of the third party identifiers that the homeserver has
    /// associated with the user's account.
    /// 
    /// This is *not* the same as the list of third party identifiers bound to
    /// the user's Matrix ID in Identity Servers.
    /// 
    /// Identifiers in this list may be used by the homeserver as, for example,
    /// identifiers that it will accept to reset the user's account password.
    class GetAccount3PIDsJob : public BaseJob
    {
        public:
            // Inner data structures

            /// Gets a list of the third party identifiers that the homeserver has
            /// associated with the user's account.
            /// 
            /// This is *not* the same as the list of third party identifiers bound to
            /// the user's Matrix ID in Identity Servers.
            /// 
            /// Identifiers in this list may be used by the homeserver as, for example,
            /// identifiers that it will accept to reset the user's account password.
            struct ThirdPartyIdentifier
            {
                /// The medium of the third party identifier.
                QString medium;
                /// The third party identifier address.
                QString address;
            };

            // Construction/destruction

            explicit GetAccount3PIDsJob();

            /*! Construct a URL without creating a full-fledged job object
             *
             * This function can be used when a URL for
             * GetAccount3PIDsJob is necessary but the job
             * itself isn't.
             */
            static QUrl makeRequestUrl(QUrl baseUrl);

            ~GetAccount3PIDsJob() override;

            // Result properties

            /// Gets a list of the third party identifiers that the homeserver has
            /// associated with the user's account.
            /// 
            /// This is *not* the same as the list of third party identifiers bound to
            /// the user's Matrix ID in Identity Servers.
            /// 
            /// Identifiers in this list may be used by the homeserver as, for example,
            /// identifiers that it will accept to reset the user's account password.
            const QVector<ThirdPartyIdentifier>& threepids() const;

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

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

    /// Adds contact information to the user's account.
    ///
    /// Adds contact information to the user's account.
    class Post3PIDsJob : public BaseJob
    {
        public:
            // Inner data structures

            /// The third party credentials to associate with the account.
            struct ThreePidCredentials
            {
                /// The client secret used in the session with the Identity Server.
                QString clientSecret;
                /// The Identity Server to use.
                QString idServer;
                /// The session identifier given by the Identity Server.
                QString sid;
            };

            // Construction/destruction

            /*! Adds contact information to the user's account.
             * \param threePidCreds
             *   The third party credentials to associate with the account.
             * \param bind
             *   Whether the homeserver should also bind this third party
             *   identifier to the account's Matrix ID with the passed identity
             *   server. Default: ``false``.
             */
            explicit Post3PIDsJob(const ThreePidCredentials& threePidCreds, bool bind = false);
    };

    /// Requests a validation token be sent to the given email address for the purpose of adding an email address to an account
    ///
    /// Proxies the identity server API ``validate/email/requestToken``, but
    /// first checks that the given email address is **not** already associated
    /// with an account on this Home Server. This API should be used to request
    /// validation tokens when adding an email address to an account. This API's
    /// parameters and response is identical to that of the HS API
    /// |/register/email/requestToken|_ endpoint.
    class RequestTokenTo3PIDEmailJob : public BaseJob
    {
        public:
            explicit RequestTokenTo3PIDEmailJob();

            /*! Construct a URL without creating a full-fledged job object
             *
             * This function can be used when a URL for
             * RequestTokenTo3PIDEmailJob is necessary but the job
             * itself isn't.
             */
            static QUrl makeRequestUrl(QUrl baseUrl);

    };

    /// Requests a validation token be sent to the given email address for the purpose of adding a phone number to an account.
    ///
    /// Proxies the identity server API ``validate/msisdn/requestToken``, but
    /// first checks that the given phone number is **not** already associated
    /// with an account on this Home Server. This API should be used to request
    /// validation tokens when adding a phone number to an account. This API's
    /// parameters and response is identical to that of the HS API
    /// |/register/msisdn/requestToken|_ endpoint.
    class RequestTokenTo3PIDMSISDNJob : public BaseJob
    {
        public:
            explicit RequestTokenTo3PIDMSISDNJob();

            /*! Construct a URL without creating a full-fledged job object
             *
             * This function can be used when a URL for
             * RequestTokenTo3PIDMSISDNJob is necessary but the job
             * itself isn't.
             */
            static QUrl makeRequestUrl(QUrl baseUrl);

    };
} // namespace QMatrixClient