/// <inheritdoc /> public async Task <LondonTravelUser> FindByEmailAsync(string normalizedEmail, CancellationToken cancellationToken) { if (normalizedEmail == null) { throw new ArgumentNullException(nameof(normalizedEmail)); } var results = await _client.GetAsync <LondonTravelUser>((p) => p.EmailNormalized == normalizedEmail, cancellationToken); return(results.FirstOrDefault()); }
/// <summary> /// Finds the user with the specified access token, if any, as an asynchronous operation. /// </summary> /// <param name="accessToken">The access token to find the associated user for.</param> /// <param name="cancellationToken">The cancellation token to use.</param> /// <returns> /// A <see cref="Task{TResult}"/> representing the asynchronous operation to /// find the London Travel user with the specified Alexa access token. /// </returns> private async Task <LondonTravelUser> FindUserByAccessTokenAsync(string accessToken, CancellationToken cancellationToken) { LondonTravelUser user = null; if (!string.IsNullOrEmpty(accessToken)) { try { user = (await _client.GetAsync <LondonTravelUser>((p) => p.AlexaToken == accessToken, cancellationToken)).FirstOrDefault(); } catch (Exception ex) { _logger?.LogError(default, ex, "Failed to find user by access token.");