/* Type definitions for non-npm package Gmail API v1 0.0 */ // Project: https://developers.google.com/workspace/gmail/api/ // Definitions by: Maxim Mazurok // Nick Amoscato // Declan Vong // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped // IMPORTANT // This file was generated by https://github.com/Maxim-Mazurok/google-api-typings-generator. Please do not edit it manually. // In case of any problems please post issue to https://github.com/Maxim-Mazurok/google-api-typings-generator // Generated from: https://gmail.googleapis.com/$discovery/rest?version=v1 // Revision: 20260824 /// declare namespace gapi.client { /** Load Gmail API v1 */ function load( urlOrObject: 'https://gmail.googleapis.com/$discovery/rest?version=v1', ): Promise; /** @deprecated Please load APIs with discovery documents. */ function load(name: 'gmail', version: 'v1'): Promise; /** @deprecated Please load APIs with discovery documents. */ function load(name: 'gmail', version: 'v1', callback: () => any): void; namespace gmail { interface AutoForwarding { /** The state that a message should be left in after it has been forwarded. */ disposition?: | 'dispositionUnspecified' | 'leaveInInbox' | 'archive' | 'trash' | 'markRead'; /** Email address to which all incoming messages are forwarded. This email address must be a verified member of the forwarding addresses. */ emailAddress?: string; /** Whether all incoming mail is automatically forwarded to another address. */ enabled?: boolean; } interface BatchDeleteMessagesRequest { /** The IDs of the messages to delete. */ ids?: string[]; } interface BatchModifyMessagesRequest { /** A list of Classification Label values to add. If a Classification Label with the same label ID is already applied to the message, fields with existing field IDs will be updated and fields with new field IDs will be added. There's a limit of 20 Classification Label values per request. If the message is already classified and the final total number of Classification Label values exceeds the maximum allowed number of Classification Label values per message, the modification fails. */ addClassificationLabels?: ClassificationLabelValue[]; /** A list of label IDs to add to messages. */ addLabelIds?: string[]; /** The IDs of the messages to modify. There is a limit of 1000 ids per request. */ ids?: string[]; /** A list of Classification Label values to remove from messages. */ removeClassificationLabelIds?: string[]; /** A list of label IDs to remove from messages. */ removeLabelIds?: string[]; } interface ClassificationLabelFieldValue { /** Required. The field ID for the Classification Label Value. Maps to the ID field of the Google Drive `Label.Field` object. */ fieldId?: string; /** Selection choice ID for the selection option. Should only be set if the field type is `SELECTION` in the Google Drive `Label.Field` object. Maps to the id field of the Google Drive `Label.Field.SelectionOptions` resource. */ selection?: string; } interface ClassificationLabelValue { /** Field values for the given classification label ID. */ fields?: ClassificationLabelFieldValue[]; /** Required. The canonical or raw alphanumeric classification label ID. Maps to the ID field of the Google Drive Label resource. */ labelId?: string; } interface CseIdentity { /** The email address for the sending identity. The email address must be the primary email address of the authenticated user. */ emailAddress?: string; /** If a key pair is associated, the ID of the key pair, CseKeyPair. */ primaryKeyPairId?: string; /** The configuration of a CSE identity that uses different key pairs for signing and encryption. */ signAndEncryptKeyPairs?: SignAndEncryptKeyPairs; } interface CseKeyPair { /** Output only. If a key pair is set to `DISABLED`, the time that the key pair's state changed from `ENABLED` to `DISABLED`. This field is present only when the key pair is in state `DISABLED`. */ disableTime?: string; /** Output only. The current state of the key pair. */ enablementState?: 'stateUnspecified' | 'enabled' | 'disabled'; /** Output only. The immutable ID for the client-side encryption S/MIME key pair. */ keyPairId?: string; /** Output only. The public key and its certificate chain, in [PEM](https://en.wikipedia.org/wiki/Privacy-Enhanced_Mail) format. */ pem?: string; /** Input only. The public key and its certificate chain. The chain must be in [PKCS#7](https://en.wikipedia.org/wiki/PKCS_7) format and use PEM encoding and ASCII armor. */ pkcs7?: string; /** Metadata for instances of this key pair's private key. */ privateKeyMetadata?: CsePrivateKeyMetadata[]; /** Output only. The email address identities that are specified on the leaf certificate. */ subjectEmailAddresses?: string[]; } interface CsePrivateKeyMetadata { /** Metadata for hardware keys. */ hardwareKeyMetadata?: HardwareKeyMetadata; /** Metadata for a private key instance managed by an external key access control list service. */ kaclsKeyMetadata?: KaclsKeyMetadata; /** Output only. The immutable ID for the private key metadata instance. */ privateKeyMetadataId?: string; } interface Delegate { /** The email address of the delegate. */ delegateEmail?: string; /** Indicates whether this address has been verified and can act as a delegate for the account. Read-only. */ verificationStatus?: | 'verificationStatusUnspecified' | 'accepted' | 'pending' | 'rejected' | 'expired'; } interface DisableCseKeyPairRequest {} interface Draft { /** The immutable ID of the draft. */ id?: string; /** The message content of the draft. */ message?: Message; } interface EnableCseKeyPairRequest {} interface Filter { /** Action that the filter performs. */ action?: FilterAction; /** Matching criteria for the filter. */ criteria?: FilterCriteria; /** The server assigned ID of the filter. */ id?: string; } interface FilterAction { /** List of labels to add to the message. */ addLabelIds?: string[]; /** Email address that the message should be forwarded to. This effectively redirects the message to the address specified in this field, maintaining the original sender in the "From" field. */ forward?: string; /** List of labels to remove from the message. */ removeLabelIds?: string[]; } interface FilterCriteria { /** Whether the response should exclude chats. */ excludeChats?: boolean; /** The sender's display name or email address. */ from?: string; /** Whether the message has any attachment. */ hasAttachment?: boolean; /** Only return messages not matching the specified query. Supports the same query format as the Gmail search box. For example, `"from:someuser@example.com rfc822msgid: is:unread"`. */ negatedQuery?: string; /** Only return messages matching the specified query. Supports the same query format as the Gmail search box. For example, `"from:someuser@example.com rfc822msgid: is:unread"`. */ query?: string; /** The size of the entire RFC822 message in bytes, including all headers and attachments. */ size?: number; /** How the message size in bytes should be in relation to the size field. */ sizeComparison?: 'unspecified' | 'smaller' | 'larger'; /** Case-insensitive phrase found in the message's subject. Trailing and leading whitespace are be trimmed and adjacent spaces are collapsed. */ subject?: string; /** The recipient's display name or email address. Includes recipients in the "to", "cc", and "bcc" header fields. You can use simply the local part of the email address. For example, "example" and "example@" both match "example@gmail.com". This field is case-insensitive. */ to?: string; } interface ForwardingAddress { /** An email address to which messages can be forwarded. */ forwardingEmail?: string; /** Indicates whether this address has been verified and is usable for forwarding. Read-only. */ verificationStatus?: 'verificationStatusUnspecified' | 'accepted' | 'pending'; } interface HardwareKeyMetadata { /** Description about the hardware key. */ description?: string; } interface History { /** The mailbox sequence ID. */ id?: string; /** Labels added to messages in this history record. */ labelsAdded?: HistoryLabelAdded[]; /** Labels removed from messages in this history record. */ labelsRemoved?: HistoryLabelRemoved[]; /** List of messages changed in this history record. The fields for specific change types, such as `messagesAdded` may duplicate messages in this field. We recommend using the specific change-type fields instead of this. */ messages?: Message[]; /** Messages added to the mailbox in this history record. */ messagesAdded?: HistoryMessageAdded[]; /** Messages deleted (not Trashed) from the mailbox in this history record. */ messagesDeleted?: HistoryMessageDeleted[]; } interface HistoryLabelAdded { /** Label IDs added to the message. */ labelIds?: string[]; message?: Message; } interface HistoryLabelRemoved { /** Label IDs removed from the message. */ labelIds?: string[]; message?: Message; } interface HistoryMessageAdded { message?: Message; } interface HistoryMessageDeleted { message?: Message; } interface ImapSettings { /** If this value is true, Gmail will immediately expunge a message when it is marked as deleted in IMAP. Otherwise, Gmail will wait for an update from the client before expunging messages marked as deleted. */ autoExpunge?: boolean; /** Whether IMAP is enabled for the account. */ enabled?: boolean; /** The action that will be executed on a message when it is marked as deleted and expunged from the last visible IMAP folder. */ expungeBehavior?: 'expungeBehaviorUnspecified' | 'archive' | 'trash' | 'deleteForever'; /** An optional limit on the number of messages that an IMAP folder may contain. Legal values are 0, 1000, 2000, 5000 or 10000. A value of zero is interpreted to mean that there is no limit. */ maxFolderSize?: number; } interface KaclsKeyMetadata { /** Opaque data generated and used by the key access control list service. Maximum size: 8 KiB. */ kaclsData?: string; /** The URI of the key access control list service that manages the private key. */ kaclsUri?: string; } interface Label { /** The color to assign to the label. Color is only available for labels that have their `type` set to `user`. */ color?: LabelColor; /** The immutable ID of the label. */ id?: string; /** The visibility of the label in the label list in the Gmail web interface. */ labelListVisibility?: 'labelShow' | 'labelShowIfUnread' | 'labelHide'; /** The visibility of messages with this label in the message list in the Gmail web interface. */ messageListVisibility?: 'show' | 'hide'; /** The total number of messages with the label. */ messagesTotal?: number; /** The number of unread messages with the label. */ messagesUnread?: number; /** The display name of the label. */ name?: string; /** The total number of threads with the label. */ threadsTotal?: number; /** The number of unread threads with the label. */ threadsUnread?: number; /** The owner type for the label. User labels are created by the user and can be modified and deleted by the user and can be applied to any message or thread. System labels are internally created and cannot be added, modified, or deleted. System labels may be able to be applied to or removed from messages and threads under some circumstances but this is not guaranteed. For example, users can apply and remove the `INBOX` and `UNREAD` labels from messages and threads, but cannot apply or remove the `DRAFTS` or `SENT` labels from messages or threads. */ type?: 'system' | 'user'; } interface LabelColor { /** The background color represented as hex string #RRGGBB (ex #000000). This field is required in order to set the color of a label. Only the following predefined set of color values are allowed: \#000000, #434343, #666666, #999999, #cccccc, #efefef, #f3f3f3, #ffffff, \#fb4c2f, #ffad47, #fad165, #16a766, #43d692, #4a86e8, #a479e2, #f691b3, \#f6c5be, #ffe6c7, #fef1d1, #b9e4d0, #c6f3de, #c9daf8, #e4d7f5, #fcdee8, \#efa093, #ffd6a2, #fce8b3, #89d3b2, #a0eac9, #a4c2f4, #d0bcf1, #fbc8d9, \#e66550, #ffbc6b, #fcda83, #44b984, #68dfa9, #6d9eeb, #b694e8, #f7a7c0, \#cc3a21, #eaa041, #f2c960, #149e60, #3dc789, #3c78d8, #8e63ce, #e07798, \#ac2b16, #cf8933, #d5ae49, #0b804b, #2a9c68, #285bac, #653e9b, #b65775, \#822111, #a46a21, #aa8831, #076239, #1a764d, #1c4587, #41236d, #83334c, \#464646, #e7e7e7, #0d3472, #b6cff5, #0d3b44, #98d7e4, #3d188e, #e3d7ff, \#711a36, #fbd3e0, #8a1c0a, #f2b2a8, #7a2e0b, #ffc8af, #7a4706, #ffdeb5, \#594c05, #fbe983, #684e07, #fdedc1, #0b4f30, #b3efd3, #04502e, #a2dcc1, \#c2c2c2, #4986e7, #2da2bb, #b99aff, #994a64, #f691b2, #ff7537, #ffad46, \#662e37, #ebdbde, #cca6ac, #094228, #42d692, #16a765, #757575, #1e53b8, \#007286, #7858c3, #c2185b, #d93025, #54240e, #633e04, #521d28, #202124, \#083018 */ backgroundColor?: string; /** The text color of the label, represented as hex string. This field is required in order to set the color of a label. Only the following predefined set of color values are allowed: \#000000, #434343, #666666, #999999, #cccccc, #efefef, #f3f3f3, #ffffff, \#fb4c2f, #ffad47, #fad165, #16a766, #43d692, #4a86e8, #a479e2, #f691b3, \#f6c5be, #ffe6c7, #fef1d1, #b9e4d0, #c6f3de, #c9daf8, #e4d7f5, #fcdee8, \#efa093, #ffd6a2, #fce8b3, #89d3b2, #a0eac9, #a4c2f4, #d0bcf1, #fbc8d9, \#e66550, #ffbc6b, #fcda83, #44b984, #68dfa9, #6d9eeb, #b694e8, #f7a7c0, \#cc3a21, #eaa041, #f2c960, #149e60, #3dc789, #3c78d8, #8e63ce, #e07798, \#ac2b16, #cf8933, #d5ae49, #0b804b, #2a9c68, #285bac, #653e9b, #b65775, \#822111, #a46a21, #aa8831, #076239, #1a764d, #1c4587, #41236d, #83334c, \#464646, #e7e7e7, #0d3472, #b6cff5, #0d3b44, #98d7e4, #3d188e, #e3d7ff, \#711a36, #fbd3e0, #8a1c0a, #f2b2a8, #7a2e0b, #ffc8af, #7a4706, #ffdeb5, \#594c05, #fbe983, #684e07, #fdedc1, #0b4f30, #b3efd3, #04502e, #a2dcc1, \#c2c2c2, #4986e7, #2da2bb, #b99aff, #994a64, #f691b2, #ff7537, #ffad46, \#662e37, #ebdbde, #cca6ac, #094228, #42d692, #16a765, #757575, #1e53b8, \#007286, #7858c3, #c2185b, #d93025, #54240e, #633e04, #521d28, #202124, \#083018 */ textColor?: string; } interface LanguageSettings { /** The language to display Gmail in, formatted as an RFC 3066 Language Tag (for example `en-GB`, `fr` or `ja` for British English, French, or Japanese respectively). The set of languages supported by Gmail evolves over time, so please refer to the "Language" dropdown in the Gmail settings for all available options, as described in the language settings help article. For a table of sample values, see [Manage language settings](https://developers.google.com/workspace/gmail/api/guides/language-settings). Not all Gmail clients can display the same set of languages. In the case that a user's display language is not available for use on a particular client, said client automatically chooses to display in the closest supported variant (or a reasonable default). */ displayLanguage?: string; } interface ListCseIdentitiesResponse { /** One page of the list of CSE identities configured for the user. */ cseIdentities?: CseIdentity[]; /** Pagination token to be passed to a subsequent ListCseIdentities call in order to retrieve the next page of identities. If this value is not returned or is the empty string, then no further pages remain. */ nextPageToken?: string; } interface ListCseKeyPairsResponse { /** One page of the list of CSE key pairs installed for the user. */ cseKeyPairs?: CseKeyPair[]; /** Pagination token to be passed to a subsequent ListCseKeyPairs call in order to retrieve the next page of key pairs. If this value is not returned, then no further pages remain. */ nextPageToken?: string; } interface ListDelegatesResponse { /** List of the user's delegates (with any verification status). If an account doesn't have delegates, this field doesn't appear. */ delegates?: Delegate[]; } interface ListDraftsResponse { /** List of drafts. Note that the `Message` property in each `Draft` resource only contains an `id` and a `threadId`. The [`messages.get`](https://developers.google.com/workspace/gmail/api/v1/reference/users/messages/get) method can fetch additional message details. */ drafts?: Draft[]; /** Token to retrieve the next page of results in the list. */ nextPageToken?: string; /** Estimated total number of results. */ resultSizeEstimate?: number; } interface ListFiltersResponse { /** List of a user's filters. */ filter?: Filter[]; } interface ListForwardingAddressesResponse { /** List of addresses that may be used for forwarding. */ forwardingAddresses?: ForwardingAddress[]; } interface ListHistoryResponse { /** List of history records. Any `messages` contained in the response will typically only have `id` and `threadId` fields populated. */ history?: History[]; /** The ID of the mailbox's current history record. */ historyId?: string; /** Page token to retrieve the next page of results in the list. */ nextPageToken?: string; } interface ListLabelsResponse { /** List of labels. Note that each label resource only contains an `id`, `name`, `messageListVisibility`, `labelListVisibility`, and `type`. The [`labels.get`](https://developers.google.com/workspace/gmail/api/v1/reference/users/labels/get) method can fetch additional label details. */ labels?: Label[]; } interface ListMessagesResponse { /** List of messages. Note that each message resource contains only an `id` and a `threadId`. Additional message details can be fetched using the messages.get method. */ messages?: Message[]; /** Token to retrieve the next page of results in the list. */ nextPageToken?: string; /** Estimated total number of results. */ resultSizeEstimate?: number; } interface ListSendAsResponse { /** List of send-as aliases. */ sendAs?: SendAs[]; } interface ListSmimeInfoResponse { /** List of SmimeInfo. */ smimeInfo?: SmimeInfo[]; } interface ListThreadsResponse { /** Page token to retrieve the next page of results in the list. */ nextPageToken?: string; /** Estimated total number of results. */ resultSizeEstimate?: number; /** List of threads. Note that each thread resource does not contain a list of `messages`. The list of `messages` for a given thread can be fetched using the [`threads.get`](https://developers.google.com/workspace/gmail/api/v1/reference/users/threads/get) method. */ threads?: Thread[]; } interface Message { /** Classification Label values on the message. Available Classification Label schemas can be queried using the Google Drive Labels API. Each classification label ID must be unique. If duplicate IDs are provided, only one will be retained, and the selection is arbitrary. Only used for Google Workspace accounts. There's a limit of 20 Classification Label values per request. If the Classification Label values exceeds the maximum allowed number, the request fails. */ classificationLabelValues?: ClassificationLabelValue[]; /** The ID of the last history record that modified this message. */ historyId?: string; /** The immutable ID of the message. */ id?: string; /** The internal message creation timestamp (epoch ms), which determines ordering in the inbox. For normal SMTP-received email, this represents the time the message was originally accepted by Google, which is more reliable than the `Date` header. However, for API-migrated mail, it can be configured by client to be based on the `Date` header. */ internalDate?: string; /** List of IDs of labels applied to this message. */ labelIds?: string[]; /** The parsed email structure in the message parts. */ payload?: MessagePart; /** The entire email message in an RFC 2822 formatted and base64url encoded string. Returned in `messages.get` and `drafts.get` responses when the `format=RAW` parameter is supplied. @required gmail.users.drafts.create gmail.users.drafts.update */ raw?: string; /** Estimated size in bytes of the message. */ sizeEstimate?: number; /** A short part of the message text. */ snippet?: string; /** The ID of the thread the message belongs to. To add a message or draft to a thread, the following criteria must be met: 1. The requested `threadId` must be specified on the `Message` or `Draft.Message` you supply with your request. 2. The `References` and `In-Reply-To` headers must be set in compliance with the [RFC 2822](https://tools.ietf.org/html/rfc2822) standard. 3. The `Subject` headers must match. */ threadId?: string; } interface MessagePart { /** The message part body for this part, which may be empty for container MIME message parts. */ body?: MessagePartBody; /** The filename of the attachment. Only present if this message part represents an attachment. */ filename?: string; /** List of headers on this message part. For the top-level message part, representing the entire message payload, it will contain the standard RFC 2822 email headers such as `To`, `From`, and `Subject`. */ headers?: MessagePartHeader[]; /** The MIME type of the message part. */ mimeType?: string; /** The immutable ID of the message part. */ partId?: string; /** The child MIME message parts of this part. This only applies to container MIME message parts, for example `multipart/*`. For non- container MIME message part types, such as `text/plain`, this field is empty. For more information, see RFC 1521. */ parts?: MessagePart[]; } interface MessagePartBody { /** When present, contains the ID of an external attachment that can be retrieved in a separate `messages.attachments.get` request. When not present, the entire content of the message part body is contained in the data field. */ attachmentId?: string; /** The body data of a MIME message part as a base64url encoded string. May be empty for MIME container types that have no message body or when the body data is sent as a separate attachment. An attachment ID is present if the body data is contained in a separate attachment. */ data?: string; /** Number of bytes for the message part data (encoding notwithstanding). */ size?: number; } interface MessagePartHeader { /** The name of the header before the `:` separator. For example, `To`. */ name?: string; /** The value of the header after the `:` separator. For example, `someuser@example.com`. */ value?: string; } interface ModifyMessageRequest { /** A list of classification label values to add. If a Classification Label with the same label ID is already applied to the message, fields with existing field IDs will be updated and fields with new field IDs will be added. There's a limit of 20 Classification Label values per request. If the message is already classified and the final total number of Classification Label values exceeds the maximum allowed number of Classification Label values per message, the modification fails. */ addClassificationLabels?: ClassificationLabelValue[]; /** A list of IDs of labels to add to this message. You can add up to 100 labels with each update. */ addLabelIds?: string[]; /** A list of Classification Label values to remove from this message. */ removeClassificationLabelIds?: string[]; /** A list IDs of labels to remove from this message. You can remove up to 100 labels with each update. */ removeLabelIds?: string[]; } interface ModifyThreadRequest { /** A list of IDs of labels to add to this thread. You can add up to 100 labels with each update. */ addLabelIds?: string[]; /** A list of IDs of labels to remove from this thread. You can remove up to 100 labels with each update. */ removeLabelIds?: string[]; } interface ObliterateCseKeyPairRequest {} interface PopSettings { /** The range of messages which are accessible via POP. */ accessWindow?: 'accessWindowUnspecified' | 'disabled' | 'fromNowOn' | 'allMail'; /** The action that will be executed on a message after it has been fetched via POP. */ disposition?: | 'dispositionUnspecified' | 'leaveInInbox' | 'archive' | 'trash' | 'markRead'; } interface Profile { /** The user's email address. */ emailAddress?: string; /** The ID of the mailbox's current history record. */ historyId?: string; /** The total number of messages in the mailbox. */ messagesTotal?: number; /** The total number of threads in the mailbox. */ threadsTotal?: number; } interface SendAs { /** A name that appears in the "From:" header for mail sent using this alias. For custom "from" addresses, when this is empty, Gmail will populate the "From:" header with the name that is used for the primary address associated with the account. If the admin has disabled the ability for users to update their name format, requests to update this field for the primary login will silently fail. */ displayName?: string; /** Whether this address is selected as the default "From:" address in situations such as composing a new message or sending a vacation auto-reply. Every Gmail account has exactly one default send-as address, so the only legal value that clients may write to this field is `true`. Changing this from `false` to `true` for an address will result in this field becoming `false` for the other previous default address. */ isDefault?: boolean; /** Whether this address is the primary address used to login to the account. Every Gmail account has exactly one primary address, and it cannot be deleted from the collection of send-as aliases. This field is read-only. */ isPrimary?: boolean; /** An optional email address that is included in a "Reply-To:" header for mail sent using this alias. If this is empty, Gmail will not generate a "Reply-To:" header. */ replyToAddress?: string; /** The email address that appears in the "From:" header for mail sent using this alias. This is read-only for all operations except create. */ sendAsEmail?: string; /** An optional HTML signature that is included in messages composed with this alias in the Gmail web UI. This signature is added to new emails only. */ signature?: string; /** An optional SMTP service that will be used as an outbound relay for mail sent using this alias. If this is empty, outbound mail will be sent directly from Gmail's servers to the destination SMTP service. This setting only applies to custom "from" aliases. */ smtpMsa?: SmtpMsa; /** Whether Gmail should treat this address as an alias for the user's primary email address. This setting only applies to custom "from" aliases. */ treatAsAlias?: boolean; /** Indicates whether this address has been verified for use as a send-as alias. Read-only. This setting only applies to custom "from" aliases. */ verificationStatus?: 'verificationStatusUnspecified' | 'accepted' | 'pending'; } interface SignAndEncryptKeyPairs { /** The ID of the CseKeyPair that encrypts signed outgoing mail. */ encryptionKeyPairId?: string; /** The ID of the CseKeyPair that signs outgoing mail. */ signingKeyPairId?: string; } interface SmimeInfo { /** Encrypted key password, when key is encrypted. */ encryptedKeyPassword?: string; /** When the certificate expires (in milliseconds since epoch). */ expiration?: string; /** The immutable ID for the SmimeInfo. */ id?: string; /** Whether this SmimeInfo is the default one for this user's send-as address. */ isDefault?: boolean; /** The S/MIME certificate issuer's common name. */ issuerCn?: string; /** PEM formatted X509 concatenated certificate string (standard base64 encoding). Format used for returning key, which includes public key as well as certificate chain (not private key). */ pem?: string; /** PKCS#12 format containing a single private/public key pair and certificate chain. This format is only accepted from client for creating a new SmimeInfo and is never returned, because the private key is not intended to be exported. PKCS#12 may be encrypted, in which case encryptedKeyPassword should be set appropriately. */ pkcs12?: string; } interface SmtpMsa { /** The hostname of the SMTP service. Required. */ host?: string; /** The password that will be used for authentication with the SMTP service. This is a write-only field that can be specified in requests to create or update SendAs settings; it is never populated in responses. */ password?: string; /** The port of the SMTP service. Required. */ port?: number; /** The protocol that will be used to secure communication with the SMTP service. Required. */ securityMode?: 'securityModeUnspecified' | 'none' | 'ssl' | 'starttls'; /** The username that will be used for authentication with the SMTP service. This is a write-only field that can be specified in requests to create or update SendAs settings; it is never populated in responses. */ username?: string; } interface Thread { /** The ID of the last history record that modified this thread. */ historyId?: string; /** The unique ID of the thread. */ id?: string; /** The list of messages in the thread. */ messages?: Message[]; /** A short part of the message text. */ snippet?: string; } interface VacationSettings { /** Flag that controls whether Gmail automatically replies to messages. */ enableAutoReply?: boolean; /** An optional end time for sending auto-replies (epoch ms). When this is specified, Gmail will automatically reply only to messages that it receives before the end time. If both `startTime` and `endTime` are specified, `startTime` must precede `endTime`. */ endTime?: string; /** Response body in HTML format. Gmail will sanitize the HTML before storing it. If both `response_body_plain_text` and `response_body_html` are specified, `response_body_html` will be used. */ responseBodyHtml?: string; /** Response body in plain text format. If both `response_body_plain_text` and `response_body_html` are specified, `response_body_html` will be used. */ responseBodyPlainText?: string; /** Optional text to prepend to the subject line in vacation responses. In order to enable auto-replies, either the response subject or the response body must be nonempty. */ responseSubject?: string; /** Flag that determines whether responses are sent to recipients who are not in the user's list of contacts. */ restrictToContacts?: boolean; /** Flag that determines whether responses are sent to recipients who are outside of the user's domain. This feature is only available for Google Workspace users. */ restrictToDomain?: boolean; /** An optional start time for sending auto-replies (epoch ms). When this is specified, Gmail will automatically reply only to messages that it receives after the start time. If both `startTime` and `endTime` are specified, `startTime` must precede `endTime`. */ startTime?: string; } interface WatchRequest { /** Filtering behavior of `labelIds list` specified. This field is deprecated because it caused incorrect behavior in some cases; use `label_filter_behavior` instead. */ labelFilterAction?: 'include' | 'exclude'; /** Filtering behavior of `labelIds list` specified. This field replaces `label_filter_action`; if set, `label_filter_action` is ignored. */ labelFilterBehavior?: 'include' | 'exclude'; /** List of label_ids to restrict notifications about. By default, if unspecified, all changes are pushed out. If specified then dictates which labels are required for a push notification to be generated. */ labelIds?: string[]; /** A fully qualified Google Cloud Pub/Sub API topic name to publish the events to. This topic name **must** already exist in Cloud Pub/Sub and you **must** have already granted gmail "publish" permission on it. For example, "projects/my-project-identifier/topics/my-topic-name" (using the Cloud Pub/Sub "v1" topic naming format). Note that the "my-project-identifier" portion must exactly match your Google developer project id (the one executing this watch request). */ topicName?: string; } interface WatchResponse { /** When Gmail will stop sending notifications for mailbox updates (epoch millis). Call `watch` again before this time to renew the watch. */ expiration?: string; /** The ID of the mailbox's current history record. */ historyId?: string; } interface DraftsResource { /** Creates a draft with the `DRAFT` label. For more information, see [Create and send draft emails](https://developers.google.com/workspace/gmail/api/guides/drafts). */ create(request: { /** V1 error format. */ '$.xgafv'?: '1' | '2'; /** OAuth access token. */ access_token?: string; /** Data format for response. */ alt?: 'json' | 'media' | 'proto'; /** JSONP */ callback?: string; /** Selector specifying which fields to include in a partial response. */ fields?: string; /** 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. */ key?: string; /** OAuth 2.0 token for the current user. */ oauth_token?: string; /** Returns response with indentations and line breaks. */ prettyPrint?: boolean; /** 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. */ quotaUser?: string; /** Upload protocol for media (e.g. "raw", "multipart"). */ upload_protocol?: string; /** Legacy upload protocol for media (e.g. "media", "multipart"). */ uploadType?: string; /** The user's email address. The special value `me` can be used to indicate the authenticated user. */ userId: string; /** Request body */ resource: Draft; }): Request; create( request: { /** V1 error format. */ '$.xgafv'?: '1' | '2'; /** OAuth access token. */ access_token?: string; /** Data format for response. */ alt?: 'json' | 'media' | 'proto'; /** JSONP */ callback?: string; /** Selector specifying which fields to include in a partial response. */ fields?: string; /** 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. */ key?: string; /** OAuth 2.0 token for the current user. */ oauth_token?: string; /** Returns response with indentations and line breaks. */ prettyPrint?: boolean; /** 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. */ quotaUser?: string; /** Upload protocol for media (e.g. "raw", "multipart"). */ upload_protocol?: string; /** Legacy upload protocol for media (e.g. "media", "multipart"). */ uploadType?: string; /** The user's email address. The special value `me` can be used to indicate the authenticated user. */ userId: string; }, body: Draft, ): Request; /** Immediately and permanently deletes the specified draft. Does not simply trash it. For more information, see [Create and send draft emails](https://developers.google.com/workspace/gmail/api/guides/drafts). */ delete(request?: { /** V1 error format. */ '$.xgafv'?: '1' | '2'; /** OAuth access token. */ access_token?: string; /** Data format for response. */ alt?: 'json' | 'media' | 'proto'; /** JSONP */ callback?: string; /** Selector specifying which fields to include in a partial response. */ fields?: string; /** The ID of the draft to delete. */ id: string; /** 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. */ key?: string; /** OAuth 2.0 token for the current user. */ oauth_token?: string; /** Returns response with indentations and line breaks. */ prettyPrint?: boolean; /** 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. */ quotaUser?: string; /** Upload protocol for media (e.g. "raw", "multipart"). */ upload_protocol?: string; /** Legacy upload protocol for media (e.g. "media", "multipart"). */ uploadType?: string; /** The user's email address. The special value `me` can be used to indicate the authenticated user. */ userId: string; }): Request; /** Gets the specified draft. For more information, see [Create and send draft emails](https://developers.google.com/workspace/gmail/api/guides/drafts). */ get(request?: { /** V1 error format. */ '$.xgafv'?: '1' | '2'; /** OAuth access token. */ access_token?: string; /** Data format for response. */ alt?: 'json' | 'media' | 'proto'; /** JSONP */ callback?: string; /** Selector specifying which fields to include in a partial response. */ fields?: string; /** The format to return the draft in. */ format?: 'minimal' | 'full' | 'raw' | 'metadata'; /** The ID of the draft to retrieve. */ id: string; /** 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. */ key?: string; /** OAuth 2.0 token for the current user. */ oauth_token?: string; /** Returns response with indentations and line breaks. */ prettyPrint?: boolean; /** 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. */ quotaUser?: string; /** Upload protocol for media (e.g. "raw", "multipart"). */ upload_protocol?: string; /** Legacy upload protocol for media (e.g. "media", "multipart"). */ uploadType?: string; /** The user's email address. The special value `me` can be used to indicate the authenticated user. */ userId: string; }): Request; /** Lists the drafts in the user's mailbox. For more information, see [Create and send draft emails](https://developers.google.com/workspace/gmail/api/guides/drafts). */ list(request?: { /** V1 error format. */ '$.xgafv'?: '1' | '2'; /** OAuth access token. */ access_token?: string; /** Data format for response. */ alt?: 'json' | 'media' | 'proto'; /** JSONP */ callback?: string; /** Selector specifying which fields to include in a partial response. */ fields?: string; /** Include drafts from `SPAM` and `TRASH` in the results. */ includeSpamTrash?: boolean; /** 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. */ key?: string; /** Maximum number of drafts to return. This field defaults to 100. The maximum allowed value for this field is 500. */ maxResults?: number; /** OAuth 2.0 token for the current user. */ oauth_token?: string; /** Page token to retrieve a specific page of results in the list. */ pageToken?: string; /** Returns response with indentations and line breaks. */ prettyPrint?: boolean; /** Only return draft messages matching the specified query. Supports the same query format as the Gmail search box. For example, `"from:someuser@example.com rfc822msgid: is:unread"`. */ q?: string; /** 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. */ quotaUser?: string; /** Upload protocol for media (e.g. "raw", "multipart"). */ upload_protocol?: string; /** Legacy upload protocol for media (e.g. "media", "multipart"). */ uploadType?: string; /** The user's email address. The special value `me` can be used to indicate the authenticated user. */ userId: string; }): Request; /** Sends the specified, existing draft to the recipients in the `To`, `Cc`, and `Bcc` headers. For more information, see [Create and send draft emails](https://developers.google.com/workspace/gmail/api/guides/drafts). */ send(request: { /** V1 error format. */ '$.xgafv'?: '1' | '2'; /** OAuth access token. */ access_token?: string; /** Data format for response. */ alt?: 'json' | 'media' | 'proto'; /** JSONP */ callback?: string; /** Selector specifying which fields to include in a partial response. */ fields?: string; /** 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. */ key?: string; /** OAuth 2.0 token for the current user. */ oauth_token?: string; /** Returns response with indentations and line breaks. */ prettyPrint?: boolean; /** 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. */ quotaUser?: string; /** Upload protocol for media (e.g. "raw", "multipart"). */ upload_protocol?: string; /** Legacy upload protocol for media (e.g. "media", "multipart"). */ uploadType?: string; /** The user's email address. The special value `me` can be used to indicate the authenticated user. */ userId: string; /** Request body */ resource: Draft; }): Request; send( request: { /** V1 error format. */ '$.xgafv'?: '1' | '2'; /** OAuth access token. */ access_token?: string; /** Data format for response. */ alt?: 'json' | 'media' | 'proto'; /** JSONP */ callback?: string; /** Selector specifying which fields to include in a partial response. */ fields?: string; /** 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. */ key?: string; /** OAuth 2.0 token for the current user. */ oauth_token?: string; /** Returns response with indentations and line breaks. */ prettyPrint?: boolean; /** 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. */ quotaUser?: string; /** Upload protocol for media (e.g. "raw", "multipart"). */ upload_protocol?: string; /** Legacy upload protocol for media (e.g. "media", "multipart"). */ uploadType?: string; /** The user's email address. The special value `me` can be used to indicate the authenticated user. */ userId: string; }, body: Draft, ): Request; /** Replaces a draft's content. For more information, see [Create and send draft emails](https://developers.google.com/workspace/gmail/api/guides/drafts). */ update(request: { /** V1 error format. */ '$.xgafv'?: '1' | '2'; /** OAuth access token. */ access_token?: string; /** Data format for response. */ alt?: 'json' | 'media' | 'proto'; /** JSONP */ callback?: string; /** Selector specifying which fields to include in a partial response. */ fields?: string; /** The ID of the draft to update. */ id: string; /** 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. */ key?: string; /** OAuth 2.0 token for the current user. */ oauth_token?: string; /** Returns response with indentations and line breaks. */ prettyPrint?: boolean; /** 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. */ quotaUser?: string; /** Upload protocol for media (e.g. "raw", "multipart"). */ upload_protocol?: string; /** Legacy upload protocol for media (e.g. "media", "multipart"). */ uploadType?: string; /** The user's email address. The special value `me` can be used to indicate the authenticated user. */ userId: string; /** Request body */ resource: Draft; }): Request; update( request: { /** V1 error format. */ '$.xgafv'?: '1' | '2'; /** OAuth access token. */ access_token?: string; /** Data format for response. */ alt?: 'json' | 'media' | 'proto'; /** JSONP */ callback?: string; /** Selector specifying which fields to include in a partial response. */ fields?: string; /** The ID of the draft to update. */ id: string; /** 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. */ key?: string; /** OAuth 2.0 token for the current user. */ oauth_token?: string; /** Returns response with indentations and line breaks. */ prettyPrint?: boolean; /** 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. */ quotaUser?: string; /** Upload protocol for media (e.g. "raw", "multipart"). */ upload_protocol?: string; /** Legacy upload protocol for media (e.g. "media", "multipart"). */ uploadType?: string; /** The user's email address. The special value `me` can be used to indicate the authenticated user. */ userId: string; }, body: Draft, ): Request; } interface HistoryResource { /** Lists the history of all changes to the given mailbox. History results are returned in chronological order (increasing `historyId`). For more information, see [Synchronize clients with Gmail](https://developers.google.com/workspace/gmail/api/guides/sync). */ list(request?: { /** V1 error format. */ '$.xgafv'?: '1' | '2'; /** OAuth access token. */ access_token?: string; /** Data format for response. */ alt?: 'json' | 'media' | 'proto'; /** JSONP */ callback?: string; /** Selector specifying which fields to include in a partial response. */ fields?: string; /** History types to be returned by the function */ historyTypes?: | 'messageAdded' | 'messageDeleted' | 'labelAdded' | 'labelRemoved' | ( 'messageAdded' | 'messageDeleted' | 'labelAdded' | 'labelRemoved' )[]; /** 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. */ key?: string; /** Only return messages with a label matching the ID. */ labelId?: string; /** Maximum number of history records to return. This field defaults to 100. The maximum allowed value for this field is 500. */ maxResults?: number; /** OAuth 2.0 token for the current user. */ oauth_token?: string; /** Page token to retrieve a specific page of results in the list. */ pageToken?: string; /** Returns response with indentations and line breaks. */ prettyPrint?: boolean; /** 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. */ quotaUser?: string; /** Required. Returns history records after the specified `startHistoryId`. The supplied `startHistoryId` should be obtained from the `historyId` of a message, thread, or previous `list` response. History IDs increase chronologically but are not contiguous with random gaps in between valid IDs. Supplying an invalid or out of date `startHistoryId` typically returns an `HTTP 404` error code. A `historyId` is typically valid for at least a week, but in some rare circumstances may be valid for only a few hours. If you receive an `HTTP 404` error response, your application should perform a full sync. If you receive no `nextPageToken` in the response, there are no updates to retrieve and you can store the returned `historyId` for a future request. */ startHistoryId?: string; /** Upload protocol for media (e.g. "raw", "multipart"). */ upload_protocol?: string; /** Legacy upload protocol for media (e.g. "media", "multipart"). */ uploadType?: string; /** The user's email address. The special value `me` can be used to indicate the authenticated user. */ userId: string; }): Request; } interface LabelsResource { /** Creates a label. For more information, see [Manage labels](https://developers.google.com/workspace/gmail/api/guides/labels). */ create(request: { /** V1 error format. */ '$.xgafv'?: '1' | '2'; /** OAuth access token. */ access_token?: string; /** Data format for response. */ alt?: 'json' | 'media' | 'proto'; /** JSONP */ callback?: string; /** Selector specifying which fields to include in a partial response. */ fields?: string; /** 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. */ key?: string; /** OAuth 2.0 token for the current user. */ oauth_token?: string; /** Returns response with indentations and line breaks. */ prettyPrint?: boolean; /** 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. */ quotaUser?: string; /** Upload protocol for media (e.g. "raw", "multipart"). */ upload_protocol?: string; /** Legacy upload protocol for media (e.g. "media", "multipart"). */ uploadType?: string; /** The user's email address. The special value `me` can be used to indicate the authenticated user. */ userId: string; /** Request body */ resource: Label; }): Request