public static ChatRequest createSendMesssageRequest(chat.model.Message message) { proto.Message messageDTO = proto.Message.CreateBuilder(). SetSenderId(message.Sender.Id) .SetReceiverId(message.Receiver.Id) .SetText(message.Text).Build(); ChatRequest request = ChatRequest.CreateBuilder() .SetType(ChatRequest.Types.Type.SendMessage) .SetMessage(messageDTO).Build(); return(request); }
public static ChatResponse createNewMessageResponse(chat.model.Message message) { proto.Message messageDTO = proto.Message.CreateBuilder(). SetSenderId(message.Sender.Id) .SetReceiverId(message.Receiver.Id) .SetText(message.Text).Build(); ChatResponse response = ChatResponse.CreateBuilder() .SetType(ChatResponse.Types.Type.NewMessage) .SetMessage(messageDTO).Build(); return(response); }