/// <summary>Authenticates the user based on credentials and returns them a suitable JWT token.</summary>
        /// <param name="request">The authentication request including user and password details.</param>
        /// <param name="cancellationToken">A cancellation token that can be used by other objects or threads to receive notice of cancellation.</param>
        /// <returns>The authentication was a success and user information will be returned along with a new token.</returns>
        /// <exception cref="SwaggerException">A server side error occurred.</exception>
        public async Task <AuthenticateUserResponse> AuthenticateJwtAsync(AuthenticateUserRequest request, CancellationToken cancellationToken)
        {
            var url_ = string.Format("{0}/{1}?", BaseUrl, "");


            var client_ = new HttpClient();

            PrepareRequest(client_, ref url_);

            var content_ = new StringContent(JsonConvert.SerializeObject(request));

            content_.Headers.ContentType.MediaType = "application/json";

            var response_ = await client_.PutAsync(url_, content_, cancellationToken).ConfigureAwait(false);

            ProcessResponse(client_, response_);

            var responseData_ = await response_.Content.ReadAsByteArrayAsync().ConfigureAwait(false);

            var status_ = ((int)response_.StatusCode).ToString();

            if (status_ == "200")
            {
                var result_ = default(AuthenticateUserResponse);
                try
                {
                    if (responseData_.Length > 0)
                    {
                        result_ = JsonConvert.DeserializeObject <AuthenticateUserResponse>(Encoding.UTF8.GetString(responseData_));
                    }
                    return(result_);
                }
                catch (Exception exception)
                {
                    throw new SwaggerException("Could not deserialize the response body.", status_, responseData_, exception);
                }
            }
            else
            if (status_ == "401")
            {
                return(default(AuthenticateUserResponse));
            }
            else
            {
            }

            throw new SwaggerException("The HTTP status code of the response was not expected (" + (int)response_.StatusCode + ").", status_, responseData_, null);
        }
 /// <summary>Authenticates the user based on credentials and returns them a suitable JWT token.</summary>
 /// <param name="request">The authentication request including user and password details.</param>
 /// <returns>The authentication was a success and user information will be returned along with a new token.</returns>
 /// <exception cref="SwaggerException">A server side error occurred.</exception>
 public Task <AuthenticateUserResponse> AuthenticateJwtAsync(AuthenticateUserRequest request)
 {
     return(AuthenticateJwtAsync(request, CancellationToken.None));
 }