Class UniversalActionResponseBuilder
จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ
เอกสารประกอบโดยละเอียด
build()
สร้างการตอบสนองการดําเนินการแบบสากลปัจจุบันและตรวจสอบ
รีเทิร์น
UniversalActionResponse
— UniversalActionResponse ที่ตรวจสอบแล้ว
โยน
Error
— หากการตอบกลับการดําเนินการแบบ Universal ที่สร้างขึ้นไม่ถูกต้อง
displayAddOnCards(cardObjects)
แสดงส่วนเสริมที่มีการ์ดที่ระบุ
พารามิเตอร์
ชื่อ | ประเภท | คำอธิบาย |
cardObjects | Object[] | อาร์เรย์ของ Card ที่จะแสดง |
รีเทิร์น
UniversalActionResponseBuilder
— ออบเจ็กต์นี้สําหรับการต่อเชื่อม
setOpenLink(openLink)
ตั้งค่า URL ให้เปิดเมื่อเลือกการดำเนินการแบบสากล
พารามิเตอร์
ชื่อ | ประเภท | คำอธิบาย |
openLink | OpenLink | ออบเจ็กต์ลิงก์ที่จะใช้ |
รีเทิร์น
UniversalActionResponseBuilder
— ออบเจ็กต์นี้สําหรับการต่อเชื่อม
เนื้อหาของหน้าเว็บนี้ได้รับอนุญาตภายใต้ใบอนุญาตที่ต้องระบุที่มาของครีเอทีฟคอมมอนส์ 4.0 และตัวอย่างโค้ดได้รับอนุญาตภายใต้ใบอนุญาต Apache 2.0 เว้นแต่จะระบุไว้เป็นอย่างอื่น โปรดดูรายละเอียดที่นโยบายเว็บไซต์ Google Developers Java เป็นเครื่องหมายการค้าจดทะเบียนของ Oracle และ/หรือบริษัทในเครือ
อัปเดตล่าสุด 2025-07-26 UTC
[null,null,["อัปเดตล่าสุด 2025-07-26 UTC"],[[["\u003cp\u003eUniversalActionResponseBuilder facilitates constructing UniversalActionResponse objects for handling user actions within Google Workspace add-ons.\u003c/p\u003e\n"],["\u003cp\u003eIt provides methods to define the response behavior, including displaying add-on cards (\u003ccode\u003edisplayAddOnCards\u003c/code\u003e) or opening URLs (\u003ccode\u003esetOpenLink\u003c/code\u003e).\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003ebuild()\u003c/code\u003e method finalizes and validates the response configuration.\u003c/p\u003e\n"]]],["The `UniversalActionResponseBuilder` constructs `UniversalActionResponse` objects. Key actions include: `build()`, which creates and validates the response, returning a `UniversalActionResponse`. `displayAddOnCards(cardObjects)` presents the add-on with provided `Card` objects, and `setOpenLink(openLink)` defines a URL that opens upon universal action selection, using an `OpenLink` object. Both `displayAddOnCards` and `setOpenLink` allow for method chaining. The `build()` method can throw an `Error` if the created object is not valid.\n"],null,["# Class UniversalActionResponseBuilder\n\nUniversalActionResponseBuilder\n\nA builder for the [UniversalActionResponse](/apps-script/reference/card-service/universal-action-response) objects. \n\n### Methods\n\n| Method | Return type | Brief description |\n|--------------------------------------------------------------|------------------------------------------------------------------------------------------|----------------------------------------------------------------|\n| [build()](#build()) | [UniversalActionResponse](/apps-script/reference/card-service/universal-action-response) | Builds the current universal action response and validates it. |\n| [displayAddOnCards(cardObjects)](#displayAddOnCards(Object)) | [UniversalActionResponseBuilder](#) | Displays the add-on with the specified cards. |\n| [setOpenLink(openLink)](#setOpenLink(OpenLink)) | [UniversalActionResponseBuilder](#) | Sets the URL to open when the universal action is selected. |\n\nDetailed documentation\n----------------------\n\n### `build()`\n\nBuilds the current universal action response and validates it.\n\n#### Return\n\n\n[UniversalActionResponse](/apps-script/reference/card-service/universal-action-response) --- A validated UniversalActionResponse.\n\n#### Throws\n\n\n[`Error`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error) --- if the constructed universal action response isn't valid.\n\n*** ** * ** ***\n\n### `display``Add``On``Cards(cardObjects)`\n\nDisplays the add-on with the specified cards.\n\n#### Parameters\n\n| Name | Type | Description |\n|-----------------|------------|---------------------------------------------------------------------------|\n| `card``Objects` | `Object[]` | An array of [Card](/apps-script/reference/card-service/card)s to display. |\n\n#### Return\n\n\n[UniversalActionResponseBuilder](#) --- This object, for chaining.\n\n*** ** * ** ***\n\n### `set``Open``Link(openLink)`\n\nSets the URL to open when the universal action is selected.\n\n#### Parameters\n\n| Name | Type | Description |\n|--------------|-----------------------------------------------------------|-------------------------|\n| `open``Link` | [OpenLink](/apps-script/reference/card-service/open-link) | The link object to use. |\n\n#### Return\n\n\n[UniversalActionResponseBuilder](#) --- This object, for chaining."]]