# Data Studio Service

Data Studio

This service allows scripts to access and modify Data Studio
[Community
Connectors](https://developers.google.com/datastudio/connector/get-started).

## Classes

| Name | Brief description |
|---|---|
| `AggregationType` | An enum that defines the aggregation types that can be set for a `Field`. |
| `AuthType` | An enum that defines the authentication types that can be set for a connector. |
| `BigQueryConfig` | A configuration object for a native BigQuery connector. |
| `BigQueryParameterType` | An enum that defines the BigQuery parameter types that you can set. |
| `Checkbox` | Contains checkbox information for the config. |
| `CommunityConnector` | CommunityConnector enables scripts to access builders and utilities to help with development of Community Connectors for Data Studio. |
| `Config` | Contains the configuration entries for a connector. |
| `DataStudioApp` | DataStudioApp allows scripts to interact with developer-oriented features for Data Studio. |
| `DebugError` | An error that is only visible to admins of the connector. |
| `Field` | Contains field-related data. |
| `FieldType` | An enum that defines the types that can be set for a `Field`. |
| `Fields` | Contains a set of `Field`s for a community connector. |
| `GetAuthTypeResponse` | Builder to create a `getAuthType()` response for your script project. |
| `GetDataResponse` | Builder to create a `getData()` response for your script project. |
| `GetSchemaResponse` | Builder to create a `getSchema()` response for your script project. |
| `Info` | Contains info data for the config. |
| `OptionBuilder` | A builder for creating options for `SelectSingle`s and `SelectMultiple`s. |
| `SelectMultiple` | Contains select multiple information for the config. |
| `SelectSingle` | Contains select single information for the config. |
| `SetCredentialsResponse` | Builder to create a `setCredentials()` response for your script project. |
| `TextArea` | Contains text area information for the config. |
| `TextInput` | Contains text input information for the config. |
| `UserError` | An error that is shown to users of the connector. |

## `AggregationType`

### Properties

| Property | Type | Description |
|---|---|---|
| `AVG` | `Enum` | Average. |
| `COUNT` | `Enum` | Count. |
| `COUNT_DISTINCT` | `Enum` | Count Distinct. |
| `MAX` | `Enum` | Max. |
| `MIN` | `Enum` | Min. |
| `SUM` | `Enum` | Sum. |
| `AUTO` | `Enum` | Auto. |

## `AuthType`

### Properties

| Property | Type | Description |
|---|---|---|
| `NONE` | `Enum` | No authorization needed. |
| `OAUTH2` | `Enum` | OAuth2 authorization needed. |
| `USER_PASS` | `Enum` | Username and password credentials needed. |
| `PATH_USER_PASS` | `Enum` | Username, path, and password needed. |
| `PATH_KEY` | `Enum` | Path and key needed. |
| `KEY` | `Enum` | API Key or Token needed. |
| `USER_TOKEN` | `Enum` | Username and token needed. |

## `BigQueryConfig`

### Methods

| Method | Return type | Brief description |
|---|---|---|
| `addQueryParameter(name, type, value)` | `BigQueryConfig` | Adds a query parameter to this `BigQueryConfig`. |
| `build()` | `Object` | Validates this object and returns it in the format needed by Data Studio. |
| `printJson()` | `String` | Prints the JSON representation of this object. |
| `setAccessToken(accessToken)` | `BigQueryConfig` | Sets the access token of this `BigQueryConfig`. |
| `setBillingProjectId(billingProjectId)` | `BigQueryConfig` | Sets the billing project ID of this `BigQueryConfig`. |
| `setQuery(query)` | `BigQueryConfig` | Sets the SQL query of this `BigQueryConfig`. |
| `setUseStandardSql(useStandardSql)` | `BigQueryConfig` | Determines if the query is interpreted as standard or legacy SQL. |

## `BigQueryParameterType`

### Properties

| Property | Type | Description |
|---|---|---|
| `STRING` | `Enum` | String. |
| `INT64` | `Enum` | 64-bit integer. |
| `BOOL` | `Enum` | Boolean. |
| `FLOAT64` | `Enum` | 64-bit floating point number. |

## `Checkbox`

### Methods

| Method | Return type | Brief description |
|---|---|---|
| `setAllowOverride(allowOverride)` | `Checkbox` | Enables overriding for this config entry. |
| `setHelpText(helpText)` | `Checkbox` | Sets the help text for this configuration entry. |
| `setId(id)` | `Checkbox` | Sets the unique ID for this configuration entry. |
| `setIsDynamic(isDynamic)` | `Checkbox` | Sets the dynamic status for this configuration entry. |
| `setName(name)` | `Checkbox` | Sets the display name for this configuration entry. |

## `CommunityConnector`

### Properties

| Property | Type | Description |
|---|---|---|
| `AggregationType` | `AggregationType` | The `AggregationType` enumeration. |
| `AuthType` | `AuthType` | The `AuthType` enumeration. |
| `BigQueryParameterType` | `BigQueryParameterType` | The `BigQueryParameterType` enumeration. |
| `FieldType` | `FieldType` | The `FieldType` enumeration. |

### Methods

| Method | Return type | Brief description |
|---|---|---|
| `getConfig()` | `Config` | Returns a `Config` object. |
| `getFields()` | `Fields` | Returns a `Fields` object. |
| `newAuthTypeResponse()` | `GetAuthTypeResponse` | Returns a new `GetAuthTypeResponse` object. |
| `newBigQueryConfig()` | `BigQueryConfig` | Returns a new `BigQueryConfig` object. |
| `newDebugError()` | `DebugError` | Returns a new `DebugError` object. |
| `newGetDataResponse()` | `GetDataResponse` | Returns a new `GetDataResponse` object. |
| `newGetSchemaResponse()` | `GetSchemaResponse` | Returns a new `GetSchemaResponse` object. |
| `newSetCredentialsResponse()` | `SetCredentialsResponse` | Returns a new `SetCredentialsResponse` object. |
| `newUserError()` | `UserError` | Returns a new `UserError` object. |

## `Config`

### Methods

| Method | Return type | Brief description |
|---|---|---|
| `build()` | `Object` | Validates this object and returns it in the format needed by Data Studio. |
| `newCheckbox()` | `Checkbox` | Returns a new checkbox configuration entry. |
| `newInfo()` | `Info` | Returns a new info configuration entry. |
| `newOptionBuilder()` | `OptionBuilder` | Returns a new options builder. |
| `newSelectMultiple()` | `SelectMultiple` | Returns a new select multiple configuration entry. |
| `newSelectSingle()` | `SelectSingle` | Returns a new select single configuration entry. |
| `newTextArea()` | `TextArea` | Returns a new text area configuration entry. |
| `newTextInput()` | `TextInput` | Returns a new text input configuration entry. |
| `printJson()` | `String` | Prints the JSON representation of this object. |
| `setDateRangeRequired(dateRangeRequired)` | `Config` | If `true`, a date range is provided for getData() requests. |
| `setIsSteppedConfig(isSteppedConfig)` | `Config` | If `true`, `getConfig()` is called again with the current user configuration. |

## `DataStudioApp`

### Methods

| Method | Return type | Brief description |
|---|---|---|
| `createCommunityConnector()` | `CommunityConnector` | Creates a new Community Connector. |

## `DebugError`

### Methods

| Method | Return type | Brief description |
|---|---|---|
| `printJson()` | `String` | Prints the JSON representation of this object. |
| `setText(text)` | `DebugError` | Sets the text of the debug error, which is only shown to admins. |
| `throwException()` | `void` | Triggers this exception to be thrown. |

## `Field`

### Methods

| Method | Return type | Brief description |
|---|---|---|
| `getAggregation()` | `AggregationType` | Returns the `AggregationType` of this `Field`. |
| `getDescription()` | `String` | Returns the description of this `Field`. |
| `getFormula()` | `String` | Returns the formula of this `Field`. |
| `getGroup()` | `String` | Returns the group of this `Field`. |
| `getId()` | `String` | Returns the ID of this `Field`. |
| `getIsReaggregatable()` | `Boolean` | Returns `true` if this field can be reaggregated, `false` otherwise. |
| `getName()` | `String` | Returns the name of this `Field`. |
| `getType()` | `FieldType` | Returns the `FieldType` of this `Field`. |
| `isDefault()` | `Boolean` | Returns `true` if this `Field` is the default metric or dimension. |
| `isDimension()` | `Boolean` | Returns `true` if this field is a dimension. |
| `isHidden()` | `Boolean` | Returns `true` if this `Field` is hidden. |
| `isMetric()` | `Boolean` | Returns `true` if this field is a metric. |
| `setAggregation(aggregation)` | `Field` | Sets the aggregation type of this `Field`. |
| `setDescription(description)` | `Field` | Sets the description of this `Field`. |
| `setFormula(formula)` | `Field` | Sets the formula of this `Field`. |
| `setGroup(group)` | `Field` | Sets the group of this `Field`. |
| `setId(id)` | `Field` | Sets the ID of this `Field`. |
| `setIsHidden(isHidden)` | `Field` | Sets the hidden status of this `Field`. |
| `setIsReaggregatable(isReaggregatable)` | `Field` | Sets the reaggregation-permitted status for a `Field`. |
| `setName(name)` | `Field` | Sets the name of this `Field`. |
| `setType(type)` | `Field` | Sets the `FieldType` of this `Field`. |

## `FieldType`

### Properties

| Property | Type | Description |
|---|---|---|
| `YEAR` | `Enum` | Year in the format of YYYY such as 2017. |
| `YEAR_QUARTER` | `Enum` | Year and quarter in the format of YYYYQ such as 20171. |
| `YEAR_MONTH` | `Enum` | Year and month in the format of YYYYMM such as 201703. |
| `YEAR_WEEK` | `Enum` | Year and week in the format of YYYYww such as 201707. |
| `YEAR_MONTH_DAY` | `Enum` | Year, month, and day in the format of YYYYMMDD such as 20170317. |
| `YEAR_MONTH_DAY_HOUR` | `Enum` | Year, month, day, and hour in the format of YYYYMMDDHH such as 2017031703. |
| `YEAR_MONTH_DAY_MINUTE` | `Enum` | Year, month, day, hour, and minute in the format of YYYYMMDDHHmm such as 201703170230. |
| `YEAR_MONTH_DAY_SECOND` | `Enum` | Year, month, day, hour, minute, and second in the format of YYYYMMDDHHmmss such as 20170317023017. |
| `QUARTER` | `Enum` | Quarter in the format of 1, 2, 3, or 4). |
| `MONTH` | `Enum` | Month in the format of MM such as 03. |
| `WEEK` | `Enum` | Week in the format of ww such as 07. |
| `MONTH_DAY` | `Enum` | Month and day in the format of MMDD such as 0317. |
| `DAY_OF_WEEK` | `Enum` | A number in the range of \[0,6\] with 0 representing Sunday. |
| `DAY` | `Enum` | Day in the format of DD such as 17. |
| `HOUR` | `Enum` | Hour in the format of HH such as 13. |
| `MINUTE` | `Enum` | Minute in the format of mm such as 12. |
| `DURATION` | `Enum` | A duration of time in seconds. |
| `COUNTRY` | `Enum` | A country such as United States. |
| `COUNTRY_CODE` | `Enum` | A country code such as US. |
| `CONTINENT` | `Enum` | A continent such as Americas. |
| `CONTINENT_CODE` | `Enum` | A continent code such as 019. |
| `SUB_CONTINENT` | `Enum` | A sub-continent such as North America. |
| `SUB_CONTINENT_CODE` | `Enum` | A sub-continent code such as 003. |
| `REGION` | `Enum` | A region such as California. |
| `REGION_CODE` | `Enum` | A region code such as CA. |
| `CITY` | `Enum` | A city such as Mountain View. |
| `CITY_CODE` | `Enum` | A city code such as 1014044. |
| `METRO` | `Enum` | A metro such as San Francisco-Oakland-San Jose CA. |
| `METRO_CODE` | `Enum` | A metro code such as 200807. |
| `LATITUDE_LONGITUDE` | `Enum` | A latitude longitude pair such as 51.5074, -0.1278. |
| `NUMBER` | `Enum` | A decimal number. |
| `PERCENT` | `Enum` | Decimal percentage (can be over 1.0). |
| `TEXT` | `Enum` | Free-form text. |
| `BOOLEAN` | `Enum` | A `true` or `false` boolean value. |
| `URL` | `Enum` | A URL as text such as https://google.com. |
| `HYPERLINK` | `Enum` | A hyperlink. |
| `IMAGE` | `Enum` | An image. |
| `IMAGE_LINK` | `Enum` | An image link. |
| `CURRENCY_AED` | `Enum` | Currency from AED. |
| `CURRENCY_ALL` | `Enum` | Currency from ALL. |
| `CURRENCY_ARS` | `Enum` | Currency from ARS. |
| `CURRENCY_AUD` | `Enum` | Currency from AUD. |
| `CURRENCY_BDT` | `Enum` | Currency from BDT. |
| `CURRENCY_BGN` | `Enum` | Currency from BGN. |
| `CURRENCY_BOB` | `Enum` | Currency from BOB. |
| `CURRENCY_BRL` | `Enum` | Currency from BRL. |
| `CURRENCY_CAD` | `Enum` | Currency from CAD. |
| `CURRENCY_CDF` | `Enum` | Currency from CDF. |
| `CURRENCY_CHF` | `Enum` | Currency from CHF. |
| `CURRENCY_CLP` | `Enum` | Currency from CLP. |
| `CURRENCY_CNY` | `Enum` | Currency from CNY. |
| `CURRENCY_COP` | `Enum` | Currency from COP. |
| `CURRENCY_CRC` | `Enum` | Currency from CRC. |
| `CURRENCY_CZK` | `Enum` | Currency from CZK. |
| `CURRENCY_DKK` | `Enum` | Currency from DKK. |
| `CURRENCY_DOP` | `Enum` | Currency from DOP. |
| `CURRENCY_EGP` | `Enum` | Currency from EGP. |
| `CURRENCY_ETB` | `Enum` | Currency from ETB. |
| `CURRENCY_EUR` | `Enum` | Currency from EUR. |
| `CURRENCY_GBP` | `Enum` | Currency from GBP. |
| `CURRENCY_HKD` | `Enum` | Currency from HKD. |
| `CURRENCY_HRK` | `Enum` | Currency from HRK. |
| `CURRENCY_HUF` | `Enum` | Currency from HUF. |
| `CURRENCY_IDR` | `Enum` | Currency from IDR. |
| `CURRENCY_ILS` | `Enum` | Currency from ILS. |
| `CURRENCY_INR` | `Enum` | Currency from INR. |
| `CURRENCY_IRR` | `Enum` | Currency from IRR. |
| `CURRENCY_ISK` | `Enum` | Currency from ISK. |
| `CURRENCY_JMD` | `Enum` | Currency from JMD. |
| `CURRENCY_JPY` | `Enum` | Currency from JPY. |
| `CURRENCY_KRW` | `Enum` | Currency from KRW. |
| `CURRENCY_LKR` | `Enum` | Currency from LKR. |
| `CURRENCY_LTL` | `Enum` | Currency from LTL. |
| `CURRENCY_MNT` | `Enum` | Currency from MNT. |
| `CURRENCY_MVR` | `Enum` | Currency from MVR. |
| `CURRENCY_MXN` | `Enum` | Currency from MXN. |
| `CURRENCY_MYR` | `Enum` | Currency from MYR. |
| `CURRENCY_NGN` | `Enum` | Currency from NGN. |
| `CURRENCY_NOK` | `Enum` | Currency from NOK. |
| `CURRENCY_NZD` | `Enum` | Currency from NZD. |
| `CURRENCY_PAB` | `Enum` | Currency from PAB. |
| `CURRENCY_PEN` | `Enum` | Currency from PEN. |
| `CURRENCY_PHP` | `Enum` | Currency from PHP. |
| `CURRENCY_PKR` | `Enum` | Currency from PKR. |
| `CURRENCY_PLN` | `Enum` | Currency from PLN. |
| `CURRENCY_RON` | `Enum` | Currency from RON. |
| `CURRENCY_RSD` | `Enum` | Currency from RSD. |
| `CURRENCY_RUB` | `Enum` | Currency from RUB. |
| `CURRENCY_SAR` | `Enum` | Currency from SAR. |
| `CURRENCY_SEK` | `Enum` | Currency from SEK. |
| `CURRENCY_SGD` | `Enum` | Currency from SGD. |
| `CURRENCY_THB` | `Enum` | Currency from THB. |
| `CURRENCY_TRY` | `Enum` | Currency from TRY. |
| `CURRENCY_TWD` | `Enum` | Currency from TWD. |
| `CURRENCY_TZS` | `Enum` | Currency from TZS. |
| `CURRENCY_UAH` | `Enum` | Currency from UAH. |
| `CURRENCY_USD` | `Enum` | Currency from USD. |
| `CURRENCY_UYU` | `Enum` | Currency from UYU. |
| `CURRENCY_VEF` | `Enum` | Currency from VEF. |
| `CURRENCY_VND` | `Enum` | Currency from VND. |
| `CURRENCY_YER` | `Enum` | Currency from YER. |
| `CURRENCY_ZAR` | `Enum` | Currency from ZAR. |

## `Fields`

### Methods

| Method | Return type | Brief description |
|---|---|---|
| `asArray()` | `Field[]` | Returns a view of this object as an array. |
| `build()` | `Object[]` | Validates this object and returns it in the format needed by Data Studio. |
| `forIds(ids)` | `Fields` | Returns a new `Fields` object filtered to `Field`s with an ID in `ids`. |
| `getDefaultDimension()` | `Field` | Returns the default dimension to be used for the set of fields. |
| `getDefaultMetric()` | `Field` | Returns the default metric to be used for the set of fields. |
| `getFieldById(fieldId)` | `Field` | Returns a field with a given ID, or `null` if no field with that ID is in this `Fields` object. |
| `newDimension()` | `Field` | Returns a new dimension `Field`. |
| `newMetric()` | `Field` | Returns a new metric `Field`. |
| `setDefaultDimension(fieldId)` | `void` | Sets the default dimension to be used for the set of fields. |
| `setDefaultMetric(fieldId)` | `void` | Sets the default metric to be used for the set of fields. |

## `GetAuthTypeResponse`

### Methods

| Method | Return type | Brief description |
|---|---|---|
| `build()` | `Object` | Validates this object and returns it in the format needed by Data Studio. |
| `printJson()` | `String` | Prints the JSON representation of this object. |
| `setAuthType(authType)` | `GetAuthTypeResponse` | Sets the `AuthType` of the builder. |
| `setHelpUrl(helpUrl)` | `GetAuthTypeResponse` | Sets the help URL of the builder. |

## `GetDataResponse`

### Methods

| Method | Return type | Brief description |
|---|---|---|
| `addAllRows(rows)` | `GetDataResponse` | Adds multiple rows of data to this `GetDataResponse`. |
| `addRow(row)` | `GetDataResponse` | Adds a row of data to this `GetDataResponse`. |
| `build()` | `Object` | Validates this object and returns it in the format needed by Data Studio. |
| `setFields(fields)` | `GetDataResponse` | Sets the `Fields` of the builder. |
| `setFiltersApplied(filtersApplied)` | `GetDataResponse` | Sets the filters applied status for this builder. |

## `GetSchemaResponse`

### Methods

| Method | Return type | Brief description |
|---|---|---|
| `build()` | `Object` | Validates this object and returns it in the format needed by Data Studio. |
| `printJson()` | `String` | Prints the JSON representation of this object. |
| `setFields(fields)` | `GetSchemaResponse` | Sets the `Fields` of the builder. |

## `Info`

### Methods

| Method | Return type | Brief description |
|---|---|---|
| `setId(id)` | `Info` | Sets the unique ID for this configuration entry. |
| `setText(text)` | `Info` | Sets the text for this configuration entry. |

## `OptionBuilder`

### Methods

| Method | Return type | Brief description |
|---|---|---|
| `setLabel(label)` | `OptionBuilder` | Sets the label of this option builder. |
| `setValue(value)` | `OptionBuilder` | Sets the value of this option builder. |

## `SelectMultiple`

### Methods

| Method | Return type | Brief description |
|---|---|---|
| `addOption(optionBuilder)` | `SelectMultiple` | Adds a new select option. |
| `setAllowOverride(allowOverride)` | `SelectMultiple` | Enables overriding for this config entry. |
| `setHelpText(helpText)` | `SelectMultiple` | Sets the help text for this configuration entry. |
| `setId(id)` | `SelectMultiple` | Sets the unique ID for this configuration entry. |
| `setIsDynamic(isDynamic)` | `SelectMultiple` | Sets the dynamic status for this configuration entry. |
| `setName(name)` | `SelectMultiple` | Sets the display name for this configuration entry. |

## `SelectSingle`

### Methods

| Method | Return type | Brief description |
|---|---|---|
| `addOption(optionBuilder)` | `SelectSingle` | Adds a new select option. |
| `setAllowOverride(allowOverride)` | `SelectSingle` | Enables overriding for this config entry. |
| `setHelpText(helpText)` | `SelectSingle` | Sets the help text for this configuration entry. |
| `setId(id)` | `SelectSingle` | Sets the unique ID for this configuration entry. |
| `setIsDynamic(isDynamic)` | `SelectSingle` | Sets the dynamic status for this configuration entry. |
| `setName(name)` | `SelectSingle` | Sets the display name for this configuration entry. |

## `SetCredentialsResponse`

### Methods

| Method | Return type | Brief description |
|---|---|---|
| `build()` | `Object` | Validates this object and returns it in the format needed by Data Studio. |
| `printJson()` | `String` | Prints the JSON representation of this object. |
| `setIsValid(isValid)` | `SetCredentialsResponse` | Sets the valid status of this `SetCredentialsResponse`. |

## `TextArea`

### Methods

| Method | Return type | Brief description |
|---|---|---|
| `setAllowOverride(allowOverride)` | `TextArea` | Enables overriding for this config entry. |
| `setHelpText(helpText)` | `TextArea` | Sets the help text for this configuration entry. |
| `setId(id)` | `TextArea` | Sets the unique ID for this configuration entry. |
| `setIsDynamic(isDynamic)` | `TextArea` | Sets the dynamic status for this configuration entry. |
| `setName(name)` | `TextArea` | Sets the display name for this configuration entry. |
| `setPlaceholder(placeholder)` | `TextArea` | Sets the placeholder text for this configuration entry. |

## `TextInput`

### Methods

| Method | Return type | Brief description |
|---|---|---|
| `setAllowOverride(allowOverride)` | `TextInput` | Enables overriding for this config entry. |
| `setHelpText(helpText)` | `TextInput` | Sets the help text for this configuration entry. |
| `setId(id)` | `TextInput` | Sets the unique ID for this configuration entry. |
| `setIsDynamic(isDynamic)` | `TextInput` | Sets the dynamic status for this configuration entry. |
| `setName(name)` | `TextInput` | Sets the display name for this configuration entry. |
| `setPlaceholder(placeholder)` | `TextInput` | Sets the placeholder text for this configuration entry. |

## `UserError`

### Methods

| Method | Return type | Brief description |
|---|---|---|
| `printJson()` | `String` | Prints the JSON representation of this object. |
| `setDebugText(text)` | `UserError` | Sets the text of the debug error, which is only shown to admins. |
| `setText(text)` | `UserError` | Sets the text of the user error. |
| `throwException()` | `void` | Triggers this exception to be thrown. |