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.



1030
1031
1032
# File 'lib/google/apis/chat_v1/classes.rb', line 1030

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:



969
970
971
# File 'lib/google/apis/chat_v1/classes.rb', line 969

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)


976
977
978
# File 'lib/google/apis/chat_v1/classes.rb', line 976

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)


985
986
987
# File 'lib/google/apis/chat_v1/classes.rb', line 985

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>)


1001
1002
1003
# File 'lib/google/apis/chat_v1/classes.rb', line 1001

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)


1007
1008
1009
# File 'lib/google/apis/chat_v1/classes.rb', line 1007

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



1016
1017
1018
# File 'lib/google/apis/chat_v1/classes.rb', line 1016

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)


1028
1029
1030
# File 'lib/google/apis/chat_v1/classes.rb', line 1028

def user_locale
  @user_locale
end

Instance Method Details

#update!(**args) ⇒ Object

Update properties of this object



1035
1036
1037
1038
1039
1040
1041
1042
1043
# File 'lib/google/apis/chat_v1/classes.rb', line 1035

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