Class: Google::Apis::ChatV1::CommonEventObject

Inherits:
Object
  • Object
show all
Includes:
Google::Apis::Core::Hashable, Google::Apis::Core::JsonObjectSupport
Defined in:
lib/google/apis/chat_v1/classes.rb,
lib/google/apis/chat_v1/representations.rb,
lib/google/apis/chat_v1/representations.rb

Overview

The common event object is the portion of the overall event object that carries general, host-independent information to the add-on from the user's client. This information includes details such as the user's locale, host app, and platform. In addition to homepage and contextual triggers, add-ons construct and pass event objects to action callback functions when the user interacts with widgets. Your add-on's callback function can query the common event object to determine the contents of open widgets in the user's client. For example, your add-on can locate the text a user has entered into a TextInput widget in the eventObject.commentEventObject.formInputs object. For Chat apps, the name of the function that the user invoked when interacting with a widget.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(**args) ⇒ CommonEventObject

Returns a new instance of CommonEventObject.



898
899
900
# File 'lib/google/apis/chat_v1/classes.rb', line 898

def initialize(**args)
   update!(**args)
end

Instance Attribute Details

#form_inputsHash<String,Google::Apis::ChatV1::Inputs>

A map containing the current values of the widgets in the displayed card. The map keys are the string IDs assigned with each widget. The structure of the map value object is dependent on the widget type: Note: The following examples are formatted for Apps Script's V8 runtime. If you're using Rhino runtime, you must add [""] after the value. For example, instead of e. commonEventObject.formInputs.employeeName.stringInputs.value[0], format the event object as e.commonEventObject.formInputs.employeeName[""].stringInputs. value[0]. To learn more about runtimes in Apps Script, see the V8 Runtime Overview. * Single-valued widgets (for example, a text box): a list of strings (only one element). Example: for a text input widget with employeeName as its ID, access the text input value with: e.commonEventObject.formInputs.employeeName. stringInputs.value[0]. * Multi-valued widgets (for example, checkbox groups): a list of strings. Example: for a multi-value widget with participants as its ID, access the value array with: e.commonEventObject.formInputs. participants.stringInputs.value. * A date-time picker: a DateTimeInput object. Example: For a picker with an ID of myDTPicker, access the DateTimeInput object using e.commonEventObject. formInputs.myDTPicker.dateTimeInput. * A date-only picker: a DateInput object. Example: For a picker with an ID of myDatePicker, access the DateInput object using e.commonEventObject. formInputs.myDatePicker.dateInput. * A time-only picker: a TimeInput object. Example: For a picker with an ID of myTimePicker, access the TimeInput object using e.commonEventObject. formInputs.myTimePicker.timeInput. Corresponds to the JSON property formInputs

Returns:



837
838
839
# File 'lib/google/apis/chat_v1/classes.rb', line 837

def form_inputs
  @form_inputs
end

#host_appString

Indicates the host app the add-on is active in when the event object is generated. Possible values include the following: * GMAIL * CALENDAR * DRIVE * DOCS * SHEETS * SLIDES * CHAT Corresponds to the JSON property hostApp

Returns:

  • (String)


844
845
846
# File 'lib/google/apis/chat_v1/classes.rb', line 844

def host_app
  @host_app
end

#invoked_functionString

Name of the function to invoke. This field doesn't populate for Google Workspace Add-ons that extend Google Chat. Instead, to receive function data like identifiers, add-ons that extend Chat should use the parameters field. See Build interactive interfaces for Chat apps. Corresponds to the JSON property invokedFunction

Returns:

  • (String)


853
854
855
# File 'lib/google/apis/chat_v1/classes.rb', line 853

def invoked_function
  @invoked_function
end

#parametersHash<String,String>

Any additional parameters you supply to an action using actionParameters or Action.setParameters(). Developer Preview: For add-ons that extend Google Chat, to suggest items based on what the users type in multiselect menus, use the value of the "autocomplete_widget_query" key (event.commonEventObject.parameters[" autocomplete_widget_query"]). You can use this value to query a database and suggest selectable items to users as they type. For details, see Collect and process information from Google Chat users. Corresponds to the JSON property parameters

Returns:

  • (Hash<String,String>)


869
870
871
# File 'lib/google/apis/chat_v1/classes.rb', line 869

def parameters
  @parameters
end

#platformString

The platform enum which indicates the platform where the event originates ( WEB, IOS, or ANDROID). Not supported by Chat apps. Corresponds to the JSON property platform

Returns:

  • (String)


875
876
877
# File 'lib/google/apis/chat_v1/classes.rb', line 875

def platform
  @platform
end

#time_zoneGoogle::Apis::ChatV1::TimeZone

The timezone ID and offset from Coordinated Universal Time (UTC). Only supported for the event types CARD_CLICKED and SUBMIT_DIALOG. Corresponds to the JSON property timeZone



884
885
886
# File 'lib/google/apis/chat_v1/classes.rb', line 884

def time_zone
  @time_zone
end

#user_localeString

Disabled by default. The user's language and country/region identifier in the format of ISO 639 language code-ISO 3166 country/region code. For example, en-US. To turn on this field, you must set addOns.common. useLocaleFromApp to true in your add-on's manifest. Your add-on's scope list must also include https://www.googleapis.com/auth/script.locale. See Accessing user locale and timezone for more details. Corresponds to the JSON property userLocale

Returns:

  • (String)


896
897
898
# File 'lib/google/apis/chat_v1/classes.rb', line 896

def user_locale
  @user_locale
end

Instance Method Details

#update!(**args) ⇒ Object

Update properties of this object



903
904
905
906
907
908
909
910
911
# File 'lib/google/apis/chat_v1/classes.rb', line 903

def update!(**args)
  @form_inputs = args[:form_inputs] if args.key?(:form_inputs)
  @host_app = args[:host_app] if args.key?(:host_app)
  @invoked_function = args[:invoked_function] if args.key?(:invoked_function)
  @parameters = args[:parameters] if args.key?(:parameters)
  @platform = args[:platform] if args.key?(:platform)
  @time_zone = args[:time_zone] if args.key?(:time_zone)
  @user_locale = args[:user_locale] if args.key?(:user_locale)
end