# Class DataType

DataType

A DataType is used to set the type of a variable. The type can be one of the basic data type or a
Workspace Studio-specific resource type.

Only available for Google Workspace add-ons that extend Google Workspace Studio.

Sample usage:

```javascript
const dataType = AddOnsResponseService.newDataType()
    .setBasicDataType(
      AddOnsResponseService.BasicDataType.STRING
    )
    .setValueMetadata(
      AddOnsResponseService.newValueMetadata()
        .addEnumValue("sample_enum_value")
    );

let resourceField = AddOnsResponseService.newResourceField()
    .setSelector("question_1")
    .setDisplayText("Question 1")
    .setDataType(dataType);

}
```

### Methods

| Method | Return type | Brief description |
|---|---|---|
| `setBasicDataType(basicDataType)` | `DataType` | Sets the data type to one of the supported `BasicDataType`s. |
| `setResourceType(resourceType)` | `DataType` | Sets the data type to a custom defined `ResourceType`. |
| `setValueMetadata(valueMetadata)` | `DataType` | Sets the `ValueMetadata`, which contains type-related information related to the variable. |

## Detailed documentation

### `setBasicDataType(basicDataType)`

Sets the data type to one of the supported `BasicDataType`s.

#### Parameters

| Name | Type | Description |
|---|---|---|
| `basicDataType` | `BasicDataType` | The basic data type that the variable belongs to. |

#### Return


`DataType` --- This data type object, for chaining.

*** ** * ** ***

### `setResourceType(resourceType)`

Sets the data type to a custom defined `ResourceType`.

#### Parameters

| Name | Type | Description |
|---|---|---|
| `resourceType` | `ResourceType` | The application specific(custom) resource type of the variable. |

#### Return


`DataType` --- This data type object, for chaining.

*** ** * ** ***

### `setValueMetadata(valueMetadata)`

Sets the `ValueMetadata`, which contains type-related information related to the
variable.

#### Parameters

| Name | Type | Description |
|---|---|---|
| `valueMetadata` | `ValueMetadata` | The value metadata information about the potential values of the variable. |

#### Return


`DataType` --- This data type object, for chaining.