/
chat_v1.dms.conversations.html
2709 lines (2687 loc) 路 492 KB
/
chat_v1.dms.conversations.html
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
<html><body>
<style>
body, h1, h2, h3, div, span, p, pre, a {
margin: 0;
padding: 0;
border: 0;
font-weight: inherit;
font-style: inherit;
font-size: 100%;
font-family: inherit;
vertical-align: baseline;
}
body {
font-size: 13px;
padding: 1em;
}
h1 {
font-size: 26px;
margin-bottom: 1em;
}
h2 {
font-size: 24px;
margin-bottom: 1em;
}
h3 {
font-size: 20px;
margin-bottom: 1em;
margin-top: 1em;
}
pre, code {
line-height: 1.5;
font-family: Monaco, 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Lucida Console', monospace;
}
pre {
margin-top: 0.5em;
}
h1, h2, h3, p {
font-family: Arial, sans serif;
}
h1, h2, h3 {
border-bottom: solid #CCC 1px;
}
.toc_element {
margin-top: 0.5em;
}
.firstline {
margin-left: 2 em;
}
.method {
margin-top: 1em;
border: solid 1px #CCC;
padding: 1em;
background: #EEE;
}
.details {
font-weight: bold;
font-size: 14px;
}
</style>
<h1><a href="chat_v1.html">Google Chat API</a> . <a href="chat_v1.dms.html">dms</a> . <a href="chat_v1.dms.conversations.html">conversations</a></h1>
<h2>Instance Methods</h2>
<p class="toc_element">
<code><a href="#close">close()</a></code></p>
<p class="firstline">Close httplib2 connections.</p>
<p class="toc_element">
<code><a href="#messages">messages(parent, body=None, messageId=None, messageReplyOption=None, requestId=None, threadKey=None, x__xgafv=None)</a></code></p>
<p class="firstline">Legacy path for creating message. Calling these will result in a BadRequest response.</p>
<h3>Method Details</h3>
<div class="method">
<code class="details" id="close">close()</code>
<pre>Close httplib2 connections.</pre>
</div>
<div class="method">
<code class="details" id="messages">messages(parent, body=None, messageId=None, messageReplyOption=None, requestId=None, threadKey=None, x__xgafv=None)</code>
<pre>Legacy path for creating message. Calling these will result in a BadRequest response.
Args:
parent: string, Required. Space resource name, in the form "spaces/*". Example: spaces/AAAAAAAAAAA (required)
body: object, The request body.
The object takes the form of:
{ # A message in Google Chat.
"actionResponse": { # Parameters that a Chat app can use to configure how it's response is posted. # Input only. Parameters that a Chat app can use to configure how its response is posted.
"dialogAction": { # Contains a [dialog](https://developers.google.com/chat/how-tos/dialogs) and request status code. # Input only. A response to an event related to a [dialog](https://developers.google.com/chat/how-tos/dialogs). Must be accompanied by `ResponseType.Dialog`.
"actionStatus": { # Represents the status for a request to either invoke or submit a [dialog](https://developers.google.com/chat/how-tos/dialogs). # Input only. Status for a request to either invoke or submit a [dialog](https://developers.google.com/chat/how-tos/dialogs). Displays a status and message to users, if necessary. For example, in case of an error or success.
"statusCode": "A String", # The status code.
"userFacingMessage": "A String", # The message to send users about the status of their request. If unset, a generic message based on the `status_code` is sent.
},
"dialog": { # Wrapper around the card body of the dialog. # Input only. [Dialog](https://developers.google.com/chat/how-tos/dialogs) for the request.
"body": { # 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. In Google Chat, cards appear in several places: - As stand-alone messages. - Accompanying a text message, just beneath the text message. - As a [dialog](https://developers.google.com/chat/how-tos/dialogs). The following example JSON creates a "contact card" that features: - A header with the contact's name, job title, avatar picture. - A section with the contact information, including formatted text. - Buttons that users can click to share the contact or see more or less info. ![Example contact card](/chat/images/card_api_reference.png) ``` { "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", } ], } } }, ], } }, ], }, ], }, } ], } ``` # Input only. Body of the dialog, which is rendered in a modal. Google Chat apps do not support the following card entities: `DateTimePicker`, `OnChangeAction`.
"cardActions": [ # The card's actions. Actions are added to the card's generated toolbar menu. Not supported by Google 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" } } } ] ```
{ # 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 Google Chat apps.
"actionLabel": "A String", # The label that displays as the action menu item.
"onClick": { # Represents the response to an `onClick` event. # The `onClick` action for this action item.
"action": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # If specified, an action is triggered by this `onClick`.
"function": "A String", # Apps Script function to invoke when the containing element is clicked/activated.
"loadIndicator": "A String", # Specifies the loading indicator that the action displays while making the call to the action.
"parameters": [ # List of action parameters.
{ # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters.
"key": "A String", # The name of the parameter for the action script.
"value": "A String", # The value of the parameter.
},
],
"persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](https://developers.google.com/workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](https://developers.google.com/workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. Not supported by Google Chat apps.
},
"card": # Object with schema name: GoogleAppsCardV1Card # A new card is pushed to the card stack after clicking if specified.
"openDynamicLinkAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # An add-on triggers this action when the action needs to open a link. This differs from the `open_link` above in that this needs to talk to server to get the link. Thus some preparation work is required for web client to do before the open link action response comes back.
"function": "A String", # Apps Script function to invoke when the containing element is clicked/activated.
"loadIndicator": "A String", # Specifies the loading indicator that the action displays while making the call to the action.
"parameters": [ # List of action parameters.
{ # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters.
"key": "A String", # The name of the parameter for the action script.
"value": "A String", # The value of the parameter.
},
],
"persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](https://developers.google.com/workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](https://developers.google.com/workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. Not supported by Google Chat apps.
},
"openLink": { # Represents an `onClick` event that opens a hyperlink. # If specified, this `onClick` triggers an open link action.
"onClose": "A String", # Whether the client forgets about a link after opening it, or observes it until the window closes. Not supported by Chat apps.
"openAs": "A String", # How to open a link. Not supported by Chat apps.
"url": "A String", # The URL to open.
},
},
},
],
"displayStyle": "A String", # The `peekCardHeader` display style for. Not supported by Google Chat apps.
"fixedFooter": { # A persistent (sticky) footer that is added to the bottom of the card. # The fixed footer shown at the bottom of this card.
"primaryButton": { # A button. Can be a text button or an image button. # The primary button of the fixed footer. The button must be a text button with text and color set.
"altText": "A String", # The alternative text used for accessibility. Has no effect when an icon is set; use `icon.alt_text` instead.
"color": { # Represents a color in the RGBA color space. This representation is designed for simplicity of conversion to/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 carry information about the absolute color space that should be used to interpret the RGB value (e.g. sRGB, Adobe RGB, DCI-P3, BT.2020, etc.). 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(''); }; // ... # If set, the button is filled with a solid background.
"alpha": 3.14, # 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).
"blue": 3.14, # The amount of blue in the color as a value in the interval [0, 1].
"green": 3.14, # The amount of green in the color as a value in the interval [0, 1].
"red": 3.14, # The amount of red in the color as a value in the interval [0, 1].
},
"disabled": True or False, # If `true`, the button is displayed in a disabled state and doesn't respond to user actions.
"icon": { # The icon image.
"altText": "A String", # The description of the icon, used for accessibility. The default value is provided if you don't specify one.
"iconUrl": "A String", # The icon specified by a URL.
"imageType": "A String", # The crop style applied to the image. In some cases, applying a `CIRCLE` crop causes the image to be drawn larger than a standard icon.
"knownIcon": "A String", # The icon specified by the string name of a list of known icons.
},
"onClick": { # Represents the response to an `onClick` event. # The action to perform when the button is clicked.
"action": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # If specified, an action is triggered by this `onClick`.
"function": "A String", # Apps Script function to invoke when the containing element is clicked/activated.
"loadIndicator": "A String", # Specifies the loading indicator that the action displays while making the call to the action.
"parameters": [ # List of action parameters.
{ # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters.
"key": "A String", # The name of the parameter for the action script.
"value": "A String", # The value of the parameter.
},
],
"persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](https://developers.google.com/workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](https://developers.google.com/workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. Not supported by Google Chat apps.
},
"card": # Object with schema name: GoogleAppsCardV1Card # A new card is pushed to the card stack after clicking if specified.
"openDynamicLinkAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # An add-on triggers this action when the action needs to open a link. This differs from the `open_link` above in that this needs to talk to server to get the link. Thus some preparation work is required for web client to do before the open link action response comes back.
"function": "A String", # Apps Script function to invoke when the containing element is clicked/activated.
"loadIndicator": "A String", # Specifies the loading indicator that the action displays while making the call to the action.
"parameters": [ # List of action parameters.
{ # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters.
"key": "A String", # The name of the parameter for the action script.
"value": "A String", # The value of the parameter.
},
],
"persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](https://developers.google.com/workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](https://developers.google.com/workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. Not supported by Google Chat apps.
},
"openLink": { # Represents an `onClick` event that opens a hyperlink. # If specified, this `onClick` triggers an open link action.
"onClose": "A String", # Whether the client forgets about a link after opening it, or observes it until the window closes. Not supported by Chat apps.
"openAs": "A String", # How to open a link. Not supported by Chat apps.
"url": "A String", # The URL to open.
},
},
"text": "A String", # The text of the button.
},
"secondaryButton": { # A button. Can be a text button or an image button. # The secondary button of the fixed footer. The button must be a text button with text and color set. `primaryButton` must be set if `secondaryButton` is set.
"altText": "A String", # The alternative text used for accessibility. Has no effect when an icon is set; use `icon.alt_text` instead.
"color": { # Represents a color in the RGBA color space. This representation is designed for simplicity of conversion to/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 carry information about the absolute color space that should be used to interpret the RGB value (e.g. sRGB, Adobe RGB, DCI-P3, BT.2020, etc.). 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(''); }; // ... # If set, the button is filled with a solid background.
"alpha": 3.14, # 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).
"blue": 3.14, # The amount of blue in the color as a value in the interval [0, 1].
"green": 3.14, # The amount of green in the color as a value in the interval [0, 1].
"red": 3.14, # The amount of red in the color as a value in the interval [0, 1].
},
"disabled": True or False, # If `true`, the button is displayed in a disabled state and doesn't respond to user actions.
"icon": { # The icon image.
"altText": "A String", # The description of the icon, used for accessibility. The default value is provided if you don't specify one.
"iconUrl": "A String", # The icon specified by a URL.
"imageType": "A String", # The crop style applied to the image. In some cases, applying a `CIRCLE` crop causes the image to be drawn larger than a standard icon.
"knownIcon": "A String", # The icon specified by the string name of a list of known icons.
},
"onClick": { # Represents the response to an `onClick` event. # The action to perform when the button is clicked.
"action": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # If specified, an action is triggered by this `onClick`.
"function": "A String", # Apps Script function to invoke when the containing element is clicked/activated.
"loadIndicator": "A String", # Specifies the loading indicator that the action displays while making the call to the action.
"parameters": [ # List of action parameters.
{ # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters.
"key": "A String", # The name of the parameter for the action script.
"value": "A String", # The value of the parameter.
},
],
"persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](https://developers.google.com/workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](https://developers.google.com/workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. Not supported by Google Chat apps.
},
"card": # Object with schema name: GoogleAppsCardV1Card # A new card is pushed to the card stack after clicking if specified.
"openDynamicLinkAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # An add-on triggers this action when the action needs to open a link. This differs from the `open_link` above in that this needs to talk to server to get the link. Thus some preparation work is required for web client to do before the open link action response comes back.
"function": "A String", # Apps Script function to invoke when the containing element is clicked/activated.
"loadIndicator": "A String", # Specifies the loading indicator that the action displays while making the call to the action.
"parameters": [ # List of action parameters.
{ # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters.
"key": "A String", # The name of the parameter for the action script.
"value": "A String", # The value of the parameter.
},
],
"persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](https://developers.google.com/workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](https://developers.google.com/workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. Not supported by Google Chat apps.
},
"openLink": { # Represents an `onClick` event that opens a hyperlink. # If specified, this `onClick` triggers an open link action.
"onClose": "A String", # Whether the client forgets about a link after opening it, or observes it until the window closes. Not supported by Chat apps.
"openAs": "A String", # How to open a link. Not supported by Chat apps.
"url": "A String", # The URL to open.
},
},
"text": "A String", # The text of the button.
},
},
"header": { # Represents a card header. # The header of the card. A header usually contains a title and an image.
"imageAltText": "A String", # The alternative text of this image which is used for accessibility.
"imageType": "A String", # The image's type.
"imageUrl": "A String", # The URL of the image in the card header.
"subtitle": "A String", # The subtitle of the card header.
"title": "A String", # 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.
},
"name": "A String", # Name of the card. Used as a card identifier in card navigation.
"peekCardHeader": { # Represents a card header. # 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 Google Chat apps.
"imageAltText": "A String", # The alternative text of this image which is used for accessibility.
"imageType": "A String", # The image's type.
"imageUrl": "A String", # The URL of the image in the card header.
"subtitle": "A String", # The subtitle of the card header.
"title": "A String", # 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.
},
"sections": [ # Sections are separated by a line divider.
{ # 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 is currently no need for layout properties, for example, float.
"collapsible": True or False, # Indicates whether this section is collapsible. If a section is collapsible, the description must be given.
"header": "A String", # The header of the section. Formatted text is supported.
"uncollapsibleWidgetsCount": 42, # The number of uncollapsible widgets. 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 as default. The `uncollapsibleWidgetsCount` is taken into account only when `collapsible` is `true`.
"widgets": [ # A section must contain at least 1 widget.
{ # A widget is a UI element that presents texts, images, etc.
"buttonList": { # A list of buttons layed out horizontally. # A list of buttons. For example, the following JSON creates two buttons. The first is a filled text button and the second is an image button that opens a link: ``` "buttonList": { "buttons": [ "button": { "text": "Edit", "Color": { "Red": 255 "Green": 255 "Blue": 255 } "disabled": true }, "button": { "icon": { "knownIcon": "INVITE" "altText": "check calendar" }, "onClick": { "openLink": { "url": "https://example.com/calendar" } } }, ] } ```
"buttons": [ # An array of buttons.
{ # A button. Can be a text button or an image button.
"altText": "A String", # The alternative text used for accessibility. Has no effect when an icon is set; use `icon.alt_text` instead.
"color": { # Represents a color in the RGBA color space. This representation is designed for simplicity of conversion to/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 carry information about the absolute color space that should be used to interpret the RGB value (e.g. sRGB, Adobe RGB, DCI-P3, BT.2020, etc.). 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(''); }; // ... # If set, the button is filled with a solid background.
"alpha": 3.14, # 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).
"blue": 3.14, # The amount of blue in the color as a value in the interval [0, 1].
"green": 3.14, # The amount of green in the color as a value in the interval [0, 1].
"red": 3.14, # The amount of red in the color as a value in the interval [0, 1].
},
"disabled": True or False, # If `true`, the button is displayed in a disabled state and doesn't respond to user actions.
"icon": { # The icon image.
"altText": "A String", # The description of the icon, used for accessibility. The default value is provided if you don't specify one.
"iconUrl": "A String", # The icon specified by a URL.
"imageType": "A String", # The crop style applied to the image. In some cases, applying a `CIRCLE` crop causes the image to be drawn larger than a standard icon.
"knownIcon": "A String", # The icon specified by the string name of a list of known icons.
},
"onClick": { # Represents the response to an `onClick` event. # The action to perform when the button is clicked.
"action": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # If specified, an action is triggered by this `onClick`.
"function": "A String", # Apps Script function to invoke when the containing element is clicked/activated.
"loadIndicator": "A String", # Specifies the loading indicator that the action displays while making the call to the action.
"parameters": [ # List of action parameters.
{ # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters.
"key": "A String", # The name of the parameter for the action script.
"value": "A String", # The value of the parameter.
},
],
"persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](https://developers.google.com/workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](https://developers.google.com/workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. Not supported by Google Chat apps.
},
"card": # Object with schema name: GoogleAppsCardV1Card # A new card is pushed to the card stack after clicking if specified.
"openDynamicLinkAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # An add-on triggers this action when the action needs to open a link. This differs from the `open_link` above in that this needs to talk to server to get the link. Thus some preparation work is required for web client to do before the open link action response comes back.
"function": "A String", # Apps Script function to invoke when the containing element is clicked/activated.
"loadIndicator": "A String", # Specifies the loading indicator that the action displays while making the call to the action.
"parameters": [ # List of action parameters.
{ # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters.
"key": "A String", # The name of the parameter for the action script.
"value": "A String", # The value of the parameter.
},
],
"persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](https://developers.google.com/workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](https://developers.google.com/workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. Not supported by Google Chat apps.
},
"openLink": { # Represents an `onClick` event that opens a hyperlink. # If specified, this `onClick` triggers an open link action.
"onClose": "A String", # Whether the client forgets about a link after opening it, or observes it until the window closes. Not supported by Chat apps.
"openAs": "A String", # How to open a link. Not supported by Chat apps.
"url": "A String", # The URL to open.
},
},
"text": "A String", # The text of the button.
},
],
},
"dateTimePicker": { # The widget that lets users to specify a date and time. Not supported by Google Chat apps. # Displays a selection/input widget for date/time. For example, the following JSON creates a date/time picker for an appointment time: ``` "date_time_picker": { "name": "appointment_time", "label": "Book your appointment at:", "type": "DateTimePickerType.DATE_AND_TIME", "valueMsEpoch": "796435200000" } ```
"label": "A String", # The label for the field that displays to the user.
"name": "A String", # The name of the text input that's used in `formInput`, and uniquely identifies this input.
"onChangeAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # Triggered when the user clicks Save or Clear from the date/time picker dialog. This is only triggered if the value changed as a result of the Save/Clear operation.
"function": "A String", # Apps Script function to invoke when the containing element is clicked/activated.
"loadIndicator": "A String", # Specifies the loading indicator that the action displays while making the call to the action.
"parameters": [ # List of action parameters.
{ # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters.
"key": "A String", # The name of the parameter for the action script.
"value": "A String", # The value of the parameter.
},
],
"persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](https://developers.google.com/workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](https://developers.google.com/workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. Not supported by Google Chat apps.
},
"timezoneOffsetDate": 42, # 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 not set, it uses the user's time zone setting on the client side.
"type": "A String", # The type of the date/time picker.
"valueMsEpoch": "A String", # The value to display as the default value before user input or previous user input. It is represented in milliseconds (Epoch time). For `DATE_AND_TIME` type, the full epoch value is used. For `DATE_ONLY` type, only date of the epoch time is used. For `TIME_ONLY` type, only time of the epoch time is used. For example, you can set epoch time to `3 * 60 * 60 * 1000` to represent 3am.
},
"decoratedText": { # 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. # Displays a decorated text item in this widget. For example, the following JSON creates a decorated text widget showing email address: ``` "decoratedText": { "icon": { "knownIcon": "EMAIL" }, "topLabel": "Email Address", "content": "sasha@example.com", "bottomLabel": "This is a new Email address!", "switchWidget": { "name": "has_send_welcome_email_to_sasha", "selected": false, "controlType": "ControlType.CHECKBOX" } } ```
"bottomLabel": "A String", # The formatted text label that shows below the main text.
"button": { # A button. Can be a text button or an image button. # A button that can be clicked to trigger an action.
"altText": "A String", # The alternative text used for accessibility. Has no effect when an icon is set; use `icon.alt_text` instead.
"color": { # Represents a color in the RGBA color space. This representation is designed for simplicity of conversion to/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 carry information about the absolute color space that should be used to interpret the RGB value (e.g. sRGB, Adobe RGB, DCI-P3, BT.2020, etc.). 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(''); }; // ... # If set, the button is filled with a solid background.
"alpha": 3.14, # 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).
"blue": 3.14, # The amount of blue in the color as a value in the interval [0, 1].
"green": 3.14, # The amount of green in the color as a value in the interval [0, 1].
"red": 3.14, # The amount of red in the color as a value in the interval [0, 1].
},
"disabled": True or False, # If `true`, the button is displayed in a disabled state and doesn't respond to user actions.
"icon": { # The icon image.
"altText": "A String", # The description of the icon, used for accessibility. The default value is provided if you don't specify one.
"iconUrl": "A String", # The icon specified by a URL.
"imageType": "A String", # The crop style applied to the image. In some cases, applying a `CIRCLE` crop causes the image to be drawn larger than a standard icon.
"knownIcon": "A String", # The icon specified by the string name of a list of known icons.
},
"onClick": { # Represents the response to an `onClick` event. # The action to perform when the button is clicked.
"action": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # If specified, an action is triggered by this `onClick`.
"function": "A String", # Apps Script function to invoke when the containing element is clicked/activated.
"loadIndicator": "A String", # Specifies the loading indicator that the action displays while making the call to the action.
"parameters": [ # List of action parameters.
{ # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters.
"key": "A String", # The name of the parameter for the action script.
"value": "A String", # The value of the parameter.
},
],
"persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](https://developers.google.com/workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](https://developers.google.com/workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. Not supported by Google Chat apps.
},
"card": # Object with schema name: GoogleAppsCardV1Card # A new card is pushed to the card stack after clicking if specified.
"openDynamicLinkAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # An add-on triggers this action when the action needs to open a link. This differs from the `open_link` above in that this needs to talk to server to get the link. Thus some preparation work is required for web client to do before the open link action response comes back.
"function": "A String", # Apps Script function to invoke when the containing element is clicked/activated.
"loadIndicator": "A String", # Specifies the loading indicator that the action displays while making the call to the action.
"parameters": [ # List of action parameters.
{ # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters.
"key": "A String", # The name of the parameter for the action script.
"value": "A String", # The value of the parameter.
},
],
"persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](https://developers.google.com/workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](https://developers.google.com/workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. Not supported by Google Chat apps.
},
"openLink": { # Represents an `onClick` event that opens a hyperlink. # If specified, this `onClick` triggers an open link action.
"onClose": "A String", # Whether the client forgets about a link after opening it, or observes it until the window closes. Not supported by Chat apps.
"openAs": "A String", # How to open a link. Not supported by Chat apps.
"url": "A String", # The URL to open.
},
},
"text": "A String", # The text of the button.
},
"endIcon": { # An icon displayed after the text.
"altText": "A String", # The description of the icon, used for accessibility. The default value is provided if you don't specify one.
"iconUrl": "A String", # The icon specified by a URL.
"imageType": "A String", # The crop style applied to the image. In some cases, applying a `CIRCLE` crop causes the image to be drawn larger than a standard icon.
"knownIcon": "A String", # The icon specified by the string name of a list of known icons.
},
"icon": { # Deprecated in favor of start_icon.
"altText": "A String", # The description of the icon, used for accessibility. The default value is provided if you don't specify one.
"iconUrl": "A String", # The icon specified by a URL.
"imageType": "A String", # The crop style applied to the image. In some cases, applying a `CIRCLE` crop causes the image to be drawn larger than a standard icon.
"knownIcon": "A String", # The icon specified by the string name of a list of known icons.
},
"onClick": { # Represents the response to an `onClick` event. # Only the top and bottom label and content region are clickable.
"action": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # If specified, an action is triggered by this `onClick`.
"function": "A String", # Apps Script function to invoke when the containing element is clicked/activated.
"loadIndicator": "A String", # Specifies the loading indicator that the action displays while making the call to the action.
"parameters": [ # List of action parameters.
{ # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters.
"key": "A String", # The name of the parameter for the action script.
"value": "A String", # The value of the parameter.
},
],
"persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](https://developers.google.com/workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](https://developers.google.com/workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. Not supported by Google Chat apps.
},
"card": # Object with schema name: GoogleAppsCardV1Card # A new card is pushed to the card stack after clicking if specified.
"openDynamicLinkAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # An add-on triggers this action when the action needs to open a link. This differs from the `open_link` above in that this needs to talk to server to get the link. Thus some preparation work is required for web client to do before the open link action response comes back.
"function": "A String", # Apps Script function to invoke when the containing element is clicked/activated.
"loadIndicator": "A String", # Specifies the loading indicator that the action displays while making the call to the action.
"parameters": [ # List of action parameters.
{ # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters.
"key": "A String", # The name of the parameter for the action script.
"value": "A String", # The value of the parameter.
},
],
"persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](https://developers.google.com/workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](https://developers.google.com/workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. Not supported by Google Chat apps.
},
"openLink": { # Represents an `onClick` event that opens a hyperlink. # If specified, this `onClick` triggers an open link action.
"onClose": "A String", # Whether the client forgets about a link after opening it, or observes it until the window closes. Not supported by Chat apps.
"openAs": "A String", # How to open a link. Not supported by Chat apps.
"url": "A String", # The URL to open.
},
},
"startIcon": { # The icon displayed in front of the text.
"altText": "A String", # The description of the icon, used for accessibility. The default value is provided if you don't specify one.
"iconUrl": "A String", # The icon specified by a URL.
"imageType": "A String", # The crop style applied to the image. In some cases, applying a `CIRCLE` crop causes the image to be drawn larger than a standard icon.
"knownIcon": "A String", # The icon specified by the string name of a list of known icons.
},
"switchControl": { # Either a toggle-style switch or a checkbox. # A switch widget can be clicked to change its state or trigger an action.
"controlType": "A String", # The control type, either switch or checkbox.
"name": "A String", # The name of the switch widget that's used in `formInput`.
"onChangeAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # The action when the switch state is changed.
"function": "A String", # Apps Script function to invoke when the containing element is clicked/activated.
"loadIndicator": "A String", # Specifies the loading indicator that the action displays while making the call to the action.
"parameters": [ # List of action parameters.
{ # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters.
"key": "A String", # The name of the parameter for the action script.
"value": "A String", # The value of the parameter.
},
],
"persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](https://developers.google.com/workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](https://developers.google.com/workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. Not supported by Google Chat apps.
},
"selected": True or False, # If the switch is selected.
"value": "A String", # The value is what is passed back in the callback.
},
"text": "A String", # Required. The main widget formatted text. See Text formatting for details.
"topLabel": "A String", # The formatted text label that shows above the main text.
"wrapText": True or False, # The wrap text setting. If `true`, the text is wrapped and displayed in multiline. Otherwise, the text is truncated.
},
"divider": { # A divider that appears in between widgets. # Displays a divider. For example, the following JSON creates a divider: ``` "divider": { } ```
},
"grid": { # Represents a Grid widget that displays items in a configurable grid layout. # Displays a grid with a collection of items. For example, the following JSON creates a 2 column grid with a single item: ``` "grid": { "title": "A fine collection of items", "numColumns": 2, "borderStyle": { "type": "STROKE", "cornerRadius": 4.0 }, "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" } } } ```
"borderStyle": { # Represents the complete border style applied to widgets. # The border style to apply to each grid item.
"cornerRadius": 42, # The corner radius for the border.
"strokeColor": { # Represents a color in the RGBA color space. This representation is designed for simplicity of conversion to/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 carry information about the absolute color space that should be used to interpret the RGB value (e.g. sRGB, Adobe RGB, DCI-P3, BT.2020, etc.). 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(''); }; // ... # The colors to use when the type is `BORDER_TYPE_STROKE`.
"alpha": 3.14, # 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).
"blue": 3.14, # The amount of blue in the color as a value in the interval [0, 1].
"green": 3.14, # The amount of green in the color as a value in the interval [0, 1].
"red": 3.14, # The amount of red in the color as a value in the interval [0, 1].
},
"type": "A String", # The border type.
},
"columnCount": 42, # 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).
"items": [ # The items to display in the grid.
{ # Represents a single item in the grid layout.
"id": "A String", # A user-specified identifier for this grid item. This identifier is returned in the parent Grid's onClick callback parameters.
"image": { # Represents an image. # The image that displays in the grid item.
"altText": "A String", # The accessibility label for the image.
"borderStyle": { # Represents the complete border style applied to widgets. # The border style to apply to the image.
"cornerRadius": 42, # The corner radius for the border.
"strokeColor": { # Represents a color in the RGBA color space. This representation is designed for simplicity of conversion to/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 carry information about the absolute color space that should be used to interpret the RGB value (e.g. sRGB, Adobe RGB, DCI-P3, BT.2020, etc.). 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(''); }; // ... # The colors to use when the type is `BORDER_TYPE_STROKE`.
"alpha": 3.14, # 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).
"blue": 3.14, # The amount of blue in the color as a value in the interval [0, 1].
"green": 3.14, # The amount of green in the color as a value in the interval [0, 1].
"red": 3.14, # The amount of red in the color as a value in the interval [0, 1].
},
"type": "A String", # The border type.
},
"cropStyle": { # Represents the crop style applied to an image. # The crop style to apply to the image.
"aspectRatio": 3.14, # The aspect ratio to use if the crop type is `RECTANGLE_CUSTOM`.
"type": "A String", # The crop type.
},
"imageUri": "A String", # The image URL.
},
"layout": "A String", # The layout to use for the grid item.
"subtitle": "A String", # The grid item's subtitle.
"textAlignment": "A String", # The horizontal alignment of the grid item's text.
"title": "A String", # The grid item's title.
},
],
"onClick": { # Represents the response to an `onClick` event. # This callback is reused by each individual grid item, but with the item's identifier and index in the items list added to the callback's parameters.
"action": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # If specified, an action is triggered by this `onClick`.
"function": "A String", # Apps Script function to invoke when the containing element is clicked/activated.
"loadIndicator": "A String", # Specifies the loading indicator that the action displays while making the call to the action.
"parameters": [ # List of action parameters.
{ # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters.
"key": "A String", # The name of the parameter for the action script.
"value": "A String", # The value of the parameter.
},
],
"persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](https://developers.google.com/workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](https://developers.google.com/workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. Not supported by Google Chat apps.
},
"card": # Object with schema name: GoogleAppsCardV1Card # A new card is pushed to the card stack after clicking if specified.
"openDynamicLinkAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # An add-on triggers this action when the action needs to open a link. This differs from the `open_link` above in that this needs to talk to server to get the link. Thus some preparation work is required for web client to do before the open link action response comes back.
"function": "A String", # Apps Script function to invoke when the containing element is clicked/activated.
"loadIndicator": "A String", # Specifies the loading indicator that the action displays while making the call to the action.
"parameters": [ # List of action parameters.
{ # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters.
"key": "A String", # The name of the parameter for the action script.
"value": "A String", # The value of the parameter.
},
],
"persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](https://developers.google.com/workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](https://developers.google.com/workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. Not supported by Google Chat apps.
},
"openLink": { # Represents an `onClick` event that opens a hyperlink. # If specified, this `onClick` triggers an open link action.
"onClose": "A String", # Whether the client forgets about a link after opening it, or observes it until the window closes. Not supported by Chat apps.
"openAs": "A String", # How to open a link. Not supported by Chat apps.
"url": "A String", # The URL to open.
},
},
"title": "A String", # The text that displays in the grid header.
},
"horizontalAlignment": "A String", # The horizontal alignment of this widget.
"image": { # An image that is specified by a URL and can have an `onClick` action. # Displays an image in this widget. For example, the following JSON creates an image with alternative text: ``` "image": { "imageUrl": "https://example.com/sasha.png" "altText": "Avatar for Sasha" } ```
"altText": "A String", # The alternative text of this image, used for accessibility.
"imageUrl": "A String", # An image URL.
"onClick": { # Represents the response to an `onClick` event. # The action triggered by an `onClick` event.
"action": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # If specified, an action is triggered by this `onClick`.
"function": "A String", # Apps Script function to invoke when the containing element is clicked/activated.
"loadIndicator": "A String", # Specifies the loading indicator that the action displays while making the call to the action.
"parameters": [ # List of action parameters.
{ # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters.
"key": "A String", # The name of the parameter for the action script.
"value": "A String", # The value of the parameter.
},
],
"persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](https://developers.google.com/workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](https://developers.google.com/workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. Not supported by Google Chat apps.
},
"card": # Object with schema name: GoogleAppsCardV1Card # A new card is pushed to the card stack after clicking if specified.
"openDynamicLinkAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # An add-on triggers this action when the action needs to open a link. This differs from the `open_link` above in that this needs to talk to server to get the link. Thus some preparation work is required for web client to do before the open link action response comes back.
"function": "A String", # Apps Script function to invoke when the containing element is clicked/activated.
"loadIndicator": "A String", # Specifies the loading indicator that the action displays while making the call to the action.
"parameters": [ # List of action parameters.
{ # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters.
"key": "A String", # The name of the parameter for the action script.
"value": "A String", # The value of the parameter.
},
],
"persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](https://developers.google.com/workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](https://developers.google.com/workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. Not supported by Google Chat apps.
},
"openLink": { # Represents an `onClick` event that opens a hyperlink. # If specified, this `onClick` triggers an open link action.
"onClose": "A String", # Whether the client forgets about a link after opening it, or observes it until the window closes. Not supported by Chat apps.
"openAs": "A String", # How to open a link. Not supported by Chat apps.
"url": "A String", # The URL to open.
},
},
},
"selectionInput": { # A widget that creates a UI item with options for users to select. For example, a dropdown menu. # Displays a switch control in this widget. For example, the following JSON creates a dropdown selection for size: ``` "switchControl": { "name": "size", "label": "Size" "type": "SelectionType.DROPDOWN", "items": [ { "text": "S", "value": "small", "selected": false }, { "text": "M", "value": "medium", "selected": true }, { "text": "L", "value": "large", "selected": false }, { "text": "XL", "value": "extra_large", "selected": false } ] } ```
"items": [ # An array of the selected items.
{ # A selectable item in the switch control.
"selected": True or False, # If more than one item is selected for `RADIO_BUTTON` and `DROPDOWN`, the first selected item is treated as selected and the ones after are ignored.
"text": "A String", # The text to be displayed.
"value": "A String", # The value associated with this item. The client should use this as a form input value.
},
],
"label": "A String", # The label displayed ahead of the switch control.
"name": "A String", # The name of the text input which is used in `formInput`.
"onChangeAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # If specified, the form is submitted when the selection changes. If not specified, you must specify a separate button.
"function": "A String", # Apps Script function to invoke when the containing element is clicked/activated.
"loadIndicator": "A String", # Specifies the loading indicator that the action displays while making the call to the action.
"parameters": [ # List of action parameters.
{ # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters.
"key": "A String", # The name of the parameter for the action script.
"value": "A String", # The value of the parameter.
},
],
"persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](https://developers.google.com/workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](https://developers.google.com/workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. Not supported by Google Chat apps.
},
"type": "A String", # The type of the selection.
},
"textInput": { # A text input is a UI item where users can input text. A text input can also have an onChange action and suggestions. # Displays a text input in this widget. For example, the following JSON creates a text input for mail address: ``` "textInput": { "name": "mailing_address", "label": "Mailing Address" } ``` As another example, the following JSON creates a text input for programming language with static suggestions: ``` "textInput": { "name": "preferred_programing_language", "label": "Preferred Language", "initialSuggestions": { "items": [ { "text": "C++" }, { "text": "Java" }, { "text": "JavaScript" }, { "text": "Python" } ] } } ```
"autoCompleteAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # The refresh function that returns suggestions based on the user's input text. If the callback is not specified, autocomplete is done in client side based on the initial suggestion items.
"function": "A String", # Apps Script function to invoke when the containing element is clicked/activated.
"loadIndicator": "A String", # Specifies the loading indicator that the action displays while making the call to the action.
"parameters": [ # List of action parameters.
{ # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters.
"key": "A String", # The name of the parameter for the action script.
"value": "A String", # The value of the parameter.
},
],
"persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](https://developers.google.com/workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](https://developers.google.com/workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. Not supported by Google Chat apps.
},
"hintText": "A String", # The hint text.
"initialSuggestions": { # A container wrapping elements necessary for showing suggestion items used in text input autocomplete. # The initial suggestions made before any user input.
"items": [ # A list of suggestions used for autocomplete recommendations.
{ # A suggestion item.
"text": "A String", # The suggested autocomplete result.
},
],
},
"label": "A String", # At least one of label and hintText must be specified.
"name": "A String", # The name of the text input which is used in `formInput`.
"onChangeAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # The onChange action, for example, invoke a function.
"function": "A String", # Apps Script function to invoke when the containing element is clicked/activated.
"loadIndicator": "A String", # Specifies the loading indicator that the action displays while making the call to the action.
"parameters": [ # List of action parameters.
{ # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters.
"key": "A String", # The name of the parameter for the action script.
"value": "A String", # The value of the parameter.
},
],
"persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](https://developers.google.com/workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](https://developers.google.com/workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. Not supported by Google Chat apps.
},
"type": "A String", # The style of the text, for example, a single line or multiple lines.
"value": "A String", # The default value when there is no input from the user.
},
"textParagraph": { # A paragraph of text that supports formatting. See [Text formatting](https://developers.google.com/workspace/add-ons/concepts/widgets#text_formatting) for details. # Displays a text paragraph in this widget. For example, the following JSON creates a bolded text: ``` "textParagraph": { "text": " *bold text*" } ```
"text": "A String", # The text that's shown in the widget.
},
},
],
},
],
},
},
},
"type": "A String", # Input only. The type of Chat app response.
"url": "A String", # Input only. URL for users to auth or config. (Only for REQUEST_CONFIG response types.)
},
"annotations": [ # Output only. Annotations associated with the text in this message.
{ # Annotations associated with the plain-text body of the message. 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/107946847022116401880", "displayName":"FooBot", "avatarUrl":"https://goo.gl/aeDtrS", "type":"BOT" }, "type":"MENTION" } }] ```
"length": 42, # Length of the substring in the plain-text message body this annotation corresponds to.
"slashCommand": { # Annotation metadata for slash commands (/). # The metadata for a slash command.
"bot": { # A user in Google Chat. # The Chat app whose command was invoked.
"displayName": "A String", # Output only. The user's display name.
"domainId": "A String", # Unique identifier of the user's Google Workspace domain.
"isAnonymous": True or False, # Output only. When `true`, the user is deleted or their profile is not visible.
"name": "A String", # Resource name for a Google Chat user. For human users, represents a person in the People API or a user in the Admin SDK Directory API. Format: `users/{user}`
"type": "A String", # User type.
},
"commandId": "A String", # The command id of the invoked slash command.
"commandName": "A String", # The name of the invoked slash command.
"triggersDialog": True or False, # Indicating whether the slash command is for a dialog.
"type": "A String", # The type of slash command.
},
"startIndex": 42, # Start index (0-based, inclusive) in the plain-text message body this annotation corresponds to.
"type": "A String", # The type of this annotation.
"userMention": { # Annotation metadata for user mentions (@). # The metadata of user mention.
"type": "A String", # The type of user mention.
"user": { # A user in Google Chat. # The user mentioned.
"displayName": "A String", # Output only. The user's display name.
"domainId": "A String", # Unique identifier of the user's Google Workspace domain.
"isAnonymous": True or False, # Output only. When `true`, the user is deleted or their profile is not visible.
"name": "A String", # Resource name for a Google Chat user. For human users, represents a person in the People API or a user in the Admin SDK Directory API. Format: `users/{user}`
"type": "A String", # User type.
},
},
},
],
"argumentText": "A String", # Plain-text body of the message with all Chat app mentions stripped out.
"attachment": [ # User uploaded attachment.
{ # An attachment in Google Chat.
"attachmentDataRef": { # A reference to the data of an attachment. # A reference to the attachment data. This is used with the media API to download the attachment data.
"resourceName": "A String", # The resource name of the attachment data. This is used with the media API to download the attachment data.
},
"contentName": "A String", # The original file name for the content, not the full path.
"contentType": "A String", # The content type (MIME type) of the file.
"downloadUri": "A String", # Output only. The download URL which should be used to allow a human user to download the attachment. Chat apps should not use this URL to download attachment content.
"driveDataRef": { # A reference to the data of a drive attachment. # A reference to the drive attachment. This is used with the Drive API.
"driveFileId": "A String", # The id for the drive file, for use with the Drive API.
},
"name": "A String", # Resource name of the attachment, in the form "spaces/*/messages/*/attachments/*".
"source": "A String", # The source of the attachment.
"thumbnailUri": "A String", # Output only. The thumbnail URL which should be used to preview the attachment to a human user. Chat apps should not use this URL to download attachment content.
},
],
"cards": [ # Deprecated: Use `cards_v2` instead. Rich, formatted and interactive cards that can be used to display UI elements such as: formatted texts, buttons, clickable images. Cards are normally displayed below the plain-text body of the message.
{ # A card is a UI element that can contain UI widgets such as texts, images.
"cardActions": [ # The actions of this card.
{ # 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.
"actionLabel": "A String", # The label used to be displayed in the action menu item.
"onClick": { # An onclick action (e.g. open a link). # The onclick action for this action item.
"action": { # A form action describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # A form action will be triggered by this onclick if specified.
"actionMethodName": "A String", # 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. The same method name can be used for several elements that trigger a common behavior if desired.
"parameters": [ # List of action parameters.
{ # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters.
"key": "A String", # The name of the parameter for the action script.
"value": "A String", # The value of the parameter.
},
],
},
"openLink": { # A link that opens a new window. # This onclick triggers an open link action if specified.
"url": "A String", # The URL to open.
},
},
},
],
"header": { # The header of the card. A header usually contains a title and an image.
"imageStyle": "A String", # The image's type (e.g. square border or circular border).
"imageUrl": "A String", # The URL of the image in the card header.
"subtitle": "A String", # The subtitle of the card header.
"title": "A String", # The title must be specified. The header has a fixed height: if both a title and subtitle is specified, each will take up 1 line. If only the title is specified, it will take up both lines.
},
"name": "A String", # Name of the card.
"sections": [ # Sections are separated by a line divider.
{ # 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 is currently no need for layout properties (e.g. float).
"header": "A String", # The header of the section, text formatted supported.
"widgets": [ # A section must contain at least 1 widget.
{ # A widget is a UI element that presents texts, images, etc.
"buttons": [ # A list of buttons. Buttons is also oneof data and only one of these fields should be set.
{ # A button. Can be a text button or an image button.
"imageButton": { # An image button with an onclick action. # A button with image and onclick action.
"icon": "A String", # The icon specified by an enum that indices to an icon provided by Chat API.
"iconUrl": "A String", # The icon specified by a URL.
"name": "A String", # The name of this image_button which will be used for accessibility. Default value will be provided if developers don't specify.
"onClick": { # An onclick action (e.g. open a link). # The onclick action.
"action": { # A form action describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # A form action will be triggered by this onclick if specified.
"actionMethodName": "A String", # 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. The same method name can be used for several elements that trigger a common behavior if desired.
"parameters": [ # List of action parameters.
{ # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters.
"key": "A String", # The name of the parameter for the action script.
"value": "A String", # The value of the parameter.
},
],
},
"openLink": { # A link that opens a new window. # This onclick triggers an open link action if specified.
"url": "A String", # The URL to open.
},
},
},
"textButton": { # A button with text and onclick action. # A button with text and onclick action.
"onClick": { # An onclick action (e.g. open a link). # The onclick action of the button.
"action": { # A form action describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # A form action will be triggered by this onclick if specified.
"actionMethodName": "A String", # 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. The same method name can be used for several elements that trigger a common behavior if desired.
"parameters": [ # List of action parameters.
{ # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters.
"key": "A String", # The name of the parameter for the action script.
"value": "A String", # The value of the parameter.
},
],
},
"openLink": { # A link that opens a new window. # This onclick triggers an open link action if specified.
"url": "A String", # The URL to open.
},
},
"text": "A String", # The text of the button.
},
},
],
"image": { # An image that is specified by a URL and can have an onclick action. # Display an image in this widget.
"aspectRatio": 3.14, # The aspect ratio of this image (width/height). This field allows clients to reserve the right height for the image while waiting for it to load. It's not meant to override the native aspect ratio of the image. If unset, the server fills it by prefetching the image.
"imageUrl": "A String", # The URL of the image.
"onClick": { # An onclick action (e.g. open a link). # The onclick action.
"action": { # A form action describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # A form action will be triggered by this onclick if specified.
"actionMethodName": "A String", # 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. The same method name can be used for several elements that trigger a common behavior if desired.
"parameters": [ # List of action parameters.
{ # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters.
"key": "A String", # The name of the parameter for the action script.
"value": "A String", # The value of the parameter.
},
],
},
"openLink": { # A link that opens a new window. # This onclick triggers an open link action if specified.
"url": "A String", # The URL to open.
},
},
},
"keyValue": { # A UI element contains a key (label) and a value (content). And this element may also contain some actions such as onclick button. # Display a key value item in this widget.
"bottomLabel": "A String", # The text of the bottom label. Formatted text supported.
"button": { # A button. Can be a text button or an image button. # A button that can be clicked to trigger an action.
"imageButton": { # An image button with an onclick action. # A button with image and onclick action.
"icon": "A String", # The icon specified by an enum that indices to an icon provided by Chat API.
"iconUrl": "A String", # The icon specified by a URL.
"name": "A String", # The name of this image_button which will be used for accessibility. Default value will be provided if developers don't specify.
"onClick": { # An onclick action (e.g. open a link). # The onclick action.
"action": { # A form action describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # A form action will be triggered by this onclick if specified.
"actionMethodName": "A String", # 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. The same method name can be used for several elements that trigger a common behavior if desired.
"parameters": [ # List of action parameters.
{ # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters.
"key": "A String", # The name of the parameter for the action script.
"value": "A String", # The value of the parameter.
},
],
},
"openLink": { # A link that opens a new window. # This onclick triggers an open link action if specified.
"url": "A String", # The URL to open.
},
},
},
"textButton": { # A button with text and onclick action. # A button with text and onclick action.
"onClick": { # An onclick action (e.g. open a link). # The onclick action of the button.
"action": { # A form action describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # A form action will be triggered by this onclick if specified.
"actionMethodName": "A String", # 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. The same method name can be used for several elements that trigger a common behavior if desired.
"parameters": [ # List of action parameters.
{ # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters.
"key": "A String", # The name of the parameter for the action script.
"value": "A String", # The value of the parameter.
},
],
},
"openLink": { # A link that opens a new window. # This onclick triggers an open link action if specified.
"url": "A String", # The URL to open.
},
},
"text": "A String", # The text of the button.
},
},
"content": "A String", # The text of the content. Formatted text supported and always required.
"contentMultiline": True or False, # If the content should be multiline.
"icon": "A String", # An enum value that will be replaced by the Chat API with the corresponding icon image.
"iconUrl": "A String", # The icon specified by a URL.
"onClick": { # An onclick action (e.g. open a link). # The onclick action. Only the top label, bottom label and content region are clickable.
"action": { # A form action describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # A form action will be triggered by this onclick if specified.
"actionMethodName": "A String", # 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. The same method name can be used for several elements that trigger a common behavior if desired.
"parameters": [ # List of action parameters.
{ # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters.
"key": "A String", # The name of the parameter for the action script.
"value": "A String", # The value of the parameter.
},
],
},
"openLink": { # A link that opens a new window. # This onclick triggers an open link action if specified.
"url": "A String", # The URL to open.
},
},
"topLabel": "A String", # The text of the top label. Formatted text supported.
},
"textParagraph": { # A paragraph of text. Formatted text supported. # Display a text paragraph in this widget.
"text": "A String",
},
},
],
},
],
},
],
"cardsV2": [ # Richly formatted and interactive cards that display UI elements and editable widgets, such as: - Formatted text - Buttons - Clickable images - Checkboxes - Radio buttons - Input widgets. Cards are usually displayed below the text-body of a Chat message, but can situationally appear other places, such as [dialogs](https://developers.google.com/chat/how-tos/dialogs). The `cardId` is a unique identifier among cards in the same message and for identifying user input values. Currently supported widgets include: - `TextParagraph` - `DecoratedText` - `Image` - `ButtonList` - `Divider`
{ # Widgets for Chat apps to specify.
"card": { # 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. In Google Chat, cards appear in several places: - As stand-alone messages. - Accompanying a text message, just beneath the text message. - As a [dialog](https://developers.google.com/chat/how-tos/dialogs). The following example JSON creates a "contact card" that features: - A header with the contact's name, job title, avatar picture. - A section with the contact information, including formatted text. - Buttons that users can click to share the contact or see more or less info. ![Example contact card](/chat/images/card_api_reference.png) ``` { "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", } ], } } }, ], } }, ], }, ], }, } ], } ``` # Card proto that allows Chat apps to specify UI elements and editable widgets.
"cardActions": [ # The card's actions. Actions are added to the card's generated toolbar menu. Not supported by Google 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" } } } ] ```
{ # 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 Google Chat apps.
"actionLabel": "A String", # The label that displays as the action menu item.
"onClick": { # Represents the response to an `onClick` event. # The `onClick` action for this action item.
"action": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # If specified, an action is triggered by this `onClick`.
"function": "A String", # Apps Script function to invoke when the containing element is clicked/activated.
"loadIndicator": "A String", # Specifies the loading indicator that the action displays while making the call to the action.
"parameters": [ # List of action parameters.
{ # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters.
"key": "A String", # The name of the parameter for the action script.
"value": "A String", # The value of the parameter.
},
],
"persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](https://developers.google.com/workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](https://developers.google.com/workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. Not supported by Google Chat apps.
},
"card": # Object with schema name: GoogleAppsCardV1Card # A new card is pushed to the card stack after clicking if specified.
"openDynamicLinkAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # An add-on triggers this action when the action needs to open a link. This differs from the `open_link` above in that this needs to talk to server to get the link. Thus some preparation work is required for web client to do before the open link action response comes back.
"function": "A String", # Apps Script function to invoke when the containing element is clicked/activated.
"loadIndicator": "A String", # Specifies the loading indicator that the action displays while making the call to the action.
"parameters": [ # List of action parameters.
{ # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters.
"key": "A String", # The name of the parameter for the action script.
"value": "A String", # The value of the parameter.
},
],
"persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](https://developers.google.com/workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](https://developers.google.com/workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. Not supported by Google Chat apps.
},
"openLink": { # Represents an `onClick` event that opens a hyperlink. # If specified, this `onClick` triggers an open link action.
"onClose": "A String", # Whether the client forgets about a link after opening it, or observes it until the window closes. Not supported by Chat apps.
"openAs": "A String", # How to open a link. Not supported by Chat apps.
"url": "A String", # The URL to open.
},
},
},
],
"displayStyle": "A String", # The `peekCardHeader` display style for. Not supported by Google Chat apps.
"fixedFooter": { # A persistent (sticky) footer that is added to the bottom of the card. # The fixed footer shown at the bottom of this card.
"primaryButton": { # A button. Can be a text button or an image button. # The primary button of the fixed footer. The button must be a text button with text and color set.
"altText": "A String", # The alternative text used for accessibility. Has no effect when an icon is set; use `icon.alt_text` instead.
"color": { # Represents a color in the RGBA color space. This representation is designed for simplicity of conversion to/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 carry information about the absolute color space that should be used to interpret the RGB value (e.g. sRGB, Adobe RGB, DCI-P3, BT.2020, etc.). 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(''); }; // ... # If set, the button is filled with a solid background.
"alpha": 3.14, # 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).
"blue": 3.14, # The amount of blue in the color as a value in the interval [0, 1].
"green": 3.14, # The amount of green in the color as a value in the interval [0, 1].
"red": 3.14, # The amount of red in the color as a value in the interval [0, 1].
},
"disabled": True or False, # If `true`, the button is displayed in a disabled state and doesn't respond to user actions.
"icon": { # The icon image.
"altText": "A String", # The description of the icon, used for accessibility. The default value is provided if you don't specify one.
"iconUrl": "A String", # The icon specified by a URL.
"imageType": "A String", # The crop style applied to the image. In some cases, applying a `CIRCLE` crop causes the image to be drawn larger than a standard icon.
"knownIcon": "A String", # The icon specified by the string name of a list of known icons.
},
"onClick": { # Represents the response to an `onClick` event. # The action to perform when the button is clicked.
"action": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # If specified, an action is triggered by this `onClick`.
"function": "A String", # Apps Script function to invoke when the containing element is clicked/activated.
"loadIndicator": "A String", # Specifies the loading indicator that the action displays while making the call to the action.
"parameters": [ # List of action parameters.
{ # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters.
"key": "A String", # The name of the parameter for the action script.
"value": "A String", # The value of the parameter.
},
],
"persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](https://developers.google.com/workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](https://developers.google.com/workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. Not supported by Google Chat apps.
},
"card": # Object with schema name: GoogleAppsCardV1Card # A new card is pushed to the card stack after clicking if specified.
"openDynamicLinkAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # An add-on triggers this action when the action needs to open a link. This differs from the `open_link` above in that this needs to talk to server to get the link. Thus some preparation work is required for web client to do before the open link action response comes back.
"function": "A String", # Apps Script function to invoke when the containing element is clicked/activated.
"loadIndicator": "A String", # Specifies the loading indicator that the action displays while making the call to the action.
"parameters": [ # List of action parameters.
{ # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters.
"key": "A String", # The name of the parameter for the action script.
"value": "A String", # The value of the parameter.
},
],
"persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](https://developers.google.com/workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](https://developers.google.com/workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. Not supported by Google Chat apps.
},
"openLink": { # Represents an `onClick` event that opens a hyperlink. # If specified, this `onClick` triggers an open link action.
"onClose": "A String", # Whether the client forgets about a link after opening it, or observes it until the window closes. Not supported by Chat apps.
"openAs": "A String", # How to open a link. Not supported by Chat apps.
"url": "A String", # The URL to open.
},
},
"text": "A String", # The text of the button.
},
"secondaryButton": { # A button. Can be a text button or an image button. # The secondary button of the fixed footer. The button must be a text button with text and color set. `primaryButton` must be set if `secondaryButton` is set.
"altText": "A String", # The alternative text used for accessibility. Has no effect when an icon is set; use `icon.alt_text` instead.
"color": { # Represents a color in the RGBA color space. This representation is designed for simplicity of conversion to/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 carry information about the absolute color space that should be used to interpret the RGB value (e.g. sRGB, Adobe RGB, DCI-P3, BT.2020, etc.). 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(''); }; // ... # If set, the button is filled with a solid background.
"alpha": 3.14, # 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).
"blue": 3.14, # The amount of blue in the color as a value in the interval [0, 1].
"green": 3.14, # The amount of green in the color as a value in the interval [0, 1].
"red": 3.14, # The amount of red in the color as a value in the interval [0, 1].
},
"disabled": True or False, # If `true`, the button is displayed in a disabled state and doesn't respond to user actions.
"icon": { # The icon image.
"altText": "A String", # The description of the icon, used for accessibility. The default value is provided if you don't specify one.
"iconUrl": "A String", # The icon specified by a URL.
"imageType": "A String", # The crop style applied to the image. In some cases, applying a `CIRCLE` crop causes the image to be drawn larger than a standard icon.
"knownIcon": "A String", # The icon specified by the string name of a list of known icons.
},
"onClick": { # Represents the response to an `onClick` event. # The action to perform when the button is clicked.
"action": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # If specified, an action is triggered by this `onClick`.
"function": "A String", # Apps Script function to invoke when the containing element is clicked/activated.
"loadIndicator": "A String", # Specifies the loading indicator that the action displays while making the call to the action.
"parameters": [ # List of action parameters.
{ # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters.
"key": "A String", # The name of the parameter for the action script.
"value": "A String", # The value of the parameter.
},
],
"persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](https://developers.google.com/workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](https://developers.google.com/workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. Not supported by Google Chat apps.
},
"card": # Object with schema name: GoogleAppsCardV1Card # A new card is pushed to the card stack after clicking if specified.
"openDynamicLinkAction": { # An action that describes the behavior when the form is submitted. For example, an Apps Script can be invoked to handle the form. # An add-on triggers this action when the action needs to open a link. This differs from the `open_link` above in that this needs to talk to server to get the link. Thus some preparation work is required for web client to do before the open link action response comes back.
"function": "A String", # Apps Script function to invoke when the containing element is clicked/activated.
"loadIndicator": "A String", # Specifies the loading indicator that the action displays while making the call to the action.
"parameters": [ # List of action parameters.
{ # List of string parameters to supply when the action method is invoked. For example, consider three snooze buttons: snooze now, snooze 1 day, snooze next week. You might use action method = snooze(), passing the snooze type and snooze time in the list of string parameters.
"key": "A String", # The name of the parameter for the action script.
"value": "A String", # The value of the parameter.
},
],
"persistValues": True or False, # Indicates whether form values persist after the action. The default value is `false`. If `true`, form values remain after the action is triggered. When using [LoadIndicator.NONE](https://developers.google.com/workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for actions, `persist_values` = `true`is recommended, as it ensures that any changes made by the user after form or on change actions are sent to the server are not overwritten by the response. If `false`, the form values are cleared when the action is triggered. When `persist_values` is set to `false`, it is strongly recommended that the card use [LoadIndicator.SPINNER](https://developers.google.com/workspace/add-ons/reference/rpc/google.apps.card.v1#loadindicator) for all actions, as this locks the UI to ensure no changes are made by the user while the action is being processed. Not supported by Google Chat apps.
},
"openLink": { # Represents an `onClick` event that opens a hyperlink. # If specified, this `onClick` triggers an open link action.
"onClose": "A String", # Whether the client forgets about a link after opening it, or observes it until the window closes. Not supported by Chat apps.
"openAs": "A String", # How to open a link. Not supported by Chat apps.
"url": "A String", # The URL to open.
},
},
"text": "A String", # The text of the button.
},
},
"header": { # Represents a card header. # The header of the card. A header usually contains a title and an image.
"imageAltText": "A String", # The alternative text of this image which is used for accessibility.
"imageType": "A String", # The image's type.
"imageUrl": "A String", # The URL of the image in the card header.
"subtitle": "A String", # The subtitle of the card header.
"title": "A String", # 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.
},
"name": "A String", # Name of the card. Used as a card identifier in card navigation.
"peekCardHeader": { # Represents a card header. # 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 Google Chat apps.
"imageAltText": "A String", # The alternative text of this image which is used for accessibility.
"imageType": "A String", # The image's type.
"imageUrl": "A String", # The URL of the image in the card header.
"subtitle": "A String", # The subtitle of the card header.
"title": "A String", # 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.
},
"sections": [ # Sections are separated by a line divider.
{ # 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 is currently no need for layout properties, for example, float.
"collapsible": True or False, # Indicates whether this section is collapsible. If a section is collapsible, the description must be given.
"header": "A String", # The header of the section. Formatted text is supported.
"uncollapsibleWidgetsCount": 42, # The number of uncollapsible widgets. 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 as default. The `uncollapsibleWidgetsCount` is taken into account only when `collapsible` is `true`.
"widgets": [ # A section must contain at least 1 widget.
{ # A widget is a UI element that presents texts, images, etc.
"buttonList": { # A list of buttons layed out horizontally. # A list of buttons. For example, the following JSON creates two buttons. The first is a filled text button and the second is an image button that opens a link: ``` "buttonList": { "buttons": [ "button": { "text": "Edit", "Color": { "Red": 255 "Green": 255 "Blue": 255 } "disabled": true }, "button": { "icon": { "knownIcon": "INVITE" "altText": "check calendar" }, "onClick": { "openLink": { "url": "https://example.com/calendar" } } }, ] } ```
"buttons": [ # An array of buttons.
{ # A button. Can be a text button or an image button.
"altText": "A String", # The alternative text used for accessibility. Has no effect when an icon is set; use `icon.alt_text` instead.
"color": { # Represents a color in the RGBA color space. This representation is designed for simplicity of conversion to/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 carry information about the absolute color space that should be used to interpret the RGB value (e.g. sRGB, Adobe RGB, DCI-P3, BT.2020, etc.). 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(''); }; // ... # If set, the button is filled with a solid background.
"alpha": 3.14, # 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).
"blue": 3.14, # The amount of blue in the color as a value in the interval [0, 1].
"green": 3.14, # The amount of green in the color as a value in the interval [0, 1].
"red": 3.14, # The amount of red in the color as a value in the interval [0, 1].