<commit_before>// Type definitions for Google Apps Script 2020-01-02
// Project: https://developers.google.com/apps-script/
// Definitions by: PopGoesTheWza <https://github.com/PopGoesTheWza>
//                 motemen <https://github.com/motemen/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped

/// <reference path="google-apps-script.types.d.ts" />

declare namespace GoogleAppsScript {
  namespace Data_Studio {
    /**
     * An enum that defines the aggregation types that can be set for a Field.
     */
    enum AggregationType { AVG, COUNT, COUNT_DISTINCT, MAX, MIN, SUM, AUTO, NO_AGGREGATION }
    /**
     * An enum that defines the authentication types that can be set for a connector.
     */
    enum AuthType { NONE, OAUTH2, USER_PASS, KEY, USER_TOKEN }
    /**
     * A configuration object for a native BigQuery connector. Return this object from getData()
     * for Data Studio to query BigQuery for the connector.
     *
     *     var cc = DataStudioApp.createCommunityConnector();
     *     var types = cc.BigQueryParameterType;
     *
     *     var bqConfig = cc.newBigQueryConfig()
     *       .setBillingProjectId('billingProjectId')
     *       .setQuery('queryString')
     *       .setUseStandardSql(true)
     *       .setAccessToken('accessToken')
     *       .addQueryParameter('dob', types.STRING, '01011990')
     *       .build();
     */
    interface BigQueryConfig {
      addQueryParameter(name: string, type: BigQueryParameterType, value: string): BigQueryConfig;
      build(): Config;
      printJson(): string;
      setAccessToken(accessToken: string): BigQueryConfig;
      setBillingProjectId(billingProjectId: string): BigQueryConfig;
      setQuery(query: string): BigQueryConfig;
      setUseStandardSql(useStandardSql: boolean): BigQueryConfig;
    }
    /**
     * An enum that defines the BigQuery parameter types that you can set.
     */
    enum BigQueryParameterType { STRING, INT64, BOOL, FLOAT64 }
    /**
     * Contains checkbox information for the config. Its properties determine how the checkbox is
     * displayed in Data Studio.
     *
     *     var checkbox = config.newCheckbox()
     *       .setId("use_https")
     *       .setName("Use Https?")
     *       .setHelpText("Whether or not https should be used.")
     *       .setAllowOverride(true);
     */
    interface Checkbox {
      setAllowOverride(allowOverride: boolean): Checkbox;
      setHelpText(helpText: string): Checkbox;
      setId(id: string): Checkbox;
      setIsDynamic(isDynamic: boolean): Checkbox;
      setName(name: string): Checkbox;
    }
    /**
     * CommunityConnector enables scripts to access builders and utilities to help with development of
     * Community Connectors for Data Studio. Use this class to get a reference to the Fields
     * object and the FieldType and AggregationType enums so they can be used in the
     * construction of Fields.
     *
     *     var cc = DataStudioApp.createCommunityConnector();
     *     var fieldType = cc.FieldType;
     *     var aggregationType = cc.AggregationType;
     *
     *     var fields = cc.getFields();
     *
     *     fields.newMetric()
     *       .setAggregation(aggregationType.AVG)
     *       .setType(fieldType.CURRENCY_USD);
     */
    interface CommunityConnector {
      AggregationType: typeof AggregationType;
      AuthType: typeof AuthType;
      BigQueryParameterType: typeof BigQueryParameterType;
      FieldType: typeof FieldType;
      getConfig(): Config;
      getFields(): Fields;
      newAuthTypeResponse(): GetAuthTypeResponse;
      newBigQueryConfig(): BigQueryConfig;
      newDebugError(): DebugError;
      newGetDataResponse(): GetDataResponse;
      newGetSchemaResponse(): GetSchemaResponse;
      newSetCredentialsResponse(): SetCredentialsResponse;
      newUserError(): UserError;
    }
    /**
     * Contains the configuration entries for a connector. These configuration entries define what
     * questions are asked when adding a new connector.
     *
     *     var cc = DataStudioApp.createCommunityConnector();
     *     var config = cc.getConfig();
     *
     *     var info_entry = config.newInfo()
     *       .setId("info_id")
     *       .setHelpText("This connector can connect to multiple data endpoints.");
     */
    interface Config {
      build(): Config;
      newCheckbox(): Checkbox;
      newInfo(): Info;
      newOptionBuilder(): OptionBuilder;
      newSelectMultiple(): SelectMultiple;
      newSelectSingle(): SelectSingle;
      newTextArea(): TextArea;
      newTextInput(): TextInput;
      printJson(): string;
      setDateRangeRequired(dateRangeRequired: boolean): Config;
      setIsSteppedConfig(isSteppedConfig: boolean): Config;
    }
    /**
     * DataStudioApp allows scripts to interact with developer-oriented features for Data Studio.
     */
    interface DataStudioApp {
      createCommunityConnector(): CommunityConnector;
    }
    /**
     * An error that is only visible to admins of the connector.
     *
     *     var cc = DataStudioApp.createCommunityConnector();
     *
     *     cc.newDebugError()
     *       .setText("This is the debug error text.")
     *       .throwException();
     */
    interface DebugError {
      printJson(): string;
      setText(text: string): DebugError;
      throwException(): void;
    }
    /**
     * Contains field-related data. Its properties determine how the field is used in Data Studio.
     *
     *     var cc = DataStudioApp.createCommunityConnector();
     *     var fields = cc.getFields();
     *     var types = cc.FieldType;
     *
     *     var field1 = fields.newDimension()
     *       .setId('field1_id')
     *       .setName('Field 1 ID')
     *       .setDescription('The first field.')
     *       .setType(types.YEAR_MONTH)
     *       .setGroup('DATETIME');
     */
    interface Field {
      getAggregation(): AggregationType;
      getDescription(): string;
      getFormula(): string;
      getGroup(): string;
      getId(): string;
      getIsReaggregatable(): boolean;
      getName(): string;
      getType(): FieldType;
      isDefault(): boolean;
      isDimension(): boolean;
      isHidden(): boolean;
      isMetric(): boolean;
      setAggregation(aggregation: AggregationType): Field;
      setDescription(description: string): Field;
      setFormula(formula: string): Field;
      setGroup(group: string): Field;
      setId(id: string): Field;
      setIsHidden(isHidden: boolean): Field;
      setIsReaggregatable(isReaggregatable: boolean): Field;
      setName(name: string): Field;
      setType(type: FieldType): Field;
    }
    /**
     * An enum that defines the types that can be set for a Field.
     */
    enum FieldType { YEAR, YEAR_QUARTER, YEAR_MONTH, YEAR_WEEK, YEAR_MONTH_DAY, YEAR_MONTH_DAY_HOUR, YEAR_MONTH_DAY_SECOND, QUARTER, MONTH, WEEK, MONTH_DAY, DAY_OF_WEEK, DAY, HOUR, MINUTE, DURATION, COUNTRY, COUNTRY_CODE, CONTINENT, CONTINENT_CODE, SUB_CONTINENT, SUB_CONTINENT_CODE, REGION, REGION_CODE, CITY, CITY_CODE, METRO, METRO_CODE, LATITUDE_LONGITUDE, NUMBER, PERCENT, TEXT, BOOLEAN, URL, HYPERLINK, IMAGE, IMAGE_LINK, CURRENCY_AED, CURRENCY_ALL, CURRENCY_ARS, CURRENCY_AUD, CURRENCY_BDT, CURRENCY_BGN, CURRENCY_BOB, CURRENCY_BRL, CURRENCY_CAD, CURRENCY_CDF, CURRENCY_CHF, CURRENCY_CLP, CURRENCY_CNY, CURRENCY_COP, CURRENCY_CRC, CURRENCY_CZK, CURRENCY_DKK, CURRENCY_DOP, CURRENCY_EGP, CURRENCY_ETB, CURRENCY_EUR, CURRENCY_GBP, CURRENCY_HKD, CURRENCY_HRK, CURRENCY_HUF, CURRENCY_IDR, CURRENCY_ILS, CURRENCY_INR, CURRENCY_IRR, CURRENCY_ISK, CURRENCY_JMD, CURRENCY_JPY, CURRENCY_KRW, CURRENCY_LKR, CURRENCY_LTL, CURRENCY_MNT, CURRENCY_MVR, CURRENCY_MXN, CURRENCY_MYR, CURRENCY_NOK, CURRENCY_NZD, CURRENCY_PAB, CURRENCY_PEN, CURRENCY_PHP, CURRENCY_PKR, CURRENCY_PLN, CURRENCY_RON, CURRENCY_RSD, CURRENCY_RUB, CURRENCY_SAR, CURRENCY_SEK, CURRENCY_SGD, CURRENCY_THB, CURRENCY_TRY, CURRENCY_TWD, CURRENCY_TZS, CURRENCY_UAH, CURRENCY_USD, CURRENCY_UYU, CURRENCY_VEF, CURRENCY_VND, CURRENCY_YER, CURRENCY_ZAR }
    /**
     * Contains a set of Fields for a community connector. This set of fields define which
     * dimensions and metrics can be used in Data Studio.
     *
     *     var cc = DataStudioApp.createCommunityConnector();
     *     var fields = cc.getFields();
     *     var types = cc.FieldType;
     *
     *     var field1 = fields.newDimension()
     *       // Set other properties as needed.
     *       .setId('field1_id');
     */
    interface Fields {
      asArray(): Field[];
      build(): any[];
      forIds(ids: string[]): Fields;
      getDefaultDimension(): Field;
      getDefaultMetric(): Field;
      getFieldById(fieldId: string): Field;
      newDimension(): Field;
      newMetric(): Field;
      setDefaultDimension(fieldId: string): void;
      setDefaultMetric(fieldId: string): void;
    }
    /**
     * Builder to create a getAuthType() response for your script project.
     *
     *     function getAuthType() {
     *       var cc = DataStudioApp.createCommunityConnector();
     *       var authTypes = cc.AuthType;
     *
     *       return cc.newGetAuthTypeResponse()
     *         .setAuthType(authTypes.USER_PASS)
     *         .setHelpUrl("https://www.example.org/connector-auth-help")
     *         .build();
     *     }
     */
    interface GetAuthTypeResponse {
      build(): GetAuthTypeResponse;<commit_msg>update types for Field and Fields (#41727)<commit_after>// Type definitions for Google Apps Script 2020-01-02
// Project: https://developers.google.com/apps-script/
// Definitions by: PopGoesTheWza <https://github.com/PopGoesTheWza>
//                 motemen <https://github.com/motemen/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped

/// <reference path="google-apps-script.types.d.ts" />

declare namespace GoogleAppsScript {
  namespace Data_Studio {
    /**
     * An enum that defines the aggregation types that can be set for a Field.
     */
    enum AggregationType { AVG, COUNT, COUNT_DISTINCT, MAX, MIN, SUM, AUTO, NO_AGGREGATION }
    /**
     * An enum that defines the authentication types that can be set for a connector.
     */
    enum AuthType { NONE, OAUTH2, USER_PASS, KEY, USER_TOKEN }
    /**
     * A configuration object for a native BigQuery connector. Return this object from getData()
     * for Data Studio to query BigQuery for the connector.
     *
     *     var cc = DataStudioApp.createCommunityConnector();
     *     var types = cc.BigQueryParameterType;
     *
     *     var bqConfig = cc.newBigQueryConfig()
     *       .setBillingProjectId('billingProjectId')
     *       .setQuery('queryString')
     *       .setUseStandardSql(true)
     *       .setAccessToken('accessToken')
     *       .addQueryParameter('dob', types.STRING, '01011990')
     *       .build();
     */
    interface BigQueryConfig {
      addQueryParameter(name: string, type: BigQueryParameterType, value: string): BigQueryConfig;
      build(): Config;
      printJson(): string;
      setAccessToken(accessToken: string): BigQueryConfig;
      setBillingProjectId(billingProjectId: string): BigQueryConfig;
      setQuery(query: string): BigQueryConfig;
      setUseStandardSql(useStandardSql: boolean): BigQueryConfig;
    }
    /**
     * An enum that defines the BigQuery parameter types that you can set.
     */
    enum BigQueryParameterType { STRING, INT64, BOOL, FLOAT64 }
    /**
     * Contains checkbox information for the config. Its properties determine how the checkbox is
     * displayed in Data Studio.
     *
     *     var checkbox = config.newCheckbox()
     *       .setId("use_https")
     *       .setName("Use Https?")
     *       .setHelpText("Whether or not https should be used.")
     *       .setAllowOverride(true);
     */
    interface Checkbox {
      setAllowOverride(allowOverride: boolean): Checkbox;
      setHelpText(helpText: string): Checkbox;
      setId(id: string): Checkbox;
      setIsDynamic(isDynamic: boolean): Checkbox;
      setName(name: string): Checkbox;
    }
    /**
     * CommunityConnector enables scripts to access builders and utilities to help with development of
     * Community Connectors for Data Studio. Use this class to get a reference to the Fields
     * object and the FieldType and AggregationType enums so they can be used in the
     * construction of Fields.
     *
     *     var cc = DataStudioApp.createCommunityConnector();
     *     var fieldType = cc.FieldType;
     *     var aggregationType = cc.AggregationType;
     *
     *     var fields = cc.getFields();
     *
     *     fields.newMetric()
     *       .setAggregation(aggregationType.AVG)
     *       .setType(fieldType.CURRENCY_USD);
     */
    interface CommunityConnector {
      AggregationType: typeof AggregationType;
      AuthType: typeof AuthType;
      BigQueryParameterType: typeof BigQueryParameterType;
      FieldType: typeof FieldType;
      getConfig(): Config;
      getFields(): Fields;
      newAuthTypeResponse(): GetAuthTypeResponse;
      newBigQueryConfig(): BigQueryConfig;
      newDebugError(): DebugError;
      newGetDataResponse(): GetDataResponse;
      newGetSchemaResponse(): GetSchemaResponse;
      newSetCredentialsResponse(): SetCredentialsResponse;
      newUserError(): UserError;
    }
    /**
     * Contains the configuration entries for a connector. These configuration entries define what
     * questions are asked when adding a new connector.
     *
     *     var cc = DataStudioApp.createCommunityConnector();
     *     var config = cc.getConfig();
     *
     *     var info_entry = config.newInfo()
     *       .setId("info_id")
     *       .setHelpText("This connector can connect to multiple data endpoints.");
     */
    interface Config {
      build(): Config;
      newCheckbox(): Checkbox;
      newInfo(): Info;
      newOptionBuilder(): OptionBuilder;
      newSelectMultiple(): SelectMultiple;
      newSelectSingle(): SelectSingle;
      newTextArea(): TextArea;
      newTextInput(): TextInput;
      printJson(): string;
      setDateRangeRequired(dateRangeRequired: boolean): Config;
      setIsSteppedConfig(isSteppedConfig: boolean): Config;
    }
    /**
     * DataStudioApp allows scripts to interact with developer-oriented features for Data Studio.
     */
    interface DataStudioApp {
      createCommunityConnector(): CommunityConnector;
    }
    /**
     * An error that is only visible to admins of the connector.
     *
     *     var cc = DataStudioApp.createCommunityConnector();
     *
     *     cc.newDebugError()
     *       .setText("This is the debug error text.")
     *       .throwException();
     */
    interface DebugError {
      printJson(): string;
      setText(text: string): DebugError;
      throwException(): void;
    }
    /**
     * Contains field-related data. Its properties determine how the field is used in Data Studio.
     *
     *     var cc = DataStudioApp.createCommunityConnector();
     *     var fields = cc.getFields();
     *     var types = cc.FieldType;
     *
     *     var field1 = fields.newDimension()
     *       .setId('field1_id')
     *       .setName('Field 1 ID')
     *       .setDescription('The first field.')
     *       .setType(types.YEAR_MONTH)
     *       .setGroup('DATETIME');
     */
    interface Field {
      getAggregation(): AggregationType | null;
      getDescription(): string | null;
      getFormula(): string | null;
      getGroup(): string | null;
      getId(): string | null;
      getIsReaggregatable(): boolean | null;
      getName(): string | null;
      getType(): FieldType | null;
      isDefault(): boolean;
      isDimension(): boolean;
      isHidden(): boolean;
      isMetric(): boolean;
      setAggregation(aggregation: AggregationType): Field;
      setDescription(description: string): Field;
      setFormula(formula: string): Field;
      setGroup(group: string): Field;
      setId(id: string): Field;
      setIsHidden(isHidden: boolean): Field;
      setIsReaggregatable(isReaggregatable: boolean): Field;
      setName(name: string): Field;
      setType(type: FieldType): Field;
    }
    /**
     * An enum that defines the types that can be set for a Field.
     */
    enum FieldType { YEAR, YEAR_QUARTER, YEAR_MONTH, YEAR_WEEK, YEAR_MONTH_DAY, YEAR_MONTH_DAY_HOUR, YEAR_MONTH_DAY_SECOND, QUARTER, MONTH, WEEK, MONTH_DAY, DAY_OF_WEEK, DAY, HOUR, MINUTE, DURATION, COUNTRY, COUNTRY_CODE, CONTINENT, CONTINENT_CODE, SUB_CONTINENT, SUB_CONTINENT_CODE, REGION, REGION_CODE, CITY, CITY_CODE, METRO, METRO_CODE, LATITUDE_LONGITUDE, NUMBER, PERCENT, TEXT, BOOLEAN, URL, HYPERLINK, IMAGE, IMAGE_LINK, CURRENCY_AED, CURRENCY_ALL, CURRENCY_ARS, CURRENCY_AUD, CURRENCY_BDT, CURRENCY_BGN, CURRENCY_BOB, CURRENCY_BRL, CURRENCY_CAD, CURRENCY_CDF, CURRENCY_CHF, CURRENCY_CLP, CURRENCY_CNY, CURRENCY_COP, CURRENCY_CRC, CURRENCY_CZK, CURRENCY_DKK, CURRENCY_DOP, CURRENCY_EGP, CURRENCY_ETB, CURRENCY_EUR, CURRENCY_GBP, CURRENCY_HKD, CURRENCY_HRK, CURRENCY_HUF, CURRENCY_IDR, CURRENCY_ILS, CURRENCY_INR, CURRENCY_IRR, CURRENCY_ISK, CURRENCY_JMD, CURRENCY_JPY, CURRENCY_KRW, CURRENCY_LKR, CURRENCY_LTL, CURRENCY_MNT, CURRENCY_MVR, CURRENCY_MXN, CURRENCY_MYR, CURRENCY_NOK, CURRENCY_NZD, CURRENCY_PAB, CURRENCY_PEN, CURRENCY_PHP, CURRENCY_PKR, CURRENCY_PLN, CURRENCY_RON, CURRENCY_RSD, CURRENCY_RUB, CURRENCY_SAR, CURRENCY_SEK, CURRENCY_SGD, CURRENCY_THB, CURRENCY_TRY, CURRENCY_TWD, CURRENCY_TZS, CURRENCY_UAH, CURRENCY_USD, CURRENCY_UYU, CURRENCY_VEF, CURRENCY_VND, CURRENCY_YER, CURRENCY_ZAR }
    /**
     * Contains a set of Fields for a community connector. This set of fields define which
     * dimensions and metrics can be used in Data Studio.
     *
     *     var cc = DataStudioApp.createCommunityConnector();
     *     var fields = cc.getFields();
     *     var types = cc.FieldType;
     *
     *     var field1 = fields.newDimension()
     *       // Set other properties as needed.
     *       .setId('field1_id');
     */
    interface Fields {
      asArray(): Field[];
      build(): any[];
      forIds(ids: string[]): Fields;
      getDefaultDimension(): Field | null;
      getDefaultMetric(): Field | null;
      getFieldById(fieldId: string): Field | null;
      newDimension(): Field;
      newMetric(): Field;
      setDefaultDimension(fieldId: string): void;
      setDefaultMetric(fieldId: string): void;
    }
    /**
     * Builder to create a getAuthType() response for your script project.
     *
     *     function getAuthType() {
     *       var cc = DataStudioApp.createCommunityConnector();
     *       var authTypes = cc.AuthType;
     *
     *       return cc.newGetAuthTypeResponse()
     *         .setAuthType(authTypes.USER_PASS)
     *         .setHelpUrl("https://www.example.org/connector-auth-help")
     *         .build();
     *     }
     */
    interface GetAuthTypeResponse {
      build(): GetAuthTypeResponse;
{'fraction_non_alphanumeric': 0.10019003378378379, 'fraction_numerical': 0.0030088682432432433, 'mean_word_length': 2.916683894976225, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 10, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5904697', 'n_tokens_mistral': 6119, 'n_tokens_neox': 5829, 'n_words': 1416}