gas-types-detailed
Version:
Detailed Google Apps Script Type Definitions. Forked from Definitely Typed @types/google-apps-script. Adds full documentation and urls.
1,116 lines (1,004 loc) • 218 kB
TypeScript
// Type definitions for Google Apps Script 2023-10-28
// 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 {
namespace Forms {
/**
* An enum representing the supported types of image alignment. Alignment types can be accessed from
* FormApp.Alignment.
*
* To call an enum, you call its parent class, name, and property. For example,
* FormApp.Alignment.LEFT.
*
* // Open a form by ID and add a new image item with alignment
* var form = FormApp.openById('1234567890abcdefghijklmnopqrstuvwxyz');
* var img = UrlFetchApp.fetch('https://www.google.com/images/srpr/logo4w.png');
* form.addImageItem()
* .setImage(img)
* .setAlignment(FormApp.Alignment.CENTER);
*/
enum Alignment { LEFT, CENTER, RIGHT }
/**
* A question item, presented as a grid of columns and rows, that allows the respondent to select
* multiple choices per row from a sequence of checkboxes. Items can be accessed or created from a
* Form.
*
* // Open a form by ID and add a new checkgox grid item.
* var form = FormApp.openById('1234567890abcdefghijklmnopqrstuvwxyz');
* var item = form.addCheckboxGridItem();
* item.setTitle('Where did you celebrate New Years?')
* .setRows(['New York', 'San Francisco', 'London'])
* .setColumns(['2014', '2015', '2016', '2017']);
*/
interface CheckboxGridItem {
/**
* Removes any data validation for this grid item.
* https://developers.google.com/apps-script/reference/forms/checkbox-grid-item#clearValidation()
*/
clearValidation(): CheckboxGridItem;
/**
* Creates a new ItemResponse for this checkbox grid item. The argument responses
* must be a String[][] array of arrays containing as many values as the number of inputs
* in the checkbox grid. A null element for a non-required checkbox grid question
* indicates no response to that row. Throws an exception if any of the values does not match a
* valid choice.
* https://developers.google.com/apps-script/reference/forms/checkbox-grid-item#createResponse(String)
* @param responses an array of arrays of valid answers for this checkbox grid item
*/
createResponse(responses: string[][]): ItemResponse;
/**
* Creates a copy of this item and appends it to the end of the form.
* https://developers.google.com/apps-script/reference/forms/checkbox-grid-item#duplicate()
*/
duplicate(): CheckboxGridItem;
/**
* Gets the values for every column in the grid.
* https://developers.google.com/apps-script/reference/forms/checkbox-grid-item#getColumns()
*/
getColumns(): string[];
/**
* Gets the item's help text (sometimes called description text for layout items like ImageItems, PageBreakItems, and SectionHeaderItems).
* https://developers.google.com/apps-script/reference/forms/checkbox-grid-item#getHelpText()
*/
getHelpText(): string;
/**
* Gets the item's unique identifier.
* https://developers.google.com/apps-script/reference/forms/checkbox-grid-item#getId()
*/
getId(): Integer;
/**
* Gets the index of the item among all the items in the form.
* https://developers.google.com/apps-script/reference/forms/checkbox-grid-item#getIndex()
*/
getIndex(): Integer;
/**
* Gets the values for every row in the grid.
* https://developers.google.com/apps-script/reference/forms/checkbox-grid-item#getRows()
*/
getRows(): string[];
/**
* Gets the item's title (sometimes called header text, in the case of a SectionHeaderItem).
* https://developers.google.com/apps-script/reference/forms/checkbox-grid-item#getTitle()
*/
getTitle(): string;
/**
* Gets the item's type, represented as an ItemType.
* https://developers.google.com/apps-script/reference/forms/checkbox-grid-item#getType()
*/
getType(): ItemType;
/**
* Determines whether the respondent must answer the question.
* https://developers.google.com/apps-script/reference/forms/checkbox-grid-item#isRequired()
*/
isRequired(): boolean;
/**
* Sets the columns of the grid based on an array of values. Throws an exception if the given
* array is empty.
* https://developers.google.com/apps-script/reference/forms/checkbox-grid-item#setColumns(String)
* @param columns an array of column values, which respondents see as labels when viewing the form
*/
setColumns(columns: string[]): CheckboxGridItem;
/**
* Sets the item's help text (sometimes called description text for layout items like ImageItems, PageBreakItems, and SectionHeaderItems).
* https://developers.google.com/apps-script/reference/forms/checkbox-grid-item#setHelpText(String)
* @param text the new help text
*/
setHelpText(text: string): CheckboxGridItem;
/**
* Sets whether the respondent must answer the question.
* https://developers.google.com/apps-script/reference/forms/checkbox-grid-item#setRequired(Boolean)
* @param enabled whether the respondent must answer the question
*/
setRequired(enabled: boolean): CheckboxGridItem;
/**
* Sets the rows of the grid based on an array of values. Throws an exception if the given array
* is empty.
* https://developers.google.com/apps-script/reference/forms/checkbox-grid-item#setRows(String)
* @param rows an array of row values, which respondents see as labels when viewing the form
*/
setRows(rows: string[]): CheckboxGridItem;
/**
* Sets the item's title (sometimes called header text, in the case of a SectionHeaderItem).
* https://developers.google.com/apps-script/reference/forms/checkbox-grid-item#setTitle(String)
* @param title the new title or header text
*/
setTitle(title: string): CheckboxGridItem;
/**
* Sets the data validation for this checkbox grid item. Passing in null or a validation without
* any require functions called will remove any prior validation.
* https://developers.google.com/apps-script/reference/forms/checkbox-grid-item#setValidation(CheckboxGridValidation)
* @param validation a CheckboxGridValidation to apply to this item.
*/
setValidation(validation: CheckboxGridValidation): CheckboxGridItem;
}
/**
* A DataValidation for a CheckboxGridItem.
*
* // Add a checkbox grid item to a form and require one response per column.
* var checkboxGridItem = form.addCheckboxGridItem();
* checkboxGridItem.setTitle('Where did you celebrate New Years?')
* .setRows(['New York', 'San Francisco', 'London'])
* .setColumns(['2014', '2015', '2016', '2017']);
* var checkboxGridValidation = FormApp.createCheckboxGridValidation()
* .setHelpText(“Select one item per column.”)
* .requireLimitOneResponsePerColumn()
* .build();
* checkboxGridItem.setValidation(checkboxGridValidation);
*/
interface CheckboxGridValidation {
}
/**
* A DataValidationBuilder for a CheckboxGridValidation.
*
* // Add a checkbox grid item to a form and restrict it to one response per column.
* var checkboxGridItem = form.addCheckboxGridItem();
* checkboxGridItem.setTitle('Where did you celebrate New Years?')
* .setRows(['New York', 'San Francisco', 'London'])
* .setColumns(['2014', '2015', '2016', '2017']);
* var checkboxGridValidation = FormApp.createcheckboxGridValidation()
* .setHelpText(“Select one item per column.”)
* .requireLimitOneResponsePerColumn()
* .build();
* checkboxGridItem.setValidation(checkboxGridValidation);
*/
interface CheckboxGridValidationBuilder {
/**
* Requires limit of one response per column for a grid item.
* https://developers.google.com/apps-script/reference/forms/checkbox-grid-validation-builder#requireLimitOneResponsePerColumn()
*/
requireLimitOneResponsePerColumn(): CheckboxGridValidationBuilder;
}
/**
* 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');
* var item = form.addCheckboxItem();
* item.setTitle('What condiments would you like on your hot dog?')
* .setChoices([
* item.createChoice('Ketchup'),
* item.createChoice('Mustard'),
* item.createChoice('Relish')
* ])
* .showOtherOption(true);
*/
interface CheckboxItem {
/**
* Removes any data validation for this checkbox item.
* https://developers.google.com/apps-script/reference/forms/checkbox-item#clearValidation()
*/
clearValidation(): CheckboxItem;
/**
* Creates a new choice.
* https://developers.google.com/apps-script/reference/forms/checkbox-item#createChoice(String)
* @param value the choice's value, which respondents see as a label when viewing the form
*/
createChoice(value: string): Choice;
/**
* Creates a new choice.
* https://developers.google.com/apps-script/reference/forms/checkbox-item#createChoice(String,Boolean)
* @param value the choice's value, which respondents see as a label when viewing the form
* @param isCorrect whether the choice is a correct answer
*/
createChoice(value: string, isCorrect: boolean): Choice;
/**
* Creates a new ItemResponse for this checkbox item. The argument responses is a
* String[] array containing values that need to be checked. Throws an exception if any
* value does not match a valid choice for this item, unless showOtherOption(enabled) is set to true.
* https://developers.google.com/apps-script/reference/forms/checkbox-item#createResponse(String)
* @param responses an array of valid answers for this multiple-choice item
*/
createResponse(responses: string[]): ItemResponse;
/**
* Creates a copy of this item and appends it to the end of the form.
* https://developers.google.com/apps-script/reference/forms/checkbox-item#duplicate()
*/
duplicate(): CheckboxItem;
/**
* Gets all choices for an item.
* https://developers.google.com/apps-script/reference/forms/checkbox-item#getChoices()
*/
getChoices(): Choice[];
/**
* Returns the feedback that is shown to respondents when they respond correctly to a question.
* https://developers.google.com/apps-script/reference/forms/checkbox-item#getFeedbackForCorrect()
*/
getFeedbackForCorrect(): QuizFeedback;
/**
* Returns the feedback that is shown to respondents when they respond incorrectly to a question.
* https://developers.google.com/apps-script/reference/forms/checkbox-item#getFeedbackForIncorrect()
*/
getFeedbackForIncorrect(): QuizFeedback;
/**
* Gets the item's help text (sometimes called description text for layout items like ImageItems, PageBreakItems, and SectionHeaderItems).
* https://developers.google.com/apps-script/reference/forms/checkbox-item#getHelpText()
*/
getHelpText(): string;
/**
* Gets the item's unique identifier.
* https://developers.google.com/apps-script/reference/forms/checkbox-item#getId()
*/
getId(): Integer;
/**
* Gets the index of the item among all the items in the form.
* https://developers.google.com/apps-script/reference/forms/checkbox-item#getIndex()
*/
getIndex(): Integer;
/**
* Returns the point value of a gradeable item.
* https://developers.google.com/apps-script/reference/forms/checkbox-item#getPoints()
*/
getPoints(): Integer;
/**
* Gets the item's title (sometimes called header text, in the case of a SectionHeaderItem).
* https://developers.google.com/apps-script/reference/forms/checkbox-item#getTitle()
*/
getTitle(): string;
/**
* Gets the item's type, represented as an ItemType.
* https://developers.google.com/apps-script/reference/forms/checkbox-item#getType()
*/
getType(): ItemType;
/**
* Determines whether the item has an "other" option.
* https://developers.google.com/apps-script/reference/forms/checkbox-item#hasOtherOption()
*/
hasOtherOption(): boolean;
/**
* Determines whether the respondent must answer the question.
* https://developers.google.com/apps-script/reference/forms/checkbox-item#isRequired()
*/
isRequired(): boolean;
/**
* Sets the choices for an item from an array of strings. Throws an exception if the given array
* is empty.
*
*
* // 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.setChoiceValues(['Dogs', 'Cats']);
* https://developers.google.com/apps-script/reference/forms/checkbox-item#setChoiceValues(String)
* @param values the array of choice values, which respondents see as labels when viewing the form
*/
setChoiceValues(values: string[]): CheckboxItem;
/**
* Sets an array of choices for an item. Throws an exception if the given array is empty or
* contains a null element.
*
*
* // 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('Cats'),
* item.createChoice('Dogs')
* ]);
* https://developers.google.com/apps-script/reference/forms/checkbox-item#setChoices(Choice)
* @param choices an array of choices
*/
setChoices(choices: Choice[]): CheckboxItem;
/**
* Sets the feedback to be shown to respondents when they respond correctly to a question.
*
*
* // 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());
* https://developers.google.com/apps-script/reference/forms/checkbox-item#setFeedbackForCorrect(QuizFeedback)
* @param feedback the new feedback. A null value will clear the feedback.
*/
setFeedbackForCorrect(feedback: QuizFeedback): CheckboxItem;
/**
* Sets the feedback to be shown to respondents when they respond incorrectly to a question.
* https://developers.google.com/apps-script/reference/forms/checkbox-item#setFeedbackForIncorrect(QuizFeedback)
* @param feedback the new feedback
*/
setFeedbackForIncorrect(feedback: QuizFeedback): CheckboxItem;
/**
* Sets the item's help text (sometimes called description text for layout items like ImageItems, PageBreakItems, and SectionHeaderItems).
* https://developers.google.com/apps-script/reference/forms/checkbox-item#setHelpText(String)
* @param text the new help text
*/
setHelpText(text: string): CheckboxItem;
/**
* Sets the number of points a gradeable item is worth. The default for new items is 0.
* https://developers.google.com/apps-script/reference/forms/checkbox-item#setPoints(Integer)
* @param points the number of a points a question item is worth
*/
setPoints(points: Integer): CheckboxItem;
/**
* Sets whether the respondent must answer the question.
* https://developers.google.com/apps-script/reference/forms/checkbox-item#setRequired(Boolean)
* @param enabled whether the respondent must answer the question
*/
setRequired(enabled: boolean): CheckboxItem;
/**
* Sets the item's title (sometimes called header text, in the case of a SectionHeaderItem).
* https://developers.google.com/apps-script/reference/forms/checkbox-item#setTitle(String)
* @param title the new title or header text
*/
setTitle(title: string): CheckboxItem;
/**
* Sets the data validation for this checkbox item. Passing in null or a validation without any
* require functions called will remove any prior validation.
* https://developers.google.com/apps-script/reference/forms/checkbox-item#setValidation(CheckboxValidation)
* @param validation a CheckboxValidation to apply to this item.
*/
setValidation(validation: CheckboxValidation): CheckboxItem;
/**
* Sets whether the item has an "other" option. The default for a new CheckboxItem or
* MultipleChoiceItem is false.
* https://developers.google.com/apps-script/reference/forms/checkbox-item#showOtherOption(Boolean)
* @param enabled true if the item has an "other" option; false if not
*/
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);
*/
interface CheckboxValidation {
}
/**
* 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);
*/
interface CheckboxValidationBuilder {
/**
* Require at least this many choices to be selected.
* https://developers.google.com/apps-script/reference/forms/checkbox-validation-builder#requireSelectAtLeast(Integer)
* @param number
*/
requireSelectAtLeast(number: Integer): CheckboxValidationBuilder;
/**
* Require at most this many choices to be selected.
* https://developers.google.com/apps-script/reference/forms/checkbox-validation-builder#requireSelectAtMost(Integer)
* @param number
*/
requireSelectAtMost(number: Integer): CheckboxValidationBuilder;
/**
* Require exactly this many choices to be selected.
* https://developers.google.com/apps-script/reference/forms/checkbox-validation-builder#requireSelectExactly(Integer)
* @param number
*/
requireSelectExactly(number: Integer): CheckboxValidationBuilder;
}
/**
* A single choice associated with a type of Item that supports choices, like CheckboxItem, ListItem, or MultipleChoiceItem.
*
* // Create a new form and add a multiple-choice item.
* var form = FormApp.create('Form Name');
* var item = form.addMultipleChoiceItem();
* item.setTitle('Do you prefer cats or dogs?')
* .setChoices([
* item.createChoice('Cats', FormApp.PageNavigationType.CONTINUE),
* item.createChoice('Dogs', FormApp.PageNavigationType.RESTART)
* ]);
*
* // Add another page because navigation has no effect on the last page.
* form.addPageBreakItem().setTitle('You chose well!');
*
* // Log the navigation types that each choice results in.
* var choices = item.getChoices();
* for (var i = 0; i < choices.length; i++) {
* Logger.log('If the respondent chooses "%s", the form will %s.',
* choices[i].getValue(),
* choices[i].getPageNavigationType());
* }
*/
interface Choice {
/**
* Gets the PageBreakItem set as a GO_TO_PAGE destination
* if the responder selects this choice and completes the current page. This method applies only
* to choices associated with MultipleChoiceItems; for other choices,
* it returns null.
* https://developers.google.com/apps-script/reference/forms/choice#getGotoPage()
*/
getGotoPage(): PageBreakItem;
/**
* Gets the PageNavigationType that occurs if the responder selects this choice and
* completes the current page. This method applies only to choices associated with MultipleChoiceItems; for other choices, it returns null.
* https://developers.google.com/apps-script/reference/forms/choice#getPageNavigationType()
*/
getPageNavigationType(): PageNavigationType;
/**
* Gets the choice's value, which respondents see as a label when viewing the form.
* https://developers.google.com/apps-script/reference/forms/choice#getValue()
*/
getValue(): string;
/**
* Gets whether the choice is a correct answer for the question. This method only applies to
* questions that are part of a quiz; for non-quiz forms, it returns false.
* https://developers.google.com/apps-script/reference/forms/choice#isCorrectAnswer()
*/
isCorrectAnswer(): boolean;
}
/**
* 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');
* var item = form.addDateItem();
* item.setTitle('When were you born?');
*/
interface DateItem {
/**
* Creates a new ItemResponse for this date item. The time fields of the Date
* object are ignored; by default, only the year, month, and day fields are used. If setIncludesYear(enabled) is set to false, the year is
* ignored as well.
* https://developers.google.com/apps-script/reference/forms/date-item#createResponse(Date)
* @param response a Date object that represents a month, day, and possibly year
*/
createResponse(response: Date): ItemResponse;
/**
* Creates a copy of this item and appends it to the end of the form.
* https://developers.google.com/apps-script/reference/forms/date-item#duplicate()
*/
duplicate(): DateItem;
/**
* Returns the feedback that is shown to respondents when they respond to a gradeable question.
* https://developers.google.com/apps-script/reference/forms/date-item#getGeneralFeedback()
*/
getGeneralFeedback(): QuizFeedback;
/**
* Gets the item's help text (sometimes called description text for layout items like ImageItems, PageBreakItems, and SectionHeaderItems).
* https://developers.google.com/apps-script/reference/forms/date-item#getHelpText()
*/
getHelpText(): string;
/**
* Gets the item's unique identifier.
* https://developers.google.com/apps-script/reference/forms/date-item#getId()
*/
getId(): Integer;
/**
* Gets the index of the item among all the items in the form.
* https://developers.google.com/apps-script/reference/forms/date-item#getIndex()
*/
getIndex(): Integer;
/**
* Returns the point value of a gradeable item.
* https://developers.google.com/apps-script/reference/forms/date-item#getPoints()
*/
getPoints(): Integer;
/**
* Gets the item's title (sometimes called header text, in the case of a SectionHeaderItem).
* https://developers.google.com/apps-script/reference/forms/date-item#getTitle()
*/
getTitle(): string;
/**
* Gets the item's type, represented as an ItemType.
* https://developers.google.com/apps-script/reference/forms/date-item#getType()
*/
getType(): ItemType;
/**
* Determines whether the date item includes a year option.
* https://developers.google.com/apps-script/reference/forms/date-item#includesYear()
*/
includesYear(): boolean;
/**
* Determines whether the respondent must answer the question.
* https://developers.google.com/apps-script/reference/forms/date-item#isRequired()
*/
isRequired(): boolean;
/**
* Sets the feedback to be shown to respondents when they respond to a gradeable question that
* doesn't have a correct or incorrect answer (ie questions that require manual grading).
* https://developers.google.com/apps-script/reference/forms/date-item#setGeneralFeedback(QuizFeedback)
* @param feedback the new feedback
*/
setGeneralFeedback(feedback: QuizFeedback): DateItem;
/**
* Sets the item's help text (sometimes called description text for layout items like ImageItems, PageBreakItems, and SectionHeaderItems).
* https://developers.google.com/apps-script/reference/forms/date-item#setHelpText(String)
* @param text the new help text
*/
setHelpText(text: string): DateItem;
/**
* Sets whether the date item includes a year setting. The default for new date items is true.
* https://developers.google.com/apps-script/reference/forms/date-item#setIncludesYear(Boolean)
* @param enableYear true if the date includes a year setting; false if not
*/
setIncludesYear(enableYear: boolean): DateItem;
/**
* Sets the number of points a gradeable item is worth. The default for new items is 0.
* https://developers.google.com/apps-script/reference/forms/date-item#setPoints(Integer)
* @param points the number of a points a question item is worth
*/
setPoints(points: Integer): DateItem;
/**
* Sets whether the respondent must answer the question.
* https://developers.google.com/apps-script/reference/forms/date-item#setRequired(Boolean)
* @param enabled whether the respondent must answer the question
*/
setRequired(enabled: boolean): DateItem;
/**
* Sets the item's title (sometimes called header text, in the case of a SectionHeaderItem).
* https://developers.google.com/apps-script/reference/forms/date-item#setTitle(String)
* @param title the new title or header text
*/
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. 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');
* var item = form.addDateTimeItem();
* item.setTitle('When do you want to meet?');
*/
interface DateTimeItem {
/**
* Creates a new ItemResponse for this date-time item. The seconds field of the Date object is ignored; by default, the year, month, day, hour, and minute fields are used. If
* setIncludesYear(enabled) is set to false, the year is
* ignored as well.
* https://developers.google.com/apps-script/reference/forms/date-time-item#createResponse(Date)
* @param response a Date object that represents a month, day, hour, minute, and possibly year
*/
createResponse(response: Date): ItemResponse;
/**
* Creates a copy of this item and appends it to the end of the form.
* https://developers.google.com/apps-script/reference/forms/date-time-item#duplicate()
*/
duplicate(): DateTimeItem;
/**
* Returns the feedback that is shown to respondents when they respond to a gradeable question.
* https://developers.google.com/apps-script/reference/forms/date-time-item#getGeneralFeedback()
*/
getGeneralFeedback(): QuizFeedback;
/**
* Gets the item's help text (sometimes called description text for layout items like ImageItems, PageBreakItems, and SectionHeaderItems).
* https://developers.google.com/apps-script/reference/forms/date-time-item#getHelpText()
*/
getHelpText(): string;
/**
* Gets the item's unique identifier.
* https://developers.google.com/apps-script/reference/forms/date-time-item#getId()
*/
getId(): Integer;
/**
* Gets the index of the item among all the items in the form.
* https://developers.google.com/apps-script/reference/forms/date-time-item#getIndex()
*/
getIndex(): Integer;
/**
* Returns the point value of a gradeable item.
* https://developers.google.com/apps-script/reference/forms/date-time-item#getPoints()
*/
getPoints(): Integer;
/**
* Gets the item's title (sometimes called header text, in the case of a SectionHeaderItem).
* https://developers.google.com/apps-script/reference/forms/date-time-item#getTitle()
*/
getTitle(): string;
/**
* Gets the item's type, represented as an ItemType.
* https://developers.google.com/apps-script/reference/forms/date-time-item#getType()
*/
getType(): ItemType;
/**
* Determines whether the date item includes a year option.
* https://developers.google.com/apps-script/reference/forms/date-time-item#includesYear()
*/
includesYear(): boolean;
/**
* Determines whether the respondent must answer the question.
* https://developers.google.com/apps-script/reference/forms/date-time-item#isRequired()
*/
isRequired(): boolean;
/**
* Sets the feedback to be shown to respondents when they respond to a gradeable question that
* doesn't have a correct or incorrect answer (ie questions that require manual grading).
* https://developers.google.com/apps-script/reference/forms/date-time-item#setGeneralFeedback(QuizFeedback)
* @param feedback the new feedback
*/
setGeneralFeedback(feedback: QuizFeedback): DateTimeItem;
/**
* Sets the item's help text (sometimes called description text for layout items like ImageItems, PageBreakItems, and SectionHeaderItems).
* https://developers.google.com/apps-script/reference/forms/date-time-item#setHelpText(String)
* @param text the new help text
*/
setHelpText(text: string): DateTimeItem;
/**
* Sets whether the date item includes a year setting. The default for new date items is true.
* https://developers.google.com/apps-script/reference/forms/date-time-item#setIncludesYear(Boolean)
* @param enableYear true if the date includes a year setting; false if not
*/
setIncludesYear(enableYear: boolean): DateTimeItem;
/**
* Sets the number of points a gradeable item is worth. The default for new items is 0.
* https://developers.google.com/apps-script/reference/forms/date-time-item#setPoints(Integer)
* @param points the number of a points a question item is worth
*/
setPoints(points: Integer): DateTimeItem;
/**
* Sets whether the respondent must answer the question.
* https://developers.google.com/apps-script/reference/forms/date-time-item#setRequired(Boolean)
* @param enabled whether the respondent must answer the question
*/
setRequired(enabled: boolean): DateTimeItem;
/**
* Sets the item's title (sometimes called header text, in the case of a SectionHeaderItem).
* https://developers.google.com/apps-script/reference/forms/date-time-item#setTitle(String)
* @param title the new title or header text
*/
setTitle(title: string): DateTimeItem;
}
/**
* An enum representing the supported types of form-response destinations. All forms, including
* those that do not have a destination set explicitly, save a copy of responses in the form's
* response store. Destination types can be accessed from FormApp.DestinationType.
*
* To call an enum, you call its parent class, name, and property. For example,
* FormApp.DestinationType.SPREADSHEET.
*
* // Open a form by ID and create a new spreadsheet.
* var form = FormApp.openById('1234567890abcdefghijklmnopqrstuvwxyz');
* var ss = SpreadsheetApp.create('Spreadsheet Name');
*
* // Update the form's response destination.
* form.setDestination(FormApp.DestinationType.SPREADSHEET, ss.getId());
*/
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. 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');
* var item = form.addDurationItem();
* item.setTitle('How long can you hold your breath?');
*/
interface DurationItem {
/**
* Creates a new ItemResponse for this date item. The arguments hours, minutes, and seconds are best represented as integers from 0 to 72 for
* hours and 0 to 59 for minutes and seconds. Values that
* exceed those bounds are clamped: for example, 24, 60, 90 is interpreted as 24:59:59.
* https://developers.google.com/apps-script/reference/forms/duration-item#createResponse(Integer,Integer,Integer)
* @param hours the hours, represented as an integer from 0 to 72
* @param minutes the minutes, represented as an integer from 0 to 59
* @param seconds the seconds, represented as an integer from 0 to 59
*/
createResponse(hours: Integer, minutes: Integer, seconds: Integer): ItemResponse;
/**
* Creates a copy of this item and appends it to the end of the form.
* https://developers.google.com/apps-script/reference/forms/duration-item#duplicate()
*/
duplicate(): DurationItem;
/**
* Returns the feedback that is shown to respondents when they respond to a gradeable question.
* https://developers.google.com/apps-script/reference/forms/duration-item#getGeneralFeedback()
*/
getGeneralFeedback(): QuizFeedback;
/**
* Gets the item's help text (sometimes called description text for layout items like ImageItems, PageBreakItems, and SectionHeaderItems).
* https://developers.google.com/apps-script/reference/forms/duration-item#getHelpText()
*/
getHelpText(): string;
/**
* Gets the item's unique identifier.
* https://developers.google.com/apps-script/reference/forms/duration-item#getId()
*/
getId(): Integer;
/**
* Gets the index of the item among all the items in the form.
* https://developers.google.com/apps-script/reference/forms/duration-item#getIndex()
*/
getIndex(): Integer;
/**
* Returns the point value of a gradeable item.
* https://developers.google.com/apps-script/reference/forms/duration-item#getPoints()
*/
getPoints(): Integer;
/**
* Gets the item's title (sometimes called header text, in the case of a SectionHeaderItem).
* https://developers.google.com/apps-script/reference/forms/duration-item#getTitle()
*/
getTitle(): string;
/**
* Gets the item's type, represented as an ItemType.
* https://developers.google.com/apps-script/reference/forms/duration-item#getType()
*/
getType(): ItemType;
/**
* Determines whether the respondent must answer the question.
* https://developers.google.com/apps-script/reference/forms/duration-item#isRequired()
*/
isRequired(): boolean;
/**
* Sets the feedback to be shown to respondents when they respond to a gradeable question that
* doesn't have a correct or incorrect answer (ie questions that require manual grading).
* https://developers.google.com/apps-script/reference/forms/duration-item#setGeneralFeedback(QuizFeedback)
* @param feedback the new feedback
*/
setGeneralFeedback(feedback: QuizFeedback): DurationItem;
/**
* Sets the item's help text (sometimes called description text for layout items like ImageItems, PageBreakItems, and SectionHeaderItems).
* https://developers.google.com/apps-script/reference/forms/duration-item#setHelpText(String)
* @param text the new help text
*/
setHelpText(text: string): DurationItem;
/**
* Sets the number of points a gradeable item is worth. The default for new items is 0.
* https://developers.google.com/apps-script/reference/forms/duration-item#setPoints(Integer)
* @param points the number of a points a question item is worth
*/
setPoints(points: Integer): DurationItem;
/**
* Sets whether the respondent must answer the question.
* https://developers.google.com/apps-script/reference/forms/duration-item#setRequired(Boolean)
* @param enabled whether the respondent must answer the question
*/
setRequired(enabled: boolean): DurationItem;
/**
* Sets the item's title (sometimes called header text, in the case of a SectionHeaderItem).
* https://developers.google.com/apps-script/reference/forms/duration-item#setTitle(String)
* @param title the new title or header text
*/
setTitle(title: string): DurationItem;
}
/**
* An enum representing the supported types of feedback. Feedback types can be accessed from FormApp.FeedbackType.
*
* To call an enum, you call its parent class, name, and property. For example,
* FormApp.FeedbackType.CORRECT.
*
* // 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());
*/
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');
* var ss = SpreadsheetApp.create('Spreadsheet Name');
*
* // Update form properties via chaining.
* form.setTitle('Form Name')
* .setDescription('Description of form')
* .setConfirmationMessage('Thanks for responding!')
* .setAllowResponseEdits(true)
* .setAcceptingResponses(false);
*
* // Update the form's response destination.
* form.setDestination(FormApp.DestinationType.SPREADSHEET, ss.getId());
*/
interface Form {
/**
* Appends a new question item, presented as a grid of columns and rows, that allows the
* respondent to select multiple choices per row from a sequence of checkboxes.
*
*
* // Opens the Forms file by its URL. If you created your script from within a
* // Google Forms file, you can use FormApp.getActiveForm() instead.
* // TODO(developer): Replace the URL with your own.
* const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit');
*
* // Adds a checkbox grid item.
* const item = form.addCheckboxGridItem();
*
* // Sets the title 'Where did you celebrate New Year's?'
* item.setTitle('Where did you celebrate New Year's?');
*
* // Sets the grid's rows and columns.
* item.setRows(['New York', 'San Francisco', 'London'])
* .setColumns(['2014', '2015', '2016', '2017']);
* https://developers.google.com/apps-script/reference/forms/form#addCheckboxGridItem()
*/
addCheckboxGridItem(): CheckboxGridItem;
/**
* Appends a new question item that allows the respondent to select one or more checkboxes, as
* well as an optional "other" field.
*
*
* // Opens the Forms file by its URL. If you created your script from within a
* // Google Forms file, you can use FormApp.getActiveForm() instead.
* // TODO(developer): Replace the URL with your own.
* const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit');
*
* // Adds a checkbox item.
* const item = form.addCheckboxItem();
*
* // Sets the title of the checkbox item to 'Do you prefer cats or dogs?'
* item.setTitle('Do you prefer cats or dogs?');
*
* // Sets the choices.
* item.setChoiceValues(['Cats', 'Dogs']);
* https://developers.google.com/apps-script/reference/forms/form#addCheckboxItem()
*/
addCheckboxItem(): CheckboxItem;
/**
* Appends a new question item that allows the respondent to indicate a date.
*
*
* // Opens the Forms file by its URL. If you created your script from within a
* // Google Forms file, you can use FormApp.getActiveForm() instead.
* // TODO(developer): Replace the URL with your own.
* const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit');
*
* // Adds a date item.
* const item = form.addDateItem();
*
* // Sets the title to 'When were you born?'
* item.setTitle('When were you born?');
*
* // Sets the description for the date item.
* item.setHelpText('Some helper text.');
* https://developers.google.com/apps-script/reference/forms/form#addDateItem()
*/
addDateItem(): DateItem;
/**
* Appends a new question item that allows the respondent to indicate a date and time.
*
*
* // Opens the Forms file by its URL. If you created your script from within a
* // Google Forms file, you can use FormApp.getActiveForm() instead.
* // TODO(developer): Replace the URL with your own.
* const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit');
*
* // Adds a question with date and time inputs.
* const item = form.addDateTimeItem();
*
* // Sets the title to 'When were you born?'
* item.setTitle('When were you born?');
*
* // Sets the question as required.
* item.setRequired(true);
* https://developers.google.com/apps-script/reference/forms/form#addDateTimeItem()
*/
addDateTimeItem(): DateTimeItem;
/**
* Appends a new question item that allows the respondent to indicate a length of time.
*
*
* // Opens the Forms file by its URL. If you created your script from within a
* // Google Forms file, you can use FormApp.getActiveForm() instead.
* // TODO(developer): Replace the URL with your own.
* const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit');
*
* // Adds a question with a duration input.
* const item = form.addDurationItem();
*
* // Sets the title to 'How long can you hold your breath?'
* item.setTitle('How long can you hold your breath?');
*
* // Sets the question as required.
* item.setRequired(true);
* https://developers.google.com/apps-script/reference/forms/form#addDurationItem()
*/
addDurationItem(): DurationItem;
/**
* Adds the given user to the list of editors for the Form. If the user was already
* on the list of viewers, this method promotes the user out of the list of viewers.
* https://developers.google.com/apps-script/reference/forms/form#addEditor(String)
* @param emailAddress The email address of the user to add.
*/
addEditor(emailAddress: string): Form;
/**
* Adds the given user to the list of editors for the Form. If the user was already
* on the list of viewers, this method promotes the user out of the list of viewers.
* https://developers.google.com/apps-script/reference/forms/form#addEditor(User)
* @param user A representation of the user to add.
*/
addEditor(user: Base.User): Form;
/**
* Adds the given array of users to the list of editors for the Form. If any of the
* users were already on the list of viewers, this method promotes them out of the list of
* viewers.
* https://developers.google.com/apps-script/reference/forms/form#addEditors(String)
* @param emailAddresses An array of email addresses of the users to add.
*/
addEditors(emailAddresses: string[]): Form;
/**
* Appends a new 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.
*
*
* // Opens the Forms file by its URL. If you created your script from within a
* // Google Forms file, you can use FormApp.getActiveForm() instead.
* // TODO(developer): Replace the URL with your own.
* const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit');
*
* // Adds a multiple choice grid.
* const item = form.addGridItem();
*
* // Sets the title to 'Rate your interests.'
* item.setTitle('Rate your interests');
*
* // Sets the grid's rows and columns.
* item.setRows(['Cars', 'Computers', 'Celebrities'])
* .setColumns(['Boring', 'So-so', 'Interesting']);
* https://developers.google.com/apps-script/reference/forms/form#addGridItem()
*/
addGridItem(): GridItem;
/**
* Appends a new layout item that displays an image.
*
*
* // Opens the Forms file by its URL. If you created your script from within a
* // Google Forms file, you can use FormApp.getActiveForm() instead.
* // TODO(developer): Replace the URL with your own.
* const form = FormApp.openByUrl('https://docs.google.com/forms/d/abc123456/edit');
*
* // Adds an image item.
* const item = form.addImageItem();
*
* // Gets the Google icon to use as the image.
* const img = UrlFetchApp.fetch('https://fonts.gstatic.com/s/i/productlogos/googleg/v6/web-24dp/logo_googleg_color_1x_web_24dp.png');
*
* // Sets the image, title, and description for the it