google-cloud-apps-script-type 1.4.0

Google Cloud Client Libraries for Rust - Google Apps Script Types
Documentation
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
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
// Copyright 2025 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// Code generated by sidekick. DO NOT EDIT.

#![allow(rustdoc::redundant_explicit_links)]
#![allow(rustdoc::broken_intra_doc_links)]
#![no_implicit_prelude]
extern crate bytes;
extern crate serde;
extern crate serde_json;
extern crate serde_with;
extern crate std;
extern crate wkt;

mod debug;
mod deserialize;
mod serialize;

/// The widget subset used by an add-on.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct AddOnWidgetSet {
    /// The list of widgets used in an add-on.
    pub used_widgets: std::vec::Vec<crate::model::add_on_widget_set::WidgetType>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl AddOnWidgetSet {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [used_widgets][crate::model::AddOnWidgetSet::used_widgets].
    ///
    /// # Example
    /// ```ignore,no_run
    /// # use google_cloud_apps_script_type::model::AddOnWidgetSet;
    /// use google_cloud_apps_script_type::model::add_on_widget_set::WidgetType;
    /// let x = AddOnWidgetSet::new().set_used_widgets([
    ///     WidgetType::DatePicker,
    ///     WidgetType::StyledButtons,
    ///     WidgetType::PersistentForms,
    /// ]);
    /// ```
    pub fn set_used_widgets<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<crate::model::add_on_widget_set::WidgetType>,
    {
        use std::iter::Iterator;
        self.used_widgets = v.into_iter().map(|i| i.into()).collect();
        self
    }
}

impl wkt::message::Message for AddOnWidgetSet {
    fn typename() -> &'static str {
        "type.googleapis.com/google.apps.script.type.AddOnWidgetSet"
    }
}

/// Defines additional types related to [AddOnWidgetSet].
pub mod add_on_widget_set {
    #[allow(unused_imports)]
    use super::*;

    /// The Widget type. DEFAULT is the basic widget set.
    ///
    /// # Working with unknown values
    ///
    /// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
    /// additional enum variants at any time. Adding new variants is not considered
    /// a breaking change. Applications should write their code in anticipation of:
    ///
    /// - New values appearing in future releases of the client library, **and**
    /// - New values received dynamically, without application changes.
    ///
    /// Please consult the [Working with enums] section in the user guide for some
    /// guidelines.
    ///
    /// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
    #[derive(Clone, Debug, PartialEq)]
    #[non_exhaustive]
    pub enum WidgetType {
        /// The default widget set.
        Unspecified,
        /// The date picker.
        DatePicker,
        /// Styled buttons include filled buttons and disabled buttons.
        StyledButtons,
        /// Persistent forms allow persisting form values during actions.
        PersistentForms,
        /// Fixed footer in card.
        FixedFooter,
        /// Update the subject and recipients of a draft.
        UpdateSubjectAndRecipients,
        /// The grid widget.
        GridWidget,
        /// A Gmail add-on action that applies to the addon compose UI.
        AddonComposeUiAction,
        /// If set, the enum was initialized with an unknown value.
        ///
        /// Applications can examine the value using [WidgetType::value] or
        /// [WidgetType::name].
        UnknownValue(widget_type::UnknownValue),
    }

    #[doc(hidden)]
    pub mod widget_type {
        #[allow(unused_imports)]
        use super::*;
        #[derive(Clone, Debug, PartialEq)]
        pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
    }

    impl WidgetType {
        /// Gets the enum value.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the string representation of enums.
        pub fn value(&self) -> std::option::Option<i32> {
            match self {
                Self::Unspecified => std::option::Option::Some(0),
                Self::DatePicker => std::option::Option::Some(1),
                Self::StyledButtons => std::option::Option::Some(2),
                Self::PersistentForms => std::option::Option::Some(3),
                Self::FixedFooter => std::option::Option::Some(4),
                Self::UpdateSubjectAndRecipients => std::option::Option::Some(5),
                Self::GridWidget => std::option::Option::Some(6),
                Self::AddonComposeUiAction => std::option::Option::Some(7),
                Self::UnknownValue(u) => u.0.value(),
            }
        }

        /// Gets the enum value as a string.
        ///
        /// Returns `None` if the enum contains an unknown value deserialized from
        /// the integer representation of enums.
        pub fn name(&self) -> std::option::Option<&str> {
            match self {
                Self::Unspecified => std::option::Option::Some("WIDGET_TYPE_UNSPECIFIED"),
                Self::DatePicker => std::option::Option::Some("DATE_PICKER"),
                Self::StyledButtons => std::option::Option::Some("STYLED_BUTTONS"),
                Self::PersistentForms => std::option::Option::Some("PERSISTENT_FORMS"),
                Self::FixedFooter => std::option::Option::Some("FIXED_FOOTER"),
                Self::UpdateSubjectAndRecipients => {
                    std::option::Option::Some("UPDATE_SUBJECT_AND_RECIPIENTS")
                }
                Self::GridWidget => std::option::Option::Some("GRID_WIDGET"),
                Self::AddonComposeUiAction => std::option::Option::Some("ADDON_COMPOSE_UI_ACTION"),
                Self::UnknownValue(u) => u.0.name(),
            }
        }
    }

    impl std::default::Default for WidgetType {
        fn default() -> Self {
            use std::convert::From;
            Self::from(0)
        }
    }

    impl std::fmt::Display for WidgetType {
        fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
            wkt::internal::display_enum(f, self.name(), self.value())
        }
    }

    impl std::convert::From<i32> for WidgetType {
        fn from(value: i32) -> Self {
            match value {
                0 => Self::Unspecified,
                1 => Self::DatePicker,
                2 => Self::StyledButtons,
                3 => Self::PersistentForms,
                4 => Self::FixedFooter,
                5 => Self::UpdateSubjectAndRecipients,
                6 => Self::GridWidget,
                7 => Self::AddonComposeUiAction,
                _ => Self::UnknownValue(widget_type::UnknownValue(
                    wkt::internal::UnknownEnumValue::Integer(value),
                )),
            }
        }
    }

    impl std::convert::From<&str> for WidgetType {
        fn from(value: &str) -> Self {
            use std::string::ToString;
            match value {
                "WIDGET_TYPE_UNSPECIFIED" => Self::Unspecified,
                "DATE_PICKER" => Self::DatePicker,
                "STYLED_BUTTONS" => Self::StyledButtons,
                "PERSISTENT_FORMS" => Self::PersistentForms,
                "FIXED_FOOTER" => Self::FixedFooter,
                "UPDATE_SUBJECT_AND_RECIPIENTS" => Self::UpdateSubjectAndRecipients,
                "GRID_WIDGET" => Self::GridWidget,
                "ADDON_COMPOSE_UI_ACTION" => Self::AddonComposeUiAction,
                _ => Self::UnknownValue(widget_type::UnknownValue(
                    wkt::internal::UnknownEnumValue::String(value.to_string()),
                )),
            }
        }
    }

    impl serde::ser::Serialize for WidgetType {
        fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
        where
            S: serde::Serializer,
        {
            match self {
                Self::Unspecified => serializer.serialize_i32(0),
                Self::DatePicker => serializer.serialize_i32(1),
                Self::StyledButtons => serializer.serialize_i32(2),
                Self::PersistentForms => serializer.serialize_i32(3),
                Self::FixedFooter => serializer.serialize_i32(4),
                Self::UpdateSubjectAndRecipients => serializer.serialize_i32(5),
                Self::GridWidget => serializer.serialize_i32(6),
                Self::AddonComposeUiAction => serializer.serialize_i32(7),
                Self::UnknownValue(u) => u.0.serialize(serializer),
            }
        }
    }

    impl<'de> serde::de::Deserialize<'de> for WidgetType {
        fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
        where
            D: serde::Deserializer<'de>,
        {
            deserializer.deserialize_any(wkt::internal::EnumVisitor::<WidgetType>::new(
                ".google.apps.script.type.AddOnWidgetSet.WidgetType",
            ))
        }
    }
}

/// Common format for declaring a  menu item, or button, that appears within a
/// host app.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct MenuItemExtensionPoint {
    /// Required. The endpoint to execute when this extension point is
    /// activated.
    pub run_function: std::string::String,

    /// Required. User-visible text describing the action taken by activating this
    /// extension point. For example, "Insert invoice".
    pub label: std::string::String,

    /// The URL for the logo image shown in the add-on toolbar.
    ///
    /// If not set, defaults to the add-on's primary logo URL.
    pub logo_url: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl MenuItemExtensionPoint {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [run_function][crate::model::MenuItemExtensionPoint::run_function].
    ///
    /// # Example
    /// ```ignore,no_run
    /// # use google_cloud_apps_script_type::model::MenuItemExtensionPoint;
    /// let x = MenuItemExtensionPoint::new().set_run_function("example");
    /// ```
    pub fn set_run_function<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.run_function = v.into();
        self
    }

    /// Sets the value of [label][crate::model::MenuItemExtensionPoint::label].
    ///
    /// # Example
    /// ```ignore,no_run
    /// # use google_cloud_apps_script_type::model::MenuItemExtensionPoint;
    /// let x = MenuItemExtensionPoint::new().set_label("example");
    /// ```
    pub fn set_label<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.label = v.into();
        self
    }

    /// Sets the value of [logo_url][crate::model::MenuItemExtensionPoint::logo_url].
    ///
    /// # Example
    /// ```ignore,no_run
    /// # use google_cloud_apps_script_type::model::MenuItemExtensionPoint;
    /// let x = MenuItemExtensionPoint::new().set_logo_url("example");
    /// ```
    pub fn set_logo_url<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.logo_url = v.into();
        self
    }
}

impl wkt::message::Message for MenuItemExtensionPoint {
    fn typename() -> &'static str {
        "type.googleapis.com/google.apps.script.type.MenuItemExtensionPoint"
    }
}

/// Common format for declaring an add-on's home-page view.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct HomepageExtensionPoint {
    /// Required. The endpoint to execute when this extension point is
    /// activated.
    pub run_function: std::string::String,

    /// Optional. If set to `false`, disable the home-page view in this context.
    ///
    /// Defaults to `true` if unset.
    ///
    /// If an add-ons custom home-page view is disabled, an autogenerated overview
    /// card will be provided for users instead.
    pub enabled: std::option::Option<wkt::BoolValue>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl HomepageExtensionPoint {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [run_function][crate::model::HomepageExtensionPoint::run_function].
    ///
    /// # Example
    /// ```ignore,no_run
    /// # use google_cloud_apps_script_type::model::HomepageExtensionPoint;
    /// let x = HomepageExtensionPoint::new().set_run_function("example");
    /// ```
    pub fn set_run_function<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.run_function = v.into();
        self
    }

    /// Sets the value of [enabled][crate::model::HomepageExtensionPoint::enabled].
    ///
    /// # Example
    /// ```ignore,no_run
    /// # use google_cloud_apps_script_type::model::HomepageExtensionPoint;
    /// use wkt::BoolValue;
    /// let x = HomepageExtensionPoint::new().set_enabled(BoolValue::default()/* use setters */);
    /// ```
    pub fn set_enabled<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::BoolValue>,
    {
        self.enabled = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [enabled][crate::model::HomepageExtensionPoint::enabled].
    ///
    /// # Example
    /// ```ignore,no_run
    /// # use google_cloud_apps_script_type::model::HomepageExtensionPoint;
    /// use wkt::BoolValue;
    /// let x = HomepageExtensionPoint::new().set_or_clear_enabled(Some(BoolValue::default()/* use setters */));
    /// let x = HomepageExtensionPoint::new().set_or_clear_enabled(None::<BoolValue>);
    /// ```
    pub fn set_or_clear_enabled<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::BoolValue>,
    {
        self.enabled = v.map(|x| x.into());
        self
    }
}

impl wkt::message::Message for HomepageExtensionPoint {
    fn typename() -> &'static str {
        "type.googleapis.com/google.apps.script.type.HomepageExtensionPoint"
    }
}

/// Format for declaring a universal action menu item extension point.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct UniversalActionExtensionPoint {
    /// Required. User-visible text describing the action taken by activating this
    /// extension point, for example, "Add a new contact".
    pub label: std::string::String,

    /// Required. The action type supported on a universal action menu item. It
    /// could be either a link to open or an endpoint to execute.
    pub action_type:
        std::option::Option<crate::model::universal_action_extension_point::ActionType>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl UniversalActionExtensionPoint {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [label][crate::model::UniversalActionExtensionPoint::label].
    ///
    /// # Example
    /// ```ignore,no_run
    /// # use google_cloud_apps_script_type::model::UniversalActionExtensionPoint;
    /// let x = UniversalActionExtensionPoint::new().set_label("example");
    /// ```
    pub fn set_label<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.label = v.into();
        self
    }

    /// Sets the value of [action_type][crate::model::UniversalActionExtensionPoint::action_type].
    ///
    /// Note that all the setters affecting `action_type` are mutually
    /// exclusive.
    ///
    /// # Example
    /// ```ignore,no_run
    /// # use google_cloud_apps_script_type::model::UniversalActionExtensionPoint;
    /// use google_cloud_apps_script_type::model::universal_action_extension_point::ActionType;
    /// let x = UniversalActionExtensionPoint::new().set_action_type(Some(ActionType::OpenLink("example".to_string())));
    /// ```
    pub fn set_action_type<
        T: std::convert::Into<
                std::option::Option<crate::model::universal_action_extension_point::ActionType>,
            >,
    >(
        mut self,
        v: T,
    ) -> Self {
        self.action_type = v.into();
        self
    }

    /// The value of [action_type][crate::model::UniversalActionExtensionPoint::action_type]
    /// if it holds a `OpenLink`, `None` if the field is not set or
    /// holds a different branch.
    pub fn open_link(&self) -> std::option::Option<&std::string::String> {
        #[allow(unreachable_patterns)]
        self.action_type.as_ref().and_then(|v| match v {
            crate::model::universal_action_extension_point::ActionType::OpenLink(v) => {
                std::option::Option::Some(v)
            }
            _ => std::option::Option::None,
        })
    }

    /// Sets the value of [action_type][crate::model::UniversalActionExtensionPoint::action_type]
    /// to hold a `OpenLink`.
    ///
    /// Note that all the setters affecting `action_type` are
    /// mutually exclusive.
    ///
    /// # Example
    /// ```ignore,no_run
    /// # use google_cloud_apps_script_type::model::UniversalActionExtensionPoint;
    /// let x = UniversalActionExtensionPoint::new().set_open_link("example");
    /// assert!(x.open_link().is_some());
    /// assert!(x.run_function().is_none());
    /// ```
    pub fn set_open_link<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.action_type = std::option::Option::Some(
            crate::model::universal_action_extension_point::ActionType::OpenLink(v.into()),
        );
        self
    }

    /// The value of [action_type][crate::model::UniversalActionExtensionPoint::action_type]
    /// if it holds a `RunFunction`, `None` if the field is not set or
    /// holds a different branch.
    pub fn run_function(&self) -> std::option::Option<&std::string::String> {
        #[allow(unreachable_patterns)]
        self.action_type.as_ref().and_then(|v| match v {
            crate::model::universal_action_extension_point::ActionType::RunFunction(v) => {
                std::option::Option::Some(v)
            }
            _ => std::option::Option::None,
        })
    }

    /// Sets the value of [action_type][crate::model::UniversalActionExtensionPoint::action_type]
    /// to hold a `RunFunction`.
    ///
    /// Note that all the setters affecting `action_type` are
    /// mutually exclusive.
    ///
    /// # Example
    /// ```ignore,no_run
    /// # use google_cloud_apps_script_type::model::UniversalActionExtensionPoint;
    /// let x = UniversalActionExtensionPoint::new().set_run_function("example");
    /// assert!(x.run_function().is_some());
    /// assert!(x.open_link().is_none());
    /// ```
    pub fn set_run_function<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.action_type = std::option::Option::Some(
            crate::model::universal_action_extension_point::ActionType::RunFunction(v.into()),
        );
        self
    }
}

impl wkt::message::Message for UniversalActionExtensionPoint {
    fn typename() -> &'static str {
        "type.googleapis.com/google.apps.script.type.UniversalActionExtensionPoint"
    }
}

/// Defines additional types related to [UniversalActionExtensionPoint].
pub mod universal_action_extension_point {
    #[allow(unused_imports)]
    use super::*;

    /// Required. The action type supported on a universal action menu item. It
    /// could be either a link to open or an endpoint to execute.
    #[derive(Clone, Debug, PartialEq)]
    #[non_exhaustive]
    pub enum ActionType {
        /// URL to be opened by the UniversalAction.
        OpenLink(std::string::String),
        /// Endpoint to be run by the UniversalAction.
        RunFunction(std::string::String),
    }
}

/// Add-on configuration that is shared across all add-on host applications.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct CommonAddOnManifest {
    /// Required. The display name of the add-on.
    pub name: std::string::String,

    /// Required. The URL for the logo image shown in the add-on toolbar.
    pub logo_url: std::string::String,

    /// Common layout properties for the add-on cards.
    pub layout_properties: std::option::Option<crate::model::LayoutProperties>,

    /// The widgets used in the add-on. If this field is not specified,
    /// it indicates that default set is used.
    pub add_on_widget_set: std::option::Option<crate::model::AddOnWidgetSet>,

    /// Whether to pass locale information from host app.
    pub use_locale_from_app: bool,

    /// Defines an endpoint that will be executed in any context, in
    /// any host. Any cards generated by this function will always be available to
    /// the user, but may be eclipsed by contextual content when this add-on
    /// declares more targeted triggers.
    pub homepage_trigger: std::option::Option<crate::model::HomepageExtensionPoint>,

    /// Defines a list of extension points in the universal action menu which
    /// serves as a setting menu for the add-on. The extension point can be
    /// link URL to open or an endpoint to execute as a form
    /// submission.
    pub universal_actions: std::vec::Vec<crate::model::UniversalActionExtensionPoint>,

    /// An OpenLink action
    /// can only use a URL with an HTTPS, MAILTO or TEL scheme.  For HTTPS links,
    /// the URL must also
    /// [match](/gmail/add-ons/concepts/manifests#whitelisting_urls) one of the
    /// prefixes specified in this whitelist. If the prefix omits the scheme, HTTPS
    /// is assumed.  Notice that HTTP links are automatically rewritten to HTTPS
    /// links.
    pub open_link_url_prefixes: std::option::Option<wkt::ListValue>,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl CommonAddOnManifest {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [name][crate::model::CommonAddOnManifest::name].
    ///
    /// # Example
    /// ```ignore,no_run
    /// # use google_cloud_apps_script_type::model::CommonAddOnManifest;
    /// let x = CommonAddOnManifest::new().set_name("example");
    /// ```
    pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.name = v.into();
        self
    }

    /// Sets the value of [logo_url][crate::model::CommonAddOnManifest::logo_url].
    ///
    /// # Example
    /// ```ignore,no_run
    /// # use google_cloud_apps_script_type::model::CommonAddOnManifest;
    /// let x = CommonAddOnManifest::new().set_logo_url("example");
    /// ```
    pub fn set_logo_url<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.logo_url = v.into();
        self
    }

    /// Sets the value of [layout_properties][crate::model::CommonAddOnManifest::layout_properties].
    ///
    /// # Example
    /// ```ignore,no_run
    /// # use google_cloud_apps_script_type::model::CommonAddOnManifest;
    /// use google_cloud_apps_script_type::model::LayoutProperties;
    /// let x = CommonAddOnManifest::new().set_layout_properties(LayoutProperties::default()/* use setters */);
    /// ```
    pub fn set_layout_properties<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::LayoutProperties>,
    {
        self.layout_properties = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [layout_properties][crate::model::CommonAddOnManifest::layout_properties].
    ///
    /// # Example
    /// ```ignore,no_run
    /// # use google_cloud_apps_script_type::model::CommonAddOnManifest;
    /// use google_cloud_apps_script_type::model::LayoutProperties;
    /// let x = CommonAddOnManifest::new().set_or_clear_layout_properties(Some(LayoutProperties::default()/* use setters */));
    /// let x = CommonAddOnManifest::new().set_or_clear_layout_properties(None::<LayoutProperties>);
    /// ```
    pub fn set_or_clear_layout_properties<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::LayoutProperties>,
    {
        self.layout_properties = v.map(|x| x.into());
        self
    }

    /// Sets the value of [add_on_widget_set][crate::model::CommonAddOnManifest::add_on_widget_set].
    ///
    /// # Example
    /// ```ignore,no_run
    /// # use google_cloud_apps_script_type::model::CommonAddOnManifest;
    /// use google_cloud_apps_script_type::model::AddOnWidgetSet;
    /// let x = CommonAddOnManifest::new().set_add_on_widget_set(AddOnWidgetSet::default()/* use setters */);
    /// ```
    pub fn set_add_on_widget_set<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::AddOnWidgetSet>,
    {
        self.add_on_widget_set = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [add_on_widget_set][crate::model::CommonAddOnManifest::add_on_widget_set].
    ///
    /// # Example
    /// ```ignore,no_run
    /// # use google_cloud_apps_script_type::model::CommonAddOnManifest;
    /// use google_cloud_apps_script_type::model::AddOnWidgetSet;
    /// let x = CommonAddOnManifest::new().set_or_clear_add_on_widget_set(Some(AddOnWidgetSet::default()/* use setters */));
    /// let x = CommonAddOnManifest::new().set_or_clear_add_on_widget_set(None::<AddOnWidgetSet>);
    /// ```
    pub fn set_or_clear_add_on_widget_set<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::AddOnWidgetSet>,
    {
        self.add_on_widget_set = v.map(|x| x.into());
        self
    }

    /// Sets the value of [use_locale_from_app][crate::model::CommonAddOnManifest::use_locale_from_app].
    ///
    /// # Example
    /// ```ignore,no_run
    /// # use google_cloud_apps_script_type::model::CommonAddOnManifest;
    /// let x = CommonAddOnManifest::new().set_use_locale_from_app(true);
    /// ```
    pub fn set_use_locale_from_app<T: std::convert::Into<bool>>(mut self, v: T) -> Self {
        self.use_locale_from_app = v.into();
        self
    }

    /// Sets the value of [homepage_trigger][crate::model::CommonAddOnManifest::homepage_trigger].
    ///
    /// # Example
    /// ```ignore,no_run
    /// # use google_cloud_apps_script_type::model::CommonAddOnManifest;
    /// use google_cloud_apps_script_type::model::HomepageExtensionPoint;
    /// let x = CommonAddOnManifest::new().set_homepage_trigger(HomepageExtensionPoint::default()/* use setters */);
    /// ```
    pub fn set_homepage_trigger<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<crate::model::HomepageExtensionPoint>,
    {
        self.homepage_trigger = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [homepage_trigger][crate::model::CommonAddOnManifest::homepage_trigger].
    ///
    /// # Example
    /// ```ignore,no_run
    /// # use google_cloud_apps_script_type::model::CommonAddOnManifest;
    /// use google_cloud_apps_script_type::model::HomepageExtensionPoint;
    /// let x = CommonAddOnManifest::new().set_or_clear_homepage_trigger(Some(HomepageExtensionPoint::default()/* use setters */));
    /// let x = CommonAddOnManifest::new().set_or_clear_homepage_trigger(None::<HomepageExtensionPoint>);
    /// ```
    pub fn set_or_clear_homepage_trigger<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<crate::model::HomepageExtensionPoint>,
    {
        self.homepage_trigger = v.map(|x| x.into());
        self
    }

    /// Sets the value of [universal_actions][crate::model::CommonAddOnManifest::universal_actions].
    ///
    /// # Example
    /// ```ignore,no_run
    /// # use google_cloud_apps_script_type::model::CommonAddOnManifest;
    /// use google_cloud_apps_script_type::model::UniversalActionExtensionPoint;
    /// let x = CommonAddOnManifest::new()
    ///     .set_universal_actions([
    ///         UniversalActionExtensionPoint::default()/* use setters */,
    ///         UniversalActionExtensionPoint::default()/* use (different) setters */,
    ///     ]);
    /// ```
    pub fn set_universal_actions<T, V>(mut self, v: T) -> Self
    where
        T: std::iter::IntoIterator<Item = V>,
        V: std::convert::Into<crate::model::UniversalActionExtensionPoint>,
    {
        use std::iter::Iterator;
        self.universal_actions = v.into_iter().map(|i| i.into()).collect();
        self
    }

    /// Sets the value of [open_link_url_prefixes][crate::model::CommonAddOnManifest::open_link_url_prefixes].
    ///
    /// # Example
    /// ```ignore,no_run
    /// # use google_cloud_apps_script_type::model::CommonAddOnManifest;
    /// use wkt::ListValue;
    /// let x = CommonAddOnManifest::new().set_open_link_url_prefixes(ListValue::default()/* use setters */);
    /// ```
    pub fn set_open_link_url_prefixes<T>(mut self, v: T) -> Self
    where
        T: std::convert::Into<wkt::ListValue>,
    {
        self.open_link_url_prefixes = std::option::Option::Some(v.into());
        self
    }

    /// Sets or clears the value of [open_link_url_prefixes][crate::model::CommonAddOnManifest::open_link_url_prefixes].
    ///
    /// # Example
    /// ```ignore,no_run
    /// # use google_cloud_apps_script_type::model::CommonAddOnManifest;
    /// use wkt::ListValue;
    /// let x = CommonAddOnManifest::new().set_or_clear_open_link_url_prefixes(Some(ListValue::default()/* use setters */));
    /// let x = CommonAddOnManifest::new().set_or_clear_open_link_url_prefixes(None::<ListValue>);
    /// ```
    pub fn set_or_clear_open_link_url_prefixes<T>(mut self, v: std::option::Option<T>) -> Self
    where
        T: std::convert::Into<wkt::ListValue>,
    {
        self.open_link_url_prefixes = v.map(|x| x.into());
        self
    }
}

impl wkt::message::Message for CommonAddOnManifest {
    fn typename() -> &'static str {
        "type.googleapis.com/google.apps.script.type.CommonAddOnManifest"
    }
}

/// Card layout properties shared across all add-on host applications.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct LayoutProperties {
    /// The primary color of the add-on. It sets the color of toolbar. If no
    /// primary color is set explicitly, the default value provided by the
    /// framework is used.
    pub primary_color: std::string::String,

    /// The secondary color of the add-on. It sets the color of buttons.
    /// If primary color is set but no secondary color is set, the
    /// secondary color is the same as the primary color. If neither primary
    /// color nor secondary color is set, the default value provided by the
    /// framework is used.
    pub secondary_color: std::string::String,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl LayoutProperties {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [primary_color][crate::model::LayoutProperties::primary_color].
    ///
    /// # Example
    /// ```ignore,no_run
    /// # use google_cloud_apps_script_type::model::LayoutProperties;
    /// let x = LayoutProperties::new().set_primary_color("example");
    /// ```
    pub fn set_primary_color<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.primary_color = v.into();
        self
    }

    /// Sets the value of [secondary_color][crate::model::LayoutProperties::secondary_color].
    ///
    /// # Example
    /// ```ignore,no_run
    /// # use google_cloud_apps_script_type::model::LayoutProperties;
    /// let x = LayoutProperties::new().set_secondary_color("example");
    /// ```
    pub fn set_secondary_color<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
        self.secondary_color = v.into();
        self
    }
}

impl wkt::message::Message for LayoutProperties {
    fn typename() -> &'static str {
        "type.googleapis.com/google.apps.script.type.LayoutProperties"
    }
}

/// Options for sending requests to add-on HTTP endpoints
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct HttpOptions {
    /// Configuration for the token sent in the HTTP Authorization header
    pub authorization_header: crate::model::HttpAuthorizationHeader,

    pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}

impl HttpOptions {
    pub fn new() -> Self {
        std::default::Default::default()
    }

    /// Sets the value of [authorization_header][crate::model::HttpOptions::authorization_header].
    ///
    /// # Example
    /// ```ignore,no_run
    /// # use google_cloud_apps_script_type::model::HttpOptions;
    /// use google_cloud_apps_script_type::model::HttpAuthorizationHeader;
    /// let x0 = HttpOptions::new().set_authorization_header(HttpAuthorizationHeader::SystemIdToken);
    /// let x1 = HttpOptions::new().set_authorization_header(HttpAuthorizationHeader::UserIdToken);
    /// let x2 = HttpOptions::new().set_authorization_header(HttpAuthorizationHeader::None);
    /// ```
    pub fn set_authorization_header<
        T: std::convert::Into<crate::model::HttpAuthorizationHeader>,
    >(
        mut self,
        v: T,
    ) -> Self {
        self.authorization_header = v.into();
        self
    }
}

impl wkt::message::Message for HttpOptions {
    fn typename() -> &'static str {
        "type.googleapis.com/google.apps.script.type.HttpOptions"
    }
}

/// Authorization header sent in add-on HTTP requests
///
/// # Working with unknown values
///
/// This enum is defined as `#[non_exhaustive]` because Google Cloud may add
/// additional enum variants at any time. Adding new variants is not considered
/// a breaking change. Applications should write their code in anticipation of:
///
/// - New values appearing in future releases of the client library, **and**
/// - New values received dynamically, without application changes.
///
/// Please consult the [Working with enums] section in the user guide for some
/// guidelines.
///
/// [Working with enums]: https://googleapis.github.io/google-cloud-rust/working_with_enums.html
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum HttpAuthorizationHeader {
    /// Default value, equivalent to `SYSTEM_ID_TOKEN`
    Unspecified,
    /// Send an ID token for the project-specific Google Workspace add-ons system
    /// service account (default)
    SystemIdToken,
    /// Send an ID token for the end user
    UserIdToken,
    /// Do not send an Authentication header
    None,
    /// If set, the enum was initialized with an unknown value.
    ///
    /// Applications can examine the value using [HttpAuthorizationHeader::value] or
    /// [HttpAuthorizationHeader::name].
    UnknownValue(http_authorization_header::UnknownValue),
}

#[doc(hidden)]
pub mod http_authorization_header {
    #[allow(unused_imports)]
    use super::*;
    #[derive(Clone, Debug, PartialEq)]
    pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}

impl HttpAuthorizationHeader {
    /// Gets the enum value.
    ///
    /// Returns `None` if the enum contains an unknown value deserialized from
    /// the string representation of enums.
    pub fn value(&self) -> std::option::Option<i32> {
        match self {
            Self::Unspecified => std::option::Option::Some(0),
            Self::SystemIdToken => std::option::Option::Some(1),
            Self::UserIdToken => std::option::Option::Some(2),
            Self::None => std::option::Option::Some(3),
            Self::UnknownValue(u) => u.0.value(),
        }
    }

    /// Gets the enum value as a string.
    ///
    /// Returns `None` if the enum contains an unknown value deserialized from
    /// the integer representation of enums.
    pub fn name(&self) -> std::option::Option<&str> {
        match self {
            Self::Unspecified => std::option::Option::Some("HTTP_AUTHORIZATION_HEADER_UNSPECIFIED"),
            Self::SystemIdToken => std::option::Option::Some("SYSTEM_ID_TOKEN"),
            Self::UserIdToken => std::option::Option::Some("USER_ID_TOKEN"),
            Self::None => std::option::Option::Some("NONE"),
            Self::UnknownValue(u) => u.0.name(),
        }
    }
}

impl std::default::Default for HttpAuthorizationHeader {
    fn default() -> Self {
        use std::convert::From;
        Self::from(0)
    }
}

impl std::fmt::Display for HttpAuthorizationHeader {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::result::Result<(), std::fmt::Error> {
        wkt::internal::display_enum(f, self.name(), self.value())
    }
}

impl std::convert::From<i32> for HttpAuthorizationHeader {
    fn from(value: i32) -> Self {
        match value {
            0 => Self::Unspecified,
            1 => Self::SystemIdToken,
            2 => Self::UserIdToken,
            3 => Self::None,
            _ => Self::UnknownValue(http_authorization_header::UnknownValue(
                wkt::internal::UnknownEnumValue::Integer(value),
            )),
        }
    }
}

impl std::convert::From<&str> for HttpAuthorizationHeader {
    fn from(value: &str) -> Self {
        use std::string::ToString;
        match value {
            "HTTP_AUTHORIZATION_HEADER_UNSPECIFIED" => Self::Unspecified,
            "SYSTEM_ID_TOKEN" => Self::SystemIdToken,
            "USER_ID_TOKEN" => Self::UserIdToken,
            "NONE" => Self::None,
            _ => Self::UnknownValue(http_authorization_header::UnknownValue(
                wkt::internal::UnknownEnumValue::String(value.to_string()),
            )),
        }
    }
}

impl serde::ser::Serialize for HttpAuthorizationHeader {
    fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
    where
        S: serde::Serializer,
    {
        match self {
            Self::Unspecified => serializer.serialize_i32(0),
            Self::SystemIdToken => serializer.serialize_i32(1),
            Self::UserIdToken => serializer.serialize_i32(2),
            Self::None => serializer.serialize_i32(3),
            Self::UnknownValue(u) => u.0.serialize(serializer),
        }
    }
}

impl<'de> serde::de::Deserialize<'de> for HttpAuthorizationHeader {
    fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
    where
        D: serde::Deserializer<'de>,
    {
        deserializer.deserialize_any(wkt::internal::EnumVisitor::<HttpAuthorizationHeader>::new(
            ".google.apps.script.type.HttpAuthorizationHeader",
        ))
    }
}