public async Task <IUser?> Get(uint userId) { var response = await _client.Get <User>($"api/Users/{userId}"); if (response.StatusCode != HttpStatusCode.OK) { Console.Error.WriteLine($"Failed to get user {userId}"); return(null); } return(await response.GetJson()); }
async Task <List <CachedEncryptionKey>?> RefreshUsersKeys(uint userId) { var response = await _ropuWebClient.Get <List <EncryptionKey> >($"api/Key/False/{userId}"); if (!response.IsSuccessful) { Console.Error.WriteLine($"Failed to find a key for user with UserId {userId}"); return(null); } var keys = (await response.GetJson()).Select(key => _cachedEncryiptonKeyFactory(key)).ToList(); _users.Remove(userId); _users.Add(userId, keys); return(keys); }