Class GetSchemaResponse

GetSchemaResponse

Builder to create a getSchema() response for your script project.

function getSchema() {
  var cc = DataStudioApp.createCommunityConnector();
  var fields = cc.getFields();
  var types = cc.FieldType;

  fields.newDimension()
      .setId('Created')
      .setName('Date Created')
      .setDescription('The date that this was created')
      .setType(types.YEAR_MONTH_DAY);

  fields.newMetric()
      .setId('Amount')
      .setName('Amount (USD)')
      .setDescription('The cost in US dollars')
      .setType(types.CURRENCY_USD);

  return cc.newGetSchemaResponse()
      .setFields(fields)
      .build();
}

Methods

MethodReturn typeBrief description
build()ObjectValidates this object and returns it in the format needed by Data Studio.
printJson()StringPrints the JSON representation of this object.
setFields(fields)GetSchemaResponseSets the Fields of the builder.

Detailed documentation

build()

Validates this object and returns it in the format needed by Data Studio.

Return

Object — The validated GetSchemaResponse object.


printJson()

Prints the JSON representation of this object. This is for debugging only.

Return

String


setFields(fields)

Sets the Fields of the builder.

Parameters

NameTypeDescription
fieldsFieldsThe fields to set.

Return

GetSchemaResponse — This builder, for chaining.