1// Copyright 2019 Google LLC. 2// Use of this source code is governed by a BSD-style 3// license that can be found in the LICENSE file. 4 5// Code generated file. DO NOT EDIT. 6 7// Package drive provides access to the Drive API. 8// 9// For product documentation, see: https://developers.google.com/drive/ 10// 11// Creating a client 12// 13// Usage example: 14// 15// import "google.golang.org/api/drive/v3" 16// ... 17// ctx := context.Background() 18// driveService, err := drive.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// driveService, err := drive.NewService(ctx, option.WithScopes(drive.DriveScriptsScope)) 29// 30// To use an API key for authentication (note: some APIs do not support API keys), use option.WithAPIKey: 31// 32// driveService, err := drive.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// driveService, err := drive.NewService(ctx, option.WithTokenSource(config.TokenSource(ctx, token))) 40// 41// See https://godoc.org/google.golang.org/api/option/ for details on options. 42package drive // import "google.golang.org/api/drive/v3" 43 44import ( 45 "bytes" 46 "context" 47 "encoding/json" 48 "errors" 49 "fmt" 50 "io" 51 "net/http" 52 "net/url" 53 "strconv" 54 "strings" 55 56 gensupport "google.golang.org/api/gensupport" 57 googleapi "google.golang.org/api/googleapi" 58 option "google.golang.org/api/option" 59 htransport "google.golang.org/api/transport/http" 60) 61 62// Always reference these packages, just in case the auto-generated code 63// below doesn't. 64var _ = bytes.NewBuffer 65var _ = strconv.Itoa 66var _ = fmt.Sprintf 67var _ = json.NewDecoder 68var _ = io.Copy 69var _ = url.Parse 70var _ = gensupport.MarshalJSON 71var _ = googleapi.Version 72var _ = errors.New 73var _ = strings.Replace 74var _ = context.Canceled 75 76const apiId = "drive:v3" 77const apiName = "drive" 78const apiVersion = "v3" 79const basePath = "https://www.googleapis.com/drive/v3/" 80 81// OAuth2 scopes used by this API. 82const ( 83 // See, edit, create, and delete all of your Google Drive files 84 DriveScope = "https://www.googleapis.com/auth/drive" 85 86 // View and manage its own configuration data in your Google Drive 87 DriveAppdataScope = "https://www.googleapis.com/auth/drive.appdata" 88 89 // View and manage Google Drive files and folders that you have opened 90 // or created with this app 91 DriveFileScope = "https://www.googleapis.com/auth/drive.file" 92 93 // View and manage metadata of files in your Google Drive 94 DriveMetadataScope = "https://www.googleapis.com/auth/drive.metadata" 95 96 // View metadata for files in your Google Drive 97 DriveMetadataReadonlyScope = "https://www.googleapis.com/auth/drive.metadata.readonly" 98 99 // View the photos, videos and albums in your Google Photos 100 DrivePhotosReadonlyScope = "https://www.googleapis.com/auth/drive.photos.readonly" 101 102 // See and download all your Google Drive files 103 DriveReadonlyScope = "https://www.googleapis.com/auth/drive.readonly" 104 105 // Modify your Google Apps Script scripts' behavior 106 DriveScriptsScope = "https://www.googleapis.com/auth/drive.scripts" 107) 108 109// NewService creates a new Service. 110func NewService(ctx context.Context, opts ...option.ClientOption) (*Service, error) { 111 scopesOption := option.WithScopes( 112 "https://www.googleapis.com/auth/drive", 113 "https://www.googleapis.com/auth/drive.appdata", 114 "https://www.googleapis.com/auth/drive.file", 115 "https://www.googleapis.com/auth/drive.metadata", 116 "https://www.googleapis.com/auth/drive.metadata.readonly", 117 "https://www.googleapis.com/auth/drive.photos.readonly", 118 "https://www.googleapis.com/auth/drive.readonly", 119 "https://www.googleapis.com/auth/drive.scripts", 120 ) 121 // NOTE: prepend, so we don't override user-specified scopes. 122 opts = append([]option.ClientOption{scopesOption}, opts...) 123 client, endpoint, err := htransport.NewClient(ctx, opts...) 124 if err != nil { 125 return nil, err 126 } 127 s, err := New(client) 128 if err != nil { 129 return nil, err 130 } 131 if endpoint != "" { 132 s.BasePath = endpoint 133 } 134 return s, nil 135} 136 137// New creates a new Service. It uses the provided http.Client for requests. 138// 139// Deprecated: please use NewService instead. 140// To provide a custom HTTP client, use option.WithHTTPClient. 141// If you are using google.golang.org/api/googleapis/transport.APIKey, use option.WithAPIKey with NewService instead. 142func New(client *http.Client) (*Service, error) { 143 if client == nil { 144 return nil, errors.New("client is nil") 145 } 146 s := &Service{client: client, BasePath: basePath} 147 s.About = NewAboutService(s) 148 s.Changes = NewChangesService(s) 149 s.Channels = NewChannelsService(s) 150 s.Comments = NewCommentsService(s) 151 s.Drives = NewDrivesService(s) 152 s.Files = NewFilesService(s) 153 s.Permissions = NewPermissionsService(s) 154 s.Replies = NewRepliesService(s) 155 s.Revisions = NewRevisionsService(s) 156 s.Teamdrives = NewTeamdrivesService(s) 157 return s, nil 158} 159 160type Service struct { 161 client *http.Client 162 BasePath string // API endpoint base URL 163 UserAgent string // optional additional User-Agent fragment 164 165 About *AboutService 166 167 Changes *ChangesService 168 169 Channels *ChannelsService 170 171 Comments *CommentsService 172 173 Drives *DrivesService 174 175 Files *FilesService 176 177 Permissions *PermissionsService 178 179 Replies *RepliesService 180 181 Revisions *RevisionsService 182 183 Teamdrives *TeamdrivesService 184} 185 186func (s *Service) userAgent() string { 187 if s.UserAgent == "" { 188 return googleapi.UserAgent 189 } 190 return googleapi.UserAgent + " " + s.UserAgent 191} 192 193func NewAboutService(s *Service) *AboutService { 194 rs := &AboutService{s: s} 195 return rs 196} 197 198type AboutService struct { 199 s *Service 200} 201 202func NewChangesService(s *Service) *ChangesService { 203 rs := &ChangesService{s: s} 204 return rs 205} 206 207type ChangesService struct { 208 s *Service 209} 210 211func NewChannelsService(s *Service) *ChannelsService { 212 rs := &ChannelsService{s: s} 213 return rs 214} 215 216type ChannelsService struct { 217 s *Service 218} 219 220func NewCommentsService(s *Service) *CommentsService { 221 rs := &CommentsService{s: s} 222 return rs 223} 224 225type CommentsService struct { 226 s *Service 227} 228 229func NewDrivesService(s *Service) *DrivesService { 230 rs := &DrivesService{s: s} 231 return rs 232} 233 234type DrivesService struct { 235 s *Service 236} 237 238func NewFilesService(s *Service) *FilesService { 239 rs := &FilesService{s: s} 240 return rs 241} 242 243type FilesService struct { 244 s *Service 245} 246 247func NewPermissionsService(s *Service) *PermissionsService { 248 rs := &PermissionsService{s: s} 249 return rs 250} 251 252type PermissionsService struct { 253 s *Service 254} 255 256func NewRepliesService(s *Service) *RepliesService { 257 rs := &RepliesService{s: s} 258 return rs 259} 260 261type RepliesService struct { 262 s *Service 263} 264 265func NewRevisionsService(s *Service) *RevisionsService { 266 rs := &RevisionsService{s: s} 267 return rs 268} 269 270type RevisionsService struct { 271 s *Service 272} 273 274func NewTeamdrivesService(s *Service) *TeamdrivesService { 275 rs := &TeamdrivesService{s: s} 276 return rs 277} 278 279type TeamdrivesService struct { 280 s *Service 281} 282 283// About: Information about the user, the user's Drive, and system 284// capabilities. 285type About struct { 286 // AppInstalled: Whether the user has installed the requesting app. 287 AppInstalled bool `json:"appInstalled,omitempty"` 288 289 // CanCreateDrives: Whether the user can create shared drives. 290 CanCreateDrives bool `json:"canCreateDrives,omitempty"` 291 292 // CanCreateTeamDrives: Deprecated - use canCreateDrives instead. 293 CanCreateTeamDrives bool `json:"canCreateTeamDrives,omitempty"` 294 295 // DriveThemes: A list of themes that are supported for shared drives. 296 DriveThemes []*AboutDriveThemes `json:"driveThemes,omitempty"` 297 298 // ExportFormats: A map of source MIME type to possible targets for all 299 // supported exports. 300 ExportFormats map[string][]string `json:"exportFormats,omitempty"` 301 302 // FolderColorPalette: The currently supported folder colors as RGB hex 303 // strings. 304 FolderColorPalette []string `json:"folderColorPalette,omitempty"` 305 306 // ImportFormats: A map of source MIME type to possible targets for all 307 // supported imports. 308 ImportFormats map[string][]string `json:"importFormats,omitempty"` 309 310 // Kind: Identifies what kind of resource this is. Value: the fixed 311 // string "drive#about". 312 Kind string `json:"kind,omitempty"` 313 314 // MaxImportSizes: A map of maximum import sizes by MIME type, in bytes. 315 MaxImportSizes map[string]string `json:"maxImportSizes,omitempty"` 316 317 // MaxUploadSize: The maximum upload size in bytes. 318 MaxUploadSize int64 `json:"maxUploadSize,omitempty,string"` 319 320 // StorageQuota: The user's storage quota limits and usage. All fields 321 // are measured in bytes. 322 StorageQuota *AboutStorageQuota `json:"storageQuota,omitempty"` 323 324 // TeamDriveThemes: Deprecated - use driveThemes instead. 325 TeamDriveThemes []*AboutTeamDriveThemes `json:"teamDriveThemes,omitempty"` 326 327 // User: The authenticated user. 328 User *User `json:"user,omitempty"` 329 330 // ServerResponse contains the HTTP response code and headers from the 331 // server. 332 googleapi.ServerResponse `json:"-"` 333 334 // ForceSendFields is a list of field names (e.g. "AppInstalled") to 335 // unconditionally include in API requests. By default, fields with 336 // empty values are omitted from API requests. However, any non-pointer, 337 // non-interface field appearing in ForceSendFields will be sent to the 338 // server regardless of whether the field is empty or not. This may be 339 // used to include empty fields in Patch requests. 340 ForceSendFields []string `json:"-"` 341 342 // NullFields is a list of field names (e.g. "AppInstalled") to include 343 // in API requests with the JSON null value. By default, fields with 344 // empty values are omitted from API requests. However, any field with 345 // an empty value appearing in NullFields will be sent to the server as 346 // null. It is an error if a field in this list has a non-empty value. 347 // This may be used to include null fields in Patch requests. 348 NullFields []string `json:"-"` 349} 350 351func (s *About) MarshalJSON() ([]byte, error) { 352 type NoMethod About 353 raw := NoMethod(*s) 354 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 355} 356 357type AboutDriveThemes struct { 358 // BackgroundImageLink: A link to this theme's background image. 359 BackgroundImageLink string `json:"backgroundImageLink,omitempty"` 360 361 // ColorRgb: The color of this theme as an RGB hex string. 362 ColorRgb string `json:"colorRgb,omitempty"` 363 364 // Id: The ID of the theme. 365 Id string `json:"id,omitempty"` 366 367 // ForceSendFields is a list of field names (e.g. "BackgroundImageLink") 368 // to unconditionally include in API requests. By default, fields with 369 // empty values are omitted from API requests. However, any non-pointer, 370 // non-interface field appearing in ForceSendFields will be sent to the 371 // server regardless of whether the field is empty or not. This may be 372 // used to include empty fields in Patch requests. 373 ForceSendFields []string `json:"-"` 374 375 // NullFields is a list of field names (e.g. "BackgroundImageLink") to 376 // include in API requests with the JSON null value. By default, fields 377 // with empty values are omitted from API requests. However, any field 378 // with an empty value appearing in NullFields will be sent to the 379 // server as null. It is an error if a field in this list has a 380 // non-empty value. This may be used to include null fields in Patch 381 // requests. 382 NullFields []string `json:"-"` 383} 384 385func (s *AboutDriveThemes) MarshalJSON() ([]byte, error) { 386 type NoMethod AboutDriveThemes 387 raw := NoMethod(*s) 388 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 389} 390 391// AboutStorageQuota: The user's storage quota limits and usage. All 392// fields are measured in bytes. 393type AboutStorageQuota struct { 394 // Limit: The usage limit, if applicable. This will not be present if 395 // the user has unlimited storage. 396 Limit int64 `json:"limit,omitempty,string"` 397 398 // Usage: The total usage across all services. 399 Usage int64 `json:"usage,omitempty,string"` 400 401 // UsageInDrive: The usage by all files in Google Drive. 402 UsageInDrive int64 `json:"usageInDrive,omitempty,string"` 403 404 // UsageInDriveTrash: The usage by trashed files in Google Drive. 405 UsageInDriveTrash int64 `json:"usageInDriveTrash,omitempty,string"` 406 407 // ForceSendFields is a list of field names (e.g. "Limit") to 408 // unconditionally include in API requests. By default, fields with 409 // empty values are omitted from API requests. However, any non-pointer, 410 // non-interface field appearing in ForceSendFields will be sent to the 411 // server regardless of whether the field is empty or not. This may be 412 // used to include empty fields in Patch requests. 413 ForceSendFields []string `json:"-"` 414 415 // NullFields is a list of field names (e.g. "Limit") to include in API 416 // requests with the JSON null value. By default, fields with empty 417 // values are omitted from API requests. However, any field with an 418 // empty value appearing in NullFields will be sent to the server as 419 // null. It is an error if a field in this list has a non-empty value. 420 // This may be used to include null fields in Patch requests. 421 NullFields []string `json:"-"` 422} 423 424func (s *AboutStorageQuota) MarshalJSON() ([]byte, error) { 425 type NoMethod AboutStorageQuota 426 raw := NoMethod(*s) 427 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 428} 429 430type AboutTeamDriveThemes struct { 431 // BackgroundImageLink: Deprecated - use driveThemes/backgroundImageLink 432 // instead. 433 BackgroundImageLink string `json:"backgroundImageLink,omitempty"` 434 435 // ColorRgb: Deprecated - use driveThemes/colorRgb instead. 436 ColorRgb string `json:"colorRgb,omitempty"` 437 438 // Id: Deprecated - use driveThemes/id instead. 439 Id string `json:"id,omitempty"` 440 441 // ForceSendFields is a list of field names (e.g. "BackgroundImageLink") 442 // to unconditionally include in API requests. By default, fields with 443 // empty values are omitted from API requests. However, any non-pointer, 444 // non-interface field appearing in ForceSendFields will be sent to the 445 // server regardless of whether the field is empty or not. This may be 446 // used to include empty fields in Patch requests. 447 ForceSendFields []string `json:"-"` 448 449 // NullFields is a list of field names (e.g. "BackgroundImageLink") to 450 // include in API requests with the JSON null value. By default, fields 451 // with empty values are omitted from API requests. However, any field 452 // with an empty value appearing in NullFields will be sent to the 453 // server as null. It is an error if a field in this list has a 454 // non-empty value. This may be used to include null fields in Patch 455 // requests. 456 NullFields []string `json:"-"` 457} 458 459func (s *AboutTeamDriveThemes) MarshalJSON() ([]byte, error) { 460 type NoMethod AboutTeamDriveThemes 461 raw := NoMethod(*s) 462 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 463} 464 465// Change: A change to a file or shared drive. 466type Change struct { 467 // ChangeType: The type of the change. Possible values are file and 468 // drive. 469 ChangeType string `json:"changeType,omitempty"` 470 471 // Drive: The updated state of the shared drive. Present if the 472 // changeType is drive, the user is still a member of the shared drive, 473 // and the shared drive has not been deleted. 474 Drive *Drive `json:"drive,omitempty"` 475 476 // DriveId: The ID of the shared drive associated with this change. 477 DriveId string `json:"driveId,omitempty"` 478 479 // File: The updated state of the file. Present if the type is file and 480 // the file has not been removed from this list of changes. 481 File *File `json:"file,omitempty"` 482 483 // FileId: The ID of the file which has changed. 484 FileId string `json:"fileId,omitempty"` 485 486 // Kind: Identifies what kind of resource this is. Value: the fixed 487 // string "drive#change". 488 Kind string `json:"kind,omitempty"` 489 490 // Removed: Whether the file or shared drive has been removed from this 491 // list of changes, for example by deletion or loss of access. 492 Removed bool `json:"removed,omitempty"` 493 494 // TeamDrive: Deprecated - use drive instead. 495 TeamDrive *TeamDrive `json:"teamDrive,omitempty"` 496 497 // TeamDriveId: Deprecated - use driveId instead. 498 TeamDriveId string `json:"teamDriveId,omitempty"` 499 500 // Time: The time of this change (RFC 3339 date-time). 501 Time string `json:"time,omitempty"` 502 503 // Type: Deprecated - use changeType instead. 504 Type string `json:"type,omitempty"` 505 506 // ForceSendFields is a list of field names (e.g. "ChangeType") to 507 // unconditionally include in API requests. By default, fields with 508 // empty values are omitted from API requests. However, any non-pointer, 509 // non-interface field appearing in ForceSendFields will be sent to the 510 // server regardless of whether the field is empty or not. This may be 511 // used to include empty fields in Patch requests. 512 ForceSendFields []string `json:"-"` 513 514 // NullFields is a list of field names (e.g. "ChangeType") to include in 515 // API requests with the JSON null value. By default, fields with empty 516 // values are omitted from API requests. However, any field with an 517 // empty value appearing in NullFields will be sent to the server as 518 // null. It is an error if a field in this list has a non-empty value. 519 // This may be used to include null fields in Patch requests. 520 NullFields []string `json:"-"` 521} 522 523func (s *Change) MarshalJSON() ([]byte, error) { 524 type NoMethod Change 525 raw := NoMethod(*s) 526 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 527} 528 529// ChangeList: A list of changes for a user. 530type ChangeList struct { 531 // Changes: The list of changes. If nextPageToken is populated, then 532 // this list may be incomplete and an additional page of results should 533 // be fetched. 534 Changes []*Change `json:"changes,omitempty"` 535 536 // Kind: Identifies what kind of resource this is. Value: the fixed 537 // string "drive#changeList". 538 Kind string `json:"kind,omitempty"` 539 540 // NewStartPageToken: The starting page token for future changes. This 541 // will be present only if the end of the current changes list has been 542 // reached. 543 NewStartPageToken string `json:"newStartPageToken,omitempty"` 544 545 // NextPageToken: The page token for the next page of changes. This will 546 // be absent if the end of the changes list has been reached. If the 547 // token is rejected for any reason, it should be discarded, and 548 // pagination should be restarted from the first page of results. 549 NextPageToken string `json:"nextPageToken,omitempty"` 550 551 // ServerResponse contains the HTTP response code and headers from the 552 // server. 553 googleapi.ServerResponse `json:"-"` 554 555 // ForceSendFields is a list of field names (e.g. "Changes") to 556 // unconditionally include in API requests. By default, fields with 557 // empty values are omitted from API requests. However, any non-pointer, 558 // non-interface field appearing in ForceSendFields will be sent to the 559 // server regardless of whether the field is empty or not. This may be 560 // used to include empty fields in Patch requests. 561 ForceSendFields []string `json:"-"` 562 563 // NullFields is a list of field names (e.g. "Changes") to include in 564 // API requests with the JSON null value. By default, fields with empty 565 // values are omitted from API requests. However, any field with an 566 // empty value appearing in NullFields will be sent to the server as 567 // null. It is an error if a field in this list has a non-empty value. 568 // This may be used to include null fields in Patch requests. 569 NullFields []string `json:"-"` 570} 571 572func (s *ChangeList) MarshalJSON() ([]byte, error) { 573 type NoMethod ChangeList 574 raw := NoMethod(*s) 575 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 576} 577 578// Channel: An notification channel used to watch for resource changes. 579type Channel struct { 580 // Address: The address where notifications are delivered for this 581 // channel. 582 Address string `json:"address,omitempty"` 583 584 // Expiration: Date and time of notification channel expiration, 585 // expressed as a Unix timestamp, in milliseconds. Optional. 586 Expiration int64 `json:"expiration,omitempty,string"` 587 588 // Id: A UUID or similar unique string that identifies this channel. 589 Id string `json:"id,omitempty"` 590 591 // Kind: Identifies this as a notification channel used to watch for 592 // changes to a resource. Value: the fixed string "api#channel". 593 Kind string `json:"kind,omitempty"` 594 595 // Params: Additional parameters controlling delivery channel behavior. 596 // Optional. 597 Params map[string]string `json:"params,omitempty"` 598 599 // Payload: A Boolean value to indicate whether payload is wanted. 600 // Optional. 601 Payload bool `json:"payload,omitempty"` 602 603 // ResourceId: An opaque ID that identifies the resource being watched 604 // on this channel. Stable across different API versions. 605 ResourceId string `json:"resourceId,omitempty"` 606 607 // ResourceUri: A version-specific identifier for the watched resource. 608 ResourceUri string `json:"resourceUri,omitempty"` 609 610 // Token: An arbitrary string delivered to the target address with each 611 // notification delivered over this channel. Optional. 612 Token string `json:"token,omitempty"` 613 614 // Type: The type of delivery mechanism used for this channel. 615 Type string `json:"type,omitempty"` 616 617 // ServerResponse contains the HTTP response code and headers from the 618 // server. 619 googleapi.ServerResponse `json:"-"` 620 621 // ForceSendFields is a list of field names (e.g. "Address") to 622 // unconditionally include in API requests. By default, fields with 623 // empty values are omitted from API requests. However, any non-pointer, 624 // non-interface field appearing in ForceSendFields will be sent to the 625 // server regardless of whether the field is empty or not. This may be 626 // used to include empty fields in Patch requests. 627 ForceSendFields []string `json:"-"` 628 629 // NullFields is a list of field names (e.g. "Address") to include in 630 // API requests with the JSON null value. By default, fields with empty 631 // values are omitted from API requests. However, any field with an 632 // empty value appearing in NullFields will be sent to the server as 633 // null. It is an error if a field in this list has a non-empty value. 634 // This may be used to include null fields in Patch requests. 635 NullFields []string `json:"-"` 636} 637 638func (s *Channel) MarshalJSON() ([]byte, error) { 639 type NoMethod Channel 640 raw := NoMethod(*s) 641 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 642} 643 644// Comment: A comment on a file. 645type Comment struct { 646 // Anchor: A region of the document represented as a JSON string. See 647 // anchor documentation for details on how to define and interpret 648 // anchor properties. 649 Anchor string `json:"anchor,omitempty"` 650 651 // Author: The user who created the comment. 652 Author *User `json:"author,omitempty"` 653 654 // Content: The plain text content of the comment. This field is used 655 // for setting the content, while htmlContent should be displayed. 656 Content string `json:"content,omitempty"` 657 658 // CreatedTime: The time at which the comment was created (RFC 3339 659 // date-time). 660 CreatedTime string `json:"createdTime,omitempty"` 661 662 // Deleted: Whether the comment has been deleted. A deleted comment has 663 // no content. 664 Deleted bool `json:"deleted,omitempty"` 665 666 // HtmlContent: The content of the comment with HTML formatting. 667 HtmlContent string `json:"htmlContent,omitempty"` 668 669 // Id: The ID of the comment. 670 Id string `json:"id,omitempty"` 671 672 // Kind: Identifies what kind of resource this is. Value: the fixed 673 // string "drive#comment". 674 Kind string `json:"kind,omitempty"` 675 676 // ModifiedTime: The last time the comment or any of its replies was 677 // modified (RFC 3339 date-time). 678 ModifiedTime string `json:"modifiedTime,omitempty"` 679 680 // QuotedFileContent: The file content to which the comment refers, 681 // typically within the anchor region. For a text file, for example, 682 // this would be the text at the location of the comment. 683 QuotedFileContent *CommentQuotedFileContent `json:"quotedFileContent,omitempty"` 684 685 // Replies: The full list of replies to the comment in chronological 686 // order. 687 Replies []*Reply `json:"replies,omitempty"` 688 689 // Resolved: Whether the comment has been resolved by one of its 690 // replies. 691 Resolved bool `json:"resolved,omitempty"` 692 693 // ServerResponse contains the HTTP response code and headers from the 694 // server. 695 googleapi.ServerResponse `json:"-"` 696 697 // ForceSendFields is a list of field names (e.g. "Anchor") to 698 // unconditionally include in API requests. By default, fields with 699 // empty values are omitted from API requests. However, any non-pointer, 700 // non-interface field appearing in ForceSendFields will be sent to the 701 // server regardless of whether the field is empty or not. This may be 702 // used to include empty fields in Patch requests. 703 ForceSendFields []string `json:"-"` 704 705 // NullFields is a list of field names (e.g. "Anchor") to include in API 706 // requests with the JSON null value. By default, fields with empty 707 // values are omitted from API requests. However, any field with an 708 // empty value appearing in NullFields will be sent to the server as 709 // null. It is an error if a field in this list has a non-empty value. 710 // This may be used to include null fields in Patch requests. 711 NullFields []string `json:"-"` 712} 713 714func (s *Comment) MarshalJSON() ([]byte, error) { 715 type NoMethod Comment 716 raw := NoMethod(*s) 717 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 718} 719 720// CommentQuotedFileContent: The file content to which the comment 721// refers, typically within the anchor region. For a text file, for 722// example, this would be the text at the location of the comment. 723type CommentQuotedFileContent struct { 724 // MimeType: The MIME type of the quoted content. 725 MimeType string `json:"mimeType,omitempty"` 726 727 // Value: The quoted content itself. This is interpreted as plain text 728 // if set through the API. 729 Value string `json:"value,omitempty"` 730 731 // ForceSendFields is a list of field names (e.g. "MimeType") to 732 // unconditionally include in API requests. By default, fields with 733 // empty values are omitted from API requests. However, any non-pointer, 734 // non-interface field appearing in ForceSendFields will be sent to the 735 // server regardless of whether the field is empty or not. This may be 736 // used to include empty fields in Patch requests. 737 ForceSendFields []string `json:"-"` 738 739 // NullFields is a list of field names (e.g. "MimeType") to include in 740 // API requests with the JSON null value. By default, fields with empty 741 // values are omitted from API requests. However, any field with an 742 // empty value appearing in NullFields will be sent to the server as 743 // null. It is an error if a field in this list has a non-empty value. 744 // This may be used to include null fields in Patch requests. 745 NullFields []string `json:"-"` 746} 747 748func (s *CommentQuotedFileContent) MarshalJSON() ([]byte, error) { 749 type NoMethod CommentQuotedFileContent 750 raw := NoMethod(*s) 751 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 752} 753 754// CommentList: A list of comments on a file. 755type CommentList struct { 756 // Comments: The list of comments. If nextPageToken is populated, then 757 // this list may be incomplete and an additional page of results should 758 // be fetched. 759 Comments []*Comment `json:"comments,omitempty"` 760 761 // Kind: Identifies what kind of resource this is. Value: the fixed 762 // string "drive#commentList". 763 Kind string `json:"kind,omitempty"` 764 765 // NextPageToken: The page token for the next page of comments. This 766 // will be absent if the end of the comments list has been reached. If 767 // the token is rejected for any reason, it should be discarded, and 768 // pagination should be restarted from the first page of results. 769 NextPageToken string `json:"nextPageToken,omitempty"` 770 771 // ServerResponse contains the HTTP response code and headers from the 772 // server. 773 googleapi.ServerResponse `json:"-"` 774 775 // ForceSendFields is a list of field names (e.g. "Comments") to 776 // unconditionally include in API requests. By default, fields with 777 // empty values are omitted from API requests. However, any non-pointer, 778 // non-interface field appearing in ForceSendFields will be sent to the 779 // server regardless of whether the field is empty or not. This may be 780 // used to include empty fields in Patch requests. 781 ForceSendFields []string `json:"-"` 782 783 // NullFields is a list of field names (e.g. "Comments") to include in 784 // API requests with the JSON null value. By default, fields with empty 785 // values are omitted from API requests. However, any field with an 786 // empty value appearing in NullFields will be sent to the server as 787 // null. It is an error if a field in this list has a non-empty value. 788 // This may be used to include null fields in Patch requests. 789 NullFields []string `json:"-"` 790} 791 792func (s *CommentList) MarshalJSON() ([]byte, error) { 793 type NoMethod CommentList 794 raw := NoMethod(*s) 795 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 796} 797 798// Drive: Representation of a shared drive. 799type Drive struct { 800 // BackgroundImageFile: An image file and cropping parameters from which 801 // a background image for this shared drive is set. This is a write only 802 // field; it can only be set on drive.drives.update requests that don't 803 // set themeId. When specified, all fields of the backgroundImageFile 804 // must be set. 805 BackgroundImageFile *DriveBackgroundImageFile `json:"backgroundImageFile,omitempty"` 806 807 // BackgroundImageLink: A short-lived link to this shared drive's 808 // background image. 809 BackgroundImageLink string `json:"backgroundImageLink,omitempty"` 810 811 // Capabilities: Capabilities the current user has on this shared drive. 812 Capabilities *DriveCapabilities `json:"capabilities,omitempty"` 813 814 // ColorRgb: The color of this shared drive as an RGB hex string. It can 815 // only be set on a drive.drives.update request that does not set 816 // themeId. 817 ColorRgb string `json:"colorRgb,omitempty"` 818 819 // CreatedTime: The time at which the shared drive was created (RFC 3339 820 // date-time). 821 CreatedTime string `json:"createdTime,omitempty"` 822 823 // Hidden: Whether the shared drive is hidden from default view. 824 Hidden bool `json:"hidden,omitempty"` 825 826 // Id: The ID of this shared drive which is also the ID of the top level 827 // folder of this shared drive. 828 Id string `json:"id,omitempty"` 829 830 // Kind: Identifies what kind of resource this is. Value: the fixed 831 // string "drive#drive". 832 Kind string `json:"kind,omitempty"` 833 834 // Name: The name of this shared drive. 835 Name string `json:"name,omitempty"` 836 837 // Restrictions: A set of restrictions that apply to this shared drive 838 // or items inside this shared drive. 839 Restrictions *DriveRestrictions `json:"restrictions,omitempty"` 840 841 // ThemeId: The ID of the theme from which the background image and 842 // color will be set. The set of possible driveThemes can be retrieved 843 // from a drive.about.get response. When not specified on a 844 // drive.drives.create request, a random theme is chosen from which the 845 // background image and color are set. This is a write-only field; it 846 // can only be set on requests that don't set colorRgb or 847 // backgroundImageFile. 848 ThemeId string `json:"themeId,omitempty"` 849 850 // ServerResponse contains the HTTP response code and headers from the 851 // server. 852 googleapi.ServerResponse `json:"-"` 853 854 // ForceSendFields is a list of field names (e.g. "BackgroundImageFile") 855 // to unconditionally include in API requests. By default, fields with 856 // empty values are omitted from API requests. However, any non-pointer, 857 // non-interface field appearing in ForceSendFields will be sent to the 858 // server regardless of whether the field is empty or not. This may be 859 // used to include empty fields in Patch requests. 860 ForceSendFields []string `json:"-"` 861 862 // NullFields is a list of field names (e.g. "BackgroundImageFile") to 863 // include in API requests with the JSON null value. By default, fields 864 // with empty values are omitted from API requests. However, any field 865 // with an empty value appearing in NullFields will be sent to the 866 // server as null. It is an error if a field in this list has a 867 // non-empty value. This may be used to include null fields in Patch 868 // requests. 869 NullFields []string `json:"-"` 870} 871 872func (s *Drive) MarshalJSON() ([]byte, error) { 873 type NoMethod Drive 874 raw := NoMethod(*s) 875 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 876} 877 878// DriveBackgroundImageFile: An image file and cropping parameters from 879// which a background image for this shared drive is set. This is a 880// write only field; it can only be set on drive.drives.update requests 881// that don't set themeId. When specified, all fields of the 882// backgroundImageFile must be set. 883type DriveBackgroundImageFile struct { 884 // Id: The ID of an image file in Google Drive to use for the background 885 // image. 886 Id string `json:"id,omitempty"` 887 888 // Width: The width of the cropped image in the closed range of 0 to 1. 889 // This value represents the width of the cropped image divided by the 890 // width of the entire image. The height is computed by applying a width 891 // to height aspect ratio of 80 to 9. The resulting image must be at 892 // least 1280 pixels wide and 144 pixels high. 893 Width float64 `json:"width,omitempty"` 894 895 // XCoordinate: The X coordinate of the upper left corner of the 896 // cropping area in the background image. This is a value in the closed 897 // range of 0 to 1. This value represents the horizontal distance from 898 // the left side of the entire image to the left side of the cropping 899 // area divided by the width of the entire image. 900 XCoordinate float64 `json:"xCoordinate,omitempty"` 901 902 // YCoordinate: The Y coordinate of the upper left corner of the 903 // cropping area in the background image. This is a value in the closed 904 // range of 0 to 1. This value represents the vertical distance from the 905 // top side of the entire image to the top side of the cropping area 906 // divided by the height of the entire image. 907 YCoordinate float64 `json:"yCoordinate,omitempty"` 908 909 // ForceSendFields is a list of field names (e.g. "Id") to 910 // unconditionally include in API requests. By default, fields with 911 // empty values are omitted from API requests. However, any non-pointer, 912 // non-interface field appearing in ForceSendFields will be sent to the 913 // server regardless of whether the field is empty or not. This may be 914 // used to include empty fields in Patch requests. 915 ForceSendFields []string `json:"-"` 916 917 // NullFields is a list of field names (e.g. "Id") to include in API 918 // requests with the JSON null value. By default, fields with empty 919 // values are omitted from API requests. However, any field with an 920 // empty value appearing in NullFields will be sent to the server as 921 // null. It is an error if a field in this list has a non-empty value. 922 // This may be used to include null fields in Patch requests. 923 NullFields []string `json:"-"` 924} 925 926func (s *DriveBackgroundImageFile) MarshalJSON() ([]byte, error) { 927 type NoMethod DriveBackgroundImageFile 928 raw := NoMethod(*s) 929 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 930} 931 932func (s *DriveBackgroundImageFile) UnmarshalJSON(data []byte) error { 933 type NoMethod DriveBackgroundImageFile 934 var s1 struct { 935 Width gensupport.JSONFloat64 `json:"width"` 936 XCoordinate gensupport.JSONFloat64 `json:"xCoordinate"` 937 YCoordinate gensupport.JSONFloat64 `json:"yCoordinate"` 938 *NoMethod 939 } 940 s1.NoMethod = (*NoMethod)(s) 941 if err := json.Unmarshal(data, &s1); err != nil { 942 return err 943 } 944 s.Width = float64(s1.Width) 945 s.XCoordinate = float64(s1.XCoordinate) 946 s.YCoordinate = float64(s1.YCoordinate) 947 return nil 948} 949 950// DriveCapabilities: Capabilities the current user has on this shared 951// drive. 952type DriveCapabilities struct { 953 // CanAddChildren: Whether the current user can add children to folders 954 // in this shared drive. 955 CanAddChildren bool `json:"canAddChildren,omitempty"` 956 957 // CanChangeCopyRequiresWriterPermissionRestriction: Whether the current 958 // user can change the copyRequiresWriterPermission restriction of this 959 // shared drive. 960 CanChangeCopyRequiresWriterPermissionRestriction bool `json:"canChangeCopyRequiresWriterPermissionRestriction,omitempty"` 961 962 // CanChangeDomainUsersOnlyRestriction: Whether the current user can 963 // change the domainUsersOnly restriction of this shared drive. 964 CanChangeDomainUsersOnlyRestriction bool `json:"canChangeDomainUsersOnlyRestriction,omitempty"` 965 966 // CanChangeDriveBackground: Whether the current user can change the 967 // background of this shared drive. 968 CanChangeDriveBackground bool `json:"canChangeDriveBackground,omitempty"` 969 970 // CanChangeDriveMembersOnlyRestriction: Whether the current user can 971 // change the driveMembersOnly restriction of this shared drive. 972 CanChangeDriveMembersOnlyRestriction bool `json:"canChangeDriveMembersOnlyRestriction,omitempty"` 973 974 // CanComment: Whether the current user can comment on files in this 975 // shared drive. 976 CanComment bool `json:"canComment,omitempty"` 977 978 // CanCopy: Whether the current user can copy files in this shared 979 // drive. 980 CanCopy bool `json:"canCopy,omitempty"` 981 982 // CanDeleteChildren: Whether the current user can delete children from 983 // folders in this shared drive. 984 CanDeleteChildren bool `json:"canDeleteChildren,omitempty"` 985 986 // CanDeleteDrive: Whether the current user can delete this shared 987 // drive. Attempting to delete the shared drive may still fail if there 988 // are untrashed items inside the shared drive. 989 CanDeleteDrive bool `json:"canDeleteDrive,omitempty"` 990 991 // CanDownload: Whether the current user can download files in this 992 // shared drive. 993 CanDownload bool `json:"canDownload,omitempty"` 994 995 // CanEdit: Whether the current user can edit files in this shared drive 996 CanEdit bool `json:"canEdit,omitempty"` 997 998 // CanListChildren: Whether the current user can list the children of 999 // folders in this shared drive. 1000 CanListChildren bool `json:"canListChildren,omitempty"` 1001 1002 // CanManageMembers: Whether the current user can add members to this 1003 // shared drive or remove them or change their role. 1004 CanManageMembers bool `json:"canManageMembers,omitempty"` 1005 1006 // CanReadRevisions: Whether the current user can read the revisions 1007 // resource of files in this shared drive. 1008 CanReadRevisions bool `json:"canReadRevisions,omitempty"` 1009 1010 // CanRename: Whether the current user can rename files or folders in 1011 // this shared drive. 1012 CanRename bool `json:"canRename,omitempty"` 1013 1014 // CanRenameDrive: Whether the current user can rename this shared 1015 // drive. 1016 CanRenameDrive bool `json:"canRenameDrive,omitempty"` 1017 1018 // CanShare: Whether the current user can share files or folders in this 1019 // shared drive. 1020 CanShare bool `json:"canShare,omitempty"` 1021 1022 // CanTrashChildren: Whether the current user can trash children from 1023 // folders in this shared drive. 1024 CanTrashChildren bool `json:"canTrashChildren,omitempty"` 1025 1026 // ForceSendFields is a list of field names (e.g. "CanAddChildren") to 1027 // unconditionally include in API requests. By default, fields with 1028 // empty values are omitted from API requests. However, any non-pointer, 1029 // non-interface field appearing in ForceSendFields will be sent to the 1030 // server regardless of whether the field is empty or not. This may be 1031 // used to include empty fields in Patch requests. 1032 ForceSendFields []string `json:"-"` 1033 1034 // NullFields is a list of field names (e.g. "CanAddChildren") to 1035 // include in API requests with the JSON null value. By default, fields 1036 // with empty values are omitted from API requests. However, any field 1037 // with an empty value appearing in NullFields will be sent to the 1038 // server as null. It is an error if a field in this list has a 1039 // non-empty value. This may be used to include null fields in Patch 1040 // requests. 1041 NullFields []string `json:"-"` 1042} 1043 1044func (s *DriveCapabilities) MarshalJSON() ([]byte, error) { 1045 type NoMethod DriveCapabilities 1046 raw := NoMethod(*s) 1047 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1048} 1049 1050// DriveRestrictions: A set of restrictions that apply to this shared 1051// drive or items inside this shared drive. 1052type DriveRestrictions struct { 1053 // AdminManagedRestrictions: Whether administrative privileges on this 1054 // shared drive are required to modify restrictions. 1055 AdminManagedRestrictions bool `json:"adminManagedRestrictions,omitempty"` 1056 1057 // CopyRequiresWriterPermission: Whether the options to copy, print, or 1058 // download files inside this shared drive, should be disabled for 1059 // readers and commenters. When this restriction is set to true, it will 1060 // override the similarly named field to true for any file inside this 1061 // shared drive. 1062 CopyRequiresWriterPermission bool `json:"copyRequiresWriterPermission,omitempty"` 1063 1064 // DomainUsersOnly: Whether access to this shared drive and items inside 1065 // this shared drive is restricted to users of the domain to which this 1066 // shared drive belongs. This restriction may be overridden by other 1067 // sharing policies controlled outside of this shared drive. 1068 DomainUsersOnly bool `json:"domainUsersOnly,omitempty"` 1069 1070 // DriveMembersOnly: Whether access to items inside this shared drive is 1071 // restricted to its members. 1072 DriveMembersOnly bool `json:"driveMembersOnly,omitempty"` 1073 1074 // ForceSendFields is a list of field names (e.g. 1075 // "AdminManagedRestrictions") to unconditionally include in API 1076 // requests. By default, fields with empty values are omitted from API 1077 // requests. However, any non-pointer, non-interface field appearing in 1078 // ForceSendFields will be sent to the server regardless of whether the 1079 // field is empty or not. This may be used to include empty fields in 1080 // Patch requests. 1081 ForceSendFields []string `json:"-"` 1082 1083 // NullFields is a list of field names (e.g. "AdminManagedRestrictions") 1084 // to include in API requests with the JSON null value. By default, 1085 // fields with empty values are omitted from API requests. However, any 1086 // field with an empty value appearing in NullFields will be sent to the 1087 // server as null. It is an error if a field in this list has a 1088 // non-empty value. This may be used to include null fields in Patch 1089 // requests. 1090 NullFields []string `json:"-"` 1091} 1092 1093func (s *DriveRestrictions) MarshalJSON() ([]byte, error) { 1094 type NoMethod DriveRestrictions 1095 raw := NoMethod(*s) 1096 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1097} 1098 1099// DriveList: A list of shared drives. 1100type DriveList struct { 1101 // Drives: The list of shared drives. If nextPageToken is populated, 1102 // then this list may be incomplete and an additional page of results 1103 // should be fetched. 1104 Drives []*Drive `json:"drives,omitempty"` 1105 1106 // Kind: Identifies what kind of resource this is. Value: the fixed 1107 // string "drive#driveList". 1108 Kind string `json:"kind,omitempty"` 1109 1110 // NextPageToken: The page token for the next page of shared drives. 1111 // This will be absent if the end of the list has been reached. If the 1112 // token is rejected for any reason, it should be discarded, and 1113 // pagination should be restarted from the first page of results. 1114 NextPageToken string `json:"nextPageToken,omitempty"` 1115 1116 // ServerResponse contains the HTTP response code and headers from the 1117 // server. 1118 googleapi.ServerResponse `json:"-"` 1119 1120 // ForceSendFields is a list of field names (e.g. "Drives") to 1121 // unconditionally include in API requests. By default, fields with 1122 // empty values are omitted from API requests. However, any non-pointer, 1123 // non-interface field appearing in ForceSendFields will be sent to the 1124 // server regardless of whether the field is empty or not. This may be 1125 // used to include empty fields in Patch requests. 1126 ForceSendFields []string `json:"-"` 1127 1128 // NullFields is a list of field names (e.g. "Drives") to include in API 1129 // requests with the JSON null value. By default, fields with empty 1130 // values are omitted from API requests. However, any field with an 1131 // empty value appearing in NullFields will be sent to the server as 1132 // null. It is an error if a field in this list has a non-empty value. 1133 // This may be used to include null fields in Patch requests. 1134 NullFields []string `json:"-"` 1135} 1136 1137func (s *DriveList) MarshalJSON() ([]byte, error) { 1138 type NoMethod DriveList 1139 raw := NoMethod(*s) 1140 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1141} 1142 1143// File: The metadata for a file. 1144type File struct { 1145 // AppProperties: A collection of arbitrary key-value pairs which are 1146 // private to the requesting app. 1147 // Entries with null values are cleared in update and copy requests. 1148 AppProperties map[string]string `json:"appProperties,omitempty"` 1149 1150 // Capabilities: Capabilities the current user has on this file. Each 1151 // capability corresponds to a fine-grained action that a user may take. 1152 Capabilities *FileCapabilities `json:"capabilities,omitempty"` 1153 1154 // ContentHints: Additional information about the content of the file. 1155 // These fields are never populated in responses. 1156 ContentHints *FileContentHints `json:"contentHints,omitempty"` 1157 1158 // CopyRequiresWriterPermission: Whether the options to copy, print, or 1159 // download this file, should be disabled for readers and commenters. 1160 CopyRequiresWriterPermission bool `json:"copyRequiresWriterPermission,omitempty"` 1161 1162 // CreatedTime: The time at which the file was created (RFC 3339 1163 // date-time). 1164 CreatedTime string `json:"createdTime,omitempty"` 1165 1166 // Description: A short description of the file. 1167 Description string `json:"description,omitempty"` 1168 1169 // DriveId: ID of the shared drive the file resides in. Only populated 1170 // for items in shared drives. 1171 DriveId string `json:"driveId,omitempty"` 1172 1173 // ExplicitlyTrashed: Whether the file has been explicitly trashed, as 1174 // opposed to recursively trashed from a parent folder. 1175 ExplicitlyTrashed bool `json:"explicitlyTrashed,omitempty"` 1176 1177 // ExportLinks: Links for exporting Google Docs to specific formats. 1178 ExportLinks map[string]string `json:"exportLinks,omitempty"` 1179 1180 // FileExtension: The final component of fullFileExtension. This is only 1181 // available for files with binary content in Google Drive. 1182 FileExtension string `json:"fileExtension,omitempty"` 1183 1184 // FolderColorRgb: The color for a folder as an RGB hex string. The 1185 // supported colors are published in the folderColorPalette field of the 1186 // About resource. 1187 // If an unsupported color is specified, the closest color in the 1188 // palette will be used instead. 1189 FolderColorRgb string `json:"folderColorRgb,omitempty"` 1190 1191 // FullFileExtension: The full file extension extracted from the name 1192 // field. May contain multiple concatenated extensions, such as 1193 // "tar.gz". This is only available for files with binary content in 1194 // Google Drive. 1195 // This is automatically updated when the name field changes, however it 1196 // is not cleared if the new name does not contain a valid extension. 1197 FullFileExtension string `json:"fullFileExtension,omitempty"` 1198 1199 // HasAugmentedPermissions: Whether any users are granted file access 1200 // directly on this file. This field is only populated for shared drive 1201 // files. 1202 HasAugmentedPermissions bool `json:"hasAugmentedPermissions,omitempty"` 1203 1204 // HasThumbnail: Whether this file has a thumbnail. This does not 1205 // indicate whether the requesting app has access to the thumbnail. To 1206 // check access, look for the presence of the thumbnailLink field. 1207 HasThumbnail bool `json:"hasThumbnail,omitempty"` 1208 1209 // HeadRevisionId: The ID of the file's head revision. This is currently 1210 // only available for files with binary content in Google Drive. 1211 HeadRevisionId string `json:"headRevisionId,omitempty"` 1212 1213 // IconLink: A static, unauthenticated link to the file's icon. 1214 IconLink string `json:"iconLink,omitempty"` 1215 1216 // Id: The ID of the file. 1217 Id string `json:"id,omitempty"` 1218 1219 // ImageMediaMetadata: Additional metadata about image media, if 1220 // available. 1221 ImageMediaMetadata *FileImageMediaMetadata `json:"imageMediaMetadata,omitempty"` 1222 1223 // IsAppAuthorized: Whether the file was created or opened by the 1224 // requesting app. 1225 IsAppAuthorized bool `json:"isAppAuthorized,omitempty"` 1226 1227 // Kind: Identifies what kind of resource this is. Value: the fixed 1228 // string "drive#file". 1229 Kind string `json:"kind,omitempty"` 1230 1231 // LastModifyingUser: The last user to modify the file. 1232 LastModifyingUser *User `json:"lastModifyingUser,omitempty"` 1233 1234 // Md5Checksum: The MD5 checksum for the content of the file. This is 1235 // only applicable to files with binary content in Google Drive. 1236 Md5Checksum string `json:"md5Checksum,omitempty"` 1237 1238 // MimeType: The MIME type of the file. 1239 // Google Drive will attempt to automatically detect an appropriate 1240 // value from uploaded content if no value is provided. The value cannot 1241 // be changed unless a new revision is uploaded. 1242 // If a file is created with a Google Doc MIME type, the uploaded 1243 // content will be imported if possible. The supported import formats 1244 // are published in the About resource. 1245 MimeType string `json:"mimeType,omitempty"` 1246 1247 // ModifiedByMe: Whether the file has been modified by this user. 1248 ModifiedByMe bool `json:"modifiedByMe,omitempty"` 1249 1250 // ModifiedByMeTime: The last time the file was modified by the user 1251 // (RFC 3339 date-time). 1252 ModifiedByMeTime string `json:"modifiedByMeTime,omitempty"` 1253 1254 // ModifiedTime: The last time the file was modified by anyone (RFC 3339 1255 // date-time). 1256 // Note that setting modifiedTime will also update modifiedByMeTime for 1257 // the user. 1258 ModifiedTime string `json:"modifiedTime,omitempty"` 1259 1260 // Name: The name of the file. This is not necessarily unique within a 1261 // folder. Note that for immutable items such as the top level folders 1262 // of shared drives, My Drive root folder, and Application Data folder 1263 // the name is constant. 1264 Name string `json:"name,omitempty"` 1265 1266 // OriginalFilename: The original filename of the uploaded content if 1267 // available, or else the original value of the name field. This is only 1268 // available for files with binary content in Google Drive. 1269 OriginalFilename string `json:"originalFilename,omitempty"` 1270 1271 // OwnedByMe: Whether the user owns the file. Not populated for items in 1272 // shared drives. 1273 OwnedByMe bool `json:"ownedByMe,omitempty"` 1274 1275 // Owners: The owners of the file. Currently, only certain legacy files 1276 // may have more than one owner. Not populated for items in shared 1277 // drives. 1278 Owners []*User `json:"owners,omitempty"` 1279 1280 // Parents: The IDs of the parent folders which contain the file. 1281 // If not specified as part of a create request, the file will be placed 1282 // directly in the user's My Drive folder. If not specified as part of a 1283 // copy request, the file will inherit any discoverable parents of the 1284 // source file. Update requests must use the addParents and 1285 // removeParents parameters to modify the parents list. 1286 Parents []string `json:"parents,omitempty"` 1287 1288 // PermissionIds: List of permission IDs for users with access to this 1289 // file. 1290 PermissionIds []string `json:"permissionIds,omitempty"` 1291 1292 // Permissions: The full list of permissions for the file. This is only 1293 // available if the requesting user can share the file. Not populated 1294 // for items in shared drives. 1295 Permissions []*Permission `json:"permissions,omitempty"` 1296 1297 // Properties: A collection of arbitrary key-value pairs which are 1298 // visible to all apps. 1299 // Entries with null values are cleared in update and copy requests. 1300 Properties map[string]string `json:"properties,omitempty"` 1301 1302 // QuotaBytesUsed: The number of storage quota bytes used by the file. 1303 // This includes the head revision as well as previous revisions with 1304 // keepForever enabled. 1305 QuotaBytesUsed int64 `json:"quotaBytesUsed,omitempty,string"` 1306 1307 // Shared: Whether the file has been shared. Not populated for items in 1308 // shared drives. 1309 Shared bool `json:"shared,omitempty"` 1310 1311 // SharedWithMeTime: The time at which the file was shared with the 1312 // user, if applicable (RFC 3339 date-time). 1313 SharedWithMeTime string `json:"sharedWithMeTime,omitempty"` 1314 1315 // SharingUser: The user who shared the file with the requesting user, 1316 // if applicable. 1317 SharingUser *User `json:"sharingUser,omitempty"` 1318 1319 // Size: The size of the file's content in bytes. This is only 1320 // applicable to files with binary content in Google Drive. 1321 Size int64 `json:"size,omitempty,string"` 1322 1323 // Spaces: The list of spaces which contain the file. The currently 1324 // supported values are 'drive', 'appDataFolder' and 'photos'. 1325 Spaces []string `json:"spaces,omitempty"` 1326 1327 // Starred: Whether the user has starred the file. 1328 Starred bool `json:"starred,omitempty"` 1329 1330 // TeamDriveId: Deprecated - use driveId instead. 1331 TeamDriveId string `json:"teamDriveId,omitempty"` 1332 1333 // ThumbnailLink: A short-lived link to the file's thumbnail, if 1334 // available. Typically lasts on the order of hours. Only populated when 1335 // the requesting app can access the file's content. 1336 ThumbnailLink string `json:"thumbnailLink,omitempty"` 1337 1338 // ThumbnailVersion: The thumbnail version for use in thumbnail cache 1339 // invalidation. 1340 ThumbnailVersion int64 `json:"thumbnailVersion,omitempty,string"` 1341 1342 // Trashed: Whether the file has been trashed, either explicitly or from 1343 // a trashed parent folder. Only the owner may trash a file, and other 1344 // users cannot see files in the owner's trash. 1345 Trashed bool `json:"trashed,omitempty"` 1346 1347 // TrashedTime: The time that the item was trashed (RFC 3339 date-time). 1348 // Only populated for items in shared drives. 1349 TrashedTime string `json:"trashedTime,omitempty"` 1350 1351 // TrashingUser: If the file has been explicitly trashed, the user who 1352 // trashed it. Only populated for items in shared drives. 1353 TrashingUser *User `json:"trashingUser,omitempty"` 1354 1355 // Version: A monotonically increasing version number for the file. This 1356 // reflects every change made to the file on the server, even those not 1357 // visible to the user. 1358 Version int64 `json:"version,omitempty,string"` 1359 1360 // VideoMediaMetadata: Additional metadata about video media. This may 1361 // not be available immediately upon upload. 1362 VideoMediaMetadata *FileVideoMediaMetadata `json:"videoMediaMetadata,omitempty"` 1363 1364 // ViewedByMe: Whether the file has been viewed by this user. 1365 ViewedByMe bool `json:"viewedByMe,omitempty"` 1366 1367 // ViewedByMeTime: The last time the file was viewed by the user (RFC 1368 // 3339 date-time). 1369 ViewedByMeTime string `json:"viewedByMeTime,omitempty"` 1370 1371 // ViewersCanCopyContent: Deprecated - use copyRequiresWriterPermission 1372 // instead. 1373 ViewersCanCopyContent bool `json:"viewersCanCopyContent,omitempty"` 1374 1375 // WebContentLink: A link for downloading the content of the file in a 1376 // browser. This is only available for files with binary content in 1377 // Google Drive. 1378 WebContentLink string `json:"webContentLink,omitempty"` 1379 1380 // WebViewLink: A link for opening the file in a relevant Google editor 1381 // or viewer in a browser. 1382 WebViewLink string `json:"webViewLink,omitempty"` 1383 1384 // WritersCanShare: Whether users with only writer permission can modify 1385 // the file's permissions. Not populated for items in shared drives. 1386 WritersCanShare bool `json:"writersCanShare,omitempty"` 1387 1388 // ServerResponse contains the HTTP response code and headers from the 1389 // server. 1390 googleapi.ServerResponse `json:"-"` 1391 1392 // ForceSendFields is a list of field names (e.g. "AppProperties") to 1393 // unconditionally include in API requests. By default, fields with 1394 // empty values are omitted from API requests. However, any non-pointer, 1395 // non-interface field appearing in ForceSendFields will be sent to the 1396 // server regardless of whether the field is empty or not. This may be 1397 // used to include empty fields in Patch requests. 1398 ForceSendFields []string `json:"-"` 1399 1400 // NullFields is a list of field names (e.g. "AppProperties") to include 1401 // in API requests with the JSON null value. By default, fields with 1402 // empty values are omitted from API requests. However, any field with 1403 // an empty value appearing in NullFields will be sent to the server as 1404 // null. It is an error if a field in this list has a non-empty value. 1405 // This may be used to include null fields in Patch requests. 1406 NullFields []string `json:"-"` 1407} 1408 1409func (s *File) MarshalJSON() ([]byte, error) { 1410 type NoMethod File 1411 raw := NoMethod(*s) 1412 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1413} 1414 1415// FileCapabilities: Capabilities the current user has on this file. 1416// Each capability corresponds to a fine-grained action that a user may 1417// take. 1418type FileCapabilities struct { 1419 // CanAddChildren: Whether the current user can add children to this 1420 // folder. This is always false when the item is not a folder. 1421 CanAddChildren bool `json:"canAddChildren,omitempty"` 1422 1423 // CanChangeCopyRequiresWriterPermission: Whether the current user can 1424 // change the copyRequiresWriterPermission restriction of this file. 1425 CanChangeCopyRequiresWriterPermission bool `json:"canChangeCopyRequiresWriterPermission,omitempty"` 1426 1427 // CanChangeViewersCanCopyContent: Deprecated 1428 CanChangeViewersCanCopyContent bool `json:"canChangeViewersCanCopyContent,omitempty"` 1429 1430 // CanComment: Whether the current user can comment on this file. 1431 CanComment bool `json:"canComment,omitempty"` 1432 1433 // CanCopy: Whether the current user can copy this file. For an item in 1434 // a shared drive, whether the current user can copy non-folder 1435 // descendants of this item, or this item itself if it is not a folder. 1436 CanCopy bool `json:"canCopy,omitempty"` 1437 1438 // CanDelete: Whether the current user can delete this file. 1439 CanDelete bool `json:"canDelete,omitempty"` 1440 1441 // CanDeleteChildren: Whether the current user can delete children of 1442 // this folder. This is false when the item is not a folder. Only 1443 // populated for items in shared drives. 1444 CanDeleteChildren bool `json:"canDeleteChildren,omitempty"` 1445 1446 // CanDownload: Whether the current user can download this file. 1447 CanDownload bool `json:"canDownload,omitempty"` 1448 1449 // CanEdit: Whether the current user can edit this file. 1450 CanEdit bool `json:"canEdit,omitempty"` 1451 1452 // CanListChildren: Whether the current user can list the children of 1453 // this folder. This is always false when the item is not a folder. 1454 CanListChildren bool `json:"canListChildren,omitempty"` 1455 1456 // CanMoveChildrenOutOfDrive: Whether the current user can move children 1457 // of this folder outside of the shared drive. This is false when the 1458 // item is not a folder. Only populated for items in shared drives. 1459 CanMoveChildrenOutOfDrive bool `json:"canMoveChildrenOutOfDrive,omitempty"` 1460 1461 // CanMoveChildrenOutOfTeamDrive: Deprecated - use 1462 // canMoveChildrenOutOfDrive instead. 1463 CanMoveChildrenOutOfTeamDrive bool `json:"canMoveChildrenOutOfTeamDrive,omitempty"` 1464 1465 // CanMoveChildrenWithinDrive: Whether the current user can move 1466 // children of this folder within the shared drive. This is false when 1467 // the item is not a folder. Only populated for items in shared drives. 1468 CanMoveChildrenWithinDrive bool `json:"canMoveChildrenWithinDrive,omitempty"` 1469 1470 // CanMoveChildrenWithinTeamDrive: Deprecated - use 1471 // canMoveChildrenWithinDrive instead. 1472 CanMoveChildrenWithinTeamDrive bool `json:"canMoveChildrenWithinTeamDrive,omitempty"` 1473 1474 // CanMoveItemIntoTeamDrive: Deprecated - use canMoveItemOutOfDrive 1475 // instead. 1476 CanMoveItemIntoTeamDrive bool `json:"canMoveItemIntoTeamDrive,omitempty"` 1477 1478 // CanMoveItemOutOfDrive: Whether the current user can move this item 1479 // outside of this drive by changing its parent. Note that a request to 1480 // change the parent of the item may still fail depending on the new 1481 // parent that is being added. 1482 CanMoveItemOutOfDrive bool `json:"canMoveItemOutOfDrive,omitempty"` 1483 1484 // CanMoveItemOutOfTeamDrive: Deprecated - use canMoveItemOutOfDrive 1485 // instead. 1486 CanMoveItemOutOfTeamDrive bool `json:"canMoveItemOutOfTeamDrive,omitempty"` 1487 1488 // CanMoveItemWithinDrive: Whether the current user can move this item 1489 // within this shared drive. Note that a request to change the parent of 1490 // the item may still fail depending on the new parent that is being 1491 // added. Only populated for items in shared drives. 1492 CanMoveItemWithinDrive bool `json:"canMoveItemWithinDrive,omitempty"` 1493 1494 // CanMoveItemWithinTeamDrive: Deprecated - use canMoveItemWithinDrive 1495 // instead. 1496 CanMoveItemWithinTeamDrive bool `json:"canMoveItemWithinTeamDrive,omitempty"` 1497 1498 // CanMoveTeamDriveItem: Deprecated - use canMoveItemWithinDrive or 1499 // canMoveItemOutOfDrive instead. 1500 CanMoveTeamDriveItem bool `json:"canMoveTeamDriveItem,omitempty"` 1501 1502 // CanReadDrive: Whether the current user can read the shared drive to 1503 // which this file belongs. Only populated for items in shared drives. 1504 CanReadDrive bool `json:"canReadDrive,omitempty"` 1505 1506 // CanReadRevisions: Whether the current user can read the revisions 1507 // resource of this file. For a shared drive item, whether revisions of 1508 // non-folder descendants of this item, or this item itself if it is not 1509 // a folder, can be read. 1510 CanReadRevisions bool `json:"canReadRevisions,omitempty"` 1511 1512 // CanReadTeamDrive: Deprecated - use canReadDrive instead. 1513 CanReadTeamDrive bool `json:"canReadTeamDrive,omitempty"` 1514 1515 // CanRemoveChildren: Whether the current user can remove children from 1516 // this folder. This is always false when the item is not a folder. For 1517 // a folder in a shared drive, use canDeleteChildren or canTrashChildren 1518 // instead. 1519 CanRemoveChildren bool `json:"canRemoveChildren,omitempty"` 1520 1521 // CanRename: Whether the current user can rename this file. 1522 CanRename bool `json:"canRename,omitempty"` 1523 1524 // CanShare: Whether the current user can modify the sharing settings 1525 // for this file. 1526 CanShare bool `json:"canShare,omitempty"` 1527 1528 // CanTrash: Whether the current user can move this file to trash. 1529 CanTrash bool `json:"canTrash,omitempty"` 1530 1531 // CanTrashChildren: Whether the current user can trash children of this 1532 // folder. This is false when the item is not a folder. Only populated 1533 // for items in shared drives. 1534 CanTrashChildren bool `json:"canTrashChildren,omitempty"` 1535 1536 // CanUntrash: Whether the current user can restore this file from 1537 // trash. 1538 CanUntrash bool `json:"canUntrash,omitempty"` 1539 1540 // ForceSendFields is a list of field names (e.g. "CanAddChildren") to 1541 // unconditionally include in API requests. By default, fields with 1542 // empty values are omitted from API requests. However, any non-pointer, 1543 // non-interface field appearing in ForceSendFields will be sent to the 1544 // server regardless of whether the field is empty or not. This may be 1545 // used to include empty fields in Patch requests. 1546 ForceSendFields []string `json:"-"` 1547 1548 // NullFields is a list of field names (e.g. "CanAddChildren") to 1549 // include in API requests with the JSON null value. By default, fields 1550 // with empty values are omitted from API requests. However, any field 1551 // with an empty value appearing in NullFields will be sent to the 1552 // server as null. It is an error if a field in this list has a 1553 // non-empty value. This may be used to include null fields in Patch 1554 // requests. 1555 NullFields []string `json:"-"` 1556} 1557 1558func (s *FileCapabilities) MarshalJSON() ([]byte, error) { 1559 type NoMethod FileCapabilities 1560 raw := NoMethod(*s) 1561 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1562} 1563 1564// FileContentHints: Additional information about the content of the 1565// file. These fields are never populated in responses. 1566type FileContentHints struct { 1567 // IndexableText: Text to be indexed for the file to improve fullText 1568 // queries. This is limited to 128KB in length and may contain HTML 1569 // elements. 1570 IndexableText string `json:"indexableText,omitempty"` 1571 1572 // Thumbnail: A thumbnail for the file. This will only be used if Google 1573 // Drive cannot generate a standard thumbnail. 1574 Thumbnail *FileContentHintsThumbnail `json:"thumbnail,omitempty"` 1575 1576 // ForceSendFields is a list of field names (e.g. "IndexableText") to 1577 // unconditionally include in API requests. By default, fields with 1578 // empty values are omitted from API requests. However, any non-pointer, 1579 // non-interface field appearing in ForceSendFields will be sent to the 1580 // server regardless of whether the field is empty or not. This may be 1581 // used to include empty fields in Patch requests. 1582 ForceSendFields []string `json:"-"` 1583 1584 // NullFields is a list of field names (e.g. "IndexableText") to include 1585 // in API requests with the JSON null value. By default, fields with 1586 // empty values are omitted from API requests. However, any field with 1587 // an empty value appearing in NullFields will be sent to the server as 1588 // null. It is an error if a field in this list has a non-empty value. 1589 // This may be used to include null fields in Patch requests. 1590 NullFields []string `json:"-"` 1591} 1592 1593func (s *FileContentHints) MarshalJSON() ([]byte, error) { 1594 type NoMethod FileContentHints 1595 raw := NoMethod(*s) 1596 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1597} 1598 1599// FileContentHintsThumbnail: A thumbnail for the file. This will only 1600// be used if Google Drive cannot generate a standard thumbnail. 1601type FileContentHintsThumbnail struct { 1602 // Image: The thumbnail data encoded with URL-safe Base64 (RFC 4648 1603 // section 5). 1604 Image string `json:"image,omitempty"` 1605 1606 // MimeType: The MIME type of the thumbnail. 1607 MimeType string `json:"mimeType,omitempty"` 1608 1609 // ForceSendFields is a list of field names (e.g. "Image") to 1610 // unconditionally include in API requests. By default, fields with 1611 // empty values are omitted from API requests. However, any non-pointer, 1612 // non-interface field appearing in ForceSendFields will be sent to the 1613 // server regardless of whether the field is empty or not. This may be 1614 // used to include empty fields in Patch requests. 1615 ForceSendFields []string `json:"-"` 1616 1617 // NullFields is a list of field names (e.g. "Image") to include in API 1618 // requests with the JSON null value. By default, fields with empty 1619 // values are omitted from API requests. However, any field with an 1620 // empty value appearing in NullFields will be sent to the server as 1621 // null. It is an error if a field in this list has a non-empty value. 1622 // This may be used to include null fields in Patch requests. 1623 NullFields []string `json:"-"` 1624} 1625 1626func (s *FileContentHintsThumbnail) MarshalJSON() ([]byte, error) { 1627 type NoMethod FileContentHintsThumbnail 1628 raw := NoMethod(*s) 1629 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1630} 1631 1632// FileImageMediaMetadata: Additional metadata about image media, if 1633// available. 1634type FileImageMediaMetadata struct { 1635 // Aperture: The aperture used to create the photo (f-number). 1636 Aperture float64 `json:"aperture,omitempty"` 1637 1638 // CameraMake: The make of the camera used to create the photo. 1639 CameraMake string `json:"cameraMake,omitempty"` 1640 1641 // CameraModel: The model of the camera used to create the photo. 1642 CameraModel string `json:"cameraModel,omitempty"` 1643 1644 // ColorSpace: The color space of the photo. 1645 ColorSpace string `json:"colorSpace,omitempty"` 1646 1647 // ExposureBias: The exposure bias of the photo (APEX value). 1648 ExposureBias float64 `json:"exposureBias,omitempty"` 1649 1650 // ExposureMode: The exposure mode used to create the photo. 1651 ExposureMode string `json:"exposureMode,omitempty"` 1652 1653 // ExposureTime: The length of the exposure, in seconds. 1654 ExposureTime float64 `json:"exposureTime,omitempty"` 1655 1656 // FlashUsed: Whether a flash was used to create the photo. 1657 FlashUsed bool `json:"flashUsed,omitempty"` 1658 1659 // FocalLength: The focal length used to create the photo, in 1660 // millimeters. 1661 FocalLength float64 `json:"focalLength,omitempty"` 1662 1663 // Height: The height of the image in pixels. 1664 Height int64 `json:"height,omitempty"` 1665 1666 // IsoSpeed: The ISO speed used to create the photo. 1667 IsoSpeed int64 `json:"isoSpeed,omitempty"` 1668 1669 // Lens: The lens used to create the photo. 1670 Lens string `json:"lens,omitempty"` 1671 1672 // Location: Geographic location information stored in the image. 1673 Location *FileImageMediaMetadataLocation `json:"location,omitempty"` 1674 1675 // MaxApertureValue: The smallest f-number of the lens at the focal 1676 // length used to create the photo (APEX value). 1677 MaxApertureValue float64 `json:"maxApertureValue,omitempty"` 1678 1679 // MeteringMode: The metering mode used to create the photo. 1680 MeteringMode string `json:"meteringMode,omitempty"` 1681 1682 // Rotation: The rotation in clockwise degrees from the image's original 1683 // orientation. 1684 Rotation int64 `json:"rotation,omitempty"` 1685 1686 // Sensor: The type of sensor used to create the photo. 1687 Sensor string `json:"sensor,omitempty"` 1688 1689 // SubjectDistance: The distance to the subject of the photo, in meters. 1690 SubjectDistance int64 `json:"subjectDistance,omitempty"` 1691 1692 // Time: The date and time the photo was taken (EXIF DateTime). 1693 Time string `json:"time,omitempty"` 1694 1695 // WhiteBalance: The white balance mode used to create the photo. 1696 WhiteBalance string `json:"whiteBalance,omitempty"` 1697 1698 // Width: The width of the image in pixels. 1699 Width int64 `json:"width,omitempty"` 1700 1701 // ForceSendFields is a list of field names (e.g. "Aperture") to 1702 // unconditionally include in API requests. By default, fields with 1703 // empty values are omitted from API requests. However, any non-pointer, 1704 // non-interface field appearing in ForceSendFields will be sent to the 1705 // server regardless of whether the field is empty or not. This may be 1706 // used to include empty fields in Patch requests. 1707 ForceSendFields []string `json:"-"` 1708 1709 // NullFields is a list of field names (e.g. "Aperture") to include in 1710 // API requests with the JSON null value. By default, fields with empty 1711 // values are omitted from API requests. However, any field with an 1712 // empty value appearing in NullFields will be sent to the server as 1713 // null. It is an error if a field in this list has a non-empty value. 1714 // This may be used to include null fields in Patch requests. 1715 NullFields []string `json:"-"` 1716} 1717 1718func (s *FileImageMediaMetadata) MarshalJSON() ([]byte, error) { 1719 type NoMethod FileImageMediaMetadata 1720 raw := NoMethod(*s) 1721 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1722} 1723 1724func (s *FileImageMediaMetadata) UnmarshalJSON(data []byte) error { 1725 type NoMethod FileImageMediaMetadata 1726 var s1 struct { 1727 Aperture gensupport.JSONFloat64 `json:"aperture"` 1728 ExposureBias gensupport.JSONFloat64 `json:"exposureBias"` 1729 ExposureTime gensupport.JSONFloat64 `json:"exposureTime"` 1730 FocalLength gensupport.JSONFloat64 `json:"focalLength"` 1731 MaxApertureValue gensupport.JSONFloat64 `json:"maxApertureValue"` 1732 *NoMethod 1733 } 1734 s1.NoMethod = (*NoMethod)(s) 1735 if err := json.Unmarshal(data, &s1); err != nil { 1736 return err 1737 } 1738 s.Aperture = float64(s1.Aperture) 1739 s.ExposureBias = float64(s1.ExposureBias) 1740 s.ExposureTime = float64(s1.ExposureTime) 1741 s.FocalLength = float64(s1.FocalLength) 1742 s.MaxApertureValue = float64(s1.MaxApertureValue) 1743 return nil 1744} 1745 1746// FileImageMediaMetadataLocation: Geographic location information 1747// stored in the image. 1748type FileImageMediaMetadataLocation struct { 1749 // Altitude: The altitude stored in the image. 1750 Altitude float64 `json:"altitude,omitempty"` 1751 1752 // Latitude: The latitude stored in the image. 1753 Latitude float64 `json:"latitude,omitempty"` 1754 1755 // Longitude: The longitude stored in the image. 1756 Longitude float64 `json:"longitude,omitempty"` 1757 1758 // ForceSendFields is a list of field names (e.g. "Altitude") to 1759 // unconditionally include in API requests. By default, fields with 1760 // empty values are omitted from API requests. However, any non-pointer, 1761 // non-interface field appearing in ForceSendFields will be sent to the 1762 // server regardless of whether the field is empty or not. This may be 1763 // used to include empty fields in Patch requests. 1764 ForceSendFields []string `json:"-"` 1765 1766 // NullFields is a list of field names (e.g. "Altitude") to include in 1767 // API requests with the JSON null value. By default, fields with empty 1768 // values are omitted from API requests. However, any field with an 1769 // empty value appearing in NullFields will be sent to the server as 1770 // null. It is an error if a field in this list has a non-empty value. 1771 // This may be used to include null fields in Patch requests. 1772 NullFields []string `json:"-"` 1773} 1774 1775func (s *FileImageMediaMetadataLocation) MarshalJSON() ([]byte, error) { 1776 type NoMethod FileImageMediaMetadataLocation 1777 raw := NoMethod(*s) 1778 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1779} 1780 1781func (s *FileImageMediaMetadataLocation) UnmarshalJSON(data []byte) error { 1782 type NoMethod FileImageMediaMetadataLocation 1783 var s1 struct { 1784 Altitude gensupport.JSONFloat64 `json:"altitude"` 1785 Latitude gensupport.JSONFloat64 `json:"latitude"` 1786 Longitude gensupport.JSONFloat64 `json:"longitude"` 1787 *NoMethod 1788 } 1789 s1.NoMethod = (*NoMethod)(s) 1790 if err := json.Unmarshal(data, &s1); err != nil { 1791 return err 1792 } 1793 s.Altitude = float64(s1.Altitude) 1794 s.Latitude = float64(s1.Latitude) 1795 s.Longitude = float64(s1.Longitude) 1796 return nil 1797} 1798 1799// FileVideoMediaMetadata: Additional metadata about video media. This 1800// may not be available immediately upon upload. 1801type FileVideoMediaMetadata struct { 1802 // DurationMillis: The duration of the video in milliseconds. 1803 DurationMillis int64 `json:"durationMillis,omitempty,string"` 1804 1805 // Height: The height of the video in pixels. 1806 Height int64 `json:"height,omitempty"` 1807 1808 // Width: The width of the video in pixels. 1809 Width int64 `json:"width,omitempty"` 1810 1811 // ForceSendFields is a list of field names (e.g. "DurationMillis") to 1812 // unconditionally include in API requests. By default, fields with 1813 // empty values are omitted from API requests. However, any non-pointer, 1814 // non-interface field appearing in ForceSendFields will be sent to the 1815 // server regardless of whether the field is empty or not. This may be 1816 // used to include empty fields in Patch requests. 1817 ForceSendFields []string `json:"-"` 1818 1819 // NullFields is a list of field names (e.g. "DurationMillis") to 1820 // include in API requests with the JSON null value. By default, fields 1821 // with empty values are omitted from API requests. However, any field 1822 // with an empty value appearing in NullFields will be sent to the 1823 // server as null. It is an error if a field in this list has a 1824 // non-empty value. This may be used to include null fields in Patch 1825 // requests. 1826 NullFields []string `json:"-"` 1827} 1828 1829func (s *FileVideoMediaMetadata) MarshalJSON() ([]byte, error) { 1830 type NoMethod FileVideoMediaMetadata 1831 raw := NoMethod(*s) 1832 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1833} 1834 1835// FileList: A list of files. 1836type FileList struct { 1837 // Files: The list of files. If nextPageToken is populated, then this 1838 // list may be incomplete and an additional page of results should be 1839 // fetched. 1840 Files []*File `json:"files,omitempty"` 1841 1842 // IncompleteSearch: Whether the search process was incomplete. If true, 1843 // then some search results may be missing, since all documents were not 1844 // searched. This may occur when searching multiple drives with the 1845 // "allDrives" corpora, but all corpora could not be searched. When this 1846 // happens, it is suggested that clients narrow their query by choosing 1847 // a different corpus such as "user" or "drive". 1848 IncompleteSearch bool `json:"incompleteSearch,omitempty"` 1849 1850 // Kind: Identifies what kind of resource this is. Value: the fixed 1851 // string "drive#fileList". 1852 Kind string `json:"kind,omitempty"` 1853 1854 // NextPageToken: The page token for the next page of files. This will 1855 // be absent if the end of the files list has been reached. If the token 1856 // is rejected for any reason, it should be discarded, and pagination 1857 // should be restarted from the first page of results. 1858 NextPageToken string `json:"nextPageToken,omitempty"` 1859 1860 // ServerResponse contains the HTTP response code and headers from the 1861 // server. 1862 googleapi.ServerResponse `json:"-"` 1863 1864 // ForceSendFields is a list of field names (e.g. "Files") to 1865 // unconditionally include in API requests. By default, fields with 1866 // empty values are omitted from API requests. However, any non-pointer, 1867 // non-interface field appearing in ForceSendFields will be sent to the 1868 // server regardless of whether the field is empty or not. This may be 1869 // used to include empty fields in Patch requests. 1870 ForceSendFields []string `json:"-"` 1871 1872 // NullFields is a list of field names (e.g. "Files") to include in API 1873 // requests with the JSON null value. By default, fields with empty 1874 // values are omitted from API requests. However, any field with an 1875 // empty value appearing in NullFields will be sent to the server as 1876 // null. It is an error if a field in this list has a non-empty value. 1877 // This may be used to include null fields in Patch requests. 1878 NullFields []string `json:"-"` 1879} 1880 1881func (s *FileList) MarshalJSON() ([]byte, error) { 1882 type NoMethod FileList 1883 raw := NoMethod(*s) 1884 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1885} 1886 1887// GeneratedIds: A list of generated file IDs which can be provided in 1888// create requests. 1889type GeneratedIds struct { 1890 // Ids: The IDs generated for the requesting user in the specified 1891 // space. 1892 Ids []string `json:"ids,omitempty"` 1893 1894 // Kind: Identifies what kind of resource this is. Value: the fixed 1895 // string "drive#generatedIds". 1896 Kind string `json:"kind,omitempty"` 1897 1898 // Space: The type of file that can be created with these IDs. 1899 Space string `json:"space,omitempty"` 1900 1901 // ServerResponse contains the HTTP response code and headers from the 1902 // server. 1903 googleapi.ServerResponse `json:"-"` 1904 1905 // ForceSendFields is a list of field names (e.g. "Ids") to 1906 // unconditionally include in API requests. By default, fields with 1907 // empty values are omitted from API requests. However, any non-pointer, 1908 // non-interface field appearing in ForceSendFields will be sent to the 1909 // server regardless of whether the field is empty or not. This may be 1910 // used to include empty fields in Patch requests. 1911 ForceSendFields []string `json:"-"` 1912 1913 // NullFields is a list of field names (e.g. "Ids") to include in API 1914 // requests with the JSON null value. By default, fields with empty 1915 // values are omitted from API requests. However, any field with an 1916 // empty value appearing in NullFields will be sent to the server as 1917 // null. It is an error if a field in this list has a non-empty value. 1918 // This may be used to include null fields in Patch requests. 1919 NullFields []string `json:"-"` 1920} 1921 1922func (s *GeneratedIds) MarshalJSON() ([]byte, error) { 1923 type NoMethod GeneratedIds 1924 raw := NoMethod(*s) 1925 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1926} 1927 1928// Permission: A permission for a file. A permission grants a user, 1929// group, domain or the world access to a file or a folder hierarchy. 1930type Permission struct { 1931 // AllowFileDiscovery: Whether the permission allows the file to be 1932 // discovered through search. This is only applicable for permissions of 1933 // type domain or anyone. 1934 AllowFileDiscovery bool `json:"allowFileDiscovery,omitempty"` 1935 1936 // Deleted: Whether the account associated with this permission has been 1937 // deleted. This field only pertains to user and group permissions. 1938 Deleted bool `json:"deleted,omitempty"` 1939 1940 // DisplayName: A displayable name for users, groups or domains. 1941 DisplayName string `json:"displayName,omitempty"` 1942 1943 // Domain: The domain to which this permission refers. 1944 Domain string `json:"domain,omitempty"` 1945 1946 // EmailAddress: The email address of the user or group to which this 1947 // permission refers. 1948 EmailAddress string `json:"emailAddress,omitempty"` 1949 1950 // ExpirationTime: The time at which this permission will expire (RFC 1951 // 3339 date-time). Expiration times have the following restrictions: 1952 // 1953 // - They can only be set on user and group permissions 1954 // - The time must be in the future 1955 // - The time cannot be more than a year in the future 1956 ExpirationTime string `json:"expirationTime,omitempty"` 1957 1958 // Id: The ID of this permission. This is a unique identifier for the 1959 // grantee, and is published in User resources as permissionId. 1960 Id string `json:"id,omitempty"` 1961 1962 // Kind: Identifies what kind of resource this is. Value: the fixed 1963 // string "drive#permission". 1964 Kind string `json:"kind,omitempty"` 1965 1966 // PermissionDetails: Details of whether the permissions on this shared 1967 // drive item are inherited or directly on this item. This is an 1968 // output-only field which is present only for shared drive items. 1969 PermissionDetails []*PermissionPermissionDetails `json:"permissionDetails,omitempty"` 1970 1971 // PhotoLink: A link to the user's profile photo, if available. 1972 PhotoLink string `json:"photoLink,omitempty"` 1973 1974 // Role: The role granted by this permission. While new values may be 1975 // supported in the future, the following are currently allowed: 1976 // - owner 1977 // - organizer 1978 // - fileOrganizer 1979 // - writer 1980 // - commenter 1981 // - reader 1982 Role string `json:"role,omitempty"` 1983 1984 // TeamDrivePermissionDetails: Deprecated - use permissionDetails 1985 // instead. 1986 TeamDrivePermissionDetails []*PermissionTeamDrivePermissionDetails `json:"teamDrivePermissionDetails,omitempty"` 1987 1988 // Type: The type of the grantee. Valid values are: 1989 // - user 1990 // - group 1991 // - domain 1992 // - anyone 1993 Type string `json:"type,omitempty"` 1994 1995 // ServerResponse contains the HTTP response code and headers from the 1996 // server. 1997 googleapi.ServerResponse `json:"-"` 1998 1999 // ForceSendFields is a list of field names (e.g. "AllowFileDiscovery") 2000 // to unconditionally include in API requests. By default, fields with 2001 // empty values are omitted from API requests. However, any non-pointer, 2002 // non-interface field appearing in ForceSendFields will be sent to the 2003 // server regardless of whether the field is empty or not. This may be 2004 // used to include empty fields in Patch requests. 2005 ForceSendFields []string `json:"-"` 2006 2007 // NullFields is a list of field names (e.g. "AllowFileDiscovery") to 2008 // include in API requests with the JSON null value. By default, fields 2009 // with empty values are omitted from API requests. However, any field 2010 // with an empty value appearing in NullFields will be sent to the 2011 // server as null. It is an error if a field in this list has a 2012 // non-empty value. This may be used to include null fields in Patch 2013 // requests. 2014 NullFields []string `json:"-"` 2015} 2016 2017func (s *Permission) MarshalJSON() ([]byte, error) { 2018 type NoMethod Permission 2019 raw := NoMethod(*s) 2020 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 2021} 2022 2023type PermissionPermissionDetails struct { 2024 // Inherited: Whether this permission is inherited. This field is always 2025 // populated. This is an output-only field. 2026 Inherited bool `json:"inherited,omitempty"` 2027 2028 // InheritedFrom: The ID of the item from which this permission is 2029 // inherited. This is an output-only field and is only populated for 2030 // members of the shared drive. 2031 InheritedFrom string `json:"inheritedFrom,omitempty"` 2032 2033 // PermissionType: The permission type for this user. While new values 2034 // may be added in future, the following are currently possible: 2035 // - file 2036 // - member 2037 PermissionType string `json:"permissionType,omitempty"` 2038 2039 // Role: The primary role for this user. While new values may be added 2040 // in the future, the following are currently possible: 2041 // - organizer 2042 // - fileOrganizer 2043 // - writer 2044 // - commenter 2045 // - reader 2046 Role string `json:"role,omitempty"` 2047 2048 // ForceSendFields is a list of field names (e.g. "Inherited") to 2049 // unconditionally include in API requests. By default, fields with 2050 // empty values are omitted from API requests. However, any non-pointer, 2051 // non-interface field appearing in ForceSendFields will be sent to the 2052 // server regardless of whether the field is empty or not. This may be 2053 // used to include empty fields in Patch requests. 2054 ForceSendFields []string `json:"-"` 2055 2056 // NullFields is a list of field names (e.g. "Inherited") to include in 2057 // API requests with the JSON null value. By default, fields with empty 2058 // values are omitted from API requests. However, any field with an 2059 // empty value appearing in NullFields will be sent to the server as 2060 // null. It is an error if a field in this list has a non-empty value. 2061 // This may be used to include null fields in Patch requests. 2062 NullFields []string `json:"-"` 2063} 2064 2065func (s *PermissionPermissionDetails) MarshalJSON() ([]byte, error) { 2066 type NoMethod PermissionPermissionDetails 2067 raw := NoMethod(*s) 2068 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 2069} 2070 2071type PermissionTeamDrivePermissionDetails struct { 2072 // Inherited: Deprecated - use permissionDetails/inherited instead. 2073 Inherited bool `json:"inherited,omitempty"` 2074 2075 // InheritedFrom: Deprecated - use permissionDetails/inheritedFrom 2076 // instead. 2077 InheritedFrom string `json:"inheritedFrom,omitempty"` 2078 2079 // Role: Deprecated - use permissionDetails/role instead. 2080 Role string `json:"role,omitempty"` 2081 2082 // TeamDrivePermissionType: Deprecated - use 2083 // permissionDetails/permissionType instead. 2084 TeamDrivePermissionType string `json:"teamDrivePermissionType,omitempty"` 2085 2086 // ForceSendFields is a list of field names (e.g. "Inherited") to 2087 // unconditionally include in API requests. By default, fields with 2088 // empty values are omitted from API requests. However, any non-pointer, 2089 // non-interface field appearing in ForceSendFields will be sent to the 2090 // server regardless of whether the field is empty or not. This may be 2091 // used to include empty fields in Patch requests. 2092 ForceSendFields []string `json:"-"` 2093 2094 // NullFields is a list of field names (e.g. "Inherited") to include in 2095 // API requests with the JSON null value. By default, fields with empty 2096 // values are omitted from API requests. However, any field with an 2097 // empty value appearing in NullFields will be sent to the server as 2098 // null. It is an error if a field in this list has a non-empty value. 2099 // This may be used to include null fields in Patch requests. 2100 NullFields []string `json:"-"` 2101} 2102 2103func (s *PermissionTeamDrivePermissionDetails) MarshalJSON() ([]byte, error) { 2104 type NoMethod PermissionTeamDrivePermissionDetails 2105 raw := NoMethod(*s) 2106 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 2107} 2108 2109// PermissionList: A list of permissions for a file. 2110type PermissionList struct { 2111 // Kind: Identifies what kind of resource this is. Value: the fixed 2112 // string "drive#permissionList". 2113 Kind string `json:"kind,omitempty"` 2114 2115 // NextPageToken: The page token for the next page of permissions. This 2116 // field will be absent if the end of the permissions list has been 2117 // reached. If the token is rejected for any reason, it should be 2118 // discarded, and pagination should be restarted from the first page of 2119 // results. 2120 NextPageToken string `json:"nextPageToken,omitempty"` 2121 2122 // Permissions: The list of permissions. If nextPageToken is populated, 2123 // then this list may be incomplete and an additional page of results 2124 // should be fetched. 2125 Permissions []*Permission `json:"permissions,omitempty"` 2126 2127 // ServerResponse contains the HTTP response code and headers from the 2128 // server. 2129 googleapi.ServerResponse `json:"-"` 2130 2131 // ForceSendFields is a list of field names (e.g. "Kind") to 2132 // unconditionally include in API requests. By default, fields with 2133 // empty values are omitted from API requests. However, any non-pointer, 2134 // non-interface field appearing in ForceSendFields will be sent to the 2135 // server regardless of whether the field is empty or not. This may be 2136 // used to include empty fields in Patch requests. 2137 ForceSendFields []string `json:"-"` 2138 2139 // NullFields is a list of field names (e.g. "Kind") to include in API 2140 // requests with the JSON null value. By default, fields with empty 2141 // values are omitted from API requests. However, any field with an 2142 // empty value appearing in NullFields will be sent to the server as 2143 // null. It is an error if a field in this list has a non-empty value. 2144 // This may be used to include null fields in Patch requests. 2145 NullFields []string `json:"-"` 2146} 2147 2148func (s *PermissionList) MarshalJSON() ([]byte, error) { 2149 type NoMethod PermissionList 2150 raw := NoMethod(*s) 2151 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 2152} 2153 2154// Reply: A reply to a comment on a file. 2155type Reply struct { 2156 // Action: The action the reply performed to the parent comment. Valid 2157 // values are: 2158 // - resolve 2159 // - reopen 2160 Action string `json:"action,omitempty"` 2161 2162 // Author: The user who created the reply. 2163 Author *User `json:"author,omitempty"` 2164 2165 // Content: The plain text content of the reply. This field is used for 2166 // setting the content, while htmlContent should be displayed. This is 2167 // required on creates if no action is specified. 2168 Content string `json:"content,omitempty"` 2169 2170 // CreatedTime: The time at which the reply was created (RFC 3339 2171 // date-time). 2172 CreatedTime string `json:"createdTime,omitempty"` 2173 2174 // Deleted: Whether the reply has been deleted. A deleted reply has no 2175 // content. 2176 Deleted bool `json:"deleted,omitempty"` 2177 2178 // HtmlContent: The content of the reply with HTML formatting. 2179 HtmlContent string `json:"htmlContent,omitempty"` 2180 2181 // Id: The ID of the reply. 2182 Id string `json:"id,omitempty"` 2183 2184 // Kind: Identifies what kind of resource this is. Value: the fixed 2185 // string "drive#reply". 2186 Kind string `json:"kind,omitempty"` 2187 2188 // ModifiedTime: The last time the reply was modified (RFC 3339 2189 // date-time). 2190 ModifiedTime string `json:"modifiedTime,omitempty"` 2191 2192 // ServerResponse contains the HTTP response code and headers from the 2193 // server. 2194 googleapi.ServerResponse `json:"-"` 2195 2196 // ForceSendFields is a list of field names (e.g. "Action") to 2197 // unconditionally include in API requests. By default, fields with 2198 // empty values are omitted from API requests. However, any non-pointer, 2199 // non-interface field appearing in ForceSendFields will be sent to the 2200 // server regardless of whether the field is empty or not. This may be 2201 // used to include empty fields in Patch requests. 2202 ForceSendFields []string `json:"-"` 2203 2204 // NullFields is a list of field names (e.g. "Action") to include in API 2205 // requests with the JSON null value. By default, fields with empty 2206 // values are omitted from API requests. However, any field with an 2207 // empty value appearing in NullFields will be sent to the server as 2208 // null. It is an error if a field in this list has a non-empty value. 2209 // This may be used to include null fields in Patch requests. 2210 NullFields []string `json:"-"` 2211} 2212 2213func (s *Reply) MarshalJSON() ([]byte, error) { 2214 type NoMethod Reply 2215 raw := NoMethod(*s) 2216 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 2217} 2218 2219// ReplyList: A list of replies to a comment on a file. 2220type ReplyList struct { 2221 // Kind: Identifies what kind of resource this is. Value: the fixed 2222 // string "drive#replyList". 2223 Kind string `json:"kind,omitempty"` 2224 2225 // NextPageToken: The page token for the next page of replies. This will 2226 // be absent if the end of the replies list has been reached. If the 2227 // token is rejected for any reason, it should be discarded, and 2228 // pagination should be restarted from the first page of results. 2229 NextPageToken string `json:"nextPageToken,omitempty"` 2230 2231 // Replies: The list of replies. If nextPageToken is populated, then 2232 // this list may be incomplete and an additional page of results should 2233 // be fetched. 2234 Replies []*Reply `json:"replies,omitempty"` 2235 2236 // ServerResponse contains the HTTP response code and headers from the 2237 // server. 2238 googleapi.ServerResponse `json:"-"` 2239 2240 // ForceSendFields is a list of field names (e.g. "Kind") to 2241 // unconditionally include in API requests. By default, fields with 2242 // empty values are omitted from API requests. However, any non-pointer, 2243 // non-interface field appearing in ForceSendFields will be sent to the 2244 // server regardless of whether the field is empty or not. This may be 2245 // used to include empty fields in Patch requests. 2246 ForceSendFields []string `json:"-"` 2247 2248 // NullFields is a list of field names (e.g. "Kind") to include in API 2249 // requests with the JSON null value. By default, fields with empty 2250 // values are omitted from API requests. However, any field with an 2251 // empty value appearing in NullFields will be sent to the server as 2252 // null. It is an error if a field in this list has a non-empty value. 2253 // This may be used to include null fields in Patch requests. 2254 NullFields []string `json:"-"` 2255} 2256 2257func (s *ReplyList) MarshalJSON() ([]byte, error) { 2258 type NoMethod ReplyList 2259 raw := NoMethod(*s) 2260 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 2261} 2262 2263// Revision: The metadata for a revision to a file. 2264type Revision struct { 2265 // ExportLinks: Links for exporting Google Docs to specific formats. 2266 ExportLinks map[string]string `json:"exportLinks,omitempty"` 2267 2268 // Id: The ID of the revision. 2269 Id string `json:"id,omitempty"` 2270 2271 // KeepForever: Whether to keep this revision forever, even if it is no 2272 // longer the head revision. If not set, the revision will be 2273 // automatically purged 30 days after newer content is uploaded. This 2274 // can be set on a maximum of 200 revisions for a file. 2275 // This field is only applicable to files with binary content in Drive. 2276 KeepForever bool `json:"keepForever,omitempty"` 2277 2278 // Kind: Identifies what kind of resource this is. Value: the fixed 2279 // string "drive#revision". 2280 Kind string `json:"kind,omitempty"` 2281 2282 // LastModifyingUser: The last user to modify this revision. 2283 LastModifyingUser *User `json:"lastModifyingUser,omitempty"` 2284 2285 // Md5Checksum: The MD5 checksum of the revision's content. This is only 2286 // applicable to files with binary content in Drive. 2287 Md5Checksum string `json:"md5Checksum,omitempty"` 2288 2289 // MimeType: The MIME type of the revision. 2290 MimeType string `json:"mimeType,omitempty"` 2291 2292 // ModifiedTime: The last time the revision was modified (RFC 3339 2293 // date-time). 2294 ModifiedTime string `json:"modifiedTime,omitempty"` 2295 2296 // OriginalFilename: The original filename used to create this revision. 2297 // This is only applicable to files with binary content in Drive. 2298 OriginalFilename string `json:"originalFilename,omitempty"` 2299 2300 // PublishAuto: Whether subsequent revisions will be automatically 2301 // republished. This is only applicable to Google Docs. 2302 PublishAuto bool `json:"publishAuto,omitempty"` 2303 2304 // Published: Whether this revision is published. This is only 2305 // applicable to Google Docs. 2306 Published bool `json:"published,omitempty"` 2307 2308 // PublishedOutsideDomain: Whether this revision is published outside 2309 // the domain. This is only applicable to Google Docs. 2310 PublishedOutsideDomain bool `json:"publishedOutsideDomain,omitempty"` 2311 2312 // Size: The size of the revision's content in bytes. This is only 2313 // applicable to files with binary content in Drive. 2314 Size int64 `json:"size,omitempty,string"` 2315 2316 // ServerResponse contains the HTTP response code and headers from the 2317 // server. 2318 googleapi.ServerResponse `json:"-"` 2319 2320 // ForceSendFields is a list of field names (e.g. "ExportLinks") to 2321 // unconditionally include in API requests. By default, fields with 2322 // empty values are omitted from API requests. However, any non-pointer, 2323 // non-interface field appearing in ForceSendFields will be sent to the 2324 // server regardless of whether the field is empty or not. This may be 2325 // used to include empty fields in Patch requests. 2326 ForceSendFields []string `json:"-"` 2327 2328 // NullFields is a list of field names (e.g. "ExportLinks") to include 2329 // in API requests with the JSON null value. By default, fields with 2330 // empty values are omitted from API requests. However, any field with 2331 // an empty value appearing in NullFields will be sent to the server as 2332 // null. It is an error if a field in this list has a non-empty value. 2333 // This may be used to include null fields in Patch requests. 2334 NullFields []string `json:"-"` 2335} 2336 2337func (s *Revision) MarshalJSON() ([]byte, error) { 2338 type NoMethod Revision 2339 raw := NoMethod(*s) 2340 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 2341} 2342 2343// RevisionList: A list of revisions of a file. 2344type RevisionList struct { 2345 // Kind: Identifies what kind of resource this is. Value: the fixed 2346 // string "drive#revisionList". 2347 Kind string `json:"kind,omitempty"` 2348 2349 // NextPageToken: The page token for the next page of revisions. This 2350 // will be absent if the end of the revisions list has been reached. If 2351 // the token is rejected for any reason, it should be discarded, and 2352 // pagination should be restarted from the first page of results. 2353 NextPageToken string `json:"nextPageToken,omitempty"` 2354 2355 // Revisions: The list of revisions. If nextPageToken is populated, then 2356 // this list may be incomplete and an additional page of results should 2357 // be fetched. 2358 Revisions []*Revision `json:"revisions,omitempty"` 2359 2360 // ServerResponse contains the HTTP response code and headers from the 2361 // server. 2362 googleapi.ServerResponse `json:"-"` 2363 2364 // ForceSendFields is a list of field names (e.g. "Kind") to 2365 // unconditionally include in API requests. By default, fields with 2366 // empty values are omitted from API requests. However, any non-pointer, 2367 // non-interface field appearing in ForceSendFields will be sent to the 2368 // server regardless of whether the field is empty or not. This may be 2369 // used to include empty fields in Patch requests. 2370 ForceSendFields []string `json:"-"` 2371 2372 // NullFields is a list of field names (e.g. "Kind") to include in API 2373 // requests with the JSON null value. By default, fields with empty 2374 // values are omitted from API requests. However, any field with an 2375 // empty value appearing in NullFields will be sent to the server as 2376 // null. It is an error if a field in this list has a non-empty value. 2377 // This may be used to include null fields in Patch requests. 2378 NullFields []string `json:"-"` 2379} 2380 2381func (s *RevisionList) MarshalJSON() ([]byte, error) { 2382 type NoMethod RevisionList 2383 raw := NoMethod(*s) 2384 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 2385} 2386 2387type StartPageToken struct { 2388 // Kind: Identifies what kind of resource this is. Value: the fixed 2389 // string "drive#startPageToken". 2390 Kind string `json:"kind,omitempty"` 2391 2392 // StartPageToken: The starting page token for listing changes. 2393 StartPageToken string `json:"startPageToken,omitempty"` 2394 2395 // ServerResponse contains the HTTP response code and headers from the 2396 // server. 2397 googleapi.ServerResponse `json:"-"` 2398 2399 // ForceSendFields is a list of field names (e.g. "Kind") to 2400 // unconditionally include in API requests. By default, fields with 2401 // empty values are omitted from API requests. However, any non-pointer, 2402 // non-interface field appearing in ForceSendFields will be sent to the 2403 // server regardless of whether the field is empty or not. This may be 2404 // used to include empty fields in Patch requests. 2405 ForceSendFields []string `json:"-"` 2406 2407 // NullFields is a list of field names (e.g. "Kind") to include in API 2408 // requests with the JSON null value. By default, fields with empty 2409 // values are omitted from API requests. However, any field with an 2410 // empty value appearing in NullFields will be sent to the server as 2411 // null. It is an error if a field in this list has a non-empty value. 2412 // This may be used to include null fields in Patch requests. 2413 NullFields []string `json:"-"` 2414} 2415 2416func (s *StartPageToken) MarshalJSON() ([]byte, error) { 2417 type NoMethod StartPageToken 2418 raw := NoMethod(*s) 2419 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 2420} 2421 2422// TeamDrive: Deprecated: use the drive collection instead. 2423type TeamDrive struct { 2424 // BackgroundImageFile: An image file and cropping parameters from which 2425 // a background image for this Team Drive is set. This is a write only 2426 // field; it can only be set on drive.teamdrives.update requests that 2427 // don't set themeId. When specified, all fields of the 2428 // backgroundImageFile must be set. 2429 BackgroundImageFile *TeamDriveBackgroundImageFile `json:"backgroundImageFile,omitempty"` 2430 2431 // BackgroundImageLink: A short-lived link to this Team Drive's 2432 // background image. 2433 BackgroundImageLink string `json:"backgroundImageLink,omitempty"` 2434 2435 // Capabilities: Capabilities the current user has on this Team Drive. 2436 Capabilities *TeamDriveCapabilities `json:"capabilities,omitempty"` 2437 2438 // ColorRgb: The color of this Team Drive as an RGB hex string. It can 2439 // only be set on a drive.teamdrives.update request that does not set 2440 // themeId. 2441 ColorRgb string `json:"colorRgb,omitempty"` 2442 2443 // CreatedTime: The time at which the Team Drive was created (RFC 3339 2444 // date-time). 2445 CreatedTime string `json:"createdTime,omitempty"` 2446 2447 // Id: The ID of this Team Drive which is also the ID of the top level 2448 // folder of this Team Drive. 2449 Id string `json:"id,omitempty"` 2450 2451 // Kind: Identifies what kind of resource this is. Value: the fixed 2452 // string "drive#teamDrive". 2453 Kind string `json:"kind,omitempty"` 2454 2455 // Name: The name of this Team Drive. 2456 Name string `json:"name,omitempty"` 2457 2458 // Restrictions: A set of restrictions that apply to this Team Drive or 2459 // items inside this Team Drive. 2460 Restrictions *TeamDriveRestrictions `json:"restrictions,omitempty"` 2461 2462 // ThemeId: The ID of the theme from which the background image and 2463 // color will be set. The set of possible teamDriveThemes can be 2464 // retrieved from a drive.about.get response. When not specified on a 2465 // drive.teamdrives.create request, a random theme is chosen from which 2466 // the background image and color are set. This is a write-only field; 2467 // it can only be set on requests that don't set colorRgb or 2468 // backgroundImageFile. 2469 ThemeId string `json:"themeId,omitempty"` 2470 2471 // ServerResponse contains the HTTP response code and headers from the 2472 // server. 2473 googleapi.ServerResponse `json:"-"` 2474 2475 // ForceSendFields is a list of field names (e.g. "BackgroundImageFile") 2476 // to unconditionally include in API requests. By default, fields with 2477 // empty values are omitted from API requests. However, any non-pointer, 2478 // non-interface field appearing in ForceSendFields will be sent to the 2479 // server regardless of whether the field is empty or not. This may be 2480 // used to include empty fields in Patch requests. 2481 ForceSendFields []string `json:"-"` 2482 2483 // NullFields is a list of field names (e.g. "BackgroundImageFile") to 2484 // include in API requests with the JSON null value. By default, fields 2485 // with empty values are omitted from API requests. However, any field 2486 // with an empty value appearing in NullFields will be sent to the 2487 // server as null. It is an error if a field in this list has a 2488 // non-empty value. This may be used to include null fields in Patch 2489 // requests. 2490 NullFields []string `json:"-"` 2491} 2492 2493func (s *TeamDrive) MarshalJSON() ([]byte, error) { 2494 type NoMethod TeamDrive 2495 raw := NoMethod(*s) 2496 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 2497} 2498 2499// TeamDriveBackgroundImageFile: An image file and cropping parameters 2500// from which a background image for this Team Drive is set. This is a 2501// write only field; it can only be set on drive.teamdrives.update 2502// requests that don't set themeId. When specified, all fields of the 2503// backgroundImageFile must be set. 2504type TeamDriveBackgroundImageFile struct { 2505 // Id: The ID of an image file in Drive to use for the background image. 2506 Id string `json:"id,omitempty"` 2507 2508 // Width: The width of the cropped image in the closed range of 0 to 1. 2509 // This value represents the width of the cropped image divided by the 2510 // width of the entire image. The height is computed by applying a width 2511 // to height aspect ratio of 80 to 9. The resulting image must be at 2512 // least 1280 pixels wide and 144 pixels high. 2513 Width float64 `json:"width,omitempty"` 2514 2515 // XCoordinate: The X coordinate of the upper left corner of the 2516 // cropping area in the background image. This is a value in the closed 2517 // range of 0 to 1. This value represents the horizontal distance from 2518 // the left side of the entire image to the left side of the cropping 2519 // area divided by the width of the entire image. 2520 XCoordinate float64 `json:"xCoordinate,omitempty"` 2521 2522 // YCoordinate: The Y coordinate of the upper left corner of the 2523 // cropping area in the background image. This is a value in the closed 2524 // range of 0 to 1. This value represents the vertical distance from the 2525 // top side of the entire image to the top side of the cropping area 2526 // divided by the height of the entire image. 2527 YCoordinate float64 `json:"yCoordinate,omitempty"` 2528 2529 // ForceSendFields is a list of field names (e.g. "Id") to 2530 // unconditionally include in API requests. By default, fields with 2531 // empty values are omitted from API requests. However, any non-pointer, 2532 // non-interface field appearing in ForceSendFields will be sent to the 2533 // server regardless of whether the field is empty or not. This may be 2534 // used to include empty fields in Patch requests. 2535 ForceSendFields []string `json:"-"` 2536 2537 // NullFields is a list of field names (e.g. "Id") to include in API 2538 // requests with the JSON null value. By default, fields with empty 2539 // values are omitted from API requests. However, any field with an 2540 // empty value appearing in NullFields will be sent to the server as 2541 // null. It is an error if a field in this list has a non-empty value. 2542 // This may be used to include null fields in Patch requests. 2543 NullFields []string `json:"-"` 2544} 2545 2546func (s *TeamDriveBackgroundImageFile) MarshalJSON() ([]byte, error) { 2547 type NoMethod TeamDriveBackgroundImageFile 2548 raw := NoMethod(*s) 2549 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 2550} 2551 2552func (s *TeamDriveBackgroundImageFile) UnmarshalJSON(data []byte) error { 2553 type NoMethod TeamDriveBackgroundImageFile 2554 var s1 struct { 2555 Width gensupport.JSONFloat64 `json:"width"` 2556 XCoordinate gensupport.JSONFloat64 `json:"xCoordinate"` 2557 YCoordinate gensupport.JSONFloat64 `json:"yCoordinate"` 2558 *NoMethod 2559 } 2560 s1.NoMethod = (*NoMethod)(s) 2561 if err := json.Unmarshal(data, &s1); err != nil { 2562 return err 2563 } 2564 s.Width = float64(s1.Width) 2565 s.XCoordinate = float64(s1.XCoordinate) 2566 s.YCoordinate = float64(s1.YCoordinate) 2567 return nil 2568} 2569 2570// TeamDriveCapabilities: Capabilities the current user has on this Team 2571// Drive. 2572type TeamDriveCapabilities struct { 2573 // CanAddChildren: Whether the current user can add children to folders 2574 // in this Team Drive. 2575 CanAddChildren bool `json:"canAddChildren,omitempty"` 2576 2577 // CanChangeCopyRequiresWriterPermissionRestriction: Whether the current 2578 // user can change the copyRequiresWriterPermission restriction of this 2579 // Team Drive. 2580 CanChangeCopyRequiresWriterPermissionRestriction bool `json:"canChangeCopyRequiresWriterPermissionRestriction,omitempty"` 2581 2582 // CanChangeDomainUsersOnlyRestriction: Whether the current user can 2583 // change the domainUsersOnly restriction of this Team Drive. 2584 CanChangeDomainUsersOnlyRestriction bool `json:"canChangeDomainUsersOnlyRestriction,omitempty"` 2585 2586 // CanChangeTeamDriveBackground: Whether the current user can change the 2587 // background of this Team Drive. 2588 CanChangeTeamDriveBackground bool `json:"canChangeTeamDriveBackground,omitempty"` 2589 2590 // CanChangeTeamMembersOnlyRestriction: Whether the current user can 2591 // change the teamMembersOnly restriction of this Team Drive. 2592 CanChangeTeamMembersOnlyRestriction bool `json:"canChangeTeamMembersOnlyRestriction,omitempty"` 2593 2594 // CanComment: Whether the current user can comment on files in this 2595 // Team Drive. 2596 CanComment bool `json:"canComment,omitempty"` 2597 2598 // CanCopy: Whether the current user can copy files in this Team Drive. 2599 CanCopy bool `json:"canCopy,omitempty"` 2600 2601 // CanDeleteChildren: Whether the current user can delete children from 2602 // folders in this Team Drive. 2603 CanDeleteChildren bool `json:"canDeleteChildren,omitempty"` 2604 2605 // CanDeleteTeamDrive: Whether the current user can delete this Team 2606 // Drive. Attempting to delete the Team Drive may still fail if there 2607 // are untrashed items inside the Team Drive. 2608 CanDeleteTeamDrive bool `json:"canDeleteTeamDrive,omitempty"` 2609 2610 // CanDownload: Whether the current user can download files in this Team 2611 // Drive. 2612 CanDownload bool `json:"canDownload,omitempty"` 2613 2614 // CanEdit: Whether the current user can edit files in this Team Drive 2615 CanEdit bool `json:"canEdit,omitempty"` 2616 2617 // CanListChildren: Whether the current user can list the children of 2618 // folders in this Team Drive. 2619 CanListChildren bool `json:"canListChildren,omitempty"` 2620 2621 // CanManageMembers: Whether the current user can add members to this 2622 // Team Drive or remove them or change their role. 2623 CanManageMembers bool `json:"canManageMembers,omitempty"` 2624 2625 // CanReadRevisions: Whether the current user can read the revisions 2626 // resource of files in this Team Drive. 2627 CanReadRevisions bool `json:"canReadRevisions,omitempty"` 2628 2629 // CanRemoveChildren: Deprecated - use canDeleteChildren or 2630 // canTrashChildren instead. 2631 CanRemoveChildren bool `json:"canRemoveChildren,omitempty"` 2632 2633 // CanRename: Whether the current user can rename files or folders in 2634 // this Team Drive. 2635 CanRename bool `json:"canRename,omitempty"` 2636 2637 // CanRenameTeamDrive: Whether the current user can rename this Team 2638 // Drive. 2639 CanRenameTeamDrive bool `json:"canRenameTeamDrive,omitempty"` 2640 2641 // CanShare: Whether the current user can share files or folders in this 2642 // Team Drive. 2643 CanShare bool `json:"canShare,omitempty"` 2644 2645 // CanTrashChildren: Whether the current user can trash children from 2646 // folders in this Team Drive. 2647 CanTrashChildren bool `json:"canTrashChildren,omitempty"` 2648 2649 // ForceSendFields is a list of field names (e.g. "CanAddChildren") to 2650 // unconditionally include in API requests. By default, fields with 2651 // empty values are omitted from API requests. However, any non-pointer, 2652 // non-interface field appearing in ForceSendFields will be sent to the 2653 // server regardless of whether the field is empty or not. This may be 2654 // used to include empty fields in Patch requests. 2655 ForceSendFields []string `json:"-"` 2656 2657 // NullFields is a list of field names (e.g. "CanAddChildren") to 2658 // include in API requests with the JSON null value. By default, fields 2659 // with empty values are omitted from API requests. However, any field 2660 // with an empty value appearing in NullFields will be sent to the 2661 // server as null. It is an error if a field in this list has a 2662 // non-empty value. This may be used to include null fields in Patch 2663 // requests. 2664 NullFields []string `json:"-"` 2665} 2666 2667func (s *TeamDriveCapabilities) MarshalJSON() ([]byte, error) { 2668 type NoMethod TeamDriveCapabilities 2669 raw := NoMethod(*s) 2670 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 2671} 2672 2673// TeamDriveRestrictions: A set of restrictions that apply to this Team 2674// Drive or items inside this Team Drive. 2675type TeamDriveRestrictions struct { 2676 // AdminManagedRestrictions: Whether administrative privileges on this 2677 // Team Drive are required to modify restrictions. 2678 AdminManagedRestrictions bool `json:"adminManagedRestrictions,omitempty"` 2679 2680 // CopyRequiresWriterPermission: Whether the options to copy, print, or 2681 // download files inside this Team Drive, should be disabled for readers 2682 // and commenters. When this restriction is set to true, it will 2683 // override the similarly named field to true for any file inside this 2684 // Team Drive. 2685 CopyRequiresWriterPermission bool `json:"copyRequiresWriterPermission,omitempty"` 2686 2687 // DomainUsersOnly: Whether access to this Team Drive and items inside 2688 // this Team Drive is restricted to users of the domain to which this 2689 // Team Drive belongs. This restriction may be overridden by other 2690 // sharing policies controlled outside of this Team Drive. 2691 DomainUsersOnly bool `json:"domainUsersOnly,omitempty"` 2692 2693 // TeamMembersOnly: Whether access to items inside this Team Drive is 2694 // restricted to members of this Team Drive. 2695 TeamMembersOnly bool `json:"teamMembersOnly,omitempty"` 2696 2697 // ForceSendFields is a list of field names (e.g. 2698 // "AdminManagedRestrictions") to unconditionally include in API 2699 // requests. By default, fields with empty values are omitted from API 2700 // requests. However, any non-pointer, non-interface field appearing in 2701 // ForceSendFields will be sent to the server regardless of whether the 2702 // field is empty or not. This may be used to include empty fields in 2703 // Patch requests. 2704 ForceSendFields []string `json:"-"` 2705 2706 // NullFields is a list of field names (e.g. "AdminManagedRestrictions") 2707 // to include in API requests with the JSON null value. By default, 2708 // fields with empty values are omitted from API requests. However, any 2709 // field with an empty value appearing in NullFields will be sent to the 2710 // server as null. It is an error if a field in this list has a 2711 // non-empty value. This may be used to include null fields in Patch 2712 // requests. 2713 NullFields []string `json:"-"` 2714} 2715 2716func (s *TeamDriveRestrictions) MarshalJSON() ([]byte, error) { 2717 type NoMethod TeamDriveRestrictions 2718 raw := NoMethod(*s) 2719 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 2720} 2721 2722// TeamDriveList: A list of Team Drives. 2723type TeamDriveList struct { 2724 // Kind: Identifies what kind of resource this is. Value: the fixed 2725 // string "drive#teamDriveList". 2726 Kind string `json:"kind,omitempty"` 2727 2728 // NextPageToken: The page token for the next page of Team Drives. This 2729 // will be absent if the end of the Team Drives list has been reached. 2730 // If the token is rejected for any reason, it should be discarded, and 2731 // pagination should be restarted from the first page of results. 2732 NextPageToken string `json:"nextPageToken,omitempty"` 2733 2734 // TeamDrives: The list of Team Drives. If nextPageToken is populated, 2735 // then this list may be incomplete and an additional page of results 2736 // should be fetched. 2737 TeamDrives []*TeamDrive `json:"teamDrives,omitempty"` 2738 2739 // ServerResponse contains the HTTP response code and headers from the 2740 // server. 2741 googleapi.ServerResponse `json:"-"` 2742 2743 // ForceSendFields is a list of field names (e.g. "Kind") to 2744 // unconditionally include in API requests. By default, fields with 2745 // empty values are omitted from API requests. However, any non-pointer, 2746 // non-interface field appearing in ForceSendFields will be sent to the 2747 // server regardless of whether the field is empty or not. This may be 2748 // used to include empty fields in Patch requests. 2749 ForceSendFields []string `json:"-"` 2750 2751 // NullFields is a list of field names (e.g. "Kind") to include in API 2752 // requests with the JSON null value. By default, fields with empty 2753 // values are omitted from API requests. However, any field with an 2754 // empty value appearing in NullFields will be sent to the server as 2755 // null. It is an error if a field in this list has a non-empty value. 2756 // This may be used to include null fields in Patch requests. 2757 NullFields []string `json:"-"` 2758} 2759 2760func (s *TeamDriveList) MarshalJSON() ([]byte, error) { 2761 type NoMethod TeamDriveList 2762 raw := NoMethod(*s) 2763 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 2764} 2765 2766// User: Information about a Drive user. 2767type User struct { 2768 // DisplayName: A plain text displayable name for this user. 2769 DisplayName string `json:"displayName,omitempty"` 2770 2771 // EmailAddress: The email address of the user. This may not be present 2772 // in certain contexts if the user has not made their email address 2773 // visible to the requester. 2774 EmailAddress string `json:"emailAddress,omitempty"` 2775 2776 // Kind: Identifies what kind of resource this is. Value: the fixed 2777 // string "drive#user". 2778 Kind string `json:"kind,omitempty"` 2779 2780 // Me: Whether this user is the requesting user. 2781 Me bool `json:"me,omitempty"` 2782 2783 // PermissionId: The user's ID as visible in Permission resources. 2784 PermissionId string `json:"permissionId,omitempty"` 2785 2786 // PhotoLink: A link to the user's profile photo, if available. 2787 PhotoLink string `json:"photoLink,omitempty"` 2788 2789 // ForceSendFields is a list of field names (e.g. "DisplayName") to 2790 // unconditionally include in API requests. By default, fields with 2791 // empty values are omitted from API requests. However, any non-pointer, 2792 // non-interface field appearing in ForceSendFields will be sent to the 2793 // server regardless of whether the field is empty or not. This may be 2794 // used to include empty fields in Patch requests. 2795 ForceSendFields []string `json:"-"` 2796 2797 // NullFields is a list of field names (e.g. "DisplayName") to include 2798 // in API requests with the JSON null value. By default, fields with 2799 // empty values are omitted from API requests. However, any field with 2800 // an empty value appearing in NullFields will be sent to the server as 2801 // null. It is an error if a field in this list has a non-empty value. 2802 // This may be used to include null fields in Patch requests. 2803 NullFields []string `json:"-"` 2804} 2805 2806func (s *User) MarshalJSON() ([]byte, error) { 2807 type NoMethod User 2808 raw := NoMethod(*s) 2809 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 2810} 2811 2812// method id "drive.about.get": 2813 2814type AboutGetCall struct { 2815 s *Service 2816 urlParams_ gensupport.URLParams 2817 ifNoneMatch_ string 2818 ctx_ context.Context 2819 header_ http.Header 2820} 2821 2822// Get: Gets information about the user, the user's Drive, and system 2823// capabilities. 2824func (r *AboutService) Get() *AboutGetCall { 2825 c := &AboutGetCall{s: r.s, urlParams_: make(gensupport.URLParams)} 2826 return c 2827} 2828 2829// Fields allows partial responses to be retrieved. See 2830// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 2831// for more information. 2832func (c *AboutGetCall) Fields(s ...googleapi.Field) *AboutGetCall { 2833 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 2834 return c 2835} 2836 2837// IfNoneMatch sets the optional parameter which makes the operation 2838// fail if the object's ETag matches the given value. This is useful for 2839// getting updates only after the object has changed since the last 2840// request. Use googleapi.IsNotModified to check whether the response 2841// error from Do is the result of In-None-Match. 2842func (c *AboutGetCall) IfNoneMatch(entityTag string) *AboutGetCall { 2843 c.ifNoneMatch_ = entityTag 2844 return c 2845} 2846 2847// Context sets the context to be used in this call's Do method. Any 2848// pending HTTP request will be aborted if the provided context is 2849// canceled. 2850func (c *AboutGetCall) Context(ctx context.Context) *AboutGetCall { 2851 c.ctx_ = ctx 2852 return c 2853} 2854 2855// Header returns an http.Header that can be modified by the caller to 2856// add HTTP headers to the request. 2857func (c *AboutGetCall) Header() http.Header { 2858 if c.header_ == nil { 2859 c.header_ = make(http.Header) 2860 } 2861 return c.header_ 2862} 2863 2864func (c *AboutGetCall) doRequest(alt string) (*http.Response, error) { 2865 reqHeaders := make(http.Header) 2866 for k, v := range c.header_ { 2867 reqHeaders[k] = v 2868 } 2869 reqHeaders.Set("User-Agent", c.s.userAgent()) 2870 if c.ifNoneMatch_ != "" { 2871 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 2872 } 2873 var body io.Reader = nil 2874 c.urlParams_.Set("alt", alt) 2875 c.urlParams_.Set("prettyPrint", "false") 2876 urls := googleapi.ResolveRelative(c.s.BasePath, "about") 2877 urls += "?" + c.urlParams_.Encode() 2878 req, err := http.NewRequest("GET", urls, body) 2879 if err != nil { 2880 return nil, err 2881 } 2882 req.Header = reqHeaders 2883 return gensupport.SendRequest(c.ctx_, c.s.client, req) 2884} 2885 2886// Do executes the "drive.about.get" call. 2887// Exactly one of *About or error will be non-nil. Any non-2xx status 2888// code is an error. Response headers are in either 2889// *About.ServerResponse.Header or (if a response was returned at all) 2890// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 2891// check whether the returned error was because http.StatusNotModified 2892// was returned. 2893func (c *AboutGetCall) Do(opts ...googleapi.CallOption) (*About, error) { 2894 gensupport.SetOptions(c.urlParams_, opts...) 2895 res, err := c.doRequest("json") 2896 if res != nil && res.StatusCode == http.StatusNotModified { 2897 if res.Body != nil { 2898 res.Body.Close() 2899 } 2900 return nil, &googleapi.Error{ 2901 Code: res.StatusCode, 2902 Header: res.Header, 2903 } 2904 } 2905 if err != nil { 2906 return nil, err 2907 } 2908 defer googleapi.CloseBody(res) 2909 if err := googleapi.CheckResponse(res); err != nil { 2910 return nil, err 2911 } 2912 ret := &About{ 2913 ServerResponse: googleapi.ServerResponse{ 2914 Header: res.Header, 2915 HTTPStatusCode: res.StatusCode, 2916 }, 2917 } 2918 target := &ret 2919 if err := gensupport.DecodeResponse(target, res); err != nil { 2920 return nil, err 2921 } 2922 return ret, nil 2923 // { 2924 // "description": "Gets information about the user, the user's Drive, and system capabilities.", 2925 // "httpMethod": "GET", 2926 // "id": "drive.about.get", 2927 // "path": "about", 2928 // "response": { 2929 // "$ref": "About" 2930 // }, 2931 // "scopes": [ 2932 // "https://www.googleapis.com/auth/drive", 2933 // "https://www.googleapis.com/auth/drive.appdata", 2934 // "https://www.googleapis.com/auth/drive.file", 2935 // "https://www.googleapis.com/auth/drive.metadata", 2936 // "https://www.googleapis.com/auth/drive.metadata.readonly", 2937 // "https://www.googleapis.com/auth/drive.photos.readonly", 2938 // "https://www.googleapis.com/auth/drive.readonly" 2939 // ] 2940 // } 2941 2942} 2943 2944// method id "drive.changes.getStartPageToken": 2945 2946type ChangesGetStartPageTokenCall struct { 2947 s *Service 2948 urlParams_ gensupport.URLParams 2949 ifNoneMatch_ string 2950 ctx_ context.Context 2951 header_ http.Header 2952} 2953 2954// GetStartPageToken: Gets the starting pageToken for listing future 2955// changes. 2956func (r *ChangesService) GetStartPageToken() *ChangesGetStartPageTokenCall { 2957 c := &ChangesGetStartPageTokenCall{s: r.s, urlParams_: make(gensupport.URLParams)} 2958 return c 2959} 2960 2961// DriveId sets the optional parameter "driveId": The ID of the shared 2962// drive for which the starting pageToken for listing future changes 2963// from that shared drive will be returned. 2964func (c *ChangesGetStartPageTokenCall) DriveId(driveId string) *ChangesGetStartPageTokenCall { 2965 c.urlParams_.Set("driveId", driveId) 2966 return c 2967} 2968 2969// SupportsAllDrives sets the optional parameter "supportsAllDrives": 2970// Deprecated - Whether the requesting application supports both My 2971// Drives and shared drives. This parameter will only be effective until 2972// June 1, 2020. Afterwards all applications are assumed to support 2973// shared drives. 2974func (c *ChangesGetStartPageTokenCall) SupportsAllDrives(supportsAllDrives bool) *ChangesGetStartPageTokenCall { 2975 c.urlParams_.Set("supportsAllDrives", fmt.Sprint(supportsAllDrives)) 2976 return c 2977} 2978 2979// SupportsTeamDrives sets the optional parameter "supportsTeamDrives": 2980// Deprecated use supportsAllDrives instead. 2981func (c *ChangesGetStartPageTokenCall) SupportsTeamDrives(supportsTeamDrives bool) *ChangesGetStartPageTokenCall { 2982 c.urlParams_.Set("supportsTeamDrives", fmt.Sprint(supportsTeamDrives)) 2983 return c 2984} 2985 2986// TeamDriveId sets the optional parameter "teamDriveId": Deprecated use 2987// driveId instead. 2988func (c *ChangesGetStartPageTokenCall) TeamDriveId(teamDriveId string) *ChangesGetStartPageTokenCall { 2989 c.urlParams_.Set("teamDriveId", teamDriveId) 2990 return c 2991} 2992 2993// Fields allows partial responses to be retrieved. See 2994// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 2995// for more information. 2996func (c *ChangesGetStartPageTokenCall) Fields(s ...googleapi.Field) *ChangesGetStartPageTokenCall { 2997 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 2998 return c 2999} 3000 3001// IfNoneMatch sets the optional parameter which makes the operation 3002// fail if the object's ETag matches the given value. This is useful for 3003// getting updates only after the object has changed since the last 3004// request. Use googleapi.IsNotModified to check whether the response 3005// error from Do is the result of In-None-Match. 3006func (c *ChangesGetStartPageTokenCall) IfNoneMatch(entityTag string) *ChangesGetStartPageTokenCall { 3007 c.ifNoneMatch_ = entityTag 3008 return c 3009} 3010 3011// Context sets the context to be used in this call's Do method. Any 3012// pending HTTP request will be aborted if the provided context is 3013// canceled. 3014func (c *ChangesGetStartPageTokenCall) Context(ctx context.Context) *ChangesGetStartPageTokenCall { 3015 c.ctx_ = ctx 3016 return c 3017} 3018 3019// Header returns an http.Header that can be modified by the caller to 3020// add HTTP headers to the request. 3021func (c *ChangesGetStartPageTokenCall) Header() http.Header { 3022 if c.header_ == nil { 3023 c.header_ = make(http.Header) 3024 } 3025 return c.header_ 3026} 3027 3028func (c *ChangesGetStartPageTokenCall) doRequest(alt string) (*http.Response, error) { 3029 reqHeaders := make(http.Header) 3030 for k, v := range c.header_ { 3031 reqHeaders[k] = v 3032 } 3033 reqHeaders.Set("User-Agent", c.s.userAgent()) 3034 if c.ifNoneMatch_ != "" { 3035 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 3036 } 3037 var body io.Reader = nil 3038 c.urlParams_.Set("alt", alt) 3039 c.urlParams_.Set("prettyPrint", "false") 3040 urls := googleapi.ResolveRelative(c.s.BasePath, "changes/startPageToken") 3041 urls += "?" + c.urlParams_.Encode() 3042 req, err := http.NewRequest("GET", urls, body) 3043 if err != nil { 3044 return nil, err 3045 } 3046 req.Header = reqHeaders 3047 return gensupport.SendRequest(c.ctx_, c.s.client, req) 3048} 3049 3050// Do executes the "drive.changes.getStartPageToken" call. 3051// Exactly one of *StartPageToken or error will be non-nil. Any non-2xx 3052// status code is an error. Response headers are in either 3053// *StartPageToken.ServerResponse.Header or (if a response was returned 3054// at all) in error.(*googleapi.Error).Header. Use 3055// googleapi.IsNotModified to check whether the returned error was 3056// because http.StatusNotModified was returned. 3057func (c *ChangesGetStartPageTokenCall) Do(opts ...googleapi.CallOption) (*StartPageToken, error) { 3058 gensupport.SetOptions(c.urlParams_, opts...) 3059 res, err := c.doRequest("json") 3060 if res != nil && res.StatusCode == http.StatusNotModified { 3061 if res.Body != nil { 3062 res.Body.Close() 3063 } 3064 return nil, &googleapi.Error{ 3065 Code: res.StatusCode, 3066 Header: res.Header, 3067 } 3068 } 3069 if err != nil { 3070 return nil, err 3071 } 3072 defer googleapi.CloseBody(res) 3073 if err := googleapi.CheckResponse(res); err != nil { 3074 return nil, err 3075 } 3076 ret := &StartPageToken{ 3077 ServerResponse: googleapi.ServerResponse{ 3078 Header: res.Header, 3079 HTTPStatusCode: res.StatusCode, 3080 }, 3081 } 3082 target := &ret 3083 if err := gensupport.DecodeResponse(target, res); err != nil { 3084 return nil, err 3085 } 3086 return ret, nil 3087 // { 3088 // "description": "Gets the starting pageToken for listing future changes.", 3089 // "httpMethod": "GET", 3090 // "id": "drive.changes.getStartPageToken", 3091 // "parameters": { 3092 // "driveId": { 3093 // "description": "The ID of the shared drive for which the starting pageToken for listing future changes from that shared drive will be returned.", 3094 // "location": "query", 3095 // "type": "string" 3096 // }, 3097 // "supportsAllDrives": { 3098 // "default": "false", 3099 // "description": "Deprecated - Whether the requesting application supports both My Drives and shared drives. This parameter will only be effective until June 1, 2020. Afterwards all applications are assumed to support shared drives.", 3100 // "location": "query", 3101 // "type": "boolean" 3102 // }, 3103 // "supportsTeamDrives": { 3104 // "default": "false", 3105 // "description": "Deprecated use supportsAllDrives instead.", 3106 // "location": "query", 3107 // "type": "boolean" 3108 // }, 3109 // "teamDriveId": { 3110 // "description": "Deprecated use driveId instead.", 3111 // "location": "query", 3112 // "type": "string" 3113 // } 3114 // }, 3115 // "path": "changes/startPageToken", 3116 // "response": { 3117 // "$ref": "StartPageToken" 3118 // }, 3119 // "scopes": [ 3120 // "https://www.googleapis.com/auth/drive", 3121 // "https://www.googleapis.com/auth/drive.appdata", 3122 // "https://www.googleapis.com/auth/drive.file", 3123 // "https://www.googleapis.com/auth/drive.metadata", 3124 // "https://www.googleapis.com/auth/drive.metadata.readonly", 3125 // "https://www.googleapis.com/auth/drive.photos.readonly", 3126 // "https://www.googleapis.com/auth/drive.readonly" 3127 // ] 3128 // } 3129 3130} 3131 3132// method id "drive.changes.list": 3133 3134type ChangesListCall struct { 3135 s *Service 3136 urlParams_ gensupport.URLParams 3137 ifNoneMatch_ string 3138 ctx_ context.Context 3139 header_ http.Header 3140} 3141 3142// List: Lists the changes for a user or shared drive. 3143func (r *ChangesService) List(pageToken string) *ChangesListCall { 3144 c := &ChangesListCall{s: r.s, urlParams_: make(gensupport.URLParams)} 3145 c.urlParams_.Set("pageToken", pageToken) 3146 return c 3147} 3148 3149// DriveId sets the optional parameter "driveId": The shared drive from 3150// which changes will be returned. If specified the change IDs will be 3151// reflective of the shared drive; use the combined drive ID and change 3152// ID as an identifier. 3153func (c *ChangesListCall) DriveId(driveId string) *ChangesListCall { 3154 c.urlParams_.Set("driveId", driveId) 3155 return c 3156} 3157 3158// IncludeCorpusRemovals sets the optional parameter 3159// "includeCorpusRemovals": Whether changes should include the file 3160// resource if the file is still accessible by the user at the time of 3161// the request, even when a file was removed from the list of changes 3162// and there will be no further change entries for this file. 3163func (c *ChangesListCall) IncludeCorpusRemovals(includeCorpusRemovals bool) *ChangesListCall { 3164 c.urlParams_.Set("includeCorpusRemovals", fmt.Sprint(includeCorpusRemovals)) 3165 return c 3166} 3167 3168// IncludeItemsFromAllDrives sets the optional parameter 3169// "includeItemsFromAllDrives": Deprecated - Whether both My Drive and 3170// shared drive items should be included in results. This parameter will 3171// only be effective until June 1, 2020. Afterwards shared drive items 3172// will be included in the results. 3173func (c *ChangesListCall) IncludeItemsFromAllDrives(includeItemsFromAllDrives bool) *ChangesListCall { 3174 c.urlParams_.Set("includeItemsFromAllDrives", fmt.Sprint(includeItemsFromAllDrives)) 3175 return c 3176} 3177 3178// IncludeRemoved sets the optional parameter "includeRemoved": Whether 3179// to include changes indicating that items have been removed from the 3180// list of changes, for example by deletion or loss of access. 3181func (c *ChangesListCall) IncludeRemoved(includeRemoved bool) *ChangesListCall { 3182 c.urlParams_.Set("includeRemoved", fmt.Sprint(includeRemoved)) 3183 return c 3184} 3185 3186// IncludeTeamDriveItems sets the optional parameter 3187// "includeTeamDriveItems": Deprecated use includeItemsFromAllDrives 3188// instead. 3189func (c *ChangesListCall) IncludeTeamDriveItems(includeTeamDriveItems bool) *ChangesListCall { 3190 c.urlParams_.Set("includeTeamDriveItems", fmt.Sprint(includeTeamDriveItems)) 3191 return c 3192} 3193 3194// PageSize sets the optional parameter "pageSize": The maximum number 3195// of changes to return per page. 3196func (c *ChangesListCall) PageSize(pageSize int64) *ChangesListCall { 3197 c.urlParams_.Set("pageSize", fmt.Sprint(pageSize)) 3198 return c 3199} 3200 3201// RestrictToMyDrive sets the optional parameter "restrictToMyDrive": 3202// Whether to restrict the results to changes inside the My Drive 3203// hierarchy. This omits changes to files such as those in the 3204// Application Data folder or shared files which have not been added to 3205// My Drive. 3206func (c *ChangesListCall) RestrictToMyDrive(restrictToMyDrive bool) *ChangesListCall { 3207 c.urlParams_.Set("restrictToMyDrive", fmt.Sprint(restrictToMyDrive)) 3208 return c 3209} 3210 3211// Spaces sets the optional parameter "spaces": A comma-separated list 3212// of spaces to query within the user corpus. Supported values are 3213// 'drive', 'appDataFolder' and 'photos'. 3214func (c *ChangesListCall) Spaces(spaces string) *ChangesListCall { 3215 c.urlParams_.Set("spaces", spaces) 3216 return c 3217} 3218 3219// SupportsAllDrives sets the optional parameter "supportsAllDrives": 3220// Deprecated - Whether the requesting application supports both My 3221// Drives and shared drives. This parameter will only be effective until 3222// June 1, 2020. Afterwards all applications are assumed to support 3223// shared drives. 3224func (c *ChangesListCall) SupportsAllDrives(supportsAllDrives bool) *ChangesListCall { 3225 c.urlParams_.Set("supportsAllDrives", fmt.Sprint(supportsAllDrives)) 3226 return c 3227} 3228 3229// SupportsTeamDrives sets the optional parameter "supportsTeamDrives": 3230// Deprecated use supportsAllDrives instead. 3231func (c *ChangesListCall) SupportsTeamDrives(supportsTeamDrives bool) *ChangesListCall { 3232 c.urlParams_.Set("supportsTeamDrives", fmt.Sprint(supportsTeamDrives)) 3233 return c 3234} 3235 3236// TeamDriveId sets the optional parameter "teamDriveId": Deprecated use 3237// driveId instead. 3238func (c *ChangesListCall) TeamDriveId(teamDriveId string) *ChangesListCall { 3239 c.urlParams_.Set("teamDriveId", teamDriveId) 3240 return c 3241} 3242 3243// Fields allows partial responses to be retrieved. See 3244// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 3245// for more information. 3246func (c *ChangesListCall) Fields(s ...googleapi.Field) *ChangesListCall { 3247 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 3248 return c 3249} 3250 3251// IfNoneMatch sets the optional parameter which makes the operation 3252// fail if the object's ETag matches the given value. This is useful for 3253// getting updates only after the object has changed since the last 3254// request. Use googleapi.IsNotModified to check whether the response 3255// error from Do is the result of In-None-Match. 3256func (c *ChangesListCall) IfNoneMatch(entityTag string) *ChangesListCall { 3257 c.ifNoneMatch_ = entityTag 3258 return c 3259} 3260 3261// Context sets the context to be used in this call's Do method. Any 3262// pending HTTP request will be aborted if the provided context is 3263// canceled. 3264func (c *ChangesListCall) Context(ctx context.Context) *ChangesListCall { 3265 c.ctx_ = ctx 3266 return c 3267} 3268 3269// Header returns an http.Header that can be modified by the caller to 3270// add HTTP headers to the request. 3271func (c *ChangesListCall) Header() http.Header { 3272 if c.header_ == nil { 3273 c.header_ = make(http.Header) 3274 } 3275 return c.header_ 3276} 3277 3278func (c *ChangesListCall) doRequest(alt string) (*http.Response, error) { 3279 reqHeaders := make(http.Header) 3280 for k, v := range c.header_ { 3281 reqHeaders[k] = v 3282 } 3283 reqHeaders.Set("User-Agent", c.s.userAgent()) 3284 if c.ifNoneMatch_ != "" { 3285 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 3286 } 3287 var body io.Reader = nil 3288 c.urlParams_.Set("alt", alt) 3289 c.urlParams_.Set("prettyPrint", "false") 3290 urls := googleapi.ResolveRelative(c.s.BasePath, "changes") 3291 urls += "?" + c.urlParams_.Encode() 3292 req, err := http.NewRequest("GET", urls, body) 3293 if err != nil { 3294 return nil, err 3295 } 3296 req.Header = reqHeaders 3297 return gensupport.SendRequest(c.ctx_, c.s.client, req) 3298} 3299 3300// Do executes the "drive.changes.list" call. 3301// Exactly one of *ChangeList or error will be non-nil. Any non-2xx 3302// status code is an error. Response headers are in either 3303// *ChangeList.ServerResponse.Header or (if a response was returned at 3304// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 3305// to check whether the returned error was because 3306// http.StatusNotModified was returned. 3307func (c *ChangesListCall) Do(opts ...googleapi.CallOption) (*ChangeList, error) { 3308 gensupport.SetOptions(c.urlParams_, opts...) 3309 res, err := c.doRequest("json") 3310 if res != nil && res.StatusCode == http.StatusNotModified { 3311 if res.Body != nil { 3312 res.Body.Close() 3313 } 3314 return nil, &googleapi.Error{ 3315 Code: res.StatusCode, 3316 Header: res.Header, 3317 } 3318 } 3319 if err != nil { 3320 return nil, err 3321 } 3322 defer googleapi.CloseBody(res) 3323 if err := googleapi.CheckResponse(res); err != nil { 3324 return nil, err 3325 } 3326 ret := &ChangeList{ 3327 ServerResponse: googleapi.ServerResponse{ 3328 Header: res.Header, 3329 HTTPStatusCode: res.StatusCode, 3330 }, 3331 } 3332 target := &ret 3333 if err := gensupport.DecodeResponse(target, res); err != nil { 3334 return nil, err 3335 } 3336 return ret, nil 3337 // { 3338 // "description": "Lists the changes for a user or shared drive.", 3339 // "httpMethod": "GET", 3340 // "id": "drive.changes.list", 3341 // "parameterOrder": [ 3342 // "pageToken" 3343 // ], 3344 // "parameters": { 3345 // "driveId": { 3346 // "description": "The shared drive from which changes will be returned. If specified the change IDs will be reflective of the shared drive; use the combined drive ID and change ID as an identifier.", 3347 // "location": "query", 3348 // "type": "string" 3349 // }, 3350 // "includeCorpusRemovals": { 3351 // "default": "false", 3352 // "description": "Whether changes should include the file resource if the file is still accessible by the user at the time of the request, even when a file was removed from the list of changes and there will be no further change entries for this file.", 3353 // "location": "query", 3354 // "type": "boolean" 3355 // }, 3356 // "includeItemsFromAllDrives": { 3357 // "default": "false", 3358 // "description": "Deprecated - Whether both My Drive and shared drive items should be included in results. This parameter will only be effective until June 1, 2020. Afterwards shared drive items will be included in the results.", 3359 // "location": "query", 3360 // "type": "boolean" 3361 // }, 3362 // "includeRemoved": { 3363 // "default": "true", 3364 // "description": "Whether to include changes indicating that items have been removed from the list of changes, for example by deletion or loss of access.", 3365 // "location": "query", 3366 // "type": "boolean" 3367 // }, 3368 // "includeTeamDriveItems": { 3369 // "default": "false", 3370 // "description": "Deprecated use includeItemsFromAllDrives instead.", 3371 // "location": "query", 3372 // "type": "boolean" 3373 // }, 3374 // "pageSize": { 3375 // "default": "100", 3376 // "description": "The maximum number of changes to return per page.", 3377 // "format": "int32", 3378 // "location": "query", 3379 // "maximum": "1000", 3380 // "minimum": "1", 3381 // "type": "integer" 3382 // }, 3383 // "pageToken": { 3384 // "description": "The token for continuing a previous list request on the next page. This should be set to the value of 'nextPageToken' from the previous response or to the response from the getStartPageToken method.", 3385 // "location": "query", 3386 // "required": true, 3387 // "type": "string" 3388 // }, 3389 // "restrictToMyDrive": { 3390 // "default": "false", 3391 // "description": "Whether to restrict the results to changes inside the My Drive hierarchy. This omits changes to files such as those in the Application Data folder or shared files which have not been added to My Drive.", 3392 // "location": "query", 3393 // "type": "boolean" 3394 // }, 3395 // "spaces": { 3396 // "default": "drive", 3397 // "description": "A comma-separated list of spaces to query within the user corpus. Supported values are 'drive', 'appDataFolder' and 'photos'.", 3398 // "location": "query", 3399 // "type": "string" 3400 // }, 3401 // "supportsAllDrives": { 3402 // "default": "false", 3403 // "description": "Deprecated - Whether the requesting application supports both My Drives and shared drives. This parameter will only be effective until June 1, 2020. Afterwards all applications are assumed to support shared drives.", 3404 // "location": "query", 3405 // "type": "boolean" 3406 // }, 3407 // "supportsTeamDrives": { 3408 // "default": "false", 3409 // "description": "Deprecated use supportsAllDrives instead.", 3410 // "location": "query", 3411 // "type": "boolean" 3412 // }, 3413 // "teamDriveId": { 3414 // "description": "Deprecated use driveId instead.", 3415 // "location": "query", 3416 // "type": "string" 3417 // } 3418 // }, 3419 // "path": "changes", 3420 // "response": { 3421 // "$ref": "ChangeList" 3422 // }, 3423 // "scopes": [ 3424 // "https://www.googleapis.com/auth/drive", 3425 // "https://www.googleapis.com/auth/drive.appdata", 3426 // "https://www.googleapis.com/auth/drive.file", 3427 // "https://www.googleapis.com/auth/drive.metadata", 3428 // "https://www.googleapis.com/auth/drive.metadata.readonly", 3429 // "https://www.googleapis.com/auth/drive.photos.readonly", 3430 // "https://www.googleapis.com/auth/drive.readonly" 3431 // ], 3432 // "supportsSubscription": true 3433 // } 3434 3435} 3436 3437// method id "drive.changes.watch": 3438 3439type ChangesWatchCall struct { 3440 s *Service 3441 channel *Channel 3442 urlParams_ gensupport.URLParams 3443 ctx_ context.Context 3444 header_ http.Header 3445} 3446 3447// Watch: Subscribes to changes for a user. 3448func (r *ChangesService) Watch(pageToken string, channel *Channel) *ChangesWatchCall { 3449 c := &ChangesWatchCall{s: r.s, urlParams_: make(gensupport.URLParams)} 3450 c.urlParams_.Set("pageToken", pageToken) 3451 c.channel = channel 3452 return c 3453} 3454 3455// DriveId sets the optional parameter "driveId": The shared drive from 3456// which changes will be returned. If specified the change IDs will be 3457// reflective of the shared drive; use the combined drive ID and change 3458// ID as an identifier. 3459func (c *ChangesWatchCall) DriveId(driveId string) *ChangesWatchCall { 3460 c.urlParams_.Set("driveId", driveId) 3461 return c 3462} 3463 3464// IncludeCorpusRemovals sets the optional parameter 3465// "includeCorpusRemovals": Whether changes should include the file 3466// resource if the file is still accessible by the user at the time of 3467// the request, even when a file was removed from the list of changes 3468// and there will be no further change entries for this file. 3469func (c *ChangesWatchCall) IncludeCorpusRemovals(includeCorpusRemovals bool) *ChangesWatchCall { 3470 c.urlParams_.Set("includeCorpusRemovals", fmt.Sprint(includeCorpusRemovals)) 3471 return c 3472} 3473 3474// IncludeItemsFromAllDrives sets the optional parameter 3475// "includeItemsFromAllDrives": Deprecated - Whether both My Drive and 3476// shared drive items should be included in results. This parameter will 3477// only be effective until June 1, 2020. Afterwards shared drive items 3478// will be included in the results. 3479func (c *ChangesWatchCall) IncludeItemsFromAllDrives(includeItemsFromAllDrives bool) *ChangesWatchCall { 3480 c.urlParams_.Set("includeItemsFromAllDrives", fmt.Sprint(includeItemsFromAllDrives)) 3481 return c 3482} 3483 3484// IncludeRemoved sets the optional parameter "includeRemoved": Whether 3485// to include changes indicating that items have been removed from the 3486// list of changes, for example by deletion or loss of access. 3487func (c *ChangesWatchCall) IncludeRemoved(includeRemoved bool) *ChangesWatchCall { 3488 c.urlParams_.Set("includeRemoved", fmt.Sprint(includeRemoved)) 3489 return c 3490} 3491 3492// IncludeTeamDriveItems sets the optional parameter 3493// "includeTeamDriveItems": Deprecated use includeItemsFromAllDrives 3494// instead. 3495func (c *ChangesWatchCall) IncludeTeamDriveItems(includeTeamDriveItems bool) *ChangesWatchCall { 3496 c.urlParams_.Set("includeTeamDriveItems", fmt.Sprint(includeTeamDriveItems)) 3497 return c 3498} 3499 3500// PageSize sets the optional parameter "pageSize": The maximum number 3501// of changes to return per page. 3502func (c *ChangesWatchCall) PageSize(pageSize int64) *ChangesWatchCall { 3503 c.urlParams_.Set("pageSize", fmt.Sprint(pageSize)) 3504 return c 3505} 3506 3507// RestrictToMyDrive sets the optional parameter "restrictToMyDrive": 3508// Whether to restrict the results to changes inside the My Drive 3509// hierarchy. This omits changes to files such as those in the 3510// Application Data folder or shared files which have not been added to 3511// My Drive. 3512func (c *ChangesWatchCall) RestrictToMyDrive(restrictToMyDrive bool) *ChangesWatchCall { 3513 c.urlParams_.Set("restrictToMyDrive", fmt.Sprint(restrictToMyDrive)) 3514 return c 3515} 3516 3517// Spaces sets the optional parameter "spaces": A comma-separated list 3518// of spaces to query within the user corpus. Supported values are 3519// 'drive', 'appDataFolder' and 'photos'. 3520func (c *ChangesWatchCall) Spaces(spaces string) *ChangesWatchCall { 3521 c.urlParams_.Set("spaces", spaces) 3522 return c 3523} 3524 3525// SupportsAllDrives sets the optional parameter "supportsAllDrives": 3526// Deprecated - Whether the requesting application supports both My 3527// Drives and shared drives. This parameter will only be effective until 3528// June 1, 2020. Afterwards all applications are assumed to support 3529// shared drives. 3530func (c *ChangesWatchCall) SupportsAllDrives(supportsAllDrives bool) *ChangesWatchCall { 3531 c.urlParams_.Set("supportsAllDrives", fmt.Sprint(supportsAllDrives)) 3532 return c 3533} 3534 3535// SupportsTeamDrives sets the optional parameter "supportsTeamDrives": 3536// Deprecated use supportsAllDrives instead. 3537func (c *ChangesWatchCall) SupportsTeamDrives(supportsTeamDrives bool) *ChangesWatchCall { 3538 c.urlParams_.Set("supportsTeamDrives", fmt.Sprint(supportsTeamDrives)) 3539 return c 3540} 3541 3542// TeamDriveId sets the optional parameter "teamDriveId": Deprecated use 3543// driveId instead. 3544func (c *ChangesWatchCall) TeamDriveId(teamDriveId string) *ChangesWatchCall { 3545 c.urlParams_.Set("teamDriveId", teamDriveId) 3546 return c 3547} 3548 3549// Fields allows partial responses to be retrieved. See 3550// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 3551// for more information. 3552func (c *ChangesWatchCall) Fields(s ...googleapi.Field) *ChangesWatchCall { 3553 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 3554 return c 3555} 3556 3557// Context sets the context to be used in this call's Do method. Any 3558// pending HTTP request will be aborted if the provided context is 3559// canceled. 3560func (c *ChangesWatchCall) Context(ctx context.Context) *ChangesWatchCall { 3561 c.ctx_ = ctx 3562 return c 3563} 3564 3565// Header returns an http.Header that can be modified by the caller to 3566// add HTTP headers to the request. 3567func (c *ChangesWatchCall) Header() http.Header { 3568 if c.header_ == nil { 3569 c.header_ = make(http.Header) 3570 } 3571 return c.header_ 3572} 3573 3574func (c *ChangesWatchCall) doRequest(alt string) (*http.Response, error) { 3575 reqHeaders := make(http.Header) 3576 for k, v := range c.header_ { 3577 reqHeaders[k] = v 3578 } 3579 reqHeaders.Set("User-Agent", c.s.userAgent()) 3580 var body io.Reader = nil 3581 body, err := googleapi.WithoutDataWrapper.JSONReader(c.channel) 3582 if err != nil { 3583 return nil, err 3584 } 3585 reqHeaders.Set("Content-Type", "application/json") 3586 c.urlParams_.Set("alt", alt) 3587 c.urlParams_.Set("prettyPrint", "false") 3588 urls := googleapi.ResolveRelative(c.s.BasePath, "changes/watch") 3589 urls += "?" + c.urlParams_.Encode() 3590 req, err := http.NewRequest("POST", urls, body) 3591 if err != nil { 3592 return nil, err 3593 } 3594 req.Header = reqHeaders 3595 return gensupport.SendRequest(c.ctx_, c.s.client, req) 3596} 3597 3598// Do executes the "drive.changes.watch" call. 3599// Exactly one of *Channel or error will be non-nil. Any non-2xx status 3600// code is an error. Response headers are in either 3601// *Channel.ServerResponse.Header or (if a response was returned at all) 3602// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 3603// check whether the returned error was because http.StatusNotModified 3604// was returned. 3605func (c *ChangesWatchCall) Do(opts ...googleapi.CallOption) (*Channel, error) { 3606 gensupport.SetOptions(c.urlParams_, opts...) 3607 res, err := c.doRequest("json") 3608 if res != nil && res.StatusCode == http.StatusNotModified { 3609 if res.Body != nil { 3610 res.Body.Close() 3611 } 3612 return nil, &googleapi.Error{ 3613 Code: res.StatusCode, 3614 Header: res.Header, 3615 } 3616 } 3617 if err != nil { 3618 return nil, err 3619 } 3620 defer googleapi.CloseBody(res) 3621 if err := googleapi.CheckResponse(res); err != nil { 3622 return nil, err 3623 } 3624 ret := &Channel{ 3625 ServerResponse: googleapi.ServerResponse{ 3626 Header: res.Header, 3627 HTTPStatusCode: res.StatusCode, 3628 }, 3629 } 3630 target := &ret 3631 if err := gensupport.DecodeResponse(target, res); err != nil { 3632 return nil, err 3633 } 3634 return ret, nil 3635 // { 3636 // "description": "Subscribes to changes for a user.", 3637 // "httpMethod": "POST", 3638 // "id": "drive.changes.watch", 3639 // "parameterOrder": [ 3640 // "pageToken" 3641 // ], 3642 // "parameters": { 3643 // "driveId": { 3644 // "description": "The shared drive from which changes will be returned. If specified the change IDs will be reflective of the shared drive; use the combined drive ID and change ID as an identifier.", 3645 // "location": "query", 3646 // "type": "string" 3647 // }, 3648 // "includeCorpusRemovals": { 3649 // "default": "false", 3650 // "description": "Whether changes should include the file resource if the file is still accessible by the user at the time of the request, even when a file was removed from the list of changes and there will be no further change entries for this file.", 3651 // "location": "query", 3652 // "type": "boolean" 3653 // }, 3654 // "includeItemsFromAllDrives": { 3655 // "default": "false", 3656 // "description": "Deprecated - Whether both My Drive and shared drive items should be included in results. This parameter will only be effective until June 1, 2020. Afterwards shared drive items will be included in the results.", 3657 // "location": "query", 3658 // "type": "boolean" 3659 // }, 3660 // "includeRemoved": { 3661 // "default": "true", 3662 // "description": "Whether to include changes indicating that items have been removed from the list of changes, for example by deletion or loss of access.", 3663 // "location": "query", 3664 // "type": "boolean" 3665 // }, 3666 // "includeTeamDriveItems": { 3667 // "default": "false", 3668 // "description": "Deprecated use includeItemsFromAllDrives instead.", 3669 // "location": "query", 3670 // "type": "boolean" 3671 // }, 3672 // "pageSize": { 3673 // "default": "100", 3674 // "description": "The maximum number of changes to return per page.", 3675 // "format": "int32", 3676 // "location": "query", 3677 // "maximum": "1000", 3678 // "minimum": "1", 3679 // "type": "integer" 3680 // }, 3681 // "pageToken": { 3682 // "description": "The token for continuing a previous list request on the next page. This should be set to the value of 'nextPageToken' from the previous response or to the response from the getStartPageToken method.", 3683 // "location": "query", 3684 // "required": true, 3685 // "type": "string" 3686 // }, 3687 // "restrictToMyDrive": { 3688 // "default": "false", 3689 // "description": "Whether to restrict the results to changes inside the My Drive hierarchy. This omits changes to files such as those in the Application Data folder or shared files which have not been added to My Drive.", 3690 // "location": "query", 3691 // "type": "boolean" 3692 // }, 3693 // "spaces": { 3694 // "default": "drive", 3695 // "description": "A comma-separated list of spaces to query within the user corpus. Supported values are 'drive', 'appDataFolder' and 'photos'.", 3696 // "location": "query", 3697 // "type": "string" 3698 // }, 3699 // "supportsAllDrives": { 3700 // "default": "false", 3701 // "description": "Deprecated - Whether the requesting application supports both My Drives and shared drives. This parameter will only be effective until June 1, 2020. Afterwards all applications are assumed to support shared drives.", 3702 // "location": "query", 3703 // "type": "boolean" 3704 // }, 3705 // "supportsTeamDrives": { 3706 // "default": "false", 3707 // "description": "Deprecated use supportsAllDrives instead.", 3708 // "location": "query", 3709 // "type": "boolean" 3710 // }, 3711 // "teamDriveId": { 3712 // "description": "Deprecated use driveId instead.", 3713 // "location": "query", 3714 // "type": "string" 3715 // } 3716 // }, 3717 // "path": "changes/watch", 3718 // "request": { 3719 // "$ref": "Channel", 3720 // "parameterName": "resource" 3721 // }, 3722 // "response": { 3723 // "$ref": "Channel" 3724 // }, 3725 // "scopes": [ 3726 // "https://www.googleapis.com/auth/drive", 3727 // "https://www.googleapis.com/auth/drive.appdata", 3728 // "https://www.googleapis.com/auth/drive.file", 3729 // "https://www.googleapis.com/auth/drive.metadata", 3730 // "https://www.googleapis.com/auth/drive.metadata.readonly", 3731 // "https://www.googleapis.com/auth/drive.photos.readonly", 3732 // "https://www.googleapis.com/auth/drive.readonly" 3733 // ], 3734 // "supportsSubscription": true 3735 // } 3736 3737} 3738 3739// method id "drive.channels.stop": 3740 3741type ChannelsStopCall struct { 3742 s *Service 3743 channel *Channel 3744 urlParams_ gensupport.URLParams 3745 ctx_ context.Context 3746 header_ http.Header 3747} 3748 3749// Stop: Stop watching resources through this channel 3750func (r *ChannelsService) Stop(channel *Channel) *ChannelsStopCall { 3751 c := &ChannelsStopCall{s: r.s, urlParams_: make(gensupport.URLParams)} 3752 c.channel = channel 3753 return c 3754} 3755 3756// Fields allows partial responses to be retrieved. See 3757// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 3758// for more information. 3759func (c *ChannelsStopCall) Fields(s ...googleapi.Field) *ChannelsStopCall { 3760 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 3761 return c 3762} 3763 3764// Context sets the context to be used in this call's Do method. Any 3765// pending HTTP request will be aborted if the provided context is 3766// canceled. 3767func (c *ChannelsStopCall) Context(ctx context.Context) *ChannelsStopCall { 3768 c.ctx_ = ctx 3769 return c 3770} 3771 3772// Header returns an http.Header that can be modified by the caller to 3773// add HTTP headers to the request. 3774func (c *ChannelsStopCall) Header() http.Header { 3775 if c.header_ == nil { 3776 c.header_ = make(http.Header) 3777 } 3778 return c.header_ 3779} 3780 3781func (c *ChannelsStopCall) doRequest(alt string) (*http.Response, error) { 3782 reqHeaders := make(http.Header) 3783 for k, v := range c.header_ { 3784 reqHeaders[k] = v 3785 } 3786 reqHeaders.Set("User-Agent", c.s.userAgent()) 3787 var body io.Reader = nil 3788 body, err := googleapi.WithoutDataWrapper.JSONReader(c.channel) 3789 if err != nil { 3790 return nil, err 3791 } 3792 reqHeaders.Set("Content-Type", "application/json") 3793 c.urlParams_.Set("alt", alt) 3794 c.urlParams_.Set("prettyPrint", "false") 3795 urls := googleapi.ResolveRelative(c.s.BasePath, "channels/stop") 3796 urls += "?" + c.urlParams_.Encode() 3797 req, err := http.NewRequest("POST", urls, body) 3798 if err != nil { 3799 return nil, err 3800 } 3801 req.Header = reqHeaders 3802 return gensupport.SendRequest(c.ctx_, c.s.client, req) 3803} 3804 3805// Do executes the "drive.channels.stop" call. 3806func (c *ChannelsStopCall) Do(opts ...googleapi.CallOption) error { 3807 gensupport.SetOptions(c.urlParams_, opts...) 3808 res, err := c.doRequest("json") 3809 if err != nil { 3810 return err 3811 } 3812 defer googleapi.CloseBody(res) 3813 if err := googleapi.CheckResponse(res); err != nil { 3814 return err 3815 } 3816 return nil 3817 // { 3818 // "description": "Stop watching resources through this channel", 3819 // "httpMethod": "POST", 3820 // "id": "drive.channels.stop", 3821 // "path": "channels/stop", 3822 // "request": { 3823 // "$ref": "Channel", 3824 // "parameterName": "resource" 3825 // }, 3826 // "scopes": [ 3827 // "https://www.googleapis.com/auth/drive", 3828 // "https://www.googleapis.com/auth/drive.appdata", 3829 // "https://www.googleapis.com/auth/drive.file", 3830 // "https://www.googleapis.com/auth/drive.metadata", 3831 // "https://www.googleapis.com/auth/drive.metadata.readonly", 3832 // "https://www.googleapis.com/auth/drive.photos.readonly", 3833 // "https://www.googleapis.com/auth/drive.readonly" 3834 // ] 3835 // } 3836 3837} 3838 3839// method id "drive.comments.create": 3840 3841type CommentsCreateCall struct { 3842 s *Service 3843 fileId string 3844 comment *Comment 3845 urlParams_ gensupport.URLParams 3846 ctx_ context.Context 3847 header_ http.Header 3848} 3849 3850// Create: Creates a new comment on a file. 3851func (r *CommentsService) Create(fileId string, comment *Comment) *CommentsCreateCall { 3852 c := &CommentsCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)} 3853 c.fileId = fileId 3854 c.comment = comment 3855 return c 3856} 3857 3858// Fields allows partial responses to be retrieved. See 3859// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 3860// for more information. 3861func (c *CommentsCreateCall) Fields(s ...googleapi.Field) *CommentsCreateCall { 3862 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 3863 return c 3864} 3865 3866// Context sets the context to be used in this call's Do method. Any 3867// pending HTTP request will be aborted if the provided context is 3868// canceled. 3869func (c *CommentsCreateCall) Context(ctx context.Context) *CommentsCreateCall { 3870 c.ctx_ = ctx 3871 return c 3872} 3873 3874// Header returns an http.Header that can be modified by the caller to 3875// add HTTP headers to the request. 3876func (c *CommentsCreateCall) Header() http.Header { 3877 if c.header_ == nil { 3878 c.header_ = make(http.Header) 3879 } 3880 return c.header_ 3881} 3882 3883func (c *CommentsCreateCall) doRequest(alt string) (*http.Response, error) { 3884 reqHeaders := make(http.Header) 3885 for k, v := range c.header_ { 3886 reqHeaders[k] = v 3887 } 3888 reqHeaders.Set("User-Agent", c.s.userAgent()) 3889 var body io.Reader = nil 3890 body, err := googleapi.WithoutDataWrapper.JSONReader(c.comment) 3891 if err != nil { 3892 return nil, err 3893 } 3894 reqHeaders.Set("Content-Type", "application/json") 3895 c.urlParams_.Set("alt", alt) 3896 c.urlParams_.Set("prettyPrint", "false") 3897 urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/comments") 3898 urls += "?" + c.urlParams_.Encode() 3899 req, err := http.NewRequest("POST", urls, body) 3900 if err != nil { 3901 return nil, err 3902 } 3903 req.Header = reqHeaders 3904 googleapi.Expand(req.URL, map[string]string{ 3905 "fileId": c.fileId, 3906 }) 3907 return gensupport.SendRequest(c.ctx_, c.s.client, req) 3908} 3909 3910// Do executes the "drive.comments.create" call. 3911// Exactly one of *Comment or error will be non-nil. Any non-2xx status 3912// code is an error. Response headers are in either 3913// *Comment.ServerResponse.Header or (if a response was returned at all) 3914// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 3915// check whether the returned error was because http.StatusNotModified 3916// was returned. 3917func (c *CommentsCreateCall) Do(opts ...googleapi.CallOption) (*Comment, error) { 3918 gensupport.SetOptions(c.urlParams_, opts...) 3919 res, err := c.doRequest("json") 3920 if res != nil && res.StatusCode == http.StatusNotModified { 3921 if res.Body != nil { 3922 res.Body.Close() 3923 } 3924 return nil, &googleapi.Error{ 3925 Code: res.StatusCode, 3926 Header: res.Header, 3927 } 3928 } 3929 if err != nil { 3930 return nil, err 3931 } 3932 defer googleapi.CloseBody(res) 3933 if err := googleapi.CheckResponse(res); err != nil { 3934 return nil, err 3935 } 3936 ret := &Comment{ 3937 ServerResponse: googleapi.ServerResponse{ 3938 Header: res.Header, 3939 HTTPStatusCode: res.StatusCode, 3940 }, 3941 } 3942 target := &ret 3943 if err := gensupport.DecodeResponse(target, res); err != nil { 3944 return nil, err 3945 } 3946 return ret, nil 3947 // { 3948 // "description": "Creates a new comment on a file.", 3949 // "httpMethod": "POST", 3950 // "id": "drive.comments.create", 3951 // "parameterOrder": [ 3952 // "fileId" 3953 // ], 3954 // "parameters": { 3955 // "fileId": { 3956 // "description": "The ID of the file.", 3957 // "location": "path", 3958 // "required": true, 3959 // "type": "string" 3960 // } 3961 // }, 3962 // "path": "files/{fileId}/comments", 3963 // "request": { 3964 // "$ref": "Comment" 3965 // }, 3966 // "response": { 3967 // "$ref": "Comment" 3968 // }, 3969 // "scopes": [ 3970 // "https://www.googleapis.com/auth/drive", 3971 // "https://www.googleapis.com/auth/drive.file" 3972 // ] 3973 // } 3974 3975} 3976 3977// method id "drive.comments.delete": 3978 3979type CommentsDeleteCall struct { 3980 s *Service 3981 fileId string 3982 commentId string 3983 urlParams_ gensupport.URLParams 3984 ctx_ context.Context 3985 header_ http.Header 3986} 3987 3988// Delete: Deletes a comment. 3989func (r *CommentsService) Delete(fileId string, commentId string) *CommentsDeleteCall { 3990 c := &CommentsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)} 3991 c.fileId = fileId 3992 c.commentId = commentId 3993 return c 3994} 3995 3996// Fields allows partial responses to be retrieved. See 3997// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 3998// for more information. 3999func (c *CommentsDeleteCall) Fields(s ...googleapi.Field) *CommentsDeleteCall { 4000 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 4001 return c 4002} 4003 4004// Context sets the context to be used in this call's Do method. Any 4005// pending HTTP request will be aborted if the provided context is 4006// canceled. 4007func (c *CommentsDeleteCall) Context(ctx context.Context) *CommentsDeleteCall { 4008 c.ctx_ = ctx 4009 return c 4010} 4011 4012// Header returns an http.Header that can be modified by the caller to 4013// add HTTP headers to the request. 4014func (c *CommentsDeleteCall) Header() http.Header { 4015 if c.header_ == nil { 4016 c.header_ = make(http.Header) 4017 } 4018 return c.header_ 4019} 4020 4021func (c *CommentsDeleteCall) doRequest(alt string) (*http.Response, error) { 4022 reqHeaders := make(http.Header) 4023 for k, v := range c.header_ { 4024 reqHeaders[k] = v 4025 } 4026 reqHeaders.Set("User-Agent", c.s.userAgent()) 4027 var body io.Reader = nil 4028 c.urlParams_.Set("alt", alt) 4029 c.urlParams_.Set("prettyPrint", "false") 4030 urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/comments/{commentId}") 4031 urls += "?" + c.urlParams_.Encode() 4032 req, err := http.NewRequest("DELETE", urls, body) 4033 if err != nil { 4034 return nil, err 4035 } 4036 req.Header = reqHeaders 4037 googleapi.Expand(req.URL, map[string]string{ 4038 "fileId": c.fileId, 4039 "commentId": c.commentId, 4040 }) 4041 return gensupport.SendRequest(c.ctx_, c.s.client, req) 4042} 4043 4044// Do executes the "drive.comments.delete" call. 4045func (c *CommentsDeleteCall) Do(opts ...googleapi.CallOption) error { 4046 gensupport.SetOptions(c.urlParams_, opts...) 4047 res, err := c.doRequest("json") 4048 if err != nil { 4049 return err 4050 } 4051 defer googleapi.CloseBody(res) 4052 if err := googleapi.CheckResponse(res); err != nil { 4053 return err 4054 } 4055 return nil 4056 // { 4057 // "description": "Deletes a comment.", 4058 // "httpMethod": "DELETE", 4059 // "id": "drive.comments.delete", 4060 // "parameterOrder": [ 4061 // "fileId", 4062 // "commentId" 4063 // ], 4064 // "parameters": { 4065 // "commentId": { 4066 // "description": "The ID of the comment.", 4067 // "location": "path", 4068 // "required": true, 4069 // "type": "string" 4070 // }, 4071 // "fileId": { 4072 // "description": "The ID of the file.", 4073 // "location": "path", 4074 // "required": true, 4075 // "type": "string" 4076 // } 4077 // }, 4078 // "path": "files/{fileId}/comments/{commentId}", 4079 // "scopes": [ 4080 // "https://www.googleapis.com/auth/drive", 4081 // "https://www.googleapis.com/auth/drive.file" 4082 // ] 4083 // } 4084 4085} 4086 4087// method id "drive.comments.get": 4088 4089type CommentsGetCall struct { 4090 s *Service 4091 fileId string 4092 commentId string 4093 urlParams_ gensupport.URLParams 4094 ifNoneMatch_ string 4095 ctx_ context.Context 4096 header_ http.Header 4097} 4098 4099// Get: Gets a comment by ID. 4100func (r *CommentsService) Get(fileId string, commentId string) *CommentsGetCall { 4101 c := &CommentsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)} 4102 c.fileId = fileId 4103 c.commentId = commentId 4104 return c 4105} 4106 4107// IncludeDeleted sets the optional parameter "includeDeleted": Whether 4108// to return deleted comments. Deleted comments will not include their 4109// original content. 4110func (c *CommentsGetCall) IncludeDeleted(includeDeleted bool) *CommentsGetCall { 4111 c.urlParams_.Set("includeDeleted", fmt.Sprint(includeDeleted)) 4112 return c 4113} 4114 4115// Fields allows partial responses to be retrieved. See 4116// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 4117// for more information. 4118func (c *CommentsGetCall) Fields(s ...googleapi.Field) *CommentsGetCall { 4119 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 4120 return c 4121} 4122 4123// IfNoneMatch sets the optional parameter which makes the operation 4124// fail if the object's ETag matches the given value. This is useful for 4125// getting updates only after the object has changed since the last 4126// request. Use googleapi.IsNotModified to check whether the response 4127// error from Do is the result of In-None-Match. 4128func (c *CommentsGetCall) IfNoneMatch(entityTag string) *CommentsGetCall { 4129 c.ifNoneMatch_ = entityTag 4130 return c 4131} 4132 4133// Context sets the context to be used in this call's Do method. Any 4134// pending HTTP request will be aborted if the provided context is 4135// canceled. 4136func (c *CommentsGetCall) Context(ctx context.Context) *CommentsGetCall { 4137 c.ctx_ = ctx 4138 return c 4139} 4140 4141// Header returns an http.Header that can be modified by the caller to 4142// add HTTP headers to the request. 4143func (c *CommentsGetCall) Header() http.Header { 4144 if c.header_ == nil { 4145 c.header_ = make(http.Header) 4146 } 4147 return c.header_ 4148} 4149 4150func (c *CommentsGetCall) doRequest(alt string) (*http.Response, error) { 4151 reqHeaders := make(http.Header) 4152 for k, v := range c.header_ { 4153 reqHeaders[k] = v 4154 } 4155 reqHeaders.Set("User-Agent", c.s.userAgent()) 4156 if c.ifNoneMatch_ != "" { 4157 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 4158 } 4159 var body io.Reader = nil 4160 c.urlParams_.Set("alt", alt) 4161 c.urlParams_.Set("prettyPrint", "false") 4162 urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/comments/{commentId}") 4163 urls += "?" + c.urlParams_.Encode() 4164 req, err := http.NewRequest("GET", urls, body) 4165 if err != nil { 4166 return nil, err 4167 } 4168 req.Header = reqHeaders 4169 googleapi.Expand(req.URL, map[string]string{ 4170 "fileId": c.fileId, 4171 "commentId": c.commentId, 4172 }) 4173 return gensupport.SendRequest(c.ctx_, c.s.client, req) 4174} 4175 4176// Do executes the "drive.comments.get" call. 4177// Exactly one of *Comment or error will be non-nil. Any non-2xx status 4178// code is an error. Response headers are in either 4179// *Comment.ServerResponse.Header or (if a response was returned at all) 4180// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 4181// check whether the returned error was because http.StatusNotModified 4182// was returned. 4183func (c *CommentsGetCall) Do(opts ...googleapi.CallOption) (*Comment, error) { 4184 gensupport.SetOptions(c.urlParams_, opts...) 4185 res, err := c.doRequest("json") 4186 if res != nil && res.StatusCode == http.StatusNotModified { 4187 if res.Body != nil { 4188 res.Body.Close() 4189 } 4190 return nil, &googleapi.Error{ 4191 Code: res.StatusCode, 4192 Header: res.Header, 4193 } 4194 } 4195 if err != nil { 4196 return nil, err 4197 } 4198 defer googleapi.CloseBody(res) 4199 if err := googleapi.CheckResponse(res); err != nil { 4200 return nil, err 4201 } 4202 ret := &Comment{ 4203 ServerResponse: googleapi.ServerResponse{ 4204 Header: res.Header, 4205 HTTPStatusCode: res.StatusCode, 4206 }, 4207 } 4208 target := &ret 4209 if err := gensupport.DecodeResponse(target, res); err != nil { 4210 return nil, err 4211 } 4212 return ret, nil 4213 // { 4214 // "description": "Gets a comment by ID.", 4215 // "httpMethod": "GET", 4216 // "id": "drive.comments.get", 4217 // "parameterOrder": [ 4218 // "fileId", 4219 // "commentId" 4220 // ], 4221 // "parameters": { 4222 // "commentId": { 4223 // "description": "The ID of the comment.", 4224 // "location": "path", 4225 // "required": true, 4226 // "type": "string" 4227 // }, 4228 // "fileId": { 4229 // "description": "The ID of the file.", 4230 // "location": "path", 4231 // "required": true, 4232 // "type": "string" 4233 // }, 4234 // "includeDeleted": { 4235 // "default": "false", 4236 // "description": "Whether to return deleted comments. Deleted comments will not include their original content.", 4237 // "location": "query", 4238 // "type": "boolean" 4239 // } 4240 // }, 4241 // "path": "files/{fileId}/comments/{commentId}", 4242 // "response": { 4243 // "$ref": "Comment" 4244 // }, 4245 // "scopes": [ 4246 // "https://www.googleapis.com/auth/drive", 4247 // "https://www.googleapis.com/auth/drive.file", 4248 // "https://www.googleapis.com/auth/drive.readonly" 4249 // ] 4250 // } 4251 4252} 4253 4254// method id "drive.comments.list": 4255 4256type CommentsListCall struct { 4257 s *Service 4258 fileId string 4259 urlParams_ gensupport.URLParams 4260 ifNoneMatch_ string 4261 ctx_ context.Context 4262 header_ http.Header 4263} 4264 4265// List: Lists a file's comments. 4266func (r *CommentsService) List(fileId string) *CommentsListCall { 4267 c := &CommentsListCall{s: r.s, urlParams_: make(gensupport.URLParams)} 4268 c.fileId = fileId 4269 return c 4270} 4271 4272// IncludeDeleted sets the optional parameter "includeDeleted": Whether 4273// to include deleted comments. Deleted comments will not include their 4274// original content. 4275func (c *CommentsListCall) IncludeDeleted(includeDeleted bool) *CommentsListCall { 4276 c.urlParams_.Set("includeDeleted", fmt.Sprint(includeDeleted)) 4277 return c 4278} 4279 4280// PageSize sets the optional parameter "pageSize": The maximum number 4281// of comments to return per page. 4282func (c *CommentsListCall) PageSize(pageSize int64) *CommentsListCall { 4283 c.urlParams_.Set("pageSize", fmt.Sprint(pageSize)) 4284 return c 4285} 4286 4287// PageToken sets the optional parameter "pageToken": The token for 4288// continuing a previous list request on the next page. This should be 4289// set to the value of 'nextPageToken' from the previous response. 4290func (c *CommentsListCall) PageToken(pageToken string) *CommentsListCall { 4291 c.urlParams_.Set("pageToken", pageToken) 4292 return c 4293} 4294 4295// StartModifiedTime sets the optional parameter "startModifiedTime": 4296// The minimum value of 'modifiedTime' for the result comments (RFC 3339 4297// date-time). 4298func (c *CommentsListCall) StartModifiedTime(startModifiedTime string) *CommentsListCall { 4299 c.urlParams_.Set("startModifiedTime", startModifiedTime) 4300 return c 4301} 4302 4303// Fields allows partial responses to be retrieved. See 4304// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 4305// for more information. 4306func (c *CommentsListCall) Fields(s ...googleapi.Field) *CommentsListCall { 4307 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 4308 return c 4309} 4310 4311// IfNoneMatch sets the optional parameter which makes the operation 4312// fail if the object's ETag matches the given value. This is useful for 4313// getting updates only after the object has changed since the last 4314// request. Use googleapi.IsNotModified to check whether the response 4315// error from Do is the result of In-None-Match. 4316func (c *CommentsListCall) IfNoneMatch(entityTag string) *CommentsListCall { 4317 c.ifNoneMatch_ = entityTag 4318 return c 4319} 4320 4321// Context sets the context to be used in this call's Do method. Any 4322// pending HTTP request will be aborted if the provided context is 4323// canceled. 4324func (c *CommentsListCall) Context(ctx context.Context) *CommentsListCall { 4325 c.ctx_ = ctx 4326 return c 4327} 4328 4329// Header returns an http.Header that can be modified by the caller to 4330// add HTTP headers to the request. 4331func (c *CommentsListCall) Header() http.Header { 4332 if c.header_ == nil { 4333 c.header_ = make(http.Header) 4334 } 4335 return c.header_ 4336} 4337 4338func (c *CommentsListCall) doRequest(alt string) (*http.Response, error) { 4339 reqHeaders := make(http.Header) 4340 for k, v := range c.header_ { 4341 reqHeaders[k] = v 4342 } 4343 reqHeaders.Set("User-Agent", c.s.userAgent()) 4344 if c.ifNoneMatch_ != "" { 4345 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 4346 } 4347 var body io.Reader = nil 4348 c.urlParams_.Set("alt", alt) 4349 c.urlParams_.Set("prettyPrint", "false") 4350 urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/comments") 4351 urls += "?" + c.urlParams_.Encode() 4352 req, err := http.NewRequest("GET", urls, body) 4353 if err != nil { 4354 return nil, err 4355 } 4356 req.Header = reqHeaders 4357 googleapi.Expand(req.URL, map[string]string{ 4358 "fileId": c.fileId, 4359 }) 4360 return gensupport.SendRequest(c.ctx_, c.s.client, req) 4361} 4362 4363// Do executes the "drive.comments.list" call. 4364// Exactly one of *CommentList or error will be non-nil. Any non-2xx 4365// status code is an error. Response headers are in either 4366// *CommentList.ServerResponse.Header or (if a response was returned at 4367// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 4368// to check whether the returned error was because 4369// http.StatusNotModified was returned. 4370func (c *CommentsListCall) Do(opts ...googleapi.CallOption) (*CommentList, error) { 4371 gensupport.SetOptions(c.urlParams_, opts...) 4372 res, err := c.doRequest("json") 4373 if res != nil && res.StatusCode == http.StatusNotModified { 4374 if res.Body != nil { 4375 res.Body.Close() 4376 } 4377 return nil, &googleapi.Error{ 4378 Code: res.StatusCode, 4379 Header: res.Header, 4380 } 4381 } 4382 if err != nil { 4383 return nil, err 4384 } 4385 defer googleapi.CloseBody(res) 4386 if err := googleapi.CheckResponse(res); err != nil { 4387 return nil, err 4388 } 4389 ret := &CommentList{ 4390 ServerResponse: googleapi.ServerResponse{ 4391 Header: res.Header, 4392 HTTPStatusCode: res.StatusCode, 4393 }, 4394 } 4395 target := &ret 4396 if err := gensupport.DecodeResponse(target, res); err != nil { 4397 return nil, err 4398 } 4399 return ret, nil 4400 // { 4401 // "description": "Lists a file's comments.", 4402 // "httpMethod": "GET", 4403 // "id": "drive.comments.list", 4404 // "parameterOrder": [ 4405 // "fileId" 4406 // ], 4407 // "parameters": { 4408 // "fileId": { 4409 // "description": "The ID of the file.", 4410 // "location": "path", 4411 // "required": true, 4412 // "type": "string" 4413 // }, 4414 // "includeDeleted": { 4415 // "default": "false", 4416 // "description": "Whether to include deleted comments. Deleted comments will not include their original content.", 4417 // "location": "query", 4418 // "type": "boolean" 4419 // }, 4420 // "pageSize": { 4421 // "default": "20", 4422 // "description": "The maximum number of comments to return per page.", 4423 // "format": "int32", 4424 // "location": "query", 4425 // "maximum": "100", 4426 // "minimum": "1", 4427 // "type": "integer" 4428 // }, 4429 // "pageToken": { 4430 // "description": "The token for continuing a previous list request on the next page. This should be set to the value of 'nextPageToken' from the previous response.", 4431 // "location": "query", 4432 // "type": "string" 4433 // }, 4434 // "startModifiedTime": { 4435 // "description": "The minimum value of 'modifiedTime' for the result comments (RFC 3339 date-time).", 4436 // "location": "query", 4437 // "type": "string" 4438 // } 4439 // }, 4440 // "path": "files/{fileId}/comments", 4441 // "response": { 4442 // "$ref": "CommentList" 4443 // }, 4444 // "scopes": [ 4445 // "https://www.googleapis.com/auth/drive", 4446 // "https://www.googleapis.com/auth/drive.file", 4447 // "https://www.googleapis.com/auth/drive.readonly" 4448 // ] 4449 // } 4450 4451} 4452 4453// Pages invokes f for each page of results. 4454// A non-nil error returned from f will halt the iteration. 4455// The provided context supersedes any context provided to the Context method. 4456func (c *CommentsListCall) Pages(ctx context.Context, f func(*CommentList) error) error { 4457 c.ctx_ = ctx 4458 defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point 4459 for { 4460 x, err := c.Do() 4461 if err != nil { 4462 return err 4463 } 4464 if err := f(x); err != nil { 4465 return err 4466 } 4467 if x.NextPageToken == "" { 4468 return nil 4469 } 4470 c.PageToken(x.NextPageToken) 4471 } 4472} 4473 4474// method id "drive.comments.update": 4475 4476type CommentsUpdateCall struct { 4477 s *Service 4478 fileId string 4479 commentId string 4480 comment *Comment 4481 urlParams_ gensupport.URLParams 4482 ctx_ context.Context 4483 header_ http.Header 4484} 4485 4486// Update: Updates a comment with patch semantics. 4487func (r *CommentsService) Update(fileId string, commentId string, comment *Comment) *CommentsUpdateCall { 4488 c := &CommentsUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)} 4489 c.fileId = fileId 4490 c.commentId = commentId 4491 c.comment = comment 4492 return c 4493} 4494 4495// Fields allows partial responses to be retrieved. See 4496// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 4497// for more information. 4498func (c *CommentsUpdateCall) Fields(s ...googleapi.Field) *CommentsUpdateCall { 4499 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 4500 return c 4501} 4502 4503// Context sets the context to be used in this call's Do method. Any 4504// pending HTTP request will be aborted if the provided context is 4505// canceled. 4506func (c *CommentsUpdateCall) Context(ctx context.Context) *CommentsUpdateCall { 4507 c.ctx_ = ctx 4508 return c 4509} 4510 4511// Header returns an http.Header that can be modified by the caller to 4512// add HTTP headers to the request. 4513func (c *CommentsUpdateCall) Header() http.Header { 4514 if c.header_ == nil { 4515 c.header_ = make(http.Header) 4516 } 4517 return c.header_ 4518} 4519 4520func (c *CommentsUpdateCall) doRequest(alt string) (*http.Response, error) { 4521 reqHeaders := make(http.Header) 4522 for k, v := range c.header_ { 4523 reqHeaders[k] = v 4524 } 4525 reqHeaders.Set("User-Agent", c.s.userAgent()) 4526 var body io.Reader = nil 4527 body, err := googleapi.WithoutDataWrapper.JSONReader(c.comment) 4528 if err != nil { 4529 return nil, err 4530 } 4531 reqHeaders.Set("Content-Type", "application/json") 4532 c.urlParams_.Set("alt", alt) 4533 c.urlParams_.Set("prettyPrint", "false") 4534 urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/comments/{commentId}") 4535 urls += "?" + c.urlParams_.Encode() 4536 req, err := http.NewRequest("PATCH", urls, body) 4537 if err != nil { 4538 return nil, err 4539 } 4540 req.Header = reqHeaders 4541 googleapi.Expand(req.URL, map[string]string{ 4542 "fileId": c.fileId, 4543 "commentId": c.commentId, 4544 }) 4545 return gensupport.SendRequest(c.ctx_, c.s.client, req) 4546} 4547 4548// Do executes the "drive.comments.update" call. 4549// Exactly one of *Comment or error will be non-nil. Any non-2xx status 4550// code is an error. Response headers are in either 4551// *Comment.ServerResponse.Header or (if a response was returned at all) 4552// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 4553// check whether the returned error was because http.StatusNotModified 4554// was returned. 4555func (c *CommentsUpdateCall) Do(opts ...googleapi.CallOption) (*Comment, error) { 4556 gensupport.SetOptions(c.urlParams_, opts...) 4557 res, err := c.doRequest("json") 4558 if res != nil && res.StatusCode == http.StatusNotModified { 4559 if res.Body != nil { 4560 res.Body.Close() 4561 } 4562 return nil, &googleapi.Error{ 4563 Code: res.StatusCode, 4564 Header: res.Header, 4565 } 4566 } 4567 if err != nil { 4568 return nil, err 4569 } 4570 defer googleapi.CloseBody(res) 4571 if err := googleapi.CheckResponse(res); err != nil { 4572 return nil, err 4573 } 4574 ret := &Comment{ 4575 ServerResponse: googleapi.ServerResponse{ 4576 Header: res.Header, 4577 HTTPStatusCode: res.StatusCode, 4578 }, 4579 } 4580 target := &ret 4581 if err := gensupport.DecodeResponse(target, res); err != nil { 4582 return nil, err 4583 } 4584 return ret, nil 4585 // { 4586 // "description": "Updates a comment with patch semantics.", 4587 // "httpMethod": "PATCH", 4588 // "id": "drive.comments.update", 4589 // "parameterOrder": [ 4590 // "fileId", 4591 // "commentId" 4592 // ], 4593 // "parameters": { 4594 // "commentId": { 4595 // "description": "The ID of the comment.", 4596 // "location": "path", 4597 // "required": true, 4598 // "type": "string" 4599 // }, 4600 // "fileId": { 4601 // "description": "The ID of the file.", 4602 // "location": "path", 4603 // "required": true, 4604 // "type": "string" 4605 // } 4606 // }, 4607 // "path": "files/{fileId}/comments/{commentId}", 4608 // "request": { 4609 // "$ref": "Comment" 4610 // }, 4611 // "response": { 4612 // "$ref": "Comment" 4613 // }, 4614 // "scopes": [ 4615 // "https://www.googleapis.com/auth/drive", 4616 // "https://www.googleapis.com/auth/drive.file" 4617 // ] 4618 // } 4619 4620} 4621 4622// method id "drive.drives.create": 4623 4624type DrivesCreateCall struct { 4625 s *Service 4626 drive *Drive 4627 urlParams_ gensupport.URLParams 4628 ctx_ context.Context 4629 header_ http.Header 4630} 4631 4632// Create: Creates a new shared drive. 4633func (r *DrivesService) Create(requestId string, drive *Drive) *DrivesCreateCall { 4634 c := &DrivesCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)} 4635 c.urlParams_.Set("requestId", requestId) 4636 c.drive = drive 4637 return c 4638} 4639 4640// Fields allows partial responses to be retrieved. See 4641// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 4642// for more information. 4643func (c *DrivesCreateCall) Fields(s ...googleapi.Field) *DrivesCreateCall { 4644 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 4645 return c 4646} 4647 4648// Context sets the context to be used in this call's Do method. Any 4649// pending HTTP request will be aborted if the provided context is 4650// canceled. 4651func (c *DrivesCreateCall) Context(ctx context.Context) *DrivesCreateCall { 4652 c.ctx_ = ctx 4653 return c 4654} 4655 4656// Header returns an http.Header that can be modified by the caller to 4657// add HTTP headers to the request. 4658func (c *DrivesCreateCall) Header() http.Header { 4659 if c.header_ == nil { 4660 c.header_ = make(http.Header) 4661 } 4662 return c.header_ 4663} 4664 4665func (c *DrivesCreateCall) doRequest(alt string) (*http.Response, error) { 4666 reqHeaders := make(http.Header) 4667 for k, v := range c.header_ { 4668 reqHeaders[k] = v 4669 } 4670 reqHeaders.Set("User-Agent", c.s.userAgent()) 4671 var body io.Reader = nil 4672 body, err := googleapi.WithoutDataWrapper.JSONReader(c.drive) 4673 if err != nil { 4674 return nil, err 4675 } 4676 reqHeaders.Set("Content-Type", "application/json") 4677 c.urlParams_.Set("alt", alt) 4678 c.urlParams_.Set("prettyPrint", "false") 4679 urls := googleapi.ResolveRelative(c.s.BasePath, "drives") 4680 urls += "?" + c.urlParams_.Encode() 4681 req, err := http.NewRequest("POST", urls, body) 4682 if err != nil { 4683 return nil, err 4684 } 4685 req.Header = reqHeaders 4686 return gensupport.SendRequest(c.ctx_, c.s.client, req) 4687} 4688 4689// Do executes the "drive.drives.create" call. 4690// Exactly one of *Drive or error will be non-nil. Any non-2xx status 4691// code is an error. Response headers are in either 4692// *Drive.ServerResponse.Header or (if a response was returned at all) 4693// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 4694// check whether the returned error was because http.StatusNotModified 4695// was returned. 4696func (c *DrivesCreateCall) Do(opts ...googleapi.CallOption) (*Drive, error) { 4697 gensupport.SetOptions(c.urlParams_, opts...) 4698 res, err := c.doRequest("json") 4699 if res != nil && res.StatusCode == http.StatusNotModified { 4700 if res.Body != nil { 4701 res.Body.Close() 4702 } 4703 return nil, &googleapi.Error{ 4704 Code: res.StatusCode, 4705 Header: res.Header, 4706 } 4707 } 4708 if err != nil { 4709 return nil, err 4710 } 4711 defer googleapi.CloseBody(res) 4712 if err := googleapi.CheckResponse(res); err != nil { 4713 return nil, err 4714 } 4715 ret := &Drive{ 4716 ServerResponse: googleapi.ServerResponse{ 4717 Header: res.Header, 4718 HTTPStatusCode: res.StatusCode, 4719 }, 4720 } 4721 target := &ret 4722 if err := gensupport.DecodeResponse(target, res); err != nil { 4723 return nil, err 4724 } 4725 return ret, nil 4726 // { 4727 // "description": "Creates a new shared drive.", 4728 // "httpMethod": "POST", 4729 // "id": "drive.drives.create", 4730 // "parameterOrder": [ 4731 // "requestId" 4732 // ], 4733 // "parameters": { 4734 // "requestId": { 4735 // "description": "An ID, such as a random UUID, which uniquely identifies this user's request for idempotent creation of a shared drive. A repeated request by the same user and with the same request ID will avoid creating duplicates by attempting to create the same shared drive. If the shared drive already exists a 409 error will be returned.", 4736 // "location": "query", 4737 // "required": true, 4738 // "type": "string" 4739 // } 4740 // }, 4741 // "path": "drives", 4742 // "request": { 4743 // "$ref": "Drive" 4744 // }, 4745 // "response": { 4746 // "$ref": "Drive" 4747 // }, 4748 // "scopes": [ 4749 // "https://www.googleapis.com/auth/drive" 4750 // ] 4751 // } 4752 4753} 4754 4755// method id "drive.drives.delete": 4756 4757type DrivesDeleteCall struct { 4758 s *Service 4759 driveId string 4760 urlParams_ gensupport.URLParams 4761 ctx_ context.Context 4762 header_ http.Header 4763} 4764 4765// Delete: Permanently deletes a shared drive for which the user is an 4766// organizer. The shared drive cannot contain any untrashed items. 4767func (r *DrivesService) Delete(driveId string) *DrivesDeleteCall { 4768 c := &DrivesDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)} 4769 c.driveId = driveId 4770 return c 4771} 4772 4773// Fields allows partial responses to be retrieved. See 4774// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 4775// for more information. 4776func (c *DrivesDeleteCall) Fields(s ...googleapi.Field) *DrivesDeleteCall { 4777 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 4778 return c 4779} 4780 4781// Context sets the context to be used in this call's Do method. Any 4782// pending HTTP request will be aborted if the provided context is 4783// canceled. 4784func (c *DrivesDeleteCall) Context(ctx context.Context) *DrivesDeleteCall { 4785 c.ctx_ = ctx 4786 return c 4787} 4788 4789// Header returns an http.Header that can be modified by the caller to 4790// add HTTP headers to the request. 4791func (c *DrivesDeleteCall) Header() http.Header { 4792 if c.header_ == nil { 4793 c.header_ = make(http.Header) 4794 } 4795 return c.header_ 4796} 4797 4798func (c *DrivesDeleteCall) doRequest(alt string) (*http.Response, error) { 4799 reqHeaders := make(http.Header) 4800 for k, v := range c.header_ { 4801 reqHeaders[k] = v 4802 } 4803 reqHeaders.Set("User-Agent", c.s.userAgent()) 4804 var body io.Reader = nil 4805 c.urlParams_.Set("alt", alt) 4806 c.urlParams_.Set("prettyPrint", "false") 4807 urls := googleapi.ResolveRelative(c.s.BasePath, "drives/{driveId}") 4808 urls += "?" + c.urlParams_.Encode() 4809 req, err := http.NewRequest("DELETE", urls, body) 4810 if err != nil { 4811 return nil, err 4812 } 4813 req.Header = reqHeaders 4814 googleapi.Expand(req.URL, map[string]string{ 4815 "driveId": c.driveId, 4816 }) 4817 return gensupport.SendRequest(c.ctx_, c.s.client, req) 4818} 4819 4820// Do executes the "drive.drives.delete" call. 4821func (c *DrivesDeleteCall) Do(opts ...googleapi.CallOption) error { 4822 gensupport.SetOptions(c.urlParams_, opts...) 4823 res, err := c.doRequest("json") 4824 if err != nil { 4825 return err 4826 } 4827 defer googleapi.CloseBody(res) 4828 if err := googleapi.CheckResponse(res); err != nil { 4829 return err 4830 } 4831 return nil 4832 // { 4833 // "description": "Permanently deletes a shared drive for which the user is an organizer. The shared drive cannot contain any untrashed items.", 4834 // "httpMethod": "DELETE", 4835 // "id": "drive.drives.delete", 4836 // "parameterOrder": [ 4837 // "driveId" 4838 // ], 4839 // "parameters": { 4840 // "driveId": { 4841 // "description": "The ID of the shared drive.", 4842 // "location": "path", 4843 // "required": true, 4844 // "type": "string" 4845 // } 4846 // }, 4847 // "path": "drives/{driveId}", 4848 // "scopes": [ 4849 // "https://www.googleapis.com/auth/drive" 4850 // ] 4851 // } 4852 4853} 4854 4855// method id "drive.drives.get": 4856 4857type DrivesGetCall struct { 4858 s *Service 4859 driveId string 4860 urlParams_ gensupport.URLParams 4861 ifNoneMatch_ string 4862 ctx_ context.Context 4863 header_ http.Header 4864} 4865 4866// Get: Gets a shared drive's metadata by ID. 4867func (r *DrivesService) Get(driveId string) *DrivesGetCall { 4868 c := &DrivesGetCall{s: r.s, urlParams_: make(gensupport.URLParams)} 4869 c.driveId = driveId 4870 return c 4871} 4872 4873// UseDomainAdminAccess sets the optional parameter 4874// "useDomainAdminAccess": Issue the request as a domain administrator; 4875// if set to true, then the requester will be granted access if they are 4876// an administrator of the domain to which the shared drive belongs. 4877func (c *DrivesGetCall) UseDomainAdminAccess(useDomainAdminAccess bool) *DrivesGetCall { 4878 c.urlParams_.Set("useDomainAdminAccess", fmt.Sprint(useDomainAdminAccess)) 4879 return c 4880} 4881 4882// Fields allows partial responses to be retrieved. See 4883// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 4884// for more information. 4885func (c *DrivesGetCall) Fields(s ...googleapi.Field) *DrivesGetCall { 4886 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 4887 return c 4888} 4889 4890// IfNoneMatch sets the optional parameter which makes the operation 4891// fail if the object's ETag matches the given value. This is useful for 4892// getting updates only after the object has changed since the last 4893// request. Use googleapi.IsNotModified to check whether the response 4894// error from Do is the result of In-None-Match. 4895func (c *DrivesGetCall) IfNoneMatch(entityTag string) *DrivesGetCall { 4896 c.ifNoneMatch_ = entityTag 4897 return c 4898} 4899 4900// Context sets the context to be used in this call's Do method. Any 4901// pending HTTP request will be aborted if the provided context is 4902// canceled. 4903func (c *DrivesGetCall) Context(ctx context.Context) *DrivesGetCall { 4904 c.ctx_ = ctx 4905 return c 4906} 4907 4908// Header returns an http.Header that can be modified by the caller to 4909// add HTTP headers to the request. 4910func (c *DrivesGetCall) Header() http.Header { 4911 if c.header_ == nil { 4912 c.header_ = make(http.Header) 4913 } 4914 return c.header_ 4915} 4916 4917func (c *DrivesGetCall) doRequest(alt string) (*http.Response, error) { 4918 reqHeaders := make(http.Header) 4919 for k, v := range c.header_ { 4920 reqHeaders[k] = v 4921 } 4922 reqHeaders.Set("User-Agent", c.s.userAgent()) 4923 if c.ifNoneMatch_ != "" { 4924 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 4925 } 4926 var body io.Reader = nil 4927 c.urlParams_.Set("alt", alt) 4928 c.urlParams_.Set("prettyPrint", "false") 4929 urls := googleapi.ResolveRelative(c.s.BasePath, "drives/{driveId}") 4930 urls += "?" + c.urlParams_.Encode() 4931 req, err := http.NewRequest("GET", urls, body) 4932 if err != nil { 4933 return nil, err 4934 } 4935 req.Header = reqHeaders 4936 googleapi.Expand(req.URL, map[string]string{ 4937 "driveId": c.driveId, 4938 }) 4939 return gensupport.SendRequest(c.ctx_, c.s.client, req) 4940} 4941 4942// Do executes the "drive.drives.get" call. 4943// Exactly one of *Drive or error will be non-nil. Any non-2xx status 4944// code is an error. Response headers are in either 4945// *Drive.ServerResponse.Header or (if a response was returned at all) 4946// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 4947// check whether the returned error was because http.StatusNotModified 4948// was returned. 4949func (c *DrivesGetCall) Do(opts ...googleapi.CallOption) (*Drive, error) { 4950 gensupport.SetOptions(c.urlParams_, opts...) 4951 res, err := c.doRequest("json") 4952 if res != nil && res.StatusCode == http.StatusNotModified { 4953 if res.Body != nil { 4954 res.Body.Close() 4955 } 4956 return nil, &googleapi.Error{ 4957 Code: res.StatusCode, 4958 Header: res.Header, 4959 } 4960 } 4961 if err != nil { 4962 return nil, err 4963 } 4964 defer googleapi.CloseBody(res) 4965 if err := googleapi.CheckResponse(res); err != nil { 4966 return nil, err 4967 } 4968 ret := &Drive{ 4969 ServerResponse: googleapi.ServerResponse{ 4970 Header: res.Header, 4971 HTTPStatusCode: res.StatusCode, 4972 }, 4973 } 4974 target := &ret 4975 if err := gensupport.DecodeResponse(target, res); err != nil { 4976 return nil, err 4977 } 4978 return ret, nil 4979 // { 4980 // "description": "Gets a shared drive's metadata by ID.", 4981 // "httpMethod": "GET", 4982 // "id": "drive.drives.get", 4983 // "parameterOrder": [ 4984 // "driveId" 4985 // ], 4986 // "parameters": { 4987 // "driveId": { 4988 // "description": "The ID of the shared drive.", 4989 // "location": "path", 4990 // "required": true, 4991 // "type": "string" 4992 // }, 4993 // "useDomainAdminAccess": { 4994 // "default": "false", 4995 // "description": "Issue the request as a domain administrator; if set to true, then the requester will be granted access if they are an administrator of the domain to which the shared drive belongs.", 4996 // "location": "query", 4997 // "type": "boolean" 4998 // } 4999 // }, 5000 // "path": "drives/{driveId}", 5001 // "response": { 5002 // "$ref": "Drive" 5003 // }, 5004 // "scopes": [ 5005 // "https://www.googleapis.com/auth/drive", 5006 // "https://www.googleapis.com/auth/drive.readonly" 5007 // ] 5008 // } 5009 5010} 5011 5012// method id "drive.drives.hide": 5013 5014type DrivesHideCall struct { 5015 s *Service 5016 driveId string 5017 urlParams_ gensupport.URLParams 5018 ctx_ context.Context 5019 header_ http.Header 5020} 5021 5022// Hide: Hides a shared drive from the default view. 5023func (r *DrivesService) Hide(driveId string) *DrivesHideCall { 5024 c := &DrivesHideCall{s: r.s, urlParams_: make(gensupport.URLParams)} 5025 c.driveId = driveId 5026 return c 5027} 5028 5029// Fields allows partial responses to be retrieved. See 5030// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 5031// for more information. 5032func (c *DrivesHideCall) Fields(s ...googleapi.Field) *DrivesHideCall { 5033 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 5034 return c 5035} 5036 5037// Context sets the context to be used in this call's Do method. Any 5038// pending HTTP request will be aborted if the provided context is 5039// canceled. 5040func (c *DrivesHideCall) Context(ctx context.Context) *DrivesHideCall { 5041 c.ctx_ = ctx 5042 return c 5043} 5044 5045// Header returns an http.Header that can be modified by the caller to 5046// add HTTP headers to the request. 5047func (c *DrivesHideCall) Header() http.Header { 5048 if c.header_ == nil { 5049 c.header_ = make(http.Header) 5050 } 5051 return c.header_ 5052} 5053 5054func (c *DrivesHideCall) doRequest(alt string) (*http.Response, error) { 5055 reqHeaders := make(http.Header) 5056 for k, v := range c.header_ { 5057 reqHeaders[k] = v 5058 } 5059 reqHeaders.Set("User-Agent", c.s.userAgent()) 5060 var body io.Reader = nil 5061 c.urlParams_.Set("alt", alt) 5062 c.urlParams_.Set("prettyPrint", "false") 5063 urls := googleapi.ResolveRelative(c.s.BasePath, "drives/{driveId}/hide") 5064 urls += "?" + c.urlParams_.Encode() 5065 req, err := http.NewRequest("POST", urls, body) 5066 if err != nil { 5067 return nil, err 5068 } 5069 req.Header = reqHeaders 5070 googleapi.Expand(req.URL, map[string]string{ 5071 "driveId": c.driveId, 5072 }) 5073 return gensupport.SendRequest(c.ctx_, c.s.client, req) 5074} 5075 5076// Do executes the "drive.drives.hide" call. 5077// Exactly one of *Drive or error will be non-nil. Any non-2xx status 5078// code is an error. Response headers are in either 5079// *Drive.ServerResponse.Header or (if a response was returned at all) 5080// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 5081// check whether the returned error was because http.StatusNotModified 5082// was returned. 5083func (c *DrivesHideCall) Do(opts ...googleapi.CallOption) (*Drive, error) { 5084 gensupport.SetOptions(c.urlParams_, opts...) 5085 res, err := c.doRequest("json") 5086 if res != nil && res.StatusCode == http.StatusNotModified { 5087 if res.Body != nil { 5088 res.Body.Close() 5089 } 5090 return nil, &googleapi.Error{ 5091 Code: res.StatusCode, 5092 Header: res.Header, 5093 } 5094 } 5095 if err != nil { 5096 return nil, err 5097 } 5098 defer googleapi.CloseBody(res) 5099 if err := googleapi.CheckResponse(res); err != nil { 5100 return nil, err 5101 } 5102 ret := &Drive{ 5103 ServerResponse: googleapi.ServerResponse{ 5104 Header: res.Header, 5105 HTTPStatusCode: res.StatusCode, 5106 }, 5107 } 5108 target := &ret 5109 if err := gensupport.DecodeResponse(target, res); err != nil { 5110 return nil, err 5111 } 5112 return ret, nil 5113 // { 5114 // "description": "Hides a shared drive from the default view.", 5115 // "httpMethod": "POST", 5116 // "id": "drive.drives.hide", 5117 // "parameterOrder": [ 5118 // "driveId" 5119 // ], 5120 // "parameters": { 5121 // "driveId": { 5122 // "description": "The ID of the shared drive.", 5123 // "location": "path", 5124 // "required": true, 5125 // "type": "string" 5126 // } 5127 // }, 5128 // "path": "drives/{driveId}/hide", 5129 // "response": { 5130 // "$ref": "Drive" 5131 // }, 5132 // "scopes": [ 5133 // "https://www.googleapis.com/auth/drive" 5134 // ] 5135 // } 5136 5137} 5138 5139// method id "drive.drives.list": 5140 5141type DrivesListCall struct { 5142 s *Service 5143 urlParams_ gensupport.URLParams 5144 ifNoneMatch_ string 5145 ctx_ context.Context 5146 header_ http.Header 5147} 5148 5149// List: Lists the user's shared drives. 5150func (r *DrivesService) List() *DrivesListCall { 5151 c := &DrivesListCall{s: r.s, urlParams_: make(gensupport.URLParams)} 5152 return c 5153} 5154 5155// PageSize sets the optional parameter "pageSize": Maximum number of 5156// shared drives to return. 5157func (c *DrivesListCall) PageSize(pageSize int64) *DrivesListCall { 5158 c.urlParams_.Set("pageSize", fmt.Sprint(pageSize)) 5159 return c 5160} 5161 5162// PageToken sets the optional parameter "pageToken": Page token for 5163// shared drives. 5164func (c *DrivesListCall) PageToken(pageToken string) *DrivesListCall { 5165 c.urlParams_.Set("pageToken", pageToken) 5166 return c 5167} 5168 5169// Q sets the optional parameter "q": Query string for searching shared 5170// drives. 5171func (c *DrivesListCall) Q(q string) *DrivesListCall { 5172 c.urlParams_.Set("q", q) 5173 return c 5174} 5175 5176// UseDomainAdminAccess sets the optional parameter 5177// "useDomainAdminAccess": Issue the request as a domain administrator; 5178// if set to true, then all shared drives of the domain in which the 5179// requester is an administrator are returned. 5180func (c *DrivesListCall) UseDomainAdminAccess(useDomainAdminAccess bool) *DrivesListCall { 5181 c.urlParams_.Set("useDomainAdminAccess", fmt.Sprint(useDomainAdminAccess)) 5182 return c 5183} 5184 5185// Fields allows partial responses to be retrieved. See 5186// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 5187// for more information. 5188func (c *DrivesListCall) Fields(s ...googleapi.Field) *DrivesListCall { 5189 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 5190 return c 5191} 5192 5193// IfNoneMatch sets the optional parameter which makes the operation 5194// fail if the object's ETag matches the given value. This is useful for 5195// getting updates only after the object has changed since the last 5196// request. Use googleapi.IsNotModified to check whether the response 5197// error from Do is the result of In-None-Match. 5198func (c *DrivesListCall) IfNoneMatch(entityTag string) *DrivesListCall { 5199 c.ifNoneMatch_ = entityTag 5200 return c 5201} 5202 5203// Context sets the context to be used in this call's Do method. Any 5204// pending HTTP request will be aborted if the provided context is 5205// canceled. 5206func (c *DrivesListCall) Context(ctx context.Context) *DrivesListCall { 5207 c.ctx_ = ctx 5208 return c 5209} 5210 5211// Header returns an http.Header that can be modified by the caller to 5212// add HTTP headers to the request. 5213func (c *DrivesListCall) Header() http.Header { 5214 if c.header_ == nil { 5215 c.header_ = make(http.Header) 5216 } 5217 return c.header_ 5218} 5219 5220func (c *DrivesListCall) doRequest(alt string) (*http.Response, error) { 5221 reqHeaders := make(http.Header) 5222 for k, v := range c.header_ { 5223 reqHeaders[k] = v 5224 } 5225 reqHeaders.Set("User-Agent", c.s.userAgent()) 5226 if c.ifNoneMatch_ != "" { 5227 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 5228 } 5229 var body io.Reader = nil 5230 c.urlParams_.Set("alt", alt) 5231 c.urlParams_.Set("prettyPrint", "false") 5232 urls := googleapi.ResolveRelative(c.s.BasePath, "drives") 5233 urls += "?" + c.urlParams_.Encode() 5234 req, err := http.NewRequest("GET", urls, body) 5235 if err != nil { 5236 return nil, err 5237 } 5238 req.Header = reqHeaders 5239 return gensupport.SendRequest(c.ctx_, c.s.client, req) 5240} 5241 5242// Do executes the "drive.drives.list" call. 5243// Exactly one of *DriveList or error will be non-nil. Any non-2xx 5244// status code is an error. Response headers are in either 5245// *DriveList.ServerResponse.Header or (if a response was returned at 5246// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 5247// to check whether the returned error was because 5248// http.StatusNotModified was returned. 5249func (c *DrivesListCall) Do(opts ...googleapi.CallOption) (*DriveList, error) { 5250 gensupport.SetOptions(c.urlParams_, opts...) 5251 res, err := c.doRequest("json") 5252 if res != nil && res.StatusCode == http.StatusNotModified { 5253 if res.Body != nil { 5254 res.Body.Close() 5255 } 5256 return nil, &googleapi.Error{ 5257 Code: res.StatusCode, 5258 Header: res.Header, 5259 } 5260 } 5261 if err != nil { 5262 return nil, err 5263 } 5264 defer googleapi.CloseBody(res) 5265 if err := googleapi.CheckResponse(res); err != nil { 5266 return nil, err 5267 } 5268 ret := &DriveList{ 5269 ServerResponse: googleapi.ServerResponse{ 5270 Header: res.Header, 5271 HTTPStatusCode: res.StatusCode, 5272 }, 5273 } 5274 target := &ret 5275 if err := gensupport.DecodeResponse(target, res); err != nil { 5276 return nil, err 5277 } 5278 return ret, nil 5279 // { 5280 // "description": "Lists the user's shared drives.", 5281 // "httpMethod": "GET", 5282 // "id": "drive.drives.list", 5283 // "parameters": { 5284 // "pageSize": { 5285 // "default": "10", 5286 // "description": "Maximum number of shared drives to return.", 5287 // "format": "int32", 5288 // "location": "query", 5289 // "maximum": "100", 5290 // "minimum": "1", 5291 // "type": "integer" 5292 // }, 5293 // "pageToken": { 5294 // "description": "Page token for shared drives.", 5295 // "location": "query", 5296 // "type": "string" 5297 // }, 5298 // "q": { 5299 // "description": "Query string for searching shared drives.", 5300 // "location": "query", 5301 // "type": "string" 5302 // }, 5303 // "useDomainAdminAccess": { 5304 // "default": "false", 5305 // "description": "Issue the request as a domain administrator; if set to true, then all shared drives of the domain in which the requester is an administrator are returned.", 5306 // "location": "query", 5307 // "type": "boolean" 5308 // } 5309 // }, 5310 // "path": "drives", 5311 // "response": { 5312 // "$ref": "DriveList" 5313 // }, 5314 // "scopes": [ 5315 // "https://www.googleapis.com/auth/drive", 5316 // "https://www.googleapis.com/auth/drive.readonly" 5317 // ] 5318 // } 5319 5320} 5321 5322// Pages invokes f for each page of results. 5323// A non-nil error returned from f will halt the iteration. 5324// The provided context supersedes any context provided to the Context method. 5325func (c *DrivesListCall) Pages(ctx context.Context, f func(*DriveList) error) error { 5326 c.ctx_ = ctx 5327 defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point 5328 for { 5329 x, err := c.Do() 5330 if err != nil { 5331 return err 5332 } 5333 if err := f(x); err != nil { 5334 return err 5335 } 5336 if x.NextPageToken == "" { 5337 return nil 5338 } 5339 c.PageToken(x.NextPageToken) 5340 } 5341} 5342 5343// method id "drive.drives.unhide": 5344 5345type DrivesUnhideCall struct { 5346 s *Service 5347 driveId string 5348 urlParams_ gensupport.URLParams 5349 ctx_ context.Context 5350 header_ http.Header 5351} 5352 5353// Unhide: Restores a shared drive to the default view. 5354func (r *DrivesService) Unhide(driveId string) *DrivesUnhideCall { 5355 c := &DrivesUnhideCall{s: r.s, urlParams_: make(gensupport.URLParams)} 5356 c.driveId = driveId 5357 return c 5358} 5359 5360// Fields allows partial responses to be retrieved. See 5361// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 5362// for more information. 5363func (c *DrivesUnhideCall) Fields(s ...googleapi.Field) *DrivesUnhideCall { 5364 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 5365 return c 5366} 5367 5368// Context sets the context to be used in this call's Do method. Any 5369// pending HTTP request will be aborted if the provided context is 5370// canceled. 5371func (c *DrivesUnhideCall) Context(ctx context.Context) *DrivesUnhideCall { 5372 c.ctx_ = ctx 5373 return c 5374} 5375 5376// Header returns an http.Header that can be modified by the caller to 5377// add HTTP headers to the request. 5378func (c *DrivesUnhideCall) Header() http.Header { 5379 if c.header_ == nil { 5380 c.header_ = make(http.Header) 5381 } 5382 return c.header_ 5383} 5384 5385func (c *DrivesUnhideCall) doRequest(alt string) (*http.Response, error) { 5386 reqHeaders := make(http.Header) 5387 for k, v := range c.header_ { 5388 reqHeaders[k] = v 5389 } 5390 reqHeaders.Set("User-Agent", c.s.userAgent()) 5391 var body io.Reader = nil 5392 c.urlParams_.Set("alt", alt) 5393 c.urlParams_.Set("prettyPrint", "false") 5394 urls := googleapi.ResolveRelative(c.s.BasePath, "drives/{driveId}/unhide") 5395 urls += "?" + c.urlParams_.Encode() 5396 req, err := http.NewRequest("POST", urls, body) 5397 if err != nil { 5398 return nil, err 5399 } 5400 req.Header = reqHeaders 5401 googleapi.Expand(req.URL, map[string]string{ 5402 "driveId": c.driveId, 5403 }) 5404 return gensupport.SendRequest(c.ctx_, c.s.client, req) 5405} 5406 5407// Do executes the "drive.drives.unhide" call. 5408// Exactly one of *Drive or error will be non-nil. Any non-2xx status 5409// code is an error. Response headers are in either 5410// *Drive.ServerResponse.Header or (if a response was returned at all) 5411// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 5412// check whether the returned error was because http.StatusNotModified 5413// was returned. 5414func (c *DrivesUnhideCall) Do(opts ...googleapi.CallOption) (*Drive, error) { 5415 gensupport.SetOptions(c.urlParams_, opts...) 5416 res, err := c.doRequest("json") 5417 if res != nil && res.StatusCode == http.StatusNotModified { 5418 if res.Body != nil { 5419 res.Body.Close() 5420 } 5421 return nil, &googleapi.Error{ 5422 Code: res.StatusCode, 5423 Header: res.Header, 5424 } 5425 } 5426 if err != nil { 5427 return nil, err 5428 } 5429 defer googleapi.CloseBody(res) 5430 if err := googleapi.CheckResponse(res); err != nil { 5431 return nil, err 5432 } 5433 ret := &Drive{ 5434 ServerResponse: googleapi.ServerResponse{ 5435 Header: res.Header, 5436 HTTPStatusCode: res.StatusCode, 5437 }, 5438 } 5439 target := &ret 5440 if err := gensupport.DecodeResponse(target, res); err != nil { 5441 return nil, err 5442 } 5443 return ret, nil 5444 // { 5445 // "description": "Restores a shared drive to the default view.", 5446 // "httpMethod": "POST", 5447 // "id": "drive.drives.unhide", 5448 // "parameterOrder": [ 5449 // "driveId" 5450 // ], 5451 // "parameters": { 5452 // "driveId": { 5453 // "description": "The ID of the shared drive.", 5454 // "location": "path", 5455 // "required": true, 5456 // "type": "string" 5457 // } 5458 // }, 5459 // "path": "drives/{driveId}/unhide", 5460 // "response": { 5461 // "$ref": "Drive" 5462 // }, 5463 // "scopes": [ 5464 // "https://www.googleapis.com/auth/drive" 5465 // ] 5466 // } 5467 5468} 5469 5470// method id "drive.drives.update": 5471 5472type DrivesUpdateCall struct { 5473 s *Service 5474 driveId string 5475 drive *Drive 5476 urlParams_ gensupport.URLParams 5477 ctx_ context.Context 5478 header_ http.Header 5479} 5480 5481// Update: Updates the metadate for a shared drive. 5482func (r *DrivesService) Update(driveId string, drive *Drive) *DrivesUpdateCall { 5483 c := &DrivesUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)} 5484 c.driveId = driveId 5485 c.drive = drive 5486 return c 5487} 5488 5489// UseDomainAdminAccess sets the optional parameter 5490// "useDomainAdminAccess": Issue the request as a domain administrator; 5491// if set to true, then the requester will be granted access if they are 5492// an administrator of the domain to which the shared drive belongs. 5493func (c *DrivesUpdateCall) UseDomainAdminAccess(useDomainAdminAccess bool) *DrivesUpdateCall { 5494 c.urlParams_.Set("useDomainAdminAccess", fmt.Sprint(useDomainAdminAccess)) 5495 return c 5496} 5497 5498// Fields allows partial responses to be retrieved. See 5499// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 5500// for more information. 5501func (c *DrivesUpdateCall) Fields(s ...googleapi.Field) *DrivesUpdateCall { 5502 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 5503 return c 5504} 5505 5506// Context sets the context to be used in this call's Do method. Any 5507// pending HTTP request will be aborted if the provided context is 5508// canceled. 5509func (c *DrivesUpdateCall) Context(ctx context.Context) *DrivesUpdateCall { 5510 c.ctx_ = ctx 5511 return c 5512} 5513 5514// Header returns an http.Header that can be modified by the caller to 5515// add HTTP headers to the request. 5516func (c *DrivesUpdateCall) Header() http.Header { 5517 if c.header_ == nil { 5518 c.header_ = make(http.Header) 5519 } 5520 return c.header_ 5521} 5522 5523func (c *DrivesUpdateCall) doRequest(alt string) (*http.Response, error) { 5524 reqHeaders := make(http.Header) 5525 for k, v := range c.header_ { 5526 reqHeaders[k] = v 5527 } 5528 reqHeaders.Set("User-Agent", c.s.userAgent()) 5529 var body io.Reader = nil 5530 body, err := googleapi.WithoutDataWrapper.JSONReader(c.drive) 5531 if err != nil { 5532 return nil, err 5533 } 5534 reqHeaders.Set("Content-Type", "application/json") 5535 c.urlParams_.Set("alt", alt) 5536 c.urlParams_.Set("prettyPrint", "false") 5537 urls := googleapi.ResolveRelative(c.s.BasePath, "drives/{driveId}") 5538 urls += "?" + c.urlParams_.Encode() 5539 req, err := http.NewRequest("PATCH", urls, body) 5540 if err != nil { 5541 return nil, err 5542 } 5543 req.Header = reqHeaders 5544 googleapi.Expand(req.URL, map[string]string{ 5545 "driveId": c.driveId, 5546 }) 5547 return gensupport.SendRequest(c.ctx_, c.s.client, req) 5548} 5549 5550// Do executes the "drive.drives.update" call. 5551// Exactly one of *Drive or error will be non-nil. Any non-2xx status 5552// code is an error. Response headers are in either 5553// *Drive.ServerResponse.Header or (if a response was returned at all) 5554// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 5555// check whether the returned error was because http.StatusNotModified 5556// was returned. 5557func (c *DrivesUpdateCall) Do(opts ...googleapi.CallOption) (*Drive, error) { 5558 gensupport.SetOptions(c.urlParams_, opts...) 5559 res, err := c.doRequest("json") 5560 if res != nil && res.StatusCode == http.StatusNotModified { 5561 if res.Body != nil { 5562 res.Body.Close() 5563 } 5564 return nil, &googleapi.Error{ 5565 Code: res.StatusCode, 5566 Header: res.Header, 5567 } 5568 } 5569 if err != nil { 5570 return nil, err 5571 } 5572 defer googleapi.CloseBody(res) 5573 if err := googleapi.CheckResponse(res); err != nil { 5574 return nil, err 5575 } 5576 ret := &Drive{ 5577 ServerResponse: googleapi.ServerResponse{ 5578 Header: res.Header, 5579 HTTPStatusCode: res.StatusCode, 5580 }, 5581 } 5582 target := &ret 5583 if err := gensupport.DecodeResponse(target, res); err != nil { 5584 return nil, err 5585 } 5586 return ret, nil 5587 // { 5588 // "description": "Updates the metadate for a shared drive.", 5589 // "httpMethod": "PATCH", 5590 // "id": "drive.drives.update", 5591 // "parameterOrder": [ 5592 // "driveId" 5593 // ], 5594 // "parameters": { 5595 // "driveId": { 5596 // "description": "The ID of the shared drive.", 5597 // "location": "path", 5598 // "required": true, 5599 // "type": "string" 5600 // }, 5601 // "useDomainAdminAccess": { 5602 // "default": "false", 5603 // "description": "Issue the request as a domain administrator; if set to true, then the requester will be granted access if they are an administrator of the domain to which the shared drive belongs.", 5604 // "location": "query", 5605 // "type": "boolean" 5606 // } 5607 // }, 5608 // "path": "drives/{driveId}", 5609 // "request": { 5610 // "$ref": "Drive" 5611 // }, 5612 // "response": { 5613 // "$ref": "Drive" 5614 // }, 5615 // "scopes": [ 5616 // "https://www.googleapis.com/auth/drive" 5617 // ] 5618 // } 5619 5620} 5621 5622// method id "drive.files.copy": 5623 5624type FilesCopyCall struct { 5625 s *Service 5626 fileId string 5627 file *File 5628 urlParams_ gensupport.URLParams 5629 ctx_ context.Context 5630 header_ http.Header 5631} 5632 5633// Copy: Creates a copy of a file and applies any requested updates with 5634// patch semantics. 5635func (r *FilesService) Copy(fileId string, file *File) *FilesCopyCall { 5636 c := &FilesCopyCall{s: r.s, urlParams_: make(gensupport.URLParams)} 5637 c.fileId = fileId 5638 c.file = file 5639 return c 5640} 5641 5642// IgnoreDefaultVisibility sets the optional parameter 5643// "ignoreDefaultVisibility": Whether to ignore the domain's default 5644// visibility settings for the created file. Domain administrators can 5645// choose to make all uploaded files visible to the domain by default; 5646// this parameter bypasses that behavior for the request. Permissions 5647// are still inherited from parent folders. 5648func (c *FilesCopyCall) IgnoreDefaultVisibility(ignoreDefaultVisibility bool) *FilesCopyCall { 5649 c.urlParams_.Set("ignoreDefaultVisibility", fmt.Sprint(ignoreDefaultVisibility)) 5650 return c 5651} 5652 5653// KeepRevisionForever sets the optional parameter 5654// "keepRevisionForever": Whether to set the 'keepForever' field in the 5655// new head revision. This is only applicable to files with binary 5656// content in Google Drive. 5657func (c *FilesCopyCall) KeepRevisionForever(keepRevisionForever bool) *FilesCopyCall { 5658 c.urlParams_.Set("keepRevisionForever", fmt.Sprint(keepRevisionForever)) 5659 return c 5660} 5661 5662// OcrLanguage sets the optional parameter "ocrLanguage": A language 5663// hint for OCR processing during image import (ISO 639-1 code). 5664func (c *FilesCopyCall) OcrLanguage(ocrLanguage string) *FilesCopyCall { 5665 c.urlParams_.Set("ocrLanguage", ocrLanguage) 5666 return c 5667} 5668 5669// SupportsAllDrives sets the optional parameter "supportsAllDrives": 5670// Deprecated - Whether the requesting application supports both My 5671// Drives and shared drives. This parameter will only be effective until 5672// June 1, 2020. Afterwards all applications are assumed to support 5673// shared drives. 5674func (c *FilesCopyCall) SupportsAllDrives(supportsAllDrives bool) *FilesCopyCall { 5675 c.urlParams_.Set("supportsAllDrives", fmt.Sprint(supportsAllDrives)) 5676 return c 5677} 5678 5679// SupportsTeamDrives sets the optional parameter "supportsTeamDrives": 5680// Deprecated use supportsAllDrives instead. 5681func (c *FilesCopyCall) SupportsTeamDrives(supportsTeamDrives bool) *FilesCopyCall { 5682 c.urlParams_.Set("supportsTeamDrives", fmt.Sprint(supportsTeamDrives)) 5683 return c 5684} 5685 5686// Fields allows partial responses to be retrieved. See 5687// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 5688// for more information. 5689func (c *FilesCopyCall) Fields(s ...googleapi.Field) *FilesCopyCall { 5690 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 5691 return c 5692} 5693 5694// Context sets the context to be used in this call's Do method. Any 5695// pending HTTP request will be aborted if the provided context is 5696// canceled. 5697func (c *FilesCopyCall) Context(ctx context.Context) *FilesCopyCall { 5698 c.ctx_ = ctx 5699 return c 5700} 5701 5702// Header returns an http.Header that can be modified by the caller to 5703// add HTTP headers to the request. 5704func (c *FilesCopyCall) Header() http.Header { 5705 if c.header_ == nil { 5706 c.header_ = make(http.Header) 5707 } 5708 return c.header_ 5709} 5710 5711func (c *FilesCopyCall) doRequest(alt string) (*http.Response, error) { 5712 reqHeaders := make(http.Header) 5713 for k, v := range c.header_ { 5714 reqHeaders[k] = v 5715 } 5716 reqHeaders.Set("User-Agent", c.s.userAgent()) 5717 var body io.Reader = nil 5718 body, err := googleapi.WithoutDataWrapper.JSONReader(c.file) 5719 if err != nil { 5720 return nil, err 5721 } 5722 reqHeaders.Set("Content-Type", "application/json") 5723 c.urlParams_.Set("alt", alt) 5724 c.urlParams_.Set("prettyPrint", "false") 5725 urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/copy") 5726 urls += "?" + c.urlParams_.Encode() 5727 req, err := http.NewRequest("POST", urls, body) 5728 if err != nil { 5729 return nil, err 5730 } 5731 req.Header = reqHeaders 5732 googleapi.Expand(req.URL, map[string]string{ 5733 "fileId": c.fileId, 5734 }) 5735 return gensupport.SendRequest(c.ctx_, c.s.client, req) 5736} 5737 5738// Do executes the "drive.files.copy" call. 5739// Exactly one of *File or error will be non-nil. Any non-2xx status 5740// code is an error. Response headers are in either 5741// *File.ServerResponse.Header or (if a response was returned at all) in 5742// error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check 5743// whether the returned error was because http.StatusNotModified was 5744// returned. 5745func (c *FilesCopyCall) Do(opts ...googleapi.CallOption) (*File, error) { 5746 gensupport.SetOptions(c.urlParams_, opts...) 5747 res, err := c.doRequest("json") 5748 if res != nil && res.StatusCode == http.StatusNotModified { 5749 if res.Body != nil { 5750 res.Body.Close() 5751 } 5752 return nil, &googleapi.Error{ 5753 Code: res.StatusCode, 5754 Header: res.Header, 5755 } 5756 } 5757 if err != nil { 5758 return nil, err 5759 } 5760 defer googleapi.CloseBody(res) 5761 if err := googleapi.CheckResponse(res); err != nil { 5762 return nil, err 5763 } 5764 ret := &File{ 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": "Creates a copy of a file and applies any requested updates with patch semantics.", 5777 // "httpMethod": "POST", 5778 // "id": "drive.files.copy", 5779 // "parameterOrder": [ 5780 // "fileId" 5781 // ], 5782 // "parameters": { 5783 // "fileId": { 5784 // "description": "The ID of the file.", 5785 // "location": "path", 5786 // "required": true, 5787 // "type": "string" 5788 // }, 5789 // "ignoreDefaultVisibility": { 5790 // "default": "false", 5791 // "description": "Whether to ignore the domain's default visibility settings for the created file. Domain administrators can choose to make all uploaded files visible to the domain by default; this parameter bypasses that behavior for the request. Permissions are still inherited from parent folders.", 5792 // "location": "query", 5793 // "type": "boolean" 5794 // }, 5795 // "keepRevisionForever": { 5796 // "default": "false", 5797 // "description": "Whether to set the 'keepForever' field in the new head revision. This is only applicable to files with binary content in Google Drive.", 5798 // "location": "query", 5799 // "type": "boolean" 5800 // }, 5801 // "ocrLanguage": { 5802 // "description": "A language hint for OCR processing during image import (ISO 639-1 code).", 5803 // "location": "query", 5804 // "type": "string" 5805 // }, 5806 // "supportsAllDrives": { 5807 // "default": "false", 5808 // "description": "Deprecated - Whether the requesting application supports both My Drives and shared drives. This parameter will only be effective until June 1, 2020. Afterwards all applications are assumed to support shared drives.", 5809 // "location": "query", 5810 // "type": "boolean" 5811 // }, 5812 // "supportsTeamDrives": { 5813 // "default": "false", 5814 // "description": "Deprecated use supportsAllDrives instead.", 5815 // "location": "query", 5816 // "type": "boolean" 5817 // } 5818 // }, 5819 // "path": "files/{fileId}/copy", 5820 // "request": { 5821 // "$ref": "File" 5822 // }, 5823 // "response": { 5824 // "$ref": "File" 5825 // }, 5826 // "scopes": [ 5827 // "https://www.googleapis.com/auth/drive", 5828 // "https://www.googleapis.com/auth/drive.appdata", 5829 // "https://www.googleapis.com/auth/drive.file", 5830 // "https://www.googleapis.com/auth/drive.photos.readonly" 5831 // ] 5832 // } 5833 5834} 5835 5836// method id "drive.files.create": 5837 5838type FilesCreateCall struct { 5839 s *Service 5840 file *File 5841 urlParams_ gensupport.URLParams 5842 mediaInfo_ *gensupport.MediaInfo 5843 ctx_ context.Context 5844 header_ http.Header 5845} 5846 5847// Create: Creates a new file. 5848func (r *FilesService) Create(file *File) *FilesCreateCall { 5849 c := &FilesCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)} 5850 c.file = file 5851 return c 5852} 5853 5854// IgnoreDefaultVisibility sets the optional parameter 5855// "ignoreDefaultVisibility": Whether to ignore the domain's default 5856// visibility settings for the created file. Domain administrators can 5857// choose to make all uploaded files visible to the domain by default; 5858// this parameter bypasses that behavior for the request. Permissions 5859// are still inherited from parent folders. 5860func (c *FilesCreateCall) IgnoreDefaultVisibility(ignoreDefaultVisibility bool) *FilesCreateCall { 5861 c.urlParams_.Set("ignoreDefaultVisibility", fmt.Sprint(ignoreDefaultVisibility)) 5862 return c 5863} 5864 5865// KeepRevisionForever sets the optional parameter 5866// "keepRevisionForever": Whether to set the 'keepForever' field in the 5867// new head revision. This is only applicable to files with binary 5868// content in Google Drive. 5869func (c *FilesCreateCall) KeepRevisionForever(keepRevisionForever bool) *FilesCreateCall { 5870 c.urlParams_.Set("keepRevisionForever", fmt.Sprint(keepRevisionForever)) 5871 return c 5872} 5873 5874// OcrLanguage sets the optional parameter "ocrLanguage": A language 5875// hint for OCR processing during image import (ISO 639-1 code). 5876func (c *FilesCreateCall) OcrLanguage(ocrLanguage string) *FilesCreateCall { 5877 c.urlParams_.Set("ocrLanguage", ocrLanguage) 5878 return c 5879} 5880 5881// SupportsAllDrives sets the optional parameter "supportsAllDrives": 5882// Deprecated - Whether the requesting application supports both My 5883// Drives and shared drives. This parameter will only be effective until 5884// June 1, 2020. Afterwards all applications are assumed to support 5885// shared drives. 5886func (c *FilesCreateCall) SupportsAllDrives(supportsAllDrives bool) *FilesCreateCall { 5887 c.urlParams_.Set("supportsAllDrives", fmt.Sprint(supportsAllDrives)) 5888 return c 5889} 5890 5891// SupportsTeamDrives sets the optional parameter "supportsTeamDrives": 5892// Deprecated use supportsAllDrives instead. 5893func (c *FilesCreateCall) SupportsTeamDrives(supportsTeamDrives bool) *FilesCreateCall { 5894 c.urlParams_.Set("supportsTeamDrives", fmt.Sprint(supportsTeamDrives)) 5895 return c 5896} 5897 5898// UseContentAsIndexableText sets the optional parameter 5899// "useContentAsIndexableText": Whether to use the uploaded content as 5900// indexable text. 5901func (c *FilesCreateCall) UseContentAsIndexableText(useContentAsIndexableText bool) *FilesCreateCall { 5902 c.urlParams_.Set("useContentAsIndexableText", fmt.Sprint(useContentAsIndexableText)) 5903 return c 5904} 5905 5906// Media specifies the media to upload in one or more chunks. The chunk 5907// size may be controlled by supplying a MediaOption generated by 5908// googleapi.ChunkSize. The chunk size defaults to 5909// googleapi.DefaultUploadChunkSize.The Content-Type header used in the 5910// upload request will be determined by sniffing the contents of r, 5911// unless a MediaOption generated by googleapi.ContentType is 5912// supplied. 5913// At most one of Media and ResumableMedia may be set. 5914func (c *FilesCreateCall) Media(r io.Reader, options ...googleapi.MediaOption) *FilesCreateCall { 5915 c.mediaInfo_ = gensupport.NewInfoFromMedia(r, options) 5916 return c 5917} 5918 5919// ResumableMedia specifies the media to upload in chunks and can be 5920// canceled with ctx. 5921// 5922// Deprecated: use Media instead. 5923// 5924// At most one of Media and ResumableMedia may be set. mediaType 5925// identifies the MIME media type of the upload, such as "image/png". If 5926// mediaType is "", it will be auto-detected. The provided ctx will 5927// supersede any context previously provided to the Context method. 5928func (c *FilesCreateCall) ResumableMedia(ctx context.Context, r io.ReaderAt, size int64, mediaType string) *FilesCreateCall { 5929 c.ctx_ = ctx 5930 c.mediaInfo_ = gensupport.NewInfoFromResumableMedia(r, size, mediaType) 5931 return c 5932} 5933 5934// ProgressUpdater provides a callback function that will be called 5935// after every chunk. It should be a low-latency function in order to 5936// not slow down the upload operation. This should only be called when 5937// using ResumableMedia (as opposed to Media). 5938func (c *FilesCreateCall) ProgressUpdater(pu googleapi.ProgressUpdater) *FilesCreateCall { 5939 c.mediaInfo_.SetProgressUpdater(pu) 5940 return c 5941} 5942 5943// Fields allows partial responses to be retrieved. See 5944// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 5945// for more information. 5946func (c *FilesCreateCall) Fields(s ...googleapi.Field) *FilesCreateCall { 5947 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 5948 return c 5949} 5950 5951// Context sets the context to be used in this call's Do method. Any 5952// pending HTTP request will be aborted if the provided context is 5953// canceled. 5954// This context will supersede any context previously provided to the 5955// ResumableMedia method. 5956func (c *FilesCreateCall) Context(ctx context.Context) *FilesCreateCall { 5957 c.ctx_ = ctx 5958 return c 5959} 5960 5961// Header returns an http.Header that can be modified by the caller to 5962// add HTTP headers to the request. 5963func (c *FilesCreateCall) Header() http.Header { 5964 if c.header_ == nil { 5965 c.header_ = make(http.Header) 5966 } 5967 return c.header_ 5968} 5969 5970func (c *FilesCreateCall) doRequest(alt string) (*http.Response, error) { 5971 reqHeaders := make(http.Header) 5972 for k, v := range c.header_ { 5973 reqHeaders[k] = v 5974 } 5975 reqHeaders.Set("User-Agent", c.s.userAgent()) 5976 var body io.Reader = nil 5977 body, err := googleapi.WithoutDataWrapper.JSONReader(c.file) 5978 if err != nil { 5979 return nil, err 5980 } 5981 reqHeaders.Set("Content-Type", "application/json") 5982 c.urlParams_.Set("alt", alt) 5983 c.urlParams_.Set("prettyPrint", "false") 5984 urls := googleapi.ResolveRelative(c.s.BasePath, "files") 5985 if c.mediaInfo_ != nil { 5986 urls = strings.Replace(urls, "https://www.googleapis.com/", "https://www.googleapis.com/upload/", 1) 5987 c.urlParams_.Set("uploadType", c.mediaInfo_.UploadType()) 5988 } 5989 if body == nil { 5990 body = new(bytes.Buffer) 5991 reqHeaders.Set("Content-Type", "application/json") 5992 } 5993 body, getBody, cleanup := c.mediaInfo_.UploadRequest(reqHeaders, body) 5994 defer cleanup() 5995 urls += "?" + c.urlParams_.Encode() 5996 req, err := http.NewRequest("POST", urls, body) 5997 if err != nil { 5998 return nil, err 5999 } 6000 req.Header = reqHeaders 6001 req.GetBody = getBody 6002 return gensupport.SendRequest(c.ctx_, c.s.client, req) 6003} 6004 6005// Do executes the "drive.files.create" call. 6006// Exactly one of *File or error will be non-nil. Any non-2xx status 6007// code is an error. Response headers are in either 6008// *File.ServerResponse.Header or (if a response was returned at all) in 6009// error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check 6010// whether the returned error was because http.StatusNotModified was 6011// returned. 6012func (c *FilesCreateCall) Do(opts ...googleapi.CallOption) (*File, error) { 6013 gensupport.SetOptions(c.urlParams_, opts...) 6014 res, err := c.doRequest("json") 6015 if res != nil && res.StatusCode == http.StatusNotModified { 6016 if res.Body != nil { 6017 res.Body.Close() 6018 } 6019 return nil, &googleapi.Error{ 6020 Code: res.StatusCode, 6021 Header: res.Header, 6022 } 6023 } 6024 if err != nil { 6025 return nil, err 6026 } 6027 defer googleapi.CloseBody(res) 6028 if err := googleapi.CheckResponse(res); err != nil { 6029 return nil, err 6030 } 6031 rx := c.mediaInfo_.ResumableUpload(res.Header.Get("Location")) 6032 if rx != nil { 6033 rx.Client = c.s.client 6034 rx.UserAgent = c.s.userAgent() 6035 ctx := c.ctx_ 6036 if ctx == nil { 6037 ctx = context.TODO() 6038 } 6039 res, err = rx.Upload(ctx) 6040 if err != nil { 6041 return nil, err 6042 } 6043 defer res.Body.Close() 6044 if err := googleapi.CheckResponse(res); err != nil { 6045 return nil, err 6046 } 6047 } 6048 ret := &File{ 6049 ServerResponse: googleapi.ServerResponse{ 6050 Header: res.Header, 6051 HTTPStatusCode: res.StatusCode, 6052 }, 6053 } 6054 target := &ret 6055 if err := gensupport.DecodeResponse(target, res); err != nil { 6056 return nil, err 6057 } 6058 return ret, nil 6059 // { 6060 // "description": "Creates a new file.", 6061 // "httpMethod": "POST", 6062 // "id": "drive.files.create", 6063 // "mediaUpload": { 6064 // "accept": [ 6065 // "*/*" 6066 // ], 6067 // "maxSize": "5120GB", 6068 // "protocols": { 6069 // "resumable": { 6070 // "multipart": true, 6071 // "path": "/resumable/upload/drive/v3/files" 6072 // }, 6073 // "simple": { 6074 // "multipart": true, 6075 // "path": "/upload/drive/v3/files" 6076 // } 6077 // } 6078 // }, 6079 // "parameters": { 6080 // "ignoreDefaultVisibility": { 6081 // "default": "false", 6082 // "description": "Whether to ignore the domain's default visibility settings for the created file. Domain administrators can choose to make all uploaded files visible to the domain by default; this parameter bypasses that behavior for the request. Permissions are still inherited from parent folders.", 6083 // "location": "query", 6084 // "type": "boolean" 6085 // }, 6086 // "keepRevisionForever": { 6087 // "default": "false", 6088 // "description": "Whether to set the 'keepForever' field in the new head revision. This is only applicable to files with binary content in Google Drive.", 6089 // "location": "query", 6090 // "type": "boolean" 6091 // }, 6092 // "ocrLanguage": { 6093 // "description": "A language hint for OCR processing during image import (ISO 639-1 code).", 6094 // "location": "query", 6095 // "type": "string" 6096 // }, 6097 // "supportsAllDrives": { 6098 // "default": "false", 6099 // "description": "Deprecated - Whether the requesting application supports both My Drives and shared drives. This parameter will only be effective until June 1, 2020. Afterwards all applications are assumed to support shared drives.", 6100 // "location": "query", 6101 // "type": "boolean" 6102 // }, 6103 // "supportsTeamDrives": { 6104 // "default": "false", 6105 // "description": "Deprecated use supportsAllDrives instead.", 6106 // "location": "query", 6107 // "type": "boolean" 6108 // }, 6109 // "useContentAsIndexableText": { 6110 // "default": "false", 6111 // "description": "Whether to use the uploaded content as indexable text.", 6112 // "location": "query", 6113 // "type": "boolean" 6114 // } 6115 // }, 6116 // "path": "files", 6117 // "request": { 6118 // "$ref": "File" 6119 // }, 6120 // "response": { 6121 // "$ref": "File" 6122 // }, 6123 // "scopes": [ 6124 // "https://www.googleapis.com/auth/drive", 6125 // "https://www.googleapis.com/auth/drive.appdata", 6126 // "https://www.googleapis.com/auth/drive.file" 6127 // ], 6128 // "supportsMediaUpload": true, 6129 // "supportsSubscription": true 6130 // } 6131 6132} 6133 6134// method id "drive.files.delete": 6135 6136type FilesDeleteCall struct { 6137 s *Service 6138 fileId string 6139 urlParams_ gensupport.URLParams 6140 ctx_ context.Context 6141 header_ http.Header 6142} 6143 6144// Delete: Permanently deletes a file owned by the user without moving 6145// it to the trash. If the file belongs to a shared drive the user must 6146// be an organizer on the parent. If the target is a folder, all 6147// descendants owned by the user are also deleted. 6148func (r *FilesService) Delete(fileId string) *FilesDeleteCall { 6149 c := &FilesDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)} 6150 c.fileId = fileId 6151 return c 6152} 6153 6154// SupportsAllDrives sets the optional parameter "supportsAllDrives": 6155// Deprecated - Whether the requesting application supports both My 6156// Drives and shared drives. This parameter will only be effective until 6157// June 1, 2020. Afterwards all applications are assumed to support 6158// shared drives. 6159func (c *FilesDeleteCall) SupportsAllDrives(supportsAllDrives bool) *FilesDeleteCall { 6160 c.urlParams_.Set("supportsAllDrives", fmt.Sprint(supportsAllDrives)) 6161 return c 6162} 6163 6164// SupportsTeamDrives sets the optional parameter "supportsTeamDrives": 6165// Deprecated use supportsAllDrives instead. 6166func (c *FilesDeleteCall) SupportsTeamDrives(supportsTeamDrives bool) *FilesDeleteCall { 6167 c.urlParams_.Set("supportsTeamDrives", fmt.Sprint(supportsTeamDrives)) 6168 return c 6169} 6170 6171// Fields allows partial responses to be retrieved. See 6172// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 6173// for more information. 6174func (c *FilesDeleteCall) Fields(s ...googleapi.Field) *FilesDeleteCall { 6175 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 6176 return c 6177} 6178 6179// Context sets the context to be used in this call's Do method. Any 6180// pending HTTP request will be aborted if the provided context is 6181// canceled. 6182func (c *FilesDeleteCall) Context(ctx context.Context) *FilesDeleteCall { 6183 c.ctx_ = ctx 6184 return c 6185} 6186 6187// Header returns an http.Header that can be modified by the caller to 6188// add HTTP headers to the request. 6189func (c *FilesDeleteCall) Header() http.Header { 6190 if c.header_ == nil { 6191 c.header_ = make(http.Header) 6192 } 6193 return c.header_ 6194} 6195 6196func (c *FilesDeleteCall) doRequest(alt string) (*http.Response, error) { 6197 reqHeaders := make(http.Header) 6198 for k, v := range c.header_ { 6199 reqHeaders[k] = v 6200 } 6201 reqHeaders.Set("User-Agent", c.s.userAgent()) 6202 var body io.Reader = nil 6203 c.urlParams_.Set("alt", alt) 6204 c.urlParams_.Set("prettyPrint", "false") 6205 urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}") 6206 urls += "?" + c.urlParams_.Encode() 6207 req, err := http.NewRequest("DELETE", urls, body) 6208 if err != nil { 6209 return nil, err 6210 } 6211 req.Header = reqHeaders 6212 googleapi.Expand(req.URL, map[string]string{ 6213 "fileId": c.fileId, 6214 }) 6215 return gensupport.SendRequest(c.ctx_, c.s.client, req) 6216} 6217 6218// Do executes the "drive.files.delete" call. 6219func (c *FilesDeleteCall) Do(opts ...googleapi.CallOption) error { 6220 gensupport.SetOptions(c.urlParams_, opts...) 6221 res, err := c.doRequest("json") 6222 if err != nil { 6223 return err 6224 } 6225 defer googleapi.CloseBody(res) 6226 if err := googleapi.CheckResponse(res); err != nil { 6227 return err 6228 } 6229 return nil 6230 // { 6231 // "description": "Permanently deletes a file owned by the user without moving it to the trash. If the file belongs to a shared drive the user must be an organizer on the parent. If the target is a folder, all descendants owned by the user are also deleted.", 6232 // "httpMethod": "DELETE", 6233 // "id": "drive.files.delete", 6234 // "parameterOrder": [ 6235 // "fileId" 6236 // ], 6237 // "parameters": { 6238 // "fileId": { 6239 // "description": "The ID of the file.", 6240 // "location": "path", 6241 // "required": true, 6242 // "type": "string" 6243 // }, 6244 // "supportsAllDrives": { 6245 // "default": "false", 6246 // "description": "Deprecated - Whether the requesting application supports both My Drives and shared drives. This parameter will only be effective until June 1, 2020. Afterwards all applications are assumed to support shared drives.", 6247 // "location": "query", 6248 // "type": "boolean" 6249 // }, 6250 // "supportsTeamDrives": { 6251 // "default": "false", 6252 // "description": "Deprecated use supportsAllDrives instead.", 6253 // "location": "query", 6254 // "type": "boolean" 6255 // } 6256 // }, 6257 // "path": "files/{fileId}", 6258 // "scopes": [ 6259 // "https://www.googleapis.com/auth/drive", 6260 // "https://www.googleapis.com/auth/drive.appdata", 6261 // "https://www.googleapis.com/auth/drive.file" 6262 // ] 6263 // } 6264 6265} 6266 6267// method id "drive.files.emptyTrash": 6268 6269type FilesEmptyTrashCall struct { 6270 s *Service 6271 urlParams_ gensupport.URLParams 6272 ctx_ context.Context 6273 header_ http.Header 6274} 6275 6276// EmptyTrash: Permanently deletes all of the user's trashed files. 6277func (r *FilesService) EmptyTrash() *FilesEmptyTrashCall { 6278 c := &FilesEmptyTrashCall{s: r.s, urlParams_: make(gensupport.URLParams)} 6279 return c 6280} 6281 6282// Fields allows partial responses to be retrieved. See 6283// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 6284// for more information. 6285func (c *FilesEmptyTrashCall) Fields(s ...googleapi.Field) *FilesEmptyTrashCall { 6286 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 6287 return c 6288} 6289 6290// Context sets the context to be used in this call's Do method. Any 6291// pending HTTP request will be aborted if the provided context is 6292// canceled. 6293func (c *FilesEmptyTrashCall) Context(ctx context.Context) *FilesEmptyTrashCall { 6294 c.ctx_ = ctx 6295 return c 6296} 6297 6298// Header returns an http.Header that can be modified by the caller to 6299// add HTTP headers to the request. 6300func (c *FilesEmptyTrashCall) Header() http.Header { 6301 if c.header_ == nil { 6302 c.header_ = make(http.Header) 6303 } 6304 return c.header_ 6305} 6306 6307func (c *FilesEmptyTrashCall) doRequest(alt string) (*http.Response, error) { 6308 reqHeaders := make(http.Header) 6309 for k, v := range c.header_ { 6310 reqHeaders[k] = v 6311 } 6312 reqHeaders.Set("User-Agent", c.s.userAgent()) 6313 var body io.Reader = nil 6314 c.urlParams_.Set("alt", alt) 6315 c.urlParams_.Set("prettyPrint", "false") 6316 urls := googleapi.ResolveRelative(c.s.BasePath, "files/trash") 6317 urls += "?" + c.urlParams_.Encode() 6318 req, err := http.NewRequest("DELETE", urls, body) 6319 if err != nil { 6320 return nil, err 6321 } 6322 req.Header = reqHeaders 6323 return gensupport.SendRequest(c.ctx_, c.s.client, req) 6324} 6325 6326// Do executes the "drive.files.emptyTrash" call. 6327func (c *FilesEmptyTrashCall) Do(opts ...googleapi.CallOption) error { 6328 gensupport.SetOptions(c.urlParams_, opts...) 6329 res, err := c.doRequest("json") 6330 if err != nil { 6331 return err 6332 } 6333 defer googleapi.CloseBody(res) 6334 if err := googleapi.CheckResponse(res); err != nil { 6335 return err 6336 } 6337 return nil 6338 // { 6339 // "description": "Permanently deletes all of the user's trashed files.", 6340 // "httpMethod": "DELETE", 6341 // "id": "drive.files.emptyTrash", 6342 // "path": "files/trash", 6343 // "scopes": [ 6344 // "https://www.googleapis.com/auth/drive" 6345 // ] 6346 // } 6347 6348} 6349 6350// method id "drive.files.export": 6351 6352type FilesExportCall struct { 6353 s *Service 6354 fileId string 6355 urlParams_ gensupport.URLParams 6356 ifNoneMatch_ string 6357 ctx_ context.Context 6358 header_ http.Header 6359} 6360 6361// Export: Exports a Google Doc to the requested MIME type and returns 6362// the exported content. Please note that the exported content is 6363// limited to 10MB. 6364func (r *FilesService) Export(fileId string, mimeType string) *FilesExportCall { 6365 c := &FilesExportCall{s: r.s, urlParams_: make(gensupport.URLParams)} 6366 c.fileId = fileId 6367 c.urlParams_.Set("mimeType", mimeType) 6368 return c 6369} 6370 6371// Fields allows partial responses to be retrieved. See 6372// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 6373// for more information. 6374func (c *FilesExportCall) Fields(s ...googleapi.Field) *FilesExportCall { 6375 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 6376 return c 6377} 6378 6379// IfNoneMatch sets the optional parameter which makes the operation 6380// fail if the object's ETag matches the given value. This is useful for 6381// getting updates only after the object has changed since the last 6382// request. Use googleapi.IsNotModified to check whether the response 6383// error from Do is the result of In-None-Match. 6384func (c *FilesExportCall) IfNoneMatch(entityTag string) *FilesExportCall { 6385 c.ifNoneMatch_ = entityTag 6386 return c 6387} 6388 6389// Context sets the context to be used in this call's Do and Download 6390// methods. Any pending HTTP request will be aborted if the provided 6391// context is canceled. 6392func (c *FilesExportCall) Context(ctx context.Context) *FilesExportCall { 6393 c.ctx_ = ctx 6394 return c 6395} 6396 6397// Header returns an http.Header that can be modified by the caller to 6398// add HTTP headers to the request. 6399func (c *FilesExportCall) Header() http.Header { 6400 if c.header_ == nil { 6401 c.header_ = make(http.Header) 6402 } 6403 return c.header_ 6404} 6405 6406func (c *FilesExportCall) doRequest(alt string) (*http.Response, error) { 6407 reqHeaders := make(http.Header) 6408 for k, v := range c.header_ { 6409 reqHeaders[k] = v 6410 } 6411 reqHeaders.Set("User-Agent", c.s.userAgent()) 6412 if c.ifNoneMatch_ != "" { 6413 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 6414 } 6415 var body io.Reader = nil 6416 c.urlParams_.Set("alt", alt) 6417 c.urlParams_.Set("prettyPrint", "false") 6418 urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/export") 6419 urls += "?" + c.urlParams_.Encode() 6420 req, err := http.NewRequest("GET", urls, body) 6421 if err != nil { 6422 return nil, err 6423 } 6424 req.Header = reqHeaders 6425 googleapi.Expand(req.URL, map[string]string{ 6426 "fileId": c.fileId, 6427 }) 6428 return gensupport.SendRequest(c.ctx_, c.s.client, req) 6429} 6430 6431// Download fetches the API endpoint's "media" value, instead of the normal 6432// API response value. If the returned error is nil, the Response is guaranteed to 6433// have a 2xx status code. Callers must close the Response.Body as usual. 6434func (c *FilesExportCall) Download(opts ...googleapi.CallOption) (*http.Response, error) { 6435 gensupport.SetOptions(c.urlParams_, opts...) 6436 res, err := c.doRequest("media") 6437 if err != nil { 6438 return nil, err 6439 } 6440 if err := googleapi.CheckMediaResponse(res); err != nil { 6441 res.Body.Close() 6442 return nil, err 6443 } 6444 return res, nil 6445} 6446 6447// Do executes the "drive.files.export" call. 6448func (c *FilesExportCall) Do(opts ...googleapi.CallOption) error { 6449 gensupport.SetOptions(c.urlParams_, opts...) 6450 res, err := c.doRequest("json") 6451 if err != nil { 6452 return err 6453 } 6454 defer googleapi.CloseBody(res) 6455 if err := googleapi.CheckResponse(res); err != nil { 6456 return err 6457 } 6458 return nil 6459 // { 6460 // "description": "Exports a Google Doc to the requested MIME type and returns the exported content. Please note that the exported content is limited to 10MB.", 6461 // "httpMethod": "GET", 6462 // "id": "drive.files.export", 6463 // "parameterOrder": [ 6464 // "fileId", 6465 // "mimeType" 6466 // ], 6467 // "parameters": { 6468 // "fileId": { 6469 // "description": "The ID of the file.", 6470 // "location": "path", 6471 // "required": true, 6472 // "type": "string" 6473 // }, 6474 // "mimeType": { 6475 // "description": "The MIME type of the format requested for this export.", 6476 // "location": "query", 6477 // "required": true, 6478 // "type": "string" 6479 // } 6480 // }, 6481 // "path": "files/{fileId}/export", 6482 // "scopes": [ 6483 // "https://www.googleapis.com/auth/drive", 6484 // "https://www.googleapis.com/auth/drive.file", 6485 // "https://www.googleapis.com/auth/drive.readonly" 6486 // ], 6487 // "supportsMediaDownload": true 6488 // } 6489 6490} 6491 6492// method id "drive.files.generateIds": 6493 6494type FilesGenerateIdsCall struct { 6495 s *Service 6496 urlParams_ gensupport.URLParams 6497 ifNoneMatch_ string 6498 ctx_ context.Context 6499 header_ http.Header 6500} 6501 6502// GenerateIds: Generates a set of file IDs which can be provided in 6503// create requests. 6504func (r *FilesService) GenerateIds() *FilesGenerateIdsCall { 6505 c := &FilesGenerateIdsCall{s: r.s, urlParams_: make(gensupport.URLParams)} 6506 return c 6507} 6508 6509// Count sets the optional parameter "count": The number of IDs to 6510// return. 6511func (c *FilesGenerateIdsCall) Count(count int64) *FilesGenerateIdsCall { 6512 c.urlParams_.Set("count", fmt.Sprint(count)) 6513 return c 6514} 6515 6516// Space sets the optional parameter "space": The space in which the IDs 6517// can be used to create new files. Supported values are 'drive' and 6518// 'appDataFolder'. 6519func (c *FilesGenerateIdsCall) Space(space string) *FilesGenerateIdsCall { 6520 c.urlParams_.Set("space", space) 6521 return c 6522} 6523 6524// Fields allows partial responses to be retrieved. See 6525// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 6526// for more information. 6527func (c *FilesGenerateIdsCall) Fields(s ...googleapi.Field) *FilesGenerateIdsCall { 6528 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 6529 return c 6530} 6531 6532// IfNoneMatch sets the optional parameter which makes the operation 6533// fail if the object's ETag matches the given value. This is useful for 6534// getting updates only after the object has changed since the last 6535// request. Use googleapi.IsNotModified to check whether the response 6536// error from Do is the result of In-None-Match. 6537func (c *FilesGenerateIdsCall) IfNoneMatch(entityTag string) *FilesGenerateIdsCall { 6538 c.ifNoneMatch_ = entityTag 6539 return c 6540} 6541 6542// Context sets the context to be used in this call's Do method. Any 6543// pending HTTP request will be aborted if the provided context is 6544// canceled. 6545func (c *FilesGenerateIdsCall) Context(ctx context.Context) *FilesGenerateIdsCall { 6546 c.ctx_ = ctx 6547 return c 6548} 6549 6550// Header returns an http.Header that can be modified by the caller to 6551// add HTTP headers to the request. 6552func (c *FilesGenerateIdsCall) Header() http.Header { 6553 if c.header_ == nil { 6554 c.header_ = make(http.Header) 6555 } 6556 return c.header_ 6557} 6558 6559func (c *FilesGenerateIdsCall) doRequest(alt string) (*http.Response, error) { 6560 reqHeaders := make(http.Header) 6561 for k, v := range c.header_ { 6562 reqHeaders[k] = v 6563 } 6564 reqHeaders.Set("User-Agent", c.s.userAgent()) 6565 if c.ifNoneMatch_ != "" { 6566 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 6567 } 6568 var body io.Reader = nil 6569 c.urlParams_.Set("alt", alt) 6570 c.urlParams_.Set("prettyPrint", "false") 6571 urls := googleapi.ResolveRelative(c.s.BasePath, "files/generateIds") 6572 urls += "?" + c.urlParams_.Encode() 6573 req, err := http.NewRequest("GET", urls, body) 6574 if err != nil { 6575 return nil, err 6576 } 6577 req.Header = reqHeaders 6578 return gensupport.SendRequest(c.ctx_, c.s.client, req) 6579} 6580 6581// Do executes the "drive.files.generateIds" call. 6582// Exactly one of *GeneratedIds or error will be non-nil. Any non-2xx 6583// status code is an error. Response headers are in either 6584// *GeneratedIds.ServerResponse.Header or (if a response was returned at 6585// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 6586// to check whether the returned error was because 6587// http.StatusNotModified was returned. 6588func (c *FilesGenerateIdsCall) Do(opts ...googleapi.CallOption) (*GeneratedIds, error) { 6589 gensupport.SetOptions(c.urlParams_, opts...) 6590 res, err := c.doRequest("json") 6591 if res != nil && res.StatusCode == http.StatusNotModified { 6592 if res.Body != nil { 6593 res.Body.Close() 6594 } 6595 return nil, &googleapi.Error{ 6596 Code: res.StatusCode, 6597 Header: res.Header, 6598 } 6599 } 6600 if err != nil { 6601 return nil, err 6602 } 6603 defer googleapi.CloseBody(res) 6604 if err := googleapi.CheckResponse(res); err != nil { 6605 return nil, err 6606 } 6607 ret := &GeneratedIds{ 6608 ServerResponse: googleapi.ServerResponse{ 6609 Header: res.Header, 6610 HTTPStatusCode: res.StatusCode, 6611 }, 6612 } 6613 target := &ret 6614 if err := gensupport.DecodeResponse(target, res); err != nil { 6615 return nil, err 6616 } 6617 return ret, nil 6618 // { 6619 // "description": "Generates a set of file IDs which can be provided in create requests.", 6620 // "httpMethod": "GET", 6621 // "id": "drive.files.generateIds", 6622 // "parameters": { 6623 // "count": { 6624 // "default": "10", 6625 // "description": "The number of IDs to return.", 6626 // "format": "int32", 6627 // "location": "query", 6628 // "maximum": "1000", 6629 // "minimum": "1", 6630 // "type": "integer" 6631 // }, 6632 // "space": { 6633 // "default": "drive", 6634 // "description": "The space in which the IDs can be used to create new files. Supported values are 'drive' and 'appDataFolder'.", 6635 // "location": "query", 6636 // "type": "string" 6637 // } 6638 // }, 6639 // "path": "files/generateIds", 6640 // "response": { 6641 // "$ref": "GeneratedIds" 6642 // }, 6643 // "scopes": [ 6644 // "https://www.googleapis.com/auth/drive", 6645 // "https://www.googleapis.com/auth/drive.appdata", 6646 // "https://www.googleapis.com/auth/drive.file" 6647 // ] 6648 // } 6649 6650} 6651 6652// method id "drive.files.get": 6653 6654type FilesGetCall struct { 6655 s *Service 6656 fileId string 6657 urlParams_ gensupport.URLParams 6658 ifNoneMatch_ string 6659 ctx_ context.Context 6660 header_ http.Header 6661} 6662 6663// Get: Gets a file's metadata or content by ID. 6664func (r *FilesService) Get(fileId string) *FilesGetCall { 6665 c := &FilesGetCall{s: r.s, urlParams_: make(gensupport.URLParams)} 6666 c.fileId = fileId 6667 return c 6668} 6669 6670// AcknowledgeAbuse sets the optional parameter "acknowledgeAbuse": 6671// Whether the user is acknowledging the risk of downloading known 6672// malware or other abusive files. This is only applicable when 6673// alt=media. 6674func (c *FilesGetCall) AcknowledgeAbuse(acknowledgeAbuse bool) *FilesGetCall { 6675 c.urlParams_.Set("acknowledgeAbuse", fmt.Sprint(acknowledgeAbuse)) 6676 return c 6677} 6678 6679// SupportsAllDrives sets the optional parameter "supportsAllDrives": 6680// Deprecated - Whether the requesting application supports both My 6681// Drives and shared drives. This parameter will only be effective until 6682// June 1, 2020. Afterwards all applications are assumed to support 6683// shared drives. 6684func (c *FilesGetCall) SupportsAllDrives(supportsAllDrives bool) *FilesGetCall { 6685 c.urlParams_.Set("supportsAllDrives", fmt.Sprint(supportsAllDrives)) 6686 return c 6687} 6688 6689// SupportsTeamDrives sets the optional parameter "supportsTeamDrives": 6690// Deprecated use supportsAllDrives instead. 6691func (c *FilesGetCall) SupportsTeamDrives(supportsTeamDrives bool) *FilesGetCall { 6692 c.urlParams_.Set("supportsTeamDrives", fmt.Sprint(supportsTeamDrives)) 6693 return c 6694} 6695 6696// Fields allows partial responses to be retrieved. See 6697// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 6698// for more information. 6699func (c *FilesGetCall) Fields(s ...googleapi.Field) *FilesGetCall { 6700 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 6701 return c 6702} 6703 6704// IfNoneMatch sets the optional parameter which makes the operation 6705// fail if the object's ETag matches the given value. This is useful for 6706// getting updates only after the object has changed since the last 6707// request. Use googleapi.IsNotModified to check whether the response 6708// error from Do is the result of In-None-Match. 6709func (c *FilesGetCall) IfNoneMatch(entityTag string) *FilesGetCall { 6710 c.ifNoneMatch_ = entityTag 6711 return c 6712} 6713 6714// Context sets the context to be used in this call's Do and Download 6715// methods. Any pending HTTP request will be aborted if the provided 6716// context is canceled. 6717func (c *FilesGetCall) Context(ctx context.Context) *FilesGetCall { 6718 c.ctx_ = ctx 6719 return c 6720} 6721 6722// Header returns an http.Header that can be modified by the caller to 6723// add HTTP headers to the request. 6724func (c *FilesGetCall) Header() http.Header { 6725 if c.header_ == nil { 6726 c.header_ = make(http.Header) 6727 } 6728 return c.header_ 6729} 6730 6731func (c *FilesGetCall) doRequest(alt string) (*http.Response, error) { 6732 reqHeaders := make(http.Header) 6733 for k, v := range c.header_ { 6734 reqHeaders[k] = v 6735 } 6736 reqHeaders.Set("User-Agent", c.s.userAgent()) 6737 if c.ifNoneMatch_ != "" { 6738 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 6739 } 6740 var body io.Reader = nil 6741 c.urlParams_.Set("alt", alt) 6742 c.urlParams_.Set("prettyPrint", "false") 6743 urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}") 6744 urls += "?" + c.urlParams_.Encode() 6745 req, err := http.NewRequest("GET", urls, body) 6746 if err != nil { 6747 return nil, err 6748 } 6749 req.Header = reqHeaders 6750 googleapi.Expand(req.URL, map[string]string{ 6751 "fileId": c.fileId, 6752 }) 6753 return gensupport.SendRequest(c.ctx_, c.s.client, req) 6754} 6755 6756// Download fetches the API endpoint's "media" value, instead of the normal 6757// API response value. If the returned error is nil, the Response is guaranteed to 6758// have a 2xx status code. Callers must close the Response.Body as usual. 6759func (c *FilesGetCall) Download(opts ...googleapi.CallOption) (*http.Response, error) { 6760 gensupport.SetOptions(c.urlParams_, opts...) 6761 res, err := c.doRequest("media") 6762 if err != nil { 6763 return nil, err 6764 } 6765 if err := googleapi.CheckMediaResponse(res); err != nil { 6766 res.Body.Close() 6767 return nil, err 6768 } 6769 return res, nil 6770} 6771 6772// Do executes the "drive.files.get" call. 6773// Exactly one of *File or error will be non-nil. Any non-2xx status 6774// code is an error. Response headers are in either 6775// *File.ServerResponse.Header or (if a response was returned at all) in 6776// error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check 6777// whether the returned error was because http.StatusNotModified was 6778// returned. 6779func (c *FilesGetCall) Do(opts ...googleapi.CallOption) (*File, error) { 6780 gensupport.SetOptions(c.urlParams_, opts...) 6781 res, err := c.doRequest("json") 6782 if res != nil && res.StatusCode == http.StatusNotModified { 6783 if res.Body != nil { 6784 res.Body.Close() 6785 } 6786 return nil, &googleapi.Error{ 6787 Code: res.StatusCode, 6788 Header: res.Header, 6789 } 6790 } 6791 if err != nil { 6792 return nil, err 6793 } 6794 defer googleapi.CloseBody(res) 6795 if err := googleapi.CheckResponse(res); err != nil { 6796 return nil, err 6797 } 6798 ret := &File{ 6799 ServerResponse: googleapi.ServerResponse{ 6800 Header: res.Header, 6801 HTTPStatusCode: res.StatusCode, 6802 }, 6803 } 6804 target := &ret 6805 if err := gensupport.DecodeResponse(target, res); err != nil { 6806 return nil, err 6807 } 6808 return ret, nil 6809 // { 6810 // "description": "Gets a file's metadata or content by ID.", 6811 // "httpMethod": "GET", 6812 // "id": "drive.files.get", 6813 // "parameterOrder": [ 6814 // "fileId" 6815 // ], 6816 // "parameters": { 6817 // "acknowledgeAbuse": { 6818 // "default": "false", 6819 // "description": "Whether the user is acknowledging the risk of downloading known malware or other abusive files. This is only applicable when alt=media.", 6820 // "location": "query", 6821 // "type": "boolean" 6822 // }, 6823 // "fileId": { 6824 // "description": "The ID of the file.", 6825 // "location": "path", 6826 // "required": true, 6827 // "type": "string" 6828 // }, 6829 // "supportsAllDrives": { 6830 // "default": "false", 6831 // "description": "Deprecated - Whether the requesting application supports both My Drives and shared drives. This parameter will only be effective until June 1, 2020. Afterwards all applications are assumed to support shared drives.", 6832 // "location": "query", 6833 // "type": "boolean" 6834 // }, 6835 // "supportsTeamDrives": { 6836 // "default": "false", 6837 // "description": "Deprecated use supportsAllDrives instead.", 6838 // "location": "query", 6839 // "type": "boolean" 6840 // } 6841 // }, 6842 // "path": "files/{fileId}", 6843 // "response": { 6844 // "$ref": "File" 6845 // }, 6846 // "scopes": [ 6847 // "https://www.googleapis.com/auth/drive", 6848 // "https://www.googleapis.com/auth/drive.appdata", 6849 // "https://www.googleapis.com/auth/drive.file", 6850 // "https://www.googleapis.com/auth/drive.metadata", 6851 // "https://www.googleapis.com/auth/drive.metadata.readonly", 6852 // "https://www.googleapis.com/auth/drive.photos.readonly", 6853 // "https://www.googleapis.com/auth/drive.readonly" 6854 // ], 6855 // "supportsMediaDownload": true, 6856 // "supportsSubscription": true, 6857 // "useMediaDownloadService": true 6858 // } 6859 6860} 6861 6862// method id "drive.files.list": 6863 6864type FilesListCall struct { 6865 s *Service 6866 urlParams_ gensupport.URLParams 6867 ifNoneMatch_ string 6868 ctx_ context.Context 6869 header_ http.Header 6870} 6871 6872// List: Lists or searches files. 6873func (r *FilesService) List() *FilesListCall { 6874 c := &FilesListCall{s: r.s, urlParams_: make(gensupport.URLParams)} 6875 return c 6876} 6877 6878// Corpora sets the optional parameter "corpora": Bodies of items 6879// (files/documents) to which the query applies. Supported bodies are 6880// 'user', 'domain', 'drive' and 'allDrives'. Prefer 'user' or 'drive' 6881// to 'allDrives' for efficiency. 6882func (c *FilesListCall) Corpora(corpora string) *FilesListCall { 6883 c.urlParams_.Set("corpora", corpora) 6884 return c 6885} 6886 6887// Corpus sets the optional parameter "corpus": The source of files to 6888// list. Deprecated: use 'corpora' instead. 6889// 6890// Possible values: 6891// "domain" - Files shared to the user's domain. 6892// "user" - Files owned by or shared to the user. 6893func (c *FilesListCall) Corpus(corpus string) *FilesListCall { 6894 c.urlParams_.Set("corpus", corpus) 6895 return c 6896} 6897 6898// DriveId sets the optional parameter "driveId": ID of the shared drive 6899// to search. 6900func (c *FilesListCall) DriveId(driveId string) *FilesListCall { 6901 c.urlParams_.Set("driveId", driveId) 6902 return c 6903} 6904 6905// IncludeItemsFromAllDrives sets the optional parameter 6906// "includeItemsFromAllDrives": Deprecated - Whether both My Drive and 6907// shared drive items should be included in results. This parameter will 6908// only be effective until June 1, 2020. Afterwards shared drive items 6909// will be included in the results. 6910func (c *FilesListCall) IncludeItemsFromAllDrives(includeItemsFromAllDrives bool) *FilesListCall { 6911 c.urlParams_.Set("includeItemsFromAllDrives", fmt.Sprint(includeItemsFromAllDrives)) 6912 return c 6913} 6914 6915// IncludeTeamDriveItems sets the optional parameter 6916// "includeTeamDriveItems": Deprecated use includeItemsFromAllDrives 6917// instead. 6918func (c *FilesListCall) IncludeTeamDriveItems(includeTeamDriveItems bool) *FilesListCall { 6919 c.urlParams_.Set("includeTeamDriveItems", fmt.Sprint(includeTeamDriveItems)) 6920 return c 6921} 6922 6923// OrderBy sets the optional parameter "orderBy": A comma-separated list 6924// of sort keys. Valid keys are 'createdTime', 'folder', 6925// 'modifiedByMeTime', 'modifiedTime', 'name', 'name_natural', 6926// 'quotaBytesUsed', 'recency', 'sharedWithMeTime', 'starred', and 6927// 'viewedByMeTime'. Each key sorts ascending by default, but may be 6928// reversed with the 'desc' modifier. Example usage: 6929// ?orderBy=folder,modifiedTime desc,name. Please note that there is a 6930// current limitation for users with approximately one million files in 6931// which the requested sort order is ignored. 6932func (c *FilesListCall) OrderBy(orderBy string) *FilesListCall { 6933 c.urlParams_.Set("orderBy", orderBy) 6934 return c 6935} 6936 6937// PageSize sets the optional parameter "pageSize": The maximum number 6938// of files to return per page. Partial or empty result pages are 6939// possible even before the end of the files list has been reached. 6940func (c *FilesListCall) PageSize(pageSize int64) *FilesListCall { 6941 c.urlParams_.Set("pageSize", fmt.Sprint(pageSize)) 6942 return c 6943} 6944 6945// PageToken sets the optional parameter "pageToken": The token for 6946// continuing a previous list request on the next page. This should be 6947// set to the value of 'nextPageToken' from the previous response. 6948func (c *FilesListCall) PageToken(pageToken string) *FilesListCall { 6949 c.urlParams_.Set("pageToken", pageToken) 6950 return c 6951} 6952 6953// Q sets the optional parameter "q": A query for filtering the file 6954// results. See the "Search for Files" guide for supported syntax. 6955func (c *FilesListCall) Q(q string) *FilesListCall { 6956 c.urlParams_.Set("q", q) 6957 return c 6958} 6959 6960// Spaces sets the optional parameter "spaces": A comma-separated list 6961// of spaces to query within the corpus. Supported values are 'drive', 6962// 'appDataFolder' and 'photos'. 6963func (c *FilesListCall) Spaces(spaces string) *FilesListCall { 6964 c.urlParams_.Set("spaces", spaces) 6965 return c 6966} 6967 6968// SupportsAllDrives sets the optional parameter "supportsAllDrives": 6969// Deprecated - Whether the requesting application supports both My 6970// Drives and shared drives. This parameter will only be effective until 6971// June 1, 2020. Afterwards all applications are assumed to support 6972// shared drives. 6973func (c *FilesListCall) SupportsAllDrives(supportsAllDrives bool) *FilesListCall { 6974 c.urlParams_.Set("supportsAllDrives", fmt.Sprint(supportsAllDrives)) 6975 return c 6976} 6977 6978// SupportsTeamDrives sets the optional parameter "supportsTeamDrives": 6979// Deprecated use supportsAllDrives instead. 6980func (c *FilesListCall) SupportsTeamDrives(supportsTeamDrives bool) *FilesListCall { 6981 c.urlParams_.Set("supportsTeamDrives", fmt.Sprint(supportsTeamDrives)) 6982 return c 6983} 6984 6985// TeamDriveId sets the optional parameter "teamDriveId": Deprecated use 6986// driveId instead. 6987func (c *FilesListCall) TeamDriveId(teamDriveId string) *FilesListCall { 6988 c.urlParams_.Set("teamDriveId", teamDriveId) 6989 return c 6990} 6991 6992// Fields allows partial responses to be retrieved. See 6993// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 6994// for more information. 6995func (c *FilesListCall) Fields(s ...googleapi.Field) *FilesListCall { 6996 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 6997 return c 6998} 6999 7000// IfNoneMatch sets the optional parameter which makes the operation 7001// fail if the object's ETag matches the given value. This is useful for 7002// getting updates only after the object has changed since the last 7003// request. Use googleapi.IsNotModified to check whether the response 7004// error from Do is the result of In-None-Match. 7005func (c *FilesListCall) IfNoneMatch(entityTag string) *FilesListCall { 7006 c.ifNoneMatch_ = entityTag 7007 return c 7008} 7009 7010// Context sets the context to be used in this call's Do method. Any 7011// pending HTTP request will be aborted if the provided context is 7012// canceled. 7013func (c *FilesListCall) Context(ctx context.Context) *FilesListCall { 7014 c.ctx_ = ctx 7015 return c 7016} 7017 7018// Header returns an http.Header that can be modified by the caller to 7019// add HTTP headers to the request. 7020func (c *FilesListCall) Header() http.Header { 7021 if c.header_ == nil { 7022 c.header_ = make(http.Header) 7023 } 7024 return c.header_ 7025} 7026 7027func (c *FilesListCall) doRequest(alt string) (*http.Response, error) { 7028 reqHeaders := make(http.Header) 7029 for k, v := range c.header_ { 7030 reqHeaders[k] = v 7031 } 7032 reqHeaders.Set("User-Agent", c.s.userAgent()) 7033 if c.ifNoneMatch_ != "" { 7034 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 7035 } 7036 var body io.Reader = nil 7037 c.urlParams_.Set("alt", alt) 7038 c.urlParams_.Set("prettyPrint", "false") 7039 urls := googleapi.ResolveRelative(c.s.BasePath, "files") 7040 urls += "?" + c.urlParams_.Encode() 7041 req, err := http.NewRequest("GET", urls, body) 7042 if err != nil { 7043 return nil, err 7044 } 7045 req.Header = reqHeaders 7046 return gensupport.SendRequest(c.ctx_, c.s.client, req) 7047} 7048 7049// Do executes the "drive.files.list" call. 7050// Exactly one of *FileList or error will be non-nil. Any non-2xx status 7051// code is an error. Response headers are in either 7052// *FileList.ServerResponse.Header or (if a response was returned at 7053// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 7054// to check whether the returned error was because 7055// http.StatusNotModified was returned. 7056func (c *FilesListCall) Do(opts ...googleapi.CallOption) (*FileList, error) { 7057 gensupport.SetOptions(c.urlParams_, opts...) 7058 res, err := c.doRequest("json") 7059 if res != nil && res.StatusCode == http.StatusNotModified { 7060 if res.Body != nil { 7061 res.Body.Close() 7062 } 7063 return nil, &googleapi.Error{ 7064 Code: res.StatusCode, 7065 Header: res.Header, 7066 } 7067 } 7068 if err != nil { 7069 return nil, err 7070 } 7071 defer googleapi.CloseBody(res) 7072 if err := googleapi.CheckResponse(res); err != nil { 7073 return nil, err 7074 } 7075 ret := &FileList{ 7076 ServerResponse: googleapi.ServerResponse{ 7077 Header: res.Header, 7078 HTTPStatusCode: res.StatusCode, 7079 }, 7080 } 7081 target := &ret 7082 if err := gensupport.DecodeResponse(target, res); err != nil { 7083 return nil, err 7084 } 7085 return ret, nil 7086 // { 7087 // "description": "Lists or searches files.", 7088 // "httpMethod": "GET", 7089 // "id": "drive.files.list", 7090 // "parameters": { 7091 // "corpora": { 7092 // "description": "Bodies of items (files/documents) to which the query applies. Supported bodies are 'user', 'domain', 'drive' and 'allDrives'. Prefer 'user' or 'drive' to 'allDrives' for efficiency.", 7093 // "location": "query", 7094 // "type": "string" 7095 // }, 7096 // "corpus": { 7097 // "description": "The source of files to list. Deprecated: use 'corpora' instead.", 7098 // "enum": [ 7099 // "domain", 7100 // "user" 7101 // ], 7102 // "enumDescriptions": [ 7103 // "Files shared to the user's domain.", 7104 // "Files owned by or shared to the user." 7105 // ], 7106 // "location": "query", 7107 // "type": "string" 7108 // }, 7109 // "driveId": { 7110 // "description": "ID of the shared drive to search.", 7111 // "location": "query", 7112 // "type": "string" 7113 // }, 7114 // "includeItemsFromAllDrives": { 7115 // "default": "false", 7116 // "description": "Deprecated - Whether both My Drive and shared drive items should be included in results. This parameter will only be effective until June 1, 2020. Afterwards shared drive items will be included in the results.", 7117 // "location": "query", 7118 // "type": "boolean" 7119 // }, 7120 // "includeTeamDriveItems": { 7121 // "default": "false", 7122 // "description": "Deprecated use includeItemsFromAllDrives instead.", 7123 // "location": "query", 7124 // "type": "boolean" 7125 // }, 7126 // "orderBy": { 7127 // "description": "A comma-separated list of sort keys. Valid keys are 'createdTime', 'folder', 'modifiedByMeTime', 'modifiedTime', 'name', 'name_natural', 'quotaBytesUsed', 'recency', 'sharedWithMeTime', 'starred', and 'viewedByMeTime'. Each key sorts ascending by default, but may be reversed with the 'desc' modifier. Example usage: ?orderBy=folder,modifiedTime desc,name. Please note that there is a current limitation for users with approximately one million files in which the requested sort order is ignored.", 7128 // "location": "query", 7129 // "type": "string" 7130 // }, 7131 // "pageSize": { 7132 // "default": "100", 7133 // "description": "The maximum number of files to return per page. Partial or empty result pages are possible even before the end of the files list has been reached.", 7134 // "format": "int32", 7135 // "location": "query", 7136 // "maximum": "1000", 7137 // "minimum": "1", 7138 // "type": "integer" 7139 // }, 7140 // "pageToken": { 7141 // "description": "The token for continuing a previous list request on the next page. This should be set to the value of 'nextPageToken' from the previous response.", 7142 // "location": "query", 7143 // "type": "string" 7144 // }, 7145 // "q": { 7146 // "description": "A query for filtering the file results. See the \"Search for Files\" guide for supported syntax.", 7147 // "location": "query", 7148 // "type": "string" 7149 // }, 7150 // "spaces": { 7151 // "default": "drive", 7152 // "description": "A comma-separated list of spaces to query within the corpus. Supported values are 'drive', 'appDataFolder' and 'photos'.", 7153 // "location": "query", 7154 // "type": "string" 7155 // }, 7156 // "supportsAllDrives": { 7157 // "default": "false", 7158 // "description": "Deprecated - Whether the requesting application supports both My Drives and shared drives. This parameter will only be effective until June 1, 2020. Afterwards all applications are assumed to support shared drives.", 7159 // "location": "query", 7160 // "type": "boolean" 7161 // }, 7162 // "supportsTeamDrives": { 7163 // "default": "false", 7164 // "description": "Deprecated use supportsAllDrives instead.", 7165 // "location": "query", 7166 // "type": "boolean" 7167 // }, 7168 // "teamDriveId": { 7169 // "description": "Deprecated use driveId instead.", 7170 // "location": "query", 7171 // "type": "string" 7172 // } 7173 // }, 7174 // "path": "files", 7175 // "response": { 7176 // "$ref": "FileList" 7177 // }, 7178 // "scopes": [ 7179 // "https://www.googleapis.com/auth/drive", 7180 // "https://www.googleapis.com/auth/drive.appdata", 7181 // "https://www.googleapis.com/auth/drive.file", 7182 // "https://www.googleapis.com/auth/drive.metadata", 7183 // "https://www.googleapis.com/auth/drive.metadata.readonly", 7184 // "https://www.googleapis.com/auth/drive.photos.readonly", 7185 // "https://www.googleapis.com/auth/drive.readonly" 7186 // ] 7187 // } 7188 7189} 7190 7191// Pages invokes f for each page of results. 7192// A non-nil error returned from f will halt the iteration. 7193// The provided context supersedes any context provided to the Context method. 7194func (c *FilesListCall) Pages(ctx context.Context, f func(*FileList) error) error { 7195 c.ctx_ = ctx 7196 defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point 7197 for { 7198 x, err := c.Do() 7199 if err != nil { 7200 return err 7201 } 7202 if err := f(x); err != nil { 7203 return err 7204 } 7205 if x.NextPageToken == "" { 7206 return nil 7207 } 7208 c.PageToken(x.NextPageToken) 7209 } 7210} 7211 7212// method id "drive.files.update": 7213 7214type FilesUpdateCall struct { 7215 s *Service 7216 fileId string 7217 file *File 7218 urlParams_ gensupport.URLParams 7219 mediaInfo_ *gensupport.MediaInfo 7220 ctx_ context.Context 7221 header_ http.Header 7222} 7223 7224// Update: Updates a file's metadata and/or content with patch 7225// semantics. 7226func (r *FilesService) Update(fileId string, file *File) *FilesUpdateCall { 7227 c := &FilesUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)} 7228 c.fileId = fileId 7229 c.file = file 7230 return c 7231} 7232 7233// AddParents sets the optional parameter "addParents": A 7234// comma-separated list of parent IDs to add. 7235func (c *FilesUpdateCall) AddParents(addParents string) *FilesUpdateCall { 7236 c.urlParams_.Set("addParents", addParents) 7237 return c 7238} 7239 7240// KeepRevisionForever sets the optional parameter 7241// "keepRevisionForever": Whether to set the 'keepForever' field in the 7242// new head revision. This is only applicable to files with binary 7243// content in Google Drive. 7244func (c *FilesUpdateCall) KeepRevisionForever(keepRevisionForever bool) *FilesUpdateCall { 7245 c.urlParams_.Set("keepRevisionForever", fmt.Sprint(keepRevisionForever)) 7246 return c 7247} 7248 7249// OcrLanguage sets the optional parameter "ocrLanguage": A language 7250// hint for OCR processing during image import (ISO 639-1 code). 7251func (c *FilesUpdateCall) OcrLanguage(ocrLanguage string) *FilesUpdateCall { 7252 c.urlParams_.Set("ocrLanguage", ocrLanguage) 7253 return c 7254} 7255 7256// RemoveParents sets the optional parameter "removeParents": A 7257// comma-separated list of parent IDs to remove. 7258func (c *FilesUpdateCall) RemoveParents(removeParents string) *FilesUpdateCall { 7259 c.urlParams_.Set("removeParents", removeParents) 7260 return c 7261} 7262 7263// SupportsAllDrives sets the optional parameter "supportsAllDrives": 7264// Deprecated - Whether the requesting application supports both My 7265// Drives and shared drives. This parameter will only be effective until 7266// June 1, 2020. Afterwards all applications are assumed to support 7267// shared drives. 7268func (c *FilesUpdateCall) SupportsAllDrives(supportsAllDrives bool) *FilesUpdateCall { 7269 c.urlParams_.Set("supportsAllDrives", fmt.Sprint(supportsAllDrives)) 7270 return c 7271} 7272 7273// SupportsTeamDrives sets the optional parameter "supportsTeamDrives": 7274// Deprecated use supportsAllDrives instead. 7275func (c *FilesUpdateCall) SupportsTeamDrives(supportsTeamDrives bool) *FilesUpdateCall { 7276 c.urlParams_.Set("supportsTeamDrives", fmt.Sprint(supportsTeamDrives)) 7277 return c 7278} 7279 7280// UseContentAsIndexableText sets the optional parameter 7281// "useContentAsIndexableText": Whether to use the uploaded content as 7282// indexable text. 7283func (c *FilesUpdateCall) UseContentAsIndexableText(useContentAsIndexableText bool) *FilesUpdateCall { 7284 c.urlParams_.Set("useContentAsIndexableText", fmt.Sprint(useContentAsIndexableText)) 7285 return c 7286} 7287 7288// Media specifies the media to upload in one or more chunks. The chunk 7289// size may be controlled by supplying a MediaOption generated by 7290// googleapi.ChunkSize. The chunk size defaults to 7291// googleapi.DefaultUploadChunkSize.The Content-Type header used in the 7292// upload request will be determined by sniffing the contents of r, 7293// unless a MediaOption generated by googleapi.ContentType is 7294// supplied. 7295// At most one of Media and ResumableMedia may be set. 7296func (c *FilesUpdateCall) Media(r io.Reader, options ...googleapi.MediaOption) *FilesUpdateCall { 7297 c.mediaInfo_ = gensupport.NewInfoFromMedia(r, options) 7298 return c 7299} 7300 7301// ResumableMedia specifies the media to upload in chunks and can be 7302// canceled with ctx. 7303// 7304// Deprecated: use Media instead. 7305// 7306// At most one of Media and ResumableMedia may be set. mediaType 7307// identifies the MIME media type of the upload, such as "image/png". If 7308// mediaType is "", it will be auto-detected. The provided ctx will 7309// supersede any context previously provided to the Context method. 7310func (c *FilesUpdateCall) ResumableMedia(ctx context.Context, r io.ReaderAt, size int64, mediaType string) *FilesUpdateCall { 7311 c.ctx_ = ctx 7312 c.mediaInfo_ = gensupport.NewInfoFromResumableMedia(r, size, mediaType) 7313 return c 7314} 7315 7316// ProgressUpdater provides a callback function that will be called 7317// after every chunk. It should be a low-latency function in order to 7318// not slow down the upload operation. This should only be called when 7319// using ResumableMedia (as opposed to Media). 7320func (c *FilesUpdateCall) ProgressUpdater(pu googleapi.ProgressUpdater) *FilesUpdateCall { 7321 c.mediaInfo_.SetProgressUpdater(pu) 7322 return c 7323} 7324 7325// Fields allows partial responses to be retrieved. See 7326// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 7327// for more information. 7328func (c *FilesUpdateCall) Fields(s ...googleapi.Field) *FilesUpdateCall { 7329 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 7330 return c 7331} 7332 7333// Context sets the context to be used in this call's Do method. Any 7334// pending HTTP request will be aborted if the provided context is 7335// canceled. 7336// This context will supersede any context previously provided to the 7337// ResumableMedia method. 7338func (c *FilesUpdateCall) Context(ctx context.Context) *FilesUpdateCall { 7339 c.ctx_ = ctx 7340 return c 7341} 7342 7343// Header returns an http.Header that can be modified by the caller to 7344// add HTTP headers to the request. 7345func (c *FilesUpdateCall) Header() http.Header { 7346 if c.header_ == nil { 7347 c.header_ = make(http.Header) 7348 } 7349 return c.header_ 7350} 7351 7352func (c *FilesUpdateCall) doRequest(alt string) (*http.Response, error) { 7353 reqHeaders := make(http.Header) 7354 for k, v := range c.header_ { 7355 reqHeaders[k] = v 7356 } 7357 reqHeaders.Set("User-Agent", c.s.userAgent()) 7358 var body io.Reader = nil 7359 body, err := googleapi.WithoutDataWrapper.JSONReader(c.file) 7360 if err != nil { 7361 return nil, err 7362 } 7363 reqHeaders.Set("Content-Type", "application/json") 7364 c.urlParams_.Set("alt", alt) 7365 c.urlParams_.Set("prettyPrint", "false") 7366 urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}") 7367 if c.mediaInfo_ != nil { 7368 urls = strings.Replace(urls, "https://www.googleapis.com/", "https://www.googleapis.com/upload/", 1) 7369 c.urlParams_.Set("uploadType", c.mediaInfo_.UploadType()) 7370 } 7371 if body == nil { 7372 body = new(bytes.Buffer) 7373 reqHeaders.Set("Content-Type", "application/json") 7374 } 7375 body, getBody, cleanup := c.mediaInfo_.UploadRequest(reqHeaders, body) 7376 defer cleanup() 7377 urls += "?" + c.urlParams_.Encode() 7378 req, err := http.NewRequest("PATCH", urls, body) 7379 if err != nil { 7380 return nil, err 7381 } 7382 req.Header = reqHeaders 7383 req.GetBody = getBody 7384 googleapi.Expand(req.URL, map[string]string{ 7385 "fileId": c.fileId, 7386 }) 7387 return gensupport.SendRequest(c.ctx_, c.s.client, req) 7388} 7389 7390// Do executes the "drive.files.update" call. 7391// Exactly one of *File or error will be non-nil. Any non-2xx status 7392// code is an error. Response headers are in either 7393// *File.ServerResponse.Header or (if a response was returned at all) in 7394// error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check 7395// whether the returned error was because http.StatusNotModified was 7396// returned. 7397func (c *FilesUpdateCall) Do(opts ...googleapi.CallOption) (*File, error) { 7398 gensupport.SetOptions(c.urlParams_, opts...) 7399 res, err := c.doRequest("json") 7400 if res != nil && res.StatusCode == http.StatusNotModified { 7401 if res.Body != nil { 7402 res.Body.Close() 7403 } 7404 return nil, &googleapi.Error{ 7405 Code: res.StatusCode, 7406 Header: res.Header, 7407 } 7408 } 7409 if err != nil { 7410 return nil, err 7411 } 7412 defer googleapi.CloseBody(res) 7413 if err := googleapi.CheckResponse(res); err != nil { 7414 return nil, err 7415 } 7416 rx := c.mediaInfo_.ResumableUpload(res.Header.Get("Location")) 7417 if rx != nil { 7418 rx.Client = c.s.client 7419 rx.UserAgent = c.s.userAgent() 7420 ctx := c.ctx_ 7421 if ctx == nil { 7422 ctx = context.TODO() 7423 } 7424 res, err = rx.Upload(ctx) 7425 if err != nil { 7426 return nil, err 7427 } 7428 defer res.Body.Close() 7429 if err := googleapi.CheckResponse(res); err != nil { 7430 return nil, err 7431 } 7432 } 7433 ret := &File{ 7434 ServerResponse: googleapi.ServerResponse{ 7435 Header: res.Header, 7436 HTTPStatusCode: res.StatusCode, 7437 }, 7438 } 7439 target := &ret 7440 if err := gensupport.DecodeResponse(target, res); err != nil { 7441 return nil, err 7442 } 7443 return ret, nil 7444 // { 7445 // "description": "Updates a file's metadata and/or content with patch semantics.", 7446 // "httpMethod": "PATCH", 7447 // "id": "drive.files.update", 7448 // "mediaUpload": { 7449 // "accept": [ 7450 // "*/*" 7451 // ], 7452 // "maxSize": "5120GB", 7453 // "protocols": { 7454 // "resumable": { 7455 // "multipart": true, 7456 // "path": "/resumable/upload/drive/v3/files/{fileId}" 7457 // }, 7458 // "simple": { 7459 // "multipart": true, 7460 // "path": "/upload/drive/v3/files/{fileId}" 7461 // } 7462 // } 7463 // }, 7464 // "parameterOrder": [ 7465 // "fileId" 7466 // ], 7467 // "parameters": { 7468 // "addParents": { 7469 // "description": "A comma-separated list of parent IDs to add.", 7470 // "location": "query", 7471 // "type": "string" 7472 // }, 7473 // "fileId": { 7474 // "description": "The ID of the file.", 7475 // "location": "path", 7476 // "required": true, 7477 // "type": "string" 7478 // }, 7479 // "keepRevisionForever": { 7480 // "default": "false", 7481 // "description": "Whether to set the 'keepForever' field in the new head revision. This is only applicable to files with binary content in Google Drive.", 7482 // "location": "query", 7483 // "type": "boolean" 7484 // }, 7485 // "ocrLanguage": { 7486 // "description": "A language hint for OCR processing during image import (ISO 639-1 code).", 7487 // "location": "query", 7488 // "type": "string" 7489 // }, 7490 // "removeParents": { 7491 // "description": "A comma-separated list of parent IDs to remove.", 7492 // "location": "query", 7493 // "type": "string" 7494 // }, 7495 // "supportsAllDrives": { 7496 // "default": "false", 7497 // "description": "Deprecated - Whether the requesting application supports both My Drives and shared drives. This parameter will only be effective until June 1, 2020. Afterwards all applications are assumed to support shared drives.", 7498 // "location": "query", 7499 // "type": "boolean" 7500 // }, 7501 // "supportsTeamDrives": { 7502 // "default": "false", 7503 // "description": "Deprecated use supportsAllDrives instead.", 7504 // "location": "query", 7505 // "type": "boolean" 7506 // }, 7507 // "useContentAsIndexableText": { 7508 // "default": "false", 7509 // "description": "Whether to use the uploaded content as indexable text.", 7510 // "location": "query", 7511 // "type": "boolean" 7512 // } 7513 // }, 7514 // "path": "files/{fileId}", 7515 // "request": { 7516 // "$ref": "File" 7517 // }, 7518 // "response": { 7519 // "$ref": "File" 7520 // }, 7521 // "scopes": [ 7522 // "https://www.googleapis.com/auth/drive", 7523 // "https://www.googleapis.com/auth/drive.appdata", 7524 // "https://www.googleapis.com/auth/drive.file", 7525 // "https://www.googleapis.com/auth/drive.metadata", 7526 // "https://www.googleapis.com/auth/drive.scripts" 7527 // ], 7528 // "supportsMediaUpload": true 7529 // } 7530 7531} 7532 7533// method id "drive.files.watch": 7534 7535type FilesWatchCall struct { 7536 s *Service 7537 fileId string 7538 channel *Channel 7539 urlParams_ gensupport.URLParams 7540 ctx_ context.Context 7541 header_ http.Header 7542} 7543 7544// Watch: Subscribes to changes to a file 7545func (r *FilesService) Watch(fileId string, channel *Channel) *FilesWatchCall { 7546 c := &FilesWatchCall{s: r.s, urlParams_: make(gensupport.URLParams)} 7547 c.fileId = fileId 7548 c.channel = channel 7549 return c 7550} 7551 7552// AcknowledgeAbuse sets the optional parameter "acknowledgeAbuse": 7553// Whether the user is acknowledging the risk of downloading known 7554// malware or other abusive files. This is only applicable when 7555// alt=media. 7556func (c *FilesWatchCall) AcknowledgeAbuse(acknowledgeAbuse bool) *FilesWatchCall { 7557 c.urlParams_.Set("acknowledgeAbuse", fmt.Sprint(acknowledgeAbuse)) 7558 return c 7559} 7560 7561// SupportsAllDrives sets the optional parameter "supportsAllDrives": 7562// Deprecated - Whether the requesting application supports both My 7563// Drives and shared drives. This parameter will only be effective until 7564// June 1, 2020. Afterwards all applications are assumed to support 7565// shared drives. 7566func (c *FilesWatchCall) SupportsAllDrives(supportsAllDrives bool) *FilesWatchCall { 7567 c.urlParams_.Set("supportsAllDrives", fmt.Sprint(supportsAllDrives)) 7568 return c 7569} 7570 7571// SupportsTeamDrives sets the optional parameter "supportsTeamDrives": 7572// Deprecated use supportsAllDrives instead. 7573func (c *FilesWatchCall) SupportsTeamDrives(supportsTeamDrives bool) *FilesWatchCall { 7574 c.urlParams_.Set("supportsTeamDrives", fmt.Sprint(supportsTeamDrives)) 7575 return c 7576} 7577 7578// Fields allows partial responses to be retrieved. See 7579// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 7580// for more information. 7581func (c *FilesWatchCall) Fields(s ...googleapi.Field) *FilesWatchCall { 7582 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 7583 return c 7584} 7585 7586// Context sets the context to be used in this call's Do and Download 7587// methods. Any pending HTTP request will be aborted if the provided 7588// context is canceled. 7589func (c *FilesWatchCall) Context(ctx context.Context) *FilesWatchCall { 7590 c.ctx_ = ctx 7591 return c 7592} 7593 7594// Header returns an http.Header that can be modified by the caller to 7595// add HTTP headers to the request. 7596func (c *FilesWatchCall) Header() http.Header { 7597 if c.header_ == nil { 7598 c.header_ = make(http.Header) 7599 } 7600 return c.header_ 7601} 7602 7603func (c *FilesWatchCall) doRequest(alt string) (*http.Response, error) { 7604 reqHeaders := make(http.Header) 7605 for k, v := range c.header_ { 7606 reqHeaders[k] = v 7607 } 7608 reqHeaders.Set("User-Agent", c.s.userAgent()) 7609 var body io.Reader = nil 7610 body, err := googleapi.WithoutDataWrapper.JSONReader(c.channel) 7611 if err != nil { 7612 return nil, err 7613 } 7614 reqHeaders.Set("Content-Type", "application/json") 7615 c.urlParams_.Set("alt", alt) 7616 c.urlParams_.Set("prettyPrint", "false") 7617 urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/watch") 7618 urls += "?" + c.urlParams_.Encode() 7619 req, err := http.NewRequest("POST", urls, body) 7620 if err != nil { 7621 return nil, err 7622 } 7623 req.Header = reqHeaders 7624 googleapi.Expand(req.URL, map[string]string{ 7625 "fileId": c.fileId, 7626 }) 7627 return gensupport.SendRequest(c.ctx_, c.s.client, req) 7628} 7629 7630// Download fetches the API endpoint's "media" value, instead of the normal 7631// API response value. If the returned error is nil, the Response is guaranteed to 7632// have a 2xx status code. Callers must close the Response.Body as usual. 7633func (c *FilesWatchCall) Download(opts ...googleapi.CallOption) (*http.Response, error) { 7634 gensupport.SetOptions(c.urlParams_, opts...) 7635 res, err := c.doRequest("media") 7636 if err != nil { 7637 return nil, err 7638 } 7639 if err := googleapi.CheckMediaResponse(res); err != nil { 7640 res.Body.Close() 7641 return nil, err 7642 } 7643 return res, nil 7644} 7645 7646// Do executes the "drive.files.watch" call. 7647// Exactly one of *Channel or error will be non-nil. Any non-2xx status 7648// code is an error. Response headers are in either 7649// *Channel.ServerResponse.Header or (if a response was returned at all) 7650// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 7651// check whether the returned error was because http.StatusNotModified 7652// was returned. 7653func (c *FilesWatchCall) Do(opts ...googleapi.CallOption) (*Channel, error) { 7654 gensupport.SetOptions(c.urlParams_, opts...) 7655 res, err := c.doRequest("json") 7656 if res != nil && res.StatusCode == http.StatusNotModified { 7657 if res.Body != nil { 7658 res.Body.Close() 7659 } 7660 return nil, &googleapi.Error{ 7661 Code: res.StatusCode, 7662 Header: res.Header, 7663 } 7664 } 7665 if err != nil { 7666 return nil, err 7667 } 7668 defer googleapi.CloseBody(res) 7669 if err := googleapi.CheckResponse(res); err != nil { 7670 return nil, err 7671 } 7672 ret := &Channel{ 7673 ServerResponse: googleapi.ServerResponse{ 7674 Header: res.Header, 7675 HTTPStatusCode: res.StatusCode, 7676 }, 7677 } 7678 target := &ret 7679 if err := gensupport.DecodeResponse(target, res); err != nil { 7680 return nil, err 7681 } 7682 return ret, nil 7683 // { 7684 // "description": "Subscribes to changes to a file", 7685 // "httpMethod": "POST", 7686 // "id": "drive.files.watch", 7687 // "parameterOrder": [ 7688 // "fileId" 7689 // ], 7690 // "parameters": { 7691 // "acknowledgeAbuse": { 7692 // "default": "false", 7693 // "description": "Whether the user is acknowledging the risk of downloading known malware or other abusive files. This is only applicable when alt=media.", 7694 // "location": "query", 7695 // "type": "boolean" 7696 // }, 7697 // "fileId": { 7698 // "description": "The ID of the file.", 7699 // "location": "path", 7700 // "required": true, 7701 // "type": "string" 7702 // }, 7703 // "supportsAllDrives": { 7704 // "default": "false", 7705 // "description": "Deprecated - Whether the requesting application supports both My Drives and shared drives. This parameter will only be effective until June 1, 2020. Afterwards all applications are assumed to support shared drives.", 7706 // "location": "query", 7707 // "type": "boolean" 7708 // }, 7709 // "supportsTeamDrives": { 7710 // "default": "false", 7711 // "description": "Deprecated use supportsAllDrives instead.", 7712 // "location": "query", 7713 // "type": "boolean" 7714 // } 7715 // }, 7716 // "path": "files/{fileId}/watch", 7717 // "request": { 7718 // "$ref": "Channel", 7719 // "parameterName": "resource" 7720 // }, 7721 // "response": { 7722 // "$ref": "Channel" 7723 // }, 7724 // "scopes": [ 7725 // "https://www.googleapis.com/auth/drive", 7726 // "https://www.googleapis.com/auth/drive.appdata", 7727 // "https://www.googleapis.com/auth/drive.file", 7728 // "https://www.googleapis.com/auth/drive.metadata", 7729 // "https://www.googleapis.com/auth/drive.metadata.readonly", 7730 // "https://www.googleapis.com/auth/drive.photos.readonly", 7731 // "https://www.googleapis.com/auth/drive.readonly" 7732 // ], 7733 // "supportsMediaDownload": true, 7734 // "supportsSubscription": true, 7735 // "useMediaDownloadService": true 7736 // } 7737 7738} 7739 7740// method id "drive.permissions.create": 7741 7742type PermissionsCreateCall struct { 7743 s *Service 7744 fileId string 7745 permission *Permission 7746 urlParams_ gensupport.URLParams 7747 ctx_ context.Context 7748 header_ http.Header 7749} 7750 7751// Create: Creates a permission for a file or shared drive. 7752func (r *PermissionsService) Create(fileId string, permission *Permission) *PermissionsCreateCall { 7753 c := &PermissionsCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)} 7754 c.fileId = fileId 7755 c.permission = permission 7756 return c 7757} 7758 7759// EmailMessage sets the optional parameter "emailMessage": A plain text 7760// custom message to include in the notification email. 7761func (c *PermissionsCreateCall) EmailMessage(emailMessage string) *PermissionsCreateCall { 7762 c.urlParams_.Set("emailMessage", emailMessage) 7763 return c 7764} 7765 7766// SendNotificationEmail sets the optional parameter 7767// "sendNotificationEmail": Whether to send a notification email when 7768// sharing to users or groups. This defaults to true for users and 7769// groups, and is not allowed for other requests. It must not be 7770// disabled for ownership transfers. 7771func (c *PermissionsCreateCall) SendNotificationEmail(sendNotificationEmail bool) *PermissionsCreateCall { 7772 c.urlParams_.Set("sendNotificationEmail", fmt.Sprint(sendNotificationEmail)) 7773 return c 7774} 7775 7776// SupportsAllDrives sets the optional parameter "supportsAllDrives": 7777// Deprecated - Whether the requesting application supports both My 7778// Drives and shared drives. This parameter will only be effective until 7779// June 1, 2020. Afterwards all applications are assumed to support 7780// shared drives. 7781func (c *PermissionsCreateCall) SupportsAllDrives(supportsAllDrives bool) *PermissionsCreateCall { 7782 c.urlParams_.Set("supportsAllDrives", fmt.Sprint(supportsAllDrives)) 7783 return c 7784} 7785 7786// SupportsTeamDrives sets the optional parameter "supportsTeamDrives": 7787// Deprecated use supportsAllDrives instead. 7788func (c *PermissionsCreateCall) SupportsTeamDrives(supportsTeamDrives bool) *PermissionsCreateCall { 7789 c.urlParams_.Set("supportsTeamDrives", fmt.Sprint(supportsTeamDrives)) 7790 return c 7791} 7792 7793// TransferOwnership sets the optional parameter "transferOwnership": 7794// Whether to transfer ownership to the specified user and downgrade the 7795// current owner to a writer. This parameter is required as an 7796// acknowledgement of the side effect. 7797func (c *PermissionsCreateCall) TransferOwnership(transferOwnership bool) *PermissionsCreateCall { 7798 c.urlParams_.Set("transferOwnership", fmt.Sprint(transferOwnership)) 7799 return c 7800} 7801 7802// UseDomainAdminAccess sets the optional parameter 7803// "useDomainAdminAccess": Issue the request as a domain administrator; 7804// if set to true, then the requester will be granted access if the file 7805// ID parameter refers to a shared drive and the requester is an 7806// administrator of the domain to which the shared drive belongs. 7807func (c *PermissionsCreateCall) UseDomainAdminAccess(useDomainAdminAccess bool) *PermissionsCreateCall { 7808 c.urlParams_.Set("useDomainAdminAccess", fmt.Sprint(useDomainAdminAccess)) 7809 return c 7810} 7811 7812// Fields allows partial responses to be retrieved. See 7813// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 7814// for more information. 7815func (c *PermissionsCreateCall) Fields(s ...googleapi.Field) *PermissionsCreateCall { 7816 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 7817 return c 7818} 7819 7820// Context sets the context to be used in this call's Do method. Any 7821// pending HTTP request will be aborted if the provided context is 7822// canceled. 7823func (c *PermissionsCreateCall) Context(ctx context.Context) *PermissionsCreateCall { 7824 c.ctx_ = ctx 7825 return c 7826} 7827 7828// Header returns an http.Header that can be modified by the caller to 7829// add HTTP headers to the request. 7830func (c *PermissionsCreateCall) Header() http.Header { 7831 if c.header_ == nil { 7832 c.header_ = make(http.Header) 7833 } 7834 return c.header_ 7835} 7836 7837func (c *PermissionsCreateCall) doRequest(alt string) (*http.Response, error) { 7838 reqHeaders := make(http.Header) 7839 for k, v := range c.header_ { 7840 reqHeaders[k] = v 7841 } 7842 reqHeaders.Set("User-Agent", c.s.userAgent()) 7843 var body io.Reader = nil 7844 body, err := googleapi.WithoutDataWrapper.JSONReader(c.permission) 7845 if err != nil { 7846 return nil, err 7847 } 7848 reqHeaders.Set("Content-Type", "application/json") 7849 c.urlParams_.Set("alt", alt) 7850 c.urlParams_.Set("prettyPrint", "false") 7851 urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/permissions") 7852 urls += "?" + c.urlParams_.Encode() 7853 req, err := http.NewRequest("POST", urls, body) 7854 if err != nil { 7855 return nil, err 7856 } 7857 req.Header = reqHeaders 7858 googleapi.Expand(req.URL, map[string]string{ 7859 "fileId": c.fileId, 7860 }) 7861 return gensupport.SendRequest(c.ctx_, c.s.client, req) 7862} 7863 7864// Do executes the "drive.permissions.create" call. 7865// Exactly one of *Permission or error will be non-nil. Any non-2xx 7866// status code is an error. Response headers are in either 7867// *Permission.ServerResponse.Header or (if a response was returned at 7868// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 7869// to check whether the returned error was because 7870// http.StatusNotModified was returned. 7871func (c *PermissionsCreateCall) Do(opts ...googleapi.CallOption) (*Permission, error) { 7872 gensupport.SetOptions(c.urlParams_, opts...) 7873 res, err := c.doRequest("json") 7874 if res != nil && res.StatusCode == http.StatusNotModified { 7875 if res.Body != nil { 7876 res.Body.Close() 7877 } 7878 return nil, &googleapi.Error{ 7879 Code: res.StatusCode, 7880 Header: res.Header, 7881 } 7882 } 7883 if err != nil { 7884 return nil, err 7885 } 7886 defer googleapi.CloseBody(res) 7887 if err := googleapi.CheckResponse(res); err != nil { 7888 return nil, err 7889 } 7890 ret := &Permission{ 7891 ServerResponse: googleapi.ServerResponse{ 7892 Header: res.Header, 7893 HTTPStatusCode: res.StatusCode, 7894 }, 7895 } 7896 target := &ret 7897 if err := gensupport.DecodeResponse(target, res); err != nil { 7898 return nil, err 7899 } 7900 return ret, nil 7901 // { 7902 // "description": "Creates a permission for a file or shared drive.", 7903 // "httpMethod": "POST", 7904 // "id": "drive.permissions.create", 7905 // "parameterOrder": [ 7906 // "fileId" 7907 // ], 7908 // "parameters": { 7909 // "emailMessage": { 7910 // "description": "A plain text custom message to include in the notification email.", 7911 // "location": "query", 7912 // "type": "string" 7913 // }, 7914 // "fileId": { 7915 // "description": "The ID of the file or shared drive.", 7916 // "location": "path", 7917 // "required": true, 7918 // "type": "string" 7919 // }, 7920 // "sendNotificationEmail": { 7921 // "description": "Whether to send a notification email when sharing to users or groups. This defaults to true for users and groups, and is not allowed for other requests. It must not be disabled for ownership transfers.", 7922 // "location": "query", 7923 // "type": "boolean" 7924 // }, 7925 // "supportsAllDrives": { 7926 // "default": "false", 7927 // "description": "Deprecated - Whether the requesting application supports both My Drives and shared drives. This parameter will only be effective until June 1, 2020. Afterwards all applications are assumed to support shared drives.", 7928 // "location": "query", 7929 // "type": "boolean" 7930 // }, 7931 // "supportsTeamDrives": { 7932 // "default": "false", 7933 // "description": "Deprecated use supportsAllDrives instead.", 7934 // "location": "query", 7935 // "type": "boolean" 7936 // }, 7937 // "transferOwnership": { 7938 // "default": "false", 7939 // "description": "Whether to transfer ownership to the specified user and downgrade the current owner to a writer. This parameter is required as an acknowledgement of the side effect.", 7940 // "location": "query", 7941 // "type": "boolean" 7942 // }, 7943 // "useDomainAdminAccess": { 7944 // "default": "false", 7945 // "description": "Issue the request as a domain administrator; if set to true, then the requester will be granted access if the file ID parameter refers to a shared drive and the requester is an administrator of the domain to which the shared drive belongs.", 7946 // "location": "query", 7947 // "type": "boolean" 7948 // } 7949 // }, 7950 // "path": "files/{fileId}/permissions", 7951 // "request": { 7952 // "$ref": "Permission" 7953 // }, 7954 // "response": { 7955 // "$ref": "Permission" 7956 // }, 7957 // "scopes": [ 7958 // "https://www.googleapis.com/auth/drive", 7959 // "https://www.googleapis.com/auth/drive.file" 7960 // ] 7961 // } 7962 7963} 7964 7965// method id "drive.permissions.delete": 7966 7967type PermissionsDeleteCall struct { 7968 s *Service 7969 fileId string 7970 permissionId string 7971 urlParams_ gensupport.URLParams 7972 ctx_ context.Context 7973 header_ http.Header 7974} 7975 7976// Delete: Deletes a permission. 7977func (r *PermissionsService) Delete(fileId string, permissionId string) *PermissionsDeleteCall { 7978 c := &PermissionsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)} 7979 c.fileId = fileId 7980 c.permissionId = permissionId 7981 return c 7982} 7983 7984// SupportsAllDrives sets the optional parameter "supportsAllDrives": 7985// Deprecated - Whether the requesting application supports both My 7986// Drives and shared drives. This parameter will only be effective until 7987// June 1, 2020. Afterwards all applications are assumed to support 7988// shared drives. 7989func (c *PermissionsDeleteCall) SupportsAllDrives(supportsAllDrives bool) *PermissionsDeleteCall { 7990 c.urlParams_.Set("supportsAllDrives", fmt.Sprint(supportsAllDrives)) 7991 return c 7992} 7993 7994// SupportsTeamDrives sets the optional parameter "supportsTeamDrives": 7995// Deprecated use supportsAllDrives instead. 7996func (c *PermissionsDeleteCall) SupportsTeamDrives(supportsTeamDrives bool) *PermissionsDeleteCall { 7997 c.urlParams_.Set("supportsTeamDrives", fmt.Sprint(supportsTeamDrives)) 7998 return c 7999} 8000 8001// UseDomainAdminAccess sets the optional parameter 8002// "useDomainAdminAccess": Issue the request as a domain administrator; 8003// if set to true, then the requester will be granted access if the file 8004// ID parameter refers to a shared drive and the requester is an 8005// administrator of the domain to which the shared drive belongs. 8006func (c *PermissionsDeleteCall) UseDomainAdminAccess(useDomainAdminAccess bool) *PermissionsDeleteCall { 8007 c.urlParams_.Set("useDomainAdminAccess", fmt.Sprint(useDomainAdminAccess)) 8008 return c 8009} 8010 8011// Fields allows partial responses to be retrieved. See 8012// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 8013// for more information. 8014func (c *PermissionsDeleteCall) Fields(s ...googleapi.Field) *PermissionsDeleteCall { 8015 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 8016 return c 8017} 8018 8019// Context sets the context to be used in this call's Do method. Any 8020// pending HTTP request will be aborted if the provided context is 8021// canceled. 8022func (c *PermissionsDeleteCall) Context(ctx context.Context) *PermissionsDeleteCall { 8023 c.ctx_ = ctx 8024 return c 8025} 8026 8027// Header returns an http.Header that can be modified by the caller to 8028// add HTTP headers to the request. 8029func (c *PermissionsDeleteCall) Header() http.Header { 8030 if c.header_ == nil { 8031 c.header_ = make(http.Header) 8032 } 8033 return c.header_ 8034} 8035 8036func (c *PermissionsDeleteCall) doRequest(alt string) (*http.Response, error) { 8037 reqHeaders := make(http.Header) 8038 for k, v := range c.header_ { 8039 reqHeaders[k] = v 8040 } 8041 reqHeaders.Set("User-Agent", c.s.userAgent()) 8042 var body io.Reader = nil 8043 c.urlParams_.Set("alt", alt) 8044 c.urlParams_.Set("prettyPrint", "false") 8045 urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/permissions/{permissionId}") 8046 urls += "?" + c.urlParams_.Encode() 8047 req, err := http.NewRequest("DELETE", urls, body) 8048 if err != nil { 8049 return nil, err 8050 } 8051 req.Header = reqHeaders 8052 googleapi.Expand(req.URL, map[string]string{ 8053 "fileId": c.fileId, 8054 "permissionId": c.permissionId, 8055 }) 8056 return gensupport.SendRequest(c.ctx_, c.s.client, req) 8057} 8058 8059// Do executes the "drive.permissions.delete" call. 8060func (c *PermissionsDeleteCall) Do(opts ...googleapi.CallOption) error { 8061 gensupport.SetOptions(c.urlParams_, opts...) 8062 res, err := c.doRequest("json") 8063 if err != nil { 8064 return err 8065 } 8066 defer googleapi.CloseBody(res) 8067 if err := googleapi.CheckResponse(res); err != nil { 8068 return err 8069 } 8070 return nil 8071 // { 8072 // "description": "Deletes a permission.", 8073 // "httpMethod": "DELETE", 8074 // "id": "drive.permissions.delete", 8075 // "parameterOrder": [ 8076 // "fileId", 8077 // "permissionId" 8078 // ], 8079 // "parameters": { 8080 // "fileId": { 8081 // "description": "The ID of the file or shared drive.", 8082 // "location": "path", 8083 // "required": true, 8084 // "type": "string" 8085 // }, 8086 // "permissionId": { 8087 // "description": "The ID of the permission.", 8088 // "location": "path", 8089 // "required": true, 8090 // "type": "string" 8091 // }, 8092 // "supportsAllDrives": { 8093 // "default": "false", 8094 // "description": "Deprecated - Whether the requesting application supports both My Drives and shared drives. This parameter will only be effective until June 1, 2020. Afterwards all applications are assumed to support shared drives.", 8095 // "location": "query", 8096 // "type": "boolean" 8097 // }, 8098 // "supportsTeamDrives": { 8099 // "default": "false", 8100 // "description": "Deprecated use supportsAllDrives instead.", 8101 // "location": "query", 8102 // "type": "boolean" 8103 // }, 8104 // "useDomainAdminAccess": { 8105 // "default": "false", 8106 // "description": "Issue the request as a domain administrator; if set to true, then the requester will be granted access if the file ID parameter refers to a shared drive and the requester is an administrator of the domain to which the shared drive belongs.", 8107 // "location": "query", 8108 // "type": "boolean" 8109 // } 8110 // }, 8111 // "path": "files/{fileId}/permissions/{permissionId}", 8112 // "scopes": [ 8113 // "https://www.googleapis.com/auth/drive", 8114 // "https://www.googleapis.com/auth/drive.file" 8115 // ] 8116 // } 8117 8118} 8119 8120// method id "drive.permissions.get": 8121 8122type PermissionsGetCall struct { 8123 s *Service 8124 fileId string 8125 permissionId string 8126 urlParams_ gensupport.URLParams 8127 ifNoneMatch_ string 8128 ctx_ context.Context 8129 header_ http.Header 8130} 8131 8132// Get: Gets a permission by ID. 8133func (r *PermissionsService) Get(fileId string, permissionId string) *PermissionsGetCall { 8134 c := &PermissionsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)} 8135 c.fileId = fileId 8136 c.permissionId = permissionId 8137 return c 8138} 8139 8140// SupportsAllDrives sets the optional parameter "supportsAllDrives": 8141// Deprecated - Whether the requesting application supports both My 8142// Drives and shared drives. This parameter will only be effective until 8143// June 1, 2020. Afterwards all applications are assumed to support 8144// shared drives. 8145func (c *PermissionsGetCall) SupportsAllDrives(supportsAllDrives bool) *PermissionsGetCall { 8146 c.urlParams_.Set("supportsAllDrives", fmt.Sprint(supportsAllDrives)) 8147 return c 8148} 8149 8150// SupportsTeamDrives sets the optional parameter "supportsTeamDrives": 8151// Deprecated use supportsAllDrives instead. 8152func (c *PermissionsGetCall) SupportsTeamDrives(supportsTeamDrives bool) *PermissionsGetCall { 8153 c.urlParams_.Set("supportsTeamDrives", fmt.Sprint(supportsTeamDrives)) 8154 return c 8155} 8156 8157// UseDomainAdminAccess sets the optional parameter 8158// "useDomainAdminAccess": Issue the request as a domain administrator; 8159// if set to true, then the requester will be granted access if the file 8160// ID parameter refers to a shared drive and the requester is an 8161// administrator of the domain to which the shared drive belongs. 8162func (c *PermissionsGetCall) UseDomainAdminAccess(useDomainAdminAccess bool) *PermissionsGetCall { 8163 c.urlParams_.Set("useDomainAdminAccess", fmt.Sprint(useDomainAdminAccess)) 8164 return c 8165} 8166 8167// Fields allows partial responses to be retrieved. See 8168// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 8169// for more information. 8170func (c *PermissionsGetCall) Fields(s ...googleapi.Field) *PermissionsGetCall { 8171 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 8172 return c 8173} 8174 8175// IfNoneMatch sets the optional parameter which makes the operation 8176// fail if the object's ETag matches the given value. This is useful for 8177// getting updates only after the object has changed since the last 8178// request. Use googleapi.IsNotModified to check whether the response 8179// error from Do is the result of In-None-Match. 8180func (c *PermissionsGetCall) IfNoneMatch(entityTag string) *PermissionsGetCall { 8181 c.ifNoneMatch_ = entityTag 8182 return c 8183} 8184 8185// Context sets the context to be used in this call's Do method. Any 8186// pending HTTP request will be aborted if the provided context is 8187// canceled. 8188func (c *PermissionsGetCall) Context(ctx context.Context) *PermissionsGetCall { 8189 c.ctx_ = ctx 8190 return c 8191} 8192 8193// Header returns an http.Header that can be modified by the caller to 8194// add HTTP headers to the request. 8195func (c *PermissionsGetCall) Header() http.Header { 8196 if c.header_ == nil { 8197 c.header_ = make(http.Header) 8198 } 8199 return c.header_ 8200} 8201 8202func (c *PermissionsGetCall) doRequest(alt string) (*http.Response, error) { 8203 reqHeaders := make(http.Header) 8204 for k, v := range c.header_ { 8205 reqHeaders[k] = v 8206 } 8207 reqHeaders.Set("User-Agent", c.s.userAgent()) 8208 if c.ifNoneMatch_ != "" { 8209 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 8210 } 8211 var body io.Reader = nil 8212 c.urlParams_.Set("alt", alt) 8213 c.urlParams_.Set("prettyPrint", "false") 8214 urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/permissions/{permissionId}") 8215 urls += "?" + c.urlParams_.Encode() 8216 req, err := http.NewRequest("GET", urls, body) 8217 if err != nil { 8218 return nil, err 8219 } 8220 req.Header = reqHeaders 8221 googleapi.Expand(req.URL, map[string]string{ 8222 "fileId": c.fileId, 8223 "permissionId": c.permissionId, 8224 }) 8225 return gensupport.SendRequest(c.ctx_, c.s.client, req) 8226} 8227 8228// Do executes the "drive.permissions.get" call. 8229// Exactly one of *Permission or error will be non-nil. Any non-2xx 8230// status code is an error. Response headers are in either 8231// *Permission.ServerResponse.Header or (if a response was returned at 8232// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 8233// to check whether the returned error was because 8234// http.StatusNotModified was returned. 8235func (c *PermissionsGetCall) Do(opts ...googleapi.CallOption) (*Permission, error) { 8236 gensupport.SetOptions(c.urlParams_, opts...) 8237 res, err := c.doRequest("json") 8238 if res != nil && res.StatusCode == http.StatusNotModified { 8239 if res.Body != nil { 8240 res.Body.Close() 8241 } 8242 return nil, &googleapi.Error{ 8243 Code: res.StatusCode, 8244 Header: res.Header, 8245 } 8246 } 8247 if err != nil { 8248 return nil, err 8249 } 8250 defer googleapi.CloseBody(res) 8251 if err := googleapi.CheckResponse(res); err != nil { 8252 return nil, err 8253 } 8254 ret := &Permission{ 8255 ServerResponse: googleapi.ServerResponse{ 8256 Header: res.Header, 8257 HTTPStatusCode: res.StatusCode, 8258 }, 8259 } 8260 target := &ret 8261 if err := gensupport.DecodeResponse(target, res); err != nil { 8262 return nil, err 8263 } 8264 return ret, nil 8265 // { 8266 // "description": "Gets a permission by ID.", 8267 // "httpMethod": "GET", 8268 // "id": "drive.permissions.get", 8269 // "parameterOrder": [ 8270 // "fileId", 8271 // "permissionId" 8272 // ], 8273 // "parameters": { 8274 // "fileId": { 8275 // "description": "The ID of the file.", 8276 // "location": "path", 8277 // "required": true, 8278 // "type": "string" 8279 // }, 8280 // "permissionId": { 8281 // "description": "The ID of the permission.", 8282 // "location": "path", 8283 // "required": true, 8284 // "type": "string" 8285 // }, 8286 // "supportsAllDrives": { 8287 // "default": "false", 8288 // "description": "Deprecated - Whether the requesting application supports both My Drives and shared drives. This parameter will only be effective until June 1, 2020. Afterwards all applications are assumed to support shared drives.", 8289 // "location": "query", 8290 // "type": "boolean" 8291 // }, 8292 // "supportsTeamDrives": { 8293 // "default": "false", 8294 // "description": "Deprecated use supportsAllDrives instead.", 8295 // "location": "query", 8296 // "type": "boolean" 8297 // }, 8298 // "useDomainAdminAccess": { 8299 // "default": "false", 8300 // "description": "Issue the request as a domain administrator; if set to true, then the requester will be granted access if the file ID parameter refers to a shared drive and the requester is an administrator of the domain to which the shared drive belongs.", 8301 // "location": "query", 8302 // "type": "boolean" 8303 // } 8304 // }, 8305 // "path": "files/{fileId}/permissions/{permissionId}", 8306 // "response": { 8307 // "$ref": "Permission" 8308 // }, 8309 // "scopes": [ 8310 // "https://www.googleapis.com/auth/drive", 8311 // "https://www.googleapis.com/auth/drive.file", 8312 // "https://www.googleapis.com/auth/drive.metadata", 8313 // "https://www.googleapis.com/auth/drive.metadata.readonly", 8314 // "https://www.googleapis.com/auth/drive.photos.readonly", 8315 // "https://www.googleapis.com/auth/drive.readonly" 8316 // ] 8317 // } 8318 8319} 8320 8321// method id "drive.permissions.list": 8322 8323type PermissionsListCall struct { 8324 s *Service 8325 fileId string 8326 urlParams_ gensupport.URLParams 8327 ifNoneMatch_ string 8328 ctx_ context.Context 8329 header_ http.Header 8330} 8331 8332// List: Lists a file's or shared drive's permissions. 8333func (r *PermissionsService) List(fileId string) *PermissionsListCall { 8334 c := &PermissionsListCall{s: r.s, urlParams_: make(gensupport.URLParams)} 8335 c.fileId = fileId 8336 return c 8337} 8338 8339// PageSize sets the optional parameter "pageSize": The maximum number 8340// of permissions to return per page. When not set for files in a shared 8341// drive, at most 100 results will be returned. When not set for files 8342// that are not in a shared drive, the entire list will be returned. 8343func (c *PermissionsListCall) PageSize(pageSize int64) *PermissionsListCall { 8344 c.urlParams_.Set("pageSize", fmt.Sprint(pageSize)) 8345 return c 8346} 8347 8348// PageToken sets the optional parameter "pageToken": The token for 8349// continuing a previous list request on the next page. This should be 8350// set to the value of 'nextPageToken' from the previous response. 8351func (c *PermissionsListCall) PageToken(pageToken string) *PermissionsListCall { 8352 c.urlParams_.Set("pageToken", pageToken) 8353 return c 8354} 8355 8356// SupportsAllDrives sets the optional parameter "supportsAllDrives": 8357// Deprecated - Whether the requesting application supports both My 8358// Drives and shared drives. This parameter will only be effective until 8359// June 1, 2020. Afterwards all applications are assumed to support 8360// shared drives. 8361func (c *PermissionsListCall) SupportsAllDrives(supportsAllDrives bool) *PermissionsListCall { 8362 c.urlParams_.Set("supportsAllDrives", fmt.Sprint(supportsAllDrives)) 8363 return c 8364} 8365 8366// SupportsTeamDrives sets the optional parameter "supportsTeamDrives": 8367// Deprecated use supportsAllDrives instead. 8368func (c *PermissionsListCall) SupportsTeamDrives(supportsTeamDrives bool) *PermissionsListCall { 8369 c.urlParams_.Set("supportsTeamDrives", fmt.Sprint(supportsTeamDrives)) 8370 return c 8371} 8372 8373// UseDomainAdminAccess sets the optional parameter 8374// "useDomainAdminAccess": Issue the request as a domain administrator; 8375// if set to true, then the requester will be granted access if the file 8376// ID parameter refers to a shared drive and the requester is an 8377// administrator of the domain to which the shared drive belongs. 8378func (c *PermissionsListCall) UseDomainAdminAccess(useDomainAdminAccess bool) *PermissionsListCall { 8379 c.urlParams_.Set("useDomainAdminAccess", fmt.Sprint(useDomainAdminAccess)) 8380 return c 8381} 8382 8383// Fields allows partial responses to be retrieved. See 8384// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 8385// for more information. 8386func (c *PermissionsListCall) Fields(s ...googleapi.Field) *PermissionsListCall { 8387 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 8388 return c 8389} 8390 8391// IfNoneMatch sets the optional parameter which makes the operation 8392// fail if the object's ETag matches the given value. This is useful for 8393// getting updates only after the object has changed since the last 8394// request. Use googleapi.IsNotModified to check whether the response 8395// error from Do is the result of In-None-Match. 8396func (c *PermissionsListCall) IfNoneMatch(entityTag string) *PermissionsListCall { 8397 c.ifNoneMatch_ = entityTag 8398 return c 8399} 8400 8401// Context sets the context to be used in this call's Do method. Any 8402// pending HTTP request will be aborted if the provided context is 8403// canceled. 8404func (c *PermissionsListCall) Context(ctx context.Context) *PermissionsListCall { 8405 c.ctx_ = ctx 8406 return c 8407} 8408 8409// Header returns an http.Header that can be modified by the caller to 8410// add HTTP headers to the request. 8411func (c *PermissionsListCall) Header() http.Header { 8412 if c.header_ == nil { 8413 c.header_ = make(http.Header) 8414 } 8415 return c.header_ 8416} 8417 8418func (c *PermissionsListCall) doRequest(alt string) (*http.Response, error) { 8419 reqHeaders := make(http.Header) 8420 for k, v := range c.header_ { 8421 reqHeaders[k] = v 8422 } 8423 reqHeaders.Set("User-Agent", c.s.userAgent()) 8424 if c.ifNoneMatch_ != "" { 8425 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 8426 } 8427 var body io.Reader = nil 8428 c.urlParams_.Set("alt", alt) 8429 c.urlParams_.Set("prettyPrint", "false") 8430 urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/permissions") 8431 urls += "?" + c.urlParams_.Encode() 8432 req, err := http.NewRequest("GET", urls, body) 8433 if err != nil { 8434 return nil, err 8435 } 8436 req.Header = reqHeaders 8437 googleapi.Expand(req.URL, map[string]string{ 8438 "fileId": c.fileId, 8439 }) 8440 return gensupport.SendRequest(c.ctx_, c.s.client, req) 8441} 8442 8443// Do executes the "drive.permissions.list" call. 8444// Exactly one of *PermissionList or error will be non-nil. Any non-2xx 8445// status code is an error. Response headers are in either 8446// *PermissionList.ServerResponse.Header or (if a response was returned 8447// at all) in error.(*googleapi.Error).Header. Use 8448// googleapi.IsNotModified to check whether the returned error was 8449// because http.StatusNotModified was returned. 8450func (c *PermissionsListCall) Do(opts ...googleapi.CallOption) (*PermissionList, error) { 8451 gensupport.SetOptions(c.urlParams_, opts...) 8452 res, err := c.doRequest("json") 8453 if res != nil && res.StatusCode == http.StatusNotModified { 8454 if res.Body != nil { 8455 res.Body.Close() 8456 } 8457 return nil, &googleapi.Error{ 8458 Code: res.StatusCode, 8459 Header: res.Header, 8460 } 8461 } 8462 if err != nil { 8463 return nil, err 8464 } 8465 defer googleapi.CloseBody(res) 8466 if err := googleapi.CheckResponse(res); err != nil { 8467 return nil, err 8468 } 8469 ret := &PermissionList{ 8470 ServerResponse: googleapi.ServerResponse{ 8471 Header: res.Header, 8472 HTTPStatusCode: res.StatusCode, 8473 }, 8474 } 8475 target := &ret 8476 if err := gensupport.DecodeResponse(target, res); err != nil { 8477 return nil, err 8478 } 8479 return ret, nil 8480 // { 8481 // "description": "Lists a file's or shared drive's permissions.", 8482 // "httpMethod": "GET", 8483 // "id": "drive.permissions.list", 8484 // "parameterOrder": [ 8485 // "fileId" 8486 // ], 8487 // "parameters": { 8488 // "fileId": { 8489 // "description": "The ID of the file or shared drive.", 8490 // "location": "path", 8491 // "required": true, 8492 // "type": "string" 8493 // }, 8494 // "pageSize": { 8495 // "description": "The maximum number of permissions to return per page. When not set for files in a shared drive, at most 100 results will be returned. When not set for files that are not in a shared drive, the entire list will be returned.", 8496 // "format": "int32", 8497 // "location": "query", 8498 // "maximum": "100", 8499 // "minimum": "1", 8500 // "type": "integer" 8501 // }, 8502 // "pageToken": { 8503 // "description": "The token for continuing a previous list request on the next page. This should be set to the value of 'nextPageToken' from the previous response.", 8504 // "location": "query", 8505 // "type": "string" 8506 // }, 8507 // "supportsAllDrives": { 8508 // "default": "false", 8509 // "description": "Deprecated - Whether the requesting application supports both My Drives and shared drives. This parameter will only be effective until June 1, 2020. Afterwards all applications are assumed to support shared drives.", 8510 // "location": "query", 8511 // "type": "boolean" 8512 // }, 8513 // "supportsTeamDrives": { 8514 // "default": "false", 8515 // "description": "Deprecated use supportsAllDrives instead.", 8516 // "location": "query", 8517 // "type": "boolean" 8518 // }, 8519 // "useDomainAdminAccess": { 8520 // "default": "false", 8521 // "description": "Issue the request as a domain administrator; if set to true, then the requester will be granted access if the file ID parameter refers to a shared drive and the requester is an administrator of the domain to which the shared drive belongs.", 8522 // "location": "query", 8523 // "type": "boolean" 8524 // } 8525 // }, 8526 // "path": "files/{fileId}/permissions", 8527 // "response": { 8528 // "$ref": "PermissionList" 8529 // }, 8530 // "scopes": [ 8531 // "https://www.googleapis.com/auth/drive", 8532 // "https://www.googleapis.com/auth/drive.file", 8533 // "https://www.googleapis.com/auth/drive.metadata", 8534 // "https://www.googleapis.com/auth/drive.metadata.readonly", 8535 // "https://www.googleapis.com/auth/drive.photos.readonly", 8536 // "https://www.googleapis.com/auth/drive.readonly" 8537 // ] 8538 // } 8539 8540} 8541 8542// Pages invokes f for each page of results. 8543// A non-nil error returned from f will halt the iteration. 8544// The provided context supersedes any context provided to the Context method. 8545func (c *PermissionsListCall) Pages(ctx context.Context, f func(*PermissionList) error) error { 8546 c.ctx_ = ctx 8547 defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point 8548 for { 8549 x, err := c.Do() 8550 if err != nil { 8551 return err 8552 } 8553 if err := f(x); err != nil { 8554 return err 8555 } 8556 if x.NextPageToken == "" { 8557 return nil 8558 } 8559 c.PageToken(x.NextPageToken) 8560 } 8561} 8562 8563// method id "drive.permissions.update": 8564 8565type PermissionsUpdateCall struct { 8566 s *Service 8567 fileId string 8568 permissionId string 8569 permission *Permission 8570 urlParams_ gensupport.URLParams 8571 ctx_ context.Context 8572 header_ http.Header 8573} 8574 8575// Update: Updates a permission with patch semantics. 8576func (r *PermissionsService) Update(fileId string, permissionId string, permission *Permission) *PermissionsUpdateCall { 8577 c := &PermissionsUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)} 8578 c.fileId = fileId 8579 c.permissionId = permissionId 8580 c.permission = permission 8581 return c 8582} 8583 8584// RemoveExpiration sets the optional parameter "removeExpiration": 8585// Whether to remove the expiration date. 8586func (c *PermissionsUpdateCall) RemoveExpiration(removeExpiration bool) *PermissionsUpdateCall { 8587 c.urlParams_.Set("removeExpiration", fmt.Sprint(removeExpiration)) 8588 return c 8589} 8590 8591// SupportsAllDrives sets the optional parameter "supportsAllDrives": 8592// Deprecated - Whether the requesting application supports both My 8593// Drives and shared drives. This parameter will only be effective until 8594// June 1, 2020. Afterwards all applications are assumed to support 8595// shared drives. 8596func (c *PermissionsUpdateCall) SupportsAllDrives(supportsAllDrives bool) *PermissionsUpdateCall { 8597 c.urlParams_.Set("supportsAllDrives", fmt.Sprint(supportsAllDrives)) 8598 return c 8599} 8600 8601// SupportsTeamDrives sets the optional parameter "supportsTeamDrives": 8602// Deprecated use supportsAllDrives instead. 8603func (c *PermissionsUpdateCall) SupportsTeamDrives(supportsTeamDrives bool) *PermissionsUpdateCall { 8604 c.urlParams_.Set("supportsTeamDrives", fmt.Sprint(supportsTeamDrives)) 8605 return c 8606} 8607 8608// TransferOwnership sets the optional parameter "transferOwnership": 8609// Whether to transfer ownership to the specified user and downgrade the 8610// current owner to a writer. This parameter is required as an 8611// acknowledgement of the side effect. 8612func (c *PermissionsUpdateCall) TransferOwnership(transferOwnership bool) *PermissionsUpdateCall { 8613 c.urlParams_.Set("transferOwnership", fmt.Sprint(transferOwnership)) 8614 return c 8615} 8616 8617// UseDomainAdminAccess sets the optional parameter 8618// "useDomainAdminAccess": Issue the request as a domain administrator; 8619// if set to true, then the requester will be granted access if the file 8620// ID parameter refers to a shared drive and the requester is an 8621// administrator of the domain to which the shared drive belongs. 8622func (c *PermissionsUpdateCall) UseDomainAdminAccess(useDomainAdminAccess bool) *PermissionsUpdateCall { 8623 c.urlParams_.Set("useDomainAdminAccess", fmt.Sprint(useDomainAdminAccess)) 8624 return c 8625} 8626 8627// Fields allows partial responses to be retrieved. See 8628// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 8629// for more information. 8630func (c *PermissionsUpdateCall) Fields(s ...googleapi.Field) *PermissionsUpdateCall { 8631 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 8632 return c 8633} 8634 8635// Context sets the context to be used in this call's Do method. Any 8636// pending HTTP request will be aborted if the provided context is 8637// canceled. 8638func (c *PermissionsUpdateCall) Context(ctx context.Context) *PermissionsUpdateCall { 8639 c.ctx_ = ctx 8640 return c 8641} 8642 8643// Header returns an http.Header that can be modified by the caller to 8644// add HTTP headers to the request. 8645func (c *PermissionsUpdateCall) Header() http.Header { 8646 if c.header_ == nil { 8647 c.header_ = make(http.Header) 8648 } 8649 return c.header_ 8650} 8651 8652func (c *PermissionsUpdateCall) doRequest(alt string) (*http.Response, error) { 8653 reqHeaders := make(http.Header) 8654 for k, v := range c.header_ { 8655 reqHeaders[k] = v 8656 } 8657 reqHeaders.Set("User-Agent", c.s.userAgent()) 8658 var body io.Reader = nil 8659 body, err := googleapi.WithoutDataWrapper.JSONReader(c.permission) 8660 if err != nil { 8661 return nil, err 8662 } 8663 reqHeaders.Set("Content-Type", "application/json") 8664 c.urlParams_.Set("alt", alt) 8665 c.urlParams_.Set("prettyPrint", "false") 8666 urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/permissions/{permissionId}") 8667 urls += "?" + c.urlParams_.Encode() 8668 req, err := http.NewRequest("PATCH", urls, body) 8669 if err != nil { 8670 return nil, err 8671 } 8672 req.Header = reqHeaders 8673 googleapi.Expand(req.URL, map[string]string{ 8674 "fileId": c.fileId, 8675 "permissionId": c.permissionId, 8676 }) 8677 return gensupport.SendRequest(c.ctx_, c.s.client, req) 8678} 8679 8680// Do executes the "drive.permissions.update" call. 8681// Exactly one of *Permission or error will be non-nil. Any non-2xx 8682// status code is an error. Response headers are in either 8683// *Permission.ServerResponse.Header or (if a response was returned at 8684// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 8685// to check whether the returned error was because 8686// http.StatusNotModified was returned. 8687func (c *PermissionsUpdateCall) Do(opts ...googleapi.CallOption) (*Permission, error) { 8688 gensupport.SetOptions(c.urlParams_, opts...) 8689 res, err := c.doRequest("json") 8690 if res != nil && res.StatusCode == http.StatusNotModified { 8691 if res.Body != nil { 8692 res.Body.Close() 8693 } 8694 return nil, &googleapi.Error{ 8695 Code: res.StatusCode, 8696 Header: res.Header, 8697 } 8698 } 8699 if err != nil { 8700 return nil, err 8701 } 8702 defer googleapi.CloseBody(res) 8703 if err := googleapi.CheckResponse(res); err != nil { 8704 return nil, err 8705 } 8706 ret := &Permission{ 8707 ServerResponse: googleapi.ServerResponse{ 8708 Header: res.Header, 8709 HTTPStatusCode: res.StatusCode, 8710 }, 8711 } 8712 target := &ret 8713 if err := gensupport.DecodeResponse(target, res); err != nil { 8714 return nil, err 8715 } 8716 return ret, nil 8717 // { 8718 // "description": "Updates a permission with patch semantics.", 8719 // "httpMethod": "PATCH", 8720 // "id": "drive.permissions.update", 8721 // "parameterOrder": [ 8722 // "fileId", 8723 // "permissionId" 8724 // ], 8725 // "parameters": { 8726 // "fileId": { 8727 // "description": "The ID of the file or shared drive.", 8728 // "location": "path", 8729 // "required": true, 8730 // "type": "string" 8731 // }, 8732 // "permissionId": { 8733 // "description": "The ID of the permission.", 8734 // "location": "path", 8735 // "required": true, 8736 // "type": "string" 8737 // }, 8738 // "removeExpiration": { 8739 // "default": "false", 8740 // "description": "Whether to remove the expiration date.", 8741 // "location": "query", 8742 // "type": "boolean" 8743 // }, 8744 // "supportsAllDrives": { 8745 // "default": "false", 8746 // "description": "Deprecated - Whether the requesting application supports both My Drives and shared drives. This parameter will only be effective until June 1, 2020. Afterwards all applications are assumed to support shared drives.", 8747 // "location": "query", 8748 // "type": "boolean" 8749 // }, 8750 // "supportsTeamDrives": { 8751 // "default": "false", 8752 // "description": "Deprecated use supportsAllDrives instead.", 8753 // "location": "query", 8754 // "type": "boolean" 8755 // }, 8756 // "transferOwnership": { 8757 // "default": "false", 8758 // "description": "Whether to transfer ownership to the specified user and downgrade the current owner to a writer. This parameter is required as an acknowledgement of the side effect.", 8759 // "location": "query", 8760 // "type": "boolean" 8761 // }, 8762 // "useDomainAdminAccess": { 8763 // "default": "false", 8764 // "description": "Issue the request as a domain administrator; if set to true, then the requester will be granted access if the file ID parameter refers to a shared drive and the requester is an administrator of the domain to which the shared drive belongs.", 8765 // "location": "query", 8766 // "type": "boolean" 8767 // } 8768 // }, 8769 // "path": "files/{fileId}/permissions/{permissionId}", 8770 // "request": { 8771 // "$ref": "Permission" 8772 // }, 8773 // "response": { 8774 // "$ref": "Permission" 8775 // }, 8776 // "scopes": [ 8777 // "https://www.googleapis.com/auth/drive", 8778 // "https://www.googleapis.com/auth/drive.file" 8779 // ] 8780 // } 8781 8782} 8783 8784// method id "drive.replies.create": 8785 8786type RepliesCreateCall struct { 8787 s *Service 8788 fileId string 8789 commentId string 8790 reply *Reply 8791 urlParams_ gensupport.URLParams 8792 ctx_ context.Context 8793 header_ http.Header 8794} 8795 8796// Create: Creates a new reply to a comment. 8797func (r *RepliesService) Create(fileId string, commentId string, reply *Reply) *RepliesCreateCall { 8798 c := &RepliesCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)} 8799 c.fileId = fileId 8800 c.commentId = commentId 8801 c.reply = reply 8802 return c 8803} 8804 8805// Fields allows partial responses to be retrieved. See 8806// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 8807// for more information. 8808func (c *RepliesCreateCall) Fields(s ...googleapi.Field) *RepliesCreateCall { 8809 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 8810 return c 8811} 8812 8813// Context sets the context to be used in this call's Do method. Any 8814// pending HTTP request will be aborted if the provided context is 8815// canceled. 8816func (c *RepliesCreateCall) Context(ctx context.Context) *RepliesCreateCall { 8817 c.ctx_ = ctx 8818 return c 8819} 8820 8821// Header returns an http.Header that can be modified by the caller to 8822// add HTTP headers to the request. 8823func (c *RepliesCreateCall) Header() http.Header { 8824 if c.header_ == nil { 8825 c.header_ = make(http.Header) 8826 } 8827 return c.header_ 8828} 8829 8830func (c *RepliesCreateCall) doRequest(alt string) (*http.Response, error) { 8831 reqHeaders := make(http.Header) 8832 for k, v := range c.header_ { 8833 reqHeaders[k] = v 8834 } 8835 reqHeaders.Set("User-Agent", c.s.userAgent()) 8836 var body io.Reader = nil 8837 body, err := googleapi.WithoutDataWrapper.JSONReader(c.reply) 8838 if err != nil { 8839 return nil, err 8840 } 8841 reqHeaders.Set("Content-Type", "application/json") 8842 c.urlParams_.Set("alt", alt) 8843 c.urlParams_.Set("prettyPrint", "false") 8844 urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/comments/{commentId}/replies") 8845 urls += "?" + c.urlParams_.Encode() 8846 req, err := http.NewRequest("POST", urls, body) 8847 if err != nil { 8848 return nil, err 8849 } 8850 req.Header = reqHeaders 8851 googleapi.Expand(req.URL, map[string]string{ 8852 "fileId": c.fileId, 8853 "commentId": c.commentId, 8854 }) 8855 return gensupport.SendRequest(c.ctx_, c.s.client, req) 8856} 8857 8858// Do executes the "drive.replies.create" call. 8859// Exactly one of *Reply or error will be non-nil. Any non-2xx status 8860// code is an error. Response headers are in either 8861// *Reply.ServerResponse.Header or (if a response was returned at all) 8862// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 8863// check whether the returned error was because http.StatusNotModified 8864// was returned. 8865func (c *RepliesCreateCall) Do(opts ...googleapi.CallOption) (*Reply, error) { 8866 gensupport.SetOptions(c.urlParams_, opts...) 8867 res, err := c.doRequest("json") 8868 if res != nil && res.StatusCode == http.StatusNotModified { 8869 if res.Body != nil { 8870 res.Body.Close() 8871 } 8872 return nil, &googleapi.Error{ 8873 Code: res.StatusCode, 8874 Header: res.Header, 8875 } 8876 } 8877 if err != nil { 8878 return nil, err 8879 } 8880 defer googleapi.CloseBody(res) 8881 if err := googleapi.CheckResponse(res); err != nil { 8882 return nil, err 8883 } 8884 ret := &Reply{ 8885 ServerResponse: googleapi.ServerResponse{ 8886 Header: res.Header, 8887 HTTPStatusCode: res.StatusCode, 8888 }, 8889 } 8890 target := &ret 8891 if err := gensupport.DecodeResponse(target, res); err != nil { 8892 return nil, err 8893 } 8894 return ret, nil 8895 // { 8896 // "description": "Creates a new reply to a comment.", 8897 // "httpMethod": "POST", 8898 // "id": "drive.replies.create", 8899 // "parameterOrder": [ 8900 // "fileId", 8901 // "commentId" 8902 // ], 8903 // "parameters": { 8904 // "commentId": { 8905 // "description": "The ID of the comment.", 8906 // "location": "path", 8907 // "required": true, 8908 // "type": "string" 8909 // }, 8910 // "fileId": { 8911 // "description": "The ID of the file.", 8912 // "location": "path", 8913 // "required": true, 8914 // "type": "string" 8915 // } 8916 // }, 8917 // "path": "files/{fileId}/comments/{commentId}/replies", 8918 // "request": { 8919 // "$ref": "Reply" 8920 // }, 8921 // "response": { 8922 // "$ref": "Reply" 8923 // }, 8924 // "scopes": [ 8925 // "https://www.googleapis.com/auth/drive", 8926 // "https://www.googleapis.com/auth/drive.file" 8927 // ] 8928 // } 8929 8930} 8931 8932// method id "drive.replies.delete": 8933 8934type RepliesDeleteCall struct { 8935 s *Service 8936 fileId string 8937 commentId string 8938 replyId string 8939 urlParams_ gensupport.URLParams 8940 ctx_ context.Context 8941 header_ http.Header 8942} 8943 8944// Delete: Deletes a reply. 8945func (r *RepliesService) Delete(fileId string, commentId string, replyId string) *RepliesDeleteCall { 8946 c := &RepliesDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)} 8947 c.fileId = fileId 8948 c.commentId = commentId 8949 c.replyId = replyId 8950 return c 8951} 8952 8953// Fields allows partial responses to be retrieved. See 8954// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 8955// for more information. 8956func (c *RepliesDeleteCall) Fields(s ...googleapi.Field) *RepliesDeleteCall { 8957 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 8958 return c 8959} 8960 8961// Context sets the context to be used in this call's Do method. Any 8962// pending HTTP request will be aborted if the provided context is 8963// canceled. 8964func (c *RepliesDeleteCall) Context(ctx context.Context) *RepliesDeleteCall { 8965 c.ctx_ = ctx 8966 return c 8967} 8968 8969// Header returns an http.Header that can be modified by the caller to 8970// add HTTP headers to the request. 8971func (c *RepliesDeleteCall) Header() http.Header { 8972 if c.header_ == nil { 8973 c.header_ = make(http.Header) 8974 } 8975 return c.header_ 8976} 8977 8978func (c *RepliesDeleteCall) doRequest(alt string) (*http.Response, error) { 8979 reqHeaders := make(http.Header) 8980 for k, v := range c.header_ { 8981 reqHeaders[k] = v 8982 } 8983 reqHeaders.Set("User-Agent", c.s.userAgent()) 8984 var body io.Reader = nil 8985 c.urlParams_.Set("alt", alt) 8986 c.urlParams_.Set("prettyPrint", "false") 8987 urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/comments/{commentId}/replies/{replyId}") 8988 urls += "?" + c.urlParams_.Encode() 8989 req, err := http.NewRequest("DELETE", urls, body) 8990 if err != nil { 8991 return nil, err 8992 } 8993 req.Header = reqHeaders 8994 googleapi.Expand(req.URL, map[string]string{ 8995 "fileId": c.fileId, 8996 "commentId": c.commentId, 8997 "replyId": c.replyId, 8998 }) 8999 return gensupport.SendRequest(c.ctx_, c.s.client, req) 9000} 9001 9002// Do executes the "drive.replies.delete" call. 9003func (c *RepliesDeleteCall) Do(opts ...googleapi.CallOption) error { 9004 gensupport.SetOptions(c.urlParams_, opts...) 9005 res, err := c.doRequest("json") 9006 if err != nil { 9007 return err 9008 } 9009 defer googleapi.CloseBody(res) 9010 if err := googleapi.CheckResponse(res); err != nil { 9011 return err 9012 } 9013 return nil 9014 // { 9015 // "description": "Deletes a reply.", 9016 // "httpMethod": "DELETE", 9017 // "id": "drive.replies.delete", 9018 // "parameterOrder": [ 9019 // "fileId", 9020 // "commentId", 9021 // "replyId" 9022 // ], 9023 // "parameters": { 9024 // "commentId": { 9025 // "description": "The ID of the comment.", 9026 // "location": "path", 9027 // "required": true, 9028 // "type": "string" 9029 // }, 9030 // "fileId": { 9031 // "description": "The ID of the file.", 9032 // "location": "path", 9033 // "required": true, 9034 // "type": "string" 9035 // }, 9036 // "replyId": { 9037 // "description": "The ID of the reply.", 9038 // "location": "path", 9039 // "required": true, 9040 // "type": "string" 9041 // } 9042 // }, 9043 // "path": "files/{fileId}/comments/{commentId}/replies/{replyId}", 9044 // "scopes": [ 9045 // "https://www.googleapis.com/auth/drive", 9046 // "https://www.googleapis.com/auth/drive.file" 9047 // ] 9048 // } 9049 9050} 9051 9052// method id "drive.replies.get": 9053 9054type RepliesGetCall struct { 9055 s *Service 9056 fileId string 9057 commentId string 9058 replyId string 9059 urlParams_ gensupport.URLParams 9060 ifNoneMatch_ string 9061 ctx_ context.Context 9062 header_ http.Header 9063} 9064 9065// Get: Gets a reply by ID. 9066func (r *RepliesService) Get(fileId string, commentId string, replyId string) *RepliesGetCall { 9067 c := &RepliesGetCall{s: r.s, urlParams_: make(gensupport.URLParams)} 9068 c.fileId = fileId 9069 c.commentId = commentId 9070 c.replyId = replyId 9071 return c 9072} 9073 9074// IncludeDeleted sets the optional parameter "includeDeleted": Whether 9075// to return deleted replies. Deleted replies will not include their 9076// original content. 9077func (c *RepliesGetCall) IncludeDeleted(includeDeleted bool) *RepliesGetCall { 9078 c.urlParams_.Set("includeDeleted", fmt.Sprint(includeDeleted)) 9079 return c 9080} 9081 9082// Fields allows partial responses to be retrieved. See 9083// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 9084// for more information. 9085func (c *RepliesGetCall) Fields(s ...googleapi.Field) *RepliesGetCall { 9086 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 9087 return c 9088} 9089 9090// IfNoneMatch sets the optional parameter which makes the operation 9091// fail if the object's ETag matches the given value. This is useful for 9092// getting updates only after the object has changed since the last 9093// request. Use googleapi.IsNotModified to check whether the response 9094// error from Do is the result of In-None-Match. 9095func (c *RepliesGetCall) IfNoneMatch(entityTag string) *RepliesGetCall { 9096 c.ifNoneMatch_ = entityTag 9097 return c 9098} 9099 9100// Context sets the context to be used in this call's Do method. Any 9101// pending HTTP request will be aborted if the provided context is 9102// canceled. 9103func (c *RepliesGetCall) Context(ctx context.Context) *RepliesGetCall { 9104 c.ctx_ = ctx 9105 return c 9106} 9107 9108// Header returns an http.Header that can be modified by the caller to 9109// add HTTP headers to the request. 9110func (c *RepliesGetCall) Header() http.Header { 9111 if c.header_ == nil { 9112 c.header_ = make(http.Header) 9113 } 9114 return c.header_ 9115} 9116 9117func (c *RepliesGetCall) doRequest(alt string) (*http.Response, error) { 9118 reqHeaders := make(http.Header) 9119 for k, v := range c.header_ { 9120 reqHeaders[k] = v 9121 } 9122 reqHeaders.Set("User-Agent", c.s.userAgent()) 9123 if c.ifNoneMatch_ != "" { 9124 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 9125 } 9126 var body io.Reader = nil 9127 c.urlParams_.Set("alt", alt) 9128 c.urlParams_.Set("prettyPrint", "false") 9129 urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/comments/{commentId}/replies/{replyId}") 9130 urls += "?" + c.urlParams_.Encode() 9131 req, err := http.NewRequest("GET", urls, body) 9132 if err != nil { 9133 return nil, err 9134 } 9135 req.Header = reqHeaders 9136 googleapi.Expand(req.URL, map[string]string{ 9137 "fileId": c.fileId, 9138 "commentId": c.commentId, 9139 "replyId": c.replyId, 9140 }) 9141 return gensupport.SendRequest(c.ctx_, c.s.client, req) 9142} 9143 9144// Do executes the "drive.replies.get" call. 9145// Exactly one of *Reply or error will be non-nil. Any non-2xx status 9146// code is an error. Response headers are in either 9147// *Reply.ServerResponse.Header or (if a response was returned at all) 9148// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 9149// check whether the returned error was because http.StatusNotModified 9150// was returned. 9151func (c *RepliesGetCall) Do(opts ...googleapi.CallOption) (*Reply, error) { 9152 gensupport.SetOptions(c.urlParams_, opts...) 9153 res, err := c.doRequest("json") 9154 if res != nil && res.StatusCode == http.StatusNotModified { 9155 if res.Body != nil { 9156 res.Body.Close() 9157 } 9158 return nil, &googleapi.Error{ 9159 Code: res.StatusCode, 9160 Header: res.Header, 9161 } 9162 } 9163 if err != nil { 9164 return nil, err 9165 } 9166 defer googleapi.CloseBody(res) 9167 if err := googleapi.CheckResponse(res); err != nil { 9168 return nil, err 9169 } 9170 ret := &Reply{ 9171 ServerResponse: googleapi.ServerResponse{ 9172 Header: res.Header, 9173 HTTPStatusCode: res.StatusCode, 9174 }, 9175 } 9176 target := &ret 9177 if err := gensupport.DecodeResponse(target, res); err != nil { 9178 return nil, err 9179 } 9180 return ret, nil 9181 // { 9182 // "description": "Gets a reply by ID.", 9183 // "httpMethod": "GET", 9184 // "id": "drive.replies.get", 9185 // "parameterOrder": [ 9186 // "fileId", 9187 // "commentId", 9188 // "replyId" 9189 // ], 9190 // "parameters": { 9191 // "commentId": { 9192 // "description": "The ID of the comment.", 9193 // "location": "path", 9194 // "required": true, 9195 // "type": "string" 9196 // }, 9197 // "fileId": { 9198 // "description": "The ID of the file.", 9199 // "location": "path", 9200 // "required": true, 9201 // "type": "string" 9202 // }, 9203 // "includeDeleted": { 9204 // "default": "false", 9205 // "description": "Whether to return deleted replies. Deleted replies will not include their original content.", 9206 // "location": "query", 9207 // "type": "boolean" 9208 // }, 9209 // "replyId": { 9210 // "description": "The ID of the reply.", 9211 // "location": "path", 9212 // "required": true, 9213 // "type": "string" 9214 // } 9215 // }, 9216 // "path": "files/{fileId}/comments/{commentId}/replies/{replyId}", 9217 // "response": { 9218 // "$ref": "Reply" 9219 // }, 9220 // "scopes": [ 9221 // "https://www.googleapis.com/auth/drive", 9222 // "https://www.googleapis.com/auth/drive.file", 9223 // "https://www.googleapis.com/auth/drive.readonly" 9224 // ] 9225 // } 9226 9227} 9228 9229// method id "drive.replies.list": 9230 9231type RepliesListCall struct { 9232 s *Service 9233 fileId string 9234 commentId string 9235 urlParams_ gensupport.URLParams 9236 ifNoneMatch_ string 9237 ctx_ context.Context 9238 header_ http.Header 9239} 9240 9241// List: Lists a comment's replies. 9242func (r *RepliesService) List(fileId string, commentId string) *RepliesListCall { 9243 c := &RepliesListCall{s: r.s, urlParams_: make(gensupport.URLParams)} 9244 c.fileId = fileId 9245 c.commentId = commentId 9246 return c 9247} 9248 9249// IncludeDeleted sets the optional parameter "includeDeleted": Whether 9250// to include deleted replies. Deleted replies will not include their 9251// original content. 9252func (c *RepliesListCall) IncludeDeleted(includeDeleted bool) *RepliesListCall { 9253 c.urlParams_.Set("includeDeleted", fmt.Sprint(includeDeleted)) 9254 return c 9255} 9256 9257// PageSize sets the optional parameter "pageSize": The maximum number 9258// of replies to return per page. 9259func (c *RepliesListCall) PageSize(pageSize int64) *RepliesListCall { 9260 c.urlParams_.Set("pageSize", fmt.Sprint(pageSize)) 9261 return c 9262} 9263 9264// PageToken sets the optional parameter "pageToken": The token for 9265// continuing a previous list request on the next page. This should be 9266// set to the value of 'nextPageToken' from the previous response. 9267func (c *RepliesListCall) PageToken(pageToken string) *RepliesListCall { 9268 c.urlParams_.Set("pageToken", pageToken) 9269 return c 9270} 9271 9272// Fields allows partial responses to be retrieved. See 9273// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 9274// for more information. 9275func (c *RepliesListCall) Fields(s ...googleapi.Field) *RepliesListCall { 9276 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 9277 return c 9278} 9279 9280// IfNoneMatch sets the optional parameter which makes the operation 9281// fail if the object's ETag matches the given value. This is useful for 9282// getting updates only after the object has changed since the last 9283// request. Use googleapi.IsNotModified to check whether the response 9284// error from Do is the result of In-None-Match. 9285func (c *RepliesListCall) IfNoneMatch(entityTag string) *RepliesListCall { 9286 c.ifNoneMatch_ = entityTag 9287 return c 9288} 9289 9290// Context sets the context to be used in this call's Do method. Any 9291// pending HTTP request will be aborted if the provided context is 9292// canceled. 9293func (c *RepliesListCall) Context(ctx context.Context) *RepliesListCall { 9294 c.ctx_ = ctx 9295 return c 9296} 9297 9298// Header returns an http.Header that can be modified by the caller to 9299// add HTTP headers to the request. 9300func (c *RepliesListCall) Header() http.Header { 9301 if c.header_ == nil { 9302 c.header_ = make(http.Header) 9303 } 9304 return c.header_ 9305} 9306 9307func (c *RepliesListCall) doRequest(alt string) (*http.Response, error) { 9308 reqHeaders := make(http.Header) 9309 for k, v := range c.header_ { 9310 reqHeaders[k] = v 9311 } 9312 reqHeaders.Set("User-Agent", c.s.userAgent()) 9313 if c.ifNoneMatch_ != "" { 9314 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 9315 } 9316 var body io.Reader = nil 9317 c.urlParams_.Set("alt", alt) 9318 c.urlParams_.Set("prettyPrint", "false") 9319 urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/comments/{commentId}/replies") 9320 urls += "?" + c.urlParams_.Encode() 9321 req, err := http.NewRequest("GET", urls, body) 9322 if err != nil { 9323 return nil, err 9324 } 9325 req.Header = reqHeaders 9326 googleapi.Expand(req.URL, map[string]string{ 9327 "fileId": c.fileId, 9328 "commentId": c.commentId, 9329 }) 9330 return gensupport.SendRequest(c.ctx_, c.s.client, req) 9331} 9332 9333// Do executes the "drive.replies.list" call. 9334// Exactly one of *ReplyList or error will be non-nil. Any non-2xx 9335// status code is an error. Response headers are in either 9336// *ReplyList.ServerResponse.Header or (if a response was returned at 9337// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 9338// to check whether the returned error was because 9339// http.StatusNotModified was returned. 9340func (c *RepliesListCall) Do(opts ...googleapi.CallOption) (*ReplyList, error) { 9341 gensupport.SetOptions(c.urlParams_, opts...) 9342 res, err := c.doRequest("json") 9343 if res != nil && res.StatusCode == http.StatusNotModified { 9344 if res.Body != nil { 9345 res.Body.Close() 9346 } 9347 return nil, &googleapi.Error{ 9348 Code: res.StatusCode, 9349 Header: res.Header, 9350 } 9351 } 9352 if err != nil { 9353 return nil, err 9354 } 9355 defer googleapi.CloseBody(res) 9356 if err := googleapi.CheckResponse(res); err != nil { 9357 return nil, err 9358 } 9359 ret := &ReplyList{ 9360 ServerResponse: googleapi.ServerResponse{ 9361 Header: res.Header, 9362 HTTPStatusCode: res.StatusCode, 9363 }, 9364 } 9365 target := &ret 9366 if err := gensupport.DecodeResponse(target, res); err != nil { 9367 return nil, err 9368 } 9369 return ret, nil 9370 // { 9371 // "description": "Lists a comment's replies.", 9372 // "httpMethod": "GET", 9373 // "id": "drive.replies.list", 9374 // "parameterOrder": [ 9375 // "fileId", 9376 // "commentId" 9377 // ], 9378 // "parameters": { 9379 // "commentId": { 9380 // "description": "The ID of the comment.", 9381 // "location": "path", 9382 // "required": true, 9383 // "type": "string" 9384 // }, 9385 // "fileId": { 9386 // "description": "The ID of the file.", 9387 // "location": "path", 9388 // "required": true, 9389 // "type": "string" 9390 // }, 9391 // "includeDeleted": { 9392 // "default": "false", 9393 // "description": "Whether to include deleted replies. Deleted replies will not include their original content.", 9394 // "location": "query", 9395 // "type": "boolean" 9396 // }, 9397 // "pageSize": { 9398 // "default": "20", 9399 // "description": "The maximum number of replies to return per page.", 9400 // "format": "int32", 9401 // "location": "query", 9402 // "maximum": "100", 9403 // "minimum": "1", 9404 // "type": "integer" 9405 // }, 9406 // "pageToken": { 9407 // "description": "The token for continuing a previous list request on the next page. This should be set to the value of 'nextPageToken' from the previous response.", 9408 // "location": "query", 9409 // "type": "string" 9410 // } 9411 // }, 9412 // "path": "files/{fileId}/comments/{commentId}/replies", 9413 // "response": { 9414 // "$ref": "ReplyList" 9415 // }, 9416 // "scopes": [ 9417 // "https://www.googleapis.com/auth/drive", 9418 // "https://www.googleapis.com/auth/drive.file", 9419 // "https://www.googleapis.com/auth/drive.readonly" 9420 // ] 9421 // } 9422 9423} 9424 9425// Pages invokes f for each page of results. 9426// A non-nil error returned from f will halt the iteration. 9427// The provided context supersedes any context provided to the Context method. 9428func (c *RepliesListCall) Pages(ctx context.Context, f func(*ReplyList) error) error { 9429 c.ctx_ = ctx 9430 defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point 9431 for { 9432 x, err := c.Do() 9433 if err != nil { 9434 return err 9435 } 9436 if err := f(x); err != nil { 9437 return err 9438 } 9439 if x.NextPageToken == "" { 9440 return nil 9441 } 9442 c.PageToken(x.NextPageToken) 9443 } 9444} 9445 9446// method id "drive.replies.update": 9447 9448type RepliesUpdateCall struct { 9449 s *Service 9450 fileId string 9451 commentId string 9452 replyId string 9453 reply *Reply 9454 urlParams_ gensupport.URLParams 9455 ctx_ context.Context 9456 header_ http.Header 9457} 9458 9459// Update: Updates a reply with patch semantics. 9460func (r *RepliesService) Update(fileId string, commentId string, replyId string, reply *Reply) *RepliesUpdateCall { 9461 c := &RepliesUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)} 9462 c.fileId = fileId 9463 c.commentId = commentId 9464 c.replyId = replyId 9465 c.reply = reply 9466 return c 9467} 9468 9469// Fields allows partial responses to be retrieved. See 9470// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 9471// for more information. 9472func (c *RepliesUpdateCall) Fields(s ...googleapi.Field) *RepliesUpdateCall { 9473 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 9474 return c 9475} 9476 9477// Context sets the context to be used in this call's Do method. Any 9478// pending HTTP request will be aborted if the provided context is 9479// canceled. 9480func (c *RepliesUpdateCall) Context(ctx context.Context) *RepliesUpdateCall { 9481 c.ctx_ = ctx 9482 return c 9483} 9484 9485// Header returns an http.Header that can be modified by the caller to 9486// add HTTP headers to the request. 9487func (c *RepliesUpdateCall) Header() http.Header { 9488 if c.header_ == nil { 9489 c.header_ = make(http.Header) 9490 } 9491 return c.header_ 9492} 9493 9494func (c *RepliesUpdateCall) doRequest(alt string) (*http.Response, error) { 9495 reqHeaders := make(http.Header) 9496 for k, v := range c.header_ { 9497 reqHeaders[k] = v 9498 } 9499 reqHeaders.Set("User-Agent", c.s.userAgent()) 9500 var body io.Reader = nil 9501 body, err := googleapi.WithoutDataWrapper.JSONReader(c.reply) 9502 if err != nil { 9503 return nil, err 9504 } 9505 reqHeaders.Set("Content-Type", "application/json") 9506 c.urlParams_.Set("alt", alt) 9507 c.urlParams_.Set("prettyPrint", "false") 9508 urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/comments/{commentId}/replies/{replyId}") 9509 urls += "?" + c.urlParams_.Encode() 9510 req, err := http.NewRequest("PATCH", urls, body) 9511 if err != nil { 9512 return nil, err 9513 } 9514 req.Header = reqHeaders 9515 googleapi.Expand(req.URL, map[string]string{ 9516 "fileId": c.fileId, 9517 "commentId": c.commentId, 9518 "replyId": c.replyId, 9519 }) 9520 return gensupport.SendRequest(c.ctx_, c.s.client, req) 9521} 9522 9523// Do executes the "drive.replies.update" call. 9524// Exactly one of *Reply or error will be non-nil. Any non-2xx status 9525// code is an error. Response headers are in either 9526// *Reply.ServerResponse.Header or (if a response was returned at all) 9527// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 9528// check whether the returned error was because http.StatusNotModified 9529// was returned. 9530func (c *RepliesUpdateCall) Do(opts ...googleapi.CallOption) (*Reply, error) { 9531 gensupport.SetOptions(c.urlParams_, opts...) 9532 res, err := c.doRequest("json") 9533 if res != nil && res.StatusCode == http.StatusNotModified { 9534 if res.Body != nil { 9535 res.Body.Close() 9536 } 9537 return nil, &googleapi.Error{ 9538 Code: res.StatusCode, 9539 Header: res.Header, 9540 } 9541 } 9542 if err != nil { 9543 return nil, err 9544 } 9545 defer googleapi.CloseBody(res) 9546 if err := googleapi.CheckResponse(res); err != nil { 9547 return nil, err 9548 } 9549 ret := &Reply{ 9550 ServerResponse: googleapi.ServerResponse{ 9551 Header: res.Header, 9552 HTTPStatusCode: res.StatusCode, 9553 }, 9554 } 9555 target := &ret 9556 if err := gensupport.DecodeResponse(target, res); err != nil { 9557 return nil, err 9558 } 9559 return ret, nil 9560 // { 9561 // "description": "Updates a reply with patch semantics.", 9562 // "httpMethod": "PATCH", 9563 // "id": "drive.replies.update", 9564 // "parameterOrder": [ 9565 // "fileId", 9566 // "commentId", 9567 // "replyId" 9568 // ], 9569 // "parameters": { 9570 // "commentId": { 9571 // "description": "The ID of the comment.", 9572 // "location": "path", 9573 // "required": true, 9574 // "type": "string" 9575 // }, 9576 // "fileId": { 9577 // "description": "The ID of the file.", 9578 // "location": "path", 9579 // "required": true, 9580 // "type": "string" 9581 // }, 9582 // "replyId": { 9583 // "description": "The ID of the reply.", 9584 // "location": "path", 9585 // "required": true, 9586 // "type": "string" 9587 // } 9588 // }, 9589 // "path": "files/{fileId}/comments/{commentId}/replies/{replyId}", 9590 // "request": { 9591 // "$ref": "Reply" 9592 // }, 9593 // "response": { 9594 // "$ref": "Reply" 9595 // }, 9596 // "scopes": [ 9597 // "https://www.googleapis.com/auth/drive", 9598 // "https://www.googleapis.com/auth/drive.file" 9599 // ] 9600 // } 9601 9602} 9603 9604// method id "drive.revisions.delete": 9605 9606type RevisionsDeleteCall struct { 9607 s *Service 9608 fileId string 9609 revisionId string 9610 urlParams_ gensupport.URLParams 9611 ctx_ context.Context 9612 header_ http.Header 9613} 9614 9615// Delete: Permanently deletes a file version. You can only delete 9616// revisions for files with binary content in Google Drive, like images 9617// or videos. Revisions for other files, like Google Docs or Sheets, and 9618// the last remaining file version can't be deleted. 9619func (r *RevisionsService) Delete(fileId string, revisionId string) *RevisionsDeleteCall { 9620 c := &RevisionsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)} 9621 c.fileId = fileId 9622 c.revisionId = revisionId 9623 return c 9624} 9625 9626// Fields allows partial responses to be retrieved. See 9627// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 9628// for more information. 9629func (c *RevisionsDeleteCall) Fields(s ...googleapi.Field) *RevisionsDeleteCall { 9630 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 9631 return c 9632} 9633 9634// Context sets the context to be used in this call's Do method. Any 9635// pending HTTP request will be aborted if the provided context is 9636// canceled. 9637func (c *RevisionsDeleteCall) Context(ctx context.Context) *RevisionsDeleteCall { 9638 c.ctx_ = ctx 9639 return c 9640} 9641 9642// Header returns an http.Header that can be modified by the caller to 9643// add HTTP headers to the request. 9644func (c *RevisionsDeleteCall) Header() http.Header { 9645 if c.header_ == nil { 9646 c.header_ = make(http.Header) 9647 } 9648 return c.header_ 9649} 9650 9651func (c *RevisionsDeleteCall) doRequest(alt string) (*http.Response, error) { 9652 reqHeaders := make(http.Header) 9653 for k, v := range c.header_ { 9654 reqHeaders[k] = v 9655 } 9656 reqHeaders.Set("User-Agent", c.s.userAgent()) 9657 var body io.Reader = nil 9658 c.urlParams_.Set("alt", alt) 9659 c.urlParams_.Set("prettyPrint", "false") 9660 urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/revisions/{revisionId}") 9661 urls += "?" + c.urlParams_.Encode() 9662 req, err := http.NewRequest("DELETE", urls, body) 9663 if err != nil { 9664 return nil, err 9665 } 9666 req.Header = reqHeaders 9667 googleapi.Expand(req.URL, map[string]string{ 9668 "fileId": c.fileId, 9669 "revisionId": c.revisionId, 9670 }) 9671 return gensupport.SendRequest(c.ctx_, c.s.client, req) 9672} 9673 9674// Do executes the "drive.revisions.delete" call. 9675func (c *RevisionsDeleteCall) Do(opts ...googleapi.CallOption) error { 9676 gensupport.SetOptions(c.urlParams_, opts...) 9677 res, err := c.doRequest("json") 9678 if err != nil { 9679 return err 9680 } 9681 defer googleapi.CloseBody(res) 9682 if err := googleapi.CheckResponse(res); err != nil { 9683 return err 9684 } 9685 return nil 9686 // { 9687 // "description": "Permanently deletes a file version. You can only delete revisions for files with binary content in Google Drive, like images or videos. Revisions for other files, like Google Docs or Sheets, and the last remaining file version can't be deleted.", 9688 // "httpMethod": "DELETE", 9689 // "id": "drive.revisions.delete", 9690 // "parameterOrder": [ 9691 // "fileId", 9692 // "revisionId" 9693 // ], 9694 // "parameters": { 9695 // "fileId": { 9696 // "description": "The ID of the file.", 9697 // "location": "path", 9698 // "required": true, 9699 // "type": "string" 9700 // }, 9701 // "revisionId": { 9702 // "description": "The ID of the revision.", 9703 // "location": "path", 9704 // "required": true, 9705 // "type": "string" 9706 // } 9707 // }, 9708 // "path": "files/{fileId}/revisions/{revisionId}", 9709 // "scopes": [ 9710 // "https://www.googleapis.com/auth/drive", 9711 // "https://www.googleapis.com/auth/drive.appdata", 9712 // "https://www.googleapis.com/auth/drive.file" 9713 // ] 9714 // } 9715 9716} 9717 9718// method id "drive.revisions.get": 9719 9720type RevisionsGetCall struct { 9721 s *Service 9722 fileId string 9723 revisionId string 9724 urlParams_ gensupport.URLParams 9725 ifNoneMatch_ string 9726 ctx_ context.Context 9727 header_ http.Header 9728} 9729 9730// Get: Gets a revision's metadata or content by ID. 9731func (r *RevisionsService) Get(fileId string, revisionId string) *RevisionsGetCall { 9732 c := &RevisionsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)} 9733 c.fileId = fileId 9734 c.revisionId = revisionId 9735 return c 9736} 9737 9738// AcknowledgeAbuse sets the optional parameter "acknowledgeAbuse": 9739// Whether the user is acknowledging the risk of downloading known 9740// malware or other abusive files. This is only applicable when 9741// alt=media. 9742func (c *RevisionsGetCall) AcknowledgeAbuse(acknowledgeAbuse bool) *RevisionsGetCall { 9743 c.urlParams_.Set("acknowledgeAbuse", fmt.Sprint(acknowledgeAbuse)) 9744 return c 9745} 9746 9747// Fields allows partial responses to be retrieved. See 9748// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 9749// for more information. 9750func (c *RevisionsGetCall) Fields(s ...googleapi.Field) *RevisionsGetCall { 9751 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 9752 return c 9753} 9754 9755// IfNoneMatch sets the optional parameter which makes the operation 9756// fail if the object's ETag matches the given value. This is useful for 9757// getting updates only after the object has changed since the last 9758// request. Use googleapi.IsNotModified to check whether the response 9759// error from Do is the result of In-None-Match. 9760func (c *RevisionsGetCall) IfNoneMatch(entityTag string) *RevisionsGetCall { 9761 c.ifNoneMatch_ = entityTag 9762 return c 9763} 9764 9765// Context sets the context to be used in this call's Do and Download 9766// methods. Any pending HTTP request will be aborted if the provided 9767// context is canceled. 9768func (c *RevisionsGetCall) Context(ctx context.Context) *RevisionsGetCall { 9769 c.ctx_ = ctx 9770 return c 9771} 9772 9773// Header returns an http.Header that can be modified by the caller to 9774// add HTTP headers to the request. 9775func (c *RevisionsGetCall) Header() http.Header { 9776 if c.header_ == nil { 9777 c.header_ = make(http.Header) 9778 } 9779 return c.header_ 9780} 9781 9782func (c *RevisionsGetCall) doRequest(alt string) (*http.Response, error) { 9783 reqHeaders := make(http.Header) 9784 for k, v := range c.header_ { 9785 reqHeaders[k] = v 9786 } 9787 reqHeaders.Set("User-Agent", c.s.userAgent()) 9788 if c.ifNoneMatch_ != "" { 9789 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 9790 } 9791 var body io.Reader = nil 9792 c.urlParams_.Set("alt", alt) 9793 c.urlParams_.Set("prettyPrint", "false") 9794 urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/revisions/{revisionId}") 9795 urls += "?" + c.urlParams_.Encode() 9796 req, err := http.NewRequest("GET", urls, body) 9797 if err != nil { 9798 return nil, err 9799 } 9800 req.Header = reqHeaders 9801 googleapi.Expand(req.URL, map[string]string{ 9802 "fileId": c.fileId, 9803 "revisionId": c.revisionId, 9804 }) 9805 return gensupport.SendRequest(c.ctx_, c.s.client, req) 9806} 9807 9808// Download fetches the API endpoint's "media" value, instead of the normal 9809// API response value. If the returned error is nil, the Response is guaranteed to 9810// have a 2xx status code. Callers must close the Response.Body as usual. 9811func (c *RevisionsGetCall) Download(opts ...googleapi.CallOption) (*http.Response, error) { 9812 gensupport.SetOptions(c.urlParams_, opts...) 9813 res, err := c.doRequest("media") 9814 if err != nil { 9815 return nil, err 9816 } 9817 if err := googleapi.CheckMediaResponse(res); err != nil { 9818 res.Body.Close() 9819 return nil, err 9820 } 9821 return res, nil 9822} 9823 9824// Do executes the "drive.revisions.get" call. 9825// Exactly one of *Revision or error will be non-nil. Any non-2xx status 9826// code is an error. Response headers are in either 9827// *Revision.ServerResponse.Header or (if a response was returned at 9828// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 9829// to check whether the returned error was because 9830// http.StatusNotModified was returned. 9831func (c *RevisionsGetCall) Do(opts ...googleapi.CallOption) (*Revision, error) { 9832 gensupport.SetOptions(c.urlParams_, opts...) 9833 res, err := c.doRequest("json") 9834 if res != nil && res.StatusCode == http.StatusNotModified { 9835 if res.Body != nil { 9836 res.Body.Close() 9837 } 9838 return nil, &googleapi.Error{ 9839 Code: res.StatusCode, 9840 Header: res.Header, 9841 } 9842 } 9843 if err != nil { 9844 return nil, err 9845 } 9846 defer googleapi.CloseBody(res) 9847 if err := googleapi.CheckResponse(res); err != nil { 9848 return nil, err 9849 } 9850 ret := &Revision{ 9851 ServerResponse: googleapi.ServerResponse{ 9852 Header: res.Header, 9853 HTTPStatusCode: res.StatusCode, 9854 }, 9855 } 9856 target := &ret 9857 if err := gensupport.DecodeResponse(target, res); err != nil { 9858 return nil, err 9859 } 9860 return ret, nil 9861 // { 9862 // "description": "Gets a revision's metadata or content by ID.", 9863 // "httpMethod": "GET", 9864 // "id": "drive.revisions.get", 9865 // "parameterOrder": [ 9866 // "fileId", 9867 // "revisionId" 9868 // ], 9869 // "parameters": { 9870 // "acknowledgeAbuse": { 9871 // "default": "false", 9872 // "description": "Whether the user is acknowledging the risk of downloading known malware or other abusive files. This is only applicable when alt=media.", 9873 // "location": "query", 9874 // "type": "boolean" 9875 // }, 9876 // "fileId": { 9877 // "description": "The ID of the file.", 9878 // "location": "path", 9879 // "required": true, 9880 // "type": "string" 9881 // }, 9882 // "revisionId": { 9883 // "description": "The ID of the revision.", 9884 // "location": "path", 9885 // "required": true, 9886 // "type": "string" 9887 // } 9888 // }, 9889 // "path": "files/{fileId}/revisions/{revisionId}", 9890 // "response": { 9891 // "$ref": "Revision" 9892 // }, 9893 // "scopes": [ 9894 // "https://www.googleapis.com/auth/drive", 9895 // "https://www.googleapis.com/auth/drive.appdata", 9896 // "https://www.googleapis.com/auth/drive.file", 9897 // "https://www.googleapis.com/auth/drive.metadata", 9898 // "https://www.googleapis.com/auth/drive.metadata.readonly", 9899 // "https://www.googleapis.com/auth/drive.photos.readonly", 9900 // "https://www.googleapis.com/auth/drive.readonly" 9901 // ], 9902 // "supportsMediaDownload": true, 9903 // "useMediaDownloadService": true 9904 // } 9905 9906} 9907 9908// method id "drive.revisions.list": 9909 9910type RevisionsListCall struct { 9911 s *Service 9912 fileId string 9913 urlParams_ gensupport.URLParams 9914 ifNoneMatch_ string 9915 ctx_ context.Context 9916 header_ http.Header 9917} 9918 9919// List: Lists a file's revisions. 9920func (r *RevisionsService) List(fileId string) *RevisionsListCall { 9921 c := &RevisionsListCall{s: r.s, urlParams_: make(gensupport.URLParams)} 9922 c.fileId = fileId 9923 return c 9924} 9925 9926// PageSize sets the optional parameter "pageSize": The maximum number 9927// of revisions to return per page. 9928func (c *RevisionsListCall) PageSize(pageSize int64) *RevisionsListCall { 9929 c.urlParams_.Set("pageSize", fmt.Sprint(pageSize)) 9930 return c 9931} 9932 9933// PageToken sets the optional parameter "pageToken": The token for 9934// continuing a previous list request on the next page. This should be 9935// set to the value of 'nextPageToken' from the previous response. 9936func (c *RevisionsListCall) PageToken(pageToken string) *RevisionsListCall { 9937 c.urlParams_.Set("pageToken", pageToken) 9938 return c 9939} 9940 9941// Fields allows partial responses to be retrieved. See 9942// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 9943// for more information. 9944func (c *RevisionsListCall) Fields(s ...googleapi.Field) *RevisionsListCall { 9945 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 9946 return c 9947} 9948 9949// IfNoneMatch sets the optional parameter which makes the operation 9950// fail if the object's ETag matches the given value. This is useful for 9951// getting updates only after the object has changed since the last 9952// request. Use googleapi.IsNotModified to check whether the response 9953// error from Do is the result of In-None-Match. 9954func (c *RevisionsListCall) IfNoneMatch(entityTag string) *RevisionsListCall { 9955 c.ifNoneMatch_ = entityTag 9956 return c 9957} 9958 9959// Context sets the context to be used in this call's Do method. Any 9960// pending HTTP request will be aborted if the provided context is 9961// canceled. 9962func (c *RevisionsListCall) Context(ctx context.Context) *RevisionsListCall { 9963 c.ctx_ = ctx 9964 return c 9965} 9966 9967// Header returns an http.Header that can be modified by the caller to 9968// add HTTP headers to the request. 9969func (c *RevisionsListCall) Header() http.Header { 9970 if c.header_ == nil { 9971 c.header_ = make(http.Header) 9972 } 9973 return c.header_ 9974} 9975 9976func (c *RevisionsListCall) doRequest(alt string) (*http.Response, error) { 9977 reqHeaders := make(http.Header) 9978 for k, v := range c.header_ { 9979 reqHeaders[k] = v 9980 } 9981 reqHeaders.Set("User-Agent", c.s.userAgent()) 9982 if c.ifNoneMatch_ != "" { 9983 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 9984 } 9985 var body io.Reader = nil 9986 c.urlParams_.Set("alt", alt) 9987 c.urlParams_.Set("prettyPrint", "false") 9988 urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/revisions") 9989 urls += "?" + c.urlParams_.Encode() 9990 req, err := http.NewRequest("GET", urls, body) 9991 if err != nil { 9992 return nil, err 9993 } 9994 req.Header = reqHeaders 9995 googleapi.Expand(req.URL, map[string]string{ 9996 "fileId": c.fileId, 9997 }) 9998 return gensupport.SendRequest(c.ctx_, c.s.client, req) 9999} 10000 10001// Do executes the "drive.revisions.list" call. 10002// Exactly one of *RevisionList or error will be non-nil. Any non-2xx 10003// status code is an error. Response headers are in either 10004// *RevisionList.ServerResponse.Header or (if a response was returned at 10005// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 10006// to check whether the returned error was because 10007// http.StatusNotModified was returned. 10008func (c *RevisionsListCall) Do(opts ...googleapi.CallOption) (*RevisionList, error) { 10009 gensupport.SetOptions(c.urlParams_, opts...) 10010 res, err := c.doRequest("json") 10011 if res != nil && res.StatusCode == http.StatusNotModified { 10012 if res.Body != nil { 10013 res.Body.Close() 10014 } 10015 return nil, &googleapi.Error{ 10016 Code: res.StatusCode, 10017 Header: res.Header, 10018 } 10019 } 10020 if err != nil { 10021 return nil, err 10022 } 10023 defer googleapi.CloseBody(res) 10024 if err := googleapi.CheckResponse(res); err != nil { 10025 return nil, err 10026 } 10027 ret := &RevisionList{ 10028 ServerResponse: googleapi.ServerResponse{ 10029 Header: res.Header, 10030 HTTPStatusCode: res.StatusCode, 10031 }, 10032 } 10033 target := &ret 10034 if err := gensupport.DecodeResponse(target, res); err != nil { 10035 return nil, err 10036 } 10037 return ret, nil 10038 // { 10039 // "description": "Lists a file's revisions.", 10040 // "httpMethod": "GET", 10041 // "id": "drive.revisions.list", 10042 // "parameterOrder": [ 10043 // "fileId" 10044 // ], 10045 // "parameters": { 10046 // "fileId": { 10047 // "description": "The ID of the file.", 10048 // "location": "path", 10049 // "required": true, 10050 // "type": "string" 10051 // }, 10052 // "pageSize": { 10053 // "default": "200", 10054 // "description": "The maximum number of revisions to return per page.", 10055 // "format": "int32", 10056 // "location": "query", 10057 // "maximum": "1000", 10058 // "minimum": "1", 10059 // "type": "integer" 10060 // }, 10061 // "pageToken": { 10062 // "description": "The token for continuing a previous list request on the next page. This should be set to the value of 'nextPageToken' from the previous response.", 10063 // "location": "query", 10064 // "type": "string" 10065 // } 10066 // }, 10067 // "path": "files/{fileId}/revisions", 10068 // "response": { 10069 // "$ref": "RevisionList" 10070 // }, 10071 // "scopes": [ 10072 // "https://www.googleapis.com/auth/drive", 10073 // "https://www.googleapis.com/auth/drive.appdata", 10074 // "https://www.googleapis.com/auth/drive.file", 10075 // "https://www.googleapis.com/auth/drive.metadata", 10076 // "https://www.googleapis.com/auth/drive.metadata.readonly", 10077 // "https://www.googleapis.com/auth/drive.photos.readonly", 10078 // "https://www.googleapis.com/auth/drive.readonly" 10079 // ] 10080 // } 10081 10082} 10083 10084// Pages invokes f for each page of results. 10085// A non-nil error returned from f will halt the iteration. 10086// The provided context supersedes any context provided to the Context method. 10087func (c *RevisionsListCall) Pages(ctx context.Context, f func(*RevisionList) error) error { 10088 c.ctx_ = ctx 10089 defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point 10090 for { 10091 x, err := c.Do() 10092 if err != nil { 10093 return err 10094 } 10095 if err := f(x); err != nil { 10096 return err 10097 } 10098 if x.NextPageToken == "" { 10099 return nil 10100 } 10101 c.PageToken(x.NextPageToken) 10102 } 10103} 10104 10105// method id "drive.revisions.update": 10106 10107type RevisionsUpdateCall struct { 10108 s *Service 10109 fileId string 10110 revisionId string 10111 revision *Revision 10112 urlParams_ gensupport.URLParams 10113 ctx_ context.Context 10114 header_ http.Header 10115} 10116 10117// Update: Updates a revision with patch semantics. 10118func (r *RevisionsService) Update(fileId string, revisionId string, revision *Revision) *RevisionsUpdateCall { 10119 c := &RevisionsUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)} 10120 c.fileId = fileId 10121 c.revisionId = revisionId 10122 c.revision = revision 10123 return c 10124} 10125 10126// Fields allows partial responses to be retrieved. See 10127// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 10128// for more information. 10129func (c *RevisionsUpdateCall) Fields(s ...googleapi.Field) *RevisionsUpdateCall { 10130 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 10131 return c 10132} 10133 10134// Context sets the context to be used in this call's Do method. Any 10135// pending HTTP request will be aborted if the provided context is 10136// canceled. 10137func (c *RevisionsUpdateCall) Context(ctx context.Context) *RevisionsUpdateCall { 10138 c.ctx_ = ctx 10139 return c 10140} 10141 10142// Header returns an http.Header that can be modified by the caller to 10143// add HTTP headers to the request. 10144func (c *RevisionsUpdateCall) Header() http.Header { 10145 if c.header_ == nil { 10146 c.header_ = make(http.Header) 10147 } 10148 return c.header_ 10149} 10150 10151func (c *RevisionsUpdateCall) doRequest(alt string) (*http.Response, error) { 10152 reqHeaders := make(http.Header) 10153 for k, v := range c.header_ { 10154 reqHeaders[k] = v 10155 } 10156 reqHeaders.Set("User-Agent", c.s.userAgent()) 10157 var body io.Reader = nil 10158 body, err := googleapi.WithoutDataWrapper.JSONReader(c.revision) 10159 if err != nil { 10160 return nil, err 10161 } 10162 reqHeaders.Set("Content-Type", "application/json") 10163 c.urlParams_.Set("alt", alt) 10164 c.urlParams_.Set("prettyPrint", "false") 10165 urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/revisions/{revisionId}") 10166 urls += "?" + c.urlParams_.Encode() 10167 req, err := http.NewRequest("PATCH", urls, body) 10168 if err != nil { 10169 return nil, err 10170 } 10171 req.Header = reqHeaders 10172 googleapi.Expand(req.URL, map[string]string{ 10173 "fileId": c.fileId, 10174 "revisionId": c.revisionId, 10175 }) 10176 return gensupport.SendRequest(c.ctx_, c.s.client, req) 10177} 10178 10179// Do executes the "drive.revisions.update" call. 10180// Exactly one of *Revision or error will be non-nil. Any non-2xx status 10181// code is an error. Response headers are in either 10182// *Revision.ServerResponse.Header or (if a response was returned at 10183// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 10184// to check whether the returned error was because 10185// http.StatusNotModified was returned. 10186func (c *RevisionsUpdateCall) Do(opts ...googleapi.CallOption) (*Revision, error) { 10187 gensupport.SetOptions(c.urlParams_, opts...) 10188 res, err := c.doRequest("json") 10189 if res != nil && res.StatusCode == http.StatusNotModified { 10190 if res.Body != nil { 10191 res.Body.Close() 10192 } 10193 return nil, &googleapi.Error{ 10194 Code: res.StatusCode, 10195 Header: res.Header, 10196 } 10197 } 10198 if err != nil { 10199 return nil, err 10200 } 10201 defer googleapi.CloseBody(res) 10202 if err := googleapi.CheckResponse(res); err != nil { 10203 return nil, err 10204 } 10205 ret := &Revision{ 10206 ServerResponse: googleapi.ServerResponse{ 10207 Header: res.Header, 10208 HTTPStatusCode: res.StatusCode, 10209 }, 10210 } 10211 target := &ret 10212 if err := gensupport.DecodeResponse(target, res); err != nil { 10213 return nil, err 10214 } 10215 return ret, nil 10216 // { 10217 // "description": "Updates a revision with patch semantics.", 10218 // "httpMethod": "PATCH", 10219 // "id": "drive.revisions.update", 10220 // "parameterOrder": [ 10221 // "fileId", 10222 // "revisionId" 10223 // ], 10224 // "parameters": { 10225 // "fileId": { 10226 // "description": "The ID of the file.", 10227 // "location": "path", 10228 // "required": true, 10229 // "type": "string" 10230 // }, 10231 // "revisionId": { 10232 // "description": "The ID of the revision.", 10233 // "location": "path", 10234 // "required": true, 10235 // "type": "string" 10236 // } 10237 // }, 10238 // "path": "files/{fileId}/revisions/{revisionId}", 10239 // "request": { 10240 // "$ref": "Revision" 10241 // }, 10242 // "response": { 10243 // "$ref": "Revision" 10244 // }, 10245 // "scopes": [ 10246 // "https://www.googleapis.com/auth/drive", 10247 // "https://www.googleapis.com/auth/drive.appdata", 10248 // "https://www.googleapis.com/auth/drive.file" 10249 // ] 10250 // } 10251 10252} 10253 10254// method id "drive.teamdrives.create": 10255 10256type TeamdrivesCreateCall struct { 10257 s *Service 10258 teamdrive *TeamDrive 10259 urlParams_ gensupport.URLParams 10260 ctx_ context.Context 10261 header_ http.Header 10262} 10263 10264// Create: Deprecated use drives.create instead. 10265func (r *TeamdrivesService) Create(requestId string, teamdrive *TeamDrive) *TeamdrivesCreateCall { 10266 c := &TeamdrivesCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)} 10267 c.urlParams_.Set("requestId", requestId) 10268 c.teamdrive = teamdrive 10269 return c 10270} 10271 10272// Fields allows partial responses to be retrieved. See 10273// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 10274// for more information. 10275func (c *TeamdrivesCreateCall) Fields(s ...googleapi.Field) *TeamdrivesCreateCall { 10276 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 10277 return c 10278} 10279 10280// Context sets the context to be used in this call's Do method. Any 10281// pending HTTP request will be aborted if the provided context is 10282// canceled. 10283func (c *TeamdrivesCreateCall) Context(ctx context.Context) *TeamdrivesCreateCall { 10284 c.ctx_ = ctx 10285 return c 10286} 10287 10288// Header returns an http.Header that can be modified by the caller to 10289// add HTTP headers to the request. 10290func (c *TeamdrivesCreateCall) Header() http.Header { 10291 if c.header_ == nil { 10292 c.header_ = make(http.Header) 10293 } 10294 return c.header_ 10295} 10296 10297func (c *TeamdrivesCreateCall) doRequest(alt string) (*http.Response, error) { 10298 reqHeaders := make(http.Header) 10299 for k, v := range c.header_ { 10300 reqHeaders[k] = v 10301 } 10302 reqHeaders.Set("User-Agent", c.s.userAgent()) 10303 var body io.Reader = nil 10304 body, err := googleapi.WithoutDataWrapper.JSONReader(c.teamdrive) 10305 if err != nil { 10306 return nil, err 10307 } 10308 reqHeaders.Set("Content-Type", "application/json") 10309 c.urlParams_.Set("alt", alt) 10310 c.urlParams_.Set("prettyPrint", "false") 10311 urls := googleapi.ResolveRelative(c.s.BasePath, "teamdrives") 10312 urls += "?" + c.urlParams_.Encode() 10313 req, err := http.NewRequest("POST", urls, body) 10314 if err != nil { 10315 return nil, err 10316 } 10317 req.Header = reqHeaders 10318 return gensupport.SendRequest(c.ctx_, c.s.client, req) 10319} 10320 10321// Do executes the "drive.teamdrives.create" call. 10322// Exactly one of *TeamDrive or error will be non-nil. Any non-2xx 10323// status code is an error. Response headers are in either 10324// *TeamDrive.ServerResponse.Header or (if a response was returned at 10325// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 10326// to check whether the returned error was because 10327// http.StatusNotModified was returned. 10328func (c *TeamdrivesCreateCall) Do(opts ...googleapi.CallOption) (*TeamDrive, error) { 10329 gensupport.SetOptions(c.urlParams_, opts...) 10330 res, err := c.doRequest("json") 10331 if res != nil && res.StatusCode == http.StatusNotModified { 10332 if res.Body != nil { 10333 res.Body.Close() 10334 } 10335 return nil, &googleapi.Error{ 10336 Code: res.StatusCode, 10337 Header: res.Header, 10338 } 10339 } 10340 if err != nil { 10341 return nil, err 10342 } 10343 defer googleapi.CloseBody(res) 10344 if err := googleapi.CheckResponse(res); err != nil { 10345 return nil, err 10346 } 10347 ret := &TeamDrive{ 10348 ServerResponse: googleapi.ServerResponse{ 10349 Header: res.Header, 10350 HTTPStatusCode: res.StatusCode, 10351 }, 10352 } 10353 target := &ret 10354 if err := gensupport.DecodeResponse(target, res); err != nil { 10355 return nil, err 10356 } 10357 return ret, nil 10358 // { 10359 // "description": "Deprecated use drives.create instead.", 10360 // "httpMethod": "POST", 10361 // "id": "drive.teamdrives.create", 10362 // "parameterOrder": [ 10363 // "requestId" 10364 // ], 10365 // "parameters": { 10366 // "requestId": { 10367 // "description": "An ID, such as a random UUID, which uniquely identifies this user's request for idempotent creation of a Team Drive. A repeated request by the same user and with the same request ID will avoid creating duplicates by attempting to create the same Team Drive. If the Team Drive already exists a 409 error will be returned.", 10368 // "location": "query", 10369 // "required": true, 10370 // "type": "string" 10371 // } 10372 // }, 10373 // "path": "teamdrives", 10374 // "request": { 10375 // "$ref": "TeamDrive" 10376 // }, 10377 // "response": { 10378 // "$ref": "TeamDrive" 10379 // }, 10380 // "scopes": [ 10381 // "https://www.googleapis.com/auth/drive" 10382 // ] 10383 // } 10384 10385} 10386 10387// method id "drive.teamdrives.delete": 10388 10389type TeamdrivesDeleteCall struct { 10390 s *Service 10391 teamDriveId string 10392 urlParams_ gensupport.URLParams 10393 ctx_ context.Context 10394 header_ http.Header 10395} 10396 10397// Delete: Deprecated use drives.delete instead. 10398func (r *TeamdrivesService) Delete(teamDriveId string) *TeamdrivesDeleteCall { 10399 c := &TeamdrivesDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)} 10400 c.teamDriveId = teamDriveId 10401 return c 10402} 10403 10404// Fields allows partial responses to be retrieved. See 10405// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 10406// for more information. 10407func (c *TeamdrivesDeleteCall) Fields(s ...googleapi.Field) *TeamdrivesDeleteCall { 10408 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 10409 return c 10410} 10411 10412// Context sets the context to be used in this call's Do method. Any 10413// pending HTTP request will be aborted if the provided context is 10414// canceled. 10415func (c *TeamdrivesDeleteCall) Context(ctx context.Context) *TeamdrivesDeleteCall { 10416 c.ctx_ = ctx 10417 return c 10418} 10419 10420// Header returns an http.Header that can be modified by the caller to 10421// add HTTP headers to the request. 10422func (c *TeamdrivesDeleteCall) Header() http.Header { 10423 if c.header_ == nil { 10424 c.header_ = make(http.Header) 10425 } 10426 return c.header_ 10427} 10428 10429func (c *TeamdrivesDeleteCall) doRequest(alt string) (*http.Response, error) { 10430 reqHeaders := make(http.Header) 10431 for k, v := range c.header_ { 10432 reqHeaders[k] = v 10433 } 10434 reqHeaders.Set("User-Agent", c.s.userAgent()) 10435 var body io.Reader = nil 10436 c.urlParams_.Set("alt", alt) 10437 c.urlParams_.Set("prettyPrint", "false") 10438 urls := googleapi.ResolveRelative(c.s.BasePath, "teamdrives/{teamDriveId}") 10439 urls += "?" + c.urlParams_.Encode() 10440 req, err := http.NewRequest("DELETE", urls, body) 10441 if err != nil { 10442 return nil, err 10443 } 10444 req.Header = reqHeaders 10445 googleapi.Expand(req.URL, map[string]string{ 10446 "teamDriveId": c.teamDriveId, 10447 }) 10448 return gensupport.SendRequest(c.ctx_, c.s.client, req) 10449} 10450 10451// Do executes the "drive.teamdrives.delete" call. 10452func (c *TeamdrivesDeleteCall) Do(opts ...googleapi.CallOption) error { 10453 gensupport.SetOptions(c.urlParams_, opts...) 10454 res, err := c.doRequest("json") 10455 if err != nil { 10456 return err 10457 } 10458 defer googleapi.CloseBody(res) 10459 if err := googleapi.CheckResponse(res); err != nil { 10460 return err 10461 } 10462 return nil 10463 // { 10464 // "description": "Deprecated use drives.delete instead.", 10465 // "httpMethod": "DELETE", 10466 // "id": "drive.teamdrives.delete", 10467 // "parameterOrder": [ 10468 // "teamDriveId" 10469 // ], 10470 // "parameters": { 10471 // "teamDriveId": { 10472 // "description": "The ID of the Team Drive", 10473 // "location": "path", 10474 // "required": true, 10475 // "type": "string" 10476 // } 10477 // }, 10478 // "path": "teamdrives/{teamDriveId}", 10479 // "scopes": [ 10480 // "https://www.googleapis.com/auth/drive" 10481 // ] 10482 // } 10483 10484} 10485 10486// method id "drive.teamdrives.get": 10487 10488type TeamdrivesGetCall struct { 10489 s *Service 10490 teamDriveId string 10491 urlParams_ gensupport.URLParams 10492 ifNoneMatch_ string 10493 ctx_ context.Context 10494 header_ http.Header 10495} 10496 10497// Get: Deprecated use drives.get instead. 10498func (r *TeamdrivesService) Get(teamDriveId string) *TeamdrivesGetCall { 10499 c := &TeamdrivesGetCall{s: r.s, urlParams_: make(gensupport.URLParams)} 10500 c.teamDriveId = teamDriveId 10501 return c 10502} 10503 10504// UseDomainAdminAccess sets the optional parameter 10505// "useDomainAdminAccess": Issue the request as a domain administrator; 10506// if set to true, then the requester will be granted access if they are 10507// an administrator of the domain to which the Team Drive belongs. 10508func (c *TeamdrivesGetCall) UseDomainAdminAccess(useDomainAdminAccess bool) *TeamdrivesGetCall { 10509 c.urlParams_.Set("useDomainAdminAccess", fmt.Sprint(useDomainAdminAccess)) 10510 return c 10511} 10512 10513// Fields allows partial responses to be retrieved. See 10514// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 10515// for more information. 10516func (c *TeamdrivesGetCall) Fields(s ...googleapi.Field) *TeamdrivesGetCall { 10517 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 10518 return c 10519} 10520 10521// IfNoneMatch sets the optional parameter which makes the operation 10522// fail if the object's ETag matches the given value. This is useful for 10523// getting updates only after the object has changed since the last 10524// request. Use googleapi.IsNotModified to check whether the response 10525// error from Do is the result of In-None-Match. 10526func (c *TeamdrivesGetCall) IfNoneMatch(entityTag string) *TeamdrivesGetCall { 10527 c.ifNoneMatch_ = entityTag 10528 return c 10529} 10530 10531// Context sets the context to be used in this call's Do method. Any 10532// pending HTTP request will be aborted if the provided context is 10533// canceled. 10534func (c *TeamdrivesGetCall) Context(ctx context.Context) *TeamdrivesGetCall { 10535 c.ctx_ = ctx 10536 return c 10537} 10538 10539// Header returns an http.Header that can be modified by the caller to 10540// add HTTP headers to the request. 10541func (c *TeamdrivesGetCall) Header() http.Header { 10542 if c.header_ == nil { 10543 c.header_ = make(http.Header) 10544 } 10545 return c.header_ 10546} 10547 10548func (c *TeamdrivesGetCall) doRequest(alt string) (*http.Response, error) { 10549 reqHeaders := make(http.Header) 10550 for k, v := range c.header_ { 10551 reqHeaders[k] = v 10552 } 10553 reqHeaders.Set("User-Agent", c.s.userAgent()) 10554 if c.ifNoneMatch_ != "" { 10555 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 10556 } 10557 var body io.Reader = nil 10558 c.urlParams_.Set("alt", alt) 10559 c.urlParams_.Set("prettyPrint", "false") 10560 urls := googleapi.ResolveRelative(c.s.BasePath, "teamdrives/{teamDriveId}") 10561 urls += "?" + c.urlParams_.Encode() 10562 req, err := http.NewRequest("GET", urls, body) 10563 if err != nil { 10564 return nil, err 10565 } 10566 req.Header = reqHeaders 10567 googleapi.Expand(req.URL, map[string]string{ 10568 "teamDriveId": c.teamDriveId, 10569 }) 10570 return gensupport.SendRequest(c.ctx_, c.s.client, req) 10571} 10572 10573// Do executes the "drive.teamdrives.get" call. 10574// Exactly one of *TeamDrive or error will be non-nil. Any non-2xx 10575// status code is an error. Response headers are in either 10576// *TeamDrive.ServerResponse.Header or (if a response was returned at 10577// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 10578// to check whether the returned error was because 10579// http.StatusNotModified was returned. 10580func (c *TeamdrivesGetCall) Do(opts ...googleapi.CallOption) (*TeamDrive, error) { 10581 gensupport.SetOptions(c.urlParams_, opts...) 10582 res, err := c.doRequest("json") 10583 if res != nil && res.StatusCode == http.StatusNotModified { 10584 if res.Body != nil { 10585 res.Body.Close() 10586 } 10587 return nil, &googleapi.Error{ 10588 Code: res.StatusCode, 10589 Header: res.Header, 10590 } 10591 } 10592 if err != nil { 10593 return nil, err 10594 } 10595 defer googleapi.CloseBody(res) 10596 if err := googleapi.CheckResponse(res); err != nil { 10597 return nil, err 10598 } 10599 ret := &TeamDrive{ 10600 ServerResponse: googleapi.ServerResponse{ 10601 Header: res.Header, 10602 HTTPStatusCode: res.StatusCode, 10603 }, 10604 } 10605 target := &ret 10606 if err := gensupport.DecodeResponse(target, res); err != nil { 10607 return nil, err 10608 } 10609 return ret, nil 10610 // { 10611 // "description": "Deprecated use drives.get instead.", 10612 // "httpMethod": "GET", 10613 // "id": "drive.teamdrives.get", 10614 // "parameterOrder": [ 10615 // "teamDriveId" 10616 // ], 10617 // "parameters": { 10618 // "teamDriveId": { 10619 // "description": "The ID of the Team Drive", 10620 // "location": "path", 10621 // "required": true, 10622 // "type": "string" 10623 // }, 10624 // "useDomainAdminAccess": { 10625 // "default": "false", 10626 // "description": "Issue the request as a domain administrator; if set to true, then the requester will be granted access if they are an administrator of the domain to which the Team Drive belongs.", 10627 // "location": "query", 10628 // "type": "boolean" 10629 // } 10630 // }, 10631 // "path": "teamdrives/{teamDriveId}", 10632 // "response": { 10633 // "$ref": "TeamDrive" 10634 // }, 10635 // "scopes": [ 10636 // "https://www.googleapis.com/auth/drive", 10637 // "https://www.googleapis.com/auth/drive.readonly" 10638 // ] 10639 // } 10640 10641} 10642 10643// method id "drive.teamdrives.list": 10644 10645type TeamdrivesListCall struct { 10646 s *Service 10647 urlParams_ gensupport.URLParams 10648 ifNoneMatch_ string 10649 ctx_ context.Context 10650 header_ http.Header 10651} 10652 10653// List: Deprecated use drives.list instead. 10654func (r *TeamdrivesService) List() *TeamdrivesListCall { 10655 c := &TeamdrivesListCall{s: r.s, urlParams_: make(gensupport.URLParams)} 10656 return c 10657} 10658 10659// PageSize sets the optional parameter "pageSize": Maximum number of 10660// Team Drives to return. 10661func (c *TeamdrivesListCall) PageSize(pageSize int64) *TeamdrivesListCall { 10662 c.urlParams_.Set("pageSize", fmt.Sprint(pageSize)) 10663 return c 10664} 10665 10666// PageToken sets the optional parameter "pageToken": Page token for 10667// Team Drives. 10668func (c *TeamdrivesListCall) PageToken(pageToken string) *TeamdrivesListCall { 10669 c.urlParams_.Set("pageToken", pageToken) 10670 return c 10671} 10672 10673// Q sets the optional parameter "q": Query string for searching Team 10674// Drives. 10675func (c *TeamdrivesListCall) Q(q string) *TeamdrivesListCall { 10676 c.urlParams_.Set("q", q) 10677 return c 10678} 10679 10680// UseDomainAdminAccess sets the optional parameter 10681// "useDomainAdminAccess": Issue the request as a domain administrator; 10682// if set to true, then all Team Drives of the domain in which the 10683// requester is an administrator are returned. 10684func (c *TeamdrivesListCall) UseDomainAdminAccess(useDomainAdminAccess bool) *TeamdrivesListCall { 10685 c.urlParams_.Set("useDomainAdminAccess", fmt.Sprint(useDomainAdminAccess)) 10686 return c 10687} 10688 10689// Fields allows partial responses to be retrieved. See 10690// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 10691// for more information. 10692func (c *TeamdrivesListCall) Fields(s ...googleapi.Field) *TeamdrivesListCall { 10693 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 10694 return c 10695} 10696 10697// IfNoneMatch sets the optional parameter which makes the operation 10698// fail if the object's ETag matches the given value. This is useful for 10699// getting updates only after the object has changed since the last 10700// request. Use googleapi.IsNotModified to check whether the response 10701// error from Do is the result of In-None-Match. 10702func (c *TeamdrivesListCall) IfNoneMatch(entityTag string) *TeamdrivesListCall { 10703 c.ifNoneMatch_ = entityTag 10704 return c 10705} 10706 10707// Context sets the context to be used in this call's Do method. Any 10708// pending HTTP request will be aborted if the provided context is 10709// canceled. 10710func (c *TeamdrivesListCall) Context(ctx context.Context) *TeamdrivesListCall { 10711 c.ctx_ = ctx 10712 return c 10713} 10714 10715// Header returns an http.Header that can be modified by the caller to 10716// add HTTP headers to the request. 10717func (c *TeamdrivesListCall) Header() http.Header { 10718 if c.header_ == nil { 10719 c.header_ = make(http.Header) 10720 } 10721 return c.header_ 10722} 10723 10724func (c *TeamdrivesListCall) doRequest(alt string) (*http.Response, error) { 10725 reqHeaders := make(http.Header) 10726 for k, v := range c.header_ { 10727 reqHeaders[k] = v 10728 } 10729 reqHeaders.Set("User-Agent", c.s.userAgent()) 10730 if c.ifNoneMatch_ != "" { 10731 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 10732 } 10733 var body io.Reader = nil 10734 c.urlParams_.Set("alt", alt) 10735 c.urlParams_.Set("prettyPrint", "false") 10736 urls := googleapi.ResolveRelative(c.s.BasePath, "teamdrives") 10737 urls += "?" + c.urlParams_.Encode() 10738 req, err := http.NewRequest("GET", urls, body) 10739 if err != nil { 10740 return nil, err 10741 } 10742 req.Header = reqHeaders 10743 return gensupport.SendRequest(c.ctx_, c.s.client, req) 10744} 10745 10746// Do executes the "drive.teamdrives.list" call. 10747// Exactly one of *TeamDriveList or error will be non-nil. Any non-2xx 10748// status code is an error. Response headers are in either 10749// *TeamDriveList.ServerResponse.Header or (if a response was returned 10750// at all) in error.(*googleapi.Error).Header. Use 10751// googleapi.IsNotModified to check whether the returned error was 10752// because http.StatusNotModified was returned. 10753func (c *TeamdrivesListCall) Do(opts ...googleapi.CallOption) (*TeamDriveList, error) { 10754 gensupport.SetOptions(c.urlParams_, opts...) 10755 res, err := c.doRequest("json") 10756 if res != nil && res.StatusCode == http.StatusNotModified { 10757 if res.Body != nil { 10758 res.Body.Close() 10759 } 10760 return nil, &googleapi.Error{ 10761 Code: res.StatusCode, 10762 Header: res.Header, 10763 } 10764 } 10765 if err != nil { 10766 return nil, err 10767 } 10768 defer googleapi.CloseBody(res) 10769 if err := googleapi.CheckResponse(res); err != nil { 10770 return nil, err 10771 } 10772 ret := &TeamDriveList{ 10773 ServerResponse: googleapi.ServerResponse{ 10774 Header: res.Header, 10775 HTTPStatusCode: res.StatusCode, 10776 }, 10777 } 10778 target := &ret 10779 if err := gensupport.DecodeResponse(target, res); err != nil { 10780 return nil, err 10781 } 10782 return ret, nil 10783 // { 10784 // "description": "Deprecated use drives.list instead.", 10785 // "httpMethod": "GET", 10786 // "id": "drive.teamdrives.list", 10787 // "parameters": { 10788 // "pageSize": { 10789 // "default": "10", 10790 // "description": "Maximum number of Team Drives to return.", 10791 // "format": "int32", 10792 // "location": "query", 10793 // "maximum": "100", 10794 // "minimum": "1", 10795 // "type": "integer" 10796 // }, 10797 // "pageToken": { 10798 // "description": "Page token for Team Drives.", 10799 // "location": "query", 10800 // "type": "string" 10801 // }, 10802 // "q": { 10803 // "description": "Query string for searching Team Drives.", 10804 // "location": "query", 10805 // "type": "string" 10806 // }, 10807 // "useDomainAdminAccess": { 10808 // "default": "false", 10809 // "description": "Issue the request as a domain administrator; if set to true, then all Team Drives of the domain in which the requester is an administrator are returned.", 10810 // "location": "query", 10811 // "type": "boolean" 10812 // } 10813 // }, 10814 // "path": "teamdrives", 10815 // "response": { 10816 // "$ref": "TeamDriveList" 10817 // }, 10818 // "scopes": [ 10819 // "https://www.googleapis.com/auth/drive", 10820 // "https://www.googleapis.com/auth/drive.readonly" 10821 // ] 10822 // } 10823 10824} 10825 10826// Pages invokes f for each page of results. 10827// A non-nil error returned from f will halt the iteration. 10828// The provided context supersedes any context provided to the Context method. 10829func (c *TeamdrivesListCall) Pages(ctx context.Context, f func(*TeamDriveList) error) error { 10830 c.ctx_ = ctx 10831 defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point 10832 for { 10833 x, err := c.Do() 10834 if err != nil { 10835 return err 10836 } 10837 if err := f(x); err != nil { 10838 return err 10839 } 10840 if x.NextPageToken == "" { 10841 return nil 10842 } 10843 c.PageToken(x.NextPageToken) 10844 } 10845} 10846 10847// method id "drive.teamdrives.update": 10848 10849type TeamdrivesUpdateCall struct { 10850 s *Service 10851 teamDriveId string 10852 teamdrive *TeamDrive 10853 urlParams_ gensupport.URLParams 10854 ctx_ context.Context 10855 header_ http.Header 10856} 10857 10858// Update: Deprecated use drives.update instead 10859func (r *TeamdrivesService) Update(teamDriveId string, teamdrive *TeamDrive) *TeamdrivesUpdateCall { 10860 c := &TeamdrivesUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)} 10861 c.teamDriveId = teamDriveId 10862 c.teamdrive = teamdrive 10863 return c 10864} 10865 10866// UseDomainAdminAccess sets the optional parameter 10867// "useDomainAdminAccess": Issue the request as a domain administrator; 10868// if set to true, then the requester will be granted access if they are 10869// an administrator of the domain to which the Team Drive belongs. 10870func (c *TeamdrivesUpdateCall) UseDomainAdminAccess(useDomainAdminAccess bool) *TeamdrivesUpdateCall { 10871 c.urlParams_.Set("useDomainAdminAccess", fmt.Sprint(useDomainAdminAccess)) 10872 return c 10873} 10874 10875// Fields allows partial responses to be retrieved. See 10876// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 10877// for more information. 10878func (c *TeamdrivesUpdateCall) Fields(s ...googleapi.Field) *TeamdrivesUpdateCall { 10879 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 10880 return c 10881} 10882 10883// Context sets the context to be used in this call's Do method. Any 10884// pending HTTP request will be aborted if the provided context is 10885// canceled. 10886func (c *TeamdrivesUpdateCall) Context(ctx context.Context) *TeamdrivesUpdateCall { 10887 c.ctx_ = ctx 10888 return c 10889} 10890 10891// Header returns an http.Header that can be modified by the caller to 10892// add HTTP headers to the request. 10893func (c *TeamdrivesUpdateCall) Header() http.Header { 10894 if c.header_ == nil { 10895 c.header_ = make(http.Header) 10896 } 10897 return c.header_ 10898} 10899 10900func (c *TeamdrivesUpdateCall) doRequest(alt string) (*http.Response, error) { 10901 reqHeaders := make(http.Header) 10902 for k, v := range c.header_ { 10903 reqHeaders[k] = v 10904 } 10905 reqHeaders.Set("User-Agent", c.s.userAgent()) 10906 var body io.Reader = nil 10907 body, err := googleapi.WithoutDataWrapper.JSONReader(c.teamdrive) 10908 if err != nil { 10909 return nil, err 10910 } 10911 reqHeaders.Set("Content-Type", "application/json") 10912 c.urlParams_.Set("alt", alt) 10913 c.urlParams_.Set("prettyPrint", "false") 10914 urls := googleapi.ResolveRelative(c.s.BasePath, "teamdrives/{teamDriveId}") 10915 urls += "?" + c.urlParams_.Encode() 10916 req, err := http.NewRequest("PATCH", urls, body) 10917 if err != nil { 10918 return nil, err 10919 } 10920 req.Header = reqHeaders 10921 googleapi.Expand(req.URL, map[string]string{ 10922 "teamDriveId": c.teamDriveId, 10923 }) 10924 return gensupport.SendRequest(c.ctx_, c.s.client, req) 10925} 10926 10927// Do executes the "drive.teamdrives.update" call. 10928// Exactly one of *TeamDrive or error will be non-nil. Any non-2xx 10929// status code is an error. Response headers are in either 10930// *TeamDrive.ServerResponse.Header or (if a response was returned at 10931// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 10932// to check whether the returned error was because 10933// http.StatusNotModified was returned. 10934func (c *TeamdrivesUpdateCall) Do(opts ...googleapi.CallOption) (*TeamDrive, error) { 10935 gensupport.SetOptions(c.urlParams_, opts...) 10936 res, err := c.doRequest("json") 10937 if res != nil && res.StatusCode == http.StatusNotModified { 10938 if res.Body != nil { 10939 res.Body.Close() 10940 } 10941 return nil, &googleapi.Error{ 10942 Code: res.StatusCode, 10943 Header: res.Header, 10944 } 10945 } 10946 if err != nil { 10947 return nil, err 10948 } 10949 defer googleapi.CloseBody(res) 10950 if err := googleapi.CheckResponse(res); err != nil { 10951 return nil, err 10952 } 10953 ret := &TeamDrive{ 10954 ServerResponse: googleapi.ServerResponse{ 10955 Header: res.Header, 10956 HTTPStatusCode: res.StatusCode, 10957 }, 10958 } 10959 target := &ret 10960 if err := gensupport.DecodeResponse(target, res); err != nil { 10961 return nil, err 10962 } 10963 return ret, nil 10964 // { 10965 // "description": "Deprecated use drives.update instead", 10966 // "httpMethod": "PATCH", 10967 // "id": "drive.teamdrives.update", 10968 // "parameterOrder": [ 10969 // "teamDriveId" 10970 // ], 10971 // "parameters": { 10972 // "teamDriveId": { 10973 // "description": "The ID of the Team Drive", 10974 // "location": "path", 10975 // "required": true, 10976 // "type": "string" 10977 // }, 10978 // "useDomainAdminAccess": { 10979 // "default": "false", 10980 // "description": "Issue the request as a domain administrator; if set to true, then the requester will be granted access if they are an administrator of the domain to which the Team Drive belongs.", 10981 // "location": "query", 10982 // "type": "boolean" 10983 // } 10984 // }, 10985 // "path": "teamdrives/{teamDriveId}", 10986 // "request": { 10987 // "$ref": "TeamDrive" 10988 // }, 10989 // "response": { 10990 // "$ref": "TeamDrive" 10991 // }, 10992 // "scopes": [ 10993 // "https://www.googleapis.com/auth/drive" 10994 // ] 10995 // } 10996 10997} 10998