1// Copyright 2020 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 googleapi "google.golang.org/api/googleapi" 57 gensupport "google.golang.org/api/internal/gensupport" 58 option "google.golang.org/api/option" 59 internaloption "google.golang.org/api/option/internaloption" 60 htransport "google.golang.org/api/transport/http" 61) 62 63// Always reference these packages, just in case the auto-generated code 64// below doesn't. 65var _ = bytes.NewBuffer 66var _ = strconv.Itoa 67var _ = fmt.Sprintf 68var _ = json.NewDecoder 69var _ = io.Copy 70var _ = url.Parse 71var _ = gensupport.MarshalJSON 72var _ = googleapi.Version 73var _ = errors.New 74var _ = strings.Replace 75var _ = context.Canceled 76var _ = internaloption.WithDefaultEndpoint 77 78const apiId = "gmail:v1" 79const apiName = "gmail" 80const apiVersion = "v1" 81const basePath = "https://gmail.googleapis.com/" 82const mtlsBasePath = "https://gmail.mtls.googleapis.com/" 83 84// OAuth2 scopes used by this API. 85const ( 86 // Read, compose, send, and permanently delete all your email from Gmail 87 MailGoogleComScope = "https://mail.google.com/" 88 89 // Manage drafts and send emails when you interact with the add-on 90 GmailAddonsCurrentActionComposeScope = "https://www.googleapis.com/auth/gmail.addons.current.action.compose" 91 92 // View your email messages when you interact with the add-on 93 GmailAddonsCurrentMessageActionScope = "https://www.googleapis.com/auth/gmail.addons.current.message.action" 94 95 // View your email message metadata when the add-on is running 96 GmailAddonsCurrentMessageMetadataScope = "https://www.googleapis.com/auth/gmail.addons.current.message.metadata" 97 98 // View your email messages when the add-on is running 99 GmailAddonsCurrentMessageReadonlyScope = "https://www.googleapis.com/auth/gmail.addons.current.message.readonly" 100 101 // Manage drafts and send emails 102 GmailComposeScope = "https://www.googleapis.com/auth/gmail.compose" 103 104 // Insert mail into your mailbox 105 GmailInsertScope = "https://www.googleapis.com/auth/gmail.insert" 106 107 // Manage mailbox labels 108 GmailLabelsScope = "https://www.googleapis.com/auth/gmail.labels" 109 110 // View your email message metadata such as labels and headers, but not 111 // the email body 112 GmailMetadataScope = "https://www.googleapis.com/auth/gmail.metadata" 113 114 // View and modify but not delete your email 115 GmailModifyScope = "https://www.googleapis.com/auth/gmail.modify" 116 117 // View your email messages and settings 118 GmailReadonlyScope = "https://www.googleapis.com/auth/gmail.readonly" 119 120 // Send email on your behalf 121 GmailSendScope = "https://www.googleapis.com/auth/gmail.send" 122 123 // Manage your basic mail settings 124 GmailSettingsBasicScope = "https://www.googleapis.com/auth/gmail.settings.basic" 125 126 // Manage your sensitive mail settings, including who can manage your 127 // mail 128 GmailSettingsSharingScope = "https://www.googleapis.com/auth/gmail.settings.sharing" 129) 130 131// NewService creates a new Service. 132func NewService(ctx context.Context, opts ...option.ClientOption) (*Service, error) { 133 scopesOption := option.WithScopes( 134 "https://mail.google.com/", 135 "https://www.googleapis.com/auth/gmail.addons.current.action.compose", 136 "https://www.googleapis.com/auth/gmail.addons.current.message.action", 137 "https://www.googleapis.com/auth/gmail.addons.current.message.metadata", 138 "https://www.googleapis.com/auth/gmail.addons.current.message.readonly", 139 "https://www.googleapis.com/auth/gmail.compose", 140 "https://www.googleapis.com/auth/gmail.insert", 141 "https://www.googleapis.com/auth/gmail.labels", 142 "https://www.googleapis.com/auth/gmail.metadata", 143 "https://www.googleapis.com/auth/gmail.modify", 144 "https://www.googleapis.com/auth/gmail.readonly", 145 "https://www.googleapis.com/auth/gmail.send", 146 "https://www.googleapis.com/auth/gmail.settings.basic", 147 "https://www.googleapis.com/auth/gmail.settings.sharing", 148 ) 149 // NOTE: prepend, so we don't override user-specified scopes. 150 opts = append([]option.ClientOption{scopesOption}, opts...) 151 opts = append(opts, internaloption.WithDefaultEndpoint(basePath)) 152 opts = append(opts, internaloption.WithDefaultMTLSEndpoint(mtlsBasePath)) 153 client, endpoint, err := htransport.NewClient(ctx, opts...) 154 if err != nil { 155 return nil, err 156 } 157 s, err := New(client) 158 if err != nil { 159 return nil, err 160 } 161 if endpoint != "" { 162 s.BasePath = endpoint 163 } 164 return s, nil 165} 166 167// New creates a new Service. It uses the provided http.Client for requests. 168// 169// Deprecated: please use NewService instead. 170// To provide a custom HTTP client, use option.WithHTTPClient. 171// If you are using google.golang.org/api/googleapis/transport.APIKey, use option.WithAPIKey with NewService instead. 172func New(client *http.Client) (*Service, error) { 173 if client == nil { 174 return nil, errors.New("client is nil") 175 } 176 s := &Service{client: client, BasePath: basePath} 177 s.Users = NewUsersService(s) 178 return s, nil 179} 180 181type Service struct { 182 client *http.Client 183 BasePath string // API endpoint base URL 184 UserAgent string // optional additional User-Agent fragment 185 186 Users *UsersService 187} 188 189func (s *Service) userAgent() string { 190 if s.UserAgent == "" { 191 return googleapi.UserAgent 192 } 193 return googleapi.UserAgent + " " + s.UserAgent 194} 195 196func NewUsersService(s *Service) *UsersService { 197 rs := &UsersService{s: s} 198 rs.Drafts = NewUsersDraftsService(s) 199 rs.History = NewUsersHistoryService(s) 200 rs.Labels = NewUsersLabelsService(s) 201 rs.Messages = NewUsersMessagesService(s) 202 rs.Settings = NewUsersSettingsService(s) 203 rs.Threads = NewUsersThreadsService(s) 204 return rs 205} 206 207type UsersService struct { 208 s *Service 209 210 Drafts *UsersDraftsService 211 212 History *UsersHistoryService 213 214 Labels *UsersLabelsService 215 216 Messages *UsersMessagesService 217 218 Settings *UsersSettingsService 219 220 Threads *UsersThreadsService 221} 222 223func NewUsersDraftsService(s *Service) *UsersDraftsService { 224 rs := &UsersDraftsService{s: s} 225 return rs 226} 227 228type UsersDraftsService struct { 229 s *Service 230} 231 232func NewUsersHistoryService(s *Service) *UsersHistoryService { 233 rs := &UsersHistoryService{s: s} 234 return rs 235} 236 237type UsersHistoryService struct { 238 s *Service 239} 240 241func NewUsersLabelsService(s *Service) *UsersLabelsService { 242 rs := &UsersLabelsService{s: s} 243 return rs 244} 245 246type UsersLabelsService struct { 247 s *Service 248} 249 250func NewUsersMessagesService(s *Service) *UsersMessagesService { 251 rs := &UsersMessagesService{s: s} 252 rs.Attachments = NewUsersMessagesAttachmentsService(s) 253 return rs 254} 255 256type UsersMessagesService struct { 257 s *Service 258 259 Attachments *UsersMessagesAttachmentsService 260} 261 262func NewUsersMessagesAttachmentsService(s *Service) *UsersMessagesAttachmentsService { 263 rs := &UsersMessagesAttachmentsService{s: s} 264 return rs 265} 266 267type UsersMessagesAttachmentsService struct { 268 s *Service 269} 270 271func NewUsersSettingsService(s *Service) *UsersSettingsService { 272 rs := &UsersSettingsService{s: s} 273 rs.Delegates = NewUsersSettingsDelegatesService(s) 274 rs.Filters = NewUsersSettingsFiltersService(s) 275 rs.ForwardingAddresses = NewUsersSettingsForwardingAddressesService(s) 276 rs.SendAs = NewUsersSettingsSendAsService(s) 277 return rs 278} 279 280type UsersSettingsService struct { 281 s *Service 282 283 Delegates *UsersSettingsDelegatesService 284 285 Filters *UsersSettingsFiltersService 286 287 ForwardingAddresses *UsersSettingsForwardingAddressesService 288 289 SendAs *UsersSettingsSendAsService 290} 291 292func NewUsersSettingsDelegatesService(s *Service) *UsersSettingsDelegatesService { 293 rs := &UsersSettingsDelegatesService{s: s} 294 return rs 295} 296 297type UsersSettingsDelegatesService struct { 298 s *Service 299} 300 301func NewUsersSettingsFiltersService(s *Service) *UsersSettingsFiltersService { 302 rs := &UsersSettingsFiltersService{s: s} 303 return rs 304} 305 306type UsersSettingsFiltersService struct { 307 s *Service 308} 309 310func NewUsersSettingsForwardingAddressesService(s *Service) *UsersSettingsForwardingAddressesService { 311 rs := &UsersSettingsForwardingAddressesService{s: s} 312 return rs 313} 314 315type UsersSettingsForwardingAddressesService struct { 316 s *Service 317} 318 319func NewUsersSettingsSendAsService(s *Service) *UsersSettingsSendAsService { 320 rs := &UsersSettingsSendAsService{s: s} 321 rs.SmimeInfo = NewUsersSettingsSendAsSmimeInfoService(s) 322 return rs 323} 324 325type UsersSettingsSendAsService struct { 326 s *Service 327 328 SmimeInfo *UsersSettingsSendAsSmimeInfoService 329} 330 331func NewUsersSettingsSendAsSmimeInfoService(s *Service) *UsersSettingsSendAsSmimeInfoService { 332 rs := &UsersSettingsSendAsSmimeInfoService{s: s} 333 return rs 334} 335 336type UsersSettingsSendAsSmimeInfoService struct { 337 s *Service 338} 339 340func NewUsersThreadsService(s *Service) *UsersThreadsService { 341 rs := &UsersThreadsService{s: s} 342 return rs 343} 344 345type UsersThreadsService struct { 346 s *Service 347} 348 349// AutoForwarding: Auto-forwarding settings for an account. 350type AutoForwarding struct { 351 // Disposition: The state that a message should be left in after it has 352 // been forwarded. 353 // 354 // Possible values: 355 // "dispositionUnspecified" - Unspecified disposition. 356 // "leaveInInbox" - Leave the message in the `INBOX`. 357 // "archive" - Archive the message. 358 // "trash" - Move the message to the `TRASH`. 359 // "markRead" - Leave the message in the `INBOX` and mark it as read. 360 Disposition string `json:"disposition,omitempty"` 361 362 // EmailAddress: Email address to which all incoming messages are 363 // forwarded. This email address must be a verified member of the 364 // forwarding addresses. 365 EmailAddress string `json:"emailAddress,omitempty"` 366 367 // Enabled: Whether all incoming mail is automatically forwarded to 368 // another address. 369 Enabled bool `json:"enabled,omitempty"` 370 371 // ServerResponse contains the HTTP response code and headers from the 372 // server. 373 googleapi.ServerResponse `json:"-"` 374 375 // ForceSendFields is a list of field names (e.g. "Disposition") to 376 // unconditionally include in API requests. By default, fields with 377 // empty values are omitted from API requests. However, any non-pointer, 378 // non-interface field appearing in ForceSendFields will be sent to the 379 // server regardless of whether the field is empty or not. This may be 380 // used to include empty fields in Patch requests. 381 ForceSendFields []string `json:"-"` 382 383 // NullFields is a list of field names (e.g. "Disposition") to include 384 // in API requests with the JSON null value. By default, fields with 385 // empty values are omitted from API requests. However, any field with 386 // an empty value appearing in NullFields will be sent to the server as 387 // null. It is an error if a field in this list has a non-empty value. 388 // This may be used to include null fields in Patch requests. 389 NullFields []string `json:"-"` 390} 391 392func (s *AutoForwarding) MarshalJSON() ([]byte, error) { 393 type NoMethod AutoForwarding 394 raw := NoMethod(*s) 395 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 396} 397 398type BatchDeleteMessagesRequest struct { 399 // Ids: The IDs of the messages to delete. 400 Ids []string `json:"ids,omitempty"` 401 402 // ForceSendFields is a list of field names (e.g. "Ids") to 403 // unconditionally include in API requests. By default, fields with 404 // empty values are omitted from API requests. However, any non-pointer, 405 // non-interface field appearing in ForceSendFields will be sent to the 406 // server regardless of whether the field is empty or not. This may be 407 // used to include empty fields in Patch requests. 408 ForceSendFields []string `json:"-"` 409 410 // NullFields is a list of field names (e.g. "Ids") to include in API 411 // requests with the JSON null value. By default, fields with empty 412 // values are omitted from API requests. However, any field with an 413 // empty value appearing in NullFields will be sent to the server as 414 // null. It is an error if a field in this list has a non-empty value. 415 // This may be used to include null fields in Patch requests. 416 NullFields []string `json:"-"` 417} 418 419func (s *BatchDeleteMessagesRequest) MarshalJSON() ([]byte, error) { 420 type NoMethod BatchDeleteMessagesRequest 421 raw := NoMethod(*s) 422 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 423} 424 425type BatchModifyMessagesRequest struct { 426 // AddLabelIds: A list of label IDs to add to messages. 427 AddLabelIds []string `json:"addLabelIds,omitempty"` 428 429 // Ids: The IDs of the messages to modify. There is a limit of 1000 ids 430 // per request. 431 Ids []string `json:"ids,omitempty"` 432 433 // RemoveLabelIds: A list of label IDs to remove from messages. 434 RemoveLabelIds []string `json:"removeLabelIds,omitempty"` 435 436 // ForceSendFields is a list of field names (e.g. "AddLabelIds") to 437 // unconditionally include in API requests. By default, fields with 438 // empty values are omitted from API requests. However, any non-pointer, 439 // non-interface field appearing in ForceSendFields will be sent to the 440 // server regardless of whether the field is empty or not. This may be 441 // used to include empty fields in Patch requests. 442 ForceSendFields []string `json:"-"` 443 444 // NullFields is a list of field names (e.g. "AddLabelIds") to include 445 // in API requests with the JSON null value. By default, fields with 446 // empty values are omitted from API requests. However, any field with 447 // an empty value appearing in NullFields will be sent to the server as 448 // null. It is an error if a field in this list has a non-empty value. 449 // This may be used to include null fields in Patch requests. 450 NullFields []string `json:"-"` 451} 452 453func (s *BatchModifyMessagesRequest) MarshalJSON() ([]byte, error) { 454 type NoMethod BatchModifyMessagesRequest 455 raw := NoMethod(*s) 456 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 457} 458 459// Delegate: Settings for a delegate. Delegates can read, send, and 460// delete messages, as well as view and add contacts, for the 461// delegator's account. See "Set up mail delegation" for more 462// information about delegates. 463type Delegate struct { 464 // DelegateEmail: The email address of the delegate. 465 DelegateEmail string `json:"delegateEmail,omitempty"` 466 467 // VerificationStatus: Indicates whether this address has been verified 468 // and can act as a delegate for the account. Read-only. 469 // 470 // Possible values: 471 // "verificationStatusUnspecified" - Unspecified verification status. 472 // "accepted" - The address can act a delegate for the account. 473 // "pending" - A verification request was mailed to the address, and 474 // the owner has not yet accepted it. 475 // "rejected" - A verification request was mailed to the address, and 476 // the owner rejected it. 477 // "expired" - A verification request was mailed to the address, and 478 // it expired without verification. 479 VerificationStatus string `json:"verificationStatus,omitempty"` 480 481 // ServerResponse contains the HTTP response code and headers from the 482 // server. 483 googleapi.ServerResponse `json:"-"` 484 485 // ForceSendFields is a list of field names (e.g. "DelegateEmail") to 486 // unconditionally include in API requests. By default, fields with 487 // empty values are omitted from API requests. However, any non-pointer, 488 // non-interface field appearing in ForceSendFields will be sent to the 489 // server regardless of whether the field is empty or not. This may be 490 // used to include empty fields in Patch requests. 491 ForceSendFields []string `json:"-"` 492 493 // NullFields is a list of field names (e.g. "DelegateEmail") to include 494 // in API requests with the JSON null value. By default, fields with 495 // empty values are omitted from API requests. However, any field with 496 // an empty value appearing in NullFields will be sent to the server as 497 // null. It is an error if a field in this list has a non-empty value. 498 // This may be used to include null fields in Patch requests. 499 NullFields []string `json:"-"` 500} 501 502func (s *Delegate) MarshalJSON() ([]byte, error) { 503 type NoMethod Delegate 504 raw := NoMethod(*s) 505 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 506} 507 508// Draft: A draft email in the user's mailbox. 509type Draft struct { 510 // Id: The immutable ID of the draft. 511 Id string `json:"id,omitempty"` 512 513 // Message: The message content of the draft. 514 Message *Message `json:"message,omitempty"` 515 516 // ServerResponse contains the HTTP response code and headers from the 517 // server. 518 googleapi.ServerResponse `json:"-"` 519 520 // ForceSendFields is a list of field names (e.g. "Id") to 521 // unconditionally include in API requests. By default, fields with 522 // empty values are omitted from API requests. However, any non-pointer, 523 // non-interface field appearing in ForceSendFields will be sent to the 524 // server regardless of whether the field is empty or not. This may be 525 // used to include empty fields in Patch requests. 526 ForceSendFields []string `json:"-"` 527 528 // NullFields is a list of field names (e.g. "Id") to include in API 529 // requests with the JSON null value. By default, fields with empty 530 // values are omitted from API requests. However, any field with an 531 // empty value appearing in NullFields will be sent to the server as 532 // null. It is an error if a field in this list has a non-empty value. 533 // This may be used to include null fields in Patch requests. 534 NullFields []string `json:"-"` 535} 536 537func (s *Draft) MarshalJSON() ([]byte, error) { 538 type NoMethod Draft 539 raw := NoMethod(*s) 540 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 541} 542 543// Filter: Resource definition for Gmail filters. Filters apply to 544// specific messages instead of an entire email thread. 545type Filter struct { 546 // Action: Action that the filter performs. 547 Action *FilterAction `json:"action,omitempty"` 548 549 // Criteria: Matching criteria for the filter. 550 Criteria *FilterCriteria `json:"criteria,omitempty"` 551 552 // Id: The server assigned ID of the filter. 553 Id string `json:"id,omitempty"` 554 555 // ServerResponse contains the HTTP response code and headers from the 556 // server. 557 googleapi.ServerResponse `json:"-"` 558 559 // ForceSendFields is a list of field names (e.g. "Action") to 560 // unconditionally include in API requests. By default, fields with 561 // empty values are omitted from API requests. However, any non-pointer, 562 // non-interface field appearing in ForceSendFields will be sent to the 563 // server regardless of whether the field is empty or not. This may be 564 // used to include empty fields in Patch requests. 565 ForceSendFields []string `json:"-"` 566 567 // NullFields is a list of field names (e.g. "Action") to include in API 568 // requests with the JSON null value. By default, fields with empty 569 // values are omitted from API requests. However, any field with an 570 // empty value appearing in NullFields will be sent to the server as 571 // null. It is an error if a field in this list has a non-empty value. 572 // This may be used to include null fields in Patch requests. 573 NullFields []string `json:"-"` 574} 575 576func (s *Filter) MarshalJSON() ([]byte, error) { 577 type NoMethod Filter 578 raw := NoMethod(*s) 579 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 580} 581 582// FilterAction: A set of actions to perform on a message. 583type FilterAction struct { 584 // AddLabelIds: List of labels to add to the message. 585 AddLabelIds []string `json:"addLabelIds,omitempty"` 586 587 // Forward: Email address that the message should be forwarded to. 588 Forward string `json:"forward,omitempty"` 589 590 // RemoveLabelIds: List of labels to remove from the message. 591 RemoveLabelIds []string `json:"removeLabelIds,omitempty"` 592 593 // ForceSendFields is a list of field names (e.g. "AddLabelIds") to 594 // unconditionally include in API requests. By default, fields with 595 // empty values are omitted from API requests. However, any non-pointer, 596 // non-interface field appearing in ForceSendFields will be sent to the 597 // server regardless of whether the field is empty or not. This may be 598 // used to include empty fields in Patch requests. 599 ForceSendFields []string `json:"-"` 600 601 // NullFields is a list of field names (e.g. "AddLabelIds") to include 602 // in API requests with the JSON null value. By default, fields with 603 // empty values are omitted from API requests. However, any field with 604 // an empty value appearing in NullFields will be sent to the server as 605 // null. It is an error if a field in this list has a non-empty value. 606 // This may be used to include null fields in Patch requests. 607 NullFields []string `json:"-"` 608} 609 610func (s *FilterAction) MarshalJSON() ([]byte, error) { 611 type NoMethod FilterAction 612 raw := NoMethod(*s) 613 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 614} 615 616// FilterCriteria: Message matching criteria. 617type FilterCriteria struct { 618 // ExcludeChats: Whether the response should exclude chats. 619 ExcludeChats bool `json:"excludeChats,omitempty"` 620 621 // From: The sender's display name or email address. 622 From string `json:"from,omitempty"` 623 624 // HasAttachment: Whether the message has any attachment. 625 HasAttachment bool `json:"hasAttachment,omitempty"` 626 627 // NegatedQuery: Only return messages not matching the specified query. 628 // Supports the same query format as the Gmail search box. For example, 629 // "from:someuser@example.com rfc822msgid: is:unread". 630 NegatedQuery string `json:"negatedQuery,omitempty"` 631 632 // Query: Only return messages matching the specified query. Supports 633 // the same query format as the Gmail search box. For example, 634 // "from:someuser@example.com rfc822msgid: is:unread". 635 Query string `json:"query,omitempty"` 636 637 // Size: The size of the entire RFC822 message in bytes, including all 638 // headers and attachments. 639 Size int64 `json:"size,omitempty"` 640 641 // SizeComparison: How the message size in bytes should be in relation 642 // to the size field. 643 // 644 // Possible values: 645 // "unspecified" 646 // "smaller" - Find messages smaller than the given size. 647 // "larger" - Find messages larger than the given size. 648 SizeComparison string `json:"sizeComparison,omitempty"` 649 650 // Subject: Case-insensitive phrase found in the message's subject. 651 // Trailing and leading whitespace are be trimmed and adjacent spaces 652 // are collapsed. 653 Subject string `json:"subject,omitempty"` 654 655 // To: The recipient's display name or email address. Includes 656 // recipients in the "to", "cc", and "bcc" header fields. You can use 657 // simply the local part of the email address. For example, "example" 658 // and "example@" both match "example@gmail.com". This field is 659 // case-insensitive. 660 To string `json:"to,omitempty"` 661 662 // ForceSendFields is a list of field names (e.g. "ExcludeChats") to 663 // unconditionally include in API requests. By default, fields with 664 // empty values are omitted from API requests. However, any non-pointer, 665 // non-interface field appearing in ForceSendFields will be sent to the 666 // server regardless of whether the field is empty or not. This may be 667 // used to include empty fields in Patch requests. 668 ForceSendFields []string `json:"-"` 669 670 // NullFields is a list of field names (e.g. "ExcludeChats") to include 671 // in API requests with the JSON null value. By default, fields with 672 // empty values are omitted from API requests. However, any field with 673 // an empty value appearing in NullFields will be sent to the server as 674 // null. It is an error if a field in this list has a non-empty value. 675 // This may be used to include null fields in Patch requests. 676 NullFields []string `json:"-"` 677} 678 679func (s *FilterCriteria) MarshalJSON() ([]byte, error) { 680 type NoMethod FilterCriteria 681 raw := NoMethod(*s) 682 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 683} 684 685// ForwardingAddress: Settings for a forwarding address. 686type ForwardingAddress struct { 687 // ForwardingEmail: An email address to which messages can be forwarded. 688 ForwardingEmail string `json:"forwardingEmail,omitempty"` 689 690 // VerificationStatus: Indicates whether this address has been verified 691 // and is usable for forwarding. Read-only. 692 // 693 // Possible values: 694 // "verificationStatusUnspecified" - Unspecified verification status. 695 // "accepted" - The address is ready to use for forwarding. 696 // "pending" - The address is awaiting verification by the owner. 697 VerificationStatus string `json:"verificationStatus,omitempty"` 698 699 // ServerResponse contains the HTTP response code and headers from the 700 // server. 701 googleapi.ServerResponse `json:"-"` 702 703 // ForceSendFields is a list of field names (e.g. "ForwardingEmail") to 704 // unconditionally include in API requests. By default, fields with 705 // empty values are omitted from API requests. However, any non-pointer, 706 // non-interface field appearing in ForceSendFields will be sent to the 707 // server regardless of whether the field is empty or not. This may be 708 // used to include empty fields in Patch requests. 709 ForceSendFields []string `json:"-"` 710 711 // NullFields is a list of field names (e.g. "ForwardingEmail") to 712 // include in API requests with the JSON null value. By default, fields 713 // with empty values are omitted from API requests. However, any field 714 // with an empty value appearing in NullFields will be sent to the 715 // server as null. It is an error if a field in this list has a 716 // non-empty value. This may be used to include null fields in Patch 717 // requests. 718 NullFields []string `json:"-"` 719} 720 721func (s *ForwardingAddress) MarshalJSON() ([]byte, error) { 722 type NoMethod ForwardingAddress 723 raw := NoMethod(*s) 724 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 725} 726 727// History: A record of a change to the user's mailbox. Each history 728// change may affect multiple messages in multiple ways. 729type History struct { 730 // Id: The mailbox sequence ID. 731 Id uint64 `json:"id,omitempty,string"` 732 733 // LabelsAdded: Labels added to messages in this history record. 734 LabelsAdded []*HistoryLabelAdded `json:"labelsAdded,omitempty"` 735 736 // LabelsRemoved: Labels removed from messages in this history record. 737 LabelsRemoved []*HistoryLabelRemoved `json:"labelsRemoved,omitempty"` 738 739 // Messages: List of messages changed in this history record. The fields 740 // for specific change types, such as `messagesAdded` may duplicate 741 // messages in this field. We recommend using the specific change-type 742 // fields instead of this. 743 Messages []*Message `json:"messages,omitempty"` 744 745 // MessagesAdded: Messages added to the mailbox in this history record. 746 MessagesAdded []*HistoryMessageAdded `json:"messagesAdded,omitempty"` 747 748 // MessagesDeleted: Messages deleted (not Trashed) from the mailbox in 749 // this history record. 750 MessagesDeleted []*HistoryMessageDeleted `json:"messagesDeleted,omitempty"` 751 752 // ForceSendFields is a list of field names (e.g. "Id") to 753 // unconditionally include in API requests. By default, fields with 754 // empty values are omitted from API requests. However, any non-pointer, 755 // non-interface field appearing in ForceSendFields will be sent to the 756 // server regardless of whether the field is empty or not. This may be 757 // used to include empty fields in Patch requests. 758 ForceSendFields []string `json:"-"` 759 760 // NullFields is a list of field names (e.g. "Id") to include in API 761 // requests with the JSON null value. By default, fields with empty 762 // values are omitted from API requests. However, any field with an 763 // empty value appearing in NullFields will be sent to the server as 764 // null. It is an error if a field in this list has a non-empty value. 765 // This may be used to include null fields in Patch requests. 766 NullFields []string `json:"-"` 767} 768 769func (s *History) MarshalJSON() ([]byte, error) { 770 type NoMethod History 771 raw := NoMethod(*s) 772 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 773} 774 775type HistoryLabelAdded struct { 776 // LabelIds: Label IDs added to the message. 777 LabelIds []string `json:"labelIds,omitempty"` 778 779 Message *Message `json:"message,omitempty"` 780 781 // ForceSendFields is a list of field names (e.g. "LabelIds") to 782 // unconditionally include in API requests. By default, fields with 783 // empty values are omitted from API requests. However, any non-pointer, 784 // non-interface field appearing in ForceSendFields will be sent to the 785 // server regardless of whether the field is empty or not. This may be 786 // used to include empty fields in Patch requests. 787 ForceSendFields []string `json:"-"` 788 789 // NullFields is a list of field names (e.g. "LabelIds") to include in 790 // API requests with the JSON null value. By default, fields with empty 791 // values are omitted from API requests. However, any field with an 792 // empty value appearing in NullFields will be sent to the server as 793 // null. It is an error if a field in this list has a non-empty value. 794 // This may be used to include null fields in Patch requests. 795 NullFields []string `json:"-"` 796} 797 798func (s *HistoryLabelAdded) MarshalJSON() ([]byte, error) { 799 type NoMethod HistoryLabelAdded 800 raw := NoMethod(*s) 801 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 802} 803 804type HistoryLabelRemoved struct { 805 // LabelIds: Label IDs removed from the message. 806 LabelIds []string `json:"labelIds,omitempty"` 807 808 Message *Message `json:"message,omitempty"` 809 810 // ForceSendFields is a list of field names (e.g. "LabelIds") to 811 // unconditionally include in API requests. By default, fields with 812 // empty values are omitted from API requests. However, any non-pointer, 813 // non-interface field appearing in ForceSendFields will be sent to the 814 // server regardless of whether the field is empty or not. This may be 815 // used to include empty fields in Patch requests. 816 ForceSendFields []string `json:"-"` 817 818 // NullFields is a list of field names (e.g. "LabelIds") to include in 819 // API requests with the JSON null value. By default, fields with empty 820 // values are omitted from API requests. However, any field with an 821 // empty value appearing in NullFields will be sent to the server as 822 // null. It is an error if a field in this list has a non-empty value. 823 // This may be used to include null fields in Patch requests. 824 NullFields []string `json:"-"` 825} 826 827func (s *HistoryLabelRemoved) MarshalJSON() ([]byte, error) { 828 type NoMethod HistoryLabelRemoved 829 raw := NoMethod(*s) 830 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 831} 832 833type HistoryMessageAdded struct { 834 Message *Message `json:"message,omitempty"` 835 836 // ForceSendFields is a list of field names (e.g. "Message") to 837 // unconditionally include in API requests. By default, fields with 838 // empty values are omitted from API requests. However, any non-pointer, 839 // non-interface field appearing in ForceSendFields will be sent to the 840 // server regardless of whether the field is empty or not. This may be 841 // used to include empty fields in Patch requests. 842 ForceSendFields []string `json:"-"` 843 844 // NullFields is a list of field names (e.g. "Message") to include in 845 // API requests with the JSON null value. By default, fields with empty 846 // values are omitted from API requests. However, any field with an 847 // empty value appearing in NullFields will be sent to the server as 848 // null. It is an error if a field in this list has a non-empty value. 849 // This may be used to include null fields in Patch requests. 850 NullFields []string `json:"-"` 851} 852 853func (s *HistoryMessageAdded) MarshalJSON() ([]byte, error) { 854 type NoMethod HistoryMessageAdded 855 raw := NoMethod(*s) 856 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 857} 858 859type HistoryMessageDeleted struct { 860 Message *Message `json:"message,omitempty"` 861 862 // ForceSendFields is a list of field names (e.g. "Message") to 863 // unconditionally include in API requests. By default, fields with 864 // empty values are omitted from API requests. However, any non-pointer, 865 // non-interface field appearing in ForceSendFields will be sent to the 866 // server regardless of whether the field is empty or not. This may be 867 // used to include empty fields in Patch requests. 868 ForceSendFields []string `json:"-"` 869 870 // NullFields is a list of field names (e.g. "Message") to include in 871 // API requests with the JSON null value. By default, fields with empty 872 // values are omitted from API requests. However, any field with an 873 // empty value appearing in NullFields will be sent to the server as 874 // null. It is an error if a field in this list has a non-empty value. 875 // This may be used to include null fields in Patch requests. 876 NullFields []string `json:"-"` 877} 878 879func (s *HistoryMessageDeleted) MarshalJSON() ([]byte, error) { 880 type NoMethod HistoryMessageDeleted 881 raw := NoMethod(*s) 882 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 883} 884 885// ImapSettings: IMAP settings for an account. 886type ImapSettings struct { 887 // AutoExpunge: If this value is true, Gmail will immediately expunge a 888 // message when it is marked as deleted in IMAP. Otherwise, Gmail will 889 // wait for an update from the client before expunging messages marked 890 // as deleted. 891 AutoExpunge bool `json:"autoExpunge,omitempty"` 892 893 // Enabled: Whether IMAP is enabled for the account. 894 Enabled bool `json:"enabled,omitempty"` 895 896 // ExpungeBehavior: The action that will be executed on a message when 897 // it is marked as deleted and expunged from the last visible IMAP 898 // folder. 899 // 900 // Possible values: 901 // "expungeBehaviorUnspecified" - Unspecified behavior. 902 // "archive" - Archive messages marked as deleted. 903 // "trash" - Move messages marked as deleted to the trash. 904 // "deleteForever" - Immediately and permanently delete messages 905 // marked as deleted. The expunged messages cannot be recovered. 906 ExpungeBehavior string `json:"expungeBehavior,omitempty"` 907 908 // MaxFolderSize: An optional limit on the number of messages that an 909 // IMAP folder may contain. Legal values are 0, 1000, 2000, 5000 or 910 // 10000. A value of zero is interpreted to mean that there is no limit. 911 MaxFolderSize int64 `json:"maxFolderSize,omitempty"` 912 913 // ServerResponse contains the HTTP response code and headers from the 914 // server. 915 googleapi.ServerResponse `json:"-"` 916 917 // ForceSendFields is a list of field names (e.g. "AutoExpunge") to 918 // unconditionally include in API requests. By default, fields with 919 // empty values are omitted from API requests. However, any non-pointer, 920 // non-interface field appearing in ForceSendFields will be sent to the 921 // server regardless of whether the field is empty or not. This may be 922 // used to include empty fields in Patch requests. 923 ForceSendFields []string `json:"-"` 924 925 // NullFields is a list of field names (e.g. "AutoExpunge") to include 926 // in API requests with the JSON null value. By default, fields with 927 // empty values are omitted from API requests. However, any field with 928 // an empty value appearing in NullFields will be sent to the server as 929 // null. It is an error if a field in this list has a non-empty value. 930 // This may be used to include null fields in Patch requests. 931 NullFields []string `json:"-"` 932} 933 934func (s *ImapSettings) MarshalJSON() ([]byte, error) { 935 type NoMethod ImapSettings 936 raw := NoMethod(*s) 937 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 938} 939 940// Label: Labels are used to categorize messages and threads within the 941// user's mailbox. 942type Label struct { 943 // Color: The color to assign to the label. Color is only available for 944 // labels that have their `type` set to `user`. 945 Color *LabelColor `json:"color,omitempty"` 946 947 // Id: The immutable ID of the label. 948 Id string `json:"id,omitempty"` 949 950 // LabelListVisibility: The visibility of the label in the label list in 951 // the Gmail web interface. 952 // 953 // Possible values: 954 // "labelShow" - Show the label in the label list. 955 // "labelShowIfUnread" - Show the label if there are any unread 956 // messages with that label. 957 // "labelHide" - Do not show the label in the label list. 958 LabelListVisibility string `json:"labelListVisibility,omitempty"` 959 960 // MessageListVisibility: The visibility of messages with this label in 961 // the message list in the Gmail web interface. 962 // 963 // Possible values: 964 // "show" - Show the label in the message list. 965 // "hide" - Do not show the label in the message list. 966 MessageListVisibility string `json:"messageListVisibility,omitempty"` 967 968 // MessagesTotal: The total number of messages with the label. 969 MessagesTotal int64 `json:"messagesTotal,omitempty"` 970 971 // MessagesUnread: The number of unread messages with the label. 972 MessagesUnread int64 `json:"messagesUnread,omitempty"` 973 974 // Name: The display name of the label. 975 Name string `json:"name,omitempty"` 976 977 // ThreadsTotal: The total number of threads with the label. 978 ThreadsTotal int64 `json:"threadsTotal,omitempty"` 979 980 // ThreadsUnread: The number of unread threads with the label. 981 ThreadsUnread int64 `json:"threadsUnread,omitempty"` 982 983 // Type: The owner type for the label. User labels are created by the 984 // user and can be modified and deleted by the user and can be applied 985 // to any message or thread. System labels are internally created and 986 // cannot be added, modified, or deleted. System labels may be able to 987 // be applied to or removed from messages and threads under some 988 // circumstances but this is not guaranteed. For example, users can 989 // apply and remove the `INBOX` and `UNREAD` labels from messages and 990 // threads, but cannot apply or remove the `DRAFTS` or `SENT` labels 991 // from messages or threads. 992 // 993 // Possible values: 994 // "system" - Labels created by Gmail. 995 // "user" - Custom labels created by the user or application. 996 Type string `json:"type,omitempty"` 997 998 // ServerResponse contains the HTTP response code and headers from the 999 // server. 1000 googleapi.ServerResponse `json:"-"` 1001 1002 // ForceSendFields is a list of field names (e.g. "Color") to 1003 // unconditionally include in API requests. By default, fields with 1004 // empty values are omitted from API requests. However, any non-pointer, 1005 // non-interface field appearing in ForceSendFields will be sent to the 1006 // server regardless of whether the field is empty or not. This may be 1007 // used to include empty fields in Patch requests. 1008 ForceSendFields []string `json:"-"` 1009 1010 // NullFields is a list of field names (e.g. "Color") to include in API 1011 // requests with the JSON null value. By default, fields with empty 1012 // values are omitted from API requests. However, any field with an 1013 // empty value appearing in NullFields will be sent to the server as 1014 // null. It is an error if a field in this list has a non-empty value. 1015 // This may be used to include null fields in Patch requests. 1016 NullFields []string `json:"-"` 1017} 1018 1019func (s *Label) MarshalJSON() ([]byte, error) { 1020 type NoMethod Label 1021 raw := NoMethod(*s) 1022 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1023} 1024 1025type LabelColor struct { 1026 // BackgroundColor: The background color represented as hex string 1027 // #RRGGBB (ex #000000). This field is required in order to set the 1028 // color of a label. Only the following predefined set of color values 1029 // are allowed: \#000000, #434343, #666666, #999999, #cccccc, #efefef, 1030 // #f3f3f3, #ffffff, \#fb4c2f, #ffad47, #fad165, #16a766, #43d692, 1031 // #4a86e8, #a479e2, #f691b3, \#f6c5be, #ffe6c7, #fef1d1, #b9e4d0, 1032 // #c6f3de, #c9daf8, #e4d7f5, #fcdee8, \#efa093, #ffd6a2, #fce8b3, 1033 // #89d3b2, #a0eac9, #a4c2f4, #d0bcf1, #fbc8d9, \#e66550, #ffbc6b, 1034 // #fcda83, #44b984, #68dfa9, #6d9eeb, #b694e8, #f7a7c0, \#cc3a21, 1035 // #eaa041, #f2c960, #149e60, #3dc789, #3c78d8, #8e63ce, #e07798, 1036 // \#ac2b16, #cf8933, #d5ae49, #0b804b, #2a9c68, #285bac, #653e9b, 1037 // #b65775, \#822111, #a46a21, #aa8831, #076239, #1a764d, #1c4587, 1038 // #41236d, #83334c \#464646, #e7e7e7, #0d3472, #b6cff5, #0d3b44, 1039 // #98d7e4, #3d188e, #e3d7ff, \#711a36, #fbd3e0, #8a1c0a, #f2b2a8, 1040 // #7a2e0b, #ffc8af, #7a4706, #ffdeb5, \#594c05, #fbe983, #684e07, 1041 // #fdedc1, #0b4f30, #b3efd3, #04502e, #a2dcc1, \#c2c2c2, #4986e7, 1042 // #2da2bb, #b99aff, #994a64, #f691b2, #ff7537, #ffad46, \#662e37, 1043 // #ebdbde, #cca6ac, #094228, #42d692, #16a765 1044 BackgroundColor string `json:"backgroundColor,omitempty"` 1045 1046 // TextColor: The text color of the label, represented as hex string. 1047 // This field is required in order to set the color of a label. Only the 1048 // following predefined set of color values are allowed: \#000000, 1049 // #434343, #666666, #999999, #cccccc, #efefef, #f3f3f3, #ffffff, 1050 // \#fb4c2f, #ffad47, #fad165, #16a766, #43d692, #4a86e8, #a479e2, 1051 // #f691b3, \#f6c5be, #ffe6c7, #fef1d1, #b9e4d0, #c6f3de, #c9daf8, 1052 // #e4d7f5, #fcdee8, \#efa093, #ffd6a2, #fce8b3, #89d3b2, #a0eac9, 1053 // #a4c2f4, #d0bcf1, #fbc8d9, \#e66550, #ffbc6b, #fcda83, #44b984, 1054 // #68dfa9, #6d9eeb, #b694e8, #f7a7c0, \#cc3a21, #eaa041, #f2c960, 1055 // #149e60, #3dc789, #3c78d8, #8e63ce, #e07798, \#ac2b16, #cf8933, 1056 // #d5ae49, #0b804b, #2a9c68, #285bac, #653e9b, #b65775, \#822111, 1057 // #a46a21, #aa8831, #076239, #1a764d, #1c4587, #41236d, #83334c 1058 // \#464646, #e7e7e7, #0d3472, #b6cff5, #0d3b44, #98d7e4, #3d188e, 1059 // #e3d7ff, \#711a36, #fbd3e0, #8a1c0a, #f2b2a8, #7a2e0b, #ffc8af, 1060 // #7a4706, #ffdeb5, \#594c05, #fbe983, #684e07, #fdedc1, #0b4f30, 1061 // #b3efd3, #04502e, #a2dcc1, \#c2c2c2, #4986e7, #2da2bb, #b99aff, 1062 // #994a64, #f691b2, #ff7537, #ffad46, \#662e37, #ebdbde, #cca6ac, 1063 // #094228, #42d692, #16a765 1064 TextColor string `json:"textColor,omitempty"` 1065 1066 // ForceSendFields is a list of field names (e.g. "BackgroundColor") to 1067 // unconditionally include in API requests. By default, fields with 1068 // empty values are omitted from API requests. However, any non-pointer, 1069 // non-interface field appearing in ForceSendFields will be sent to the 1070 // server regardless of whether the field is empty or not. This may be 1071 // used to include empty fields in Patch requests. 1072 ForceSendFields []string `json:"-"` 1073 1074 // NullFields is a list of field names (e.g. "BackgroundColor") to 1075 // include in API requests with the JSON null value. By default, fields 1076 // with empty values are omitted from API requests. However, any field 1077 // with an empty value appearing in NullFields will be sent to the 1078 // server as null. It is an error if a field in this list has a 1079 // non-empty value. This may be used to include null fields in Patch 1080 // requests. 1081 NullFields []string `json:"-"` 1082} 1083 1084func (s *LabelColor) MarshalJSON() ([]byte, error) { 1085 type NoMethod LabelColor 1086 raw := NoMethod(*s) 1087 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1088} 1089 1090// LanguageSettings: Language settings for an account. These settings 1091// correspond to the "Language settings" feature in the web interface. 1092type LanguageSettings struct { 1093 // DisplayLanguage: The language to display Gmail in, formatted as an 1094 // RFC 3066 Language Tag (for example `en-GB`, `fr` or `ja` for British 1095 // English, French, or Japanese respectively). The set of languages 1096 // supported by Gmail evolves over time, so please refer to the 1097 // "Language" dropdown in the Gmail settings for all available options, 1098 // as described in the language settings help article. A table of sample 1099 // values is also provided in the Managing Language Settings guide Not 1100 // all Gmail clients can display the same set of languages. In the case 1101 // that a user's display language is not available for use on a 1102 // particular client, said client automatically chooses to display in 1103 // the closest supported variant (or a reasonable default). 1104 DisplayLanguage string `json:"displayLanguage,omitempty"` 1105 1106 // ServerResponse contains the HTTP response code and headers from the 1107 // server. 1108 googleapi.ServerResponse `json:"-"` 1109 1110 // ForceSendFields is a list of field names (e.g. "DisplayLanguage") to 1111 // unconditionally include in API requests. By default, fields with 1112 // empty values are omitted from API requests. However, any non-pointer, 1113 // non-interface field appearing in ForceSendFields will be sent to the 1114 // server regardless of whether the field is empty or not. This may be 1115 // used to include empty fields in Patch requests. 1116 ForceSendFields []string `json:"-"` 1117 1118 // NullFields is a list of field names (e.g. "DisplayLanguage") to 1119 // include in API requests with the JSON null value. By default, fields 1120 // with empty values are omitted from API requests. However, any field 1121 // with an empty value appearing in NullFields will be sent to the 1122 // server as null. It is an error if a field in this list has a 1123 // non-empty value. This may be used to include null fields in Patch 1124 // requests. 1125 NullFields []string `json:"-"` 1126} 1127 1128func (s *LanguageSettings) MarshalJSON() ([]byte, error) { 1129 type NoMethod LanguageSettings 1130 raw := NoMethod(*s) 1131 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1132} 1133 1134// ListDelegatesResponse: Response for the ListDelegates method. 1135type ListDelegatesResponse struct { 1136 // Delegates: List of the user's delegates (with any verification 1137 // status). If an account doesn't have delegates, this field doesn't 1138 // appear. 1139 Delegates []*Delegate `json:"delegates,omitempty"` 1140 1141 // ServerResponse contains the HTTP response code and headers from the 1142 // server. 1143 googleapi.ServerResponse `json:"-"` 1144 1145 // ForceSendFields is a list of field names (e.g. "Delegates") to 1146 // unconditionally include in API requests. By default, fields with 1147 // empty values are omitted from API requests. However, any non-pointer, 1148 // non-interface field appearing in ForceSendFields will be sent to the 1149 // server regardless of whether the field is empty or not. This may be 1150 // used to include empty fields in Patch requests. 1151 ForceSendFields []string `json:"-"` 1152 1153 // NullFields is a list of field names (e.g. "Delegates") to include in 1154 // API requests with the JSON null value. By default, fields with empty 1155 // values are omitted from API requests. However, any field with an 1156 // empty value appearing in NullFields will be sent to the server as 1157 // null. It is an error if a field in this list has a non-empty value. 1158 // This may be used to include null fields in Patch requests. 1159 NullFields []string `json:"-"` 1160} 1161 1162func (s *ListDelegatesResponse) MarshalJSON() ([]byte, error) { 1163 type NoMethod ListDelegatesResponse 1164 raw := NoMethod(*s) 1165 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1166} 1167 1168type ListDraftsResponse struct { 1169 // Drafts: List of drafts. Note that the `Message` property in each 1170 // `Draft` resource only contains an `id` and a `threadId`. The 1171 // messages.get method can fetch additional message details. 1172 Drafts []*Draft `json:"drafts,omitempty"` 1173 1174 // NextPageToken: Token to retrieve the next page of results in the 1175 // list. 1176 NextPageToken string `json:"nextPageToken,omitempty"` 1177 1178 // ResultSizeEstimate: Estimated total number of results. 1179 ResultSizeEstimate int64 `json:"resultSizeEstimate,omitempty"` 1180 1181 // ServerResponse contains the HTTP response code and headers from the 1182 // server. 1183 googleapi.ServerResponse `json:"-"` 1184 1185 // ForceSendFields is a list of field names (e.g. "Drafts") to 1186 // unconditionally include in API requests. By default, fields with 1187 // empty values are omitted from API requests. However, any non-pointer, 1188 // non-interface field appearing in ForceSendFields will be sent to the 1189 // server regardless of whether the field is empty or not. This may be 1190 // used to include empty fields in Patch requests. 1191 ForceSendFields []string `json:"-"` 1192 1193 // NullFields is a list of field names (e.g. "Drafts") to include in API 1194 // requests with the JSON null value. By default, fields with empty 1195 // values are omitted from API requests. However, any field with an 1196 // empty value appearing in NullFields will be sent to the server as 1197 // null. It is an error if a field in this list has a non-empty value. 1198 // This may be used to include null fields in Patch requests. 1199 NullFields []string `json:"-"` 1200} 1201 1202func (s *ListDraftsResponse) MarshalJSON() ([]byte, error) { 1203 type NoMethod ListDraftsResponse 1204 raw := NoMethod(*s) 1205 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1206} 1207 1208// ListFiltersResponse: Response for the ListFilters method. 1209type ListFiltersResponse struct { 1210 // Filter: List of a user's filters. 1211 Filter []*Filter `json:"filter,omitempty"` 1212 1213 // ServerResponse contains the HTTP response code and headers from the 1214 // server. 1215 googleapi.ServerResponse `json:"-"` 1216 1217 // ForceSendFields is a list of field names (e.g. "Filter") to 1218 // unconditionally include in API requests. By default, fields with 1219 // empty values are omitted from API requests. However, any non-pointer, 1220 // non-interface field appearing in ForceSendFields will be sent to the 1221 // server regardless of whether the field is empty or not. This may be 1222 // used to include empty fields in Patch requests. 1223 ForceSendFields []string `json:"-"` 1224 1225 // NullFields is a list of field names (e.g. "Filter") to include in API 1226 // requests with the JSON null value. By default, fields with empty 1227 // values are omitted from API requests. However, any field with an 1228 // empty value appearing in NullFields will be sent to the server as 1229 // null. It is an error if a field in this list has a non-empty value. 1230 // This may be used to include null fields in Patch requests. 1231 NullFields []string `json:"-"` 1232} 1233 1234func (s *ListFiltersResponse) MarshalJSON() ([]byte, error) { 1235 type NoMethod ListFiltersResponse 1236 raw := NoMethod(*s) 1237 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1238} 1239 1240// ListForwardingAddressesResponse: Response for the 1241// ListForwardingAddresses method. 1242type ListForwardingAddressesResponse struct { 1243 // ForwardingAddresses: List of addresses that may be used for 1244 // forwarding. 1245 ForwardingAddresses []*ForwardingAddress `json:"forwardingAddresses,omitempty"` 1246 1247 // ServerResponse contains the HTTP response code and headers from the 1248 // server. 1249 googleapi.ServerResponse `json:"-"` 1250 1251 // ForceSendFields is a list of field names (e.g. "ForwardingAddresses") 1252 // to unconditionally include in API requests. By default, fields with 1253 // empty values are omitted from API requests. However, any non-pointer, 1254 // non-interface field appearing in ForceSendFields will be sent to the 1255 // server regardless of whether the field is empty or not. This may be 1256 // used to include empty fields in Patch requests. 1257 ForceSendFields []string `json:"-"` 1258 1259 // NullFields is a list of field names (e.g. "ForwardingAddresses") to 1260 // include in API requests with the JSON null value. By default, fields 1261 // with empty values are omitted from API requests. However, any field 1262 // with an empty value appearing in NullFields will be sent to the 1263 // server as null. It is an error if a field in this list has a 1264 // non-empty value. This may be used to include null fields in Patch 1265 // requests. 1266 NullFields []string `json:"-"` 1267} 1268 1269func (s *ListForwardingAddressesResponse) MarshalJSON() ([]byte, error) { 1270 type NoMethod ListForwardingAddressesResponse 1271 raw := NoMethod(*s) 1272 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1273} 1274 1275type ListHistoryResponse struct { 1276 // History: List of history records. Any `messages` contained in the 1277 // response will typically only have `id` and `threadId` fields 1278 // populated. 1279 History []*History `json:"history,omitempty"` 1280 1281 // HistoryId: The ID of the mailbox's current history record. 1282 HistoryId uint64 `json:"historyId,omitempty,string"` 1283 1284 // NextPageToken: Page token to retrieve the next page of results in the 1285 // list. 1286 NextPageToken string `json:"nextPageToken,omitempty"` 1287 1288 // ServerResponse contains the HTTP response code and headers from the 1289 // server. 1290 googleapi.ServerResponse `json:"-"` 1291 1292 // ForceSendFields is a list of field names (e.g. "History") to 1293 // unconditionally include in API requests. By default, fields with 1294 // empty values are omitted from API requests. However, any non-pointer, 1295 // non-interface field appearing in ForceSendFields will be sent to the 1296 // server regardless of whether the field is empty or not. This may be 1297 // used to include empty fields in Patch requests. 1298 ForceSendFields []string `json:"-"` 1299 1300 // NullFields is a list of field names (e.g. "History") to include in 1301 // API requests with the JSON null value. By default, fields with empty 1302 // values are omitted from API requests. However, any field with an 1303 // empty value appearing in NullFields will be sent to the server as 1304 // null. It is an error if a field in this list has a non-empty value. 1305 // This may be used to include null fields in Patch requests. 1306 NullFields []string `json:"-"` 1307} 1308 1309func (s *ListHistoryResponse) MarshalJSON() ([]byte, error) { 1310 type NoMethod ListHistoryResponse 1311 raw := NoMethod(*s) 1312 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1313} 1314 1315type ListLabelsResponse struct { 1316 // Labels: List of labels. Note that each label resource only contains 1317 // an `id`, `name`, `messageListVisibility`, `labelListVisibility`, and 1318 // `type`. The labels.get method can fetch additional label details. 1319 Labels []*Label `json:"labels,omitempty"` 1320 1321 // ServerResponse contains the HTTP response code and headers from the 1322 // server. 1323 googleapi.ServerResponse `json:"-"` 1324 1325 // ForceSendFields is a list of field names (e.g. "Labels") to 1326 // unconditionally include in API requests. By default, fields with 1327 // empty values are omitted from API requests. However, any non-pointer, 1328 // non-interface field appearing in ForceSendFields will be sent to the 1329 // server regardless of whether the field is empty or not. This may be 1330 // used to include empty fields in Patch requests. 1331 ForceSendFields []string `json:"-"` 1332 1333 // NullFields is a list of field names (e.g. "Labels") to include in API 1334 // requests with the JSON null value. By default, fields with empty 1335 // values are omitted from API requests. However, any field with an 1336 // empty value appearing in NullFields will be sent to the server as 1337 // null. It is an error if a field in this list has a non-empty value. 1338 // This may be used to include null fields in Patch requests. 1339 NullFields []string `json:"-"` 1340} 1341 1342func (s *ListLabelsResponse) MarshalJSON() ([]byte, error) { 1343 type NoMethod ListLabelsResponse 1344 raw := NoMethod(*s) 1345 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1346} 1347 1348type ListMessagesResponse struct { 1349 // Messages: List of messages. Note that each message resource contains 1350 // only an `id` and a `threadId`. Additional message details can be 1351 // fetched using the messages.get method. 1352 Messages []*Message `json:"messages,omitempty"` 1353 1354 // NextPageToken: Token to retrieve the next page of results in the 1355 // list. 1356 NextPageToken string `json:"nextPageToken,omitempty"` 1357 1358 // ResultSizeEstimate: Estimated total number of results. 1359 ResultSizeEstimate int64 `json:"resultSizeEstimate,omitempty"` 1360 1361 // ServerResponse contains the HTTP response code and headers from the 1362 // server. 1363 googleapi.ServerResponse `json:"-"` 1364 1365 // ForceSendFields is a list of field names (e.g. "Messages") to 1366 // unconditionally include in API requests. By default, fields with 1367 // empty values are omitted from API requests. However, any non-pointer, 1368 // non-interface field appearing in ForceSendFields will be sent to the 1369 // server regardless of whether the field is empty or not. This may be 1370 // used to include empty fields in Patch requests. 1371 ForceSendFields []string `json:"-"` 1372 1373 // NullFields is a list of field names (e.g. "Messages") to include in 1374 // API requests with the JSON null value. By default, fields with empty 1375 // values are omitted from API requests. However, any field with an 1376 // empty value appearing in NullFields will be sent to the server as 1377 // null. It is an error if a field in this list has a non-empty value. 1378 // This may be used to include null fields in Patch requests. 1379 NullFields []string `json:"-"` 1380} 1381 1382func (s *ListMessagesResponse) MarshalJSON() ([]byte, error) { 1383 type NoMethod ListMessagesResponse 1384 raw := NoMethod(*s) 1385 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1386} 1387 1388// ListSendAsResponse: Response for the ListSendAs method. 1389type ListSendAsResponse struct { 1390 // SendAs: List of send-as aliases. 1391 SendAs []*SendAs `json:"sendAs,omitempty"` 1392 1393 // ServerResponse contains the HTTP response code and headers from the 1394 // server. 1395 googleapi.ServerResponse `json:"-"` 1396 1397 // ForceSendFields is a list of field names (e.g. "SendAs") to 1398 // unconditionally include in API requests. By default, fields with 1399 // empty values are omitted from API requests. However, any non-pointer, 1400 // non-interface field appearing in ForceSendFields will be sent to the 1401 // server regardless of whether the field is empty or not. This may be 1402 // used to include empty fields in Patch requests. 1403 ForceSendFields []string `json:"-"` 1404 1405 // NullFields is a list of field names (e.g. "SendAs") to include in API 1406 // requests with the JSON null value. By default, fields with empty 1407 // values are omitted from API requests. However, any field with an 1408 // empty value appearing in NullFields will be sent to the server as 1409 // null. It is an error if a field in this list has a non-empty value. 1410 // This may be used to include null fields in Patch requests. 1411 NullFields []string `json:"-"` 1412} 1413 1414func (s *ListSendAsResponse) MarshalJSON() ([]byte, error) { 1415 type NoMethod ListSendAsResponse 1416 raw := NoMethod(*s) 1417 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1418} 1419 1420type ListSmimeInfoResponse struct { 1421 // SmimeInfo: List of SmimeInfo. 1422 SmimeInfo []*SmimeInfo `json:"smimeInfo,omitempty"` 1423 1424 // ServerResponse contains the HTTP response code and headers from the 1425 // server. 1426 googleapi.ServerResponse `json:"-"` 1427 1428 // ForceSendFields is a list of field names (e.g. "SmimeInfo") to 1429 // unconditionally include in API requests. By default, fields with 1430 // empty values are omitted from API requests. However, any non-pointer, 1431 // non-interface field appearing in ForceSendFields will be sent to the 1432 // server regardless of whether the field is empty or not. This may be 1433 // used to include empty fields in Patch requests. 1434 ForceSendFields []string `json:"-"` 1435 1436 // NullFields is a list of field names (e.g. "SmimeInfo") to include in 1437 // API requests with the JSON null value. By default, fields with empty 1438 // values are omitted from API requests. However, any field with an 1439 // empty value appearing in NullFields will be sent to the server as 1440 // null. It is an error if a field in this list has a non-empty value. 1441 // This may be used to include null fields in Patch requests. 1442 NullFields []string `json:"-"` 1443} 1444 1445func (s *ListSmimeInfoResponse) MarshalJSON() ([]byte, error) { 1446 type NoMethod ListSmimeInfoResponse 1447 raw := NoMethod(*s) 1448 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1449} 1450 1451type ListThreadsResponse struct { 1452 // NextPageToken: Page token to retrieve the next page of results in the 1453 // list. 1454 NextPageToken string `json:"nextPageToken,omitempty"` 1455 1456 // ResultSizeEstimate: Estimated total number of results. 1457 ResultSizeEstimate int64 `json:"resultSizeEstimate,omitempty"` 1458 1459 // Threads: List of threads. Note that each thread resource does not 1460 // contain a list of `messages`. The list of `messages` for a given 1461 // thread can be fetched using the threads.get method. 1462 Threads []*Thread `json:"threads,omitempty"` 1463 1464 // ServerResponse contains the HTTP response code and headers from the 1465 // server. 1466 googleapi.ServerResponse `json:"-"` 1467 1468 // ForceSendFields is a list of field names (e.g. "NextPageToken") to 1469 // unconditionally include in API requests. By default, fields with 1470 // empty values are omitted from API requests. However, any non-pointer, 1471 // non-interface field appearing in ForceSendFields will be sent to the 1472 // server regardless of whether the field is empty or not. This may be 1473 // used to include empty fields in Patch requests. 1474 ForceSendFields []string `json:"-"` 1475 1476 // NullFields is a list of field names (e.g. "NextPageToken") to include 1477 // in API requests with the JSON null value. By default, fields with 1478 // empty values are omitted from API requests. However, any field with 1479 // an empty value appearing in NullFields will be sent to the server as 1480 // null. It is an error if a field in this list has a non-empty value. 1481 // This may be used to include null fields in Patch requests. 1482 NullFields []string `json:"-"` 1483} 1484 1485func (s *ListThreadsResponse) MarshalJSON() ([]byte, error) { 1486 type NoMethod ListThreadsResponse 1487 raw := NoMethod(*s) 1488 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1489} 1490 1491// Message: An email message. 1492type Message struct { 1493 // HistoryId: The ID of the last history record that modified this 1494 // message. 1495 HistoryId uint64 `json:"historyId,omitempty,string"` 1496 1497 // Id: The immutable ID of the message. 1498 Id string `json:"id,omitempty"` 1499 1500 // InternalDate: The internal message creation timestamp (epoch ms), 1501 // which determines ordering in the inbox. For normal SMTP-received 1502 // email, this represents the time the message was originally accepted 1503 // by Google, which is more reliable than the `Date` header. However, 1504 // for API-migrated mail, it can be configured by client to be based on 1505 // the `Date` header. 1506 InternalDate int64 `json:"internalDate,omitempty,string"` 1507 1508 // LabelIds: List of IDs of labels applied to this message. 1509 LabelIds []string `json:"labelIds,omitempty"` 1510 1511 // Payload: The parsed email structure in the message parts. 1512 Payload *MessagePart `json:"payload,omitempty"` 1513 1514 // Raw: The entire email message in an RFC 2822 formatted and base64url 1515 // encoded string. Returned in `messages.get` and `drafts.get` responses 1516 // when the `format=RAW` parameter is supplied. 1517 Raw string `json:"raw,omitempty"` 1518 1519 // SizeEstimate: Estimated size in bytes of the message. 1520 SizeEstimate int64 `json:"sizeEstimate,omitempty"` 1521 1522 // Snippet: A short part of the message text. 1523 Snippet string `json:"snippet,omitempty"` 1524 1525 // ThreadId: The ID of the thread the message belongs to. To add a 1526 // message or draft to a thread, the following criteria must be met: 1. 1527 // The requested `threadId` must be specified on the `Message` or 1528 // `Draft.Message` you supply with your request. 2. The `References` and 1529 // `In-Reply-To` headers must be set in compliance with the [RFC 1530 // 2822](https://tools.ietf.org/html/rfc2822) standard. 3. The `Subject` 1531 // headers must match. 1532 ThreadId string `json:"threadId,omitempty"` 1533 1534 // ServerResponse contains the HTTP response code and headers from the 1535 // server. 1536 googleapi.ServerResponse `json:"-"` 1537 1538 // ForceSendFields is a list of field names (e.g. "HistoryId") to 1539 // unconditionally include in API requests. By default, fields with 1540 // empty values are omitted from API requests. However, any non-pointer, 1541 // non-interface field appearing in ForceSendFields will be sent to the 1542 // server regardless of whether the field is empty or not. This may be 1543 // used to include empty fields in Patch requests. 1544 ForceSendFields []string `json:"-"` 1545 1546 // NullFields is a list of field names (e.g. "HistoryId") to include in 1547 // API requests with the JSON null value. By default, fields with empty 1548 // values are omitted from API requests. However, any field with an 1549 // empty value appearing in NullFields will be sent to the server as 1550 // null. It is an error if a field in this list has a non-empty value. 1551 // This may be used to include null fields in Patch requests. 1552 NullFields []string `json:"-"` 1553} 1554 1555func (s *Message) MarshalJSON() ([]byte, error) { 1556 type NoMethod Message 1557 raw := NoMethod(*s) 1558 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1559} 1560 1561// MessagePart: A single MIME message part. 1562type MessagePart struct { 1563 // Body: The message part body for this part, which may be empty for 1564 // container MIME message parts. 1565 Body *MessagePartBody `json:"body,omitempty"` 1566 1567 // Filename: The filename of the attachment. Only present if this 1568 // message part represents an attachment. 1569 Filename string `json:"filename,omitempty"` 1570 1571 // Headers: List of headers on this message part. For the top-level 1572 // message part, representing the entire message payload, it will 1573 // contain the standard RFC 2822 email headers such as `To`, `From`, and 1574 // `Subject`. 1575 Headers []*MessagePartHeader `json:"headers,omitempty"` 1576 1577 // MimeType: The MIME type of the message part. 1578 MimeType string `json:"mimeType,omitempty"` 1579 1580 // PartId: The immutable ID of the message part. 1581 PartId string `json:"partId,omitempty"` 1582 1583 // Parts: The child MIME message parts of this part. This only applies 1584 // to container MIME message parts, for example `multipart/*`. For non- 1585 // container MIME message part types, such as `text/plain`, this field 1586 // is empty. For more information, see RFC 1521. 1587 Parts []*MessagePart `json:"parts,omitempty"` 1588 1589 // ForceSendFields is a list of field names (e.g. "Body") to 1590 // unconditionally include in API requests. By default, fields with 1591 // empty values are omitted from API requests. However, any non-pointer, 1592 // non-interface field appearing in ForceSendFields will be sent to the 1593 // server regardless of whether the field is empty or not. This may be 1594 // used to include empty fields in Patch requests. 1595 ForceSendFields []string `json:"-"` 1596 1597 // NullFields is a list of field names (e.g. "Body") to include in API 1598 // requests with the JSON null value. By default, fields with empty 1599 // values are omitted from API requests. However, any field with an 1600 // empty value appearing in NullFields will be sent to the server as 1601 // null. It is an error if a field in this list has a non-empty value. 1602 // This may be used to include null fields in Patch requests. 1603 NullFields []string `json:"-"` 1604} 1605 1606func (s *MessagePart) MarshalJSON() ([]byte, error) { 1607 type NoMethod MessagePart 1608 raw := NoMethod(*s) 1609 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1610} 1611 1612// MessagePartBody: The body of a single MIME message part. 1613type MessagePartBody struct { 1614 // AttachmentId: When present, contains the ID of an external attachment 1615 // that can be retrieved in a separate `messages.attachments.get` 1616 // request. When not present, the entire content of the message part 1617 // body is contained in the data field. 1618 AttachmentId string `json:"attachmentId,omitempty"` 1619 1620 // Data: The body data of a MIME message part as a base64url encoded 1621 // string. May be empty for MIME container types that have no message 1622 // body or when the body data is sent as a separate attachment. An 1623 // attachment ID is present if the body data is contained in a separate 1624 // attachment. 1625 Data string `json:"data,omitempty"` 1626 1627 // Size: Number of bytes for the message part data (encoding 1628 // notwithstanding). 1629 Size int64 `json:"size,omitempty"` 1630 1631 // ServerResponse contains the HTTP response code and headers from the 1632 // server. 1633 googleapi.ServerResponse `json:"-"` 1634 1635 // ForceSendFields is a list of field names (e.g. "AttachmentId") to 1636 // unconditionally include in API requests. By default, fields with 1637 // empty values are omitted from API requests. However, any non-pointer, 1638 // non-interface field appearing in ForceSendFields will be sent to the 1639 // server regardless of whether the field is empty or not. This may be 1640 // used to include empty fields in Patch requests. 1641 ForceSendFields []string `json:"-"` 1642 1643 // NullFields is a list of field names (e.g. "AttachmentId") to include 1644 // in API requests with the JSON null value. By default, fields with 1645 // empty values are omitted from API requests. However, any field with 1646 // an empty value appearing in NullFields will be sent to the server as 1647 // null. It is an error if a field in this list has a non-empty value. 1648 // This may be used to include null fields in Patch requests. 1649 NullFields []string `json:"-"` 1650} 1651 1652func (s *MessagePartBody) MarshalJSON() ([]byte, error) { 1653 type NoMethod MessagePartBody 1654 raw := NoMethod(*s) 1655 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1656} 1657 1658type MessagePartHeader struct { 1659 // Name: The name of the header before the `:` separator. For example, 1660 // `To`. 1661 Name string `json:"name,omitempty"` 1662 1663 // Value: The value of the header after the `:` separator. For example, 1664 // `someuser@example.com`. 1665 Value string `json:"value,omitempty"` 1666 1667 // ForceSendFields is a list of field names (e.g. "Name") to 1668 // unconditionally include in API requests. By default, fields with 1669 // empty values are omitted from API requests. However, any non-pointer, 1670 // non-interface field appearing in ForceSendFields will be sent to the 1671 // server regardless of whether the field is empty or not. This may be 1672 // used to include empty fields in Patch requests. 1673 ForceSendFields []string `json:"-"` 1674 1675 // NullFields is a list of field names (e.g. "Name") to include in API 1676 // requests with the JSON null value. By default, fields with empty 1677 // values are omitted from API requests. However, any field with an 1678 // empty value appearing in NullFields will be sent to the server as 1679 // null. It is an error if a field in this list has a non-empty value. 1680 // This may be used to include null fields in Patch requests. 1681 NullFields []string `json:"-"` 1682} 1683 1684func (s *MessagePartHeader) MarshalJSON() ([]byte, error) { 1685 type NoMethod MessagePartHeader 1686 raw := NoMethod(*s) 1687 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1688} 1689 1690type ModifyMessageRequest struct { 1691 // AddLabelIds: A list of IDs of labels to add to this message. 1692 AddLabelIds []string `json:"addLabelIds,omitempty"` 1693 1694 // RemoveLabelIds: A list IDs of labels to remove from this message. 1695 RemoveLabelIds []string `json:"removeLabelIds,omitempty"` 1696 1697 // ForceSendFields is a list of field names (e.g. "AddLabelIds") to 1698 // unconditionally include in API requests. By default, fields with 1699 // empty values are omitted from API requests. However, any non-pointer, 1700 // non-interface field appearing in ForceSendFields will be sent to the 1701 // server regardless of whether the field is empty or not. This may be 1702 // used to include empty fields in Patch requests. 1703 ForceSendFields []string `json:"-"` 1704 1705 // NullFields is a list of field names (e.g. "AddLabelIds") to include 1706 // in API requests with the JSON null value. By default, fields with 1707 // empty values are omitted from API requests. However, any field with 1708 // an empty value appearing in NullFields will be sent to the server as 1709 // null. It is an error if a field in this list has a non-empty value. 1710 // This may be used to include null fields in Patch requests. 1711 NullFields []string `json:"-"` 1712} 1713 1714func (s *ModifyMessageRequest) MarshalJSON() ([]byte, error) { 1715 type NoMethod ModifyMessageRequest 1716 raw := NoMethod(*s) 1717 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1718} 1719 1720type ModifyThreadRequest struct { 1721 // AddLabelIds: A list of IDs of labels to add to this thread. 1722 AddLabelIds []string `json:"addLabelIds,omitempty"` 1723 1724 // RemoveLabelIds: A list of IDs of labels to remove from this thread. 1725 RemoveLabelIds []string `json:"removeLabelIds,omitempty"` 1726 1727 // ForceSendFields is a list of field names (e.g. "AddLabelIds") to 1728 // unconditionally include in API requests. By default, fields with 1729 // empty values are omitted from API requests. However, any non-pointer, 1730 // non-interface field appearing in ForceSendFields will be sent to the 1731 // server regardless of whether the field is empty or not. This may be 1732 // used to include empty fields in Patch requests. 1733 ForceSendFields []string `json:"-"` 1734 1735 // NullFields is a list of field names (e.g. "AddLabelIds") to include 1736 // in API requests with the JSON null value. By default, fields with 1737 // empty values are omitted from API requests. However, any field with 1738 // an empty value appearing in NullFields will be sent to the server as 1739 // null. It is an error if a field in this list has a non-empty value. 1740 // This may be used to include null fields in Patch requests. 1741 NullFields []string `json:"-"` 1742} 1743 1744func (s *ModifyThreadRequest) MarshalJSON() ([]byte, error) { 1745 type NoMethod ModifyThreadRequest 1746 raw := NoMethod(*s) 1747 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1748} 1749 1750// PopSettings: POP settings for an account. 1751type PopSettings struct { 1752 // AccessWindow: The range of messages which are accessible via POP. 1753 // 1754 // Possible values: 1755 // "accessWindowUnspecified" - Unspecified range. 1756 // "disabled" - Indicates that no messages are accessible via POP. 1757 // "fromNowOn" - Indicates that unfetched messages received after some 1758 // past point in time are accessible via POP. 1759 // "allMail" - Indicates that all unfetched messages are accessible 1760 // via POP. 1761 AccessWindow string `json:"accessWindow,omitempty"` 1762 1763 // Disposition: The action that will be executed on a message after it 1764 // has been fetched via POP. 1765 // 1766 // Possible values: 1767 // "dispositionUnspecified" - Unspecified disposition. 1768 // "leaveInInbox" - Leave the message in the `INBOX`. 1769 // "archive" - Archive the message. 1770 // "trash" - Move the message to the `TRASH`. 1771 // "markRead" - Leave the message in the `INBOX` and mark it as read. 1772 Disposition string `json:"disposition,omitempty"` 1773 1774 // ServerResponse contains the HTTP response code and headers from the 1775 // server. 1776 googleapi.ServerResponse `json:"-"` 1777 1778 // ForceSendFields is a list of field names (e.g. "AccessWindow") to 1779 // unconditionally include in API requests. By default, fields with 1780 // empty values are omitted from API requests. However, any non-pointer, 1781 // non-interface field appearing in ForceSendFields will be sent to the 1782 // server regardless of whether the field is empty or not. This may be 1783 // used to include empty fields in Patch requests. 1784 ForceSendFields []string `json:"-"` 1785 1786 // NullFields is a list of field names (e.g. "AccessWindow") to include 1787 // in API requests with the JSON null value. By default, fields with 1788 // empty values are omitted from API requests. However, any field with 1789 // an empty value appearing in NullFields will be sent to the server as 1790 // null. It is an error if a field in this list has a non-empty value. 1791 // This may be used to include null fields in Patch requests. 1792 NullFields []string `json:"-"` 1793} 1794 1795func (s *PopSettings) MarshalJSON() ([]byte, error) { 1796 type NoMethod PopSettings 1797 raw := NoMethod(*s) 1798 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1799} 1800 1801// Profile: Profile for a Gmail user. 1802type Profile struct { 1803 // EmailAddress: The user's email address. 1804 EmailAddress string `json:"emailAddress,omitempty"` 1805 1806 // HistoryId: The ID of the mailbox's current history record. 1807 HistoryId uint64 `json:"historyId,omitempty,string"` 1808 1809 // MessagesTotal: The total number of messages in the mailbox. 1810 MessagesTotal int64 `json:"messagesTotal,omitempty"` 1811 1812 // ThreadsTotal: The total number of threads in the mailbox. 1813 ThreadsTotal int64 `json:"threadsTotal,omitempty"` 1814 1815 // ServerResponse contains the HTTP response code and headers from the 1816 // server. 1817 googleapi.ServerResponse `json:"-"` 1818 1819 // ForceSendFields is a list of field names (e.g. "EmailAddress") to 1820 // unconditionally include in API requests. By default, fields with 1821 // empty values are omitted from API requests. However, any non-pointer, 1822 // non-interface field appearing in ForceSendFields will be sent to the 1823 // server regardless of whether the field is empty or not. This may be 1824 // used to include empty fields in Patch requests. 1825 ForceSendFields []string `json:"-"` 1826 1827 // NullFields is a list of field names (e.g. "EmailAddress") to include 1828 // in API requests with the JSON null value. By default, fields with 1829 // empty values are omitted from API requests. However, any field with 1830 // an empty value appearing in NullFields will be sent to the server as 1831 // null. It is an error if a field in this list has a non-empty value. 1832 // This may be used to include null fields in Patch requests. 1833 NullFields []string `json:"-"` 1834} 1835 1836func (s *Profile) MarshalJSON() ([]byte, error) { 1837 type NoMethod Profile 1838 raw := NoMethod(*s) 1839 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1840} 1841 1842// SendAs: Settings associated with a send-as alias, which can be either 1843// the primary login address associated with the account or a custom 1844// "from" address. Send-as aliases correspond to the "Send Mail As" 1845// feature in the web interface. 1846type SendAs struct { 1847 // DisplayName: A name that appears in the "From:" header for mail sent 1848 // using this alias. For custom "from" addresses, when this is empty, 1849 // Gmail will populate the "From:" header with the name that is used for 1850 // the primary address associated with the account. If the admin has 1851 // disabled the ability for users to update their name format, requests 1852 // to update this field for the primary login will silently fail. 1853 DisplayName string `json:"displayName,omitempty"` 1854 1855 // IsDefault: Whether this address is selected as the default "From:" 1856 // address in situations such as composing a new message or sending a 1857 // vacation auto-reply. Every Gmail account has exactly one default 1858 // send-as address, so the only legal value that clients may write to 1859 // this field is `true`. Changing this from `false` to `true` for an 1860 // address will result in this field becoming `false` for the other 1861 // previous default address. 1862 IsDefault bool `json:"isDefault,omitempty"` 1863 1864 // IsPrimary: Whether this address is the primary address used to login 1865 // to the account. Every Gmail account has exactly one primary address, 1866 // and it cannot be deleted from the collection of send-as aliases. This 1867 // field is read-only. 1868 IsPrimary bool `json:"isPrimary,omitempty"` 1869 1870 // ReplyToAddress: An optional email address that is included in a 1871 // "Reply-To:" header for mail sent using this alias. If this is empty, 1872 // Gmail will not generate a "Reply-To:" header. 1873 ReplyToAddress string `json:"replyToAddress,omitempty"` 1874 1875 // SendAsEmail: The email address that appears in the "From:" header for 1876 // mail sent using this alias. This is read-only for all operations 1877 // except create. 1878 SendAsEmail string `json:"sendAsEmail,omitempty"` 1879 1880 // Signature: An optional HTML signature that is included in messages 1881 // composed with this alias in the Gmail web UI. 1882 Signature string `json:"signature,omitempty"` 1883 1884 // SmtpMsa: An optional SMTP service that will be used as an outbound 1885 // relay for mail sent using this alias. If this is empty, outbound mail 1886 // will be sent directly from Gmail's servers to the destination SMTP 1887 // service. This setting only applies to custom "from" aliases. 1888 SmtpMsa *SmtpMsa `json:"smtpMsa,omitempty"` 1889 1890 // TreatAsAlias: Whether Gmail should treat this address as an alias for 1891 // the user's primary email address. This setting only applies to custom 1892 // "from" aliases. 1893 TreatAsAlias bool `json:"treatAsAlias,omitempty"` 1894 1895 // VerificationStatus: Indicates whether this address has been verified 1896 // for use as a send-as alias. Read-only. This setting only applies to 1897 // custom "from" aliases. 1898 // 1899 // Possible values: 1900 // "verificationStatusUnspecified" - Unspecified verification status. 1901 // "accepted" - The address is ready to use as a send-as alias. 1902 // "pending" - The address is awaiting verification by the owner. 1903 VerificationStatus string `json:"verificationStatus,omitempty"` 1904 1905 // ServerResponse contains the HTTP response code and headers from the 1906 // server. 1907 googleapi.ServerResponse `json:"-"` 1908 1909 // ForceSendFields is a list of field names (e.g. "DisplayName") to 1910 // unconditionally include in API requests. By default, fields with 1911 // empty values are omitted from API requests. However, any non-pointer, 1912 // non-interface field appearing in ForceSendFields will be sent to the 1913 // server regardless of whether the field is empty or not. This may be 1914 // used to include empty fields in Patch requests. 1915 ForceSendFields []string `json:"-"` 1916 1917 // NullFields is a list of field names (e.g. "DisplayName") to include 1918 // in API requests with the JSON null value. By default, fields with 1919 // empty values are omitted from API requests. However, any field with 1920 // an empty value appearing in NullFields will be sent to the server as 1921 // null. It is an error if a field in this list has a non-empty value. 1922 // This may be used to include null fields in Patch requests. 1923 NullFields []string `json:"-"` 1924} 1925 1926func (s *SendAs) MarshalJSON() ([]byte, error) { 1927 type NoMethod SendAs 1928 raw := NoMethod(*s) 1929 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1930} 1931 1932// SmimeInfo: An S/MIME email config. 1933type SmimeInfo struct { 1934 // EncryptedKeyPassword: Encrypted key password, when key is encrypted. 1935 EncryptedKeyPassword string `json:"encryptedKeyPassword,omitempty"` 1936 1937 // Expiration: When the certificate expires (in milliseconds since 1938 // epoch). 1939 Expiration int64 `json:"expiration,omitempty,string"` 1940 1941 // Id: The immutable ID for the SmimeInfo. 1942 Id string `json:"id,omitempty"` 1943 1944 // IsDefault: Whether this SmimeInfo is the default one for this user's 1945 // send-as address. 1946 IsDefault bool `json:"isDefault,omitempty"` 1947 1948 // IssuerCn: The S/MIME certificate issuer's common name. 1949 IssuerCn string `json:"issuerCn,omitempty"` 1950 1951 // Pem: PEM formatted X509 concatenated certificate string (standard 1952 // base64 encoding). Format used for returning key, which includes 1953 // public key as well as certificate chain (not private key). 1954 Pem string `json:"pem,omitempty"` 1955 1956 // Pkcs12: PKCS#12 format containing a single private/public key pair 1957 // and certificate chain. This format is only accepted from client for 1958 // creating a new SmimeInfo and is never returned, because the private 1959 // key is not intended to be exported. PKCS#12 may be encrypted, in 1960 // which case encryptedKeyPassword should be set appropriately. 1961 Pkcs12 string `json:"pkcs12,omitempty"` 1962 1963 // ServerResponse contains the HTTP response code and headers from the 1964 // server. 1965 googleapi.ServerResponse `json:"-"` 1966 1967 // ForceSendFields is a list of field names (e.g. 1968 // "EncryptedKeyPassword") to unconditionally include in API requests. 1969 // By default, fields with empty values are omitted from API requests. 1970 // However, any non-pointer, non-interface field appearing in 1971 // ForceSendFields will be sent to the server regardless of whether the 1972 // field is empty or not. This may be used to include empty fields in 1973 // Patch requests. 1974 ForceSendFields []string `json:"-"` 1975 1976 // NullFields is a list of field names (e.g. "EncryptedKeyPassword") to 1977 // include in API requests with the JSON null value. By default, fields 1978 // with empty values are omitted from API requests. However, any field 1979 // with an empty value appearing in NullFields will be sent to the 1980 // server as null. It is an error if a field in this list has a 1981 // non-empty value. This may be used to include null fields in Patch 1982 // requests. 1983 NullFields []string `json:"-"` 1984} 1985 1986func (s *SmimeInfo) MarshalJSON() ([]byte, error) { 1987 type NoMethod SmimeInfo 1988 raw := NoMethod(*s) 1989 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1990} 1991 1992// SmtpMsa: Configuration for communication with an SMTP service. 1993type SmtpMsa struct { 1994 // Host: The hostname of the SMTP service. Required. 1995 Host string `json:"host,omitempty"` 1996 1997 // Password: The password that will be used for authentication with the 1998 // SMTP service. This is a write-only field that can be specified in 1999 // requests to create or update SendAs settings; it is never populated 2000 // in responses. 2001 Password string `json:"password,omitempty"` 2002 2003 // Port: The port of the SMTP service. Required. 2004 Port int64 `json:"port,omitempty"` 2005 2006 // SecurityMode: The protocol that will be used to secure communication 2007 // with the SMTP service. Required. 2008 // 2009 // Possible values: 2010 // "securityModeUnspecified" - Unspecified security mode. 2011 // "none" - Communication with the remote SMTP service is unsecured. 2012 // Requires port 25. 2013 // "ssl" - Communication with the remote SMTP service is secured using 2014 // SSL. 2015 // "starttls" - Communication with the remote SMTP service is secured 2016 // using STARTTLS. 2017 SecurityMode string `json:"securityMode,omitempty"` 2018 2019 // Username: The username that will be used for authentication with the 2020 // SMTP service. This is a write-only field that can be specified in 2021 // requests to create or update SendAs settings; it is never populated 2022 // in responses. 2023 Username string `json:"username,omitempty"` 2024 2025 // ForceSendFields is a list of field names (e.g. "Host") to 2026 // unconditionally include in API requests. By default, fields with 2027 // empty values are omitted from API requests. However, any non-pointer, 2028 // non-interface field appearing in ForceSendFields will be sent to the 2029 // server regardless of whether the field is empty or not. This may be 2030 // used to include empty fields in Patch requests. 2031 ForceSendFields []string `json:"-"` 2032 2033 // NullFields is a list of field names (e.g. "Host") to include in API 2034 // requests with the JSON null value. By default, fields with empty 2035 // values are omitted from API requests. However, any field with an 2036 // empty value appearing in NullFields will be sent to the server as 2037 // null. It is an error if a field in this list has a non-empty value. 2038 // This may be used to include null fields in Patch requests. 2039 NullFields []string `json:"-"` 2040} 2041 2042func (s *SmtpMsa) MarshalJSON() ([]byte, error) { 2043 type NoMethod SmtpMsa 2044 raw := NoMethod(*s) 2045 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 2046} 2047 2048// Thread: A collection of messages representing a conversation. 2049type Thread struct { 2050 // HistoryId: The ID of the last history record that modified this 2051 // thread. 2052 HistoryId uint64 `json:"historyId,omitempty,string"` 2053 2054 // Id: The unique ID of the thread. 2055 Id string `json:"id,omitempty"` 2056 2057 // Messages: The list of messages in the thread. 2058 Messages []*Message `json:"messages,omitempty"` 2059 2060 // Snippet: A short part of the message text. 2061 Snippet string `json:"snippet,omitempty"` 2062 2063 // ServerResponse contains the HTTP response code and headers from the 2064 // server. 2065 googleapi.ServerResponse `json:"-"` 2066 2067 // ForceSendFields is a list of field names (e.g. "HistoryId") to 2068 // unconditionally include in API requests. By default, fields with 2069 // empty values are omitted from API requests. However, any non-pointer, 2070 // non-interface field appearing in ForceSendFields will be sent to the 2071 // server regardless of whether the field is empty or not. This may be 2072 // used to include empty fields in Patch requests. 2073 ForceSendFields []string `json:"-"` 2074 2075 // NullFields is a list of field names (e.g. "HistoryId") to include in 2076 // API requests with the JSON null value. By default, fields with empty 2077 // values are omitted from API requests. However, any field with an 2078 // empty value appearing in NullFields will be sent to the server as 2079 // null. It is an error if a field in this list has a non-empty value. 2080 // This may be used to include null fields in Patch requests. 2081 NullFields []string `json:"-"` 2082} 2083 2084func (s *Thread) MarshalJSON() ([]byte, error) { 2085 type NoMethod Thread 2086 raw := NoMethod(*s) 2087 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 2088} 2089 2090// VacationSettings: Vacation auto-reply settings for an account. These 2091// settings correspond to the "Vacation responder" feature in the web 2092// interface. 2093type VacationSettings struct { 2094 // EnableAutoReply: Flag that controls whether Gmail automatically 2095 // replies to messages. 2096 EnableAutoReply bool `json:"enableAutoReply,omitempty"` 2097 2098 // EndTime: An optional end time for sending auto-replies (epoch ms). 2099 // When this is specified, Gmail will automatically reply only to 2100 // messages that it receives before the end time. If both `startTime` 2101 // and `endTime` are specified, `startTime` must precede `endTime`. 2102 EndTime int64 `json:"endTime,omitempty,string"` 2103 2104 // ResponseBodyHtml: Response body in HTML format. Gmail will sanitize 2105 // the HTML before storing it. If both `response_body_plain_text` and 2106 // `response_body_html` are specified, `response_body_html` will be 2107 // used. 2108 ResponseBodyHtml string `json:"responseBodyHtml,omitempty"` 2109 2110 // ResponseBodyPlainText: Response body in plain text format. If both 2111 // `response_body_plain_text` and `response_body_html` are specified, 2112 // `response_body_html` will be used. 2113 ResponseBodyPlainText string `json:"responseBodyPlainText,omitempty"` 2114 2115 // ResponseSubject: Optional text to prepend to the subject line in 2116 // vacation responses. In order to enable auto-replies, either the 2117 // response subject or the response body must be nonempty. 2118 ResponseSubject string `json:"responseSubject,omitempty"` 2119 2120 // RestrictToContacts: Flag that determines whether responses are sent 2121 // to recipients who are not in the user's list of contacts. 2122 RestrictToContacts bool `json:"restrictToContacts,omitempty"` 2123 2124 // RestrictToDomain: Flag that determines whether responses are sent to 2125 // recipients who are outside of the user's domain. This feature is only 2126 // available for G Suite users. 2127 RestrictToDomain bool `json:"restrictToDomain,omitempty"` 2128 2129 // StartTime: An optional start time for sending auto-replies (epoch 2130 // ms). When this is specified, Gmail will automatically reply only to 2131 // messages that it receives after the start time. If both `startTime` 2132 // and `endTime` are specified, `startTime` must precede `endTime`. 2133 StartTime int64 `json:"startTime,omitempty,string"` 2134 2135 // ServerResponse contains the HTTP response code and headers from the 2136 // server. 2137 googleapi.ServerResponse `json:"-"` 2138 2139 // ForceSendFields is a list of field names (e.g. "EnableAutoReply") to 2140 // unconditionally include in API requests. By default, fields with 2141 // empty values are omitted from API requests. However, any non-pointer, 2142 // non-interface field appearing in ForceSendFields will be sent to the 2143 // server regardless of whether the field is empty or not. This may be 2144 // used to include empty fields in Patch requests. 2145 ForceSendFields []string `json:"-"` 2146 2147 // NullFields is a list of field names (e.g. "EnableAutoReply") to 2148 // include in API requests with the JSON null value. By default, fields 2149 // with empty values are omitted from API requests. However, any field 2150 // with an empty value appearing in NullFields will be sent to the 2151 // server as null. It is an error if a field in this list has a 2152 // non-empty value. This may be used to include null fields in Patch 2153 // requests. 2154 NullFields []string `json:"-"` 2155} 2156 2157func (s *VacationSettings) MarshalJSON() ([]byte, error) { 2158 type NoMethod VacationSettings 2159 raw := NoMethod(*s) 2160 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 2161} 2162 2163// WatchRequest: Set up or update a new push notification watch on this 2164// user's mailbox. 2165type WatchRequest struct { 2166 // LabelFilterAction: Filtering behavior of labelIds list specified. 2167 // 2168 // Possible values: 2169 // "include" - Only get push notifications for message changes 2170 // relating to labelIds specified. 2171 // "exclude" - Get push notifications for all message changes except 2172 // those relating to labelIds specified. 2173 LabelFilterAction string `json:"labelFilterAction,omitempty"` 2174 2175 // LabelIds: List of label_ids to restrict notifications about. By 2176 // default, if unspecified, all changes are pushed out. If specified 2177 // then dictates which labels are required for a push notification to be 2178 // generated. 2179 LabelIds []string `json:"labelIds,omitempty"` 2180 2181 // TopicName: A fully qualified Google Cloud Pub/Sub API topic name to 2182 // publish the events to. This topic name **must** already exist in 2183 // Cloud Pub/Sub and you **must** have already granted gmail "publish" 2184 // permission on it. For example, 2185 // "projects/my-project-identifier/topics/my-topic-name" (using the 2186 // Cloud Pub/Sub "v1" topic naming format). Note that the 2187 // "my-project-identifier" portion must exactly match your Google 2188 // developer project id (the one executing this watch request). 2189 TopicName string `json:"topicName,omitempty"` 2190 2191 // ForceSendFields is a list of field names (e.g. "LabelFilterAction") 2192 // to unconditionally include in API requests. By default, fields with 2193 // empty values are omitted from API requests. However, any non-pointer, 2194 // non-interface field appearing in ForceSendFields will be sent to the 2195 // server regardless of whether the field is empty or not. This may be 2196 // used to include empty fields in Patch requests. 2197 ForceSendFields []string `json:"-"` 2198 2199 // NullFields is a list of field names (e.g. "LabelFilterAction") to 2200 // include in API requests with the JSON null value. By default, fields 2201 // with empty values are omitted from API requests. However, any field 2202 // with an empty value appearing in NullFields will be sent to the 2203 // server as null. It is an error if a field in this list has a 2204 // non-empty value. This may be used to include null fields in Patch 2205 // requests. 2206 NullFields []string `json:"-"` 2207} 2208 2209func (s *WatchRequest) MarshalJSON() ([]byte, error) { 2210 type NoMethod WatchRequest 2211 raw := NoMethod(*s) 2212 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 2213} 2214 2215// WatchResponse: Push notification watch response. 2216type WatchResponse struct { 2217 // Expiration: When Gmail will stop sending notifications for mailbox 2218 // updates (epoch millis). Call `watch` again before this time to renew 2219 // the watch. 2220 Expiration int64 `json:"expiration,omitempty,string"` 2221 2222 // HistoryId: The ID of the mailbox's current history record. 2223 HistoryId uint64 `json:"historyId,omitempty,string"` 2224 2225 // ServerResponse contains the HTTP response code and headers from the 2226 // server. 2227 googleapi.ServerResponse `json:"-"` 2228 2229 // ForceSendFields is a list of field names (e.g. "Expiration") to 2230 // unconditionally include in API requests. By default, fields with 2231 // empty values are omitted from API requests. However, any non-pointer, 2232 // non-interface field appearing in ForceSendFields will be sent to the 2233 // server regardless of whether the field is empty or not. This may be 2234 // used to include empty fields in Patch requests. 2235 ForceSendFields []string `json:"-"` 2236 2237 // NullFields is a list of field names (e.g. "Expiration") to include in 2238 // API requests with the JSON null value. By default, fields with empty 2239 // values are omitted from API requests. However, any field with an 2240 // empty value appearing in NullFields will be sent to the server as 2241 // null. It is an error if a field in this list has a non-empty value. 2242 // This may be used to include null fields in Patch requests. 2243 NullFields []string `json:"-"` 2244} 2245 2246func (s *WatchResponse) MarshalJSON() ([]byte, error) { 2247 type NoMethod WatchResponse 2248 raw := NoMethod(*s) 2249 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 2250} 2251 2252// method id "gmail.users.getProfile": 2253 2254type UsersGetProfileCall struct { 2255 s *Service 2256 userId string 2257 urlParams_ gensupport.URLParams 2258 ifNoneMatch_ string 2259 ctx_ context.Context 2260 header_ http.Header 2261} 2262 2263// GetProfile: Gets the current user's Gmail profile. 2264func (r *UsersService) GetProfile(userId string) *UsersGetProfileCall { 2265 c := &UsersGetProfileCall{s: r.s, urlParams_: make(gensupport.URLParams)} 2266 c.userId = userId 2267 return c 2268} 2269 2270// Fields allows partial responses to be retrieved. See 2271// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 2272// for more information. 2273func (c *UsersGetProfileCall) Fields(s ...googleapi.Field) *UsersGetProfileCall { 2274 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 2275 return c 2276} 2277 2278// IfNoneMatch sets the optional parameter which makes the operation 2279// fail if the object's ETag matches the given value. This is useful for 2280// getting updates only after the object has changed since the last 2281// request. Use googleapi.IsNotModified to check whether the response 2282// error from Do is the result of In-None-Match. 2283func (c *UsersGetProfileCall) IfNoneMatch(entityTag string) *UsersGetProfileCall { 2284 c.ifNoneMatch_ = entityTag 2285 return c 2286} 2287 2288// Context sets the context to be used in this call's Do method. Any 2289// pending HTTP request will be aborted if the provided context is 2290// canceled. 2291func (c *UsersGetProfileCall) Context(ctx context.Context) *UsersGetProfileCall { 2292 c.ctx_ = ctx 2293 return c 2294} 2295 2296// Header returns an http.Header that can be modified by the caller to 2297// add HTTP headers to the request. 2298func (c *UsersGetProfileCall) Header() http.Header { 2299 if c.header_ == nil { 2300 c.header_ = make(http.Header) 2301 } 2302 return c.header_ 2303} 2304 2305func (c *UsersGetProfileCall) doRequest(alt string) (*http.Response, error) { 2306 reqHeaders := make(http.Header) 2307 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20201124") 2308 for k, v := range c.header_ { 2309 reqHeaders[k] = v 2310 } 2311 reqHeaders.Set("User-Agent", c.s.userAgent()) 2312 if c.ifNoneMatch_ != "" { 2313 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 2314 } 2315 var body io.Reader = nil 2316 c.urlParams_.Set("alt", alt) 2317 c.urlParams_.Set("prettyPrint", "false") 2318 urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/profile") 2319 urls += "?" + c.urlParams_.Encode() 2320 req, err := http.NewRequest("GET", urls, body) 2321 if err != nil { 2322 return nil, err 2323 } 2324 req.Header = reqHeaders 2325 googleapi.Expand(req.URL, map[string]string{ 2326 "userId": c.userId, 2327 }) 2328 return gensupport.SendRequest(c.ctx_, c.s.client, req) 2329} 2330 2331// Do executes the "gmail.users.getProfile" call. 2332// Exactly one of *Profile or error will be non-nil. Any non-2xx status 2333// code is an error. Response headers are in either 2334// *Profile.ServerResponse.Header or (if a response was returned at all) 2335// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 2336// check whether the returned error was because http.StatusNotModified 2337// was returned. 2338func (c *UsersGetProfileCall) Do(opts ...googleapi.CallOption) (*Profile, error) { 2339 gensupport.SetOptions(c.urlParams_, opts...) 2340 res, err := c.doRequest("json") 2341 if res != nil && res.StatusCode == http.StatusNotModified { 2342 if res.Body != nil { 2343 res.Body.Close() 2344 } 2345 return nil, &googleapi.Error{ 2346 Code: res.StatusCode, 2347 Header: res.Header, 2348 } 2349 } 2350 if err != nil { 2351 return nil, err 2352 } 2353 defer googleapi.CloseBody(res) 2354 if err := googleapi.CheckResponse(res); err != nil { 2355 return nil, err 2356 } 2357 ret := &Profile{ 2358 ServerResponse: googleapi.ServerResponse{ 2359 Header: res.Header, 2360 HTTPStatusCode: res.StatusCode, 2361 }, 2362 } 2363 target := &ret 2364 if err := gensupport.DecodeResponse(target, res); err != nil { 2365 return nil, err 2366 } 2367 return ret, nil 2368 // { 2369 // "description": "Gets the current user's Gmail profile.", 2370 // "flatPath": "gmail/v1/users/{userId}/profile", 2371 // "httpMethod": "GET", 2372 // "id": "gmail.users.getProfile", 2373 // "parameterOrder": [ 2374 // "userId" 2375 // ], 2376 // "parameters": { 2377 // "userId": { 2378 // "default": "me", 2379 // "description": "The user's email address. The special value `me` can be used to indicate the authenticated user.", 2380 // "location": "path", 2381 // "required": true, 2382 // "type": "string" 2383 // } 2384 // }, 2385 // "path": "gmail/v1/users/{userId}/profile", 2386 // "response": { 2387 // "$ref": "Profile" 2388 // }, 2389 // "scopes": [ 2390 // "https://mail.google.com/", 2391 // "https://www.googleapis.com/auth/gmail.compose", 2392 // "https://www.googleapis.com/auth/gmail.metadata", 2393 // "https://www.googleapis.com/auth/gmail.modify", 2394 // "https://www.googleapis.com/auth/gmail.readonly" 2395 // ] 2396 // } 2397 2398} 2399 2400// method id "gmail.users.stop": 2401 2402type UsersStopCall struct { 2403 s *Service 2404 userId string 2405 urlParams_ gensupport.URLParams 2406 ctx_ context.Context 2407 header_ http.Header 2408} 2409 2410// Stop: Stop receiving push notifications for the given user mailbox. 2411func (r *UsersService) Stop(userId string) *UsersStopCall { 2412 c := &UsersStopCall{s: r.s, urlParams_: make(gensupport.URLParams)} 2413 c.userId = userId 2414 return c 2415} 2416 2417// Fields allows partial responses to be retrieved. See 2418// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 2419// for more information. 2420func (c *UsersStopCall) Fields(s ...googleapi.Field) *UsersStopCall { 2421 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 2422 return c 2423} 2424 2425// Context sets the context to be used in this call's Do method. Any 2426// pending HTTP request will be aborted if the provided context is 2427// canceled. 2428func (c *UsersStopCall) Context(ctx context.Context) *UsersStopCall { 2429 c.ctx_ = ctx 2430 return c 2431} 2432 2433// Header returns an http.Header that can be modified by the caller to 2434// add HTTP headers to the request. 2435func (c *UsersStopCall) Header() http.Header { 2436 if c.header_ == nil { 2437 c.header_ = make(http.Header) 2438 } 2439 return c.header_ 2440} 2441 2442func (c *UsersStopCall) doRequest(alt string) (*http.Response, error) { 2443 reqHeaders := make(http.Header) 2444 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20201124") 2445 for k, v := range c.header_ { 2446 reqHeaders[k] = v 2447 } 2448 reqHeaders.Set("User-Agent", c.s.userAgent()) 2449 var body io.Reader = nil 2450 c.urlParams_.Set("alt", alt) 2451 c.urlParams_.Set("prettyPrint", "false") 2452 urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/stop") 2453 urls += "?" + c.urlParams_.Encode() 2454 req, err := http.NewRequest("POST", urls, body) 2455 if err != nil { 2456 return nil, err 2457 } 2458 req.Header = reqHeaders 2459 googleapi.Expand(req.URL, map[string]string{ 2460 "userId": c.userId, 2461 }) 2462 return gensupport.SendRequest(c.ctx_, c.s.client, req) 2463} 2464 2465// Do executes the "gmail.users.stop" call. 2466func (c *UsersStopCall) Do(opts ...googleapi.CallOption) error { 2467 gensupport.SetOptions(c.urlParams_, opts...) 2468 res, err := c.doRequest("json") 2469 if err != nil { 2470 return err 2471 } 2472 defer googleapi.CloseBody(res) 2473 if err := googleapi.CheckResponse(res); err != nil { 2474 return err 2475 } 2476 return nil 2477 // { 2478 // "description": "Stop receiving push notifications for the given user mailbox.", 2479 // "flatPath": "gmail/v1/users/{userId}/stop", 2480 // "httpMethod": "POST", 2481 // "id": "gmail.users.stop", 2482 // "parameterOrder": [ 2483 // "userId" 2484 // ], 2485 // "parameters": { 2486 // "userId": { 2487 // "default": "me", 2488 // "description": "The user's email address. The special value `me` can be used to indicate the authenticated user.", 2489 // "location": "path", 2490 // "required": true, 2491 // "type": "string" 2492 // } 2493 // }, 2494 // "path": "gmail/v1/users/{userId}/stop", 2495 // "scopes": [ 2496 // "https://mail.google.com/", 2497 // "https://www.googleapis.com/auth/gmail.metadata", 2498 // "https://www.googleapis.com/auth/gmail.modify", 2499 // "https://www.googleapis.com/auth/gmail.readonly" 2500 // ] 2501 // } 2502 2503} 2504 2505// method id "gmail.users.watch": 2506 2507type UsersWatchCall struct { 2508 s *Service 2509 userId string 2510 watchrequest *WatchRequest 2511 urlParams_ gensupport.URLParams 2512 ctx_ context.Context 2513 header_ http.Header 2514} 2515 2516// Watch: Set up or update a push notification watch on the given user 2517// mailbox. 2518func (r *UsersService) Watch(userId string, watchrequest *WatchRequest) *UsersWatchCall { 2519 c := &UsersWatchCall{s: r.s, urlParams_: make(gensupport.URLParams)} 2520 c.userId = userId 2521 c.watchrequest = watchrequest 2522 return c 2523} 2524 2525// Fields allows partial responses to be retrieved. See 2526// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 2527// for more information. 2528func (c *UsersWatchCall) Fields(s ...googleapi.Field) *UsersWatchCall { 2529 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 2530 return c 2531} 2532 2533// Context sets the context to be used in this call's Do method. Any 2534// pending HTTP request will be aborted if the provided context is 2535// canceled. 2536func (c *UsersWatchCall) Context(ctx context.Context) *UsersWatchCall { 2537 c.ctx_ = ctx 2538 return c 2539} 2540 2541// Header returns an http.Header that can be modified by the caller to 2542// add HTTP headers to the request. 2543func (c *UsersWatchCall) Header() http.Header { 2544 if c.header_ == nil { 2545 c.header_ = make(http.Header) 2546 } 2547 return c.header_ 2548} 2549 2550func (c *UsersWatchCall) doRequest(alt string) (*http.Response, error) { 2551 reqHeaders := make(http.Header) 2552 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20201124") 2553 for k, v := range c.header_ { 2554 reqHeaders[k] = v 2555 } 2556 reqHeaders.Set("User-Agent", c.s.userAgent()) 2557 var body io.Reader = nil 2558 body, err := googleapi.WithoutDataWrapper.JSONReader(c.watchrequest) 2559 if err != nil { 2560 return nil, err 2561 } 2562 reqHeaders.Set("Content-Type", "application/json") 2563 c.urlParams_.Set("alt", alt) 2564 c.urlParams_.Set("prettyPrint", "false") 2565 urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/watch") 2566 urls += "?" + c.urlParams_.Encode() 2567 req, err := http.NewRequest("POST", urls, body) 2568 if err != nil { 2569 return nil, err 2570 } 2571 req.Header = reqHeaders 2572 googleapi.Expand(req.URL, map[string]string{ 2573 "userId": c.userId, 2574 }) 2575 return gensupport.SendRequest(c.ctx_, c.s.client, req) 2576} 2577 2578// Do executes the "gmail.users.watch" call. 2579// Exactly one of *WatchResponse or error will be non-nil. Any non-2xx 2580// status code is an error. Response headers are in either 2581// *WatchResponse.ServerResponse.Header or (if a response was returned 2582// at all) in error.(*googleapi.Error).Header. Use 2583// googleapi.IsNotModified to check whether the returned error was 2584// because http.StatusNotModified was returned. 2585func (c *UsersWatchCall) Do(opts ...googleapi.CallOption) (*WatchResponse, error) { 2586 gensupport.SetOptions(c.urlParams_, opts...) 2587 res, err := c.doRequest("json") 2588 if res != nil && res.StatusCode == http.StatusNotModified { 2589 if res.Body != nil { 2590 res.Body.Close() 2591 } 2592 return nil, &googleapi.Error{ 2593 Code: res.StatusCode, 2594 Header: res.Header, 2595 } 2596 } 2597 if err != nil { 2598 return nil, err 2599 } 2600 defer googleapi.CloseBody(res) 2601 if err := googleapi.CheckResponse(res); err != nil { 2602 return nil, err 2603 } 2604 ret := &WatchResponse{ 2605 ServerResponse: googleapi.ServerResponse{ 2606 Header: res.Header, 2607 HTTPStatusCode: res.StatusCode, 2608 }, 2609 } 2610 target := &ret 2611 if err := gensupport.DecodeResponse(target, res); err != nil { 2612 return nil, err 2613 } 2614 return ret, nil 2615 // { 2616 // "description": "Set up or update a push notification watch on the given user mailbox.", 2617 // "flatPath": "gmail/v1/users/{userId}/watch", 2618 // "httpMethod": "POST", 2619 // "id": "gmail.users.watch", 2620 // "parameterOrder": [ 2621 // "userId" 2622 // ], 2623 // "parameters": { 2624 // "userId": { 2625 // "default": "me", 2626 // "description": "The user's email address. The special value `me` can be used to indicate the authenticated user.", 2627 // "location": "path", 2628 // "required": true, 2629 // "type": "string" 2630 // } 2631 // }, 2632 // "path": "gmail/v1/users/{userId}/watch", 2633 // "request": { 2634 // "$ref": "WatchRequest" 2635 // }, 2636 // "response": { 2637 // "$ref": "WatchResponse" 2638 // }, 2639 // "scopes": [ 2640 // "https://mail.google.com/", 2641 // "https://www.googleapis.com/auth/gmail.metadata", 2642 // "https://www.googleapis.com/auth/gmail.modify", 2643 // "https://www.googleapis.com/auth/gmail.readonly" 2644 // ] 2645 // } 2646 2647} 2648 2649// method id "gmail.users.drafts.create": 2650 2651type UsersDraftsCreateCall struct { 2652 s *Service 2653 userId string 2654 draft *Draft 2655 urlParams_ gensupport.URLParams 2656 mediaInfo_ *gensupport.MediaInfo 2657 ctx_ context.Context 2658 header_ http.Header 2659} 2660 2661// Create: Creates a new draft with the `DRAFT` label. 2662func (r *UsersDraftsService) Create(userId string, draft *Draft) *UsersDraftsCreateCall { 2663 c := &UsersDraftsCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)} 2664 c.userId = userId 2665 c.draft = draft 2666 return c 2667} 2668 2669// Media specifies the media to upload in one or more chunks. The chunk 2670// size may be controlled by supplying a MediaOption generated by 2671// googleapi.ChunkSize. The chunk size defaults to 2672// googleapi.DefaultUploadChunkSize.The Content-Type header used in the 2673// upload request will be determined by sniffing the contents of r, 2674// unless a MediaOption generated by googleapi.ContentType is 2675// supplied. 2676// At most one of Media and ResumableMedia may be set. 2677func (c *UsersDraftsCreateCall) Media(r io.Reader, options ...googleapi.MediaOption) *UsersDraftsCreateCall { 2678 c.mediaInfo_ = gensupport.NewInfoFromMedia(r, options) 2679 return c 2680} 2681 2682// ResumableMedia specifies the media to upload in chunks and can be 2683// canceled with ctx. 2684// 2685// Deprecated: use Media instead. 2686// 2687// At most one of Media and ResumableMedia may be set. mediaType 2688// identifies the MIME media type of the upload, such as "image/png". If 2689// mediaType is "", it will be auto-detected. The provided ctx will 2690// supersede any context previously provided to the Context method. 2691func (c *UsersDraftsCreateCall) ResumableMedia(ctx context.Context, r io.ReaderAt, size int64, mediaType string) *UsersDraftsCreateCall { 2692 c.ctx_ = ctx 2693 c.mediaInfo_ = gensupport.NewInfoFromResumableMedia(r, size, mediaType) 2694 return c 2695} 2696 2697// ProgressUpdater provides a callback function that will be called 2698// after every chunk. It should be a low-latency function in order to 2699// not slow down the upload operation. This should only be called when 2700// using ResumableMedia (as opposed to Media). 2701func (c *UsersDraftsCreateCall) ProgressUpdater(pu googleapi.ProgressUpdater) *UsersDraftsCreateCall { 2702 c.mediaInfo_.SetProgressUpdater(pu) 2703 return c 2704} 2705 2706// Fields allows partial responses to be retrieved. See 2707// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 2708// for more information. 2709func (c *UsersDraftsCreateCall) Fields(s ...googleapi.Field) *UsersDraftsCreateCall { 2710 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 2711 return c 2712} 2713 2714// Context sets the context to be used in this call's Do method. Any 2715// pending HTTP request will be aborted if the provided context is 2716// canceled. 2717// This context will supersede any context previously provided to the 2718// ResumableMedia method. 2719func (c *UsersDraftsCreateCall) Context(ctx context.Context) *UsersDraftsCreateCall { 2720 c.ctx_ = ctx 2721 return c 2722} 2723 2724// Header returns an http.Header that can be modified by the caller to 2725// add HTTP headers to the request. 2726func (c *UsersDraftsCreateCall) Header() http.Header { 2727 if c.header_ == nil { 2728 c.header_ = make(http.Header) 2729 } 2730 return c.header_ 2731} 2732 2733func (c *UsersDraftsCreateCall) doRequest(alt string) (*http.Response, error) { 2734 reqHeaders := make(http.Header) 2735 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20201124") 2736 for k, v := range c.header_ { 2737 reqHeaders[k] = v 2738 } 2739 reqHeaders.Set("User-Agent", c.s.userAgent()) 2740 var body io.Reader = nil 2741 body, err := googleapi.WithoutDataWrapper.JSONReader(c.draft) 2742 if err != nil { 2743 return nil, err 2744 } 2745 reqHeaders.Set("Content-Type", "application/json") 2746 c.urlParams_.Set("alt", alt) 2747 c.urlParams_.Set("prettyPrint", "false") 2748 urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/drafts") 2749 if c.mediaInfo_ != nil { 2750 urls = googleapi.ResolveRelative(c.s.BasePath, "/upload/gmail/v1/users/{userId}/drafts") 2751 c.urlParams_.Set("uploadType", c.mediaInfo_.UploadType()) 2752 } 2753 if body == nil { 2754 body = new(bytes.Buffer) 2755 reqHeaders.Set("Content-Type", "application/json") 2756 } 2757 body, getBody, cleanup := c.mediaInfo_.UploadRequest(reqHeaders, body) 2758 defer cleanup() 2759 urls += "?" + c.urlParams_.Encode() 2760 req, err := http.NewRequest("POST", urls, body) 2761 if err != nil { 2762 return nil, err 2763 } 2764 req.Header = reqHeaders 2765 req.GetBody = getBody 2766 googleapi.Expand(req.URL, map[string]string{ 2767 "userId": c.userId, 2768 }) 2769 return gensupport.SendRequest(c.ctx_, c.s.client, req) 2770} 2771 2772// Do executes the "gmail.users.drafts.create" call. 2773// Exactly one of *Draft or error will be non-nil. Any non-2xx status 2774// code is an error. Response headers are in either 2775// *Draft.ServerResponse.Header or (if a response was returned at all) 2776// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 2777// check whether the returned error was because http.StatusNotModified 2778// was returned. 2779func (c *UsersDraftsCreateCall) Do(opts ...googleapi.CallOption) (*Draft, error) { 2780 gensupport.SetOptions(c.urlParams_, opts...) 2781 res, err := c.doRequest("json") 2782 if res != nil && res.StatusCode == http.StatusNotModified { 2783 if res.Body != nil { 2784 res.Body.Close() 2785 } 2786 return nil, &googleapi.Error{ 2787 Code: res.StatusCode, 2788 Header: res.Header, 2789 } 2790 } 2791 if err != nil { 2792 return nil, err 2793 } 2794 defer googleapi.CloseBody(res) 2795 if err := googleapi.CheckResponse(res); err != nil { 2796 return nil, err 2797 } 2798 rx := c.mediaInfo_.ResumableUpload(res.Header.Get("Location")) 2799 if rx != nil { 2800 rx.Client = c.s.client 2801 rx.UserAgent = c.s.userAgent() 2802 ctx := c.ctx_ 2803 if ctx == nil { 2804 ctx = context.TODO() 2805 } 2806 res, err = rx.Upload(ctx) 2807 if err != nil { 2808 return nil, err 2809 } 2810 defer res.Body.Close() 2811 if err := googleapi.CheckResponse(res); err != nil { 2812 return nil, err 2813 } 2814 } 2815 ret := &Draft{ 2816 ServerResponse: googleapi.ServerResponse{ 2817 Header: res.Header, 2818 HTTPStatusCode: res.StatusCode, 2819 }, 2820 } 2821 target := &ret 2822 if err := gensupport.DecodeResponse(target, res); err != nil { 2823 return nil, err 2824 } 2825 return ret, nil 2826 // { 2827 // "description": "Creates a new draft with the `DRAFT` label.", 2828 // "flatPath": "gmail/v1/users/{userId}/drafts", 2829 // "httpMethod": "POST", 2830 // "id": "gmail.users.drafts.create", 2831 // "mediaUpload": { 2832 // "accept": [ 2833 // "message/*" 2834 // ], 2835 // "maxSize": "36700160", 2836 // "protocols": { 2837 // "resumable": { 2838 // "multipart": true, 2839 // "path": "/resumable/upload/gmail/v1/users/{userId}/drafts" 2840 // }, 2841 // "simple": { 2842 // "multipart": true, 2843 // "path": "/upload/gmail/v1/users/{userId}/drafts" 2844 // } 2845 // } 2846 // }, 2847 // "parameterOrder": [ 2848 // "userId" 2849 // ], 2850 // "parameters": { 2851 // "userId": { 2852 // "default": "me", 2853 // "description": "The user's email address. The special value `me` can be used to indicate the authenticated user.", 2854 // "location": "path", 2855 // "required": true, 2856 // "type": "string" 2857 // } 2858 // }, 2859 // "path": "gmail/v1/users/{userId}/drafts", 2860 // "request": { 2861 // "$ref": "Draft" 2862 // }, 2863 // "response": { 2864 // "$ref": "Draft" 2865 // }, 2866 // "scopes": [ 2867 // "https://mail.google.com/", 2868 // "https://www.googleapis.com/auth/gmail.addons.current.action.compose", 2869 // "https://www.googleapis.com/auth/gmail.compose", 2870 // "https://www.googleapis.com/auth/gmail.modify" 2871 // ], 2872 // "supportsMediaUpload": true 2873 // } 2874 2875} 2876 2877// method id "gmail.users.drafts.delete": 2878 2879type UsersDraftsDeleteCall struct { 2880 s *Service 2881 userId string 2882 id string 2883 urlParams_ gensupport.URLParams 2884 ctx_ context.Context 2885 header_ http.Header 2886} 2887 2888// Delete: Immediately and permanently deletes the specified draft. Does 2889// not simply trash it. 2890func (r *UsersDraftsService) Delete(userId string, id string) *UsersDraftsDeleteCall { 2891 c := &UsersDraftsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)} 2892 c.userId = userId 2893 c.id = id 2894 return c 2895} 2896 2897// Fields allows partial responses to be retrieved. See 2898// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 2899// for more information. 2900func (c *UsersDraftsDeleteCall) Fields(s ...googleapi.Field) *UsersDraftsDeleteCall { 2901 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 2902 return c 2903} 2904 2905// Context sets the context to be used in this call's Do method. Any 2906// pending HTTP request will be aborted if the provided context is 2907// canceled. 2908func (c *UsersDraftsDeleteCall) Context(ctx context.Context) *UsersDraftsDeleteCall { 2909 c.ctx_ = ctx 2910 return c 2911} 2912 2913// Header returns an http.Header that can be modified by the caller to 2914// add HTTP headers to the request. 2915func (c *UsersDraftsDeleteCall) Header() http.Header { 2916 if c.header_ == nil { 2917 c.header_ = make(http.Header) 2918 } 2919 return c.header_ 2920} 2921 2922func (c *UsersDraftsDeleteCall) doRequest(alt string) (*http.Response, error) { 2923 reqHeaders := make(http.Header) 2924 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20201124") 2925 for k, v := range c.header_ { 2926 reqHeaders[k] = v 2927 } 2928 reqHeaders.Set("User-Agent", c.s.userAgent()) 2929 var body io.Reader = nil 2930 c.urlParams_.Set("alt", alt) 2931 c.urlParams_.Set("prettyPrint", "false") 2932 urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/drafts/{id}") 2933 urls += "?" + c.urlParams_.Encode() 2934 req, err := http.NewRequest("DELETE", urls, body) 2935 if err != nil { 2936 return nil, err 2937 } 2938 req.Header = reqHeaders 2939 googleapi.Expand(req.URL, map[string]string{ 2940 "userId": c.userId, 2941 "id": c.id, 2942 }) 2943 return gensupport.SendRequest(c.ctx_, c.s.client, req) 2944} 2945 2946// Do executes the "gmail.users.drafts.delete" call. 2947func (c *UsersDraftsDeleteCall) Do(opts ...googleapi.CallOption) error { 2948 gensupport.SetOptions(c.urlParams_, opts...) 2949 res, err := c.doRequest("json") 2950 if err != nil { 2951 return err 2952 } 2953 defer googleapi.CloseBody(res) 2954 if err := googleapi.CheckResponse(res); err != nil { 2955 return err 2956 } 2957 return nil 2958 // { 2959 // "description": "Immediately and permanently deletes the specified draft. Does not simply trash it.", 2960 // "flatPath": "gmail/v1/users/{userId}/drafts/{id}", 2961 // "httpMethod": "DELETE", 2962 // "id": "gmail.users.drafts.delete", 2963 // "parameterOrder": [ 2964 // "userId", 2965 // "id" 2966 // ], 2967 // "parameters": { 2968 // "id": { 2969 // "description": "The ID of the draft to delete.", 2970 // "location": "path", 2971 // "required": true, 2972 // "type": "string" 2973 // }, 2974 // "userId": { 2975 // "default": "me", 2976 // "description": "The user's email address. The special value `me` can be used to indicate the authenticated user.", 2977 // "location": "path", 2978 // "required": true, 2979 // "type": "string" 2980 // } 2981 // }, 2982 // "path": "gmail/v1/users/{userId}/drafts/{id}", 2983 // "scopes": [ 2984 // "https://mail.google.com/", 2985 // "https://www.googleapis.com/auth/gmail.addons.current.action.compose", 2986 // "https://www.googleapis.com/auth/gmail.compose", 2987 // "https://www.googleapis.com/auth/gmail.modify" 2988 // ] 2989 // } 2990 2991} 2992 2993// method id "gmail.users.drafts.get": 2994 2995type UsersDraftsGetCall struct { 2996 s *Service 2997 userId string 2998 id string 2999 urlParams_ gensupport.URLParams 3000 ifNoneMatch_ string 3001 ctx_ context.Context 3002 header_ http.Header 3003} 3004 3005// Get: Gets the specified draft. 3006func (r *UsersDraftsService) Get(userId string, id string) *UsersDraftsGetCall { 3007 c := &UsersDraftsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)} 3008 c.userId = userId 3009 c.id = id 3010 return c 3011} 3012 3013// Format sets the optional parameter "format": The format to return the 3014// draft in. 3015// 3016// Possible values: 3017// "minimal" - Returns only email message ID and labels; does not 3018// return the email headers, body, or payload. 3019// "full" (default) - Returns the full email message data with body 3020// content parsed in the `payload` field; the `raw` field is not used. 3021// Format cannot be used when accessing the api using the gmail.metadata 3022// scope. 3023// "raw" - Returns the full email message data with body content in 3024// the `raw` field as a base64url encoded string; the `payload` field is 3025// not used. Format cannot be used when accessing the api using the 3026// gmail.metadata scope. 3027// "metadata" - Returns only email message ID, labels, and email 3028// headers. 3029func (c *UsersDraftsGetCall) Format(format string) *UsersDraftsGetCall { 3030 c.urlParams_.Set("format", format) 3031 return c 3032} 3033 3034// Fields allows partial responses to be retrieved. See 3035// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 3036// for more information. 3037func (c *UsersDraftsGetCall) Fields(s ...googleapi.Field) *UsersDraftsGetCall { 3038 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 3039 return c 3040} 3041 3042// IfNoneMatch sets the optional parameter which makes the operation 3043// fail if the object's ETag matches the given value. This is useful for 3044// getting updates only after the object has changed since the last 3045// request. Use googleapi.IsNotModified to check whether the response 3046// error from Do is the result of In-None-Match. 3047func (c *UsersDraftsGetCall) IfNoneMatch(entityTag string) *UsersDraftsGetCall { 3048 c.ifNoneMatch_ = entityTag 3049 return c 3050} 3051 3052// Context sets the context to be used in this call's Do method. Any 3053// pending HTTP request will be aborted if the provided context is 3054// canceled. 3055func (c *UsersDraftsGetCall) Context(ctx context.Context) *UsersDraftsGetCall { 3056 c.ctx_ = ctx 3057 return c 3058} 3059 3060// Header returns an http.Header that can be modified by the caller to 3061// add HTTP headers to the request. 3062func (c *UsersDraftsGetCall) Header() http.Header { 3063 if c.header_ == nil { 3064 c.header_ = make(http.Header) 3065 } 3066 return c.header_ 3067} 3068 3069func (c *UsersDraftsGetCall) doRequest(alt string) (*http.Response, error) { 3070 reqHeaders := make(http.Header) 3071 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20201124") 3072 for k, v := range c.header_ { 3073 reqHeaders[k] = v 3074 } 3075 reqHeaders.Set("User-Agent", c.s.userAgent()) 3076 if c.ifNoneMatch_ != "" { 3077 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 3078 } 3079 var body io.Reader = nil 3080 c.urlParams_.Set("alt", alt) 3081 c.urlParams_.Set("prettyPrint", "false") 3082 urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/drafts/{id}") 3083 urls += "?" + c.urlParams_.Encode() 3084 req, err := http.NewRequest("GET", urls, body) 3085 if err != nil { 3086 return nil, err 3087 } 3088 req.Header = reqHeaders 3089 googleapi.Expand(req.URL, map[string]string{ 3090 "userId": c.userId, 3091 "id": c.id, 3092 }) 3093 return gensupport.SendRequest(c.ctx_, c.s.client, req) 3094} 3095 3096// Do executes the "gmail.users.drafts.get" call. 3097// Exactly one of *Draft or error will be non-nil. Any non-2xx status 3098// code is an error. Response headers are in either 3099// *Draft.ServerResponse.Header or (if a response was returned at all) 3100// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 3101// check whether the returned error was because http.StatusNotModified 3102// was returned. 3103func (c *UsersDraftsGetCall) Do(opts ...googleapi.CallOption) (*Draft, error) { 3104 gensupport.SetOptions(c.urlParams_, opts...) 3105 res, err := c.doRequest("json") 3106 if res != nil && res.StatusCode == http.StatusNotModified { 3107 if res.Body != nil { 3108 res.Body.Close() 3109 } 3110 return nil, &googleapi.Error{ 3111 Code: res.StatusCode, 3112 Header: res.Header, 3113 } 3114 } 3115 if err != nil { 3116 return nil, err 3117 } 3118 defer googleapi.CloseBody(res) 3119 if err := googleapi.CheckResponse(res); err != nil { 3120 return nil, err 3121 } 3122 ret := &Draft{ 3123 ServerResponse: googleapi.ServerResponse{ 3124 Header: res.Header, 3125 HTTPStatusCode: res.StatusCode, 3126 }, 3127 } 3128 target := &ret 3129 if err := gensupport.DecodeResponse(target, res); err != nil { 3130 return nil, err 3131 } 3132 return ret, nil 3133 // { 3134 // "description": "Gets the specified draft.", 3135 // "flatPath": "gmail/v1/users/{userId}/drafts/{id}", 3136 // "httpMethod": "GET", 3137 // "id": "gmail.users.drafts.get", 3138 // "parameterOrder": [ 3139 // "userId", 3140 // "id" 3141 // ], 3142 // "parameters": { 3143 // "format": { 3144 // "default": "full", 3145 // "description": "The format to return the draft in.", 3146 // "enum": [ 3147 // "minimal", 3148 // "full", 3149 // "raw", 3150 // "metadata" 3151 // ], 3152 // "enumDescriptions": [ 3153 // "Returns only email message ID and labels; does not return the email headers, body, or payload.", 3154 // "Returns the full email message data with body content parsed in the `payload` field; the `raw` field is not used. Format cannot be used when accessing the api using the gmail.metadata scope.", 3155 // "Returns the full email message data with body content in the `raw` field as a base64url encoded string; the `payload` field is not used. Format cannot be used when accessing the api using the gmail.metadata scope.", 3156 // "Returns only email message ID, labels, and email headers." 3157 // ], 3158 // "location": "query", 3159 // "type": "string" 3160 // }, 3161 // "id": { 3162 // "description": "The ID of the draft to retrieve.", 3163 // "location": "path", 3164 // "required": true, 3165 // "type": "string" 3166 // }, 3167 // "userId": { 3168 // "default": "me", 3169 // "description": "The user's email address. The special value `me` can be used to indicate the authenticated user.", 3170 // "location": "path", 3171 // "required": true, 3172 // "type": "string" 3173 // } 3174 // }, 3175 // "path": "gmail/v1/users/{userId}/drafts/{id}", 3176 // "response": { 3177 // "$ref": "Draft" 3178 // }, 3179 // "scopes": [ 3180 // "https://mail.google.com/", 3181 // "https://www.googleapis.com/auth/gmail.compose", 3182 // "https://www.googleapis.com/auth/gmail.modify", 3183 // "https://www.googleapis.com/auth/gmail.readonly" 3184 // ] 3185 // } 3186 3187} 3188 3189// method id "gmail.users.drafts.list": 3190 3191type UsersDraftsListCall struct { 3192 s *Service 3193 userId string 3194 urlParams_ gensupport.URLParams 3195 ifNoneMatch_ string 3196 ctx_ context.Context 3197 header_ http.Header 3198} 3199 3200// List: Lists the drafts in the user's mailbox. 3201func (r *UsersDraftsService) List(userId string) *UsersDraftsListCall { 3202 c := &UsersDraftsListCall{s: r.s, urlParams_: make(gensupport.URLParams)} 3203 c.userId = userId 3204 return c 3205} 3206 3207// IncludeSpamTrash sets the optional parameter "includeSpamTrash": 3208// Include drafts from `SPAM` and `TRASH` in the results. 3209func (c *UsersDraftsListCall) IncludeSpamTrash(includeSpamTrash bool) *UsersDraftsListCall { 3210 c.urlParams_.Set("includeSpamTrash", fmt.Sprint(includeSpamTrash)) 3211 return c 3212} 3213 3214// MaxResults sets the optional parameter "maxResults": Maximum number 3215// of drafts to return. 3216func (c *UsersDraftsListCall) MaxResults(maxResults int64) *UsersDraftsListCall { 3217 c.urlParams_.Set("maxResults", fmt.Sprint(maxResults)) 3218 return c 3219} 3220 3221// PageToken sets the optional parameter "pageToken": Page token to 3222// retrieve a specific page of results in the list. 3223func (c *UsersDraftsListCall) PageToken(pageToken string) *UsersDraftsListCall { 3224 c.urlParams_.Set("pageToken", pageToken) 3225 return c 3226} 3227 3228// Q sets the optional parameter "q": Only return draft messages 3229// matching the specified query. Supports the same query format as the 3230// Gmail search box. For example, "from:someuser@example.com 3231// rfc822msgid: is:unread". 3232func (c *UsersDraftsListCall) Q(q string) *UsersDraftsListCall { 3233 c.urlParams_.Set("q", q) 3234 return c 3235} 3236 3237// Fields allows partial responses to be retrieved. See 3238// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 3239// for more information. 3240func (c *UsersDraftsListCall) Fields(s ...googleapi.Field) *UsersDraftsListCall { 3241 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 3242 return c 3243} 3244 3245// IfNoneMatch sets the optional parameter which makes the operation 3246// fail if the object's ETag matches the given value. This is useful for 3247// getting updates only after the object has changed since the last 3248// request. Use googleapi.IsNotModified to check whether the response 3249// error from Do is the result of In-None-Match. 3250func (c *UsersDraftsListCall) IfNoneMatch(entityTag string) *UsersDraftsListCall { 3251 c.ifNoneMatch_ = entityTag 3252 return c 3253} 3254 3255// Context sets the context to be used in this call's Do method. Any 3256// pending HTTP request will be aborted if the provided context is 3257// canceled. 3258func (c *UsersDraftsListCall) Context(ctx context.Context) *UsersDraftsListCall { 3259 c.ctx_ = ctx 3260 return c 3261} 3262 3263// Header returns an http.Header that can be modified by the caller to 3264// add HTTP headers to the request. 3265func (c *UsersDraftsListCall) Header() http.Header { 3266 if c.header_ == nil { 3267 c.header_ = make(http.Header) 3268 } 3269 return c.header_ 3270} 3271 3272func (c *UsersDraftsListCall) doRequest(alt string) (*http.Response, error) { 3273 reqHeaders := make(http.Header) 3274 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20201124") 3275 for k, v := range c.header_ { 3276 reqHeaders[k] = v 3277 } 3278 reqHeaders.Set("User-Agent", c.s.userAgent()) 3279 if c.ifNoneMatch_ != "" { 3280 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 3281 } 3282 var body io.Reader = nil 3283 c.urlParams_.Set("alt", alt) 3284 c.urlParams_.Set("prettyPrint", "false") 3285 urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/drafts") 3286 urls += "?" + c.urlParams_.Encode() 3287 req, err := http.NewRequest("GET", urls, body) 3288 if err != nil { 3289 return nil, err 3290 } 3291 req.Header = reqHeaders 3292 googleapi.Expand(req.URL, map[string]string{ 3293 "userId": c.userId, 3294 }) 3295 return gensupport.SendRequest(c.ctx_, c.s.client, req) 3296} 3297 3298// Do executes the "gmail.users.drafts.list" call. 3299// Exactly one of *ListDraftsResponse or error will be non-nil. Any 3300// non-2xx status code is an error. Response headers are in either 3301// *ListDraftsResponse.ServerResponse.Header or (if a response was 3302// returned at all) in error.(*googleapi.Error).Header. Use 3303// googleapi.IsNotModified to check whether the returned error was 3304// because http.StatusNotModified was returned. 3305func (c *UsersDraftsListCall) Do(opts ...googleapi.CallOption) (*ListDraftsResponse, error) { 3306 gensupport.SetOptions(c.urlParams_, opts...) 3307 res, err := c.doRequest("json") 3308 if res != nil && res.StatusCode == http.StatusNotModified { 3309 if res.Body != nil { 3310 res.Body.Close() 3311 } 3312 return nil, &googleapi.Error{ 3313 Code: res.StatusCode, 3314 Header: res.Header, 3315 } 3316 } 3317 if err != nil { 3318 return nil, err 3319 } 3320 defer googleapi.CloseBody(res) 3321 if err := googleapi.CheckResponse(res); err != nil { 3322 return nil, err 3323 } 3324 ret := &ListDraftsResponse{ 3325 ServerResponse: googleapi.ServerResponse{ 3326 Header: res.Header, 3327 HTTPStatusCode: res.StatusCode, 3328 }, 3329 } 3330 target := &ret 3331 if err := gensupport.DecodeResponse(target, res); err != nil { 3332 return nil, err 3333 } 3334 return ret, nil 3335 // { 3336 // "description": "Lists the drafts in the user's mailbox.", 3337 // "flatPath": "gmail/v1/users/{userId}/drafts", 3338 // "httpMethod": "GET", 3339 // "id": "gmail.users.drafts.list", 3340 // "parameterOrder": [ 3341 // "userId" 3342 // ], 3343 // "parameters": { 3344 // "includeSpamTrash": { 3345 // "default": "false", 3346 // "description": "Include drafts from `SPAM` and `TRASH` in the results.", 3347 // "location": "query", 3348 // "type": "boolean" 3349 // }, 3350 // "maxResults": { 3351 // "default": "100", 3352 // "description": "Maximum number of drafts to return.", 3353 // "format": "uint32", 3354 // "location": "query", 3355 // "type": "integer" 3356 // }, 3357 // "pageToken": { 3358 // "description": "Page token to retrieve a specific page of results in the list.", 3359 // "location": "query", 3360 // "type": "string" 3361 // }, 3362 // "q": { 3363 // "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\"`.", 3364 // "location": "query", 3365 // "type": "string" 3366 // }, 3367 // "userId": { 3368 // "default": "me", 3369 // "description": "The user's email address. The special value `me` can be used to indicate the authenticated user.", 3370 // "location": "path", 3371 // "required": true, 3372 // "type": "string" 3373 // } 3374 // }, 3375 // "path": "gmail/v1/users/{userId}/drafts", 3376 // "response": { 3377 // "$ref": "ListDraftsResponse" 3378 // }, 3379 // "scopes": [ 3380 // "https://mail.google.com/", 3381 // "https://www.googleapis.com/auth/gmail.compose", 3382 // "https://www.googleapis.com/auth/gmail.modify", 3383 // "https://www.googleapis.com/auth/gmail.readonly" 3384 // ] 3385 // } 3386 3387} 3388 3389// Pages invokes f for each page of results. 3390// A non-nil error returned from f will halt the iteration. 3391// The provided context supersedes any context provided to the Context method. 3392func (c *UsersDraftsListCall) Pages(ctx context.Context, f func(*ListDraftsResponse) error) error { 3393 c.ctx_ = ctx 3394 defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point 3395 for { 3396 x, err := c.Do() 3397 if err != nil { 3398 return err 3399 } 3400 if err := f(x); err != nil { 3401 return err 3402 } 3403 if x.NextPageToken == "" { 3404 return nil 3405 } 3406 c.PageToken(x.NextPageToken) 3407 } 3408} 3409 3410// method id "gmail.users.drafts.send": 3411 3412type UsersDraftsSendCall struct { 3413 s *Service 3414 userId string 3415 draft *Draft 3416 urlParams_ gensupport.URLParams 3417 mediaInfo_ *gensupport.MediaInfo 3418 ctx_ context.Context 3419 header_ http.Header 3420} 3421 3422// Send: Sends the specified, existing draft to the recipients in the 3423// `To`, `Cc`, and `Bcc` headers. 3424func (r *UsersDraftsService) Send(userId string, draft *Draft) *UsersDraftsSendCall { 3425 c := &UsersDraftsSendCall{s: r.s, urlParams_: make(gensupport.URLParams)} 3426 c.userId = userId 3427 c.draft = draft 3428 return c 3429} 3430 3431// Media specifies the media to upload in one or more chunks. The chunk 3432// size may be controlled by supplying a MediaOption generated by 3433// googleapi.ChunkSize. The chunk size defaults to 3434// googleapi.DefaultUploadChunkSize.The Content-Type header used in the 3435// upload request will be determined by sniffing the contents of r, 3436// unless a MediaOption generated by googleapi.ContentType is 3437// supplied. 3438// At most one of Media and ResumableMedia may be set. 3439func (c *UsersDraftsSendCall) Media(r io.Reader, options ...googleapi.MediaOption) *UsersDraftsSendCall { 3440 c.mediaInfo_ = gensupport.NewInfoFromMedia(r, options) 3441 return c 3442} 3443 3444// ResumableMedia specifies the media to upload in chunks and can be 3445// canceled with ctx. 3446// 3447// Deprecated: use Media instead. 3448// 3449// At most one of Media and ResumableMedia may be set. mediaType 3450// identifies the MIME media type of the upload, such as "image/png". If 3451// mediaType is "", it will be auto-detected. The provided ctx will 3452// supersede any context previously provided to the Context method. 3453func (c *UsersDraftsSendCall) ResumableMedia(ctx context.Context, r io.ReaderAt, size int64, mediaType string) *UsersDraftsSendCall { 3454 c.ctx_ = ctx 3455 c.mediaInfo_ = gensupport.NewInfoFromResumableMedia(r, size, mediaType) 3456 return c 3457} 3458 3459// ProgressUpdater provides a callback function that will be called 3460// after every chunk. It should be a low-latency function in order to 3461// not slow down the upload operation. This should only be called when 3462// using ResumableMedia (as opposed to Media). 3463func (c *UsersDraftsSendCall) ProgressUpdater(pu googleapi.ProgressUpdater) *UsersDraftsSendCall { 3464 c.mediaInfo_.SetProgressUpdater(pu) 3465 return c 3466} 3467 3468// Fields allows partial responses to be retrieved. See 3469// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 3470// for more information. 3471func (c *UsersDraftsSendCall) Fields(s ...googleapi.Field) *UsersDraftsSendCall { 3472 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 3473 return c 3474} 3475 3476// Context sets the context to be used in this call's Do method. Any 3477// pending HTTP request will be aborted if the provided context is 3478// canceled. 3479// This context will supersede any context previously provided to the 3480// ResumableMedia method. 3481func (c *UsersDraftsSendCall) Context(ctx context.Context) *UsersDraftsSendCall { 3482 c.ctx_ = ctx 3483 return c 3484} 3485 3486// Header returns an http.Header that can be modified by the caller to 3487// add HTTP headers to the request. 3488func (c *UsersDraftsSendCall) Header() http.Header { 3489 if c.header_ == nil { 3490 c.header_ = make(http.Header) 3491 } 3492 return c.header_ 3493} 3494 3495func (c *UsersDraftsSendCall) doRequest(alt string) (*http.Response, error) { 3496 reqHeaders := make(http.Header) 3497 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20201124") 3498 for k, v := range c.header_ { 3499 reqHeaders[k] = v 3500 } 3501 reqHeaders.Set("User-Agent", c.s.userAgent()) 3502 var body io.Reader = nil 3503 body, err := googleapi.WithoutDataWrapper.JSONReader(c.draft) 3504 if err != nil { 3505 return nil, err 3506 } 3507 reqHeaders.Set("Content-Type", "application/json") 3508 c.urlParams_.Set("alt", alt) 3509 c.urlParams_.Set("prettyPrint", "false") 3510 urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/drafts/send") 3511 if c.mediaInfo_ != nil { 3512 urls = googleapi.ResolveRelative(c.s.BasePath, "/upload/gmail/v1/users/{userId}/drafts/send") 3513 c.urlParams_.Set("uploadType", c.mediaInfo_.UploadType()) 3514 } 3515 if body == nil { 3516 body = new(bytes.Buffer) 3517 reqHeaders.Set("Content-Type", "application/json") 3518 } 3519 body, getBody, cleanup := c.mediaInfo_.UploadRequest(reqHeaders, body) 3520 defer cleanup() 3521 urls += "?" + c.urlParams_.Encode() 3522 req, err := http.NewRequest("POST", urls, body) 3523 if err != nil { 3524 return nil, err 3525 } 3526 req.Header = reqHeaders 3527 req.GetBody = getBody 3528 googleapi.Expand(req.URL, map[string]string{ 3529 "userId": c.userId, 3530 }) 3531 return gensupport.SendRequest(c.ctx_, c.s.client, req) 3532} 3533 3534// Do executes the "gmail.users.drafts.send" call. 3535// Exactly one of *Message or error will be non-nil. Any non-2xx status 3536// code is an error. Response headers are in either 3537// *Message.ServerResponse.Header or (if a response was returned at all) 3538// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 3539// check whether the returned error was because http.StatusNotModified 3540// was returned. 3541func (c *UsersDraftsSendCall) Do(opts ...googleapi.CallOption) (*Message, error) { 3542 gensupport.SetOptions(c.urlParams_, opts...) 3543 res, err := c.doRequest("json") 3544 if res != nil && res.StatusCode == http.StatusNotModified { 3545 if res.Body != nil { 3546 res.Body.Close() 3547 } 3548 return nil, &googleapi.Error{ 3549 Code: res.StatusCode, 3550 Header: res.Header, 3551 } 3552 } 3553 if err != nil { 3554 return nil, err 3555 } 3556 defer googleapi.CloseBody(res) 3557 if err := googleapi.CheckResponse(res); err != nil { 3558 return nil, err 3559 } 3560 rx := c.mediaInfo_.ResumableUpload(res.Header.Get("Location")) 3561 if rx != nil { 3562 rx.Client = c.s.client 3563 rx.UserAgent = c.s.userAgent() 3564 ctx := c.ctx_ 3565 if ctx == nil { 3566 ctx = context.TODO() 3567 } 3568 res, err = rx.Upload(ctx) 3569 if err != nil { 3570 return nil, err 3571 } 3572 defer res.Body.Close() 3573 if err := googleapi.CheckResponse(res); err != nil { 3574 return nil, err 3575 } 3576 } 3577 ret := &Message{ 3578 ServerResponse: googleapi.ServerResponse{ 3579 Header: res.Header, 3580 HTTPStatusCode: res.StatusCode, 3581 }, 3582 } 3583 target := &ret 3584 if err := gensupport.DecodeResponse(target, res); err != nil { 3585 return nil, err 3586 } 3587 return ret, nil 3588 // { 3589 // "description": "Sends the specified, existing draft to the recipients in the `To`, `Cc`, and `Bcc` headers.", 3590 // "flatPath": "gmail/v1/users/{userId}/drafts/send", 3591 // "httpMethod": "POST", 3592 // "id": "gmail.users.drafts.send", 3593 // "mediaUpload": { 3594 // "accept": [ 3595 // "message/*" 3596 // ], 3597 // "maxSize": "36700160", 3598 // "protocols": { 3599 // "resumable": { 3600 // "multipart": true, 3601 // "path": "/resumable/upload/gmail/v1/users/{userId}/drafts/send" 3602 // }, 3603 // "simple": { 3604 // "multipart": true, 3605 // "path": "/upload/gmail/v1/users/{userId}/drafts/send" 3606 // } 3607 // } 3608 // }, 3609 // "parameterOrder": [ 3610 // "userId" 3611 // ], 3612 // "parameters": { 3613 // "userId": { 3614 // "default": "me", 3615 // "description": "The user's email address. The special value `me` can be used to indicate the authenticated user.", 3616 // "location": "path", 3617 // "required": true, 3618 // "type": "string" 3619 // } 3620 // }, 3621 // "path": "gmail/v1/users/{userId}/drafts/send", 3622 // "request": { 3623 // "$ref": "Draft" 3624 // }, 3625 // "response": { 3626 // "$ref": "Message" 3627 // }, 3628 // "scopes": [ 3629 // "https://mail.google.com/", 3630 // "https://www.googleapis.com/auth/gmail.addons.current.action.compose", 3631 // "https://www.googleapis.com/auth/gmail.compose", 3632 // "https://www.googleapis.com/auth/gmail.modify" 3633 // ], 3634 // "supportsMediaUpload": true 3635 // } 3636 3637} 3638 3639// method id "gmail.users.drafts.update": 3640 3641type UsersDraftsUpdateCall struct { 3642 s *Service 3643 userId string 3644 id string 3645 draft *Draft 3646 urlParams_ gensupport.URLParams 3647 mediaInfo_ *gensupport.MediaInfo 3648 ctx_ context.Context 3649 header_ http.Header 3650} 3651 3652// Update: Replaces a draft's content. 3653func (r *UsersDraftsService) Update(userId string, id string, draft *Draft) *UsersDraftsUpdateCall { 3654 c := &UsersDraftsUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)} 3655 c.userId = userId 3656 c.id = id 3657 c.draft = draft 3658 return c 3659} 3660 3661// Media specifies the media to upload in one or more chunks. The chunk 3662// size may be controlled by supplying a MediaOption generated by 3663// googleapi.ChunkSize. The chunk size defaults to 3664// googleapi.DefaultUploadChunkSize.The Content-Type header used in the 3665// upload request will be determined by sniffing the contents of r, 3666// unless a MediaOption generated by googleapi.ContentType is 3667// supplied. 3668// At most one of Media and ResumableMedia may be set. 3669func (c *UsersDraftsUpdateCall) Media(r io.Reader, options ...googleapi.MediaOption) *UsersDraftsUpdateCall { 3670 c.mediaInfo_ = gensupport.NewInfoFromMedia(r, options) 3671 return c 3672} 3673 3674// ResumableMedia specifies the media to upload in chunks and can be 3675// canceled with ctx. 3676// 3677// Deprecated: use Media instead. 3678// 3679// At most one of Media and ResumableMedia may be set. mediaType 3680// identifies the MIME media type of the upload, such as "image/png". If 3681// mediaType is "", it will be auto-detected. The provided ctx will 3682// supersede any context previously provided to the Context method. 3683func (c *UsersDraftsUpdateCall) ResumableMedia(ctx context.Context, r io.ReaderAt, size int64, mediaType string) *UsersDraftsUpdateCall { 3684 c.ctx_ = ctx 3685 c.mediaInfo_ = gensupport.NewInfoFromResumableMedia(r, size, mediaType) 3686 return c 3687} 3688 3689// ProgressUpdater provides a callback function that will be called 3690// after every chunk. It should be a low-latency function in order to 3691// not slow down the upload operation. This should only be called when 3692// using ResumableMedia (as opposed to Media). 3693func (c *UsersDraftsUpdateCall) ProgressUpdater(pu googleapi.ProgressUpdater) *UsersDraftsUpdateCall { 3694 c.mediaInfo_.SetProgressUpdater(pu) 3695 return c 3696} 3697 3698// Fields allows partial responses to be retrieved. See 3699// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 3700// for more information. 3701func (c *UsersDraftsUpdateCall) Fields(s ...googleapi.Field) *UsersDraftsUpdateCall { 3702 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 3703 return c 3704} 3705 3706// Context sets the context to be used in this call's Do method. Any 3707// pending HTTP request will be aborted if the provided context is 3708// canceled. 3709// This context will supersede any context previously provided to the 3710// ResumableMedia method. 3711func (c *UsersDraftsUpdateCall) Context(ctx context.Context) *UsersDraftsUpdateCall { 3712 c.ctx_ = ctx 3713 return c 3714} 3715 3716// Header returns an http.Header that can be modified by the caller to 3717// add HTTP headers to the request. 3718func (c *UsersDraftsUpdateCall) Header() http.Header { 3719 if c.header_ == nil { 3720 c.header_ = make(http.Header) 3721 } 3722 return c.header_ 3723} 3724 3725func (c *UsersDraftsUpdateCall) doRequest(alt string) (*http.Response, error) { 3726 reqHeaders := make(http.Header) 3727 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20201124") 3728 for k, v := range c.header_ { 3729 reqHeaders[k] = v 3730 } 3731 reqHeaders.Set("User-Agent", c.s.userAgent()) 3732 var body io.Reader = nil 3733 body, err := googleapi.WithoutDataWrapper.JSONReader(c.draft) 3734 if err != nil { 3735 return nil, err 3736 } 3737 reqHeaders.Set("Content-Type", "application/json") 3738 c.urlParams_.Set("alt", alt) 3739 c.urlParams_.Set("prettyPrint", "false") 3740 urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/drafts/{id}") 3741 if c.mediaInfo_ != nil { 3742 urls = googleapi.ResolveRelative(c.s.BasePath, "/upload/gmail/v1/users/{userId}/drafts/{id}") 3743 c.urlParams_.Set("uploadType", c.mediaInfo_.UploadType()) 3744 } 3745 if body == nil { 3746 body = new(bytes.Buffer) 3747 reqHeaders.Set("Content-Type", "application/json") 3748 } 3749 body, getBody, cleanup := c.mediaInfo_.UploadRequest(reqHeaders, body) 3750 defer cleanup() 3751 urls += "?" + c.urlParams_.Encode() 3752 req, err := http.NewRequest("PUT", urls, body) 3753 if err != nil { 3754 return nil, err 3755 } 3756 req.Header = reqHeaders 3757 req.GetBody = getBody 3758 googleapi.Expand(req.URL, map[string]string{ 3759 "userId": c.userId, 3760 "id": c.id, 3761 }) 3762 return gensupport.SendRequest(c.ctx_, c.s.client, req) 3763} 3764 3765// Do executes the "gmail.users.drafts.update" call. 3766// Exactly one of *Draft or error will be non-nil. Any non-2xx status 3767// code is an error. Response headers are in either 3768// *Draft.ServerResponse.Header or (if a response was returned at all) 3769// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 3770// check whether the returned error was because http.StatusNotModified 3771// was returned. 3772func (c *UsersDraftsUpdateCall) Do(opts ...googleapi.CallOption) (*Draft, error) { 3773 gensupport.SetOptions(c.urlParams_, opts...) 3774 res, err := c.doRequest("json") 3775 if res != nil && res.StatusCode == http.StatusNotModified { 3776 if res.Body != nil { 3777 res.Body.Close() 3778 } 3779 return nil, &googleapi.Error{ 3780 Code: res.StatusCode, 3781 Header: res.Header, 3782 } 3783 } 3784 if err != nil { 3785 return nil, err 3786 } 3787 defer googleapi.CloseBody(res) 3788 if err := googleapi.CheckResponse(res); err != nil { 3789 return nil, err 3790 } 3791 rx := c.mediaInfo_.ResumableUpload(res.Header.Get("Location")) 3792 if rx != nil { 3793 rx.Client = c.s.client 3794 rx.UserAgent = c.s.userAgent() 3795 ctx := c.ctx_ 3796 if ctx == nil { 3797 ctx = context.TODO() 3798 } 3799 res, err = rx.Upload(ctx) 3800 if err != nil { 3801 return nil, err 3802 } 3803 defer res.Body.Close() 3804 if err := googleapi.CheckResponse(res); err != nil { 3805 return nil, err 3806 } 3807 } 3808 ret := &Draft{ 3809 ServerResponse: googleapi.ServerResponse{ 3810 Header: res.Header, 3811 HTTPStatusCode: res.StatusCode, 3812 }, 3813 } 3814 target := &ret 3815 if err := gensupport.DecodeResponse(target, res); err != nil { 3816 return nil, err 3817 } 3818 return ret, nil 3819 // { 3820 // "description": "Replaces a draft's content.", 3821 // "flatPath": "gmail/v1/users/{userId}/drafts/{id}", 3822 // "httpMethod": "PUT", 3823 // "id": "gmail.users.drafts.update", 3824 // "mediaUpload": { 3825 // "accept": [ 3826 // "message/*" 3827 // ], 3828 // "maxSize": "36700160", 3829 // "protocols": { 3830 // "resumable": { 3831 // "multipart": true, 3832 // "path": "/resumable/upload/gmail/v1/users/{userId}/drafts/{id}" 3833 // }, 3834 // "simple": { 3835 // "multipart": true, 3836 // "path": "/upload/gmail/v1/users/{userId}/drafts/{id}" 3837 // } 3838 // } 3839 // }, 3840 // "parameterOrder": [ 3841 // "userId", 3842 // "id" 3843 // ], 3844 // "parameters": { 3845 // "id": { 3846 // "description": "The ID of the draft to update.", 3847 // "location": "path", 3848 // "required": true, 3849 // "type": "string" 3850 // }, 3851 // "userId": { 3852 // "default": "me", 3853 // "description": "The user's email address. The special value `me` can be used to indicate the authenticated user.", 3854 // "location": "path", 3855 // "required": true, 3856 // "type": "string" 3857 // } 3858 // }, 3859 // "path": "gmail/v1/users/{userId}/drafts/{id}", 3860 // "request": { 3861 // "$ref": "Draft" 3862 // }, 3863 // "response": { 3864 // "$ref": "Draft" 3865 // }, 3866 // "scopes": [ 3867 // "https://mail.google.com/", 3868 // "https://www.googleapis.com/auth/gmail.addons.current.action.compose", 3869 // "https://www.googleapis.com/auth/gmail.compose", 3870 // "https://www.googleapis.com/auth/gmail.modify" 3871 // ], 3872 // "supportsMediaUpload": true 3873 // } 3874 3875} 3876 3877// method id "gmail.users.history.list": 3878 3879type UsersHistoryListCall struct { 3880 s *Service 3881 userId string 3882 urlParams_ gensupport.URLParams 3883 ifNoneMatch_ string 3884 ctx_ context.Context 3885 header_ http.Header 3886} 3887 3888// List: Lists the history of all changes to the given mailbox. History 3889// results are returned in chronological order (increasing `historyId`). 3890func (r *UsersHistoryService) List(userId string) *UsersHistoryListCall { 3891 c := &UsersHistoryListCall{s: r.s, urlParams_: make(gensupport.URLParams)} 3892 c.userId = userId 3893 return c 3894} 3895 3896// HistoryTypes sets the optional parameter "historyTypes": History 3897// types to be returned by the function 3898// 3899// Possible values: 3900// "messageAdded" 3901// "messageDeleted" 3902// "labelAdded" 3903// "labelRemoved" 3904func (c *UsersHistoryListCall) HistoryTypes(historyTypes ...string) *UsersHistoryListCall { 3905 c.urlParams_.SetMulti("historyTypes", append([]string{}, historyTypes...)) 3906 return c 3907} 3908 3909// LabelId sets the optional parameter "labelId": Only return messages 3910// with a label matching the ID. 3911func (c *UsersHistoryListCall) LabelId(labelId string) *UsersHistoryListCall { 3912 c.urlParams_.Set("labelId", labelId) 3913 return c 3914} 3915 3916// MaxResults sets the optional parameter "maxResults": The maximum 3917// number of history records to return. 3918func (c *UsersHistoryListCall) MaxResults(maxResults int64) *UsersHistoryListCall { 3919 c.urlParams_.Set("maxResults", fmt.Sprint(maxResults)) 3920 return c 3921} 3922 3923// PageToken sets the optional parameter "pageToken": Page token to 3924// retrieve a specific page of results in the list. 3925func (c *UsersHistoryListCall) PageToken(pageToken string) *UsersHistoryListCall { 3926 c.urlParams_.Set("pageToken", pageToken) 3927 return c 3928} 3929 3930// StartHistoryId sets the optional parameter "startHistoryId": 3931// Required. Returns history records after the specified 3932// `startHistoryId`. The supplied `startHistoryId` should be obtained 3933// from the `historyId` of a message, thread, or previous `list` 3934// response. History IDs increase chronologically but are not contiguous 3935// with random gaps in between valid IDs. Supplying an invalid or out of 3936// date `startHistoryId` typically returns an `HTTP 404` error code. A 3937// `historyId` is typically valid for at least a week, but in some rare 3938// circumstances may be valid for only a few hours. If you receive an 3939// `HTTP 404` error response, your application should perform a full 3940// sync. If you receive no `nextPageToken` in the response, there are no 3941// updates to retrieve and you can store the returned `historyId` for a 3942// future request. 3943func (c *UsersHistoryListCall) StartHistoryId(startHistoryId uint64) *UsersHistoryListCall { 3944 c.urlParams_.Set("startHistoryId", fmt.Sprint(startHistoryId)) 3945 return c 3946} 3947 3948// Fields allows partial responses to be retrieved. See 3949// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 3950// for more information. 3951func (c *UsersHistoryListCall) Fields(s ...googleapi.Field) *UsersHistoryListCall { 3952 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 3953 return c 3954} 3955 3956// IfNoneMatch sets the optional parameter which makes the operation 3957// fail if the object's ETag matches the given value. This is useful for 3958// getting updates only after the object has changed since the last 3959// request. Use googleapi.IsNotModified to check whether the response 3960// error from Do is the result of In-None-Match. 3961func (c *UsersHistoryListCall) IfNoneMatch(entityTag string) *UsersHistoryListCall { 3962 c.ifNoneMatch_ = entityTag 3963 return c 3964} 3965 3966// Context sets the context to be used in this call's Do method. Any 3967// pending HTTP request will be aborted if the provided context is 3968// canceled. 3969func (c *UsersHistoryListCall) Context(ctx context.Context) *UsersHistoryListCall { 3970 c.ctx_ = ctx 3971 return c 3972} 3973 3974// Header returns an http.Header that can be modified by the caller to 3975// add HTTP headers to the request. 3976func (c *UsersHistoryListCall) Header() http.Header { 3977 if c.header_ == nil { 3978 c.header_ = make(http.Header) 3979 } 3980 return c.header_ 3981} 3982 3983func (c *UsersHistoryListCall) doRequest(alt string) (*http.Response, error) { 3984 reqHeaders := make(http.Header) 3985 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20201124") 3986 for k, v := range c.header_ { 3987 reqHeaders[k] = v 3988 } 3989 reqHeaders.Set("User-Agent", c.s.userAgent()) 3990 if c.ifNoneMatch_ != "" { 3991 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 3992 } 3993 var body io.Reader = nil 3994 c.urlParams_.Set("alt", alt) 3995 c.urlParams_.Set("prettyPrint", "false") 3996 urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/history") 3997 urls += "?" + c.urlParams_.Encode() 3998 req, err := http.NewRequest("GET", urls, body) 3999 if err != nil { 4000 return nil, err 4001 } 4002 req.Header = reqHeaders 4003 googleapi.Expand(req.URL, map[string]string{ 4004 "userId": c.userId, 4005 }) 4006 return gensupport.SendRequest(c.ctx_, c.s.client, req) 4007} 4008 4009// Do executes the "gmail.users.history.list" call. 4010// Exactly one of *ListHistoryResponse or error will be non-nil. Any 4011// non-2xx status code is an error. Response headers are in either 4012// *ListHistoryResponse.ServerResponse.Header or (if a response was 4013// returned at all) in error.(*googleapi.Error).Header. Use 4014// googleapi.IsNotModified to check whether the returned error was 4015// because http.StatusNotModified was returned. 4016func (c *UsersHistoryListCall) Do(opts ...googleapi.CallOption) (*ListHistoryResponse, error) { 4017 gensupport.SetOptions(c.urlParams_, opts...) 4018 res, err := c.doRequest("json") 4019 if res != nil && res.StatusCode == http.StatusNotModified { 4020 if res.Body != nil { 4021 res.Body.Close() 4022 } 4023 return nil, &googleapi.Error{ 4024 Code: res.StatusCode, 4025 Header: res.Header, 4026 } 4027 } 4028 if err != nil { 4029 return nil, err 4030 } 4031 defer googleapi.CloseBody(res) 4032 if err := googleapi.CheckResponse(res); err != nil { 4033 return nil, err 4034 } 4035 ret := &ListHistoryResponse{ 4036 ServerResponse: googleapi.ServerResponse{ 4037 Header: res.Header, 4038 HTTPStatusCode: res.StatusCode, 4039 }, 4040 } 4041 target := &ret 4042 if err := gensupport.DecodeResponse(target, res); err != nil { 4043 return nil, err 4044 } 4045 return ret, nil 4046 // { 4047 // "description": "Lists the history of all changes to the given mailbox. History results are returned in chronological order (increasing `historyId`).", 4048 // "flatPath": "gmail/v1/users/{userId}/history", 4049 // "httpMethod": "GET", 4050 // "id": "gmail.users.history.list", 4051 // "parameterOrder": [ 4052 // "userId" 4053 // ], 4054 // "parameters": { 4055 // "historyTypes": { 4056 // "description": "History types to be returned by the function", 4057 // "enum": [ 4058 // "messageAdded", 4059 // "messageDeleted", 4060 // "labelAdded", 4061 // "labelRemoved" 4062 // ], 4063 // "enumDescriptions": [ 4064 // "", 4065 // "", 4066 // "", 4067 // "" 4068 // ], 4069 // "location": "query", 4070 // "repeated": true, 4071 // "type": "string" 4072 // }, 4073 // "labelId": { 4074 // "description": "Only return messages with a label matching the ID.", 4075 // "location": "query", 4076 // "type": "string" 4077 // }, 4078 // "maxResults": { 4079 // "default": "100", 4080 // "description": "The maximum number of history records to return.", 4081 // "format": "uint32", 4082 // "location": "query", 4083 // "type": "integer" 4084 // }, 4085 // "pageToken": { 4086 // "description": "Page token to retrieve a specific page of results in the list.", 4087 // "location": "query", 4088 // "type": "string" 4089 // }, 4090 // "startHistoryId": { 4091 // "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.", 4092 // "format": "uint64", 4093 // "location": "query", 4094 // "type": "string" 4095 // }, 4096 // "userId": { 4097 // "default": "me", 4098 // "description": "The user's email address. The special value `me` can be used to indicate the authenticated user.", 4099 // "location": "path", 4100 // "required": true, 4101 // "type": "string" 4102 // } 4103 // }, 4104 // "path": "gmail/v1/users/{userId}/history", 4105 // "response": { 4106 // "$ref": "ListHistoryResponse" 4107 // }, 4108 // "scopes": [ 4109 // "https://mail.google.com/", 4110 // "https://www.googleapis.com/auth/gmail.metadata", 4111 // "https://www.googleapis.com/auth/gmail.modify", 4112 // "https://www.googleapis.com/auth/gmail.readonly" 4113 // ] 4114 // } 4115 4116} 4117 4118// Pages invokes f for each page of results. 4119// A non-nil error returned from f will halt the iteration. 4120// The provided context supersedes any context provided to the Context method. 4121func (c *UsersHistoryListCall) Pages(ctx context.Context, f func(*ListHistoryResponse) error) error { 4122 c.ctx_ = ctx 4123 defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point 4124 for { 4125 x, err := c.Do() 4126 if err != nil { 4127 return err 4128 } 4129 if err := f(x); err != nil { 4130 return err 4131 } 4132 if x.NextPageToken == "" { 4133 return nil 4134 } 4135 c.PageToken(x.NextPageToken) 4136 } 4137} 4138 4139// method id "gmail.users.labels.create": 4140 4141type UsersLabelsCreateCall struct { 4142 s *Service 4143 userId string 4144 label *Label 4145 urlParams_ gensupport.URLParams 4146 ctx_ context.Context 4147 header_ http.Header 4148} 4149 4150// Create: Creates a new label. 4151func (r *UsersLabelsService) Create(userId string, label *Label) *UsersLabelsCreateCall { 4152 c := &UsersLabelsCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)} 4153 c.userId = userId 4154 c.label = label 4155 return c 4156} 4157 4158// Fields allows partial responses to be retrieved. See 4159// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 4160// for more information. 4161func (c *UsersLabelsCreateCall) Fields(s ...googleapi.Field) *UsersLabelsCreateCall { 4162 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 4163 return c 4164} 4165 4166// Context sets the context to be used in this call's Do method. Any 4167// pending HTTP request will be aborted if the provided context is 4168// canceled. 4169func (c *UsersLabelsCreateCall) Context(ctx context.Context) *UsersLabelsCreateCall { 4170 c.ctx_ = ctx 4171 return c 4172} 4173 4174// Header returns an http.Header that can be modified by the caller to 4175// add HTTP headers to the request. 4176func (c *UsersLabelsCreateCall) Header() http.Header { 4177 if c.header_ == nil { 4178 c.header_ = make(http.Header) 4179 } 4180 return c.header_ 4181} 4182 4183func (c *UsersLabelsCreateCall) doRequest(alt string) (*http.Response, error) { 4184 reqHeaders := make(http.Header) 4185 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20201124") 4186 for k, v := range c.header_ { 4187 reqHeaders[k] = v 4188 } 4189 reqHeaders.Set("User-Agent", c.s.userAgent()) 4190 var body io.Reader = nil 4191 body, err := googleapi.WithoutDataWrapper.JSONReader(c.label) 4192 if err != nil { 4193 return nil, err 4194 } 4195 reqHeaders.Set("Content-Type", "application/json") 4196 c.urlParams_.Set("alt", alt) 4197 c.urlParams_.Set("prettyPrint", "false") 4198 urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/labels") 4199 urls += "?" + c.urlParams_.Encode() 4200 req, err := http.NewRequest("POST", urls, body) 4201 if err != nil { 4202 return nil, err 4203 } 4204 req.Header = reqHeaders 4205 googleapi.Expand(req.URL, map[string]string{ 4206 "userId": c.userId, 4207 }) 4208 return gensupport.SendRequest(c.ctx_, c.s.client, req) 4209} 4210 4211// Do executes the "gmail.users.labels.create" call. 4212// Exactly one of *Label or error will be non-nil. Any non-2xx status 4213// code is an error. Response headers are in either 4214// *Label.ServerResponse.Header or (if a response was returned at all) 4215// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 4216// check whether the returned error was because http.StatusNotModified 4217// was returned. 4218func (c *UsersLabelsCreateCall) Do(opts ...googleapi.CallOption) (*Label, error) { 4219 gensupport.SetOptions(c.urlParams_, opts...) 4220 res, err := c.doRequest("json") 4221 if res != nil && res.StatusCode == http.StatusNotModified { 4222 if res.Body != nil { 4223 res.Body.Close() 4224 } 4225 return nil, &googleapi.Error{ 4226 Code: res.StatusCode, 4227 Header: res.Header, 4228 } 4229 } 4230 if err != nil { 4231 return nil, err 4232 } 4233 defer googleapi.CloseBody(res) 4234 if err := googleapi.CheckResponse(res); err != nil { 4235 return nil, err 4236 } 4237 ret := &Label{ 4238 ServerResponse: googleapi.ServerResponse{ 4239 Header: res.Header, 4240 HTTPStatusCode: res.StatusCode, 4241 }, 4242 } 4243 target := &ret 4244 if err := gensupport.DecodeResponse(target, res); err != nil { 4245 return nil, err 4246 } 4247 return ret, nil 4248 // { 4249 // "description": "Creates a new label.", 4250 // "flatPath": "gmail/v1/users/{userId}/labels", 4251 // "httpMethod": "POST", 4252 // "id": "gmail.users.labels.create", 4253 // "parameterOrder": [ 4254 // "userId" 4255 // ], 4256 // "parameters": { 4257 // "userId": { 4258 // "default": "me", 4259 // "description": "The user's email address. The special value `me` can be used to indicate the authenticated user.", 4260 // "location": "path", 4261 // "required": true, 4262 // "type": "string" 4263 // } 4264 // }, 4265 // "path": "gmail/v1/users/{userId}/labels", 4266 // "request": { 4267 // "$ref": "Label" 4268 // }, 4269 // "response": { 4270 // "$ref": "Label" 4271 // }, 4272 // "scopes": [ 4273 // "https://mail.google.com/", 4274 // "https://www.googleapis.com/auth/gmail.labels", 4275 // "https://www.googleapis.com/auth/gmail.modify" 4276 // ] 4277 // } 4278 4279} 4280 4281// method id "gmail.users.labels.delete": 4282 4283type UsersLabelsDeleteCall struct { 4284 s *Service 4285 userId string 4286 id string 4287 urlParams_ gensupport.URLParams 4288 ctx_ context.Context 4289 header_ http.Header 4290} 4291 4292// Delete: Immediately and permanently deletes the specified label and 4293// removes it from any messages and threads that it is applied to. 4294func (r *UsersLabelsService) Delete(userId string, id string) *UsersLabelsDeleteCall { 4295 c := &UsersLabelsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)} 4296 c.userId = userId 4297 c.id = id 4298 return c 4299} 4300 4301// Fields allows partial responses to be retrieved. See 4302// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 4303// for more information. 4304func (c *UsersLabelsDeleteCall) Fields(s ...googleapi.Field) *UsersLabelsDeleteCall { 4305 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 4306 return c 4307} 4308 4309// Context sets the context to be used in this call's Do method. Any 4310// pending HTTP request will be aborted if the provided context is 4311// canceled. 4312func (c *UsersLabelsDeleteCall) Context(ctx context.Context) *UsersLabelsDeleteCall { 4313 c.ctx_ = ctx 4314 return c 4315} 4316 4317// Header returns an http.Header that can be modified by the caller to 4318// add HTTP headers to the request. 4319func (c *UsersLabelsDeleteCall) Header() http.Header { 4320 if c.header_ == nil { 4321 c.header_ = make(http.Header) 4322 } 4323 return c.header_ 4324} 4325 4326func (c *UsersLabelsDeleteCall) doRequest(alt string) (*http.Response, error) { 4327 reqHeaders := make(http.Header) 4328 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20201124") 4329 for k, v := range c.header_ { 4330 reqHeaders[k] = v 4331 } 4332 reqHeaders.Set("User-Agent", c.s.userAgent()) 4333 var body io.Reader = nil 4334 c.urlParams_.Set("alt", alt) 4335 c.urlParams_.Set("prettyPrint", "false") 4336 urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/labels/{id}") 4337 urls += "?" + c.urlParams_.Encode() 4338 req, err := http.NewRequest("DELETE", urls, body) 4339 if err != nil { 4340 return nil, err 4341 } 4342 req.Header = reqHeaders 4343 googleapi.Expand(req.URL, map[string]string{ 4344 "userId": c.userId, 4345 "id": c.id, 4346 }) 4347 return gensupport.SendRequest(c.ctx_, c.s.client, req) 4348} 4349 4350// Do executes the "gmail.users.labels.delete" call. 4351func (c *UsersLabelsDeleteCall) Do(opts ...googleapi.CallOption) error { 4352 gensupport.SetOptions(c.urlParams_, opts...) 4353 res, err := c.doRequest("json") 4354 if err != nil { 4355 return err 4356 } 4357 defer googleapi.CloseBody(res) 4358 if err := googleapi.CheckResponse(res); err != nil { 4359 return err 4360 } 4361 return nil 4362 // { 4363 // "description": "Immediately and permanently deletes the specified label and removes it from any messages and threads that it is applied to.", 4364 // "flatPath": "gmail/v1/users/{userId}/labels/{id}", 4365 // "httpMethod": "DELETE", 4366 // "id": "gmail.users.labels.delete", 4367 // "parameterOrder": [ 4368 // "userId", 4369 // "id" 4370 // ], 4371 // "parameters": { 4372 // "id": { 4373 // "description": "The ID of the label to delete.", 4374 // "location": "path", 4375 // "required": true, 4376 // "type": "string" 4377 // }, 4378 // "userId": { 4379 // "default": "me", 4380 // "description": "The user's email address. The special value `me` can be used to indicate the authenticated user.", 4381 // "location": "path", 4382 // "required": true, 4383 // "type": "string" 4384 // } 4385 // }, 4386 // "path": "gmail/v1/users/{userId}/labels/{id}", 4387 // "scopes": [ 4388 // "https://mail.google.com/", 4389 // "https://www.googleapis.com/auth/gmail.labels", 4390 // "https://www.googleapis.com/auth/gmail.modify" 4391 // ] 4392 // } 4393 4394} 4395 4396// method id "gmail.users.labels.get": 4397 4398type UsersLabelsGetCall struct { 4399 s *Service 4400 userId string 4401 id string 4402 urlParams_ gensupport.URLParams 4403 ifNoneMatch_ string 4404 ctx_ context.Context 4405 header_ http.Header 4406} 4407 4408// Get: Gets the specified label. 4409func (r *UsersLabelsService) Get(userId string, id string) *UsersLabelsGetCall { 4410 c := &UsersLabelsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)} 4411 c.userId = userId 4412 c.id = id 4413 return c 4414} 4415 4416// Fields allows partial responses to be retrieved. See 4417// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 4418// for more information. 4419func (c *UsersLabelsGetCall) Fields(s ...googleapi.Field) *UsersLabelsGetCall { 4420 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 4421 return c 4422} 4423 4424// IfNoneMatch sets the optional parameter which makes the operation 4425// fail if the object's ETag matches the given value. This is useful for 4426// getting updates only after the object has changed since the last 4427// request. Use googleapi.IsNotModified to check whether the response 4428// error from Do is the result of In-None-Match. 4429func (c *UsersLabelsGetCall) IfNoneMatch(entityTag string) *UsersLabelsGetCall { 4430 c.ifNoneMatch_ = entityTag 4431 return c 4432} 4433 4434// Context sets the context to be used in this call's Do method. Any 4435// pending HTTP request will be aborted if the provided context is 4436// canceled. 4437func (c *UsersLabelsGetCall) Context(ctx context.Context) *UsersLabelsGetCall { 4438 c.ctx_ = ctx 4439 return c 4440} 4441 4442// Header returns an http.Header that can be modified by the caller to 4443// add HTTP headers to the request. 4444func (c *UsersLabelsGetCall) Header() http.Header { 4445 if c.header_ == nil { 4446 c.header_ = make(http.Header) 4447 } 4448 return c.header_ 4449} 4450 4451func (c *UsersLabelsGetCall) doRequest(alt string) (*http.Response, error) { 4452 reqHeaders := make(http.Header) 4453 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20201124") 4454 for k, v := range c.header_ { 4455 reqHeaders[k] = v 4456 } 4457 reqHeaders.Set("User-Agent", c.s.userAgent()) 4458 if c.ifNoneMatch_ != "" { 4459 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 4460 } 4461 var body io.Reader = nil 4462 c.urlParams_.Set("alt", alt) 4463 c.urlParams_.Set("prettyPrint", "false") 4464 urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/labels/{id}") 4465 urls += "?" + c.urlParams_.Encode() 4466 req, err := http.NewRequest("GET", urls, body) 4467 if err != nil { 4468 return nil, err 4469 } 4470 req.Header = reqHeaders 4471 googleapi.Expand(req.URL, map[string]string{ 4472 "userId": c.userId, 4473 "id": c.id, 4474 }) 4475 return gensupport.SendRequest(c.ctx_, c.s.client, req) 4476} 4477 4478// Do executes the "gmail.users.labels.get" call. 4479// Exactly one of *Label or error will be non-nil. Any non-2xx status 4480// code is an error. Response headers are in either 4481// *Label.ServerResponse.Header or (if a response was returned at all) 4482// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 4483// check whether the returned error was because http.StatusNotModified 4484// was returned. 4485func (c *UsersLabelsGetCall) Do(opts ...googleapi.CallOption) (*Label, error) { 4486 gensupport.SetOptions(c.urlParams_, opts...) 4487 res, err := c.doRequest("json") 4488 if res != nil && res.StatusCode == http.StatusNotModified { 4489 if res.Body != nil { 4490 res.Body.Close() 4491 } 4492 return nil, &googleapi.Error{ 4493 Code: res.StatusCode, 4494 Header: res.Header, 4495 } 4496 } 4497 if err != nil { 4498 return nil, err 4499 } 4500 defer googleapi.CloseBody(res) 4501 if err := googleapi.CheckResponse(res); err != nil { 4502 return nil, err 4503 } 4504 ret := &Label{ 4505 ServerResponse: googleapi.ServerResponse{ 4506 Header: res.Header, 4507 HTTPStatusCode: res.StatusCode, 4508 }, 4509 } 4510 target := &ret 4511 if err := gensupport.DecodeResponse(target, res); err != nil { 4512 return nil, err 4513 } 4514 return ret, nil 4515 // { 4516 // "description": "Gets the specified label.", 4517 // "flatPath": "gmail/v1/users/{userId}/labels/{id}", 4518 // "httpMethod": "GET", 4519 // "id": "gmail.users.labels.get", 4520 // "parameterOrder": [ 4521 // "userId", 4522 // "id" 4523 // ], 4524 // "parameters": { 4525 // "id": { 4526 // "description": "The ID of the label to retrieve.", 4527 // "location": "path", 4528 // "required": true, 4529 // "type": "string" 4530 // }, 4531 // "userId": { 4532 // "default": "me", 4533 // "description": "The user's email address. The special value `me` can be used to indicate the authenticated user.", 4534 // "location": "path", 4535 // "required": true, 4536 // "type": "string" 4537 // } 4538 // }, 4539 // "path": "gmail/v1/users/{userId}/labels/{id}", 4540 // "response": { 4541 // "$ref": "Label" 4542 // }, 4543 // "scopes": [ 4544 // "https://mail.google.com/", 4545 // "https://www.googleapis.com/auth/gmail.labels", 4546 // "https://www.googleapis.com/auth/gmail.metadata", 4547 // "https://www.googleapis.com/auth/gmail.modify", 4548 // "https://www.googleapis.com/auth/gmail.readonly" 4549 // ] 4550 // } 4551 4552} 4553 4554// method id "gmail.users.labels.list": 4555 4556type UsersLabelsListCall struct { 4557 s *Service 4558 userId string 4559 urlParams_ gensupport.URLParams 4560 ifNoneMatch_ string 4561 ctx_ context.Context 4562 header_ http.Header 4563} 4564 4565// List: Lists all labels in the user's mailbox. 4566func (r *UsersLabelsService) List(userId string) *UsersLabelsListCall { 4567 c := &UsersLabelsListCall{s: r.s, urlParams_: make(gensupport.URLParams)} 4568 c.userId = userId 4569 return c 4570} 4571 4572// Fields allows partial responses to be retrieved. See 4573// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 4574// for more information. 4575func (c *UsersLabelsListCall) Fields(s ...googleapi.Field) *UsersLabelsListCall { 4576 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 4577 return c 4578} 4579 4580// IfNoneMatch sets the optional parameter which makes the operation 4581// fail if the object's ETag matches the given value. This is useful for 4582// getting updates only after the object has changed since the last 4583// request. Use googleapi.IsNotModified to check whether the response 4584// error from Do is the result of In-None-Match. 4585func (c *UsersLabelsListCall) IfNoneMatch(entityTag string) *UsersLabelsListCall { 4586 c.ifNoneMatch_ = entityTag 4587 return c 4588} 4589 4590// Context sets the context to be used in this call's Do method. Any 4591// pending HTTP request will be aborted if the provided context is 4592// canceled. 4593func (c *UsersLabelsListCall) Context(ctx context.Context) *UsersLabelsListCall { 4594 c.ctx_ = ctx 4595 return c 4596} 4597 4598// Header returns an http.Header that can be modified by the caller to 4599// add HTTP headers to the request. 4600func (c *UsersLabelsListCall) Header() http.Header { 4601 if c.header_ == nil { 4602 c.header_ = make(http.Header) 4603 } 4604 return c.header_ 4605} 4606 4607func (c *UsersLabelsListCall) doRequest(alt string) (*http.Response, error) { 4608 reqHeaders := make(http.Header) 4609 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20201124") 4610 for k, v := range c.header_ { 4611 reqHeaders[k] = v 4612 } 4613 reqHeaders.Set("User-Agent", c.s.userAgent()) 4614 if c.ifNoneMatch_ != "" { 4615 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 4616 } 4617 var body io.Reader = nil 4618 c.urlParams_.Set("alt", alt) 4619 c.urlParams_.Set("prettyPrint", "false") 4620 urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/labels") 4621 urls += "?" + c.urlParams_.Encode() 4622 req, err := http.NewRequest("GET", urls, body) 4623 if err != nil { 4624 return nil, err 4625 } 4626 req.Header = reqHeaders 4627 googleapi.Expand(req.URL, map[string]string{ 4628 "userId": c.userId, 4629 }) 4630 return gensupport.SendRequest(c.ctx_, c.s.client, req) 4631} 4632 4633// Do executes the "gmail.users.labels.list" call. 4634// Exactly one of *ListLabelsResponse or error will be non-nil. Any 4635// non-2xx status code is an error. Response headers are in either 4636// *ListLabelsResponse.ServerResponse.Header or (if a response was 4637// returned at all) in error.(*googleapi.Error).Header. Use 4638// googleapi.IsNotModified to check whether the returned error was 4639// because http.StatusNotModified was returned. 4640func (c *UsersLabelsListCall) Do(opts ...googleapi.CallOption) (*ListLabelsResponse, error) { 4641 gensupport.SetOptions(c.urlParams_, opts...) 4642 res, err := c.doRequest("json") 4643 if res != nil && res.StatusCode == http.StatusNotModified { 4644 if res.Body != nil { 4645 res.Body.Close() 4646 } 4647 return nil, &googleapi.Error{ 4648 Code: res.StatusCode, 4649 Header: res.Header, 4650 } 4651 } 4652 if err != nil { 4653 return nil, err 4654 } 4655 defer googleapi.CloseBody(res) 4656 if err := googleapi.CheckResponse(res); err != nil { 4657 return nil, err 4658 } 4659 ret := &ListLabelsResponse{ 4660 ServerResponse: googleapi.ServerResponse{ 4661 Header: res.Header, 4662 HTTPStatusCode: res.StatusCode, 4663 }, 4664 } 4665 target := &ret 4666 if err := gensupport.DecodeResponse(target, res); err != nil { 4667 return nil, err 4668 } 4669 return ret, nil 4670 // { 4671 // "description": "Lists all labels in the user's mailbox.", 4672 // "flatPath": "gmail/v1/users/{userId}/labels", 4673 // "httpMethod": "GET", 4674 // "id": "gmail.users.labels.list", 4675 // "parameterOrder": [ 4676 // "userId" 4677 // ], 4678 // "parameters": { 4679 // "userId": { 4680 // "default": "me", 4681 // "description": "The user's email address. The special value `me` can be used to indicate the authenticated user.", 4682 // "location": "path", 4683 // "required": true, 4684 // "type": "string" 4685 // } 4686 // }, 4687 // "path": "gmail/v1/users/{userId}/labels", 4688 // "response": { 4689 // "$ref": "ListLabelsResponse" 4690 // }, 4691 // "scopes": [ 4692 // "https://mail.google.com/", 4693 // "https://www.googleapis.com/auth/gmail.labels", 4694 // "https://www.googleapis.com/auth/gmail.metadata", 4695 // "https://www.googleapis.com/auth/gmail.modify", 4696 // "https://www.googleapis.com/auth/gmail.readonly" 4697 // ] 4698 // } 4699 4700} 4701 4702// method id "gmail.users.labels.patch": 4703 4704type UsersLabelsPatchCall struct { 4705 s *Service 4706 userId string 4707 id string 4708 label *Label 4709 urlParams_ gensupport.URLParams 4710 ctx_ context.Context 4711 header_ http.Header 4712} 4713 4714// Patch: Patch the specified label. 4715func (r *UsersLabelsService) Patch(userId string, id string, label *Label) *UsersLabelsPatchCall { 4716 c := &UsersLabelsPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)} 4717 c.userId = userId 4718 c.id = id 4719 c.label = label 4720 return c 4721} 4722 4723// Fields allows partial responses to be retrieved. See 4724// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 4725// for more information. 4726func (c *UsersLabelsPatchCall) Fields(s ...googleapi.Field) *UsersLabelsPatchCall { 4727 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 4728 return c 4729} 4730 4731// Context sets the context to be used in this call's Do method. Any 4732// pending HTTP request will be aborted if the provided context is 4733// canceled. 4734func (c *UsersLabelsPatchCall) Context(ctx context.Context) *UsersLabelsPatchCall { 4735 c.ctx_ = ctx 4736 return c 4737} 4738 4739// Header returns an http.Header that can be modified by the caller to 4740// add HTTP headers to the request. 4741func (c *UsersLabelsPatchCall) Header() http.Header { 4742 if c.header_ == nil { 4743 c.header_ = make(http.Header) 4744 } 4745 return c.header_ 4746} 4747 4748func (c *UsersLabelsPatchCall) doRequest(alt string) (*http.Response, error) { 4749 reqHeaders := make(http.Header) 4750 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20201124") 4751 for k, v := range c.header_ { 4752 reqHeaders[k] = v 4753 } 4754 reqHeaders.Set("User-Agent", c.s.userAgent()) 4755 var body io.Reader = nil 4756 body, err := googleapi.WithoutDataWrapper.JSONReader(c.label) 4757 if err != nil { 4758 return nil, err 4759 } 4760 reqHeaders.Set("Content-Type", "application/json") 4761 c.urlParams_.Set("alt", alt) 4762 c.urlParams_.Set("prettyPrint", "false") 4763 urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/labels/{id}") 4764 urls += "?" + c.urlParams_.Encode() 4765 req, err := http.NewRequest("PATCH", urls, body) 4766 if err != nil { 4767 return nil, err 4768 } 4769 req.Header = reqHeaders 4770 googleapi.Expand(req.URL, map[string]string{ 4771 "userId": c.userId, 4772 "id": c.id, 4773 }) 4774 return gensupport.SendRequest(c.ctx_, c.s.client, req) 4775} 4776 4777// Do executes the "gmail.users.labels.patch" call. 4778// Exactly one of *Label or error will be non-nil. Any non-2xx status 4779// code is an error. Response headers are in either 4780// *Label.ServerResponse.Header or (if a response was returned at all) 4781// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 4782// check whether the returned error was because http.StatusNotModified 4783// was returned. 4784func (c *UsersLabelsPatchCall) Do(opts ...googleapi.CallOption) (*Label, error) { 4785 gensupport.SetOptions(c.urlParams_, opts...) 4786 res, err := c.doRequest("json") 4787 if res != nil && res.StatusCode == http.StatusNotModified { 4788 if res.Body != nil { 4789 res.Body.Close() 4790 } 4791 return nil, &googleapi.Error{ 4792 Code: res.StatusCode, 4793 Header: res.Header, 4794 } 4795 } 4796 if err != nil { 4797 return nil, err 4798 } 4799 defer googleapi.CloseBody(res) 4800 if err := googleapi.CheckResponse(res); err != nil { 4801 return nil, err 4802 } 4803 ret := &Label{ 4804 ServerResponse: googleapi.ServerResponse{ 4805 Header: res.Header, 4806 HTTPStatusCode: res.StatusCode, 4807 }, 4808 } 4809 target := &ret 4810 if err := gensupport.DecodeResponse(target, res); err != nil { 4811 return nil, err 4812 } 4813 return ret, nil 4814 // { 4815 // "description": "Patch the specified label.", 4816 // "flatPath": "gmail/v1/users/{userId}/labels/{id}", 4817 // "httpMethod": "PATCH", 4818 // "id": "gmail.users.labels.patch", 4819 // "parameterOrder": [ 4820 // "userId", 4821 // "id" 4822 // ], 4823 // "parameters": { 4824 // "id": { 4825 // "description": "The ID of the label to update.", 4826 // "location": "path", 4827 // "required": true, 4828 // "type": "string" 4829 // }, 4830 // "userId": { 4831 // "default": "me", 4832 // "description": "The user's email address. The special value `me` can be used to indicate the authenticated user.", 4833 // "location": "path", 4834 // "required": true, 4835 // "type": "string" 4836 // } 4837 // }, 4838 // "path": "gmail/v1/users/{userId}/labels/{id}", 4839 // "request": { 4840 // "$ref": "Label" 4841 // }, 4842 // "response": { 4843 // "$ref": "Label" 4844 // }, 4845 // "scopes": [ 4846 // "https://mail.google.com/", 4847 // "https://www.googleapis.com/auth/gmail.labels", 4848 // "https://www.googleapis.com/auth/gmail.modify" 4849 // ] 4850 // } 4851 4852} 4853 4854// method id "gmail.users.labels.update": 4855 4856type UsersLabelsUpdateCall struct { 4857 s *Service 4858 userId string 4859 id string 4860 label *Label 4861 urlParams_ gensupport.URLParams 4862 ctx_ context.Context 4863 header_ http.Header 4864} 4865 4866// Update: Updates the specified label. 4867func (r *UsersLabelsService) Update(userId string, id string, label *Label) *UsersLabelsUpdateCall { 4868 c := &UsersLabelsUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)} 4869 c.userId = userId 4870 c.id = id 4871 c.label = label 4872 return c 4873} 4874 4875// Fields allows partial responses to be retrieved. See 4876// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 4877// for more information. 4878func (c *UsersLabelsUpdateCall) Fields(s ...googleapi.Field) *UsersLabelsUpdateCall { 4879 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 4880 return c 4881} 4882 4883// Context sets the context to be used in this call's Do method. Any 4884// pending HTTP request will be aborted if the provided context is 4885// canceled. 4886func (c *UsersLabelsUpdateCall) Context(ctx context.Context) *UsersLabelsUpdateCall { 4887 c.ctx_ = ctx 4888 return c 4889} 4890 4891// Header returns an http.Header that can be modified by the caller to 4892// add HTTP headers to the request. 4893func (c *UsersLabelsUpdateCall) Header() http.Header { 4894 if c.header_ == nil { 4895 c.header_ = make(http.Header) 4896 } 4897 return c.header_ 4898} 4899 4900func (c *UsersLabelsUpdateCall) doRequest(alt string) (*http.Response, error) { 4901 reqHeaders := make(http.Header) 4902 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20201124") 4903 for k, v := range c.header_ { 4904 reqHeaders[k] = v 4905 } 4906 reqHeaders.Set("User-Agent", c.s.userAgent()) 4907 var body io.Reader = nil 4908 body, err := googleapi.WithoutDataWrapper.JSONReader(c.label) 4909 if err != nil { 4910 return nil, err 4911 } 4912 reqHeaders.Set("Content-Type", "application/json") 4913 c.urlParams_.Set("alt", alt) 4914 c.urlParams_.Set("prettyPrint", "false") 4915 urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/labels/{id}") 4916 urls += "?" + c.urlParams_.Encode() 4917 req, err := http.NewRequest("PUT", urls, body) 4918 if err != nil { 4919 return nil, err 4920 } 4921 req.Header = reqHeaders 4922 googleapi.Expand(req.URL, map[string]string{ 4923 "userId": c.userId, 4924 "id": c.id, 4925 }) 4926 return gensupport.SendRequest(c.ctx_, c.s.client, req) 4927} 4928 4929// Do executes the "gmail.users.labels.update" call. 4930// Exactly one of *Label or error will be non-nil. Any non-2xx status 4931// code is an error. Response headers are in either 4932// *Label.ServerResponse.Header or (if a response was returned at all) 4933// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 4934// check whether the returned error was because http.StatusNotModified 4935// was returned. 4936func (c *UsersLabelsUpdateCall) Do(opts ...googleapi.CallOption) (*Label, error) { 4937 gensupport.SetOptions(c.urlParams_, opts...) 4938 res, err := c.doRequest("json") 4939 if res != nil && res.StatusCode == http.StatusNotModified { 4940 if res.Body != nil { 4941 res.Body.Close() 4942 } 4943 return nil, &googleapi.Error{ 4944 Code: res.StatusCode, 4945 Header: res.Header, 4946 } 4947 } 4948 if err != nil { 4949 return nil, err 4950 } 4951 defer googleapi.CloseBody(res) 4952 if err := googleapi.CheckResponse(res); err != nil { 4953 return nil, err 4954 } 4955 ret := &Label{ 4956 ServerResponse: googleapi.ServerResponse{ 4957 Header: res.Header, 4958 HTTPStatusCode: res.StatusCode, 4959 }, 4960 } 4961 target := &ret 4962 if err := gensupport.DecodeResponse(target, res); err != nil { 4963 return nil, err 4964 } 4965 return ret, nil 4966 // { 4967 // "description": "Updates the specified label.", 4968 // "flatPath": "gmail/v1/users/{userId}/labels/{id}", 4969 // "httpMethod": "PUT", 4970 // "id": "gmail.users.labels.update", 4971 // "parameterOrder": [ 4972 // "userId", 4973 // "id" 4974 // ], 4975 // "parameters": { 4976 // "id": { 4977 // "description": "The ID of the label to update.", 4978 // "location": "path", 4979 // "required": true, 4980 // "type": "string" 4981 // }, 4982 // "userId": { 4983 // "default": "me", 4984 // "description": "The user's email address. The special value `me` can be used to indicate the authenticated user.", 4985 // "location": "path", 4986 // "required": true, 4987 // "type": "string" 4988 // } 4989 // }, 4990 // "path": "gmail/v1/users/{userId}/labels/{id}", 4991 // "request": { 4992 // "$ref": "Label" 4993 // }, 4994 // "response": { 4995 // "$ref": "Label" 4996 // }, 4997 // "scopes": [ 4998 // "https://mail.google.com/", 4999 // "https://www.googleapis.com/auth/gmail.labels", 5000 // "https://www.googleapis.com/auth/gmail.modify" 5001 // ] 5002 // } 5003 5004} 5005 5006// method id "gmail.users.messages.batchDelete": 5007 5008type UsersMessagesBatchDeleteCall struct { 5009 s *Service 5010 userId string 5011 batchdeletemessagesrequest *BatchDeleteMessagesRequest 5012 urlParams_ gensupport.URLParams 5013 ctx_ context.Context 5014 header_ http.Header 5015} 5016 5017// BatchDelete: Deletes many messages by message ID. Provides no 5018// guarantees that messages were not already deleted or even existed at 5019// all. 5020func (r *UsersMessagesService) BatchDelete(userId string, batchdeletemessagesrequest *BatchDeleteMessagesRequest) *UsersMessagesBatchDeleteCall { 5021 c := &UsersMessagesBatchDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)} 5022 c.userId = userId 5023 c.batchdeletemessagesrequest = batchdeletemessagesrequest 5024 return c 5025} 5026 5027// Fields allows partial responses to be retrieved. See 5028// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 5029// for more information. 5030func (c *UsersMessagesBatchDeleteCall) Fields(s ...googleapi.Field) *UsersMessagesBatchDeleteCall { 5031 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 5032 return c 5033} 5034 5035// Context sets the context to be used in this call's Do method. Any 5036// pending HTTP request will be aborted if the provided context is 5037// canceled. 5038func (c *UsersMessagesBatchDeleteCall) Context(ctx context.Context) *UsersMessagesBatchDeleteCall { 5039 c.ctx_ = ctx 5040 return c 5041} 5042 5043// Header returns an http.Header that can be modified by the caller to 5044// add HTTP headers to the request. 5045func (c *UsersMessagesBatchDeleteCall) Header() http.Header { 5046 if c.header_ == nil { 5047 c.header_ = make(http.Header) 5048 } 5049 return c.header_ 5050} 5051 5052func (c *UsersMessagesBatchDeleteCall) doRequest(alt string) (*http.Response, error) { 5053 reqHeaders := make(http.Header) 5054 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20201124") 5055 for k, v := range c.header_ { 5056 reqHeaders[k] = v 5057 } 5058 reqHeaders.Set("User-Agent", c.s.userAgent()) 5059 var body io.Reader = nil 5060 body, err := googleapi.WithoutDataWrapper.JSONReader(c.batchdeletemessagesrequest) 5061 if err != nil { 5062 return nil, err 5063 } 5064 reqHeaders.Set("Content-Type", "application/json") 5065 c.urlParams_.Set("alt", alt) 5066 c.urlParams_.Set("prettyPrint", "false") 5067 urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/messages/batchDelete") 5068 urls += "?" + c.urlParams_.Encode() 5069 req, err := http.NewRequest("POST", urls, body) 5070 if err != nil { 5071 return nil, err 5072 } 5073 req.Header = reqHeaders 5074 googleapi.Expand(req.URL, map[string]string{ 5075 "userId": c.userId, 5076 }) 5077 return gensupport.SendRequest(c.ctx_, c.s.client, req) 5078} 5079 5080// Do executes the "gmail.users.messages.batchDelete" call. 5081func (c *UsersMessagesBatchDeleteCall) Do(opts ...googleapi.CallOption) error { 5082 gensupport.SetOptions(c.urlParams_, opts...) 5083 res, err := c.doRequest("json") 5084 if err != nil { 5085 return err 5086 } 5087 defer googleapi.CloseBody(res) 5088 if err := googleapi.CheckResponse(res); err != nil { 5089 return err 5090 } 5091 return nil 5092 // { 5093 // "description": "Deletes many messages by message ID. Provides no guarantees that messages were not already deleted or even existed at all.", 5094 // "flatPath": "gmail/v1/users/{userId}/messages/batchDelete", 5095 // "httpMethod": "POST", 5096 // "id": "gmail.users.messages.batchDelete", 5097 // "parameterOrder": [ 5098 // "userId" 5099 // ], 5100 // "parameters": { 5101 // "userId": { 5102 // "default": "me", 5103 // "description": "The user's email address. The special value `me` can be used to indicate the authenticated user.", 5104 // "location": "path", 5105 // "required": true, 5106 // "type": "string" 5107 // } 5108 // }, 5109 // "path": "gmail/v1/users/{userId}/messages/batchDelete", 5110 // "request": { 5111 // "$ref": "BatchDeleteMessagesRequest" 5112 // }, 5113 // "scopes": [ 5114 // "https://mail.google.com/" 5115 // ] 5116 // } 5117 5118} 5119 5120// method id "gmail.users.messages.batchModify": 5121 5122type UsersMessagesBatchModifyCall struct { 5123 s *Service 5124 userId string 5125 batchmodifymessagesrequest *BatchModifyMessagesRequest 5126 urlParams_ gensupport.URLParams 5127 ctx_ context.Context 5128 header_ http.Header 5129} 5130 5131// BatchModify: Modifies the labels on the specified messages. 5132func (r *UsersMessagesService) BatchModify(userId string, batchmodifymessagesrequest *BatchModifyMessagesRequest) *UsersMessagesBatchModifyCall { 5133 c := &UsersMessagesBatchModifyCall{s: r.s, urlParams_: make(gensupport.URLParams)} 5134 c.userId = userId 5135 c.batchmodifymessagesrequest = batchmodifymessagesrequest 5136 return c 5137} 5138 5139// Fields allows partial responses to be retrieved. See 5140// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 5141// for more information. 5142func (c *UsersMessagesBatchModifyCall) Fields(s ...googleapi.Field) *UsersMessagesBatchModifyCall { 5143 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 5144 return c 5145} 5146 5147// Context sets the context to be used in this call's Do method. Any 5148// pending HTTP request will be aborted if the provided context is 5149// canceled. 5150func (c *UsersMessagesBatchModifyCall) Context(ctx context.Context) *UsersMessagesBatchModifyCall { 5151 c.ctx_ = ctx 5152 return c 5153} 5154 5155// Header returns an http.Header that can be modified by the caller to 5156// add HTTP headers to the request. 5157func (c *UsersMessagesBatchModifyCall) Header() http.Header { 5158 if c.header_ == nil { 5159 c.header_ = make(http.Header) 5160 } 5161 return c.header_ 5162} 5163 5164func (c *UsersMessagesBatchModifyCall) doRequest(alt string) (*http.Response, error) { 5165 reqHeaders := make(http.Header) 5166 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20201124") 5167 for k, v := range c.header_ { 5168 reqHeaders[k] = v 5169 } 5170 reqHeaders.Set("User-Agent", c.s.userAgent()) 5171 var body io.Reader = nil 5172 body, err := googleapi.WithoutDataWrapper.JSONReader(c.batchmodifymessagesrequest) 5173 if err != nil { 5174 return nil, err 5175 } 5176 reqHeaders.Set("Content-Type", "application/json") 5177 c.urlParams_.Set("alt", alt) 5178 c.urlParams_.Set("prettyPrint", "false") 5179 urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/messages/batchModify") 5180 urls += "?" + c.urlParams_.Encode() 5181 req, err := http.NewRequest("POST", urls, body) 5182 if err != nil { 5183 return nil, err 5184 } 5185 req.Header = reqHeaders 5186 googleapi.Expand(req.URL, map[string]string{ 5187 "userId": c.userId, 5188 }) 5189 return gensupport.SendRequest(c.ctx_, c.s.client, req) 5190} 5191 5192// Do executes the "gmail.users.messages.batchModify" call. 5193func (c *UsersMessagesBatchModifyCall) Do(opts ...googleapi.CallOption) error { 5194 gensupport.SetOptions(c.urlParams_, opts...) 5195 res, err := c.doRequest("json") 5196 if err != nil { 5197 return err 5198 } 5199 defer googleapi.CloseBody(res) 5200 if err := googleapi.CheckResponse(res); err != nil { 5201 return err 5202 } 5203 return nil 5204 // { 5205 // "description": "Modifies the labels on the specified messages.", 5206 // "flatPath": "gmail/v1/users/{userId}/messages/batchModify", 5207 // "httpMethod": "POST", 5208 // "id": "gmail.users.messages.batchModify", 5209 // "parameterOrder": [ 5210 // "userId" 5211 // ], 5212 // "parameters": { 5213 // "userId": { 5214 // "default": "me", 5215 // "description": "The user's email address. The special value `me` can be used to indicate the authenticated user.", 5216 // "location": "path", 5217 // "required": true, 5218 // "type": "string" 5219 // } 5220 // }, 5221 // "path": "gmail/v1/users/{userId}/messages/batchModify", 5222 // "request": { 5223 // "$ref": "BatchModifyMessagesRequest" 5224 // }, 5225 // "scopes": [ 5226 // "https://mail.google.com/", 5227 // "https://www.googleapis.com/auth/gmail.modify" 5228 // ] 5229 // } 5230 5231} 5232 5233// method id "gmail.users.messages.delete": 5234 5235type UsersMessagesDeleteCall struct { 5236 s *Service 5237 userId string 5238 id string 5239 urlParams_ gensupport.URLParams 5240 ctx_ context.Context 5241 header_ http.Header 5242} 5243 5244// Delete: Immediately and permanently deletes the specified message. 5245// This operation cannot be undone. Prefer `messages.trash` instead. 5246func (r *UsersMessagesService) Delete(userId string, id string) *UsersMessagesDeleteCall { 5247 c := &UsersMessagesDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)} 5248 c.userId = userId 5249 c.id = id 5250 return c 5251} 5252 5253// Fields allows partial responses to be retrieved. See 5254// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 5255// for more information. 5256func (c *UsersMessagesDeleteCall) Fields(s ...googleapi.Field) *UsersMessagesDeleteCall { 5257 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 5258 return c 5259} 5260 5261// Context sets the context to be used in this call's Do method. Any 5262// pending HTTP request will be aborted if the provided context is 5263// canceled. 5264func (c *UsersMessagesDeleteCall) Context(ctx context.Context) *UsersMessagesDeleteCall { 5265 c.ctx_ = ctx 5266 return c 5267} 5268 5269// Header returns an http.Header that can be modified by the caller to 5270// add HTTP headers to the request. 5271func (c *UsersMessagesDeleteCall) Header() http.Header { 5272 if c.header_ == nil { 5273 c.header_ = make(http.Header) 5274 } 5275 return c.header_ 5276} 5277 5278func (c *UsersMessagesDeleteCall) doRequest(alt string) (*http.Response, error) { 5279 reqHeaders := make(http.Header) 5280 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20201124") 5281 for k, v := range c.header_ { 5282 reqHeaders[k] = v 5283 } 5284 reqHeaders.Set("User-Agent", c.s.userAgent()) 5285 var body io.Reader = nil 5286 c.urlParams_.Set("alt", alt) 5287 c.urlParams_.Set("prettyPrint", "false") 5288 urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/messages/{id}") 5289 urls += "?" + c.urlParams_.Encode() 5290 req, err := http.NewRequest("DELETE", urls, body) 5291 if err != nil { 5292 return nil, err 5293 } 5294 req.Header = reqHeaders 5295 googleapi.Expand(req.URL, map[string]string{ 5296 "userId": c.userId, 5297 "id": c.id, 5298 }) 5299 return gensupport.SendRequest(c.ctx_, c.s.client, req) 5300} 5301 5302// Do executes the "gmail.users.messages.delete" call. 5303func (c *UsersMessagesDeleteCall) Do(opts ...googleapi.CallOption) error { 5304 gensupport.SetOptions(c.urlParams_, opts...) 5305 res, err := c.doRequest("json") 5306 if err != nil { 5307 return err 5308 } 5309 defer googleapi.CloseBody(res) 5310 if err := googleapi.CheckResponse(res); err != nil { 5311 return err 5312 } 5313 return nil 5314 // { 5315 // "description": "Immediately and permanently deletes the specified message. This operation cannot be undone. Prefer `messages.trash` instead.", 5316 // "flatPath": "gmail/v1/users/{userId}/messages/{id}", 5317 // "httpMethod": "DELETE", 5318 // "id": "gmail.users.messages.delete", 5319 // "parameterOrder": [ 5320 // "userId", 5321 // "id" 5322 // ], 5323 // "parameters": { 5324 // "id": { 5325 // "description": "The ID of the message to delete.", 5326 // "location": "path", 5327 // "required": true, 5328 // "type": "string" 5329 // }, 5330 // "userId": { 5331 // "default": "me", 5332 // "description": "The user's email address. The special value `me` can be used to indicate the authenticated user.", 5333 // "location": "path", 5334 // "required": true, 5335 // "type": "string" 5336 // } 5337 // }, 5338 // "path": "gmail/v1/users/{userId}/messages/{id}", 5339 // "scopes": [ 5340 // "https://mail.google.com/" 5341 // ] 5342 // } 5343 5344} 5345 5346// method id "gmail.users.messages.get": 5347 5348type UsersMessagesGetCall struct { 5349 s *Service 5350 userId string 5351 id string 5352 urlParams_ gensupport.URLParams 5353 ifNoneMatch_ string 5354 ctx_ context.Context 5355 header_ http.Header 5356} 5357 5358// Get: Gets the specified message. 5359func (r *UsersMessagesService) Get(userId string, id string) *UsersMessagesGetCall { 5360 c := &UsersMessagesGetCall{s: r.s, urlParams_: make(gensupport.URLParams)} 5361 c.userId = userId 5362 c.id = id 5363 return c 5364} 5365 5366// Format sets the optional parameter "format": The format to return the 5367// message in. 5368// 5369// Possible values: 5370// "minimal" - Returns only email message ID and labels; does not 5371// return the email headers, body, or payload. 5372// "full" (default) - Returns the full email message data with body 5373// content parsed in the `payload` field; the `raw` field is not used. 5374// Format cannot be used when accessing the api using the gmail.metadata 5375// scope. 5376// "raw" - Returns the full email message data with body content in 5377// the `raw` field as a base64url encoded string; the `payload` field is 5378// not used. Format cannot be used when accessing the api using the 5379// gmail.metadata scope. 5380// "metadata" - Returns only email message ID, labels, and email 5381// headers. 5382func (c *UsersMessagesGetCall) Format(format string) *UsersMessagesGetCall { 5383 c.urlParams_.Set("format", format) 5384 return c 5385} 5386 5387// MetadataHeaders sets the optional parameter "metadataHeaders": When 5388// given and format is `METADATA`, only include headers specified. 5389func (c *UsersMessagesGetCall) MetadataHeaders(metadataHeaders ...string) *UsersMessagesGetCall { 5390 c.urlParams_.SetMulti("metadataHeaders", append([]string{}, metadataHeaders...)) 5391 return c 5392} 5393 5394// Fields allows partial responses to be retrieved. See 5395// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 5396// for more information. 5397func (c *UsersMessagesGetCall) Fields(s ...googleapi.Field) *UsersMessagesGetCall { 5398 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 5399 return c 5400} 5401 5402// IfNoneMatch sets the optional parameter which makes the operation 5403// fail if the object's ETag matches the given value. This is useful for 5404// getting updates only after the object has changed since the last 5405// request. Use googleapi.IsNotModified to check whether the response 5406// error from Do is the result of In-None-Match. 5407func (c *UsersMessagesGetCall) IfNoneMatch(entityTag string) *UsersMessagesGetCall { 5408 c.ifNoneMatch_ = entityTag 5409 return c 5410} 5411 5412// Context sets the context to be used in this call's Do method. Any 5413// pending HTTP request will be aborted if the provided context is 5414// canceled. 5415func (c *UsersMessagesGetCall) Context(ctx context.Context) *UsersMessagesGetCall { 5416 c.ctx_ = ctx 5417 return c 5418} 5419 5420// Header returns an http.Header that can be modified by the caller to 5421// add HTTP headers to the request. 5422func (c *UsersMessagesGetCall) Header() http.Header { 5423 if c.header_ == nil { 5424 c.header_ = make(http.Header) 5425 } 5426 return c.header_ 5427} 5428 5429func (c *UsersMessagesGetCall) doRequest(alt string) (*http.Response, error) { 5430 reqHeaders := make(http.Header) 5431 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20201124") 5432 for k, v := range c.header_ { 5433 reqHeaders[k] = v 5434 } 5435 reqHeaders.Set("User-Agent", c.s.userAgent()) 5436 if c.ifNoneMatch_ != "" { 5437 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 5438 } 5439 var body io.Reader = nil 5440 c.urlParams_.Set("alt", alt) 5441 c.urlParams_.Set("prettyPrint", "false") 5442 urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/messages/{id}") 5443 urls += "?" + c.urlParams_.Encode() 5444 req, err := http.NewRequest("GET", urls, body) 5445 if err != nil { 5446 return nil, err 5447 } 5448 req.Header = reqHeaders 5449 googleapi.Expand(req.URL, map[string]string{ 5450 "userId": c.userId, 5451 "id": c.id, 5452 }) 5453 return gensupport.SendRequest(c.ctx_, c.s.client, req) 5454} 5455 5456// Do executes the "gmail.users.messages.get" call. 5457// Exactly one of *Message or error will be non-nil. Any non-2xx status 5458// code is an error. Response headers are in either 5459// *Message.ServerResponse.Header or (if a response was returned at all) 5460// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 5461// check whether the returned error was because http.StatusNotModified 5462// was returned. 5463func (c *UsersMessagesGetCall) Do(opts ...googleapi.CallOption) (*Message, error) { 5464 gensupport.SetOptions(c.urlParams_, opts...) 5465 res, err := c.doRequest("json") 5466 if res != nil && res.StatusCode == http.StatusNotModified { 5467 if res.Body != nil { 5468 res.Body.Close() 5469 } 5470 return nil, &googleapi.Error{ 5471 Code: res.StatusCode, 5472 Header: res.Header, 5473 } 5474 } 5475 if err != nil { 5476 return nil, err 5477 } 5478 defer googleapi.CloseBody(res) 5479 if err := googleapi.CheckResponse(res); err != nil { 5480 return nil, err 5481 } 5482 ret := &Message{ 5483 ServerResponse: googleapi.ServerResponse{ 5484 Header: res.Header, 5485 HTTPStatusCode: res.StatusCode, 5486 }, 5487 } 5488 target := &ret 5489 if err := gensupport.DecodeResponse(target, res); err != nil { 5490 return nil, err 5491 } 5492 return ret, nil 5493 // { 5494 // "description": "Gets the specified message.", 5495 // "flatPath": "gmail/v1/users/{userId}/messages/{id}", 5496 // "httpMethod": "GET", 5497 // "id": "gmail.users.messages.get", 5498 // "parameterOrder": [ 5499 // "userId", 5500 // "id" 5501 // ], 5502 // "parameters": { 5503 // "format": { 5504 // "default": "full", 5505 // "description": "The format to return the message in.", 5506 // "enum": [ 5507 // "minimal", 5508 // "full", 5509 // "raw", 5510 // "metadata" 5511 // ], 5512 // "enumDescriptions": [ 5513 // "Returns only email message ID and labels; does not return the email headers, body, or payload.", 5514 // "Returns the full email message data with body content parsed in the `payload` field; the `raw` field is not used. Format cannot be used when accessing the api using the gmail.metadata scope.", 5515 // "Returns the full email message data with body content in the `raw` field as a base64url encoded string; the `payload` field is not used. Format cannot be used when accessing the api using the gmail.metadata scope.", 5516 // "Returns only email message ID, labels, and email headers." 5517 // ], 5518 // "location": "query", 5519 // "type": "string" 5520 // }, 5521 // "id": { 5522 // "description": "The ID of the message to retrieve.", 5523 // "location": "path", 5524 // "required": true, 5525 // "type": "string" 5526 // }, 5527 // "metadataHeaders": { 5528 // "description": "When given and format is `METADATA`, only include headers specified.", 5529 // "location": "query", 5530 // "repeated": true, 5531 // "type": "string" 5532 // }, 5533 // "userId": { 5534 // "default": "me", 5535 // "description": "The user's email address. The special value `me` can be used to indicate the authenticated user.", 5536 // "location": "path", 5537 // "required": true, 5538 // "type": "string" 5539 // } 5540 // }, 5541 // "path": "gmail/v1/users/{userId}/messages/{id}", 5542 // "response": { 5543 // "$ref": "Message" 5544 // }, 5545 // "scopes": [ 5546 // "https://mail.google.com/", 5547 // "https://www.googleapis.com/auth/gmail.addons.current.message.action", 5548 // "https://www.googleapis.com/auth/gmail.addons.current.message.metadata", 5549 // "https://www.googleapis.com/auth/gmail.addons.current.message.readonly", 5550 // "https://www.googleapis.com/auth/gmail.metadata", 5551 // "https://www.googleapis.com/auth/gmail.modify", 5552 // "https://www.googleapis.com/auth/gmail.readonly" 5553 // ] 5554 // } 5555 5556} 5557 5558// method id "gmail.users.messages.import": 5559 5560type UsersMessagesImportCall struct { 5561 s *Service 5562 userId string 5563 message *Message 5564 urlParams_ gensupport.URLParams 5565 mediaInfo_ *gensupport.MediaInfo 5566 ctx_ context.Context 5567 header_ http.Header 5568} 5569 5570// Import: Imports a message into only this user's mailbox, with 5571// standard email delivery scanning and classification similar to 5572// receiving via SMTP. Does not send a message. Note: This function 5573// doesn't trigger forwarding rules or filters set up by the user. 5574func (r *UsersMessagesService) Import(userId string, message *Message) *UsersMessagesImportCall { 5575 c := &UsersMessagesImportCall{s: r.s, urlParams_: make(gensupport.URLParams)} 5576 c.userId = userId 5577 c.message = message 5578 return c 5579} 5580 5581// Deleted sets the optional parameter "deleted": Mark the email as 5582// permanently deleted (not TRASH) and only visible in Google Vault to a 5583// Vault administrator. Only used for G Suite accounts. 5584func (c *UsersMessagesImportCall) Deleted(deleted bool) *UsersMessagesImportCall { 5585 c.urlParams_.Set("deleted", fmt.Sprint(deleted)) 5586 return c 5587} 5588 5589// InternalDateSource sets the optional parameter "internalDateSource": 5590// Source for Gmail's internal date of the message. 5591// 5592// Possible values: 5593// "receivedTime" - Internal message date set to current time when 5594// received by Gmail. 5595// "dateHeader" (default) - Internal message time based on 'Date' 5596// header in email, when valid. 5597func (c *UsersMessagesImportCall) InternalDateSource(internalDateSource string) *UsersMessagesImportCall { 5598 c.urlParams_.Set("internalDateSource", internalDateSource) 5599 return c 5600} 5601 5602// NeverMarkSpam sets the optional parameter "neverMarkSpam": Ignore the 5603// Gmail spam classifier decision and never mark this email as SPAM in 5604// the mailbox. 5605func (c *UsersMessagesImportCall) NeverMarkSpam(neverMarkSpam bool) *UsersMessagesImportCall { 5606 c.urlParams_.Set("neverMarkSpam", fmt.Sprint(neverMarkSpam)) 5607 return c 5608} 5609 5610// ProcessForCalendar sets the optional parameter "processForCalendar": 5611// Process calendar invites in the email and add any extracted meetings 5612// to the Google Calendar for this user. 5613func (c *UsersMessagesImportCall) ProcessForCalendar(processForCalendar bool) *UsersMessagesImportCall { 5614 c.urlParams_.Set("processForCalendar", fmt.Sprint(processForCalendar)) 5615 return c 5616} 5617 5618// Media specifies the media to upload in one or more chunks. The chunk 5619// size may be controlled by supplying a MediaOption generated by 5620// googleapi.ChunkSize. The chunk size defaults to 5621// googleapi.DefaultUploadChunkSize.The Content-Type header used in the 5622// upload request will be determined by sniffing the contents of r, 5623// unless a MediaOption generated by googleapi.ContentType is 5624// supplied. 5625// At most one of Media and ResumableMedia may be set. 5626func (c *UsersMessagesImportCall) Media(r io.Reader, options ...googleapi.MediaOption) *UsersMessagesImportCall { 5627 c.mediaInfo_ = gensupport.NewInfoFromMedia(r, options) 5628 return c 5629} 5630 5631// ResumableMedia specifies the media to upload in chunks and can be 5632// canceled with ctx. 5633// 5634// Deprecated: use Media instead. 5635// 5636// At most one of Media and ResumableMedia may be set. mediaType 5637// identifies the MIME media type of the upload, such as "image/png". If 5638// mediaType is "", it will be auto-detected. The provided ctx will 5639// supersede any context previously provided to the Context method. 5640func (c *UsersMessagesImportCall) ResumableMedia(ctx context.Context, r io.ReaderAt, size int64, mediaType string) *UsersMessagesImportCall { 5641 c.ctx_ = ctx 5642 c.mediaInfo_ = gensupport.NewInfoFromResumableMedia(r, size, mediaType) 5643 return c 5644} 5645 5646// ProgressUpdater provides a callback function that will be called 5647// after every chunk. It should be a low-latency function in order to 5648// not slow down the upload operation. This should only be called when 5649// using ResumableMedia (as opposed to Media). 5650func (c *UsersMessagesImportCall) ProgressUpdater(pu googleapi.ProgressUpdater) *UsersMessagesImportCall { 5651 c.mediaInfo_.SetProgressUpdater(pu) 5652 return c 5653} 5654 5655// Fields allows partial responses to be retrieved. See 5656// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 5657// for more information. 5658func (c *UsersMessagesImportCall) Fields(s ...googleapi.Field) *UsersMessagesImportCall { 5659 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 5660 return c 5661} 5662 5663// Context sets the context to be used in this call's Do method. Any 5664// pending HTTP request will be aborted if the provided context is 5665// canceled. 5666// This context will supersede any context previously provided to the 5667// ResumableMedia method. 5668func (c *UsersMessagesImportCall) Context(ctx context.Context) *UsersMessagesImportCall { 5669 c.ctx_ = ctx 5670 return c 5671} 5672 5673// Header returns an http.Header that can be modified by the caller to 5674// add HTTP headers to the request. 5675func (c *UsersMessagesImportCall) Header() http.Header { 5676 if c.header_ == nil { 5677 c.header_ = make(http.Header) 5678 } 5679 return c.header_ 5680} 5681 5682func (c *UsersMessagesImportCall) doRequest(alt string) (*http.Response, error) { 5683 reqHeaders := make(http.Header) 5684 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20201124") 5685 for k, v := range c.header_ { 5686 reqHeaders[k] = v 5687 } 5688 reqHeaders.Set("User-Agent", c.s.userAgent()) 5689 var body io.Reader = nil 5690 body, err := googleapi.WithoutDataWrapper.JSONReader(c.message) 5691 if err != nil { 5692 return nil, err 5693 } 5694 reqHeaders.Set("Content-Type", "application/json") 5695 c.urlParams_.Set("alt", alt) 5696 c.urlParams_.Set("prettyPrint", "false") 5697 urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/messages/import") 5698 if c.mediaInfo_ != nil { 5699 urls = googleapi.ResolveRelative(c.s.BasePath, "/upload/gmail/v1/users/{userId}/messages/import") 5700 c.urlParams_.Set("uploadType", c.mediaInfo_.UploadType()) 5701 } 5702 if body == nil { 5703 body = new(bytes.Buffer) 5704 reqHeaders.Set("Content-Type", "application/json") 5705 } 5706 body, getBody, cleanup := c.mediaInfo_.UploadRequest(reqHeaders, body) 5707 defer cleanup() 5708 urls += "?" + c.urlParams_.Encode() 5709 req, err := http.NewRequest("POST", urls, body) 5710 if err != nil { 5711 return nil, err 5712 } 5713 req.Header = reqHeaders 5714 req.GetBody = getBody 5715 googleapi.Expand(req.URL, map[string]string{ 5716 "userId": c.userId, 5717 }) 5718 return gensupport.SendRequest(c.ctx_, c.s.client, req) 5719} 5720 5721// Do executes the "gmail.users.messages.import" call. 5722// Exactly one of *Message or error will be non-nil. Any non-2xx status 5723// code is an error. Response headers are in either 5724// *Message.ServerResponse.Header or (if a response was returned at all) 5725// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 5726// check whether the returned error was because http.StatusNotModified 5727// was returned. 5728func (c *UsersMessagesImportCall) Do(opts ...googleapi.CallOption) (*Message, error) { 5729 gensupport.SetOptions(c.urlParams_, opts...) 5730 res, err := c.doRequest("json") 5731 if res != nil && res.StatusCode == http.StatusNotModified { 5732 if res.Body != nil { 5733 res.Body.Close() 5734 } 5735 return nil, &googleapi.Error{ 5736 Code: res.StatusCode, 5737 Header: res.Header, 5738 } 5739 } 5740 if err != nil { 5741 return nil, err 5742 } 5743 defer googleapi.CloseBody(res) 5744 if err := googleapi.CheckResponse(res); err != nil { 5745 return nil, err 5746 } 5747 rx := c.mediaInfo_.ResumableUpload(res.Header.Get("Location")) 5748 if rx != nil { 5749 rx.Client = c.s.client 5750 rx.UserAgent = c.s.userAgent() 5751 ctx := c.ctx_ 5752 if ctx == nil { 5753 ctx = context.TODO() 5754 } 5755 res, err = rx.Upload(ctx) 5756 if err != nil { 5757 return nil, err 5758 } 5759 defer res.Body.Close() 5760 if err := googleapi.CheckResponse(res); err != nil { 5761 return nil, err 5762 } 5763 } 5764 ret := &Message{ 5765 ServerResponse: googleapi.ServerResponse{ 5766 Header: res.Header, 5767 HTTPStatusCode: res.StatusCode, 5768 }, 5769 } 5770 target := &ret 5771 if err := gensupport.DecodeResponse(target, res); err != nil { 5772 return nil, err 5773 } 5774 return ret, nil 5775 // { 5776 // "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. Note: This function doesn't trigger forwarding rules or filters set up by the user.", 5777 // "flatPath": "gmail/v1/users/{userId}/messages/import", 5778 // "httpMethod": "POST", 5779 // "id": "gmail.users.messages.import", 5780 // "mediaUpload": { 5781 // "accept": [ 5782 // "message/*" 5783 // ], 5784 // "maxSize": "52428800", 5785 // "protocols": { 5786 // "resumable": { 5787 // "multipart": true, 5788 // "path": "/resumable/upload/gmail/v1/users/{userId}/messages/import" 5789 // }, 5790 // "simple": { 5791 // "multipart": true, 5792 // "path": "/upload/gmail/v1/users/{userId}/messages/import" 5793 // } 5794 // } 5795 // }, 5796 // "parameterOrder": [ 5797 // "userId" 5798 // ], 5799 // "parameters": { 5800 // "deleted": { 5801 // "default": "false", 5802 // "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.", 5803 // "location": "query", 5804 // "type": "boolean" 5805 // }, 5806 // "internalDateSource": { 5807 // "default": "dateHeader", 5808 // "description": "Source for Gmail's internal date of the message.", 5809 // "enum": [ 5810 // "receivedTime", 5811 // "dateHeader" 5812 // ], 5813 // "enumDescriptions": [ 5814 // "Internal message date set to current time when received by Gmail.", 5815 // "Internal message time based on 'Date' header in email, when valid." 5816 // ], 5817 // "location": "query", 5818 // "type": "string" 5819 // }, 5820 // "neverMarkSpam": { 5821 // "default": "false", 5822 // "description": "Ignore the Gmail spam classifier decision and never mark this email as SPAM in the mailbox.", 5823 // "location": "query", 5824 // "type": "boolean" 5825 // }, 5826 // "processForCalendar": { 5827 // "default": "false", 5828 // "description": "Process calendar invites in the email and add any extracted meetings to the Google Calendar for this user.", 5829 // "location": "query", 5830 // "type": "boolean" 5831 // }, 5832 // "userId": { 5833 // "default": "me", 5834 // "description": "The user's email address. The special value `me` can be used to indicate the authenticated user.", 5835 // "location": "path", 5836 // "required": true, 5837 // "type": "string" 5838 // } 5839 // }, 5840 // "path": "gmail/v1/users/{userId}/messages/import", 5841 // "request": { 5842 // "$ref": "Message" 5843 // }, 5844 // "response": { 5845 // "$ref": "Message" 5846 // }, 5847 // "scopes": [ 5848 // "https://mail.google.com/", 5849 // "https://www.googleapis.com/auth/gmail.insert", 5850 // "https://www.googleapis.com/auth/gmail.modify" 5851 // ], 5852 // "supportsMediaUpload": true 5853 // } 5854 5855} 5856 5857// method id "gmail.users.messages.insert": 5858 5859type UsersMessagesInsertCall struct { 5860 s *Service 5861 userId string 5862 message *Message 5863 urlParams_ gensupport.URLParams 5864 mediaInfo_ *gensupport.MediaInfo 5865 ctx_ context.Context 5866 header_ http.Header 5867} 5868 5869// Insert: Directly inserts a message into only this user's mailbox 5870// similar to `IMAP APPEND`, bypassing most scanning and classification. 5871// Does not send a message. 5872func (r *UsersMessagesService) Insert(userId string, message *Message) *UsersMessagesInsertCall { 5873 c := &UsersMessagesInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)} 5874 c.userId = userId 5875 c.message = message 5876 return c 5877} 5878 5879// Deleted sets the optional parameter "deleted": Mark the email as 5880// permanently deleted (not TRASH) and only visible in Google Vault to a 5881// Vault administrator. Only used for G Suite accounts. 5882func (c *UsersMessagesInsertCall) Deleted(deleted bool) *UsersMessagesInsertCall { 5883 c.urlParams_.Set("deleted", fmt.Sprint(deleted)) 5884 return c 5885} 5886 5887// InternalDateSource sets the optional parameter "internalDateSource": 5888// Source for Gmail's internal date of the message. 5889// 5890// Possible values: 5891// "receivedTime" (default) - Internal message date set to current 5892// time when received by Gmail. 5893// "dateHeader" - Internal message time based on 'Date' header in 5894// email, when valid. 5895func (c *UsersMessagesInsertCall) InternalDateSource(internalDateSource string) *UsersMessagesInsertCall { 5896 c.urlParams_.Set("internalDateSource", internalDateSource) 5897 return c 5898} 5899 5900// Media specifies the media to upload in one or more chunks. The chunk 5901// size may be controlled by supplying a MediaOption generated by 5902// googleapi.ChunkSize. The chunk size defaults to 5903// googleapi.DefaultUploadChunkSize.The Content-Type header used in the 5904// upload request will be determined by sniffing the contents of r, 5905// unless a MediaOption generated by googleapi.ContentType is 5906// supplied. 5907// At most one of Media and ResumableMedia may be set. 5908func (c *UsersMessagesInsertCall) Media(r io.Reader, options ...googleapi.MediaOption) *UsersMessagesInsertCall { 5909 c.mediaInfo_ = gensupport.NewInfoFromMedia(r, options) 5910 return c 5911} 5912 5913// ResumableMedia specifies the media to upload in chunks and can be 5914// canceled with ctx. 5915// 5916// Deprecated: use Media instead. 5917// 5918// At most one of Media and ResumableMedia may be set. mediaType 5919// identifies the MIME media type of the upload, such as "image/png". If 5920// mediaType is "", it will be auto-detected. The provided ctx will 5921// supersede any context previously provided to the Context method. 5922func (c *UsersMessagesInsertCall) ResumableMedia(ctx context.Context, r io.ReaderAt, size int64, mediaType string) *UsersMessagesInsertCall { 5923 c.ctx_ = ctx 5924 c.mediaInfo_ = gensupport.NewInfoFromResumableMedia(r, size, mediaType) 5925 return c 5926} 5927 5928// ProgressUpdater provides a callback function that will be called 5929// after every chunk. It should be a low-latency function in order to 5930// not slow down the upload operation. This should only be called when 5931// using ResumableMedia (as opposed to Media). 5932func (c *UsersMessagesInsertCall) ProgressUpdater(pu googleapi.ProgressUpdater) *UsersMessagesInsertCall { 5933 c.mediaInfo_.SetProgressUpdater(pu) 5934 return c 5935} 5936 5937// Fields allows partial responses to be retrieved. See 5938// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 5939// for more information. 5940func (c *UsersMessagesInsertCall) Fields(s ...googleapi.Field) *UsersMessagesInsertCall { 5941 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 5942 return c 5943} 5944 5945// Context sets the context to be used in this call's Do method. Any 5946// pending HTTP request will be aborted if the provided context is 5947// canceled. 5948// This context will supersede any context previously provided to the 5949// ResumableMedia method. 5950func (c *UsersMessagesInsertCall) Context(ctx context.Context) *UsersMessagesInsertCall { 5951 c.ctx_ = ctx 5952 return c 5953} 5954 5955// Header returns an http.Header that can be modified by the caller to 5956// add HTTP headers to the request. 5957func (c *UsersMessagesInsertCall) Header() http.Header { 5958 if c.header_ == nil { 5959 c.header_ = make(http.Header) 5960 } 5961 return c.header_ 5962} 5963 5964func (c *UsersMessagesInsertCall) doRequest(alt string) (*http.Response, error) { 5965 reqHeaders := make(http.Header) 5966 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20201124") 5967 for k, v := range c.header_ { 5968 reqHeaders[k] = v 5969 } 5970 reqHeaders.Set("User-Agent", c.s.userAgent()) 5971 var body io.Reader = nil 5972 body, err := googleapi.WithoutDataWrapper.JSONReader(c.message) 5973 if err != nil { 5974 return nil, err 5975 } 5976 reqHeaders.Set("Content-Type", "application/json") 5977 c.urlParams_.Set("alt", alt) 5978 c.urlParams_.Set("prettyPrint", "false") 5979 urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/messages") 5980 if c.mediaInfo_ != nil { 5981 urls = googleapi.ResolveRelative(c.s.BasePath, "/upload/gmail/v1/users/{userId}/messages") 5982 c.urlParams_.Set("uploadType", c.mediaInfo_.UploadType()) 5983 } 5984 if body == nil { 5985 body = new(bytes.Buffer) 5986 reqHeaders.Set("Content-Type", "application/json") 5987 } 5988 body, getBody, cleanup := c.mediaInfo_.UploadRequest(reqHeaders, body) 5989 defer cleanup() 5990 urls += "?" + c.urlParams_.Encode() 5991 req, err := http.NewRequest("POST", urls, body) 5992 if err != nil { 5993 return nil, err 5994 } 5995 req.Header = reqHeaders 5996 req.GetBody = getBody 5997 googleapi.Expand(req.URL, map[string]string{ 5998 "userId": c.userId, 5999 }) 6000 return gensupport.SendRequest(c.ctx_, c.s.client, req) 6001} 6002 6003// Do executes the "gmail.users.messages.insert" call. 6004// Exactly one of *Message or error will be non-nil. Any non-2xx status 6005// code is an error. Response headers are in either 6006// *Message.ServerResponse.Header or (if a response was returned at all) 6007// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 6008// check whether the returned error was because http.StatusNotModified 6009// was returned. 6010func (c *UsersMessagesInsertCall) Do(opts ...googleapi.CallOption) (*Message, error) { 6011 gensupport.SetOptions(c.urlParams_, opts...) 6012 res, err := c.doRequest("json") 6013 if res != nil && res.StatusCode == http.StatusNotModified { 6014 if res.Body != nil { 6015 res.Body.Close() 6016 } 6017 return nil, &googleapi.Error{ 6018 Code: res.StatusCode, 6019 Header: res.Header, 6020 } 6021 } 6022 if err != nil { 6023 return nil, err 6024 } 6025 defer googleapi.CloseBody(res) 6026 if err := googleapi.CheckResponse(res); err != nil { 6027 return nil, err 6028 } 6029 rx := c.mediaInfo_.ResumableUpload(res.Header.Get("Location")) 6030 if rx != nil { 6031 rx.Client = c.s.client 6032 rx.UserAgent = c.s.userAgent() 6033 ctx := c.ctx_ 6034 if ctx == nil { 6035 ctx = context.TODO() 6036 } 6037 res, err = rx.Upload(ctx) 6038 if err != nil { 6039 return nil, err 6040 } 6041 defer res.Body.Close() 6042 if err := googleapi.CheckResponse(res); err != nil { 6043 return nil, err 6044 } 6045 } 6046 ret := &Message{ 6047 ServerResponse: googleapi.ServerResponse{ 6048 Header: res.Header, 6049 HTTPStatusCode: res.StatusCode, 6050 }, 6051 } 6052 target := &ret 6053 if err := gensupport.DecodeResponse(target, res); err != nil { 6054 return nil, err 6055 } 6056 return ret, nil 6057 // { 6058 // "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.", 6059 // "flatPath": "gmail/v1/users/{userId}/messages", 6060 // "httpMethod": "POST", 6061 // "id": "gmail.users.messages.insert", 6062 // "mediaUpload": { 6063 // "accept": [ 6064 // "message/*" 6065 // ], 6066 // "maxSize": "52428800", 6067 // "protocols": { 6068 // "resumable": { 6069 // "multipart": true, 6070 // "path": "/resumable/upload/gmail/v1/users/{userId}/messages" 6071 // }, 6072 // "simple": { 6073 // "multipart": true, 6074 // "path": "/upload/gmail/v1/users/{userId}/messages" 6075 // } 6076 // } 6077 // }, 6078 // "parameterOrder": [ 6079 // "userId" 6080 // ], 6081 // "parameters": { 6082 // "deleted": { 6083 // "default": "false", 6084 // "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.", 6085 // "location": "query", 6086 // "type": "boolean" 6087 // }, 6088 // "internalDateSource": { 6089 // "default": "receivedTime", 6090 // "description": "Source for Gmail's internal date of the message.", 6091 // "enum": [ 6092 // "receivedTime", 6093 // "dateHeader" 6094 // ], 6095 // "enumDescriptions": [ 6096 // "Internal message date set to current time when received by Gmail.", 6097 // "Internal message time based on 'Date' header in email, when valid." 6098 // ], 6099 // "location": "query", 6100 // "type": "string" 6101 // }, 6102 // "userId": { 6103 // "default": "me", 6104 // "description": "The user's email address. The special value `me` can be used to indicate the authenticated user.", 6105 // "location": "path", 6106 // "required": true, 6107 // "type": "string" 6108 // } 6109 // }, 6110 // "path": "gmail/v1/users/{userId}/messages", 6111 // "request": { 6112 // "$ref": "Message" 6113 // }, 6114 // "response": { 6115 // "$ref": "Message" 6116 // }, 6117 // "scopes": [ 6118 // "https://mail.google.com/", 6119 // "https://www.googleapis.com/auth/gmail.insert", 6120 // "https://www.googleapis.com/auth/gmail.modify" 6121 // ], 6122 // "supportsMediaUpload": true 6123 // } 6124 6125} 6126 6127// method id "gmail.users.messages.list": 6128 6129type UsersMessagesListCall struct { 6130 s *Service 6131 userId string 6132 urlParams_ gensupport.URLParams 6133 ifNoneMatch_ string 6134 ctx_ context.Context 6135 header_ http.Header 6136} 6137 6138// List: Lists the messages in the user's mailbox. 6139func (r *UsersMessagesService) List(userId string) *UsersMessagesListCall { 6140 c := &UsersMessagesListCall{s: r.s, urlParams_: make(gensupport.URLParams)} 6141 c.userId = userId 6142 return c 6143} 6144 6145// IncludeSpamTrash sets the optional parameter "includeSpamTrash": 6146// Include messages from `SPAM` and `TRASH` in the results. 6147func (c *UsersMessagesListCall) IncludeSpamTrash(includeSpamTrash bool) *UsersMessagesListCall { 6148 c.urlParams_.Set("includeSpamTrash", fmt.Sprint(includeSpamTrash)) 6149 return c 6150} 6151 6152// LabelIds sets the optional parameter "labelIds": Only return messages 6153// with labels that match all of the specified label IDs. 6154func (c *UsersMessagesListCall) LabelIds(labelIds ...string) *UsersMessagesListCall { 6155 c.urlParams_.SetMulti("labelIds", append([]string{}, labelIds...)) 6156 return c 6157} 6158 6159// MaxResults sets the optional parameter "maxResults": Maximum number 6160// of messages to return. 6161func (c *UsersMessagesListCall) MaxResults(maxResults int64) *UsersMessagesListCall { 6162 c.urlParams_.Set("maxResults", fmt.Sprint(maxResults)) 6163 return c 6164} 6165 6166// PageToken sets the optional parameter "pageToken": Page token to 6167// retrieve a specific page of results in the list. 6168func (c *UsersMessagesListCall) PageToken(pageToken string) *UsersMessagesListCall { 6169 c.urlParams_.Set("pageToken", pageToken) 6170 return c 6171} 6172 6173// Q sets the optional parameter "q": Only return messages matching the 6174// specified query. Supports the same query format as the Gmail search 6175// box. For example, "from:someuser@example.com rfc822msgid: 6176// is:unread". Parameter cannot be used when accessing the api using 6177// the gmail.metadata scope. 6178func (c *UsersMessagesListCall) Q(q string) *UsersMessagesListCall { 6179 c.urlParams_.Set("q", q) 6180 return c 6181} 6182 6183// Fields allows partial responses to be retrieved. See 6184// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 6185// for more information. 6186func (c *UsersMessagesListCall) Fields(s ...googleapi.Field) *UsersMessagesListCall { 6187 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 6188 return c 6189} 6190 6191// IfNoneMatch sets the optional parameter which makes the operation 6192// fail if the object's ETag matches the given value. This is useful for 6193// getting updates only after the object has changed since the last 6194// request. Use googleapi.IsNotModified to check whether the response 6195// error from Do is the result of In-None-Match. 6196func (c *UsersMessagesListCall) IfNoneMatch(entityTag string) *UsersMessagesListCall { 6197 c.ifNoneMatch_ = entityTag 6198 return c 6199} 6200 6201// Context sets the context to be used in this call's Do method. Any 6202// pending HTTP request will be aborted if the provided context is 6203// canceled. 6204func (c *UsersMessagesListCall) Context(ctx context.Context) *UsersMessagesListCall { 6205 c.ctx_ = ctx 6206 return c 6207} 6208 6209// Header returns an http.Header that can be modified by the caller to 6210// add HTTP headers to the request. 6211func (c *UsersMessagesListCall) Header() http.Header { 6212 if c.header_ == nil { 6213 c.header_ = make(http.Header) 6214 } 6215 return c.header_ 6216} 6217 6218func (c *UsersMessagesListCall) doRequest(alt string) (*http.Response, error) { 6219 reqHeaders := make(http.Header) 6220 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20201124") 6221 for k, v := range c.header_ { 6222 reqHeaders[k] = v 6223 } 6224 reqHeaders.Set("User-Agent", c.s.userAgent()) 6225 if c.ifNoneMatch_ != "" { 6226 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 6227 } 6228 var body io.Reader = nil 6229 c.urlParams_.Set("alt", alt) 6230 c.urlParams_.Set("prettyPrint", "false") 6231 urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/messages") 6232 urls += "?" + c.urlParams_.Encode() 6233 req, err := http.NewRequest("GET", urls, body) 6234 if err != nil { 6235 return nil, err 6236 } 6237 req.Header = reqHeaders 6238 googleapi.Expand(req.URL, map[string]string{ 6239 "userId": c.userId, 6240 }) 6241 return gensupport.SendRequest(c.ctx_, c.s.client, req) 6242} 6243 6244// Do executes the "gmail.users.messages.list" call. 6245// Exactly one of *ListMessagesResponse or error will be non-nil. Any 6246// non-2xx status code is an error. Response headers are in either 6247// *ListMessagesResponse.ServerResponse.Header or (if a response was 6248// returned at all) in error.(*googleapi.Error).Header. Use 6249// googleapi.IsNotModified to check whether the returned error was 6250// because http.StatusNotModified was returned. 6251func (c *UsersMessagesListCall) Do(opts ...googleapi.CallOption) (*ListMessagesResponse, error) { 6252 gensupport.SetOptions(c.urlParams_, opts...) 6253 res, err := c.doRequest("json") 6254 if res != nil && res.StatusCode == http.StatusNotModified { 6255 if res.Body != nil { 6256 res.Body.Close() 6257 } 6258 return nil, &googleapi.Error{ 6259 Code: res.StatusCode, 6260 Header: res.Header, 6261 } 6262 } 6263 if err != nil { 6264 return nil, err 6265 } 6266 defer googleapi.CloseBody(res) 6267 if err := googleapi.CheckResponse(res); err != nil { 6268 return nil, err 6269 } 6270 ret := &ListMessagesResponse{ 6271 ServerResponse: googleapi.ServerResponse{ 6272 Header: res.Header, 6273 HTTPStatusCode: res.StatusCode, 6274 }, 6275 } 6276 target := &ret 6277 if err := gensupport.DecodeResponse(target, res); err != nil { 6278 return nil, err 6279 } 6280 return ret, nil 6281 // { 6282 // "description": "Lists the messages in the user's mailbox.", 6283 // "flatPath": "gmail/v1/users/{userId}/messages", 6284 // "httpMethod": "GET", 6285 // "id": "gmail.users.messages.list", 6286 // "parameterOrder": [ 6287 // "userId" 6288 // ], 6289 // "parameters": { 6290 // "includeSpamTrash": { 6291 // "default": "false", 6292 // "description": "Include messages from `SPAM` and `TRASH` in the results.", 6293 // "location": "query", 6294 // "type": "boolean" 6295 // }, 6296 // "labelIds": { 6297 // "description": "Only return messages with labels that match all of the specified label IDs.", 6298 // "location": "query", 6299 // "repeated": true, 6300 // "type": "string" 6301 // }, 6302 // "maxResults": { 6303 // "default": "100", 6304 // "description": "Maximum number of messages to return.", 6305 // "format": "uint32", 6306 // "location": "query", 6307 // "type": "integer" 6308 // }, 6309 // "pageToken": { 6310 // "description": "Page token to retrieve a specific page of results in the list.", 6311 // "location": "query", 6312 // "type": "string" 6313 // }, 6314 // "q": { 6315 // "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: is:unread\"`. Parameter cannot be used when accessing the api using the gmail.metadata scope.", 6316 // "location": "query", 6317 // "type": "string" 6318 // }, 6319 // "userId": { 6320 // "default": "me", 6321 // "description": "The user's email address. The special value `me` can be used to indicate the authenticated user.", 6322 // "location": "path", 6323 // "required": true, 6324 // "type": "string" 6325 // } 6326 // }, 6327 // "path": "gmail/v1/users/{userId}/messages", 6328 // "response": { 6329 // "$ref": "ListMessagesResponse" 6330 // }, 6331 // "scopes": [ 6332 // "https://mail.google.com/", 6333 // "https://www.googleapis.com/auth/gmail.metadata", 6334 // "https://www.googleapis.com/auth/gmail.modify", 6335 // "https://www.googleapis.com/auth/gmail.readonly" 6336 // ] 6337 // } 6338 6339} 6340 6341// Pages invokes f for each page of results. 6342// A non-nil error returned from f will halt the iteration. 6343// The provided context supersedes any context provided to the Context method. 6344func (c *UsersMessagesListCall) Pages(ctx context.Context, f func(*ListMessagesResponse) error) error { 6345 c.ctx_ = ctx 6346 defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point 6347 for { 6348 x, err := c.Do() 6349 if err != nil { 6350 return err 6351 } 6352 if err := f(x); err != nil { 6353 return err 6354 } 6355 if x.NextPageToken == "" { 6356 return nil 6357 } 6358 c.PageToken(x.NextPageToken) 6359 } 6360} 6361 6362// method id "gmail.users.messages.modify": 6363 6364type UsersMessagesModifyCall struct { 6365 s *Service 6366 userId string 6367 id string 6368 modifymessagerequest *ModifyMessageRequest 6369 urlParams_ gensupport.URLParams 6370 ctx_ context.Context 6371 header_ http.Header 6372} 6373 6374// Modify: Modifies the labels on the specified message. 6375func (r *UsersMessagesService) Modify(userId string, id string, modifymessagerequest *ModifyMessageRequest) *UsersMessagesModifyCall { 6376 c := &UsersMessagesModifyCall{s: r.s, urlParams_: make(gensupport.URLParams)} 6377 c.userId = userId 6378 c.id = id 6379 c.modifymessagerequest = modifymessagerequest 6380 return c 6381} 6382 6383// Fields allows partial responses to be retrieved. See 6384// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 6385// for more information. 6386func (c *UsersMessagesModifyCall) Fields(s ...googleapi.Field) *UsersMessagesModifyCall { 6387 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 6388 return c 6389} 6390 6391// Context sets the context to be used in this call's Do method. Any 6392// pending HTTP request will be aborted if the provided context is 6393// canceled. 6394func (c *UsersMessagesModifyCall) Context(ctx context.Context) *UsersMessagesModifyCall { 6395 c.ctx_ = ctx 6396 return c 6397} 6398 6399// Header returns an http.Header that can be modified by the caller to 6400// add HTTP headers to the request. 6401func (c *UsersMessagesModifyCall) Header() http.Header { 6402 if c.header_ == nil { 6403 c.header_ = make(http.Header) 6404 } 6405 return c.header_ 6406} 6407 6408func (c *UsersMessagesModifyCall) doRequest(alt string) (*http.Response, error) { 6409 reqHeaders := make(http.Header) 6410 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20201124") 6411 for k, v := range c.header_ { 6412 reqHeaders[k] = v 6413 } 6414 reqHeaders.Set("User-Agent", c.s.userAgent()) 6415 var body io.Reader = nil 6416 body, err := googleapi.WithoutDataWrapper.JSONReader(c.modifymessagerequest) 6417 if err != nil { 6418 return nil, err 6419 } 6420 reqHeaders.Set("Content-Type", "application/json") 6421 c.urlParams_.Set("alt", alt) 6422 c.urlParams_.Set("prettyPrint", "false") 6423 urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/messages/{id}/modify") 6424 urls += "?" + c.urlParams_.Encode() 6425 req, err := http.NewRequest("POST", urls, body) 6426 if err != nil { 6427 return nil, err 6428 } 6429 req.Header = reqHeaders 6430 googleapi.Expand(req.URL, map[string]string{ 6431 "userId": c.userId, 6432 "id": c.id, 6433 }) 6434 return gensupport.SendRequest(c.ctx_, c.s.client, req) 6435} 6436 6437// Do executes the "gmail.users.messages.modify" call. 6438// Exactly one of *Message or error will be non-nil. Any non-2xx status 6439// code is an error. Response headers are in either 6440// *Message.ServerResponse.Header or (if a response was returned at all) 6441// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 6442// check whether the returned error was because http.StatusNotModified 6443// was returned. 6444func (c *UsersMessagesModifyCall) Do(opts ...googleapi.CallOption) (*Message, error) { 6445 gensupport.SetOptions(c.urlParams_, opts...) 6446 res, err := c.doRequest("json") 6447 if res != nil && res.StatusCode == http.StatusNotModified { 6448 if res.Body != nil { 6449 res.Body.Close() 6450 } 6451 return nil, &googleapi.Error{ 6452 Code: res.StatusCode, 6453 Header: res.Header, 6454 } 6455 } 6456 if err != nil { 6457 return nil, err 6458 } 6459 defer googleapi.CloseBody(res) 6460 if err := googleapi.CheckResponse(res); err != nil { 6461 return nil, err 6462 } 6463 ret := &Message{ 6464 ServerResponse: googleapi.ServerResponse{ 6465 Header: res.Header, 6466 HTTPStatusCode: res.StatusCode, 6467 }, 6468 } 6469 target := &ret 6470 if err := gensupport.DecodeResponse(target, res); err != nil { 6471 return nil, err 6472 } 6473 return ret, nil 6474 // { 6475 // "description": "Modifies the labels on the specified message.", 6476 // "flatPath": "gmail/v1/users/{userId}/messages/{id}/modify", 6477 // "httpMethod": "POST", 6478 // "id": "gmail.users.messages.modify", 6479 // "parameterOrder": [ 6480 // "userId", 6481 // "id" 6482 // ], 6483 // "parameters": { 6484 // "id": { 6485 // "description": "The ID of the message to modify.", 6486 // "location": "path", 6487 // "required": true, 6488 // "type": "string" 6489 // }, 6490 // "userId": { 6491 // "default": "me", 6492 // "description": "The user's email address. The special value `me` can be used to indicate the authenticated user.", 6493 // "location": "path", 6494 // "required": true, 6495 // "type": "string" 6496 // } 6497 // }, 6498 // "path": "gmail/v1/users/{userId}/messages/{id}/modify", 6499 // "request": { 6500 // "$ref": "ModifyMessageRequest" 6501 // }, 6502 // "response": { 6503 // "$ref": "Message" 6504 // }, 6505 // "scopes": [ 6506 // "https://mail.google.com/", 6507 // "https://www.googleapis.com/auth/gmail.modify" 6508 // ] 6509 // } 6510 6511} 6512 6513// method id "gmail.users.messages.send": 6514 6515type UsersMessagesSendCall struct { 6516 s *Service 6517 userId string 6518 message *Message 6519 urlParams_ gensupport.URLParams 6520 mediaInfo_ *gensupport.MediaInfo 6521 ctx_ context.Context 6522 header_ http.Header 6523} 6524 6525// Send: Sends the specified message to the recipients in the `To`, 6526// `Cc`, and `Bcc` headers. 6527func (r *UsersMessagesService) Send(userId string, message *Message) *UsersMessagesSendCall { 6528 c := &UsersMessagesSendCall{s: r.s, urlParams_: make(gensupport.URLParams)} 6529 c.userId = userId 6530 c.message = message 6531 return c 6532} 6533 6534// Media specifies the media to upload in one or more chunks. The chunk 6535// size may be controlled by supplying a MediaOption generated by 6536// googleapi.ChunkSize. The chunk size defaults to 6537// googleapi.DefaultUploadChunkSize.The Content-Type header used in the 6538// upload request will be determined by sniffing the contents of r, 6539// unless a MediaOption generated by googleapi.ContentType is 6540// supplied. 6541// At most one of Media and ResumableMedia may be set. 6542func (c *UsersMessagesSendCall) Media(r io.Reader, options ...googleapi.MediaOption) *UsersMessagesSendCall { 6543 c.mediaInfo_ = gensupport.NewInfoFromMedia(r, options) 6544 return c 6545} 6546 6547// ResumableMedia specifies the media to upload in chunks and can be 6548// canceled with ctx. 6549// 6550// Deprecated: use Media instead. 6551// 6552// At most one of Media and ResumableMedia may be set. mediaType 6553// identifies the MIME media type of the upload, such as "image/png". If 6554// mediaType is "", it will be auto-detected. The provided ctx will 6555// supersede any context previously provided to the Context method. 6556func (c *UsersMessagesSendCall) ResumableMedia(ctx context.Context, r io.ReaderAt, size int64, mediaType string) *UsersMessagesSendCall { 6557 c.ctx_ = ctx 6558 c.mediaInfo_ = gensupport.NewInfoFromResumableMedia(r, size, mediaType) 6559 return c 6560} 6561 6562// ProgressUpdater provides a callback function that will be called 6563// after every chunk. It should be a low-latency function in order to 6564// not slow down the upload operation. This should only be called when 6565// using ResumableMedia (as opposed to Media). 6566func (c *UsersMessagesSendCall) ProgressUpdater(pu googleapi.ProgressUpdater) *UsersMessagesSendCall { 6567 c.mediaInfo_.SetProgressUpdater(pu) 6568 return c 6569} 6570 6571// Fields allows partial responses to be retrieved. See 6572// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 6573// for more information. 6574func (c *UsersMessagesSendCall) Fields(s ...googleapi.Field) *UsersMessagesSendCall { 6575 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 6576 return c 6577} 6578 6579// Context sets the context to be used in this call's Do method. Any 6580// pending HTTP request will be aborted if the provided context is 6581// canceled. 6582// This context will supersede any context previously provided to the 6583// ResumableMedia method. 6584func (c *UsersMessagesSendCall) Context(ctx context.Context) *UsersMessagesSendCall { 6585 c.ctx_ = ctx 6586 return c 6587} 6588 6589// Header returns an http.Header that can be modified by the caller to 6590// add HTTP headers to the request. 6591func (c *UsersMessagesSendCall) Header() http.Header { 6592 if c.header_ == nil { 6593 c.header_ = make(http.Header) 6594 } 6595 return c.header_ 6596} 6597 6598func (c *UsersMessagesSendCall) doRequest(alt string) (*http.Response, error) { 6599 reqHeaders := make(http.Header) 6600 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20201124") 6601 for k, v := range c.header_ { 6602 reqHeaders[k] = v 6603 } 6604 reqHeaders.Set("User-Agent", c.s.userAgent()) 6605 var body io.Reader = nil 6606 body, err := googleapi.WithoutDataWrapper.JSONReader(c.message) 6607 if err != nil { 6608 return nil, err 6609 } 6610 reqHeaders.Set("Content-Type", "application/json") 6611 c.urlParams_.Set("alt", alt) 6612 c.urlParams_.Set("prettyPrint", "false") 6613 urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/messages/send") 6614 if c.mediaInfo_ != nil { 6615 urls = googleapi.ResolveRelative(c.s.BasePath, "/upload/gmail/v1/users/{userId}/messages/send") 6616 c.urlParams_.Set("uploadType", c.mediaInfo_.UploadType()) 6617 } 6618 if body == nil { 6619 body = new(bytes.Buffer) 6620 reqHeaders.Set("Content-Type", "application/json") 6621 } 6622 body, getBody, cleanup := c.mediaInfo_.UploadRequest(reqHeaders, body) 6623 defer cleanup() 6624 urls += "?" + c.urlParams_.Encode() 6625 req, err := http.NewRequest("POST", urls, body) 6626 if err != nil { 6627 return nil, err 6628 } 6629 req.Header = reqHeaders 6630 req.GetBody = getBody 6631 googleapi.Expand(req.URL, map[string]string{ 6632 "userId": c.userId, 6633 }) 6634 return gensupport.SendRequest(c.ctx_, c.s.client, req) 6635} 6636 6637// Do executes the "gmail.users.messages.send" call. 6638// Exactly one of *Message or error will be non-nil. Any non-2xx status 6639// code is an error. Response headers are in either 6640// *Message.ServerResponse.Header or (if a response was returned at all) 6641// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 6642// check whether the returned error was because http.StatusNotModified 6643// was returned. 6644func (c *UsersMessagesSendCall) Do(opts ...googleapi.CallOption) (*Message, error) { 6645 gensupport.SetOptions(c.urlParams_, opts...) 6646 res, err := c.doRequest("json") 6647 if res != nil && res.StatusCode == http.StatusNotModified { 6648 if res.Body != nil { 6649 res.Body.Close() 6650 } 6651 return nil, &googleapi.Error{ 6652 Code: res.StatusCode, 6653 Header: res.Header, 6654 } 6655 } 6656 if err != nil { 6657 return nil, err 6658 } 6659 defer googleapi.CloseBody(res) 6660 if err := googleapi.CheckResponse(res); err != nil { 6661 return nil, err 6662 } 6663 rx := c.mediaInfo_.ResumableUpload(res.Header.Get("Location")) 6664 if rx != nil { 6665 rx.Client = c.s.client 6666 rx.UserAgent = c.s.userAgent() 6667 ctx := c.ctx_ 6668 if ctx == nil { 6669 ctx = context.TODO() 6670 } 6671 res, err = rx.Upload(ctx) 6672 if err != nil { 6673 return nil, err 6674 } 6675 defer res.Body.Close() 6676 if err := googleapi.CheckResponse(res); err != nil { 6677 return nil, err 6678 } 6679 } 6680 ret := &Message{ 6681 ServerResponse: googleapi.ServerResponse{ 6682 Header: res.Header, 6683 HTTPStatusCode: res.StatusCode, 6684 }, 6685 } 6686 target := &ret 6687 if err := gensupport.DecodeResponse(target, res); err != nil { 6688 return nil, err 6689 } 6690 return ret, nil 6691 // { 6692 // "description": "Sends the specified message to the recipients in the `To`, `Cc`, and `Bcc` headers.", 6693 // "flatPath": "gmail/v1/users/{userId}/messages/send", 6694 // "httpMethod": "POST", 6695 // "id": "gmail.users.messages.send", 6696 // "mediaUpload": { 6697 // "accept": [ 6698 // "message/*" 6699 // ], 6700 // "maxSize": "36700160", 6701 // "protocols": { 6702 // "resumable": { 6703 // "multipart": true, 6704 // "path": "/resumable/upload/gmail/v1/users/{userId}/messages/send" 6705 // }, 6706 // "simple": { 6707 // "multipart": true, 6708 // "path": "/upload/gmail/v1/users/{userId}/messages/send" 6709 // } 6710 // } 6711 // }, 6712 // "parameterOrder": [ 6713 // "userId" 6714 // ], 6715 // "parameters": { 6716 // "userId": { 6717 // "default": "me", 6718 // "description": "The user's email address. The special value `me` can be used to indicate the authenticated user.", 6719 // "location": "path", 6720 // "required": true, 6721 // "type": "string" 6722 // } 6723 // }, 6724 // "path": "gmail/v1/users/{userId}/messages/send", 6725 // "request": { 6726 // "$ref": "Message" 6727 // }, 6728 // "response": { 6729 // "$ref": "Message" 6730 // }, 6731 // "scopes": [ 6732 // "https://mail.google.com/", 6733 // "https://www.googleapis.com/auth/gmail.addons.current.action.compose", 6734 // "https://www.googleapis.com/auth/gmail.compose", 6735 // "https://www.googleapis.com/auth/gmail.modify", 6736 // "https://www.googleapis.com/auth/gmail.send" 6737 // ], 6738 // "supportsMediaUpload": true 6739 // } 6740 6741} 6742 6743// method id "gmail.users.messages.trash": 6744 6745type UsersMessagesTrashCall struct { 6746 s *Service 6747 userId string 6748 id string 6749 urlParams_ gensupport.URLParams 6750 ctx_ context.Context 6751 header_ http.Header 6752} 6753 6754// Trash: Moves the specified message to the trash. 6755func (r *UsersMessagesService) Trash(userId string, id string) *UsersMessagesTrashCall { 6756 c := &UsersMessagesTrashCall{s: r.s, urlParams_: make(gensupport.URLParams)} 6757 c.userId = userId 6758 c.id = id 6759 return c 6760} 6761 6762// Fields allows partial responses to be retrieved. See 6763// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 6764// for more information. 6765func (c *UsersMessagesTrashCall) Fields(s ...googleapi.Field) *UsersMessagesTrashCall { 6766 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 6767 return c 6768} 6769 6770// Context sets the context to be used in this call's Do method. Any 6771// pending HTTP request will be aborted if the provided context is 6772// canceled. 6773func (c *UsersMessagesTrashCall) Context(ctx context.Context) *UsersMessagesTrashCall { 6774 c.ctx_ = ctx 6775 return c 6776} 6777 6778// Header returns an http.Header that can be modified by the caller to 6779// add HTTP headers to the request. 6780func (c *UsersMessagesTrashCall) Header() http.Header { 6781 if c.header_ == nil { 6782 c.header_ = make(http.Header) 6783 } 6784 return c.header_ 6785} 6786 6787func (c *UsersMessagesTrashCall) doRequest(alt string) (*http.Response, error) { 6788 reqHeaders := make(http.Header) 6789 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20201124") 6790 for k, v := range c.header_ { 6791 reqHeaders[k] = v 6792 } 6793 reqHeaders.Set("User-Agent", c.s.userAgent()) 6794 var body io.Reader = nil 6795 c.urlParams_.Set("alt", alt) 6796 c.urlParams_.Set("prettyPrint", "false") 6797 urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/messages/{id}/trash") 6798 urls += "?" + c.urlParams_.Encode() 6799 req, err := http.NewRequest("POST", urls, body) 6800 if err != nil { 6801 return nil, err 6802 } 6803 req.Header = reqHeaders 6804 googleapi.Expand(req.URL, map[string]string{ 6805 "userId": c.userId, 6806 "id": c.id, 6807 }) 6808 return gensupport.SendRequest(c.ctx_, c.s.client, req) 6809} 6810 6811// Do executes the "gmail.users.messages.trash" call. 6812// Exactly one of *Message or error will be non-nil. Any non-2xx status 6813// code is an error. Response headers are in either 6814// *Message.ServerResponse.Header or (if a response was returned at all) 6815// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 6816// check whether the returned error was because http.StatusNotModified 6817// was returned. 6818func (c *UsersMessagesTrashCall) Do(opts ...googleapi.CallOption) (*Message, error) { 6819 gensupport.SetOptions(c.urlParams_, opts...) 6820 res, err := c.doRequest("json") 6821 if res != nil && res.StatusCode == http.StatusNotModified { 6822 if res.Body != nil { 6823 res.Body.Close() 6824 } 6825 return nil, &googleapi.Error{ 6826 Code: res.StatusCode, 6827 Header: res.Header, 6828 } 6829 } 6830 if err != nil { 6831 return nil, err 6832 } 6833 defer googleapi.CloseBody(res) 6834 if err := googleapi.CheckResponse(res); err != nil { 6835 return nil, err 6836 } 6837 ret := &Message{ 6838 ServerResponse: googleapi.ServerResponse{ 6839 Header: res.Header, 6840 HTTPStatusCode: res.StatusCode, 6841 }, 6842 } 6843 target := &ret 6844 if err := gensupport.DecodeResponse(target, res); err != nil { 6845 return nil, err 6846 } 6847 return ret, nil 6848 // { 6849 // "description": "Moves the specified message to the trash.", 6850 // "flatPath": "gmail/v1/users/{userId}/messages/{id}/trash", 6851 // "httpMethod": "POST", 6852 // "id": "gmail.users.messages.trash", 6853 // "parameterOrder": [ 6854 // "userId", 6855 // "id" 6856 // ], 6857 // "parameters": { 6858 // "id": { 6859 // "description": "The ID of the message to Trash.", 6860 // "location": "path", 6861 // "required": true, 6862 // "type": "string" 6863 // }, 6864 // "userId": { 6865 // "default": "me", 6866 // "description": "The user's email address. The special value `me` can be used to indicate the authenticated user.", 6867 // "location": "path", 6868 // "required": true, 6869 // "type": "string" 6870 // } 6871 // }, 6872 // "path": "gmail/v1/users/{userId}/messages/{id}/trash", 6873 // "response": { 6874 // "$ref": "Message" 6875 // }, 6876 // "scopes": [ 6877 // "https://mail.google.com/", 6878 // "https://www.googleapis.com/auth/gmail.modify" 6879 // ] 6880 // } 6881 6882} 6883 6884// method id "gmail.users.messages.untrash": 6885 6886type UsersMessagesUntrashCall struct { 6887 s *Service 6888 userId string 6889 id string 6890 urlParams_ gensupport.URLParams 6891 ctx_ context.Context 6892 header_ http.Header 6893} 6894 6895// Untrash: Removes the specified message from the trash. 6896func (r *UsersMessagesService) Untrash(userId string, id string) *UsersMessagesUntrashCall { 6897 c := &UsersMessagesUntrashCall{s: r.s, urlParams_: make(gensupport.URLParams)} 6898 c.userId = userId 6899 c.id = id 6900 return c 6901} 6902 6903// Fields allows partial responses to be retrieved. See 6904// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 6905// for more information. 6906func (c *UsersMessagesUntrashCall) Fields(s ...googleapi.Field) *UsersMessagesUntrashCall { 6907 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 6908 return c 6909} 6910 6911// Context sets the context to be used in this call's Do method. Any 6912// pending HTTP request will be aborted if the provided context is 6913// canceled. 6914func (c *UsersMessagesUntrashCall) Context(ctx context.Context) *UsersMessagesUntrashCall { 6915 c.ctx_ = ctx 6916 return c 6917} 6918 6919// Header returns an http.Header that can be modified by the caller to 6920// add HTTP headers to the request. 6921func (c *UsersMessagesUntrashCall) Header() http.Header { 6922 if c.header_ == nil { 6923 c.header_ = make(http.Header) 6924 } 6925 return c.header_ 6926} 6927 6928func (c *UsersMessagesUntrashCall) doRequest(alt string) (*http.Response, error) { 6929 reqHeaders := make(http.Header) 6930 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20201124") 6931 for k, v := range c.header_ { 6932 reqHeaders[k] = v 6933 } 6934 reqHeaders.Set("User-Agent", c.s.userAgent()) 6935 var body io.Reader = nil 6936 c.urlParams_.Set("alt", alt) 6937 c.urlParams_.Set("prettyPrint", "false") 6938 urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/messages/{id}/untrash") 6939 urls += "?" + c.urlParams_.Encode() 6940 req, err := http.NewRequest("POST", urls, body) 6941 if err != nil { 6942 return nil, err 6943 } 6944 req.Header = reqHeaders 6945 googleapi.Expand(req.URL, map[string]string{ 6946 "userId": c.userId, 6947 "id": c.id, 6948 }) 6949 return gensupport.SendRequest(c.ctx_, c.s.client, req) 6950} 6951 6952// Do executes the "gmail.users.messages.untrash" call. 6953// Exactly one of *Message or error will be non-nil. Any non-2xx status 6954// code is an error. Response headers are in either 6955// *Message.ServerResponse.Header or (if a response was returned at all) 6956// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 6957// check whether the returned error was because http.StatusNotModified 6958// was returned. 6959func (c *UsersMessagesUntrashCall) Do(opts ...googleapi.CallOption) (*Message, error) { 6960 gensupport.SetOptions(c.urlParams_, opts...) 6961 res, err := c.doRequest("json") 6962 if res != nil && res.StatusCode == http.StatusNotModified { 6963 if res.Body != nil { 6964 res.Body.Close() 6965 } 6966 return nil, &googleapi.Error{ 6967 Code: res.StatusCode, 6968 Header: res.Header, 6969 } 6970 } 6971 if err != nil { 6972 return nil, err 6973 } 6974 defer googleapi.CloseBody(res) 6975 if err := googleapi.CheckResponse(res); err != nil { 6976 return nil, err 6977 } 6978 ret := &Message{ 6979 ServerResponse: googleapi.ServerResponse{ 6980 Header: res.Header, 6981 HTTPStatusCode: res.StatusCode, 6982 }, 6983 } 6984 target := &ret 6985 if err := gensupport.DecodeResponse(target, res); err != nil { 6986 return nil, err 6987 } 6988 return ret, nil 6989 // { 6990 // "description": "Removes the specified message from the trash.", 6991 // "flatPath": "gmail/v1/users/{userId}/messages/{id}/untrash", 6992 // "httpMethod": "POST", 6993 // "id": "gmail.users.messages.untrash", 6994 // "parameterOrder": [ 6995 // "userId", 6996 // "id" 6997 // ], 6998 // "parameters": { 6999 // "id": { 7000 // "description": "The ID of the message to remove from Trash.", 7001 // "location": "path", 7002 // "required": true, 7003 // "type": "string" 7004 // }, 7005 // "userId": { 7006 // "default": "me", 7007 // "description": "The user's email address. The special value `me` can be used to indicate the authenticated user.", 7008 // "location": "path", 7009 // "required": true, 7010 // "type": "string" 7011 // } 7012 // }, 7013 // "path": "gmail/v1/users/{userId}/messages/{id}/untrash", 7014 // "response": { 7015 // "$ref": "Message" 7016 // }, 7017 // "scopes": [ 7018 // "https://mail.google.com/", 7019 // "https://www.googleapis.com/auth/gmail.modify" 7020 // ] 7021 // } 7022 7023} 7024 7025// method id "gmail.users.messages.attachments.get": 7026 7027type UsersMessagesAttachmentsGetCall struct { 7028 s *Service 7029 userId string 7030 messageId string 7031 id string 7032 urlParams_ gensupport.URLParams 7033 ifNoneMatch_ string 7034 ctx_ context.Context 7035 header_ http.Header 7036} 7037 7038// Get: Gets the specified message attachment. 7039func (r *UsersMessagesAttachmentsService) Get(userId string, messageId string, id string) *UsersMessagesAttachmentsGetCall { 7040 c := &UsersMessagesAttachmentsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)} 7041 c.userId = userId 7042 c.messageId = messageId 7043 c.id = id 7044 return c 7045} 7046 7047// Fields allows partial responses to be retrieved. See 7048// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 7049// for more information. 7050func (c *UsersMessagesAttachmentsGetCall) Fields(s ...googleapi.Field) *UsersMessagesAttachmentsGetCall { 7051 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 7052 return c 7053} 7054 7055// IfNoneMatch sets the optional parameter which makes the operation 7056// fail if the object's ETag matches the given value. This is useful for 7057// getting updates only after the object has changed since the last 7058// request. Use googleapi.IsNotModified to check whether the response 7059// error from Do is the result of In-None-Match. 7060func (c *UsersMessagesAttachmentsGetCall) IfNoneMatch(entityTag string) *UsersMessagesAttachmentsGetCall { 7061 c.ifNoneMatch_ = entityTag 7062 return c 7063} 7064 7065// Context sets the context to be used in this call's Do method. Any 7066// pending HTTP request will be aborted if the provided context is 7067// canceled. 7068func (c *UsersMessagesAttachmentsGetCall) Context(ctx context.Context) *UsersMessagesAttachmentsGetCall { 7069 c.ctx_ = ctx 7070 return c 7071} 7072 7073// Header returns an http.Header that can be modified by the caller to 7074// add HTTP headers to the request. 7075func (c *UsersMessagesAttachmentsGetCall) Header() http.Header { 7076 if c.header_ == nil { 7077 c.header_ = make(http.Header) 7078 } 7079 return c.header_ 7080} 7081 7082func (c *UsersMessagesAttachmentsGetCall) doRequest(alt string) (*http.Response, error) { 7083 reqHeaders := make(http.Header) 7084 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20201124") 7085 for k, v := range c.header_ { 7086 reqHeaders[k] = v 7087 } 7088 reqHeaders.Set("User-Agent", c.s.userAgent()) 7089 if c.ifNoneMatch_ != "" { 7090 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 7091 } 7092 var body io.Reader = nil 7093 c.urlParams_.Set("alt", alt) 7094 c.urlParams_.Set("prettyPrint", "false") 7095 urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/messages/{messageId}/attachments/{id}") 7096 urls += "?" + c.urlParams_.Encode() 7097 req, err := http.NewRequest("GET", urls, body) 7098 if err != nil { 7099 return nil, err 7100 } 7101 req.Header = reqHeaders 7102 googleapi.Expand(req.URL, map[string]string{ 7103 "userId": c.userId, 7104 "messageId": c.messageId, 7105 "id": c.id, 7106 }) 7107 return gensupport.SendRequest(c.ctx_, c.s.client, req) 7108} 7109 7110// Do executes the "gmail.users.messages.attachments.get" call. 7111// Exactly one of *MessagePartBody or error will be non-nil. Any non-2xx 7112// status code is an error. Response headers are in either 7113// *MessagePartBody.ServerResponse.Header or (if a response was returned 7114// at all) in error.(*googleapi.Error).Header. Use 7115// googleapi.IsNotModified to check whether the returned error was 7116// because http.StatusNotModified was returned. 7117func (c *UsersMessagesAttachmentsGetCall) Do(opts ...googleapi.CallOption) (*MessagePartBody, error) { 7118 gensupport.SetOptions(c.urlParams_, opts...) 7119 res, err := c.doRequest("json") 7120 if res != nil && res.StatusCode == http.StatusNotModified { 7121 if res.Body != nil { 7122 res.Body.Close() 7123 } 7124 return nil, &googleapi.Error{ 7125 Code: res.StatusCode, 7126 Header: res.Header, 7127 } 7128 } 7129 if err != nil { 7130 return nil, err 7131 } 7132 defer googleapi.CloseBody(res) 7133 if err := googleapi.CheckResponse(res); err != nil { 7134 return nil, err 7135 } 7136 ret := &MessagePartBody{ 7137 ServerResponse: googleapi.ServerResponse{ 7138 Header: res.Header, 7139 HTTPStatusCode: res.StatusCode, 7140 }, 7141 } 7142 target := &ret 7143 if err := gensupport.DecodeResponse(target, res); err != nil { 7144 return nil, err 7145 } 7146 return ret, nil 7147 // { 7148 // "description": "Gets the specified message attachment.", 7149 // "flatPath": "gmail/v1/users/{userId}/messages/{messageId}/attachments/{id}", 7150 // "httpMethod": "GET", 7151 // "id": "gmail.users.messages.attachments.get", 7152 // "parameterOrder": [ 7153 // "userId", 7154 // "messageId", 7155 // "id" 7156 // ], 7157 // "parameters": { 7158 // "id": { 7159 // "description": "The ID of the attachment.", 7160 // "location": "path", 7161 // "required": true, 7162 // "type": "string" 7163 // }, 7164 // "messageId": { 7165 // "description": "The ID of the message containing the attachment.", 7166 // "location": "path", 7167 // "required": true, 7168 // "type": "string" 7169 // }, 7170 // "userId": { 7171 // "default": "me", 7172 // "description": "The user's email address. The special value `me` can be used to indicate the authenticated user.", 7173 // "location": "path", 7174 // "required": true, 7175 // "type": "string" 7176 // } 7177 // }, 7178 // "path": "gmail/v1/users/{userId}/messages/{messageId}/attachments/{id}", 7179 // "response": { 7180 // "$ref": "MessagePartBody" 7181 // }, 7182 // "scopes": [ 7183 // "https://mail.google.com/", 7184 // "https://www.googleapis.com/auth/gmail.addons.current.message.action", 7185 // "https://www.googleapis.com/auth/gmail.addons.current.message.readonly", 7186 // "https://www.googleapis.com/auth/gmail.modify", 7187 // "https://www.googleapis.com/auth/gmail.readonly" 7188 // ] 7189 // } 7190 7191} 7192 7193// method id "gmail.users.settings.getAutoForwarding": 7194 7195type UsersSettingsGetAutoForwardingCall struct { 7196 s *Service 7197 userId string 7198 urlParams_ gensupport.URLParams 7199 ifNoneMatch_ string 7200 ctx_ context.Context 7201 header_ http.Header 7202} 7203 7204// GetAutoForwarding: Gets the auto-forwarding setting for the specified 7205// account. 7206func (r *UsersSettingsService) GetAutoForwarding(userId string) *UsersSettingsGetAutoForwardingCall { 7207 c := &UsersSettingsGetAutoForwardingCall{s: r.s, urlParams_: make(gensupport.URLParams)} 7208 c.userId = userId 7209 return c 7210} 7211 7212// Fields allows partial responses to be retrieved. See 7213// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 7214// for more information. 7215func (c *UsersSettingsGetAutoForwardingCall) Fields(s ...googleapi.Field) *UsersSettingsGetAutoForwardingCall { 7216 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 7217 return c 7218} 7219 7220// IfNoneMatch sets the optional parameter which makes the operation 7221// fail if the object's ETag matches the given value. This is useful for 7222// getting updates only after the object has changed since the last 7223// request. Use googleapi.IsNotModified to check whether the response 7224// error from Do is the result of In-None-Match. 7225func (c *UsersSettingsGetAutoForwardingCall) IfNoneMatch(entityTag string) *UsersSettingsGetAutoForwardingCall { 7226 c.ifNoneMatch_ = entityTag 7227 return c 7228} 7229 7230// Context sets the context to be used in this call's Do method. Any 7231// pending HTTP request will be aborted if the provided context is 7232// canceled. 7233func (c *UsersSettingsGetAutoForwardingCall) Context(ctx context.Context) *UsersSettingsGetAutoForwardingCall { 7234 c.ctx_ = ctx 7235 return c 7236} 7237 7238// Header returns an http.Header that can be modified by the caller to 7239// add HTTP headers to the request. 7240func (c *UsersSettingsGetAutoForwardingCall) Header() http.Header { 7241 if c.header_ == nil { 7242 c.header_ = make(http.Header) 7243 } 7244 return c.header_ 7245} 7246 7247func (c *UsersSettingsGetAutoForwardingCall) doRequest(alt string) (*http.Response, error) { 7248 reqHeaders := make(http.Header) 7249 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20201124") 7250 for k, v := range c.header_ { 7251 reqHeaders[k] = v 7252 } 7253 reqHeaders.Set("User-Agent", c.s.userAgent()) 7254 if c.ifNoneMatch_ != "" { 7255 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 7256 } 7257 var body io.Reader = nil 7258 c.urlParams_.Set("alt", alt) 7259 c.urlParams_.Set("prettyPrint", "false") 7260 urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/settings/autoForwarding") 7261 urls += "?" + c.urlParams_.Encode() 7262 req, err := http.NewRequest("GET", urls, body) 7263 if err != nil { 7264 return nil, err 7265 } 7266 req.Header = reqHeaders 7267 googleapi.Expand(req.URL, map[string]string{ 7268 "userId": c.userId, 7269 }) 7270 return gensupport.SendRequest(c.ctx_, c.s.client, req) 7271} 7272 7273// Do executes the "gmail.users.settings.getAutoForwarding" call. 7274// Exactly one of *AutoForwarding or error will be non-nil. Any non-2xx 7275// status code is an error. Response headers are in either 7276// *AutoForwarding.ServerResponse.Header or (if a response was returned 7277// at all) in error.(*googleapi.Error).Header. Use 7278// googleapi.IsNotModified to check whether the returned error was 7279// because http.StatusNotModified was returned. 7280func (c *UsersSettingsGetAutoForwardingCall) Do(opts ...googleapi.CallOption) (*AutoForwarding, error) { 7281 gensupport.SetOptions(c.urlParams_, opts...) 7282 res, err := c.doRequest("json") 7283 if res != nil && res.StatusCode == http.StatusNotModified { 7284 if res.Body != nil { 7285 res.Body.Close() 7286 } 7287 return nil, &googleapi.Error{ 7288 Code: res.StatusCode, 7289 Header: res.Header, 7290 } 7291 } 7292 if err != nil { 7293 return nil, err 7294 } 7295 defer googleapi.CloseBody(res) 7296 if err := googleapi.CheckResponse(res); err != nil { 7297 return nil, err 7298 } 7299 ret := &AutoForwarding{ 7300 ServerResponse: googleapi.ServerResponse{ 7301 Header: res.Header, 7302 HTTPStatusCode: res.StatusCode, 7303 }, 7304 } 7305 target := &ret 7306 if err := gensupport.DecodeResponse(target, res); err != nil { 7307 return nil, err 7308 } 7309 return ret, nil 7310 // { 7311 // "description": "Gets the auto-forwarding setting for the specified account.", 7312 // "flatPath": "gmail/v1/users/{userId}/settings/autoForwarding", 7313 // "httpMethod": "GET", 7314 // "id": "gmail.users.settings.getAutoForwarding", 7315 // "parameterOrder": [ 7316 // "userId" 7317 // ], 7318 // "parameters": { 7319 // "userId": { 7320 // "default": "me", 7321 // "description": "User's email address. The special value \"me\" can be used to indicate the authenticated user.", 7322 // "location": "path", 7323 // "required": true, 7324 // "type": "string" 7325 // } 7326 // }, 7327 // "path": "gmail/v1/users/{userId}/settings/autoForwarding", 7328 // "response": { 7329 // "$ref": "AutoForwarding" 7330 // }, 7331 // "scopes": [ 7332 // "https://mail.google.com/", 7333 // "https://www.googleapis.com/auth/gmail.modify", 7334 // "https://www.googleapis.com/auth/gmail.readonly", 7335 // "https://www.googleapis.com/auth/gmail.settings.basic" 7336 // ] 7337 // } 7338 7339} 7340 7341// method id "gmail.users.settings.getImap": 7342 7343type UsersSettingsGetImapCall struct { 7344 s *Service 7345 userId string 7346 urlParams_ gensupport.URLParams 7347 ifNoneMatch_ string 7348 ctx_ context.Context 7349 header_ http.Header 7350} 7351 7352// GetImap: Gets IMAP settings. 7353func (r *UsersSettingsService) GetImap(userId string) *UsersSettingsGetImapCall { 7354 c := &UsersSettingsGetImapCall{s: r.s, urlParams_: make(gensupport.URLParams)} 7355 c.userId = userId 7356 return c 7357} 7358 7359// Fields allows partial responses to be retrieved. See 7360// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 7361// for more information. 7362func (c *UsersSettingsGetImapCall) Fields(s ...googleapi.Field) *UsersSettingsGetImapCall { 7363 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 7364 return c 7365} 7366 7367// IfNoneMatch sets the optional parameter which makes the operation 7368// fail if the object's ETag matches the given value. This is useful for 7369// getting updates only after the object has changed since the last 7370// request. Use googleapi.IsNotModified to check whether the response 7371// error from Do is the result of In-None-Match. 7372func (c *UsersSettingsGetImapCall) IfNoneMatch(entityTag string) *UsersSettingsGetImapCall { 7373 c.ifNoneMatch_ = entityTag 7374 return c 7375} 7376 7377// Context sets the context to be used in this call's Do method. Any 7378// pending HTTP request will be aborted if the provided context is 7379// canceled. 7380func (c *UsersSettingsGetImapCall) Context(ctx context.Context) *UsersSettingsGetImapCall { 7381 c.ctx_ = ctx 7382 return c 7383} 7384 7385// Header returns an http.Header that can be modified by the caller to 7386// add HTTP headers to the request. 7387func (c *UsersSettingsGetImapCall) Header() http.Header { 7388 if c.header_ == nil { 7389 c.header_ = make(http.Header) 7390 } 7391 return c.header_ 7392} 7393 7394func (c *UsersSettingsGetImapCall) doRequest(alt string) (*http.Response, error) { 7395 reqHeaders := make(http.Header) 7396 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20201124") 7397 for k, v := range c.header_ { 7398 reqHeaders[k] = v 7399 } 7400 reqHeaders.Set("User-Agent", c.s.userAgent()) 7401 if c.ifNoneMatch_ != "" { 7402 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 7403 } 7404 var body io.Reader = nil 7405 c.urlParams_.Set("alt", alt) 7406 c.urlParams_.Set("prettyPrint", "false") 7407 urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/settings/imap") 7408 urls += "?" + c.urlParams_.Encode() 7409 req, err := http.NewRequest("GET", urls, body) 7410 if err != nil { 7411 return nil, err 7412 } 7413 req.Header = reqHeaders 7414 googleapi.Expand(req.URL, map[string]string{ 7415 "userId": c.userId, 7416 }) 7417 return gensupport.SendRequest(c.ctx_, c.s.client, req) 7418} 7419 7420// Do executes the "gmail.users.settings.getImap" call. 7421// Exactly one of *ImapSettings or error will be non-nil. Any non-2xx 7422// status code is an error. Response headers are in either 7423// *ImapSettings.ServerResponse.Header or (if a response was returned at 7424// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 7425// to check whether the returned error was because 7426// http.StatusNotModified was returned. 7427func (c *UsersSettingsGetImapCall) Do(opts ...googleapi.CallOption) (*ImapSettings, error) { 7428 gensupport.SetOptions(c.urlParams_, opts...) 7429 res, err := c.doRequest("json") 7430 if res != nil && res.StatusCode == http.StatusNotModified { 7431 if res.Body != nil { 7432 res.Body.Close() 7433 } 7434 return nil, &googleapi.Error{ 7435 Code: res.StatusCode, 7436 Header: res.Header, 7437 } 7438 } 7439 if err != nil { 7440 return nil, err 7441 } 7442 defer googleapi.CloseBody(res) 7443 if err := googleapi.CheckResponse(res); err != nil { 7444 return nil, err 7445 } 7446 ret := &ImapSettings{ 7447 ServerResponse: googleapi.ServerResponse{ 7448 Header: res.Header, 7449 HTTPStatusCode: res.StatusCode, 7450 }, 7451 } 7452 target := &ret 7453 if err := gensupport.DecodeResponse(target, res); err != nil { 7454 return nil, err 7455 } 7456 return ret, nil 7457 // { 7458 // "description": "Gets IMAP settings.", 7459 // "flatPath": "gmail/v1/users/{userId}/settings/imap", 7460 // "httpMethod": "GET", 7461 // "id": "gmail.users.settings.getImap", 7462 // "parameterOrder": [ 7463 // "userId" 7464 // ], 7465 // "parameters": { 7466 // "userId": { 7467 // "default": "me", 7468 // "description": "User's email address. The special value \"me\" can be used to indicate the authenticated user.", 7469 // "location": "path", 7470 // "required": true, 7471 // "type": "string" 7472 // } 7473 // }, 7474 // "path": "gmail/v1/users/{userId}/settings/imap", 7475 // "response": { 7476 // "$ref": "ImapSettings" 7477 // }, 7478 // "scopes": [ 7479 // "https://mail.google.com/", 7480 // "https://www.googleapis.com/auth/gmail.modify", 7481 // "https://www.googleapis.com/auth/gmail.readonly", 7482 // "https://www.googleapis.com/auth/gmail.settings.basic" 7483 // ] 7484 // } 7485 7486} 7487 7488// method id "gmail.users.settings.getLanguage": 7489 7490type UsersSettingsGetLanguageCall struct { 7491 s *Service 7492 userId string 7493 urlParams_ gensupport.URLParams 7494 ifNoneMatch_ string 7495 ctx_ context.Context 7496 header_ http.Header 7497} 7498 7499// GetLanguage: Gets language settings. 7500func (r *UsersSettingsService) GetLanguage(userId string) *UsersSettingsGetLanguageCall { 7501 c := &UsersSettingsGetLanguageCall{s: r.s, urlParams_: make(gensupport.URLParams)} 7502 c.userId = userId 7503 return c 7504} 7505 7506// Fields allows partial responses to be retrieved. See 7507// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 7508// for more information. 7509func (c *UsersSettingsGetLanguageCall) Fields(s ...googleapi.Field) *UsersSettingsGetLanguageCall { 7510 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 7511 return c 7512} 7513 7514// IfNoneMatch sets the optional parameter which makes the operation 7515// fail if the object's ETag matches the given value. This is useful for 7516// getting updates only after the object has changed since the last 7517// request. Use googleapi.IsNotModified to check whether the response 7518// error from Do is the result of In-None-Match. 7519func (c *UsersSettingsGetLanguageCall) IfNoneMatch(entityTag string) *UsersSettingsGetLanguageCall { 7520 c.ifNoneMatch_ = entityTag 7521 return c 7522} 7523 7524// Context sets the context to be used in this call's Do method. Any 7525// pending HTTP request will be aborted if the provided context is 7526// canceled. 7527func (c *UsersSettingsGetLanguageCall) Context(ctx context.Context) *UsersSettingsGetLanguageCall { 7528 c.ctx_ = ctx 7529 return c 7530} 7531 7532// Header returns an http.Header that can be modified by the caller to 7533// add HTTP headers to the request. 7534func (c *UsersSettingsGetLanguageCall) Header() http.Header { 7535 if c.header_ == nil { 7536 c.header_ = make(http.Header) 7537 } 7538 return c.header_ 7539} 7540 7541func (c *UsersSettingsGetLanguageCall) doRequest(alt string) (*http.Response, error) { 7542 reqHeaders := make(http.Header) 7543 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20201124") 7544 for k, v := range c.header_ { 7545 reqHeaders[k] = v 7546 } 7547 reqHeaders.Set("User-Agent", c.s.userAgent()) 7548 if c.ifNoneMatch_ != "" { 7549 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 7550 } 7551 var body io.Reader = nil 7552 c.urlParams_.Set("alt", alt) 7553 c.urlParams_.Set("prettyPrint", "false") 7554 urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/settings/language") 7555 urls += "?" + c.urlParams_.Encode() 7556 req, err := http.NewRequest("GET", urls, body) 7557 if err != nil { 7558 return nil, err 7559 } 7560 req.Header = reqHeaders 7561 googleapi.Expand(req.URL, map[string]string{ 7562 "userId": c.userId, 7563 }) 7564 return gensupport.SendRequest(c.ctx_, c.s.client, req) 7565} 7566 7567// Do executes the "gmail.users.settings.getLanguage" call. 7568// Exactly one of *LanguageSettings or error will be non-nil. Any 7569// non-2xx status code is an error. Response headers are in either 7570// *LanguageSettings.ServerResponse.Header or (if a response was 7571// returned at all) in error.(*googleapi.Error).Header. Use 7572// googleapi.IsNotModified to check whether the returned error was 7573// because http.StatusNotModified was returned. 7574func (c *UsersSettingsGetLanguageCall) Do(opts ...googleapi.CallOption) (*LanguageSettings, error) { 7575 gensupport.SetOptions(c.urlParams_, opts...) 7576 res, err := c.doRequest("json") 7577 if res != nil && res.StatusCode == http.StatusNotModified { 7578 if res.Body != nil { 7579 res.Body.Close() 7580 } 7581 return nil, &googleapi.Error{ 7582 Code: res.StatusCode, 7583 Header: res.Header, 7584 } 7585 } 7586 if err != nil { 7587 return nil, err 7588 } 7589 defer googleapi.CloseBody(res) 7590 if err := googleapi.CheckResponse(res); err != nil { 7591 return nil, err 7592 } 7593 ret := &LanguageSettings{ 7594 ServerResponse: googleapi.ServerResponse{ 7595 Header: res.Header, 7596 HTTPStatusCode: res.StatusCode, 7597 }, 7598 } 7599 target := &ret 7600 if err := gensupport.DecodeResponse(target, res); err != nil { 7601 return nil, err 7602 } 7603 return ret, nil 7604 // { 7605 // "description": "Gets language settings.", 7606 // "flatPath": "gmail/v1/users/{userId}/settings/language", 7607 // "httpMethod": "GET", 7608 // "id": "gmail.users.settings.getLanguage", 7609 // "parameterOrder": [ 7610 // "userId" 7611 // ], 7612 // "parameters": { 7613 // "userId": { 7614 // "default": "me", 7615 // "description": "User's email address. The special value \"me\" can be used to indicate the authenticated user.", 7616 // "location": "path", 7617 // "required": true, 7618 // "type": "string" 7619 // } 7620 // }, 7621 // "path": "gmail/v1/users/{userId}/settings/language", 7622 // "response": { 7623 // "$ref": "LanguageSettings" 7624 // }, 7625 // "scopes": [ 7626 // "https://mail.google.com/", 7627 // "https://www.googleapis.com/auth/gmail.modify", 7628 // "https://www.googleapis.com/auth/gmail.readonly", 7629 // "https://www.googleapis.com/auth/gmail.settings.basic" 7630 // ] 7631 // } 7632 7633} 7634 7635// method id "gmail.users.settings.getPop": 7636 7637type UsersSettingsGetPopCall struct { 7638 s *Service 7639 userId string 7640 urlParams_ gensupport.URLParams 7641 ifNoneMatch_ string 7642 ctx_ context.Context 7643 header_ http.Header 7644} 7645 7646// GetPop: Gets POP settings. 7647func (r *UsersSettingsService) GetPop(userId string) *UsersSettingsGetPopCall { 7648 c := &UsersSettingsGetPopCall{s: r.s, urlParams_: make(gensupport.URLParams)} 7649 c.userId = userId 7650 return c 7651} 7652 7653// Fields allows partial responses to be retrieved. See 7654// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 7655// for more information. 7656func (c *UsersSettingsGetPopCall) Fields(s ...googleapi.Field) *UsersSettingsGetPopCall { 7657 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 7658 return c 7659} 7660 7661// IfNoneMatch sets the optional parameter which makes the operation 7662// fail if the object's ETag matches the given value. This is useful for 7663// getting updates only after the object has changed since the last 7664// request. Use googleapi.IsNotModified to check whether the response 7665// error from Do is the result of In-None-Match. 7666func (c *UsersSettingsGetPopCall) IfNoneMatch(entityTag string) *UsersSettingsGetPopCall { 7667 c.ifNoneMatch_ = entityTag 7668 return c 7669} 7670 7671// Context sets the context to be used in this call's Do method. Any 7672// pending HTTP request will be aborted if the provided context is 7673// canceled. 7674func (c *UsersSettingsGetPopCall) Context(ctx context.Context) *UsersSettingsGetPopCall { 7675 c.ctx_ = ctx 7676 return c 7677} 7678 7679// Header returns an http.Header that can be modified by the caller to 7680// add HTTP headers to the request. 7681func (c *UsersSettingsGetPopCall) Header() http.Header { 7682 if c.header_ == nil { 7683 c.header_ = make(http.Header) 7684 } 7685 return c.header_ 7686} 7687 7688func (c *UsersSettingsGetPopCall) doRequest(alt string) (*http.Response, error) { 7689 reqHeaders := make(http.Header) 7690 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20201124") 7691 for k, v := range c.header_ { 7692 reqHeaders[k] = v 7693 } 7694 reqHeaders.Set("User-Agent", c.s.userAgent()) 7695 if c.ifNoneMatch_ != "" { 7696 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 7697 } 7698 var body io.Reader = nil 7699 c.urlParams_.Set("alt", alt) 7700 c.urlParams_.Set("prettyPrint", "false") 7701 urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/settings/pop") 7702 urls += "?" + c.urlParams_.Encode() 7703 req, err := http.NewRequest("GET", urls, body) 7704 if err != nil { 7705 return nil, err 7706 } 7707 req.Header = reqHeaders 7708 googleapi.Expand(req.URL, map[string]string{ 7709 "userId": c.userId, 7710 }) 7711 return gensupport.SendRequest(c.ctx_, c.s.client, req) 7712} 7713 7714// Do executes the "gmail.users.settings.getPop" call. 7715// Exactly one of *PopSettings or error will be non-nil. Any non-2xx 7716// status code is an error. Response headers are in either 7717// *PopSettings.ServerResponse.Header or (if a response was returned at 7718// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 7719// to check whether the returned error was because 7720// http.StatusNotModified was returned. 7721func (c *UsersSettingsGetPopCall) Do(opts ...googleapi.CallOption) (*PopSettings, error) { 7722 gensupport.SetOptions(c.urlParams_, opts...) 7723 res, err := c.doRequest("json") 7724 if res != nil && res.StatusCode == http.StatusNotModified { 7725 if res.Body != nil { 7726 res.Body.Close() 7727 } 7728 return nil, &googleapi.Error{ 7729 Code: res.StatusCode, 7730 Header: res.Header, 7731 } 7732 } 7733 if err != nil { 7734 return nil, err 7735 } 7736 defer googleapi.CloseBody(res) 7737 if err := googleapi.CheckResponse(res); err != nil { 7738 return nil, err 7739 } 7740 ret := &PopSettings{ 7741 ServerResponse: googleapi.ServerResponse{ 7742 Header: res.Header, 7743 HTTPStatusCode: res.StatusCode, 7744 }, 7745 } 7746 target := &ret 7747 if err := gensupport.DecodeResponse(target, res); err != nil { 7748 return nil, err 7749 } 7750 return ret, nil 7751 // { 7752 // "description": "Gets POP settings.", 7753 // "flatPath": "gmail/v1/users/{userId}/settings/pop", 7754 // "httpMethod": "GET", 7755 // "id": "gmail.users.settings.getPop", 7756 // "parameterOrder": [ 7757 // "userId" 7758 // ], 7759 // "parameters": { 7760 // "userId": { 7761 // "default": "me", 7762 // "description": "User's email address. The special value \"me\" can be used to indicate the authenticated user.", 7763 // "location": "path", 7764 // "required": true, 7765 // "type": "string" 7766 // } 7767 // }, 7768 // "path": "gmail/v1/users/{userId}/settings/pop", 7769 // "response": { 7770 // "$ref": "PopSettings" 7771 // }, 7772 // "scopes": [ 7773 // "https://mail.google.com/", 7774 // "https://www.googleapis.com/auth/gmail.modify", 7775 // "https://www.googleapis.com/auth/gmail.readonly", 7776 // "https://www.googleapis.com/auth/gmail.settings.basic" 7777 // ] 7778 // } 7779 7780} 7781 7782// method id "gmail.users.settings.getVacation": 7783 7784type UsersSettingsGetVacationCall struct { 7785 s *Service 7786 userId string 7787 urlParams_ gensupport.URLParams 7788 ifNoneMatch_ string 7789 ctx_ context.Context 7790 header_ http.Header 7791} 7792 7793// GetVacation: Gets vacation responder settings. 7794func (r *UsersSettingsService) GetVacation(userId string) *UsersSettingsGetVacationCall { 7795 c := &UsersSettingsGetVacationCall{s: r.s, urlParams_: make(gensupport.URLParams)} 7796 c.userId = userId 7797 return c 7798} 7799 7800// Fields allows partial responses to be retrieved. See 7801// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 7802// for more information. 7803func (c *UsersSettingsGetVacationCall) Fields(s ...googleapi.Field) *UsersSettingsGetVacationCall { 7804 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 7805 return c 7806} 7807 7808// IfNoneMatch sets the optional parameter which makes the operation 7809// fail if the object's ETag matches the given value. This is useful for 7810// getting updates only after the object has changed since the last 7811// request. Use googleapi.IsNotModified to check whether the response 7812// error from Do is the result of In-None-Match. 7813func (c *UsersSettingsGetVacationCall) IfNoneMatch(entityTag string) *UsersSettingsGetVacationCall { 7814 c.ifNoneMatch_ = entityTag 7815 return c 7816} 7817 7818// Context sets the context to be used in this call's Do method. Any 7819// pending HTTP request will be aborted if the provided context is 7820// canceled. 7821func (c *UsersSettingsGetVacationCall) Context(ctx context.Context) *UsersSettingsGetVacationCall { 7822 c.ctx_ = ctx 7823 return c 7824} 7825 7826// Header returns an http.Header that can be modified by the caller to 7827// add HTTP headers to the request. 7828func (c *UsersSettingsGetVacationCall) Header() http.Header { 7829 if c.header_ == nil { 7830 c.header_ = make(http.Header) 7831 } 7832 return c.header_ 7833} 7834 7835func (c *UsersSettingsGetVacationCall) doRequest(alt string) (*http.Response, error) { 7836 reqHeaders := make(http.Header) 7837 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20201124") 7838 for k, v := range c.header_ { 7839 reqHeaders[k] = v 7840 } 7841 reqHeaders.Set("User-Agent", c.s.userAgent()) 7842 if c.ifNoneMatch_ != "" { 7843 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 7844 } 7845 var body io.Reader = nil 7846 c.urlParams_.Set("alt", alt) 7847 c.urlParams_.Set("prettyPrint", "false") 7848 urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/settings/vacation") 7849 urls += "?" + c.urlParams_.Encode() 7850 req, err := http.NewRequest("GET", urls, body) 7851 if err != nil { 7852 return nil, err 7853 } 7854 req.Header = reqHeaders 7855 googleapi.Expand(req.URL, map[string]string{ 7856 "userId": c.userId, 7857 }) 7858 return gensupport.SendRequest(c.ctx_, c.s.client, req) 7859} 7860 7861// Do executes the "gmail.users.settings.getVacation" call. 7862// Exactly one of *VacationSettings or error will be non-nil. Any 7863// non-2xx status code is an error. Response headers are in either 7864// *VacationSettings.ServerResponse.Header or (if a response was 7865// returned at all) in error.(*googleapi.Error).Header. Use 7866// googleapi.IsNotModified to check whether the returned error was 7867// because http.StatusNotModified was returned. 7868func (c *UsersSettingsGetVacationCall) Do(opts ...googleapi.CallOption) (*VacationSettings, error) { 7869 gensupport.SetOptions(c.urlParams_, opts...) 7870 res, err := c.doRequest("json") 7871 if res != nil && res.StatusCode == http.StatusNotModified { 7872 if res.Body != nil { 7873 res.Body.Close() 7874 } 7875 return nil, &googleapi.Error{ 7876 Code: res.StatusCode, 7877 Header: res.Header, 7878 } 7879 } 7880 if err != nil { 7881 return nil, err 7882 } 7883 defer googleapi.CloseBody(res) 7884 if err := googleapi.CheckResponse(res); err != nil { 7885 return nil, err 7886 } 7887 ret := &VacationSettings{ 7888 ServerResponse: googleapi.ServerResponse{ 7889 Header: res.Header, 7890 HTTPStatusCode: res.StatusCode, 7891 }, 7892 } 7893 target := &ret 7894 if err := gensupport.DecodeResponse(target, res); err != nil { 7895 return nil, err 7896 } 7897 return ret, nil 7898 // { 7899 // "description": "Gets vacation responder settings.", 7900 // "flatPath": "gmail/v1/users/{userId}/settings/vacation", 7901 // "httpMethod": "GET", 7902 // "id": "gmail.users.settings.getVacation", 7903 // "parameterOrder": [ 7904 // "userId" 7905 // ], 7906 // "parameters": { 7907 // "userId": { 7908 // "default": "me", 7909 // "description": "User's email address. The special value \"me\" can be used to indicate the authenticated user.", 7910 // "location": "path", 7911 // "required": true, 7912 // "type": "string" 7913 // } 7914 // }, 7915 // "path": "gmail/v1/users/{userId}/settings/vacation", 7916 // "response": { 7917 // "$ref": "VacationSettings" 7918 // }, 7919 // "scopes": [ 7920 // "https://mail.google.com/", 7921 // "https://www.googleapis.com/auth/gmail.modify", 7922 // "https://www.googleapis.com/auth/gmail.readonly", 7923 // "https://www.googleapis.com/auth/gmail.settings.basic" 7924 // ] 7925 // } 7926 7927} 7928 7929// method id "gmail.users.settings.updateAutoForwarding": 7930 7931type UsersSettingsUpdateAutoForwardingCall struct { 7932 s *Service 7933 userId string 7934 autoforwarding *AutoForwarding 7935 urlParams_ gensupport.URLParams 7936 ctx_ context.Context 7937 header_ http.Header 7938} 7939 7940// UpdateAutoForwarding: Updates the auto-forwarding setting for the 7941// specified account. A verified forwarding address must be specified 7942// when auto-forwarding is enabled. This method is only available to 7943// service account clients that have been delegated domain-wide 7944// authority. 7945func (r *UsersSettingsService) UpdateAutoForwarding(userId string, autoforwarding *AutoForwarding) *UsersSettingsUpdateAutoForwardingCall { 7946 c := &UsersSettingsUpdateAutoForwardingCall{s: r.s, urlParams_: make(gensupport.URLParams)} 7947 c.userId = userId 7948 c.autoforwarding = autoforwarding 7949 return c 7950} 7951 7952// Fields allows partial responses to be retrieved. See 7953// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 7954// for more information. 7955func (c *UsersSettingsUpdateAutoForwardingCall) Fields(s ...googleapi.Field) *UsersSettingsUpdateAutoForwardingCall { 7956 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 7957 return c 7958} 7959 7960// Context sets the context to be used in this call's Do method. Any 7961// pending HTTP request will be aborted if the provided context is 7962// canceled. 7963func (c *UsersSettingsUpdateAutoForwardingCall) Context(ctx context.Context) *UsersSettingsUpdateAutoForwardingCall { 7964 c.ctx_ = ctx 7965 return c 7966} 7967 7968// Header returns an http.Header that can be modified by the caller to 7969// add HTTP headers to the request. 7970func (c *UsersSettingsUpdateAutoForwardingCall) Header() http.Header { 7971 if c.header_ == nil { 7972 c.header_ = make(http.Header) 7973 } 7974 return c.header_ 7975} 7976 7977func (c *UsersSettingsUpdateAutoForwardingCall) doRequest(alt string) (*http.Response, error) { 7978 reqHeaders := make(http.Header) 7979 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20201124") 7980 for k, v := range c.header_ { 7981 reqHeaders[k] = v 7982 } 7983 reqHeaders.Set("User-Agent", c.s.userAgent()) 7984 var body io.Reader = nil 7985 body, err := googleapi.WithoutDataWrapper.JSONReader(c.autoforwarding) 7986 if err != nil { 7987 return nil, err 7988 } 7989 reqHeaders.Set("Content-Type", "application/json") 7990 c.urlParams_.Set("alt", alt) 7991 c.urlParams_.Set("prettyPrint", "false") 7992 urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/settings/autoForwarding") 7993 urls += "?" + c.urlParams_.Encode() 7994 req, err := http.NewRequest("PUT", urls, body) 7995 if err != nil { 7996 return nil, err 7997 } 7998 req.Header = reqHeaders 7999 googleapi.Expand(req.URL, map[string]string{ 8000 "userId": c.userId, 8001 }) 8002 return gensupport.SendRequest(c.ctx_, c.s.client, req) 8003} 8004 8005// Do executes the "gmail.users.settings.updateAutoForwarding" call. 8006// Exactly one of *AutoForwarding or error will be non-nil. Any non-2xx 8007// status code is an error. Response headers are in either 8008// *AutoForwarding.ServerResponse.Header or (if a response was returned 8009// at all) in error.(*googleapi.Error).Header. Use 8010// googleapi.IsNotModified to check whether the returned error was 8011// because http.StatusNotModified was returned. 8012func (c *UsersSettingsUpdateAutoForwardingCall) Do(opts ...googleapi.CallOption) (*AutoForwarding, error) { 8013 gensupport.SetOptions(c.urlParams_, opts...) 8014 res, err := c.doRequest("json") 8015 if res != nil && res.StatusCode == http.StatusNotModified { 8016 if res.Body != nil { 8017 res.Body.Close() 8018 } 8019 return nil, &googleapi.Error{ 8020 Code: res.StatusCode, 8021 Header: res.Header, 8022 } 8023 } 8024 if err != nil { 8025 return nil, err 8026 } 8027 defer googleapi.CloseBody(res) 8028 if err := googleapi.CheckResponse(res); err != nil { 8029 return nil, err 8030 } 8031 ret := &AutoForwarding{ 8032 ServerResponse: googleapi.ServerResponse{ 8033 Header: res.Header, 8034 HTTPStatusCode: res.StatusCode, 8035 }, 8036 } 8037 target := &ret 8038 if err := gensupport.DecodeResponse(target, res); err != nil { 8039 return nil, err 8040 } 8041 return ret, nil 8042 // { 8043 // "description": "Updates the auto-forwarding setting for the specified account. A verified forwarding address must be specified when auto-forwarding is enabled. This method is only available to service account clients that have been delegated domain-wide authority.", 8044 // "flatPath": "gmail/v1/users/{userId}/settings/autoForwarding", 8045 // "httpMethod": "PUT", 8046 // "id": "gmail.users.settings.updateAutoForwarding", 8047 // "parameterOrder": [ 8048 // "userId" 8049 // ], 8050 // "parameters": { 8051 // "userId": { 8052 // "default": "me", 8053 // "description": "User's email address. The special value \"me\" can be used to indicate the authenticated user.", 8054 // "location": "path", 8055 // "required": true, 8056 // "type": "string" 8057 // } 8058 // }, 8059 // "path": "gmail/v1/users/{userId}/settings/autoForwarding", 8060 // "request": { 8061 // "$ref": "AutoForwarding" 8062 // }, 8063 // "response": { 8064 // "$ref": "AutoForwarding" 8065 // }, 8066 // "scopes": [ 8067 // "https://www.googleapis.com/auth/gmail.settings.sharing" 8068 // ] 8069 // } 8070 8071} 8072 8073// method id "gmail.users.settings.updateImap": 8074 8075type UsersSettingsUpdateImapCall struct { 8076 s *Service 8077 userId string 8078 imapsettings *ImapSettings 8079 urlParams_ gensupport.URLParams 8080 ctx_ context.Context 8081 header_ http.Header 8082} 8083 8084// UpdateImap: Updates IMAP settings. 8085func (r *UsersSettingsService) UpdateImap(userId string, imapsettings *ImapSettings) *UsersSettingsUpdateImapCall { 8086 c := &UsersSettingsUpdateImapCall{s: r.s, urlParams_: make(gensupport.URLParams)} 8087 c.userId = userId 8088 c.imapsettings = imapsettings 8089 return c 8090} 8091 8092// Fields allows partial responses to be retrieved. See 8093// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 8094// for more information. 8095func (c *UsersSettingsUpdateImapCall) Fields(s ...googleapi.Field) *UsersSettingsUpdateImapCall { 8096 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 8097 return c 8098} 8099 8100// Context sets the context to be used in this call's Do method. Any 8101// pending HTTP request will be aborted if the provided context is 8102// canceled. 8103func (c *UsersSettingsUpdateImapCall) Context(ctx context.Context) *UsersSettingsUpdateImapCall { 8104 c.ctx_ = ctx 8105 return c 8106} 8107 8108// Header returns an http.Header that can be modified by the caller to 8109// add HTTP headers to the request. 8110func (c *UsersSettingsUpdateImapCall) Header() http.Header { 8111 if c.header_ == nil { 8112 c.header_ = make(http.Header) 8113 } 8114 return c.header_ 8115} 8116 8117func (c *UsersSettingsUpdateImapCall) doRequest(alt string) (*http.Response, error) { 8118 reqHeaders := make(http.Header) 8119 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20201124") 8120 for k, v := range c.header_ { 8121 reqHeaders[k] = v 8122 } 8123 reqHeaders.Set("User-Agent", c.s.userAgent()) 8124 var body io.Reader = nil 8125 body, err := googleapi.WithoutDataWrapper.JSONReader(c.imapsettings) 8126 if err != nil { 8127 return nil, err 8128 } 8129 reqHeaders.Set("Content-Type", "application/json") 8130 c.urlParams_.Set("alt", alt) 8131 c.urlParams_.Set("prettyPrint", "false") 8132 urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/settings/imap") 8133 urls += "?" + c.urlParams_.Encode() 8134 req, err := http.NewRequest("PUT", urls, body) 8135 if err != nil { 8136 return nil, err 8137 } 8138 req.Header = reqHeaders 8139 googleapi.Expand(req.URL, map[string]string{ 8140 "userId": c.userId, 8141 }) 8142 return gensupport.SendRequest(c.ctx_, c.s.client, req) 8143} 8144 8145// Do executes the "gmail.users.settings.updateImap" call. 8146// Exactly one of *ImapSettings or error will be non-nil. Any non-2xx 8147// status code is an error. Response headers are in either 8148// *ImapSettings.ServerResponse.Header or (if a response was returned at 8149// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 8150// to check whether the returned error was because 8151// http.StatusNotModified was returned. 8152func (c *UsersSettingsUpdateImapCall) Do(opts ...googleapi.CallOption) (*ImapSettings, error) { 8153 gensupport.SetOptions(c.urlParams_, opts...) 8154 res, err := c.doRequest("json") 8155 if res != nil && res.StatusCode == http.StatusNotModified { 8156 if res.Body != nil { 8157 res.Body.Close() 8158 } 8159 return nil, &googleapi.Error{ 8160 Code: res.StatusCode, 8161 Header: res.Header, 8162 } 8163 } 8164 if err != nil { 8165 return nil, err 8166 } 8167 defer googleapi.CloseBody(res) 8168 if err := googleapi.CheckResponse(res); err != nil { 8169 return nil, err 8170 } 8171 ret := &ImapSettings{ 8172 ServerResponse: googleapi.ServerResponse{ 8173 Header: res.Header, 8174 HTTPStatusCode: res.StatusCode, 8175 }, 8176 } 8177 target := &ret 8178 if err := gensupport.DecodeResponse(target, res); err != nil { 8179 return nil, err 8180 } 8181 return ret, nil 8182 // { 8183 // "description": "Updates IMAP settings.", 8184 // "flatPath": "gmail/v1/users/{userId}/settings/imap", 8185 // "httpMethod": "PUT", 8186 // "id": "gmail.users.settings.updateImap", 8187 // "parameterOrder": [ 8188 // "userId" 8189 // ], 8190 // "parameters": { 8191 // "userId": { 8192 // "default": "me", 8193 // "description": "User's email address. The special value \"me\" can be used to indicate the authenticated user.", 8194 // "location": "path", 8195 // "required": true, 8196 // "type": "string" 8197 // } 8198 // }, 8199 // "path": "gmail/v1/users/{userId}/settings/imap", 8200 // "request": { 8201 // "$ref": "ImapSettings" 8202 // }, 8203 // "response": { 8204 // "$ref": "ImapSettings" 8205 // }, 8206 // "scopes": [ 8207 // "https://www.googleapis.com/auth/gmail.settings.basic" 8208 // ] 8209 // } 8210 8211} 8212 8213// method id "gmail.users.settings.updateLanguage": 8214 8215type UsersSettingsUpdateLanguageCall struct { 8216 s *Service 8217 userId string 8218 languagesettings *LanguageSettings 8219 urlParams_ gensupport.URLParams 8220 ctx_ context.Context 8221 header_ http.Header 8222} 8223 8224// UpdateLanguage: Updates language settings. If successful, the return 8225// object contains the `displayLanguage` that was saved for the user, 8226// which may differ from the value passed into the request. This is 8227// because the requested `displayLanguage` may not be directly supported 8228// by Gmail but have a close variant that is, and so the variant may be 8229// chosen and saved instead. 8230func (r *UsersSettingsService) UpdateLanguage(userId string, languagesettings *LanguageSettings) *UsersSettingsUpdateLanguageCall { 8231 c := &UsersSettingsUpdateLanguageCall{s: r.s, urlParams_: make(gensupport.URLParams)} 8232 c.userId = userId 8233 c.languagesettings = languagesettings 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 *UsersSettingsUpdateLanguageCall) Fields(s ...googleapi.Field) *UsersSettingsUpdateLanguageCall { 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 *UsersSettingsUpdateLanguageCall) Context(ctx context.Context) *UsersSettingsUpdateLanguageCall { 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 *UsersSettingsUpdateLanguageCall) Header() http.Header { 8256 if c.header_ == nil { 8257 c.header_ = make(http.Header) 8258 } 8259 return c.header_ 8260} 8261 8262func (c *UsersSettingsUpdateLanguageCall) doRequest(alt string) (*http.Response, error) { 8263 reqHeaders := make(http.Header) 8264 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20201124") 8265 for k, v := range c.header_ { 8266 reqHeaders[k] = v 8267 } 8268 reqHeaders.Set("User-Agent", c.s.userAgent()) 8269 var body io.Reader = nil 8270 body, err := googleapi.WithoutDataWrapper.JSONReader(c.languagesettings) 8271 if err != nil { 8272 return nil, err 8273 } 8274 reqHeaders.Set("Content-Type", "application/json") 8275 c.urlParams_.Set("alt", alt) 8276 c.urlParams_.Set("prettyPrint", "false") 8277 urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/settings/language") 8278 urls += "?" + c.urlParams_.Encode() 8279 req, err := http.NewRequest("PUT", urls, body) 8280 if err != nil { 8281 return nil, err 8282 } 8283 req.Header = reqHeaders 8284 googleapi.Expand(req.URL, map[string]string{ 8285 "userId": c.userId, 8286 }) 8287 return gensupport.SendRequest(c.ctx_, c.s.client, req) 8288} 8289 8290// Do executes the "gmail.users.settings.updateLanguage" call. 8291// Exactly one of *LanguageSettings or error will be non-nil. Any 8292// non-2xx status code is an error. Response headers are in either 8293// *LanguageSettings.ServerResponse.Header or (if a response was 8294// returned at all) in error.(*googleapi.Error).Header. Use 8295// googleapi.IsNotModified to check whether the returned error was 8296// because http.StatusNotModified was returned. 8297func (c *UsersSettingsUpdateLanguageCall) Do(opts ...googleapi.CallOption) (*LanguageSettings, error) { 8298 gensupport.SetOptions(c.urlParams_, opts...) 8299 res, err := c.doRequest("json") 8300 if res != nil && res.StatusCode == http.StatusNotModified { 8301 if res.Body != nil { 8302 res.Body.Close() 8303 } 8304 return nil, &googleapi.Error{ 8305 Code: res.StatusCode, 8306 Header: res.Header, 8307 } 8308 } 8309 if err != nil { 8310 return nil, err 8311 } 8312 defer googleapi.CloseBody(res) 8313 if err := googleapi.CheckResponse(res); err != nil { 8314 return nil, err 8315 } 8316 ret := &LanguageSettings{ 8317 ServerResponse: googleapi.ServerResponse{ 8318 Header: res.Header, 8319 HTTPStatusCode: res.StatusCode, 8320 }, 8321 } 8322 target := &ret 8323 if err := gensupport.DecodeResponse(target, res); err != nil { 8324 return nil, err 8325 } 8326 return ret, nil 8327 // { 8328 // "description": "Updates language settings. If successful, the return object contains the `displayLanguage` that was saved for the user, which may differ from the value passed into the request. This is because the requested `displayLanguage` may not be directly supported by Gmail but have a close variant that is, and so the variant may be chosen and saved instead.", 8329 // "flatPath": "gmail/v1/users/{userId}/settings/language", 8330 // "httpMethod": "PUT", 8331 // "id": "gmail.users.settings.updateLanguage", 8332 // "parameterOrder": [ 8333 // "userId" 8334 // ], 8335 // "parameters": { 8336 // "userId": { 8337 // "default": "me", 8338 // "description": "User's email address. The special value \"me\" can be used to indicate the authenticated user.", 8339 // "location": "path", 8340 // "required": true, 8341 // "type": "string" 8342 // } 8343 // }, 8344 // "path": "gmail/v1/users/{userId}/settings/language", 8345 // "request": { 8346 // "$ref": "LanguageSettings" 8347 // }, 8348 // "response": { 8349 // "$ref": "LanguageSettings" 8350 // }, 8351 // "scopes": [ 8352 // "https://www.googleapis.com/auth/gmail.settings.basic" 8353 // ] 8354 // } 8355 8356} 8357 8358// method id "gmail.users.settings.updatePop": 8359 8360type UsersSettingsUpdatePopCall struct { 8361 s *Service 8362 userId string 8363 popsettings *PopSettings 8364 urlParams_ gensupport.URLParams 8365 ctx_ context.Context 8366 header_ http.Header 8367} 8368 8369// UpdatePop: Updates POP settings. 8370func (r *UsersSettingsService) UpdatePop(userId string, popsettings *PopSettings) *UsersSettingsUpdatePopCall { 8371 c := &UsersSettingsUpdatePopCall{s: r.s, urlParams_: make(gensupport.URLParams)} 8372 c.userId = userId 8373 c.popsettings = popsettings 8374 return c 8375} 8376 8377// Fields allows partial responses to be retrieved. See 8378// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 8379// for more information. 8380func (c *UsersSettingsUpdatePopCall) Fields(s ...googleapi.Field) *UsersSettingsUpdatePopCall { 8381 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 8382 return c 8383} 8384 8385// Context sets the context to be used in this call's Do method. Any 8386// pending HTTP request will be aborted if the provided context is 8387// canceled. 8388func (c *UsersSettingsUpdatePopCall) Context(ctx context.Context) *UsersSettingsUpdatePopCall { 8389 c.ctx_ = ctx 8390 return c 8391} 8392 8393// Header returns an http.Header that can be modified by the caller to 8394// add HTTP headers to the request. 8395func (c *UsersSettingsUpdatePopCall) Header() http.Header { 8396 if c.header_ == nil { 8397 c.header_ = make(http.Header) 8398 } 8399 return c.header_ 8400} 8401 8402func (c *UsersSettingsUpdatePopCall) doRequest(alt string) (*http.Response, error) { 8403 reqHeaders := make(http.Header) 8404 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20201124") 8405 for k, v := range c.header_ { 8406 reqHeaders[k] = v 8407 } 8408 reqHeaders.Set("User-Agent", c.s.userAgent()) 8409 var body io.Reader = nil 8410 body, err := googleapi.WithoutDataWrapper.JSONReader(c.popsettings) 8411 if err != nil { 8412 return nil, err 8413 } 8414 reqHeaders.Set("Content-Type", "application/json") 8415 c.urlParams_.Set("alt", alt) 8416 c.urlParams_.Set("prettyPrint", "false") 8417 urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/settings/pop") 8418 urls += "?" + c.urlParams_.Encode() 8419 req, err := http.NewRequest("PUT", urls, body) 8420 if err != nil { 8421 return nil, err 8422 } 8423 req.Header = reqHeaders 8424 googleapi.Expand(req.URL, map[string]string{ 8425 "userId": c.userId, 8426 }) 8427 return gensupport.SendRequest(c.ctx_, c.s.client, req) 8428} 8429 8430// Do executes the "gmail.users.settings.updatePop" call. 8431// Exactly one of *PopSettings or error will be non-nil. Any non-2xx 8432// status code is an error. Response headers are in either 8433// *PopSettings.ServerResponse.Header or (if a response was returned at 8434// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 8435// to check whether the returned error was because 8436// http.StatusNotModified was returned. 8437func (c *UsersSettingsUpdatePopCall) Do(opts ...googleapi.CallOption) (*PopSettings, error) { 8438 gensupport.SetOptions(c.urlParams_, opts...) 8439 res, err := c.doRequest("json") 8440 if res != nil && res.StatusCode == http.StatusNotModified { 8441 if res.Body != nil { 8442 res.Body.Close() 8443 } 8444 return nil, &googleapi.Error{ 8445 Code: res.StatusCode, 8446 Header: res.Header, 8447 } 8448 } 8449 if err != nil { 8450 return nil, err 8451 } 8452 defer googleapi.CloseBody(res) 8453 if err := googleapi.CheckResponse(res); err != nil { 8454 return nil, err 8455 } 8456 ret := &PopSettings{ 8457 ServerResponse: googleapi.ServerResponse{ 8458 Header: res.Header, 8459 HTTPStatusCode: res.StatusCode, 8460 }, 8461 } 8462 target := &ret 8463 if err := gensupport.DecodeResponse(target, res); err != nil { 8464 return nil, err 8465 } 8466 return ret, nil 8467 // { 8468 // "description": "Updates POP settings.", 8469 // "flatPath": "gmail/v1/users/{userId}/settings/pop", 8470 // "httpMethod": "PUT", 8471 // "id": "gmail.users.settings.updatePop", 8472 // "parameterOrder": [ 8473 // "userId" 8474 // ], 8475 // "parameters": { 8476 // "userId": { 8477 // "default": "me", 8478 // "description": "User's email address. The special value \"me\" can be used to indicate the authenticated user.", 8479 // "location": "path", 8480 // "required": true, 8481 // "type": "string" 8482 // } 8483 // }, 8484 // "path": "gmail/v1/users/{userId}/settings/pop", 8485 // "request": { 8486 // "$ref": "PopSettings" 8487 // }, 8488 // "response": { 8489 // "$ref": "PopSettings" 8490 // }, 8491 // "scopes": [ 8492 // "https://www.googleapis.com/auth/gmail.settings.basic" 8493 // ] 8494 // } 8495 8496} 8497 8498// method id "gmail.users.settings.updateVacation": 8499 8500type UsersSettingsUpdateVacationCall struct { 8501 s *Service 8502 userId string 8503 vacationsettings *VacationSettings 8504 urlParams_ gensupport.URLParams 8505 ctx_ context.Context 8506 header_ http.Header 8507} 8508 8509// UpdateVacation: Updates vacation responder settings. 8510func (r *UsersSettingsService) UpdateVacation(userId string, vacationsettings *VacationSettings) *UsersSettingsUpdateVacationCall { 8511 c := &UsersSettingsUpdateVacationCall{s: r.s, urlParams_: make(gensupport.URLParams)} 8512 c.userId = userId 8513 c.vacationsettings = vacationsettings 8514 return c 8515} 8516 8517// Fields allows partial responses to be retrieved. See 8518// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 8519// for more information. 8520func (c *UsersSettingsUpdateVacationCall) Fields(s ...googleapi.Field) *UsersSettingsUpdateVacationCall { 8521 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 8522 return c 8523} 8524 8525// Context sets the context to be used in this call's Do method. Any 8526// pending HTTP request will be aborted if the provided context is 8527// canceled. 8528func (c *UsersSettingsUpdateVacationCall) Context(ctx context.Context) *UsersSettingsUpdateVacationCall { 8529 c.ctx_ = ctx 8530 return c 8531} 8532 8533// Header returns an http.Header that can be modified by the caller to 8534// add HTTP headers to the request. 8535func (c *UsersSettingsUpdateVacationCall) Header() http.Header { 8536 if c.header_ == nil { 8537 c.header_ = make(http.Header) 8538 } 8539 return c.header_ 8540} 8541 8542func (c *UsersSettingsUpdateVacationCall) doRequest(alt string) (*http.Response, error) { 8543 reqHeaders := make(http.Header) 8544 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20201124") 8545 for k, v := range c.header_ { 8546 reqHeaders[k] = v 8547 } 8548 reqHeaders.Set("User-Agent", c.s.userAgent()) 8549 var body io.Reader = nil 8550 body, err := googleapi.WithoutDataWrapper.JSONReader(c.vacationsettings) 8551 if err != nil { 8552 return nil, err 8553 } 8554 reqHeaders.Set("Content-Type", "application/json") 8555 c.urlParams_.Set("alt", alt) 8556 c.urlParams_.Set("prettyPrint", "false") 8557 urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/settings/vacation") 8558 urls += "?" + c.urlParams_.Encode() 8559 req, err := http.NewRequest("PUT", urls, body) 8560 if err != nil { 8561 return nil, err 8562 } 8563 req.Header = reqHeaders 8564 googleapi.Expand(req.URL, map[string]string{ 8565 "userId": c.userId, 8566 }) 8567 return gensupport.SendRequest(c.ctx_, c.s.client, req) 8568} 8569 8570// Do executes the "gmail.users.settings.updateVacation" call. 8571// Exactly one of *VacationSettings or error will be non-nil. Any 8572// non-2xx status code is an error. Response headers are in either 8573// *VacationSettings.ServerResponse.Header or (if a response was 8574// returned at all) in error.(*googleapi.Error).Header. Use 8575// googleapi.IsNotModified to check whether the returned error was 8576// because http.StatusNotModified was returned. 8577func (c *UsersSettingsUpdateVacationCall) Do(opts ...googleapi.CallOption) (*VacationSettings, error) { 8578 gensupport.SetOptions(c.urlParams_, opts...) 8579 res, err := c.doRequest("json") 8580 if res != nil && res.StatusCode == http.StatusNotModified { 8581 if res.Body != nil { 8582 res.Body.Close() 8583 } 8584 return nil, &googleapi.Error{ 8585 Code: res.StatusCode, 8586 Header: res.Header, 8587 } 8588 } 8589 if err != nil { 8590 return nil, err 8591 } 8592 defer googleapi.CloseBody(res) 8593 if err := googleapi.CheckResponse(res); err != nil { 8594 return nil, err 8595 } 8596 ret := &VacationSettings{ 8597 ServerResponse: googleapi.ServerResponse{ 8598 Header: res.Header, 8599 HTTPStatusCode: res.StatusCode, 8600 }, 8601 } 8602 target := &ret 8603 if err := gensupport.DecodeResponse(target, res); err != nil { 8604 return nil, err 8605 } 8606 return ret, nil 8607 // { 8608 // "description": "Updates vacation responder settings.", 8609 // "flatPath": "gmail/v1/users/{userId}/settings/vacation", 8610 // "httpMethod": "PUT", 8611 // "id": "gmail.users.settings.updateVacation", 8612 // "parameterOrder": [ 8613 // "userId" 8614 // ], 8615 // "parameters": { 8616 // "userId": { 8617 // "default": "me", 8618 // "description": "User's email address. The special value \"me\" can be used to indicate the authenticated user.", 8619 // "location": "path", 8620 // "required": true, 8621 // "type": "string" 8622 // } 8623 // }, 8624 // "path": "gmail/v1/users/{userId}/settings/vacation", 8625 // "request": { 8626 // "$ref": "VacationSettings" 8627 // }, 8628 // "response": { 8629 // "$ref": "VacationSettings" 8630 // }, 8631 // "scopes": [ 8632 // "https://www.googleapis.com/auth/gmail.settings.basic" 8633 // ] 8634 // } 8635 8636} 8637 8638// method id "gmail.users.settings.delegates.create": 8639 8640type UsersSettingsDelegatesCreateCall struct { 8641 s *Service 8642 userId string 8643 delegate *Delegate 8644 urlParams_ gensupport.URLParams 8645 ctx_ context.Context 8646 header_ http.Header 8647} 8648 8649// Create: Adds a delegate with its verification status set directly to 8650// `accepted`, without sending any verification email. The delegate user 8651// must be a member of the same G Suite organization as the delegator 8652// user. Gmail imposes limitations on the number of delegates and 8653// delegators each user in a G Suite organization can have. These limits 8654// depend on your organization, but in general each user can have up to 8655// 25 delegates and up to 10 delegators. Note that a delegate user must 8656// be referred to by their primary email address, and not an email 8657// alias. Also note that when a new delegate is created, there may be up 8658// to a one minute delay before the new delegate is available for use. 8659// This method is only available to service account clients that have 8660// been delegated domain-wide authority. 8661func (r *UsersSettingsDelegatesService) Create(userId string, delegate *Delegate) *UsersSettingsDelegatesCreateCall { 8662 c := &UsersSettingsDelegatesCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)} 8663 c.userId = userId 8664 c.delegate = delegate 8665 return c 8666} 8667 8668// Fields allows partial responses to be retrieved. See 8669// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 8670// for more information. 8671func (c *UsersSettingsDelegatesCreateCall) Fields(s ...googleapi.Field) *UsersSettingsDelegatesCreateCall { 8672 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 8673 return c 8674} 8675 8676// Context sets the context to be used in this call's Do method. Any 8677// pending HTTP request will be aborted if the provided context is 8678// canceled. 8679func (c *UsersSettingsDelegatesCreateCall) Context(ctx context.Context) *UsersSettingsDelegatesCreateCall { 8680 c.ctx_ = ctx 8681 return c 8682} 8683 8684// Header returns an http.Header that can be modified by the caller to 8685// add HTTP headers to the request. 8686func (c *UsersSettingsDelegatesCreateCall) Header() http.Header { 8687 if c.header_ == nil { 8688 c.header_ = make(http.Header) 8689 } 8690 return c.header_ 8691} 8692 8693func (c *UsersSettingsDelegatesCreateCall) doRequest(alt string) (*http.Response, error) { 8694 reqHeaders := make(http.Header) 8695 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20201124") 8696 for k, v := range c.header_ { 8697 reqHeaders[k] = v 8698 } 8699 reqHeaders.Set("User-Agent", c.s.userAgent()) 8700 var body io.Reader = nil 8701 body, err := googleapi.WithoutDataWrapper.JSONReader(c.delegate) 8702 if err != nil { 8703 return nil, err 8704 } 8705 reqHeaders.Set("Content-Type", "application/json") 8706 c.urlParams_.Set("alt", alt) 8707 c.urlParams_.Set("prettyPrint", "false") 8708 urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/settings/delegates") 8709 urls += "?" + c.urlParams_.Encode() 8710 req, err := http.NewRequest("POST", urls, body) 8711 if err != nil { 8712 return nil, err 8713 } 8714 req.Header = reqHeaders 8715 googleapi.Expand(req.URL, map[string]string{ 8716 "userId": c.userId, 8717 }) 8718 return gensupport.SendRequest(c.ctx_, c.s.client, req) 8719} 8720 8721// Do executes the "gmail.users.settings.delegates.create" call. 8722// Exactly one of *Delegate or error will be non-nil. Any non-2xx status 8723// code is an error. Response headers are in either 8724// *Delegate.ServerResponse.Header or (if a response was returned at 8725// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 8726// to check whether the returned error was because 8727// http.StatusNotModified was returned. 8728func (c *UsersSettingsDelegatesCreateCall) Do(opts ...googleapi.CallOption) (*Delegate, error) { 8729 gensupport.SetOptions(c.urlParams_, opts...) 8730 res, err := c.doRequest("json") 8731 if res != nil && res.StatusCode == http.StatusNotModified { 8732 if res.Body != nil { 8733 res.Body.Close() 8734 } 8735 return nil, &googleapi.Error{ 8736 Code: res.StatusCode, 8737 Header: res.Header, 8738 } 8739 } 8740 if err != nil { 8741 return nil, err 8742 } 8743 defer googleapi.CloseBody(res) 8744 if err := googleapi.CheckResponse(res); err != nil { 8745 return nil, err 8746 } 8747 ret := &Delegate{ 8748 ServerResponse: googleapi.ServerResponse{ 8749 Header: res.Header, 8750 HTTPStatusCode: res.StatusCode, 8751 }, 8752 } 8753 target := &ret 8754 if err := gensupport.DecodeResponse(target, res); err != nil { 8755 return nil, err 8756 } 8757 return ret, nil 8758 // { 8759 // "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. Gmail imposes limitations on the number of delegates and delegators each user in a G Suite organization can have. These limits depend on your organization, but in general each user can have up to 25 delegates and up to 10 delegators. Note that a delegate user must be referred to by their primary email address, and not an email alias. Also note that when a new delegate is created, there may be up to a one minute delay before the new delegate is available for use. This method is only available to service account clients that have been delegated domain-wide authority.", 8760 // "flatPath": "gmail/v1/users/{userId}/settings/delegates", 8761 // "httpMethod": "POST", 8762 // "id": "gmail.users.settings.delegates.create", 8763 // "parameterOrder": [ 8764 // "userId" 8765 // ], 8766 // "parameters": { 8767 // "userId": { 8768 // "default": "me", 8769 // "description": "User's email address. The special value \"me\" can be used to indicate the authenticated user.", 8770 // "location": "path", 8771 // "required": true, 8772 // "type": "string" 8773 // } 8774 // }, 8775 // "path": "gmail/v1/users/{userId}/settings/delegates", 8776 // "request": { 8777 // "$ref": "Delegate" 8778 // }, 8779 // "response": { 8780 // "$ref": "Delegate" 8781 // }, 8782 // "scopes": [ 8783 // "https://www.googleapis.com/auth/gmail.settings.sharing" 8784 // ] 8785 // } 8786 8787} 8788 8789// method id "gmail.users.settings.delegates.delete": 8790 8791type UsersSettingsDelegatesDeleteCall struct { 8792 s *Service 8793 userId string 8794 delegateEmail string 8795 urlParams_ gensupport.URLParams 8796 ctx_ context.Context 8797 header_ http.Header 8798} 8799 8800// Delete: Removes the specified delegate (which can be of any 8801// verification status), and revokes any verification that may have been 8802// required for using it. Note that a delegate user must be referred to 8803// by their primary email address, and not an email alias. This method 8804// is only available to service account clients that have been delegated 8805// domain-wide authority. 8806func (r *UsersSettingsDelegatesService) Delete(userId string, delegateEmail string) *UsersSettingsDelegatesDeleteCall { 8807 c := &UsersSettingsDelegatesDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)} 8808 c.userId = userId 8809 c.delegateEmail = delegateEmail 8810 return c 8811} 8812 8813// Fields allows partial responses to be retrieved. See 8814// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 8815// for more information. 8816func (c *UsersSettingsDelegatesDeleteCall) Fields(s ...googleapi.Field) *UsersSettingsDelegatesDeleteCall { 8817 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 8818 return c 8819} 8820 8821// Context sets the context to be used in this call's Do method. Any 8822// pending HTTP request will be aborted if the provided context is 8823// canceled. 8824func (c *UsersSettingsDelegatesDeleteCall) Context(ctx context.Context) *UsersSettingsDelegatesDeleteCall { 8825 c.ctx_ = ctx 8826 return c 8827} 8828 8829// Header returns an http.Header that can be modified by the caller to 8830// add HTTP headers to the request. 8831func (c *UsersSettingsDelegatesDeleteCall) Header() http.Header { 8832 if c.header_ == nil { 8833 c.header_ = make(http.Header) 8834 } 8835 return c.header_ 8836} 8837 8838func (c *UsersSettingsDelegatesDeleteCall) doRequest(alt string) (*http.Response, error) { 8839 reqHeaders := make(http.Header) 8840 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20201124") 8841 for k, v := range c.header_ { 8842 reqHeaders[k] = v 8843 } 8844 reqHeaders.Set("User-Agent", c.s.userAgent()) 8845 var body io.Reader = nil 8846 c.urlParams_.Set("alt", alt) 8847 c.urlParams_.Set("prettyPrint", "false") 8848 urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/settings/delegates/{delegateEmail}") 8849 urls += "?" + c.urlParams_.Encode() 8850 req, err := http.NewRequest("DELETE", urls, body) 8851 if err != nil { 8852 return nil, err 8853 } 8854 req.Header = reqHeaders 8855 googleapi.Expand(req.URL, map[string]string{ 8856 "userId": c.userId, 8857 "delegateEmail": c.delegateEmail, 8858 }) 8859 return gensupport.SendRequest(c.ctx_, c.s.client, req) 8860} 8861 8862// Do executes the "gmail.users.settings.delegates.delete" call. 8863func (c *UsersSettingsDelegatesDeleteCall) Do(opts ...googleapi.CallOption) error { 8864 gensupport.SetOptions(c.urlParams_, opts...) 8865 res, err := c.doRequest("json") 8866 if err != nil { 8867 return err 8868 } 8869 defer googleapi.CloseBody(res) 8870 if err := googleapi.CheckResponse(res); err != nil { 8871 return err 8872 } 8873 return nil 8874 // { 8875 // "description": "Removes the specified delegate (which can be of any verification status), and revokes any verification that may have been required for using it. Note that a delegate user must be referred to by their primary email address, and not an email alias. This method is only available to service account clients that have been delegated domain-wide authority.", 8876 // "flatPath": "gmail/v1/users/{userId}/settings/delegates/{delegateEmail}", 8877 // "httpMethod": "DELETE", 8878 // "id": "gmail.users.settings.delegates.delete", 8879 // "parameterOrder": [ 8880 // "userId", 8881 // "delegateEmail" 8882 // ], 8883 // "parameters": { 8884 // "delegateEmail": { 8885 // "description": "The email address of the user to be removed as a delegate.", 8886 // "location": "path", 8887 // "required": true, 8888 // "type": "string" 8889 // }, 8890 // "userId": { 8891 // "default": "me", 8892 // "description": "User's email address. The special value \"me\" can be used to indicate the authenticated user.", 8893 // "location": "path", 8894 // "required": true, 8895 // "type": "string" 8896 // } 8897 // }, 8898 // "path": "gmail/v1/users/{userId}/settings/delegates/{delegateEmail}", 8899 // "scopes": [ 8900 // "https://www.googleapis.com/auth/gmail.settings.sharing" 8901 // ] 8902 // } 8903 8904} 8905 8906// method id "gmail.users.settings.delegates.get": 8907 8908type UsersSettingsDelegatesGetCall struct { 8909 s *Service 8910 userId string 8911 delegateEmail string 8912 urlParams_ gensupport.URLParams 8913 ifNoneMatch_ string 8914 ctx_ context.Context 8915 header_ http.Header 8916} 8917 8918// Get: Gets the specified delegate. Note that a delegate user must be 8919// referred to by their primary email address, and not an email alias. 8920// This method is only available to service account clients that have 8921// been delegated domain-wide authority. 8922func (r *UsersSettingsDelegatesService) Get(userId string, delegateEmail string) *UsersSettingsDelegatesGetCall { 8923 c := &UsersSettingsDelegatesGetCall{s: r.s, urlParams_: make(gensupport.URLParams)} 8924 c.userId = userId 8925 c.delegateEmail = delegateEmail 8926 return c 8927} 8928 8929// Fields allows partial responses to be retrieved. See 8930// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 8931// for more information. 8932func (c *UsersSettingsDelegatesGetCall) Fields(s ...googleapi.Field) *UsersSettingsDelegatesGetCall { 8933 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 8934 return c 8935} 8936 8937// IfNoneMatch sets the optional parameter which makes the operation 8938// fail if the object's ETag matches the given value. This is useful for 8939// getting updates only after the object has changed since the last 8940// request. Use googleapi.IsNotModified to check whether the response 8941// error from Do is the result of In-None-Match. 8942func (c *UsersSettingsDelegatesGetCall) IfNoneMatch(entityTag string) *UsersSettingsDelegatesGetCall { 8943 c.ifNoneMatch_ = entityTag 8944 return c 8945} 8946 8947// Context sets the context to be used in this call's Do method. Any 8948// pending HTTP request will be aborted if the provided context is 8949// canceled. 8950func (c *UsersSettingsDelegatesGetCall) Context(ctx context.Context) *UsersSettingsDelegatesGetCall { 8951 c.ctx_ = ctx 8952 return c 8953} 8954 8955// Header returns an http.Header that can be modified by the caller to 8956// add HTTP headers to the request. 8957func (c *UsersSettingsDelegatesGetCall) Header() http.Header { 8958 if c.header_ == nil { 8959 c.header_ = make(http.Header) 8960 } 8961 return c.header_ 8962} 8963 8964func (c *UsersSettingsDelegatesGetCall) doRequest(alt string) (*http.Response, error) { 8965 reqHeaders := make(http.Header) 8966 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20201124") 8967 for k, v := range c.header_ { 8968 reqHeaders[k] = v 8969 } 8970 reqHeaders.Set("User-Agent", c.s.userAgent()) 8971 if c.ifNoneMatch_ != "" { 8972 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 8973 } 8974 var body io.Reader = nil 8975 c.urlParams_.Set("alt", alt) 8976 c.urlParams_.Set("prettyPrint", "false") 8977 urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/settings/delegates/{delegateEmail}") 8978 urls += "?" + c.urlParams_.Encode() 8979 req, err := http.NewRequest("GET", urls, body) 8980 if err != nil { 8981 return nil, err 8982 } 8983 req.Header = reqHeaders 8984 googleapi.Expand(req.URL, map[string]string{ 8985 "userId": c.userId, 8986 "delegateEmail": c.delegateEmail, 8987 }) 8988 return gensupport.SendRequest(c.ctx_, c.s.client, req) 8989} 8990 8991// Do executes the "gmail.users.settings.delegates.get" call. 8992// Exactly one of *Delegate or error will be non-nil. Any non-2xx status 8993// code is an error. Response headers are in either 8994// *Delegate.ServerResponse.Header or (if a response was returned at 8995// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 8996// to check whether the returned error was because 8997// http.StatusNotModified was returned. 8998func (c *UsersSettingsDelegatesGetCall) Do(opts ...googleapi.CallOption) (*Delegate, error) { 8999 gensupport.SetOptions(c.urlParams_, opts...) 9000 res, err := c.doRequest("json") 9001 if res != nil && res.StatusCode == http.StatusNotModified { 9002 if res.Body != nil { 9003 res.Body.Close() 9004 } 9005 return nil, &googleapi.Error{ 9006 Code: res.StatusCode, 9007 Header: res.Header, 9008 } 9009 } 9010 if err != nil { 9011 return nil, err 9012 } 9013 defer googleapi.CloseBody(res) 9014 if err := googleapi.CheckResponse(res); err != nil { 9015 return nil, err 9016 } 9017 ret := &Delegate{ 9018 ServerResponse: googleapi.ServerResponse{ 9019 Header: res.Header, 9020 HTTPStatusCode: res.StatusCode, 9021 }, 9022 } 9023 target := &ret 9024 if err := gensupport.DecodeResponse(target, res); err != nil { 9025 return nil, err 9026 } 9027 return ret, nil 9028 // { 9029 // "description": "Gets the specified delegate. Note that a delegate user must be referred to by their primary email address, and not an email alias. This method is only available to service account clients that have been delegated domain-wide authority.", 9030 // "flatPath": "gmail/v1/users/{userId}/settings/delegates/{delegateEmail}", 9031 // "httpMethod": "GET", 9032 // "id": "gmail.users.settings.delegates.get", 9033 // "parameterOrder": [ 9034 // "userId", 9035 // "delegateEmail" 9036 // ], 9037 // "parameters": { 9038 // "delegateEmail": { 9039 // "description": "The email address of the user whose delegate relationship is to be retrieved.", 9040 // "location": "path", 9041 // "required": true, 9042 // "type": "string" 9043 // }, 9044 // "userId": { 9045 // "default": "me", 9046 // "description": "User's email address. The special value \"me\" can be used to indicate the authenticated user.", 9047 // "location": "path", 9048 // "required": true, 9049 // "type": "string" 9050 // } 9051 // }, 9052 // "path": "gmail/v1/users/{userId}/settings/delegates/{delegateEmail}", 9053 // "response": { 9054 // "$ref": "Delegate" 9055 // }, 9056 // "scopes": [ 9057 // "https://mail.google.com/", 9058 // "https://www.googleapis.com/auth/gmail.modify", 9059 // "https://www.googleapis.com/auth/gmail.readonly", 9060 // "https://www.googleapis.com/auth/gmail.settings.basic" 9061 // ] 9062 // } 9063 9064} 9065 9066// method id "gmail.users.settings.delegates.list": 9067 9068type UsersSettingsDelegatesListCall struct { 9069 s *Service 9070 userId string 9071 urlParams_ gensupport.URLParams 9072 ifNoneMatch_ string 9073 ctx_ context.Context 9074 header_ http.Header 9075} 9076 9077// List: Lists the delegates for the specified account. This method is 9078// only available to service account clients that have been delegated 9079// domain-wide authority. 9080func (r *UsersSettingsDelegatesService) List(userId string) *UsersSettingsDelegatesListCall { 9081 c := &UsersSettingsDelegatesListCall{s: r.s, urlParams_: make(gensupport.URLParams)} 9082 c.userId = userId 9083 return c 9084} 9085 9086// Fields allows partial responses to be retrieved. See 9087// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 9088// for more information. 9089func (c *UsersSettingsDelegatesListCall) Fields(s ...googleapi.Field) *UsersSettingsDelegatesListCall { 9090 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 9091 return c 9092} 9093 9094// IfNoneMatch sets the optional parameter which makes the operation 9095// fail if the object's ETag matches the given value. This is useful for 9096// getting updates only after the object has changed since the last 9097// request. Use googleapi.IsNotModified to check whether the response 9098// error from Do is the result of In-None-Match. 9099func (c *UsersSettingsDelegatesListCall) IfNoneMatch(entityTag string) *UsersSettingsDelegatesListCall { 9100 c.ifNoneMatch_ = entityTag 9101 return c 9102} 9103 9104// Context sets the context to be used in this call's Do method. Any 9105// pending HTTP request will be aborted if the provided context is 9106// canceled. 9107func (c *UsersSettingsDelegatesListCall) Context(ctx context.Context) *UsersSettingsDelegatesListCall { 9108 c.ctx_ = ctx 9109 return c 9110} 9111 9112// Header returns an http.Header that can be modified by the caller to 9113// add HTTP headers to the request. 9114func (c *UsersSettingsDelegatesListCall) Header() http.Header { 9115 if c.header_ == nil { 9116 c.header_ = make(http.Header) 9117 } 9118 return c.header_ 9119} 9120 9121func (c *UsersSettingsDelegatesListCall) doRequest(alt string) (*http.Response, error) { 9122 reqHeaders := make(http.Header) 9123 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20201124") 9124 for k, v := range c.header_ { 9125 reqHeaders[k] = v 9126 } 9127 reqHeaders.Set("User-Agent", c.s.userAgent()) 9128 if c.ifNoneMatch_ != "" { 9129 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 9130 } 9131 var body io.Reader = nil 9132 c.urlParams_.Set("alt", alt) 9133 c.urlParams_.Set("prettyPrint", "false") 9134 urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/settings/delegates") 9135 urls += "?" + c.urlParams_.Encode() 9136 req, err := http.NewRequest("GET", 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.delegates.list" call. 9148// Exactly one of *ListDelegatesResponse or error will be non-nil. Any 9149// non-2xx status code is an error. Response headers are in either 9150// *ListDelegatesResponse.ServerResponse.Header or (if a response was 9151// returned at all) in error.(*googleapi.Error).Header. Use 9152// googleapi.IsNotModified to check whether the returned error was 9153// because http.StatusNotModified was returned. 9154func (c *UsersSettingsDelegatesListCall) Do(opts ...googleapi.CallOption) (*ListDelegatesResponse, 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 := &ListDelegatesResponse{ 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": "Lists the delegates for the specified account. This method is only available to service account clients that have been delegated domain-wide authority.", 9186 // "flatPath": "gmail/v1/users/{userId}/settings/delegates", 9187 // "httpMethod": "GET", 9188 // "id": "gmail.users.settings.delegates.list", 9189 // "parameterOrder": [ 9190 // "userId" 9191 // ], 9192 // "parameters": { 9193 // "userId": { 9194 // "default": "me", 9195 // "description": "User's email address. The special value \"me\" can be used to indicate the authenticated user.", 9196 // "location": "path", 9197 // "required": true, 9198 // "type": "string" 9199 // } 9200 // }, 9201 // "path": "gmail/v1/users/{userId}/settings/delegates", 9202 // "response": { 9203 // "$ref": "ListDelegatesResponse" 9204 // }, 9205 // "scopes": [ 9206 // "https://mail.google.com/", 9207 // "https://www.googleapis.com/auth/gmail.modify", 9208 // "https://www.googleapis.com/auth/gmail.readonly", 9209 // "https://www.googleapis.com/auth/gmail.settings.basic" 9210 // ] 9211 // } 9212 9213} 9214 9215// method id "gmail.users.settings.filters.create": 9216 9217type UsersSettingsFiltersCreateCall struct { 9218 s *Service 9219 userId string 9220 filter *Filter 9221 urlParams_ gensupport.URLParams 9222 ctx_ context.Context 9223 header_ http.Header 9224} 9225 9226// Create: Creates a filter. Note: you can only create a maximum of 9227// 1,000 filters. 9228func (r *UsersSettingsFiltersService) Create(userId string, filter *Filter) *UsersSettingsFiltersCreateCall { 9229 c := &UsersSettingsFiltersCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)} 9230 c.userId = userId 9231 c.filter = filter 9232 return c 9233} 9234 9235// Fields allows partial responses to be retrieved. See 9236// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 9237// for more information. 9238func (c *UsersSettingsFiltersCreateCall) Fields(s ...googleapi.Field) *UsersSettingsFiltersCreateCall { 9239 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 9240 return c 9241} 9242 9243// Context sets the context to be used in this call's Do method. Any 9244// pending HTTP request will be aborted if the provided context is 9245// canceled. 9246func (c *UsersSettingsFiltersCreateCall) Context(ctx context.Context) *UsersSettingsFiltersCreateCall { 9247 c.ctx_ = ctx 9248 return c 9249} 9250 9251// Header returns an http.Header that can be modified by the caller to 9252// add HTTP headers to the request. 9253func (c *UsersSettingsFiltersCreateCall) Header() http.Header { 9254 if c.header_ == nil { 9255 c.header_ = make(http.Header) 9256 } 9257 return c.header_ 9258} 9259 9260func (c *UsersSettingsFiltersCreateCall) doRequest(alt string) (*http.Response, error) { 9261 reqHeaders := make(http.Header) 9262 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20201124") 9263 for k, v := range c.header_ { 9264 reqHeaders[k] = v 9265 } 9266 reqHeaders.Set("User-Agent", c.s.userAgent()) 9267 var body io.Reader = nil 9268 body, err := googleapi.WithoutDataWrapper.JSONReader(c.filter) 9269 if err != nil { 9270 return nil, err 9271 } 9272 reqHeaders.Set("Content-Type", "application/json") 9273 c.urlParams_.Set("alt", alt) 9274 c.urlParams_.Set("prettyPrint", "false") 9275 urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/settings/filters") 9276 urls += "?" + c.urlParams_.Encode() 9277 req, err := http.NewRequest("POST", urls, body) 9278 if err != nil { 9279 return nil, err 9280 } 9281 req.Header = reqHeaders 9282 googleapi.Expand(req.URL, map[string]string{ 9283 "userId": c.userId, 9284 }) 9285 return gensupport.SendRequest(c.ctx_, c.s.client, req) 9286} 9287 9288// Do executes the "gmail.users.settings.filters.create" call. 9289// Exactly one of *Filter or error will be non-nil. Any non-2xx status 9290// code is an error. Response headers are in either 9291// *Filter.ServerResponse.Header or (if a response was returned at all) 9292// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 9293// check whether the returned error was because http.StatusNotModified 9294// was returned. 9295func (c *UsersSettingsFiltersCreateCall) Do(opts ...googleapi.CallOption) (*Filter, error) { 9296 gensupport.SetOptions(c.urlParams_, opts...) 9297 res, err := c.doRequest("json") 9298 if res != nil && res.StatusCode == http.StatusNotModified { 9299 if res.Body != nil { 9300 res.Body.Close() 9301 } 9302 return nil, &googleapi.Error{ 9303 Code: res.StatusCode, 9304 Header: res.Header, 9305 } 9306 } 9307 if err != nil { 9308 return nil, err 9309 } 9310 defer googleapi.CloseBody(res) 9311 if err := googleapi.CheckResponse(res); err != nil { 9312 return nil, err 9313 } 9314 ret := &Filter{ 9315 ServerResponse: googleapi.ServerResponse{ 9316 Header: res.Header, 9317 HTTPStatusCode: res.StatusCode, 9318 }, 9319 } 9320 target := &ret 9321 if err := gensupport.DecodeResponse(target, res); err != nil { 9322 return nil, err 9323 } 9324 return ret, nil 9325 // { 9326 // "description": "Creates a filter. Note: you can only create a maximum of 1,000 filters.", 9327 // "flatPath": "gmail/v1/users/{userId}/settings/filters", 9328 // "httpMethod": "POST", 9329 // "id": "gmail.users.settings.filters.create", 9330 // "parameterOrder": [ 9331 // "userId" 9332 // ], 9333 // "parameters": { 9334 // "userId": { 9335 // "default": "me", 9336 // "description": "User's email address. The special value \"me\" can be used to indicate the authenticated user.", 9337 // "location": "path", 9338 // "required": true, 9339 // "type": "string" 9340 // } 9341 // }, 9342 // "path": "gmail/v1/users/{userId}/settings/filters", 9343 // "request": { 9344 // "$ref": "Filter" 9345 // }, 9346 // "response": { 9347 // "$ref": "Filter" 9348 // }, 9349 // "scopes": [ 9350 // "https://www.googleapis.com/auth/gmail.settings.basic" 9351 // ] 9352 // } 9353 9354} 9355 9356// method id "gmail.users.settings.filters.delete": 9357 9358type UsersSettingsFiltersDeleteCall struct { 9359 s *Service 9360 userId string 9361 id string 9362 urlParams_ gensupport.URLParams 9363 ctx_ context.Context 9364 header_ http.Header 9365} 9366 9367// Delete: Deletes a filter. 9368func (r *UsersSettingsFiltersService) Delete(userId string, id string) *UsersSettingsFiltersDeleteCall { 9369 c := &UsersSettingsFiltersDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)} 9370 c.userId = userId 9371 c.id = id 9372 return c 9373} 9374 9375// Fields allows partial responses to be retrieved. See 9376// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 9377// for more information. 9378func (c *UsersSettingsFiltersDeleteCall) Fields(s ...googleapi.Field) *UsersSettingsFiltersDeleteCall { 9379 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 9380 return c 9381} 9382 9383// Context sets the context to be used in this call's Do method. Any 9384// pending HTTP request will be aborted if the provided context is 9385// canceled. 9386func (c *UsersSettingsFiltersDeleteCall) Context(ctx context.Context) *UsersSettingsFiltersDeleteCall { 9387 c.ctx_ = ctx 9388 return c 9389} 9390 9391// Header returns an http.Header that can be modified by the caller to 9392// add HTTP headers to the request. 9393func (c *UsersSettingsFiltersDeleteCall) Header() http.Header { 9394 if c.header_ == nil { 9395 c.header_ = make(http.Header) 9396 } 9397 return c.header_ 9398} 9399 9400func (c *UsersSettingsFiltersDeleteCall) doRequest(alt string) (*http.Response, error) { 9401 reqHeaders := make(http.Header) 9402 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20201124") 9403 for k, v := range c.header_ { 9404 reqHeaders[k] = v 9405 } 9406 reqHeaders.Set("User-Agent", c.s.userAgent()) 9407 var body io.Reader = nil 9408 c.urlParams_.Set("alt", alt) 9409 c.urlParams_.Set("prettyPrint", "false") 9410 urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/settings/filters/{id}") 9411 urls += "?" + c.urlParams_.Encode() 9412 req, err := http.NewRequest("DELETE", urls, body) 9413 if err != nil { 9414 return nil, err 9415 } 9416 req.Header = reqHeaders 9417 googleapi.Expand(req.URL, map[string]string{ 9418 "userId": c.userId, 9419 "id": c.id, 9420 }) 9421 return gensupport.SendRequest(c.ctx_, c.s.client, req) 9422} 9423 9424// Do executes the "gmail.users.settings.filters.delete" call. 9425func (c *UsersSettingsFiltersDeleteCall) Do(opts ...googleapi.CallOption) error { 9426 gensupport.SetOptions(c.urlParams_, opts...) 9427 res, err := c.doRequest("json") 9428 if err != nil { 9429 return err 9430 } 9431 defer googleapi.CloseBody(res) 9432 if err := googleapi.CheckResponse(res); err != nil { 9433 return err 9434 } 9435 return nil 9436 // { 9437 // "description": "Deletes a filter.", 9438 // "flatPath": "gmail/v1/users/{userId}/settings/filters/{id}", 9439 // "httpMethod": "DELETE", 9440 // "id": "gmail.users.settings.filters.delete", 9441 // "parameterOrder": [ 9442 // "userId", 9443 // "id" 9444 // ], 9445 // "parameters": { 9446 // "id": { 9447 // "description": "The ID of the filter to be deleted.", 9448 // "location": "path", 9449 // "required": true, 9450 // "type": "string" 9451 // }, 9452 // "userId": { 9453 // "default": "me", 9454 // "description": "User's email address. The special value \"me\" can be used to indicate the authenticated user.", 9455 // "location": "path", 9456 // "required": true, 9457 // "type": "string" 9458 // } 9459 // }, 9460 // "path": "gmail/v1/users/{userId}/settings/filters/{id}", 9461 // "scopes": [ 9462 // "https://www.googleapis.com/auth/gmail.settings.basic" 9463 // ] 9464 // } 9465 9466} 9467 9468// method id "gmail.users.settings.filters.get": 9469 9470type UsersSettingsFiltersGetCall struct { 9471 s *Service 9472 userId string 9473 id string 9474 urlParams_ gensupport.URLParams 9475 ifNoneMatch_ string 9476 ctx_ context.Context 9477 header_ http.Header 9478} 9479 9480// Get: Gets a filter. 9481func (r *UsersSettingsFiltersService) Get(userId string, id string) *UsersSettingsFiltersGetCall { 9482 c := &UsersSettingsFiltersGetCall{s: r.s, urlParams_: make(gensupport.URLParams)} 9483 c.userId = userId 9484 c.id = id 9485 return c 9486} 9487 9488// Fields allows partial responses to be retrieved. See 9489// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 9490// for more information. 9491func (c *UsersSettingsFiltersGetCall) Fields(s ...googleapi.Field) *UsersSettingsFiltersGetCall { 9492 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 9493 return c 9494} 9495 9496// IfNoneMatch sets the optional parameter which makes the operation 9497// fail if the object's ETag matches the given value. This is useful for 9498// getting updates only after the object has changed since the last 9499// request. Use googleapi.IsNotModified to check whether the response 9500// error from Do is the result of In-None-Match. 9501func (c *UsersSettingsFiltersGetCall) IfNoneMatch(entityTag string) *UsersSettingsFiltersGetCall { 9502 c.ifNoneMatch_ = entityTag 9503 return c 9504} 9505 9506// Context sets the context to be used in this call's Do method. Any 9507// pending HTTP request will be aborted if the provided context is 9508// canceled. 9509func (c *UsersSettingsFiltersGetCall) Context(ctx context.Context) *UsersSettingsFiltersGetCall { 9510 c.ctx_ = ctx 9511 return c 9512} 9513 9514// Header returns an http.Header that can be modified by the caller to 9515// add HTTP headers to the request. 9516func (c *UsersSettingsFiltersGetCall) Header() http.Header { 9517 if c.header_ == nil { 9518 c.header_ = make(http.Header) 9519 } 9520 return c.header_ 9521} 9522 9523func (c *UsersSettingsFiltersGetCall) doRequest(alt string) (*http.Response, error) { 9524 reqHeaders := make(http.Header) 9525 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20201124") 9526 for k, v := range c.header_ { 9527 reqHeaders[k] = v 9528 } 9529 reqHeaders.Set("User-Agent", c.s.userAgent()) 9530 if c.ifNoneMatch_ != "" { 9531 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 9532 } 9533 var body io.Reader = nil 9534 c.urlParams_.Set("alt", alt) 9535 c.urlParams_.Set("prettyPrint", "false") 9536 urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/settings/filters/{id}") 9537 urls += "?" + c.urlParams_.Encode() 9538 req, err := http.NewRequest("GET", urls, body) 9539 if err != nil { 9540 return nil, err 9541 } 9542 req.Header = reqHeaders 9543 googleapi.Expand(req.URL, map[string]string{ 9544 "userId": c.userId, 9545 "id": c.id, 9546 }) 9547 return gensupport.SendRequest(c.ctx_, c.s.client, req) 9548} 9549 9550// Do executes the "gmail.users.settings.filters.get" call. 9551// Exactly one of *Filter or error will be non-nil. Any non-2xx status 9552// code is an error. Response headers are in either 9553// *Filter.ServerResponse.Header or (if a response was returned at all) 9554// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 9555// check whether the returned error was because http.StatusNotModified 9556// was returned. 9557func (c *UsersSettingsFiltersGetCall) Do(opts ...googleapi.CallOption) (*Filter, error) { 9558 gensupport.SetOptions(c.urlParams_, opts...) 9559 res, err := c.doRequest("json") 9560 if res != nil && res.StatusCode == http.StatusNotModified { 9561 if res.Body != nil { 9562 res.Body.Close() 9563 } 9564 return nil, &googleapi.Error{ 9565 Code: res.StatusCode, 9566 Header: res.Header, 9567 } 9568 } 9569 if err != nil { 9570 return nil, err 9571 } 9572 defer googleapi.CloseBody(res) 9573 if err := googleapi.CheckResponse(res); err != nil { 9574 return nil, err 9575 } 9576 ret := &Filter{ 9577 ServerResponse: googleapi.ServerResponse{ 9578 Header: res.Header, 9579 HTTPStatusCode: res.StatusCode, 9580 }, 9581 } 9582 target := &ret 9583 if err := gensupport.DecodeResponse(target, res); err != nil { 9584 return nil, err 9585 } 9586 return ret, nil 9587 // { 9588 // "description": "Gets a filter.", 9589 // "flatPath": "gmail/v1/users/{userId}/settings/filters/{id}", 9590 // "httpMethod": "GET", 9591 // "id": "gmail.users.settings.filters.get", 9592 // "parameterOrder": [ 9593 // "userId", 9594 // "id" 9595 // ], 9596 // "parameters": { 9597 // "id": { 9598 // "description": "The ID of the filter to be fetched.", 9599 // "location": "path", 9600 // "required": true, 9601 // "type": "string" 9602 // }, 9603 // "userId": { 9604 // "default": "me", 9605 // "description": "User's email address. The special value \"me\" can be used to indicate the authenticated user.", 9606 // "location": "path", 9607 // "required": true, 9608 // "type": "string" 9609 // } 9610 // }, 9611 // "path": "gmail/v1/users/{userId}/settings/filters/{id}", 9612 // "response": { 9613 // "$ref": "Filter" 9614 // }, 9615 // "scopes": [ 9616 // "https://mail.google.com/", 9617 // "https://www.googleapis.com/auth/gmail.modify", 9618 // "https://www.googleapis.com/auth/gmail.readonly", 9619 // "https://www.googleapis.com/auth/gmail.settings.basic" 9620 // ] 9621 // } 9622 9623} 9624 9625// method id "gmail.users.settings.filters.list": 9626 9627type UsersSettingsFiltersListCall struct { 9628 s *Service 9629 userId string 9630 urlParams_ gensupport.URLParams 9631 ifNoneMatch_ string 9632 ctx_ context.Context 9633 header_ http.Header 9634} 9635 9636// List: Lists the message filters of a Gmail user. 9637func (r *UsersSettingsFiltersService) List(userId string) *UsersSettingsFiltersListCall { 9638 c := &UsersSettingsFiltersListCall{s: r.s, urlParams_: make(gensupport.URLParams)} 9639 c.userId = userId 9640 return c 9641} 9642 9643// Fields allows partial responses to be retrieved. See 9644// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 9645// for more information. 9646func (c *UsersSettingsFiltersListCall) Fields(s ...googleapi.Field) *UsersSettingsFiltersListCall { 9647 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 9648 return c 9649} 9650 9651// IfNoneMatch sets the optional parameter which makes the operation 9652// fail if the object's ETag matches the given value. This is useful for 9653// getting updates only after the object has changed since the last 9654// request. Use googleapi.IsNotModified to check whether the response 9655// error from Do is the result of In-None-Match. 9656func (c *UsersSettingsFiltersListCall) IfNoneMatch(entityTag string) *UsersSettingsFiltersListCall { 9657 c.ifNoneMatch_ = entityTag 9658 return c 9659} 9660 9661// Context sets the context to be used in this call's Do method. Any 9662// pending HTTP request will be aborted if the provided context is 9663// canceled. 9664func (c *UsersSettingsFiltersListCall) Context(ctx context.Context) *UsersSettingsFiltersListCall { 9665 c.ctx_ = ctx 9666 return c 9667} 9668 9669// Header returns an http.Header that can be modified by the caller to 9670// add HTTP headers to the request. 9671func (c *UsersSettingsFiltersListCall) Header() http.Header { 9672 if c.header_ == nil { 9673 c.header_ = make(http.Header) 9674 } 9675 return c.header_ 9676} 9677 9678func (c *UsersSettingsFiltersListCall) doRequest(alt string) (*http.Response, error) { 9679 reqHeaders := make(http.Header) 9680 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20201124") 9681 for k, v := range c.header_ { 9682 reqHeaders[k] = v 9683 } 9684 reqHeaders.Set("User-Agent", c.s.userAgent()) 9685 if c.ifNoneMatch_ != "" { 9686 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 9687 } 9688 var body io.Reader = nil 9689 c.urlParams_.Set("alt", alt) 9690 c.urlParams_.Set("prettyPrint", "false") 9691 urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/settings/filters") 9692 urls += "?" + c.urlParams_.Encode() 9693 req, err := http.NewRequest("GET", urls, body) 9694 if err != nil { 9695 return nil, err 9696 } 9697 req.Header = reqHeaders 9698 googleapi.Expand(req.URL, map[string]string{ 9699 "userId": c.userId, 9700 }) 9701 return gensupport.SendRequest(c.ctx_, c.s.client, req) 9702} 9703 9704// Do executes the "gmail.users.settings.filters.list" call. 9705// Exactly one of *ListFiltersResponse or error will be non-nil. Any 9706// non-2xx status code is an error. Response headers are in either 9707// *ListFiltersResponse.ServerResponse.Header or (if a response was 9708// returned at all) in error.(*googleapi.Error).Header. Use 9709// googleapi.IsNotModified to check whether the returned error was 9710// because http.StatusNotModified was returned. 9711func (c *UsersSettingsFiltersListCall) Do(opts ...googleapi.CallOption) (*ListFiltersResponse, error) { 9712 gensupport.SetOptions(c.urlParams_, opts...) 9713 res, err := c.doRequest("json") 9714 if res != nil && res.StatusCode == http.StatusNotModified { 9715 if res.Body != nil { 9716 res.Body.Close() 9717 } 9718 return nil, &googleapi.Error{ 9719 Code: res.StatusCode, 9720 Header: res.Header, 9721 } 9722 } 9723 if err != nil { 9724 return nil, err 9725 } 9726 defer googleapi.CloseBody(res) 9727 if err := googleapi.CheckResponse(res); err != nil { 9728 return nil, err 9729 } 9730 ret := &ListFiltersResponse{ 9731 ServerResponse: googleapi.ServerResponse{ 9732 Header: res.Header, 9733 HTTPStatusCode: res.StatusCode, 9734 }, 9735 } 9736 target := &ret 9737 if err := gensupport.DecodeResponse(target, res); err != nil { 9738 return nil, err 9739 } 9740 return ret, nil 9741 // { 9742 // "description": "Lists the message filters of a Gmail user.", 9743 // "flatPath": "gmail/v1/users/{userId}/settings/filters", 9744 // "httpMethod": "GET", 9745 // "id": "gmail.users.settings.filters.list", 9746 // "parameterOrder": [ 9747 // "userId" 9748 // ], 9749 // "parameters": { 9750 // "userId": { 9751 // "default": "me", 9752 // "description": "User's email address. The special value \"me\" can be used to indicate the authenticated user.", 9753 // "location": "path", 9754 // "required": true, 9755 // "type": "string" 9756 // } 9757 // }, 9758 // "path": "gmail/v1/users/{userId}/settings/filters", 9759 // "response": { 9760 // "$ref": "ListFiltersResponse" 9761 // }, 9762 // "scopes": [ 9763 // "https://mail.google.com/", 9764 // "https://www.googleapis.com/auth/gmail.modify", 9765 // "https://www.googleapis.com/auth/gmail.readonly", 9766 // "https://www.googleapis.com/auth/gmail.settings.basic" 9767 // ] 9768 // } 9769 9770} 9771 9772// method id "gmail.users.settings.forwardingAddresses.create": 9773 9774type UsersSettingsForwardingAddressesCreateCall struct { 9775 s *Service 9776 userId string 9777 forwardingaddress *ForwardingAddress 9778 urlParams_ gensupport.URLParams 9779 ctx_ context.Context 9780 header_ http.Header 9781} 9782 9783// Create: Creates a forwarding address. If ownership verification is 9784// required, a message will be sent to the recipient and the resource's 9785// verification status will be set to `pending`; otherwise, the resource 9786// will be created with verification status set to `accepted`. This 9787// method is only available to service account clients that have been 9788// delegated domain-wide authority. 9789func (r *UsersSettingsForwardingAddressesService) Create(userId string, forwardingaddress *ForwardingAddress) *UsersSettingsForwardingAddressesCreateCall { 9790 c := &UsersSettingsForwardingAddressesCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)} 9791 c.userId = userId 9792 c.forwardingaddress = forwardingaddress 9793 return c 9794} 9795 9796// Fields allows partial responses to be retrieved. See 9797// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 9798// for more information. 9799func (c *UsersSettingsForwardingAddressesCreateCall) Fields(s ...googleapi.Field) *UsersSettingsForwardingAddressesCreateCall { 9800 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 9801 return c 9802} 9803 9804// Context sets the context to be used in this call's Do method. Any 9805// pending HTTP request will be aborted if the provided context is 9806// canceled. 9807func (c *UsersSettingsForwardingAddressesCreateCall) Context(ctx context.Context) *UsersSettingsForwardingAddressesCreateCall { 9808 c.ctx_ = ctx 9809 return c 9810} 9811 9812// Header returns an http.Header that can be modified by the caller to 9813// add HTTP headers to the request. 9814func (c *UsersSettingsForwardingAddressesCreateCall) Header() http.Header { 9815 if c.header_ == nil { 9816 c.header_ = make(http.Header) 9817 } 9818 return c.header_ 9819} 9820 9821func (c *UsersSettingsForwardingAddressesCreateCall) doRequest(alt string) (*http.Response, error) { 9822 reqHeaders := make(http.Header) 9823 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20201124") 9824 for k, v := range c.header_ { 9825 reqHeaders[k] = v 9826 } 9827 reqHeaders.Set("User-Agent", c.s.userAgent()) 9828 var body io.Reader = nil 9829 body, err := googleapi.WithoutDataWrapper.JSONReader(c.forwardingaddress) 9830 if err != nil { 9831 return nil, err 9832 } 9833 reqHeaders.Set("Content-Type", "application/json") 9834 c.urlParams_.Set("alt", alt) 9835 c.urlParams_.Set("prettyPrint", "false") 9836 urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/settings/forwardingAddresses") 9837 urls += "?" + c.urlParams_.Encode() 9838 req, err := http.NewRequest("POST", urls, body) 9839 if err != nil { 9840 return nil, err 9841 } 9842 req.Header = reqHeaders 9843 googleapi.Expand(req.URL, map[string]string{ 9844 "userId": c.userId, 9845 }) 9846 return gensupport.SendRequest(c.ctx_, c.s.client, req) 9847} 9848 9849// Do executes the "gmail.users.settings.forwardingAddresses.create" call. 9850// Exactly one of *ForwardingAddress or error will be non-nil. Any 9851// non-2xx status code is an error. Response headers are in either 9852// *ForwardingAddress.ServerResponse.Header or (if a response was 9853// returned at all) in error.(*googleapi.Error).Header. Use 9854// googleapi.IsNotModified to check whether the returned error was 9855// because http.StatusNotModified was returned. 9856func (c *UsersSettingsForwardingAddressesCreateCall) Do(opts ...googleapi.CallOption) (*ForwardingAddress, error) { 9857 gensupport.SetOptions(c.urlParams_, opts...) 9858 res, err := c.doRequest("json") 9859 if res != nil && res.StatusCode == http.StatusNotModified { 9860 if res.Body != nil { 9861 res.Body.Close() 9862 } 9863 return nil, &googleapi.Error{ 9864 Code: res.StatusCode, 9865 Header: res.Header, 9866 } 9867 } 9868 if err != nil { 9869 return nil, err 9870 } 9871 defer googleapi.CloseBody(res) 9872 if err := googleapi.CheckResponse(res); err != nil { 9873 return nil, err 9874 } 9875 ret := &ForwardingAddress{ 9876 ServerResponse: googleapi.ServerResponse{ 9877 Header: res.Header, 9878 HTTPStatusCode: res.StatusCode, 9879 }, 9880 } 9881 target := &ret 9882 if err := gensupport.DecodeResponse(target, res); err != nil { 9883 return nil, err 9884 } 9885 return ret, nil 9886 // { 9887 // "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`. This method is only available to service account clients that have been delegated domain-wide authority.", 9888 // "flatPath": "gmail/v1/users/{userId}/settings/forwardingAddresses", 9889 // "httpMethod": "POST", 9890 // "id": "gmail.users.settings.forwardingAddresses.create", 9891 // "parameterOrder": [ 9892 // "userId" 9893 // ], 9894 // "parameters": { 9895 // "userId": { 9896 // "default": "me", 9897 // "description": "User's email address. The special value \"me\" can be used to indicate the authenticated user.", 9898 // "location": "path", 9899 // "required": true, 9900 // "type": "string" 9901 // } 9902 // }, 9903 // "path": "gmail/v1/users/{userId}/settings/forwardingAddresses", 9904 // "request": { 9905 // "$ref": "ForwardingAddress" 9906 // }, 9907 // "response": { 9908 // "$ref": "ForwardingAddress" 9909 // }, 9910 // "scopes": [ 9911 // "https://www.googleapis.com/auth/gmail.settings.sharing" 9912 // ] 9913 // } 9914 9915} 9916 9917// method id "gmail.users.settings.forwardingAddresses.delete": 9918 9919type UsersSettingsForwardingAddressesDeleteCall struct { 9920 s *Service 9921 userId string 9922 forwardingEmail string 9923 urlParams_ gensupport.URLParams 9924 ctx_ context.Context 9925 header_ http.Header 9926} 9927 9928// Delete: Deletes the specified forwarding address and revokes any 9929// verification that may have been required. This method is only 9930// available to service account clients that have been delegated 9931// domain-wide authority. 9932func (r *UsersSettingsForwardingAddressesService) Delete(userId string, forwardingEmail string) *UsersSettingsForwardingAddressesDeleteCall { 9933 c := &UsersSettingsForwardingAddressesDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)} 9934 c.userId = userId 9935 c.forwardingEmail = forwardingEmail 9936 return c 9937} 9938 9939// Fields allows partial responses to be retrieved. See 9940// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 9941// for more information. 9942func (c *UsersSettingsForwardingAddressesDeleteCall) Fields(s ...googleapi.Field) *UsersSettingsForwardingAddressesDeleteCall { 9943 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 9944 return c 9945} 9946 9947// Context sets the context to be used in this call's Do method. Any 9948// pending HTTP request will be aborted if the provided context is 9949// canceled. 9950func (c *UsersSettingsForwardingAddressesDeleteCall) Context(ctx context.Context) *UsersSettingsForwardingAddressesDeleteCall { 9951 c.ctx_ = ctx 9952 return c 9953} 9954 9955// Header returns an http.Header that can be modified by the caller to 9956// add HTTP headers to the request. 9957func (c *UsersSettingsForwardingAddressesDeleteCall) Header() http.Header { 9958 if c.header_ == nil { 9959 c.header_ = make(http.Header) 9960 } 9961 return c.header_ 9962} 9963 9964func (c *UsersSettingsForwardingAddressesDeleteCall) doRequest(alt string) (*http.Response, error) { 9965 reqHeaders := make(http.Header) 9966 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20201124") 9967 for k, v := range c.header_ { 9968 reqHeaders[k] = v 9969 } 9970 reqHeaders.Set("User-Agent", c.s.userAgent()) 9971 var body io.Reader = nil 9972 c.urlParams_.Set("alt", alt) 9973 c.urlParams_.Set("prettyPrint", "false") 9974 urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/settings/forwardingAddresses/{forwardingEmail}") 9975 urls += "?" + c.urlParams_.Encode() 9976 req, err := http.NewRequest("DELETE", urls, body) 9977 if err != nil { 9978 return nil, err 9979 } 9980 req.Header = reqHeaders 9981 googleapi.Expand(req.URL, map[string]string{ 9982 "userId": c.userId, 9983 "forwardingEmail": c.forwardingEmail, 9984 }) 9985 return gensupport.SendRequest(c.ctx_, c.s.client, req) 9986} 9987 9988// Do executes the "gmail.users.settings.forwardingAddresses.delete" call. 9989func (c *UsersSettingsForwardingAddressesDeleteCall) Do(opts ...googleapi.CallOption) error { 9990 gensupport.SetOptions(c.urlParams_, opts...) 9991 res, err := c.doRequest("json") 9992 if err != nil { 9993 return err 9994 } 9995 defer googleapi.CloseBody(res) 9996 if err := googleapi.CheckResponse(res); err != nil { 9997 return err 9998 } 9999 return nil 10000 // { 10001 // "description": "Deletes the specified forwarding address and revokes any verification that may have been required. This method is only available to service account clients that have been delegated domain-wide authority.", 10002 // "flatPath": "gmail/v1/users/{userId}/settings/forwardingAddresses/{forwardingEmail}", 10003 // "httpMethod": "DELETE", 10004 // "id": "gmail.users.settings.forwardingAddresses.delete", 10005 // "parameterOrder": [ 10006 // "userId", 10007 // "forwardingEmail" 10008 // ], 10009 // "parameters": { 10010 // "forwardingEmail": { 10011 // "description": "The forwarding address to be deleted.", 10012 // "location": "path", 10013 // "required": true, 10014 // "type": "string" 10015 // }, 10016 // "userId": { 10017 // "default": "me", 10018 // "description": "User's email address. The special value \"me\" can be used to indicate the authenticated user.", 10019 // "location": "path", 10020 // "required": true, 10021 // "type": "string" 10022 // } 10023 // }, 10024 // "path": "gmail/v1/users/{userId}/settings/forwardingAddresses/{forwardingEmail}", 10025 // "scopes": [ 10026 // "https://www.googleapis.com/auth/gmail.settings.sharing" 10027 // ] 10028 // } 10029 10030} 10031 10032// method id "gmail.users.settings.forwardingAddresses.get": 10033 10034type UsersSettingsForwardingAddressesGetCall struct { 10035 s *Service 10036 userId string 10037 forwardingEmail string 10038 urlParams_ gensupport.URLParams 10039 ifNoneMatch_ string 10040 ctx_ context.Context 10041 header_ http.Header 10042} 10043 10044// Get: Gets the specified forwarding address. 10045func (r *UsersSettingsForwardingAddressesService) Get(userId string, forwardingEmail string) *UsersSettingsForwardingAddressesGetCall { 10046 c := &UsersSettingsForwardingAddressesGetCall{s: r.s, urlParams_: make(gensupport.URLParams)} 10047 c.userId = userId 10048 c.forwardingEmail = forwardingEmail 10049 return c 10050} 10051 10052// Fields allows partial responses to be retrieved. See 10053// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 10054// for more information. 10055func (c *UsersSettingsForwardingAddressesGetCall) Fields(s ...googleapi.Field) *UsersSettingsForwardingAddressesGetCall { 10056 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 10057 return c 10058} 10059 10060// IfNoneMatch sets the optional parameter which makes the operation 10061// fail if the object's ETag matches the given value. This is useful for 10062// getting updates only after the object has changed since the last 10063// request. Use googleapi.IsNotModified to check whether the response 10064// error from Do is the result of In-None-Match. 10065func (c *UsersSettingsForwardingAddressesGetCall) IfNoneMatch(entityTag string) *UsersSettingsForwardingAddressesGetCall { 10066 c.ifNoneMatch_ = entityTag 10067 return c 10068} 10069 10070// Context sets the context to be used in this call's Do method. Any 10071// pending HTTP request will be aborted if the provided context is 10072// canceled. 10073func (c *UsersSettingsForwardingAddressesGetCall) Context(ctx context.Context) *UsersSettingsForwardingAddressesGetCall { 10074 c.ctx_ = ctx 10075 return c 10076} 10077 10078// Header returns an http.Header that can be modified by the caller to 10079// add HTTP headers to the request. 10080func (c *UsersSettingsForwardingAddressesGetCall) Header() http.Header { 10081 if c.header_ == nil { 10082 c.header_ = make(http.Header) 10083 } 10084 return c.header_ 10085} 10086 10087func (c *UsersSettingsForwardingAddressesGetCall) doRequest(alt string) (*http.Response, error) { 10088 reqHeaders := make(http.Header) 10089 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20201124") 10090 for k, v := range c.header_ { 10091 reqHeaders[k] = v 10092 } 10093 reqHeaders.Set("User-Agent", c.s.userAgent()) 10094 if c.ifNoneMatch_ != "" { 10095 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 10096 } 10097 var body io.Reader = nil 10098 c.urlParams_.Set("alt", alt) 10099 c.urlParams_.Set("prettyPrint", "false") 10100 urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/settings/forwardingAddresses/{forwardingEmail}") 10101 urls += "?" + c.urlParams_.Encode() 10102 req, err := http.NewRequest("GET", urls, body) 10103 if err != nil { 10104 return nil, err 10105 } 10106 req.Header = reqHeaders 10107 googleapi.Expand(req.URL, map[string]string{ 10108 "userId": c.userId, 10109 "forwardingEmail": c.forwardingEmail, 10110 }) 10111 return gensupport.SendRequest(c.ctx_, c.s.client, req) 10112} 10113 10114// Do executes the "gmail.users.settings.forwardingAddresses.get" call. 10115// Exactly one of *ForwardingAddress or error will be non-nil. Any 10116// non-2xx status code is an error. Response headers are in either 10117// *ForwardingAddress.ServerResponse.Header or (if a response was 10118// returned at all) in error.(*googleapi.Error).Header. Use 10119// googleapi.IsNotModified to check whether the returned error was 10120// because http.StatusNotModified was returned. 10121func (c *UsersSettingsForwardingAddressesGetCall) Do(opts ...googleapi.CallOption) (*ForwardingAddress, error) { 10122 gensupport.SetOptions(c.urlParams_, opts...) 10123 res, err := c.doRequest("json") 10124 if res != nil && res.StatusCode == http.StatusNotModified { 10125 if res.Body != nil { 10126 res.Body.Close() 10127 } 10128 return nil, &googleapi.Error{ 10129 Code: res.StatusCode, 10130 Header: res.Header, 10131 } 10132 } 10133 if err != nil { 10134 return nil, err 10135 } 10136 defer googleapi.CloseBody(res) 10137 if err := googleapi.CheckResponse(res); err != nil { 10138 return nil, err 10139 } 10140 ret := &ForwardingAddress{ 10141 ServerResponse: googleapi.ServerResponse{ 10142 Header: res.Header, 10143 HTTPStatusCode: res.StatusCode, 10144 }, 10145 } 10146 target := &ret 10147 if err := gensupport.DecodeResponse(target, res); err != nil { 10148 return nil, err 10149 } 10150 return ret, nil 10151 // { 10152 // "description": "Gets the specified forwarding address.", 10153 // "flatPath": "gmail/v1/users/{userId}/settings/forwardingAddresses/{forwardingEmail}", 10154 // "httpMethod": "GET", 10155 // "id": "gmail.users.settings.forwardingAddresses.get", 10156 // "parameterOrder": [ 10157 // "userId", 10158 // "forwardingEmail" 10159 // ], 10160 // "parameters": { 10161 // "forwardingEmail": { 10162 // "description": "The forwarding address to be retrieved.", 10163 // "location": "path", 10164 // "required": true, 10165 // "type": "string" 10166 // }, 10167 // "userId": { 10168 // "default": "me", 10169 // "description": "User's email address. The special value \"me\" can be used to indicate the authenticated user.", 10170 // "location": "path", 10171 // "required": true, 10172 // "type": "string" 10173 // } 10174 // }, 10175 // "path": "gmail/v1/users/{userId}/settings/forwardingAddresses/{forwardingEmail}", 10176 // "response": { 10177 // "$ref": "ForwardingAddress" 10178 // }, 10179 // "scopes": [ 10180 // "https://mail.google.com/", 10181 // "https://www.googleapis.com/auth/gmail.modify", 10182 // "https://www.googleapis.com/auth/gmail.readonly", 10183 // "https://www.googleapis.com/auth/gmail.settings.basic" 10184 // ] 10185 // } 10186 10187} 10188 10189// method id "gmail.users.settings.forwardingAddresses.list": 10190 10191type UsersSettingsForwardingAddressesListCall struct { 10192 s *Service 10193 userId string 10194 urlParams_ gensupport.URLParams 10195 ifNoneMatch_ string 10196 ctx_ context.Context 10197 header_ http.Header 10198} 10199 10200// List: Lists the forwarding addresses for the specified account. 10201func (r *UsersSettingsForwardingAddressesService) List(userId string) *UsersSettingsForwardingAddressesListCall { 10202 c := &UsersSettingsForwardingAddressesListCall{s: r.s, urlParams_: make(gensupport.URLParams)} 10203 c.userId = userId 10204 return c 10205} 10206 10207// Fields allows partial responses to be retrieved. See 10208// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 10209// for more information. 10210func (c *UsersSettingsForwardingAddressesListCall) Fields(s ...googleapi.Field) *UsersSettingsForwardingAddressesListCall { 10211 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 10212 return c 10213} 10214 10215// IfNoneMatch sets the optional parameter which makes the operation 10216// fail if the object's ETag matches the given value. This is useful for 10217// getting updates only after the object has changed since the last 10218// request. Use googleapi.IsNotModified to check whether the response 10219// error from Do is the result of In-None-Match. 10220func (c *UsersSettingsForwardingAddressesListCall) IfNoneMatch(entityTag string) *UsersSettingsForwardingAddressesListCall { 10221 c.ifNoneMatch_ = entityTag 10222 return c 10223} 10224 10225// Context sets the context to be used in this call's Do method. Any 10226// pending HTTP request will be aborted if the provided context is 10227// canceled. 10228func (c *UsersSettingsForwardingAddressesListCall) Context(ctx context.Context) *UsersSettingsForwardingAddressesListCall { 10229 c.ctx_ = ctx 10230 return c 10231} 10232 10233// Header returns an http.Header that can be modified by the caller to 10234// add HTTP headers to the request. 10235func (c *UsersSettingsForwardingAddressesListCall) Header() http.Header { 10236 if c.header_ == nil { 10237 c.header_ = make(http.Header) 10238 } 10239 return c.header_ 10240} 10241 10242func (c *UsersSettingsForwardingAddressesListCall) doRequest(alt string) (*http.Response, error) { 10243 reqHeaders := make(http.Header) 10244 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20201124") 10245 for k, v := range c.header_ { 10246 reqHeaders[k] = v 10247 } 10248 reqHeaders.Set("User-Agent", c.s.userAgent()) 10249 if c.ifNoneMatch_ != "" { 10250 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 10251 } 10252 var body io.Reader = nil 10253 c.urlParams_.Set("alt", alt) 10254 c.urlParams_.Set("prettyPrint", "false") 10255 urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/settings/forwardingAddresses") 10256 urls += "?" + c.urlParams_.Encode() 10257 req, err := http.NewRequest("GET", urls, body) 10258 if err != nil { 10259 return nil, err 10260 } 10261 req.Header = reqHeaders 10262 googleapi.Expand(req.URL, map[string]string{ 10263 "userId": c.userId, 10264 }) 10265 return gensupport.SendRequest(c.ctx_, c.s.client, req) 10266} 10267 10268// Do executes the "gmail.users.settings.forwardingAddresses.list" call. 10269// Exactly one of *ListForwardingAddressesResponse or error will be 10270// non-nil. Any non-2xx status code is an error. Response headers are in 10271// either *ListForwardingAddressesResponse.ServerResponse.Header or (if 10272// a response was returned at all) in error.(*googleapi.Error).Header. 10273// Use googleapi.IsNotModified to check whether the returned error was 10274// because http.StatusNotModified was returned. 10275func (c *UsersSettingsForwardingAddressesListCall) Do(opts ...googleapi.CallOption) (*ListForwardingAddressesResponse, error) { 10276 gensupport.SetOptions(c.urlParams_, opts...) 10277 res, err := c.doRequest("json") 10278 if res != nil && res.StatusCode == http.StatusNotModified { 10279 if res.Body != nil { 10280 res.Body.Close() 10281 } 10282 return nil, &googleapi.Error{ 10283 Code: res.StatusCode, 10284 Header: res.Header, 10285 } 10286 } 10287 if err != nil { 10288 return nil, err 10289 } 10290 defer googleapi.CloseBody(res) 10291 if err := googleapi.CheckResponse(res); err != nil { 10292 return nil, err 10293 } 10294 ret := &ListForwardingAddressesResponse{ 10295 ServerResponse: googleapi.ServerResponse{ 10296 Header: res.Header, 10297 HTTPStatusCode: res.StatusCode, 10298 }, 10299 } 10300 target := &ret 10301 if err := gensupport.DecodeResponse(target, res); err != nil { 10302 return nil, err 10303 } 10304 return ret, nil 10305 // { 10306 // "description": "Lists the forwarding addresses for the specified account.", 10307 // "flatPath": "gmail/v1/users/{userId}/settings/forwardingAddresses", 10308 // "httpMethod": "GET", 10309 // "id": "gmail.users.settings.forwardingAddresses.list", 10310 // "parameterOrder": [ 10311 // "userId" 10312 // ], 10313 // "parameters": { 10314 // "userId": { 10315 // "default": "me", 10316 // "description": "User's email address. The special value \"me\" can be used to indicate the authenticated user.", 10317 // "location": "path", 10318 // "required": true, 10319 // "type": "string" 10320 // } 10321 // }, 10322 // "path": "gmail/v1/users/{userId}/settings/forwardingAddresses", 10323 // "response": { 10324 // "$ref": "ListForwardingAddressesResponse" 10325 // }, 10326 // "scopes": [ 10327 // "https://mail.google.com/", 10328 // "https://www.googleapis.com/auth/gmail.modify", 10329 // "https://www.googleapis.com/auth/gmail.readonly", 10330 // "https://www.googleapis.com/auth/gmail.settings.basic" 10331 // ] 10332 // } 10333 10334} 10335 10336// method id "gmail.users.settings.sendAs.create": 10337 10338type UsersSettingsSendAsCreateCall struct { 10339 s *Service 10340 userId string 10341 sendas *SendAs 10342 urlParams_ gensupport.URLParams 10343 ctx_ context.Context 10344 header_ http.Header 10345} 10346 10347// Create: Creates a custom "from" send-as alias. If an SMTP MSA is 10348// specified, Gmail will attempt to connect to the SMTP service to 10349// validate the configuration before creating the alias. If ownership 10350// verification is required for the alias, a message will be sent to the 10351// email address and the resource's verification status will be set to 10352// `pending`; otherwise, the resource will be created with verification 10353// status set to `accepted`. If a signature is provided, Gmail will 10354// sanitize the HTML before saving it with the alias. This method is 10355// only available to service account clients that have been delegated 10356// domain-wide authority. 10357func (r *UsersSettingsSendAsService) Create(userId string, sendas *SendAs) *UsersSettingsSendAsCreateCall { 10358 c := &UsersSettingsSendAsCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)} 10359 c.userId = userId 10360 c.sendas = sendas 10361 return c 10362} 10363 10364// Fields allows partial responses to be retrieved. See 10365// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 10366// for more information. 10367func (c *UsersSettingsSendAsCreateCall) Fields(s ...googleapi.Field) *UsersSettingsSendAsCreateCall { 10368 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 10369 return c 10370} 10371 10372// Context sets the context to be used in this call's Do method. Any 10373// pending HTTP request will be aborted if the provided context is 10374// canceled. 10375func (c *UsersSettingsSendAsCreateCall) Context(ctx context.Context) *UsersSettingsSendAsCreateCall { 10376 c.ctx_ = ctx 10377 return c 10378} 10379 10380// Header returns an http.Header that can be modified by the caller to 10381// add HTTP headers to the request. 10382func (c *UsersSettingsSendAsCreateCall) Header() http.Header { 10383 if c.header_ == nil { 10384 c.header_ = make(http.Header) 10385 } 10386 return c.header_ 10387} 10388 10389func (c *UsersSettingsSendAsCreateCall) doRequest(alt string) (*http.Response, error) { 10390 reqHeaders := make(http.Header) 10391 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20201124") 10392 for k, v := range c.header_ { 10393 reqHeaders[k] = v 10394 } 10395 reqHeaders.Set("User-Agent", c.s.userAgent()) 10396 var body io.Reader = nil 10397 body, err := googleapi.WithoutDataWrapper.JSONReader(c.sendas) 10398 if err != nil { 10399 return nil, err 10400 } 10401 reqHeaders.Set("Content-Type", "application/json") 10402 c.urlParams_.Set("alt", alt) 10403 c.urlParams_.Set("prettyPrint", "false") 10404 urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/settings/sendAs") 10405 urls += "?" + c.urlParams_.Encode() 10406 req, err := http.NewRequest("POST", urls, body) 10407 if err != nil { 10408 return nil, err 10409 } 10410 req.Header = reqHeaders 10411 googleapi.Expand(req.URL, map[string]string{ 10412 "userId": c.userId, 10413 }) 10414 return gensupport.SendRequest(c.ctx_, c.s.client, req) 10415} 10416 10417// Do executes the "gmail.users.settings.sendAs.create" call. 10418// Exactly one of *SendAs or error will be non-nil. Any non-2xx status 10419// code is an error. Response headers are in either 10420// *SendAs.ServerResponse.Header or (if a response was returned at all) 10421// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 10422// check whether the returned error was because http.StatusNotModified 10423// was returned. 10424func (c *UsersSettingsSendAsCreateCall) Do(opts ...googleapi.CallOption) (*SendAs, error) { 10425 gensupport.SetOptions(c.urlParams_, opts...) 10426 res, err := c.doRequest("json") 10427 if res != nil && res.StatusCode == http.StatusNotModified { 10428 if res.Body != nil { 10429 res.Body.Close() 10430 } 10431 return nil, &googleapi.Error{ 10432 Code: res.StatusCode, 10433 Header: res.Header, 10434 } 10435 } 10436 if err != nil { 10437 return nil, err 10438 } 10439 defer googleapi.CloseBody(res) 10440 if err := googleapi.CheckResponse(res); err != nil { 10441 return nil, err 10442 } 10443 ret := &SendAs{ 10444 ServerResponse: googleapi.ServerResponse{ 10445 Header: res.Header, 10446 HTTPStatusCode: res.StatusCode, 10447 }, 10448 } 10449 target := &ret 10450 if err := gensupport.DecodeResponse(target, res); err != nil { 10451 return nil, err 10452 } 10453 return ret, nil 10454 // { 10455 // "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. This method is only available to service account clients that have been delegated domain-wide authority.", 10456 // "flatPath": "gmail/v1/users/{userId}/settings/sendAs", 10457 // "httpMethod": "POST", 10458 // "id": "gmail.users.settings.sendAs.create", 10459 // "parameterOrder": [ 10460 // "userId" 10461 // ], 10462 // "parameters": { 10463 // "userId": { 10464 // "default": "me", 10465 // "description": "User's email address. The special value \"me\" can be used to indicate the authenticated user.", 10466 // "location": "path", 10467 // "required": true, 10468 // "type": "string" 10469 // } 10470 // }, 10471 // "path": "gmail/v1/users/{userId}/settings/sendAs", 10472 // "request": { 10473 // "$ref": "SendAs" 10474 // }, 10475 // "response": { 10476 // "$ref": "SendAs" 10477 // }, 10478 // "scopes": [ 10479 // "https://www.googleapis.com/auth/gmail.settings.sharing" 10480 // ] 10481 // } 10482 10483} 10484 10485// method id "gmail.users.settings.sendAs.delete": 10486 10487type UsersSettingsSendAsDeleteCall struct { 10488 s *Service 10489 userId string 10490 sendAsEmail string 10491 urlParams_ gensupport.URLParams 10492 ctx_ context.Context 10493 header_ http.Header 10494} 10495 10496// Delete: Deletes the specified send-as alias. Revokes any verification 10497// that may have been required for using it. This method is only 10498// available to service account clients that have been delegated 10499// domain-wide authority. 10500func (r *UsersSettingsSendAsService) Delete(userId string, sendAsEmail string) *UsersSettingsSendAsDeleteCall { 10501 c := &UsersSettingsSendAsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)} 10502 c.userId = userId 10503 c.sendAsEmail = sendAsEmail 10504 return c 10505} 10506 10507// Fields allows partial responses to be retrieved. See 10508// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 10509// for more information. 10510func (c *UsersSettingsSendAsDeleteCall) Fields(s ...googleapi.Field) *UsersSettingsSendAsDeleteCall { 10511 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 10512 return c 10513} 10514 10515// Context sets the context to be used in this call's Do method. Any 10516// pending HTTP request will be aborted if the provided context is 10517// canceled. 10518func (c *UsersSettingsSendAsDeleteCall) Context(ctx context.Context) *UsersSettingsSendAsDeleteCall { 10519 c.ctx_ = ctx 10520 return c 10521} 10522 10523// Header returns an http.Header that can be modified by the caller to 10524// add HTTP headers to the request. 10525func (c *UsersSettingsSendAsDeleteCall) Header() http.Header { 10526 if c.header_ == nil { 10527 c.header_ = make(http.Header) 10528 } 10529 return c.header_ 10530} 10531 10532func (c *UsersSettingsSendAsDeleteCall) doRequest(alt string) (*http.Response, error) { 10533 reqHeaders := make(http.Header) 10534 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20201124") 10535 for k, v := range c.header_ { 10536 reqHeaders[k] = v 10537 } 10538 reqHeaders.Set("User-Agent", c.s.userAgent()) 10539 var body io.Reader = nil 10540 c.urlParams_.Set("alt", alt) 10541 c.urlParams_.Set("prettyPrint", "false") 10542 urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/settings/sendAs/{sendAsEmail}") 10543 urls += "?" + c.urlParams_.Encode() 10544 req, err := http.NewRequest("DELETE", urls, body) 10545 if err != nil { 10546 return nil, err 10547 } 10548 req.Header = reqHeaders 10549 googleapi.Expand(req.URL, map[string]string{ 10550 "userId": c.userId, 10551 "sendAsEmail": c.sendAsEmail, 10552 }) 10553 return gensupport.SendRequest(c.ctx_, c.s.client, req) 10554} 10555 10556// Do executes the "gmail.users.settings.sendAs.delete" call. 10557func (c *UsersSettingsSendAsDeleteCall) Do(opts ...googleapi.CallOption) error { 10558 gensupport.SetOptions(c.urlParams_, opts...) 10559 res, err := c.doRequest("json") 10560 if err != nil { 10561 return err 10562 } 10563 defer googleapi.CloseBody(res) 10564 if err := googleapi.CheckResponse(res); err != nil { 10565 return err 10566 } 10567 return nil 10568 // { 10569 // "description": "Deletes the specified send-as alias. Revokes any verification that may have been required for using it. This method is only available to service account clients that have been delegated domain-wide authority.", 10570 // "flatPath": "gmail/v1/users/{userId}/settings/sendAs/{sendAsEmail}", 10571 // "httpMethod": "DELETE", 10572 // "id": "gmail.users.settings.sendAs.delete", 10573 // "parameterOrder": [ 10574 // "userId", 10575 // "sendAsEmail" 10576 // ], 10577 // "parameters": { 10578 // "sendAsEmail": { 10579 // "description": "The send-as alias to be deleted.", 10580 // "location": "path", 10581 // "required": true, 10582 // "type": "string" 10583 // }, 10584 // "userId": { 10585 // "default": "me", 10586 // "description": "User's email address. The special value \"me\" can be used to indicate the authenticated user.", 10587 // "location": "path", 10588 // "required": true, 10589 // "type": "string" 10590 // } 10591 // }, 10592 // "path": "gmail/v1/users/{userId}/settings/sendAs/{sendAsEmail}", 10593 // "scopes": [ 10594 // "https://www.googleapis.com/auth/gmail.settings.sharing" 10595 // ] 10596 // } 10597 10598} 10599 10600// method id "gmail.users.settings.sendAs.get": 10601 10602type UsersSettingsSendAsGetCall struct { 10603 s *Service 10604 userId string 10605 sendAsEmail string 10606 urlParams_ gensupport.URLParams 10607 ifNoneMatch_ string 10608 ctx_ context.Context 10609 header_ http.Header 10610} 10611 10612// Get: Gets the specified send-as alias. Fails with an HTTP 404 error 10613// if the specified address is not a member of the collection. 10614func (r *UsersSettingsSendAsService) Get(userId string, sendAsEmail string) *UsersSettingsSendAsGetCall { 10615 c := &UsersSettingsSendAsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)} 10616 c.userId = userId 10617 c.sendAsEmail = sendAsEmail 10618 return c 10619} 10620 10621// Fields allows partial responses to be retrieved. See 10622// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 10623// for more information. 10624func (c *UsersSettingsSendAsGetCall) Fields(s ...googleapi.Field) *UsersSettingsSendAsGetCall { 10625 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 10626 return c 10627} 10628 10629// IfNoneMatch sets the optional parameter which makes the operation 10630// fail if the object's ETag matches the given value. This is useful for 10631// getting updates only after the object has changed since the last 10632// request. Use googleapi.IsNotModified to check whether the response 10633// error from Do is the result of In-None-Match. 10634func (c *UsersSettingsSendAsGetCall) IfNoneMatch(entityTag string) *UsersSettingsSendAsGetCall { 10635 c.ifNoneMatch_ = entityTag 10636 return c 10637} 10638 10639// Context sets the context to be used in this call's Do method. Any 10640// pending HTTP request will be aborted if the provided context is 10641// canceled. 10642func (c *UsersSettingsSendAsGetCall) Context(ctx context.Context) *UsersSettingsSendAsGetCall { 10643 c.ctx_ = ctx 10644 return c 10645} 10646 10647// Header returns an http.Header that can be modified by the caller to 10648// add HTTP headers to the request. 10649func (c *UsersSettingsSendAsGetCall) Header() http.Header { 10650 if c.header_ == nil { 10651 c.header_ = make(http.Header) 10652 } 10653 return c.header_ 10654} 10655 10656func (c *UsersSettingsSendAsGetCall) doRequest(alt string) (*http.Response, error) { 10657 reqHeaders := make(http.Header) 10658 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20201124") 10659 for k, v := range c.header_ { 10660 reqHeaders[k] = v 10661 } 10662 reqHeaders.Set("User-Agent", c.s.userAgent()) 10663 if c.ifNoneMatch_ != "" { 10664 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 10665 } 10666 var body io.Reader = nil 10667 c.urlParams_.Set("alt", alt) 10668 c.urlParams_.Set("prettyPrint", "false") 10669 urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/settings/sendAs/{sendAsEmail}") 10670 urls += "?" + c.urlParams_.Encode() 10671 req, err := http.NewRequest("GET", urls, body) 10672 if err != nil { 10673 return nil, err 10674 } 10675 req.Header = reqHeaders 10676 googleapi.Expand(req.URL, map[string]string{ 10677 "userId": c.userId, 10678 "sendAsEmail": c.sendAsEmail, 10679 }) 10680 return gensupport.SendRequest(c.ctx_, c.s.client, req) 10681} 10682 10683// Do executes the "gmail.users.settings.sendAs.get" call. 10684// Exactly one of *SendAs or error will be non-nil. Any non-2xx status 10685// code is an error. Response headers are in either 10686// *SendAs.ServerResponse.Header or (if a response was returned at all) 10687// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 10688// check whether the returned error was because http.StatusNotModified 10689// was returned. 10690func (c *UsersSettingsSendAsGetCall) Do(opts ...googleapi.CallOption) (*SendAs, error) { 10691 gensupport.SetOptions(c.urlParams_, opts...) 10692 res, err := c.doRequest("json") 10693 if res != nil && res.StatusCode == http.StatusNotModified { 10694 if res.Body != nil { 10695 res.Body.Close() 10696 } 10697 return nil, &googleapi.Error{ 10698 Code: res.StatusCode, 10699 Header: res.Header, 10700 } 10701 } 10702 if err != nil { 10703 return nil, err 10704 } 10705 defer googleapi.CloseBody(res) 10706 if err := googleapi.CheckResponse(res); err != nil { 10707 return nil, err 10708 } 10709 ret := &SendAs{ 10710 ServerResponse: googleapi.ServerResponse{ 10711 Header: res.Header, 10712 HTTPStatusCode: res.StatusCode, 10713 }, 10714 } 10715 target := &ret 10716 if err := gensupport.DecodeResponse(target, res); err != nil { 10717 return nil, err 10718 } 10719 return ret, nil 10720 // { 10721 // "description": "Gets the specified send-as alias. Fails with an HTTP 404 error if the specified address is not a member of the collection.", 10722 // "flatPath": "gmail/v1/users/{userId}/settings/sendAs/{sendAsEmail}", 10723 // "httpMethod": "GET", 10724 // "id": "gmail.users.settings.sendAs.get", 10725 // "parameterOrder": [ 10726 // "userId", 10727 // "sendAsEmail" 10728 // ], 10729 // "parameters": { 10730 // "sendAsEmail": { 10731 // "description": "The send-as alias to be retrieved.", 10732 // "location": "path", 10733 // "required": true, 10734 // "type": "string" 10735 // }, 10736 // "userId": { 10737 // "default": "me", 10738 // "description": "User's email address. The special value \"me\" can be used to indicate the authenticated user.", 10739 // "location": "path", 10740 // "required": true, 10741 // "type": "string" 10742 // } 10743 // }, 10744 // "path": "gmail/v1/users/{userId}/settings/sendAs/{sendAsEmail}", 10745 // "response": { 10746 // "$ref": "SendAs" 10747 // }, 10748 // "scopes": [ 10749 // "https://mail.google.com/", 10750 // "https://www.googleapis.com/auth/gmail.modify", 10751 // "https://www.googleapis.com/auth/gmail.readonly", 10752 // "https://www.googleapis.com/auth/gmail.settings.basic" 10753 // ] 10754 // } 10755 10756} 10757 10758// method id "gmail.users.settings.sendAs.list": 10759 10760type UsersSettingsSendAsListCall struct { 10761 s *Service 10762 userId string 10763 urlParams_ gensupport.URLParams 10764 ifNoneMatch_ string 10765 ctx_ context.Context 10766 header_ http.Header 10767} 10768 10769// List: Lists the send-as aliases for the specified account. The result 10770// includes the primary send-as address associated with the account as 10771// well as any custom "from" aliases. 10772func (r *UsersSettingsSendAsService) List(userId string) *UsersSettingsSendAsListCall { 10773 c := &UsersSettingsSendAsListCall{s: r.s, urlParams_: make(gensupport.URLParams)} 10774 c.userId = userId 10775 return c 10776} 10777 10778// Fields allows partial responses to be retrieved. See 10779// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 10780// for more information. 10781func (c *UsersSettingsSendAsListCall) Fields(s ...googleapi.Field) *UsersSettingsSendAsListCall { 10782 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 10783 return c 10784} 10785 10786// IfNoneMatch sets the optional parameter which makes the operation 10787// fail if the object's ETag matches the given value. This is useful for 10788// getting updates only after the object has changed since the last 10789// request. Use googleapi.IsNotModified to check whether the response 10790// error from Do is the result of In-None-Match. 10791func (c *UsersSettingsSendAsListCall) IfNoneMatch(entityTag string) *UsersSettingsSendAsListCall { 10792 c.ifNoneMatch_ = entityTag 10793 return c 10794} 10795 10796// Context sets the context to be used in this call's Do method. Any 10797// pending HTTP request will be aborted if the provided context is 10798// canceled. 10799func (c *UsersSettingsSendAsListCall) Context(ctx context.Context) *UsersSettingsSendAsListCall { 10800 c.ctx_ = ctx 10801 return c 10802} 10803 10804// Header returns an http.Header that can be modified by the caller to 10805// add HTTP headers to the request. 10806func (c *UsersSettingsSendAsListCall) Header() http.Header { 10807 if c.header_ == nil { 10808 c.header_ = make(http.Header) 10809 } 10810 return c.header_ 10811} 10812 10813func (c *UsersSettingsSendAsListCall) doRequest(alt string) (*http.Response, error) { 10814 reqHeaders := make(http.Header) 10815 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20201124") 10816 for k, v := range c.header_ { 10817 reqHeaders[k] = v 10818 } 10819 reqHeaders.Set("User-Agent", c.s.userAgent()) 10820 if c.ifNoneMatch_ != "" { 10821 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 10822 } 10823 var body io.Reader = nil 10824 c.urlParams_.Set("alt", alt) 10825 c.urlParams_.Set("prettyPrint", "false") 10826 urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/settings/sendAs") 10827 urls += "?" + c.urlParams_.Encode() 10828 req, err := http.NewRequest("GET", urls, body) 10829 if err != nil { 10830 return nil, err 10831 } 10832 req.Header = reqHeaders 10833 googleapi.Expand(req.URL, map[string]string{ 10834 "userId": c.userId, 10835 }) 10836 return gensupport.SendRequest(c.ctx_, c.s.client, req) 10837} 10838 10839// Do executes the "gmail.users.settings.sendAs.list" call. 10840// Exactly one of *ListSendAsResponse or error will be non-nil. Any 10841// non-2xx status code is an error. Response headers are in either 10842// *ListSendAsResponse.ServerResponse.Header or (if a response was 10843// returned at all) in error.(*googleapi.Error).Header. Use 10844// googleapi.IsNotModified to check whether the returned error was 10845// because http.StatusNotModified was returned. 10846func (c *UsersSettingsSendAsListCall) Do(opts ...googleapi.CallOption) (*ListSendAsResponse, error) { 10847 gensupport.SetOptions(c.urlParams_, opts...) 10848 res, err := c.doRequest("json") 10849 if res != nil && res.StatusCode == http.StatusNotModified { 10850 if res.Body != nil { 10851 res.Body.Close() 10852 } 10853 return nil, &googleapi.Error{ 10854 Code: res.StatusCode, 10855 Header: res.Header, 10856 } 10857 } 10858 if err != nil { 10859 return nil, err 10860 } 10861 defer googleapi.CloseBody(res) 10862 if err := googleapi.CheckResponse(res); err != nil { 10863 return nil, err 10864 } 10865 ret := &ListSendAsResponse{ 10866 ServerResponse: googleapi.ServerResponse{ 10867 Header: res.Header, 10868 HTTPStatusCode: res.StatusCode, 10869 }, 10870 } 10871 target := &ret 10872 if err := gensupport.DecodeResponse(target, res); err != nil { 10873 return nil, err 10874 } 10875 return ret, nil 10876 // { 10877 // "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.", 10878 // "flatPath": "gmail/v1/users/{userId}/settings/sendAs", 10879 // "httpMethod": "GET", 10880 // "id": "gmail.users.settings.sendAs.list", 10881 // "parameterOrder": [ 10882 // "userId" 10883 // ], 10884 // "parameters": { 10885 // "userId": { 10886 // "default": "me", 10887 // "description": "User's email address. The special value \"me\" can be used to indicate the authenticated user.", 10888 // "location": "path", 10889 // "required": true, 10890 // "type": "string" 10891 // } 10892 // }, 10893 // "path": "gmail/v1/users/{userId}/settings/sendAs", 10894 // "response": { 10895 // "$ref": "ListSendAsResponse" 10896 // }, 10897 // "scopes": [ 10898 // "https://mail.google.com/", 10899 // "https://www.googleapis.com/auth/gmail.modify", 10900 // "https://www.googleapis.com/auth/gmail.readonly", 10901 // "https://www.googleapis.com/auth/gmail.settings.basic" 10902 // ] 10903 // } 10904 10905} 10906 10907// method id "gmail.users.settings.sendAs.patch": 10908 10909type UsersSettingsSendAsPatchCall struct { 10910 s *Service 10911 userId string 10912 sendAsEmail string 10913 sendas *SendAs 10914 urlParams_ gensupport.URLParams 10915 ctx_ context.Context 10916 header_ http.Header 10917} 10918 10919// Patch: Patch the specified send-as alias. 10920func (r *UsersSettingsSendAsService) Patch(userId string, sendAsEmail string, sendas *SendAs) *UsersSettingsSendAsPatchCall { 10921 c := &UsersSettingsSendAsPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)} 10922 c.userId = userId 10923 c.sendAsEmail = sendAsEmail 10924 c.sendas = sendas 10925 return c 10926} 10927 10928// Fields allows partial responses to be retrieved. See 10929// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 10930// for more information. 10931func (c *UsersSettingsSendAsPatchCall) Fields(s ...googleapi.Field) *UsersSettingsSendAsPatchCall { 10932 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 10933 return c 10934} 10935 10936// Context sets the context to be used in this call's Do method. Any 10937// pending HTTP request will be aborted if the provided context is 10938// canceled. 10939func (c *UsersSettingsSendAsPatchCall) Context(ctx context.Context) *UsersSettingsSendAsPatchCall { 10940 c.ctx_ = ctx 10941 return c 10942} 10943 10944// Header returns an http.Header that can be modified by the caller to 10945// add HTTP headers to the request. 10946func (c *UsersSettingsSendAsPatchCall) Header() http.Header { 10947 if c.header_ == nil { 10948 c.header_ = make(http.Header) 10949 } 10950 return c.header_ 10951} 10952 10953func (c *UsersSettingsSendAsPatchCall) doRequest(alt string) (*http.Response, error) { 10954 reqHeaders := make(http.Header) 10955 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20201124") 10956 for k, v := range c.header_ { 10957 reqHeaders[k] = v 10958 } 10959 reqHeaders.Set("User-Agent", c.s.userAgent()) 10960 var body io.Reader = nil 10961 body, err := googleapi.WithoutDataWrapper.JSONReader(c.sendas) 10962 if err != nil { 10963 return nil, err 10964 } 10965 reqHeaders.Set("Content-Type", "application/json") 10966 c.urlParams_.Set("alt", alt) 10967 c.urlParams_.Set("prettyPrint", "false") 10968 urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/settings/sendAs/{sendAsEmail}") 10969 urls += "?" + c.urlParams_.Encode() 10970 req, err := http.NewRequest("PATCH", urls, body) 10971 if err != nil { 10972 return nil, err 10973 } 10974 req.Header = reqHeaders 10975 googleapi.Expand(req.URL, map[string]string{ 10976 "userId": c.userId, 10977 "sendAsEmail": c.sendAsEmail, 10978 }) 10979 return gensupport.SendRequest(c.ctx_, c.s.client, req) 10980} 10981 10982// Do executes the "gmail.users.settings.sendAs.patch" call. 10983// Exactly one of *SendAs or error will be non-nil. Any non-2xx status 10984// code is an error. Response headers are in either 10985// *SendAs.ServerResponse.Header or (if a response was returned at all) 10986// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 10987// check whether the returned error was because http.StatusNotModified 10988// was returned. 10989func (c *UsersSettingsSendAsPatchCall) Do(opts ...googleapi.CallOption) (*SendAs, error) { 10990 gensupport.SetOptions(c.urlParams_, opts...) 10991 res, err := c.doRequest("json") 10992 if res != nil && res.StatusCode == http.StatusNotModified { 10993 if res.Body != nil { 10994 res.Body.Close() 10995 } 10996 return nil, &googleapi.Error{ 10997 Code: res.StatusCode, 10998 Header: res.Header, 10999 } 11000 } 11001 if err != nil { 11002 return nil, err 11003 } 11004 defer googleapi.CloseBody(res) 11005 if err := googleapi.CheckResponse(res); err != nil { 11006 return nil, err 11007 } 11008 ret := &SendAs{ 11009 ServerResponse: googleapi.ServerResponse{ 11010 Header: res.Header, 11011 HTTPStatusCode: res.StatusCode, 11012 }, 11013 } 11014 target := &ret 11015 if err := gensupport.DecodeResponse(target, res); err != nil { 11016 return nil, err 11017 } 11018 return ret, nil 11019 // { 11020 // "description": "Patch the specified send-as alias.", 11021 // "flatPath": "gmail/v1/users/{userId}/settings/sendAs/{sendAsEmail}", 11022 // "httpMethod": "PATCH", 11023 // "id": "gmail.users.settings.sendAs.patch", 11024 // "parameterOrder": [ 11025 // "userId", 11026 // "sendAsEmail" 11027 // ], 11028 // "parameters": { 11029 // "sendAsEmail": { 11030 // "description": "The send-as alias to be updated.", 11031 // "location": "path", 11032 // "required": true, 11033 // "type": "string" 11034 // }, 11035 // "userId": { 11036 // "default": "me", 11037 // "description": "User's email address. The special value \"me\" can be used to indicate the authenticated user.", 11038 // "location": "path", 11039 // "required": true, 11040 // "type": "string" 11041 // } 11042 // }, 11043 // "path": "gmail/v1/users/{userId}/settings/sendAs/{sendAsEmail}", 11044 // "request": { 11045 // "$ref": "SendAs" 11046 // }, 11047 // "response": { 11048 // "$ref": "SendAs" 11049 // }, 11050 // "scopes": [ 11051 // "https://www.googleapis.com/auth/gmail.settings.basic", 11052 // "https://www.googleapis.com/auth/gmail.settings.sharing" 11053 // ] 11054 // } 11055 11056} 11057 11058// method id "gmail.users.settings.sendAs.update": 11059 11060type UsersSettingsSendAsUpdateCall struct { 11061 s *Service 11062 userId string 11063 sendAsEmail string 11064 sendas *SendAs 11065 urlParams_ gensupport.URLParams 11066 ctx_ context.Context 11067 header_ http.Header 11068} 11069 11070// Update: Updates a send-as alias. If a signature is provided, Gmail 11071// will sanitize the HTML before saving it with the alias. Addresses 11072// other than the primary address for the account can only be updated by 11073// service account clients that have been delegated domain-wide 11074// authority. 11075func (r *UsersSettingsSendAsService) Update(userId string, sendAsEmail string, sendas *SendAs) *UsersSettingsSendAsUpdateCall { 11076 c := &UsersSettingsSendAsUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)} 11077 c.userId = userId 11078 c.sendAsEmail = sendAsEmail 11079 c.sendas = sendas 11080 return c 11081} 11082 11083// Fields allows partial responses to be retrieved. See 11084// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 11085// for more information. 11086func (c *UsersSettingsSendAsUpdateCall) Fields(s ...googleapi.Field) *UsersSettingsSendAsUpdateCall { 11087 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 11088 return c 11089} 11090 11091// Context sets the context to be used in this call's Do method. Any 11092// pending HTTP request will be aborted if the provided context is 11093// canceled. 11094func (c *UsersSettingsSendAsUpdateCall) Context(ctx context.Context) *UsersSettingsSendAsUpdateCall { 11095 c.ctx_ = ctx 11096 return c 11097} 11098 11099// Header returns an http.Header that can be modified by the caller to 11100// add HTTP headers to the request. 11101func (c *UsersSettingsSendAsUpdateCall) Header() http.Header { 11102 if c.header_ == nil { 11103 c.header_ = make(http.Header) 11104 } 11105 return c.header_ 11106} 11107 11108func (c *UsersSettingsSendAsUpdateCall) doRequest(alt string) (*http.Response, error) { 11109 reqHeaders := make(http.Header) 11110 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20201124") 11111 for k, v := range c.header_ { 11112 reqHeaders[k] = v 11113 } 11114 reqHeaders.Set("User-Agent", c.s.userAgent()) 11115 var body io.Reader = nil 11116 body, err := googleapi.WithoutDataWrapper.JSONReader(c.sendas) 11117 if err != nil { 11118 return nil, err 11119 } 11120 reqHeaders.Set("Content-Type", "application/json") 11121 c.urlParams_.Set("alt", alt) 11122 c.urlParams_.Set("prettyPrint", "false") 11123 urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/settings/sendAs/{sendAsEmail}") 11124 urls += "?" + c.urlParams_.Encode() 11125 req, err := http.NewRequest("PUT", urls, body) 11126 if err != nil { 11127 return nil, err 11128 } 11129 req.Header = reqHeaders 11130 googleapi.Expand(req.URL, map[string]string{ 11131 "userId": c.userId, 11132 "sendAsEmail": c.sendAsEmail, 11133 }) 11134 return gensupport.SendRequest(c.ctx_, c.s.client, req) 11135} 11136 11137// Do executes the "gmail.users.settings.sendAs.update" call. 11138// Exactly one of *SendAs or error will be non-nil. Any non-2xx status 11139// code is an error. Response headers are in either 11140// *SendAs.ServerResponse.Header or (if a response was returned at all) 11141// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 11142// check whether the returned error was because http.StatusNotModified 11143// was returned. 11144func (c *UsersSettingsSendAsUpdateCall) Do(opts ...googleapi.CallOption) (*SendAs, error) { 11145 gensupport.SetOptions(c.urlParams_, opts...) 11146 res, err := c.doRequest("json") 11147 if res != nil && res.StatusCode == http.StatusNotModified { 11148 if res.Body != nil { 11149 res.Body.Close() 11150 } 11151 return nil, &googleapi.Error{ 11152 Code: res.StatusCode, 11153 Header: res.Header, 11154 } 11155 } 11156 if err != nil { 11157 return nil, err 11158 } 11159 defer googleapi.CloseBody(res) 11160 if err := googleapi.CheckResponse(res); err != nil { 11161 return nil, err 11162 } 11163 ret := &SendAs{ 11164 ServerResponse: googleapi.ServerResponse{ 11165 Header: res.Header, 11166 HTTPStatusCode: res.StatusCode, 11167 }, 11168 } 11169 target := &ret 11170 if err := gensupport.DecodeResponse(target, res); err != nil { 11171 return nil, err 11172 } 11173 return ret, nil 11174 // { 11175 // "description": "Updates a send-as alias. If a signature is provided, Gmail will sanitize the HTML before saving it with the alias. Addresses other than the primary address for the account can only be updated by service account clients that have been delegated domain-wide authority.", 11176 // "flatPath": "gmail/v1/users/{userId}/settings/sendAs/{sendAsEmail}", 11177 // "httpMethod": "PUT", 11178 // "id": "gmail.users.settings.sendAs.update", 11179 // "parameterOrder": [ 11180 // "userId", 11181 // "sendAsEmail" 11182 // ], 11183 // "parameters": { 11184 // "sendAsEmail": { 11185 // "description": "The send-as alias to be updated.", 11186 // "location": "path", 11187 // "required": true, 11188 // "type": "string" 11189 // }, 11190 // "userId": { 11191 // "default": "me", 11192 // "description": "User's email address. The special value \"me\" can be used to indicate the authenticated user.", 11193 // "location": "path", 11194 // "required": true, 11195 // "type": "string" 11196 // } 11197 // }, 11198 // "path": "gmail/v1/users/{userId}/settings/sendAs/{sendAsEmail}", 11199 // "request": { 11200 // "$ref": "SendAs" 11201 // }, 11202 // "response": { 11203 // "$ref": "SendAs" 11204 // }, 11205 // "scopes": [ 11206 // "https://www.googleapis.com/auth/gmail.settings.basic", 11207 // "https://www.googleapis.com/auth/gmail.settings.sharing" 11208 // ] 11209 // } 11210 11211} 11212 11213// method id "gmail.users.settings.sendAs.verify": 11214 11215type UsersSettingsSendAsVerifyCall struct { 11216 s *Service 11217 userId string 11218 sendAsEmail string 11219 urlParams_ gensupport.URLParams 11220 ctx_ context.Context 11221 header_ http.Header 11222} 11223 11224// Verify: Sends a verification email to the specified send-as alias 11225// address. The verification status must be `pending`. This method is 11226// only available to service account clients that have been delegated 11227// domain-wide authority. 11228func (r *UsersSettingsSendAsService) Verify(userId string, sendAsEmail string) *UsersSettingsSendAsVerifyCall { 11229 c := &UsersSettingsSendAsVerifyCall{s: r.s, urlParams_: make(gensupport.URLParams)} 11230 c.userId = userId 11231 c.sendAsEmail = sendAsEmail 11232 return c 11233} 11234 11235// Fields allows partial responses to be retrieved. See 11236// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 11237// for more information. 11238func (c *UsersSettingsSendAsVerifyCall) Fields(s ...googleapi.Field) *UsersSettingsSendAsVerifyCall { 11239 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 11240 return c 11241} 11242 11243// Context sets the context to be used in this call's Do method. Any 11244// pending HTTP request will be aborted if the provided context is 11245// canceled. 11246func (c *UsersSettingsSendAsVerifyCall) Context(ctx context.Context) *UsersSettingsSendAsVerifyCall { 11247 c.ctx_ = ctx 11248 return c 11249} 11250 11251// Header returns an http.Header that can be modified by the caller to 11252// add HTTP headers to the request. 11253func (c *UsersSettingsSendAsVerifyCall) Header() http.Header { 11254 if c.header_ == nil { 11255 c.header_ = make(http.Header) 11256 } 11257 return c.header_ 11258} 11259 11260func (c *UsersSettingsSendAsVerifyCall) doRequest(alt string) (*http.Response, error) { 11261 reqHeaders := make(http.Header) 11262 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20201124") 11263 for k, v := range c.header_ { 11264 reqHeaders[k] = v 11265 } 11266 reqHeaders.Set("User-Agent", c.s.userAgent()) 11267 var body io.Reader = nil 11268 c.urlParams_.Set("alt", alt) 11269 c.urlParams_.Set("prettyPrint", "false") 11270 urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/settings/sendAs/{sendAsEmail}/verify") 11271 urls += "?" + c.urlParams_.Encode() 11272 req, err := http.NewRequest("POST", urls, body) 11273 if err != nil { 11274 return nil, err 11275 } 11276 req.Header = reqHeaders 11277 googleapi.Expand(req.URL, map[string]string{ 11278 "userId": c.userId, 11279 "sendAsEmail": c.sendAsEmail, 11280 }) 11281 return gensupport.SendRequest(c.ctx_, c.s.client, req) 11282} 11283 11284// Do executes the "gmail.users.settings.sendAs.verify" call. 11285func (c *UsersSettingsSendAsVerifyCall) Do(opts ...googleapi.CallOption) error { 11286 gensupport.SetOptions(c.urlParams_, opts...) 11287 res, err := c.doRequest("json") 11288 if err != nil { 11289 return err 11290 } 11291 defer googleapi.CloseBody(res) 11292 if err := googleapi.CheckResponse(res); err != nil { 11293 return err 11294 } 11295 return nil 11296 // { 11297 // "description": "Sends a verification email to the specified send-as alias address. The verification status must be `pending`. This method is only available to service account clients that have been delegated domain-wide authority.", 11298 // "flatPath": "gmail/v1/users/{userId}/settings/sendAs/{sendAsEmail}/verify", 11299 // "httpMethod": "POST", 11300 // "id": "gmail.users.settings.sendAs.verify", 11301 // "parameterOrder": [ 11302 // "userId", 11303 // "sendAsEmail" 11304 // ], 11305 // "parameters": { 11306 // "sendAsEmail": { 11307 // "description": "The send-as alias to be verified.", 11308 // "location": "path", 11309 // "required": true, 11310 // "type": "string" 11311 // }, 11312 // "userId": { 11313 // "default": "me", 11314 // "description": "User's email address. The special value \"me\" can be used to indicate the authenticated user.", 11315 // "location": "path", 11316 // "required": true, 11317 // "type": "string" 11318 // } 11319 // }, 11320 // "path": "gmail/v1/users/{userId}/settings/sendAs/{sendAsEmail}/verify", 11321 // "scopes": [ 11322 // "https://www.googleapis.com/auth/gmail.settings.sharing" 11323 // ] 11324 // } 11325 11326} 11327 11328// method id "gmail.users.settings.sendAs.smimeInfo.delete": 11329 11330type UsersSettingsSendAsSmimeInfoDeleteCall struct { 11331 s *Service 11332 userId string 11333 sendAsEmail string 11334 id string 11335 urlParams_ gensupport.URLParams 11336 ctx_ context.Context 11337 header_ http.Header 11338} 11339 11340// Delete: Deletes the specified S/MIME config for the specified send-as 11341// alias. 11342func (r *UsersSettingsSendAsSmimeInfoService) Delete(userId string, sendAsEmail string, id string) *UsersSettingsSendAsSmimeInfoDeleteCall { 11343 c := &UsersSettingsSendAsSmimeInfoDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)} 11344 c.userId = userId 11345 c.sendAsEmail = sendAsEmail 11346 c.id = id 11347 return c 11348} 11349 11350// Fields allows partial responses to be retrieved. See 11351// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 11352// for more information. 11353func (c *UsersSettingsSendAsSmimeInfoDeleteCall) Fields(s ...googleapi.Field) *UsersSettingsSendAsSmimeInfoDeleteCall { 11354 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 11355 return c 11356} 11357 11358// Context sets the context to be used in this call's Do method. Any 11359// pending HTTP request will be aborted if the provided context is 11360// canceled. 11361func (c *UsersSettingsSendAsSmimeInfoDeleteCall) Context(ctx context.Context) *UsersSettingsSendAsSmimeInfoDeleteCall { 11362 c.ctx_ = ctx 11363 return c 11364} 11365 11366// Header returns an http.Header that can be modified by the caller to 11367// add HTTP headers to the request. 11368func (c *UsersSettingsSendAsSmimeInfoDeleteCall) Header() http.Header { 11369 if c.header_ == nil { 11370 c.header_ = make(http.Header) 11371 } 11372 return c.header_ 11373} 11374 11375func (c *UsersSettingsSendAsSmimeInfoDeleteCall) doRequest(alt string) (*http.Response, error) { 11376 reqHeaders := make(http.Header) 11377 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20201124") 11378 for k, v := range c.header_ { 11379 reqHeaders[k] = v 11380 } 11381 reqHeaders.Set("User-Agent", c.s.userAgent()) 11382 var body io.Reader = nil 11383 c.urlParams_.Set("alt", alt) 11384 c.urlParams_.Set("prettyPrint", "false") 11385 urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/settings/sendAs/{sendAsEmail}/smimeInfo/{id}") 11386 urls += "?" + c.urlParams_.Encode() 11387 req, err := http.NewRequest("DELETE", urls, body) 11388 if err != nil { 11389 return nil, err 11390 } 11391 req.Header = reqHeaders 11392 googleapi.Expand(req.URL, map[string]string{ 11393 "userId": c.userId, 11394 "sendAsEmail": c.sendAsEmail, 11395 "id": c.id, 11396 }) 11397 return gensupport.SendRequest(c.ctx_, c.s.client, req) 11398} 11399 11400// Do executes the "gmail.users.settings.sendAs.smimeInfo.delete" call. 11401func (c *UsersSettingsSendAsSmimeInfoDeleteCall) Do(opts ...googleapi.CallOption) error { 11402 gensupport.SetOptions(c.urlParams_, opts...) 11403 res, err := c.doRequest("json") 11404 if err != nil { 11405 return err 11406 } 11407 defer googleapi.CloseBody(res) 11408 if err := googleapi.CheckResponse(res); err != nil { 11409 return err 11410 } 11411 return nil 11412 // { 11413 // "description": "Deletes the specified S/MIME config for the specified send-as alias.", 11414 // "flatPath": "gmail/v1/users/{userId}/settings/sendAs/{sendAsEmail}/smimeInfo/{id}", 11415 // "httpMethod": "DELETE", 11416 // "id": "gmail.users.settings.sendAs.smimeInfo.delete", 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": "gmail/v1/users/{userId}/settings/sendAs/{sendAsEmail}/smimeInfo/{id}", 11444 // "scopes": [ 11445 // "https://www.googleapis.com/auth/gmail.settings.basic", 11446 // "https://www.googleapis.com/auth/gmail.settings.sharing" 11447 // ] 11448 // } 11449 11450} 11451 11452// method id "gmail.users.settings.sendAs.smimeInfo.get": 11453 11454type UsersSettingsSendAsSmimeInfoGetCall struct { 11455 s *Service 11456 userId string 11457 sendAsEmail string 11458 id string 11459 urlParams_ gensupport.URLParams 11460 ifNoneMatch_ string 11461 ctx_ context.Context 11462 header_ http.Header 11463} 11464 11465// Get: Gets the specified S/MIME config for the specified send-as 11466// alias. 11467func (r *UsersSettingsSendAsSmimeInfoService) Get(userId string, sendAsEmail string, id string) *UsersSettingsSendAsSmimeInfoGetCall { 11468 c := &UsersSettingsSendAsSmimeInfoGetCall{s: r.s, urlParams_: make(gensupport.URLParams)} 11469 c.userId = userId 11470 c.sendAsEmail = sendAsEmail 11471 c.id = id 11472 return c 11473} 11474 11475// Fields allows partial responses to be retrieved. See 11476// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 11477// for more information. 11478func (c *UsersSettingsSendAsSmimeInfoGetCall) Fields(s ...googleapi.Field) *UsersSettingsSendAsSmimeInfoGetCall { 11479 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 11480 return c 11481} 11482 11483// IfNoneMatch sets the optional parameter which makes the operation 11484// fail if the object's ETag matches the given value. This is useful for 11485// getting updates only after the object has changed since the last 11486// request. Use googleapi.IsNotModified to check whether the response 11487// error from Do is the result of In-None-Match. 11488func (c *UsersSettingsSendAsSmimeInfoGetCall) IfNoneMatch(entityTag string) *UsersSettingsSendAsSmimeInfoGetCall { 11489 c.ifNoneMatch_ = entityTag 11490 return c 11491} 11492 11493// Context sets the context to be used in this call's Do method. Any 11494// pending HTTP request will be aborted if the provided context is 11495// canceled. 11496func (c *UsersSettingsSendAsSmimeInfoGetCall) Context(ctx context.Context) *UsersSettingsSendAsSmimeInfoGetCall { 11497 c.ctx_ = ctx 11498 return c 11499} 11500 11501// Header returns an http.Header that can be modified by the caller to 11502// add HTTP headers to the request. 11503func (c *UsersSettingsSendAsSmimeInfoGetCall) Header() http.Header { 11504 if c.header_ == nil { 11505 c.header_ = make(http.Header) 11506 } 11507 return c.header_ 11508} 11509 11510func (c *UsersSettingsSendAsSmimeInfoGetCall) doRequest(alt string) (*http.Response, error) { 11511 reqHeaders := make(http.Header) 11512 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20201124") 11513 for k, v := range c.header_ { 11514 reqHeaders[k] = v 11515 } 11516 reqHeaders.Set("User-Agent", c.s.userAgent()) 11517 if c.ifNoneMatch_ != "" { 11518 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 11519 } 11520 var body io.Reader = nil 11521 c.urlParams_.Set("alt", alt) 11522 c.urlParams_.Set("prettyPrint", "false") 11523 urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/settings/sendAs/{sendAsEmail}/smimeInfo/{id}") 11524 urls += "?" + c.urlParams_.Encode() 11525 req, err := http.NewRequest("GET", urls, body) 11526 if err != nil { 11527 return nil, err 11528 } 11529 req.Header = reqHeaders 11530 googleapi.Expand(req.URL, map[string]string{ 11531 "userId": c.userId, 11532 "sendAsEmail": c.sendAsEmail, 11533 "id": c.id, 11534 }) 11535 return gensupport.SendRequest(c.ctx_, c.s.client, req) 11536} 11537 11538// Do executes the "gmail.users.settings.sendAs.smimeInfo.get" call. 11539// Exactly one of *SmimeInfo or error will be non-nil. Any non-2xx 11540// status code is an error. Response headers are in either 11541// *SmimeInfo.ServerResponse.Header or (if a response was returned at 11542// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 11543// to check whether the returned error was because 11544// http.StatusNotModified was returned. 11545func (c *UsersSettingsSendAsSmimeInfoGetCall) Do(opts ...googleapi.CallOption) (*SmimeInfo, error) { 11546 gensupport.SetOptions(c.urlParams_, opts...) 11547 res, err := c.doRequest("json") 11548 if res != nil && res.StatusCode == http.StatusNotModified { 11549 if res.Body != nil { 11550 res.Body.Close() 11551 } 11552 return nil, &googleapi.Error{ 11553 Code: res.StatusCode, 11554 Header: res.Header, 11555 } 11556 } 11557 if err != nil { 11558 return nil, err 11559 } 11560 defer googleapi.CloseBody(res) 11561 if err := googleapi.CheckResponse(res); err != nil { 11562 return nil, err 11563 } 11564 ret := &SmimeInfo{ 11565 ServerResponse: googleapi.ServerResponse{ 11566 Header: res.Header, 11567 HTTPStatusCode: res.StatusCode, 11568 }, 11569 } 11570 target := &ret 11571 if err := gensupport.DecodeResponse(target, res); err != nil { 11572 return nil, err 11573 } 11574 return ret, nil 11575 // { 11576 // "description": "Gets the specified S/MIME config for the specified send-as alias.", 11577 // "flatPath": "gmail/v1/users/{userId}/settings/sendAs/{sendAsEmail}/smimeInfo/{id}", 11578 // "httpMethod": "GET", 11579 // "id": "gmail.users.settings.sendAs.smimeInfo.get", 11580 // "parameterOrder": [ 11581 // "userId", 11582 // "sendAsEmail", 11583 // "id" 11584 // ], 11585 // "parameters": { 11586 // "id": { 11587 // "description": "The immutable ID for the SmimeInfo.", 11588 // "location": "path", 11589 // "required": true, 11590 // "type": "string" 11591 // }, 11592 // "sendAsEmail": { 11593 // "description": "The email address that appears in the \"From:\" header for mail sent using this alias.", 11594 // "location": "path", 11595 // "required": true, 11596 // "type": "string" 11597 // }, 11598 // "userId": { 11599 // "default": "me", 11600 // "description": "The user's email address. The special value `me` can be used to indicate the authenticated user.", 11601 // "location": "path", 11602 // "required": true, 11603 // "type": "string" 11604 // } 11605 // }, 11606 // "path": "gmail/v1/users/{userId}/settings/sendAs/{sendAsEmail}/smimeInfo/{id}", 11607 // "response": { 11608 // "$ref": "SmimeInfo" 11609 // }, 11610 // "scopes": [ 11611 // "https://mail.google.com/", 11612 // "https://www.googleapis.com/auth/gmail.modify", 11613 // "https://www.googleapis.com/auth/gmail.readonly", 11614 // "https://www.googleapis.com/auth/gmail.settings.basic", 11615 // "https://www.googleapis.com/auth/gmail.settings.sharing" 11616 // ] 11617 // } 11618 11619} 11620 11621// method id "gmail.users.settings.sendAs.smimeInfo.insert": 11622 11623type UsersSettingsSendAsSmimeInfoInsertCall struct { 11624 s *Service 11625 userId string 11626 sendAsEmail string 11627 smimeinfo *SmimeInfo 11628 urlParams_ gensupport.URLParams 11629 ctx_ context.Context 11630 header_ http.Header 11631} 11632 11633// Insert: Insert (upload) the given S/MIME config for the specified 11634// send-as alias. Note that pkcs12 format is required for the key. 11635func (r *UsersSettingsSendAsSmimeInfoService) Insert(userId string, sendAsEmail string, smimeinfo *SmimeInfo) *UsersSettingsSendAsSmimeInfoInsertCall { 11636 c := &UsersSettingsSendAsSmimeInfoInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)} 11637 c.userId = userId 11638 c.sendAsEmail = sendAsEmail 11639 c.smimeinfo = smimeinfo 11640 return c 11641} 11642 11643// Fields allows partial responses to be retrieved. See 11644// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 11645// for more information. 11646func (c *UsersSettingsSendAsSmimeInfoInsertCall) Fields(s ...googleapi.Field) *UsersSettingsSendAsSmimeInfoInsertCall { 11647 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 11648 return c 11649} 11650 11651// Context sets the context to be used in this call's Do method. Any 11652// pending HTTP request will be aborted if the provided context is 11653// canceled. 11654func (c *UsersSettingsSendAsSmimeInfoInsertCall) Context(ctx context.Context) *UsersSettingsSendAsSmimeInfoInsertCall { 11655 c.ctx_ = ctx 11656 return c 11657} 11658 11659// Header returns an http.Header that can be modified by the caller to 11660// add HTTP headers to the request. 11661func (c *UsersSettingsSendAsSmimeInfoInsertCall) Header() http.Header { 11662 if c.header_ == nil { 11663 c.header_ = make(http.Header) 11664 } 11665 return c.header_ 11666} 11667 11668func (c *UsersSettingsSendAsSmimeInfoInsertCall) doRequest(alt string) (*http.Response, error) { 11669 reqHeaders := make(http.Header) 11670 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20201124") 11671 for k, v := range c.header_ { 11672 reqHeaders[k] = v 11673 } 11674 reqHeaders.Set("User-Agent", c.s.userAgent()) 11675 var body io.Reader = nil 11676 body, err := googleapi.WithoutDataWrapper.JSONReader(c.smimeinfo) 11677 if err != nil { 11678 return nil, err 11679 } 11680 reqHeaders.Set("Content-Type", "application/json") 11681 c.urlParams_.Set("alt", alt) 11682 c.urlParams_.Set("prettyPrint", "false") 11683 urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/settings/sendAs/{sendAsEmail}/smimeInfo") 11684 urls += "?" + c.urlParams_.Encode() 11685 req, err := http.NewRequest("POST", urls, body) 11686 if err != nil { 11687 return nil, err 11688 } 11689 req.Header = reqHeaders 11690 googleapi.Expand(req.URL, map[string]string{ 11691 "userId": c.userId, 11692 "sendAsEmail": c.sendAsEmail, 11693 }) 11694 return gensupport.SendRequest(c.ctx_, c.s.client, req) 11695} 11696 11697// Do executes the "gmail.users.settings.sendAs.smimeInfo.insert" call. 11698// Exactly one of *SmimeInfo or error will be non-nil. Any non-2xx 11699// status code is an error. Response headers are in either 11700// *SmimeInfo.ServerResponse.Header or (if a response was returned at 11701// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 11702// to check whether the returned error was because 11703// http.StatusNotModified was returned. 11704func (c *UsersSettingsSendAsSmimeInfoInsertCall) Do(opts ...googleapi.CallOption) (*SmimeInfo, error) { 11705 gensupport.SetOptions(c.urlParams_, opts...) 11706 res, err := c.doRequest("json") 11707 if res != nil && res.StatusCode == http.StatusNotModified { 11708 if res.Body != nil { 11709 res.Body.Close() 11710 } 11711 return nil, &googleapi.Error{ 11712 Code: res.StatusCode, 11713 Header: res.Header, 11714 } 11715 } 11716 if err != nil { 11717 return nil, err 11718 } 11719 defer googleapi.CloseBody(res) 11720 if err := googleapi.CheckResponse(res); err != nil { 11721 return nil, err 11722 } 11723 ret := &SmimeInfo{ 11724 ServerResponse: googleapi.ServerResponse{ 11725 Header: res.Header, 11726 HTTPStatusCode: res.StatusCode, 11727 }, 11728 } 11729 target := &ret 11730 if err := gensupport.DecodeResponse(target, res); err != nil { 11731 return nil, err 11732 } 11733 return ret, nil 11734 // { 11735 // "description": "Insert (upload) the given S/MIME config for the specified send-as alias. Note that pkcs12 format is required for the key.", 11736 // "flatPath": "gmail/v1/users/{userId}/settings/sendAs/{sendAsEmail}/smimeInfo", 11737 // "httpMethod": "POST", 11738 // "id": "gmail.users.settings.sendAs.smimeInfo.insert", 11739 // "parameterOrder": [ 11740 // "userId", 11741 // "sendAsEmail" 11742 // ], 11743 // "parameters": { 11744 // "sendAsEmail": { 11745 // "description": "The email address that appears in the \"From:\" header for mail sent using this alias.", 11746 // "location": "path", 11747 // "required": true, 11748 // "type": "string" 11749 // }, 11750 // "userId": { 11751 // "default": "me", 11752 // "description": "The user's email address. The special value `me` can be used to indicate the authenticated user.", 11753 // "location": "path", 11754 // "required": true, 11755 // "type": "string" 11756 // } 11757 // }, 11758 // "path": "gmail/v1/users/{userId}/settings/sendAs/{sendAsEmail}/smimeInfo", 11759 // "request": { 11760 // "$ref": "SmimeInfo" 11761 // }, 11762 // "response": { 11763 // "$ref": "SmimeInfo" 11764 // }, 11765 // "scopes": [ 11766 // "https://www.googleapis.com/auth/gmail.settings.basic", 11767 // "https://www.googleapis.com/auth/gmail.settings.sharing" 11768 // ] 11769 // } 11770 11771} 11772 11773// method id "gmail.users.settings.sendAs.smimeInfo.list": 11774 11775type UsersSettingsSendAsSmimeInfoListCall struct { 11776 s *Service 11777 userId string 11778 sendAsEmail string 11779 urlParams_ gensupport.URLParams 11780 ifNoneMatch_ string 11781 ctx_ context.Context 11782 header_ http.Header 11783} 11784 11785// List: Lists S/MIME configs for the specified send-as alias. 11786func (r *UsersSettingsSendAsSmimeInfoService) List(userId string, sendAsEmail string) *UsersSettingsSendAsSmimeInfoListCall { 11787 c := &UsersSettingsSendAsSmimeInfoListCall{s: r.s, urlParams_: make(gensupport.URLParams)} 11788 c.userId = userId 11789 c.sendAsEmail = sendAsEmail 11790 return c 11791} 11792 11793// Fields allows partial responses to be retrieved. See 11794// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 11795// for more information. 11796func (c *UsersSettingsSendAsSmimeInfoListCall) Fields(s ...googleapi.Field) *UsersSettingsSendAsSmimeInfoListCall { 11797 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 11798 return c 11799} 11800 11801// IfNoneMatch sets the optional parameter which makes the operation 11802// fail if the object's ETag matches the given value. This is useful for 11803// getting updates only after the object has changed since the last 11804// request. Use googleapi.IsNotModified to check whether the response 11805// error from Do is the result of In-None-Match. 11806func (c *UsersSettingsSendAsSmimeInfoListCall) IfNoneMatch(entityTag string) *UsersSettingsSendAsSmimeInfoListCall { 11807 c.ifNoneMatch_ = entityTag 11808 return c 11809} 11810 11811// Context sets the context to be used in this call's Do method. Any 11812// pending HTTP request will be aborted if the provided context is 11813// canceled. 11814func (c *UsersSettingsSendAsSmimeInfoListCall) Context(ctx context.Context) *UsersSettingsSendAsSmimeInfoListCall { 11815 c.ctx_ = ctx 11816 return c 11817} 11818 11819// Header returns an http.Header that can be modified by the caller to 11820// add HTTP headers to the request. 11821func (c *UsersSettingsSendAsSmimeInfoListCall) Header() http.Header { 11822 if c.header_ == nil { 11823 c.header_ = make(http.Header) 11824 } 11825 return c.header_ 11826} 11827 11828func (c *UsersSettingsSendAsSmimeInfoListCall) doRequest(alt string) (*http.Response, error) { 11829 reqHeaders := make(http.Header) 11830 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20201124") 11831 for k, v := range c.header_ { 11832 reqHeaders[k] = v 11833 } 11834 reqHeaders.Set("User-Agent", c.s.userAgent()) 11835 if c.ifNoneMatch_ != "" { 11836 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 11837 } 11838 var body io.Reader = nil 11839 c.urlParams_.Set("alt", alt) 11840 c.urlParams_.Set("prettyPrint", "false") 11841 urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/settings/sendAs/{sendAsEmail}/smimeInfo") 11842 urls += "?" + c.urlParams_.Encode() 11843 req, err := http.NewRequest("GET", urls, body) 11844 if err != nil { 11845 return nil, err 11846 } 11847 req.Header = reqHeaders 11848 googleapi.Expand(req.URL, map[string]string{ 11849 "userId": c.userId, 11850 "sendAsEmail": c.sendAsEmail, 11851 }) 11852 return gensupport.SendRequest(c.ctx_, c.s.client, req) 11853} 11854 11855// Do executes the "gmail.users.settings.sendAs.smimeInfo.list" call. 11856// Exactly one of *ListSmimeInfoResponse or error will be non-nil. Any 11857// non-2xx status code is an error. Response headers are in either 11858// *ListSmimeInfoResponse.ServerResponse.Header or (if a response was 11859// returned at all) in error.(*googleapi.Error).Header. Use 11860// googleapi.IsNotModified to check whether the returned error was 11861// because http.StatusNotModified was returned. 11862func (c *UsersSettingsSendAsSmimeInfoListCall) Do(opts ...googleapi.CallOption) (*ListSmimeInfoResponse, error) { 11863 gensupport.SetOptions(c.urlParams_, opts...) 11864 res, err := c.doRequest("json") 11865 if res != nil && res.StatusCode == http.StatusNotModified { 11866 if res.Body != nil { 11867 res.Body.Close() 11868 } 11869 return nil, &googleapi.Error{ 11870 Code: res.StatusCode, 11871 Header: res.Header, 11872 } 11873 } 11874 if err != nil { 11875 return nil, err 11876 } 11877 defer googleapi.CloseBody(res) 11878 if err := googleapi.CheckResponse(res); err != nil { 11879 return nil, err 11880 } 11881 ret := &ListSmimeInfoResponse{ 11882 ServerResponse: googleapi.ServerResponse{ 11883 Header: res.Header, 11884 HTTPStatusCode: res.StatusCode, 11885 }, 11886 } 11887 target := &ret 11888 if err := gensupport.DecodeResponse(target, res); err != nil { 11889 return nil, err 11890 } 11891 return ret, nil 11892 // { 11893 // "description": "Lists S/MIME configs for the specified send-as alias.", 11894 // "flatPath": "gmail/v1/users/{userId}/settings/sendAs/{sendAsEmail}/smimeInfo", 11895 // "httpMethod": "GET", 11896 // "id": "gmail.users.settings.sendAs.smimeInfo.list", 11897 // "parameterOrder": [ 11898 // "userId", 11899 // "sendAsEmail" 11900 // ], 11901 // "parameters": { 11902 // "sendAsEmail": { 11903 // "description": "The email address that appears in the \"From:\" header for mail sent using this alias.", 11904 // "location": "path", 11905 // "required": true, 11906 // "type": "string" 11907 // }, 11908 // "userId": { 11909 // "default": "me", 11910 // "description": "The user's email address. The special value `me` can be used to indicate the authenticated user.", 11911 // "location": "path", 11912 // "required": true, 11913 // "type": "string" 11914 // } 11915 // }, 11916 // "path": "gmail/v1/users/{userId}/settings/sendAs/{sendAsEmail}/smimeInfo", 11917 // "response": { 11918 // "$ref": "ListSmimeInfoResponse" 11919 // }, 11920 // "scopes": [ 11921 // "https://mail.google.com/", 11922 // "https://www.googleapis.com/auth/gmail.modify", 11923 // "https://www.googleapis.com/auth/gmail.readonly", 11924 // "https://www.googleapis.com/auth/gmail.settings.basic", 11925 // "https://www.googleapis.com/auth/gmail.settings.sharing" 11926 // ] 11927 // } 11928 11929} 11930 11931// method id "gmail.users.settings.sendAs.smimeInfo.setDefault": 11932 11933type UsersSettingsSendAsSmimeInfoSetDefaultCall struct { 11934 s *Service 11935 userId string 11936 sendAsEmail string 11937 id string 11938 urlParams_ gensupport.URLParams 11939 ctx_ context.Context 11940 header_ http.Header 11941} 11942 11943// SetDefault: Sets the default S/MIME config for the specified send-as 11944// alias. 11945func (r *UsersSettingsSendAsSmimeInfoService) SetDefault(userId string, sendAsEmail string, id string) *UsersSettingsSendAsSmimeInfoSetDefaultCall { 11946 c := &UsersSettingsSendAsSmimeInfoSetDefaultCall{s: r.s, urlParams_: make(gensupport.URLParams)} 11947 c.userId = userId 11948 c.sendAsEmail = sendAsEmail 11949 c.id = id 11950 return c 11951} 11952 11953// Fields allows partial responses to be retrieved. See 11954// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 11955// for more information. 11956func (c *UsersSettingsSendAsSmimeInfoSetDefaultCall) Fields(s ...googleapi.Field) *UsersSettingsSendAsSmimeInfoSetDefaultCall { 11957 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 11958 return c 11959} 11960 11961// Context sets the context to be used in this call's Do method. Any 11962// pending HTTP request will be aborted if the provided context is 11963// canceled. 11964func (c *UsersSettingsSendAsSmimeInfoSetDefaultCall) Context(ctx context.Context) *UsersSettingsSendAsSmimeInfoSetDefaultCall { 11965 c.ctx_ = ctx 11966 return c 11967} 11968 11969// Header returns an http.Header that can be modified by the caller to 11970// add HTTP headers to the request. 11971func (c *UsersSettingsSendAsSmimeInfoSetDefaultCall) Header() http.Header { 11972 if c.header_ == nil { 11973 c.header_ = make(http.Header) 11974 } 11975 return c.header_ 11976} 11977 11978func (c *UsersSettingsSendAsSmimeInfoSetDefaultCall) doRequest(alt string) (*http.Response, error) { 11979 reqHeaders := make(http.Header) 11980 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20201124") 11981 for k, v := range c.header_ { 11982 reqHeaders[k] = v 11983 } 11984 reqHeaders.Set("User-Agent", c.s.userAgent()) 11985 var body io.Reader = nil 11986 c.urlParams_.Set("alt", alt) 11987 c.urlParams_.Set("prettyPrint", "false") 11988 urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/settings/sendAs/{sendAsEmail}/smimeInfo/{id}/setDefault") 11989 urls += "?" + c.urlParams_.Encode() 11990 req, err := http.NewRequest("POST", urls, body) 11991 if err != nil { 11992 return nil, err 11993 } 11994 req.Header = reqHeaders 11995 googleapi.Expand(req.URL, map[string]string{ 11996 "userId": c.userId, 11997 "sendAsEmail": c.sendAsEmail, 11998 "id": c.id, 11999 }) 12000 return gensupport.SendRequest(c.ctx_, c.s.client, req) 12001} 12002 12003// Do executes the "gmail.users.settings.sendAs.smimeInfo.setDefault" call. 12004func (c *UsersSettingsSendAsSmimeInfoSetDefaultCall) Do(opts ...googleapi.CallOption) error { 12005 gensupport.SetOptions(c.urlParams_, opts...) 12006 res, err := c.doRequest("json") 12007 if err != nil { 12008 return err 12009 } 12010 defer googleapi.CloseBody(res) 12011 if err := googleapi.CheckResponse(res); err != nil { 12012 return err 12013 } 12014 return nil 12015 // { 12016 // "description": "Sets the default S/MIME config for the specified send-as alias.", 12017 // "flatPath": "gmail/v1/users/{userId}/settings/sendAs/{sendAsEmail}/smimeInfo/{id}/setDefault", 12018 // "httpMethod": "POST", 12019 // "id": "gmail.users.settings.sendAs.smimeInfo.setDefault", 12020 // "parameterOrder": [ 12021 // "userId", 12022 // "sendAsEmail", 12023 // "id" 12024 // ], 12025 // "parameters": { 12026 // "id": { 12027 // "description": "The immutable ID for the SmimeInfo.", 12028 // "location": "path", 12029 // "required": true, 12030 // "type": "string" 12031 // }, 12032 // "sendAsEmail": { 12033 // "description": "The email address that appears in the \"From:\" header for mail sent using this alias.", 12034 // "location": "path", 12035 // "required": true, 12036 // "type": "string" 12037 // }, 12038 // "userId": { 12039 // "default": "me", 12040 // "description": "The user's email address. The special value `me` can be used to indicate the authenticated user.", 12041 // "location": "path", 12042 // "required": true, 12043 // "type": "string" 12044 // } 12045 // }, 12046 // "path": "gmail/v1/users/{userId}/settings/sendAs/{sendAsEmail}/smimeInfo/{id}/setDefault", 12047 // "scopes": [ 12048 // "https://www.googleapis.com/auth/gmail.settings.basic", 12049 // "https://www.googleapis.com/auth/gmail.settings.sharing" 12050 // ] 12051 // } 12052 12053} 12054 12055// method id "gmail.users.threads.delete": 12056 12057type UsersThreadsDeleteCall struct { 12058 s *Service 12059 userId string 12060 id string 12061 urlParams_ gensupport.URLParams 12062 ctx_ context.Context 12063 header_ http.Header 12064} 12065 12066// Delete: Immediately and permanently deletes the specified thread. 12067// This operation cannot be undone. Prefer `threads.trash` instead. 12068func (r *UsersThreadsService) Delete(userId string, id string) *UsersThreadsDeleteCall { 12069 c := &UsersThreadsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)} 12070 c.userId = userId 12071 c.id = id 12072 return c 12073} 12074 12075// Fields allows partial responses to be retrieved. See 12076// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 12077// for more information. 12078func (c *UsersThreadsDeleteCall) Fields(s ...googleapi.Field) *UsersThreadsDeleteCall { 12079 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 12080 return c 12081} 12082 12083// Context sets the context to be used in this call's Do method. Any 12084// pending HTTP request will be aborted if the provided context is 12085// canceled. 12086func (c *UsersThreadsDeleteCall) Context(ctx context.Context) *UsersThreadsDeleteCall { 12087 c.ctx_ = ctx 12088 return c 12089} 12090 12091// Header returns an http.Header that can be modified by the caller to 12092// add HTTP headers to the request. 12093func (c *UsersThreadsDeleteCall) Header() http.Header { 12094 if c.header_ == nil { 12095 c.header_ = make(http.Header) 12096 } 12097 return c.header_ 12098} 12099 12100func (c *UsersThreadsDeleteCall) doRequest(alt string) (*http.Response, error) { 12101 reqHeaders := make(http.Header) 12102 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20201124") 12103 for k, v := range c.header_ { 12104 reqHeaders[k] = v 12105 } 12106 reqHeaders.Set("User-Agent", c.s.userAgent()) 12107 var body io.Reader = nil 12108 c.urlParams_.Set("alt", alt) 12109 c.urlParams_.Set("prettyPrint", "false") 12110 urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/threads/{id}") 12111 urls += "?" + c.urlParams_.Encode() 12112 req, err := http.NewRequest("DELETE", urls, body) 12113 if err != nil { 12114 return nil, err 12115 } 12116 req.Header = reqHeaders 12117 googleapi.Expand(req.URL, map[string]string{ 12118 "userId": c.userId, 12119 "id": c.id, 12120 }) 12121 return gensupport.SendRequest(c.ctx_, c.s.client, req) 12122} 12123 12124// Do executes the "gmail.users.threads.delete" call. 12125func (c *UsersThreadsDeleteCall) Do(opts ...googleapi.CallOption) error { 12126 gensupport.SetOptions(c.urlParams_, opts...) 12127 res, err := c.doRequest("json") 12128 if err != nil { 12129 return err 12130 } 12131 defer googleapi.CloseBody(res) 12132 if err := googleapi.CheckResponse(res); err != nil { 12133 return err 12134 } 12135 return nil 12136 // { 12137 // "description": "Immediately and permanently deletes the specified thread. This operation cannot be undone. Prefer `threads.trash` instead.", 12138 // "flatPath": "gmail/v1/users/{userId}/threads/{id}", 12139 // "httpMethod": "DELETE", 12140 // "id": "gmail.users.threads.delete", 12141 // "parameterOrder": [ 12142 // "userId", 12143 // "id" 12144 // ], 12145 // "parameters": { 12146 // "id": { 12147 // "description": "ID of the Thread to delete.", 12148 // "location": "path", 12149 // "required": true, 12150 // "type": "string" 12151 // }, 12152 // "userId": { 12153 // "default": "me", 12154 // "description": "The user's email address. The special value `me` can be used to indicate the authenticated user.", 12155 // "location": "path", 12156 // "required": true, 12157 // "type": "string" 12158 // } 12159 // }, 12160 // "path": "gmail/v1/users/{userId}/threads/{id}", 12161 // "scopes": [ 12162 // "https://mail.google.com/" 12163 // ] 12164 // } 12165 12166} 12167 12168// method id "gmail.users.threads.get": 12169 12170type UsersThreadsGetCall struct { 12171 s *Service 12172 userId string 12173 id string 12174 urlParams_ gensupport.URLParams 12175 ifNoneMatch_ string 12176 ctx_ context.Context 12177 header_ http.Header 12178} 12179 12180// Get: Gets the specified thread. 12181func (r *UsersThreadsService) Get(userId string, id string) *UsersThreadsGetCall { 12182 c := &UsersThreadsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)} 12183 c.userId = userId 12184 c.id = id 12185 return c 12186} 12187 12188// Format sets the optional parameter "format": The format to return the 12189// messages in. 12190// 12191// Possible values: 12192// "full" (default) - Returns the full email message data with body 12193// content parsed in the `payload` field; the `raw` field is not used. 12194// Format cannot be used when accessing the api using the gmail.metadata 12195// scope. 12196// "metadata" - Returns only email message IDs, labels, and email 12197// headers. 12198// "minimal" - Returns only email message IDs and labels; does not 12199// return the email headers, body, or payload. 12200func (c *UsersThreadsGetCall) Format(format string) *UsersThreadsGetCall { 12201 c.urlParams_.Set("format", format) 12202 return c 12203} 12204 12205// MetadataHeaders sets the optional parameter "metadataHeaders": When 12206// given and format is METADATA, only include headers specified. 12207func (c *UsersThreadsGetCall) MetadataHeaders(metadataHeaders ...string) *UsersThreadsGetCall { 12208 c.urlParams_.SetMulti("metadataHeaders", append([]string{}, metadataHeaders...)) 12209 return c 12210} 12211 12212// Fields allows partial responses to be retrieved. See 12213// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 12214// for more information. 12215func (c *UsersThreadsGetCall) Fields(s ...googleapi.Field) *UsersThreadsGetCall { 12216 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 12217 return c 12218} 12219 12220// IfNoneMatch sets the optional parameter which makes the operation 12221// fail if the object's ETag matches the given value. This is useful for 12222// getting updates only after the object has changed since the last 12223// request. Use googleapi.IsNotModified to check whether the response 12224// error from Do is the result of In-None-Match. 12225func (c *UsersThreadsGetCall) IfNoneMatch(entityTag string) *UsersThreadsGetCall { 12226 c.ifNoneMatch_ = entityTag 12227 return c 12228} 12229 12230// Context sets the context to be used in this call's Do method. Any 12231// pending HTTP request will be aborted if the provided context is 12232// canceled. 12233func (c *UsersThreadsGetCall) Context(ctx context.Context) *UsersThreadsGetCall { 12234 c.ctx_ = ctx 12235 return c 12236} 12237 12238// Header returns an http.Header that can be modified by the caller to 12239// add HTTP headers to the request. 12240func (c *UsersThreadsGetCall) Header() http.Header { 12241 if c.header_ == nil { 12242 c.header_ = make(http.Header) 12243 } 12244 return c.header_ 12245} 12246 12247func (c *UsersThreadsGetCall) doRequest(alt string) (*http.Response, error) { 12248 reqHeaders := make(http.Header) 12249 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20201124") 12250 for k, v := range c.header_ { 12251 reqHeaders[k] = v 12252 } 12253 reqHeaders.Set("User-Agent", c.s.userAgent()) 12254 if c.ifNoneMatch_ != "" { 12255 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 12256 } 12257 var body io.Reader = nil 12258 c.urlParams_.Set("alt", alt) 12259 c.urlParams_.Set("prettyPrint", "false") 12260 urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/threads/{id}") 12261 urls += "?" + c.urlParams_.Encode() 12262 req, err := http.NewRequest("GET", urls, body) 12263 if err != nil { 12264 return nil, err 12265 } 12266 req.Header = reqHeaders 12267 googleapi.Expand(req.URL, map[string]string{ 12268 "userId": c.userId, 12269 "id": c.id, 12270 }) 12271 return gensupport.SendRequest(c.ctx_, c.s.client, req) 12272} 12273 12274// Do executes the "gmail.users.threads.get" call. 12275// Exactly one of *Thread or error will be non-nil. Any non-2xx status 12276// code is an error. Response headers are in either 12277// *Thread.ServerResponse.Header or (if a response was returned at all) 12278// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 12279// check whether the returned error was because http.StatusNotModified 12280// was returned. 12281func (c *UsersThreadsGetCall) Do(opts ...googleapi.CallOption) (*Thread, error) { 12282 gensupport.SetOptions(c.urlParams_, opts...) 12283 res, err := c.doRequest("json") 12284 if res != nil && res.StatusCode == http.StatusNotModified { 12285 if res.Body != nil { 12286 res.Body.Close() 12287 } 12288 return nil, &googleapi.Error{ 12289 Code: res.StatusCode, 12290 Header: res.Header, 12291 } 12292 } 12293 if err != nil { 12294 return nil, err 12295 } 12296 defer googleapi.CloseBody(res) 12297 if err := googleapi.CheckResponse(res); err != nil { 12298 return nil, err 12299 } 12300 ret := &Thread{ 12301 ServerResponse: googleapi.ServerResponse{ 12302 Header: res.Header, 12303 HTTPStatusCode: res.StatusCode, 12304 }, 12305 } 12306 target := &ret 12307 if err := gensupport.DecodeResponse(target, res); err != nil { 12308 return nil, err 12309 } 12310 return ret, nil 12311 // { 12312 // "description": "Gets the specified thread.", 12313 // "flatPath": "gmail/v1/users/{userId}/threads/{id}", 12314 // "httpMethod": "GET", 12315 // "id": "gmail.users.threads.get", 12316 // "parameterOrder": [ 12317 // "userId", 12318 // "id" 12319 // ], 12320 // "parameters": { 12321 // "format": { 12322 // "default": "full", 12323 // "description": "The format to return the messages in.", 12324 // "enum": [ 12325 // "full", 12326 // "metadata", 12327 // "minimal" 12328 // ], 12329 // "enumDescriptions": [ 12330 // "Returns the full email message data with body content parsed in the `payload` field; the `raw` field is not used. Format cannot be used when accessing the api using the gmail.metadata scope.", 12331 // "Returns only email message IDs, labels, and email headers.", 12332 // "Returns only email message IDs and labels; does not return the email headers, body, or payload." 12333 // ], 12334 // "location": "query", 12335 // "type": "string" 12336 // }, 12337 // "id": { 12338 // "description": "The ID of the thread to retrieve.", 12339 // "location": "path", 12340 // "required": true, 12341 // "type": "string" 12342 // }, 12343 // "metadataHeaders": { 12344 // "description": "When given and format is METADATA, only include headers specified.", 12345 // "location": "query", 12346 // "repeated": true, 12347 // "type": "string" 12348 // }, 12349 // "userId": { 12350 // "default": "me", 12351 // "description": "The user's email address. The special value `me` can be used to indicate the authenticated user.", 12352 // "location": "path", 12353 // "required": true, 12354 // "type": "string" 12355 // } 12356 // }, 12357 // "path": "gmail/v1/users/{userId}/threads/{id}", 12358 // "response": { 12359 // "$ref": "Thread" 12360 // }, 12361 // "scopes": [ 12362 // "https://mail.google.com/", 12363 // "https://www.googleapis.com/auth/gmail.addons.current.message.action", 12364 // "https://www.googleapis.com/auth/gmail.addons.current.message.metadata", 12365 // "https://www.googleapis.com/auth/gmail.addons.current.message.readonly", 12366 // "https://www.googleapis.com/auth/gmail.metadata", 12367 // "https://www.googleapis.com/auth/gmail.modify", 12368 // "https://www.googleapis.com/auth/gmail.readonly" 12369 // ] 12370 // } 12371 12372} 12373 12374// method id "gmail.users.threads.list": 12375 12376type UsersThreadsListCall struct { 12377 s *Service 12378 userId string 12379 urlParams_ gensupport.URLParams 12380 ifNoneMatch_ string 12381 ctx_ context.Context 12382 header_ http.Header 12383} 12384 12385// List: Lists the threads in the user's mailbox. 12386func (r *UsersThreadsService) List(userId string) *UsersThreadsListCall { 12387 c := &UsersThreadsListCall{s: r.s, urlParams_: make(gensupport.URLParams)} 12388 c.userId = userId 12389 return c 12390} 12391 12392// IncludeSpamTrash sets the optional parameter "includeSpamTrash": 12393// Include threads from `SPAM` and `TRASH` in the results. 12394func (c *UsersThreadsListCall) IncludeSpamTrash(includeSpamTrash bool) *UsersThreadsListCall { 12395 c.urlParams_.Set("includeSpamTrash", fmt.Sprint(includeSpamTrash)) 12396 return c 12397} 12398 12399// LabelIds sets the optional parameter "labelIds": Only return threads 12400// with labels that match all of the specified label IDs. 12401func (c *UsersThreadsListCall) LabelIds(labelIds ...string) *UsersThreadsListCall { 12402 c.urlParams_.SetMulti("labelIds", append([]string{}, labelIds...)) 12403 return c 12404} 12405 12406// MaxResults sets the optional parameter "maxResults": Maximum number 12407// of threads to return. 12408func (c *UsersThreadsListCall) MaxResults(maxResults int64) *UsersThreadsListCall { 12409 c.urlParams_.Set("maxResults", fmt.Sprint(maxResults)) 12410 return c 12411} 12412 12413// PageToken sets the optional parameter "pageToken": Page token to 12414// retrieve a specific page of results in the list. 12415func (c *UsersThreadsListCall) PageToken(pageToken string) *UsersThreadsListCall { 12416 c.urlParams_.Set("pageToken", pageToken) 12417 return c 12418} 12419 12420// Q sets the optional parameter "q": Only return threads matching the 12421// specified query. Supports the same query format as the Gmail search 12422// box. For example, "from:someuser@example.com rfc822msgid: 12423// is:unread". Parameter cannot be used when accessing the api using 12424// the gmail.metadata scope. 12425func (c *UsersThreadsListCall) Q(q string) *UsersThreadsListCall { 12426 c.urlParams_.Set("q", q) 12427 return c 12428} 12429 12430// Fields allows partial responses to be retrieved. See 12431// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 12432// for more information. 12433func (c *UsersThreadsListCall) Fields(s ...googleapi.Field) *UsersThreadsListCall { 12434 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 12435 return c 12436} 12437 12438// IfNoneMatch sets the optional parameter which makes the operation 12439// fail if the object's ETag matches the given value. This is useful for 12440// getting updates only after the object has changed since the last 12441// request. Use googleapi.IsNotModified to check whether the response 12442// error from Do is the result of In-None-Match. 12443func (c *UsersThreadsListCall) IfNoneMatch(entityTag string) *UsersThreadsListCall { 12444 c.ifNoneMatch_ = entityTag 12445 return c 12446} 12447 12448// Context sets the context to be used in this call's Do method. Any 12449// pending HTTP request will be aborted if the provided context is 12450// canceled. 12451func (c *UsersThreadsListCall) Context(ctx context.Context) *UsersThreadsListCall { 12452 c.ctx_ = ctx 12453 return c 12454} 12455 12456// Header returns an http.Header that can be modified by the caller to 12457// add HTTP headers to the request. 12458func (c *UsersThreadsListCall) Header() http.Header { 12459 if c.header_ == nil { 12460 c.header_ = make(http.Header) 12461 } 12462 return c.header_ 12463} 12464 12465func (c *UsersThreadsListCall) doRequest(alt string) (*http.Response, error) { 12466 reqHeaders := make(http.Header) 12467 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20201124") 12468 for k, v := range c.header_ { 12469 reqHeaders[k] = v 12470 } 12471 reqHeaders.Set("User-Agent", c.s.userAgent()) 12472 if c.ifNoneMatch_ != "" { 12473 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 12474 } 12475 var body io.Reader = nil 12476 c.urlParams_.Set("alt", alt) 12477 c.urlParams_.Set("prettyPrint", "false") 12478 urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/threads") 12479 urls += "?" + c.urlParams_.Encode() 12480 req, err := http.NewRequest("GET", urls, body) 12481 if err != nil { 12482 return nil, err 12483 } 12484 req.Header = reqHeaders 12485 googleapi.Expand(req.URL, map[string]string{ 12486 "userId": c.userId, 12487 }) 12488 return gensupport.SendRequest(c.ctx_, c.s.client, req) 12489} 12490 12491// Do executes the "gmail.users.threads.list" call. 12492// Exactly one of *ListThreadsResponse or error will be non-nil. Any 12493// non-2xx status code is an error. Response headers are in either 12494// *ListThreadsResponse.ServerResponse.Header or (if a response was 12495// returned at all) in error.(*googleapi.Error).Header. Use 12496// googleapi.IsNotModified to check whether the returned error was 12497// because http.StatusNotModified was returned. 12498func (c *UsersThreadsListCall) Do(opts ...googleapi.CallOption) (*ListThreadsResponse, error) { 12499 gensupport.SetOptions(c.urlParams_, opts...) 12500 res, err := c.doRequest("json") 12501 if res != nil && res.StatusCode == http.StatusNotModified { 12502 if res.Body != nil { 12503 res.Body.Close() 12504 } 12505 return nil, &googleapi.Error{ 12506 Code: res.StatusCode, 12507 Header: res.Header, 12508 } 12509 } 12510 if err != nil { 12511 return nil, err 12512 } 12513 defer googleapi.CloseBody(res) 12514 if err := googleapi.CheckResponse(res); err != nil { 12515 return nil, err 12516 } 12517 ret := &ListThreadsResponse{ 12518 ServerResponse: googleapi.ServerResponse{ 12519 Header: res.Header, 12520 HTTPStatusCode: res.StatusCode, 12521 }, 12522 } 12523 target := &ret 12524 if err := gensupport.DecodeResponse(target, res); err != nil { 12525 return nil, err 12526 } 12527 return ret, nil 12528 // { 12529 // "description": "Lists the threads in the user's mailbox.", 12530 // "flatPath": "gmail/v1/users/{userId}/threads", 12531 // "httpMethod": "GET", 12532 // "id": "gmail.users.threads.list", 12533 // "parameterOrder": [ 12534 // "userId" 12535 // ], 12536 // "parameters": { 12537 // "includeSpamTrash": { 12538 // "default": "false", 12539 // "description": "Include threads from `SPAM` and `TRASH` in the results.", 12540 // "location": "query", 12541 // "type": "boolean" 12542 // }, 12543 // "labelIds": { 12544 // "description": "Only return threads with labels that match all of the specified label IDs.", 12545 // "location": "query", 12546 // "repeated": true, 12547 // "type": "string" 12548 // }, 12549 // "maxResults": { 12550 // "default": "100", 12551 // "description": "Maximum number of threads to return.", 12552 // "format": "uint32", 12553 // "location": "query", 12554 // "type": "integer" 12555 // }, 12556 // "pageToken": { 12557 // "description": "Page token to retrieve a specific page of results in the list.", 12558 // "location": "query", 12559 // "type": "string" 12560 // }, 12561 // "q": { 12562 // "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.", 12563 // "location": "query", 12564 // "type": "string" 12565 // }, 12566 // "userId": { 12567 // "default": "me", 12568 // "description": "The user's email address. The special value `me` can be used to indicate the authenticated user.", 12569 // "location": "path", 12570 // "required": true, 12571 // "type": "string" 12572 // } 12573 // }, 12574 // "path": "gmail/v1/users/{userId}/threads", 12575 // "response": { 12576 // "$ref": "ListThreadsResponse" 12577 // }, 12578 // "scopes": [ 12579 // "https://mail.google.com/", 12580 // "https://www.googleapis.com/auth/gmail.metadata", 12581 // "https://www.googleapis.com/auth/gmail.modify", 12582 // "https://www.googleapis.com/auth/gmail.readonly" 12583 // ] 12584 // } 12585 12586} 12587 12588// Pages invokes f for each page of results. 12589// A non-nil error returned from f will halt the iteration. 12590// The provided context supersedes any context provided to the Context method. 12591func (c *UsersThreadsListCall) Pages(ctx context.Context, f func(*ListThreadsResponse) error) error { 12592 c.ctx_ = ctx 12593 defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point 12594 for { 12595 x, err := c.Do() 12596 if err != nil { 12597 return err 12598 } 12599 if err := f(x); err != nil { 12600 return err 12601 } 12602 if x.NextPageToken == "" { 12603 return nil 12604 } 12605 c.PageToken(x.NextPageToken) 12606 } 12607} 12608 12609// method id "gmail.users.threads.modify": 12610 12611type UsersThreadsModifyCall struct { 12612 s *Service 12613 userId string 12614 id string 12615 modifythreadrequest *ModifyThreadRequest 12616 urlParams_ gensupport.URLParams 12617 ctx_ context.Context 12618 header_ http.Header 12619} 12620 12621// Modify: Modifies the labels applied to the thread. This applies to 12622// all messages in the thread. 12623func (r *UsersThreadsService) Modify(userId string, id string, modifythreadrequest *ModifyThreadRequest) *UsersThreadsModifyCall { 12624 c := &UsersThreadsModifyCall{s: r.s, urlParams_: make(gensupport.URLParams)} 12625 c.userId = userId 12626 c.id = id 12627 c.modifythreadrequest = modifythreadrequest 12628 return c 12629} 12630 12631// Fields allows partial responses to be retrieved. See 12632// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 12633// for more information. 12634func (c *UsersThreadsModifyCall) Fields(s ...googleapi.Field) *UsersThreadsModifyCall { 12635 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 12636 return c 12637} 12638 12639// Context sets the context to be used in this call's Do method. Any 12640// pending HTTP request will be aborted if the provided context is 12641// canceled. 12642func (c *UsersThreadsModifyCall) Context(ctx context.Context) *UsersThreadsModifyCall { 12643 c.ctx_ = ctx 12644 return c 12645} 12646 12647// Header returns an http.Header that can be modified by the caller to 12648// add HTTP headers to the request. 12649func (c *UsersThreadsModifyCall) Header() http.Header { 12650 if c.header_ == nil { 12651 c.header_ = make(http.Header) 12652 } 12653 return c.header_ 12654} 12655 12656func (c *UsersThreadsModifyCall) doRequest(alt string) (*http.Response, error) { 12657 reqHeaders := make(http.Header) 12658 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20201124") 12659 for k, v := range c.header_ { 12660 reqHeaders[k] = v 12661 } 12662 reqHeaders.Set("User-Agent", c.s.userAgent()) 12663 var body io.Reader = nil 12664 body, err := googleapi.WithoutDataWrapper.JSONReader(c.modifythreadrequest) 12665 if err != nil { 12666 return nil, err 12667 } 12668 reqHeaders.Set("Content-Type", "application/json") 12669 c.urlParams_.Set("alt", alt) 12670 c.urlParams_.Set("prettyPrint", "false") 12671 urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/threads/{id}/modify") 12672 urls += "?" + c.urlParams_.Encode() 12673 req, err := http.NewRequest("POST", urls, body) 12674 if err != nil { 12675 return nil, err 12676 } 12677 req.Header = reqHeaders 12678 googleapi.Expand(req.URL, map[string]string{ 12679 "userId": c.userId, 12680 "id": c.id, 12681 }) 12682 return gensupport.SendRequest(c.ctx_, c.s.client, req) 12683} 12684 12685// Do executes the "gmail.users.threads.modify" call. 12686// Exactly one of *Thread or error will be non-nil. Any non-2xx status 12687// code is an error. Response headers are in either 12688// *Thread.ServerResponse.Header or (if a response was returned at all) 12689// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 12690// check whether the returned error was because http.StatusNotModified 12691// was returned. 12692func (c *UsersThreadsModifyCall) Do(opts ...googleapi.CallOption) (*Thread, error) { 12693 gensupport.SetOptions(c.urlParams_, opts...) 12694 res, err := c.doRequest("json") 12695 if res != nil && res.StatusCode == http.StatusNotModified { 12696 if res.Body != nil { 12697 res.Body.Close() 12698 } 12699 return nil, &googleapi.Error{ 12700 Code: res.StatusCode, 12701 Header: res.Header, 12702 } 12703 } 12704 if err != nil { 12705 return nil, err 12706 } 12707 defer googleapi.CloseBody(res) 12708 if err := googleapi.CheckResponse(res); err != nil { 12709 return nil, err 12710 } 12711 ret := &Thread{ 12712 ServerResponse: googleapi.ServerResponse{ 12713 Header: res.Header, 12714 HTTPStatusCode: res.StatusCode, 12715 }, 12716 } 12717 target := &ret 12718 if err := gensupport.DecodeResponse(target, res); err != nil { 12719 return nil, err 12720 } 12721 return ret, nil 12722 // { 12723 // "description": "Modifies the labels applied to the thread. This applies to all messages in the thread.", 12724 // "flatPath": "gmail/v1/users/{userId}/threads/{id}/modify", 12725 // "httpMethod": "POST", 12726 // "id": "gmail.users.threads.modify", 12727 // "parameterOrder": [ 12728 // "userId", 12729 // "id" 12730 // ], 12731 // "parameters": { 12732 // "id": { 12733 // "description": "The ID of the thread to modify.", 12734 // "location": "path", 12735 // "required": true, 12736 // "type": "string" 12737 // }, 12738 // "userId": { 12739 // "default": "me", 12740 // "description": "The user's email address. The special value `me` can be used to indicate the authenticated user.", 12741 // "location": "path", 12742 // "required": true, 12743 // "type": "string" 12744 // } 12745 // }, 12746 // "path": "gmail/v1/users/{userId}/threads/{id}/modify", 12747 // "request": { 12748 // "$ref": "ModifyThreadRequest" 12749 // }, 12750 // "response": { 12751 // "$ref": "Thread" 12752 // }, 12753 // "scopes": [ 12754 // "https://mail.google.com/", 12755 // "https://www.googleapis.com/auth/gmail.modify" 12756 // ] 12757 // } 12758 12759} 12760 12761// method id "gmail.users.threads.trash": 12762 12763type UsersThreadsTrashCall struct { 12764 s *Service 12765 userId string 12766 id string 12767 urlParams_ gensupport.URLParams 12768 ctx_ context.Context 12769 header_ http.Header 12770} 12771 12772// Trash: Moves the specified thread to the trash. 12773func (r *UsersThreadsService) Trash(userId string, id string) *UsersThreadsTrashCall { 12774 c := &UsersThreadsTrashCall{s: r.s, urlParams_: make(gensupport.URLParams)} 12775 c.userId = userId 12776 c.id = id 12777 return c 12778} 12779 12780// Fields allows partial responses to be retrieved. See 12781// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 12782// for more information. 12783func (c *UsersThreadsTrashCall) Fields(s ...googleapi.Field) *UsersThreadsTrashCall { 12784 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 12785 return c 12786} 12787 12788// Context sets the context to be used in this call's Do method. Any 12789// pending HTTP request will be aborted if the provided context is 12790// canceled. 12791func (c *UsersThreadsTrashCall) Context(ctx context.Context) *UsersThreadsTrashCall { 12792 c.ctx_ = ctx 12793 return c 12794} 12795 12796// Header returns an http.Header that can be modified by the caller to 12797// add HTTP headers to the request. 12798func (c *UsersThreadsTrashCall) Header() http.Header { 12799 if c.header_ == nil { 12800 c.header_ = make(http.Header) 12801 } 12802 return c.header_ 12803} 12804 12805func (c *UsersThreadsTrashCall) doRequest(alt string) (*http.Response, error) { 12806 reqHeaders := make(http.Header) 12807 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20201124") 12808 for k, v := range c.header_ { 12809 reqHeaders[k] = v 12810 } 12811 reqHeaders.Set("User-Agent", c.s.userAgent()) 12812 var body io.Reader = nil 12813 c.urlParams_.Set("alt", alt) 12814 c.urlParams_.Set("prettyPrint", "false") 12815 urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/threads/{id}/trash") 12816 urls += "?" + c.urlParams_.Encode() 12817 req, err := http.NewRequest("POST", urls, body) 12818 if err != nil { 12819 return nil, err 12820 } 12821 req.Header = reqHeaders 12822 googleapi.Expand(req.URL, map[string]string{ 12823 "userId": c.userId, 12824 "id": c.id, 12825 }) 12826 return gensupport.SendRequest(c.ctx_, c.s.client, req) 12827} 12828 12829// Do executes the "gmail.users.threads.trash" call. 12830// Exactly one of *Thread or error will be non-nil. Any non-2xx status 12831// code is an error. Response headers are in either 12832// *Thread.ServerResponse.Header or (if a response was returned at all) 12833// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 12834// check whether the returned error was because http.StatusNotModified 12835// was returned. 12836func (c *UsersThreadsTrashCall) Do(opts ...googleapi.CallOption) (*Thread, error) { 12837 gensupport.SetOptions(c.urlParams_, opts...) 12838 res, err := c.doRequest("json") 12839 if res != nil && res.StatusCode == http.StatusNotModified { 12840 if res.Body != nil { 12841 res.Body.Close() 12842 } 12843 return nil, &googleapi.Error{ 12844 Code: res.StatusCode, 12845 Header: res.Header, 12846 } 12847 } 12848 if err != nil { 12849 return nil, err 12850 } 12851 defer googleapi.CloseBody(res) 12852 if err := googleapi.CheckResponse(res); err != nil { 12853 return nil, err 12854 } 12855 ret := &Thread{ 12856 ServerResponse: googleapi.ServerResponse{ 12857 Header: res.Header, 12858 HTTPStatusCode: res.StatusCode, 12859 }, 12860 } 12861 target := &ret 12862 if err := gensupport.DecodeResponse(target, res); err != nil { 12863 return nil, err 12864 } 12865 return ret, nil 12866 // { 12867 // "description": "Moves the specified thread to the trash.", 12868 // "flatPath": "gmail/v1/users/{userId}/threads/{id}/trash", 12869 // "httpMethod": "POST", 12870 // "id": "gmail.users.threads.trash", 12871 // "parameterOrder": [ 12872 // "userId", 12873 // "id" 12874 // ], 12875 // "parameters": { 12876 // "id": { 12877 // "description": "The ID of the thread to Trash.", 12878 // "location": "path", 12879 // "required": true, 12880 // "type": "string" 12881 // }, 12882 // "userId": { 12883 // "default": "me", 12884 // "description": "The user's email address. The special value `me` can be used to indicate the authenticated user.", 12885 // "location": "path", 12886 // "required": true, 12887 // "type": "string" 12888 // } 12889 // }, 12890 // "path": "gmail/v1/users/{userId}/threads/{id}/trash", 12891 // "response": { 12892 // "$ref": "Thread" 12893 // }, 12894 // "scopes": [ 12895 // "https://mail.google.com/", 12896 // "https://www.googleapis.com/auth/gmail.modify" 12897 // ] 12898 // } 12899 12900} 12901 12902// method id "gmail.users.threads.untrash": 12903 12904type UsersThreadsUntrashCall struct { 12905 s *Service 12906 userId string 12907 id string 12908 urlParams_ gensupport.URLParams 12909 ctx_ context.Context 12910 header_ http.Header 12911} 12912 12913// Untrash: Removes the specified thread from the trash. 12914func (r *UsersThreadsService) Untrash(userId string, id string) *UsersThreadsUntrashCall { 12915 c := &UsersThreadsUntrashCall{s: r.s, urlParams_: make(gensupport.URLParams)} 12916 c.userId = userId 12917 c.id = id 12918 return c 12919} 12920 12921// Fields allows partial responses to be retrieved. See 12922// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 12923// for more information. 12924func (c *UsersThreadsUntrashCall) Fields(s ...googleapi.Field) *UsersThreadsUntrashCall { 12925 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 12926 return c 12927} 12928 12929// Context sets the context to be used in this call's Do method. Any 12930// pending HTTP request will be aborted if the provided context is 12931// canceled. 12932func (c *UsersThreadsUntrashCall) Context(ctx context.Context) *UsersThreadsUntrashCall { 12933 c.ctx_ = ctx 12934 return c 12935} 12936 12937// Header returns an http.Header that can be modified by the caller to 12938// add HTTP headers to the request. 12939func (c *UsersThreadsUntrashCall) Header() http.Header { 12940 if c.header_ == nil { 12941 c.header_ = make(http.Header) 12942 } 12943 return c.header_ 12944} 12945 12946func (c *UsersThreadsUntrashCall) doRequest(alt string) (*http.Response, error) { 12947 reqHeaders := make(http.Header) 12948 reqHeaders.Set("x-goog-api-client", "gl-go/"+gensupport.GoVersion()+" gdcl/20201124") 12949 for k, v := range c.header_ { 12950 reqHeaders[k] = v 12951 } 12952 reqHeaders.Set("User-Agent", c.s.userAgent()) 12953 var body io.Reader = nil 12954 c.urlParams_.Set("alt", alt) 12955 c.urlParams_.Set("prettyPrint", "false") 12956 urls := googleapi.ResolveRelative(c.s.BasePath, "gmail/v1/users/{userId}/threads/{id}/untrash") 12957 urls += "?" + c.urlParams_.Encode() 12958 req, err := http.NewRequest("POST", urls, body) 12959 if err != nil { 12960 return nil, err 12961 } 12962 req.Header = reqHeaders 12963 googleapi.Expand(req.URL, map[string]string{ 12964 "userId": c.userId, 12965 "id": c.id, 12966 }) 12967 return gensupport.SendRequest(c.ctx_, c.s.client, req) 12968} 12969 12970// Do executes the "gmail.users.threads.untrash" call. 12971// Exactly one of *Thread or error will be non-nil. Any non-2xx status 12972// code is an error. Response headers are in either 12973// *Thread.ServerResponse.Header or (if a response was returned at all) 12974// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 12975// check whether the returned error was because http.StatusNotModified 12976// was returned. 12977func (c *UsersThreadsUntrashCall) Do(opts ...googleapi.CallOption) (*Thread, error) { 12978 gensupport.SetOptions(c.urlParams_, opts...) 12979 res, err := c.doRequest("json") 12980 if res != nil && res.StatusCode == http.StatusNotModified { 12981 if res.Body != nil { 12982 res.Body.Close() 12983 } 12984 return nil, &googleapi.Error{ 12985 Code: res.StatusCode, 12986 Header: res.Header, 12987 } 12988 } 12989 if err != nil { 12990 return nil, err 12991 } 12992 defer googleapi.CloseBody(res) 12993 if err := googleapi.CheckResponse(res); err != nil { 12994 return nil, err 12995 } 12996 ret := &Thread{ 12997 ServerResponse: googleapi.ServerResponse{ 12998 Header: res.Header, 12999 HTTPStatusCode: res.StatusCode, 13000 }, 13001 } 13002 target := &ret 13003 if err := gensupport.DecodeResponse(target, res); err != nil { 13004 return nil, err 13005 } 13006 return ret, nil 13007 // { 13008 // "description": "Removes the specified thread from the trash.", 13009 // "flatPath": "gmail/v1/users/{userId}/threads/{id}/untrash", 13010 // "httpMethod": "POST", 13011 // "id": "gmail.users.threads.untrash", 13012 // "parameterOrder": [ 13013 // "userId", 13014 // "id" 13015 // ], 13016 // "parameters": { 13017 // "id": { 13018 // "description": "The ID of the thread to remove from Trash.", 13019 // "location": "path", 13020 // "required": true, 13021 // "type": "string" 13022 // }, 13023 // "userId": { 13024 // "default": "me", 13025 // "description": "The user's email address. The special value `me` can be used to indicate the authenticated user.", 13026 // "location": "path", 13027 // "required": true, 13028 // "type": "string" 13029 // } 13030 // }, 13031 // "path": "gmail/v1/users/{userId}/threads/{id}/untrash", 13032 // "response": { 13033 // "$ref": "Thread" 13034 // }, 13035 // "scopes": [ 13036 // "https://mail.google.com/", 13037 // "https://www.googleapis.com/auth/gmail.modify" 13038 // ] 13039 // } 13040 13041} 13042