UNPKG

gas-types-detailed

Version:

Enhanced Google Apps Script Type Definitions with detailed documentation. Includes type definitions plus code snippets, return values, required authorization scopes, and other details not found in @types/google-apps-script.

1,243 lines (1,176 loc) 394 kB
// Type definitions for Google Apps Script 2025-11-10 // 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 * const form = FormApp.openById('1234567890abcdefghijklmnopqrstuvwxyz'); * const 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 checkbox grid item. * const form = FormApp.openById('1234567890abcdefghijklmnopqrstuvwxyz'); * const 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. * * Return: * - CheckboxGridItem — this item, for chaining * * Authorization: * * Scripts that use this method require authorization with one or more of the following scopes: * - https://www.googleapis.com/auth/forms.currentonly * - https://www.googleapis.com/auth/forms * * 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. * * Return: * - ItemResponse — the item response * * Authorization: * * Scripts that use this method require authorization with one or more of the following scopes: * - https://www.googleapis.com/auth/forms.currentonly * - https://www.googleapis.com/auth/forms * * 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. * * Return: * - CheckboxGridItem — a duplicate of this CheckboxGridItem, for chaining * * Authorization: * * Scripts that use this method require authorization with one or more of the following scopes: * - https://www.googleapis.com/auth/forms.currentonly * - https://www.googleapis.com/auth/forms * * https://developers.google.com/apps-script/reference/forms/checkbox-grid-item#duplicate() */ duplicate(): CheckboxGridItem; /** * Gets the values for every column in the grid. * * Return: * - String[] — an array of column values, which respondents see as labels when viewing the form * * Authorization: * * Scripts that use this method require authorization with one or more of the following scopes: * - https://www.googleapis.com/auth/forms.currentonly * - https://www.googleapis.com/auth/forms * * 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). * * Return: * - String — the item's help text or description text * * Authorization: * * Scripts that use this method require authorization with one or more of the following scopes: * - https://www.googleapis.com/auth/forms.currentonly * - https://www.googleapis.com/auth/forms * * https://developers.google.com/apps-script/reference/forms/checkbox-grid-item#getHelpText() */ getHelpText(): string; /** * Gets the item's unique identifier. * * Return: * - Integer — the item's ID * * Authorization: * * Scripts that use this method require authorization with one or more of the following scopes: * - https://www.googleapis.com/auth/forms.currentonly * - https://www.googleapis.com/auth/forms * * 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. * * Return: * - Integer — the index of the item * * Authorization: * * Scripts that use this method require authorization with one or more of the following scopes: * - https://www.googleapis.com/auth/forms.currentonly * - https://www.googleapis.com/auth/forms * * https://developers.google.com/apps-script/reference/forms/checkbox-grid-item#getIndex() */ getIndex(): Integer; /** * Gets the values for every row in the grid. * * Return: * - String[] — an array of row values, which respondents see as labels when viewing the form * * Authorization: * * Scripts that use this method require authorization with one or more of the following scopes: * - https://www.googleapis.com/auth/forms.currentonly * - https://www.googleapis.com/auth/forms * * 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). * * Return: * - String — the item's title or header text * * Authorization: * * Scripts that use this method require authorization with one or more of the following scopes: * - https://www.googleapis.com/auth/forms.currentonly * - https://www.googleapis.com/auth/forms * * https://developers.google.com/apps-script/reference/forms/checkbox-grid-item#getTitle() */ getTitle(): string; /** * Gets the item's type, represented as an ItemType. * * Return: * - ItemType — the item's type * * Authorization: * * Scripts that use this method require authorization with one or more of the following scopes: * - https://www.googleapis.com/auth/forms.currentonly * - https://www.googleapis.com/auth/forms * * https://developers.google.com/apps-script/reference/forms/checkbox-grid-item#getType() */ getType(): ItemType; /** * Determines whether the respondent must answer the question. * * Return: * - Boolean — whether the respondent must answer the question * * Authorization: * * Scripts that use this method require authorization with one or more of the following scopes: * - https://www.googleapis.com/auth/forms.currentonly * - https://www.googleapis.com/auth/forms * * 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. * * Return: * - CheckboxGridItem — this item, for chaining * * Throws: * - Error — if the given array is null or empty * * Authorization: * * Scripts that use this method require authorization with one or more of the following scopes: * - https://www.googleapis.com/auth/forms.currentonly * - https://www.googleapis.com/auth/forms * * 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). * * Return: * - CheckboxGridItem — this CheckboxGridItem, for chaining * * Authorization: * * Scripts that use this method require authorization with one or more of the following scopes: * - https://www.googleapis.com/auth/forms.currentonly * - https://www.googleapis.com/auth/forms * * 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. * * Return: * - CheckboxGridItem — the current item (for chaining) * * Authorization: * * Scripts that use this method require authorization with one or more of the following scopes: * - https://www.googleapis.com/auth/forms.currentonly * - https://www.googleapis.com/auth/forms * * 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. * * Return: * - CheckboxGridItem — this item, for chaining * * Throws: * - Error — if the given array is null or empty * * Authorization: * * Scripts that use this method require authorization with one or more of the following scopes: * - https://www.googleapis.com/auth/forms.currentonly * - https://www.googleapis.com/auth/forms * * 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). * * Return: * - CheckboxGridItem — this CheckboxGridItem, for chaining * * Authorization: * * Scripts that use this method require authorization with one or more of the following scopes: * - https://www.googleapis.com/auth/forms.currentonly * - https://www.googleapis.com/auth/forms * * 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. * * Return: * - CheckboxGridItem — this CheckboxGridItem, for chaining * * Authorization: * * Scripts that use this method require authorization with one or more of the following scopes: * - https://www.googleapis.com/auth/forms.currentonly * - https://www.googleapis.com/auth/forms * * 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. * const form = FormApp.openById('123abc'); * const checkboxGridItem = form.addCheckboxGridItem(); * checkboxGridItem.setTitle('Where did you celebrate New Years?') * .setRows(['New York', 'San Francisco', 'London']) * .setColumns(['2014', '2015', '2016', '2017']); * const 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. * const form = FormApp.openById('123abc'); * const checkboxGridItem = form.addCheckboxGridItem(); * checkboxGridItem.setTitle('Where did you celebrate New Years?') * .setRows(['New York', 'San Francisco', 'London']) * .setColumns(['2014', '2015', '2016', '2017']); * const 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. * * Return: * - CheckboxGridValidationBuilder — this validation builder, for chaining * * 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. * const form = FormApp.openById('1234567890abcdefghijklmnopqrstuvwxyz'); * const 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. * * Return: * - CheckboxItem — this CheckboxItem, for chaining * * Authorization: * * Scripts that use this method require authorization with one or more of the following scopes: * - https://www.googleapis.com/auth/forms.currentonly * - https://www.googleapis.com/auth/forms * * https://developers.google.com/apps-script/reference/forms/checkbox-item#clearValidation() */ clearValidation(): CheckboxItem; /** * Creates a new choice. * * Return: * - Choice — the new choice * * Authorization: * * Scripts that use this method require authorization with one or more of the following scopes: * - https://www.googleapis.com/auth/forms.currentonly * - https://www.googleapis.com/auth/forms * * 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. * * Return: * - Choice — the new choice * * Authorization: * * Scripts that use this method require authorization with one or more of the following scopes: * - https://www.googleapis.com/auth/forms.currentonly * - https://www.googleapis.com/auth/forms * * 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. * * Return: * - ItemResponse — the item response * * Authorization: * * Scripts that use this method require authorization with one or more of the following scopes: * - https://www.googleapis.com/auth/forms.currentonly * - https://www.googleapis.com/auth/forms * * 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. * * Return: * - CheckboxItem — a duplicate of this CheckboxItem, for chaining * * Authorization: * * Scripts that use this method require authorization with one or more of the following scopes: * - https://www.googleapis.com/auth/forms.currentonly * - https://www.googleapis.com/auth/forms * * https://developers.google.com/apps-script/reference/forms/checkbox-item#duplicate() */ duplicate(): CheckboxItem; /** * Gets all choices for an item. * * Return: * - Choice[] — an array of choices * * Authorization: * * Scripts that use this method require authorization with one or more of the following scopes: * - https://www.googleapis.com/auth/forms.currentonly * - https://www.googleapis.com/auth/forms * * 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. * * Return: * - QuizFeedback — the feedback, if any. * * Authorization: * * Scripts that use this method require authorization with one or more of the following scopes: * - https://www.googleapis.com/auth/forms.currentonly * - https://www.googleapis.com/auth/forms * * 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. * * Return: * - QuizFeedback — the feedback, if any. * * Authorization: * * Scripts that use this method require authorization with one or more of the following scopes: * - https://www.googleapis.com/auth/forms.currentonly * - https://www.googleapis.com/auth/forms * * 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). * * Return: * - String — the item's help text or description text * * Authorization: * * Scripts that use this method require authorization with one or more of the following scopes: * - https://www.googleapis.com/auth/forms.currentonly * - https://www.googleapis.com/auth/forms * * https://developers.google.com/apps-script/reference/forms/checkbox-item#getHelpText() */ getHelpText(): string; /** * Gets the item's unique identifier. * * Return: * - Integer — the item's ID * * Authorization: * * Scripts that use this method require authorization with one or more of the following scopes: * - https://www.googleapis.com/auth/forms.currentonly * - https://www.googleapis.com/auth/forms * * 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. * * Return: * - Integer — the index of the item * * Authorization: * * Scripts that use this method require authorization with one or more of the following scopes: * - https://www.googleapis.com/auth/forms.currentonly * - https://www.googleapis.com/auth/forms * * https://developers.google.com/apps-script/reference/forms/checkbox-item#getIndex() */ getIndex(): Integer; /** * Returns the point value of a gradeable item. * * Return: * - Integer — the number of points a question is worth. * * Authorization: * * Scripts that use this method require authorization with one or more of the following scopes: * - https://www.googleapis.com/auth/forms.currentonly * - https://www.googleapis.com/auth/forms * * 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). * * Return: * - String — the item's title or header text * * Authorization: * * Scripts that use this method require authorization with one or more of the following scopes: * - https://www.googleapis.com/auth/forms.currentonly * - https://www.googleapis.com/auth/forms * * https://developers.google.com/apps-script/reference/forms/checkbox-item#getTitle() */ getTitle(): string; /** * Gets the item's type, represented as an ItemType. * * Return: * - ItemType — the item's type * * Authorization: * * Scripts that use this method require authorization with one or more of the following scopes: * - https://www.googleapis.com/auth/forms.currentonly * - https://www.googleapis.com/auth/forms * * https://developers.google.com/apps-script/reference/forms/checkbox-item#getType() */ getType(): ItemType; /** * Determines whether the item has an "other" option. * * Return: * - Boolean — true if the item has an "other" option; false if not * * Authorization: * * Scripts that use this method require authorization with one or more of the following scopes: * - https://www.googleapis.com/auth/forms.currentonly * - https://www.googleapis.com/auth/forms * * https://developers.google.com/apps-script/reference/forms/checkbox-item#hasOtherOption() */ hasOtherOption(): boolean; /** * Determines whether the respondent must answer the question. * * Return: * - Boolean — whether the respondent must answer the question * * Authorization: * * Scripts that use this method require authorization with one or more of the following scopes: * - https://www.googleapis.com/auth/forms.currentonly * - https://www.googleapis.com/auth/forms * * 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. * const form = FormApp.openById('1234567890abcdefghijklmnopqrstuvwxyz'); * const item = form.addListItem(); * item.setTitle('Do you prefer cats or dogs?'); * item.setChoiceValues(['Dogs', 'Cats']); * * Return: * - CheckboxItem — this CheckboxItem, for chaining * * Authorization: * * Scripts that use this method require authorization with one or more of the following scopes: * - https://www.googleapis.com/auth/forms.currentonly * - https://www.googleapis.com/auth/forms * * 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. * const form = FormApp.openById('1234567890abcdefghijklmnopqrstuvwxyz'); * const item = form.addListItem(); * item.setTitle('Do you prefer cats or dogs?'); * item.setChoices([item.createChoice('Cats'), item.createChoice('Dogs')]); * * Return: * - CheckboxItem — this CheckboxItem, for chaining * * Throws: * - Error — if the given array is null, empty, or contains a null element * * Authorization: * * Scripts that use this method require authorization with one or more of the following scopes: * - https://www.googleapis.com/auth/forms.currentonly * - https://www.googleapis.com/auth/forms * * 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. * const form = FormApp.openById('1234567890abcdefghijklmnopqrstuvwxyz'); * const 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(), * ); * * Return: * - CheckboxItem — this CheckboxItem, for chaining * * Authorization: * * Scripts that use this method require authorization with one or more of the following scopes: * - https://www.googleapis.com/auth/forms.currentonly * - https://www.googleapis.com/auth/forms * * 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. * * Return: * - CheckboxItem — this CheckboxItem, for chaining * * Authorization: * * Scripts that use this method require authorization with one or more of the following scopes: * - https://www.googleapis.com/auth/forms.currentonly * - https://www.googleapis.com/auth/forms * * 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). * * Return: * - CheckboxItem — this CheckboxItem, for chaining * * Authorization: * * Scripts that use this method require authorization with one or more of the following scopes: * - https://www.googleapis.com/auth/forms.currentonly * - https://www.googleapis.com/auth/forms * * 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. * * Return: * - CheckboxItem — this CheckboxItem, for chaining * * Authorization: * * Scripts that use this method require authorization with one or more of the following scopes: * - https://www.googleapis.com/auth/forms.currentonly * - https://www.googleapis.com/auth/forms * * 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. * * Return: * - CheckboxItem — the current item (for chaining) * * Authorization: * * Scripts that use this method require authorization with one or more of the following scopes: * - https://www.googleapis.com/auth/forms.currentonly * - https://www.googleapis.com/auth/forms * * 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). * * Return: * - CheckboxItem — this CheckboxItem, for chaining * * Authorization: * * Scripts that use this method require authorization with one or more of the following scopes: * - https://www.googleapis.com/auth/forms.currentonly * - https://www.googleapis.com/auth/forms * * 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. * * Return: * - CheckboxItem — this CheckboxItem, for chaining * * Authorization: * * Scripts that use this method require authorization with one or more of the following scopes: * - https://www.googleapis.com/auth/forms.currentonly * - https://www.googleapis.com/auth/forms * * 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. * * Return: * - CheckboxItem — this CheckboxItem, for chaining * * Authorization: * * Scripts that use this method require authorization with one or more of the following scopes: * - https://www.googleapis.com/auth/forms.currentonly * - https://www.googleapis.com/auth/forms * * 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. * const form = FormApp.create('My Form'); * const 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'), * ]); * const 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. * const form = FormApp.create('My Form'); * const 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'), * ]); * const checkBoxValidation = FormApp.createCheckboxValidation() * .setHelpText('Select two condiments.') * .requireSelectExactly(2) * .build(); * checkBoxItem.setValidation(checkBoxValidation); */ interface CheckboxValidationBuilder { /** * Require at least this many choices to be selected. * * Return: * - CheckboxValidationBuilder — this CheckboxValidationBuilder, for chaining * * 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. * * Return: * - CheckboxValidationBuilder — this CheckboxValidationBuilder, for chaining * * 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. * * Return: * - CheckboxValidationBuilder — this CheckboxValidationBuilder, for chaining * * 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. * const form = FormApp.create('Form Name'); * const 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. * const choices = item.getChoices(); * for (let 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. * * Return: * - PageBreakItem — the GO_TO_PAGE destination for this choice, or null if there is none * * Authorization: * * Scripts that use this method require authorization with one or more of the following scopes: * - https://www.googleapis.com/auth/forms.currentonly * - https://www.googleapis.com/auth/forms * * 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. * * Return: * - PageNavigationType — the navigation action for this choice, or null if there is none * * Authorization: * * Scripts that use this method require authorization with one or more of the following scopes: * - https://www.googleapis.com/auth/forms.currentonly * - https://www.googleapis.com/auth/forms * * 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. * * Return: * - String — the choice's value * * Authorization: * * Scripts that use this method require authorization with one or more of the following scopes: * - https://www.googleapis.com/auth/forms.currentonly * - https://www.googleapis.com/auth/forms * * 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. * * Return: * - Boolean — Whether the choice is a correct answer. * * Authorization: * * Scripts that use this method require authorization with one or more of the following scopes: * - https://www.googleapis.com/auth/forms.currentonly * - https://www.googleapis.com/auth/forms * * 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. * const form = FormApp.openById('1234567890abcdefghijklmnopqrstuvwxyz'); * const 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. * * Return: * - ItemResponse — the item response * * Authorization: * * Scripts that use this method require authorization with one or more of the following scopes: * - https://www.googleapis.com/auth/forms.currentonly * - https://www.googleapis.com/auth/forms * * 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. * * Return: * - DateItem — a duplicate of this DateItem, for chaining * * Authorization: * * Scripts that use this method require authorization with one or more of the following scopes: * - https://www.googleapis.com/auth/forms.currentonly * - https://www.googleapis.com/auth/forms * * 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. * * Return: * - QuizFeedback — the feedback, if any. * * Authorization: * * Scripts that use this method require authorization with one or more of the following scopes: * - https://www.googleapis.com/auth/forms.currentonly * - https://www.googleapis.com/auth/forms * * 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). * * Return: * - String — the item's help text or description text * * Authorization: * * Scripts that use this method require authorization with one or more of the following scopes: * - https://www.googleapis.com/auth/forms.currentonly * - https://www.googleapis.com/auth/forms * * https://developers.google.com/apps-script/reference/forms/date-item#getHelpText() */ getHelpText(): string; /** * Gets the item's unique identifier. * * Return: * - Integer — the item's ID * * Authorization: * * Scripts that use this method require authorization with one or more of the following scopes: * - https://www.googleapis.com/auth/forms.currentonly * - https://www.googleapis.com/auth/forms * * 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. * * Return: * - Integer — the index of the item * * Authorization: * * Scripts that use this method require authorization with one or more of the following scopes: * - https://www.googleapis.com/auth/forms.currentonly * - https://www.googleapis.com/auth/forms * * https://developers.google.com/apps-script/reference/forms/date-item#getIndex() */ getIndex(): Integer; /** * Returns the point value of a gradeable item. * * Return: * - Integer — the number of points a question is worth. * * Authorization: * * Scripts that use this method require authorization with one or more of the following scopes: * - https://www.googleapis.com/auth/forms.currentonly * - https://www.googleapis.com/auth/forms * * 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). * * Return: * - String — the item's title or header text * * Authorization: * * Scripts that use this method require authorization with one or more of the following scopes: * - https://www.googleapis.com/auth/forms.currentonly * - https://www.googleapis.com/auth/forms * * https://developers.google.com/apps-script/reference/forms/date-item#getTitle() */ getTitle(): string; /** * Gets the item's type, represented as an ItemType. * * Return: * - ItemType — the item's type * * Authorization: * * Scripts that use this method require authorization with one or more of the following scopes: * - https://www.googleapis.com/auth/forms.currentonly * - https://www.googleapis.com/auth/forms * * https://developers.google.com/apps-script/reference/forms/date-item#getType() */ getType(): ItemType; /** * Determines whether the date item includes a year option. * * Return: * - Boolean — true if the date includes a year setting; false if not * * Authorization: * * Scripts that use this method require authorization with one or more of the following scopes: * - https://www.googleapis.com/auth/forms.currentonly * - https://www.googleapis.com/auth/forms * * https://developers.google.com/apps-script/reference/forms/date-item#includesYear() */ includesYear(): boolean; /** * Determines whether the respondent must answer the question. * * Return: * - Boolean — whether the respondent must answer the question * * Authorization: * * Scripts that use this method require authorization with one or more of the following scopes: * - https://www.googleapis.com/auth/forms.currentonly * - https://www.googleapis.com/auth/forms * * 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). * * Return: * - DateItem — this DateItem, for chaining * * Authorization: * * Scripts that use this method require authorization with one or more of the following scopes: * - https://www.googleapis.com/auth/forms.currentonly * - https://www.googleapis.com/auth/forms * * 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). * * Return: * - DateItem — this DateItem, for chaining * * Authorization: * * Scripts that use this method require authorization with one or more of the following scopes: * - https://www.googleapis.com/auth/forms.currentonly * - https://www.googleapis.com/auth/forms * * 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. * * Return: * - DateItem — this DateItem, for chaining * * Authorization: * * Scripts that use this method require authorization with one or more of the following scopes: * - https://www.googleapis.com/auth/forms.currentonly * - https://www.googleapis.com/auth/forms * * https://developers.google.com/apps-script/reference/forms/date-item#setIncludesYear(Boolean) *