diff options
author | Alexey Rusakov <Kitsune-Ral@users.sf.net> | 2022-06-11 19:42:08 +0200 |
---|---|---|
committer | Alexey Rusakov <Kitsune-Ral@users.sf.net> | 2022-06-11 21:33:54 +0200 |
commit | ed05d9d589fe3d36bd3714e648016352179afbef (patch) | |
tree | b86c1c9417d1037f02011cc9b651ab3acb3c77cb /lib/csapi/registration.h | |
parent | 3a2e7f19c97289fb962b1c0ba4439870bbd0f31d (diff) | |
download | libquotient-ed05d9d589fe3d36bd3714e648016352179afbef.tar.gz libquotient-ed05d9d589fe3d36bd3714e648016352179afbef.zip |
Regenerate API files using latest matrix-spec
New:
- refresh tokens support (changes in login.* and registration.*;
RefreshJob);
- GetRelatingEvents[WithRelType[AndEventType]]Job
Changed space_hierarchy.*:
- childrenState is of type StateEvents now; limit and maxDepth are
(omittable) integers, not doubles.
- no more unused `stripped_state.h` file inclusion.
Diffstat (limited to 'lib/csapi/registration.h')
-rw-r--r-- | lib/csapi/registration.h | 32 |
1 files changed, 24 insertions, 8 deletions
diff --git a/lib/csapi/registration.h b/lib/csapi/registration.h index 39840008..7a20cab8 100644 --- a/lib/csapi/registration.h +++ b/lib/csapi/registration.h @@ -93,6 +93,9 @@ public: * If true, an `access_token` and `device_id` should not be * returned from this call, therefore preventing an automatic * login. Defaults to false. + * + * \param refreshToken + * If true, the client supports refresh tokens. */ explicit RegisterJob(const QString& kind = QStringLiteral("user"), const Omittable<AuthenticationData>& auth = none, @@ -100,7 +103,8 @@ public: const QString& password = {}, const QString& deviceId = {}, const QString& initialDeviceDisplayName = {}, - Omittable<bool> inhibitLogin = none); + Omittable<bool> inhibitLogin = none, + Omittable<bool> refreshToken = none); // Result properties @@ -118,15 +122,27 @@ public: return loadFromJson<QString>("access_token"_ls); } - /// The server_name of the homeserver on which the account has - /// been registered. + /// A refresh token for the account. This token can be used to + /// obtain a new access token when it expires by calling the + /// `/refresh` endpoint. + /// + /// Omitted if the `inhibit_login` option is false. + QString refreshToken() const + { + return loadFromJson<QString>("refresh_token"_ls); + } + + /// The lifetime of the access token, in milliseconds. Once + /// the access token has expired a new access token can be + /// obtained by using the provided refresh token. If no + /// refresh token is provided, the client will need to re-log in + /// to obtain a new access token. If not given, the client can + /// assume that the access token will not expire. /// - /// **Deprecated**. Clients should extract the server_name from - /// `user_id` (by splitting at the first colon) if they require - /// it. Note also that `homeserver` is not spelt this way. - QString homeServer() const + /// Omitted if the `inhibit_login` option is false. + Omittable<int> expiresInMs() const { - return loadFromJson<QString>("home_server"_ls); + return loadFromJson<Omittable<int>>("expires_in_ms"_ls); } /// ID of the registered device. Will be the same as the |