xref: /aosp_15_r20/external/googleapis/google/chat/v1/contextual_addon.proto (revision d5c09012810ac0c9f33fe448fb6da8260d444cc9)
1// Copyright 2023 Google LLC
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//     http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15syntax = "proto3";
16
17package google.chat.v1;
18
19import "google/chat/v1/widgets.proto";
20
21option csharp_namespace = "Google.Apps.Chat.V1";
22option go_package = "cloud.google.com/go/chat/apiv1/chatpb;chatpb";
23option java_multiple_files = true;
24option java_outer_classname = "ContextualAddOnProto";
25option java_package = "com.google.chat.v1";
26option php_namespace = "Google\\Apps\\Chat\\V1";
27option ruby_package = "Google::Apps::Chat::V1";
28
29// The markup for developers to specify the contents of a contextual AddOn.
30message ContextualAddOnMarkup {
31  // A card is a UI element that can contain UI widgets such as text and
32  // images.
33  message Card {
34    message CardHeader {
35      enum ImageStyle {
36        IMAGE_STYLE_UNSPECIFIED = 0;
37
38        // Square border.
39        IMAGE = 1;
40
41        // Circular border.
42        AVATAR = 2;
43      }
44
45      // The title must be specified. The header has a fixed height: if both a
46      // title and subtitle is specified, each takes up one line. If only the
47      // title is specified, it takes up both lines.
48      string title = 1;
49
50      // The subtitle of the card header.
51      string subtitle = 2;
52
53      // The image's type (for example, square border or circular border).
54      ImageStyle image_style = 3;
55
56      // The URL of the image in the card header.
57      string image_url = 4;
58    }
59
60    // A section contains a collection of widgets that are rendered
61    // (vertically) in the order that they are specified. Across all platforms,
62    // cards have a narrow fixed width, so
63    // there's currently no need for layout properties (for example, float).
64    message Section {
65      // The header of the section. Formatted text is
66      // supported. For more information
67      // about formatting text, see
68      // [Formatting text in Google Chat
69      // apps](https://developers.google.com/workspace/chat/format-messages#card-formatting)
70      // and
71      // [Formatting
72      // text in Google Workspace
73      // Add-ons](https://developers.google.com/apps-script/add-ons/concepts/widgets#text_formatting).
74      string header = 1;
75
76      // A section must contain at least one widget.
77      repeated WidgetMarkup widgets = 2;
78    }
79
80    // A card action is
81    // the action associated with the card. For an invoice card, a
82    // typical action would be: delete invoice, email invoice or open the
83    // invoice in browser.
84    //
85    // Not supported by Google Chat apps.
86    message CardAction {
87      // The label used to be displayed in the action menu item.
88      string action_label = 1;
89
90      // The onclick action for this action item.
91      WidgetMarkup.OnClick on_click = 2;
92    }
93
94    // The header of the card. A header usually contains a title and an image.
95    CardHeader header = 1;
96
97    // Sections are separated by a line divider.
98    repeated Section sections = 2;
99
100    // The actions of this card.
101    repeated CardAction card_actions = 3;
102
103    // Name of the card.
104    string name = 4;
105  }
106}
107