| 1 | /****************************************************************************** |
| 2 | * THIS FILE IS GENERATED - ANY EDITS WILL BE OVERWRITTEN |
| 3 | */ |
| 4 | |
| 5 | #pragma once |
| 6 | |
| 7 | #include <Quotient/jobs/basejob.h> |
| 8 | |
| 9 | namespace Quotient { |
| 10 | |
| 11 | /*! \brief Refresh an access token |
| 12 | * |
| 13 | * Refresh an access token. Clients should use the returned access token |
| 14 | * when making subsequent API calls, and store the returned refresh token |
| 15 | * (if given) in order to refresh the new access token when necessary. |
| 16 | * |
| 17 | * After an access token has been refreshed, a server can choose to |
| 18 | * invalidate the old access token immediately, or can choose not to, for |
| 19 | * example if the access token would expire soon anyways. Clients should |
| 20 | * not make any assumptions about the old access token still being valid, |
| 21 | * and should use the newly provided access token instead. |
| 22 | * |
| 23 | * The old refresh token remains valid until the new access token or refresh |
| 24 | * token is used, at which point the old refresh token is revoked. |
| 25 | * |
| 26 | * Note that this endpoint does not require authentication via an |
| 27 | * access token. Authentication is provided via the refresh token. |
| 28 | * |
| 29 | * Application Service identity assertion is disabled for this endpoint. |
| 30 | */ |
| 31 | class QUOTIENT_API RefreshJob : public BaseJob { |
| 32 | public: |
| 33 | /*! \brief Refresh an access token |
| 34 | * |
| 35 | * \param refreshToken |
| 36 | * The refresh token |
| 37 | */ |
| 38 | explicit RefreshJob(const QString& refreshToken); |
| 39 | |
| 40 | // Result properties |
| 41 | |
| 42 | /// The new access token to use. |
| 43 | QString accessToken() const |
| 44 | { |
| 45 | return loadFromJson<QString>(keyName: "access_token"_ls ); |
| 46 | } |
| 47 | |
| 48 | /// The new refresh token to use when the access token needs to |
| 49 | /// be refreshed again. If not given, the old refresh token can |
| 50 | /// be re-used. |
| 51 | QString refreshToken() const |
| 52 | { |
| 53 | return loadFromJson<QString>(keyName: "refresh_token"_ls ); |
| 54 | } |
| 55 | |
| 56 | /// The lifetime of the access token, in milliseconds. If not |
| 57 | /// given, the client can assume that the access token will not |
| 58 | /// expire. |
| 59 | Omittable<int> expiresInMs() const |
| 60 | { |
| 61 | return loadFromJson<Omittable<int>>(keyName: "expires_in_ms"_ls ); |
| 62 | } |
| 63 | }; |
| 64 | |
| 65 | } // namespace Quotient |
| 66 | |