Class ActionResponseBuilder

ActionResponseBuilder

ActionResponse 物件的建構工具。

適用於 Google Workspace 外掛程式。

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

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

const action = AddOnsResponseService.newActionResponseBuilder()
    .setNavigation(navigation)
    .setNotification(notification)
    .build();

方法

方法傳回類型簡短說明
addModifyCard(modifyCard)ActionResponseBuilder將修改資訊卡作業設為動作。
build()ActionResponse建構並驗證目前動作的回覆。
setLinkPreview(linkPreview)ActionResponseBuilder將 LinkPreview 設為動作。
setNavigation(navigation)ActionResponseBuilder設定對 Navigation 動作的回應。
setNotification(notification)ActionResponseBuilder設定動作啟動時顯示的通知。
setOpenLink(openLink)ActionResponseBuilder設定啟用動作時要前往的網址。
setStateChanged(stateChanged)ActionResponseBuilder設定旗標,指出這項動作變更了現有資料狀態。

內容詳盡的說明文件

addModifyCard(modifyCard)

將修改資訊卡作業設為動作。

參數

名稱類型說明
modifyCardModifyCard要使用的 ModifyCard

回攻員

ActionResponseBuilder - 這個物件,用於鏈結。


build()

建構並驗證目前動作的回覆。

回攻員

ActionResponse:經過驗證的 ActionResponse。

擲回

Error - 如果建構的動作回應無效。


setLinkPreview(linkPreview)

將 LinkPreview 設為動作。

參數

名稱類型說明
linkPreviewLinkPreview要使用的 LinkPreview

回攻員

ActionResponseBuilder - 這個物件,用於鏈結。


setNavigation(navigation)

設定對 Navigation 動作的回應。

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

const action = AddOnsResponseService.newActionResponseBuilder()
    .setNavigation(navigation)
    .build();

參數

名稱類型說明
navigationNavigation要使用的 Navigation

回攻員

ActionResponseBuilder - 這個物件,用於鏈結。


setNotification(notification)

設定在啟用動作時顯示的通知。

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

const action = AddOnsResponseService.newActionResponseBuilder()
    .setNotification(notification)
    .build();

參數

名稱類型說明
notificationNotification要使用的 Notification

回攻員

ActionResponseBuilder - 這個物件,用於鏈結。


設定啟用動作時要前往的網址。

參數

名稱類型說明
openLinkOpenLink要使用的 OpenLink

回攻員

ActionResponseBuilder - 這個物件,用於鏈結。


setStateChanged(stateChanged)

設定標記,指出這項動作變更了現有資料狀態。舉例來說,如果動作是建立工作或更新聯絡資訊,如果這個旗標設為 true,Gmail 等服務可以嘗試清除與這項動作相關聯的任何快取狀態資料。

參數

名稱類型說明
stateChangedBoolean這項動作是否已變更現有的狀態資料。預設值為 false

回攻員

ActionResponseBuilder - 這個物件,用於鏈結。