libQuotient
A Qt library for building matrix clients
Loading...
Searching...
No Matches
administrative_contact.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/csapi/definitions/auth_data.h>
6#include <Quotient/csapi/definitions/request_email_validation.h>
7#include <Quotient/csapi/definitions/request_msisdn_validation.h>
8#include <Quotient/csapi/definitions/request_token_response.h>
9
10#include <Quotient/jobs/basejob.h>
11
12namespace Quotient {
13
14//! \brief Gets a list of a user's third-party identifiers.
15//!
16//! Gets a list of the third-party identifiers that the homeserver has
17//! associated with the user's account.
18//!
19//! This is *not* the same as the list of third-party identifiers bound to
20//! the user's Matrix ID in identity servers.
21//!
22//! Identifiers in this list may be used by the homeserver as, for example,
23//! identifiers that it will accept to reset the user's account password.
25public:
26 // Inner data structures
27
29 //! The medium of the third-party identifier.
31
32 //! The third-party identifier address.
34
35 //! The timestamp, in milliseconds, when the identifier was
36 //! validated by the identity server.
38
39 //! The timestamp, in milliseconds, when the homeserver associated the third-party
40 //! identifier with the user.
42 };
43
44 // Construction/destruction
45
47
48 //! \brief Construct a URL without creating a full-fledged job object
49 //!
50 //! This function can be used when a URL for GetAccount3PIDsJob
51 //! is necessary but the job itself isn't.
53
54 // Result properties
55
57 {
58 return loadFromJson<QVector<ThirdPartyIdentifier>>("threepids"_L1);
59 }
60};
61
62inline auto collectResponse(const GetAccount3PIDsJob* job) { return job->threepids(); }
63
64template <>
67 {
68 fillFromJson(jo.value("medium"_L1), result.medium);
69 fillFromJson(jo.value("address"_L1), result.address);
70 fillFromJson(jo.value("validated_at"_L1), result.validatedAt);
71 fillFromJson(jo.value("added_at"_L1), result.addedAt);
72 }
73};
74
75//! \brief Adds contact information to the user's account.
76//!
77//! Adds contact information to the user's account.
78//!
79//! This endpoint is deprecated in favour of the more specific `/3pid/add`
80//! and `/3pid/bind` endpoints.
81//!
82//! **Note:**
83//! Previously this endpoint supported a `bind` parameter. This parameter
84//! has been removed, making this endpoint behave as though it was `false`.
85//! This results in this endpoint being an equivalent to `/3pid/bind` rather
86//! than dual-purpose.
87class [[deprecated("Check the documentation for details")]] QUOTIENT_API Post3PIDsJob
88 : public BaseJob {
89public:
90 // Inner data structures
91
92 //! The third-party credentials to associate with the account.
94 //! The client secret used in the session with the identity server.
96
97 //! The identity server to use.
99
100 //! An access token previously registered with the identity server. Servers
101 //! can treat this as optional to distinguish between r0.5-compatible clients
102 //! and this specification version.
104
105 //! The session identifier given by the identity server.
107 };
108
109 // Construction/destruction
110
111 //! \param threePidCreds
112 //! The third-party credentials to associate with the account.
114
115 // Result properties
116
117 //! An optional field containing a URL where the client must
118 //! submit the validation token to, with identical parameters
119 //! to the Identity Service API's `POST
120 //! /validate/email/submitToken` endpoint (without the requirement
121 //! for an access token). The homeserver must send this token to the
122 //! user (if applicable), who should then be prompted to provide it
123 //! to the client.
124 //!
125 //! If this field is not present, the client can assume that
126 //! verification will happen without the client's involvement
127 //! provided the homeserver advertises this specification version
128 //! in the `/versions` response (ie: r0.5.0).
129 QUrl submitUrl() const { return loadFromJson<QUrl>("submit_url"_L1); }
130};
131
132QT_WARNING_PUSH
133QT_WARNING_DISABLE_DEPRECATED
134inline auto collectResponse(const Post3PIDsJob* job) { return job->submitUrl(); }
135QT_WARNING_POP
136
137QT_WARNING_PUSH
139template <>
142 {
143 addParam(jo, "client_secret"_L1, pod.clientSecret);
144 addParam(jo, "id_server"_L1, pod.idServer);
145 addParam(jo, "id_access_token"_L1, pod.idAccessToken);
146 addParam(jo, "sid"_L1, pod.sid);
147 }
148};
150
151//! \brief Adds contact information to the user's account.
152//!
153//! This API endpoint uses the [User-Interactive Authentication
154//! API](/client-server-api/#user-interactive-authentication-api).
155//!
156//! Adds contact information to the user's account. Homeservers should use 3PIDs added
157//! through this endpoint for password resets instead of relying on the identity server.
158//!
159//! Homeservers should prevent the caller from adding a 3PID to their account if it has
160//! already been added to another user's account on the homeserver.
162public:
163 //! \param clientSecret
164 //! The client secret used in the session with the homeserver.
165 //!
166 //! \param sid
167 //! The session identifier given by the homeserver.
168 //!
169 //! \param auth
170 //! Additional authentication information for the
171 //! user-interactive authentication API.
172 explicit Add3PIDJob(const QString& clientSecret, const QString& sid,
174};
175
176//! \brief Binds a 3PID to the user's account through an Identity Service.
177//!
178//! Binds a 3PID to the user's account through the specified identity server.
179//!
180//! Homeservers should not prevent this request from succeeding if another user
181//! has bound the 3PID. Homeservers should simply proxy any errors received by
182//! the identity server to the caller.
183//!
184//! Homeservers should track successful binds so they can be unbound later.
186public:
187 //! \param clientSecret
188 //! The client secret used in the session with the identity server.
189 //!
190 //! \param idServer
191 //! The identity server to use.
192 //!
193 //! \param idAccessToken
194 //! An access token previously registered with the identity server.
195 //!
196 //! \param sid
197 //! The session identifier given by the identity server.
199 const QString& idAccessToken, const QString& sid);
200};
201
202//! \brief Deletes a third-party identifier from the user's account
203//!
204//! Removes a third-party identifier from the user's account. This might not
205//! cause an unbind of the identifier from the identity server.
206//!
207//! Unlike other endpoints, this endpoint does not take an `id_access_token`
208//! parameter because the homeserver is expected to sign the request to the
209//! identity server instead.
211public:
212 //! \param medium
213 //! The medium of the third-party identifier being removed.
214 //!
215 //! \param address
216 //! The third-party address being removed.
217 //!
218 //! \param idServer
219 //! The identity server to unbind from. If not provided, the homeserver
220 //! MUST use the `id_server` the identifier was added through. If the
221 //! homeserver does not know the original `id_server`, it MUST return
222 //! a `id_server_unbind_result` of `no-support`.
224 const QString& idServer = {});
225
226 // Result properties
227
228 //! An indicator as to whether or not the homeserver was able to unbind
229 //! the 3PID from the identity server. `success` indicates that the
230 //! identity server has unbound the identifier whereas `no-support`
231 //! indicates that the identity server refuses to support the request
232 //! or the homeserver was not able to determine an identity server to
233 //! unbind from.
235 {
236 return loadFromJson<QString>("id_server_unbind_result"_L1);
237 }
238};
239
240inline auto collectResponse(const Delete3pidFromAccountJob* job)
241{
242 return job->idServerUnbindResult();
243}
244
245//! \brief Removes a user's third-party identifier from an identity server.
246//!
247//! Removes a user's third-party identifier from the provided identity server
248//! without removing it from the homeserver.
249//!
250//! Unlike other endpoints, this endpoint does not take an `id_access_token`
251//! parameter because the homeserver is expected to sign the request to the
252//! identity server instead.
254public:
255 //! \param medium
256 //! The medium of the third-party identifier being removed.
257 //!
258 //! \param address
259 //! The third-party address being removed.
260 //!
261 //! \param idServer
262 //! The identity server to unbind from. If not provided, the homeserver
263 //! MUST use the `id_server` the identifier was added through. If the
264 //! homeserver does not know the original `id_server`, it MUST return
265 //! a `id_server_unbind_result` of `no-support`.
267 const QString& idServer = {});
268
269 // Result properties
270
271 //! An indicator as to whether or not the identity server was able to unbind
272 //! the 3PID. `success` indicates that the identity server has unbound the
273 //! identifier whereas `no-support` indicates that the identity server
274 //! refuses to support the request or the homeserver was not able to determine
275 //! an identity server to unbind from.
277 {
278 return loadFromJson<QString>("id_server_unbind_result"_L1);
279 }
280};
281
282inline auto collectResponse(const Unbind3pidFromAccountJob* job)
283{
284 return job->idServerUnbindResult();
285}
286
287//! \brief Begins the validation process for an email address for association with the user's
288//! account.
289//!
290//! The homeserver must check that the given email address is **not**
291//! already associated with an account on this homeserver. This API should
292//! be used to request validation tokens when adding an email address to an
293//! account. This API's parameters and response are identical to that of
294//! the
295//! [`/register/email/requestToken`](/client-server-api/#post_matrixclientv3registeremailrequesttoken)
296//! endpoint. The homeserver should validate
297//! the email itself, either by sending a validation email itself or by using
298//! a service it has control over.
300public:
302
303 // Result properties
304
305 //! An email was sent to the given address. Note that this may be an
306 //! email containing the validation token or it may be informing the
307 //! user of an error.
309};
310
311inline auto collectResponse(const RequestTokenTo3PIDEmailJob* job) { return job->response(); }
312
313//! \brief Begins the validation process for a phone number for association with the user's account.
314//!
315//! The homeserver must check that the given phone number is **not**
316//! already associated with an account on this homeserver. This API should
317//! be used to request validation tokens when adding a phone number to an
318//! account. This API's parameters and response are identical to that of
319//! the
320//! [`/register/msisdn/requestToken`](/client-server-api/#post_matrixclientv3registermsisdnrequesttoken)
321//! endpoint. The homeserver should validate
322//! the phone number itself, either by sending a validation message itself or by using
323//! a service it has control over.
325public:
327
328 // Result properties
329
330 //! An SMS message was sent to the given phone number.
332};
333
334inline auto collectResponse(const RequestTokenTo3PIDMSISDNJob* job) { return job->response(); }
335
336} // namespace Quotient
Adds contact information to the user's account.
Binds a 3PID to the user's account through an Identity Service.
Deletes a third-party identifier from the user's account.
Gets a list of a user's third-party identifiers.
Adds contact information to the user's account.
Begins the validation process for an email address for association with the user's account.
Begins the validation process for a phone number for association with the user's account.
Removes a user's third-party identifier from an identity server.
auto collectResponse(const GetAccountDataJob *job)
#define QUOTIENT_API