#![allow(rustdoc::redundant_explicit_links)]
#![allow(rustdoc::broken_intra_doc_links)]
#![no_implicit_prelude]
extern crate bytes;
extern crate google_cloud_apps_script_type;
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 GmailAddOnManifest {
pub homepage_trigger:
std::option::Option<google_cloud_apps_script_type::model::HomepageExtensionPoint>,
pub contextual_triggers: std::vec::Vec<crate::model::ContextualTrigger>,
pub universal_actions: std::vec::Vec<crate::model::UniversalAction>,
pub compose_trigger: std::option::Option<crate::model::ComposeTrigger>,
pub authorization_check_function: std::string::String,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl GmailAddOnManifest {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_homepage_trigger<T>(mut self, v: T) -> Self
where
T: std::convert::Into<google_cloud_apps_script_type::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<google_cloud_apps_script_type::model::HomepageExtensionPoint>,
{
self.homepage_trigger = v.map(|x| x.into());
self
}
pub fn set_contextual_triggers<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<crate::model::ContextualTrigger>,
{
use std::iter::Iterator;
self.contextual_triggers = v.into_iter().map(|i| i.into()).collect();
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::UniversalAction>,
{
use std::iter::Iterator;
self.universal_actions = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_compose_trigger<T>(mut self, v: T) -> Self
where
T: std::convert::Into<crate::model::ComposeTrigger>,
{
self.compose_trigger = std::option::Option::Some(v.into());
self
}
pub fn set_or_clear_compose_trigger<T>(mut self, v: std::option::Option<T>) -> Self
where
T: std::convert::Into<crate::model::ComposeTrigger>,
{
self.compose_trigger = v.map(|x| x.into());
self
}
pub fn set_authorization_check_function<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.authorization_check_function = v.into();
self
}
}
impl wkt::message::Message for GmailAddOnManifest {
fn typename() -> &'static str {
"type.googleapis.com/google.apps.script.type.gmail.GmailAddOnManifest"
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct UniversalAction {
pub text: std::string::String,
pub action_type: std::option::Option<crate::model::universal_action::ActionType>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl UniversalAction {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_text<T: std::convert::Into<std::string::String>>(mut self, v: T) -> Self {
self.text = v.into();
self
}
pub fn set_action_type<
T: std::convert::Into<std::option::Option<crate::model::universal_action::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::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::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::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::ActionType::RunFunction(v.into()),
);
self
}
}
impl wkt::message::Message for UniversalAction {
fn typename() -> &'static str {
"type.googleapis.com/google.apps.script.type.gmail.UniversalAction"
}
}
pub mod universal_action {
#[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 ComposeTrigger {
pub actions: std::vec::Vec<google_cloud_apps_script_type::model::MenuItemExtensionPoint>,
pub draft_access: crate::model::compose_trigger::DraftAccess,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ComposeTrigger {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_actions<T, V>(mut self, v: T) -> Self
where
T: std::iter::IntoIterator<Item = V>,
V: std::convert::Into<google_cloud_apps_script_type::model::MenuItemExtensionPoint>,
{
use std::iter::Iterator;
self.actions = v.into_iter().map(|i| i.into()).collect();
self
}
pub fn set_draft_access<T: std::convert::Into<crate::model::compose_trigger::DraftAccess>>(
mut self,
v: T,
) -> Self {
self.draft_access = v.into();
self
}
}
impl wkt::message::Message for ComposeTrigger {
fn typename() -> &'static str {
"type.googleapis.com/google.apps.script.type.gmail.ComposeTrigger"
}
}
pub mod compose_trigger {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum DraftAccess {
Unspecified,
None,
Metadata,
UnknownValue(draft_access::UnknownValue),
}
#[doc(hidden)]
pub mod draft_access {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
pub struct UnknownValue(pub(crate) wkt::internal::UnknownEnumValue);
}
impl DraftAccess {
pub fn value(&self) -> std::option::Option<i32> {
match self {
Self::Unspecified => std::option::Option::Some(0),
Self::None => std::option::Option::Some(1),
Self::Metadata => std::option::Option::Some(2),
Self::UnknownValue(u) => u.0.value(),
}
}
pub fn name(&self) -> std::option::Option<&str> {
match self {
Self::Unspecified => std::option::Option::Some("UNSPECIFIED"),
Self::None => std::option::Option::Some("NONE"),
Self::Metadata => std::option::Option::Some("METADATA"),
Self::UnknownValue(u) => u.0.name(),
}
}
}
impl std::default::Default for DraftAccess {
fn default() -> Self {
use std::convert::From;
Self::from(0)
}
}
impl std::fmt::Display for DraftAccess {
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 DraftAccess {
fn from(value: i32) -> Self {
match value {
0 => Self::Unspecified,
1 => Self::None,
2 => Self::Metadata,
_ => Self::UnknownValue(draft_access::UnknownValue(
wkt::internal::UnknownEnumValue::Integer(value),
)),
}
}
}
impl std::convert::From<&str> for DraftAccess {
fn from(value: &str) -> Self {
use std::string::ToString;
match value {
"UNSPECIFIED" => Self::Unspecified,
"NONE" => Self::None,
"METADATA" => Self::Metadata,
_ => Self::UnknownValue(draft_access::UnknownValue(
wkt::internal::UnknownEnumValue::String(value.to_string()),
)),
}
}
}
impl serde::ser::Serialize for DraftAccess {
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::None => serializer.serialize_i32(1),
Self::Metadata => serializer.serialize_i32(2),
Self::UnknownValue(u) => u.0.serialize(serializer),
}
}
}
impl<'de> serde::de::Deserialize<'de> for DraftAccess {
fn deserialize<D>(deserializer: D) -> std::result::Result<Self, D::Error>
where
D: serde::Deserializer<'de>,
{
deserializer.deserialize_any(wkt::internal::EnumVisitor::<DraftAccess>::new(
".google.apps.script.type.gmail.ComposeTrigger.DraftAccess",
))
}
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct ContextualTrigger {
pub on_trigger_function: std::string::String,
pub trigger: std::option::Option<crate::model::contextual_trigger::Trigger>,
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl ContextualTrigger {
pub fn new() -> Self {
std::default::Default::default()
}
pub fn set_on_trigger_function<T: std::convert::Into<std::string::String>>(
mut self,
v: T,
) -> Self {
self.on_trigger_function = v.into();
self
}
pub fn set_trigger<
T: std::convert::Into<std::option::Option<crate::model::contextual_trigger::Trigger>>,
>(
mut self,
v: T,
) -> Self {
self.trigger = v.into();
self
}
pub fn unconditional(
&self,
) -> std::option::Option<&std::boxed::Box<crate::model::UnconditionalTrigger>> {
#[allow(unreachable_patterns)]
self.trigger.as_ref().and_then(|v| match v {
crate::model::contextual_trigger::Trigger::Unconditional(v) => {
std::option::Option::Some(v)
}
_ => std::option::Option::None,
})
}
pub fn set_unconditional<
T: std::convert::Into<std::boxed::Box<crate::model::UnconditionalTrigger>>,
>(
mut self,
v: T,
) -> Self {
self.trigger = std::option::Option::Some(
crate::model::contextual_trigger::Trigger::Unconditional(v.into()),
);
self
}
}
impl wkt::message::Message for ContextualTrigger {
fn typename() -> &'static str {
"type.googleapis.com/google.apps.script.type.gmail.ContextualTrigger"
}
}
pub mod contextual_trigger {
#[allow(unused_imports)]
use super::*;
#[derive(Clone, Debug, PartialEq)]
#[non_exhaustive]
pub enum Trigger {
Unconditional(std::boxed::Box<crate::model::UnconditionalTrigger>),
}
}
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct UnconditionalTrigger {
pub(crate) _unknown_fields: serde_json::Map<std::string::String, serde_json::Value>,
}
impl UnconditionalTrigger {
pub fn new() -> Self {
std::default::Default::default()
}
}
impl wkt::message::Message for UnconditionalTrigger {
fn typename() -> &'static str {
"type.googleapis.com/google.apps.script.type.gmail.UnconditionalTrigger"
}
}