aboutsummaryrefslogtreecommitdiff
path: root/lib/csapi/registration_tokens.h
diff options
context:
space:
mode:
authorAlexey Rusakov <Kitsune-Ral@users.sf.net>2022-05-31 18:24:53 +0200
committerAlexey Rusakov <Kitsune-Ral@users.sf.net>2022-05-31 18:25:37 +0200
commit42811660094c88a4a1bfa8bd8ace5f4b148c246a (patch)
tree36c7c05f16f3643eaabec75d3e231c1e6bf2a61d /lib/csapi/registration_tokens.h
parentfed831820965ad5654317d5e7df18c23fa75de20 (diff)
downloadlibquotient-42811660094c88a4a1bfa8bd8ace5f4b148c246a.tar.gz
libquotient-42811660094c88a4a1bfa8bd8ace5f4b148c246a.zip
Regenerate API files (FTBFS; see the next commit)
Diffstat (limited to 'lib/csapi/registration_tokens.h')
-rw-r--r--lib/csapi/registration_tokens.h44
1 files changed, 44 insertions, 0 deletions
diff --git a/lib/csapi/registration_tokens.h b/lib/csapi/registration_tokens.h
new file mode 100644
index 00000000..e3008dd4
--- /dev/null
+++ b/lib/csapi/registration_tokens.h
@@ -0,0 +1,44 @@
+/******************************************************************************
+ * THIS FILE IS GENERATED - ANY EDITS WILL BE OVERWRITTEN
+ */
+
+#pragma once
+
+#include "jobs/basejob.h"
+
+namespace Quotient {
+
+/*! \brief Query if a given registration token is still valid.
+ *
+ * Queries the server to determine if a given registration token is still
+ * valid at the time of request. This is a point-in-time check where the
+ * token might still expire by the time it is used.
+ *
+ * Servers should be sure to rate limit this endpoint to avoid brute force
+ * attacks.
+ */
+class QUOTIENT_API RegistrationTokenValidityJob : public BaseJob {
+public:
+ /*! \brief Query if a given registration token is still valid.
+ *
+ * \param token
+ * The token to check validity of.
+ */
+ explicit RegistrationTokenValidityJob(const QString& token);
+
+ /*! \brief Construct a URL without creating a full-fledged job object
+ *
+ * This function can be used when a URL for RegistrationTokenValidityJob
+ * is necessary but the job itself isn't.
+ */
+ static QUrl makeRequestUrl(QUrl baseUrl, const QString& token);
+
+ // Result properties
+
+ /// True if the token is still valid, false otherwise. This should
+ /// additionally be false if the token is not a recognised token by
+ /// the server.
+ bool valid() const { return loadFromJson<bool>("valid"_ls); }
+};
+
+} // namespace Quotient