1919
2020#pragma once
2121
22- #include < boost/optional.hpp>
2322#include < chrono>
2423#include < functional>
2524#include < memory>
2625#include < string>
2726
27+ #include < olp/authentication/AuthenticationApi.h>
28+ #include < olp/authentication/AuthenticationCredentials.h>
29+ #include < olp/authentication/AuthenticationError.h>
2830#include < olp/authentication/AuthenticationSettings.h>
2931#include < olp/authentication/AuthorizeRequest.h>
32+ #include < olp/authentication/SignInResult.h>
33+ #include < olp/authentication/SignInUserResult.h>
34+ #include < olp/authentication/SignOutResult.h>
35+ #include < olp/authentication/SignUpResult.h>
3036#include < olp/authentication/Types.h>
3137#include < olp/core/client/ApiResponse.h>
3238#include < olp/core/client/CancellationToken.h>
33- #include < olp/core/http/NetworkProxySettings.h>
34-
35- #include " AuthenticationApi.h"
36- #include " AuthenticationCredentials.h"
37- #include " AuthenticationError.h"
38- #include " SignInResult.h"
39- #include " SignInUserResult.h"
40- #include " SignOutResult.h"
41- #include " SignUpResult.h"
39+ #include < boost/optional.hpp>
4240
4341/* *
44- * @brief The olp namespace
42+ * @brief The olp namespace is the namespace to rule them all.
4543 */
4644namespace olp {
4745
48- namespace http {
49- class Network ;
50- }
51-
52- namespace thread {
53- class TaskScheduler ;
54- }
55-
5646/* *
57- * @brief The authentication namespace
47+ * @brief The authentication namespace holds all authentication related classes.
5848 */
5949namespace authentication {
50+ class AuthenticationClientImpl ;
6051
6152/* *
6253 * @brief An API class of the C++ client that provides
@@ -107,7 +98,7 @@ class AUTHENTICATION_API AuthenticationClient {
10798 * It must be equal to or more than zero. Ignored if it is zero or greater
10899 * than the default expiration time of the application.
109100 */
110- unsigned int expires_in = 0 ;
101+ unsigned int expires_in{ 0 } ;
111102 };
112103
113104 /* *
@@ -151,7 +142,7 @@ class AUTHENTICATION_API AuthenticationClient {
151142 * zero or greater than the default expiration time supported by
152143 * the application.
153144 */
154- unsigned int expires_in = 0 ;
145+ unsigned int expires_in{ 0 } ;
155146 };
156147
157148 /* *
@@ -199,7 +190,7 @@ class AUTHENTICATION_API AuthenticationClient {
199190 /* *
200191 * @brief (Optional) Indicates if the user has opted in to marketing.
201192 */
202- bool marketing_enabled = false ;
193+ bool marketing_enabled{ false } ;
203194
204195 /* *
205196 * @brief (Optional) Your valid phone number.
@@ -255,81 +246,61 @@ class AUTHENTICATION_API AuthenticationClient {
255246 * zero or greater than the default expiration time supported by
256247 * the application.
257248 */
258- unsigned int expires_in = 0 ;
249+ unsigned int expires_in{ 0 } ;
259250 };
260251
252+ // / The client sign-in response type.
253+ using SignInClientResponse = Response<SignInResult>;
254+
255+ // / The callback type of the client sign-in response.
256+ using SignInClientCallback = Callback<SignInResult>;
257+
258+ // / The user sign-in response type.
259+ using SignInUserResponse = Response<SignInUserResult>;
260+
261+ // / The callback type of the user sign-in response.
262+ using SignInUserCallback = Callback<SignInUserResult>;
263+
264+ // / The client sign-up response type.
265+ using SignUpResponse = Response<SignUpResult>;
266+
267+ // / The callback type of the user sign-up response.
268+ using SignUpCallback = Callback<SignUpResult>;
269+
270+ // / The client sign-out response type.
271+ using SignOutUserResponse = Response<SignOutResult>;
272+
273+ // / The callback type of the user sign-out response.
274+ using SignOutUserCallback = Callback<SignOutResult>;
275+
261276 /* *
262277 * @brief Creates the `AuthenticationClient` instance.
263278 *
264279 * @param settings The authentication settings that can be used to configure
265280 * the `AuthenticationClient` instance.
266281 */
267282 explicit AuthenticationClient (AuthenticationSettings settings);
268-
269- /* *
270- * @brief A default destructor.
271- */
272283 virtual ~AuthenticationClient ();
273284
274- /* *
275- * @brief Defines the callback signature when the client sign-in request is
276- * completed.
277- */
278- using SignInClientResponse =
279- client::ApiResponse<SignInResult, AuthenticationError>;
280- /* *
281- * @brief Called when the client sign-in request is completed.
282- */
283- using SignInClientCallback =
284- std::function<void (const SignInClientResponse& response)>;
285-
286- /* *
287- * @brief Defines the callback signature when the user sign-in request is
288- * completed.
289- */
290- using SignInUserResponse =
291- client::ApiResponse<SignInUserResult, AuthenticationError>;
292- /* *
293- * @brief Called when the user sign-in request is completed.
294- */
295- using SignInUserCallback =
296- std::function<void (const SignInUserResponse& response)>;
297-
298- /* *
299- * @brief Defines the callback signature when the user sign-up request is
300- * completed.
301- */
302- using SignUpResponse = client::ApiResponse<SignUpResult, AuthenticationError>;
303- /* *
304- * @brief Called when the user sign-up request is completed.
305- */
306- using SignUpCallback = std::function<void (const SignUpResponse& response)>;
307-
308- /* *
309- * @brief Defines the callback signature when the user sign-out request is
310- * completed.
311- */
312- using SignOutUserResponse =
313- client::ApiResponse<SignOutResult, AuthenticationError>;
314- /* *
315- * @brief Called when the user sign-out request is completed.
316- */
317- using SignOutUserCallback =
318- std::function<void (const SignOutUserResponse& response)>;
285+ // Non-copyable but movable
286+ AuthenticationClient (const AuthenticationClient&) = delete ;
287+ AuthenticationClient& operator =(const AuthenticationClient&) = delete ;
288+ AuthenticationClient (AuthenticationClient&&) noexcept = default ;
289+ AuthenticationClient& operator =(AuthenticationClient&&) noexcept = default ;
319290
320291 /* *
321- * @brief Signs in with your HERE Account client credentials and reuests
292+ * @brief Signs in with your HERE Account client credentials and requests
322293 * the client access token.
323294 *
324295 * The client access tokens cannot be refreshed. Instead
325296 * request a new client access token using your client credentials.
326297 *
327298 * @param credentials The `AuthenticationCredentials` instance.
328- * @param properties The `SignInProperties` structure that has the scope and
329- * expiration time.
299+ * @param properties The `SignInProperties` structure that has the scope
300+ * and expiration time.
330301 * @param callback The`SignInClientCallback` method that is called when
331- * the client sign-in request is completed. If successful, the returned HTTP
332- * status is 200. Otherwise, check the response error.
302+ * the client sign-in request is completed. If successful, the returned
303+ * HTTP status is 200. Otherwise, check the response error.
333304 *
334305 * @return The `CancellationToken` instance that can be used to cancel
335306 * the request.
@@ -405,6 +376,7 @@ class AUTHENTICATION_API AuthenticationClient {
405376 const AuthenticationCredentials& credentials,
406377 const FederatedProperties& properties,
407378 const SignInUserCallback& callback);
379+
408380 /* *
409381 * @brief Signs in with your valid Google token and requests your user access
410382 * token.
@@ -428,6 +400,7 @@ class AUTHENTICATION_API AuthenticationClient {
428400 const AuthenticationCredentials& credentials,
429401 const FederatedProperties& properties,
430402 const SignInUserCallback& callback);
403+
431404 /* *
432405 * @brief Signs in with your valid ArcGIS token and requests your user access
433406 * token.
@@ -451,6 +424,7 @@ class AUTHENTICATION_API AuthenticationClient {
451424 const AuthenticationCredentials& credentials,
452425 const FederatedProperties& properties,
453426 const SignInUserCallback& callback);
427+
454428 /* *
455429 * @brief Signs in with the refresh token.
456430 *
@@ -482,8 +456,8 @@ class AUTHENTICATION_API AuthenticationClient {
482456 * for using your email and password that are the login credentials.
483457 *
484458 * The HERE user is uniquely identified by the user ID that is consistent
485- * across the other HERE platform Services, regardless of the authentication method
486- * used.
459+ * across the other HERE platform Services, regardless of the authentication
460+ * method used.
487461 *
488462 * @param credentials The `AuthenticationCredentials` instance.
489463 * @param properties The `SignUpProperties` structure.
@@ -497,6 +471,7 @@ class AUTHENTICATION_API AuthenticationClient {
497471 client::CancellationToken SignUpHereUser (
498472 const AuthenticationCredentials& credentials,
499473 const SignUpProperties& properties, const SignUpCallback& callback);
474+
500475 /* *
501476 * @brief Accepts the terms and conditions.
502477 *
@@ -586,8 +561,7 @@ class AUTHENTICATION_API AuthenticationClient {
586561 AuthorizeCallback callback);
587562
588563 private:
589- class Impl ;
590- std::unique_ptr<Impl> impl_;
564+ std::unique_ptr<AuthenticationClientImpl> impl_;
591565};
592566
593567} // namespace authentication
0 commit comments