update google-apps-script

generated by https://github.com/motemen/dts-google-apps-script
This commit is contained in:
motemen 2017-05-12 11:02:46 +09:00
parent ac9bfc4eec
commit 00251fcd75
28 changed files with 864 additions and 229 deletions

View File

@ -25,3 +25,9 @@ function createAndSendDocument() {
// Send yourself an email with a link to the document.
GmailApp.sendEmail(email, subject, body);
}
// Regression
ScriptApp.getService().getUrl();
CalendarApp.GuestStatus.NO;

View File

@ -1,9 +1,9 @@
// Type definitions for Google Apps Script 2015-11-12
// Type definitions for Google Apps Script 2017-05-12
// Project: https://developers.google.com/apps-script/
// Definitions by: motemen <https://github.com/motemen/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference path="google-apps-script.types.d.ts" />
declare namespace GoogleAppsScript {
export module Base {
@ -58,6 +58,8 @@ declare namespace GoogleAppsScript {
*
* JdbcClobA JDBC Clob.
*
* PositionedImageFixed position image anchored to a Paragraph.
*
* SpreadsheetThis class allows users to access and modify Google Sheets files.
*
* StaticMapAllows for the creation and decoration of static map images.
@ -68,7 +70,7 @@ declare namespace GoogleAppsScript {
}
/**
* This class provides access to Google Apps specific dialog boxes.
* This class provides access to G Suite specific dialog boxes.
*
* The methods in this class are only available for use in the context of a Google Spreadsheet.
* See also
@ -76,7 +78,7 @@ declare namespace GoogleAppsScript {
* ButtonSet
*/
export interface Browser {
Buttons: ButtonSet
Buttons: typeof ButtonSet;
inputBox(prompt: string): string;
inputBox(prompt: string, buttons: ButtonSet): string;
inputBox(title: string, prompt: string, buttons: ButtonSet): string;
@ -219,6 +221,7 @@ declare namespace GoogleAppsScript {
getActiveUserLocale(): string;
getEffectiveUser(): User;
getScriptTimeZone(): string;
getTemporaryActiveUserKey(): string;
getTimeZone(): string;
getUser(): User;
}
@ -244,8 +247,8 @@ declare namespace GoogleAppsScript {
* }
*/
export interface Ui {
Button: Button
ButtonSet: ButtonSet
Button: typeof Button;
ButtonSet: typeof ButtonSet;
alert(prompt: string): Button;
alert(prompt: string, buttons: ButtonSet): Button;
alert(title: string, prompt: string, buttons: ButtonSet): Button;

View File

@ -1,9 +1,9 @@
// Type definitions for Google Apps Script 2015-11-12
// Type definitions for Google Apps Script 2017-05-12
// Project: https://developers.google.com/apps-script/
// Definitions by: motemen <https://github.com/motemen/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference path="google-apps-script.types.d.ts" />
declare namespace GoogleAppsScript {
export module Cache {
@ -16,7 +16,7 @@ declare namespace GoogleAppsScript {
* to speed up access on an average request.
*
* function getRssFeed() {
* var cache = CacheService.getPublicCache();
* var cache = CacheService.getScriptCache();
* var cached = cache.get("rss-feed-contents");
* if (cached != null) {
* return cached;

View File

@ -1,10 +1,10 @@
// Type definitions for Google Apps Script 2015-11-12
// Type definitions for Google Apps Script 2017-05-12
// Project: https://developers.google.com/apps-script/
// Definitions by: motemen <https://github.com/motemen/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference path="google-apps-script.types.d.ts" />
/// <reference path="google-apps-script.base.d.ts" />
declare namespace GoogleAppsScript {
export module Calendar {
@ -51,11 +51,12 @@ declare namespace GoogleAppsScript {
* that the user owns or is subscribed to.
*/
export interface CalendarApp {
Color: Color
GuestStatus: GuestStatus
Month: Base.Month
Visibility: Visibility
Weekday: Base.Weekday
Color: typeof Color;
EventColor: typeof EventColor;
GuestStatus: typeof GuestStatus;
Month: typeof Base.Month;
Visibility: typeof Visibility;
Weekday: typeof Base.Weekday;
createAllDayEvent(title: string, date: Date): CalendarEvent;
createAllDayEvent(title: string, date: Date, options: Object): CalendarEvent;
createAllDayEventSeries(title: string, startDate: Date, recurrence: EventRecurrence): CalendarEventSeries;
@ -113,6 +114,7 @@ declare namespace GoogleAppsScript {
getAllDayEndDate(): Date;
getAllDayStartDate(): Date;
getAllTagKeys(): String[];
getColor(): string;
getCreators(): String[];
getDateCreated(): Date;
getDescription(): string;
@ -144,6 +146,7 @@ declare namespace GoogleAppsScript {
resetRemindersToDefault(): CalendarEvent;
setAllDayDate(date: Date): CalendarEvent;
setAnyoneCanAddSelf(anyoneCanAddSelf: boolean): CalendarEvent;
setColor(color: string): CalendarEvent;
setDescription(description: string): CalendarEvent;
setGuestsCanInviteOthers(guestsCanInviteOthers: boolean): CalendarEvent;
setGuestsCanModify(guestsCanModify: boolean): CalendarEvent;
@ -168,6 +171,7 @@ declare namespace GoogleAppsScript {
deleteEventSeries(): void;
deleteTag(key: string): CalendarEventSeries;
getAllTagKeys(): String[];
getColor(): string;
getCreators(): String[];
getDateCreated(): Date;
getDescription(): string;
@ -193,6 +197,7 @@ declare namespace GoogleAppsScript {
removeGuest(email: string): CalendarEventSeries;
resetRemindersToDefault(): CalendarEventSeries;
setAnyoneCanAddSelf(anyoneCanAddSelf: boolean): CalendarEventSeries;
setColor(color: string): CalendarEventSeries;
setDescription(description: string): CalendarEventSeries;
setGuestsCanInviteOthers(guestsCanInviteOthers: boolean): CalendarEventSeries;
setGuestsCanModify(guestsCanModify: boolean): CalendarEventSeries;
@ -211,6 +216,11 @@ declare namespace GoogleAppsScript {
*/
export enum Color { BLUE, BROWN, CHARCOAL, CHESTNUT, GRAY, GREEN, INDIGO, LIME, MUSTARD, OLIVE, ORANGE, PINK, PLUM, PURPLE, RED, RED_ORANGE, SEA_BLUE, SLATE, TEAL, TURQOISE, YELLOW }
/**
* An enum representing the named event colors available in the Calendar service.
*/
export enum EventColor { PALE_BLUE, PALE_GREEN, MAUVE, PALE_RED, YELLOW, ORANGE, CYAN, GRAY, BLUE, GREEN, RED }
/**
* Represents a guest of an event.
*/

View File

@ -1,11 +1,11 @@
// Type definitions for Google Apps Script 2015-11-12
// Type definitions for Google Apps Script 2017-05-12
// Project: https://developers.google.com/apps-script/
// Definitions by: motemen <https://github.com/motemen/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference path="google-apps-script.types.d.ts" />
/// <reference path="google-apps-script.base.d.ts" />
/// <reference path="google-apps-script.ui.d.ts" />
declare namespace GoogleAppsScript {
export module Charts {
@ -232,7 +232,7 @@ declare namespace GoogleAppsScript {
/**
* Chart types supported by the Charts service.
*/
export enum ChartType { AREA, BAR, COLUMN, LINE, PIE, SCATTER, TABLE }
export enum ChartType { AREA, BAR, COLUMN, COMBO, HISTOGRAM, LINE, PIE, SCATTER, TABLE }
/**
* Entry point for creating Charts in scripts.
@ -265,14 +265,14 @@ declare namespace GoogleAppsScript {
* }
*/
export interface Charts {
ChartType: ChartType
ColumnType: ColumnType
CurveStyle: CurveStyle
MatchType: MatchType
Orientation: Orientation
PickerValuesLayout: PickerValuesLayout
PointStyle: PointStyle
Position: Position
ChartType: typeof ChartType;
ColumnType: typeof ColumnType;
CurveStyle: typeof CurveStyle;
MatchType: typeof MatchType;
Orientation: typeof Orientation;
PickerValuesLayout: typeof PickerValuesLayout;
PointStyle: typeof PointStyle;
Position: typeof Position;
newAreaChart(): AreaChartBuilder;
newBarChart(): BarChartBuilder;
newCategoryFilter(): CategoryFilterBuilder;
@ -446,10 +446,10 @@ declare namespace GoogleAppsScript {
* }
*/
export interface DashboardPanel {
add(widget: UI.Widget): DashboardPanel;
getId(): string;
getType(): string;
setId(id: string): DashboardPanel;
add(widget: UI.Widget): DashboardPanel;
}
/**

View File

@ -1,10 +1,10 @@
// Type definitions for Google Apps Script 2015-11-12
// Type definitions for Google Apps Script 2017-05-12
// Project: https://developers.google.com/apps-script/
// Definitions by: motemen <https://github.com/motemen/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference path="google-apps-script.types.d.ts" />
/// <reference path="google-apps-script.base.d.ts" />
declare namespace GoogleAppsScript {
export module Contacts {
@ -136,12 +136,12 @@ declare namespace GoogleAppsScript {
* contacts listed therein.
*/
export interface ContactsApp {
ExtendedField: ExtendedField
Field: Field
Gender: Gender
Month: Base.Month
Priority: Priority
Sensitivity: Sensitivity
ExtendedField: typeof ExtendedField;
Field: typeof Field;
Gender: typeof Gender;
Month: typeof Base.Month;
Priority: typeof Priority;
Sensitivity: typeof Sensitivity;
createContact(givenName: string, familyName: string, email: string): Contact;
createContactGroup(name: string): ContactGroup;
deleteContact(contact: Contact): void;
@ -197,6 +197,11 @@ declare namespace GoogleAppsScript {
/**
* A date field in a Contact.
*
* This class is only used by the Contacts service, and dates used elsewhere in App Script use
* JavaScript's standard
*
* Date object.
*/
export interface DateField {
deleteDateField(): void;

View File

@ -1,9 +1,9 @@
// Type definitions for Google Apps Script 2015-11-12
// Type definitions for Google Apps Script 2017-05-12
// Project: https://developers.google.com/apps-script/
// Definitions by: motemen <https://github.com/motemen/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference path="google-apps-script.types.d.ts" />
declare namespace GoogleAppsScript {
export module Content {
@ -17,7 +17,7 @@ declare namespace GoogleAppsScript {
* }
*/
export interface ContentService {
MimeType: MimeType
MimeType: typeof MimeType;
createTextOutput(): TextOutput;
createTextOutput(content: string): TextOutput;
}
@ -37,7 +37,7 @@ declare namespace GoogleAppsScript {
* You can return text content like this:
*
* function doGet() {
* return ContentService.createPlainTextOutput("hello world!");
* return ContentService.createTextOutput("hello world!");
* }
*
* ContentService

View File

@ -1,10 +1,10 @@
// Type definitions for Google Apps Script 2015-11-12
// Type definitions for Google Apps Script 2017-05-12
// Project: https://developers.google.com/apps-script/
// Definitions by: motemen <https://github.com/motemen/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference path="google-apps-script.types.d.ts" />
/// <reference path="google-apps-script.base.d.ts" />
declare namespace GoogleAppsScript {
export module Document {
@ -64,6 +64,7 @@ declare namespace GoogleAppsScript {
getAttributes(): Object;
getChild(childIndex: Integer): Element;
getChildIndex(child: Element): Integer;
getHeadingAttributes(paragraphHeading: ParagraphHeading): Object;
getImages(): InlineImage[];
getListItems(): ListItem[];
getMarginBottom(): Number;
@ -94,6 +95,7 @@ declare namespace GoogleAppsScript {
removeChild(child: Element): Body;
replaceText(searchPattern: string, replacement: string): Element;
setAttributes(attributes: Object): Body;
setHeadingAttributes(paragraphHeading: ParagraphHeading, attributes: Object): Body;
setMarginBottom(marginBottom: Number): Body;
setMarginLeft(marginLeft: Number): Body;
setMarginRight(marginRight: Number): Body;
@ -230,14 +232,15 @@ declare namespace GoogleAppsScript {
* doc = DocumentApp.create('Document Name');
*/
export interface DocumentApp {
Attribute: Attribute
ElementType: ElementType
FontFamily: FontFamily
GlyphType: GlyphType
HorizontalAlignment: HorizontalAlignment
ParagraphHeading: ParagraphHeading
TextAlignment: TextAlignment
VerticalAlignment: VerticalAlignment
Attribute: typeof Attribute;
ElementType: typeof ElementType;
FontFamily: typeof FontFamily;
GlyphType: typeof GlyphType;
HorizontalAlignment: typeof HorizontalAlignment;
ParagraphHeading: typeof ParagraphHeading;
PositionedLayout: typeof PositionedLayout;
TextAlignment: typeof TextAlignment;
VerticalAlignment: typeof VerticalAlignment;
create(name: string): Document;
getActiveDocument(): Document;
getUi(): Base.Ui;
@ -737,6 +740,8 @@ declare namespace GoogleAppsScript {
*/
export interface InlineDrawing {
copy(): InlineDrawing;
getAltDescription(): string;
getAltTitle(): string;
getAttributes(): Object;
getNextSibling(): Element;
getParent(): ContainerElement;
@ -745,6 +750,8 @@ declare namespace GoogleAppsScript {
isAtDocumentEnd(): boolean;
merge(): InlineDrawing;
removeFromParent(): InlineDrawing;
setAltDescription(description: string): InlineDrawing;
setAltTitle(title: string): InlineDrawing;
setAttributes(attributes: Object): InlineDrawing;
}
@ -757,6 +764,8 @@ declare namespace GoogleAppsScript {
*/
export interface InlineImage {
copy(): InlineImage;
getAltDescription(): string;
getAltTitle(): string;
getAs(contentType: string): Base.Blob;
getAttributes(): Object;
getBlob(): Base.Blob;
@ -770,6 +779,8 @@ declare namespace GoogleAppsScript {
isAtDocumentEnd(): boolean;
merge(): InlineImage;
removeFromParent(): InlineImage;
setAltDescription(description: string): InlineImage;
setAltTitle(title: string): InlineImage;
setAttributes(attributes: Object): InlineImage;
setHeight(height: Integer): InlineImage;
setLinkUrl(url: string): InlineImage;
@ -810,6 +821,7 @@ declare namespace GoogleAppsScript {
* item2.setListId(item1);
*/
export interface ListItem {
addPositionedImage(image: Base.BlobSource): PositionedImage;
appendHorizontalRule(): HorizontalRule;
appendInlineImage(image: Base.BlobSource): InlineImage;
appendInlineImage(image: InlineImage): InlineImage;
@ -840,6 +852,8 @@ declare namespace GoogleAppsScript {
getNextSibling(): Element;
getNumChildren(): Integer;
getParent(): ContainerElement;
getPositionedImage(id: string): PositionedImage;
getPositionedImages(): PositionedImage[];
getPreviousSibling(): Element;
getSpacingAfter(): Number;
getSpacingBefore(): Number;
@ -858,6 +872,7 @@ declare namespace GoogleAppsScript {
merge(): ListItem;
removeChild(child: Element): ListItem;
removeFromParent(): ListItem;
removePositionedImage(id: string): boolean;
replaceText(searchPattern: string, replacement: string): Element;
setAlignment(alignment: HorizontalAlignment): ListItem;
setAttributes(attributes: Object): ListItem;
@ -945,6 +960,7 @@ declare namespace GoogleAppsScript {
* body.appendParagraph("This is a typical paragraph.");
*/
export interface Paragraph {
addPositionedImage(image: Base.BlobSource): PositionedImage;
appendHorizontalRule(): HorizontalRule;
appendInlineImage(image: Base.BlobSource): InlineImage;
appendInlineImage(image: InlineImage): InlineImage;
@ -972,6 +988,8 @@ declare namespace GoogleAppsScript {
getNextSibling(): Element;
getNumChildren(): Integer;
getParent(): ContainerElement;
getPositionedImage(id: string): PositionedImage;
getPositionedImages(): PositionedImage[];
getPreviousSibling(): Element;
getSpacingAfter(): Number;
getSpacingBefore(): Number;
@ -990,6 +1008,7 @@ declare namespace GoogleAppsScript {
merge(): Paragraph;
removeChild(child: Element): Paragraph;
removeFromParent(): Paragraph;
removePositionedImage(id: string): boolean;
replaceText(searchPattern: string, replacement: string): Element;
setAlignment(alignment: HorizontalAlignment): Paragraph;
setAttributes(attributes: Object): Paragraph;
@ -1059,6 +1078,54 @@ declare namespace GoogleAppsScript {
insertText(text: string): Text;
}
/**
* Fixed position image anchored to a Paragraph.
* Unlike an InlineImage,
* a PositionedImage is not an
* Element.
* It does not have a parent or sibling
* Element.
* Instead, it is anchored to a Paragraph
* or ListItem,
* and is placed via offsets from that anchor. A PositionedImage
* has an ID that can be used to reference it.
*
* var body = DocumentApp.getActiveDocument().getBody();
*
* // Append a new paragraph.
* var paragraph = body.appendParagraph("New paragraph to anchor the image to.");
*
* // Get an image in Drive from its ID.
* var image = DriveApp.getFileById('ENTER_IMAGE_FILE_ID_HERE').getBlob();
*
* // Add the PositionedImage with offsets (in points).
* var posImage = paragraph.addPositionedImage(image)
* .setTopOffset(60)
* .setLeftOffset(40);
*/
export interface PositionedImage {
getAs(contentType: string): Base.Blob;
getBlob(): Base.Blob;
getHeight(): Integer;
getId(): string;
getLayout(): PositionedLayout;
getLeftOffset(): Number;
getParagraph(): Paragraph;
getTopOffset(): Number;
getWidth(): Integer;
setHeight(height: Integer): PositionedImage;
setLayout(layout: PositionedLayout): PositionedImage;
setLeftOffset(offset: Number): PositionedImage;
setTopOffset(offset: Number): PositionedImage;
setWidth(width: Integer): PositionedImage;
}
/**
* An enumeration that specifies how to lay out a PositionedImage in
* relation to surrounding text.
*/
export enum PositionedLayout { ABOVE_TEXT, BREAK_BOTH, BREAK_LEFT, BREAK_RIGHT, WRAP_TEXT }
/**
* A range of elements in a document. The user's selection is represented as a
* Range, among other uses. Scripts can only access the selection of the user who is running
@ -1215,6 +1282,7 @@ declare namespace GoogleAppsScript {
getBackgroundColor(): string;
getChild(childIndex: Integer): Element;
getChildIndex(child: Element): Integer;
getColSpan(): Integer;
getLinkUrl(): string;
getNextSibling(): Element;
getNumChildren(): Integer;
@ -1226,6 +1294,7 @@ declare namespace GoogleAppsScript {
getParentRow(): TableRow;
getParentTable(): Table;
getPreviousSibling(): Element;
getRowSpan(): Integer;
getText(): string;
getTextAlignment(): TextAlignment;
getType(): ElementType;

View File

@ -1,10 +1,10 @@
// Type definitions for Google Apps Script 2015-11-12
// Type definitions for Google Apps Script 2017-05-12
// Project: https://developers.google.com/apps-script/
// Definitions by: motemen <https://github.com/motemen/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference path="google-apps-script.types.d.ts" />
/// <reference path="google-apps-script.base.d.ts" />
declare namespace GoogleAppsScript {
export module Drive {
@ -14,8 +14,7 @@ declare namespace GoogleAppsScript {
* DriveApp.Access.
*
* // Creates a folder that anyone on the Internet can read from and write to. (Domain
* // administrators can prohibit this setting for users of Google Apps for Business, Google Apps
* // for Education, or Google Apps for Your Domain.)
* // administrators can prohibit this setting for users of a G Suite domain.)
* var folder = DriveApp.createFolder('Shared Folder');
* folder.setSharing(DriveApp.Access.ANYONE, DriveApp.Permission.EDIT);
*/
@ -32,8 +31,8 @@ declare namespace GoogleAppsScript {
* }
*/
export interface DriveApp {
Access: Access
Permission: Permission
Access: typeof Access;
Permission: typeof Permission;
addFile(child: File): Folder;
addFolder(child: Folder): Folder;
continueFileIterator(continuationToken: string): FileIterator;
@ -234,12 +233,11 @@ declare namespace GoogleAppsScript {
* DriveApp.Permission.
*
* // Creates a folder that anyone on the Internet can read from and write to. (Domain
* // administrators can prohibit this setting for users of Google Apps for Business, Google Apps
* // for Education, or Google Apps for Your Domain.)
* // administrators can prohibit this setting for users of a G Suite domain.)
* var folder = DriveApp.createFolder('Shared Folder');
* folder.setSharing(DriveApp.Access.ANYONE, DriveApp.Permission.EDIT);
*/
export enum Permission { VIEW, EDIT, COMMENT, OWNER, NONE }
export enum Permission { VIEW, EDIT, COMMENT, OWNER, ORGANIZER, NONE }
/**
* A user associated with a file in Google Drive. Users can be accessed from

View File

@ -1,10 +1,10 @@
// Type definitions for Google Apps Script 2015-11-12
// Type definitions for Google Apps Script 2017-05-12
// Project: https://developers.google.com/apps-script/
// Definitions by: motemen <https://github.com/motemen/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference path="google-apps-script.types.d.ts" />
/// <reference path="google-apps-script.base.d.ts" />
declare namespace GoogleAppsScript {
export module Forms {
@ -22,8 +22,9 @@ declare namespace GoogleAppsScript {
export enum Alignment { LEFT, CENTER, RIGHT }
/**
* A question item that allows the respondent to select one or more checkboxes, as well as an
* optional "other" field. Items can be accessed or created from a Form.
* A question item that allows the respondent to select one or more checkboxes, as well
* as an optional "other" field. Items can be accessed or created from a Form. When used in
* a quiz, these items are autograded.
*
* // Open a form by ID and add a new checkbox item.
* var form = FormApp.openById('1234567890abcdefghijklmnopqrstuvwxyz');
@ -37,25 +38,81 @@ declare namespace GoogleAppsScript {
* .showOtherOption(true);
*/
export interface CheckboxItem {
clearValidation(): CheckboxItem;
createChoice(value: string): Choice;
createChoice(value: string, isCorrect: boolean): Choice;
createResponse(responses: String[]): ItemResponse;
duplicate(): CheckboxItem;
getChoices(): Choice[];
getFeedbackForCorrect(): QuizFeedback;
getFeedbackForIncorrect(): QuizFeedback;
getHelpText(): string;
getId(): Integer;
getIndex(): Integer;
getPoints(): Integer;
getTitle(): string;
getType(): ItemType;
hasOtherOption(): boolean;
isRequired(): boolean;
setChoiceValues(values: String[]): CheckboxItem;
setChoices(choices: Choice[]): CheckboxItem;
setFeedbackForCorrect(feedback: QuizFeedback): CheckboxItem;
setFeedbackForIncorrect(feedback: QuizFeedback): CheckboxItem;
setHelpText(text: string): CheckboxItem;
setPoints(points: Integer): CheckboxItem;
setRequired(enabled: boolean): CheckboxItem;
setTitle(title: string): CheckboxItem;
setValidation(validation: CheckboxValidation): CheckboxItem;
showOtherOption(enabled: boolean): CheckboxItem;
}
/**
* A DataValidation for a CheckboxItem.
*
* // Add a checkBox item to a form and require exactly two selections.
* var checkBoxItem = form.addCheckboxItem();
* checkBoxItem.setTitle('What two condiments would you like on your hot dog?');
* checkBoxItem.setChoices([
* checkBoxItem.createChoice('Ketchup'),
* checkBoxItem.createChoice('Mustard'),
* checkBoxItem.createChoice('Relish')
* ]);
* var checkBoxValidation = FormApp.createCheckboxValidation()
* .setHelpText(Select two condiments.)
* .requireSelectExactly(2)
* .build();
* checkBoxItem.setValidation(checkBoxValidation);
*/
export interface CheckboxValidation {
getHelpText(): string;
}
/**
* A DataValidationBuilder for a CheckboxValidation.
*
* // Add a checkBox item to a form and require exactly two selections.
* var checkBoxItem = form.addCheckboxItem();
* checkBoxItem.setTitle('What two condiments would you like on your hot dog?');
* checkBoxItem.setChoices([
* checkBoxItem.createChoice('Ketchup'),
* checkBoxItem.createChoice('Mustard'),
* checkBoxItem.createChoice('Relish')
* ]);
* var checkBoxValidation = FormApp.createCheckboxValidation()
* .setHelpText(Select two condiments.)
* .requireSelectExactly(2)
* .build();
* checkBoxItem.setValidation(checkBoxValidation);
*/
export interface CheckboxValidationBuilder {
build(): CheckboxValidation;
copy(): CheckboxValidationBuilder;
requireSelectAtLeast(number: Integer): CheckboxValidationBuilder;
requireSelectAtMost(number: Integer): CheckboxValidationBuilder;
requireSelectExactly(number: Integer): CheckboxValidationBuilder;
setHelpText(text: string): CheckboxValidationBuilder;
}
/**
* A single choice associated with a type of Item that supports choices, like
* CheckboxItem, ListItem, or MultipleChoiceItem.
@ -84,11 +141,45 @@ declare namespace GoogleAppsScript {
getGotoPage(): PageBreakItem;
getPageNavigationType(): PageNavigationType;
getValue(): string;
isCorrectAnswer(): boolean;
}
/**
* A question item that allows the respondent to indicate a date. Items can be accessed or created
* from a Form.
* The base DataValidation that contains properties common to all validations, such as help text.
* Validations can be added to certain Form items.
*
* // Add a text item to a form and require it to be a number within a range.
* var textItem = form.addTextItem().setTitle('Pick a number between 1 and 100?');
* var textValidation = FormApp.createTextValidation()
* .setHelpText(Input was not a number between 1 and 100.)
* .requireNumberBetween(1, 100);
* textItem.setValidation(textValidation);
*/
export interface DataValidation {
getHelpText(): string;
}
/**
* The base DataValidationBuilder that contains setters for properties common to all validations,
* such as help text. Used to build DataValadation objects.
*
* // Add a text item to a form and require it to be a number within a range.
* var textItem = form.addTextItem().setTitle('Pick a number between 1 and 100?');
* var textValidation = FormApp.createTextValidation()
* .setHelpText(Input was not a number between 1 and 100.)
* .requireNumberBetween(1, 100)
* .build();
* textItem.setValidation(textValidation);
*/
export interface DataValidationBuilder {
build(): DataValidation;
copy(): DataValidationBuilder;
setHelpText(text: string): DataValidationBuilder;
}
/**
* A question item that allows the respondent to indicate a date. Items can be accessed or
* created from a Form. When used in a quiz, these items are graded.
*
* // Open a form by ID and add a new date item.
* var form = FormApp.openById('1234567890abcdefghijklmnopqrstuvwxyz');
@ -98,22 +189,26 @@ declare namespace GoogleAppsScript {
export interface DateItem {
createResponse(response: Date): ItemResponse;
duplicate(): DateItem;
getGeneralFeedback(): QuizFeedback;
getHelpText(): string;
getId(): Integer;
getIndex(): Integer;
getPoints(): Integer;
getTitle(): string;
getType(): ItemType;
includesYear(): boolean;
isRequired(): boolean;
setGeneralFeedback(feedback: QuizFeedback): DateItem;
setHelpText(text: string): DateItem;
setIncludesYear(enableYear: boolean): DateItem;
setPoints(points: Integer): DateItem;
setRequired(enabled: boolean): DateItem;
setTitle(title: string): DateItem;
}
/**
* A question item that allows the respondent to indicate a date and time. Items can be accessed or
* created from a Form.
* A question item that allows the respondent to indicate a date and time. Items can be
* accessed or created from a Form. When used in a quiz, these items are graded.
*
* // Open a form by ID and add a new date-time item.
* var form = FormApp.openById('1234567890abcdefghijklmnopqrstuvwxyz');
@ -123,15 +218,19 @@ declare namespace GoogleAppsScript {
export interface DateTimeItem {
createResponse(response: Date): ItemResponse;
duplicate(): DateTimeItem;
getGeneralFeedback(): QuizFeedback;
getHelpText(): string;
getId(): Integer;
getIndex(): Integer;
getPoints(): Integer;
getTitle(): string;
getType(): ItemType;
includesYear(): boolean;
isRequired(): boolean;
setGeneralFeedback(feedback: QuizFeedback): DateTimeItem;
setHelpText(text: string): DateTimeItem;
setIncludesYear(enableYear: boolean): DateTimeItem;
setPoints(points: Integer): DateTimeItem;
setRequired(enabled: boolean): DateTimeItem;
setTitle(title: string): DateTimeItem;
}
@ -153,8 +252,8 @@ declare namespace GoogleAppsScript {
export enum DestinationType { SPREADSHEET }
/**
* A question item that allows the respondent to indicate a length of time. Items can be accessed or
* created from a Form.
* A question item that allows the respondent to indicate a length of time. Items can be
* accessed or created from a Form. When used in a quiz, these items are graded.
*
* // Open a form by ID and add a new duration item.
* var form = FormApp.openById('1234567890abcdefghijklmnopqrstuvwxyz');
@ -164,21 +263,44 @@ declare namespace GoogleAppsScript {
export interface DurationItem {
createResponse(hours: Integer, minutes: Integer, seconds: Integer): ItemResponse;
duplicate(): DurationItem;
getGeneralFeedback(): QuizFeedback;
getHelpText(): string;
getId(): Integer;
getIndex(): Integer;
getPoints(): Integer;
getTitle(): string;
getType(): ItemType;
isRequired(): boolean;
setGeneralFeedback(feedback: QuizFeedback): DurationItem;
setHelpText(text: string): DurationItem;
setPoints(points: Integer): DurationItem;
setRequired(enabled: boolean): DurationItem;
setTitle(title: string): DurationItem;
}
/**
* A form that contains overall properties (such as title, settings, and where responses are stored)
* and items (which includes question items like checkboxes and layout items like page breaks).
* Forms can be accessed or created from FormApp.
* An enum representing the supported types of feedback. Feedback types can be accessed from
* FormApp.FeedbackType.
*
* // Open a form by ID and add a new list item.
* var form = FormApp.openById('1234567890abcdefghijklmnopqrstuvwxyz');
* var item = form.addListItem();
* item.setTitle('Do you prefer cats or dogs?');
* // Set "Dogs" as the correct answer to this question.
* item.setChoices([
* item.createChoice('Dogs', true),
* item.createChoice('Cats', false)]);
* // Add feedback which will be shown for correct responses; ie "Dogs".
* item.setFeedbackForCorrect(
* FormApp.createFeedback().setDisplayText("Dogs rule, cats drool.").build());
*/
export enum FeedbackType { CORRECT, INCORRECT, GENERAL }
/**
* A form that contains overall properties and items. Properties include title, settings, and
* where responses are stored. Items include question items like checkboxes or radio items, while
* layout items refer to things like page breaks. Forms can be accessed or created from
* FormApp.
*
* // Open a form by ID and create a new spreadsheet.
* var form = FormApp.openById('1234567890abcdefghijklmnopqrstuvwxyz');
@ -242,6 +364,7 @@ declare namespace GoogleAppsScript {
hasRespondAgainLink(): boolean;
isAcceptingResponses(): boolean;
isPublishingSummary(): boolean;
isQuiz(): boolean;
moveItem(from: Integer, to: Integer): Item;
moveItem(item: Item, toIndex: Integer): Item;
removeDestination(): Form;
@ -255,6 +378,7 @@ declare namespace GoogleAppsScript {
setCustomClosedFormMessage(message: string): Form;
setDescription(description: string): Form;
setDestination(type: DestinationType, id: string): Form;
setIsQuiz(enabled: boolean): Form;
setLimitOneResponsePerUser(enabled: boolean): Form;
setProgressBar(enabled: boolean): Form;
setPublishingSummary(enabled: boolean): Form;
@ -263,10 +387,11 @@ declare namespace GoogleAppsScript {
setShuffleQuestions(shuffle: boolean): Form;
setTitle(title: string): Form;
shortenFormUrl(url: string): string;
submitGrades(responses: FormResponse[]): Form;
}
/**
* Allows a script to open existing Forms or create new ones.
* Allows a script to open an existing Form or create a new one.
*
* // Open a form by ID.
* var existingForm = FormApp.openById('1234567890abcdefghijklmnopqrstuvwxyz');
@ -275,11 +400,17 @@ declare namespace GoogleAppsScript {
* var newForm = FormApp.create('Form Name');
*/
export interface FormApp {
Alignment: Alignment
DestinationType: DestinationType
ItemType: ItemType
PageNavigationType: PageNavigationType
Alignment: typeof Alignment;
DestinationType: typeof DestinationType;
FeedbackType: typeof FeedbackType;
ItemType: typeof ItemType;
PageNavigationType: typeof PageNavigationType;
create(title: string): Form;
createCheckboxValidation(): CheckboxValidationBuilder;
createFeedback(): QuizFeedbackBuilder;
createGridValidation(): GridValidationBuilder;
createParagraphTextValidation(): ParagraphTextValidationBuilder;
createTextValidation(): TextValidationBuilder;
getActiveForm(): Form;
getUi(): Base.Ui;
openById(id: string): Form;
@ -287,11 +418,11 @@ declare namespace GoogleAppsScript {
}
/**
* A response to the form as a whole. Form responses have three main uses: they contain the answers
* submitted by a respondent (see getItemResponses(), they can be used to programmatically
* respond to the form (see withItemResponse(response) and submit()), and they
* can be used as a template to create a URL for the form with pre-filled answers. Form responses
* can be created or accessed from a Form.
* A response to the form as a whole. A FormResponse can be used in three ways: to
* access the answers submitted by a respondent (see getItemResponses()), to
* programmatically submit a response to the form (see withItemResponse(response) and
* submit()), and to generate a URL for the form which pre-fills fields using the
* provided answers. FormResponses can be created or accessed from a Form.
*
* // Open a form by ID and log the responses to each question.
* var form = FormApp.openById('1234567890abcdefghijklmnopqrstuvwxyz');
@ -310,6 +441,8 @@ declare namespace GoogleAppsScript {
*/
export interface FormResponse {
getEditResponseUrl(): string;
getGradableItemResponses(): ItemResponse[];
getGradableResponseForItem(item: Item): ItemResponse;
getId(): string;
getItemResponses(): ItemResponse[];
getRespondentEmail(): string;
@ -317,13 +450,14 @@ declare namespace GoogleAppsScript {
getTimestamp(): Date;
submit(): FormResponse;
toPrefilledUrl(): string;
withItemGrade(gradedResponse: ItemResponse): FormResponse;
withItemResponse(response: ItemResponse): FormResponse;
}
/**
* A question item, presented as a grid of columns and rows, that allows the respondent to select
* one choice per row from a sequence of radio buttons. Items can be accessed or created from a
* Form.
* Form.
*
* // Open a form by ID and add a new grid item.
* var form = FormApp.openById('1234567890abcdefghijklmnopqrstuvwxyz');
@ -333,6 +467,7 @@ declare namespace GoogleAppsScript {
* .setColumns(['Boring', 'So-so', 'Interesting']);
*/
export interface GridItem {
clearValidation(): GridItem;
createResponse(responses: String[]): ItemResponse;
duplicate(): GridItem;
getColumns(): String[];
@ -348,6 +483,46 @@ declare namespace GoogleAppsScript {
setRequired(enabled: boolean): GridItem;
setRows(rows: String[]): GridItem;
setTitle(title: string): GridItem;
setValidation(validation: GridValidation): GridItem;
}
/**
* A DataValidation for a GridItem.
*
* // Add a grid item to a form and require one response per column.
* var gridItem = form.addGridItem();
* gridItem.setTitle('Rate your interests')
* .setRows(['Cars', 'Computers', 'Celebrities'])
* .setColumns(['Boring', 'So-so', 'Interesting']);
* var gridValidation = FormApp.createGridValidation()
* .setHelpText(Select one item per column.)
* .requireLimitOneResponsePerColumn()
* .build();
* gridItem.setValidation(gridValidation);
*/
export interface GridValidation {
getHelpText(): string;
}
/**
* A DataValidationBuilder for a GridValidation.
*
* // Add a grid item to a form and require one response per column.
* var gridItem = form.addGridItem();
* gridItem.setTitle('Rate your interests')
* .setRows(['Cars', 'Computers', 'Celebrities'])
* .setColumns(['Boring', 'So-so', 'Interesting']);
* var gridValidation = FormApp.createGridValidation()
* .setHelpText(Select one item per column.)
* .requireLimitOneResponsePerColumn()
* .build();
* gridItem.setValidation(gridValidation);
*/
export interface GridValidationBuilder {
build(): GridValidation;
copy(): GridValidationBuilder;
requireLimitOneResponsePerColumn(): GridValidationBuilder;
setHelpText(text: string): GridValidationBuilder;
}
/**
@ -447,8 +622,12 @@ declare namespace GoogleAppsScript {
* }
*/
export interface ItemResponse {
getFeedback(): Object;
getItem(): Item;
getResponse(): Object;
getScore(): Object;
setFeedback(feedback: Object): ItemResponse;
setScore(score: Object): ItemResponse;
}
/**
@ -482,27 +661,35 @@ declare namespace GoogleAppsScript {
*/
export interface ListItem {
createChoice(value: string): Choice;
createChoice(value: string, isCorrect: boolean): Choice;
createChoice(value: string, navigationItem: PageBreakItem): Choice;
createChoice(value: string, navigationType: PageNavigationType): Choice;
createResponse(response: string): ItemResponse;
duplicate(): ListItem;
getChoices(): Choice[];
getFeedbackForCorrect(): QuizFeedback;
getFeedbackForIncorrect(): QuizFeedback;
getHelpText(): string;
getId(): Integer;
getIndex(): Integer;
getPoints(): Integer;
getTitle(): string;
getType(): ItemType;
isRequired(): boolean;
setChoiceValues(values: String[]): ListItem;
setChoices(choices: Choice[]): ListItem;
setFeedbackForCorrect(feedback: QuizFeedback): ListItem;
setFeedbackForIncorrect(feedback: QuizFeedback): ListItem;
setHelpText(text: string): ListItem;
setPoints(points: Integer): ListItem;
setRequired(enabled: boolean): ListItem;
setTitle(title: string): ListItem;
}
/**
* A question item that allows the respondent to select one choice from a list of radio buttons or
* an optional "other" field. Items can be accessed or created from a Form.
* A question item that allows the respondent to select one choice from a list of radio
* buttons or an optional "other" field. Items can be accessed or created from a Form.
* When used in a quiz, these items are autograded.
*
* // Open a form by ID and add a new multiple choice item.
* var form = FormApp.openById('1234567890abcdefghijklmnopqrstuvwxyz');
@ -516,21 +703,28 @@ declare namespace GoogleAppsScript {
*/
export interface MultipleChoiceItem {
createChoice(value: string): Choice;
createChoice(value: string, isCorrect: boolean): Choice;
createChoice(value: string, navigationItem: PageBreakItem): Choice;
createChoice(value: string, navigationType: PageNavigationType): Choice;
createResponse(response: string): ItemResponse;
duplicate(): MultipleChoiceItem;
getChoices(): Choice[];
getFeedbackForCorrect(): QuizFeedback;
getFeedbackForIncorrect(): QuizFeedback;
getHelpText(): string;
getId(): Integer;
getIndex(): Integer;
getPoints(): Integer;
getTitle(): string;
getType(): ItemType;
hasOtherOption(): boolean;
isRequired(): boolean;
setChoiceValues(values: String[]): MultipleChoiceItem;
setChoices(choices: Choice[]): MultipleChoiceItem;
setFeedbackForCorrect(feedback: QuizFeedback): MultipleChoiceItem;
setFeedbackForIncorrect(feedback: QuizFeedback): MultipleChoiceItem;
setHelpText(text: string): MultipleChoiceItem;
setPoints(points: Integer): MultipleChoiceItem;
setRequired(enabled: boolean): MultipleChoiceItem;
setTitle(title: string): MultipleChoiceItem;
showOtherOption(enabled: boolean): MultipleChoiceItem;
@ -593,8 +787,8 @@ declare namespace GoogleAppsScript {
export enum PageNavigationType { CONTINUE, GO_TO_PAGE, RESTART, SUBMIT }
/**
* A question item that allows the respondent to enter a block of text. Items can be accessed or
* created from a Form.
* A question item that allows the respondent to enter a block of text. Items can be
* accessed or created from a Form. When used in a quiz, these items are graded.
*
* // Open a form by ID and add a new paragraph text item.
* var form = FormApp.openById('1234567890abcdefghijklmnopqrstuvwxyz');
@ -602,22 +796,107 @@ declare namespace GoogleAppsScript {
* item.setTitle('What is your address?');
*/
export interface ParagraphTextItem {
clearValidation(): ParagraphTextItem;
createResponse(response: string): ItemResponse;
duplicate(): ParagraphTextItem;
getGeneralFeedback(): QuizFeedback;
getHelpText(): string;
getId(): Integer;
getIndex(): Integer;
getPoints(): Integer;
getTitle(): string;
getType(): ItemType;
isRequired(): boolean;
setGeneralFeedback(feedback: QuizFeedback): ParagraphTextItem;
setHelpText(text: string): ParagraphTextItem;
setPoints(points: Integer): ParagraphTextItem;
setRequired(enabled: boolean): ParagraphTextItem;
setTitle(title: string): ParagraphTextItem;
setValidation(validation: ParagraphTextValidation): ParagraphTextItem;
}
/**
* A question item that allows the respondent to choose one option from a numbered sequence of radio
* buttons. Items can be accessed or created from a Form.
* A DataValidation for a ParagraphTextItem.
*
* // Add a paragraph text item to a form and require the answer to be at least 100 characters.
* var paragraphTextItem = form.addParagraphTextItem().setTitle('Describe yourself:');
* var paragraphtextValidation = FormApp.createParagraphTextValidation()
* .setHelpText(Answer must be more than 100 characters.)
* .requireTextLengthGreatherThan(100);
* paragraphTextItem.setValidation(paragraphtextValidation);
*/
export interface ParagraphTextValidation {
getHelpText(): string;
}
/**
* A DataValidationBuilder for a ParagraphTextValidation.
*
* // Add a paragraph text item to a form and require the answer to be at least 100 characters.
* var paragraphTextItem = form.addParagraphTextItem().setTitle('Describe yourself:');
* var paragraphtextValidation = FormApp.createParagraphTextValidation()
* .setHelpText(Answer must be more than 100 characters.)
* .requireTextLengthGreatherThan(100);
* paragraphTextItem.setValidation(paragraphtextValidation);
*/
export interface ParagraphTextValidationBuilder {
build(): ParagraphTextValidation;
copy(): ParagraphTextValidationBuilder;
requireTextContainsPattern(pattern: string): ParagraphTextValidationBuilder;
requireTextDoesNotContainPattern(pattern: string): ParagraphTextValidationBuilder;
requireTextDoesNotMatchPattern(pattern: string): ParagraphTextValidationBuilder;
requireTextLengthGreaterThanOrEqualTo(number: Integer): ParagraphTextValidationBuilder;
requireTextLengthLessThanOrEqualTo(number: Integer): ParagraphTextValidationBuilder;
requireTextMatchesPattern(pattern: string): ParagraphTextValidationBuilder;
setHelpText(text: string): ParagraphTextValidationBuilder;
}
/**
* The bean implementation of a Feedback, which contains properties common to all feedback, such as
* display text or links.
*
* Feedback can be added to gradeable Form items.
*
* // Setting feedback which should be automatically shown when a user responds to a question
* // incorrectly.
* var textItem = form.addTextItem().setTitle('Re-hydrating dried fruit is an example of what?');
* var feedback = FormApp.createFeedback()
* .setDisplayText(
* Good answer, but not quite right. Please review chapter 4 before next time.)
* .addLink("http://wikipedia.com/osmosis");
* textItem.setFeedbackForIncorrect(feedback);
*/
export interface QuizFeedback {
getLinkUrls(): String[];
getText(): string;
}
/**
* The base FeedbackBuilder that contains setters for properties common to all feedback,
* such as display text. Used to build Feedback objects.
*
* // Open a form by ID and add a new list item.
* var form = FormApp.openById('1234567890abcdefghijklmnopqrstuvwxyz');
* var item = form.addListItem();
* item.setTitle('Do you prefer cats or dogs?');
* item.setChoices([
* item.createChoice('Dogs', true),
* item.createChoice('Cats', false)]);
* // Add feedback which will be shown for correct responses; ie "Dogs".
* item.setFeedbackForCorrect(FormApp.createFeedback().setText("Dogs rule, cats drool.").build());
*/
export interface QuizFeedbackBuilder {
addLink(url: string): QuizFeedbackBuilder;
addLink(url: string, displayText: string): QuizFeedbackBuilder;
build(): QuizFeedback;
copy(): QuizFeedbackBuilder;
setText(text: string): QuizFeedbackBuilder;
}
/**
* A question item that allows the respondent to choose one option from a numbered sequence
* of radio buttons. Items can be accessed or created from a Form. When used in a quiz,
* these items are graded.
*
* // Open a form by ID and add a new scale item.
* var form = FormApp.openById('1234567890abcdefghijklmnopqrstuvwxyz');
@ -628,19 +907,23 @@ declare namespace GoogleAppsScript {
export interface ScaleItem {
createResponse(response: Integer): ItemResponse;
duplicate(): ScaleItem;
getGeneralFeedback(): QuizFeedback;
getHelpText(): string;
getId(): Integer;
getIndex(): Integer;
getLeftLabel(): string;
getLowerBound(): Integer;
getPoints(): Integer;
getRightLabel(): string;
getTitle(): string;
getType(): ItemType;
getUpperBound(): Integer;
isRequired(): boolean;
setBounds(lower: Integer, upper: Integer): ScaleItem;
setGeneralFeedback(feedback: QuizFeedback): ScaleItem;
setHelpText(text: string): ScaleItem;
setLabels(lower: string, upper: string): ScaleItem;
setPoints(points: Integer): ScaleItem;
setRequired(enabled: boolean): ScaleItem;
setTitle(title: string): ScaleItem;
}
@ -666,8 +949,8 @@ declare namespace GoogleAppsScript {
}
/**
* A question item that allows the respondent to enter a single line of text. Items can be accessed
* or created from a Form.
* A question item that allows the respondent to enter a single line of text. Items can be
* accessed or created from a Form. When used in a quiz, these items are graded.
*
* // Open a form by ID and add a new text item.
* var form = FormApp.openById('1234567890abcdefghijklmnopqrstuvwxyz');
@ -675,22 +958,77 @@ declare namespace GoogleAppsScript {
* item.setTitle('What is your name?');
*/
export interface TextItem {
clearValidation(): TextItem;
createResponse(response: string): ItemResponse;
duplicate(): TextItem;
getGeneralFeedback(): QuizFeedback;
getHelpText(): string;
getId(): Integer;
getIndex(): Integer;
getPoints(): Integer;
getTitle(): string;
getType(): ItemType;
isRequired(): boolean;
setGeneralFeedback(feedback: QuizFeedback): TextItem;
setHelpText(text: string): TextItem;
setPoints(points: Integer): TextItem;
setRequired(enabled: boolean): TextItem;
setTitle(title: string): TextItem;
setValidation(validation: TextValidation): TextItem;
}
/**
* A question item that allows the respondent to indicate a time of day. Items can be accessed or
* created from a Form.
* A DataValidation for a TextItem.
*
* // Add a text item to a form and require it to be a number within a range.
* var textItem = form.addTextItem().setTitle('Pick a number between 1 and 100?');
* var textValidation = FormApp.createTextValidation()
* .setHelpText(Input was not a number between 1 and 100.)
* .requireNumberBetween(1, 100)
* .build();
* textItem.setValidation(textValidation);
*/
export interface TextValidation {
getHelpText(): string;
}
/**
* A DataValidationBuilder for a TextValidation.
*
* // Add a text item to a form and require it to be a number within a range.
* var textItem = form.addTextItem().setTitle('Pick a number between 1 and 100?');
* var textValidation = FormApp.createTextValidation()
* .setHelpText(Input was not a number between 1 and 100.)
* .requireNumberBetween(1, 100);
* textItem.setValidation(textValidation);
*/
export interface TextValidationBuilder {
build(): TextValidation;
copy(): TextValidationBuilder;
requireNumber(): TextValidationBuilder;
requireNumberBetween(start: Number, end: Number): TextValidationBuilder;
requireNumberEqualTo(number: Number): TextValidationBuilder;
requireNumberGreaterThan(number: Number): TextValidationBuilder;
requireNumberGreaterThanOrEqualTo(number: Number): TextValidationBuilder;
requireNumberLessThan(number: Number): TextValidationBuilder;
requireNumberLessThanOrEqualTo(number: Number): TextValidationBuilder;
requireNumberNotBetween(start: Number, end: Number): TextValidationBuilder;
requireNumberNotEqualTo(number: Number): TextValidationBuilder;
requireTextContainsPattern(pattern: string): TextValidationBuilder;
requireTextDoesNotContainPattern(pattern: string): TextValidationBuilder;
requireTextDoesNotMatchPattern(pattern: string): TextValidationBuilder;
requireTextIsEmail(): TextValidationBuilder;
requireTextIsUrl(): TextValidationBuilder;
requireTextLengthGreaterThanOrEqualTo(number: Integer): TextValidationBuilder;
requireTextLengthLessThanOrEqualTo(number: Integer): TextValidationBuilder;
requireTextMatchesPattern(pattern: string): TextValidationBuilder;
requireWholeNumber(): TextValidationBuilder;
setHelpText(text: string): TextValidationBuilder;
}
/**
* A question item that allows the respondent to indicate a time of day. Items can be
* accessed or created from a Form. When used in a quiz, these items are graded.
*
* // Open a form by ID and add a new time item.
* var form = FormApp.openById('1234567890abcdefghijklmnopqrstuvwxyz');
@ -700,13 +1038,17 @@ declare namespace GoogleAppsScript {
export interface TimeItem {
createResponse(hour: Integer, minute: Integer): ItemResponse;
duplicate(): TimeItem;
getGeneralFeedback(): QuizFeedback;
getHelpText(): string;
getId(): Integer;
getIndex(): Integer;
getPoints(): Integer;
getTitle(): string;
getType(): ItemType;
isRequired(): boolean;
setGeneralFeedback(feedback: QuizFeedback): TimeItem;
setHelpText(text: string): TimeItem;
setPoints(points: Integer): TimeItem;
setRequired(enabled: boolean): TimeItem;
setTitle(title: string): TimeItem;
}

View File

@ -1,10 +1,10 @@
// Type definitions for Google Apps Script 2015-11-12
// Type definitions for Google Apps Script 2017-05-12
// Project: https://developers.google.com/apps-script/
// Definitions by: motemen <https://github.com/motemen/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference path="google-apps-script.types.d.ts" />
/// <reference path="google-apps-script.base.d.ts" />
declare namespace GoogleAppsScript {
export module Gmail {

View File

@ -1,10 +1,10 @@
// Type definitions for Google Apps Script 2015-11-12
// Type definitions for Google Apps Script 2017-05-12
// Project: https://developers.google.com/apps-script/
// Definitions by: motemen <https://github.com/motemen/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference path="google-apps-script.types.d.ts" />
/// <reference path="google-apps-script.base.d.ts" />
declare namespace GoogleAppsScript {
export module Groups {
@ -46,7 +46,7 @@ declare namespace GoogleAppsScript {
* Logger.log('You belong to ' + groups.length + ' groups.');
*/
export interface GroupsApp {
Role: Role
Role: typeof Role;
getGroupByEmail(email: string): Group;
getGroups(): Group[];
}

View File

@ -1,10 +1,10 @@
// Type definitions for Google Apps Script 2015-11-12
// Type definitions for Google Apps Script 2017-05-12
// Project: https://developers.google.com/apps-script/
// Definitions by: motemen <https://github.com/motemen/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference path="google-apps-script.types.d.ts" />
/// <reference path="google-apps-script.base.d.ts" />
declare namespace GoogleAppsScript {
export module HTML {
@ -22,6 +22,7 @@ declare namespace GoogleAppsScript {
* guide to restrictions in HTML service
*/
export interface HtmlOutput {
addMetaTag(name: string, content: string): HtmlOutput;
append(addedContent: string): HtmlOutput;
appendUntrusted(addedContent: string): HtmlOutput;
asTemplate(): HtmlTemplate;
@ -29,14 +30,33 @@ declare namespace GoogleAppsScript {
getAs(contentType: string): Base.Blob;
getBlob(): Base.Blob;
getContent(): string;
getFaviconUrl(): string;
getHeight(): Integer;
getMetaTags(): HtmlOutputMetaTag[];
getTitle(): string;
getWidth(): Integer;
setContent(content: string): HtmlOutput;
setFaviconUrl(iconUrl: string): HtmlOutput;
setHeight(height: Integer): HtmlOutput;
setSandboxMode(mode: SandboxMode): HtmlOutput;
setTitle(title: string): HtmlOutput;
setWidth(width: Integer): HtmlOutput;
setXFrameOptionsMode(mode: XFrameOptionsMode): HtmlOutput;
}
/**
* An object that represents a meta tag added to the page by calling
* HtmlOutput.addMetaTag(name, content).
*
* var output = HtmlService.createHtmlOutput('<b>Hello, world!</b>');
* output.addMetaTag('viewport', 'width=device-width, initial-scale=1');
*
* var tags = output.getMetaTags();
* Logger.log('<meta name="%s" content="%s"/>', tags[0].getName(), tags[0].getContent());
*/
export interface HtmlOutputMetaTag {
getContent(): string;
getName(): string;
}
/**
@ -47,7 +67,8 @@ declare namespace GoogleAppsScript {
* HtmlOutput for what limitations this implies on what can be returned.
*/
export interface HtmlService {
SandboxMode: SandboxMode
SandboxMode: typeof SandboxMode;
XFrameOptionsMode: typeof XFrameOptionsMode;
createHtmlOutput(): HtmlOutput;
createHtmlOutput(blob: Base.BlobSource): HtmlOutput;
createHtmlOutput(html: string): HtmlOutput;
@ -74,24 +95,17 @@ declare namespace GoogleAppsScript {
* scripts. These values can be accessed from HtmlService.SandboxMode, and set by calling
* HtmlOutput.setSandboxMode(mode).
*
* The NATIVE and EMULATED modes were
* deprecated on October 13, 2015 and both are
* now sunset.
* Only IFRAME mode is now supported.
* To protect users from being served malicious HTML or JavaScript, client-side code served from
* HTML service executes in a security sandbox that imposes restrictions on the code. The method
* HtmlOutput.setSandboxMode(mode) allows script authors to choose between
* different versions of the sandbox. For more information, see the
* HtmlOutput.setSandboxMode(mode) previously allowed script authors to choose
* between different versions of the sandbox, but now has no effect. For more information, see the
* guide to restrictions in HTML service.
* If a script does not set a sandbox mode, Apps Script uses NATIVE mode as the default.
* Prior to February 2014, the default was EMULATED. The default is subject to change.
* The IFRAME mode imposes many fewer restrictions than the other sandbox modes and runs
* fastest, but does not work at all in certain older browsers, including Internet Explorer 9. By
* contrast, EMULATED mode is more likely to work in
* older browsers that do not support ECMAScript 5 strict
* mode, most notably Internet Explorer 9. NATIVE mode is the middle ground. If
* NATIVE mode is set but not supported in the user's browser, the sandbox mode falls back
* to EMULATED mode for that user.
*
* // Serve HTML with a defined sandbox mode (in Apps Script server-side code).
* var output = HtmlService.createHtmlOutput('<b>Hello, world!</b>');
* output.setSandboxMode(HtmlService.SandboxMode.IFRAME);
* fastest, but does not work at all in certain older browsers, including Internet Explorer 9.
*
* google.script.sandbox.mode
*
@ -102,6 +116,23 @@ declare namespace GoogleAppsScript {
*/
export enum SandboxMode { EMULATED, IFRAME, NATIVE }
/**
* An enum representing the X-Frame-Options modes that can be used for client-side
* HtmlService scripts. These values can be accessed from
* HtmlService.XFrameOptionsMode, and set by calling
* HtmlOutput.setXFrameOptionsMode(mode).
*
* Setting XFrameOptionsMode.ALLOWALL will let any site iframe the page, so the developer
* should implement their own protection against clickjacking.
* If a script does not set an X-Frame-Options mode, Apps Script uses DEFAULT
* mode as the default.
*
* // Serve HTML with no X-Frame-Options header (in Apps Script server-side code).
* var output = HtmlService.createHtmlOutput('<b>Hello, world!</b>');
* output.setXFrameOptionsMode(HtmlService.XFrameOptionsMode.ALLOWALL);
*/
export enum XFrameOptionsMode { ALLOWALL, DEFAULT }
}
}

View File

@ -1,10 +1,10 @@
// Type definitions for Google Apps Script 2015-11-12
// Type definitions for Google Apps Script 2017-05-12
// Project: https://developers.google.com/apps-script/
// Definitions by: motemen <https://github.com/motemen/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference path="google-apps-script.types.d.ts" />
/// <reference path="google-apps-script.base.d.ts" />
declare namespace GoogleAppsScript {
export module JDBC {

View File

@ -1,9 +1,9 @@
// Type definitions for Google Apps Script 2015-11-12
// Type definitions for Google Apps Script 2017-05-12
// Project: https://developers.google.com/apps-script/
// Definitions by: motemen <https://github.com/motemen/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference path="google-apps-script.types.d.ts" />
declare namespace GoogleAppsScript {
export module Language {

View File

@ -1,9 +1,9 @@
// Type definitions for Google Apps Script 2015-11-12
// Type definitions for Google Apps Script 2017-05-12
// Project: https://developers.google.com/apps-script/
// Definitions by: motemen <https://github.com/motemen/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference path="google-apps-script.types.d.ts" />
declare namespace GoogleAppsScript {
export module Lock {

View File

@ -1,9 +1,9 @@
// Type definitions for Google Apps Script 2015-11-12
// Type definitions for Google Apps Script 2017-05-12
// Project: https://developers.google.com/apps-script/
// Definitions by: motemen <https://github.com/motemen/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference path="google-apps-script.types.d.ts" />
declare namespace GoogleAppsScript {
export module Mail {

View File

@ -1,10 +1,10 @@
// Type definitions for Google Apps Script 2015-11-12
// Type definitions for Google Apps Script 2017-05-12
// Project: https://developers.google.com/apps-script/
// Definitions by: motemen <https://github.com/motemen/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference path="google-apps-script.types.d.ts" />
/// <reference path="google-apps-script.base.d.ts" />
declare namespace GoogleAppsScript {
export module Maps {
@ -93,8 +93,8 @@ declare namespace GoogleAppsScript {
* A collection of enums used by DirectionFinder.
*/
export interface DirectionFinderEnums {
Avoid: Avoid
Mode: Mode
Avoid: typeof Avoid;
Mode: typeof Mode;
}
/**
@ -200,8 +200,8 @@ declare namespace GoogleAppsScript {
* images.
*/
export interface Maps {
DirectionFinder: DirectionFinderEnums
StaticMap: StaticMapEnums
DirectionFinder: DirectionFinderEnums;
StaticMap: StaticMapEnums;
decodePolyline(polyline: string): Number[];
encodePolyline(points: Number[]): string;
newDirectionFinder(): DirectionFinder;
@ -299,10 +299,10 @@ declare namespace GoogleAppsScript {
* A collection of enums used by StaticMap.
*/
export interface StaticMapEnums {
Color: Color
Format: Format
MarkerSize: MarkerSize
Type: Type
Color: typeof Color;
Format: typeof Format;
MarkerSize: typeof MarkerSize;
Type: typeof Type;
}
/**

View File

@ -1,9 +1,9 @@
// Type definitions for Google Apps Script 2015-11-12
// Type definitions for Google Apps Script 2017-05-12
// Project: https://developers.google.com/apps-script/
// Definitions by: motemen <https://github.com/motemen/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference path="google-apps-script.types.d.ts" />
declare namespace GoogleAppsScript {
export module Optimization {
@ -86,6 +86,7 @@ declare namespace GoogleAppsScript {
addConstraint(lowerBound: Number, upperBound: Number): LinearOptimizationConstraint;
addVariable(name: string, lowerBound: Number, upperBound: Number): LinearOptimizationEngine;
addVariable(name: string, lowerBound: Number, upperBound: Number, type: VariableType): LinearOptimizationEngine;
addVariable(name: string, lowerBound: Number, upperBound: Number, type: VariableType, objectiveCoefficient: Number): LinearOptimizationEngine;
setMaximization(): LinearOptimizationEngine;
setMinimization(): LinearOptimizationEngine;
setObjectiveCoefficient(variableName: string, coefficient: Number): LinearOptimizationEngine;
@ -146,8 +147,8 @@ declare namespace GoogleAppsScript {
* }
*/
export interface LinearOptimizationService {
Status: Status
VariableType: VariableType
Status: typeof Status;
VariableType: typeof VariableType;
createEngine(): LinearOptimizationEngine;
}

View File

@ -1,9 +1,9 @@
// Type definitions for Google Apps Script 2015-11-12
// Type definitions for Google Apps Script 2017-05-12
// Project: https://developers.google.com/apps-script/
// Definitions by: motemen <https://github.com/motemen/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference path="google-apps-script.types.d.ts" />
declare namespace GoogleAppsScript {
export module Properties {

View File

@ -1,13 +1,13 @@
// Type definitions for Google Apps Script 2015-11-12
// Type definitions for Google Apps Script 2017-05-12
// Project: https://developers.google.com/apps-script/
// Definitions by: motemen <https://github.com/motemen/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference path="google-apps-script.types.d.ts" />
/// <reference path="google-apps-script.base.d.ts" />
/// <reference path="google-apps-script.document.d.ts" />
/// <reference path="google-apps-script.forms.d.ts" />
/// <reference path="google-apps-script.spreadsheet.d.ts" />
declare namespace GoogleAppsScript {
export module Script {
@ -118,18 +118,18 @@ declare namespace GoogleAppsScript {
* triggers and control publishing the script as a service.
*/
export interface ScriptApp {
AuthMode: AuthMode
AuthorizationStatus: AuthorizationStatus
EventType: EventType
InstallationSource: InstallationSource
TriggerSource: TriggerSource
WeekDay: Base.Weekday
AuthMode: typeof AuthMode;
AuthorizationStatus: typeof AuthorizationStatus;
EventType: typeof EventType;
InstallationSource: typeof InstallationSource;
TriggerSource: typeof TriggerSource;
WeekDay: typeof Base.Weekday;
deleteTrigger(trigger: Trigger): void;
getAuthorizationInfo(authMode: AuthMode): AuthorizationInfo;
getInstallationSource(): InstallationSource;
getOAuthToken(): string;
getProjectKey(): string;
getProjectTriggers(): Trigger[];
getScriptId(): string;
getService(): Service;
getUserTriggers(document: Document.Document): Trigger[];
getUserTriggers(form: Forms.Form): Trigger[];
@ -137,13 +137,27 @@ declare namespace GoogleAppsScript {
invalidateAuth(): void;
newStateToken(): StateTokenBuilder;
newTrigger(functionName: string): TriggerBuilder;
getProjectKey(): string;
getScriptTriggers(): Trigger[];
}
/**
* Access and manipulate script publishing.
*/
export interface Service {
Restriction: typeof Service.Restriction;
disable(): void;
getUrl(): string;
isEnabled(): boolean;
enable(restriction: Service.Restriction): void;
}
/**
*
*/
export enum Service { MYSELF, DOMAIN, ALL }
namespace Service {
export enum Restriction { MYSELF, DOMAIN, ALL }
}
/**
* Builder for spreadsheet triggers.

View File

@ -1,10 +1,10 @@
// Type definitions for Google Apps Script 2015-11-12
// Type definitions for Google Apps Script 2017-05-12
// Project: https://developers.google.com/apps-script/
// Definitions by: motemen <https://github.com/motemen/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference path="google-apps-script.types.d.ts" />
/// <reference path="google-apps-script.base.d.ts" />
declare namespace GoogleAppsScript {
export module Sites {
@ -12,6 +12,12 @@ declare namespace GoogleAppsScript {
* A Sites Attachment such as a file attached to a page.
*
* Note that an Attachment is a Blob and can be used anywhere Blob input is expected.
* A
* rebuilt
* version of Sites was launched on November 22, 2016. Apps Script cannot currently access or
* modify Sites made with this version, but script can still access
*
* classic Sites.
*
* var filesPage = SitesApp.getSite('example.com', 'mysite').getChildByName("files");
* var attachments = filesPage.getAttachments();
@ -42,11 +48,23 @@ declare namespace GoogleAppsScript {
/**
* A typesafe enum for sites attachment type.
* A
* rebuilt
* version of Sites was launched on November 22, 2016. Apps Script cannot currently access or
* modify Sites made with this version, but script can still access
*
* classic Sites.
*/
export enum AttachmentType { WEB, HOSTED }
/**
* A Sites Column - a column from a Sites List page.
* A
* rebuilt
* version of Sites was launched on November 22, 2016. Apps Script cannot currently access or
* modify Sites made with this version, but script can still access
*
* classic Sites.
*/
export interface Column {
deleteColumn(): void;
@ -57,6 +75,12 @@ declare namespace GoogleAppsScript {
/**
* A Comment attached to any Sites page.
* A
* rebuilt
* version of Sites was launched on November 22, 2016. Apps Script cannot currently access or
* modify Sites made with this version, but script can still access
*
* classic Sites.
*/
export interface Comment {
deleteComment(): void;
@ -72,6 +96,12 @@ declare namespace GoogleAppsScript {
/**
* A Sites ListItem - a list element from a Sites List page.
* A
* rebuilt
* version of Sites was launched on November 22, 2016. Apps Script cannot currently access or
* modify Sites made with this version, but script can still access
*
* classic Sites.
*/
export interface ListItem {
deleteListItem(): void;
@ -87,6 +117,12 @@ declare namespace GoogleAppsScript {
/**
* A Page on a Google Site.
* A
* rebuilt
* version of Sites was launched on November 22, 2016. Apps Script cannot currently access or
* modify Sites made with this version, but script can still access
*
* classic Sites.
*/
export interface Page {
addColumn(name: string): Column;
@ -113,8 +149,6 @@ declare namespace GoogleAppsScript {
getChildren(): Page[];
getChildren(options: Object): Page[];
getColumns(): Column[];
getComments(): Comment[];
getComments(optOptions: Object): Comment[];
getDatePublished(): Date;
getHtmlContent(): string;
getIsDraft(): boolean;
@ -139,17 +173,31 @@ declare namespace GoogleAppsScript {
setParent(parent: Page): Page;
setTitle(title: string): Page;
addComment(content: string): Comment;
getComments(): Comment[];
getComments(optOptions: Object): Comment[];
getPageName(): string;
getSelfLink(): string;
}
/**
* A typesafe enum for sites page type.
* A
* rebuilt
* version of Sites was launched on November 22, 2016. Apps Script cannot currently access or
* modify Sites made with this version, but script can still access
*
* classic Sites.
*/
export enum PageType { WEB_PAGE, LIST_PAGE, ANNOUNCEMENT, ANNOUNCEMENTS_PAGE, FILE_CABINET_PAGE }
/**
* An object representing a Google Site.
* A
* rebuilt
* version of Sites was launched on November 22, 2016. Apps Script cannot currently access or
* modify Sites made with this version, but script can still access
*
* classic Sites.
*/
export interface Site {
addEditor(emailAddress: string): Site;
@ -215,10 +263,16 @@ declare namespace GoogleAppsScript {
/**
* Create and access Google Sites.
* A
* rebuilt
* version of Sites was launched on November 22, 2016. Apps Script cannot currently access or
* modify Sites made with this version, but script can still access
*
* classic Sites.
*/
export interface SitesApp {
AttachmentType: AttachmentType
PageType: PageType
AttachmentType: typeof AttachmentType;
PageType: typeof PageType;
copySite(domain: string, name: string, title: string, summary: string, site: Site): Site;
createSite(domain: string, name: string, title: string, summary: string): Site;
getActivePage(): Page;

View File

@ -1,15 +1,21 @@
// Type definitions for Google Apps Script 2015-11-12
// Type definitions for Google Apps Script 2017-05-12
// Project: https://developers.google.com/apps-script/
// Definitions by: motemen <https://github.com/motemen/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference path="google-apps-script.types.d.ts" />
/// <reference path="google-apps-script.charts.d.ts" />
/// <reference path="google-apps-script.base.d.ts" />
/// <reference path="google-apps-script.drive.d.ts" />
declare namespace GoogleAppsScript {
export module Spreadsheet {
/**
* Styles that can be set on a range using
* Range.setBorder(top, left, bottom, right, vertical, horizontal, color, style).
*/
export enum BorderStyle { DOTTED, DASHED, SOLID }
/**
* The chart's position within a sheet. Can be updated using the EmbeddedChart.modify()
* function.
@ -135,6 +141,8 @@ declare namespace GoogleAppsScript {
asAreaChart(): EmbeddedAreaChartBuilder;
asBarChart(): EmbeddedBarChartBuilder;
asColumnChart(): EmbeddedColumnChartBuilder;
asComboChart(): EmbeddedComboChartBuilder;
asHistogramChart(): EmbeddedHistogramChartBuilder;
asLineChart(): EmbeddedLineChartBuilder;
asPieChart(): EmbeddedPieChartBuilder;
asScatterChart(): EmbeddedScatterChartBuilder;
@ -175,6 +183,8 @@ declare namespace GoogleAppsScript {
asAreaChart(): EmbeddedAreaChartBuilder;
asBarChart(): EmbeddedBarChartBuilder;
asColumnChart(): EmbeddedColumnChartBuilder;
asComboChart(): EmbeddedComboChartBuilder;
asHistogramChart(): EmbeddedHistogramChartBuilder;
asLineChart(): EmbeddedLineChartBuilder;
asPieChart(): EmbeddedPieChartBuilder;
asScatterChart(): EmbeddedScatterChartBuilder;
@ -265,6 +275,8 @@ declare namespace GoogleAppsScript {
asAreaChart(): EmbeddedAreaChartBuilder;
asBarChart(): EmbeddedBarChartBuilder;
asColumnChart(): EmbeddedColumnChartBuilder;
asComboChart(): EmbeddedComboChartBuilder;
asHistogramChart(): EmbeddedHistogramChartBuilder;
asLineChart(): EmbeddedLineChartBuilder;
asPieChart(): EmbeddedPieChartBuilder;
asScatterChart(): EmbeddedScatterChartBuilder;
@ -288,6 +300,8 @@ declare namespace GoogleAppsScript {
asAreaChart(): EmbeddedAreaChartBuilder;
asBarChart(): EmbeddedBarChartBuilder;
asColumnChart(): EmbeddedColumnChartBuilder;
asComboChart(): EmbeddedComboChartBuilder;
asHistogramChart(): EmbeddedHistogramChartBuilder;
asLineChart(): EmbeddedLineChartBuilder;
asPieChart(): EmbeddedPieChartBuilder;
asScatterChart(): EmbeddedScatterChartBuilder;
@ -318,6 +332,88 @@ declare namespace GoogleAppsScript {
useLogScale(): EmbeddedColumnChartBuilder;
}
/**
* Builder for combo charts. For more details, see the Gviz
* documentation.
*/
export interface EmbeddedComboChartBuilder {
addRange(range: Range): EmbeddedChartBuilder;
asAreaChart(): EmbeddedAreaChartBuilder;
asBarChart(): EmbeddedBarChartBuilder;
asColumnChart(): EmbeddedColumnChartBuilder;
asComboChart(): EmbeddedComboChartBuilder;
asHistogramChart(): EmbeddedHistogramChartBuilder;
asLineChart(): EmbeddedLineChartBuilder;
asPieChart(): EmbeddedPieChartBuilder;
asScatterChart(): EmbeddedScatterChartBuilder;
asTableChart(): EmbeddedTableChartBuilder;
build(): EmbeddedChart;
getChartType(): Charts.ChartType;
getContainer(): ContainerInfo;
getRanges(): Range[];
removeRange(range: Range): EmbeddedChartBuilder;
reverseCategories(): EmbeddedComboChartBuilder;
setBackgroundColor(cssValue: string): EmbeddedComboChartBuilder;
setChartType(type: Charts.ChartType): EmbeddedChartBuilder;
setColors(cssValues: String[]): EmbeddedComboChartBuilder;
setLegendPosition(position: Charts.Position): EmbeddedComboChartBuilder;
setLegendTextStyle(textStyle: Charts.TextStyle): EmbeddedComboChartBuilder;
setOption(option: string, value: Object): EmbeddedChartBuilder;
setPosition(anchorRowPos: Integer, anchorColPos: Integer, offsetX: Integer, offsetY: Integer): EmbeddedChartBuilder;
setRange(start: Number, end: Number): EmbeddedComboChartBuilder;
setStacked(): EmbeddedComboChartBuilder;
setTitle(chartTitle: string): EmbeddedComboChartBuilder;
setTitleTextStyle(textStyle: Charts.TextStyle): EmbeddedComboChartBuilder;
setXAxisTextStyle(textStyle: Charts.TextStyle): EmbeddedComboChartBuilder;
setXAxisTitle(title: string): EmbeddedComboChartBuilder;
setXAxisTitleTextStyle(textStyle: Charts.TextStyle): EmbeddedComboChartBuilder;
setYAxisTextStyle(textStyle: Charts.TextStyle): EmbeddedComboChartBuilder;
setYAxisTitle(title: string): EmbeddedComboChartBuilder;
setYAxisTitleTextStyle(textStyle: Charts.TextStyle): EmbeddedComboChartBuilder;
useLogScale(): EmbeddedComboChartBuilder;
}
/**
* Builder for histogram charts. For more details, see the Gviz
* documentation.
*/
export interface EmbeddedHistogramChartBuilder {
addRange(range: Range): EmbeddedChartBuilder;
asAreaChart(): EmbeddedAreaChartBuilder;
asBarChart(): EmbeddedBarChartBuilder;
asColumnChart(): EmbeddedColumnChartBuilder;
asComboChart(): EmbeddedComboChartBuilder;
asHistogramChart(): EmbeddedHistogramChartBuilder;
asLineChart(): EmbeddedLineChartBuilder;
asPieChart(): EmbeddedPieChartBuilder;
asScatterChart(): EmbeddedScatterChartBuilder;
asTableChart(): EmbeddedTableChartBuilder;
build(): EmbeddedChart;
getChartType(): Charts.ChartType;
getContainer(): ContainerInfo;
getRanges(): Range[];
removeRange(range: Range): EmbeddedChartBuilder;
reverseCategories(): EmbeddedHistogramChartBuilder;
setBackgroundColor(cssValue: string): EmbeddedHistogramChartBuilder;
setChartType(type: Charts.ChartType): EmbeddedChartBuilder;
setColors(cssValues: String[]): EmbeddedHistogramChartBuilder;
setLegendPosition(position: Charts.Position): EmbeddedHistogramChartBuilder;
setLegendTextStyle(textStyle: Charts.TextStyle): EmbeddedHistogramChartBuilder;
setOption(option: string, value: Object): EmbeddedChartBuilder;
setPosition(anchorRowPos: Integer, anchorColPos: Integer, offsetX: Integer, offsetY: Integer): EmbeddedChartBuilder;
setRange(start: Number, end: Number): EmbeddedHistogramChartBuilder;
setStacked(): EmbeddedHistogramChartBuilder;
setTitle(chartTitle: string): EmbeddedHistogramChartBuilder;
setTitleTextStyle(textStyle: Charts.TextStyle): EmbeddedHistogramChartBuilder;
setXAxisTextStyle(textStyle: Charts.TextStyle): EmbeddedHistogramChartBuilder;
setXAxisTitle(title: string): EmbeddedHistogramChartBuilder;
setXAxisTitleTextStyle(textStyle: Charts.TextStyle): EmbeddedHistogramChartBuilder;
setYAxisTextStyle(textStyle: Charts.TextStyle): EmbeddedHistogramChartBuilder;
setYAxisTitle(title: string): EmbeddedHistogramChartBuilder;
setYAxisTitleTextStyle(textStyle: Charts.TextStyle): EmbeddedHistogramChartBuilder;
useLogScale(): EmbeddedHistogramChartBuilder;
}
/**
* Builder for line charts. For more details, see the Gviz
* documentation.
@ -327,6 +423,8 @@ declare namespace GoogleAppsScript {
asAreaChart(): EmbeddedAreaChartBuilder;
asBarChart(): EmbeddedBarChartBuilder;
asColumnChart(): EmbeddedColumnChartBuilder;
asComboChart(): EmbeddedComboChartBuilder;
asHistogramChart(): EmbeddedHistogramChartBuilder;
asLineChart(): EmbeddedLineChartBuilder;
asPieChart(): EmbeddedPieChartBuilder;
asScatterChart(): EmbeddedScatterChartBuilder;
@ -367,6 +465,8 @@ declare namespace GoogleAppsScript {
asAreaChart(): EmbeddedAreaChartBuilder;
asBarChart(): EmbeddedBarChartBuilder;
asColumnChart(): EmbeddedColumnChartBuilder;
asComboChart(): EmbeddedComboChartBuilder;
asHistogramChart(): EmbeddedHistogramChartBuilder;
asLineChart(): EmbeddedLineChartBuilder;
asPieChart(): EmbeddedPieChartBuilder;
asScatterChart(): EmbeddedScatterChartBuilder;
@ -398,6 +498,8 @@ declare namespace GoogleAppsScript {
asAreaChart(): EmbeddedAreaChartBuilder;
asBarChart(): EmbeddedBarChartBuilder;
asColumnChart(): EmbeddedColumnChartBuilder;
asComboChart(): EmbeddedComboChartBuilder;
asHistogramChart(): EmbeddedHistogramChartBuilder;
asLineChart(): EmbeddedLineChartBuilder;
asPieChart(): EmbeddedPieChartBuilder;
asScatterChart(): EmbeddedScatterChartBuilder;
@ -438,6 +540,8 @@ declare namespace GoogleAppsScript {
asAreaChart(): EmbeddedAreaChartBuilder;
asBarChart(): EmbeddedBarChartBuilder;
asColumnChart(): EmbeddedColumnChartBuilder;
asComboChart(): EmbeddedComboChartBuilder;
asHistogramChart(): EmbeddedHistogramChartBuilder;
asLineChart(): EmbeddedLineChartBuilder;
asPieChart(): EmbeddedPieChartBuilder;
asScatterChart(): EmbeddedScatterChartBuilder;
@ -462,6 +566,20 @@ declare namespace GoogleAppsScript {
useAlternatingRowStyle(alternate: boolean): EmbeddedTableChartBuilder;
}
/**
* Create, access and modify named ranges in a spreadsheet.
* Named ranges are ranges that have associated string aliases.
* They can be viewed and edited via the Sheets UI under the
* Data > Named ranges... menu.
*/
export interface NamedRange {
getName(): string;
getRange(): Range;
remove(): void;
setName(name: string): NamedRange;
setRange(range: Range): NamedRange;
}
/**
*
* Deprecated. For spreadsheets created in the newer version of Google Sheets, use the more powerful
@ -539,6 +657,7 @@ declare namespace GoogleAppsScript {
removeEditors(emailAddresses: String[]): Protection;
setDescription(description: string): Protection;
setDomainEdit(editable: boolean): Protection;
setNamedRange(namedRange: NamedRange): Protection;
setRange(range: Range): Protection;
setRangeName(rangeName: string): Protection;
setUnprotectedRanges(ranges: Range[]): Protection;
@ -599,6 +718,8 @@ declare namespace GoogleAppsScript {
getDataTable(firstRowIsHeader: boolean): Charts.DataTable;
getDataValidation(): DataValidation;
getDataValidations(): DataValidation[][];
getDisplayValue(): string;
getDisplayValues(): String[][];
getFontColor(): string;
getFontColors(): String[][];
getFontFamilies(): String[][];
@ -621,6 +742,7 @@ declare namespace GoogleAppsScript {
getHorizontalAlignments(): String[][];
getLastColumn(): Integer;
getLastRow(): Integer;
getMergedRanges(): Range[];
getNote(): string;
getNotes(): String[][];
getNumColumns(): Integer;
@ -640,6 +762,7 @@ declare namespace GoogleAppsScript {
isBlank(): boolean;
isEndColumnBounded(): boolean;
isEndRowBounded(): boolean;
isPartOfMerge(): boolean;
isStartColumnBounded(): boolean;
isStartRowBounded(): boolean;
merge(): Range;
@ -654,6 +777,7 @@ declare namespace GoogleAppsScript {
setBackgroundRGB(red: Integer, green: Integer, blue: Integer): Range;
setBackgrounds(color: String[][]): Range;
setBorder(top: boolean, left: boolean, bottom: boolean, right: boolean, vertical: boolean, horizontal: boolean): Range;
setBorder(top: boolean, left: boolean, bottom: boolean, right: boolean, vertical: boolean, horizontal: boolean, color: string, style: BorderStyle): Range;
setDataValidation(rule: DataValidation): Range;
setDataValidations(rules: DataValidation[][]): Range;
setFontColor(color: string): Range;
@ -718,6 +842,7 @@ declare namespace GoogleAppsScript {
getMaxColumns(): Integer;
getMaxRows(): Integer;
getName(): string;
getNamedRanges(): NamedRange[];
getParent(): Spreadsheet;
getProtections(type: ProtectionType): Protection[];
getRange(row: Integer, column: Integer): Range;
@ -728,6 +853,7 @@ declare namespace GoogleAppsScript {
getSheetId(): Integer;
getSheetName(): string;
getSheetValues(startRow: Integer, startColumn: Integer, numRows: Integer, numColumns: Integer): Object[][];
getTabColor(): string;
hideColumn(column: Range): void;
hideColumns(columnIndex: Integer): void;
hideColumns(columnIndex: Integer, numColumns: Integer): void;
@ -764,6 +890,7 @@ declare namespace GoogleAppsScript {
setFrozenRows(rows: Integer): void;
setName(name: string): Sheet;
setRowHeight(rowPosition: Integer, height: Integer): Sheet;
setTabColor(color: string): Sheet;
showColumns(columnIndex: Integer): void;
showColumns(columnIndex: Integer, numColumns: Integer): void;
showRows(rowIndex: Integer): void;
@ -815,6 +942,7 @@ declare namespace GoogleAppsScript {
getLastColumn(): Integer;
getLastRow(): Integer;
getName(): string;
getNamedRanges(): NamedRange[];
getNumSheets(): Integer;
getOwner(): Base.User;
getProtections(type: ProtectionType): Protection[];
@ -893,8 +1021,9 @@ declare namespace GoogleAppsScript {
* the parent class for the Spreadsheet service.
*/
export interface SpreadsheetApp {
DataValidationCriteria: DataValidationCriteria
ProtectionType: ProtectionType
BorderStyle: typeof BorderStyle;
DataValidationCriteria: typeof DataValidationCriteria;
ProtectionType: typeof ProtectionType;
create(name: string): Spreadsheet;
create(name: string, rows: Integer, columns: Integer): Spreadsheet;
flush(): void;

View File

@ -3,7 +3,7 @@
// Definitions by: motemen <https://github.com/motemen/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare namespace GoogleAppsScript {
declare module GoogleAppsScript {
type BigNumber = any;
type Byte = number;
type Integer = number;

View File

@ -1,9 +1,9 @@
// Type definitions for Google Apps Script 2015-11-12
// Type definitions for Google Apps Script 2017-05-12
// Project: https://developers.google.com/apps-script/
// Definitions by: motemen <https://github.com/motemen/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference path="google-apps-script.types.d.ts" />
declare namespace GoogleAppsScript {
export module UI {
@ -3263,13 +3263,13 @@ declare namespace GoogleAppsScript {
*
* deprecated on December 11, 2014. To create user interfaces, use the
* HTML service instead.
* Create user interfaces for use inside Google Apps or as standalone services.
* Create user interfaces for use inside G Suite or as standalone services.
*/
export interface UiApp {
DateTimeFormat: DateTimeFormat
FileType: FileType
HorizontalAlignment: HorizontalAlignment
VerticalAlignment: VerticalAlignment
DateTimeFormat: typeof DateTimeFormat;
FileType: typeof FileType;
HorizontalAlignment: typeof HorizontalAlignment;
VerticalAlignment: typeof VerticalAlignment;
createApplication(): UiInstance;
getActiveApplication(): UiInstance;
getUserAgent(): string;

View File

@ -1,10 +1,10 @@
// Type definitions for Google Apps Script 2015-11-12
// Type definitions for Google Apps Script 2017-05-12
// Project: https://developers.google.com/apps-script/
// Definitions by: motemen <https://github.com/motemen/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference path="google-apps-script.types.d.ts" />
/// <reference path="google-apps-script.base.d.ts" />
declare namespace GoogleAppsScript {
export module URL_Fetch {
@ -25,30 +25,6 @@ declare namespace GoogleAppsScript {
getResponseCode(): Integer;
}
/**
*
* Deprecated. This class is deprecated and should not be used in new scripts.
* Represents configuration settings for an OAuth-enabled remote service.
* See also
*
* UrlFetchApp
*/
export interface OAuthConfig {
getAccessTokenUrl(): string;
getAuthorizationUrl(): string;
getMethod(): string;
getParamLocation(): string;
getRequestTokenUrl(): string;
getServiceName(): string;
setAccessTokenUrl(url: string): void;
setAuthorizationUrl(url: string): void;
setConsumerKey(consumerKey: string): void;
setConsumerSecret(consumerSecret: string): void;
setMethod(method: string): void;
setParamLocation(location: string): void;
setRequestTokenUrl(url: string): void;
}
/**
* Fetch resources and communicate with other hosts over the Internet.
*
@ -58,8 +34,6 @@ declare namespace GoogleAppsScript {
* and scaling purposes.
* See also
*
* OAuthConfig
*
* HTTPResponse
*/
export interface UrlFetchApp {
@ -67,8 +41,6 @@ declare namespace GoogleAppsScript {
fetch(url: string, params: Object): HTTPResponse;
getRequest(url: string): Object;
getRequest(url: string, params: Object): Object;
addOAuthService(serviceName: string): OAuthConfig;
removeOAuthService(serviceName: string): void;
}
}

View File

@ -1,10 +1,10 @@
// Type definitions for Google Apps Script 2015-11-12
// Type definitions for Google Apps Script 2017-05-12
// Project: https://developers.google.com/apps-script/
// Definitions by: motemen <https://github.com/motemen/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference path="google-apps-script.types.d.ts" />
/// <reference path="google-apps-script.base.d.ts" />
declare namespace GoogleAppsScript {
export module Utilities {
@ -28,9 +28,9 @@ declare namespace GoogleAppsScript {
* and other miscellaneous tasks.
*/
export interface Utilities {
Charset: Charset
DigestAlgorithm: DigestAlgorithm
MacAlgorithm: MacAlgorithm
Charset: typeof Charset;
DigestAlgorithm: typeof DigestAlgorithm;
MacAlgorithm: typeof MacAlgorithm;
base64Decode(encoded: string): Byte[];
base64Decode(encoded: string, charset: Charset): Byte[];
base64DecodeWebSafe(encoded: string): Byte[];
@ -51,6 +51,7 @@ declare namespace GoogleAppsScript {
computeRsaSha256Signature(value: string, key: string, charset: Charset): Byte[];
formatDate(date: Date, timeZone: string, format: string): string;
formatString(template: string, ...args: Object[]): string;
getUuid(): string;
newBlob(data: Byte[]): Base.Blob;
newBlob(data: Byte[], contentType: string): Base.Blob;
newBlob(data: Byte[], contentType: string, name: string): Base.Blob;

View File

@ -1,9 +1,9 @@
// Type definitions for Google Apps Script 2015-11-12
// Type definitions for Google Apps Script 2017-05-12
// Project: https://developers.google.com/apps-script/
// Definitions by: motemen <https://github.com/motemen/>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference path="google-apps-script.types.d.ts" />
declare namespace GoogleAppsScript {
export module XML_Service {
@ -283,9 +283,9 @@ declare namespace GoogleAppsScript {
/**
* This service allows scripts to parse, navigate, and programmatically create XML documents.
*
* // Log the title and labels for the first page of blog posts on the Google Apps Developer blog.
* // Log the title and labels for the first page of blog posts on the G Suite Developer blog.
* function parseXml() {
* var url = 'http://googleappsdeveloper.blogspot.com/atom.xml';
* var url = 'https://gsuite-developers.googleblog.com/atom.xml';
* var xml = UrlFetchApp.fetch(url).getContentText();
* var document = XmlService.parse(xml);
* var root = document.getRootElement();
@ -320,7 +320,7 @@ declare namespace GoogleAppsScript {
* }
*/
export interface XmlService {
ContentTypes: ContentType
ContentTypes: typeof ContentType;
createCdata(text: string): Cdata;
createComment(text: string): Comment;
createDocType(elementName: string): DocType;