From cd5aa114af5622be3ae699688bb5e231000d97e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Yamanqui=20Garc=C3=ADa=20Rosales?= Date: Sun, 5 Oct 2025 18:48:35 -0700 Subject: [PATCH] =?UTF-8?q?=F0=9F=A4=96=20Merge=20PR=20#73742=20google-app?= =?UTF-8?q?s-script:=20Added=20missing=20methods=20for=20Action=20by=20@Ya?= =?UTF-8?q?manquiChacala?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-authored-by: Yamanqui GarcĂ­a Rosales --- .../google-apps-script.card-service.d.ts | 14 ++++++++++++++ .../test/google-apps-script-tests.ts | 5 +++++ 2 files changed, 19 insertions(+) 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