aboutsummaryrefslogtreecommitdiff
path: root/juick-common/src/main/java/com/juick/server/helpers/CommandResult.java
blob: a5baaee0b552040926f62dcbba64e7a642b741d8 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
package com.juick.server.helpers;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.juick.Message;

import java.util.Optional;

public class CommandResult {
    private String text;
    private String markdown;
    private Message newMessage;

    public String getText() {
        return text;
    }
    public String getMarkdown() {
        return markdown;
    }

    public Optional<Message> getNewMessage() {
        return Optional.ofNullable(newMessage);
    }
    public static CommandResult build(Message newMessage, String text, String markdown) {
        CommandResult result = new CommandResult();
        result.newMessage = newMessage;
        result.text = text;
        result.markdown = markdown;
        return result;
    }
    public static CommandResult fromString(String text) {
        CommandResult result = new CommandResult();
        result.text = text;
        return result;
    }

}