# Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. require 'date' require 'google/apis/core/base_service' require 'google/apis/core/json_representation' require 'google/apis/core/hashable' require 'google/apis/errors' module Google module Apis module ChatV1 # List of string parameters to supply when the action method is invoked. For # example, consider three snooze buttons: snooze now, snooze one day, snooze # next week. You might use `action method = snooze()`, passing the snooze type # and snooze time in the list of string parameters. class ActionParameter include Google::Apis::Core::Hashable # The name of the parameter for the action script. # Corresponds to the JSON property `key` # @return [String] attr_accessor :key # The value of the parameter. # Corresponds to the JSON property `value` # @return [String] attr_accessor :value def initialize(**args) update!(**args) end # Update properties of this object def update!(**args) @key = args[:key] if args.key?(:key) @value = args[:value] if args.key?(:value) end end # Parameters that a Chat app can use to configure how its response is posted. class ActionResponse include Google::Apis::Core::Hashable # Contains a [dialog](https://developers.google.com/chat/how-tos/dialogs) and # request status code. # Corresponds to the JSON property `dialogAction` # @return [Google::Apis::ChatV1::DialogAction] attr_accessor :dialog_action # Input only. The type of Chat app response. # Corresponds to the JSON property `type` # @return [String] attr_accessor :type # Input only. URL for users to authenticate or configure. (Only for ` # REQUEST_CONFIG` response types.) # Corresponds to the JSON property `url` # @return [String] attr_accessor :url def initialize(**args) update!(**args) end # Update properties of this object def update!(**args) @dialog_action = args[:dialog_action] if args.key?(:dialog_action) @type = args[:type] if args.key?(:type) @url = args[:url] if args.key?(:url) end end # Represents the status for a request to either invoke or submit a [dialog]( # https://developers.google.com/chat/how-tos/dialogs). class ActionStatus include Google::Apis::Core::Hashable # The status code. # Corresponds to the JSON property `statusCode` # @return [String] attr_accessor :status_code # The message to send users about the status of their request. If unset, a # generic message based on the `status_code` is sent. # Corresponds to the JSON property `userFacingMessage` # @return [String] attr_accessor :user_facing_message def initialize(**args) update!(**args) end # Update properties of this object def update!(**args) @status_code = args[:status_code] if args.key?(:status_code) @user_facing_message = args[:user_facing_message] if args.key?(:user_facing_message) end end # Output only. Annotations associated with the plain-text body of the message. # To add basic formatting to a text message, see [Format text messages](https:// # developers.google.com/chat/api/guides/message-formats/text#format-texts). # Example plain-text message body: ``` Hello @FooBot how are you!" ``` The # corresponding annotations metadata: ``` "annotations":[` "type":"USER_MENTION", # "startIndex":6, "length":7, "userMention": ` "user": ` "name":"users/`user`", # "displayName":"FooBot", "avatarUrl":"https://goo.gl/aeDtrS", "type":"BOT" `, " # type":"MENTION" ` `] ``` class Annotation include Google::Apis::Core::Hashable # Length of the substring in the plain-text message body this annotation # corresponds to. # Corresponds to the JSON property `length` # @return [Fixnum] attr_accessor :length # Annotation metadata for slash commands (/). # Corresponds to the JSON property `slashCommand` # @return [Google::Apis::ChatV1::SlashCommandMetadata] attr_accessor :slash_command # Start index (0-based, inclusive) in the plain-text message body this # annotation corresponds to. # Corresponds to the JSON property `startIndex` # @return [Fixnum] attr_accessor :start_index # The type of this annotation. # Corresponds to the JSON property `type` # @return [String] attr_accessor :type # Annotation metadata for user mentions (@). # Corresponds to the JSON property `userMention` # @return [Google::Apis::ChatV1::UserMentionMetadata] attr_accessor :user_mention def initialize(**args) update!(**args) end # Update properties of this object def update!(**args) @length = args[:length] if args.key?(:length) @slash_command = args[:slash_command] if args.key?(:slash_command) @start_index = args[:start_index] if args.key?(:start_index) @type = args[:type] if args.key?(:type) @user_mention = args[:user_mention] if args.key?(:user_mention) end end # A GIF image that's specified by a URL. class AttachedGif include Google::Apis::Core::Hashable # Output only. The URL that hosts the GIF image. # Corresponds to the JSON property `uri` # @return [String] attr_accessor :uri def initialize(**args) update!(**args) end # Update properties of this object def update!(**args) @uri = args[:uri] if args.key?(:uri) end end # An attachment in Google Chat. class Attachment include Google::Apis::Core::Hashable # A reference to the attachment data. This field is used with the media API to # download the attachment data. # Corresponds to the JSON property `attachmentDataRef` # @return [Google::Apis::ChatV1::AttachmentDataRef] attr_accessor :attachment_data_ref # Output only. The original file name for the content, not the full path. # Corresponds to the JSON property `contentName` # @return [String] attr_accessor :content_name # Output only. The content type (MIME type) of the file. # Corresponds to the JSON property `contentType` # @return [String] attr_accessor :content_type # Output only. The download URL which should be used to allow a human user to # download the attachment. Chat apps shouldn't use this URL to download # attachment content. # Corresponds to the JSON property `downloadUri` # @return [String] attr_accessor :download_uri # A reference to the data of a drive attachment. # Corresponds to the JSON property `driveDataRef` # @return [Google::Apis::ChatV1::DriveDataRef] attr_accessor :drive_data_ref # Resource name of the attachment, in the form `spaces/*/messages/*/attachments/* # `. # Corresponds to the JSON property `name` # @return [String] attr_accessor :name # Output only. The source of the attachment. # Corresponds to the JSON property `source` # @return [String] attr_accessor :source # Output only. The thumbnail URL which should be used to preview the attachment # to a human user. Chat apps shouldn't use this URL to download attachment # content. # Corresponds to the JSON property `thumbnailUri` # @return [String] attr_accessor :thumbnail_uri def initialize(**args) update!(**args) end # Update properties of this object def update!(**args) @attachment_data_ref = args[:attachment_data_ref] if args.key?(:attachment_data_ref) @content_name = args[:content_name] if args.key?(:content_name) @content_type = args[:content_type] if args.key?(:content_type) @download_uri = args[:download_uri] if args.key?(:download_uri) @drive_data_ref = args[:drive_data_ref] if args.key?(:drive_data_ref) @name = args[:name] if args.key?(:name) @source = args[:source] if args.key?(:source) @thumbnail_uri = args[:thumbnail_uri] if args.key?(:thumbnail_uri) end end # class AttachmentDataRef include Google::Apis::Core::Hashable # Opaque token containing a reference to an uploaded attachment. Treated by # clients as an opaque string and used to create or update Chat messages with # attachments. # Corresponds to the JSON property `attachmentUploadToken` # @return [String] attr_accessor :attachment_upload_token # The resource name of the attachment data. This field is used with the media # API to download the attachment data. # Corresponds to the JSON property `resourceName` # @return [String] attr_accessor :resource_name def initialize(**args) update!(**args) end # Update properties of this object def update!(**args) @attachment_upload_token = args[:attachment_upload_token] if args.key?(:attachment_upload_token) @resource_name = args[:resource_name] if args.key?(:resource_name) end end # A button. Can be a text button or an image button. class Button include Google::Apis::Core::Hashable # An image button with an `onclick` action. # Corresponds to the JSON property `imageButton` # @return [Google::Apis::ChatV1::ImageButton] attr_accessor :image_button # A button with text and `onclick` action. # Corresponds to the JSON property `textButton` # @return [Google::Apis::ChatV1::TextButton] attr_accessor :text_button def initialize(**args) update!(**args) end # Update properties of this object def update!(**args) @image_button = args[:image_button] if args.key?(:image_button) @text_button = args[:text_button] if args.key?(:text_button) end end # A card is a UI element that can contain UI widgets such as text and images. class Card include Google::Apis::Core::Hashable # The actions of this card. # Corresponds to the JSON property `cardActions` # @return [Array] attr_accessor :card_actions # The header of the card. A header usually contains a title and an image. # Corresponds to the JSON property `header` # @return [Google::Apis::ChatV1::CardHeader] attr_accessor :header # Name of the card. # Corresponds to the JSON property `name` # @return [String] attr_accessor :name # Sections are separated by a line divider. # Corresponds to the JSON property `sections` # @return [Array] attr_accessor :sections def initialize(**args) update!(**args) end # Update properties of this object def update!(**args) @card_actions = args[:card_actions] if args.key?(:card_actions) @header = args[:header] if args.key?(:header) @name = args[:name] if args.key?(:name) @sections = args[:sections] if args.key?(:sections) end end # A card action is the action associated with the card. For an invoice card, a # typical action would be: delete invoice, email invoice or open the invoice in # browser. Not supported by Google Chat apps. class CardAction include Google::Apis::Core::Hashable # The label used to be displayed in the action menu item. # Corresponds to the JSON property `actionLabel` # @return [String] attr_accessor :action_label # An `onclick` action (for example, open a link). # Corresponds to the JSON property `onClick` # @return [Google::Apis::ChatV1::OnClick] attr_accessor :on_click def initialize(**args) update!(**args) end # Update properties of this object def update!(**args) @action_label = args[:action_label] if args.key?(:action_label) @on_click = args[:on_click] if args.key?(:on_click) end end # class CardHeader include Google::Apis::Core::Hashable # The image's type (for example, square border or circular border). # Corresponds to the JSON property `imageStyle` # @return [String] attr_accessor :image_style # The URL of the image in the card header. # Corresponds to the JSON property `imageUrl` # @return [String] attr_accessor :image_url # The subtitle of the card header. # Corresponds to the JSON property `subtitle` # @return [String] attr_accessor :subtitle # The title must be specified. The header has a fixed height: if both a title # and subtitle is specified, each takes up one line. If only the title is # specified, it takes up both lines. # Corresponds to the JSON property `title` # @return [String] attr_accessor :title def initialize(**args) update!(**args) end # Update properties of this object def update!(**args) @image_style = args[:image_style] if args.key?(:image_style) @image_url = args[:image_url] if args.key?(:image_url) @subtitle = args[:subtitle] if args.key?(:subtitle) @title = args[:title] if args.key?(:title) end end # A [card](https://developers.google.com/chat/api/reference/rest/v1/cards) in a # Google Chat message. Only Chat apps can create cards. If your Chat app [ # authenticates as a user](https://developers.google.com/chat/api/guides/auth/ # users), the message can't contain cards. class CardWithId include Google::Apis::Core::Hashable # A card interface displayed in a Google Chat message or Google Workspace Add-on. # Cards support a defined layout, interactive UI elements like buttons, and # rich media like images. Use cards to present detailed information, gather # information from users, and guide users to take a next step. To learn how to # build cards, see the following documentation: * For Google Chat apps, see [ # Design dynamic, interactive, and consistent UIs with cards](https://developers. # google.com/chat/ui). * For Google Workspace Add-ons, see [Card-based # interfaces](https://developers.google.com/apps-script/add-ons/concepts/cards). # **Example: Card message for a Google Chat app** ![Example contact card](https:/ # /developers.google.com/chat/images/card_api_reference.png) To create the # sample card message in Google Chat, use the following JSON: ``` ` "cardsV2": [ # ` "cardId": "unique-card-id", "card": ` "header": ` "title": "Sasha", " # subtitle": "Software Engineer", "imageUrl": "https://developers.google.com/ # chat/images/quickstart-app-avatar.png", "imageType": "CIRCLE", "imageAltText": # "Avatar for Sasha", `, "sections": [ ` "header": "Contact Info", "collapsible": # true, "uncollapsibleWidgetsCount": 1, "widgets": [ ` "decoratedText": ` " # startIcon": ` "knownIcon": "EMAIL", `, "text": "sasha@example.com", ` `, ` " # decoratedText": ` "startIcon": ` "knownIcon": "PERSON", `, "text": "Online", `, # `, ` "decoratedText": ` "startIcon": ` "knownIcon": "PHONE", `, "text": "+1 ( # 555) 555-1234", ` `, ` "buttonList": ` "buttons": [ ` "text": "Share", " # onClick": ` "openLink": ` "url": "https://example.com/share", ` ` `, ` "text": # "Edit", "onClick": ` "action": ` "function": "goToView", "parameters": [ ` " # key": "viewType", "value": "EDIT", ` ], ` ` `, ], ` `, ], `, ], `, ` ], ` ``` # Corresponds to the JSON property `card` # @return [Google::Apis::ChatV1::GoogleAppsCardV1Card] attr_accessor :card # Required if the message contains multiple cards. A unique identifier for a # card in a message. # Corresponds to the JSON property `cardId` # @return [String] attr_accessor :card_id def initialize(**args) update!(**args) end # Update properties of this object def update!(**args) @card = args[:card] if args.key?(:card) @card_id = args[:card_id] if args.key?(:card_id) end end # JSON payload of error messages. If the Cloud Logging API is enabled, these # error messages are logged to [Google Cloud Logging](https://cloud.google.com/ # logging/docs). class ChatAppLogEntry include Google::Apis::Core::Hashable # The deployment that caused the error. For Chat apps built in Apps Script, this # is the deployment ID defined by Apps Script. # Corresponds to the JSON property `deployment` # @return [String] attr_accessor :deployment # The unencrypted `callback_method` name that was running when the error was # encountered. # Corresponds to the JSON property `deploymentFunction` # @return [String] attr_accessor :deployment_function # The `Status` type defines a logical error model that is suitable for different # programming environments, including REST APIs and RPC APIs. It is used by [ # gRPC](https://github.com/grpc). Each `Status` message contains three pieces of # data: error code, error message, and error details. You can find out more # about this error model and how to work with it in the [API Design Guide](https: # //cloud.google.com/apis/design/errors). # Corresponds to the JSON property `error` # @return [Google::Apis::ChatV1::Status] attr_accessor :error def initialize(**args) update!(**args) end # Update properties of this object def update!(**args) @deployment = args[:deployment] if args.key?(:deployment) @deployment_function = args[:deployment_function] if args.key?(:deployment_function) @error = args[:error] if args.key?(:error) end end # Chat apps only. For a `SelectionInput` widget that uses a multi-select menu, a # data source from Google Chat. For example, a list of Google Chat spaces of # which the user is a member. [Developer Preview](https://developers.google.com/ # workspace/preview). class ChatClientDataSourceMarkup include Google::Apis::Core::Hashable # A data source representing a Google Chat space. Format: spaces/`space` [ # Developer Preview](https://developers.google.com/workspace/preview). # Corresponds to the JSON property `spaceDataSource` # @return [Google::Apis::ChatV1::SpaceDataSource] attr_accessor :space_data_source def initialize(**args) update!(**args) end # Update properties of this object def update!(**args) @space_data_source = args[:space_data_source] if args.key?(:space_data_source) end end # Represents a color in the RGBA color space. This representation is designed # for simplicity of conversion to and from color representations in various # languages over compactness. For example, the fields of this representation can # be trivially provided to the constructor of `java.awt.Color` in Java; it can # also be trivially provided to UIColor's `+colorWithRed:green:blue:alpha` # method in iOS; and, with just a little work, it can be easily formatted into a # CSS `rgba()` string in JavaScript. This reference page doesn't have # information about the absolute color space that should be used to interpret # the RGB value—for example, sRGB, Adobe RGB, DCI-P3, and BT.2020. By default, # applications should assume the sRGB color space. When color equality needs to # be decided, implementations, unless documented otherwise, treat two colors as # equal if all their red, green, blue, and alpha values each differ by at most ` # 1e-5`. Example (Java): import com.google.type.Color; // ... public static java. # awt.Color fromProto(Color protocolor) ` float alpha = protocolor.hasAlpha() ? # protocolor.getAlpha().getValue() : 1.0; return new java.awt.Color( protocolor. # getRed(), protocolor.getGreen(), protocolor.getBlue(), alpha); ` public static # Color toProto(java.awt.Color color) ` float red = (float) color.getRed(); # float green = (float) color.getGreen(); float blue = (float) color.getBlue(); # float denominator = 255.0; Color.Builder resultBuilder = Color .newBuilder() . # setRed(red / denominator) .setGreen(green / denominator) .setBlue(blue / # denominator); int alpha = color.getAlpha(); if (alpha != 255) ` result. # setAlpha( FloatValue .newBuilder() .setValue(((float) alpha) / denominator) . # build()); ` return resultBuilder.build(); ` // ... Example (iOS / Obj-C): // .. # . static UIColor* fromProto(Color* protocolor) ` float red = [protocolor red]; # float green = [protocolor green]; float blue = [protocolor blue]; FloatValue* # alpha_wrapper = [protocolor alpha]; float alpha = 1.0; if (alpha_wrapper != # nil) ` alpha = [alpha_wrapper value]; ` return [UIColor colorWithRed:red green: # green blue:blue alpha:alpha]; ` static Color* toProto(UIColor* color) ` # CGFloat red, green, blue, alpha; if (![color getRed:&red green:&green blue:& # blue alpha:&alpha]) ` return nil; ` Color* result = [[Color alloc] init]; [ # result setRed:red]; [result setGreen:green]; [result setBlue:blue]; if (alpha < # = 0.9999) ` [result setAlpha:floatWrapperWithValue(alpha)]; ` [result # autorelease]; return result; ` // ... Example (JavaScript): // ... var # protoToCssColor = function(rgb_color) ` var redFrac = rgb_color.red || 0.0; # var greenFrac = rgb_color.green || 0.0; var blueFrac = rgb_color.blue || 0.0; # var red = Math.floor(redFrac * 255); var green = Math.floor(greenFrac * 255); # var blue = Math.floor(blueFrac * 255); if (!('alpha' in rgb_color)) ` return # rgbToCssColor(red, green, blue); ` var alphaFrac = rgb_color.alpha.value || 0. # 0; var rgbParams = [red, green, blue].join(','); return ['rgba(', rgbParams, ', # ', alphaFrac, ')'].join(''); `; var rgbToCssColor = function(red, green, blue) # ` var rgbNumber = new Number((red << 16) | (green << 8) | blue); var hexString # = rgbNumber.toString(16); var missingZeros = 6 - hexString.length; var # resultBuilder = ['#']; for (var i = 0; i < missingZeros; i++) ` resultBuilder. # push('0'); ` resultBuilder.push(hexString); return resultBuilder.join(''); `; / # / ... class Color include Google::Apis::Core::Hashable # The fraction of this color that should be applied to the pixel. That is, the # final pixel color is defined by the equation: `pixel color = alpha * (this # color) + (1.0 - alpha) * (background color)` This means that a value of 1.0 # corresponds to a solid color, whereas a value of 0.0 corresponds to a # completely transparent color. This uses a wrapper message rather than a simple # float scalar so that it is possible to distinguish between a default value and # the value being unset. If omitted, this color object is rendered as a solid # color (as if the alpha value had been explicitly given a value of 1.0). # Corresponds to the JSON property `alpha` # @return [Float] attr_accessor :alpha # The amount of blue in the color as a value in the interval [0, 1]. # Corresponds to the JSON property `blue` # @return [Float] attr_accessor :blue # The amount of green in the color as a value in the interval [0, 1]. # Corresponds to the JSON property `green` # @return [Float] attr_accessor :green # The amount of red in the color as a value in the interval [0, 1]. # Corresponds to the JSON property `red` # @return [Float] attr_accessor :red def initialize(**args) update!(**args) end # Update properties of this object def update!(**args) @alpha = args[:alpha] if args.key?(:alpha) @blue = args[:blue] if args.key?(:blue) @green = args[:green] if args.key?(:green) @red = args[:red] if args.key?(:red) end end # Represents information about the user's client, such as locale, host app, and # platform. For Chat apps, `CommonEventObject` includes data submitted by users # interacting with cards, like data entered in [dialogs](https://developers. # google.com/chat/how-tos/dialogs). class CommonEventObject include Google::Apis::Core::Hashable # A map containing the current values of the widgets in a card. The map keys are # the string IDs assigned to each widget, and the values represent inputs to the # widget. Depending on the input data type, a different object represents each # input: For single-value widgets, `StringInput`. For multi-value widgets, an # array of `StringInput` objects. For a date-time picker, a `DateTimeInput`. For # a date-only picker, a `DateInput`. For a time-only picker, a `TimeInput`. # Corresponds with the data entered by a user on a card in a [dialog](https:// # developers.google.com/chat/how-tos/dialogs). # Corresponds to the JSON property `formInputs` # @return [Hash] attr_accessor :form_inputs # The hostApp enum which indicates the app the add-on is invoked from. Always ` # CHAT` for Chat apps. # Corresponds to the JSON property `hostApp` # @return [String] attr_accessor :host_app # Name of the invoked function associated with the widget. Only set for Chat # apps. # Corresponds to the JSON property `invokedFunction` # @return [String] attr_accessor :invoked_function # Custom [parameters](/chat/api/reference/rest/v1/cards#ActionParameter) passed # to the invoked function. Both keys and values must be strings. # Corresponds to the JSON property `parameters` # @return [Hash] attr_accessor :parameters # 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` # @return [String] attr_accessor :platform # The timezone ID and offset from Coordinated Universal Time (UTC). Only # supported for the event types [`CARD_CLICKED`](https://developers.google.com/ # chat/api/reference/rest/v1/EventType#ENUM_VALUES.CARD_CLICKED) and [` # SUBMIT_DIALOG`](https://developers.google.com/chat/api/reference/rest/v1/ # DialogEventType#ENUM_VALUES.SUBMIT_DIALOG). # Corresponds to the JSON property `timeZone` # @return [Google::Apis::ChatV1::TimeZone] attr_accessor :time_zone # The full `locale.displayName` in the format of [ISO 639 language code]-[ISO # 3166 country/region code] such as "en-US". # Corresponds to the JSON property `userLocale` # @return [String] attr_accessor :user_locale def initialize(**args) update!(**args) end # Update properties of this object 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 end # Represents a custom emoji. class CustomEmoji include Google::Apis::Core::Hashable # Unique key for the custom emoji resource. # Corresponds to the JSON property `uid` # @return [String] attr_accessor :uid def initialize(**args) update!(**args) end # Update properties of this object def update!(**args) @uid = args[:uid] if args.key?(:uid) end end # Date input values. class DateInput include Google::Apis::Core::Hashable # Time since epoch time, in milliseconds. # Corresponds to the JSON property `msSinceEpoch` # @return [Fixnum] attr_accessor :ms_since_epoch def initialize(**args) update!(**args) end # Update properties of this object def update!(**args) @ms_since_epoch = args[:ms_since_epoch] if args.key?(:ms_since_epoch) end end # Date and time input values. class DateTimeInput include Google::Apis::Core::Hashable # Whether the `datetime` input includes a calendar date. # Corresponds to the JSON property `hasDate` # @return [Boolean] attr_accessor :has_date alias_method :has_date?, :has_date # Whether the `datetime` input includes a timestamp. # Corresponds to the JSON property `hasTime` # @return [Boolean] attr_accessor :has_time alias_method :has_time?, :has_time # Time since epoch time, in milliseconds. # Corresponds to the JSON property `msSinceEpoch` # @return [Fixnum] attr_accessor :ms_since_epoch def initialize(**args) update!(**args) end # Update properties of this object def update!(**args) @has_date = args[:has_date] if args.key?(:has_date) @has_time = args[:has_time] if args.key?(:has_time) @ms_since_epoch = args[:ms_since_epoch] if args.key?(:ms_since_epoch) end end # Information about a deleted message. A message is deleted when `delete_time` # is set. class DeletionMetadata include Google::Apis::Core::Hashable # Indicates who deleted the message. # Corresponds to the JSON property `deletionType` # @return [String] attr_accessor :deletion_type def initialize(**args) update!(**args) end # Update properties of this object def update!(**args) @deletion_type = args[:deletion_type] if args.key?(:deletion_type) end end # A Google Chat app interaction event. To learn about interaction events, see [ # Receive and respond to interactions with your Google Chat app](https:// # developers.google.com/chat/api/guides/message-formats). To learn about event # types and for example event payloads, see [Types of Google Chat app # interaction events](https://developers.google.com/chat/api/guides/message- # formats/events). class DeprecatedEvent include Google::Apis::Core::Hashable # A form action describes the behavior when the form is submitted. For example, # you can invoke Apps Script to handle the form. # Corresponds to the JSON property `action` # @return [Google::Apis::ChatV1::FormAction] attr_accessor :action # Represents information about the user's client, such as locale, host app, and # platform. For Chat apps, `CommonEventObject` includes data submitted by users # interacting with cards, like data entered in [dialogs](https://developers. # google.com/chat/how-tos/dialogs). # Corresponds to the JSON property `common` # @return [Google::Apis::ChatV1::CommonEventObject] attr_accessor :common # The URL the Chat app should redirect the user to after they have completed an # authorization or configuration flow outside of Google Chat. For more # information, see [Connect a Chat app with other services & tools](https:// # developers.google.com/chat/how-tos/connect-web-services-tools). # Corresponds to the JSON property `configCompleteRedirectUrl` # @return [String] attr_accessor :config_complete_redirect_url # The type of [dialog](https://developers.google.com/chat/how-tos/dialogs) # interaction event received. # Corresponds to the JSON property `dialogEventType` # @return [String] attr_accessor :dialog_event_type # The timestamp indicating when the interaction event occurred. # Corresponds to the JSON property `eventTime` # @return [String] attr_accessor :event_time # For `CARD_CLICKED` interaction events, whether the user interacted with a [ # dialog](https://developers.google.com/chat/how-tos/dialogs). # Corresponds to the JSON property `isDialogEvent` # @return [Boolean] attr_accessor :is_dialog_event alias_method :is_dialog_event?, :is_dialog_event # A message in a Google Chat space. # Corresponds to the JSON property `message` # @return [Google::Apis::ChatV1::Message] attr_accessor :message # A space in Google Chat. Spaces are conversations between two or more users or # 1:1 messages between a user and a Chat app. # Corresponds to the JSON property `space` # @return [Google::Apis::ChatV1::Space] attr_accessor :space # The Chat app-defined key for the thread related to the interaction event. See [ # `spaces.messages.thread.threadKey`](/chat/api/reference/rest/v1/spaces. # messages#Thread.FIELDS.thread_key) for more information. # Corresponds to the JSON property `threadKey` # @return [String] attr_accessor :thread_key # A secret value that legacy Chat apps can use to verify if a request is from # Google. Google randomly generates the token, and its value remains static. You # can obtain, revoke, or regenerate the token from the [Chat API configuration # page](https://console.cloud.google.com/apis/api/chat.googleapis.com/hangouts- # chat) in the Google Cloud Console. Modern Chat apps don't use this field. It # is absent from API responses and the [Chat API configuration page](https:// # console.cloud.google.com/apis/api/chat.googleapis.com/hangouts-chat). # Corresponds to the JSON property `token` # @return [String] attr_accessor :token # The type of interaction event. For details, see [Types of Google Chat app # interaction events](https://developers.google.com/chat/api/guides/message- # formats/events). # Corresponds to the JSON property `type` # @return [String] attr_accessor :type # A user in Google Chat. When returned as an output from a request, if your Chat # app [authenticates as a user](https://developers.google.com/chat/api/guides/ # auth/users), the output for a `User` resource only populates the user's `name` # and `type`. # Corresponds to the JSON property `user` # @return [Google::Apis::ChatV1::User] attr_accessor :user def initialize(**args) update!(**args) end # Update properties of this object def update!(**args) @action = args[:action] if args.key?(:action) @common = args[:common] if args.key?(:common) @config_complete_redirect_url = args[:config_complete_redirect_url] if args.key?(:config_complete_redirect_url) @dialog_event_type = args[:dialog_event_type] if args.key?(:dialog_event_type) @event_time = args[:event_time] if args.key?(:event_time) @is_dialog_event = args[:is_dialog_event] if args.key?(:is_dialog_event) @message = args[:message] if args.key?(:message) @space = args[:space] if args.key?(:space) @thread_key = args[:thread_key] if args.key?(:thread_key) @token = args[:token] if args.key?(:token) @type = args[:type] if args.key?(:type) @user = args[:user] if args.key?(:user) end end # Wrapper around the card body of the dialog. class Dialog include Google::Apis::Core::Hashable # A card interface displayed in a Google Chat message or Google Workspace Add-on. # Cards support a defined layout, interactive UI elements like buttons, and # rich media like images. Use cards to present detailed information, gather # information from users, and guide users to take a next step. To learn how to # build cards, see the following documentation: * For Google Chat apps, see [ # Design dynamic, interactive, and consistent UIs with cards](https://developers. # google.com/chat/ui). * For Google Workspace Add-ons, see [Card-based # interfaces](https://developers.google.com/apps-script/add-ons/concepts/cards). # **Example: Card message for a Google Chat app** ![Example contact card](https:/ # /developers.google.com/chat/images/card_api_reference.png) To create the # sample card message in Google Chat, use the following JSON: ``` ` "cardsV2": [ # ` "cardId": "unique-card-id", "card": ` "header": ` "title": "Sasha", " # subtitle": "Software Engineer", "imageUrl": "https://developers.google.com/ # chat/images/quickstart-app-avatar.png", "imageType": "CIRCLE", "imageAltText": # "Avatar for Sasha", `, "sections": [ ` "header": "Contact Info", "collapsible": # true, "uncollapsibleWidgetsCount": 1, "widgets": [ ` "decoratedText": ` " # startIcon": ` "knownIcon": "EMAIL", `, "text": "sasha@example.com", ` `, ` " # decoratedText": ` "startIcon": ` "knownIcon": "PERSON", `, "text": "Online", `, # `, ` "decoratedText": ` "startIcon": ` "knownIcon": "PHONE", `, "text": "+1 ( # 555) 555-1234", ` `, ` "buttonList": ` "buttons": [ ` "text": "Share", " # onClick": ` "openLink": ` "url": "https://example.com/share", ` ` `, ` "text": # "Edit", "onClick": ` "action": ` "function": "goToView", "parameters": [ ` " # key": "viewType", "value": "EDIT", ` ], ` ` `, ], ` `, ], `, ], `, ` ], ` ``` # Corresponds to the JSON property `body` # @return [Google::Apis::ChatV1::GoogleAppsCardV1Card] attr_accessor :body def initialize(**args) update!(**args) end # Update properties of this object def update!(**args) @body = args[:body] if args.key?(:body) end end # Contains a [dialog](https://developers.google.com/chat/how-tos/dialogs) and # request status code. class DialogAction include Google::Apis::Core::Hashable # Represents the status for a request to either invoke or submit a [dialog]( # https://developers.google.com/chat/how-tos/dialogs). # Corresponds to the JSON property `actionStatus` # @return [Google::Apis::ChatV1::ActionStatus] attr_accessor :action_status # Wrapper around the card body of the dialog. # Corresponds to the JSON property `dialog` # @return [Google::Apis::ChatV1::Dialog] attr_accessor :dialog def initialize(**args) update!(**args) end # Update properties of this object def update!(**args) @action_status = args[:action_status] if args.key?(:action_status) @dialog = args[:dialog] if args.key?(:dialog) end end # A reference to the data of a drive attachment. class DriveDataRef include Google::Apis::Core::Hashable # The ID for the drive file. Use with the Drive API. # Corresponds to the JSON property `driveFileId` # @return [String] attr_accessor :drive_file_id def initialize(**args) update!(**args) end # Update properties of this object def update!(**args) @drive_file_id = args[:drive_file_id] if args.key?(:drive_file_id) end end # An emoji that is used as a reaction to a message. class Emoji include Google::Apis::Core::Hashable # Represents a custom emoji. # Corresponds to the JSON property `customEmoji` # @return [Google::Apis::ChatV1::CustomEmoji] attr_accessor :custom_emoji # A basic emoji represented by a unicode string. # Corresponds to the JSON property `unicode` # @return [String] attr_accessor :unicode def initialize(**args) update!(**args) end # Update properties of this object def update!(**args) @custom_emoji = args[:custom_emoji] if args.key?(:custom_emoji) @unicode = args[:unicode] if args.key?(:unicode) end end # The number of people who reacted to a message with a specific emoji. class EmojiReactionSummary include Google::Apis::Core::Hashable # An emoji that is used as a reaction to a message. # Corresponds to the JSON property `emoji` # @return [Google::Apis::ChatV1::Emoji] attr_accessor :emoji # The total number of reactions using the associated emoji. # Corresponds to the JSON property `reactionCount` # @return [Fixnum] attr_accessor :reaction_count def initialize(**args) update!(**args) end # Update properties of this object def update!(**args) @emoji = args[:emoji] if args.key?(:emoji) @reaction_count = args[:reaction_count] if args.key?(:reaction_count) end end # A generic empty message that you can re-use to avoid defining duplicated empty # messages in your APIs. A typical example is to use it as the request or the # response type of an API method. For instance: service Foo ` rpc Bar(google. # protobuf.Empty) returns (google.protobuf.Empty); ` class Empty include Google::Apis::Core::Hashable def initialize(**args) update!(**args) end # Update properties of this object def update!(**args) end end # A form action describes the behavior when the form is submitted. For example, # you can invoke Apps Script to handle the form. class FormAction include Google::Apis::Core::Hashable # The method name is used to identify which part of the form triggered the form # submission. This information is echoed back to the Chat app as part of the # card click event. You can use the same method name for several elements that # trigger a common behavior. # Corresponds to the JSON property `actionMethodName` # @return [String] attr_accessor :action_method_name # List of action parameters. # Corresponds to the JSON property `parameters` # @return [Array] attr_accessor :parameters def initialize(**args) update!(**args) end # Update properties of this object def update!(**args) @action_method_name = args[:action_method_name] if args.key?(:action_method_name) @parameters = args[:parameters] if args.key?(:parameters) end end # An action that describes the behavior when the form is submitted. For example, # you can invoke an Apps Script script to handle the form. If the action is # triggered, the form values are sent to the server. class GoogleAppsCardV1Action include Google::Apis::Core::Hashable # A custom function to invoke when the containing element is clicked or othrwise # activated. For example usage, see [Create interactive cards](https:// # developers.google.com/chat/how-tos/cards-onclick). # Corresponds to the JSON property `function` # @return [String] attr_accessor :function # Optional. Required when opening a [dialog](https://developers.google.com/chat/ # how-tos/dialogs). What to do in response to an interaction with a user, such # as a user clicking a button in a card message. If unspecified, the app # responds by executing an `action`—like opening a link or running a function—as # normal. By specifying an `interaction`, the app can respond in special # interactive ways. For example, by setting `interaction` to `OPEN_DIALOG`, the # app can open a [dialog](https://developers.google.com/chat/how-tos/dialogs). # When specified, a loading indicator isn't shown. Supported by Chat apps, but # not Google Workspace Add-ons. If specified for an add-on, the entire card is # stripped and nothing is shown in the client. # Corresponds to the JSON property `interaction` # @return [String] attr_accessor :interaction # Specifies the loading indicator that the action displays while making the call # to the action. # Corresponds to the JSON property `loadIndicator` # @return [String] attr_accessor :load_indicator # List of action parameters. # Corresponds to the JSON property `parameters` # @return [Array] attr_accessor :parameters # Indicates whether form values persist after the action. The default value is ` # false`. If `true`, form values remain after the action is triggered. To let # the user make changes while the action is being processed, set [`LoadIndicator` # ](https://developers.google.com/workspace/add-ons/reference/rpc/google.apps. # card.v1#loadindicator) to `NONE`. For [card messages](https://developers. # google.com/chat/api/guides/message-formats/cards) in Chat apps, you must also # set the action's [`ResponseType`](https://developers.google.com/chat/api/ # reference/rest/v1/spaces.messages#responsetype) to `UPDATE_MESSAGE` and use # the same [`card_id`](https://developers.google.com/chat/api/reference/rest/v1/ # spaces.messages#CardWithId) from the card that contained the action. If `false` # , the form values are cleared when the action is triggered. To prevent the # user from making changes while the action is being processed, set [` # LoadIndicator`](https://developers.google.com/workspace/add-ons/reference/rpc/ # google.apps.card.v1#loadindicator) to `SPINNER`. # Corresponds to the JSON property `persistValues` # @return [Boolean] attr_accessor :persist_values alias_method :persist_values?, :persist_values def initialize(**args) update!(**args) end # Update properties of this object def update!(**args) @function = args[:function] if args.key?(:function) @interaction = args[:interaction] if args.key?(:interaction) @load_indicator = args[:load_indicator] if args.key?(:load_indicator) @parameters = args[:parameters] if args.key?(:parameters) @persist_values = args[:persist_values] if args.key?(:persist_values) end end # List of string parameters to supply when the action method is invoked. For # example, consider three snooze buttons: snooze now, snooze one day, or snooze # next week. You might use `action method = snooze()`, passing the snooze type # and snooze time in the list of string parameters. To learn more, see [` # CommonEventObject`](https://developers.google.com/chat/api/reference/rest/v1/ # Event#commoneventobject). class GoogleAppsCardV1ActionParameter include Google::Apis::Core::Hashable # The name of the parameter for the action script. # Corresponds to the JSON property `key` # @return [String] attr_accessor :key # The value of the parameter. # Corresponds to the JSON property `value` # @return [String] attr_accessor :value def initialize(**args) update!(**args) end # Update properties of this object def update!(**args) @key = args[:key] if args.key?(:key) @value = args[:value] if args.key?(:value) end end # The style options for the border of a card or widget, including the border # type and color. class GoogleAppsCardV1BorderStyle include Google::Apis::Core::Hashable # The corner radius for the border. # Corresponds to the JSON property `cornerRadius` # @return [Fixnum] attr_accessor :corner_radius # Represents a color in the RGBA color space. This representation is designed # for simplicity of conversion to and from color representations in various # languages over compactness. For example, the fields of this representation can # be trivially provided to the constructor of `java.awt.Color` in Java; it can # also be trivially provided to UIColor's `+colorWithRed:green:blue:alpha` # method in iOS; and, with just a little work, it can be easily formatted into a # CSS `rgba()` string in JavaScript. This reference page doesn't have # information about the absolute color space that should be used to interpret # the RGB value—for example, sRGB, Adobe RGB, DCI-P3, and BT.2020. By default, # applications should assume the sRGB color space. When color equality needs to # be decided, implementations, unless documented otherwise, treat two colors as # equal if all their red, green, blue, and alpha values each differ by at most ` # 1e-5`. Example (Java): import com.google.type.Color; // ... public static java. # awt.Color fromProto(Color protocolor) ` float alpha = protocolor.hasAlpha() ? # protocolor.getAlpha().getValue() : 1.0; return new java.awt.Color( protocolor. # getRed(), protocolor.getGreen(), protocolor.getBlue(), alpha); ` public static # Color toProto(java.awt.Color color) ` float red = (float) color.getRed(); # float green = (float) color.getGreen(); float blue = (float) color.getBlue(); # float denominator = 255.0; Color.Builder resultBuilder = Color .newBuilder() . # setRed(red / denominator) .setGreen(green / denominator) .setBlue(blue / # denominator); int alpha = color.getAlpha(); if (alpha != 255) ` result. # setAlpha( FloatValue .newBuilder() .setValue(((float) alpha) / denominator) . # build()); ` return resultBuilder.build(); ` // ... Example (iOS / Obj-C): // .. # . static UIColor* fromProto(Color* protocolor) ` float red = [protocolor red]; # float green = [protocolor green]; float blue = [protocolor blue]; FloatValue* # alpha_wrapper = [protocolor alpha]; float alpha = 1.0; if (alpha_wrapper != # nil) ` alpha = [alpha_wrapper value]; ` return [UIColor colorWithRed:red green: # green blue:blue alpha:alpha]; ` static Color* toProto(UIColor* color) ` # CGFloat red, green, blue, alpha; if (![color getRed:&red green:&green blue:& # blue alpha:&alpha]) ` return nil; ` Color* result = [[Color alloc] init]; [ # result setRed:red]; [result setGreen:green]; [result setBlue:blue]; if (alpha < # = 0.9999) ` [result setAlpha:floatWrapperWithValue(alpha)]; ` [result # autorelease]; return result; ` // ... Example (JavaScript): // ... var # protoToCssColor = function(rgb_color) ` var redFrac = rgb_color.red || 0.0; # var greenFrac = rgb_color.green || 0.0; var blueFrac = rgb_color.blue || 0.0; # var red = Math.floor(redFrac * 255); var green = Math.floor(greenFrac * 255); # var blue = Math.floor(blueFrac * 255); if (!('alpha' in rgb_color)) ` return # rgbToCssColor(red, green, blue); ` var alphaFrac = rgb_color.alpha.value || 0. # 0; var rgbParams = [red, green, blue].join(','); return ['rgba(', rgbParams, ', # ', alphaFrac, ')'].join(''); `; var rgbToCssColor = function(red, green, blue) # ` var rgbNumber = new Number((red << 16) | (green << 8) | blue); var hexString # = rgbNumber.toString(16); var missingZeros = 6 - hexString.length; var # resultBuilder = ['#']; for (var i = 0; i < missingZeros; i++) ` resultBuilder. # push('0'); ` resultBuilder.push(hexString); return resultBuilder.join(''); `; / # / ... # Corresponds to the JSON property `strokeColor` # @return [Google::Apis::ChatV1::Color] attr_accessor :stroke_color # The border type. # Corresponds to the JSON property `type` # @return [String] attr_accessor :type def initialize(**args) update!(**args) end # Update properties of this object def update!(**args) @corner_radius = args[:corner_radius] if args.key?(:corner_radius) @stroke_color = args[:stroke_color] if args.key?(:stroke_color) @type = args[:type] if args.key?(:type) end end # A text, icon, or text and icon button that users can click. For an example in # Google Chat apps, see [Button list](https://developers.google.com/chat/ui/ # widgets/button-list). To make an image a clickable button, specify an `Image` ( # not an `ImageComponent`) and set an `onClick` action. class GoogleAppsCardV1Button include Google::Apis::Core::Hashable # The alternative text that's used for accessibility. Set descriptive text that # lets users know what the button does. For example, if a button opens a # hyperlink, you might write: "Opens a new browser tab and navigates to the # Google Chat developer documentation at https://developers.google.com/chat". # Corresponds to the JSON property `altText` # @return [String] attr_accessor :alt_text # Represents a color in the RGBA color space. This representation is designed # for simplicity of conversion to and from color representations in various # languages over compactness. For example, the fields of this representation can # be trivially provided to the constructor of `java.awt.Color` in Java; it can # also be trivially provided to UIColor's `+colorWithRed:green:blue:alpha` # method in iOS; and, with just a little work, it can be easily formatted into a # CSS `rgba()` string in JavaScript. This reference page doesn't have # information about the absolute color space that should be used to interpret # the RGB value—for example, sRGB, Adobe RGB, DCI-P3, and BT.2020. By default, # applications should assume the sRGB color space. When color equality needs to # be decided, implementations, unless documented otherwise, treat two colors as # equal if all their red, green, blue, and alpha values each differ by at most ` # 1e-5`. Example (Java): import com.google.type.Color; // ... public static java. # awt.Color fromProto(Color protocolor) ` float alpha = protocolor.hasAlpha() ? # protocolor.getAlpha().getValue() : 1.0; return new java.awt.Color( protocolor. # getRed(), protocolor.getGreen(), protocolor.getBlue(), alpha); ` public static # Color toProto(java.awt.Color color) ` float red = (float) color.getRed(); # float green = (float) color.getGreen(); float blue = (float) color.getBlue(); # float denominator = 255.0; Color.Builder resultBuilder = Color .newBuilder() . # setRed(red / denominator) .setGreen(green / denominator) .setBlue(blue / # denominator); int alpha = color.getAlpha(); if (alpha != 255) ` result. # setAlpha( FloatValue .newBuilder() .setValue(((float) alpha) / denominator) . # build()); ` return resultBuilder.build(); ` // ... Example (iOS / Obj-C): // .. # . static UIColor* fromProto(Color* protocolor) ` float red = [protocolor red]; # float green = [protocolor green]; float blue = [protocolor blue]; FloatValue* # alpha_wrapper = [protocolor alpha]; float alpha = 1.0; if (alpha_wrapper != # nil) ` alpha = [alpha_wrapper value]; ` return [UIColor colorWithRed:red green: # green blue:blue alpha:alpha]; ` static Color* toProto(UIColor* color) ` # CGFloat red, green, blue, alpha; if (![color getRed:&red green:&green blue:& # blue alpha:&alpha]) ` return nil; ` Color* result = [[Color alloc] init]; [ # result setRed:red]; [result setGreen:green]; [result setBlue:blue]; if (alpha < # = 0.9999) ` [result setAlpha:floatWrapperWithValue(alpha)]; ` [result # autorelease]; return result; ` // ... Example (JavaScript): // ... var # protoToCssColor = function(rgb_color) ` var redFrac = rgb_color.red || 0.0; # var greenFrac = rgb_color.green || 0.0; var blueFrac = rgb_color.blue || 0.0; # var red = Math.floor(redFrac * 255); var green = Math.floor(greenFrac * 255); # var blue = Math.floor(blueFrac * 255); if (!('alpha' in rgb_color)) ` return # rgbToCssColor(red, green, blue); ` var alphaFrac = rgb_color.alpha.value || 0. # 0; var rgbParams = [red, green, blue].join(','); return ['rgba(', rgbParams, ', # ', alphaFrac, ')'].join(''); `; var rgbToCssColor = function(red, green, blue) # ` var rgbNumber = new Number((red << 16) | (green << 8) | blue); var hexString # = rgbNumber.toString(16); var missingZeros = 6 - hexString.length; var # resultBuilder = ['#']; for (var i = 0; i < missingZeros; i++) ` resultBuilder. # push('0'); ` resultBuilder.push(hexString); return resultBuilder.join(''); `; / # / ... # Corresponds to the JSON property `color` # @return [Google::Apis::ChatV1::Color] attr_accessor :color # If `true`, the button is displayed in an inactive state and doesn't respond to # user actions. # Corresponds to the JSON property `disabled` # @return [Boolean] attr_accessor :disabled alias_method :disabled?, :disabled # An icon displayed in a widget on a card. For an example in Google Chat apps, # see [Icon](https://developers.google.com/chat/ui/widgets/icon). Supports [ # built-in](https://developers.google.com/chat/api/guides/message-formats/cards# # builtinicons) and [custom](https://developers.google.com/chat/api/guides/ # message-formats/cards#customicons) icons. # Corresponds to the JSON property `icon` # @return [Google::Apis::ChatV1::GoogleAppsCardV1Icon] attr_accessor :icon # Represents how to respond when users click an interactive element on a card, # such as a button. # Corresponds to the JSON property `onClick` # @return [Google::Apis::ChatV1::GoogleAppsCardV1OnClick] attr_accessor :on_click # The text displayed inside the button. # Corresponds to the JSON property `text` # @return [String] attr_accessor :text def initialize(**args) update!(**args) end # Update properties of this object def update!(**args) @alt_text = args[:alt_text] if args.key?(:alt_text) @color = args[:color] if args.key?(:color) @disabled = args[:disabled] if args.key?(:disabled) @icon = args[:icon] if args.key?(:icon) @on_click = args[:on_click] if args.key?(:on_click) @text = args[:text] if args.key?(:text) end end # A list of buttons layed out horizontally. For an example in Google Chat apps, # see [Button list](https://developers.google.com/chat/ui/widgets/button-list). class GoogleAppsCardV1ButtonList include Google::Apis::Core::Hashable # An array of buttons. # Corresponds to the JSON property `buttons` # @return [Array] attr_accessor :buttons def initialize(**args) update!(**args) end # Update properties of this object def update!(**args) @buttons = args[:buttons] if args.key?(:buttons) end end # A card interface displayed in a Google Chat message or Google Workspace Add-on. # Cards support a defined layout, interactive UI elements like buttons, and # rich media like images. Use cards to present detailed information, gather # information from users, and guide users to take a next step. To learn how to # build cards, see the following documentation: * For Google Chat apps, see [ # Design dynamic, interactive, and consistent UIs with cards](https://developers. # google.com/chat/ui). * For Google Workspace Add-ons, see [Card-based # interfaces](https://developers.google.com/apps-script/add-ons/concepts/cards). # **Example: Card message for a Google Chat app** ![Example contact card](https:/ # /developers.google.com/chat/images/card_api_reference.png) To create the # sample card message in Google Chat, use the following JSON: ``` ` "cardsV2": [ # ` "cardId": "unique-card-id", "card": ` "header": ` "title": "Sasha", " # subtitle": "Software Engineer", "imageUrl": "https://developers.google.com/ # chat/images/quickstart-app-avatar.png", "imageType": "CIRCLE", "imageAltText": # "Avatar for Sasha", `, "sections": [ ` "header": "Contact Info", "collapsible": # true, "uncollapsibleWidgetsCount": 1, "widgets": [ ` "decoratedText": ` " # startIcon": ` "knownIcon": "EMAIL", `, "text": "sasha@example.com", ` `, ` " # decoratedText": ` "startIcon": ` "knownIcon": "PERSON", `, "text": "Online", `, # `, ` "decoratedText": ` "startIcon": ` "knownIcon": "PHONE", `, "text": "+1 ( # 555) 555-1234", ` `, ` "buttonList": ` "buttons": [ ` "text": "Share", " # onClick": ` "openLink": ` "url": "https://example.com/share", ` ` `, ` "text": # "Edit", "onClick": ` "action": ` "function": "goToView", "parameters": [ ` " # key": "viewType", "value": "EDIT", ` ], ` ` `, ], ` `, ], `, ], `, ` ], ` ``` class GoogleAppsCardV1Card include Google::Apis::Core::Hashable # The card's actions. Actions are added to the card's toolbar menu. Because Chat # app cards have no toolbar, `cardActions[]` isn't supported by Chat apps. For # example, the following JSON constructs a card action menu with `Settings` and ` # Send Feedback` options: ``` "card_actions": [ ` "actionLabel": "Settings", " # onClick": ` "action": ` "functionName": "goToView", "parameters": [ ` "key": " # viewType", "value": "SETTING" ` ], "loadIndicator": "LoadIndicator.SPINNER" ` ` # `, ` "actionLabel": "Send Feedback", "onClick": ` "openLink": ` "url": "https: # //example.com/feedback" ` ` ` ] ``` # Corresponds to the JSON property `cardActions` # @return [Array] attr_accessor :card_actions # In Google Workspace add-ons, sets the display properties of the ` # peekCardHeader`. Not supported by Chat apps. # Corresponds to the JSON property `displayStyle` # @return [String] attr_accessor :display_style # A persistent (sticky) footer that that appears at the bottom of the card. For # an example in Google Chat apps, see [Card footer](https://developers.google. # com/chat/ui/widgets/card-fixed-footer). Setting `fixedFooter` without # specifying a `primaryButton` or a `secondaryButton` causes an error. Supported # by Google Workspace Add-ons and Chat apps. For Chat apps, you can use fixed # footers in [dialogs](https://developers.google.com/chat/how-tos/dialogs), but # not [card messages](https://developers.google.com/chat/api/guides/message- # formats/cards). # Corresponds to the JSON property `fixedFooter` # @return [Google::Apis::ChatV1::GoogleAppsCardV1CardFixedFooter] attr_accessor :fixed_footer # Represents a card header. For an example in Google Chat apps, see [Card header] # (https://developers.google.com/chat/ui/widgets/card-header). # Corresponds to the JSON property `header` # @return [Google::Apis::ChatV1::GoogleAppsCardV1CardHeader] attr_accessor :header # Name of the card. Used as a card identifier in card navigation. Because Chat # apps don't support card navigation, they ignore this field. # Corresponds to the JSON property `name` # @return [String] attr_accessor :name # Represents a card header. For an example in Google Chat apps, see [Card header] # (https://developers.google.com/chat/ui/widgets/card-header). # Corresponds to the JSON property `peekCardHeader` # @return [Google::Apis::ChatV1::GoogleAppsCardV1CardHeader] attr_accessor :peek_card_header # The divider style between sections. # Corresponds to the JSON property `sectionDividerStyle` # @return [String] attr_accessor :section_divider_style # Contains a collection of widgets. Each section has its own, optional header. # Sections are visually separated by a line divider. For an example in Google # Chat apps, see [Card section](https://developers.google.com/chat/ui/widgets/ # card-section). # Corresponds to the JSON property `sections` # @return [Array] attr_accessor :sections def initialize(**args) update!(**args) end # Update properties of this object def update!(**args) @card_actions = args[:card_actions] if args.key?(:card_actions) @display_style = args[:display_style] if args.key?(:display_style) @fixed_footer = args[:fixed_footer] if args.key?(:fixed_footer) @header = args[:header] if args.key?(:header) @name = args[:name] if args.key?(:name) @peek_card_header = args[:peek_card_header] if args.key?(:peek_card_header) @section_divider_style = args[:section_divider_style] if args.key?(:section_divider_style) @sections = args[:sections] if args.key?(:sections) end end # A card action is the action associated with the card. For example, an invoice # card might include actions such as delete invoice, email invoice, or open the # invoice in a browser. Not supported by Chat apps. class GoogleAppsCardV1CardAction include Google::Apis::Core::Hashable # The label that displays as the action menu item. # Corresponds to the JSON property `actionLabel` # @return [String] attr_accessor :action_label # Represents how to respond when users click an interactive element on a card, # such as a button. # Corresponds to the JSON property `onClick` # @return [Google::Apis::ChatV1::GoogleAppsCardV1OnClick] attr_accessor :on_click def initialize(**args) update!(**args) end # Update properties of this object def update!(**args) @action_label = args[:action_label] if args.key?(:action_label) @on_click = args[:on_click] if args.key?(:on_click) end end # A persistent (sticky) footer that that appears at the bottom of the card. For # an example in Google Chat apps, see [Card footer](https://developers.google. # com/chat/ui/widgets/card-fixed-footer). Setting `fixedFooter` without # specifying a `primaryButton` or a `secondaryButton` causes an error. Supported # by Google Workspace Add-ons and Chat apps. For Chat apps, you can use fixed # footers in [dialogs](https://developers.google.com/chat/how-tos/dialogs), but # not [card messages](https://developers.google.com/chat/api/guides/message- # formats/cards). class GoogleAppsCardV1CardFixedFooter include Google::Apis::Core::Hashable # A text, icon, or text and icon button that users can click. For an example in # Google Chat apps, see [Button list](https://developers.google.com/chat/ui/ # widgets/button-list). To make an image a clickable button, specify an `Image` ( # not an `ImageComponent`) and set an `onClick` action. # Corresponds to the JSON property `primaryButton` # @return [Google::Apis::ChatV1::GoogleAppsCardV1Button] attr_accessor :primary_button # A text, icon, or text and icon button that users can click. For an example in # Google Chat apps, see [Button list](https://developers.google.com/chat/ui/ # widgets/button-list). To make an image a clickable button, specify an `Image` ( # not an `ImageComponent`) and set an `onClick` action. # Corresponds to the JSON property `secondaryButton` # @return [Google::Apis::ChatV1::GoogleAppsCardV1Button] attr_accessor :secondary_button def initialize(**args) update!(**args) end # Update properties of this object def update!(**args) @primary_button = args[:primary_button] if args.key?(:primary_button) @secondary_button = args[:secondary_button] if args.key?(:secondary_button) end end # Represents a card header. For an example in Google Chat apps, see [Card header] # (https://developers.google.com/chat/ui/widgets/card-header). class GoogleAppsCardV1CardHeader include Google::Apis::Core::Hashable # The alternative text of this image that's used for accessibility. # Corresponds to the JSON property `imageAltText` # @return [String] attr_accessor :image_alt_text # The shape used to crop the image. # Corresponds to the JSON property `imageType` # @return [String] attr_accessor :image_type # The HTTPS URL of the image in the card header. # Corresponds to the JSON property `imageUrl` # @return [String] attr_accessor :image_url # The subtitle of the card header. If specified, appears on its own line below # the `title`. # Corresponds to the JSON property `subtitle` # @return [String] attr_accessor :subtitle # Required. The title of the card header. The header has a fixed height: if both # a title and subtitle are specified, each takes up one line. If only the title # is specified, it takes up both lines. # Corresponds to the JSON property `title` # @return [String] attr_accessor :title def initialize(**args) update!(**args) end # Update properties of this object def update!(**args) @image_alt_text = args[:image_alt_text] if args.key?(:image_alt_text) @image_type = args[:image_type] if args.key?(:image_type) @image_url = args[:image_url] if args.key?(:image_url) @subtitle = args[:subtitle] if args.key?(:subtitle) @title = args[:title] if args.key?(:title) end end # A column. class GoogleAppsCardV1Column include Google::Apis::Core::Hashable # Specifies whether widgets align to the left, right, or center of a column. # Corresponds to the JSON property `horizontalAlignment` # @return [String] attr_accessor :horizontal_alignment # Specifies how a column fills the width of the card. # Corresponds to the JSON property `horizontalSizeStyle` # @return [String] attr_accessor :horizontal_size_style # Specifies whether widgets align to the top, bottom, or center of a column. # Corresponds to the JSON property `verticalAlignment` # @return [String] attr_accessor :vertical_alignment # An array of widgets included in a column. Widgets appear in the order that # they are specified. # Corresponds to the JSON property `widgets` # @return [Array] attr_accessor :widgets def initialize(**args) update!(**args) end # Update properties of this object def update!(**args) @horizontal_alignment = args[:horizontal_alignment] if args.key?(:horizontal_alignment) @horizontal_size_style = args[:horizontal_size_style] if args.key?(:horizontal_size_style) @vertical_alignment = args[:vertical_alignment] if args.key?(:vertical_alignment) @widgets = args[:widgets] if args.key?(:widgets) end end # The `Columns` widget displays up to 2 columns in a card message or dialog. You # can add widgets to each column; the widgets appear in the order that they are # specified. For an example in Google Chat apps, see [Columns](https:// # developers.google.com/chat/ui/widgets/columns). The height of each column is # determined by the taller column. For example, if the first column is taller # than the second column, both columns have the height of the first column. # Because each column can contain a different number of widgets, you can't # define rows or align widgets between the columns. Columns are displayed side- # by-side. You can customize the width of each column using the ` # HorizontalSizeStyle` field. If the user's screen width is too narrow, the # second column wraps below the first: * On web, the second column wraps if the # screen width is less than or equal to 480 pixels. * On iOS devices, the second # column wraps if the screen width is less than or equal to 300 pt. * On Android # devices, the second column wraps if the screen width is less than or equal to # 320 dp. To include more than 2 columns, or to use rows, use the `Grid` widget. # Supported by Chat apps, but not Google Workspace Add-ons. class GoogleAppsCardV1Columns include Google::Apis::Core::Hashable # An array of columns. You can include up to 2 columns in a card or dialog. # Corresponds to the JSON property `columnItems` # @return [Array] attr_accessor :column_items def initialize(**args) update!(**args) end # Update properties of this object def update!(**args) @column_items = args[:column_items] if args.key?(:column_items) end end # Lets users input a date, a time, or both a date and a time. For an example in # Google Chat apps, see [Date time picker](https://developers.google.com/chat/ui/ # widgets/date-time-picker). Users can input text or use the picker to select # dates and times. If users input an invalid date or time, the picker shows an # error that prompts users to input the information correctly. class GoogleAppsCardV1DateTimePicker include Google::Apis::Core::Hashable # The text that prompts users to input a date, a time, or a date and time. For # example, if users are scheduling an appointment, use a label such as ` # Appointment date` or `Appointment date and time`. # Corresponds to the JSON property `label` # @return [String] attr_accessor :label # The name by which the `DateTimePicker` is identified in a form input event. # For details about working with form inputs, see [Receive form data](https:// # developers.google.com/chat/ui/read-form-data). # Corresponds to the JSON property `name` # @return [String] attr_accessor :name # An action that describes the behavior when the form is submitted. For example, # you can invoke an Apps Script script to handle the form. If the action is # triggered, the form values are sent to the server. # Corresponds to the JSON property `onChangeAction` # @return [Google::Apis::ChatV1::GoogleAppsCardV1Action] attr_accessor :on_change_action # The number representing the time zone offset from UTC, in minutes. If set, the # `value_ms_epoch` is displayed in the specified time zone. If unset, the value # defaults to the user's time zone setting. # Corresponds to the JSON property `timezoneOffsetDate` # @return [Fixnum] attr_accessor :timezone_offset_date # Whether the widget supports inputting a date, a time, or the date and time. # Corresponds to the JSON property `type` # @return [String] attr_accessor :type # The default value displayed in the widget, in milliseconds since [Unix epoch # time](https://en.wikipedia.org/wiki/Unix_time). Specify the value based on the # type of picker (`DateTimePickerType`): * `DATE_AND_TIME`: a calendar date and # time in UTC. For example, to represent January 1, 2023 at 12:00 PM UTC, use ` # 1672574400000`. * `DATE_ONLY`: a calendar date at 00:00:00 UTC. For example, # to represent January 1, 2023, use `1672531200000`. * `TIME_ONLY`: a time in # UTC. For example, to represent 12:00 PM, use `43200000` (or `12 * 60 * 60 * # 1000`). # Corresponds to the JSON property `valueMsEpoch` # @return [Fixnum] attr_accessor :value_ms_epoch def initialize(**args) update!(**args) end # Update properties of this object def update!(**args) @label = args[:label] if args.key?(:label) @name = args[:name] if args.key?(:name) @on_change_action = args[:on_change_action] if args.key?(:on_change_action) @timezone_offset_date = args[:timezone_offset_date] if args.key?(:timezone_offset_date) @type = args[:type] if args.key?(:type) @value_ms_epoch = args[:value_ms_epoch] if args.key?(:value_ms_epoch) end end # A widget that displays text with optional decorations such as a label above or # below the text, an icon in front of the text, a selection widget, or a button # after the text. For an example in Google Chat apps, see [Decorated text](https: # //developers.google.com/chat/ui/widgets/decorated-text). class GoogleAppsCardV1DecoratedText include Google::Apis::Core::Hashable # The text that appears below `text`. Always wraps. # Corresponds to the JSON property `bottomLabel` # @return [String] attr_accessor :bottom_label # A text, icon, or text and icon button that users can click. For an example in # Google Chat apps, see [Button list](https://developers.google.com/chat/ui/ # widgets/button-list). To make an image a clickable button, specify an `Image` ( # not an `ImageComponent`) and set an `onClick` action. # Corresponds to the JSON property `button` # @return [Google::Apis::ChatV1::GoogleAppsCardV1Button] attr_accessor :button # An icon displayed in a widget on a card. For an example in Google Chat apps, # see [Icon](https://developers.google.com/chat/ui/widgets/icon). Supports [ # built-in](https://developers.google.com/chat/api/guides/message-formats/cards# # builtinicons) and [custom](https://developers.google.com/chat/api/guides/ # message-formats/cards#customicons) icons. # Corresponds to the JSON property `endIcon` # @return [Google::Apis::ChatV1::GoogleAppsCardV1Icon] attr_accessor :end_icon # An icon displayed in a widget on a card. For an example in Google Chat apps, # see [Icon](https://developers.google.com/chat/ui/widgets/icon). Supports [ # built-in](https://developers.google.com/chat/api/guides/message-formats/cards# # builtinicons) and [custom](https://developers.google.com/chat/api/guides/ # message-formats/cards#customicons) icons. # Corresponds to the JSON property `icon` # @return [Google::Apis::ChatV1::GoogleAppsCardV1Icon] attr_accessor :icon # Represents how to respond when users click an interactive element on a card, # such as a button. # Corresponds to the JSON property `onClick` # @return [Google::Apis::ChatV1::GoogleAppsCardV1OnClick] attr_accessor :on_click # An icon displayed in a widget on a card. For an example in Google Chat apps, # see [Icon](https://developers.google.com/chat/ui/widgets/icon). Supports [ # built-in](https://developers.google.com/chat/api/guides/message-formats/cards# # builtinicons) and [custom](https://developers.google.com/chat/api/guides/ # message-formats/cards#customicons) icons. # Corresponds to the JSON property `startIcon` # @return [Google::Apis::ChatV1::GoogleAppsCardV1Icon] attr_accessor :start_icon # Either a toggle-style switch or a checkbox inside a `decoratedText` widget. # Only supported in the `decoratedText` widget. # Corresponds to the JSON property `switchControl` # @return [Google::Apis::ChatV1::GoogleAppsCardV1SwitchControl] attr_accessor :switch_control # Required. The primary text. Supports simple formatting. For more information # about formatting text, see [Formatting text in Google Chat apps](https:// # developers.google.com/chat/api/guides/message-formats/cards#card-formatting) # and [Formatting text in Google Workspace Add-ons](https://developers.google. # com/apps-script/add-ons/concepts/widgets#text_formatting). # Corresponds to the JSON property `text` # @return [String] attr_accessor :text # The text that appears above `text`. Always truncates. # Corresponds to the JSON property `topLabel` # @return [String] attr_accessor :top_label # The wrap text setting. If `true`, the text wraps and displays on multiple # lines. Otherwise, the text is truncated. Only applies to `text`, not `topLabel` # and `bottomLabel`. # Corresponds to the JSON property `wrapText` # @return [Boolean] attr_accessor :wrap_text alias_method :wrap_text?, :wrap_text def initialize(**args) update!(**args) end # Update properties of this object def update!(**args) @bottom_label = args[:bottom_label] if args.key?(:bottom_label) @button = args[:button] if args.key?(:button) @end_icon = args[:end_icon] if args.key?(:end_icon) @icon = args[:icon] if args.key?(:icon) @on_click = args[:on_click] if args.key?(:on_click) @start_icon = args[:start_icon] if args.key?(:start_icon) @switch_control = args[:switch_control] if args.key?(:switch_control) @text = args[:text] if args.key?(:text) @top_label = args[:top_label] if args.key?(:top_label) @wrap_text = args[:wrap_text] if args.key?(:wrap_text) end end # Displays a divider between widgets as a horizontal line. For an example in # Google Chat apps, see [Divider](https://developers.google.com/chat/ui/widgets/ # divider). For example, the following JSON creates a divider: ``` "divider": `` # ``` class GoogleAppsCardV1Divider include Google::Apis::Core::Hashable def initialize(**args) update!(**args) end # Update properties of this object def update!(**args) end end # Displays a grid with a collection of items. Items can only include text or # images. For responsive columns, or to include more than text or images, use ` # Columns`. For an example in Google Chat apps, see [Grid](https://developers. # google.com/chat/ui/widgets/grid). A grid supports any number of columns and # items. The number of rows is determined by items divided by columns. A grid # with 10 items and 2 columns has 5 rows. A grid with 11 items and 2 columns has # 6 rows. For example, the following JSON creates a 2 column grid with a single # item: ``` "grid": ` "title": "A fine collection of items", "columnCount": 2, " # borderStyle": ` "type": "STROKE", "cornerRadius": 4 `, "items": [ ` "image": ` # "imageUri": "https://www.example.com/image.png", "cropStyle": ` "type": " # SQUARE" `, "borderStyle": ` "type": "STROKE" ` `, "title": "An item", " # textAlignment": "CENTER" ` ], "onClick": ` "openLink": ` "url": "https://www. # example.com" ` ` ` ``` class GoogleAppsCardV1Grid include Google::Apis::Core::Hashable # The style options for the border of a card or widget, including the border # type and color. # Corresponds to the JSON property `borderStyle` # @return [Google::Apis::ChatV1::GoogleAppsCardV1BorderStyle] attr_accessor :border_style # The number of columns to display in the grid. A default value is used if this # field isn't specified, and that default value is different depending on where # the grid is shown (dialog versus companion). # Corresponds to the JSON property `columnCount` # @return [Fixnum] attr_accessor :column_count # The items to display in the grid. # Corresponds to the JSON property `items` # @return [Array] attr_accessor :items # Represents how to respond when users click an interactive element on a card, # such as a button. # Corresponds to the JSON property `onClick` # @return [Google::Apis::ChatV1::GoogleAppsCardV1OnClick] attr_accessor :on_click # The text that displays in the grid header. # Corresponds to the JSON property `title` # @return [String] attr_accessor :title def initialize(**args) update!(**args) end # Update properties of this object def update!(**args) @border_style = args[:border_style] if args.key?(:border_style) @column_count = args[:column_count] if args.key?(:column_count) @items = args[:items] if args.key?(:items) @on_click = args[:on_click] if args.key?(:on_click) @title = args[:title] if args.key?(:title) end end # Represents an item in a grid layout. Items can contain text, an image, or both # text and an image. class GoogleAppsCardV1GridItem include Google::Apis::Core::Hashable # A user-specified identifier for this grid item. This identifier is returned in # the parent grid's `onClick` callback parameters. # Corresponds to the JSON property `id` # @return [String] attr_accessor :id # Represents an image. # Corresponds to the JSON property `image` # @return [Google::Apis::ChatV1::GoogleAppsCardV1ImageComponent] attr_accessor :image # The layout to use for the grid item. # Corresponds to the JSON property `layout` # @return [String] attr_accessor :layout # The grid item's subtitle. # Corresponds to the JSON property `subtitle` # @return [String] attr_accessor :subtitle # The grid item's title. # Corresponds to the JSON property `title` # @return [String] attr_accessor :title def initialize(**args) update!(**args) end # Update properties of this object def update!(**args) @id = args[:id] if args.key?(:id) @image = args[:image] if args.key?(:image) @layout = args[:layout] if args.key?(:layout) @subtitle = args[:subtitle] if args.key?(:subtitle) @title = args[:title] if args.key?(:title) end end # An icon displayed in a widget on a card. For an example in Google Chat apps, # see [Icon](https://developers.google.com/chat/ui/widgets/icon). Supports [ # built-in](https://developers.google.com/chat/api/guides/message-formats/cards# # builtinicons) and [custom](https://developers.google.com/chat/api/guides/ # message-formats/cards#customicons) icons. class GoogleAppsCardV1Icon include Google::Apis::Core::Hashable # Optional. A description of the icon used for accessibility. If unspecified, # the default value `Button` is provided. As a best practice, you should set a # helpful description for what the icon displays, and if applicable, what it # does. For example, `A user's account portrait`, or `Opens a new browser tab # and navigates to the Google Chat developer documentation at https://developers. # google.com/chat`. If the icon is set in a `Button`, the `altText` appears as # helper text when the user hovers over the button. However, if the button also # sets `text`, the icon's `altText` is ignored. # Corresponds to the JSON property `altText` # @return [String] attr_accessor :alt_text # Display a custom icon hosted at an HTTPS URL. For example: ``` "iconUrl": " # https://developers.google.com/chat/images/quickstart-app-avatar.png" ``` # Supported file types include `.png` and `.jpg`. # Corresponds to the JSON property `iconUrl` # @return [String] attr_accessor :icon_url # The crop style applied to the image. In some cases, applying a `CIRCLE` crop # causes the image to be drawn larger than a built-in icon. # Corresponds to the JSON property `imageType` # @return [String] attr_accessor :image_type # Display one of the built-in icons provided by Google Workspace. For example, # to display an airplane icon, specify `AIRPLANE`. For a bus, specify `BUS`. For # a full list of supported icons, see [built-in icons](https://developers.google. # com/chat/api/guides/message-formats/cards#builtinicons). # Corresponds to the JSON property `knownIcon` # @return [String] attr_accessor :known_icon def initialize(**args) update!(**args) end # Update properties of this object def update!(**args) @alt_text = args[:alt_text] if args.key?(:alt_text) @icon_url = args[:icon_url] if args.key?(:icon_url) @image_type = args[:image_type] if args.key?(:image_type) @known_icon = args[:known_icon] if args.key?(:known_icon) end end # An image that is specified by a URL and can have an `onClick` action. For an # example, see [Image](https://developers.google.com/chat/ui/widgets/image). class GoogleAppsCardV1Image include Google::Apis::Core::Hashable # The alternative text of this image that's used for accessibility. # Corresponds to the JSON property `altText` # @return [String] attr_accessor :alt_text # The HTTPS URL that hosts the image. For example: ``` https://developers.google. # com/chat/images/quickstart-app-avatar.png ``` # Corresponds to the JSON property `imageUrl` # @return [String] attr_accessor :image_url # Represents how to respond when users click an interactive element on a card, # such as a button. # Corresponds to the JSON property `onClick` # @return [Google::Apis::ChatV1::GoogleAppsCardV1OnClick] attr_accessor :on_click def initialize(**args) update!(**args) end # Update properties of this object def update!(**args) @alt_text = args[:alt_text] if args.key?(:alt_text) @image_url = args[:image_url] if args.key?(:image_url) @on_click = args[:on_click] if args.key?(:on_click) end end # Represents an image. class GoogleAppsCardV1ImageComponent include Google::Apis::Core::Hashable # The accessibility label for the image. # Corresponds to the JSON property `altText` # @return [String] attr_accessor :alt_text # The style options for the border of a card or widget, including the border # type and color. # Corresponds to the JSON property `borderStyle` # @return [Google::Apis::ChatV1::GoogleAppsCardV1BorderStyle] attr_accessor :border_style # Represents the crop style applied to an image. For example, here's how to # apply a 16:9 aspect ratio: ``` cropStyle ` "type": "RECTANGLE_CUSTOM", " # aspectRatio": 16/9 ` ``` # Corresponds to the JSON property `cropStyle` # @return [Google::Apis::ChatV1::GoogleAppsCardV1ImageCropStyle] attr_accessor :crop_style # The image URL. # Corresponds to the JSON property `imageUri` # @return [String] attr_accessor :image_uri def initialize(**args) update!(**args) end # Update properties of this object def update!(**args) @alt_text = args[:alt_text] if args.key?(:alt_text) @border_style = args[:border_style] if args.key?(:border_style) @crop_style = args[:crop_style] if args.key?(:crop_style) @image_uri = args[:image_uri] if args.key?(:image_uri) end end # Represents the crop style applied to an image. For example, here's how to # apply a 16:9 aspect ratio: ``` cropStyle ` "type": "RECTANGLE_CUSTOM", " # aspectRatio": 16/9 ` ``` class GoogleAppsCardV1ImageCropStyle include Google::Apis::Core::Hashable # The aspect ratio to use if the crop type is `RECTANGLE_CUSTOM`. For example, # here's how to apply a 16:9 aspect ratio: ``` cropStyle ` "type": " # RECTANGLE_CUSTOM", "aspectRatio": 16/9 ` ``` # Corresponds to the JSON property `aspectRatio` # @return [Float] attr_accessor :aspect_ratio # The crop type. # Corresponds to the JSON property `type` # @return [String] attr_accessor :type def initialize(**args) update!(**args) end # Update properties of this object def update!(**args) @aspect_ratio = args[:aspect_ratio] if args.key?(:aspect_ratio) @type = args[:type] if args.key?(:type) end end # Represents how to respond when users click an interactive element on a card, # such as a button. class GoogleAppsCardV1OnClick include Google::Apis::Core::Hashable # An action that describes the behavior when the form is submitted. For example, # you can invoke an Apps Script script to handle the form. If the action is # triggered, the form values are sent to the server. # Corresponds to the JSON property `action` # @return [Google::Apis::ChatV1::GoogleAppsCardV1Action] attr_accessor :action # A card interface displayed in a Google Chat message or Google Workspace Add-on. # Cards support a defined layout, interactive UI elements like buttons, and # rich media like images. Use cards to present detailed information, gather # information from users, and guide users to take a next step. To learn how to # build cards, see the following documentation: * For Google Chat apps, see [ # Design dynamic, interactive, and consistent UIs with cards](https://developers. # google.com/chat/ui). * For Google Workspace Add-ons, see [Card-based # interfaces](https://developers.google.com/apps-script/add-ons/concepts/cards). # **Example: Card message for a Google Chat app** ![Example contact card](https:/ # /developers.google.com/chat/images/card_api_reference.png) To create the # sample card message in Google Chat, use the following JSON: ``` ` "cardsV2": [ # ` "cardId": "unique-card-id", "card": ` "header": ` "title": "Sasha", " # subtitle": "Software Engineer", "imageUrl": "https://developers.google.com/ # chat/images/quickstart-app-avatar.png", "imageType": "CIRCLE", "imageAltText": # "Avatar for Sasha", `, "sections": [ ` "header": "Contact Info", "collapsible": # true, "uncollapsibleWidgetsCount": 1, "widgets": [ ` "decoratedText": ` " # startIcon": ` "knownIcon": "EMAIL", `, "text": "sasha@example.com", ` `, ` " # decoratedText": ` "startIcon": ` "knownIcon": "PERSON", `, "text": "Online", `, # `, ` "decoratedText": ` "startIcon": ` "knownIcon": "PHONE", `, "text": "+1 ( # 555) 555-1234", ` `, ` "buttonList": ` "buttons": [ ` "text": "Share", " # onClick": ` "openLink": ` "url": "https://example.com/share", ` ` `, ` "text": # "Edit", "onClick": ` "action": ` "function": "goToView", "parameters": [ ` " # key": "viewType", "value": "EDIT", ` ], ` ` `, ], ` `, ], `, ], `, ` ], ` ``` # Corresponds to the JSON property `card` # @return [Google::Apis::ChatV1::GoogleAppsCardV1Card] attr_accessor :card # An action that describes the behavior when the form is submitted. For example, # you can invoke an Apps Script script to handle the form. If the action is # triggered, the form values are sent to the server. # Corresponds to the JSON property `openDynamicLinkAction` # @return [Google::Apis::ChatV1::GoogleAppsCardV1Action] attr_accessor :open_dynamic_link_action # Represents an `onClick` event that opens a hyperlink. # Corresponds to the JSON property `openLink` # @return [Google::Apis::ChatV1::GoogleAppsCardV1OpenLink] attr_accessor :open_link def initialize(**args) update!(**args) end # Update properties of this object def update!(**args) @action = args[:action] if args.key?(:action) @card = args[:card] if args.key?(:card) @open_dynamic_link_action = args[:open_dynamic_link_action] if args.key?(:open_dynamic_link_action) @open_link = args[:open_link] if args.key?(:open_link) end end # Represents an `onClick` event that opens a hyperlink. class GoogleAppsCardV1OpenLink include Google::Apis::Core::Hashable # Whether the client forgets about a link after opening it, or observes it until # the window closes. Not supported by Chat apps. # Corresponds to the JSON property `onClose` # @return [String] attr_accessor :on_close # How to open a link. Not supported by Chat apps. # Corresponds to the JSON property `openAs` # @return [String] attr_accessor :open_as # The URL to open. # Corresponds to the JSON property `url` # @return [String] attr_accessor :url def initialize(**args) update!(**args) end # Update properties of this object def update!(**args) @on_close = args[:on_close] if args.key?(:on_close) @open_as = args[:open_as] if args.key?(:open_as) @url = args[:url] if args.key?(:url) end end # Chat apps only. For a `SelectionInput` widget that uses a multi-select menu, # the data from a [Google Workspace host application](https://developers.google. # com/chat/api/reference/rest/v1/HostApp). Used to populate the items in the # multi-select menu. [Developer Preview](https://developers.google.com/workspace/ # preview). class GoogleAppsCardV1PlatformDataSource include Google::Apis::Core::Hashable # For a `SelectionInput` widget that uses a multi-select menu, a data source # shared by all Google Workspace host applications, such as users in a Google # Workspace organization. [Developer Preview](https://developers.google.com/ # workspace/preview). # Corresponds to the JSON property `commonDataSource` # @return [String] attr_accessor :common_data_source # Chat apps only. For a `SelectionInput` widget that uses a multi-select menu, a # data source from a Google Workspace host application. [Developer Preview]( # https://developers.google.com/workspace/preview). # Corresponds to the JSON property `hostAppDataSource` # @return [Google::Apis::ChatV1::HostAppDataSourceMarkup] attr_accessor :host_app_data_source def initialize(**args) update!(**args) end # Update properties of this object def update!(**args) @common_data_source = args[:common_data_source] if args.key?(:common_data_source) @host_app_data_source = args[:host_app_data_source] if args.key?(:host_app_data_source) end end # A section contains a collection of widgets that are rendered vertically in the # order that they're specified. class GoogleAppsCardV1Section include Google::Apis::Core::Hashable # Indicates whether this section is collapsible. Collapsible sections hide some # or all widgets, but users can expand the section to reveal the hidden widgets # by clicking **Show more**. Users can hide the widgets again by clicking **Show # less**. To determine which widgets are hidden, specify ` # uncollapsibleWidgetsCount`. # Corresponds to the JSON property `collapsible` # @return [Boolean] attr_accessor :collapsible alias_method :collapsible?, :collapsible # Text that appears at the top of a section. Supports simple HTML formatted text. # For more information about formatting text, see [Formatting text in Google # Chat apps](https://developers.google.com/chat/api/guides/message-formats/cards# # card-formatting) and [Formatting text in Google Workspace Add-ons](https:// # developers.google.com/apps-script/add-ons/concepts/widgets#text_formatting). # Corresponds to the JSON property `header` # @return [String] attr_accessor :header # The number of uncollapsible widgets which remain visible even when a section # is collapsed. For example, when a section contains five widgets and the ` # uncollapsibleWidgetsCount` is set to `2`, the first two widgets are always # shown and the last three are collapsed by default. The ` # uncollapsibleWidgetsCount` is taken into account only when `collapsible` is ` # true`. # Corresponds to the JSON property `uncollapsibleWidgetsCount` # @return [Fixnum] attr_accessor :uncollapsible_widgets_count # All the widgets in the section. Must contain at least one widget. # Corresponds to the JSON property `widgets` # @return [Array] attr_accessor :widgets def initialize(**args) update!(**args) end # Update properties of this object def update!(**args) @collapsible = args[:collapsible] if args.key?(:collapsible) @header = args[:header] if args.key?(:header) @uncollapsible_widgets_count = args[:uncollapsible_widgets_count] if args.key?(:uncollapsible_widgets_count) @widgets = args[:widgets] if args.key?(:widgets) end end # A widget that creates one or more UI items that users can select. For example, # a dropdown menu or checkboxes. You can use this widget to collect data that # can be predicted or enumerated. For an example in Google Chat apps, see [ # Selection input](https://developers.google.com/chat/ui/widgets/selection-input) # . Chat apps can process the value of items that users select or input. For # details about working with form inputs, see [Receive form data](https:// # developers.google.com/chat/ui/read-form-data). To collect undefined or # abstract data from users, use the TextInput widget. class GoogleAppsCardV1SelectionInput include Google::Apis::Core::Hashable # An action that describes the behavior when the form is submitted. For example, # you can invoke an Apps Script script to handle the form. If the action is # triggered, the form values are sent to the server. # Corresponds to the JSON property `externalDataSource` # @return [Google::Apis::ChatV1::GoogleAppsCardV1Action] attr_accessor :external_data_source # An array of selectable items. For example, an array of radio buttons or # checkboxes. Supports up to 100 items. # Corresponds to the JSON property `items` # @return [Array] attr_accessor :items # The text that appears above the selection input field in the user interface. # Specify text that helps the user enter the information your app needs. For # example, if users are selecting the urgency of a work ticket from a drop-down # menu, the label might be "Urgency" or "Select urgency". # Corresponds to the JSON property `label` # @return [String] attr_accessor :label # For multi-select menus, the maximum number of items that a user can select. # Minimum value is 1 item. If unspecified, set to 3 items. [Developer Preview]( # https://developers.google.com/workspace/preview). # Corresponds to the JSON property `multiSelectMaxSelectedItems` # @return [Fixnum] attr_accessor :multi_select_max_selected_items # For multi-select menus, the number of text characters that a user inputs # before the Chat app queries autocomplete and displays suggested items on the # card. If unspecified, set to 0 characters for static data sources and 3 # characters for external data sources. [Developer Preview](https://developers. # google.com/workspace/preview). # Corresponds to the JSON property `multiSelectMinQueryLength` # @return [Fixnum] attr_accessor :multi_select_min_query_length # The name that identifies the selection input in a form input event. For # details about working with form inputs, see [Receive form data](https:// # developers.google.com/chat/ui/read-form-data). # Corresponds to the JSON property `name` # @return [String] attr_accessor :name # An action that describes the behavior when the form is submitted. For example, # you can invoke an Apps Script script to handle the form. If the action is # triggered, the form values are sent to the server. # Corresponds to the JSON property `onChangeAction` # @return [Google::Apis::ChatV1::GoogleAppsCardV1Action] attr_accessor :on_change_action # Chat apps only. For a `SelectionInput` widget that uses a multi-select menu, # the data from a [Google Workspace host application](https://developers.google. # com/chat/api/reference/rest/v1/HostApp). Used to populate the items in the # multi-select menu. [Developer Preview](https://developers.google.com/workspace/ # preview). # Corresponds to the JSON property `platformDataSource` # @return [Google::Apis::ChatV1::GoogleAppsCardV1PlatformDataSource] attr_accessor :platform_data_source # The type of items that are displayed to users in a `SelectionInput` widget. # Selection types support different types of interactions. For example, users # can select one or more checkboxes, but they can only select one value from a # dropdown menu. # Corresponds to the JSON property `type` # @return [String] attr_accessor :type def initialize(**args) update!(**args) end # Update properties of this object def update!(**args) @external_data_source = args[:external_data_source] if args.key?(:external_data_source) @items = args[:items] if args.key?(:items) @label = args[:label] if args.key?(:label) @multi_select_max_selected_items = args[:multi_select_max_selected_items] if args.key?(:multi_select_max_selected_items) @multi_select_min_query_length = args[:multi_select_min_query_length] if args.key?(:multi_select_min_query_length) @name = args[:name] if args.key?(:name) @on_change_action = args[:on_change_action] if args.key?(:on_change_action) @platform_data_source = args[:platform_data_source] if args.key?(:platform_data_source) @type = args[:type] if args.key?(:type) end end # An item that users can select in a selection input, such as a checkbox or # switch. class GoogleAppsCardV1SelectionItem include Google::Apis::Core::Hashable # For multi-select menus, a text description or label that's displayed below the # item's `text` field. [Developer Preview](https://developers.google.com/ # workspace/preview). # Corresponds to the JSON property `bottomText` # @return [String] attr_accessor :bottom_text # Whether the item is selected by default. If the selection input only accepts # one value (such as for radio buttons or a dropdown menu), only set this field # for one item. # Corresponds to the JSON property `selected` # @return [Boolean] attr_accessor :selected alias_method :selected?, :selected # For multi-select menus, the URL for the icon displayed next to the item's ` # text` field. Supports PNG and JPEG files. Must be an `HTTPS` URL. For example, # `https://developers.google.com/chat/images/quickstart-app-avatar.png`. [ # Developer Preview](https://developers.google.com/workspace/preview). # Corresponds to the JSON property `startIconUri` # @return [String] attr_accessor :start_icon_uri # The text that identifies or describes the item to users. # Corresponds to the JSON property `text` # @return [String] attr_accessor :text # The value associated with this item. The client should use this as a form # input value. For details about working with form inputs, see [Receive form # data](https://developers.google.com/chat/ui/read-form-data). # Corresponds to the JSON property `value` # @return [String] attr_accessor :value def initialize(**args) update!(**args) end # Update properties of this object def update!(**args) @bottom_text = args[:bottom_text] if args.key?(:bottom_text) @selected = args[:selected] if args.key?(:selected) @start_icon_uri = args[:start_icon_uri] if args.key?(:start_icon_uri) @text = args[:text] if args.key?(:text) @value = args[:value] if args.key?(:value) end end # One suggested value that users can enter in a text input field. class GoogleAppsCardV1SuggestionItem include Google::Apis::Core::Hashable # The value of a suggested input to a text input field. This is equivalent to # what users enter themselves. # Corresponds to the JSON property `text` # @return [String] attr_accessor :text def initialize(**args) update!(**args) end # Update properties of this object def update!(**args) @text = args[:text] if args.key?(:text) end end # Suggested values that users can enter. These values appear when users click # inside the text input field. As users type, the suggested values dynamically # filter to match what the users have typed. For example, a text input field for # programming language might suggest Java, JavaScript, Python, and C++. When # users start typing `Jav`, the list of suggestions filters to show `Java` and ` # JavaScript`. Suggested values help guide users to enter values that your app # can make sense of. When referring to JavaScript, some users might enter ` # javascript` and others `java script`. Suggesting `JavaScript` can standardize # how users interact with your app. When specified, `TextInput.type` is always ` # SINGLE_LINE`, even if it's set to `MULTIPLE_LINE`. class GoogleAppsCardV1Suggestions include Google::Apis::Core::Hashable # A list of suggestions used for autocomplete recommendations in text input # fields. # Corresponds to the JSON property `items` # @return [Array] attr_accessor :items def initialize(**args) update!(**args) end # Update properties of this object def update!(**args) @items = args[:items] if args.key?(:items) end end # Either a toggle-style switch or a checkbox inside a `decoratedText` widget. # Only supported in the `decoratedText` widget. class GoogleAppsCardV1SwitchControl include Google::Apis::Core::Hashable # How the switch appears in the user interface. # Corresponds to the JSON property `controlType` # @return [String] attr_accessor :control_type # The name by which the switch widget is identified in a form input event. For # details about working with form inputs, see [Receive form data](https:// # developers.google.com/chat/ui/read-form-data). # Corresponds to the JSON property `name` # @return [String] attr_accessor :name # An action that describes the behavior when the form is submitted. For example, # you can invoke an Apps Script script to handle the form. If the action is # triggered, the form values are sent to the server. # Corresponds to the JSON property `onChangeAction` # @return [Google::Apis::ChatV1::GoogleAppsCardV1Action] attr_accessor :on_change_action # When `true`, the switch is selected. # Corresponds to the JSON property `selected` # @return [Boolean] attr_accessor :selected alias_method :selected?, :selected # The value entered by a user, returned as part of a form input event. For # details about working with form inputs, see [Receive form data](https:// # developers.google.com/chat/ui/read-form-data). # Corresponds to the JSON property `value` # @return [String] attr_accessor :value def initialize(**args) update!(**args) end # Update properties of this object def update!(**args) @control_type = args[:control_type] if args.key?(:control_type) @name = args[:name] if args.key?(:name) @on_change_action = args[:on_change_action] if args.key?(:on_change_action) @selected = args[:selected] if args.key?(:selected) @value = args[:value] if args.key?(:value) end end # A field in which users can enter text. Supports suggestions and on-change # actions. For an example in Google Chat apps, see [Text input](https:// # developers.google.com/chat/ui/widgets/text-input). Chat apps receive and can # process the value of entered text during form input events. For details about # working with form inputs, see [Receive form data](https://developers.google. # com/chat/ui/read-form-data). When you need to collect undefined or abstract # data from users, use a text input. To collect defined or enumerated data from # users, use the SelectionInput widget. class GoogleAppsCardV1TextInput include Google::Apis::Core::Hashable # An action that describes the behavior when the form is submitted. For example, # you can invoke an Apps Script script to handle the form. If the action is # triggered, the form values are sent to the server. # Corresponds to the JSON property `autoCompleteAction` # @return [Google::Apis::ChatV1::GoogleAppsCardV1Action] attr_accessor :auto_complete_action # Text that appears below the text input field meant to assist users by # prompting them to enter a certain value. This text is always visible. Required # if `label` is unspecified. Otherwise, optional. # Corresponds to the JSON property `hintText` # @return [String] attr_accessor :hint_text # Suggested values that users can enter. These values appear when users click # inside the text input field. As users type, the suggested values dynamically # filter to match what the users have typed. For example, a text input field for # programming language might suggest Java, JavaScript, Python, and C++. When # users start typing `Jav`, the list of suggestions filters to show `Java` and ` # JavaScript`. Suggested values help guide users to enter values that your app # can make sense of. When referring to JavaScript, some users might enter ` # javascript` and others `java script`. Suggesting `JavaScript` can standardize # how users interact with your app. When specified, `TextInput.type` is always ` # SINGLE_LINE`, even if it's set to `MULTIPLE_LINE`. # Corresponds to the JSON property `initialSuggestions` # @return [Google::Apis::ChatV1::GoogleAppsCardV1Suggestions] attr_accessor :initial_suggestions # The text that appears above the text input field in the user interface. # Specify text that helps the user enter the information your app needs. For # example, if you are asking someone's name, but specifically need their surname, # write `surname` instead of `name`. Required if `hintText` is unspecified. # Otherwise, optional. # Corresponds to the JSON property `label` # @return [String] attr_accessor :label # The name by which the text input is identified in a form input event. For # details about working with form inputs, see [Receive form data](https:// # developers.google.com/chat/ui/read-form-data). # Corresponds to the JSON property `name` # @return [String] attr_accessor :name # An action that describes the behavior when the form is submitted. For example, # you can invoke an Apps Script script to handle the form. If the action is # triggered, the form values are sent to the server. # Corresponds to the JSON property `onChangeAction` # @return [Google::Apis::ChatV1::GoogleAppsCardV1Action] attr_accessor :on_change_action # How a text input field appears in the user interface. For example, whether the # field is single or multi-line. # Corresponds to the JSON property `type` # @return [String] attr_accessor :type # The value entered by a user, returned as part of a form input event. For # details about working with form inputs, see [Receive form data](https:// # developers.google.com/chat/ui/read-form-data). # Corresponds to the JSON property `value` # @return [String] attr_accessor :value def initialize(**args) update!(**args) end # Update properties of this object def update!(**args) @auto_complete_action = args[:auto_complete_action] if args.key?(:auto_complete_action) @hint_text = args[:hint_text] if args.key?(:hint_text) @initial_suggestions = args[:initial_suggestions] if args.key?(:initial_suggestions) @label = args[:label] if args.key?(:label) @name = args[:name] if args.key?(:name) @on_change_action = args[:on_change_action] if args.key?(:on_change_action) @type = args[:type] if args.key?(:type) @value = args[:value] if args.key?(:value) end end # A paragraph of text that supports formatting. For an example in Google Chat # apps, see [Text paragraph](https://developers.google.com/chat/ui/widgets/text- # paragraph). For more information about formatting text, see [Formatting text # in Google Chat apps](https://developers.google.com/chat/api/guides/message- # formats/cards##card-formatting) and [Formatting text in Google Workspace Add- # ons](https://developers.google.com/apps-script/add-ons/concepts/widgets# # text_formatting). class GoogleAppsCardV1TextParagraph include Google::Apis::Core::Hashable # The text that's shown in the widget. # Corresponds to the JSON property `text` # @return [String] attr_accessor :text def initialize(**args) update!(**args) end # Update properties of this object def update!(**args) @text = args[:text] if args.key?(:text) end end # Each card is made up of widgets. A widget is a composite object that can # represent one of text, images, buttons, and other object types. class GoogleAppsCardV1Widget include Google::Apis::Core::Hashable # A list of buttons layed out horizontally. For an example in Google Chat apps, # see [Button list](https://developers.google.com/chat/ui/widgets/button-list). # Corresponds to the JSON property `buttonList` # @return [Google::Apis::ChatV1::GoogleAppsCardV1ButtonList] attr_accessor :button_list # The `Columns` widget displays up to 2 columns in a card message or dialog. You # can add widgets to each column; the widgets appear in the order that they are # specified. For an example in Google Chat apps, see [Columns](https:// # developers.google.com/chat/ui/widgets/columns). The height of each column is # determined by the taller column. For example, if the first column is taller # than the second column, both columns have the height of the first column. # Because each column can contain a different number of widgets, you can't # define rows or align widgets between the columns. Columns are displayed side- # by-side. You can customize the width of each column using the ` # HorizontalSizeStyle` field. If the user's screen width is too narrow, the # second column wraps below the first: * On web, the second column wraps if the # screen width is less than or equal to 480 pixels. * On iOS devices, the second # column wraps if the screen width is less than or equal to 300 pt. * On Android # devices, the second column wraps if the screen width is less than or equal to # 320 dp. To include more than 2 columns, or to use rows, use the `Grid` widget. # Supported by Chat apps, but not Google Workspace Add-ons. # Corresponds to the JSON property `columns` # @return [Google::Apis::ChatV1::GoogleAppsCardV1Columns] attr_accessor :columns # Lets users input a date, a time, or both a date and a time. For an example in # Google Chat apps, see [Date time picker](https://developers.google.com/chat/ui/ # widgets/date-time-picker). Users can input text or use the picker to select # dates and times. If users input an invalid date or time, the picker shows an # error that prompts users to input the information correctly. # Corresponds to the JSON property `dateTimePicker` # @return [Google::Apis::ChatV1::GoogleAppsCardV1DateTimePicker] attr_accessor :date_time_picker # A widget that displays text with optional decorations such as a label above or # below the text, an icon in front of the text, a selection widget, or a button # after the text. For an example in Google Chat apps, see [Decorated text](https: # //developers.google.com/chat/ui/widgets/decorated-text). # Corresponds to the JSON property `decoratedText` # @return [Google::Apis::ChatV1::GoogleAppsCardV1DecoratedText] attr_accessor :decorated_text # Displays a divider between widgets as a horizontal line. For an example in # Google Chat apps, see [Divider](https://developers.google.com/chat/ui/widgets/ # divider). For example, the following JSON creates a divider: ``` "divider": `` # ``` # Corresponds to the JSON property `divider` # @return [Google::Apis::ChatV1::GoogleAppsCardV1Divider] attr_accessor :divider # Displays a grid with a collection of items. Items can only include text or # images. For responsive columns, or to include more than text or images, use ` # Columns`. For an example in Google Chat apps, see [Grid](https://developers. # google.com/chat/ui/widgets/grid). A grid supports any number of columns and # items. The number of rows is determined by items divided by columns. A grid # with 10 items and 2 columns has 5 rows. A grid with 11 items and 2 columns has # 6 rows. For example, the following JSON creates a 2 column grid with a single # item: ``` "grid": ` "title": "A fine collection of items", "columnCount": 2, " # borderStyle": ` "type": "STROKE", "cornerRadius": 4 `, "items": [ ` "image": ` # "imageUri": "https://www.example.com/image.png", "cropStyle": ` "type": " # SQUARE" `, "borderStyle": ` "type": "STROKE" ` `, "title": "An item", " # textAlignment": "CENTER" ` ], "onClick": ` "openLink": ` "url": "https://www. # example.com" ` ` ` ``` # Corresponds to the JSON property `grid` # @return [Google::Apis::ChatV1::GoogleAppsCardV1Grid] attr_accessor :grid # Specifies whether widgets align to the left, right, or center of a column. # Corresponds to the JSON property `horizontalAlignment` # @return [String] attr_accessor :horizontal_alignment # An image that is specified by a URL and can have an `onClick` action. For an # example, see [Image](https://developers.google.com/chat/ui/widgets/image). # Corresponds to the JSON property `image` # @return [Google::Apis::ChatV1::GoogleAppsCardV1Image] attr_accessor :image # A widget that creates one or more UI items that users can select. For example, # a dropdown menu or checkboxes. You can use this widget to collect data that # can be predicted or enumerated. For an example in Google Chat apps, see [ # Selection input](https://developers.google.com/chat/ui/widgets/selection-input) # . Chat apps can process the value of items that users select or input. For # details about working with form inputs, see [Receive form data](https:// # developers.google.com/chat/ui/read-form-data). To collect undefined or # abstract data from users, use the TextInput widget. # Corresponds to the JSON property `selectionInput` # @return [Google::Apis::ChatV1::GoogleAppsCardV1SelectionInput] attr_accessor :selection_input # A field in which users can enter text. Supports suggestions and on-change # actions. For an example in Google Chat apps, see [Text input](https:// # developers.google.com/chat/ui/widgets/text-input). Chat apps receive and can # process the value of entered text during form input events. For details about # working with form inputs, see [Receive form data](https://developers.google. # com/chat/ui/read-form-data). When you need to collect undefined or abstract # data from users, use a text input. To collect defined or enumerated data from # users, use the SelectionInput widget. # Corresponds to the JSON property `textInput` # @return [Google::Apis::ChatV1::GoogleAppsCardV1TextInput] attr_accessor :text_input # A paragraph of text that supports formatting. For an example in Google Chat # apps, see [Text paragraph](https://developers.google.com/chat/ui/widgets/text- # paragraph). For more information about formatting text, see [Formatting text # in Google Chat apps](https://developers.google.com/chat/api/guides/message- # formats/cards##card-formatting) and [Formatting text in Google Workspace Add- # ons](https://developers.google.com/apps-script/add-ons/concepts/widgets# # text_formatting). # Corresponds to the JSON property `textParagraph` # @return [Google::Apis::ChatV1::GoogleAppsCardV1TextParagraph] attr_accessor :text_paragraph def initialize(**args) update!(**args) end # Update properties of this object def update!(**args) @button_list = args[:button_list] if args.key?(:button_list) @columns = args[:columns] if args.key?(:columns) @date_time_picker = args[:date_time_picker] if args.key?(:date_time_picker) @decorated_text = args[:decorated_text] if args.key?(:decorated_text) @divider = args[:divider] if args.key?(:divider) @grid = args[:grid] if args.key?(:grid) @horizontal_alignment = args[:horizontal_alignment] if args.key?(:horizontal_alignment) @image = args[:image] if args.key?(:image) @selection_input = args[:selection_input] if args.key?(:selection_input) @text_input = args[:text_input] if args.key?(:text_input) @text_paragraph = args[:text_paragraph] if args.key?(:text_paragraph) end end # The supported widgets that you can include in a column. class GoogleAppsCardV1Widgets include Google::Apis::Core::Hashable # A list of buttons layed out horizontally. For an example in Google Chat apps, # see [Button list](https://developers.google.com/chat/ui/widgets/button-list). # Corresponds to the JSON property `buttonList` # @return [Google::Apis::ChatV1::GoogleAppsCardV1ButtonList] attr_accessor :button_list # Lets users input a date, a time, or both a date and a time. For an example in # Google Chat apps, see [Date time picker](https://developers.google.com/chat/ui/ # widgets/date-time-picker). Users can input text or use the picker to select # dates and times. If users input an invalid date or time, the picker shows an # error that prompts users to input the information correctly. # Corresponds to the JSON property `dateTimePicker` # @return [Google::Apis::ChatV1::GoogleAppsCardV1DateTimePicker] attr_accessor :date_time_picker # A widget that displays text with optional decorations such as a label above or # below the text, an icon in front of the text, a selection widget, or a button # after the text. For an example in Google Chat apps, see [Decorated text](https: # //developers.google.com/chat/ui/widgets/decorated-text). # Corresponds to the JSON property `decoratedText` # @return [Google::Apis::ChatV1::GoogleAppsCardV1DecoratedText] attr_accessor :decorated_text # An image that is specified by a URL and can have an `onClick` action. For an # example, see [Image](https://developers.google.com/chat/ui/widgets/image). # Corresponds to the JSON property `image` # @return [Google::Apis::ChatV1::GoogleAppsCardV1Image] attr_accessor :image # A widget that creates one or more UI items that users can select. For example, # a dropdown menu or checkboxes. You can use this widget to collect data that # can be predicted or enumerated. For an example in Google Chat apps, see [ # Selection input](https://developers.google.com/chat/ui/widgets/selection-input) # . Chat apps can process the value of items that users select or input. For # details about working with form inputs, see [Receive form data](https:// # developers.google.com/chat/ui/read-form-data). To collect undefined or # abstract data from users, use the TextInput widget. # Corresponds to the JSON property `selectionInput` # @return [Google::Apis::ChatV1::GoogleAppsCardV1SelectionInput] attr_accessor :selection_input # A field in which users can enter text. Supports suggestions and on-change # actions. For an example in Google Chat apps, see [Text input](https:// # developers.google.com/chat/ui/widgets/text-input). Chat apps receive and can # process the value of entered text during form input events. For details about # working with form inputs, see [Receive form data](https://developers.google. # com/chat/ui/read-form-data). When you need to collect undefined or abstract # data from users, use a text input. To collect defined or enumerated data from # users, use the SelectionInput widget. # Corresponds to the JSON property `textInput` # @return [Google::Apis::ChatV1::GoogleAppsCardV1TextInput] attr_accessor :text_input # A paragraph of text that supports formatting. For an example in Google Chat # apps, see [Text paragraph](https://developers.google.com/chat/ui/widgets/text- # paragraph). For more information about formatting text, see [Formatting text # in Google Chat apps](https://developers.google.com/chat/api/guides/message- # formats/cards##card-formatting) and [Formatting text in Google Workspace Add- # ons](https://developers.google.com/apps-script/add-ons/concepts/widgets# # text_formatting). # Corresponds to the JSON property `textParagraph` # @return [Google::Apis::ChatV1::GoogleAppsCardV1TextParagraph] attr_accessor :text_paragraph def initialize(**args) update!(**args) end # Update properties of this object def update!(**args) @button_list = args[:button_list] if args.key?(:button_list) @date_time_picker = args[:date_time_picker] if args.key?(:date_time_picker) @decorated_text = args[:decorated_text] if args.key?(:decorated_text) @image = args[:image] if args.key?(:image) @selection_input = args[:selection_input] if args.key?(:selection_input) @text_input = args[:text_input] if args.key?(:text_input) @text_paragraph = args[:text_paragraph] if args.key?(:text_paragraph) end end # Chat apps only. For a `SelectionInput` widget that uses a multi-select menu, a # data source from a Google Workspace host application. [Developer Preview]( # https://developers.google.com/workspace/preview). class HostAppDataSourceMarkup include Google::Apis::Core::Hashable # Chat apps only. For a `SelectionInput` widget that uses a multi-select menu, a # data source from Google Chat. For example, a list of Google Chat spaces of # which the user is a member. [Developer Preview](https://developers.google.com/ # workspace/preview). # Corresponds to the JSON property `chatDataSource` # @return [Google::Apis::ChatV1::ChatClientDataSourceMarkup] attr_accessor :chat_data_source def initialize(**args) update!(**args) end # Update properties of this object def update!(**args) @chat_data_source = args[:chat_data_source] if args.key?(:chat_data_source) end end # An image that's specified by a URL and can have an `onclick` action. class Image include Google::Apis::Core::Hashable # The aspect ratio of this image (width and height). This field lets you reserve # the right height for the image while waiting for it to load. It's not meant to # override the built-in aspect ratio of the image. If unset, the server fills it # by prefetching the image. # Corresponds to the JSON property `aspectRatio` # @return [Float] attr_accessor :aspect_ratio # The URL of the image. # Corresponds to the JSON property `imageUrl` # @return [String] attr_accessor :image_url # An `onclick` action (for example, open a link). # Corresponds to the JSON property `onClick` # @return [Google::Apis::ChatV1::OnClick] attr_accessor :on_click def initialize(**args) update!(**args) end # Update properties of this object def update!(**args) @aspect_ratio = args[:aspect_ratio] if args.key?(:aspect_ratio) @image_url = args[:image_url] if args.key?(:image_url) @on_click = args[:on_click] if args.key?(:on_click) end end # An image button with an `onclick` action. class ImageButton include Google::Apis::Core::Hashable # The icon specified by an `enum` that indices to an icon provided by Chat API. # Corresponds to the JSON property `icon` # @return [String] attr_accessor :icon # The icon specified by a URL. # Corresponds to the JSON property `iconUrl` # @return [String] attr_accessor :icon_url # The name of this `image_button` that's used for accessibility. Default value # is provided if this name isn't specified. # Corresponds to the JSON property `name` # @return [String] attr_accessor :name # An `onclick` action (for example, open a link). # Corresponds to the JSON property `onClick` # @return [Google::Apis::ChatV1::OnClick] attr_accessor :on_click def initialize(**args) update!(**args) end # Update properties of this object def update!(**args) @icon = args[:icon] if args.key?(:icon) @icon_url = args[:icon_url] if args.key?(:icon_url) @name = args[:name] if args.key?(:name) @on_click = args[:on_click] if args.key?(:on_click) end end # Types of data that users can enter on cards or dialogs. To learn how to # process information from users, see [Read form data input by users on cards]( # https://developers.google.com/chat/ui/read-form-data). class Inputs include Google::Apis::Core::Hashable # Date input values. # Corresponds to the JSON property `dateInput` # @return [Google::Apis::ChatV1::DateInput] attr_accessor :date_input # Date and time input values. # Corresponds to the JSON property `dateTimeInput` # @return [Google::Apis::ChatV1::DateTimeInput] attr_accessor :date_time_input # Input parameter for regular widgets. For single-valued widgets, it is a single # value list. For multi-valued widgets, such as checkbox, all the values are # presented. # Corresponds to the JSON property `stringInputs` # @return [Google::Apis::ChatV1::StringInputs] attr_accessor :string_inputs # Time input values. # Corresponds to the JSON property `timeInput` # @return [Google::Apis::ChatV1::TimeInput] attr_accessor :time_input def initialize(**args) update!(**args) end # Update properties of this object def update!(**args) @date_input = args[:date_input] if args.key?(:date_input) @date_time_input = args[:date_time_input] if args.key?(:date_time_input) @string_inputs = args[:string_inputs] if args.key?(:string_inputs) @time_input = args[:time_input] if args.key?(:time_input) end end # A UI element contains a key (label) and a value (content). This element can # also contain some actions such as `onclick` button. class KeyValue include Google::Apis::Core::Hashable # The text of the bottom label. Formatted text supported. For more information # about formatting text, see [Formatting text in Google Chat apps](https:// # developers.google.com/chat/api/guides/message-formats/cards# # card_text_formatting) and [Formatting text in Google Workspace Add-ons](https:/ # /developers.google.com/apps-script/add-ons/concepts/widgets#text_formatting). # Corresponds to the JSON property `bottomLabel` # @return [String] attr_accessor :bottom_label # A button. Can be a text button or an image button. # Corresponds to the JSON property `button` # @return [Google::Apis::ChatV1::Button] attr_accessor :button # The text of the content. Formatted text supported and always required. For # more information about formatting text, see [Formatting text in Google Chat # apps](https://developers.google.com/chat/api/guides/message-formats/cards# # card_text_formatting) and [Formatting text in Google Workspace Add-ons](https:/ # /developers.google.com/apps-script/add-ons/concepts/widgets#text_formatting). # Corresponds to the JSON property `content` # @return [String] attr_accessor :content # If the content should be multiline. # Corresponds to the JSON property `contentMultiline` # @return [Boolean] attr_accessor :content_multiline alias_method :content_multiline?, :content_multiline # An enum value that's replaced by the Chat API with the corresponding icon # image. # Corresponds to the JSON property `icon` # @return [String] attr_accessor :icon # The icon specified by a URL. # Corresponds to the JSON property `iconUrl` # @return [String] attr_accessor :icon_url # An `onclick` action (for example, open a link). # Corresponds to the JSON property `onClick` # @return [Google::Apis::ChatV1::OnClick] attr_accessor :on_click # The text of the top label. Formatted text supported. For more information # about formatting text, see [Formatting text in Google Chat apps](https:// # developers.google.com/chat/api/guides/message-formats/cards# # card_text_formatting) and [Formatting text in Google Workspace Add-ons](https:/ # /developers.google.com/apps-script/add-ons/concepts/widgets#text_formatting). # Corresponds to the JSON property `topLabel` # @return [String] attr_accessor :top_label def initialize(**args) update!(**args) end # Update properties of this object def update!(**args) @bottom_label = args[:bottom_label] if args.key?(:bottom_label) @button = args[:button] if args.key?(:button) @content = args[:content] if args.key?(:content) @content_multiline = args[:content_multiline] if args.key?(:content_multiline) @icon = args[:icon] if args.key?(:icon) @icon_url = args[:icon_url] if args.key?(:icon_url) @on_click = args[:on_click] if args.key?(:on_click) @top_label = args[:top_label] if args.key?(:top_label) end end # class ListMembershipsResponse include Google::Apis::Core::Hashable # List of memberships in the requested (or first) page. # Corresponds to the JSON property `memberships` # @return [Array] attr_accessor :memberships # A token that you can send as `pageToken` to retrieve the next page of results. # If empty, there are no subsequent pages. # Corresponds to the JSON property `nextPageToken` # @return [String] attr_accessor :next_page_token def initialize(**args) update!(**args) end # Update properties of this object def update!(**args) @memberships = args[:memberships] if args.key?(:memberships) @next_page_token = args[:next_page_token] if args.key?(:next_page_token) end end # class ListMessagesResponse include Google::Apis::Core::Hashable # List of messages. # Corresponds to the JSON property `messages` # @return [Array] attr_accessor :messages # You can send a token as `pageToken` to retrieve the next page of results. If # empty, there are no subsequent pages. # Corresponds to the JSON property `nextPageToken` # @return [String] attr_accessor :next_page_token def initialize(**args) update!(**args) end # Update properties of this object def update!(**args) @messages = args[:messages] if args.key?(:messages) @next_page_token = args[:next_page_token] if args.key?(:next_page_token) end end # class ListReactionsResponse include Google::Apis::Core::Hashable # Continuation token to retrieve the next page of results. It's empty for the # last page of results. # Corresponds to the JSON property `nextPageToken` # @return [String] attr_accessor :next_page_token # List of reactions in the requested (or first) page. # Corresponds to the JSON property `reactions` # @return [Array] attr_accessor :reactions def initialize(**args) update!(**args) end # Update properties of this object def update!(**args) @next_page_token = args[:next_page_token] if args.key?(:next_page_token) @reactions = args[:reactions] if args.key?(:reactions) end end # class ListSpacesResponse include Google::Apis::Core::Hashable # You can send a token as `pageToken` to retrieve the next page of results. If # empty, there are no subsequent pages. # Corresponds to the JSON property `nextPageToken` # @return [String] attr_accessor :next_page_token # List of spaces in the requested (or first) page. # Corresponds to the JSON property `spaces` # @return [Array] attr_accessor :spaces def initialize(**args) update!(**args) end # Update properties of this object def update!(**args) @next_page_token = args[:next_page_token] if args.key?(:next_page_token) @spaces = args[:spaces] if args.key?(:spaces) end end # A matched URL in a Chat message. Chat apps can preview matched URLs. For more # information, see [Preview links](https://developers.google.com/chat/how-tos/ # preview-links). class MatchedUrl include Google::Apis::Core::Hashable # Output only. The URL that was matched. # Corresponds to the JSON property `url` # @return [String] attr_accessor :url def initialize(**args) update!(**args) end # Update properties of this object def update!(**args) @url = args[:url] if args.key?(:url) end end # Media resource. class Media include Google::Apis::Core::Hashable # Name of the media resource. # Corresponds to the JSON property `resourceName` # @return [String] attr_accessor :resource_name def initialize(**args) update!(**args) end # Update properties of this object def update!(**args) @resource_name = args[:resource_name] if args.key?(:resource_name) end end # Represents a membership relation in Google Chat, such as whether a user or # Chat app is invited to, part of, or absent from a space. class Membership include Google::Apis::Core::Hashable # Output only. The creation time of the membership, such as when a member joined # or was invited to join a space. # Corresponds to the JSON property `createTime` # @return [String] attr_accessor :create_time # A user in Google Chat. When returned as an output from a request, if your Chat # app [authenticates as a user](https://developers.google.com/chat/api/guides/ # auth/users), the output for a `User` resource only populates the user's `name` # and `type`. # Corresponds to the JSON property `member` # @return [Google::Apis::ChatV1::User] attr_accessor :member # Resource name of the membership, assigned by the server. Format: `spaces/` # space`/members/`member`` # Corresponds to the JSON property `name` # @return [String] attr_accessor :name # Output only. User's role within a Chat space, which determines their permitted # actions in the space. # Corresponds to the JSON property `role` # @return [String] attr_accessor :role # Output only. State of the membership. # Corresponds to the JSON property `state` # @return [String] attr_accessor :state def initialize(**args) update!(**args) end # Update properties of this object def update!(**args) @create_time = args[:create_time] if args.key?(:create_time) @member = args[:member] if args.key?(:member) @name = args[:name] if args.key?(:name) @role = args[:role] if args.key?(:role) @state = args[:state] if args.key?(:state) end end # A message in a Google Chat space. class Message include Google::Apis::Core::Hashable # Parameters that a Chat app can use to configure how its response is posted. # Corresponds to the JSON property `actionResponse` # @return [Google::Apis::ChatV1::ActionResponse] attr_accessor :action_response # Output only. Annotations associated with the `text` in this message. # Corresponds to the JSON property `annotations` # @return [Array] attr_accessor :annotations # Output only. Plain-text body of the message with all Chat app mentions # stripped out. # Corresponds to the JSON property `argumentText` # @return [String] attr_accessor :argument_text # Output only. GIF images that are attached to the message. # Corresponds to the JSON property `attachedGifs` # @return [Array] attr_accessor :attached_gifs # User-uploaded attachment. # Corresponds to the JSON property `attachment` # @return [Array] attr_accessor :attachment # Deprecated: Use `cards_v2` instead. Rich, formatted, and interactive cards # that you can use to display UI elements such as: formatted texts, buttons, and # clickable images. Cards are normally displayed below the plain-text body of # the message. `cards` and `cards_v2` can have a maximum size of 32 KB. # Corresponds to the JSON property `cards` # @return [Array] attr_accessor :cards # An array of [cards](https://developers.google.com/chat/api/reference/rest/v1/ # cards). Only Chat apps can create cards. If your Chat app [authenticates as a # user](https://developers.google.com/chat/api/guides/auth/users), the messages # can't contain cards. To learn about cards and how to create them, see [Design # dynamic, interactive, and consistent UIs with cards](https://developers.google. # com/chat/ui). # Corresponds to the JSON property `cardsV2` # @return [Array] attr_accessor :cards_v2 # A custom name for a Chat message assigned at creation. Must start with `client- # ` and contain only lowercase letters, numbers, and hyphens up to 63 characters # in length. Specify this field to get, update, or delete the message with the # specified value. Assigning a custom name lets a Chat app recall the message # without saving the message `name` from the [response body](/chat/api/reference/ # rest/v1/spaces.messages/get#response-body) returned when creating the message. # Assigning a custom name doesn't replace the generated `name` field, the # message's resource name. Instead, it sets the custom name as the ` # clientAssignedMessageId` field, which you can reference while processing later # operations, like updating or deleting the message. For example usage, see [ # Name a created message](https://developers.google.com/chat/api/guides/v1/ # messages/create#name_a_created_message). # Corresponds to the JSON property `clientAssignedMessageId` # @return [String] attr_accessor :client_assigned_message_id # For spaces created in Chat, the time at which the message was created. This # field is output only, except when used in imported spaces. [Developer Preview]( # https://developers.google.com/workspace/preview): For imported spaces, set # this field to the historical timestamp at which the message was created in the # source in order to preserve the original creation time. # Corresponds to the JSON property `createTime` # @return [String] attr_accessor :create_time # Output only. The time at which the message was deleted in Google Chat. If the # message is never deleted, this field is empty. # Corresponds to the JSON property `deleteTime` # @return [String] attr_accessor :delete_time # Information about a deleted message. A message is deleted when `delete_time` # is set. # Corresponds to the JSON property `deletionMetadata` # @return [Google::Apis::ChatV1::DeletionMetadata] attr_accessor :deletion_metadata # Output only. The list of emoji reaction summaries on the message. # Corresponds to the JSON property `emojiReactionSummaries` # @return [Array] attr_accessor :emoji_reaction_summaries # A plain-text description of the message's cards, used when the actual cards # can't be displayed—for example, mobile notifications. # Corresponds to the JSON property `fallbackText` # @return [String] attr_accessor :fallback_text # Output only. The time at which the message was last edited by a user. If the # message has never been edited, this field is empty. # Corresponds to the JSON property `lastUpdateTime` # @return [String] attr_accessor :last_update_time # A matched URL in a Chat message. Chat apps can preview matched URLs. For more # information, see [Preview links](https://developers.google.com/chat/how-tos/ # preview-links). # Corresponds to the JSON property `matchedUrl` # @return [Google::Apis::ChatV1::MatchedUrl] attr_accessor :matched_url # Resource name in the form `spaces/*/messages/*`. Example: `spaces/AAAAAAAAAAA/ # messages/BBBBBBBBBBB.BBBBBBBBBBB` # Corresponds to the JSON property `name` # @return [String] attr_accessor :name # Information about a quoted message. # Corresponds to the JSON property `quotedMessageMetadata` # @return [Google::Apis::ChatV1::QuotedMessageMetadata] attr_accessor :quoted_message_metadata # A user in Google Chat. When returned as an output from a request, if your Chat # app [authenticates as a user](https://developers.google.com/chat/api/guides/ # auth/users), the output for a `User` resource only populates the user's `name` # and `type`. # Corresponds to the JSON property `sender` # @return [Google::Apis::ChatV1::User] attr_accessor :sender # A [slash command](https://developers.google.com/chat/how-tos/slash-commands) # in Google Chat. # Corresponds to the JSON property `slashCommand` # @return [Google::Apis::ChatV1::SlashCommand] attr_accessor :slash_command # A space in Google Chat. Spaces are conversations between two or more users or # 1:1 messages between a user and a Chat app. # Corresponds to the JSON property `space` # @return [Google::Apis::ChatV1::Space] attr_accessor :space # Plain-text body of the message. The first link to an image, video, or web page # generates a [preview chip](https://developers.google.com/chat/how-tos/preview- # links). You can also [@mention a Google Chat user](https://developers.google. # com/chat/api/guides/message-formats/text#messages-@mention), or everyone in # the space. To learn about creating text messages, see [Create a text message]( # https://developers.google.com/chat/api/guides/message-formats/text). # Corresponds to the JSON property `text` # @return [String] attr_accessor :text # A thread in a Google Chat space. For example usage, see [Start or reply to a # message thread](https://developers.google.com/chat/api/guides/v1/messages/ # create#create-message-thread). If you specify a thread when creating a message, # you can set the [`messageReplyOption`](https://developers.google.com/chat/api/ # reference/rest/v1/spaces.messages/create#messagereplyoption) field to # determine what happens if no matching thread is found. # Corresponds to the JSON property `thread` # @return [Google::Apis::ChatV1::Thread] attr_accessor :thread # Output only. When `true`, the message is a response in a reply thread. When ` # false`, the message is visible in the space's top-level conversation as either # the first message of a thread or a message with no threaded replies. If the # space doesn't support reply in threads, this field is always `false`. # Corresponds to the JSON property `threadReply` # @return [Boolean] attr_accessor :thread_reply alias_method :thread_reply?, :thread_reply def initialize(**args) update!(**args) end # Update properties of this object def update!(**args) @action_response = args[:action_response] if args.key?(:action_response) @annotations = args[:annotations] if args.key?(:annotations) @argument_text = args[:argument_text] if args.key?(:argument_text) @attached_gifs = args[:attached_gifs] if args.key?(:attached_gifs) @attachment = args[:attachment] if args.key?(:attachment) @cards = args[:cards] if args.key?(:cards) @cards_v2 = args[:cards_v2] if args.key?(:cards_v2) @client_assigned_message_id = args[:client_assigned_message_id] if args.key?(:client_assigned_message_id) @create_time = args[:create_time] if args.key?(:create_time) @delete_time = args[:delete_time] if args.key?(:delete_time) @deletion_metadata = args[:deletion_metadata] if args.key?(:deletion_metadata) @emoji_reaction_summaries = args[:emoji_reaction_summaries] if args.key?(:emoji_reaction_summaries) @fallback_text = args[:fallback_text] if args.key?(:fallback_text) @last_update_time = args[:last_update_time] if args.key?(:last_update_time) @matched_url = args[:matched_url] if args.key?(:matched_url) @name = args[:name] if args.key?(:name) @quoted_message_metadata = args[:quoted_message_metadata] if args.key?(:quoted_message_metadata) @sender = args[:sender] if args.key?(:sender) @slash_command = args[:slash_command] if args.key?(:slash_command) @space = args[:space] if args.key?(:space) @text = args[:text] if args.key?(:text) @thread = args[:thread] if args.key?(:thread) @thread_reply = args[:thread_reply] if args.key?(:thread_reply) end end # An `onclick` action (for example, open a link). class OnClick include Google::Apis::Core::Hashable # A form action describes the behavior when the form is submitted. For example, # you can invoke Apps Script to handle the form. # Corresponds to the JSON property `action` # @return [Google::Apis::ChatV1::FormAction] attr_accessor :action # A link that opens a new window. # Corresponds to the JSON property `openLink` # @return [Google::Apis::ChatV1::OpenLink] attr_accessor :open_link def initialize(**args) update!(**args) end # Update properties of this object def update!(**args) @action = args[:action] if args.key?(:action) @open_link = args[:open_link] if args.key?(:open_link) end end # A link that opens a new window. class OpenLink include Google::Apis::Core::Hashable # The URL to open. # Corresponds to the JSON property `url` # @return [String] attr_accessor :url def initialize(**args) update!(**args) end # Update properties of this object def update!(**args) @url = args[:url] if args.key?(:url) end end # Information about a quoted message. class QuotedMessageMetadata include Google::Apis::Core::Hashable # Output only. The timestamp when the quoted message was created or when the # quoted message was last updated. # Corresponds to the JSON property `lastUpdateTime` # @return [String] attr_accessor :last_update_time # Output only. Resource name of the quoted message. Format: `spaces/`space`/ # messages/`message`` # Corresponds to the JSON property `name` # @return [String] attr_accessor :name def initialize(**args) update!(**args) end # Update properties of this object def update!(**args) @last_update_time = args[:last_update_time] if args.key?(:last_update_time) @name = args[:name] if args.key?(:name) end end # A reaction to a message. class Reaction include Google::Apis::Core::Hashable # An emoji that is used as a reaction to a message. # Corresponds to the JSON property `emoji` # @return [Google::Apis::ChatV1::Emoji] attr_accessor :emoji # The resource name of the reaction. Format: `spaces/`space`/messages/`message`/ # reactions/`reaction`` # Corresponds to the JSON property `name` # @return [String] attr_accessor :name # A user in Google Chat. When returned as an output from a request, if your Chat # app [authenticates as a user](https://developers.google.com/chat/api/guides/ # auth/users), the output for a `User` resource only populates the user's `name` # and `type`. # Corresponds to the JSON property `user` # @return [Google::Apis::ChatV1::User] attr_accessor :user def initialize(**args) update!(**args) end # Update properties of this object def update!(**args) @emoji = args[:emoji] if args.key?(:emoji) @name = args[:name] if args.key?(:name) @user = args[:user] if args.key?(:user) end end # A section contains a collection of widgets that are rendered (vertically) in # the order that they are specified. Across all platforms, cards have a narrow # fixed width, so there's currently no need for layout properties (for example, # float). class Section include Google::Apis::Core::Hashable # The header of the section. Formatted text is supported. For more information # about formatting text, see [Formatting text in Google Chat apps](https:// # developers.google.com/chat/api/guides/message-formats/cards# # card_text_formatting) and [Formatting text in Google Workspace Add-ons](https:/ # /developers.google.com/apps-script/add-ons/concepts/widgets#text_formatting). # Corresponds to the JSON property `header` # @return [String] attr_accessor :header # A section must contain at least one widget. # Corresponds to the JSON property `widgets` # @return [Array] attr_accessor :widgets def initialize(**args) update!(**args) end # Update properties of this object def update!(**args) @header = args[:header] if args.key?(:header) @widgets = args[:widgets] if args.key?(:widgets) end end # class SetUpSpaceRequest include Google::Apis::Core::Hashable # Optional. The Google Chat users to invite to join the space. Omit the calling # user, as they are added automatically. The set currently allows up to 20 # memberships (in addition to the caller). The `Membership.member` field must # contain a `user` with `name` populated (format: `users/`user``) and `type` set # to `User.Type.HUMAN`. You can only add human users when setting up a space ( # adding Chat apps is only supported for direct message setup with the calling # app). You can also add members using the user's email as an alias for `user`. # For example, the `user.name` can be `users/example@gmail.com`." To invite # Gmail users or users from external Google Workspace domains, user's email must # be used for ``user``. Optional when setting `Space.spaceType` to `SPACE`. # Required when setting `Space.spaceType` to `GROUP_CHAT`, along with at least # two memberships. Required when setting `Space.spaceType` to `DIRECT_MESSAGE` # with a human user, along with exactly one membership. Must be empty when # creating a 1:1 conversation between a human and the calling Chat app (when # setting `Space.spaceType` to `DIRECT_MESSAGE` and `Space.singleUserBotDm` to ` # true`). # Corresponds to the JSON property `memberships` # @return [Array] attr_accessor :memberships # Optional. A unique identifier for this request. A random UUID is recommended. # Specifying an existing request ID returns the space created with that ID # instead of creating a new space. Specifying an existing request ID from the # same Chat app with a different authenticated user returns an error. # Corresponds to the JSON property `requestId` # @return [String] attr_accessor :request_id # A space in Google Chat. Spaces are conversations between two or more users or # 1:1 messages between a user and a Chat app. # Corresponds to the JSON property `space` # @return [Google::Apis::ChatV1::Space] attr_accessor :space def initialize(**args) update!(**args) end # Update properties of this object def update!(**args) @memberships = args[:memberships] if args.key?(:memberships) @request_id = args[:request_id] if args.key?(:request_id) @space = args[:space] if args.key?(:space) end end # A [slash command](https://developers.google.com/chat/how-tos/slash-commands) # in Google Chat. class SlashCommand include Google::Apis::Core::Hashable # The ID of the slash command invoked. # Corresponds to the JSON property `commandId` # @return [Fixnum] attr_accessor :command_id def initialize(**args) update!(**args) end # Update properties of this object def update!(**args) @command_id = args[:command_id] if args.key?(:command_id) end end # Annotation metadata for slash commands (/). class SlashCommandMetadata include Google::Apis::Core::Hashable # A user in Google Chat. When returned as an output from a request, if your Chat # app [authenticates as a user](https://developers.google.com/chat/api/guides/ # auth/users), the output for a `User` resource only populates the user's `name` # and `type`. # Corresponds to the JSON property `bot` # @return [Google::Apis::ChatV1::User] attr_accessor :bot # The command ID of the invoked slash command. # Corresponds to the JSON property `commandId` # @return [Fixnum] attr_accessor :command_id # The name of the invoked slash command. # Corresponds to the JSON property `commandName` # @return [String] attr_accessor :command_name # Indicates whether the slash command is for a dialog. # Corresponds to the JSON property `triggersDialog` # @return [Boolean] attr_accessor :triggers_dialog alias_method :triggers_dialog?, :triggers_dialog # The type of slash command. # Corresponds to the JSON property `type` # @return [String] attr_accessor :type def initialize(**args) update!(**args) end # Update properties of this object def update!(**args) @bot = args[:bot] if args.key?(:bot) @command_id = args[:command_id] if args.key?(:command_id) @command_name = args[:command_name] if args.key?(:command_name) @triggers_dialog = args[:triggers_dialog] if args.key?(:triggers_dialog) @type = args[:type] if args.key?(:type) end end # A space in Google Chat. Spaces are conversations between two or more users or # 1:1 messages between a user and a Chat app. class Space include Google::Apis::Core::Hashable # Output only. Whether the Chat app was installed by a Google Workspace # administrator. Administrators can install a Chat app for their domain, # organizational unit, or a group of users. Administrators can only install Chat # apps for direct messaging between users and the app. To support admin install, # your app must feature direct messaging. # Corresponds to the JSON property `adminInstalled` # @return [Boolean] attr_accessor :admin_installed alias_method :admin_installed?, :admin_installed # The space's display name. Required when [creating a space](https://developers. # google.com/chat/api/reference/rest/v1/spaces/create). If you receive the error # message `ALREADY_EXISTS` when creating a space or updating the `displayName`, # try a different `displayName`. An existing space within the Google Workspace # organization might already use this display name. For direct messages, this # field might be empty. Supports up to 128 characters. # Corresponds to the JSON property `displayName` # @return [String] attr_accessor :display_name # Immutable. Whether this space permits any Google Chat user as a member. Input # when creating a space in a Google Workspace organization. For Google Chat # users that use a Google Account, omit this field when creating a space (By # default, the space permits any Google Chat user). For existing spaces, this # field is output only. # Corresponds to the JSON property `externalUserAllowed` # @return [Boolean] attr_accessor :external_user_allowed alias_method :external_user_allowed?, :external_user_allowed # Resource name of the space. Format: `spaces/`space`` # Corresponds to the JSON property `name` # @return [String] attr_accessor :name # Optional. Whether the space is a DM between a Chat app and a single human. # Corresponds to the JSON property `singleUserBotDm` # @return [Boolean] attr_accessor :single_user_bot_dm alias_method :single_user_bot_dm?, :single_user_bot_dm # Details about the space including description and rules. # Corresponds to the JSON property `spaceDetails` # @return [Google::Apis::ChatV1::SpaceDetails] attr_accessor :space_details # The message history state for messages and threads in this space. # Corresponds to the JSON property `spaceHistoryState` # @return [String] attr_accessor :space_history_state # Output only. The threading state in the Chat space. # Corresponds to the JSON property `spaceThreadingState` # @return [String] attr_accessor :space_threading_state # The type of space. Required when creating a space or updating the space type # of a space. Output only for other usage. # Corresponds to the JSON property `spaceType` # @return [String] attr_accessor :space_type # Output only. Deprecated: Use `spaceThreadingState` instead. Whether messages # are threaded in this space. # Corresponds to the JSON property `threaded` # @return [Boolean] attr_accessor :threaded alias_method :threaded?, :threaded # Output only. Deprecated: Use `space_type` instead. The type of a space. # Corresponds to the JSON property `type` # @return [String] attr_accessor :type def initialize(**args) update!(**args) end # Update properties of this object def update!(**args) @admin_installed = args[:admin_installed] if args.key?(:admin_installed) @display_name = args[:display_name] if args.key?(:display_name) @external_user_allowed = args[:external_user_allowed] if args.key?(:external_user_allowed) @name = args[:name] if args.key?(:name) @single_user_bot_dm = args[:single_user_bot_dm] if args.key?(:single_user_bot_dm) @space_details = args[:space_details] if args.key?(:space_details) @space_history_state = args[:space_history_state] if args.key?(:space_history_state) @space_threading_state = args[:space_threading_state] if args.key?(:space_threading_state) @space_type = args[:space_type] if args.key?(:space_type) @threaded = args[:threaded] if args.key?(:threaded) @type = args[:type] if args.key?(:type) end end # A data source representing a Google Chat space. Format: spaces/`space` [ # Developer Preview](https://developers.google.com/workspace/preview). class SpaceDataSource include Google::Apis::Core::Hashable # When `true`, uses the card's Google Chat space as the default selection. The # default value is `false`. [Developer Preview](https://developers.google.com/ # workspace/preview). # Corresponds to the JSON property `defaultToCurrentSpace` # @return [Boolean] attr_accessor :default_to_current_space alias_method :default_to_current_space?, :default_to_current_space def initialize(**args) update!(**args) end # Update properties of this object def update!(**args) @default_to_current_space = args[:default_to_current_space] if args.key?(:default_to_current_space) end end # Details about the space including description and rules. class SpaceDetails include Google::Apis::Core::Hashable # Optional. A description of the space. For example, describe the space's # discussion topic, functional purpose, or participants. Supports up to 150 # characters. # Corresponds to the JSON property `description` # @return [String] attr_accessor :description # Optional. The space's rules, expectations, and etiquette. Supports up to 5,000 # characters. # Corresponds to the JSON property `guidelines` # @return [String] attr_accessor :guidelines def initialize(**args) update!(**args) end # Update properties of this object def update!(**args) @description = args[:description] if args.key?(:description) @guidelines = args[:guidelines] if args.key?(:guidelines) end end # The `Status` type defines a logical error model that is suitable for different # programming environments, including REST APIs and RPC APIs. It is used by [ # gRPC](https://github.com/grpc). Each `Status` message contains three pieces of # data: error code, error message, and error details. You can find out more # about this error model and how to work with it in the [API Design Guide](https: # //cloud.google.com/apis/design/errors). class Status include Google::Apis::Core::Hashable # The status code, which should be an enum value of google.rpc.Code. # Corresponds to the JSON property `code` # @return [Fixnum] attr_accessor :code # A list of messages that carry the error details. There is a common set of # message types for APIs to use. # Corresponds to the JSON property `details` # @return [Array>] attr_accessor :details # A developer-facing error message, which should be in English. Any user-facing # error message should be localized and sent in the google.rpc.Status.details # field, or localized by the client. # Corresponds to the JSON property `message` # @return [String] attr_accessor :message def initialize(**args) update!(**args) end # Update properties of this object def update!(**args) @code = args[:code] if args.key?(:code) @details = args[:details] if args.key?(:details) @message = args[:message] if args.key?(:message) end end # Input parameter for regular widgets. For single-valued widgets, it is a single # value list. For multi-valued widgets, such as checkbox, all the values are # presented. class StringInputs include Google::Apis::Core::Hashable # An array of strings entered by the user. # Corresponds to the JSON property `value` # @return [Array] attr_accessor :value def initialize(**args) update!(**args) end # Update properties of this object def update!(**args) @value = args[:value] if args.key?(:value) end end # A button with text and `onclick` action. class TextButton include Google::Apis::Core::Hashable # An `onclick` action (for example, open a link). # Corresponds to the JSON property `onClick` # @return [Google::Apis::ChatV1::OnClick] attr_accessor :on_click # The text of the button. # Corresponds to the JSON property `text` # @return [String] attr_accessor :text def initialize(**args) update!(**args) end # Update properties of this object def update!(**args) @on_click = args[:on_click] if args.key?(:on_click) @text = args[:text] if args.key?(:text) end end # A paragraph of text. Formatted text supported. For more information about # formatting text, see [Formatting text in Google Chat apps](https://developers. # google.com/chat/api/guides/message-formats/cards#card_text_formatting) and [ # Formatting text in Google Workspace Add-ons](https://developers.google.com/ # apps-script/add-ons/concepts/widgets#text_formatting). class TextParagraph include Google::Apis::Core::Hashable # # Corresponds to the JSON property `text` # @return [String] attr_accessor :text def initialize(**args) update!(**args) end # Update properties of this object def update!(**args) @text = args[:text] if args.key?(:text) end end # A thread in a Google Chat space. For example usage, see [Start or reply to a # message thread](https://developers.google.com/chat/api/guides/v1/messages/ # create#create-message-thread). If you specify a thread when creating a message, # you can set the [`messageReplyOption`](https://developers.google.com/chat/api/ # reference/rest/v1/spaces.messages/create#messagereplyoption) field to # determine what happens if no matching thread is found. class Thread include Google::Apis::Core::Hashable # Output only. Resource name of the thread. Example: `spaces/`space`/threads/` # thread`` # Corresponds to the JSON property `name` # @return [String] attr_accessor :name # Optional. Input for creating or updating a thread. Otherwise, output only. ID # for the thread. Supports up to 4000 characters. This ID is unique to the Chat # app that sets it. For example, if multiple Chat apps create a message using # the same thread key, the messages are posted in different threads. To reply in # a thread created by a person or another Chat app, specify the thread `name` # field instead. # Corresponds to the JSON property `threadKey` # @return [String] attr_accessor :thread_key def initialize(**args) update!(**args) end # Update properties of this object def update!(**args) @name = args[:name] if args.key?(:name) @thread_key = args[:thread_key] if args.key?(:thread_key) end end # Time input values. class TimeInput include Google::Apis::Core::Hashable # The hour on a 24-hour clock. # Corresponds to the JSON property `hours` # @return [Fixnum] attr_accessor :hours # The number of minutes past the hour. Valid values are 0 to 59. # Corresponds to the JSON property `minutes` # @return [Fixnum] attr_accessor :minutes def initialize(**args) update!(**args) end # Update properties of this object def update!(**args) @hours = args[:hours] if args.key?(:hours) @minutes = args[:minutes] if args.key?(:minutes) end end # The timezone ID and offset from Coordinated Universal Time (UTC). Only # supported for the event types [`CARD_CLICKED`](https://developers.google.com/ # chat/api/reference/rest/v1/EventType#ENUM_VALUES.CARD_CLICKED) and [` # SUBMIT_DIALOG`](https://developers.google.com/chat/api/reference/rest/v1/ # DialogEventType#ENUM_VALUES.SUBMIT_DIALOG). class TimeZone include Google::Apis::Core::Hashable # The [IANA TZ](https://www.iana.org/time-zones) time zone database code, such # as "America/Toronto". # Corresponds to the JSON property `id` # @return [String] attr_accessor :id # The user timezone offset, in milliseconds, from Coordinated Universal Time ( # UTC). # Corresponds to the JSON property `offset` # @return [Fixnum] attr_accessor :offset def initialize(**args) update!(**args) end # Update properties of this object def update!(**args) @id = args[:id] if args.key?(:id) @offset = args[:offset] if args.key?(:offset) end end # class UploadAttachmentRequest include Google::Apis::Core::Hashable # Required. The filename of the attachment, including the file extension. # Corresponds to the JSON property `filename` # @return [String] attr_accessor :filename def initialize(**args) update!(**args) end # Update properties of this object def update!(**args) @filename = args[:filename] if args.key?(:filename) end end # class UploadAttachmentResponse include Google::Apis::Core::Hashable # Reference to the uploaded attachment. # Corresponds to the JSON property `attachmentDataRef` # @return [Google::Apis::ChatV1::AttachmentDataRef] attr_accessor :attachment_data_ref def initialize(**args) update!(**args) end # Update properties of this object def update!(**args) @attachment_data_ref = args[:attachment_data_ref] if args.key?(:attachment_data_ref) end end # A user in Google Chat. When returned as an output from a request, if your Chat # app [authenticates as a user](https://developers.google.com/chat/api/guides/ # auth/users), the output for a `User` resource only populates the user's `name` # and `type`. class User include Google::Apis::Core::Hashable # Output only. The user's display name. # Corresponds to the JSON property `displayName` # @return [String] attr_accessor :display_name # Unique identifier of the user's Google Workspace domain. # Corresponds to the JSON property `domainId` # @return [String] attr_accessor :domain_id # Output only. When `true`, the user is deleted or their profile is not visible. # Corresponds to the JSON property `isAnonymous` # @return [Boolean] attr_accessor :is_anonymous alias_method :is_anonymous?, :is_anonymous # Resource name for a Google Chat user. Format: `users/`user``. `users/app` can # be used as an alias for the calling app bot user. For human users, ``user`` is # the same user identifier as: - the ``person_id`` for the [Person](https:// # developers.google.com/people/api/rest/v1/people) in the People API, where the # Person `resource_name` is `people/`person_id``. For example, `users/123456789` # in Chat API represents the same person as `people/123456789` in People API. - # the `id` for a [user](https://developers.google.com/admin-sdk/directory/ # reference/rest/v1/users) in the Admin SDK Directory API. # Corresponds to the JSON property `name` # @return [String] attr_accessor :name # User type. # Corresponds to the JSON property `type` # @return [String] attr_accessor :type def initialize(**args) update!(**args) end # Update properties of this object def update!(**args) @display_name = args[:display_name] if args.key?(:display_name) @domain_id = args[:domain_id] if args.key?(:domain_id) @is_anonymous = args[:is_anonymous] if args.key?(:is_anonymous) @name = args[:name] if args.key?(:name) @type = args[:type] if args.key?(:type) end end # Annotation metadata for user mentions (@). class UserMentionMetadata include Google::Apis::Core::Hashable # The type of user mention. # Corresponds to the JSON property `type` # @return [String] attr_accessor :type # A user in Google Chat. When returned as an output from a request, if your Chat # app [authenticates as a user](https://developers.google.com/chat/api/guides/ # auth/users), the output for a `User` resource only populates the user's `name` # and `type`. # Corresponds to the JSON property `user` # @return [Google::Apis::ChatV1::User] attr_accessor :user def initialize(**args) update!(**args) end # Update properties of this object def update!(**args) @type = args[:type] if args.key?(:type) @user = args[:user] if args.key?(:user) end end # A widget is a UI element that presents text and images. class WidgetMarkup include Google::Apis::Core::Hashable # A list of buttons. Buttons is also `oneof data` and only one of these fields # should be set. # Corresponds to the JSON property `buttons` # @return [Array] attr_accessor :buttons # An image that's specified by a URL and can have an `onclick` action. # Corresponds to the JSON property `image` # @return [Google::Apis::ChatV1::Image] attr_accessor :image # A UI element contains a key (label) and a value (content). This element can # also contain some actions such as `onclick` button. # Corresponds to the JSON property `keyValue` # @return [Google::Apis::ChatV1::KeyValue] attr_accessor :key_value # A paragraph of text. Formatted text supported. For more information about # formatting text, see [Formatting text in Google Chat apps](https://developers. # google.com/chat/api/guides/message-formats/cards#card_text_formatting) and [ # Formatting text in Google Workspace Add-ons](https://developers.google.com/ # apps-script/add-ons/concepts/widgets#text_formatting). # Corresponds to the JSON property `textParagraph` # @return [Google::Apis::ChatV1::TextParagraph] attr_accessor :text_paragraph def initialize(**args) update!(**args) end # Update properties of this object def update!(**args) @buttons = args[:buttons] if args.key?(:buttons) @image = args[:image] if args.key?(:image) @key_value = args[:key_value] if args.key?(:key_value) @text_paragraph = args[:text_paragraph] if args.key?(:text_paragraph) end end end end end