#![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;
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct AddOnWidgetSet {
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()
}
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"
}
}
pub mod add_on_widget_set {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum WidgetType {
Unspecified,
DatePicker,
StyledButtons,
PersistentForms,
FixedFooter,
UpdateSubjectAndRecipients,
GridWidget,
AddonComposeUiAction,
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 {
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(),
}
}
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",
))
}
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct MenuItemExtensionPoint {
pub run_function: std::string::String,
pub label: std::string::String,
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()
}
pub fn set_run_function<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.run_function = v.into();
self
}
pub fn set_label<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.label = v.into();
self
}
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"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct HomepageExtensionPoint {
pub run_function: std::string::String,
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()
}
pub fn set_run_function<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.run_function = v.into();
self
}
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
}
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"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct UniversalActionExtensionPoint {
pub label: std::string::String,
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()
}
pub fn set_label<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.label = v.into();
self
}
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
}
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,
})
}
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
}
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,
})
}
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"
}
}
pub mod universal_action_extension_point {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum ActionType {
OpenLink(std::string::String),
RunFunction(std::string::String),
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct CommonAddOnManifest {
pub name: std::string::String,
pub logo_url: std::string::String,
pub layout_properties: std::option::Option<crate::model::LayoutProperties>,
pub add_on_widget_set: std::option::Option<crate::model::AddOnWidgetSet>,
pub use_locale_from_app: bool,
pub homepage_trigger: std::option::Option<crate::model::HomepageExtensionPoint>,
pub universal_actions: std::vec::Vec<crate::model::UniversalActionExtensionPoint>,
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()
}
pub fn set_name<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.name = v.into();
self
}
pub fn set_logo_url<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.logo_url = v.into();
self
}
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
}
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
}
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
}
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
}
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
}
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
}
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
}
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
}
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
}
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"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct LayoutProperties {
pub primary_color: std::string::String,
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()
}
pub fn set_primary_color<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.primary_color = v.into();
self
}
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"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct HttpOptions {
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()
}
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"
}
}
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum HttpAuthorizationHeader {
Unspecified,
SystemIdToken,
UserIdToken,
None,
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 {
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(),
}
}
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",
))
}
}