Class ChatDataActionsResponseBuilder

Конструктор ответов для действий в чате

Конструктор объектов Chat Data Action .

Доступно для дополнений Google Workspace, расширяющих функциональность Google Chat.

const card = CardService.newCardBuilder()
    .setHeader(CardService.newCardHeader().setTitle("Card Title"))
    .addSection(CardService.newCardSection()
      .addWidget(CardService.newTextParagraph().setText("Text paragraph")))
    .build()

const cardWithId = CardService.newCardWithId().setCardId("card_one").setCard(card)

const message = AddOnsResponseService.newChatMessage().addCardWithId(cardWithId)

const chatDataAction = AddOnsResponseService.newChatDataActionBuilder()
    .setCreateChatMessageAction(AddOnsResponseService.newCreateMessageAction()
    .setMessage(message))
    .build()

Методы

Метод Тип возвращаемого значения Краткое описание
build() Data Actions Response Формирует текущий ответ на действие.
set Create Chat Message Action(createMessageAction) Chat Data Actions Response Builder Задает Create Message Action для этого Data Actions Response .
set Update Chat Message Action(updateMessageAction) Chat Data Actions Response Builder Задает Update Message Action для Data Actions Response .
set Update Inline Preview Action(updateInlinePreviewAction) Chat Data Actions Response Builder Устанавливает Update Inline Preview Action для Data Actions Response .

Подробная документация

build()

Формирует текущий ответ на действие.

Возвращаться

Data Actions ResponseData Action Response .


set Create Chat Message Action(createMessageAction)

Задает Create Message Action для этого Data Actions Response .

const card = CardService.newCardBuilder()
    .setHeader(CardService.newCardHeader().setTitle("Card Title"))
    .addSection(CardService.newCardSection()
      .addWidget(CardService.newTextParagraph().setText("Text paragraph")))
    .build()

const cardWithId = CardService.newCardWithId().setCardId("card_one").setCard(card)

const message = AddOnsResponseService.newChatMessage().addCardWithId(cardWithId)

const chatDataAction = AddOnsResponseService.newChatDataActionBuilder()
    .setCreateChatMessageAction(AddOnsResponseService.newCreateMessageAction()
    .setMessage(message))
    .build()

Параметры

Имя Тип Описание
create Message Action Create Message Action Действие создания сообщения, которое следует использовать.

Возвращаться

Chat Data Actions Response Builder — этот объект используется для создания цепочек сообщений.


set Update Chat Message Action(updateMessageAction)

Задает Update Message Action для Data Actions Response .

const card = CardService.newCardBuilder()
    .setHeader(CardService.newCardHeader().setTitle("Card Title"))
    .addSection(CardService.newCardSection()
      .addWidget(CardService.newTextParagraph().setText("Text paragraph")))
    .build()

const cardWithId = CardService.newCardWithId().setCardId("card_one").setCard(card)

const message = AddOnsResponseService.newChatMessage().addCardWithId(cardWithId)

const chatDataAction = AddOnsResponseService.newChatDataActionBuilder()
    .setUpdateChatMessageAction(AddOnsResponseService.newUpdateMessageAction()
    .setMessage(message))
    .build()

Параметры

Имя Тип Описание
update Message Action Update Message Action Действие обновления сообщения, которое следует использовать.

Возвращаться

Chat Data Actions Response Builder — этот объект используется для создания цепочек сообщений.


set Update Inline Preview Action(updateInlinePreviewAction)

Устанавливает Update Inline Preview Action для Data Actions Response .

const card = CardService.newCardBuilder()
    .setHeader(CardService.newCardHeader().setTitle("Unfurl Card!"))
    .addSection(CardService.newCardSection()
      .addWidget(CardService.newTextParagraph().setText("url"))
      .addWidget(CardService.newButtonSet()
        .addButton(CardService.newTextButton()
          .setText("Open URL!")
          .setOpenLink(CardService.newOpenLink().setUrl("https://www.google.com")))))
    .build();

const cardWithId = CardService.newCardWithId().setCardId("card_one").setCard(card);

const chatDataAction = AddOnsResponseService.newChatDataActionBuilder()
    .setUpdateInlinePreviewAction(AddOnsResponseService.newUpdateInlinePreviewAction()
    .addCardWithId(cardWithId))
    .build();

Параметры

Имя Тип Описание
update Inline Preview Action Update Inline Preview Action Для использования функции предварительного просмотра обновления.

Возвращаться

Chat Data Actions Response Builder — этот объект используется для создания цепочек сообщений.