Skip to content

Commit

Permalink
feat(chat): update the API
Browse files Browse the repository at this point in the history
#### chat:v1

The following keys were added:
- schemas.ChatClientDataSourceMarkup.description
- schemas.ChatClientDataSourceMarkup.id
- schemas.ChatClientDataSourceMarkup.properties.spaceDataSource.$ref
- schemas.ChatClientDataSourceMarkup.properties.spaceDataSource.description
- schemas.ChatClientDataSourceMarkup.type
- schemas.GoogleAppsCardV1Card.properties.sectionDividerStyle.description
- schemas.GoogleAppsCardV1Card.properties.sectionDividerStyle.enum
- schemas.GoogleAppsCardV1Card.properties.sectionDividerStyle.enumDescriptions
- schemas.GoogleAppsCardV1Card.properties.sectionDividerStyle.type
- schemas.GoogleAppsCardV1PlatformDataSource.description
- schemas.GoogleAppsCardV1PlatformDataSource.id
- schemas.GoogleAppsCardV1PlatformDataSource.properties.commonDataSource.description
- schemas.GoogleAppsCardV1PlatformDataSource.properties.commonDataSource.enum
- schemas.GoogleAppsCardV1PlatformDataSource.properties.commonDataSource.enumDescriptions
- schemas.GoogleAppsCardV1PlatformDataSource.properties.commonDataSource.type
- schemas.GoogleAppsCardV1PlatformDataSource.properties.hostAppDataSource.$ref
- schemas.GoogleAppsCardV1PlatformDataSource.properties.hostAppDataSource.description
- schemas.GoogleAppsCardV1PlatformDataSource.type
- schemas.GoogleAppsCardV1SelectionInput.properties.externalDataSource.$ref
- schemas.GoogleAppsCardV1SelectionInput.properties.externalDataSource.description
- schemas.GoogleAppsCardV1SelectionInput.properties.multiSelectMaxSelectedItems.description
- schemas.GoogleAppsCardV1SelectionInput.properties.multiSelectMaxSelectedItems.format
- schemas.GoogleAppsCardV1SelectionInput.properties.multiSelectMaxSelectedItems.type
- schemas.GoogleAppsCardV1SelectionInput.properties.multiSelectMinQueryLength.description
- schemas.GoogleAppsCardV1SelectionInput.properties.multiSelectMinQueryLength.format
- schemas.GoogleAppsCardV1SelectionInput.properties.multiSelectMinQueryLength.type
- schemas.GoogleAppsCardV1SelectionInput.properties.platformDataSource.$ref
- schemas.GoogleAppsCardV1SelectionInput.properties.platformDataSource.description
- schemas.GoogleAppsCardV1SelectionItem.properties.bottomText.description
- schemas.GoogleAppsCardV1SelectionItem.properties.bottomText.type
- schemas.GoogleAppsCardV1SelectionItem.properties.startIconUri.description
- schemas.GoogleAppsCardV1SelectionItem.properties.startIconUri.type
- schemas.HostAppDataSourceMarkup.description
- schemas.HostAppDataSourceMarkup.id
- schemas.HostAppDataSourceMarkup.properties.chatDataSource.$ref
- schemas.HostAppDataSourceMarkup.properties.chatDataSource.description
- schemas.HostAppDataSourceMarkup.type
- schemas.SpaceDataSource.description
- schemas.SpaceDataSource.id
- schemas.SpaceDataSource.properties.defaultToCurrentSpace.description
- schemas.SpaceDataSource.properties.defaultToCurrentSpace.type
- schemas.SpaceDataSource.type

The following keys were changed:
- schemas.GoogleAppsCardV1SelectionInput.properties.type.enum
- schemas.GoogleAppsCardV1SelectionInput.properties.type.enumDescriptions
  • Loading branch information
yoshi-automation authored and sofisl committed Jul 15, 2023
1 parent 71b067c commit 8ca9926
Show file tree
Hide file tree
Showing 2 changed files with 169 additions and 3 deletions.
104 changes: 101 additions & 3 deletions discovery/chat-v1.json
Original file line number Diff line number Diff line change
Expand Up @@ -954,7 +954,7 @@
}
}
},
"revision": "20230704",
"revision": "20230711",
"rootUrl": "https://chat.googleapis.com/",
"schemas": {
"ActionParameter": {
Expand Down Expand Up @@ -1301,6 +1301,17 @@
},
"type": "object"
},
"ChatClientDataSourceMarkup": {
"description": "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).",
"id": "ChatClientDataSourceMarkup",
"properties": {
"spaceDataSource": {
"$ref": "SpaceDataSource",
"description": "A data source representing a Google Chat space. Format: spaces/{space} [Developer Preview](https://developers.google.com/workspace/preview)."
}
},
"type": "object"
},
"Color": {
"description": "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(''); }; // ...",
"id": "Color",
Expand Down Expand Up @@ -1831,6 +1842,20 @@
"$ref": "GoogleAppsCardV1CardHeader",
"description": "When displaying contextual content, the peek card header acts as a placeholder so that the user can navigate forward between the homepage cards and the contextual cards. Not supported by Chat apps."
},
"sectionDividerStyle": {
"description": "The divider style between sections.",
"enum": [
"DIVIDER_STYLE_UNSPECIFIED",
"SOLID_DIVIDER",
"NO_DIVIDER"
],
"enumDescriptions": [
"Don't use. Unspecified.",
"Default option. Render a solid divider between sections.",
"If set, no divider is rendered between sections."
],
"type": "string"
},
"sections": {
"description": "Contains a collection of widgets. Each section has its own, optional header. Sections are visually separated by a line divider.",
"items": {
Expand Down Expand Up @@ -2306,6 +2331,29 @@
},
"type": "object"
},
"GoogleAppsCardV1PlatformDataSource": {
"description": "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).",
"id": "GoogleAppsCardV1PlatformDataSource",
"properties": {
"commonDataSource": {
"description": "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).",
"enum": [
"UNKNOWN",
"USER"
],
"enumDescriptions": [
"Default value. Don't use. [Developer Preview](https://developers.google.com/workspace/preview).",
"A list of users provided by the Google Workspace host application. For example, to source users from Google Chat, use the resource name of the [user](https://developers.google.com/chat/api/reference/rest/v1/User). Format: users/{user} [Developer Preview](https://developers.google.com/workspace/preview)."
],
"type": "string"
},
"hostAppDataSource": {
"$ref": "HostAppDataSourceMarkup",
"description": "A data source that's unique to a Google Workspace host application, such as Gmail emails, Google Calendar events, or Google Chat messages. [Developer Preview](https://developers.google.com/workspace/preview)."
}
},
"type": "object"
},
"GoogleAppsCardV1Section": {
"description": "A section contains a collection of widgets that are rendered vertically in the order that they're specified.",
"id": "GoogleAppsCardV1Section",
Expand Down Expand Up @@ -2337,6 +2385,10 @@
"description": "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. 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/how-tos/dialogs#receive_form_data_from_dialogs). To collect undefined or abstract data from users, use the TextInput widget.",
"id": "GoogleAppsCardV1SelectionInput",
"properties": {
"externalDataSource": {
"$ref": "GoogleAppsCardV1Action",
"description": "An external data source, such as a relational data base. [Developer Preview](https://developers.google.com/workspace/preview)."
},
"items": {
"description": "An array of selectable items. For example, an array of radio buttons or checkboxes. Supports up to 100 items.",
"items": {
Expand All @@ -2348,6 +2400,16 @@
"description": "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\".",
"type": "string"
},
"multiSelectMaxSelectedItems": {
"description": "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).",
"format": "int32",
"type": "integer"
},
"multiSelectMinQueryLength": {
"description": "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).",
"format": "int32",
"type": "integer"
},
"name": {
"description": "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/how-tos/dialogs#receive_form_data_from_dialogs).",
"type": "string"
Expand All @@ -2356,19 +2418,25 @@
"$ref": "GoogleAppsCardV1Action",
"description": "If specified, the form is submitted when the selection changes. If not specified, you must specify a separate button that submits the form. For details about working with form inputs, see [Receive form data](https://developers.google.com/chat/how-tos/dialogs#receive_form_data_from_dialogs)."
},
"platformDataSource": {
"$ref": "GoogleAppsCardV1PlatformDataSource",
"description": "A data source from a [Google Workspace host application](https://developers.google.com/chat/api/reference/rest/v1/HostApp). [Developer Preview](https://developers.google.com/workspace/preview)."
},
"type": {
"description": "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.",
"enum": [
"CHECK_BOX",
"RADIO_BUTTON",
"SWITCH",
"DROPDOWN"
"DROPDOWN",
"MULTI_SELECT"
],
"enumDescriptions": [
"A set of checkboxes. Users can select one or more checkboxes.",
"A set of radio buttons. Users can select one radio button.",
"A set of switches. Users can turn on one or more switches.",
"A dropdown menu. Users can select one item from the menu."
"A dropdown menu. Users can select one item from the menu.",
"Supported by Chat apps, but not Google Workspace Add-ons. A multi-select menu for static or dynamic data. From the menu bar, users select one or more items. Users can also input values to populate dynamic data. For example, users can start typing the name of a Google Chat space and the widget autosuggests the space. To populate items for a multi-select menu, you can use one of the following types of data sources: * Static data: Items are specified as `SelectionItem` objects in the widget. Up to 100 items. * Google Workspace data: Items are populated using data from a Google Workspace application, such as Google Chat users or spaces. * External data: Items are populated from a dynamic external data source. For examples of how to implement multi-select menus, see the [`SelectionInput` widget page](https://developers.google.com/chat/ui/widgets/selection-input). [Developer Preview](https://developers.google.com/workspace/preview)."
],
"type": "string"
}
Expand All @@ -2379,10 +2447,18 @@
"description": "An item that users can select in a selection input, such as a checkbox or switch.",
"id": "GoogleAppsCardV1SelectionItem",
"properties": {
"bottomText": {
"description": "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).",
"type": "string"
},
"selected": {
"description": "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.",
"type": "boolean"
},
"startIconUri": {
"description": "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).",
"type": "string"
},
"text": {
"description": "The text that identifies or describes the item to users.",
"type": "string"
Expand Down Expand Up @@ -2612,6 +2688,17 @@
},
"type": "object"
},
"HostAppDataSourceMarkup": {
"description": "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).",
"id": "HostAppDataSourceMarkup",
"properties": {
"chatDataSource": {
"$ref": "ChatClientDataSourceMarkup",
"description": "The data source is Google Chat. [Developer Preview](https://developers.google.com/workspace/preview)."
}
},
"type": "object"
},
"Image": {
"description": "An image that's specified by a URL and can have an `onclick` action.",
"id": "Image",
Expand Down Expand Up @@ -3376,6 +3463,17 @@
},
"type": "object"
},
"SpaceDataSource": {
"description": "A data source representing a Google Chat space. Format: spaces/{space} [Developer Preview](https://developers.google.com/workspace/preview).",
"id": "SpaceDataSource",
"properties": {
"defaultToCurrentSpace": {
"description": "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).",
"type": "boolean"
}
},
"type": "object"
},
"SpaceDetails": {
"description": "Details about the space including description and rules.",
"id": "SpaceDetails",
Expand Down
Loading

0 comments on commit 8ca9926

Please sign in to comment.