Struct gmail::GmailClient

source ·
pub struct GmailClient { /* private fields */ }

Implementations§

source§

impl GmailClient

source

pub fn from_env() -> Self

source

pub fn with_auth(authentication: GmailAuth) -> Self

source

pub fn new_with(client: Client, authentication: GmailAuth) -> Self

source§

impl GmailClient

source

pub fn drafts_list(&self, user_id: &str) -> FluentRequest<'_, DraftsListRequest>

Lists the drafts in the user’s mailbox.

source

pub fn drafts_create( &self, user_id: &str ) -> FluentRequest<'_, DraftsCreateRequest>

Creates a new draft with the DRAFT label.

source

pub fn drafts_send(&self, user_id: &str) -> FluentRequest<'_, DraftsSendRequest>

Sends the specified, existing draft to the recipients in the To, Cc, and Bcc headers.

source

pub fn drafts_get( &self, id: &str, user_id: &str ) -> FluentRequest<'_, DraftsGetRequest>

Gets the specified draft.

source

pub fn drafts_update( &self, id: &str, user_id: &str ) -> FluentRequest<'_, DraftsUpdateRequest>

Replaces a draft’s content.

source

pub fn drafts_delete( &self, id: &str, user_id: &str ) -> FluentRequest<'_, DraftsDeleteRequest>

Immediately and permanently deletes the specified draft. Does not simply trash it.

source

pub fn history_list( &self, user_id: &str ) -> FluentRequest<'_, HistoryListRequest>

Lists the history of all changes to the given mailbox. History results are returned in chronological order (increasing historyId).

source

pub fn labels_list(&self, user_id: &str) -> FluentRequest<'_, LabelsListRequest>

Lists all labels in the user’s mailbox.

source

pub fn labels_create( &self, user_id: &str ) -> FluentRequest<'_, LabelsCreateRequest>

Creates a new label.

source

pub fn labels_get( &self, id: &str, user_id: &str ) -> FluentRequest<'_, LabelsGetRequest>

Gets the specified label.

source

pub fn labels_update( &self, id: &str, user_id: &str ) -> FluentRequest<'_, LabelsUpdateRequest>

Updates the specified label.

source

pub fn labels_delete( &self, id: &str, user_id: &str ) -> FluentRequest<'_, LabelsDeleteRequest>

Immediately and permanently deletes the specified label and removes it from any messages and threads that it is applied to.

source

pub fn labels_patch( &self, id: &str, user_id: &str ) -> FluentRequest<'_, LabelsPatchRequest>

Patch the specified label.

source

pub fn messages_list( &self, user_id: &str ) -> FluentRequest<'_, MessagesListRequest>

Lists the messages in the user’s mailbox.

source

pub fn messages_insert( &self, user_id: &str ) -> FluentRequest<'_, MessagesInsertRequest>

Directly inserts a message into only this user’s mailbox similar to IMAP APPEND, bypassing most scanning and classification. Does not send a message.

source

pub fn messages_batch_delete( &self, user_id: &str ) -> FluentRequest<'_, MessagesBatchDeleteRequest>

Deletes many messages by message ID. Provides no guarantees that messages were not already deleted or even existed at all.

source

pub fn messages_batch_modify( &self, user_id: &str ) -> FluentRequest<'_, MessagesBatchModifyRequest>

Modifies the labels on the specified messages.

source

pub fn messages_import( &self, user_id: &str ) -> FluentRequest<'_, MessagesImportRequest>

Imports a message into only this user’s mailbox, with standard email delivery scanning and classification similar to receiving via SMTP. This method doesn’t perform SPF checks, so it might not work for some spam messages, such as those attempting to perform domain spoofing. This method does not send a message. Note: This function doesn’t trigger forwarding rules or filters set up by the user.

source

pub fn messages_send( &self, user_id: &str ) -> FluentRequest<'_, MessagesSendRequest>

Sends the specified message to the recipients in the To, Cc, and Bcc headers.

source

pub fn messages_get( &self, id: &str, user_id: &str ) -> FluentRequest<'_, MessagesGetRequest>

Gets the specified message.

source

pub fn messages_delete( &self, id: &str, user_id: &str ) -> FluentRequest<'_, MessagesDeleteRequest>

Immediately and permanently deletes the specified message. This operation cannot be undone. Prefer messages.trash instead.

source

pub fn messages_modify( &self, id: &str, user_id: &str ) -> FluentRequest<'_, MessagesModifyRequest>

Modifies the labels on the specified message.

source

pub fn messages_trash( &self, id: &str, user_id: &str ) -> FluentRequest<'_, MessagesTrashRequest>

Moves the specified message to the trash.

source

pub fn messages_untrash( &self, id: &str, user_id: &str ) -> FluentRequest<'_, MessagesUntrashRequest>

Removes the specified message from the trash.

source

pub fn messages_attachments_get( &self, id: &str, message_id: &str, user_id: &str ) -> FluentRequest<'_, MessagesAttachmentsGetRequest>

Gets the specified message attachment.

source

pub fn get_profile(&self, user_id: &str) -> FluentRequest<'_, GetProfileRequest>

Gets the current user’s Gmail profile.

source

pub fn settings_get_auto_forwarding( &self, user_id: &str ) -> FluentRequest<'_, SettingsGetAutoForwardingRequest>

Gets the auto-forwarding setting for the specified account.

source

pub fn settings_update_auto_forwarding( &self, user_id: &str ) -> FluentRequest<'_, SettingsUpdateAutoForwardingRequest>

Updates the auto-forwarding setting for the specified account. A verified forwarding address must be specified when auto-forwarding is enabled. This method is only available to service account clients that have been delegated domain-wide authority.

source

pub fn settings_delegates_list( &self, user_id: &str ) -> FluentRequest<'_, SettingsDelegatesListRequest>

Lists the delegates for the specified account. This method is only available to service account clients that have been delegated domain-wide authority.

source

pub fn settings_delegates_create( &self, user_id: &str ) -> FluentRequest<'_, SettingsDelegatesCreateRequest>

Adds a delegate with its verification status set directly to accepted, without sending any verification email. The delegate user must be a member of the same G Suite organization as the delegator user. Gmail imposes limitations on the number of delegates and delegators each user in a G Suite organization can have. These limits depend on your organization, but in general each user can have up to 25 delegates and up to 10 delegators. Note that a delegate user must be referred to by their primary email address, and not an email alias. Also note that when a new delegate is created, there may be up to a one minute delay before the new delegate is available for use. This method is only available to service account clients that have been delegated domain-wide authority.

source

pub fn settings_delegates_get( &self, delegate_email: &str, user_id: &str ) -> FluentRequest<'_, SettingsDelegatesGetRequest>

Gets the specified delegate. Note that a delegate user must be referred to by their primary email address, and not an email alias. This method is only available to service account clients that have been delegated domain-wide authority.

source

pub fn settings_delegates_delete( &self, delegate_email: &str, user_id: &str ) -> FluentRequest<'_, SettingsDelegatesDeleteRequest>

Removes the specified delegate (which can be of any verification status), and revokes any verification that may have been required for using it. Note that a delegate user must be referred to by their primary email address, and not an email alias. This method is only available to service account clients that have been delegated domain-wide authority.

source

pub fn settings_filters_list( &self, user_id: &str ) -> FluentRequest<'_, SettingsFiltersListRequest>

Lists the message filters of a Gmail user.

source

pub fn settings_filters_create( &self, user_id: &str ) -> FluentRequest<'_, SettingsFiltersCreateRequest>

Creates a filter. Note: you can only create a maximum of 1,000 filters.

source

pub fn settings_filters_get( &self, id: &str, user_id: &str ) -> FluentRequest<'_, SettingsFiltersGetRequest>

Gets a filter.

source

pub fn settings_filters_delete( &self, id: &str, user_id: &str ) -> FluentRequest<'_, SettingsFiltersDeleteRequest>

Deletes a filter.

source

pub fn settings_forwarding_addresses_list( &self, user_id: &str ) -> FluentRequest<'_, SettingsForwardingAddressesListRequest>

Lists the forwarding addresses for the specified account.

source

pub fn settings_forwarding_addresses_create( &self, user_id: &str ) -> FluentRequest<'_, SettingsForwardingAddressesCreateRequest>

Creates a forwarding address. If ownership verification is required, a message will be sent to the recipient and the resource’s verification status will be set to pending; otherwise, the resource will be created with verification status set to accepted. This method is only available to service account clients that have been delegated domain-wide authority.

source

pub fn settings_forwarding_addresses_get( &self, forwarding_email: &str, user_id: &str ) -> FluentRequest<'_, SettingsForwardingAddressesGetRequest>

Gets the specified forwarding address.

source

pub fn settings_forwarding_addresses_delete( &self, forwarding_email: &str, user_id: &str ) -> FluentRequest<'_, SettingsForwardingAddressesDeleteRequest>

Deletes the specified forwarding address and revokes any verification that may have been required. This method is only available to service account clients that have been delegated domain-wide authority.

source

pub fn settings_get_imap( &self, user_id: &str ) -> FluentRequest<'_, SettingsGetImapRequest>

Gets IMAP settings.

source

pub fn settings_update_imap( &self, user_id: &str ) -> FluentRequest<'_, SettingsUpdateImapRequest>

Updates IMAP settings.

source

pub fn settings_get_language( &self, user_id: &str ) -> FluentRequest<'_, SettingsGetLanguageRequest>

Gets language settings.

source

pub fn settings_update_language( &self, user_id: &str ) -> FluentRequest<'_, SettingsUpdateLanguageRequest>

Updates language settings. If successful, the return object contains the displayLanguage that was saved for the user, which may differ from the value passed into the request. This is because the requested displayLanguage may not be directly supported by Gmail but have a close variant that is, and so the variant may be chosen and saved instead.

source

pub fn settings_get_pop( &self, user_id: &str ) -> FluentRequest<'_, SettingsGetPopRequest>

Gets POP settings.

source

pub fn settings_update_pop( &self, user_id: &str ) -> FluentRequest<'_, SettingsUpdatePopRequest>

Updates POP settings.

source

pub fn settings_send_as_list( &self, user_id: &str ) -> FluentRequest<'_, SettingsSendAsListRequest>

Lists the send-as aliases for the specified account. The result includes the primary send-as address associated with the account as well as any custom “from” aliases.

source

pub fn settings_send_as_create( &self, user_id: &str ) -> FluentRequest<'_, SettingsSendAsCreateRequest>

Creates a custom “from” send-as alias. If an SMTP MSA is specified, Gmail will attempt to connect to the SMTP service to validate the configuration before creating the alias. If ownership verification is required for the alias, a message will be sent to the email address and the resource’s verification status will be set to pending; otherwise, the resource will be created with verification status set to accepted. If a signature is provided, Gmail will sanitize the HTML before saving it with the alias. This method is only available to service account clients that have been delegated domain-wide authority.

source

pub fn settings_send_as_get( &self, send_as_email: &str, user_id: &str ) -> FluentRequest<'_, SettingsSendAsGetRequest>

Gets the specified send-as alias. Fails with an HTTP 404 error if the specified address is not a member of the collection.

source

pub fn settings_send_as_update( &self, send_as_email: &str, user_id: &str ) -> FluentRequest<'_, SettingsSendAsUpdateRequest>

Updates a send-as alias. If a signature is provided, Gmail will sanitize the HTML before saving it with the alias. Addresses other than the primary address for the account can only be updated by service account clients that have been delegated domain-wide authority.

source

pub fn settings_send_as_delete( &self, send_as_email: &str, user_id: &str ) -> FluentRequest<'_, SettingsSendAsDeleteRequest>

Deletes the specified send-as alias. Revokes any verification that may have been required for using it. This method is only available to service account clients that have been delegated domain-wide authority.

source

pub fn settings_send_as_patch( &self, send_as_email: &str, user_id: &str ) -> FluentRequest<'_, SettingsSendAsPatchRequest>

Patch the specified send-as alias.

source

pub fn settings_send_as_smime_info_list( &self, send_as_email: &str, user_id: &str ) -> FluentRequest<'_, SettingsSendAsSmimeInfoListRequest>

Lists S/MIME configs for the specified send-as alias.

source

pub fn settings_send_as_smime_info_insert( &self, send_as_email: &str, user_id: &str ) -> FluentRequest<'_, SettingsSendAsSmimeInfoInsertRequest>

Insert (upload) the given S/MIME config for the specified send-as alias. Note that pkcs12 format is required for the key.

source

pub fn settings_send_as_smime_info_get( &self, id: &str, send_as_email: &str, user_id: &str ) -> FluentRequest<'_, SettingsSendAsSmimeInfoGetRequest>

Gets the specified S/MIME config for the specified send-as alias.

source

pub fn settings_send_as_smime_info_delete( &self, id: &str, send_as_email: &str, user_id: &str ) -> FluentRequest<'_, SettingsSendAsSmimeInfoDeleteRequest>

Deletes the specified S/MIME config for the specified send-as alias.

source

pub fn settings_send_as_smime_info_set_default( &self, id: &str, send_as_email: &str, user_id: &str ) -> FluentRequest<'_, SettingsSendAsSmimeInfoSetDefaultRequest>

Sets the default S/MIME config for the specified send-as alias.

source

pub fn settings_send_as_verify( &self, send_as_email: &str, user_id: &str ) -> FluentRequest<'_, SettingsSendAsVerifyRequest>

Sends a verification email to the specified send-as alias address. The verification status must be pending. This method is only available to service account clients that have been delegated domain-wide authority.

source

pub fn settings_get_vacation( &self, user_id: &str ) -> FluentRequest<'_, SettingsGetVacationRequest>

Gets vacation responder settings.

source

pub fn settings_update_vacation( &self, user_id: &str ) -> FluentRequest<'_, SettingsUpdateVacationRequest>

Updates vacation responder settings.

source

pub fn stop(&self, user_id: &str) -> FluentRequest<'_, StopRequest>

Stop receiving push notifications for the given user mailbox.

source

pub fn threads_list( &self, user_id: &str ) -> FluentRequest<'_, ThreadsListRequest>

Lists the threads in the user’s mailbox.

source

pub fn threads_get( &self, id: &str, user_id: &str ) -> FluentRequest<'_, ThreadsGetRequest>

Gets the specified thread.

source

pub fn threads_delete( &self, id: &str, user_id: &str ) -> FluentRequest<'_, ThreadsDeleteRequest>

Immediately and permanently deletes the specified thread. This operation cannot be undone. Prefer threads.trash instead.

source

pub fn threads_modify( &self, id: &str, user_id: &str ) -> FluentRequest<'_, ThreadsModifyRequest>

Modifies the labels applied to the thread. This applies to all messages in the thread.

source

pub fn threads_trash( &self, id: &str, user_id: &str ) -> FluentRequest<'_, ThreadsTrashRequest>

Moves the specified thread to the trash.

source

pub fn threads_untrash( &self, id: &str, user_id: &str ) -> FluentRequest<'_, ThreadsUntrashRequest>

Removes the specified thread from the trash.

source

pub fn watch(&self, user_id: &str) -> FluentRequest<'_, WatchRequest>

Set up or update a push notification watch on the given user mailbox.

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more