Exemple #1
0
        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);
        }
Exemple #2
0
        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);
        }