Class SuggestionsResponseBuilder
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
详细文档
setSuggestions(suggestions)
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-07-26。
[null,null,["最后更新时间 (UTC):2025-07-26。"],[[["\u003cp\u003e\u003ccode\u003eSuggestionsResponseBuilder\u003c/code\u003e helps create suggestion responses for auto-complete in Google Workspace Add-ons and Google Chat apps.\u003c/p\u003e\n"],["\u003cp\u003eIt provides methods to set suggestions and build the response object.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003ebuild()\u003c/code\u003e method creates the final response and validates it, while \u003ccode\u003esetSuggestions()\u003c/code\u003e adds the desired suggestions.\u003c/p\u003e\n"],["\u003cp\u003eCalling \u003ccode\u003ebuild()\u003c/code\u003e without setting suggestions might result in an error, ensuring the response's validity.\u003c/p\u003e\n"]]],[],null,["# Class SuggestionsResponseBuilder\n\nSuggestionsResponseBuilder\n\nA builder for [SuggestionsResponse](/apps-script/reference/card-service/suggestions-response) objects.\n\nAvailable for Google Workspace add-ons and Google Chat apps. \n\n### Methods\n\n| Method | Return type | Brief description |\n|-------------------------------------------------------------|---------------------------------------------------------------------------------|------------------------------------------------------------|\n| [build()](#build()) | [SuggestionsResponse](/apps-script/reference/card-service/suggestions-response) | Builds the current suggestions response and validates it. |\n| [setSuggestions(suggestions)](#setSuggestions(Suggestions)) | [SuggestionsResponseBuilder](#) | Sets the suggestions used in auto complete in text fields. |\n\nDetailed documentation\n----------------------\n\n### `build()`\n\nBuilds the current suggestions response and validates it.\n\n#### Return\n\n\n[SuggestionsResponse](/apps-script/reference/card-service/suggestions-response) --- A validated SuggestionsResponse.\n\n#### Throws\n\n\n[`Error`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error) --- if the constructed suggestions response isn't valid.\n\n*** ** * ** ***\n\n### `set``Suggestions(suggestions)`\n\nSets the suggestions used in auto complete in text fields.\n\n#### Parameters\n\n| Name | Type | Description |\n|---------------|----------------------------------------------------------------|----------------------------------------------------------------------------|\n| `suggestions` | [Suggestions](/apps-script/reference/card-service/suggestions) | The [Suggestions](/apps-script/reference/card-service/suggestions) to use. |\n\n#### Return\n\n\n[SuggestionsResponseBuilder](#) --- This object."]]