...

Source file src/google.golang.org/api/gmail/v1/gmail-gen.go

Documentation: google.golang.org/api/gmail/v1

     1  // Copyright 2024 Google LLC.
     2  // Use of this source code is governed by a BSD-style
     3  // license that can be found in the LICENSE file.
     4  
     5  // Code generated file. DO NOT EDIT.
     6  
     7  // Package gmail provides access to the Gmail API.
     8  //
     9  // For product documentation, see: https://developers.google.com/gmail/api/
    10  //
    11  // # Library status
    12  //
    13  // These client libraries are officially supported by Google. However, this
    14  // library is considered complete and is in maintenance mode. This means
    15  // that we will address critical bugs and security issues but will not add
    16  // any new features.
    17  //
    18  // When possible, we recommend using our newer
    19  // [Cloud Client Libraries for Go](https://pkg.go.dev/cloud.google.com/go)
    20  // that are still actively being worked and iterated on.
    21  //
    22  // # Creating a client
    23  //
    24  // Usage example:
    25  //
    26  //	import "google.golang.org/api/gmail/v1"
    27  //	...
    28  //	ctx := context.Background()
    29  //	gmailService, err := gmail.NewService(ctx)
    30  //
    31  // In this example, Google Application Default Credentials are used for
    32  // authentication. For information on how to create and obtain Application
    33  // Default Credentials, see https://developers.google.com/identity/protocols/application-default-credentials.
    34  //
    35  // # Other authentication options
    36  //
    37  // By default, all available scopes (see "Constants") are used to authenticate.
    38  // To restrict scopes, use [google.golang.org/api/option.WithScopes]:
    39  //
    40  //	gmailService, err := gmail.NewService(ctx, option.WithScopes(gmail.GmailSettingsSharingScope))
    41  //
    42  // To use an API key for authentication (note: some APIs do not support API
    43  // keys), use [google.golang.org/api/option.WithAPIKey]:
    44  //
    45  //	gmailService, err := gmail.NewService(ctx, option.WithAPIKey("AIza..."))
    46  //
    47  // To use an OAuth token (e.g., a user token obtained via a three-legged OAuth
    48  // flow, use [google.golang.org/api/option.WithTokenSource]:
    49  //
    50  //	config := &oauth2.Config{...}
    51  //	// ...
    52  //	token, err := config.Exchange(ctx, ...)
    53  //	gmailService, err := gmail.NewService(ctx, option.WithTokenSource(config.TokenSource(ctx, token)))
    54  //
    55  // See [google.golang.org/api/option.ClientOption] for details on options.
    56  package gmail // import "google.golang.org/api/gmail/v1"
    57  
    58  import (
    59  	"bytes"
    60  	"context"
    61  	"encoding/json"
    62  	"errors"
    63  	"fmt"
    64  	"io"
    65  	"net/http"
    66  	"net/url"
    67  	"strconv"
    68  	"strings"
    69  
    70  	googleapi "google.golang.org/api/googleapi"
    71  	internal "google.golang.org/api/internal"
    72  	gensupport "google.golang.org/api/internal/gensupport"
    73  	option "google.golang.org/api/option"
    74  	internaloption "google.golang.org/api/option/internaloption"
    75  	htransport "google.golang.org/api/transport/http"
    76  )
    77  
    78  // Always reference these packages, just in case the auto-generated code
    79  // below doesn't.
    80  var _ = bytes.NewBuffer
    81  var _ = strconv.Itoa
    82  var _ = fmt.Sprintf
    83  var _ = json.NewDecoder
    84  var _ = io.Copy
    85  var _ = url.Parse
    86  var _ = gensupport.MarshalJSON
    87  var _ = googleapi.Version
    88  var _ = errors.New
    89  var _ = strings.Replace
    90  var _ = context.Canceled
    91  var _ = internaloption.WithDefaultEndpoint
    92  var _ = internal.Version
    93  
    94  const apiId = "gmail:v1"
    95  const apiName = "gmail"
    96  const apiVersion = "v1"
    97  const basePath = "https://gmail.googleapis.com/"
    98  const basePathTemplate = "https://gmail.UNIVERSE_DOMAIN/"
    99  const mtlsBasePath = "https://gmail.mtls.googleapis.com/"
   100  
   101  // OAuth2 scopes used by this API.
   102  const (
   103  	// Read, compose, send, and permanently delete all your email from Gmail
   104  	MailGoogleComScope = "https://mail.google.com/"
   105  
   106  	// Manage drafts and send emails when you interact with the add-on
   107  	GmailAddonsCurrentActionComposeScope = "https://www.googleapis.com/auth/gmail.addons.current.action.compose"
   108  
   109  	// View your email messages when you interact with the add-on
   110  	GmailAddonsCurrentMessageActionScope = "https://www.googleapis.com/auth/gmail.addons.current.message.action"
   111  
   112  	// View your email message metadata when the add-on is running
   113  	GmailAddonsCurrentMessageMetadataScope = "https://www.googleapis.com/auth/gmail.addons.current.message.metadata"
   114  
   115  	// View your email messages when the add-on is running
   116  	GmailAddonsCurrentMessageReadonlyScope = "https://www.googleapis.com/auth/gmail.addons.current.message.readonly"
   117  
   118  	// Manage drafts and send emails
   119  	GmailComposeScope = "https://www.googleapis.com/auth/gmail.compose"
   120  
   121  	// Add emails into your Gmail mailbox
   122  	GmailInsertScope = "https://www.googleapis.com/auth/gmail.insert"
   123  
   124  	// See and edit your email labels
   125  	GmailLabelsScope = "https://www.googleapis.com/auth/gmail.labels"
   126  
   127  	// View your email message metadata such as labels and headers, but not the
   128  	// email body
   129  	GmailMetadataScope = "https://www.googleapis.com/auth/gmail.metadata"
   130  
   131  	// Read, compose, and send emails from your Gmail account
   132  	GmailModifyScope = "https://www.googleapis.com/auth/gmail.modify"
   133  
   134  	// View your email messages and settings
   135  	GmailReadonlyScope = "https://www.googleapis.com/auth/gmail.readonly"
   136  
   137  	// Send email on your behalf
   138  	GmailSendScope = "https://www.googleapis.com/auth/gmail.send"
   139  
   140  	// See, edit, create, or change your email settings and filters in Gmail
   141  	GmailSettingsBasicScope = "https://www.googleapis.com/auth/gmail.settings.basic"
   142  
   143  	// Manage your sensitive mail settings, including who can manage your mail
   144  	GmailSettingsSharingScope = "https://www.googleapis.com/auth/gmail.settings.sharing"
   145  )
   146  
   147  // NewService creates a new Service.
   148  func NewService(ctx context.Context, opts ...option.ClientOption) (*Service, error) {
   149  	scopesOption := internaloption.WithDefaultScopes(
   150  		"https://mail.google.com/",
   151  		"https://www.googleapis.com/auth/gmail.addons.current.action.compose",
   152  		"https://www.googleapis.com/auth/gmail.addons.current.message.action",
   153  		"https://www.googleapis.com/auth/gmail.addons.current.message.metadata",
   154  		"https://www.googleapis.com/auth/gmail.addons.current.message.readonly",
   155  		"https://www.googleapis.com/auth/gmail.compose",
   156  		"https://www.googleapis.com/auth/gmail.insert",
   157  		"https://www.googleapis.com/auth/gmail.labels",
   158  		"https://www.googleapis.com/auth/gmail.metadata",
   159  		"https://www.googleapis.com/auth/gmail.modify",
   160  		"https://www.googleapis.com/auth/gmail.readonly",
   161  		"https://www.googleapis.com/auth/gmail.send",
   162  		"https://www.googleapis.com/auth/gmail.settings.basic",
   163  		"https://www.googleapis.com/auth/gmail.settings.sharing",
   164  	)
   165  	// NOTE: prepend, so we don't override user-specified scopes.
   166  	opts = append([]option.ClientOption{scopesOption}, opts...)
   167  	opts = append(opts, internaloption.WithDefaultEndpoint(basePath))
   168  	opts = append(opts, internaloption.WithDefaultEndpointTemplate(basePathTemplate))
   169  	opts = append(opts, internaloption.WithDefaultMTLSEndpoint(mtlsBasePath))
   170  	opts = append(opts, internaloption.EnableNewAuthLibrary())
   171  	client, endpoint, err := htransport.NewClient(ctx, opts...)
   172  	if err != nil {
   173  		return nil, err
   174  	}
   175  	s, err := New(client)
   176  	if err != nil {
   177  		return nil, err
   178  	}
   179  	if endpoint != "" {
   180  		s.BasePath = endpoint
   181  	}
   182  	return s, nil
   183  }
   184  
   185  // New creates a new Service. It uses the provided http.Client for requests.
   186  //
   187  // Deprecated: please use NewService instead.
   188  // To provide a custom HTTP client, use option.WithHTTPClient.
   189  // If you are using google.golang.org/api/googleapis/transport.APIKey, use option.WithAPIKey with NewService instead.
   190  func New(client *http.Client) (*Service, error) {
   191  	if client == nil {
   192  		return nil, errors.New("client is nil")
   193  	}
   194  	s := &Service{client: client, BasePath: basePath}
   195  	s.Users = NewUsersService(s)
   196  	return s, nil
   197  }
   198  
   199  type Service struct {
   200  	client    *http.Client
   201  	BasePath  string // API endpoint base URL
   202  	UserAgent string // optional additional User-Agent fragment
   203  
   204  	Users *UsersService
   205  }
   206  
   207  func (s *Service) userAgent() string {
   208  	if s.UserAgent == "" {
   209  		return googleapi.UserAgent
   210  	}
   211  	return googleapi.UserAgent + " " + s.UserAgent
   212  }
   213  
   214  func NewUsersService(s *Service) *UsersService {
   215  	rs := &UsersService{s: s}
   216  	rs.Drafts = NewUsersDraftsService(s)
   217  	rs.History = NewUsersHistoryService(s)
   218  	rs.Labels = NewUsersLabelsService(s)
   219  	rs.Messages = NewUsersMessagesService(s)
   220  	rs.Settings = NewUsersSettingsService(s)
   221  	rs.Threads = NewUsersThreadsService(s)
   222  	return rs
   223  }
   224  
   225  type UsersService struct {
   226  	s *Service
   227  
   228  	Drafts *UsersDraftsService
   229  
   230  	History *UsersHistoryService
   231  
   232  	Labels *UsersLabelsService
   233  
   234  	Messages *UsersMessagesService
   235  
   236  	Settings *UsersSettingsService
   237  
   238  	Threads *UsersThreadsService
   239  }
   240  
   241  func NewUsersDraftsService(s *Service) *UsersDraftsService {
   242  	rs := &UsersDraftsService{s: s}
   243  	return rs
   244  }
   245  
   246  type UsersDraftsService struct {
   247  	s *Service
   248  }
   249  
   250  func NewUsersHistoryService(s *Service) *UsersHistoryService {
   251  	rs := &UsersHistoryService{s: s}
   252  	return rs
   253  }
   254  
   255  type UsersHistoryService struct {
   256  	s *Service
   257  }
   258  
   259  func NewUsersLabelsService(s *Service) *UsersLabelsService {
   260  	rs := &UsersLabelsService{s: s}
   261  	return rs
   262  }
   263  
   264  type UsersLabelsService struct {
   265  	s *Service
   266  }
   267  
   268  func NewUsersMessagesService(s *Service) *UsersMessagesService {
   269  	rs := &UsersMessagesService{s: s}
   270  	rs.Attachments = NewUsersMessagesAttachmentsService(s)
   271  	return rs
   272  }
   273  
   274  type UsersMessagesService struct {
   275  	s *Service
   276  
   277  	Attachments *UsersMessagesAttachmentsService
   278  }
   279  
   280  func NewUsersMessagesAttachmentsService(s *Service) *UsersMessagesAttachmentsService {
   281  	rs := &UsersMessagesAttachmentsService{s: s}
   282  	return rs
   283  }
   284  
   285  type UsersMessagesAttachmentsService struct {
   286  	s *Service
   287  }
   288  
   289  func NewUsersSettingsService(s *Service) *UsersSettingsService {
   290  	rs := &UsersSettingsService{s: s}
   291  	rs.Cse = NewUsersSettingsCseService(s)
   292  	rs.Delegates = NewUsersSettingsDelegatesService(s)
   293  	rs.Filters = NewUsersSettingsFiltersService(s)
   294  	rs.ForwardingAddresses = NewUsersSettingsForwardingAddressesService(s)
   295  	rs.SendAs = NewUsersSettingsSendAsService(s)
   296  	return rs
   297  }
   298  
   299  type UsersSettingsService struct {
   300  	s *Service
   301  
   302  	Cse *UsersSettingsCseService
   303  
   304  	Delegates *UsersSettingsDelegatesService
   305  
   306  	Filters *UsersSettingsFiltersService
   307  
   308  	ForwardingAddresses *UsersSettingsForwardingAddressesService
   309  
   310  	SendAs *UsersSettingsSendAsService
   311  }
   312  
   313  func NewUsersSettingsCseService(s *Service) *UsersSettingsCseService {
   314  	rs := &UsersSettingsCseService{s: s}
   315  	rs.Identities = NewUsersSettingsCseIdentitiesService(s)
   316  	rs.Keypairs = NewUsersSettingsCseKeypairsService(s)
   317  	return rs
   318  }
   319  
   320  type UsersSettingsCseService struct {
   321  	s *Service
   322  
   323  	Identities *UsersSettingsCseIdentitiesService
   324  
   325  	Keypairs *UsersSettingsCseKeypairsService
   326  }
   327  
   328  func NewUsersSettingsCseIdentitiesService(s *Service) *UsersSettingsCseIdentitiesService {
   329  	rs := &UsersSettingsCseIdentitiesService{s: s}
   330  	return rs
   331  }
   332  
   333  type UsersSettingsCseIdentitiesService struct {
   334  	s *Service
   335  }
   336  
   337  func NewUsersSettingsCseKeypairsService(s *Service) *UsersSettingsCseKeypairsService {
   338  	rs := &UsersSettingsCseKeypairsService{s: s}
   339  	return rs
   340  }
   341  
   342  type UsersSettingsCseKeypairsService struct {
   343  	s *Service
   344  }
   345  
   346  func NewUsersSettingsDelegatesService(s *Service) *UsersSettingsDelegatesService {
   347  	rs := &UsersSettingsDelegatesService{s: s}
   348  	return rs
   349  }
   350  
   351  type UsersSettingsDelegatesService struct {
   352  	s *Service
   353  }
   354  
   355  func NewUsersSettingsFiltersService(s *Service) *UsersSettingsFiltersService {
   356  	rs := &UsersSettingsFiltersService{s: s}
   357  	return rs
   358  }
   359  
   360  type UsersSettingsFiltersService struct {
   361  	s *Service
   362  }
   363  
   364  func NewUsersSettingsForwardingAddressesService(s *Service) *UsersSettingsForwardingAddressesService {
   365  	rs := &UsersSettingsForwardingAddressesService{s: s}
   366  	return rs
   367  }
   368  
   369  type UsersSettingsForwardingAddressesService struct {
   370  	s *Service
   371  }
   372  
   373  func NewUsersSettingsSendAsService(s *Service) *UsersSettingsSendAsService {
   374  	rs := &UsersSettingsSendAsService{s: s}
   375  	rs.SmimeInfo = NewUsersSettingsSendAsSmimeInfoService(s)
   376  	return rs
   377  }
   378  
   379  type UsersSettingsSendAsService struct {
   380  	s *Service
   381  
   382  	SmimeInfo *UsersSettingsSendAsSmimeInfoService
   383  }
   384  
   385  func NewUsersSettingsSendAsSmimeInfoService(s *Service) *UsersSettingsSendAsSmimeInfoService {
   386  	rs := &UsersSettingsSendAsSmimeInfoService{s: s}
   387  	return rs
   388  }
   389  
   390  type UsersSettingsSendAsSmimeInfoService struct {
   391  	s *Service
   392  }
   393  
   394  func NewUsersThreadsService(s *Service) *UsersThreadsService {
   395  	rs := &UsersThreadsService{s: s}
   396  	return rs
   397  }
   398  
   399  type UsersThreadsService struct {
   400  	s *Service
   401  }
   402  
   403  // AutoForwarding: Auto-forwarding settings for an account.
   404  type AutoForwarding struct {
   405  	// Disposition: The state that a message should be left in after it has been
   406  	// forwarded.
   407  	//
   408  	// Possible values:
   409  	//   "dispositionUnspecified" - Unspecified disposition.
   410  	//   "leaveInInbox" - Leave the message in the `INBOX`.
   411  	//   "archive" - Archive the message.
   412  	//   "trash" - Move the message to the `TRASH`.
   413  	//   "markRead" - Leave the message in the `INBOX` and mark it as read.
   414  	Disposition string `json:"disposition,omitempty"`
   415  	// EmailAddress: Email address to which all incoming messages are forwarded.
   416  	// This email address must be a verified member of the forwarding addresses.
   417  	EmailAddress string `json:"emailAddress,omitempty"`
   418  	// Enabled: Whether all incoming mail is automatically forwarded to another
   419  	// address.
   420  	Enabled bool `json:"enabled,omitempty"`
   421  
   422  	// ServerResponse contains the HTTP response code and headers from the server.
   423  	googleapi.ServerResponse `json:"-"`
   424  	// ForceSendFields is a list of field names (e.g. "Disposition") to
   425  	// unconditionally include in API requests. By default, fields with empty or
   426  	// default values are omitted from API requests. See
   427  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   428  	// details.
   429  	ForceSendFields []string `json:"-"`
   430  	// NullFields is a list of field names (e.g. "Disposition") to include in API
   431  	// requests with the JSON null value. By default, fields with empty values are
   432  	// omitted from API requests. See
   433  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   434  	NullFields []string `json:"-"`
   435  }
   436  
   437  func (s *AutoForwarding) MarshalJSON() ([]byte, error) {
   438  	type NoMethod AutoForwarding
   439  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   440  }
   441  
   442  type BatchDeleteMessagesRequest struct {
   443  	// Ids: The IDs of the messages to delete.
   444  	Ids []string `json:"ids,omitempty"`
   445  	// ForceSendFields is a list of field names (e.g. "Ids") to unconditionally
   446  	// include in API requests. By default, fields with empty or default values are
   447  	// omitted from API requests. See
   448  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   449  	// details.
   450  	ForceSendFields []string `json:"-"`
   451  	// NullFields is a list of field names (e.g. "Ids") to include in API requests
   452  	// with the JSON null value. By default, fields with empty values are omitted
   453  	// from API requests. See
   454  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   455  	NullFields []string `json:"-"`
   456  }
   457  
   458  func (s *BatchDeleteMessagesRequest) MarshalJSON() ([]byte, error) {
   459  	type NoMethod BatchDeleteMessagesRequest
   460  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   461  }
   462  
   463  type BatchModifyMessagesRequest struct {
   464  	// AddLabelIds: A list of label IDs to add to messages.
   465  	AddLabelIds []string `json:"addLabelIds,omitempty"`
   466  	// Ids: The IDs of the messages to modify. There is a limit of 1000 ids per
   467  	// request.
   468  	Ids []string `json:"ids,omitempty"`
   469  	// RemoveLabelIds: A list of label IDs to remove from messages.
   470  	RemoveLabelIds []string `json:"removeLabelIds,omitempty"`
   471  	// ForceSendFields is a list of field names (e.g. "AddLabelIds") to
   472  	// unconditionally include in API requests. By default, fields with empty or
   473  	// default values are omitted from API requests. See
   474  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   475  	// details.
   476  	ForceSendFields []string `json:"-"`
   477  	// NullFields is a list of field names (e.g. "AddLabelIds") to include in API
   478  	// requests with the JSON null value. By default, fields with empty values are
   479  	// omitted from API requests. See
   480  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   481  	NullFields []string `json:"-"`
   482  }
   483  
   484  func (s *BatchModifyMessagesRequest) MarshalJSON() ([]byte, error) {
   485  	type NoMethod BatchModifyMessagesRequest
   486  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   487  }
   488  
   489  // CseIdentity: The client-side encryption (CSE) configuration for the email
   490  // address of an authenticated user. Gmail uses CSE configurations to save
   491  // drafts of client-side encrypted email messages, and to sign and send
   492  // encrypted email messages.
   493  type CseIdentity struct {
   494  	// EmailAddress: The email address for the sending identity. The email address
   495  	// must be the primary email address of the authenticated user.
   496  	EmailAddress string `json:"emailAddress,omitempty"`
   497  	// PrimaryKeyPairId: If a key pair is associated, the ID of the key pair,
   498  	// CseKeyPair.
   499  	PrimaryKeyPairId string `json:"primaryKeyPairId,omitempty"`
   500  	// SignAndEncryptKeyPairs: The configuration of a CSE identity that uses
   501  	// different key pairs for signing and encryption.
   502  	SignAndEncryptKeyPairs *SignAndEncryptKeyPairs `json:"signAndEncryptKeyPairs,omitempty"`
   503  
   504  	// ServerResponse contains the HTTP response code and headers from the server.
   505  	googleapi.ServerResponse `json:"-"`
   506  	// ForceSendFields is a list of field names (e.g. "EmailAddress") to
   507  	// unconditionally include in API requests. By default, fields with empty or
   508  	// default values are omitted from API requests. See
   509  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   510  	// details.
   511  	ForceSendFields []string `json:"-"`
   512  	// NullFields is a list of field names (e.g. "EmailAddress") to include in API
   513  	// requests with the JSON null value. By default, fields with empty values are
   514  	// omitted from API requests. See
   515  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   516  	NullFields []string `json:"-"`
   517  }
   518  
   519  func (s *CseIdentity) MarshalJSON() ([]byte, error) {
   520  	type NoMethod CseIdentity
   521  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   522  }
   523  
   524  // CseKeyPair: A client-side encryption S/MIME key pair, which is comprised of
   525  // a public key, its certificate chain, and metadata for its paired private
   526  // key. Gmail uses the key pair to complete the following tasks: - Sign
   527  // outgoing client-side encrypted messages. - Save and reopen drafts of
   528  // client-side encrypted messages. - Save and reopen sent messages. - Decrypt
   529  // incoming or archived S/MIME messages.
   530  type CseKeyPair struct {
   531  	// DisableTime: Output only. If a key pair is set to `DISABLED`, the time that
   532  	// the key pair's state changed from `ENABLED` to `DISABLED`. This field is
   533  	// present only when the key pair is in state `DISABLED`.
   534  	DisableTime string `json:"disableTime,omitempty"`
   535  	// EnablementState: Output only. The current state of the key pair.
   536  	//
   537  	// Possible values:
   538  	//   "stateUnspecified" - The current state of the key pair is not set. The key
   539  	// pair is neither turned on nor turned off.
   540  	//   "enabled" - The key pair is turned on. For any email messages that this
   541  	// key pair encrypts, Gmail decrypts the messages and signs any outgoing mail
   542  	// with the private key. To turn on a key pair, use the EnableCseKeyPair
   543  	// method.
   544  	//   "disabled" - The key pair is turned off. Authenticated users cannot
   545  	// decrypt email messages nor sign outgoing messages. If a key pair is turned
   546  	// off for more than 30 days, you can permanently delete it. To turn off a key
   547  	// pair, use the DisableCseKeyPair method.
   548  	EnablementState string `json:"enablementState,omitempty"`
   549  	// KeyPairId: Output only. The immutable ID for the client-side encryption
   550  	// S/MIME key pair.
   551  	KeyPairId string `json:"keyPairId,omitempty"`
   552  	// Pem: Output only. The public key and its certificate chain, in PEM
   553  	// (https://en.wikipedia.org/wiki/Privacy-Enhanced_Mail) format.
   554  	Pem string `json:"pem,omitempty"`
   555  	// Pkcs7: Input only. The public key and its certificate chain. The chain must
   556  	// be in PKCS#7 (https://en.wikipedia.org/wiki/PKCS_7) format and use PEM
   557  	// encoding and ASCII armor.
   558  	Pkcs7 string `json:"pkcs7,omitempty"`
   559  	// PrivateKeyMetadata: Metadata for instances of this key pair's private key.
   560  	PrivateKeyMetadata []*CsePrivateKeyMetadata `json:"privateKeyMetadata,omitempty"`
   561  	// SubjectEmailAddresses: Output only. The email address identities that are
   562  	// specified on the leaf certificate.
   563  	SubjectEmailAddresses []string `json:"subjectEmailAddresses,omitempty"`
   564  
   565  	// ServerResponse contains the HTTP response code and headers from the server.
   566  	googleapi.ServerResponse `json:"-"`
   567  	// ForceSendFields is a list of field names (e.g. "DisableTime") to
   568  	// unconditionally include in API requests. By default, fields with empty or
   569  	// default values are omitted from API requests. See
   570  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   571  	// details.
   572  	ForceSendFields []string `json:"-"`
   573  	// NullFields is a list of field names (e.g. "DisableTime") to include in API
   574  	// requests with the JSON null value. By default, fields with empty values are
   575  	// omitted from API requests. See
   576  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   577  	NullFields []string `json:"-"`
   578  }
   579  
   580  func (s *CseKeyPair) MarshalJSON() ([]byte, error) {
   581  	type NoMethod CseKeyPair
   582  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   583  }
   584  
   585  // CsePrivateKeyMetadata: Metadata for a private key instance.
   586  type CsePrivateKeyMetadata struct {
   587  	// HardwareKeyMetadata: Metadata for hardware keys.
   588  	HardwareKeyMetadata *HardwareKeyMetadata `json:"hardwareKeyMetadata,omitempty"`
   589  	// KaclsKeyMetadata: Metadata for a private key instance managed by an external
   590  	// key access control list service.
   591  	KaclsKeyMetadata *KaclsKeyMetadata `json:"kaclsKeyMetadata,omitempty"`
   592  	// PrivateKeyMetadataId: Output only. The immutable ID for the private key
   593  	// metadata instance.
   594  	PrivateKeyMetadataId string `json:"privateKeyMetadataId,omitempty"`
   595  	// ForceSendFields is a list of field names (e.g. "HardwareKeyMetadata") to
   596  	// unconditionally include in API requests. By default, fields with empty or
   597  	// default values are omitted from API requests. See
   598  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   599  	// details.
   600  	ForceSendFields []string `json:"-"`
   601  	// NullFields is a list of field names (e.g. "HardwareKeyMetadata") to include
   602  	// in API requests with the JSON null value. By default, fields with empty
   603  	// values are omitted from API requests. See
   604  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   605  	NullFields []string `json:"-"`
   606  }
   607  
   608  func (s *CsePrivateKeyMetadata) MarshalJSON() ([]byte, error) {
   609  	type NoMethod CsePrivateKeyMetadata
   610  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   611  }
   612  
   613  // Delegate: Settings for a delegate. Delegates can read, send, and delete
   614  // messages, as well as view and add contacts, for the delegator's account. See
   615  // "Set up mail delegation" for more information about delegates.
   616  type Delegate struct {
   617  	// DelegateEmail: The email address of the delegate.
   618  	DelegateEmail string `json:"delegateEmail,omitempty"`
   619  	// VerificationStatus: Indicates whether this address has been verified and can
   620  	// act as a delegate for the account. Read-only.
   621  	//
   622  	// Possible values:
   623  	//   "verificationStatusUnspecified" - Unspecified verification status.
   624  	//   "accepted" - The address can act a delegate for the account.
   625  	//   "pending" - A verification request was mailed to the address, and the
   626  	// owner has not yet accepted it.
   627  	//   "rejected" - A verification request was mailed to the address, and the
   628  	// owner rejected it.
   629  	//   "expired" - A verification request was mailed to the address, and it
   630  	// expired without verification.
   631  	VerificationStatus string `json:"verificationStatus,omitempty"`
   632  
   633  	// ServerResponse contains the HTTP response code and headers from the server.
   634  	googleapi.ServerResponse `json:"-"`
   635  	// ForceSendFields is a list of field names (e.g. "DelegateEmail") to
   636  	// unconditionally include in API requests. By default, fields with empty or
   637  	// default values are omitted from API requests. See
   638  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   639  	// details.
   640  	ForceSendFields []string `json:"-"`
   641  	// NullFields is a list of field names (e.g. "DelegateEmail") to include in API
   642  	// requests with the JSON null value. By default, fields with empty values are
   643  	// omitted from API requests. See
   644  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   645  	NullFields []string `json:"-"`
   646  }
   647  
   648  func (s *Delegate) MarshalJSON() ([]byte, error) {
   649  	type NoMethod Delegate
   650  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   651  }
   652  
   653  // DisableCseKeyPairRequest: Requests to turn off a client-side encryption key
   654  // pair.
   655  type DisableCseKeyPairRequest struct {
   656  }
   657  
   658  // Draft: A draft email in the user's mailbox.
   659  type Draft struct {
   660  	// Id: The immutable ID of the draft.
   661  	Id string `json:"id,omitempty"`
   662  	// Message: The message content of the draft.
   663  	Message *Message `json:"message,omitempty"`
   664  
   665  	// ServerResponse contains the HTTP response code and headers from the server.
   666  	googleapi.ServerResponse `json:"-"`
   667  	// ForceSendFields is a list of field names (e.g. "Id") to unconditionally
   668  	// include in API requests. By default, fields with empty or default values are
   669  	// omitted from API requests. See
   670  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   671  	// details.
   672  	ForceSendFields []string `json:"-"`
   673  	// NullFields is a list of field names (e.g. "Id") to include in API requests
   674  	// with the JSON null value. By default, fields with empty values are omitted
   675  	// from API requests. See
   676  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   677  	NullFields []string `json:"-"`
   678  }
   679  
   680  func (s *Draft) MarshalJSON() ([]byte, error) {
   681  	type NoMethod Draft
   682  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   683  }
   684  
   685  // EnableCseKeyPairRequest: Requests to turn on a client-side encryption key
   686  // pair.
   687  type EnableCseKeyPairRequest struct {
   688  }
   689  
   690  // Filter: Resource definition for Gmail filters. Filters apply to specific
   691  // messages instead of an entire email thread.
   692  type Filter struct {
   693  	// Action: Action that the filter performs.
   694  	Action *FilterAction `json:"action,omitempty"`
   695  	// Criteria: Matching criteria for the filter.
   696  	Criteria *FilterCriteria `json:"criteria,omitempty"`
   697  	// Id: The server assigned ID of the filter.
   698  	Id string `json:"id,omitempty"`
   699  
   700  	// ServerResponse contains the HTTP response code and headers from the server.
   701  	googleapi.ServerResponse `json:"-"`
   702  	// ForceSendFields is a list of field names (e.g. "Action") to unconditionally
   703  	// include in API requests. By default, fields with empty or default values are
   704  	// omitted from API requests. See
   705  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   706  	// details.
   707  	ForceSendFields []string `json:"-"`
   708  	// NullFields is a list of field names (e.g. "Action") to include in API
   709  	// requests with the JSON null value. By default, fields with empty values are
   710  	// omitted from API requests. See
   711  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   712  	NullFields []string `json:"-"`
   713  }
   714  
   715  func (s *Filter) MarshalJSON() ([]byte, error) {
   716  	type NoMethod Filter
   717  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   718  }
   719  
   720  // FilterAction: A set of actions to perform on a message.
   721  type FilterAction struct {
   722  	// AddLabelIds: List of labels to add to the message.
   723  	AddLabelIds []string `json:"addLabelIds,omitempty"`
   724  	// Forward: Email address that the message should be forwarded to.
   725  	Forward string `json:"forward,omitempty"`
   726  	// RemoveLabelIds: List of labels to remove from the message.
   727  	RemoveLabelIds []string `json:"removeLabelIds,omitempty"`
   728  	// ForceSendFields is a list of field names (e.g. "AddLabelIds") to
   729  	// unconditionally include in API requests. By default, fields with empty or
   730  	// default values are omitted from API requests. See
   731  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   732  	// details.
   733  	ForceSendFields []string `json:"-"`
   734  	// NullFields is a list of field names (e.g. "AddLabelIds") to include in API
   735  	// requests with the JSON null value. By default, fields with empty values are
   736  	// omitted from API requests. See
   737  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   738  	NullFields []string `json:"-"`
   739  }
   740  
   741  func (s *FilterAction) MarshalJSON() ([]byte, error) {
   742  	type NoMethod FilterAction
   743  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   744  }
   745  
   746  // FilterCriteria: Message matching criteria.
   747  type FilterCriteria struct {
   748  	// ExcludeChats: Whether the response should exclude chats.
   749  	ExcludeChats bool `json:"excludeChats,omitempty"`
   750  	// From: The sender's display name or email address.
   751  	From string `json:"from,omitempty"`
   752  	// HasAttachment: Whether the message has any attachment.
   753  	HasAttachment bool `json:"hasAttachment,omitempty"`
   754  	// NegatedQuery: Only return messages not matching the specified query.
   755  	// Supports the same query format as the Gmail search box. For example,
   756  	// "from:someuser@example.com rfc822msgid: is:unread".
   757  	NegatedQuery string `json:"negatedQuery,omitempty"`
   758  	// Query: Only return messages matching the specified query. Supports the same
   759  	// query format as the Gmail search box. For example,
   760  	// "from:someuser@example.com rfc822msgid: is:unread".
   761  	Query string `json:"query,omitempty"`
   762  	// Size: The size of the entire RFC822 message in bytes, including all headers
   763  	// and attachments.
   764  	Size int64 `json:"size,omitempty"`
   765  	// SizeComparison: How the message size in bytes should be in relation to the
   766  	// size field.
   767  	//
   768  	// Possible values:
   769  	//   "unspecified"
   770  	//   "smaller" - Find messages smaller than the given size.
   771  	//   "larger" - Find messages larger than the given size.
   772  	SizeComparison string `json:"sizeComparison,omitempty"`
   773  	// Subject: Case-insensitive phrase found in the message's subject. Trailing
   774  	// and leading whitespace are be trimmed and adjacent spaces are collapsed.
   775  	Subject string `json:"subject,omitempty"`
   776  	// To: The recipient's display name or email address. Includes recipients in
   777  	// the "to", "cc", and "bcc" header fields. You can use simply the local part
   778  	// of the email address. For example, "example" and "example@" both match
   779  	// "example@gmail.com". This field is case-insensitive.
   780  	To string `json:"to,omitempty"`
   781  	// ForceSendFields is a list of field names (e.g. "ExcludeChats") to
   782  	// unconditionally include in API requests. By default, fields with empty or
   783  	// default values are omitted from API requests. See
   784  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   785  	// details.
   786  	ForceSendFields []string `json:"-"`
   787  	// NullFields is a list of field names (e.g. "ExcludeChats") to include in API
   788  	// requests with the JSON null value. By default, fields with empty values are
   789  	// omitted from API requests. See
   790  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   791  	NullFields []string `json:"-"`
   792  }
   793  
   794  func (s *FilterCriteria) MarshalJSON() ([]byte, error) {
   795  	type NoMethod FilterCriteria
   796  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   797  }
   798  
   799  // ForwardingAddress: Settings for a forwarding address.
   800  type ForwardingAddress struct {
   801  	// ForwardingEmail: An email address to which messages can be forwarded.
   802  	ForwardingEmail string `json:"forwardingEmail,omitempty"`
   803  	// VerificationStatus: Indicates whether this address has been verified and is
   804  	// usable for forwarding. Read-only.
   805  	//
   806  	// Possible values:
   807  	//   "verificationStatusUnspecified" - Unspecified verification status.
   808  	//   "accepted" - The address is ready to use for forwarding.
   809  	//   "pending" - The address is awaiting verification by the owner.
   810  	VerificationStatus string `json:"verificationStatus,omitempty"`
   811  
   812  	// ServerResponse contains the HTTP response code and headers from the server.
   813  	googleapi.ServerResponse `json:"-"`
   814  	// ForceSendFields is a list of field names (e.g. "ForwardingEmail") to
   815  	// unconditionally include in API requests. By default, fields with empty or
   816  	// default values are omitted from API requests. See
   817  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   818  	// details.
   819  	ForceSendFields []string `json:"-"`
   820  	// NullFields is a list of field names (e.g. "ForwardingEmail") to include in
   821  	// API requests with the JSON null value. By default, fields with empty values
   822  	// are omitted from API requests. See
   823  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   824  	NullFields []string `json:"-"`
   825  }
   826  
   827  func (s *ForwardingAddress) MarshalJSON() ([]byte, error) {
   828  	type NoMethod ForwardingAddress
   829  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   830  }
   831  
   832  // HardwareKeyMetadata: Metadata for hardware keys.
   833  type HardwareKeyMetadata struct {
   834  	// Description: Description about the hardware key.
   835  	Description string `json:"description,omitempty"`
   836  	// ForceSendFields is a list of field names (e.g. "Description") to
   837  	// unconditionally include in API requests. By default, fields with empty or
   838  	// default values are omitted from API requests. See
   839  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   840  	// details.
   841  	ForceSendFields []string `json:"-"`
   842  	// NullFields is a list of field names (e.g. "Description") to include in API
   843  	// requests with the JSON null value. By default, fields with empty values are
   844  	// omitted from API requests. See
   845  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   846  	NullFields []string `json:"-"`
   847  }
   848  
   849  func (s *HardwareKeyMetadata) MarshalJSON() ([]byte, error) {
   850  	type NoMethod HardwareKeyMetadata
   851  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   852  }
   853  
   854  // History: A record of a change to the user's mailbox. Each history change may
   855  // affect multiple messages in multiple ways.
   856  type History struct {
   857  	// Id: The mailbox sequence ID.
   858  	Id uint64 `json:"id,omitempty,string"`
   859  	// LabelsAdded: Labels added to messages in this history record.
   860  	LabelsAdded []*HistoryLabelAdded `json:"labelsAdded,omitempty"`
   861  	// LabelsRemoved: Labels removed from messages in this history record.
   862  	LabelsRemoved []*HistoryLabelRemoved `json:"labelsRemoved,omitempty"`
   863  	// Messages: List of messages changed in this history record. The fields for
   864  	// specific change types, such as `messagesAdded` may duplicate messages in
   865  	// this field. We recommend using the specific change-type fields instead of
   866  	// this.
   867  	Messages []*Message `json:"messages,omitempty"`
   868  	// MessagesAdded: Messages added to the mailbox in this history record.
   869  	MessagesAdded []*HistoryMessageAdded `json:"messagesAdded,omitempty"`
   870  	// MessagesDeleted: Messages deleted (not Trashed) from the mailbox in this
   871  	// history record.
   872  	MessagesDeleted []*HistoryMessageDeleted `json:"messagesDeleted,omitempty"`
   873  	// ForceSendFields is a list of field names (e.g. "Id") to unconditionally
   874  	// include in API requests. By default, fields with empty or default values are
   875  	// omitted from API requests. See
   876  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   877  	// details.
   878  	ForceSendFields []string `json:"-"`
   879  	// NullFields is a list of field names (e.g. "Id") to include in API requests
   880  	// with the JSON null value. By default, fields with empty values are omitted
   881  	// from API requests. See
   882  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   883  	NullFields []string `json:"-"`
   884  }
   885  
   886  func (s *History) MarshalJSON() ([]byte, error) {
   887  	type NoMethod History
   888  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   889  }
   890  
   891  type HistoryLabelAdded struct {
   892  	// LabelIds: Label IDs added to the message.
   893  	LabelIds []string `json:"labelIds,omitempty"`
   894  	Message  *Message `json:"message,omitempty"`
   895  	// ForceSendFields is a list of field names (e.g. "LabelIds") to
   896  	// unconditionally include in API requests. By default, fields with empty or
   897  	// default values are omitted from API requests. See
   898  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   899  	// details.
   900  	ForceSendFields []string `json:"-"`
   901  	// NullFields is a list of field names (e.g. "LabelIds") to include in API
   902  	// requests with the JSON null value. By default, fields with empty values are
   903  	// omitted from API requests. See
   904  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   905  	NullFields []string `json:"-"`
   906  }
   907  
   908  func (s *HistoryLabelAdded) MarshalJSON() ([]byte, error) {
   909  	type NoMethod HistoryLabelAdded
   910  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   911  }
   912  
   913  type HistoryLabelRemoved struct {
   914  	// LabelIds: Label IDs removed from the message.
   915  	LabelIds []string `json:"labelIds,omitempty"`
   916  	Message  *Message `json:"message,omitempty"`
   917  	// ForceSendFields is a list of field names (e.g. "LabelIds") to
   918  	// unconditionally include in API requests. By default, fields with empty or
   919  	// default values are omitted from API requests. See
   920  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   921  	// details.
   922  	ForceSendFields []string `json:"-"`
   923  	// NullFields is a list of field names (e.g. "LabelIds") to include in API
   924  	// requests with the JSON null value. By default, fields with empty values are
   925  	// omitted from API requests. See
   926  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   927  	NullFields []string `json:"-"`
   928  }
   929  
   930  func (s *HistoryLabelRemoved) MarshalJSON() ([]byte, error) {
   931  	type NoMethod HistoryLabelRemoved
   932  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   933  }
   934  
   935  type HistoryMessageAdded struct {
   936  	Message *Message `json:"message,omitempty"`
   937  	// ForceSendFields is a list of field names (e.g. "Message") to unconditionally
   938  	// include in API requests. By default, fields with empty or default values are
   939  	// omitted from API requests. See
   940  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   941  	// details.
   942  	ForceSendFields []string `json:"-"`
   943  	// NullFields is a list of field names (e.g. "Message") to include in API
   944  	// requests with the JSON null value. By default, fields with empty values are
   945  	// omitted from API requests. See
   946  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   947  	NullFields []string `json:"-"`
   948  }
   949  
   950  func (s *HistoryMessageAdded) MarshalJSON() ([]byte, error) {
   951  	type NoMethod HistoryMessageAdded
   952  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   953  }
   954  
   955  type HistoryMessageDeleted struct {
   956  	Message *Message `json:"message,omitempty"`
   957  	// ForceSendFields is a list of field names (e.g. "Message") to unconditionally
   958  	// include in API requests. By default, fields with empty or default values are
   959  	// omitted from API requests. See
   960  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
   961  	// details.
   962  	ForceSendFields []string `json:"-"`
   963  	// NullFields is a list of field names (e.g. "Message") to include in API
   964  	// requests with the JSON null value. By default, fields with empty values are
   965  	// omitted from API requests. See
   966  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
   967  	NullFields []string `json:"-"`
   968  }
   969  
   970  func (s *HistoryMessageDeleted) MarshalJSON() ([]byte, error) {
   971  	type NoMethod HistoryMessageDeleted
   972  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
   973  }
   974  
   975  // ImapSettings: IMAP settings for an account.
   976  type ImapSettings struct {
   977  	// AutoExpunge: If this value is true, Gmail will immediately expunge a message
   978  	// when it is marked as deleted in IMAP. Otherwise, Gmail will wait for an
   979  	// update from the client before expunging messages marked as deleted.
   980  	AutoExpunge bool `json:"autoExpunge,omitempty"`
   981  	// Enabled: Whether IMAP is enabled for the account.
   982  	Enabled bool `json:"enabled,omitempty"`
   983  	// ExpungeBehavior: The action that will be executed on a message when it is
   984  	// marked as deleted and expunged from the last visible IMAP folder.
   985  	//
   986  	// Possible values:
   987  	//   "expungeBehaviorUnspecified" - Unspecified behavior.
   988  	//   "archive" - Archive messages marked as deleted.
   989  	//   "trash" - Move messages marked as deleted to the trash.
   990  	//   "deleteForever" - Immediately and permanently delete messages marked as
   991  	// deleted. The expunged messages cannot be recovered.
   992  	ExpungeBehavior string `json:"expungeBehavior,omitempty"`
   993  	// MaxFolderSize: An optional limit on the number of messages that an IMAP
   994  	// folder may contain. Legal values are 0, 1000, 2000, 5000 or 10000. A value
   995  	// of zero is interpreted to mean that there is no limit.
   996  	MaxFolderSize int64 `json:"maxFolderSize,omitempty"`
   997  
   998  	// ServerResponse contains the HTTP response code and headers from the server.
   999  	googleapi.ServerResponse `json:"-"`
  1000  	// ForceSendFields is a list of field names (e.g. "AutoExpunge") to
  1001  	// unconditionally include in API requests. By default, fields with empty or
  1002  	// default values are omitted from API requests. See
  1003  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
  1004  	// details.
  1005  	ForceSendFields []string `json:"-"`
  1006  	// NullFields is a list of field names (e.g. "AutoExpunge") to include in API
  1007  	// requests with the JSON null value. By default, fields with empty values are
  1008  	// omitted from API requests. See
  1009  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
  1010  	NullFields []string `json:"-"`
  1011  }
  1012  
  1013  func (s *ImapSettings) MarshalJSON() ([]byte, error) {
  1014  	type NoMethod ImapSettings
  1015  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
  1016  }
  1017  
  1018  // KaclsKeyMetadata: Metadata for private keys managed by an external key
  1019  // access control list service. For details about managing key access, see
  1020  // Google Workspace CSE API Reference
  1021  // (https://developers.google.com/workspace/cse/reference).
  1022  type KaclsKeyMetadata struct {
  1023  	// KaclsData: Opaque data generated and used by the key access control list
  1024  	// service. Maximum size: 8 KiB.
  1025  	KaclsData string `json:"kaclsData,omitempty"`
  1026  	// KaclsUri: The URI of the key access control list service that manages the
  1027  	// private key.
  1028  	KaclsUri string `json:"kaclsUri,omitempty"`
  1029  	// ForceSendFields is a list of field names (e.g. "KaclsData") to
  1030  	// unconditionally include in API requests. By default, fields with empty or
  1031  	// default values are omitted from API requests. See
  1032  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
  1033  	// details.
  1034  	ForceSendFields []string `json:"-"`
  1035  	// NullFields is a list of field names (e.g. "KaclsData") to include in API
  1036  	// requests with the JSON null value. By default, fields with empty values are
  1037  	// omitted from API requests. See
  1038  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
  1039  	NullFields []string `json:"-"`
  1040  }
  1041  
  1042  func (s *KaclsKeyMetadata) MarshalJSON() ([]byte, error) {
  1043  	type NoMethod KaclsKeyMetadata
  1044  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
  1045  }
  1046  
  1047  // Label: Labels are used to categorize messages and threads within the user's
  1048  // mailbox. The maximum number of labels supported for a user's mailbox is
  1049  // 10,000.
  1050  type Label struct {
  1051  	// Color: The color to assign to the label. Color is only available for labels
  1052  	// that have their `type` set to `user`.
  1053  	Color *LabelColor `json:"color,omitempty"`
  1054  	// Id: The immutable ID of the label.
  1055  	Id string `json:"id,omitempty"`
  1056  	// LabelListVisibility: The visibility of the label in the label list in the
  1057  	// Gmail web interface.
  1058  	//
  1059  	// Possible values:
  1060  	//   "labelShow" - Show the label in the label list.
  1061  	//   "labelShowIfUnread" - Show the label if there are any unread messages with
  1062  	// that label.
  1063  	//   "labelHide" - Do not show the label in the label list.
  1064  	LabelListVisibility string `json:"labelListVisibility,omitempty"`
  1065  	// MessageListVisibility: The visibility of messages with this label in the
  1066  	// message list in the Gmail web interface.
  1067  	//
  1068  	// Possible values:
  1069  	//   "show" - Show the label in the message list.
  1070  	//   "hide" - Do not show the label in the message list.
  1071  	MessageListVisibility string `json:"messageListVisibility,omitempty"`
  1072  	// MessagesTotal: The total number of messages with the label.
  1073  	MessagesTotal int64 `json:"messagesTotal,omitempty"`
  1074  	// MessagesUnread: The number of unread messages with the label.
  1075  	MessagesUnread int64 `json:"messagesUnread,omitempty"`
  1076  	// Name: The display name of the label.
  1077  	Name string `json:"name,omitempty"`
  1078  	// ThreadsTotal: The total number of threads with the label.
  1079  	ThreadsTotal int64 `json:"threadsTotal,omitempty"`
  1080  	// ThreadsUnread: The number of unread threads with the label.
  1081  	ThreadsUnread int64 `json:"threadsUnread,omitempty"`
  1082  	// Type: The owner type for the label. User labels are created by the user and
  1083  	// can be modified and deleted by the user and can be applied to any message or
  1084  	// thread. System labels are internally created and cannot be added, modified,
  1085  	// or deleted. System labels may be able to be applied to or removed from
  1086  	// messages and threads under some circumstances but this is not guaranteed.
  1087  	// For example, users can apply and remove the `INBOX` and `UNREAD` labels from
  1088  	// messages and threads, but cannot apply or remove the `DRAFTS` or `SENT`
  1089  	// labels from messages or threads.
  1090  	//
  1091  	// Possible values:
  1092  	//   "system" - Labels created by Gmail.
  1093  	//   "user" - Custom labels created by the user or application.
  1094  	Type string `json:"type,omitempty"`
  1095  
  1096  	// ServerResponse contains the HTTP response code and headers from the server.
  1097  	googleapi.ServerResponse `json:"-"`
  1098  	// ForceSendFields is a list of field names (e.g. "Color") to unconditionally
  1099  	// include in API requests. By default, fields with empty or default values are
  1100  	// omitted from API requests. See
  1101  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
  1102  	// details.
  1103  	ForceSendFields []string `json:"-"`
  1104  	// NullFields is a list of field names (e.g. "Color") to include in API
  1105  	// requests with the JSON null value. By default, fields with empty values are
  1106  	// omitted from API requests. See
  1107  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
  1108  	NullFields []string `json:"-"`
  1109  }
  1110  
  1111  func (s *Label) MarshalJSON() ([]byte, error) {
  1112  	type NoMethod Label
  1113  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
  1114  }
  1115  
  1116  type LabelColor struct {
  1117  	// BackgroundColor: The background color represented as hex string #RRGGBB (ex
  1118  	// #000000). This field is required in order to set the color of a label. Only
  1119  	// the following predefined set of color values are allowed: \#000000, #434343,
  1120  	// #666666, #999999, #cccccc, #efefef, #f3f3f3, #ffffff, \#fb4c2f, #ffad47,
  1121  	// #fad165, #16a766, #43d692, #4a86e8, #a479e2, #f691b3, \#f6c5be, #ffe6c7,
  1122  	// #fef1d1, #b9e4d0, #c6f3de, #c9daf8, #e4d7f5, #fcdee8, \#efa093, #ffd6a2,
  1123  	// #fce8b3, #89d3b2, #a0eac9, #a4c2f4, #d0bcf1, #fbc8d9, \#e66550, #ffbc6b,
  1124  	// #fcda83, #44b984, #68dfa9, #6d9eeb, #b694e8, #f7a7c0, \#cc3a21, #eaa041,
  1125  	// #f2c960, #149e60, #3dc789, #3c78d8, #8e63ce, #e07798, \#ac2b16, #cf8933,
  1126  	// #d5ae49, #0b804b, #2a9c68, #285bac, #653e9b, #b65775, \#822111, #a46a21,
  1127  	// #aa8831, #076239, #1a764d, #1c4587, #41236d, #83334c \#464646, #e7e7e7,
  1128  	// #0d3472, #b6cff5, #0d3b44, #98d7e4, #3d188e, #e3d7ff, \#711a36, #fbd3e0,
  1129  	// #8a1c0a, #f2b2a8, #7a2e0b, #ffc8af, #7a4706, #ffdeb5, \#594c05, #fbe983,
  1130  	// #684e07, #fdedc1, #0b4f30, #b3efd3, #04502e, #a2dcc1, \#c2c2c2, #4986e7,
  1131  	// #2da2bb, #b99aff, #994a64, #f691b2, #ff7537, #ffad46, \#662e37, #ebdbde,
  1132  	// #cca6ac, #094228, #42d692, #16a765
  1133  	BackgroundColor string `json:"backgroundColor,omitempty"`
  1134  	// TextColor: The text color of the label, represented as hex string. This
  1135  	// field is required in order to set the color of a label. Only the following
  1136  	// predefined set of color values are allowed: \#000000, #434343, #666666,
  1137  	// #999999, #cccccc, #efefef, #f3f3f3, #ffffff, \#fb4c2f, #ffad47, #fad165,
  1138  	// #16a766, #43d692, #4a86e8, #a479e2, #f691b3, \#f6c5be, #ffe6c7, #fef1d1,
  1139  	// #b9e4d0, #c6f3de, #c9daf8, #e4d7f5, #fcdee8, \#efa093, #ffd6a2, #fce8b3,
  1140  	// #89d3b2, #a0eac9, #a4c2f4, #d0bcf1, #fbc8d9, \#e66550, #ffbc6b, #fcda83,
  1141  	// #44b984, #68dfa9, #6d9eeb, #b694e8, #f7a7c0, \#cc3a21, #eaa041, #f2c960,
  1142  	// #149e60, #3dc789, #3c78d8, #8e63ce, #e07798, \#ac2b16, #cf8933, #d5ae49,
  1143  	// #0b804b, #2a9c68, #285bac, #653e9b, #b65775, \#822111, #a46a21, #aa8831,
  1144  	// #076239, #1a764d, #1c4587, #41236d, #83334c \#464646, #e7e7e7, #0d3472,
  1145  	// #b6cff5, #0d3b44, #98d7e4, #3d188e, #e3d7ff, \#711a36, #fbd3e0, #8a1c0a,
  1146  	// #f2b2a8, #7a2e0b, #ffc8af, #7a4706, #ffdeb5, \#594c05, #fbe983, #684e07,
  1147  	// #fdedc1, #0b4f30, #b3efd3, #04502e, #a2dcc1, \#c2c2c2, #4986e7, #2da2bb,
  1148  	// #b99aff, #994a64, #f691b2, #ff7537, #ffad46, \#662e37, #ebdbde, #cca6ac,
  1149  	// #094228, #42d692, #16a765
  1150  	TextColor string `json:"textColor,omitempty"`
  1151  	// ForceSendFields is a list of field names (e.g. "BackgroundColor") to
  1152  	// unconditionally include in API requests. By default, fields with empty or
  1153  	// default values are omitted from API requests. See
  1154  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
  1155  	// details.
  1156  	ForceSendFields []string `json:"-"`
  1157  	// NullFields is a list of field names (e.g. "BackgroundColor") to include in
  1158  	// API requests with the JSON null value. By default, fields with empty values
  1159  	// are omitted from API requests. See
  1160  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
  1161  	NullFields []string `json:"-"`
  1162  }
  1163  
  1164  func (s *LabelColor) MarshalJSON() ([]byte, error) {
  1165  	type NoMethod LabelColor
  1166  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
  1167  }
  1168  
  1169  // LanguageSettings: Language settings for an account. These settings
  1170  // correspond to the "Language settings" feature in the web interface.
  1171  type LanguageSettings struct {
  1172  	// DisplayLanguage: The language to display Gmail in, formatted as an RFC 3066
  1173  	// Language Tag (for example `en-GB`, `fr` or `ja` for British English, French,
  1174  	// or Japanese respectively). The set of languages supported by Gmail evolves
  1175  	// over time, so please refer to the "Language" dropdown in the Gmail settings
  1176  	// for all available options, as described in the language settings help
  1177  	// article. A table of sample values is also provided in the Managing Language
  1178  	// Settings guide Not all Gmail clients can display the same set of languages.
  1179  	// In the case that a user's display language is not available for use on a
  1180  	// particular client, said client automatically chooses to display in the
  1181  	// closest supported variant (or a reasonable default).
  1182  	DisplayLanguage string `json:"displayLanguage,omitempty"`
  1183  
  1184  	// ServerResponse contains the HTTP response code and headers from the server.
  1185  	googleapi.ServerResponse `json:"-"`
  1186  	// ForceSendFields is a list of field names (e.g. "DisplayLanguage") to
  1187  	// unconditionally include in API requests. By default, fields with empty or
  1188  	// default values are omitted from API requests. See
  1189  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
  1190  	// details.
  1191  	ForceSendFields []string `json:"-"`
  1192  	// NullFields is a list of field names (e.g. "DisplayLanguage") to include in
  1193  	// API requests with the JSON null value. By default, fields with empty values
  1194  	// are omitted from API requests. See
  1195  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
  1196  	NullFields []string `json:"-"`
  1197  }
  1198  
  1199  func (s *LanguageSettings) MarshalJSON() ([]byte, error) {
  1200  	type NoMethod LanguageSettings
  1201  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
  1202  }
  1203  
  1204  type ListCseIdentitiesResponse struct {
  1205  	// CseIdentities: One page of the list of CSE identities configured for the
  1206  	// user.
  1207  	CseIdentities []*CseIdentity `json:"cseIdentities,omitempty"`
  1208  	// NextPageToken: Pagination token to be passed to a subsequent
  1209  	// ListCseIdentities call in order to retrieve the next page of identities. If
  1210  	// this value is not returned or is the empty string, then no further pages
  1211  	// remain.
  1212  	NextPageToken string `json:"nextPageToken,omitempty"`
  1213  
  1214  	// ServerResponse contains the HTTP response code and headers from the server.
  1215  	googleapi.ServerResponse `json:"-"`
  1216  	// ForceSendFields is a list of field names (e.g. "CseIdentities") to
  1217  	// unconditionally include in API requests. By default, fields with empty or
  1218  	// default values are omitted from API requests. See
  1219  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
  1220  	// details.
  1221  	ForceSendFields []string `json:"-"`
  1222  	// NullFields is a list of field names (e.g. "CseIdentities") to include in API
  1223  	// requests with the JSON null value. By default, fields with empty values are
  1224  	// omitted from API requests. See
  1225  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
  1226  	NullFields []string `json:"-"`
  1227  }
  1228  
  1229  func (s *ListCseIdentitiesResponse) MarshalJSON() ([]byte, error) {
  1230  	type NoMethod ListCseIdentitiesResponse
  1231  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
  1232  }
  1233  
  1234  type ListCseKeyPairsResponse struct {
  1235  	// CseKeyPairs: One page of the list of CSE key pairs installed for the user.
  1236  	CseKeyPairs []*CseKeyPair `json:"cseKeyPairs,omitempty"`
  1237  	// NextPageToken: Pagination token to be passed to a subsequent ListCseKeyPairs
  1238  	// call in order to retrieve the next page of key pairs. If this value is not
  1239  	// returned, then no further pages remain.
  1240  	NextPageToken string `json:"nextPageToken,omitempty"`
  1241  
  1242  	// ServerResponse contains the HTTP response code and headers from the server.
  1243  	googleapi.ServerResponse `json:"-"`
  1244  	// ForceSendFields is a list of field names (e.g. "CseKeyPairs") to
  1245  	// unconditionally include in API requests. By default, fields with empty or
  1246  	// default values are omitted from API requests. See
  1247  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
  1248  	// details.
  1249  	ForceSendFields []string `json:"-"`
  1250  	// NullFields is a list of field names (e.g. "CseKeyPairs") to include in API
  1251  	// requests with the JSON null value. By default, fields with empty values are
  1252  	// omitted from API requests. See
  1253  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
  1254  	NullFields []string `json:"-"`
  1255  }
  1256  
  1257  func (s *ListCseKeyPairsResponse) MarshalJSON() ([]byte, error) {
  1258  	type NoMethod ListCseKeyPairsResponse
  1259  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
  1260  }
  1261  
  1262  // ListDelegatesResponse: Response for the ListDelegates method.
  1263  type ListDelegatesResponse struct {
  1264  	// Delegates: List of the user's delegates (with any verification status). If
  1265  	// an account doesn't have delegates, this field doesn't appear.
  1266  	Delegates []*Delegate `json:"delegates,omitempty"`
  1267  
  1268  	// ServerResponse contains the HTTP response code and headers from the server.
  1269  	googleapi.ServerResponse `json:"-"`
  1270  	// ForceSendFields is a list of field names (e.g. "Delegates") to
  1271  	// unconditionally include in API requests. By default, fields with empty or
  1272  	// default values are omitted from API requests. See
  1273  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
  1274  	// details.
  1275  	ForceSendFields []string `json:"-"`
  1276  	// NullFields is a list of field names (e.g. "Delegates") to include in API
  1277  	// requests with the JSON null value. By default, fields with empty values are
  1278  	// omitted from API requests. See
  1279  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
  1280  	NullFields []string `json:"-"`
  1281  }
  1282  
  1283  func (s *ListDelegatesResponse) MarshalJSON() ([]byte, error) {
  1284  	type NoMethod ListDelegatesResponse
  1285  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
  1286  }
  1287  
  1288  type ListDraftsResponse struct {
  1289  	// Drafts: List of drafts. Note that the `Message` property in each `Draft`
  1290  	// resource only contains an `id` and a `threadId`. The messages.get method can
  1291  	// fetch additional message details.
  1292  	Drafts []*Draft `json:"drafts,omitempty"`
  1293  	// NextPageToken: Token to retrieve the next page of results in the list.
  1294  	NextPageToken string `json:"nextPageToken,omitempty"`
  1295  	// ResultSizeEstimate: Estimated total number of results.
  1296  	ResultSizeEstimate int64 `json:"resultSizeEstimate,omitempty"`
  1297  
  1298  	// ServerResponse contains the HTTP response code and headers from the server.
  1299  	googleapi.ServerResponse `json:"-"`
  1300  	// ForceSendFields is a list of field names (e.g. "Drafts") to unconditionally
  1301  	// include in API requests. By default, fields with empty or default values are
  1302  	// omitted from API requests. See
  1303  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
  1304  	// details.
  1305  	ForceSendFields []string `json:"-"`
  1306  	// NullFields is a list of field names (e.g. "Drafts") to include in API
  1307  	// requests with the JSON null value. By default, fields with empty values are
  1308  	// omitted from API requests. See
  1309  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
  1310  	NullFields []string `json:"-"`
  1311  }
  1312  
  1313  func (s *ListDraftsResponse) MarshalJSON() ([]byte, error) {
  1314  	type NoMethod ListDraftsResponse
  1315  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
  1316  }
  1317  
  1318  // ListFiltersResponse: Response for the ListFilters method.
  1319  type ListFiltersResponse struct {
  1320  	// Filter: List of a user's filters.
  1321  	Filter []*Filter `json:"filter,omitempty"`
  1322  
  1323  	// ServerResponse contains the HTTP response code and headers from the server.
  1324  	googleapi.ServerResponse `json:"-"`
  1325  	// ForceSendFields is a list of field names (e.g. "Filter") to unconditionally
  1326  	// include in API requests. By default, fields with empty or default values are
  1327  	// omitted from API requests. See
  1328  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
  1329  	// details.
  1330  	ForceSendFields []string `json:"-"`
  1331  	// NullFields is a list of field names (e.g. "Filter") to include in API
  1332  	// requests with the JSON null value. By default, fields with empty values are
  1333  	// omitted from API requests. See
  1334  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
  1335  	NullFields []string `json:"-"`
  1336  }
  1337  
  1338  func (s *ListFiltersResponse) MarshalJSON() ([]byte, error) {
  1339  	type NoMethod ListFiltersResponse
  1340  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
  1341  }
  1342  
  1343  // ListForwardingAddressesResponse: Response for the ListForwardingAddresses
  1344  // method.
  1345  type ListForwardingAddressesResponse struct {
  1346  	// ForwardingAddresses: List of addresses that may be used for forwarding.
  1347  	ForwardingAddresses []*ForwardingAddress `json:"forwardingAddresses,omitempty"`
  1348  
  1349  	// ServerResponse contains the HTTP response code and headers from the server.
  1350  	googleapi.ServerResponse `json:"-"`
  1351  	// ForceSendFields is a list of field names (e.g. "ForwardingAddresses") to
  1352  	// unconditionally include in API requests. By default, fields with empty or
  1353  	// default values are omitted from API requests. See
  1354  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
  1355  	// details.
  1356  	ForceSendFields []string `json:"-"`
  1357  	// NullFields is a list of field names (e.g. "ForwardingAddresses") to include
  1358  	// in API requests with the JSON null value. By default, fields with empty
  1359  	// values are omitted from API requests. See
  1360  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
  1361  	NullFields []string `json:"-"`
  1362  }
  1363  
  1364  func (s *ListForwardingAddressesResponse) MarshalJSON() ([]byte, error) {
  1365  	type NoMethod ListForwardingAddressesResponse
  1366  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
  1367  }
  1368  
  1369  type ListHistoryResponse struct {
  1370  	// History: List of history records. Any `messages` contained in the response
  1371  	// will typically only have `id` and `threadId` fields populated.
  1372  	History []*History `json:"history,omitempty"`
  1373  	// HistoryId: The ID of the mailbox's current history record.
  1374  	HistoryId uint64 `json:"historyId,omitempty,string"`
  1375  	// NextPageToken: Page token to retrieve the next page of results in the list.
  1376  	NextPageToken string `json:"nextPageToken,omitempty"`
  1377  
  1378  	// ServerResponse contains the HTTP response code and headers from the server.
  1379  	googleapi.ServerResponse `json:"-"`
  1380  	// ForceSendFields is a list of field names (e.g. "History") to unconditionally
  1381  	// include in API requests. By default, fields with empty or default values are
  1382  	// omitted from API requests. See
  1383  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
  1384  	// details.
  1385  	ForceSendFields []string `json:"-"`
  1386  	// NullFields is a list of field names (e.g. "History") to include in API
  1387  	// requests with the JSON null value. By default, fields with empty values are
  1388  	// omitted from API requests. See
  1389  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
  1390  	NullFields []string `json:"-"`
  1391  }
  1392  
  1393  func (s *ListHistoryResponse) MarshalJSON() ([]byte, error) {
  1394  	type NoMethod ListHistoryResponse
  1395  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
  1396  }
  1397  
  1398  type ListLabelsResponse struct {
  1399  	// Labels: List of labels. Note that each label resource only contains an `id`,
  1400  	// `name`, `messageListVisibility`, `labelListVisibility`, and `type`. The
  1401  	// labels.get method can fetch additional label details.
  1402  	Labels []*Label `json:"labels,omitempty"`
  1403  
  1404  	// ServerResponse contains the HTTP response code and headers from the server.
  1405  	googleapi.ServerResponse `json:"-"`
  1406  	// ForceSendFields is a list of field names (e.g. "Labels") to unconditionally
  1407  	// include in API requests. By default, fields with empty or default values are
  1408  	// omitted from API requests. See
  1409  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
  1410  	// details.
  1411  	ForceSendFields []string `json:"-"`
  1412  	// NullFields is a list of field names (e.g. "Labels") to include in API
  1413  	// requests with the JSON null value. By default, fields with empty values are
  1414  	// omitted from API requests. See
  1415  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
  1416  	NullFields []string `json:"-"`
  1417  }
  1418  
  1419  func (s *ListLabelsResponse) MarshalJSON() ([]byte, error) {
  1420  	type NoMethod ListLabelsResponse
  1421  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
  1422  }
  1423  
  1424  type ListMessagesResponse struct {
  1425  	// Messages: List of messages. Note that each message resource contains only an
  1426  	// `id` and a `threadId`. Additional message details can be fetched using the
  1427  	// messages.get method.
  1428  	Messages []*Message `json:"messages,omitempty"`
  1429  	// NextPageToken: Token to retrieve the next page of results in the list.
  1430  	NextPageToken string `json:"nextPageToken,omitempty"`
  1431  	// ResultSizeEstimate: Estimated total number of results.
  1432  	ResultSizeEstimate int64 `json:"resultSizeEstimate,omitempty"`
  1433  
  1434  	// ServerResponse contains the HTTP response code and headers from the server.
  1435  	googleapi.ServerResponse `json:"-"`
  1436  	// ForceSendFields is a list of field names (e.g. "Messages") to
  1437  	// unconditionally include in API requests. By default, fields with empty or
  1438  	// default values are omitted from API requests. See
  1439  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
  1440  	// details.
  1441  	ForceSendFields []string `json:"-"`
  1442  	// NullFields is a list of field names (e.g. "Messages") to include in API
  1443  	// requests with the JSON null value. By default, fields with empty values are
  1444  	// omitted from API requests. See
  1445  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
  1446  	NullFields []string `json:"-"`
  1447  }
  1448  
  1449  func (s *ListMessagesResponse) MarshalJSON() ([]byte, error) {
  1450  	type NoMethod ListMessagesResponse
  1451  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
  1452  }
  1453  
  1454  // ListSendAsResponse: Response for the ListSendAs method.
  1455  type ListSendAsResponse struct {
  1456  	// SendAs: List of send-as aliases.
  1457  	SendAs []*SendAs `json:"sendAs,omitempty"`
  1458  
  1459  	// ServerResponse contains the HTTP response code and headers from the server.
  1460  	googleapi.ServerResponse `json:"-"`
  1461  	// ForceSendFields is a list of field names (e.g. "SendAs") to unconditionally
  1462  	// include in API requests. By default, fields with empty or default values are
  1463  	// omitted from API requests. See
  1464  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
  1465  	// details.
  1466  	ForceSendFields []string `json:"-"`
  1467  	// NullFields is a list of field names (e.g. "SendAs") to include in API
  1468  	// requests with the JSON null value. By default, fields with empty values are
  1469  	// omitted from API requests. See
  1470  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
  1471  	NullFields []string `json:"-"`
  1472  }
  1473  
  1474  func (s *ListSendAsResponse) MarshalJSON() ([]byte, error) {
  1475  	type NoMethod ListSendAsResponse
  1476  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
  1477  }
  1478  
  1479  type ListSmimeInfoResponse struct {
  1480  	// SmimeInfo: List of SmimeInfo.
  1481  	SmimeInfo []*SmimeInfo `json:"smimeInfo,omitempty"`
  1482  
  1483  	// ServerResponse contains the HTTP response code and headers from the server.
  1484  	googleapi.ServerResponse `json:"-"`
  1485  	// ForceSendFields is a list of field names (e.g. "SmimeInfo") to
  1486  	// unconditionally include in API requests. By default, fields with empty or
  1487  	// default values are omitted from API requests. See
  1488  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
  1489  	// details.
  1490  	ForceSendFields []string `json:"-"`
  1491  	// NullFields is a list of field names (e.g. "SmimeInfo") to include in API
  1492  	// requests with the JSON null value. By default, fields with empty values are
  1493  	// omitted from API requests. See
  1494  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
  1495  	NullFields []string `json:"-"`
  1496  }
  1497  
  1498  func (s *ListSmimeInfoResponse) MarshalJSON() ([]byte, error) {
  1499  	type NoMethod ListSmimeInfoResponse
  1500  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
  1501  }
  1502  
  1503  type ListThreadsResponse struct {
  1504  	// NextPageToken: Page token to retrieve the next page of results in the list.
  1505  	NextPageToken string `json:"nextPageToken,omitempty"`
  1506  	// ResultSizeEstimate: Estimated total number of results.
  1507  	ResultSizeEstimate int64 `json:"resultSizeEstimate,omitempty"`
  1508  	// Threads: List of threads. Note that each thread resource does not contain a
  1509  	// list of `messages`. The list of `messages` for a given thread can be fetched
  1510  	// using the threads.get method.
  1511  	Threads []*Thread `json:"threads,omitempty"`
  1512  
  1513  	// ServerResponse contains the HTTP response code and headers from the server.
  1514  	googleapi.ServerResponse `json:"-"`
  1515  	// ForceSendFields is a list of field names (e.g. "NextPageToken") to
  1516  	// unconditionally include in API requests. By default, fields with empty or
  1517  	// default values are omitted from API requests. See
  1518  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
  1519  	// details.
  1520  	ForceSendFields []string `json:"-"`
  1521  	// NullFields is a list of field names (e.g. "NextPageToken") to include in API
  1522  	// requests with the JSON null value. By default, fields with empty values are
  1523  	// omitted from API requests. See
  1524  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
  1525  	NullFields []string `json:"-"`
  1526  }
  1527  
  1528  func (s *ListThreadsResponse) MarshalJSON() ([]byte, error) {
  1529  	type NoMethod ListThreadsResponse
  1530  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
  1531  }
  1532  
  1533  // Message: An email message.
  1534  type Message struct {
  1535  	// HistoryId: The ID of the last history record that modified this message.
  1536  	HistoryId uint64 `json:"historyId,omitempty,string"`
  1537  	// Id: The immutable ID of the message.
  1538  	Id string `json:"id,omitempty"`
  1539  	// InternalDate: The internal message creation timestamp (epoch ms), which
  1540  	// determines ordering in the inbox. For normal SMTP-received email, this
  1541  	// represents the time the message was originally accepted by Google, which is
  1542  	// more reliable than the `Date` header. However, for API-migrated mail, it can
  1543  	// be configured by client to be based on the `Date` header.
  1544  	InternalDate int64 `json:"internalDate,omitempty,string"`
  1545  	// LabelIds: List of IDs of labels applied to this message.
  1546  	LabelIds []string `json:"labelIds,omitempty"`
  1547  	// Payload: The parsed email structure in the message parts.
  1548  	Payload *MessagePart `json:"payload,omitempty"`
  1549  	// Raw: The entire email message in an RFC 2822 formatted and base64url encoded
  1550  	// string. Returned in `messages.get` and `drafts.get` responses when the
  1551  	// `format=RAW` parameter is supplied.
  1552  	Raw string `json:"raw,omitempty"`
  1553  	// SizeEstimate: Estimated size in bytes of the message.
  1554  	SizeEstimate int64 `json:"sizeEstimate,omitempty"`
  1555  	// Snippet: A short part of the message text.
  1556  	Snippet string `json:"snippet,omitempty"`
  1557  	// ThreadId: The ID of the thread the message belongs to. To add a message or
  1558  	// draft to a thread, the following criteria must be met: 1. The requested
  1559  	// `threadId` must be specified on the `Message` or `Draft.Message` you supply
  1560  	// with your request. 2. The `References` and `In-Reply-To` headers must be set
  1561  	// in compliance with the RFC 2822 (https://tools.ietf.org/html/rfc2822)
  1562  	// standard. 3. The `Subject` headers must match.
  1563  	ThreadId string `json:"threadId,omitempty"`
  1564  
  1565  	// ServerResponse contains the HTTP response code and headers from the server.
  1566  	googleapi.ServerResponse `json:"-"`
  1567  	// ForceSendFields is a list of field names (e.g. "HistoryId") to
  1568  	// unconditionally include in API requests. By default, fields with empty or
  1569  	// default values are omitted from API requests. See
  1570  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
  1571  	// details.
  1572  	ForceSendFields []string `json:"-"`
  1573  	// NullFields is a list of field names (e.g. "HistoryId") to include in API
  1574  	// requests with the JSON null value. By default, fields with empty values are
  1575  	// omitted from API requests. See
  1576  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
  1577  	NullFields []string `json:"-"`
  1578  }
  1579  
  1580  func (s *Message) MarshalJSON() ([]byte, error) {
  1581  	type NoMethod Message
  1582  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
  1583  }
  1584  
  1585  // MessagePart: A single MIME message part.
  1586  type MessagePart struct {
  1587  	// Body: The message part body for this part, which may be empty for container
  1588  	// MIME message parts.
  1589  	Body *MessagePartBody `json:"body,omitempty"`
  1590  	// Filename: The filename of the attachment. Only present if this message part
  1591  	// represents an attachment.
  1592  	Filename string `json:"filename,omitempty"`
  1593  	// Headers: List of headers on this message part. For the top-level message
  1594  	// part, representing the entire message payload, it will contain the standard
  1595  	// RFC 2822 email headers such as `To`, `From`, and `Subject`.
  1596  	Headers []*MessagePartHeader `json:"headers,omitempty"`
  1597  	// MimeType: The MIME type of the message part.
  1598  	MimeType string `json:"mimeType,omitempty"`
  1599  	// PartId: The immutable ID of the message part.
  1600  	PartId string `json:"partId,omitempty"`
  1601  	// Parts: The child MIME message parts of this part. This only applies to
  1602  	// container MIME message parts, for example `multipart/*`. For non- container
  1603  	// MIME message part types, such as `text/plain`, this field is empty. For more
  1604  	// information, see RFC 1521.
  1605  	Parts []*MessagePart `json:"parts,omitempty"`
  1606  	// ForceSendFields is a list of field names (e.g. "Body") to unconditionally
  1607  	// include in API requests. By default, fields with empty or default values are
  1608  	// omitted from API requests. See
  1609  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
  1610  	// details.
  1611  	ForceSendFields []string `json:"-"`
  1612  	// NullFields is a list of field names (e.g. "Body") to include in API requests
  1613  	// with the JSON null value. By default, fields with empty values are omitted
  1614  	// from API requests. See
  1615  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
  1616  	NullFields []string `json:"-"`
  1617  }
  1618  
  1619  func (s *MessagePart) MarshalJSON() ([]byte, error) {
  1620  	type NoMethod MessagePart
  1621  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
  1622  }
  1623  
  1624  // MessagePartBody: The body of a single MIME message part.
  1625  type MessagePartBody struct {
  1626  	// AttachmentId: When present, contains the ID of an external attachment that
  1627  	// can be retrieved in a separate `messages.attachments.get` request. When not
  1628  	// present, the entire content of the message part body is contained in the
  1629  	// data field.
  1630  	AttachmentId string `json:"attachmentId,omitempty"`
  1631  	// Data: The body data of a MIME message part as a base64url encoded string.
  1632  	// May be empty for MIME container types that have no message body or when the
  1633  	// body data is sent as a separate attachment. An attachment ID is present if
  1634  	// the body data is contained in a separate attachment.
  1635  	Data string `json:"data,omitempty"`
  1636  	// Size: Number of bytes for the message part data (encoding notwithstanding).
  1637  	Size int64 `json:"size,omitempty"`
  1638  
  1639  	// ServerResponse contains the HTTP response code and headers from the server.
  1640  	googleapi.ServerResponse `json:"-"`
  1641  	// ForceSendFields is a list of field names (e.g. "AttachmentId") to
  1642  	// unconditionally include in API requests. By default, fields with empty or
  1643  	// default values are omitted from API requests. See
  1644  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
  1645  	// details.
  1646  	ForceSendFields []string `json:"-"`
  1647  	// NullFields is a list of field names (e.g. "AttachmentId") to include in API
  1648  	// requests with the JSON null value. By default, fields with empty values are
  1649  	// omitted from API requests. See
  1650  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
  1651  	NullFields []string `json:"-"`
  1652  }
  1653  
  1654  func (s *MessagePartBody) MarshalJSON() ([]byte, error) {
  1655  	type NoMethod MessagePartBody
  1656  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
  1657  }
  1658  
  1659  type MessagePartHeader struct {
  1660  	// Name: The name of the header before the `:` separator. For example, `To`.
  1661  	Name string `json:"name,omitempty"`
  1662  	// Value: The value of the header after the `:` separator. For example,
  1663  	// `someuser@example.com`.
  1664  	Value string `json:"value,omitempty"`
  1665  	// ForceSendFields is a list of field names (e.g. "Name") to unconditionally
  1666  	// include in API requests. By default, fields with empty or default values are
  1667  	// omitted from API requests. See
  1668  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
  1669  	// details.
  1670  	ForceSendFields []string `json:"-"`
  1671  	// NullFields is a list of field names (e.g. "Name") to include in API requests
  1672  	// with the JSON null value. By default, fields with empty values are omitted
  1673  	// from API requests. See
  1674  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
  1675  	NullFields []string `json:"-"`
  1676  }
  1677  
  1678  func (s *MessagePartHeader) MarshalJSON() ([]byte, error) {
  1679  	type NoMethod MessagePartHeader
  1680  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
  1681  }
  1682  
  1683  type ModifyMessageRequest struct {
  1684  	// AddLabelIds: A list of IDs of labels to add to this message. You can add up
  1685  	// to 100 labels with each update.
  1686  	AddLabelIds []string `json:"addLabelIds,omitempty"`
  1687  	// RemoveLabelIds: A list IDs of labels to remove from this message. You can
  1688  	// remove up to 100 labels with each update.
  1689  	RemoveLabelIds []string `json:"removeLabelIds,omitempty"`
  1690  	// ForceSendFields is a list of field names (e.g. "AddLabelIds") to
  1691  	// unconditionally include in API requests. By default, fields with empty or
  1692  	// default values are omitted from API requests. See
  1693  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
  1694  	// details.
  1695  	ForceSendFields []string `json:"-"`
  1696  	// NullFields is a list of field names (e.g. "AddLabelIds") to include in API
  1697  	// requests with the JSON null value. By default, fields with empty values are
  1698  	// omitted from API requests. See
  1699  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
  1700  	NullFields []string `json:"-"`
  1701  }
  1702  
  1703  func (s *ModifyMessageRequest) MarshalJSON() ([]byte, error) {
  1704  	type NoMethod ModifyMessageRequest
  1705  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
  1706  }
  1707  
  1708  type ModifyThreadRequest struct {
  1709  	// AddLabelIds: A list of IDs of labels to add to this thread. You can add up
  1710  	// to 100 labels with each update.
  1711  	AddLabelIds []string `json:"addLabelIds,omitempty"`
  1712  	// RemoveLabelIds: A list of IDs of labels to remove from this thread. You can
  1713  	// remove up to 100 labels with each update.
  1714  	RemoveLabelIds []string `json:"removeLabelIds,omitempty"`
  1715  	// ForceSendFields is a list of field names (e.g. "AddLabelIds") to
  1716  	// unconditionally include in API requests. By default, fields with empty or
  1717  	// default values are omitted from API requests. See
  1718  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
  1719  	// details.
  1720  	ForceSendFields []string `json:"-"`
  1721  	// NullFields is a list of field names (e.g. "AddLabelIds") to include in API
  1722  	// requests with the JSON null value. By default, fields with empty values are
  1723  	// omitted from API requests. See
  1724  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
  1725  	NullFields []string `json:"-"`
  1726  }
  1727  
  1728  func (s *ModifyThreadRequest) MarshalJSON() ([]byte, error) {
  1729  	type NoMethod ModifyThreadRequest
  1730  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
  1731  }
  1732  
  1733  // ObliterateCseKeyPairRequest: Request to obliterate a CSE key pair.
  1734  type ObliterateCseKeyPairRequest struct {
  1735  }
  1736  
  1737  // PopSettings: POP settings for an account.
  1738  type PopSettings struct {
  1739  	// AccessWindow: The range of messages which are accessible via POP.
  1740  	//
  1741  	// Possible values:
  1742  	//   "accessWindowUnspecified" - Unspecified range.
  1743  	//   "disabled" - Indicates that no messages are accessible via POP.
  1744  	//   "fromNowOn" - Indicates that unfetched messages received after some past
  1745  	// point in time are accessible via POP.
  1746  	//   "allMail" - Indicates that all unfetched messages are accessible via POP.
  1747  	AccessWindow string `json:"accessWindow,omitempty"`
  1748  	// Disposition: The action that will be executed on a message after it has been
  1749  	// fetched via POP.
  1750  	//
  1751  	// Possible values:
  1752  	//   "dispositionUnspecified" - Unspecified disposition.
  1753  	//   "leaveInInbox" - Leave the message in the `INBOX`.
  1754  	//   "archive" - Archive the message.
  1755  	//   "trash" - Move the message to the `TRASH`.
  1756  	//   "markRead" - Leave the message in the `INBOX` and mark it as read.
  1757  	Disposition string `json:"disposition,omitempty"`
  1758  
  1759  	// ServerResponse contains the HTTP response code and headers from the server.
  1760  	googleapi.ServerResponse `json:"-"`
  1761  	// ForceSendFields is a list of field names (e.g. "AccessWindow") to
  1762  	// unconditionally include in API requests. By default, fields with empty or
  1763  	// default values are omitted from API requests. See
  1764  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
  1765  	// details.
  1766  	ForceSendFields []string `json:"-"`
  1767  	// NullFields is a list of field names (e.g. "AccessWindow") to include in API
  1768  	// requests with the JSON null value. By default, fields with empty values are
  1769  	// omitted from API requests. See
  1770  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
  1771  	NullFields []string `json:"-"`
  1772  }
  1773  
  1774  func (s *PopSettings) MarshalJSON() ([]byte, error) {
  1775  	type NoMethod PopSettings
  1776  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
  1777  }
  1778  
  1779  // Profile: Profile for a Gmail user.
  1780  type Profile struct {
  1781  	// EmailAddress: The user's email address.
  1782  	EmailAddress string `json:"emailAddress,omitempty"`
  1783  	// HistoryId: The ID of the mailbox's current history record.
  1784  	HistoryId uint64 `json:"historyId,omitempty,string"`
  1785  	// MessagesTotal: The total number of messages in the mailbox.
  1786  	MessagesTotal int64 `json:"messagesTotal,omitempty"`
  1787  	// ThreadsTotal: The total number of threads in the mailbox.
  1788  	ThreadsTotal int64 `json:"threadsTotal,omitempty"`
  1789  
  1790  	// ServerResponse contains the HTTP response code and headers from the server.
  1791  	googleapi.ServerResponse `json:"-"`
  1792  	// ForceSendFields is a list of field names (e.g. "EmailAddress") to
  1793  	// unconditionally include in API requests. By default, fields with empty or
  1794  	// default values are omitted from API requests. See
  1795  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
  1796  	// details.
  1797  	ForceSendFields []string `json:"-"`
  1798  	// NullFields is a list of field names (e.g. "EmailAddress") to include in API
  1799  	// requests with the JSON null value. By default, fields with empty values are
  1800  	// omitted from API requests. See
  1801  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
  1802  	NullFields []string `json:"-"`
  1803  }
  1804  
  1805  func (s *Profile) MarshalJSON() ([]byte, error) {
  1806  	type NoMethod Profile
  1807  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
  1808  }
  1809  
  1810  // SendAs: Settings associated with a send-as alias, which can be either the
  1811  // primary login address associated with the account or a custom "from"
  1812  // address. Send-as aliases correspond to the "Send Mail As" feature in the web
  1813  // interface.
  1814  type SendAs struct {
  1815  	// DisplayName: A name that appears in the "From:" header for mail sent using
  1816  	// this alias. For custom "from" addresses, when this is empty, Gmail will
  1817  	// populate the "From:" header with the name that is used for the primary
  1818  	// address associated with the account. If the admin has disabled the ability
  1819  	// for users to update their name format, requests to update this field for the
  1820  	// primary login will silently fail.
  1821  	DisplayName string `json:"displayName,omitempty"`
  1822  	// IsDefault: Whether this address is selected as the default "From:" address
  1823  	// in situations such as composing a new message or sending a vacation
  1824  	// auto-reply. Every Gmail account has exactly one default send-as address, so
  1825  	// the only legal value that clients may write to this field is `true`.
  1826  	// Changing this from `false` to `true` for an address will result in this
  1827  	// field becoming `false` for the other previous default address.
  1828  	IsDefault bool `json:"isDefault,omitempty"`
  1829  	// IsPrimary: Whether this address is the primary address used to login to the
  1830  	// account. Every Gmail account has exactly one primary address, and it cannot
  1831  	// be deleted from the collection of send-as aliases. This field is read-only.
  1832  	IsPrimary bool `json:"isPrimary,omitempty"`
  1833  	// ReplyToAddress: An optional email address that is included in a "Reply-To:"
  1834  	// header for mail sent using this alias. If this is empty, Gmail will not
  1835  	// generate a "Reply-To:" header.
  1836  	ReplyToAddress string `json:"replyToAddress,omitempty"`
  1837  	// SendAsEmail: The email address that appears in the "From:" header for mail
  1838  	// sent using this alias. This is read-only for all operations except create.
  1839  	SendAsEmail string `json:"sendAsEmail,omitempty"`
  1840  	// Signature: An optional HTML signature that is included in messages composed
  1841  	// with this alias in the Gmail web UI. This signature is added to new emails
  1842  	// only.
  1843  	Signature string `json:"signature,omitempty"`
  1844  	// SmtpMsa: An optional SMTP service that will be used as an outbound relay for
  1845  	// mail sent using this alias. If this is empty, outbound mail will be sent
  1846  	// directly from Gmail's servers to the destination SMTP service. This setting
  1847  	// only applies to custom "from" aliases.
  1848  	SmtpMsa *SmtpMsa `json:"smtpMsa,omitempty"`
  1849  	// TreatAsAlias: Whether Gmail should treat this address as an alias for the
  1850  	// user's primary email address. This setting only applies to custom "from"
  1851  	// aliases.
  1852  	TreatAsAlias bool `json:"treatAsAlias,omitempty"`
  1853  	// VerificationStatus: Indicates whether this address has been verified for use
  1854  	// as a send-as alias. Read-only. This setting only applies to custom "from"
  1855  	// aliases.
  1856  	//
  1857  	// Possible values:
  1858  	//   "verificationStatusUnspecified" - Unspecified verification status.
  1859  	//   "accepted" - The address is ready to use as a send-as alias.
  1860  	//   "pending" - The address is awaiting verification by the owner.
  1861  	VerificationStatus string `json:"verificationStatus,omitempty"`
  1862  
  1863  	// ServerResponse contains the HTTP response code and headers from the server.
  1864  	googleapi.ServerResponse `json:"-"`
  1865  	// ForceSendFields is a list of field names (e.g. "DisplayName") to
  1866  	// unconditionally include in API requests. By default, fields with empty or
  1867  	// default values are omitted from API requests. See
  1868  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
  1869  	// details.
  1870  	ForceSendFields []string `json:"-"`
  1871  	// NullFields is a list of field names (e.g. "DisplayName") to include in API
  1872  	// requests with the JSON null value. By default, fields with empty values are
  1873  	// omitted from API requests. See
  1874  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
  1875  	NullFields []string `json:"-"`
  1876  }
  1877  
  1878  func (s *SendAs) MarshalJSON() ([]byte, error) {
  1879  	type NoMethod SendAs
  1880  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
  1881  }
  1882  
  1883  // SignAndEncryptKeyPairs: The configuration of a CSE identity that uses
  1884  // different key pairs for signing and encryption.
  1885  type SignAndEncryptKeyPairs struct {
  1886  	// EncryptionKeyPairId: The ID of the CseKeyPair that encrypts signed outgoing
  1887  	// mail.
  1888  	EncryptionKeyPairId string `json:"encryptionKeyPairId,omitempty"`
  1889  	// SigningKeyPairId: The ID of the CseKeyPair that signs outgoing mail.
  1890  	SigningKeyPairId string `json:"signingKeyPairId,omitempty"`
  1891  	// ForceSendFields is a list of field names (e.g. "EncryptionKeyPairId") to
  1892  	// unconditionally include in API requests. By default, fields with empty or
  1893  	// default values are omitted from API requests. See
  1894  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
  1895  	// details.
  1896  	ForceSendFields []string `json:"-"`
  1897  	// NullFields is a list of field names (e.g. "EncryptionKeyPairId") to include
  1898  	// in API requests with the JSON null value. By default, fields with empty
  1899  	// values are omitted from API requests. See
  1900  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
  1901  	NullFields []string `json:"-"`
  1902  }
  1903  
  1904  func (s *SignAndEncryptKeyPairs) MarshalJSON() ([]byte, error) {
  1905  	type NoMethod SignAndEncryptKeyPairs
  1906  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
  1907  }
  1908  
  1909  // SmimeInfo: An S/MIME email config.
  1910  type SmimeInfo struct {
  1911  	// EncryptedKeyPassword: Encrypted key password, when key is encrypted.
  1912  	EncryptedKeyPassword string `json:"encryptedKeyPassword,omitempty"`
  1913  	// Expiration: When the certificate expires (in milliseconds since epoch).
  1914  	Expiration int64 `json:"expiration,omitempty,string"`
  1915  	// Id: The immutable ID for the SmimeInfo.
  1916  	Id string `json:"id,omitempty"`
  1917  	// IsDefault: Whether this SmimeInfo is the default one for this user's send-as
  1918  	// address.
  1919  	IsDefault bool `json:"isDefault,omitempty"`
  1920  	// IssuerCn: The S/MIME certificate issuer's common name.
  1921  	IssuerCn string `json:"issuerCn,omitempty"`
  1922  	// Pem: PEM formatted X509 concatenated certificate string (standard base64
  1923  	// encoding). Format used for returning key, which includes public key as well
  1924  	// as certificate chain (not private key).
  1925  	Pem string `json:"pem,omitempty"`
  1926  	// Pkcs12: PKCS#12 format containing a single private/public key pair and
  1927  	// certificate chain. This format is only accepted from client for creating a
  1928  	// new SmimeInfo and is never returned, because the private key is not intended
  1929  	// to be exported. PKCS#12 may be encrypted, in which case encryptedKeyPassword
  1930  	// should be set appropriately.
  1931  	Pkcs12 string `json:"pkcs12,omitempty"`
  1932  
  1933  	// ServerResponse contains the HTTP response code and headers from the server.
  1934  	googleapi.ServerResponse `json:"-"`
  1935  	// ForceSendFields is a list of field names (e.g. "EncryptedKeyPassword") to
  1936  	// unconditionally include in API requests. By default, fields with empty or
  1937  	// default values are omitted from API requests. See
  1938  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
  1939  	// details.
  1940  	ForceSendFields []string `json:"-"`
  1941  	// NullFields is a list of field names (e.g. "EncryptedKeyPassword") to include
  1942  	// in API requests with the JSON null value. By default, fields with empty
  1943  	// values are omitted from API requests. See
  1944  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
  1945  	NullFields []string `json:"-"`
  1946  }
  1947  
  1948  func (s *SmimeInfo) MarshalJSON() ([]byte, error) {
  1949  	type NoMethod SmimeInfo
  1950  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
  1951  }
  1952  
  1953  // SmtpMsa: Configuration for communication with an SMTP service.
  1954  type SmtpMsa struct {
  1955  	// Host: The hostname of the SMTP service. Required.
  1956  	Host string `json:"host,omitempty"`
  1957  	// Password: The password that will be used for authentication with the SMTP
  1958  	// service. This is a write-only field that can be specified in requests to
  1959  	// create or update SendAs settings; it is never populated in responses.
  1960  	Password string `json:"password,omitempty"`
  1961  	// Port: The port of the SMTP service. Required.
  1962  	Port int64 `json:"port,omitempty"`
  1963  	// SecurityMode: The protocol that will be used to secure communication with
  1964  	// the SMTP service. Required.
  1965  	//
  1966  	// Possible values:
  1967  	//   "securityModeUnspecified" - Unspecified security mode.
  1968  	//   "none" - Communication with the remote SMTP service is unsecured. Requires
  1969  	// port 25.
  1970  	//   "ssl" - Communication with the remote SMTP service is secured using SSL.
  1971  	//   "starttls" - Communication with the remote SMTP service is secured using
  1972  	// STARTTLS.
  1973  	SecurityMode string `json:"securityMode,omitempty"`
  1974  	// Username: The username that will be used for authentication with the SMTP
  1975  	// service. This is a write-only field that can be specified in requests to
  1976  	// create or update SendAs settings; it is never populated in responses.
  1977  	Username string `json:"username,omitempty"`
  1978  	// ForceSendFields is a list of field names (e.g. "Host") to unconditionally
  1979  	// include in API requests. By default, fields with empty or default values are
  1980  	// omitted from API requests. See
  1981  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
  1982  	// details.
  1983  	ForceSendFields []string `json:"-"`
  1984  	// NullFields is a list of field names (e.g. "Host") to include in API requests
  1985  	// with the JSON null value. By default, fields with empty values are omitted
  1986  	// from API requests. See
  1987  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
  1988  	NullFields []string `json:"-"`
  1989  }
  1990  
  1991  func (s *SmtpMsa) MarshalJSON() ([]byte, error) {
  1992  	type NoMethod SmtpMsa
  1993  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
  1994  }
  1995  
  1996  // Thread: A collection of messages representing a conversation.
  1997  type Thread struct {
  1998  	// HistoryId: The ID of the last history record that modified this thread.
  1999  	HistoryId uint64 `json:"historyId,omitempty,string"`
  2000  	// Id: The unique ID of the thread.
  2001  	Id string `json:"id,omitempty"`
  2002  	// Messages: The list of messages in the thread.
  2003  	Messages []*Message `json:"messages,omitempty"`
  2004  	// Snippet: A short part of the message text.
  2005  	Snippet string `json:"snippet,omitempty"`
  2006  
  2007  	// ServerResponse contains the HTTP response code and headers from the server.
  2008  	googleapi.ServerResponse `json:"-"`
  2009  	// ForceSendFields is a list of field names (e.g. "HistoryId") to
  2010  	// unconditionally include in API requests. By default, fields with empty or
  2011  	// default values are omitted from API requests. See
  2012  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
  2013  	// details.
  2014  	ForceSendFields []string `json:"-"`
  2015  	// NullFields is a list of field names (e.g. "HistoryId") to include in API
  2016  	// requests with the JSON null value. By default, fields with empty values are
  2017  	// omitted from API requests. See
  2018  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
  2019  	NullFields []string `json:"-"`
  2020  }
  2021  
  2022  func (s *Thread) MarshalJSON() ([]byte, error) {
  2023  	type NoMethod Thread
  2024  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
  2025  }
  2026  
  2027  // VacationSettings: Vacation auto-reply settings for an account. These
  2028  // settings correspond to the "Vacation responder" feature in the web
  2029  // interface.
  2030  type VacationSettings struct {
  2031  	// EnableAutoReply: Flag that controls whether Gmail automatically replies to
  2032  	// messages.
  2033  	EnableAutoReply bool `json:"enableAutoReply,omitempty"`
  2034  	// EndTime: An optional end time for sending auto-replies (epoch ms). When this
  2035  	// is specified, Gmail will automatically reply only to messages that it
  2036  	// receives before the end time. If both `startTime` and `endTime` are
  2037  	// specified, `startTime` must precede `endTime`.
  2038  	EndTime int64 `json:"endTime,omitempty,string"`
  2039  	// ResponseBodyHtml: Response body in HTML format. Gmail will sanitize the HTML
  2040  	// before storing it. If both `response_body_plain_text` and
  2041  	// `response_body_html` are specified, `response_body_html` will be used.
  2042  	ResponseBodyHtml string `json:"responseBodyHtml,omitempty"`
  2043  	// ResponseBodyPlainText: Response body in plain text format. If both
  2044  	// `response_body_plain_text` and `response_body_html` are specified,
  2045  	// `response_body_html` will be used.
  2046  	ResponseBodyPlainText string `json:"responseBodyPlainText,omitempty"`
  2047  	// ResponseSubject: Optional text to prepend to the subject line in vacation
  2048  	// responses. In order to enable auto-replies, either the response subject or
  2049  	// the response body must be nonempty.
  2050  	ResponseSubject string `json:"responseSubject,omitempty"`
  2051  	// RestrictToContacts: Flag that determines whether responses are sent to
  2052  	// recipients who are not in the user's list of contacts.
  2053  	RestrictToContacts bool `json:"restrictToContacts,omitempty"`
  2054  	// RestrictToDomain: Flag that determines whether responses are sent to
  2055  	// recipients who are outside of the user's domain. This feature is only
  2056  	// available for Google Workspace users.
  2057  	RestrictToDomain bool `json:"restrictToDomain,omitempty"`
  2058  	// StartTime: An optional start time for sending auto-replies (epoch ms). When
  2059  	// this is specified, Gmail will automatically reply only to messages that it
  2060  	// receives after the start time. If both `startTime` and `endTime` are
  2061  	// specified, `startTime` must precede `endTime`.
  2062  	StartTime int64 `json:"startTime,omitempty,string"`
  2063  
  2064  	// ServerResponse contains the HTTP response code and headers from the server.
  2065  	googleapi.ServerResponse `json:"-"`
  2066  	// ForceSendFields is a list of field names (e.g. "EnableAutoReply") to
  2067  	// unconditionally include in API requests. By default, fields with empty or
  2068  	// default values are omitted from API requests. See
  2069  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
  2070  	// details.
  2071  	ForceSendFields []string `json:"-"`
  2072  	// NullFields is a list of field names (e.g. "EnableAutoReply") to include in
  2073  	// API requests with the JSON null value. By default, fields with empty values
  2074  	// are omitted from API requests. See
  2075  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
  2076  	NullFields []string `json:"-"`
  2077  }
  2078  
  2079  func (s *VacationSettings) MarshalJSON() ([]byte, error) {
  2080  	type NoMethod VacationSettings
  2081  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
  2082  }
  2083  
  2084  // WatchRequest: Set up or update a new push notification watch on this user's
  2085  // mailbox.
  2086  type WatchRequest struct {
  2087  	// LabelFilterAction: Filtering behavior of `labelIds list` specified. This
  2088  	// field is deprecated because it caused incorrect behavior in some cases; use
  2089  	// `label_filter_behavior` instead.
  2090  	//
  2091  	// Possible values:
  2092  	//   "include" - Only get push notifications for message changes relating to
  2093  	// labelIds specified.
  2094  	//   "exclude" - Get push notifications for all message changes except those
  2095  	// relating to labelIds specified.
  2096  	LabelFilterAction string `json:"labelFilterAction,omitempty"`
  2097  	// LabelFilterBehavior: Filtering behavior of `labelIds list` specified. This
  2098  	// field replaces `label_filter_action`; if set, `label_filter_action` is
  2099  	// ignored.
  2100  	//
  2101  	// Possible values:
  2102  	//   "include" - Only get push notifications for message changes relating to
  2103  	// labelIds specified.
  2104  	//   "exclude" - Get push notifications for all message changes except those
  2105  	// relating to labelIds specified.
  2106  	LabelFilterBehavior string `json:"labelFilterBehavior,omitempty"`
  2107  	// LabelIds: List of label_ids to restrict notifications about. By default, if
  2108  	// unspecified, all changes are pushed out. If specified then dictates which
  2109  	// labels are required for a push notification to be generated.
  2110  	LabelIds []string `json:"labelIds,omitempty"`
  2111  	// TopicName: A fully qualified Google Cloud Pub/Sub API topic name to publish
  2112  	// the events to. This topic name **must** already exist in Cloud Pub/Sub and
  2113  	// you **must** have already granted gmail "publish" permission on it. For
  2114  	// example, "projects/my-project-identifier/topics/my-topic-name" (using the
  2115  	// Cloud Pub/Sub "v1" topic naming format). Note that the
  2116  	// "my-project-identifier" portion must exactly match your Google developer
  2117  	// project id (the one executing this watch request).
  2118  	TopicName string `json:"topicName,omitempty"`
  2119  	// ForceSendFields is a list of field names (e.g. "LabelFilterAction") to
  2120  	// unconditionally include in API requests. By default, fields with empty or
  2121  	// default values are omitted from API requests. See
  2122  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
  2123  	// details.
  2124  	ForceSendFields []string `json:"-"`
  2125  	// NullFields is a list of field names (e.g. "LabelFilterAction") to include in
  2126  	// API requests with the JSON null value. By default, fields with empty values
  2127  	// are omitted from API requests. See
  2128  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
  2129  	NullFields []string `json:"-"`
  2130  }
  2131  
  2132  func (s *WatchRequest) MarshalJSON() ([]byte, error) {
  2133  	type NoMethod WatchRequest
  2134  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
  2135  }
  2136  
  2137  // WatchResponse: Push notification watch response.
  2138  type WatchResponse struct {
  2139  	// Expiration: When Gmail will stop sending notifications for mailbox updates
  2140  	// (epoch millis). Call `watch` again before this time to renew the watch.
  2141  	Expiration int64 `json:"expiration,omitempty,string"`
  2142  	// HistoryId: The ID of the mailbox's current history record.
  2143  	HistoryId uint64 `json:"historyId,omitempty,string"`
  2144  
  2145  	// ServerResponse contains the HTTP response code and headers from the server.
  2146  	googleapi.ServerResponse `json:"-"`
  2147  	// ForceSendFields is a list of field names (e.g. "Expiration") to
  2148  	// unconditionally include in API requests. By default, fields with empty or
  2149  	// default values are omitted from API requests. See
  2150  	// https://pkg.go.dev/google.golang.org/api#hdr-ForceSendFields for more
  2151  	// details.
  2152  	ForceSendFields []string `json:"-"`
  2153  	// NullFields is a list of field names (e.g. "Expiration") to include in API
  2154  	// requests with the JSON null value. By default, fields with empty values are
  2155  	// omitted from API requests. See
  2156  	// https://pkg.go.dev/google.golang.org/api#hdr-NullFields for more details.
  2157  	NullFields []string `json:"-"`
  2158  }
  2159  
  2160  func (s *WatchResponse) MarshalJSON() ([]byte, error) {
  2161  	type NoMethod WatchResponse
  2162  	return gensupport.MarshalJSON(NoMethod(*s), s.ForceSendFields, s.NullFields)
  2163  }
  2164  
  2165  type UsersGetProfileCall struct {
  2166  	s            *Service
  2167  	userId       string
  2168  	urlParams_   gensupport.URLParams
  2169  	ifNoneMatch_ string
  2170  	ctx_         context.Context
  2171  	header_      http.Header
  2172  }
  2173  
  2174  // GetProfile: Gets the current user's Gmail profile.
  2175  //
  2176  //   - userId: The user's email address. The special value `me` can be used to
  2177  //     indicate the authenticated user.
  2178  func (r *UsersService) GetProfile(userId string) *UsersGetProfileCall {
  2179  	c := &UsersGetProfileCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2180  	c.userId = userId
  2181  	return c
  2182  }
  2183  
  2184  // TemporaryEeccBypass sets the optional parameter "temporaryEeccBypass":
  2185  func (c *UsersGetProfileCall) TemporaryEeccBypass(temporaryEeccBypass bool) *UsersGetProfileCall {
  2186  	c.urlParams_.Set("temporaryEeccBypass", fmt.Sprint(temporaryEeccBypass))
  2187  	return c
  2188  }
  2189  
  2190  // Fields allows partial responses to be retrieved. See
  2191  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  2192  // details.
  2193  func (c *UsersGetProfileCall) Fields(s ...googleapi.Field) *UsersGetProfileCall {
  2194  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2195  	return c
  2196  }
  2197  
  2198  // IfNoneMatch sets an optional parameter which makes the operation fail if the
  2199  // object's ETag matches the given value. This is useful for getting updates
  2200  // only after the object has changed since the last request.
  2201  func (c *UsersGetProfileCall) IfNoneMatch(entityTag string) *UsersGetProfileCall {
  2202  	c.ifNoneMatch_ = entityTag
  2203  	return c
  2204  }
  2205  
  2206  // Context sets the context to be used in this call's Do method.
  2207  func (c *UsersGetProfileCall) Context(ctx context.Context) *UsersGetProfileCall {
  2208  	c.ctx_ = ctx
  2209  	return c
  2210  }
  2211  
  2212  // Header returns a http.Header that can be modified by the caller to add
  2213  // headers to the request.
  2214  func (c *UsersGetProfileCall) Header() http.Header {
  2215  	if c.header_ == nil {
  2216  		c.header_ = make(http.Header)
  2217  	}
  2218  	return c.header_
  2219  }
  2220  
  2221  func (c *UsersGetProfileCall) doRequest(alt string) (*http.Response, error) {
  2222  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
  2223  	if c.ifNoneMatch_ != "" {
  2224  		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  2225  	}
  2226  	var body io.Reader = nil
  2227  	c.urlParams_.Set("alt", alt)
  2228  	c.urlParams_.Set("prettyPrint", "false")
  2229  	urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/profile")
  2230  	urls += "?" + c.urlParams_.Encode()
  2231  	req, err := http.NewRequest("GET", urls, body)
  2232  	if err != nil {
  2233  		return nil, err
  2234  	}
  2235  	req.Header = reqHeaders
  2236  	googleapi.Expand(req.URL, map[string]string{
  2237  		"userId": c.userId,
  2238  	})
  2239  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2240  }
  2241  
  2242  // Do executes the "gmail.users.getProfile" call.
  2243  // Any non-2xx status code is an error. Response headers are in either
  2244  // *Profile.ServerResponse.Header or (if a response was returned at all) in
  2245  // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  2246  // whether the returned error was because http.StatusNotModified was returned.
  2247  func (c *UsersGetProfileCall) Do(opts ...googleapi.CallOption) (*Profile, error) {
  2248  	gensupport.SetOptions(c.urlParams_, opts...)
  2249  	res, err := c.doRequest("json")
  2250  	if res != nil && res.StatusCode == http.StatusNotModified {
  2251  		if res.Body != nil {
  2252  			res.Body.Close()
  2253  		}
  2254  		return nil, gensupport.WrapError(&googleapi.Error{
  2255  			Code:   res.StatusCode,
  2256  			Header: res.Header,
  2257  		})
  2258  	}
  2259  	if err != nil {
  2260  		return nil, err
  2261  	}
  2262  	defer googleapi.CloseBody(res)
  2263  	if err := googleapi.CheckResponse(res); err != nil {
  2264  		return nil, gensupport.WrapError(err)
  2265  	}
  2266  	ret := &Profile{
  2267  		ServerResponse: googleapi.ServerResponse{
  2268  			Header:         res.Header,
  2269  			HTTPStatusCode: res.StatusCode,
  2270  		},
  2271  	}
  2272  	target := &ret
  2273  	if err := gensupport.DecodeResponse(target, res); err != nil {
  2274  		return nil, err
  2275  	}
  2276  	return ret, nil
  2277  }
  2278  
  2279  type UsersStopCall struct {
  2280  	s          *Service
  2281  	userId     string
  2282  	urlParams_ gensupport.URLParams
  2283  	ctx_       context.Context
  2284  	header_    http.Header
  2285  }
  2286  
  2287  // Stop: Stop receiving push notifications for the given user mailbox.
  2288  //
  2289  //   - userId: The user's email address. The special value `me` can be used to
  2290  //     indicate the authenticated user.
  2291  func (r *UsersService) Stop(userId string) *UsersStopCall {
  2292  	c := &UsersStopCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2293  	c.userId = userId
  2294  	return c
  2295  }
  2296  
  2297  // Fields allows partial responses to be retrieved. See
  2298  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  2299  // details.
  2300  func (c *UsersStopCall) Fields(s ...googleapi.Field) *UsersStopCall {
  2301  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2302  	return c
  2303  }
  2304  
  2305  // Context sets the context to be used in this call's Do method.
  2306  func (c *UsersStopCall) Context(ctx context.Context) *UsersStopCall {
  2307  	c.ctx_ = ctx
  2308  	return c
  2309  }
  2310  
  2311  // Header returns a http.Header that can be modified by the caller to add
  2312  // headers to the request.
  2313  func (c *UsersStopCall) Header() http.Header {
  2314  	if c.header_ == nil {
  2315  		c.header_ = make(http.Header)
  2316  	}
  2317  	return c.header_
  2318  }
  2319  
  2320  func (c *UsersStopCall) doRequest(alt string) (*http.Response, error) {
  2321  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
  2322  	var body io.Reader = nil
  2323  	c.urlParams_.Set("alt", alt)
  2324  	c.urlParams_.Set("prettyPrint", "false")
  2325  	urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/stop")
  2326  	urls += "?" + c.urlParams_.Encode()
  2327  	req, err := http.NewRequest("POST", urls, body)
  2328  	if err != nil {
  2329  		return nil, err
  2330  	}
  2331  	req.Header = reqHeaders
  2332  	googleapi.Expand(req.URL, map[string]string{
  2333  		"userId": c.userId,
  2334  	})
  2335  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2336  }
  2337  
  2338  // Do executes the "gmail.users.stop" call.
  2339  func (c *UsersStopCall) Do(opts ...googleapi.CallOption) error {
  2340  	gensupport.SetOptions(c.urlParams_, opts...)
  2341  	res, err := c.doRequest("json")
  2342  	if err != nil {
  2343  		return err
  2344  	}
  2345  	defer googleapi.CloseBody(res)
  2346  	if err := googleapi.CheckResponse(res); err != nil {
  2347  		return gensupport.WrapError(err)
  2348  	}
  2349  	return nil
  2350  }
  2351  
  2352  type UsersWatchCall struct {
  2353  	s            *Service
  2354  	userId       string
  2355  	watchrequest *WatchRequest
  2356  	urlParams_   gensupport.URLParams
  2357  	ctx_         context.Context
  2358  	header_      http.Header
  2359  }
  2360  
  2361  // Watch: Set up or update a push notification watch on the given user mailbox.
  2362  //
  2363  //   - userId: The user's email address. The special value `me` can be used to
  2364  //     indicate the authenticated user.
  2365  func (r *UsersService) Watch(userId string, watchrequest *WatchRequest) *UsersWatchCall {
  2366  	c := &UsersWatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2367  	c.userId = userId
  2368  	c.watchrequest = watchrequest
  2369  	return c
  2370  }
  2371  
  2372  // Fields allows partial responses to be retrieved. See
  2373  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  2374  // details.
  2375  func (c *UsersWatchCall) Fields(s ...googleapi.Field) *UsersWatchCall {
  2376  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2377  	return c
  2378  }
  2379  
  2380  // Context sets the context to be used in this call's Do method.
  2381  func (c *UsersWatchCall) Context(ctx context.Context) *UsersWatchCall {
  2382  	c.ctx_ = ctx
  2383  	return c
  2384  }
  2385  
  2386  // Header returns a http.Header that can be modified by the caller to add
  2387  // headers to the request.
  2388  func (c *UsersWatchCall) Header() http.Header {
  2389  	if c.header_ == nil {
  2390  		c.header_ = make(http.Header)
  2391  	}
  2392  	return c.header_
  2393  }
  2394  
  2395  func (c *UsersWatchCall) doRequest(alt string) (*http.Response, error) {
  2396  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
  2397  	var body io.Reader = nil
  2398  	body, err := googleapi.WithoutDataWrapper.JSONReader(c.watchrequest)
  2399  	if err != nil {
  2400  		return nil, err
  2401  	}
  2402  	c.urlParams_.Set("alt", alt)
  2403  	c.urlParams_.Set("prettyPrint", "false")
  2404  	urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/watch")
  2405  	urls += "?" + c.urlParams_.Encode()
  2406  	req, err := http.NewRequest("POST", urls, body)
  2407  	if err != nil {
  2408  		return nil, err
  2409  	}
  2410  	req.Header = reqHeaders
  2411  	googleapi.Expand(req.URL, map[string]string{
  2412  		"userId": c.userId,
  2413  	})
  2414  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2415  }
  2416  
  2417  // Do executes the "gmail.users.watch" call.
  2418  // Any non-2xx status code is an error. Response headers are in either
  2419  // *WatchResponse.ServerResponse.Header or (if a response was returned at all)
  2420  // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  2421  // whether the returned error was because http.StatusNotModified was returned.
  2422  func (c *UsersWatchCall) Do(opts ...googleapi.CallOption) (*WatchResponse, error) {
  2423  	gensupport.SetOptions(c.urlParams_, opts...)
  2424  	res, err := c.doRequest("json")
  2425  	if res != nil && res.StatusCode == http.StatusNotModified {
  2426  		if res.Body != nil {
  2427  			res.Body.Close()
  2428  		}
  2429  		return nil, gensupport.WrapError(&googleapi.Error{
  2430  			Code:   res.StatusCode,
  2431  			Header: res.Header,
  2432  		})
  2433  	}
  2434  	if err != nil {
  2435  		return nil, err
  2436  	}
  2437  	defer googleapi.CloseBody(res)
  2438  	if err := googleapi.CheckResponse(res); err != nil {
  2439  		return nil, gensupport.WrapError(err)
  2440  	}
  2441  	ret := &WatchResponse{
  2442  		ServerResponse: googleapi.ServerResponse{
  2443  			Header:         res.Header,
  2444  			HTTPStatusCode: res.StatusCode,
  2445  		},
  2446  	}
  2447  	target := &ret
  2448  	if err := gensupport.DecodeResponse(target, res); err != nil {
  2449  		return nil, err
  2450  	}
  2451  	return ret, nil
  2452  }
  2453  
  2454  type UsersDraftsCreateCall struct {
  2455  	s          *Service
  2456  	userId     string
  2457  	draft      *Draft
  2458  	urlParams_ gensupport.URLParams
  2459  	mediaInfo_ *gensupport.MediaInfo
  2460  	ctx_       context.Context
  2461  	header_    http.Header
  2462  }
  2463  
  2464  // Create: Creates a new draft with the `DRAFT` label.
  2465  //
  2466  //   - userId: The user's email address. The special value `me` can be used to
  2467  //     indicate the authenticated user.
  2468  func (r *UsersDraftsService) Create(userId string, draft *Draft) *UsersDraftsCreateCall {
  2469  	c := &UsersDraftsCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2470  	c.userId = userId
  2471  	c.draft = draft
  2472  	return c
  2473  }
  2474  
  2475  // Media specifies the media to upload in one or more chunks. The chunk size
  2476  // may be controlled by supplying a MediaOption generated by
  2477  // googleapi.ChunkSize. The chunk size defaults to
  2478  // googleapi.DefaultUploadChunkSize.The Content-Type header used in the upload
  2479  // request will be determined by sniffing the contents of r, unless a
  2480  // MediaOption generated by googleapi.ContentType is supplied.
  2481  // At most one of Media and ResumableMedia may be set.
  2482  func (c *UsersDraftsCreateCall) Media(r io.Reader, options ...googleapi.MediaOption) *UsersDraftsCreateCall {
  2483  	c.mediaInfo_ = gensupport.NewInfoFromMedia(r, options)
  2484  	return c
  2485  }
  2486  
  2487  // ResumableMedia specifies the media to upload in chunks and can be canceled
  2488  // with ctx.
  2489  //
  2490  // Deprecated: use Media instead.
  2491  //
  2492  // At most one of Media and ResumableMedia may be set. mediaType identifies the
  2493  // MIME media type of the upload, such as "image/png". If mediaType is "", it
  2494  // will be auto-detected. The provided ctx will supersede any context
  2495  // previously provided to the Context method.
  2496  func (c *UsersDraftsCreateCall) ResumableMedia(ctx context.Context, r io.ReaderAt, size int64, mediaType string) *UsersDraftsCreateCall {
  2497  	c.ctx_ = ctx
  2498  	c.mediaInfo_ = gensupport.NewInfoFromResumableMedia(r, size, mediaType)
  2499  	return c
  2500  }
  2501  
  2502  // ProgressUpdater provides a callback function that will be called after every
  2503  // chunk. It should be a low-latency function in order to not slow down the
  2504  // upload operation. This should only be called when using ResumableMedia (as
  2505  // opposed to Media).
  2506  func (c *UsersDraftsCreateCall) ProgressUpdater(pu googleapi.ProgressUpdater) *UsersDraftsCreateCall {
  2507  	c.mediaInfo_.SetProgressUpdater(pu)
  2508  	return c
  2509  }
  2510  
  2511  // Fields allows partial responses to be retrieved. See
  2512  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  2513  // details.
  2514  func (c *UsersDraftsCreateCall) Fields(s ...googleapi.Field) *UsersDraftsCreateCall {
  2515  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2516  	return c
  2517  }
  2518  
  2519  // Context sets the context to be used in this call's Do method.
  2520  // This context will supersede any context previously provided to the
  2521  // ResumableMedia method.
  2522  func (c *UsersDraftsCreateCall) Context(ctx context.Context) *UsersDraftsCreateCall {
  2523  	c.ctx_ = ctx
  2524  	return c
  2525  }
  2526  
  2527  // Header returns a http.Header that can be modified by the caller to add
  2528  // headers to the request.
  2529  func (c *UsersDraftsCreateCall) Header() http.Header {
  2530  	if c.header_ == nil {
  2531  		c.header_ = make(http.Header)
  2532  	}
  2533  	return c.header_
  2534  }
  2535  
  2536  func (c *UsersDraftsCreateCall) doRequest(alt string) (*http.Response, error) {
  2537  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
  2538  	var body io.Reader = nil
  2539  	body, err := googleapi.WithoutDataWrapper.JSONReader(c.draft)
  2540  	if err != nil {
  2541  		return nil, err
  2542  	}
  2543  	c.urlParams_.Set("alt", alt)
  2544  	c.urlParams_.Set("prettyPrint", "false")
  2545  	urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/drafts")
  2546  	if c.mediaInfo_ != nil {
  2547  		urls = googleapi.ResolveRelative(c.s.BasePath, "/upload/gmail/v1/users/{userId}/drafts")
  2548  		c.urlParams_.Set("uploadType", c.mediaInfo_.UploadType())
  2549  	}
  2550  	if body == nil {
  2551  		body = new(bytes.Buffer)
  2552  		reqHeaders.Set("Content-Type", "application/json")
  2553  	}
  2554  	body, getBody, cleanup := c.mediaInfo_.UploadRequest(reqHeaders, body)
  2555  	defer cleanup()
  2556  	urls += "?" + c.urlParams_.Encode()
  2557  	req, err := http.NewRequest("POST", urls, body)
  2558  	if err != nil {
  2559  		return nil, err
  2560  	}
  2561  	req.Header = reqHeaders
  2562  	req.GetBody = getBody
  2563  	googleapi.Expand(req.URL, map[string]string{
  2564  		"userId": c.userId,
  2565  	})
  2566  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2567  }
  2568  
  2569  // Do executes the "gmail.users.drafts.create" call.
  2570  // Any non-2xx status code is an error. Response headers are in either
  2571  // *Draft.ServerResponse.Header or (if a response was returned at all) in
  2572  // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  2573  // whether the returned error was because http.StatusNotModified was returned.
  2574  func (c *UsersDraftsCreateCall) Do(opts ...googleapi.CallOption) (*Draft, error) {
  2575  	gensupport.SetOptions(c.urlParams_, opts...)
  2576  	res, err := c.doRequest("json")
  2577  	if res != nil && res.StatusCode == http.StatusNotModified {
  2578  		if res.Body != nil {
  2579  			res.Body.Close()
  2580  		}
  2581  		return nil, gensupport.WrapError(&googleapi.Error{
  2582  			Code:   res.StatusCode,
  2583  			Header: res.Header,
  2584  		})
  2585  	}
  2586  	if err != nil {
  2587  		return nil, err
  2588  	}
  2589  	defer googleapi.CloseBody(res)
  2590  	if err := googleapi.CheckResponse(res); err != nil {
  2591  		return nil, gensupport.WrapError(err)
  2592  	}
  2593  	rx := c.mediaInfo_.ResumableUpload(res.Header.Get("Location"))
  2594  	if rx != nil {
  2595  		rx.Client = c.s.client
  2596  		rx.UserAgent = c.s.userAgent()
  2597  		ctx := c.ctx_
  2598  		if ctx == nil {
  2599  			ctx = context.TODO()
  2600  		}
  2601  		res, err = rx.Upload(ctx)
  2602  		if err != nil {
  2603  			return nil, err
  2604  		}
  2605  		defer res.Body.Close()
  2606  		if err := googleapi.CheckResponse(res); err != nil {
  2607  			return nil, gensupport.WrapError(err)
  2608  		}
  2609  	}
  2610  	ret := &Draft{
  2611  		ServerResponse: googleapi.ServerResponse{
  2612  			Header:         res.Header,
  2613  			HTTPStatusCode: res.StatusCode,
  2614  		},
  2615  	}
  2616  	target := &ret
  2617  	if err := gensupport.DecodeResponse(target, res); err != nil {
  2618  		return nil, err
  2619  	}
  2620  	return ret, nil
  2621  }
  2622  
  2623  type UsersDraftsDeleteCall struct {
  2624  	s          *Service
  2625  	userId     string
  2626  	id         string
  2627  	urlParams_ gensupport.URLParams
  2628  	ctx_       context.Context
  2629  	header_    http.Header
  2630  }
  2631  
  2632  // Delete: Immediately and permanently deletes the specified draft. Does not
  2633  // simply trash it.
  2634  //
  2635  //   - id: The ID of the draft to delete.
  2636  //   - userId: The user's email address. The special value `me` can be used to
  2637  //     indicate the authenticated user.
  2638  func (r *UsersDraftsService) Delete(userId string, id string) *UsersDraftsDeleteCall {
  2639  	c := &UsersDraftsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2640  	c.userId = userId
  2641  	c.id = id
  2642  	return c
  2643  }
  2644  
  2645  // Fields allows partial responses to be retrieved. See
  2646  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  2647  // details.
  2648  func (c *UsersDraftsDeleteCall) Fields(s ...googleapi.Field) *UsersDraftsDeleteCall {
  2649  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2650  	return c
  2651  }
  2652  
  2653  // Context sets the context to be used in this call's Do method.
  2654  func (c *UsersDraftsDeleteCall) Context(ctx context.Context) *UsersDraftsDeleteCall {
  2655  	c.ctx_ = ctx
  2656  	return c
  2657  }
  2658  
  2659  // Header returns a http.Header that can be modified by the caller to add
  2660  // headers to the request.
  2661  func (c *UsersDraftsDeleteCall) Header() http.Header {
  2662  	if c.header_ == nil {
  2663  		c.header_ = make(http.Header)
  2664  	}
  2665  	return c.header_
  2666  }
  2667  
  2668  func (c *UsersDraftsDeleteCall) doRequest(alt string) (*http.Response, error) {
  2669  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
  2670  	var body io.Reader = nil
  2671  	c.urlParams_.Set("alt", alt)
  2672  	c.urlParams_.Set("prettyPrint", "false")
  2673  	urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/drafts/{id}")
  2674  	urls += "?" + c.urlParams_.Encode()
  2675  	req, err := http.NewRequest("DELETE", urls, body)
  2676  	if err != nil {
  2677  		return nil, err
  2678  	}
  2679  	req.Header = reqHeaders
  2680  	googleapi.Expand(req.URL, map[string]string{
  2681  		"userId": c.userId,
  2682  		"id":     c.id,
  2683  	})
  2684  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2685  }
  2686  
  2687  // Do executes the "gmail.users.drafts.delete" call.
  2688  func (c *UsersDraftsDeleteCall) Do(opts ...googleapi.CallOption) error {
  2689  	gensupport.SetOptions(c.urlParams_, opts...)
  2690  	res, err := c.doRequest("json")
  2691  	if err != nil {
  2692  		return err
  2693  	}
  2694  	defer googleapi.CloseBody(res)
  2695  	if err := googleapi.CheckResponse(res); err != nil {
  2696  		return gensupport.WrapError(err)
  2697  	}
  2698  	return nil
  2699  }
  2700  
  2701  type UsersDraftsGetCall struct {
  2702  	s            *Service
  2703  	userId       string
  2704  	id           string
  2705  	urlParams_   gensupport.URLParams
  2706  	ifNoneMatch_ string
  2707  	ctx_         context.Context
  2708  	header_      http.Header
  2709  }
  2710  
  2711  // Get: Gets the specified draft.
  2712  //
  2713  //   - id: The ID of the draft to retrieve.
  2714  //   - userId: The user's email address. The special value `me` can be used to
  2715  //     indicate the authenticated user.
  2716  func (r *UsersDraftsService) Get(userId string, id string) *UsersDraftsGetCall {
  2717  	c := &UsersDraftsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2718  	c.userId = userId
  2719  	c.id = id
  2720  	return c
  2721  }
  2722  
  2723  // Format sets the optional parameter "format": The format to return the draft
  2724  // in.
  2725  //
  2726  // Possible values:
  2727  //
  2728  //	"minimal" - Returns only email message ID and labels; does not return the
  2729  //
  2730  // email headers, body, or payload.
  2731  //
  2732  //	"full" (default) - Returns the full email message data with body content
  2733  //
  2734  // parsed in the `payload` field; the `raw` field is not used. Format cannot be
  2735  // used when accessing the api using the gmail.metadata scope.
  2736  //
  2737  //	"raw" - Returns the full email message data with body content in the `raw`
  2738  //
  2739  // field as a base64url encoded string; the `payload` field is not used. Format
  2740  // cannot be used when accessing the api using the gmail.metadata scope.
  2741  //
  2742  //	"metadata" - Returns only email message ID, labels, and email headers.
  2743  func (c *UsersDraftsGetCall) Format(format string) *UsersDraftsGetCall {
  2744  	c.urlParams_.Set("format", format)
  2745  	return c
  2746  }
  2747  
  2748  // Fields allows partial responses to be retrieved. See
  2749  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  2750  // details.
  2751  func (c *UsersDraftsGetCall) Fields(s ...googleapi.Field) *UsersDraftsGetCall {
  2752  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2753  	return c
  2754  }
  2755  
  2756  // IfNoneMatch sets an optional parameter which makes the operation fail if the
  2757  // object's ETag matches the given value. This is useful for getting updates
  2758  // only after the object has changed since the last request.
  2759  func (c *UsersDraftsGetCall) IfNoneMatch(entityTag string) *UsersDraftsGetCall {
  2760  	c.ifNoneMatch_ = entityTag
  2761  	return c
  2762  }
  2763  
  2764  // Context sets the context to be used in this call's Do method.
  2765  func (c *UsersDraftsGetCall) Context(ctx context.Context) *UsersDraftsGetCall {
  2766  	c.ctx_ = ctx
  2767  	return c
  2768  }
  2769  
  2770  // Header returns a http.Header that can be modified by the caller to add
  2771  // headers to the request.
  2772  func (c *UsersDraftsGetCall) Header() http.Header {
  2773  	if c.header_ == nil {
  2774  		c.header_ = make(http.Header)
  2775  	}
  2776  	return c.header_
  2777  }
  2778  
  2779  func (c *UsersDraftsGetCall) doRequest(alt string) (*http.Response, error) {
  2780  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
  2781  	if c.ifNoneMatch_ != "" {
  2782  		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  2783  	}
  2784  	var body io.Reader = nil
  2785  	c.urlParams_.Set("alt", alt)
  2786  	c.urlParams_.Set("prettyPrint", "false")
  2787  	urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/drafts/{id}")
  2788  	urls += "?" + c.urlParams_.Encode()
  2789  	req, err := http.NewRequest("GET", urls, body)
  2790  	if err != nil {
  2791  		return nil, err
  2792  	}
  2793  	req.Header = reqHeaders
  2794  	googleapi.Expand(req.URL, map[string]string{
  2795  		"userId": c.userId,
  2796  		"id":     c.id,
  2797  	})
  2798  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2799  }
  2800  
  2801  // Do executes the "gmail.users.drafts.get" call.
  2802  // Any non-2xx status code is an error. Response headers are in either
  2803  // *Draft.ServerResponse.Header or (if a response was returned at all) in
  2804  // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  2805  // whether the returned error was because http.StatusNotModified was returned.
  2806  func (c *UsersDraftsGetCall) Do(opts ...googleapi.CallOption) (*Draft, error) {
  2807  	gensupport.SetOptions(c.urlParams_, opts...)
  2808  	res, err := c.doRequest("json")
  2809  	if res != nil && res.StatusCode == http.StatusNotModified {
  2810  		if res.Body != nil {
  2811  			res.Body.Close()
  2812  		}
  2813  		return nil, gensupport.WrapError(&googleapi.Error{
  2814  			Code:   res.StatusCode,
  2815  			Header: res.Header,
  2816  		})
  2817  	}
  2818  	if err != nil {
  2819  		return nil, err
  2820  	}
  2821  	defer googleapi.CloseBody(res)
  2822  	if err := googleapi.CheckResponse(res); err != nil {
  2823  		return nil, gensupport.WrapError(err)
  2824  	}
  2825  	ret := &Draft{
  2826  		ServerResponse: googleapi.ServerResponse{
  2827  			Header:         res.Header,
  2828  			HTTPStatusCode: res.StatusCode,
  2829  		},
  2830  	}
  2831  	target := &ret
  2832  	if err := gensupport.DecodeResponse(target, res); err != nil {
  2833  		return nil, err
  2834  	}
  2835  	return ret, nil
  2836  }
  2837  
  2838  type UsersDraftsListCall struct {
  2839  	s            *Service
  2840  	userId       string
  2841  	urlParams_   gensupport.URLParams
  2842  	ifNoneMatch_ string
  2843  	ctx_         context.Context
  2844  	header_      http.Header
  2845  }
  2846  
  2847  // List: Lists the drafts in the user's mailbox.
  2848  //
  2849  //   - userId: The user's email address. The special value `me` can be used to
  2850  //     indicate the authenticated user.
  2851  func (r *UsersDraftsService) List(userId string) *UsersDraftsListCall {
  2852  	c := &UsersDraftsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2853  	c.userId = userId
  2854  	return c
  2855  }
  2856  
  2857  // IncludeSpamTrash sets the optional parameter "includeSpamTrash": Include
  2858  // drafts from `SPAM` and `TRASH` in the results.
  2859  func (c *UsersDraftsListCall) IncludeSpamTrash(includeSpamTrash bool) *UsersDraftsListCall {
  2860  	c.urlParams_.Set("includeSpamTrash", fmt.Sprint(includeSpamTrash))
  2861  	return c
  2862  }
  2863  
  2864  // MaxResults sets the optional parameter "maxResults": Maximum number of
  2865  // drafts to return. This field defaults to 100. The maximum allowed value for
  2866  // this field is 500.
  2867  func (c *UsersDraftsListCall) MaxResults(maxResults int64) *UsersDraftsListCall {
  2868  	c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
  2869  	return c
  2870  }
  2871  
  2872  // PageToken sets the optional parameter "pageToken": Page token to retrieve a
  2873  // specific page of results in the list.
  2874  func (c *UsersDraftsListCall) PageToken(pageToken string) *UsersDraftsListCall {
  2875  	c.urlParams_.Set("pageToken", pageToken)
  2876  	return c
  2877  }
  2878  
  2879  // Q sets the optional parameter "q": Only return draft messages matching the
  2880  // specified query. Supports the same query format as the Gmail search box. For
  2881  // example, "from:someuser@example.com rfc822msgid: is:unread".
  2882  func (c *UsersDraftsListCall) Q(q string) *UsersDraftsListCall {
  2883  	c.urlParams_.Set("q", q)
  2884  	return c
  2885  }
  2886  
  2887  // Fields allows partial responses to be retrieved. See
  2888  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  2889  // details.
  2890  func (c *UsersDraftsListCall) Fields(s ...googleapi.Field) *UsersDraftsListCall {
  2891  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2892  	return c
  2893  }
  2894  
  2895  // IfNoneMatch sets an optional parameter which makes the operation fail if the
  2896  // object's ETag matches the given value. This is useful for getting updates
  2897  // only after the object has changed since the last request.
  2898  func (c *UsersDraftsListCall) IfNoneMatch(entityTag string) *UsersDraftsListCall {
  2899  	c.ifNoneMatch_ = entityTag
  2900  	return c
  2901  }
  2902  
  2903  // Context sets the context to be used in this call's Do method.
  2904  func (c *UsersDraftsListCall) Context(ctx context.Context) *UsersDraftsListCall {
  2905  	c.ctx_ = ctx
  2906  	return c
  2907  }
  2908  
  2909  // Header returns a http.Header that can be modified by the caller to add
  2910  // headers to the request.
  2911  func (c *UsersDraftsListCall) Header() http.Header {
  2912  	if c.header_ == nil {
  2913  		c.header_ = make(http.Header)
  2914  	}
  2915  	return c.header_
  2916  }
  2917  
  2918  func (c *UsersDraftsListCall) doRequest(alt string) (*http.Response, error) {
  2919  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
  2920  	if c.ifNoneMatch_ != "" {
  2921  		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  2922  	}
  2923  	var body io.Reader = nil
  2924  	c.urlParams_.Set("alt", alt)
  2925  	c.urlParams_.Set("prettyPrint", "false")
  2926  	urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/drafts")
  2927  	urls += "?" + c.urlParams_.Encode()
  2928  	req, err := http.NewRequest("GET", urls, body)
  2929  	if err != nil {
  2930  		return nil, err
  2931  	}
  2932  	req.Header = reqHeaders
  2933  	googleapi.Expand(req.URL, map[string]string{
  2934  		"userId": c.userId,
  2935  	})
  2936  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2937  }
  2938  
  2939  // Do executes the "gmail.users.drafts.list" call.
  2940  // Any non-2xx status code is an error. Response headers are in either
  2941  // *ListDraftsResponse.ServerResponse.Header or (if a response was returned at
  2942  // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  2943  // check whether the returned error was because http.StatusNotModified was
  2944  // returned.
  2945  func (c *UsersDraftsListCall) Do(opts ...googleapi.CallOption) (*ListDraftsResponse, error) {
  2946  	gensupport.SetOptions(c.urlParams_, opts...)
  2947  	res, err := c.doRequest("json")
  2948  	if res != nil && res.StatusCode == http.StatusNotModified {
  2949  		if res.Body != nil {
  2950  			res.Body.Close()
  2951  		}
  2952  		return nil, gensupport.WrapError(&googleapi.Error{
  2953  			Code:   res.StatusCode,
  2954  			Header: res.Header,
  2955  		})
  2956  	}
  2957  	if err != nil {
  2958  		return nil, err
  2959  	}
  2960  	defer googleapi.CloseBody(res)
  2961  	if err := googleapi.CheckResponse(res); err != nil {
  2962  		return nil, gensupport.WrapError(err)
  2963  	}
  2964  	ret := &ListDraftsResponse{
  2965  		ServerResponse: googleapi.ServerResponse{
  2966  			Header:         res.Header,
  2967  			HTTPStatusCode: res.StatusCode,
  2968  		},
  2969  	}
  2970  	target := &ret
  2971  	if err := gensupport.DecodeResponse(target, res); err != nil {
  2972  		return nil, err
  2973  	}
  2974  	return ret, nil
  2975  }
  2976  
  2977  // Pages invokes f for each page of results.
  2978  // A non-nil error returned from f will halt the iteration.
  2979  // The provided context supersedes any context provided to the Context method.
  2980  func (c *UsersDraftsListCall) Pages(ctx context.Context, f func(*ListDraftsResponse) error) error {
  2981  	c.ctx_ = ctx
  2982  	defer c.PageToken(c.urlParams_.Get("pageToken"))
  2983  	for {
  2984  		x, err := c.Do()
  2985  		if err != nil {
  2986  			return err
  2987  		}
  2988  		if err := f(x); err != nil {
  2989  			return err
  2990  		}
  2991  		if x.NextPageToken == "" {
  2992  			return nil
  2993  		}
  2994  		c.PageToken(x.NextPageToken)
  2995  	}
  2996  }
  2997  
  2998  type UsersDraftsSendCall struct {
  2999  	s          *Service
  3000  	userId     string
  3001  	draft      *Draft
  3002  	urlParams_ gensupport.URLParams
  3003  	mediaInfo_ *gensupport.MediaInfo
  3004  	ctx_       context.Context
  3005  	header_    http.Header
  3006  }
  3007  
  3008  // Send: Sends the specified, existing draft to the recipients in the `To`,
  3009  // `Cc`, and `Bcc` headers.
  3010  //
  3011  //   - userId: The user's email address. The special value `me` can be used to
  3012  //     indicate the authenticated user.
  3013  func (r *UsersDraftsService) Send(userId string, draft *Draft) *UsersDraftsSendCall {
  3014  	c := &UsersDraftsSendCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3015  	c.userId = userId
  3016  	c.draft = draft
  3017  	return c
  3018  }
  3019  
  3020  // Media specifies the media to upload in one or more chunks. The chunk size
  3021  // may be controlled by supplying a MediaOption generated by
  3022  // googleapi.ChunkSize. The chunk size defaults to
  3023  // googleapi.DefaultUploadChunkSize.The Content-Type header used in the upload
  3024  // request will be determined by sniffing the contents of r, unless a
  3025  // MediaOption generated by googleapi.ContentType is supplied.
  3026  // At most one of Media and ResumableMedia may be set.
  3027  func (c *UsersDraftsSendCall) Media(r io.Reader, options ...googleapi.MediaOption) *UsersDraftsSendCall {
  3028  	c.mediaInfo_ = gensupport.NewInfoFromMedia(r, options)
  3029  	return c
  3030  }
  3031  
  3032  // ResumableMedia specifies the media to upload in chunks and can be canceled
  3033  // with ctx.
  3034  //
  3035  // Deprecated: use Media instead.
  3036  //
  3037  // At most one of Media and ResumableMedia may be set. mediaType identifies the
  3038  // MIME media type of the upload, such as "image/png". If mediaType is "", it
  3039  // will be auto-detected. The provided ctx will supersede any context
  3040  // previously provided to the Context method.
  3041  func (c *UsersDraftsSendCall) ResumableMedia(ctx context.Context, r io.ReaderAt, size int64, mediaType string) *UsersDraftsSendCall {
  3042  	c.ctx_ = ctx
  3043  	c.mediaInfo_ = gensupport.NewInfoFromResumableMedia(r, size, mediaType)
  3044  	return c
  3045  }
  3046  
  3047  // ProgressUpdater provides a callback function that will be called after every
  3048  // chunk. It should be a low-latency function in order to not slow down the
  3049  // upload operation. This should only be called when using ResumableMedia (as
  3050  // opposed to Media).
  3051  func (c *UsersDraftsSendCall) ProgressUpdater(pu googleapi.ProgressUpdater) *UsersDraftsSendCall {
  3052  	c.mediaInfo_.SetProgressUpdater(pu)
  3053  	return c
  3054  }
  3055  
  3056  // Fields allows partial responses to be retrieved. See
  3057  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  3058  // details.
  3059  func (c *UsersDraftsSendCall) Fields(s ...googleapi.Field) *UsersDraftsSendCall {
  3060  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3061  	return c
  3062  }
  3063  
  3064  // Context sets the context to be used in this call's Do method.
  3065  // This context will supersede any context previously provided to the
  3066  // ResumableMedia method.
  3067  func (c *UsersDraftsSendCall) Context(ctx context.Context) *UsersDraftsSendCall {
  3068  	c.ctx_ = ctx
  3069  	return c
  3070  }
  3071  
  3072  // Header returns a http.Header that can be modified by the caller to add
  3073  // headers to the request.
  3074  func (c *UsersDraftsSendCall) Header() http.Header {
  3075  	if c.header_ == nil {
  3076  		c.header_ = make(http.Header)
  3077  	}
  3078  	return c.header_
  3079  }
  3080  
  3081  func (c *UsersDraftsSendCall) doRequest(alt string) (*http.Response, error) {
  3082  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
  3083  	var body io.Reader = nil
  3084  	body, err := googleapi.WithoutDataWrapper.JSONReader(c.draft)
  3085  	if err != nil {
  3086  		return nil, err
  3087  	}
  3088  	c.urlParams_.Set("alt", alt)
  3089  	c.urlParams_.Set("prettyPrint", "false")
  3090  	urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/drafts/send")
  3091  	if c.mediaInfo_ != nil {
  3092  		urls = googleapi.ResolveRelative(c.s.BasePath, "/upload/gmail/v1/users/{userId}/drafts/send")
  3093  		c.urlParams_.Set("uploadType", c.mediaInfo_.UploadType())
  3094  	}
  3095  	if body == nil {
  3096  		body = new(bytes.Buffer)
  3097  		reqHeaders.Set("Content-Type", "application/json")
  3098  	}
  3099  	body, getBody, cleanup := c.mediaInfo_.UploadRequest(reqHeaders, body)
  3100  	defer cleanup()
  3101  	urls += "?" + c.urlParams_.Encode()
  3102  	req, err := http.NewRequest("POST", urls, body)
  3103  	if err != nil {
  3104  		return nil, err
  3105  	}
  3106  	req.Header = reqHeaders
  3107  	req.GetBody = getBody
  3108  	googleapi.Expand(req.URL, map[string]string{
  3109  		"userId": c.userId,
  3110  	})
  3111  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3112  }
  3113  
  3114  // Do executes the "gmail.users.drafts.send" call.
  3115  // Any non-2xx status code is an error. Response headers are in either
  3116  // *Message.ServerResponse.Header or (if a response was returned at all) in
  3117  // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  3118  // whether the returned error was because http.StatusNotModified was returned.
  3119  func (c *UsersDraftsSendCall) Do(opts ...googleapi.CallOption) (*Message, error) {
  3120  	gensupport.SetOptions(c.urlParams_, opts...)
  3121  	res, err := c.doRequest("json")
  3122  	if res != nil && res.StatusCode == http.StatusNotModified {
  3123  		if res.Body != nil {
  3124  			res.Body.Close()
  3125  		}
  3126  		return nil, gensupport.WrapError(&googleapi.Error{
  3127  			Code:   res.StatusCode,
  3128  			Header: res.Header,
  3129  		})
  3130  	}
  3131  	if err != nil {
  3132  		return nil, err
  3133  	}
  3134  	defer googleapi.CloseBody(res)
  3135  	if err := googleapi.CheckResponse(res); err != nil {
  3136  		return nil, gensupport.WrapError(err)
  3137  	}
  3138  	rx := c.mediaInfo_.ResumableUpload(res.Header.Get("Location"))
  3139  	if rx != nil {
  3140  		rx.Client = c.s.client
  3141  		rx.UserAgent = c.s.userAgent()
  3142  		ctx := c.ctx_
  3143  		if ctx == nil {
  3144  			ctx = context.TODO()
  3145  		}
  3146  		res, err = rx.Upload(ctx)
  3147  		if err != nil {
  3148  			return nil, err
  3149  		}
  3150  		defer res.Body.Close()
  3151  		if err := googleapi.CheckResponse(res); err != nil {
  3152  			return nil, gensupport.WrapError(err)
  3153  		}
  3154  	}
  3155  	ret := &Message{
  3156  		ServerResponse: googleapi.ServerResponse{
  3157  			Header:         res.Header,
  3158  			HTTPStatusCode: res.StatusCode,
  3159  		},
  3160  	}
  3161  	target := &ret
  3162  	if err := gensupport.DecodeResponse(target, res); err != nil {
  3163  		return nil, err
  3164  	}
  3165  	return ret, nil
  3166  }
  3167  
  3168  type UsersDraftsUpdateCall struct {
  3169  	s          *Service
  3170  	userId     string
  3171  	id         string
  3172  	draft      *Draft
  3173  	urlParams_ gensupport.URLParams
  3174  	mediaInfo_ *gensupport.MediaInfo
  3175  	ctx_       context.Context
  3176  	header_    http.Header
  3177  }
  3178  
  3179  // Update: Replaces a draft's content.
  3180  //
  3181  //   - id: The ID of the draft to update.
  3182  //   - userId: The user's email address. The special value `me` can be used to
  3183  //     indicate the authenticated user.
  3184  func (r *UsersDraftsService) Update(userId string, id string, draft *Draft) *UsersDraftsUpdateCall {
  3185  	c := &UsersDraftsUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3186  	c.userId = userId
  3187  	c.id = id
  3188  	c.draft = draft
  3189  	return c
  3190  }
  3191  
  3192  // Media specifies the media to upload in one or more chunks. The chunk size
  3193  // may be controlled by supplying a MediaOption generated by
  3194  // googleapi.ChunkSize. The chunk size defaults to
  3195  // googleapi.DefaultUploadChunkSize.The Content-Type header used in the upload
  3196  // request will be determined by sniffing the contents of r, unless a
  3197  // MediaOption generated by googleapi.ContentType is supplied.
  3198  // At most one of Media and ResumableMedia may be set.
  3199  func (c *UsersDraftsUpdateCall) Media(r io.Reader, options ...googleapi.MediaOption) *UsersDraftsUpdateCall {
  3200  	c.mediaInfo_ = gensupport.NewInfoFromMedia(r, options)
  3201  	return c
  3202  }
  3203  
  3204  // ResumableMedia specifies the media to upload in chunks and can be canceled
  3205  // with ctx.
  3206  //
  3207  // Deprecated: use Media instead.
  3208  //
  3209  // At most one of Media and ResumableMedia may be set. mediaType identifies the
  3210  // MIME media type of the upload, such as "image/png". If mediaType is "", it
  3211  // will be auto-detected. The provided ctx will supersede any context
  3212  // previously provided to the Context method.
  3213  func (c *UsersDraftsUpdateCall) ResumableMedia(ctx context.Context, r io.ReaderAt, size int64, mediaType string) *UsersDraftsUpdateCall {
  3214  	c.ctx_ = ctx
  3215  	c.mediaInfo_ = gensupport.NewInfoFromResumableMedia(r, size, mediaType)
  3216  	return c
  3217  }
  3218  
  3219  // ProgressUpdater provides a callback function that will be called after every
  3220  // chunk. It should be a low-latency function in order to not slow down the
  3221  // upload operation. This should only be called when using ResumableMedia (as
  3222  // opposed to Media).
  3223  func (c *UsersDraftsUpdateCall) ProgressUpdater(pu googleapi.ProgressUpdater) *UsersDraftsUpdateCall {
  3224  	c.mediaInfo_.SetProgressUpdater(pu)
  3225  	return c
  3226  }
  3227  
  3228  // Fields allows partial responses to be retrieved. See
  3229  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  3230  // details.
  3231  func (c *UsersDraftsUpdateCall) Fields(s ...googleapi.Field) *UsersDraftsUpdateCall {
  3232  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3233  	return c
  3234  }
  3235  
  3236  // Context sets the context to be used in this call's Do method.
  3237  // This context will supersede any context previously provided to the
  3238  // ResumableMedia method.
  3239  func (c *UsersDraftsUpdateCall) Context(ctx context.Context) *UsersDraftsUpdateCall {
  3240  	c.ctx_ = ctx
  3241  	return c
  3242  }
  3243  
  3244  // Header returns a http.Header that can be modified by the caller to add
  3245  // headers to the request.
  3246  func (c *UsersDraftsUpdateCall) Header() http.Header {
  3247  	if c.header_ == nil {
  3248  		c.header_ = make(http.Header)
  3249  	}
  3250  	return c.header_
  3251  }
  3252  
  3253  func (c *UsersDraftsUpdateCall) doRequest(alt string) (*http.Response, error) {
  3254  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
  3255  	var body io.Reader = nil
  3256  	body, err := googleapi.WithoutDataWrapper.JSONReader(c.draft)
  3257  	if err != nil {
  3258  		return nil, err
  3259  	}
  3260  	c.urlParams_.Set("alt", alt)
  3261  	c.urlParams_.Set("prettyPrint", "false")
  3262  	urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/drafts/{id}")
  3263  	if c.mediaInfo_ != nil {
  3264  		urls = googleapi.ResolveRelative(c.s.BasePath, "/upload/gmail/v1/users/{userId}/drafts/{id}")
  3265  		c.urlParams_.Set("uploadType", c.mediaInfo_.UploadType())
  3266  	}
  3267  	if body == nil {
  3268  		body = new(bytes.Buffer)
  3269  		reqHeaders.Set("Content-Type", "application/json")
  3270  	}
  3271  	body, getBody, cleanup := c.mediaInfo_.UploadRequest(reqHeaders, body)
  3272  	defer cleanup()
  3273  	urls += "?" + c.urlParams_.Encode()
  3274  	req, err := http.NewRequest("PUT", urls, body)
  3275  	if err != nil {
  3276  		return nil, err
  3277  	}
  3278  	req.Header = reqHeaders
  3279  	req.GetBody = getBody
  3280  	googleapi.Expand(req.URL, map[string]string{
  3281  		"userId": c.userId,
  3282  		"id":     c.id,
  3283  	})
  3284  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3285  }
  3286  
  3287  // Do executes the "gmail.users.drafts.update" call.
  3288  // Any non-2xx status code is an error. Response headers are in either
  3289  // *Draft.ServerResponse.Header or (if a response was returned at all) in
  3290  // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  3291  // whether the returned error was because http.StatusNotModified was returned.
  3292  func (c *UsersDraftsUpdateCall) Do(opts ...googleapi.CallOption) (*Draft, error) {
  3293  	gensupport.SetOptions(c.urlParams_, opts...)
  3294  	res, err := c.doRequest("json")
  3295  	if res != nil && res.StatusCode == http.StatusNotModified {
  3296  		if res.Body != nil {
  3297  			res.Body.Close()
  3298  		}
  3299  		return nil, gensupport.WrapError(&googleapi.Error{
  3300  			Code:   res.StatusCode,
  3301  			Header: res.Header,
  3302  		})
  3303  	}
  3304  	if err != nil {
  3305  		return nil, err
  3306  	}
  3307  	defer googleapi.CloseBody(res)
  3308  	if err := googleapi.CheckResponse(res); err != nil {
  3309  		return nil, gensupport.WrapError(err)
  3310  	}
  3311  	rx := c.mediaInfo_.ResumableUpload(res.Header.Get("Location"))
  3312  	if rx != nil {
  3313  		rx.Client = c.s.client
  3314  		rx.UserAgent = c.s.userAgent()
  3315  		ctx := c.ctx_
  3316  		if ctx == nil {
  3317  			ctx = context.TODO()
  3318  		}
  3319  		res, err = rx.Upload(ctx)
  3320  		if err != nil {
  3321  			return nil, err
  3322  		}
  3323  		defer res.Body.Close()
  3324  		if err := googleapi.CheckResponse(res); err != nil {
  3325  			return nil, gensupport.WrapError(err)
  3326  		}
  3327  	}
  3328  	ret := &Draft{
  3329  		ServerResponse: googleapi.ServerResponse{
  3330  			Header:         res.Header,
  3331  			HTTPStatusCode: res.StatusCode,
  3332  		},
  3333  	}
  3334  	target := &ret
  3335  	if err := gensupport.DecodeResponse(target, res); err != nil {
  3336  		return nil, err
  3337  	}
  3338  	return ret, nil
  3339  }
  3340  
  3341  type UsersHistoryListCall struct {
  3342  	s            *Service
  3343  	userId       string
  3344  	urlParams_   gensupport.URLParams
  3345  	ifNoneMatch_ string
  3346  	ctx_         context.Context
  3347  	header_      http.Header
  3348  }
  3349  
  3350  // List: Lists the history of all changes to the given mailbox. History results
  3351  // are returned in chronological order (increasing `historyId`).
  3352  //
  3353  //   - userId: The user's email address. The special value `me` can be used to
  3354  //     indicate the authenticated user.
  3355  func (r *UsersHistoryService) List(userId string) *UsersHistoryListCall {
  3356  	c := &UsersHistoryListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3357  	c.userId = userId
  3358  	return c
  3359  }
  3360  
  3361  // HistoryTypes sets the optional parameter "historyTypes": History types to be
  3362  // returned by the function
  3363  //
  3364  // Possible values:
  3365  //
  3366  //	"messageAdded"
  3367  //	"messageDeleted"
  3368  //	"labelAdded"
  3369  //	"labelRemoved"
  3370  func (c *UsersHistoryListCall) HistoryTypes(historyTypes ...string) *UsersHistoryListCall {
  3371  	c.urlParams_.SetMulti("historyTypes", append([]string{}, historyTypes...))
  3372  	return c
  3373  }
  3374  
  3375  // LabelId sets the optional parameter "labelId": Only return messages with a
  3376  // label matching the ID.
  3377  func (c *UsersHistoryListCall) LabelId(labelId string) *UsersHistoryListCall {
  3378  	c.urlParams_.Set("labelId", labelId)
  3379  	return c
  3380  }
  3381  
  3382  // MaxResults sets the optional parameter "maxResults": Maximum number of
  3383  // history records to return. This field defaults to 100. The maximum allowed
  3384  // value for this field is 500.
  3385  func (c *UsersHistoryListCall) MaxResults(maxResults int64) *UsersHistoryListCall {
  3386  	c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
  3387  	return c
  3388  }
  3389  
  3390  // PageToken sets the optional parameter "pageToken": Page token to retrieve a
  3391  // specific page of results in the list.
  3392  func (c *UsersHistoryListCall) PageToken(pageToken string) *UsersHistoryListCall {
  3393  	c.urlParams_.Set("pageToken", pageToken)
  3394  	return c
  3395  }
  3396  
  3397  // StartHistoryId sets the optional parameter "startHistoryId": Required.
  3398  // Returns history records after the specified `startHistoryId`. The supplied
  3399  // `startHistoryId` should be obtained from the `historyId` of a message,
  3400  // thread, or previous `list` response. History IDs increase chronologically
  3401  // but are not contiguous with random gaps in between valid IDs. Supplying an
  3402  // invalid or out of date `startHistoryId` typically returns an `HTTP 404`
  3403  // error code. A `historyId` is typically valid for at least a week, but in
  3404  // some rare circumstances may be valid for only a few hours. If you receive an
  3405  // `HTTP 404` error response, your application should perform a full sync. If
  3406  // you receive no `nextPageToken` in the response, there are no updates to
  3407  // retrieve and you can store the returned `historyId` for a future request.
  3408  func (c *UsersHistoryListCall) StartHistoryId(startHistoryId uint64) *UsersHistoryListCall {
  3409  	c.urlParams_.Set("startHistoryId", fmt.Sprint(startHistoryId))
  3410  	return c
  3411  }
  3412  
  3413  // Fields allows partial responses to be retrieved. See
  3414  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  3415  // details.
  3416  func (c *UsersHistoryListCall) Fields(s ...googleapi.Field) *UsersHistoryListCall {
  3417  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3418  	return c
  3419  }
  3420  
  3421  // IfNoneMatch sets an optional parameter which makes the operation fail if the
  3422  // object's ETag matches the given value. This is useful for getting updates
  3423  // only after the object has changed since the last request.
  3424  func (c *UsersHistoryListCall) IfNoneMatch(entityTag string) *UsersHistoryListCall {
  3425  	c.ifNoneMatch_ = entityTag
  3426  	return c
  3427  }
  3428  
  3429  // Context sets the context to be used in this call's Do method.
  3430  func (c *UsersHistoryListCall) Context(ctx context.Context) *UsersHistoryListCall {
  3431  	c.ctx_ = ctx
  3432  	return c
  3433  }
  3434  
  3435  // Header returns a http.Header that can be modified by the caller to add
  3436  // headers to the request.
  3437  func (c *UsersHistoryListCall) Header() http.Header {
  3438  	if c.header_ == nil {
  3439  		c.header_ = make(http.Header)
  3440  	}
  3441  	return c.header_
  3442  }
  3443  
  3444  func (c *UsersHistoryListCall) doRequest(alt string) (*http.Response, error) {
  3445  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
  3446  	if c.ifNoneMatch_ != "" {
  3447  		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  3448  	}
  3449  	var body io.Reader = nil
  3450  	c.urlParams_.Set("alt", alt)
  3451  	c.urlParams_.Set("prettyPrint", "false")
  3452  	urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/history")
  3453  	urls += "?" + c.urlParams_.Encode()
  3454  	req, err := http.NewRequest("GET", urls, body)
  3455  	if err != nil {
  3456  		return nil, err
  3457  	}
  3458  	req.Header = reqHeaders
  3459  	googleapi.Expand(req.URL, map[string]string{
  3460  		"userId": c.userId,
  3461  	})
  3462  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3463  }
  3464  
  3465  // Do executes the "gmail.users.history.list" call.
  3466  // Any non-2xx status code is an error. Response headers are in either
  3467  // *ListHistoryResponse.ServerResponse.Header or (if a response was returned at
  3468  // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  3469  // check whether the returned error was because http.StatusNotModified was
  3470  // returned.
  3471  func (c *UsersHistoryListCall) Do(opts ...googleapi.CallOption) (*ListHistoryResponse, error) {
  3472  	gensupport.SetOptions(c.urlParams_, opts...)
  3473  	res, err := c.doRequest("json")
  3474  	if res != nil && res.StatusCode == http.StatusNotModified {
  3475  		if res.Body != nil {
  3476  			res.Body.Close()
  3477  		}
  3478  		return nil, gensupport.WrapError(&googleapi.Error{
  3479  			Code:   res.StatusCode,
  3480  			Header: res.Header,
  3481  		})
  3482  	}
  3483  	if err != nil {
  3484  		return nil, err
  3485  	}
  3486  	defer googleapi.CloseBody(res)
  3487  	if err := googleapi.CheckResponse(res); err != nil {
  3488  		return nil, gensupport.WrapError(err)
  3489  	}
  3490  	ret := &ListHistoryResponse{
  3491  		ServerResponse: googleapi.ServerResponse{
  3492  			Header:         res.Header,
  3493  			HTTPStatusCode: res.StatusCode,
  3494  		},
  3495  	}
  3496  	target := &ret
  3497  	if err := gensupport.DecodeResponse(target, res); err != nil {
  3498  		return nil, err
  3499  	}
  3500  	return ret, nil
  3501  }
  3502  
  3503  // Pages invokes f for each page of results.
  3504  // A non-nil error returned from f will halt the iteration.
  3505  // The provided context supersedes any context provided to the Context method.
  3506  func (c *UsersHistoryListCall) Pages(ctx context.Context, f func(*ListHistoryResponse) error) error {
  3507  	c.ctx_ = ctx
  3508  	defer c.PageToken(c.urlParams_.Get("pageToken"))
  3509  	for {
  3510  		x, err := c.Do()
  3511  		if err != nil {
  3512  			return err
  3513  		}
  3514  		if err := f(x); err != nil {
  3515  			return err
  3516  		}
  3517  		if x.NextPageToken == "" {
  3518  			return nil
  3519  		}
  3520  		c.PageToken(x.NextPageToken)
  3521  	}
  3522  }
  3523  
  3524  type UsersLabelsCreateCall struct {
  3525  	s          *Service
  3526  	userId     string
  3527  	label      *Label
  3528  	urlParams_ gensupport.URLParams
  3529  	ctx_       context.Context
  3530  	header_    http.Header
  3531  }
  3532  
  3533  // Create: Creates a new label.
  3534  //
  3535  //   - userId: The user's email address. The special value `me` can be used to
  3536  //     indicate the authenticated user.
  3537  func (r *UsersLabelsService) Create(userId string, label *Label) *UsersLabelsCreateCall {
  3538  	c := &UsersLabelsCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3539  	c.userId = userId
  3540  	c.label = label
  3541  	return c
  3542  }
  3543  
  3544  // Fields allows partial responses to be retrieved. See
  3545  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  3546  // details.
  3547  func (c *UsersLabelsCreateCall) Fields(s ...googleapi.Field) *UsersLabelsCreateCall {
  3548  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3549  	return c
  3550  }
  3551  
  3552  // Context sets the context to be used in this call's Do method.
  3553  func (c *UsersLabelsCreateCall) Context(ctx context.Context) *UsersLabelsCreateCall {
  3554  	c.ctx_ = ctx
  3555  	return c
  3556  }
  3557  
  3558  // Header returns a http.Header that can be modified by the caller to add
  3559  // headers to the request.
  3560  func (c *UsersLabelsCreateCall) Header() http.Header {
  3561  	if c.header_ == nil {
  3562  		c.header_ = make(http.Header)
  3563  	}
  3564  	return c.header_
  3565  }
  3566  
  3567  func (c *UsersLabelsCreateCall) doRequest(alt string) (*http.Response, error) {
  3568  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
  3569  	var body io.Reader = nil
  3570  	body, err := googleapi.WithoutDataWrapper.JSONReader(c.label)
  3571  	if err != nil {
  3572  		return nil, err
  3573  	}
  3574  	c.urlParams_.Set("alt", alt)
  3575  	c.urlParams_.Set("prettyPrint", "false")
  3576  	urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/labels")
  3577  	urls += "?" + c.urlParams_.Encode()
  3578  	req, err := http.NewRequest("POST", urls, body)
  3579  	if err != nil {
  3580  		return nil, err
  3581  	}
  3582  	req.Header = reqHeaders
  3583  	googleapi.Expand(req.URL, map[string]string{
  3584  		"userId": c.userId,
  3585  	})
  3586  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3587  }
  3588  
  3589  // Do executes the "gmail.users.labels.create" call.
  3590  // Any non-2xx status code is an error. Response headers are in either
  3591  // *Label.ServerResponse.Header or (if a response was returned at all) in
  3592  // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  3593  // whether the returned error was because http.StatusNotModified was returned.
  3594  func (c *UsersLabelsCreateCall) Do(opts ...googleapi.CallOption) (*Label, error) {
  3595  	gensupport.SetOptions(c.urlParams_, opts...)
  3596  	res, err := c.doRequest("json")
  3597  	if res != nil && res.StatusCode == http.StatusNotModified {
  3598  		if res.Body != nil {
  3599  			res.Body.Close()
  3600  		}
  3601  		return nil, gensupport.WrapError(&googleapi.Error{
  3602  			Code:   res.StatusCode,
  3603  			Header: res.Header,
  3604  		})
  3605  	}
  3606  	if err != nil {
  3607  		return nil, err
  3608  	}
  3609  	defer googleapi.CloseBody(res)
  3610  	if err := googleapi.CheckResponse(res); err != nil {
  3611  		return nil, gensupport.WrapError(err)
  3612  	}
  3613  	ret := &Label{
  3614  		ServerResponse: googleapi.ServerResponse{
  3615  			Header:         res.Header,
  3616  			HTTPStatusCode: res.StatusCode,
  3617  		},
  3618  	}
  3619  	target := &ret
  3620  	if err := gensupport.DecodeResponse(target, res); err != nil {
  3621  		return nil, err
  3622  	}
  3623  	return ret, nil
  3624  }
  3625  
  3626  type UsersLabelsDeleteCall struct {
  3627  	s          *Service
  3628  	userId     string
  3629  	id         string
  3630  	urlParams_ gensupport.URLParams
  3631  	ctx_       context.Context
  3632  	header_    http.Header
  3633  }
  3634  
  3635  // Delete: Immediately and permanently deletes the specified label and removes
  3636  // it from any messages and threads that it is applied to.
  3637  //
  3638  //   - id: The ID of the label to delete.
  3639  //   - userId: The user's email address. The special value `me` can be used to
  3640  //     indicate the authenticated user.
  3641  func (r *UsersLabelsService) Delete(userId string, id string) *UsersLabelsDeleteCall {
  3642  	c := &UsersLabelsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3643  	c.userId = userId
  3644  	c.id = id
  3645  	return c
  3646  }
  3647  
  3648  // Fields allows partial responses to be retrieved. See
  3649  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  3650  // details.
  3651  func (c *UsersLabelsDeleteCall) Fields(s ...googleapi.Field) *UsersLabelsDeleteCall {
  3652  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3653  	return c
  3654  }
  3655  
  3656  // Context sets the context to be used in this call's Do method.
  3657  func (c *UsersLabelsDeleteCall) Context(ctx context.Context) *UsersLabelsDeleteCall {
  3658  	c.ctx_ = ctx
  3659  	return c
  3660  }
  3661  
  3662  // Header returns a http.Header that can be modified by the caller to add
  3663  // headers to the request.
  3664  func (c *UsersLabelsDeleteCall) Header() http.Header {
  3665  	if c.header_ == nil {
  3666  		c.header_ = make(http.Header)
  3667  	}
  3668  	return c.header_
  3669  }
  3670  
  3671  func (c *UsersLabelsDeleteCall) doRequest(alt string) (*http.Response, error) {
  3672  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
  3673  	var body io.Reader = nil
  3674  	c.urlParams_.Set("alt", alt)
  3675  	c.urlParams_.Set("prettyPrint", "false")
  3676  	urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/labels/{id}")
  3677  	urls += "?" + c.urlParams_.Encode()
  3678  	req, err := http.NewRequest("DELETE", urls, body)
  3679  	if err != nil {
  3680  		return nil, err
  3681  	}
  3682  	req.Header = reqHeaders
  3683  	googleapi.Expand(req.URL, map[string]string{
  3684  		"userId": c.userId,
  3685  		"id":     c.id,
  3686  	})
  3687  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3688  }
  3689  
  3690  // Do executes the "gmail.users.labels.delete" call.
  3691  func (c *UsersLabelsDeleteCall) Do(opts ...googleapi.CallOption) error {
  3692  	gensupport.SetOptions(c.urlParams_, opts...)
  3693  	res, err := c.doRequest("json")
  3694  	if err != nil {
  3695  		return err
  3696  	}
  3697  	defer googleapi.CloseBody(res)
  3698  	if err := googleapi.CheckResponse(res); err != nil {
  3699  		return gensupport.WrapError(err)
  3700  	}
  3701  	return nil
  3702  }
  3703  
  3704  type UsersLabelsGetCall struct {
  3705  	s            *Service
  3706  	userId       string
  3707  	id           string
  3708  	urlParams_   gensupport.URLParams
  3709  	ifNoneMatch_ string
  3710  	ctx_         context.Context
  3711  	header_      http.Header
  3712  }
  3713  
  3714  // Get: Gets the specified label.
  3715  //
  3716  //   - id: The ID of the label to retrieve.
  3717  //   - userId: The user's email address. The special value `me` can be used to
  3718  //     indicate the authenticated user.
  3719  func (r *UsersLabelsService) Get(userId string, id string) *UsersLabelsGetCall {
  3720  	c := &UsersLabelsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3721  	c.userId = userId
  3722  	c.id = id
  3723  	return c
  3724  }
  3725  
  3726  // Fields allows partial responses to be retrieved. See
  3727  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  3728  // details.
  3729  func (c *UsersLabelsGetCall) Fields(s ...googleapi.Field) *UsersLabelsGetCall {
  3730  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3731  	return c
  3732  }
  3733  
  3734  // IfNoneMatch sets an optional parameter which makes the operation fail if the
  3735  // object's ETag matches the given value. This is useful for getting updates
  3736  // only after the object has changed since the last request.
  3737  func (c *UsersLabelsGetCall) IfNoneMatch(entityTag string) *UsersLabelsGetCall {
  3738  	c.ifNoneMatch_ = entityTag
  3739  	return c
  3740  }
  3741  
  3742  // Context sets the context to be used in this call's Do method.
  3743  func (c *UsersLabelsGetCall) Context(ctx context.Context) *UsersLabelsGetCall {
  3744  	c.ctx_ = ctx
  3745  	return c
  3746  }
  3747  
  3748  // Header returns a http.Header that can be modified by the caller to add
  3749  // headers to the request.
  3750  func (c *UsersLabelsGetCall) Header() http.Header {
  3751  	if c.header_ == nil {
  3752  		c.header_ = make(http.Header)
  3753  	}
  3754  	return c.header_
  3755  }
  3756  
  3757  func (c *UsersLabelsGetCall) doRequest(alt string) (*http.Response, error) {
  3758  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
  3759  	if c.ifNoneMatch_ != "" {
  3760  		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  3761  	}
  3762  	var body io.Reader = nil
  3763  	c.urlParams_.Set("alt", alt)
  3764  	c.urlParams_.Set("prettyPrint", "false")
  3765  	urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/labels/{id}")
  3766  	urls += "?" + c.urlParams_.Encode()
  3767  	req, err := http.NewRequest("GET", urls, body)
  3768  	if err != nil {
  3769  		return nil, err
  3770  	}
  3771  	req.Header = reqHeaders
  3772  	googleapi.Expand(req.URL, map[string]string{
  3773  		"userId": c.userId,
  3774  		"id":     c.id,
  3775  	})
  3776  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3777  }
  3778  
  3779  // Do executes the "gmail.users.labels.get" call.
  3780  // Any non-2xx status code is an error. Response headers are in either
  3781  // *Label.ServerResponse.Header or (if a response was returned at all) in
  3782  // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  3783  // whether the returned error was because http.StatusNotModified was returned.
  3784  func (c *UsersLabelsGetCall) Do(opts ...googleapi.CallOption) (*Label, error) {
  3785  	gensupport.SetOptions(c.urlParams_, opts...)
  3786  	res, err := c.doRequest("json")
  3787  	if res != nil && res.StatusCode == http.StatusNotModified {
  3788  		if res.Body != nil {
  3789  			res.Body.Close()
  3790  		}
  3791  		return nil, gensupport.WrapError(&googleapi.Error{
  3792  			Code:   res.StatusCode,
  3793  			Header: res.Header,
  3794  		})
  3795  	}
  3796  	if err != nil {
  3797  		return nil, err
  3798  	}
  3799  	defer googleapi.CloseBody(res)
  3800  	if err := googleapi.CheckResponse(res); err != nil {
  3801  		return nil, gensupport.WrapError(err)
  3802  	}
  3803  	ret := &Label{
  3804  		ServerResponse: googleapi.ServerResponse{
  3805  			Header:         res.Header,
  3806  			HTTPStatusCode: res.StatusCode,
  3807  		},
  3808  	}
  3809  	target := &ret
  3810  	if err := gensupport.DecodeResponse(target, res); err != nil {
  3811  		return nil, err
  3812  	}
  3813  	return ret, nil
  3814  }
  3815  
  3816  type UsersLabelsListCall struct {
  3817  	s            *Service
  3818  	userId       string
  3819  	urlParams_   gensupport.URLParams
  3820  	ifNoneMatch_ string
  3821  	ctx_         context.Context
  3822  	header_      http.Header
  3823  }
  3824  
  3825  // List: Lists all labels in the user's mailbox.
  3826  //
  3827  //   - userId: The user's email address. The special value `me` can be used to
  3828  //     indicate the authenticated user.
  3829  func (r *UsersLabelsService) List(userId string) *UsersLabelsListCall {
  3830  	c := &UsersLabelsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3831  	c.userId = userId
  3832  	return c
  3833  }
  3834  
  3835  // Fields allows partial responses to be retrieved. See
  3836  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  3837  // details.
  3838  func (c *UsersLabelsListCall) Fields(s ...googleapi.Field) *UsersLabelsListCall {
  3839  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3840  	return c
  3841  }
  3842  
  3843  // IfNoneMatch sets an optional parameter which makes the operation fail if the
  3844  // object's ETag matches the given value. This is useful for getting updates
  3845  // only after the object has changed since the last request.
  3846  func (c *UsersLabelsListCall) IfNoneMatch(entityTag string) *UsersLabelsListCall {
  3847  	c.ifNoneMatch_ = entityTag
  3848  	return c
  3849  }
  3850  
  3851  // Context sets the context to be used in this call's Do method.
  3852  func (c *UsersLabelsListCall) Context(ctx context.Context) *UsersLabelsListCall {
  3853  	c.ctx_ = ctx
  3854  	return c
  3855  }
  3856  
  3857  // Header returns a http.Header that can be modified by the caller to add
  3858  // headers to the request.
  3859  func (c *UsersLabelsListCall) Header() http.Header {
  3860  	if c.header_ == nil {
  3861  		c.header_ = make(http.Header)
  3862  	}
  3863  	return c.header_
  3864  }
  3865  
  3866  func (c *UsersLabelsListCall) doRequest(alt string) (*http.Response, error) {
  3867  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
  3868  	if c.ifNoneMatch_ != "" {
  3869  		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  3870  	}
  3871  	var body io.Reader = nil
  3872  	c.urlParams_.Set("alt", alt)
  3873  	c.urlParams_.Set("prettyPrint", "false")
  3874  	urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/labels")
  3875  	urls += "?" + c.urlParams_.Encode()
  3876  	req, err := http.NewRequest("GET", urls, body)
  3877  	if err != nil {
  3878  		return nil, err
  3879  	}
  3880  	req.Header = reqHeaders
  3881  	googleapi.Expand(req.URL, map[string]string{
  3882  		"userId": c.userId,
  3883  	})
  3884  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3885  }
  3886  
  3887  // Do executes the "gmail.users.labels.list" call.
  3888  // Any non-2xx status code is an error. Response headers are in either
  3889  // *ListLabelsResponse.ServerResponse.Header or (if a response was returned at
  3890  // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  3891  // check whether the returned error was because http.StatusNotModified was
  3892  // returned.
  3893  func (c *UsersLabelsListCall) Do(opts ...googleapi.CallOption) (*ListLabelsResponse, error) {
  3894  	gensupport.SetOptions(c.urlParams_, opts...)
  3895  	res, err := c.doRequest("json")
  3896  	if res != nil && res.StatusCode == http.StatusNotModified {
  3897  		if res.Body != nil {
  3898  			res.Body.Close()
  3899  		}
  3900  		return nil, gensupport.WrapError(&googleapi.Error{
  3901  			Code:   res.StatusCode,
  3902  			Header: res.Header,
  3903  		})
  3904  	}
  3905  	if err != nil {
  3906  		return nil, err
  3907  	}
  3908  	defer googleapi.CloseBody(res)
  3909  	if err := googleapi.CheckResponse(res); err != nil {
  3910  		return nil, gensupport.WrapError(err)
  3911  	}
  3912  	ret := &ListLabelsResponse{
  3913  		ServerResponse: googleapi.ServerResponse{
  3914  			Header:         res.Header,
  3915  			HTTPStatusCode: res.StatusCode,
  3916  		},
  3917  	}
  3918  	target := &ret
  3919  	if err := gensupport.DecodeResponse(target, res); err != nil {
  3920  		return nil, err
  3921  	}
  3922  	return ret, nil
  3923  }
  3924  
  3925  type UsersLabelsPatchCall struct {
  3926  	s          *Service
  3927  	userId     string
  3928  	id         string
  3929  	label      *Label
  3930  	urlParams_ gensupport.URLParams
  3931  	ctx_       context.Context
  3932  	header_    http.Header
  3933  }
  3934  
  3935  // Patch: Patch the specified label.
  3936  //
  3937  //   - id: The ID of the label to update.
  3938  //   - userId: The user's email address. The special value `me` can be used to
  3939  //     indicate the authenticated user.
  3940  func (r *UsersLabelsService) Patch(userId string, id string, label *Label) *UsersLabelsPatchCall {
  3941  	c := &UsersLabelsPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3942  	c.userId = userId
  3943  	c.id = id
  3944  	c.label = label
  3945  	return c
  3946  }
  3947  
  3948  // Fields allows partial responses to be retrieved. See
  3949  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  3950  // details.
  3951  func (c *UsersLabelsPatchCall) Fields(s ...googleapi.Field) *UsersLabelsPatchCall {
  3952  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3953  	return c
  3954  }
  3955  
  3956  // Context sets the context to be used in this call's Do method.
  3957  func (c *UsersLabelsPatchCall) Context(ctx context.Context) *UsersLabelsPatchCall {
  3958  	c.ctx_ = ctx
  3959  	return c
  3960  }
  3961  
  3962  // Header returns a http.Header that can be modified by the caller to add
  3963  // headers to the request.
  3964  func (c *UsersLabelsPatchCall) Header() http.Header {
  3965  	if c.header_ == nil {
  3966  		c.header_ = make(http.Header)
  3967  	}
  3968  	return c.header_
  3969  }
  3970  
  3971  func (c *UsersLabelsPatchCall) doRequest(alt string) (*http.Response, error) {
  3972  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
  3973  	var body io.Reader = nil
  3974  	body, err := googleapi.WithoutDataWrapper.JSONReader(c.label)
  3975  	if err != nil {
  3976  		return nil, err
  3977  	}
  3978  	c.urlParams_.Set("alt", alt)
  3979  	c.urlParams_.Set("prettyPrint", "false")
  3980  	urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/labels/{id}")
  3981  	urls += "?" + c.urlParams_.Encode()
  3982  	req, err := http.NewRequest("PATCH", urls, body)
  3983  	if err != nil {
  3984  		return nil, err
  3985  	}
  3986  	req.Header = reqHeaders
  3987  	googleapi.Expand(req.URL, map[string]string{
  3988  		"userId": c.userId,
  3989  		"id":     c.id,
  3990  	})
  3991  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3992  }
  3993  
  3994  // Do executes the "gmail.users.labels.patch" call.
  3995  // Any non-2xx status code is an error. Response headers are in either
  3996  // *Label.ServerResponse.Header or (if a response was returned at all) in
  3997  // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  3998  // whether the returned error was because http.StatusNotModified was returned.
  3999  func (c *UsersLabelsPatchCall) Do(opts ...googleapi.CallOption) (*Label, error) {
  4000  	gensupport.SetOptions(c.urlParams_, opts...)
  4001  	res, err := c.doRequest("json")
  4002  	if res != nil && res.StatusCode == http.StatusNotModified {
  4003  		if res.Body != nil {
  4004  			res.Body.Close()
  4005  		}
  4006  		return nil, gensupport.WrapError(&googleapi.Error{
  4007  			Code:   res.StatusCode,
  4008  			Header: res.Header,
  4009  		})
  4010  	}
  4011  	if err != nil {
  4012  		return nil, err
  4013  	}
  4014  	defer googleapi.CloseBody(res)
  4015  	if err := googleapi.CheckResponse(res); err != nil {
  4016  		return nil, gensupport.WrapError(err)
  4017  	}
  4018  	ret := &Label{
  4019  		ServerResponse: googleapi.ServerResponse{
  4020  			Header:         res.Header,
  4021  			HTTPStatusCode: res.StatusCode,
  4022  		},
  4023  	}
  4024  	target := &ret
  4025  	if err := gensupport.DecodeResponse(target, res); err != nil {
  4026  		return nil, err
  4027  	}
  4028  	return ret, nil
  4029  }
  4030  
  4031  type UsersLabelsUpdateCall struct {
  4032  	s          *Service
  4033  	userId     string
  4034  	id         string
  4035  	label      *Label
  4036  	urlParams_ gensupport.URLParams
  4037  	ctx_       context.Context
  4038  	header_    http.Header
  4039  }
  4040  
  4041  // Update: Updates the specified label.
  4042  //
  4043  //   - id: The ID of the label to update.
  4044  //   - userId: The user's email address. The special value `me` can be used to
  4045  //     indicate the authenticated user.
  4046  func (r *UsersLabelsService) Update(userId string, id string, label *Label) *UsersLabelsUpdateCall {
  4047  	c := &UsersLabelsUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4048  	c.userId = userId
  4049  	c.id = id
  4050  	c.label = label
  4051  	return c
  4052  }
  4053  
  4054  // Fields allows partial responses to be retrieved. See
  4055  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  4056  // details.
  4057  func (c *UsersLabelsUpdateCall) Fields(s ...googleapi.Field) *UsersLabelsUpdateCall {
  4058  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4059  	return c
  4060  }
  4061  
  4062  // Context sets the context to be used in this call's Do method.
  4063  func (c *UsersLabelsUpdateCall) Context(ctx context.Context) *UsersLabelsUpdateCall {
  4064  	c.ctx_ = ctx
  4065  	return c
  4066  }
  4067  
  4068  // Header returns a http.Header that can be modified by the caller to add
  4069  // headers to the request.
  4070  func (c *UsersLabelsUpdateCall) Header() http.Header {
  4071  	if c.header_ == nil {
  4072  		c.header_ = make(http.Header)
  4073  	}
  4074  	return c.header_
  4075  }
  4076  
  4077  func (c *UsersLabelsUpdateCall) doRequest(alt string) (*http.Response, error) {
  4078  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
  4079  	var body io.Reader = nil
  4080  	body, err := googleapi.WithoutDataWrapper.JSONReader(c.label)
  4081  	if err != nil {
  4082  		return nil, err
  4083  	}
  4084  	c.urlParams_.Set("alt", alt)
  4085  	c.urlParams_.Set("prettyPrint", "false")
  4086  	urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/labels/{id}")
  4087  	urls += "?" + c.urlParams_.Encode()
  4088  	req, err := http.NewRequest("PUT", urls, body)
  4089  	if err != nil {
  4090  		return nil, err
  4091  	}
  4092  	req.Header = reqHeaders
  4093  	googleapi.Expand(req.URL, map[string]string{
  4094  		"userId": c.userId,
  4095  		"id":     c.id,
  4096  	})
  4097  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4098  }
  4099  
  4100  // Do executes the "gmail.users.labels.update" call.
  4101  // Any non-2xx status code is an error. Response headers are in either
  4102  // *Label.ServerResponse.Header or (if a response was returned at all) in
  4103  // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  4104  // whether the returned error was because http.StatusNotModified was returned.
  4105  func (c *UsersLabelsUpdateCall) Do(opts ...googleapi.CallOption) (*Label, error) {
  4106  	gensupport.SetOptions(c.urlParams_, opts...)
  4107  	res, err := c.doRequest("json")
  4108  	if res != nil && res.StatusCode == http.StatusNotModified {
  4109  		if res.Body != nil {
  4110  			res.Body.Close()
  4111  		}
  4112  		return nil, gensupport.WrapError(&googleapi.Error{
  4113  			Code:   res.StatusCode,
  4114  			Header: res.Header,
  4115  		})
  4116  	}
  4117  	if err != nil {
  4118  		return nil, err
  4119  	}
  4120  	defer googleapi.CloseBody(res)
  4121  	if err := googleapi.CheckResponse(res); err != nil {
  4122  		return nil, gensupport.WrapError(err)
  4123  	}
  4124  	ret := &Label{
  4125  		ServerResponse: googleapi.ServerResponse{
  4126  			Header:         res.Header,
  4127  			HTTPStatusCode: res.StatusCode,
  4128  		},
  4129  	}
  4130  	target := &ret
  4131  	if err := gensupport.DecodeResponse(target, res); err != nil {
  4132  		return nil, err
  4133  	}
  4134  	return ret, nil
  4135  }
  4136  
  4137  type UsersMessagesBatchDeleteCall struct {
  4138  	s                          *Service
  4139  	userId                     string
  4140  	batchdeletemessagesrequest *BatchDeleteMessagesRequest
  4141  	urlParams_                 gensupport.URLParams
  4142  	ctx_                       context.Context
  4143  	header_                    http.Header
  4144  }
  4145  
  4146  // BatchDelete: Deletes many messages by message ID. Provides no guarantees
  4147  // that messages were not already deleted or even existed at all.
  4148  //
  4149  //   - userId: The user's email address. The special value `me` can be used to
  4150  //     indicate the authenticated user.
  4151  func (r *UsersMessagesService) BatchDelete(userId string, batchdeletemessagesrequest *BatchDeleteMessagesRequest) *UsersMessagesBatchDeleteCall {
  4152  	c := &UsersMessagesBatchDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4153  	c.userId = userId
  4154  	c.batchdeletemessagesrequest = batchdeletemessagesrequest
  4155  	return c
  4156  }
  4157  
  4158  // Fields allows partial responses to be retrieved. See
  4159  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  4160  // details.
  4161  func (c *UsersMessagesBatchDeleteCall) Fields(s ...googleapi.Field) *UsersMessagesBatchDeleteCall {
  4162  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4163  	return c
  4164  }
  4165  
  4166  // Context sets the context to be used in this call's Do method.
  4167  func (c *UsersMessagesBatchDeleteCall) Context(ctx context.Context) *UsersMessagesBatchDeleteCall {
  4168  	c.ctx_ = ctx
  4169  	return c
  4170  }
  4171  
  4172  // Header returns a http.Header that can be modified by the caller to add
  4173  // headers to the request.
  4174  func (c *UsersMessagesBatchDeleteCall) Header() http.Header {
  4175  	if c.header_ == nil {
  4176  		c.header_ = make(http.Header)
  4177  	}
  4178  	return c.header_
  4179  }
  4180  
  4181  func (c *UsersMessagesBatchDeleteCall) doRequest(alt string) (*http.Response, error) {
  4182  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
  4183  	var body io.Reader = nil
  4184  	body, err := googleapi.WithoutDataWrapper.JSONReader(c.batchdeletemessagesrequest)
  4185  	if err != nil {
  4186  		return nil, err
  4187  	}
  4188  	c.urlParams_.Set("alt", alt)
  4189  	c.urlParams_.Set("prettyPrint", "false")
  4190  	urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/messages/batchDelete")
  4191  	urls += "?" + c.urlParams_.Encode()
  4192  	req, err := http.NewRequest("POST", urls, body)
  4193  	if err != nil {
  4194  		return nil, err
  4195  	}
  4196  	req.Header = reqHeaders
  4197  	googleapi.Expand(req.URL, map[string]string{
  4198  		"userId": c.userId,
  4199  	})
  4200  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4201  }
  4202  
  4203  // Do executes the "gmail.users.messages.batchDelete" call.
  4204  func (c *UsersMessagesBatchDeleteCall) Do(opts ...googleapi.CallOption) error {
  4205  	gensupport.SetOptions(c.urlParams_, opts...)
  4206  	res, err := c.doRequest("json")
  4207  	if err != nil {
  4208  		return err
  4209  	}
  4210  	defer googleapi.CloseBody(res)
  4211  	if err := googleapi.CheckResponse(res); err != nil {
  4212  		return gensupport.WrapError(err)
  4213  	}
  4214  	return nil
  4215  }
  4216  
  4217  type UsersMessagesBatchModifyCall struct {
  4218  	s                          *Service
  4219  	userId                     string
  4220  	batchmodifymessagesrequest *BatchModifyMessagesRequest
  4221  	urlParams_                 gensupport.URLParams
  4222  	ctx_                       context.Context
  4223  	header_                    http.Header
  4224  }
  4225  
  4226  // BatchModify: Modifies the labels on the specified messages.
  4227  //
  4228  //   - userId: The user's email address. The special value `me` can be used to
  4229  //     indicate the authenticated user.
  4230  func (r *UsersMessagesService) BatchModify(userId string, batchmodifymessagesrequest *BatchModifyMessagesRequest) *UsersMessagesBatchModifyCall {
  4231  	c := &UsersMessagesBatchModifyCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4232  	c.userId = userId
  4233  	c.batchmodifymessagesrequest = batchmodifymessagesrequest
  4234  	return c
  4235  }
  4236  
  4237  // Fields allows partial responses to be retrieved. See
  4238  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  4239  // details.
  4240  func (c *UsersMessagesBatchModifyCall) Fields(s ...googleapi.Field) *UsersMessagesBatchModifyCall {
  4241  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4242  	return c
  4243  }
  4244  
  4245  // Context sets the context to be used in this call's Do method.
  4246  func (c *UsersMessagesBatchModifyCall) Context(ctx context.Context) *UsersMessagesBatchModifyCall {
  4247  	c.ctx_ = ctx
  4248  	return c
  4249  }
  4250  
  4251  // Header returns a http.Header that can be modified by the caller to add
  4252  // headers to the request.
  4253  func (c *UsersMessagesBatchModifyCall) Header() http.Header {
  4254  	if c.header_ == nil {
  4255  		c.header_ = make(http.Header)
  4256  	}
  4257  	return c.header_
  4258  }
  4259  
  4260  func (c *UsersMessagesBatchModifyCall) doRequest(alt string) (*http.Response, error) {
  4261  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
  4262  	var body io.Reader = nil
  4263  	body, err := googleapi.WithoutDataWrapper.JSONReader(c.batchmodifymessagesrequest)
  4264  	if err != nil {
  4265  		return nil, err
  4266  	}
  4267  	c.urlParams_.Set("alt", alt)
  4268  	c.urlParams_.Set("prettyPrint", "false")
  4269  	urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/messages/batchModify")
  4270  	urls += "?" + c.urlParams_.Encode()
  4271  	req, err := http.NewRequest("POST", urls, body)
  4272  	if err != nil {
  4273  		return nil, err
  4274  	}
  4275  	req.Header = reqHeaders
  4276  	googleapi.Expand(req.URL, map[string]string{
  4277  		"userId": c.userId,
  4278  	})
  4279  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4280  }
  4281  
  4282  // Do executes the "gmail.users.messages.batchModify" call.
  4283  func (c *UsersMessagesBatchModifyCall) Do(opts ...googleapi.CallOption) error {
  4284  	gensupport.SetOptions(c.urlParams_, opts...)
  4285  	res, err := c.doRequest("json")
  4286  	if err != nil {
  4287  		return err
  4288  	}
  4289  	defer googleapi.CloseBody(res)
  4290  	if err := googleapi.CheckResponse(res); err != nil {
  4291  		return gensupport.WrapError(err)
  4292  	}
  4293  	return nil
  4294  }
  4295  
  4296  type UsersMessagesDeleteCall struct {
  4297  	s          *Service
  4298  	userId     string
  4299  	id         string
  4300  	urlParams_ gensupport.URLParams
  4301  	ctx_       context.Context
  4302  	header_    http.Header
  4303  }
  4304  
  4305  // Delete: Immediately and permanently deletes the specified message. This
  4306  // operation cannot be undone. Prefer `messages.trash` instead.
  4307  //
  4308  //   - id: The ID of the message to delete.
  4309  //   - userId: The user's email address. The special value `me` can be used to
  4310  //     indicate the authenticated user.
  4311  func (r *UsersMessagesService) Delete(userId string, id string) *UsersMessagesDeleteCall {
  4312  	c := &UsersMessagesDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4313  	c.userId = userId
  4314  	c.id = id
  4315  	return c
  4316  }
  4317  
  4318  // Fields allows partial responses to be retrieved. See
  4319  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  4320  // details.
  4321  func (c *UsersMessagesDeleteCall) Fields(s ...googleapi.Field) *UsersMessagesDeleteCall {
  4322  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4323  	return c
  4324  }
  4325  
  4326  // Context sets the context to be used in this call's Do method.
  4327  func (c *UsersMessagesDeleteCall) Context(ctx context.Context) *UsersMessagesDeleteCall {
  4328  	c.ctx_ = ctx
  4329  	return c
  4330  }
  4331  
  4332  // Header returns a http.Header that can be modified by the caller to add
  4333  // headers to the request.
  4334  func (c *UsersMessagesDeleteCall) Header() http.Header {
  4335  	if c.header_ == nil {
  4336  		c.header_ = make(http.Header)
  4337  	}
  4338  	return c.header_
  4339  }
  4340  
  4341  func (c *UsersMessagesDeleteCall) doRequest(alt string) (*http.Response, error) {
  4342  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
  4343  	var body io.Reader = nil
  4344  	c.urlParams_.Set("alt", alt)
  4345  	c.urlParams_.Set("prettyPrint", "false")
  4346  	urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/messages/{id}")
  4347  	urls += "?" + c.urlParams_.Encode()
  4348  	req, err := http.NewRequest("DELETE", urls, body)
  4349  	if err != nil {
  4350  		return nil, err
  4351  	}
  4352  	req.Header = reqHeaders
  4353  	googleapi.Expand(req.URL, map[string]string{
  4354  		"userId": c.userId,
  4355  		"id":     c.id,
  4356  	})
  4357  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4358  }
  4359  
  4360  // Do executes the "gmail.users.messages.delete" call.
  4361  func (c *UsersMessagesDeleteCall) Do(opts ...googleapi.CallOption) error {
  4362  	gensupport.SetOptions(c.urlParams_, opts...)
  4363  	res, err := c.doRequest("json")
  4364  	if err != nil {
  4365  		return err
  4366  	}
  4367  	defer googleapi.CloseBody(res)
  4368  	if err := googleapi.CheckResponse(res); err != nil {
  4369  		return gensupport.WrapError(err)
  4370  	}
  4371  	return nil
  4372  }
  4373  
  4374  type UsersMessagesGetCall struct {
  4375  	s            *Service
  4376  	userId       string
  4377  	id           string
  4378  	urlParams_   gensupport.URLParams
  4379  	ifNoneMatch_ string
  4380  	ctx_         context.Context
  4381  	header_      http.Header
  4382  }
  4383  
  4384  // Get: Gets the specified message.
  4385  //
  4386  //   - id: The ID of the message to retrieve. This ID is usually retrieved using
  4387  //     `messages.list`. The ID is also contained in the result when a message is
  4388  //     inserted (`messages.insert`) or imported (`messages.import`).
  4389  //   - userId: The user's email address. The special value `me` can be used to
  4390  //     indicate the authenticated user.
  4391  func (r *UsersMessagesService) Get(userId string, id string) *UsersMessagesGetCall {
  4392  	c := &UsersMessagesGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4393  	c.userId = userId
  4394  	c.id = id
  4395  	return c
  4396  }
  4397  
  4398  // Format sets the optional parameter "format": The format to return the
  4399  // message in.
  4400  //
  4401  // Possible values:
  4402  //
  4403  //	"minimal" - Returns only email message ID and labels; does not return the
  4404  //
  4405  // email headers, body, or payload.
  4406  //
  4407  //	"full" (default) - Returns the full email message data with body content
  4408  //
  4409  // parsed in the `payload` field; the `raw` field is not used. Format cannot be
  4410  // used when accessing the api using the gmail.metadata scope.
  4411  //
  4412  //	"raw" - Returns the full email message data with body content in the `raw`
  4413  //
  4414  // field as a base64url encoded string; the `payload` field is not used. Format
  4415  // cannot be used when accessing the api using the gmail.metadata scope.
  4416  //
  4417  //	"metadata" - Returns only email message ID, labels, and email headers.
  4418  func (c *UsersMessagesGetCall) Format(format string) *UsersMessagesGetCall {
  4419  	c.urlParams_.Set("format", format)
  4420  	return c
  4421  }
  4422  
  4423  // MetadataHeaders sets the optional parameter "metadataHeaders": When given
  4424  // and format is `METADATA`, only include headers specified.
  4425  func (c *UsersMessagesGetCall) MetadataHeaders(metadataHeaders ...string) *UsersMessagesGetCall {
  4426  	c.urlParams_.SetMulti("metadataHeaders", append([]string{}, metadataHeaders...))
  4427  	return c
  4428  }
  4429  
  4430  // TemporaryEeccBypass sets the optional parameter "temporaryEeccBypass":
  4431  func (c *UsersMessagesGetCall) TemporaryEeccBypass(temporaryEeccBypass bool) *UsersMessagesGetCall {
  4432  	c.urlParams_.Set("temporaryEeccBypass", fmt.Sprint(temporaryEeccBypass))
  4433  	return c
  4434  }
  4435  
  4436  // Fields allows partial responses to be retrieved. See
  4437  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  4438  // details.
  4439  func (c *UsersMessagesGetCall) Fields(s ...googleapi.Field) *UsersMessagesGetCall {
  4440  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4441  	return c
  4442  }
  4443  
  4444  // IfNoneMatch sets an optional parameter which makes the operation fail if the
  4445  // object's ETag matches the given value. This is useful for getting updates
  4446  // only after the object has changed since the last request.
  4447  func (c *UsersMessagesGetCall) IfNoneMatch(entityTag string) *UsersMessagesGetCall {
  4448  	c.ifNoneMatch_ = entityTag
  4449  	return c
  4450  }
  4451  
  4452  // Context sets the context to be used in this call's Do method.
  4453  func (c *UsersMessagesGetCall) Context(ctx context.Context) *UsersMessagesGetCall {
  4454  	c.ctx_ = ctx
  4455  	return c
  4456  }
  4457  
  4458  // Header returns a http.Header that can be modified by the caller to add
  4459  // headers to the request.
  4460  func (c *UsersMessagesGetCall) Header() http.Header {
  4461  	if c.header_ == nil {
  4462  		c.header_ = make(http.Header)
  4463  	}
  4464  	return c.header_
  4465  }
  4466  
  4467  func (c *UsersMessagesGetCall) doRequest(alt string) (*http.Response, error) {
  4468  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
  4469  	if c.ifNoneMatch_ != "" {
  4470  		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  4471  	}
  4472  	var body io.Reader = nil
  4473  	c.urlParams_.Set("alt", alt)
  4474  	c.urlParams_.Set("prettyPrint", "false")
  4475  	urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/messages/{id}")
  4476  	urls += "?" + c.urlParams_.Encode()
  4477  	req, err := http.NewRequest("GET", urls, body)
  4478  	if err != nil {
  4479  		return nil, err
  4480  	}
  4481  	req.Header = reqHeaders
  4482  	googleapi.Expand(req.URL, map[string]string{
  4483  		"userId": c.userId,
  4484  		"id":     c.id,
  4485  	})
  4486  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4487  }
  4488  
  4489  // Do executes the "gmail.users.messages.get" call.
  4490  // Any non-2xx status code is an error. Response headers are in either
  4491  // *Message.ServerResponse.Header or (if a response was returned at all) in
  4492  // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  4493  // whether the returned error was because http.StatusNotModified was returned.
  4494  func (c *UsersMessagesGetCall) Do(opts ...googleapi.CallOption) (*Message, error) {
  4495  	gensupport.SetOptions(c.urlParams_, opts...)
  4496  	res, err := c.doRequest("json")
  4497  	if res != nil && res.StatusCode == http.StatusNotModified {
  4498  		if res.Body != nil {
  4499  			res.Body.Close()
  4500  		}
  4501  		return nil, gensupport.WrapError(&googleapi.Error{
  4502  			Code:   res.StatusCode,
  4503  			Header: res.Header,
  4504  		})
  4505  	}
  4506  	if err != nil {
  4507  		return nil, err
  4508  	}
  4509  	defer googleapi.CloseBody(res)
  4510  	if err := googleapi.CheckResponse(res); err != nil {
  4511  		return nil, gensupport.WrapError(err)
  4512  	}
  4513  	ret := &Message{
  4514  		ServerResponse: googleapi.ServerResponse{
  4515  			Header:         res.Header,
  4516  			HTTPStatusCode: res.StatusCode,
  4517  		},
  4518  	}
  4519  	target := &ret
  4520  	if err := gensupport.DecodeResponse(target, res); err != nil {
  4521  		return nil, err
  4522  	}
  4523  	return ret, nil
  4524  }
  4525  
  4526  type UsersMessagesImportCall struct {
  4527  	s          *Service
  4528  	userId     string
  4529  	message    *Message
  4530  	urlParams_ gensupport.URLParams
  4531  	mediaInfo_ *gensupport.MediaInfo
  4532  	ctx_       context.Context
  4533  	header_    http.Header
  4534  }
  4535  
  4536  // Import: Imports a message into only this user's mailbox, with standard email
  4537  // delivery scanning and classification similar to receiving via SMTP. This
  4538  // method doesn't perform SPF checks, so it might not work for some spam
  4539  // messages, such as those attempting to perform domain spoofing. This method
  4540  // does not send a message.
  4541  //
  4542  //   - userId: The user's email address. The special value `me` can be used to
  4543  //     indicate the authenticated user.
  4544  func (r *UsersMessagesService) Import(userId string, message *Message) *UsersMessagesImportCall {
  4545  	c := &UsersMessagesImportCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4546  	c.userId = userId
  4547  	c.message = message
  4548  	return c
  4549  }
  4550  
  4551  // Deleted sets the optional parameter "deleted": Mark the email as permanently
  4552  // deleted (not TRASH) and only visible in Google Vault to a Vault
  4553  // administrator. Only used for Google Workspace accounts.
  4554  func (c *UsersMessagesImportCall) Deleted(deleted bool) *UsersMessagesImportCall {
  4555  	c.urlParams_.Set("deleted", fmt.Sprint(deleted))
  4556  	return c
  4557  }
  4558  
  4559  // InternalDateSource sets the optional parameter "internalDateSource": Source
  4560  // for Gmail's internal date of the message.
  4561  //
  4562  // Possible values:
  4563  //
  4564  //	"receivedTime" - Internal message date set to current time when received
  4565  //
  4566  // by Gmail.
  4567  //
  4568  //	"dateHeader" (default) - Internal message time based on 'Date' header in
  4569  //
  4570  // email, when valid.
  4571  func (c *UsersMessagesImportCall) InternalDateSource(internalDateSource string) *UsersMessagesImportCall {
  4572  	c.urlParams_.Set("internalDateSource", internalDateSource)
  4573  	return c
  4574  }
  4575  
  4576  // NeverMarkSpam sets the optional parameter "neverMarkSpam": Ignore the Gmail
  4577  // spam classifier decision and never mark this email as SPAM in the mailbox.
  4578  func (c *UsersMessagesImportCall) NeverMarkSpam(neverMarkSpam bool) *UsersMessagesImportCall {
  4579  	c.urlParams_.Set("neverMarkSpam", fmt.Sprint(neverMarkSpam))
  4580  	return c
  4581  }
  4582  
  4583  // ProcessForCalendar sets the optional parameter "processForCalendar": Process
  4584  // calendar invites in the email and add any extracted meetings to the Google
  4585  // Calendar for this user.
  4586  func (c *UsersMessagesImportCall) ProcessForCalendar(processForCalendar bool) *UsersMessagesImportCall {
  4587  	c.urlParams_.Set("processForCalendar", fmt.Sprint(processForCalendar))
  4588  	return c
  4589  }
  4590  
  4591  // Media specifies the media to upload in one or more chunks. The chunk size
  4592  // may be controlled by supplying a MediaOption generated by
  4593  // googleapi.ChunkSize. The chunk size defaults to
  4594  // googleapi.DefaultUploadChunkSize.The Content-Type header used in the upload
  4595  // request will be determined by sniffing the contents of r, unless a
  4596  // MediaOption generated by googleapi.ContentType is supplied.
  4597  // At most one of Media and ResumableMedia may be set.
  4598  func (c *UsersMessagesImportCall) Media(r io.Reader, options ...googleapi.MediaOption) *UsersMessagesImportCall {
  4599  	c.mediaInfo_ = gensupport.NewInfoFromMedia(r, options)
  4600  	return c
  4601  }
  4602  
  4603  // ResumableMedia specifies the media to upload in chunks and can be canceled
  4604  // with ctx.
  4605  //
  4606  // Deprecated: use Media instead.
  4607  //
  4608  // At most one of Media and ResumableMedia may be set. mediaType identifies the
  4609  // MIME media type of the upload, such as "image/png". If mediaType is "", it
  4610  // will be auto-detected. The provided ctx will supersede any context
  4611  // previously provided to the Context method.
  4612  func (c *UsersMessagesImportCall) ResumableMedia(ctx context.Context, r io.ReaderAt, size int64, mediaType string) *UsersMessagesImportCall {
  4613  	c.ctx_ = ctx
  4614  	c.mediaInfo_ = gensupport.NewInfoFromResumableMedia(r, size, mediaType)
  4615  	return c
  4616  }
  4617  
  4618  // ProgressUpdater provides a callback function that will be called after every
  4619  // chunk. It should be a low-latency function in order to not slow down the
  4620  // upload operation. This should only be called when using ResumableMedia (as
  4621  // opposed to Media).
  4622  func (c *UsersMessagesImportCall) ProgressUpdater(pu googleapi.ProgressUpdater) *UsersMessagesImportCall {
  4623  	c.mediaInfo_.SetProgressUpdater(pu)
  4624  	return c
  4625  }
  4626  
  4627  // Fields allows partial responses to be retrieved. See
  4628  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  4629  // details.
  4630  func (c *UsersMessagesImportCall) Fields(s ...googleapi.Field) *UsersMessagesImportCall {
  4631  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4632  	return c
  4633  }
  4634  
  4635  // Context sets the context to be used in this call's Do method.
  4636  // This context will supersede any context previously provided to the
  4637  // ResumableMedia method.
  4638  func (c *UsersMessagesImportCall) Context(ctx context.Context) *UsersMessagesImportCall {
  4639  	c.ctx_ = ctx
  4640  	return c
  4641  }
  4642  
  4643  // Header returns a http.Header that can be modified by the caller to add
  4644  // headers to the request.
  4645  func (c *UsersMessagesImportCall) Header() http.Header {
  4646  	if c.header_ == nil {
  4647  		c.header_ = make(http.Header)
  4648  	}
  4649  	return c.header_
  4650  }
  4651  
  4652  func (c *UsersMessagesImportCall) doRequest(alt string) (*http.Response, error) {
  4653  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
  4654  	var body io.Reader = nil
  4655  	body, err := googleapi.WithoutDataWrapper.JSONReader(c.message)
  4656  	if err != nil {
  4657  		return nil, err
  4658  	}
  4659  	c.urlParams_.Set("alt", alt)
  4660  	c.urlParams_.Set("prettyPrint", "false")
  4661  	urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/messages/import")
  4662  	if c.mediaInfo_ != nil {
  4663  		urls = googleapi.ResolveRelative(c.s.BasePath, "/upload/gmail/v1/users/{userId}/messages/import")
  4664  		c.urlParams_.Set("uploadType", c.mediaInfo_.UploadType())
  4665  	}
  4666  	if body == nil {
  4667  		body = new(bytes.Buffer)
  4668  		reqHeaders.Set("Content-Type", "application/json")
  4669  	}
  4670  	body, getBody, cleanup := c.mediaInfo_.UploadRequest(reqHeaders, body)
  4671  	defer cleanup()
  4672  	urls += "?" + c.urlParams_.Encode()
  4673  	req, err := http.NewRequest("POST", urls, body)
  4674  	if err != nil {
  4675  		return nil, err
  4676  	}
  4677  	req.Header = reqHeaders
  4678  	req.GetBody = getBody
  4679  	googleapi.Expand(req.URL, map[string]string{
  4680  		"userId": c.userId,
  4681  	})
  4682  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4683  }
  4684  
  4685  // Do executes the "gmail.users.messages.import" call.
  4686  // Any non-2xx status code is an error. Response headers are in either
  4687  // *Message.ServerResponse.Header or (if a response was returned at all) in
  4688  // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  4689  // whether the returned error was because http.StatusNotModified was returned.
  4690  func (c *UsersMessagesImportCall) Do(opts ...googleapi.CallOption) (*Message, error) {
  4691  	gensupport.SetOptions(c.urlParams_, opts...)
  4692  	res, err := c.doRequest("json")
  4693  	if res != nil && res.StatusCode == http.StatusNotModified {
  4694  		if res.Body != nil {
  4695  			res.Body.Close()
  4696  		}
  4697  		return nil, gensupport.WrapError(&googleapi.Error{
  4698  			Code:   res.StatusCode,
  4699  			Header: res.Header,
  4700  		})
  4701  	}
  4702  	if err != nil {
  4703  		return nil, err
  4704  	}
  4705  	defer googleapi.CloseBody(res)
  4706  	if err := googleapi.CheckResponse(res); err != nil {
  4707  		return nil, gensupport.WrapError(err)
  4708  	}
  4709  	rx := c.mediaInfo_.ResumableUpload(res.Header.Get("Location"))
  4710  	if rx != nil {
  4711  		rx.Client = c.s.client
  4712  		rx.UserAgent = c.s.userAgent()
  4713  		ctx := c.ctx_
  4714  		if ctx == nil {
  4715  			ctx = context.TODO()
  4716  		}
  4717  		res, err = rx.Upload(ctx)
  4718  		if err != nil {
  4719  			return nil, err
  4720  		}
  4721  		defer res.Body.Close()
  4722  		if err := googleapi.CheckResponse(res); err != nil {
  4723  			return nil, gensupport.WrapError(err)
  4724  		}
  4725  	}
  4726  	ret := &Message{
  4727  		ServerResponse: googleapi.ServerResponse{
  4728  			Header:         res.Header,
  4729  			HTTPStatusCode: res.StatusCode,
  4730  		},
  4731  	}
  4732  	target := &ret
  4733  	if err := gensupport.DecodeResponse(target, res); err != nil {
  4734  		return nil, err
  4735  	}
  4736  	return ret, nil
  4737  }
  4738  
  4739  type UsersMessagesInsertCall struct {
  4740  	s          *Service
  4741  	userId     string
  4742  	message    *Message
  4743  	urlParams_ gensupport.URLParams
  4744  	mediaInfo_ *gensupport.MediaInfo
  4745  	ctx_       context.Context
  4746  	header_    http.Header
  4747  }
  4748  
  4749  // Insert: Directly inserts a message into only this user's mailbox similar to
  4750  // `IMAP APPEND`, bypassing most scanning and classification. Does not send a
  4751  // message.
  4752  //
  4753  //   - userId: The user's email address. The special value `me` can be used to
  4754  //     indicate the authenticated user.
  4755  func (r *UsersMessagesService) Insert(userId string, message *Message) *UsersMessagesInsertCall {
  4756  	c := &UsersMessagesInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4757  	c.userId = userId
  4758  	c.message = message
  4759  	return c
  4760  }
  4761  
  4762  // Deleted sets the optional parameter "deleted": Mark the email as permanently
  4763  // deleted (not TRASH) and only visible in Google Vault to a Vault
  4764  // administrator. Only used for Google Workspace accounts.
  4765  func (c *UsersMessagesInsertCall) Deleted(deleted bool) *UsersMessagesInsertCall {
  4766  	c.urlParams_.Set("deleted", fmt.Sprint(deleted))
  4767  	return c
  4768  }
  4769  
  4770  // InternalDateSource sets the optional parameter "internalDateSource": Source
  4771  // for Gmail's internal date of the message.
  4772  //
  4773  // Possible values:
  4774  //
  4775  //	"receivedTime" (default) - Internal message date set to current time when
  4776  //
  4777  // received by Gmail.
  4778  //
  4779  //	"dateHeader" - Internal message time based on 'Date' header in email, when
  4780  //
  4781  // valid.
  4782  func (c *UsersMessagesInsertCall) InternalDateSource(internalDateSource string) *UsersMessagesInsertCall {
  4783  	c.urlParams_.Set("internalDateSource", internalDateSource)
  4784  	return c
  4785  }
  4786  
  4787  // Media specifies the media to upload in one or more chunks. The chunk size
  4788  // may be controlled by supplying a MediaOption generated by
  4789  // googleapi.ChunkSize. The chunk size defaults to
  4790  // googleapi.DefaultUploadChunkSize.The Content-Type header used in the upload
  4791  // request will be determined by sniffing the contents of r, unless a
  4792  // MediaOption generated by googleapi.ContentType is supplied.
  4793  // At most one of Media and ResumableMedia may be set.
  4794  func (c *UsersMessagesInsertCall) Media(r io.Reader, options ...googleapi.MediaOption) *UsersMessagesInsertCall {
  4795  	c.mediaInfo_ = gensupport.NewInfoFromMedia(r, options)
  4796  	return c
  4797  }
  4798  
  4799  // ResumableMedia specifies the media to upload in chunks and can be canceled
  4800  // with ctx.
  4801  //
  4802  // Deprecated: use Media instead.
  4803  //
  4804  // At most one of Media and ResumableMedia may be set. mediaType identifies the
  4805  // MIME media type of the upload, such as "image/png". If mediaType is "", it
  4806  // will be auto-detected. The provided ctx will supersede any context
  4807  // previously provided to the Context method.
  4808  func (c *UsersMessagesInsertCall) ResumableMedia(ctx context.Context, r io.ReaderAt, size int64, mediaType string) *UsersMessagesInsertCall {
  4809  	c.ctx_ = ctx
  4810  	c.mediaInfo_ = gensupport.NewInfoFromResumableMedia(r, size, mediaType)
  4811  	return c
  4812  }
  4813  
  4814  // ProgressUpdater provides a callback function that will be called after every
  4815  // chunk. It should be a low-latency function in order to not slow down the
  4816  // upload operation. This should only be called when using ResumableMedia (as
  4817  // opposed to Media).
  4818  func (c *UsersMessagesInsertCall) ProgressUpdater(pu googleapi.ProgressUpdater) *UsersMessagesInsertCall {
  4819  	c.mediaInfo_.SetProgressUpdater(pu)
  4820  	return c
  4821  }
  4822  
  4823  // Fields allows partial responses to be retrieved. See
  4824  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  4825  // details.
  4826  func (c *UsersMessagesInsertCall) Fields(s ...googleapi.Field) *UsersMessagesInsertCall {
  4827  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4828  	return c
  4829  }
  4830  
  4831  // Context sets the context to be used in this call's Do method.
  4832  // This context will supersede any context previously provided to the
  4833  // ResumableMedia method.
  4834  func (c *UsersMessagesInsertCall) Context(ctx context.Context) *UsersMessagesInsertCall {
  4835  	c.ctx_ = ctx
  4836  	return c
  4837  }
  4838  
  4839  // Header returns a http.Header that can be modified by the caller to add
  4840  // headers to the request.
  4841  func (c *UsersMessagesInsertCall) Header() http.Header {
  4842  	if c.header_ == nil {
  4843  		c.header_ = make(http.Header)
  4844  	}
  4845  	return c.header_
  4846  }
  4847  
  4848  func (c *UsersMessagesInsertCall) doRequest(alt string) (*http.Response, error) {
  4849  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
  4850  	var body io.Reader = nil
  4851  	body, err := googleapi.WithoutDataWrapper.JSONReader(c.message)
  4852  	if err != nil {
  4853  		return nil, err
  4854  	}
  4855  	c.urlParams_.Set("alt", alt)
  4856  	c.urlParams_.Set("prettyPrint", "false")
  4857  	urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/messages")
  4858  	if c.mediaInfo_ != nil {
  4859  		urls = googleapi.ResolveRelative(c.s.BasePath, "/upload/gmail/v1/users/{userId}/messages")
  4860  		c.urlParams_.Set("uploadType", c.mediaInfo_.UploadType())
  4861  	}
  4862  	if body == nil {
  4863  		body = new(bytes.Buffer)
  4864  		reqHeaders.Set("Content-Type", "application/json")
  4865  	}
  4866  	body, getBody, cleanup := c.mediaInfo_.UploadRequest(reqHeaders, body)
  4867  	defer cleanup()
  4868  	urls += "?" + c.urlParams_.Encode()
  4869  	req, err := http.NewRequest("POST", urls, body)
  4870  	if err != nil {
  4871  		return nil, err
  4872  	}
  4873  	req.Header = reqHeaders
  4874  	req.GetBody = getBody
  4875  	googleapi.Expand(req.URL, map[string]string{
  4876  		"userId": c.userId,
  4877  	})
  4878  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4879  }
  4880  
  4881  // Do executes the "gmail.users.messages.insert" call.
  4882  // Any non-2xx status code is an error. Response headers are in either
  4883  // *Message.ServerResponse.Header or (if a response was returned at all) in
  4884  // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  4885  // whether the returned error was because http.StatusNotModified was returned.
  4886  func (c *UsersMessagesInsertCall) Do(opts ...googleapi.CallOption) (*Message, error) {
  4887  	gensupport.SetOptions(c.urlParams_, opts...)
  4888  	res, err := c.doRequest("json")
  4889  	if res != nil && res.StatusCode == http.StatusNotModified {
  4890  		if res.Body != nil {
  4891  			res.Body.Close()
  4892  		}
  4893  		return nil, gensupport.WrapError(&googleapi.Error{
  4894  			Code:   res.StatusCode,
  4895  			Header: res.Header,
  4896  		})
  4897  	}
  4898  	if err != nil {
  4899  		return nil, err
  4900  	}
  4901  	defer googleapi.CloseBody(res)
  4902  	if err := googleapi.CheckResponse(res); err != nil {
  4903  		return nil, gensupport.WrapError(err)
  4904  	}
  4905  	rx := c.mediaInfo_.ResumableUpload(res.Header.Get("Location"))
  4906  	if rx != nil {
  4907  		rx.Client = c.s.client
  4908  		rx.UserAgent = c.s.userAgent()
  4909  		ctx := c.ctx_
  4910  		if ctx == nil {
  4911  			ctx = context.TODO()
  4912  		}
  4913  		res, err = rx.Upload(ctx)
  4914  		if err != nil {
  4915  			return nil, err
  4916  		}
  4917  		defer res.Body.Close()
  4918  		if err := googleapi.CheckResponse(res); err != nil {
  4919  			return nil, gensupport.WrapError(err)
  4920  		}
  4921  	}
  4922  	ret := &Message{
  4923  		ServerResponse: googleapi.ServerResponse{
  4924  			Header:         res.Header,
  4925  			HTTPStatusCode: res.StatusCode,
  4926  		},
  4927  	}
  4928  	target := &ret
  4929  	if err := gensupport.DecodeResponse(target, res); err != nil {
  4930  		return nil, err
  4931  	}
  4932  	return ret, nil
  4933  }
  4934  
  4935  type UsersMessagesListCall struct {
  4936  	s            *Service
  4937  	userId       string
  4938  	urlParams_   gensupport.URLParams
  4939  	ifNoneMatch_ string
  4940  	ctx_         context.Context
  4941  	header_      http.Header
  4942  }
  4943  
  4944  // List: Lists the messages in the user's mailbox.
  4945  //
  4946  //   - userId: The user's email address. The special value `me` can be used to
  4947  //     indicate the authenticated user.
  4948  func (r *UsersMessagesService) List(userId string) *UsersMessagesListCall {
  4949  	c := &UsersMessagesListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4950  	c.userId = userId
  4951  	return c
  4952  }
  4953  
  4954  // IncludeSpamTrash sets the optional parameter "includeSpamTrash": Include
  4955  // messages from `SPAM` and `TRASH` in the results.
  4956  func (c *UsersMessagesListCall) IncludeSpamTrash(includeSpamTrash bool) *UsersMessagesListCall {
  4957  	c.urlParams_.Set("includeSpamTrash", fmt.Sprint(includeSpamTrash))
  4958  	return c
  4959  }
  4960  
  4961  // LabelIds sets the optional parameter "labelIds": Only return messages with
  4962  // labels that match all of the specified label IDs. Messages in a thread might
  4963  // have labels that other messages in the same thread don't have. To learn
  4964  // more, see Manage labels on messages and threads
  4965  // (https://developers.google.com/gmail/api/guides/labels#manage_labels_on_messages_threads).
  4966  func (c *UsersMessagesListCall) LabelIds(labelIds ...string) *UsersMessagesListCall {
  4967  	c.urlParams_.SetMulti("labelIds", append([]string{}, labelIds...))
  4968  	return c
  4969  }
  4970  
  4971  // MaxResults sets the optional parameter "maxResults": Maximum number of
  4972  // messages to return. This field defaults to 100. The maximum allowed value
  4973  // for this field is 500.
  4974  func (c *UsersMessagesListCall) MaxResults(maxResults int64) *UsersMessagesListCall {
  4975  	c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
  4976  	return c
  4977  }
  4978  
  4979  // PageToken sets the optional parameter "pageToken": Page token to retrieve a
  4980  // specific page of results in the list.
  4981  func (c *UsersMessagesListCall) PageToken(pageToken string) *UsersMessagesListCall {
  4982  	c.urlParams_.Set("pageToken", pageToken)
  4983  	return c
  4984  }
  4985  
  4986  // Q sets the optional parameter "q": Only return messages matching the
  4987  // specified query. Supports the same query format as the Gmail search box. For
  4988  // example, "from:someuser@example.com rfc822msgid: is:unread". Parameter
  4989  // cannot be used when accessing the api using the gmail.metadata scope.
  4990  func (c *UsersMessagesListCall) Q(q string) *UsersMessagesListCall {
  4991  	c.urlParams_.Set("q", q)
  4992  	return c
  4993  }
  4994  
  4995  // TemporaryEeccBypass sets the optional parameter "temporaryEeccBypass":
  4996  func (c *UsersMessagesListCall) TemporaryEeccBypass(temporaryEeccBypass bool) *UsersMessagesListCall {
  4997  	c.urlParams_.Set("temporaryEeccBypass", fmt.Sprint(temporaryEeccBypass))
  4998  	return c
  4999  }
  5000  
  5001  // Fields allows partial responses to be retrieved. See
  5002  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  5003  // details.
  5004  func (c *UsersMessagesListCall) Fields(s ...googleapi.Field) *UsersMessagesListCall {
  5005  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5006  	return c
  5007  }
  5008  
  5009  // IfNoneMatch sets an optional parameter which makes the operation fail if the
  5010  // object's ETag matches the given value. This is useful for getting updates
  5011  // only after the object has changed since the last request.
  5012  func (c *UsersMessagesListCall) IfNoneMatch(entityTag string) *UsersMessagesListCall {
  5013  	c.ifNoneMatch_ = entityTag
  5014  	return c
  5015  }
  5016  
  5017  // Context sets the context to be used in this call's Do method.
  5018  func (c *UsersMessagesListCall) Context(ctx context.Context) *UsersMessagesListCall {
  5019  	c.ctx_ = ctx
  5020  	return c
  5021  }
  5022  
  5023  // Header returns a http.Header that can be modified by the caller to add
  5024  // headers to the request.
  5025  func (c *UsersMessagesListCall) Header() http.Header {
  5026  	if c.header_ == nil {
  5027  		c.header_ = make(http.Header)
  5028  	}
  5029  	return c.header_
  5030  }
  5031  
  5032  func (c *UsersMessagesListCall) doRequest(alt string) (*http.Response, error) {
  5033  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
  5034  	if c.ifNoneMatch_ != "" {
  5035  		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  5036  	}
  5037  	var body io.Reader = nil
  5038  	c.urlParams_.Set("alt", alt)
  5039  	c.urlParams_.Set("prettyPrint", "false")
  5040  	urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/messages")
  5041  	urls += "?" + c.urlParams_.Encode()
  5042  	req, err := http.NewRequest("GET", urls, body)
  5043  	if err != nil {
  5044  		return nil, err
  5045  	}
  5046  	req.Header = reqHeaders
  5047  	googleapi.Expand(req.URL, map[string]string{
  5048  		"userId": c.userId,
  5049  	})
  5050  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  5051  }
  5052  
  5053  // Do executes the "gmail.users.messages.list" call.
  5054  // Any non-2xx status code is an error. Response headers are in either
  5055  // *ListMessagesResponse.ServerResponse.Header or (if a response was returned
  5056  // at all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  5057  // check whether the returned error was because http.StatusNotModified was
  5058  // returned.
  5059  func (c *UsersMessagesListCall) Do(opts ...googleapi.CallOption) (*ListMessagesResponse, error) {
  5060  	gensupport.SetOptions(c.urlParams_, opts...)
  5061  	res, err := c.doRequest("json")
  5062  	if res != nil && res.StatusCode == http.StatusNotModified {
  5063  		if res.Body != nil {
  5064  			res.Body.Close()
  5065  		}
  5066  		return nil, gensupport.WrapError(&googleapi.Error{
  5067  			Code:   res.StatusCode,
  5068  			Header: res.Header,
  5069  		})
  5070  	}
  5071  	if err != nil {
  5072  		return nil, err
  5073  	}
  5074  	defer googleapi.CloseBody(res)
  5075  	if err := googleapi.CheckResponse(res); err != nil {
  5076  		return nil, gensupport.WrapError(err)
  5077  	}
  5078  	ret := &ListMessagesResponse{
  5079  		ServerResponse: googleapi.ServerResponse{
  5080  			Header:         res.Header,
  5081  			HTTPStatusCode: res.StatusCode,
  5082  		},
  5083  	}
  5084  	target := &ret
  5085  	if err := gensupport.DecodeResponse(target, res); err != nil {
  5086  		return nil, err
  5087  	}
  5088  	return ret, nil
  5089  }
  5090  
  5091  // Pages invokes f for each page of results.
  5092  // A non-nil error returned from f will halt the iteration.
  5093  // The provided context supersedes any context provided to the Context method.
  5094  func (c *UsersMessagesListCall) Pages(ctx context.Context, f func(*ListMessagesResponse) error) error {
  5095  	c.ctx_ = ctx
  5096  	defer c.PageToken(c.urlParams_.Get("pageToken"))
  5097  	for {
  5098  		x, err := c.Do()
  5099  		if err != nil {
  5100  			return err
  5101  		}
  5102  		if err := f(x); err != nil {
  5103  			return err
  5104  		}
  5105  		if x.NextPageToken == "" {
  5106  			return nil
  5107  		}
  5108  		c.PageToken(x.NextPageToken)
  5109  	}
  5110  }
  5111  
  5112  type UsersMessagesModifyCall struct {
  5113  	s                    *Service
  5114  	userId               string
  5115  	id                   string
  5116  	modifymessagerequest *ModifyMessageRequest
  5117  	urlParams_           gensupport.URLParams
  5118  	ctx_                 context.Context
  5119  	header_              http.Header
  5120  }
  5121  
  5122  // Modify: Modifies the labels on the specified message.
  5123  //
  5124  //   - id: The ID of the message to modify.
  5125  //   - userId: The user's email address. The special value `me` can be used to
  5126  //     indicate the authenticated user.
  5127  func (r *UsersMessagesService) Modify(userId string, id string, modifymessagerequest *ModifyMessageRequest) *UsersMessagesModifyCall {
  5128  	c := &UsersMessagesModifyCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5129  	c.userId = userId
  5130  	c.id = id
  5131  	c.modifymessagerequest = modifymessagerequest
  5132  	return c
  5133  }
  5134  
  5135  // Fields allows partial responses to be retrieved. See
  5136  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  5137  // details.
  5138  func (c *UsersMessagesModifyCall) Fields(s ...googleapi.Field) *UsersMessagesModifyCall {
  5139  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5140  	return c
  5141  }
  5142  
  5143  // Context sets the context to be used in this call's Do method.
  5144  func (c *UsersMessagesModifyCall) Context(ctx context.Context) *UsersMessagesModifyCall {
  5145  	c.ctx_ = ctx
  5146  	return c
  5147  }
  5148  
  5149  // Header returns a http.Header that can be modified by the caller to add
  5150  // headers to the request.
  5151  func (c *UsersMessagesModifyCall) Header() http.Header {
  5152  	if c.header_ == nil {
  5153  		c.header_ = make(http.Header)
  5154  	}
  5155  	return c.header_
  5156  }
  5157  
  5158  func (c *UsersMessagesModifyCall) doRequest(alt string) (*http.Response, error) {
  5159  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
  5160  	var body io.Reader = nil
  5161  	body, err := googleapi.WithoutDataWrapper.JSONReader(c.modifymessagerequest)
  5162  	if err != nil {
  5163  		return nil, err
  5164  	}
  5165  	c.urlParams_.Set("alt", alt)
  5166  	c.urlParams_.Set("prettyPrint", "false")
  5167  	urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/messages/{id}/modify")
  5168  	urls += "?" + c.urlParams_.Encode()
  5169  	req, err := http.NewRequest("POST", urls, body)
  5170  	if err != nil {
  5171  		return nil, err
  5172  	}
  5173  	req.Header = reqHeaders
  5174  	googleapi.Expand(req.URL, map[string]string{
  5175  		"userId": c.userId,
  5176  		"id":     c.id,
  5177  	})
  5178  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  5179  }
  5180  
  5181  // Do executes the "gmail.users.messages.modify" call.
  5182  // Any non-2xx status code is an error. Response headers are in either
  5183  // *Message.ServerResponse.Header or (if a response was returned at all) in
  5184  // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  5185  // whether the returned error was because http.StatusNotModified was returned.
  5186  func (c *UsersMessagesModifyCall) Do(opts ...googleapi.CallOption) (*Message, error) {
  5187  	gensupport.SetOptions(c.urlParams_, opts...)
  5188  	res, err := c.doRequest("json")
  5189  	if res != nil && res.StatusCode == http.StatusNotModified {
  5190  		if res.Body != nil {
  5191  			res.Body.Close()
  5192  		}
  5193  		return nil, gensupport.WrapError(&googleapi.Error{
  5194  			Code:   res.StatusCode,
  5195  			Header: res.Header,
  5196  		})
  5197  	}
  5198  	if err != nil {
  5199  		return nil, err
  5200  	}
  5201  	defer googleapi.CloseBody(res)
  5202  	if err := googleapi.CheckResponse(res); err != nil {
  5203  		return nil, gensupport.WrapError(err)
  5204  	}
  5205  	ret := &Message{
  5206  		ServerResponse: googleapi.ServerResponse{
  5207  			Header:         res.Header,
  5208  			HTTPStatusCode: res.StatusCode,
  5209  		},
  5210  	}
  5211  	target := &ret
  5212  	if err := gensupport.DecodeResponse(target, res); err != nil {
  5213  		return nil, err
  5214  	}
  5215  	return ret, nil
  5216  }
  5217  
  5218  type UsersMessagesSendCall struct {
  5219  	s          *Service
  5220  	userId     string
  5221  	message    *Message
  5222  	urlParams_ gensupport.URLParams
  5223  	mediaInfo_ *gensupport.MediaInfo
  5224  	ctx_       context.Context
  5225  	header_    http.Header
  5226  }
  5227  
  5228  // Send: Sends the specified message to the recipients in the `To`, `Cc`, and
  5229  // `Bcc` headers. For example usage, see Sending email
  5230  // (https://developers.google.com/gmail/api/guides/sending).
  5231  //
  5232  //   - userId: The user's email address. The special value `me` can be used to
  5233  //     indicate the authenticated user.
  5234  func (r *UsersMessagesService) Send(userId string, message *Message) *UsersMessagesSendCall {
  5235  	c := &UsersMessagesSendCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5236  	c.userId = userId
  5237  	c.message = message
  5238  	return c
  5239  }
  5240  
  5241  // Media specifies the media to upload in one or more chunks. The chunk size
  5242  // may be controlled by supplying a MediaOption generated by
  5243  // googleapi.ChunkSize. The chunk size defaults to
  5244  // googleapi.DefaultUploadChunkSize.The Content-Type header used in the upload
  5245  // request will be determined by sniffing the contents of r, unless a
  5246  // MediaOption generated by googleapi.ContentType is supplied.
  5247  // At most one of Media and ResumableMedia may be set.
  5248  func (c *UsersMessagesSendCall) Media(r io.Reader, options ...googleapi.MediaOption) *UsersMessagesSendCall {
  5249  	c.mediaInfo_ = gensupport.NewInfoFromMedia(r, options)
  5250  	return c
  5251  }
  5252  
  5253  // ResumableMedia specifies the media to upload in chunks and can be canceled
  5254  // with ctx.
  5255  //
  5256  // Deprecated: use Media instead.
  5257  //
  5258  // At most one of Media and ResumableMedia may be set. mediaType identifies the
  5259  // MIME media type of the upload, such as "image/png". If mediaType is "", it
  5260  // will be auto-detected. The provided ctx will supersede any context
  5261  // previously provided to the Context method.
  5262  func (c *UsersMessagesSendCall) ResumableMedia(ctx context.Context, r io.ReaderAt, size int64, mediaType string) *UsersMessagesSendCall {
  5263  	c.ctx_ = ctx
  5264  	c.mediaInfo_ = gensupport.NewInfoFromResumableMedia(r, size, mediaType)
  5265  	return c
  5266  }
  5267  
  5268  // ProgressUpdater provides a callback function that will be called after every
  5269  // chunk. It should be a low-latency function in order to not slow down the
  5270  // upload operation. This should only be called when using ResumableMedia (as
  5271  // opposed to Media).
  5272  func (c *UsersMessagesSendCall) ProgressUpdater(pu googleapi.ProgressUpdater) *UsersMessagesSendCall {
  5273  	c.mediaInfo_.SetProgressUpdater(pu)
  5274  	return c
  5275  }
  5276  
  5277  // Fields allows partial responses to be retrieved. See
  5278  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  5279  // details.
  5280  func (c *UsersMessagesSendCall) Fields(s ...googleapi.Field) *UsersMessagesSendCall {
  5281  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5282  	return c
  5283  }
  5284  
  5285  // Context sets the context to be used in this call's Do method.
  5286  // This context will supersede any context previously provided to the
  5287  // ResumableMedia method.
  5288  func (c *UsersMessagesSendCall) Context(ctx context.Context) *UsersMessagesSendCall {
  5289  	c.ctx_ = ctx
  5290  	return c
  5291  }
  5292  
  5293  // Header returns a http.Header that can be modified by the caller to add
  5294  // headers to the request.
  5295  func (c *UsersMessagesSendCall) Header() http.Header {
  5296  	if c.header_ == nil {
  5297  		c.header_ = make(http.Header)
  5298  	}
  5299  	return c.header_
  5300  }
  5301  
  5302  func (c *UsersMessagesSendCall) doRequest(alt string) (*http.Response, error) {
  5303  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
  5304  	var body io.Reader = nil
  5305  	body, err := googleapi.WithoutDataWrapper.JSONReader(c.message)
  5306  	if err != nil {
  5307  		return nil, err
  5308  	}
  5309  	c.urlParams_.Set("alt", alt)
  5310  	c.urlParams_.Set("prettyPrint", "false")
  5311  	urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/messages/send")
  5312  	if c.mediaInfo_ != nil {
  5313  		urls = googleapi.ResolveRelative(c.s.BasePath, "/upload/gmail/v1/users/{userId}/messages/send")
  5314  		c.urlParams_.Set("uploadType", c.mediaInfo_.UploadType())
  5315  	}
  5316  	if body == nil {
  5317  		body = new(bytes.Buffer)
  5318  		reqHeaders.Set("Content-Type", "application/json")
  5319  	}
  5320  	body, getBody, cleanup := c.mediaInfo_.UploadRequest(reqHeaders, body)
  5321  	defer cleanup()
  5322  	urls += "?" + c.urlParams_.Encode()
  5323  	req, err := http.NewRequest("POST", urls, body)
  5324  	if err != nil {
  5325  		return nil, err
  5326  	}
  5327  	req.Header = reqHeaders
  5328  	req.GetBody = getBody
  5329  	googleapi.Expand(req.URL, map[string]string{
  5330  		"userId": c.userId,
  5331  	})
  5332  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  5333  }
  5334  
  5335  // Do executes the "gmail.users.messages.send" call.
  5336  // Any non-2xx status code is an error. Response headers are in either
  5337  // *Message.ServerResponse.Header or (if a response was returned at all) in
  5338  // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  5339  // whether the returned error was because http.StatusNotModified was returned.
  5340  func (c *UsersMessagesSendCall) Do(opts ...googleapi.CallOption) (*Message, error) {
  5341  	gensupport.SetOptions(c.urlParams_, opts...)
  5342  	res, err := c.doRequest("json")
  5343  	if res != nil && res.StatusCode == http.StatusNotModified {
  5344  		if res.Body != nil {
  5345  			res.Body.Close()
  5346  		}
  5347  		return nil, gensupport.WrapError(&googleapi.Error{
  5348  			Code:   res.StatusCode,
  5349  			Header: res.Header,
  5350  		})
  5351  	}
  5352  	if err != nil {
  5353  		return nil, err
  5354  	}
  5355  	defer googleapi.CloseBody(res)
  5356  	if err := googleapi.CheckResponse(res); err != nil {
  5357  		return nil, gensupport.WrapError(err)
  5358  	}
  5359  	rx := c.mediaInfo_.ResumableUpload(res.Header.Get("Location"))
  5360  	if rx != nil {
  5361  		rx.Client = c.s.client
  5362  		rx.UserAgent = c.s.userAgent()
  5363  		ctx := c.ctx_
  5364  		if ctx == nil {
  5365  			ctx = context.TODO()
  5366  		}
  5367  		res, err = rx.Upload(ctx)
  5368  		if err != nil {
  5369  			return nil, err
  5370  		}
  5371  		defer res.Body.Close()
  5372  		if err := googleapi.CheckResponse(res); err != nil {
  5373  			return nil, gensupport.WrapError(err)
  5374  		}
  5375  	}
  5376  	ret := &Message{
  5377  		ServerResponse: googleapi.ServerResponse{
  5378  			Header:         res.Header,
  5379  			HTTPStatusCode: res.StatusCode,
  5380  		},
  5381  	}
  5382  	target := &ret
  5383  	if err := gensupport.DecodeResponse(target, res); err != nil {
  5384  		return nil, err
  5385  	}
  5386  	return ret, nil
  5387  }
  5388  
  5389  type UsersMessagesTrashCall struct {
  5390  	s          *Service
  5391  	userId     string
  5392  	id         string
  5393  	urlParams_ gensupport.URLParams
  5394  	ctx_       context.Context
  5395  	header_    http.Header
  5396  }
  5397  
  5398  // Trash: Moves the specified message to the trash.
  5399  //
  5400  //   - id: The ID of the message to Trash.
  5401  //   - userId: The user's email address. The special value `me` can be used to
  5402  //     indicate the authenticated user.
  5403  func (r *UsersMessagesService) Trash(userId string, id string) *UsersMessagesTrashCall {
  5404  	c := &UsersMessagesTrashCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5405  	c.userId = userId
  5406  	c.id = id
  5407  	return c
  5408  }
  5409  
  5410  // Fields allows partial responses to be retrieved. See
  5411  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  5412  // details.
  5413  func (c *UsersMessagesTrashCall) Fields(s ...googleapi.Field) *UsersMessagesTrashCall {
  5414  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5415  	return c
  5416  }
  5417  
  5418  // Context sets the context to be used in this call's Do method.
  5419  func (c *UsersMessagesTrashCall) Context(ctx context.Context) *UsersMessagesTrashCall {
  5420  	c.ctx_ = ctx
  5421  	return c
  5422  }
  5423  
  5424  // Header returns a http.Header that can be modified by the caller to add
  5425  // headers to the request.
  5426  func (c *UsersMessagesTrashCall) Header() http.Header {
  5427  	if c.header_ == nil {
  5428  		c.header_ = make(http.Header)
  5429  	}
  5430  	return c.header_
  5431  }
  5432  
  5433  func (c *UsersMessagesTrashCall) doRequest(alt string) (*http.Response, error) {
  5434  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
  5435  	var body io.Reader = nil
  5436  	c.urlParams_.Set("alt", alt)
  5437  	c.urlParams_.Set("prettyPrint", "false")
  5438  	urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/messages/{id}/trash")
  5439  	urls += "?" + c.urlParams_.Encode()
  5440  	req, err := http.NewRequest("POST", urls, body)
  5441  	if err != nil {
  5442  		return nil, err
  5443  	}
  5444  	req.Header = reqHeaders
  5445  	googleapi.Expand(req.URL, map[string]string{
  5446  		"userId": c.userId,
  5447  		"id":     c.id,
  5448  	})
  5449  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  5450  }
  5451  
  5452  // Do executes the "gmail.users.messages.trash" call.
  5453  // Any non-2xx status code is an error. Response headers are in either
  5454  // *Message.ServerResponse.Header or (if a response was returned at all) in
  5455  // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  5456  // whether the returned error was because http.StatusNotModified was returned.
  5457  func (c *UsersMessagesTrashCall) Do(opts ...googleapi.CallOption) (*Message, error) {
  5458  	gensupport.SetOptions(c.urlParams_, opts...)
  5459  	res, err := c.doRequest("json")
  5460  	if res != nil && res.StatusCode == http.StatusNotModified {
  5461  		if res.Body != nil {
  5462  			res.Body.Close()
  5463  		}
  5464  		return nil, gensupport.WrapError(&googleapi.Error{
  5465  			Code:   res.StatusCode,
  5466  			Header: res.Header,
  5467  		})
  5468  	}
  5469  	if err != nil {
  5470  		return nil, err
  5471  	}
  5472  	defer googleapi.CloseBody(res)
  5473  	if err := googleapi.CheckResponse(res); err != nil {
  5474  		return nil, gensupport.WrapError(err)
  5475  	}
  5476  	ret := &Message{
  5477  		ServerResponse: googleapi.ServerResponse{
  5478  			Header:         res.Header,
  5479  			HTTPStatusCode: res.StatusCode,
  5480  		},
  5481  	}
  5482  	target := &ret
  5483  	if err := gensupport.DecodeResponse(target, res); err != nil {
  5484  		return nil, err
  5485  	}
  5486  	return ret, nil
  5487  }
  5488  
  5489  type UsersMessagesUntrashCall struct {
  5490  	s          *Service
  5491  	userId     string
  5492  	id         string
  5493  	urlParams_ gensupport.URLParams
  5494  	ctx_       context.Context
  5495  	header_    http.Header
  5496  }
  5497  
  5498  // Untrash: Removes the specified message from the trash.
  5499  //
  5500  //   - id: The ID of the message to remove from Trash.
  5501  //   - userId: The user's email address. The special value `me` can be used to
  5502  //     indicate the authenticated user.
  5503  func (r *UsersMessagesService) Untrash(userId string, id string) *UsersMessagesUntrashCall {
  5504  	c := &UsersMessagesUntrashCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5505  	c.userId = userId
  5506  	c.id = id
  5507  	return c
  5508  }
  5509  
  5510  // Fields allows partial responses to be retrieved. See
  5511  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  5512  // details.
  5513  func (c *UsersMessagesUntrashCall) Fields(s ...googleapi.Field) *UsersMessagesUntrashCall {
  5514  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5515  	return c
  5516  }
  5517  
  5518  // Context sets the context to be used in this call's Do method.
  5519  func (c *UsersMessagesUntrashCall) Context(ctx context.Context) *UsersMessagesUntrashCall {
  5520  	c.ctx_ = ctx
  5521  	return c
  5522  }
  5523  
  5524  // Header returns a http.Header that can be modified by the caller to add
  5525  // headers to the request.
  5526  func (c *UsersMessagesUntrashCall) Header() http.Header {
  5527  	if c.header_ == nil {
  5528  		c.header_ = make(http.Header)
  5529  	}
  5530  	return c.header_
  5531  }
  5532  
  5533  func (c *UsersMessagesUntrashCall) doRequest(alt string) (*http.Response, error) {
  5534  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
  5535  	var body io.Reader = nil
  5536  	c.urlParams_.Set("alt", alt)
  5537  	c.urlParams_.Set("prettyPrint", "false")
  5538  	urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/messages/{id}/untrash")
  5539  	urls += "?" + c.urlParams_.Encode()
  5540  	req, err := http.NewRequest("POST", urls, body)
  5541  	if err != nil {
  5542  		return nil, err
  5543  	}
  5544  	req.Header = reqHeaders
  5545  	googleapi.Expand(req.URL, map[string]string{
  5546  		"userId": c.userId,
  5547  		"id":     c.id,
  5548  	})
  5549  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  5550  }
  5551  
  5552  // Do executes the "gmail.users.messages.untrash" call.
  5553  // Any non-2xx status code is an error. Response headers are in either
  5554  // *Message.ServerResponse.Header or (if a response was returned at all) in
  5555  // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  5556  // whether the returned error was because http.StatusNotModified was returned.
  5557  func (c *UsersMessagesUntrashCall) Do(opts ...googleapi.CallOption) (*Message, error) {
  5558  	gensupport.SetOptions(c.urlParams_, opts...)
  5559  	res, err := c.doRequest("json")
  5560  	if res != nil && res.StatusCode == http.StatusNotModified {
  5561  		if res.Body != nil {
  5562  			res.Body.Close()
  5563  		}
  5564  		return nil, gensupport.WrapError(&googleapi.Error{
  5565  			Code:   res.StatusCode,
  5566  			Header: res.Header,
  5567  		})
  5568  	}
  5569  	if err != nil {
  5570  		return nil, err
  5571  	}
  5572  	defer googleapi.CloseBody(res)
  5573  	if err := googleapi.CheckResponse(res); err != nil {
  5574  		return nil, gensupport.WrapError(err)
  5575  	}
  5576  	ret := &Message{
  5577  		ServerResponse: googleapi.ServerResponse{
  5578  			Header:         res.Header,
  5579  			HTTPStatusCode: res.StatusCode,
  5580  		},
  5581  	}
  5582  	target := &ret
  5583  	if err := gensupport.DecodeResponse(target, res); err != nil {
  5584  		return nil, err
  5585  	}
  5586  	return ret, nil
  5587  }
  5588  
  5589  type UsersMessagesAttachmentsGetCall struct {
  5590  	s            *Service
  5591  	userId       string
  5592  	messageId    string
  5593  	id           string
  5594  	urlParams_   gensupport.URLParams
  5595  	ifNoneMatch_ string
  5596  	ctx_         context.Context
  5597  	header_      http.Header
  5598  }
  5599  
  5600  // Get: Gets the specified message attachment.
  5601  //
  5602  //   - id: The ID of the attachment.
  5603  //   - messageId: The ID of the message containing the attachment.
  5604  //   - userId: The user's email address. The special value `me` can be used to
  5605  //     indicate the authenticated user.
  5606  func (r *UsersMessagesAttachmentsService) Get(userId string, messageId string, id string) *UsersMessagesAttachmentsGetCall {
  5607  	c := &UsersMessagesAttachmentsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5608  	c.userId = userId
  5609  	c.messageId = messageId
  5610  	c.id = id
  5611  	return c
  5612  }
  5613  
  5614  // TemporaryEeccBypass sets the optional parameter "temporaryEeccBypass":
  5615  func (c *UsersMessagesAttachmentsGetCall) TemporaryEeccBypass(temporaryEeccBypass bool) *UsersMessagesAttachmentsGetCall {
  5616  	c.urlParams_.Set("temporaryEeccBypass", fmt.Sprint(temporaryEeccBypass))
  5617  	return c
  5618  }
  5619  
  5620  // Fields allows partial responses to be retrieved. See
  5621  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  5622  // details.
  5623  func (c *UsersMessagesAttachmentsGetCall) Fields(s ...googleapi.Field) *UsersMessagesAttachmentsGetCall {
  5624  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5625  	return c
  5626  }
  5627  
  5628  // IfNoneMatch sets an optional parameter which makes the operation fail if the
  5629  // object's ETag matches the given value. This is useful for getting updates
  5630  // only after the object has changed since the last request.
  5631  func (c *UsersMessagesAttachmentsGetCall) IfNoneMatch(entityTag string) *UsersMessagesAttachmentsGetCall {
  5632  	c.ifNoneMatch_ = entityTag
  5633  	return c
  5634  }
  5635  
  5636  // Context sets the context to be used in this call's Do method.
  5637  func (c *UsersMessagesAttachmentsGetCall) Context(ctx context.Context) *UsersMessagesAttachmentsGetCall {
  5638  	c.ctx_ = ctx
  5639  	return c
  5640  }
  5641  
  5642  // Header returns a http.Header that can be modified by the caller to add
  5643  // headers to the request.
  5644  func (c *UsersMessagesAttachmentsGetCall) Header() http.Header {
  5645  	if c.header_ == nil {
  5646  		c.header_ = make(http.Header)
  5647  	}
  5648  	return c.header_
  5649  }
  5650  
  5651  func (c *UsersMessagesAttachmentsGetCall) doRequest(alt string) (*http.Response, error) {
  5652  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
  5653  	if c.ifNoneMatch_ != "" {
  5654  		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  5655  	}
  5656  	var body io.Reader = nil
  5657  	c.urlParams_.Set("alt", alt)
  5658  	c.urlParams_.Set("prettyPrint", "false")
  5659  	urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/messages/{messageId}/attachments/{id}")
  5660  	urls += "?" + c.urlParams_.Encode()
  5661  	req, err := http.NewRequest("GET", urls, body)
  5662  	if err != nil {
  5663  		return nil, err
  5664  	}
  5665  	req.Header = reqHeaders
  5666  	googleapi.Expand(req.URL, map[string]string{
  5667  		"userId":    c.userId,
  5668  		"messageId": c.messageId,
  5669  		"id":        c.id,
  5670  	})
  5671  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  5672  }
  5673  
  5674  // Do executes the "gmail.users.messages.attachments.get" call.
  5675  // Any non-2xx status code is an error. Response headers are in either
  5676  // *MessagePartBody.ServerResponse.Header or (if a response was returned at
  5677  // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  5678  // check whether the returned error was because http.StatusNotModified was
  5679  // returned.
  5680  func (c *UsersMessagesAttachmentsGetCall) Do(opts ...googleapi.CallOption) (*MessagePartBody, error) {
  5681  	gensupport.SetOptions(c.urlParams_, opts...)
  5682  	res, err := c.doRequest("json")
  5683  	if res != nil && res.StatusCode == http.StatusNotModified {
  5684  		if res.Body != nil {
  5685  			res.Body.Close()
  5686  		}
  5687  		return nil, gensupport.WrapError(&googleapi.Error{
  5688  			Code:   res.StatusCode,
  5689  			Header: res.Header,
  5690  		})
  5691  	}
  5692  	if err != nil {
  5693  		return nil, err
  5694  	}
  5695  	defer googleapi.CloseBody(res)
  5696  	if err := googleapi.CheckResponse(res); err != nil {
  5697  		return nil, gensupport.WrapError(err)
  5698  	}
  5699  	ret := &MessagePartBody{
  5700  		ServerResponse: googleapi.ServerResponse{
  5701  			Header:         res.Header,
  5702  			HTTPStatusCode: res.StatusCode,
  5703  		},
  5704  	}
  5705  	target := &ret
  5706  	if err := gensupport.DecodeResponse(target, res); err != nil {
  5707  		return nil, err
  5708  	}
  5709  	return ret, nil
  5710  }
  5711  
  5712  type UsersSettingsGetAutoForwardingCall struct {
  5713  	s            *Service
  5714  	userId       string
  5715  	urlParams_   gensupport.URLParams
  5716  	ifNoneMatch_ string
  5717  	ctx_         context.Context
  5718  	header_      http.Header
  5719  }
  5720  
  5721  // GetAutoForwarding: Gets the auto-forwarding setting for the specified
  5722  // account.
  5723  //
  5724  //   - userId: User's email address. The special value "me" can be used to
  5725  //     indicate the authenticated user.
  5726  func (r *UsersSettingsService) GetAutoForwarding(userId string) *UsersSettingsGetAutoForwardingCall {
  5727  	c := &UsersSettingsGetAutoForwardingCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5728  	c.userId = userId
  5729  	return c
  5730  }
  5731  
  5732  // Fields allows partial responses to be retrieved. See
  5733  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  5734  // details.
  5735  func (c *UsersSettingsGetAutoForwardingCall) Fields(s ...googleapi.Field) *UsersSettingsGetAutoForwardingCall {
  5736  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5737  	return c
  5738  }
  5739  
  5740  // IfNoneMatch sets an optional parameter which makes the operation fail if the
  5741  // object's ETag matches the given value. This is useful for getting updates
  5742  // only after the object has changed since the last request.
  5743  func (c *UsersSettingsGetAutoForwardingCall) IfNoneMatch(entityTag string) *UsersSettingsGetAutoForwardingCall {
  5744  	c.ifNoneMatch_ = entityTag
  5745  	return c
  5746  }
  5747  
  5748  // Context sets the context to be used in this call's Do method.
  5749  func (c *UsersSettingsGetAutoForwardingCall) Context(ctx context.Context) *UsersSettingsGetAutoForwardingCall {
  5750  	c.ctx_ = ctx
  5751  	return c
  5752  }
  5753  
  5754  // Header returns a http.Header that can be modified by the caller to add
  5755  // headers to the request.
  5756  func (c *UsersSettingsGetAutoForwardingCall) Header() http.Header {
  5757  	if c.header_ == nil {
  5758  		c.header_ = make(http.Header)
  5759  	}
  5760  	return c.header_
  5761  }
  5762  
  5763  func (c *UsersSettingsGetAutoForwardingCall) doRequest(alt string) (*http.Response, error) {
  5764  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
  5765  	if c.ifNoneMatch_ != "" {
  5766  		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  5767  	}
  5768  	var body io.Reader = nil
  5769  	c.urlParams_.Set("alt", alt)
  5770  	c.urlParams_.Set("prettyPrint", "false")
  5771  	urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/settings/autoForwarding")
  5772  	urls += "?" + c.urlParams_.Encode()
  5773  	req, err := http.NewRequest("GET", urls, body)
  5774  	if err != nil {
  5775  		return nil, err
  5776  	}
  5777  	req.Header = reqHeaders
  5778  	googleapi.Expand(req.URL, map[string]string{
  5779  		"userId": c.userId,
  5780  	})
  5781  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  5782  }
  5783  
  5784  // Do executes the "gmail.users.settings.getAutoForwarding" call.
  5785  // Any non-2xx status code is an error. Response headers are in either
  5786  // *AutoForwarding.ServerResponse.Header or (if a response was returned at all)
  5787  // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  5788  // whether the returned error was because http.StatusNotModified was returned.
  5789  func (c *UsersSettingsGetAutoForwardingCall) Do(opts ...googleapi.CallOption) (*AutoForwarding, error) {
  5790  	gensupport.SetOptions(c.urlParams_, opts...)
  5791  	res, err := c.doRequest("json")
  5792  	if res != nil && res.StatusCode == http.StatusNotModified {
  5793  		if res.Body != nil {
  5794  			res.Body.Close()
  5795  		}
  5796  		return nil, gensupport.WrapError(&googleapi.Error{
  5797  			Code:   res.StatusCode,
  5798  			Header: res.Header,
  5799  		})
  5800  	}
  5801  	if err != nil {
  5802  		return nil, err
  5803  	}
  5804  	defer googleapi.CloseBody(res)
  5805  	if err := googleapi.CheckResponse(res); err != nil {
  5806  		return nil, gensupport.WrapError(err)
  5807  	}
  5808  	ret := &AutoForwarding{
  5809  		ServerResponse: googleapi.ServerResponse{
  5810  			Header:         res.Header,
  5811  			HTTPStatusCode: res.StatusCode,
  5812  		},
  5813  	}
  5814  	target := &ret
  5815  	if err := gensupport.DecodeResponse(target, res); err != nil {
  5816  		return nil, err
  5817  	}
  5818  	return ret, nil
  5819  }
  5820  
  5821  type UsersSettingsGetImapCall struct {
  5822  	s            *Service
  5823  	userId       string
  5824  	urlParams_   gensupport.URLParams
  5825  	ifNoneMatch_ string
  5826  	ctx_         context.Context
  5827  	header_      http.Header
  5828  }
  5829  
  5830  // GetImap: Gets IMAP settings.
  5831  //
  5832  //   - userId: User's email address. The special value "me" can be used to
  5833  //     indicate the authenticated user.
  5834  func (r *UsersSettingsService) GetImap(userId string) *UsersSettingsGetImapCall {
  5835  	c := &UsersSettingsGetImapCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5836  	c.userId = userId
  5837  	return c
  5838  }
  5839  
  5840  // Fields allows partial responses to be retrieved. See
  5841  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  5842  // details.
  5843  func (c *UsersSettingsGetImapCall) Fields(s ...googleapi.Field) *UsersSettingsGetImapCall {
  5844  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5845  	return c
  5846  }
  5847  
  5848  // IfNoneMatch sets an optional parameter which makes the operation fail if the
  5849  // object's ETag matches the given value. This is useful for getting updates
  5850  // only after the object has changed since the last request.
  5851  func (c *UsersSettingsGetImapCall) IfNoneMatch(entityTag string) *UsersSettingsGetImapCall {
  5852  	c.ifNoneMatch_ = entityTag
  5853  	return c
  5854  }
  5855  
  5856  // Context sets the context to be used in this call's Do method.
  5857  func (c *UsersSettingsGetImapCall) Context(ctx context.Context) *UsersSettingsGetImapCall {
  5858  	c.ctx_ = ctx
  5859  	return c
  5860  }
  5861  
  5862  // Header returns a http.Header that can be modified by the caller to add
  5863  // headers to the request.
  5864  func (c *UsersSettingsGetImapCall) Header() http.Header {
  5865  	if c.header_ == nil {
  5866  		c.header_ = make(http.Header)
  5867  	}
  5868  	return c.header_
  5869  }
  5870  
  5871  func (c *UsersSettingsGetImapCall) doRequest(alt string) (*http.Response, error) {
  5872  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
  5873  	if c.ifNoneMatch_ != "" {
  5874  		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  5875  	}
  5876  	var body io.Reader = nil
  5877  	c.urlParams_.Set("alt", alt)
  5878  	c.urlParams_.Set("prettyPrint", "false")
  5879  	urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/settings/imap")
  5880  	urls += "?" + c.urlParams_.Encode()
  5881  	req, err := http.NewRequest("GET", urls, body)
  5882  	if err != nil {
  5883  		return nil, err
  5884  	}
  5885  	req.Header = reqHeaders
  5886  	googleapi.Expand(req.URL, map[string]string{
  5887  		"userId": c.userId,
  5888  	})
  5889  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  5890  }
  5891  
  5892  // Do executes the "gmail.users.settings.getImap" call.
  5893  // Any non-2xx status code is an error. Response headers are in either
  5894  // *ImapSettings.ServerResponse.Header or (if a response was returned at all)
  5895  // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  5896  // whether the returned error was because http.StatusNotModified was returned.
  5897  func (c *UsersSettingsGetImapCall) Do(opts ...googleapi.CallOption) (*ImapSettings, error) {
  5898  	gensupport.SetOptions(c.urlParams_, opts...)
  5899  	res, err := c.doRequest("json")
  5900  	if res != nil && res.StatusCode == http.StatusNotModified {
  5901  		if res.Body != nil {
  5902  			res.Body.Close()
  5903  		}
  5904  		return nil, gensupport.WrapError(&googleapi.Error{
  5905  			Code:   res.StatusCode,
  5906  			Header: res.Header,
  5907  		})
  5908  	}
  5909  	if err != nil {
  5910  		return nil, err
  5911  	}
  5912  	defer googleapi.CloseBody(res)
  5913  	if err := googleapi.CheckResponse(res); err != nil {
  5914  		return nil, gensupport.WrapError(err)
  5915  	}
  5916  	ret := &ImapSettings{
  5917  		ServerResponse: googleapi.ServerResponse{
  5918  			Header:         res.Header,
  5919  			HTTPStatusCode: res.StatusCode,
  5920  		},
  5921  	}
  5922  	target := &ret
  5923  	if err := gensupport.DecodeResponse(target, res); err != nil {
  5924  		return nil, err
  5925  	}
  5926  	return ret, nil
  5927  }
  5928  
  5929  type UsersSettingsGetLanguageCall struct {
  5930  	s            *Service
  5931  	userId       string
  5932  	urlParams_   gensupport.URLParams
  5933  	ifNoneMatch_ string
  5934  	ctx_         context.Context
  5935  	header_      http.Header
  5936  }
  5937  
  5938  // GetLanguage: Gets language settings.
  5939  //
  5940  //   - userId: User's email address. The special value "me" can be used to
  5941  //     indicate the authenticated user.
  5942  func (r *UsersSettingsService) GetLanguage(userId string) *UsersSettingsGetLanguageCall {
  5943  	c := &UsersSettingsGetLanguageCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5944  	c.userId = userId
  5945  	return c
  5946  }
  5947  
  5948  // Fields allows partial responses to be retrieved. See
  5949  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  5950  // details.
  5951  func (c *UsersSettingsGetLanguageCall) Fields(s ...googleapi.Field) *UsersSettingsGetLanguageCall {
  5952  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5953  	return c
  5954  }
  5955  
  5956  // IfNoneMatch sets an optional parameter which makes the operation fail if the
  5957  // object's ETag matches the given value. This is useful for getting updates
  5958  // only after the object has changed since the last request.
  5959  func (c *UsersSettingsGetLanguageCall) IfNoneMatch(entityTag string) *UsersSettingsGetLanguageCall {
  5960  	c.ifNoneMatch_ = entityTag
  5961  	return c
  5962  }
  5963  
  5964  // Context sets the context to be used in this call's Do method.
  5965  func (c *UsersSettingsGetLanguageCall) Context(ctx context.Context) *UsersSettingsGetLanguageCall {
  5966  	c.ctx_ = ctx
  5967  	return c
  5968  }
  5969  
  5970  // Header returns a http.Header that can be modified by the caller to add
  5971  // headers to the request.
  5972  func (c *UsersSettingsGetLanguageCall) Header() http.Header {
  5973  	if c.header_ == nil {
  5974  		c.header_ = make(http.Header)
  5975  	}
  5976  	return c.header_
  5977  }
  5978  
  5979  func (c *UsersSettingsGetLanguageCall) doRequest(alt string) (*http.Response, error) {
  5980  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
  5981  	if c.ifNoneMatch_ != "" {
  5982  		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  5983  	}
  5984  	var body io.Reader = nil
  5985  	c.urlParams_.Set("alt", alt)
  5986  	c.urlParams_.Set("prettyPrint", "false")
  5987  	urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/settings/language")
  5988  	urls += "?" + c.urlParams_.Encode()
  5989  	req, err := http.NewRequest("GET", urls, body)
  5990  	if err != nil {
  5991  		return nil, err
  5992  	}
  5993  	req.Header = reqHeaders
  5994  	googleapi.Expand(req.URL, map[string]string{
  5995  		"userId": c.userId,
  5996  	})
  5997  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  5998  }
  5999  
  6000  // Do executes the "gmail.users.settings.getLanguage" call.
  6001  // Any non-2xx status code is an error. Response headers are in either
  6002  // *LanguageSettings.ServerResponse.Header or (if a response was returned at
  6003  // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  6004  // check whether the returned error was because http.StatusNotModified was
  6005  // returned.
  6006  func (c *UsersSettingsGetLanguageCall) Do(opts ...googleapi.CallOption) (*LanguageSettings, error) {
  6007  	gensupport.SetOptions(c.urlParams_, opts...)
  6008  	res, err := c.doRequest("json")
  6009  	if res != nil && res.StatusCode == http.StatusNotModified {
  6010  		if res.Body != nil {
  6011  			res.Body.Close()
  6012  		}
  6013  		return nil, gensupport.WrapError(&googleapi.Error{
  6014  			Code:   res.StatusCode,
  6015  			Header: res.Header,
  6016  		})
  6017  	}
  6018  	if err != nil {
  6019  		return nil, err
  6020  	}
  6021  	defer googleapi.CloseBody(res)
  6022  	if err := googleapi.CheckResponse(res); err != nil {
  6023  		return nil, gensupport.WrapError(err)
  6024  	}
  6025  	ret := &LanguageSettings{
  6026  		ServerResponse: googleapi.ServerResponse{
  6027  			Header:         res.Header,
  6028  			HTTPStatusCode: res.StatusCode,
  6029  		},
  6030  	}
  6031  	target := &ret
  6032  	if err := gensupport.DecodeResponse(target, res); err != nil {
  6033  		return nil, err
  6034  	}
  6035  	return ret, nil
  6036  }
  6037  
  6038  type UsersSettingsGetPopCall struct {
  6039  	s            *Service
  6040  	userId       string
  6041  	urlParams_   gensupport.URLParams
  6042  	ifNoneMatch_ string
  6043  	ctx_         context.Context
  6044  	header_      http.Header
  6045  }
  6046  
  6047  // GetPop: Gets POP settings.
  6048  //
  6049  //   - userId: User's email address. The special value "me" can be used to
  6050  //     indicate the authenticated user.
  6051  func (r *UsersSettingsService) GetPop(userId string) *UsersSettingsGetPopCall {
  6052  	c := &UsersSettingsGetPopCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  6053  	c.userId = userId
  6054  	return c
  6055  }
  6056  
  6057  // Fields allows partial responses to be retrieved. See
  6058  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  6059  // details.
  6060  func (c *UsersSettingsGetPopCall) Fields(s ...googleapi.Field) *UsersSettingsGetPopCall {
  6061  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  6062  	return c
  6063  }
  6064  
  6065  // IfNoneMatch sets an optional parameter which makes the operation fail if the
  6066  // object's ETag matches the given value. This is useful for getting updates
  6067  // only after the object has changed since the last request.
  6068  func (c *UsersSettingsGetPopCall) IfNoneMatch(entityTag string) *UsersSettingsGetPopCall {
  6069  	c.ifNoneMatch_ = entityTag
  6070  	return c
  6071  }
  6072  
  6073  // Context sets the context to be used in this call's Do method.
  6074  func (c *UsersSettingsGetPopCall) Context(ctx context.Context) *UsersSettingsGetPopCall {
  6075  	c.ctx_ = ctx
  6076  	return c
  6077  }
  6078  
  6079  // Header returns a http.Header that can be modified by the caller to add
  6080  // headers to the request.
  6081  func (c *UsersSettingsGetPopCall) Header() http.Header {
  6082  	if c.header_ == nil {
  6083  		c.header_ = make(http.Header)
  6084  	}
  6085  	return c.header_
  6086  }
  6087  
  6088  func (c *UsersSettingsGetPopCall) doRequest(alt string) (*http.Response, error) {
  6089  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
  6090  	if c.ifNoneMatch_ != "" {
  6091  		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  6092  	}
  6093  	var body io.Reader = nil
  6094  	c.urlParams_.Set("alt", alt)
  6095  	c.urlParams_.Set("prettyPrint", "false")
  6096  	urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/settings/pop")
  6097  	urls += "?" + c.urlParams_.Encode()
  6098  	req, err := http.NewRequest("GET", urls, body)
  6099  	if err != nil {
  6100  		return nil, err
  6101  	}
  6102  	req.Header = reqHeaders
  6103  	googleapi.Expand(req.URL, map[string]string{
  6104  		"userId": c.userId,
  6105  	})
  6106  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  6107  }
  6108  
  6109  // Do executes the "gmail.users.settings.getPop" call.
  6110  // Any non-2xx status code is an error. Response headers are in either
  6111  // *PopSettings.ServerResponse.Header or (if a response was returned at all) in
  6112  // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  6113  // whether the returned error was because http.StatusNotModified was returned.
  6114  func (c *UsersSettingsGetPopCall) Do(opts ...googleapi.CallOption) (*PopSettings, error) {
  6115  	gensupport.SetOptions(c.urlParams_, opts...)
  6116  	res, err := c.doRequest("json")
  6117  	if res != nil && res.StatusCode == http.StatusNotModified {
  6118  		if res.Body != nil {
  6119  			res.Body.Close()
  6120  		}
  6121  		return nil, gensupport.WrapError(&googleapi.Error{
  6122  			Code:   res.StatusCode,
  6123  			Header: res.Header,
  6124  		})
  6125  	}
  6126  	if err != nil {
  6127  		return nil, err
  6128  	}
  6129  	defer googleapi.CloseBody(res)
  6130  	if err := googleapi.CheckResponse(res); err != nil {
  6131  		return nil, gensupport.WrapError(err)
  6132  	}
  6133  	ret := &PopSettings{
  6134  		ServerResponse: googleapi.ServerResponse{
  6135  			Header:         res.Header,
  6136  			HTTPStatusCode: res.StatusCode,
  6137  		},
  6138  	}
  6139  	target := &ret
  6140  	if err := gensupport.DecodeResponse(target, res); err != nil {
  6141  		return nil, err
  6142  	}
  6143  	return ret, nil
  6144  }
  6145  
  6146  type UsersSettingsGetVacationCall struct {
  6147  	s            *Service
  6148  	userId       string
  6149  	urlParams_   gensupport.URLParams
  6150  	ifNoneMatch_ string
  6151  	ctx_         context.Context
  6152  	header_      http.Header
  6153  }
  6154  
  6155  // GetVacation: Gets vacation responder settings.
  6156  //
  6157  //   - userId: User's email address. The special value "me" can be used to
  6158  //     indicate the authenticated user.
  6159  func (r *UsersSettingsService) GetVacation(userId string) *UsersSettingsGetVacationCall {
  6160  	c := &UsersSettingsGetVacationCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  6161  	c.userId = userId
  6162  	return c
  6163  }
  6164  
  6165  // Fields allows partial responses to be retrieved. See
  6166  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  6167  // details.
  6168  func (c *UsersSettingsGetVacationCall) Fields(s ...googleapi.Field) *UsersSettingsGetVacationCall {
  6169  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  6170  	return c
  6171  }
  6172  
  6173  // IfNoneMatch sets an optional parameter which makes the operation fail if the
  6174  // object's ETag matches the given value. This is useful for getting updates
  6175  // only after the object has changed since the last request.
  6176  func (c *UsersSettingsGetVacationCall) IfNoneMatch(entityTag string) *UsersSettingsGetVacationCall {
  6177  	c.ifNoneMatch_ = entityTag
  6178  	return c
  6179  }
  6180  
  6181  // Context sets the context to be used in this call's Do method.
  6182  func (c *UsersSettingsGetVacationCall) Context(ctx context.Context) *UsersSettingsGetVacationCall {
  6183  	c.ctx_ = ctx
  6184  	return c
  6185  }
  6186  
  6187  // Header returns a http.Header that can be modified by the caller to add
  6188  // headers to the request.
  6189  func (c *UsersSettingsGetVacationCall) Header() http.Header {
  6190  	if c.header_ == nil {
  6191  		c.header_ = make(http.Header)
  6192  	}
  6193  	return c.header_
  6194  }
  6195  
  6196  func (c *UsersSettingsGetVacationCall) doRequest(alt string) (*http.Response, error) {
  6197  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
  6198  	if c.ifNoneMatch_ != "" {
  6199  		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  6200  	}
  6201  	var body io.Reader = nil
  6202  	c.urlParams_.Set("alt", alt)
  6203  	c.urlParams_.Set("prettyPrint", "false")
  6204  	urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/settings/vacation")
  6205  	urls += "?" + c.urlParams_.Encode()
  6206  	req, err := http.NewRequest("GET", urls, body)
  6207  	if err != nil {
  6208  		return nil, err
  6209  	}
  6210  	req.Header = reqHeaders
  6211  	googleapi.Expand(req.URL, map[string]string{
  6212  		"userId": c.userId,
  6213  	})
  6214  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  6215  }
  6216  
  6217  // Do executes the "gmail.users.settings.getVacation" call.
  6218  // Any non-2xx status code is an error. Response headers are in either
  6219  // *VacationSettings.ServerResponse.Header or (if a response was returned at
  6220  // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  6221  // check whether the returned error was because http.StatusNotModified was
  6222  // returned.
  6223  func (c *UsersSettingsGetVacationCall) Do(opts ...googleapi.CallOption) (*VacationSettings, error) {
  6224  	gensupport.SetOptions(c.urlParams_, opts...)
  6225  	res, err := c.doRequest("json")
  6226  	if res != nil && res.StatusCode == http.StatusNotModified {
  6227  		if res.Body != nil {
  6228  			res.Body.Close()
  6229  		}
  6230  		return nil, gensupport.WrapError(&googleapi.Error{
  6231  			Code:   res.StatusCode,
  6232  			Header: res.Header,
  6233  		})
  6234  	}
  6235  	if err != nil {
  6236  		return nil, err
  6237  	}
  6238  	defer googleapi.CloseBody(res)
  6239  	if err := googleapi.CheckResponse(res); err != nil {
  6240  		return nil, gensupport.WrapError(err)
  6241  	}
  6242  	ret := &VacationSettings{
  6243  		ServerResponse: googleapi.ServerResponse{
  6244  			Header:         res.Header,
  6245  			HTTPStatusCode: res.StatusCode,
  6246  		},
  6247  	}
  6248  	target := &ret
  6249  	if err := gensupport.DecodeResponse(target, res); err != nil {
  6250  		return nil, err
  6251  	}
  6252  	return ret, nil
  6253  }
  6254  
  6255  type UsersSettingsUpdateAutoForwardingCall struct {
  6256  	s              *Service
  6257  	userId         string
  6258  	autoforwarding *AutoForwarding
  6259  	urlParams_     gensupport.URLParams
  6260  	ctx_           context.Context
  6261  	header_        http.Header
  6262  }
  6263  
  6264  // UpdateAutoForwarding: Updates the auto-forwarding setting for the specified
  6265  // account. A verified forwarding address must be specified when
  6266  // auto-forwarding is enabled. This method is only available to service account
  6267  // clients that have been delegated domain-wide authority.
  6268  //
  6269  //   - userId: User's email address. The special value "me" can be used to
  6270  //     indicate the authenticated user.
  6271  func (r *UsersSettingsService) UpdateAutoForwarding(userId string, autoforwarding *AutoForwarding) *UsersSettingsUpdateAutoForwardingCall {
  6272  	c := &UsersSettingsUpdateAutoForwardingCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  6273  	c.userId = userId
  6274  	c.autoforwarding = autoforwarding
  6275  	return c
  6276  }
  6277  
  6278  // Fields allows partial responses to be retrieved. See
  6279  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  6280  // details.
  6281  func (c *UsersSettingsUpdateAutoForwardingCall) Fields(s ...googleapi.Field) *UsersSettingsUpdateAutoForwardingCall {
  6282  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  6283  	return c
  6284  }
  6285  
  6286  // Context sets the context to be used in this call's Do method.
  6287  func (c *UsersSettingsUpdateAutoForwardingCall) Context(ctx context.Context) *UsersSettingsUpdateAutoForwardingCall {
  6288  	c.ctx_ = ctx
  6289  	return c
  6290  }
  6291  
  6292  // Header returns a http.Header that can be modified by the caller to add
  6293  // headers to the request.
  6294  func (c *UsersSettingsUpdateAutoForwardingCall) Header() http.Header {
  6295  	if c.header_ == nil {
  6296  		c.header_ = make(http.Header)
  6297  	}
  6298  	return c.header_
  6299  }
  6300  
  6301  func (c *UsersSettingsUpdateAutoForwardingCall) doRequest(alt string) (*http.Response, error) {
  6302  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
  6303  	var body io.Reader = nil
  6304  	body, err := googleapi.WithoutDataWrapper.JSONReader(c.autoforwarding)
  6305  	if err != nil {
  6306  		return nil, err
  6307  	}
  6308  	c.urlParams_.Set("alt", alt)
  6309  	c.urlParams_.Set("prettyPrint", "false")
  6310  	urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/settings/autoForwarding")
  6311  	urls += "?" + c.urlParams_.Encode()
  6312  	req, err := http.NewRequest("PUT", urls, body)
  6313  	if err != nil {
  6314  		return nil, err
  6315  	}
  6316  	req.Header = reqHeaders
  6317  	googleapi.Expand(req.URL, map[string]string{
  6318  		"userId": c.userId,
  6319  	})
  6320  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  6321  }
  6322  
  6323  // Do executes the "gmail.users.settings.updateAutoForwarding" call.
  6324  // Any non-2xx status code is an error. Response headers are in either
  6325  // *AutoForwarding.ServerResponse.Header or (if a response was returned at all)
  6326  // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  6327  // whether the returned error was because http.StatusNotModified was returned.
  6328  func (c *UsersSettingsUpdateAutoForwardingCall) Do(opts ...googleapi.CallOption) (*AutoForwarding, error) {
  6329  	gensupport.SetOptions(c.urlParams_, opts...)
  6330  	res, err := c.doRequest("json")
  6331  	if res != nil && res.StatusCode == http.StatusNotModified {
  6332  		if res.Body != nil {
  6333  			res.Body.Close()
  6334  		}
  6335  		return nil, gensupport.WrapError(&googleapi.Error{
  6336  			Code:   res.StatusCode,
  6337  			Header: res.Header,
  6338  		})
  6339  	}
  6340  	if err != nil {
  6341  		return nil, err
  6342  	}
  6343  	defer googleapi.CloseBody(res)
  6344  	if err := googleapi.CheckResponse(res); err != nil {
  6345  		return nil, gensupport.WrapError(err)
  6346  	}
  6347  	ret := &AutoForwarding{
  6348  		ServerResponse: googleapi.ServerResponse{
  6349  			Header:         res.Header,
  6350  			HTTPStatusCode: res.StatusCode,
  6351  		},
  6352  	}
  6353  	target := &ret
  6354  	if err := gensupport.DecodeResponse(target, res); err != nil {
  6355  		return nil, err
  6356  	}
  6357  	return ret, nil
  6358  }
  6359  
  6360  type UsersSettingsUpdateImapCall struct {
  6361  	s            *Service
  6362  	userId       string
  6363  	imapsettings *ImapSettings
  6364  	urlParams_   gensupport.URLParams
  6365  	ctx_         context.Context
  6366  	header_      http.Header
  6367  }
  6368  
  6369  // UpdateImap: Updates IMAP settings.
  6370  //
  6371  //   - userId: User's email address. The special value "me" can be used to
  6372  //     indicate the authenticated user.
  6373  func (r *UsersSettingsService) UpdateImap(userId string, imapsettings *ImapSettings) *UsersSettingsUpdateImapCall {
  6374  	c := &UsersSettingsUpdateImapCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  6375  	c.userId = userId
  6376  	c.imapsettings = imapsettings
  6377  	return c
  6378  }
  6379  
  6380  // Fields allows partial responses to be retrieved. See
  6381  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  6382  // details.
  6383  func (c *UsersSettingsUpdateImapCall) Fields(s ...googleapi.Field) *UsersSettingsUpdateImapCall {
  6384  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  6385  	return c
  6386  }
  6387  
  6388  // Context sets the context to be used in this call's Do method.
  6389  func (c *UsersSettingsUpdateImapCall) Context(ctx context.Context) *UsersSettingsUpdateImapCall {
  6390  	c.ctx_ = ctx
  6391  	return c
  6392  }
  6393  
  6394  // Header returns a http.Header that can be modified by the caller to add
  6395  // headers to the request.
  6396  func (c *UsersSettingsUpdateImapCall) Header() http.Header {
  6397  	if c.header_ == nil {
  6398  		c.header_ = make(http.Header)
  6399  	}
  6400  	return c.header_
  6401  }
  6402  
  6403  func (c *UsersSettingsUpdateImapCall) doRequest(alt string) (*http.Response, error) {
  6404  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
  6405  	var body io.Reader = nil
  6406  	body, err := googleapi.WithoutDataWrapper.JSONReader(c.imapsettings)
  6407  	if err != nil {
  6408  		return nil, err
  6409  	}
  6410  	c.urlParams_.Set("alt", alt)
  6411  	c.urlParams_.Set("prettyPrint", "false")
  6412  	urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/settings/imap")
  6413  	urls += "?" + c.urlParams_.Encode()
  6414  	req, err := http.NewRequest("PUT", urls, body)
  6415  	if err != nil {
  6416  		return nil, err
  6417  	}
  6418  	req.Header = reqHeaders
  6419  	googleapi.Expand(req.URL, map[string]string{
  6420  		"userId": c.userId,
  6421  	})
  6422  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  6423  }
  6424  
  6425  // Do executes the "gmail.users.settings.updateImap" call.
  6426  // Any non-2xx status code is an error. Response headers are in either
  6427  // *ImapSettings.ServerResponse.Header or (if a response was returned at all)
  6428  // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  6429  // whether the returned error was because http.StatusNotModified was returned.
  6430  func (c *UsersSettingsUpdateImapCall) Do(opts ...googleapi.CallOption) (*ImapSettings, error) {
  6431  	gensupport.SetOptions(c.urlParams_, opts...)
  6432  	res, err := c.doRequest("json")
  6433  	if res != nil && res.StatusCode == http.StatusNotModified {
  6434  		if res.Body != nil {
  6435  			res.Body.Close()
  6436  		}
  6437  		return nil, gensupport.WrapError(&googleapi.Error{
  6438  			Code:   res.StatusCode,
  6439  			Header: res.Header,
  6440  		})
  6441  	}
  6442  	if err != nil {
  6443  		return nil, err
  6444  	}
  6445  	defer googleapi.CloseBody(res)
  6446  	if err := googleapi.CheckResponse(res); err != nil {
  6447  		return nil, gensupport.WrapError(err)
  6448  	}
  6449  	ret := &ImapSettings{
  6450  		ServerResponse: googleapi.ServerResponse{
  6451  			Header:         res.Header,
  6452  			HTTPStatusCode: res.StatusCode,
  6453  		},
  6454  	}
  6455  	target := &ret
  6456  	if err := gensupport.DecodeResponse(target, res); err != nil {
  6457  		return nil, err
  6458  	}
  6459  	return ret, nil
  6460  }
  6461  
  6462  type UsersSettingsUpdateLanguageCall struct {
  6463  	s                *Service
  6464  	userId           string
  6465  	languagesettings *LanguageSettings
  6466  	urlParams_       gensupport.URLParams
  6467  	ctx_             context.Context
  6468  	header_          http.Header
  6469  }
  6470  
  6471  // UpdateLanguage: Updates language settings. If successful, the return object
  6472  // contains the `displayLanguage` that was saved for the user, which may differ
  6473  // from the value passed into the request. This is because the requested
  6474  // `displayLanguage` may not be directly supported by Gmail but have a close
  6475  // variant that is, and so the variant may be chosen and saved instead.
  6476  //
  6477  //   - userId: User's email address. The special value "me" can be used to
  6478  //     indicate the authenticated user.
  6479  func (r *UsersSettingsService) UpdateLanguage(userId string, languagesettings *LanguageSettings) *UsersSettingsUpdateLanguageCall {
  6480  	c := &UsersSettingsUpdateLanguageCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  6481  	c.userId = userId
  6482  	c.languagesettings = languagesettings
  6483  	return c
  6484  }
  6485  
  6486  // Fields allows partial responses to be retrieved. See
  6487  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  6488  // details.
  6489  func (c *UsersSettingsUpdateLanguageCall) Fields(s ...googleapi.Field) *UsersSettingsUpdateLanguageCall {
  6490  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  6491  	return c
  6492  }
  6493  
  6494  // Context sets the context to be used in this call's Do method.
  6495  func (c *UsersSettingsUpdateLanguageCall) Context(ctx context.Context) *UsersSettingsUpdateLanguageCall {
  6496  	c.ctx_ = ctx
  6497  	return c
  6498  }
  6499  
  6500  // Header returns a http.Header that can be modified by the caller to add
  6501  // headers to the request.
  6502  func (c *UsersSettingsUpdateLanguageCall) Header() http.Header {
  6503  	if c.header_ == nil {
  6504  		c.header_ = make(http.Header)
  6505  	}
  6506  	return c.header_
  6507  }
  6508  
  6509  func (c *UsersSettingsUpdateLanguageCall) doRequest(alt string) (*http.Response, error) {
  6510  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
  6511  	var body io.Reader = nil
  6512  	body, err := googleapi.WithoutDataWrapper.JSONReader(c.languagesettings)
  6513  	if err != nil {
  6514  		return nil, err
  6515  	}
  6516  	c.urlParams_.Set("alt", alt)
  6517  	c.urlParams_.Set("prettyPrint", "false")
  6518  	urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/settings/language")
  6519  	urls += "?" + c.urlParams_.Encode()
  6520  	req, err := http.NewRequest("PUT", urls, body)
  6521  	if err != nil {
  6522  		return nil, err
  6523  	}
  6524  	req.Header = reqHeaders
  6525  	googleapi.Expand(req.URL, map[string]string{
  6526  		"userId": c.userId,
  6527  	})
  6528  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  6529  }
  6530  
  6531  // Do executes the "gmail.users.settings.updateLanguage" call.
  6532  // Any non-2xx status code is an error. Response headers are in either
  6533  // *LanguageSettings.ServerResponse.Header or (if a response was returned at
  6534  // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  6535  // check whether the returned error was because http.StatusNotModified was
  6536  // returned.
  6537  func (c *UsersSettingsUpdateLanguageCall) Do(opts ...googleapi.CallOption) (*LanguageSettings, error) {
  6538  	gensupport.SetOptions(c.urlParams_, opts...)
  6539  	res, err := c.doRequest("json")
  6540  	if res != nil && res.StatusCode == http.StatusNotModified {
  6541  		if res.Body != nil {
  6542  			res.Body.Close()
  6543  		}
  6544  		return nil, gensupport.WrapError(&googleapi.Error{
  6545  			Code:   res.StatusCode,
  6546  			Header: res.Header,
  6547  		})
  6548  	}
  6549  	if err != nil {
  6550  		return nil, err
  6551  	}
  6552  	defer googleapi.CloseBody(res)
  6553  	if err := googleapi.CheckResponse(res); err != nil {
  6554  		return nil, gensupport.WrapError(err)
  6555  	}
  6556  	ret := &LanguageSettings{
  6557  		ServerResponse: googleapi.ServerResponse{
  6558  			Header:         res.Header,
  6559  			HTTPStatusCode: res.StatusCode,
  6560  		},
  6561  	}
  6562  	target := &ret
  6563  	if err := gensupport.DecodeResponse(target, res); err != nil {
  6564  		return nil, err
  6565  	}
  6566  	return ret, nil
  6567  }
  6568  
  6569  type UsersSettingsUpdatePopCall struct {
  6570  	s           *Service
  6571  	userId      string
  6572  	popsettings *PopSettings
  6573  	urlParams_  gensupport.URLParams
  6574  	ctx_        context.Context
  6575  	header_     http.Header
  6576  }
  6577  
  6578  // UpdatePop: Updates POP settings.
  6579  //
  6580  //   - userId: User's email address. The special value "me" can be used to
  6581  //     indicate the authenticated user.
  6582  func (r *UsersSettingsService) UpdatePop(userId string, popsettings *PopSettings) *UsersSettingsUpdatePopCall {
  6583  	c := &UsersSettingsUpdatePopCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  6584  	c.userId = userId
  6585  	c.popsettings = popsettings
  6586  	return c
  6587  }
  6588  
  6589  // Fields allows partial responses to be retrieved. See
  6590  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  6591  // details.
  6592  func (c *UsersSettingsUpdatePopCall) Fields(s ...googleapi.Field) *UsersSettingsUpdatePopCall {
  6593  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  6594  	return c
  6595  }
  6596  
  6597  // Context sets the context to be used in this call's Do method.
  6598  func (c *UsersSettingsUpdatePopCall) Context(ctx context.Context) *UsersSettingsUpdatePopCall {
  6599  	c.ctx_ = ctx
  6600  	return c
  6601  }
  6602  
  6603  // Header returns a http.Header that can be modified by the caller to add
  6604  // headers to the request.
  6605  func (c *UsersSettingsUpdatePopCall) Header() http.Header {
  6606  	if c.header_ == nil {
  6607  		c.header_ = make(http.Header)
  6608  	}
  6609  	return c.header_
  6610  }
  6611  
  6612  func (c *UsersSettingsUpdatePopCall) doRequest(alt string) (*http.Response, error) {
  6613  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
  6614  	var body io.Reader = nil
  6615  	body, err := googleapi.WithoutDataWrapper.JSONReader(c.popsettings)
  6616  	if err != nil {
  6617  		return nil, err
  6618  	}
  6619  	c.urlParams_.Set("alt", alt)
  6620  	c.urlParams_.Set("prettyPrint", "false")
  6621  	urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/settings/pop")
  6622  	urls += "?" + c.urlParams_.Encode()
  6623  	req, err := http.NewRequest("PUT", urls, body)
  6624  	if err != nil {
  6625  		return nil, err
  6626  	}
  6627  	req.Header = reqHeaders
  6628  	googleapi.Expand(req.URL, map[string]string{
  6629  		"userId": c.userId,
  6630  	})
  6631  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  6632  }
  6633  
  6634  // Do executes the "gmail.users.settings.updatePop" call.
  6635  // Any non-2xx status code is an error. Response headers are in either
  6636  // *PopSettings.ServerResponse.Header or (if a response was returned at all) in
  6637  // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  6638  // whether the returned error was because http.StatusNotModified was returned.
  6639  func (c *UsersSettingsUpdatePopCall) Do(opts ...googleapi.CallOption) (*PopSettings, error) {
  6640  	gensupport.SetOptions(c.urlParams_, opts...)
  6641  	res, err := c.doRequest("json")
  6642  	if res != nil && res.StatusCode == http.StatusNotModified {
  6643  		if res.Body != nil {
  6644  			res.Body.Close()
  6645  		}
  6646  		return nil, gensupport.WrapError(&googleapi.Error{
  6647  			Code:   res.StatusCode,
  6648  			Header: res.Header,
  6649  		})
  6650  	}
  6651  	if err != nil {
  6652  		return nil, err
  6653  	}
  6654  	defer googleapi.CloseBody(res)
  6655  	if err := googleapi.CheckResponse(res); err != nil {
  6656  		return nil, gensupport.WrapError(err)
  6657  	}
  6658  	ret := &PopSettings{
  6659  		ServerResponse: googleapi.ServerResponse{
  6660  			Header:         res.Header,
  6661  			HTTPStatusCode: res.StatusCode,
  6662  		},
  6663  	}
  6664  	target := &ret
  6665  	if err := gensupport.DecodeResponse(target, res); err != nil {
  6666  		return nil, err
  6667  	}
  6668  	return ret, nil
  6669  }
  6670  
  6671  type UsersSettingsUpdateVacationCall struct {
  6672  	s                *Service
  6673  	userId           string
  6674  	vacationsettings *VacationSettings
  6675  	urlParams_       gensupport.URLParams
  6676  	ctx_             context.Context
  6677  	header_          http.Header
  6678  }
  6679  
  6680  // UpdateVacation: Updates vacation responder settings.
  6681  //
  6682  //   - userId: User's email address. The special value "me" can be used to
  6683  //     indicate the authenticated user.
  6684  func (r *UsersSettingsService) UpdateVacation(userId string, vacationsettings *VacationSettings) *UsersSettingsUpdateVacationCall {
  6685  	c := &UsersSettingsUpdateVacationCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  6686  	c.userId = userId
  6687  	c.vacationsettings = vacationsettings
  6688  	return c
  6689  }
  6690  
  6691  // Fields allows partial responses to be retrieved. See
  6692  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  6693  // details.
  6694  func (c *UsersSettingsUpdateVacationCall) Fields(s ...googleapi.Field) *UsersSettingsUpdateVacationCall {
  6695  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  6696  	return c
  6697  }
  6698  
  6699  // Context sets the context to be used in this call's Do method.
  6700  func (c *UsersSettingsUpdateVacationCall) Context(ctx context.Context) *UsersSettingsUpdateVacationCall {
  6701  	c.ctx_ = ctx
  6702  	return c
  6703  }
  6704  
  6705  // Header returns a http.Header that can be modified by the caller to add
  6706  // headers to the request.
  6707  func (c *UsersSettingsUpdateVacationCall) Header() http.Header {
  6708  	if c.header_ == nil {
  6709  		c.header_ = make(http.Header)
  6710  	}
  6711  	return c.header_
  6712  }
  6713  
  6714  func (c *UsersSettingsUpdateVacationCall) doRequest(alt string) (*http.Response, error) {
  6715  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
  6716  	var body io.Reader = nil
  6717  	body, err := googleapi.WithoutDataWrapper.JSONReader(c.vacationsettings)
  6718  	if err != nil {
  6719  		return nil, err
  6720  	}
  6721  	c.urlParams_.Set("alt", alt)
  6722  	c.urlParams_.Set("prettyPrint", "false")
  6723  	urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/settings/vacation")
  6724  	urls += "?" + c.urlParams_.Encode()
  6725  	req, err := http.NewRequest("PUT", urls, body)
  6726  	if err != nil {
  6727  		return nil, err
  6728  	}
  6729  	req.Header = reqHeaders
  6730  	googleapi.Expand(req.URL, map[string]string{
  6731  		"userId": c.userId,
  6732  	})
  6733  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  6734  }
  6735  
  6736  // Do executes the "gmail.users.settings.updateVacation" call.
  6737  // Any non-2xx status code is an error. Response headers are in either
  6738  // *VacationSettings.ServerResponse.Header or (if a response was returned at
  6739  // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  6740  // check whether the returned error was because http.StatusNotModified was
  6741  // returned.
  6742  func (c *UsersSettingsUpdateVacationCall) Do(opts ...googleapi.CallOption) (*VacationSettings, error) {
  6743  	gensupport.SetOptions(c.urlParams_, opts...)
  6744  	res, err := c.doRequest("json")
  6745  	if res != nil && res.StatusCode == http.StatusNotModified {
  6746  		if res.Body != nil {
  6747  			res.Body.Close()
  6748  		}
  6749  		return nil, gensupport.WrapError(&googleapi.Error{
  6750  			Code:   res.StatusCode,
  6751  			Header: res.Header,
  6752  		})
  6753  	}
  6754  	if err != nil {
  6755  		return nil, err
  6756  	}
  6757  	defer googleapi.CloseBody(res)
  6758  	if err := googleapi.CheckResponse(res); err != nil {
  6759  		return nil, gensupport.WrapError(err)
  6760  	}
  6761  	ret := &VacationSettings{
  6762  		ServerResponse: googleapi.ServerResponse{
  6763  			Header:         res.Header,
  6764  			HTTPStatusCode: res.StatusCode,
  6765  		},
  6766  	}
  6767  	target := &ret
  6768  	if err := gensupport.DecodeResponse(target, res); err != nil {
  6769  		return nil, err
  6770  	}
  6771  	return ret, nil
  6772  }
  6773  
  6774  type UsersSettingsCseIdentitiesCreateCall struct {
  6775  	s           *Service
  6776  	userId      string
  6777  	cseidentity *CseIdentity
  6778  	urlParams_  gensupport.URLParams
  6779  	ctx_        context.Context
  6780  	header_     http.Header
  6781  }
  6782  
  6783  // Create: Creates and configures a client-side encryption identity that's
  6784  // authorized to send mail from the user account. Google publishes the S/MIME
  6785  // certificate to a shared domain-wide directory so that people within a Google
  6786  // Workspace organization can encrypt and send mail to the identity.
  6787  //
  6788  //   - userId: The requester's primary email address. To indicate the
  6789  //     authenticated user, you can use the special value `me`.
  6790  func (r *UsersSettingsCseIdentitiesService) Create(userId string, cseidentity *CseIdentity) *UsersSettingsCseIdentitiesCreateCall {
  6791  	c := &UsersSettingsCseIdentitiesCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  6792  	c.userId = userId
  6793  	c.cseidentity = cseidentity
  6794  	return c
  6795  }
  6796  
  6797  // Fields allows partial responses to be retrieved. See
  6798  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  6799  // details.
  6800  func (c *UsersSettingsCseIdentitiesCreateCall) Fields(s ...googleapi.Field) *UsersSettingsCseIdentitiesCreateCall {
  6801  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  6802  	return c
  6803  }
  6804  
  6805  // Context sets the context to be used in this call's Do method.
  6806  func (c *UsersSettingsCseIdentitiesCreateCall) Context(ctx context.Context) *UsersSettingsCseIdentitiesCreateCall {
  6807  	c.ctx_ = ctx
  6808  	return c
  6809  }
  6810  
  6811  // Header returns a http.Header that can be modified by the caller to add
  6812  // headers to the request.
  6813  func (c *UsersSettingsCseIdentitiesCreateCall) Header() http.Header {
  6814  	if c.header_ == nil {
  6815  		c.header_ = make(http.Header)
  6816  	}
  6817  	return c.header_
  6818  }
  6819  
  6820  func (c *UsersSettingsCseIdentitiesCreateCall) doRequest(alt string) (*http.Response, error) {
  6821  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
  6822  	var body io.Reader = nil
  6823  	body, err := googleapi.WithoutDataWrapper.JSONReader(c.cseidentity)
  6824  	if err != nil {
  6825  		return nil, err
  6826  	}
  6827  	c.urlParams_.Set("alt", alt)
  6828  	c.urlParams_.Set("prettyPrint", "false")
  6829  	urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/settings/cse/identities")
  6830  	urls += "?" + c.urlParams_.Encode()
  6831  	req, err := http.NewRequest("POST", urls, body)
  6832  	if err != nil {
  6833  		return nil, err
  6834  	}
  6835  	req.Header = reqHeaders
  6836  	googleapi.Expand(req.URL, map[string]string{
  6837  		"userId": c.userId,
  6838  	})
  6839  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  6840  }
  6841  
  6842  // Do executes the "gmail.users.settings.cse.identities.create" call.
  6843  // Any non-2xx status code is an error. Response headers are in either
  6844  // *CseIdentity.ServerResponse.Header or (if a response was returned at all) in
  6845  // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  6846  // whether the returned error was because http.StatusNotModified was returned.
  6847  func (c *UsersSettingsCseIdentitiesCreateCall) Do(opts ...googleapi.CallOption) (*CseIdentity, error) {
  6848  	gensupport.SetOptions(c.urlParams_, opts...)
  6849  	res, err := c.doRequest("json")
  6850  	if res != nil && res.StatusCode == http.StatusNotModified {
  6851  		if res.Body != nil {
  6852  			res.Body.Close()
  6853  		}
  6854  		return nil, gensupport.WrapError(&googleapi.Error{
  6855  			Code:   res.StatusCode,
  6856  			Header: res.Header,
  6857  		})
  6858  	}
  6859  	if err != nil {
  6860  		return nil, err
  6861  	}
  6862  	defer googleapi.CloseBody(res)
  6863  	if err := googleapi.CheckResponse(res); err != nil {
  6864  		return nil, gensupport.WrapError(err)
  6865  	}
  6866  	ret := &CseIdentity{
  6867  		ServerResponse: googleapi.ServerResponse{
  6868  			Header:         res.Header,
  6869  			HTTPStatusCode: res.StatusCode,
  6870  		},
  6871  	}
  6872  	target := &ret
  6873  	if err := gensupport.DecodeResponse(target, res); err != nil {
  6874  		return nil, err
  6875  	}
  6876  	return ret, nil
  6877  }
  6878  
  6879  type UsersSettingsCseIdentitiesDeleteCall struct {
  6880  	s               *Service
  6881  	userId          string
  6882  	cseEmailAddress string
  6883  	urlParams_      gensupport.URLParams
  6884  	ctx_            context.Context
  6885  	header_         http.Header
  6886  }
  6887  
  6888  // Delete: Deletes a client-side encryption identity. The authenticated user
  6889  // can no longer use the identity to send encrypted messages. You cannot
  6890  // restore the identity after you delete it. Instead, use the CreateCseIdentity
  6891  // method to create another identity with the same configuration.
  6892  //
  6893  //   - cseEmailAddress: The primary email address associated with the client-side
  6894  //     encryption identity configuration that's removed.
  6895  //   - userId: The requester's primary email address. To indicate the
  6896  //     authenticated user, you can use the special value `me`.
  6897  func (r *UsersSettingsCseIdentitiesService) Delete(userId string, cseEmailAddress string) *UsersSettingsCseIdentitiesDeleteCall {
  6898  	c := &UsersSettingsCseIdentitiesDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  6899  	c.userId = userId
  6900  	c.cseEmailAddress = cseEmailAddress
  6901  	return c
  6902  }
  6903  
  6904  // Fields allows partial responses to be retrieved. See
  6905  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  6906  // details.
  6907  func (c *UsersSettingsCseIdentitiesDeleteCall) Fields(s ...googleapi.Field) *UsersSettingsCseIdentitiesDeleteCall {
  6908  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  6909  	return c
  6910  }
  6911  
  6912  // Context sets the context to be used in this call's Do method.
  6913  func (c *UsersSettingsCseIdentitiesDeleteCall) Context(ctx context.Context) *UsersSettingsCseIdentitiesDeleteCall {
  6914  	c.ctx_ = ctx
  6915  	return c
  6916  }
  6917  
  6918  // Header returns a http.Header that can be modified by the caller to add
  6919  // headers to the request.
  6920  func (c *UsersSettingsCseIdentitiesDeleteCall) Header() http.Header {
  6921  	if c.header_ == nil {
  6922  		c.header_ = make(http.Header)
  6923  	}
  6924  	return c.header_
  6925  }
  6926  
  6927  func (c *UsersSettingsCseIdentitiesDeleteCall) doRequest(alt string) (*http.Response, error) {
  6928  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
  6929  	var body io.Reader = nil
  6930  	c.urlParams_.Set("alt", alt)
  6931  	c.urlParams_.Set("prettyPrint", "false")
  6932  	urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/settings/cse/identities/{cseEmailAddress}")
  6933  	urls += "?" + c.urlParams_.Encode()
  6934  	req, err := http.NewRequest("DELETE", urls, body)
  6935  	if err != nil {
  6936  		return nil, err
  6937  	}
  6938  	req.Header = reqHeaders
  6939  	googleapi.Expand(req.URL, map[string]string{
  6940  		"userId":          c.userId,
  6941  		"cseEmailAddress": c.cseEmailAddress,
  6942  	})
  6943  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  6944  }
  6945  
  6946  // Do executes the "gmail.users.settings.cse.identities.delete" call.
  6947  func (c *UsersSettingsCseIdentitiesDeleteCall) Do(opts ...googleapi.CallOption) error {
  6948  	gensupport.SetOptions(c.urlParams_, opts...)
  6949  	res, err := c.doRequest("json")
  6950  	if err != nil {
  6951  		return err
  6952  	}
  6953  	defer googleapi.CloseBody(res)
  6954  	if err := googleapi.CheckResponse(res); err != nil {
  6955  		return gensupport.WrapError(err)
  6956  	}
  6957  	return nil
  6958  }
  6959  
  6960  type UsersSettingsCseIdentitiesGetCall struct {
  6961  	s               *Service
  6962  	userId          string
  6963  	cseEmailAddress string
  6964  	urlParams_      gensupport.URLParams
  6965  	ifNoneMatch_    string
  6966  	ctx_            context.Context
  6967  	header_         http.Header
  6968  }
  6969  
  6970  // Get: Retrieves a client-side encryption identity configuration.
  6971  //
  6972  //   - cseEmailAddress: The primary email address associated with the client-side
  6973  //     encryption identity configuration that's retrieved.
  6974  //   - userId: The requester's primary email address. To indicate the
  6975  //     authenticated user, you can use the special value `me`.
  6976  func (r *UsersSettingsCseIdentitiesService) Get(userId string, cseEmailAddress string) *UsersSettingsCseIdentitiesGetCall {
  6977  	c := &UsersSettingsCseIdentitiesGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  6978  	c.userId = userId
  6979  	c.cseEmailAddress = cseEmailAddress
  6980  	return c
  6981  }
  6982  
  6983  // Fields allows partial responses to be retrieved. See
  6984  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  6985  // details.
  6986  func (c *UsersSettingsCseIdentitiesGetCall) Fields(s ...googleapi.Field) *UsersSettingsCseIdentitiesGetCall {
  6987  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  6988  	return c
  6989  }
  6990  
  6991  // IfNoneMatch sets an optional parameter which makes the operation fail if the
  6992  // object's ETag matches the given value. This is useful for getting updates
  6993  // only after the object has changed since the last request.
  6994  func (c *UsersSettingsCseIdentitiesGetCall) IfNoneMatch(entityTag string) *UsersSettingsCseIdentitiesGetCall {
  6995  	c.ifNoneMatch_ = entityTag
  6996  	return c
  6997  }
  6998  
  6999  // Context sets the context to be used in this call's Do method.
  7000  func (c *UsersSettingsCseIdentitiesGetCall) Context(ctx context.Context) *UsersSettingsCseIdentitiesGetCall {
  7001  	c.ctx_ = ctx
  7002  	return c
  7003  }
  7004  
  7005  // Header returns a http.Header that can be modified by the caller to add
  7006  // headers to the request.
  7007  func (c *UsersSettingsCseIdentitiesGetCall) Header() http.Header {
  7008  	if c.header_ == nil {
  7009  		c.header_ = make(http.Header)
  7010  	}
  7011  	return c.header_
  7012  }
  7013  
  7014  func (c *UsersSettingsCseIdentitiesGetCall) doRequest(alt string) (*http.Response, error) {
  7015  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
  7016  	if c.ifNoneMatch_ != "" {
  7017  		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  7018  	}
  7019  	var body io.Reader = nil
  7020  	c.urlParams_.Set("alt", alt)
  7021  	c.urlParams_.Set("prettyPrint", "false")
  7022  	urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/settings/cse/identities/{cseEmailAddress}")
  7023  	urls += "?" + c.urlParams_.Encode()
  7024  	req, err := http.NewRequest("GET", urls, body)
  7025  	if err != nil {
  7026  		return nil, err
  7027  	}
  7028  	req.Header = reqHeaders
  7029  	googleapi.Expand(req.URL, map[string]string{
  7030  		"userId":          c.userId,
  7031  		"cseEmailAddress": c.cseEmailAddress,
  7032  	})
  7033  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  7034  }
  7035  
  7036  // Do executes the "gmail.users.settings.cse.identities.get" call.
  7037  // Any non-2xx status code is an error. Response headers are in either
  7038  // *CseIdentity.ServerResponse.Header or (if a response was returned at all) in
  7039  // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  7040  // whether the returned error was because http.StatusNotModified was returned.
  7041  func (c *UsersSettingsCseIdentitiesGetCall) Do(opts ...googleapi.CallOption) (*CseIdentity, error) {
  7042  	gensupport.SetOptions(c.urlParams_, opts...)
  7043  	res, err := c.doRequest("json")
  7044  	if res != nil && res.StatusCode == http.StatusNotModified {
  7045  		if res.Body != nil {
  7046  			res.Body.Close()
  7047  		}
  7048  		return nil, gensupport.WrapError(&googleapi.Error{
  7049  			Code:   res.StatusCode,
  7050  			Header: res.Header,
  7051  		})
  7052  	}
  7053  	if err != nil {
  7054  		return nil, err
  7055  	}
  7056  	defer googleapi.CloseBody(res)
  7057  	if err := googleapi.CheckResponse(res); err != nil {
  7058  		return nil, gensupport.WrapError(err)
  7059  	}
  7060  	ret := &CseIdentity{
  7061  		ServerResponse: googleapi.ServerResponse{
  7062  			Header:         res.Header,
  7063  			HTTPStatusCode: res.StatusCode,
  7064  		},
  7065  	}
  7066  	target := &ret
  7067  	if err := gensupport.DecodeResponse(target, res); err != nil {
  7068  		return nil, err
  7069  	}
  7070  	return ret, nil
  7071  }
  7072  
  7073  type UsersSettingsCseIdentitiesListCall struct {
  7074  	s            *Service
  7075  	userId       string
  7076  	urlParams_   gensupport.URLParams
  7077  	ifNoneMatch_ string
  7078  	ctx_         context.Context
  7079  	header_      http.Header
  7080  }
  7081  
  7082  // List: Lists the client-side encrypted identities for an authenticated user.
  7083  //
  7084  //   - userId: The requester's primary email address. To indicate the
  7085  //     authenticated user, you can use the special value `me`.
  7086  func (r *UsersSettingsCseIdentitiesService) List(userId string) *UsersSettingsCseIdentitiesListCall {
  7087  	c := &UsersSettingsCseIdentitiesListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  7088  	c.userId = userId
  7089  	return c
  7090  }
  7091  
  7092  // PageSize sets the optional parameter "pageSize": The number of identities to
  7093  // return. If not provided, the page size will default to 20 entries.
  7094  func (c *UsersSettingsCseIdentitiesListCall) PageSize(pageSize int64) *UsersSettingsCseIdentitiesListCall {
  7095  	c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  7096  	return c
  7097  }
  7098  
  7099  // PageToken sets the optional parameter "pageToken": Pagination token
  7100  // indicating which page of identities to return. If the token is not supplied,
  7101  // then the API will return the first page of results.
  7102  func (c *UsersSettingsCseIdentitiesListCall) PageToken(pageToken string) *UsersSettingsCseIdentitiesListCall {
  7103  	c.urlParams_.Set("pageToken", pageToken)
  7104  	return c
  7105  }
  7106  
  7107  // Fields allows partial responses to be retrieved. See
  7108  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  7109  // details.
  7110  func (c *UsersSettingsCseIdentitiesListCall) Fields(s ...googleapi.Field) *UsersSettingsCseIdentitiesListCall {
  7111  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  7112  	return c
  7113  }
  7114  
  7115  // IfNoneMatch sets an optional parameter which makes the operation fail if the
  7116  // object's ETag matches the given value. This is useful for getting updates
  7117  // only after the object has changed since the last request.
  7118  func (c *UsersSettingsCseIdentitiesListCall) IfNoneMatch(entityTag string) *UsersSettingsCseIdentitiesListCall {
  7119  	c.ifNoneMatch_ = entityTag
  7120  	return c
  7121  }
  7122  
  7123  // Context sets the context to be used in this call's Do method.
  7124  func (c *UsersSettingsCseIdentitiesListCall) Context(ctx context.Context) *UsersSettingsCseIdentitiesListCall {
  7125  	c.ctx_ = ctx
  7126  	return c
  7127  }
  7128  
  7129  // Header returns a http.Header that can be modified by the caller to add
  7130  // headers to the request.
  7131  func (c *UsersSettingsCseIdentitiesListCall) Header() http.Header {
  7132  	if c.header_ == nil {
  7133  		c.header_ = make(http.Header)
  7134  	}
  7135  	return c.header_
  7136  }
  7137  
  7138  func (c *UsersSettingsCseIdentitiesListCall) doRequest(alt string) (*http.Response, error) {
  7139  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
  7140  	if c.ifNoneMatch_ != "" {
  7141  		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  7142  	}
  7143  	var body io.Reader = nil
  7144  	c.urlParams_.Set("alt", alt)
  7145  	c.urlParams_.Set("prettyPrint", "false")
  7146  	urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/settings/cse/identities")
  7147  	urls += "?" + c.urlParams_.Encode()
  7148  	req, err := http.NewRequest("GET", urls, body)
  7149  	if err != nil {
  7150  		return nil, err
  7151  	}
  7152  	req.Header = reqHeaders
  7153  	googleapi.Expand(req.URL, map[string]string{
  7154  		"userId": c.userId,
  7155  	})
  7156  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  7157  }
  7158  
  7159  // Do executes the "gmail.users.settings.cse.identities.list" call.
  7160  // Any non-2xx status code is an error. Response headers are in either
  7161  // *ListCseIdentitiesResponse.ServerResponse.Header or (if a response was
  7162  // returned at all) in error.(*googleapi.Error).Header. Use
  7163  // googleapi.IsNotModified to check whether the returned error was because
  7164  // http.StatusNotModified was returned.
  7165  func (c *UsersSettingsCseIdentitiesListCall) Do(opts ...googleapi.CallOption) (*ListCseIdentitiesResponse, error) {
  7166  	gensupport.SetOptions(c.urlParams_, opts...)
  7167  	res, err := c.doRequest("json")
  7168  	if res != nil && res.StatusCode == http.StatusNotModified {
  7169  		if res.Body != nil {
  7170  			res.Body.Close()
  7171  		}
  7172  		return nil, gensupport.WrapError(&googleapi.Error{
  7173  			Code:   res.StatusCode,
  7174  			Header: res.Header,
  7175  		})
  7176  	}
  7177  	if err != nil {
  7178  		return nil, err
  7179  	}
  7180  	defer googleapi.CloseBody(res)
  7181  	if err := googleapi.CheckResponse(res); err != nil {
  7182  		return nil, gensupport.WrapError(err)
  7183  	}
  7184  	ret := &ListCseIdentitiesResponse{
  7185  		ServerResponse: googleapi.ServerResponse{
  7186  			Header:         res.Header,
  7187  			HTTPStatusCode: res.StatusCode,
  7188  		},
  7189  	}
  7190  	target := &ret
  7191  	if err := gensupport.DecodeResponse(target, res); err != nil {
  7192  		return nil, err
  7193  	}
  7194  	return ret, nil
  7195  }
  7196  
  7197  // Pages invokes f for each page of results.
  7198  // A non-nil error returned from f will halt the iteration.
  7199  // The provided context supersedes any context provided to the Context method.
  7200  func (c *UsersSettingsCseIdentitiesListCall) Pages(ctx context.Context, f func(*ListCseIdentitiesResponse) error) error {
  7201  	c.ctx_ = ctx
  7202  	defer c.PageToken(c.urlParams_.Get("pageToken"))
  7203  	for {
  7204  		x, err := c.Do()
  7205  		if err != nil {
  7206  			return err
  7207  		}
  7208  		if err := f(x); err != nil {
  7209  			return err
  7210  		}
  7211  		if x.NextPageToken == "" {
  7212  			return nil
  7213  		}
  7214  		c.PageToken(x.NextPageToken)
  7215  	}
  7216  }
  7217  
  7218  type UsersSettingsCseIdentitiesPatchCall struct {
  7219  	s            *Service
  7220  	userId       string
  7221  	emailAddress string
  7222  	cseidentity  *CseIdentity
  7223  	urlParams_   gensupport.URLParams
  7224  	ctx_         context.Context
  7225  	header_      http.Header
  7226  }
  7227  
  7228  // Patch: Associates a different key pair with an existing client-side
  7229  // encryption identity. The updated key pair must validate against Google's
  7230  // S/MIME certificate profiles (https://support.google.com/a/answer/7300887).
  7231  //
  7232  //   - emailAddress: The email address of the client-side encryption identity to
  7233  //     update.
  7234  //   - userId: The requester's primary email address. To indicate the
  7235  //     authenticated user, you can use the special value `me`.
  7236  func (r *UsersSettingsCseIdentitiesService) Patch(userId string, emailAddress string, cseidentity *CseIdentity) *UsersSettingsCseIdentitiesPatchCall {
  7237  	c := &UsersSettingsCseIdentitiesPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  7238  	c.userId = userId
  7239  	c.emailAddress = emailAddress
  7240  	c.cseidentity = cseidentity
  7241  	return c
  7242  }
  7243  
  7244  // Fields allows partial responses to be retrieved. See
  7245  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  7246  // details.
  7247  func (c *UsersSettingsCseIdentitiesPatchCall) Fields(s ...googleapi.Field) *UsersSettingsCseIdentitiesPatchCall {
  7248  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  7249  	return c
  7250  }
  7251  
  7252  // Context sets the context to be used in this call's Do method.
  7253  func (c *UsersSettingsCseIdentitiesPatchCall) Context(ctx context.Context) *UsersSettingsCseIdentitiesPatchCall {
  7254  	c.ctx_ = ctx
  7255  	return c
  7256  }
  7257  
  7258  // Header returns a http.Header that can be modified by the caller to add
  7259  // headers to the request.
  7260  func (c *UsersSettingsCseIdentitiesPatchCall) Header() http.Header {
  7261  	if c.header_ == nil {
  7262  		c.header_ = make(http.Header)
  7263  	}
  7264  	return c.header_
  7265  }
  7266  
  7267  func (c *UsersSettingsCseIdentitiesPatchCall) doRequest(alt string) (*http.Response, error) {
  7268  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
  7269  	var body io.Reader = nil
  7270  	body, err := googleapi.WithoutDataWrapper.JSONReader(c.cseidentity)
  7271  	if err != nil {
  7272  		return nil, err
  7273  	}
  7274  	c.urlParams_.Set("alt", alt)
  7275  	c.urlParams_.Set("prettyPrint", "false")
  7276  	urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/settings/cse/identities/{emailAddress}")
  7277  	urls += "?" + c.urlParams_.Encode()
  7278  	req, err := http.NewRequest("PATCH", urls, body)
  7279  	if err != nil {
  7280  		return nil, err
  7281  	}
  7282  	req.Header = reqHeaders
  7283  	googleapi.Expand(req.URL, map[string]string{
  7284  		"userId":       c.userId,
  7285  		"emailAddress": c.emailAddress,
  7286  	})
  7287  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  7288  }
  7289  
  7290  // Do executes the "gmail.users.settings.cse.identities.patch" call.
  7291  // Any non-2xx status code is an error. Response headers are in either
  7292  // *CseIdentity.ServerResponse.Header or (if a response was returned at all) in
  7293  // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  7294  // whether the returned error was because http.StatusNotModified was returned.
  7295  func (c *UsersSettingsCseIdentitiesPatchCall) Do(opts ...googleapi.CallOption) (*CseIdentity, error) {
  7296  	gensupport.SetOptions(c.urlParams_, opts...)
  7297  	res, err := c.doRequest("json")
  7298  	if res != nil && res.StatusCode == http.StatusNotModified {
  7299  		if res.Body != nil {
  7300  			res.Body.Close()
  7301  		}
  7302  		return nil, gensupport.WrapError(&googleapi.Error{
  7303  			Code:   res.StatusCode,
  7304  			Header: res.Header,
  7305  		})
  7306  	}
  7307  	if err != nil {
  7308  		return nil, err
  7309  	}
  7310  	defer googleapi.CloseBody(res)
  7311  	if err := googleapi.CheckResponse(res); err != nil {
  7312  		return nil, gensupport.WrapError(err)
  7313  	}
  7314  	ret := &CseIdentity{
  7315  		ServerResponse: googleapi.ServerResponse{
  7316  			Header:         res.Header,
  7317  			HTTPStatusCode: res.StatusCode,
  7318  		},
  7319  	}
  7320  	target := &ret
  7321  	if err := gensupport.DecodeResponse(target, res); err != nil {
  7322  		return nil, err
  7323  	}
  7324  	return ret, nil
  7325  }
  7326  
  7327  type UsersSettingsCseKeypairsCreateCall struct {
  7328  	s          *Service
  7329  	userId     string
  7330  	csekeypair *CseKeyPair
  7331  	urlParams_ gensupport.URLParams
  7332  	ctx_       context.Context
  7333  	header_    http.Header
  7334  }
  7335  
  7336  // Create: Creates and uploads a client-side encryption S/MIME public key
  7337  // certificate chain and private key metadata for the authenticated user.
  7338  //
  7339  //   - userId: The requester's primary email address. To indicate the
  7340  //     authenticated user, you can use the special value `me`.
  7341  func (r *UsersSettingsCseKeypairsService) Create(userId string, csekeypair *CseKeyPair) *UsersSettingsCseKeypairsCreateCall {
  7342  	c := &UsersSettingsCseKeypairsCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  7343  	c.userId = userId
  7344  	c.csekeypair = csekeypair
  7345  	return c
  7346  }
  7347  
  7348  // Fields allows partial responses to be retrieved. See
  7349  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  7350  // details.
  7351  func (c *UsersSettingsCseKeypairsCreateCall) Fields(s ...googleapi.Field) *UsersSettingsCseKeypairsCreateCall {
  7352  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  7353  	return c
  7354  }
  7355  
  7356  // Context sets the context to be used in this call's Do method.
  7357  func (c *UsersSettingsCseKeypairsCreateCall) Context(ctx context.Context) *UsersSettingsCseKeypairsCreateCall {
  7358  	c.ctx_ = ctx
  7359  	return c
  7360  }
  7361  
  7362  // Header returns a http.Header that can be modified by the caller to add
  7363  // headers to the request.
  7364  func (c *UsersSettingsCseKeypairsCreateCall) Header() http.Header {
  7365  	if c.header_ == nil {
  7366  		c.header_ = make(http.Header)
  7367  	}
  7368  	return c.header_
  7369  }
  7370  
  7371  func (c *UsersSettingsCseKeypairsCreateCall) doRequest(alt string) (*http.Response, error) {
  7372  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
  7373  	var body io.Reader = nil
  7374  	body, err := googleapi.WithoutDataWrapper.JSONReader(c.csekeypair)
  7375  	if err != nil {
  7376  		return nil, err
  7377  	}
  7378  	c.urlParams_.Set("alt", alt)
  7379  	c.urlParams_.Set("prettyPrint", "false")
  7380  	urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/settings/cse/keypairs")
  7381  	urls += "?" + c.urlParams_.Encode()
  7382  	req, err := http.NewRequest("POST", urls, body)
  7383  	if err != nil {
  7384  		return nil, err
  7385  	}
  7386  	req.Header = reqHeaders
  7387  	googleapi.Expand(req.URL, map[string]string{
  7388  		"userId": c.userId,
  7389  	})
  7390  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  7391  }
  7392  
  7393  // Do executes the "gmail.users.settings.cse.keypairs.create" call.
  7394  // Any non-2xx status code is an error. Response headers are in either
  7395  // *CseKeyPair.ServerResponse.Header or (if a response was returned at all) in
  7396  // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  7397  // whether the returned error was because http.StatusNotModified was returned.
  7398  func (c *UsersSettingsCseKeypairsCreateCall) Do(opts ...googleapi.CallOption) (*CseKeyPair, error) {
  7399  	gensupport.SetOptions(c.urlParams_, opts...)
  7400  	res, err := c.doRequest("json")
  7401  	if res != nil && res.StatusCode == http.StatusNotModified {
  7402  		if res.Body != nil {
  7403  			res.Body.Close()
  7404  		}
  7405  		return nil, gensupport.WrapError(&googleapi.Error{
  7406  			Code:   res.StatusCode,
  7407  			Header: res.Header,
  7408  		})
  7409  	}
  7410  	if err != nil {
  7411  		return nil, err
  7412  	}
  7413  	defer googleapi.CloseBody(res)
  7414  	if err := googleapi.CheckResponse(res); err != nil {
  7415  		return nil, gensupport.WrapError(err)
  7416  	}
  7417  	ret := &CseKeyPair{
  7418  		ServerResponse: googleapi.ServerResponse{
  7419  			Header:         res.Header,
  7420  			HTTPStatusCode: res.StatusCode,
  7421  		},
  7422  	}
  7423  	target := &ret
  7424  	if err := gensupport.DecodeResponse(target, res); err != nil {
  7425  		return nil, err
  7426  	}
  7427  	return ret, nil
  7428  }
  7429  
  7430  type UsersSettingsCseKeypairsDisableCall struct {
  7431  	s                        *Service
  7432  	userId                   string
  7433  	keyPairId                string
  7434  	disablecsekeypairrequest *DisableCseKeyPairRequest
  7435  	urlParams_               gensupport.URLParams
  7436  	ctx_                     context.Context
  7437  	header_                  http.Header
  7438  }
  7439  
  7440  // Disable: Turns off a client-side encryption key pair. The authenticated user
  7441  // can no longer use the key pair to decrypt incoming CSE message texts or sign
  7442  // outgoing CSE mail. To regain access, use the EnableCseKeyPair to turn on the
  7443  // key pair. After 30 days, you can permanently delete the key pair by using
  7444  // the ObliterateCseKeyPair method.
  7445  //
  7446  //   - keyPairId: The identifier of the key pair to turn off.
  7447  //   - userId: The requester's primary email address. To indicate the
  7448  //     authenticated user, you can use the special value `me`.
  7449  func (r *UsersSettingsCseKeypairsService) Disable(userId string, keyPairId string, disablecsekeypairrequest *DisableCseKeyPairRequest) *UsersSettingsCseKeypairsDisableCall {
  7450  	c := &UsersSettingsCseKeypairsDisableCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  7451  	c.userId = userId
  7452  	c.keyPairId = keyPairId
  7453  	c.disablecsekeypairrequest = disablecsekeypairrequest
  7454  	return c
  7455  }
  7456  
  7457  // Fields allows partial responses to be retrieved. See
  7458  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  7459  // details.
  7460  func (c *UsersSettingsCseKeypairsDisableCall) Fields(s ...googleapi.Field) *UsersSettingsCseKeypairsDisableCall {
  7461  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  7462  	return c
  7463  }
  7464  
  7465  // Context sets the context to be used in this call's Do method.
  7466  func (c *UsersSettingsCseKeypairsDisableCall) Context(ctx context.Context) *UsersSettingsCseKeypairsDisableCall {
  7467  	c.ctx_ = ctx
  7468  	return c
  7469  }
  7470  
  7471  // Header returns a http.Header that can be modified by the caller to add
  7472  // headers to the request.
  7473  func (c *UsersSettingsCseKeypairsDisableCall) Header() http.Header {
  7474  	if c.header_ == nil {
  7475  		c.header_ = make(http.Header)
  7476  	}
  7477  	return c.header_
  7478  }
  7479  
  7480  func (c *UsersSettingsCseKeypairsDisableCall) doRequest(alt string) (*http.Response, error) {
  7481  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
  7482  	var body io.Reader = nil
  7483  	body, err := googleapi.WithoutDataWrapper.JSONReader(c.disablecsekeypairrequest)
  7484  	if err != nil {
  7485  		return nil, err
  7486  	}
  7487  	c.urlParams_.Set("alt", alt)
  7488  	c.urlParams_.Set("prettyPrint", "false")
  7489  	urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/settings/cse/keypairs/{keyPairId}:disable")
  7490  	urls += "?" + c.urlParams_.Encode()
  7491  	req, err := http.NewRequest("POST", urls, body)
  7492  	if err != nil {
  7493  		return nil, err
  7494  	}
  7495  	req.Header = reqHeaders
  7496  	googleapi.Expand(req.URL, map[string]string{
  7497  		"userId":    c.userId,
  7498  		"keyPairId": c.keyPairId,
  7499  	})
  7500  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  7501  }
  7502  
  7503  // Do executes the "gmail.users.settings.cse.keypairs.disable" call.
  7504  // Any non-2xx status code is an error. Response headers are in either
  7505  // *CseKeyPair.ServerResponse.Header or (if a response was returned at all) in
  7506  // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  7507  // whether the returned error was because http.StatusNotModified was returned.
  7508  func (c *UsersSettingsCseKeypairsDisableCall) Do(opts ...googleapi.CallOption) (*CseKeyPair, error) {
  7509  	gensupport.SetOptions(c.urlParams_, opts...)
  7510  	res, err := c.doRequest("json")
  7511  	if res != nil && res.StatusCode == http.StatusNotModified {
  7512  		if res.Body != nil {
  7513  			res.Body.Close()
  7514  		}
  7515  		return nil, gensupport.WrapError(&googleapi.Error{
  7516  			Code:   res.StatusCode,
  7517  			Header: res.Header,
  7518  		})
  7519  	}
  7520  	if err != nil {
  7521  		return nil, err
  7522  	}
  7523  	defer googleapi.CloseBody(res)
  7524  	if err := googleapi.CheckResponse(res); err != nil {
  7525  		return nil, gensupport.WrapError(err)
  7526  	}
  7527  	ret := &CseKeyPair{
  7528  		ServerResponse: googleapi.ServerResponse{
  7529  			Header:         res.Header,
  7530  			HTTPStatusCode: res.StatusCode,
  7531  		},
  7532  	}
  7533  	target := &ret
  7534  	if err := gensupport.DecodeResponse(target, res); err != nil {
  7535  		return nil, err
  7536  	}
  7537  	return ret, nil
  7538  }
  7539  
  7540  type UsersSettingsCseKeypairsEnableCall struct {
  7541  	s                       *Service
  7542  	userId                  string
  7543  	keyPairId               string
  7544  	enablecsekeypairrequest *EnableCseKeyPairRequest
  7545  	urlParams_              gensupport.URLParams
  7546  	ctx_                    context.Context
  7547  	header_                 http.Header
  7548  }
  7549  
  7550  // Enable: Turns on a client-side encryption key pair that was turned off. The
  7551  // key pair becomes active again for any associated client-side encryption
  7552  // identities.
  7553  //
  7554  //   - keyPairId: The identifier of the key pair to turn on.
  7555  //   - userId: The requester's primary email address. To indicate the
  7556  //     authenticated user, you can use the special value `me`.
  7557  func (r *UsersSettingsCseKeypairsService) Enable(userId string, keyPairId string, enablecsekeypairrequest *EnableCseKeyPairRequest) *UsersSettingsCseKeypairsEnableCall {
  7558  	c := &UsersSettingsCseKeypairsEnableCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  7559  	c.userId = userId
  7560  	c.keyPairId = keyPairId
  7561  	c.enablecsekeypairrequest = enablecsekeypairrequest
  7562  	return c
  7563  }
  7564  
  7565  // Fields allows partial responses to be retrieved. See
  7566  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  7567  // details.
  7568  func (c *UsersSettingsCseKeypairsEnableCall) Fields(s ...googleapi.Field) *UsersSettingsCseKeypairsEnableCall {
  7569  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  7570  	return c
  7571  }
  7572  
  7573  // Context sets the context to be used in this call's Do method.
  7574  func (c *UsersSettingsCseKeypairsEnableCall) Context(ctx context.Context) *UsersSettingsCseKeypairsEnableCall {
  7575  	c.ctx_ = ctx
  7576  	return c
  7577  }
  7578  
  7579  // Header returns a http.Header that can be modified by the caller to add
  7580  // headers to the request.
  7581  func (c *UsersSettingsCseKeypairsEnableCall) Header() http.Header {
  7582  	if c.header_ == nil {
  7583  		c.header_ = make(http.Header)
  7584  	}
  7585  	return c.header_
  7586  }
  7587  
  7588  func (c *UsersSettingsCseKeypairsEnableCall) doRequest(alt string) (*http.Response, error) {
  7589  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
  7590  	var body io.Reader = nil
  7591  	body, err := googleapi.WithoutDataWrapper.JSONReader(c.enablecsekeypairrequest)
  7592  	if err != nil {
  7593  		return nil, err
  7594  	}
  7595  	c.urlParams_.Set("alt", alt)
  7596  	c.urlParams_.Set("prettyPrint", "false")
  7597  	urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/settings/cse/keypairs/{keyPairId}:enable")
  7598  	urls += "?" + c.urlParams_.Encode()
  7599  	req, err := http.NewRequest("POST", urls, body)
  7600  	if err != nil {
  7601  		return nil, err
  7602  	}
  7603  	req.Header = reqHeaders
  7604  	googleapi.Expand(req.URL, map[string]string{
  7605  		"userId":    c.userId,
  7606  		"keyPairId": c.keyPairId,
  7607  	})
  7608  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  7609  }
  7610  
  7611  // Do executes the "gmail.users.settings.cse.keypairs.enable" call.
  7612  // Any non-2xx status code is an error. Response headers are in either
  7613  // *CseKeyPair.ServerResponse.Header or (if a response was returned at all) in
  7614  // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  7615  // whether the returned error was because http.StatusNotModified was returned.
  7616  func (c *UsersSettingsCseKeypairsEnableCall) Do(opts ...googleapi.CallOption) (*CseKeyPair, error) {
  7617  	gensupport.SetOptions(c.urlParams_, opts...)
  7618  	res, err := c.doRequest("json")
  7619  	if res != nil && res.StatusCode == http.StatusNotModified {
  7620  		if res.Body != nil {
  7621  			res.Body.Close()
  7622  		}
  7623  		return nil, gensupport.WrapError(&googleapi.Error{
  7624  			Code:   res.StatusCode,
  7625  			Header: res.Header,
  7626  		})
  7627  	}
  7628  	if err != nil {
  7629  		return nil, err
  7630  	}
  7631  	defer googleapi.CloseBody(res)
  7632  	if err := googleapi.CheckResponse(res); err != nil {
  7633  		return nil, gensupport.WrapError(err)
  7634  	}
  7635  	ret := &CseKeyPair{
  7636  		ServerResponse: googleapi.ServerResponse{
  7637  			Header:         res.Header,
  7638  			HTTPStatusCode: res.StatusCode,
  7639  		},
  7640  	}
  7641  	target := &ret
  7642  	if err := gensupport.DecodeResponse(target, res); err != nil {
  7643  		return nil, err
  7644  	}
  7645  	return ret, nil
  7646  }
  7647  
  7648  type UsersSettingsCseKeypairsGetCall struct {
  7649  	s            *Service
  7650  	userId       string
  7651  	keyPairId    string
  7652  	urlParams_   gensupport.URLParams
  7653  	ifNoneMatch_ string
  7654  	ctx_         context.Context
  7655  	header_      http.Header
  7656  }
  7657  
  7658  // Get: Retrieves an existing client-side encryption key pair.
  7659  //
  7660  //   - keyPairId: The identifier of the key pair to retrieve.
  7661  //   - userId: The requester's primary email address. To indicate the
  7662  //     authenticated user, you can use the special value `me`.
  7663  func (r *UsersSettingsCseKeypairsService) Get(userId string, keyPairId string) *UsersSettingsCseKeypairsGetCall {
  7664  	c := &UsersSettingsCseKeypairsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  7665  	c.userId = userId
  7666  	c.keyPairId = keyPairId
  7667  	return c
  7668  }
  7669  
  7670  // Fields allows partial responses to be retrieved. See
  7671  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  7672  // details.
  7673  func (c *UsersSettingsCseKeypairsGetCall) Fields(s ...googleapi.Field) *UsersSettingsCseKeypairsGetCall {
  7674  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  7675  	return c
  7676  }
  7677  
  7678  // IfNoneMatch sets an optional parameter which makes the operation fail if the
  7679  // object's ETag matches the given value. This is useful for getting updates
  7680  // only after the object has changed since the last request.
  7681  func (c *UsersSettingsCseKeypairsGetCall) IfNoneMatch(entityTag string) *UsersSettingsCseKeypairsGetCall {
  7682  	c.ifNoneMatch_ = entityTag
  7683  	return c
  7684  }
  7685  
  7686  // Context sets the context to be used in this call's Do method.
  7687  func (c *UsersSettingsCseKeypairsGetCall) Context(ctx context.Context) *UsersSettingsCseKeypairsGetCall {
  7688  	c.ctx_ = ctx
  7689  	return c
  7690  }
  7691  
  7692  // Header returns a http.Header that can be modified by the caller to add
  7693  // headers to the request.
  7694  func (c *UsersSettingsCseKeypairsGetCall) Header() http.Header {
  7695  	if c.header_ == nil {
  7696  		c.header_ = make(http.Header)
  7697  	}
  7698  	return c.header_
  7699  }
  7700  
  7701  func (c *UsersSettingsCseKeypairsGetCall) doRequest(alt string) (*http.Response, error) {
  7702  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
  7703  	if c.ifNoneMatch_ != "" {
  7704  		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  7705  	}
  7706  	var body io.Reader = nil
  7707  	c.urlParams_.Set("alt", alt)
  7708  	c.urlParams_.Set("prettyPrint", "false")
  7709  	urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/settings/cse/keypairs/{keyPairId}")
  7710  	urls += "?" + c.urlParams_.Encode()
  7711  	req, err := http.NewRequest("GET", urls, body)
  7712  	if err != nil {
  7713  		return nil, err
  7714  	}
  7715  	req.Header = reqHeaders
  7716  	googleapi.Expand(req.URL, map[string]string{
  7717  		"userId":    c.userId,
  7718  		"keyPairId": c.keyPairId,
  7719  	})
  7720  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  7721  }
  7722  
  7723  // Do executes the "gmail.users.settings.cse.keypairs.get" call.
  7724  // Any non-2xx status code is an error. Response headers are in either
  7725  // *CseKeyPair.ServerResponse.Header or (if a response was returned at all) in
  7726  // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  7727  // whether the returned error was because http.StatusNotModified was returned.
  7728  func (c *UsersSettingsCseKeypairsGetCall) Do(opts ...googleapi.CallOption) (*CseKeyPair, error) {
  7729  	gensupport.SetOptions(c.urlParams_, opts...)
  7730  	res, err := c.doRequest("json")
  7731  	if res != nil && res.StatusCode == http.StatusNotModified {
  7732  		if res.Body != nil {
  7733  			res.Body.Close()
  7734  		}
  7735  		return nil, gensupport.WrapError(&googleapi.Error{
  7736  			Code:   res.StatusCode,
  7737  			Header: res.Header,
  7738  		})
  7739  	}
  7740  	if err != nil {
  7741  		return nil, err
  7742  	}
  7743  	defer googleapi.CloseBody(res)
  7744  	if err := googleapi.CheckResponse(res); err != nil {
  7745  		return nil, gensupport.WrapError(err)
  7746  	}
  7747  	ret := &CseKeyPair{
  7748  		ServerResponse: googleapi.ServerResponse{
  7749  			Header:         res.Header,
  7750  			HTTPStatusCode: res.StatusCode,
  7751  		},
  7752  	}
  7753  	target := &ret
  7754  	if err := gensupport.DecodeResponse(target, res); err != nil {
  7755  		return nil, err
  7756  	}
  7757  	return ret, nil
  7758  }
  7759  
  7760  type UsersSettingsCseKeypairsListCall struct {
  7761  	s            *Service
  7762  	userId       string
  7763  	urlParams_   gensupport.URLParams
  7764  	ifNoneMatch_ string
  7765  	ctx_         context.Context
  7766  	header_      http.Header
  7767  }
  7768  
  7769  // List: Lists client-side encryption key pairs for an authenticated user.
  7770  //
  7771  //   - userId: The requester's primary email address. To indicate the
  7772  //     authenticated user, you can use the special value `me`.
  7773  func (r *UsersSettingsCseKeypairsService) List(userId string) *UsersSettingsCseKeypairsListCall {
  7774  	c := &UsersSettingsCseKeypairsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  7775  	c.userId = userId
  7776  	return c
  7777  }
  7778  
  7779  // PageSize sets the optional parameter "pageSize": The number of key pairs to
  7780  // return. If not provided, the page size will default to 20 entries.
  7781  func (c *UsersSettingsCseKeypairsListCall) PageSize(pageSize int64) *UsersSettingsCseKeypairsListCall {
  7782  	c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  7783  	return c
  7784  }
  7785  
  7786  // PageToken sets the optional parameter "pageToken": Pagination token
  7787  // indicating which page of key pairs to return. If the token is not supplied,
  7788  // then the API will return the first page of results.
  7789  func (c *UsersSettingsCseKeypairsListCall) PageToken(pageToken string) *UsersSettingsCseKeypairsListCall {
  7790  	c.urlParams_.Set("pageToken", pageToken)
  7791  	return c
  7792  }
  7793  
  7794  // Fields allows partial responses to be retrieved. See
  7795  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  7796  // details.
  7797  func (c *UsersSettingsCseKeypairsListCall) Fields(s ...googleapi.Field) *UsersSettingsCseKeypairsListCall {
  7798  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  7799  	return c
  7800  }
  7801  
  7802  // IfNoneMatch sets an optional parameter which makes the operation fail if the
  7803  // object's ETag matches the given value. This is useful for getting updates
  7804  // only after the object has changed since the last request.
  7805  func (c *UsersSettingsCseKeypairsListCall) IfNoneMatch(entityTag string) *UsersSettingsCseKeypairsListCall {
  7806  	c.ifNoneMatch_ = entityTag
  7807  	return c
  7808  }
  7809  
  7810  // Context sets the context to be used in this call's Do method.
  7811  func (c *UsersSettingsCseKeypairsListCall) Context(ctx context.Context) *UsersSettingsCseKeypairsListCall {
  7812  	c.ctx_ = ctx
  7813  	return c
  7814  }
  7815  
  7816  // Header returns a http.Header that can be modified by the caller to add
  7817  // headers to the request.
  7818  func (c *UsersSettingsCseKeypairsListCall) Header() http.Header {
  7819  	if c.header_ == nil {
  7820  		c.header_ = make(http.Header)
  7821  	}
  7822  	return c.header_
  7823  }
  7824  
  7825  func (c *UsersSettingsCseKeypairsListCall) doRequest(alt string) (*http.Response, error) {
  7826  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
  7827  	if c.ifNoneMatch_ != "" {
  7828  		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  7829  	}
  7830  	var body io.Reader = nil
  7831  	c.urlParams_.Set("alt", alt)
  7832  	c.urlParams_.Set("prettyPrint", "false")
  7833  	urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/settings/cse/keypairs")
  7834  	urls += "?" + c.urlParams_.Encode()
  7835  	req, err := http.NewRequest("GET", urls, body)
  7836  	if err != nil {
  7837  		return nil, err
  7838  	}
  7839  	req.Header = reqHeaders
  7840  	googleapi.Expand(req.URL, map[string]string{
  7841  		"userId": c.userId,
  7842  	})
  7843  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  7844  }
  7845  
  7846  // Do executes the "gmail.users.settings.cse.keypairs.list" call.
  7847  // Any non-2xx status code is an error. Response headers are in either
  7848  // *ListCseKeyPairsResponse.ServerResponse.Header or (if a response was
  7849  // returned at all) in error.(*googleapi.Error).Header. Use
  7850  // googleapi.IsNotModified to check whether the returned error was because
  7851  // http.StatusNotModified was returned.
  7852  func (c *UsersSettingsCseKeypairsListCall) Do(opts ...googleapi.CallOption) (*ListCseKeyPairsResponse, error) {
  7853  	gensupport.SetOptions(c.urlParams_, opts...)
  7854  	res, err := c.doRequest("json")
  7855  	if res != nil && res.StatusCode == http.StatusNotModified {
  7856  		if res.Body != nil {
  7857  			res.Body.Close()
  7858  		}
  7859  		return nil, gensupport.WrapError(&googleapi.Error{
  7860  			Code:   res.StatusCode,
  7861  			Header: res.Header,
  7862  		})
  7863  	}
  7864  	if err != nil {
  7865  		return nil, err
  7866  	}
  7867  	defer googleapi.CloseBody(res)
  7868  	if err := googleapi.CheckResponse(res); err != nil {
  7869  		return nil, gensupport.WrapError(err)
  7870  	}
  7871  	ret := &ListCseKeyPairsResponse{
  7872  		ServerResponse: googleapi.ServerResponse{
  7873  			Header:         res.Header,
  7874  			HTTPStatusCode: res.StatusCode,
  7875  		},
  7876  	}
  7877  	target := &ret
  7878  	if err := gensupport.DecodeResponse(target, res); err != nil {
  7879  		return nil, err
  7880  	}
  7881  	return ret, nil
  7882  }
  7883  
  7884  // Pages invokes f for each page of results.
  7885  // A non-nil error returned from f will halt the iteration.
  7886  // The provided context supersedes any context provided to the Context method.
  7887  func (c *UsersSettingsCseKeypairsListCall) Pages(ctx context.Context, f func(*ListCseKeyPairsResponse) error) error {
  7888  	c.ctx_ = ctx
  7889  	defer c.PageToken(c.urlParams_.Get("pageToken"))
  7890  	for {
  7891  		x, err := c.Do()
  7892  		if err != nil {
  7893  			return err
  7894  		}
  7895  		if err := f(x); err != nil {
  7896  			return err
  7897  		}
  7898  		if x.NextPageToken == "" {
  7899  			return nil
  7900  		}
  7901  		c.PageToken(x.NextPageToken)
  7902  	}
  7903  }
  7904  
  7905  type UsersSettingsCseKeypairsObliterateCall struct {
  7906  	s                           *Service
  7907  	userId                      string
  7908  	keyPairId                   string
  7909  	obliteratecsekeypairrequest *ObliterateCseKeyPairRequest
  7910  	urlParams_                  gensupport.URLParams
  7911  	ctx_                        context.Context
  7912  	header_                     http.Header
  7913  }
  7914  
  7915  // Obliterate: Deletes a client-side encryption key pair permanently and
  7916  // immediately. You can only permanently delete key pairs that have been turned
  7917  // off for more than 30 days. To turn off a key pair, use the DisableCseKeyPair
  7918  // method. Gmail can't restore or decrypt any messages that were encrypted by
  7919  // an obliterated key. Authenticated users and Google Workspace administrators
  7920  // lose access to reading the encrypted messages.
  7921  //
  7922  //   - keyPairId: The identifier of the key pair to obliterate.
  7923  //   - userId: The requester's primary email address. To indicate the
  7924  //     authenticated user, you can use the special value `me`.
  7925  func (r *UsersSettingsCseKeypairsService) Obliterate(userId string, keyPairId string, obliteratecsekeypairrequest *ObliterateCseKeyPairRequest) *UsersSettingsCseKeypairsObliterateCall {
  7926  	c := &UsersSettingsCseKeypairsObliterateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  7927  	c.userId = userId
  7928  	c.keyPairId = keyPairId
  7929  	c.obliteratecsekeypairrequest = obliteratecsekeypairrequest
  7930  	return c
  7931  }
  7932  
  7933  // Fields allows partial responses to be retrieved. See
  7934  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  7935  // details.
  7936  func (c *UsersSettingsCseKeypairsObliterateCall) Fields(s ...googleapi.Field) *UsersSettingsCseKeypairsObliterateCall {
  7937  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  7938  	return c
  7939  }
  7940  
  7941  // Context sets the context to be used in this call's Do method.
  7942  func (c *UsersSettingsCseKeypairsObliterateCall) Context(ctx context.Context) *UsersSettingsCseKeypairsObliterateCall {
  7943  	c.ctx_ = ctx
  7944  	return c
  7945  }
  7946  
  7947  // Header returns a http.Header that can be modified by the caller to add
  7948  // headers to the request.
  7949  func (c *UsersSettingsCseKeypairsObliterateCall) Header() http.Header {
  7950  	if c.header_ == nil {
  7951  		c.header_ = make(http.Header)
  7952  	}
  7953  	return c.header_
  7954  }
  7955  
  7956  func (c *UsersSettingsCseKeypairsObliterateCall) doRequest(alt string) (*http.Response, error) {
  7957  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
  7958  	var body io.Reader = nil
  7959  	body, err := googleapi.WithoutDataWrapper.JSONReader(c.obliteratecsekeypairrequest)
  7960  	if err != nil {
  7961  		return nil, err
  7962  	}
  7963  	c.urlParams_.Set("alt", alt)
  7964  	c.urlParams_.Set("prettyPrint", "false")
  7965  	urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/settings/cse/keypairs/{keyPairId}:obliterate")
  7966  	urls += "?" + c.urlParams_.Encode()
  7967  	req, err := http.NewRequest("POST", urls, body)
  7968  	if err != nil {
  7969  		return nil, err
  7970  	}
  7971  	req.Header = reqHeaders
  7972  	googleapi.Expand(req.URL, map[string]string{
  7973  		"userId":    c.userId,
  7974  		"keyPairId": c.keyPairId,
  7975  	})
  7976  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  7977  }
  7978  
  7979  // Do executes the "gmail.users.settings.cse.keypairs.obliterate" call.
  7980  func (c *UsersSettingsCseKeypairsObliterateCall) Do(opts ...googleapi.CallOption) error {
  7981  	gensupport.SetOptions(c.urlParams_, opts...)
  7982  	res, err := c.doRequest("json")
  7983  	if err != nil {
  7984  		return err
  7985  	}
  7986  	defer googleapi.CloseBody(res)
  7987  	if err := googleapi.CheckResponse(res); err != nil {
  7988  		return gensupport.WrapError(err)
  7989  	}
  7990  	return nil
  7991  }
  7992  
  7993  type UsersSettingsDelegatesCreateCall struct {
  7994  	s          *Service
  7995  	userId     string
  7996  	delegate   *Delegate
  7997  	urlParams_ gensupport.URLParams
  7998  	ctx_       context.Context
  7999  	header_    http.Header
  8000  }
  8001  
  8002  // Create: Adds a delegate with its verification status set directly to
  8003  // `accepted`, without sending any verification email. The delegate user must
  8004  // be a member of the same Google Workspace organization as the delegator user.
  8005  // Gmail imposes limitations on the number of delegates and delegators each
  8006  // user in a Google Workspace organization can have. These limits depend on
  8007  // your organization, but in general each user can have up to 25 delegates and
  8008  // up to 10 delegators. Note that a delegate user must be referred to by their
  8009  // primary email address, and not an email alias. Also note that when a new
  8010  // delegate is created, there may be up to a one minute delay before the new
  8011  // delegate is available for use. This method is only available to service
  8012  // account clients that have been delegated domain-wide authority.
  8013  //
  8014  //   - userId: User's email address. The special value "me" can be used to
  8015  //     indicate the authenticated user.
  8016  func (r *UsersSettingsDelegatesService) Create(userId string, delegate *Delegate) *UsersSettingsDelegatesCreateCall {
  8017  	c := &UsersSettingsDelegatesCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  8018  	c.userId = userId
  8019  	c.delegate = delegate
  8020  	return c
  8021  }
  8022  
  8023  // Fields allows partial responses to be retrieved. See
  8024  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  8025  // details.
  8026  func (c *UsersSettingsDelegatesCreateCall) Fields(s ...googleapi.Field) *UsersSettingsDelegatesCreateCall {
  8027  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  8028  	return c
  8029  }
  8030  
  8031  // Context sets the context to be used in this call's Do method.
  8032  func (c *UsersSettingsDelegatesCreateCall) Context(ctx context.Context) *UsersSettingsDelegatesCreateCall {
  8033  	c.ctx_ = ctx
  8034  	return c
  8035  }
  8036  
  8037  // Header returns a http.Header that can be modified by the caller to add
  8038  // headers to the request.
  8039  func (c *UsersSettingsDelegatesCreateCall) Header() http.Header {
  8040  	if c.header_ == nil {
  8041  		c.header_ = make(http.Header)
  8042  	}
  8043  	return c.header_
  8044  }
  8045  
  8046  func (c *UsersSettingsDelegatesCreateCall) doRequest(alt string) (*http.Response, error) {
  8047  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
  8048  	var body io.Reader = nil
  8049  	body, err := googleapi.WithoutDataWrapper.JSONReader(c.delegate)
  8050  	if err != nil {
  8051  		return nil, err
  8052  	}
  8053  	c.urlParams_.Set("alt", alt)
  8054  	c.urlParams_.Set("prettyPrint", "false")
  8055  	urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/settings/delegates")
  8056  	urls += "?" + c.urlParams_.Encode()
  8057  	req, err := http.NewRequest("POST", urls, body)
  8058  	if err != nil {
  8059  		return nil, err
  8060  	}
  8061  	req.Header = reqHeaders
  8062  	googleapi.Expand(req.URL, map[string]string{
  8063  		"userId": c.userId,
  8064  	})
  8065  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  8066  }
  8067  
  8068  // Do executes the "gmail.users.settings.delegates.create" call.
  8069  // Any non-2xx status code is an error. Response headers are in either
  8070  // *Delegate.ServerResponse.Header or (if a response was returned at all) in
  8071  // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  8072  // whether the returned error was because http.StatusNotModified was returned.
  8073  func (c *UsersSettingsDelegatesCreateCall) Do(opts ...googleapi.CallOption) (*Delegate, error) {
  8074  	gensupport.SetOptions(c.urlParams_, opts...)
  8075  	res, err := c.doRequest("json")
  8076  	if res != nil && res.StatusCode == http.StatusNotModified {
  8077  		if res.Body != nil {
  8078  			res.Body.Close()
  8079  		}
  8080  		return nil, gensupport.WrapError(&googleapi.Error{
  8081  			Code:   res.StatusCode,
  8082  			Header: res.Header,
  8083  		})
  8084  	}
  8085  	if err != nil {
  8086  		return nil, err
  8087  	}
  8088  	defer googleapi.CloseBody(res)
  8089  	if err := googleapi.CheckResponse(res); err != nil {
  8090  		return nil, gensupport.WrapError(err)
  8091  	}
  8092  	ret := &Delegate{
  8093  		ServerResponse: googleapi.ServerResponse{
  8094  			Header:         res.Header,
  8095  			HTTPStatusCode: res.StatusCode,
  8096  		},
  8097  	}
  8098  	target := &ret
  8099  	if err := gensupport.DecodeResponse(target, res); err != nil {
  8100  		return nil, err
  8101  	}
  8102  	return ret, nil
  8103  }
  8104  
  8105  type UsersSettingsDelegatesDeleteCall struct {
  8106  	s             *Service
  8107  	userId        string
  8108  	delegateEmail string
  8109  	urlParams_    gensupport.URLParams
  8110  	ctx_          context.Context
  8111  	header_       http.Header
  8112  }
  8113  
  8114  // Delete: Removes the specified delegate (which can be of any verification
  8115  // status), and revokes any verification that may have been required for using
  8116  // it. Note that a delegate user must be referred to by their primary email
  8117  // address, and not an email alias. This method is only available to service
  8118  // account clients that have been delegated domain-wide authority.
  8119  //
  8120  //   - delegateEmail: The email address of the user to be removed as a delegate.
  8121  //   - userId: User's email address. The special value "me" can be used to
  8122  //     indicate the authenticated user.
  8123  func (r *UsersSettingsDelegatesService) Delete(userId string, delegateEmail string) *UsersSettingsDelegatesDeleteCall {
  8124  	c := &UsersSettingsDelegatesDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  8125  	c.userId = userId
  8126  	c.delegateEmail = delegateEmail
  8127  	return c
  8128  }
  8129  
  8130  // Fields allows partial responses to be retrieved. See
  8131  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  8132  // details.
  8133  func (c *UsersSettingsDelegatesDeleteCall) Fields(s ...googleapi.Field) *UsersSettingsDelegatesDeleteCall {
  8134  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  8135  	return c
  8136  }
  8137  
  8138  // Context sets the context to be used in this call's Do method.
  8139  func (c *UsersSettingsDelegatesDeleteCall) Context(ctx context.Context) *UsersSettingsDelegatesDeleteCall {
  8140  	c.ctx_ = ctx
  8141  	return c
  8142  }
  8143  
  8144  // Header returns a http.Header that can be modified by the caller to add
  8145  // headers to the request.
  8146  func (c *UsersSettingsDelegatesDeleteCall) Header() http.Header {
  8147  	if c.header_ == nil {
  8148  		c.header_ = make(http.Header)
  8149  	}
  8150  	return c.header_
  8151  }
  8152  
  8153  func (c *UsersSettingsDelegatesDeleteCall) doRequest(alt string) (*http.Response, error) {
  8154  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
  8155  	var body io.Reader = nil
  8156  	c.urlParams_.Set("alt", alt)
  8157  	c.urlParams_.Set("prettyPrint", "false")
  8158  	urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/settings/delegates/{delegateEmail}")
  8159  	urls += "?" + c.urlParams_.Encode()
  8160  	req, err := http.NewRequest("DELETE", urls, body)
  8161  	if err != nil {
  8162  		return nil, err
  8163  	}
  8164  	req.Header = reqHeaders
  8165  	googleapi.Expand(req.URL, map[string]string{
  8166  		"userId":        c.userId,
  8167  		"delegateEmail": c.delegateEmail,
  8168  	})
  8169  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  8170  }
  8171  
  8172  // Do executes the "gmail.users.settings.delegates.delete" call.
  8173  func (c *UsersSettingsDelegatesDeleteCall) Do(opts ...googleapi.CallOption) error {
  8174  	gensupport.SetOptions(c.urlParams_, opts...)
  8175  	res, err := c.doRequest("json")
  8176  	if err != nil {
  8177  		return err
  8178  	}
  8179  	defer googleapi.CloseBody(res)
  8180  	if err := googleapi.CheckResponse(res); err != nil {
  8181  		return gensupport.WrapError(err)
  8182  	}
  8183  	return nil
  8184  }
  8185  
  8186  type UsersSettingsDelegatesGetCall struct {
  8187  	s             *Service
  8188  	userId        string
  8189  	delegateEmail string
  8190  	urlParams_    gensupport.URLParams
  8191  	ifNoneMatch_  string
  8192  	ctx_          context.Context
  8193  	header_       http.Header
  8194  }
  8195  
  8196  // Get: Gets the specified delegate. Note that a delegate user must be referred
  8197  // to by their primary email address, and not an email alias. This method is
  8198  // only available to service account clients that have been delegated
  8199  // domain-wide authority.
  8200  //
  8201  //   - delegateEmail: The email address of the user whose delegate relationship
  8202  //     is to be retrieved.
  8203  //   - userId: User's email address. The special value "me" can be used to
  8204  //     indicate the authenticated user.
  8205  func (r *UsersSettingsDelegatesService) Get(userId string, delegateEmail string) *UsersSettingsDelegatesGetCall {
  8206  	c := &UsersSettingsDelegatesGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  8207  	c.userId = userId
  8208  	c.delegateEmail = delegateEmail
  8209  	return c
  8210  }
  8211  
  8212  // Fields allows partial responses to be retrieved. See
  8213  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  8214  // details.
  8215  func (c *UsersSettingsDelegatesGetCall) Fields(s ...googleapi.Field) *UsersSettingsDelegatesGetCall {
  8216  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  8217  	return c
  8218  }
  8219  
  8220  // IfNoneMatch sets an optional parameter which makes the operation fail if the
  8221  // object's ETag matches the given value. This is useful for getting updates
  8222  // only after the object has changed since the last request.
  8223  func (c *UsersSettingsDelegatesGetCall) IfNoneMatch(entityTag string) *UsersSettingsDelegatesGetCall {
  8224  	c.ifNoneMatch_ = entityTag
  8225  	return c
  8226  }
  8227  
  8228  // Context sets the context to be used in this call's Do method.
  8229  func (c *UsersSettingsDelegatesGetCall) Context(ctx context.Context) *UsersSettingsDelegatesGetCall {
  8230  	c.ctx_ = ctx
  8231  	return c
  8232  }
  8233  
  8234  // Header returns a http.Header that can be modified by the caller to add
  8235  // headers to the request.
  8236  func (c *UsersSettingsDelegatesGetCall) Header() http.Header {
  8237  	if c.header_ == nil {
  8238  		c.header_ = make(http.Header)
  8239  	}
  8240  	return c.header_
  8241  }
  8242  
  8243  func (c *UsersSettingsDelegatesGetCall) doRequest(alt string) (*http.Response, error) {
  8244  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
  8245  	if c.ifNoneMatch_ != "" {
  8246  		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  8247  	}
  8248  	var body io.Reader = nil
  8249  	c.urlParams_.Set("alt", alt)
  8250  	c.urlParams_.Set("prettyPrint", "false")
  8251  	urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/settings/delegates/{delegateEmail}")
  8252  	urls += "?" + c.urlParams_.Encode()
  8253  	req, err := http.NewRequest("GET", urls, body)
  8254  	if err != nil {
  8255  		return nil, err
  8256  	}
  8257  	req.Header = reqHeaders
  8258  	googleapi.Expand(req.URL, map[string]string{
  8259  		"userId":        c.userId,
  8260  		"delegateEmail": c.delegateEmail,
  8261  	})
  8262  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  8263  }
  8264  
  8265  // Do executes the "gmail.users.settings.delegates.get" call.
  8266  // Any non-2xx status code is an error. Response headers are in either
  8267  // *Delegate.ServerResponse.Header or (if a response was returned at all) in
  8268  // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  8269  // whether the returned error was because http.StatusNotModified was returned.
  8270  func (c *UsersSettingsDelegatesGetCall) Do(opts ...googleapi.CallOption) (*Delegate, error) {
  8271  	gensupport.SetOptions(c.urlParams_, opts...)
  8272  	res, err := c.doRequest("json")
  8273  	if res != nil && res.StatusCode == http.StatusNotModified {
  8274  		if res.Body != nil {
  8275  			res.Body.Close()
  8276  		}
  8277  		return nil, gensupport.WrapError(&googleapi.Error{
  8278  			Code:   res.StatusCode,
  8279  			Header: res.Header,
  8280  		})
  8281  	}
  8282  	if err != nil {
  8283  		return nil, err
  8284  	}
  8285  	defer googleapi.CloseBody(res)
  8286  	if err := googleapi.CheckResponse(res); err != nil {
  8287  		return nil, gensupport.WrapError(err)
  8288  	}
  8289  	ret := &Delegate{
  8290  		ServerResponse: googleapi.ServerResponse{
  8291  			Header:         res.Header,
  8292  			HTTPStatusCode: res.StatusCode,
  8293  		},
  8294  	}
  8295  	target := &ret
  8296  	if err := gensupport.DecodeResponse(target, res); err != nil {
  8297  		return nil, err
  8298  	}
  8299  	return ret, nil
  8300  }
  8301  
  8302  type UsersSettingsDelegatesListCall struct {
  8303  	s            *Service
  8304  	userId       string
  8305  	urlParams_   gensupport.URLParams
  8306  	ifNoneMatch_ string
  8307  	ctx_         context.Context
  8308  	header_      http.Header
  8309  }
  8310  
  8311  // List: Lists the delegates for the specified account. This method is only
  8312  // available to service account clients that have been delegated domain-wide
  8313  // authority.
  8314  //
  8315  //   - userId: User's email address. The special value "me" can be used to
  8316  //     indicate the authenticated user.
  8317  func (r *UsersSettingsDelegatesService) List(userId string) *UsersSettingsDelegatesListCall {
  8318  	c := &UsersSettingsDelegatesListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  8319  	c.userId = userId
  8320  	return c
  8321  }
  8322  
  8323  // Fields allows partial responses to be retrieved. See
  8324  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  8325  // details.
  8326  func (c *UsersSettingsDelegatesListCall) Fields(s ...googleapi.Field) *UsersSettingsDelegatesListCall {
  8327  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  8328  	return c
  8329  }
  8330  
  8331  // IfNoneMatch sets an optional parameter which makes the operation fail if the
  8332  // object's ETag matches the given value. This is useful for getting updates
  8333  // only after the object has changed since the last request.
  8334  func (c *UsersSettingsDelegatesListCall) IfNoneMatch(entityTag string) *UsersSettingsDelegatesListCall {
  8335  	c.ifNoneMatch_ = entityTag
  8336  	return c
  8337  }
  8338  
  8339  // Context sets the context to be used in this call's Do method.
  8340  func (c *UsersSettingsDelegatesListCall) Context(ctx context.Context) *UsersSettingsDelegatesListCall {
  8341  	c.ctx_ = ctx
  8342  	return c
  8343  }
  8344  
  8345  // Header returns a http.Header that can be modified by the caller to add
  8346  // headers to the request.
  8347  func (c *UsersSettingsDelegatesListCall) Header() http.Header {
  8348  	if c.header_ == nil {
  8349  		c.header_ = make(http.Header)
  8350  	}
  8351  	return c.header_
  8352  }
  8353  
  8354  func (c *UsersSettingsDelegatesListCall) doRequest(alt string) (*http.Response, error) {
  8355  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
  8356  	if c.ifNoneMatch_ != "" {
  8357  		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  8358  	}
  8359  	var body io.Reader = nil
  8360  	c.urlParams_.Set("alt", alt)
  8361  	c.urlParams_.Set("prettyPrint", "false")
  8362  	urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/settings/delegates")
  8363  	urls += "?" + c.urlParams_.Encode()
  8364  	req, err := http.NewRequest("GET", urls, body)
  8365  	if err != nil {
  8366  		return nil, err
  8367  	}
  8368  	req.Header = reqHeaders
  8369  	googleapi.Expand(req.URL, map[string]string{
  8370  		"userId": c.userId,
  8371  	})
  8372  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  8373  }
  8374  
  8375  // Do executes the "gmail.users.settings.delegates.list" call.
  8376  // Any non-2xx status code is an error. Response headers are in either
  8377  // *ListDelegatesResponse.ServerResponse.Header or (if a response was returned
  8378  // at all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  8379  // check whether the returned error was because http.StatusNotModified was
  8380  // returned.
  8381  func (c *UsersSettingsDelegatesListCall) Do(opts ...googleapi.CallOption) (*ListDelegatesResponse, error) {
  8382  	gensupport.SetOptions(c.urlParams_, opts...)
  8383  	res, err := c.doRequest("json")
  8384  	if res != nil && res.StatusCode == http.StatusNotModified {
  8385  		if res.Body != nil {
  8386  			res.Body.Close()
  8387  		}
  8388  		return nil, gensupport.WrapError(&googleapi.Error{
  8389  			Code:   res.StatusCode,
  8390  			Header: res.Header,
  8391  		})
  8392  	}
  8393  	if err != nil {
  8394  		return nil, err
  8395  	}
  8396  	defer googleapi.CloseBody(res)
  8397  	if err := googleapi.CheckResponse(res); err != nil {
  8398  		return nil, gensupport.WrapError(err)
  8399  	}
  8400  	ret := &ListDelegatesResponse{
  8401  		ServerResponse: googleapi.ServerResponse{
  8402  			Header:         res.Header,
  8403  			HTTPStatusCode: res.StatusCode,
  8404  		},
  8405  	}
  8406  	target := &ret
  8407  	if err := gensupport.DecodeResponse(target, res); err != nil {
  8408  		return nil, err
  8409  	}
  8410  	return ret, nil
  8411  }
  8412  
  8413  type UsersSettingsFiltersCreateCall struct {
  8414  	s          *Service
  8415  	userId     string
  8416  	filter     *Filter
  8417  	urlParams_ gensupport.URLParams
  8418  	ctx_       context.Context
  8419  	header_    http.Header
  8420  }
  8421  
  8422  // Create: Creates a filter. Note: you can only create a maximum of 1,000
  8423  // filters.
  8424  //
  8425  //   - userId: User's email address. The special value "me" can be used to
  8426  //     indicate the authenticated user.
  8427  func (r *UsersSettingsFiltersService) Create(userId string, filter *Filter) *UsersSettingsFiltersCreateCall {
  8428  	c := &UsersSettingsFiltersCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  8429  	c.userId = userId
  8430  	c.filter = filter
  8431  	return c
  8432  }
  8433  
  8434  // Fields allows partial responses to be retrieved. See
  8435  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  8436  // details.
  8437  func (c *UsersSettingsFiltersCreateCall) Fields(s ...googleapi.Field) *UsersSettingsFiltersCreateCall {
  8438  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  8439  	return c
  8440  }
  8441  
  8442  // Context sets the context to be used in this call's Do method.
  8443  func (c *UsersSettingsFiltersCreateCall) Context(ctx context.Context) *UsersSettingsFiltersCreateCall {
  8444  	c.ctx_ = ctx
  8445  	return c
  8446  }
  8447  
  8448  // Header returns a http.Header that can be modified by the caller to add
  8449  // headers to the request.
  8450  func (c *UsersSettingsFiltersCreateCall) Header() http.Header {
  8451  	if c.header_ == nil {
  8452  		c.header_ = make(http.Header)
  8453  	}
  8454  	return c.header_
  8455  }
  8456  
  8457  func (c *UsersSettingsFiltersCreateCall) doRequest(alt string) (*http.Response, error) {
  8458  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
  8459  	var body io.Reader = nil
  8460  	body, err := googleapi.WithoutDataWrapper.JSONReader(c.filter)
  8461  	if err != nil {
  8462  		return nil, err
  8463  	}
  8464  	c.urlParams_.Set("alt", alt)
  8465  	c.urlParams_.Set("prettyPrint", "false")
  8466  	urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/settings/filters")
  8467  	urls += "?" + c.urlParams_.Encode()
  8468  	req, err := http.NewRequest("POST", urls, body)
  8469  	if err != nil {
  8470  		return nil, err
  8471  	}
  8472  	req.Header = reqHeaders
  8473  	googleapi.Expand(req.URL, map[string]string{
  8474  		"userId": c.userId,
  8475  	})
  8476  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  8477  }
  8478  
  8479  // Do executes the "gmail.users.settings.filters.create" call.
  8480  // Any non-2xx status code is an error. Response headers are in either
  8481  // *Filter.ServerResponse.Header or (if a response was returned at all) in
  8482  // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  8483  // whether the returned error was because http.StatusNotModified was returned.
  8484  func (c *UsersSettingsFiltersCreateCall) Do(opts ...googleapi.CallOption) (*Filter, error) {
  8485  	gensupport.SetOptions(c.urlParams_, opts...)
  8486  	res, err := c.doRequest("json")
  8487  	if res != nil && res.StatusCode == http.StatusNotModified {
  8488  		if res.Body != nil {
  8489  			res.Body.Close()
  8490  		}
  8491  		return nil, gensupport.WrapError(&googleapi.Error{
  8492  			Code:   res.StatusCode,
  8493  			Header: res.Header,
  8494  		})
  8495  	}
  8496  	if err != nil {
  8497  		return nil, err
  8498  	}
  8499  	defer googleapi.CloseBody(res)
  8500  	if err := googleapi.CheckResponse(res); err != nil {
  8501  		return nil, gensupport.WrapError(err)
  8502  	}
  8503  	ret := &Filter{
  8504  		ServerResponse: googleapi.ServerResponse{
  8505  			Header:         res.Header,
  8506  			HTTPStatusCode: res.StatusCode,
  8507  		},
  8508  	}
  8509  	target := &ret
  8510  	if err := gensupport.DecodeResponse(target, res); err != nil {
  8511  		return nil, err
  8512  	}
  8513  	return ret, nil
  8514  }
  8515  
  8516  type UsersSettingsFiltersDeleteCall struct {
  8517  	s          *Service
  8518  	userId     string
  8519  	id         string
  8520  	urlParams_ gensupport.URLParams
  8521  	ctx_       context.Context
  8522  	header_    http.Header
  8523  }
  8524  
  8525  // Delete: Immediately and permanently deletes the specified filter.
  8526  //
  8527  //   - id: The ID of the filter to be deleted.
  8528  //   - userId: User's email address. The special value "me" can be used to
  8529  //     indicate the authenticated user.
  8530  func (r *UsersSettingsFiltersService) Delete(userId string, id string) *UsersSettingsFiltersDeleteCall {
  8531  	c := &UsersSettingsFiltersDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  8532  	c.userId = userId
  8533  	c.id = id
  8534  	return c
  8535  }
  8536  
  8537  // Fields allows partial responses to be retrieved. See
  8538  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  8539  // details.
  8540  func (c *UsersSettingsFiltersDeleteCall) Fields(s ...googleapi.Field) *UsersSettingsFiltersDeleteCall {
  8541  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  8542  	return c
  8543  }
  8544  
  8545  // Context sets the context to be used in this call's Do method.
  8546  func (c *UsersSettingsFiltersDeleteCall) Context(ctx context.Context) *UsersSettingsFiltersDeleteCall {
  8547  	c.ctx_ = ctx
  8548  	return c
  8549  }
  8550  
  8551  // Header returns a http.Header that can be modified by the caller to add
  8552  // headers to the request.
  8553  func (c *UsersSettingsFiltersDeleteCall) Header() http.Header {
  8554  	if c.header_ == nil {
  8555  		c.header_ = make(http.Header)
  8556  	}
  8557  	return c.header_
  8558  }
  8559  
  8560  func (c *UsersSettingsFiltersDeleteCall) doRequest(alt string) (*http.Response, error) {
  8561  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
  8562  	var body io.Reader = nil
  8563  	c.urlParams_.Set("alt", alt)
  8564  	c.urlParams_.Set("prettyPrint", "false")
  8565  	urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/settings/filters/{id}")
  8566  	urls += "?" + c.urlParams_.Encode()
  8567  	req, err := http.NewRequest("DELETE", urls, body)
  8568  	if err != nil {
  8569  		return nil, err
  8570  	}
  8571  	req.Header = reqHeaders
  8572  	googleapi.Expand(req.URL, map[string]string{
  8573  		"userId": c.userId,
  8574  		"id":     c.id,
  8575  	})
  8576  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  8577  }
  8578  
  8579  // Do executes the "gmail.users.settings.filters.delete" call.
  8580  func (c *UsersSettingsFiltersDeleteCall) Do(opts ...googleapi.CallOption) error {
  8581  	gensupport.SetOptions(c.urlParams_, opts...)
  8582  	res, err := c.doRequest("json")
  8583  	if err != nil {
  8584  		return err
  8585  	}
  8586  	defer googleapi.CloseBody(res)
  8587  	if err := googleapi.CheckResponse(res); err != nil {
  8588  		return gensupport.WrapError(err)
  8589  	}
  8590  	return nil
  8591  }
  8592  
  8593  type UsersSettingsFiltersGetCall struct {
  8594  	s            *Service
  8595  	userId       string
  8596  	id           string
  8597  	urlParams_   gensupport.URLParams
  8598  	ifNoneMatch_ string
  8599  	ctx_         context.Context
  8600  	header_      http.Header
  8601  }
  8602  
  8603  // Get: Gets a filter.
  8604  //
  8605  //   - id: The ID of the filter to be fetched.
  8606  //   - userId: User's email address. The special value "me" can be used to
  8607  //     indicate the authenticated user.
  8608  func (r *UsersSettingsFiltersService) Get(userId string, id string) *UsersSettingsFiltersGetCall {
  8609  	c := &UsersSettingsFiltersGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  8610  	c.userId = userId
  8611  	c.id = id
  8612  	return c
  8613  }
  8614  
  8615  // Fields allows partial responses to be retrieved. See
  8616  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  8617  // details.
  8618  func (c *UsersSettingsFiltersGetCall) Fields(s ...googleapi.Field) *UsersSettingsFiltersGetCall {
  8619  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  8620  	return c
  8621  }
  8622  
  8623  // IfNoneMatch sets an optional parameter which makes the operation fail if the
  8624  // object's ETag matches the given value. This is useful for getting updates
  8625  // only after the object has changed since the last request.
  8626  func (c *UsersSettingsFiltersGetCall) IfNoneMatch(entityTag string) *UsersSettingsFiltersGetCall {
  8627  	c.ifNoneMatch_ = entityTag
  8628  	return c
  8629  }
  8630  
  8631  // Context sets the context to be used in this call's Do method.
  8632  func (c *UsersSettingsFiltersGetCall) Context(ctx context.Context) *UsersSettingsFiltersGetCall {
  8633  	c.ctx_ = ctx
  8634  	return c
  8635  }
  8636  
  8637  // Header returns a http.Header that can be modified by the caller to add
  8638  // headers to the request.
  8639  func (c *UsersSettingsFiltersGetCall) Header() http.Header {
  8640  	if c.header_ == nil {
  8641  		c.header_ = make(http.Header)
  8642  	}
  8643  	return c.header_
  8644  }
  8645  
  8646  func (c *UsersSettingsFiltersGetCall) doRequest(alt string) (*http.Response, error) {
  8647  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
  8648  	if c.ifNoneMatch_ != "" {
  8649  		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  8650  	}
  8651  	var body io.Reader = nil
  8652  	c.urlParams_.Set("alt", alt)
  8653  	c.urlParams_.Set("prettyPrint", "false")
  8654  	urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/settings/filters/{id}")
  8655  	urls += "?" + c.urlParams_.Encode()
  8656  	req, err := http.NewRequest("GET", urls, body)
  8657  	if err != nil {
  8658  		return nil, err
  8659  	}
  8660  	req.Header = reqHeaders
  8661  	googleapi.Expand(req.URL, map[string]string{
  8662  		"userId": c.userId,
  8663  		"id":     c.id,
  8664  	})
  8665  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  8666  }
  8667  
  8668  // Do executes the "gmail.users.settings.filters.get" call.
  8669  // Any non-2xx status code is an error. Response headers are in either
  8670  // *Filter.ServerResponse.Header or (if a response was returned at all) in
  8671  // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  8672  // whether the returned error was because http.StatusNotModified was returned.
  8673  func (c *UsersSettingsFiltersGetCall) Do(opts ...googleapi.CallOption) (*Filter, error) {
  8674  	gensupport.SetOptions(c.urlParams_, opts...)
  8675  	res, err := c.doRequest("json")
  8676  	if res != nil && res.StatusCode == http.StatusNotModified {
  8677  		if res.Body != nil {
  8678  			res.Body.Close()
  8679  		}
  8680  		return nil, gensupport.WrapError(&googleapi.Error{
  8681  			Code:   res.StatusCode,
  8682  			Header: res.Header,
  8683  		})
  8684  	}
  8685  	if err != nil {
  8686  		return nil, err
  8687  	}
  8688  	defer googleapi.CloseBody(res)
  8689  	if err := googleapi.CheckResponse(res); err != nil {
  8690  		return nil, gensupport.WrapError(err)
  8691  	}
  8692  	ret := &Filter{
  8693  		ServerResponse: googleapi.ServerResponse{
  8694  			Header:         res.Header,
  8695  			HTTPStatusCode: res.StatusCode,
  8696  		},
  8697  	}
  8698  	target := &ret
  8699  	if err := gensupport.DecodeResponse(target, res); err != nil {
  8700  		return nil, err
  8701  	}
  8702  	return ret, nil
  8703  }
  8704  
  8705  type UsersSettingsFiltersListCall struct {
  8706  	s            *Service
  8707  	userId       string
  8708  	urlParams_   gensupport.URLParams
  8709  	ifNoneMatch_ string
  8710  	ctx_         context.Context
  8711  	header_      http.Header
  8712  }
  8713  
  8714  // List: Lists the message filters of a Gmail user.
  8715  //
  8716  //   - userId: User's email address. The special value "me" can be used to
  8717  //     indicate the authenticated user.
  8718  func (r *UsersSettingsFiltersService) List(userId string) *UsersSettingsFiltersListCall {
  8719  	c := &UsersSettingsFiltersListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  8720  	c.userId = userId
  8721  	return c
  8722  }
  8723  
  8724  // Fields allows partial responses to be retrieved. See
  8725  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  8726  // details.
  8727  func (c *UsersSettingsFiltersListCall) Fields(s ...googleapi.Field) *UsersSettingsFiltersListCall {
  8728  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  8729  	return c
  8730  }
  8731  
  8732  // IfNoneMatch sets an optional parameter which makes the operation fail if the
  8733  // object's ETag matches the given value. This is useful for getting updates
  8734  // only after the object has changed since the last request.
  8735  func (c *UsersSettingsFiltersListCall) IfNoneMatch(entityTag string) *UsersSettingsFiltersListCall {
  8736  	c.ifNoneMatch_ = entityTag
  8737  	return c
  8738  }
  8739  
  8740  // Context sets the context to be used in this call's Do method.
  8741  func (c *UsersSettingsFiltersListCall) Context(ctx context.Context) *UsersSettingsFiltersListCall {
  8742  	c.ctx_ = ctx
  8743  	return c
  8744  }
  8745  
  8746  // Header returns a http.Header that can be modified by the caller to add
  8747  // headers to the request.
  8748  func (c *UsersSettingsFiltersListCall) Header() http.Header {
  8749  	if c.header_ == nil {
  8750  		c.header_ = make(http.Header)
  8751  	}
  8752  	return c.header_
  8753  }
  8754  
  8755  func (c *UsersSettingsFiltersListCall) doRequest(alt string) (*http.Response, error) {
  8756  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
  8757  	if c.ifNoneMatch_ != "" {
  8758  		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  8759  	}
  8760  	var body io.Reader = nil
  8761  	c.urlParams_.Set("alt", alt)
  8762  	c.urlParams_.Set("prettyPrint", "false")
  8763  	urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/settings/filters")
  8764  	urls += "?" + c.urlParams_.Encode()
  8765  	req, err := http.NewRequest("GET", urls, body)
  8766  	if err != nil {
  8767  		return nil, err
  8768  	}
  8769  	req.Header = reqHeaders
  8770  	googleapi.Expand(req.URL, map[string]string{
  8771  		"userId": c.userId,
  8772  	})
  8773  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  8774  }
  8775  
  8776  // Do executes the "gmail.users.settings.filters.list" call.
  8777  // Any non-2xx status code is an error. Response headers are in either
  8778  // *ListFiltersResponse.ServerResponse.Header or (if a response was returned at
  8779  // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  8780  // check whether the returned error was because http.StatusNotModified was
  8781  // returned.
  8782  func (c *UsersSettingsFiltersListCall) Do(opts ...googleapi.CallOption) (*ListFiltersResponse, error) {
  8783  	gensupport.SetOptions(c.urlParams_, opts...)
  8784  	res, err := c.doRequest("json")
  8785  	if res != nil && res.StatusCode == http.StatusNotModified {
  8786  		if res.Body != nil {
  8787  			res.Body.Close()
  8788  		}
  8789  		return nil, gensupport.WrapError(&googleapi.Error{
  8790  			Code:   res.StatusCode,
  8791  			Header: res.Header,
  8792  		})
  8793  	}
  8794  	if err != nil {
  8795  		return nil, err
  8796  	}
  8797  	defer googleapi.CloseBody(res)
  8798  	if err := googleapi.CheckResponse(res); err != nil {
  8799  		return nil, gensupport.WrapError(err)
  8800  	}
  8801  	ret := &ListFiltersResponse{
  8802  		ServerResponse: googleapi.ServerResponse{
  8803  			Header:         res.Header,
  8804  			HTTPStatusCode: res.StatusCode,
  8805  		},
  8806  	}
  8807  	target := &ret
  8808  	if err := gensupport.DecodeResponse(target, res); err != nil {
  8809  		return nil, err
  8810  	}
  8811  	return ret, nil
  8812  }
  8813  
  8814  type UsersSettingsForwardingAddressesCreateCall struct {
  8815  	s                 *Service
  8816  	userId            string
  8817  	forwardingaddress *ForwardingAddress
  8818  	urlParams_        gensupport.URLParams
  8819  	ctx_              context.Context
  8820  	header_           http.Header
  8821  }
  8822  
  8823  // Create: Creates a forwarding address. If ownership verification is required,
  8824  // a message will be sent to the recipient and the resource's verification
  8825  // status will be set to `pending`; otherwise, the resource will be created
  8826  // with verification status set to `accepted`. This method is only available to
  8827  // service account clients that have been delegated domain-wide authority.
  8828  //
  8829  //   - userId: User's email address. The special value "me" can be used to
  8830  //     indicate the authenticated user.
  8831  func (r *UsersSettingsForwardingAddressesService) Create(userId string, forwardingaddress *ForwardingAddress) *UsersSettingsForwardingAddressesCreateCall {
  8832  	c := &UsersSettingsForwardingAddressesCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  8833  	c.userId = userId
  8834  	c.forwardingaddress = forwardingaddress
  8835  	return c
  8836  }
  8837  
  8838  // Fields allows partial responses to be retrieved. See
  8839  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  8840  // details.
  8841  func (c *UsersSettingsForwardingAddressesCreateCall) Fields(s ...googleapi.Field) *UsersSettingsForwardingAddressesCreateCall {
  8842  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  8843  	return c
  8844  }
  8845  
  8846  // Context sets the context to be used in this call's Do method.
  8847  func (c *UsersSettingsForwardingAddressesCreateCall) Context(ctx context.Context) *UsersSettingsForwardingAddressesCreateCall {
  8848  	c.ctx_ = ctx
  8849  	return c
  8850  }
  8851  
  8852  // Header returns a http.Header that can be modified by the caller to add
  8853  // headers to the request.
  8854  func (c *UsersSettingsForwardingAddressesCreateCall) Header() http.Header {
  8855  	if c.header_ == nil {
  8856  		c.header_ = make(http.Header)
  8857  	}
  8858  	return c.header_
  8859  }
  8860  
  8861  func (c *UsersSettingsForwardingAddressesCreateCall) doRequest(alt string) (*http.Response, error) {
  8862  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
  8863  	var body io.Reader = nil
  8864  	body, err := googleapi.WithoutDataWrapper.JSONReader(c.forwardingaddress)
  8865  	if err != nil {
  8866  		return nil, err
  8867  	}
  8868  	c.urlParams_.Set("alt", alt)
  8869  	c.urlParams_.Set("prettyPrint", "false")
  8870  	urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/settings/forwardingAddresses")
  8871  	urls += "?" + c.urlParams_.Encode()
  8872  	req, err := http.NewRequest("POST", urls, body)
  8873  	if err != nil {
  8874  		return nil, err
  8875  	}
  8876  	req.Header = reqHeaders
  8877  	googleapi.Expand(req.URL, map[string]string{
  8878  		"userId": c.userId,
  8879  	})
  8880  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  8881  }
  8882  
  8883  // Do executes the "gmail.users.settings.forwardingAddresses.create" call.
  8884  // Any non-2xx status code is an error. Response headers are in either
  8885  // *ForwardingAddress.ServerResponse.Header or (if a response was returned at
  8886  // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  8887  // check whether the returned error was because http.StatusNotModified was
  8888  // returned.
  8889  func (c *UsersSettingsForwardingAddressesCreateCall) Do(opts ...googleapi.CallOption) (*ForwardingAddress, error) {
  8890  	gensupport.SetOptions(c.urlParams_, opts...)
  8891  	res, err := c.doRequest("json")
  8892  	if res != nil && res.StatusCode == http.StatusNotModified {
  8893  		if res.Body != nil {
  8894  			res.Body.Close()
  8895  		}
  8896  		return nil, gensupport.WrapError(&googleapi.Error{
  8897  			Code:   res.StatusCode,
  8898  			Header: res.Header,
  8899  		})
  8900  	}
  8901  	if err != nil {
  8902  		return nil, err
  8903  	}
  8904  	defer googleapi.CloseBody(res)
  8905  	if err := googleapi.CheckResponse(res); err != nil {
  8906  		return nil, gensupport.WrapError(err)
  8907  	}
  8908  	ret := &ForwardingAddress{
  8909  		ServerResponse: googleapi.ServerResponse{
  8910  			Header:         res.Header,
  8911  			HTTPStatusCode: res.StatusCode,
  8912  		},
  8913  	}
  8914  	target := &ret
  8915  	if err := gensupport.DecodeResponse(target, res); err != nil {
  8916  		return nil, err
  8917  	}
  8918  	return ret, nil
  8919  }
  8920  
  8921  type UsersSettingsForwardingAddressesDeleteCall struct {
  8922  	s               *Service
  8923  	userId          string
  8924  	forwardingEmail string
  8925  	urlParams_      gensupport.URLParams
  8926  	ctx_            context.Context
  8927  	header_         http.Header
  8928  }
  8929  
  8930  // Delete: Deletes the specified forwarding address and revokes any
  8931  // verification that may have been required. This method is only available to
  8932  // service account clients that have been delegated domain-wide authority.
  8933  //
  8934  //   - forwardingEmail: The forwarding address to be deleted.
  8935  //   - userId: User's email address. The special value "me" can be used to
  8936  //     indicate the authenticated user.
  8937  func (r *UsersSettingsForwardingAddressesService) Delete(userId string, forwardingEmail string) *UsersSettingsForwardingAddressesDeleteCall {
  8938  	c := &UsersSettingsForwardingAddressesDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  8939  	c.userId = userId
  8940  	c.forwardingEmail = forwardingEmail
  8941  	return c
  8942  }
  8943  
  8944  // Fields allows partial responses to be retrieved. See
  8945  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  8946  // details.
  8947  func (c *UsersSettingsForwardingAddressesDeleteCall) Fields(s ...googleapi.Field) *UsersSettingsForwardingAddressesDeleteCall {
  8948  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  8949  	return c
  8950  }
  8951  
  8952  // Context sets the context to be used in this call's Do method.
  8953  func (c *UsersSettingsForwardingAddressesDeleteCall) Context(ctx context.Context) *UsersSettingsForwardingAddressesDeleteCall {
  8954  	c.ctx_ = ctx
  8955  	return c
  8956  }
  8957  
  8958  // Header returns a http.Header that can be modified by the caller to add
  8959  // headers to the request.
  8960  func (c *UsersSettingsForwardingAddressesDeleteCall) Header() http.Header {
  8961  	if c.header_ == nil {
  8962  		c.header_ = make(http.Header)
  8963  	}
  8964  	return c.header_
  8965  }
  8966  
  8967  func (c *UsersSettingsForwardingAddressesDeleteCall) doRequest(alt string) (*http.Response, error) {
  8968  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
  8969  	var body io.Reader = nil
  8970  	c.urlParams_.Set("alt", alt)
  8971  	c.urlParams_.Set("prettyPrint", "false")
  8972  	urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/settings/forwardingAddresses/{forwardingEmail}")
  8973  	urls += "?" + c.urlParams_.Encode()
  8974  	req, err := http.NewRequest("DELETE", urls, body)
  8975  	if err != nil {
  8976  		return nil, err
  8977  	}
  8978  	req.Header = reqHeaders
  8979  	googleapi.Expand(req.URL, map[string]string{
  8980  		"userId":          c.userId,
  8981  		"forwardingEmail": c.forwardingEmail,
  8982  	})
  8983  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  8984  }
  8985  
  8986  // Do executes the "gmail.users.settings.forwardingAddresses.delete" call.
  8987  func (c *UsersSettingsForwardingAddressesDeleteCall) Do(opts ...googleapi.CallOption) error {
  8988  	gensupport.SetOptions(c.urlParams_, opts...)
  8989  	res, err := c.doRequest("json")
  8990  	if err != nil {
  8991  		return err
  8992  	}
  8993  	defer googleapi.CloseBody(res)
  8994  	if err := googleapi.CheckResponse(res); err != nil {
  8995  		return gensupport.WrapError(err)
  8996  	}
  8997  	return nil
  8998  }
  8999  
  9000  type UsersSettingsForwardingAddressesGetCall struct {
  9001  	s               *Service
  9002  	userId          string
  9003  	forwardingEmail string
  9004  	urlParams_      gensupport.URLParams
  9005  	ifNoneMatch_    string
  9006  	ctx_            context.Context
  9007  	header_         http.Header
  9008  }
  9009  
  9010  // Get: Gets the specified forwarding address.
  9011  //
  9012  //   - forwardingEmail: The forwarding address to be retrieved.
  9013  //   - userId: User's email address. The special value "me" can be used to
  9014  //     indicate the authenticated user.
  9015  func (r *UsersSettingsForwardingAddressesService) Get(userId string, forwardingEmail string) *UsersSettingsForwardingAddressesGetCall {
  9016  	c := &UsersSettingsForwardingAddressesGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  9017  	c.userId = userId
  9018  	c.forwardingEmail = forwardingEmail
  9019  	return c
  9020  }
  9021  
  9022  // Fields allows partial responses to be retrieved. See
  9023  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  9024  // details.
  9025  func (c *UsersSettingsForwardingAddressesGetCall) Fields(s ...googleapi.Field) *UsersSettingsForwardingAddressesGetCall {
  9026  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  9027  	return c
  9028  }
  9029  
  9030  // IfNoneMatch sets an optional parameter which makes the operation fail if the
  9031  // object's ETag matches the given value. This is useful for getting updates
  9032  // only after the object has changed since the last request.
  9033  func (c *UsersSettingsForwardingAddressesGetCall) IfNoneMatch(entityTag string) *UsersSettingsForwardingAddressesGetCall {
  9034  	c.ifNoneMatch_ = entityTag
  9035  	return c
  9036  }
  9037  
  9038  // Context sets the context to be used in this call's Do method.
  9039  func (c *UsersSettingsForwardingAddressesGetCall) Context(ctx context.Context) *UsersSettingsForwardingAddressesGetCall {
  9040  	c.ctx_ = ctx
  9041  	return c
  9042  }
  9043  
  9044  // Header returns a http.Header that can be modified by the caller to add
  9045  // headers to the request.
  9046  func (c *UsersSettingsForwardingAddressesGetCall) Header() http.Header {
  9047  	if c.header_ == nil {
  9048  		c.header_ = make(http.Header)
  9049  	}
  9050  	return c.header_
  9051  }
  9052  
  9053  func (c *UsersSettingsForwardingAddressesGetCall) doRequest(alt string) (*http.Response, error) {
  9054  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
  9055  	if c.ifNoneMatch_ != "" {
  9056  		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  9057  	}
  9058  	var body io.Reader = nil
  9059  	c.urlParams_.Set("alt", alt)
  9060  	c.urlParams_.Set("prettyPrint", "false")
  9061  	urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/settings/forwardingAddresses/{forwardingEmail}")
  9062  	urls += "?" + c.urlParams_.Encode()
  9063  	req, err := http.NewRequest("GET", urls, body)
  9064  	if err != nil {
  9065  		return nil, err
  9066  	}
  9067  	req.Header = reqHeaders
  9068  	googleapi.Expand(req.URL, map[string]string{
  9069  		"userId":          c.userId,
  9070  		"forwardingEmail": c.forwardingEmail,
  9071  	})
  9072  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  9073  }
  9074  
  9075  // Do executes the "gmail.users.settings.forwardingAddresses.get" call.
  9076  // Any non-2xx status code is an error. Response headers are in either
  9077  // *ForwardingAddress.ServerResponse.Header or (if a response was returned at
  9078  // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  9079  // check whether the returned error was because http.StatusNotModified was
  9080  // returned.
  9081  func (c *UsersSettingsForwardingAddressesGetCall) Do(opts ...googleapi.CallOption) (*ForwardingAddress, error) {
  9082  	gensupport.SetOptions(c.urlParams_, opts...)
  9083  	res, err := c.doRequest("json")
  9084  	if res != nil && res.StatusCode == http.StatusNotModified {
  9085  		if res.Body != nil {
  9086  			res.Body.Close()
  9087  		}
  9088  		return nil, gensupport.WrapError(&googleapi.Error{
  9089  			Code:   res.StatusCode,
  9090  			Header: res.Header,
  9091  		})
  9092  	}
  9093  	if err != nil {
  9094  		return nil, err
  9095  	}
  9096  	defer googleapi.CloseBody(res)
  9097  	if err := googleapi.CheckResponse(res); err != nil {
  9098  		return nil, gensupport.WrapError(err)
  9099  	}
  9100  	ret := &ForwardingAddress{
  9101  		ServerResponse: googleapi.ServerResponse{
  9102  			Header:         res.Header,
  9103  			HTTPStatusCode: res.StatusCode,
  9104  		},
  9105  	}
  9106  	target := &ret
  9107  	if err := gensupport.DecodeResponse(target, res); err != nil {
  9108  		return nil, err
  9109  	}
  9110  	return ret, nil
  9111  }
  9112  
  9113  type UsersSettingsForwardingAddressesListCall struct {
  9114  	s            *Service
  9115  	userId       string
  9116  	urlParams_   gensupport.URLParams
  9117  	ifNoneMatch_ string
  9118  	ctx_         context.Context
  9119  	header_      http.Header
  9120  }
  9121  
  9122  // List: Lists the forwarding addresses for the specified account.
  9123  //
  9124  //   - userId: User's email address. The special value "me" can be used to
  9125  //     indicate the authenticated user.
  9126  func (r *UsersSettingsForwardingAddressesService) List(userId string) *UsersSettingsForwardingAddressesListCall {
  9127  	c := &UsersSettingsForwardingAddressesListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  9128  	c.userId = userId
  9129  	return c
  9130  }
  9131  
  9132  // Fields allows partial responses to be retrieved. See
  9133  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  9134  // details.
  9135  func (c *UsersSettingsForwardingAddressesListCall) Fields(s ...googleapi.Field) *UsersSettingsForwardingAddressesListCall {
  9136  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  9137  	return c
  9138  }
  9139  
  9140  // IfNoneMatch sets an optional parameter which makes the operation fail if the
  9141  // object's ETag matches the given value. This is useful for getting updates
  9142  // only after the object has changed since the last request.
  9143  func (c *UsersSettingsForwardingAddressesListCall) IfNoneMatch(entityTag string) *UsersSettingsForwardingAddressesListCall {
  9144  	c.ifNoneMatch_ = entityTag
  9145  	return c
  9146  }
  9147  
  9148  // Context sets the context to be used in this call's Do method.
  9149  func (c *UsersSettingsForwardingAddressesListCall) Context(ctx context.Context) *UsersSettingsForwardingAddressesListCall {
  9150  	c.ctx_ = ctx
  9151  	return c
  9152  }
  9153  
  9154  // Header returns a http.Header that can be modified by the caller to add
  9155  // headers to the request.
  9156  func (c *UsersSettingsForwardingAddressesListCall) Header() http.Header {
  9157  	if c.header_ == nil {
  9158  		c.header_ = make(http.Header)
  9159  	}
  9160  	return c.header_
  9161  }
  9162  
  9163  func (c *UsersSettingsForwardingAddressesListCall) doRequest(alt string) (*http.Response, error) {
  9164  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
  9165  	if c.ifNoneMatch_ != "" {
  9166  		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  9167  	}
  9168  	var body io.Reader = nil
  9169  	c.urlParams_.Set("alt", alt)
  9170  	c.urlParams_.Set("prettyPrint", "false")
  9171  	urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/settings/forwardingAddresses")
  9172  	urls += "?" + c.urlParams_.Encode()
  9173  	req, err := http.NewRequest("GET", urls, body)
  9174  	if err != nil {
  9175  		return nil, err
  9176  	}
  9177  	req.Header = reqHeaders
  9178  	googleapi.Expand(req.URL, map[string]string{
  9179  		"userId": c.userId,
  9180  	})
  9181  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  9182  }
  9183  
  9184  // Do executes the "gmail.users.settings.forwardingAddresses.list" call.
  9185  // Any non-2xx status code is an error. Response headers are in either
  9186  // *ListForwardingAddressesResponse.ServerResponse.Header or (if a response was
  9187  // returned at all) in error.(*googleapi.Error).Header. Use
  9188  // googleapi.IsNotModified to check whether the returned error was because
  9189  // http.StatusNotModified was returned.
  9190  func (c *UsersSettingsForwardingAddressesListCall) Do(opts ...googleapi.CallOption) (*ListForwardingAddressesResponse, error) {
  9191  	gensupport.SetOptions(c.urlParams_, opts...)
  9192  	res, err := c.doRequest("json")
  9193  	if res != nil && res.StatusCode == http.StatusNotModified {
  9194  		if res.Body != nil {
  9195  			res.Body.Close()
  9196  		}
  9197  		return nil, gensupport.WrapError(&googleapi.Error{
  9198  			Code:   res.StatusCode,
  9199  			Header: res.Header,
  9200  		})
  9201  	}
  9202  	if err != nil {
  9203  		return nil, err
  9204  	}
  9205  	defer googleapi.CloseBody(res)
  9206  	if err := googleapi.CheckResponse(res); err != nil {
  9207  		return nil, gensupport.WrapError(err)
  9208  	}
  9209  	ret := &ListForwardingAddressesResponse{
  9210  		ServerResponse: googleapi.ServerResponse{
  9211  			Header:         res.Header,
  9212  			HTTPStatusCode: res.StatusCode,
  9213  		},
  9214  	}
  9215  	target := &ret
  9216  	if err := gensupport.DecodeResponse(target, res); err != nil {
  9217  		return nil, err
  9218  	}
  9219  	return ret, nil
  9220  }
  9221  
  9222  type UsersSettingsSendAsCreateCall struct {
  9223  	s          *Service
  9224  	userId     string
  9225  	sendas     *SendAs
  9226  	urlParams_ gensupport.URLParams
  9227  	ctx_       context.Context
  9228  	header_    http.Header
  9229  }
  9230  
  9231  // Create: Creates a custom "from" send-as alias. If an SMTP MSA is specified,
  9232  // Gmail will attempt to connect to the SMTP service to validate the
  9233  // configuration before creating the alias. If ownership verification is
  9234  // required for the alias, a message will be sent to the email address and the
  9235  // resource's verification status will be set to `pending`; otherwise, the
  9236  // resource will be created with verification status set to `accepted`. If a
  9237  // signature is provided, Gmail will sanitize the HTML before saving it with
  9238  // the alias. This method is only available to service account clients that
  9239  // have been delegated domain-wide authority.
  9240  //
  9241  //   - userId: User's email address. The special value "me" can be used to
  9242  //     indicate the authenticated user.
  9243  func (r *UsersSettingsSendAsService) Create(userId string, sendas *SendAs) *UsersSettingsSendAsCreateCall {
  9244  	c := &UsersSettingsSendAsCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  9245  	c.userId = userId
  9246  	c.sendas = sendas
  9247  	return c
  9248  }
  9249  
  9250  // Fields allows partial responses to be retrieved. See
  9251  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  9252  // details.
  9253  func (c *UsersSettingsSendAsCreateCall) Fields(s ...googleapi.Field) *UsersSettingsSendAsCreateCall {
  9254  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  9255  	return c
  9256  }
  9257  
  9258  // Context sets the context to be used in this call's Do method.
  9259  func (c *UsersSettingsSendAsCreateCall) Context(ctx context.Context) *UsersSettingsSendAsCreateCall {
  9260  	c.ctx_ = ctx
  9261  	return c
  9262  }
  9263  
  9264  // Header returns a http.Header that can be modified by the caller to add
  9265  // headers to the request.
  9266  func (c *UsersSettingsSendAsCreateCall) Header() http.Header {
  9267  	if c.header_ == nil {
  9268  		c.header_ = make(http.Header)
  9269  	}
  9270  	return c.header_
  9271  }
  9272  
  9273  func (c *UsersSettingsSendAsCreateCall) doRequest(alt string) (*http.Response, error) {
  9274  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
  9275  	var body io.Reader = nil
  9276  	body, err := googleapi.WithoutDataWrapper.JSONReader(c.sendas)
  9277  	if err != nil {
  9278  		return nil, err
  9279  	}
  9280  	c.urlParams_.Set("alt", alt)
  9281  	c.urlParams_.Set("prettyPrint", "false")
  9282  	urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/settings/sendAs")
  9283  	urls += "?" + c.urlParams_.Encode()
  9284  	req, err := http.NewRequest("POST", urls, body)
  9285  	if err != nil {
  9286  		return nil, err
  9287  	}
  9288  	req.Header = reqHeaders
  9289  	googleapi.Expand(req.URL, map[string]string{
  9290  		"userId": c.userId,
  9291  	})
  9292  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  9293  }
  9294  
  9295  // Do executes the "gmail.users.settings.sendAs.create" call.
  9296  // Any non-2xx status code is an error. Response headers are in either
  9297  // *SendAs.ServerResponse.Header or (if a response was returned at all) in
  9298  // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  9299  // whether the returned error was because http.StatusNotModified was returned.
  9300  func (c *UsersSettingsSendAsCreateCall) Do(opts ...googleapi.CallOption) (*SendAs, error) {
  9301  	gensupport.SetOptions(c.urlParams_, opts...)
  9302  	res, err := c.doRequest("json")
  9303  	if res != nil && res.StatusCode == http.StatusNotModified {
  9304  		if res.Body != nil {
  9305  			res.Body.Close()
  9306  		}
  9307  		return nil, gensupport.WrapError(&googleapi.Error{
  9308  			Code:   res.StatusCode,
  9309  			Header: res.Header,
  9310  		})
  9311  	}
  9312  	if err != nil {
  9313  		return nil, err
  9314  	}
  9315  	defer googleapi.CloseBody(res)
  9316  	if err := googleapi.CheckResponse(res); err != nil {
  9317  		return nil, gensupport.WrapError(err)
  9318  	}
  9319  	ret := &SendAs{
  9320  		ServerResponse: googleapi.ServerResponse{
  9321  			Header:         res.Header,
  9322  			HTTPStatusCode: res.StatusCode,
  9323  		},
  9324  	}
  9325  	target := &ret
  9326  	if err := gensupport.DecodeResponse(target, res); err != nil {
  9327  		return nil, err
  9328  	}
  9329  	return ret, nil
  9330  }
  9331  
  9332  type UsersSettingsSendAsDeleteCall struct {
  9333  	s           *Service
  9334  	userId      string
  9335  	sendAsEmail string
  9336  	urlParams_  gensupport.URLParams
  9337  	ctx_        context.Context
  9338  	header_     http.Header
  9339  }
  9340  
  9341  // Delete: Deletes the specified send-as alias. Revokes any verification that
  9342  // may have been required for using it. This method is only available to
  9343  // service account clients that have been delegated domain-wide authority.
  9344  //
  9345  //   - sendAsEmail: The send-as alias to be deleted.
  9346  //   - userId: User's email address. The special value "me" can be used to
  9347  //     indicate the authenticated user.
  9348  func (r *UsersSettingsSendAsService) Delete(userId string, sendAsEmail string) *UsersSettingsSendAsDeleteCall {
  9349  	c := &UsersSettingsSendAsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  9350  	c.userId = userId
  9351  	c.sendAsEmail = sendAsEmail
  9352  	return c
  9353  }
  9354  
  9355  // Fields allows partial responses to be retrieved. See
  9356  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  9357  // details.
  9358  func (c *UsersSettingsSendAsDeleteCall) Fields(s ...googleapi.Field) *UsersSettingsSendAsDeleteCall {
  9359  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  9360  	return c
  9361  }
  9362  
  9363  // Context sets the context to be used in this call's Do method.
  9364  func (c *UsersSettingsSendAsDeleteCall) Context(ctx context.Context) *UsersSettingsSendAsDeleteCall {
  9365  	c.ctx_ = ctx
  9366  	return c
  9367  }
  9368  
  9369  // Header returns a http.Header that can be modified by the caller to add
  9370  // headers to the request.
  9371  func (c *UsersSettingsSendAsDeleteCall) Header() http.Header {
  9372  	if c.header_ == nil {
  9373  		c.header_ = make(http.Header)
  9374  	}
  9375  	return c.header_
  9376  }
  9377  
  9378  func (c *UsersSettingsSendAsDeleteCall) doRequest(alt string) (*http.Response, error) {
  9379  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
  9380  	var body io.Reader = nil
  9381  	c.urlParams_.Set("alt", alt)
  9382  	c.urlParams_.Set("prettyPrint", "false")
  9383  	urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/settings/sendAs/{sendAsEmail}")
  9384  	urls += "?" + c.urlParams_.Encode()
  9385  	req, err := http.NewRequest("DELETE", urls, body)
  9386  	if err != nil {
  9387  		return nil, err
  9388  	}
  9389  	req.Header = reqHeaders
  9390  	googleapi.Expand(req.URL, map[string]string{
  9391  		"userId":      c.userId,
  9392  		"sendAsEmail": c.sendAsEmail,
  9393  	})
  9394  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  9395  }
  9396  
  9397  // Do executes the "gmail.users.settings.sendAs.delete" call.
  9398  func (c *UsersSettingsSendAsDeleteCall) Do(opts ...googleapi.CallOption) error {
  9399  	gensupport.SetOptions(c.urlParams_, opts...)
  9400  	res, err := c.doRequest("json")
  9401  	if err != nil {
  9402  		return err
  9403  	}
  9404  	defer googleapi.CloseBody(res)
  9405  	if err := googleapi.CheckResponse(res); err != nil {
  9406  		return gensupport.WrapError(err)
  9407  	}
  9408  	return nil
  9409  }
  9410  
  9411  type UsersSettingsSendAsGetCall struct {
  9412  	s            *Service
  9413  	userId       string
  9414  	sendAsEmail  string
  9415  	urlParams_   gensupport.URLParams
  9416  	ifNoneMatch_ string
  9417  	ctx_         context.Context
  9418  	header_      http.Header
  9419  }
  9420  
  9421  // Get: Gets the specified send-as alias. Fails with an HTTP 404 error if the
  9422  // specified address is not a member of the collection.
  9423  //
  9424  //   - sendAsEmail: The send-as alias to be retrieved.
  9425  //   - userId: User's email address. The special value "me" can be used to
  9426  //     indicate the authenticated user.
  9427  func (r *UsersSettingsSendAsService) Get(userId string, sendAsEmail string) *UsersSettingsSendAsGetCall {
  9428  	c := &UsersSettingsSendAsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  9429  	c.userId = userId
  9430  	c.sendAsEmail = sendAsEmail
  9431  	return c
  9432  }
  9433  
  9434  // Fields allows partial responses to be retrieved. See
  9435  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  9436  // details.
  9437  func (c *UsersSettingsSendAsGetCall) Fields(s ...googleapi.Field) *UsersSettingsSendAsGetCall {
  9438  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  9439  	return c
  9440  }
  9441  
  9442  // IfNoneMatch sets an optional parameter which makes the operation fail if the
  9443  // object's ETag matches the given value. This is useful for getting updates
  9444  // only after the object has changed since the last request.
  9445  func (c *UsersSettingsSendAsGetCall) IfNoneMatch(entityTag string) *UsersSettingsSendAsGetCall {
  9446  	c.ifNoneMatch_ = entityTag
  9447  	return c
  9448  }
  9449  
  9450  // Context sets the context to be used in this call's Do method.
  9451  func (c *UsersSettingsSendAsGetCall) Context(ctx context.Context) *UsersSettingsSendAsGetCall {
  9452  	c.ctx_ = ctx
  9453  	return c
  9454  }
  9455  
  9456  // Header returns a http.Header that can be modified by the caller to add
  9457  // headers to the request.
  9458  func (c *UsersSettingsSendAsGetCall) Header() http.Header {
  9459  	if c.header_ == nil {
  9460  		c.header_ = make(http.Header)
  9461  	}
  9462  	return c.header_
  9463  }
  9464  
  9465  func (c *UsersSettingsSendAsGetCall) doRequest(alt string) (*http.Response, error) {
  9466  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
  9467  	if c.ifNoneMatch_ != "" {
  9468  		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  9469  	}
  9470  	var body io.Reader = nil
  9471  	c.urlParams_.Set("alt", alt)
  9472  	c.urlParams_.Set("prettyPrint", "false")
  9473  	urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/settings/sendAs/{sendAsEmail}")
  9474  	urls += "?" + c.urlParams_.Encode()
  9475  	req, err := http.NewRequest("GET", urls, body)
  9476  	if err != nil {
  9477  		return nil, err
  9478  	}
  9479  	req.Header = reqHeaders
  9480  	googleapi.Expand(req.URL, map[string]string{
  9481  		"userId":      c.userId,
  9482  		"sendAsEmail": c.sendAsEmail,
  9483  	})
  9484  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  9485  }
  9486  
  9487  // Do executes the "gmail.users.settings.sendAs.get" call.
  9488  // Any non-2xx status code is an error. Response headers are in either
  9489  // *SendAs.ServerResponse.Header or (if a response was returned at all) in
  9490  // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  9491  // whether the returned error was because http.StatusNotModified was returned.
  9492  func (c *UsersSettingsSendAsGetCall) Do(opts ...googleapi.CallOption) (*SendAs, error) {
  9493  	gensupport.SetOptions(c.urlParams_, opts...)
  9494  	res, err := c.doRequest("json")
  9495  	if res != nil && res.StatusCode == http.StatusNotModified {
  9496  		if res.Body != nil {
  9497  			res.Body.Close()
  9498  		}
  9499  		return nil, gensupport.WrapError(&googleapi.Error{
  9500  			Code:   res.StatusCode,
  9501  			Header: res.Header,
  9502  		})
  9503  	}
  9504  	if err != nil {
  9505  		return nil, err
  9506  	}
  9507  	defer googleapi.CloseBody(res)
  9508  	if err := googleapi.CheckResponse(res); err != nil {
  9509  		return nil, gensupport.WrapError(err)
  9510  	}
  9511  	ret := &SendAs{
  9512  		ServerResponse: googleapi.ServerResponse{
  9513  			Header:         res.Header,
  9514  			HTTPStatusCode: res.StatusCode,
  9515  		},
  9516  	}
  9517  	target := &ret
  9518  	if err := gensupport.DecodeResponse(target, res); err != nil {
  9519  		return nil, err
  9520  	}
  9521  	return ret, nil
  9522  }
  9523  
  9524  type UsersSettingsSendAsListCall struct {
  9525  	s            *Service
  9526  	userId       string
  9527  	urlParams_   gensupport.URLParams
  9528  	ifNoneMatch_ string
  9529  	ctx_         context.Context
  9530  	header_      http.Header
  9531  }
  9532  
  9533  // List: Lists the send-as aliases for the specified account. The result
  9534  // includes the primary send-as address associated with the account as well as
  9535  // any custom "from" aliases.
  9536  //
  9537  //   - userId: User's email address. The special value "me" can be used to
  9538  //     indicate the authenticated user.
  9539  func (r *UsersSettingsSendAsService) List(userId string) *UsersSettingsSendAsListCall {
  9540  	c := &UsersSettingsSendAsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  9541  	c.userId = userId
  9542  	return c
  9543  }
  9544  
  9545  // Fields allows partial responses to be retrieved. See
  9546  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  9547  // details.
  9548  func (c *UsersSettingsSendAsListCall) Fields(s ...googleapi.Field) *UsersSettingsSendAsListCall {
  9549  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  9550  	return c
  9551  }
  9552  
  9553  // IfNoneMatch sets an optional parameter which makes the operation fail if the
  9554  // object's ETag matches the given value. This is useful for getting updates
  9555  // only after the object has changed since the last request.
  9556  func (c *UsersSettingsSendAsListCall) IfNoneMatch(entityTag string) *UsersSettingsSendAsListCall {
  9557  	c.ifNoneMatch_ = entityTag
  9558  	return c
  9559  }
  9560  
  9561  // Context sets the context to be used in this call's Do method.
  9562  func (c *UsersSettingsSendAsListCall) Context(ctx context.Context) *UsersSettingsSendAsListCall {
  9563  	c.ctx_ = ctx
  9564  	return c
  9565  }
  9566  
  9567  // Header returns a http.Header that can be modified by the caller to add
  9568  // headers to the request.
  9569  func (c *UsersSettingsSendAsListCall) Header() http.Header {
  9570  	if c.header_ == nil {
  9571  		c.header_ = make(http.Header)
  9572  	}
  9573  	return c.header_
  9574  }
  9575  
  9576  func (c *UsersSettingsSendAsListCall) doRequest(alt string) (*http.Response, error) {
  9577  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
  9578  	if c.ifNoneMatch_ != "" {
  9579  		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  9580  	}
  9581  	var body io.Reader = nil
  9582  	c.urlParams_.Set("alt", alt)
  9583  	c.urlParams_.Set("prettyPrint", "false")
  9584  	urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/settings/sendAs")
  9585  	urls += "?" + c.urlParams_.Encode()
  9586  	req, err := http.NewRequest("GET", urls, body)
  9587  	if err != nil {
  9588  		return nil, err
  9589  	}
  9590  	req.Header = reqHeaders
  9591  	googleapi.Expand(req.URL, map[string]string{
  9592  		"userId": c.userId,
  9593  	})
  9594  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  9595  }
  9596  
  9597  // Do executes the "gmail.users.settings.sendAs.list" call.
  9598  // Any non-2xx status code is an error. Response headers are in either
  9599  // *ListSendAsResponse.ServerResponse.Header or (if a response was returned at
  9600  // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  9601  // check whether the returned error was because http.StatusNotModified was
  9602  // returned.
  9603  func (c *UsersSettingsSendAsListCall) Do(opts ...googleapi.CallOption) (*ListSendAsResponse, error) {
  9604  	gensupport.SetOptions(c.urlParams_, opts...)
  9605  	res, err := c.doRequest("json")
  9606  	if res != nil && res.StatusCode == http.StatusNotModified {
  9607  		if res.Body != nil {
  9608  			res.Body.Close()
  9609  		}
  9610  		return nil, gensupport.WrapError(&googleapi.Error{
  9611  			Code:   res.StatusCode,
  9612  			Header: res.Header,
  9613  		})
  9614  	}
  9615  	if err != nil {
  9616  		return nil, err
  9617  	}
  9618  	defer googleapi.CloseBody(res)
  9619  	if err := googleapi.CheckResponse(res); err != nil {
  9620  		return nil, gensupport.WrapError(err)
  9621  	}
  9622  	ret := &ListSendAsResponse{
  9623  		ServerResponse: googleapi.ServerResponse{
  9624  			Header:         res.Header,
  9625  			HTTPStatusCode: res.StatusCode,
  9626  		},
  9627  	}
  9628  	target := &ret
  9629  	if err := gensupport.DecodeResponse(target, res); err != nil {
  9630  		return nil, err
  9631  	}
  9632  	return ret, nil
  9633  }
  9634  
  9635  type UsersSettingsSendAsPatchCall struct {
  9636  	s           *Service
  9637  	userId      string
  9638  	sendAsEmail string
  9639  	sendas      *SendAs
  9640  	urlParams_  gensupport.URLParams
  9641  	ctx_        context.Context
  9642  	header_     http.Header
  9643  }
  9644  
  9645  // Patch: Patch the specified send-as alias.
  9646  //
  9647  //   - sendAsEmail: The send-as alias to be updated.
  9648  //   - userId: User's email address. The special value "me" can be used to
  9649  //     indicate the authenticated user.
  9650  func (r *UsersSettingsSendAsService) Patch(userId string, sendAsEmail string, sendas *SendAs) *UsersSettingsSendAsPatchCall {
  9651  	c := &UsersSettingsSendAsPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  9652  	c.userId = userId
  9653  	c.sendAsEmail = sendAsEmail
  9654  	c.sendas = sendas
  9655  	return c
  9656  }
  9657  
  9658  // Fields allows partial responses to be retrieved. See
  9659  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  9660  // details.
  9661  func (c *UsersSettingsSendAsPatchCall) Fields(s ...googleapi.Field) *UsersSettingsSendAsPatchCall {
  9662  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  9663  	return c
  9664  }
  9665  
  9666  // Context sets the context to be used in this call's Do method.
  9667  func (c *UsersSettingsSendAsPatchCall) Context(ctx context.Context) *UsersSettingsSendAsPatchCall {
  9668  	c.ctx_ = ctx
  9669  	return c
  9670  }
  9671  
  9672  // Header returns a http.Header that can be modified by the caller to add
  9673  // headers to the request.
  9674  func (c *UsersSettingsSendAsPatchCall) Header() http.Header {
  9675  	if c.header_ == nil {
  9676  		c.header_ = make(http.Header)
  9677  	}
  9678  	return c.header_
  9679  }
  9680  
  9681  func (c *UsersSettingsSendAsPatchCall) doRequest(alt string) (*http.Response, error) {
  9682  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
  9683  	var body io.Reader = nil
  9684  	body, err := googleapi.WithoutDataWrapper.JSONReader(c.sendas)
  9685  	if err != nil {
  9686  		return nil, err
  9687  	}
  9688  	c.urlParams_.Set("alt", alt)
  9689  	c.urlParams_.Set("prettyPrint", "false")
  9690  	urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/settings/sendAs/{sendAsEmail}")
  9691  	urls += "?" + c.urlParams_.Encode()
  9692  	req, err := http.NewRequest("PATCH", urls, body)
  9693  	if err != nil {
  9694  		return nil, err
  9695  	}
  9696  	req.Header = reqHeaders
  9697  	googleapi.Expand(req.URL, map[string]string{
  9698  		"userId":      c.userId,
  9699  		"sendAsEmail": c.sendAsEmail,
  9700  	})
  9701  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  9702  }
  9703  
  9704  // Do executes the "gmail.users.settings.sendAs.patch" call.
  9705  // Any non-2xx status code is an error. Response headers are in either
  9706  // *SendAs.ServerResponse.Header or (if a response was returned at all) in
  9707  // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  9708  // whether the returned error was because http.StatusNotModified was returned.
  9709  func (c *UsersSettingsSendAsPatchCall) Do(opts ...googleapi.CallOption) (*SendAs, error) {
  9710  	gensupport.SetOptions(c.urlParams_, opts...)
  9711  	res, err := c.doRequest("json")
  9712  	if res != nil && res.StatusCode == http.StatusNotModified {
  9713  		if res.Body != nil {
  9714  			res.Body.Close()
  9715  		}
  9716  		return nil, gensupport.WrapError(&googleapi.Error{
  9717  			Code:   res.StatusCode,
  9718  			Header: res.Header,
  9719  		})
  9720  	}
  9721  	if err != nil {
  9722  		return nil, err
  9723  	}
  9724  	defer googleapi.CloseBody(res)
  9725  	if err := googleapi.CheckResponse(res); err != nil {
  9726  		return nil, gensupport.WrapError(err)
  9727  	}
  9728  	ret := &SendAs{
  9729  		ServerResponse: googleapi.ServerResponse{
  9730  			Header:         res.Header,
  9731  			HTTPStatusCode: res.StatusCode,
  9732  		},
  9733  	}
  9734  	target := &ret
  9735  	if err := gensupport.DecodeResponse(target, res); err != nil {
  9736  		return nil, err
  9737  	}
  9738  	return ret, nil
  9739  }
  9740  
  9741  type UsersSettingsSendAsUpdateCall struct {
  9742  	s           *Service
  9743  	userId      string
  9744  	sendAsEmail string
  9745  	sendas      *SendAs
  9746  	urlParams_  gensupport.URLParams
  9747  	ctx_        context.Context
  9748  	header_     http.Header
  9749  }
  9750  
  9751  // Update: Updates a send-as alias. If a signature is provided, Gmail will
  9752  // sanitize the HTML before saving it with the alias. Addresses other than the
  9753  // primary address for the account can only be updated by service account
  9754  // clients that have been delegated domain-wide authority.
  9755  //
  9756  //   - sendAsEmail: The send-as alias to be updated.
  9757  //   - userId: User's email address. The special value "me" can be used to
  9758  //     indicate the authenticated user.
  9759  func (r *UsersSettingsSendAsService) Update(userId string, sendAsEmail string, sendas *SendAs) *UsersSettingsSendAsUpdateCall {
  9760  	c := &UsersSettingsSendAsUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  9761  	c.userId = userId
  9762  	c.sendAsEmail = sendAsEmail
  9763  	c.sendas = sendas
  9764  	return c
  9765  }
  9766  
  9767  // Fields allows partial responses to be retrieved. See
  9768  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  9769  // details.
  9770  func (c *UsersSettingsSendAsUpdateCall) Fields(s ...googleapi.Field) *UsersSettingsSendAsUpdateCall {
  9771  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  9772  	return c
  9773  }
  9774  
  9775  // Context sets the context to be used in this call's Do method.
  9776  func (c *UsersSettingsSendAsUpdateCall) Context(ctx context.Context) *UsersSettingsSendAsUpdateCall {
  9777  	c.ctx_ = ctx
  9778  	return c
  9779  }
  9780  
  9781  // Header returns a http.Header that can be modified by the caller to add
  9782  // headers to the request.
  9783  func (c *UsersSettingsSendAsUpdateCall) Header() http.Header {
  9784  	if c.header_ == nil {
  9785  		c.header_ = make(http.Header)
  9786  	}
  9787  	return c.header_
  9788  }
  9789  
  9790  func (c *UsersSettingsSendAsUpdateCall) doRequest(alt string) (*http.Response, error) {
  9791  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
  9792  	var body io.Reader = nil
  9793  	body, err := googleapi.WithoutDataWrapper.JSONReader(c.sendas)
  9794  	if err != nil {
  9795  		return nil, err
  9796  	}
  9797  	c.urlParams_.Set("alt", alt)
  9798  	c.urlParams_.Set("prettyPrint", "false")
  9799  	urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/settings/sendAs/{sendAsEmail}")
  9800  	urls += "?" + c.urlParams_.Encode()
  9801  	req, err := http.NewRequest("PUT", urls, body)
  9802  	if err != nil {
  9803  		return nil, err
  9804  	}
  9805  	req.Header = reqHeaders
  9806  	googleapi.Expand(req.URL, map[string]string{
  9807  		"userId":      c.userId,
  9808  		"sendAsEmail": c.sendAsEmail,
  9809  	})
  9810  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  9811  }
  9812  
  9813  // Do executes the "gmail.users.settings.sendAs.update" call.
  9814  // Any non-2xx status code is an error. Response headers are in either
  9815  // *SendAs.ServerResponse.Header or (if a response was returned at all) in
  9816  // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  9817  // whether the returned error was because http.StatusNotModified was returned.
  9818  func (c *UsersSettingsSendAsUpdateCall) Do(opts ...googleapi.CallOption) (*SendAs, error) {
  9819  	gensupport.SetOptions(c.urlParams_, opts...)
  9820  	res, err := c.doRequest("json")
  9821  	if res != nil && res.StatusCode == http.StatusNotModified {
  9822  		if res.Body != nil {
  9823  			res.Body.Close()
  9824  		}
  9825  		return nil, gensupport.WrapError(&googleapi.Error{
  9826  			Code:   res.StatusCode,
  9827  			Header: res.Header,
  9828  		})
  9829  	}
  9830  	if err != nil {
  9831  		return nil, err
  9832  	}
  9833  	defer googleapi.CloseBody(res)
  9834  	if err := googleapi.CheckResponse(res); err != nil {
  9835  		return nil, gensupport.WrapError(err)
  9836  	}
  9837  	ret := &SendAs{
  9838  		ServerResponse: googleapi.ServerResponse{
  9839  			Header:         res.Header,
  9840  			HTTPStatusCode: res.StatusCode,
  9841  		},
  9842  	}
  9843  	target := &ret
  9844  	if err := gensupport.DecodeResponse(target, res); err != nil {
  9845  		return nil, err
  9846  	}
  9847  	return ret, nil
  9848  }
  9849  
  9850  type UsersSettingsSendAsVerifyCall struct {
  9851  	s           *Service
  9852  	userId      string
  9853  	sendAsEmail string
  9854  	urlParams_  gensupport.URLParams
  9855  	ctx_        context.Context
  9856  	header_     http.Header
  9857  }
  9858  
  9859  // Verify: Sends a verification email to the specified send-as alias address.
  9860  // The verification status must be `pending`. This method is only available to
  9861  // service account clients that have been delegated domain-wide authority.
  9862  //
  9863  //   - sendAsEmail: The send-as alias to be verified.
  9864  //   - userId: User's email address. The special value "me" can be used to
  9865  //     indicate the authenticated user.
  9866  func (r *UsersSettingsSendAsService) Verify(userId string, sendAsEmail string) *UsersSettingsSendAsVerifyCall {
  9867  	c := &UsersSettingsSendAsVerifyCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  9868  	c.userId = userId
  9869  	c.sendAsEmail = sendAsEmail
  9870  	return c
  9871  }
  9872  
  9873  // Fields allows partial responses to be retrieved. See
  9874  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  9875  // details.
  9876  func (c *UsersSettingsSendAsVerifyCall) Fields(s ...googleapi.Field) *UsersSettingsSendAsVerifyCall {
  9877  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  9878  	return c
  9879  }
  9880  
  9881  // Context sets the context to be used in this call's Do method.
  9882  func (c *UsersSettingsSendAsVerifyCall) Context(ctx context.Context) *UsersSettingsSendAsVerifyCall {
  9883  	c.ctx_ = ctx
  9884  	return c
  9885  }
  9886  
  9887  // Header returns a http.Header that can be modified by the caller to add
  9888  // headers to the request.
  9889  func (c *UsersSettingsSendAsVerifyCall) Header() http.Header {
  9890  	if c.header_ == nil {
  9891  		c.header_ = make(http.Header)
  9892  	}
  9893  	return c.header_
  9894  }
  9895  
  9896  func (c *UsersSettingsSendAsVerifyCall) doRequest(alt string) (*http.Response, error) {
  9897  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
  9898  	var body io.Reader = nil
  9899  	c.urlParams_.Set("alt", alt)
  9900  	c.urlParams_.Set("prettyPrint", "false")
  9901  	urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/settings/sendAs/{sendAsEmail}/verify")
  9902  	urls += "?" + c.urlParams_.Encode()
  9903  	req, err := http.NewRequest("POST", urls, body)
  9904  	if err != nil {
  9905  		return nil, err
  9906  	}
  9907  	req.Header = reqHeaders
  9908  	googleapi.Expand(req.URL, map[string]string{
  9909  		"userId":      c.userId,
  9910  		"sendAsEmail": c.sendAsEmail,
  9911  	})
  9912  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  9913  }
  9914  
  9915  // Do executes the "gmail.users.settings.sendAs.verify" call.
  9916  func (c *UsersSettingsSendAsVerifyCall) Do(opts ...googleapi.CallOption) error {
  9917  	gensupport.SetOptions(c.urlParams_, opts...)
  9918  	res, err := c.doRequest("json")
  9919  	if err != nil {
  9920  		return err
  9921  	}
  9922  	defer googleapi.CloseBody(res)
  9923  	if err := googleapi.CheckResponse(res); err != nil {
  9924  		return gensupport.WrapError(err)
  9925  	}
  9926  	return nil
  9927  }
  9928  
  9929  type UsersSettingsSendAsSmimeInfoDeleteCall struct {
  9930  	s           *Service
  9931  	userId      string
  9932  	sendAsEmail string
  9933  	id          string
  9934  	urlParams_  gensupport.URLParams
  9935  	ctx_        context.Context
  9936  	header_     http.Header
  9937  }
  9938  
  9939  // Delete: Deletes the specified S/MIME config for the specified send-as alias.
  9940  //
  9941  //   - id: The immutable ID for the SmimeInfo.
  9942  //   - sendAsEmail: The email address that appears in the "From:" header for mail
  9943  //     sent using this alias.
  9944  //   - userId: The user's email address. The special value `me` can be used to
  9945  //     indicate the authenticated user.
  9946  func (r *UsersSettingsSendAsSmimeInfoService) Delete(userId string, sendAsEmail string, id string) *UsersSettingsSendAsSmimeInfoDeleteCall {
  9947  	c := &UsersSettingsSendAsSmimeInfoDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  9948  	c.userId = userId
  9949  	c.sendAsEmail = sendAsEmail
  9950  	c.id = id
  9951  	return c
  9952  }
  9953  
  9954  // Fields allows partial responses to be retrieved. See
  9955  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
  9956  // details.
  9957  func (c *UsersSettingsSendAsSmimeInfoDeleteCall) Fields(s ...googleapi.Field) *UsersSettingsSendAsSmimeInfoDeleteCall {
  9958  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
  9959  	return c
  9960  }
  9961  
  9962  // Context sets the context to be used in this call's Do method.
  9963  func (c *UsersSettingsSendAsSmimeInfoDeleteCall) Context(ctx context.Context) *UsersSettingsSendAsSmimeInfoDeleteCall {
  9964  	c.ctx_ = ctx
  9965  	return c
  9966  }
  9967  
  9968  // Header returns a http.Header that can be modified by the caller to add
  9969  // headers to the request.
  9970  func (c *UsersSettingsSendAsSmimeInfoDeleteCall) Header() http.Header {
  9971  	if c.header_ == nil {
  9972  		c.header_ = make(http.Header)
  9973  	}
  9974  	return c.header_
  9975  }
  9976  
  9977  func (c *UsersSettingsSendAsSmimeInfoDeleteCall) doRequest(alt string) (*http.Response, error) {
  9978  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
  9979  	var body io.Reader = nil
  9980  	c.urlParams_.Set("alt", alt)
  9981  	c.urlParams_.Set("prettyPrint", "false")
  9982  	urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/settings/sendAs/{sendAsEmail}/smimeInfo/{id}")
  9983  	urls += "?" + c.urlParams_.Encode()
  9984  	req, err := http.NewRequest("DELETE", urls, body)
  9985  	if err != nil {
  9986  		return nil, err
  9987  	}
  9988  	req.Header = reqHeaders
  9989  	googleapi.Expand(req.URL, map[string]string{
  9990  		"userId":      c.userId,
  9991  		"sendAsEmail": c.sendAsEmail,
  9992  		"id":          c.id,
  9993  	})
  9994  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
  9995  }
  9996  
  9997  // Do executes the "gmail.users.settings.sendAs.smimeInfo.delete" call.
  9998  func (c *UsersSettingsSendAsSmimeInfoDeleteCall) Do(opts ...googleapi.CallOption) error {
  9999  	gensupport.SetOptions(c.urlParams_, opts...)
 10000  	res, err := c.doRequest("json")
 10001  	if err != nil {
 10002  		return err
 10003  	}
 10004  	defer googleapi.CloseBody(res)
 10005  	if err := googleapi.CheckResponse(res); err != nil {
 10006  		return gensupport.WrapError(err)
 10007  	}
 10008  	return nil
 10009  }
 10010  
 10011  type UsersSettingsSendAsSmimeInfoGetCall struct {
 10012  	s            *Service
 10013  	userId       string
 10014  	sendAsEmail  string
 10015  	id           string
 10016  	urlParams_   gensupport.URLParams
 10017  	ifNoneMatch_ string
 10018  	ctx_         context.Context
 10019  	header_      http.Header
 10020  }
 10021  
 10022  // Get: Gets the specified S/MIME config for the specified send-as alias.
 10023  //
 10024  //   - id: The immutable ID for the SmimeInfo.
 10025  //   - sendAsEmail: The email address that appears in the "From:" header for mail
 10026  //     sent using this alias.
 10027  //   - userId: The user's email address. The special value `me` can be used to
 10028  //     indicate the authenticated user.
 10029  func (r *UsersSettingsSendAsSmimeInfoService) Get(userId string, sendAsEmail string, id string) *UsersSettingsSendAsSmimeInfoGetCall {
 10030  	c := &UsersSettingsSendAsSmimeInfoGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
 10031  	c.userId = userId
 10032  	c.sendAsEmail = sendAsEmail
 10033  	c.id = id
 10034  	return c
 10035  }
 10036  
 10037  // Fields allows partial responses to be retrieved. See
 10038  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
 10039  // details.
 10040  func (c *UsersSettingsSendAsSmimeInfoGetCall) Fields(s ...googleapi.Field) *UsersSettingsSendAsSmimeInfoGetCall {
 10041  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
 10042  	return c
 10043  }
 10044  
 10045  // IfNoneMatch sets an optional parameter which makes the operation fail if the
 10046  // object's ETag matches the given value. This is useful for getting updates
 10047  // only after the object has changed since the last request.
 10048  func (c *UsersSettingsSendAsSmimeInfoGetCall) IfNoneMatch(entityTag string) *UsersSettingsSendAsSmimeInfoGetCall {
 10049  	c.ifNoneMatch_ = entityTag
 10050  	return c
 10051  }
 10052  
 10053  // Context sets the context to be used in this call's Do method.
 10054  func (c *UsersSettingsSendAsSmimeInfoGetCall) Context(ctx context.Context) *UsersSettingsSendAsSmimeInfoGetCall {
 10055  	c.ctx_ = ctx
 10056  	return c
 10057  }
 10058  
 10059  // Header returns a http.Header that can be modified by the caller to add
 10060  // headers to the request.
 10061  func (c *UsersSettingsSendAsSmimeInfoGetCall) Header() http.Header {
 10062  	if c.header_ == nil {
 10063  		c.header_ = make(http.Header)
 10064  	}
 10065  	return c.header_
 10066  }
 10067  
 10068  func (c *UsersSettingsSendAsSmimeInfoGetCall) doRequest(alt string) (*http.Response, error) {
 10069  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
 10070  	if c.ifNoneMatch_ != "" {
 10071  		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
 10072  	}
 10073  	var body io.Reader = nil
 10074  	c.urlParams_.Set("alt", alt)
 10075  	c.urlParams_.Set("prettyPrint", "false")
 10076  	urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/settings/sendAs/{sendAsEmail}/smimeInfo/{id}")
 10077  	urls += "?" + c.urlParams_.Encode()
 10078  	req, err := http.NewRequest("GET", urls, body)
 10079  	if err != nil {
 10080  		return nil, err
 10081  	}
 10082  	req.Header = reqHeaders
 10083  	googleapi.Expand(req.URL, map[string]string{
 10084  		"userId":      c.userId,
 10085  		"sendAsEmail": c.sendAsEmail,
 10086  		"id":          c.id,
 10087  	})
 10088  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
 10089  }
 10090  
 10091  // Do executes the "gmail.users.settings.sendAs.smimeInfo.get" call.
 10092  // Any non-2xx status code is an error. Response headers are in either
 10093  // *SmimeInfo.ServerResponse.Header or (if a response was returned at all) in
 10094  // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
 10095  // whether the returned error was because http.StatusNotModified was returned.
 10096  func (c *UsersSettingsSendAsSmimeInfoGetCall) Do(opts ...googleapi.CallOption) (*SmimeInfo, error) {
 10097  	gensupport.SetOptions(c.urlParams_, opts...)
 10098  	res, err := c.doRequest("json")
 10099  	if res != nil && res.StatusCode == http.StatusNotModified {
 10100  		if res.Body != nil {
 10101  			res.Body.Close()
 10102  		}
 10103  		return nil, gensupport.WrapError(&googleapi.Error{
 10104  			Code:   res.StatusCode,
 10105  			Header: res.Header,
 10106  		})
 10107  	}
 10108  	if err != nil {
 10109  		return nil, err
 10110  	}
 10111  	defer googleapi.CloseBody(res)
 10112  	if err := googleapi.CheckResponse(res); err != nil {
 10113  		return nil, gensupport.WrapError(err)
 10114  	}
 10115  	ret := &SmimeInfo{
 10116  		ServerResponse: googleapi.ServerResponse{
 10117  			Header:         res.Header,
 10118  			HTTPStatusCode: res.StatusCode,
 10119  		},
 10120  	}
 10121  	target := &ret
 10122  	if err := gensupport.DecodeResponse(target, res); err != nil {
 10123  		return nil, err
 10124  	}
 10125  	return ret, nil
 10126  }
 10127  
 10128  type UsersSettingsSendAsSmimeInfoInsertCall struct {
 10129  	s           *Service
 10130  	userId      string
 10131  	sendAsEmail string
 10132  	smimeinfo   *SmimeInfo
 10133  	urlParams_  gensupport.URLParams
 10134  	ctx_        context.Context
 10135  	header_     http.Header
 10136  }
 10137  
 10138  // Insert: Insert (upload) the given S/MIME config for the specified send-as
 10139  // alias. Note that pkcs12 format is required for the key.
 10140  //
 10141  //   - sendAsEmail: The email address that appears in the "From:" header for mail
 10142  //     sent using this alias.
 10143  //   - userId: The user's email address. The special value `me` can be used to
 10144  //     indicate the authenticated user.
 10145  func (r *UsersSettingsSendAsSmimeInfoService) Insert(userId string, sendAsEmail string, smimeinfo *SmimeInfo) *UsersSettingsSendAsSmimeInfoInsertCall {
 10146  	c := &UsersSettingsSendAsSmimeInfoInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)}
 10147  	c.userId = userId
 10148  	c.sendAsEmail = sendAsEmail
 10149  	c.smimeinfo = smimeinfo
 10150  	return c
 10151  }
 10152  
 10153  // Fields allows partial responses to be retrieved. See
 10154  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
 10155  // details.
 10156  func (c *UsersSettingsSendAsSmimeInfoInsertCall) Fields(s ...googleapi.Field) *UsersSettingsSendAsSmimeInfoInsertCall {
 10157  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
 10158  	return c
 10159  }
 10160  
 10161  // Context sets the context to be used in this call's Do method.
 10162  func (c *UsersSettingsSendAsSmimeInfoInsertCall) Context(ctx context.Context) *UsersSettingsSendAsSmimeInfoInsertCall {
 10163  	c.ctx_ = ctx
 10164  	return c
 10165  }
 10166  
 10167  // Header returns a http.Header that can be modified by the caller to add
 10168  // headers to the request.
 10169  func (c *UsersSettingsSendAsSmimeInfoInsertCall) Header() http.Header {
 10170  	if c.header_ == nil {
 10171  		c.header_ = make(http.Header)
 10172  	}
 10173  	return c.header_
 10174  }
 10175  
 10176  func (c *UsersSettingsSendAsSmimeInfoInsertCall) doRequest(alt string) (*http.Response, error) {
 10177  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
 10178  	var body io.Reader = nil
 10179  	body, err := googleapi.WithoutDataWrapper.JSONReader(c.smimeinfo)
 10180  	if err != nil {
 10181  		return nil, err
 10182  	}
 10183  	c.urlParams_.Set("alt", alt)
 10184  	c.urlParams_.Set("prettyPrint", "false")
 10185  	urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/settings/sendAs/{sendAsEmail}/smimeInfo")
 10186  	urls += "?" + c.urlParams_.Encode()
 10187  	req, err := http.NewRequest("POST", urls, body)
 10188  	if err != nil {
 10189  		return nil, err
 10190  	}
 10191  	req.Header = reqHeaders
 10192  	googleapi.Expand(req.URL, map[string]string{
 10193  		"userId":      c.userId,
 10194  		"sendAsEmail": c.sendAsEmail,
 10195  	})
 10196  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
 10197  }
 10198  
 10199  // Do executes the "gmail.users.settings.sendAs.smimeInfo.insert" call.
 10200  // Any non-2xx status code is an error. Response headers are in either
 10201  // *SmimeInfo.ServerResponse.Header or (if a response was returned at all) in
 10202  // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
 10203  // whether the returned error was because http.StatusNotModified was returned.
 10204  func (c *UsersSettingsSendAsSmimeInfoInsertCall) Do(opts ...googleapi.CallOption) (*SmimeInfo, error) {
 10205  	gensupport.SetOptions(c.urlParams_, opts...)
 10206  	res, err := c.doRequest("json")
 10207  	if res != nil && res.StatusCode == http.StatusNotModified {
 10208  		if res.Body != nil {
 10209  			res.Body.Close()
 10210  		}
 10211  		return nil, gensupport.WrapError(&googleapi.Error{
 10212  			Code:   res.StatusCode,
 10213  			Header: res.Header,
 10214  		})
 10215  	}
 10216  	if err != nil {
 10217  		return nil, err
 10218  	}
 10219  	defer googleapi.CloseBody(res)
 10220  	if err := googleapi.CheckResponse(res); err != nil {
 10221  		return nil, gensupport.WrapError(err)
 10222  	}
 10223  	ret := &SmimeInfo{
 10224  		ServerResponse: googleapi.ServerResponse{
 10225  			Header:         res.Header,
 10226  			HTTPStatusCode: res.StatusCode,
 10227  		},
 10228  	}
 10229  	target := &ret
 10230  	if err := gensupport.DecodeResponse(target, res); err != nil {
 10231  		return nil, err
 10232  	}
 10233  	return ret, nil
 10234  }
 10235  
 10236  type UsersSettingsSendAsSmimeInfoListCall struct {
 10237  	s            *Service
 10238  	userId       string
 10239  	sendAsEmail  string
 10240  	urlParams_   gensupport.URLParams
 10241  	ifNoneMatch_ string
 10242  	ctx_         context.Context
 10243  	header_      http.Header
 10244  }
 10245  
 10246  // List: Lists S/MIME configs for the specified send-as alias.
 10247  //
 10248  //   - sendAsEmail: The email address that appears in the "From:" header for mail
 10249  //     sent using this alias.
 10250  //   - userId: The user's email address. The special value `me` can be used to
 10251  //     indicate the authenticated user.
 10252  func (r *UsersSettingsSendAsSmimeInfoService) List(userId string, sendAsEmail string) *UsersSettingsSendAsSmimeInfoListCall {
 10253  	c := &UsersSettingsSendAsSmimeInfoListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
 10254  	c.userId = userId
 10255  	c.sendAsEmail = sendAsEmail
 10256  	return c
 10257  }
 10258  
 10259  // Fields allows partial responses to be retrieved. See
 10260  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
 10261  // details.
 10262  func (c *UsersSettingsSendAsSmimeInfoListCall) Fields(s ...googleapi.Field) *UsersSettingsSendAsSmimeInfoListCall {
 10263  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
 10264  	return c
 10265  }
 10266  
 10267  // IfNoneMatch sets an optional parameter which makes the operation fail if the
 10268  // object's ETag matches the given value. This is useful for getting updates
 10269  // only after the object has changed since the last request.
 10270  func (c *UsersSettingsSendAsSmimeInfoListCall) IfNoneMatch(entityTag string) *UsersSettingsSendAsSmimeInfoListCall {
 10271  	c.ifNoneMatch_ = entityTag
 10272  	return c
 10273  }
 10274  
 10275  // Context sets the context to be used in this call's Do method.
 10276  func (c *UsersSettingsSendAsSmimeInfoListCall) Context(ctx context.Context) *UsersSettingsSendAsSmimeInfoListCall {
 10277  	c.ctx_ = ctx
 10278  	return c
 10279  }
 10280  
 10281  // Header returns a http.Header that can be modified by the caller to add
 10282  // headers to the request.
 10283  func (c *UsersSettingsSendAsSmimeInfoListCall) Header() http.Header {
 10284  	if c.header_ == nil {
 10285  		c.header_ = make(http.Header)
 10286  	}
 10287  	return c.header_
 10288  }
 10289  
 10290  func (c *UsersSettingsSendAsSmimeInfoListCall) doRequest(alt string) (*http.Response, error) {
 10291  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
 10292  	if c.ifNoneMatch_ != "" {
 10293  		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
 10294  	}
 10295  	var body io.Reader = nil
 10296  	c.urlParams_.Set("alt", alt)
 10297  	c.urlParams_.Set("prettyPrint", "false")
 10298  	urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/settings/sendAs/{sendAsEmail}/smimeInfo")
 10299  	urls += "?" + c.urlParams_.Encode()
 10300  	req, err := http.NewRequest("GET", urls, body)
 10301  	if err != nil {
 10302  		return nil, err
 10303  	}
 10304  	req.Header = reqHeaders
 10305  	googleapi.Expand(req.URL, map[string]string{
 10306  		"userId":      c.userId,
 10307  		"sendAsEmail": c.sendAsEmail,
 10308  	})
 10309  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
 10310  }
 10311  
 10312  // Do executes the "gmail.users.settings.sendAs.smimeInfo.list" call.
 10313  // Any non-2xx status code is an error. Response headers are in either
 10314  // *ListSmimeInfoResponse.ServerResponse.Header or (if a response was returned
 10315  // at all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
 10316  // check whether the returned error was because http.StatusNotModified was
 10317  // returned.
 10318  func (c *UsersSettingsSendAsSmimeInfoListCall) Do(opts ...googleapi.CallOption) (*ListSmimeInfoResponse, error) {
 10319  	gensupport.SetOptions(c.urlParams_, opts...)
 10320  	res, err := c.doRequest("json")
 10321  	if res != nil && res.StatusCode == http.StatusNotModified {
 10322  		if res.Body != nil {
 10323  			res.Body.Close()
 10324  		}
 10325  		return nil, gensupport.WrapError(&googleapi.Error{
 10326  			Code:   res.StatusCode,
 10327  			Header: res.Header,
 10328  		})
 10329  	}
 10330  	if err != nil {
 10331  		return nil, err
 10332  	}
 10333  	defer googleapi.CloseBody(res)
 10334  	if err := googleapi.CheckResponse(res); err != nil {
 10335  		return nil, gensupport.WrapError(err)
 10336  	}
 10337  	ret := &ListSmimeInfoResponse{
 10338  		ServerResponse: googleapi.ServerResponse{
 10339  			Header:         res.Header,
 10340  			HTTPStatusCode: res.StatusCode,
 10341  		},
 10342  	}
 10343  	target := &ret
 10344  	if err := gensupport.DecodeResponse(target, res); err != nil {
 10345  		return nil, err
 10346  	}
 10347  	return ret, nil
 10348  }
 10349  
 10350  type UsersSettingsSendAsSmimeInfoSetDefaultCall struct {
 10351  	s           *Service
 10352  	userId      string
 10353  	sendAsEmail string
 10354  	id          string
 10355  	urlParams_  gensupport.URLParams
 10356  	ctx_        context.Context
 10357  	header_     http.Header
 10358  }
 10359  
 10360  // SetDefault: Sets the default S/MIME config for the specified send-as alias.
 10361  //
 10362  //   - id: The immutable ID for the SmimeInfo.
 10363  //   - sendAsEmail: The email address that appears in the "From:" header for mail
 10364  //     sent using this alias.
 10365  //   - userId: The user's email address. The special value `me` can be used to
 10366  //     indicate the authenticated user.
 10367  func (r *UsersSettingsSendAsSmimeInfoService) SetDefault(userId string, sendAsEmail string, id string) *UsersSettingsSendAsSmimeInfoSetDefaultCall {
 10368  	c := &UsersSettingsSendAsSmimeInfoSetDefaultCall{s: r.s, urlParams_: make(gensupport.URLParams)}
 10369  	c.userId = userId
 10370  	c.sendAsEmail = sendAsEmail
 10371  	c.id = id
 10372  	return c
 10373  }
 10374  
 10375  // Fields allows partial responses to be retrieved. See
 10376  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
 10377  // details.
 10378  func (c *UsersSettingsSendAsSmimeInfoSetDefaultCall) Fields(s ...googleapi.Field) *UsersSettingsSendAsSmimeInfoSetDefaultCall {
 10379  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
 10380  	return c
 10381  }
 10382  
 10383  // Context sets the context to be used in this call's Do method.
 10384  func (c *UsersSettingsSendAsSmimeInfoSetDefaultCall) Context(ctx context.Context) *UsersSettingsSendAsSmimeInfoSetDefaultCall {
 10385  	c.ctx_ = ctx
 10386  	return c
 10387  }
 10388  
 10389  // Header returns a http.Header that can be modified by the caller to add
 10390  // headers to the request.
 10391  func (c *UsersSettingsSendAsSmimeInfoSetDefaultCall) Header() http.Header {
 10392  	if c.header_ == nil {
 10393  		c.header_ = make(http.Header)
 10394  	}
 10395  	return c.header_
 10396  }
 10397  
 10398  func (c *UsersSettingsSendAsSmimeInfoSetDefaultCall) doRequest(alt string) (*http.Response, error) {
 10399  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
 10400  	var body io.Reader = nil
 10401  	c.urlParams_.Set("alt", alt)
 10402  	c.urlParams_.Set("prettyPrint", "false")
 10403  	urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/settings/sendAs/{sendAsEmail}/smimeInfo/{id}/setDefault")
 10404  	urls += "?" + c.urlParams_.Encode()
 10405  	req, err := http.NewRequest("POST", urls, body)
 10406  	if err != nil {
 10407  		return nil, err
 10408  	}
 10409  	req.Header = reqHeaders
 10410  	googleapi.Expand(req.URL, map[string]string{
 10411  		"userId":      c.userId,
 10412  		"sendAsEmail": c.sendAsEmail,
 10413  		"id":          c.id,
 10414  	})
 10415  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
 10416  }
 10417  
 10418  // Do executes the "gmail.users.settings.sendAs.smimeInfo.setDefault" call.
 10419  func (c *UsersSettingsSendAsSmimeInfoSetDefaultCall) Do(opts ...googleapi.CallOption) error {
 10420  	gensupport.SetOptions(c.urlParams_, opts...)
 10421  	res, err := c.doRequest("json")
 10422  	if err != nil {
 10423  		return err
 10424  	}
 10425  	defer googleapi.CloseBody(res)
 10426  	if err := googleapi.CheckResponse(res); err != nil {
 10427  		return gensupport.WrapError(err)
 10428  	}
 10429  	return nil
 10430  }
 10431  
 10432  type UsersThreadsDeleteCall struct {
 10433  	s          *Service
 10434  	userId     string
 10435  	id         string
 10436  	urlParams_ gensupport.URLParams
 10437  	ctx_       context.Context
 10438  	header_    http.Header
 10439  }
 10440  
 10441  // Delete: Immediately and permanently deletes the specified thread. Any
 10442  // messages that belong to the thread are also deleted. This operation cannot
 10443  // be undone. Prefer `threads.trash` instead.
 10444  //
 10445  //   - id: ID of the Thread to delete.
 10446  //   - userId: The user's email address. The special value `me` can be used to
 10447  //     indicate the authenticated user.
 10448  func (r *UsersThreadsService) Delete(userId string, id string) *UsersThreadsDeleteCall {
 10449  	c := &UsersThreadsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
 10450  	c.userId = userId
 10451  	c.id = id
 10452  	return c
 10453  }
 10454  
 10455  // Fields allows partial responses to be retrieved. See
 10456  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
 10457  // details.
 10458  func (c *UsersThreadsDeleteCall) Fields(s ...googleapi.Field) *UsersThreadsDeleteCall {
 10459  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
 10460  	return c
 10461  }
 10462  
 10463  // Context sets the context to be used in this call's Do method.
 10464  func (c *UsersThreadsDeleteCall) Context(ctx context.Context) *UsersThreadsDeleteCall {
 10465  	c.ctx_ = ctx
 10466  	return c
 10467  }
 10468  
 10469  // Header returns a http.Header that can be modified by the caller to add
 10470  // headers to the request.
 10471  func (c *UsersThreadsDeleteCall) Header() http.Header {
 10472  	if c.header_ == nil {
 10473  		c.header_ = make(http.Header)
 10474  	}
 10475  	return c.header_
 10476  }
 10477  
 10478  func (c *UsersThreadsDeleteCall) doRequest(alt string) (*http.Response, error) {
 10479  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
 10480  	var body io.Reader = nil
 10481  	c.urlParams_.Set("alt", alt)
 10482  	c.urlParams_.Set("prettyPrint", "false")
 10483  	urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/threads/{id}")
 10484  	urls += "?" + c.urlParams_.Encode()
 10485  	req, err := http.NewRequest("DELETE", urls, body)
 10486  	if err != nil {
 10487  		return nil, err
 10488  	}
 10489  	req.Header = reqHeaders
 10490  	googleapi.Expand(req.URL, map[string]string{
 10491  		"userId": c.userId,
 10492  		"id":     c.id,
 10493  	})
 10494  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
 10495  }
 10496  
 10497  // Do executes the "gmail.users.threads.delete" call.
 10498  func (c *UsersThreadsDeleteCall) Do(opts ...googleapi.CallOption) error {
 10499  	gensupport.SetOptions(c.urlParams_, opts...)
 10500  	res, err := c.doRequest("json")
 10501  	if err != nil {
 10502  		return err
 10503  	}
 10504  	defer googleapi.CloseBody(res)
 10505  	if err := googleapi.CheckResponse(res); err != nil {
 10506  		return gensupport.WrapError(err)
 10507  	}
 10508  	return nil
 10509  }
 10510  
 10511  type UsersThreadsGetCall struct {
 10512  	s            *Service
 10513  	userId       string
 10514  	id           string
 10515  	urlParams_   gensupport.URLParams
 10516  	ifNoneMatch_ string
 10517  	ctx_         context.Context
 10518  	header_      http.Header
 10519  }
 10520  
 10521  // Get: Gets the specified thread.
 10522  //
 10523  //   - id: The ID of the thread to retrieve.
 10524  //   - userId: The user's email address. The special value `me` can be used to
 10525  //     indicate the authenticated user.
 10526  func (r *UsersThreadsService) Get(userId string, id string) *UsersThreadsGetCall {
 10527  	c := &UsersThreadsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
 10528  	c.userId = userId
 10529  	c.id = id
 10530  	return c
 10531  }
 10532  
 10533  // Format sets the optional parameter "format": The format to return the
 10534  // messages in.
 10535  //
 10536  // Possible values:
 10537  //
 10538  //	"full" (default) - Returns the full email message data with body content
 10539  //
 10540  // parsed in the `payload` field; the `raw` field is not used. Format cannot be
 10541  // used when accessing the api using the gmail.metadata scope.
 10542  //
 10543  //	"metadata" - Returns only email message IDs, labels, and email headers.
 10544  //	"minimal" - Returns only email message IDs and labels; does not return the
 10545  //
 10546  // email headers, body, or payload.
 10547  func (c *UsersThreadsGetCall) Format(format string) *UsersThreadsGetCall {
 10548  	c.urlParams_.Set("format", format)
 10549  	return c
 10550  }
 10551  
 10552  // MetadataHeaders sets the optional parameter "metadataHeaders": When given
 10553  // and format is METADATA, only include headers specified.
 10554  func (c *UsersThreadsGetCall) MetadataHeaders(metadataHeaders ...string) *UsersThreadsGetCall {
 10555  	c.urlParams_.SetMulti("metadataHeaders", append([]string{}, metadataHeaders...))
 10556  	return c
 10557  }
 10558  
 10559  // TemporaryEeccBypass sets the optional parameter "temporaryEeccBypass":
 10560  func (c *UsersThreadsGetCall) TemporaryEeccBypass(temporaryEeccBypass bool) *UsersThreadsGetCall {
 10561  	c.urlParams_.Set("temporaryEeccBypass", fmt.Sprint(temporaryEeccBypass))
 10562  	return c
 10563  }
 10564  
 10565  // Fields allows partial responses to be retrieved. See
 10566  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
 10567  // details.
 10568  func (c *UsersThreadsGetCall) Fields(s ...googleapi.Field) *UsersThreadsGetCall {
 10569  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
 10570  	return c
 10571  }
 10572  
 10573  // IfNoneMatch sets an optional parameter which makes the operation fail if the
 10574  // object's ETag matches the given value. This is useful for getting updates
 10575  // only after the object has changed since the last request.
 10576  func (c *UsersThreadsGetCall) IfNoneMatch(entityTag string) *UsersThreadsGetCall {
 10577  	c.ifNoneMatch_ = entityTag
 10578  	return c
 10579  }
 10580  
 10581  // Context sets the context to be used in this call's Do method.
 10582  func (c *UsersThreadsGetCall) Context(ctx context.Context) *UsersThreadsGetCall {
 10583  	c.ctx_ = ctx
 10584  	return c
 10585  }
 10586  
 10587  // Header returns a http.Header that can be modified by the caller to add
 10588  // headers to the request.
 10589  func (c *UsersThreadsGetCall) Header() http.Header {
 10590  	if c.header_ == nil {
 10591  		c.header_ = make(http.Header)
 10592  	}
 10593  	return c.header_
 10594  }
 10595  
 10596  func (c *UsersThreadsGetCall) doRequest(alt string) (*http.Response, error) {
 10597  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
 10598  	if c.ifNoneMatch_ != "" {
 10599  		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
 10600  	}
 10601  	var body io.Reader = nil
 10602  	c.urlParams_.Set("alt", alt)
 10603  	c.urlParams_.Set("prettyPrint", "false")
 10604  	urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/threads/{id}")
 10605  	urls += "?" + c.urlParams_.Encode()
 10606  	req, err := http.NewRequest("GET", urls, body)
 10607  	if err != nil {
 10608  		return nil, err
 10609  	}
 10610  	req.Header = reqHeaders
 10611  	googleapi.Expand(req.URL, map[string]string{
 10612  		"userId": c.userId,
 10613  		"id":     c.id,
 10614  	})
 10615  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
 10616  }
 10617  
 10618  // Do executes the "gmail.users.threads.get" call.
 10619  // Any non-2xx status code is an error. Response headers are in either
 10620  // *Thread.ServerResponse.Header or (if a response was returned at all) in
 10621  // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
 10622  // whether the returned error was because http.StatusNotModified was returned.
 10623  func (c *UsersThreadsGetCall) Do(opts ...googleapi.CallOption) (*Thread, error) {
 10624  	gensupport.SetOptions(c.urlParams_, opts...)
 10625  	res, err := c.doRequest("json")
 10626  	if res != nil && res.StatusCode == http.StatusNotModified {
 10627  		if res.Body != nil {
 10628  			res.Body.Close()
 10629  		}
 10630  		return nil, gensupport.WrapError(&googleapi.Error{
 10631  			Code:   res.StatusCode,
 10632  			Header: res.Header,
 10633  		})
 10634  	}
 10635  	if err != nil {
 10636  		return nil, err
 10637  	}
 10638  	defer googleapi.CloseBody(res)
 10639  	if err := googleapi.CheckResponse(res); err != nil {
 10640  		return nil, gensupport.WrapError(err)
 10641  	}
 10642  	ret := &Thread{
 10643  		ServerResponse: googleapi.ServerResponse{
 10644  			Header:         res.Header,
 10645  			HTTPStatusCode: res.StatusCode,
 10646  		},
 10647  	}
 10648  	target := &ret
 10649  	if err := gensupport.DecodeResponse(target, res); err != nil {
 10650  		return nil, err
 10651  	}
 10652  	return ret, nil
 10653  }
 10654  
 10655  type UsersThreadsListCall struct {
 10656  	s            *Service
 10657  	userId       string
 10658  	urlParams_   gensupport.URLParams
 10659  	ifNoneMatch_ string
 10660  	ctx_         context.Context
 10661  	header_      http.Header
 10662  }
 10663  
 10664  // List: Lists the threads in the user's mailbox.
 10665  //
 10666  //   - userId: The user's email address. The special value `me` can be used to
 10667  //     indicate the authenticated user.
 10668  func (r *UsersThreadsService) List(userId string) *UsersThreadsListCall {
 10669  	c := &UsersThreadsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
 10670  	c.userId = userId
 10671  	return c
 10672  }
 10673  
 10674  // IncludeSpamTrash sets the optional parameter "includeSpamTrash": Include
 10675  // threads from `SPAM` and `TRASH` in the results.
 10676  func (c *UsersThreadsListCall) IncludeSpamTrash(includeSpamTrash bool) *UsersThreadsListCall {
 10677  	c.urlParams_.Set("includeSpamTrash", fmt.Sprint(includeSpamTrash))
 10678  	return c
 10679  }
 10680  
 10681  // LabelIds sets the optional parameter "labelIds": Only return threads with
 10682  // labels that match all of the specified label IDs.
 10683  func (c *UsersThreadsListCall) LabelIds(labelIds ...string) *UsersThreadsListCall {
 10684  	c.urlParams_.SetMulti("labelIds", append([]string{}, labelIds...))
 10685  	return c
 10686  }
 10687  
 10688  // MaxResults sets the optional parameter "maxResults": Maximum number of
 10689  // threads to return. This field defaults to 100. The maximum allowed value for
 10690  // this field is 500.
 10691  func (c *UsersThreadsListCall) MaxResults(maxResults int64) *UsersThreadsListCall {
 10692  	c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
 10693  	return c
 10694  }
 10695  
 10696  // PageToken sets the optional parameter "pageToken": Page token to retrieve a
 10697  // specific page of results in the list.
 10698  func (c *UsersThreadsListCall) PageToken(pageToken string) *UsersThreadsListCall {
 10699  	c.urlParams_.Set("pageToken", pageToken)
 10700  	return c
 10701  }
 10702  
 10703  // Q sets the optional parameter "q": Only return threads matching the
 10704  // specified query. Supports the same query format as the Gmail search box. For
 10705  // example, "from:someuser@example.com rfc822msgid: is:unread". Parameter
 10706  // cannot be used when accessing the api using the gmail.metadata scope.
 10707  func (c *UsersThreadsListCall) Q(q string) *UsersThreadsListCall {
 10708  	c.urlParams_.Set("q", q)
 10709  	return c
 10710  }
 10711  
 10712  // TemporaryEeccBypass sets the optional parameter "temporaryEeccBypass":
 10713  func (c *UsersThreadsListCall) TemporaryEeccBypass(temporaryEeccBypass bool) *UsersThreadsListCall {
 10714  	c.urlParams_.Set("temporaryEeccBypass", fmt.Sprint(temporaryEeccBypass))
 10715  	return c
 10716  }
 10717  
 10718  // Fields allows partial responses to be retrieved. See
 10719  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
 10720  // details.
 10721  func (c *UsersThreadsListCall) Fields(s ...googleapi.Field) *UsersThreadsListCall {
 10722  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
 10723  	return c
 10724  }
 10725  
 10726  // IfNoneMatch sets an optional parameter which makes the operation fail if the
 10727  // object's ETag matches the given value. This is useful for getting updates
 10728  // only after the object has changed since the last request.
 10729  func (c *UsersThreadsListCall) IfNoneMatch(entityTag string) *UsersThreadsListCall {
 10730  	c.ifNoneMatch_ = entityTag
 10731  	return c
 10732  }
 10733  
 10734  // Context sets the context to be used in this call's Do method.
 10735  func (c *UsersThreadsListCall) Context(ctx context.Context) *UsersThreadsListCall {
 10736  	c.ctx_ = ctx
 10737  	return c
 10738  }
 10739  
 10740  // Header returns a http.Header that can be modified by the caller to add
 10741  // headers to the request.
 10742  func (c *UsersThreadsListCall) Header() http.Header {
 10743  	if c.header_ == nil {
 10744  		c.header_ = make(http.Header)
 10745  	}
 10746  	return c.header_
 10747  }
 10748  
 10749  func (c *UsersThreadsListCall) doRequest(alt string) (*http.Response, error) {
 10750  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
 10751  	if c.ifNoneMatch_ != "" {
 10752  		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
 10753  	}
 10754  	var body io.Reader = nil
 10755  	c.urlParams_.Set("alt", alt)
 10756  	c.urlParams_.Set("prettyPrint", "false")
 10757  	urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/threads")
 10758  	urls += "?" + c.urlParams_.Encode()
 10759  	req, err := http.NewRequest("GET", urls, body)
 10760  	if err != nil {
 10761  		return nil, err
 10762  	}
 10763  	req.Header = reqHeaders
 10764  	googleapi.Expand(req.URL, map[string]string{
 10765  		"userId": c.userId,
 10766  	})
 10767  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
 10768  }
 10769  
 10770  // Do executes the "gmail.users.threads.list" call.
 10771  // Any non-2xx status code is an error. Response headers are in either
 10772  // *ListThreadsResponse.ServerResponse.Header or (if a response was returned at
 10773  // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
 10774  // check whether the returned error was because http.StatusNotModified was
 10775  // returned.
 10776  func (c *UsersThreadsListCall) Do(opts ...googleapi.CallOption) (*ListThreadsResponse, error) {
 10777  	gensupport.SetOptions(c.urlParams_, opts...)
 10778  	res, err := c.doRequest("json")
 10779  	if res != nil && res.StatusCode == http.StatusNotModified {
 10780  		if res.Body != nil {
 10781  			res.Body.Close()
 10782  		}
 10783  		return nil, gensupport.WrapError(&googleapi.Error{
 10784  			Code:   res.StatusCode,
 10785  			Header: res.Header,
 10786  		})
 10787  	}
 10788  	if err != nil {
 10789  		return nil, err
 10790  	}
 10791  	defer googleapi.CloseBody(res)
 10792  	if err := googleapi.CheckResponse(res); err != nil {
 10793  		return nil, gensupport.WrapError(err)
 10794  	}
 10795  	ret := &ListThreadsResponse{
 10796  		ServerResponse: googleapi.ServerResponse{
 10797  			Header:         res.Header,
 10798  			HTTPStatusCode: res.StatusCode,
 10799  		},
 10800  	}
 10801  	target := &ret
 10802  	if err := gensupport.DecodeResponse(target, res); err != nil {
 10803  		return nil, err
 10804  	}
 10805  	return ret, nil
 10806  }
 10807  
 10808  // Pages invokes f for each page of results.
 10809  // A non-nil error returned from f will halt the iteration.
 10810  // The provided context supersedes any context provided to the Context method.
 10811  func (c *UsersThreadsListCall) Pages(ctx context.Context, f func(*ListThreadsResponse) error) error {
 10812  	c.ctx_ = ctx
 10813  	defer c.PageToken(c.urlParams_.Get("pageToken"))
 10814  	for {
 10815  		x, err := c.Do()
 10816  		if err != nil {
 10817  			return err
 10818  		}
 10819  		if err := f(x); err != nil {
 10820  			return err
 10821  		}
 10822  		if x.NextPageToken == "" {
 10823  			return nil
 10824  		}
 10825  		c.PageToken(x.NextPageToken)
 10826  	}
 10827  }
 10828  
 10829  type UsersThreadsModifyCall struct {
 10830  	s                   *Service
 10831  	userId              string
 10832  	id                  string
 10833  	modifythreadrequest *ModifyThreadRequest
 10834  	urlParams_          gensupport.URLParams
 10835  	ctx_                context.Context
 10836  	header_             http.Header
 10837  }
 10838  
 10839  // Modify: Modifies the labels applied to the thread. This applies to all
 10840  // messages in the thread.
 10841  //
 10842  //   - id: The ID of the thread to modify.
 10843  //   - userId: The user's email address. The special value `me` can be used to
 10844  //     indicate the authenticated user.
 10845  func (r *UsersThreadsService) Modify(userId string, id string, modifythreadrequest *ModifyThreadRequest) *UsersThreadsModifyCall {
 10846  	c := &UsersThreadsModifyCall{s: r.s, urlParams_: make(gensupport.URLParams)}
 10847  	c.userId = userId
 10848  	c.id = id
 10849  	c.modifythreadrequest = modifythreadrequest
 10850  	return c
 10851  }
 10852  
 10853  // Fields allows partial responses to be retrieved. See
 10854  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
 10855  // details.
 10856  func (c *UsersThreadsModifyCall) Fields(s ...googleapi.Field) *UsersThreadsModifyCall {
 10857  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
 10858  	return c
 10859  }
 10860  
 10861  // Context sets the context to be used in this call's Do method.
 10862  func (c *UsersThreadsModifyCall) Context(ctx context.Context) *UsersThreadsModifyCall {
 10863  	c.ctx_ = ctx
 10864  	return c
 10865  }
 10866  
 10867  // Header returns a http.Header that can be modified by the caller to add
 10868  // headers to the request.
 10869  func (c *UsersThreadsModifyCall) Header() http.Header {
 10870  	if c.header_ == nil {
 10871  		c.header_ = make(http.Header)
 10872  	}
 10873  	return c.header_
 10874  }
 10875  
 10876  func (c *UsersThreadsModifyCall) doRequest(alt string) (*http.Response, error) {
 10877  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "application/json", c.header_)
 10878  	var body io.Reader = nil
 10879  	body, err := googleapi.WithoutDataWrapper.JSONReader(c.modifythreadrequest)
 10880  	if err != nil {
 10881  		return nil, err
 10882  	}
 10883  	c.urlParams_.Set("alt", alt)
 10884  	c.urlParams_.Set("prettyPrint", "false")
 10885  	urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/threads/{id}/modify")
 10886  	urls += "?" + c.urlParams_.Encode()
 10887  	req, err := http.NewRequest("POST", urls, body)
 10888  	if err != nil {
 10889  		return nil, err
 10890  	}
 10891  	req.Header = reqHeaders
 10892  	googleapi.Expand(req.URL, map[string]string{
 10893  		"userId": c.userId,
 10894  		"id":     c.id,
 10895  	})
 10896  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
 10897  }
 10898  
 10899  // Do executes the "gmail.users.threads.modify" call.
 10900  // Any non-2xx status code is an error. Response headers are in either
 10901  // *Thread.ServerResponse.Header or (if a response was returned at all) in
 10902  // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
 10903  // whether the returned error was because http.StatusNotModified was returned.
 10904  func (c *UsersThreadsModifyCall) Do(opts ...googleapi.CallOption) (*Thread, error) {
 10905  	gensupport.SetOptions(c.urlParams_, opts...)
 10906  	res, err := c.doRequest("json")
 10907  	if res != nil && res.StatusCode == http.StatusNotModified {
 10908  		if res.Body != nil {
 10909  			res.Body.Close()
 10910  		}
 10911  		return nil, gensupport.WrapError(&googleapi.Error{
 10912  			Code:   res.StatusCode,
 10913  			Header: res.Header,
 10914  		})
 10915  	}
 10916  	if err != nil {
 10917  		return nil, err
 10918  	}
 10919  	defer googleapi.CloseBody(res)
 10920  	if err := googleapi.CheckResponse(res); err != nil {
 10921  		return nil, gensupport.WrapError(err)
 10922  	}
 10923  	ret := &Thread{
 10924  		ServerResponse: googleapi.ServerResponse{
 10925  			Header:         res.Header,
 10926  			HTTPStatusCode: res.StatusCode,
 10927  		},
 10928  	}
 10929  	target := &ret
 10930  	if err := gensupport.DecodeResponse(target, res); err != nil {
 10931  		return nil, err
 10932  	}
 10933  	return ret, nil
 10934  }
 10935  
 10936  type UsersThreadsTrashCall struct {
 10937  	s          *Service
 10938  	userId     string
 10939  	id         string
 10940  	urlParams_ gensupport.URLParams
 10941  	ctx_       context.Context
 10942  	header_    http.Header
 10943  }
 10944  
 10945  // Trash: Moves the specified thread to the trash. Any messages that belong to
 10946  // the thread are also moved to the trash.
 10947  //
 10948  //   - id: The ID of the thread to Trash.
 10949  //   - userId: The user's email address. The special value `me` can be used to
 10950  //     indicate the authenticated user.
 10951  func (r *UsersThreadsService) Trash(userId string, id string) *UsersThreadsTrashCall {
 10952  	c := &UsersThreadsTrashCall{s: r.s, urlParams_: make(gensupport.URLParams)}
 10953  	c.userId = userId
 10954  	c.id = id
 10955  	return c
 10956  }
 10957  
 10958  // Fields allows partial responses to be retrieved. See
 10959  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
 10960  // details.
 10961  func (c *UsersThreadsTrashCall) Fields(s ...googleapi.Field) *UsersThreadsTrashCall {
 10962  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
 10963  	return c
 10964  }
 10965  
 10966  // Context sets the context to be used in this call's Do method.
 10967  func (c *UsersThreadsTrashCall) Context(ctx context.Context) *UsersThreadsTrashCall {
 10968  	c.ctx_ = ctx
 10969  	return c
 10970  }
 10971  
 10972  // Header returns a http.Header that can be modified by the caller to add
 10973  // headers to the request.
 10974  func (c *UsersThreadsTrashCall) Header() http.Header {
 10975  	if c.header_ == nil {
 10976  		c.header_ = make(http.Header)
 10977  	}
 10978  	return c.header_
 10979  }
 10980  
 10981  func (c *UsersThreadsTrashCall) doRequest(alt string) (*http.Response, error) {
 10982  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
 10983  	var body io.Reader = nil
 10984  	c.urlParams_.Set("alt", alt)
 10985  	c.urlParams_.Set("prettyPrint", "false")
 10986  	urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/threads/{id}/trash")
 10987  	urls += "?" + c.urlParams_.Encode()
 10988  	req, err := http.NewRequest("POST", urls, body)
 10989  	if err != nil {
 10990  		return nil, err
 10991  	}
 10992  	req.Header = reqHeaders
 10993  	googleapi.Expand(req.URL, map[string]string{
 10994  		"userId": c.userId,
 10995  		"id":     c.id,
 10996  	})
 10997  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
 10998  }
 10999  
 11000  // Do executes the "gmail.users.threads.trash" call.
 11001  // Any non-2xx status code is an error. Response headers are in either
 11002  // *Thread.ServerResponse.Header or (if a response was returned at all) in
 11003  // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
 11004  // whether the returned error was because http.StatusNotModified was returned.
 11005  func (c *UsersThreadsTrashCall) Do(opts ...googleapi.CallOption) (*Thread, error) {
 11006  	gensupport.SetOptions(c.urlParams_, opts...)
 11007  	res, err := c.doRequest("json")
 11008  	if res != nil && res.StatusCode == http.StatusNotModified {
 11009  		if res.Body != nil {
 11010  			res.Body.Close()
 11011  		}
 11012  		return nil, gensupport.WrapError(&googleapi.Error{
 11013  			Code:   res.StatusCode,
 11014  			Header: res.Header,
 11015  		})
 11016  	}
 11017  	if err != nil {
 11018  		return nil, err
 11019  	}
 11020  	defer googleapi.CloseBody(res)
 11021  	if err := googleapi.CheckResponse(res); err != nil {
 11022  		return nil, gensupport.WrapError(err)
 11023  	}
 11024  	ret := &Thread{
 11025  		ServerResponse: googleapi.ServerResponse{
 11026  			Header:         res.Header,
 11027  			HTTPStatusCode: res.StatusCode,
 11028  		},
 11029  	}
 11030  	target := &ret
 11031  	if err := gensupport.DecodeResponse(target, res); err != nil {
 11032  		return nil, err
 11033  	}
 11034  	return ret, nil
 11035  }
 11036  
 11037  type UsersThreadsUntrashCall struct {
 11038  	s          *Service
 11039  	userId     string
 11040  	id         string
 11041  	urlParams_ gensupport.URLParams
 11042  	ctx_       context.Context
 11043  	header_    http.Header
 11044  }
 11045  
 11046  // Untrash: Removes the specified thread from the trash. Any messages that
 11047  // belong to the thread are also removed from the trash.
 11048  //
 11049  //   - id: The ID of the thread to remove from Trash.
 11050  //   - userId: The user's email address. The special value `me` can be used to
 11051  //     indicate the authenticated user.
 11052  func (r *UsersThreadsService) Untrash(userId string, id string) *UsersThreadsUntrashCall {
 11053  	c := &UsersThreadsUntrashCall{s: r.s, urlParams_: make(gensupport.URLParams)}
 11054  	c.userId = userId
 11055  	c.id = id
 11056  	return c
 11057  }
 11058  
 11059  // Fields allows partial responses to be retrieved. See
 11060  // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse for more
 11061  // details.
 11062  func (c *UsersThreadsUntrashCall) Fields(s ...googleapi.Field) *UsersThreadsUntrashCall {
 11063  	c.urlParams_.Set("fields", googleapi.CombineFields(s))
 11064  	return c
 11065  }
 11066  
 11067  // Context sets the context to be used in this call's Do method.
 11068  func (c *UsersThreadsUntrashCall) Context(ctx context.Context) *UsersThreadsUntrashCall {
 11069  	c.ctx_ = ctx
 11070  	return c
 11071  }
 11072  
 11073  // Header returns a http.Header that can be modified by the caller to add
 11074  // headers to the request.
 11075  func (c *UsersThreadsUntrashCall) Header() http.Header {
 11076  	if c.header_ == nil {
 11077  		c.header_ = make(http.Header)
 11078  	}
 11079  	return c.header_
 11080  }
 11081  
 11082  func (c *UsersThreadsUntrashCall) doRequest(alt string) (*http.Response, error) {
 11083  	reqHeaders := gensupport.SetHeaders(c.s.userAgent(), "", c.header_)
 11084  	var body io.Reader = nil
 11085  	c.urlParams_.Set("alt", alt)
 11086  	c.urlParams_.Set("prettyPrint", "false")
 11087  	urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/threads/{id}/untrash")
 11088  	urls += "?" + c.urlParams_.Encode()
 11089  	req, err := http.NewRequest("POST", urls, body)
 11090  	if err != nil {
 11091  		return nil, err
 11092  	}
 11093  	req.Header = reqHeaders
 11094  	googleapi.Expand(req.URL, map[string]string{
 11095  		"userId": c.userId,
 11096  		"id":     c.id,
 11097  	})
 11098  	return gensupport.SendRequest(c.ctx_, c.s.client, req)
 11099  }
 11100  
 11101  // Do executes the "gmail.users.threads.untrash" call.
 11102  // Any non-2xx status code is an error. Response headers are in either
 11103  // *Thread.ServerResponse.Header or (if a response was returned at all) in
 11104  // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
 11105  // whether the returned error was because http.StatusNotModified was returned.
 11106  func (c *UsersThreadsUntrashCall) Do(opts ...googleapi.CallOption) (*Thread, error) {
 11107  	gensupport.SetOptions(c.urlParams_, opts...)
 11108  	res, err := c.doRequest("json")
 11109  	if res != nil && res.StatusCode == http.StatusNotModified {
 11110  		if res.Body != nil {
 11111  			res.Body.Close()
 11112  		}
 11113  		return nil, gensupport.WrapError(&googleapi.Error{
 11114  			Code:   res.StatusCode,
 11115  			Header: res.Header,
 11116  		})
 11117  	}
 11118  	if err != nil {
 11119  		return nil, err
 11120  	}
 11121  	defer googleapi.CloseBody(res)
 11122  	if err := googleapi.CheckResponse(res); err != nil {
 11123  		return nil, gensupport.WrapError(err)
 11124  	}
 11125  	ret := &Thread{
 11126  		ServerResponse: googleapi.ServerResponse{
 11127  			Header:         res.Header,
 11128  			HTTPStatusCode: res.StatusCode,
 11129  		},
 11130  	}
 11131  	target := &ret
 11132  	if err := gensupport.DecodeResponse(target, res); err != nil {
 11133  		return nil, err
 11134  	}
 11135  	return ret, nil
 11136  }
 11137  

View as plain text