public override async Task <GetTwitterUserResponse> AddTwitterUser(GetTwitterUserRequest request, ServerCallContext context) { GetTwitterUserResponse response = await GetTwitterUser(request, context); _dataStore.AddUser(response.User); return(response); }
public override async Task <GetTwitterUserResponse> GetTwitterUser(GetTwitterUserRequest request, ServerCallContext context) { GetTwitterUserResponse response = new GetTwitterUserResponse(); response.User = new TwitterUser { Language = request.Language, VoiceName = request.VoiceName }; IUser user = request.UserCase switch { GetTwitterUserRequest.UserOneofCase.Id => await UserAsync.GetUserFromId(request.Id), GetTwitterUserRequest.UserOneofCase.Handle => await UserAsync.GetUserFromScreenName(request.Handle), _ => null, }; response.User.Id = user.Id; response.User.Handle = user.ScreenName; response.User.Name = user.Name; response.User.ProfileImageUrl = user.ProfileImageUrlFullSize; return(response); }