java.lang.Object
com.sinch.sdk.domains.voice.models.v2.helpers.MenuCreator

public final class MenuCreator extends Object
Fluent creator of a menu command, returned by Menu.create(String)

build() checks that the start menu and every Menu.gotoMenu(String) target are items of this menu.

Since:
2.4
  • Method Details

    • item

      public MenuCreator item(String name, Consumer<MenuItemCreator> item)
      Add a menu item
      Parameters:
      name - Name of the item, 1 to 16 characters. Start menu and gotoMenu targets refer to it
      item - Lambda filling the item
      Returns:
      This creator
      Throws:
      IllegalArgumentException - if an item with this name is already defined
      Since:
      2.4
    • item

      public MenuCreator item(String name, MenuItem item)
      Add a menu item
      Parameters:
      name - Name of the item, 1 to 16 characters. Start menu and gotoMenu targets refer to it
      item - Menu item, e.g. built with Menu.item(Consumer) to share it
      Returns:
      This creator
      Throws:
      IllegalArgumentException - if an item with this name is already defined
      Since:
      2.4
    • build

      public MenuCommand build()
      Build the menu command
      Returns:
      The command
      Throws:
      IllegalStateException - if the start menu, or the target of a gotoMenu command of an item, is not an item of this menu
      Since:
      2.4