google-cloud-apps-script-type-sheets 1.6.0

Google Cloud Client Libraries for Rust - Google Apps Script Types
Documentation
// 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 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;

/// Sheets add-on manifest.
#[derive(Clone, Default, PartialEq)]
#[non_exhaustive]
pub struct SheetsAddOnManifest {
    /// If present, this overrides the configuration from
    /// `addOns.common.homepageTrigger`.
    pub homepage_trigger:
        std::option::Option<google_cloud_apps_script_type::model::HomepageExtensionPoint>,

    /// Endpoint to execute when file scope authorization is granted
    /// for this document/user pair.
    pub on_file_scope_granted_trigger: std::option::Option<crate::model::SheetsExtensionPoint>,

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

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

    /// Sets the value of [homepage_trigger][crate::model::SheetsAddOnManifest::homepage_trigger].
    ///
    /// # Example
    /// ```ignore,no_run
    /// # use google_cloud_apps_script_type_sheets::model::SheetsAddOnManifest;
    /// use google_cloud_apps_script_type::model::HomepageExtensionPoint;
    /// let x = SheetsAddOnManifest::new().set_homepage_trigger(HomepageExtensionPoint::default()/* use setters */);
    /// ```
    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
    }

    /// Sets or clears the value of [homepage_trigger][crate::model::SheetsAddOnManifest::homepage_trigger].
    ///
    /// # Example
    /// ```ignore,no_run
    /// # use google_cloud_apps_script_type_sheets::model::SheetsAddOnManifest;
    /// use google_cloud_apps_script_type::model::HomepageExtensionPoint;
    /// let x = SheetsAddOnManifest::new().set_or_clear_homepage_trigger(Some(HomepageExtensionPoint::default()/* use setters */));
    /// let x = SheetsAddOnManifest::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<google_cloud_apps_script_type::model::HomepageExtensionPoint>,
    {
        self.homepage_trigger = v.map(|x| x.into());
        self
    }

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

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

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

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

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

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

    /// Sets the value of [run_function][crate::model::SheetsExtensionPoint::run_function].
    ///
    /// # Example
    /// ```ignore,no_run
    /// # use google_cloud_apps_script_type_sheets::model::SheetsExtensionPoint;
    /// let x = SheetsExtensionPoint::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
    }
}

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