Class AddOnsResponseService

Служба обработки запросов на дополнительные услуги

Add Ons Response Service позволяет создавать ответы для дополнений Google Workspace.

Пример использования:

function myFunction() {
  return AddOnsResponseService.newChatDataActionBuilder();
}

В следующем примере показано, как приложение чата отвечает диалоговым окном:

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

const actionResponse = AddOnsResponseService.newActionResponseBuilder()
    .setNavigation(AddOnsResponseService.newNavigation().pushCard(card))
    .build();

В следующем примере показано, как приложение чата отвечает карточкой предварительного просмотра ссылки:

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();

Характеристики

Свойство Тип Описание
Addon Compose Ui Action Type Addon Compose Ui Action Type Перечисление Addon Compose Ui Action Type .
Composed Email Type Composed Email Type Перечисление Composed Email Type .
Content Type Content Type Перечисление Content Type .
End Navigation End Navigation Перечисление End Navigation .
On Close On Close Перечисление « On Close .
Open As Open As Перечисление Open As .
Send Status Send Status Перечисление Send Status .
Update Draft Body Type Update Draft Body Type Перечисление Update Draft Body Type .

Методы

Метод Тип возвращаемого значения Краткое описание
new Accessory Widget() Accessory Widget Создает новый Accessory Widget .
new Action() Action Создает новое Action .
new Action Response Builder() Action Response Builder Создает Action Response Builder .
new Addon Compose Ui Action Response Builder() Addon Compose Ui Action Response Builder Создает Addon Compose Ui Action Response Builder .
new Attachment() Attachment Создает Attachment .
new Calendar Event Action Response Builder() Calendar Event Action Response Builder Создает Calendar Event Action Response Builder .
new Chat Data Action Builder() Chat Data Actions Response Builder Создает Chat Data Actions Response Builder .
new Chat Message() Chat Message Создает Chat Message .
new Compose Action Response Builder() Compose Action Response Builder Создает Compose Action Response Builder .
new Create Message Action() Create Message Action Создает Create Message Action .
new Drive Items Selected Action Response Builder() Drive Items Selected Action Response Builder Создает Drive Items Selected Action Response Builder .
new Editor File Scope Action Response Builder() Editor File Scope Action Response Builder Создает Editor File Scope Action Response Builder .
new Link Preview() Link Preview Создает Link Preview .
new Navigation() Navigation Создает Navigation .
new Notification() Notification Создает Notification .
new Open Link() Open Link Создает Open Link .
new Render Action Builder() Render Action Builder Создает новый Render Action Builder .
new Universal Action Response Builder() Universal Action Response Builder Создает Universal Action Response Builder .
new Update Draft Action Response Builder() Update Draft Action Response Builder Создает Update Draft Action Response Builder .
new Update Draft Bcc Recipients Action() Update Draft Bcc Recipients Action Создает Update Draft Bcc Recipients Action »;
new Update Draft Body Action() Update Draft Body Action Создает Update Draft Body Action .
new Update Draft Cc Recipients Action() Update Draft Cc Recipients Action Создает Update Draft Cc Recipients Action .
new Update Draft Subject Action() Update Draft Subject Action Создает Update Draft Subject Action .
new Update Draft To Recipients Action() Update Draft To Recipients Action Создает Update Draft To Recipients Action .
new Update Inline Preview Action() Update Inline Preview Action Создает Update Inline Preview Action .
new Update Message Action() Update Message Action Создает Update Message Action .

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

new Accessory Widget()

Создает новый Accessory Widget .

const widget = CardService.newButtonSet()
    .addButton(CardService.newImageButton()
      .setIcon(CardService.Icon.PHONE)
      .setOnClickAction(CardService.newAction()
        .setFunctionName("phone")))
    .addButton(CardService.newTextButton()
      .setText("Robot")
      .setIconUrl("https://developers.google.com/chat/images/quickstart-app-avatar.png")
      .setOnClickAction(CardService.newAction()
        .setFunctionName("robot")));

const accessoryWidget = AddOnsResponseService.newAccessoryWidget()
    .addWidget(widget);

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

Accessory Widget — пустой AccessoryWidget.


new Action()

Создает новое Action .

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

Action — пустое действие.


new Action Response Builder()

Создает Action Response Builder .

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

const actionResponse = AddOnsResponseService.newActionResponseBuilder()
    .setNavigation(AddOnsResponseService.newNavigation().pushCard(card))
    .build();

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

Action Response Builder — пустой конструктор ответов действий.


new Addon Compose Ui Action Response Builder()

Создает Addon Compose Ui Action Response Builder .

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

Addon Compose Ui Action Response Builder — Пустой объект AddonComposeUiActionResponseBuilder.


new Attachment()

Создает Attachment .

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

Attachment — Пустое вложение.


new Calendar Event Action Response Builder()


new Chat Data Action Builder()

Создает Chat Data Actions Response Builder .

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();

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

Chat Data Actions Response Builder — пустой конструктор AddOnsResponse.


new Chat Message()

Создает Chat Message .

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);

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

Chat Message — Пустое сообщение чата.


new Compose Action Response Builder()

Создает Compose Action Response Builder .

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

Compose Action Response Builder — пустой конструктор ComposeActionResponse.


new Create Message Action()

Создает Create Message Action .

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 — пустой объект CreateMessageAction.


new Drive Items Selected Action Response Builder()


new Editor File Scope Action Response Builder()


new Link Preview()

Создает Link Preview .

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

Link Preview — Пустой предварительный просмотр ссылки.


new Navigation()

Создает Navigation .

const card = CardService.newCardBuilder()
    .setHeader(CardService.newCardHeader().setTitle('Card title'))
    .addSection(cardSection)
    .build();

const navigation = AddOnsResponseService.newNavigation()
    .pushCard(card);

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

Navigation — Пустая навигация.


new Notification()

Создает Notification .

const notification = AddOnsResponseService.newNotification().setText("You closed a dialog!");

const navigation = AddOnsResponseService.newNavigation()
    .setEndNavigation(AddOnsResponseService.EndNavigation.CLOSE_DIALOG);

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

Notification — Пустое уведомление.


Создает Open Link .

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

Open Link — Пустая ссылка OpenLink.


new Render Action Builder()

Создает новый Render Action Builder .

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

Render Action Builder — пустой объект RenderActionBuilder.


new Universal Action Response Builder()

Создает Universal Action Response Builder .

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

Universal Action Response Builder — пустой конструктор UniversalActionResponse.


new Update Draft Action Response Builder()

Создает Update Draft Action Response Builder .

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

Update Draft Action Response Builder — пустой объект UpdateDraftActionResponseBuilder.


new Update Draft Bcc Recipients Action()

Создает Update Draft Bcc Recipients Action »;

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

Update Draft Bcc Recipients Action — пустое значение действия UpdateDraftBccRecipientsAction.


new Update Draft Body Action()

Создает Update Draft Body Action .

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

Update Draft Body Action UpdateDraftBodyAction.


new Update Draft Cc Recipients Action()

Создает Update Draft Cc Recipients Action .

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

Update Draft Cc Recipients Action — пустой объект UpdateDraftCcRecipientsAction.


new Update Draft Subject Action()

Создает Update Draft Subject Action .

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

Update Draft Subject Action — Пустое значение UpdateDraftSubjectAction.


new Update Draft To Recipients Action()

Создает Update Draft To Recipients Action .

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

Update Draft To Recipients Action — пустой объект UpdateDraftToRecipientsAction.


new Update Inline Preview Action()

Создает Update Inline Preview Action .

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 UpdateInlinePreviewAction.


new Update Message Action()

Создает Update Message Action .

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 — Пустой объект UpdateMessageAction.