Search in sources :

Example 1 with ChatRequest

use of org.finos.symphony.toolkit.workflow.annotations.ChatRequest in project spring-bot by finos.

the class HelpController method initExposedHandlers.

@SuppressWarnings("unchecked")
public void initExposedHandlers() {
    if (exposedHandlers == null) {
        ResolvableType rt = ResolvableType.forClassWithGenerics(ChatHandlerMapping.class, ChatRequest.class);
        exposedHandlers = Arrays.stream(ctx.getBeanNamesForType(rt)).map(bn -> (ChatHandlerMapping<ChatRequest>) ctx.getBean(bn)).collect(Collectors.toList());
    }
}
Also used : ChatRequest(org.finos.symphony.toolkit.workflow.annotations.ChatRequest) ResolvableType(org.springframework.core.ResolvableType)

Example 2 with ChatRequest

use of org.finos.symphony.toolkit.workflow.annotations.ChatRequest in project spring-bot by finos.

the class HelpController method convertToCommandDescriptions.

private CommandDescription convertToCommandDescriptions(ChatMapping<ChatRequest> hm) {
    ChatRequest e = hm.getMapping();
    ChatHandlerMethod m = hm.getHandlerMethod();
    String d = StringUtils.hasText(e.description()) ? e.description() : defaultDescription(m.getMethod());
    return new CommandDescription(e.isButtonOnHelpPage(), e.value()[0], d, Arrays.asList(e.value()));
}
Also used : ChatRequest(org.finos.symphony.toolkit.workflow.annotations.ChatRequest) ChatHandlerMethod(org.finos.symphony.toolkit.workflow.java.mapping.ChatHandlerMethod)

Example 3 with ChatRequest

use of org.finos.symphony.toolkit.workflow.annotations.ChatRequest in project spring-bot by finos.

the class ToDoController method complete.

@ChatRequest(value = "complete {items} {by}", description = "Complete items, e.g. \"/complete 1 3 5 @Suresh Rupnar\"")
public ToDoList complete(@ChatVariable("items") List<Word> words, @ChatVariable("by") Optional<User> by, User a, Optional<ToDoList> toDo) {
    ToDoList out = toDo.orElse(new ToDoList());
    User u = by.orElse(a);
    changeStatus(out, words, u, Status.COMPLETE);
    return out;
}
Also used : User(org.finos.symphony.toolkit.workflow.content.User) ChatRequest(org.finos.symphony.toolkit.workflow.annotations.ChatRequest)

Example 4 with ChatRequest

use of org.finos.symphony.toolkit.workflow.annotations.ChatRequest in project spring-bot by finos.

the class ToDoController method assign.

@ChatRequest(value = "assign {items} {by}", description = "Assign items, e.g. \"/assign 1 3 5 @Suresh Rupnar\"")
public ToDoList assign(@ChatVariable("items") List<Word> words, @ChatVariable("by") Optional<User> by, User a, Optional<ToDoList> toDo) {
    ToDoList out = toDo.orElse(new ToDoList());
    User u = by.orElse(a);
    changeStatus(out, words, u, Status.OPEN);
    return out;
}
Also used : User(org.finos.symphony.toolkit.workflow.content.User) ChatRequest(org.finos.symphony.toolkit.workflow.annotations.ChatRequest)

Example 5 with ChatRequest

use of org.finos.symphony.toolkit.workflow.annotations.ChatRequest in project spring-bot by finos.

the class OurController method form1.

@ChatRequest(description = "Do blah with a form", value = "form1")
public WorkResponse form1(Addressable a) {
    ButtonList bl = new ButtonList();
    bl.add(new Button("go", Type.ACTION, "Do The Thing"));
    return new WorkResponse(a, new TestObject(), WorkMode.EDIT, bl, null);
}
Also used : Button(org.finos.symphony.toolkit.workflow.form.Button) ChatButton(org.finos.symphony.toolkit.workflow.annotations.ChatButton) WorkResponse(org.finos.symphony.toolkit.workflow.response.WorkResponse) ButtonList(org.finos.symphony.toolkit.workflow.form.ButtonList) ChatRequest(org.finos.symphony.toolkit.workflow.annotations.ChatRequest)

Aggregations

ChatRequest (org.finos.symphony.toolkit.workflow.annotations.ChatRequest)9 User (org.finos.symphony.toolkit.workflow.content.User)3 ZoneId (java.time.ZoneId)2 Map (java.util.Map)2 ChatButton (org.finos.symphony.toolkit.workflow.annotations.ChatButton)2 ChatVariable (org.finos.symphony.toolkit.workflow.annotations.ChatVariable)2 WorkMode (org.finos.symphony.toolkit.workflow.annotations.WorkMode)2 MessageResponse (org.finos.symphony.toolkit.workflow.response.MessageResponse)2 Arrays (java.util.Arrays)1 HashMap (java.util.HashMap)1 List (java.util.List)1 Optional (java.util.Optional)1 Collectors (java.util.stream.Collectors)1 Action (org.finos.symphony.toolkit.workflow.actions.Action)1 FormAction (org.finos.symphony.toolkit.workflow.actions.FormAction)1 SimpleMessageAction (org.finos.symphony.toolkit.workflow.actions.SimpleMessageAction)1 ChatResponseBody (org.finos.symphony.toolkit.workflow.annotations.ChatResponseBody)1 Addressable (org.finos.symphony.toolkit.workflow.content.Addressable)1 Content (org.finos.symphony.toolkit.workflow.content.Content)1 Message (org.finos.symphony.toolkit.workflow.content.Message)1