/// <summary> /// Ensures the lifespan. /// </summary> /// <param name="errorRsponse">The error response.</param> /// <returns></returns> public bool EnsureLifespan(ApiResponse apiResponse) { var identityResponse = AuthClient.EnsureLifespan(Token); if (identityResponse.StatusCode != HttpStatusCode.OK) { var errorMessage = identityResponse.StatusMessage; if (identityResponse.Token != null) { var errorParts = new List <string> { identityResponse.Token.Error }; if (string.IsNullOrWhiteSpace(identityResponse.Token.ErrorDescription) == false) { errorParts.Add(identityResponse.Token.ErrorDescription); } errorMessage = string.Join(" - ", errorParts); } apiResponse.StatusCode = identityResponse.StatusCode; apiResponse.Errors = new List <ErrorCodeModel> { new ErrorCodeModel { Code = (int)apiResponse.StatusCode, Description = errorMessage } }; return(false); } apiResponse.StatusCode = identityResponse.StatusCode; Token = identityResponse.Token; return(true); }