Class CommunityConnector
จัดทุกอย่างให้เป็นระเบียบอยู่เสมอด้วยคอลเล็กชัน
บันทึกและจัดหมวดหมู่เนื้อหาตามค่ากำหนดของคุณ
CommunityConnector
เครื่องมือเชื่อมต่อชุมชนช่วยให้สคริปต์เข้าถึงเครื่องมือสร้างและยูทิลิตีเพื่อช่วยในการพัฒนาเครื่องมือเชื่อมต่อชุมชนสําหรับ Data Studio ได้ ใช้คลาสนี้เพื่อรับการอ้างอิงไปยังออบเจ็กต์ Fields
และอนุกรม FieldType
และ AggregationType
เพื่อให้นำไปใช้ในการสร้าง Field
ได้
const cc = DataStudioApp.createCommunityConnector();
const fields = cc.getFields();
fields.newMetric()
.setAggregation(cc.AggregationType.AVG)
.setType(cc.FieldType.CURRENCY_USD);
เอกสารประกอบโดยละเอียด
getConfig()
แสดงผลออบเจ็กต์ Config
ใช้ออบเจ็กต์นี้เพื่อเพิ่มรายการการกําหนดค่า
รีเทิร์น
Config
— ออบเจ็กต์ Config
newSetCredentialsResponse()
เนื้อหาของหน้าเว็บนี้ได้รับอนุญาตภายใต้ใบอนุญาตที่ต้องระบุที่มาของครีเอทีฟคอมมอนส์ 4.0 และตัวอย่างโค้ดได้รับอนุญาตภายใต้ใบอนุญาต Apache 2.0 เว้นแต่จะระบุไว้เป็นอย่างอื่น โปรดดูรายละเอียดที่นโยบายเว็บไซต์ Google Developers Java เป็นเครื่องหมายการค้าจดทะเบียนของ Oracle และ/หรือบริษัทในเครือ
อัปเดตล่าสุด 2025-07-26 UTC
[null,null,["อัปเดตล่าสุด 2025-07-26 UTC"],[[["\u003cp\u003eThe \u003ccode\u003eCommunityConnector\u003c/code\u003e class enables scripts to access builders and utilities for developing Community Connectors for Data Studio.\u003c/p\u003e\n"],["\u003cp\u003eIt provides access to \u003ccode\u003eFields\u003c/code\u003e, \u003ccode\u003eFieldType\u003c/code\u003e, and \u003ccode\u003eAggregationType\u003c/code\u003e for constructing \u003ccode\u003eField\u003c/code\u003e objects within your connector.\u003c/p\u003e\n"],["\u003cp\u003e\u003ccode\u003eCommunityConnector\u003c/code\u003e offers methods to manage configurations, define data schemas, handle authentication, and create response objects for various connector functions.\u003c/p\u003e\n"],["\u003cp\u003eIt also allows the creation of user and debug errors for better error handling within your connector.\u003c/p\u003e\n"],["\u003cp\u003eDevelopers can utilize methods like \u003ccode\u003egetConfig()\u003c/code\u003e, \u003ccode\u003egetFields()\u003c/code\u003e, and response builders such as \u003ccode\u003enewGetDataResponse()\u003c/code\u003e to interact with and control the connector's behavior.\u003c/p\u003e\n"]]],[],null,["# Class CommunityConnector\n\nCommunityConnector\n\nCommunityConnector enables scripts to access builders and utilities to help with development of\nCommunity Connectors for Data Studio. Use this class to get a reference to the [Fields](/apps-script/reference/data-studio/fields)\nobject and the [FieldType](/apps-script/reference/data-studio/field-type) and [AggregationType](/apps-script/reference/data-studio/aggregation-type) enums so they can be used in the\nconstruction of [Field](/apps-script/reference/data-studio/field)s.\n\n```javascript\nconst cc = DataStudioApp.createCommunityConnector();\n\nconst fields = cc.getFields();\n\nfields.newMetric()\n .setAggregation(cc.AggregationType.AVG)\n .setType(cc.FieldType.CURRENCY_USD);\n``` \n\n### Properties\n\n| Property | Type | Description |\n|-------------------------------|--------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------|\n| `Aggregation``Type` | [AggregationType](/apps-script/reference/data-studio/aggregation-type) | The [AggregationType](/apps-script/reference/data-studio/aggregation-type) enumeration. |\n| `Auth``Type` | [AuthType](/apps-script/reference/data-studio/auth-type) | The [AuthType](/apps-script/reference/data-studio/auth-type) enumeration. |\n| `Big``Query``Parameter``Type` | [BigQueryParameterType](/apps-script/reference/data-studio/big-query-parameter-type) | The [BigQueryParameterType](/apps-script/reference/data-studio/big-query-parameter-type) enumeration. |\n| `Field``Type` | [FieldType](/apps-script/reference/data-studio/field-type) | The [FieldType](/apps-script/reference/data-studio/field-type) enumeration. |\n\n### Methods\n\n| Method | Return type | Brief description |\n|-------------------------------------------------------------|---------------------------------------------------------------------------------------|-------------------------------------------------------------------------------------------------------------|\n| [getConfig()](#getConfig()) | [Config](/apps-script/reference/data-studio/config) | Returns a [Config](/apps-script/reference/data-studio/config) object. |\n| [getFields()](#getFields()) | [Fields](/apps-script/reference/data-studio/fields) | Returns a [Fields](/apps-script/reference/data-studio/fields) object. |\n| [newAuthTypeResponse()](#newAuthTypeResponse()) | [GetAuthTypeResponse](/apps-script/reference/data-studio/get-auth-type-response) | Returns a new [GetAuthTypeResponse](/apps-script/reference/data-studio/get-auth-type-response) object. |\n| [newBigQueryConfig()](#newBigQueryConfig()) | [BigQueryConfig](/apps-script/reference/data-studio/big-query-config) | Returns a new [BigQueryConfig](/apps-script/reference/data-studio/big-query-config) object. |\n| [newDebugError()](#newDebugError()) | [DebugError](/apps-script/reference/data-studio/debug-error) | Returns a new [DebugError](/apps-script/reference/data-studio/debug-error) object. |\n| [newGetDataResponse()](#newGetDataResponse()) | [GetDataResponse](/apps-script/reference/data-studio/get-data-response) | Returns a new [GetDataResponse](/apps-script/reference/data-studio/get-data-response) object. |\n| [newGetSchemaResponse()](#newGetSchemaResponse()) | [GetSchemaResponse](/apps-script/reference/data-studio/get-schema-response) | Returns a new [GetSchemaResponse](/apps-script/reference/data-studio/get-schema-response) object. |\n| [newSetCredentialsResponse()](#newSetCredentialsResponse()) | [SetCredentialsResponse](/apps-script/reference/data-studio/set-credentials-response) | Returns a new [SetCredentialsResponse](/apps-script/reference/data-studio/set-credentials-response) object. |\n| [newUserError()](#newUserError()) | [UserError](/apps-script/reference/data-studio/user-error) | Returns a new [UserError](/apps-script/reference/data-studio/user-error) object. |\n\nDetailed documentation\n----------------------\n\n### `get``Config()`\n\nReturns a [Config](/apps-script/reference/data-studio/config) object. Use this object to add configuration entries.\n\n#### Return\n\n\n[Config](/apps-script/reference/data-studio/config) --- A [Config](/apps-script/reference/data-studio/config) object.\n\n*** ** * ** ***\n\n### `get``Fields()`\n\nReturns a [Fields](/apps-script/reference/data-studio/fields) object. Use this object to add metric and dimension [Field](/apps-script/reference/data-studio/field)s.\n\n#### Return\n\n\n[Fields](/apps-script/reference/data-studio/fields) --- A [Fields](/apps-script/reference/data-studio/fields) object.\n\n*** ** * ** ***\n\n### `new``Auth``Type``Response()`\n\nReturns a new [GetAuthTypeResponse](/apps-script/reference/data-studio/get-auth-type-response) object. Use this object to create a response for the\n`get``Auth``Type()` function you implement in your script project.\n\n#### Return\n\n\n[GetAuthTypeResponse](/apps-script/reference/data-studio/get-auth-type-response) --- A new [GetAuthTypeResponse](/apps-script/reference/data-studio/get-auth-type-response) object.\n\n*** ** * ** ***\n\n### `new``Big``Query``Config()`\n\nReturns a new [BigQueryConfig](/apps-script/reference/data-studio/big-query-config) object. Use this object to create a response for the\n`get``Data()` function you implement in your script project.\n\n#### Return\n\n\n[BigQueryConfig](/apps-script/reference/data-studio/big-query-config) --- A new [BigQueryConfig](/apps-script/reference/data-studio/big-query-config) object.\n\n*** ** * ** ***\n\n### `new``Debug``Error()`\n\nReturns a new [DebugError](/apps-script/reference/data-studio/debug-error) object. Use this object to create debug errors.\n\n#### Return\n\n\n[DebugError](/apps-script/reference/data-studio/debug-error) --- A new [DebugError](/apps-script/reference/data-studio/debug-error) object.\n\n*** ** * ** ***\n\n### `new``Get``Data``Response()`\n\nReturns a new [GetDataResponse](/apps-script/reference/data-studio/get-data-response) object. Use this object to create a response for the\n`get``Data()` function you implement in your script project.\n\n#### Return\n\n\n[GetDataResponse](/apps-script/reference/data-studio/get-data-response) --- A new [GetDataResponse](/apps-script/reference/data-studio/get-data-response) object.\n\n*** ** * ** ***\n\n### `new``Get``Schema``Response()`\n\nReturns a new [GetSchemaResponse](/apps-script/reference/data-studio/get-schema-response) object. Use this object to create a response for the\n`get``Schema()` function you implement in your script project.\n\n#### Return\n\n\n[GetSchemaResponse](/apps-script/reference/data-studio/get-schema-response) --- A new [GetSchemaResponse](/apps-script/reference/data-studio/get-schema-response) object.\n\n*** ** * ** ***\n\n### `new``Set``Credentials``Response()`\n\nReturns a new [SetCredentialsResponse](/apps-script/reference/data-studio/set-credentials-response) object. Use this object to create a response for\nthe `set``Credentials()` function you implement in your script project.\n\n#### Return\n\n\n[SetCredentialsResponse](/apps-script/reference/data-studio/set-credentials-response) --- A new [SetCredentialsResponse](/apps-script/reference/data-studio/set-credentials-response) object.\n\n*** ** * ** ***\n\n### `new``User``Error()`\n\nReturns a new [UserError](/apps-script/reference/data-studio/user-error) object. Use this object to create user errors.\n\n#### Return\n\n\n[UserError](/apps-script/reference/data-studio/user-error) --- A new [UserError](/apps-script/reference/data-studio/user-error) object."]]