libQuotient
A Qt library for building matrix clients
registration_tokens.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 
7 namespace Quotient {
8 
9 //! \brief Query if a given registration token is still valid.
10 //!
11 //! Queries the server to determine if a given registration token is still
12 //! valid at the time of request. This is a point-in-time check where the
13 //! token might still expire by the time it is used.
14 //!
15 //! Servers should be sure to rate limit this endpoint to avoid brute force
16 //! attacks.
17 class QUOTIENT_API RegistrationTokenValidityJob : public BaseJob {
18 public:
19  //! \param token
20  //! The token to check validity of.
21  explicit RegistrationTokenValidityJob(const QString& token);
22 
23  //! \brief Construct a URL without creating a full-fledged job object
24  //!
25  //! This function can be used when a URL for RegistrationTokenValidityJob
26  //! is necessary but the job itself isn't.
27  static QUrl makeRequestUrl(const HomeserverData& hsData, const QString& token);
28 
29  // Result properties
30 
31  //! True if the token is still valid, false otherwise. This should
32  //! additionally be false if the token is not a recognised token by
33  //! the server.
34  bool valid() const { return loadFromJson<bool>("valid"_L1); }
35 };
36 
37 inline auto collectResponse(const RegistrationTokenValidityJob* job) { return job->valid(); }
38 
39 } // namespace Quotient