### Complete Library Usage Example Source: https://docs.rs/google-gmail1/latest/src/google_gmail1/lib.rs.html A comprehensive example demonstrating how to set up the authenticator, configure the client, and initialize the Gmail hub. ```Rust extern crate hyper; extern crate hyper_rustls; extern crate google_gmail1 as gmail1; use gmail1::api::Message; use gmail1::{Result, Error}; use std::fs; # async fn dox() { use gmail1::{Gmail, FieldMask, hyper_rustls, hyper_util, yup_oauth2}; // Get an ApplicationSecret instance by some means. It contains the `client_id` and // `client_secret`, among other things. let secret: yup_oauth2::ApplicationSecret = Default::default(); // Instantiate the authenticator. It will choose a suitable authentication flow for you, // unless you replace `None` with the desired Flow. // Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about // what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and // retrieve them from storage. let connector = hyper_rustls::HttpsConnectorBuilder::new() .with_native_roots() .unwrap() .https_only() .enable_http2() .build(); let executor = hyper_util::rt::TokioExecutor::new(); let auth = yup_oauth2::InstalledFlowAuthenticator::with_client( secret, yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect, yup_oauth2::client::CustomHyperClientBuilder::from( hyper_util::client::legacy::Client::builder(executor).build(connector), ), ).build().await.unwrap(); let client = hyper_util::client::legacy::Client::builder( hyper_util::rt::TokioExecutor::new() ) .build( hyper_rustls::HttpsConnectorBuilder::new() .with_native_roots() .unwrap() .https_or_http() .enable_http2() .build() ); let mut hub = Gmail::new(client, auth); // As the method needs a request, you would usually fill it with the desired information // into the respective structure. Some of the parts shown here might not be applicable ! // Values shown here are possibly random and not representative ! let mut req = Message::default(); // You can configure optional parameters by calling the respective setters at will, and ``` -------------------------------- ### Complete Library Usage Example Source: https://docs.rs/google-gmail1 A full example demonstrating authentication, hub initialization, and performing a resumable upload. ```rust extern crate hyper; extern crate hyper_rustls; extern crate google_gmail1 as gmail1; use gmail1::api::Message; use gmail1::{Result, Error}; use std::fs; use gmail1::{Gmail, FieldMask, hyper_rustls, hyper_util, yup_oauth2}; // Get an ApplicationSecret instance by some means. It contains the `client_id` and // `client_secret`, among other things. let secret: yup_oauth2::ApplicationSecret = Default::default(); // Instantiate the authenticator. It will choose a suitable authentication flow for you, // unless you replace `None` with the desired Flow. // Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about // what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and // retrieve them from storage. let connector = hyper_rustls::HttpsConnectorBuilder::new() .with_native_roots() .unwrap() .https_only() .enable_http2() .build(); let executor = hyper_util::rt::TokioExecutor::new(); let auth = yup_oauth2::InstalledFlowAuthenticator::with_client( secret, yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect, yup_oauth2::client::CustomHyperClientBuilder::from( hyper_util::client::legacy::Client::builder(executor).build(connector), ), ).build().await.unwrap(); let client = hyper_util::client::legacy::Client::builder( hyper_util::rt::TokioExecutor::new() ) .build( hyper_rustls::HttpsConnectorBuilder::new() .with_native_roots() .unwrap() .https_or_http() .enable_http2() .build() ); let mut hub = Gmail::new(client, auth); // As the method needs a request, you would usually fill it with the desired information // into the respective structure. Some of the parts shown here might not be applicable ! // Values shown here are possibly random and not representative ! let mut req = Message::default(); // You can configure optional parameters by calling the respective setters at will, and // execute the final call using `upload_resumable(...)`. // Values shown here are possibly random and not representative ! let result = hub.users().messages_import(req, "userId") .process_for_calendar(true) .never_mark_spam(true) .internal_date_source("Lorem") .deleted(false) .upload_resumable(fs::File::open("file.ext").unwrap(), "application/octet-stream".parse().unwrap()).await; ``` -------------------------------- ### Example: using threads_list builder Source: https://docs.rs/google-gmail1/latest/google_gmail1/api/struct.UserThreadListCall.html Example of instantiating and executing the `threads_list` builder. Optional parameters are set via chained setters and the final call is executed with `doit().await`. ```rust // You can configure optional parameters by calling the respective setters at will, and // execute the final call using `doit()`. // Values shown here are possibly random and not representative ! let result = hub.users().threads_list("userId") .q("At") .page_token("dolor") .max_results(79) .add_label_ids("sit") .include_spam_trash(false) .doit().await; ``` -------------------------------- ### Instantiate a resource method builder Source: https://docs.rs/google-gmail1/latest/google_gmail1/api/struct.UserSettingCseKeypairGetCall.html Example showing how to configure and execute the settings.cse.keypairs.get method using the hub. ```rust // You can configure optional parameters by calling the respective setters at will, and // execute the final call using `doit()`. // Values shown here are possibly random and not representative ! let result = hub.users().settings_cse_keypairs_get("userId", "keyPairId") .doit().await; ``` -------------------------------- ### UserSettingSendASmimeInfoGetCall struct and usage example Source: https://docs.rs/google-gmail1/latest/google_gmail1/api/struct.UserSettingSendASmimeInfoGetCall.html The struct definition and a usage example for the builder method. The example shows how to call the method with required parameters and execute it with `doit().await`. ```rust pub struct UserSettingSendASmimeInfoGetCall<'a, C> where C: 'a, { /* private fields */ } ``` ```rust // You can configure optional parameters by calling the respective setters at will, and // execute the final call using `doit()`. // Values shown here are possibly random and not representative ! let result = hub.users().settings_send_as_smime_info_get("userId", "sendAsEmail", "id") .doit().await; ``` -------------------------------- ### Instantiate UserSettingForwardingAddressListCall builder Source: https://docs.rs/google-gmail1/latest/google_gmail1/api/struct.UserSettingForwardingAddressListCall.html Example of instantiating a resource method builder for the settings.forwardingAddresses.list method. The example shows how to call the method with a user ID and execute the request using doit(). ```rust // You can configure optional parameters by calling the respective setters at will, and // execute the final call using `doit()`. // Values shown here are possibly random and not representative ! let result = hub.users().settings_forwarding_addresses_list("userId") .doit().await; ``` -------------------------------- ### Instantiate a resource method builder Source: https://docs.rs/google-gmail1/latest/google_gmail1/api/struct.UserSettingSendAVerifyCall.html Example showing how to configure and execute the settings_send_as_verify method using a hub instance. ```rust // You can configure optional parameters by calling the respective setters at will, and // execute the final call using `doit()`. // Values shown here are possibly random and not representative ! let result = hub.users().settings_send_as_verify("userId", "sendAsEmail") .doit().await; ``` -------------------------------- ### Example: Instantiate a resource method builder Source: https://docs.rs/google-gmail1/latest/google_gmail1/api/struct.UserThreadTrashCall.html Shows how to create a UserThreadTrashCall builder using the UserMethods instance and execute the trash operation with doit(). The example uses placeholder values for userId and id. ```rust // You can configure optional parameters by calling the respective setters at will, and // execute the final call using `doit()`. // Values shown here are possibly random and not representative ! let result = hub.users().threads_trash("userId", "id") .doit().await; ``` -------------------------------- ### Instantiate a resource builder Source: https://docs.rs/google-gmail1/latest/google_gmail1/api/struct.UserMethods.html Example showing how to instantiate the Gmail hub and access the user resource builder. ```rust extern crate hyper; extern crate hyper_rustls; extern crate google_gmail1 as gmail1; use gmail1::{Gmail, FieldMask, hyper_rustls, hyper_util, yup_oauth2}; let secret: yup_oauth2::ApplicationSecret = Default::default(); let connector = hyper_rustls::HttpsConnectorBuilder::new() .with_native_roots() .unwrap() .https_only() .enable_http2() .build(); let executor = hyper_util::rt::TokioExecutor::new(); let auth = yup_oauth2::InstalledFlowAuthenticator::with_client( secret, yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect, yup_oauth2::client::CustomHyperClientBuilder::from( hyper_util::client::legacy::Client::builder(executor).build(connector), ), ).build().await.unwrap(); let client = hyper_util::client::legacy::Client::builder( hyper_util::rt::TokioExecutor::new() ) .build( hyper_rustls::HttpsConnectorBuilder::new() .with_native_roots() .unwrap() .https_or_http() .enable_http2() .build() ); let mut hub = Gmail::new(client, auth); // Usually you wouldn't bind this to a variable, but keep calling *CallBuilders* // like `drafts_create(...)`, `drafts_delete(...)`, `drafts_get(...)`, `drafts_list(...)`, `drafts_send(...)`, `drafts_update(...)`, `get_profile(...)`, `history_list(...)`, `labels_create(...)`, `labels_delete(...)`, `labels_get(...)`, `labels_list(...)`, `labels_patch(...)`, `labels_update(...)`, `messages_attachments_get(...)`, `messages_batch_delete(...)`, `messages_batch_modify(...)`, `messages_delete(...)`, `messages_get(...)`, `messages_import(...)`, `messages_insert(...)`, `messages_list(...)`, `messages_modify(...)`, `messages_send(...)`, `messages_trash(...)`, `messages_untrash(...)`, `settings_cse_identities_create(...)`, `settings_cse_identities_delete(...)`, `settings_cse_identities_get(...)`, `settings_cse_identities_list(...)`, `settings_cse_identities_patch(...)`, `settings_cse_keypairs_create(...)`, `settings_cse_keypairs_disable(...)`, `settings_cse_keypairs_enable(...)`, `settings_cse_keypairs_get(...)`, `settings_cse_keypairs_list(...)`, `settings_cse_keypairs_obliterate(...)`, `settings_delegates_create(...)`, `settings_delegates_delete(...)`, `settings_delegates_get(...)`, `settings_delegates_list(...)`, `settings_filters_create(...)`, `settings_filters_delete(...)`, `settings_filters_get(...)`, `settings_filters_list(...)`, `settings_forwarding_addresses_create(...)`, `settings_forwarding_addresses_delete(...)`, `settings_forwarding_addresses_get(...)`, `settings_forwarding_addresses_list(...)`, `settings_get_auto_forwarding(...)`, `settings_get_imap(...)`, `settings_get_language(...)`, `settings_get_pop(...)`, `settings_get_vacation(...)`, `settings_send_as_create(...)`, `settings_send_as_delete(...)`, `settings_send_as_get(...)`, `settings_send_as_list(...)`, `settings_send_as_patch(...)`, `settings_send_as_smime_info_delete(...)`, `settings_send_as_smime_info_get(...)`, `settings_send_as_smime_info_insert(...)`, `settings_send_as_smime_info_list(...)`, `settings_send_as_smime_info_set_default(...)`, `settings_send_as_update(...)`, `settings_send_as_verify(...)`, `settings_update_auto_forwarding(...)`, `settings_update_imap(...)`, `settings_update_language(...)`, `settings_update_pop(...)`, `settings_update_vacation(...)`, `stop(...)`, `threads_delete(...)`, `threads_get(...)`, `threads_list(...)`, `threads_modify(...)`, `threads_trash(...)`, `threads_untrash(...)` and `watch(...)` // to build up your call. let rb = hub.users(); ``` -------------------------------- ### Instantiate a resource method builder Source: https://docs.rs/google-gmail1/latest/google_gmail1/api/struct.UserSettingSendASmimeInfoListCall.html Example showing how to configure and execute the list method using the hub. ```rust // You can configure optional parameters by calling the respective setters at will, and // execute the final call using `doit()`. // Values shown here are possibly random and not representative ! let result = hub.users().settings_send_as_smime_info_list("userId", "sendAsEmail") .doit().await; ``` -------------------------------- ### Instantiate a resource method builder Source: https://docs.rs/google-gmail1/latest/google_gmail1/api/struct.UserSettingSendACreateCall.html Example showing how to prepare a request and execute the settings_send_as_create method using a hub instance. ```rust use gmail1::api::SendAs; // As the method needs a request, you would usually fill it with the desired information // into the respective structure. Some of the parts shown here might not be applicable ! // Values shown here are possibly random and not representative ! let mut req = SendAs::default(); // You can configure optional parameters by calling the respective setters at will, and // execute the final call using `doit()`. // Values shown here are possibly random and not representative ! let result = hub.users().settings_send_as_create(req, "userId") .doit().await; ``` -------------------------------- ### Instantiate a resource method builder Source: https://docs.rs/google-gmail1/latest/google_gmail1/api/struct.UserSettingSendAUpdateCall.html Example showing how to prepare a request and execute the settings_send_as_update method using a hub instance. ```rust use gmail1::api::SendAs; // As the method needs a request, you would usually fill it with the desired information // into the respective structure. Some of the parts shown here might not be applicable ! // Values shown here are possibly random and not representative ! let mut req = SendAs::default(); // You can configure optional parameters by calling the respective setters at will, and // execute the final call using `doit()`. // Values shown here are possibly random and not representative ! let result = hub.users().settings_send_as_update(req, "userId", "sendAsEmail") .doit().await; ``` -------------------------------- ### Instantiate a resource method builder Source: https://docs.rs/google-gmail1/latest/google_gmail1/api/struct.UserSettingSendADeleteCall.html Example showing how to configure and execute the settings_send_as_delete method using a builder. ```rust // You can configure optional parameters by calling the respective setters at will, and // execute the final call using `doit()`. // Values shown here are possibly random and not representative ! let result = hub.users().settings_send_as_delete("userId", "sendAsEmail") .doit().await; ``` -------------------------------- ### Instantiate a resource method builder Source: https://docs.rs/google-gmail1/latest/google_gmail1/api/struct.UserSettingDelegateGetCall.html Example showing how to configure and execute the settings_delegates_get method via a hub instance. ```rust // You can configure optional parameters by calling the respective setters at will, and // execute the final call using `doit()`. // Values shown here are possibly random and not representative ! let result = hub.users().settings_delegates_get("userId", "delegateEmail") .doit().await; ``` -------------------------------- ### Example: instantiate and execute settings.filters.list Source: https://docs.rs/google-gmail1/latest/google_gmail1/api/struct.UserSettingFilterListCall.html Shows how to create a builder for the settings.filters.list method and execute it with doit(). The user_id parameter is required. ```rust // You can configure optional parameters by calling the respective setters at will, and // execute the final call using `doit()`. // Values shown here are possibly random and not representative ! let result = hub.users().settings_filters_list("userId") .doit().await; ``` -------------------------------- ### Instantiate a resource method builder Source: https://docs.rs/google-gmail1/latest/google_gmail1/api/struct.UserSettingUpdateLanguageCall.html Example showing how to prepare a LanguageSettings request and execute the update language call using the hub. ```rust use gmail1::api::LanguageSettings; // As the method needs a request, you would usually fill it with the desired information // into the respective structure. Some of the parts shown here might not be applicable ! // Values shown here are possibly random and not representative ! let mut req = LanguageSettings::default(); // You can configure optional parameters by calling the respective setters at will, and // execute the final call using `doit()`. // Values shown here are possibly random and not representative ! let result = hub.users().settings_update_language(req, "userId") .doit().await; ``` -------------------------------- ### Instantiate and execute a resource method builder Source: https://docs.rs/google-gmail1/latest/google_gmail1/api/struct.UserSettingSendAGetCall.html Example of how to configure and execute the settings_send_as_get method using the builder pattern. ```rust // You can configure optional parameters by calling the respective setters at will, and // execute the final call using `doit()`. // Values shown here are possibly random and not representative ! let result = hub.users().settings_send_as_get("userId", "sendAsEmail") .doit().await; ``` -------------------------------- ### Instantiate a resource method builder Source: https://docs.rs/google-gmail1/latest/google_gmail1/api/struct.UserSettingSendASmimeInfoDeleteCall.html Example showing how to configure and execute the delete call using the hub. ```rust // You can configure optional parameters by calling the respective setters at will, and // execute the final call using `doit()`. // Values shown here are possibly random and not representative ! let result = hub.users().settings_send_as_smime_info_delete("userId", "sendAsEmail", "id") .doit().await; ``` -------------------------------- ### Instantiate a resource method builder Source: https://docs.rs/google-gmail1/latest/google_gmail1/api/struct.UserSettingUpdatePopCall.html Example showing how to instantiate a resource method builder for updating POP settings. ```rust use gmail1::api::PopSettings; // As the method needs a request, you would usually fill it with the desired information // into the respective structure. Some of the parts shown here might not be applicable ! // Values shown here are possibly random and not representative ! let mut req = PopSettings::default(); // You can configure optional parameters by calling the respective setters at will, and // execute the final call using `doit()`. // Values shown here are possibly random and not representative ! let result = hub.users().settings_update_pop(req, "userId") .doit().await; ``` -------------------------------- ### Instantiate and execute a resource method builder Source: https://docs.rs/google-gmail1/latest/google_gmail1/api/struct.UserSettingCseIdentityListCall.html Example showing how to configure optional parameters and execute the settings.cse.identities.list method using doit(). ```rust // You can configure optional parameters by calling the respective setters at will, and // execute the final call using `doit()`. // Values shown here are possibly random and not representative ! let result = hub.users().settings_cse_identities_list("userId") .page_token("voluptua.") .page_size(-2) .doit().await; ``` -------------------------------- ### Instantiate a resource method builder Source: https://docs.rs/google-gmail1/latest/google_gmail1/api/struct.UserSettingSendAListCall.html Example showing how to initiate the list operation for send-as aliases using the hub. ```rust // You can configure optional parameters by calling the respective setters at will, and // execute the final call using `doit()`. // Values shown here are possibly random and not representative ! let result = hub.users().settings_send_as_list("userId") .doit().await; ``` -------------------------------- ### Instantiate a resource method builder Source: https://docs.rs/google-gmail1/latest/google_gmail1/api/struct.UserSettingFilterDeleteCall.html Example of how to configure and execute the delete filter operation. ```rust // You can configure optional parameters by calling the respective setters at will, and // execute the final call using `doit()`. // Values shown here are possibly random and not representative ! let result = hub.users().settings_filters_delete("userId", "id") .doit().await; ``` -------------------------------- ### Instantiate a resource method builder Source: https://docs.rs/google-gmail1/latest/google_gmail1/api/struct.UserSettingUpdateVacationCall.html Example showing how to prepare a VacationSettings request and execute the update vacation call using the hub. ```rust use gmail1::api::VacationSettings; // As the method needs a request, you would usually fill it with the desired information // into the respective structure. Some of the parts shown here might not be applicable ! // Values shown here are possibly random and not representative ! let mut req = VacationSettings::default(); // You can configure optional parameters by calling the respective setters at will, and // execute the final call using `doit()`. // Values shown here are possibly random and not representative ! let result = hub.users().settings_update_vacation(req, "userId") .doit().await; ``` -------------------------------- ### Instantiate and Use Gmail Hub Source: https://docs.rs/google-gmail1/latest/google_gmail1/api/struct.Gmail.html Example showing how to instantiate the Gmail hub with authentication and perform a resumable upload request. ```rust extern crate hyper; extern crate hyper_rustls; extern crate google_gmail1 as gmail1; use gmail1::api::Message; use gmail1::{Result, Error}; use std::fs; use gmail1::{Gmail, FieldMask, hyper_rustls, hyper_util, yup_oauth2}; // Get an ApplicationSecret instance by some means. It contains the `client_id` and // `client_secret`, among other things. let secret: yup_oauth2::ApplicationSecret = Default::default(); // Instantiate the authenticator. It will choose a suitable authentication flow for you, // unless you replace `None` with the desired Flow. // Provide your own `AuthenticatorDelegate` to adjust the way it operates and get feedback about // what's going on. You probably want to bring in your own `TokenStorage` to persist tokens and // retrieve them from storage. let connector = hyper_rustls::HttpsConnectorBuilder::new() .with_native_roots() .unwrap() .https_only() .enable_http2() .build(); let executor = hyper_util::rt::TokioExecutor::new(); let auth = yup_oauth2::InstalledFlowAuthenticator::with_client( secret, yup_oauth2::InstalledFlowReturnMethod::HTTPRedirect, yup_oauth2::client::CustomHyperClientBuilder::from( hyper_util::client::legacy::Client::builder(executor).build(connector), ), ).build().await.unwrap(); let client = hyper_util::client::legacy::Client::builder( hyper_util::rt::TokioExecutor::new() ) .build( hyper_rustls::HttpsConnectorBuilder::new() .with_native_roots() .unwrap() .https_or_http() .enable_http2() .build() ); let mut hub = Gmail::new(client, auth); // As the method needs a request, you would usually fill it with the desired information // into the respective structure. Some of the parts shown here might not be applicable ! // Values shown here are possibly random and not representative ! let mut req = Message::default(); // You can configure optional parameters by calling the respective setters at will, and // execute the final call using `upload_resumable(...)`. // Values shown here are possibly random and not representative ! let result = hub.users().messages_import(req, "userId") .process_for_calendar(true) .never_mark_spam(false) .internal_date_source("amet") .deleted(true) .upload_resumable(fs::File::open("file.ext").unwrap(), "application/octet-stream".parse().unwrap()).await; match result { Err(e) => match e { // The Error enum provides details about what exactly happened. // You can also just use its `Debug`, `Display` or `Error` traits Error::HttpError(_) |Error::Io(_) |Error::MissingAPIKey |Error::MissingToken(_) |Error::Cancelled |Error::UploadSizeLimitExceeded(_, _) |Error::Failure(_) |Error::BadRequest(_) |Error::FieldClash(_) |Error::JsonDecodeError(_, _) => println!("{}", e), }, Ok(res) => println!("Success: {:?}", res), } ``` -------------------------------- ### Instantiate a resource method builder Source: https://docs.rs/google-gmail1/latest/google_gmail1/api/struct.UserSettingFilterCreateCall.html Example showing how to instantiate a resource method builder and execute the settings.filters.create call. ```rust use gmail1::api::Filter; // As the method needs a request, you would usually fill it with the desired information // into the respective structure. Some of the parts shown here might not be applicable ! // Values shown here are possibly random and not representative ! let mut req = Filter::default(); // You can configure optional parameters by calling the respective setters at will, and // execute the final call using `doit()`. // Values shown here are possibly random and not representative ! let result = hub.users().settings_filters_create(req, "userId") .doit().await; ``` -------------------------------- ### Instantiate a resource method builder Source: https://docs.rs/google-gmail1/latest/google_gmail1/api/struct.UserDraftCreateCall.html Example showing how to prepare a draft request and execute the create method using upload_resumable. ```rust use gmail1::api::Draft; use std::fs; // As the method needs a request, you would usually fill it with the desired information // into the respective structure. Some of the parts shown here might not be applicable ! // Values shown here are possibly random and not representative ! let mut req = Draft::default(); // You can configure optional parameters by calling the respective setters at will, and // execute the final call using `upload_resumable(...)`. // Values shown here are possibly random and not representative ! let result = hub.users().drafts_create(req, "userId") .upload_resumable(fs::File::open("file.ext").unwrap(), "application/octet-stream".parse().unwrap()).await; ``` -------------------------------- ### Instantiate and Execute Method Builder Source: https://docs.rs/google-gmail1/latest/google_gmail1/api/struct.UserSettingGetLanguageCall.html Example of how to configure and execute the settings.getLanguage method using the builder pattern. ```rust // You can configure optional parameters by calling the respective setters at will, and // execute the final call using `doit()`. // Values shown here are possibly random and not representative ! let result = hub.users().settings_get_language("userId") .doit().await; ``` -------------------------------- ### Instantiate a resource method builder Source: https://docs.rs/google-gmail1/latest/google_gmail1/api/struct.UserSettingUpdateAutoForwardingCall.html Example showing how to prepare the AutoForwarding request and execute the update call using the hub. ```rust use gmail1::api::AutoForwarding; // As the method needs a request, you would usually fill it with the desired information // into the respective structure. Some of the parts shown here might not be applicable ! // Values shown here are possibly random and not representative ! let mut req = AutoForwarding::default(); // You can configure optional parameters by calling the respective setters at will, and // execute the final call using `doit()`. // Values shown here are possibly random and not representative ! let result = hub.users().settings_update_auto_forwarding(req, "userId") .doit().await; ``` -------------------------------- ### Instantiate a resource method builder Source: https://docs.rs/google-gmail1/latest/google_gmail1/api/struct.UserLabelPatchCall.html Example showing how to prepare a Label request and execute the labels_patch method using the hub. ```rust use gmail1::api::Label; // As the method needs a request, you would usually fill it with the desired information // into the respective structure. Some of the parts shown here might not be applicable ! // Values shown here are possibly random and not representative ! let mut req = Label::default(); // You can configure optional parameters by calling the respective setters at will, and // execute the final call using `doit()`. // Values shown here are possibly random and not representative ! let result = hub.users().labels_patch(req, "userId", "id") .doit().await; ``` -------------------------------- ### Instantiate a resource method builder Source: https://docs.rs/google-gmail1/latest/google_gmail1/api/struct.UserGetProfileCall.html Example of how to configure and execute a get_profile request using the builder pattern. ```rust // You can configure optional parameters by calling the respective setters at will, and // execute the final call using `doit()`. // Values shown here are possibly random and not representative ! let result = hub.users().get_profile("userId") .doit().await; ``` -------------------------------- ### Instantiate a resource method builder Source: https://docs.rs/google-gmail1/latest/google_gmail1/api/struct.UserSettingCseIdentityGetCall.html Example showing how to configure and execute the settings.cse.identities.get method using the builder pattern. ```rust // You can configure optional parameters by calling the respective setters at will, and // execute the final call using `doit()`. // Values shown here are possibly random and not representative ! let result = hub.users().settings_cse_identities_get("userId", "cseEmailAddress") .doit().await; ``` -------------------------------- ### Instantiate a resource method builder Source: https://docs.rs/google-gmail1/latest/google_gmail1/api/struct.UserMessageInsertCall.html Example showing how to configure and execute a messages.insert call using the builder pattern. ```rust use gmail1::api::Message; use std::fs; // As the method needs a request, you would usually fill it with the desired information // into the respective structure. Some of the parts shown here might not be applicable ! // Values shown here are possibly random and not representative ! let mut req = Message::default(); // You can configure optional parameters by calling the respective setters at will, and // execute the final call using `upload_resumable(...)`. // Values shown here are possibly random and not representative ! let result = hub.users().messages_insert(req, "userId") .internal_date_source("Lorem") .deleted(true) .upload_resumable(fs::File::open("file.ext").unwrap(), "application/octet-stream".parse().unwrap()).await; ``` -------------------------------- ### Instantiate a resource method builder Source: https://docs.rs/google-gmail1/latest/google_gmail1/api/struct.UserSettingForwardingAddressCreateCall.html Example showing how to configure and execute the forwarding address creation request using the builder pattern. ```rust use gmail1::api::ForwardingAddress; // As the method needs a request, you would usually fill it with the desired information // into the respective structure. Some of the parts shown here might not be applicable ! // Values shown here are possibly random and not representative ! let mut req = ForwardingAddress::default(); // You can configure optional parameters by calling the respective setters at will, and // execute the final call using `doit()`. // Values shown here are possibly random and not representative ! let result = hub.users().settings_forwarding_addresses_create(req, "userId") .doit().await; ``` -------------------------------- ### Instantiate a resource method builder Source: https://docs.rs/google-gmail1/latest/google_gmail1/api/struct.UserSettingCseIdentityPatchCall.html Example showing how to configure and execute the settings_cse_identities_patch method using the builder pattern. ```rust use gmail1::api::CseIdentity; // As the method needs a request, you would usually fill it with the desired information // into the respective structure. Some of the parts shown here might not be applicable ! // Values shown here are possibly random and not representative ! let mut req = CseIdentity::default(); // You can configure optional parameters by calling the respective setters at will, and // execute the final call using `doit()`. // Values shown here are possibly random and not representative ! let result = hub.users().settings_cse_identities_patch(req, "userId", "emailAddress") .doit().await; ``` -------------------------------- ### Instantiate a resource method builder Source: https://docs.rs/google-gmail1/latest/google_gmail1/api/struct.UserMessageBatchDeleteCall.html Example showing how to prepare a BatchDeleteMessagesRequest and execute the messages_batch_delete method using the hub. ```rust use gmail1::api::BatchDeleteMessagesRequest; // As the method needs a request, you would usually fill it with the desired information // into the respective structure. Some of the parts shown here might not be applicable ! // Values shown here are possibly random and not representative ! let mut req = BatchDeleteMessagesRequest::default(); // You can configure optional parameters by calling the respective setters at will, and // execute the final call using `doit()`. // Values shown here are possibly random and not representative ! let result = hub.users().messages_batch_delete(req, "userId") .doit().await; ``` -------------------------------- ### Instantiate a resource method builder Source: https://docs.rs/google-gmail1/latest/google_gmail1/api/struct.UserThreadGetCall.html Example showing how to configure optional parameters and execute the threads_get method using the builder pattern. ```rust // You can configure optional parameters by calling the respective setters at will, and // execute the final call using `doit()`. // Values shown here are possibly random and not representative ! let result = hub.users().threads_get("userId", "id") .add_metadata_headers("takimata") .format("Lorem") .doit().await; ``` -------------------------------- ### Instantiate a resource method builder Source: https://docs.rs/google-gmail1/latest/google_gmail1/api/struct.UserLabelUpdateCall.html Example showing how to prepare a Label request and execute the labels_update method using the builder pattern. ```rust use gmail1::api::Label; // As the method needs a request, you would usually fill it with the desired information // into the respective structure. Some of the parts shown here might not be applicable ! // Values shown here are possibly random and not representative ! let mut req = Label::default(); // You can configure optional parameters by calling the respective setters at will, and // execute the final call using `doit()`. // Values shown here are possibly random and not representative ! let result = hub.users().labels_update(req, "userId", "id") .doit().await; ``` -------------------------------- ### Example: Delete Message Source: https://docs.rs/google-gmail1/latest/google_gmail1/api/struct.UserMessageDeleteCall.html Example of instantiating a resource method builder and executing the delete call with doit(). ```rust // You can configure optional parameters by calling the respective setters at will, and // execute the final call using `doit()`. // Values shown here are possibly random and not representative ! let result = hub.users().messages_delete("userId", "id") .doit().await; ``` -------------------------------- ### Example: Instantiate a resource method builder Source: https://docs.rs/google-gmail1/latest/google_gmail1/api/struct.UserSettingDelegateCreateCall.html Shows how to create a `Delegate` request, configure optional parameters, and execute the `settings_delegates_create` call with `doit().await`. ```rust use gmail1::api::Delegate; // As the method needs a request, you would usually fill it with the desired information // into the respective structure. Some of the parts shown here might not be applicable ! // Values shown here are possibly random and not representative ! let mut req = Delegate::default(); // You can configure optional parameters by calling the respective setters at will, and // execute the final call using `doit()`. // Values shown here are possibly random and not representative ! let result = hub.users().settings_delegates_create(req, "userId") .doit().await; ``` -------------------------------- ### Example: Instantiate and execute the method Source: https://docs.rs/google-gmail1/latest/google_gmail1/api/struct.UserSettingCseKeypairCreateCall.html Shows how to create a CseKeyPair request, configure optional parameters, and execute the call using the doit() method. ```rust use gmail1::api::CseKeyPair; // As the method needs a request, you would usually fill it with the desired information // into the respective structure. Some of the parts shown here might not be applicable ! // Values shown here are possibly random and not representative ! let mut req = CseKeyPair::default(); // You can configure optional parameters by calling the respective setters at will, and // execute the final call using `doit()`. // Values shown here are possibly random and not representative ! let result = hub.users().settings_cse_keypairs_create(req, "userId") .doit().await; ``` -------------------------------- ### Example: Delete forwarding address Source: https://docs.rs/google-gmail1/latest/google_gmail1/api/struct.UserSettingForwardingAddressDeleteCall.html Shows how to instantiate the builder and execute the delete call with optional parameters using the doit() method. ```rust // You can configure optional parameters by calling the respective setters at will, and // execute the final call using `doit()`. // Values shown here are possibly random and not representative ! let result = hub.users().settings_forwarding_addresses_delete("userId", "forwardingEmail") .doit().await; ``` -------------------------------- ### Example: delete a label using UserLabelDeleteCall Source: https://docs.rs/google-gmail1/latest/google_gmail1/api/struct.UserLabelDeleteCall.html Example of instantiating the builder and executing the delete operation with doit(). The user ID and label ID are required. ```rust // You can configure optional parameters by calling the respective setters at will, and // execute the final call using `doit()`. // Values shown here are possibly random and not representative ! let result = hub.users().labels_delete("userId", "id") .doit().await; ``` -------------------------------- ### Example: Instantiate a resource method builder Source: https://docs.rs/google-gmail1/latest/google_gmail1/api/struct.UserSettingCseIdentityCreateCall.html Shows how to create a `CseIdentity` request, configure optional parameters, and execute the `settings_cse_identities_create` method with `doit().await`. ```rust use gmail1::api::CseIdentity; // As the method needs a request, you would usually fill it with the desired information // into the respective structure. Some of the parts shown here might not be applicable ! // Values shown here are possibly random and not representative ! let mut req = CseIdentity::default(); // You can configure optional parameters by calling the respective setters at will, and // execute the final call using `doit()`. // Values shown here are possibly random and not representative ! let result = hub.users().settings_cse_identities_create(req, "userId") .doit().await; ``` -------------------------------- ### GET /gmail/v1/users/{userId}/settings/sendAs/{sendAsEmail} Source: https://docs.rs/google-gmail1/latest/google_gmail1/api/struct.UserSettingSendAGetCall.html Gets the specified send-as alias. Fails with an HTTP 404 error if the specified address is not a member of the collection. ```APIDOC ## GET /gmail/v1/users/{userId}/settings/sendAs/{sendAsEmail} ### Description Gets the specified send-as alias. Fails with an HTTP 404 error if the specified address is not a member of the collection. ### Method GET ### Endpoint /gmail/v1/users/{userId}/settings/sendAs/{sendAsEmail} ### Parameters #### Path Parameters - **userId** (string) - Required - User's email address. The special value "me" can be used to indicate the authenticated user. - **sendAsEmail** (string) - Required - The send-as alias to be retrieved. #### Query Parameters - **$.xgafv** (string) - Optional - V1 error format. - **access_token** (string) - Optional - OAuth access token. - **alt** (string) - Optional - Data format for response. - **callback** (string) - Optional - JSONP - **fields** (string) - Optional - Selector specifying which fields to include in a partial response. - **key** (string) - Optional - API key. Your API key identifies your project and provides you with API access, quota, and reports. Required unless you provide an OAuth 2.0 token. - **oauth_token** (string) - Optional - OAuth 2.0 token for the current user. - **prettyPrint** (boolean) - Optional - Returns response with indentations and line breaks. - **quotaUser** (string) - Optional - Available to use for quota purposes for server-side applications. Can be any arbitrary string assigned to a user, but should not exceed 40 characters. - **uploadType** (string) - Optional - Legacy upload protocol for media (e.g. "media", "multipart"). - **upload_protocol** (string) - Optional - Upload protocol for media (e.g. "raw", "multipart"). ### Request Example No request body is required for this operation. ### Response #### Success Response (200) - **SendAs** (object) - The send-as alias resource. #### Response Example { "sendAsEmail": "string", "displayName": "string", "replyToAddress": "string", "signature": "string", "isPrimary": false, "isDefault": false, "treatAsAlias": false, "smtpMsa": { "host": "string", "port": 0, "username": "string", "password": "string", "securityMode": "string" }, "verificationStatus": "string" } ### Error Handling - **404** - The specified address is not a member of the collection. ### Authorization Scopes - **https://www.googleapis.com/auth/gmail.readonly** (default) - Additional scopes can be added via the builder's `add_scope` method. ``` -------------------------------- ### Example: Instantiate and execute settings_get_imap Source: https://docs.rs/google-gmail1/latest/google_gmail1/api/struct.UserSettingGetImapCall.html Shows how to create a builder for the settings.getImap method and execute it with doit(). The user ID is provided as a string, and the result is awaited. ```rust // You can configure optional parameters by calling the respective setters at will, and // execute the final call using `doit()`. // Values shown here are possibly random and not representative ! let result = hub.users().settings_get_imap("userId") .doit().await; ``` -------------------------------- ### expect method Source: https://docs.rs/google-gmail1/latest/google_gmail1/type.Result.html Returns the contained Ok value or panics if the result is Err. Includes examples for basic usage and recommended message style. ```rust let x: Result = Err("emergency failure"); x.expect("Testing expect"); // panics with `Testing expect: emergency failure` ``` ```rust let path = std::env::var("IMPORTANT_PATH") .expect("env variable `IMPORTANT_PATH` should be set by `wrapper_script.sh`"); ``` -------------------------------- ### Example: creating a label with labels_create Source: https://docs.rs/google-gmail1/latest/google_gmail1/api/struct.UserLabelCreateCall.html Shows how to instantiate a Label request, build the labels_create call with a user ID, and execute it with doit(). Values shown are random and not representative. ```rust use gmail1::api::Label; // As the method needs a request, you would usually fill it with the desired information // into the respective structure. Some of the parts shown here might not be applicable ! // Values shown here are possibly random and not representative ! let mut req = Label::default(); // You can configure optional parameters by calling the respective setters at will, and // execute the final call using `doit()`. // Values shown here are possibly random and not representative ! let result = hub.users().labels_create(req, "userId") .doit().await; ``` -------------------------------- ### settings_get_pop Source: https://docs.rs/google-gmail1/latest/google_gmail1/api/struct.UserMethods.html Gets POP settings. ```APIDOC ## settings_get_pop ### Description Gets POP settings. ### Method GET ### Endpoint /users/{userId}/settings/pop ### Parameters #### Path Parameters - **userId** (string) - Required - User's email address. The special value "me" can be used to indicate the authenticated user. ### Response #### Success Response (200) - **accessWindow** (string) - The access window for POP. - **disposition** (string) - The disposition of messages after POP access. #### Response Example { "accessWindow": "allMail", "disposition": "archive" } ``` -------------------------------- ### Example: instantiate and execute UserStopCall Source: https://docs.rs/google-gmail1/latest/google_gmail1/api/struct.UserStopCall.html Shows how to create a UserStopCall builder via hub.users().stop("userId") and execute it with doit().await. Values shown are possibly random and not representative. ```rust // You can configure optional parameters by calling the respective setters at will, and // execute the final call using `doit()`. // Values shown here are possibly random and not representative ! let result = hub.users().stop("userId") .doit().await; ``` -------------------------------- ### settings_get_language Source: https://docs.rs/google-gmail1/latest/google_gmail1/api/struct.UserMethods.html Gets language settings. ```APIDOC ## settings_get_language ### Description Gets language settings. ### Method GET ### Endpoint /users/{userId}/settings/language ### Parameters #### Path Parameters - **userId** (string) - Required - User's email address. The special value "me" can be used to indicate the authenticated user. ### Response #### Success Response (200) - **displayLanguage** (string) - The language to display Gmail in. #### Response Example { "displayLanguage": "en" } ``` -------------------------------- ### settings_get_imap Source: https://docs.rs/google-gmail1/latest/google_gmail1/api/struct.UserMethods.html Gets IMAP settings. ```APIDOC ## settings_get_imap ### Description Gets IMAP settings. ### Method GET ### Endpoint /users/{userId}/settings/imap ### Parameters #### Path Parameters - **userId** (string) - Required - User's email address. The special value "me" can be used to indicate the authenticated user. ### Response #### Success Response (200) - **enabled** (boolean) - Whether IMAP is enabled. - **autoExpunge** (boolean) - Whether auto-expunge is enabled. #### Response Example { "enabled": true, "autoExpunge": true } ``` -------------------------------- ### Example: instantiate and execute settings_get_pop builder Source: https://docs.rs/google-gmail1/latest/google_gmail1/api/struct.UserSettingGetPopCall.html Shows how to create a `UserSettingGetPopCall` builder via `hub.users().settings_get_pop("userId")` and execute it with `doit().await`. Optional parameters can be set with setters before calling `doit()`. ```rust // You can configure optional parameters by calling the respective setters at will, and // execute the final call using `doit()`. // Values shown here are possibly random and not representative ! let result = hub.users().settings_get_pop("userId") .doit().await; ``` -------------------------------- ### settings_get_vacation Source: https://docs.rs/google-gmail1/latest/google_gmail1/api/struct.UserMethods.html Gets vacation responder settings. ```APIDOC ## settings_get_vacation ### Description Gets vacation responder settings. ### Method GET ### Endpoint /users/{userId}/settings/vacation ### Parameters #### Path Parameters - **userId** (string) - Required - User's email address. The special value "me" can be used to indicate the authenticated user. ### Response #### Success Response (200) - **enableAutoReply** (boolean) - Whether auto-reply is enabled. - **responseSubject** (string) - The subject of the auto-reply. - **responseBody** (string) - The body of the auto-reply. #### Response Example { "enableAutoReply": true, "responseSubject": "Out of office", "responseBody": "I am on vacation." } ``` -------------------------------- ### settings_filters_get Source: https://docs.rs/google-gmail1/latest/google_gmail1/api/struct.UserMethods.html Creates a builder to get a filter. ```APIDOC ## settings_filters_get ### Description Gets a filter. ### Method GET ### Endpoint /users/{userId}/settings/filters/{id} ### Parameters #### Path Parameters - **userId** (string) - Required - User's email address. The special value "me" can be used to indicate the authenticated user. - **id** (string) - Required - The ID of the filter to be fetched. ### Response #### Success Response (200) - **filter** (object) - The filter resource. #### Response Example { "id": "string", "criteria": {}, "action": {} } ``` -------------------------------- ### Usage example with SmimeInfo Source: https://docs.rs/google-gmail1/latest/google_gmail1/api/struct.UserSettingSendASmimeInfoInsertCall.html Shows how to create a SmimeInfo request, set optional parameters, and execute the insert call using doit(). Note that pkcs12 format is required for the key. ```rust use gmail1::api::SmimeInfo; // As the method needs a request, you would usually fill it with the desired information // into the respective structure. Some of the parts shown here might not be applicable ! // Values shown here are possibly random and not representative ! let mut req = SmimeInfo::default(); // You can configure optional parameters by calling the respective setters at will, and // execute the final call using `doit()`. // Values shown here are possibly random and not representative ! let result = hub.users().settings_send_as_smime_info_insert(req, "userId", "sendAsEmail") .doit().await; ``` -------------------------------- ### threads_get Source: https://docs.rs/google-gmail1/latest/google_gmail1/api/struct.UserMethods.html Creates a builder to get the specified thread. ```APIDOC ## threads_get ### Description Gets the specified thread. ### Method GET ### Endpoint /users/{userId}/threads/{id} ### Parameters #### Path Parameters - **userId** (string) - Required - The user's email address. The special value `me` can be used to indicate the authenticated user. - **id** (string) - Required - The ID of the thread to retrieve. ### Response #### Success Response (200) - **id** (string) - The ID of the thread. - **historyId** (string) - The ID of the last history record that modified this thread. - **messages** (array) - The list of messages in the thread. #### Response Example { "id": "threadId", "historyId": "historyId", "messages": [] } ``` -------------------------------- ### Struct definition Source: https://docs.rs/google-gmail1/latest/google_gmail1/api/struct.UserSettingForwardingAddressGetCall.html The internal structure definition for the forwarding address get call builder. ```rust pub struct UserSettingForwardingAddressGetCall<'a, C> where C: 'a, { /* private fields */ } ```