new classes and methods

This commit is contained in:
PopGoesTheWza
2019-01-23 12:16:38 +01:00
parent cac944e325
commit 16168859d9
2 changed files with 100 additions and 3 deletions
@@ -1,4 +1,4 @@
// Type definitions for Google Apps Script 2019-01-06
// Type definitions for Google Apps Script 2019-01-23
// Project: https://developers.google.com/apps-script/
// Definitions by: motemen <https://github.com/motemen/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
@@ -12,6 +12,11 @@ declare namespace GoogleAppsScript {
*/
export enum AggregationType { NO_AGGREGATION, AVG, COUNT, COUNT_DISTINCT, MAX, MIN, SUM }
/**
* An enum that defines the authentication types that can be set for a connector.
*/
export enum AuthType { NONE, OAUTH2, USER_PASS, KEY, USER_TOKEN }
/**
* Contains checkbox information for the config. Its properties determine how the checkbox is
* displayed in Data Studio.
@@ -47,9 +52,11 @@ declare namespace GoogleAppsScript {
*/
export interface CommunityConnector {
AggregationType: typeof AggregationType;
AuthType: typeof AuthType;
FieldType: typeof FieldType;
getConfig(): Config;
getFields(): Fields;
newAuthTypeResponse(): GetAuthTypeResponse;
newDebugError(): DebugError;
newUserError(): UserError;
}
@@ -166,6 +173,26 @@ declare namespace GoogleAppsScript {
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();
* }
*/
export interface GetAuthTypeResponse {
build(): Object;
printJson(): string;
setAuthType(authType: AuthType): GetAuthTypeResponse;
setHelpUrl(helpUrl: string): GetAuthTypeResponse;
}
/**
* Contains info data for the config. Its properties determine how the info is displayed in Data
* Studio.
@@ -174,7 +201,7 @@ declare namespace GoogleAppsScript {
* var config = cc.getConfig();
*
* var info1 = config.newInfo()
* .setName("info1")
* .setId("info1")
* .setText("This text gives some context on the configuration.");
*/
export interface Info {
@@ -1,4 +1,4 @@
// Type definitions for Google Apps Script 2018-12-26
// Type definitions for Google Apps Script 2019-01-23
// Project: https://developers.google.com/apps-script/
// Definitions by: motemen <https://github.com/motemen/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
@@ -1254,6 +1254,8 @@ declare namespace GoogleAppsScript {
getNumRows(): Integer;
getNumberFormat(): string;
getNumberFormats(): string[][];
getRichTextValue(): RichTextValue;
getRichTextValues(): RichTextValue[][];
getRow(): Integer;
getRowIndex(): Integer;
getSheet(): Sheet;
@@ -1261,6 +1263,8 @@ declare namespace GoogleAppsScript {
getTextDirections(): TextDirection[][];
getTextRotation(): TextRotation;
getTextRotations(): TextRotation[][];
getTextStyle(): TextStyle;
getTextStyles(): TextStyle[][];
getValue(): Object;
getValues(): Object[][];
getVerticalAlignment(): string;
@@ -1315,12 +1319,16 @@ declare namespace GoogleAppsScript {
setNotes(notes: Object[][]): Range;
setNumberFormat(numberFormat: string): Range;
setNumberFormats(numberFormats: Object[][]): Range;
setRichTextValue(value: RichTextValue): Range;
setRichTextValues(values: RichTextValue[][]): Range;
setShowHyperlink(showHyperlink: boolean): Range;
setTextDirection(direction: TextDirection): Range;
setTextDirections(directions: TextDirection[][]): Range;
setTextRotation(degrees: Integer): Range;
setTextRotation(rotation: TextRotation): Range;
setTextRotations(rotations: TextRotation[][]): Range;
setTextStyle(style: TextStyle): Range;
setTextStyles(styles: TextStyle[][]): Range;
setValue(value: Object): Range;
setValues(values: Object[][]): Range;
setVerticalAlignment(alignment: string): Range;
@@ -1383,6 +1391,34 @@ declare namespace GoogleAppsScript {
*/
export enum RelativeDate { TODAY, TOMORROW, YESTERDAY, PAST_WEEK, PAST_MONTH, PAST_YEAR }
/**
* A stylized text string used to represent cell text. Substrings of the text can have different
* text styles.
*
* A run is the longest unbroken substring having the same text style. For example, the
* sentence "This kid has two apples." has four runs: ["This ", "kid ", "has two ",
* "apples."].
*/
export interface RichTextValue {
copy(): RichTextValueBuilder;
getEndIndex(): Integer;
getRuns(): RichTextValue[];
getStartIndex(): Integer;
getText(): string;
getTextStyle(): TextStyle;
getTextStyle(startOffset: Integer, endOffset: Integer): TextStyle;
}
/**
* A builder for Rich Text values.
*/
export interface RichTextValueBuilder {
build(): RichTextValue;
setText(text: string): RichTextValueBuilder;
setTextStyle(startOffset: Integer, endOffset: Integer, textStyle: TextStyle): RichTextValueBuilder;
setTextStyle(textStyle: TextStyle): RichTextValueBuilder;
}
/**
* Access the current active selection in the active sheet. A selection is the set of cells the user
* has highlighted in the sheet, which can be non-adjacent ranges. One cell in the selection is the
@@ -1720,6 +1756,8 @@ declare namespace GoogleAppsScript {
newConditionalFormatRule(): ConditionalFormatRuleBuilder;
newDataValidation(): DataValidationBuilder;
newFilterCriteria(): FilterCriteriaBuilder;
newRichTextValue(): RichTextValueBuilder;
newTextStyle(): TextStyleBuilder;
open(file: Drive.File): Spreadsheet;
openById(id: string): Spreadsheet;
openByUrl(url: string): Spreadsheet;
@@ -1744,6 +1782,38 @@ declare namespace GoogleAppsScript {
isVertical(): boolean;
}
/**
* The rendered style of text in a cell.
*
* Text styles can have a corresponding RichTextValue. If the RichTextValue spans multiple text runs that have different values for a given text style read
* method, the method returns null. To avoid this, query for text styles using the Rich Text
* values returned by the RichTextValue.getRuns() method.
*/
export interface TextStyle {
copy(): TextStyleBuilder;
getFontFamily(): string;
getFontSize(): Integer;
getForegroundColor(): string;
isBold(): boolean;
isItalic(): boolean;
isStrikethrough(): boolean;
isUnderline(): boolean;
}
/**
* A builder for text styles.
*/
export interface TextStyleBuilder {
build(): TextStyle;
setBold(bold: boolean): TextStyleBuilder;
setFontFamily(fontFamily: string): TextStyleBuilder;
setFontSize(fontSize: Integer): TextStyleBuilder;
setForegroundColor(cssString: string): TextStyleBuilder;
setItalic(italic: boolean): TextStyleBuilder;
setStrikethrough(strikethrough: boolean): TextStyleBuilder;
setUnderline(underline: boolean): TextStyleBuilder;
}
/**
* An enumeration of the types of preset delimiters that can split a column of text into multiple
* columns.