diff --git a/types/google-apps-script/google-apps-script.card-service.d.ts b/types/google-apps-script/google-apps-script.card-service.d.ts index 1f5c1eb0c2056c..00d13ae366f13a 100644 --- a/types/google-apps-script/google-apps-script.card-service.d.ts +++ b/types/google-apps-script/google-apps-script.card-service.d.ts @@ -14,12 +14,25 @@ declare namespace GoogleAppsScript { * .setParameters({imageSrc: 'carImage'})); */ interface Action { + addRequiredWidget(requiredWidget: string): Action; + setAllWidgetsAreRequired(allWidgetsAreRequired: boolean): Action; setFunctionName(functionName: string): Action; + setInteraction(interaction: Interaction): Action; setLoadIndicator(loadIndicator: LoadIndicator): Action; setParameters(parameters: { [key: string]: string }): Action; /** @deprecated DO NOT USE */ setMethodName(functionName: string): Action; setPersistValues(persistValues: boolean): Action; } + + /** + * An enum type that specifies what to do in response to an interaction with a user, + * such as a user clicking a button in a card message. + */ + enum Interaction { + INTERACTION_UNSPECIFIED, + OPEN_DIALOG, + } + /** * The response object that may be returned from a callback function (e.g., a form response handler) * to perform one or more actions on the client. Some combinations of actions are not supported. @@ -271,6 +284,7 @@ declare namespace GoogleAppsScript { TextButtonStyle: typeof TextButtonStyle; UpdateDraftBodyType: typeof UpdateDraftBodyType; InputType: typeof InputType; + Interaction: typeof Interaction; newAction(): Action; newActionResponseBuilder(): ActionResponseBuilder; newAttachment(): Attachment; diff --git a/types/google-apps-script/test/google-apps-script-tests.ts b/types/google-apps-script/test/google-apps-script-tests.ts index c71ed8e55fc6d9..49f146bad30d35 100644 --- a/types/google-apps-script/test/google-apps-script-tests.ts +++ b/types/google-apps-script/test/google-apps-script-tests.ts @@ -592,6 +592,11 @@ function timeDriven(e: GoogleAppsScript.Events.TimeDriven) { } } +CardService.newAction(); // $ExpectType Action +CardService.newAction().addRequiredWidget(""); // $ExpectType Action +CardService.newAction().setAllWidgetsAreRequired(true); // $ExpectType Action +CardService.newAction().setInteraction(CardService.Interaction.OPEN_DIALOG); // $ExpectType Action + CardService.newTextButton().setAltText("alt text"); // $ExpectType TextButton CardService.newLinkPreview().setTitle("Smart chip title"); // $ExpectType LinkPreview