| // Copyright 2019 Google LLC. |
| // Use of this source code is governed by a BSD-style |
| // license that can be found in the LICENSE file. |
| |
| // Code generated file. DO NOT EDIT. |
| |
| // Package gmail provides access to the Gmail API. |
| // |
| // For product documentation, see: https://developers.google.com/gmail/api/ |
| // |
| // Creating a client |
| // |
| // Usage example: |
| // |
| // import "google.golang.org/api/gmail/v1" |
| // ... |
| // ctx := context.Background() |
| // gmailService, err := gmail.NewService(ctx) |
| // |
| // In this example, Google Application Default Credentials are used for authentication. |
| // |
| // For information on how to create and obtain Application Default Credentials, see https://developers.google.com/identity/protocols/application-default-credentials. |
| // |
| // Other authentication options |
| // |
| // By default, all available scopes (see "Constants") are used to authenticate. To restrict scopes, use option.WithScopes: |
| // |
| // gmailService, err := gmail.NewService(ctx, option.WithScopes(gmail.GmailSettingsSharingScope)) |
| // |
| // To use an API key for authentication (note: some APIs do not support API keys), use option.WithAPIKey: |
| // |
| // gmailService, err := gmail.NewService(ctx, option.WithAPIKey("AIza...")) |
| // |
| // To use an OAuth token (e.g., a user token obtained via a three-legged OAuth flow), use option.WithTokenSource: |
| // |
| // config := &oauth2.Config{...} |
| // // ... |
| // token, err := config.Exchange(ctx, ...) |
| // gmailService, err := gmail.NewService(ctx, option.WithTokenSource(config.TokenSource(ctx, token))) |
| // |
| // See https://godoc.org/google.golang.org/api/option/ for details on options. |
| package gmail // import "google.golang.org/api/gmail/v1" |
| |
| import ( |
| "bytes" |
| "context" |
| "encoding/json" |
| "errors" |
| "fmt" |
| "io" |
| "net/http" |
| "net/url" |
| "strconv" |
| "strings" |
| |
| googleapi "google.golang.org/api/googleapi" |
| gensupport "google.golang.org/api/internal/gensupport" |
| option "google.golang.org/api/option" |
| htransport "google.golang.org/api/transport/http" |
| ) |
| |
| // Always reference these packages, just in case the auto-generated code |
| // below doesn't. |
| var _ = bytes.NewBuffer |
| var _ = strconv.Itoa |
| var _ = fmt.Sprintf |
| var _ = json.NewDecoder |
| var _ = io.Copy |
| var _ = url.Parse |
| var _ = gensupport.MarshalJSON |
| var _ = googleapi.Version |
| var _ = errors.New |
| var _ = strings.Replace |
| var _ = context.Canceled |
| |
| const apiId = "gmail:v1" |
| const apiName = "gmail" |
| const apiVersion = "v1" |
| const basePath = "https://www.googleapis.com/gmail/v1/users/" |
| |
| // OAuth2 scopes used by this API. |
| const ( |
| // Read, compose, send, and permanently delete all your email from Gmail |
| MailGoogleComScope = "https://mail.google.com/" |
| |
| // Manage drafts and send emails |
| GmailComposeScope = "https://www.googleapis.com/auth/gmail.compose" |
| |
| // Insert mail into your mailbox |
| GmailInsertScope = "https://www.googleapis.com/auth/gmail.insert" |
| |
| // Manage mailbox labels |
| GmailLabelsScope = "https://www.googleapis.com/auth/gmail.labels" |
| |
| // View your email message metadata such as labels and headers, but not |
| // the email body |
| GmailMetadataScope = "https://www.googleapis.com/auth/gmail.metadata" |
| |
| // View and modify but not delete your email |
| GmailModifyScope = "https://www.googleapis.com/auth/gmail.modify" |
| |
| // View your email messages and settings |
| GmailReadonlyScope = "https://www.googleapis.com/auth/gmail.readonly" |
| |
| // Send email on your behalf |
| GmailSendScope = "https://www.googleapis.com/auth/gmail.send" |
| |
| // Manage your basic mail settings |
| GmailSettingsBasicScope = "https://www.googleapis.com/auth/gmail.settings.basic" |
| |
| // Manage your sensitive mail settings, including who can manage your |
| // mail |
| GmailSettingsSharingScope = "https://www.googleapis.com/auth/gmail.settings.sharing" |
| ) |
| |
| // NewService creates a new Service. |
| func NewService(ctx context.Context, opts ...option.ClientOption) (*Service, error) { |
| scopesOption := option.WithScopes( |
| "https://mail.google.com/", |
| "https://www.googleapis.com/auth/gmail.compose", |
| "https://www.googleapis.com/auth/gmail.insert", |
| "https://www.googleapis.com/auth/gmail.labels", |
| "https://www.googleapis.com/auth/gmail.metadata", |
| "https://www.googleapis.com/auth/gmail.modify", |
| "https://www.googleapis.com/auth/gmail.readonly", |
| "https://www.googleapis.com/auth/gmail.send", |
| "https://www.googleapis.com/auth/gmail.settings.basic", |
| "https://www.googleapis.com/auth/gmail.settings.sharing", |
| ) |
| // NOTE: prepend, so we don't override user-specified scopes. |
| opts = append([]option.ClientOption{scopesOption}, opts...) |
| client, endpoint, err := htransport.NewClient(ctx, opts...) |
| if err != nil { |
| return nil, err |
| } |
| s, err := New(client) |
| if err != nil { |
| return nil, err |
| } |
| if endpoint != "" { |
| s.BasePath = endpoint |
| } |
| return s, nil |
| } |
| |
| // New creates a new Service. It uses the provided http.Client for requests. |
| // |
| // Deprecated: please use NewService instead. |
| // To provide a custom HTTP client, use option.WithHTTPClient. |
| // If you are using google.golang.org/api/googleapis/transport.APIKey, use option.WithAPIKey with NewService instead. |
| func New(client *http.Client) (*Service, error) { |
| if client == nil { |
| return nil, errors.New("client is nil") |
| } |
| s := &Service{client: client, BasePath: basePath} |
| s.Users = NewUsersService(s) |
| return s, nil |
| } |
| |
| type Service struct { |
| client *http.Client |
| BasePath string // API endpoint base URL |
| UserAgent string // optional additional User-Agent fragment |
| |
| Users *UsersService |
| } |
| |
| func (s *Service) userAgent() string { |
| if s.UserAgent == "" { |
| return googleapi.UserAgent |
| } |
| return googleapi.UserAgent + " " + s.UserAgent |
| } |
| |
| func NewUsersService(s *Service) *UsersService { |
| rs := &UsersService{s: s} |
| rs.Drafts = NewUsersDraftsService(s) |
| rs.History = NewUsersHistoryService(s) |
| rs.Labels = NewUsersLabelsService(s) |
| rs.Messages = NewUsersMessagesService(s) |
| rs.Settings = NewUsersSettingsService(s) |
| rs.Threads = NewUsersThreadsService(s) |
| return rs |
| } |
| |
| type UsersService struct { |
| s *Service |
| |
| Drafts *UsersDraftsService |
| |
| History *UsersHistoryService |
| |
| Labels *UsersLabelsService |
| |
| Messages *UsersMessagesService |
| |
| Settings *UsersSettingsService |
| |
| Threads *UsersThreadsService |
| } |
| |
| func NewUsersDraftsService(s *Service) *UsersDraftsService { |
| rs := &UsersDraftsService{s: s} |
| return rs |
| } |
| |
| type UsersDraftsService struct { |
| s *Service |
| } |
| |
| func NewUsersHistoryService(s *Service) *UsersHistoryService { |
| rs := &UsersHistoryService{s: s} |
| return rs |
| } |
| |
| type UsersHistoryService struct { |
| s *Service |
| } |
| |
| func NewUsersLabelsService(s *Service) *UsersLabelsService { |
| rs := &UsersLabelsService{s: s} |
| return rs |
| } |
| |
| type UsersLabelsService struct { |
| s *Service |
| } |
| |
| func NewUsersMessagesService(s *Service) *UsersMessagesService { |
| rs := &UsersMessagesService{s: s} |
| rs.Attachments = NewUsersMessagesAttachmentsService(s) |
| return rs |
| } |
| |
| type UsersMessagesService struct { |
| s *Service |
| |
| Attachments *UsersMessagesAttachmentsService |
| } |
| |
| func NewUsersMessagesAttachmentsService(s *Service) *UsersMessagesAttachmentsService { |
| rs := &UsersMessagesAttachmentsService{s: s} |
| return rs |
| } |
| |
| type UsersMessagesAttachmentsService struct { |
| s *Service |
| } |
| |
| func NewUsersSettingsService(s *Service) *UsersSettingsService { |
| rs := &UsersSettingsService{s: s} |
| rs.Delegates = NewUsersSettingsDelegatesService(s) |
| rs.Filters = NewUsersSettingsFiltersService(s) |
| rs.ForwardingAddresses = NewUsersSettingsForwardingAddressesService(s) |
| rs.SendAs = NewUsersSettingsSendAsService(s) |
| return rs |
| } |
| |
| type UsersSettingsService struct { |
| s *Service |
| |
| Delegates *UsersSettingsDelegatesService |
| |
| Filters *UsersSettingsFiltersService |
| |
| ForwardingAddresses *UsersSettingsForwardingAddressesService |
| |
| SendAs *UsersSettingsSendAsService |
| } |
| |
| func NewUsersSettingsDelegatesService(s *Service) *UsersSettingsDelegatesService { |
| rs := &UsersSettingsDelegatesService{s: s} |
| return rs |
| } |
| |
| type UsersSettingsDelegatesService struct { |
| s *Service |
| } |
| |
| func NewUsersSettingsFiltersService(s *Service) *UsersSettingsFiltersService { |
| rs := &UsersSettingsFiltersService{s: s} |
| return rs |
| } |
| |
| type UsersSettingsFiltersService struct { |
| s *Service |
| } |
| |
| func NewUsersSettingsForwardingAddressesService(s *Service) *UsersSettingsForwardingAddressesService { |
| rs := &UsersSettingsForwardingAddressesService{s: s} |
| return rs |
| } |
| |
| type UsersSettingsForwardingAddressesService struct { |
| s *Service |
| } |
| |
| func NewUsersSettingsSendAsService(s *Service) *UsersSettingsSendAsService { |
| rs := &UsersSettingsSendAsService{s: s} |
| rs.SmimeInfo = NewUsersSettingsSendAsSmimeInfoService(s) |
| return rs |
| } |
| |
| type UsersSettingsSendAsService struct { |
| s *Service |
| |
| SmimeInfo *UsersSettingsSendAsSmimeInfoService |
| } |
| |
| func NewUsersSettingsSendAsSmimeInfoService(s *Service) *UsersSettingsSendAsSmimeInfoService { |
| rs := &UsersSettingsSendAsSmimeInfoService{s: s} |
| return rs |
| } |
| |
| type UsersSettingsSendAsSmimeInfoService struct { |
| s *Service |
| } |
| |
| func NewUsersThreadsService(s *Service) *UsersThreadsService { |
| rs := &UsersThreadsService{s: s} |
| return rs |
| } |
| |
| type UsersThreadsService struct { |
| s *Service |
| } |
| |
| // AutoForwarding: Auto-forwarding settings for an account. |
| type AutoForwarding struct { |
| // Disposition: The state that a message should be left in after it has |
| // been forwarded. |
| // |
| // Possible values: |
| // "archive" |
| // "dispositionUnspecified" |
| // "leaveInInbox" |
| // "markRead" |
| // "trash" |
| Disposition string `json:"disposition,omitempty"` |
| |
| // EmailAddress: Email address to which all incoming messages are |
| // forwarded. This email address must be a verified member of the |
| // forwarding addresses. |
| EmailAddress string `json:"emailAddress,omitempty"` |
| |
| // Enabled: Whether all incoming mail is automatically forwarded to |
| // another address. |
| Enabled bool `json:"enabled,omitempty"` |
| |
| // ServerResponse contains the HTTP response code and headers from the |
| // server. |
| googleapi.ServerResponse `json:"-"` |
| |
| // ForceSendFields is a list of field names (e.g. "Disposition") to |
| // unconditionally include in API requests. By default, fields with |
| // empty values are omitted from API requests. However, any non-pointer, |
| // non-interface field appearing in ForceSendFields will be sent to the |
| // server regardless of whether the field is empty or not. This may be |
| // used to include empty fields in Patch requests. |
| ForceSendFields []string `json:"-"` |
| |
| // NullFields is a list of field names (e.g. "Disposition") to include |
| // in API requests with the JSON null value. By default, fields with |
| // empty values are omitted from API requests. However, any field with |
| // an empty value appearing in NullFields will be sent to the server as |
| // null. It is an error if a field in this list has a non-empty value. |
| // This may be used to include null fields in Patch requests. |
| NullFields []string `json:"-"` |
| } |
| |
| func (s *AutoForwarding) MarshalJSON() ([]byte, error) { |
| type NoMethod AutoForwarding |
| raw := NoMethod(*s) |
| return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) |
| } |
| |
| type BatchDeleteMessagesRequest struct { |
| // Ids: The IDs of the messages to delete. |
| Ids []string `json:"ids,omitempty"` |
| |
| // ForceSendFields is a list of field names (e.g. "Ids") to |
| // unconditionally include in API requests. By default, fields with |
| // empty values are omitted from API requests. However, any non-pointer, |
| // non-interface field appearing in ForceSendFields will be sent to the |
| // server regardless of whether the field is empty or not. This may be |
| // used to include empty fields in Patch requests. |
| ForceSendFields []string `json:"-"` |
| |
| // NullFields is a list of field names (e.g. "Ids") to include in API |
| // requests with the JSON null value. By default, fields with empty |
| // values are omitted from API requests. However, any field with an |
| // empty value appearing in NullFields will be sent to the server as |
| // null. It is an error if a field in this list has a non-empty value. |
| // This may be used to include null fields in Patch requests. |
| NullFields []string `json:"-"` |
| } |
| |
| func (s *BatchDeleteMessagesRequest) MarshalJSON() ([]byte, error) { |
| type NoMethod BatchDeleteMessagesRequest |
| raw := NoMethod(*s) |
| return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) |
| } |
| |
| type BatchModifyMessagesRequest struct { |
| // AddLabelIds: A list of label IDs to add to messages. |
| AddLabelIds []string `json:"addLabelIds,omitempty"` |
| |
| // Ids: The IDs of the messages to modify. There is a limit of 1000 ids |
| // per request. |
| Ids []string `json:"ids,omitempty"` |
| |
| // RemoveLabelIds: A list of label IDs to remove from messages. |
| RemoveLabelIds []string `json:"removeLabelIds,omitempty"` |
| |
| // ForceSendFields is a list of field names (e.g. "AddLabelIds") to |
| // unconditionally include in API requests. By default, fields with |
| // empty values are omitted from API requests. However, any non-pointer, |
| // non-interface field appearing in ForceSendFields will be sent to the |
| // server regardless of whether the field is empty or not. This may be |
| // used to include empty fields in Patch requests. |
| ForceSendFields []string `json:"-"` |
| |
| // NullFields is a list of field names (e.g. "AddLabelIds") to include |
| // in API requests with the JSON null value. By default, fields with |
| // empty values are omitted from API requests. However, any field with |
| // an empty value appearing in NullFields will be sent to the server as |
| // null. It is an error if a field in this list has a non-empty value. |
| // This may be used to include null fields in Patch requests. |
| NullFields []string `json:"-"` |
| } |
| |
| func (s *BatchModifyMessagesRequest) MarshalJSON() ([]byte, error) { |
| type NoMethod BatchModifyMessagesRequest |
| raw := NoMethod(*s) |
| return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) |
| } |
| |
| // Delegate: Settings for a delegate. Delegates can read, send, and |
| // delete messages, as well as view and add contacts, for the |
| // delegator's account. See "Set up mail delegation" for more |
| // information about delegates. |
| type Delegate struct { |
| // DelegateEmail: The email address of the delegate. |
| DelegateEmail string `json:"delegateEmail,omitempty"` |
| |
| // VerificationStatus: Indicates whether this address has been verified |
| // and can act as a delegate for the account. Read-only. |
| // |
| // Possible values: |
| // "accepted" |
| // "expired" |
| // "pending" |
| // "rejected" |
| // "verificationStatusUnspecified" |
| VerificationStatus string `json:"verificationStatus,omitempty"` |
| |
| // ServerResponse contains the HTTP response code and headers from the |
| // server. |
| googleapi.ServerResponse `json:"-"` |
| |
| // ForceSendFields is a list of field names (e.g. "DelegateEmail") to |
| // unconditionally include in API requests. By default, fields with |
| // empty values are omitted from API requests. However, any non-pointer, |
| // non-interface field appearing in ForceSendFields will be sent to the |
| // server regardless of whether the field is empty or not. This may be |
| // used to include empty fields in Patch requests. |
| ForceSendFields []string `json:"-"` |
| |
| // NullFields is a list of field names (e.g. "DelegateEmail") to include |
| // in API requests with the JSON null value. By default, fields with |
| // empty values are omitted from API requests. However, any field with |
| // an empty value appearing in NullFields will be sent to the server as |
| // null. It is an error if a field in this list has a non-empty value. |
| // This may be used to include null fields in Patch requests. |
| NullFields []string `json:"-"` |
| } |
| |
| func (s *Delegate) MarshalJSON() ([]byte, error) { |
| type NoMethod Delegate |
| raw := NoMethod(*s) |
| return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) |
| } |
| |
| // Draft: A draft email in the user's mailbox. |
| type Draft struct { |
| // Id: The immutable ID of the draft. |
| Id string `json:"id,omitempty"` |
| |
| // Message: The message content of the draft. |
| Message *Message `json:"message,omitempty"` |
| |
| // ServerResponse contains the HTTP response code and headers from the |
| // server. |
| googleapi.ServerResponse `json:"-"` |
| |
| // ForceSendFields is a list of field names (e.g. "Id") to |
| // unconditionally include in API requests. By default, fields with |
| // empty values are omitted from API requests. However, any non-pointer, |
| // non-interface field appearing in ForceSendFields will be sent to the |
| // server regardless of whether the field is empty or not. This may be |
| // used to include empty fields in Patch requests. |
| ForceSendFields []string `json:"-"` |
| |
| // NullFields is a list of field names (e.g. "Id") to include in API |
| // requests with the JSON null value. By default, fields with empty |
| // values are omitted from API requests. However, any field with an |
| // empty value appearing in NullFields will be sent to the server as |
| // null. It is an error if a field in this list has a non-empty value. |
| // This may be used to include null fields in Patch requests. |
| NullFields []string `json:"-"` |
| } |
| |
| func (s *Draft) MarshalJSON() ([]byte, error) { |
| type NoMethod Draft |
| raw := NoMethod(*s) |
| return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) |
| } |
| |
| // Filter: Resource definition for Gmail filters. Filters apply to |
| // specific messages instead of an entire email thread. |
| type Filter struct { |
| // Action: Action that the filter performs. |
| Action *FilterAction `json:"action,omitempty"` |
| |
| // Criteria: Matching criteria for the filter. |
| Criteria *FilterCriteria `json:"criteria,omitempty"` |
| |
| // Id: The server assigned ID of the filter. |
| Id string `json:"id,omitempty"` |
| |
| // ServerResponse contains the HTTP response code and headers from the |
| // server. |
| googleapi.ServerResponse `json:"-"` |
| |
| // ForceSendFields is a list of field names (e.g. "Action") to |
| // unconditionally include in API requests. By default, fields with |
| // empty values are omitted from API requests. However, any non-pointer, |
| // non-interface field appearing in ForceSendFields will be sent to the |
| // server regardless of whether the field is empty or not. This may be |
| // used to include empty fields in Patch requests. |
| ForceSendFields []string `json:"-"` |
| |
| // NullFields is a list of field names (e.g. "Action") to include in API |
| // requests with the JSON null value. By default, fields with empty |
| // values are omitted from API requests. However, any field with an |
| // empty value appearing in NullFields will be sent to the server as |
| // null. It is an error if a field in this list has a non-empty value. |
| // This may be used to include null fields in Patch requests. |
| NullFields []string `json:"-"` |
| } |
| |
| func (s *Filter) MarshalJSON() ([]byte, error) { |
| type NoMethod Filter |
| raw := NoMethod(*s) |
| return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) |
| } |
| |
| // FilterAction: A set of actions to perform on a message. |
| type FilterAction struct { |
| // AddLabelIds: List of labels to add to the message. |
| AddLabelIds []string `json:"addLabelIds,omitempty"` |
| |
| // Forward: Email address that the message should be forwarded to. |
| Forward string `json:"forward,omitempty"` |
| |
| // RemoveLabelIds: List of labels to remove from the message. |
| RemoveLabelIds []string `json:"removeLabelIds,omitempty"` |
| |
| // ForceSendFields is a list of field names (e.g. "AddLabelIds") to |
| // unconditionally include in API requests. By default, fields with |
| // empty values are omitted from API requests. However, any non-pointer, |
| // non-interface field appearing in ForceSendFields will be sent to the |
| // server regardless of whether the field is empty or not. This may be |
| // used to include empty fields in Patch requests. |
| ForceSendFields []string `json:"-"` |
| |
| // NullFields is a list of field names (e.g. "AddLabelIds") to include |
| // in API requests with the JSON null value. By default, fields with |
| // empty values are omitted from API requests. However, any field with |
| // an empty value appearing in NullFields will be sent to the server as |
| // null. It is an error if a field in this list has a non-empty value. |
| // This may be used to include null fields in Patch requests. |
| NullFields []string `json:"-"` |
| } |
| |
| func (s *FilterAction) MarshalJSON() ([]byte, error) { |
| type NoMethod FilterAction |
| raw := NoMethod(*s) |
| return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) |
| } |
| |
| // FilterCriteria: Message matching criteria. |
| type FilterCriteria struct { |
| // ExcludeChats: Whether the response should exclude chats. |
| ExcludeChats bool `json:"excludeChats,omitempty"` |
| |
| // From: The sender's display name or email address. |
| From string `json:"from,omitempty"` |
| |
| // HasAttachment: Whether the message has any attachment. |
| HasAttachment bool `json:"hasAttachment,omitempty"` |
| |
| // NegatedQuery: 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 `json:"negatedQuery,omitempty"` |
| |
| // Query: 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 `json:"query,omitempty"` |
| |
| // Size: The size of the entire RFC822 message in bytes, including all |
| // headers and attachments. |
| Size int64 `json:"size,omitempty"` |
| |
| // SizeComparison: How the message size in bytes should be in relation |
| // to the size field. |
| // |
| // Possible values: |
| // "larger" |
| // "smaller" |
| // "unspecified" |
| SizeComparison string `json:"sizeComparison,omitempty"` |
| |
| // Subject: Case-insensitive phrase found in the message's subject. |
| // Trailing and leading whitespace are be trimmed and adjacent spaces |
| // are collapsed. |
| Subject string `json:"subject,omitempty"` |
| |
| // To: 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 `json:"to,omitempty"` |
| |
| // ForceSendFields is a list of field names (e.g. "ExcludeChats") to |
| // unconditionally include in API requests. By default, fields with |
| // empty values are omitted from API requests. However, any non-pointer, |
| // non-interface field appearing in ForceSendFields will be sent to the |
| // server regardless of whether the field is empty or not. This may be |
| // used to include empty fields in Patch requests. |
| ForceSendFields []string `json:"-"` |
| |
| // NullFields is a list of field names (e.g. "ExcludeChats") to include |
| // in API requests with the JSON null value. By default, fields with |
| // empty values are omitted from API requests. However, any field with |
| // an empty value appearing in NullFields will be sent to the server as |
| // null. It is an error if a field in this list has a non-empty value. |
| // This may be used to include null fields in Patch requests. |
| NullFields []string `json:"-"` |
| } |
| |
| func (s *FilterCriteria) MarshalJSON() ([]byte, error) { |
| type NoMethod FilterCriteria |
| raw := NoMethod(*s) |
| return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) |
| } |
| |
| // ForwardingAddress: Settings for a forwarding address. |
| type ForwardingAddress struct { |
| // ForwardingEmail: An email address to which messages can be forwarded. |
| ForwardingEmail string `json:"forwardingEmail,omitempty"` |
| |
| // VerificationStatus: Indicates whether this address has been verified |
| // and is usable for forwarding. Read-only. |
| // |
| // Possible values: |
| // "accepted" |
| // "pending" |
| // "verificationStatusUnspecified" |
| VerificationStatus string `json:"verificationStatus,omitempty"` |
| |
| // ServerResponse contains the HTTP response code and headers from the |
| // server. |
| googleapi.ServerResponse `json:"-"` |
| |
| // ForceSendFields is a list of field names (e.g. "ForwardingEmail") to |
| // unconditionally include in API requests. By default, fields with |
| // empty values are omitted from API requests. However, any non-pointer, |
| // non-interface field appearing in ForceSendFields will be sent to the |
| // server regardless of whether the field is empty or not. This may be |
| // used to include empty fields in Patch requests. |
| ForceSendFields []string `json:"-"` |
| |
| // NullFields is a list of field names (e.g. "ForwardingEmail") to |
| // include in API requests with the JSON null value. By default, fields |
| // with empty values are omitted from API requests. However, any field |
| // with an empty value appearing in NullFields will be sent to the |
| // server as null. It is an error if a field in this list has a |
| // non-empty value. This may be used to include null fields in Patch |
| // requests. |
| NullFields []string `json:"-"` |
| } |
| |
| func (s *ForwardingAddress) MarshalJSON() ([]byte, error) { |
| type NoMethod ForwardingAddress |
| raw := NoMethod(*s) |
| return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) |
| } |
| |
| // History: A record of a change to the user's mailbox. Each history |
| // change may affect multiple messages in multiple ways. |
| type History struct { |
| // Id: The mailbox sequence ID. |
| Id uint64 `json:"id,omitempty,string"` |
| |
| // LabelsAdded: Labels added to messages in this history record. |
| LabelsAdded []*HistoryLabelAdded `json:"labelsAdded,omitempty"` |
| |
| // LabelsRemoved: Labels removed from messages in this history record. |
| LabelsRemoved []*HistoryLabelRemoved `json:"labelsRemoved,omitempty"` |
| |
| // Messages: 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 `json:"messages,omitempty"` |
| |
| // MessagesAdded: Messages added to the mailbox in this history record. |
| MessagesAdded []*HistoryMessageAdded `json:"messagesAdded,omitempty"` |
| |
| // MessagesDeleted: Messages deleted (not Trashed) from the mailbox in |
| // this history record. |
| MessagesDeleted []*HistoryMessageDeleted `json:"messagesDeleted,omitempty"` |
| |
| // ForceSendFields is a list of field names (e.g. "Id") to |
| // unconditionally include in API requests. By default, fields with |
| // empty values are omitted from API requests. However, any non-pointer, |
| // non-interface field appearing in ForceSendFields will be sent to the |
| // server regardless of whether the field is empty or not. This may be |
| // used to include empty fields in Patch requests. |
| ForceSendFields []string `json:"-"` |
| |
| // NullFields is a list of field names (e.g. "Id") to include in API |
| // requests with the JSON null value. By default, fields with empty |
| // values are omitted from API requests. However, any field with an |
| // empty value appearing in NullFields will be sent to the server as |
| // null. It is an error if a field in this list has a non-empty value. |
| // This may be used to include null fields in Patch requests. |
| NullFields []string `json:"-"` |
| } |
| |
| func (s *History) MarshalJSON() ([]byte, error) { |
| type NoMethod History |
| raw := NoMethod(*s) |
| return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) |
| } |
| |
| type HistoryLabelAdded struct { |
| // LabelIds: Label IDs added to the message. |
| LabelIds []string `json:"labelIds,omitempty"` |
| |
| Message *Message `json:"message,omitempty"` |
| |
| // ForceSendFields is a list of field names (e.g. "LabelIds") to |
| // unconditionally include in API requests. By default, fields with |
| // empty values are omitted from API requests. However, any non-pointer, |
| // non-interface field appearing in ForceSendFields will be sent to the |
| // server regardless of whether the field is empty or not. This may be |
| // used to include empty fields in Patch requests. |
| ForceSendFields []string `json:"-"` |
| |
| // NullFields is a list of field names (e.g. "LabelIds") to include in |
| // API requests with the JSON null value. By default, fields with empty |
| // values are omitted from API requests. However, any field with an |
| // empty value appearing in NullFields will be sent to the server as |
| // null. It is an error if a field in this list has a non-empty value. |
| // This may be used to include null fields in Patch requests. |
| NullFields []string `json:"-"` |
| } |
| |
| func (s *HistoryLabelAdded) MarshalJSON() ([]byte, error) { |
| type NoMethod HistoryLabelAdded |
| raw := NoMethod(*s) |
| return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) |
| } |
| |
| type HistoryLabelRemoved struct { |
| // LabelIds: Label IDs removed from the message. |
| LabelIds []string `json:"labelIds,omitempty"` |
| |
| Message *Message `json:"message,omitempty"` |
| |
| // ForceSendFields is a list of field names (e.g. "LabelIds") to |
| // unconditionally include in API requests. By default, fields with |
| // empty values are omitted from API requests. However, any non-pointer, |
| // non-interface field appearing in ForceSendFields will be sent to the |
| // server regardless of whether the field is empty or not. This may be |
| // used to include empty fields in Patch requests. |
| ForceSendFields []string `json:"-"` |
| |
| // NullFields is a list of field names (e.g. "LabelIds") to include in |
| // API requests with the JSON null value. By default, fields with empty |
| // values are omitted from API requests. However, any field with an |
| // empty value appearing in NullFields will be sent to the server as |
| // null. It is an error if a field in this list has a non-empty value. |
| // This may be used to include null fields in Patch requests. |
| NullFields []string `json:"-"` |
| } |
| |
| func (s *HistoryLabelRemoved) MarshalJSON() ([]byte, error) { |
| type NoMethod HistoryLabelRemoved |
| raw := NoMethod(*s) |
| return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) |
| } |
| |
| type HistoryMessageAdded struct { |
| Message *Message `json:"message,omitempty"` |
| |
| // ForceSendFields is a list of field names (e.g. "Message") to |
| // unconditionally include in API requests. By default, fields with |
| // empty values are omitted from API requests. However, any non-pointer, |
| // non-interface field appearing in ForceSendFields will be sent to the |
| // server regardless of whether the field is empty or not. This may be |
| // used to include empty fields in Patch requests. |
| ForceSendFields []string `json:"-"` |
| |
| // NullFields is a list of field names (e.g. "Message") to include in |
| // API requests with the JSON null value. By default, fields with empty |
| // values are omitted from API requests. However, any field with an |
| // empty value appearing in NullFields will be sent to the server as |
| // null. It is an error if a field in this list has a non-empty value. |
| // This may be used to include null fields in Patch requests. |
| NullFields []string `json:"-"` |
| } |
| |
| func (s *HistoryMessageAdded) MarshalJSON() ([]byte, error) { |
| type NoMethod HistoryMessageAdded |
| raw := NoMethod(*s) |
| return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) |
| } |
| |
| type HistoryMessageDeleted struct { |
| Message *Message `json:"message,omitempty"` |
| |
| // ForceSendFields is a list of field names (e.g. "Message") to |
| // unconditionally include in API requests. By default, fields with |
| // empty values are omitted from API requests. However, any non-pointer, |
| // non-interface field appearing in ForceSendFields will be sent to the |
| // server regardless of whether the field is empty or not. This may be |
| // used to include empty fields in Patch requests. |
| ForceSendFields []string `json:"-"` |
| |
| // NullFields is a list of field names (e.g. "Message") to include in |
| // API requests with the JSON null value. By default, fields with empty |
| // values are omitted from API requests. However, any field with an |
| // empty value appearing in NullFields will be sent to the server as |
| // null. It is an error if a field in this list has a non-empty value. |
| // This may be used to include null fields in Patch requests. |
| NullFields []string `json:"-"` |
| } |
| |
| func (s *HistoryMessageDeleted) MarshalJSON() ([]byte, error) { |
| type NoMethod HistoryMessageDeleted |
| raw := NoMethod(*s) |
| return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) |
| } |
| |
| // ImapSettings: IMAP settings for an account. |
| type ImapSettings struct { |
| // AutoExpunge: 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 bool `json:"autoExpunge,omitempty"` |
| |
| // Enabled: Whether IMAP is enabled for the account. |
| Enabled bool `json:"enabled,omitempty"` |
| |
| // ExpungeBehavior: The action that will be executed on a message when |
| // it is marked as deleted and expunged from the last visible IMAP |
| // folder. |
| // |
| // Possible values: |
| // "archive" |
| // "deleteForever" |
| // "expungeBehaviorUnspecified" |
| // "trash" |
| ExpungeBehavior string `json:"expungeBehavior,omitempty"` |
| |
| // MaxFolderSize: 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 int64 `json:"maxFolderSize,omitempty"` |
| |
| // ServerResponse contains the HTTP response code and headers from the |
| // server. |
| googleapi.ServerResponse `json:"-"` |
| |
| // ForceSendFields is a list of field names (e.g. "AutoExpunge") to |
| // unconditionally include in API requests. By default, fields with |
| // empty values are omitted from API requests. However, any non-pointer, |
| // non-interface field appearing in ForceSendFields will be sent to the |
| // server regardless of whether the field is empty or not. This may be |
| // used to include empty fields in Patch requests. |
| ForceSendFields []string `json:"-"` |
| |
| // NullFields is a list of field names (e.g. "AutoExpunge") to include |
| // in API requests with the JSON null value. By default, fields with |
| // empty values are omitted from API requests. However, any field with |
| // an empty value appearing in NullFields will be sent to the server as |
| // null. It is an error if a field in this list has a non-empty value. |
| // This may be used to include null fields in Patch requests. |
| NullFields []string `json:"-"` |
| } |
| |
| func (s *ImapSettings) MarshalJSON() ([]byte, error) { |
| type NoMethod ImapSettings |
| raw := NoMethod(*s) |
| return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) |
| } |
| |
| // Label: Labels are used to categorize messages and threads within the |
| // user's mailbox. |
| type Label struct { |
| // Color: The color to assign to the label. Color is only available for |
| // labels that have their type set to user. |
| Color *LabelColor `json:"color,omitempty"` |
| |
| // Id: The immutable ID of the label. |
| Id string `json:"id,omitempty"` |
| |
| // LabelListVisibility: The visibility of the label in the label list in |
| // the Gmail web interface. |
| // |
| // Possible values: |
| // "labelHide" |
| // "labelShow" |
| // "labelShowIfUnread" |
| LabelListVisibility string `json:"labelListVisibility,omitempty"` |
| |
| // MessageListVisibility: The visibility of the label in the message |
| // list in the Gmail web interface. |
| // |
| // Possible values: |
| // "hide" |
| // "show" |
| MessageListVisibility string `json:"messageListVisibility,omitempty"` |
| |
| // MessagesTotal: The total number of messages with the label. |
| MessagesTotal int64 `json:"messagesTotal,omitempty"` |
| |
| // MessagesUnread: The number of unread messages with the label. |
| MessagesUnread int64 `json:"messagesUnread,omitempty"` |
| |
| // Name: The display name of the label. |
| Name string `json:"name,omitempty"` |
| |
| // ThreadsTotal: The total number of threads with the label. |
| ThreadsTotal int64 `json:"threadsTotal,omitempty"` |
| |
| // ThreadsUnread: The number of unread threads with the label. |
| ThreadsUnread int64 `json:"threadsUnread,omitempty"` |
| |
| // Type: 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. |
| // |
| // Possible values: |
| // "system" |
| // "user" |
| Type string `json:"type,omitempty"` |
| |
| // ServerResponse contains the HTTP response code and headers from the |
| // server. |
| googleapi.ServerResponse `json:"-"` |
| |
| // ForceSendFields is a list of field names (e.g. "Color") to |
| // unconditionally include in API requests. By default, fields with |
| // empty values are omitted from API requests. However, any non-pointer, |
| // non-interface field appearing in ForceSendFields will be sent to the |
| // server regardless of whether the field is empty or not. This may be |
| // used to include empty fields in Patch requests. |
| ForceSendFields []string `json:"-"` |
| |
| // NullFields is a list of field names (e.g. "Color") to include in API |
| // requests with the JSON null value. By default, fields with empty |
| // values are omitted from API requests. However, any field with an |
| // empty value appearing in NullFields will be sent to the server as |
| // null. It is an error if a field in this list has a non-empty value. |
| // This may be used to include null fields in Patch requests. |
| NullFields []string `json:"-"` |
| } |
| |
| func (s *Label) MarshalJSON() ([]byte, error) { |
| type NoMethod Label |
| raw := NoMethod(*s) |
| return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) |
| } |
| |
| type LabelColor struct { |
| // BackgroundColor: 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 |
| BackgroundColor string `json:"backgroundColor,omitempty"` |
| |
| // TextColor: 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 |
| TextColor string `json:"textColor,omitempty"` |
| |
| // ForceSendFields is a list of field names (e.g. "BackgroundColor") to |
| // unconditionally include in API requests. By default, fields with |
| // empty values are omitted from API requests. However, any non-pointer, |
| // non-interface field appearing in ForceSendFields will be sent to the |
| // server regardless of whether the field is empty or not. This may be |
| // used to include empty fields in Patch requests. |
| ForceSendFields []string `json:"-"` |
| |
| // NullFields is a list of field names (e.g. "BackgroundColor") to |
| // include in API requests with the JSON null value. By default, fields |
| // with empty values are omitted from API requests. However, any field |
| // with an empty value appearing in NullFields will be sent to the |
| // server as null. It is an error if a field in this list has a |
| // non-empty value. This may be used to include null fields in Patch |
| // requests. |
| NullFields []string `json:"-"` |
| } |
| |
| func (s *LabelColor) MarshalJSON() ([]byte, error) { |
| type NoMethod LabelColor |
| raw := NoMethod(*s) |
| return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) |
| } |
| |
| // LanguageSettings: Language settings for an account. These settings |
| // correspond to the "Language settings" feature in the web interface. |
| type LanguageSettings struct { |
| // DisplayLanguage: 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. A table of sample values is also provided in the Managing |
| // Language Settings guide |
| // |
| // 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 `json:"displayLanguage,omitempty"` |
| |
| // ServerResponse contains the HTTP response code and headers from the |
| // server. |
| googleapi.ServerResponse `json:"-"` |
| |
| // ForceSendFields is a list of field names (e.g. "DisplayLanguage") to |
| // unconditionally include in API requests. By default, fields with |
| // empty values are omitted from API requests. However, any non-pointer, |
| // non-interface field appearing in ForceSendFields will be sent to the |
| // server regardless of whether the field is empty or not. This may be |
| // used to include empty fields in Patch requests. |
| ForceSendFields []string `json:"-"` |
| |
| // NullFields is a list of field names (e.g. "DisplayLanguage") to |
| // include in API requests with the JSON null value. By default, fields |
| // with empty values are omitted from API requests. However, any field |
| // with an empty value appearing in NullFields will be sent to the |
| // server as null. It is an error if a field in this list has a |
| // non-empty value. This may be used to include null fields in Patch |
| // requests. |
| NullFields []string `json:"-"` |
| } |
| |
| func (s *LanguageSettings) MarshalJSON() ([]byte, error) { |
| type NoMethod LanguageSettings |
| raw := NoMethod(*s) |
| return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) |
| } |
| |
| // ListDelegatesResponse: Response for the ListDelegates method. |
| type ListDelegatesResponse struct { |
| // Delegates: List of the user's delegates (with any verification |
| // status). |
| Delegates []*Delegate `json:"delegates,omitempty"` |
| |
| // ServerResponse contains the HTTP response code and headers from the |
| // server. |
| googleapi.ServerResponse `json:"-"` |
| |
| // ForceSendFields is a list of field names (e.g. "Delegates") to |
| // unconditionally include in API requests. By default, fields with |
| // empty values are omitted from API requests. However, any non-pointer, |
| // non-interface field appearing in ForceSendFields will be sent to the |
| // server regardless of whether the field is empty or not. This may be |
| // used to include empty fields in Patch requests. |
| ForceSendFields []string `json:"-"` |
| |
| // NullFields is a list of field names (e.g. "Delegates") to include in |
| // API requests with the JSON null value. By default, fields with empty |
| // values are omitted from API requests. However, any field with an |
| // empty value appearing in NullFields will be sent to the server as |
| // null. It is an error if a field in this list has a non-empty value. |
| // This may be used to include null fields in Patch requests. |
| NullFields []string `json:"-"` |
| } |
| |
| func (s *ListDelegatesResponse) MarshalJSON() ([]byte, error) { |
| type NoMethod ListDelegatesResponse |
| raw := NoMethod(*s) |
| return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) |
| } |
| |
| type ListDraftsResponse struct { |
| // Drafts: List of drafts. |
| Drafts []*Draft `json:"drafts,omitempty"` |
| |
| // NextPageToken: Token to retrieve the next page of results in the |
| // list. |
| NextPageToken string `json:"nextPageToken,omitempty"` |
| |
| // ResultSizeEstimate: Estimated total number of results. |
| ResultSizeEstimate int64 `json:"resultSizeEstimate,omitempty"` |
| |
| // ServerResponse contains the HTTP response code and headers from the |
| // server. |
| googleapi.ServerResponse `json:"-"` |
| |
| // ForceSendFields is a list of field names (e.g. "Drafts") to |
| // unconditionally include in API requests. By default, fields with |
| // empty values are omitted from API requests. However, any non-pointer, |
| // non-interface field appearing in ForceSendFields will be sent to the |
| // server regardless of whether the field is empty or not. This may be |
| // used to include empty fields in Patch requests. |
| ForceSendFields []string `json:"-"` |
| |
| // NullFields is a list of field names (e.g. "Drafts") to include in API |
| // requests with the JSON null value. By default, fields with empty |
| // values are omitted from API requests. However, any field with an |
| // empty value appearing in NullFields will be sent to the server as |
| // null. It is an error if a field in this list has a non-empty value. |
| // This may be used to include null fields in Patch requests. |
| NullFields []string `json:"-"` |
| } |
| |
| func (s *ListDraftsResponse) MarshalJSON() ([]byte, error) { |
| type NoMethod ListDraftsResponse |
| raw := NoMethod(*s) |
| return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) |
| } |
| |
| // ListFiltersResponse: Response for the ListFilters method. |
| type ListFiltersResponse struct { |
| // Filter: List of a user's filters. |
| Filter []*Filter `json:"filter,omitempty"` |
| |
| // ServerResponse contains the HTTP response code and headers from the |
| // server. |
| googleapi.ServerResponse `json:"-"` |
| |
| // ForceSendFields is a list of field names (e.g. "Filter") to |
| // unconditionally include in API requests. By default, fields with |
| // empty values are omitted from API requests. However, any non-pointer, |
| // non-interface field appearing in ForceSendFields will be sent to the |
| // server regardless of whether the field is empty or not. This may be |
| // used to include empty fields in Patch requests. |
| ForceSendFields []string `json:"-"` |
| |
| // NullFields is a list of field names (e.g. "Filter") to include in API |
| // requests with the JSON null value. By default, fields with empty |
| // values are omitted from API requests. However, any field with an |
| // empty value appearing in NullFields will be sent to the server as |
| // null. It is an error if a field in this list has a non-empty value. |
| // This may be used to include null fields in Patch requests. |
| NullFields []string `json:"-"` |
| } |
| |
| func (s *ListFiltersResponse) MarshalJSON() ([]byte, error) { |
| type NoMethod ListFiltersResponse |
| raw := NoMethod(*s) |
| return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) |
| } |
| |
| // ListForwardingAddressesResponse: Response for the |
| // ListForwardingAddresses method. |
| type ListForwardingAddressesResponse struct { |
| // ForwardingAddresses: List of addresses that may be used for |
| // forwarding. |
| ForwardingAddresses []*ForwardingAddress `json:"forwardingAddresses,omitempty"` |
| |
| // ServerResponse contains the HTTP response code and headers from the |
| // server. |
| googleapi.ServerResponse `json:"-"` |
| |
| // ForceSendFields is a list of field names (e.g. "ForwardingAddresses") |
| // to unconditionally include in API requests. By default, fields with |
| // empty values are omitted from API requests. However, any non-pointer, |
| // non-interface field appearing in ForceSendFields will be sent to the |
| // server regardless of whether the field is empty or not. This may be |
| // used to include empty fields in Patch requests. |
| ForceSendFields []string `json:"-"` |
| |
| // NullFields is a list of field names (e.g. "ForwardingAddresses") to |
| // include in API requests with the JSON null value. By default, fields |
| // with empty values are omitted from API requests. However, any field |
| // with an empty value appearing in NullFields will be sent to the |
| // server as null. It is an error if a field in this list has a |
| // non-empty value. This may be used to include null fields in Patch |
| // requests. |
| NullFields []string `json:"-"` |
| } |
| |
| func (s *ListForwardingAddressesResponse) MarshalJSON() ([]byte, error) { |
| type NoMethod ListForwardingAddressesResponse |
| raw := NoMethod(*s) |
| return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) |
| } |
| |
| type ListHistoryResponse struct { |
| // History: List of history records. Any messages contained in the |
| // response will typically only have id and threadId fields populated. |
| History []*History `json:"history,omitempty"` |
| |
| // HistoryId: The ID of the mailbox's current history record. |
| HistoryId uint64 `json:"historyId,omitempty,string"` |
| |
| // NextPageToken: Page token to retrieve the next page of results in the |
| // list. |
| NextPageToken string `json:"nextPageToken,omitempty"` |
| |
| // ServerResponse contains the HTTP response code and headers from the |
| // server. |
| googleapi.ServerResponse `json:"-"` |
| |
| // ForceSendFields is a list of field names (e.g. "History") to |
| // unconditionally include in API requests. By default, fields with |
| // empty values are omitted from API requests. However, any non-pointer, |
| // non-interface field appearing in ForceSendFields will be sent to the |
| // server regardless of whether the field is empty or not. This may be |
| // used to include empty fields in Patch requests. |
| ForceSendFields []string `json:"-"` |
| |
| // NullFields is a list of field names (e.g. "History") to include in |
| // API requests with the JSON null value. By default, fields with empty |
| // values are omitted from API requests. However, any field with an |
| // empty value appearing in NullFields will be sent to the server as |
| // null. It is an error if a field in this list has a non-empty value. |
| // This may be used to include null fields in Patch requests. |
| NullFields []string `json:"-"` |
| } |
| |
| func (s *ListHistoryResponse) MarshalJSON() ([]byte, error) { |
| type NoMethod ListHistoryResponse |
| raw := NoMethod(*s) |
| return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) |
| } |
| |
| type ListLabelsResponse struct { |
| // Labels: List of labels. |
| Labels []*Label `json:"labels,omitempty"` |
| |
| // ServerResponse contains the HTTP response code and headers from the |
| // server. |
| googleapi.ServerResponse `json:"-"` |
| |
| // ForceSendFields is a list of field names (e.g. "Labels") to |
| // unconditionally include in API requests. By default, fields with |
| // empty values are omitted from API requests. However, any non-pointer, |
| // non-interface field appearing in ForceSendFields will be sent to the |
| // server regardless of whether the field is empty or not. This may be |
| // used to include empty fields in Patch requests. |
| ForceSendFields []string `json:"-"` |
| |
| // NullFields is a list of field names (e.g. "Labels") to include in API |
| // requests with the JSON null value. By default, fields with empty |
| // values are omitted from API requests. However, any field with an |
| // empty value appearing in NullFields will be sent to the server as |
| // null. It is an error if a field in this list has a non-empty value. |
| // This may be used to include null fields in Patch requests. |
| NullFields []string `json:"-"` |
| } |
| |
| func (s *ListLabelsResponse) MarshalJSON() ([]byte, error) { |
| type NoMethod ListLabelsResponse |
| raw := NoMethod(*s) |
| return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) |
| } |
| |
| type ListMessagesResponse struct { |
| // Messages: 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 `json:"messages,omitempty"` |
| |
| // NextPageToken: Token to retrieve the next page of results in the |
| // list. |
| NextPageToken string `json:"nextPageToken,omitempty"` |
| |
| // ResultSizeEstimate: Estimated total number of results. |
| ResultSizeEstimate int64 `json:"resultSizeEstimate,omitempty"` |
| |
| // ServerResponse contains the HTTP response code and headers from the |
| // server. |
| googleapi.ServerResponse `json:"-"` |
| |
| // ForceSendFields is a list of field names (e.g. "Messages") to |
| // unconditionally include in API requests. By default, fields with |
| // empty values are omitted from API requests. However, any non-pointer, |
| // non-interface field appearing in ForceSendFields will be sent to the |
| // server regardless of whether the field is empty or not. This may be |
| // used to include empty fields in Patch requests. |
| ForceSendFields []string `json:"-"` |
| |
| // NullFields is a list of field names (e.g. "Messages") to include in |
| // API requests with the JSON null value. By default, fields with empty |
| // values are omitted from API requests. However, any field with an |
| // empty value appearing in NullFields will be sent to the server as |
| // null. It is an error if a field in this list has a non-empty value. |
| // This may be used to include null fields in Patch requests. |
| NullFields []string `json:"-"` |
| } |
| |
| func (s *ListMessagesResponse) MarshalJSON() ([]byte, error) { |
| type NoMethod ListMessagesResponse |
| raw := NoMethod(*s) |
| return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) |
| } |
| |
| // ListSendAsResponse: Response for the ListSendAs method. |
| type ListSendAsResponse struct { |
| // SendAs: List of send-as aliases. |
| SendAs []*SendAs `json:"sendAs,omitempty"` |
| |
| // ServerResponse contains the HTTP response code and headers from the |
| // server. |
| googleapi.ServerResponse `json:"-"` |
| |
| // ForceSendFields is a list of field names (e.g. "SendAs") to |
| // unconditionally include in API requests. By default, fields with |
| // empty values are omitted from API requests. However, any non-pointer, |
| // non-interface field appearing in ForceSendFields will be sent to the |
| // server regardless of whether the field is empty or not. This may be |
| // used to include empty fields in Patch requests. |
| ForceSendFields []string `json:"-"` |
| |
| // NullFields is a list of field names (e.g. "SendAs") to include in API |
| // requests with the JSON null value. By default, fields with empty |
| // values are omitted from API requests. However, any field with an |
| // empty value appearing in NullFields will be sent to the server as |
| // null. It is an error if a field in this list has a non-empty value. |
| // This may be used to include null fields in Patch requests. |
| NullFields []string `json:"-"` |
| } |
| |
| func (s *ListSendAsResponse) MarshalJSON() ([]byte, error) { |
| type NoMethod ListSendAsResponse |
| raw := NoMethod(*s) |
| return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) |
| } |
| |
| type ListSmimeInfoResponse struct { |
| // SmimeInfo: List of SmimeInfo. |
| SmimeInfo []*SmimeInfo `json:"smimeInfo,omitempty"` |
| |
| // ServerResponse contains the HTTP response code and headers from the |
| // server. |
| googleapi.ServerResponse `json:"-"` |
| |
| // ForceSendFields is a list of field names (e.g. "SmimeInfo") to |
| // unconditionally include in API requests. By default, fields with |
| // empty values are omitted from API requests. However, any non-pointer, |
| // non-interface field appearing in ForceSendFields will be sent to the |
| // server regardless of whether the field is empty or not. This may be |
| // used to include empty fields in Patch requests. |
| ForceSendFields []string `json:"-"` |
| |
| // NullFields is a list of field names (e.g. "SmimeInfo") to include in |
| // API requests with the JSON null value. By default, fields with empty |
| // values are omitted from API requests. However, any field with an |
| // empty value appearing in NullFields will be sent to the server as |
| // null. It is an error if a field in this list has a non-empty value. |
| // This may be used to include null fields in Patch requests. |
| NullFields []string `json:"-"` |
| } |
| |
| func (s *ListSmimeInfoResponse) MarshalJSON() ([]byte, error) { |
| type NoMethod ListSmimeInfoResponse |
| raw := NoMethod(*s) |
| return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) |
| } |
| |
| type ListThreadsResponse struct { |
| // NextPageToken: Page token to retrieve the next page of results in the |
| // list. |
| NextPageToken string `json:"nextPageToken,omitempty"` |
| |
| // ResultSizeEstimate: Estimated total number of results. |
| ResultSizeEstimate int64 `json:"resultSizeEstimate,omitempty"` |
| |
| // Threads: 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 method. |
| Threads []*Thread `json:"threads,omitempty"` |
| |
| // ServerResponse contains the HTTP response code and headers from the |
| // server. |
| googleapi.ServerResponse `json:"-"` |
| |
| // ForceSendFields is a list of field names (e.g. "NextPageToken") to |
| // unconditionally include in API requests. By default, fields with |
| // empty values are omitted from API requests. However, any non-pointer, |
| // non-interface field appearing in ForceSendFields will be sent to the |
| // server regardless of whether the field is empty or not. This may be |
| // used to include empty fields in Patch requests. |
| ForceSendFields []string `json:"-"` |
| |
| // NullFields is a list of field names (e.g. "NextPageToken") to include |
| // in API requests with the JSON null value. By default, fields with |
| // empty values are omitted from API requests. However, any field with |
| // an empty value appearing in NullFields will be sent to the server as |
| // null. It is an error if a field in this list has a non-empty value. |
| // This may be used to include null fields in Patch requests. |
| NullFields []string `json:"-"` |
| } |
| |
| func (s *ListThreadsResponse) MarshalJSON() ([]byte, error) { |
| type NoMethod ListThreadsResponse |
| raw := NoMethod(*s) |
| return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) |
| } |
| |
| // Message: An email message. |
| type Message struct { |
| // HistoryId: The ID of the last history record that modified this |
| // message. |
| HistoryId uint64 `json:"historyId,omitempty,string"` |
| |
| // Id: The immutable ID of the message. |
| Id string `json:"id,omitempty"` |
| |
| // InternalDate: 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 int64 `json:"internalDate,omitempty,string"` |
| |
| // LabelIds: List of IDs of labels applied to this message. |
| LabelIds []string `json:"labelIds,omitempty"` |
| |
| // Payload: The parsed email structure in the message parts. |
| Payload *MessagePart `json:"payload,omitempty"` |
| |
| // Raw: 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. |
| Raw string `json:"raw,omitempty"` |
| |
| // SizeEstimate: Estimated size in bytes of the message. |
| SizeEstimate int64 `json:"sizeEstimate,omitempty"` |
| |
| // Snippet: A short part of the message text. |
| Snippet string `json:"snippet,omitempty"` |
| |
| // ThreadId: The ID of the thread the message belongs to. To add a |
| // message or draft to a thread, the following criteria must be met: |
| // - The requested threadId must be specified on the Message or |
| // Draft.Message you supply with your request. |
| // - The References and In-Reply-To headers must be set in compliance |
| // with the RFC 2822 standard. |
| // - The Subject headers must match. |
| ThreadId string `json:"threadId,omitempty"` |
| |
| // ServerResponse contains the HTTP response code and headers from the |
| // server. |
| googleapi.ServerResponse `json:"-"` |
| |
| // ForceSendFields is a list of field names (e.g. "HistoryId") to |
| // unconditionally include in API requests. By default, fields with |
| // empty values are omitted from API requests. However, any non-pointer, |
| // non-interface field appearing in ForceSendFields will be sent to the |
| // server regardless of whether the field is empty or not. This may be |
| // used to include empty fields in Patch requests. |
| ForceSendFields []string `json:"-"` |
| |
| // NullFields is a list of field names (e.g. "HistoryId") to include in |
| // API requests with the JSON null value. By default, fields with empty |
| // values are omitted from API requests. However, any field with an |
| // empty value appearing in NullFields will be sent to the server as |
| // null. It is an error if a field in this list has a non-empty value. |
| // This may be used to include null fields in Patch requests. |
| NullFields []string `json:"-"` |
| } |
| |
| func (s *Message) MarshalJSON() ([]byte, error) { |
| type NoMethod Message |
| raw := NoMethod(*s) |
| return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) |
| } |
| |
| // MessagePart: A single MIME message part. |
| type MessagePart struct { |
| // Body: The message part body for this part, which may be empty for |
| // container MIME message parts. |
| Body *MessagePartBody `json:"body,omitempty"` |
| |
| // Filename: The filename of the attachment. Only present if this |
| // message part represents an attachment. |
| Filename string `json:"filename,omitempty"` |
| |
| // Headers: 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 `json:"headers,omitempty"` |
| |
| // MimeType: The MIME type of the message part. |
| MimeType string `json:"mimeType,omitempty"` |
| |
| // PartId: The immutable ID of the message part. |
| PartId string `json:"partId,omitempty"` |
| |
| // Parts: 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 `json:"parts,omitempty"` |
| |
| // ForceSendFields is a list of field names (e.g. "Body") to |
| // unconditionally include in API requests. By default, fields with |
| // empty values are omitted from API requests. However, any non-pointer, |
| // non-interface field appearing in ForceSendFields will be sent to the |
| // server regardless of whether the field is empty or not. This may be |
| // used to include empty fields in Patch requests. |
| ForceSendFields []string `json:"-"` |
| |
| // NullFields is a list of field names (e.g. "Body") to include in API |
| // requests with the JSON null value. By default, fields with empty |
| // values are omitted from API requests. However, any field with an |
| // empty value appearing in NullFields will be sent to the server as |
| // null. It is an error if a field in this list has a non-empty value. |
| // This may be used to include null fields in Patch requests. |
| NullFields []string `json:"-"` |
| } |
| |
| func (s *MessagePart) MarshalJSON() ([]byte, error) { |
| type NoMethod MessagePart |
| raw := NoMethod(*s) |
| return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) |
| } |
| |
| // MessagePartBody: The body of a single MIME message part. |
| type MessagePartBody struct { |
| // AttachmentId: 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 `json:"attachmentId,omitempty"` |
| |
| // Data: 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 `json:"data,omitempty"` |
| |
| // Size: Number of bytes for the message part data (encoding |
| // notwithstanding). |
| Size int64 `json:"size,omitempty"` |
| |
| // ServerResponse contains the HTTP response code and headers from the |
| // server. |
| googleapi.ServerResponse `json:"-"` |
| |
| // ForceSendFields is a list of field names (e.g. "AttachmentId") to |
| // unconditionally include in API requests. By default, fields with |
| // empty values are omitted from API requests. However, any non-pointer, |
| // non-interface field appearing in ForceSendFields will be sent to the |
| // server regardless of whether the field is empty or not. This may be |
| // used to include empty fields in Patch requests. |
| ForceSendFields []string `json:"-"` |
| |
| // NullFields is a list of field names (e.g. "AttachmentId") to include |
| // in API requests with the JSON null value. By default, fields with |
| // empty values are omitted from API requests. However, any field with |
| // an empty value appearing in NullFields will be sent to the server as |
| // null. It is an error if a field in this list has a non-empty value. |
| // This may be used to include null fields in Patch requests. |
| NullFields []string `json:"-"` |
| } |
| |
| func (s *MessagePartBody) MarshalJSON() ([]byte, error) { |
| type NoMethod MessagePartBody |
| raw := NoMethod(*s) |
| return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) |
| } |
| |
| type MessagePartHeader struct { |
| // Name: The name of the header before the : separator. For example, To. |
| Name string `json:"name,omitempty"` |
| |
| // Value: The value of the header after the : separator. For example, |
| // someuser@example.com. |
| Value string `json:"value,omitempty"` |
| |
| // ForceSendFields is a list of field names (e.g. "Name") to |
| // unconditionally include in API requests. By default, fields with |
| // empty values are omitted from API requests. However, any non-pointer, |
| // non-interface field appearing in ForceSendFields will be sent to the |
| // server regardless of whether the field is empty or not. This may be |
| // used to include empty fields in Patch requests. |
| ForceSendFields []string `json:"-"` |
| |
| // NullFields is a list of field names (e.g. "Name") to include in API |
| // requests with the JSON null value. By default, fields with empty |
| // values are omitted from API requests. However, any field with an |
| // empty value appearing in NullFields will be sent to the server as |
| // null. It is an error if a field in this list has a non-empty value. |
| // This may be used to include null fields in Patch requests. |
| NullFields []string `json:"-"` |
| } |
| |
| func (s *MessagePartHeader) MarshalJSON() ([]byte, error) { |
| type NoMethod MessagePartHeader |
| raw := NoMethod(*s) |
| return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) |
| } |
| |
| type ModifyMessageRequest struct { |
| // AddLabelIds: A list of IDs of labels to add to this message. |
| AddLabelIds []string `json:"addLabelIds,omitempty"` |
| |
| // RemoveLabelIds: A list IDs of labels to remove from this message. |
| RemoveLabelIds []string `json:"removeLabelIds,omitempty"` |
| |
| // ForceSendFields is a list of field names (e.g. "AddLabelIds") to |
| // unconditionally include in API requests. By default, fields with |
| // empty values are omitted from API requests. However, any non-pointer, |
| // non-interface field appearing in ForceSendFields will be sent to the |
| // server regardless of whether the field is empty or not. This may be |
| // used to include empty fields in Patch requests. |
| ForceSendFields []string `json:"-"` |
| |
| // NullFields is a list of field names (e.g. "AddLabelIds") to include |
| // in API requests with the JSON null value. By default, fields with |
| // empty values are omitted from API requests. However, any field with |
| // an empty value appearing in NullFields will be sent to the server as |
| // null. It is an error if a field in this list has a non-empty value. |
| // This may be used to include null fields in Patch requests. |
| NullFields []string `json:"-"` |
| } |
| |
| func (s *ModifyMessageRequest) MarshalJSON() ([]byte, error) { |
| type NoMethod ModifyMessageRequest |
| raw := NoMethod(*s) |
| return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) |
| } |
| |
| type ModifyThreadRequest struct { |
| // AddLabelIds: A list of IDs of labels to add to this thread. |
| AddLabelIds []string `json:"addLabelIds,omitempty"` |
| |
| // RemoveLabelIds: A list of IDs of labels to remove from this thread. |
| RemoveLabelIds []string `json:"removeLabelIds,omitempty"` |
| |
| // ForceSendFields is a list of field names (e.g. "AddLabelIds") to |
| // unconditionally include in API requests. By default, fields with |
| // empty values are omitted from API requests. However, any non-pointer, |
| // non-interface field appearing in ForceSendFields will be sent to the |
| // server regardless of whether the field is empty or not. This may be |
| // used to include empty fields in Patch requests. |
| ForceSendFields []string `json:"-"` |
| |
| // NullFields is a list of field names (e.g. "AddLabelIds") to include |
| // in API requests with the JSON null value. By default, fields with |
| // empty values are omitted from API requests. However, any field with |
| // an empty value appearing in NullFields will be sent to the server as |
| // null. It is an error if a field in this list has a non-empty value. |
| // This may be used to include null fields in Patch requests. |
| NullFields []string `json:"-"` |
| } |
| |
| func (s *ModifyThreadRequest) MarshalJSON() ([]byte, error) { |
| type NoMethod ModifyThreadRequest |
| raw := NoMethod(*s) |
| return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) |
| } |
| |
| // PopSettings: POP settings for an account. |
| type PopSettings struct { |
| // AccessWindow: The range of messages which are accessible via POP. |
| // |
| // Possible values: |
| // "accessWindowUnspecified" |
| // "allMail" |
| // "disabled" |
| // "fromNowOn" |
| AccessWindow string `json:"accessWindow,omitempty"` |
| |
| // Disposition: The action that will be executed on a message after it |
| // has been fetched via POP. |
| // |
| // Possible values: |
| // "archive" |
| // "dispositionUnspecified" |
| // "leaveInInbox" |
| // "markRead" |
| // "trash" |
| Disposition string `json:"disposition,omitempty"` |
| |
| // ServerResponse contains the HTTP response code and headers from the |
| // server. |
| googleapi.ServerResponse `json:"-"` |
| |
| // ForceSendFields is a list of field names (e.g. "AccessWindow") to |
| // unconditionally include in API requests. By default, fields with |
| // empty values are omitted from API requests. However, any non-pointer, |
| // non-interface field appearing in ForceSendFields will be sent to the |
| // server regardless of whether the field is empty or not. This may be |
| // used to include empty fields in Patch requests. |
| ForceSendFields []string `json:"-"` |
| |
| // NullFields is a list of field names (e.g. "AccessWindow") to include |
| // in API requests with the JSON null value. By default, fields with |
| // empty values are omitted from API requests. However, any field with |
| // an empty value appearing in NullFields will be sent to the server as |
| // null. It is an error if a field in this list has a non-empty value. |
| // This may be used to include null fields in Patch requests. |
| NullFields []string `json:"-"` |
| } |
| |
| func (s *PopSettings) MarshalJSON() ([]byte, error) { |
| type NoMethod PopSettings |
| raw := NoMethod(*s) |
| return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) |
| } |
| |
| // Profile: Profile for a Gmail user. |
| type Profile struct { |
| // EmailAddress: The user's email address. |
| EmailAddress string `json:"emailAddress,omitempty"` |
| |
| // HistoryId: The ID of the mailbox's current history record. |
| HistoryId uint64 `json:"historyId,omitempty,string"` |
| |
| // MessagesTotal: The total number of messages in the mailbox. |
| MessagesTotal int64 `json:"messagesTotal,omitempty"` |
| |
| // ThreadsTotal: The total number of threads in the mailbox. |
| ThreadsTotal int64 `json:"threadsTotal,omitempty"` |
| |
| // ServerResponse contains the HTTP response code and headers from the |
| // server. |
| googleapi.ServerResponse `json:"-"` |
| |
| // ForceSendFields is a list of field names (e.g. "EmailAddress") to |
| // unconditionally include in API requests. By default, fields with |
| // empty values are omitted from API requests. However, any non-pointer, |
| // non-interface field appearing in ForceSendFields will be sent to the |
| // server regardless of whether the field is empty or not. This may be |
| // used to include empty fields in Patch requests. |
| ForceSendFields []string `json:"-"` |
| |
| // NullFields is a list of field names (e.g. "EmailAddress") to include |
| // in API requests with the JSON null value. By default, fields with |
| // empty values are omitted from API requests. However, any field with |
| // an empty value appearing in NullFields will be sent to the server as |
| // null. It is an error if a field in this list has a non-empty value. |
| // This may be used to include null fields in Patch requests. |
| NullFields []string `json:"-"` |
| } |
| |
| func (s *Profile) MarshalJSON() ([]byte, error) { |
| type NoMethod Profile |
| raw := NoMethod(*s) |
| return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) |
| } |
| |
| // SendAs: Settings associated with a send-as alias, which can be either |
| // the primary login address associated with the account or a custom |
| // "from" address. Send-as aliases correspond to the "Send Mail As" |
| // feature in the web interface. |
| type SendAs struct { |
| // DisplayName: 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 `json:"displayName,omitempty"` |
| |
| // IsDefault: 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 bool `json:"isDefault,omitempty"` |
| |
| // IsPrimary: 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 bool `json:"isPrimary,omitempty"` |
| |
| // ReplyToAddress: 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 `json:"replyToAddress,omitempty"` |
| |
| // SendAsEmail: 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 `json:"sendAsEmail,omitempty"` |
| |
| // Signature: An optional HTML signature that is included in messages |
| // composed with this alias in the Gmail web UI. |
| Signature string `json:"signature,omitempty"` |
| |
| // SmtpMsa: 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 `json:"smtpMsa,omitempty"` |
| |
| // TreatAsAlias: 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 bool `json:"treatAsAlias,omitempty"` |
| |
| // VerificationStatus: Indicates whether this address has been verified |
| // for use as a send-as alias. Read-only. This setting only applies to |
| // custom "from" aliases. |
| // |
| // Possible values: |
| // "accepted" |
| // "pending" |
| // "verificationStatusUnspecified" |
| VerificationStatus string `json:"verificationStatus,omitempty"` |
| |
| // ServerResponse contains the HTTP response code and headers from the |
| // server. |
| googleapi.ServerResponse `json:"-"` |
| |
| // ForceSendFields is a list of field names (e.g. "DisplayName") to |
| // unconditionally include in API requests. By default, fields with |
| // empty values are omitted from API requests. However, any non-pointer, |
| // non-interface field appearing in ForceSendFields will be sent to the |
| // server regardless of whether the field is empty or not. This may be |
| // used to include empty fields in Patch requests. |
| ForceSendFields []string `json:"-"` |
| |
| // NullFields is a list of field names (e.g. "DisplayName") to include |
| // in API requests with the JSON null value. By default, fields with |
| // empty values are omitted from API requests. However, any field with |
| // an empty value appearing in NullFields will be sent to the server as |
| // null. It is an error if a field in this list has a non-empty value. |
| // This may be used to include null fields in Patch requests. |
| NullFields []string `json:"-"` |
| } |
| |
| func (s *SendAs) MarshalJSON() ([]byte, error) { |
| type NoMethod SendAs |
| raw := NoMethod(*s) |
| return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) |
| } |
| |
| // SmimeInfo: An S/MIME email config. |
| type SmimeInfo struct { |
| // EncryptedKeyPassword: Encrypted key password, when key is encrypted. |
| EncryptedKeyPassword string `json:"encryptedKeyPassword,omitempty"` |
| |
| // Expiration: When the certificate expires (in milliseconds since |
| // epoch). |
| Expiration int64 `json:"expiration,omitempty,string"` |
| |
| // Id: The immutable ID for the SmimeInfo. |
| Id string `json:"id,omitempty"` |
| |
| // IsDefault: Whether this SmimeInfo is the default one for this user's |
| // send-as address. |
| IsDefault bool `json:"isDefault,omitempty"` |
| |
| // IssuerCn: The S/MIME certificate issuer's common name. |
| IssuerCn string `json:"issuerCn,omitempty"` |
| |
| // Pem: 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 `json:"pem,omitempty"` |
| |
| // Pkcs12: 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 `json:"pkcs12,omitempty"` |
| |
| // ServerResponse contains the HTTP response code and headers from the |
| // server. |
| googleapi.ServerResponse `json:"-"` |
| |
| // ForceSendFields is a list of field names (e.g. |
| // "EncryptedKeyPassword") to unconditionally include in API requests. |
| // By default, fields with empty values are omitted from API requests. |
| // However, any non-pointer, non-interface field appearing in |
| // ForceSendFields will be sent to the server regardless of whether the |
| // field is empty or not. This may be used to include empty fields in |
| // Patch requests. |
| ForceSendFields []string `json:"-"` |
| |
| // NullFields is a list of field names (e.g. "EncryptedKeyPassword") to |
| // include in API requests with the JSON null value. By default, fields |
| // with empty values are omitted from API requests. However, any field |
| // with an empty value appearing in NullFields will be sent to the |
| // server as null. It is an error if a field in this list has a |
| // non-empty value. This may be used to include null fields in Patch |
| // requests. |
| NullFields []string `json:"-"` |
| } |
| |
| func (s *SmimeInfo) MarshalJSON() ([]byte, error) { |
| type NoMethod SmimeInfo |
| raw := NoMethod(*s) |
| return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) |
| } |
| |
| // SmtpMsa: Configuration for communication with an SMTP service. |
| type SmtpMsa struct { |
| // Host: The hostname of the SMTP service. Required. |
| Host string `json:"host,omitempty"` |
| |
| // Password: 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 `json:"password,omitempty"` |
| |
| // Port: The port of the SMTP service. Required. |
| Port int64 `json:"port,omitempty"` |
| |
| // SecurityMode: The protocol that will be used to secure communication |
| // with the SMTP service. Required. |
| // |
| // Possible values: |
| // "none" |
| // "securityModeUnspecified" |
| // "ssl" |
| // "starttls" |
| SecurityMode string `json:"securityMode,omitempty"` |
| |
| // Username: 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 `json:"username,omitempty"` |
| |
| // ForceSendFields is a list of field names (e.g. "Host") to |
| // unconditionally include in API requests. By default, fields with |
| // empty values are omitted from API requests. However, any non-pointer, |
| // non-interface field appearing in ForceSendFields will be sent to the |
| // server regardless of whether the field is empty or not. This may be |
| // used to include empty fields in Patch requests. |
| ForceSendFields []string `json:"-"` |
| |
| // NullFields is a list of field names (e.g. "Host") to include in API |
| // requests with the JSON null value. By default, fields with empty |
| // values are omitted from API requests. However, any field with an |
| // empty value appearing in NullFields will be sent to the server as |
| // null. It is an error if a field in this list has a non-empty value. |
| // This may be used to include null fields in Patch requests. |
| NullFields []string `json:"-"` |
| } |
| |
| func (s *SmtpMsa) MarshalJSON() ([]byte, error) { |
| type NoMethod SmtpMsa |
| raw := NoMethod(*s) |
| return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) |
| } |
| |
| // Thread: A collection of messages representing a conversation. |
| type Thread struct { |
| // HistoryId: The ID of the last history record that modified this |
| // thread. |
| HistoryId uint64 `json:"historyId,omitempty,string"` |
| |
| // Id: The unique ID of the thread. |
| Id string `json:"id,omitempty"` |
| |
| // Messages: The list of messages in the thread. |
| Messages []*Message `json:"messages,omitempty"` |
| |
| // Snippet: A short part of the message text. |
| Snippet string `json:"snippet,omitempty"` |
| |
| // ServerResponse contains the HTTP response code and headers from the |
| // server. |
| googleapi.ServerResponse `json:"-"` |
| |
| // ForceSendFields is a list of field names (e.g. "HistoryId") to |
| // unconditionally include in API requests. By default, fields with |
| // empty values are omitted from API requests. However, any non-pointer, |
| // non-interface field appearing in ForceSendFields will be sent to the |
| // server regardless of whether the field is empty or not. This may be |
| // used to include empty fields in Patch requests. |
| ForceSendFields []string `json:"-"` |
| |
| // NullFields is a list of field names (e.g. "HistoryId") to include in |
| // API requests with the JSON null value. By default, fields with empty |
| // values are omitted from API requests. However, any field with an |
| // empty value appearing in NullFields will be sent to the server as |
| // null. It is an error if a field in this list has a non-empty value. |
| // This may be used to include null fields in Patch requests. |
| NullFields []string `json:"-"` |
| } |
| |
| func (s *Thread) MarshalJSON() ([]byte, error) { |
| type NoMethod Thread |
| raw := NoMethod(*s) |
| return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) |
| } |
| |
| // VacationSettings: Vacation auto-reply settings for an account. These |
| // settings correspond to the "Vacation responder" feature in the web |
| // interface. |
| type VacationSettings struct { |
| // EnableAutoReply: Flag that controls whether Gmail automatically |
| // replies to messages. |
| EnableAutoReply bool `json:"enableAutoReply,omitempty"` |
| |
| // EndTime: 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 int64 `json:"endTime,omitempty,string"` |
| |
| // ResponseBodyHtml: Response body in HTML format. Gmail will sanitize |
| // the HTML before storing it. |
| ResponseBodyHtml string `json:"responseBodyHtml,omitempty"` |
| |
| // ResponseBodyPlainText: Response body in plain text format. |
| ResponseBodyPlainText string `json:"responseBodyPlainText,omitempty"` |
| |
| // ResponseSubject: 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 `json:"responseSubject,omitempty"` |
| |
| // RestrictToContacts: Flag that determines whether responses are sent |
| // to recipients who are not in the user's list of contacts. |
| RestrictToContacts bool `json:"restrictToContacts,omitempty"` |
| |
| // RestrictToDomain: Flag that determines whether responses are sent to |
| // recipients who are outside of the user's domain. This feature is only |
| // available for G Suite users. |
| RestrictToDomain bool `json:"restrictToDomain,omitempty"` |
| |
| // StartTime: 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 int64 `json:"startTime,omitempty,string"` |
| |
| // ServerResponse contains the HTTP response code and headers from the |
| // server. |
| googleapi.ServerResponse `json:"-"` |
| |
| // ForceSendFields is a list of field names (e.g. "EnableAutoReply") to |
| // unconditionally include in API requests. By default, fields with |
| // empty values are omitted from API requests. However, any non-pointer, |
| // non-interface field appearing in ForceSendFields will be sent to the |
| // server regardless of whether the field is empty or not. This may be |
| // used to include empty fields in Patch requests. |
| ForceSendFields []string `json:"-"` |
| |
| // NullFields is a list of field names (e.g. "EnableAutoReply") to |
| // include in API requests with the JSON null value. By default, fields |
| // with empty values are omitted from API requests. However, any field |
| // with an empty value appearing in NullFields will be sent to the |
| // server as null. It is an error if a field in this list has a |
| // non-empty value. This may be used to include null fields in Patch |
| // requests. |
| NullFields []string `json:"-"` |
| } |
| |
| func (s *VacationSettings) MarshalJSON() ([]byte, error) { |
| type NoMethod VacationSettings |
| raw := NoMethod(*s) |
| return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) |
| } |
| |
| // WatchRequest: Set up or update a new push notification watch on this |
| // user's mailbox. |
| type WatchRequest struct { |
| // LabelFilterAction: Filtering behavior of labelIds list specified. |
| // |
| // Possible values: |
| // "exclude" |
| // "include" |
| LabelFilterAction string `json:"labelFilterAction,omitempty"` |
| |
| // LabelIds: 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 `json:"labelIds,omitempty"` |
| |
| // TopicName: 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 `json:"topicName,omitempty"` |
| |
| // ForceSendFields is a list of field names (e.g. "LabelFilterAction") |
| // to unconditionally include in API requests. By default, fields with |
| // empty values are omitted from API requests. However, any non-pointer, |
| // non-interface field appearing in ForceSendFields will be sent to the |
| // server regardless of whether the field is empty or not. This may be |
| // used to include empty fields in Patch requests. |
| ForceSendFields []string `json:"-"` |
| |
| // NullFields is a list of field names (e.g. "LabelFilterAction") to |
| // include in API requests with the JSON null value. By default, fields |
| // with empty values are omitted from API requests. However, any field |
| // with an empty value appearing in NullFields will be sent to the |
| // server as null. It is an error if a field in this list has a |
| // non-empty value. This may be used to include null fields in Patch |
| // requests. |
| NullFields []string `json:"-"` |
| } |
| |
| func (s *WatchRequest) MarshalJSON() ([]byte, error) { |
| type NoMethod WatchRequest |
| raw := NoMethod(*s) |
| return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) |
| } |
| |
| // WatchResponse: Push notification watch response. |
| type WatchResponse struct { |
| // Expiration: When Gmail will stop sending notifications for mailbox |
| // updates (epoch millis). Call watch again before this time to renew |
| // the watch. |
| Expiration int64 `json:"expiration,omitempty,string"` |
| |
| // HistoryId: The ID of the mailbox's current history record. |
| HistoryId uint64 `json:"historyId,omitempty,string"` |
| |
| // ServerResponse contains the HTTP response code and headers from the |
| // server. |
| googleapi.ServerResponse `json:"-"` |
| |
| // ForceSendFields is a list of field names (e.g. "Expiration") to |
| // unconditionally include in API requests. By default, fields with |
| // empty values are omitted from API requests. However, any non-pointer, |
| // non-interface field appearing in ForceSendFields will be sent to the |
| // server regardless of whether the field is empty or not. This may be |
| // used to include empty fields in Patch requests. |
| ForceSendFields []string `json:"-"` |
| |
| // NullFields is a list of field names (e.g. "Expiration") to include in |
| // API requests with the JSON null value. By default, fields with empty |
| // values are omitted from API requests. However, any field with an |
| // empty value appearing in NullFields will be sent to the server as |
| // null. It is an error if a field in this list has a non-empty value. |
| // This may be used to include null fields in Patch requests. |
| NullFields []string `json:"-"` |
| } |
| |
| func (s *WatchResponse) MarshalJSON() ([]byte, error) { |
| type NoMethod WatchResponse |
| raw := NoMethod(*s) |
| return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) |
| } |
| |
| // method id "gmail.users.getProfile": |
| |
| type UsersGetProfileCall struct { |
| s *Service |
| userId string |
| urlParams_ gensupport.URLParams |
| ifNoneMatch_ string |
| ctx_ context.Context |
| header_ http.Header |
| } |
| |
| // GetProfile: Gets the current user's Gmail profile. |
| func (r *UsersService) GetProfile(userId string) *UsersGetProfileCall { |
| c := &UsersGetProfileCall{s: r.s, urlParams_: make(gensupport.URLParams)} |
| c.userId = userId |
| return c |
| } |
| |
| // Fields allows partial responses to be retrieved. See |
| // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse |
| // for more information. |
| func (c *UsersGetProfileCall) Fields(s ...googleapi.Field) *UsersGetProfileCall { |
| c.urlParams_.Set("fields", googleapi.CombineFields(s)) |
| return c |
| } |
| |
| // IfNoneMatch sets the optional parameter which makes the operation |
| // fail if the object's ETag matches the given value. This is useful for |
| // getting updates only after the object has changed since the last |
| // request. Use googleapi.IsNotModified to check whether the response |
| // error from Do is the result of In-None-Match. |
| func (c *UsersGetProfileCall) IfNoneMatch(entityTag string) *UsersGetProfileCall { |
| c.ifNoneMatch_ = entityTag |
| return c |
| } |
| |
| // Context sets the context to be used in this call's Do method. Any |
| // pending HTTP request will be aborted if the provided context is |
| // canceled. |
| func (c *UsersGetProfileCall) Context(ctx context.Context) *UsersGetProfileCall { |
| c.ctx_ = ctx |
| return c |
| } |
| |
| // Header returns an http.Header that can be modified by the caller to |
| // add HTTP headers to the request. |
| func (c *UsersGetProfileCall) Header() http.Header { |
| if c.header_ == nil { |
| c.header_ = make(http.Header) |
| } |
| return c.header_ |
| } |
| |
| func (c *UsersGetProfileCall) doRequest(alt string) (*http.Response, error) { |
| reqHeaders := make(http.Header) |
| reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20191204") |
| for k, v := range c.header_ { |
| reqHeaders[k] = v |
| } |
| reqHeaders.Set("User-Agent", c.s.userAgent()) |
| if c.ifNoneMatch_ != "" { |
| reqHeaders.Set("If-None-Match", c.ifNoneMatch_) |
| } |
| var body io.Reader = nil |
| c.urlParams_.Set("alt", alt) |
| c.urlParams_.Set("prettyPrint", "false") |
| urls := googleapi.ResolveRelative(c.s.BasePath, "{userId}/profile") |
| urls += "?" + c.urlParams_.Encode() |
| req, err := http.NewRequest("GET", urls, body) |
| if err != nil { |
| return nil, err |
| } |
| req.Header = reqHeaders |
| googleapi.Expand(req.URL, map[string]string{ |
| "userId": c.userId, |
| }) |
| return gensupport.SendRequest(c.ctx_, c.s.client, req) |
| } |
| |
| // Do executes the "gmail.users.getProfile" call. |
| // Exactly one of *Profile or error will be non-nil. Any non-2xx status |
| // code is an error. Response headers are in either |
| // *Profile.ServerResponse.Header or (if a response was returned at all) |
| // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to |
| // check whether the returned error was because http.StatusNotModified |
| // was returned. |
| func (c *UsersGetProfileCall) Do(opts ...googleapi.CallOption) (*Profile, error) { |
| gensupport.SetOptions(c.urlParams_, opts...) |
| res, err := c.doRequest("json") |
| if res != nil && res.StatusCode == http.StatusNotModified { |
| if res.Body != nil { |
| res.Body.Close() |
| } |
| return nil, &googleapi.Error{ |
| Code: res.StatusCode, |
| Header: res.Header, |
| } |
| } |
| if err != nil { |
| return nil, err |
| } |
| defer googleapi.CloseBody(res) |
| if err := googleapi.CheckResponse(res); err != nil { |
| return nil, err |
| } |
| ret := &Profile{ |
| ServerResponse: googleapi.ServerResponse{ |
| Header: res.Header, |
| HTTPStatusCode: res.StatusCode, |
| }, |
| } |
| target := &ret |
| if err := gensupport.DecodeResponse(target, res); err != nil { |
| return nil, err |
| } |
| return ret, nil |
| // { |
| // "description": "Gets the current user's Gmail profile.", |
| // "httpMethod": "GET", |
| // "id": "gmail.users.getProfile", |
| // "parameterOrder": [ |
| // "userId" |
| // ], |
| // "parameters": { |
| // "userId": { |
| // "default": "me", |
| // "description": "The user's email address. The special value me can be used to indicate the authenticated user.", |
| // "location": "path", |
| // "required": true, |
| // "type": "string" |
| // } |
| // }, |
| // "path": "{userId}/profile", |
| // "response": { |
| // "$ref": "Profile" |
| // }, |
| // "scopes": [ |
| // "https://mail.google.com/", |
| // "https://www.googleapis.com/auth/gmail.compose", |
| // "https://www.googleapis.com/auth/gmail.metadata", |
| // "https://www.googleapis.com/auth/gmail.modify", |
| // "https://www.googleapis.com/auth/gmail.readonly" |
| // ] |
| // } |
| |
| } |
| |
| // method id "gmail.users.stop": |
| |
| type UsersStopCall struct { |
| s *Service |
| userId string |
| urlParams_ gensupport.URLParams |
| ctx_ context.Context |
| header_ http.Header |
| } |
| |
| // Stop: Stop receiving push notifications for the given user mailbox. |
| func (r *UsersService) Stop(userId string) *UsersStopCall { |
| c := &UsersStopCall{s: r.s, urlParams_: make(gensupport.URLParams)} |
| c.userId = userId |
| return c |
| } |
| |
| // Fields allows partial responses to be retrieved. See |
| // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse |
| // for more information. |
| func (c *UsersStopCall) Fields(s ...googleapi.Field) *UsersStopCall { |
| c.urlParams_.Set("fields", googleapi.CombineFields(s)) |
| return c |
| } |
| |
| // Context sets the context to be used in this call's Do method. Any |
| // pending HTTP request will be aborted if the provided context is |
| // canceled. |
| func (c *UsersStopCall) Context(ctx context.Context) *UsersStopCall { |
| c.ctx_ = ctx |
| return c |
| } |
| |
| // Header returns an http.Header that can be modified by the caller to |
| // add HTTP headers to the request. |
| func (c *UsersStopCall) Header() http.Header { |
| if c.header_ == nil { |
| c.header_ = make(http.Header) |
| } |
| return c.header_ |
| } |
| |
| func (c *UsersStopCall) doRequest(alt string) (*http.Response, error) { |
| reqHeaders := make(http.Header) |
| reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20191204") |
| for k, v := range c.header_ { |
| reqHeaders[k] = v |
| } |
| reqHeaders.Set("User-Agent", c.s.userAgent()) |
| var body io.Reader = nil |
| c.urlParams_.Set("alt", alt) |
| c.urlParams_.Set("prettyPrint", "false") |
| urls := googleapi.ResolveRelative(c.s.BasePath, "{userId}/stop") |
| urls += "?" + c.urlParams_.Encode() |
| req, err := http.NewRequest("POST", urls, body) |
| if err != nil { |
| return nil, err |
| } |
| req.Header = reqHeaders |
| googleapi.Expand(req.URL, map[string]string{ |
| "userId": c.userId, |
| }) |
| return gensupport.SendRequest(c.ctx_, c.s.client, req) |
| } |
| |
| // Do executes the "gmail.users.stop" call. |
| func (c *UsersStopCall) Do(opts ...googleapi.CallOption) error { |
| gensupport.SetOptions(c.urlParams_, opts...) |
| res, err := c.doRequest("json") |
| if err != nil { |
| return err |
| } |
| defer googleapi.CloseBody(res) |
| if err := googleapi.CheckResponse(res); err != nil { |
| return err |
| } |
| return nil |
| // { |
| // "description": "Stop receiving push notifications for the given user mailbox.", |
| // "httpMethod": "POST", |
| // "id": "gmail.users.stop", |
| // "parameterOrder": [ |
| // "userId" |
| // ], |
| // "parameters": { |
| // "userId": { |
| // "default": "me", |
| // "description": "The user's email address. The special value me can be used to indicate the authenticated user.", |
| // "location": "path", |
| // "required": true, |
| // "type": "string" |
| // } |
| // }, |
| // "path": "{userId}/stop", |
| // "scopes": [ |
| // "https://mail.google.com/", |
| // "https://www.googleapis.com/auth/gmail.metadata", |
| // "https://www.googleapis.com/auth/gmail.modify", |
| // "https://www.googleapis.com/auth/gmail.readonly" |
| // ] |
| // } |
| |
| } |
| |
| // method id "gmail.users.watch": |
| |
| type UsersWatchCall struct { |
| s *Service |
| userId string |
| watchrequest *WatchRequest |
| urlParams_ gensupport.URLParams |
| ctx_ context.Context |
| header_ http.Header |
| } |
| |
| // Watch: Set up or update a push notification watch on the given user |
| // mailbox. |
| func (r *UsersService) Watch(userId string, watchrequest *WatchRequest) *UsersWatchCall { |
| c := &UsersWatchCall{s: r.s, urlParams_: make(gensupport.URLParams)} |
| c.userId = userId |
| c.watchrequest = watchrequest |
| return c |
| } |
| |
| // Fields allows partial responses to be retrieved. See |
| // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse |
| // for more information. |
| func (c *UsersWatchCall) Fields(s ...googleapi.Field) *UsersWatchCall { |
| c.urlParams_.Set("fields", googleapi.CombineFields(s)) |
| return c |
| } |
| |
| // Context sets the context to be used in this call's Do method. Any |
| // pending HTTP request will be aborted if the provided context is |
| // canceled. |
| func (c *UsersWatchCall) Context(ctx context.Context) *UsersWatchCall { |
| c.ctx_ = ctx |
| return c |
| } |
| |
| // Header returns an http.Header that can be modified by the caller to |
| // add HTTP headers to the request. |
| func (c *UsersWatchCall) Header() http.Header { |
| if c.header_ == nil { |
| c.header_ = make(http.Header) |
| } |
| return c.header_ |
| } |
| |
| func (c *UsersWatchCall) doRequest(alt string) (*http.Response, error) { |
| reqHeaders := make(http.Header) |
| reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20191204") |
| for k, v := range c.header_ { |
| reqHeaders[k] = v |
| } |
| reqHeaders.Set("User-Agent", c.s.userAgent()) |
| var body io.Reader = nil |
| body, err := googleapi.WithoutDataWrapper.JSONReader(c.watchrequest) |
| if err != nil { |
| return nil, err |
| } |
| reqHeaders.Set("Content-Type", "application/json") |
| c.urlParams_.Set("alt", alt) |
| c.urlParams_.Set("prettyPrint", "false") |
| urls := googleapi.ResolveRelative(c.s.BasePath, "{userId}/watch") |
| urls += "?" + c.urlParams_.Encode() |
| req, err := http.NewRequest("POST", urls, body) |
| if err != nil { |
| return nil, err |
| } |
| req.Header = reqHeaders |
| googleapi.Expand(req.URL, map[string]string{ |
| "userId": c.userId, |
| }) |
| return gensupport.SendRequest(c.ctx_, c.s.client, req) |
| } |
| |
| // Do executes the "gmail.users.watch" call. |
| // Exactly one of *WatchResponse or error will be non-nil. Any non-2xx |
| // status code is an error. Response headers are in either |
| // *WatchResponse.ServerResponse.Header or (if a response was returned |
| // at all) in error.(*googleapi.Error).Header. Use |
| // googleapi.IsNotModified to check whether the returned error was |
| // because http.StatusNotModified was returned. |
| func (c *UsersWatchCall) Do(opts ...googleapi.CallOption) (*WatchResponse, error) { |
| gensupport.SetOptions(c.urlParams_, opts...) |
| res, err := c.doRequest("json") |
| if res != nil && res.StatusCode == http.StatusNotModified { |
| if res.Body != nil { |
| res.Body.Close() |
| } |
| return nil, &googleapi.Error{ |
| Code: res.StatusCode, |
| Header: res.Header, |
| } |
| } |
| if err != nil { |
| return nil, err |
| } |
| defer googleapi.CloseBody(res) |
| if err := googleapi.CheckResponse(res); err != nil { |
| return nil, err |
| } |
| ret := &WatchResponse{ |
| ServerResponse: googleapi.ServerResponse{ |
| Header: res.Header, |
| HTTPStatusCode: res.StatusCode, |
| }, |
| } |
| target := &ret |
| if err := gensupport.DecodeResponse(target, res); err != nil { |
| return nil, err |
| } |
| return ret, nil |
| // { |
| // "description": "Set up or update a push notification watch on the given user mailbox.", |
| // "httpMethod": "POST", |
| // "id": "gmail.users.watch", |
| // "parameterOrder": [ |
| // "userId" |
| // ], |
| // "parameters": { |
| // "userId": { |
| // "default": "me", |
| // "description": "The user's email address. The special value me can be used to indicate the authenticated user.", |
| // "location": "path", |
| // "required": true, |
| // "type": "string" |
| // } |
| // }, |
| // "path": "{userId}/watch", |
| // "request": { |
| // "$ref": "WatchRequest" |
| // }, |
| // "response": { |
| // "$ref": "WatchResponse" |
| // }, |
| // "scopes": [ |
| // "https://mail.google.com/", |
| // "https://www.googleapis.com/auth/gmail.metadata", |
| // "https://www.googleapis.com/auth/gmail.modify", |
| // "https://www.googleapis.com/auth/gmail.readonly" |
| // ] |
| // } |
| |
| } |
| |
| // method id "gmail.users.drafts.create": |
| |
| type UsersDraftsCreateCall struct { |
| s *Service |
| userId string |
| draft *Draft |
| urlParams_ gensupport.URLParams |
| mediaInfo_ *gensupport.MediaInfo |
| ctx_ context.Context |
| header_ http.Header |
| } |
| |
| // Create: Creates a new draft with the DRAFT label. |
| func (r *UsersDraftsService) Create(userId string, draft *Draft) *UsersDraftsCreateCall { |
| c := &UsersDraftsCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)} |
| c.userId = userId |
| c.draft = draft |
| return c |
| } |
| |
| // Media specifies the media to upload in one or more chunks. The chunk |
| // size may be controlled by supplying a MediaOption generated by |
| // googleapi.ChunkSize. The chunk size defaults to |
| // googleapi.DefaultUploadChunkSize.The Content-Type header used in the |
| // upload request will be determined by sniffing the contents of r, |
| // unless a MediaOption generated by googleapi.ContentType is |
| // supplied. |
| // At most one of Media and ResumableMedia may be set. |
| func (c *UsersDraftsCreateCall) Media(r io.Reader, options ...googleapi.MediaOption) *UsersDraftsCreateCall { |
| c.mediaInfo_ = gensupport.NewInfoFromMedia(r, options) |
| return c |
| } |
| |
| // ResumableMedia specifies the media to upload in chunks and can be |
| // canceled with ctx. |
| // |
| // Deprecated: use Media instead. |
| // |
| // At most one of Media and ResumableMedia may be set. mediaType |
| // identifies the MIME media type of the upload, such as "image/png". If |
| // mediaType is "", it will be auto-detected. The provided ctx will |
| // supersede any context previously provided to the Context method. |
| func (c *UsersDraftsCreateCall) ResumableMedia(ctx context.Context, r io.ReaderAt, size int64, mediaType string) *UsersDraftsCreateCall { |
| c.ctx_ = ctx |
| c.mediaInfo_ = gensupport.NewInfoFromResumableMedia(r, size, mediaType) |
| return c |
| } |
| |
| // ProgressUpdater provides a callback function that will be called |
| // after every chunk. It should be a low-latency function in order to |
| // not slow down the upload operation. This should only be called when |
| // using ResumableMedia (as opposed to Media). |
| func (c *UsersDraftsCreateCall) ProgressUpdater(pu googleapi.ProgressUpdater) *UsersDraftsCreateCall { |
| c.mediaInfo_.SetProgressUpdater(pu) |
| return c |
| } |
| |
| // Fields allows partial responses to be retrieved. See |
| // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse |
| // for more information. |
| func (c *UsersDraftsCreateCall) Fields(s ...googleapi.Field) *UsersDraftsCreateCall { |
| c.urlParams_.Set("fields", googleapi.CombineFields(s)) |
| return c |
| } |
| |
| // Context sets the context to be used in this call's Do method. Any |
| // pending HTTP request will be aborted if the provided context is |
| // canceled. |
| // This context will supersede any context previously provided to the |
| // ResumableMedia method. |
| func (c *UsersDraftsCreateCall) Context(ctx context.Context) *UsersDraftsCreateCall { |
| c.ctx_ = ctx |
| return c |
| } |
| |
| // Header returns an http.Header that can be modified by the caller to |
| // add HTTP headers to the request. |
| func (c *UsersDraftsCreateCall) Header() http.Header { |
| if c.header_ == nil { |
| c.header_ = make(http.Header) |
| } |
| return c.header_ |
| } |
| |
| func (c *UsersDraftsCreateCall) doRequest(alt string) (*http.Response, error) { |
| reqHeaders := make(http.Header) |
| reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20191204") |
| for k, v := range c.header_ { |
| reqHeaders[k] = v |
| } |
| reqHeaders.Set("User-Agent", c.s.userAgent()) |
| var body io.Reader = nil |
| body, err := googleapi.WithoutDataWrapper.JSONReader(c.draft) |
| if err != nil { |
| return nil, err |
| } |
| reqHeaders.Set("Content-Type", "application/json") |
| c.urlParams_.Set("alt", alt) |
| c.urlParams_.Set("prettyPrint", "false") |
| urls := googleapi.ResolveRelative(c.s.BasePath, "{userId}/drafts") |
| if c.mediaInfo_ != nil { |
| urls = googleapi.ResolveRelative(c.s.BasePath, "/upload/gmail/v1/users/{userId}/drafts") |
| c.urlParams_.Set("uploadType", c.mediaInfo_.UploadType()) |
| } |
| if body == nil { |
| body = new(bytes.Buffer) |
| reqHeaders.Set("Content-Type", "application/json") |
| } |
| body, getBody, cleanup := c.mediaInfo_.UploadRequest(reqHeaders, body) |
| defer cleanup() |
| urls += "?" + c.urlParams_.Encode() |
| req, err := http.NewRequest("POST", urls, body) |
| if err != nil { |
| return nil, err |
| } |
| req.Header = reqHeaders |
| req.GetBody = getBody |
| googleapi.Expand(req.URL, map[string]string{ |
| "userId": c.userId, |
| }) |
| return gensupport.SendRequest(c.ctx_, c.s.client, req) |
| } |
| |
| // Do executes the "gmail.users.drafts.create" call. |
| // Exactly one of *Draft or error will be non-nil. Any non-2xx status |
| // code is an error. Response headers are in either |
| // *Draft.ServerResponse.Header or (if a response was returned at all) |
| // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to |
| // check whether the returned error was because http.StatusNotModified |
| // was returned. |
| func (c *UsersDraftsCreateCall) Do(opts ...googleapi.CallOption) (*Draft, error) { |
| gensupport.SetOptions(c.urlParams_, opts...) |
| res, err := c.doRequest("json") |
| if res != nil && res.StatusCode == http.StatusNotModified { |
| if res.Body != nil { |
| res.Body.Close() |
| } |
| return nil, &googleapi.Error{ |
| Code: res.StatusCode, |
| Header: res.Header, |
| } |
| } |
| if err != nil { |
| return nil, err |
| } |
| defer googleapi.CloseBody(res) |
| if err := googleapi.CheckResponse(res); err != nil { |
| return nil, err |
| } |
| rx := c.mediaInfo_.ResumableUpload(res.Header.Get("Location")) |
| if rx != nil { |
| rx.Client = c.s.client |
| rx.UserAgent = c.s.userAgent() |
| ctx := c.ctx_ |
| if ctx == nil { |
| ctx = context.TODO() |
| } |
| res, err = rx.Upload(ctx) |
| if err != nil { |
| return nil, err |
| } |
| defer res.Body.Close() |
| if err := googleapi.CheckResponse(res); err != nil { |
| return nil, err |
| } |
| } |
| ret := &Draft{ |
| ServerResponse: googleapi.ServerResponse{ |
| Header: res.Header, |
| HTTPStatusCode: res.StatusCode, |
| }, |
| } |
| target := &ret |
| if err := gensupport.DecodeResponse(target, res); err != nil { |
| return nil, err |
| } |
| return ret, nil |
| // { |
| // "description": "Creates a new draft with the DRAFT label.", |
| // "httpMethod": "POST", |
| // "id": "gmail.users.drafts.create", |
| // "mediaUpload": { |
| // "accept": [ |
| // "message/rfc822" |
| // ], |
| // "maxSize": "35MB", |
| // "protocols": { |
| // "resumable": { |
| // "multipart": true, |
| // "path": "/resumable/upload/gmail/v1/users/{userId}/drafts" |
| // }, |
| // "simple": { |
| // "multipart": true, |
| // "path": "/upload/gmail/v1/users/{userId}/drafts" |
| // } |
| // } |
| // }, |
| // "parameterOrder": [ |
| // "userId" |
| // ], |
| // "parameters": { |
| // "userId": { |
| // "default": "me", |
| // "description": "The user's email address. The special value me can be used to indicate the authenticated user.", |
| // "location": "path", |
| // "required": true, |
| // "type": "string" |
| // } |
| // }, |
| // "path": "{userId}/drafts", |
| // "request": { |
| // "$ref": "Draft" |
| // }, |
| // "response": { |
| // "$ref": "Draft" |
| // }, |
| // "scopes": [ |
| // "https://mail.google.com/", |
| // "https://www.googleapis.com/auth/gmail.compose", |
| // "https://www.googleapis.com/auth/gmail.modify" |
| // ], |
| // "supportsMediaUpload": true |
| // } |
| |
| } |
| |
| // method id "gmail.users.drafts.delete": |
| |
| type UsersDraftsDeleteCall struct { |
| s *Service |
| userId string |
| id string |
| urlParams_ gensupport.URLParams |
| ctx_ context.Context |
| header_ http.Header |
| } |
| |
| // Delete: Immediately and permanently deletes the specified draft. Does |
| // not simply trash it. |
| func (r *UsersDraftsService) Delete(userId string, id string) *UsersDraftsDeleteCall { |
| c := &UsersDraftsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)} |
| c.userId = userId |
| c.id = id |
| return c |
| } |
| |
| // Fields allows partial responses to be retrieved. See |
| // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse |
| // for more information. |
| func (c *UsersDraftsDeleteCall) Fields(s ...googleapi.Field) *UsersDraftsDeleteCall { |
| c.urlParams_.Set("fields", googleapi.CombineFields(s)) |
| return c |
| } |
| |
| // Context sets the context to be used in this call's Do method. Any |
| // pending HTTP request will be aborted if the provided context is |
| // canceled. |
| func (c *UsersDraftsDeleteCall) Context(ctx context.Context) *UsersDraftsDeleteCall { |
| c.ctx_ = ctx |
| return c |
| } |
| |
| // Header returns an http.Header that can be modified by the caller to |
| // add HTTP headers to the request. |
| func (c *UsersDraftsDeleteCall) Header() http.Header { |
| if c.header_ == nil { |
| c.header_ = make(http.Header) |
| } |
| return c.header_ |
| } |
| |
| func (c *UsersDraftsDeleteCall) doRequest(alt string) (*http.Response, error) { |
| reqHeaders := make(http.Header) |
| reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20191204") |
| for k, v := range c.header_ { |
| reqHeaders[k] = v |
| } |
| reqHeaders.Set("User-Agent", c.s.userAgent()) |
| var body io.Reader = nil |
| c.urlParams_.Set("alt", alt) |
| c.urlParams_.Set("prettyPrint", "false") |
| urls := googleapi.ResolveRelative(c.s.BasePath, "{userId}/drafts/{id}") |
| urls += "?" + c.urlParams_.Encode() |
| req, err := http.NewRequest("DELETE", urls, body) |
| if err != nil { |
| return nil, err |
| } |
| req.Header = reqHeaders |
| googleapi.Expand(req.URL, map[string]string{ |
| "userId": c.userId, |
| "id": c.id, |
| }) |
| return gensupport.SendRequest(c.ctx_, c.s.client, req) |
| } |
| |
| // Do executes the "gmail.users.drafts.delete" call. |
| func (c *UsersDraftsDeleteCall) Do(opts ...googleapi.CallOption) error { |
| gensupport.SetOptions(c.urlParams_, opts...) |
| res, err := c.doRequest("json") |
| if err != nil { |
| return err |
| } |
| defer googleapi.CloseBody(res) |
| if err := googleapi.CheckResponse(res); err != nil { |
| return err |
| } |
| return nil |
| // { |
| // "description": "Immediately and permanently deletes the specified draft. Does not simply trash it.", |
| // "httpMethod": "DELETE", |
| // "id": "gmail.users.drafts.delete", |
| // "parameterOrder": [ |
| // "userId", |
| // "id" |
| // ], |
| // "parameters": { |
| // "id": { |
| // "description": "The ID of the draft to delete.", |
| // "location": "path", |
| // "required": true, |
| // "type": "string" |
| // }, |
| // "userId": { |
| // "default": "me", |
| // "description": "The user's email address. The special value me can be used to indicate the authenticated user.", |
| // "location": "path", |
| // "required": true, |
| // "type": "string" |
| // } |
| // }, |
| // "path": "{userId}/drafts/{id}", |
| // "scopes": [ |
| // "https://mail.google.com/", |
| // "https://www.googleapis.com/auth/gmail.compose", |
| // "https://www.googleapis.com/auth/gmail.modify" |
| // ] |
| // } |
| |
| } |
| |
| // method id "gmail.users.drafts.get": |
| |
| type UsersDraftsGetCall struct { |
| s *Service |
| userId string |
| id string |
| urlParams_ gensupport.URLParams |
| ifNoneMatch_ string |
| ctx_ context.Context |
| header_ http.Header |
| } |
| |
| // Get: Gets the specified draft. |
| func (r *UsersDraftsService) Get(userId string, id string) *UsersDraftsGetCall { |
| c := &UsersDraftsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)} |
| c.userId = userId |
| c.id = id |
| return c |
| } |
| |
| // Format sets the optional parameter "format": The format to return the |
| // draft in. |
| // |
| // Possible values: |
| // "full" (default) |
| // "metadata" |
| // "minimal" |
| // "raw" |
| func (c *UsersDraftsGetCall) Format(format string) *UsersDraftsGetCall { |
| c.urlParams_.Set("format", format) |
| return c |
| } |
| |
| // Fields allows partial responses to be retrieved. See |
| // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse |
| // for more information. |
| func (c *UsersDraftsGetCall) Fields(s ...googleapi.Field) *UsersDraftsGetCall { |
| c.urlParams_.Set("fields", googleapi.CombineFields(s)) |
| return c |
| } |
| |
| // IfNoneMatch sets the optional parameter which makes the operation |
| // fail if the object's ETag matches the given value. This is useful for |
| // getting updates only after the object has changed since the last |
| // request. Use googleapi.IsNotModified to check whether the response |
| // error from Do is the result of In-None-Match. |
| func (c *UsersDraftsGetCall) IfNoneMatch(entityTag string) *UsersDraftsGetCall { |
| c.ifNoneMatch_ = entityTag |
| return c |
| } |
| |
| // Context sets the context to be used in this call's Do method. Any |
| // pending HTTP request will be aborted if the provided context is |
| // canceled. |
| func (c *UsersDraftsGetCall) Context(ctx context.Context) *UsersDraftsGetCall { |
| c.ctx_ = ctx |
| return c |
| } |
| |
| // Header returns an http.Header that can be modified by the caller to |
| // add HTTP headers to the request. |
| func (c *UsersDraftsGetCall) Header() http.Header { |
| if c.header_ == nil { |
| c.header_ = make(http.Header) |
| } |
| return c.header_ |
| } |
| |
| func (c *UsersDraftsGetCall) doRequest(alt string) (*http.Response, error) { |
| reqHeaders := make(http.Header) |
| reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20191204") |
| for k, v := range c.header_ { |
| reqHeaders[k] = v |
| } |
| reqHeaders.Set("User-Agent", c.s.userAgent()) |
| if c.ifNoneMatch_ != "" { |
| reqHeaders.Set("If-None-Match", c.ifNoneMatch_) |
| } |
| var body io.Reader = nil |
| c.urlParams_.Set("alt", alt) |
| c.urlParams_.Set("prettyPrint", "false") |
| urls := googleapi.ResolveRelative(c.s.BasePath, "{userId}/drafts/{id}") |
| urls += "?" + c.urlParams_.Encode() |
| req, err := http.NewRequest("GET", urls, body) |
| if err != nil { |
| return nil, err |
| } |
| req.Header = reqHeaders |
| googleapi.Expand(req.URL, map[string]string{ |
| "userId": c.userId, |
| "id": c.id, |
| }) |
| return gensupport.SendRequest(c.ctx_, c.s.client, req) |
| } |
| |
| // Do executes the "gmail.users.drafts.get" call. |
| // Exactly one of *Draft or error will be non-nil. Any non-2xx status |
| // code is an error. Response headers are in either |
| // *Draft.ServerResponse.Header or (if a response was returned at all) |
| // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to |
| // check whether the returned error was because http.StatusNotModified |
| // was returned. |
| func (c *UsersDraftsGetCall) Do(opts ...googleapi.CallOption) (*Draft, error) { |
| gensupport.SetOptions(c.urlParams_, opts...) |
| res, err := c.doRequest("json") |
| if res != nil && res.StatusCode == http.StatusNotModified { |
| if res.Body != nil { |
| res.Body.Close() |
| } |
| return nil, &googleapi.Error{ |
| Code: res.StatusCode, |
| Header: res.Header, |
| } |
| } |
| if err != nil { |
| return nil, err |
| } |
| defer googleapi.CloseBody(res) |
| if err := googleapi.CheckResponse(res); err != nil { |
| return nil, err |
| } |
| ret := &Draft{ |
| ServerResponse: googleapi.ServerResponse{ |
| Header: res.Header, |
| HTTPStatusCode: res.StatusCode, |
| }, |
| } |
| target := &ret |
| if err := gensupport.DecodeResponse(target, res); err != nil { |
| return nil, err |
| } |
| return ret, nil |
| // { |
| // "description": "Gets the specified draft.", |
| // "httpMethod": "GET", |
| // "id": "gmail.users.drafts.get", |
| // "parameterOrder": [ |
| // "userId", |
| // "id" |
| // ], |
| // "parameters": { |
| // "format": { |
| // "default": "full", |
| // "description": "The format to return the draft in.", |
| // "enum": [ |
| // "full", |
| // "metadata", |
| // "minimal", |
| // "raw" |
| // ], |
| // "enumDescriptions": [ |
| // "", |
| // "", |
| // "", |
| // "" |
| // ], |
| // "location": "query", |
| // "type": "string" |
| // }, |
| // "id": { |
| // "description": "The ID of the draft to retrieve.", |
| // "location": "path", |
| // "required": true, |
| // "type": "string" |
| // }, |
| // "userId": { |
| // "default": "me", |
| // "description": "The user's email address. The special value me can be used to indicate the authenticated user.", |
| // "location": "path", |
| // "required": true, |
| // "type": "string" |
| // } |
| // }, |
| // "path": "{userId}/drafts/{id}", |
| // "response": { |
| // "$ref": "Draft" |
| // }, |
| // "scopes": [ |
| // "https://mail.google.com/", |
| // "https://www.googleapis.com/auth/gmail.compose", |
| // "https://www.googleapis.com/auth/gmail.modify", |
| // "https://www.googleapis.com/auth/gmail.readonly" |
| // ] |
| // } |
| |
| } |
| |
| // method id "gmail.users.drafts.list": |
| |
| type UsersDraftsListCall struct { |
| s *Service |
| userId string |
| urlParams_ gensupport.URLParams |
| ifNoneMatch_ string |
| ctx_ context.Context |
| header_ http.Header |
| } |
| |
| // List: Lists the drafts in the user's mailbox. |
| func (r *UsersDraftsService) List(userId string) *UsersDraftsListCall { |
| c := &UsersDraftsListCall{s: r.s, urlParams_: make(gensupport.URLParams)} |
| c.userId = userId |
| return c |
| } |
| |
| // IncludeSpamTrash sets the optional parameter "includeSpamTrash": |
| // Include drafts from SPAM and TRASH in the results. |
| func (c *UsersDraftsListCall) IncludeSpamTrash(includeSpamTrash bool) *UsersDraftsListCall { |
| c.urlParams_.Set("includeSpamTrash", fmt.Sprint(includeSpamTrash)) |
| return c |
| } |
| |
| // MaxResults sets the optional parameter "maxResults": Maximum number |
| // of drafts to return. |
| func (c *UsersDraftsListCall) MaxResults(maxResults int64) *UsersDraftsListCall { |
| c.urlParams_.Set("maxResults", fmt.Sprint(maxResults)) |
| return c |
| } |
| |
| // PageToken sets the optional parameter "pageToken": Page token to |
| // retrieve a specific page of results in the list. |
| func (c *UsersDraftsListCall) PageToken(pageToken string) *UsersDraftsListCall { |
| c.urlParams_.Set("pageToken", pageToken) |
| return c |
| } |
| |
| // Q sets the optional parameter "q": 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". |
| func (c *UsersDraftsListCall) Q(q string) *UsersDraftsListCall { |
| c.urlParams_.Set("q", q) |
| return c |
| } |
| |
| // Fields allows partial responses to be retrieved. See |
| // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse |
| // for more information. |
| func (c *UsersDraftsListCall) Fields(s ...googleapi.Field) *UsersDraftsListCall { |
| c.urlParams_.Set("fields", googleapi.CombineFields(s)) |
| return c |
| } |
| |
| // IfNoneMatch sets the optional parameter which makes the operation |
| // fail if the object's ETag matches the given value. This is useful for |
| // getting updates only after the object has changed since the last |
| // request. Use googleapi.IsNotModified to check whether the response |
| // error from Do is the result of In-None-Match. |
| func (c *UsersDraftsListCall) IfNoneMatch(entityTag string) *UsersDraftsListCall { |
| c.ifNoneMatch_ = entityTag |
| return c |
| } |
| |
| // Context sets the context to be used in this call's Do method. Any |
| // pending HTTP request will be aborted if the provided context is |
| // canceled. |
| func (c *UsersDraftsListCall) Context(ctx context.Context) *UsersDraftsListCall { |
| c.ctx_ = ctx |
| return c |
| } |
| |
| // Header returns an http.Header that can be modified by the caller to |
| // add HTTP headers to the request. |
| func (c *UsersDraftsListCall) Header() http.Header { |
| if c.header_ == nil { |
| c.header_ = make(http.Header) |
| } |
| return c.header_ |
| } |
| |
| func (c *UsersDraftsListCall) doRequest(alt string) (*http.Response, error) { |
| reqHeaders := make(http.Header) |
| reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20191204") |
| for k, v := range c.header_ { |
| reqHeaders[k] = v |
| } |
| reqHeaders.Set("User-Agent", c.s.userAgent()) |
| if c.ifNoneMatch_ != "" { |
| reqHeaders.Set("If-None-Match", c.ifNoneMatch_) |
| } |
| var body io.Reader = nil |
| c.urlParams_.Set("alt", alt) |
| c.urlParams_.Set("prettyPrint", "false") |
| urls := googleapi.ResolveRelative(c.s.BasePath, "{userId}/drafts") |
| urls += "?" + c.urlParams_.Encode() |
| req, err := http.NewRequest("GET", urls, body) |
| if err != nil { |
| return nil, err |
| } |
| req.Header = reqHeaders |
| googleapi.Expand(req.URL, map[string]string{ |
| "userId": c.userId, |
| }) |
| return gensupport.SendRequest(c.ctx_, c.s.client, req) |
| } |
| |
| // Do executes the "gmail.users.drafts.list" call. |
| // Exactly one of *ListDraftsResponse or error will be non-nil. Any |
| // non-2xx status code is an error. Response headers are in either |
| // *ListDraftsResponse.ServerResponse.Header or (if a response was |
| // returned at all) in error.(*googleapi.Error).Header. Use |
| // googleapi.IsNotModified to check whether the returned error was |
| // because http.StatusNotModified was returned. |
| func (c *UsersDraftsListCall) Do(opts ...googleapi.CallOption) (*ListDraftsResponse, error) { |
| gensupport.SetOptions(c.urlParams_, opts...) |
| res, err := c.doRequest("json") |
| if res != nil && res.StatusCode == http.StatusNotModified { |
| if res.Body != nil { |
| res.Body.Close() |
| } |
| return nil, &googleapi.Error{ |
| Code: res.StatusCode, |
| Header: res.Header, |
| } |
| } |
| if err != nil { |
| return nil, err |
| } |
| defer googleapi.CloseBody(res) |
| if err := googleapi.CheckResponse(res); err != nil { |
| return nil, err |
| } |
| ret := &ListDraftsResponse{ |
| ServerResponse: googleapi.ServerResponse{ |
| Header: res.Header, |
| HTTPStatusCode: res.StatusCode, |
| }, |
| } |
| target := &ret |
| if err := gensupport.DecodeResponse(target, res); err != nil { |
| return nil, err |
| } |
| return ret, nil |
| // { |
| // "description": "Lists the drafts in the user's mailbox.", |
| // "httpMethod": "GET", |
| // "id": "gmail.users.drafts.list", |
| // "parameterOrder": [ |
| // "userId" |
| // ], |
| // "parameters": { |
| // "includeSpamTrash": { |
| // "default": "false", |
| // "description": "Include drafts from SPAM and TRASH in the results.", |
| // "location": "query", |
| // "type": "boolean" |
| // }, |
| // "maxResults": { |
| // "default": "100", |
| // "description": "Maximum number of drafts to return.", |
| // "format": "uint32", |
| // "location": "query", |
| // "type": "integer" |
| // }, |
| // "pageToken": { |
| // "description": "Page token to retrieve a specific page of results in the list.", |
| // "location": "query", |
| // "type": "string" |
| // }, |
| // "q": { |
| // "description": "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\".", |
| // "location": "query", |
| // "type": "string" |
| // }, |
| // "userId": { |
| // "default": "me", |
| // "description": "The user's email address. The special value me can be used to indicate the authenticated user.", |
| // "location": "path", |
| // "required": true, |
| // "type": "string" |
| // } |
| // }, |
| // "path": "{userId}/drafts", |
| // "response": { |
| // "$ref": "ListDraftsResponse" |
| // }, |
| // "scopes": [ |
| // "https://mail.google.com/", |
| // "https://www.googleapis.com/auth/gmail.compose", |
| // "https://www.googleapis.com/auth/gmail.modify", |
| // "https://www.googleapis.com/auth/gmail.readonly" |
| // ] |
| // } |
| |
| } |
| |
| // Pages invokes f for each page of results. |
| // A non-nil error returned from f will halt the iteration. |
| // The provided context supersedes any context provided to the Context method. |
| func (c *UsersDraftsListCall) Pages(ctx context.Context, f func(*ListDraftsResponse) error) error { |
| c.ctx_ = ctx |
| defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point |
| for { |
| x, err := c.Do() |
| if err != nil { |
| return err |
| } |
| if err := f(x); err != nil { |
| return err |
| } |
| if x.NextPageToken == "" { |
| return nil |
| } |
| c.PageToken(x.NextPageToken) |
| } |
| } |
| |
| // method id "gmail.users.drafts.send": |
| |
| type UsersDraftsSendCall struct { |
| s *Service |
| userId string |
| draft *Draft |
| urlParams_ gensupport.URLParams |
| mediaInfo_ *gensupport.MediaInfo |
| ctx_ context.Context |
| header_ http.Header |
| } |
| |
| // Send: Sends the specified, existing draft to the recipients in the |
| // To, Cc, and Bcc headers. |
| func (r *UsersDraftsService) Send(userId string, draft *Draft) *UsersDraftsSendCall { |
| c := &UsersDraftsSendCall{s: r.s, urlParams_: make(gensupport.URLParams)} |
| c.userId = userId |
| c.draft = draft |
| return c |
| } |
| |
| // Media specifies the media to upload in one or more chunks. The chunk |
| // size may be controlled by supplying a MediaOption generated by |
| // googleapi.ChunkSize. The chunk size defaults to |
| // googleapi.DefaultUploadChunkSize.The Content-Type header used in the |
| // upload request will be determined by sniffing the contents of r, |
| // unless a MediaOption generated by googleapi.ContentType is |
| // supplied. |
| // At most one of Media and ResumableMedia may be set. |
| func (c *UsersDraftsSendCall) Media(r io.Reader, options ...googleapi.MediaOption) *UsersDraftsSendCall { |
| c.mediaInfo_ = gensupport.NewInfoFromMedia(r, options) |
| return c |
| } |
| |
| // ResumableMedia specifies the media to upload in chunks and can be |
| // canceled with ctx. |
| // |
| // Deprecated: use Media instead. |
| // |
| // At most one of Media and ResumableMedia may be set. mediaType |
| // identifies the MIME media type of the upload, such as "image/png". If |
| // mediaType is "", it will be auto-detected. The provided ctx will |
| // supersede any context previously provided to the Context method. |
| func (c *UsersDraftsSendCall) ResumableMedia(ctx context.Context, r io.ReaderAt, size int64, mediaType string) *UsersDraftsSendCall { |
| c.ctx_ = ctx |
| c.mediaInfo_ = gensupport.NewInfoFromResumableMedia(r, size, mediaType) |
| return c |
| } |
| |
| // ProgressUpdater provides a callback function that will be called |
| // after every chunk. It should be a low-latency function in order to |
| // not slow down the upload operation. This should only be called when |
| // using ResumableMedia (as opposed to Media). |
| func (c *UsersDraftsSendCall) ProgressUpdater(pu googleapi.ProgressUpdater) *UsersDraftsSendCall { |
| c.mediaInfo_.SetProgressUpdater(pu) |
| return c |
| } |
| |
| // Fields allows partial responses to be retrieved. See |
| // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse |
| // for more information. |
| func (c *UsersDraftsSendCall) Fields(s ...googleapi.Field) *UsersDraftsSendCall { |
| c.urlParams_.Set("fields", googleapi.CombineFields(s)) |
| return c |
| } |
| |
| // Context sets the context to be used in this call's Do method. Any |
| // pending HTTP request will be aborted if the provided context is |
| // canceled. |
| // This context will supersede any context previously provided to the |
| // ResumableMedia method. |
| func (c *UsersDraftsSendCall) Context(ctx context.Context) *UsersDraftsSendCall { |
| c.ctx_ = ctx |
| return c |
| } |
| |
| // Header returns an http.Header that can be modified by the caller to |
| // add HTTP headers to the request. |
| func (c *UsersDraftsSendCall) Header() http.Header { |
| if c.header_ == nil { |
| c.header_ = make(http.Header) |
| } |
| return c.header_ |
| } |
| |
| func (c *UsersDraftsSendCall) doRequest(alt string) (*http.Response, error) { |
| reqHeaders := make(http.Header) |
| reqHeaders.Set("x-goog-api-client", "gl-go/1.11.0 gdcl/20191204") |
| for k, v := range c.header_ { |
| reqHeaders[k] = v |
| } |
| reqHeaders.Set("User-Agent", c.s.userAgent()) |
| var body io.Reader = nil |
| body, err := googleapi.WithoutDataWrapper.JSONReader(c.draft) |
| if err != nil { |
| return nil, err |
| } |
| reqHeaders.Set("Content-Type", "application/json") |
| c.urlParams_.Set("alt", alt) |
| c.urlParams_.Set("prettyPrint", "false") |
| urls := googleapi.ResolveRelative(c.s.BasePath, "{userId}/drafts/send") |
| if c.mediaInfo_ != nil { |
| urls = googleapi.ResolveRelative(c.s.BasePath, "/upload/gmail/v1/users/{userId}/drafts/send") |
| c.urlParams_.Set("uploadType", c.mediaInfo_.UploadType()) |
| } |
| if body == nil { |
| body = new(bytes.Buffer) |
| reqHeaders.Set("Content-Type", "application/json") |
| } |
| body, getBody, cleanup := c.mediaInfo_.UploadRequest(reqHeaders, body) |
| defer cleanup() |
| urls += "?" + c.urlParams_.Encode() |
| req, err := http.NewRequest("POST", urls, body) |
| if err != nil { |
| return nil, err |
| } |
| req.Header = reqHeaders |
| req.GetBody = getBody |
| googleapi.Expand(req.URL, map[string]string{ |
| "userId": c.userId, |
| }) |
| return gensupport.SendRequest(c.ctx_, c.s.client, req) |
| } |
| |
| // Do executes the "gmail.users.drafts.send" call. |
| // Exactly one of *Message or error will be non-nil. Any non-2xx status |
| // code is an error. Response headers are in either |
| // *Message.ServerResponse.Header or (if a response was returned at all) |
| // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to |
| // check whether the returned error was because http.StatusNotModified |
| // was returned. |
| func (c *UsersDraftsSendCall) Do(opts ...googleapi.CallOption) (*Message, error) { |
| gensupport.SetOptions(c.urlParams_, opts...) |
| res, err := c.doRequest("json") |
| if res != nil && res.StatusCode == http.StatusNotModified { |
| if res.Body != nil { |
| res.Body.Close() |
| } |
| return nil, &googleapi.Error{ |
| Code: res.StatusCode, |
| Header: res.Header, |
| } |
| } |
| if err != nil { |
| return nil, err |
| } |
| defer googleapi.CloseBody(res) |
| if err := googleapi.CheckResponse(res); err != nil { |
| return nil, err |
| } |
| rx := c.mediaInfo_.ResumableUpload(res.Header.Get("Location")) |
| if rx != nil { |
| rx.Client = c.s.client |
| rx.UserAgent = c.s.userAgent() |
| ctx := c.ctx_ |
| if ctx == nil { |
| ctx = context.TODO() |
| } |
| res, err = rx.Upload(ctx) |
| if err != nil { |
| return nil, err |
| } |
| defer res.Body.Close() |
| if err := googleapi.CheckResponse(res); err != nil { |
| return nil, err |
| } |
| } |
| ret := &Message{ |
| ServerResponse: googleapi.ServerResponse{ |
| Header: res.Header, |
| HTTPStatusCode: res.StatusCode, |
| }, |
| } |
| target := &ret |
| if err := gensupport.DecodeResponse(target, res); err != nil { |
| return nil, err |
| } |
| return ret, nil |
| // { |
| // "description": "Sends the specified, existing draft to the recipients in the To, Cc, and Bcc headers.", |
| // "httpMethod": "POST", |
| // "id": "gmail.users.drafts.send", |
| // "mediaUpload": { |
| // "accept": [ |
| // "message/rfc822" |
| // ], |
| // "maxSize": "35MB", |
| // "protocols": { |
| // "resumable": { |
| // "multipart": true, |
| // "path": "/resumable/upload/gmail/v1/users/{userId}/drafts/send" |
| // }, |
| // "simple": { |
| // "multipart": true, |
| // "path": "/upload/gmail/v1/users/{userId}/drafts/send" |
| // } |
| // } |
| // }, |
| // "parameterOrder": [ |
| // "userId" |
| // ], |
| // "parameters": { |
| // "userId": { |
| // "default": "me", |
| // "description": "The user's email address. The special value me can be used to indicate the authenticated user.", |
| // "location": "path", |
| // "required": true, |
| // "type": "string" |
| // } |
| // }, |
| // "path": "{userId}/drafts/send", |
| // "request": { |
| // "$ref": "Draft" |
| // }, |
| // "response": { |
| // "$ref": "Message" |
| // }, |
| // "scopes": [ |
| // "https://mail.google.com/", |
| // "https://www.googleapis.com/auth/gmail.compose", |
| // "https://www.googleapis.com/auth/gmail.modify" |
| // ], |
| // "supportsMediaUpload": true |
| // } |
| |
| } |
| |
| // method id "gmail.users.drafts.update": |
| |
| type UsersDraftsUpdateCall struct { |
| s *Service |
| userId string |
| id string |
| draft *Draft |
| urlParams_ gensupport.URLParams |
| mediaInfo_ *gensupport.MediaInfo |
| ctx_ context.Context |
| header_ http.Header |
| } |
| |
| // Update: Replaces a draft's content. |
| func (r *UsersDraftsService) Update(userId string, id string, draft *Draft) *UsersDraftsUpdateCall { |
| c := &UsersDraftsUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)} |
| c.userId = userId |
| c.id = id |
| c.draft = draft |
| return c |
| } |
| |
| // Media specifies the media to upload in one or more chunks. The chunk |
| // size may be controlled by supplying a MediaOption generated by |
| // googleapi.ChunkSize. The chunk size defaults to |
| // googleapi.DefaultUploadChunkSize.The Content-Type header used in the |
| // upload request will be determined by sniffing the contents of r, |
| // unless a MediaOption generated by googleapi.ContentType is |
| // supplied. |
| // At most one of Media and ResumableMedia may be set. |
| func (c *UsersDraftsUpdateCall) Media(r io.Reader, options ...googleapi.MediaOption) *UsersDraftsUpdateCall { |
| c.mediaInfo_ = gensupport.NewInfoFromMedia(r, options) |
| return c |
| } |
| |
| // ResumableMedia specifies the media to upload in chunks and can be |
| // canceled with ctx. |
| // |
| // Deprecated: use Media instead. |
| // |
| // At most one of Media and ResumableMedia may be set. mediaType |
| // identifies the MIME media type of the upload, such as "image/png". If |
| // mediaType is "", it will be auto-detected. The provided ctx will |
| // supersede any context previously provided to the Context method. |
| func (c *UsersDraftsUpdateCall) ResumableMedia(ctx context.Context, r io.ReaderAt, size int64, mediaType string) *UsersDraftsUpdateCall { |
| c.ctx_ = ctx |
| c.mediaInfo_ = gensupport.NewInfoFromResumableMedia(r, size, mediaType) |
| return c |
| } |
| |
| // ProgressUpdater provides a callback function that will be called |
| // after every chunk. It should be a low-latency function in order to |
| // not slow down the upload operation. This should only be called when |
| // using ResumableMedia (as opposed to Media). |
| func (c *UsersDraftsUpdateCall) ProgressUpdater(pu googleapi.ProgressUpdater) *UsersDraftsUpdateCall { |
|