Class Config
使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
配置
包含连接器的配置条目。这些配置条目用于定义在添加新连接器时系统会询问哪些问题。
const cc = DataStudioApp.createCommunityConnector();
const config = cc.getConfig();
const info_entry = config.newInfo().setId('info_id').setHelpText(
'This connector can connect to multiple data endpoints.');
详细文档
build()
验证此对象,并以数据分析所需的格式返回该对象。
返回
Object
- 经过验证的 Config
对象。
newInfo()
返回新的 info 配置条目。
返回
Info
- 新的 info 配置条目。
printJson()
输出此对象的 JSON 表示法。这仅用于调试。
返回
String
setDateRangeRequired(dateRangeRequired)
如果为 true
,则需要为 getData() 请求提供日期范围。
参数
名称 | 类型 | 说明 |
dateRangeRequired | Boolean | 是否应向 getData() 请求提供日期范围。 |
返回
Config
- 此构建器,用于链式调用。
setIsSteppedConfig(isSteppedConfig)
如果为 true
,则使用当前用户配置再次调用 getConfig()
。
参数
名称 | 类型 | 说明 |
isSteppedConfig | Boolean | 要设置的分级配置状态。 |
返回
Config
- 此构建器,用于链式调用。
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2025-07-26。
[null,null,["最后更新时间 (UTC):2025-07-26。"],[[["\u003cp\u003eThe \u003ccode\u003eConfig\u003c/code\u003e object defines the configuration entries for a connector, determining the questions asked when adding a new connector.\u003c/p\u003e\n"],["\u003cp\u003eIt provides methods for creating various configuration entry types like checkboxes, text inputs, and select lists.\u003c/p\u003e\n"],["\u003cp\u003eThe \u003ccode\u003ebuild()\u003c/code\u003e method validates the configuration and returns it in the required format for Data Studio.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003esetDateRangeRequired()\u003c/code\u003e and \u003ccode\u003esetIsSteppedConfig()\u003c/code\u003e methods control whether a date range is provided to data requests and if the configuration is stepped.\u003c/p\u003e\n"],["\u003cp\u003eIt offers methods such as \u003ccode\u003eprintJson()\u003c/code\u003e for debugging purposes.\u003c/p\u003e\n"]]],[],null,["# Class Config\n\nConfig\n\nContains the configuration entries for a connector. These configuration entries define what\nquestions are asked when adding a new connector.\n\n```javascript\nconst cc = DataStudioApp.createCommunityConnector();\nconst config = cc.getConfig();\n\nconst info_entry = config.newInfo().setId('info_id').setHelpText(\n 'This connector can connect to multiple data endpoints.');\n``` \n\n### Methods\n\n| Method | Return type | Brief description |\n|---------------------------------------------------------------------------|----------------------------------------------------------------------|---------------------------------------------------------------------------------|\n| [build()](#build()) | `Object` | Validates this object and returns it in the format needed by Data Studio. |\n| [newCheckbox()](#newCheckbox()) | [Checkbox](/apps-script/reference/data-studio/checkbox) | Returns a new checkbox configuration entry. |\n| [newInfo()](#newInfo()) | [Info](/apps-script/reference/data-studio/info) | Returns a new info configuration entry. |\n| [newOptionBuilder()](#newOptionBuilder()) | [OptionBuilder](/apps-script/reference/data-studio/option-builder) | Returns a new options builder. |\n| [newSelectMultiple()](#newSelectMultiple()) | [SelectMultiple](/apps-script/reference/data-studio/select-multiple) | Returns a new select multiple configuration entry. |\n| [newSelectSingle()](#newSelectSingle()) | [SelectSingle](/apps-script/reference/data-studio/select-single) | Returns a new select single configuration entry. |\n| [newTextArea()](#newTextArea()) | [TextArea](/apps-script/reference/data-studio/text-area) | Returns a new text area configuration entry. |\n| [newTextInput()](#newTextInput()) | [TextInput](/apps-script/reference/data-studio/text-input) | Returns a new text input configuration entry. |\n| [printJson()](#printJson()) | `String` | Prints the JSON representation of this object. |\n| [setDateRangeRequired(dateRangeRequired)](#setDateRangeRequired(Boolean)) | [Config](#) | If `true`, a date range is provided for getData() requests. |\n| [setIsSteppedConfig(isSteppedConfig)](#setIsSteppedConfig(Boolean)) | [Config](#) | If `true`, `get``Config()` is called again with the current user configuration. |\n\nDetailed documentation\n----------------------\n\n### `build()`\n\nValidates this object and returns it in the format needed by Data Studio.\n\n#### Return\n\n\n`Object` --- The validated [Config](#) object.\n\n*** ** * ** ***\n\n### `new``Checkbox()`\n\nReturns a new checkbox configuration entry.\n\n#### Return\n\n\n[Checkbox](/apps-script/reference/data-studio/checkbox) --- A new checkbox configuration entry.\n\n*** ** * ** ***\n\n### `new``Info()`\n\nReturns a new info configuration entry.\n\n#### Return\n\n\n[Info](/apps-script/reference/data-studio/info) --- A new info configuration entry.\n\n*** ** * ** ***\n\n### `new``Option``Builder()`\n\nReturns a new options builder.\n\n#### Return\n\n\n[OptionBuilder](/apps-script/reference/data-studio/option-builder) --- A new options builder.\n\n*** ** * ** ***\n\n### `new``Select``Multiple()`\n\nReturns a new select multiple configuration entry.\n\n#### Return\n\n\n[SelectMultiple](/apps-script/reference/data-studio/select-multiple) --- A new select multiple configuration entry.\n\n*** ** * ** ***\n\n### `new``Select``Single()`\n\nReturns a new select single configuration entry.\n\n#### Return\n\n\n[SelectSingle](/apps-script/reference/data-studio/select-single) --- A new select single configuration entry.\n\n*** ** * ** ***\n\n### `new``Text``Area()`\n\nReturns a new text area configuration entry.\n\n#### Return\n\n\n[TextArea](/apps-script/reference/data-studio/text-area) --- A new text area configuration entry.\n\n*** ** * ** ***\n\n### `new``Text``Input()`\n\nReturns a new text input configuration entry.\n\n#### Return\n\n\n[TextInput](/apps-script/reference/data-studio/text-input) --- A new text input configuration entry.\n\n*** ** * ** ***\n\n### `print``Json()`\n\nPrints the JSON representation of this object. This is for debugging only.\n\n#### Return\n\n\n`String`\n\n*** ** * ** ***\n\n### `set``Date``Range``Required(dateRangeRequired)`\n\nIf `true`, a date range is provided for getData() requests.\n\n#### Parameters\n\n| Name | Type | Description |\n|-------------------------|-----------|---------------------------------------------------------------------------|\n| `date``Range``Required` | `Boolean` | Whether or not a date range should be provided to `get``Data()` requests. |\n\n#### Return\n\n\n[Config](#) --- This builder, for chaining.\n\n*** ** * ** ***\n\n### `set``Is``Stepped``Config(isSteppedConfig)`\n\nIf `true`, `get``Config()` is called again with the current user configuration.\n\n#### Parameters\n\n| Name | Type | Description |\n|-----------------------|-----------|-----------------------------------|\n| `is``Stepped``Config` | `Boolean` | The stepped config status to set. |\n\n#### Return\n\n\n[Config](#) --- This builder, for chaining."]]