Search in sources :

Example 6 with MessageResponse

use of org.finos.symphony.toolkit.workflow.response.MessageResponse in project spring-bot by finos.

the class ReminderController method timezones.

@ChatRequest(value = "timezones", description = "List Time Zones")
public Response timezones(Addressable a) {
    Map<String, List<String>> zoneMap = ZoneId.getAvailableZoneIds().stream().sorted().collect(Collectors.groupingBy(k -> {
        int slashIndex = k.indexOf("/");
        if (slashIndex == -1) {
            return "none";
        } else {
            return k.substring(0, slashIndex);
        }
    }));
    List<? extends Content> headers = Word.build("Region Zone");
    List<List<? extends Content>> tableCells = zoneMap.keySet().stream().map(m -> Arrays.asList(Word.of(m), bulletsOf(zoneMap.get(m)))).collect(Collectors.toList());
    Table t = Table.of(headers, tableCells);
    return new MessageResponse(a, t);
}
Also used : Paragraph(org.finos.symphony.toolkit.workflow.content.Paragraph) Arrays(java.util.Arrays) UnorderedList(org.finos.symphony.toolkit.workflow.content.UnorderedList) Table(org.finos.symphony.toolkit.workflow.content.Table) User(org.finos.symphony.toolkit.workflow.content.User) Word(org.finos.symphony.toolkit.workflow.content.Word) WorkMode(org.finos.symphony.toolkit.workflow.annotations.WorkMode) Autowired(org.springframework.beans.factory.annotation.Autowired) Response(org.finos.symphony.toolkit.workflow.response.Response) ChatVariable(org.finos.symphony.toolkit.workflow.annotations.ChatVariable) Controller(org.springframework.stereotype.Controller) Collectors(java.util.stream.Collectors) ZoneId(java.time.ZoneId) History(org.finos.symphony.toolkit.workflow.history.History) List(java.util.List) Addressable(org.finos.symphony.toolkit.workflow.content.Addressable) MessageResponse(org.finos.symphony.toolkit.workflow.response.MessageResponse) Map(java.util.Map) ChatRequest(org.finos.symphony.toolkit.workflow.annotations.ChatRequest) Optional(java.util.Optional) ChatButton(org.finos.symphony.toolkit.workflow.annotations.ChatButton) ChatResponseBody(org.finos.symphony.toolkit.workflow.annotations.ChatResponseBody) Content(org.finos.symphony.toolkit.workflow.content.Content) Table(org.finos.symphony.toolkit.workflow.content.Table) Content(org.finos.symphony.toolkit.workflow.content.Content) MessageResponse(org.finos.symphony.toolkit.workflow.response.MessageResponse) UnorderedList(org.finos.symphony.toolkit.workflow.content.UnorderedList) List(java.util.List) ChatRequest(org.finos.symphony.toolkit.workflow.annotations.ChatRequest)

Aggregations

MessageResponse (org.finos.symphony.toolkit.workflow.response.MessageResponse)6 EntityJson (org.finos.symphony.toolkit.json.EntityJson)2 ChatButton (org.finos.symphony.toolkit.workflow.annotations.ChatButton)2 ChatRequest (org.finos.symphony.toolkit.workflow.annotations.ChatRequest)2 ErrorResponse (org.finos.symphony.toolkit.workflow.response.ErrorResponse)2 ActiveWebHooks (org.finos.symphony.webhookbot.domain.ActiveWebHooks)2 Template (org.finos.symphony.webhookbot.domain.Template)2 WebHook (org.finos.symphony.webhookbot.domain.WebHook)2 JsonProcessingException (com.fasterxml.jackson.core.JsonProcessingException)1 ZoneId (java.time.ZoneId)1 Arrays (java.util.Arrays)1 List (java.util.List)1 Map (java.util.Map)1 Optional (java.util.Optional)1 Collectors (java.util.stream.Collectors)1 ChatResponseBody (org.finos.symphony.toolkit.workflow.annotations.ChatResponseBody)1 ChatVariable (org.finos.symphony.toolkit.workflow.annotations.ChatVariable)1 WorkMode (org.finos.symphony.toolkit.workflow.annotations.WorkMode)1 Addressable (org.finos.symphony.toolkit.workflow.content.Addressable)1 Chat (org.finos.symphony.toolkit.workflow.content.Chat)1