Class ActionResponseBuilder

Action Response Builder

A builder for Action Response objects.

Available for Google Workspace add-ons.

 const 
  
 notification 
  
 = 
  
 AddOnsResponseService 
 . 
 newNotification 
 (). 
 setText 
 ( 
 "You closed a dialog!" 
 ); 
 const 
  
 navigation 
  
 = 
  
 AddOnsResponseService 
 . 
 newNavigation 
 () 
  
 . 
 setEndNavigation 
 ( 
 AddOnsResponseService 
 . 
 EndNavigation 
 . 
 CLOSE_DIALOG 
 ); 
 const 
  
 action 
  
 = 
  
 AddOnsResponseService 
 . 
 newActionResponseBuilder 
 () 
  
 . 
 setNavigation 
 ( 
 navigation 
 ) 
  
 . 
 setNotification 
 ( 
 notification 
 ) 
  
 . 
 build 
 (); 

Methods

Method Return type Brief description
Action Response Builder Sets the modify card operation to the action.
Action Response Builds the current action response and validates it.
Action Response Builder Sets the LinkPreview to the action.
Action Response Builder Sets the response to a Navigation action.
Action Response Builder Sets the notification to display when the action is activated.
Action Response Builder Sets the URL to navigate to when the action is activated.
Action Response Builder Sets a flag to indicate that this action changed the existing data state.

Detailed documentation

add Modify Card(modifyCard)

Sets the modify card operation to the action.

Parameters

Name Type Description
modify Card
Modify Card The Modify Card to use.

Return

Action Response Builder — This object, for chaining.


build()

Builds the current action response and validates it.

Return

Action Response — A validated ActionResponse.

Throws

Error — if the constructed action response isn't valid.


set Link Preview(linkPreview)

Sets the LinkPreview to the action.

Parameters

Name Type Description
link Preview
Link Preview The Link Preview to use.

Return

Action Response Builder — This object, for chaining.


set Navigation(navigation)

Sets the response to a Navigation action.

 const 
  
 navigation 
  
 = 
  
 AddOnsResponseService 
 . 
 newNavigation 
 () 
  
 . 
 setEndNavigation 
 ( 
 AddOnsResponseService 
 . 
 EndNavigation 
 . 
 CLOSE_DIALOG 
 ); 
 const 
  
 action 
  
 = 
  
 AddOnsResponseService 
 . 
 newActionResponseBuilder 
 () 
  
 . 
 setNavigation 
 ( 
 navigation 
 ) 
  
 . 
 build 
 (); 

Parameters

Name Type Description
navigation
Navigation The Navigation to use.

Return

Action Response Builder — This object, for chaining.


set Notification(notification)

Sets the notification to display when the action is activated.

 const 
  
 notification 
  
 = 
  
 AddOnsResponseService 
 . 
 newNotification 
 (). 
 setText 
 ( 
 "You closed a dialog!" 
 ); 
 const 
  
 action 
  
 = 
  
 AddOnsResponseService 
 . 
 newActionResponseBuilder 
 () 
  
 . 
 setNotification 
 ( 
 notification 
 ) 
  
 . 
 build 
 (); 

Parameters

Name Type Description
notification
Notification The Notification to use.

Return

Action Response Builder — This object, for chaining.


Sets the URL to navigate to when the action is activated.

Parameters

Name Type Description
open Link
Open Link The Open Link to use.

Return

Action Response Builder — This object, for chaining.


set State Changed(stateChanged)

Sets a flag to indicate that this action changed the existing data state. For example, if the action created a task or updated contact information. When this flag is set to true , services such as Gmail can attempt to clear any cached state data associated with this action.

Parameters

Name Type Description
state Changed
Boolean Whether this action has changed the existing state data. Defaults to false .

Return

Action Response Builder — This object, for chaining.

Design a Mobile Site
View Site in Mobile | Classic
Share by: