public static ChatRequest createLoginRequest(chat.model.User user) { proto.User userDTO = proto.User.CreateBuilder().SetId(user.Id).SetPasswd(user.Password).Build(); ChatRequest request = ChatRequest.CreateBuilder().SetType(ChatRequest.Types.Type.Login) .SetUser(userDTO).Build(); return(request); }
public static ChatRequest createLoggedFriendsRequest(chat.model.User user) { proto.User userDTO = proto.User.CreateBuilder().SetId(user.Id).Build(); ChatRequest request = ChatRequest.CreateBuilder().SetType(ChatRequest.Types.Type.GetLoggedFriends) .SetUser(userDTO).Build(); return(request); }
public static ChatResponse createFriendLoggedOutResponse(chat.model.User user) { proto.User userDTO = proto.User.CreateBuilder().SetId(user.Id).Build(); ChatResponse response = ChatResponse.CreateBuilder() .SetType(ChatResponse.Types.Type.FriendLoggedOut) .SetUser(userDTO).Build(); return(response); }
public static ChatResponse createLoggedFriendsResponse(chat.model.User[] users) { ChatResponse.Builder response = ChatResponse.CreateBuilder() .SetType(ChatResponse.Types.Type.GetLoggedFriends); foreach (chat.model.User user in users) { proto.User userDTO = proto.User.CreateBuilder().SetId(user.Id).Build(); response.AddFriends(userDTO); } return(response.Build()); }