1// Copyright 2019 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// Creating a client
12//
13// Usage example:
14//
15//   import "google.golang.org/api/gmail/v1"
16//   ...
17//   ctx := context.Background()
18//   gmailService, err := gmail.NewService(ctx)
19//
20// In this example, Google Application Default Credentials are used for authentication.
21//
22// For information on how to create and obtain Application Default Credentials, see https://developers.google.com/identity/protocols/application-default-credentials.
23//
24// Other authentication options
25//
26// By default, all available scopes (see "Constants") are used to authenticate. To restrict scopes, use option.WithScopes:
27//
28//   gmailService, err := gmail.NewService(ctx, option.WithScopes(gmail.GmailSettingsSharingScope))
29//
30// To use an API key for authentication (note: some APIs do not support API keys), use option.WithAPIKey:
31//
32//   gmailService, err := gmail.NewService(ctx, option.WithAPIKey("AIza..."))
33//
34// To use an OAuth token (e.g., a user token obtained via a three-legged OAuth flow), use option.WithTokenSource:
35//
36//   config := &oauth2.Config{...}
37//   // ...
38//   token, err := config.Exchange(ctx, ...)
39//   gmailService, err := gmail.NewService(ctx, option.WithTokenSource(config.TokenSource(ctx, token)))
40//
41// See https://godoc.org/google.golang.org/api/option/ for details on options.
42package gmail // import "google.golang.org/api/gmail/v1"
43
44import (
45	"bytes"
46	"context"
47	"encoding/json"
48	"errors"
49	"fmt"
50	"io"
51	"net/http"
52	"net/url"
53	"strconv"
54	"strings"
55
56	gensupport "google.golang.org/api/gensupport"
57	googleapi "google.golang.org/api/googleapi"
58	option "google.golang.org/api/option"
59	htransport "google.golang.org/api/transport/http"
60)
61
62// Always reference these packages, just in case the auto-generated code
63// below doesn't.
64var _ = bytes.NewBuffer
65var _ = strconv.Itoa
66var _ = fmt.Sprintf
67var _ = json.NewDecoder
68var _ = io.Copy
69var _ = url.Parse
70var _ = gensupport.MarshalJSON
71var _ = googleapi.Version
72var _ = errors.New
73var _ = strings.Replace
74var _ = context.Canceled
75
76const apiId = "gmail:v1"
77const apiName = "gmail"
78const apiVersion = "v1"
79const basePath = "https://www.googleapis.com/gmail/v1/users/"
80
81// OAuth2 scopes used by this API.
82const (
83	// Read, compose, send, and permanently delete all your email from Gmail
84	MailGoogleComScope = "https://mail.google.com/"
85
86	// Manage drafts and send emails
87	GmailComposeScope = "https://www.googleapis.com/auth/gmail.compose"
88
89	// Insert mail into your mailbox
90	GmailInsertScope = "https://www.googleapis.com/auth/gmail.insert"
91
92	// Manage mailbox labels
93	GmailLabelsScope = "https://www.googleapis.com/auth/gmail.labels"
94
95	// View your email message metadata such as labels and headers, but not
96	// the email body
97	GmailMetadataScope = "https://www.googleapis.com/auth/gmail.metadata"
98
99	// View and modify but not delete your email
100	GmailModifyScope = "https://www.googleapis.com/auth/gmail.modify"
101
102	// View your email messages and settings
103	GmailReadonlyScope = "https://www.googleapis.com/auth/gmail.readonly"
104
105	// Send email on your behalf
106	GmailSendScope = "https://www.googleapis.com/auth/gmail.send"
107
108	// Manage your basic mail settings
109	GmailSettingsBasicScope = "https://www.googleapis.com/auth/gmail.settings.basic"
110
111	// Manage your sensitive mail settings, including who can manage your
112	// mail
113	GmailSettingsSharingScope = "https://www.googleapis.com/auth/gmail.settings.sharing"
114)
115
116// NewService creates a new Service.
117func NewService(ctx context.Context, opts ...option.ClientOption) (*Service, error) {
118	scopesOption := option.WithScopes(
119		"https://mail.google.com/",
120		"https://www.googleapis.com/auth/gmail.compose",
121		"https://www.googleapis.com/auth/gmail.insert",
122		"https://www.googleapis.com/auth/gmail.labels",
123		"https://www.googleapis.com/auth/gmail.metadata",
124		"https://www.googleapis.com/auth/gmail.modify",
125		"https://www.googleapis.com/auth/gmail.readonly",
126		"https://www.googleapis.com/auth/gmail.send",
127		"https://www.googleapis.com/auth/gmail.settings.basic",
128		"https://www.googleapis.com/auth/gmail.settings.sharing",
129	)
130	// NOTE: prepend, so we don't override user-specified scopes.
131	opts = append([]option.ClientOption{scopesOption}, opts...)
132	client, endpoint, err := htransport.NewClient(ctx, opts...)
133	if err != nil {
134		return nil, err
135	}
136	s, err := New(client)
137	if err != nil {
138		return nil, err
139	}
140	if endpoint != "" {
141		s.BasePath = endpoint
142	}
143	return s, nil
144}
145
146// New creates a new Service. It uses the provided http.Client for requests.
147//
148// Deprecated: please use NewService instead.
149// To provide a custom HTTP client, use option.WithHTTPClient.
150// If you are using google.golang.org/api/googleapis/transport.APIKey, use option.WithAPIKey with NewService instead.
151func New(client *http.Client) (*Service, error) {
152	if client == nil {
153		return nil, errors.New("client is nil")
154	}
155	s := &Service{client: client, BasePath: basePath}
156	s.Users = NewUsersService(s)
157	return s, nil
158}
159
160type Service struct {
161	client    *http.Client
162	BasePath  string // API endpoint base URL
163	UserAgent string // optional additional User-Agent fragment
164
165	Users *UsersService
166}
167
168func (s *Service) userAgent() string {
169	if s.UserAgent == "" {
170		return googleapi.UserAgent
171	}
172	return googleapi.UserAgent + " " + s.UserAgent
173}
174
175func NewUsersService(s *Service) *UsersService {
176	rs := &UsersService{s: s}
177	rs.Drafts = NewUsersDraftsService(s)
178	rs.History = NewUsersHistoryService(s)
179	rs.Labels = NewUsersLabelsService(s)
180	rs.Messages = NewUsersMessagesService(s)
181	rs.Settings = NewUsersSettingsService(s)
182	rs.Threads = NewUsersThreadsService(s)
183	return rs
184}
185
186type UsersService struct {
187	s *Service
188
189	Drafts *UsersDraftsService
190
191	History *UsersHistoryService
192
193	Labels *UsersLabelsService
194
195	Messages *UsersMessagesService
196
197	Settings *UsersSettingsService
198
199	Threads *UsersThreadsService
200}
201
202func NewUsersDraftsService(s *Service) *UsersDraftsService {
203	rs := &UsersDraftsService{s: s}
204	return rs
205}
206
207type UsersDraftsService struct {
208	s *Service
209}
210
211func NewUsersHistoryService(s *Service) *UsersHistoryService {
212	rs := &UsersHistoryService{s: s}
213	return rs
214}
215
216type UsersHistoryService struct {
217	s *Service
218}
219
220func NewUsersLabelsService(s *Service) *UsersLabelsService {
221	rs := &UsersLabelsService{s: s}
222	return rs
223}
224
225type UsersLabelsService struct {
226	s *Service
227}
228
229func NewUsersMessagesService(s *Service) *UsersMessagesService {
230	rs := &UsersMessagesService{s: s}
231	rs.Attachments = NewUsersMessagesAttachmentsService(s)
232	return rs
233}
234
235type UsersMessagesService struct {
236	s *Service
237
238	Attachments *UsersMessagesAttachmentsService
239}
240
241func NewUsersMessagesAttachmentsService(s *Service) *UsersMessagesAttachmentsService {
242	rs := &UsersMessagesAttachmentsService{s: s}
243	return rs
244}
245
246type UsersMessagesAttachmentsService struct {
247	s *Service
248}
249
250func NewUsersSettingsService(s *Service) *UsersSettingsService {
251	rs := &UsersSettingsService{s: s}
252	rs.Delegates = NewUsersSettingsDelegatesService(s)
253	rs.Filters = NewUsersSettingsFiltersService(s)
254	rs.ForwardingAddresses = NewUsersSettingsForwardingAddressesService(s)
255	rs.SendAs = NewUsersSettingsSendAsService(s)
256	return rs
257}
258
259type UsersSettingsService struct {
260	s *Service
261
262	Delegates *UsersSettingsDelegatesService
263
264	Filters *UsersSettingsFiltersService
265
266	ForwardingAddresses *UsersSettingsForwardingAddressesService
267
268	SendAs *UsersSettingsSendAsService
269}
270
271func NewUsersSettingsDelegatesService(s *Service) *UsersSettingsDelegatesService {
272	rs := &UsersSettingsDelegatesService{s: s}
273	return rs
274}
275
276type UsersSettingsDelegatesService struct {
277	s *Service
278}
279
280func NewUsersSettingsFiltersService(s *Service) *UsersSettingsFiltersService {
281	rs := &UsersSettingsFiltersService{s: s}
282	return rs
283}
284
285type UsersSettingsFiltersService struct {
286	s *Service
287}
288
289func NewUsersSettingsForwardingAddressesService(s *Service) *UsersSettingsForwardingAddressesService {
290	rs := &UsersSettingsForwardingAddressesService{s: s}
291	return rs
292}
293
294type UsersSettingsForwardingAddressesService struct {
295	s *Service
296}
297
298func NewUsersSettingsSendAsService(s *Service) *UsersSettingsSendAsService {
299	rs := &UsersSettingsSendAsService{s: s}
300	rs.SmimeInfo = NewUsersSettingsSendAsSmimeInfoService(s)
301	return rs
302}
303
304type UsersSettingsSendAsService struct {
305	s *Service
306
307	SmimeInfo *UsersSettingsSendAsSmimeInfoService
308}
309
310func NewUsersSettingsSendAsSmimeInfoService(s *Service) *UsersSettingsSendAsSmimeInfoService {
311	rs := &UsersSettingsSendAsSmimeInfoService{s: s}
312	return rs
313}
314
315type UsersSettingsSendAsSmimeInfoService struct {
316	s *Service
317}
318
319func NewUsersThreadsService(s *Service) *UsersThreadsService {
320	rs := &UsersThreadsService{s: s}
321	return rs
322}
323
324type UsersThreadsService struct {
325	s *Service
326}
327
328// AutoForwarding: Auto-forwarding settings for an account.
329type AutoForwarding struct {
330	// Disposition: The state that a message should be left in after it has
331	// been forwarded.
332	//
333	// Possible values:
334	//   "archive"
335	//   "dispositionUnspecified"
336	//   "leaveInInbox"
337	//   "markRead"
338	//   "trash"
339	Disposition string `json:"disposition,omitempty"`
340
341	// EmailAddress: Email address to which all incoming messages are
342	// forwarded. This email address must be a verified member of the
343	// forwarding addresses.
344	EmailAddress string `json:"emailAddress,omitempty"`
345
346	// Enabled: Whether all incoming mail is automatically forwarded to
347	// another address.
348	Enabled bool `json:"enabled,omitempty"`
349
350	// ServerResponse contains the HTTP response code and headers from the
351	// server.
352	googleapi.ServerResponse `json:"-"`
353
354	// ForceSendFields is a list of field names (e.g. "Disposition") to
355	// unconditionally include in API requests. By default, fields with
356	// empty values are omitted from API requests. However, any non-pointer,
357	// non-interface field appearing in ForceSendFields will be sent to the
358	// server regardless of whether the field is empty or not. This may be
359	// used to include empty fields in Patch requests.
360	ForceSendFields []string `json:"-"`
361
362	// NullFields is a list of field names (e.g. "Disposition") to include
363	// in API requests with the JSON null value. By default, fields with
364	// empty values are omitted from API requests. However, any field with
365	// an empty value appearing in NullFields will be sent to the server as
366	// null. It is an error if a field in this list has a non-empty value.
367	// This may be used to include null fields in Patch requests.
368	NullFields []string `json:"-"`
369}
370
371func (s *AutoForwarding) MarshalJSON() ([]byte, error) {
372	type NoMethod AutoForwarding
373	raw := NoMethod(*s)
374	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
375}
376
377type BatchDeleteMessagesRequest struct {
378	// Ids: The IDs of the messages to delete.
379	Ids []string `json:"ids,omitempty"`
380
381	// ForceSendFields is a list of field names (e.g. "Ids") to
382	// unconditionally include in API requests. By default, fields with
383	// empty values are omitted from API requests. However, any non-pointer,
384	// non-interface field appearing in ForceSendFields will be sent to the
385	// server regardless of whether the field is empty or not. This may be
386	// used to include empty fields in Patch requests.
387	ForceSendFields []string `json:"-"`
388
389	// NullFields is a list of field names (e.g. "Ids") to include in API
390	// requests with the JSON null value. By default, fields with empty
391	// values are omitted from API requests. However, any field with an
392	// empty value appearing in NullFields will be sent to the server as
393	// null. It is an error if a field in this list has a non-empty value.
394	// This may be used to include null fields in Patch requests.
395	NullFields []string `json:"-"`
396}
397
398func (s *BatchDeleteMessagesRequest) MarshalJSON() ([]byte, error) {
399	type NoMethod BatchDeleteMessagesRequest
400	raw := NoMethod(*s)
401	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
402}
403
404type BatchModifyMessagesRequest struct {
405	// AddLabelIds: A list of label IDs to add to messages.
406	AddLabelIds []string `json:"addLabelIds,omitempty"`
407
408	// Ids: The IDs of the messages to modify. There is a limit of 1000 ids
409	// per request.
410	Ids []string `json:"ids,omitempty"`
411
412	// RemoveLabelIds: A list of label IDs to remove from messages.
413	RemoveLabelIds []string `json:"removeLabelIds,omitempty"`
414
415	// ForceSendFields is a list of field names (e.g. "AddLabelIds") to
416	// unconditionally include in API requests. By default, fields with
417	// empty values are omitted from API requests. However, any non-pointer,
418	// non-interface field appearing in ForceSendFields will be sent to the
419	// server regardless of whether the field is empty or not. This may be
420	// used to include empty fields in Patch requests.
421	ForceSendFields []string `json:"-"`
422
423	// NullFields is a list of field names (e.g. "AddLabelIds") to include
424	// in API requests with the JSON null value. By default, fields with
425	// empty values are omitted from API requests. However, any field with
426	// an empty value appearing in NullFields will be sent to the server as
427	// null. It is an error if a field in this list has a non-empty value.
428	// This may be used to include null fields in Patch requests.
429	NullFields []string `json:"-"`
430}
431
432func (s *BatchModifyMessagesRequest) MarshalJSON() ([]byte, error) {
433	type NoMethod BatchModifyMessagesRequest
434	raw := NoMethod(*s)
435	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
436}
437
438// Delegate: Settings for a delegate. Delegates can read, send, and
439// delete messages, as well as view and add contacts, for the
440// delegator's account. See "Set up mail delegation" for more
441// information about delegates.
442type Delegate struct {
443	// DelegateEmail: The email address of the delegate.
444	DelegateEmail string `json:"delegateEmail,omitempty"`
445
446	// VerificationStatus: Indicates whether this address has been verified
447	// and can act as a delegate for the account. Read-only.
448	//
449	// Possible values:
450	//   "accepted"
451	//   "expired"
452	//   "pending"
453	//   "rejected"
454	//   "verificationStatusUnspecified"
455	VerificationStatus string `json:"verificationStatus,omitempty"`
456
457	// ServerResponse contains the HTTP response code and headers from the
458	// server.
459	googleapi.ServerResponse `json:"-"`
460
461	// ForceSendFields is a list of field names (e.g. "DelegateEmail") to
462	// unconditionally include in API requests. By default, fields with
463	// empty values are omitted from API requests. However, any non-pointer,
464	// non-interface field appearing in ForceSendFields will be sent to the
465	// server regardless of whether the field is empty or not. This may be
466	// used to include empty fields in Patch requests.
467	ForceSendFields []string `json:"-"`
468
469	// NullFields is a list of field names (e.g. "DelegateEmail") to include
470	// in API requests with the JSON null value. By default, fields with
471	// empty values are omitted from API requests. However, any field with
472	// an empty value appearing in NullFields will be sent to the server as
473	// null. It is an error if a field in this list has a non-empty value.
474	// This may be used to include null fields in Patch requests.
475	NullFields []string `json:"-"`
476}
477
478func (s *Delegate) MarshalJSON() ([]byte, error) {
479	type NoMethod Delegate
480	raw := NoMethod(*s)
481	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
482}
483
484// Draft: A draft email in the user's mailbox.
485type Draft struct {
486	// Id: The immutable ID of the draft.
487	Id string `json:"id,omitempty"`
488
489	// Message: The message content of the draft.
490	Message *Message `json:"message,omitempty"`
491
492	// ServerResponse contains the HTTP response code and headers from the
493	// server.
494	googleapi.ServerResponse `json:"-"`
495
496	// ForceSendFields is a list of field names (e.g. "Id") to
497	// unconditionally include in API requests. By default, fields with
498	// empty values are omitted from API requests. However, any non-pointer,
499	// non-interface field appearing in ForceSendFields will be sent to the
500	// server regardless of whether the field is empty or not. This may be
501	// used to include empty fields in Patch requests.
502	ForceSendFields []string `json:"-"`
503
504	// NullFields is a list of field names (e.g. "Id") to include in API
505	// requests with the JSON null value. By default, fields with empty
506	// values are omitted from API requests. However, any field with an
507	// empty value appearing in NullFields will be sent to the server as
508	// null. It is an error if a field in this list has a non-empty value.
509	// This may be used to include null fields in Patch requests.
510	NullFields []string `json:"-"`
511}
512
513func (s *Draft) MarshalJSON() ([]byte, error) {
514	type NoMethod Draft
515	raw := NoMethod(*s)
516	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
517}
518
519// Filter: Resource definition for Gmail filters. Filters apply to
520// specific messages instead of an entire email thread.
521type Filter struct {
522	// Action: Action that the filter performs.
523	Action *FilterAction `json:"action,omitempty"`
524
525	// Criteria: Matching criteria for the filter.
526	Criteria *FilterCriteria `json:"criteria,omitempty"`
527
528	// Id: The server assigned ID of the filter.
529	Id string `json:"id,omitempty"`
530
531	// ServerResponse contains the HTTP response code and headers from the
532	// server.
533	googleapi.ServerResponse `json:"-"`
534
535	// ForceSendFields is a list of field names (e.g. "Action") to
536	// unconditionally include in API requests. By default, fields with
537	// empty values are omitted from API requests. However, any non-pointer,
538	// non-interface field appearing in ForceSendFields will be sent to the
539	// server regardless of whether the field is empty or not. This may be
540	// used to include empty fields in Patch requests.
541	ForceSendFields []string `json:"-"`
542
543	// NullFields is a list of field names (e.g. "Action") to include in API
544	// requests with the JSON null value. By default, fields with empty
545	// values are omitted from API requests. However, any field with an
546	// empty value appearing in NullFields will be sent to the server as
547	// null. It is an error if a field in this list has a non-empty value.
548	// This may be used to include null fields in Patch requests.
549	NullFields []string `json:"-"`
550}
551
552func (s *Filter) MarshalJSON() ([]byte, error) {
553	type NoMethod Filter
554	raw := NoMethod(*s)
555	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
556}
557
558// FilterAction: A set of actions to perform on a message.
559type FilterAction struct {
560	// AddLabelIds: List of labels to add to the message.
561	AddLabelIds []string `json:"addLabelIds,omitempty"`
562
563	// Forward: Email address that the message should be forwarded to.
564	Forward string `json:"forward,omitempty"`
565
566	// RemoveLabelIds: List of labels to remove from the message.
567	RemoveLabelIds []string `json:"removeLabelIds,omitempty"`
568
569	// ForceSendFields is a list of field names (e.g. "AddLabelIds") to
570	// unconditionally include in API requests. By default, fields with
571	// empty values are omitted from API requests. However, any non-pointer,
572	// non-interface field appearing in ForceSendFields will be sent to the
573	// server regardless of whether the field is empty or not. This may be
574	// used to include empty fields in Patch requests.
575	ForceSendFields []string `json:"-"`
576
577	// NullFields is a list of field names (e.g. "AddLabelIds") to include
578	// in API requests with the JSON null value. By default, fields with
579	// empty values are omitted from API requests. However, any field with
580	// an empty value appearing in NullFields will be sent to the server as
581	// null. It is an error if a field in this list has a non-empty value.
582	// This may be used to include null fields in Patch requests.
583	NullFields []string `json:"-"`
584}
585
586func (s *FilterAction) MarshalJSON() ([]byte, error) {
587	type NoMethod FilterAction
588	raw := NoMethod(*s)
589	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
590}
591
592// FilterCriteria: Message matching criteria.
593type FilterCriteria struct {
594	// ExcludeChats: Whether the response should exclude chats.
595	ExcludeChats bool `json:"excludeChats,omitempty"`
596
597	// From: The sender's display name or email address.
598	From string `json:"from,omitempty"`
599
600	// HasAttachment: Whether the message has any attachment.
601	HasAttachment bool `json:"hasAttachment,omitempty"`
602
603	// NegatedQuery: Only return messages not matching the specified query.
604	// Supports the same query format as the Gmail search box. For example,
605	// "from:someuser@example.com rfc822msgid: is:unread".
606	NegatedQuery string `json:"negatedQuery,omitempty"`
607
608	// Query: Only return messages matching the specified query. Supports
609	// the same query format as the Gmail search box. For example,
610	// "from:someuser@example.com rfc822msgid: is:unread".
611	Query string `json:"query,omitempty"`
612
613	// Size: The size of the entire RFC822 message in bytes, including all
614	// headers and attachments.
615	Size int64 `json:"size,omitempty"`
616
617	// SizeComparison: How the message size in bytes should be in relation
618	// to the size field.
619	//
620	// Possible values:
621	//   "larger"
622	//   "smaller"
623	//   "unspecified"
624	SizeComparison string `json:"sizeComparison,omitempty"`
625
626	// Subject: Case-insensitive phrase found in the message's subject.
627	// Trailing and leading whitespace are be trimmed and adjacent spaces
628	// are collapsed.
629	Subject string `json:"subject,omitempty"`
630
631	// To: The recipient's display name or email address. Includes
632	// recipients in the "to", "cc", and "bcc" header fields. You can use
633	// simply the local part of the email address. For example, "example"
634	// and "example@" both match "example@gmail.com". This field is
635	// case-insensitive.
636	To string `json:"to,omitempty"`
637
638	// ForceSendFields is a list of field names (e.g. "ExcludeChats") to
639	// unconditionally include in API requests. By default, fields with
640	// empty values are omitted from API requests. However, any non-pointer,
641	// non-interface field appearing in ForceSendFields will be sent to the
642	// server regardless of whether the field is empty or not. This may be
643	// used to include empty fields in Patch requests.
644	ForceSendFields []string `json:"-"`
645
646	// NullFields is a list of field names (e.g. "ExcludeChats") to include
647	// in API requests with the JSON null value. By default, fields with
648	// empty values are omitted from API requests. However, any field with
649	// an empty value appearing in NullFields will be sent to the server as
650	// null. It is an error if a field in this list has a non-empty value.
651	// This may be used to include null fields in Patch requests.
652	NullFields []string `json:"-"`
653}
654
655func (s *FilterCriteria) MarshalJSON() ([]byte, error) {
656	type NoMethod FilterCriteria
657	raw := NoMethod(*s)
658	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
659}
660
661// ForwardingAddress: Settings for a forwarding address.
662type ForwardingAddress struct {
663	// ForwardingEmail: An email address to which messages can be forwarded.
664	ForwardingEmail string `json:"forwardingEmail,omitempty"`
665
666	// VerificationStatus: Indicates whether this address has been verified
667	// and is usable for forwarding. Read-only.
668	//
669	// Possible values:
670	//   "accepted"
671	//   "pending"
672	//   "verificationStatusUnspecified"
673	VerificationStatus string `json:"verificationStatus,omitempty"`
674
675	// ServerResponse contains the HTTP response code and headers from the
676	// server.
677	googleapi.ServerResponse `json:"-"`
678
679	// ForceSendFields is a list of field names (e.g. "ForwardingEmail") to
680	// unconditionally include in API requests. By default, fields with
681	// empty values are omitted from API requests. However, any non-pointer,
682	// non-interface field appearing in ForceSendFields will be sent to the
683	// server regardless of whether the field is empty or not. This may be
684	// used to include empty fields in Patch requests.
685	ForceSendFields []string `json:"-"`
686
687	// NullFields is a list of field names (e.g. "ForwardingEmail") to
688	// include in API requests with the JSON null value. By default, fields
689	// with empty values are omitted from API requests. However, any field
690	// with an empty value appearing in NullFields will be sent to the
691	// server as null. It is an error if a field in this list has a
692	// non-empty value. This may be used to include null fields in Patch
693	// requests.
694	NullFields []string `json:"-"`
695}
696
697func (s *ForwardingAddress) MarshalJSON() ([]byte, error) {
698	type NoMethod ForwardingAddress
699	raw := NoMethod(*s)
700	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
701}
702
703// History: A record of a change to the user's mailbox. Each history
704// change may affect multiple messages in multiple ways.
705type History struct {
706	// Id: The mailbox sequence ID.
707	Id uint64 `json:"id,omitempty,string"`
708
709	// LabelsAdded: Labels added to messages in this history record.
710	LabelsAdded []*HistoryLabelAdded `json:"labelsAdded,omitempty"`
711
712	// LabelsRemoved: Labels removed from messages in this history record.
713	LabelsRemoved []*HistoryLabelRemoved `json:"labelsRemoved,omitempty"`
714
715	// Messages: List of messages changed in this history record. The fields
716	// for specific change types, such as messagesAdded may duplicate
717	// messages in this field. We recommend using the specific change-type
718	// fields instead of this.
719	Messages []*Message `json:"messages,omitempty"`
720
721	// MessagesAdded: Messages added to the mailbox in this history record.
722	MessagesAdded []*HistoryMessageAdded `json:"messagesAdded,omitempty"`
723
724	// MessagesDeleted: Messages deleted (not Trashed) from the mailbox in
725	// this history record.
726	MessagesDeleted []*HistoryMessageDeleted `json:"messagesDeleted,omitempty"`
727
728	// ForceSendFields is a list of field names (e.g. "Id") to
729	// unconditionally include in API requests. By default, fields with
730	// empty values are omitted from API requests. However, any non-pointer,
731	// non-interface field appearing in ForceSendFields will be sent to the
732	// server regardless of whether the field is empty or not. This may be
733	// used to include empty fields in Patch requests.
734	ForceSendFields []string `json:"-"`
735
736	// NullFields is a list of field names (e.g. "Id") to include in API
737	// requests with the JSON null value. By default, fields with empty
738	// values are omitted from API requests. However, any field with an
739	// empty value appearing in NullFields will be sent to the server as
740	// null. It is an error if a field in this list has a non-empty value.
741	// This may be used to include null fields in Patch requests.
742	NullFields []string `json:"-"`
743}
744
745func (s *History) MarshalJSON() ([]byte, error) {
746	type NoMethod History
747	raw := NoMethod(*s)
748	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
749}
750
751type HistoryLabelAdded struct {
752	// LabelIds: Label IDs added to the message.
753	LabelIds []string `json:"labelIds,omitempty"`
754
755	Message *Message `json:"message,omitempty"`
756
757	// ForceSendFields is a list of field names (e.g. "LabelIds") to
758	// unconditionally include in API requests. By default, fields with
759	// empty values are omitted from API requests. However, any non-pointer,
760	// non-interface field appearing in ForceSendFields will be sent to the
761	// server regardless of whether the field is empty or not. This may be
762	// used to include empty fields in Patch requests.
763	ForceSendFields []string `json:"-"`
764
765	// NullFields is a list of field names (e.g. "LabelIds") to include in
766	// API requests with the JSON null value. By default, fields with empty
767	// values are omitted from API requests. However, any field with an
768	// empty value appearing in NullFields will be sent to the server as
769	// null. It is an error if a field in this list has a non-empty value.
770	// This may be used to include null fields in Patch requests.
771	NullFields []string `json:"-"`
772}
773
774func (s *HistoryLabelAdded) MarshalJSON() ([]byte, error) {
775	type NoMethod HistoryLabelAdded
776	raw := NoMethod(*s)
777	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
778}
779
780type HistoryLabelRemoved struct {
781	// LabelIds: Label IDs removed from the message.
782	LabelIds []string `json:"labelIds,omitempty"`
783
784	Message *Message `json:"message,omitempty"`
785
786	// ForceSendFields is a list of field names (e.g. "LabelIds") to
787	// unconditionally include in API requests. By default, fields with
788	// empty values are omitted from API requests. However, any non-pointer,
789	// non-interface field appearing in ForceSendFields will be sent to the
790	// server regardless of whether the field is empty or not. This may be
791	// used to include empty fields in Patch requests.
792	ForceSendFields []string `json:"-"`
793
794	// NullFields is a list of field names (e.g. "LabelIds") to include in
795	// API requests with the JSON null value. By default, fields with empty
796	// values are omitted from API requests. However, any field with an
797	// empty value appearing in NullFields will be sent to the server as
798	// null. It is an error if a field in this list has a non-empty value.
799	// This may be used to include null fields in Patch requests.
800	NullFields []string `json:"-"`
801}
802
803func (s *HistoryLabelRemoved) MarshalJSON() ([]byte, error) {
804	type NoMethod HistoryLabelRemoved
805	raw := NoMethod(*s)
806	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
807}
808
809type HistoryMessageAdded struct {
810	Message *Message `json:"message,omitempty"`
811
812	// ForceSendFields is a list of field names (e.g. "Message") to
813	// unconditionally include in API requests. By default, fields with
814	// empty values are omitted from API requests. However, any non-pointer,
815	// non-interface field appearing in ForceSendFields will be sent to the
816	// server regardless of whether the field is empty or not. This may be
817	// used to include empty fields in Patch requests.
818	ForceSendFields []string `json:"-"`
819
820	// NullFields is a list of field names (e.g. "Message") to include in
821	// API requests with the JSON null value. By default, fields with empty
822	// values are omitted from API requests. However, any field with an
823	// empty value appearing in NullFields will be sent to the server as
824	// null. It is an error if a field in this list has a non-empty value.
825	// This may be used to include null fields in Patch requests.
826	NullFields []string `json:"-"`
827}
828
829func (s *HistoryMessageAdded) MarshalJSON() ([]byte, error) {
830	type NoMethod HistoryMessageAdded
831	raw := NoMethod(*s)
832	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
833}
834
835type HistoryMessageDeleted struct {
836	Message *Message `json:"message,omitempty"`
837
838	// ForceSendFields is a list of field names (e.g. "Message") to
839	// unconditionally include in API requests. By default, fields with
840	// empty values are omitted from API requests. However, any non-pointer,
841	// non-interface field appearing in ForceSendFields will be sent to the
842	// server regardless of whether the field is empty or not. This may be
843	// used to include empty fields in Patch requests.
844	ForceSendFields []string `json:"-"`
845
846	// NullFields is a list of field names (e.g. "Message") to include in
847	// API requests with the JSON null value. By default, fields with empty
848	// values are omitted from API requests. However, any field with an
849	// empty value appearing in NullFields will be sent to the server as
850	// null. It is an error if a field in this list has a non-empty value.
851	// This may be used to include null fields in Patch requests.
852	NullFields []string `json:"-"`
853}
854
855func (s *HistoryMessageDeleted) MarshalJSON() ([]byte, error) {
856	type NoMethod HistoryMessageDeleted
857	raw := NoMethod(*s)
858	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
859}
860
861// ImapSettings: IMAP settings for an account.
862type ImapSettings struct {
863	// AutoExpunge: If this value is true, Gmail will immediately expunge a
864	// message when it is marked as deleted in IMAP. Otherwise, Gmail will
865	// wait for an update from the client before expunging messages marked
866	// as deleted.
867	AutoExpunge bool `json:"autoExpunge,omitempty"`
868
869	// Enabled: Whether IMAP is enabled for the account.
870	Enabled bool `json:"enabled,omitempty"`
871
872	// ExpungeBehavior: The action that will be executed on a message when
873	// it is marked as deleted and expunged from the last visible IMAP
874	// folder.
875	//
876	// Possible values:
877	//   "archive"
878	//   "deleteForever"
879	//   "expungeBehaviorUnspecified"
880	//   "trash"
881	ExpungeBehavior string `json:"expungeBehavior,omitempty"`
882
883	// MaxFolderSize: An optional limit on the number of messages that an
884	// IMAP folder may contain. Legal values are 0, 1000, 2000, 5000 or
885	// 10000. A value of zero is interpreted to mean that there is no limit.
886	MaxFolderSize int64 `json:"maxFolderSize,omitempty"`
887
888	// ServerResponse contains the HTTP response code and headers from the
889	// server.
890	googleapi.ServerResponse `json:"-"`
891
892	// ForceSendFields is a list of field names (e.g. "AutoExpunge") to
893	// unconditionally include in API requests. By default, fields with
894	// empty values are omitted from API requests. However, any non-pointer,
895	// non-interface field appearing in ForceSendFields will be sent to the
896	// server regardless of whether the field is empty or not. This may be
897	// used to include empty fields in Patch requests.
898	ForceSendFields []string `json:"-"`
899
900	// NullFields is a list of field names (e.g. "AutoExpunge") to include
901	// in API requests with the JSON null value. By default, fields with
902	// empty values are omitted from API requests. However, any field with
903	// an empty value appearing in NullFields will be sent to the server as
904	// null. It is an error if a field in this list has a non-empty value.
905	// This may be used to include null fields in Patch requests.
906	NullFields []string `json:"-"`
907}
908
909func (s *ImapSettings) MarshalJSON() ([]byte, error) {
910	type NoMethod ImapSettings
911	raw := NoMethod(*s)
912	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
913}
914
915// Label: Labels are used to categorize messages and threads within the
916// user's mailbox.
917type Label struct {
918	// Color: The color to assign to the label. Color is only available for
919	// labels that have their type set to user.
920	Color *LabelColor `json:"color,omitempty"`
921
922	// Id: The immutable ID of the label.
923	Id string `json:"id,omitempty"`
924
925	// LabelListVisibility: The visibility of the label in the label list in
926	// the Gmail web interface.
927	//
928	// Possible values:
929	//   "labelHide"
930	//   "labelShow"
931	//   "labelShowIfUnread"
932	LabelListVisibility string `json:"labelListVisibility,omitempty"`
933
934	// MessageListVisibility: The visibility of the label in the message
935	// list in the Gmail web interface.
936	//
937	// Possible values:
938	//   "hide"
939	//   "show"
940	MessageListVisibility string `json:"messageListVisibility,omitempty"`
941
942	// MessagesTotal: The total number of messages with the label.
943	MessagesTotal int64 `json:"messagesTotal,omitempty"`
944
945	// MessagesUnread: The number of unread messages with the label.
946	MessagesUnread int64 `json:"messagesUnread,omitempty"`
947
948	// Name: The display name of the label.
949	Name string `json:"name,omitempty"`
950
951	// ThreadsTotal: The total number of threads with the label.
952	ThreadsTotal int64 `json:"threadsTotal,omitempty"`
953
954	// ThreadsUnread: The number of unread threads with the label.
955	ThreadsUnread int64 `json:"threadsUnread,omitempty"`
956
957	// Type: The owner type for the label. User labels are created by the
958	// user and can be modified and deleted by the user and can be applied
959	// to any message or thread. System labels are internally created and
960	// cannot be added, modified, or deleted. System labels may be able to
961	// be applied to or removed from messages and threads under some
962	// circumstances but this is not guaranteed. For example, users can
963	// apply and remove the INBOX and UNREAD labels from messages and
964	// threads, but cannot apply or remove the DRAFTS or SENT labels from
965	// messages or threads.
966	//
967	// Possible values:
968	//   "system"
969	//   "user"
970	Type string `json:"type,omitempty"`
971
972	// ServerResponse contains the HTTP response code and headers from the
973	// server.
974	googleapi.ServerResponse `json:"-"`
975
976	// ForceSendFields is a list of field names (e.g. "Color") to
977	// unconditionally include in API requests. By default, fields with
978	// empty values are omitted from API requests. However, any non-pointer,
979	// non-interface field appearing in ForceSendFields will be sent to the
980	// server regardless of whether the field is empty or not. This may be
981	// used to include empty fields in Patch requests.
982	ForceSendFields []string `json:"-"`
983
984	// NullFields is a list of field names (e.g. "Color") to include in API
985	// requests with the JSON null value. By default, fields with empty
986	// values are omitted from API requests. However, any field with an
987	// empty value appearing in NullFields will be sent to the server as
988	// null. It is an error if a field in this list has a non-empty value.
989	// This may be used to include null fields in Patch requests.
990	NullFields []string `json:"-"`
991}
992
993func (s *Label) MarshalJSON() ([]byte, error) {
994	type NoMethod Label
995	raw := NoMethod(*s)
996	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
997}
998
999type LabelColor struct {
1000	// BackgroundColor: The background color represented as hex string
1001	// #RRGGBB (ex #000000). This field is required in order to set the
1002	// color of a label. Only the following predefined set of color values
1003	// are allowed:
1004	// #000000, #434343, #666666, #999999, #cccccc, #efefef, #f3f3f3,
1005	// #ffffff, #fb4c2f, #ffad47, #fad165, #16a766, #43d692, #4a86e8,
1006	// #a479e2, #f691b3, #f6c5be, #ffe6c7, #fef1d1, #b9e4d0, #c6f3de,
1007	// #c9daf8, #e4d7f5, #fcdee8, #efa093, #ffd6a2, #fce8b3, #89d3b2,
1008	// #a0eac9, #a4c2f4, #d0bcf1, #fbc8d9, #e66550, #ffbc6b, #fcda83,
1009	// #44b984, #68dfa9, #6d9eeb, #b694e8, #f7a7c0, #cc3a21, #eaa041,
1010	// #f2c960, #149e60, #3dc789, #3c78d8, #8e63ce, #e07798, #ac2b16,
1011	// #cf8933, #d5ae49, #0b804b, #2a9c68, #285bac, #653e9b, #b65775,
1012	// #822111, #a46a21, #aa8831, #076239, #1a764d, #1c4587, #41236d,
1013	// #83334c #464646, #e7e7e7, #0d3472, #b6cff5, #0d3b44, #98d7e4,
1014	// #3d188e, #e3d7ff, #711a36, #fbd3e0, #8a1c0a, #f2b2a8, #7a2e0b,
1015	// #ffc8af, #7a4706, #ffdeb5, #594c05, #fbe983, #684e07, #fdedc1,
1016	// #0b4f30, #b3efd3, #04502e, #a2dcc1, #c2c2c2, #4986e7, #2da2bb,
1017	// #b99aff, #994a64, #f691b2, #ff7537, #ffad46, #662e37, #ebdbde,
1018	// #cca6ac, #094228, #42d692, #16a765
1019	BackgroundColor string `json:"backgroundColor,omitempty"`
1020
1021	// TextColor: The text color of the label, represented as hex string.
1022	// This field is required in order to set the color of a label. Only the
1023	// following predefined set of color values are allowed:
1024	// #000000, #434343, #666666, #999999, #cccccc, #efefef, #f3f3f3,
1025	// #ffffff, #fb4c2f, #ffad47, #fad165, #16a766, #43d692, #4a86e8,
1026	// #a479e2, #f691b3, #f6c5be, #ffe6c7, #fef1d1, #b9e4d0, #c6f3de,
1027	// #c9daf8, #e4d7f5, #fcdee8, #efa093, #ffd6a2, #fce8b3, #89d3b2,
1028	// #a0eac9, #a4c2f4, #d0bcf1, #fbc8d9, #e66550, #ffbc6b, #fcda83,
1029	// #44b984, #68dfa9, #6d9eeb, #b694e8, #f7a7c0, #cc3a21, #eaa041,
1030	// #f2c960, #149e60, #3dc789, #3c78d8, #8e63ce, #e07798, #ac2b16,
1031	// #cf8933, #d5ae49, #0b804b, #2a9c68, #285bac, #653e9b, #b65775,
1032	// #822111, #a46a21, #aa8831, #076239, #1a764d, #1c4587, #41236d,
1033	// #83334c #464646, #e7e7e7, #0d3472, #b6cff5, #0d3b44, #98d7e4,
1034	// #3d188e, #e3d7ff, #711a36, #fbd3e0, #8a1c0a, #f2b2a8, #7a2e0b,
1035	// #ffc8af, #7a4706, #ffdeb5, #594c05, #fbe983, #684e07, #fdedc1,
1036	// #0b4f30, #b3efd3, #04502e, #a2dcc1, #c2c2c2, #4986e7, #2da2bb,
1037	// #b99aff, #994a64, #f691b2, #ff7537, #ffad46, #662e37, #ebdbde,
1038	// #cca6ac, #094228, #42d692, #16a765
1039	TextColor string `json:"textColor,omitempty"`
1040
1041	// ForceSendFields is a list of field names (e.g. "BackgroundColor") to
1042	// unconditionally include in API requests. By default, fields with
1043	// empty values are omitted from API requests. However, any non-pointer,
1044	// non-interface field appearing in ForceSendFields will be sent to the
1045	// server regardless of whether the field is empty or not. This may be
1046	// used to include empty fields in Patch requests.
1047	ForceSendFields []string `json:"-"`
1048
1049	// NullFields is a list of field names (e.g. "BackgroundColor") to
1050	// include in API requests with the JSON null value. By default, fields
1051	// with empty values are omitted from API requests. However, any field
1052	// with an empty value appearing in NullFields will be sent to the
1053	// server as null. It is an error if a field in this list has a
1054	// non-empty value. This may be used to include null fields in Patch
1055	// requests.
1056	NullFields []string `json:"-"`
1057}
1058
1059func (s *LabelColor) MarshalJSON() ([]byte, error) {
1060	type NoMethod LabelColor
1061	raw := NoMethod(*s)
1062	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
1063}
1064
1065// LanguageSettings: Language settings for an account. These settings
1066// correspond to the "Language settings" feature in the web interface.
1067type LanguageSettings struct {
1068	// DisplayLanguage: The language to display Gmail in, formatted as an
1069	// RFC 3066 Language Tag (for example en-GB, fr or ja for British
1070	// English, French, or Japanese respectively).
1071	//
1072	// The set of languages supported by Gmail evolves over time, so please
1073	// refer to the "Language" dropdown in the Gmail settings  for all
1074	// available options, as described in the language settings help
1075	// article. A table of sample values is also provided in the Managing
1076	// Language Settings guide
1077	//
1078	// Not all Gmail clients can display the same set of languages. In the
1079	// case that a user's display language is not available for use on a
1080	// particular client, said client automatically chooses to display in
1081	// the closest supported variant (or a reasonable default).
1082	DisplayLanguage string `json:"displayLanguage,omitempty"`
1083
1084	// ServerResponse contains the HTTP response code and headers from the
1085	// server.
1086	googleapi.ServerResponse `json:"-"`
1087
1088	// ForceSendFields is a list of field names (e.g. "DisplayLanguage") to
1089	// unconditionally include in API requests. By default, fields with
1090	// empty values are omitted from API requests. However, any non-pointer,
1091	// non-interface field appearing in ForceSendFields will be sent to the
1092	// server regardless of whether the field is empty or not. This may be
1093	// used to include empty fields in Patch requests.
1094	ForceSendFields []string `json:"-"`
1095
1096	// NullFields is a list of field names (e.g. "DisplayLanguage") to
1097	// include in API requests with the JSON null value. By default, fields
1098	// with empty values are omitted from API requests. However, any field
1099	// with an empty value appearing in NullFields will be sent to the
1100	// server as null. It is an error if a field in this list has a
1101	// non-empty value. This may be used to include null fields in Patch
1102	// requests.
1103	NullFields []string `json:"-"`
1104}
1105
1106func (s *LanguageSettings) MarshalJSON() ([]byte, error) {
1107	type NoMethod LanguageSettings
1108	raw := NoMethod(*s)
1109	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
1110}
1111
1112// ListDelegatesResponse: Response for the ListDelegates method.
1113type ListDelegatesResponse struct {
1114	// Delegates: List of the user's delegates (with any verification
1115	// status).
1116	Delegates []*Delegate `json:"delegates,omitempty"`
1117
1118	// ServerResponse contains the HTTP response code and headers from the
1119	// server.
1120	googleapi.ServerResponse `json:"-"`
1121
1122	// ForceSendFields is a list of field names (e.g. "Delegates") to
1123	// unconditionally include in API requests. By default, fields with
1124	// empty values are omitted from API requests. However, any non-pointer,
1125	// non-interface field appearing in ForceSendFields will be sent to the
1126	// server regardless of whether the field is empty or not. This may be
1127	// used to include empty fields in Patch requests.
1128	ForceSendFields []string `json:"-"`
1129
1130	// NullFields is a list of field names (e.g. "Delegates") to include in
1131	// API requests with the JSON null value. By default, fields with empty
1132	// values are omitted from API requests. However, any field with an
1133	// empty value appearing in NullFields will be sent to the server as
1134	// null. It is an error if a field in this list has a non-empty value.
1135	// This may be used to include null fields in Patch requests.
1136	NullFields []string `json:"-"`
1137}
1138
1139func (s *ListDelegatesResponse) MarshalJSON() ([]byte, error) {
1140	type NoMethod ListDelegatesResponse
1141	raw := NoMethod(*s)
1142	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
1143}
1144
1145type ListDraftsResponse struct {
1146	// Drafts: List of drafts.
1147	Drafts []*Draft `json:"drafts,omitempty"`
1148
1149	// NextPageToken: Token to retrieve the next page of results in the
1150	// list.
1151	NextPageToken string `json:"nextPageToken,omitempty"`
1152
1153	// ResultSizeEstimate: Estimated total number of results.
1154	ResultSizeEstimate int64 `json:"resultSizeEstimate,omitempty"`
1155
1156	// ServerResponse contains the HTTP response code and headers from the
1157	// server.
1158	googleapi.ServerResponse `json:"-"`
1159
1160	// ForceSendFields is a list of field names (e.g. "Drafts") to
1161	// unconditionally include in API requests. By default, fields with
1162	// empty values are omitted from API requests. However, any non-pointer,
1163	// non-interface field appearing in ForceSendFields will be sent to the
1164	// server regardless of whether the field is empty or not. This may be
1165	// used to include empty fields in Patch requests.
1166	ForceSendFields []string `json:"-"`
1167
1168	// NullFields is a list of field names (e.g. "Drafts") to include in API
1169	// requests with the JSON null value. By default, fields with empty
1170	// values are omitted from API requests. However, any field with an
1171	// empty value appearing in NullFields will be sent to the server as
1172	// null. It is an error if a field in this list has a non-empty value.
1173	// This may be used to include null fields in Patch requests.
1174	NullFields []string `json:"-"`
1175}
1176
1177func (s *ListDraftsResponse) MarshalJSON() ([]byte, error) {
1178	type NoMethod ListDraftsResponse
1179	raw := NoMethod(*s)
1180	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
1181}
1182
1183// ListFiltersResponse: Response for the ListFilters method.
1184type ListFiltersResponse struct {
1185	// Filter: List of a user's filters.
1186	Filter []*Filter `json:"filter,omitempty"`
1187
1188	// ServerResponse contains the HTTP response code and headers from the
1189	// server.
1190	googleapi.ServerResponse `json:"-"`
1191
1192	// ForceSendFields is a list of field names (e.g. "Filter") to
1193	// unconditionally include in API requests. By default, fields with
1194	// empty values are omitted from API requests. However, any non-pointer,
1195	// non-interface field appearing in ForceSendFields will be sent to the
1196	// server regardless of whether the field is empty or not. This may be
1197	// used to include empty fields in Patch requests.
1198	ForceSendFields []string `json:"-"`
1199
1200	// NullFields is a list of field names (e.g. "Filter") to include in API
1201	// requests with the JSON null value. By default, fields with empty
1202	// values are omitted from API requests. However, any field with an
1203	// empty value appearing in NullFields will be sent to the server as
1204	// null. It is an error if a field in this list has a non-empty value.
1205	// This may be used to include null fields in Patch requests.
1206	NullFields []string `json:"-"`
1207}
1208
1209func (s *ListFiltersResponse) MarshalJSON() ([]byte, error) {
1210	type NoMethod ListFiltersResponse
1211	raw := NoMethod(*s)
1212	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
1213}
1214
1215// ListForwardingAddressesResponse: Response for the
1216// ListForwardingAddresses method.
1217type ListForwardingAddressesResponse struct {
1218	// ForwardingAddresses: List of addresses that may be used for
1219	// forwarding.
1220	ForwardingAddresses []*ForwardingAddress `json:"forwardingAddresses,omitempty"`
1221
1222	// ServerResponse contains the HTTP response code and headers from the
1223	// server.
1224	googleapi.ServerResponse `json:"-"`
1225
1226	// ForceSendFields is a list of field names (e.g. "ForwardingAddresses")
1227	// to unconditionally include in API requests. By default, fields with
1228	// empty values are omitted from API requests. However, any non-pointer,
1229	// non-interface field appearing in ForceSendFields will be sent to the
1230	// server regardless of whether the field is empty or not. This may be
1231	// used to include empty fields in Patch requests.
1232	ForceSendFields []string `json:"-"`
1233
1234	// NullFields is a list of field names (e.g. "ForwardingAddresses") to
1235	// include in API requests with the JSON null value. By default, fields
1236	// with empty values are omitted from API requests. However, any field
1237	// with an empty value appearing in NullFields will be sent to the
1238	// server as null. It is an error if a field in this list has a
1239	// non-empty value. This may be used to include null fields in Patch
1240	// requests.
1241	NullFields []string `json:"-"`
1242}
1243
1244func (s *ListForwardingAddressesResponse) MarshalJSON() ([]byte, error) {
1245	type NoMethod ListForwardingAddressesResponse
1246	raw := NoMethod(*s)
1247	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
1248}
1249
1250type ListHistoryResponse struct {
1251	// History: List of history records. Any messages contained in the
1252	// response will typically only have id and threadId fields populated.
1253	History []*History `json:"history,omitempty"`
1254
1255	// HistoryId: The ID of the mailbox's current history record.
1256	HistoryId uint64 `json:"historyId,omitempty,string"`
1257
1258	// NextPageToken: Page token to retrieve the next page of results in the
1259	// list.
1260	NextPageToken string `json:"nextPageToken,omitempty"`
1261
1262	// ServerResponse contains the HTTP response code and headers from the
1263	// server.
1264	googleapi.ServerResponse `json:"-"`
1265
1266	// ForceSendFields is a list of field names (e.g. "History") to
1267	// unconditionally include in API requests. By default, fields with
1268	// empty values are omitted from API requests. However, any non-pointer,
1269	// non-interface field appearing in ForceSendFields will be sent to the
1270	// server regardless of whether the field is empty or not. This may be
1271	// used to include empty fields in Patch requests.
1272	ForceSendFields []string `json:"-"`
1273
1274	// NullFields is a list of field names (e.g. "History") to include in
1275	// API requests with the JSON null value. By default, fields with empty
1276	// values are omitted from API requests. However, any field with an
1277	// empty value appearing in NullFields will be sent to the server as
1278	// null. It is an error if a field in this list has a non-empty value.
1279	// This may be used to include null fields in Patch requests.
1280	NullFields []string `json:"-"`
1281}
1282
1283func (s *ListHistoryResponse) MarshalJSON() ([]byte, error) {
1284	type NoMethod ListHistoryResponse
1285	raw := NoMethod(*s)
1286	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
1287}
1288
1289type ListLabelsResponse struct {
1290	// Labels: List of labels.
1291	Labels []*Label `json:"labels,omitempty"`
1292
1293	// ServerResponse contains the HTTP response code and headers from the
1294	// server.
1295	googleapi.ServerResponse `json:"-"`
1296
1297	// ForceSendFields is a list of field names (e.g. "Labels") to
1298	// unconditionally include in API requests. By default, fields with
1299	// empty values are omitted from API requests. However, any non-pointer,
1300	// non-interface field appearing in ForceSendFields will be sent to the
1301	// server regardless of whether the field is empty or not. This may be
1302	// used to include empty fields in Patch requests.
1303	ForceSendFields []string `json:"-"`
1304
1305	// NullFields is a list of field names (e.g. "Labels") to include in API
1306	// requests with the JSON null value. By default, fields with empty
1307	// values are omitted from API requests. However, any field with an
1308	// empty value appearing in NullFields will be sent to the server as
1309	// null. It is an error if a field in this list has a non-empty value.
1310	// This may be used to include null fields in Patch requests.
1311	NullFields []string `json:"-"`
1312}
1313
1314func (s *ListLabelsResponse) MarshalJSON() ([]byte, error) {
1315	type NoMethod ListLabelsResponse
1316	raw := NoMethod(*s)
1317	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
1318}
1319
1320type ListMessagesResponse struct {
1321	// Messages: List of messages. Note that each message resource contains
1322	// only an id and a threadId. Additional message details can be fetched
1323	// using the messages.get method.
1324	Messages []*Message `json:"messages,omitempty"`
1325
1326	// NextPageToken: Token to retrieve the next page of results in the
1327	// list.
1328	NextPageToken string `json:"nextPageToken,omitempty"`
1329
1330	// ResultSizeEstimate: Estimated total number of results.
1331	ResultSizeEstimate int64 `json:"resultSizeEstimate,omitempty"`
1332
1333	// ServerResponse contains the HTTP response code and headers from the
1334	// server.
1335	googleapi.ServerResponse `json:"-"`
1336
1337	// ForceSendFields is a list of field names (e.g. "Messages") to
1338	// unconditionally include in API requests. By default, fields with
1339	// empty values are omitted from API requests. However, any non-pointer,
1340	// non-interface field appearing in ForceSendFields will be sent to the
1341	// server regardless of whether the field is empty or not. This may be
1342	// used to include empty fields in Patch requests.
1343	ForceSendFields []string `json:"-"`
1344
1345	// NullFields is a list of field names (e.g. "Messages") to include in
1346	// API requests with the JSON null value. By default, fields with empty
1347	// values are omitted from API requests. However, any field with an
1348	// empty value appearing in NullFields will be sent to the server as
1349	// null. It is an error if a field in this list has a non-empty value.
1350	// This may be used to include null fields in Patch requests.
1351	NullFields []string `json:"-"`
1352}
1353
1354func (s *ListMessagesResponse) MarshalJSON() ([]byte, error) {
1355	type NoMethod ListMessagesResponse
1356	raw := NoMethod(*s)
1357	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
1358}
1359
1360// ListSendAsResponse: Response for the ListSendAs method.
1361type ListSendAsResponse struct {
1362	// SendAs: List of send-as aliases.
1363	SendAs []*SendAs `json:"sendAs,omitempty"`
1364
1365	// ServerResponse contains the HTTP response code and headers from the
1366	// server.
1367	googleapi.ServerResponse `json:"-"`
1368
1369	// ForceSendFields is a list of field names (e.g. "SendAs") to
1370	// unconditionally include in API requests. By default, fields with
1371	// empty values are omitted from API requests. However, any non-pointer,
1372	// non-interface field appearing in ForceSendFields will be sent to the
1373	// server regardless of whether the field is empty or not. This may be
1374	// used to include empty fields in Patch requests.
1375	ForceSendFields []string `json:"-"`
1376
1377	// NullFields is a list of field names (e.g. "SendAs") to include in API
1378	// requests with the JSON null value. By default, fields with empty
1379	// values are omitted from API requests. However, any field with an
1380	// empty value appearing in NullFields will be sent to the server as
1381	// null. It is an error if a field in this list has a non-empty value.
1382	// This may be used to include null fields in Patch requests.
1383	NullFields []string `json:"-"`
1384}
1385
1386func (s *ListSendAsResponse) MarshalJSON() ([]byte, error) {
1387	type NoMethod ListSendAsResponse
1388	raw := NoMethod(*s)
1389	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
1390}
1391
1392type ListSmimeInfoResponse struct {
1393	// SmimeInfo: List of SmimeInfo.
1394	SmimeInfo []*SmimeInfo `json:"smimeInfo,omitempty"`
1395
1396	// ServerResponse contains the HTTP response code and headers from the
1397	// server.
1398	googleapi.ServerResponse `json:"-"`
1399
1400	// ForceSendFields is a list of field names (e.g. "SmimeInfo") to
1401	// unconditionally include in API requests. By default, fields with
1402	// empty values are omitted from API requests. However, any non-pointer,
1403	// non-interface field appearing in ForceSendFields will be sent to the
1404	// server regardless of whether the field is empty or not. This may be
1405	// used to include empty fields in Patch requests.
1406	ForceSendFields []string `json:"-"`
1407
1408	// NullFields is a list of field names (e.g. "SmimeInfo") to include in
1409	// API requests with the JSON null value. By default, fields with empty
1410	// values are omitted from API requests. However, any field with an
1411	// empty value appearing in NullFields will be sent to the server as
1412	// null. It is an error if a field in this list has a non-empty value.
1413	// This may be used to include null fields in Patch requests.
1414	NullFields []string `json:"-"`
1415}
1416
1417func (s *ListSmimeInfoResponse) MarshalJSON() ([]byte, error) {
1418	type NoMethod ListSmimeInfoResponse
1419	raw := NoMethod(*s)
1420	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
1421}
1422
1423type ListThreadsResponse struct {
1424	// NextPageToken: Page token to retrieve the next page of results in the
1425	// list.
1426	NextPageToken string `json:"nextPageToken,omitempty"`
1427
1428	// ResultSizeEstimate: Estimated total number of results.
1429	ResultSizeEstimate int64 `json:"resultSizeEstimate,omitempty"`
1430
1431	// Threads: List of threads. Note that each thread resource does not
1432	// contain a list of messages. The list of messages for a given thread
1433	// can be fetched using the threads.get method.
1434	Threads []*Thread `json:"threads,omitempty"`
1435
1436	// ServerResponse contains the HTTP response code and headers from the
1437	// server.
1438	googleapi.ServerResponse `json:"-"`
1439
1440	// ForceSendFields is a list of field names (e.g. "NextPageToken") to
1441	// unconditionally include in API requests. By default, fields with
1442	// empty values are omitted from API requests. However, any non-pointer,
1443	// non-interface field appearing in ForceSendFields will be sent to the
1444	// server regardless of whether the field is empty or not. This may be
1445	// used to include empty fields in Patch requests.
1446	ForceSendFields []string `json:"-"`
1447
1448	// NullFields is a list of field names (e.g. "NextPageToken") to include
1449	// in API requests with the JSON null value. By default, fields with
1450	// empty values are omitted from API requests. However, any field with
1451	// an empty value appearing in NullFields will be sent to the server as
1452	// null. It is an error if a field in this list has a non-empty value.
1453	// This may be used to include null fields in Patch requests.
1454	NullFields []string `json:"-"`
1455}
1456
1457func (s *ListThreadsResponse) MarshalJSON() ([]byte, error) {
1458	type NoMethod ListThreadsResponse
1459	raw := NoMethod(*s)
1460	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
1461}
1462
1463// Message: An email message.
1464type Message struct {
1465	// HistoryId: The ID of the last history record that modified this
1466	// message.
1467	HistoryId uint64 `json:"historyId,omitempty,string"`
1468
1469	// Id: The immutable ID of the message.
1470	Id string `json:"id,omitempty"`
1471
1472	// InternalDate: The internal message creation timestamp (epoch ms),
1473	// which determines ordering in the inbox. For normal SMTP-received
1474	// email, this represents the time the message was originally accepted
1475	// by Google, which is more reliable than the Date header. However, for
1476	// API-migrated mail, it can be configured by client to be based on the
1477	// Date header.
1478	InternalDate int64 `json:"internalDate,omitempty,string"`
1479
1480	// LabelIds: List of IDs of labels applied to this message.
1481	LabelIds []string `json:"labelIds,omitempty"`
1482
1483	// Payload: The parsed email structure in the message parts.
1484	Payload *MessagePart `json:"payload,omitempty"`
1485
1486	// Raw: The entire email message in an RFC 2822 formatted and base64url
1487	// encoded string. Returned in messages.get and drafts.get responses
1488	// when the format=RAW parameter is supplied.
1489	Raw string `json:"raw,omitempty"`
1490
1491	// SizeEstimate: Estimated size in bytes of the message.
1492	SizeEstimate int64 `json:"sizeEstimate,omitempty"`
1493
1494	// Snippet: A short part of the message text.
1495	Snippet string `json:"snippet,omitempty"`
1496
1497	// ThreadId: The ID of the thread the message belongs to. To add a
1498	// message or draft to a thread, the following criteria must be met:
1499	// - The requested threadId must be specified on the Message or
1500	// Draft.Message you supply with your request.
1501	// - The References and In-Reply-To headers must be set in compliance
1502	// with the RFC 2822 standard.
1503	// - The Subject headers must match.
1504	ThreadId string `json:"threadId,omitempty"`
1505
1506	// ServerResponse contains the HTTP response code and headers from the
1507	// server.
1508	googleapi.ServerResponse `json:"-"`
1509
1510	// ForceSendFields is a list of field names (e.g. "HistoryId") to
1511	// unconditionally include in API requests. By default, fields with
1512	// empty values are omitted from API requests. However, any non-pointer,
1513	// non-interface field appearing in ForceSendFields will be sent to the
1514	// server regardless of whether the field is empty or not. This may be
1515	// used to include empty fields in Patch requests.
1516	ForceSendFields []string `json:"-"`
1517
1518	// NullFields is a list of field names (e.g. "HistoryId") to include in
1519	// API requests with the JSON null value. By default, fields with empty
1520	// values are omitted from API requests. However, any field with an
1521	// empty value appearing in NullFields will be sent to the server as
1522	// null. It is an error if a field in this list has a non-empty value.
1523	// This may be used to include null fields in Patch requests.
1524	NullFields []string `json:"-"`
1525}
1526
1527func (s *Message) MarshalJSON() ([]byte, error) {
1528	type NoMethod Message
1529	raw := NoMethod(*s)
1530	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
1531}
1532
1533// MessagePart: A single MIME message part.
1534type MessagePart struct {
1535	// Body: The message part body for this part, which may be empty for
1536	// container MIME message parts.
1537	Body *MessagePartBody `json:"body,omitempty"`
1538
1539	// Filename: The filename of the attachment. Only present if this
1540	// message part represents an attachment.
1541	Filename string `json:"filename,omitempty"`
1542
1543	// Headers: List of headers on this message part. For the top-level
1544	// message part, representing the entire message payload, it will
1545	// contain the standard RFC 2822 email headers such as To, From, and
1546	// Subject.
1547	Headers []*MessagePartHeader `json:"headers,omitempty"`
1548
1549	// MimeType: The MIME type of the message part.
1550	MimeType string `json:"mimeType,omitempty"`
1551
1552	// PartId: The immutable ID of the message part.
1553	PartId string `json:"partId,omitempty"`
1554
1555	// Parts: The child MIME message parts of this part. This only applies
1556	// to container MIME message parts, for example multipart/*. For non-
1557	// container MIME message part types, such as text/plain, this field is
1558	// empty. For more information, see RFC 1521.
1559	Parts []*MessagePart `json:"parts,omitempty"`
1560
1561	// ForceSendFields is a list of field names (e.g. "Body") to
1562	// unconditionally include in API requests. By default, fields with
1563	// empty values are omitted from API requests. However, any non-pointer,
1564	// non-interface field appearing in ForceSendFields will be sent to the
1565	// server regardless of whether the field is empty or not. This may be
1566	// used to include empty fields in Patch requests.
1567	ForceSendFields []string `json:"-"`
1568
1569	// NullFields is a list of field names (e.g. "Body") to include in API
1570	// requests with the JSON null value. By default, fields with empty
1571	// values are omitted from API requests. However, any field with an
1572	// empty value appearing in NullFields will be sent to the server as
1573	// null. It is an error if a field in this list has a non-empty value.
1574	// This may be used to include null fields in Patch requests.
1575	NullFields []string `json:"-"`
1576}
1577
1578func (s *MessagePart) MarshalJSON() ([]byte, error) {
1579	type NoMethod MessagePart
1580	raw := NoMethod(*s)
1581	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
1582}
1583
1584// MessagePartBody: The body of a single MIME message part.
1585type MessagePartBody struct {
1586	// AttachmentId: When present, contains the ID of an external attachment
1587	// that can be retrieved in a separate messages.attachments.get request.
1588	// When not present, the entire content of the message part body is
1589	// contained in the data field.
1590	AttachmentId string `json:"attachmentId,omitempty"`
1591
1592	// Data: The body data of a MIME message part as a base64url encoded
1593	// string. May be empty for MIME container types that have no message
1594	// body or when the body data is sent as a separate attachment. An
1595	// attachment ID is present if the body data is contained in a separate
1596	// attachment.
1597	Data string `json:"data,omitempty"`
1598
1599	// Size: Number of bytes for the message part data (encoding
1600	// notwithstanding).
1601	Size int64 `json:"size,omitempty"`
1602
1603	// ServerResponse contains the HTTP response code and headers from the
1604	// server.
1605	googleapi.ServerResponse `json:"-"`
1606
1607	// ForceSendFields is a list of field names (e.g. "AttachmentId") to
1608	// unconditionally include in API requests. By default, fields with
1609	// empty values are omitted from API requests. However, any non-pointer,
1610	// non-interface field appearing in ForceSendFields will be sent to the
1611	// server regardless of whether the field is empty or not. This may be
1612	// used to include empty fields in Patch requests.
1613	ForceSendFields []string `json:"-"`
1614
1615	// NullFields is a list of field names (e.g. "AttachmentId") to include
1616	// in API requests with the JSON null value. By default, fields with
1617	// empty values are omitted from API requests. However, any field with
1618	// an empty value appearing in NullFields will be sent to the server as
1619	// null. It is an error if a field in this list has a non-empty value.
1620	// This may be used to include null fields in Patch requests.
1621	NullFields []string `json:"-"`
1622}
1623
1624func (s *MessagePartBody) MarshalJSON() ([]byte, error) {
1625	type NoMethod MessagePartBody
1626	raw := NoMethod(*s)
1627	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
1628}
1629
1630type MessagePartHeader struct {
1631	// Name: The name of the header before the : separator. For example, To.
1632	Name string `json:"name,omitempty"`
1633
1634	// Value: The value of the header after the : separator. For example,
1635	// someuser@example.com.
1636	Value string `json:"value,omitempty"`
1637
1638	// ForceSendFields is a list of field names (e.g. "Name") to
1639	// unconditionally include in API requests. By default, fields with
1640	// empty values are omitted from API requests. However, any non-pointer,
1641	// non-interface field appearing in ForceSendFields will be sent to the
1642	// server regardless of whether the field is empty or not. This may be
1643	// used to include empty fields in Patch requests.
1644	ForceSendFields []string `json:"-"`
1645
1646	// NullFields is a list of field names (e.g. "Name") to include in API
1647	// requests with the JSON null value. By default, fields with empty
1648	// values are omitted from API requests. However, any field with an
1649	// empty value appearing in NullFields will be sent to the server as
1650	// null. It is an error if a field in this list has a non-empty value.
1651	// This may be used to include null fields in Patch requests.
1652	NullFields []string `json:"-"`
1653}
1654
1655func (s *MessagePartHeader) MarshalJSON() ([]byte, error) {
1656	type NoMethod MessagePartHeader
1657	raw := NoMethod(*s)
1658	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
1659}
1660
1661type ModifyMessageRequest struct {
1662	// AddLabelIds: A list of IDs of labels to add to this message.
1663	AddLabelIds []string `json:"addLabelIds,omitempty"`
1664
1665	// RemoveLabelIds: A list IDs of labels to remove from this message.
1666	RemoveLabelIds []string `json:"removeLabelIds,omitempty"`
1667
1668	// ForceSendFields is a list of field names (e.g. "AddLabelIds") to
1669	// unconditionally include in API requests. By default, fields with
1670	// empty values are omitted from API requests. However, any non-pointer,
1671	// non-interface field appearing in ForceSendFields will be sent to the
1672	// server regardless of whether the field is empty or not. This may be
1673	// used to include empty fields in Patch requests.
1674	ForceSendFields []string `json:"-"`
1675
1676	// NullFields is a list of field names (e.g. "AddLabelIds") to include
1677	// in API requests with the JSON null value. By default, fields with
1678	// empty values are omitted from API requests. However, any field with
1679	// an empty value appearing in NullFields will be sent to the server as
1680	// null. It is an error if a field in this list has a non-empty value.
1681	// This may be used to include null fields in Patch requests.
1682	NullFields []string `json:"-"`
1683}
1684
1685func (s *ModifyMessageRequest) MarshalJSON() ([]byte, error) {
1686	type NoMethod ModifyMessageRequest
1687	raw := NoMethod(*s)
1688	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
1689}
1690
1691type ModifyThreadRequest struct {
1692	// AddLabelIds: A list of IDs of labels to add to this thread.
1693	AddLabelIds []string `json:"addLabelIds,omitempty"`
1694
1695	// RemoveLabelIds: A list of IDs of labels to remove from this thread.
1696	RemoveLabelIds []string `json:"removeLabelIds,omitempty"`
1697
1698	// ForceSendFields is a list of field names (e.g. "AddLabelIds") to
1699	// unconditionally include in API requests. By default, fields with
1700	// empty values are omitted from API requests. However, any non-pointer,
1701	// non-interface field appearing in ForceSendFields will be sent to the
1702	// server regardless of whether the field is empty or not. This may be
1703	// used to include empty fields in Patch requests.
1704	ForceSendFields []string `json:"-"`
1705
1706	// NullFields is a list of field names (e.g. "AddLabelIds") to include
1707	// in API requests with the JSON null value. By default, fields with
1708	// empty values are omitted from API requests. However, any field with
1709	// an empty value appearing in NullFields will be sent to the server as
1710	// null. It is an error if a field in this list has a non-empty value.
1711	// This may be used to include null fields in Patch requests.
1712	NullFields []string `json:"-"`
1713}
1714
1715func (s *ModifyThreadRequest) MarshalJSON() ([]byte, error) {
1716	type NoMethod ModifyThreadRequest
1717	raw := NoMethod(*s)
1718	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
1719}
1720
1721// PopSettings: POP settings for an account.
1722type PopSettings struct {
1723	// AccessWindow: The range of messages which are accessible via POP.
1724	//
1725	// Possible values:
1726	//   "accessWindowUnspecified"
1727	//   "allMail"
1728	//   "disabled"
1729	//   "fromNowOn"
1730	AccessWindow string `json:"accessWindow,omitempty"`
1731
1732	// Disposition: The action that will be executed on a message after it
1733	// has been fetched via POP.
1734	//
1735	// Possible values:
1736	//   "archive"
1737	//   "dispositionUnspecified"
1738	//   "leaveInInbox"
1739	//   "markRead"
1740	//   "trash"
1741	Disposition string `json:"disposition,omitempty"`
1742
1743	// ServerResponse contains the HTTP response code and headers from the
1744	// server.
1745	googleapi.ServerResponse `json:"-"`
1746
1747	// ForceSendFields is a list of field names (e.g. "AccessWindow") to
1748	// unconditionally include in API requests. By default, fields with
1749	// empty values are omitted from API requests. However, any non-pointer,
1750	// non-interface field appearing in ForceSendFields will be sent to the
1751	// server regardless of whether the field is empty or not. This may be
1752	// used to include empty fields in Patch requests.
1753	ForceSendFields []string `json:"-"`
1754
1755	// NullFields is a list of field names (e.g. "AccessWindow") to include
1756	// in API requests with the JSON null value. By default, fields with
1757	// empty values are omitted from API requests. However, any field with
1758	// an empty value appearing in NullFields will be sent to the server as
1759	// null. It is an error if a field in this list has a non-empty value.
1760	// This may be used to include null fields in Patch requests.
1761	NullFields []string `json:"-"`
1762}
1763
1764func (s *PopSettings) MarshalJSON() ([]byte, error) {
1765	type NoMethod PopSettings
1766	raw := NoMethod(*s)
1767	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
1768}
1769
1770// Profile: Profile for a Gmail user.
1771type Profile struct {
1772	// EmailAddress: The user's email address.
1773	EmailAddress string `json:"emailAddress,omitempty"`
1774
1775	// HistoryId: The ID of the mailbox's current history record.
1776	HistoryId uint64 `json:"historyId,omitempty,string"`
1777
1778	// MessagesTotal: The total number of messages in the mailbox.
1779	MessagesTotal int64 `json:"messagesTotal,omitempty"`
1780
1781	// ThreadsTotal: The total number of threads in the mailbox.
1782	ThreadsTotal int64 `json:"threadsTotal,omitempty"`
1783
1784	// ServerResponse contains the HTTP response code and headers from the
1785	// server.
1786	googleapi.ServerResponse `json:"-"`
1787
1788	// ForceSendFields is a list of field names (e.g. "EmailAddress") to
1789	// unconditionally include in API requests. By default, fields with
1790	// empty values are omitted from API requests. However, any non-pointer,
1791	// non-interface field appearing in ForceSendFields will be sent to the
1792	// server regardless of whether the field is empty or not. This may be
1793	// used to include empty fields in Patch requests.
1794	ForceSendFields []string `json:"-"`
1795
1796	// NullFields is a list of field names (e.g. "EmailAddress") to include
1797	// in API requests with the JSON null value. By default, fields with
1798	// empty values are omitted from API requests. However, any field with
1799	// an empty value appearing in NullFields will be sent to the server as
1800	// null. It is an error if a field in this list has a non-empty value.
1801	// This may be used to include null fields in Patch requests.
1802	NullFields []string `json:"-"`
1803}
1804
1805func (s *Profile) MarshalJSON() ([]byte, error) {
1806	type NoMethod Profile
1807	raw := NoMethod(*s)
1808	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
1809}
1810
1811// SendAs: Settings associated with a send-as alias, which can be either
1812// the primary login address associated with the account or a custom
1813// "from" address. Send-as aliases correspond to the "Send Mail As"
1814// feature in the web interface.
1815type SendAs struct {
1816	// DisplayName: A name that appears in the "From:" header for mail sent
1817	// using this alias. For custom "from" addresses, when this is empty,
1818	// Gmail will populate the "From:" header with the name that is used for
1819	// the primary address associated with the account. If the admin has
1820	// disabled the ability for users to update their name format, requests
1821	// to update this field for the primary login will silently fail.
1822	DisplayName string `json:"displayName,omitempty"`
1823
1824	// IsDefault: Whether this address is selected as the default "From:"
1825	// address in situations such as composing a new message or sending a
1826	// vacation auto-reply. Every Gmail account has exactly one default
1827	// send-as address, so the only legal value that clients may write to
1828	// this field is true. Changing this from false to true for an address
1829	// will result in this field becoming false for the other previous
1830	// default address.
1831	IsDefault bool `json:"isDefault,omitempty"`
1832
1833	// IsPrimary: Whether this address is the primary address used to login
1834	// to the account. Every Gmail account has exactly one primary address,
1835	// and it cannot be deleted from the collection of send-as aliases. This
1836	// field is read-only.
1837	IsPrimary bool `json:"isPrimary,omitempty"`
1838
1839	// ReplyToAddress: An optional email address that is included in a
1840	// "Reply-To:" header for mail sent using this alias. If this is empty,
1841	// Gmail will not generate a "Reply-To:" header.
1842	ReplyToAddress string `json:"replyToAddress,omitempty"`
1843
1844	// SendAsEmail: The email address that appears in the "From:" header for
1845	// mail sent using this alias. This is read-only for all operations
1846	// except create.
1847	SendAsEmail string `json:"sendAsEmail,omitempty"`
1848
1849	// Signature: An optional HTML signature that is included in messages
1850	// composed with this alias in the Gmail web UI.
1851	Signature string `json:"signature,omitempty"`
1852
1853	// SmtpMsa: An optional SMTP service that will be used as an outbound
1854	// relay for mail sent using this alias. If this is empty, outbound mail
1855	// will be sent directly from Gmail's servers to the destination SMTP
1856	// service. This setting only applies to custom "from" aliases.
1857	SmtpMsa *SmtpMsa `json:"smtpMsa,omitempty"`
1858
1859	// TreatAsAlias: Whether Gmail should  treat this address as an alias
1860	// for the user's primary email address. This setting only applies to
1861	// custom "from" aliases.
1862	TreatAsAlias bool `json:"treatAsAlias,omitempty"`
1863
1864	// VerificationStatus: Indicates whether this address has been verified
1865	// for use as a send-as alias. Read-only. This setting only applies to
1866	// custom "from" aliases.
1867	//
1868	// Possible values:
1869	//   "accepted"
1870	//   "pending"
1871	//   "verificationStatusUnspecified"
1872	VerificationStatus string `json:"verificationStatus,omitempty"`
1873
1874	// ServerResponse contains the HTTP response code and headers from the
1875	// server.
1876	googleapi.ServerResponse `json:"-"`
1877
1878	// ForceSendFields is a list of field names (e.g. "DisplayName") to
1879	// unconditionally include in API requests. By default, fields with
1880	// empty values are omitted from API requests. However, any non-pointer,
1881	// non-interface field appearing in ForceSendFields will be sent to the
1882	// server regardless of whether the field is empty or not. This may be
1883	// used to include empty fields in Patch requests.
1884	ForceSendFields []string `json:"-"`
1885
1886	// NullFields is a list of field names (e.g. "DisplayName") to include
1887	// in API requests with the JSON null value. By default, fields with
1888	// empty values are omitted from API requests. However, any field with
1889	// an empty value appearing in NullFields will be sent to the server as
1890	// null. It is an error if a field in this list has a non-empty value.
1891	// This may be used to include null fields in Patch requests.
1892	NullFields []string `json:"-"`
1893}
1894
1895func (s *SendAs) MarshalJSON() ([]byte, error) {
1896	type NoMethod SendAs
1897	raw := NoMethod(*s)
1898	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
1899}
1900
1901// SmimeInfo: An S/MIME email config.
1902type SmimeInfo struct {
1903	// EncryptedKeyPassword: Encrypted key password, when key is encrypted.
1904	EncryptedKeyPassword string `json:"encryptedKeyPassword,omitempty"`
1905
1906	// Expiration: When the certificate expires (in milliseconds since
1907	// epoch).
1908	Expiration int64 `json:"expiration,omitempty,string"`
1909
1910	// Id: The immutable ID for the SmimeInfo.
1911	Id string `json:"id,omitempty"`
1912
1913	// IsDefault: Whether this SmimeInfo is the default one for this user's
1914	// send-as address.
1915	IsDefault bool `json:"isDefault,omitempty"`
1916
1917	// IssuerCn: The S/MIME certificate issuer's common name.
1918	IssuerCn string `json:"issuerCn,omitempty"`
1919
1920	// Pem: PEM formatted X509 concatenated certificate string (standard
1921	// base64 encoding). Format used for returning key, which includes
1922	// public key as well as certificate chain (not private key).
1923	Pem string `json:"pem,omitempty"`
1924
1925	// Pkcs12: PKCS#12 format containing a single private/public key pair
1926	// and certificate chain. This format is only accepted from client for
1927	// creating a new SmimeInfo and is never returned, because the private
1928	// key is not intended to be exported. PKCS#12 may be encrypted, in
1929	// which case encryptedKeyPassword should be set appropriately.
1930	Pkcs12 string `json:"pkcs12,omitempty"`
1931
1932	// ServerResponse contains the HTTP response code and headers from the
1933	// server.
1934	googleapi.ServerResponse `json:"-"`
1935
1936	// ForceSendFields is a list of field names (e.g.
1937	// "EncryptedKeyPassword") to unconditionally include in API requests.
1938	// By default, fields with empty values are omitted from API requests.
1939	// However, any non-pointer, non-interface field appearing in
1940	// ForceSendFields will be sent to the server regardless of whether the
1941	// field is empty or not. This may be used to include empty fields in
1942	// Patch requests.
1943	ForceSendFields []string `json:"-"`
1944
1945	// NullFields is a list of field names (e.g. "EncryptedKeyPassword") to
1946	// include in API requests with the JSON null value. By default, fields
1947	// with empty values are omitted from API requests. However, any field
1948	// with an empty value appearing in NullFields will be sent to the
1949	// server as null. It is an error if a field in this list has a
1950	// non-empty value. This may be used to include null fields in Patch
1951	// requests.
1952	NullFields []string `json:"-"`
1953}
1954
1955func (s *SmimeInfo) MarshalJSON() ([]byte, error) {
1956	type NoMethod SmimeInfo
1957	raw := NoMethod(*s)
1958	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
1959}
1960
1961// SmtpMsa: Configuration for communication with an SMTP service.
1962type SmtpMsa struct {
1963	// Host: The hostname of the SMTP service. Required.
1964	Host string `json:"host,omitempty"`
1965
1966	// Password: The password that will be used for authentication with the
1967	// SMTP service. This is a write-only field that can be specified in
1968	// requests to create or update SendAs settings; it is never populated
1969	// in responses.
1970	Password string `json:"password,omitempty"`
1971
1972	// Port: The port of the SMTP service. Required.
1973	Port int64 `json:"port,omitempty"`
1974
1975	// SecurityMode: The protocol that will be used to secure communication
1976	// with the SMTP service. Required.
1977	//
1978	// Possible values:
1979	//   "none"
1980	//   "securityModeUnspecified"
1981	//   "ssl"
1982	//   "starttls"
1983	SecurityMode string `json:"securityMode,omitempty"`
1984
1985	// Username: The username that will be used for authentication with the
1986	// SMTP service. This is a write-only field that can be specified in
1987	// requests to create or update SendAs settings; it is never populated
1988	// in responses.
1989	Username string `json:"username,omitempty"`
1990
1991	// ForceSendFields is a list of field names (e.g. "Host") to
1992	// unconditionally include in API requests. By default, fields with
1993	// empty values are omitted from API requests. However, any non-pointer,
1994	// non-interface field appearing in ForceSendFields will be sent to the
1995	// server regardless of whether the field is empty or not. This may be
1996	// used to include empty fields in Patch requests.
1997	ForceSendFields []string `json:"-"`
1998
1999	// NullFields is a list of field names (e.g. "Host") to include in API
2000	// requests with the JSON null value. By default, fields with empty
2001	// values are omitted from API requests. However, any field with an
2002	// empty value appearing in NullFields will be sent to the server as
2003	// null. It is an error if a field in this list has a non-empty value.
2004	// This may be used to include null fields in Patch requests.
2005	NullFields []string `json:"-"`
2006}
2007
2008func (s *SmtpMsa) MarshalJSON() ([]byte, error) {
2009	type NoMethod SmtpMsa
2010	raw := NoMethod(*s)
2011	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
2012}
2013
2014// Thread: A collection of messages representing a conversation.
2015type Thread struct {
2016	// HistoryId: The ID of the last history record that modified this
2017	// thread.
2018	HistoryId uint64 `json:"historyId,omitempty,string"`
2019
2020	// Id: The unique ID of the thread.
2021	Id string `json:"id,omitempty"`
2022
2023	// Messages: The list of messages in the thread.
2024	Messages []*Message `json:"messages,omitempty"`
2025
2026	// Snippet: A short part of the message text.
2027	Snippet string `json:"snippet,omitempty"`
2028
2029	// ServerResponse contains the HTTP response code and headers from the
2030	// server.
2031	googleapi.ServerResponse `json:"-"`
2032
2033	// ForceSendFields is a list of field names (e.g. "HistoryId") to
2034	// unconditionally include in API requests. By default, fields with
2035	// empty values are omitted from API requests. However, any non-pointer,
2036	// non-interface field appearing in ForceSendFields will be sent to the
2037	// server regardless of whether the field is empty or not. This may be
2038	// used to include empty fields in Patch requests.
2039	ForceSendFields []string `json:"-"`
2040
2041	// NullFields is a list of field names (e.g. "HistoryId") to include in
2042	// API requests with the JSON null value. By default, fields with empty
2043	// values are omitted from API requests. However, any field with an
2044	// empty value appearing in NullFields will be sent to the server as
2045	// null. It is an error if a field in this list has a non-empty value.
2046	// This may be used to include null fields in Patch requests.
2047	NullFields []string `json:"-"`
2048}
2049
2050func (s *Thread) MarshalJSON() ([]byte, error) {
2051	type NoMethod Thread
2052	raw := NoMethod(*s)
2053	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
2054}
2055
2056// VacationSettings: Vacation auto-reply settings for an account. These
2057// settings correspond to the "Vacation responder" feature in the web
2058// interface.
2059type VacationSettings struct {
2060	// EnableAutoReply: Flag that controls whether Gmail automatically
2061	// replies to messages.
2062	EnableAutoReply bool `json:"enableAutoReply,omitempty"`
2063
2064	// EndTime: An optional end time for sending auto-replies (epoch ms).
2065	// When this is specified, Gmail will automatically reply only to
2066	// messages that it receives before the end time. If both startTime and
2067	// endTime are specified, startTime must precede endTime.
2068	EndTime int64 `json:"endTime,omitempty,string"`
2069
2070	// ResponseBodyHtml: Response body in HTML format. Gmail will sanitize
2071	// the HTML before storing it.
2072	ResponseBodyHtml string `json:"responseBodyHtml,omitempty"`
2073
2074	// ResponseBodyPlainText: Response body in plain text format.
2075	ResponseBodyPlainText string `json:"responseBodyPlainText,omitempty"`
2076
2077	// ResponseSubject: Optional text to prepend to the subject line in
2078	// vacation responses. In order to enable auto-replies, either the
2079	// response subject or the response body must be nonempty.
2080	ResponseSubject string `json:"responseSubject,omitempty"`
2081
2082	// RestrictToContacts: Flag that determines whether responses are sent
2083	// to recipients who are not in the user's list of contacts.
2084	RestrictToContacts bool `json:"restrictToContacts,omitempty"`
2085
2086	// RestrictToDomain: Flag that determines whether responses are sent to
2087	// recipients who are outside of the user's domain. This feature is only
2088	// available for G Suite users.
2089	RestrictToDomain bool `json:"restrictToDomain,omitempty"`
2090
2091	// StartTime: An optional start time for sending auto-replies (epoch
2092	// ms). When this is specified, Gmail will automatically reply only to
2093	// messages that it receives after the start time. If both startTime and
2094	// endTime are specified, startTime must precede endTime.
2095	StartTime int64 `json:"startTime,omitempty,string"`
2096
2097	// ServerResponse contains the HTTP response code and headers from the
2098	// server.
2099	googleapi.ServerResponse `json:"-"`
2100
2101	// ForceSendFields is a list of field names (e.g. "EnableAutoReply") to
2102	// unconditionally include in API requests. By default, fields with
2103	// empty values are omitted from API requests. However, any non-pointer,
2104	// non-interface field appearing in ForceSendFields will be sent to the
2105	// server regardless of whether the field is empty or not. This may be
2106	// used to include empty fields in Patch requests.
2107	ForceSendFields []string `json:"-"`
2108
2109	// NullFields is a list of field names (e.g. "EnableAutoReply") to
2110	// include in API requests with the JSON null value. By default, fields
2111	// with empty values are omitted from API requests. However, any field
2112	// with an empty value appearing in NullFields will be sent to the
2113	// server as null. It is an error if a field in this list has a
2114	// non-empty value. This may be used to include null fields in Patch
2115	// requests.
2116	NullFields []string `json:"-"`
2117}
2118
2119func (s *VacationSettings) MarshalJSON() ([]byte, error) {
2120	type NoMethod VacationSettings
2121	raw := NoMethod(*s)
2122	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
2123}
2124
2125// WatchRequest: Set up or update a new push notification watch on this
2126// user's mailbox.
2127type WatchRequest struct {
2128	// LabelFilterAction: Filtering behavior of labelIds list specified.
2129	//
2130	// Possible values:
2131	//   "exclude"
2132	//   "include"
2133	LabelFilterAction string `json:"labelFilterAction,omitempty"`
2134
2135	// LabelIds: List of label_ids to restrict notifications about. By
2136	// default, if unspecified, all changes are pushed out. If specified
2137	// then dictates which labels are required for a push notification to be
2138	// generated.
2139	LabelIds []string `json:"labelIds,omitempty"`
2140
2141	// TopicName: A fully qualified Google Cloud Pub/Sub API topic name to
2142	// publish the events to. This topic name **must** already exist in
2143	// Cloud Pub/Sub and you **must** have already granted gmail "publish"
2144	// permission on it. For example,
2145	// "projects/my-project-identifier/topics/my-topic-name" (using the
2146	// Cloud Pub/Sub "v1" topic naming format).
2147	//
2148	// Note that the "my-project-identifier" portion must exactly match your
2149	// Google developer project id (the one executing this watch request).
2150	TopicName string `json:"topicName,omitempty"`
2151
2152	// ForceSendFields is a list of field names (e.g. "LabelFilterAction")
2153	// to unconditionally include in API requests. By default, fields with
2154	// empty values are omitted from API requests. However, any non-pointer,
2155	// non-interface field appearing in ForceSendFields will be sent to the
2156	// server regardless of whether the field is empty or not. This may be
2157	// used to include empty fields in Patch requests.
2158	ForceSendFields []string `json:"-"`
2159
2160	// NullFields is a list of field names (e.g. "LabelFilterAction") to
2161	// include in API requests with the JSON null value. By default, fields
2162	// with empty values are omitted from API requests. However, any field
2163	// with an empty value appearing in NullFields will be sent to the
2164	// server as null. It is an error if a field in this list has a
2165	// non-empty value. This may be used to include null fields in Patch
2166	// requests.
2167	NullFields []string `json:"-"`
2168}
2169
2170func (s *WatchRequest) MarshalJSON() ([]byte, error) {
2171	type NoMethod WatchRequest
2172	raw := NoMethod(*s)
2173	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
2174}
2175
2176// WatchResponse: Push notification watch response.
2177type WatchResponse struct {
2178	// Expiration: When Gmail will stop sending notifications for mailbox
2179	// updates (epoch millis). Call watch again before this time to renew
2180	// the watch.
2181	Expiration int64 `json:"expiration,omitempty,string"`
2182
2183	// HistoryId: The ID of the mailbox's current history record.
2184	HistoryId uint64 `json:"historyId,omitempty,string"`
2185
2186	// ServerResponse contains the HTTP response code and headers from the
2187	// server.
2188	googleapi.ServerResponse `json:"-"`
2189
2190	// ForceSendFields is a list of field names (e.g. "Expiration") to
2191	// unconditionally include in API requests. By default, fields with
2192	// empty values are omitted from API requests. However, any non-pointer,
2193	// non-interface field appearing in ForceSendFields will be sent to the
2194	// server regardless of whether the field is empty or not. This may be
2195	// used to include empty fields in Patch requests.
2196	ForceSendFields []string `json:"-"`
2197
2198	// NullFields is a list of field names (e.g. "Expiration") to include in
2199	// API requests with the JSON null value. By default, fields with empty
2200	// values are omitted from API requests. However, any field with an
2201	// empty value appearing in NullFields will be sent to the server as
2202	// null. It is an error if a field in this list has a non-empty value.
2203	// This may be used to include null fields in Patch requests.
2204	NullFields []string `json:"-"`
2205}
2206
2207func (s *WatchResponse) MarshalJSON() ([]byte, error) {
2208	type NoMethod WatchResponse
2209	raw := NoMethod(*s)
2210	return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
2211}
2212
2213// method id "gmail.users.getProfile":
2214
2215type UsersGetProfileCall struct {
2216	s            *Service
2217	userId       string
2218	urlParams_   gensupport.URLParams
2219	ifNoneMatch_ string
2220	ctx_         context.Context
2221	header_      http.Header
2222}
2223
2224// GetProfile: Gets the current user's Gmail profile.
2225func (r *UsersService) GetProfile(userId string) *UsersGetProfileCall {
2226	c := &UsersGetProfileCall{s: r.s, urlParams_: make(gensupport.URLParams)}
2227	c.userId = userId
2228	return c
2229}
2230
2231// Fields allows partial responses to be retrieved. See
2232// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
2233// for more information.
2234func (c *UsersGetProfileCall) Fields(s ...googleapi.Field) *UsersGetProfileCall {
2235	c.urlParams_.Set("fields", googleapi.CombineFields(s))
2236	return c
2237}
2238
2239// IfNoneMatch sets the optional parameter which makes the operation
2240// fail if the object's ETag matches the given value. This is useful for
2241// getting updates only after the object has changed since the last
2242// request. Use googleapi.IsNotModified to check whether the response
2243// error from Do is the result of In-None-Match.
2244func (c *UsersGetProfileCall) IfNoneMatch(entityTag string) *UsersGetProfileCall {
2245	c.ifNoneMatch_ = entityTag
2246	return c
2247}
2248
2249// Context sets the context to be used in this call's Do method. Any
2250// pending HTTP request will be aborted if the provided context is
2251// canceled.
2252func (c *UsersGetProfileCall) Context(ctx context.Context) *UsersGetProfileCall {
2253	c.ctx_ = ctx
2254	return c
2255}
2256
2257// Header returns an http.Header that can be modified by the caller to
2258// add HTTP headers to the request.
2259func (c *UsersGetProfileCall) Header() http.Header {
2260	if c.header_ == nil {
2261		c.header_ = make(http.Header)
2262	}
2263	return c.header_
2264}
2265
2266func (c *UsersGetProfileCall) doRequest(alt string) (*http.Response, error) {
2267	reqHeaders := make(http.Header)
2268	for k, v := range c.header_ {
2269		reqHeaders[k] = v
2270	}
2271	reqHeaders.Set("User-Agent", c.s.userAgent())
2272	if c.ifNoneMatch_ != "" {
2273		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
2274	}
2275	var body io.Reader = nil
2276	c.urlParams_.Set("alt", alt)
2277	c.urlParams_.Set("prettyPrint", "false")
2278	urls := googleapi.ResolveRelative(c.s.BasePath, "{userId}/profile")
2279	urls += "?" + c.urlParams_.Encode()
2280	req, err := http.NewRequest("GET", urls, body)
2281	if err != nil {
2282		return nil, err
2283	}
2284	req.Header = reqHeaders
2285	googleapi.Expand(req.URL, map[string]string{
2286		"userId": c.userId,
2287	})
2288	return gensupport.SendRequest(c.ctx_, c.s.client, req)
2289}
2290
2291// Do executes the "gmail.users.getProfile" call.
2292// Exactly one of *Profile or error will be non-nil. Any non-2xx status
2293// code is an error. Response headers are in either
2294// *Profile.ServerResponse.Header or (if a response was returned at all)
2295// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
2296// check whether the returned error was because http.StatusNotModified
2297// was returned.
2298func (c *UsersGetProfileCall) Do(opts ...googleapi.CallOption) (*Profile, error) {
2299	gensupport.SetOptions(c.urlParams_, opts...)
2300	res, err := c.doRequest("json")
2301	if res != nil && res.StatusCode == http.StatusNotModified {
2302		if res.Body != nil {
2303			res.Body.Close()
2304		}
2305		return nil, &googleapi.Error{
2306			Code:   res.StatusCode,
2307			Header: res.Header,
2308		}
2309	}
2310	if err != nil {
2311		return nil, err
2312	}
2313	defer googleapi.CloseBody(res)
2314	if err := googleapi.CheckResponse(res); err != nil {
2315		return nil, err
2316	}
2317	ret := &Profile{
2318		ServerResponse: googleapi.ServerResponse{
2319			Header:         res.Header,
2320			HTTPStatusCode: res.StatusCode,
2321		},
2322	}
2323	target := &ret
2324	if err := gensupport.DecodeResponse(target, res); err != nil {
2325		return nil, err
2326	}
2327	return ret, nil
2328	// {
2329	//   "description": "Gets the current user's Gmail profile.",
2330	//   "httpMethod": "GET",
2331	//   "id": "gmail.users.getProfile",
2332	//   "parameterOrder": [
2333	//     "userId"
2334	//   ],
2335	//   "parameters": {
2336	//     "userId": {
2337	//       "default": "me",
2338	//       "description": "The user's email address. The special value me can be used to indicate the authenticated user.",
2339	//       "location": "path",
2340	//       "required": true,
2341	//       "type": "string"
2342	//     }
2343	//   },
2344	//   "path": "{userId}/profile",
2345	//   "response": {
2346	//     "$ref": "Profile"
2347	//   },
2348	//   "scopes": [
2349	//     "https://mail.google.com/",
2350	//     "https://www.googleapis.com/auth/gmail.compose",
2351	//     "https://www.googleapis.com/auth/gmail.metadata",
2352	//     "https://www.googleapis.com/auth/gmail.modify",
2353	//     "https://www.googleapis.com/auth/gmail.readonly"
2354	//   ]
2355	// }
2356
2357}
2358
2359// method id "gmail.users.stop":
2360
2361type UsersStopCall struct {
2362	s          *Service
2363	userId     string
2364	urlParams_ gensupport.URLParams
2365	ctx_       context.Context
2366	header_    http.Header
2367}
2368
2369// Stop: Stop receiving push notifications for the given user mailbox.
2370func (r *UsersService) Stop(userId string) *UsersStopCall {
2371	c := &UsersStopCall{s: r.s, urlParams_: make(gensupport.URLParams)}
2372	c.userId = userId
2373	return c
2374}
2375
2376// Fields allows partial responses to be retrieved. See
2377// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
2378// for more information.
2379func (c *UsersStopCall) Fields(s ...googleapi.Field) *UsersStopCall {
2380	c.urlParams_.Set("fields", googleapi.CombineFields(s))
2381	return c
2382}
2383
2384// Context sets the context to be used in this call's Do method. Any
2385// pending HTTP request will be aborted if the provided context is
2386// canceled.
2387func (c *UsersStopCall) Context(ctx context.Context) *UsersStopCall {
2388	c.ctx_ = ctx
2389	return c
2390}
2391
2392// Header returns an http.Header that can be modified by the caller to
2393// add HTTP headers to the request.
2394func (c *UsersStopCall) Header() http.Header {
2395	if c.header_ == nil {
2396		c.header_ = make(http.Header)
2397	}
2398	return c.header_
2399}
2400
2401func (c *UsersStopCall) doRequest(alt string) (*http.Response, error) {
2402	reqHeaders := make(http.Header)
2403	for k, v := range c.header_ {
2404		reqHeaders[k] = v
2405	}
2406	reqHeaders.Set("User-Agent", c.s.userAgent())
2407	var body io.Reader = nil
2408	c.urlParams_.Set("alt", alt)
2409	c.urlParams_.Set("prettyPrint", "false")
2410	urls := googleapi.ResolveRelative(c.s.BasePath, "{userId}/stop")
2411	urls += "?" + c.urlParams_.Encode()
2412	req, err := http.NewRequest("POST", urls, body)
2413	if err != nil {
2414		return nil, err
2415	}
2416	req.Header = reqHeaders
2417	googleapi.Expand(req.URL, map[string]string{
2418		"userId": c.userId,
2419	})
2420	return gensupport.SendRequest(c.ctx_, c.s.client, req)
2421}
2422
2423// Do executes the "gmail.users.stop" call.
2424func (c *UsersStopCall) Do(opts ...googleapi.CallOption) error {
2425	gensupport.SetOptions(c.urlParams_, opts...)
2426	res, err := c.doRequest("json")
2427	if err != nil {
2428		return err
2429	}
2430	defer googleapi.CloseBody(res)
2431	if err := googleapi.CheckResponse(res); err != nil {
2432		return err
2433	}
2434	return nil
2435	// {
2436	//   "description": "Stop receiving push notifications for the given user mailbox.",
2437	//   "httpMethod": "POST",
2438	//   "id": "gmail.users.stop",
2439	//   "parameterOrder": [
2440	//     "userId"
2441	//   ],
2442	//   "parameters": {
2443	//     "userId": {
2444	//       "default": "me",
2445	//       "description": "The user's email address. The special value me can be used to indicate the authenticated user.",
2446	//       "location": "path",
2447	//       "required": true,
2448	//       "type": "string"
2449	//     }
2450	//   },
2451	//   "path": "{userId}/stop",
2452	//   "scopes": [
2453	//     "https://mail.google.com/",
2454	//     "https://www.googleapis.com/auth/gmail.metadata",
2455	//     "https://www.googleapis.com/auth/gmail.modify",
2456	//     "https://www.googleapis.com/auth/gmail.readonly"
2457	//   ]
2458	// }
2459
2460}
2461
2462// method id "gmail.users.watch":
2463
2464type UsersWatchCall struct {
2465	s            *Service
2466	userId       string
2467	watchrequest *WatchRequest
2468	urlParams_   gensupport.URLParams
2469	ctx_         context.Context
2470	header_      http.Header
2471}
2472
2473// Watch: Set up or update a push notification watch on the given user
2474// mailbox.
2475func (r *UsersService) Watch(userId string, watchrequest *WatchRequest) *UsersWatchCall {
2476	c := &UsersWatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
2477	c.userId = userId
2478	c.watchrequest = watchrequest
2479	return c
2480}
2481
2482// Fields allows partial responses to be retrieved. See
2483// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
2484// for more information.
2485func (c *UsersWatchCall) Fields(s ...googleapi.Field) *UsersWatchCall {
2486	c.urlParams_.Set("fields", googleapi.CombineFields(s))
2487	return c
2488}
2489
2490// Context sets the context to be used in this call's Do method. Any
2491// pending HTTP request will be aborted if the provided context is
2492// canceled.
2493func (c *UsersWatchCall) Context(ctx context.Context) *UsersWatchCall {
2494	c.ctx_ = ctx
2495	return c
2496}
2497
2498// Header returns an http.Header that can be modified by the caller to
2499// add HTTP headers to the request.
2500func (c *UsersWatchCall) Header() http.Header {
2501	if c.header_ == nil {
2502		c.header_ = make(http.Header)
2503	}
2504	return c.header_
2505}
2506
2507func (c *UsersWatchCall) doRequest(alt string) (*http.Response, error) {
2508	reqHeaders := make(http.Header)
2509	for k, v := range c.header_ {
2510		reqHeaders[k] = v
2511	}
2512	reqHeaders.Set("User-Agent", c.s.userAgent())
2513	var body io.Reader = nil
2514	body, err := googleapi.WithoutDataWrapper.JSONReader(c.watchrequest)
2515	if err != nil {
2516		return nil, err
2517	}
2518	reqHeaders.Set("Content-Type", "application/json")
2519	c.urlParams_.Set("alt", alt)
2520	c.urlParams_.Set("prettyPrint", "false")
2521	urls := googleapi.ResolveRelative(c.s.BasePath, "{userId}/watch")
2522	urls += "?" + c.urlParams_.Encode()
2523	req, err := http.NewRequest("POST", urls, body)
2524	if err != nil {
2525		return nil, err
2526	}
2527	req.Header = reqHeaders
2528	googleapi.Expand(req.URL, map[string]string{
2529		"userId": c.userId,
2530	})
2531	return gensupport.SendRequest(c.ctx_, c.s.client, req)
2532}
2533
2534// Do executes the "gmail.users.watch" call.
2535// Exactly one of *WatchResponse or error will be non-nil. Any non-2xx
2536// status code is an error. Response headers are in either
2537// *WatchResponse.ServerResponse.Header or (if a response was returned
2538// at all) in error.(*googleapi.Error).Header. Use
2539// googleapi.IsNotModified to check whether the returned error was
2540// because http.StatusNotModified was returned.
2541func (c *UsersWatchCall) Do(opts ...googleapi.CallOption) (*WatchResponse, error) {
2542	gensupport.SetOptions(c.urlParams_, opts...)
2543	res, err := c.doRequest("json")
2544	if res != nil && res.StatusCode == http.StatusNotModified {
2545		if res.Body != nil {
2546			res.Body.Close()
2547		}
2548		return nil, &googleapi.Error{
2549			Code:   res.StatusCode,
2550			Header: res.Header,
2551		}
2552	}
2553	if err != nil {
2554		return nil, err
2555	}
2556	defer googleapi.CloseBody(res)
2557	if err := googleapi.CheckResponse(res); err != nil {
2558		return nil, err
2559	}
2560	ret := &WatchResponse{
2561		ServerResponse: googleapi.ServerResponse{
2562			Header:         res.Header,
2563			HTTPStatusCode: res.StatusCode,
2564		},
2565	}
2566	target := &ret
2567	if err := gensupport.DecodeResponse(target, res); err != nil {
2568		return nil, err
2569	}
2570	return ret, nil
2571	// {
2572	//   "description": "Set up or update a push notification watch on the given user mailbox.",
2573	//   "httpMethod": "POST",
2574	//   "id": "gmail.users.watch",
2575	//   "parameterOrder": [
2576	//     "userId"
2577	//   ],
2578	//   "parameters": {
2579	//     "userId": {
2580	//       "default": "me",
2581	//       "description": "The user's email address. The special value me can be used to indicate the authenticated user.",
2582	//       "location": "path",
2583	//       "required": true,
2584	//       "type": "string"
2585	//     }
2586	//   },
2587	//   "path": "{userId}/watch",
2588	//   "request": {
2589	//     "$ref": "WatchRequest"
2590	//   },
2591	//   "response": {
2592	//     "$ref": "WatchResponse"
2593	//   },
2594	//   "scopes": [
2595	//     "https://mail.google.com/",
2596	//     "https://www.googleapis.com/auth/gmail.metadata",
2597	//     "https://www.googleapis.com/auth/gmail.modify",
2598	//     "https://www.googleapis.com/auth/gmail.readonly"
2599	//   ]
2600	// }
2601
2602}
2603
2604// method id "gmail.users.drafts.create":
2605
2606type UsersDraftsCreateCall struct {
2607	s          *Service
2608	userId     string
2609	draft      *Draft
2610	urlParams_ gensupport.URLParams
2611	mediaInfo_ *gensupport.MediaInfo
2612	ctx_       context.Context
2613	header_    http.Header
2614}
2615
2616// Create: Creates a new draft with the DRAFT label.
2617func (r *UsersDraftsService) Create(userId string, draft *Draft) *UsersDraftsCreateCall {
2618	c := &UsersDraftsCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
2619	c.userId = userId
2620	c.draft = draft
2621	return c
2622}
2623
2624// Media specifies the media to upload in one or more chunks. The chunk
2625// size may be controlled by supplying a MediaOption generated by
2626// googleapi.ChunkSize. The chunk size defaults to
2627// googleapi.DefaultUploadChunkSize.The Content-Type header used in the
2628// upload request will be determined by sniffing the contents of r,
2629// unless a MediaOption generated by googleapi.ContentType is
2630// supplied.
2631// At most one of Media and ResumableMedia may be set.
2632func (c *UsersDraftsCreateCall) Media(r io.Reader, options ...googleapi.MediaOption) *UsersDraftsCreateCall {
2633	c.mediaInfo_ = gensupport.NewInfoFromMedia(r, options)
2634	return c
2635}
2636
2637// ResumableMedia specifies the media to upload in chunks and can be
2638// canceled with ctx.
2639//
2640// Deprecated: use Media instead.
2641//
2642// At most one of Media and ResumableMedia may be set. mediaType
2643// identifies the MIME media type of the upload, such as "image/png". If
2644// mediaType is "", it will be auto-detected. The provided ctx will
2645// supersede any context previously provided to the Context method.
2646func (c *UsersDraftsCreateCall) ResumableMedia(ctx context.Context, r io.ReaderAt, size int64, mediaType string) *UsersDraftsCreateCall {
2647	c.ctx_ = ctx
2648	c.mediaInfo_ = gensupport.NewInfoFromResumableMedia(r, size, mediaType)
2649	return c
2650}
2651
2652// ProgressUpdater provides a callback function that will be called
2653// after every chunk. It should be a low-latency function in order to
2654// not slow down the upload operation. This should only be called when
2655// using ResumableMedia (as opposed to Media).
2656func (c *UsersDraftsCreateCall) ProgressUpdater(pu googleapi.ProgressUpdater) *UsersDraftsCreateCall {
2657	c.mediaInfo_.SetProgressUpdater(pu)
2658	return c
2659}
2660
2661// Fields allows partial responses to be retrieved. See
2662// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
2663// for more information.
2664func (c *UsersDraftsCreateCall) Fields(s ...googleapi.Field) *UsersDraftsCreateCall {
2665	c.urlParams_.Set("fields", googleapi.CombineFields(s))
2666	return c
2667}
2668
2669// Context sets the context to be used in this call's Do method. Any
2670// pending HTTP request will be aborted if the provided context is
2671// canceled.
2672// This context will supersede any context previously provided to the
2673// ResumableMedia method.
2674func (c *UsersDraftsCreateCall) Context(ctx context.Context) *UsersDraftsCreateCall {
2675	c.ctx_ = ctx
2676	return c
2677}
2678
2679// Header returns an http.Header that can be modified by the caller to
2680// add HTTP headers to the request.
2681func (c *UsersDraftsCreateCall) Header() http.Header {
2682	if c.header_ == nil {
2683		c.header_ = make(http.Header)
2684	}
2685	return c.header_
2686}
2687
2688func (c *UsersDraftsCreateCall) doRequest(alt string) (*http.Response, error) {
2689	reqHeaders := make(http.Header)
2690	for k, v := range c.header_ {
2691		reqHeaders[k] = v
2692	}
2693	reqHeaders.Set("User-Agent", c.s.userAgent())
2694	var body io.Reader = nil
2695	body, err := googleapi.WithoutDataWrapper.JSONReader(c.draft)
2696	if err != nil {
2697		return nil, err
2698	}
2699	reqHeaders.Set("Content-Type", "application/json")
2700	c.urlParams_.Set("alt", alt)
2701	c.urlParams_.Set("prettyPrint", "false")
2702	urls := googleapi.ResolveRelative(c.s.BasePath, "{userId}/drafts")
2703	if c.mediaInfo_ != nil {
2704		urls = strings.Replace(urls, "https://www.googleapis.com/", "https://www.googleapis.com/upload/", 1)
2705		c.urlParams_.Set("uploadType", c.mediaInfo_.UploadType())
2706	}
2707	if body == nil {
2708		body = new(bytes.Buffer)
2709		reqHeaders.Set("Content-Type", "application/json")
2710	}
2711	body, getBody, cleanup := c.mediaInfo_.UploadRequest(reqHeaders, body)
2712	defer cleanup()
2713	urls += "?" + c.urlParams_.Encode()
2714	req, err := http.NewRequest("POST", urls, body)
2715	if err != nil {
2716		return nil, err
2717	}
2718	req.Header = reqHeaders
2719	req.GetBody = getBody
2720	googleapi.Expand(req.URL, map[string]string{
2721		"userId": c.userId,
2722	})
2723	return gensupport.SendRequest(c.ctx_, c.s.client, req)
2724}
2725
2726// Do executes the "gmail.users.drafts.create" call.
2727// Exactly one of *Draft or error will be non-nil. Any non-2xx status
2728// code is an error. Response headers are in either
2729// *Draft.ServerResponse.Header or (if a response was returned at all)
2730// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
2731// check whether the returned error was because http.StatusNotModified
2732// was returned.
2733func (c *UsersDraftsCreateCall) Do(opts ...googleapi.CallOption) (*Draft, error) {
2734	gensupport.SetOptions(c.urlParams_, opts...)
2735	res, err := c.doRequest("json")
2736	if res != nil && res.StatusCode == http.StatusNotModified {
2737		if res.Body != nil {
2738			res.Body.Close()
2739		}
2740		return nil, &googleapi.Error{
2741			Code:   res.StatusCode,
2742			Header: res.Header,
2743		}
2744	}
2745	if err != nil {
2746		return nil, err
2747	}
2748	defer googleapi.CloseBody(res)
2749	if err := googleapi.CheckResponse(res); err != nil {
2750		return nil, err
2751	}
2752	rx := c.mediaInfo_.ResumableUpload(res.Header.Get("Location"))
2753	if rx != nil {
2754		rx.Client = c.s.client
2755		rx.UserAgent = c.s.userAgent()
2756		ctx := c.ctx_
2757		if ctx == nil {
2758			ctx = context.TODO()
2759		}
2760		res, err = rx.Upload(ctx)
2761		if err != nil {
2762			return nil, err
2763		}
2764		defer res.Body.Close()
2765		if err := googleapi.CheckResponse(res); err != nil {
2766			return nil, err
2767		}
2768	}
2769	ret := &Draft{
2770		ServerResponse: googleapi.ServerResponse{
2771			Header:         res.Header,
2772			HTTPStatusCode: res.StatusCode,
2773		},
2774	}
2775	target := &ret
2776	if err := gensupport.DecodeResponse(target, res); err != nil {
2777		return nil, err
2778	}
2779	return ret, nil
2780	// {
2781	//   "description": "Creates a new draft with the DRAFT label.",
2782	//   "httpMethod": "POST",
2783	//   "id": "gmail.users.drafts.create",
2784	//   "mediaUpload": {
2785	//     "accept": [
2786	//       "message/rfc822"
2787	//     ],
2788	//     "maxSize": "35MB",
2789	//     "protocols": {
2790	//       "resumable": {
2791	//         "multipart": true,
2792	//         "path": "/resumable/upload/gmail/v1/users/{userId}/drafts"
2793	//       },
2794	//       "simple": {
2795	//         "multipart": true,
2796	//         "path": "/upload/gmail/v1/users/{userId}/drafts"
2797	//       }
2798	//     }
2799	//   },
2800	//   "parameterOrder": [
2801	//     "userId"
2802	//   ],
2803	//   "parameters": {
2804	//     "userId": {
2805	//       "default": "me",
2806	//       "description": "The user's email address. The special value me can be used to indicate the authenticated user.",
2807	//       "location": "path",
2808	//       "required": true,
2809	//       "type": "string"
2810	//     }
2811	//   },
2812	//   "path": "{userId}/drafts",
2813	//   "request": {
2814	//     "$ref": "Draft"
2815	//   },
2816	//   "response": {
2817	//     "$ref": "Draft"
2818	//   },
2819	//   "scopes": [
2820	//     "https://mail.google.com/",
2821	//     "https://www.googleapis.com/auth/gmail.compose",
2822	//     "https://www.googleapis.com/auth/gmail.modify"
2823	//   ],
2824	//   "supportsMediaUpload": true
2825	// }
2826
2827}
2828
2829// method id "gmail.users.drafts.delete":
2830
2831type UsersDraftsDeleteCall struct {
2832	s          *Service
2833	userId     string
2834	id         string
2835	urlParams_ gensupport.URLParams
2836	ctx_       context.Context
2837	header_    http.Header
2838}
2839
2840// Delete: Immediately and permanently deletes the specified draft. Does
2841// not simply trash it.
2842func (r *UsersDraftsService) Delete(userId string, id string) *UsersDraftsDeleteCall {
2843	c := &UsersDraftsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
2844	c.userId = userId
2845	c.id = id
2846	return c
2847}
2848
2849// Fields allows partial responses to be retrieved. See
2850// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
2851// for more information.
2852func (c *UsersDraftsDeleteCall) Fields(s ...googleapi.Field) *UsersDraftsDeleteCall {
2853	c.urlParams_.Set("fields", googleapi.CombineFields(s))
2854	return c
2855}
2856
2857// Context sets the context to be used in this call's Do method. Any
2858// pending HTTP request will be aborted if the provided context is
2859// canceled.
2860func (c *UsersDraftsDeleteCall) Context(ctx context.Context) *UsersDraftsDeleteCall {
2861	c.ctx_ = ctx
2862	return c
2863}
2864
2865// Header returns an http.Header that can be modified by the caller to
2866// add HTTP headers to the request.
2867func (c *UsersDraftsDeleteCall) Header() http.Header {
2868	if c.header_ == nil {
2869		c.header_ = make(http.Header)
2870	}
2871	return c.header_
2872}
2873
2874func (c *UsersDraftsDeleteCall) doRequest(alt string) (*http.Response, error) {
2875	reqHeaders := make(http.Header)
2876	for k, v := range c.header_ {
2877		reqHeaders[k] = v
2878	}
2879	reqHeaders.Set("User-Agent", c.s.userAgent())
2880	var body io.Reader = nil
2881	c.urlParams_.Set("alt", alt)
2882	c.urlParams_.Set("prettyPrint", "false")
2883	urls := googleapi.ResolveRelative(c.s.BasePath, "{userId}/drafts/{id}")
2884	urls += "?" + c.urlParams_.Encode()
2885	req, err := http.NewRequest("DELETE", urls, body)
2886	if err != nil {
2887		return nil, err
2888	}
2889	req.Header = reqHeaders
2890	googleapi.Expand(req.URL, map[string]string{
2891		"userId": c.userId,
2892		"id":     c.id,
2893	})
2894	return gensupport.SendRequest(c.ctx_, c.s.client, req)
2895}
2896
2897// Do executes the "gmail.users.drafts.delete" call.
2898func (c *UsersDraftsDeleteCall) Do(opts ...googleapi.CallOption) error {
2899	gensupport.SetOptions(c.urlParams_, opts...)
2900	res, err := c.doRequest("json")
2901	if err != nil {
2902		return err
2903	}
2904	defer googleapi.CloseBody(res)
2905	if err := googleapi.CheckResponse(res); err != nil {
2906		return err
2907	}
2908	return nil
2909	// {
2910	//   "description": "Immediately and permanently deletes the specified draft. Does not simply trash it.",
2911	//   "httpMethod": "DELETE",
2912	//   "id": "gmail.users.drafts.delete",
2913	//   "parameterOrder": [
2914	//     "userId",
2915	//     "id"
2916	//   ],
2917	//   "parameters": {
2918	//     "id": {
2919	//       "description": "The ID of the draft to delete.",
2920	//       "location": "path",
2921	//       "required": true,
2922	//       "type": "string"
2923	//     },
2924	//     "userId": {
2925	//       "default": "me",
2926	//       "description": "The user's email address. The special value me can be used to indicate the authenticated user.",
2927	//       "location": "path",
2928	//       "required": true,
2929	//       "type": "string"
2930	//     }
2931	//   },
2932	//   "path": "{userId}/drafts/{id}",
2933	//   "scopes": [
2934	//     "https://mail.google.com/",
2935	//     "https://www.googleapis.com/auth/gmail.compose",
2936	//     "https://www.googleapis.com/auth/gmail.modify"
2937	//   ]
2938	// }
2939
2940}
2941
2942// method id "gmail.users.drafts.get":
2943
2944type UsersDraftsGetCall struct {
2945	s            *Service
2946	userId       string
2947	id           string
2948	urlParams_   gensupport.URLParams
2949	ifNoneMatch_ string
2950	ctx_         context.Context
2951	header_      http.Header
2952}
2953
2954// Get: Gets the specified draft.
2955func (r *UsersDraftsService) Get(userId string, id string) *UsersDraftsGetCall {
2956	c := &UsersDraftsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
2957	c.userId = userId
2958	c.id = id
2959	return c
2960}
2961
2962// Format sets the optional parameter "format": The format to return the
2963// draft in.
2964//
2965// Possible values:
2966//   "full" (default)
2967//   "metadata"
2968//   "minimal"
2969//   "raw"
2970func (c *UsersDraftsGetCall) Format(format string) *UsersDraftsGetCall {
2971	c.urlParams_.Set("format", format)
2972	return c
2973}
2974
2975// Fields allows partial responses to be retrieved. See
2976// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
2977// for more information.
2978func (c *UsersDraftsGetCall) Fields(s ...googleapi.Field) *UsersDraftsGetCall {
2979	c.urlParams_.Set("fields", googleapi.CombineFields(s))
2980	return c
2981}
2982
2983// IfNoneMatch sets the optional parameter which makes the operation
2984// fail if the object's ETag matches the given value. This is useful for
2985// getting updates only after the object has changed since the last
2986// request. Use googleapi.IsNotModified to check whether the response
2987// error from Do is the result of In-None-Match.
2988func (c *UsersDraftsGetCall) IfNoneMatch(entityTag string) *UsersDraftsGetCall {
2989	c.ifNoneMatch_ = entityTag
2990	return c
2991}
2992
2993// Context sets the context to be used in this call's Do method. Any
2994// pending HTTP request will be aborted if the provided context is
2995// canceled.
2996func (c *UsersDraftsGetCall) Context(ctx context.Context) *UsersDraftsGetCall {
2997	c.ctx_ = ctx
2998	return c
2999}
3000
3001// Header returns an http.Header that can be modified by the caller to
3002// add HTTP headers to the request.
3003func (c *UsersDraftsGetCall) Header() http.Header {
3004	if c.header_ == nil {
3005		c.header_ = make(http.Header)
3006	}
3007	return c.header_
3008}
3009
3010func (c *UsersDraftsGetCall) doRequest(alt string) (*http.Response, error) {
3011	reqHeaders := make(http.Header)
3012	for k, v := range c.header_ {
3013		reqHeaders[k] = v
3014	}
3015	reqHeaders.Set("User-Agent", c.s.userAgent())
3016	if c.ifNoneMatch_ != "" {
3017		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
3018	}
3019	var body io.Reader = nil
3020	c.urlParams_.Set("alt", alt)
3021	c.urlParams_.Set("prettyPrint", "false")
3022	urls := googleapi.ResolveRelative(c.s.BasePath, "{userId}/drafts/{id}")
3023	urls += "?" + c.urlParams_.Encode()
3024	req, err := http.NewRequest("GET", urls, body)
3025	if err != nil {
3026		return nil, err
3027	}
3028	req.Header = reqHeaders
3029	googleapi.Expand(req.URL, map[string]string{
3030		"userId": c.userId,
3031		"id":     c.id,
3032	})
3033	return gensupport.SendRequest(c.ctx_, c.s.client, req)
3034}
3035
3036// Do executes the "gmail.users.drafts.get" call.
3037// Exactly one of *Draft or error will be non-nil. Any non-2xx status
3038// code is an error. Response headers are in either
3039// *Draft.ServerResponse.Header or (if a response was returned at all)
3040// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
3041// check whether the returned error was because http.StatusNotModified
3042// was returned.
3043func (c *UsersDraftsGetCall) Do(opts ...googleapi.CallOption) (*Draft, error) {
3044	gensupport.SetOptions(c.urlParams_, opts...)
3045	res, err := c.doRequest("json")
3046	if res != nil && res.StatusCode == http.StatusNotModified {
3047		if res.Body != nil {
3048			res.Body.Close()
3049		}
3050		return nil, &googleapi.Error{
3051			Code:   res.StatusCode,
3052			Header: res.Header,
3053		}
3054	}
3055	if err != nil {
3056		return nil, err
3057	}
3058	defer googleapi.CloseBody(res)
3059	if err := googleapi.CheckResponse(res); err != nil {
3060		return nil, err
3061	}
3062	ret := &Draft{
3063		ServerResponse: googleapi.ServerResponse{
3064			Header:         res.Header,
3065			HTTPStatusCode: res.StatusCode,
3066		},
3067	}
3068	target := &ret
3069	if err := gensupport.DecodeResponse(target, res); err != nil {
3070		return nil, err
3071	}
3072	return ret, nil
3073	// {
3074	//   "description": "Gets the specified draft.",
3075	//   "httpMethod": "GET",
3076	//   "id": "gmail.users.drafts.get",
3077	//   "parameterOrder": [
3078	//     "userId",
3079	//     "id"
3080	//   ],
3081	//   "parameters": {
3082	//     "format": {
3083	//       "default": "full",
3084	//       "description": "The format to return the draft in.",
3085	//       "enum": [
3086	//         "full",
3087	//         "metadata",
3088	//         "minimal",
3089	//         "raw"
3090	//       ],
3091	//       "enumDescriptions": [
3092	//         "",
3093	//         "",
3094	//         "",
3095	//         ""
3096	//       ],
3097	//       "location": "query",
3098	//       "type": "string"
3099	//     },
3100	//     "id": {
3101	//       "description": "The ID of the draft to retrieve.",
3102	//       "location": "path",
3103	//       "required": true,
3104	//       "type": "string"
3105	//     },
3106	//     "userId": {
3107	//       "default": "me",
3108	//       "description": "The user's email address. The special value me can be used to indicate the authenticated user.",
3109	//       "location": "path",
3110	//       "required": true,
3111	//       "type": "string"
3112	//     }
3113	//   },
3114	//   "path": "{userId}/drafts/{id}",
3115	//   "response": {
3116	//     "$ref": "Draft"
3117	//   },
3118	//   "scopes": [
3119	//     "https://mail.google.com/",
3120	//     "https://www.googleapis.com/auth/gmail.compose",
3121	//     "https://www.googleapis.com/auth/gmail.modify",
3122	//     "https://www.googleapis.com/auth/gmail.readonly"
3123	//   ]
3124	// }
3125
3126}
3127
3128// method id "gmail.users.drafts.list":
3129
3130type UsersDraftsListCall struct {
3131	s            *Service
3132	userId       string
3133	urlParams_   gensupport.URLParams
3134	ifNoneMatch_ string
3135	ctx_         context.Context
3136	header_      http.Header
3137}
3138
3139// List: Lists the drafts in the user's mailbox.
3140func (r *UsersDraftsService) List(userId string) *UsersDraftsListCall {
3141	c := &UsersDraftsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
3142	c.userId = userId
3143	return c
3144}
3145
3146// IncludeSpamTrash sets the optional parameter "includeSpamTrash":
3147// Include drafts from SPAM and TRASH in the results.
3148func (c *UsersDraftsListCall) IncludeSpamTrash(includeSpamTrash bool) *UsersDraftsListCall {
3149	c.urlParams_.Set("includeSpamTrash", fmt.Sprint(includeSpamTrash))
3150	return c
3151}
3152
3153// MaxResults sets the optional parameter "maxResults": Maximum number
3154// of drafts to return.
3155func (c *UsersDraftsListCall) MaxResults(maxResults int64) *UsersDraftsListCall {
3156	c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
3157	return c
3158}
3159
3160// PageToken sets the optional parameter "pageToken": Page token to
3161// retrieve a specific page of results in the list.
3162func (c *UsersDraftsListCall) PageToken(pageToken string) *UsersDraftsListCall {
3163	c.urlParams_.Set("pageToken", pageToken)
3164	return c
3165}
3166
3167// Q sets the optional parameter "q": Only return draft messages
3168// matching the specified query. Supports the same query format as the
3169// Gmail search box. For example, "from:someuser@example.com
3170// rfc822msgid: is:unread".
3171func (c *UsersDraftsListCall) Q(q string) *UsersDraftsListCall {
3172	c.urlParams_.Set("q", q)
3173	return c
3174}
3175
3176// Fields allows partial responses to be retrieved. See
3177// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
3178// for more information.
3179func (c *UsersDraftsListCall) Fields(s ...googleapi.Field) *UsersDraftsListCall {
3180	c.urlParams_.Set("fields", googleapi.CombineFields(s))
3181	return c
3182}
3183
3184// IfNoneMatch sets the optional parameter which makes the operation
3185// fail if the object's ETag matches the given value. This is useful for
3186// getting updates only after the object has changed since the last
3187// request. Use googleapi.IsNotModified to check whether the response
3188// error from Do is the result of In-None-Match.
3189func (c *UsersDraftsListCall) IfNoneMatch(entityTag string) *UsersDraftsListCall {
3190	c.ifNoneMatch_ = entityTag
3191	return c
3192}
3193
3194// Context sets the context to be used in this call's Do method. Any
3195// pending HTTP request will be aborted if the provided context is
3196// canceled.
3197func (c *UsersDraftsListCall) Context(ctx context.Context) *UsersDraftsListCall {
3198	c.ctx_ = ctx
3199	return c
3200}
3201
3202// Header returns an http.Header that can be modified by the caller to
3203// add HTTP headers to the request.
3204func (c *UsersDraftsListCall) Header() http.Header {
3205	if c.header_ == nil {
3206		c.header_ = make(http.Header)
3207	}
3208	return c.header_
3209}
3210
3211func (c *UsersDraftsListCall) doRequest(alt string) (*http.Response, error) {
3212	reqHeaders := make(http.Header)
3213	for k, v := range c.header_ {
3214		reqHeaders[k] = v
3215	}
3216	reqHeaders.Set("User-Agent", c.s.userAgent())
3217	if c.ifNoneMatch_ != "" {
3218		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
3219	}
3220	var body io.Reader = nil
3221	c.urlParams_.Set("alt", alt)
3222	c.urlParams_.Set("prettyPrint", "false")
3223	urls := googleapi.ResolveRelative(c.s.BasePath, "{userId}/drafts")
3224	urls += "?" + c.urlParams_.Encode()
3225	req, err := http.NewRequest("GET", urls, body)
3226	if err != nil {
3227		return nil, err
3228	}
3229	req.Header = reqHeaders
3230	googleapi.Expand(req.URL, map[string]string{
3231		"userId": c.userId,
3232	})
3233	return gensupport.SendRequest(c.ctx_, c.s.client, req)
3234}
3235
3236// Do executes the "gmail.users.drafts.list" call.
3237// Exactly one of *ListDraftsResponse or error will be non-nil. Any
3238// non-2xx status code is an error. Response headers are in either
3239// *ListDraftsResponse.ServerResponse.Header or (if a response was
3240// returned at all) in error.(*googleapi.Error).Header. Use
3241// googleapi.IsNotModified to check whether the returned error was
3242// because http.StatusNotModified was returned.
3243func (c *UsersDraftsListCall) Do(opts ...googleapi.CallOption) (*ListDraftsResponse, error) {
3244	gensupport.SetOptions(c.urlParams_, opts...)
3245	res, err := c.doRequest("json")
3246	if res != nil && res.StatusCode == http.StatusNotModified {
3247		if res.Body != nil {
3248			res.Body.Close()
3249		}
3250		return nil, &googleapi.Error{
3251			Code:   res.StatusCode,
3252			Header: res.Header,
3253		}
3254	}
3255	if err != nil {
3256		return nil, err
3257	}
3258	defer googleapi.CloseBody(res)
3259	if err := googleapi.CheckResponse(res); err != nil {
3260		return nil, err
3261	}
3262	ret := &ListDraftsResponse{
3263		ServerResponse: googleapi.ServerResponse{
3264			Header:         res.Header,
3265			HTTPStatusCode: res.StatusCode,
3266		},
3267	}
3268	target := &ret
3269	if err := gensupport.DecodeResponse(target, res); err != nil {
3270		return nil, err
3271	}
3272	return ret, nil
3273	// {
3274	//   "description": "Lists the drafts in the user's mailbox.",
3275	//   "httpMethod": "GET",
3276	//   "id": "gmail.users.drafts.list",
3277	//   "parameterOrder": [
3278	//     "userId"
3279	//   ],
3280	//   "parameters": {
3281	//     "includeSpamTrash": {
3282	//       "default": "false",
3283	//       "description": "Include drafts from SPAM and TRASH in the results.",
3284	//       "location": "query",
3285	//       "type": "boolean"
3286	//     },
3287	//     "maxResults": {
3288	//       "default": "100",
3289	//       "description": "Maximum number of drafts to return.",
3290	//       "format": "uint32",
3291	//       "location": "query",
3292	//       "type": "integer"
3293	//     },
3294	//     "pageToken": {
3295	//       "description": "Page token to retrieve a specific page of results in the list.",
3296	//       "location": "query",
3297	//       "type": "string"
3298	//     },
3299	//     "q": {
3300	//       "description": "Only return draft messages matching the specified query. Supports the same query format as the Gmail search box. For example, \"from:someuser@example.com rfc822msgid: is:unread\".",
3301	//       "location": "query",
3302	//       "type": "string"
3303	//     },
3304	//     "userId": {
3305	//       "default": "me",
3306	//       "description": "The user's email address. The special value me can be used to indicate the authenticated user.",
3307	//       "location": "path",
3308	//       "required": true,
3309	//       "type": "string"
3310	//     }
3311	//   },
3312	//   "path": "{userId}/drafts",
3313	//   "response": {
3314	//     "$ref": "ListDraftsResponse"
3315	//   },
3316	//   "scopes": [
3317	//     "https://mail.google.com/",
3318	//     "https://www.googleapis.com/auth/gmail.compose",
3319	//     "https://www.googleapis.com/auth/gmail.modify",
3320	//     "https://www.googleapis.com/auth/gmail.readonly"
3321	//   ]
3322	// }
3323
3324}
3325
3326// Pages invokes f for each page of results.
3327// A non-nil error returned from f will halt the iteration.
3328// The provided context supersedes any context provided to the Context method.
3329func (c *UsersDraftsListCall) Pages(ctx context.Context, f func(*ListDraftsResponse) error) error {
3330	c.ctx_ = ctx
3331	defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
3332	for {
3333		x, err := c.Do()
3334		if err != nil {
3335			return err
3336		}
3337		if err := f(x); err != nil {
3338			return err
3339		}
3340		if x.NextPageToken == "" {
3341			return nil
3342		}
3343		c.PageToken(x.NextPageToken)
3344	}
3345}
3346
3347// method id "gmail.users.drafts.send":
3348
3349type UsersDraftsSendCall struct {
3350	s          *Service
3351	userId     string
3352	draft      *Draft
3353	urlParams_ gensupport.URLParams
3354	mediaInfo_ *gensupport.MediaInfo
3355	ctx_       context.Context
3356	header_    http.Header
3357}
3358
3359// Send: Sends the specified, existing draft to the recipients in the
3360// To, Cc, and Bcc headers.
3361func (r *UsersDraftsService) Send(userId string, draft *Draft) *UsersDraftsSendCall {
3362	c := &UsersDraftsSendCall{s: r.s, urlParams_: make(gensupport.URLParams)}
3363	c.userId = userId
3364	c.draft = draft
3365	return c
3366}
3367
3368// Media specifies the media to upload in one or more chunks. The chunk
3369// size may be controlled by supplying a MediaOption generated by
3370// googleapi.ChunkSize. The chunk size defaults to
3371// googleapi.DefaultUploadChunkSize.The Content-Type header used in the
3372// upload request will be determined by sniffing the contents of r,
3373// unless a MediaOption generated by googleapi.ContentType is
3374// supplied.
3375// At most one of Media and ResumableMedia may be set.
3376func (c *UsersDraftsSendCall) Media(r io.Reader, options ...googleapi.MediaOption) *UsersDraftsSendCall {
3377	c.mediaInfo_ = gensupport.NewInfoFromMedia(r, options)
3378	return c
3379}
3380
3381// ResumableMedia specifies the media to upload in chunks and can be
3382// canceled with ctx.
3383//
3384// Deprecated: use Media instead.
3385//
3386// At most one of Media and ResumableMedia may be set. mediaType
3387// identifies the MIME media type of the upload, such as "image/png". If
3388// mediaType is "", it will be auto-detected. The provided ctx will
3389// supersede any context previously provided to the Context method.
3390func (c *UsersDraftsSendCall) ResumableMedia(ctx context.Context, r io.ReaderAt, size int64, mediaType string) *UsersDraftsSendCall {
3391	c.ctx_ = ctx
3392	c.mediaInfo_ = gensupport.NewInfoFromResumableMedia(r, size, mediaType)
3393	return c
3394}
3395
3396// ProgressUpdater provides a callback function that will be called
3397// after every chunk. It should be a low-latency function in order to
3398// not slow down the upload operation. This should only be called when
3399// using ResumableMedia (as opposed to Media).
3400func (c *UsersDraftsSendCall) ProgressUpdater(pu googleapi.ProgressUpdater) *UsersDraftsSendCall {
3401	c.mediaInfo_.SetProgressUpdater(pu)
3402	return c
3403}
3404
3405// Fields allows partial responses to be retrieved. See
3406// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
3407// for more information.
3408func (c *UsersDraftsSendCall) Fields(s ...googleapi.Field) *UsersDraftsSendCall {
3409	c.urlParams_.Set("fields", googleapi.CombineFields(s))
3410	return c
3411}
3412
3413// Context sets the context to be used in this call's Do method. Any
3414// pending HTTP request will be aborted if the provided context is
3415// canceled.
3416// This context will supersede any context previously provided to the
3417// ResumableMedia method.
3418func (c *UsersDraftsSendCall) Context(ctx context.Context) *UsersDraftsSendCall {
3419	c.ctx_ = ctx
3420	return c
3421}
3422
3423// Header returns an http.Header that can be modified by the caller to
3424// add HTTP headers to the request.
3425func (c *UsersDraftsSendCall) Header() http.Header {
3426	if c.header_ == nil {
3427		c.header_ = make(http.Header)
3428	}
3429	return c.header_
3430}
3431
3432func (c *UsersDraftsSendCall) doRequest(alt string) (*http.Response, error) {
3433	reqHeaders := make(http.Header)
3434	for k, v := range c.header_ {
3435		reqHeaders[k] = v
3436	}
3437	reqHeaders.Set("User-Agent", c.s.userAgent())
3438	var body io.Reader = nil
3439	body, err := googleapi.WithoutDataWrapper.JSONReader(c.draft)
3440	if err != nil {
3441		return nil, err
3442	}
3443	reqHeaders.Set("Content-Type", "application/json")
3444	c.urlParams_.Set("alt", alt)
3445	c.urlParams_.Set("prettyPrint", "false")
3446	urls := googleapi.ResolveRelative(c.s.BasePath, "{userId}/drafts/send")
3447	if c.mediaInfo_ != nil {
3448		urls = strings.Replace(urls, "https://www.googleapis.com/", "https://www.googleapis.com/upload/", 1)
3449		c.urlParams_.Set("uploadType", c.mediaInfo_.UploadType())
3450	}
3451	if body == nil {
3452		body = new(bytes.Buffer)
3453		reqHeaders.Set("Content-Type", "application/json")
3454	}
3455	body, getBody, cleanup := c.mediaInfo_.UploadRequest(reqHeaders, body)
3456	defer cleanup()
3457	urls += "?" + c.urlParams_.Encode()
3458	req, err := http.NewRequest("POST", urls, body)
3459	if err != nil {
3460		return nil, err
3461	}
3462	req.Header = reqHeaders
3463	req.GetBody = getBody
3464	googleapi.Expand(req.URL, map[string]string{
3465		"userId": c.userId,
3466	})
3467	return gensupport.SendRequest(c.ctx_, c.s.client, req)
3468}
3469
3470// Do executes the "gmail.users.drafts.send" call.
3471// Exactly one of *Message or error will be non-nil. Any non-2xx status
3472// code is an error. Response headers are in either
3473// *Message.ServerResponse.Header or (if a response was returned at all)
3474// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
3475// check whether the returned error was because http.StatusNotModified
3476// was returned.
3477func (c *UsersDraftsSendCall) Do(opts ...googleapi.CallOption) (*Message, error) {
3478	gensupport.SetOptions(c.urlParams_, opts...)
3479	res, err := c.doRequest("json")
3480	if res != nil && res.StatusCode == http.StatusNotModified {
3481		if res.Body != nil {
3482			res.Body.Close()
3483		}
3484		return nil, &googleapi.Error{
3485			Code:   res.StatusCode,
3486			Header: res.Header,
3487		}
3488	}
3489	if err != nil {
3490		return nil, err
3491	}
3492	defer googleapi.CloseBody(res)
3493	if err := googleapi.CheckResponse(res); err != nil {
3494		return nil, err
3495	}
3496	rx := c.mediaInfo_.ResumableUpload(res.Header.Get("Location"))
3497	if rx != nil {
3498		rx.Client = c.s.client
3499		rx.UserAgent = c.s.userAgent()
3500		ctx := c.ctx_
3501		if ctx == nil {
3502			ctx = context.TODO()
3503		}
3504		res, err = rx.Upload(ctx)
3505		if err != nil {
3506			return nil, err
3507		}
3508		defer res.Body.Close()
3509		if err := googleapi.CheckResponse(res); err != nil {
3510			return nil, err
3511		}
3512	}
3513	ret := &Message{
3514		ServerResponse: googleapi.ServerResponse{
3515			Header:         res.Header,
3516			HTTPStatusCode: res.StatusCode,
3517		},
3518	}
3519	target := &ret
3520	if err := gensupport.DecodeResponse(target, res); err != nil {
3521		return nil, err
3522	}
3523	return ret, nil
3524	// {
3525	//   "description": "Sends the specified, existing draft to the recipients in the To, Cc, and Bcc headers.",
3526	//   "httpMethod": "POST",
3527	//   "id": "gmail.users.drafts.send",
3528	//   "mediaUpload": {
3529	//     "accept": [
3530	//       "message/rfc822"
3531	//     ],
3532	//     "maxSize": "35MB",
3533	//     "protocols": {
3534	//       "resumable": {
3535	//         "multipart": true,
3536	//         "path": "/resumable/upload/gmail/v1/users/{userId}/drafts/send"
3537	//       },
3538	//       "simple": {
3539	//         "multipart": true,
3540	//         "path": "/upload/gmail/v1/users/{userId}/drafts/send"
3541	//       }
3542	//     }
3543	//   },
3544	//   "parameterOrder": [
3545	//     "userId"
3546	//   ],
3547	//   "parameters": {
3548	//     "userId": {
3549	//       "default": "me",
3550	//       "description": "The user's email address. The special value me can be used to indicate the authenticated user.",
3551	//       "location": "path",
3552	//       "required": true,
3553	//       "type": "string"
3554	//     }
3555	//   },
3556	//   "path": "{userId}/drafts/send",
3557	//   "request": {
3558	//     "$ref": "Draft"
3559	//   },
3560	//   "response": {
3561	//     "$ref": "Message"
3562	//   },
3563	//   "scopes": [
3564	//     "https://mail.google.com/",
3565	//     "https://www.googleapis.com/auth/gmail.compose",
3566	//     "https://www.googleapis.com/auth/gmail.modify"
3567	//   ],
3568	//   "supportsMediaUpload": true
3569	// }
3570
3571}
3572
3573// method id "gmail.users.drafts.update":
3574
3575type UsersDraftsUpdateCall struct {
3576	s          *Service
3577	userId     string
3578	id         string
3579	draft      *Draft
3580	urlParams_ gensupport.URLParams
3581	mediaInfo_ *gensupport.MediaInfo
3582	ctx_       context.Context
3583	header_    http.Header
3584}
3585
3586// Update: Replaces a draft's content.
3587func (r *UsersDraftsService) Update(userId string, id string, draft *Draft) *UsersDraftsUpdateCall {
3588	c := &UsersDraftsUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
3589	c.userId = userId
3590	c.id = id
3591	c.draft = draft
3592	return c
3593}
3594
3595// Media specifies the media to upload in one or more chunks. The chunk
3596// size may be controlled by supplying a MediaOption generated by
3597// googleapi.ChunkSize. The chunk size defaults to
3598// googleapi.DefaultUploadChunkSize.The Content-Type header used in the
3599// upload request will be determined by sniffing the contents of r,
3600// unless a MediaOption generated by googleapi.ContentType is
3601// supplied.
3602// At most one of Media and ResumableMedia may be set.
3603func (c *UsersDraftsUpdateCall) Media(r io.Reader, options ...googleapi.MediaOption) *UsersDraftsUpdateCall {
3604	c.mediaInfo_ = gensupport.NewInfoFromMedia(r, options)
3605	return c
3606}
3607
3608// ResumableMedia specifies the media to upload in chunks and can be
3609// canceled with ctx.
3610//
3611// Deprecated: use Media instead.
3612//
3613// At most one of Media and ResumableMedia may be set. mediaType
3614// identifies the MIME media type of the upload, such as "image/png". If
3615// mediaType is "", it will be auto-detected. The provided ctx will
3616// supersede any context previously provided to the Context method.
3617func (c *UsersDraftsUpdateCall) ResumableMedia(ctx context.Context, r io.ReaderAt, size int64, mediaType string) *UsersDraftsUpdateCall {
3618	c.ctx_ = ctx
3619	c.mediaInfo_ = gensupport.NewInfoFromResumableMedia(r, size, mediaType)
3620	return c
3621}
3622
3623// ProgressUpdater provides a callback function that will be called
3624// after every chunk. It should be a low-latency function in order to
3625// not slow down the upload operation. This should only be called when
3626// using ResumableMedia (as opposed to Media).
3627func (c *UsersDraftsUpdateCall) ProgressUpdater(pu googleapi.ProgressUpdater) *UsersDraftsUpdateCall {
3628	c.mediaInfo_.SetProgressUpdater(pu)
3629	return c
3630}
3631
3632// Fields allows partial responses to be retrieved. See
3633// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
3634// for more information.
3635func (c *UsersDraftsUpdateCall) Fields(s ...googleapi.Field) *UsersDraftsUpdateCall {
3636	c.urlParams_.Set("fields", googleapi.CombineFields(s))
3637	return c
3638}
3639
3640// Context sets the context to be used in this call's Do method. Any
3641// pending HTTP request will be aborted if the provided context is
3642// canceled.
3643// This context will supersede any context previously provided to the
3644// ResumableMedia method.
3645func (c *UsersDraftsUpdateCall) Context(ctx context.Context) *UsersDraftsUpdateCall {
3646	c.ctx_ = ctx
3647	return c
3648}
3649
3650// Header returns an http.Header that can be modified by the caller to
3651// add HTTP headers to the request.
3652func (c *UsersDraftsUpdateCall) Header() http.Header {
3653	if c.header_ == nil {
3654		c.header_ = make(http.Header)
3655	}
3656	return c.header_
3657}
3658
3659func (c *UsersDraftsUpdateCall) doRequest(alt string) (*http.Response, error) {
3660	reqHeaders := make(http.Header)
3661	for k, v := range c.header_ {
3662		reqHeaders[k] = v
3663	}
3664	reqHeaders.Set("User-Agent", c.s.userAgent())
3665	var body io.Reader = nil
3666	body, err := googleapi.WithoutDataWrapper.JSONReader(c.draft)
3667	if err != nil {
3668		return nil, err
3669	}
3670	reqHeaders.Set("Content-Type", "application/json")
3671	c.urlParams_.Set("alt", alt)
3672	c.urlParams_.Set("prettyPrint", "false")
3673	urls := googleapi.ResolveRelative(c.s.BasePath, "{userId}/drafts/{id}")
3674	if c.mediaInfo_ != nil {
3675		urls = strings.Replace(urls, "https://www.googleapis.com/", "https://www.googleapis.com/upload/", 1)
3676		c.urlParams_.Set("uploadType", c.mediaInfo_.UploadType())
3677	}
3678	if body == nil {
3679		body = new(bytes.Buffer)
3680		reqHeaders.Set("Content-Type", "application/json")
3681	}
3682	body, getBody, cleanup := c.mediaInfo_.UploadRequest(reqHeaders, body)
3683	defer cleanup()
3684	urls += "?" + c.urlParams_.Encode()
3685	req, err := http.NewRequest("PUT", urls, body)
3686	if err != nil {
3687		return nil, err
3688	}
3689	req.Header = reqHeaders
3690	req.GetBody = getBody
3691	googleapi.Expand(req.URL, map[string]string{
3692		"userId": c.userId,
3693		"id":     c.id,
3694	})
3695	return gensupport.SendRequest(c.ctx_, c.s.client, req)
3696}
3697
3698// Do executes the "gmail.users.drafts.update" call.
3699// Exactly one of *Draft or error will be non-nil. Any non-2xx status
3700// code is an error. Response headers are in either
3701// *Draft.ServerResponse.Header or (if a response was returned at all)
3702// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
3703// check whether the returned error was because http.StatusNotModified
3704// was returned.
3705func (c *UsersDraftsUpdateCall) Do(opts ...googleapi.CallOption) (*Draft, error) {
3706	gensupport.SetOptions(c.urlParams_, opts...)
3707	res, err := c.doRequest("json")
3708	if res != nil && res.StatusCode == http.StatusNotModified {
3709		if res.Body != nil {
3710			res.Body.Close()
3711		}
3712		return nil, &googleapi.Error{
3713			Code:   res.StatusCode,
3714			Header: res.Header,
3715		}
3716	}
3717	if err != nil {
3718		return nil, err
3719	}
3720	defer googleapi.CloseBody(res)
3721	if err := googleapi.CheckResponse(res); err != nil {
3722		return nil, err
3723	}
3724	rx := c.mediaInfo_.ResumableUpload(res.Header.Get("Location"))
3725	if rx != nil {
3726		rx.Client = c.s.client
3727		rx.UserAgent = c.s.userAgent()
3728		ctx := c.ctx_
3729		if ctx == nil {
3730			ctx = context.TODO()
3731		}
3732		res, err = rx.Upload(ctx)
3733		if err != nil {
3734			return nil, err
3735		}
3736		defer res.Body.Close()
3737		if err := googleapi.CheckResponse(res); err != nil {
3738			return nil, err
3739		}
3740	}
3741	ret := &Draft{
3742		ServerResponse: googleapi.ServerResponse{
3743			Header:         res.Header,
3744			HTTPStatusCode: res.StatusCode,
3745		},
3746	}
3747	target := &ret
3748	if err := gensupport.DecodeResponse(target, res); err != nil {
3749		return nil, err
3750	}
3751	return ret, nil
3752	// {
3753	//   "description": "Replaces a draft's content.",
3754	//   "httpMethod": "PUT",
3755	//   "id": "gmail.users.drafts.update",
3756	//   "mediaUpload": {
3757	//     "accept": [
3758	//       "message/rfc822"
3759	//     ],
3760	//     "maxSize": "35MB",
3761	//     "protocols": {
3762	//       "resumable": {
3763	//         "multipart": true,
3764	//         "path": "/resumable/upload/gmail/v1/users/{userId}/drafts/{id}"
3765	//       },
3766	//       "simple": {
3767	//         "multipart": true,
3768	//         "path": "/upload/gmail/v1/users/{userId}/drafts/{id}"
3769	//       }
3770	//     }
3771	//   },
3772	//   "parameterOrder": [
3773	//     "userId",
3774	//     "id"
3775	//   ],
3776	//   "parameters": {
3777	//     "id": {
3778	//       "description": "The ID of the draft to update.",
3779	//       "location": "path",
3780	//       "required": true,
3781	//       "type": "string"
3782	//     },
3783	//     "userId": {
3784	//       "default": "me",
3785	//       "description": "The user's email address. The special value me can be used to indicate the authenticated user.",
3786	//       "location": "path",
3787	//       "required": true,
3788	//       "type": "string"
3789	//     }
3790	//   },
3791	//   "path": "{userId}/drafts/{id}",
3792	//   "request": {
3793	//     "$ref": "Draft"
3794	//   },
3795	//   "response": {
3796	//     "$ref": "Draft"
3797	//   },
3798	//   "scopes": [
3799	//     "https://mail.google.com/",
3800	//     "https://www.googleapis.com/auth/gmail.compose",
3801	//     "https://www.googleapis.com/auth/gmail.modify"
3802	//   ],
3803	//   "supportsMediaUpload": true
3804	// }
3805
3806}
3807
3808// method id "gmail.users.history.list":
3809
3810type UsersHistoryListCall struct {
3811	s            *Service
3812	userId       string
3813	urlParams_   gensupport.URLParams
3814	ifNoneMatch_ string
3815	ctx_         context.Context
3816	header_      http.Header
3817}
3818
3819// List: Lists the history of all changes to the given mailbox. History
3820// results are returned in chronological order (increasing historyId).
3821func (r *UsersHistoryService) List(userId string) *UsersHistoryListCall {
3822	c := &UsersHistoryListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
3823	c.userId = userId
3824	return c
3825}
3826
3827// HistoryTypes sets the optional parameter "historyTypes": History
3828// types to be returned by the function
3829//
3830// Possible values:
3831//   "labelAdded"
3832//   "labelRemoved"
3833//   "messageAdded"
3834//   "messageDeleted"
3835func (c *UsersHistoryListCall) HistoryTypes(historyTypes ...string) *UsersHistoryListCall {
3836	c.urlParams_.SetMulti("historyTypes", append([]string{}, historyTypes...))
3837	return c
3838}
3839
3840// LabelId sets the optional parameter "labelId": Only return messages
3841// with a label matching the ID.
3842func (c *UsersHistoryListCall) LabelId(labelId string) *UsersHistoryListCall {
3843	c.urlParams_.Set("labelId", labelId)
3844	return c
3845}
3846
3847// MaxResults sets the optional parameter "maxResults": The maximum
3848// number of history records to return.
3849func (c *UsersHistoryListCall) MaxResults(maxResults int64) *UsersHistoryListCall {
3850	c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
3851	return c
3852}
3853
3854// PageToken sets the optional parameter "pageToken": Page token to
3855// retrieve a specific page of results in the list.
3856func (c *UsersHistoryListCall) PageToken(pageToken string) *UsersHistoryListCall {
3857	c.urlParams_.Set("pageToken", pageToken)
3858	return c
3859}
3860
3861// StartHistoryId sets the optional parameter "startHistoryId":
3862// Required. Returns history records after the specified startHistoryId.
3863// The supplied startHistoryId should be obtained from the historyId of
3864// a message, thread, or previous list response. History IDs increase
3865// chronologically but are not contiguous with random gaps in between
3866// valid IDs. Supplying an invalid or out of date startHistoryId
3867// typically returns an HTTP 404 error code. A historyId is typically
3868// valid for at least a week, but in some rare circumstances may be
3869// valid for only a few hours. If you receive an HTTP 404 error
3870// response, your application should perform a full sync. If you receive
3871// no nextPageToken in the response, there are no updates to retrieve
3872// and you can store the returned historyId for a future request.
3873func (c *UsersHistoryListCall) StartHistoryId(startHistoryId uint64) *UsersHistoryListCall {
3874	c.urlParams_.Set("startHistoryId", fmt.Sprint(startHistoryId))
3875	return c
3876}
3877
3878// Fields allows partial responses to be retrieved. See
3879// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
3880// for more information.
3881func (c *UsersHistoryListCall) Fields(s ...googleapi.Field) *UsersHistoryListCall {
3882	c.urlParams_.Set("fields", googleapi.CombineFields(s))
3883	return c
3884}
3885
3886// IfNoneMatch sets the optional parameter which makes the operation
3887// fail if the object's ETag matches the given value. This is useful for
3888// getting updates only after the object has changed since the last
3889// request. Use googleapi.IsNotModified to check whether the response
3890// error from Do is the result of In-None-Match.
3891func (c *UsersHistoryListCall) IfNoneMatch(entityTag string) *UsersHistoryListCall {
3892	c.ifNoneMatch_ = entityTag
3893	return c
3894}
3895
3896// Context sets the context to be used in this call's Do method. Any
3897// pending HTTP request will be aborted if the provided context is
3898// canceled.
3899func (c *UsersHistoryListCall) Context(ctx context.Context) *UsersHistoryListCall {
3900	c.ctx_ = ctx
3901	return c
3902}
3903
3904// Header returns an http.Header that can be modified by the caller to
3905// add HTTP headers to the request.
3906func (c *UsersHistoryListCall) Header() http.Header {
3907	if c.header_ == nil {
3908		c.header_ = make(http.Header)
3909	}
3910	return c.header_
3911}
3912
3913func (c *UsersHistoryListCall) doRequest(alt string) (*http.Response, error) {
3914	reqHeaders := make(http.Header)
3915	for k, v := range c.header_ {
3916		reqHeaders[k] = v
3917	}
3918	reqHeaders.Set("User-Agent", c.s.userAgent())
3919	if c.ifNoneMatch_ != "" {
3920		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
3921	}
3922	var body io.Reader = nil
3923	c.urlParams_.Set("alt", alt)
3924	c.urlParams_.Set("prettyPrint", "false")
3925	urls := googleapi.ResolveRelative(c.s.BasePath, "{userId}/history")
3926	urls += "?" + c.urlParams_.Encode()
3927	req, err := http.NewRequest("GET", urls, body)
3928	if err != nil {
3929		return nil, err
3930	}
3931	req.Header = reqHeaders
3932	googleapi.Expand(req.URL, map[string]string{
3933		"userId": c.userId,
3934	})
3935	return gensupport.SendRequest(c.ctx_, c.s.client, req)
3936}
3937
3938// Do executes the "gmail.users.history.list" call.
3939// Exactly one of *ListHistoryResponse or error will be non-nil. Any
3940// non-2xx status code is an error. Response headers are in either
3941// *ListHistoryResponse.ServerResponse.Header or (if a response was
3942// returned at all) in error.(*googleapi.Error).Header. Use
3943// googleapi.IsNotModified to check whether the returned error was
3944// because http.StatusNotModified was returned.
3945func (c *UsersHistoryListCall) Do(opts ...googleapi.CallOption) (*ListHistoryResponse, error) {
3946	gensupport.SetOptions(c.urlParams_, opts...)
3947	res, err := c.doRequest("json")
3948	if res != nil && res.StatusCode == http.StatusNotModified {
3949		if res.Body != nil {
3950			res.Body.Close()
3951		}
3952		return nil, &googleapi.Error{
3953			Code:   res.StatusCode,
3954			Header: res.Header,
3955		}
3956	}
3957	if err != nil {
3958		return nil, err
3959	}
3960	defer googleapi.CloseBody(res)
3961	if err := googleapi.CheckResponse(res); err != nil {
3962		return nil, err
3963	}
3964	ret := &ListHistoryResponse{
3965		ServerResponse: googleapi.ServerResponse{
3966			Header:         res.Header,
3967			HTTPStatusCode: res.StatusCode,
3968		},
3969	}
3970	target := &ret
3971	if err := gensupport.DecodeResponse(target, res); err != nil {
3972		return nil, err
3973	}
3974	return ret, nil
3975	// {
3976	//   "description": "Lists the history of all changes to the given mailbox. History results are returned in chronological order (increasing historyId).",
3977	//   "httpMethod": "GET",
3978	//   "id": "gmail.users.history.list",
3979	//   "parameterOrder": [
3980	//     "userId"
3981	//   ],
3982	//   "parameters": {
3983	//     "historyTypes": {
3984	//       "description": "History types to be returned by the function",
3985	//       "enum": [
3986	//         "labelAdded",
3987	//         "labelRemoved",
3988	//         "messageAdded",
3989	//         "messageDeleted"
3990	//       ],
3991	//       "enumDescriptions": [
3992	//         "",
3993	//         "",
3994	//         "",
3995	//         ""
3996	//       ],
3997	//       "location": "query",
3998	//       "repeated": true,
3999	//       "type": "string"
4000	//     },
4001	//     "labelId": {
4002	//       "description": "Only return messages with a label matching the ID.",
4003	//       "location": "query",
4004	//       "type": "string"
4005	//     },
4006	//     "maxResults": {
4007	//       "default": "100",
4008	//       "description": "The maximum number of history records to return.",
4009	//       "format": "uint32",
4010	//       "location": "query",
4011	//       "type": "integer"
4012	//     },
4013	//     "pageToken": {
4014	//       "description": "Page token to retrieve a specific page of results in the list.",
4015	//       "location": "query",
4016	//       "type": "string"
4017	//     },
4018	//     "startHistoryId": {
4019	//       "description": "Required. Returns history records after the specified startHistoryId. The supplied startHistoryId should be obtained from the historyId of a message, thread, or previous list response. History IDs increase chronologically but are not contiguous with random gaps in between valid IDs. Supplying an invalid or out of date startHistoryId typically returns an HTTP 404 error code. A historyId is typically valid for at least a week, but in some rare circumstances may be valid for only a few hours. If you receive an HTTP 404 error response, your application should perform a full sync. If you receive no nextPageToken in the response, there are no updates to retrieve and you can store the returned historyId for a future request.",
4020	//       "format": "uint64",
4021	//       "location": "query",
4022	//       "type": "string"
4023	//     },
4024	//     "userId": {
4025	//       "default": "me",
4026	//       "description": "The user's email address. The special value me can be used to indicate the authenticated user.",
4027	//       "location": "path",
4028	//       "required": true,
4029	//       "type": "string"
4030	//     }
4031	//   },
4032	//   "path": "{userId}/history",
4033	//   "response": {
4034	//     "$ref": "ListHistoryResponse"
4035	//   },
4036	//   "scopes": [
4037	//     "https://mail.google.com/",
4038	//     "https://www.googleapis.com/auth/gmail.metadata",
4039	//     "https://www.googleapis.com/auth/gmail.modify",
4040	//     "https://www.googleapis.com/auth/gmail.readonly"
4041	//   ]
4042	// }
4043
4044}
4045
4046// Pages invokes f for each page of results.
4047// A non-nil error returned from f will halt the iteration.
4048// The provided context supersedes any context provided to the Context method.
4049func (c *UsersHistoryListCall) Pages(ctx context.Context, f func(*ListHistoryResponse) error) error {
4050	c.ctx_ = ctx
4051	defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
4052	for {
4053		x, err := c.Do()
4054		if err != nil {
4055			return err
4056		}
4057		if err := f(x); err != nil {
4058			return err
4059		}
4060		if x.NextPageToken == "" {
4061			return nil
4062		}
4063		c.PageToken(x.NextPageToken)
4064	}
4065}
4066
4067// method id "gmail.users.labels.create":
4068
4069type UsersLabelsCreateCall struct {
4070	s          *Service
4071	userId     string
4072	label      *Label
4073	urlParams_ gensupport.URLParams
4074	ctx_       context.Context
4075	header_    http.Header
4076}
4077
4078// Create: Creates a new label.
4079func (r *UsersLabelsService) Create(userId string, label *Label) *UsersLabelsCreateCall {
4080	c := &UsersLabelsCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
4081	c.userId = userId
4082	c.label = label
4083	return c
4084}
4085
4086// Fields allows partial responses to be retrieved. See
4087// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
4088// for more information.
4089func (c *UsersLabelsCreateCall) Fields(s ...googleapi.Field) *UsersLabelsCreateCall {
4090	c.urlParams_.Set("fields", googleapi.CombineFields(s))
4091	return c
4092}
4093
4094// Context sets the context to be used in this call's Do method. Any
4095// pending HTTP request will be aborted if the provided context is
4096// canceled.
4097func (c *UsersLabelsCreateCall) Context(ctx context.Context) *UsersLabelsCreateCall {
4098	c.ctx_ = ctx
4099	return c
4100}
4101
4102// Header returns an http.Header that can be modified by the caller to
4103// add HTTP headers to the request.
4104func (c *UsersLabelsCreateCall) Header() http.Header {
4105	if c.header_ == nil {
4106		c.header_ = make(http.Header)
4107	}
4108	return c.header_
4109}
4110
4111func (c *UsersLabelsCreateCall) doRequest(alt string) (*http.Response, error) {
4112	reqHeaders := make(http.Header)
4113	for k, v := range c.header_ {
4114		reqHeaders[k] = v
4115	}
4116	reqHeaders.Set("User-Agent", c.s.userAgent())
4117	var body io.Reader = nil
4118	body, err := googleapi.WithoutDataWrapper.JSONReader(c.label)
4119	if err != nil {
4120		return nil, err
4121	}
4122	reqHeaders.Set("Content-Type", "application/json")
4123	c.urlParams_.Set("alt", alt)
4124	c.urlParams_.Set("prettyPrint", "false")
4125	urls := googleapi.ResolveRelative(c.s.BasePath, "{userId}/labels")
4126	urls += "?" + c.urlParams_.Encode()
4127	req, err := http.NewRequest("POST", urls, body)
4128	if err != nil {
4129		return nil, err
4130	}
4131	req.Header = reqHeaders
4132	googleapi.Expand(req.URL, map[string]string{
4133		"userId": c.userId,
4134	})
4135	return gensupport.SendRequest(c.ctx_, c.s.client, req)
4136}
4137
4138// Do executes the "gmail.users.labels.create" call.
4139// Exactly one of *Label or error will be non-nil. Any non-2xx status
4140// code is an error. Response headers are in either
4141// *Label.ServerResponse.Header or (if a response was returned at all)
4142// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
4143// check whether the returned error was because http.StatusNotModified
4144// was returned.
4145func (c *UsersLabelsCreateCall) Do(opts ...googleapi.CallOption) (*Label, error) {
4146	gensupport.SetOptions(c.urlParams_, opts...)
4147	res, err := c.doRequest("json")
4148	if res != nil && res.StatusCode == http.StatusNotModified {
4149		if res.Body != nil {
4150			res.Body.Close()
4151		}
4152		return nil, &googleapi.Error{
4153			Code:   res.StatusCode,
4154			Header: res.Header,
4155		}
4156	}
4157	if err != nil {
4158		return nil, err
4159	}
4160	defer googleapi.CloseBody(res)
4161	if err := googleapi.CheckResponse(res); err != nil {
4162		return nil, err
4163	}
4164	ret := &Label{
4165		ServerResponse: googleapi.ServerResponse{
4166			Header:         res.Header,
4167			HTTPStatusCode: res.StatusCode,
4168		},
4169	}
4170	target := &ret
4171	if err := gensupport.DecodeResponse(target, res); err != nil {
4172		return nil, err
4173	}
4174	return ret, nil
4175	// {
4176	//   "description": "Creates a new label.",
4177	//   "httpMethod": "POST",
4178	//   "id": "gmail.users.labels.create",
4179	//   "parameterOrder": [
4180	//     "userId"
4181	//   ],
4182	//   "parameters": {
4183	//     "userId": {
4184	//       "default": "me",
4185	//       "description": "The user's email address. The special value me can be used to indicate the authenticated user.",
4186	//       "location": "path",
4187	//       "required": true,
4188	//       "type": "string"
4189	//     }
4190	//   },
4191	//   "path": "{userId}/labels",
4192	//   "request": {
4193	//     "$ref": "Label"
4194	//   },
4195	//   "response": {
4196	//     "$ref": "Label"
4197	//   },
4198	//   "scopes": [
4199	//     "https://mail.google.com/",
4200	//     "https://www.googleapis.com/auth/gmail.labels",
4201	//     "https://www.googleapis.com/auth/gmail.modify"
4202	//   ]
4203	// }
4204
4205}
4206
4207// method id "gmail.users.labels.delete":
4208
4209type UsersLabelsDeleteCall struct {
4210	s          *Service
4211	userId     string
4212	id         string
4213	urlParams_ gensupport.URLParams
4214	ctx_       context.Context
4215	header_    http.Header
4216}
4217
4218// Delete: Immediately and permanently deletes the specified label and
4219// removes it from any messages and threads that it is applied to.
4220func (r *UsersLabelsService) Delete(userId string, id string) *UsersLabelsDeleteCall {
4221	c := &UsersLabelsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
4222	c.userId = userId
4223	c.id = id
4224	return c
4225}
4226
4227// Fields allows partial responses to be retrieved. See
4228// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
4229// for more information.
4230func (c *UsersLabelsDeleteCall) Fields(s ...googleapi.Field) *UsersLabelsDeleteCall {
4231	c.urlParams_.Set("fields", googleapi.CombineFields(s))
4232	return c
4233}
4234
4235// Context sets the context to be used in this call's Do method. Any
4236// pending HTTP request will be aborted if the provided context is
4237// canceled.
4238func (c *UsersLabelsDeleteCall) Context(ctx context.Context) *UsersLabelsDeleteCall {
4239	c.ctx_ = ctx
4240	return c
4241}
4242
4243// Header returns an http.Header that can be modified by the caller to
4244// add HTTP headers to the request.
4245func (c *UsersLabelsDeleteCall) Header() http.Header {
4246	if c.header_ == nil {
4247		c.header_ = make(http.Header)
4248	}
4249	return c.header_
4250}
4251
4252func (c *UsersLabelsDeleteCall) doRequest(alt string) (*http.Response, error) {
4253	reqHeaders := make(http.Header)
4254	for k, v := range c.header_ {
4255		reqHeaders[k] = v
4256	}
4257	reqHeaders.Set("User-Agent", c.s.userAgent())
4258	var body io.Reader = nil
4259	c.urlParams_.Set("alt", alt)
4260	c.urlParams_.Set("prettyPrint", "false")
4261	urls := googleapi.ResolveRelative(c.s.BasePath, "{userId}/labels/{id}")
4262	urls += "?" + c.urlParams_.Encode()
4263	req, err := http.NewRequest("DELETE", urls, body)
4264	if err != nil {
4265		return nil, err
4266	}
4267	req.Header = reqHeaders
4268	googleapi.Expand(req.URL, map[string]string{
4269		"userId": c.userId,
4270		"id":     c.id,
4271	})
4272	return gensupport.SendRequest(c.ctx_, c.s.client, req)
4273}
4274
4275// Do executes the "gmail.users.labels.delete" call.
4276func (c *UsersLabelsDeleteCall) Do(opts ...googleapi.CallOption) error {
4277	gensupport.SetOptions(c.urlParams_, opts...)
4278	res, err := c.doRequest("json")
4279	if err != nil {
4280		return err
4281	}
4282	defer googleapi.CloseBody(res)
4283	if err := googleapi.CheckResponse(res); err != nil {
4284		return err
4285	}
4286	return nil
4287	// {
4288	//   "description": "Immediately and permanently deletes the specified label and removes it from any messages and threads that it is applied to.",
4289	//   "httpMethod": "DELETE",
4290	//   "id": "gmail.users.labels.delete",
4291	//   "parameterOrder": [
4292	//     "userId",
4293	//     "id"
4294	//   ],
4295	//   "parameters": {
4296	//     "id": {
4297	//       "description": "The ID of the label to delete.",
4298	//       "location": "path",
4299	//       "required": true,
4300	//       "type": "string"
4301	//     },
4302	//     "userId": {
4303	//       "default": "me",
4304	//       "description": "The user's email address. The special value me can be used to indicate the authenticated user.",
4305	//       "location": "path",
4306	//       "required": true,
4307	//       "type": "string"
4308	//     }
4309	//   },
4310	//   "path": "{userId}/labels/{id}",
4311	//   "scopes": [
4312	//     "https://mail.google.com/",
4313	//     "https://www.googleapis.com/auth/gmail.labels",
4314	//     "https://www.googleapis.com/auth/gmail.modify"
4315	//   ]
4316	// }
4317
4318}
4319
4320// method id "gmail.users.labels.get":
4321
4322type UsersLabelsGetCall struct {
4323	s            *Service
4324	userId       string
4325	id           string
4326	urlParams_   gensupport.URLParams
4327	ifNoneMatch_ string
4328	ctx_         context.Context
4329	header_      http.Header
4330}
4331
4332// Get: Gets the specified label.
4333func (r *UsersLabelsService) Get(userId string, id string) *UsersLabelsGetCall {
4334	c := &UsersLabelsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
4335	c.userId = userId
4336	c.id = id
4337	return c
4338}
4339
4340// Fields allows partial responses to be retrieved. See
4341// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
4342// for more information.
4343func (c *UsersLabelsGetCall) Fields(s ...googleapi.Field) *UsersLabelsGetCall {
4344	c.urlParams_.Set("fields", googleapi.CombineFields(s))
4345	return c
4346}
4347
4348// IfNoneMatch sets the optional parameter which makes the operation
4349// fail if the object's ETag matches the given value. This is useful for
4350// getting updates only after the object has changed since the last
4351// request. Use googleapi.IsNotModified to check whether the response
4352// error from Do is the result of In-None-Match.
4353func (c *UsersLabelsGetCall) IfNoneMatch(entityTag string) *UsersLabelsGetCall {
4354	c.ifNoneMatch_ = entityTag
4355	return c
4356}
4357
4358// Context sets the context to be used in this call's Do method. Any
4359// pending HTTP request will be aborted if the provided context is
4360// canceled.
4361func (c *UsersLabelsGetCall) Context(ctx context.Context) *UsersLabelsGetCall {
4362	c.ctx_ = ctx
4363	return c
4364}
4365
4366// Header returns an http.Header that can be modified by the caller to
4367// add HTTP headers to the request.
4368func (c *UsersLabelsGetCall) Header() http.Header {
4369	if c.header_ == nil {
4370		c.header_ = make(http.Header)
4371	}
4372	return c.header_
4373}
4374
4375func (c *UsersLabelsGetCall) doRequest(alt string) (*http.Response, error) {
4376	reqHeaders := make(http.Header)
4377	for k, v := range c.header_ {
4378		reqHeaders[k] = v
4379	}
4380	reqHeaders.Set("User-Agent", c.s.userAgent())
4381	if c.ifNoneMatch_ != "" {
4382		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
4383	}
4384	var body io.Reader = nil
4385	c.urlParams_.Set("alt", alt)
4386	c.urlParams_.Set("prettyPrint", "false")
4387	urls := googleapi.ResolveRelative(c.s.BasePath, "{userId}/labels/{id}")
4388	urls += "?" + c.urlParams_.Encode()
4389	req, err := http.NewRequest("GET", urls, body)
4390	if err != nil {
4391		return nil, err
4392	}
4393	req.Header = reqHeaders
4394	googleapi.Expand(req.URL, map[string]string{
4395		"userId": c.userId,
4396		"id":     c.id,
4397	})
4398	return gensupport.SendRequest(c.ctx_, c.s.client, req)
4399}
4400
4401// Do executes the "gmail.users.labels.get" call.
4402// Exactly one of *Label or error will be non-nil. Any non-2xx status
4403// code is an error. Response headers are in either
4404// *Label.ServerResponse.Header or (if a response was returned at all)
4405// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
4406// check whether the returned error was because http.StatusNotModified
4407// was returned.
4408func (c *UsersLabelsGetCall) Do(opts ...googleapi.CallOption) (*Label, error) {
4409	gensupport.SetOptions(c.urlParams_, opts...)
4410	res, err := c.doRequest("json")
4411	if res != nil && res.StatusCode == http.StatusNotModified {
4412		if res.Body != nil {
4413			res.Body.Close()
4414		}
4415		return nil, &googleapi.Error{
4416			Code:   res.StatusCode,
4417			Header: res.Header,
4418		}
4419	}
4420	if err != nil {
4421		return nil, err
4422	}
4423	defer googleapi.CloseBody(res)
4424	if err := googleapi.CheckResponse(res); err != nil {
4425		return nil, err
4426	}
4427	ret := &Label{
4428		ServerResponse: googleapi.ServerResponse{
4429			Header:         res.Header,
4430			HTTPStatusCode: res.StatusCode,
4431		},
4432	}
4433	target := &ret
4434	if err := gensupport.DecodeResponse(target, res); err != nil {
4435		return nil, err
4436	}
4437	return ret, nil
4438	// {
4439	//   "description": "Gets the specified label.",
4440	//   "httpMethod": "GET",
4441	//   "id": "gmail.users.labels.get",
4442	//   "parameterOrder": [
4443	//     "userId",
4444	//     "id"
4445	//   ],
4446	//   "parameters": {
4447	//     "id": {
4448	//       "description": "The ID of the label to retrieve.",
4449	//       "location": "path",
4450	//       "required": true,
4451	//       "type": "string"
4452	//     },
4453	//     "userId": {
4454	//       "default": "me",
4455	//       "description": "The user's email address. The special value me can be used to indicate the authenticated user.",
4456	//       "location": "path",
4457	//       "required": true,
4458	//       "type": "string"
4459	//     }
4460	//   },
4461	//   "path": "{userId}/labels/{id}",
4462	//   "response": {
4463	//     "$ref": "Label"
4464	//   },
4465	//   "scopes": [
4466	//     "https://mail.google.com/",
4467	//     "https://www.googleapis.com/auth/gmail.labels",
4468	//     "https://www.googleapis.com/auth/gmail.metadata",
4469	//     "https://www.googleapis.com/auth/gmail.modify",
4470	//     "https://www.googleapis.com/auth/gmail.readonly"
4471	//   ]
4472	// }
4473
4474}
4475
4476// method id "gmail.users.labels.list":
4477
4478type UsersLabelsListCall struct {
4479	s            *Service
4480	userId       string
4481	urlParams_   gensupport.URLParams
4482	ifNoneMatch_ string
4483	ctx_         context.Context
4484	header_      http.Header
4485}
4486
4487// List: Lists all labels in the user's mailbox.
4488func (r *UsersLabelsService) List(userId string) *UsersLabelsListCall {
4489	c := &UsersLabelsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
4490	c.userId = userId
4491	return c
4492}
4493
4494// Fields allows partial responses to be retrieved. See
4495// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
4496// for more information.
4497func (c *UsersLabelsListCall) Fields(s ...googleapi.Field) *UsersLabelsListCall {
4498	c.urlParams_.Set("fields", googleapi.CombineFields(s))
4499	return c
4500}
4501
4502// IfNoneMatch sets the optional parameter which makes the operation
4503// fail if the object's ETag matches the given value. This is useful for
4504// getting updates only after the object has changed since the last
4505// request. Use googleapi.IsNotModified to check whether the response
4506// error from Do is the result of In-None-Match.
4507func (c *UsersLabelsListCall) IfNoneMatch(entityTag string) *UsersLabelsListCall {
4508	c.ifNoneMatch_ = entityTag
4509	return c
4510}
4511
4512// Context sets the context to be used in this call's Do method. Any
4513// pending HTTP request will be aborted if the provided context is
4514// canceled.
4515func (c *UsersLabelsListCall) Context(ctx context.Context) *UsersLabelsListCall {
4516	c.ctx_ = ctx
4517	return c
4518}
4519
4520// Header returns an http.Header that can be modified by the caller to
4521// add HTTP headers to the request.
4522func (c *UsersLabelsListCall) Header() http.Header {
4523	if c.header_ == nil {
4524		c.header_ = make(http.Header)
4525	}
4526	return c.header_
4527}
4528
4529func (c *UsersLabelsListCall) doRequest(alt string) (*http.Response, error) {
4530	reqHeaders := make(http.Header)
4531	for k, v := range c.header_ {
4532		reqHeaders[k] = v
4533	}
4534	reqHeaders.Set("User-Agent", c.s.userAgent())
4535	if c.ifNoneMatch_ != "" {
4536		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
4537	}
4538	var body io.Reader = nil
4539	c.urlParams_.Set("alt", alt)
4540	c.urlParams_.Set("prettyPrint", "false")
4541	urls := googleapi.ResolveRelative(c.s.BasePath, "{userId}/labels")
4542	urls += "?" + c.urlParams_.Encode()
4543	req, err := http.NewRequest("GET", urls, body)
4544	if err != nil {
4545		return nil, err
4546	}
4547	req.Header = reqHeaders
4548	googleapi.Expand(req.URL, map[string]string{
4549		"userId": c.userId,
4550	})
4551	return gensupport.SendRequest(c.ctx_, c.s.client, req)
4552}
4553
4554// Do executes the "gmail.users.labels.list" call.
4555// Exactly one of *ListLabelsResponse or error will be non-nil. Any
4556// non-2xx status code is an error. Response headers are in either
4557// *ListLabelsResponse.ServerResponse.Header or (if a response was
4558// returned at all) in error.(*googleapi.Error).Header. Use
4559// googleapi.IsNotModified to check whether the returned error was
4560// because http.StatusNotModified was returned.
4561func (c *UsersLabelsListCall) Do(opts ...googleapi.CallOption) (*ListLabelsResponse, error) {
4562	gensupport.SetOptions(c.urlParams_, opts...)
4563	res, err := c.doRequest("json")
4564	if res != nil && res.StatusCode == http.StatusNotModified {
4565		if res.Body != nil {
4566			res.Body.Close()
4567		}
4568		return nil, &googleapi.Error{
4569			Code:   res.StatusCode,
4570			Header: res.Header,
4571		}
4572	}
4573	if err != nil {
4574		return nil, err
4575	}
4576	defer googleapi.CloseBody(res)
4577	if err := googleapi.CheckResponse(res); err != nil {
4578		return nil, err
4579	}
4580	ret := &ListLabelsResponse{
4581		ServerResponse: googleapi.ServerResponse{
4582			Header:         res.Header,
4583			HTTPStatusCode: res.StatusCode,
4584		},
4585	}
4586	target := &ret
4587	if err := gensupport.DecodeResponse(target, res); err != nil {
4588		return nil, err
4589	}
4590	return ret, nil
4591	// {
4592	//   "description": "Lists all labels in the user's mailbox.",
4593	//   "httpMethod": "GET",
4594	//   "id": "gmail.users.labels.list",
4595	//   "parameterOrder": [
4596	//     "userId"
4597	//   ],
4598	//   "parameters": {
4599	//     "userId": {
4600	//       "default": "me",
4601	//       "description": "The user's email address. The special value me can be used to indicate the authenticated user.",
4602	//       "location": "path",
4603	//       "required": true,
4604	//       "type": "string"
4605	//     }
4606	//   },
4607	//   "path": "{userId}/labels",
4608	//   "response": {
4609	//     "$ref": "ListLabelsResponse"
4610	//   },
4611	//   "scopes": [
4612	//     "https://mail.google.com/",
4613	//     "https://www.googleapis.com/auth/gmail.labels",
4614	//     "https://www.googleapis.com/auth/gmail.metadata",
4615	//     "https://www.googleapis.com/auth/gmail.modify",
4616	//     "https://www.googleapis.com/auth/gmail.readonly"
4617	//   ]
4618	// }
4619
4620}
4621
4622// method id "gmail.users.labels.patch":
4623
4624type UsersLabelsPatchCall struct {
4625	s          *Service
4626	userId     string
4627	id         string
4628	label      *Label
4629	urlParams_ gensupport.URLParams
4630	ctx_       context.Context
4631	header_    http.Header
4632}
4633
4634// Patch: Updates the specified label. This method supports patch
4635// semantics.
4636func (r *UsersLabelsService) Patch(userId string, id string, label *Label) *UsersLabelsPatchCall {
4637	c := &UsersLabelsPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
4638	c.userId = userId
4639	c.id = id
4640	c.label = label
4641	return c
4642}
4643
4644// Fields allows partial responses to be retrieved. See
4645// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
4646// for more information.
4647func (c *UsersLabelsPatchCall) Fields(s ...googleapi.Field) *UsersLabelsPatchCall {
4648	c.urlParams_.Set("fields", googleapi.CombineFields(s))
4649	return c
4650}
4651
4652// Context sets the context to be used in this call's Do method. Any
4653// pending HTTP request will be aborted if the provided context is
4654// canceled.
4655func (c *UsersLabelsPatchCall) Context(ctx context.Context) *UsersLabelsPatchCall {
4656	c.ctx_ = ctx
4657	return c
4658}
4659
4660// Header returns an http.Header that can be modified by the caller to
4661// add HTTP headers to the request.
4662func (c *UsersLabelsPatchCall) Header() http.Header {
4663	if c.header_ == nil {
4664		c.header_ = make(http.Header)
4665	}
4666	return c.header_
4667}
4668
4669func (c *UsersLabelsPatchCall) doRequest(alt string) (*http.Response, error) {
4670	reqHeaders := make(http.Header)
4671	for k, v := range c.header_ {
4672		reqHeaders[k] = v
4673	}
4674	reqHeaders.Set("User-Agent", c.s.userAgent())
4675	var body io.Reader = nil
4676	body, err := googleapi.WithoutDataWrapper.JSONReader(c.label)
4677	if err != nil {
4678		return nil, err
4679	}
4680	reqHeaders.Set("Content-Type", "application/json")
4681	c.urlParams_.Set("alt", alt)
4682	c.urlParams_.Set("prettyPrint", "false")
4683	urls := googleapi.ResolveRelative(c.s.BasePath, "{userId}/labels/{id}")
4684	urls += "?" + c.urlParams_.Encode()
4685	req, err := http.NewRequest("PATCH", urls, body)
4686	if err != nil {
4687		return nil, err
4688	}
4689	req.Header = reqHeaders
4690	googleapi.Expand(req.URL, map[string]string{
4691		"userId": c.userId,
4692		"id":     c.id,
4693	})
4694	return gensupport.SendRequest(c.ctx_, c.s.client, req)
4695}
4696
4697// Do executes the "gmail.users.labels.patch" call.
4698// Exactly one of *Label or error will be non-nil. Any non-2xx status
4699// code is an error. Response headers are in either
4700// *Label.ServerResponse.Header or (if a response was returned at all)
4701// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
4702// check whether the returned error was because http.StatusNotModified
4703// was returned.
4704func (c *UsersLabelsPatchCall) Do(opts ...googleapi.CallOption) (*Label, error) {
4705	gensupport.SetOptions(c.urlParams_, opts...)
4706	res, err := c.doRequest("json")
4707	if res != nil && res.StatusCode == http.StatusNotModified {
4708		if res.Body != nil {
4709			res.Body.Close()
4710		}
4711		return nil, &googleapi.Error{
4712			Code:   res.StatusCode,
4713			Header: res.Header,
4714		}
4715	}
4716	if err != nil {
4717		return nil, err
4718	}
4719	defer googleapi.CloseBody(res)
4720	if err := googleapi.CheckResponse(res); err != nil {
4721		return nil, err
4722	}
4723	ret := &Label{
4724		ServerResponse: googleapi.ServerResponse{
4725			Header:         res.Header,
4726			HTTPStatusCode: res.StatusCode,
4727		},
4728	}
4729	target := &ret
4730	if err := gensupport.DecodeResponse(target, res); err != nil {
4731		return nil, err
4732	}
4733	return ret, nil
4734	// {
4735	//   "description": "Updates the specified label. This method supports patch semantics.",
4736	//   "httpMethod": "PATCH",
4737	//   "id": "gmail.users.labels.patch",
4738	//   "parameterOrder": [
4739	//     "userId",
4740	//     "id"
4741	//   ],
4742	//   "parameters": {
4743	//     "id": {
4744	//       "description": "The ID of the label to update.",
4745	//       "location": "path",
4746	//       "required": true,
4747	//       "type": "string"
4748	//     },
4749	//     "userId": {
4750	//       "default": "me",
4751	//       "description": "The user's email address. The special value me can be used to indicate the authenticated user.",
4752	//       "location": "path",
4753	//       "required": true,
4754	//       "type": "string"
4755	//     }
4756	//   },
4757	//   "path": "{userId}/labels/{id}",
4758	//   "request": {
4759	//     "$ref": "Label"
4760	//   },
4761	//   "response": {
4762	//     "$ref": "Label"
4763	//   },
4764	//   "scopes": [
4765	//     "https://mail.google.com/",
4766	//     "https://www.googleapis.com/auth/gmail.labels",
4767	//     "https://www.googleapis.com/auth/gmail.modify"
4768	//   ]
4769	// }
4770
4771}
4772
4773// method id "gmail.users.labels.update":
4774
4775type UsersLabelsUpdateCall struct {
4776	s          *Service
4777	userId     string
4778	id         string
4779	label      *Label
4780	urlParams_ gensupport.URLParams
4781	ctx_       context.Context
4782	header_    http.Header
4783}
4784
4785// Update: Updates the specified label.
4786func (r *UsersLabelsService) Update(userId string, id string, label *Label) *UsersLabelsUpdateCall {
4787	c := &UsersLabelsUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
4788	c.userId = userId
4789	c.id = id
4790	c.label = label
4791	return c
4792}
4793
4794// Fields allows partial responses to be retrieved. See
4795// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
4796// for more information.
4797func (c *UsersLabelsUpdateCall) Fields(s ...googleapi.Field) *UsersLabelsUpdateCall {
4798	c.urlParams_.Set("fields", googleapi.CombineFields(s))
4799	return c
4800}
4801
4802// Context sets the context to be used in this call's Do method. Any
4803// pending HTTP request will be aborted if the provided context is
4804// canceled.
4805func (c *UsersLabelsUpdateCall) Context(ctx context.Context) *UsersLabelsUpdateCall {
4806	c.ctx_ = ctx
4807	return c
4808}
4809
4810// Header returns an http.Header that can be modified by the caller to
4811// add HTTP headers to the request.
4812func (c *UsersLabelsUpdateCall) Header() http.Header {
4813	if c.header_ == nil {
4814		c.header_ = make(http.Header)
4815	}
4816	return c.header_
4817}
4818
4819func (c *UsersLabelsUpdateCall) doRequest(alt string) (*http.Response, error) {
4820	reqHeaders := make(http.Header)
4821	for k, v := range c.header_ {
4822		reqHeaders[k] = v
4823	}
4824	reqHeaders.Set("User-Agent", c.s.userAgent())
4825	var body io.Reader = nil
4826	body, err := googleapi.WithoutDataWrapper.JSONReader(c.label)
4827	if err != nil {
4828		return nil, err
4829	}
4830	reqHeaders.Set("Content-Type", "application/json")
4831	c.urlParams_.Set("alt", alt)
4832	c.urlParams_.Set("prettyPrint", "false")
4833	urls := googleapi.ResolveRelative(c.s.BasePath, "{userId}/labels/{id}")
4834	urls += "?" + c.urlParams_.Encode()
4835	req, err := http.NewRequest("PUT", urls, body)
4836	if err != nil {
4837		return nil, err
4838	}
4839	req.Header = reqHeaders
4840	googleapi.Expand(req.URL, map[string]string{
4841		"userId": c.userId,
4842		"id":     c.id,
4843	})
4844	return gensupport.SendRequest(c.ctx_, c.s.client, req)
4845}
4846
4847// Do executes the "gmail.users.labels.update" call.
4848// Exactly one of *Label or error will be non-nil. Any non-2xx status
4849// code is an error. Response headers are in either
4850// *Label.ServerResponse.Header or (if a response was returned at all)
4851// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
4852// check whether the returned error was because http.StatusNotModified
4853// was returned.
4854func (c *UsersLabelsUpdateCall) Do(opts ...googleapi.CallOption) (*Label, error) {
4855	gensupport.SetOptions(c.urlParams_, opts...)
4856	res, err := c.doRequest("json")
4857	if res != nil && res.StatusCode == http.StatusNotModified {
4858		if res.Body != nil {
4859			res.Body.Close()
4860		}
4861		return nil, &googleapi.Error{
4862			Code:   res.StatusCode,
4863			Header: res.Header,
4864		}
4865	}
4866	if err != nil {
4867		return nil, err
4868	}
4869	defer googleapi.CloseBody(res)
4870	if err := googleapi.CheckResponse(res); err != nil {
4871		return nil, err
4872	}
4873	ret := &Label{
4874		ServerResponse: googleapi.ServerResponse{
4875			Header:         res.Header,
4876			HTTPStatusCode: res.StatusCode,
4877		},
4878	}
4879	target := &ret
4880	if err := gensupport.DecodeResponse(target, res); err != nil {
4881		return nil, err
4882	}
4883	return ret, nil
4884	// {
4885	//   "description": "Updates the specified label.",
4886	//   "httpMethod": "PUT",
4887	//   "id": "gmail.users.labels.update",
4888	//   "parameterOrder": [
4889	//     "userId",
4890	//     "id"
4891	//   ],
4892	//   "parameters": {
4893	//     "id": {
4894	//       "description": "The ID of the label to update.",
4895	//       "location": "path",
4896	//       "required": true,
4897	//       "type": "string"
4898	//     },
4899	//     "userId": {
4900	//       "default": "me",
4901	//       "description": "The user's email address. The special value me can be used to indicate the authenticated user.",
4902	//       "location": "path",
4903	//       "required": true,
4904	//       "type": "string"
4905	//     }
4906	//   },
4907	//   "path": "{userId}/labels/{id}",
4908	//   "request": {
4909	//     "$ref": "Label"
4910	//   },
4911	//   "response": {
4912	//     "$ref": "Label"
4913	//   },
4914	//   "scopes": [
4915	//     "https://mail.google.com/",
4916	//     "https://www.googleapis.com/auth/gmail.labels",
4917	//     "https://www.googleapis.com/auth/gmail.modify"
4918	//   ]
4919	// }
4920
4921}
4922
4923// method id "gmail.users.messages.batchDelete":
4924
4925type UsersMessagesBatchDeleteCall struct {
4926	s                          *Service
4927	userId                     string
4928	batchdeletemessagesrequest *BatchDeleteMessagesRequest
4929	urlParams_                 gensupport.URLParams
4930	ctx_                       context.Context
4931	header_                    http.Header
4932}
4933
4934// BatchDelete: Deletes many messages by message ID. Provides no
4935// guarantees that messages were not already deleted or even existed at
4936// all.
4937func (r *UsersMessagesService) BatchDelete(userId string, batchdeletemessagesrequest *BatchDeleteMessagesRequest) *UsersMessagesBatchDeleteCall {
4938	c := &UsersMessagesBatchDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
4939	c.userId = userId
4940	c.batchdeletemessagesrequest = batchdeletemessagesrequest
4941	return c
4942}
4943
4944// Fields allows partial responses to be retrieved. See
4945// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
4946// for more information.
4947func (c *UsersMessagesBatchDeleteCall) Fields(s ...googleapi.Field) *UsersMessagesBatchDeleteCall {
4948	c.urlParams_.Set("fields", googleapi.CombineFields(s))
4949	return c
4950}
4951
4952// Context sets the context to be used in this call's Do method. Any
4953// pending HTTP request will be aborted if the provided context is
4954// canceled.
4955func (c *UsersMessagesBatchDeleteCall) Context(ctx context.Context) *UsersMessagesBatchDeleteCall {
4956	c.ctx_ = ctx
4957	return c
4958}
4959
4960// Header returns an http.Header that can be modified by the caller to
4961// add HTTP headers to the request.
4962func (c *UsersMessagesBatchDeleteCall) Header() http.Header {
4963	if c.header_ == nil {
4964		c.header_ = make(http.Header)
4965	}
4966	return c.header_
4967}
4968
4969func (c *UsersMessagesBatchDeleteCall) doRequest(alt string) (*http.Response, error) {
4970	reqHeaders := make(http.Header)
4971	for k, v := range c.header_ {
4972		reqHeaders[k] = v
4973	}
4974	reqHeaders.Set("User-Agent", c.s.userAgent())
4975	var body io.Reader = nil
4976	body, err := googleapi.WithoutDataWrapper.JSONReader(c.batchdeletemessagesrequest)
4977	if err != nil {
4978		return nil, err
4979	}
4980	reqHeaders.Set("Content-Type", "application/json")
4981	c.urlParams_.Set("alt", alt)
4982	c.urlParams_.Set("prettyPrint", "false")
4983	urls := googleapi.ResolveRelative(c.s.BasePath, "{userId}/messages/batchDelete")
4984	urls += "?" + c.urlParams_.Encode()
4985	req, err := http.NewRequest("POST", urls, body)
4986	if err != nil {
4987		return nil, err
4988	}
4989	req.Header = reqHeaders
4990	googleapi.Expand(req.URL, map[string]string{
4991		"userId": c.userId,
4992	})
4993	return gensupport.SendRequest(c.ctx_, c.s.client, req)
4994}
4995
4996// Do executes the "gmail.users.messages.batchDelete" call.
4997func (c *UsersMessagesBatchDeleteCall) Do(opts ...googleapi.CallOption) error {
4998	gensupport.SetOptions(c.urlParams_, opts...)
4999	res, err := c.doRequest("json")
5000	if err != nil {
5001		return err
5002	}
5003	defer googleapi.CloseBody(res)
5004	if err := googleapi.CheckResponse(res); err != nil {
5005		return err
5006	}
5007	return nil
5008	// {
5009	//   "description": "Deletes many messages by message ID. Provides no guarantees that messages were not already deleted or even existed at all.",
5010	//   "httpMethod": "POST",
5011	//   "id": "gmail.users.messages.batchDelete",
5012	//   "parameterOrder": [
5013	//     "userId"
5014	//   ],
5015	//   "parameters": {
5016	//     "userId": {
5017	//       "default": "me",
5018	//       "description": "The user's email address. The special value me can be used to indicate the authenticated user.",
5019	//       "location": "path",
5020	//       "required": true,
5021	//       "type": "string"
5022	//     }
5023	//   },
5024	//   "path": "{userId}/messages/batchDelete",
5025	//   "request": {
5026	//     "$ref": "BatchDeleteMessagesRequest"
5027	//   },
5028	//   "scopes": [
5029	//     "https://mail.google.com/"
5030	//   ]
5031	// }
5032
5033}
5034
5035// method id "gmail.users.messages.batchModify":
5036
5037type UsersMessagesBatchModifyCall struct {
5038	s                          *Service
5039	userId                     string
5040	batchmodifymessagesrequest *BatchModifyMessagesRequest
5041	urlParams_                 gensupport.URLParams
5042	ctx_                       context.Context
5043	header_                    http.Header
5044}
5045
5046// BatchModify: Modifies the labels on the specified messages.
5047func (r *UsersMessagesService) BatchModify(userId string, batchmodifymessagesrequest *BatchModifyMessagesRequest) *UsersMessagesBatchModifyCall {
5048	c := &UsersMessagesBatchModifyCall{s: r.s, urlParams_: make(gensupport.URLParams)}
5049	c.userId = userId
5050	c.batchmodifymessagesrequest = batchmodifymessagesrequest
5051	return c
5052}
5053
5054// Fields allows partial responses to be retrieved. See
5055// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
5056// for more information.
5057func (c *UsersMessagesBatchModifyCall) Fields(s ...googleapi.Field) *UsersMessagesBatchModifyCall {
5058	c.urlParams_.Set("fields", googleapi.CombineFields(s))
5059	return c
5060}
5061
5062// Context sets the context to be used in this call's Do method. Any
5063// pending HTTP request will be aborted if the provided context is
5064// canceled.
5065func (c *UsersMessagesBatchModifyCall) Context(ctx context.Context) *UsersMessagesBatchModifyCall {
5066	c.ctx_ = ctx
5067	return c
5068}
5069
5070// Header returns an http.Header that can be modified by the caller to
5071// add HTTP headers to the request.
5072func (c *UsersMessagesBatchModifyCall) Header() http.Header {
5073	if c.header_ == nil {
5074		c.header_ = make(http.Header)
5075	}
5076	return c.header_
5077}
5078
5079func (c *UsersMessagesBatchModifyCall) doRequest(alt string) (*http.Response, error) {
5080	reqHeaders := make(http.Header)
5081	for k, v := range c.header_ {
5082		reqHeaders[k] = v
5083	}
5084	reqHeaders.Set("User-Agent", c.s.userAgent())
5085	var body io.Reader = nil
5086	body, err := googleapi.WithoutDataWrapper.JSONReader(c.batchmodifymessagesrequest)
5087	if err != nil {
5088		return nil, err
5089	}
5090	reqHeaders.Set("Content-Type", "application/json")
5091	c.urlParams_.Set("alt", alt)
5092	c.urlParams_.Set("prettyPrint", "false")
5093	urls := googleapi.ResolveRelative(c.s.BasePath, "{userId}/messages/batchModify")
5094	urls += "?" + c.urlParams_.Encode()
5095	req, err := http.NewRequest("POST", urls, body)
5096	if err != nil {
5097		return nil, err
5098	}
5099	req.Header = reqHeaders
5100	googleapi.Expand(req.URL, map[string]string{
5101		"userId": c.userId,
5102	})
5103	return gensupport.SendRequest(c.ctx_, c.s.client, req)
5104}
5105
5106// Do executes the "gmail.users.messages.batchModify" call.
5107func (c *UsersMessagesBatchModifyCall) Do(opts ...googleapi.CallOption) error {
5108	gensupport.SetOptions(c.urlParams_, opts...)
5109	res, err := c.doRequest("json")
5110	if err != nil {
5111		return err
5112	}
5113	defer googleapi.CloseBody(res)
5114	if err := googleapi.CheckResponse(res); err != nil {
5115		return err
5116	}
5117	return nil
5118	// {
5119	//   "description": "Modifies the labels on the specified messages.",
5120	//   "httpMethod": "POST",
5121	//   "id": "gmail.users.messages.batchModify",
5122	//   "parameterOrder": [
5123	//     "userId"
5124	//   ],
5125	//   "parameters": {
5126	//     "userId": {
5127	//       "default": "me",
5128	//       "description": "The user's email address. The special value me can be used to indicate the authenticated user.",
5129	//       "location": "path",
5130	//       "required": true,
5131	//       "type": "string"
5132	//     }
5133	//   },
5134	//   "path": "{userId}/messages/batchModify",
5135	//   "request": {
5136	//     "$ref": "BatchModifyMessagesRequest"
5137	//   },
5138	//   "scopes": [
5139	//     "https://mail.google.com/",
5140	//     "https://www.googleapis.com/auth/gmail.modify"
5141	//   ]
5142	// }
5143
5144}
5145
5146// method id "gmail.users.messages.delete":
5147
5148type UsersMessagesDeleteCall struct {
5149	s          *Service
5150	userId     string
5151	id         string
5152	urlParams_ gensupport.URLParams
5153	ctx_       context.Context
5154	header_    http.Header
5155}
5156
5157// Delete: Immediately and permanently deletes the specified message.
5158// This operation cannot be undone. Prefer messages.trash instead.
5159func (r *UsersMessagesService) Delete(userId string, id string) *UsersMessagesDeleteCall {
5160	c := &UsersMessagesDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
5161	c.userId = userId
5162	c.id = id
5163	return c
5164}
5165
5166// Fields allows partial responses to be retrieved. See
5167// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
5168// for more information.
5169func (c *UsersMessagesDeleteCall) Fields(s ...googleapi.Field) *UsersMessagesDeleteCall {
5170	c.urlParams_.Set("fields", googleapi.CombineFields(s))
5171	return c
5172}
5173
5174// Context sets the context to be used in this call's Do method. Any
5175// pending HTTP request will be aborted if the provided context is
5176// canceled.
5177func (c *UsersMessagesDeleteCall) Context(ctx context.Context) *UsersMessagesDeleteCall {
5178	c.ctx_ = ctx
5179	return c
5180}
5181
5182// Header returns an http.Header that can be modified by the caller to
5183// add HTTP headers to the request.
5184func (c *UsersMessagesDeleteCall) Header() http.Header {
5185	if c.header_ == nil {
5186		c.header_ = make(http.Header)
5187	}
5188	return c.header_
5189}
5190
5191func (c *UsersMessagesDeleteCall) doRequest(alt string) (*http.Response, error) {
5192	reqHeaders := make(http.Header)
5193	for k, v := range c.header_ {
5194		reqHeaders[k] = v
5195	}
5196	reqHeaders.Set("User-Agent", c.s.userAgent())
5197	var body io.Reader = nil
5198	c.urlParams_.Set("alt", alt)
5199	c.urlParams_.Set("prettyPrint", "false")
5200	urls := googleapi.ResolveRelative(c.s.BasePath, "{userId}/messages/{id}")
5201	urls += "?" + c.urlParams_.Encode()
5202	req, err := http.NewRequest("DELETE", urls, body)
5203	if err != nil {
5204		return nil, err
5205	}
5206	req.Header = reqHeaders
5207	googleapi.Expand(req.URL, map[string]string{
5208		"userId": c.userId,
5209		"id":     c.id,
5210	})
5211	return gensupport.SendRequest(c.ctx_, c.s.client, req)
5212}
5213
5214// Do executes the "gmail.users.messages.delete" call.
5215func (c *UsersMessagesDeleteCall) Do(opts ...googleapi.CallOption) error {
5216	gensupport.SetOptions(c.urlParams_, opts...)
5217	res, err := c.doRequest("json")
5218	if err != nil {
5219		return err
5220	}
5221	defer googleapi.CloseBody(res)
5222	if err := googleapi.CheckResponse(res); err != nil {
5223		return err
5224	}
5225	return nil
5226	// {
5227	//   "description": "Immediately and permanently deletes the specified message. This operation cannot be undone. Prefer messages.trash instead.",
5228	//   "httpMethod": "DELETE",
5229	//   "id": "gmail.users.messages.delete",
5230	//   "parameterOrder": [
5231	//     "userId",
5232	//     "id"
5233	//   ],
5234	//   "parameters": {
5235	//     "id": {
5236	//       "description": "The ID of the message to delete.",
5237	//       "location": "path",
5238	//       "required": true,
5239	//       "type": "string"
5240	//     },
5241	//     "userId": {
5242	//       "default": "me",
5243	//       "description": "The user's email address. The special value me can be used to indicate the authenticated user.",
5244	//       "location": "path",
5245	//       "required": true,
5246	//       "type": "string"
5247	//     }
5248	//   },
5249	//   "path": "{userId}/messages/{id}",
5250	//   "scopes": [
5251	//     "https://mail.google.com/"
5252	//   ]
5253	// }
5254
5255}
5256
5257// method id "gmail.users.messages.get":
5258
5259type UsersMessagesGetCall struct {
5260	s            *Service
5261	userId       string
5262	id           string
5263	urlParams_   gensupport.URLParams
5264	ifNoneMatch_ string
5265	ctx_         context.Context
5266	header_      http.Header
5267}
5268
5269// Get: Gets the specified message.
5270func (r *UsersMessagesService) Get(userId string, id string) *UsersMessagesGetCall {
5271	c := &UsersMessagesGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
5272	c.userId = userId
5273	c.id = id
5274	return c
5275}
5276
5277// Format sets the optional parameter "format": The format to return the
5278// message in.
5279//
5280// Possible values:
5281//   "full" (default)
5282//   "metadata"
5283//   "minimal"
5284//   "raw"
5285func (c *UsersMessagesGetCall) Format(format string) *UsersMessagesGetCall {
5286	c.urlParams_.Set("format", format)
5287	return c
5288}
5289
5290// MetadataHeaders sets the optional parameter "metadataHeaders": When
5291// given and format is METADATA, only include headers specified.
5292func (c *UsersMessagesGetCall) MetadataHeaders(metadataHeaders ...string) *UsersMessagesGetCall {
5293	c.urlParams_.SetMulti("metadataHeaders", append([]string{}, metadataHeaders...))
5294	return c
5295}
5296
5297// Fields allows partial responses to be retrieved. See
5298// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
5299// for more information.
5300func (c *UsersMessagesGetCall) Fields(s ...googleapi.Field) *UsersMessagesGetCall {
5301	c.urlParams_.Set("fields", googleapi.CombineFields(s))
5302	return c
5303}
5304
5305// IfNoneMatch sets the optional parameter which makes the operation
5306// fail if the object's ETag matches the given value. This is useful for
5307// getting updates only after the object has changed since the last
5308// request. Use googleapi.IsNotModified to check whether the response
5309// error from Do is the result of In-None-Match.
5310func (c *UsersMessagesGetCall) IfNoneMatch(entityTag string) *UsersMessagesGetCall {
5311	c.ifNoneMatch_ = entityTag
5312	return c
5313}
5314
5315// Context sets the context to be used in this call's Do method. Any
5316// pending HTTP request will be aborted if the provided context is
5317// canceled.
5318func (c *UsersMessagesGetCall) Context(ctx context.Context) *UsersMessagesGetCall {
5319	c.ctx_ = ctx
5320	return c
5321}
5322
5323// Header returns an http.Header that can be modified by the caller to
5324// add HTTP headers to the request.
5325func (c *UsersMessagesGetCall) Header() http.Header {
5326	if c.header_ == nil {
5327		c.header_ = make(http.Header)
5328	}
5329	return c.header_
5330}
5331
5332func (c *UsersMessagesGetCall) doRequest(alt string) (*http.Response, error) {
5333	reqHeaders := make(http.Header)
5334	for k, v := range c.header_ {
5335		reqHeaders[k] = v
5336	}
5337	reqHeaders.Set("User-Agent", c.s.userAgent())
5338	if c.ifNoneMatch_ != "" {
5339		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
5340	}
5341	var body io.Reader = nil
5342	c.urlParams_.Set("alt", alt)
5343	c.urlParams_.Set("prettyPrint", "false")
5344	urls := googleapi.ResolveRelative(c.s.BasePath, "{userId}/messages/{id}")
5345	urls += "?" + c.urlParams_.Encode()
5346	req, err := http.NewRequest("GET", urls, body)
5347	if err != nil {
5348		return nil, err
5349	}
5350	req.Header = reqHeaders
5351	googleapi.Expand(req.URL, map[string]string{
5352		"userId": c.userId,
5353		"id":     c.id,
5354	})
5355	return gensupport.SendRequest(c.ctx_, c.s.client, req)
5356}
5357
5358// Do executes the "gmail.users.messages.get" call.
5359// Exactly one of *Message or error will be non-nil. Any non-2xx status
5360// code is an error. Response headers are in either
5361// *Message.ServerResponse.Header or (if a response was returned at all)
5362// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
5363// check whether the returned error was because http.StatusNotModified
5364// was returned.
5365func (c *UsersMessagesGetCall) Do(opts ...googleapi.CallOption) (*Message, error) {
5366	gensupport.SetOptions(c.urlParams_, opts...)
5367	res, err := c.doRequest("json")
5368	if res != nil && res.StatusCode == http.StatusNotModified {
5369		if res.Body != nil {
5370			res.Body.Close()
5371		}
5372		return nil, &googleapi.Error{
5373			Code:   res.StatusCode,
5374			Header: res.Header,
5375		}
5376	}
5377	if err != nil {
5378		return nil, err
5379	}
5380	defer googleapi.CloseBody(res)
5381	if err := googleapi.CheckResponse(res); err != nil {
5382		return nil, err
5383	}
5384	ret := &Message{
5385		ServerResponse: googleapi.ServerResponse{
5386			Header:         res.Header,
5387			HTTPStatusCode: res.StatusCode,
5388		},
5389	}
5390	target := &ret
5391	if err := gensupport.DecodeResponse(target, res); err != nil {
5392		return nil, err
5393	}
5394	return ret, nil
5395	// {
5396	//   "description": "Gets the specified message.",
5397	//   "httpMethod": "GET",
5398	//   "id": "gmail.users.messages.get",
5399	//   "parameterOrder": [
5400	//     "userId",
5401	//     "id"
5402	//   ],
5403	//   "parameters": {
5404	//     "format": {
5405	//       "default": "full",
5406	//       "description": "The format to return the message in.",
5407	//       "enum": [
5408	//         "full",
5409	//         "metadata",
5410	//         "minimal",
5411	//         "raw"
5412	//       ],
5413	//       "enumDescriptions": [
5414	//         "",
5415	//         "",
5416	//         "",
5417	//         ""
5418	//       ],
5419	//       "location": "query",
5420	//       "type": "string"
5421	//     },
5422	//     "id": {
5423	//       "description": "The ID of the message to retrieve.",
5424	//       "location": "path",
5425	//       "required": true,
5426	//       "type": "string"
5427	//     },
5428	//     "metadataHeaders": {
5429	//       "description": "When given and format is METADATA, only include headers specified.",
5430	//       "location": "query",
5431	//       "repeated": true,
5432	//       "type": "string"
5433	//     },
5434	//     "userId": {
5435	//       "default": "me",
5436	//       "description": "The user's email address. The special value me can be used to indicate the authenticated user.",
5437	//       "location": "path",
5438	//       "required": true,
5439	//       "type": "string"
5440	//     }
5441	//   },
5442	//   "path": "{userId}/messages/{id}",
5443	//   "response": {
5444	//     "$ref": "Message"
5445	//   },
5446	//   "scopes": [
5447	//     "https://mail.google.com/",
5448	//     "https://www.googleapis.com/auth/gmail.metadata",
5449	//     "https://www.googleapis.com/auth/gmail.modify",
5450	//     "https://www.googleapis.com/auth/gmail.readonly"
5451	//   ]
5452	// }
5453
5454}
5455
5456// method id "gmail.users.messages.import":
5457
5458type UsersMessagesImportCall struct {
5459	s          *Service
5460	userId     string
5461	message    *Message
5462	urlParams_ gensupport.URLParams
5463	mediaInfo_ *gensupport.MediaInfo
5464	ctx_       context.Context
5465	header_    http.Header
5466}
5467
5468// Import: Imports a message into only this user's mailbox, with
5469// standard email delivery scanning and classification similar to
5470// receiving via SMTP. Does not send a message.
5471func (r *UsersMessagesService) Import(userId string, message *Message) *UsersMessagesImportCall {
5472	c := &UsersMessagesImportCall{s: r.s, urlParams_: make(gensupport.URLParams)}
5473	c.userId = userId
5474	c.message = message
5475	return c
5476}
5477
5478// Deleted sets the optional parameter "deleted": Mark the email as
5479// permanently deleted (not TRASH) and only visible in Google Vault to a
5480// Vault administrator. Only used for G Suite accounts.
5481func (c *UsersMessagesImportCall) Deleted(deleted bool) *UsersMessagesImportCall {
5482	c.urlParams_.Set("deleted", fmt.Sprint(deleted))
5483	return c
5484}
5485
5486// InternalDateSource sets the optional parameter "internalDateSource":
5487// Source for Gmail's internal date of the message.
5488//
5489// Possible values:
5490//   "dateHeader" (default)
5491//   "receivedTime"
5492func (c *UsersMessagesImportCall) InternalDateSource(internalDateSource string) *UsersMessagesImportCall {
5493	c.urlParams_.Set("internalDateSource", internalDateSource)
5494	return c
5495}
5496
5497// NeverMarkSpam sets the optional parameter "neverMarkSpam": Ignore the
5498// Gmail spam classifier decision and never mark this email as SPAM in
5499// the mailbox.
5500func (c *UsersMessagesImportCall) NeverMarkSpam(neverMarkSpam bool) *UsersMessagesImportCall {
5501	c.urlParams_.Set("neverMarkSpam", fmt.Sprint(neverMarkSpam))
5502	return c
5503}
5504
5505// ProcessForCalendar sets the optional parameter "processForCalendar":
5506// Process calendar invites in the email and add any extracted meetings
5507// to the Google Calendar for this user.
5508func (c *UsersMessagesImportCall) ProcessForCalendar(processForCalendar bool) *UsersMessagesImportCall {
5509	c.urlParams_.Set("processForCalendar", fmt.Sprint(processForCalendar))
5510	return c
5511}
5512
5513// Media specifies the media to upload in one or more chunks. The chunk
5514// size may be controlled by supplying a MediaOption generated by
5515// googleapi.ChunkSize. The chunk size defaults to
5516// googleapi.DefaultUploadChunkSize.The Content-Type header used in the
5517// upload request will be determined by sniffing the contents of r,
5518// unless a MediaOption generated by googleapi.ContentType is
5519// supplied.
5520// At most one of Media and ResumableMedia may be set.
5521func (c *UsersMessagesImportCall) Media(r io.Reader, options ...googleapi.MediaOption) *UsersMessagesImportCall {
5522	c.mediaInfo_ = gensupport.NewInfoFromMedia(r, options)
5523	return c
5524}
5525
5526// ResumableMedia specifies the media to upload in chunks and can be
5527// canceled with ctx.
5528//
5529// Deprecated: use Media instead.
5530//
5531// At most one of Media and ResumableMedia may be set. mediaType
5532// identifies the MIME media type of the upload, such as "image/png". If
5533// mediaType is "", it will be auto-detected. The provided ctx will
5534// supersede any context previously provided to the Context method.
5535func (c *UsersMessagesImportCall) ResumableMedia(ctx context.Context, r io.ReaderAt, size int64, mediaType string) *UsersMessagesImportCall {
5536	c.ctx_ = ctx
5537	c.mediaInfo_ = gensupport.NewInfoFromResumableMedia(r, size, mediaType)
5538	return c
5539}
5540
5541// ProgressUpdater provides a callback function that will be called
5542// after every chunk. It should be a low-latency function in order to
5543// not slow down the upload operation. This should only be called when
5544// using ResumableMedia (as opposed to Media).
5545func (c *UsersMessagesImportCall) ProgressUpdater(pu googleapi.ProgressUpdater) *UsersMessagesImportCall {
5546	c.mediaInfo_.SetProgressUpdater(pu)
5547	return c
5548}
5549
5550// Fields allows partial responses to be retrieved. See
5551// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
5552// for more information.
5553func (c *UsersMessagesImportCall) Fields(s ...googleapi.Field) *UsersMessagesImportCall {
5554	c.urlParams_.Set("fields", googleapi.CombineFields(s))
5555	return c
5556}
5557
5558// Context sets the context to be used in this call's Do method. Any
5559// pending HTTP request will be aborted if the provided context is
5560// canceled.
5561// This context will supersede any context previously provided to the
5562// ResumableMedia method.
5563func (c *UsersMessagesImportCall) Context(ctx context.Context) *UsersMessagesImportCall {
5564	c.ctx_ = ctx
5565	return c
5566}
5567
5568// Header returns an http.Header that can be modified by the caller to
5569// add HTTP headers to the request.
5570func (c *UsersMessagesImportCall) Header() http.Header {
5571	if c.header_ == nil {
5572		c.header_ = make(http.Header)
5573	}
5574	return c.header_
5575}
5576
5577func (c *UsersMessagesImportCall) doRequest(alt string) (*http.Response, error) {
5578	reqHeaders := make(http.Header)
5579	for k, v := range c.header_ {
5580		reqHeaders[k] = v
5581	}
5582	reqHeaders.Set("User-Agent", c.s.userAgent())
5583	var body io.Reader = nil
5584	body, err := googleapi.WithoutDataWrapper.JSONReader(c.message)
5585	if err != nil {
5586		return nil, err
5587	}
5588	reqHeaders.Set("Content-Type", "application/json")
5589	c.urlParams_.Set("alt", alt)
5590	c.urlParams_.Set("prettyPrint", "false")
5591	urls := googleapi.ResolveRelative(c.s.BasePath, "{userId}/messages/import")
5592	if c.mediaInfo_ != nil {
5593		urls = strings.Replace(urls, "https://www.googleapis.com/", "https://www.googleapis.com/upload/", 1)
5594		c.urlParams_.Set("uploadType", c.mediaInfo_.UploadType())
5595	}
5596	if body == nil {
5597		body = new(bytes.Buffer)
5598		reqHeaders.Set("Content-Type", "application/json")
5599	}
5600	body, getBody, cleanup := c.mediaInfo_.UploadRequest(reqHeaders, body)
5601	defer cleanup()
5602	urls += "?" + c.urlParams_.Encode()
5603	req, err := http.NewRequest("POST", urls, body)
5604	if err != nil {
5605		return nil, err
5606	}
5607	req.Header = reqHeaders
5608	req.GetBody = getBody
5609	googleapi.Expand(req.URL, map[string]string{
5610		"userId": c.userId,
5611	})
5612	return gensupport.SendRequest(c.ctx_, c.s.client, req)
5613}
5614
5615// Do executes the "gmail.users.messages.import" call.
5616// Exactly one of *Message or error will be non-nil. Any non-2xx status
5617// code is an error. Response headers are in either
5618// *Message.ServerResponse.Header or (if a response was returned at all)
5619// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
5620// check whether the returned error was because http.StatusNotModified
5621// was returned.
5622func (c *UsersMessagesImportCall) Do(opts ...googleapi.CallOption) (*Message, error) {
5623	gensupport.SetOptions(c.urlParams_, opts...)
5624	res, err := c.doRequest("json")
5625	if res != nil && res.StatusCode == http.StatusNotModified {
5626		if res.Body != nil {
5627			res.Body.Close()
5628		}
5629		return nil, &googleapi.Error{
5630			Code:   res.StatusCode,
5631			Header: res.Header,
5632		}
5633	}
5634	if err != nil {
5635		return nil, err
5636	}
5637	defer googleapi.CloseBody(res)
5638	if err := googleapi.CheckResponse(res); err != nil {
5639		return nil, err
5640	}
5641	rx := c.mediaInfo_.ResumableUpload(res.Header.Get("Location"))
5642	if rx != nil {
5643		rx.Client = c.s.client
5644		rx.UserAgent = c.s.userAgent()
5645		ctx := c.ctx_
5646		if ctx == nil {
5647			ctx = context.TODO()
5648		}
5649		res, err = rx.Upload(ctx)
5650		if err != nil {
5651			return nil, err
5652		}
5653		defer res.Body.Close()
5654		if err := googleapi.CheckResponse(res); err != nil {
5655			return nil, err
5656		}
5657	}
5658	ret := &Message{
5659		ServerResponse: googleapi.ServerResponse{
5660			Header:         res.Header,
5661			HTTPStatusCode: res.StatusCode,
5662		},
5663	}
5664	target := &ret
5665	if err := gensupport.DecodeResponse(target, res); err != nil {
5666		return nil, err
5667	}
5668	return ret, nil
5669	// {
5670	//   "description": "Imports a message into only this user's mailbox, with standard email delivery scanning and classification similar to receiving via SMTP. Does not send a message.",
5671	//   "httpMethod": "POST",
5672	//   "id": "gmail.users.messages.import",
5673	//   "mediaUpload": {
5674	//     "accept": [
5675	//       "message/rfc822"
5676	//     ],
5677	//     "maxSize": "50MB",
5678	//     "protocols": {
5679	//       "resumable": {
5680	//         "multipart": true,
5681	//         "path": "/resumable/upload/gmail/v1/users/{userId}/messages/import"
5682	//       },
5683	//       "simple": {
5684	//         "multipart": true,
5685	//         "path": "/upload/gmail/v1/users/{userId}/messages/import"
5686	//       }
5687	//     }
5688	//   },
5689	//   "parameterOrder": [
5690	//     "userId"
5691	//   ],
5692	//   "parameters": {
5693	//     "deleted": {
5694	//       "default": "false",
5695	//       "description": "Mark the email as permanently deleted (not TRASH) and only visible in Google Vault to a Vault administrator. Only used for G Suite accounts.",
5696	//       "location": "query",
5697	//       "type": "boolean"
5698	//     },
5699	//     "internalDateSource": {
5700	//       "default": "dateHeader",
5701	//       "description": "Source for Gmail's internal date of the message.",
5702	//       "enum": [
5703	//         "dateHeader",
5704	//         "receivedTime"
5705	//       ],
5706	//       "enumDescriptions": [
5707	//         "",
5708	//         ""
5709	//       ],
5710	//       "location": "query",
5711	//       "type": "string"
5712	//     },
5713	//     "neverMarkSpam": {
5714	//       "default": "false",
5715	//       "description": "Ignore the Gmail spam classifier decision and never mark this email as SPAM in the mailbox.",
5716	//       "location": "query",
5717	//       "type": "boolean"
5718	//     },
5719	//     "processForCalendar": {
5720	//       "default": "false",
5721	//       "description": "Process calendar invites in the email and add any extracted meetings to the Google Calendar for this user.",
5722	//       "location": "query",
5723	//       "type": "boolean"
5724	//     },
5725	//     "userId": {
5726	//       "default": "me",
5727	//       "description": "The user's email address. The special value me can be used to indicate the authenticated user.",
5728	//       "location": "path",
5729	//       "required": true,
5730	//       "type": "string"
5731	//     }
5732	//   },
5733	//   "path": "{userId}/messages/import",
5734	//   "request": {
5735	//     "$ref": "Message"
5736	//   },
5737	//   "response": {
5738	//     "$ref": "Message"
5739	//   },
5740	//   "scopes": [
5741	//     "https://mail.google.com/",
5742	//     "https://www.googleapis.com/auth/gmail.insert",
5743	//     "https://www.googleapis.com/auth/gmail.modify"
5744	//   ],
5745	//   "supportsMediaUpload": true
5746	// }
5747
5748}
5749
5750// method id "gmail.users.messages.insert":
5751
5752type UsersMessagesInsertCall struct {
5753	s          *Service
5754	userId     string
5755	message    *Message
5756	urlParams_ gensupport.URLParams
5757	mediaInfo_ *gensupport.MediaInfo
5758	ctx_       context.Context
5759	header_    http.Header
5760}
5761
5762// Insert: Directly inserts a message into only this user's mailbox
5763// similar to IMAP APPEND, bypassing most scanning and classification.
5764// Does not send a message.
5765func (r *UsersMessagesService) Insert(userId string, message *Message) *UsersMessagesInsertCall {
5766	c := &UsersMessagesInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)}
5767	c.userId = userId
5768	c.message = message
5769	return c
5770}
5771
5772// Deleted sets the optional parameter "deleted": Mark the email as
5773// permanently deleted (not TRASH) and only visible in Google Vault to a
5774// Vault administrator. Only used for G Suite accounts.
5775func (c *UsersMessagesInsertCall) Deleted(deleted bool) *UsersMessagesInsertCall {
5776	c.urlParams_.Set("deleted", fmt.Sprint(deleted))
5777	return c
5778}
5779
5780// InternalDateSource sets the optional parameter "internalDateSource":
5781// Source for Gmail's internal date of the message.
5782//
5783// Possible values:
5784//   "dateHeader"
5785//   "receivedTime" (default)
5786func (c *UsersMessagesInsertCall) InternalDateSource(internalDateSource string) *UsersMessagesInsertCall {
5787	c.urlParams_.Set("internalDateSource", internalDateSource)
5788	return c
5789}
5790
5791// Media specifies the media to upload in one or more chunks. The chunk
5792// size may be controlled by supplying a MediaOption generated by
5793// googleapi.ChunkSize. The chunk size defaults to
5794// googleapi.DefaultUploadChunkSize.The Content-Type header used in the
5795// upload request will be determined by sniffing the contents of r,
5796// unless a MediaOption generated by googleapi.ContentType is
5797// supplied.
5798// At most one of Media and ResumableMedia may be set.
5799func (c *UsersMessagesInsertCall) Media(r io.Reader, options ...googleapi.MediaOption) *UsersMessagesInsertCall {
5800	c.mediaInfo_ = gensupport.NewInfoFromMedia(r, options)
5801	return c
5802}
5803
5804// ResumableMedia specifies the media to upload in chunks and can be
5805// canceled with ctx.
5806//
5807// Deprecated: use Media instead.
5808//
5809// At most one of Media and ResumableMedia may be set. mediaType
5810// identifies the MIME media type of the upload, such as "image/png". If
5811// mediaType is "", it will be auto-detected. The provided ctx will
5812// supersede any context previously provided to the Context method.
5813func (c *UsersMessagesInsertCall) ResumableMedia(ctx context.Context, r io.ReaderAt, size int64, mediaType string) *UsersMessagesInsertCall {
5814	c.ctx_ = ctx
5815	c.mediaInfo_ = gensupport.NewInfoFromResumableMedia(r, size, mediaType)
5816	return c
5817}
5818
5819// ProgressUpdater provides a callback function that will be called
5820// after every chunk. It should be a low-latency function in order to
5821// not slow down the upload operation. This should only be called when
5822// using ResumableMedia (as opposed to Media).
5823func (c *UsersMessagesInsertCall) ProgressUpdater(pu googleapi.ProgressUpdater) *UsersMessagesInsertCall {
5824	c.mediaInfo_.SetProgressUpdater(pu)
5825	return c
5826}
5827
5828// Fields allows partial responses to be retrieved. See
5829// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
5830// for more information.
5831func (c *UsersMessagesInsertCall) Fields(s ...googleapi.Field) *UsersMessagesInsertCall {
5832	c.urlParams_.Set("fields", googleapi.CombineFields(s))
5833	return c
5834}
5835
5836// Context sets the context to be used in this call's Do method. Any
5837// pending HTTP request will be aborted if the provided context is
5838// canceled.
5839// This context will supersede any context previously provided to the
5840// ResumableMedia method.
5841func (c *UsersMessagesInsertCall) Context(ctx context.Context) *UsersMessagesInsertCall {
5842	c.ctx_ = ctx
5843	return c
5844}
5845
5846// Header returns an http.Header that can be modified by the caller to
5847// add HTTP headers to the request.
5848func (c *UsersMessagesInsertCall) Header() http.Header {
5849	if c.header_ == nil {
5850		c.header_ = make(http.Header)
5851	}
5852	return c.header_
5853}
5854
5855func (c *UsersMessagesInsertCall) doRequest(alt string) (*http.Response, error) {
5856	reqHeaders := make(http.Header)
5857	for k, v := range c.header_ {
5858		reqHeaders[k] = v
5859	}
5860	reqHeaders.Set("User-Agent", c.s.userAgent())
5861	var body io.Reader = nil
5862	body, err := googleapi.WithoutDataWrapper.JSONReader(c.message)
5863	if err != nil {
5864		return nil, err
5865	}
5866	reqHeaders.Set("Content-Type", "application/json")
5867	c.urlParams_.Set("alt", alt)
5868	c.urlParams_.Set("prettyPrint", "false")
5869	urls := googleapi.ResolveRelative(c.s.BasePath, "{userId}/messages")
5870	if c.mediaInfo_ != nil {
5871		urls = strings.Replace(urls, "https://www.googleapis.com/", "https://www.googleapis.com/upload/", 1)
5872		c.urlParams_.Set("uploadType", c.mediaInfo_.UploadType())
5873	}
5874	if body == nil {
5875		body = new(bytes.Buffer)
5876		reqHeaders.Set("Content-Type", "application/json")
5877	}
5878	body, getBody, cleanup := c.mediaInfo_.UploadRequest(reqHeaders, body)
5879	defer cleanup()
5880	urls += "?" + c.urlParams_.Encode()
5881	req, err := http.NewRequest("POST", urls, body)
5882	if err != nil {
5883		return nil, err
5884	}
5885	req.Header = reqHeaders
5886	req.GetBody = getBody
5887	googleapi.Expand(req.URL, map[string]string{
5888		"userId": c.userId,
5889	})
5890	return gensupport.SendRequest(c.ctx_, c.s.client, req)
5891}
5892
5893// Do executes the "gmail.users.messages.insert" call.
5894// Exactly one of *Message or error will be non-nil. Any non-2xx status
5895// code is an error. Response headers are in either
5896// *Message.ServerResponse.Header or (if a response was returned at all)
5897// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
5898// check whether the returned error was because http.StatusNotModified
5899// was returned.
5900func (c *UsersMessagesInsertCall) Do(opts ...googleapi.CallOption) (*Message, error) {
5901	gensupport.SetOptions(c.urlParams_, opts...)
5902	res, err := c.doRequest("json")
5903	if res != nil && res.StatusCode == http.StatusNotModified {
5904		if res.Body != nil {
5905			res.Body.Close()
5906		}
5907		return nil, &googleapi.Error{
5908			Code:   res.StatusCode,
5909			Header: res.Header,
5910		}
5911	}
5912	if err != nil {
5913		return nil, err
5914	}
5915	defer googleapi.CloseBody(res)
5916	if err := googleapi.CheckResponse(res); err != nil {
5917		return nil, err
5918	}
5919	rx := c.mediaInfo_.ResumableUpload(res.Header.Get("Location"))
5920	if rx != nil {
5921		rx.Client = c.s.client
5922		rx.UserAgent = c.s.userAgent()
5923		ctx := c.ctx_
5924		if ctx == nil {
5925			ctx = context.TODO()
5926		}
5927		res, err = rx.Upload(ctx)
5928		if err != nil {
5929			return nil, err
5930		}
5931		defer res.Body.Close()
5932		if err := googleapi.CheckResponse(res); err != nil {
5933			return nil, err
5934		}
5935	}
5936	ret := &Message{
5937		ServerResponse: googleapi.ServerResponse{
5938			Header:         res.Header,
5939			HTTPStatusCode: res.StatusCode,
5940		},
5941	}
5942	target := &ret
5943	if err := gensupport.DecodeResponse(target, res); err != nil {
5944		return nil, err
5945	}
5946	return ret, nil
5947	// {
5948	//   "description": "Directly inserts a message into only this user's mailbox similar to IMAP APPEND, bypassing most scanning and classification. Does not send a message.",
5949	//   "httpMethod": "POST",
5950	//   "id": "gmail.users.messages.insert",
5951	//   "mediaUpload": {
5952	//     "accept": [
5953	//       "message/rfc822"
5954	//     ],
5955	//     "maxSize": "50MB",
5956	//     "protocols": {
5957	//       "resumable": {
5958	//         "multipart": true,
5959	//         "path": "/resumable/upload/gmail/v1/users/{userId}/messages"
5960	//       },
5961	//       "simple": {
5962	//         "multipart": true,
5963	//         "path": "/upload/gmail/v1/users/{userId}/messages"
5964	//       }
5965	//     }
5966	//   },
5967	//   "parameterOrder": [
5968	//     "userId"
5969	//   ],
5970	//   "parameters": {
5971	//     "deleted": {
5972	//       "default": "false",
5973	//       "description": "Mark the email as permanently deleted (not TRASH) and only visible in Google Vault to a Vault administrator. Only used for G Suite accounts.",
5974	//       "location": "query",
5975	//       "type": "boolean"
5976	//     },
5977	//     "internalDateSource": {
5978	//       "default": "receivedTime",
5979	//       "description": "Source for Gmail's internal date of the message.",
5980	//       "enum": [
5981	//         "dateHeader",
5982	//         "receivedTime"
5983	//       ],
5984	//       "enumDescriptions": [
5985	//         "",
5986	//         ""
5987	//       ],
5988	//       "location": "query",
5989	//       "type": "string"
5990	//     },
5991	//     "userId": {
5992	//       "default": "me",
5993	//       "description": "The user's email address. The special value me can be used to indicate the authenticated user.",
5994	//       "location": "path",
5995	//       "required": true,
5996	//       "type": "string"
5997	//     }
5998	//   },
5999	//   "path": "{userId}/messages",
6000	//   "request": {
6001	//     "$ref": "Message"
6002	//   },
6003	//   "response": {
6004	//     "$ref": "Message"
6005	//   },
6006	//   "scopes": [
6007	//     "https://mail.google.com/",
6008	//     "https://www.googleapis.com/auth/gmail.insert",
6009	//     "https://www.googleapis.com/auth/gmail.modify"
6010	//   ],
6011	//   "supportsMediaUpload": true
6012	// }
6013
6014}
6015
6016// method id "gmail.users.messages.list":
6017
6018type UsersMessagesListCall struct {
6019	s            *Service
6020	userId       string
6021	urlParams_   gensupport.URLParams
6022	ifNoneMatch_ string
6023	ctx_         context.Context
6024	header_      http.Header
6025}
6026
6027// List: Lists the messages in the user's mailbox.
6028func (r *UsersMessagesService) List(userId string) *UsersMessagesListCall {
6029	c := &UsersMessagesListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
6030	c.userId = userId
6031	return c
6032}
6033
6034// IncludeSpamTrash sets the optional parameter "includeSpamTrash":
6035// Include messages from SPAM and TRASH in the results.
6036func (c *UsersMessagesListCall) IncludeSpamTrash(includeSpamTrash bool) *UsersMessagesListCall {
6037	c.urlParams_.Set("includeSpamTrash", fmt.Sprint(includeSpamTrash))
6038	return c
6039}
6040
6041// LabelIds sets the optional parameter "labelIds": Only return messages
6042// with labels that match all of the specified label IDs.
6043func (c *UsersMessagesListCall) LabelIds(labelIds ...string) *UsersMessagesListCall {
6044	c.urlParams_.SetMulti("labelIds", append([]string{}, labelIds...))
6045	return c
6046}
6047
6048// MaxResults sets the optional parameter "maxResults": Maximum number
6049// of messages to return.
6050func (c *UsersMessagesListCall) MaxResults(maxResults int64) *UsersMessagesListCall {
6051	c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
6052	return c
6053}
6054
6055// PageToken sets the optional parameter "pageToken": Page token to
6056// retrieve a specific page of results in the list.
6057func (c *UsersMessagesListCall) PageToken(pageToken string) *UsersMessagesListCall {
6058	c.urlParams_.Set("pageToken", pageToken)
6059	return c
6060}
6061
6062// Q sets the optional parameter "q": Only return messages matching the
6063// specified query. Supports the same query format as the Gmail search
6064// box. For example, "from:someuser@example.com
6065// rfc822msgid:<somemsgid@example.com> is:unread". Parameter cannot be
6066// used when accessing the api using the gmail.metadata scope.
6067func (c *UsersMessagesListCall) Q(q string) *UsersMessagesListCall {
6068	c.urlParams_.Set("q", q)
6069	return c
6070}
6071
6072// Fields allows partial responses to be retrieved. See
6073// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
6074// for more information.
6075func (c *UsersMessagesListCall) Fields(s ...googleapi.Field) *UsersMessagesListCall {
6076	c.urlParams_.Set("fields", googleapi.CombineFields(s))
6077	return c
6078}
6079
6080// IfNoneMatch sets the optional parameter which makes the operation
6081// fail if the object's ETag matches the given value. This is useful for
6082// getting updates only after the object has changed since the last
6083// request. Use googleapi.IsNotModified to check whether the response
6084// error from Do is the result of In-None-Match.
6085func (c *UsersMessagesListCall) IfNoneMatch(entityTag string) *UsersMessagesListCall {
6086	c.ifNoneMatch_ = entityTag
6087	return c
6088}
6089
6090// Context sets the context to be used in this call's Do method. Any
6091// pending HTTP request will be aborted if the provided context is
6092// canceled.
6093func (c *UsersMessagesListCall) Context(ctx context.Context) *UsersMessagesListCall {
6094	c.ctx_ = ctx
6095	return c
6096}
6097
6098// Header returns an http.Header that can be modified by the caller to
6099// add HTTP headers to the request.
6100func (c *UsersMessagesListCall) Header() http.Header {
6101	if c.header_ == nil {
6102		c.header_ = make(http.Header)
6103	}
6104	return c.header_
6105}
6106
6107func (c *UsersMessagesListCall) doRequest(alt string) (*http.Response, error) {
6108	reqHeaders := make(http.Header)
6109	for k, v := range c.header_ {
6110		reqHeaders[k] = v
6111	}
6112	reqHeaders.Set("User-Agent", c.s.userAgent())
6113	if c.ifNoneMatch_ != "" {
6114		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
6115	}
6116	var body io.Reader = nil
6117	c.urlParams_.Set("alt", alt)
6118	c.urlParams_.Set("prettyPrint", "false")
6119	urls := googleapi.ResolveRelative(c.s.BasePath, "{userId}/messages")
6120	urls += "?" + c.urlParams_.Encode()
6121	req, err := http.NewRequest("GET", urls, body)
6122	if err != nil {
6123		return nil, err
6124	}
6125	req.Header = reqHeaders
6126	googleapi.Expand(req.URL, map[string]string{
6127		"userId": c.userId,
6128	})
6129	return gensupport.SendRequest(c.ctx_, c.s.client, req)
6130}
6131
6132// Do executes the "gmail.users.messages.list" call.
6133// Exactly one of *ListMessagesResponse or error will be non-nil. Any
6134// non-2xx status code is an error. Response headers are in either
6135// *ListMessagesResponse.ServerResponse.Header or (if a response was
6136// returned at all) in error.(*googleapi.Error).Header. Use
6137// googleapi.IsNotModified to check whether the returned error was
6138// because http.StatusNotModified was returned.
6139func (c *UsersMessagesListCall) Do(opts ...googleapi.CallOption) (*ListMessagesResponse, error) {
6140	gensupport.SetOptions(c.urlParams_, opts...)
6141	res, err := c.doRequest("json")
6142	if res != nil && res.StatusCode == http.StatusNotModified {
6143		if res.Body != nil {
6144			res.Body.Close()
6145		}
6146		return nil, &googleapi.Error{
6147			Code:   res.StatusCode,
6148			Header: res.Header,
6149		}
6150	}
6151	if err != nil {
6152		return nil, err
6153	}
6154	defer googleapi.CloseBody(res)
6155	if err := googleapi.CheckResponse(res); err != nil {
6156		return nil, err
6157	}
6158	ret := &ListMessagesResponse{
6159		ServerResponse: googleapi.ServerResponse{
6160			Header:         res.Header,
6161			HTTPStatusCode: res.StatusCode,
6162		},
6163	}
6164	target := &ret
6165	if err := gensupport.DecodeResponse(target, res); err != nil {
6166		return nil, err
6167	}
6168	return ret, nil
6169	// {
6170	//   "description": "Lists the messages in the user's mailbox.",
6171	//   "httpMethod": "GET",
6172	//   "id": "gmail.users.messages.list",
6173	//   "parameterOrder": [
6174	//     "userId"
6175	//   ],
6176	//   "parameters": {
6177	//     "includeSpamTrash": {
6178	//       "default": "false",
6179	//       "description": "Include messages from SPAM and TRASH in the results.",
6180	//       "location": "query",
6181	//       "type": "boolean"
6182	//     },
6183	//     "labelIds": {
6184	//       "description": "Only return messages with labels that match all of the specified label IDs.",
6185	//       "location": "query",
6186	//       "repeated": true,
6187	//       "type": "string"
6188	//     },
6189	//     "maxResults": {
6190	//       "default": "100",
6191	//       "description": "Maximum number of messages to return.",
6192	//       "format": "uint32",
6193	//       "location": "query",
6194	//       "type": "integer"
6195	//     },
6196	//     "pageToken": {
6197	//       "description": "Page token to retrieve a specific page of results in the list.",
6198	//       "location": "query",
6199	//       "type": "string"
6200	//     },
6201	//     "q": {
6202	//       "description": "Only return messages matching the specified query. Supports the same query format as the Gmail search box. For example, \"from:someuser@example.com rfc822msgid:\u003csomemsgid@example.com\u003e is:unread\". Parameter cannot be used when accessing the api using the gmail.metadata scope.",
6203	//       "location": "query",
6204	//       "type": "string"
6205	//     },
6206	//     "userId": {
6207	//       "default": "me",
6208	//       "description": "The user's email address. The special value me can be used to indicate the authenticated user.",
6209	//       "location": "path",
6210	//       "required": true,
6211	//       "type": "string"
6212	//     }
6213	//   },
6214	//   "path": "{userId}/messages",
6215	//   "response": {
6216	//     "$ref": "ListMessagesResponse"
6217	//   },
6218	//   "scopes": [
6219	//     "https://mail.google.com/",
6220	//     "https://www.googleapis.com/auth/gmail.metadata",
6221	//     "https://www.googleapis.com/auth/gmail.modify",
6222	//     "https://www.googleapis.com/auth/gmail.readonly"
6223	//   ]
6224	// }
6225
6226}
6227
6228// Pages invokes f for each page of results.
6229// A non-nil error returned from f will halt the iteration.
6230// The provided context supersedes any context provided to the Context method.
6231func (c *UsersMessagesListCall) Pages(ctx context.Context, f func(*ListMessagesResponse) error) error {
6232	c.ctx_ = ctx
6233	defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
6234	for {
6235		x, err := c.Do()
6236		if err != nil {
6237			return err
6238		}
6239		if err := f(x); err != nil {
6240			return err
6241		}
6242		if x.NextPageToken == "" {
6243			return nil
6244		}
6245		c.PageToken(x.NextPageToken)
6246	}
6247}
6248
6249// method id "gmail.users.messages.modify":
6250
6251type UsersMessagesModifyCall struct {
6252	s                    *Service
6253	userId               string
6254	id                   string
6255	modifymessagerequest *ModifyMessageRequest
6256	urlParams_           gensupport.URLParams
6257	ctx_                 context.Context
6258	header_              http.Header
6259}
6260
6261// Modify: Modifies the labels on the specified message.
6262func (r *UsersMessagesService) Modify(userId string, id string, modifymessagerequest *ModifyMessageRequest) *UsersMessagesModifyCall {
6263	c := &UsersMessagesModifyCall{s: r.s, urlParams_: make(gensupport.URLParams)}
6264	c.userId = userId
6265	c.id = id
6266	c.modifymessagerequest = modifymessagerequest
6267	return c
6268}
6269
6270// Fields allows partial responses to be retrieved. See
6271// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
6272// for more information.
6273func (c *UsersMessagesModifyCall) Fields(s ...googleapi.Field) *UsersMessagesModifyCall {
6274	c.urlParams_.Set("fields", googleapi.CombineFields(s))
6275	return c
6276}
6277
6278// Context sets the context to be used in this call's Do method. Any
6279// pending HTTP request will be aborted if the provided context is
6280// canceled.
6281func (c *UsersMessagesModifyCall) Context(ctx context.Context) *UsersMessagesModifyCall {
6282	c.ctx_ = ctx
6283	return c
6284}
6285
6286// Header returns an http.Header that can be modified by the caller to
6287// add HTTP headers to the request.
6288func (c *UsersMessagesModifyCall) Header() http.Header {
6289	if c.header_ == nil {
6290		c.header_ = make(http.Header)
6291	}
6292	return c.header_
6293}
6294
6295func (c *UsersMessagesModifyCall) doRequest(alt string) (*http.Response, error) {
6296	reqHeaders := make(http.Header)
6297	for k, v := range c.header_ {
6298		reqHeaders[k] = v
6299	}
6300	reqHeaders.Set("User-Agent", c.s.userAgent())
6301	var body io.Reader = nil
6302	body, err := googleapi.WithoutDataWrapper.JSONReader(c.modifymessagerequest)
6303	if err != nil {
6304		return nil, err
6305	}
6306	reqHeaders.Set("Content-Type", "application/json")
6307	c.urlParams_.Set("alt", alt)
6308	c.urlParams_.Set("prettyPrint", "false")
6309	urls := googleapi.ResolveRelative(c.s.BasePath, "{userId}/messages/{id}/modify")
6310	urls += "?" + c.urlParams_.Encode()
6311	req, err := http.NewRequest("POST", urls, body)
6312	if err != nil {
6313		return nil, err
6314	}
6315	req.Header = reqHeaders
6316	googleapi.Expand(req.URL, map[string]string{
6317		"userId": c.userId,
6318		"id":     c.id,
6319	})
6320	return gensupport.SendRequest(c.ctx_, c.s.client, req)
6321}
6322
6323// Do executes the "gmail.users.messages.modify" call.
6324// Exactly one of *Message or error will be non-nil. Any non-2xx status
6325// code is an error. Response headers are in either
6326// *Message.ServerResponse.Header or (if a response was returned at all)
6327// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
6328// check whether the returned error was because http.StatusNotModified
6329// was returned.
6330func (c *UsersMessagesModifyCall) Do(opts ...googleapi.CallOption) (*Message, error) {
6331	gensupport.SetOptions(c.urlParams_, opts...)
6332	res, err := c.doRequest("json")
6333	if res != nil && res.StatusCode == http.StatusNotModified {
6334		if res.Body != nil {
6335			res.Body.Close()
6336		}
6337		return nil, &googleapi.Error{
6338			Code:   res.StatusCode,
6339			Header: res.Header,
6340		}
6341	}
6342	if err != nil {
6343		return nil, err
6344	}
6345	defer googleapi.CloseBody(res)
6346	if err := googleapi.CheckResponse(res); err != nil {
6347		return nil, err
6348	}
6349	ret := &Message{
6350		ServerResponse: googleapi.ServerResponse{
6351			Header:         res.Header,
6352			HTTPStatusCode: res.StatusCode,
6353		},
6354	}
6355	target := &ret
6356	if err := gensupport.DecodeResponse(target, res); err != nil {
6357		return nil, err
6358	}
6359	return ret, nil
6360	// {
6361	//   "description": "Modifies the labels on the specified message.",
6362	//   "httpMethod": "POST",
6363	//   "id": "gmail.users.messages.modify",
6364	//   "parameterOrder": [
6365	//     "userId",
6366	//     "id"
6367	//   ],
6368	//   "parameters": {
6369	//     "id": {
6370	//       "description": "The ID of the message to modify.",
6371	//       "location": "path",
6372	//       "required": true,
6373	//       "type": "string"
6374	//     },
6375	//     "userId": {
6376	//       "default": "me",
6377	//       "description": "The user's email address. The special value me can be used to indicate the authenticated user.",
6378	//       "location": "path",
6379	//       "required": true,
6380	//       "type": "string"
6381	//     }
6382	//   },
6383	//   "path": "{userId}/messages/{id}/modify",
6384	//   "request": {
6385	//     "$ref": "ModifyMessageRequest"
6386	//   },
6387	//   "response": {
6388	//     "$ref": "Message"
6389	//   },
6390	//   "scopes": [
6391	//     "https://mail.google.com/",
6392	//     "https://www.googleapis.com/auth/gmail.modify"
6393	//   ]
6394	// }
6395
6396}
6397
6398// method id "gmail.users.messages.send":
6399
6400type UsersMessagesSendCall struct {
6401	s          *Service
6402	userId     string
6403	message    *Message
6404	urlParams_ gensupport.URLParams
6405	mediaInfo_ *gensupport.MediaInfo
6406	ctx_       context.Context
6407	header_    http.Header
6408}
6409
6410// Send: Sends the specified message to the recipients in the To, Cc,
6411// and Bcc headers.
6412func (r *UsersMessagesService) Send(userId string, message *Message) *UsersMessagesSendCall {
6413	c := &UsersMessagesSendCall{s: r.s, urlParams_: make(gensupport.URLParams)}
6414	c.userId = userId
6415	c.message = message
6416	return c
6417}
6418
6419// Media specifies the media to upload in one or more chunks. The chunk
6420// size may be controlled by supplying a MediaOption generated by
6421// googleapi.ChunkSize. The chunk size defaults to
6422// googleapi.DefaultUploadChunkSize.The Content-Type header used in the
6423// upload request will be determined by sniffing the contents of r,
6424// unless a MediaOption generated by googleapi.ContentType is
6425// supplied.
6426// At most one of Media and ResumableMedia may be set.
6427func (c *UsersMessagesSendCall) Media(r io.Reader, options ...googleapi.MediaOption) *UsersMessagesSendCall {
6428	c.mediaInfo_ = gensupport.NewInfoFromMedia(r, options)
6429	return c
6430}
6431
6432// ResumableMedia specifies the media to upload in chunks and can be
6433// canceled with ctx.
6434//
6435// Deprecated: use Media instead.
6436//
6437// At most one of Media and ResumableMedia may be set. mediaType
6438// identifies the MIME media type of the upload, such as "image/png". If
6439// mediaType is "", it will be auto-detected. The provided ctx will
6440// supersede any context previously provided to the Context method.
6441func (c *UsersMessagesSendCall) ResumableMedia(ctx context.Context, r io.ReaderAt, size int64, mediaType string) *UsersMessagesSendCall {
6442	c.ctx_ = ctx
6443	c.mediaInfo_ = gensupport.NewInfoFromResumableMedia(r, size, mediaType)
6444	return c
6445}
6446
6447// ProgressUpdater provides a callback function that will be called
6448// after every chunk. It should be a low-latency function in order to
6449// not slow down the upload operation. This should only be called when
6450// using ResumableMedia (as opposed to Media).
6451func (c *UsersMessagesSendCall) ProgressUpdater(pu googleapi.ProgressUpdater) *UsersMessagesSendCall {
6452	c.mediaInfo_.SetProgressUpdater(pu)
6453	return c
6454}
6455
6456// Fields allows partial responses to be retrieved. See
6457// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
6458// for more information.
6459func (c *UsersMessagesSendCall) Fields(s ...googleapi.Field) *UsersMessagesSendCall {
6460	c.urlParams_.Set("fields", googleapi.CombineFields(s))
6461	return c
6462}
6463
6464// Context sets the context to be used in this call's Do method. Any
6465// pending HTTP request will be aborted if the provided context is
6466// canceled.
6467// This context will supersede any context previously provided to the
6468// ResumableMedia method.
6469func (c *UsersMessagesSendCall) Context(ctx context.Context) *UsersMessagesSendCall {
6470	c.ctx_ = ctx
6471	return c
6472}
6473
6474// Header returns an http.Header that can be modified by the caller to
6475// add HTTP headers to the request.
6476func (c *UsersMessagesSendCall) Header() http.Header {
6477	if c.header_ == nil {
6478		c.header_ = make(http.Header)
6479	}
6480	return c.header_
6481}
6482
6483func (c *UsersMessagesSendCall) doRequest(alt string) (*http.Response, error) {
6484	reqHeaders := make(http.Header)
6485	for k, v := range c.header_ {
6486		reqHeaders[k] = v
6487	}
6488	reqHeaders.Set("User-Agent", c.s.userAgent())
6489	var body io.Reader = nil
6490	body, err := googleapi.WithoutDataWrapper.JSONReader(c.message)
6491	if err != nil {
6492		return nil, err
6493	}
6494	reqHeaders.Set("Content-Type", "application/json")
6495	c.urlParams_.Set("alt", alt)
6496	c.urlParams_.Set("prettyPrint", "false")
6497	urls := googleapi.ResolveRelative(c.s.BasePath, "{userId}/messages/send")
6498	if c.mediaInfo_ != nil {
6499		urls = strings.Replace(urls, "https://www.googleapis.com/", "https://www.googleapis.com/upload/", 1)
6500		c.urlParams_.Set("uploadType", c.mediaInfo_.UploadType())
6501	}
6502	if body == nil {
6503		body = new(bytes.Buffer)
6504		reqHeaders.Set("Content-Type", "application/json")
6505	}
6506	body, getBody, cleanup := c.mediaInfo_.UploadRequest(reqHeaders, body)
6507	defer cleanup()
6508	urls += "?" + c.urlParams_.Encode()
6509	req, err := http.NewRequest("POST", urls, body)
6510	if err != nil {
6511		return nil, err
6512	}
6513	req.Header = reqHeaders
6514	req.GetBody = getBody
6515	googleapi.Expand(req.URL, map[string]string{
6516		"userId": c.userId,
6517	})
6518	return gensupport.SendRequest(c.ctx_, c.s.client, req)
6519}
6520
6521// Do executes the "gmail.users.messages.send" call.
6522// Exactly one of *Message or error will be non-nil. Any non-2xx status
6523// code is an error. Response headers are in either
6524// *Message.ServerResponse.Header or (if a response was returned at all)
6525// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
6526// check whether the returned error was because http.StatusNotModified
6527// was returned.
6528func (c *UsersMessagesSendCall) Do(opts ...googleapi.CallOption) (*Message, error) {
6529	gensupport.SetOptions(c.urlParams_, opts...)
6530	res, err := c.doRequest("json")
6531	if res != nil && res.StatusCode == http.StatusNotModified {
6532		if res.Body != nil {
6533			res.Body.Close()
6534		}
6535		return nil, &googleapi.Error{
6536			Code:   res.StatusCode,
6537			Header: res.Header,
6538		}
6539	}
6540	if err != nil {
6541		return nil, err
6542	}
6543	defer googleapi.CloseBody(res)
6544	if err := googleapi.CheckResponse(res); err != nil {
6545		return nil, err
6546	}
6547	rx := c.mediaInfo_.ResumableUpload(res.Header.Get("Location"))
6548	if rx != nil {
6549		rx.Client = c.s.client
6550		rx.UserAgent = c.s.userAgent()
6551		ctx := c.ctx_
6552		if ctx == nil {
6553			ctx = context.TODO()
6554		}
6555		res, err = rx.Upload(ctx)
6556		if err != nil {
6557			return nil, err
6558		}
6559		defer res.Body.Close()
6560		if err := googleapi.CheckResponse(res); err != nil {
6561			return nil, err
6562		}
6563	}
6564	ret := &Message{
6565		ServerResponse: googleapi.ServerResponse{
6566			Header:         res.Header,
6567			HTTPStatusCode: res.StatusCode,
6568		},
6569	}
6570	target := &ret
6571	if err := gensupport.DecodeResponse(target, res); err != nil {
6572		return nil, err
6573	}
6574	return ret, nil
6575	// {
6576	//   "description": "Sends the specified message to the recipients in the To, Cc, and Bcc headers.",
6577	//   "httpMethod": "POST",
6578	//   "id": "gmail.users.messages.send",
6579	//   "mediaUpload": {
6580	//     "accept": [
6581	//       "message/rfc822"
6582	//     ],
6583	//     "maxSize": "35MB",
6584	//     "protocols": {
6585	//       "resumable": {
6586	//         "multipart": true,
6587	//         "path": "/resumable/upload/gmail/v1/users/{userId}/messages/send"
6588	//       },
6589	//       "simple": {
6590	//         "multipart": true,
6591	//         "path": "/upload/gmail/v1/users/{userId}/messages/send"
6592	//       }
6593	//     }
6594	//   },
6595	//   "parameterOrder": [
6596	//     "userId"
6597	//   ],
6598	//   "parameters": {
6599	//     "userId": {
6600	//       "default": "me",
6601	//       "description": "The user's email address. The special value me can be used to indicate the authenticated user.",
6602	//       "location": "path",
6603	//       "required": true,
6604	//       "type": "string"
6605	//     }
6606	//   },
6607	//   "path": "{userId}/messages/send",
6608	//   "request": {
6609	//     "$ref": "Message"
6610	//   },
6611	//   "response": {
6612	//     "$ref": "Message"
6613	//   },
6614	//   "scopes": [
6615	//     "https://mail.google.com/",
6616	//     "https://www.googleapis.com/auth/gmail.compose",
6617	//     "https://www.googleapis.com/auth/gmail.modify",
6618	//     "https://www.googleapis.com/auth/gmail.send"
6619	//   ],
6620	//   "supportsMediaUpload": true
6621	// }
6622
6623}
6624
6625// method id "gmail.users.messages.trash":
6626
6627type UsersMessagesTrashCall struct {
6628	s          *Service
6629	userId     string
6630	id         string
6631	urlParams_ gensupport.URLParams
6632	ctx_       context.Context
6633	header_    http.Header
6634}
6635
6636// Trash: Moves the specified message to the trash.
6637func (r *UsersMessagesService) Trash(userId string, id string) *UsersMessagesTrashCall {
6638	c := &UsersMessagesTrashCall{s: r.s, urlParams_: make(gensupport.URLParams)}
6639	c.userId = userId
6640	c.id = id
6641	return c
6642}
6643
6644// Fields allows partial responses to be retrieved. See
6645// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
6646// for more information.
6647func (c *UsersMessagesTrashCall) Fields(s ...googleapi.Field) *UsersMessagesTrashCall {
6648	c.urlParams_.Set("fields", googleapi.CombineFields(s))
6649	return c
6650}
6651
6652// Context sets the context to be used in this call's Do method. Any
6653// pending HTTP request will be aborted if the provided context is
6654// canceled.
6655func (c *UsersMessagesTrashCall) Context(ctx context.Context) *UsersMessagesTrashCall {
6656	c.ctx_ = ctx
6657	return c
6658}
6659
6660// Header returns an http.Header that can be modified by the caller to
6661// add HTTP headers to the request.
6662func (c *UsersMessagesTrashCall) Header() http.Header {
6663	if c.header_ == nil {
6664		c.header_ = make(http.Header)
6665	}
6666	return c.header_
6667}
6668
6669func (c *UsersMessagesTrashCall) doRequest(alt string) (*http.Response, error) {
6670	reqHeaders := make(http.Header)
6671	for k, v := range c.header_ {
6672		reqHeaders[k] = v
6673	}
6674	reqHeaders.Set("User-Agent", c.s.userAgent())
6675	var body io.Reader = nil
6676	c.urlParams_.Set("alt", alt)
6677	c.urlParams_.Set("prettyPrint", "false")
6678	urls := googleapi.ResolveRelative(c.s.BasePath, "{userId}/messages/{id}/trash")
6679	urls += "?" + c.urlParams_.Encode()
6680	req, err := http.NewRequest("POST", urls, body)
6681	if err != nil {
6682		return nil, err
6683	}
6684	req.Header = reqHeaders
6685	googleapi.Expand(req.URL, map[string]string{
6686		"userId": c.userId,
6687		"id":     c.id,
6688	})
6689	return gensupport.SendRequest(c.ctx_, c.s.client, req)
6690}
6691
6692// Do executes the "gmail.users.messages.trash" call.
6693// Exactly one of *Message or error will be non-nil. Any non-2xx status
6694// code is an error. Response headers are in either
6695// *Message.ServerResponse.Header or (if a response was returned at all)
6696// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
6697// check whether the returned error was because http.StatusNotModified
6698// was returned.
6699func (c *UsersMessagesTrashCall) Do(opts ...googleapi.CallOption) (*Message, error) {
6700	gensupport.SetOptions(c.urlParams_, opts...)
6701	res, err := c.doRequest("json")
6702	if res != nil && res.StatusCode == http.StatusNotModified {
6703		if res.Body != nil {
6704			res.Body.Close()
6705		}
6706		return nil, &googleapi.Error{
6707			Code:   res.StatusCode,
6708			Header: res.Header,
6709		}
6710	}
6711	if err != nil {
6712		return nil, err
6713	}
6714	defer googleapi.CloseBody(res)
6715	if err := googleapi.CheckResponse(res); err != nil {
6716		return nil, err
6717	}
6718	ret := &Message{
6719		ServerResponse: googleapi.ServerResponse{
6720			Header:         res.Header,
6721			HTTPStatusCode: res.StatusCode,
6722		},
6723	}
6724	target := &ret
6725	if err := gensupport.DecodeResponse(target, res); err != nil {
6726		return nil, err
6727	}
6728	return ret, nil
6729	// {
6730	//   "description": "Moves the specified message to the trash.",
6731	//   "httpMethod": "POST",
6732	//   "id": "gmail.users.messages.trash",
6733	//   "parameterOrder": [
6734	//     "userId",
6735	//     "id"
6736	//   ],
6737	//   "parameters": {
6738	//     "id": {
6739	//       "description": "The ID of the message to Trash.",
6740	//       "location": "path",
6741	//       "required": true,
6742	//       "type": "string"
6743	//     },
6744	//     "userId": {
6745	//       "default": "me",
6746	//       "description": "The user's email address. The special value me can be used to indicate the authenticated user.",
6747	//       "location": "path",
6748	//       "required": true,
6749	//       "type": "string"
6750	//     }
6751	//   },
6752	//   "path": "{userId}/messages/{id}/trash",
6753	//   "response": {
6754	//     "$ref": "Message"
6755	//   },
6756	//   "scopes": [
6757	//     "https://mail.google.com/",
6758	//     "https://www.googleapis.com/auth/gmail.modify"
6759	//   ]
6760	// }
6761
6762}
6763
6764// method id "gmail.users.messages.untrash":
6765
6766type UsersMessagesUntrashCall struct {
6767	s          *Service
6768	userId     string
6769	id         string
6770	urlParams_ gensupport.URLParams
6771	ctx_       context.Context
6772	header_    http.Header
6773}
6774
6775// Untrash: Removes the specified message from the trash.
6776func (r *UsersMessagesService) Untrash(userId string, id string) *UsersMessagesUntrashCall {
6777	c := &UsersMessagesUntrashCall{s: r.s, urlParams_: make(gensupport.URLParams)}
6778	c.userId = userId
6779	c.id = id
6780	return c
6781}
6782
6783// Fields allows partial responses to be retrieved. See
6784// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
6785// for more information.
6786func (c *UsersMessagesUntrashCall) Fields(s ...googleapi.Field) *UsersMessagesUntrashCall {
6787	c.urlParams_.Set("fields", googleapi.CombineFields(s))
6788	return c
6789}
6790
6791// Context sets the context to be used in this call's Do method. Any
6792// pending HTTP request will be aborted if the provided context is
6793// canceled.
6794func (c *UsersMessagesUntrashCall) Context(ctx context.Context) *UsersMessagesUntrashCall {
6795	c.ctx_ = ctx
6796	return c
6797}
6798
6799// Header returns an http.Header that can be modified by the caller to
6800// add HTTP headers to the request.
6801func (c *UsersMessagesUntrashCall) Header() http.Header {
6802	if c.header_ == nil {
6803		c.header_ = make(http.Header)
6804	}
6805	return c.header_
6806}
6807
6808func (c *UsersMessagesUntrashCall) doRequest(alt string) (*http.Response, error) {
6809	reqHeaders := make(http.Header)
6810	for k, v := range c.header_ {
6811		reqHeaders[k] = v
6812	}
6813	reqHeaders.Set("User-Agent", c.s.userAgent())
6814	var body io.Reader = nil
6815	c.urlParams_.Set("alt", alt)
6816	c.urlParams_.Set("prettyPrint", "false")
6817	urls := googleapi.ResolveRelative(c.s.BasePath, "{userId}/messages/{id}/untrash")
6818	urls += "?" + c.urlParams_.Encode()
6819	req, err := http.NewRequest("POST", urls, body)
6820	if err != nil {
6821		return nil, err
6822	}
6823	req.Header = reqHeaders
6824	googleapi.Expand(req.URL, map[string]string{
6825		"userId": c.userId,
6826		"id":     c.id,
6827	})
6828	return gensupport.SendRequest(c.ctx_, c.s.client, req)
6829}
6830
6831// Do executes the "gmail.users.messages.untrash" call.
6832// Exactly one of *Message or error will be non-nil. Any non-2xx status
6833// code is an error. Response headers are in either
6834// *Message.ServerResponse.Header or (if a response was returned at all)
6835// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
6836// check whether the returned error was because http.StatusNotModified
6837// was returned.
6838func (c *UsersMessagesUntrashCall) Do(opts ...googleapi.CallOption) (*Message, error) {
6839	gensupport.SetOptions(c.urlParams_, opts...)
6840	res, err := c.doRequest("json")
6841	if res != nil && res.StatusCode == http.StatusNotModified {
6842		if res.Body != nil {
6843			res.Body.Close()
6844		}
6845		return nil, &googleapi.Error{
6846			Code:   res.StatusCode,
6847			Header: res.Header,
6848		}
6849	}
6850	if err != nil {
6851		return nil, err
6852	}
6853	defer googleapi.CloseBody(res)
6854	if err := googleapi.CheckResponse(res); err != nil {
6855		return nil, err
6856	}
6857	ret := &Message{
6858		ServerResponse: googleapi.ServerResponse{
6859			Header:         res.Header,
6860			HTTPStatusCode: res.StatusCode,
6861		},
6862	}
6863	target := &ret
6864	if err := gensupport.DecodeResponse(target, res); err != nil {
6865		return nil, err
6866	}
6867	return ret, nil
6868	// {
6869	//   "description": "Removes the specified message from the trash.",
6870	//   "httpMethod": "POST",
6871	//   "id": "gmail.users.messages.untrash",
6872	//   "parameterOrder": [
6873	//     "userId",
6874	//     "id"
6875	//   ],
6876	//   "parameters": {
6877	//     "id": {
6878	//       "description": "The ID of the message to remove from Trash.",
6879	//       "location": "path",
6880	//       "required": true,
6881	//       "type": "string"
6882	//     },
6883	//     "userId": {
6884	//       "default": "me",
6885	//       "description": "The user's email address. The special value me can be used to indicate the authenticated user.",
6886	//       "location": "path",
6887	//       "required": true,
6888	//       "type": "string"
6889	//     }
6890	//   },
6891	//   "path": "{userId}/messages/{id}/untrash",
6892	//   "response": {
6893	//     "$ref": "Message"
6894	//   },
6895	//   "scopes": [
6896	//     "https://mail.google.com/",
6897	//     "https://www.googleapis.com/auth/gmail.modify"
6898	//   ]
6899	// }
6900
6901}
6902
6903// method id "gmail.users.messages.attachments.get":
6904
6905type UsersMessagesAttachmentsGetCall struct {
6906	s            *Service
6907	userId       string
6908	messageId    string
6909	id           string
6910	urlParams_   gensupport.URLParams
6911	ifNoneMatch_ string
6912	ctx_         context.Context
6913	header_      http.Header
6914}
6915
6916// Get: Gets the specified message attachment.
6917func (r *UsersMessagesAttachmentsService) Get(userId string, messageId string, id string) *UsersMessagesAttachmentsGetCall {
6918	c := &UsersMessagesAttachmentsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
6919	c.userId = userId
6920	c.messageId = messageId
6921	c.id = id
6922	return c
6923}
6924
6925// Fields allows partial responses to be retrieved. See
6926// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
6927// for more information.
6928func (c *UsersMessagesAttachmentsGetCall) Fields(s ...googleapi.Field) *UsersMessagesAttachmentsGetCall {
6929	c.urlParams_.Set("fields", googleapi.CombineFields(s))
6930	return c
6931}
6932
6933// IfNoneMatch sets the optional parameter which makes the operation
6934// fail if the object's ETag matches the given value. This is useful for
6935// getting updates only after the object has changed since the last
6936// request. Use googleapi.IsNotModified to check whether the response
6937// error from Do is the result of In-None-Match.
6938func (c *UsersMessagesAttachmentsGetCall) IfNoneMatch(entityTag string) *UsersMessagesAttachmentsGetCall {
6939	c.ifNoneMatch_ = entityTag
6940	return c
6941}
6942
6943// Context sets the context to be used in this call's Do method. Any
6944// pending HTTP request will be aborted if the provided context is
6945// canceled.
6946func (c *UsersMessagesAttachmentsGetCall) Context(ctx context.Context) *UsersMessagesAttachmentsGetCall {
6947	c.ctx_ = ctx
6948	return c
6949}
6950
6951// Header returns an http.Header that can be modified by the caller to
6952// add HTTP headers to the request.
6953func (c *UsersMessagesAttachmentsGetCall) Header() http.Header {
6954	if c.header_ == nil {
6955		c.header_ = make(http.Header)
6956	}
6957	return c.header_
6958}
6959
6960func (c *UsersMessagesAttachmentsGetCall) doRequest(alt string) (*http.Response, error) {
6961	reqHeaders := make(http.Header)
6962	for k, v := range c.header_ {
6963		reqHeaders[k] = v
6964	}
6965	reqHeaders.Set("User-Agent", c.s.userAgent())
6966	if c.ifNoneMatch_ != "" {
6967		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
6968	}
6969	var body io.Reader = nil
6970	c.urlParams_.Set("alt", alt)
6971	c.urlParams_.Set("prettyPrint", "false")
6972	urls := googleapi.ResolveRelative(c.s.BasePath, "{userId}/messages/{messageId}/attachments/{id}")
6973	urls += "?" + c.urlParams_.Encode()
6974	req, err := http.NewRequest("GET", urls, body)
6975	if err != nil {
6976		return nil, err
6977	}
6978	req.Header = reqHeaders
6979	googleapi.Expand(req.URL, map[string]string{
6980		"userId":    c.userId,
6981		"messageId": c.messageId,
6982		"id":        c.id,
6983	})
6984	return gensupport.SendRequest(c.ctx_, c.s.client, req)
6985}
6986
6987// Do executes the "gmail.users.messages.attachments.get" call.
6988// Exactly one of *MessagePartBody or error will be non-nil. Any non-2xx
6989// status code is an error. Response headers are in either
6990// *MessagePartBody.ServerResponse.Header or (if a response was returned
6991// at all) in error.(*googleapi.Error).Header. Use
6992// googleapi.IsNotModified to check whether the returned error was
6993// because http.StatusNotModified was returned.
6994func (c *UsersMessagesAttachmentsGetCall) Do(opts ...googleapi.CallOption) (*MessagePartBody, error) {
6995	gensupport.SetOptions(c.urlParams_, opts...)
6996	res, err := c.doRequest("json")
6997	if res != nil && res.StatusCode == http.StatusNotModified {
6998		if res.Body != nil {
6999			res.Body.Close()
7000		}
7001		return nil, &googleapi.Error{
7002			Code:   res.StatusCode,
7003			Header: res.Header,
7004		}
7005	}
7006	if err != nil {
7007		return nil, err
7008	}
7009	defer googleapi.CloseBody(res)
7010	if err := googleapi.CheckResponse(res); err != nil {
7011		return nil, err
7012	}
7013	ret := &MessagePartBody{
7014		ServerResponse: googleapi.ServerResponse{
7015			Header:         res.Header,
7016			HTTPStatusCode: res.StatusCode,
7017		},
7018	}
7019	target := &ret
7020	if err := gensupport.DecodeResponse(target, res); err != nil {
7021		return nil, err
7022	}
7023	return ret, nil
7024	// {
7025	//   "description": "Gets the specified message attachment.",
7026	//   "httpMethod": "GET",
7027	//   "id": "gmail.users.messages.attachments.get",
7028	//   "parameterOrder": [
7029	//     "userId",
7030	//     "messageId",
7031	//     "id"
7032	//   ],
7033	//   "parameters": {
7034	//     "id": {
7035	//       "description": "The ID of the attachment.",
7036	//       "location": "path",
7037	//       "required": true,
7038	//       "type": "string"
7039	//     },
7040	//     "messageId": {
7041	//       "description": "The ID of the message containing the attachment.",
7042	//       "location": "path",
7043	//       "required": true,
7044	//       "type": "string"
7045	//     },
7046	//     "userId": {
7047	//       "default": "me",
7048	//       "description": "The user's email address. The special value me can be used to indicate the authenticated user.",
7049	//       "location": "path",
7050	//       "required": true,
7051	//       "type": "string"
7052	//     }
7053	//   },
7054	//   "path": "{userId}/messages/{messageId}/attachments/{id}",
7055	//   "response": {
7056	//     "$ref": "MessagePartBody"
7057	//   },
7058	//   "scopes": [
7059	//     "https://mail.google.com/",
7060	//     "https://www.googleapis.com/auth/gmail.modify",
7061	//     "https://www.googleapis.com/auth/gmail.readonly"
7062	//   ]
7063	// }
7064
7065}
7066
7067// method id "gmail.users.settings.getAutoForwarding":
7068
7069type UsersSettingsGetAutoForwardingCall struct {
7070	s            *Service
7071	userId       string
7072	urlParams_   gensupport.URLParams
7073	ifNoneMatch_ string
7074	ctx_         context.Context
7075	header_      http.Header
7076}
7077
7078// GetAutoForwarding: Gets the auto-forwarding setting for the specified
7079// account.
7080func (r *UsersSettingsService) GetAutoForwarding(userId string) *UsersSettingsGetAutoForwardingCall {
7081	c := &UsersSettingsGetAutoForwardingCall{s: r.s, urlParams_: make(gensupport.URLParams)}
7082	c.userId = userId
7083	return c
7084}
7085
7086// Fields allows partial responses to be retrieved. See
7087// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
7088// for more information.
7089func (c *UsersSettingsGetAutoForwardingCall) Fields(s ...googleapi.Field) *UsersSettingsGetAutoForwardingCall {
7090	c.urlParams_.Set("fields", googleapi.CombineFields(s))
7091	return c
7092}
7093
7094// IfNoneMatch sets the optional parameter which makes the operation
7095// fail if the object's ETag matches the given value. This is useful for
7096// getting updates only after the object has changed since the last
7097// request. Use googleapi.IsNotModified to check whether the response
7098// error from Do is the result of In-None-Match.
7099func (c *UsersSettingsGetAutoForwardingCall) IfNoneMatch(entityTag string) *UsersSettingsGetAutoForwardingCall {
7100	c.ifNoneMatch_ = entityTag
7101	return c
7102}
7103
7104// Context sets the context to be used in this call's Do method. Any
7105// pending HTTP request will be aborted if the provided context is
7106// canceled.
7107func (c *UsersSettingsGetAutoForwardingCall) Context(ctx context.Context) *UsersSettingsGetAutoForwardingCall {
7108	c.ctx_ = ctx
7109	return c
7110}
7111
7112// Header returns an http.Header that can be modified by the caller to
7113// add HTTP headers to the request.
7114func (c *UsersSettingsGetAutoForwardingCall) Header() http.Header {
7115	if c.header_ == nil {
7116		c.header_ = make(http.Header)
7117	}
7118	return c.header_
7119}
7120
7121func (c *UsersSettingsGetAutoForwardingCall) doRequest(alt string) (*http.Response, error) {
7122	reqHeaders := make(http.Header)
7123	for k, v := range c.header_ {
7124		reqHeaders[k] = v
7125	}
7126	reqHeaders.Set("User-Agent", c.s.userAgent())
7127	if c.ifNoneMatch_ != "" {
7128		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
7129	}
7130	var body io.Reader = nil
7131	c.urlParams_.Set("alt", alt)
7132	c.urlParams_.Set("prettyPrint", "false")
7133	urls := googleapi.ResolveRelative(c.s.BasePath, "{userId}/settings/autoForwarding")
7134	urls += "?" + c.urlParams_.Encode()
7135	req, err := http.NewRequest("GET", urls, body)
7136	if err != nil {
7137		return nil, err
7138	}
7139	req.Header = reqHeaders
7140	googleapi.Expand(req.URL, map[string]string{
7141		"userId": c.userId,
7142	})
7143	return gensupport.SendRequest(c.ctx_, c.s.client, req)
7144}
7145
7146// Do executes the "gmail.users.settings.getAutoForwarding" call.
7147// Exactly one of *AutoForwarding or error will be non-nil. Any non-2xx
7148// status code is an error. Response headers are in either
7149// *AutoForwarding.ServerResponse.Header or (if a response was returned
7150// at all) in error.(*googleapi.Error).Header. Use
7151// googleapi.IsNotModified to check whether the returned error was
7152// because http.StatusNotModified was returned.
7153func (c *UsersSettingsGetAutoForwardingCall) Do(opts ...googleapi.CallOption) (*AutoForwarding, error) {
7154	gensupport.SetOptions(c.urlParams_, opts...)
7155	res, err := c.doRequest("json")
7156	if res != nil && res.StatusCode == http.StatusNotModified {
7157		if res.Body != nil {
7158			res.Body.Close()
7159		}
7160		return nil, &googleapi.Error{
7161			Code:   res.StatusCode,
7162			Header: res.Header,
7163		}
7164	}
7165	if err != nil {
7166		return nil, err
7167	}
7168	defer googleapi.CloseBody(res)
7169	if err := googleapi.CheckResponse(res); err != nil {
7170		return nil, err
7171	}
7172	ret := &AutoForwarding{
7173		ServerResponse: googleapi.ServerResponse{
7174			Header:         res.Header,
7175			HTTPStatusCode: res.StatusCode,
7176		},
7177	}
7178	target := &ret
7179	if err := gensupport.DecodeResponse(target, res); err != nil {
7180		return nil, err
7181	}
7182	return ret, nil
7183	// {
7184	//   "description": "Gets the auto-forwarding setting for the specified account.",
7185	//   "httpMethod": "GET",
7186	//   "id": "gmail.users.settings.getAutoForwarding",
7187	//   "parameterOrder": [
7188	//     "userId"
7189	//   ],
7190	//   "parameters": {
7191	//     "userId": {
7192	//       "default": "me",
7193	//       "description": "User's email address. The special value \"me\" can be used to indicate the authenticated user.",
7194	//       "location": "path",
7195	//       "required": true,
7196	//       "type": "string"
7197	//     }
7198	//   },
7199	//   "path": "{userId}/settings/autoForwarding",
7200	//   "response": {
7201	//     "$ref": "AutoForwarding"
7202	//   },
7203	//   "scopes": [
7204	//     "https://mail.google.com/",
7205	//     "https://www.googleapis.com/auth/gmail.modify",
7206	//     "https://www.googleapis.com/auth/gmail.readonly",
7207	//     "https://www.googleapis.com/auth/gmail.settings.basic"
7208	//   ]
7209	// }
7210
7211}
7212
7213// method id "gmail.users.settings.getImap":
7214
7215type UsersSettingsGetImapCall struct {
7216	s            *Service
7217	userId       string
7218	urlParams_   gensupport.URLParams
7219	ifNoneMatch_ string
7220	ctx_         context.Context
7221	header_      http.Header
7222}
7223
7224// GetImap: Gets IMAP settings.
7225func (r *UsersSettingsService) GetImap(userId string) *UsersSettingsGetImapCall {
7226	c := &UsersSettingsGetImapCall{s: r.s, urlParams_: make(gensupport.URLParams)}
7227	c.userId = userId
7228	return c
7229}
7230
7231// Fields allows partial responses to be retrieved. See
7232// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
7233// for more information.
7234func (c *UsersSettingsGetImapCall) Fields(s ...googleapi.Field) *UsersSettingsGetImapCall {
7235	c.urlParams_.Set("fields", googleapi.CombineFields(s))
7236	return c
7237}
7238
7239// IfNoneMatch sets the optional parameter which makes the operation
7240// fail if the object's ETag matches the given value. This is useful for
7241// getting updates only after the object has changed since the last
7242// request. Use googleapi.IsNotModified to check whether the response
7243// error from Do is the result of In-None-Match.
7244func (c *UsersSettingsGetImapCall) IfNoneMatch(entityTag string) *UsersSettingsGetImapCall {
7245	c.ifNoneMatch_ = entityTag
7246	return c
7247}
7248
7249// Context sets the context to be used in this call's Do method. Any
7250// pending HTTP request will be aborted if the provided context is
7251// canceled.
7252func (c *UsersSettingsGetImapCall) Context(ctx context.Context) *UsersSettingsGetImapCall {
7253	c.ctx_ = ctx
7254	return c
7255}
7256
7257// Header returns an http.Header that can be modified by the caller to
7258// add HTTP headers to the request.
7259func (c *UsersSettingsGetImapCall) Header() http.Header {
7260	if c.header_ == nil {
7261		c.header_ = make(http.Header)
7262	}
7263	return c.header_
7264}
7265
7266func (c *UsersSettingsGetImapCall) doRequest(alt string) (*http.Response, error) {
7267	reqHeaders := make(http.Header)
7268	for k, v := range c.header_ {
7269		reqHeaders[k] = v
7270	}
7271	reqHeaders.Set("User-Agent", c.s.userAgent())
7272	if c.ifNoneMatch_ != "" {
7273		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
7274	}
7275	var body io.Reader = nil
7276	c.urlParams_.Set("alt", alt)
7277	c.urlParams_.Set("prettyPrint", "false")
7278	urls := googleapi.ResolveRelative(c.s.BasePath, "{userId}/settings/imap")
7279	urls += "?" + c.urlParams_.Encode()
7280	req, err := http.NewRequest("GET", urls, body)
7281	if err != nil {
7282		return nil, err
7283	}
7284	req.Header = reqHeaders
7285	googleapi.Expand(req.URL, map[string]string{
7286		"userId": c.userId,
7287	})
7288	return gensupport.SendRequest(c.ctx_, c.s.client, req)
7289}
7290
7291// Do executes the "gmail.users.settings.getImap" call.
7292// Exactly one of *ImapSettings or error will be non-nil. Any non-2xx
7293// status code is an error. Response headers are in either
7294// *ImapSettings.ServerResponse.Header or (if a response was returned at
7295// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
7296// to check whether the returned error was because
7297// http.StatusNotModified was returned.
7298func (c *UsersSettingsGetImapCall) Do(opts ...googleapi.CallOption) (*ImapSettings, error) {
7299	gensupport.SetOptions(c.urlParams_, opts...)
7300	res, err := c.doRequest("json")
7301	if res != nil && res.StatusCode == http.StatusNotModified {
7302		if res.Body != nil {
7303			res.Body.Close()
7304		}
7305		return nil, &googleapi.Error{
7306			Code:   res.StatusCode,
7307			Header: res.Header,
7308		}
7309	}
7310	if err != nil {
7311		return nil, err
7312	}
7313	defer googleapi.CloseBody(res)
7314	if err := googleapi.CheckResponse(res); err != nil {
7315		return nil, err
7316	}
7317	ret := &ImapSettings{
7318		ServerResponse: googleapi.ServerResponse{
7319			Header:         res.Header,
7320			HTTPStatusCode: res.StatusCode,
7321		},
7322	}
7323	target := &ret
7324	if err := gensupport.DecodeResponse(target, res); err != nil {
7325		return nil, err
7326	}
7327	return ret, nil
7328	// {
7329	//   "description": "Gets IMAP settings.",
7330	//   "httpMethod": "GET",
7331	//   "id": "gmail.users.settings.getImap",
7332	//   "parameterOrder": [
7333	//     "userId"
7334	//   ],
7335	//   "parameters": {
7336	//     "userId": {
7337	//       "default": "me",
7338	//       "description": "User's email address. The special value \"me\" can be used to indicate the authenticated user.",
7339	//       "location": "path",
7340	//       "required": true,
7341	//       "type": "string"
7342	//     }
7343	//   },
7344	//   "path": "{userId}/settings/imap",
7345	//   "response": {
7346	//     "$ref": "ImapSettings"
7347	//   },
7348	//   "scopes": [
7349	//     "https://mail.google.com/",
7350	//     "https://www.googleapis.com/auth/gmail.modify",
7351	//     "https://www.googleapis.com/auth/gmail.readonly",
7352	//     "https://www.googleapis.com/auth/gmail.settings.basic"
7353	//   ]
7354	// }
7355
7356}
7357
7358// method id "gmail.users.settings.getLanguage":
7359
7360type UsersSettingsGetLanguageCall struct {
7361	s            *Service
7362	userId       string
7363	urlParams_   gensupport.URLParams
7364	ifNoneMatch_ string
7365	ctx_         context.Context
7366	header_      http.Header
7367}
7368
7369// GetLanguage: Gets language settings.
7370func (r *UsersSettingsService) GetLanguage(userId string) *UsersSettingsGetLanguageCall {
7371	c := &UsersSettingsGetLanguageCall{s: r.s, urlParams_: make(gensupport.URLParams)}
7372	c.userId = userId
7373	return c
7374}
7375
7376// Fields allows partial responses to be retrieved. See
7377// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
7378// for more information.
7379func (c *UsersSettingsGetLanguageCall) Fields(s ...googleapi.Field) *UsersSettingsGetLanguageCall {
7380	c.urlParams_.Set("fields", googleapi.CombineFields(s))
7381	return c
7382}
7383
7384// IfNoneMatch sets the optional parameter which makes the operation
7385// fail if the object's ETag matches the given value. This is useful for
7386// getting updates only after the object has changed since the last
7387// request. Use googleapi.IsNotModified to check whether the response
7388// error from Do is the result of In-None-Match.
7389func (c *UsersSettingsGetLanguageCall) IfNoneMatch(entityTag string) *UsersSettingsGetLanguageCall {
7390	c.ifNoneMatch_ = entityTag
7391	return c
7392}
7393
7394// Context sets the context to be used in this call's Do method. Any
7395// pending HTTP request will be aborted if the provided context is
7396// canceled.
7397func (c *UsersSettingsGetLanguageCall) Context(ctx context.Context) *UsersSettingsGetLanguageCall {
7398	c.ctx_ = ctx
7399	return c
7400}
7401
7402// Header returns an http.Header that can be modified by the caller to
7403// add HTTP headers to the request.
7404func (c *UsersSettingsGetLanguageCall) Header() http.Header {
7405	if c.header_ == nil {
7406		c.header_ = make(http.Header)
7407	}
7408	return c.header_
7409}
7410
7411func (c *UsersSettingsGetLanguageCall) doRequest(alt string) (*http.Response, error) {
7412	reqHeaders := make(http.Header)
7413	for k, v := range c.header_ {
7414		reqHeaders[k] = v
7415	}
7416	reqHeaders.Set("User-Agent", c.s.userAgent())
7417	if c.ifNoneMatch_ != "" {
7418		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
7419	}
7420	var body io.Reader = nil
7421	c.urlParams_.Set("alt", alt)
7422	c.urlParams_.Set("prettyPrint", "false")
7423	urls := googleapi.ResolveRelative(c.s.BasePath, "{userId}/settings/language")
7424	urls += "?" + c.urlParams_.Encode()
7425	req, err := http.NewRequest("GET", urls, body)
7426	if err != nil {
7427		return nil, err
7428	}
7429	req.Header = reqHeaders
7430	googleapi.Expand(req.URL, map[string]string{
7431		"userId": c.userId,
7432	})
7433	return gensupport.SendRequest(c.ctx_, c.s.client, req)
7434}
7435
7436// Do executes the "gmail.users.settings.getLanguage" call.
7437// Exactly one of *LanguageSettings or error will be non-nil. Any
7438// non-2xx status code is an error. Response headers are in either
7439// *LanguageSettings.ServerResponse.Header or (if a response was
7440// returned at all) in error.(*googleapi.Error).Header. Use
7441// googleapi.IsNotModified to check whether the returned error was
7442// because http.StatusNotModified was returned.
7443func (c *UsersSettingsGetLanguageCall) Do(opts ...googleapi.CallOption) (*LanguageSettings, error) {
7444	gensupport.SetOptions(c.urlParams_, opts...)
7445	res, err := c.doRequest("json")
7446	if res != nil && res.StatusCode == http.StatusNotModified {
7447		if res.Body != nil {
7448			res.Body.Close()
7449		}
7450		return nil, &googleapi.Error{
7451			Code:   res.StatusCode,
7452			Header: res.Header,
7453		}
7454	}
7455	if err != nil {
7456		return nil, err
7457	}
7458	defer googleapi.CloseBody(res)
7459	if err := googleapi.CheckResponse(res); err != nil {
7460		return nil, err
7461	}
7462	ret := &LanguageSettings{
7463		ServerResponse: googleapi.ServerResponse{
7464			Header:         res.Header,
7465			HTTPStatusCode: res.StatusCode,
7466		},
7467	}
7468	target := &ret
7469	if err := gensupport.DecodeResponse(target, res); err != nil {
7470		return nil, err
7471	}
7472	return ret, nil
7473	// {
7474	//   "description": "Gets language settings.",
7475	//   "httpMethod": "GET",
7476	//   "id": "gmail.users.settings.getLanguage",
7477	//   "parameterOrder": [
7478	//     "userId"
7479	//   ],
7480	//   "parameters": {
7481	//     "userId": {
7482	//       "default": "me",
7483	//       "description": "User's email address. The special value \"me\" can be used to indicate the authenticated user.",
7484	//       "location": "path",
7485	//       "required": true,
7486	//       "type": "string"
7487	//     }
7488	//   },
7489	//   "path": "{userId}/settings/language",
7490	//   "response": {
7491	//     "$ref": "LanguageSettings"
7492	//   },
7493	//   "scopes": [
7494	//     "https://mail.google.com/",
7495	//     "https://www.googleapis.com/auth/gmail.modify",
7496	//     "https://www.googleapis.com/auth/gmail.readonly",
7497	//     "https://www.googleapis.com/auth/gmail.settings.basic"
7498	//   ]
7499	// }
7500
7501}
7502
7503// method id "gmail.users.settings.getPop":
7504
7505type UsersSettingsGetPopCall struct {
7506	s            *Service
7507	userId       string
7508	urlParams_   gensupport.URLParams
7509	ifNoneMatch_ string
7510	ctx_         context.Context
7511	header_      http.Header
7512}
7513
7514// GetPop: Gets POP settings.
7515func (r *UsersSettingsService) GetPop(userId string) *UsersSettingsGetPopCall {
7516	c := &UsersSettingsGetPopCall{s: r.s, urlParams_: make(gensupport.URLParams)}
7517	c.userId = userId
7518	return c
7519}
7520
7521// Fields allows partial responses to be retrieved. See
7522// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
7523// for more information.
7524func (c *UsersSettingsGetPopCall) Fields(s ...googleapi.Field) *UsersSettingsGetPopCall {
7525	c.urlParams_.Set("fields", googleapi.CombineFields(s))
7526	return c
7527}
7528
7529// IfNoneMatch sets the optional parameter which makes the operation
7530// fail if the object's ETag matches the given value. This is useful for
7531// getting updates only after the object has changed since the last
7532// request. Use googleapi.IsNotModified to check whether the response
7533// error from Do is the result of In-None-Match.
7534func (c *UsersSettingsGetPopCall) IfNoneMatch(entityTag string) *UsersSettingsGetPopCall {
7535	c.ifNoneMatch_ = entityTag
7536	return c
7537}
7538
7539// Context sets the context to be used in this call's Do method. Any
7540// pending HTTP request will be aborted if the provided context is
7541// canceled.
7542func (c *UsersSettingsGetPopCall) Context(ctx context.Context) *UsersSettingsGetPopCall {
7543	c.ctx_ = ctx
7544	return c
7545}
7546
7547// Header returns an http.Header that can be modified by the caller to
7548// add HTTP headers to the request.
7549func (c *UsersSettingsGetPopCall) Header() http.Header {
7550	if c.header_ == nil {
7551		c.header_ = make(http.Header)
7552	}
7553	return c.header_
7554}
7555
7556func (c *UsersSettingsGetPopCall) doRequest(alt string) (*http.Response, error) {
7557	reqHeaders := make(http.Header)
7558	for k, v := range c.header_ {
7559		reqHeaders[k] = v
7560	}
7561	reqHeaders.Set("User-Agent", c.s.userAgent())
7562	if c.ifNoneMatch_ != "" {
7563		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
7564	}
7565	var body io.Reader = nil
7566	c.urlParams_.Set("alt", alt)
7567	c.urlParams_.Set("prettyPrint", "false")
7568	urls := googleapi.ResolveRelative(c.s.BasePath, "{userId}/settings/pop")
7569	urls += "?" + c.urlParams_.Encode()
7570	req, err := http.NewRequest("GET", urls, body)
7571	if err != nil {
7572		return nil, err
7573	}
7574	req.Header = reqHeaders
7575	googleapi.Expand(req.URL, map[string]string{
7576		"userId": c.userId,
7577	})
7578	return gensupport.SendRequest(c.ctx_, c.s.client, req)
7579}
7580
7581// Do executes the "gmail.users.settings.getPop" call.
7582// Exactly one of *PopSettings or error will be non-nil. Any non-2xx
7583// status code is an error. Response headers are in either
7584// *PopSettings.ServerResponse.Header or (if a response was returned at
7585// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
7586// to check whether the returned error was because
7587// http.StatusNotModified was returned.
7588func (c *UsersSettingsGetPopCall) Do(opts ...googleapi.CallOption) (*PopSettings, error) {
7589	gensupport.SetOptions(c.urlParams_, opts...)
7590	res, err := c.doRequest("json")
7591	if res != nil && res.StatusCode == http.StatusNotModified {
7592		if res.Body != nil {
7593			res.Body.Close()
7594		}
7595		return nil, &googleapi.Error{
7596			Code:   res.StatusCode,
7597			Header: res.Header,
7598		}
7599	}
7600	if err != nil {
7601		return nil, err
7602	}
7603	defer googleapi.CloseBody(res)
7604	if err := googleapi.CheckResponse(res); err != nil {
7605		return nil, err
7606	}
7607	ret := &PopSettings{
7608		ServerResponse: googleapi.ServerResponse{
7609			Header:         res.Header,
7610			HTTPStatusCode: res.StatusCode,
7611		},
7612	}
7613	target := &ret
7614	if err := gensupport.DecodeResponse(target, res); err != nil {
7615		return nil, err
7616	}
7617	return ret, nil
7618	// {
7619	//   "description": "Gets POP settings.",
7620	//   "httpMethod": "GET",
7621	//   "id": "gmail.users.settings.getPop",
7622	//   "parameterOrder": [
7623	//     "userId"
7624	//   ],
7625	//   "parameters": {
7626	//     "userId": {
7627	//       "default": "me",
7628	//       "description": "User's email address. The special value \"me\" can be used to indicate the authenticated user.",
7629	//       "location": "path",
7630	//       "required": true,
7631	//       "type": "string"
7632	//     }
7633	//   },
7634	//   "path": "{userId}/settings/pop",
7635	//   "response": {
7636	//     "$ref": "PopSettings"
7637	//   },
7638	//   "scopes": [
7639	//     "https://mail.google.com/",
7640	//     "https://www.googleapis.com/auth/gmail.modify",
7641	//     "https://www.googleapis.com/auth/gmail.readonly",
7642	//     "https://www.googleapis.com/auth/gmail.settings.basic"
7643	//   ]
7644	// }
7645
7646}
7647
7648// method id "gmail.users.settings.getVacation":
7649
7650type UsersSettingsGetVacationCall struct {
7651	s            *Service
7652	userId       string
7653	urlParams_   gensupport.URLParams
7654	ifNoneMatch_ string
7655	ctx_         context.Context
7656	header_      http.Header
7657}
7658
7659// GetVacation: Gets vacation responder settings.
7660func (r *UsersSettingsService) GetVacation(userId string) *UsersSettingsGetVacationCall {
7661	c := &UsersSettingsGetVacationCall{s: r.s, urlParams_: make(gensupport.URLParams)}
7662	c.userId = userId
7663	return c
7664}
7665
7666// Fields allows partial responses to be retrieved. See
7667// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
7668// for more information.
7669func (c *UsersSettingsGetVacationCall) Fields(s ...googleapi.Field) *UsersSettingsGetVacationCall {
7670	c.urlParams_.Set("fields", googleapi.CombineFields(s))
7671	return c
7672}
7673
7674// IfNoneMatch sets the optional parameter which makes the operation
7675// fail if the object's ETag matches the given value. This is useful for
7676// getting updates only after the object has changed since the last
7677// request. Use googleapi.IsNotModified to check whether the response
7678// error from Do is the result of In-None-Match.
7679func (c *UsersSettingsGetVacationCall) IfNoneMatch(entityTag string) *UsersSettingsGetVacationCall {
7680	c.ifNoneMatch_ = entityTag
7681	return c
7682}
7683
7684// Context sets the context to be used in this call's Do method. Any
7685// pending HTTP request will be aborted if the provided context is
7686// canceled.
7687func (c *UsersSettingsGetVacationCall) Context(ctx context.Context) *UsersSettingsGetVacationCall {
7688	c.ctx_ = ctx
7689	return c
7690}
7691
7692// Header returns an http.Header that can be modified by the caller to
7693// add HTTP headers to the request.
7694func (c *UsersSettingsGetVacationCall) Header() http.Header {
7695	if c.header_ == nil {
7696		c.header_ = make(http.Header)
7697	}
7698	return c.header_
7699}
7700
7701func (c *UsersSettingsGetVacationCall) doRequest(alt string) (*http.Response, error) {
7702	reqHeaders := make(http.Header)
7703	for k, v := range c.header_ {
7704		reqHeaders[k] = v
7705	}
7706	reqHeaders.Set("User-Agent", c.s.userAgent())
7707	if c.ifNoneMatch_ != "" {
7708		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
7709	}
7710	var body io.Reader = nil
7711	c.urlParams_.Set("alt", alt)
7712	c.urlParams_.Set("prettyPrint", "false")
7713	urls := googleapi.ResolveRelative(c.s.BasePath, "{userId}/settings/vacation")
7714	urls += "?" + c.urlParams_.Encode()
7715	req, err := http.NewRequest("GET", urls, body)
7716	if err != nil {
7717		return nil, err
7718	}
7719	req.Header = reqHeaders
7720	googleapi.Expand(req.URL, map[string]string{
7721		"userId": c.userId,
7722	})
7723	return gensupport.SendRequest(c.ctx_, c.s.client, req)
7724}
7725
7726// Do executes the "gmail.users.settings.getVacation" call.
7727// Exactly one of *VacationSettings or error will be non-nil. Any
7728// non-2xx status code is an error. Response headers are in either
7729// *VacationSettings.ServerResponse.Header or (if a response was
7730// returned at all) in error.(*googleapi.Error).Header. Use
7731// googleapi.IsNotModified to check whether the returned error was
7732// because http.StatusNotModified was returned.
7733func (c *UsersSettingsGetVacationCall) Do(opts ...googleapi.CallOption) (*VacationSettings, error) {
7734	gensupport.SetOptions(c.urlParams_, opts...)
7735	res, err := c.doRequest("json")
7736	if res != nil && res.StatusCode == http.StatusNotModified {
7737		if res.Body != nil {
7738			res.Body.Close()
7739		}
7740		return nil, &googleapi.Error{
7741			Code:   res.StatusCode,
7742			Header: res.Header,
7743		}
7744	}
7745	if err != nil {
7746		return nil, err
7747	}
7748	defer googleapi.CloseBody(res)
7749	if err := googleapi.CheckResponse(res); err != nil {
7750		return nil, err
7751	}
7752	ret := &VacationSettings{
7753		ServerResponse: googleapi.ServerResponse{
7754			Header:         res.Header,
7755			HTTPStatusCode: res.StatusCode,
7756		},
7757	}
7758	target := &ret
7759	if err := gensupport.DecodeResponse(target, res); err != nil {
7760		return nil, err
7761	}
7762	return ret, nil
7763	// {
7764	//   "description": "Gets vacation responder settings.",
7765	//   "httpMethod": "GET",
7766	//   "id": "gmail.users.settings.getVacation",
7767	//   "parameterOrder": [
7768	//     "userId"
7769	//   ],
7770	//   "parameters": {
7771	//     "userId": {
7772	//       "default": "me",
7773	//       "description": "User's email address. The special value \"me\" can be used to indicate the authenticated user.",
7774	//       "location": "path",
7775	//       "required": true,
7776	//       "type": "string"
7777	//     }
7778	//   },
7779	//   "path": "{userId}/settings/vacation",
7780	//   "response": {
7781	//     "$ref": "VacationSettings"
7782	//   },
7783	//   "scopes": [
7784	//     "https://mail.google.com/",
7785	//     "https://www.googleapis.com/auth/gmail.modify",
7786	//     "https://www.googleapis.com/auth/gmail.readonly",
7787	//     "https://www.googleapis.com/auth/gmail.settings.basic"
7788	//   ]
7789	// }
7790
7791}
7792
7793// method id "gmail.users.settings.updateAutoForwarding":
7794
7795type UsersSettingsUpdateAutoForwardingCall struct {
7796	s              *Service
7797	userId         string
7798	autoforwarding *AutoForwarding
7799	urlParams_     gensupport.URLParams
7800	ctx_           context.Context
7801	header_        http.Header
7802}
7803
7804// UpdateAutoForwarding: Updates the auto-forwarding setting for the
7805// specified account. A verified forwarding address must be specified
7806// when auto-forwarding is enabled.
7807//
7808// This method is only available to service account clients that have
7809// been delegated domain-wide authority.
7810func (r *UsersSettingsService) UpdateAutoForwarding(userId string, autoforwarding *AutoForwarding) *UsersSettingsUpdateAutoForwardingCall {
7811	c := &UsersSettingsUpdateAutoForwardingCall{s: r.s, urlParams_: make(gensupport.URLParams)}
7812	c.userId = userId
7813	c.autoforwarding = autoforwarding
7814	return c
7815}
7816
7817// Fields allows partial responses to be retrieved. See
7818// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
7819// for more information.
7820func (c *UsersSettingsUpdateAutoForwardingCall) Fields(s ...googleapi.Field) *UsersSettingsUpdateAutoForwardingCall {
7821	c.urlParams_.Set("fields", googleapi.CombineFields(s))
7822	return c
7823}
7824
7825// Context sets the context to be used in this call's Do method. Any
7826// pending HTTP request will be aborted if the provided context is
7827// canceled.
7828func (c *UsersSettingsUpdateAutoForwardingCall) Context(ctx context.Context) *UsersSettingsUpdateAutoForwardingCall {
7829	c.ctx_ = ctx
7830	return c
7831}
7832
7833// Header returns an http.Header that can be modified by the caller to
7834// add HTTP headers to the request.
7835func (c *UsersSettingsUpdateAutoForwardingCall) Header() http.Header {
7836	if c.header_ == nil {
7837		c.header_ = make(http.Header)
7838	}
7839	return c.header_
7840}
7841
7842func (c *UsersSettingsUpdateAutoForwardingCall) doRequest(alt string) (*http.Response, error) {
7843	reqHeaders := make(http.Header)
7844	for k, v := range c.header_ {
7845		reqHeaders[k] = v
7846	}
7847	reqHeaders.Set("User-Agent", c.s.userAgent())
7848	var body io.Reader = nil
7849	body, err := googleapi.WithoutDataWrapper.JSONReader(c.autoforwarding)
7850	if err != nil {
7851		return nil, err
7852	}
7853	reqHeaders.Set("Content-Type", "application/json")
7854	c.urlParams_.Set("alt", alt)
7855	c.urlParams_.Set("prettyPrint", "false")
7856	urls := googleapi.ResolveRelative(c.s.BasePath, "{userId}/settings/autoForwarding")
7857	urls += "?" + c.urlParams_.Encode()
7858	req, err := http.NewRequest("PUT", urls, body)
7859	if err != nil {
7860		return nil, err
7861	}
7862	req.Header = reqHeaders
7863	googleapi.Expand(req.URL, map[string]string{
7864		"userId": c.userId,
7865	})
7866	return gensupport.SendRequest(c.ctx_, c.s.client, req)
7867}
7868
7869// Do executes the "gmail.users.settings.updateAutoForwarding" call.
7870// Exactly one of *AutoForwarding or error will be non-nil. Any non-2xx
7871// status code is an error. Response headers are in either
7872// *AutoForwarding.ServerResponse.Header or (if a response was returned
7873// at all) in error.(*googleapi.Error).Header. Use
7874// googleapi.IsNotModified to check whether the returned error was
7875// because http.StatusNotModified was returned.
7876func (c *UsersSettingsUpdateAutoForwardingCall) Do(opts ...googleapi.CallOption) (*AutoForwarding, error) {
7877	gensupport.SetOptions(c.urlParams_, opts...)
7878	res, err := c.doRequest("json")
7879	if res != nil && res.StatusCode == http.StatusNotModified {
7880		if res.Body != nil {
7881			res.Body.Close()
7882		}
7883		return nil, &googleapi.Error{
7884			Code:   res.StatusCode,
7885			Header: res.Header,
7886		}
7887	}
7888	if err != nil {
7889		return nil, err
7890	}
7891	defer googleapi.CloseBody(res)
7892	if err := googleapi.CheckResponse(res); err != nil {
7893		return nil, err
7894	}
7895	ret := &AutoForwarding{
7896		ServerResponse: googleapi.ServerResponse{
7897			Header:         res.Header,
7898			HTTPStatusCode: res.StatusCode,
7899		},
7900	}
7901	target := &ret
7902	if err := gensupport.DecodeResponse(target, res); err != nil {
7903		return nil, err
7904	}
7905	return ret, nil
7906	// {
7907	//   "description": "Updates the auto-forwarding setting for the specified account. A verified forwarding address must be specified when auto-forwarding is enabled.\n\nThis method is only available to service account clients that have been delegated domain-wide authority.",
7908	//   "httpMethod": "PUT",
7909	//   "id": "gmail.users.settings.updateAutoForwarding",
7910	//   "parameterOrder": [
7911	//     "userId"
7912	//   ],
7913	//   "parameters": {
7914	//     "userId": {
7915	//       "default": "me",
7916	//       "description": "User's email address. The special value \"me\" can be used to indicate the authenticated user.",
7917	//       "location": "path",
7918	//       "required": true,
7919	//       "type": "string"
7920	//     }
7921	//   },
7922	//   "path": "{userId}/settings/autoForwarding",
7923	//   "request": {
7924	//     "$ref": "AutoForwarding"
7925	//   },
7926	//   "response": {
7927	//     "$ref": "AutoForwarding"
7928	//   },
7929	//   "scopes": [
7930	//     "https://www.googleapis.com/auth/gmail.settings.sharing"
7931	//   ]
7932	// }
7933
7934}
7935
7936// method id "gmail.users.settings.updateImap":
7937
7938type UsersSettingsUpdateImapCall struct {
7939	s            *Service
7940	userId       string
7941	imapsettings *ImapSettings
7942	urlParams_   gensupport.URLParams
7943	ctx_         context.Context
7944	header_      http.Header
7945}
7946
7947// UpdateImap: Updates IMAP settings.
7948func (r *UsersSettingsService) UpdateImap(userId string, imapsettings *ImapSettings) *UsersSettingsUpdateImapCall {
7949	c := &UsersSettingsUpdateImapCall{s: r.s, urlParams_: make(gensupport.URLParams)}
7950	c.userId = userId
7951	c.imapsettings = imapsettings
7952	return c
7953}
7954
7955// Fields allows partial responses to be retrieved. See
7956// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
7957// for more information.
7958func (c *UsersSettingsUpdateImapCall) Fields(s ...googleapi.Field) *UsersSettingsUpdateImapCall {
7959	c.urlParams_.Set("fields", googleapi.CombineFields(s))
7960	return c
7961}
7962
7963// Context sets the context to be used in this call's Do method. Any
7964// pending HTTP request will be aborted if the provided context is
7965// canceled.
7966func (c *UsersSettingsUpdateImapCall) Context(ctx context.Context) *UsersSettingsUpdateImapCall {
7967	c.ctx_ = ctx
7968	return c
7969}
7970
7971// Header returns an http.Header that can be modified by the caller to
7972// add HTTP headers to the request.
7973func (c *UsersSettingsUpdateImapCall) Header() http.Header {
7974	if c.header_ == nil {
7975		c.header_ = make(http.Header)
7976	}
7977	return c.header_
7978}
7979
7980func (c *UsersSettingsUpdateImapCall) doRequest(alt string) (*http.Response, error) {
7981	reqHeaders := make(http.Header)
7982	for k, v := range c.header_ {
7983		reqHeaders[k] = v
7984	}
7985	reqHeaders.Set("User-Agent", c.s.userAgent())
7986	var body io.Reader = nil
7987	body, err := googleapi.WithoutDataWrapper.JSONReader(c.imapsettings)
7988	if err != nil {
7989		return nil, err
7990	}
7991	reqHeaders.Set("Content-Type", "application/json")
7992	c.urlParams_.Set("alt", alt)
7993	c.urlParams_.Set("prettyPrint", "false")
7994	urls := googleapi.ResolveRelative(c.s.BasePath, "{userId}/settings/imap")
7995	urls += "?" + c.urlParams_.Encode()
7996	req, err := http.NewRequest("PUT", urls, body)
7997	if err != nil {
7998		return nil, err
7999	}
8000	req.Header = reqHeaders
8001	googleapi.Expand(req.URL, map[string]string{
8002		"userId": c.userId,
8003	})
8004	return gensupport.SendRequest(c.ctx_, c.s.client, req)
8005}
8006
8007// Do executes the "gmail.users.settings.updateImap" call.
8008// Exactly one of *ImapSettings or error will be non-nil. Any non-2xx
8009// status code is an error. Response headers are in either
8010// *ImapSettings.ServerResponse.Header or (if a response was returned at
8011// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
8012// to check whether the returned error was because
8013// http.StatusNotModified was returned.
8014func (c *UsersSettingsUpdateImapCall) Do(opts ...googleapi.CallOption) (*ImapSettings, error) {
8015	gensupport.SetOptions(c.urlParams_, opts...)
8016	res, err := c.doRequest("json")
8017	if res != nil && res.StatusCode == http.StatusNotModified {
8018		if res.Body != nil {
8019			res.Body.Close()
8020		}
8021		return nil, &googleapi.Error{
8022			Code:   res.StatusCode,
8023			Header: res.Header,
8024		}
8025	}
8026	if err != nil {
8027		return nil, err
8028	}
8029	defer googleapi.CloseBody(res)
8030	if err := googleapi.CheckResponse(res); err != nil {
8031		return nil, err
8032	}
8033	ret := &ImapSettings{
8034		ServerResponse: googleapi.ServerResponse{
8035			Header:         res.Header,
8036			HTTPStatusCode: res.StatusCode,
8037		},
8038	}
8039	target := &ret
8040	if err := gensupport.DecodeResponse(target, res); err != nil {
8041		return nil, err
8042	}
8043	return ret, nil
8044	// {
8045	//   "description": "Updates IMAP settings.",
8046	//   "httpMethod": "PUT",
8047	//   "id": "gmail.users.settings.updateImap",
8048	//   "parameterOrder": [
8049	//     "userId"
8050	//   ],
8051	//   "parameters": {
8052	//     "userId": {
8053	//       "default": "me",
8054	//       "description": "User's email address. The special value \"me\" can be used to indicate the authenticated user.",
8055	//       "location": "path",
8056	//       "required": true,
8057	//       "type": "string"
8058	//     }
8059	//   },
8060	//   "path": "{userId}/settings/imap",
8061	//   "request": {
8062	//     "$ref": "ImapSettings"
8063	//   },
8064	//   "response": {
8065	//     "$ref": "ImapSettings"
8066	//   },
8067	//   "scopes": [
8068	//     "https://www.googleapis.com/auth/gmail.settings.basic"
8069	//   ]
8070	// }
8071
8072}
8073
8074// method id "gmail.users.settings.updateLanguage":
8075
8076type UsersSettingsUpdateLanguageCall struct {
8077	s                *Service
8078	userId           string
8079	languagesettings *LanguageSettings
8080	urlParams_       gensupport.URLParams
8081	ctx_             context.Context
8082	header_          http.Header
8083}
8084
8085// UpdateLanguage: Updates language settings.
8086//
8087// If successful, the return object contains the displayLanguage that
8088// was saved for the user, which may differ from the value passed into
8089// the request. This is because the requested displayLanguage may not be
8090// directly supported by Gmail but have a close variant that is, and so
8091// the variant may be chosen and saved instead.
8092func (r *UsersSettingsService) UpdateLanguage(userId string, languagesettings *LanguageSettings) *UsersSettingsUpdateLanguageCall {
8093	c := &UsersSettingsUpdateLanguageCall{s: r.s, urlParams_: make(gensupport.URLParams)}
8094	c.userId = userId
8095	c.languagesettings = languagesettings
8096	return c
8097}
8098
8099// Fields allows partial responses to be retrieved. See
8100// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
8101// for more information.
8102func (c *UsersSettingsUpdateLanguageCall) Fields(s ...googleapi.Field) *UsersSettingsUpdateLanguageCall {
8103	c.urlParams_.Set("fields", googleapi.CombineFields(s))
8104	return c
8105}
8106
8107// Context sets the context to be used in this call's Do method. Any
8108// pending HTTP request will be aborted if the provided context is
8109// canceled.
8110func (c *UsersSettingsUpdateLanguageCall) Context(ctx context.Context) *UsersSettingsUpdateLanguageCall {
8111	c.ctx_ = ctx
8112	return c
8113}
8114
8115// Header returns an http.Header that can be modified by the caller to
8116// add HTTP headers to the request.
8117func (c *UsersSettingsUpdateLanguageCall) Header() http.Header {
8118	if c.header_ == nil {
8119		c.header_ = make(http.Header)
8120	}
8121	return c.header_
8122}
8123
8124func (c *UsersSettingsUpdateLanguageCall) doRequest(alt string) (*http.Response, error) {
8125	reqHeaders := make(http.Header)
8126	for k, v := range c.header_ {
8127		reqHeaders[k] = v
8128	}
8129	reqHeaders.Set("User-Agent", c.s.userAgent())
8130	var body io.Reader = nil
8131	body, err := googleapi.WithoutDataWrapper.JSONReader(c.languagesettings)
8132	if err != nil {
8133		return nil, err
8134	}
8135	reqHeaders.Set("Content-Type", "application/json")
8136	c.urlParams_.Set("alt", alt)
8137	c.urlParams_.Set("prettyPrint", "false")
8138	urls := googleapi.ResolveRelative(c.s.BasePath, "{userId}/settings/language")
8139	urls += "?" + c.urlParams_.Encode()
8140	req, err := http.NewRequest("PUT", urls, body)
8141	if err != nil {
8142		return nil, err
8143	}
8144	req.Header = reqHeaders
8145	googleapi.Expand(req.URL, map[string]string{
8146		"userId": c.userId,
8147	})
8148	return gensupport.SendRequest(c.ctx_, c.s.client, req)
8149}
8150
8151// Do executes the "gmail.users.settings.updateLanguage" call.
8152// Exactly one of *LanguageSettings or error will be non-nil. Any
8153// non-2xx status code is an error. Response headers are in either
8154// *LanguageSettings.ServerResponse.Header or (if a response was
8155// returned at all) in error.(*googleapi.Error).Header. Use
8156// googleapi.IsNotModified to check whether the returned error was
8157// because http.StatusNotModified was returned.
8158func (c *UsersSettingsUpdateLanguageCall) Do(opts ...googleapi.CallOption) (*LanguageSettings, error) {
8159	gensupport.SetOptions(c.urlParams_, opts...)
8160	res, err := c.doRequest("json")
8161	if res != nil && res.StatusCode == http.StatusNotModified {
8162		if res.Body != nil {
8163			res.Body.Close()
8164		}
8165		return nil, &googleapi.Error{
8166			Code:   res.StatusCode,
8167			Header: res.Header,
8168		}
8169	}
8170	if err != nil {
8171		return nil, err
8172	}
8173	defer googleapi.CloseBody(res)
8174	if err := googleapi.CheckResponse(res); err != nil {
8175		return nil, err
8176	}
8177	ret := &LanguageSettings{
8178		ServerResponse: googleapi.ServerResponse{
8179			Header:         res.Header,
8180			HTTPStatusCode: res.StatusCode,
8181		},
8182	}
8183	target := &ret
8184	if err := gensupport.DecodeResponse(target, res); err != nil {
8185		return nil, err
8186	}
8187	return ret, nil
8188	// {
8189	//   "description": "Updates language settings.\n\nIf successful, the return object contains the displayLanguage that was saved for the user, which may differ from the value passed into the request. This is because the requested displayLanguage may not be directly supported by Gmail but have a close variant that is, and so the variant may be chosen and saved instead.",
8190	//   "httpMethod": "PUT",
8191	//   "id": "gmail.users.settings.updateLanguage",
8192	//   "parameterOrder": [
8193	//     "userId"
8194	//   ],
8195	//   "parameters": {
8196	//     "userId": {
8197	//       "default": "me",
8198	//       "description": "User's email address. The special value \"me\" can be used to indicate the authenticated user.",
8199	//       "location": "path",
8200	//       "required": true,
8201	//       "type": "string"
8202	//     }
8203	//   },
8204	//   "path": "{userId}/settings/language",
8205	//   "request": {
8206	//     "$ref": "LanguageSettings"
8207	//   },
8208	//   "response": {
8209	//     "$ref": "LanguageSettings"
8210	//   },
8211	//   "scopes": [
8212	//     "https://www.googleapis.com/auth/gmail.settings.basic"
8213	//   ]
8214	// }
8215
8216}
8217
8218// method id "gmail.users.settings.updatePop":
8219
8220type UsersSettingsUpdatePopCall struct {
8221	s           *Service
8222	userId      string
8223	popsettings *PopSettings
8224	urlParams_  gensupport.URLParams
8225	ctx_        context.Context
8226	header_     http.Header
8227}
8228
8229// UpdatePop: Updates POP settings.
8230func (r *UsersSettingsService) UpdatePop(userId string, popsettings *PopSettings) *UsersSettingsUpdatePopCall {
8231	c := &UsersSettingsUpdatePopCall{s: r.s, urlParams_: make(gensupport.URLParams)}
8232	c.userId = userId
8233	c.popsettings = popsettings
8234	return c
8235}
8236
8237// Fields allows partial responses to be retrieved. See
8238// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
8239// for more information.
8240func (c *UsersSettingsUpdatePopCall) Fields(s ...googleapi.Field) *UsersSettingsUpdatePopCall {
8241	c.urlParams_.Set("fields", googleapi.CombineFields(s))
8242	return c
8243}
8244
8245// Context sets the context to be used in this call's Do method. Any
8246// pending HTTP request will be aborted if the provided context is
8247// canceled.
8248func (c *UsersSettingsUpdatePopCall) Context(ctx context.Context) *UsersSettingsUpdatePopCall {
8249	c.ctx_ = ctx
8250	return c
8251}
8252
8253// Header returns an http.Header that can be modified by the caller to
8254// add HTTP headers to the request.
8255func (c *UsersSettingsUpdatePopCall) Header() http.Header {
8256	if c.header_ == nil {
8257		c.header_ = make(http.Header)
8258	}
8259	return c.header_
8260}
8261
8262func (c *UsersSettingsUpdatePopCall) doRequest(alt string) (*http.Response, error) {
8263	reqHeaders := make(http.Header)
8264	for k, v := range c.header_ {
8265		reqHeaders[k] = v
8266	}
8267	reqHeaders.Set("User-Agent", c.s.userAgent())
8268	var body io.Reader = nil
8269	body, err := googleapi.WithoutDataWrapper.JSONReader(c.popsettings)
8270	if err != nil {
8271		return nil, err
8272	}
8273	reqHeaders.Set("Content-Type", "application/json")
8274	c.urlParams_.Set("alt", alt)
8275	c.urlParams_.Set("prettyPrint", "false")
8276	urls := googleapi.ResolveRelative(c.s.BasePath, "{userId}/settings/pop")
8277	urls += "?" + c.urlParams_.Encode()
8278	req, err := http.NewRequest("PUT", urls, body)
8279	if err != nil {
8280		return nil, err
8281	}
8282	req.Header = reqHeaders
8283	googleapi.Expand(req.URL, map[string]string{
8284		"userId": c.userId,
8285	})
8286	return gensupport.SendRequest(c.ctx_, c.s.client, req)
8287}
8288
8289// Do executes the "gmail.users.settings.updatePop" call.
8290// Exactly one of *PopSettings or error will be non-nil. Any non-2xx
8291// status code is an error. Response headers are in either
8292// *PopSettings.ServerResponse.Header or (if a response was returned at
8293// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
8294// to check whether the returned error was because
8295// http.StatusNotModified was returned.
8296func (c *UsersSettingsUpdatePopCall) Do(opts ...googleapi.CallOption) (*PopSettings, error) {
8297	gensupport.SetOptions(c.urlParams_, opts...)
8298	res, err := c.doRequest("json")
8299	if res != nil && res.StatusCode == http.StatusNotModified {
8300		if res.Body != nil {
8301			res.Body.Close()
8302		}
8303		return nil, &googleapi.Error{
8304			Code:   res.StatusCode,
8305			Header: res.Header,
8306		}
8307	}
8308	if err != nil {
8309		return nil, err
8310	}
8311	defer googleapi.CloseBody(res)
8312	if err := googleapi.CheckResponse(res); err != nil {
8313		return nil, err
8314	}
8315	ret := &PopSettings{
8316		ServerResponse: googleapi.ServerResponse{
8317			Header:         res.Header,
8318			HTTPStatusCode: res.StatusCode,
8319		},
8320	}
8321	target := &ret
8322	if err := gensupport.DecodeResponse(target, res); err != nil {
8323		return nil, err
8324	}
8325	return ret, nil
8326	// {
8327	//   "description": "Updates POP settings.",
8328	//   "httpMethod": "PUT",
8329	//   "id": "gmail.users.settings.updatePop",
8330	//   "parameterOrder": [
8331	//     "userId"
8332	//   ],
8333	//   "parameters": {
8334	//     "userId": {
8335	//       "default": "me",
8336	//       "description": "User's email address. The special value \"me\" can be used to indicate the authenticated user.",
8337	//       "location": "path",
8338	//       "required": true,
8339	//       "type": "string"
8340	//     }
8341	//   },
8342	//   "path": "{userId}/settings/pop",
8343	//   "request": {
8344	//     "$ref": "PopSettings"
8345	//   },
8346	//   "response": {
8347	//     "$ref": "PopSettings"
8348	//   },
8349	//   "scopes": [
8350	//     "https://www.googleapis.com/auth/gmail.settings.basic"
8351	//   ]
8352	// }
8353
8354}
8355
8356// method id "gmail.users.settings.updateVacation":
8357
8358type UsersSettingsUpdateVacationCall struct {
8359	s                *Service
8360	userId           string
8361	vacationsettings *VacationSettings
8362	urlParams_       gensupport.URLParams
8363	ctx_             context.Context
8364	header_          http.Header
8365}
8366
8367// UpdateVacation: Updates vacation responder settings.
8368func (r *UsersSettingsService) UpdateVacation(userId string, vacationsettings *VacationSettings) *UsersSettingsUpdateVacationCall {
8369	c := &UsersSettingsUpdateVacationCall{s: r.s, urlParams_: make(gensupport.URLParams)}
8370	c.userId = userId
8371	c.vacationsettings = vacationsettings
8372	return c
8373}
8374
8375// Fields allows partial responses to be retrieved. See
8376// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
8377// for more information.
8378func (c *UsersSettingsUpdateVacationCall) Fields(s ...googleapi.Field) *UsersSettingsUpdateVacationCall {
8379	c.urlParams_.Set("fields", googleapi.CombineFields(s))
8380	return c
8381}
8382
8383// Context sets the context to be used in this call's Do method. Any
8384// pending HTTP request will be aborted if the provided context is
8385// canceled.
8386func (c *UsersSettingsUpdateVacationCall) Context(ctx context.Context) *UsersSettingsUpdateVacationCall {
8387	c.ctx_ = ctx
8388	return c
8389}
8390
8391// Header returns an http.Header that can be modified by the caller to
8392// add HTTP headers to the request.
8393func (c *UsersSettingsUpdateVacationCall) Header() http.Header {
8394	if c.header_ == nil {
8395		c.header_ = make(http.Header)
8396	}
8397	return c.header_
8398}
8399
8400func (c *UsersSettingsUpdateVacationCall) doRequest(alt string) (*http.Response, error) {
8401	reqHeaders := make(http.Header)
8402	for k, v := range c.header_ {
8403		reqHeaders[k] = v
8404	}
8405	reqHeaders.Set("User-Agent", c.s.userAgent())
8406	var body io.Reader = nil
8407	body, err := googleapi.WithoutDataWrapper.JSONReader(c.vacationsettings)
8408	if err != nil {
8409		return nil, err
8410	}
8411	reqHeaders.Set("Content-Type", "application/json")
8412	c.urlParams_.Set("alt", alt)
8413	c.urlParams_.Set("prettyPrint", "false")
8414	urls := googleapi.ResolveRelative(c.s.BasePath, "{userId}/settings/vacation")
8415	urls += "?" + c.urlParams_.Encode()
8416	req, err := http.NewRequest("PUT", urls, body)
8417	if err != nil {
8418		return nil, err
8419	}
8420	req.Header = reqHeaders
8421	googleapi.Expand(req.URL, map[string]string{
8422		"userId": c.userId,
8423	})
8424	return gensupport.SendRequest(c.ctx_, c.s.client, req)
8425}
8426
8427// Do executes the "gmail.users.settings.updateVacation" call.
8428// Exactly one of *VacationSettings or error will be non-nil. Any
8429// non-2xx status code is an error. Response headers are in either
8430// *VacationSettings.ServerResponse.Header or (if a response was
8431// returned at all) in error.(*googleapi.Error).Header. Use
8432// googleapi.IsNotModified to check whether the returned error was
8433// because http.StatusNotModified was returned.
8434func (c *UsersSettingsUpdateVacationCall) Do(opts ...googleapi.CallOption) (*VacationSettings, error) {
8435	gensupport.SetOptions(c.urlParams_, opts...)
8436	res, err := c.doRequest("json")
8437	if res != nil && res.StatusCode == http.StatusNotModified {
8438		if res.Body != nil {
8439			res.Body.Close()
8440		}
8441		return nil, &googleapi.Error{
8442			Code:   res.StatusCode,
8443			Header: res.Header,
8444		}
8445	}
8446	if err != nil {
8447		return nil, err
8448	}
8449	defer googleapi.CloseBody(res)
8450	if err := googleapi.CheckResponse(res); err != nil {
8451		return nil, err
8452	}
8453	ret := &VacationSettings{
8454		ServerResponse: googleapi.ServerResponse{
8455			Header:         res.Header,
8456			HTTPStatusCode: res.StatusCode,
8457		},
8458	}
8459	target := &ret
8460	if err := gensupport.DecodeResponse(target, res); err != nil {
8461		return nil, err
8462	}
8463	return ret, nil
8464	// {
8465	//   "description": "Updates vacation responder settings.",
8466	//   "httpMethod": "PUT",
8467	//   "id": "gmail.users.settings.updateVacation",
8468	//   "parameterOrder": [
8469	//     "userId"
8470	//   ],
8471	//   "parameters": {
8472	//     "userId": {
8473	//       "default": "me",
8474	//       "description": "User's email address. The special value \"me\" can be used to indicate the authenticated user.",
8475	//       "location": "path",
8476	//       "required": true,
8477	//       "type": "string"
8478	//     }
8479	//   },
8480	//   "path": "{userId}/settings/vacation",
8481	//   "request": {
8482	//     "$ref": "VacationSettings"
8483	//   },
8484	//   "response": {
8485	//     "$ref": "VacationSettings"
8486	//   },
8487	//   "scopes": [
8488	//     "https://www.googleapis.com/auth/gmail.settings.basic"
8489	//   ]
8490	// }
8491
8492}
8493
8494// method id "gmail.users.settings.delegates.create":
8495
8496type UsersSettingsDelegatesCreateCall struct {
8497	s          *Service
8498	userId     string
8499	delegate   *Delegate
8500	urlParams_ gensupport.URLParams
8501	ctx_       context.Context
8502	header_    http.Header
8503}
8504
8505// Create: Adds a delegate with its verification status set directly to
8506// accepted, without sending any verification email. The delegate user
8507// must be a member of the same G Suite organization as the delegator
8508// user.
8509//
8510// Gmail imposes limtations on the number of delegates and delegators
8511// each user in a G Suite organization can have. These limits depend on
8512// your organization, but in general each user can have up to 25
8513// delegates and up to 10 delegators.
8514//
8515// Note that a delegate user must be referred to by their primary email
8516// address, and not an email alias.
8517//
8518// Also note that when a new delegate is created, there may be up to a
8519// one minute delay before the new delegate is available for use.
8520//
8521// This method is only available to service account clients that have
8522// been delegated domain-wide authority.
8523func (r *UsersSettingsDelegatesService) Create(userId string, delegate *Delegate) *UsersSettingsDelegatesCreateCall {
8524	c := &UsersSettingsDelegatesCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
8525	c.userId = userId
8526	c.delegate = delegate
8527	return c
8528}
8529
8530// Fields allows partial responses to be retrieved. See
8531// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
8532// for more information.
8533func (c *UsersSettingsDelegatesCreateCall) Fields(s ...googleapi.Field) *UsersSettingsDelegatesCreateCall {
8534	c.urlParams_.Set("fields", googleapi.CombineFields(s))
8535	return c
8536}
8537
8538// Context sets the context to be used in this call's Do method. Any
8539// pending HTTP request will be aborted if the provided context is
8540// canceled.
8541func (c *UsersSettingsDelegatesCreateCall) Context(ctx context.Context) *UsersSettingsDelegatesCreateCall {
8542	c.ctx_ = ctx
8543	return c
8544}
8545
8546// Header returns an http.Header that can be modified by the caller to
8547// add HTTP headers to the request.
8548func (c *UsersSettingsDelegatesCreateCall) Header() http.Header {
8549	if c.header_ == nil {
8550		c.header_ = make(http.Header)
8551	}
8552	return c.header_
8553}
8554
8555func (c *UsersSettingsDelegatesCreateCall) doRequest(alt string) (*http.Response, error) {
8556	reqHeaders := make(http.Header)
8557	for k, v := range c.header_ {
8558		reqHeaders[k] = v
8559	}
8560	reqHeaders.Set("User-Agent", c.s.userAgent())
8561	var body io.Reader = nil
8562	body, err := googleapi.WithoutDataWrapper.JSONReader(c.delegate)
8563	if err != nil {
8564		return nil, err
8565	}
8566	reqHeaders.Set("Content-Type", "application/json")
8567	c.urlParams_.Set("alt", alt)
8568	c.urlParams_.Set("prettyPrint", "false")
8569	urls := googleapi.ResolveRelative(c.s.BasePath, "{userId}/settings/delegates")
8570	urls += "?" + c.urlParams_.Encode()
8571	req, err := http.NewRequest("POST", urls, body)
8572	if err != nil {
8573		return nil, err
8574	}
8575	req.Header = reqHeaders
8576	googleapi.Expand(req.URL, map[string]string{
8577		"userId": c.userId,
8578	})
8579	return gensupport.SendRequest(c.ctx_, c.s.client, req)
8580}
8581
8582// Do executes the "gmail.users.settings.delegates.create" call.
8583// Exactly one of *Delegate or error will be non-nil. Any non-2xx status
8584// code is an error. Response headers are in either
8585// *Delegate.ServerResponse.Header or (if a response was returned at
8586// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
8587// to check whether the returned error was because
8588// http.StatusNotModified was returned.
8589func (c *UsersSettingsDelegatesCreateCall) Do(opts ...googleapi.CallOption) (*Delegate, error) {
8590	gensupport.SetOptions(c.urlParams_, opts...)
8591	res, err := c.doRequest("json")
8592	if res != nil && res.StatusCode == http.StatusNotModified {
8593		if res.Body != nil {
8594			res.Body.Close()
8595		}
8596		return nil, &googleapi.Error{
8597			Code:   res.StatusCode,
8598			Header: res.Header,
8599		}
8600	}
8601	if err != nil {
8602		return nil, err
8603	}
8604	defer googleapi.CloseBody(res)
8605	if err := googleapi.CheckResponse(res); err != nil {
8606		return nil, err
8607	}
8608	ret := &Delegate{
8609		ServerResponse: googleapi.ServerResponse{
8610			Header:         res.Header,
8611			HTTPStatusCode: res.StatusCode,
8612		},
8613	}
8614	target := &ret
8615	if err := gensupport.DecodeResponse(target, res); err != nil {
8616		return nil, err
8617	}
8618	return ret, nil
8619	// {
8620	//   "description": "Adds a delegate with its verification status set directly to accepted, without sending any verification email. The delegate user must be a member of the same G Suite organization as the delegator user.\n\nGmail imposes limtations on the number of delegates and delegators each user in a G Suite organization can have. These limits depend on your organization, but in general each user can have up to 25 delegates and up to 10 delegators.\n\nNote that a delegate user must be referred to by their primary email address, and not an email alias.\n\nAlso note that when a new delegate is created, there may be up to a one minute delay before the new delegate is available for use.\n\nThis method is only available to service account clients that have been delegated domain-wide authority.",
8621	//   "httpMethod": "POST",
8622	//   "id": "gmail.users.settings.delegates.create",
8623	//   "parameterOrder": [
8624	//     "userId"
8625	//   ],
8626	//   "parameters": {
8627	//     "userId": {
8628	//       "default": "me",
8629	//       "description": "User's email address. The special value \"me\" can be used to indicate the authenticated user.",
8630	//       "location": "path",
8631	//       "required": true,
8632	//       "type": "string"
8633	//     }
8634	//   },
8635	//   "path": "{userId}/settings/delegates",
8636	//   "request": {
8637	//     "$ref": "Delegate"
8638	//   },
8639	//   "response": {
8640	//     "$ref": "Delegate"
8641	//   },
8642	//   "scopes": [
8643	//     "https://www.googleapis.com/auth/gmail.settings.sharing"
8644	//   ]
8645	// }
8646
8647}
8648
8649// method id "gmail.users.settings.delegates.delete":
8650
8651type UsersSettingsDelegatesDeleteCall struct {
8652	s             *Service
8653	userId        string
8654	delegateEmail string
8655	urlParams_    gensupport.URLParams
8656	ctx_          context.Context
8657	header_       http.Header
8658}
8659
8660// Delete: Removes the specified delegate (which can be of any
8661// verification status), and revokes any verification that may have been
8662// required for using it.
8663//
8664// Note that a delegate user must be referred to by their primary email
8665// address, and not an email alias.
8666//
8667// This method is only available to service account clients that have
8668// been delegated domain-wide authority.
8669func (r *UsersSettingsDelegatesService) Delete(userId string, delegateEmail string) *UsersSettingsDelegatesDeleteCall {
8670	c := &UsersSettingsDelegatesDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
8671	c.userId = userId
8672	c.delegateEmail = delegateEmail
8673	return c
8674}
8675
8676// Fields allows partial responses to be retrieved. See
8677// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
8678// for more information.
8679func (c *UsersSettingsDelegatesDeleteCall) Fields(s ...googleapi.Field) *UsersSettingsDelegatesDeleteCall {
8680	c.urlParams_.Set("fields", googleapi.CombineFields(s))
8681	return c
8682}
8683
8684// Context sets the context to be used in this call's Do method. Any
8685// pending HTTP request will be aborted if the provided context is
8686// canceled.
8687func (c *UsersSettingsDelegatesDeleteCall) Context(ctx context.Context) *UsersSettingsDelegatesDeleteCall {
8688	c.ctx_ = ctx
8689	return c
8690}
8691
8692// Header returns an http.Header that can be modified by the caller to
8693// add HTTP headers to the request.
8694func (c *UsersSettingsDelegatesDeleteCall) Header() http.Header {
8695	if c.header_ == nil {
8696		c.header_ = make(http.Header)
8697	}
8698	return c.header_
8699}
8700
8701func (c *UsersSettingsDelegatesDeleteCall) doRequest(alt string) (*http.Response, error) {
8702	reqHeaders := make(http.Header)
8703	for k, v := range c.header_ {
8704		reqHeaders[k] = v
8705	}
8706	reqHeaders.Set("User-Agent", c.s.userAgent())
8707	var body io.Reader = nil
8708	c.urlParams_.Set("alt", alt)
8709	c.urlParams_.Set("prettyPrint", "false")
8710	urls := googleapi.ResolveRelative(c.s.BasePath, "{userId}/settings/delegates/{delegateEmail}")
8711	urls += "?" + c.urlParams_.Encode()
8712	req, err := http.NewRequest("DELETE", urls, body)
8713	if err != nil {
8714		return nil, err
8715	}
8716	req.Header = reqHeaders
8717	googleapi.Expand(req.URL, map[string]string{
8718		"userId":        c.userId,
8719		"delegateEmail": c.delegateEmail,
8720	})
8721	return gensupport.SendRequest(c.ctx_, c.s.client, req)
8722}
8723
8724// Do executes the "gmail.users.settings.delegates.delete" call.
8725func (c *UsersSettingsDelegatesDeleteCall) Do(opts ...googleapi.CallOption) error {
8726	gensupport.SetOptions(c.urlParams_, opts...)
8727	res, err := c.doRequest("json")
8728	if err != nil {
8729		return err
8730	}
8731	defer googleapi.CloseBody(res)
8732	if err := googleapi.CheckResponse(res); err != nil {
8733		return err
8734	}
8735	return nil
8736	// {
8737	//   "description": "Removes the specified delegate (which can be of any verification status), and revokes any verification that may have been required for using it.\n\nNote that a delegate user must be referred to by their primary email address, and not an email alias.\n\nThis method is only available to service account clients that have been delegated domain-wide authority.",
8738	//   "httpMethod": "DELETE",
8739	//   "id": "gmail.users.settings.delegates.delete",
8740	//   "parameterOrder": [
8741	//     "userId",
8742	//     "delegateEmail"
8743	//   ],
8744	//   "parameters": {
8745	//     "delegateEmail": {
8746	//       "description": "The email address of the user to be removed as a delegate.",
8747	//       "location": "path",
8748	//       "required": true,
8749	//       "type": "string"
8750	//     },
8751	//     "userId": {
8752	//       "default": "me",
8753	//       "description": "User's email address. The special value \"me\" can be used to indicate the authenticated user.",
8754	//       "location": "path",
8755	//       "required": true,
8756	//       "type": "string"
8757	//     }
8758	//   },
8759	//   "path": "{userId}/settings/delegates/{delegateEmail}",
8760	//   "scopes": [
8761	//     "https://www.googleapis.com/auth/gmail.settings.sharing"
8762	//   ]
8763	// }
8764
8765}
8766
8767// method id "gmail.users.settings.delegates.get":
8768
8769type UsersSettingsDelegatesGetCall struct {
8770	s             *Service
8771	userId        string
8772	delegateEmail string
8773	urlParams_    gensupport.URLParams
8774	ifNoneMatch_  string
8775	ctx_          context.Context
8776	header_       http.Header
8777}
8778
8779// Get: Gets the specified delegate.
8780//
8781// Note that a delegate user must be referred to by their primary email
8782// address, and not an email alias.
8783//
8784// This method is only available to service account clients that have
8785// been delegated domain-wide authority.
8786func (r *UsersSettingsDelegatesService) Get(userId string, delegateEmail string) *UsersSettingsDelegatesGetCall {
8787	c := &UsersSettingsDelegatesGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
8788	c.userId = userId
8789	c.delegateEmail = delegateEmail
8790	return c
8791}
8792
8793// Fields allows partial responses to be retrieved. See
8794// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
8795// for more information.
8796func (c *UsersSettingsDelegatesGetCall) Fields(s ...googleapi.Field) *UsersSettingsDelegatesGetCall {
8797	c.urlParams_.Set("fields", googleapi.CombineFields(s))
8798	return c
8799}
8800
8801// IfNoneMatch sets the optional parameter which makes the operation
8802// fail if the object's ETag matches the given value. This is useful for
8803// getting updates only after the object has changed since the last
8804// request. Use googleapi.IsNotModified to check whether the response
8805// error from Do is the result of In-None-Match.
8806func (c *UsersSettingsDelegatesGetCall) IfNoneMatch(entityTag string) *UsersSettingsDelegatesGetCall {
8807	c.ifNoneMatch_ = entityTag
8808	return c
8809}
8810
8811// Context sets the context to be used in this call's Do method. Any
8812// pending HTTP request will be aborted if the provided context is
8813// canceled.
8814func (c *UsersSettingsDelegatesGetCall) Context(ctx context.Context) *UsersSettingsDelegatesGetCall {
8815	c.ctx_ = ctx
8816	return c
8817}
8818
8819// Header returns an http.Header that can be modified by the caller to
8820// add HTTP headers to the request.
8821func (c *UsersSettingsDelegatesGetCall) Header() http.Header {
8822	if c.header_ == nil {
8823		c.header_ = make(http.Header)
8824	}
8825	return c.header_
8826}
8827
8828func (c *UsersSettingsDelegatesGetCall) doRequest(alt string) (*http.Response, error) {
8829	reqHeaders := make(http.Header)
8830	for k, v := range c.header_ {
8831		reqHeaders[k] = v
8832	}
8833	reqHeaders.Set("User-Agent", c.s.userAgent())
8834	if c.ifNoneMatch_ != "" {
8835		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
8836	}
8837	var body io.Reader = nil
8838	c.urlParams_.Set("alt", alt)
8839	c.urlParams_.Set("prettyPrint", "false")
8840	urls := googleapi.ResolveRelative(c.s.BasePath, "{userId}/settings/delegates/{delegateEmail}")
8841	urls += "?" + c.urlParams_.Encode()
8842	req, err := http.NewRequest("GET", urls, body)
8843	if err != nil {
8844		return nil, err
8845	}
8846	req.Header = reqHeaders
8847	googleapi.Expand(req.URL, map[string]string{
8848		"userId":        c.userId,
8849		"delegateEmail": c.delegateEmail,
8850	})
8851	return gensupport.SendRequest(c.ctx_, c.s.client, req)
8852}
8853
8854// Do executes the "gmail.users.settings.delegates.get" call.
8855// Exactly one of *Delegate or error will be non-nil. Any non-2xx status
8856// code is an error. Response headers are in either
8857// *Delegate.ServerResponse.Header or (if a response was returned at
8858// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
8859// to check whether the returned error was because
8860// http.StatusNotModified was returned.
8861func (c *UsersSettingsDelegatesGetCall) Do(opts ...googleapi.CallOption) (*Delegate, error) {
8862	gensupport.SetOptions(c.urlParams_, opts...)
8863	res, err := c.doRequest("json")
8864	if res != nil && res.StatusCode == http.StatusNotModified {
8865		if res.Body != nil {
8866			res.Body.Close()
8867		}
8868		return nil, &googleapi.Error{
8869			Code:   res.StatusCode,
8870			Header: res.Header,
8871		}
8872	}
8873	if err != nil {
8874		return nil, err
8875	}
8876	defer googleapi.CloseBody(res)
8877	if err := googleapi.CheckResponse(res); err != nil {
8878		return nil, err
8879	}
8880	ret := &Delegate{
8881		ServerResponse: googleapi.ServerResponse{
8882			Header:         res.Header,
8883			HTTPStatusCode: res.StatusCode,
8884		},
8885	}
8886	target := &ret
8887	if err := gensupport.DecodeResponse(target, res); err != nil {
8888		return nil, err
8889	}
8890	return ret, nil
8891	// {
8892	//   "description": "Gets the specified delegate.\n\nNote that a delegate user must be referred to by their primary email address, and not an email alias.\n\nThis method is only available to service account clients that have been delegated domain-wide authority.",
8893	//   "httpMethod": "GET",
8894	//   "id": "gmail.users.settings.delegates.get",
8895	//   "parameterOrder": [
8896	//     "userId",
8897	//     "delegateEmail"
8898	//   ],
8899	//   "parameters": {
8900	//     "delegateEmail": {
8901	//       "description": "The email address of the user whose delegate relationship is to be retrieved.",
8902	//       "location": "path",
8903	//       "required": true,
8904	//       "type": "string"
8905	//     },
8906	//     "userId": {
8907	//       "default": "me",
8908	//       "description": "User's email address. The special value \"me\" can be used to indicate the authenticated user.",
8909	//       "location": "path",
8910	//       "required": true,
8911	//       "type": "string"
8912	//     }
8913	//   },
8914	//   "path": "{userId}/settings/delegates/{delegateEmail}",
8915	//   "response": {
8916	//     "$ref": "Delegate"
8917	//   },
8918	//   "scopes": [
8919	//     "https://mail.google.com/",
8920	//     "https://www.googleapis.com/auth/gmail.modify",
8921	//     "https://www.googleapis.com/auth/gmail.readonly",
8922	//     "https://www.googleapis.com/auth/gmail.settings.basic"
8923	//   ]
8924	// }
8925
8926}
8927
8928// method id "gmail.users.settings.delegates.list":
8929
8930type UsersSettingsDelegatesListCall struct {
8931	s            *Service
8932	userId       string
8933	urlParams_   gensupport.URLParams
8934	ifNoneMatch_ string
8935	ctx_         context.Context
8936	header_      http.Header
8937}
8938
8939// List: Lists the delegates for the specified account.
8940//
8941// This method is only available to service account clients that have
8942// been delegated domain-wide authority.
8943func (r *UsersSettingsDelegatesService) List(userId string) *UsersSettingsDelegatesListCall {
8944	c := &UsersSettingsDelegatesListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
8945	c.userId = userId
8946	return c
8947}
8948
8949// Fields allows partial responses to be retrieved. See
8950// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
8951// for more information.
8952func (c *UsersSettingsDelegatesListCall) Fields(s ...googleapi.Field) *UsersSettingsDelegatesListCall {
8953	c.urlParams_.Set("fields", googleapi.CombineFields(s))
8954	return c
8955}
8956
8957// IfNoneMatch sets the optional parameter which makes the operation
8958// fail if the object's ETag matches the given value. This is useful for
8959// getting updates only after the object has changed since the last
8960// request. Use googleapi.IsNotModified to check whether the response
8961// error from Do is the result of In-None-Match.
8962func (c *UsersSettingsDelegatesListCall) IfNoneMatch(entityTag string) *UsersSettingsDelegatesListCall {
8963	c.ifNoneMatch_ = entityTag
8964	return c
8965}
8966
8967// Context sets the context to be used in this call's Do method. Any
8968// pending HTTP request will be aborted if the provided context is
8969// canceled.
8970func (c *UsersSettingsDelegatesListCall) Context(ctx context.Context) *UsersSettingsDelegatesListCall {
8971	c.ctx_ = ctx
8972	return c
8973}
8974
8975// Header returns an http.Header that can be modified by the caller to
8976// add HTTP headers to the request.
8977func (c *UsersSettingsDelegatesListCall) Header() http.Header {
8978	if c.header_ == nil {
8979		c.header_ = make(http.Header)
8980	}
8981	return c.header_
8982}
8983
8984func (c *UsersSettingsDelegatesListCall) doRequest(alt string) (*http.Response, error) {
8985	reqHeaders := make(http.Header)
8986	for k, v := range c.header_ {
8987		reqHeaders[k] = v
8988	}
8989	reqHeaders.Set("User-Agent", c.s.userAgent())
8990	if c.ifNoneMatch_ != "" {
8991		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
8992	}
8993	var body io.Reader = nil
8994	c.urlParams_.Set("alt", alt)
8995	c.urlParams_.Set("prettyPrint", "false")
8996	urls := googleapi.ResolveRelative(c.s.BasePath, "{userId}/settings/delegates")
8997	urls += "?" + c.urlParams_.Encode()
8998	req, err := http.NewRequest("GET", urls, body)
8999	if err != nil {
9000		return nil, err
9001	}
9002	req.Header = reqHeaders
9003	googleapi.Expand(req.URL, map[string]string{
9004		"userId": c.userId,
9005	})
9006	return gensupport.SendRequest(c.ctx_, c.s.client, req)
9007}
9008
9009// Do executes the "gmail.users.settings.delegates.list" call.
9010// Exactly one of *ListDelegatesResponse or error will be non-nil. Any
9011// non-2xx status code is an error. Response headers are in either
9012// *ListDelegatesResponse.ServerResponse.Header or (if a response was
9013// returned at all) in error.(*googleapi.Error).Header. Use
9014// googleapi.IsNotModified to check whether the returned error was
9015// because http.StatusNotModified was returned.
9016func (c *UsersSettingsDelegatesListCall) Do(opts ...googleapi.CallOption) (*ListDelegatesResponse, error) {
9017	gensupport.SetOptions(c.urlParams_, opts...)
9018	res, err := c.doRequest("json")
9019	if res != nil && res.StatusCode == http.StatusNotModified {
9020		if res.Body != nil {
9021			res.Body.Close()
9022		}
9023		return nil, &googleapi.Error{
9024			Code:   res.StatusCode,
9025			Header: res.Header,
9026		}
9027	}
9028	if err != nil {
9029		return nil, err
9030	}
9031	defer googleapi.CloseBody(res)
9032	if err := googleapi.CheckResponse(res); err != nil {
9033		return nil, err
9034	}
9035	ret := &ListDelegatesResponse{
9036		ServerResponse: googleapi.ServerResponse{
9037			Header:         res.Header,
9038			HTTPStatusCode: res.StatusCode,
9039		},
9040	}
9041	target := &ret
9042	if err := gensupport.DecodeResponse(target, res); err != nil {
9043		return nil, err
9044	}
9045	return ret, nil
9046	// {
9047	//   "description": "Lists the delegates for the specified account.\n\nThis method is only available to service account clients that have been delegated domain-wide authority.",
9048	//   "httpMethod": "GET",
9049	//   "id": "gmail.users.settings.delegates.list",
9050	//   "parameterOrder": [
9051	//     "userId"
9052	//   ],
9053	//   "parameters": {
9054	//     "userId": {
9055	//       "default": "me",
9056	//       "description": "User's email address. The special value \"me\" can be used to indicate the authenticated user.",
9057	//       "location": "path",
9058	//       "required": true,
9059	//       "type": "string"
9060	//     }
9061	//   },
9062	//   "path": "{userId}/settings/delegates",
9063	//   "response": {
9064	//     "$ref": "ListDelegatesResponse"
9065	//   },
9066	//   "scopes": [
9067	//     "https://mail.google.com/",
9068	//     "https://www.googleapis.com/auth/gmail.modify",
9069	//     "https://www.googleapis.com/auth/gmail.readonly",
9070	//     "https://www.googleapis.com/auth/gmail.settings.basic"
9071	//   ]
9072	// }
9073
9074}
9075
9076// method id "gmail.users.settings.filters.create":
9077
9078type UsersSettingsFiltersCreateCall struct {
9079	s          *Service
9080	userId     string
9081	filter     *Filter
9082	urlParams_ gensupport.URLParams
9083	ctx_       context.Context
9084	header_    http.Header
9085}
9086
9087// Create: Creates a filter.
9088func (r *UsersSettingsFiltersService) Create(userId string, filter *Filter) *UsersSettingsFiltersCreateCall {
9089	c := &UsersSettingsFiltersCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
9090	c.userId = userId
9091	c.filter = filter
9092	return c
9093}
9094
9095// Fields allows partial responses to be retrieved. See
9096// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
9097// for more information.
9098func (c *UsersSettingsFiltersCreateCall) Fields(s ...googleapi.Field) *UsersSettingsFiltersCreateCall {
9099	c.urlParams_.Set("fields", googleapi.CombineFields(s))
9100	return c
9101}
9102
9103// Context sets the context to be used in this call's Do method. Any
9104// pending HTTP request will be aborted if the provided context is
9105// canceled.
9106func (c *UsersSettingsFiltersCreateCall) Context(ctx context.Context) *UsersSettingsFiltersCreateCall {
9107	c.ctx_ = ctx
9108	return c
9109}
9110
9111// Header returns an http.Header that can be modified by the caller to
9112// add HTTP headers to the request.
9113func (c *UsersSettingsFiltersCreateCall) Header() http.Header {
9114	if c.header_ == nil {
9115		c.header_ = make(http.Header)
9116	}
9117	return c.header_
9118}
9119
9120func (c *UsersSettingsFiltersCreateCall) doRequest(alt string) (*http.Response, error) {
9121	reqHeaders := make(http.Header)
9122	for k, v := range c.header_ {
9123		reqHeaders[k] = v
9124	}
9125	reqHeaders.Set("User-Agent", c.s.userAgent())
9126	var body io.Reader = nil
9127	body, err := googleapi.WithoutDataWrapper.JSONReader(c.filter)
9128	if err != nil {
9129		return nil, err
9130	}
9131	reqHeaders.Set("Content-Type", "application/json")
9132	c.urlParams_.Set("alt", alt)
9133	c.urlParams_.Set("prettyPrint", "false")
9134	urls := googleapi.ResolveRelative(c.s.BasePath, "{userId}/settings/filters")
9135	urls += "?" + c.urlParams_.Encode()
9136	req, err := http.NewRequest("POST", urls, body)
9137	if err != nil {
9138		return nil, err
9139	}
9140	req.Header = reqHeaders
9141	googleapi.Expand(req.URL, map[string]string{
9142		"userId": c.userId,
9143	})
9144	return gensupport.SendRequest(c.ctx_, c.s.client, req)
9145}
9146
9147// Do executes the "gmail.users.settings.filters.create" call.
9148// Exactly one of *Filter or error will be non-nil. Any non-2xx status
9149// code is an error. Response headers are in either
9150// *Filter.ServerResponse.Header or (if a response was returned at all)
9151// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
9152// check whether the returned error was because http.StatusNotModified
9153// was returned.
9154func (c *UsersSettingsFiltersCreateCall) Do(opts ...googleapi.CallOption) (*Filter, error) {
9155	gensupport.SetOptions(c.urlParams_, opts...)
9156	res, err := c.doRequest("json")
9157	if res != nil && res.StatusCode == http.StatusNotModified {
9158		if res.Body != nil {
9159			res.Body.Close()
9160		}
9161		return nil, &googleapi.Error{
9162			Code:   res.StatusCode,
9163			Header: res.Header,
9164		}
9165	}
9166	if err != nil {
9167		return nil, err
9168	}
9169	defer googleapi.CloseBody(res)
9170	if err := googleapi.CheckResponse(res); err != nil {
9171		return nil, err
9172	}
9173	ret := &Filter{
9174		ServerResponse: googleapi.ServerResponse{
9175			Header:         res.Header,
9176			HTTPStatusCode: res.StatusCode,
9177		},
9178	}
9179	target := &ret
9180	if err := gensupport.DecodeResponse(target, res); err != nil {
9181		return nil, err
9182	}
9183	return ret, nil
9184	// {
9185	//   "description": "Creates a filter.",
9186	//   "httpMethod": "POST",
9187	//   "id": "gmail.users.settings.filters.create",
9188	//   "parameterOrder": [
9189	//     "userId"
9190	//   ],
9191	//   "parameters": {
9192	//     "userId": {
9193	//       "default": "me",
9194	//       "description": "User's email address. The special value \"me\" can be used to indicate the authenticated user.",
9195	//       "location": "path",
9196	//       "required": true,
9197	//       "type": "string"
9198	//     }
9199	//   },
9200	//   "path": "{userId}/settings/filters",
9201	//   "request": {
9202	//     "$ref": "Filter"
9203	//   },
9204	//   "response": {
9205	//     "$ref": "Filter"
9206	//   },
9207	//   "scopes": [
9208	//     "https://www.googleapis.com/auth/gmail.settings.basic"
9209	//   ]
9210	// }
9211
9212}
9213
9214// method id "gmail.users.settings.filters.delete":
9215
9216type UsersSettingsFiltersDeleteCall struct {
9217	s          *Service
9218	userId     string
9219	id         string
9220	urlParams_ gensupport.URLParams
9221	ctx_       context.Context
9222	header_    http.Header
9223}
9224
9225// Delete: Deletes a filter.
9226func (r *UsersSettingsFiltersService) Delete(userId string, id string) *UsersSettingsFiltersDeleteCall {
9227	c := &UsersSettingsFiltersDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
9228	c.userId = userId
9229	c.id = id
9230	return c
9231}
9232
9233// Fields allows partial responses to be retrieved. See
9234// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
9235// for more information.
9236func (c *UsersSettingsFiltersDeleteCall) Fields(s ...googleapi.Field) *UsersSettingsFiltersDeleteCall {
9237	c.urlParams_.Set("fields", googleapi.CombineFields(s))
9238	return c
9239}
9240
9241// Context sets the context to be used in this call's Do method. Any
9242// pending HTTP request will be aborted if the provided context is
9243// canceled.
9244func (c *UsersSettingsFiltersDeleteCall) Context(ctx context.Context) *UsersSettingsFiltersDeleteCall {
9245	c.ctx_ = ctx
9246	return c
9247}
9248
9249// Header returns an http.Header that can be modified by the caller to
9250// add HTTP headers to the request.
9251func (c *UsersSettingsFiltersDeleteCall) Header() http.Header {
9252	if c.header_ == nil {
9253		c.header_ = make(http.Header)
9254	}
9255	return c.header_
9256}
9257
9258func (c *UsersSettingsFiltersDeleteCall) doRequest(alt string) (*http.Response, error) {
9259	reqHeaders := make(http.Header)
9260	for k, v := range c.header_ {
9261		reqHeaders[k] = v
9262	}
9263	reqHeaders.Set("User-Agent", c.s.userAgent())
9264	var body io.Reader = nil
9265	c.urlParams_.Set("alt", alt)
9266	c.urlParams_.Set("prettyPrint", "false")
9267	urls := googleapi.ResolveRelative(c.s.BasePath, "{userId}/settings/filters/{id}")
9268	urls += "?" + c.urlParams_.Encode()
9269	req, err := http.NewRequest("DELETE", urls, body)
9270	if err != nil {
9271		return nil, err
9272	}
9273	req.Header = reqHeaders
9274	googleapi.Expand(req.URL, map[string]string{
9275		"userId": c.userId,
9276		"id":     c.id,
9277	})
9278	return gensupport.SendRequest(c.ctx_, c.s.client, req)
9279}
9280
9281// Do executes the "gmail.users.settings.filters.delete" call.
9282func (c *UsersSettingsFiltersDeleteCall) Do(opts ...googleapi.CallOption) error {
9283	gensupport.SetOptions(c.urlParams_, opts...)
9284	res, err := c.doRequest("json")
9285	if err != nil {
9286		return err
9287	}
9288	defer googleapi.CloseBody(res)
9289	if err := googleapi.CheckResponse(res); err != nil {
9290		return err
9291	}
9292	return nil
9293	// {
9294	//   "description": "Deletes a filter.",
9295	//   "httpMethod": "DELETE",
9296	//   "id": "gmail.users.settings.filters.delete",
9297	//   "parameterOrder": [
9298	//     "userId",
9299	//     "id"
9300	//   ],
9301	//   "parameters": {
9302	//     "id": {
9303	//       "description": "The ID of the filter to be deleted.",
9304	//       "location": "path",
9305	//       "required": true,
9306	//       "type": "string"
9307	//     },
9308	//     "userId": {
9309	//       "default": "me",
9310	//       "description": "User's email address. The special value \"me\" can be used to indicate the authenticated user.",
9311	//       "location": "path",
9312	//       "required": true,
9313	//       "type": "string"
9314	//     }
9315	//   },
9316	//   "path": "{userId}/settings/filters/{id}",
9317	//   "scopes": [
9318	//     "https://www.googleapis.com/auth/gmail.settings.basic"
9319	//   ]
9320	// }
9321
9322}
9323
9324// method id "gmail.users.settings.filters.get":
9325
9326type UsersSettingsFiltersGetCall struct {
9327	s            *Service
9328	userId       string
9329	id           string
9330	urlParams_   gensupport.URLParams
9331	ifNoneMatch_ string
9332	ctx_         context.Context
9333	header_      http.Header
9334}
9335
9336// Get: Gets a filter.
9337func (r *UsersSettingsFiltersService) Get(userId string, id string) *UsersSettingsFiltersGetCall {
9338	c := &UsersSettingsFiltersGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
9339	c.userId = userId
9340	c.id = id
9341	return c
9342}
9343
9344// Fields allows partial responses to be retrieved. See
9345// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
9346// for more information.
9347func (c *UsersSettingsFiltersGetCall) Fields(s ...googleapi.Field) *UsersSettingsFiltersGetCall {
9348	c.urlParams_.Set("fields", googleapi.CombineFields(s))
9349	return c
9350}
9351
9352// IfNoneMatch sets the optional parameter which makes the operation
9353// fail if the object's ETag matches the given value. This is useful for
9354// getting updates only after the object has changed since the last
9355// request. Use googleapi.IsNotModified to check whether the response
9356// error from Do is the result of In-None-Match.
9357func (c *UsersSettingsFiltersGetCall) IfNoneMatch(entityTag string) *UsersSettingsFiltersGetCall {
9358	c.ifNoneMatch_ = entityTag
9359	return c
9360}
9361
9362// Context sets the context to be used in this call's Do method. Any
9363// pending HTTP request will be aborted if the provided context is
9364// canceled.
9365func (c *UsersSettingsFiltersGetCall) Context(ctx context.Context) *UsersSettingsFiltersGetCall {
9366	c.ctx_ = ctx
9367	return c
9368}
9369
9370// Header returns an http.Header that can be modified by the caller to
9371// add HTTP headers to the request.
9372func (c *UsersSettingsFiltersGetCall) Header() http.Header {
9373	if c.header_ == nil {
9374		c.header_ = make(http.Header)
9375	}
9376	return c.header_
9377}
9378
9379func (c *UsersSettingsFiltersGetCall) doRequest(alt string) (*http.Response, error) {
9380	reqHeaders := make(http.Header)
9381	for k, v := range c.header_ {
9382		reqHeaders[k] = v
9383	}
9384	reqHeaders.Set("User-Agent", c.s.userAgent())
9385	if c.ifNoneMatch_ != "" {
9386		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
9387	}
9388	var body io.Reader = nil
9389	c.urlParams_.Set("alt", alt)
9390	c.urlParams_.Set("prettyPrint", "false")
9391	urls := googleapi.ResolveRelative(c.s.BasePath, "{userId}/settings/filters/{id}")
9392	urls += "?" + c.urlParams_.Encode()
9393	req, err := http.NewRequest("GET", urls, body)
9394	if err != nil {
9395		return nil, err
9396	}
9397	req.Header = reqHeaders
9398	googleapi.Expand(req.URL, map[string]string{
9399		"userId": c.userId,
9400		"id":     c.id,
9401	})
9402	return gensupport.SendRequest(c.ctx_, c.s.client, req)
9403}
9404
9405// Do executes the "gmail.users.settings.filters.get" call.
9406// Exactly one of *Filter or error will be non-nil. Any non-2xx status
9407// code is an error. Response headers are in either
9408// *Filter.ServerResponse.Header or (if a response was returned at all)
9409// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
9410// check whether the returned error was because http.StatusNotModified
9411// was returned.
9412func (c *UsersSettingsFiltersGetCall) Do(opts ...googleapi.CallOption) (*Filter, error) {
9413	gensupport.SetOptions(c.urlParams_, opts...)
9414	res, err := c.doRequest("json")
9415	if res != nil && res.StatusCode == http.StatusNotModified {
9416		if res.Body != nil {
9417			res.Body.Close()
9418		}
9419		return nil, &googleapi.Error{
9420			Code:   res.StatusCode,
9421			Header: res.Header,
9422		}
9423	}
9424	if err != nil {
9425		return nil, err
9426	}
9427	defer googleapi.CloseBody(res)
9428	if err := googleapi.CheckResponse(res); err != nil {
9429		return nil, err
9430	}
9431	ret := &Filter{
9432		ServerResponse: googleapi.ServerResponse{
9433			Header:         res.Header,
9434			HTTPStatusCode: res.StatusCode,
9435		},
9436	}
9437	target := &ret
9438	if err := gensupport.DecodeResponse(target, res); err != nil {
9439		return nil, err
9440	}
9441	return ret, nil
9442	// {
9443	//   "description": "Gets a filter.",
9444	//   "httpMethod": "GET",
9445	//   "id": "gmail.users.settings.filters.get",
9446	//   "parameterOrder": [
9447	//     "userId",
9448	//     "id"
9449	//   ],
9450	//   "parameters": {
9451	//     "id": {
9452	//       "description": "The ID of the filter to be fetched.",
9453	//       "location": "path",
9454	//       "required": true,
9455	//       "type": "string"
9456	//     },
9457	//     "userId": {
9458	//       "default": "me",
9459	//       "description": "User's email address. The special value \"me\" can be used to indicate the authenticated user.",
9460	//       "location": "path",
9461	//       "required": true,
9462	//       "type": "string"
9463	//     }
9464	//   },
9465	//   "path": "{userId}/settings/filters/{id}",
9466	//   "response": {
9467	//     "$ref": "Filter"
9468	//   },
9469	//   "scopes": [
9470	//     "https://mail.google.com/",
9471	//     "https://www.googleapis.com/auth/gmail.modify",
9472	//     "https://www.googleapis.com/auth/gmail.readonly",
9473	//     "https://www.googleapis.com/auth/gmail.settings.basic"
9474	//   ]
9475	// }
9476
9477}
9478
9479// method id "gmail.users.settings.filters.list":
9480
9481type UsersSettingsFiltersListCall struct {
9482	s            *Service
9483	userId       string
9484	urlParams_   gensupport.URLParams
9485	ifNoneMatch_ string
9486	ctx_         context.Context
9487	header_      http.Header
9488}
9489
9490// List: Lists the message filters of a Gmail user.
9491func (r *UsersSettingsFiltersService) List(userId string) *UsersSettingsFiltersListCall {
9492	c := &UsersSettingsFiltersListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
9493	c.userId = userId
9494	return c
9495}
9496
9497// Fields allows partial responses to be retrieved. See
9498// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
9499// for more information.
9500func (c *UsersSettingsFiltersListCall) Fields(s ...googleapi.Field) *UsersSettingsFiltersListCall {
9501	c.urlParams_.Set("fields", googleapi.CombineFields(s))
9502	return c
9503}
9504
9505// IfNoneMatch sets the optional parameter which makes the operation
9506// fail if the object's ETag matches the given value. This is useful for
9507// getting updates only after the object has changed since the last
9508// request. Use googleapi.IsNotModified to check whether the response
9509// error from Do is the result of In-None-Match.
9510func (c *UsersSettingsFiltersListCall) IfNoneMatch(entityTag string) *UsersSettingsFiltersListCall {
9511	c.ifNoneMatch_ = entityTag
9512	return c
9513}
9514
9515// Context sets the context to be used in this call's Do method. Any
9516// pending HTTP request will be aborted if the provided context is
9517// canceled.
9518func (c *UsersSettingsFiltersListCall) Context(ctx context.Context) *UsersSettingsFiltersListCall {
9519	c.ctx_ = ctx
9520	return c
9521}
9522
9523// Header returns an http.Header that can be modified by the caller to
9524// add HTTP headers to the request.
9525func (c *UsersSettingsFiltersListCall) Header() http.Header {
9526	if c.header_ == nil {
9527		c.header_ = make(http.Header)
9528	}
9529	return c.header_
9530}
9531
9532func (c *UsersSettingsFiltersListCall) doRequest(alt string) (*http.Response, error) {
9533	reqHeaders := make(http.Header)
9534	for k, v := range c.header_ {
9535		reqHeaders[k] = v
9536	}
9537	reqHeaders.Set("User-Agent", c.s.userAgent())
9538	if c.ifNoneMatch_ != "" {
9539		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
9540	}
9541	var body io.Reader = nil
9542	c.urlParams_.Set("alt", alt)
9543	c.urlParams_.Set("prettyPrint", "false")
9544	urls := googleapi.ResolveRelative(c.s.BasePath, "{userId}/settings/filters")
9545	urls += "?" + c.urlParams_.Encode()
9546	req, err := http.NewRequest("GET", urls, body)
9547	if err != nil {
9548		return nil, err
9549	}
9550	req.Header = reqHeaders
9551	googleapi.Expand(req.URL, map[string]string{
9552		"userId": c.userId,
9553	})
9554	return gensupport.SendRequest(c.ctx_, c.s.client, req)
9555}
9556
9557// Do executes the "gmail.users.settings.filters.list" call.
9558// Exactly one of *ListFiltersResponse or error will be non-nil. Any
9559// non-2xx status code is an error. Response headers are in either
9560// *ListFiltersResponse.ServerResponse.Header or (if a response was
9561// returned at all) in error.(*googleapi.Error).Header. Use
9562// googleapi.IsNotModified to check whether the returned error was
9563// because http.StatusNotModified was returned.
9564func (c *UsersSettingsFiltersListCall) Do(opts ...googleapi.CallOption) (*ListFiltersResponse, error) {
9565	gensupport.SetOptions(c.urlParams_, opts...)
9566	res, err := c.doRequest("json")
9567	if res != nil && res.StatusCode == http.StatusNotModified {
9568		if res.Body != nil {
9569			res.Body.Close()
9570		}
9571		return nil, &googleapi.Error{
9572			Code:   res.StatusCode,
9573			Header: res.Header,
9574		}
9575	}
9576	if err != nil {
9577		return nil, err
9578	}
9579	defer googleapi.CloseBody(res)
9580	if err := googleapi.CheckResponse(res); err != nil {
9581		return nil, err
9582	}
9583	ret := &ListFiltersResponse{
9584		ServerResponse: googleapi.ServerResponse{
9585			Header:         res.Header,
9586			HTTPStatusCode: res.StatusCode,
9587		},
9588	}
9589	target := &ret
9590	if err := gensupport.DecodeResponse(target, res); err != nil {
9591		return nil, err
9592	}
9593	return ret, nil
9594	// {
9595	//   "description": "Lists the message filters of a Gmail user.",
9596	//   "httpMethod": "GET",
9597	//   "id": "gmail.users.settings.filters.list",
9598	//   "parameterOrder": [
9599	//     "userId"
9600	//   ],
9601	//   "parameters": {
9602	//     "userId": {
9603	//       "default": "me",
9604	//       "description": "User's email address. The special value \"me\" can be used to indicate the authenticated user.",
9605	//       "location": "path",
9606	//       "required": true,
9607	//       "type": "string"
9608	//     }
9609	//   },
9610	//   "path": "{userId}/settings/filters",
9611	//   "response": {
9612	//     "$ref": "ListFiltersResponse"
9613	//   },
9614	//   "scopes": [
9615	//     "https://mail.google.com/",
9616	//     "https://www.googleapis.com/auth/gmail.modify",
9617	//     "https://www.googleapis.com/auth/gmail.readonly",
9618	//     "https://www.googleapis.com/auth/gmail.settings.basic"
9619	//   ]
9620	// }
9621
9622}
9623
9624// method id "gmail.users.settings.forwardingAddresses.create":
9625
9626type UsersSettingsForwardingAddressesCreateCall struct {
9627	s                 *Service
9628	userId            string
9629	forwardingaddress *ForwardingAddress
9630	urlParams_        gensupport.URLParams
9631	ctx_              context.Context
9632	header_           http.Header
9633}
9634
9635// Create: Creates a forwarding address. If ownership verification is
9636// required, a message will be sent to the recipient and the resource's
9637// verification status will be set to pending; otherwise, the resource
9638// will be created with verification status set to accepted.
9639//
9640// This method is only available to service account clients that have
9641// been delegated domain-wide authority.
9642func (r *UsersSettingsForwardingAddressesService) Create(userId string, forwardingaddress *ForwardingAddress) *UsersSettingsForwardingAddressesCreateCall {
9643	c := &UsersSettingsForwardingAddressesCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
9644	c.userId = userId
9645	c.forwardingaddress = forwardingaddress
9646	return c
9647}
9648
9649// Fields allows partial responses to be retrieved. See
9650// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
9651// for more information.
9652func (c *UsersSettingsForwardingAddressesCreateCall) Fields(s ...googleapi.Field) *UsersSettingsForwardingAddressesCreateCall {
9653	c.urlParams_.Set("fields", googleapi.CombineFields(s))
9654	return c
9655}
9656
9657// Context sets the context to be used in this call's Do method. Any
9658// pending HTTP request will be aborted if the provided context is
9659// canceled.
9660func (c *UsersSettingsForwardingAddressesCreateCall) Context(ctx context.Context) *UsersSettingsForwardingAddressesCreateCall {
9661	c.ctx_ = ctx
9662	return c
9663}
9664
9665// Header returns an http.Header that can be modified by the caller to
9666// add HTTP headers to the request.
9667func (c *UsersSettingsForwardingAddressesCreateCall) Header() http.Header {
9668	if c.header_ == nil {
9669		c.header_ = make(http.Header)
9670	}
9671	return c.header_
9672}
9673
9674func (c *UsersSettingsForwardingAddressesCreateCall) doRequest(alt string) (*http.Response, error) {
9675	reqHeaders := make(http.Header)
9676	for k, v := range c.header_ {
9677		reqHeaders[k] = v
9678	}
9679	reqHeaders.Set("User-Agent", c.s.userAgent())
9680	var body io.Reader = nil
9681	body, err := googleapi.WithoutDataWrapper.JSONReader(c.forwardingaddress)
9682	if err != nil {
9683		return nil, err
9684	}
9685	reqHeaders.Set("Content-Type", "application/json")
9686	c.urlParams_.Set("alt", alt)
9687	c.urlParams_.Set("prettyPrint", "false")
9688	urls := googleapi.ResolveRelative(c.s.BasePath, "{userId}/settings/forwardingAddresses")
9689	urls += "?" + c.urlParams_.Encode()
9690	req, err := http.NewRequest("POST", urls, body)
9691	if err != nil {
9692		return nil, err
9693	}
9694	req.Header = reqHeaders
9695	googleapi.Expand(req.URL, map[string]string{
9696		"userId": c.userId,
9697	})
9698	return gensupport.SendRequest(c.ctx_, c.s.client, req)
9699}
9700
9701// Do executes the "gmail.users.settings.forwardingAddresses.create" call.
9702// Exactly one of *ForwardingAddress or error will be non-nil. Any
9703// non-2xx status code is an error. Response headers are in either
9704// *ForwardingAddress.ServerResponse.Header or (if a response was
9705// returned at all) in error.(*googleapi.Error).Header. Use
9706// googleapi.IsNotModified to check whether the returned error was
9707// because http.StatusNotModified was returned.
9708func (c *UsersSettingsForwardingAddressesCreateCall) Do(opts ...googleapi.CallOption) (*ForwardingAddress, error) {
9709	gensupport.SetOptions(c.urlParams_, opts...)
9710	res, err := c.doRequest("json")
9711	if res != nil && res.StatusCode == http.StatusNotModified {
9712		if res.Body != nil {
9713			res.Body.Close()
9714		}
9715		return nil, &googleapi.Error{
9716			Code:   res.StatusCode,
9717			Header: res.Header,
9718		}
9719	}
9720	if err != nil {
9721		return nil, err
9722	}
9723	defer googleapi.CloseBody(res)
9724	if err := googleapi.CheckResponse(res); err != nil {
9725		return nil, err
9726	}
9727	ret := &ForwardingAddress{
9728		ServerResponse: googleapi.ServerResponse{
9729			Header:         res.Header,
9730			HTTPStatusCode: res.StatusCode,
9731		},
9732	}
9733	target := &ret
9734	if err := gensupport.DecodeResponse(target, res); err != nil {
9735		return nil, err
9736	}
9737	return ret, nil
9738	// {
9739	//   "description": "Creates a forwarding address. If ownership verification is required, a message will be sent to the recipient and the resource's verification status will be set to pending; otherwise, the resource will be created with verification status set to accepted.\n\nThis method is only available to service account clients that have been delegated domain-wide authority.",
9740	//   "httpMethod": "POST",
9741	//   "id": "gmail.users.settings.forwardingAddresses.create",
9742	//   "parameterOrder": [
9743	//     "userId"
9744	//   ],
9745	//   "parameters": {
9746	//     "userId": {
9747	//       "default": "me",
9748	//       "description": "User's email address. The special value \"me\" can be used to indicate the authenticated user.",
9749	//       "location": "path",
9750	//       "required": true,
9751	//       "type": "string"
9752	//     }
9753	//   },
9754	//   "path": "{userId}/settings/forwardingAddresses",
9755	//   "request": {
9756	//     "$ref": "ForwardingAddress"
9757	//   },
9758	//   "response": {
9759	//     "$ref": "ForwardingAddress"
9760	//   },
9761	//   "scopes": [
9762	//     "https://www.googleapis.com/auth/gmail.settings.sharing"
9763	//   ]
9764	// }
9765
9766}
9767
9768// method id "gmail.users.settings.forwardingAddresses.delete":
9769
9770type UsersSettingsForwardingAddressesDeleteCall struct {
9771	s               *Service
9772	userId          string
9773	forwardingEmail string
9774	urlParams_      gensupport.URLParams
9775	ctx_            context.Context
9776	header_         http.Header
9777}
9778
9779// Delete: Deletes the specified forwarding address and revokes any
9780// verification that may have been required.
9781//
9782// This method is only available to service account clients that have
9783// been delegated domain-wide authority.
9784func (r *UsersSettingsForwardingAddressesService) Delete(userId string, forwardingEmail string) *UsersSettingsForwardingAddressesDeleteCall {
9785	c := &UsersSettingsForwardingAddressesDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
9786	c.userId = userId
9787	c.forwardingEmail = forwardingEmail
9788	return c
9789}
9790
9791// Fields allows partial responses to be retrieved. See
9792// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
9793// for more information.
9794func (c *UsersSettingsForwardingAddressesDeleteCall) Fields(s ...googleapi.Field) *UsersSettingsForwardingAddressesDeleteCall {
9795	c.urlParams_.Set("fields", googleapi.CombineFields(s))
9796	return c
9797}
9798
9799// Context sets the context to be used in this call's Do method. Any
9800// pending HTTP request will be aborted if the provided context is
9801// canceled.
9802func (c *UsersSettingsForwardingAddressesDeleteCall) Context(ctx context.Context) *UsersSettingsForwardingAddressesDeleteCall {
9803	c.ctx_ = ctx
9804	return c
9805}
9806
9807// Header returns an http.Header that can be modified by the caller to
9808// add HTTP headers to the request.
9809func (c *UsersSettingsForwardingAddressesDeleteCall) Header() http.Header {
9810	if c.header_ == nil {
9811		c.header_ = make(http.Header)
9812	}
9813	return c.header_
9814}
9815
9816func (c *UsersSettingsForwardingAddressesDeleteCall) doRequest(alt string) (*http.Response, error) {
9817	reqHeaders := make(http.Header)
9818	for k, v := range c.header_ {
9819		reqHeaders[k] = v
9820	}
9821	reqHeaders.Set("User-Agent", c.s.userAgent())
9822	var body io.Reader = nil
9823	c.urlParams_.Set("alt", alt)
9824	c.urlParams_.Set("prettyPrint", "false")
9825	urls := googleapi.ResolveRelative(c.s.BasePath, "{userId}/settings/forwardingAddresses/{forwardingEmail}")
9826	urls += "?" + c.urlParams_.Encode()
9827	req, err := http.NewRequest("DELETE", urls, body)
9828	if err != nil {
9829		return nil, err
9830	}
9831	req.Header = reqHeaders
9832	googleapi.Expand(req.URL, map[string]string{
9833		"userId":          c.userId,
9834		"forwardingEmail": c.forwardingEmail,
9835	})
9836	return gensupport.SendRequest(c.ctx_, c.s.client, req)
9837}
9838
9839// Do executes the "gmail.users.settings.forwardingAddresses.delete" call.
9840func (c *UsersSettingsForwardingAddressesDeleteCall) Do(opts ...googleapi.CallOption) error {
9841	gensupport.SetOptions(c.urlParams_, opts...)
9842	res, err := c.doRequest("json")
9843	if err != nil {
9844		return err
9845	}
9846	defer googleapi.CloseBody(res)
9847	if err := googleapi.CheckResponse(res); err != nil {
9848		return err
9849	}
9850	return nil
9851	// {
9852	//   "description": "Deletes the specified forwarding address and revokes any verification that may have been required.\n\nThis method is only available to service account clients that have been delegated domain-wide authority.",
9853	//   "httpMethod": "DELETE",
9854	//   "id": "gmail.users.settings.forwardingAddresses.delete",
9855	//   "parameterOrder": [
9856	//     "userId",
9857	//     "forwardingEmail"
9858	//   ],
9859	//   "parameters": {
9860	//     "forwardingEmail": {
9861	//       "description": "The forwarding address to be deleted.",
9862	//       "location": "path",
9863	//       "required": true,
9864	//       "type": "string"
9865	//     },
9866	//     "userId": {
9867	//       "default": "me",
9868	//       "description": "User's email address. The special value \"me\" can be used to indicate the authenticated user.",
9869	//       "location": "path",
9870	//       "required": true,
9871	//       "type": "string"
9872	//     }
9873	//   },
9874	//   "path": "{userId}/settings/forwardingAddresses/{forwardingEmail}",
9875	//   "scopes": [
9876	//     "https://www.googleapis.com/auth/gmail.settings.sharing"
9877	//   ]
9878	// }
9879
9880}
9881
9882// method id "gmail.users.settings.forwardingAddresses.get":
9883
9884type UsersSettingsForwardingAddressesGetCall struct {
9885	s               *Service
9886	userId          string
9887	forwardingEmail string
9888	urlParams_      gensupport.URLParams
9889	ifNoneMatch_    string
9890	ctx_            context.Context
9891	header_         http.Header
9892}
9893
9894// Get: Gets the specified forwarding address.
9895func (r *UsersSettingsForwardingAddressesService) Get(userId string, forwardingEmail string) *UsersSettingsForwardingAddressesGetCall {
9896	c := &UsersSettingsForwardingAddressesGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
9897	c.userId = userId
9898	c.forwardingEmail = forwardingEmail
9899	return c
9900}
9901
9902// Fields allows partial responses to be retrieved. See
9903// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
9904// for more information.
9905func (c *UsersSettingsForwardingAddressesGetCall) Fields(s ...googleapi.Field) *UsersSettingsForwardingAddressesGetCall {
9906	c.urlParams_.Set("fields", googleapi.CombineFields(s))
9907	return c
9908}
9909
9910// IfNoneMatch sets the optional parameter which makes the operation
9911// fail if the object's ETag matches the given value. This is useful for
9912// getting updates only after the object has changed since the last
9913// request. Use googleapi.IsNotModified to check whether the response
9914// error from Do is the result of In-None-Match.
9915func (c *UsersSettingsForwardingAddressesGetCall) IfNoneMatch(entityTag string) *UsersSettingsForwardingAddressesGetCall {
9916	c.ifNoneMatch_ = entityTag
9917	return c
9918}
9919
9920// Context sets the context to be used in this call's Do method. Any
9921// pending HTTP request will be aborted if the provided context is
9922// canceled.
9923func (c *UsersSettingsForwardingAddressesGetCall) Context(ctx context.Context) *UsersSettingsForwardingAddressesGetCall {
9924	c.ctx_ = ctx
9925	return c
9926}
9927
9928// Header returns an http.Header that can be modified by the caller to
9929// add HTTP headers to the request.
9930func (c *UsersSettingsForwardingAddressesGetCall) Header() http.Header {
9931	if c.header_ == nil {
9932		c.header_ = make(http.Header)
9933	}
9934	return c.header_
9935}
9936
9937func (c *UsersSettingsForwardingAddressesGetCall) doRequest(alt string) (*http.Response, error) {
9938	reqHeaders := make(http.Header)
9939	for k, v := range c.header_ {
9940		reqHeaders[k] = v
9941	}
9942	reqHeaders.Set("User-Agent", c.s.userAgent())
9943	if c.ifNoneMatch_ != "" {
9944		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
9945	}
9946	var body io.Reader = nil
9947	c.urlParams_.Set("alt", alt)
9948	c.urlParams_.Set("prettyPrint", "false")
9949	urls := googleapi.ResolveRelative(c.s.BasePath, "{userId}/settings/forwardingAddresses/{forwardingEmail}")
9950	urls += "?" + c.urlParams_.Encode()
9951	req, err := http.NewRequest("GET", urls, body)
9952	if err != nil {
9953		return nil, err
9954	}
9955	req.Header = reqHeaders
9956	googleapi.Expand(req.URL, map[string]string{
9957		"userId":          c.userId,
9958		"forwardingEmail": c.forwardingEmail,
9959	})
9960	return gensupport.SendRequest(c.ctx_, c.s.client, req)
9961}
9962
9963// Do executes the "gmail.users.settings.forwardingAddresses.get" call.
9964// Exactly one of *ForwardingAddress or error will be non-nil. Any
9965// non-2xx status code is an error. Response headers are in either
9966// *ForwardingAddress.ServerResponse.Header or (if a response was
9967// returned at all) in error.(*googleapi.Error).Header. Use
9968// googleapi.IsNotModified to check whether the returned error was
9969// because http.StatusNotModified was returned.
9970func (c *UsersSettingsForwardingAddressesGetCall) Do(opts ...googleapi.CallOption) (*ForwardingAddress, error) {
9971	gensupport.SetOptions(c.urlParams_, opts...)
9972	res, err := c.doRequest("json")
9973	if res != nil && res.StatusCode == http.StatusNotModified {
9974		if res.Body != nil {
9975			res.Body.Close()
9976		}
9977		return nil, &googleapi.Error{
9978			Code:   res.StatusCode,
9979			Header: res.Header,
9980		}
9981	}
9982	if err != nil {
9983		return nil, err
9984	}
9985	defer googleapi.CloseBody(res)
9986	if err := googleapi.CheckResponse(res); err != nil {
9987		return nil, err
9988	}
9989	ret := &ForwardingAddress{
9990		ServerResponse: googleapi.ServerResponse{
9991			Header:         res.Header,
9992			HTTPStatusCode: res.StatusCode,
9993		},
9994	}
9995	target := &ret
9996	if err := gensupport.DecodeResponse(target, res); err != nil {
9997		return nil, err
9998	}
9999	return ret, nil
10000	// {
10001	//   "description": "Gets the specified forwarding address.",
10002	//   "httpMethod": "GET",
10003	//   "id": "gmail.users.settings.forwardingAddresses.get",
10004	//   "parameterOrder": [
10005	//     "userId",
10006	//     "forwardingEmail"
10007	//   ],
10008	//   "parameters": {
10009	//     "forwardingEmail": {
10010	//       "description": "The forwarding address to be retrieved.",
10011	//       "location": "path",
10012	//       "required": true,
10013	//       "type": "string"
10014	//     },
10015	//     "userId": {
10016	//       "default": "me",
10017	//       "description": "User's email address. The special value \"me\" can be used to indicate the authenticated user.",
10018	//       "location": "path",
10019	//       "required": true,
10020	//       "type": "string"
10021	//     }
10022	//   },
10023	//   "path": "{userId}/settings/forwardingAddresses/{forwardingEmail}",
10024	//   "response": {
10025	//     "$ref": "ForwardingAddress"
10026	//   },
10027	//   "scopes": [
10028	//     "https://mail.google.com/",
10029	//     "https://www.googleapis.com/auth/gmail.modify",
10030	//     "https://www.googleapis.com/auth/gmail.readonly",
10031	//     "https://www.googleapis.com/auth/gmail.settings.basic"
10032	//   ]
10033	// }
10034
10035}
10036
10037// method id "gmail.users.settings.forwardingAddresses.list":
10038
10039type UsersSettingsForwardingAddressesListCall struct {
10040	s            *Service
10041	userId       string
10042	urlParams_   gensupport.URLParams
10043	ifNoneMatch_ string
10044	ctx_         context.Context
10045	header_      http.Header
10046}
10047
10048// List: Lists the forwarding addresses for the specified account.
10049func (r *UsersSettingsForwardingAddressesService) List(userId string) *UsersSettingsForwardingAddressesListCall {
10050	c := &UsersSettingsForwardingAddressesListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
10051	c.userId = userId
10052	return c
10053}
10054
10055// Fields allows partial responses to be retrieved. See
10056// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
10057// for more information.
10058func (c *UsersSettingsForwardingAddressesListCall) Fields(s ...googleapi.Field) *UsersSettingsForwardingAddressesListCall {
10059	c.urlParams_.Set("fields", googleapi.CombineFields(s))
10060	return c
10061}
10062
10063// IfNoneMatch sets the optional parameter which makes the operation
10064// fail if the object's ETag matches the given value. This is useful for
10065// getting updates only after the object has changed since the last
10066// request. Use googleapi.IsNotModified to check whether the response
10067// error from Do is the result of In-None-Match.
10068func (c *UsersSettingsForwardingAddressesListCall) IfNoneMatch(entityTag string) *UsersSettingsForwardingAddressesListCall {
10069	c.ifNoneMatch_ = entityTag
10070	return c
10071}
10072
10073// Context sets the context to be used in this call's Do method. Any
10074// pending HTTP request will be aborted if the provided context is
10075// canceled.
10076func (c *UsersSettingsForwardingAddressesListCall) Context(ctx context.Context) *UsersSettingsForwardingAddressesListCall {
10077	c.ctx_ = ctx
10078	return c
10079}
10080
10081// Header returns an http.Header that can be modified by the caller to
10082// add HTTP headers to the request.
10083func (c *UsersSettingsForwardingAddressesListCall) Header() http.Header {
10084	if c.header_ == nil {
10085		c.header_ = make(http.Header)
10086	}
10087	return c.header_
10088}
10089
10090func (c *UsersSettingsForwardingAddressesListCall) doRequest(alt string) (*http.Response, error) {
10091	reqHeaders := make(http.Header)
10092	for k, v := range c.header_ {
10093		reqHeaders[k] = v
10094	}
10095	reqHeaders.Set("User-Agent", c.s.userAgent())
10096	if c.ifNoneMatch_ != "" {
10097		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
10098	}
10099	var body io.Reader = nil
10100	c.urlParams_.Set("alt", alt)
10101	c.urlParams_.Set("prettyPrint", "false")
10102	urls := googleapi.ResolveRelative(c.s.BasePath, "{userId}/settings/forwardingAddresses")
10103	urls += "?" + c.urlParams_.Encode()
10104	req, err := http.NewRequest("GET", urls, body)
10105	if err != nil {
10106		return nil, err
10107	}
10108	req.Header = reqHeaders
10109	googleapi.Expand(req.URL, map[string]string{
10110		"userId": c.userId,
10111	})
10112	return gensupport.SendRequest(c.ctx_, c.s.client, req)
10113}
10114
10115// Do executes the "gmail.users.settings.forwardingAddresses.list" call.
10116// Exactly one of *ListForwardingAddressesResponse or error will be
10117// non-nil. Any non-2xx status code is an error. Response headers are in
10118// either *ListForwardingAddressesResponse.ServerResponse.Header or (if
10119// a response was returned at all) in error.(*googleapi.Error).Header.
10120// Use googleapi.IsNotModified to check whether the returned error was
10121// because http.StatusNotModified was returned.
10122func (c *UsersSettingsForwardingAddressesListCall) Do(opts ...googleapi.CallOption) (*ListForwardingAddressesResponse, error) {
10123	gensupport.SetOptions(c.urlParams_, opts...)
10124	res, err := c.doRequest("json")
10125	if res != nil && res.StatusCode == http.StatusNotModified {
10126		if res.Body != nil {
10127			res.Body.Close()
10128		}
10129		return nil, &googleapi.Error{
10130			Code:   res.StatusCode,
10131			Header: res.Header,
10132		}
10133	}
10134	if err != nil {
10135		return nil, err
10136	}
10137	defer googleapi.CloseBody(res)
10138	if err := googleapi.CheckResponse(res); err != nil {
10139		return nil, err
10140	}
10141	ret := &ListForwardingAddressesResponse{
10142		ServerResponse: googleapi.ServerResponse{
10143			Header:         res.Header,
10144			HTTPStatusCode: res.StatusCode,
10145		},
10146	}
10147	target := &ret
10148	if err := gensupport.DecodeResponse(target, res); err != nil {
10149		return nil, err
10150	}
10151	return ret, nil
10152	// {
10153	//   "description": "Lists the forwarding addresses for the specified account.",
10154	//   "httpMethod": "GET",
10155	//   "id": "gmail.users.settings.forwardingAddresses.list",
10156	//   "parameterOrder": [
10157	//     "userId"
10158	//   ],
10159	//   "parameters": {
10160	//     "userId": {
10161	//       "default": "me",
10162	//       "description": "User's email address. The special value \"me\" can be used to indicate the authenticated user.",
10163	//       "location": "path",
10164	//       "required": true,
10165	//       "type": "string"
10166	//     }
10167	//   },
10168	//   "path": "{userId}/settings/forwardingAddresses",
10169	//   "response": {
10170	//     "$ref": "ListForwardingAddressesResponse"
10171	//   },
10172	//   "scopes": [
10173	//     "https://mail.google.com/",
10174	//     "https://www.googleapis.com/auth/gmail.modify",
10175	//     "https://www.googleapis.com/auth/gmail.readonly",
10176	//     "https://www.googleapis.com/auth/gmail.settings.basic"
10177	//   ]
10178	// }
10179
10180}
10181
10182// method id "gmail.users.settings.sendAs.create":
10183
10184type UsersSettingsSendAsCreateCall struct {
10185	s          *Service
10186	userId     string
10187	sendas     *SendAs
10188	urlParams_ gensupport.URLParams
10189	ctx_       context.Context
10190	header_    http.Header
10191}
10192
10193// Create: Creates a custom "from" send-as alias. If an SMTP MSA is
10194// specified, Gmail will attempt to connect to the SMTP service to
10195// validate the configuration before creating the alias. If ownership
10196// verification is required for the alias, a message will be sent to the
10197// email address and the resource's verification status will be set to
10198// pending; otherwise, the resource will be created with verification
10199// status set to accepted. If a signature is provided, Gmail will
10200// sanitize the HTML before saving it with the alias.
10201//
10202// This method is only available to service account clients that have
10203// been delegated domain-wide authority.
10204func (r *UsersSettingsSendAsService) Create(userId string, sendas *SendAs) *UsersSettingsSendAsCreateCall {
10205	c := &UsersSettingsSendAsCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
10206	c.userId = userId
10207	c.sendas = sendas
10208	return c
10209}
10210
10211// Fields allows partial responses to be retrieved. See
10212// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
10213// for more information.
10214func (c *UsersSettingsSendAsCreateCall) Fields(s ...googleapi.Field) *UsersSettingsSendAsCreateCall {
10215	c.urlParams_.Set("fields", googleapi.CombineFields(s))
10216	return c
10217}
10218
10219// Context sets the context to be used in this call's Do method. Any
10220// pending HTTP request will be aborted if the provided context is
10221// canceled.
10222func (c *UsersSettingsSendAsCreateCall) Context(ctx context.Context) *UsersSettingsSendAsCreateCall {
10223	c.ctx_ = ctx
10224	return c
10225}
10226
10227// Header returns an http.Header that can be modified by the caller to
10228// add HTTP headers to the request.
10229func (c *UsersSettingsSendAsCreateCall) Header() http.Header {
10230	if c.header_ == nil {
10231		c.header_ = make(http.Header)
10232	}
10233	return c.header_
10234}
10235
10236func (c *UsersSettingsSendAsCreateCall) doRequest(alt string) (*http.Response, error) {
10237	reqHeaders := make(http.Header)
10238	for k, v := range c.header_ {
10239		reqHeaders[k] = v
10240	}
10241	reqHeaders.Set("User-Agent", c.s.userAgent())
10242	var body io.Reader = nil
10243	body, err := googleapi.WithoutDataWrapper.JSONReader(c.sendas)
10244	if err != nil {
10245		return nil, err
10246	}
10247	reqHeaders.Set("Content-Type", "application/json")
10248	c.urlParams_.Set("alt", alt)
10249	c.urlParams_.Set("prettyPrint", "false")
10250	urls := googleapi.ResolveRelative(c.s.BasePath, "{userId}/settings/sendAs")
10251	urls += "?" + c.urlParams_.Encode()
10252	req, err := http.NewRequest("POST", urls, body)
10253	if err != nil {
10254		return nil, err
10255	}
10256	req.Header = reqHeaders
10257	googleapi.Expand(req.URL, map[string]string{
10258		"userId": c.userId,
10259	})
10260	return gensupport.SendRequest(c.ctx_, c.s.client, req)
10261}
10262
10263// Do executes the "gmail.users.settings.sendAs.create" call.
10264// Exactly one of *SendAs or error will be non-nil. Any non-2xx status
10265// code is an error. Response headers are in either
10266// *SendAs.ServerResponse.Header or (if a response was returned at all)
10267// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
10268// check whether the returned error was because http.StatusNotModified
10269// was returned.
10270func (c *UsersSettingsSendAsCreateCall) Do(opts ...googleapi.CallOption) (*SendAs, error) {
10271	gensupport.SetOptions(c.urlParams_, opts...)
10272	res, err := c.doRequest("json")
10273	if res != nil && res.StatusCode == http.StatusNotModified {
10274		if res.Body != nil {
10275			res.Body.Close()
10276		}
10277		return nil, &googleapi.Error{
10278			Code:   res.StatusCode,
10279			Header: res.Header,
10280		}
10281	}
10282	if err != nil {
10283		return nil, err
10284	}
10285	defer googleapi.CloseBody(res)
10286	if err := googleapi.CheckResponse(res); err != nil {
10287		return nil, err
10288	}
10289	ret := &SendAs{
10290		ServerResponse: googleapi.ServerResponse{
10291			Header:         res.Header,
10292			HTTPStatusCode: res.StatusCode,
10293		},
10294	}
10295	target := &ret
10296	if err := gensupport.DecodeResponse(target, res); err != nil {
10297		return nil, err
10298	}
10299	return ret, nil
10300	// {
10301	//   "description": "Creates a custom \"from\" send-as alias. If an SMTP MSA is specified, Gmail will attempt to connect to the SMTP service to validate the configuration before creating the alias. If ownership verification is required for the alias, a message will be sent to the email address and the resource's verification status will be set to pending; otherwise, the resource will be created with verification status set to accepted. If a signature is provided, Gmail will sanitize the HTML before saving it with the alias.\n\nThis method is only available to service account clients that have been delegated domain-wide authority.",
10302	//   "httpMethod": "POST",
10303	//   "id": "gmail.users.settings.sendAs.create",
10304	//   "parameterOrder": [
10305	//     "userId"
10306	//   ],
10307	//   "parameters": {
10308	//     "userId": {
10309	//       "default": "me",
10310	//       "description": "User's email address. The special value \"me\" can be used to indicate the authenticated user.",
10311	//       "location": "path",
10312	//       "required": true,
10313	//       "type": "string"
10314	//     }
10315	//   },
10316	//   "path": "{userId}/settings/sendAs",
10317	//   "request": {
10318	//     "$ref": "SendAs"
10319	//   },
10320	//   "response": {
10321	//     "$ref": "SendAs"
10322	//   },
10323	//   "scopes": [
10324	//     "https://www.googleapis.com/auth/gmail.settings.sharing"
10325	//   ]
10326	// }
10327
10328}
10329
10330// method id "gmail.users.settings.sendAs.delete":
10331
10332type UsersSettingsSendAsDeleteCall struct {
10333	s           *Service
10334	userId      string
10335	sendAsEmail string
10336	urlParams_  gensupport.URLParams
10337	ctx_        context.Context
10338	header_     http.Header
10339}
10340
10341// Delete: Deletes the specified send-as alias. Revokes any verification
10342// that may have been required for using it.
10343//
10344// This method is only available to service account clients that have
10345// been delegated domain-wide authority.
10346func (r *UsersSettingsSendAsService) Delete(userId string, sendAsEmail string) *UsersSettingsSendAsDeleteCall {
10347	c := &UsersSettingsSendAsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
10348	c.userId = userId
10349	c.sendAsEmail = sendAsEmail
10350	return c
10351}
10352
10353// Fields allows partial responses to be retrieved. See
10354// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
10355// for more information.
10356func (c *UsersSettingsSendAsDeleteCall) Fields(s ...googleapi.Field) *UsersSettingsSendAsDeleteCall {
10357	c.urlParams_.Set("fields", googleapi.CombineFields(s))
10358	return c
10359}
10360
10361// Context sets the context to be used in this call's Do method. Any
10362// pending HTTP request will be aborted if the provided context is
10363// canceled.
10364func (c *UsersSettingsSendAsDeleteCall) Context(ctx context.Context) *UsersSettingsSendAsDeleteCall {
10365	c.ctx_ = ctx
10366	return c
10367}
10368
10369// Header returns an http.Header that can be modified by the caller to
10370// add HTTP headers to the request.
10371func (c *UsersSettingsSendAsDeleteCall) Header() http.Header {
10372	if c.header_ == nil {
10373		c.header_ = make(http.Header)
10374	}
10375	return c.header_
10376}
10377
10378func (c *UsersSettingsSendAsDeleteCall) doRequest(alt string) (*http.Response, error) {
10379	reqHeaders := make(http.Header)
10380	for k, v := range c.header_ {
10381		reqHeaders[k] = v
10382	}
10383	reqHeaders.Set("User-Agent", c.s.userAgent())
10384	var body io.Reader = nil
10385	c.urlParams_.Set("alt", alt)
10386	c.urlParams_.Set("prettyPrint", "false")
10387	urls := googleapi.ResolveRelative(c.s.BasePath, "{userId}/settings/sendAs/{sendAsEmail}")
10388	urls += "?" + c.urlParams_.Encode()
10389	req, err := http.NewRequest("DELETE", urls, body)
10390	if err != nil {
10391		return nil, err
10392	}
10393	req.Header = reqHeaders
10394	googleapi.Expand(req.URL, map[string]string{
10395		"userId":      c.userId,
10396		"sendAsEmail": c.sendAsEmail,
10397	})
10398	return gensupport.SendRequest(c.ctx_, c.s.client, req)
10399}
10400
10401// Do executes the "gmail.users.settings.sendAs.delete" call.
10402func (c *UsersSettingsSendAsDeleteCall) Do(opts ...googleapi.CallOption) error {
10403	gensupport.SetOptions(c.urlParams_, opts...)
10404	res, err := c.doRequest("json")
10405	if err != nil {
10406		return err
10407	}
10408	defer googleapi.CloseBody(res)
10409	if err := googleapi.CheckResponse(res); err != nil {
10410		return err
10411	}
10412	return nil
10413	// {
10414	//   "description": "Deletes the specified send-as alias. Revokes any verification that may have been required for using it.\n\nThis method is only available to service account clients that have been delegated domain-wide authority.",
10415	//   "httpMethod": "DELETE",
10416	//   "id": "gmail.users.settings.sendAs.delete",
10417	//   "parameterOrder": [
10418	//     "userId",
10419	//     "sendAsEmail"
10420	//   ],
10421	//   "parameters": {
10422	//     "sendAsEmail": {
10423	//       "description": "The send-as alias to be deleted.",
10424	//       "location": "path",
10425	//       "required": true,
10426	//       "type": "string"
10427	//     },
10428	//     "userId": {
10429	//       "default": "me",
10430	//       "description": "User's email address. The special value \"me\" can be used to indicate the authenticated user.",
10431	//       "location": "path",
10432	//       "required": true,
10433	//       "type": "string"
10434	//     }
10435	//   },
10436	//   "path": "{userId}/settings/sendAs/{sendAsEmail}",
10437	//   "scopes": [
10438	//     "https://www.googleapis.com/auth/gmail.settings.sharing"
10439	//   ]
10440	// }
10441
10442}
10443
10444// method id "gmail.users.settings.sendAs.get":
10445
10446type UsersSettingsSendAsGetCall struct {
10447	s            *Service
10448	userId       string
10449	sendAsEmail  string
10450	urlParams_   gensupport.URLParams
10451	ifNoneMatch_ string
10452	ctx_         context.Context
10453	header_      http.Header
10454}
10455
10456// Get: Gets the specified send-as alias. Fails with an HTTP 404 error
10457// if the specified address is not a member of the collection.
10458func (r *UsersSettingsSendAsService) Get(userId string, sendAsEmail string) *UsersSettingsSendAsGetCall {
10459	c := &UsersSettingsSendAsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
10460	c.userId = userId
10461	c.sendAsEmail = sendAsEmail
10462	return c
10463}
10464
10465// Fields allows partial responses to be retrieved. See
10466// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
10467// for more information.
10468func (c *UsersSettingsSendAsGetCall) Fields(s ...googleapi.Field) *UsersSettingsSendAsGetCall {
10469	c.urlParams_.Set("fields", googleapi.CombineFields(s))
10470	return c
10471}
10472
10473// IfNoneMatch sets the optional parameter which makes the operation
10474// fail if the object's ETag matches the given value. This is useful for
10475// getting updates only after the object has changed since the last
10476// request. Use googleapi.IsNotModified to check whether the response
10477// error from Do is the result of In-None-Match.
10478func (c *UsersSettingsSendAsGetCall) IfNoneMatch(entityTag string) *UsersSettingsSendAsGetCall {
10479	c.ifNoneMatch_ = entityTag
10480	return c
10481}
10482
10483// Context sets the context to be used in this call's Do method. Any
10484// pending HTTP request will be aborted if the provided context is
10485// canceled.
10486func (c *UsersSettingsSendAsGetCall) Context(ctx context.Context) *UsersSettingsSendAsGetCall {
10487	c.ctx_ = ctx
10488	return c
10489}
10490
10491// Header returns an http.Header that can be modified by the caller to
10492// add HTTP headers to the request.
10493func (c *UsersSettingsSendAsGetCall) Header() http.Header {
10494	if c.header_ == nil {
10495		c.header_ = make(http.Header)
10496	}
10497	return c.header_
10498}
10499
10500func (c *UsersSettingsSendAsGetCall) doRequest(alt string) (*http.Response, error) {
10501	reqHeaders := make(http.Header)
10502	for k, v := range c.header_ {
10503		reqHeaders[k] = v
10504	}
10505	reqHeaders.Set("User-Agent", c.s.userAgent())
10506	if c.ifNoneMatch_ != "" {
10507		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
10508	}
10509	var body io.Reader = nil
10510	c.urlParams_.Set("alt", alt)
10511	c.urlParams_.Set("prettyPrint", "false")
10512	urls := googleapi.ResolveRelative(c.s.BasePath, "{userId}/settings/sendAs/{sendAsEmail}")
10513	urls += "?" + c.urlParams_.Encode()
10514	req, err := http.NewRequest("GET", urls, body)
10515	if err != nil {
10516		return nil, err
10517	}
10518	req.Header = reqHeaders
10519	googleapi.Expand(req.URL, map[string]string{
10520		"userId":      c.userId,
10521		"sendAsEmail": c.sendAsEmail,
10522	})
10523	return gensupport.SendRequest(c.ctx_, c.s.client, req)
10524}
10525
10526// Do executes the "gmail.users.settings.sendAs.get" call.
10527// Exactly one of *SendAs or error will be non-nil. Any non-2xx status
10528// code is an error. Response headers are in either
10529// *SendAs.ServerResponse.Header or (if a response was returned at all)
10530// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
10531// check whether the returned error was because http.StatusNotModified
10532// was returned.
10533func (c *UsersSettingsSendAsGetCall) Do(opts ...googleapi.CallOption) (*SendAs, error) {
10534	gensupport.SetOptions(c.urlParams_, opts...)
10535	res, err := c.doRequest("json")
10536	if res != nil && res.StatusCode == http.StatusNotModified {
10537		if res.Body != nil {
10538			res.Body.Close()
10539		}
10540		return nil, &googleapi.Error{
10541			Code:   res.StatusCode,
10542			Header: res.Header,
10543		}
10544	}
10545	if err != nil {
10546		return nil, err
10547	}
10548	defer googleapi.CloseBody(res)
10549	if err := googleapi.CheckResponse(res); err != nil {
10550		return nil, err
10551	}
10552	ret := &SendAs{
10553		ServerResponse: googleapi.ServerResponse{
10554			Header:         res.Header,
10555			HTTPStatusCode: res.StatusCode,
10556		},
10557	}
10558	target := &ret
10559	if err := gensupport.DecodeResponse(target, res); err != nil {
10560		return nil, err
10561	}
10562	return ret, nil
10563	// {
10564	//   "description": "Gets the specified send-as alias. Fails with an HTTP 404 error if the specified address is not a member of the collection.",
10565	//   "httpMethod": "GET",
10566	//   "id": "gmail.users.settings.sendAs.get",
10567	//   "parameterOrder": [
10568	//     "userId",
10569	//     "sendAsEmail"
10570	//   ],
10571	//   "parameters": {
10572	//     "sendAsEmail": {
10573	//       "description": "The send-as alias to be retrieved.",
10574	//       "location": "path",
10575	//       "required": true,
10576	//       "type": "string"
10577	//     },
10578	//     "userId": {
10579	//       "default": "me",
10580	//       "description": "User's email address. The special value \"me\" can be used to indicate the authenticated user.",
10581	//       "location": "path",
10582	//       "required": true,
10583	//       "type": "string"
10584	//     }
10585	//   },
10586	//   "path": "{userId}/settings/sendAs/{sendAsEmail}",
10587	//   "response": {
10588	//     "$ref": "SendAs"
10589	//   },
10590	//   "scopes": [
10591	//     "https://mail.google.com/",
10592	//     "https://www.googleapis.com/auth/gmail.modify",
10593	//     "https://www.googleapis.com/auth/gmail.readonly",
10594	//     "https://www.googleapis.com/auth/gmail.settings.basic"
10595	//   ]
10596	// }
10597
10598}
10599
10600// method id "gmail.users.settings.sendAs.list":
10601
10602type UsersSettingsSendAsListCall struct {
10603	s            *Service
10604	userId       string
10605	urlParams_   gensupport.URLParams
10606	ifNoneMatch_ string
10607	ctx_         context.Context
10608	header_      http.Header
10609}
10610
10611// List: Lists the send-as aliases for the specified account. The result
10612// includes the primary send-as address associated with the account as
10613// well as any custom "from" aliases.
10614func (r *UsersSettingsSendAsService) List(userId string) *UsersSettingsSendAsListCall {
10615	c := &UsersSettingsSendAsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
10616	c.userId = userId
10617	return c
10618}
10619
10620// Fields allows partial responses to be retrieved. See
10621// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
10622// for more information.
10623func (c *UsersSettingsSendAsListCall) Fields(s ...googleapi.Field) *UsersSettingsSendAsListCall {
10624	c.urlParams_.Set("fields", googleapi.CombineFields(s))
10625	return c
10626}
10627
10628// IfNoneMatch sets the optional parameter which makes the operation
10629// fail if the object's ETag matches the given value. This is useful for
10630// getting updates only after the object has changed since the last
10631// request. Use googleapi.IsNotModified to check whether the response
10632// error from Do is the result of In-None-Match.
10633func (c *UsersSettingsSendAsListCall) IfNoneMatch(entityTag string) *UsersSettingsSendAsListCall {
10634	c.ifNoneMatch_ = entityTag
10635	return c
10636}
10637
10638// Context sets the context to be used in this call's Do method. Any
10639// pending HTTP request will be aborted if the provided context is
10640// canceled.
10641func (c *UsersSettingsSendAsListCall) Context(ctx context.Context) *UsersSettingsSendAsListCall {
10642	c.ctx_ = ctx
10643	return c
10644}
10645
10646// Header returns an http.Header that can be modified by the caller to
10647// add HTTP headers to the request.
10648func (c *UsersSettingsSendAsListCall) Header() http.Header {
10649	if c.header_ == nil {
10650		c.header_ = make(http.Header)
10651	}
10652	return c.header_
10653}
10654
10655func (c *UsersSettingsSendAsListCall) doRequest(alt string) (*http.Response, error) {
10656	reqHeaders := make(http.Header)
10657	for k, v := range c.header_ {
10658		reqHeaders[k] = v
10659	}
10660	reqHeaders.Set("User-Agent", c.s.userAgent())
10661	if c.ifNoneMatch_ != "" {
10662		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
10663	}
10664	var body io.Reader = nil
10665	c.urlParams_.Set("alt", alt)
10666	c.urlParams_.Set("prettyPrint", "false")
10667	urls := googleapi.ResolveRelative(c.s.BasePath, "{userId}/settings/sendAs")
10668	urls += "?" + c.urlParams_.Encode()
10669	req, err := http.NewRequest("GET", urls, body)
10670	if err != nil {
10671		return nil, err
10672	}
10673	req.Header = reqHeaders
10674	googleapi.Expand(req.URL, map[string]string{
10675		"userId": c.userId,
10676	})
10677	return gensupport.SendRequest(c.ctx_, c.s.client, req)
10678}
10679
10680// Do executes the "gmail.users.settings.sendAs.list" call.
10681// Exactly one of *ListSendAsResponse or error will be non-nil. Any
10682// non-2xx status code is an error. Response headers are in either
10683// *ListSendAsResponse.ServerResponse.Header or (if a response was
10684// returned at all) in error.(*googleapi.Error).Header. Use
10685// googleapi.IsNotModified to check whether the returned error was
10686// because http.StatusNotModified was returned.
10687func (c *UsersSettingsSendAsListCall) Do(opts ...googleapi.CallOption) (*ListSendAsResponse, error) {
10688	gensupport.SetOptions(c.urlParams_, opts...)
10689	res, err := c.doRequest("json")
10690	if res != nil && res.StatusCode == http.StatusNotModified {
10691		if res.Body != nil {
10692			res.Body.Close()
10693		}
10694		return nil, &googleapi.Error{
10695			Code:   res.StatusCode,
10696			Header: res.Header,
10697		}
10698	}
10699	if err != nil {
10700		return nil, err
10701	}
10702	defer googleapi.CloseBody(res)
10703	if err := googleapi.CheckResponse(res); err != nil {
10704		return nil, err
10705	}
10706	ret := &ListSendAsResponse{
10707		ServerResponse: googleapi.ServerResponse{
10708			Header:         res.Header,
10709			HTTPStatusCode: res.StatusCode,
10710		},
10711	}
10712	target := &ret
10713	if err := gensupport.DecodeResponse(target, res); err != nil {
10714		return nil, err
10715	}
10716	return ret, nil
10717	// {
10718	//   "description": "Lists the send-as aliases for the specified account. The result includes the primary send-as address associated with the account as well as any custom \"from\" aliases.",
10719	//   "httpMethod": "GET",
10720	//   "id": "gmail.users.settings.sendAs.list",
10721	//   "parameterOrder": [
10722	//     "userId"
10723	//   ],
10724	//   "parameters": {
10725	//     "userId": {
10726	//       "default": "me",
10727	//       "description": "User's email address. The special value \"me\" can be used to indicate the authenticated user.",
10728	//       "location": "path",
10729	//       "required": true,
10730	//       "type": "string"
10731	//     }
10732	//   },
10733	//   "path": "{userId}/settings/sendAs",
10734	//   "response": {
10735	//     "$ref": "ListSendAsResponse"
10736	//   },
10737	//   "scopes": [
10738	//     "https://mail.google.com/",
10739	//     "https://www.googleapis.com/auth/gmail.modify",
10740	//     "https://www.googleapis.com/auth/gmail.readonly",
10741	//     "https://www.googleapis.com/auth/gmail.settings.basic"
10742	//   ]
10743	// }
10744
10745}
10746
10747// method id "gmail.users.settings.sendAs.patch":
10748
10749type UsersSettingsSendAsPatchCall struct {
10750	s           *Service
10751	userId      string
10752	sendAsEmail string
10753	sendas      *SendAs
10754	urlParams_  gensupport.URLParams
10755	ctx_        context.Context
10756	header_     http.Header
10757}
10758
10759// Patch: Updates a send-as alias. If a signature is provided, Gmail
10760// will sanitize the HTML before saving it with the alias.
10761//
10762// Addresses other than the primary address for the account can only be
10763// updated by service account clients that have been delegated
10764// domain-wide authority. This method supports patch semantics.
10765func (r *UsersSettingsSendAsService) Patch(userId string, sendAsEmail string, sendas *SendAs) *UsersSettingsSendAsPatchCall {
10766	c := &UsersSettingsSendAsPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
10767	c.userId = userId
10768	c.sendAsEmail = sendAsEmail
10769	c.sendas = sendas
10770	return c
10771}
10772
10773// Fields allows partial responses to be retrieved. See
10774// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
10775// for more information.
10776func (c *UsersSettingsSendAsPatchCall) Fields(s ...googleapi.Field) *UsersSettingsSendAsPatchCall {
10777	c.urlParams_.Set("fields", googleapi.CombineFields(s))
10778	return c
10779}
10780
10781// Context sets the context to be used in this call's Do method. Any
10782// pending HTTP request will be aborted if the provided context is
10783// canceled.
10784func (c *UsersSettingsSendAsPatchCall) Context(ctx context.Context) *UsersSettingsSendAsPatchCall {
10785	c.ctx_ = ctx
10786	return c
10787}
10788
10789// Header returns an http.Header that can be modified by the caller to
10790// add HTTP headers to the request.
10791func (c *UsersSettingsSendAsPatchCall) Header() http.Header {
10792	if c.header_ == nil {
10793		c.header_ = make(http.Header)
10794	}
10795	return c.header_
10796}
10797
10798func (c *UsersSettingsSendAsPatchCall) doRequest(alt string) (*http.Response, error) {
10799	reqHeaders := make(http.Header)
10800	for k, v := range c.header_ {
10801		reqHeaders[k] = v
10802	}
10803	reqHeaders.Set("User-Agent", c.s.userAgent())
10804	var body io.Reader = nil
10805	body, err := googleapi.WithoutDataWrapper.JSONReader(c.sendas)
10806	if err != nil {
10807		return nil, err
10808	}
10809	reqHeaders.Set("Content-Type", "application/json")
10810	c.urlParams_.Set("alt", alt)
10811	c.urlParams_.Set("prettyPrint", "false")
10812	urls := googleapi.ResolveRelative(c.s.BasePath, "{userId}/settings/sendAs/{sendAsEmail}")
10813	urls += "?" + c.urlParams_.Encode()
10814	req, err := http.NewRequest("PATCH", urls, body)
10815	if err != nil {
10816		return nil, err
10817	}
10818	req.Header = reqHeaders
10819	googleapi.Expand(req.URL, map[string]string{
10820		"userId":      c.userId,
10821		"sendAsEmail": c.sendAsEmail,
10822	})
10823	return gensupport.SendRequest(c.ctx_, c.s.client, req)
10824}
10825
10826// Do executes the "gmail.users.settings.sendAs.patch" call.
10827// Exactly one of *SendAs or error will be non-nil. Any non-2xx status
10828// code is an error. Response headers are in either
10829// *SendAs.ServerResponse.Header or (if a response was returned at all)
10830// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
10831// check whether the returned error was because http.StatusNotModified
10832// was returned.
10833func (c *UsersSettingsSendAsPatchCall) Do(opts ...googleapi.CallOption) (*SendAs, error) {
10834	gensupport.SetOptions(c.urlParams_, opts...)
10835	res, err := c.doRequest("json")
10836	if res != nil && res.StatusCode == http.StatusNotModified {
10837		if res.Body != nil {
10838			res.Body.Close()
10839		}
10840		return nil, &googleapi.Error{
10841			Code:   res.StatusCode,
10842			Header: res.Header,
10843		}
10844	}
10845	if err != nil {
10846		return nil, err
10847	}
10848	defer googleapi.CloseBody(res)
10849	if err := googleapi.CheckResponse(res); err != nil {
10850		return nil, err
10851	}
10852	ret := &SendAs{
10853		ServerResponse: googleapi.ServerResponse{
10854			Header:         res.Header,
10855			HTTPStatusCode: res.StatusCode,
10856		},
10857	}
10858	target := &ret
10859	if err := gensupport.DecodeResponse(target, res); err != nil {
10860		return nil, err
10861	}
10862	return ret, nil
10863	// {
10864	//   "description": "Updates a send-as alias. If a signature is provided, Gmail will sanitize the HTML before saving it with the alias.\n\nAddresses other than the primary address for the account can only be updated by service account clients that have been delegated domain-wide authority. This method supports patch semantics.",
10865	//   "httpMethod": "PATCH",
10866	//   "id": "gmail.users.settings.sendAs.patch",
10867	//   "parameterOrder": [
10868	//     "userId",
10869	//     "sendAsEmail"
10870	//   ],
10871	//   "parameters": {
10872	//     "sendAsEmail": {
10873	//       "description": "The send-as alias to be updated.",
10874	//       "location": "path",
10875	//       "required": true,
10876	//       "type": "string"
10877	//     },
10878	//     "userId": {
10879	//       "default": "me",
10880	//       "description": "User's email address. The special value \"me\" can be used to indicate the authenticated user.",
10881	//       "location": "path",
10882	//       "required": true,
10883	//       "type": "string"
10884	//     }
10885	//   },
10886	//   "path": "{userId}/settings/sendAs/{sendAsEmail}",
10887	//   "request": {
10888	//     "$ref": "SendAs"
10889	//   },
10890	//   "response": {
10891	//     "$ref": "SendAs"
10892	//   },
10893	//   "scopes": [
10894	//     "https://www.googleapis.com/auth/gmail.settings.basic",
10895	//     "https://www.googleapis.com/auth/gmail.settings.sharing"
10896	//   ]
10897	// }
10898
10899}
10900
10901// method id "gmail.users.settings.sendAs.update":
10902
10903type UsersSettingsSendAsUpdateCall struct {
10904	s           *Service
10905	userId      string
10906	sendAsEmail string
10907	sendas      *SendAs
10908	urlParams_  gensupport.URLParams
10909	ctx_        context.Context
10910	header_     http.Header
10911}
10912
10913// Update: Updates a send-as alias. If a signature is provided, Gmail
10914// will sanitize the HTML before saving it with the alias.
10915//
10916// Addresses other than the primary address for the account can only be
10917// updated by service account clients that have been delegated
10918// domain-wide authority.
10919func (r *UsersSettingsSendAsService) Update(userId string, sendAsEmail string, sendas *SendAs) *UsersSettingsSendAsUpdateCall {
10920	c := &UsersSettingsSendAsUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
10921	c.userId = userId
10922	c.sendAsEmail = sendAsEmail
10923	c.sendas = sendas
10924	return c
10925}
10926
10927// Fields allows partial responses to be retrieved. See
10928// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
10929// for more information.
10930func (c *UsersSettingsSendAsUpdateCall) Fields(s ...googleapi.Field) *UsersSettingsSendAsUpdateCall {
10931	c.urlParams_.Set("fields", googleapi.CombineFields(s))
10932	return c
10933}
10934
10935// Context sets the context to be used in this call's Do method. Any
10936// pending HTTP request will be aborted if the provided context is
10937// canceled.
10938func (c *UsersSettingsSendAsUpdateCall) Context(ctx context.Context) *UsersSettingsSendAsUpdateCall {
10939	c.ctx_ = ctx
10940	return c
10941}
10942
10943// Header returns an http.Header that can be modified by the caller to
10944// add HTTP headers to the request.
10945func (c *UsersSettingsSendAsUpdateCall) Header() http.Header {
10946	if c.header_ == nil {
10947		c.header_ = make(http.Header)
10948	}
10949	return c.header_
10950}
10951
10952func (c *UsersSettingsSendAsUpdateCall) doRequest(alt string) (*http.Response, error) {
10953	reqHeaders := make(http.Header)
10954	for k, v := range c.header_ {
10955		reqHeaders[k] = v
10956	}
10957	reqHeaders.Set("User-Agent", c.s.userAgent())
10958	var body io.Reader = nil
10959	body, err := googleapi.WithoutDataWrapper.JSONReader(c.sendas)
10960	if err != nil {
10961		return nil, err
10962	}
10963	reqHeaders.Set("Content-Type", "application/json")
10964	c.urlParams_.Set("alt", alt)
10965	c.urlParams_.Set("prettyPrint", "false")
10966	urls := googleapi.ResolveRelative(c.s.BasePath, "{userId}/settings/sendAs/{sendAsEmail}")
10967	urls += "?" + c.urlParams_.Encode()
10968	req, err := http.NewRequest("PUT", urls, body)
10969	if err != nil {
10970		return nil, err
10971	}
10972	req.Header = reqHeaders
10973	googleapi.Expand(req.URL, map[string]string{
10974		"userId":      c.userId,
10975		"sendAsEmail": c.sendAsEmail,
10976	})
10977	return gensupport.SendRequest(c.ctx_, c.s.client, req)
10978}
10979
10980// Do executes the "gmail.users.settings.sendAs.update" call.
10981// Exactly one of *SendAs or error will be non-nil. Any non-2xx status
10982// code is an error. Response headers are in either
10983// *SendAs.ServerResponse.Header or (if a response was returned at all)
10984// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
10985// check whether the returned error was because http.StatusNotModified
10986// was returned.
10987func (c *UsersSettingsSendAsUpdateCall) Do(opts ...googleapi.CallOption) (*SendAs, error) {
10988	gensupport.SetOptions(c.urlParams_, opts...)
10989	res, err := c.doRequest("json")
10990	if res != nil && res.StatusCode == http.StatusNotModified {
10991		if res.Body != nil {
10992			res.Body.Close()
10993		}
10994		return nil, &googleapi.Error{
10995			Code:   res.StatusCode,
10996			Header: res.Header,
10997		}
10998	}
10999	if err != nil {
11000		return nil, err
11001	}
11002	defer googleapi.CloseBody(res)
11003	if err := googleapi.CheckResponse(res); err != nil {
11004		return nil, err
11005	}
11006	ret := &SendAs{
11007		ServerResponse: googleapi.ServerResponse{
11008			Header:         res.Header,
11009			HTTPStatusCode: res.StatusCode,
11010		},
11011	}
11012	target := &ret
11013	if err := gensupport.DecodeResponse(target, res); err != nil {
11014		return nil, err
11015	}
11016	return ret, nil
11017	// {
11018	//   "description": "Updates a send-as alias. If a signature is provided, Gmail will sanitize the HTML before saving it with the alias.\n\nAddresses other than the primary address for the account can only be updated by service account clients that have been delegated domain-wide authority.",
11019	//   "httpMethod": "PUT",
11020	//   "id": "gmail.users.settings.sendAs.update",
11021	//   "parameterOrder": [
11022	//     "userId",
11023	//     "sendAsEmail"
11024	//   ],
11025	//   "parameters": {
11026	//     "sendAsEmail": {
11027	//       "description": "The send-as alias to be updated.",
11028	//       "location": "path",
11029	//       "required": true,
11030	//       "type": "string"
11031	//     },
11032	//     "userId": {
11033	//       "default": "me",
11034	//       "description": "User's email address. The special value \"me\" can be used to indicate the authenticated user.",
11035	//       "location": "path",
11036	//       "required": true,
11037	//       "type": "string"
11038	//     }
11039	//   },
11040	//   "path": "{userId}/settings/sendAs/{sendAsEmail}",
11041	//   "request": {
11042	//     "$ref": "SendAs"
11043	//   },
11044	//   "response": {
11045	//     "$ref": "SendAs"
11046	//   },
11047	//   "scopes": [
11048	//     "https://www.googleapis.com/auth/gmail.settings.basic",
11049	//     "https://www.googleapis.com/auth/gmail.settings.sharing"
11050	//   ]
11051	// }
11052
11053}
11054
11055// method id "gmail.users.settings.sendAs.verify":
11056
11057type UsersSettingsSendAsVerifyCall struct {
11058	s           *Service
11059	userId      string
11060	sendAsEmail string
11061	urlParams_  gensupport.URLParams
11062	ctx_        context.Context
11063	header_     http.Header
11064}
11065
11066// Verify: Sends a verification email to the specified send-as alias
11067// address. The verification status must be pending.
11068//
11069// This method is only available to service account clients that have
11070// been delegated domain-wide authority.
11071func (r *UsersSettingsSendAsService) Verify(userId string, sendAsEmail string) *UsersSettingsSendAsVerifyCall {
11072	c := &UsersSettingsSendAsVerifyCall{s: r.s, urlParams_: make(gensupport.URLParams)}
11073	c.userId = userId
11074	c.sendAsEmail = sendAsEmail
11075	return c
11076}
11077
11078// Fields allows partial responses to be retrieved. See
11079// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
11080// for more information.
11081func (c *UsersSettingsSendAsVerifyCall) Fields(s ...googleapi.Field) *UsersSettingsSendAsVerifyCall {
11082	c.urlParams_.Set("fields", googleapi.CombineFields(s))
11083	return c
11084}
11085
11086// Context sets the context to be used in this call's Do method. Any
11087// pending HTTP request will be aborted if the provided context is
11088// canceled.
11089func (c *UsersSettingsSendAsVerifyCall) Context(ctx context.Context) *UsersSettingsSendAsVerifyCall {
11090	c.ctx_ = ctx
11091	return c
11092}
11093
11094// Header returns an http.Header that can be modified by the caller to
11095// add HTTP headers to the request.
11096func (c *UsersSettingsSendAsVerifyCall) Header() http.Header {
11097	if c.header_ == nil {
11098		c.header_ = make(http.Header)
11099	}
11100	return c.header_
11101}
11102
11103func (c *UsersSettingsSendAsVerifyCall) doRequest(alt string) (*http.Response, error) {
11104	reqHeaders := make(http.Header)
11105	for k, v := range c.header_ {
11106		reqHeaders[k] = v
11107	}
11108	reqHeaders.Set("User-Agent", c.s.userAgent())
11109	var body io.Reader = nil
11110	c.urlParams_.Set("alt", alt)
11111	c.urlParams_.Set("prettyPrint", "false")
11112	urls := googleapi.ResolveRelative(c.s.BasePath, "{userId}/settings/sendAs/{sendAsEmail}/verify")
11113	urls += "?" + c.urlParams_.Encode()
11114	req, err := http.NewRequest("POST", urls, body)
11115	if err != nil {
11116		return nil, err
11117	}
11118	req.Header = reqHeaders
11119	googleapi.Expand(req.URL, map[string]string{
11120		"userId":      c.userId,
11121		"sendAsEmail": c.sendAsEmail,
11122	})
11123	return gensupport.SendRequest(c.ctx_, c.s.client, req)
11124}
11125
11126// Do executes the "gmail.users.settings.sendAs.verify" call.
11127func (c *UsersSettingsSendAsVerifyCall) Do(opts ...googleapi.CallOption) error {
11128	gensupport.SetOptions(c.urlParams_, opts...)
11129	res, err := c.doRequest("json")
11130	if err != nil {
11131		return err
11132	}
11133	defer googleapi.CloseBody(res)
11134	if err := googleapi.CheckResponse(res); err != nil {
11135		return err
11136	}
11137	return nil
11138	// {
11139	//   "description": "Sends a verification email to the specified send-as alias address. The verification status must be pending.\n\nThis method is only available to service account clients that have been delegated domain-wide authority.",
11140	//   "httpMethod": "POST",
11141	//   "id": "gmail.users.settings.sendAs.verify",
11142	//   "parameterOrder": [
11143	//     "userId",
11144	//     "sendAsEmail"
11145	//   ],
11146	//   "parameters": {
11147	//     "sendAsEmail": {
11148	//       "description": "The send-as alias to be verified.",
11149	//       "location": "path",
11150	//       "required": true,
11151	//       "type": "string"
11152	//     },
11153	//     "userId": {
11154	//       "default": "me",
11155	//       "description": "User's email address. The special value \"me\" can be used to indicate the authenticated user.",
11156	//       "location": "path",
11157	//       "required": true,
11158	//       "type": "string"
11159	//     }
11160	//   },
11161	//   "path": "{userId}/settings/sendAs/{sendAsEmail}/verify",
11162	//   "scopes": [
11163	//     "https://www.googleapis.com/auth/gmail.settings.sharing"
11164	//   ]
11165	// }
11166
11167}
11168
11169// method id "gmail.users.settings.sendAs.smimeInfo.delete":
11170
11171type UsersSettingsSendAsSmimeInfoDeleteCall struct {
11172	s           *Service
11173	userId      string
11174	sendAsEmail string
11175	id          string
11176	urlParams_  gensupport.URLParams
11177	ctx_        context.Context
11178	header_     http.Header
11179}
11180
11181// Delete: Deletes the specified S/MIME config for the specified send-as
11182// alias.
11183func (r *UsersSettingsSendAsSmimeInfoService) Delete(userId string, sendAsEmail string, id string) *UsersSettingsSendAsSmimeInfoDeleteCall {
11184	c := &UsersSettingsSendAsSmimeInfoDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
11185	c.userId = userId
11186	c.sendAsEmail = sendAsEmail
11187	c.id = id
11188	return c
11189}
11190
11191// Fields allows partial responses to be retrieved. See
11192// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
11193// for more information.
11194func (c *UsersSettingsSendAsSmimeInfoDeleteCall) Fields(s ...googleapi.Field) *UsersSettingsSendAsSmimeInfoDeleteCall {
11195	c.urlParams_.Set("fields", googleapi.CombineFields(s))
11196	return c
11197}
11198
11199// Context sets the context to be used in this call's Do method. Any
11200// pending HTTP request will be aborted if the provided context is
11201// canceled.
11202func (c *UsersSettingsSendAsSmimeInfoDeleteCall) Context(ctx context.Context) *UsersSettingsSendAsSmimeInfoDeleteCall {
11203	c.ctx_ = ctx
11204	return c
11205}
11206
11207// Header returns an http.Header that can be modified by the caller to
11208// add HTTP headers to the request.
11209func (c *UsersSettingsSendAsSmimeInfoDeleteCall) Header() http.Header {
11210	if c.header_ == nil {
11211		c.header_ = make(http.Header)
11212	}
11213	return c.header_
11214}
11215
11216func (c *UsersSettingsSendAsSmimeInfoDeleteCall) doRequest(alt string) (*http.Response, error) {
11217	reqHeaders := make(http.Header)
11218	for k, v := range c.header_ {
11219		reqHeaders[k] = v
11220	}
11221	reqHeaders.Set("User-Agent", c.s.userAgent())
11222	var body io.Reader = nil
11223	c.urlParams_.Set("alt", alt)
11224	c.urlParams_.Set("prettyPrint", "false")
11225	urls := googleapi.ResolveRelative(c.s.BasePath, "{userId}/settings/sendAs/{sendAsEmail}/smimeInfo/{id}")
11226	urls += "?" + c.urlParams_.Encode()
11227	req, err := http.NewRequest("DELETE", urls, body)
11228	if err != nil {
11229		return nil, err
11230	}
11231	req.Header = reqHeaders
11232	googleapi.Expand(req.URL, map[string]string{
11233		"userId":      c.userId,
11234		"sendAsEmail": c.sendAsEmail,
11235		"id":          c.id,
11236	})
11237	return gensupport.SendRequest(c.ctx_, c.s.client, req)
11238}
11239
11240// Do executes the "gmail.users.settings.sendAs.smimeInfo.delete" call.
11241func (c *UsersSettingsSendAsSmimeInfoDeleteCall) Do(opts ...googleapi.CallOption) error {
11242	gensupport.SetOptions(c.urlParams_, opts...)
11243	res, err := c.doRequest("json")
11244	if err != nil {
11245		return err
11246	}
11247	defer googleapi.CloseBody(res)
11248	if err := googleapi.CheckResponse(res); err != nil {
11249		return err
11250	}
11251	return nil
11252	// {
11253	//   "description": "Deletes the specified S/MIME config for the specified send-as alias.",
11254	//   "httpMethod": "DELETE",
11255	//   "id": "gmail.users.settings.sendAs.smimeInfo.delete",
11256	//   "parameterOrder": [
11257	//     "userId",
11258	//     "sendAsEmail",
11259	//     "id"
11260	//   ],
11261	//   "parameters": {
11262	//     "id": {
11263	//       "description": "The immutable ID for the SmimeInfo.",
11264	//       "location": "path",
11265	//       "required": true,
11266	//       "type": "string"
11267	//     },
11268	//     "sendAsEmail": {
11269	//       "description": "The email address that appears in the \"From:\" header for mail sent using this alias.",
11270	//       "location": "path",
11271	//       "required": true,
11272	//       "type": "string"
11273	//     },
11274	//     "userId": {
11275	//       "default": "me",
11276	//       "description": "The user's email address. The special value me can be used to indicate the authenticated user.",
11277	//       "location": "path",
11278	//       "required": true,
11279	//       "type": "string"
11280	//     }
11281	//   },
11282	//   "path": "{userId}/settings/sendAs/{sendAsEmail}/smimeInfo/{id}",
11283	//   "scopes": [
11284	//     "https://www.googleapis.com/auth/gmail.settings.basic",
11285	//     "https://www.googleapis.com/auth/gmail.settings.sharing"
11286	//   ]
11287	// }
11288
11289}
11290
11291// method id "gmail.users.settings.sendAs.smimeInfo.get":
11292
11293type UsersSettingsSendAsSmimeInfoGetCall struct {
11294	s            *Service
11295	userId       string
11296	sendAsEmail  string
11297	id           string
11298	urlParams_   gensupport.URLParams
11299	ifNoneMatch_ string
11300	ctx_         context.Context
11301	header_      http.Header
11302}
11303
11304// Get: Gets the specified S/MIME config for the specified send-as
11305// alias.
11306func (r *UsersSettingsSendAsSmimeInfoService) Get(userId string, sendAsEmail string, id string) *UsersSettingsSendAsSmimeInfoGetCall {
11307	c := &UsersSettingsSendAsSmimeInfoGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
11308	c.userId = userId
11309	c.sendAsEmail = sendAsEmail
11310	c.id = id
11311	return c
11312}
11313
11314// Fields allows partial responses to be retrieved. See
11315// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
11316// for more information.
11317func (c *UsersSettingsSendAsSmimeInfoGetCall) Fields(s ...googleapi.Field) *UsersSettingsSendAsSmimeInfoGetCall {
11318	c.urlParams_.Set("fields", googleapi.CombineFields(s))
11319	return c
11320}
11321
11322// IfNoneMatch sets the optional parameter which makes the operation
11323// fail if the object's ETag matches the given value. This is useful for
11324// getting updates only after the object has changed since the last
11325// request. Use googleapi.IsNotModified to check whether the response
11326// error from Do is the result of In-None-Match.
11327func (c *UsersSettingsSendAsSmimeInfoGetCall) IfNoneMatch(entityTag string) *UsersSettingsSendAsSmimeInfoGetCall {
11328	c.ifNoneMatch_ = entityTag
11329	return c
11330}
11331
11332// Context sets the context to be used in this call's Do method. Any
11333// pending HTTP request will be aborted if the provided context is
11334// canceled.
11335func (c *UsersSettingsSendAsSmimeInfoGetCall) Context(ctx context.Context) *UsersSettingsSendAsSmimeInfoGetCall {
11336	c.ctx_ = ctx
11337	return c
11338}
11339
11340// Header returns an http.Header that can be modified by the caller to
11341// add HTTP headers to the request.
11342func (c *UsersSettingsSendAsSmimeInfoGetCall) Header() http.Header {
11343	if c.header_ == nil {
11344		c.header_ = make(http.Header)
11345	}
11346	return c.header_
11347}
11348
11349func (c *UsersSettingsSendAsSmimeInfoGetCall) doRequest(alt string) (*http.Response, error) {
11350	reqHeaders := make(http.Header)
11351	for k, v := range c.header_ {
11352		reqHeaders[k] = v
11353	}
11354	reqHeaders.Set("User-Agent", c.s.userAgent())
11355	if c.ifNoneMatch_ != "" {
11356		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
11357	}
11358	var body io.Reader = nil
11359	c.urlParams_.Set("alt", alt)
11360	c.urlParams_.Set("prettyPrint", "false")
11361	urls := googleapi.ResolveRelative(c.s.BasePath, "{userId}/settings/sendAs/{sendAsEmail}/smimeInfo/{id}")
11362	urls += "?" + c.urlParams_.Encode()
11363	req, err := http.NewRequest("GET", urls, body)
11364	if err != nil {
11365		return nil, err
11366	}
11367	req.Header = reqHeaders
11368	googleapi.Expand(req.URL, map[string]string{
11369		"userId":      c.userId,
11370		"sendAsEmail": c.sendAsEmail,
11371		"id":          c.id,
11372	})
11373	return gensupport.SendRequest(c.ctx_, c.s.client, req)
11374}
11375
11376// Do executes the "gmail.users.settings.sendAs.smimeInfo.get" call.
11377// Exactly one of *SmimeInfo or error will be non-nil. Any non-2xx
11378// status code is an error. Response headers are in either
11379// *SmimeInfo.ServerResponse.Header or (if a response was returned at
11380// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
11381// to check whether the returned error was because
11382// http.StatusNotModified was returned.
11383func (c *UsersSettingsSendAsSmimeInfoGetCall) Do(opts ...googleapi.CallOption) (*SmimeInfo, error) {
11384	gensupport.SetOptions(c.urlParams_, opts...)
11385	res, err := c.doRequest("json")
11386	if res != nil && res.StatusCode == http.StatusNotModified {
11387		if res.Body != nil {
11388			res.Body.Close()
11389		}
11390		return nil, &googleapi.Error{
11391			Code:   res.StatusCode,
11392			Header: res.Header,
11393		}
11394	}
11395	if err != nil {
11396		return nil, err
11397	}
11398	defer googleapi.CloseBody(res)
11399	if err := googleapi.CheckResponse(res); err != nil {
11400		return nil, err
11401	}
11402	ret := &SmimeInfo{
11403		ServerResponse: googleapi.ServerResponse{
11404			Header:         res.Header,
11405			HTTPStatusCode: res.StatusCode,
11406		},
11407	}
11408	target := &ret
11409	if err := gensupport.DecodeResponse(target, res); err != nil {
11410		return nil, err
11411	}
11412	return ret, nil
11413	// {
11414	//   "description": "Gets the specified S/MIME config for the specified send-as alias.",
11415	//   "httpMethod": "GET",
11416	//   "id": "gmail.users.settings.sendAs.smimeInfo.get",
11417	//   "parameterOrder": [
11418	//     "userId",
11419	//     "sendAsEmail",
11420	//     "id"
11421	//   ],
11422	//   "parameters": {
11423	//     "id": {
11424	//       "description": "The immutable ID for the SmimeInfo.",
11425	//       "location": "path",
11426	//       "required": true,
11427	//       "type": "string"
11428	//     },
11429	//     "sendAsEmail": {
11430	//       "description": "The email address that appears in the \"From:\" header for mail sent using this alias.",
11431	//       "location": "path",
11432	//       "required": true,
11433	//       "type": "string"
11434	//     },
11435	//     "userId": {
11436	//       "default": "me",
11437	//       "description": "The user's email address. The special value me can be used to indicate the authenticated user.",
11438	//       "location": "path",
11439	//       "required": true,
11440	//       "type": "string"
11441	//     }
11442	//   },
11443	//   "path": "{userId}/settings/sendAs/{sendAsEmail}/smimeInfo/{id}",
11444	//   "response": {
11445	//     "$ref": "SmimeInfo"
11446	//   },
11447	//   "scopes": [
11448	//     "https://mail.google.com/",
11449	//     "https://www.googleapis.com/auth/gmail.modify",
11450	//     "https://www.googleapis.com/auth/gmail.readonly",
11451	//     "https://www.googleapis.com/auth/gmail.settings.basic",
11452	//     "https://www.googleapis.com/auth/gmail.settings.sharing"
11453	//   ]
11454	// }
11455
11456}
11457
11458// method id "gmail.users.settings.sendAs.smimeInfo.insert":
11459
11460type UsersSettingsSendAsSmimeInfoInsertCall struct {
11461	s           *Service
11462	userId      string
11463	sendAsEmail string
11464	smimeinfo   *SmimeInfo
11465	urlParams_  gensupport.URLParams
11466	ctx_        context.Context
11467	header_     http.Header
11468}
11469
11470// Insert: Insert (upload) the given S/MIME config for the specified
11471// send-as alias. Note that pkcs12 format is required for the key.
11472func (r *UsersSettingsSendAsSmimeInfoService) Insert(userId string, sendAsEmail string, smimeinfo *SmimeInfo) *UsersSettingsSendAsSmimeInfoInsertCall {
11473	c := &UsersSettingsSendAsSmimeInfoInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)}
11474	c.userId = userId
11475	c.sendAsEmail = sendAsEmail
11476	c.smimeinfo = smimeinfo
11477	return c
11478}
11479
11480// Fields allows partial responses to be retrieved. See
11481// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
11482// for more information.
11483func (c *UsersSettingsSendAsSmimeInfoInsertCall) Fields(s ...googleapi.Field) *UsersSettingsSendAsSmimeInfoInsertCall {
11484	c.urlParams_.Set("fields", googleapi.CombineFields(s))
11485	return c
11486}
11487
11488// Context sets the context to be used in this call's Do method. Any
11489// pending HTTP request will be aborted if the provided context is
11490// canceled.
11491func (c *UsersSettingsSendAsSmimeInfoInsertCall) Context(ctx context.Context) *UsersSettingsSendAsSmimeInfoInsertCall {
11492	c.ctx_ = ctx
11493	return c
11494}
11495
11496// Header returns an http.Header that can be modified by the caller to
11497// add HTTP headers to the request.
11498func (c *UsersSettingsSendAsSmimeInfoInsertCall) Header() http.Header {
11499	if c.header_ == nil {
11500		c.header_ = make(http.Header)
11501	}
11502	return c.header_
11503}
11504
11505func (c *UsersSettingsSendAsSmimeInfoInsertCall) doRequest(alt string) (*http.Response, error) {
11506	reqHeaders := make(http.Header)
11507	for k, v := range c.header_ {
11508		reqHeaders[k] = v
11509	}
11510	reqHeaders.Set("User-Agent", c.s.userAgent())
11511	var body io.Reader = nil
11512	body, err := googleapi.WithoutDataWrapper.JSONReader(c.smimeinfo)
11513	if err != nil {
11514		return nil, err
11515	}
11516	reqHeaders.Set("Content-Type", "application/json")
11517	c.urlParams_.Set("alt", alt)
11518	c.urlParams_.Set("prettyPrint", "false")
11519	urls := googleapi.ResolveRelative(c.s.BasePath, "{userId}/settings/sendAs/{sendAsEmail}/smimeInfo")
11520	urls += "?" + c.urlParams_.Encode()
11521	req, err := http.NewRequest("POST", urls, body)
11522	if err != nil {
11523		return nil, err
11524	}
11525	req.Header = reqHeaders
11526	googleapi.Expand(req.URL, map[string]string{
11527		"userId":      c.userId,
11528		"sendAsEmail": c.sendAsEmail,
11529	})
11530	return gensupport.SendRequest(c.ctx_, c.s.client, req)
11531}
11532
11533// Do executes the "gmail.users.settings.sendAs.smimeInfo.insert" call.
11534// Exactly one of *SmimeInfo or error will be non-nil. Any non-2xx
11535// status code is an error. Response headers are in either
11536// *SmimeInfo.ServerResponse.Header or (if a response was returned at
11537// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
11538// to check whether the returned error was because
11539// http.StatusNotModified was returned.
11540func (c *UsersSettingsSendAsSmimeInfoInsertCall) Do(opts ...googleapi.CallOption) (*SmimeInfo, error) {
11541	gensupport.SetOptions(c.urlParams_, opts...)
11542	res, err := c.doRequest("json")
11543	if res != nil && res.StatusCode == http.StatusNotModified {
11544		if res.Body != nil {
11545			res.Body.Close()
11546		}
11547		return nil, &googleapi.Error{
11548			Code:   res.StatusCode,
11549			Header: res.Header,
11550		}
11551	}
11552	if err != nil {
11553		return nil, err
11554	}
11555	defer googleapi.CloseBody(res)
11556	if err := googleapi.CheckResponse(res); err != nil {
11557		return nil, err
11558	}
11559	ret := &SmimeInfo{
11560		ServerResponse: googleapi.ServerResponse{
11561			Header:         res.Header,
11562			HTTPStatusCode: res.StatusCode,
11563		},
11564	}
11565	target := &ret
11566	if err := gensupport.DecodeResponse(target, res); err != nil {
11567		return nil, err
11568	}
11569	return ret, nil
11570	// {
11571	//   "description": "Insert (upload) the given S/MIME config for the specified send-as alias. Note that pkcs12 format is required for the key.",
11572	//   "httpMethod": "POST",
11573	//   "id": "gmail.users.settings.sendAs.smimeInfo.insert",
11574	//   "parameterOrder": [
11575	//     "userId",
11576	//     "sendAsEmail"
11577	//   ],
11578	//   "parameters": {
11579	//     "sendAsEmail": {
11580	//       "description": "The email address that appears in the \"From:\" header for mail sent using this alias.",
11581	//       "location": "path",
11582	//       "required": true,
11583	//       "type": "string"
11584	//     },
11585	//     "userId": {
11586	//       "default": "me",
11587	//       "description": "The user's email address. The special value me can be used to indicate the authenticated user.",
11588	//       "location": "path",
11589	//       "required": true,
11590	//       "type": "string"
11591	//     }
11592	//   },
11593	//   "path": "{userId}/settings/sendAs/{sendAsEmail}/smimeInfo",
11594	//   "request": {
11595	//     "$ref": "SmimeInfo"
11596	//   },
11597	//   "response": {
11598	//     "$ref": "SmimeInfo"
11599	//   },
11600	//   "scopes": [
11601	//     "https://www.googleapis.com/auth/gmail.settings.basic",
11602	//     "https://www.googleapis.com/auth/gmail.settings.sharing"
11603	//   ]
11604	// }
11605
11606}
11607
11608// method id "gmail.users.settings.sendAs.smimeInfo.list":
11609
11610type UsersSettingsSendAsSmimeInfoListCall struct {
11611	s            *Service
11612	userId       string
11613	sendAsEmail  string
11614	urlParams_   gensupport.URLParams
11615	ifNoneMatch_ string
11616	ctx_         context.Context
11617	header_      http.Header
11618}
11619
11620// List: Lists S/MIME configs for the specified send-as alias.
11621func (r *UsersSettingsSendAsSmimeInfoService) List(userId string, sendAsEmail string) *UsersSettingsSendAsSmimeInfoListCall {
11622	c := &UsersSettingsSendAsSmimeInfoListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
11623	c.userId = userId
11624	c.sendAsEmail = sendAsEmail
11625	return c
11626}
11627
11628// Fields allows partial responses to be retrieved. See
11629// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
11630// for more information.
11631func (c *UsersSettingsSendAsSmimeInfoListCall) Fields(s ...googleapi.Field) *UsersSettingsSendAsSmimeInfoListCall {
11632	c.urlParams_.Set("fields", googleapi.CombineFields(s))
11633	return c
11634}
11635
11636// IfNoneMatch sets the optional parameter which makes the operation
11637// fail if the object's ETag matches the given value. This is useful for
11638// getting updates only after the object has changed since the last
11639// request. Use googleapi.IsNotModified to check whether the response
11640// error from Do is the result of In-None-Match.
11641func (c *UsersSettingsSendAsSmimeInfoListCall) IfNoneMatch(entityTag string) *UsersSettingsSendAsSmimeInfoListCall {
11642	c.ifNoneMatch_ = entityTag
11643	return c
11644}
11645
11646// Context sets the context to be used in this call's Do method. Any
11647// pending HTTP request will be aborted if the provided context is
11648// canceled.
11649func (c *UsersSettingsSendAsSmimeInfoListCall) Context(ctx context.Context) *UsersSettingsSendAsSmimeInfoListCall {
11650	c.ctx_ = ctx
11651	return c
11652}
11653
11654// Header returns an http.Header that can be modified by the caller to
11655// add HTTP headers to the request.
11656func (c *UsersSettingsSendAsSmimeInfoListCall) Header() http.Header {
11657	if c.header_ == nil {
11658		c.header_ = make(http.Header)
11659	}
11660	return c.header_
11661}
11662
11663func (c *UsersSettingsSendAsSmimeInfoListCall) doRequest(alt string) (*http.Response, error) {
11664	reqHeaders := make(http.Header)
11665	for k, v := range c.header_ {
11666		reqHeaders[k] = v
11667	}
11668	reqHeaders.Set("User-Agent", c.s.userAgent())
11669	if c.ifNoneMatch_ != "" {
11670		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
11671	}
11672	var body io.Reader = nil
11673	c.urlParams_.Set("alt", alt)
11674	c.urlParams_.Set("prettyPrint", "false")
11675	urls := googleapi.ResolveRelative(c.s.BasePath, "{userId}/settings/sendAs/{sendAsEmail}/smimeInfo")
11676	urls += "?" + c.urlParams_.Encode()
11677	req, err := http.NewRequest("GET", urls, body)
11678	if err != nil {
11679		return nil, err
11680	}
11681	req.Header = reqHeaders
11682	googleapi.Expand(req.URL, map[string]string{
11683		"userId":      c.userId,
11684		"sendAsEmail": c.sendAsEmail,
11685	})
11686	return gensupport.SendRequest(c.ctx_, c.s.client, req)
11687}
11688
11689// Do executes the "gmail.users.settings.sendAs.smimeInfo.list" call.
11690// Exactly one of *ListSmimeInfoResponse or error will be non-nil. Any
11691// non-2xx status code is an error. Response headers are in either
11692// *ListSmimeInfoResponse.ServerResponse.Header or (if a response was
11693// returned at all) in error.(*googleapi.Error).Header. Use
11694// googleapi.IsNotModified to check whether the returned error was
11695// because http.StatusNotModified was returned.
11696func (c *UsersSettingsSendAsSmimeInfoListCall) Do(opts ...googleapi.CallOption) (*ListSmimeInfoResponse, error) {
11697	gensupport.SetOptions(c.urlParams_, opts...)
11698	res, err := c.doRequest("json")
11699	if res != nil && res.StatusCode == http.StatusNotModified {
11700		if res.Body != nil {
11701			res.Body.Close()
11702		}
11703		return nil, &googleapi.Error{
11704			Code:   res.StatusCode,
11705			Header: res.Header,
11706		}
11707	}
11708	if err != nil {
11709		return nil, err
11710	}
11711	defer googleapi.CloseBody(res)
11712	if err := googleapi.CheckResponse(res); err != nil {
11713		return nil, err
11714	}
11715	ret := &ListSmimeInfoResponse{
11716		ServerResponse: googleapi.ServerResponse{
11717			Header:         res.Header,
11718			HTTPStatusCode: res.StatusCode,
11719		},
11720	}
11721	target := &ret
11722	if err := gensupport.DecodeResponse(target, res); err != nil {
11723		return nil, err
11724	}
11725	return ret, nil
11726	// {
11727	//   "description": "Lists S/MIME configs for the specified send-as alias.",
11728	//   "httpMethod": "GET",
11729	//   "id": "gmail.users.settings.sendAs.smimeInfo.list",
11730	//   "parameterOrder": [
11731	//     "userId",
11732	//     "sendAsEmail"
11733	//   ],
11734	//   "parameters": {
11735	//     "sendAsEmail": {
11736	//       "description": "The email address that appears in the \"From:\" header for mail sent using this alias.",
11737	//       "location": "path",
11738	//       "required": true,
11739	//       "type": "string"
11740	//     },
11741	//     "userId": {
11742	//       "default": "me",
11743	//       "description": "The user's email address. The special value me can be used to indicate the authenticated user.",
11744	//       "location": "path",
11745	//       "required": true,
11746	//       "type": "string"
11747	//     }
11748	//   },
11749	//   "path": "{userId}/settings/sendAs/{sendAsEmail}/smimeInfo",
11750	//   "response": {
11751	//     "$ref": "ListSmimeInfoResponse"
11752	//   },
11753	//   "scopes": [
11754	//     "https://mail.google.com/",
11755	//     "https://www.googleapis.com/auth/gmail.modify",
11756	//     "https://www.googleapis.com/auth/gmail.readonly",
11757	//     "https://www.googleapis.com/auth/gmail.settings.basic",
11758	//     "https://www.googleapis.com/auth/gmail.settings.sharing"
11759	//   ]
11760	// }
11761
11762}
11763
11764// method id "gmail.users.settings.sendAs.smimeInfo.setDefault":
11765
11766type UsersSettingsSendAsSmimeInfoSetDefaultCall struct {
11767	s           *Service
11768	userId      string
11769	sendAsEmail string
11770	id          string
11771	urlParams_  gensupport.URLParams
11772	ctx_        context.Context
11773	header_     http.Header
11774}
11775
11776// SetDefault: Sets the default S/MIME config for the specified send-as
11777// alias.
11778func (r *UsersSettingsSendAsSmimeInfoService) SetDefault(userId string, sendAsEmail string, id string) *UsersSettingsSendAsSmimeInfoSetDefaultCall {
11779	c := &UsersSettingsSendAsSmimeInfoSetDefaultCall{s: r.s, urlParams_: make(gensupport.URLParams)}
11780	c.userId = userId
11781	c.sendAsEmail = sendAsEmail
11782	c.id = id
11783	return c
11784}
11785
11786// Fields allows partial responses to be retrieved. See
11787// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
11788// for more information.
11789func (c *UsersSettingsSendAsSmimeInfoSetDefaultCall) Fields(s ...googleapi.Field) *UsersSettingsSendAsSmimeInfoSetDefaultCall {
11790	c.urlParams_.Set("fields", googleapi.CombineFields(s))
11791	return c
11792}
11793
11794// Context sets the context to be used in this call's Do method. Any
11795// pending HTTP request will be aborted if the provided context is
11796// canceled.
11797func (c *UsersSettingsSendAsSmimeInfoSetDefaultCall) Context(ctx context.Context) *UsersSettingsSendAsSmimeInfoSetDefaultCall {
11798	c.ctx_ = ctx
11799	return c
11800}
11801
11802// Header returns an http.Header that can be modified by the caller to
11803// add HTTP headers to the request.
11804func (c *UsersSettingsSendAsSmimeInfoSetDefaultCall) Header() http.Header {
11805	if c.header_ == nil {
11806		c.header_ = make(http.Header)
11807	}
11808	return c.header_
11809}
11810
11811func (c *UsersSettingsSendAsSmimeInfoSetDefaultCall) doRequest(alt string) (*http.Response, error) {
11812	reqHeaders := make(http.Header)
11813	for k, v := range c.header_ {
11814		reqHeaders[k] = v
11815	}
11816	reqHeaders.Set("User-Agent", c.s.userAgent())
11817	var body io.Reader = nil
11818	c.urlParams_.Set("alt", alt)
11819	c.urlParams_.Set("prettyPrint", "false")
11820	urls := googleapi.ResolveRelative(c.s.BasePath, "{userId}/settings/sendAs/{sendAsEmail}/smimeInfo/{id}/setDefault")
11821	urls += "?" + c.urlParams_.Encode()
11822	req, err := http.NewRequest("POST", urls, body)
11823	if err != nil {
11824		return nil, err
11825	}
11826	req.Header = reqHeaders
11827	googleapi.Expand(req.URL, map[string]string{
11828		"userId":      c.userId,
11829		"sendAsEmail": c.sendAsEmail,
11830		"id":          c.id,
11831	})
11832	return gensupport.SendRequest(c.ctx_, c.s.client, req)
11833}
11834
11835// Do executes the "gmail.users.settings.sendAs.smimeInfo.setDefault" call.
11836func (c *UsersSettingsSendAsSmimeInfoSetDefaultCall) Do(opts ...googleapi.CallOption) error {
11837	gensupport.SetOptions(c.urlParams_, opts...)
11838	res, err := c.doRequest("json")
11839	if err != nil {
11840		return err
11841	}
11842	defer googleapi.CloseBody(res)
11843	if err := googleapi.CheckResponse(res); err != nil {
11844		return err
11845	}
11846	return nil
11847	// {
11848	//   "description": "Sets the default S/MIME config for the specified send-as alias.",
11849	//   "httpMethod": "POST",
11850	//   "id": "gmail.users.settings.sendAs.smimeInfo.setDefault",
11851	//   "parameterOrder": [
11852	//     "userId",
11853	//     "sendAsEmail",
11854	//     "id"
11855	//   ],
11856	//   "parameters": {
11857	//     "id": {
11858	//       "description": "The immutable ID for the SmimeInfo.",
11859	//       "location": "path",
11860	//       "required": true,
11861	//       "type": "string"
11862	//     },
11863	//     "sendAsEmail": {
11864	//       "description": "The email address that appears in the \"From:\" header for mail sent using this alias.",
11865	//       "location": "path",
11866	//       "required": true,
11867	//       "type": "string"
11868	//     },
11869	//     "userId": {
11870	//       "default": "me",
11871	//       "description": "The user's email address. The special value me can be used to indicate the authenticated user.",
11872	//       "location": "path",
11873	//       "required": true,
11874	//       "type": "string"
11875	//     }
11876	//   },
11877	//   "path": "{userId}/settings/sendAs/{sendAsEmail}/smimeInfo/{id}/setDefault",
11878	//   "scopes": [
11879	//     "https://www.googleapis.com/auth/gmail.settings.basic",
11880	//     "https://www.googleapis.com/auth/gmail.settings.sharing"
11881	//   ]
11882	// }
11883
11884}
11885
11886// method id "gmail.users.threads.delete":
11887
11888type UsersThreadsDeleteCall struct {
11889	s          *Service
11890	userId     string
11891	id         string
11892	urlParams_ gensupport.URLParams
11893	ctx_       context.Context
11894	header_    http.Header
11895}
11896
11897// Delete: Immediately and permanently deletes the specified thread.
11898// This operation cannot be undone. Prefer threads.trash instead.
11899func (r *UsersThreadsService) Delete(userId string, id string) *UsersThreadsDeleteCall {
11900	c := &UsersThreadsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
11901	c.userId = userId
11902	c.id = id
11903	return c
11904}
11905
11906// Fields allows partial responses to be retrieved. See
11907// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
11908// for more information.
11909func (c *UsersThreadsDeleteCall) Fields(s ...googleapi.Field) *UsersThreadsDeleteCall {
11910	c.urlParams_.Set("fields", googleapi.CombineFields(s))
11911	return c
11912}
11913
11914// Context sets the context to be used in this call's Do method. Any
11915// pending HTTP request will be aborted if the provided context is
11916// canceled.
11917func (c *UsersThreadsDeleteCall) Context(ctx context.Context) *UsersThreadsDeleteCall {
11918	c.ctx_ = ctx
11919	return c
11920}
11921
11922// Header returns an http.Header that can be modified by the caller to
11923// add HTTP headers to the request.
11924func (c *UsersThreadsDeleteCall) Header() http.Header {
11925	if c.header_ == nil {
11926		c.header_ = make(http.Header)
11927	}
11928	return c.header_
11929}
11930
11931func (c *UsersThreadsDeleteCall) doRequest(alt string) (*http.Response, error) {
11932	reqHeaders := make(http.Header)
11933	for k, v := range c.header_ {
11934		reqHeaders[k] = v
11935	}
11936	reqHeaders.Set("User-Agent", c.s.userAgent())
11937	var body io.Reader = nil
11938	c.urlParams_.Set("alt", alt)
11939	c.urlParams_.Set("prettyPrint", "false")
11940	urls := googleapi.ResolveRelative(c.s.BasePath, "{userId}/threads/{id}")
11941	urls += "?" + c.urlParams_.Encode()
11942	req, err := http.NewRequest("DELETE", urls, body)
11943	if err != nil {
11944		return nil, err
11945	}
11946	req.Header = reqHeaders
11947	googleapi.Expand(req.URL, map[string]string{
11948		"userId": c.userId,
11949		"id":     c.id,
11950	})
11951	return gensupport.SendRequest(c.ctx_, c.s.client, req)
11952}
11953
11954// Do executes the "gmail.users.threads.delete" call.
11955func (c *UsersThreadsDeleteCall) Do(opts ...googleapi.CallOption) error {
11956	gensupport.SetOptions(c.urlParams_, opts...)
11957	res, err := c.doRequest("json")
11958	if err != nil {
11959		return err
11960	}
11961	defer googleapi.CloseBody(res)
11962	if err := googleapi.CheckResponse(res); err != nil {
11963		return err
11964	}
11965	return nil
11966	// {
11967	//   "description": "Immediately and permanently deletes the specified thread. This operation cannot be undone. Prefer threads.trash instead.",
11968	//   "httpMethod": "DELETE",
11969	//   "id": "gmail.users.threads.delete",
11970	//   "parameterOrder": [
11971	//     "userId",
11972	//     "id"
11973	//   ],
11974	//   "parameters": {
11975	//     "id": {
11976	//       "description": "ID of the Thread to delete.",
11977	//       "location": "path",
11978	//       "required": true,
11979	//       "type": "string"
11980	//     },
11981	//     "userId": {
11982	//       "default": "me",
11983	//       "description": "The user's email address. The special value me can be used to indicate the authenticated user.",
11984	//       "location": "path",
11985	//       "required": true,
11986	//       "type": "string"
11987	//     }
11988	//   },
11989	//   "path": "{userId}/threads/{id}",
11990	//   "scopes": [
11991	//     "https://mail.google.com/"
11992	//   ]
11993	// }
11994
11995}
11996
11997// method id "gmail.users.threads.get":
11998
11999type UsersThreadsGetCall struct {
12000	s            *Service
12001	userId       string
12002	id           string
12003	urlParams_   gensupport.URLParams
12004	ifNoneMatch_ string
12005	ctx_         context.Context
12006	header_      http.Header
12007}
12008
12009// Get: Gets the specified thread.
12010func (r *UsersThreadsService) Get(userId string, id string) *UsersThreadsGetCall {
12011	c := &UsersThreadsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
12012	c.userId = userId
12013	c.id = id
12014	return c
12015}
12016
12017// Format sets the optional parameter "format": The format to return the
12018// messages in.
12019//
12020// Possible values:
12021//   "full" (default)
12022//   "metadata"
12023//   "minimal"
12024func (c *UsersThreadsGetCall) Format(format string) *UsersThreadsGetCall {
12025	c.urlParams_.Set("format", format)
12026	return c
12027}
12028
12029// MetadataHeaders sets the optional parameter "metadataHeaders": When
12030// given and format is METADATA, only include headers specified.
12031func (c *UsersThreadsGetCall) MetadataHeaders(metadataHeaders ...string) *UsersThreadsGetCall {
12032	c.urlParams_.SetMulti("metadataHeaders", append([]string{}, metadataHeaders...))
12033	return c
12034}
12035
12036// Fields allows partial responses to be retrieved. See
12037// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
12038// for more information.
12039func (c *UsersThreadsGetCall) Fields(s ...googleapi.Field) *UsersThreadsGetCall {
12040	c.urlParams_.Set("fields", googleapi.CombineFields(s))
12041	return c
12042}
12043
12044// IfNoneMatch sets the optional parameter which makes the operation
12045// fail if the object's ETag matches the given value. This is useful for
12046// getting updates only after the object has changed since the last
12047// request. Use googleapi.IsNotModified to check whether the response
12048// error from Do is the result of In-None-Match.
12049func (c *UsersThreadsGetCall) IfNoneMatch(entityTag string) *UsersThreadsGetCall {
12050	c.ifNoneMatch_ = entityTag
12051	return c
12052}
12053
12054// Context sets the context to be used in this call's Do method. Any
12055// pending HTTP request will be aborted if the provided context is
12056// canceled.
12057func (c *UsersThreadsGetCall) Context(ctx context.Context) *UsersThreadsGetCall {
12058	c.ctx_ = ctx
12059	return c
12060}
12061
12062// Header returns an http.Header that can be modified by the caller to
12063// add HTTP headers to the request.
12064func (c *UsersThreadsGetCall) Header() http.Header {
12065	if c.header_ == nil {
12066		c.header_ = make(http.Header)
12067	}
12068	return c.header_
12069}
12070
12071func (c *UsersThreadsGetCall) doRequest(alt string) (*http.Response, error) {
12072	reqHeaders := make(http.Header)
12073	for k, v := range c.header_ {
12074		reqHeaders[k] = v
12075	}
12076	reqHeaders.Set("User-Agent", c.s.userAgent())
12077	if c.ifNoneMatch_ != "" {
12078		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
12079	}
12080	var body io.Reader = nil
12081	c.urlParams_.Set("alt", alt)
12082	c.urlParams_.Set("prettyPrint", "false")
12083	urls := googleapi.ResolveRelative(c.s.BasePath, "{userId}/threads/{id}")
12084	urls += "?" + c.urlParams_.Encode()
12085	req, err := http.NewRequest("GET", urls, body)
12086	if err != nil {
12087		return nil, err
12088	}
12089	req.Header = reqHeaders
12090	googleapi.Expand(req.URL, map[string]string{
12091		"userId": c.userId,
12092		"id":     c.id,
12093	})
12094	return gensupport.SendRequest(c.ctx_, c.s.client, req)
12095}
12096
12097// Do executes the "gmail.users.threads.get" call.
12098// Exactly one of *Thread or error will be non-nil. Any non-2xx status
12099// code is an error. Response headers are in either
12100// *Thread.ServerResponse.Header or (if a response was returned at all)
12101// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
12102// check whether the returned error was because http.StatusNotModified
12103// was returned.
12104func (c *UsersThreadsGetCall) Do(opts ...googleapi.CallOption) (*Thread, error) {
12105	gensupport.SetOptions(c.urlParams_, opts...)
12106	res, err := c.doRequest("json")
12107	if res != nil && res.StatusCode == http.StatusNotModified {
12108		if res.Body != nil {
12109			res.Body.Close()
12110		}
12111		return nil, &googleapi.Error{
12112			Code:   res.StatusCode,
12113			Header: res.Header,
12114		}
12115	}
12116	if err != nil {
12117		return nil, err
12118	}
12119	defer googleapi.CloseBody(res)
12120	if err := googleapi.CheckResponse(res); err != nil {
12121		return nil, err
12122	}
12123	ret := &Thread{
12124		ServerResponse: googleapi.ServerResponse{
12125			Header:         res.Header,
12126			HTTPStatusCode: res.StatusCode,
12127		},
12128	}
12129	target := &ret
12130	if err := gensupport.DecodeResponse(target, res); err != nil {
12131		return nil, err
12132	}
12133	return ret, nil
12134	// {
12135	//   "description": "Gets the specified thread.",
12136	//   "httpMethod": "GET",
12137	//   "id": "gmail.users.threads.get",
12138	//   "parameterOrder": [
12139	//     "userId",
12140	//     "id"
12141	//   ],
12142	//   "parameters": {
12143	//     "format": {
12144	//       "default": "full",
12145	//       "description": "The format to return the messages in.",
12146	//       "enum": [
12147	//         "full",
12148	//         "metadata",
12149	//         "minimal"
12150	//       ],
12151	//       "enumDescriptions": [
12152	//         "",
12153	//         "",
12154	//         ""
12155	//       ],
12156	//       "location": "query",
12157	//       "type": "string"
12158	//     },
12159	//     "id": {
12160	//       "description": "The ID of the thread to retrieve.",
12161	//       "location": "path",
12162	//       "required": true,
12163	//       "type": "string"
12164	//     },
12165	//     "metadataHeaders": {
12166	//       "description": "When given and format is METADATA, only include headers specified.",
12167	//       "location": "query",
12168	//       "repeated": true,
12169	//       "type": "string"
12170	//     },
12171	//     "userId": {
12172	//       "default": "me",
12173	//       "description": "The user's email address. The special value me can be used to indicate the authenticated user.",
12174	//       "location": "path",
12175	//       "required": true,
12176	//       "type": "string"
12177	//     }
12178	//   },
12179	//   "path": "{userId}/threads/{id}",
12180	//   "response": {
12181	//     "$ref": "Thread"
12182	//   },
12183	//   "scopes": [
12184	//     "https://mail.google.com/",
12185	//     "https://www.googleapis.com/auth/gmail.metadata",
12186	//     "https://www.googleapis.com/auth/gmail.modify",
12187	//     "https://www.googleapis.com/auth/gmail.readonly"
12188	//   ]
12189	// }
12190
12191}
12192
12193// method id "gmail.users.threads.list":
12194
12195type UsersThreadsListCall struct {
12196	s            *Service
12197	userId       string
12198	urlParams_   gensupport.URLParams
12199	ifNoneMatch_ string
12200	ctx_         context.Context
12201	header_      http.Header
12202}
12203
12204// List: Lists the threads in the user's mailbox.
12205func (r *UsersThreadsService) List(userId string) *UsersThreadsListCall {
12206	c := &UsersThreadsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
12207	c.userId = userId
12208	return c
12209}
12210
12211// IncludeSpamTrash sets the optional parameter "includeSpamTrash":
12212// Include threads from SPAM and TRASH in the results.
12213func (c *UsersThreadsListCall) IncludeSpamTrash(includeSpamTrash bool) *UsersThreadsListCall {
12214	c.urlParams_.Set("includeSpamTrash", fmt.Sprint(includeSpamTrash))
12215	return c
12216}
12217
12218// LabelIds sets the optional parameter "labelIds": Only return threads
12219// with labels that match all of the specified label IDs.
12220func (c *UsersThreadsListCall) LabelIds(labelIds ...string) *UsersThreadsListCall {
12221	c.urlParams_.SetMulti("labelIds", append([]string{}, labelIds...))
12222	return c
12223}
12224
12225// MaxResults sets the optional parameter "maxResults": Maximum number
12226// of threads to return.
12227func (c *UsersThreadsListCall) MaxResults(maxResults int64) *UsersThreadsListCall {
12228	c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
12229	return c
12230}
12231
12232// PageToken sets the optional parameter "pageToken": Page token to
12233// retrieve a specific page of results in the list.
12234func (c *UsersThreadsListCall) PageToken(pageToken string) *UsersThreadsListCall {
12235	c.urlParams_.Set("pageToken", pageToken)
12236	return c
12237}
12238
12239// Q sets the optional parameter "q": Only return threads matching the
12240// specified query. Supports the same query format as the Gmail search
12241// box. For example, "from:someuser@example.com rfc822msgid: is:unread".
12242// Parameter cannot be used when accessing the api using the
12243// gmail.metadata scope.
12244func (c *UsersThreadsListCall) Q(q string) *UsersThreadsListCall {
12245	c.urlParams_.Set("q", q)
12246	return c
12247}
12248
12249// Fields allows partial responses to be retrieved. See
12250// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
12251// for more information.
12252func (c *UsersThreadsListCall) Fields(s ...googleapi.Field) *UsersThreadsListCall {
12253	c.urlParams_.Set("fields", googleapi.CombineFields(s))
12254	return c
12255}
12256
12257// IfNoneMatch sets the optional parameter which makes the operation
12258// fail if the object's ETag matches the given value. This is useful for
12259// getting updates only after the object has changed since the last
12260// request. Use googleapi.IsNotModified to check whether the response
12261// error from Do is the result of In-None-Match.
12262func (c *UsersThreadsListCall) IfNoneMatch(entityTag string) *UsersThreadsListCall {
12263	c.ifNoneMatch_ = entityTag
12264	return c
12265}
12266
12267// Context sets the context to be used in this call's Do method. Any
12268// pending HTTP request will be aborted if the provided context is
12269// canceled.
12270func (c *UsersThreadsListCall) Context(ctx context.Context) *UsersThreadsListCall {
12271	c.ctx_ = ctx
12272	return c
12273}
12274
12275// Header returns an http.Header that can be modified by the caller to
12276// add HTTP headers to the request.
12277func (c *UsersThreadsListCall) Header() http.Header {
12278	if c.header_ == nil {
12279		c.header_ = make(http.Header)
12280	}
12281	return c.header_
12282}
12283
12284func (c *UsersThreadsListCall) doRequest(alt string) (*http.Response, error) {
12285	reqHeaders := make(http.Header)
12286	for k, v := range c.header_ {
12287		reqHeaders[k] = v
12288	}
12289	reqHeaders.Set("User-Agent", c.s.userAgent())
12290	if c.ifNoneMatch_ != "" {
12291		reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
12292	}
12293	var body io.Reader = nil
12294	c.urlParams_.Set("alt", alt)
12295	c.urlParams_.Set("prettyPrint", "false")
12296	urls := googleapi.ResolveRelative(c.s.BasePath, "{userId}/threads")
12297	urls += "?" + c.urlParams_.Encode()
12298	req, err := http.NewRequest("GET", urls, body)
12299	if err != nil {
12300		return nil, err
12301	}
12302	req.Header = reqHeaders
12303	googleapi.Expand(req.URL, map[string]string{
12304		"userId": c.userId,
12305	})
12306	return gensupport.SendRequest(c.ctx_, c.s.client, req)
12307}
12308
12309// Do executes the "gmail.users.threads.list" call.
12310// Exactly one of *ListThreadsResponse or error will be non-nil. Any
12311// non-2xx status code is an error. Response headers are in either
12312// *ListThreadsResponse.ServerResponse.Header or (if a response was
12313// returned at all) in error.(*googleapi.Error).Header. Use
12314// googleapi.IsNotModified to check whether the returned error was
12315// because http.StatusNotModified was returned.
12316func (c *UsersThreadsListCall) Do(opts ...googleapi.CallOption) (*ListThreadsResponse, error) {
12317	gensupport.SetOptions(c.urlParams_, opts...)
12318	res, err := c.doRequest("json")
12319	if res != nil && res.StatusCode == http.StatusNotModified {
12320		if res.Body != nil {
12321			res.Body.Close()
12322		}
12323		return nil, &googleapi.Error{
12324			Code:   res.StatusCode,
12325			Header: res.Header,
12326		}
12327	}
12328	if err != nil {
12329		return nil, err
12330	}
12331	defer googleapi.CloseBody(res)
12332	if err := googleapi.CheckResponse(res); err != nil {
12333		return nil, err
12334	}
12335	ret := &ListThreadsResponse{
12336		ServerResponse: googleapi.ServerResponse{
12337			Header:         res.Header,
12338			HTTPStatusCode: res.StatusCode,
12339		},
12340	}
12341	target := &ret
12342	if err := gensupport.DecodeResponse(target, res); err != nil {
12343		return nil, err
12344	}
12345	return ret, nil
12346	// {
12347	//   "description": "Lists the threads in the user's mailbox.",
12348	//   "httpMethod": "GET",
12349	//   "id": "gmail.users.threads.list",
12350	//   "parameterOrder": [
12351	//     "userId"
12352	//   ],
12353	//   "parameters": {
12354	//     "includeSpamTrash": {
12355	//       "default": "false",
12356	//       "description": "Include threads from SPAM and TRASH in the results.",
12357	//       "location": "query",
12358	//       "type": "boolean"
12359	//     },
12360	//     "labelIds": {
12361	//       "description": "Only return threads with labels that match all of the specified label IDs.",
12362	//       "location": "query",
12363	//       "repeated": true,
12364	//       "type": "string"
12365	//     },
12366	//     "maxResults": {
12367	//       "default": "100",
12368	//       "description": "Maximum number of threads to return.",
12369	//       "format": "uint32",
12370	//       "location": "query",
12371	//       "type": "integer"
12372	//     },
12373	//     "pageToken": {
12374	//       "description": "Page token to retrieve a specific page of results in the list.",
12375	//       "location": "query",
12376	//       "type": "string"
12377	//     },
12378	//     "q": {
12379	//       "description": "Only return threads matching the specified query. Supports the same query format as the Gmail search box. For example, \"from:someuser@example.com rfc822msgid: is:unread\". Parameter cannot be used when accessing the api using the gmail.metadata scope.",
12380	//       "location": "query",
12381	//       "type": "string"
12382	//     },
12383	//     "userId": {
12384	//       "default": "me",
12385	//       "description": "The user's email address. The special value me can be used to indicate the authenticated user.",
12386	//       "location": "path",
12387	//       "required": true,
12388	//       "type": "string"
12389	//     }
12390	//   },
12391	//   "path": "{userId}/threads",
12392	//   "response": {
12393	//     "$ref": "ListThreadsResponse"
12394	//   },
12395	//   "scopes": [
12396	//     "https://mail.google.com/",
12397	//     "https://www.googleapis.com/auth/gmail.metadata",
12398	//     "https://www.googleapis.com/auth/gmail.modify",
12399	//     "https://www.googleapis.com/auth/gmail.readonly"
12400	//   ]
12401	// }
12402
12403}
12404
12405// Pages invokes f for each page of results.
12406// A non-nil error returned from f will halt the iteration.
12407// The provided context supersedes any context provided to the Context method.
12408func (c *UsersThreadsListCall) Pages(ctx context.Context, f func(*ListThreadsResponse) error) error {
12409	c.ctx_ = ctx
12410	defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
12411	for {
12412		x, err := c.Do()
12413		if err != nil {
12414			return err
12415		}
12416		if err := f(x); err != nil {
12417			return err
12418		}
12419		if x.NextPageToken == "" {
12420			return nil
12421		}
12422		c.PageToken(x.NextPageToken)
12423	}
12424}
12425
12426// method id "gmail.users.threads.modify":
12427
12428type UsersThreadsModifyCall struct {
12429	s                   *Service
12430	userId              string
12431	id                  string
12432	modifythreadrequest *ModifyThreadRequest
12433	urlParams_          gensupport.URLParams
12434	ctx_                context.Context
12435	header_             http.Header
12436}
12437
12438// Modify: Modifies the labels applied to the thread. This applies to
12439// all messages in the thread.
12440func (r *UsersThreadsService) Modify(userId string, id string, modifythreadrequest *ModifyThreadRequest) *UsersThreadsModifyCall {
12441	c := &UsersThreadsModifyCall{s: r.s, urlParams_: make(gensupport.URLParams)}
12442	c.userId = userId
12443	c.id = id
12444	c.modifythreadrequest = modifythreadrequest
12445	return c
12446}
12447
12448// Fields allows partial responses to be retrieved. See
12449// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
12450// for more information.
12451func (c *UsersThreadsModifyCall) Fields(s ...googleapi.Field) *UsersThreadsModifyCall {
12452	c.urlParams_.Set("fields", googleapi.CombineFields(s))
12453	return c
12454}
12455
12456// Context sets the context to be used in this call's Do method. Any
12457// pending HTTP request will be aborted if the provided context is
12458// canceled.
12459func (c *UsersThreadsModifyCall) Context(ctx context.Context) *UsersThreadsModifyCall {
12460	c.ctx_ = ctx
12461	return c
12462}
12463
12464// Header returns an http.Header that can be modified by the caller to
12465// add HTTP headers to the request.
12466func (c *UsersThreadsModifyCall) Header() http.Header {
12467	if c.header_ == nil {
12468		c.header_ = make(http.Header)
12469	}
12470	return c.header_
12471}
12472
12473func (c *UsersThreadsModifyCall) doRequest(alt string) (*http.Response, error) {
12474	reqHeaders := make(http.Header)
12475	for k, v := range c.header_ {
12476		reqHeaders[k] = v
12477	}
12478	reqHeaders.Set("User-Agent", c.s.userAgent())
12479	var body io.Reader = nil
12480	body, err := googleapi.WithoutDataWrapper.JSONReader(c.modifythreadrequest)
12481	if err != nil {
12482		return nil, err
12483	}
12484	reqHeaders.Set("Content-Type", "application/json")
12485	c.urlParams_.Set("alt", alt)
12486	c.urlParams_.Set("prettyPrint", "false")
12487	urls := googleapi.ResolveRelative(c.s.BasePath, "{userId}/threads/{id}/modify")
12488	urls += "?" + c.urlParams_.Encode()
12489	req, err := http.NewRequest("POST", urls, body)
12490	if err != nil {
12491		return nil, err
12492	}
12493	req.Header = reqHeaders
12494	googleapi.Expand(req.URL, map[string]string{
12495		"userId": c.userId,
12496		"id":     c.id,
12497	})
12498	return gensupport.SendRequest(c.ctx_, c.s.client, req)
12499}
12500
12501// Do executes the "gmail.users.threads.modify" call.
12502// Exactly one of *Thread or error will be non-nil. Any non-2xx status
12503// code is an error. Response headers are in either
12504// *Thread.ServerResponse.Header or (if a response was returned at all)
12505// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
12506// check whether the returned error was because http.StatusNotModified
12507// was returned.
12508func (c *UsersThreadsModifyCall) Do(opts ...googleapi.CallOption) (*Thread, error) {
12509	gensupport.SetOptions(c.urlParams_, opts...)
12510	res, err := c.doRequest("json")
12511	if res != nil && res.StatusCode == http.StatusNotModified {
12512		if res.Body != nil {
12513			res.Body.Close()
12514		}
12515		return nil, &googleapi.Error{
12516			Code:   res.StatusCode,
12517			Header: res.Header,
12518		}
12519	}
12520	if err != nil {
12521		return nil, err
12522	}
12523	defer googleapi.CloseBody(res)
12524	if err := googleapi.CheckResponse(res); err != nil {
12525		return nil, err
12526	}
12527	ret := &Thread{
12528		ServerResponse: googleapi.ServerResponse{
12529			Header:         res.Header,
12530			HTTPStatusCode: res.StatusCode,
12531		},
12532	}
12533	target := &ret
12534	if err := gensupport.DecodeResponse(target, res); err != nil {
12535		return nil, err
12536	}
12537	return ret, nil
12538	// {
12539	//   "description": "Modifies the labels applied to the thread. This applies to all messages in the thread.",
12540	//   "httpMethod": "POST",
12541	//   "id": "gmail.users.threads.modify",
12542	//   "parameterOrder": [
12543	//     "userId",
12544	//     "id"
12545	//   ],
12546	//   "parameters": {
12547	//     "id": {
12548	//       "description": "The ID of the thread to modify.",
12549	//       "location": "path",
12550	//       "required": true,
12551	//       "type": "string"
12552	//     },
12553	//     "userId": {
12554	//       "default": "me",
12555	//       "description": "The user's email address. The special value me can be used to indicate the authenticated user.",
12556	//       "location": "path",
12557	//       "required": true,
12558	//       "type": "string"
12559	//     }
12560	//   },
12561	//   "path": "{userId}/threads/{id}/modify",
12562	//   "request": {
12563	//     "$ref": "ModifyThreadRequest"
12564	//   },
12565	//   "response": {
12566	//     "$ref": "Thread"
12567	//   },
12568	//   "scopes": [
12569	//     "https://mail.google.com/",
12570	//     "https://www.googleapis.com/auth/gmail.modify"
12571	//   ]
12572	// }
12573
12574}
12575
12576// method id "gmail.users.threads.trash":
12577
12578type UsersThreadsTrashCall struct {
12579	s          *Service
12580	userId     string
12581	id         string
12582	urlParams_ gensupport.URLParams
12583	ctx_       context.Context
12584	header_    http.Header
12585}
12586
12587// Trash: Moves the specified thread to the trash.
12588func (r *UsersThreadsService) Trash(userId string, id string) *UsersThreadsTrashCall {
12589	c := &UsersThreadsTrashCall{s: r.s, urlParams_: make(gensupport.URLParams)}
12590	c.userId = userId
12591	c.id = id
12592	return c
12593}
12594
12595// Fields allows partial responses to be retrieved. See
12596// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
12597// for more information.
12598func (c *UsersThreadsTrashCall) Fields(s ...googleapi.Field) *UsersThreadsTrashCall {
12599	c.urlParams_.Set("fields", googleapi.CombineFields(s))
12600	return c
12601}
12602
12603// Context sets the context to be used in this call's Do method. Any
12604// pending HTTP request will be aborted if the provided context is
12605// canceled.
12606func (c *UsersThreadsTrashCall) Context(ctx context.Context) *UsersThreadsTrashCall {
12607	c.ctx_ = ctx
12608	return c
12609}
12610
12611// Header returns an http.Header that can be modified by the caller to
12612// add HTTP headers to the request.
12613func (c *UsersThreadsTrashCall) Header() http.Header {
12614	if c.header_ == nil {
12615		c.header_ = make(http.Header)
12616	}
12617	return c.header_
12618}
12619
12620func (c *UsersThreadsTrashCall) doRequest(alt string) (*http.Response, error) {
12621	reqHeaders := make(http.Header)
12622	for k, v := range c.header_ {
12623		reqHeaders[k] = v
12624	}
12625	reqHeaders.Set("User-Agent", c.s.userAgent())
12626	var body io.Reader = nil
12627	c.urlParams_.Set("alt", alt)
12628	c.urlParams_.Set("prettyPrint", "false")
12629	urls := googleapi.ResolveRelative(c.s.BasePath, "{userId}/threads/{id}/trash")
12630	urls += "?" + c.urlParams_.Encode()
12631	req, err := http.NewRequest("POST", urls, body)
12632	if err != nil {
12633		return nil, err
12634	}
12635	req.Header = reqHeaders
12636	googleapi.Expand(req.URL, map[string]string{
12637		"userId": c.userId,
12638		"id":     c.id,
12639	})
12640	return gensupport.SendRequest(c.ctx_, c.s.client, req)
12641}
12642
12643// Do executes the "gmail.users.threads.trash" call.
12644// Exactly one of *Thread or error will be non-nil. Any non-2xx status
12645// code is an error. Response headers are in either
12646// *Thread.ServerResponse.Header or (if a response was returned at all)
12647// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
12648// check whether the returned error was because http.StatusNotModified
12649// was returned.
12650func (c *UsersThreadsTrashCall) Do(opts ...googleapi.CallOption) (*Thread, error) {
12651	gensupport.SetOptions(c.urlParams_, opts...)
12652	res, err := c.doRequest("json")
12653	if res != nil && res.StatusCode == http.StatusNotModified {
12654		if res.Body != nil {
12655			res.Body.Close()
12656		}
12657		return nil, &googleapi.Error{
12658			Code:   res.StatusCode,
12659			Header: res.Header,
12660		}
12661	}
12662	if err != nil {
12663		return nil, err
12664	}
12665	defer googleapi.CloseBody(res)
12666	if err := googleapi.CheckResponse(res); err != nil {
12667		return nil, err
12668	}
12669	ret := &Thread{
12670		ServerResponse: googleapi.ServerResponse{
12671			Header:         res.Header,
12672			HTTPStatusCode: res.StatusCode,
12673		},
12674	}
12675	target := &ret
12676	if err := gensupport.DecodeResponse(target, res); err != nil {
12677		return nil, err
12678	}
12679	return ret, nil
12680	// {
12681	//   "description": "Moves the specified thread to the trash.",
12682	//   "httpMethod": "POST",
12683	//   "id": "gmail.users.threads.trash",
12684	//   "parameterOrder": [
12685	//     "userId",
12686	//     "id"
12687	//   ],
12688	//   "parameters": {
12689	//     "id": {
12690	//       "description": "The ID of the thread to Trash.",
12691	//       "location": "path",
12692	//       "required": true,
12693	//       "type": "string"
12694	//     },
12695	//     "userId": {
12696	//       "default": "me",
12697	//       "description": "The user's email address. The special value me can be used to indicate the authenticated user.",
12698	//       "location": "path",
12699	//       "required": true,
12700	//       "type": "string"
12701	//     }
12702	//   },
12703	//   "path": "{userId}/threads/{id}/trash",
12704	//   "response": {
12705	//     "$ref": "Thread"
12706	//   },
12707	//   "scopes": [
12708	//     "https://mail.google.com/",
12709	//     "https://www.googleapis.com/auth/gmail.modify"
12710	//   ]
12711	// }
12712
12713}
12714
12715// method id "gmail.users.threads.untrash":
12716
12717type UsersThreadsUntrashCall struct {
12718	s          *Service
12719	userId     string
12720	id         string
12721	urlParams_ gensupport.URLParams
12722	ctx_       context.Context
12723	header_    http.Header
12724}
12725
12726// Untrash: Removes the specified thread from the trash.
12727func (r *UsersThreadsService) Untrash(userId string, id string) *UsersThreadsUntrashCall {
12728	c := &UsersThreadsUntrashCall{s: r.s, urlParams_: make(gensupport.URLParams)}
12729	c.userId = userId
12730	c.id = id
12731	return c
12732}
12733
12734// Fields allows partial responses to be retrieved. See
12735// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
12736// for more information.
12737func (c *UsersThreadsUntrashCall) Fields(s ...googleapi.Field) *UsersThreadsUntrashCall {
12738	c.urlParams_.Set("fields", googleapi.CombineFields(s))
12739	return c
12740}
12741
12742// Context sets the context to be used in this call's Do method. Any
12743// pending HTTP request will be aborted if the provided context is
12744// canceled.
12745func (c *UsersThreadsUntrashCall) Context(ctx context.Context) *UsersThreadsUntrashCall {
12746	c.ctx_ = ctx
12747	return c
12748}
12749
12750// Header returns an http.Header that can be modified by the caller to
12751// add HTTP headers to the request.
12752func (c *UsersThreadsUntrashCall) Header() http.Header {
12753	if c.header_ == nil {
12754		c.header_ = make(http.Header)
12755	}
12756	return c.header_
12757}
12758
12759func (c *UsersThreadsUntrashCall) doRequest(alt string) (*http.Response, error) {
12760	reqHeaders := make(http.Header)
12761	for k, v := range c.header_ {
12762		reqHeaders[k] = v
12763	}
12764	reqHeaders.Set("User-Agent", c.s.userAgent())
12765	var body io.Reader = nil
12766	c.urlParams_.Set("alt", alt)
12767	c.urlParams_.Set("prettyPrint", "false")
12768	urls := googleapi.ResolveRelative(c.s.BasePath, "{userId}/threads/{id}/untrash")
12769	urls += "?" + c.urlParams_.Encode()
12770	req, err := http.NewRequest("POST", urls, body)
12771	if err != nil {
12772		return nil, err
12773	}
12774	req.Header = reqHeaders
12775	googleapi.Expand(req.URL, map[string]string{
12776		"userId": c.userId,
12777		"id":     c.id,
12778	})
12779	return gensupport.SendRequest(c.ctx_, c.s.client, req)
12780}
12781
12782// Do executes the "gmail.users.threads.untrash" call.
12783// Exactly one of *Thread or error will be non-nil. Any non-2xx status
12784// code is an error. Response headers are in either
12785// *Thread.ServerResponse.Header or (if a response was returned at all)
12786// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
12787// check whether the returned error was because http.StatusNotModified
12788// was returned.
12789func (c *UsersThreadsUntrashCall) Do(opts ...googleapi.CallOption) (*Thread, error) {
12790	gensupport.SetOptions(c.urlParams_, opts...)
12791	res, err := c.doRequest("json")
12792	if res != nil && res.StatusCode == http.StatusNotModified {
12793		if res.Body != nil {
12794			res.Body.Close()
12795		}
12796		return nil, &googleapi.Error{
12797			Code:   res.StatusCode,
12798			Header: res.Header,
12799		}
12800	}
12801	if err != nil {
12802		return nil, err
12803	}
12804	defer googleapi.CloseBody(res)
12805	if err := googleapi.CheckResponse(res); err != nil {
12806		return nil, err
12807	}
12808	ret := &Thread{
12809		ServerResponse: googleapi.ServerResponse{
12810			Header:         res.Header,
12811			HTTPStatusCode: res.StatusCode,
12812		},
12813	}
12814	target := &ret
12815	if err := gensupport.DecodeResponse(target, res); err != nil {
12816		return nil, err
12817	}
12818	return ret, nil
12819	// {
12820	//   "description": "Removes the specified thread from the trash.",
12821	//   "httpMethod": "POST",
12822	//   "id": "gmail.users.threads.untrash",
12823	//   "parameterOrder": [
12824	//     "userId",
12825	//     "id"
12826	//   ],
12827	//   "parameters": {
12828	//     "id": {
12829	//       "description": "The ID of the thread to remove from Trash.",
12830	//       "location": "path",
12831	//       "required": true,
12832	//       "type": "string"
12833	//     },
12834	//     "userId": {
12835	//       "default": "me",
12836	//       "description": "The user's email address. The special value me can be used to indicate the authenticated user.",
12837	//       "location": "path",
12838	//       "required": true,
12839	//       "type": "string"
12840	//     }
12841	//   },
12842	//   "path": "{userId}/threads/{id}/untrash",
12843	//   "response": {
12844	//     "$ref": "Thread"
12845	//   },
12846	//   "scopes": [
12847	//     "https://mail.google.com/",
12848	//     "https://www.googleapis.com/auth/gmail.modify"
12849	//   ]
12850	// }
12851
12852}
12853