Class InsertWidget

Insert Widget

A builder for InsertWidget objects. Developers cans insert a widget into a card by passing a Insert Widget to Modify Card

Only available for Google Workspace add-ons that extend Google Workspace Studio.

Sample usage:

 const 
  
 newWidget 
  
 = 
  
 CardService 
 . 
 newDecoratedText 
 (). 
 setText 
 ( 
 'New Widget' 
 ); 
 const 
  
 insertWidget 
  
 = 
  
 AddOnsResponseService 
 . 
 newInsertWidget 
 () 
  
 . 
 insertAboveWidget 
 ( 
 'sample_id' 
 ) 
  
 . 
 setWidget 
 ( 
 newWidget 
 ); 
 const 
  
 modifyCard 
  
 = 
  
 AddOnsResponseService 
 . 
 newModifyCard 
 (). 
 setInsertWidget 
 ( 
 insertWidget 
 ); 

Methods

Method Return type Brief description
Insert Widget Sets the widget ID, and the new widget is inserted above the widget with the given ID.
Insert Widget Sets the widget ID, and the new widget is inserted below the widget with the given ID.
Insert Widget Sets the Widget to be inserted.

Detailed documentation

insert Above Widget(widgetId)

Sets the widget ID, and the new widget is inserted above the widget with the given ID. An error is thrown if the widget ID is not found.

Parameters

Name Type Description
widget Id
String The ID of the widget to insert above.

Return

Insert Widget — The insert widget object, for chaining.


insert Below Widget(widgetId)

Sets the widget ID, and the new widget is inserted below the widget with the given ID. An error is thrown if the widget ID is not found.

Parameters

Name Type Description
widget Id
String The ID of the widget to insert below.

Return

Insert Widget — The insert widget object, for chaining.


set Widget(widget)

Sets the Widget to be inserted. An error is thrown if there is a existing widget with the same ID.

Parameters

Name Type Description
widget
Widget The widget to be inserted.

Return

Insert Widget — The insert widget object, for chaining.

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