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/v2" 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/v2" 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:v2" 77const apiName = "drive" 78const apiVersion = "v2" 79const basePath = "https://www.googleapis.com/drive/v2/" 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 your Google Drive apps 90 DriveAppsReadonlyScope = "https://www.googleapis.com/auth/drive.apps.readonly" 91 92 // View and manage Google Drive files and folders that you have opened 93 // or created with this app 94 DriveFileScope = "https://www.googleapis.com/auth/drive.file" 95 96 // View and manage metadata of files in your Google Drive 97 DriveMetadataScope = "https://www.googleapis.com/auth/drive.metadata" 98 99 // View metadata for files in your Google Drive 100 DriveMetadataReadonlyScope = "https://www.googleapis.com/auth/drive.metadata.readonly" 101 102 // View the photos, videos and albums in your Google Photos 103 DrivePhotosReadonlyScope = "https://www.googleapis.com/auth/drive.photos.readonly" 104 105 // See and download all your Google Drive files 106 DriveReadonlyScope = "https://www.googleapis.com/auth/drive.readonly" 107 108 // Modify your Google Apps Script scripts' behavior 109 DriveScriptsScope = "https://www.googleapis.com/auth/drive.scripts" 110) 111 112// NewService creates a new Service. 113func NewService(ctx context.Context, opts ...option.ClientOption) (*Service, error) { 114 scopesOption := option.WithScopes( 115 "https://www.googleapis.com/auth/drive", 116 "https://www.googleapis.com/auth/drive.appdata", 117 "https://www.googleapis.com/auth/drive.apps.readonly", 118 "https://www.googleapis.com/auth/drive.file", 119 "https://www.googleapis.com/auth/drive.metadata", 120 "https://www.googleapis.com/auth/drive.metadata.readonly", 121 "https://www.googleapis.com/auth/drive.photos.readonly", 122 "https://www.googleapis.com/auth/drive.readonly", 123 "https://www.googleapis.com/auth/drive.scripts", 124 ) 125 // NOTE: prepend, so we don't override user-specified scopes. 126 opts = append([]option.ClientOption{scopesOption}, opts...) 127 client, endpoint, err := htransport.NewClient(ctx, opts...) 128 if err != nil { 129 return nil, err 130 } 131 s, err := New(client) 132 if err != nil { 133 return nil, err 134 } 135 if endpoint != "" { 136 s.BasePath = endpoint 137 } 138 return s, nil 139} 140 141// New creates a new Service. It uses the provided http.Client for requests. 142// 143// Deprecated: please use NewService instead. 144// To provide a custom HTTP client, use option.WithHTTPClient. 145// If you are using google.golang.org/api/googleapis/transport.APIKey, use option.WithAPIKey with NewService instead. 146func New(client *http.Client) (*Service, error) { 147 if client == nil { 148 return nil, errors.New("client is nil") 149 } 150 s := &Service{client: client, BasePath: basePath} 151 s.About = NewAboutService(s) 152 s.Apps = NewAppsService(s) 153 s.Changes = NewChangesService(s) 154 s.Channels = NewChannelsService(s) 155 s.Children = NewChildrenService(s) 156 s.Comments = NewCommentsService(s) 157 s.Drives = NewDrivesService(s) 158 s.Files = NewFilesService(s) 159 s.Parents = NewParentsService(s) 160 s.Permissions = NewPermissionsService(s) 161 s.Properties = NewPropertiesService(s) 162 s.Realtime = NewRealtimeService(s) 163 s.Replies = NewRepliesService(s) 164 s.Revisions = NewRevisionsService(s) 165 s.Teamdrives = NewTeamdrivesService(s) 166 return s, nil 167} 168 169type Service struct { 170 client *http.Client 171 BasePath string // API endpoint base URL 172 UserAgent string // optional additional User-Agent fragment 173 174 About *AboutService 175 176 Apps *AppsService 177 178 Changes *ChangesService 179 180 Channels *ChannelsService 181 182 Children *ChildrenService 183 184 Comments *CommentsService 185 186 Drives *DrivesService 187 188 Files *FilesService 189 190 Parents *ParentsService 191 192 Permissions *PermissionsService 193 194 Properties *PropertiesService 195 196 Realtime *RealtimeService 197 198 Replies *RepliesService 199 200 Revisions *RevisionsService 201 202 Teamdrives *TeamdrivesService 203} 204 205func (s *Service) userAgent() string { 206 if s.UserAgent == "" { 207 return googleapi.UserAgent 208 } 209 return googleapi.UserAgent + " " + s.UserAgent 210} 211 212func NewAboutService(s *Service) *AboutService { 213 rs := &AboutService{s: s} 214 return rs 215} 216 217type AboutService struct { 218 s *Service 219} 220 221func NewAppsService(s *Service) *AppsService { 222 rs := &AppsService{s: s} 223 return rs 224} 225 226type AppsService struct { 227 s *Service 228} 229 230func NewChangesService(s *Service) *ChangesService { 231 rs := &ChangesService{s: s} 232 return rs 233} 234 235type ChangesService struct { 236 s *Service 237} 238 239func NewChannelsService(s *Service) *ChannelsService { 240 rs := &ChannelsService{s: s} 241 return rs 242} 243 244type ChannelsService struct { 245 s *Service 246} 247 248func NewChildrenService(s *Service) *ChildrenService { 249 rs := &ChildrenService{s: s} 250 return rs 251} 252 253type ChildrenService struct { 254 s *Service 255} 256 257func NewCommentsService(s *Service) *CommentsService { 258 rs := &CommentsService{s: s} 259 return rs 260} 261 262type CommentsService struct { 263 s *Service 264} 265 266func NewDrivesService(s *Service) *DrivesService { 267 rs := &DrivesService{s: s} 268 return rs 269} 270 271type DrivesService struct { 272 s *Service 273} 274 275func NewFilesService(s *Service) *FilesService { 276 rs := &FilesService{s: s} 277 return rs 278} 279 280type FilesService struct { 281 s *Service 282} 283 284func NewParentsService(s *Service) *ParentsService { 285 rs := &ParentsService{s: s} 286 return rs 287} 288 289type ParentsService struct { 290 s *Service 291} 292 293func NewPermissionsService(s *Service) *PermissionsService { 294 rs := &PermissionsService{s: s} 295 return rs 296} 297 298type PermissionsService struct { 299 s *Service 300} 301 302func NewPropertiesService(s *Service) *PropertiesService { 303 rs := &PropertiesService{s: s} 304 return rs 305} 306 307type PropertiesService struct { 308 s *Service 309} 310 311func NewRealtimeService(s *Service) *RealtimeService { 312 rs := &RealtimeService{s: s} 313 return rs 314} 315 316type RealtimeService struct { 317 s *Service 318} 319 320func NewRepliesService(s *Service) *RepliesService { 321 rs := &RepliesService{s: s} 322 return rs 323} 324 325type RepliesService struct { 326 s *Service 327} 328 329func NewRevisionsService(s *Service) *RevisionsService { 330 rs := &RevisionsService{s: s} 331 return rs 332} 333 334type RevisionsService struct { 335 s *Service 336} 337 338func NewTeamdrivesService(s *Service) *TeamdrivesService { 339 rs := &TeamdrivesService{s: s} 340 return rs 341} 342 343type TeamdrivesService struct { 344 s *Service 345} 346 347// About: An item with user information and settings. 348type About struct { 349 // AdditionalRoleInfo: Information about supported additional roles per 350 // file type. The most specific type takes precedence. 351 AdditionalRoleInfo []*AboutAdditionalRoleInfo `json:"additionalRoleInfo,omitempty"` 352 353 // CanCreateDrives: Whether the user can create shared drives. 354 CanCreateDrives bool `json:"canCreateDrives,omitempty"` 355 356 // CanCreateTeamDrives: Deprecated - use canCreateDrives instead. 357 CanCreateTeamDrives bool `json:"canCreateTeamDrives,omitempty"` 358 359 // DomainSharingPolicy: The domain sharing policy for the current user. 360 // Possible values are: 361 // - allowed 362 // - allowedWithWarning 363 // - incomingOnly 364 // - disallowed 365 DomainSharingPolicy string `json:"domainSharingPolicy,omitempty"` 366 367 // DriveThemes: A list of themes that are supported for shared drives. 368 DriveThemes []*AboutDriveThemes `json:"driveThemes,omitempty"` 369 370 // Etag: The ETag of the item. 371 Etag string `json:"etag,omitempty"` 372 373 // ExportFormats: The allowable export formats. 374 ExportFormats []*AboutExportFormats `json:"exportFormats,omitempty"` 375 376 // Features: List of additional features enabled on this account. 377 Features []*AboutFeatures `json:"features,omitempty"` 378 379 // FolderColorPalette: The palette of allowable folder colors as RGB hex 380 // strings. 381 FolderColorPalette []string `json:"folderColorPalette,omitempty"` 382 383 // ImportFormats: The allowable import formats. 384 ImportFormats []*AboutImportFormats `json:"importFormats,omitempty"` 385 386 // IsCurrentAppInstalled: A boolean indicating whether the authenticated 387 // app is installed by the authenticated user. 388 IsCurrentAppInstalled bool `json:"isCurrentAppInstalled,omitempty"` 389 390 // Kind: This is always drive#about. 391 Kind string `json:"kind,omitempty"` 392 393 // LanguageCode: The user's language or locale code, as defined by BCP 394 // 47, with some extensions from Unicode's LDML format 395 // (http://www.unicode.org/reports/tr35/). 396 LanguageCode string `json:"languageCode,omitempty"` 397 398 // LargestChangeId: The largest change id. 399 LargestChangeId int64 `json:"largestChangeId,omitempty,string"` 400 401 // MaxUploadSizes: List of max upload sizes for each file type. The most 402 // specific type takes precedence. 403 MaxUploadSizes []*AboutMaxUploadSizes `json:"maxUploadSizes,omitempty"` 404 405 // Name: The name of the current user. 406 Name string `json:"name,omitempty"` 407 408 // PermissionId: The current user's ID as visible in the permissions 409 // collection. 410 PermissionId string `json:"permissionId,omitempty"` 411 412 // QuotaBytesByService: The amount of storage quota used by different 413 // Google services. 414 QuotaBytesByService []*AboutQuotaBytesByService `json:"quotaBytesByService,omitempty"` 415 416 // QuotaBytesTotal: The total number of quota bytes. 417 QuotaBytesTotal int64 `json:"quotaBytesTotal,omitempty,string"` 418 419 // QuotaBytesUsed: The number of quota bytes used by Google Drive. 420 QuotaBytesUsed int64 `json:"quotaBytesUsed,omitempty,string"` 421 422 // QuotaBytesUsedAggregate: The number of quota bytes used by all Google 423 // apps (Drive, Picasa, etc.). 424 QuotaBytesUsedAggregate int64 `json:"quotaBytesUsedAggregate,omitempty,string"` 425 426 // QuotaBytesUsedInTrash: The number of quota bytes used by trashed 427 // items. 428 QuotaBytesUsedInTrash int64 `json:"quotaBytesUsedInTrash,omitempty,string"` 429 430 // QuotaType: The type of the user's storage quota. Possible values are: 431 // 432 // - LIMITED 433 // - UNLIMITED 434 QuotaType string `json:"quotaType,omitempty"` 435 436 // RemainingChangeIds: The number of remaining change ids, limited to no 437 // more than 2500. 438 RemainingChangeIds int64 `json:"remainingChangeIds,omitempty,string"` 439 440 // RootFolderId: The id of the root folder. 441 RootFolderId string `json:"rootFolderId,omitempty"` 442 443 // SelfLink: A link back to this item. 444 SelfLink string `json:"selfLink,omitempty"` 445 446 // TeamDriveThemes: Deprecated - use driveThemes instead. 447 TeamDriveThemes []*AboutTeamDriveThemes `json:"teamDriveThemes,omitempty"` 448 449 // User: The authenticated user. 450 User *User `json:"user,omitempty"` 451 452 // ServerResponse contains the HTTP response code and headers from the 453 // server. 454 googleapi.ServerResponse `json:"-"` 455 456 // ForceSendFields is a list of field names (e.g. "AdditionalRoleInfo") 457 // to unconditionally include in API requests. By default, fields with 458 // empty values are omitted from API requests. However, any non-pointer, 459 // non-interface field appearing in ForceSendFields will be sent to the 460 // server regardless of whether the field is empty or not. This may be 461 // used to include empty fields in Patch requests. 462 ForceSendFields []string `json:"-"` 463 464 // NullFields is a list of field names (e.g. "AdditionalRoleInfo") to 465 // include in API requests with the JSON null value. By default, fields 466 // with empty values are omitted from API requests. However, any field 467 // with an empty value appearing in NullFields will be sent to the 468 // server as null. It is an error if a field in this list has a 469 // non-empty value. This may be used to include null fields in Patch 470 // requests. 471 NullFields []string `json:"-"` 472} 473 474func (s *About) MarshalJSON() ([]byte, error) { 475 type NoMethod About 476 raw := NoMethod(*s) 477 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 478} 479 480type AboutAdditionalRoleInfo struct { 481 // RoleSets: The supported additional roles per primary role. 482 RoleSets []*AboutAdditionalRoleInfoRoleSets `json:"roleSets,omitempty"` 483 484 // Type: The content type that this additional role info applies to. 485 Type string `json:"type,omitempty"` 486 487 // ForceSendFields is a list of field names (e.g. "RoleSets") to 488 // unconditionally include in API requests. By default, fields with 489 // empty values are omitted from API requests. However, any non-pointer, 490 // non-interface field appearing in ForceSendFields will be sent to the 491 // server regardless of whether the field is empty or not. This may be 492 // used to include empty fields in Patch requests. 493 ForceSendFields []string `json:"-"` 494 495 // NullFields is a list of field names (e.g. "RoleSets") to include in 496 // API requests with the JSON null value. By default, fields with empty 497 // values are omitted from API requests. However, any field with an 498 // empty value appearing in NullFields will be sent to the server as 499 // null. It is an error if a field in this list has a non-empty value. 500 // This may be used to include null fields in Patch requests. 501 NullFields []string `json:"-"` 502} 503 504func (s *AboutAdditionalRoleInfo) MarshalJSON() ([]byte, error) { 505 type NoMethod AboutAdditionalRoleInfo 506 raw := NoMethod(*s) 507 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 508} 509 510type AboutAdditionalRoleInfoRoleSets struct { 511 // AdditionalRoles: The supported additional roles with the primary 512 // role. 513 AdditionalRoles []string `json:"additionalRoles,omitempty"` 514 515 // PrimaryRole: A primary permission role. 516 PrimaryRole string `json:"primaryRole,omitempty"` 517 518 // ForceSendFields is a list of field names (e.g. "AdditionalRoles") to 519 // unconditionally include in API requests. By default, fields with 520 // empty values are omitted from API requests. However, any non-pointer, 521 // non-interface field appearing in ForceSendFields will be sent to the 522 // server regardless of whether the field is empty or not. This may be 523 // used to include empty fields in Patch requests. 524 ForceSendFields []string `json:"-"` 525 526 // NullFields is a list of field names (e.g. "AdditionalRoles") to 527 // include in API requests with the JSON null value. By default, fields 528 // with empty values are omitted from API requests. However, any field 529 // with an empty value appearing in NullFields will be sent to the 530 // server as null. It is an error if a field in this list has a 531 // non-empty value. This may be used to include null fields in Patch 532 // requests. 533 NullFields []string `json:"-"` 534} 535 536func (s *AboutAdditionalRoleInfoRoleSets) MarshalJSON() ([]byte, error) { 537 type NoMethod AboutAdditionalRoleInfoRoleSets 538 raw := NoMethod(*s) 539 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 540} 541 542type AboutDriveThemes struct { 543 // BackgroundImageLink: A link to this theme's background image. 544 BackgroundImageLink string `json:"backgroundImageLink,omitempty"` 545 546 // ColorRgb: The color of this theme as an RGB hex string. 547 ColorRgb string `json:"colorRgb,omitempty"` 548 549 // Id: The ID of the theme. 550 Id string `json:"id,omitempty"` 551 552 // ForceSendFields is a list of field names (e.g. "BackgroundImageLink") 553 // to unconditionally include in API requests. By default, fields with 554 // empty values are omitted from API requests. However, any non-pointer, 555 // non-interface field appearing in ForceSendFields will be sent to the 556 // server regardless of whether the field is empty or not. This may be 557 // used to include empty fields in Patch requests. 558 ForceSendFields []string `json:"-"` 559 560 // NullFields is a list of field names (e.g. "BackgroundImageLink") to 561 // include in API requests with the JSON null value. By default, fields 562 // with empty values are omitted from API requests. However, any field 563 // with an empty value appearing in NullFields will be sent to the 564 // server as null. It is an error if a field in this list has a 565 // non-empty value. This may be used to include null fields in Patch 566 // requests. 567 NullFields []string `json:"-"` 568} 569 570func (s *AboutDriveThemes) MarshalJSON() ([]byte, error) { 571 type NoMethod AboutDriveThemes 572 raw := NoMethod(*s) 573 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 574} 575 576type AboutExportFormats struct { 577 // Source: The content type to convert from. 578 Source string `json:"source,omitempty"` 579 580 // Targets: The possible content types to convert to. 581 Targets []string `json:"targets,omitempty"` 582 583 // ForceSendFields is a list of field names (e.g. "Source") to 584 // unconditionally include in API requests. By default, fields with 585 // empty values are omitted from API requests. However, any non-pointer, 586 // non-interface field appearing in ForceSendFields will be sent to the 587 // server regardless of whether the field is empty or not. This may be 588 // used to include empty fields in Patch requests. 589 ForceSendFields []string `json:"-"` 590 591 // NullFields is a list of field names (e.g. "Source") to include in API 592 // requests with the JSON null value. By default, fields with empty 593 // values are omitted from API requests. However, any field with an 594 // empty value appearing in NullFields will be sent to the server as 595 // null. It is an error if a field in this list has a non-empty value. 596 // This may be used to include null fields in Patch requests. 597 NullFields []string `json:"-"` 598} 599 600func (s *AboutExportFormats) MarshalJSON() ([]byte, error) { 601 type NoMethod AboutExportFormats 602 raw := NoMethod(*s) 603 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 604} 605 606type AboutFeatures struct { 607 // FeatureName: The name of the feature. 608 FeatureName string `json:"featureName,omitempty"` 609 610 // FeatureRate: The request limit rate for this feature, in queries per 611 // second. 612 FeatureRate float64 `json:"featureRate,omitempty"` 613 614 // ForceSendFields is a list of field names (e.g. "FeatureName") to 615 // unconditionally include in API requests. By default, fields with 616 // empty values are omitted from API requests. However, any non-pointer, 617 // non-interface field appearing in ForceSendFields will be sent to the 618 // server regardless of whether the field is empty or not. This may be 619 // used to include empty fields in Patch requests. 620 ForceSendFields []string `json:"-"` 621 622 // NullFields is a list of field names (e.g. "FeatureName") to include 623 // in API requests with the JSON null value. By default, fields with 624 // empty values are omitted from API requests. However, any field with 625 // an empty value appearing in NullFields will be sent to the server as 626 // null. It is an error if a field in this list has a non-empty value. 627 // This may be used to include null fields in Patch requests. 628 NullFields []string `json:"-"` 629} 630 631func (s *AboutFeatures) MarshalJSON() ([]byte, error) { 632 type NoMethod AboutFeatures 633 raw := NoMethod(*s) 634 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 635} 636 637func (s *AboutFeatures) UnmarshalJSON(data []byte) error { 638 type NoMethod AboutFeatures 639 var s1 struct { 640 FeatureRate gensupport.JSONFloat64 `json:"featureRate"` 641 *NoMethod 642 } 643 s1.NoMethod = (*NoMethod)(s) 644 if err := json.Unmarshal(data, &s1); err != nil { 645 return err 646 } 647 s.FeatureRate = float64(s1.FeatureRate) 648 return nil 649} 650 651type AboutImportFormats struct { 652 // Source: The imported file's content type to convert from. 653 Source string `json:"source,omitempty"` 654 655 // Targets: The possible content types to convert to. 656 Targets []string `json:"targets,omitempty"` 657 658 // ForceSendFields is a list of field names (e.g. "Source") to 659 // unconditionally include in API requests. By default, fields with 660 // empty values are omitted from API requests. However, any non-pointer, 661 // non-interface field appearing in ForceSendFields will be sent to the 662 // server regardless of whether the field is empty or not. This may be 663 // used to include empty fields in Patch requests. 664 ForceSendFields []string `json:"-"` 665 666 // NullFields is a list of field names (e.g. "Source") to include in API 667 // requests with the JSON null value. By default, fields with empty 668 // values are omitted from API requests. However, any field with an 669 // empty value appearing in NullFields will be sent to the server as 670 // null. It is an error if a field in this list has a non-empty value. 671 // This may be used to include null fields in Patch requests. 672 NullFields []string `json:"-"` 673} 674 675func (s *AboutImportFormats) MarshalJSON() ([]byte, error) { 676 type NoMethod AboutImportFormats 677 raw := NoMethod(*s) 678 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 679} 680 681type AboutMaxUploadSizes struct { 682 // Size: The max upload size for this type. 683 Size int64 `json:"size,omitempty,string"` 684 685 // Type: The file type. 686 Type string `json:"type,omitempty"` 687 688 // ForceSendFields is a list of field names (e.g. "Size") to 689 // unconditionally include in API requests. By default, fields with 690 // empty values are omitted from API requests. However, any non-pointer, 691 // non-interface field appearing in ForceSendFields will be sent to the 692 // server regardless of whether the field is empty or not. This may be 693 // used to include empty fields in Patch requests. 694 ForceSendFields []string `json:"-"` 695 696 // NullFields is a list of field names (e.g. "Size") to include in API 697 // requests with the JSON null value. By default, fields with empty 698 // values are omitted from API requests. However, any field with an 699 // empty value appearing in NullFields will be sent to the server as 700 // null. It is an error if a field in this list has a non-empty value. 701 // This may be used to include null fields in Patch requests. 702 NullFields []string `json:"-"` 703} 704 705func (s *AboutMaxUploadSizes) MarshalJSON() ([]byte, error) { 706 type NoMethod AboutMaxUploadSizes 707 raw := NoMethod(*s) 708 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 709} 710 711type AboutQuotaBytesByService struct { 712 // BytesUsed: The storage quota bytes used by the service. 713 BytesUsed int64 `json:"bytesUsed,omitempty,string"` 714 715 // ServiceName: The service's name, e.g. DRIVE, GMAIL, or PHOTOS. 716 ServiceName string `json:"serviceName,omitempty"` 717 718 // ForceSendFields is a list of field names (e.g. "BytesUsed") to 719 // unconditionally include in API requests. By default, fields with 720 // empty values are omitted from API requests. However, any non-pointer, 721 // non-interface field appearing in ForceSendFields will be sent to the 722 // server regardless of whether the field is empty or not. This may be 723 // used to include empty fields in Patch requests. 724 ForceSendFields []string `json:"-"` 725 726 // NullFields is a list of field names (e.g. "BytesUsed") to include in 727 // API requests with the JSON null value. By default, fields with empty 728 // values are omitted from API requests. However, any field with an 729 // empty value appearing in NullFields will be sent to the server as 730 // null. It is an error if a field in this list has a non-empty value. 731 // This may be used to include null fields in Patch requests. 732 NullFields []string `json:"-"` 733} 734 735func (s *AboutQuotaBytesByService) MarshalJSON() ([]byte, error) { 736 type NoMethod AboutQuotaBytesByService 737 raw := NoMethod(*s) 738 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 739} 740 741type AboutTeamDriveThemes struct { 742 // BackgroundImageLink: Deprecated - use driveThemes/backgroundImageLink 743 // instead. 744 BackgroundImageLink string `json:"backgroundImageLink,omitempty"` 745 746 // ColorRgb: Deprecated - use driveThemes/colorRgb instead. 747 ColorRgb string `json:"colorRgb,omitempty"` 748 749 // Id: Deprecated - use driveThemes/id instead. 750 Id string `json:"id,omitempty"` 751 752 // ForceSendFields is a list of field names (e.g. "BackgroundImageLink") 753 // to unconditionally include in API requests. By default, fields with 754 // empty values are omitted from API requests. However, any non-pointer, 755 // non-interface field appearing in ForceSendFields will be sent to the 756 // server regardless of whether the field is empty or not. This may be 757 // used to include empty fields in Patch requests. 758 ForceSendFields []string `json:"-"` 759 760 // NullFields is a list of field names (e.g. "BackgroundImageLink") to 761 // include in API requests with the JSON null value. By default, fields 762 // with empty values are omitted from API requests. However, any field 763 // with an empty value appearing in NullFields will be sent to the 764 // server as null. It is an error if a field in this list has a 765 // non-empty value. This may be used to include null fields in Patch 766 // requests. 767 NullFields []string `json:"-"` 768} 769 770func (s *AboutTeamDriveThemes) MarshalJSON() ([]byte, error) { 771 type NoMethod AboutTeamDriveThemes 772 raw := NoMethod(*s) 773 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 774} 775 776// App: The apps resource provides a list of the apps that a user has 777// installed, with information about each app's supported MIME types, 778// file extensions, and other details. 779type App struct { 780 // Authorized: Whether the app is authorized to access data on the 781 // user's Drive. 782 Authorized bool `json:"authorized,omitempty"` 783 784 // CreateInFolderTemplate: The template url to create a new file with 785 // this app in a given folder. The template will contain {folderId} to 786 // be replaced by the folder to create the new file in. 787 CreateInFolderTemplate string `json:"createInFolderTemplate,omitempty"` 788 789 // CreateUrl: The url to create a new file with this app. 790 CreateUrl string `json:"createUrl,omitempty"` 791 792 // HasDriveWideScope: Whether the app has drive-wide scope. An app with 793 // drive-wide scope can access all files in the user's drive. 794 HasDriveWideScope bool `json:"hasDriveWideScope,omitempty"` 795 796 // Icons: The various icons for the app. 797 Icons []*AppIcons `json:"icons,omitempty"` 798 799 // Id: The ID of the app. 800 Id string `json:"id,omitempty"` 801 802 // Installed: Whether the app is installed. 803 Installed bool `json:"installed,omitempty"` 804 805 // Kind: This is always drive#app. 806 Kind string `json:"kind,omitempty"` 807 808 // LongDescription: A long description of the app. 809 LongDescription string `json:"longDescription,omitempty"` 810 811 // Name: The name of the app. 812 Name string `json:"name,omitempty"` 813 814 // ObjectType: The type of object this app creates (e.g. Chart). If 815 // empty, the app name should be used instead. 816 ObjectType string `json:"objectType,omitempty"` 817 818 // OpenUrlTemplate: The template url for opening files with this app. 819 // The template will contain {ids} and/or {exportIds} to be replaced by 820 // the actual file ids. See Open Files for the full documentation. 821 OpenUrlTemplate string `json:"openUrlTemplate,omitempty"` 822 823 // PrimaryFileExtensions: The list of primary file extensions. 824 PrimaryFileExtensions []string `json:"primaryFileExtensions,omitempty"` 825 826 // PrimaryMimeTypes: The list of primary mime types. 827 PrimaryMimeTypes []string `json:"primaryMimeTypes,omitempty"` 828 829 // ProductId: The ID of the product listing for this app. 830 ProductId string `json:"productId,omitempty"` 831 832 // ProductUrl: A link to the product listing for this app. 833 ProductUrl string `json:"productUrl,omitempty"` 834 835 // SecondaryFileExtensions: The list of secondary file extensions. 836 SecondaryFileExtensions []string `json:"secondaryFileExtensions,omitempty"` 837 838 // SecondaryMimeTypes: The list of secondary mime types. 839 SecondaryMimeTypes []string `json:"secondaryMimeTypes,omitempty"` 840 841 // ShortDescription: A short description of the app. 842 ShortDescription string `json:"shortDescription,omitempty"` 843 844 // SupportsCreate: Whether this app supports creating new objects. 845 SupportsCreate bool `json:"supportsCreate,omitempty"` 846 847 // SupportsImport: Whether this app supports importing Google Docs. 848 SupportsImport bool `json:"supportsImport,omitempty"` 849 850 // SupportsMultiOpen: Whether this app supports opening more than one 851 // file. 852 SupportsMultiOpen bool `json:"supportsMultiOpen,omitempty"` 853 854 // SupportsOfflineCreate: Whether this app supports creating new files 855 // when offline. 856 SupportsOfflineCreate bool `json:"supportsOfflineCreate,omitempty"` 857 858 // UseByDefault: Whether the app is selected as the default handler for 859 // the types it supports. 860 UseByDefault bool `json:"useByDefault,omitempty"` 861 862 // ServerResponse contains the HTTP response code and headers from the 863 // server. 864 googleapi.ServerResponse `json:"-"` 865 866 // ForceSendFields is a list of field names (e.g. "Authorized") to 867 // unconditionally include in API requests. By default, fields with 868 // empty values are omitted from API requests. However, any non-pointer, 869 // non-interface field appearing in ForceSendFields will be sent to the 870 // server regardless of whether the field is empty or not. This may be 871 // used to include empty fields in Patch requests. 872 ForceSendFields []string `json:"-"` 873 874 // NullFields is a list of field names (e.g. "Authorized") to include in 875 // API requests with the JSON null value. By default, fields with empty 876 // values are omitted from API requests. However, any field with an 877 // empty value appearing in NullFields will be sent to the server as 878 // null. It is an error if a field in this list has a non-empty value. 879 // This may be used to include null fields in Patch requests. 880 NullFields []string `json:"-"` 881} 882 883func (s *App) MarshalJSON() ([]byte, error) { 884 type NoMethod App 885 raw := NoMethod(*s) 886 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 887} 888 889type AppIcons struct { 890 // Category: Category of the icon. Allowed values are: 891 // - application - icon for the application 892 // - document - icon for a file associated with the app 893 // - documentShared - icon for a shared file associated with the app 894 Category string `json:"category,omitempty"` 895 896 // IconUrl: URL for the icon. 897 IconUrl string `json:"iconUrl,omitempty"` 898 899 // Size: Size of the icon. Represented as the maximum of the width and 900 // height. 901 Size int64 `json:"size,omitempty"` 902 903 // ForceSendFields is a list of field names (e.g. "Category") to 904 // unconditionally include in API requests. By default, fields with 905 // empty values are omitted from API requests. However, any non-pointer, 906 // non-interface field appearing in ForceSendFields will be sent to the 907 // server regardless of whether the field is empty or not. This may be 908 // used to include empty fields in Patch requests. 909 ForceSendFields []string `json:"-"` 910 911 // NullFields is a list of field names (e.g. "Category") to include in 912 // API requests with the JSON null value. By default, fields with empty 913 // values are omitted from API requests. However, any field with an 914 // empty value appearing in NullFields will be sent to the server as 915 // null. It is an error if a field in this list has a non-empty value. 916 // This may be used to include null fields in Patch requests. 917 NullFields []string `json:"-"` 918} 919 920func (s *AppIcons) MarshalJSON() ([]byte, error) { 921 type NoMethod AppIcons 922 raw := NoMethod(*s) 923 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 924} 925 926// AppList: A list of third-party applications which the user has 927// installed or given access to Google Drive. 928type AppList struct { 929 // DefaultAppIds: List of app IDs that the user has specified to use by 930 // default. The list is in reverse-priority order (lowest to highest). 931 DefaultAppIds []string `json:"defaultAppIds,omitempty"` 932 933 // Etag: The ETag of the list. 934 Etag string `json:"etag,omitempty"` 935 936 // Items: The list of apps. 937 Items []*App `json:"items,omitempty"` 938 939 // Kind: This is always drive#appList. 940 Kind string `json:"kind,omitempty"` 941 942 // SelfLink: A link back to this list. 943 SelfLink string `json:"selfLink,omitempty"` 944 945 // ServerResponse contains the HTTP response code and headers from the 946 // server. 947 googleapi.ServerResponse `json:"-"` 948 949 // ForceSendFields is a list of field names (e.g. "DefaultAppIds") to 950 // unconditionally include in API requests. By default, fields with 951 // empty values are omitted from API requests. However, any non-pointer, 952 // non-interface field appearing in ForceSendFields will be sent to the 953 // server regardless of whether the field is empty or not. This may be 954 // used to include empty fields in Patch requests. 955 ForceSendFields []string `json:"-"` 956 957 // NullFields is a list of field names (e.g. "DefaultAppIds") to include 958 // in API requests with the JSON null value. By default, fields with 959 // empty values are omitted from API requests. However, any field with 960 // an empty value appearing in NullFields will be sent to the server as 961 // null. It is an error if a field in this list has a non-empty value. 962 // This may be used to include null fields in Patch requests. 963 NullFields []string `json:"-"` 964} 965 966func (s *AppList) MarshalJSON() ([]byte, error) { 967 type NoMethod AppList 968 raw := NoMethod(*s) 969 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 970} 971 972// Change: Representation of a change to a file or shared drive. 973type Change struct { 974 // ChangeType: The type of the change. Possible values are file and 975 // drive. 976 ChangeType string `json:"changeType,omitempty"` 977 978 // Deleted: Whether the file or shared drive has been removed from this 979 // list of changes, for example by deletion or loss of access. 980 Deleted bool `json:"deleted,omitempty"` 981 982 // Drive: The updated state of the shared drive. Present if the 983 // changeType is drive, the user is still a member of the shared drive, 984 // and the shared drive has not been deleted. 985 Drive *Drive `json:"drive,omitempty"` 986 987 // DriveId: The ID of the shared drive associated with this change. 988 DriveId string `json:"driveId,omitempty"` 989 990 // File: The updated state of the file. Present if the type is file and 991 // the file has not been removed from this list of changes. 992 File *File `json:"file,omitempty"` 993 994 // FileId: The ID of the file associated with this change. 995 FileId string `json:"fileId,omitempty"` 996 997 // Id: The ID of the change. 998 Id int64 `json:"id,omitempty,string"` 999 1000 // Kind: This is always drive#change. 1001 Kind string `json:"kind,omitempty"` 1002 1003 // ModificationDate: The time of this modification. 1004 ModificationDate string `json:"modificationDate,omitempty"` 1005 1006 // SelfLink: A link back to this change. 1007 SelfLink string `json:"selfLink,omitempty"` 1008 1009 // TeamDrive: Deprecated - use drive instead. 1010 TeamDrive *TeamDrive `json:"teamDrive,omitempty"` 1011 1012 // TeamDriveId: Deprecated - use driveId instead. 1013 TeamDriveId string `json:"teamDriveId,omitempty"` 1014 1015 // Type: Deprecated - use changeType instead. 1016 Type string `json:"type,omitempty"` 1017 1018 // ServerResponse contains the HTTP response code and headers from the 1019 // server. 1020 googleapi.ServerResponse `json:"-"` 1021 1022 // ForceSendFields is a list of field names (e.g. "ChangeType") to 1023 // unconditionally include in API requests. By default, fields with 1024 // empty values are omitted from API requests. However, any non-pointer, 1025 // non-interface field appearing in ForceSendFields will be sent to the 1026 // server regardless of whether the field is empty or not. This may be 1027 // used to include empty fields in Patch requests. 1028 ForceSendFields []string `json:"-"` 1029 1030 // NullFields is a list of field names (e.g. "ChangeType") to include in 1031 // API requests with the JSON null value. By default, fields with empty 1032 // values are omitted from API requests. However, any field with an 1033 // empty value appearing in NullFields will be sent to the server as 1034 // null. It is an error if a field in this list has a non-empty value. 1035 // This may be used to include null fields in Patch requests. 1036 NullFields []string `json:"-"` 1037} 1038 1039func (s *Change) MarshalJSON() ([]byte, error) { 1040 type NoMethod Change 1041 raw := NoMethod(*s) 1042 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1043} 1044 1045// ChangeList: A list of changes for a user. 1046type ChangeList struct { 1047 // Etag: The ETag of the list. 1048 Etag string `json:"etag,omitempty"` 1049 1050 // Items: The list of changes. If nextPageToken is populated, then this 1051 // list may be incomplete and an additional page of results should be 1052 // fetched. 1053 Items []*Change `json:"items,omitempty"` 1054 1055 // Kind: This is always drive#changeList. 1056 Kind string `json:"kind,omitempty"` 1057 1058 // LargestChangeId: The current largest change ID. 1059 LargestChangeId int64 `json:"largestChangeId,omitempty,string"` 1060 1061 // NewStartPageToken: The starting page token for future changes. This 1062 // will be present only if the end of the current changes list has been 1063 // reached. 1064 NewStartPageToken string `json:"newStartPageToken,omitempty"` 1065 1066 // NextLink: A link to the next page of changes. 1067 NextLink string `json:"nextLink,omitempty"` 1068 1069 // NextPageToken: The page token for the next page of changes. This will 1070 // be absent if the end of the changes list has been reached. If the 1071 // token is rejected for any reason, it should be discarded, and 1072 // pagination should be restarted from the first page of results. 1073 NextPageToken string `json:"nextPageToken,omitempty"` 1074 1075 // SelfLink: A link back to this list. 1076 SelfLink string `json:"selfLink,omitempty"` 1077 1078 // ServerResponse contains the HTTP response code and headers from the 1079 // server. 1080 googleapi.ServerResponse `json:"-"` 1081 1082 // ForceSendFields is a list of field names (e.g. "Etag") to 1083 // unconditionally include in API requests. By default, fields with 1084 // empty values are omitted from API requests. However, any non-pointer, 1085 // non-interface field appearing in ForceSendFields will be sent to the 1086 // server regardless of whether the field is empty or not. This may be 1087 // used to include empty fields in Patch requests. 1088 ForceSendFields []string `json:"-"` 1089 1090 // NullFields is a list of field names (e.g. "Etag") to include in API 1091 // requests with the JSON null value. By default, fields with empty 1092 // values are omitted from API requests. However, any field with an 1093 // empty value appearing in NullFields will be sent to the server as 1094 // null. It is an error if a field in this list has a non-empty value. 1095 // This may be used to include null fields in Patch requests. 1096 NullFields []string `json:"-"` 1097} 1098 1099func (s *ChangeList) MarshalJSON() ([]byte, error) { 1100 type NoMethod ChangeList 1101 raw := NoMethod(*s) 1102 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1103} 1104 1105// Channel: An notification channel used to watch for resource changes. 1106type Channel struct { 1107 // Address: The address where notifications are delivered for this 1108 // channel. 1109 Address string `json:"address,omitempty"` 1110 1111 // Expiration: Date and time of notification channel expiration, 1112 // expressed as a Unix timestamp, in milliseconds. Optional. 1113 Expiration int64 `json:"expiration,omitempty,string"` 1114 1115 // Id: A UUID or similar unique string that identifies this channel. 1116 Id string `json:"id,omitempty"` 1117 1118 // Kind: Identifies this as a notification channel used to watch for 1119 // changes to a resource. Value: the fixed string "api#channel". 1120 Kind string `json:"kind,omitempty"` 1121 1122 // Params: Additional parameters controlling delivery channel behavior. 1123 // Optional. 1124 Params map[string]string `json:"params,omitempty"` 1125 1126 // Payload: A Boolean value to indicate whether payload is wanted. 1127 // Optional. 1128 Payload bool `json:"payload,omitempty"` 1129 1130 // ResourceId: An opaque ID that identifies the resource being watched 1131 // on this channel. Stable across different API versions. 1132 ResourceId string `json:"resourceId,omitempty"` 1133 1134 // ResourceUri: A version-specific identifier for the watched resource. 1135 ResourceUri string `json:"resourceUri,omitempty"` 1136 1137 // Token: An arbitrary string delivered to the target address with each 1138 // notification delivered over this channel. Optional. 1139 Token string `json:"token,omitempty"` 1140 1141 // Type: The type of delivery mechanism used for this channel. 1142 Type string `json:"type,omitempty"` 1143 1144 // ServerResponse contains the HTTP response code and headers from the 1145 // server. 1146 googleapi.ServerResponse `json:"-"` 1147 1148 // ForceSendFields is a list of field names (e.g. "Address") to 1149 // unconditionally include in API requests. By default, fields with 1150 // empty values are omitted from API requests. However, any non-pointer, 1151 // non-interface field appearing in ForceSendFields will be sent to the 1152 // server regardless of whether the field is empty or not. This may be 1153 // used to include empty fields in Patch requests. 1154 ForceSendFields []string `json:"-"` 1155 1156 // NullFields is a list of field names (e.g. "Address") to include in 1157 // API requests with the JSON null value. By default, fields with empty 1158 // values are omitted from API requests. However, any field with an 1159 // empty value appearing in NullFields will be sent to the server as 1160 // null. It is an error if a field in this list has a non-empty value. 1161 // This may be used to include null fields in Patch requests. 1162 NullFields []string `json:"-"` 1163} 1164 1165func (s *Channel) MarshalJSON() ([]byte, error) { 1166 type NoMethod Channel 1167 raw := NoMethod(*s) 1168 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1169} 1170 1171// ChildList: A list of children of a file. 1172type ChildList struct { 1173 // Etag: The ETag of the list. 1174 Etag string `json:"etag,omitempty"` 1175 1176 // Items: The list of children. If nextPageToken is populated, then this 1177 // list may be incomplete and an additional page of results should be 1178 // fetched. 1179 Items []*ChildReference `json:"items,omitempty"` 1180 1181 // Kind: This is always drive#childList. 1182 Kind string `json:"kind,omitempty"` 1183 1184 // NextLink: A link to the next page of children. 1185 NextLink string `json:"nextLink,omitempty"` 1186 1187 // NextPageToken: The page token for the next page of children. This 1188 // will be absent if the end of the children list has been reached. If 1189 // the token is rejected for any reason, it should be discarded, and 1190 // pagination should be restarted from the first page of results. 1191 NextPageToken string `json:"nextPageToken,omitempty"` 1192 1193 // SelfLink: A link back to this list. 1194 SelfLink string `json:"selfLink,omitempty"` 1195 1196 // ServerResponse contains the HTTP response code and headers from the 1197 // server. 1198 googleapi.ServerResponse `json:"-"` 1199 1200 // ForceSendFields is a list of field names (e.g. "Etag") to 1201 // unconditionally include in API requests. By default, fields with 1202 // empty values are omitted from API requests. However, any non-pointer, 1203 // non-interface field appearing in ForceSendFields will be sent to the 1204 // server regardless of whether the field is empty or not. This may be 1205 // used to include empty fields in Patch requests. 1206 ForceSendFields []string `json:"-"` 1207 1208 // NullFields is a list of field names (e.g. "Etag") to include in API 1209 // requests with the JSON null value. By default, fields with empty 1210 // values are omitted from API requests. However, any field with an 1211 // empty value appearing in NullFields will be sent to the server as 1212 // null. It is an error if a field in this list has a non-empty value. 1213 // This may be used to include null fields in Patch requests. 1214 NullFields []string `json:"-"` 1215} 1216 1217func (s *ChildList) MarshalJSON() ([]byte, error) { 1218 type NoMethod ChildList 1219 raw := NoMethod(*s) 1220 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1221} 1222 1223// ChildReference: A reference to a folder's child. 1224type ChildReference struct { 1225 // ChildLink: A link to the child. 1226 ChildLink string `json:"childLink,omitempty"` 1227 1228 // Id: The ID of the child. 1229 Id string `json:"id,omitempty"` 1230 1231 // Kind: This is always drive#childReference. 1232 Kind string `json:"kind,omitempty"` 1233 1234 // SelfLink: A link back to this reference. 1235 SelfLink string `json:"selfLink,omitempty"` 1236 1237 // ServerResponse contains the HTTP response code and headers from the 1238 // server. 1239 googleapi.ServerResponse `json:"-"` 1240 1241 // ForceSendFields is a list of field names (e.g. "ChildLink") to 1242 // unconditionally include in API requests. By default, fields with 1243 // empty values are omitted from API requests. However, any non-pointer, 1244 // non-interface field appearing in ForceSendFields will be sent to the 1245 // server regardless of whether the field is empty or not. This may be 1246 // used to include empty fields in Patch requests. 1247 ForceSendFields []string `json:"-"` 1248 1249 // NullFields is a list of field names (e.g. "ChildLink") to include in 1250 // API requests with the JSON null value. By default, fields with empty 1251 // values are omitted from API requests. However, any field with an 1252 // empty value appearing in NullFields will be sent to the server as 1253 // null. It is an error if a field in this list has a non-empty value. 1254 // This may be used to include null fields in Patch requests. 1255 NullFields []string `json:"-"` 1256} 1257 1258func (s *ChildReference) MarshalJSON() ([]byte, error) { 1259 type NoMethod ChildReference 1260 raw := NoMethod(*s) 1261 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1262} 1263 1264// Comment: A comment on a file in Google Drive. 1265type Comment struct { 1266 // Anchor: A region of the document represented as a JSON string. See 1267 // anchor documentation for details on how to define and interpret 1268 // anchor properties. 1269 Anchor string `json:"anchor,omitempty"` 1270 1271 // Author: The user who wrote this comment. 1272 Author *User `json:"author,omitempty"` 1273 1274 // CommentId: The ID of the comment. 1275 CommentId string `json:"commentId,omitempty"` 1276 1277 // Content: The plain text content used to create this comment. This is 1278 // not HTML safe and should only be used as a starting point to make 1279 // edits to a comment's content. 1280 Content string `json:"content,omitempty"` 1281 1282 // Context: The context of the file which is being commented on. 1283 Context *CommentContext `json:"context,omitempty"` 1284 1285 // CreatedDate: The date when this comment was first created. 1286 CreatedDate string `json:"createdDate,omitempty"` 1287 1288 // Deleted: Whether this comment has been deleted. If a comment has been 1289 // deleted the content will be cleared and this will only represent a 1290 // comment that once existed. 1291 Deleted bool `json:"deleted,omitempty"` 1292 1293 // FileId: The file which this comment is addressing. 1294 FileId string `json:"fileId,omitempty"` 1295 1296 // FileTitle: The title of the file which this comment is addressing. 1297 FileTitle string `json:"fileTitle,omitempty"` 1298 1299 // HtmlContent: HTML formatted content for this comment. 1300 HtmlContent string `json:"htmlContent,omitempty"` 1301 1302 // Kind: This is always drive#comment. 1303 Kind string `json:"kind,omitempty"` 1304 1305 // ModifiedDate: The date when this comment or any of its replies were 1306 // last modified. 1307 ModifiedDate string `json:"modifiedDate,omitempty"` 1308 1309 // Replies: Replies to this post. 1310 Replies []*CommentReply `json:"replies,omitempty"` 1311 1312 // SelfLink: A link back to this comment. 1313 SelfLink string `json:"selfLink,omitempty"` 1314 1315 // Status: The status of this comment. Status can be changed by posting 1316 // a reply to a comment with the desired status. 1317 // - "open" - The comment is still open. 1318 // - "resolved" - The comment has been resolved by one of its replies. 1319 Status string `json:"status,omitempty"` 1320 1321 // ServerResponse contains the HTTP response code and headers from the 1322 // server. 1323 googleapi.ServerResponse `json:"-"` 1324 1325 // ForceSendFields is a list of field names (e.g. "Anchor") to 1326 // unconditionally include in API requests. By default, fields with 1327 // empty values are omitted from API requests. However, any non-pointer, 1328 // non-interface field appearing in ForceSendFields will be sent to the 1329 // server regardless of whether the field is empty or not. This may be 1330 // used to include empty fields in Patch requests. 1331 ForceSendFields []string `json:"-"` 1332 1333 // NullFields is a list of field names (e.g. "Anchor") to include in API 1334 // requests with the JSON null value. By default, fields with empty 1335 // values are omitted from API requests. However, any field with an 1336 // empty value appearing in NullFields will be sent to the server as 1337 // null. It is an error if a field in this list has a non-empty value. 1338 // This may be used to include null fields in Patch requests. 1339 NullFields []string `json:"-"` 1340} 1341 1342func (s *Comment) MarshalJSON() ([]byte, error) { 1343 type NoMethod Comment 1344 raw := NoMethod(*s) 1345 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1346} 1347 1348// CommentContext: The context of the file which is being commented on. 1349type CommentContext struct { 1350 // Type: The MIME type of the context snippet. 1351 Type string `json:"type,omitempty"` 1352 1353 // Value: Data representation of the segment of the file being commented 1354 // on. In the case of a text file for example, this would be the actual 1355 // text that the comment is about. 1356 Value string `json:"value,omitempty"` 1357 1358 // ForceSendFields is a list of field names (e.g. "Type") to 1359 // unconditionally include in API requests. By default, fields with 1360 // empty values are omitted from API requests. However, any non-pointer, 1361 // non-interface field appearing in ForceSendFields will be sent to the 1362 // server regardless of whether the field is empty or not. This may be 1363 // used to include empty fields in Patch requests. 1364 ForceSendFields []string `json:"-"` 1365 1366 // NullFields is a list of field names (e.g. "Type") to include in API 1367 // requests with the JSON null value. By default, fields with empty 1368 // values are omitted from API requests. However, any field with an 1369 // empty value appearing in NullFields will be sent to the server as 1370 // null. It is an error if a field in this list has a non-empty value. 1371 // This may be used to include null fields in Patch requests. 1372 NullFields []string `json:"-"` 1373} 1374 1375func (s *CommentContext) MarshalJSON() ([]byte, error) { 1376 type NoMethod CommentContext 1377 raw := NoMethod(*s) 1378 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1379} 1380 1381// CommentList: A list of comments on a file in Google Drive. 1382type CommentList struct { 1383 // Items: The list of comments. If nextPageToken is populated, then this 1384 // list may be incomplete and an additional page of results should be 1385 // fetched. 1386 Items []*Comment `json:"items,omitempty"` 1387 1388 // Kind: This is always drive#commentList. 1389 Kind string `json:"kind,omitempty"` 1390 1391 // NextLink: A link to the next page of comments. 1392 NextLink string `json:"nextLink,omitempty"` 1393 1394 // NextPageToken: The page token for the next page of comments. This 1395 // will be absent if the end of the comments list has been reached. If 1396 // the token is rejected for any reason, it should be discarded, and 1397 // pagination should be restarted from the first page of results. 1398 NextPageToken string `json:"nextPageToken,omitempty"` 1399 1400 // SelfLink: A link back to this list. 1401 SelfLink string `json:"selfLink,omitempty"` 1402 1403 // ServerResponse contains the HTTP response code and headers from the 1404 // server. 1405 googleapi.ServerResponse `json:"-"` 1406 1407 // ForceSendFields is a list of field names (e.g. "Items") to 1408 // unconditionally include in API requests. By default, fields with 1409 // empty values are omitted from API requests. However, any non-pointer, 1410 // non-interface field appearing in ForceSendFields will be sent to the 1411 // server regardless of whether the field is empty or not. This may be 1412 // used to include empty fields in Patch requests. 1413 ForceSendFields []string `json:"-"` 1414 1415 // NullFields is a list of field names (e.g. "Items") to include in API 1416 // requests with the JSON null value. By default, fields with empty 1417 // values are omitted from API requests. However, any field with an 1418 // empty value appearing in NullFields will be sent to the server as 1419 // null. It is an error if a field in this list has a non-empty value. 1420 // This may be used to include null fields in Patch requests. 1421 NullFields []string `json:"-"` 1422} 1423 1424func (s *CommentList) MarshalJSON() ([]byte, error) { 1425 type NoMethod CommentList 1426 raw := NoMethod(*s) 1427 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1428} 1429 1430// CommentReply: A comment on a file in Google Drive. 1431type CommentReply struct { 1432 // Author: The user who wrote this reply. 1433 Author *User `json:"author,omitempty"` 1434 1435 // Content: The plain text content used to create this reply. This is 1436 // not HTML safe and should only be used as a starting point to make 1437 // edits to a reply's content. This field is required on inserts if no 1438 // verb is specified (resolve/reopen). 1439 Content string `json:"content,omitempty"` 1440 1441 // CreatedDate: The date when this reply was first created. 1442 CreatedDate string `json:"createdDate,omitempty"` 1443 1444 // Deleted: Whether this reply has been deleted. If a reply has been 1445 // deleted the content will be cleared and this will only represent a 1446 // reply that once existed. 1447 Deleted bool `json:"deleted,omitempty"` 1448 1449 // HtmlContent: HTML formatted content for this reply. 1450 HtmlContent string `json:"htmlContent,omitempty"` 1451 1452 // Kind: This is always drive#commentReply. 1453 Kind string `json:"kind,omitempty"` 1454 1455 // ModifiedDate: The date when this reply was last modified. 1456 ModifiedDate string `json:"modifiedDate,omitempty"` 1457 1458 // ReplyId: The ID of the reply. 1459 ReplyId string `json:"replyId,omitempty"` 1460 1461 // Verb: The action this reply performed to the parent comment. When 1462 // creating a new reply this is the action to be perform to the parent 1463 // comment. Possible values are: 1464 // - "resolve" - To resolve a comment. 1465 // - "reopen" - To reopen (un-resolve) a comment. 1466 Verb string `json:"verb,omitempty"` 1467 1468 // ServerResponse contains the HTTP response code and headers from the 1469 // server. 1470 googleapi.ServerResponse `json:"-"` 1471 1472 // ForceSendFields is a list of field names (e.g. "Author") to 1473 // unconditionally include in API requests. By default, fields with 1474 // empty values are omitted from API requests. However, any non-pointer, 1475 // non-interface field appearing in ForceSendFields will be sent to the 1476 // server regardless of whether the field is empty or not. This may be 1477 // used to include empty fields in Patch requests. 1478 ForceSendFields []string `json:"-"` 1479 1480 // NullFields is a list of field names (e.g. "Author") to include in API 1481 // requests with the JSON null value. By default, fields with empty 1482 // values are omitted from API requests. However, any field with an 1483 // empty value appearing in NullFields will be sent to the server as 1484 // null. It is an error if a field in this list has a non-empty value. 1485 // This may be used to include null fields in Patch requests. 1486 NullFields []string `json:"-"` 1487} 1488 1489func (s *CommentReply) MarshalJSON() ([]byte, error) { 1490 type NoMethod CommentReply 1491 raw := NoMethod(*s) 1492 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1493} 1494 1495// CommentReplyList: A list of replies to a comment on a file in Google 1496// Drive. 1497type CommentReplyList struct { 1498 // Items: The list of replies. If nextPageToken is populated, then this 1499 // list may be incomplete and an additional page of results should be 1500 // fetched. 1501 Items []*CommentReply `json:"items,omitempty"` 1502 1503 // Kind: This is always drive#commentReplyList. 1504 Kind string `json:"kind,omitempty"` 1505 1506 // NextLink: A link to the next page of replies. 1507 NextLink string `json:"nextLink,omitempty"` 1508 1509 // NextPageToken: The page token for the next page of replies. This will 1510 // be absent if the end of the replies list has been reached. If the 1511 // token is rejected for any reason, it should be discarded, and 1512 // pagination should be restarted from the first page of results. 1513 NextPageToken string `json:"nextPageToken,omitempty"` 1514 1515 // SelfLink: A link back to this list. 1516 SelfLink string `json:"selfLink,omitempty"` 1517 1518 // ServerResponse contains the HTTP response code and headers from the 1519 // server. 1520 googleapi.ServerResponse `json:"-"` 1521 1522 // ForceSendFields is a list of field names (e.g. "Items") to 1523 // unconditionally include in API requests. By default, fields with 1524 // empty values are omitted from API requests. However, any non-pointer, 1525 // non-interface field appearing in ForceSendFields will be sent to the 1526 // server regardless of whether the field is empty or not. This may be 1527 // used to include empty fields in Patch requests. 1528 ForceSendFields []string `json:"-"` 1529 1530 // NullFields is a list of field names (e.g. "Items") to include in API 1531 // requests with the JSON null value. By default, fields with empty 1532 // values are omitted from API requests. However, any field with an 1533 // empty value appearing in NullFields will be sent to the server as 1534 // null. It is an error if a field in this list has a non-empty value. 1535 // This may be used to include null fields in Patch requests. 1536 NullFields []string `json:"-"` 1537} 1538 1539func (s *CommentReplyList) MarshalJSON() ([]byte, error) { 1540 type NoMethod CommentReplyList 1541 raw := NoMethod(*s) 1542 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1543} 1544 1545// Drive: Representation of a shared drive. 1546type Drive struct { 1547 // BackgroundImageFile: An image file and cropping parameters from which 1548 // a background image for this shared drive is set. This is a write only 1549 // field; it can only be set on drive.drives.update requests that don't 1550 // set themeId. When specified, all fields of the backgroundImageFile 1551 // must be set. 1552 BackgroundImageFile *DriveBackgroundImageFile `json:"backgroundImageFile,omitempty"` 1553 1554 // BackgroundImageLink: A short-lived link to this shared drive's 1555 // background image. 1556 BackgroundImageLink string `json:"backgroundImageLink,omitempty"` 1557 1558 // Capabilities: Capabilities the current user has on this shared drive. 1559 Capabilities *DriveCapabilities `json:"capabilities,omitempty"` 1560 1561 // ColorRgb: The color of this shared drive as an RGB hex string. It can 1562 // only be set on a drive.drives.update request that does not set 1563 // themeId. 1564 ColorRgb string `json:"colorRgb,omitempty"` 1565 1566 // CreatedDate: The time at which the shared drive was created (RFC 3339 1567 // date-time). 1568 CreatedDate string `json:"createdDate,omitempty"` 1569 1570 // Hidden: Whether the shared drive is hidden from default view. 1571 Hidden bool `json:"hidden,omitempty"` 1572 1573 // Id: The ID of this shared drive which is also the ID of the top level 1574 // folder of this shared drive. 1575 Id string `json:"id,omitempty"` 1576 1577 // Kind: This is always drive#drive 1578 Kind string `json:"kind,omitempty"` 1579 1580 // Name: The name of this shared drive. 1581 Name string `json:"name,omitempty"` 1582 1583 // Restrictions: A set of restrictions that apply to this shared drive 1584 // or items inside this shared drive. 1585 Restrictions *DriveRestrictions `json:"restrictions,omitempty"` 1586 1587 // ThemeId: The ID of the theme from which the background image and 1588 // color will be set. The set of possible driveThemes can be retrieved 1589 // from a drive.about.get response. When not specified on a 1590 // drive.drives.insert request, a random theme is chosen from which the 1591 // background image and color are set. This is a write-only field; it 1592 // can only be set on requests that don't set colorRgb or 1593 // backgroundImageFile. 1594 ThemeId string `json:"themeId,omitempty"` 1595 1596 // ServerResponse contains the HTTP response code and headers from the 1597 // server. 1598 googleapi.ServerResponse `json:"-"` 1599 1600 // ForceSendFields is a list of field names (e.g. "BackgroundImageFile") 1601 // to unconditionally include in API requests. By default, fields with 1602 // empty values are omitted from API requests. However, any non-pointer, 1603 // non-interface field appearing in ForceSendFields will be sent to the 1604 // server regardless of whether the field is empty or not. This may be 1605 // used to include empty fields in Patch requests. 1606 ForceSendFields []string `json:"-"` 1607 1608 // NullFields is a list of field names (e.g. "BackgroundImageFile") to 1609 // include in API requests with the JSON null value. By default, fields 1610 // with empty values are omitted from API requests. However, any field 1611 // with an empty value appearing in NullFields will be sent to the 1612 // server as null. It is an error if a field in this list has a 1613 // non-empty value. This may be used to include null fields in Patch 1614 // requests. 1615 NullFields []string `json:"-"` 1616} 1617 1618func (s *Drive) MarshalJSON() ([]byte, error) { 1619 type NoMethod Drive 1620 raw := NoMethod(*s) 1621 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1622} 1623 1624// DriveBackgroundImageFile: An image file and cropping parameters from 1625// which a background image for this shared drive is set. This is a 1626// write only field; it can only be set on drive.drives.update requests 1627// that don't set themeId. When specified, all fields of the 1628// backgroundImageFile must be set. 1629type DriveBackgroundImageFile struct { 1630 // Id: The ID of an image file in Google Drive to use for the background 1631 // image. 1632 Id string `json:"id,omitempty"` 1633 1634 // Width: The width of the cropped image in the closed range of 0 to 1. 1635 // This value represents the width of the cropped image divided by the 1636 // width of the entire image. The height is computed by applying a width 1637 // to height aspect ratio of 80 to 9. The resulting image must be at 1638 // least 1280 pixels wide and 144 pixels high. 1639 Width float64 `json:"width,omitempty"` 1640 1641 // XCoordinate: The X coordinate of the upper left corner of the 1642 // cropping area in the background image. This is a value in the closed 1643 // range of 0 to 1. This value represents the horizontal distance from 1644 // the left side of the entire image to the left side of the cropping 1645 // area divided by the width of the entire image. 1646 XCoordinate float64 `json:"xCoordinate,omitempty"` 1647 1648 // YCoordinate: The Y coordinate of the upper left corner of the 1649 // cropping area in the background image. This is a value in the closed 1650 // range of 0 to 1. This value represents the vertical distance from the 1651 // top side of the entire image to the top side of the cropping area 1652 // divided by the height of the entire image. 1653 YCoordinate float64 `json:"yCoordinate,omitempty"` 1654 1655 // ForceSendFields is a list of field names (e.g. "Id") to 1656 // unconditionally include in API requests. By default, fields with 1657 // empty values are omitted from API requests. However, any non-pointer, 1658 // non-interface field appearing in ForceSendFields will be sent to the 1659 // server regardless of whether the field is empty or not. This may be 1660 // used to include empty fields in Patch requests. 1661 ForceSendFields []string `json:"-"` 1662 1663 // NullFields is a list of field names (e.g. "Id") to include in API 1664 // requests with the JSON null value. By default, fields with empty 1665 // values are omitted from API requests. However, any field with an 1666 // empty value appearing in NullFields will be sent to the server as 1667 // null. It is an error if a field in this list has a non-empty value. 1668 // This may be used to include null fields in Patch requests. 1669 NullFields []string `json:"-"` 1670} 1671 1672func (s *DriveBackgroundImageFile) MarshalJSON() ([]byte, error) { 1673 type NoMethod DriveBackgroundImageFile 1674 raw := NoMethod(*s) 1675 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1676} 1677 1678func (s *DriveBackgroundImageFile) UnmarshalJSON(data []byte) error { 1679 type NoMethod DriveBackgroundImageFile 1680 var s1 struct { 1681 Width gensupport.JSONFloat64 `json:"width"` 1682 XCoordinate gensupport.JSONFloat64 `json:"xCoordinate"` 1683 YCoordinate gensupport.JSONFloat64 `json:"yCoordinate"` 1684 *NoMethod 1685 } 1686 s1.NoMethod = (*NoMethod)(s) 1687 if err := json.Unmarshal(data, &s1); err != nil { 1688 return err 1689 } 1690 s.Width = float64(s1.Width) 1691 s.XCoordinate = float64(s1.XCoordinate) 1692 s.YCoordinate = float64(s1.YCoordinate) 1693 return nil 1694} 1695 1696// DriveCapabilities: Capabilities the current user has on this shared 1697// drive. 1698type DriveCapabilities struct { 1699 // CanAddChildren: Whether the current user can add children to folders 1700 // in this shared drive. 1701 CanAddChildren bool `json:"canAddChildren,omitempty"` 1702 1703 // CanChangeCopyRequiresWriterPermissionRestriction: Whether the current 1704 // user can change the copyRequiresWriterPermission restriction of this 1705 // shared drive. 1706 CanChangeCopyRequiresWriterPermissionRestriction bool `json:"canChangeCopyRequiresWriterPermissionRestriction,omitempty"` 1707 1708 // CanChangeDomainUsersOnlyRestriction: Whether the current user can 1709 // change the domainUsersOnly restriction of this shared drive. 1710 CanChangeDomainUsersOnlyRestriction bool `json:"canChangeDomainUsersOnlyRestriction,omitempty"` 1711 1712 // CanChangeDriveBackground: Whether the current user can change the 1713 // background of this shared drive. 1714 CanChangeDriveBackground bool `json:"canChangeDriveBackground,omitempty"` 1715 1716 // CanChangeDriveMembersOnlyRestriction: Whether the current user can 1717 // change the driveMembersOnly restriction of this shared drive. 1718 CanChangeDriveMembersOnlyRestriction bool `json:"canChangeDriveMembersOnlyRestriction,omitempty"` 1719 1720 // CanComment: Whether the current user can comment on files in this 1721 // shared drive. 1722 CanComment bool `json:"canComment,omitempty"` 1723 1724 // CanCopy: Whether the current user can copy files in this shared 1725 // drive. 1726 CanCopy bool `json:"canCopy,omitempty"` 1727 1728 // CanDeleteChildren: Whether the current user can delete children from 1729 // folders in this shared drive. 1730 CanDeleteChildren bool `json:"canDeleteChildren,omitempty"` 1731 1732 // CanDeleteDrive: Whether the current user can delete this shared 1733 // drive. Attempting to delete the shared drive may still fail if there 1734 // are untrashed items inside the shared drive. 1735 CanDeleteDrive bool `json:"canDeleteDrive,omitempty"` 1736 1737 // CanDownload: Whether the current user can download files in this 1738 // shared drive. 1739 CanDownload bool `json:"canDownload,omitempty"` 1740 1741 // CanEdit: Whether the current user can edit files in this shared drive 1742 CanEdit bool `json:"canEdit,omitempty"` 1743 1744 // CanListChildren: Whether the current user can list the children of 1745 // folders in this shared drive. 1746 CanListChildren bool `json:"canListChildren,omitempty"` 1747 1748 // CanManageMembers: Whether the current user can add members to this 1749 // shared drive or remove them or change their role. 1750 CanManageMembers bool `json:"canManageMembers,omitempty"` 1751 1752 // CanReadRevisions: Whether the current user can read the revisions 1753 // resource of files in this shared drive. 1754 CanReadRevisions bool `json:"canReadRevisions,omitempty"` 1755 1756 // CanRename: Whether the current user can rename files or folders in 1757 // this shared drive. 1758 CanRename bool `json:"canRename,omitempty"` 1759 1760 // CanRenameDrive: Whether the current user can rename this shared 1761 // drive. 1762 CanRenameDrive bool `json:"canRenameDrive,omitempty"` 1763 1764 // CanShare: Whether the current user can share files or folders in this 1765 // shared drive. 1766 CanShare bool `json:"canShare,omitempty"` 1767 1768 // CanTrashChildren: Whether the current user can trash children from 1769 // folders in this shared drive. 1770 CanTrashChildren bool `json:"canTrashChildren,omitempty"` 1771 1772 // ForceSendFields is a list of field names (e.g. "CanAddChildren") to 1773 // unconditionally include in API requests. By default, fields with 1774 // empty values are omitted from API requests. However, any non-pointer, 1775 // non-interface field appearing in ForceSendFields will be sent to the 1776 // server regardless of whether the field is empty or not. This may be 1777 // used to include empty fields in Patch requests. 1778 ForceSendFields []string `json:"-"` 1779 1780 // NullFields is a list of field names (e.g. "CanAddChildren") to 1781 // include in API requests with the JSON null value. By default, fields 1782 // with empty values are omitted from API requests. However, any field 1783 // with an empty value appearing in NullFields will be sent to the 1784 // server as null. It is an error if a field in this list has a 1785 // non-empty value. This may be used to include null fields in Patch 1786 // requests. 1787 NullFields []string `json:"-"` 1788} 1789 1790func (s *DriveCapabilities) MarshalJSON() ([]byte, error) { 1791 type NoMethod DriveCapabilities 1792 raw := NoMethod(*s) 1793 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1794} 1795 1796// DriveRestrictions: A set of restrictions that apply to this shared 1797// drive or items inside this shared drive. 1798type DriveRestrictions struct { 1799 // AdminManagedRestrictions: Whether administrative privileges on this 1800 // shared drive are required to modify restrictions. 1801 AdminManagedRestrictions bool `json:"adminManagedRestrictions,omitempty"` 1802 1803 // CopyRequiresWriterPermission: Whether the options to copy, print, or 1804 // download files inside this shared drive, should be disabled for 1805 // readers and commenters. When this restriction is set to true, it will 1806 // override the similarly named field to true for any file inside this 1807 // shared drive. 1808 CopyRequiresWriterPermission bool `json:"copyRequiresWriterPermission,omitempty"` 1809 1810 // DomainUsersOnly: Whether access to this shared drive and items inside 1811 // this shared drive is restricted to users of the domain to which this 1812 // shared drive belongs. This restriction may be overridden by other 1813 // sharing policies controlled outside of this shared drive. 1814 DomainUsersOnly bool `json:"domainUsersOnly,omitempty"` 1815 1816 // DriveMembersOnly: Whether access to items inside this shared drive is 1817 // restricted to its members. 1818 DriveMembersOnly bool `json:"driveMembersOnly,omitempty"` 1819 1820 // ForceSendFields is a list of field names (e.g. 1821 // "AdminManagedRestrictions") to unconditionally include in API 1822 // requests. By default, fields with empty values are omitted from API 1823 // requests. However, any non-pointer, non-interface field appearing in 1824 // ForceSendFields will be sent to the server regardless of whether the 1825 // field is empty or not. This may be used to include empty fields in 1826 // Patch requests. 1827 ForceSendFields []string `json:"-"` 1828 1829 // NullFields is a list of field names (e.g. "AdminManagedRestrictions") 1830 // to include in API requests with the JSON null value. By default, 1831 // fields with empty values are omitted from API requests. However, any 1832 // field with an empty value appearing in NullFields will be sent to the 1833 // server as null. It is an error if a field in this list has a 1834 // non-empty value. This may be used to include null fields in Patch 1835 // requests. 1836 NullFields []string `json:"-"` 1837} 1838 1839func (s *DriveRestrictions) MarshalJSON() ([]byte, error) { 1840 type NoMethod DriveRestrictions 1841 raw := NoMethod(*s) 1842 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1843} 1844 1845// DriveList: A list of shared drives. 1846type DriveList struct { 1847 // Items: The list of shared drives. If nextPageToken is populated, then 1848 // this list may be incomplete and an additional page of results should 1849 // be fetched. 1850 Items []*Drive `json:"items,omitempty"` 1851 1852 // Kind: This is always drive#driveList 1853 Kind string `json:"kind,omitempty"` 1854 1855 // NextPageToken: The page token for the next page of shared drives. 1856 // This will be absent if the end of the list has been reached. If the 1857 // token is rejected for any reason, it should be discarded, and 1858 // pagination should be restarted from the first page of results. 1859 NextPageToken string `json:"nextPageToken,omitempty"` 1860 1861 // ServerResponse contains the HTTP response code and headers from the 1862 // server. 1863 googleapi.ServerResponse `json:"-"` 1864 1865 // ForceSendFields is a list of field names (e.g. "Items") to 1866 // unconditionally include in API requests. By default, fields with 1867 // empty values are omitted from API requests. However, any non-pointer, 1868 // non-interface field appearing in ForceSendFields will be sent to the 1869 // server regardless of whether the field is empty or not. This may be 1870 // used to include empty fields in Patch requests. 1871 ForceSendFields []string `json:"-"` 1872 1873 // NullFields is a list of field names (e.g. "Items") to include in API 1874 // requests with the JSON null value. By default, fields with empty 1875 // values are omitted from API requests. However, any field with an 1876 // empty value appearing in NullFields will be sent to the server as 1877 // null. It is an error if a field in this list has a non-empty value. 1878 // This may be used to include null fields in Patch requests. 1879 NullFields []string `json:"-"` 1880} 1881 1882func (s *DriveList) MarshalJSON() ([]byte, error) { 1883 type NoMethod DriveList 1884 raw := NoMethod(*s) 1885 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 1886} 1887 1888// File: The metadata for a file. 1889type File struct { 1890 // AlternateLink: A link for opening the file in a relevant Google 1891 // editor or viewer. 1892 AlternateLink string `json:"alternateLink,omitempty"` 1893 1894 // AppDataContents: Whether this file is in the Application Data folder. 1895 AppDataContents bool `json:"appDataContents,omitempty"` 1896 1897 // CanComment: Deprecated: use capabilities/canComment. 1898 CanComment bool `json:"canComment,omitempty"` 1899 1900 // CanReadRevisions: Deprecated: use capabilities/canReadRevisions. 1901 CanReadRevisions bool `json:"canReadRevisions,omitempty"` 1902 1903 // Capabilities: Capabilities the current user has on this file. Each 1904 // capability corresponds to a fine-grained action that a user may take. 1905 Capabilities *FileCapabilities `json:"capabilities,omitempty"` 1906 1907 // CopyRequiresWriterPermission: Whether the options to copy, print, or 1908 // download this file, should be disabled for readers and commenters. 1909 CopyRequiresWriterPermission bool `json:"copyRequiresWriterPermission,omitempty"` 1910 1911 // Copyable: Deprecated: use capabilities/canCopy. 1912 Copyable bool `json:"copyable,omitempty"` 1913 1914 // CreatedDate: Create time for this file (formatted RFC 3339 1915 // timestamp). 1916 CreatedDate string `json:"createdDate,omitempty"` 1917 1918 // DefaultOpenWithLink: A link to open this file with the user's default 1919 // app for this file. Only populated when the drive.apps.readonly scope 1920 // is used. 1921 DefaultOpenWithLink string `json:"defaultOpenWithLink,omitempty"` 1922 1923 // Description: A short description of the file. 1924 Description string `json:"description,omitempty"` 1925 1926 // DownloadUrl: Short lived download URL for the file. This field is 1927 // only populated for files with content stored in Google Drive; it is 1928 // not populated for Google Docs or shortcut files. 1929 DownloadUrl string `json:"downloadUrl,omitempty"` 1930 1931 // DriveId: ID of the shared drive the file resides in. Only populated 1932 // for items in shared drives. 1933 DriveId string `json:"driveId,omitempty"` 1934 1935 // Editable: Deprecated: use capabilities/canEdit. 1936 Editable bool `json:"editable,omitempty"` 1937 1938 // EmbedLink: A link for embedding the file. 1939 EmbedLink string `json:"embedLink,omitempty"` 1940 1941 // Etag: ETag of the file. 1942 Etag string `json:"etag,omitempty"` 1943 1944 // ExplicitlyTrashed: Whether this file has been explicitly trashed, as 1945 // opposed to recursively trashed. 1946 ExplicitlyTrashed bool `json:"explicitlyTrashed,omitempty"` 1947 1948 // ExportLinks: Links for exporting Google Docs to specific formats. 1949 ExportLinks map[string]string `json:"exportLinks,omitempty"` 1950 1951 // FileExtension: The final component of fullFileExtension with trailing 1952 // text that does not appear to be part of the extension removed. This 1953 // field is only populated for files with content stored in Google 1954 // Drive; it is not populated for Google Docs or shortcut files. 1955 FileExtension string `json:"fileExtension,omitempty"` 1956 1957 // FileSize: The size of the file in bytes. This field is only populated 1958 // for files with content stored in Google Drive; it is not populated 1959 // for Google Docs or shortcut files. 1960 FileSize int64 `json:"fileSize,omitempty,string"` 1961 1962 // FolderColorRgb: Folder color as an RGB hex string if the file is a 1963 // folder. The list of supported colors is available in the 1964 // folderColorPalette field of the About resource. If an unsupported 1965 // color is specified, it will be changed to the closest color in the 1966 // palette. Not populated for items in shared drives. 1967 FolderColorRgb string `json:"folderColorRgb,omitempty"` 1968 1969 // FullFileExtension: The full file extension; extracted from the title. 1970 // May contain multiple concatenated extensions, such as "tar.gz". 1971 // Removing an extension from the title does not clear this field; 1972 // however, changing the extension on the title does update this field. 1973 // This field is only populated for files with content stored in Google 1974 // Drive; it is not populated for Google Docs or shortcut files. 1975 FullFileExtension string `json:"fullFileExtension,omitempty"` 1976 1977 // HasAugmentedPermissions: Whether any users are granted file access 1978 // directly on this file. This field is only populated for items in 1979 // shared drives. 1980 HasAugmentedPermissions bool `json:"hasAugmentedPermissions,omitempty"` 1981 1982 // HasThumbnail: Whether this file has a thumbnail. This does not 1983 // indicate whether the requesting app has access to the thumbnail. To 1984 // check access, look for the presence of the thumbnailLink field. 1985 HasThumbnail bool `json:"hasThumbnail,omitempty"` 1986 1987 // HeadRevisionId: The ID of the file's head revision. This field is 1988 // only populated for files with content stored in Google Drive; it is 1989 // not populated for Google Docs or shortcut files. 1990 HeadRevisionId string `json:"headRevisionId,omitempty"` 1991 1992 // IconLink: A link to the file's icon. 1993 IconLink string `json:"iconLink,omitempty"` 1994 1995 // Id: The ID of the file. 1996 Id string `json:"id,omitempty"` 1997 1998 // ImageMediaMetadata: Metadata about image media. This will only be 1999 // present for image types, and its contents will depend on what can be 2000 // parsed from the image content. 2001 ImageMediaMetadata *FileImageMediaMetadata `json:"imageMediaMetadata,omitempty"` 2002 2003 // IndexableText: Indexable text attributes for the file (can only be 2004 // written) 2005 IndexableText *FileIndexableText `json:"indexableText,omitempty"` 2006 2007 // IsAppAuthorized: Whether the file was created or opened by the 2008 // requesting app. 2009 IsAppAuthorized bool `json:"isAppAuthorized,omitempty"` 2010 2011 // Kind: The type of file. This is always drive#file. 2012 Kind string `json:"kind,omitempty"` 2013 2014 // Labels: A group of labels for the file. 2015 Labels *FileLabels `json:"labels,omitempty"` 2016 2017 // LastModifyingUser: The last user to modify this file. 2018 LastModifyingUser *User `json:"lastModifyingUser,omitempty"` 2019 2020 // LastModifyingUserName: Name of the last user to modify this file. 2021 LastModifyingUserName string `json:"lastModifyingUserName,omitempty"` 2022 2023 // LastViewedByMeDate: Last time this file was viewed by the user 2024 // (formatted RFC 3339 timestamp). 2025 LastViewedByMeDate string `json:"lastViewedByMeDate,omitempty"` 2026 2027 // MarkedViewedByMeDate: Deprecated. 2028 MarkedViewedByMeDate string `json:"markedViewedByMeDate,omitempty"` 2029 2030 // Md5Checksum: An MD5 checksum for the content of this file. This field 2031 // is only populated for files with content stored in Google Drive; it 2032 // is not populated for Google Docs or shortcut files. 2033 Md5Checksum string `json:"md5Checksum,omitempty"` 2034 2035 // MimeType: The MIME type of the file. This is only mutable on update 2036 // when uploading new content. This field can be left blank, and the 2037 // mimetype will be determined from the uploaded content's MIME type. 2038 MimeType string `json:"mimeType,omitempty"` 2039 2040 // ModifiedByMeDate: Last time this file was modified by the user 2041 // (formatted RFC 3339 timestamp). Note that setting modifiedDate will 2042 // also update the modifiedByMe date for the user which set the date. 2043 ModifiedByMeDate string `json:"modifiedByMeDate,omitempty"` 2044 2045 // ModifiedDate: Last time this file was modified by anyone (formatted 2046 // RFC 3339 timestamp). This is only mutable on update when the 2047 // setModifiedDate parameter is set. 2048 ModifiedDate string `json:"modifiedDate,omitempty"` 2049 2050 // OpenWithLinks: A map of the id of each of the user's apps to a link 2051 // to open this file with that app. Only populated when the 2052 // drive.apps.readonly scope is used. 2053 OpenWithLinks map[string]string `json:"openWithLinks,omitempty"` 2054 2055 // OriginalFilename: The original filename of the uploaded content if 2056 // available, or else the original value of the title field. This is 2057 // only available for files with binary content in Google Drive. 2058 OriginalFilename string `json:"originalFilename,omitempty"` 2059 2060 // OwnedByMe: Whether the file is owned by the current user. Not 2061 // populated for items in shared drives. 2062 OwnedByMe bool `json:"ownedByMe,omitempty"` 2063 2064 // OwnerNames: Name(s) of the owner(s) of this file. Not populated for 2065 // items in shared drives. 2066 OwnerNames []string `json:"ownerNames,omitempty"` 2067 2068 // Owners: The owner(s) of this file. Not populated for items in shared 2069 // drives. 2070 Owners []*User `json:"owners,omitempty"` 2071 2072 // Parents: Collection of parent folders which contain this file. 2073 // If not specified as part of an insert request, the file will be 2074 // placed directly in the user's My Drive folder. If not specified as 2075 // part of a copy request, the file will inherit any discoverable 2076 // parents of the source file. Update requests can also use the 2077 // addParents and removeParents parameters to modify the parents list. 2078 Parents []*ParentReference `json:"parents,omitempty"` 2079 2080 // PermissionIds: List of permission IDs for users with access to this 2081 // file. 2082 PermissionIds []string `json:"permissionIds,omitempty"` 2083 2084 // Permissions: The list of permissions for users with access to this 2085 // file. Not populated for items in shared drives. 2086 Permissions []*Permission `json:"permissions,omitempty"` 2087 2088 // Properties: The list of properties. 2089 Properties []*Property `json:"properties,omitempty"` 2090 2091 // QuotaBytesUsed: The number of quota bytes used by this file. 2092 QuotaBytesUsed int64 `json:"quotaBytesUsed,omitempty,string"` 2093 2094 // SelfLink: A link back to this file. 2095 SelfLink string `json:"selfLink,omitempty"` 2096 2097 // Shareable: Deprecated: use capabilities/canShare. 2098 Shareable bool `json:"shareable,omitempty"` 2099 2100 // Shared: Whether the file has been shared. Not populated for items in 2101 // shared drives. 2102 Shared bool `json:"shared,omitempty"` 2103 2104 // SharedWithMeDate: Time at which this file was shared with the user 2105 // (formatted RFC 3339 timestamp). 2106 SharedWithMeDate string `json:"sharedWithMeDate,omitempty"` 2107 2108 // SharingUser: User that shared the item with the current user, if 2109 // available. 2110 SharingUser *User `json:"sharingUser,omitempty"` 2111 2112 // Spaces: The list of spaces which contain the file. Supported values 2113 // are 'drive', 'appDataFolder' and 'photos'. 2114 Spaces []string `json:"spaces,omitempty"` 2115 2116 // TeamDriveId: Deprecated - use driveId instead. 2117 TeamDriveId string `json:"teamDriveId,omitempty"` 2118 2119 // Thumbnail: A thumbnail for the file. This will only be used if a 2120 // standard thumbnail cannot be generated. 2121 Thumbnail *FileThumbnail `json:"thumbnail,omitempty"` 2122 2123 // ThumbnailLink: A short-lived link to the file's thumbnail. Typically 2124 // lasts on the order of hours. Only populated when the requesting app 2125 // can access the file's content. 2126 ThumbnailLink string `json:"thumbnailLink,omitempty"` 2127 2128 // ThumbnailVersion: The thumbnail version for use in thumbnail cache 2129 // invalidation. 2130 ThumbnailVersion int64 `json:"thumbnailVersion,omitempty,string"` 2131 2132 // Title: The title of this file. Note that for immutable items such as 2133 // the top level folders of shared drives, My Drive root folder, and 2134 // Application Data folder the title is constant. 2135 Title string `json:"title,omitempty"` 2136 2137 // TrashedDate: The time that the item was trashed (formatted RFC 3339 2138 // timestamp). Only populated for items in shared drives. 2139 TrashedDate string `json:"trashedDate,omitempty"` 2140 2141 // TrashingUser: If the file has been explicitly trashed, the user who 2142 // trashed it. Only populated for items in shared drives. 2143 TrashingUser *User `json:"trashingUser,omitempty"` 2144 2145 // UserPermission: The permissions for the authenticated user on this 2146 // file. 2147 UserPermission *Permission `json:"userPermission,omitempty"` 2148 2149 // Version: A monotonically increasing version number for the file. This 2150 // reflects every change made to the file on the server, even those not 2151 // visible to the requesting user. 2152 Version int64 `json:"version,omitempty,string"` 2153 2154 // VideoMediaMetadata: Metadata about video media. This will only be 2155 // present for video types. 2156 VideoMediaMetadata *FileVideoMediaMetadata `json:"videoMediaMetadata,omitempty"` 2157 2158 // WebContentLink: A link for downloading the content of the file in a 2159 // browser using cookie based authentication. In cases where the content 2160 // is shared publicly, the content can be downloaded without any 2161 // credentials. 2162 WebContentLink string `json:"webContentLink,omitempty"` 2163 2164 // WebViewLink: A link only available on public folders for viewing 2165 // their static web assets (HTML, CSS, JS, etc) via Google Drive's 2166 // Website Hosting. 2167 WebViewLink string `json:"webViewLink,omitempty"` 2168 2169 // WritersCanShare: Whether writers can share the document with other 2170 // users. Not populated for items in shared drives. 2171 WritersCanShare bool `json:"writersCanShare,omitempty"` 2172 2173 // ServerResponse contains the HTTP response code and headers from the 2174 // server. 2175 googleapi.ServerResponse `json:"-"` 2176 2177 // ForceSendFields is a list of field names (e.g. "AlternateLink") to 2178 // unconditionally include in API requests. By default, fields with 2179 // empty values are omitted from API requests. However, any non-pointer, 2180 // non-interface field appearing in ForceSendFields will be sent to the 2181 // server regardless of whether the field is empty or not. This may be 2182 // used to include empty fields in Patch requests. 2183 ForceSendFields []string `json:"-"` 2184 2185 // NullFields is a list of field names (e.g. "AlternateLink") to include 2186 // in API requests with the JSON null value. By default, fields with 2187 // empty values are omitted from API requests. However, any field with 2188 // an empty value appearing in NullFields will be sent to the server as 2189 // null. It is an error if a field in this list has a non-empty value. 2190 // This may be used to include null fields in Patch requests. 2191 NullFields []string `json:"-"` 2192} 2193 2194func (s *File) MarshalJSON() ([]byte, error) { 2195 type NoMethod File 2196 raw := NoMethod(*s) 2197 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 2198} 2199 2200// FileCapabilities: Capabilities the current user has on this file. 2201// Each capability corresponds to a fine-grained action that a user may 2202// take. 2203type FileCapabilities struct { 2204 // CanAddChildren: Whether the current user can add children to this 2205 // folder. This is always false when the item is not a folder. 2206 CanAddChildren bool `json:"canAddChildren,omitempty"` 2207 2208 // CanChangeCopyRequiresWriterPermission: Whether the current user can 2209 // change the copyRequiresWriterPermission restriction of this file. 2210 CanChangeCopyRequiresWriterPermission bool `json:"canChangeCopyRequiresWriterPermission,omitempty"` 2211 2212 // CanChangeRestrictedDownload: Deprecated 2213 CanChangeRestrictedDownload bool `json:"canChangeRestrictedDownload,omitempty"` 2214 2215 // CanComment: Whether the current user can comment on this file. 2216 CanComment bool `json:"canComment,omitempty"` 2217 2218 // CanCopy: Whether the current user can copy this file. For an item in 2219 // a shared drive, whether the current user can copy non-folder 2220 // descendants of this item, or this item itself if it is not a folder. 2221 CanCopy bool `json:"canCopy,omitempty"` 2222 2223 // CanDelete: Whether the current user can delete this file. 2224 CanDelete bool `json:"canDelete,omitempty"` 2225 2226 // CanDeleteChildren: Whether the current user can delete children of 2227 // this folder. This is false when the item is not a folder. Only 2228 // populated for items in shared drives. 2229 CanDeleteChildren bool `json:"canDeleteChildren,omitempty"` 2230 2231 // CanDownload: Whether the current user can download this file. 2232 CanDownload bool `json:"canDownload,omitempty"` 2233 2234 // CanEdit: Whether the current user can edit this file. 2235 CanEdit bool `json:"canEdit,omitempty"` 2236 2237 // CanListChildren: Whether the current user can list the children of 2238 // this folder. This is always false when the item is not a folder. 2239 CanListChildren bool `json:"canListChildren,omitempty"` 2240 2241 // CanMoveChildrenOutOfDrive: Whether the current user can move children 2242 // of this folder outside of the shared drive. This is false when the 2243 // item is not a folder. Only populated for items in shared drives. 2244 CanMoveChildrenOutOfDrive bool `json:"canMoveChildrenOutOfDrive,omitempty"` 2245 2246 // CanMoveChildrenOutOfTeamDrive: Deprecated - use 2247 // canMoveChildrenOutOfDrive instead. 2248 CanMoveChildrenOutOfTeamDrive bool `json:"canMoveChildrenOutOfTeamDrive,omitempty"` 2249 2250 // CanMoveChildrenWithinDrive: Whether the current user can move 2251 // children of this folder within the shared drive. This is false when 2252 // the item is not a folder. Only populated for items in shared drives. 2253 CanMoveChildrenWithinDrive bool `json:"canMoveChildrenWithinDrive,omitempty"` 2254 2255 // CanMoveChildrenWithinTeamDrive: Deprecated - use 2256 // canMoveChildrenWithinDrive instead. 2257 CanMoveChildrenWithinTeamDrive bool `json:"canMoveChildrenWithinTeamDrive,omitempty"` 2258 2259 // CanMoveItemIntoTeamDrive: Deprecated - use canMoveItemOutOfDrive 2260 // instead. 2261 CanMoveItemIntoTeamDrive bool `json:"canMoveItemIntoTeamDrive,omitempty"` 2262 2263 // CanMoveItemOutOfDrive: Whether the current user can move this item 2264 // outside of this drive by changing its parent. Note that a request to 2265 // change the parent of the item may still fail depending on the new 2266 // parent that is being added. 2267 CanMoveItemOutOfDrive bool `json:"canMoveItemOutOfDrive,omitempty"` 2268 2269 // CanMoveItemOutOfTeamDrive: Deprecated - use canMoveItemOutOfDrive 2270 // instead. 2271 CanMoveItemOutOfTeamDrive bool `json:"canMoveItemOutOfTeamDrive,omitempty"` 2272 2273 // CanMoveItemWithinDrive: Whether the current user can move this item 2274 // within this shared drive. Note that a request to change the parent of 2275 // the item may still fail depending on the new parent that is being 2276 // added. Only populated for items in shared drives. 2277 CanMoveItemWithinDrive bool `json:"canMoveItemWithinDrive,omitempty"` 2278 2279 // CanMoveItemWithinTeamDrive: Deprecated - use canMoveItemWithinDrive 2280 // instead. 2281 CanMoveItemWithinTeamDrive bool `json:"canMoveItemWithinTeamDrive,omitempty"` 2282 2283 // CanMoveTeamDriveItem: Deprecated - use canMoveItemWithinDrive or 2284 // canMoveItemOutOfDrive instead. 2285 CanMoveTeamDriveItem bool `json:"canMoveTeamDriveItem,omitempty"` 2286 2287 // CanReadDrive: Whether the current user can read the shared drive to 2288 // which this file belongs. Only populated for items in shared drives. 2289 CanReadDrive bool `json:"canReadDrive,omitempty"` 2290 2291 // CanReadRevisions: Whether the current user can read the revisions 2292 // resource of this file. For a shared drive item, whether revisions of 2293 // non-folder descendants of this item, or this item itself if it is not 2294 // a folder, can be read. 2295 CanReadRevisions bool `json:"canReadRevisions,omitempty"` 2296 2297 // CanReadTeamDrive: Deprecated - use canReadDrive instead. 2298 CanReadTeamDrive bool `json:"canReadTeamDrive,omitempty"` 2299 2300 // CanRemoveChildren: Whether the current user can remove children from 2301 // this folder. This is always false when the item is not a folder. For 2302 // a folder in a shared drive, use canDeleteChildren or canTrashChildren 2303 // instead. 2304 CanRemoveChildren bool `json:"canRemoveChildren,omitempty"` 2305 2306 // CanRename: Whether the current user can rename this file. 2307 CanRename bool `json:"canRename,omitempty"` 2308 2309 // CanShare: Whether the current user can modify the sharing settings 2310 // for this file. 2311 CanShare bool `json:"canShare,omitempty"` 2312 2313 // CanTrash: Whether the current user can move this file to trash. 2314 CanTrash bool `json:"canTrash,omitempty"` 2315 2316 // CanTrashChildren: Whether the current user can trash children of this 2317 // folder. This is false when the item is not a folder. Only populated 2318 // for items in shared drives. 2319 CanTrashChildren bool `json:"canTrashChildren,omitempty"` 2320 2321 // CanUntrash: Whether the current user can restore this file from 2322 // trash. 2323 CanUntrash bool `json:"canUntrash,omitempty"` 2324 2325 // ForceSendFields is a list of field names (e.g. "CanAddChildren") to 2326 // unconditionally include in API requests. By default, fields with 2327 // empty values are omitted from API requests. However, any non-pointer, 2328 // non-interface field appearing in ForceSendFields will be sent to the 2329 // server regardless of whether the field is empty or not. This may be 2330 // used to include empty fields in Patch requests. 2331 ForceSendFields []string `json:"-"` 2332 2333 // NullFields is a list of field names (e.g. "CanAddChildren") to 2334 // include in API requests with the JSON null value. By default, fields 2335 // with empty values are omitted from API requests. However, any field 2336 // with an empty value appearing in NullFields will be sent to the 2337 // server as null. It is an error if a field in this list has a 2338 // non-empty value. This may be used to include null fields in Patch 2339 // requests. 2340 NullFields []string `json:"-"` 2341} 2342 2343func (s *FileCapabilities) MarshalJSON() ([]byte, error) { 2344 type NoMethod FileCapabilities 2345 raw := NoMethod(*s) 2346 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 2347} 2348 2349// FileImageMediaMetadata: Metadata about image media. This will only be 2350// present for image types, and its contents will depend on what can be 2351// parsed from the image content. 2352type FileImageMediaMetadata struct { 2353 // Aperture: The aperture used to create the photo (f-number). 2354 Aperture float64 `json:"aperture,omitempty"` 2355 2356 // CameraMake: The make of the camera used to create the photo. 2357 CameraMake string `json:"cameraMake,omitempty"` 2358 2359 // CameraModel: The model of the camera used to create the photo. 2360 CameraModel string `json:"cameraModel,omitempty"` 2361 2362 // ColorSpace: The color space of the photo. 2363 ColorSpace string `json:"colorSpace,omitempty"` 2364 2365 // Date: The date and time the photo was taken (EXIF format timestamp). 2366 Date string `json:"date,omitempty"` 2367 2368 // ExposureBias: The exposure bias of the photo (APEX value). 2369 ExposureBias float64 `json:"exposureBias,omitempty"` 2370 2371 // ExposureMode: The exposure mode used to create the photo. 2372 ExposureMode string `json:"exposureMode,omitempty"` 2373 2374 // ExposureTime: The length of the exposure, in seconds. 2375 ExposureTime float64 `json:"exposureTime,omitempty"` 2376 2377 // FlashUsed: Whether a flash was used to create the photo. 2378 FlashUsed bool `json:"flashUsed,omitempty"` 2379 2380 // FocalLength: The focal length used to create the photo, in 2381 // millimeters. 2382 FocalLength float64 `json:"focalLength,omitempty"` 2383 2384 // Height: The height of the image in pixels. 2385 Height int64 `json:"height,omitempty"` 2386 2387 // IsoSpeed: The ISO speed used to create the photo. 2388 IsoSpeed int64 `json:"isoSpeed,omitempty"` 2389 2390 // Lens: The lens used to create the photo. 2391 Lens string `json:"lens,omitempty"` 2392 2393 // Location: Geographic location information stored in the image. 2394 Location *FileImageMediaMetadataLocation `json:"location,omitempty"` 2395 2396 // MaxApertureValue: The smallest f-number of the lens at the focal 2397 // length used to create the photo (APEX value). 2398 MaxApertureValue float64 `json:"maxApertureValue,omitempty"` 2399 2400 // MeteringMode: The metering mode used to create the photo. 2401 MeteringMode string `json:"meteringMode,omitempty"` 2402 2403 // Rotation: The rotation in clockwise degrees from the image's original 2404 // orientation. 2405 Rotation int64 `json:"rotation,omitempty"` 2406 2407 // Sensor: The type of sensor used to create the photo. 2408 Sensor string `json:"sensor,omitempty"` 2409 2410 // SubjectDistance: The distance to the subject of the photo, in meters. 2411 SubjectDistance int64 `json:"subjectDistance,omitempty"` 2412 2413 // WhiteBalance: The white balance mode used to create the photo. 2414 WhiteBalance string `json:"whiteBalance,omitempty"` 2415 2416 // Width: The width of the image in pixels. 2417 Width int64 `json:"width,omitempty"` 2418 2419 // ForceSendFields is a list of field names (e.g. "Aperture") to 2420 // unconditionally include in API requests. By default, fields with 2421 // empty values are omitted from API requests. However, any non-pointer, 2422 // non-interface field appearing in ForceSendFields will be sent to the 2423 // server regardless of whether the field is empty or not. This may be 2424 // used to include empty fields in Patch requests. 2425 ForceSendFields []string `json:"-"` 2426 2427 // NullFields is a list of field names (e.g. "Aperture") to include in 2428 // API requests with the JSON null value. By default, fields with empty 2429 // values are omitted from API requests. However, any field with an 2430 // empty value appearing in NullFields will be sent to the server as 2431 // null. It is an error if a field in this list has a non-empty value. 2432 // This may be used to include null fields in Patch requests. 2433 NullFields []string `json:"-"` 2434} 2435 2436func (s *FileImageMediaMetadata) MarshalJSON() ([]byte, error) { 2437 type NoMethod FileImageMediaMetadata 2438 raw := NoMethod(*s) 2439 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 2440} 2441 2442func (s *FileImageMediaMetadata) UnmarshalJSON(data []byte) error { 2443 type NoMethod FileImageMediaMetadata 2444 var s1 struct { 2445 Aperture gensupport.JSONFloat64 `json:"aperture"` 2446 ExposureBias gensupport.JSONFloat64 `json:"exposureBias"` 2447 ExposureTime gensupport.JSONFloat64 `json:"exposureTime"` 2448 FocalLength gensupport.JSONFloat64 `json:"focalLength"` 2449 MaxApertureValue gensupport.JSONFloat64 `json:"maxApertureValue"` 2450 *NoMethod 2451 } 2452 s1.NoMethod = (*NoMethod)(s) 2453 if err := json.Unmarshal(data, &s1); err != nil { 2454 return err 2455 } 2456 s.Aperture = float64(s1.Aperture) 2457 s.ExposureBias = float64(s1.ExposureBias) 2458 s.ExposureTime = float64(s1.ExposureTime) 2459 s.FocalLength = float64(s1.FocalLength) 2460 s.MaxApertureValue = float64(s1.MaxApertureValue) 2461 return nil 2462} 2463 2464// FileImageMediaMetadataLocation: Geographic location information 2465// stored in the image. 2466type FileImageMediaMetadataLocation struct { 2467 // Altitude: The altitude stored in the image. 2468 Altitude float64 `json:"altitude,omitempty"` 2469 2470 // Latitude: The latitude stored in the image. 2471 Latitude float64 `json:"latitude,omitempty"` 2472 2473 // Longitude: The longitude stored in the image. 2474 Longitude float64 `json:"longitude,omitempty"` 2475 2476 // ForceSendFields is a list of field names (e.g. "Altitude") to 2477 // unconditionally include in API requests. By default, fields with 2478 // empty values are omitted from API requests. However, any non-pointer, 2479 // non-interface field appearing in ForceSendFields will be sent to the 2480 // server regardless of whether the field is empty or not. This may be 2481 // used to include empty fields in Patch requests. 2482 ForceSendFields []string `json:"-"` 2483 2484 // NullFields is a list of field names (e.g. "Altitude") to include in 2485 // API requests with the JSON null value. By default, fields with empty 2486 // values are omitted from API requests. However, any field with an 2487 // empty value appearing in NullFields will be sent to the server as 2488 // null. It is an error if a field in this list has a non-empty value. 2489 // This may be used to include null fields in Patch requests. 2490 NullFields []string `json:"-"` 2491} 2492 2493func (s *FileImageMediaMetadataLocation) MarshalJSON() ([]byte, error) { 2494 type NoMethod FileImageMediaMetadataLocation 2495 raw := NoMethod(*s) 2496 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 2497} 2498 2499func (s *FileImageMediaMetadataLocation) UnmarshalJSON(data []byte) error { 2500 type NoMethod FileImageMediaMetadataLocation 2501 var s1 struct { 2502 Altitude gensupport.JSONFloat64 `json:"altitude"` 2503 Latitude gensupport.JSONFloat64 `json:"latitude"` 2504 Longitude gensupport.JSONFloat64 `json:"longitude"` 2505 *NoMethod 2506 } 2507 s1.NoMethod = (*NoMethod)(s) 2508 if err := json.Unmarshal(data, &s1); err != nil { 2509 return err 2510 } 2511 s.Altitude = float64(s1.Altitude) 2512 s.Latitude = float64(s1.Latitude) 2513 s.Longitude = float64(s1.Longitude) 2514 return nil 2515} 2516 2517// FileIndexableText: Indexable text attributes for the file (can only 2518// be written) 2519type FileIndexableText struct { 2520 // Text: The text to be indexed for this file. 2521 Text string `json:"text,omitempty"` 2522 2523 // ForceSendFields is a list of field names (e.g. "Text") to 2524 // unconditionally include in API requests. By default, fields with 2525 // empty values are omitted from API requests. However, any non-pointer, 2526 // non-interface field appearing in ForceSendFields will be sent to the 2527 // server regardless of whether the field is empty or not. This may be 2528 // used to include empty fields in Patch requests. 2529 ForceSendFields []string `json:"-"` 2530 2531 // NullFields is a list of field names (e.g. "Text") to include in API 2532 // requests with the JSON null value. By default, fields with empty 2533 // values are omitted from API requests. However, any field with an 2534 // empty value appearing in NullFields will be sent to the server as 2535 // null. It is an error if a field in this list has a non-empty value. 2536 // This may be used to include null fields in Patch requests. 2537 NullFields []string `json:"-"` 2538} 2539 2540func (s *FileIndexableText) MarshalJSON() ([]byte, error) { 2541 type NoMethod FileIndexableText 2542 raw := NoMethod(*s) 2543 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 2544} 2545 2546// FileLabels: A group of labels for the file. 2547type FileLabels struct { 2548 // Hidden: Deprecated. 2549 Hidden bool `json:"hidden,omitempty"` 2550 2551 // Modified: Whether the file has been modified by this user. 2552 Modified bool `json:"modified,omitempty"` 2553 2554 // Restricted: Deprecated - use copyRequiresWriterPermission instead. 2555 Restricted bool `json:"restricted,omitempty"` 2556 2557 // Starred: Whether this file is starred by the user. 2558 Starred bool `json:"starred,omitempty"` 2559 2560 // Trashed: Whether this file has been trashed. This label applies to 2561 // all users accessing the file; however, only owners are allowed to see 2562 // and untrash files. 2563 Trashed bool `json:"trashed,omitempty"` 2564 2565 // Viewed: Whether this file has been viewed by this user. 2566 Viewed bool `json:"viewed,omitempty"` 2567 2568 // ForceSendFields is a list of field names (e.g. "Hidden") to 2569 // unconditionally include in API requests. By default, fields with 2570 // empty values are omitted from API requests. However, any non-pointer, 2571 // non-interface field appearing in ForceSendFields will be sent to the 2572 // server regardless of whether the field is empty or not. This may be 2573 // used to include empty fields in Patch requests. 2574 ForceSendFields []string `json:"-"` 2575 2576 // NullFields is a list of field names (e.g. "Hidden") to include in API 2577 // requests with the JSON null value. By default, fields with empty 2578 // values are omitted from API requests. However, any field with an 2579 // empty value appearing in NullFields will be sent to the server as 2580 // null. It is an error if a field in this list has a non-empty value. 2581 // This may be used to include null fields in Patch requests. 2582 NullFields []string `json:"-"` 2583} 2584 2585func (s *FileLabels) MarshalJSON() ([]byte, error) { 2586 type NoMethod FileLabels 2587 raw := NoMethod(*s) 2588 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 2589} 2590 2591// FileThumbnail: A thumbnail for the file. This will only be used if a 2592// standard thumbnail cannot be generated. 2593type FileThumbnail struct { 2594 // Image: The URL-safe Base64 encoded bytes of the thumbnail image. It 2595 // should conform to RFC 4648 section 5. 2596 Image string `json:"image,omitempty"` 2597 2598 // MimeType: The MIME type of the thumbnail. 2599 MimeType string `json:"mimeType,omitempty"` 2600 2601 // ForceSendFields is a list of field names (e.g. "Image") to 2602 // unconditionally include in API requests. By default, fields with 2603 // empty values are omitted from API requests. However, any non-pointer, 2604 // non-interface field appearing in ForceSendFields will be sent to the 2605 // server regardless of whether the field is empty or not. This may be 2606 // used to include empty fields in Patch requests. 2607 ForceSendFields []string `json:"-"` 2608 2609 // NullFields is a list of field names (e.g. "Image") to include in API 2610 // requests with the JSON null value. By default, fields with empty 2611 // values are omitted from API requests. However, any field with an 2612 // empty value appearing in NullFields will be sent to the server as 2613 // null. It is an error if a field in this list has a non-empty value. 2614 // This may be used to include null fields in Patch requests. 2615 NullFields []string `json:"-"` 2616} 2617 2618func (s *FileThumbnail) MarshalJSON() ([]byte, error) { 2619 type NoMethod FileThumbnail 2620 raw := NoMethod(*s) 2621 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 2622} 2623 2624// FileVideoMediaMetadata: Metadata about video media. This will only be 2625// present for video types. 2626type FileVideoMediaMetadata struct { 2627 // DurationMillis: The duration of the video in milliseconds. 2628 DurationMillis int64 `json:"durationMillis,omitempty,string"` 2629 2630 // Height: The height of the video in pixels. 2631 Height int64 `json:"height,omitempty"` 2632 2633 // Width: The width of the video in pixels. 2634 Width int64 `json:"width,omitempty"` 2635 2636 // ForceSendFields is a list of field names (e.g. "DurationMillis") to 2637 // unconditionally include in API requests. By default, fields with 2638 // empty values are omitted from API requests. However, any non-pointer, 2639 // non-interface field appearing in ForceSendFields will be sent to the 2640 // server regardless of whether the field is empty or not. This may be 2641 // used to include empty fields in Patch requests. 2642 ForceSendFields []string `json:"-"` 2643 2644 // NullFields is a list of field names (e.g. "DurationMillis") to 2645 // include in API requests with the JSON null value. By default, fields 2646 // with empty values are omitted from API requests. However, any field 2647 // with an empty value appearing in NullFields will be sent to the 2648 // server as null. It is an error if a field in this list has a 2649 // non-empty value. This may be used to include null fields in Patch 2650 // requests. 2651 NullFields []string `json:"-"` 2652} 2653 2654func (s *FileVideoMediaMetadata) MarshalJSON() ([]byte, error) { 2655 type NoMethod FileVideoMediaMetadata 2656 raw := NoMethod(*s) 2657 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 2658} 2659 2660// FileList: A list of files. 2661type FileList struct { 2662 // Etag: The ETag of the list. 2663 Etag string `json:"etag,omitempty"` 2664 2665 // IncompleteSearch: Whether the search process was incomplete. If true, 2666 // then some search results may be missing, since all documents were not 2667 // searched. This may occur when searching multiple drives with the 2668 // "allDrives" corpora, but all corpora could not be searched. When this 2669 // happens, it is suggested that clients narrow their query by choosing 2670 // a different corpus such as "default" or "drive". 2671 IncompleteSearch bool `json:"incompleteSearch,omitempty"` 2672 2673 // Items: The list of files. If nextPageToken is populated, then this 2674 // list may be incomplete and an additional page of results should be 2675 // fetched. 2676 Items []*File `json:"items,omitempty"` 2677 2678 // Kind: This is always drive#fileList. 2679 Kind string `json:"kind,omitempty"` 2680 2681 // NextLink: A link to the next page of files. 2682 NextLink string `json:"nextLink,omitempty"` 2683 2684 // NextPageToken: The page token for the next page of files. This will 2685 // be absent if the end of the files list has been reached. If the token 2686 // is rejected for any reason, it should be discarded, and pagination 2687 // should be restarted from the first page of results. 2688 NextPageToken string `json:"nextPageToken,omitempty"` 2689 2690 // SelfLink: A link back to this list. 2691 SelfLink string `json:"selfLink,omitempty"` 2692 2693 // ServerResponse contains the HTTP response code and headers from the 2694 // server. 2695 googleapi.ServerResponse `json:"-"` 2696 2697 // ForceSendFields is a list of field names (e.g. "Etag") to 2698 // unconditionally include in API requests. By default, fields with 2699 // empty values are omitted from API requests. However, any non-pointer, 2700 // non-interface field appearing in ForceSendFields will be sent to the 2701 // server regardless of whether the field is empty or not. This may be 2702 // used to include empty fields in Patch requests. 2703 ForceSendFields []string `json:"-"` 2704 2705 // NullFields is a list of field names (e.g. "Etag") to include in API 2706 // requests with the JSON null value. By default, fields with empty 2707 // values are omitted from API requests. However, any field with an 2708 // empty value appearing in NullFields will be sent to the server as 2709 // null. It is an error if a field in this list has a non-empty value. 2710 // This may be used to include null fields in Patch requests. 2711 NullFields []string `json:"-"` 2712} 2713 2714func (s *FileList) MarshalJSON() ([]byte, error) { 2715 type NoMethod FileList 2716 raw := NoMethod(*s) 2717 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 2718} 2719 2720// GeneratedIds: A list of generated IDs which can be provided in insert 2721// requests 2722type GeneratedIds struct { 2723 // Ids: The IDs generated for the requesting user in the specified 2724 // space. 2725 Ids []string `json:"ids,omitempty"` 2726 2727 // Kind: This is always drive#generatedIds 2728 Kind string `json:"kind,omitempty"` 2729 2730 // Space: The type of file that can be created with these IDs. 2731 Space string `json:"space,omitempty"` 2732 2733 // ServerResponse contains the HTTP response code and headers from the 2734 // server. 2735 googleapi.ServerResponse `json:"-"` 2736 2737 // ForceSendFields is a list of field names (e.g. "Ids") to 2738 // unconditionally include in API requests. By default, fields with 2739 // empty values are omitted from API requests. However, any non-pointer, 2740 // non-interface field appearing in ForceSendFields will be sent to the 2741 // server regardless of whether the field is empty or not. This may be 2742 // used to include empty fields in Patch requests. 2743 ForceSendFields []string `json:"-"` 2744 2745 // NullFields is a list of field names (e.g. "Ids") to include in API 2746 // requests with the JSON null value. By default, fields with empty 2747 // values are omitted from API requests. However, any field with an 2748 // empty value appearing in NullFields will be sent to the server as 2749 // null. It is an error if a field in this list has a non-empty value. 2750 // This may be used to include null fields in Patch requests. 2751 NullFields []string `json:"-"` 2752} 2753 2754func (s *GeneratedIds) MarshalJSON() ([]byte, error) { 2755 type NoMethod GeneratedIds 2756 raw := NoMethod(*s) 2757 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 2758} 2759 2760// ParentList: A list of a file's parents. 2761type ParentList struct { 2762 // Etag: The ETag of the list. 2763 Etag string `json:"etag,omitempty"` 2764 2765 // Items: The list of parents. 2766 Items []*ParentReference `json:"items,omitempty"` 2767 2768 // Kind: This is always drive#parentList. 2769 Kind string `json:"kind,omitempty"` 2770 2771 // SelfLink: A link back to this list. 2772 SelfLink string `json:"selfLink,omitempty"` 2773 2774 // ServerResponse contains the HTTP response code and headers from the 2775 // server. 2776 googleapi.ServerResponse `json:"-"` 2777 2778 // ForceSendFields is a list of field names (e.g. "Etag") to 2779 // unconditionally include in API requests. By default, fields with 2780 // empty values are omitted from API requests. However, any non-pointer, 2781 // non-interface field appearing in ForceSendFields will be sent to the 2782 // server regardless of whether the field is empty or not. This may be 2783 // used to include empty fields in Patch requests. 2784 ForceSendFields []string `json:"-"` 2785 2786 // NullFields is a list of field names (e.g. "Etag") to include in API 2787 // requests with the JSON null value. By default, fields with empty 2788 // values are omitted from API requests. However, any field with an 2789 // empty value appearing in NullFields will be sent to the server as 2790 // null. It is an error if a field in this list has a non-empty value. 2791 // This may be used to include null fields in Patch requests. 2792 NullFields []string `json:"-"` 2793} 2794 2795func (s *ParentList) MarshalJSON() ([]byte, error) { 2796 type NoMethod ParentList 2797 raw := NoMethod(*s) 2798 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 2799} 2800 2801// ParentReference: A reference to a file's parent. 2802type ParentReference struct { 2803 // Id: The ID of the parent. 2804 Id string `json:"id,omitempty"` 2805 2806 // IsRoot: Whether or not the parent is the root folder. 2807 IsRoot bool `json:"isRoot,omitempty"` 2808 2809 // Kind: This is always drive#parentReference. 2810 Kind string `json:"kind,omitempty"` 2811 2812 // ParentLink: A link to the parent. 2813 ParentLink string `json:"parentLink,omitempty"` 2814 2815 // SelfLink: A link back to this reference. 2816 SelfLink string `json:"selfLink,omitempty"` 2817 2818 // ServerResponse contains the HTTP response code and headers from the 2819 // server. 2820 googleapi.ServerResponse `json:"-"` 2821 2822 // ForceSendFields is a list of field names (e.g. "Id") to 2823 // unconditionally include in API requests. By default, fields with 2824 // empty values are omitted from API requests. However, any non-pointer, 2825 // non-interface field appearing in ForceSendFields will be sent to the 2826 // server regardless of whether the field is empty or not. This may be 2827 // used to include empty fields in Patch requests. 2828 ForceSendFields []string `json:"-"` 2829 2830 // NullFields is a list of field names (e.g. "Id") to include in API 2831 // requests with the JSON null value. By default, fields with empty 2832 // values are omitted from API requests. However, any field with an 2833 // empty value appearing in NullFields will be sent to the server as 2834 // null. It is an error if a field in this list has a non-empty value. 2835 // This may be used to include null fields in Patch requests. 2836 NullFields []string `json:"-"` 2837} 2838 2839func (s *ParentReference) MarshalJSON() ([]byte, error) { 2840 type NoMethod ParentReference 2841 raw := NoMethod(*s) 2842 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 2843} 2844 2845// Permission: A permission for a file. 2846type Permission struct { 2847 // AdditionalRoles: Additional roles for this user. Only commenter is 2848 // currently allowed, though more may be supported in the future. 2849 AdditionalRoles []string `json:"additionalRoles,omitempty"` 2850 2851 // AuthKey: Deprecated. 2852 AuthKey string `json:"authKey,omitempty"` 2853 2854 // Deleted: Whether the account associated with this permission has been 2855 // deleted. This field only pertains to user and group permissions. 2856 Deleted bool `json:"deleted,omitempty"` 2857 2858 // Domain: The domain name of the entity this permission refers to. This 2859 // is an output-only field which is present when the permission type is 2860 // user, group or domain. 2861 Domain string `json:"domain,omitempty"` 2862 2863 // EmailAddress: The email address of the user or group this permission 2864 // refers to. This is an output-only field which is present when the 2865 // permission type is user or group. 2866 EmailAddress string `json:"emailAddress,omitempty"` 2867 2868 // Etag: The ETag of the permission. 2869 Etag string `json:"etag,omitempty"` 2870 2871 // ExpirationDate: The time at which this permission will expire (RFC 2872 // 3339 date-time). Expiration dates have the following restrictions: 2873 // 2874 // - They can only be set on user and group permissions 2875 // - The date must be in the future 2876 // - The date cannot be more than a year in the future 2877 // - The date can only be set on drive.permissions.update or 2878 // drive.permissions.patch requests 2879 ExpirationDate string `json:"expirationDate,omitempty"` 2880 2881 // Id: The ID of the user this permission refers to, and identical to 2882 // the permissionId in the About and Files resources. When making a 2883 // drive.permissions.insert request, exactly one of the id or value 2884 // fields must be specified unless the permission type is anyone, in 2885 // which case both id and value are ignored. 2886 Id string `json:"id,omitempty"` 2887 2888 // Kind: This is always drive#permission. 2889 Kind string `json:"kind,omitempty"` 2890 2891 // Name: The name for this permission. 2892 Name string `json:"name,omitempty"` 2893 2894 // PermissionDetails: Details of whether the permissions on this shared 2895 // drive item are inherited or directly on this item. This is an 2896 // output-only field which is present only for shared drive items. 2897 PermissionDetails []*PermissionPermissionDetails `json:"permissionDetails,omitempty"` 2898 2899 // PhotoLink: A link to the profile photo, if available. 2900 PhotoLink string `json:"photoLink,omitempty"` 2901 2902 // Role: The primary role for this user. While new values may be 2903 // supported in the future, the following are currently allowed: 2904 // - owner 2905 // - organizer 2906 // - fileOrganizer 2907 // - writer 2908 // - reader 2909 Role string `json:"role,omitempty"` 2910 2911 // SelfLink: A link back to this permission. 2912 SelfLink string `json:"selfLink,omitempty"` 2913 2914 // TeamDrivePermissionDetails: Deprecated - use permissionDetails 2915 // instead. 2916 TeamDrivePermissionDetails []*PermissionTeamDrivePermissionDetails `json:"teamDrivePermissionDetails,omitempty"` 2917 2918 // Type: The account type. Allowed values are: 2919 // - user 2920 // - group 2921 // - domain 2922 // - anyone 2923 Type string `json:"type,omitempty"` 2924 2925 // Value: The email address or domain name for the entity. This is used 2926 // during inserts and is not populated in responses. When making a 2927 // drive.permissions.insert request, exactly one of the id or value 2928 // fields must be specified unless the permission type is anyone, in 2929 // which case both id and value are ignored. 2930 Value string `json:"value,omitempty"` 2931 2932 // WithLink: Whether the link is required for this permission. 2933 WithLink bool `json:"withLink,omitempty"` 2934 2935 // ServerResponse contains the HTTP response code and headers from the 2936 // server. 2937 googleapi.ServerResponse `json:"-"` 2938 2939 // ForceSendFields is a list of field names (e.g. "AdditionalRoles") to 2940 // unconditionally include in API requests. By default, fields with 2941 // empty values are omitted from API requests. However, any non-pointer, 2942 // non-interface field appearing in ForceSendFields will be sent to the 2943 // server regardless of whether the field is empty or not. This may be 2944 // used to include empty fields in Patch requests. 2945 ForceSendFields []string `json:"-"` 2946 2947 // NullFields is a list of field names (e.g. "AdditionalRoles") to 2948 // include in API requests with the JSON null value. By default, fields 2949 // with empty values are omitted from API requests. However, any field 2950 // with an empty value appearing in NullFields will be sent to the 2951 // server as null. It is an error if a field in this list has a 2952 // non-empty value. This may be used to include null fields in Patch 2953 // requests. 2954 NullFields []string `json:"-"` 2955} 2956 2957func (s *Permission) MarshalJSON() ([]byte, error) { 2958 type NoMethod Permission 2959 raw := NoMethod(*s) 2960 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 2961} 2962 2963type PermissionPermissionDetails struct { 2964 // AdditionalRoles: Additional roles for this user. Only commenter is 2965 // currently possible, though more may be supported in the future. 2966 AdditionalRoles []string `json:"additionalRoles,omitempty"` 2967 2968 // Inherited: Whether this permission is inherited. This field is always 2969 // populated. This is an output-only field. 2970 Inherited bool `json:"inherited,omitempty"` 2971 2972 // InheritedFrom: The ID of the item from which this permission is 2973 // inherited. This is an output-only field and is only populated for 2974 // members of the shared drive. 2975 InheritedFrom string `json:"inheritedFrom,omitempty"` 2976 2977 // PermissionType: The permission type for this user. While new values 2978 // may be added in future, the following are currently possible: 2979 // - file 2980 // - member 2981 PermissionType string `json:"permissionType,omitempty"` 2982 2983 // Role: The primary role for this user. While new values may be added 2984 // in the future, the following are currently possible: 2985 // - organizer 2986 // - fileOrganizer 2987 // - writer 2988 // - reader 2989 Role string `json:"role,omitempty"` 2990 2991 // ForceSendFields is a list of field names (e.g. "AdditionalRoles") to 2992 // unconditionally include in API requests. By default, fields with 2993 // empty values are omitted from API requests. However, any non-pointer, 2994 // non-interface field appearing in ForceSendFields will be sent to the 2995 // server regardless of whether the field is empty or not. This may be 2996 // used to include empty fields in Patch requests. 2997 ForceSendFields []string `json:"-"` 2998 2999 // NullFields is a list of field names (e.g. "AdditionalRoles") to 3000 // include in API requests with the JSON null value. By default, fields 3001 // with empty values are omitted from API requests. However, any field 3002 // with an empty value appearing in NullFields will be sent to the 3003 // server as null. It is an error if a field in this list has a 3004 // non-empty value. This may be used to include null fields in Patch 3005 // requests. 3006 NullFields []string `json:"-"` 3007} 3008 3009func (s *PermissionPermissionDetails) MarshalJSON() ([]byte, error) { 3010 type NoMethod PermissionPermissionDetails 3011 raw := NoMethod(*s) 3012 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 3013} 3014 3015type PermissionTeamDrivePermissionDetails struct { 3016 // AdditionalRoles: Deprecated - use permissionDetails/additionalRoles 3017 // instead. 3018 AdditionalRoles []string `json:"additionalRoles,omitempty"` 3019 3020 // Inherited: Deprecated - use permissionDetails/inherited instead. 3021 Inherited bool `json:"inherited,omitempty"` 3022 3023 // InheritedFrom: Deprecated - use permissionDetails/inheritedFrom 3024 // instead. 3025 InheritedFrom string `json:"inheritedFrom,omitempty"` 3026 3027 // Role: Deprecated - use permissionDetails/role instead. 3028 Role string `json:"role,omitempty"` 3029 3030 // TeamDrivePermissionType: Deprecated - use 3031 // permissionDetails/permissionType instead. 3032 TeamDrivePermissionType string `json:"teamDrivePermissionType,omitempty"` 3033 3034 // ForceSendFields is a list of field names (e.g. "AdditionalRoles") to 3035 // unconditionally include in API requests. By default, fields with 3036 // empty values are omitted from API requests. However, any non-pointer, 3037 // non-interface field appearing in ForceSendFields will be sent to the 3038 // server regardless of whether the field is empty or not. This may be 3039 // used to include empty fields in Patch requests. 3040 ForceSendFields []string `json:"-"` 3041 3042 // NullFields is a list of field names (e.g. "AdditionalRoles") to 3043 // include in API requests with the JSON null value. By default, fields 3044 // with empty values are omitted from API requests. However, any field 3045 // with an empty value appearing in NullFields will be sent to the 3046 // server as null. It is an error if a field in this list has a 3047 // non-empty value. This may be used to include null fields in Patch 3048 // requests. 3049 NullFields []string `json:"-"` 3050} 3051 3052func (s *PermissionTeamDrivePermissionDetails) MarshalJSON() ([]byte, error) { 3053 type NoMethod PermissionTeamDrivePermissionDetails 3054 raw := NoMethod(*s) 3055 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 3056} 3057 3058// PermissionId: An ID for a user or group as seen in Permission items. 3059type PermissionId struct { 3060 // Id: The permission ID. 3061 Id string `json:"id,omitempty"` 3062 3063 // Kind: This is always drive#permissionId. 3064 Kind string `json:"kind,omitempty"` 3065 3066 // ServerResponse contains the HTTP response code and headers from the 3067 // server. 3068 googleapi.ServerResponse `json:"-"` 3069 3070 // ForceSendFields is a list of field names (e.g. "Id") to 3071 // unconditionally include in API requests. By default, fields with 3072 // empty values are omitted from API requests. However, any non-pointer, 3073 // non-interface field appearing in ForceSendFields will be sent to the 3074 // server regardless of whether the field is empty or not. This may be 3075 // used to include empty fields in Patch requests. 3076 ForceSendFields []string `json:"-"` 3077 3078 // NullFields is a list of field names (e.g. "Id") to include in API 3079 // requests with the JSON null value. By default, fields with empty 3080 // values are omitted from API requests. However, any field with an 3081 // empty value appearing in NullFields will be sent to the server as 3082 // null. It is an error if a field in this list has a non-empty value. 3083 // This may be used to include null fields in Patch requests. 3084 NullFields []string `json:"-"` 3085} 3086 3087func (s *PermissionId) MarshalJSON() ([]byte, error) { 3088 type NoMethod PermissionId 3089 raw := NoMethod(*s) 3090 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 3091} 3092 3093// PermissionList: A list of permissions associated with a file. 3094type PermissionList struct { 3095 // Etag: The ETag of the list. 3096 Etag string `json:"etag,omitempty"` 3097 3098 // Items: The list of permissions. 3099 Items []*Permission `json:"items,omitempty"` 3100 3101 // Kind: This is always drive#permissionList. 3102 Kind string `json:"kind,omitempty"` 3103 3104 // NextPageToken: The page token for the next page of permissions. This 3105 // field will be absent if the end of the permissions list has been 3106 // reached. If the token is rejected for any reason, it should be 3107 // discarded, and pagination should be restarted from the first page of 3108 // results. 3109 NextPageToken string `json:"nextPageToken,omitempty"` 3110 3111 // SelfLink: A link back to this list. 3112 SelfLink string `json:"selfLink,omitempty"` 3113 3114 // ServerResponse contains the HTTP response code and headers from the 3115 // server. 3116 googleapi.ServerResponse `json:"-"` 3117 3118 // ForceSendFields is a list of field names (e.g. "Etag") to 3119 // unconditionally include in API requests. By default, fields with 3120 // empty values are omitted from API requests. However, any non-pointer, 3121 // non-interface field appearing in ForceSendFields will be sent to the 3122 // server regardless of whether the field is empty or not. This may be 3123 // used to include empty fields in Patch requests. 3124 ForceSendFields []string `json:"-"` 3125 3126 // NullFields is a list of field names (e.g. "Etag") to include in API 3127 // requests with the JSON null value. By default, fields with empty 3128 // values are omitted from API requests. However, any field with an 3129 // empty value appearing in NullFields will be sent to the server as 3130 // null. It is an error if a field in this list has a non-empty value. 3131 // This may be used to include null fields in Patch requests. 3132 NullFields []string `json:"-"` 3133} 3134 3135func (s *PermissionList) MarshalJSON() ([]byte, error) { 3136 type NoMethod PermissionList 3137 raw := NoMethod(*s) 3138 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 3139} 3140 3141// Property: A key-value pair attached to a file that is either public 3142// or private to an application. 3143// The following limits apply to file properties: 3144// - Maximum of 100 properties total per file 3145// - Maximum of 30 private properties per app 3146// - Maximum of 30 public properties 3147// - Maximum of 124 bytes size limit on (key + value) string in UTF-8 3148// encoding for a single property. 3149type Property struct { 3150 // Etag: ETag of the property. 3151 Etag string `json:"etag,omitempty"` 3152 3153 // Key: The key of this property. 3154 Key string `json:"key,omitempty"` 3155 3156 // Kind: This is always drive#property. 3157 Kind string `json:"kind,omitempty"` 3158 3159 // SelfLink: The link back to this property. 3160 SelfLink string `json:"selfLink,omitempty"` 3161 3162 // Value: The value of this property. 3163 Value string `json:"value,omitempty"` 3164 3165 // Visibility: The visibility of this property. Allowed values are 3166 // PRIVATE and PUBLIC. (Default: PRIVATE) 3167 Visibility string `json:"visibility,omitempty"` 3168 3169 // ServerResponse contains the HTTP response code and headers from the 3170 // server. 3171 googleapi.ServerResponse `json:"-"` 3172 3173 // ForceSendFields is a list of field names (e.g. "Etag") to 3174 // unconditionally include in API requests. By default, fields with 3175 // empty values are omitted from API requests. However, any non-pointer, 3176 // non-interface field appearing in ForceSendFields will be sent to the 3177 // server regardless of whether the field is empty or not. This may be 3178 // used to include empty fields in Patch requests. 3179 ForceSendFields []string `json:"-"` 3180 3181 // NullFields is a list of field names (e.g. "Etag") to include in API 3182 // requests with the JSON null value. By default, fields with empty 3183 // values are omitted from API requests. However, any field with an 3184 // empty value appearing in NullFields will be sent to the server as 3185 // null. It is an error if a field in this list has a non-empty value. 3186 // This may be used to include null fields in Patch requests. 3187 NullFields []string `json:"-"` 3188} 3189 3190func (s *Property) MarshalJSON() ([]byte, error) { 3191 type NoMethod Property 3192 raw := NoMethod(*s) 3193 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 3194} 3195 3196// PropertyList: A collection of properties, key-value pairs that are 3197// either public or private to an application. 3198type PropertyList struct { 3199 // Etag: The ETag of the list. 3200 Etag string `json:"etag,omitempty"` 3201 3202 // Items: The list of properties. 3203 Items []*Property `json:"items,omitempty"` 3204 3205 // Kind: This is always drive#propertyList. 3206 Kind string `json:"kind,omitempty"` 3207 3208 // SelfLink: The link back to this list. 3209 SelfLink string `json:"selfLink,omitempty"` 3210 3211 // ServerResponse contains the HTTP response code and headers from the 3212 // server. 3213 googleapi.ServerResponse `json:"-"` 3214 3215 // ForceSendFields is a list of field names (e.g. "Etag") to 3216 // unconditionally include in API requests. By default, fields with 3217 // empty values are omitted from API requests. However, any non-pointer, 3218 // non-interface field appearing in ForceSendFields will be sent to the 3219 // server regardless of whether the field is empty or not. This may be 3220 // used to include empty fields in Patch requests. 3221 ForceSendFields []string `json:"-"` 3222 3223 // NullFields is a list of field names (e.g. "Etag") to include in API 3224 // requests with the JSON null value. By default, fields with empty 3225 // values are omitted from API requests. However, any field with an 3226 // empty value appearing in NullFields will be sent to the server as 3227 // null. It is an error if a field in this list has a non-empty value. 3228 // This may be used to include null fields in Patch requests. 3229 NullFields []string `json:"-"` 3230} 3231 3232func (s *PropertyList) MarshalJSON() ([]byte, error) { 3233 type NoMethod PropertyList 3234 raw := NoMethod(*s) 3235 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 3236} 3237 3238// Revision: A revision of a file. 3239type Revision struct { 3240 // DownloadUrl: Short term download URL for the file. This will only be 3241 // populated on files with content stored in Drive. 3242 DownloadUrl string `json:"downloadUrl,omitempty"` 3243 3244 // Etag: The ETag of the revision. 3245 Etag string `json:"etag,omitempty"` 3246 3247 // ExportLinks: Links for exporting Google Docs to specific formats. 3248 ExportLinks map[string]string `json:"exportLinks,omitempty"` 3249 3250 // FileSize: The size of the revision in bytes. This will only be 3251 // populated on files with content stored in Drive. 3252 FileSize int64 `json:"fileSize,omitempty,string"` 3253 3254 // Id: The ID of the revision. 3255 Id string `json:"id,omitempty"` 3256 3257 // Kind: This is always drive#revision. 3258 Kind string `json:"kind,omitempty"` 3259 3260 // LastModifyingUser: The last user to modify this revision. 3261 LastModifyingUser *User `json:"lastModifyingUser,omitempty"` 3262 3263 // LastModifyingUserName: Name of the last user to modify this revision. 3264 LastModifyingUserName string `json:"lastModifyingUserName,omitempty"` 3265 3266 // Md5Checksum: An MD5 checksum for the content of this revision. This 3267 // will only be populated on files with content stored in Drive. 3268 Md5Checksum string `json:"md5Checksum,omitempty"` 3269 3270 // MimeType: The MIME type of the revision. 3271 MimeType string `json:"mimeType,omitempty"` 3272 3273 // ModifiedDate: Last time this revision was modified (formatted RFC 3274 // 3339 timestamp). 3275 ModifiedDate string `json:"modifiedDate,omitempty"` 3276 3277 // OriginalFilename: The original filename when this revision was 3278 // created. This will only be populated on files with content stored in 3279 // Drive. 3280 OriginalFilename string `json:"originalFilename,omitempty"` 3281 3282 // Pinned: Whether this revision is pinned to prevent automatic purging. 3283 // This will only be populated and can only be modified on files with 3284 // content stored in Drive which are not Google Docs. Revisions can also 3285 // be pinned when they are created through the 3286 // drive.files.insert/update/copy by using the pinned query parameter. 3287 Pinned bool `json:"pinned,omitempty"` 3288 3289 // PublishAuto: Whether subsequent revisions will be automatically 3290 // republished. This is only populated and can only be modified for 3291 // Google Docs. 3292 PublishAuto bool `json:"publishAuto,omitempty"` 3293 3294 // Published: Whether this revision is published. This is only populated 3295 // and can only be modified for Google Docs. 3296 Published bool `json:"published,omitempty"` 3297 3298 // PublishedLink: A link to the published revision. 3299 PublishedLink string `json:"publishedLink,omitempty"` 3300 3301 // PublishedOutsideDomain: Whether this revision is published outside 3302 // the domain. This is only populated and can only be modified for 3303 // Google Docs. 3304 PublishedOutsideDomain bool `json:"publishedOutsideDomain,omitempty"` 3305 3306 // SelfLink: A link back to this revision. 3307 SelfLink string `json:"selfLink,omitempty"` 3308 3309 // ServerResponse contains the HTTP response code and headers from the 3310 // server. 3311 googleapi.ServerResponse `json:"-"` 3312 3313 // ForceSendFields is a list of field names (e.g. "DownloadUrl") to 3314 // unconditionally include in API requests. By default, fields with 3315 // empty values are omitted from API requests. However, any non-pointer, 3316 // non-interface field appearing in ForceSendFields will be sent to the 3317 // server regardless of whether the field is empty or not. This may be 3318 // used to include empty fields in Patch requests. 3319 ForceSendFields []string `json:"-"` 3320 3321 // NullFields is a list of field names (e.g. "DownloadUrl") to include 3322 // in API requests with the JSON null value. By default, fields with 3323 // empty values are omitted from API requests. However, any field with 3324 // an empty value appearing in NullFields will be sent to the server as 3325 // null. It is an error if a field in this list has a non-empty value. 3326 // This may be used to include null fields in Patch requests. 3327 NullFields []string `json:"-"` 3328} 3329 3330func (s *Revision) MarshalJSON() ([]byte, error) { 3331 type NoMethod Revision 3332 raw := NoMethod(*s) 3333 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 3334} 3335 3336// RevisionList: A list of revisions of a file. 3337type RevisionList struct { 3338 // Etag: The ETag of the list. 3339 Etag string `json:"etag,omitempty"` 3340 3341 // Items: The list of revisions. If nextPageToken is populated, then 3342 // this list may be incomplete and an additional page of results should 3343 // be fetched. 3344 Items []*Revision `json:"items,omitempty"` 3345 3346 // Kind: This is always drive#revisionList. 3347 Kind string `json:"kind,omitempty"` 3348 3349 // NextPageToken: The page token for the next page of revisions. This 3350 // field will be absent if the end of the revisions list has been 3351 // reached. If the token is rejected for any reason, it should be 3352 // discarded and pagination should be restarted from the first page of 3353 // results. 3354 NextPageToken string `json:"nextPageToken,omitempty"` 3355 3356 // SelfLink: A link back to this list. 3357 SelfLink string `json:"selfLink,omitempty"` 3358 3359 // ServerResponse contains the HTTP response code and headers from the 3360 // server. 3361 googleapi.ServerResponse `json:"-"` 3362 3363 // ForceSendFields is a list of field names (e.g. "Etag") to 3364 // unconditionally include in API requests. By default, fields with 3365 // empty values are omitted from API requests. However, any non-pointer, 3366 // non-interface field appearing in ForceSendFields will be sent to the 3367 // server regardless of whether the field is empty or not. This may be 3368 // used to include empty fields in Patch requests. 3369 ForceSendFields []string `json:"-"` 3370 3371 // NullFields is a list of field names (e.g. "Etag") to include in API 3372 // requests with the JSON null value. By default, fields with empty 3373 // values are omitted from API requests. However, any field with an 3374 // empty value appearing in NullFields will be sent to the server as 3375 // null. It is an error if a field in this list has a non-empty value. 3376 // This may be used to include null fields in Patch requests. 3377 NullFields []string `json:"-"` 3378} 3379 3380func (s *RevisionList) MarshalJSON() ([]byte, error) { 3381 type NoMethod RevisionList 3382 raw := NoMethod(*s) 3383 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 3384} 3385 3386type StartPageToken struct { 3387 // Kind: Identifies what kind of resource this is. Value: the fixed 3388 // string "drive#startPageToken". 3389 Kind string `json:"kind,omitempty"` 3390 3391 // StartPageToken: The starting page token for listing changes. 3392 StartPageToken string `json:"startPageToken,omitempty"` 3393 3394 // ServerResponse contains the HTTP response code and headers from the 3395 // server. 3396 googleapi.ServerResponse `json:"-"` 3397 3398 // ForceSendFields is a list of field names (e.g. "Kind") to 3399 // unconditionally include in API requests. By default, fields with 3400 // empty values are omitted from API requests. However, any non-pointer, 3401 // non-interface field appearing in ForceSendFields will be sent to the 3402 // server regardless of whether the field is empty or not. This may be 3403 // used to include empty fields in Patch requests. 3404 ForceSendFields []string `json:"-"` 3405 3406 // NullFields is a list of field names (e.g. "Kind") to include in API 3407 // requests with the JSON null value. By default, fields with empty 3408 // values are omitted from API requests. However, any field with an 3409 // empty value appearing in NullFields will be sent to the server as 3410 // null. It is an error if a field in this list has a non-empty value. 3411 // This may be used to include null fields in Patch requests. 3412 NullFields []string `json:"-"` 3413} 3414 3415func (s *StartPageToken) MarshalJSON() ([]byte, error) { 3416 type NoMethod StartPageToken 3417 raw := NoMethod(*s) 3418 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 3419} 3420 3421// TeamDrive: Deprecated: use the drive collection instead. 3422type TeamDrive struct { 3423 // BackgroundImageFile: An image file and cropping parameters from which 3424 // a background image for this Team Drive is set. This is a write only 3425 // field; it can only be set on drive.teamdrives.update requests that 3426 // don't set themeId. When specified, all fields of the 3427 // backgroundImageFile must be set. 3428 BackgroundImageFile *TeamDriveBackgroundImageFile `json:"backgroundImageFile,omitempty"` 3429 3430 // BackgroundImageLink: A short-lived link to this Team Drive's 3431 // background image. 3432 BackgroundImageLink string `json:"backgroundImageLink,omitempty"` 3433 3434 // Capabilities: Capabilities the current user has on this Team Drive. 3435 Capabilities *TeamDriveCapabilities `json:"capabilities,omitempty"` 3436 3437 // ColorRgb: The color of this Team Drive as an RGB hex string. It can 3438 // only be set on a drive.teamdrives.update request that does not set 3439 // themeId. 3440 ColorRgb string `json:"colorRgb,omitempty"` 3441 3442 // CreatedDate: The time at which the Team Drive was created (RFC 3339 3443 // date-time). 3444 CreatedDate string `json:"createdDate,omitempty"` 3445 3446 // Id: The ID of this Team Drive which is also the ID of the top level 3447 // folder of this Team Drive. 3448 Id string `json:"id,omitempty"` 3449 3450 // Kind: This is always drive#teamDrive 3451 Kind string `json:"kind,omitempty"` 3452 3453 // Name: The name of this Team Drive. 3454 Name string `json:"name,omitempty"` 3455 3456 // Restrictions: A set of restrictions that apply to this Team Drive or 3457 // items inside this Team Drive. 3458 Restrictions *TeamDriveRestrictions `json:"restrictions,omitempty"` 3459 3460 // ThemeId: The ID of the theme from which the background image and 3461 // color will be set. The set of possible teamDriveThemes can be 3462 // retrieved from a drive.about.get response. When not specified on a 3463 // drive.teamdrives.insert request, a random theme is chosen from which 3464 // the background image and color are set. This is a write-only field; 3465 // it can only be set on requests that don't set colorRgb or 3466 // backgroundImageFile. 3467 ThemeId string `json:"themeId,omitempty"` 3468 3469 // ServerResponse contains the HTTP response code and headers from the 3470 // server. 3471 googleapi.ServerResponse `json:"-"` 3472 3473 // ForceSendFields is a list of field names (e.g. "BackgroundImageFile") 3474 // to unconditionally include in API requests. By default, fields with 3475 // empty values are omitted from API requests. However, any non-pointer, 3476 // non-interface field appearing in ForceSendFields will be sent to the 3477 // server regardless of whether the field is empty or not. This may be 3478 // used to include empty fields in Patch requests. 3479 ForceSendFields []string `json:"-"` 3480 3481 // NullFields is a list of field names (e.g. "BackgroundImageFile") to 3482 // include in API requests with the JSON null value. By default, fields 3483 // with empty values are omitted from API requests. However, any field 3484 // with an empty value appearing in NullFields will be sent to the 3485 // server as null. It is an error if a field in this list has a 3486 // non-empty value. This may be used to include null fields in Patch 3487 // requests. 3488 NullFields []string `json:"-"` 3489} 3490 3491func (s *TeamDrive) MarshalJSON() ([]byte, error) { 3492 type NoMethod TeamDrive 3493 raw := NoMethod(*s) 3494 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 3495} 3496 3497// TeamDriveBackgroundImageFile: An image file and cropping parameters 3498// from which a background image for this Team Drive is set. This is a 3499// write only field; it can only be set on drive.teamdrives.update 3500// requests that don't set themeId. When specified, all fields of the 3501// backgroundImageFile must be set. 3502type TeamDriveBackgroundImageFile struct { 3503 // Id: The ID of an image file in Drive to use for the background image. 3504 Id string `json:"id,omitempty"` 3505 3506 // Width: The width of the cropped image in the closed range of 0 to 1. 3507 // This value represents the width of the cropped image divided by the 3508 // width of the entire image. The height is computed by applying a width 3509 // to height aspect ratio of 80 to 9. The resulting image must be at 3510 // least 1280 pixels wide and 144 pixels high. 3511 Width float64 `json:"width,omitempty"` 3512 3513 // XCoordinate: The X coordinate of the upper left corner of the 3514 // cropping area in the background image. This is a value in the closed 3515 // range of 0 to 1. This value represents the horizontal distance from 3516 // the left side of the entire image to the left side of the cropping 3517 // area divided by the width of the entire image. 3518 XCoordinate float64 `json:"xCoordinate,omitempty"` 3519 3520 // YCoordinate: The Y coordinate of the upper left corner of the 3521 // cropping area in the background image. This is a value in the closed 3522 // range of 0 to 1. This value represents the vertical distance from the 3523 // top side of the entire image to the top side of the cropping area 3524 // divided by the height of the entire image. 3525 YCoordinate float64 `json:"yCoordinate,omitempty"` 3526 3527 // ForceSendFields is a list of field names (e.g. "Id") to 3528 // unconditionally include in API requests. By default, fields with 3529 // empty values are omitted from API requests. However, any non-pointer, 3530 // non-interface field appearing in ForceSendFields will be sent to the 3531 // server regardless of whether the field is empty or not. This may be 3532 // used to include empty fields in Patch requests. 3533 ForceSendFields []string `json:"-"` 3534 3535 // NullFields is a list of field names (e.g. "Id") to include in API 3536 // requests with the JSON null value. By default, fields with empty 3537 // values are omitted from API requests. However, any field with an 3538 // empty value appearing in NullFields will be sent to the server as 3539 // null. It is an error if a field in this list has a non-empty value. 3540 // This may be used to include null fields in Patch requests. 3541 NullFields []string `json:"-"` 3542} 3543 3544func (s *TeamDriveBackgroundImageFile) MarshalJSON() ([]byte, error) { 3545 type NoMethod TeamDriveBackgroundImageFile 3546 raw := NoMethod(*s) 3547 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 3548} 3549 3550func (s *TeamDriveBackgroundImageFile) UnmarshalJSON(data []byte) error { 3551 type NoMethod TeamDriveBackgroundImageFile 3552 var s1 struct { 3553 Width gensupport.JSONFloat64 `json:"width"` 3554 XCoordinate gensupport.JSONFloat64 `json:"xCoordinate"` 3555 YCoordinate gensupport.JSONFloat64 `json:"yCoordinate"` 3556 *NoMethod 3557 } 3558 s1.NoMethod = (*NoMethod)(s) 3559 if err := json.Unmarshal(data, &s1); err != nil { 3560 return err 3561 } 3562 s.Width = float64(s1.Width) 3563 s.XCoordinate = float64(s1.XCoordinate) 3564 s.YCoordinate = float64(s1.YCoordinate) 3565 return nil 3566} 3567 3568// TeamDriveCapabilities: Capabilities the current user has on this Team 3569// Drive. 3570type TeamDriveCapabilities struct { 3571 // CanAddChildren: Whether the current user can add children to folders 3572 // in this Team Drive. 3573 CanAddChildren bool `json:"canAddChildren,omitempty"` 3574 3575 // CanChangeCopyRequiresWriterPermissionRestriction: Whether the current 3576 // user can change the copyRequiresWriterPermission restriction of this 3577 // Team Drive. 3578 CanChangeCopyRequiresWriterPermissionRestriction bool `json:"canChangeCopyRequiresWriterPermissionRestriction,omitempty"` 3579 3580 // CanChangeDomainUsersOnlyRestriction: Whether the current user can 3581 // change the domainUsersOnly restriction of this Team Drive. 3582 CanChangeDomainUsersOnlyRestriction bool `json:"canChangeDomainUsersOnlyRestriction,omitempty"` 3583 3584 // CanChangeTeamDriveBackground: Whether the current user can change the 3585 // background of this Team Drive. 3586 CanChangeTeamDriveBackground bool `json:"canChangeTeamDriveBackground,omitempty"` 3587 3588 // CanChangeTeamMembersOnlyRestriction: Whether the current user can 3589 // change the teamMembersOnly restriction of this Team Drive. 3590 CanChangeTeamMembersOnlyRestriction bool `json:"canChangeTeamMembersOnlyRestriction,omitempty"` 3591 3592 // CanComment: Whether the current user can comment on files in this 3593 // Team Drive. 3594 CanComment bool `json:"canComment,omitempty"` 3595 3596 // CanCopy: Whether the current user can copy files in this Team Drive. 3597 CanCopy bool `json:"canCopy,omitempty"` 3598 3599 // CanDeleteChildren: Whether the current user can delete children from 3600 // folders in this Team Drive. 3601 CanDeleteChildren bool `json:"canDeleteChildren,omitempty"` 3602 3603 // CanDeleteTeamDrive: Whether the current user can delete this Team 3604 // Drive. Attempting to delete the Team Drive may still fail if there 3605 // are untrashed items inside the Team Drive. 3606 CanDeleteTeamDrive bool `json:"canDeleteTeamDrive,omitempty"` 3607 3608 // CanDownload: Whether the current user can download files in this Team 3609 // Drive. 3610 CanDownload bool `json:"canDownload,omitempty"` 3611 3612 // CanEdit: Whether the current user can edit files in this Team Drive 3613 CanEdit bool `json:"canEdit,omitempty"` 3614 3615 // CanListChildren: Whether the current user can list the children of 3616 // folders in this Team Drive. 3617 CanListChildren bool `json:"canListChildren,omitempty"` 3618 3619 // CanManageMembers: Whether the current user can add members to this 3620 // Team Drive or remove them or change their role. 3621 CanManageMembers bool `json:"canManageMembers,omitempty"` 3622 3623 // CanReadRevisions: Whether the current user can read the revisions 3624 // resource of files in this Team Drive. 3625 CanReadRevisions bool `json:"canReadRevisions,omitempty"` 3626 3627 // CanRemoveChildren: Deprecated - use canDeleteChildren or 3628 // canTrashChildren instead. 3629 CanRemoveChildren bool `json:"canRemoveChildren,omitempty"` 3630 3631 // CanRename: Whether the current user can rename files or folders in 3632 // this Team Drive. 3633 CanRename bool `json:"canRename,omitempty"` 3634 3635 // CanRenameTeamDrive: Whether the current user can rename this Team 3636 // Drive. 3637 CanRenameTeamDrive bool `json:"canRenameTeamDrive,omitempty"` 3638 3639 // CanShare: Whether the current user can share files or folders in this 3640 // Team Drive. 3641 CanShare bool `json:"canShare,omitempty"` 3642 3643 // CanTrashChildren: Whether the current user can trash children from 3644 // folders in this Team Drive. 3645 CanTrashChildren bool `json:"canTrashChildren,omitempty"` 3646 3647 // ForceSendFields is a list of field names (e.g. "CanAddChildren") to 3648 // unconditionally include in API requests. By default, fields with 3649 // empty values are omitted from API requests. However, any non-pointer, 3650 // non-interface field appearing in ForceSendFields will be sent to the 3651 // server regardless of whether the field is empty or not. This may be 3652 // used to include empty fields in Patch requests. 3653 ForceSendFields []string `json:"-"` 3654 3655 // NullFields is a list of field names (e.g. "CanAddChildren") to 3656 // include in API requests with the JSON null value. By default, fields 3657 // with empty values are omitted from API requests. However, any field 3658 // with an empty value appearing in NullFields will be sent to the 3659 // server as null. It is an error if a field in this list has a 3660 // non-empty value. This may be used to include null fields in Patch 3661 // requests. 3662 NullFields []string `json:"-"` 3663} 3664 3665func (s *TeamDriveCapabilities) MarshalJSON() ([]byte, error) { 3666 type NoMethod TeamDriveCapabilities 3667 raw := NoMethod(*s) 3668 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 3669} 3670 3671// TeamDriveRestrictions: A set of restrictions that apply to this Team 3672// Drive or items inside this Team Drive. 3673type TeamDriveRestrictions struct { 3674 // AdminManagedRestrictions: Whether administrative privileges on this 3675 // Team Drive are required to modify restrictions. 3676 AdminManagedRestrictions bool `json:"adminManagedRestrictions,omitempty"` 3677 3678 // CopyRequiresWriterPermission: Whether the options to copy, print, or 3679 // download files inside this Team Drive, should be disabled for readers 3680 // and commenters. When this restriction is set to true, it will 3681 // override the similarly named field to true for any file inside this 3682 // Team Drive. 3683 CopyRequiresWriterPermission bool `json:"copyRequiresWriterPermission,omitempty"` 3684 3685 // DomainUsersOnly: Whether access to this Team Drive and items inside 3686 // this Team Drive is restricted to users of the domain to which this 3687 // Team Drive belongs. This restriction may be overridden by other 3688 // sharing policies controlled outside of this Team Drive. 3689 DomainUsersOnly bool `json:"domainUsersOnly,omitempty"` 3690 3691 // TeamMembersOnly: Whether access to items inside this Team Drive is 3692 // restricted to members of this Team Drive. 3693 TeamMembersOnly bool `json:"teamMembersOnly,omitempty"` 3694 3695 // ForceSendFields is a list of field names (e.g. 3696 // "AdminManagedRestrictions") to unconditionally include in API 3697 // requests. By default, fields with empty values are omitted from API 3698 // requests. However, any non-pointer, non-interface field appearing in 3699 // ForceSendFields will be sent to the server regardless of whether the 3700 // field is empty or not. This may be used to include empty fields in 3701 // Patch requests. 3702 ForceSendFields []string `json:"-"` 3703 3704 // NullFields is a list of field names (e.g. "AdminManagedRestrictions") 3705 // to include in API requests with the JSON null value. By default, 3706 // fields with empty values are omitted from API requests. However, any 3707 // field with an empty value appearing in NullFields will be sent to the 3708 // server as null. It is an error if a field in this list has a 3709 // non-empty value. This may be used to include null fields in Patch 3710 // requests. 3711 NullFields []string `json:"-"` 3712} 3713 3714func (s *TeamDriveRestrictions) MarshalJSON() ([]byte, error) { 3715 type NoMethod TeamDriveRestrictions 3716 raw := NoMethod(*s) 3717 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 3718} 3719 3720// TeamDriveList: A list of Team Drives. 3721type TeamDriveList struct { 3722 // Items: The list of Team Drives. 3723 Items []*TeamDrive `json:"items,omitempty"` 3724 3725 // Kind: This is always drive#teamDriveList 3726 Kind string `json:"kind,omitempty"` 3727 3728 // NextPageToken: The page token for the next page of Team Drives. 3729 NextPageToken string `json:"nextPageToken,omitempty"` 3730 3731 // ServerResponse contains the HTTP response code and headers from the 3732 // server. 3733 googleapi.ServerResponse `json:"-"` 3734 3735 // ForceSendFields is a list of field names (e.g. "Items") to 3736 // unconditionally include in API requests. By default, fields with 3737 // empty values are omitted from API requests. However, any non-pointer, 3738 // non-interface field appearing in ForceSendFields will be sent to the 3739 // server regardless of whether the field is empty or not. This may be 3740 // used to include empty fields in Patch requests. 3741 ForceSendFields []string `json:"-"` 3742 3743 // NullFields is a list of field names (e.g. "Items") to include in API 3744 // requests with the JSON null value. By default, fields with empty 3745 // values are omitted from API requests. However, any field with an 3746 // empty value appearing in NullFields will be sent to the server as 3747 // null. It is an error if a field in this list has a non-empty value. 3748 // This may be used to include null fields in Patch requests. 3749 NullFields []string `json:"-"` 3750} 3751 3752func (s *TeamDriveList) MarshalJSON() ([]byte, error) { 3753 type NoMethod TeamDriveList 3754 raw := NoMethod(*s) 3755 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 3756} 3757 3758// User: Information about a Drive user. 3759type User struct { 3760 // DisplayName: A plain text displayable name for this user. 3761 DisplayName string `json:"displayName,omitempty"` 3762 3763 // EmailAddress: The email address of the user. 3764 EmailAddress string `json:"emailAddress,omitempty"` 3765 3766 // IsAuthenticatedUser: Whether this user is the same as the 3767 // authenticated user for whom the request was made. 3768 IsAuthenticatedUser bool `json:"isAuthenticatedUser,omitempty"` 3769 3770 // Kind: This is always drive#user. 3771 Kind string `json:"kind,omitempty"` 3772 3773 // PermissionId: The user's ID as visible in the permissions collection. 3774 PermissionId string `json:"permissionId,omitempty"` 3775 3776 // Picture: The user's profile picture. 3777 Picture *UserPicture `json:"picture,omitempty"` 3778 3779 // ForceSendFields is a list of field names (e.g. "DisplayName") to 3780 // unconditionally include in API requests. By default, fields with 3781 // empty values are omitted from API requests. However, any non-pointer, 3782 // non-interface field appearing in ForceSendFields will be sent to the 3783 // server regardless of whether the field is empty or not. This may be 3784 // used to include empty fields in Patch requests. 3785 ForceSendFields []string `json:"-"` 3786 3787 // NullFields is a list of field names (e.g. "DisplayName") to include 3788 // in API requests with the JSON null value. By default, fields with 3789 // empty values are omitted from API requests. However, any field with 3790 // an empty value appearing in NullFields will be sent to the server as 3791 // null. It is an error if a field in this list has a non-empty value. 3792 // This may be used to include null fields in Patch requests. 3793 NullFields []string `json:"-"` 3794} 3795 3796func (s *User) MarshalJSON() ([]byte, error) { 3797 type NoMethod User 3798 raw := NoMethod(*s) 3799 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 3800} 3801 3802// UserPicture: The user's profile picture. 3803type UserPicture struct { 3804 // Url: A URL that points to a profile picture of this user. 3805 Url string `json:"url,omitempty"` 3806 3807 // ForceSendFields is a list of field names (e.g. "Url") to 3808 // unconditionally include in API requests. By default, fields with 3809 // empty values are omitted from API requests. However, any non-pointer, 3810 // non-interface field appearing in ForceSendFields will be sent to the 3811 // server regardless of whether the field is empty or not. This may be 3812 // used to include empty fields in Patch requests. 3813 ForceSendFields []string `json:"-"` 3814 3815 // NullFields is a list of field names (e.g. "Url") to include in API 3816 // requests with the JSON null value. By default, fields with empty 3817 // values are omitted from API requests. However, any field with an 3818 // empty value appearing in NullFields will be sent to the server as 3819 // null. It is an error if a field in this list has a non-empty value. 3820 // This may be used to include null fields in Patch requests. 3821 NullFields []string `json:"-"` 3822} 3823 3824func (s *UserPicture) MarshalJSON() ([]byte, error) { 3825 type NoMethod UserPicture 3826 raw := NoMethod(*s) 3827 return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields) 3828} 3829 3830// method id "drive.about.get": 3831 3832type AboutGetCall struct { 3833 s *Service 3834 urlParams_ gensupport.URLParams 3835 ifNoneMatch_ string 3836 ctx_ context.Context 3837 header_ http.Header 3838} 3839 3840// Get: Gets the information about the current user along with Drive API 3841// settings 3842func (r *AboutService) Get() *AboutGetCall { 3843 c := &AboutGetCall{s: r.s, urlParams_: make(gensupport.URLParams)} 3844 return c 3845} 3846 3847// IncludeSubscribed sets the optional parameter "includeSubscribed": 3848// Whether to count changes outside the My Drive hierarchy. When set to 3849// false, changes to files such as those in the Application Data folder 3850// or shared files which have not been added to My Drive will be omitted 3851// from the maxChangeIdCount. 3852func (c *AboutGetCall) IncludeSubscribed(includeSubscribed bool) *AboutGetCall { 3853 c.urlParams_.Set("includeSubscribed", fmt.Sprint(includeSubscribed)) 3854 return c 3855} 3856 3857// MaxChangeIdCount sets the optional parameter "maxChangeIdCount": 3858// Maximum number of remaining change IDs to count 3859func (c *AboutGetCall) MaxChangeIdCount(maxChangeIdCount int64) *AboutGetCall { 3860 c.urlParams_.Set("maxChangeIdCount", fmt.Sprint(maxChangeIdCount)) 3861 return c 3862} 3863 3864// StartChangeId sets the optional parameter "startChangeId": Change ID 3865// to start counting from when calculating number of remaining change 3866// IDs 3867func (c *AboutGetCall) StartChangeId(startChangeId int64) *AboutGetCall { 3868 c.urlParams_.Set("startChangeId", fmt.Sprint(startChangeId)) 3869 return c 3870} 3871 3872// Fields allows partial responses to be retrieved. See 3873// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 3874// for more information. 3875func (c *AboutGetCall) Fields(s ...googleapi.Field) *AboutGetCall { 3876 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 3877 return c 3878} 3879 3880// IfNoneMatch sets the optional parameter which makes the operation 3881// fail if the object's ETag matches the given value. This is useful for 3882// getting updates only after the object has changed since the last 3883// request. Use googleapi.IsNotModified to check whether the response 3884// error from Do is the result of In-None-Match. 3885func (c *AboutGetCall) IfNoneMatch(entityTag string) *AboutGetCall { 3886 c.ifNoneMatch_ = entityTag 3887 return c 3888} 3889 3890// Context sets the context to be used in this call's Do method. Any 3891// pending HTTP request will be aborted if the provided context is 3892// canceled. 3893func (c *AboutGetCall) Context(ctx context.Context) *AboutGetCall { 3894 c.ctx_ = ctx 3895 return c 3896} 3897 3898// Header returns an http.Header that can be modified by the caller to 3899// add HTTP headers to the request. 3900func (c *AboutGetCall) Header() http.Header { 3901 if c.header_ == nil { 3902 c.header_ = make(http.Header) 3903 } 3904 return c.header_ 3905} 3906 3907func (c *AboutGetCall) doRequest(alt string) (*http.Response, error) { 3908 reqHeaders := make(http.Header) 3909 for k, v := range c.header_ { 3910 reqHeaders[k] = v 3911 } 3912 reqHeaders.Set("User-Agent", c.s.userAgent()) 3913 if c.ifNoneMatch_ != "" { 3914 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 3915 } 3916 var body io.Reader = nil 3917 c.urlParams_.Set("alt", alt) 3918 c.urlParams_.Set("prettyPrint", "false") 3919 urls := googleapi.ResolveRelative(c.s.BasePath, "about") 3920 urls += "?" + c.urlParams_.Encode() 3921 req, err := http.NewRequest("GET", urls, body) 3922 if err != nil { 3923 return nil, err 3924 } 3925 req.Header = reqHeaders 3926 return gensupport.SendRequest(c.ctx_, c.s.client, req) 3927} 3928 3929// Do executes the "drive.about.get" call. 3930// Exactly one of *About or error will be non-nil. Any non-2xx status 3931// code is an error. Response headers are in either 3932// *About.ServerResponse.Header or (if a response was returned at all) 3933// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 3934// check whether the returned error was because http.StatusNotModified 3935// was returned. 3936func (c *AboutGetCall) Do(opts ...googleapi.CallOption) (*About, error) { 3937 gensupport.SetOptions(c.urlParams_, opts...) 3938 res, err := c.doRequest("json") 3939 if res != nil && res.StatusCode == http.StatusNotModified { 3940 if res.Body != nil { 3941 res.Body.Close() 3942 } 3943 return nil, &googleapi.Error{ 3944 Code: res.StatusCode, 3945 Header: res.Header, 3946 } 3947 } 3948 if err != nil { 3949 return nil, err 3950 } 3951 defer googleapi.CloseBody(res) 3952 if err := googleapi.CheckResponse(res); err != nil { 3953 return nil, err 3954 } 3955 ret := &About{ 3956 ServerResponse: googleapi.ServerResponse{ 3957 Header: res.Header, 3958 HTTPStatusCode: res.StatusCode, 3959 }, 3960 } 3961 target := &ret 3962 if err := gensupport.DecodeResponse(target, res); err != nil { 3963 return nil, err 3964 } 3965 return ret, nil 3966 // { 3967 // "description": "Gets the information about the current user along with Drive API settings", 3968 // "httpMethod": "GET", 3969 // "id": "drive.about.get", 3970 // "parameters": { 3971 // "includeSubscribed": { 3972 // "default": "true", 3973 // "description": "Whether to count changes outside the My Drive hierarchy. When set to false, changes to files such as those in the Application Data folder or shared files which have not been added to My Drive will be omitted from the maxChangeIdCount.", 3974 // "location": "query", 3975 // "type": "boolean" 3976 // }, 3977 // "maxChangeIdCount": { 3978 // "default": "1", 3979 // "description": "Maximum number of remaining change IDs to count", 3980 // "format": "int64", 3981 // "location": "query", 3982 // "type": "string" 3983 // }, 3984 // "startChangeId": { 3985 // "description": "Change ID to start counting from when calculating number of remaining change IDs", 3986 // "format": "int64", 3987 // "location": "query", 3988 // "type": "string" 3989 // } 3990 // }, 3991 // "path": "about", 3992 // "response": { 3993 // "$ref": "About" 3994 // }, 3995 // "scopes": [ 3996 // "https://www.googleapis.com/auth/drive", 3997 // "https://www.googleapis.com/auth/drive.appdata", 3998 // "https://www.googleapis.com/auth/drive.file", 3999 // "https://www.googleapis.com/auth/drive.metadata", 4000 // "https://www.googleapis.com/auth/drive.metadata.readonly", 4001 // "https://www.googleapis.com/auth/drive.photos.readonly", 4002 // "https://www.googleapis.com/auth/drive.readonly" 4003 // ] 4004 // } 4005 4006} 4007 4008// method id "drive.apps.get": 4009 4010type AppsGetCall struct { 4011 s *Service 4012 appId string 4013 urlParams_ gensupport.URLParams 4014 ifNoneMatch_ string 4015 ctx_ context.Context 4016 header_ http.Header 4017} 4018 4019// Get: Gets a specific app. 4020func (r *AppsService) Get(appId string) *AppsGetCall { 4021 c := &AppsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)} 4022 c.appId = appId 4023 return c 4024} 4025 4026// Fields allows partial responses to be retrieved. See 4027// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 4028// for more information. 4029func (c *AppsGetCall) Fields(s ...googleapi.Field) *AppsGetCall { 4030 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 4031 return c 4032} 4033 4034// IfNoneMatch sets the optional parameter which makes the operation 4035// fail if the object's ETag matches the given value. This is useful for 4036// getting updates only after the object has changed since the last 4037// request. Use googleapi.IsNotModified to check whether the response 4038// error from Do is the result of In-None-Match. 4039func (c *AppsGetCall) IfNoneMatch(entityTag string) *AppsGetCall { 4040 c.ifNoneMatch_ = entityTag 4041 return c 4042} 4043 4044// Context sets the context to be used in this call's Do method. Any 4045// pending HTTP request will be aborted if the provided context is 4046// canceled. 4047func (c *AppsGetCall) Context(ctx context.Context) *AppsGetCall { 4048 c.ctx_ = ctx 4049 return c 4050} 4051 4052// Header returns an http.Header that can be modified by the caller to 4053// add HTTP headers to the request. 4054func (c *AppsGetCall) Header() http.Header { 4055 if c.header_ == nil { 4056 c.header_ = make(http.Header) 4057 } 4058 return c.header_ 4059} 4060 4061func (c *AppsGetCall) doRequest(alt string) (*http.Response, error) { 4062 reqHeaders := make(http.Header) 4063 for k, v := range c.header_ { 4064 reqHeaders[k] = v 4065 } 4066 reqHeaders.Set("User-Agent", c.s.userAgent()) 4067 if c.ifNoneMatch_ != "" { 4068 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 4069 } 4070 var body io.Reader = nil 4071 c.urlParams_.Set("alt", alt) 4072 c.urlParams_.Set("prettyPrint", "false") 4073 urls := googleapi.ResolveRelative(c.s.BasePath, "apps/{appId}") 4074 urls += "?" + c.urlParams_.Encode() 4075 req, err := http.NewRequest("GET", urls, body) 4076 if err != nil { 4077 return nil, err 4078 } 4079 req.Header = reqHeaders 4080 googleapi.Expand(req.URL, map[string]string{ 4081 "appId": c.appId, 4082 }) 4083 return gensupport.SendRequest(c.ctx_, c.s.client, req) 4084} 4085 4086// Do executes the "drive.apps.get" call. 4087// Exactly one of *App or error will be non-nil. Any non-2xx status code 4088// is an error. Response headers are in either 4089// *App.ServerResponse.Header or (if a response was returned at all) in 4090// error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check 4091// whether the returned error was because http.StatusNotModified was 4092// returned. 4093func (c *AppsGetCall) Do(opts ...googleapi.CallOption) (*App, error) { 4094 gensupport.SetOptions(c.urlParams_, opts...) 4095 res, err := c.doRequest("json") 4096 if res != nil && res.StatusCode == http.StatusNotModified { 4097 if res.Body != nil { 4098 res.Body.Close() 4099 } 4100 return nil, &googleapi.Error{ 4101 Code: res.StatusCode, 4102 Header: res.Header, 4103 } 4104 } 4105 if err != nil { 4106 return nil, err 4107 } 4108 defer googleapi.CloseBody(res) 4109 if err := googleapi.CheckResponse(res); err != nil { 4110 return nil, err 4111 } 4112 ret := &App{ 4113 ServerResponse: googleapi.ServerResponse{ 4114 Header: res.Header, 4115 HTTPStatusCode: res.StatusCode, 4116 }, 4117 } 4118 target := &ret 4119 if err := gensupport.DecodeResponse(target, res); err != nil { 4120 return nil, err 4121 } 4122 return ret, nil 4123 // { 4124 // "description": "Gets a specific app.", 4125 // "httpMethod": "GET", 4126 // "id": "drive.apps.get", 4127 // "parameterOrder": [ 4128 // "appId" 4129 // ], 4130 // "parameters": { 4131 // "appId": { 4132 // "description": "The ID of the app.", 4133 // "location": "path", 4134 // "required": true, 4135 // "type": "string" 4136 // } 4137 // }, 4138 // "path": "apps/{appId}", 4139 // "response": { 4140 // "$ref": "App" 4141 // }, 4142 // "scopes": [ 4143 // "https://www.googleapis.com/auth/drive", 4144 // "https://www.googleapis.com/auth/drive.appdata", 4145 // "https://www.googleapis.com/auth/drive.apps.readonly", 4146 // "https://www.googleapis.com/auth/drive.file", 4147 // "https://www.googleapis.com/auth/drive.metadata", 4148 // "https://www.googleapis.com/auth/drive.metadata.readonly", 4149 // "https://www.googleapis.com/auth/drive.readonly" 4150 // ] 4151 // } 4152 4153} 4154 4155// method id "drive.apps.list": 4156 4157type AppsListCall struct { 4158 s *Service 4159 urlParams_ gensupport.URLParams 4160 ifNoneMatch_ string 4161 ctx_ context.Context 4162 header_ http.Header 4163} 4164 4165// List: Lists a user's installed apps. 4166func (r *AppsService) List() *AppsListCall { 4167 c := &AppsListCall{s: r.s, urlParams_: make(gensupport.URLParams)} 4168 return c 4169} 4170 4171// AppFilterExtensions sets the optional parameter 4172// "appFilterExtensions": A comma-separated list of file extensions for 4173// open with filtering. All apps within the given app query scope which 4174// can open any of the given file extensions will be included in the 4175// response. If appFilterMimeTypes are provided as well, the result is a 4176// union of the two resulting app lists. 4177func (c *AppsListCall) AppFilterExtensions(appFilterExtensions string) *AppsListCall { 4178 c.urlParams_.Set("appFilterExtensions", appFilterExtensions) 4179 return c 4180} 4181 4182// AppFilterMimeTypes sets the optional parameter "appFilterMimeTypes": 4183// A comma-separated list of MIME types for open with filtering. All 4184// apps within the given app query scope which can open any of the given 4185// MIME types will be included in the response. If appFilterExtensions 4186// are provided as well, the result is a union of the two resulting app 4187// lists. 4188func (c *AppsListCall) AppFilterMimeTypes(appFilterMimeTypes string) *AppsListCall { 4189 c.urlParams_.Set("appFilterMimeTypes", appFilterMimeTypes) 4190 return c 4191} 4192 4193// LanguageCode sets the optional parameter "languageCode": A language 4194// or locale code, as defined by BCP 47, with some extensions from 4195// Unicode's LDML format (http://www.unicode.org/reports/tr35/). 4196func (c *AppsListCall) LanguageCode(languageCode string) *AppsListCall { 4197 c.urlParams_.Set("languageCode", languageCode) 4198 return c 4199} 4200 4201// Fields allows partial responses to be retrieved. See 4202// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 4203// for more information. 4204func (c *AppsListCall) Fields(s ...googleapi.Field) *AppsListCall { 4205 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 4206 return c 4207} 4208 4209// IfNoneMatch sets the optional parameter which makes the operation 4210// fail if the object's ETag matches the given value. This is useful for 4211// getting updates only after the object has changed since the last 4212// request. Use googleapi.IsNotModified to check whether the response 4213// error from Do is the result of In-None-Match. 4214func (c *AppsListCall) IfNoneMatch(entityTag string) *AppsListCall { 4215 c.ifNoneMatch_ = entityTag 4216 return c 4217} 4218 4219// Context sets the context to be used in this call's Do method. Any 4220// pending HTTP request will be aborted if the provided context is 4221// canceled. 4222func (c *AppsListCall) Context(ctx context.Context) *AppsListCall { 4223 c.ctx_ = ctx 4224 return c 4225} 4226 4227// Header returns an http.Header that can be modified by the caller to 4228// add HTTP headers to the request. 4229func (c *AppsListCall) Header() http.Header { 4230 if c.header_ == nil { 4231 c.header_ = make(http.Header) 4232 } 4233 return c.header_ 4234} 4235 4236func (c *AppsListCall) doRequest(alt string) (*http.Response, error) { 4237 reqHeaders := make(http.Header) 4238 for k, v := range c.header_ { 4239 reqHeaders[k] = v 4240 } 4241 reqHeaders.Set("User-Agent", c.s.userAgent()) 4242 if c.ifNoneMatch_ != "" { 4243 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 4244 } 4245 var body io.Reader = nil 4246 c.urlParams_.Set("alt", alt) 4247 c.urlParams_.Set("prettyPrint", "false") 4248 urls := googleapi.ResolveRelative(c.s.BasePath, "apps") 4249 urls += "?" + c.urlParams_.Encode() 4250 req, err := http.NewRequest("GET", urls, body) 4251 if err != nil { 4252 return nil, err 4253 } 4254 req.Header = reqHeaders 4255 return gensupport.SendRequest(c.ctx_, c.s.client, req) 4256} 4257 4258// Do executes the "drive.apps.list" call. 4259// Exactly one of *AppList or error will be non-nil. Any non-2xx status 4260// code is an error. Response headers are in either 4261// *AppList.ServerResponse.Header or (if a response was returned at all) 4262// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 4263// check whether the returned error was because http.StatusNotModified 4264// was returned. 4265func (c *AppsListCall) Do(opts ...googleapi.CallOption) (*AppList, error) { 4266 gensupport.SetOptions(c.urlParams_, opts...) 4267 res, err := c.doRequest("json") 4268 if res != nil && res.StatusCode == http.StatusNotModified { 4269 if res.Body != nil { 4270 res.Body.Close() 4271 } 4272 return nil, &googleapi.Error{ 4273 Code: res.StatusCode, 4274 Header: res.Header, 4275 } 4276 } 4277 if err != nil { 4278 return nil, err 4279 } 4280 defer googleapi.CloseBody(res) 4281 if err := googleapi.CheckResponse(res); err != nil { 4282 return nil, err 4283 } 4284 ret := &AppList{ 4285 ServerResponse: googleapi.ServerResponse{ 4286 Header: res.Header, 4287 HTTPStatusCode: res.StatusCode, 4288 }, 4289 } 4290 target := &ret 4291 if err := gensupport.DecodeResponse(target, res); err != nil { 4292 return nil, err 4293 } 4294 return ret, nil 4295 // { 4296 // "description": "Lists a user's installed apps.", 4297 // "httpMethod": "GET", 4298 // "id": "drive.apps.list", 4299 // "parameters": { 4300 // "appFilterExtensions": { 4301 // "default": "", 4302 // "description": "A comma-separated list of file extensions for open with filtering. All apps within the given app query scope which can open any of the given file extensions will be included in the response. If appFilterMimeTypes are provided as well, the result is a union of the two resulting app lists.", 4303 // "location": "query", 4304 // "type": "string" 4305 // }, 4306 // "appFilterMimeTypes": { 4307 // "default": "", 4308 // "description": "A comma-separated list of MIME types for open with filtering. All apps within the given app query scope which can open any of the given MIME types will be included in the response. If appFilterExtensions are provided as well, the result is a union of the two resulting app lists.", 4309 // "location": "query", 4310 // "type": "string" 4311 // }, 4312 // "languageCode": { 4313 // "description": "A language or locale code, as defined by BCP 47, with some extensions from Unicode's LDML format (http://www.unicode.org/reports/tr35/).", 4314 // "location": "query", 4315 // "type": "string" 4316 // } 4317 // }, 4318 // "path": "apps", 4319 // "response": { 4320 // "$ref": "AppList" 4321 // }, 4322 // "scopes": [ 4323 // "https://www.googleapis.com/auth/drive.apps.readonly" 4324 // ] 4325 // } 4326 4327} 4328 4329// method id "drive.changes.get": 4330 4331type ChangesGetCall struct { 4332 s *Service 4333 changeId string 4334 urlParams_ gensupport.URLParams 4335 ifNoneMatch_ string 4336 ctx_ context.Context 4337 header_ http.Header 4338} 4339 4340// Get: Deprecated - Use changes.getStartPageToken and changes.list to 4341// retrieve recent changes. 4342func (r *ChangesService) Get(changeId string) *ChangesGetCall { 4343 c := &ChangesGetCall{s: r.s, urlParams_: make(gensupport.URLParams)} 4344 c.changeId = changeId 4345 return c 4346} 4347 4348// DriveId sets the optional parameter "driveId": The shared drive from 4349// which the change will be returned. 4350func (c *ChangesGetCall) DriveId(driveId string) *ChangesGetCall { 4351 c.urlParams_.Set("driveId", driveId) 4352 return c 4353} 4354 4355// SupportsAllDrives sets the optional parameter "supportsAllDrives": 4356// Deprecated - Whether the requesting application supports both My 4357// Drives and shared drives. This parameter will only be effective until 4358// June 1, 2020. Afterwards all applications are assumed to support 4359// shared drives. 4360func (c *ChangesGetCall) SupportsAllDrives(supportsAllDrives bool) *ChangesGetCall { 4361 c.urlParams_.Set("supportsAllDrives", fmt.Sprint(supportsAllDrives)) 4362 return c 4363} 4364 4365// SupportsTeamDrives sets the optional parameter "supportsTeamDrives": 4366// Deprecated use supportsAllDrives instead. 4367func (c *ChangesGetCall) SupportsTeamDrives(supportsTeamDrives bool) *ChangesGetCall { 4368 c.urlParams_.Set("supportsTeamDrives", fmt.Sprint(supportsTeamDrives)) 4369 return c 4370} 4371 4372// TeamDriveId sets the optional parameter "teamDriveId": Deprecated use 4373// driveId instead. 4374func (c *ChangesGetCall) TeamDriveId(teamDriveId string) *ChangesGetCall { 4375 c.urlParams_.Set("teamDriveId", teamDriveId) 4376 return c 4377} 4378 4379// Fields allows partial responses to be retrieved. See 4380// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 4381// for more information. 4382func (c *ChangesGetCall) Fields(s ...googleapi.Field) *ChangesGetCall { 4383 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 4384 return c 4385} 4386 4387// IfNoneMatch sets the optional parameter which makes the operation 4388// fail if the object's ETag matches the given value. This is useful for 4389// getting updates only after the object has changed since the last 4390// request. Use googleapi.IsNotModified to check whether the response 4391// error from Do is the result of In-None-Match. 4392func (c *ChangesGetCall) IfNoneMatch(entityTag string) *ChangesGetCall { 4393 c.ifNoneMatch_ = entityTag 4394 return c 4395} 4396 4397// Context sets the context to be used in this call's Do method. Any 4398// pending HTTP request will be aborted if the provided context is 4399// canceled. 4400func (c *ChangesGetCall) Context(ctx context.Context) *ChangesGetCall { 4401 c.ctx_ = ctx 4402 return c 4403} 4404 4405// Header returns an http.Header that can be modified by the caller to 4406// add HTTP headers to the request. 4407func (c *ChangesGetCall) Header() http.Header { 4408 if c.header_ == nil { 4409 c.header_ = make(http.Header) 4410 } 4411 return c.header_ 4412} 4413 4414func (c *ChangesGetCall) doRequest(alt string) (*http.Response, error) { 4415 reqHeaders := make(http.Header) 4416 for k, v := range c.header_ { 4417 reqHeaders[k] = v 4418 } 4419 reqHeaders.Set("User-Agent", c.s.userAgent()) 4420 if c.ifNoneMatch_ != "" { 4421 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 4422 } 4423 var body io.Reader = nil 4424 c.urlParams_.Set("alt", alt) 4425 c.urlParams_.Set("prettyPrint", "false") 4426 urls := googleapi.ResolveRelative(c.s.BasePath, "changes/{changeId}") 4427 urls += "?" + c.urlParams_.Encode() 4428 req, err := http.NewRequest("GET", urls, body) 4429 if err != nil { 4430 return nil, err 4431 } 4432 req.Header = reqHeaders 4433 googleapi.Expand(req.URL, map[string]string{ 4434 "changeId": c.changeId, 4435 }) 4436 return gensupport.SendRequest(c.ctx_, c.s.client, req) 4437} 4438 4439// Do executes the "drive.changes.get" call. 4440// Exactly one of *Change or error will be non-nil. Any non-2xx status 4441// code is an error. Response headers are in either 4442// *Change.ServerResponse.Header or (if a response was returned at all) 4443// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 4444// check whether the returned error was because http.StatusNotModified 4445// was returned. 4446func (c *ChangesGetCall) Do(opts ...googleapi.CallOption) (*Change, error) { 4447 gensupport.SetOptions(c.urlParams_, opts...) 4448 res, err := c.doRequest("json") 4449 if res != nil && res.StatusCode == http.StatusNotModified { 4450 if res.Body != nil { 4451 res.Body.Close() 4452 } 4453 return nil, &googleapi.Error{ 4454 Code: res.StatusCode, 4455 Header: res.Header, 4456 } 4457 } 4458 if err != nil { 4459 return nil, err 4460 } 4461 defer googleapi.CloseBody(res) 4462 if err := googleapi.CheckResponse(res); err != nil { 4463 return nil, err 4464 } 4465 ret := &Change{ 4466 ServerResponse: googleapi.ServerResponse{ 4467 Header: res.Header, 4468 HTTPStatusCode: res.StatusCode, 4469 }, 4470 } 4471 target := &ret 4472 if err := gensupport.DecodeResponse(target, res); err != nil { 4473 return nil, err 4474 } 4475 return ret, nil 4476 // { 4477 // "description": "Deprecated - Use changes.getStartPageToken and changes.list to retrieve recent changes.", 4478 // "httpMethod": "GET", 4479 // "id": "drive.changes.get", 4480 // "parameterOrder": [ 4481 // "changeId" 4482 // ], 4483 // "parameters": { 4484 // "changeId": { 4485 // "description": "The ID of the change.", 4486 // "location": "path", 4487 // "required": true, 4488 // "type": "string" 4489 // }, 4490 // "driveId": { 4491 // "description": "The shared drive from which the change will be returned.", 4492 // "location": "query", 4493 // "type": "string" 4494 // }, 4495 // "supportsAllDrives": { 4496 // "default": "false", 4497 // "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.", 4498 // "location": "query", 4499 // "type": "boolean" 4500 // }, 4501 // "supportsTeamDrives": { 4502 // "default": "false", 4503 // "description": "Deprecated use supportsAllDrives instead.", 4504 // "location": "query", 4505 // "type": "boolean" 4506 // }, 4507 // "teamDriveId": { 4508 // "description": "Deprecated use driveId instead.", 4509 // "location": "query", 4510 // "type": "string" 4511 // } 4512 // }, 4513 // "path": "changes/{changeId}", 4514 // "response": { 4515 // "$ref": "Change" 4516 // }, 4517 // "scopes": [ 4518 // "https://www.googleapis.com/auth/drive", 4519 // "https://www.googleapis.com/auth/drive.appdata", 4520 // "https://www.googleapis.com/auth/drive.apps.readonly", 4521 // "https://www.googleapis.com/auth/drive.file", 4522 // "https://www.googleapis.com/auth/drive.metadata", 4523 // "https://www.googleapis.com/auth/drive.metadata.readonly", 4524 // "https://www.googleapis.com/auth/drive.photos.readonly", 4525 // "https://www.googleapis.com/auth/drive.readonly" 4526 // ] 4527 // } 4528 4529} 4530 4531// method id "drive.changes.getStartPageToken": 4532 4533type ChangesGetStartPageTokenCall struct { 4534 s *Service 4535 urlParams_ gensupport.URLParams 4536 ifNoneMatch_ string 4537 ctx_ context.Context 4538 header_ http.Header 4539} 4540 4541// GetStartPageToken: Gets the starting pageToken for listing future 4542// changes. 4543func (r *ChangesService) GetStartPageToken() *ChangesGetStartPageTokenCall { 4544 c := &ChangesGetStartPageTokenCall{s: r.s, urlParams_: make(gensupport.URLParams)} 4545 return c 4546} 4547 4548// DriveId sets the optional parameter "driveId": The ID of the shared 4549// drive for which the starting pageToken for listing future changes 4550// from that shared drive will be returned. 4551func (c *ChangesGetStartPageTokenCall) DriveId(driveId string) *ChangesGetStartPageTokenCall { 4552 c.urlParams_.Set("driveId", driveId) 4553 return c 4554} 4555 4556// SupportsAllDrives sets the optional parameter "supportsAllDrives": 4557// Deprecated - Whether the requesting application supports both My 4558// Drives and shared drives. This parameter will only be effective until 4559// June 1, 2020. Afterwards all applications are assumed to support 4560// shared drives. 4561func (c *ChangesGetStartPageTokenCall) SupportsAllDrives(supportsAllDrives bool) *ChangesGetStartPageTokenCall { 4562 c.urlParams_.Set("supportsAllDrives", fmt.Sprint(supportsAllDrives)) 4563 return c 4564} 4565 4566// SupportsTeamDrives sets the optional parameter "supportsTeamDrives": 4567// Deprecated use supportsAllDrives instead. 4568func (c *ChangesGetStartPageTokenCall) SupportsTeamDrives(supportsTeamDrives bool) *ChangesGetStartPageTokenCall { 4569 c.urlParams_.Set("supportsTeamDrives", fmt.Sprint(supportsTeamDrives)) 4570 return c 4571} 4572 4573// TeamDriveId sets the optional parameter "teamDriveId": Deprecated use 4574// driveId instead. 4575func (c *ChangesGetStartPageTokenCall) TeamDriveId(teamDriveId string) *ChangesGetStartPageTokenCall { 4576 c.urlParams_.Set("teamDriveId", teamDriveId) 4577 return c 4578} 4579 4580// Fields allows partial responses to be retrieved. See 4581// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 4582// for more information. 4583func (c *ChangesGetStartPageTokenCall) Fields(s ...googleapi.Field) *ChangesGetStartPageTokenCall { 4584 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 4585 return c 4586} 4587 4588// IfNoneMatch sets the optional parameter which makes the operation 4589// fail if the object's ETag matches the given value. This is useful for 4590// getting updates only after the object has changed since the last 4591// request. Use googleapi.IsNotModified to check whether the response 4592// error from Do is the result of In-None-Match. 4593func (c *ChangesGetStartPageTokenCall) IfNoneMatch(entityTag string) *ChangesGetStartPageTokenCall { 4594 c.ifNoneMatch_ = entityTag 4595 return c 4596} 4597 4598// Context sets the context to be used in this call's Do method. Any 4599// pending HTTP request will be aborted if the provided context is 4600// canceled. 4601func (c *ChangesGetStartPageTokenCall) Context(ctx context.Context) *ChangesGetStartPageTokenCall { 4602 c.ctx_ = ctx 4603 return c 4604} 4605 4606// Header returns an http.Header that can be modified by the caller to 4607// add HTTP headers to the request. 4608func (c *ChangesGetStartPageTokenCall) Header() http.Header { 4609 if c.header_ == nil { 4610 c.header_ = make(http.Header) 4611 } 4612 return c.header_ 4613} 4614 4615func (c *ChangesGetStartPageTokenCall) doRequest(alt string) (*http.Response, error) { 4616 reqHeaders := make(http.Header) 4617 for k, v := range c.header_ { 4618 reqHeaders[k] = v 4619 } 4620 reqHeaders.Set("User-Agent", c.s.userAgent()) 4621 if c.ifNoneMatch_ != "" { 4622 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 4623 } 4624 var body io.Reader = nil 4625 c.urlParams_.Set("alt", alt) 4626 c.urlParams_.Set("prettyPrint", "false") 4627 urls := googleapi.ResolveRelative(c.s.BasePath, "changes/startPageToken") 4628 urls += "?" + c.urlParams_.Encode() 4629 req, err := http.NewRequest("GET", urls, body) 4630 if err != nil { 4631 return nil, err 4632 } 4633 req.Header = reqHeaders 4634 return gensupport.SendRequest(c.ctx_, c.s.client, req) 4635} 4636 4637// Do executes the "drive.changes.getStartPageToken" call. 4638// Exactly one of *StartPageToken or error will be non-nil. Any non-2xx 4639// status code is an error. Response headers are in either 4640// *StartPageToken.ServerResponse.Header or (if a response was returned 4641// at all) in error.(*googleapi.Error).Header. Use 4642// googleapi.IsNotModified to check whether the returned error was 4643// because http.StatusNotModified was returned. 4644func (c *ChangesGetStartPageTokenCall) Do(opts ...googleapi.CallOption) (*StartPageToken, error) { 4645 gensupport.SetOptions(c.urlParams_, opts...) 4646 res, err := c.doRequest("json") 4647 if res != nil && res.StatusCode == http.StatusNotModified { 4648 if res.Body != nil { 4649 res.Body.Close() 4650 } 4651 return nil, &googleapi.Error{ 4652 Code: res.StatusCode, 4653 Header: res.Header, 4654 } 4655 } 4656 if err != nil { 4657 return nil, err 4658 } 4659 defer googleapi.CloseBody(res) 4660 if err := googleapi.CheckResponse(res); err != nil { 4661 return nil, err 4662 } 4663 ret := &StartPageToken{ 4664 ServerResponse: googleapi.ServerResponse{ 4665 Header: res.Header, 4666 HTTPStatusCode: res.StatusCode, 4667 }, 4668 } 4669 target := &ret 4670 if err := gensupport.DecodeResponse(target, res); err != nil { 4671 return nil, err 4672 } 4673 return ret, nil 4674 // { 4675 // "description": "Gets the starting pageToken for listing future changes.", 4676 // "httpMethod": "GET", 4677 // "id": "drive.changes.getStartPageToken", 4678 // "parameters": { 4679 // "driveId": { 4680 // "description": "The ID of the shared drive for which the starting pageToken for listing future changes from that shared drive will be returned.", 4681 // "location": "query", 4682 // "type": "string" 4683 // }, 4684 // "supportsAllDrives": { 4685 // "default": "false", 4686 // "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.", 4687 // "location": "query", 4688 // "type": "boolean" 4689 // }, 4690 // "supportsTeamDrives": { 4691 // "default": "false", 4692 // "description": "Deprecated use supportsAllDrives instead.", 4693 // "location": "query", 4694 // "type": "boolean" 4695 // }, 4696 // "teamDriveId": { 4697 // "description": "Deprecated use driveId instead.", 4698 // "location": "query", 4699 // "type": "string" 4700 // } 4701 // }, 4702 // "path": "changes/startPageToken", 4703 // "response": { 4704 // "$ref": "StartPageToken" 4705 // }, 4706 // "scopes": [ 4707 // "https://www.googleapis.com/auth/drive", 4708 // "https://www.googleapis.com/auth/drive.appdata", 4709 // "https://www.googleapis.com/auth/drive.apps.readonly", 4710 // "https://www.googleapis.com/auth/drive.file", 4711 // "https://www.googleapis.com/auth/drive.metadata", 4712 // "https://www.googleapis.com/auth/drive.metadata.readonly", 4713 // "https://www.googleapis.com/auth/drive.photos.readonly", 4714 // "https://www.googleapis.com/auth/drive.readonly" 4715 // ] 4716 // } 4717 4718} 4719 4720// method id "drive.changes.list": 4721 4722type ChangesListCall struct { 4723 s *Service 4724 urlParams_ gensupport.URLParams 4725 ifNoneMatch_ string 4726 ctx_ context.Context 4727 header_ http.Header 4728} 4729 4730// List: Lists the changes for a user or shared drive. 4731func (r *ChangesService) List() *ChangesListCall { 4732 c := &ChangesListCall{s: r.s, urlParams_: make(gensupport.URLParams)} 4733 return c 4734} 4735 4736// DriveId sets the optional parameter "driveId": The shared drive from 4737// which changes will be returned. If specified the change IDs will be 4738// reflective of the shared drive; use the combined drive ID and change 4739// ID as an identifier. 4740func (c *ChangesListCall) DriveId(driveId string) *ChangesListCall { 4741 c.urlParams_.Set("driveId", driveId) 4742 return c 4743} 4744 4745// IncludeCorpusRemovals sets the optional parameter 4746// "includeCorpusRemovals": Whether changes should include the file 4747// resource if the file is still accessible by the user at the time of 4748// the request, even when a file was removed from the list of changes 4749// and there will be no further change entries for this file. 4750func (c *ChangesListCall) IncludeCorpusRemovals(includeCorpusRemovals bool) *ChangesListCall { 4751 c.urlParams_.Set("includeCorpusRemovals", fmt.Sprint(includeCorpusRemovals)) 4752 return c 4753} 4754 4755// IncludeDeleted sets the optional parameter "includeDeleted": Whether 4756// to include changes indicating that items have been removed from the 4757// list of changes, for example by deletion or loss of access. 4758func (c *ChangesListCall) IncludeDeleted(includeDeleted bool) *ChangesListCall { 4759 c.urlParams_.Set("includeDeleted", fmt.Sprint(includeDeleted)) 4760 return c 4761} 4762 4763// IncludeItemsFromAllDrives sets the optional parameter 4764// "includeItemsFromAllDrives": Deprecated - Whether both My Drive and 4765// shared drive items should be included in results. This parameter will 4766// only be effective until June 1, 2020. Afterwards shared drive items 4767// will be included in the results. 4768func (c *ChangesListCall) IncludeItemsFromAllDrives(includeItemsFromAllDrives bool) *ChangesListCall { 4769 c.urlParams_.Set("includeItemsFromAllDrives", fmt.Sprint(includeItemsFromAllDrives)) 4770 return c 4771} 4772 4773// IncludeSubscribed sets the optional parameter "includeSubscribed": 4774// Whether to include changes outside the My Drive hierarchy in the 4775// result. When set to false, changes to files such as those in the 4776// Application Data folder or shared files which have not been added to 4777// My Drive will be omitted from the result. 4778func (c *ChangesListCall) IncludeSubscribed(includeSubscribed bool) *ChangesListCall { 4779 c.urlParams_.Set("includeSubscribed", fmt.Sprint(includeSubscribed)) 4780 return c 4781} 4782 4783// IncludeTeamDriveItems sets the optional parameter 4784// "includeTeamDriveItems": Deprecated use includeItemsFromAllDrives 4785// instead. 4786func (c *ChangesListCall) IncludeTeamDriveItems(includeTeamDriveItems bool) *ChangesListCall { 4787 c.urlParams_.Set("includeTeamDriveItems", fmt.Sprint(includeTeamDriveItems)) 4788 return c 4789} 4790 4791// MaxResults sets the optional parameter "maxResults": Maximum number 4792// of changes to return. 4793func (c *ChangesListCall) MaxResults(maxResults int64) *ChangesListCall { 4794 c.urlParams_.Set("maxResults", fmt.Sprint(maxResults)) 4795 return c 4796} 4797 4798// PageToken sets the optional parameter "pageToken": The token for 4799// continuing a previous list request on the next page. This should be 4800// set to the value of 'nextPageToken' from the previous response or to 4801// the response from the getStartPageToken method. 4802func (c *ChangesListCall) PageToken(pageToken string) *ChangesListCall { 4803 c.urlParams_.Set("pageToken", pageToken) 4804 return c 4805} 4806 4807// Spaces sets the optional parameter "spaces": A comma-separated list 4808// of spaces to query. Supported values are 'drive', 'appDataFolder' and 4809// 'photos'. 4810func (c *ChangesListCall) Spaces(spaces string) *ChangesListCall { 4811 c.urlParams_.Set("spaces", spaces) 4812 return c 4813} 4814 4815// StartChangeId sets the optional parameter "startChangeId": Deprecated 4816// - use pageToken instead. 4817func (c *ChangesListCall) StartChangeId(startChangeId int64) *ChangesListCall { 4818 c.urlParams_.Set("startChangeId", fmt.Sprint(startChangeId)) 4819 return c 4820} 4821 4822// SupportsAllDrives sets the optional parameter "supportsAllDrives": 4823// Deprecated - Whether the requesting application supports both My 4824// Drives and shared drives. This parameter will only be effective until 4825// June 1, 2020. Afterwards all applications are assumed to support 4826// shared drives. 4827func (c *ChangesListCall) SupportsAllDrives(supportsAllDrives bool) *ChangesListCall { 4828 c.urlParams_.Set("supportsAllDrives", fmt.Sprint(supportsAllDrives)) 4829 return c 4830} 4831 4832// SupportsTeamDrives sets the optional parameter "supportsTeamDrives": 4833// Deprecated use supportsAllDrives instead. 4834func (c *ChangesListCall) SupportsTeamDrives(supportsTeamDrives bool) *ChangesListCall { 4835 c.urlParams_.Set("supportsTeamDrives", fmt.Sprint(supportsTeamDrives)) 4836 return c 4837} 4838 4839// TeamDriveId sets the optional parameter "teamDriveId": Deprecated use 4840// driveId instead. 4841func (c *ChangesListCall) TeamDriveId(teamDriveId string) *ChangesListCall { 4842 c.urlParams_.Set("teamDriveId", teamDriveId) 4843 return c 4844} 4845 4846// Fields allows partial responses to be retrieved. See 4847// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 4848// for more information. 4849func (c *ChangesListCall) Fields(s ...googleapi.Field) *ChangesListCall { 4850 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 4851 return c 4852} 4853 4854// IfNoneMatch sets the optional parameter which makes the operation 4855// fail if the object's ETag matches the given value. This is useful for 4856// getting updates only after the object has changed since the last 4857// request. Use googleapi.IsNotModified to check whether the response 4858// error from Do is the result of In-None-Match. 4859func (c *ChangesListCall) IfNoneMatch(entityTag string) *ChangesListCall { 4860 c.ifNoneMatch_ = entityTag 4861 return c 4862} 4863 4864// Context sets the context to be used in this call's Do method. Any 4865// pending HTTP request will be aborted if the provided context is 4866// canceled. 4867func (c *ChangesListCall) Context(ctx context.Context) *ChangesListCall { 4868 c.ctx_ = ctx 4869 return c 4870} 4871 4872// Header returns an http.Header that can be modified by the caller to 4873// add HTTP headers to the request. 4874func (c *ChangesListCall) Header() http.Header { 4875 if c.header_ == nil { 4876 c.header_ = make(http.Header) 4877 } 4878 return c.header_ 4879} 4880 4881func (c *ChangesListCall) doRequest(alt string) (*http.Response, error) { 4882 reqHeaders := make(http.Header) 4883 for k, v := range c.header_ { 4884 reqHeaders[k] = v 4885 } 4886 reqHeaders.Set("User-Agent", c.s.userAgent()) 4887 if c.ifNoneMatch_ != "" { 4888 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 4889 } 4890 var body io.Reader = nil 4891 c.urlParams_.Set("alt", alt) 4892 c.urlParams_.Set("prettyPrint", "false") 4893 urls := googleapi.ResolveRelative(c.s.BasePath, "changes") 4894 urls += "?" + c.urlParams_.Encode() 4895 req, err := http.NewRequest("GET", urls, body) 4896 if err != nil { 4897 return nil, err 4898 } 4899 req.Header = reqHeaders 4900 return gensupport.SendRequest(c.ctx_, c.s.client, req) 4901} 4902 4903// Do executes the "drive.changes.list" call. 4904// Exactly one of *ChangeList or error will be non-nil. Any non-2xx 4905// status code is an error. Response headers are in either 4906// *ChangeList.ServerResponse.Header or (if a response was returned at 4907// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 4908// to check whether the returned error was because 4909// http.StatusNotModified was returned. 4910func (c *ChangesListCall) Do(opts ...googleapi.CallOption) (*ChangeList, error) { 4911 gensupport.SetOptions(c.urlParams_, opts...) 4912 res, err := c.doRequest("json") 4913 if res != nil && res.StatusCode == http.StatusNotModified { 4914 if res.Body != nil { 4915 res.Body.Close() 4916 } 4917 return nil, &googleapi.Error{ 4918 Code: res.StatusCode, 4919 Header: res.Header, 4920 } 4921 } 4922 if err != nil { 4923 return nil, err 4924 } 4925 defer googleapi.CloseBody(res) 4926 if err := googleapi.CheckResponse(res); err != nil { 4927 return nil, err 4928 } 4929 ret := &ChangeList{ 4930 ServerResponse: googleapi.ServerResponse{ 4931 Header: res.Header, 4932 HTTPStatusCode: res.StatusCode, 4933 }, 4934 } 4935 target := &ret 4936 if err := gensupport.DecodeResponse(target, res); err != nil { 4937 return nil, err 4938 } 4939 return ret, nil 4940 // { 4941 // "description": "Lists the changes for a user or shared drive.", 4942 // "httpMethod": "GET", 4943 // "id": "drive.changes.list", 4944 // "parameters": { 4945 // "driveId": { 4946 // "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.", 4947 // "location": "query", 4948 // "type": "string" 4949 // }, 4950 // "includeCorpusRemovals": { 4951 // "default": "false", 4952 // "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.", 4953 // "location": "query", 4954 // "type": "boolean" 4955 // }, 4956 // "includeDeleted": { 4957 // "default": "true", 4958 // "description": "Whether to include changes indicating that items have been removed from the list of changes, for example by deletion or loss of access.", 4959 // "location": "query", 4960 // "type": "boolean" 4961 // }, 4962 // "includeItemsFromAllDrives": { 4963 // "default": "false", 4964 // "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.", 4965 // "location": "query", 4966 // "type": "boolean" 4967 // }, 4968 // "includeSubscribed": { 4969 // "default": "true", 4970 // "description": "Whether to include changes outside the My Drive hierarchy in the result. When set to false, changes to files such as those in the Application Data folder or shared files which have not been added to My Drive will be omitted from the result.", 4971 // "location": "query", 4972 // "type": "boolean" 4973 // }, 4974 // "includeTeamDriveItems": { 4975 // "default": "false", 4976 // "description": "Deprecated use includeItemsFromAllDrives instead.", 4977 // "location": "query", 4978 // "type": "boolean" 4979 // }, 4980 // "maxResults": { 4981 // "default": "100", 4982 // "description": "Maximum number of changes to return.", 4983 // "format": "int32", 4984 // "location": "query", 4985 // "minimum": "1", 4986 // "type": "integer" 4987 // }, 4988 // "pageToken": { 4989 // "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.", 4990 // "location": "query", 4991 // "type": "string" 4992 // }, 4993 // "spaces": { 4994 // "description": "A comma-separated list of spaces to query. Supported values are 'drive', 'appDataFolder' and 'photos'.", 4995 // "location": "query", 4996 // "type": "string" 4997 // }, 4998 // "startChangeId": { 4999 // "description": "Deprecated - use pageToken instead.", 5000 // "format": "int64", 5001 // "location": "query", 5002 // "type": "string" 5003 // }, 5004 // "supportsAllDrives": { 5005 // "default": "false", 5006 // "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.", 5007 // "location": "query", 5008 // "type": "boolean" 5009 // }, 5010 // "supportsTeamDrives": { 5011 // "default": "false", 5012 // "description": "Deprecated use supportsAllDrives instead.", 5013 // "location": "query", 5014 // "type": "boolean" 5015 // }, 5016 // "teamDriveId": { 5017 // "description": "Deprecated use driveId instead.", 5018 // "location": "query", 5019 // "type": "string" 5020 // } 5021 // }, 5022 // "path": "changes", 5023 // "response": { 5024 // "$ref": "ChangeList" 5025 // }, 5026 // "scopes": [ 5027 // "https://www.googleapis.com/auth/drive", 5028 // "https://www.googleapis.com/auth/drive.appdata", 5029 // "https://www.googleapis.com/auth/drive.apps.readonly", 5030 // "https://www.googleapis.com/auth/drive.file", 5031 // "https://www.googleapis.com/auth/drive.metadata", 5032 // "https://www.googleapis.com/auth/drive.metadata.readonly", 5033 // "https://www.googleapis.com/auth/drive.photos.readonly", 5034 // "https://www.googleapis.com/auth/drive.readonly" 5035 // ], 5036 // "supportsSubscription": true 5037 // } 5038 5039} 5040 5041// Pages invokes f for each page of results. 5042// A non-nil error returned from f will halt the iteration. 5043// The provided context supersedes any context provided to the Context method. 5044func (c *ChangesListCall) Pages(ctx context.Context, f func(*ChangeList) error) error { 5045 c.ctx_ = ctx 5046 defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point 5047 for { 5048 x, err := c.Do() 5049 if err != nil { 5050 return err 5051 } 5052 if err := f(x); err != nil { 5053 return err 5054 } 5055 if x.NextPageToken == "" { 5056 return nil 5057 } 5058 c.PageToken(x.NextPageToken) 5059 } 5060} 5061 5062// method id "drive.changes.watch": 5063 5064type ChangesWatchCall struct { 5065 s *Service 5066 channel *Channel 5067 urlParams_ gensupport.URLParams 5068 ctx_ context.Context 5069 header_ http.Header 5070} 5071 5072// Watch: Subscribe to changes for a user. 5073func (r *ChangesService) Watch(channel *Channel) *ChangesWatchCall { 5074 c := &ChangesWatchCall{s: r.s, urlParams_: make(gensupport.URLParams)} 5075 c.channel = channel 5076 return c 5077} 5078 5079// DriveId sets the optional parameter "driveId": The shared drive from 5080// which changes will be returned. If specified the change IDs will be 5081// reflective of the shared drive; use the combined drive ID and change 5082// ID as an identifier. 5083func (c *ChangesWatchCall) DriveId(driveId string) *ChangesWatchCall { 5084 c.urlParams_.Set("driveId", driveId) 5085 return c 5086} 5087 5088// IncludeCorpusRemovals sets the optional parameter 5089// "includeCorpusRemovals": Whether changes should include the file 5090// resource if the file is still accessible by the user at the time of 5091// the request, even when a file was removed from the list of changes 5092// and there will be no further change entries for this file. 5093func (c *ChangesWatchCall) IncludeCorpusRemovals(includeCorpusRemovals bool) *ChangesWatchCall { 5094 c.urlParams_.Set("includeCorpusRemovals", fmt.Sprint(includeCorpusRemovals)) 5095 return c 5096} 5097 5098// IncludeDeleted sets the optional parameter "includeDeleted": Whether 5099// to include changes indicating that items have been removed from the 5100// list of changes, for example by deletion or loss of access. 5101func (c *ChangesWatchCall) IncludeDeleted(includeDeleted bool) *ChangesWatchCall { 5102 c.urlParams_.Set("includeDeleted", fmt.Sprint(includeDeleted)) 5103 return c 5104} 5105 5106// IncludeItemsFromAllDrives sets the optional parameter 5107// "includeItemsFromAllDrives": Deprecated - Whether both My Drive and 5108// shared drive items should be included in results. This parameter will 5109// only be effective until June 1, 2020. Afterwards shared drive items 5110// will be included in the results. 5111func (c *ChangesWatchCall) IncludeItemsFromAllDrives(includeItemsFromAllDrives bool) *ChangesWatchCall { 5112 c.urlParams_.Set("includeItemsFromAllDrives", fmt.Sprint(includeItemsFromAllDrives)) 5113 return c 5114} 5115 5116// IncludeSubscribed sets the optional parameter "includeSubscribed": 5117// Whether to include changes outside the My Drive hierarchy in the 5118// result. When set to false, changes to files such as those in the 5119// Application Data folder or shared files which have not been added to 5120// My Drive will be omitted from the result. 5121func (c *ChangesWatchCall) IncludeSubscribed(includeSubscribed bool) *ChangesWatchCall { 5122 c.urlParams_.Set("includeSubscribed", fmt.Sprint(includeSubscribed)) 5123 return c 5124} 5125 5126// IncludeTeamDriveItems sets the optional parameter 5127// "includeTeamDriveItems": Deprecated use includeItemsFromAllDrives 5128// instead. 5129func (c *ChangesWatchCall) IncludeTeamDriveItems(includeTeamDriveItems bool) *ChangesWatchCall { 5130 c.urlParams_.Set("includeTeamDriveItems", fmt.Sprint(includeTeamDriveItems)) 5131 return c 5132} 5133 5134// MaxResults sets the optional parameter "maxResults": Maximum number 5135// of changes to return. 5136func (c *ChangesWatchCall) MaxResults(maxResults int64) *ChangesWatchCall { 5137 c.urlParams_.Set("maxResults", fmt.Sprint(maxResults)) 5138 return c 5139} 5140 5141// PageToken sets the optional parameter "pageToken": The token for 5142// continuing a previous list request on the next page. This should be 5143// set to the value of 'nextPageToken' from the previous response or to 5144// the response from the getStartPageToken method. 5145func (c *ChangesWatchCall) PageToken(pageToken string) *ChangesWatchCall { 5146 c.urlParams_.Set("pageToken", pageToken) 5147 return c 5148} 5149 5150// Spaces sets the optional parameter "spaces": A comma-separated list 5151// of spaces to query. Supported values are 'drive', 'appDataFolder' and 5152// 'photos'. 5153func (c *ChangesWatchCall) Spaces(spaces string) *ChangesWatchCall { 5154 c.urlParams_.Set("spaces", spaces) 5155 return c 5156} 5157 5158// StartChangeId sets the optional parameter "startChangeId": Deprecated 5159// - use pageToken instead. 5160func (c *ChangesWatchCall) StartChangeId(startChangeId int64) *ChangesWatchCall { 5161 c.urlParams_.Set("startChangeId", fmt.Sprint(startChangeId)) 5162 return c 5163} 5164 5165// SupportsAllDrives sets the optional parameter "supportsAllDrives": 5166// Deprecated - Whether the requesting application supports both My 5167// Drives and shared drives. This parameter will only be effective until 5168// June 1, 2020. Afterwards all applications are assumed to support 5169// shared drives. 5170func (c *ChangesWatchCall) SupportsAllDrives(supportsAllDrives bool) *ChangesWatchCall { 5171 c.urlParams_.Set("supportsAllDrives", fmt.Sprint(supportsAllDrives)) 5172 return c 5173} 5174 5175// SupportsTeamDrives sets the optional parameter "supportsTeamDrives": 5176// Deprecated use supportsAllDrives instead. 5177func (c *ChangesWatchCall) SupportsTeamDrives(supportsTeamDrives bool) *ChangesWatchCall { 5178 c.urlParams_.Set("supportsTeamDrives", fmt.Sprint(supportsTeamDrives)) 5179 return c 5180} 5181 5182// TeamDriveId sets the optional parameter "teamDriveId": Deprecated use 5183// driveId instead. 5184func (c *ChangesWatchCall) TeamDriveId(teamDriveId string) *ChangesWatchCall { 5185 c.urlParams_.Set("teamDriveId", teamDriveId) 5186 return c 5187} 5188 5189// Fields allows partial responses to be retrieved. See 5190// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 5191// for more information. 5192func (c *ChangesWatchCall) Fields(s ...googleapi.Field) *ChangesWatchCall { 5193 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 5194 return c 5195} 5196 5197// Context sets the context to be used in this call's Do method. Any 5198// pending HTTP request will be aborted if the provided context is 5199// canceled. 5200func (c *ChangesWatchCall) Context(ctx context.Context) *ChangesWatchCall { 5201 c.ctx_ = ctx 5202 return c 5203} 5204 5205// Header returns an http.Header that can be modified by the caller to 5206// add HTTP headers to the request. 5207func (c *ChangesWatchCall) Header() http.Header { 5208 if c.header_ == nil { 5209 c.header_ = make(http.Header) 5210 } 5211 return c.header_ 5212} 5213 5214func (c *ChangesWatchCall) doRequest(alt string) (*http.Response, error) { 5215 reqHeaders := make(http.Header) 5216 for k, v := range c.header_ { 5217 reqHeaders[k] = v 5218 } 5219 reqHeaders.Set("User-Agent", c.s.userAgent()) 5220 var body io.Reader = nil 5221 body, err := googleapi.WithoutDataWrapper.JSONReader(c.channel) 5222 if err != nil { 5223 return nil, err 5224 } 5225 reqHeaders.Set("Content-Type", "application/json") 5226 c.urlParams_.Set("alt", alt) 5227 c.urlParams_.Set("prettyPrint", "false") 5228 urls := googleapi.ResolveRelative(c.s.BasePath, "changes/watch") 5229 urls += "?" + c.urlParams_.Encode() 5230 req, err := http.NewRequest("POST", urls, body) 5231 if err != nil { 5232 return nil, err 5233 } 5234 req.Header = reqHeaders 5235 return gensupport.SendRequest(c.ctx_, c.s.client, req) 5236} 5237 5238// Do executes the "drive.changes.watch" call. 5239// Exactly one of *Channel or error will be non-nil. Any non-2xx status 5240// code is an error. Response headers are in either 5241// *Channel.ServerResponse.Header or (if a response was returned at all) 5242// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 5243// check whether the returned error was because http.StatusNotModified 5244// was returned. 5245func (c *ChangesWatchCall) Do(opts ...googleapi.CallOption) (*Channel, error) { 5246 gensupport.SetOptions(c.urlParams_, opts...) 5247 res, err := c.doRequest("json") 5248 if res != nil && res.StatusCode == http.StatusNotModified { 5249 if res.Body != nil { 5250 res.Body.Close() 5251 } 5252 return nil, &googleapi.Error{ 5253 Code: res.StatusCode, 5254 Header: res.Header, 5255 } 5256 } 5257 if err != nil { 5258 return nil, err 5259 } 5260 defer googleapi.CloseBody(res) 5261 if err := googleapi.CheckResponse(res); err != nil { 5262 return nil, err 5263 } 5264 ret := &Channel{ 5265 ServerResponse: googleapi.ServerResponse{ 5266 Header: res.Header, 5267 HTTPStatusCode: res.StatusCode, 5268 }, 5269 } 5270 target := &ret 5271 if err := gensupport.DecodeResponse(target, res); err != nil { 5272 return nil, err 5273 } 5274 return ret, nil 5275 // { 5276 // "description": "Subscribe to changes for a user.", 5277 // "httpMethod": "POST", 5278 // "id": "drive.changes.watch", 5279 // "parameters": { 5280 // "driveId": { 5281 // "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.", 5282 // "location": "query", 5283 // "type": "string" 5284 // }, 5285 // "includeCorpusRemovals": { 5286 // "default": "false", 5287 // "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.", 5288 // "location": "query", 5289 // "type": "boolean" 5290 // }, 5291 // "includeDeleted": { 5292 // "default": "true", 5293 // "description": "Whether to include changes indicating that items have been removed from the list of changes, for example by deletion or loss of access.", 5294 // "location": "query", 5295 // "type": "boolean" 5296 // }, 5297 // "includeItemsFromAllDrives": { 5298 // "default": "false", 5299 // "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.", 5300 // "location": "query", 5301 // "type": "boolean" 5302 // }, 5303 // "includeSubscribed": { 5304 // "default": "true", 5305 // "description": "Whether to include changes outside the My Drive hierarchy in the result. When set to false, changes to files such as those in the Application Data folder or shared files which have not been added to My Drive will be omitted from the result.", 5306 // "location": "query", 5307 // "type": "boolean" 5308 // }, 5309 // "includeTeamDriveItems": { 5310 // "default": "false", 5311 // "description": "Deprecated use includeItemsFromAllDrives instead.", 5312 // "location": "query", 5313 // "type": "boolean" 5314 // }, 5315 // "maxResults": { 5316 // "default": "100", 5317 // "description": "Maximum number of changes to return.", 5318 // "format": "int32", 5319 // "location": "query", 5320 // "minimum": "1", 5321 // "type": "integer" 5322 // }, 5323 // "pageToken": { 5324 // "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.", 5325 // "location": "query", 5326 // "type": "string" 5327 // }, 5328 // "spaces": { 5329 // "description": "A comma-separated list of spaces to query. Supported values are 'drive', 'appDataFolder' and 'photos'.", 5330 // "location": "query", 5331 // "type": "string" 5332 // }, 5333 // "startChangeId": { 5334 // "description": "Deprecated - use pageToken instead.", 5335 // "format": "int64", 5336 // "location": "query", 5337 // "type": "string" 5338 // }, 5339 // "supportsAllDrives": { 5340 // "default": "false", 5341 // "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.", 5342 // "location": "query", 5343 // "type": "boolean" 5344 // }, 5345 // "supportsTeamDrives": { 5346 // "default": "false", 5347 // "description": "Deprecated use supportsAllDrives instead.", 5348 // "location": "query", 5349 // "type": "boolean" 5350 // }, 5351 // "teamDriveId": { 5352 // "description": "Deprecated use driveId instead.", 5353 // "location": "query", 5354 // "type": "string" 5355 // } 5356 // }, 5357 // "path": "changes/watch", 5358 // "request": { 5359 // "$ref": "Channel", 5360 // "parameterName": "resource" 5361 // }, 5362 // "response": { 5363 // "$ref": "Channel" 5364 // }, 5365 // "scopes": [ 5366 // "https://www.googleapis.com/auth/drive", 5367 // "https://www.googleapis.com/auth/drive.appdata", 5368 // "https://www.googleapis.com/auth/drive.apps.readonly", 5369 // "https://www.googleapis.com/auth/drive.file", 5370 // "https://www.googleapis.com/auth/drive.metadata", 5371 // "https://www.googleapis.com/auth/drive.metadata.readonly", 5372 // "https://www.googleapis.com/auth/drive.photos.readonly", 5373 // "https://www.googleapis.com/auth/drive.readonly" 5374 // ], 5375 // "supportsSubscription": true 5376 // } 5377 5378} 5379 5380// method id "drive.channels.stop": 5381 5382type ChannelsStopCall struct { 5383 s *Service 5384 channel *Channel 5385 urlParams_ gensupport.URLParams 5386 ctx_ context.Context 5387 header_ http.Header 5388} 5389 5390// Stop: Stop watching resources through this channel 5391func (r *ChannelsService) Stop(channel *Channel) *ChannelsStopCall { 5392 c := &ChannelsStopCall{s: r.s, urlParams_: make(gensupport.URLParams)} 5393 c.channel = channel 5394 return c 5395} 5396 5397// Fields allows partial responses to be retrieved. See 5398// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 5399// for more information. 5400func (c *ChannelsStopCall) Fields(s ...googleapi.Field) *ChannelsStopCall { 5401 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 5402 return c 5403} 5404 5405// Context sets the context to be used in this call's Do method. Any 5406// pending HTTP request will be aborted if the provided context is 5407// canceled. 5408func (c *ChannelsStopCall) Context(ctx context.Context) *ChannelsStopCall { 5409 c.ctx_ = ctx 5410 return c 5411} 5412 5413// Header returns an http.Header that can be modified by the caller to 5414// add HTTP headers to the request. 5415func (c *ChannelsStopCall) Header() http.Header { 5416 if c.header_ == nil { 5417 c.header_ = make(http.Header) 5418 } 5419 return c.header_ 5420} 5421 5422func (c *ChannelsStopCall) doRequest(alt string) (*http.Response, error) { 5423 reqHeaders := make(http.Header) 5424 for k, v := range c.header_ { 5425 reqHeaders[k] = v 5426 } 5427 reqHeaders.Set("User-Agent", c.s.userAgent()) 5428 var body io.Reader = nil 5429 body, err := googleapi.WithoutDataWrapper.JSONReader(c.channel) 5430 if err != nil { 5431 return nil, err 5432 } 5433 reqHeaders.Set("Content-Type", "application/json") 5434 c.urlParams_.Set("alt", alt) 5435 c.urlParams_.Set("prettyPrint", "false") 5436 urls := googleapi.ResolveRelative(c.s.BasePath, "channels/stop") 5437 urls += "?" + c.urlParams_.Encode() 5438 req, err := http.NewRequest("POST", urls, body) 5439 if err != nil { 5440 return nil, err 5441 } 5442 req.Header = reqHeaders 5443 return gensupport.SendRequest(c.ctx_, c.s.client, req) 5444} 5445 5446// Do executes the "drive.channels.stop" call. 5447func (c *ChannelsStopCall) Do(opts ...googleapi.CallOption) error { 5448 gensupport.SetOptions(c.urlParams_, opts...) 5449 res, err := c.doRequest("json") 5450 if err != nil { 5451 return err 5452 } 5453 defer googleapi.CloseBody(res) 5454 if err := googleapi.CheckResponse(res); err != nil { 5455 return err 5456 } 5457 return nil 5458 // { 5459 // "description": "Stop watching resources through this channel", 5460 // "httpMethod": "POST", 5461 // "id": "drive.channels.stop", 5462 // "path": "channels/stop", 5463 // "request": { 5464 // "$ref": "Channel", 5465 // "parameterName": "resource" 5466 // }, 5467 // "scopes": [ 5468 // "https://www.googleapis.com/auth/drive", 5469 // "https://www.googleapis.com/auth/drive.appdata", 5470 // "https://www.googleapis.com/auth/drive.apps.readonly", 5471 // "https://www.googleapis.com/auth/drive.file", 5472 // "https://www.googleapis.com/auth/drive.metadata", 5473 // "https://www.googleapis.com/auth/drive.metadata.readonly", 5474 // "https://www.googleapis.com/auth/drive.photos.readonly", 5475 // "https://www.googleapis.com/auth/drive.readonly" 5476 // ] 5477 // } 5478 5479} 5480 5481// method id "drive.children.delete": 5482 5483type ChildrenDeleteCall struct { 5484 s *Service 5485 folderId string 5486 childId string 5487 urlParams_ gensupport.URLParams 5488 ctx_ context.Context 5489 header_ http.Header 5490} 5491 5492// Delete: Removes a child from a folder. 5493func (r *ChildrenService) Delete(folderId string, childId string) *ChildrenDeleteCall { 5494 c := &ChildrenDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)} 5495 c.folderId = folderId 5496 c.childId = childId 5497 return c 5498} 5499 5500// Fields allows partial responses to be retrieved. See 5501// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 5502// for more information. 5503func (c *ChildrenDeleteCall) Fields(s ...googleapi.Field) *ChildrenDeleteCall { 5504 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 5505 return c 5506} 5507 5508// Context sets the context to be used in this call's Do method. Any 5509// pending HTTP request will be aborted if the provided context is 5510// canceled. 5511func (c *ChildrenDeleteCall) Context(ctx context.Context) *ChildrenDeleteCall { 5512 c.ctx_ = ctx 5513 return c 5514} 5515 5516// Header returns an http.Header that can be modified by the caller to 5517// add HTTP headers to the request. 5518func (c *ChildrenDeleteCall) Header() http.Header { 5519 if c.header_ == nil { 5520 c.header_ = make(http.Header) 5521 } 5522 return c.header_ 5523} 5524 5525func (c *ChildrenDeleteCall) doRequest(alt string) (*http.Response, error) { 5526 reqHeaders := make(http.Header) 5527 for k, v := range c.header_ { 5528 reqHeaders[k] = v 5529 } 5530 reqHeaders.Set("User-Agent", c.s.userAgent()) 5531 var body io.Reader = nil 5532 c.urlParams_.Set("alt", alt) 5533 c.urlParams_.Set("prettyPrint", "false") 5534 urls := googleapi.ResolveRelative(c.s.BasePath, "files/{folderId}/children/{childId}") 5535 urls += "?" + c.urlParams_.Encode() 5536 req, err := http.NewRequest("DELETE", urls, body) 5537 if err != nil { 5538 return nil, err 5539 } 5540 req.Header = reqHeaders 5541 googleapi.Expand(req.URL, map[string]string{ 5542 "folderId": c.folderId, 5543 "childId": c.childId, 5544 }) 5545 return gensupport.SendRequest(c.ctx_, c.s.client, req) 5546} 5547 5548// Do executes the "drive.children.delete" call. 5549func (c *ChildrenDeleteCall) Do(opts ...googleapi.CallOption) error { 5550 gensupport.SetOptions(c.urlParams_, opts...) 5551 res, err := c.doRequest("json") 5552 if err != nil { 5553 return err 5554 } 5555 defer googleapi.CloseBody(res) 5556 if err := googleapi.CheckResponse(res); err != nil { 5557 return err 5558 } 5559 return nil 5560 // { 5561 // "description": "Removes a child from a folder.", 5562 // "httpMethod": "DELETE", 5563 // "id": "drive.children.delete", 5564 // "parameterOrder": [ 5565 // "folderId", 5566 // "childId" 5567 // ], 5568 // "parameters": { 5569 // "childId": { 5570 // "description": "The ID of the child.", 5571 // "location": "path", 5572 // "required": true, 5573 // "type": "string" 5574 // }, 5575 // "folderId": { 5576 // "description": "The ID of the folder.", 5577 // "location": "path", 5578 // "required": true, 5579 // "type": "string" 5580 // } 5581 // }, 5582 // "path": "files/{folderId}/children/{childId}", 5583 // "scopes": [ 5584 // "https://www.googleapis.com/auth/drive", 5585 // "https://www.googleapis.com/auth/drive.file" 5586 // ] 5587 // } 5588 5589} 5590 5591// method id "drive.children.get": 5592 5593type ChildrenGetCall struct { 5594 s *Service 5595 folderId string 5596 childId string 5597 urlParams_ gensupport.URLParams 5598 ifNoneMatch_ string 5599 ctx_ context.Context 5600 header_ http.Header 5601} 5602 5603// Get: Gets a specific child reference. 5604func (r *ChildrenService) Get(folderId string, childId string) *ChildrenGetCall { 5605 c := &ChildrenGetCall{s: r.s, urlParams_: make(gensupport.URLParams)} 5606 c.folderId = folderId 5607 c.childId = childId 5608 return c 5609} 5610 5611// Fields allows partial responses to be retrieved. See 5612// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 5613// for more information. 5614func (c *ChildrenGetCall) Fields(s ...googleapi.Field) *ChildrenGetCall { 5615 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 5616 return c 5617} 5618 5619// IfNoneMatch sets the optional parameter which makes the operation 5620// fail if the object's ETag matches the given value. This is useful for 5621// getting updates only after the object has changed since the last 5622// request. Use googleapi.IsNotModified to check whether the response 5623// error from Do is the result of In-None-Match. 5624func (c *ChildrenGetCall) IfNoneMatch(entityTag string) *ChildrenGetCall { 5625 c.ifNoneMatch_ = entityTag 5626 return c 5627} 5628 5629// Context sets the context to be used in this call's Do method. Any 5630// pending HTTP request will be aborted if the provided context is 5631// canceled. 5632func (c *ChildrenGetCall) Context(ctx context.Context) *ChildrenGetCall { 5633 c.ctx_ = ctx 5634 return c 5635} 5636 5637// Header returns an http.Header that can be modified by the caller to 5638// add HTTP headers to the request. 5639func (c *ChildrenGetCall) Header() http.Header { 5640 if c.header_ == nil { 5641 c.header_ = make(http.Header) 5642 } 5643 return c.header_ 5644} 5645 5646func (c *ChildrenGetCall) doRequest(alt string) (*http.Response, error) { 5647 reqHeaders := make(http.Header) 5648 for k, v := range c.header_ { 5649 reqHeaders[k] = v 5650 } 5651 reqHeaders.Set("User-Agent", c.s.userAgent()) 5652 if c.ifNoneMatch_ != "" { 5653 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 5654 } 5655 var body io.Reader = nil 5656 c.urlParams_.Set("alt", alt) 5657 c.urlParams_.Set("prettyPrint", "false") 5658 urls := googleapi.ResolveRelative(c.s.BasePath, "files/{folderId}/children/{childId}") 5659 urls += "?" + c.urlParams_.Encode() 5660 req, err := http.NewRequest("GET", urls, body) 5661 if err != nil { 5662 return nil, err 5663 } 5664 req.Header = reqHeaders 5665 googleapi.Expand(req.URL, map[string]string{ 5666 "folderId": c.folderId, 5667 "childId": c.childId, 5668 }) 5669 return gensupport.SendRequest(c.ctx_, c.s.client, req) 5670} 5671 5672// Do executes the "drive.children.get" call. 5673// Exactly one of *ChildReference or error will be non-nil. Any non-2xx 5674// status code is an error. Response headers are in either 5675// *ChildReference.ServerResponse.Header or (if a response was returned 5676// at all) in error.(*googleapi.Error).Header. Use 5677// googleapi.IsNotModified to check whether the returned error was 5678// because http.StatusNotModified was returned. 5679func (c *ChildrenGetCall) Do(opts ...googleapi.CallOption) (*ChildReference, error) { 5680 gensupport.SetOptions(c.urlParams_, opts...) 5681 res, err := c.doRequest("json") 5682 if res != nil && res.StatusCode == http.StatusNotModified { 5683 if res.Body != nil { 5684 res.Body.Close() 5685 } 5686 return nil, &googleapi.Error{ 5687 Code: res.StatusCode, 5688 Header: res.Header, 5689 } 5690 } 5691 if err != nil { 5692 return nil, err 5693 } 5694 defer googleapi.CloseBody(res) 5695 if err := googleapi.CheckResponse(res); err != nil { 5696 return nil, err 5697 } 5698 ret := &ChildReference{ 5699 ServerResponse: googleapi.ServerResponse{ 5700 Header: res.Header, 5701 HTTPStatusCode: res.StatusCode, 5702 }, 5703 } 5704 target := &ret 5705 if err := gensupport.DecodeResponse(target, res); err != nil { 5706 return nil, err 5707 } 5708 return ret, nil 5709 // { 5710 // "description": "Gets a specific child reference.", 5711 // "httpMethod": "GET", 5712 // "id": "drive.children.get", 5713 // "parameterOrder": [ 5714 // "folderId", 5715 // "childId" 5716 // ], 5717 // "parameters": { 5718 // "childId": { 5719 // "description": "The ID of the child.", 5720 // "location": "path", 5721 // "required": true, 5722 // "type": "string" 5723 // }, 5724 // "folderId": { 5725 // "description": "The ID of the folder.", 5726 // "location": "path", 5727 // "required": true, 5728 // "type": "string" 5729 // } 5730 // }, 5731 // "path": "files/{folderId}/children/{childId}", 5732 // "response": { 5733 // "$ref": "ChildReference" 5734 // }, 5735 // "scopes": [ 5736 // "https://www.googleapis.com/auth/drive", 5737 // "https://www.googleapis.com/auth/drive.appdata", 5738 // "https://www.googleapis.com/auth/drive.file", 5739 // "https://www.googleapis.com/auth/drive.metadata", 5740 // "https://www.googleapis.com/auth/drive.metadata.readonly", 5741 // "https://www.googleapis.com/auth/drive.photos.readonly", 5742 // "https://www.googleapis.com/auth/drive.readonly" 5743 // ] 5744 // } 5745 5746} 5747 5748// method id "drive.children.insert": 5749 5750type ChildrenInsertCall struct { 5751 s *Service 5752 folderId string 5753 childreference *ChildReference 5754 urlParams_ gensupport.URLParams 5755 ctx_ context.Context 5756 header_ http.Header 5757} 5758 5759// Insert: Inserts a file into a folder. 5760func (r *ChildrenService) Insert(folderId string, childreference *ChildReference) *ChildrenInsertCall { 5761 c := &ChildrenInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)} 5762 c.folderId = folderId 5763 c.childreference = childreference 5764 return c 5765} 5766 5767// SupportsAllDrives sets the optional parameter "supportsAllDrives": 5768// Deprecated - Whether the requesting application supports both My 5769// Drives and shared drives. This parameter will only be effective until 5770// June 1, 2020. Afterwards all applications are assumed to support 5771// shared drives. 5772func (c *ChildrenInsertCall) SupportsAllDrives(supportsAllDrives bool) *ChildrenInsertCall { 5773 c.urlParams_.Set("supportsAllDrives", fmt.Sprint(supportsAllDrives)) 5774 return c 5775} 5776 5777// SupportsTeamDrives sets the optional parameter "supportsTeamDrives": 5778// Deprecated use supportsAllDrives instead. 5779func (c *ChildrenInsertCall) SupportsTeamDrives(supportsTeamDrives bool) *ChildrenInsertCall { 5780 c.urlParams_.Set("supportsTeamDrives", fmt.Sprint(supportsTeamDrives)) 5781 return c 5782} 5783 5784// Fields allows partial responses to be retrieved. See 5785// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 5786// for more information. 5787func (c *ChildrenInsertCall) Fields(s ...googleapi.Field) *ChildrenInsertCall { 5788 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 5789 return c 5790} 5791 5792// Context sets the context to be used in this call's Do method. Any 5793// pending HTTP request will be aborted if the provided context is 5794// canceled. 5795func (c *ChildrenInsertCall) Context(ctx context.Context) *ChildrenInsertCall { 5796 c.ctx_ = ctx 5797 return c 5798} 5799 5800// Header returns an http.Header that can be modified by the caller to 5801// add HTTP headers to the request. 5802func (c *ChildrenInsertCall) Header() http.Header { 5803 if c.header_ == nil { 5804 c.header_ = make(http.Header) 5805 } 5806 return c.header_ 5807} 5808 5809func (c *ChildrenInsertCall) doRequest(alt string) (*http.Response, error) { 5810 reqHeaders := make(http.Header) 5811 for k, v := range c.header_ { 5812 reqHeaders[k] = v 5813 } 5814 reqHeaders.Set("User-Agent", c.s.userAgent()) 5815 var body io.Reader = nil 5816 body, err := googleapi.WithoutDataWrapper.JSONReader(c.childreference) 5817 if err != nil { 5818 return nil, err 5819 } 5820 reqHeaders.Set("Content-Type", "application/json") 5821 c.urlParams_.Set("alt", alt) 5822 c.urlParams_.Set("prettyPrint", "false") 5823 urls := googleapi.ResolveRelative(c.s.BasePath, "files/{folderId}/children") 5824 urls += "?" + c.urlParams_.Encode() 5825 req, err := http.NewRequest("POST", urls, body) 5826 if err != nil { 5827 return nil, err 5828 } 5829 req.Header = reqHeaders 5830 googleapi.Expand(req.URL, map[string]string{ 5831 "folderId": c.folderId, 5832 }) 5833 return gensupport.SendRequest(c.ctx_, c.s.client, req) 5834} 5835 5836// Do executes the "drive.children.insert" call. 5837// Exactly one of *ChildReference or error will be non-nil. Any non-2xx 5838// status code is an error. Response headers are in either 5839// *ChildReference.ServerResponse.Header or (if a response was returned 5840// at all) in error.(*googleapi.Error).Header. Use 5841// googleapi.IsNotModified to check whether the returned error was 5842// because http.StatusNotModified was returned. 5843func (c *ChildrenInsertCall) Do(opts ...googleapi.CallOption) (*ChildReference, error) { 5844 gensupport.SetOptions(c.urlParams_, opts...) 5845 res, err := c.doRequest("json") 5846 if res != nil && res.StatusCode == http.StatusNotModified { 5847 if res.Body != nil { 5848 res.Body.Close() 5849 } 5850 return nil, &googleapi.Error{ 5851 Code: res.StatusCode, 5852 Header: res.Header, 5853 } 5854 } 5855 if err != nil { 5856 return nil, err 5857 } 5858 defer googleapi.CloseBody(res) 5859 if err := googleapi.CheckResponse(res); err != nil { 5860 return nil, err 5861 } 5862 ret := &ChildReference{ 5863 ServerResponse: googleapi.ServerResponse{ 5864 Header: res.Header, 5865 HTTPStatusCode: res.StatusCode, 5866 }, 5867 } 5868 target := &ret 5869 if err := gensupport.DecodeResponse(target, res); err != nil { 5870 return nil, err 5871 } 5872 return ret, nil 5873 // { 5874 // "description": "Inserts a file into a folder.", 5875 // "httpMethod": "POST", 5876 // "id": "drive.children.insert", 5877 // "parameterOrder": [ 5878 // "folderId" 5879 // ], 5880 // "parameters": { 5881 // "folderId": { 5882 // "description": "The ID of the folder.", 5883 // "location": "path", 5884 // "required": true, 5885 // "type": "string" 5886 // }, 5887 // "supportsAllDrives": { 5888 // "default": "false", 5889 // "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.", 5890 // "location": "query", 5891 // "type": "boolean" 5892 // }, 5893 // "supportsTeamDrives": { 5894 // "default": "false", 5895 // "description": "Deprecated use supportsAllDrives instead.", 5896 // "location": "query", 5897 // "type": "boolean" 5898 // } 5899 // }, 5900 // "path": "files/{folderId}/children", 5901 // "request": { 5902 // "$ref": "ChildReference" 5903 // }, 5904 // "response": { 5905 // "$ref": "ChildReference" 5906 // }, 5907 // "scopes": [ 5908 // "https://www.googleapis.com/auth/drive", 5909 // "https://www.googleapis.com/auth/drive.appdata", 5910 // "https://www.googleapis.com/auth/drive.file" 5911 // ] 5912 // } 5913 5914} 5915 5916// method id "drive.children.list": 5917 5918type ChildrenListCall struct { 5919 s *Service 5920 folderId string 5921 urlParams_ gensupport.URLParams 5922 ifNoneMatch_ string 5923 ctx_ context.Context 5924 header_ http.Header 5925} 5926 5927// List: Lists a folder's children. 5928func (r *ChildrenService) List(folderId string) *ChildrenListCall { 5929 c := &ChildrenListCall{s: r.s, urlParams_: make(gensupport.URLParams)} 5930 c.folderId = folderId 5931 return c 5932} 5933 5934// MaxResults sets the optional parameter "maxResults": Maximum number 5935// of children to return. 5936func (c *ChildrenListCall) MaxResults(maxResults int64) *ChildrenListCall { 5937 c.urlParams_.Set("maxResults", fmt.Sprint(maxResults)) 5938 return c 5939} 5940 5941// OrderBy sets the optional parameter "orderBy": A comma-separated list 5942// of sort keys. Valid keys are 'createdDate', 'folder', 5943// 'lastViewedByMeDate', 'modifiedByMeDate', 'modifiedDate', 5944// 'quotaBytesUsed', 'recency', 'sharedWithMeDate', 'starred', and 5945// 'title'. Each key sorts ascending by default, but may be reversed 5946// with the 'desc' modifier. Example usage: ?orderBy=folder,modifiedDate 5947// desc,title. Please note that there is a current limitation for users 5948// with approximately one million files in which the requested sort 5949// order is ignored. 5950func (c *ChildrenListCall) OrderBy(orderBy string) *ChildrenListCall { 5951 c.urlParams_.Set("orderBy", orderBy) 5952 return c 5953} 5954 5955// PageToken sets the optional parameter "pageToken": Page token for 5956// children. 5957func (c *ChildrenListCall) PageToken(pageToken string) *ChildrenListCall { 5958 c.urlParams_.Set("pageToken", pageToken) 5959 return c 5960} 5961 5962// Q sets the optional parameter "q": Query string for searching 5963// children. 5964func (c *ChildrenListCall) Q(q string) *ChildrenListCall { 5965 c.urlParams_.Set("q", q) 5966 return c 5967} 5968 5969// Fields allows partial responses to be retrieved. See 5970// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 5971// for more information. 5972func (c *ChildrenListCall) Fields(s ...googleapi.Field) *ChildrenListCall { 5973 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 5974 return c 5975} 5976 5977// IfNoneMatch sets the optional parameter which makes the operation 5978// fail if the object's ETag matches the given value. This is useful for 5979// getting updates only after the object has changed since the last 5980// request. Use googleapi.IsNotModified to check whether the response 5981// error from Do is the result of In-None-Match. 5982func (c *ChildrenListCall) IfNoneMatch(entityTag string) *ChildrenListCall { 5983 c.ifNoneMatch_ = entityTag 5984 return c 5985} 5986 5987// Context sets the context to be used in this call's Do method. Any 5988// pending HTTP request will be aborted if the provided context is 5989// canceled. 5990func (c *ChildrenListCall) Context(ctx context.Context) *ChildrenListCall { 5991 c.ctx_ = ctx 5992 return c 5993} 5994 5995// Header returns an http.Header that can be modified by the caller to 5996// add HTTP headers to the request. 5997func (c *ChildrenListCall) Header() http.Header { 5998 if c.header_ == nil { 5999 c.header_ = make(http.Header) 6000 } 6001 return c.header_ 6002} 6003 6004func (c *ChildrenListCall) doRequest(alt string) (*http.Response, error) { 6005 reqHeaders := make(http.Header) 6006 for k, v := range c.header_ { 6007 reqHeaders[k] = v 6008 } 6009 reqHeaders.Set("User-Agent", c.s.userAgent()) 6010 if c.ifNoneMatch_ != "" { 6011 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 6012 } 6013 var body io.Reader = nil 6014 c.urlParams_.Set("alt", alt) 6015 c.urlParams_.Set("prettyPrint", "false") 6016 urls := googleapi.ResolveRelative(c.s.BasePath, "files/{folderId}/children") 6017 urls += "?" + c.urlParams_.Encode() 6018 req, err := http.NewRequest("GET", urls, body) 6019 if err != nil { 6020 return nil, err 6021 } 6022 req.Header = reqHeaders 6023 googleapi.Expand(req.URL, map[string]string{ 6024 "folderId": c.folderId, 6025 }) 6026 return gensupport.SendRequest(c.ctx_, c.s.client, req) 6027} 6028 6029// Do executes the "drive.children.list" call. 6030// Exactly one of *ChildList or error will be non-nil. Any non-2xx 6031// status code is an error. Response headers are in either 6032// *ChildList.ServerResponse.Header or (if a response was returned at 6033// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 6034// to check whether the returned error was because 6035// http.StatusNotModified was returned. 6036func (c *ChildrenListCall) Do(opts ...googleapi.CallOption) (*ChildList, error) { 6037 gensupport.SetOptions(c.urlParams_, opts...) 6038 res, err := c.doRequest("json") 6039 if res != nil && res.StatusCode == http.StatusNotModified { 6040 if res.Body != nil { 6041 res.Body.Close() 6042 } 6043 return nil, &googleapi.Error{ 6044 Code: res.StatusCode, 6045 Header: res.Header, 6046 } 6047 } 6048 if err != nil { 6049 return nil, err 6050 } 6051 defer googleapi.CloseBody(res) 6052 if err := googleapi.CheckResponse(res); err != nil { 6053 return nil, err 6054 } 6055 ret := &ChildList{ 6056 ServerResponse: googleapi.ServerResponse{ 6057 Header: res.Header, 6058 HTTPStatusCode: res.StatusCode, 6059 }, 6060 } 6061 target := &ret 6062 if err := gensupport.DecodeResponse(target, res); err != nil { 6063 return nil, err 6064 } 6065 return ret, nil 6066 // { 6067 // "description": "Lists a folder's children.", 6068 // "httpMethod": "GET", 6069 // "id": "drive.children.list", 6070 // "parameterOrder": [ 6071 // "folderId" 6072 // ], 6073 // "parameters": { 6074 // "folderId": { 6075 // "description": "The ID of the folder.", 6076 // "location": "path", 6077 // "required": true, 6078 // "type": "string" 6079 // }, 6080 // "maxResults": { 6081 // "default": "100", 6082 // "description": "Maximum number of children to return.", 6083 // "format": "int32", 6084 // "location": "query", 6085 // "minimum": "0", 6086 // "type": "integer" 6087 // }, 6088 // "orderBy": { 6089 // "description": "A comma-separated list of sort keys. Valid keys are 'createdDate', 'folder', 'lastViewedByMeDate', 'modifiedByMeDate', 'modifiedDate', 'quotaBytesUsed', 'recency', 'sharedWithMeDate', 'starred', and 'title'. Each key sorts ascending by default, but may be reversed with the 'desc' modifier. Example usage: ?orderBy=folder,modifiedDate desc,title. Please note that there is a current limitation for users with approximately one million files in which the requested sort order is ignored.", 6090 // "location": "query", 6091 // "type": "string" 6092 // }, 6093 // "pageToken": { 6094 // "description": "Page token for children.", 6095 // "location": "query", 6096 // "type": "string" 6097 // }, 6098 // "q": { 6099 // "description": "Query string for searching children.", 6100 // "location": "query", 6101 // "type": "string" 6102 // } 6103 // }, 6104 // "path": "files/{folderId}/children", 6105 // "response": { 6106 // "$ref": "ChildList" 6107 // }, 6108 // "scopes": [ 6109 // "https://www.googleapis.com/auth/drive", 6110 // "https://www.googleapis.com/auth/drive.appdata", 6111 // "https://www.googleapis.com/auth/drive.file", 6112 // "https://www.googleapis.com/auth/drive.metadata", 6113 // "https://www.googleapis.com/auth/drive.metadata.readonly", 6114 // "https://www.googleapis.com/auth/drive.photos.readonly", 6115 // "https://www.googleapis.com/auth/drive.readonly" 6116 // ] 6117 // } 6118 6119} 6120 6121// Pages invokes f for each page of results. 6122// A non-nil error returned from f will halt the iteration. 6123// The provided context supersedes any context provided to the Context method. 6124func (c *ChildrenListCall) Pages(ctx context.Context, f func(*ChildList) error) error { 6125 c.ctx_ = ctx 6126 defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point 6127 for { 6128 x, err := c.Do() 6129 if err != nil { 6130 return err 6131 } 6132 if err := f(x); err != nil { 6133 return err 6134 } 6135 if x.NextPageToken == "" { 6136 return nil 6137 } 6138 c.PageToken(x.NextPageToken) 6139 } 6140} 6141 6142// method id "drive.comments.delete": 6143 6144type CommentsDeleteCall struct { 6145 s *Service 6146 fileId string 6147 commentId string 6148 urlParams_ gensupport.URLParams 6149 ctx_ context.Context 6150 header_ http.Header 6151} 6152 6153// Delete: Deletes a comment. 6154func (r *CommentsService) Delete(fileId string, commentId string) *CommentsDeleteCall { 6155 c := &CommentsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)} 6156 c.fileId = fileId 6157 c.commentId = commentId 6158 return c 6159} 6160 6161// Fields allows partial responses to be retrieved. See 6162// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 6163// for more information. 6164func (c *CommentsDeleteCall) Fields(s ...googleapi.Field) *CommentsDeleteCall { 6165 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 6166 return c 6167} 6168 6169// Context sets the context to be used in this call's Do method. Any 6170// pending HTTP request will be aborted if the provided context is 6171// canceled. 6172func (c *CommentsDeleteCall) Context(ctx context.Context) *CommentsDeleteCall { 6173 c.ctx_ = ctx 6174 return c 6175} 6176 6177// Header returns an http.Header that can be modified by the caller to 6178// add HTTP headers to the request. 6179func (c *CommentsDeleteCall) Header() http.Header { 6180 if c.header_ == nil { 6181 c.header_ = make(http.Header) 6182 } 6183 return c.header_ 6184} 6185 6186func (c *CommentsDeleteCall) doRequest(alt string) (*http.Response, error) { 6187 reqHeaders := make(http.Header) 6188 for k, v := range c.header_ { 6189 reqHeaders[k] = v 6190 } 6191 reqHeaders.Set("User-Agent", c.s.userAgent()) 6192 var body io.Reader = nil 6193 c.urlParams_.Set("alt", alt) 6194 c.urlParams_.Set("prettyPrint", "false") 6195 urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/comments/{commentId}") 6196 urls += "?" + c.urlParams_.Encode() 6197 req, err := http.NewRequest("DELETE", urls, body) 6198 if err != nil { 6199 return nil, err 6200 } 6201 req.Header = reqHeaders 6202 googleapi.Expand(req.URL, map[string]string{ 6203 "fileId": c.fileId, 6204 "commentId": c.commentId, 6205 }) 6206 return gensupport.SendRequest(c.ctx_, c.s.client, req) 6207} 6208 6209// Do executes the "drive.comments.delete" call. 6210func (c *CommentsDeleteCall) Do(opts ...googleapi.CallOption) error { 6211 gensupport.SetOptions(c.urlParams_, opts...) 6212 res, err := c.doRequest("json") 6213 if err != nil { 6214 return err 6215 } 6216 defer googleapi.CloseBody(res) 6217 if err := googleapi.CheckResponse(res); err != nil { 6218 return err 6219 } 6220 return nil 6221 // { 6222 // "description": "Deletes a comment.", 6223 // "httpMethod": "DELETE", 6224 // "id": "drive.comments.delete", 6225 // "parameterOrder": [ 6226 // "fileId", 6227 // "commentId" 6228 // ], 6229 // "parameters": { 6230 // "commentId": { 6231 // "description": "The ID of the comment.", 6232 // "location": "path", 6233 // "required": true, 6234 // "type": "string" 6235 // }, 6236 // "fileId": { 6237 // "description": "The ID of the file.", 6238 // "location": "path", 6239 // "required": true, 6240 // "type": "string" 6241 // } 6242 // }, 6243 // "path": "files/{fileId}/comments/{commentId}", 6244 // "scopes": [ 6245 // "https://www.googleapis.com/auth/drive", 6246 // "https://www.googleapis.com/auth/drive.file" 6247 // ] 6248 // } 6249 6250} 6251 6252// method id "drive.comments.get": 6253 6254type CommentsGetCall struct { 6255 s *Service 6256 fileId string 6257 commentId string 6258 urlParams_ gensupport.URLParams 6259 ifNoneMatch_ string 6260 ctx_ context.Context 6261 header_ http.Header 6262} 6263 6264// Get: Gets a comment by ID. 6265func (r *CommentsService) Get(fileId string, commentId string) *CommentsGetCall { 6266 c := &CommentsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)} 6267 c.fileId = fileId 6268 c.commentId = commentId 6269 return c 6270} 6271 6272// IncludeDeleted sets the optional parameter "includeDeleted": If set, 6273// this will succeed when retrieving a deleted comment, and will include 6274// any deleted replies. 6275func (c *CommentsGetCall) IncludeDeleted(includeDeleted bool) *CommentsGetCall { 6276 c.urlParams_.Set("includeDeleted", fmt.Sprint(includeDeleted)) 6277 return c 6278} 6279 6280// Fields allows partial responses to be retrieved. See 6281// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 6282// for more information. 6283func (c *CommentsGetCall) Fields(s ...googleapi.Field) *CommentsGetCall { 6284 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 6285 return c 6286} 6287 6288// IfNoneMatch sets the optional parameter which makes the operation 6289// fail if the object's ETag matches the given value. This is useful for 6290// getting updates only after the object has changed since the last 6291// request. Use googleapi.IsNotModified to check whether the response 6292// error from Do is the result of In-None-Match. 6293func (c *CommentsGetCall) IfNoneMatch(entityTag string) *CommentsGetCall { 6294 c.ifNoneMatch_ = entityTag 6295 return c 6296} 6297 6298// Context sets the context to be used in this call's Do method. Any 6299// pending HTTP request will be aborted if the provided context is 6300// canceled. 6301func (c *CommentsGetCall) Context(ctx context.Context) *CommentsGetCall { 6302 c.ctx_ = ctx 6303 return c 6304} 6305 6306// Header returns an http.Header that can be modified by the caller to 6307// add HTTP headers to the request. 6308func (c *CommentsGetCall) Header() http.Header { 6309 if c.header_ == nil { 6310 c.header_ = make(http.Header) 6311 } 6312 return c.header_ 6313} 6314 6315func (c *CommentsGetCall) doRequest(alt string) (*http.Response, error) { 6316 reqHeaders := make(http.Header) 6317 for k, v := range c.header_ { 6318 reqHeaders[k] = v 6319 } 6320 reqHeaders.Set("User-Agent", c.s.userAgent()) 6321 if c.ifNoneMatch_ != "" { 6322 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 6323 } 6324 var body io.Reader = nil 6325 c.urlParams_.Set("alt", alt) 6326 c.urlParams_.Set("prettyPrint", "false") 6327 urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/comments/{commentId}") 6328 urls += "?" + c.urlParams_.Encode() 6329 req, err := http.NewRequest("GET", urls, body) 6330 if err != nil { 6331 return nil, err 6332 } 6333 req.Header = reqHeaders 6334 googleapi.Expand(req.URL, map[string]string{ 6335 "fileId": c.fileId, 6336 "commentId": c.commentId, 6337 }) 6338 return gensupport.SendRequest(c.ctx_, c.s.client, req) 6339} 6340 6341// Do executes the "drive.comments.get" call. 6342// Exactly one of *Comment or error will be non-nil. Any non-2xx status 6343// code is an error. Response headers are in either 6344// *Comment.ServerResponse.Header or (if a response was returned at all) 6345// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 6346// check whether the returned error was because http.StatusNotModified 6347// was returned. 6348func (c *CommentsGetCall) Do(opts ...googleapi.CallOption) (*Comment, error) { 6349 gensupport.SetOptions(c.urlParams_, opts...) 6350 res, err := c.doRequest("json") 6351 if res != nil && res.StatusCode == http.StatusNotModified { 6352 if res.Body != nil { 6353 res.Body.Close() 6354 } 6355 return nil, &googleapi.Error{ 6356 Code: res.StatusCode, 6357 Header: res.Header, 6358 } 6359 } 6360 if err != nil { 6361 return nil, err 6362 } 6363 defer googleapi.CloseBody(res) 6364 if err := googleapi.CheckResponse(res); err != nil { 6365 return nil, err 6366 } 6367 ret := &Comment{ 6368 ServerResponse: googleapi.ServerResponse{ 6369 Header: res.Header, 6370 HTTPStatusCode: res.StatusCode, 6371 }, 6372 } 6373 target := &ret 6374 if err := gensupport.DecodeResponse(target, res); err != nil { 6375 return nil, err 6376 } 6377 return ret, nil 6378 // { 6379 // "description": "Gets a comment by ID.", 6380 // "httpMethod": "GET", 6381 // "id": "drive.comments.get", 6382 // "parameterOrder": [ 6383 // "fileId", 6384 // "commentId" 6385 // ], 6386 // "parameters": { 6387 // "commentId": { 6388 // "description": "The ID of the comment.", 6389 // "location": "path", 6390 // "required": true, 6391 // "type": "string" 6392 // }, 6393 // "fileId": { 6394 // "description": "The ID of the file.", 6395 // "location": "path", 6396 // "required": true, 6397 // "type": "string" 6398 // }, 6399 // "includeDeleted": { 6400 // "default": "false", 6401 // "description": "If set, this will succeed when retrieving a deleted comment, and will include any deleted replies.", 6402 // "location": "query", 6403 // "type": "boolean" 6404 // } 6405 // }, 6406 // "path": "files/{fileId}/comments/{commentId}", 6407 // "response": { 6408 // "$ref": "Comment" 6409 // }, 6410 // "scopes": [ 6411 // "https://www.googleapis.com/auth/drive", 6412 // "https://www.googleapis.com/auth/drive.file", 6413 // "https://www.googleapis.com/auth/drive.readonly" 6414 // ] 6415 // } 6416 6417} 6418 6419// method id "drive.comments.insert": 6420 6421type CommentsInsertCall struct { 6422 s *Service 6423 fileId string 6424 comment *Comment 6425 urlParams_ gensupport.URLParams 6426 ctx_ context.Context 6427 header_ http.Header 6428} 6429 6430// Insert: Creates a new comment on the given file. 6431func (r *CommentsService) Insert(fileId string, comment *Comment) *CommentsInsertCall { 6432 c := &CommentsInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)} 6433 c.fileId = fileId 6434 c.comment = comment 6435 return c 6436} 6437 6438// Fields allows partial responses to be retrieved. See 6439// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 6440// for more information. 6441func (c *CommentsInsertCall) Fields(s ...googleapi.Field) *CommentsInsertCall { 6442 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 6443 return c 6444} 6445 6446// Context sets the context to be used in this call's Do method. Any 6447// pending HTTP request will be aborted if the provided context is 6448// canceled. 6449func (c *CommentsInsertCall) Context(ctx context.Context) *CommentsInsertCall { 6450 c.ctx_ = ctx 6451 return c 6452} 6453 6454// Header returns an http.Header that can be modified by the caller to 6455// add HTTP headers to the request. 6456func (c *CommentsInsertCall) Header() http.Header { 6457 if c.header_ == nil { 6458 c.header_ = make(http.Header) 6459 } 6460 return c.header_ 6461} 6462 6463func (c *CommentsInsertCall) doRequest(alt string) (*http.Response, error) { 6464 reqHeaders := make(http.Header) 6465 for k, v := range c.header_ { 6466 reqHeaders[k] = v 6467 } 6468 reqHeaders.Set("User-Agent", c.s.userAgent()) 6469 var body io.Reader = nil 6470 body, err := googleapi.WithoutDataWrapper.JSONReader(c.comment) 6471 if err != nil { 6472 return nil, err 6473 } 6474 reqHeaders.Set("Content-Type", "application/json") 6475 c.urlParams_.Set("alt", alt) 6476 c.urlParams_.Set("prettyPrint", "false") 6477 urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/comments") 6478 urls += "?" + c.urlParams_.Encode() 6479 req, err := http.NewRequest("POST", urls, body) 6480 if err != nil { 6481 return nil, err 6482 } 6483 req.Header = reqHeaders 6484 googleapi.Expand(req.URL, map[string]string{ 6485 "fileId": c.fileId, 6486 }) 6487 return gensupport.SendRequest(c.ctx_, c.s.client, req) 6488} 6489 6490// Do executes the "drive.comments.insert" call. 6491// Exactly one of *Comment or error will be non-nil. Any non-2xx status 6492// code is an error. Response headers are in either 6493// *Comment.ServerResponse.Header or (if a response was returned at all) 6494// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 6495// check whether the returned error was because http.StatusNotModified 6496// was returned. 6497func (c *CommentsInsertCall) Do(opts ...googleapi.CallOption) (*Comment, error) { 6498 gensupport.SetOptions(c.urlParams_, opts...) 6499 res, err := c.doRequest("json") 6500 if res != nil && res.StatusCode == http.StatusNotModified { 6501 if res.Body != nil { 6502 res.Body.Close() 6503 } 6504 return nil, &googleapi.Error{ 6505 Code: res.StatusCode, 6506 Header: res.Header, 6507 } 6508 } 6509 if err != nil { 6510 return nil, err 6511 } 6512 defer googleapi.CloseBody(res) 6513 if err := googleapi.CheckResponse(res); err != nil { 6514 return nil, err 6515 } 6516 ret := &Comment{ 6517 ServerResponse: googleapi.ServerResponse{ 6518 Header: res.Header, 6519 HTTPStatusCode: res.StatusCode, 6520 }, 6521 } 6522 target := &ret 6523 if err := gensupport.DecodeResponse(target, res); err != nil { 6524 return nil, err 6525 } 6526 return ret, nil 6527 // { 6528 // "description": "Creates a new comment on the given file.", 6529 // "httpMethod": "POST", 6530 // "id": "drive.comments.insert", 6531 // "parameterOrder": [ 6532 // "fileId" 6533 // ], 6534 // "parameters": { 6535 // "fileId": { 6536 // "description": "The ID of the file.", 6537 // "location": "path", 6538 // "required": true, 6539 // "type": "string" 6540 // } 6541 // }, 6542 // "path": "files/{fileId}/comments", 6543 // "request": { 6544 // "$ref": "Comment" 6545 // }, 6546 // "response": { 6547 // "$ref": "Comment" 6548 // }, 6549 // "scopes": [ 6550 // "https://www.googleapis.com/auth/drive", 6551 // "https://www.googleapis.com/auth/drive.file" 6552 // ] 6553 // } 6554 6555} 6556 6557// method id "drive.comments.list": 6558 6559type CommentsListCall struct { 6560 s *Service 6561 fileId string 6562 urlParams_ gensupport.URLParams 6563 ifNoneMatch_ string 6564 ctx_ context.Context 6565 header_ http.Header 6566} 6567 6568// List: Lists a file's comments. 6569func (r *CommentsService) List(fileId string) *CommentsListCall { 6570 c := &CommentsListCall{s: r.s, urlParams_: make(gensupport.URLParams)} 6571 c.fileId = fileId 6572 return c 6573} 6574 6575// IncludeDeleted sets the optional parameter "includeDeleted": If set, 6576// all comments and replies, including deleted comments and replies 6577// (with content stripped) will be returned. 6578func (c *CommentsListCall) IncludeDeleted(includeDeleted bool) *CommentsListCall { 6579 c.urlParams_.Set("includeDeleted", fmt.Sprint(includeDeleted)) 6580 return c 6581} 6582 6583// MaxResults sets the optional parameter "maxResults": The maximum 6584// number of discussions to include in the response, used for paging. 6585func (c *CommentsListCall) MaxResults(maxResults int64) *CommentsListCall { 6586 c.urlParams_.Set("maxResults", fmt.Sprint(maxResults)) 6587 return c 6588} 6589 6590// PageToken sets the optional parameter "pageToken": The continuation 6591// token, used to page through large result sets. To get the next page 6592// of results, set this parameter to the value of "nextPageToken" from 6593// the previous response. 6594func (c *CommentsListCall) PageToken(pageToken string) *CommentsListCall { 6595 c.urlParams_.Set("pageToken", pageToken) 6596 return c 6597} 6598 6599// UpdatedMin sets the optional parameter "updatedMin": Only discussions 6600// that were updated after this timestamp will be returned. Formatted as 6601// an RFC 3339 timestamp. 6602func (c *CommentsListCall) UpdatedMin(updatedMin string) *CommentsListCall { 6603 c.urlParams_.Set("updatedMin", updatedMin) 6604 return c 6605} 6606 6607// Fields allows partial responses to be retrieved. See 6608// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 6609// for more information. 6610func (c *CommentsListCall) Fields(s ...googleapi.Field) *CommentsListCall { 6611 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 6612 return c 6613} 6614 6615// IfNoneMatch sets the optional parameter which makes the operation 6616// fail if the object's ETag matches the given value. This is useful for 6617// getting updates only after the object has changed since the last 6618// request. Use googleapi.IsNotModified to check whether the response 6619// error from Do is the result of In-None-Match. 6620func (c *CommentsListCall) IfNoneMatch(entityTag string) *CommentsListCall { 6621 c.ifNoneMatch_ = entityTag 6622 return c 6623} 6624 6625// Context sets the context to be used in this call's Do method. Any 6626// pending HTTP request will be aborted if the provided context is 6627// canceled. 6628func (c *CommentsListCall) Context(ctx context.Context) *CommentsListCall { 6629 c.ctx_ = ctx 6630 return c 6631} 6632 6633// Header returns an http.Header that can be modified by the caller to 6634// add HTTP headers to the request. 6635func (c *CommentsListCall) Header() http.Header { 6636 if c.header_ == nil { 6637 c.header_ = make(http.Header) 6638 } 6639 return c.header_ 6640} 6641 6642func (c *CommentsListCall) doRequest(alt string) (*http.Response, error) { 6643 reqHeaders := make(http.Header) 6644 for k, v := range c.header_ { 6645 reqHeaders[k] = v 6646 } 6647 reqHeaders.Set("User-Agent", c.s.userAgent()) 6648 if c.ifNoneMatch_ != "" { 6649 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 6650 } 6651 var body io.Reader = nil 6652 c.urlParams_.Set("alt", alt) 6653 c.urlParams_.Set("prettyPrint", "false") 6654 urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/comments") 6655 urls += "?" + c.urlParams_.Encode() 6656 req, err := http.NewRequest("GET", urls, body) 6657 if err != nil { 6658 return nil, err 6659 } 6660 req.Header = reqHeaders 6661 googleapi.Expand(req.URL, map[string]string{ 6662 "fileId": c.fileId, 6663 }) 6664 return gensupport.SendRequest(c.ctx_, c.s.client, req) 6665} 6666 6667// Do executes the "drive.comments.list" call. 6668// Exactly one of *CommentList or error will be non-nil. Any non-2xx 6669// status code is an error. Response headers are in either 6670// *CommentList.ServerResponse.Header or (if a response was returned at 6671// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 6672// to check whether the returned error was because 6673// http.StatusNotModified was returned. 6674func (c *CommentsListCall) Do(opts ...googleapi.CallOption) (*CommentList, error) { 6675 gensupport.SetOptions(c.urlParams_, opts...) 6676 res, err := c.doRequest("json") 6677 if res != nil && res.StatusCode == http.StatusNotModified { 6678 if res.Body != nil { 6679 res.Body.Close() 6680 } 6681 return nil, &googleapi.Error{ 6682 Code: res.StatusCode, 6683 Header: res.Header, 6684 } 6685 } 6686 if err != nil { 6687 return nil, err 6688 } 6689 defer googleapi.CloseBody(res) 6690 if err := googleapi.CheckResponse(res); err != nil { 6691 return nil, err 6692 } 6693 ret := &CommentList{ 6694 ServerResponse: googleapi.ServerResponse{ 6695 Header: res.Header, 6696 HTTPStatusCode: res.StatusCode, 6697 }, 6698 } 6699 target := &ret 6700 if err := gensupport.DecodeResponse(target, res); err != nil { 6701 return nil, err 6702 } 6703 return ret, nil 6704 // { 6705 // "description": "Lists a file's comments.", 6706 // "httpMethod": "GET", 6707 // "id": "drive.comments.list", 6708 // "parameterOrder": [ 6709 // "fileId" 6710 // ], 6711 // "parameters": { 6712 // "fileId": { 6713 // "description": "The ID of the file.", 6714 // "location": "path", 6715 // "required": true, 6716 // "type": "string" 6717 // }, 6718 // "includeDeleted": { 6719 // "default": "false", 6720 // "description": "If set, all comments and replies, including deleted comments and replies (with content stripped) will be returned.", 6721 // "location": "query", 6722 // "type": "boolean" 6723 // }, 6724 // "maxResults": { 6725 // "default": "20", 6726 // "description": "The maximum number of discussions to include in the response, used for paging.", 6727 // "format": "int32", 6728 // "location": "query", 6729 // "maximum": "100", 6730 // "minimum": "0", 6731 // "type": "integer" 6732 // }, 6733 // "pageToken": { 6734 // "description": "The continuation token, used to page through large result sets. To get the next page of results, set this parameter to the value of \"nextPageToken\" from the previous response.", 6735 // "location": "query", 6736 // "type": "string" 6737 // }, 6738 // "updatedMin": { 6739 // "description": "Only discussions that were updated after this timestamp will be returned. Formatted as an RFC 3339 timestamp.", 6740 // "location": "query", 6741 // "type": "string" 6742 // } 6743 // }, 6744 // "path": "files/{fileId}/comments", 6745 // "response": { 6746 // "$ref": "CommentList" 6747 // }, 6748 // "scopes": [ 6749 // "https://www.googleapis.com/auth/drive", 6750 // "https://www.googleapis.com/auth/drive.file", 6751 // "https://www.googleapis.com/auth/drive.readonly" 6752 // ] 6753 // } 6754 6755} 6756 6757// Pages invokes f for each page of results. 6758// A non-nil error returned from f will halt the iteration. 6759// The provided context supersedes any context provided to the Context method. 6760func (c *CommentsListCall) Pages(ctx context.Context, f func(*CommentList) error) error { 6761 c.ctx_ = ctx 6762 defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point 6763 for { 6764 x, err := c.Do() 6765 if err != nil { 6766 return err 6767 } 6768 if err := f(x); err != nil { 6769 return err 6770 } 6771 if x.NextPageToken == "" { 6772 return nil 6773 } 6774 c.PageToken(x.NextPageToken) 6775 } 6776} 6777 6778// method id "drive.comments.patch": 6779 6780type CommentsPatchCall struct { 6781 s *Service 6782 fileId string 6783 commentId string 6784 comment *Comment 6785 urlParams_ gensupport.URLParams 6786 ctx_ context.Context 6787 header_ http.Header 6788} 6789 6790// Patch: Updates an existing comment. This method supports patch 6791// semantics. 6792func (r *CommentsService) Patch(fileId string, commentId string, comment *Comment) *CommentsPatchCall { 6793 c := &CommentsPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)} 6794 c.fileId = fileId 6795 c.commentId = commentId 6796 c.comment = comment 6797 return c 6798} 6799 6800// Fields allows partial responses to be retrieved. See 6801// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 6802// for more information. 6803func (c *CommentsPatchCall) Fields(s ...googleapi.Field) *CommentsPatchCall { 6804 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 6805 return c 6806} 6807 6808// Context sets the context to be used in this call's Do method. Any 6809// pending HTTP request will be aborted if the provided context is 6810// canceled. 6811func (c *CommentsPatchCall) Context(ctx context.Context) *CommentsPatchCall { 6812 c.ctx_ = ctx 6813 return c 6814} 6815 6816// Header returns an http.Header that can be modified by the caller to 6817// add HTTP headers to the request. 6818func (c *CommentsPatchCall) Header() http.Header { 6819 if c.header_ == nil { 6820 c.header_ = make(http.Header) 6821 } 6822 return c.header_ 6823} 6824 6825func (c *CommentsPatchCall) doRequest(alt string) (*http.Response, error) { 6826 reqHeaders := make(http.Header) 6827 for k, v := range c.header_ { 6828 reqHeaders[k] = v 6829 } 6830 reqHeaders.Set("User-Agent", c.s.userAgent()) 6831 var body io.Reader = nil 6832 body, err := googleapi.WithoutDataWrapper.JSONReader(c.comment) 6833 if err != nil { 6834 return nil, err 6835 } 6836 reqHeaders.Set("Content-Type", "application/json") 6837 c.urlParams_.Set("alt", alt) 6838 c.urlParams_.Set("prettyPrint", "false") 6839 urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/comments/{commentId}") 6840 urls += "?" + c.urlParams_.Encode() 6841 req, err := http.NewRequest("PATCH", urls, body) 6842 if err != nil { 6843 return nil, err 6844 } 6845 req.Header = reqHeaders 6846 googleapi.Expand(req.URL, map[string]string{ 6847 "fileId": c.fileId, 6848 "commentId": c.commentId, 6849 }) 6850 return gensupport.SendRequest(c.ctx_, c.s.client, req) 6851} 6852 6853// Do executes the "drive.comments.patch" call. 6854// Exactly one of *Comment or error will be non-nil. Any non-2xx status 6855// code is an error. Response headers are in either 6856// *Comment.ServerResponse.Header or (if a response was returned at all) 6857// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 6858// check whether the returned error was because http.StatusNotModified 6859// was returned. 6860func (c *CommentsPatchCall) Do(opts ...googleapi.CallOption) (*Comment, error) { 6861 gensupport.SetOptions(c.urlParams_, opts...) 6862 res, err := c.doRequest("json") 6863 if res != nil && res.StatusCode == http.StatusNotModified { 6864 if res.Body != nil { 6865 res.Body.Close() 6866 } 6867 return nil, &googleapi.Error{ 6868 Code: res.StatusCode, 6869 Header: res.Header, 6870 } 6871 } 6872 if err != nil { 6873 return nil, err 6874 } 6875 defer googleapi.CloseBody(res) 6876 if err := googleapi.CheckResponse(res); err != nil { 6877 return nil, err 6878 } 6879 ret := &Comment{ 6880 ServerResponse: googleapi.ServerResponse{ 6881 Header: res.Header, 6882 HTTPStatusCode: res.StatusCode, 6883 }, 6884 } 6885 target := &ret 6886 if err := gensupport.DecodeResponse(target, res); err != nil { 6887 return nil, err 6888 } 6889 return ret, nil 6890 // { 6891 // "description": "Updates an existing comment. This method supports patch semantics.", 6892 // "httpMethod": "PATCH", 6893 // "id": "drive.comments.patch", 6894 // "parameterOrder": [ 6895 // "fileId", 6896 // "commentId" 6897 // ], 6898 // "parameters": { 6899 // "commentId": { 6900 // "description": "The ID of the comment.", 6901 // "location": "path", 6902 // "required": true, 6903 // "type": "string" 6904 // }, 6905 // "fileId": { 6906 // "description": "The ID of the file.", 6907 // "location": "path", 6908 // "required": true, 6909 // "type": "string" 6910 // } 6911 // }, 6912 // "path": "files/{fileId}/comments/{commentId}", 6913 // "request": { 6914 // "$ref": "Comment" 6915 // }, 6916 // "response": { 6917 // "$ref": "Comment" 6918 // }, 6919 // "scopes": [ 6920 // "https://www.googleapis.com/auth/drive", 6921 // "https://www.googleapis.com/auth/drive.file" 6922 // ] 6923 // } 6924 6925} 6926 6927// method id "drive.comments.update": 6928 6929type CommentsUpdateCall struct { 6930 s *Service 6931 fileId string 6932 commentId string 6933 comment *Comment 6934 urlParams_ gensupport.URLParams 6935 ctx_ context.Context 6936 header_ http.Header 6937} 6938 6939// Update: Updates an existing comment. 6940func (r *CommentsService) Update(fileId string, commentId string, comment *Comment) *CommentsUpdateCall { 6941 c := &CommentsUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)} 6942 c.fileId = fileId 6943 c.commentId = commentId 6944 c.comment = comment 6945 return c 6946} 6947 6948// Fields allows partial responses to be retrieved. See 6949// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 6950// for more information. 6951func (c *CommentsUpdateCall) Fields(s ...googleapi.Field) *CommentsUpdateCall { 6952 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 6953 return c 6954} 6955 6956// Context sets the context to be used in this call's Do method. Any 6957// pending HTTP request will be aborted if the provided context is 6958// canceled. 6959func (c *CommentsUpdateCall) Context(ctx context.Context) *CommentsUpdateCall { 6960 c.ctx_ = ctx 6961 return c 6962} 6963 6964// Header returns an http.Header that can be modified by the caller to 6965// add HTTP headers to the request. 6966func (c *CommentsUpdateCall) Header() http.Header { 6967 if c.header_ == nil { 6968 c.header_ = make(http.Header) 6969 } 6970 return c.header_ 6971} 6972 6973func (c *CommentsUpdateCall) doRequest(alt string) (*http.Response, error) { 6974 reqHeaders := make(http.Header) 6975 for k, v := range c.header_ { 6976 reqHeaders[k] = v 6977 } 6978 reqHeaders.Set("User-Agent", c.s.userAgent()) 6979 var body io.Reader = nil 6980 body, err := googleapi.WithoutDataWrapper.JSONReader(c.comment) 6981 if err != nil { 6982 return nil, err 6983 } 6984 reqHeaders.Set("Content-Type", "application/json") 6985 c.urlParams_.Set("alt", alt) 6986 c.urlParams_.Set("prettyPrint", "false") 6987 urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/comments/{commentId}") 6988 urls += "?" + c.urlParams_.Encode() 6989 req, err := http.NewRequest("PUT", urls, body) 6990 if err != nil { 6991 return nil, err 6992 } 6993 req.Header = reqHeaders 6994 googleapi.Expand(req.URL, map[string]string{ 6995 "fileId": c.fileId, 6996 "commentId": c.commentId, 6997 }) 6998 return gensupport.SendRequest(c.ctx_, c.s.client, req) 6999} 7000 7001// Do executes the "drive.comments.update" call. 7002// Exactly one of *Comment or error will be non-nil. Any non-2xx status 7003// code is an error. Response headers are in either 7004// *Comment.ServerResponse.Header or (if a response was returned at all) 7005// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 7006// check whether the returned error was because http.StatusNotModified 7007// was returned. 7008func (c *CommentsUpdateCall) Do(opts ...googleapi.CallOption) (*Comment, error) { 7009 gensupport.SetOptions(c.urlParams_, opts...) 7010 res, err := c.doRequest("json") 7011 if res != nil && res.StatusCode == http.StatusNotModified { 7012 if res.Body != nil { 7013 res.Body.Close() 7014 } 7015 return nil, &googleapi.Error{ 7016 Code: res.StatusCode, 7017 Header: res.Header, 7018 } 7019 } 7020 if err != nil { 7021 return nil, err 7022 } 7023 defer googleapi.CloseBody(res) 7024 if err := googleapi.CheckResponse(res); err != nil { 7025 return nil, err 7026 } 7027 ret := &Comment{ 7028 ServerResponse: googleapi.ServerResponse{ 7029 Header: res.Header, 7030 HTTPStatusCode: res.StatusCode, 7031 }, 7032 } 7033 target := &ret 7034 if err := gensupport.DecodeResponse(target, res); err != nil { 7035 return nil, err 7036 } 7037 return ret, nil 7038 // { 7039 // "description": "Updates an existing comment.", 7040 // "httpMethod": "PUT", 7041 // "id": "drive.comments.update", 7042 // "parameterOrder": [ 7043 // "fileId", 7044 // "commentId" 7045 // ], 7046 // "parameters": { 7047 // "commentId": { 7048 // "description": "The ID of the comment.", 7049 // "location": "path", 7050 // "required": true, 7051 // "type": "string" 7052 // }, 7053 // "fileId": { 7054 // "description": "The ID of the file.", 7055 // "location": "path", 7056 // "required": true, 7057 // "type": "string" 7058 // } 7059 // }, 7060 // "path": "files/{fileId}/comments/{commentId}", 7061 // "request": { 7062 // "$ref": "Comment" 7063 // }, 7064 // "response": { 7065 // "$ref": "Comment" 7066 // }, 7067 // "scopes": [ 7068 // "https://www.googleapis.com/auth/drive", 7069 // "https://www.googleapis.com/auth/drive.file" 7070 // ] 7071 // } 7072 7073} 7074 7075// method id "drive.drives.delete": 7076 7077type DrivesDeleteCall struct { 7078 s *Service 7079 driveId string 7080 urlParams_ gensupport.URLParams 7081 ctx_ context.Context 7082 header_ http.Header 7083} 7084 7085// Delete: Permanently deletes a shared drive for which the user is an 7086// organizer. The shared drive cannot contain any untrashed items. 7087func (r *DrivesService) Delete(driveId string) *DrivesDeleteCall { 7088 c := &DrivesDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)} 7089 c.driveId = driveId 7090 return c 7091} 7092 7093// Fields allows partial responses to be retrieved. See 7094// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 7095// for more information. 7096func (c *DrivesDeleteCall) Fields(s ...googleapi.Field) *DrivesDeleteCall { 7097 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 7098 return c 7099} 7100 7101// Context sets the context to be used in this call's Do method. Any 7102// pending HTTP request will be aborted if the provided context is 7103// canceled. 7104func (c *DrivesDeleteCall) Context(ctx context.Context) *DrivesDeleteCall { 7105 c.ctx_ = ctx 7106 return c 7107} 7108 7109// Header returns an http.Header that can be modified by the caller to 7110// add HTTP headers to the request. 7111func (c *DrivesDeleteCall) Header() http.Header { 7112 if c.header_ == nil { 7113 c.header_ = make(http.Header) 7114 } 7115 return c.header_ 7116} 7117 7118func (c *DrivesDeleteCall) doRequest(alt string) (*http.Response, error) { 7119 reqHeaders := make(http.Header) 7120 for k, v := range c.header_ { 7121 reqHeaders[k] = v 7122 } 7123 reqHeaders.Set("User-Agent", c.s.userAgent()) 7124 var body io.Reader = nil 7125 c.urlParams_.Set("alt", alt) 7126 c.urlParams_.Set("prettyPrint", "false") 7127 urls := googleapi.ResolveRelative(c.s.BasePath, "drives/{driveId}") 7128 urls += "?" + c.urlParams_.Encode() 7129 req, err := http.NewRequest("DELETE", urls, body) 7130 if err != nil { 7131 return nil, err 7132 } 7133 req.Header = reqHeaders 7134 googleapi.Expand(req.URL, map[string]string{ 7135 "driveId": c.driveId, 7136 }) 7137 return gensupport.SendRequest(c.ctx_, c.s.client, req) 7138} 7139 7140// Do executes the "drive.drives.delete" call. 7141func (c *DrivesDeleteCall) Do(opts ...googleapi.CallOption) error { 7142 gensupport.SetOptions(c.urlParams_, opts...) 7143 res, err := c.doRequest("json") 7144 if err != nil { 7145 return err 7146 } 7147 defer googleapi.CloseBody(res) 7148 if err := googleapi.CheckResponse(res); err != nil { 7149 return err 7150 } 7151 return nil 7152 // { 7153 // "description": "Permanently deletes a shared drive for which the user is an organizer. The shared drive cannot contain any untrashed items.", 7154 // "httpMethod": "DELETE", 7155 // "id": "drive.drives.delete", 7156 // "parameterOrder": [ 7157 // "driveId" 7158 // ], 7159 // "parameters": { 7160 // "driveId": { 7161 // "description": "The ID of the shared drive.", 7162 // "location": "path", 7163 // "required": true, 7164 // "type": "string" 7165 // } 7166 // }, 7167 // "path": "drives/{driveId}", 7168 // "scopes": [ 7169 // "https://www.googleapis.com/auth/drive" 7170 // ] 7171 // } 7172 7173} 7174 7175// method id "drive.drives.get": 7176 7177type DrivesGetCall struct { 7178 s *Service 7179 driveId string 7180 urlParams_ gensupport.URLParams 7181 ifNoneMatch_ string 7182 ctx_ context.Context 7183 header_ http.Header 7184} 7185 7186// Get: Gets a shared drive's metadata by ID. 7187func (r *DrivesService) Get(driveId string) *DrivesGetCall { 7188 c := &DrivesGetCall{s: r.s, urlParams_: make(gensupport.URLParams)} 7189 c.driveId = driveId 7190 return c 7191} 7192 7193// UseDomainAdminAccess sets the optional parameter 7194// "useDomainAdminAccess": Issue the request as a domain administrator; 7195// if set to true, then the requester will be granted access if they are 7196// an administrator of the domain to which the shared drive belongs. 7197func (c *DrivesGetCall) UseDomainAdminAccess(useDomainAdminAccess bool) *DrivesGetCall { 7198 c.urlParams_.Set("useDomainAdminAccess", fmt.Sprint(useDomainAdminAccess)) 7199 return c 7200} 7201 7202// Fields allows partial responses to be retrieved. See 7203// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 7204// for more information. 7205func (c *DrivesGetCall) Fields(s ...googleapi.Field) *DrivesGetCall { 7206 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 7207 return c 7208} 7209 7210// IfNoneMatch sets the optional parameter which makes the operation 7211// fail if the object's ETag matches the given value. This is useful for 7212// getting updates only after the object has changed since the last 7213// request. Use googleapi.IsNotModified to check whether the response 7214// error from Do is the result of In-None-Match. 7215func (c *DrivesGetCall) IfNoneMatch(entityTag string) *DrivesGetCall { 7216 c.ifNoneMatch_ = entityTag 7217 return c 7218} 7219 7220// Context sets the context to be used in this call's Do method. Any 7221// pending HTTP request will be aborted if the provided context is 7222// canceled. 7223func (c *DrivesGetCall) Context(ctx context.Context) *DrivesGetCall { 7224 c.ctx_ = ctx 7225 return c 7226} 7227 7228// Header returns an http.Header that can be modified by the caller to 7229// add HTTP headers to the request. 7230func (c *DrivesGetCall) Header() http.Header { 7231 if c.header_ == nil { 7232 c.header_ = make(http.Header) 7233 } 7234 return c.header_ 7235} 7236 7237func (c *DrivesGetCall) doRequest(alt string) (*http.Response, error) { 7238 reqHeaders := make(http.Header) 7239 for k, v := range c.header_ { 7240 reqHeaders[k] = v 7241 } 7242 reqHeaders.Set("User-Agent", c.s.userAgent()) 7243 if c.ifNoneMatch_ != "" { 7244 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 7245 } 7246 var body io.Reader = nil 7247 c.urlParams_.Set("alt", alt) 7248 c.urlParams_.Set("prettyPrint", "false") 7249 urls := googleapi.ResolveRelative(c.s.BasePath, "drives/{driveId}") 7250 urls += "?" + c.urlParams_.Encode() 7251 req, err := http.NewRequest("GET", urls, body) 7252 if err != nil { 7253 return nil, err 7254 } 7255 req.Header = reqHeaders 7256 googleapi.Expand(req.URL, map[string]string{ 7257 "driveId": c.driveId, 7258 }) 7259 return gensupport.SendRequest(c.ctx_, c.s.client, req) 7260} 7261 7262// Do executes the "drive.drives.get" call. 7263// Exactly one of *Drive or error will be non-nil. Any non-2xx status 7264// code is an error. Response headers are in either 7265// *Drive.ServerResponse.Header or (if a response was returned at all) 7266// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 7267// check whether the returned error was because http.StatusNotModified 7268// was returned. 7269func (c *DrivesGetCall) Do(opts ...googleapi.CallOption) (*Drive, error) { 7270 gensupport.SetOptions(c.urlParams_, opts...) 7271 res, err := c.doRequest("json") 7272 if res != nil && res.StatusCode == http.StatusNotModified { 7273 if res.Body != nil { 7274 res.Body.Close() 7275 } 7276 return nil, &googleapi.Error{ 7277 Code: res.StatusCode, 7278 Header: res.Header, 7279 } 7280 } 7281 if err != nil { 7282 return nil, err 7283 } 7284 defer googleapi.CloseBody(res) 7285 if err := googleapi.CheckResponse(res); err != nil { 7286 return nil, err 7287 } 7288 ret := &Drive{ 7289 ServerResponse: googleapi.ServerResponse{ 7290 Header: res.Header, 7291 HTTPStatusCode: res.StatusCode, 7292 }, 7293 } 7294 target := &ret 7295 if err := gensupport.DecodeResponse(target, res); err != nil { 7296 return nil, err 7297 } 7298 return ret, nil 7299 // { 7300 // "description": "Gets a shared drive's metadata by ID.", 7301 // "httpMethod": "GET", 7302 // "id": "drive.drives.get", 7303 // "parameterOrder": [ 7304 // "driveId" 7305 // ], 7306 // "parameters": { 7307 // "driveId": { 7308 // "description": "The ID of the shared drive.", 7309 // "location": "path", 7310 // "required": true, 7311 // "type": "string" 7312 // }, 7313 // "useDomainAdminAccess": { 7314 // "default": "false", 7315 // "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.", 7316 // "location": "query", 7317 // "type": "boolean" 7318 // } 7319 // }, 7320 // "path": "drives/{driveId}", 7321 // "response": { 7322 // "$ref": "Drive" 7323 // }, 7324 // "scopes": [ 7325 // "https://www.googleapis.com/auth/drive", 7326 // "https://www.googleapis.com/auth/drive.readonly" 7327 // ] 7328 // } 7329 7330} 7331 7332// method id "drive.drives.hide": 7333 7334type DrivesHideCall struct { 7335 s *Service 7336 driveId string 7337 urlParams_ gensupport.URLParams 7338 ctx_ context.Context 7339 header_ http.Header 7340} 7341 7342// Hide: Hides a shared drive from the default view. 7343func (r *DrivesService) Hide(driveId string) *DrivesHideCall { 7344 c := &DrivesHideCall{s: r.s, urlParams_: make(gensupport.URLParams)} 7345 c.driveId = driveId 7346 return c 7347} 7348 7349// Fields allows partial responses to be retrieved. See 7350// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 7351// for more information. 7352func (c *DrivesHideCall) Fields(s ...googleapi.Field) *DrivesHideCall { 7353 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 7354 return c 7355} 7356 7357// Context sets the context to be used in this call's Do method. Any 7358// pending HTTP request will be aborted if the provided context is 7359// canceled. 7360func (c *DrivesHideCall) Context(ctx context.Context) *DrivesHideCall { 7361 c.ctx_ = ctx 7362 return c 7363} 7364 7365// Header returns an http.Header that can be modified by the caller to 7366// add HTTP headers to the request. 7367func (c *DrivesHideCall) Header() http.Header { 7368 if c.header_ == nil { 7369 c.header_ = make(http.Header) 7370 } 7371 return c.header_ 7372} 7373 7374func (c *DrivesHideCall) doRequest(alt string) (*http.Response, error) { 7375 reqHeaders := make(http.Header) 7376 for k, v := range c.header_ { 7377 reqHeaders[k] = v 7378 } 7379 reqHeaders.Set("User-Agent", c.s.userAgent()) 7380 var body io.Reader = nil 7381 c.urlParams_.Set("alt", alt) 7382 c.urlParams_.Set("prettyPrint", "false") 7383 urls := googleapi.ResolveRelative(c.s.BasePath, "drives/{driveId}/hide") 7384 urls += "?" + c.urlParams_.Encode() 7385 req, err := http.NewRequest("POST", urls, body) 7386 if err != nil { 7387 return nil, err 7388 } 7389 req.Header = reqHeaders 7390 googleapi.Expand(req.URL, map[string]string{ 7391 "driveId": c.driveId, 7392 }) 7393 return gensupport.SendRequest(c.ctx_, c.s.client, req) 7394} 7395 7396// Do executes the "drive.drives.hide" call. 7397// Exactly one of *Drive or error will be non-nil. Any non-2xx status 7398// code is an error. Response headers are in either 7399// *Drive.ServerResponse.Header or (if a response was returned at all) 7400// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 7401// check whether the returned error was because http.StatusNotModified 7402// was returned. 7403func (c *DrivesHideCall) Do(opts ...googleapi.CallOption) (*Drive, error) { 7404 gensupport.SetOptions(c.urlParams_, opts...) 7405 res, err := c.doRequest("json") 7406 if res != nil && res.StatusCode == http.StatusNotModified { 7407 if res.Body != nil { 7408 res.Body.Close() 7409 } 7410 return nil, &googleapi.Error{ 7411 Code: res.StatusCode, 7412 Header: res.Header, 7413 } 7414 } 7415 if err != nil { 7416 return nil, err 7417 } 7418 defer googleapi.CloseBody(res) 7419 if err := googleapi.CheckResponse(res); err != nil { 7420 return nil, err 7421 } 7422 ret := &Drive{ 7423 ServerResponse: googleapi.ServerResponse{ 7424 Header: res.Header, 7425 HTTPStatusCode: res.StatusCode, 7426 }, 7427 } 7428 target := &ret 7429 if err := gensupport.DecodeResponse(target, res); err != nil { 7430 return nil, err 7431 } 7432 return ret, nil 7433 // { 7434 // "description": "Hides a shared drive from the default view.", 7435 // "httpMethod": "POST", 7436 // "id": "drive.drives.hide", 7437 // "parameterOrder": [ 7438 // "driveId" 7439 // ], 7440 // "parameters": { 7441 // "driveId": { 7442 // "description": "The ID of the shared drive.", 7443 // "location": "path", 7444 // "required": true, 7445 // "type": "string" 7446 // } 7447 // }, 7448 // "path": "drives/{driveId}/hide", 7449 // "response": { 7450 // "$ref": "Drive" 7451 // }, 7452 // "scopes": [ 7453 // "https://www.googleapis.com/auth/drive" 7454 // ] 7455 // } 7456 7457} 7458 7459// method id "drive.drives.insert": 7460 7461type DrivesInsertCall struct { 7462 s *Service 7463 drive *Drive 7464 urlParams_ gensupport.URLParams 7465 ctx_ context.Context 7466 header_ http.Header 7467} 7468 7469// Insert: Creates a new shared drive. 7470func (r *DrivesService) Insert(requestId string, drive *Drive) *DrivesInsertCall { 7471 c := &DrivesInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)} 7472 c.urlParams_.Set("requestId", requestId) 7473 c.drive = drive 7474 return c 7475} 7476 7477// Fields allows partial responses to be retrieved. See 7478// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 7479// for more information. 7480func (c *DrivesInsertCall) Fields(s ...googleapi.Field) *DrivesInsertCall { 7481 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 7482 return c 7483} 7484 7485// Context sets the context to be used in this call's Do method. Any 7486// pending HTTP request will be aborted if the provided context is 7487// canceled. 7488func (c *DrivesInsertCall) Context(ctx context.Context) *DrivesInsertCall { 7489 c.ctx_ = ctx 7490 return c 7491} 7492 7493// Header returns an http.Header that can be modified by the caller to 7494// add HTTP headers to the request. 7495func (c *DrivesInsertCall) Header() http.Header { 7496 if c.header_ == nil { 7497 c.header_ = make(http.Header) 7498 } 7499 return c.header_ 7500} 7501 7502func (c *DrivesInsertCall) doRequest(alt string) (*http.Response, error) { 7503 reqHeaders := make(http.Header) 7504 for k, v := range c.header_ { 7505 reqHeaders[k] = v 7506 } 7507 reqHeaders.Set("User-Agent", c.s.userAgent()) 7508 var body io.Reader = nil 7509 body, err := googleapi.WithoutDataWrapper.JSONReader(c.drive) 7510 if err != nil { 7511 return nil, err 7512 } 7513 reqHeaders.Set("Content-Type", "application/json") 7514 c.urlParams_.Set("alt", alt) 7515 c.urlParams_.Set("prettyPrint", "false") 7516 urls := googleapi.ResolveRelative(c.s.BasePath, "drives") 7517 urls += "?" + c.urlParams_.Encode() 7518 req, err := http.NewRequest("POST", urls, body) 7519 if err != nil { 7520 return nil, err 7521 } 7522 req.Header = reqHeaders 7523 return gensupport.SendRequest(c.ctx_, c.s.client, req) 7524} 7525 7526// Do executes the "drive.drives.insert" call. 7527// Exactly one of *Drive or error will be non-nil. Any non-2xx status 7528// code is an error. Response headers are in either 7529// *Drive.ServerResponse.Header or (if a response was returned at all) 7530// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 7531// check whether the returned error was because http.StatusNotModified 7532// was returned. 7533func (c *DrivesInsertCall) Do(opts ...googleapi.CallOption) (*Drive, error) { 7534 gensupport.SetOptions(c.urlParams_, opts...) 7535 res, err := c.doRequest("json") 7536 if res != nil && res.StatusCode == http.StatusNotModified { 7537 if res.Body != nil { 7538 res.Body.Close() 7539 } 7540 return nil, &googleapi.Error{ 7541 Code: res.StatusCode, 7542 Header: res.Header, 7543 } 7544 } 7545 if err != nil { 7546 return nil, err 7547 } 7548 defer googleapi.CloseBody(res) 7549 if err := googleapi.CheckResponse(res); err != nil { 7550 return nil, err 7551 } 7552 ret := &Drive{ 7553 ServerResponse: googleapi.ServerResponse{ 7554 Header: res.Header, 7555 HTTPStatusCode: res.StatusCode, 7556 }, 7557 } 7558 target := &ret 7559 if err := gensupport.DecodeResponse(target, res); err != nil { 7560 return nil, err 7561 } 7562 return ret, nil 7563 // { 7564 // "description": "Creates a new shared drive.", 7565 // "httpMethod": "POST", 7566 // "id": "drive.drives.insert", 7567 // "parameterOrder": [ 7568 // "requestId" 7569 // ], 7570 // "parameters": { 7571 // "requestId": { 7572 // "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.", 7573 // "location": "query", 7574 // "required": true, 7575 // "type": "string" 7576 // } 7577 // }, 7578 // "path": "drives", 7579 // "request": { 7580 // "$ref": "Drive" 7581 // }, 7582 // "response": { 7583 // "$ref": "Drive" 7584 // }, 7585 // "scopes": [ 7586 // "https://www.googleapis.com/auth/drive" 7587 // ] 7588 // } 7589 7590} 7591 7592// method id "drive.drives.list": 7593 7594type DrivesListCall struct { 7595 s *Service 7596 urlParams_ gensupport.URLParams 7597 ifNoneMatch_ string 7598 ctx_ context.Context 7599 header_ http.Header 7600} 7601 7602// List: Lists the user's shared drives. 7603func (r *DrivesService) List() *DrivesListCall { 7604 c := &DrivesListCall{s: r.s, urlParams_: make(gensupport.URLParams)} 7605 return c 7606} 7607 7608// MaxResults sets the optional parameter "maxResults": Maximum number 7609// of shared drives to return. 7610func (c *DrivesListCall) MaxResults(maxResults int64) *DrivesListCall { 7611 c.urlParams_.Set("maxResults", fmt.Sprint(maxResults)) 7612 return c 7613} 7614 7615// PageToken sets the optional parameter "pageToken": Page token for 7616// shared drives. 7617func (c *DrivesListCall) PageToken(pageToken string) *DrivesListCall { 7618 c.urlParams_.Set("pageToken", pageToken) 7619 return c 7620} 7621 7622// Q sets the optional parameter "q": Query string for searching shared 7623// drives. 7624func (c *DrivesListCall) Q(q string) *DrivesListCall { 7625 c.urlParams_.Set("q", q) 7626 return c 7627} 7628 7629// UseDomainAdminAccess sets the optional parameter 7630// "useDomainAdminAccess": Issue the request as a domain administrator; 7631// if set to true, then all shared drives of the domain in which the 7632// requester is an administrator are returned. 7633func (c *DrivesListCall) UseDomainAdminAccess(useDomainAdminAccess bool) *DrivesListCall { 7634 c.urlParams_.Set("useDomainAdminAccess", fmt.Sprint(useDomainAdminAccess)) 7635 return c 7636} 7637 7638// Fields allows partial responses to be retrieved. See 7639// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 7640// for more information. 7641func (c *DrivesListCall) Fields(s ...googleapi.Field) *DrivesListCall { 7642 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 7643 return c 7644} 7645 7646// IfNoneMatch sets the optional parameter which makes the operation 7647// fail if the object's ETag matches the given value. This is useful for 7648// getting updates only after the object has changed since the last 7649// request. Use googleapi.IsNotModified to check whether the response 7650// error from Do is the result of In-None-Match. 7651func (c *DrivesListCall) IfNoneMatch(entityTag string) *DrivesListCall { 7652 c.ifNoneMatch_ = entityTag 7653 return c 7654} 7655 7656// Context sets the context to be used in this call's Do method. Any 7657// pending HTTP request will be aborted if the provided context is 7658// canceled. 7659func (c *DrivesListCall) Context(ctx context.Context) *DrivesListCall { 7660 c.ctx_ = ctx 7661 return c 7662} 7663 7664// Header returns an http.Header that can be modified by the caller to 7665// add HTTP headers to the request. 7666func (c *DrivesListCall) Header() http.Header { 7667 if c.header_ == nil { 7668 c.header_ = make(http.Header) 7669 } 7670 return c.header_ 7671} 7672 7673func (c *DrivesListCall) doRequest(alt string) (*http.Response, error) { 7674 reqHeaders := make(http.Header) 7675 for k, v := range c.header_ { 7676 reqHeaders[k] = v 7677 } 7678 reqHeaders.Set("User-Agent", c.s.userAgent()) 7679 if c.ifNoneMatch_ != "" { 7680 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 7681 } 7682 var body io.Reader = nil 7683 c.urlParams_.Set("alt", alt) 7684 c.urlParams_.Set("prettyPrint", "false") 7685 urls := googleapi.ResolveRelative(c.s.BasePath, "drives") 7686 urls += "?" + c.urlParams_.Encode() 7687 req, err := http.NewRequest("GET", urls, body) 7688 if err != nil { 7689 return nil, err 7690 } 7691 req.Header = reqHeaders 7692 return gensupport.SendRequest(c.ctx_, c.s.client, req) 7693} 7694 7695// Do executes the "drive.drives.list" call. 7696// Exactly one of *DriveList or error will be non-nil. Any non-2xx 7697// status code is an error. Response headers are in either 7698// *DriveList.ServerResponse.Header or (if a response was returned at 7699// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 7700// to check whether the returned error was because 7701// http.StatusNotModified was returned. 7702func (c *DrivesListCall) Do(opts ...googleapi.CallOption) (*DriveList, error) { 7703 gensupport.SetOptions(c.urlParams_, opts...) 7704 res, err := c.doRequest("json") 7705 if res != nil && res.StatusCode == http.StatusNotModified { 7706 if res.Body != nil { 7707 res.Body.Close() 7708 } 7709 return nil, &googleapi.Error{ 7710 Code: res.StatusCode, 7711 Header: res.Header, 7712 } 7713 } 7714 if err != nil { 7715 return nil, err 7716 } 7717 defer googleapi.CloseBody(res) 7718 if err := googleapi.CheckResponse(res); err != nil { 7719 return nil, err 7720 } 7721 ret := &DriveList{ 7722 ServerResponse: googleapi.ServerResponse{ 7723 Header: res.Header, 7724 HTTPStatusCode: res.StatusCode, 7725 }, 7726 } 7727 target := &ret 7728 if err := gensupport.DecodeResponse(target, res); err != nil { 7729 return nil, err 7730 } 7731 return ret, nil 7732 // { 7733 // "description": "Lists the user's shared drives.", 7734 // "httpMethod": "GET", 7735 // "id": "drive.drives.list", 7736 // "parameters": { 7737 // "maxResults": { 7738 // "default": "10", 7739 // "description": "Maximum number of shared drives to return.", 7740 // "format": "int32", 7741 // "location": "query", 7742 // "maximum": "100", 7743 // "minimum": "1", 7744 // "type": "integer" 7745 // }, 7746 // "pageToken": { 7747 // "description": "Page token for shared drives.", 7748 // "location": "query", 7749 // "type": "string" 7750 // }, 7751 // "q": { 7752 // "description": "Query string for searching shared drives.", 7753 // "location": "query", 7754 // "type": "string" 7755 // }, 7756 // "useDomainAdminAccess": { 7757 // "default": "false", 7758 // "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.", 7759 // "location": "query", 7760 // "type": "boolean" 7761 // } 7762 // }, 7763 // "path": "drives", 7764 // "response": { 7765 // "$ref": "DriveList" 7766 // }, 7767 // "scopes": [ 7768 // "https://www.googleapis.com/auth/drive", 7769 // "https://www.googleapis.com/auth/drive.readonly" 7770 // ] 7771 // } 7772 7773} 7774 7775// Pages invokes f for each page of results. 7776// A non-nil error returned from f will halt the iteration. 7777// The provided context supersedes any context provided to the Context method. 7778func (c *DrivesListCall) Pages(ctx context.Context, f func(*DriveList) error) error { 7779 c.ctx_ = ctx 7780 defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point 7781 for { 7782 x, err := c.Do() 7783 if err != nil { 7784 return err 7785 } 7786 if err := f(x); err != nil { 7787 return err 7788 } 7789 if x.NextPageToken == "" { 7790 return nil 7791 } 7792 c.PageToken(x.NextPageToken) 7793 } 7794} 7795 7796// method id "drive.drives.unhide": 7797 7798type DrivesUnhideCall struct { 7799 s *Service 7800 driveId string 7801 urlParams_ gensupport.URLParams 7802 ctx_ context.Context 7803 header_ http.Header 7804} 7805 7806// Unhide: Restores a shared drive to the default view. 7807func (r *DrivesService) Unhide(driveId string) *DrivesUnhideCall { 7808 c := &DrivesUnhideCall{s: r.s, urlParams_: make(gensupport.URLParams)} 7809 c.driveId = driveId 7810 return c 7811} 7812 7813// Fields allows partial responses to be retrieved. See 7814// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 7815// for more information. 7816func (c *DrivesUnhideCall) Fields(s ...googleapi.Field) *DrivesUnhideCall { 7817 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 7818 return c 7819} 7820 7821// Context sets the context to be used in this call's Do method. Any 7822// pending HTTP request will be aborted if the provided context is 7823// canceled. 7824func (c *DrivesUnhideCall) Context(ctx context.Context) *DrivesUnhideCall { 7825 c.ctx_ = ctx 7826 return c 7827} 7828 7829// Header returns an http.Header that can be modified by the caller to 7830// add HTTP headers to the request. 7831func (c *DrivesUnhideCall) Header() http.Header { 7832 if c.header_ == nil { 7833 c.header_ = make(http.Header) 7834 } 7835 return c.header_ 7836} 7837 7838func (c *DrivesUnhideCall) doRequest(alt string) (*http.Response, error) { 7839 reqHeaders := make(http.Header) 7840 for k, v := range c.header_ { 7841 reqHeaders[k] = v 7842 } 7843 reqHeaders.Set("User-Agent", c.s.userAgent()) 7844 var body io.Reader = nil 7845 c.urlParams_.Set("alt", alt) 7846 c.urlParams_.Set("prettyPrint", "false") 7847 urls := googleapi.ResolveRelative(c.s.BasePath, "drives/{driveId}/unhide") 7848 urls += "?" + c.urlParams_.Encode() 7849 req, err := http.NewRequest("POST", urls, body) 7850 if err != nil { 7851 return nil, err 7852 } 7853 req.Header = reqHeaders 7854 googleapi.Expand(req.URL, map[string]string{ 7855 "driveId": c.driveId, 7856 }) 7857 return gensupport.SendRequest(c.ctx_, c.s.client, req) 7858} 7859 7860// Do executes the "drive.drives.unhide" call. 7861// Exactly one of *Drive or error will be non-nil. Any non-2xx status 7862// code is an error. Response headers are in either 7863// *Drive.ServerResponse.Header or (if a response was returned at all) 7864// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 7865// check whether the returned error was because http.StatusNotModified 7866// was returned. 7867func (c *DrivesUnhideCall) Do(opts ...googleapi.CallOption) (*Drive, error) { 7868 gensupport.SetOptions(c.urlParams_, opts...) 7869 res, err := c.doRequest("json") 7870 if res != nil && res.StatusCode == http.StatusNotModified { 7871 if res.Body != nil { 7872 res.Body.Close() 7873 } 7874 return nil, &googleapi.Error{ 7875 Code: res.StatusCode, 7876 Header: res.Header, 7877 } 7878 } 7879 if err != nil { 7880 return nil, err 7881 } 7882 defer googleapi.CloseBody(res) 7883 if err := googleapi.CheckResponse(res); err != nil { 7884 return nil, err 7885 } 7886 ret := &Drive{ 7887 ServerResponse: googleapi.ServerResponse{ 7888 Header: res.Header, 7889 HTTPStatusCode: res.StatusCode, 7890 }, 7891 } 7892 target := &ret 7893 if err := gensupport.DecodeResponse(target, res); err != nil { 7894 return nil, err 7895 } 7896 return ret, nil 7897 // { 7898 // "description": "Restores a shared drive to the default view.", 7899 // "httpMethod": "POST", 7900 // "id": "drive.drives.unhide", 7901 // "parameterOrder": [ 7902 // "driveId" 7903 // ], 7904 // "parameters": { 7905 // "driveId": { 7906 // "description": "The ID of the shared drive.", 7907 // "location": "path", 7908 // "required": true, 7909 // "type": "string" 7910 // } 7911 // }, 7912 // "path": "drives/{driveId}/unhide", 7913 // "response": { 7914 // "$ref": "Drive" 7915 // }, 7916 // "scopes": [ 7917 // "https://www.googleapis.com/auth/drive" 7918 // ] 7919 // } 7920 7921} 7922 7923// method id "drive.drives.update": 7924 7925type DrivesUpdateCall struct { 7926 s *Service 7927 driveId string 7928 drive *Drive 7929 urlParams_ gensupport.URLParams 7930 ctx_ context.Context 7931 header_ http.Header 7932} 7933 7934// Update: Updates the metadata for a shared drive. 7935func (r *DrivesService) Update(driveId string, drive *Drive) *DrivesUpdateCall { 7936 c := &DrivesUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)} 7937 c.driveId = driveId 7938 c.drive = drive 7939 return c 7940} 7941 7942// UseDomainAdminAccess sets the optional parameter 7943// "useDomainAdminAccess": Issue the request as a domain administrator; 7944// if set to true, then the requester will be granted access if they are 7945// an administrator of the domain to which the shared drive belongs. 7946func (c *DrivesUpdateCall) UseDomainAdminAccess(useDomainAdminAccess bool) *DrivesUpdateCall { 7947 c.urlParams_.Set("useDomainAdminAccess", fmt.Sprint(useDomainAdminAccess)) 7948 return c 7949} 7950 7951// Fields allows partial responses to be retrieved. See 7952// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 7953// for more information. 7954func (c *DrivesUpdateCall) Fields(s ...googleapi.Field) *DrivesUpdateCall { 7955 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 7956 return c 7957} 7958 7959// Context sets the context to be used in this call's Do method. Any 7960// pending HTTP request will be aborted if the provided context is 7961// canceled. 7962func (c *DrivesUpdateCall) Context(ctx context.Context) *DrivesUpdateCall { 7963 c.ctx_ = ctx 7964 return c 7965} 7966 7967// Header returns an http.Header that can be modified by the caller to 7968// add HTTP headers to the request. 7969func (c *DrivesUpdateCall) Header() http.Header { 7970 if c.header_ == nil { 7971 c.header_ = make(http.Header) 7972 } 7973 return c.header_ 7974} 7975 7976func (c *DrivesUpdateCall) doRequest(alt string) (*http.Response, error) { 7977 reqHeaders := make(http.Header) 7978 for k, v := range c.header_ { 7979 reqHeaders[k] = v 7980 } 7981 reqHeaders.Set("User-Agent", c.s.userAgent()) 7982 var body io.Reader = nil 7983 body, err := googleapi.WithoutDataWrapper.JSONReader(c.drive) 7984 if err != nil { 7985 return nil, err 7986 } 7987 reqHeaders.Set("Content-Type", "application/json") 7988 c.urlParams_.Set("alt", alt) 7989 c.urlParams_.Set("prettyPrint", "false") 7990 urls := googleapi.ResolveRelative(c.s.BasePath, "drives/{driveId}") 7991 urls += "?" + c.urlParams_.Encode() 7992 req, err := http.NewRequest("PUT", urls, body) 7993 if err != nil { 7994 return nil, err 7995 } 7996 req.Header = reqHeaders 7997 googleapi.Expand(req.URL, map[string]string{ 7998 "driveId": c.driveId, 7999 }) 8000 return gensupport.SendRequest(c.ctx_, c.s.client, req) 8001} 8002 8003// Do executes the "drive.drives.update" call. 8004// Exactly one of *Drive or error will be non-nil. Any non-2xx status 8005// code is an error. Response headers are in either 8006// *Drive.ServerResponse.Header or (if a response was returned at all) 8007// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 8008// check whether the returned error was because http.StatusNotModified 8009// was returned. 8010func (c *DrivesUpdateCall) Do(opts ...googleapi.CallOption) (*Drive, error) { 8011 gensupport.SetOptions(c.urlParams_, opts...) 8012 res, err := c.doRequest("json") 8013 if res != nil && res.StatusCode == http.StatusNotModified { 8014 if res.Body != nil { 8015 res.Body.Close() 8016 } 8017 return nil, &googleapi.Error{ 8018 Code: res.StatusCode, 8019 Header: res.Header, 8020 } 8021 } 8022 if err != nil { 8023 return nil, err 8024 } 8025 defer googleapi.CloseBody(res) 8026 if err := googleapi.CheckResponse(res); err != nil { 8027 return nil, err 8028 } 8029 ret := &Drive{ 8030 ServerResponse: googleapi.ServerResponse{ 8031 Header: res.Header, 8032 HTTPStatusCode: res.StatusCode, 8033 }, 8034 } 8035 target := &ret 8036 if err := gensupport.DecodeResponse(target, res); err != nil { 8037 return nil, err 8038 } 8039 return ret, nil 8040 // { 8041 // "description": "Updates the metadata for a shared drive.", 8042 // "httpMethod": "PUT", 8043 // "id": "drive.drives.update", 8044 // "parameterOrder": [ 8045 // "driveId" 8046 // ], 8047 // "parameters": { 8048 // "driveId": { 8049 // "description": "The ID of the shared drive.", 8050 // "location": "path", 8051 // "required": true, 8052 // "type": "string" 8053 // }, 8054 // "useDomainAdminAccess": { 8055 // "default": "false", 8056 // "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.", 8057 // "location": "query", 8058 // "type": "boolean" 8059 // } 8060 // }, 8061 // "path": "drives/{driveId}", 8062 // "request": { 8063 // "$ref": "Drive" 8064 // }, 8065 // "response": { 8066 // "$ref": "Drive" 8067 // }, 8068 // "scopes": [ 8069 // "https://www.googleapis.com/auth/drive" 8070 // ] 8071 // } 8072 8073} 8074 8075// method id "drive.files.copy": 8076 8077type FilesCopyCall struct { 8078 s *Service 8079 fileId string 8080 file *File 8081 urlParams_ gensupport.URLParams 8082 ctx_ context.Context 8083 header_ http.Header 8084} 8085 8086// Copy: Creates a copy of the specified file. 8087func (r *FilesService) Copy(fileId string, file *File) *FilesCopyCall { 8088 c := &FilesCopyCall{s: r.s, urlParams_: make(gensupport.URLParams)} 8089 c.fileId = fileId 8090 c.file = file 8091 return c 8092} 8093 8094// Convert sets the optional parameter "convert": Whether to convert 8095// this file to the corresponding Google Docs format. 8096func (c *FilesCopyCall) Convert(convert bool) *FilesCopyCall { 8097 c.urlParams_.Set("convert", fmt.Sprint(convert)) 8098 return c 8099} 8100 8101// Ocr sets the optional parameter "ocr": Whether to attempt OCR on 8102// .jpg, .png, .gif, or .pdf uploads. 8103func (c *FilesCopyCall) Ocr(ocr bool) *FilesCopyCall { 8104 c.urlParams_.Set("ocr", fmt.Sprint(ocr)) 8105 return c 8106} 8107 8108// OcrLanguage sets the optional parameter "ocrLanguage": If ocr is 8109// true, hints at the language to use. Valid values are BCP 47 codes. 8110func (c *FilesCopyCall) OcrLanguage(ocrLanguage string) *FilesCopyCall { 8111 c.urlParams_.Set("ocrLanguage", ocrLanguage) 8112 return c 8113} 8114 8115// Pinned sets the optional parameter "pinned": Whether to pin the head 8116// revision of the new copy. A file can have a maximum of 200 pinned 8117// revisions. 8118func (c *FilesCopyCall) Pinned(pinned bool) *FilesCopyCall { 8119 c.urlParams_.Set("pinned", fmt.Sprint(pinned)) 8120 return c 8121} 8122 8123// SupportsAllDrives sets the optional parameter "supportsAllDrives": 8124// Deprecated - Whether the requesting application supports both My 8125// Drives and shared drives. This parameter will only be effective until 8126// June 1, 2020. Afterwards all applications are assumed to support 8127// shared drives. 8128func (c *FilesCopyCall) SupportsAllDrives(supportsAllDrives bool) *FilesCopyCall { 8129 c.urlParams_.Set("supportsAllDrives", fmt.Sprint(supportsAllDrives)) 8130 return c 8131} 8132 8133// SupportsTeamDrives sets the optional parameter "supportsTeamDrives": 8134// Deprecated use supportsAllDrives instead. 8135func (c *FilesCopyCall) SupportsTeamDrives(supportsTeamDrives bool) *FilesCopyCall { 8136 c.urlParams_.Set("supportsTeamDrives", fmt.Sprint(supportsTeamDrives)) 8137 return c 8138} 8139 8140// TimedTextLanguage sets the optional parameter "timedTextLanguage": 8141// The language of the timed text. 8142func (c *FilesCopyCall) TimedTextLanguage(timedTextLanguage string) *FilesCopyCall { 8143 c.urlParams_.Set("timedTextLanguage", timedTextLanguage) 8144 return c 8145} 8146 8147// TimedTextTrackName sets the optional parameter "timedTextTrackName": 8148// The timed text track name. 8149func (c *FilesCopyCall) TimedTextTrackName(timedTextTrackName string) *FilesCopyCall { 8150 c.urlParams_.Set("timedTextTrackName", timedTextTrackName) 8151 return c 8152} 8153 8154// Visibility sets the optional parameter "visibility": The visibility 8155// of the new file. This parameter is only relevant when the source is 8156// not a native Google Doc and convert=false. 8157// 8158// Possible values: 8159// "DEFAULT" (default) - The visibility of the new file is determined 8160// by the user's default visibility/sharing policies. 8161// "PRIVATE" - The new file will be visible to only the owner. 8162func (c *FilesCopyCall) Visibility(visibility string) *FilesCopyCall { 8163 c.urlParams_.Set("visibility", visibility) 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 *FilesCopyCall) Fields(s ...googleapi.Field) *FilesCopyCall { 8171 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 8172 return c 8173} 8174 8175// Context sets the context to be used in this call's Do method. Any 8176// pending HTTP request will be aborted if the provided context is 8177// canceled. 8178func (c *FilesCopyCall) Context(ctx context.Context) *FilesCopyCall { 8179 c.ctx_ = ctx 8180 return c 8181} 8182 8183// Header returns an http.Header that can be modified by the caller to 8184// add HTTP headers to the request. 8185func (c *FilesCopyCall) Header() http.Header { 8186 if c.header_ == nil { 8187 c.header_ = make(http.Header) 8188 } 8189 return c.header_ 8190} 8191 8192func (c *FilesCopyCall) doRequest(alt string) (*http.Response, error) { 8193 reqHeaders := make(http.Header) 8194 for k, v := range c.header_ { 8195 reqHeaders[k] = v 8196 } 8197 reqHeaders.Set("User-Agent", c.s.userAgent()) 8198 var body io.Reader = nil 8199 body, err := googleapi.WithoutDataWrapper.JSONReader(c.file) 8200 if err != nil { 8201 return nil, err 8202 } 8203 reqHeaders.Set("Content-Type", "application/json") 8204 c.urlParams_.Set("alt", alt) 8205 c.urlParams_.Set("prettyPrint", "false") 8206 urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/copy") 8207 urls += "?" + c.urlParams_.Encode() 8208 req, err := http.NewRequest("POST", urls, body) 8209 if err != nil { 8210 return nil, err 8211 } 8212 req.Header = reqHeaders 8213 googleapi.Expand(req.URL, map[string]string{ 8214 "fileId": c.fileId, 8215 }) 8216 return gensupport.SendRequest(c.ctx_, c.s.client, req) 8217} 8218 8219// Do executes the "drive.files.copy" call. 8220// Exactly one of *File or error will be non-nil. Any non-2xx status 8221// code is an error. Response headers are in either 8222// *File.ServerResponse.Header or (if a response was returned at all) in 8223// error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check 8224// whether the returned error was because http.StatusNotModified was 8225// returned. 8226func (c *FilesCopyCall) Do(opts ...googleapi.CallOption) (*File, error) { 8227 gensupport.SetOptions(c.urlParams_, opts...) 8228 res, err := c.doRequest("json") 8229 if res != nil && res.StatusCode == http.StatusNotModified { 8230 if res.Body != nil { 8231 res.Body.Close() 8232 } 8233 return nil, &googleapi.Error{ 8234 Code: res.StatusCode, 8235 Header: res.Header, 8236 } 8237 } 8238 if err != nil { 8239 return nil, err 8240 } 8241 defer googleapi.CloseBody(res) 8242 if err := googleapi.CheckResponse(res); err != nil { 8243 return nil, err 8244 } 8245 ret := &File{ 8246 ServerResponse: googleapi.ServerResponse{ 8247 Header: res.Header, 8248 HTTPStatusCode: res.StatusCode, 8249 }, 8250 } 8251 target := &ret 8252 if err := gensupport.DecodeResponse(target, res); err != nil { 8253 return nil, err 8254 } 8255 return ret, nil 8256 // { 8257 // "description": "Creates a copy of the specified file.", 8258 // "httpMethod": "POST", 8259 // "id": "drive.files.copy", 8260 // "parameterOrder": [ 8261 // "fileId" 8262 // ], 8263 // "parameters": { 8264 // "convert": { 8265 // "default": "false", 8266 // "description": "Whether to convert this file to the corresponding Google Docs format.", 8267 // "location": "query", 8268 // "type": "boolean" 8269 // }, 8270 // "fileId": { 8271 // "description": "The ID of the file to copy.", 8272 // "location": "path", 8273 // "required": true, 8274 // "type": "string" 8275 // }, 8276 // "ocr": { 8277 // "default": "false", 8278 // "description": "Whether to attempt OCR on .jpg, .png, .gif, or .pdf uploads.", 8279 // "location": "query", 8280 // "type": "boolean" 8281 // }, 8282 // "ocrLanguage": { 8283 // "description": "If ocr is true, hints at the language to use. Valid values are BCP 47 codes.", 8284 // "location": "query", 8285 // "type": "string" 8286 // }, 8287 // "pinned": { 8288 // "default": "false", 8289 // "description": "Whether to pin the head revision of the new copy. A file can have a maximum of 200 pinned revisions.", 8290 // "location": "query", 8291 // "type": "boolean" 8292 // }, 8293 // "supportsAllDrives": { 8294 // "default": "false", 8295 // "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.", 8296 // "location": "query", 8297 // "type": "boolean" 8298 // }, 8299 // "supportsTeamDrives": { 8300 // "default": "false", 8301 // "description": "Deprecated use supportsAllDrives instead.", 8302 // "location": "query", 8303 // "type": "boolean" 8304 // }, 8305 // "timedTextLanguage": { 8306 // "description": "The language of the timed text.", 8307 // "location": "query", 8308 // "type": "string" 8309 // }, 8310 // "timedTextTrackName": { 8311 // "description": "The timed text track name.", 8312 // "location": "query", 8313 // "type": "string" 8314 // }, 8315 // "visibility": { 8316 // "default": "DEFAULT", 8317 // "description": "The visibility of the new file. This parameter is only relevant when the source is not a native Google Doc and convert=false.", 8318 // "enum": [ 8319 // "DEFAULT", 8320 // "PRIVATE" 8321 // ], 8322 // "enumDescriptions": [ 8323 // "The visibility of the new file is determined by the user's default visibility/sharing policies.", 8324 // "The new file will be visible to only the owner." 8325 // ], 8326 // "location": "query", 8327 // "type": "string" 8328 // } 8329 // }, 8330 // "path": "files/{fileId}/copy", 8331 // "request": { 8332 // "$ref": "File" 8333 // }, 8334 // "response": { 8335 // "$ref": "File" 8336 // }, 8337 // "scopes": [ 8338 // "https://www.googleapis.com/auth/drive", 8339 // "https://www.googleapis.com/auth/drive.appdata", 8340 // "https://www.googleapis.com/auth/drive.apps.readonly", 8341 // "https://www.googleapis.com/auth/drive.file", 8342 // "https://www.googleapis.com/auth/drive.photos.readonly" 8343 // ] 8344 // } 8345 8346} 8347 8348// method id "drive.files.delete": 8349 8350type FilesDeleteCall struct { 8351 s *Service 8352 fileId string 8353 urlParams_ gensupport.URLParams 8354 ctx_ context.Context 8355 header_ http.Header 8356} 8357 8358// Delete: Permanently deletes a file by ID. Skips the trash. The 8359// currently authenticated user must own the file or be an organizer on 8360// the parent for shared drive files. 8361func (r *FilesService) Delete(fileId string) *FilesDeleteCall { 8362 c := &FilesDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)} 8363 c.fileId = fileId 8364 return c 8365} 8366 8367// SupportsAllDrives sets the optional parameter "supportsAllDrives": 8368// Deprecated - Whether the requesting application supports both My 8369// Drives and shared drives. This parameter will only be effective until 8370// June 1, 2020. Afterwards all applications are assumed to support 8371// shared drives. 8372func (c *FilesDeleteCall) SupportsAllDrives(supportsAllDrives bool) *FilesDeleteCall { 8373 c.urlParams_.Set("supportsAllDrives", fmt.Sprint(supportsAllDrives)) 8374 return c 8375} 8376 8377// SupportsTeamDrives sets the optional parameter "supportsTeamDrives": 8378// Deprecated use supportsAllDrives instead. 8379func (c *FilesDeleteCall) SupportsTeamDrives(supportsTeamDrives bool) *FilesDeleteCall { 8380 c.urlParams_.Set("supportsTeamDrives", fmt.Sprint(supportsTeamDrives)) 8381 return c 8382} 8383 8384// Fields allows partial responses to be retrieved. See 8385// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 8386// for more information. 8387func (c *FilesDeleteCall) Fields(s ...googleapi.Field) *FilesDeleteCall { 8388 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 8389 return c 8390} 8391 8392// Context sets the context to be used in this call's Do method. Any 8393// pending HTTP request will be aborted if the provided context is 8394// canceled. 8395func (c *FilesDeleteCall) Context(ctx context.Context) *FilesDeleteCall { 8396 c.ctx_ = ctx 8397 return c 8398} 8399 8400// Header returns an http.Header that can be modified by the caller to 8401// add HTTP headers to the request. 8402func (c *FilesDeleteCall) Header() http.Header { 8403 if c.header_ == nil { 8404 c.header_ = make(http.Header) 8405 } 8406 return c.header_ 8407} 8408 8409func (c *FilesDeleteCall) doRequest(alt string) (*http.Response, error) { 8410 reqHeaders := make(http.Header) 8411 for k, v := range c.header_ { 8412 reqHeaders[k] = v 8413 } 8414 reqHeaders.Set("User-Agent", c.s.userAgent()) 8415 var body io.Reader = nil 8416 c.urlParams_.Set("alt", alt) 8417 c.urlParams_.Set("prettyPrint", "false") 8418 urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}") 8419 urls += "?" + c.urlParams_.Encode() 8420 req, err := http.NewRequest("DELETE", urls, body) 8421 if err != nil { 8422 return nil, err 8423 } 8424 req.Header = reqHeaders 8425 googleapi.Expand(req.URL, map[string]string{ 8426 "fileId": c.fileId, 8427 }) 8428 return gensupport.SendRequest(c.ctx_, c.s.client, req) 8429} 8430 8431// Do executes the "drive.files.delete" call. 8432func (c *FilesDeleteCall) Do(opts ...googleapi.CallOption) error { 8433 gensupport.SetOptions(c.urlParams_, opts...) 8434 res, err := c.doRequest("json") 8435 if err != nil { 8436 return err 8437 } 8438 defer googleapi.CloseBody(res) 8439 if err := googleapi.CheckResponse(res); err != nil { 8440 return err 8441 } 8442 return nil 8443 // { 8444 // "description": "Permanently deletes a file by ID. Skips the trash. The currently authenticated user must own the file or be an organizer on the parent for shared drive files.", 8445 // "httpMethod": "DELETE", 8446 // "id": "drive.files.delete", 8447 // "parameterOrder": [ 8448 // "fileId" 8449 // ], 8450 // "parameters": { 8451 // "fileId": { 8452 // "description": "The ID of the file to delete.", 8453 // "location": "path", 8454 // "required": true, 8455 // "type": "string" 8456 // }, 8457 // "supportsAllDrives": { 8458 // "default": "false", 8459 // "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.", 8460 // "location": "query", 8461 // "type": "boolean" 8462 // }, 8463 // "supportsTeamDrives": { 8464 // "default": "false", 8465 // "description": "Deprecated use supportsAllDrives instead.", 8466 // "location": "query", 8467 // "type": "boolean" 8468 // } 8469 // }, 8470 // "path": "files/{fileId}", 8471 // "scopes": [ 8472 // "https://www.googleapis.com/auth/drive", 8473 // "https://www.googleapis.com/auth/drive.appdata", 8474 // "https://www.googleapis.com/auth/drive.file" 8475 // ] 8476 // } 8477 8478} 8479 8480// method id "drive.files.emptyTrash": 8481 8482type FilesEmptyTrashCall struct { 8483 s *Service 8484 urlParams_ gensupport.URLParams 8485 ctx_ context.Context 8486 header_ http.Header 8487} 8488 8489// EmptyTrash: Permanently deletes all of the user's trashed files. 8490func (r *FilesService) EmptyTrash() *FilesEmptyTrashCall { 8491 c := &FilesEmptyTrashCall{s: r.s, urlParams_: make(gensupport.URLParams)} 8492 return c 8493} 8494 8495// Fields allows partial responses to be retrieved. See 8496// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 8497// for more information. 8498func (c *FilesEmptyTrashCall) Fields(s ...googleapi.Field) *FilesEmptyTrashCall { 8499 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 8500 return c 8501} 8502 8503// Context sets the context to be used in this call's Do method. Any 8504// pending HTTP request will be aborted if the provided context is 8505// canceled. 8506func (c *FilesEmptyTrashCall) Context(ctx context.Context) *FilesEmptyTrashCall { 8507 c.ctx_ = ctx 8508 return c 8509} 8510 8511// Header returns an http.Header that can be modified by the caller to 8512// add HTTP headers to the request. 8513func (c *FilesEmptyTrashCall) Header() http.Header { 8514 if c.header_ == nil { 8515 c.header_ = make(http.Header) 8516 } 8517 return c.header_ 8518} 8519 8520func (c *FilesEmptyTrashCall) doRequest(alt string) (*http.Response, error) { 8521 reqHeaders := make(http.Header) 8522 for k, v := range c.header_ { 8523 reqHeaders[k] = v 8524 } 8525 reqHeaders.Set("User-Agent", c.s.userAgent()) 8526 var body io.Reader = nil 8527 c.urlParams_.Set("alt", alt) 8528 c.urlParams_.Set("prettyPrint", "false") 8529 urls := googleapi.ResolveRelative(c.s.BasePath, "files/trash") 8530 urls += "?" + c.urlParams_.Encode() 8531 req, err := http.NewRequest("DELETE", urls, body) 8532 if err != nil { 8533 return nil, err 8534 } 8535 req.Header = reqHeaders 8536 return gensupport.SendRequest(c.ctx_, c.s.client, req) 8537} 8538 8539// Do executes the "drive.files.emptyTrash" call. 8540func (c *FilesEmptyTrashCall) Do(opts ...googleapi.CallOption) error { 8541 gensupport.SetOptions(c.urlParams_, opts...) 8542 res, err := c.doRequest("json") 8543 if err != nil { 8544 return err 8545 } 8546 defer googleapi.CloseBody(res) 8547 if err := googleapi.CheckResponse(res); err != nil { 8548 return err 8549 } 8550 return nil 8551 // { 8552 // "description": "Permanently deletes all of the user's trashed files.", 8553 // "httpMethod": "DELETE", 8554 // "id": "drive.files.emptyTrash", 8555 // "path": "files/trash", 8556 // "scopes": [ 8557 // "https://www.googleapis.com/auth/drive" 8558 // ] 8559 // } 8560 8561} 8562 8563// method id "drive.files.export": 8564 8565type FilesExportCall struct { 8566 s *Service 8567 fileId string 8568 urlParams_ gensupport.URLParams 8569 ifNoneMatch_ string 8570 ctx_ context.Context 8571 header_ http.Header 8572} 8573 8574// Export: Exports a Google Doc to the requested MIME type and returns 8575// the exported content. Please note that the exported content is 8576// limited to 10MB. 8577func (r *FilesService) Export(fileId string, mimeType string) *FilesExportCall { 8578 c := &FilesExportCall{s: r.s, urlParams_: make(gensupport.URLParams)} 8579 c.fileId = fileId 8580 c.urlParams_.Set("mimeType", mimeType) 8581 return c 8582} 8583 8584// Fields allows partial responses to be retrieved. See 8585// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 8586// for more information. 8587func (c *FilesExportCall) Fields(s ...googleapi.Field) *FilesExportCall { 8588 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 8589 return c 8590} 8591 8592// IfNoneMatch sets the optional parameter which makes the operation 8593// fail if the object's ETag matches the given value. This is useful for 8594// getting updates only after the object has changed since the last 8595// request. Use googleapi.IsNotModified to check whether the response 8596// error from Do is the result of In-None-Match. 8597func (c *FilesExportCall) IfNoneMatch(entityTag string) *FilesExportCall { 8598 c.ifNoneMatch_ = entityTag 8599 return c 8600} 8601 8602// Context sets the context to be used in this call's Do and Download 8603// methods. Any pending HTTP request will be aborted if the provided 8604// context is canceled. 8605func (c *FilesExportCall) Context(ctx context.Context) *FilesExportCall { 8606 c.ctx_ = ctx 8607 return c 8608} 8609 8610// Header returns an http.Header that can be modified by the caller to 8611// add HTTP headers to the request. 8612func (c *FilesExportCall) Header() http.Header { 8613 if c.header_ == nil { 8614 c.header_ = make(http.Header) 8615 } 8616 return c.header_ 8617} 8618 8619func (c *FilesExportCall) doRequest(alt string) (*http.Response, error) { 8620 reqHeaders := make(http.Header) 8621 for k, v := range c.header_ { 8622 reqHeaders[k] = v 8623 } 8624 reqHeaders.Set("User-Agent", c.s.userAgent()) 8625 if c.ifNoneMatch_ != "" { 8626 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 8627 } 8628 var body io.Reader = nil 8629 c.urlParams_.Set("alt", alt) 8630 c.urlParams_.Set("prettyPrint", "false") 8631 urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/export") 8632 urls += "?" + c.urlParams_.Encode() 8633 req, err := http.NewRequest("GET", urls, body) 8634 if err != nil { 8635 return nil, err 8636 } 8637 req.Header = reqHeaders 8638 googleapi.Expand(req.URL, map[string]string{ 8639 "fileId": c.fileId, 8640 }) 8641 return gensupport.SendRequest(c.ctx_, c.s.client, req) 8642} 8643 8644// Download fetches the API endpoint's "media" value, instead of the normal 8645// API response value. If the returned error is nil, the Response is guaranteed to 8646// have a 2xx status code. Callers must close the Response.Body as usual. 8647func (c *FilesExportCall) Download(opts ...googleapi.CallOption) (*http.Response, error) { 8648 gensupport.SetOptions(c.urlParams_, opts...) 8649 res, err := c.doRequest("media") 8650 if err != nil { 8651 return nil, err 8652 } 8653 if err := googleapi.CheckMediaResponse(res); err != nil { 8654 res.Body.Close() 8655 return nil, err 8656 } 8657 return res, nil 8658} 8659 8660// Do executes the "drive.files.export" call. 8661func (c *FilesExportCall) Do(opts ...googleapi.CallOption) error { 8662 gensupport.SetOptions(c.urlParams_, opts...) 8663 res, err := c.doRequest("json") 8664 if err != nil { 8665 return err 8666 } 8667 defer googleapi.CloseBody(res) 8668 if err := googleapi.CheckResponse(res); err != nil { 8669 return err 8670 } 8671 return nil 8672 // { 8673 // "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.", 8674 // "httpMethod": "GET", 8675 // "id": "drive.files.export", 8676 // "parameterOrder": [ 8677 // "fileId", 8678 // "mimeType" 8679 // ], 8680 // "parameters": { 8681 // "fileId": { 8682 // "description": "The ID of the file.", 8683 // "location": "path", 8684 // "required": true, 8685 // "type": "string" 8686 // }, 8687 // "mimeType": { 8688 // "description": "The MIME type of the format requested for this export.", 8689 // "location": "query", 8690 // "required": true, 8691 // "type": "string" 8692 // } 8693 // }, 8694 // "path": "files/{fileId}/export", 8695 // "scopes": [ 8696 // "https://www.googleapis.com/auth/drive", 8697 // "https://www.googleapis.com/auth/drive.file", 8698 // "https://www.googleapis.com/auth/drive.readonly" 8699 // ], 8700 // "supportsMediaDownload": true 8701 // } 8702 8703} 8704 8705// method id "drive.files.generateIds": 8706 8707type FilesGenerateIdsCall struct { 8708 s *Service 8709 urlParams_ gensupport.URLParams 8710 ifNoneMatch_ string 8711 ctx_ context.Context 8712 header_ http.Header 8713} 8714 8715// GenerateIds: Generates a set of file IDs which can be provided in 8716// insert requests. 8717func (r *FilesService) GenerateIds() *FilesGenerateIdsCall { 8718 c := &FilesGenerateIdsCall{s: r.s, urlParams_: make(gensupport.URLParams)} 8719 return c 8720} 8721 8722// MaxResults sets the optional parameter "maxResults": Maximum number 8723// of IDs to return. 8724func (c *FilesGenerateIdsCall) MaxResults(maxResults int64) *FilesGenerateIdsCall { 8725 c.urlParams_.Set("maxResults", fmt.Sprint(maxResults)) 8726 return c 8727} 8728 8729// Space sets the optional parameter "space": The space in which the IDs 8730// can be used to create new files. Supported values are 'drive' and 8731// 'appDataFolder'. 8732func (c *FilesGenerateIdsCall) Space(space string) *FilesGenerateIdsCall { 8733 c.urlParams_.Set("space", space) 8734 return c 8735} 8736 8737// Fields allows partial responses to be retrieved. See 8738// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 8739// for more information. 8740func (c *FilesGenerateIdsCall) Fields(s ...googleapi.Field) *FilesGenerateIdsCall { 8741 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 8742 return c 8743} 8744 8745// IfNoneMatch sets the optional parameter which makes the operation 8746// fail if the object's ETag matches the given value. This is useful for 8747// getting updates only after the object has changed since the last 8748// request. Use googleapi.IsNotModified to check whether the response 8749// error from Do is the result of In-None-Match. 8750func (c *FilesGenerateIdsCall) IfNoneMatch(entityTag string) *FilesGenerateIdsCall { 8751 c.ifNoneMatch_ = entityTag 8752 return c 8753} 8754 8755// Context sets the context to be used in this call's Do method. Any 8756// pending HTTP request will be aborted if the provided context is 8757// canceled. 8758func (c *FilesGenerateIdsCall) Context(ctx context.Context) *FilesGenerateIdsCall { 8759 c.ctx_ = ctx 8760 return c 8761} 8762 8763// Header returns an http.Header that can be modified by the caller to 8764// add HTTP headers to the request. 8765func (c *FilesGenerateIdsCall) Header() http.Header { 8766 if c.header_ == nil { 8767 c.header_ = make(http.Header) 8768 } 8769 return c.header_ 8770} 8771 8772func (c *FilesGenerateIdsCall) doRequest(alt string) (*http.Response, error) { 8773 reqHeaders := make(http.Header) 8774 for k, v := range c.header_ { 8775 reqHeaders[k] = v 8776 } 8777 reqHeaders.Set("User-Agent", c.s.userAgent()) 8778 if c.ifNoneMatch_ != "" { 8779 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 8780 } 8781 var body io.Reader = nil 8782 c.urlParams_.Set("alt", alt) 8783 c.urlParams_.Set("prettyPrint", "false") 8784 urls := googleapi.ResolveRelative(c.s.BasePath, "files/generateIds") 8785 urls += "?" + c.urlParams_.Encode() 8786 req, err := http.NewRequest("GET", urls, body) 8787 if err != nil { 8788 return nil, err 8789 } 8790 req.Header = reqHeaders 8791 return gensupport.SendRequest(c.ctx_, c.s.client, req) 8792} 8793 8794// Do executes the "drive.files.generateIds" call. 8795// Exactly one of *GeneratedIds or error will be non-nil. Any non-2xx 8796// status code is an error. Response headers are in either 8797// *GeneratedIds.ServerResponse.Header or (if a response was returned at 8798// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 8799// to check whether the returned error was because 8800// http.StatusNotModified was returned. 8801func (c *FilesGenerateIdsCall) Do(opts ...googleapi.CallOption) (*GeneratedIds, error) { 8802 gensupport.SetOptions(c.urlParams_, opts...) 8803 res, err := c.doRequest("json") 8804 if res != nil && res.StatusCode == http.StatusNotModified { 8805 if res.Body != nil { 8806 res.Body.Close() 8807 } 8808 return nil, &googleapi.Error{ 8809 Code: res.StatusCode, 8810 Header: res.Header, 8811 } 8812 } 8813 if err != nil { 8814 return nil, err 8815 } 8816 defer googleapi.CloseBody(res) 8817 if err := googleapi.CheckResponse(res); err != nil { 8818 return nil, err 8819 } 8820 ret := &GeneratedIds{ 8821 ServerResponse: googleapi.ServerResponse{ 8822 Header: res.Header, 8823 HTTPStatusCode: res.StatusCode, 8824 }, 8825 } 8826 target := &ret 8827 if err := gensupport.DecodeResponse(target, res); err != nil { 8828 return nil, err 8829 } 8830 return ret, nil 8831 // { 8832 // "description": "Generates a set of file IDs which can be provided in insert requests.", 8833 // "httpMethod": "GET", 8834 // "id": "drive.files.generateIds", 8835 // "parameters": { 8836 // "maxResults": { 8837 // "default": "10", 8838 // "description": "Maximum number of IDs to return.", 8839 // "format": "int32", 8840 // "location": "query", 8841 // "maximum": "1000", 8842 // "minimum": "1", 8843 // "type": "integer" 8844 // }, 8845 // "space": { 8846 // "default": "drive", 8847 // "description": "The space in which the IDs can be used to create new files. Supported values are 'drive' and 'appDataFolder'.", 8848 // "location": "query", 8849 // "type": "string" 8850 // } 8851 // }, 8852 // "path": "files/generateIds", 8853 // "response": { 8854 // "$ref": "GeneratedIds" 8855 // }, 8856 // "scopes": [ 8857 // "https://www.googleapis.com/auth/drive", 8858 // "https://www.googleapis.com/auth/drive.appdata", 8859 // "https://www.googleapis.com/auth/drive.file" 8860 // ] 8861 // } 8862 8863} 8864 8865// method id "drive.files.get": 8866 8867type FilesGetCall struct { 8868 s *Service 8869 fileId string 8870 urlParams_ gensupport.URLParams 8871 ifNoneMatch_ string 8872 ctx_ context.Context 8873 header_ http.Header 8874} 8875 8876// Get: Gets a file's metadata by ID. 8877func (r *FilesService) Get(fileId string) *FilesGetCall { 8878 c := &FilesGetCall{s: r.s, urlParams_: make(gensupport.URLParams)} 8879 c.fileId = fileId 8880 return c 8881} 8882 8883// AcknowledgeAbuse sets the optional parameter "acknowledgeAbuse": 8884// Whether the user is acknowledging the risk of downloading known 8885// malware or other abusive files. 8886func (c *FilesGetCall) AcknowledgeAbuse(acknowledgeAbuse bool) *FilesGetCall { 8887 c.urlParams_.Set("acknowledgeAbuse", fmt.Sprint(acknowledgeAbuse)) 8888 return c 8889} 8890 8891// Projection sets the optional parameter "projection": This parameter 8892// is deprecated and has no function. 8893// 8894// Possible values: 8895// "BASIC" - Deprecated 8896// "FULL" - Deprecated 8897func (c *FilesGetCall) Projection(projection string) *FilesGetCall { 8898 c.urlParams_.Set("projection", projection) 8899 return c 8900} 8901 8902// RevisionId sets the optional parameter "revisionId": Specifies the 8903// Revision ID that should be downloaded. Ignored unless alt=media is 8904// specified. 8905func (c *FilesGetCall) RevisionId(revisionId string) *FilesGetCall { 8906 c.urlParams_.Set("revisionId", revisionId) 8907 return c 8908} 8909 8910// SupportsAllDrives sets the optional parameter "supportsAllDrives": 8911// Deprecated - Whether the requesting application supports both My 8912// Drives and shared drives. This parameter will only be effective until 8913// June 1, 2020. Afterwards all applications are assumed to support 8914// shared drives. 8915func (c *FilesGetCall) SupportsAllDrives(supportsAllDrives bool) *FilesGetCall { 8916 c.urlParams_.Set("supportsAllDrives", fmt.Sprint(supportsAllDrives)) 8917 return c 8918} 8919 8920// SupportsTeamDrives sets the optional parameter "supportsTeamDrives": 8921// Deprecated use supportsAllDrives instead. 8922func (c *FilesGetCall) SupportsTeamDrives(supportsTeamDrives bool) *FilesGetCall { 8923 c.urlParams_.Set("supportsTeamDrives", fmt.Sprint(supportsTeamDrives)) 8924 return c 8925} 8926 8927// UpdateViewedDate sets the optional parameter "updateViewedDate": 8928// Deprecated: Use files.update with modifiedDateBehavior=noChange, 8929// updateViewedDate=true and an empty request body. 8930func (c *FilesGetCall) UpdateViewedDate(updateViewedDate bool) *FilesGetCall { 8931 c.urlParams_.Set("updateViewedDate", fmt.Sprint(updateViewedDate)) 8932 return c 8933} 8934 8935// Fields allows partial responses to be retrieved. See 8936// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 8937// for more information. 8938func (c *FilesGetCall) Fields(s ...googleapi.Field) *FilesGetCall { 8939 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 8940 return c 8941} 8942 8943// IfNoneMatch sets the optional parameter which makes the operation 8944// fail if the object's ETag matches the given value. This is useful for 8945// getting updates only after the object has changed since the last 8946// request. Use googleapi.IsNotModified to check whether the response 8947// error from Do is the result of In-None-Match. 8948func (c *FilesGetCall) IfNoneMatch(entityTag string) *FilesGetCall { 8949 c.ifNoneMatch_ = entityTag 8950 return c 8951} 8952 8953// Context sets the context to be used in this call's Do and Download 8954// methods. Any pending HTTP request will be aborted if the provided 8955// context is canceled. 8956func (c *FilesGetCall) Context(ctx context.Context) *FilesGetCall { 8957 c.ctx_ = ctx 8958 return c 8959} 8960 8961// Header returns an http.Header that can be modified by the caller to 8962// add HTTP headers to the request. 8963func (c *FilesGetCall) Header() http.Header { 8964 if c.header_ == nil { 8965 c.header_ = make(http.Header) 8966 } 8967 return c.header_ 8968} 8969 8970func (c *FilesGetCall) doRequest(alt string) (*http.Response, error) { 8971 reqHeaders := make(http.Header) 8972 for k, v := range c.header_ { 8973 reqHeaders[k] = v 8974 } 8975 reqHeaders.Set("User-Agent", c.s.userAgent()) 8976 if c.ifNoneMatch_ != "" { 8977 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 8978 } 8979 var body io.Reader = nil 8980 c.urlParams_.Set("alt", alt) 8981 c.urlParams_.Set("prettyPrint", "false") 8982 urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}") 8983 urls += "?" + c.urlParams_.Encode() 8984 req, err := http.NewRequest("GET", urls, body) 8985 if err != nil { 8986 return nil, err 8987 } 8988 req.Header = reqHeaders 8989 googleapi.Expand(req.URL, map[string]string{ 8990 "fileId": c.fileId, 8991 }) 8992 return gensupport.SendRequest(c.ctx_, c.s.client, req) 8993} 8994 8995// Download fetches the API endpoint's "media" value, instead of the normal 8996// API response value. If the returned error is nil, the Response is guaranteed to 8997// have a 2xx status code. Callers must close the Response.Body as usual. 8998func (c *FilesGetCall) Download(opts ...googleapi.CallOption) (*http.Response, error) { 8999 gensupport.SetOptions(c.urlParams_, opts...) 9000 res, err := c.doRequest("media") 9001 if err != nil { 9002 return nil, err 9003 } 9004 if err := googleapi.CheckMediaResponse(res); err != nil { 9005 res.Body.Close() 9006 return nil, err 9007 } 9008 return res, nil 9009} 9010 9011// Do executes the "drive.files.get" call. 9012// Exactly one of *File or error will be non-nil. Any non-2xx status 9013// code is an error. Response headers are in either 9014// *File.ServerResponse.Header or (if a response was returned at all) in 9015// error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check 9016// whether the returned error was because http.StatusNotModified was 9017// returned. 9018func (c *FilesGetCall) Do(opts ...googleapi.CallOption) (*File, error) { 9019 gensupport.SetOptions(c.urlParams_, opts...) 9020 res, err := c.doRequest("json") 9021 if res != nil && res.StatusCode == http.StatusNotModified { 9022 if res.Body != nil { 9023 res.Body.Close() 9024 } 9025 return nil, &googleapi.Error{ 9026 Code: res.StatusCode, 9027 Header: res.Header, 9028 } 9029 } 9030 if err != nil { 9031 return nil, err 9032 } 9033 defer googleapi.CloseBody(res) 9034 if err := googleapi.CheckResponse(res); err != nil { 9035 return nil, err 9036 } 9037 ret := &File{ 9038 ServerResponse: googleapi.ServerResponse{ 9039 Header: res.Header, 9040 HTTPStatusCode: res.StatusCode, 9041 }, 9042 } 9043 target := &ret 9044 if err := gensupport.DecodeResponse(target, res); err != nil { 9045 return nil, err 9046 } 9047 return ret, nil 9048 // { 9049 // "description": "Gets a file's metadata by ID.", 9050 // "httpMethod": "GET", 9051 // "id": "drive.files.get", 9052 // "parameterOrder": [ 9053 // "fileId" 9054 // ], 9055 // "parameters": { 9056 // "acknowledgeAbuse": { 9057 // "default": "false", 9058 // "description": "Whether the user is acknowledging the risk of downloading known malware or other abusive files.", 9059 // "location": "query", 9060 // "type": "boolean" 9061 // }, 9062 // "fileId": { 9063 // "description": "The ID for the file in question.", 9064 // "location": "path", 9065 // "required": true, 9066 // "type": "string" 9067 // }, 9068 // "projection": { 9069 // "description": "This parameter is deprecated and has no function.", 9070 // "enum": [ 9071 // "BASIC", 9072 // "FULL" 9073 // ], 9074 // "enumDescriptions": [ 9075 // "Deprecated", 9076 // "Deprecated" 9077 // ], 9078 // "location": "query", 9079 // "type": "string" 9080 // }, 9081 // "revisionId": { 9082 // "description": "Specifies the Revision ID that should be downloaded. Ignored unless alt=media is specified.", 9083 // "location": "query", 9084 // "type": "string" 9085 // }, 9086 // "supportsAllDrives": { 9087 // "default": "false", 9088 // "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.", 9089 // "location": "query", 9090 // "type": "boolean" 9091 // }, 9092 // "supportsTeamDrives": { 9093 // "default": "false", 9094 // "description": "Deprecated use supportsAllDrives instead.", 9095 // "location": "query", 9096 // "type": "boolean" 9097 // }, 9098 // "updateViewedDate": { 9099 // "default": "false", 9100 // "description": "Deprecated: Use files.update with modifiedDateBehavior=noChange, updateViewedDate=true and an empty request body.", 9101 // "location": "query", 9102 // "type": "boolean" 9103 // } 9104 // }, 9105 // "path": "files/{fileId}", 9106 // "response": { 9107 // "$ref": "File" 9108 // }, 9109 // "scopes": [ 9110 // "https://www.googleapis.com/auth/drive", 9111 // "https://www.googleapis.com/auth/drive.appdata", 9112 // "https://www.googleapis.com/auth/drive.file", 9113 // "https://www.googleapis.com/auth/drive.metadata", 9114 // "https://www.googleapis.com/auth/drive.metadata.readonly", 9115 // "https://www.googleapis.com/auth/drive.photos.readonly", 9116 // "https://www.googleapis.com/auth/drive.readonly" 9117 // ], 9118 // "supportsMediaDownload": true, 9119 // "supportsSubscription": true, 9120 // "useMediaDownloadService": true 9121 // } 9122 9123} 9124 9125// method id "drive.files.insert": 9126 9127type FilesInsertCall struct { 9128 s *Service 9129 file *File 9130 urlParams_ gensupport.URLParams 9131 mediaInfo_ *gensupport.MediaInfo 9132 ctx_ context.Context 9133 header_ http.Header 9134} 9135 9136// Insert: Insert a new file. 9137func (r *FilesService) Insert(file *File) *FilesInsertCall { 9138 c := &FilesInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)} 9139 c.file = file 9140 return c 9141} 9142 9143// Convert sets the optional parameter "convert": Whether to convert 9144// this file to the corresponding Google Docs format. 9145func (c *FilesInsertCall) Convert(convert bool) *FilesInsertCall { 9146 c.urlParams_.Set("convert", fmt.Sprint(convert)) 9147 return c 9148} 9149 9150// Ocr sets the optional parameter "ocr": Whether to attempt OCR on 9151// .jpg, .png, .gif, or .pdf uploads. 9152func (c *FilesInsertCall) Ocr(ocr bool) *FilesInsertCall { 9153 c.urlParams_.Set("ocr", fmt.Sprint(ocr)) 9154 return c 9155} 9156 9157// OcrLanguage sets the optional parameter "ocrLanguage": If ocr is 9158// true, hints at the language to use. Valid values are BCP 47 codes. 9159func (c *FilesInsertCall) OcrLanguage(ocrLanguage string) *FilesInsertCall { 9160 c.urlParams_.Set("ocrLanguage", ocrLanguage) 9161 return c 9162} 9163 9164// Pinned sets the optional parameter "pinned": Whether to pin the head 9165// revision of the uploaded file. A file can have a maximum of 200 9166// pinned revisions. 9167func (c *FilesInsertCall) Pinned(pinned bool) *FilesInsertCall { 9168 c.urlParams_.Set("pinned", fmt.Sprint(pinned)) 9169 return c 9170} 9171 9172// SupportsAllDrives sets the optional parameter "supportsAllDrives": 9173// Deprecated - Whether the requesting application supports both My 9174// Drives and shared drives. This parameter will only be effective until 9175// June 1, 2020. Afterwards all applications are assumed to support 9176// shared drives. 9177func (c *FilesInsertCall) SupportsAllDrives(supportsAllDrives bool) *FilesInsertCall { 9178 c.urlParams_.Set("supportsAllDrives", fmt.Sprint(supportsAllDrives)) 9179 return c 9180} 9181 9182// SupportsTeamDrives sets the optional parameter "supportsTeamDrives": 9183// Deprecated use supportsAllDrives instead. 9184func (c *FilesInsertCall) SupportsTeamDrives(supportsTeamDrives bool) *FilesInsertCall { 9185 c.urlParams_.Set("supportsTeamDrives", fmt.Sprint(supportsTeamDrives)) 9186 return c 9187} 9188 9189// TimedTextLanguage sets the optional parameter "timedTextLanguage": 9190// The language of the timed text. 9191func (c *FilesInsertCall) TimedTextLanguage(timedTextLanguage string) *FilesInsertCall { 9192 c.urlParams_.Set("timedTextLanguage", timedTextLanguage) 9193 return c 9194} 9195 9196// TimedTextTrackName sets the optional parameter "timedTextTrackName": 9197// The timed text track name. 9198func (c *FilesInsertCall) TimedTextTrackName(timedTextTrackName string) *FilesInsertCall { 9199 c.urlParams_.Set("timedTextTrackName", timedTextTrackName) 9200 return c 9201} 9202 9203// UseContentAsIndexableText sets the optional parameter 9204// "useContentAsIndexableText": Whether to use the content as indexable 9205// text. 9206func (c *FilesInsertCall) UseContentAsIndexableText(useContentAsIndexableText bool) *FilesInsertCall { 9207 c.urlParams_.Set("useContentAsIndexableText", fmt.Sprint(useContentAsIndexableText)) 9208 return c 9209} 9210 9211// Visibility sets the optional parameter "visibility": The visibility 9212// of the new file. This parameter is only relevant when convert=false. 9213// 9214// Possible values: 9215// "DEFAULT" (default) - The visibility of the new file is determined 9216// by the user's default visibility/sharing policies. 9217// "PRIVATE" - The new file will be visible to only the owner. 9218func (c *FilesInsertCall) Visibility(visibility string) *FilesInsertCall { 9219 c.urlParams_.Set("visibility", visibility) 9220 return c 9221} 9222 9223// Media specifies the media to upload in one or more chunks. The chunk 9224// size may be controlled by supplying a MediaOption generated by 9225// googleapi.ChunkSize. The chunk size defaults to 9226// googleapi.DefaultUploadChunkSize.The Content-Type header used in the 9227// upload request will be determined by sniffing the contents of r, 9228// unless a MediaOption generated by googleapi.ContentType is 9229// supplied. 9230// At most one of Media and ResumableMedia may be set. 9231func (c *FilesInsertCall) Media(r io.Reader, options ...googleapi.MediaOption) *FilesInsertCall { 9232 c.mediaInfo_ = gensupport.NewInfoFromMedia(r, options) 9233 return c 9234} 9235 9236// ResumableMedia specifies the media to upload in chunks and can be 9237// canceled with ctx. 9238// 9239// Deprecated: use Media instead. 9240// 9241// At most one of Media and ResumableMedia may be set. mediaType 9242// identifies the MIME media type of the upload, such as "image/png". If 9243// mediaType is "", it will be auto-detected. The provided ctx will 9244// supersede any context previously provided to the Context method. 9245func (c *FilesInsertCall) ResumableMedia(ctx context.Context, r io.ReaderAt, size int64, mediaType string) *FilesInsertCall { 9246 c.ctx_ = ctx 9247 c.mediaInfo_ = gensupport.NewInfoFromResumableMedia(r, size, mediaType) 9248 return c 9249} 9250 9251// ProgressUpdater provides a callback function that will be called 9252// after every chunk. It should be a low-latency function in order to 9253// not slow down the upload operation. This should only be called when 9254// using ResumableMedia (as opposed to Media). 9255func (c *FilesInsertCall) ProgressUpdater(pu googleapi.ProgressUpdater) *FilesInsertCall { 9256 c.mediaInfo_.SetProgressUpdater(pu) 9257 return c 9258} 9259 9260// Fields allows partial responses to be retrieved. See 9261// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 9262// for more information. 9263func (c *FilesInsertCall) Fields(s ...googleapi.Field) *FilesInsertCall { 9264 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 9265 return c 9266} 9267 9268// Context sets the context to be used in this call's Do method. Any 9269// pending HTTP request will be aborted if the provided context is 9270// canceled. 9271// This context will supersede any context previously provided to the 9272// ResumableMedia method. 9273func (c *FilesInsertCall) Context(ctx context.Context) *FilesInsertCall { 9274 c.ctx_ = ctx 9275 return c 9276} 9277 9278// Header returns an http.Header that can be modified by the caller to 9279// add HTTP headers to the request. 9280func (c *FilesInsertCall) Header() http.Header { 9281 if c.header_ == nil { 9282 c.header_ = make(http.Header) 9283 } 9284 return c.header_ 9285} 9286 9287func (c *FilesInsertCall) doRequest(alt string) (*http.Response, error) { 9288 reqHeaders := make(http.Header) 9289 for k, v := range c.header_ { 9290 reqHeaders[k] = v 9291 } 9292 reqHeaders.Set("User-Agent", c.s.userAgent()) 9293 var body io.Reader = nil 9294 body, err := googleapi.WithoutDataWrapper.JSONReader(c.file) 9295 if err != nil { 9296 return nil, err 9297 } 9298 reqHeaders.Set("Content-Type", "application/json") 9299 c.urlParams_.Set("alt", alt) 9300 c.urlParams_.Set("prettyPrint", "false") 9301 urls := googleapi.ResolveRelative(c.s.BasePath, "files") 9302 if c.mediaInfo_ != nil { 9303 urls = strings.Replace(urls, "https://www.googleapis.com/", "https://www.googleapis.com/upload/", 1) 9304 c.urlParams_.Set("uploadType", c.mediaInfo_.UploadType()) 9305 } 9306 if body == nil { 9307 body = new(bytes.Buffer) 9308 reqHeaders.Set("Content-Type", "application/json") 9309 } 9310 body, getBody, cleanup := c.mediaInfo_.UploadRequest(reqHeaders, body) 9311 defer cleanup() 9312 urls += "?" + c.urlParams_.Encode() 9313 req, err := http.NewRequest("POST", urls, body) 9314 if err != nil { 9315 return nil, err 9316 } 9317 req.Header = reqHeaders 9318 req.GetBody = getBody 9319 return gensupport.SendRequest(c.ctx_, c.s.client, req) 9320} 9321 9322// Do executes the "drive.files.insert" call. 9323// Exactly one of *File or error will be non-nil. Any non-2xx status 9324// code is an error. Response headers are in either 9325// *File.ServerResponse.Header or (if a response was returned at all) in 9326// error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check 9327// whether the returned error was because http.StatusNotModified was 9328// returned. 9329func (c *FilesInsertCall) Do(opts ...googleapi.CallOption) (*File, error) { 9330 gensupport.SetOptions(c.urlParams_, opts...) 9331 res, err := c.doRequest("json") 9332 if res != nil && res.StatusCode == http.StatusNotModified { 9333 if res.Body != nil { 9334 res.Body.Close() 9335 } 9336 return nil, &googleapi.Error{ 9337 Code: res.StatusCode, 9338 Header: res.Header, 9339 } 9340 } 9341 if err != nil { 9342 return nil, err 9343 } 9344 defer googleapi.CloseBody(res) 9345 if err := googleapi.CheckResponse(res); err != nil { 9346 return nil, err 9347 } 9348 rx := c.mediaInfo_.ResumableUpload(res.Header.Get("Location")) 9349 if rx != nil { 9350 rx.Client = c.s.client 9351 rx.UserAgent = c.s.userAgent() 9352 ctx := c.ctx_ 9353 if ctx == nil { 9354 ctx = context.TODO() 9355 } 9356 res, err = rx.Upload(ctx) 9357 if err != nil { 9358 return nil, err 9359 } 9360 defer res.Body.Close() 9361 if err := googleapi.CheckResponse(res); err != nil { 9362 return nil, err 9363 } 9364 } 9365 ret := &File{ 9366 ServerResponse: googleapi.ServerResponse{ 9367 Header: res.Header, 9368 HTTPStatusCode: res.StatusCode, 9369 }, 9370 } 9371 target := &ret 9372 if err := gensupport.DecodeResponse(target, res); err != nil { 9373 return nil, err 9374 } 9375 return ret, nil 9376 // { 9377 // "description": "Insert a new file.", 9378 // "httpMethod": "POST", 9379 // "id": "drive.files.insert", 9380 // "mediaUpload": { 9381 // "accept": [ 9382 // "*/*" 9383 // ], 9384 // "maxSize": "5120GB", 9385 // "protocols": { 9386 // "resumable": { 9387 // "multipart": true, 9388 // "path": "/resumable/upload/drive/v2/files" 9389 // }, 9390 // "simple": { 9391 // "multipart": true, 9392 // "path": "/upload/drive/v2/files" 9393 // } 9394 // } 9395 // }, 9396 // "parameters": { 9397 // "convert": { 9398 // "default": "false", 9399 // "description": "Whether to convert this file to the corresponding Google Docs format.", 9400 // "location": "query", 9401 // "type": "boolean" 9402 // }, 9403 // "ocr": { 9404 // "default": "false", 9405 // "description": "Whether to attempt OCR on .jpg, .png, .gif, or .pdf uploads.", 9406 // "location": "query", 9407 // "type": "boolean" 9408 // }, 9409 // "ocrLanguage": { 9410 // "description": "If ocr is true, hints at the language to use. Valid values are BCP 47 codes.", 9411 // "location": "query", 9412 // "type": "string" 9413 // }, 9414 // "pinned": { 9415 // "default": "false", 9416 // "description": "Whether to pin the head revision of the uploaded file. A file can have a maximum of 200 pinned revisions.", 9417 // "location": "query", 9418 // "type": "boolean" 9419 // }, 9420 // "supportsAllDrives": { 9421 // "default": "false", 9422 // "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.", 9423 // "location": "query", 9424 // "type": "boolean" 9425 // }, 9426 // "supportsTeamDrives": { 9427 // "default": "false", 9428 // "description": "Deprecated use supportsAllDrives instead.", 9429 // "location": "query", 9430 // "type": "boolean" 9431 // }, 9432 // "timedTextLanguage": { 9433 // "description": "The language of the timed text.", 9434 // "location": "query", 9435 // "type": "string" 9436 // }, 9437 // "timedTextTrackName": { 9438 // "description": "The timed text track name.", 9439 // "location": "query", 9440 // "type": "string" 9441 // }, 9442 // "useContentAsIndexableText": { 9443 // "default": "false", 9444 // "description": "Whether to use the content as indexable text.", 9445 // "location": "query", 9446 // "type": "boolean" 9447 // }, 9448 // "visibility": { 9449 // "default": "DEFAULT", 9450 // "description": "The visibility of the new file. This parameter is only relevant when convert=false.", 9451 // "enum": [ 9452 // "DEFAULT", 9453 // "PRIVATE" 9454 // ], 9455 // "enumDescriptions": [ 9456 // "The visibility of the new file is determined by the user's default visibility/sharing policies.", 9457 // "The new file will be visible to only the owner." 9458 // ], 9459 // "location": "query", 9460 // "type": "string" 9461 // } 9462 // }, 9463 // "path": "files", 9464 // "request": { 9465 // "$ref": "File" 9466 // }, 9467 // "response": { 9468 // "$ref": "File" 9469 // }, 9470 // "scopes": [ 9471 // "https://www.googleapis.com/auth/drive", 9472 // "https://www.googleapis.com/auth/drive.appdata", 9473 // "https://www.googleapis.com/auth/drive.apps.readonly", 9474 // "https://www.googleapis.com/auth/drive.file" 9475 // ], 9476 // "supportsMediaUpload": true, 9477 // "supportsSubscription": true 9478 // } 9479 9480} 9481 9482// method id "drive.files.list": 9483 9484type FilesListCall struct { 9485 s *Service 9486 urlParams_ gensupport.URLParams 9487 ifNoneMatch_ string 9488 ctx_ context.Context 9489 header_ http.Header 9490} 9491 9492// List: Lists the user's files. 9493func (r *FilesService) List() *FilesListCall { 9494 c := &FilesListCall{s: r.s, urlParams_: make(gensupport.URLParams)} 9495 return c 9496} 9497 9498// Corpora sets the optional parameter "corpora": Bodies of items 9499// (files/documents) to which the query applies. Supported bodies are 9500// 'default', 'domain', 'drive' and 'allDrives'. Prefer 'default' or 9501// 'drive' to 'allDrives' for efficiency. 9502func (c *FilesListCall) Corpora(corpora string) *FilesListCall { 9503 c.urlParams_.Set("corpora", corpora) 9504 return c 9505} 9506 9507// Corpus sets the optional parameter "corpus": The body of items 9508// (files/documents) to which the query applies. Deprecated: use 9509// 'corpora' instead. 9510// 9511// Possible values: 9512// "DEFAULT" - The items that the user has accessed. 9513// "DOMAIN" - Items shared to the user's domain. 9514func (c *FilesListCall) Corpus(corpus string) *FilesListCall { 9515 c.urlParams_.Set("corpus", corpus) 9516 return c 9517} 9518 9519// DriveId sets the optional parameter "driveId": ID of the shared drive 9520// to search. 9521func (c *FilesListCall) DriveId(driveId string) *FilesListCall { 9522 c.urlParams_.Set("driveId", driveId) 9523 return c 9524} 9525 9526// IncludeItemsFromAllDrives sets the optional parameter 9527// "includeItemsFromAllDrives": Deprecated - Whether both My Drive and 9528// shared drive items should be included in results. This parameter will 9529// only be effective until June 1, 2020. Afterwards shared drive items 9530// will be included in the results. 9531func (c *FilesListCall) IncludeItemsFromAllDrives(includeItemsFromAllDrives bool) *FilesListCall { 9532 c.urlParams_.Set("includeItemsFromAllDrives", fmt.Sprint(includeItemsFromAllDrives)) 9533 return c 9534} 9535 9536// IncludeTeamDriveItems sets the optional parameter 9537// "includeTeamDriveItems": Deprecated use includeItemsFromAllDrives 9538// instead. 9539func (c *FilesListCall) IncludeTeamDriveItems(includeTeamDriveItems bool) *FilesListCall { 9540 c.urlParams_.Set("includeTeamDriveItems", fmt.Sprint(includeTeamDriveItems)) 9541 return c 9542} 9543 9544// MaxResults sets the optional parameter "maxResults": The maximum 9545// number of files to return per page. Partial or empty result pages are 9546// possible even before the end of the files list has been reached. 9547func (c *FilesListCall) MaxResults(maxResults int64) *FilesListCall { 9548 c.urlParams_.Set("maxResults", fmt.Sprint(maxResults)) 9549 return c 9550} 9551 9552// OrderBy sets the optional parameter "orderBy": A comma-separated list 9553// of sort keys. Valid keys are 'createdDate', 'folder', 9554// 'lastViewedByMeDate', 'modifiedByMeDate', 'modifiedDate', 9555// 'quotaBytesUsed', 'recency', 'sharedWithMeDate', 'starred', 'title', 9556// and 'title_natural'. Each key sorts ascending by default, but may be 9557// reversed with the 'desc' modifier. Example usage: 9558// ?orderBy=folder,modifiedDate desc,title. Please note that there is a 9559// current limitation for users with approximately one million files in 9560// which the requested sort order is ignored. 9561func (c *FilesListCall) OrderBy(orderBy string) *FilesListCall { 9562 c.urlParams_.Set("orderBy", orderBy) 9563 return c 9564} 9565 9566// PageToken sets the optional parameter "pageToken": Page token for 9567// files. 9568func (c *FilesListCall) PageToken(pageToken string) *FilesListCall { 9569 c.urlParams_.Set("pageToken", pageToken) 9570 return c 9571} 9572 9573// Projection sets the optional parameter "projection": This parameter 9574// is deprecated and has no function. 9575// 9576// Possible values: 9577// "BASIC" - Deprecated 9578// "FULL" - Deprecated 9579func (c *FilesListCall) Projection(projection string) *FilesListCall { 9580 c.urlParams_.Set("projection", projection) 9581 return c 9582} 9583 9584// Q sets the optional parameter "q": Query string for searching files. 9585func (c *FilesListCall) Q(q string) *FilesListCall { 9586 c.urlParams_.Set("q", q) 9587 return c 9588} 9589 9590// Spaces sets the optional parameter "spaces": A comma-separated list 9591// of spaces to query. Supported values are 'drive', 'appDataFolder' and 9592// 'photos'. 9593func (c *FilesListCall) Spaces(spaces string) *FilesListCall { 9594 c.urlParams_.Set("spaces", spaces) 9595 return c 9596} 9597 9598// SupportsAllDrives sets the optional parameter "supportsAllDrives": 9599// Deprecated - Whether the requesting application supports both My 9600// Drives and shared drives. This parameter will only be effective until 9601// June 1, 2020. Afterwards all applications are assumed to support 9602// shared drives. 9603func (c *FilesListCall) SupportsAllDrives(supportsAllDrives bool) *FilesListCall { 9604 c.urlParams_.Set("supportsAllDrives", fmt.Sprint(supportsAllDrives)) 9605 return c 9606} 9607 9608// SupportsTeamDrives sets the optional parameter "supportsTeamDrives": 9609// Deprecated use supportsAllDrives instead. 9610func (c *FilesListCall) SupportsTeamDrives(supportsTeamDrives bool) *FilesListCall { 9611 c.urlParams_.Set("supportsTeamDrives", fmt.Sprint(supportsTeamDrives)) 9612 return c 9613} 9614 9615// TeamDriveId sets the optional parameter "teamDriveId": Deprecated use 9616// driveId instead. 9617func (c *FilesListCall) TeamDriveId(teamDriveId string) *FilesListCall { 9618 c.urlParams_.Set("teamDriveId", teamDriveId) 9619 return c 9620} 9621 9622// Fields allows partial responses to be retrieved. See 9623// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 9624// for more information. 9625func (c *FilesListCall) Fields(s ...googleapi.Field) *FilesListCall { 9626 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 9627 return c 9628} 9629 9630// IfNoneMatch sets the optional parameter which makes the operation 9631// fail if the object's ETag matches the given value. This is useful for 9632// getting updates only after the object has changed since the last 9633// request. Use googleapi.IsNotModified to check whether the response 9634// error from Do is the result of In-None-Match. 9635func (c *FilesListCall) IfNoneMatch(entityTag string) *FilesListCall { 9636 c.ifNoneMatch_ = entityTag 9637 return c 9638} 9639 9640// Context sets the context to be used in this call's Do method. Any 9641// pending HTTP request will be aborted if the provided context is 9642// canceled. 9643func (c *FilesListCall) Context(ctx context.Context) *FilesListCall { 9644 c.ctx_ = ctx 9645 return c 9646} 9647 9648// Header returns an http.Header that can be modified by the caller to 9649// add HTTP headers to the request. 9650func (c *FilesListCall) Header() http.Header { 9651 if c.header_ == nil { 9652 c.header_ = make(http.Header) 9653 } 9654 return c.header_ 9655} 9656 9657func (c *FilesListCall) doRequest(alt string) (*http.Response, error) { 9658 reqHeaders := make(http.Header) 9659 for k, v := range c.header_ { 9660 reqHeaders[k] = v 9661 } 9662 reqHeaders.Set("User-Agent", c.s.userAgent()) 9663 if c.ifNoneMatch_ != "" { 9664 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 9665 } 9666 var body io.Reader = nil 9667 c.urlParams_.Set("alt", alt) 9668 c.urlParams_.Set("prettyPrint", "false") 9669 urls := googleapi.ResolveRelative(c.s.BasePath, "files") 9670 urls += "?" + c.urlParams_.Encode() 9671 req, err := http.NewRequest("GET", urls, body) 9672 if err != nil { 9673 return nil, err 9674 } 9675 req.Header = reqHeaders 9676 return gensupport.SendRequest(c.ctx_, c.s.client, req) 9677} 9678 9679// Do executes the "drive.files.list" call. 9680// Exactly one of *FileList or error will be non-nil. Any non-2xx status 9681// code is an error. Response headers are in either 9682// *FileList.ServerResponse.Header or (if a response was returned at 9683// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 9684// to check whether the returned error was because 9685// http.StatusNotModified was returned. 9686func (c *FilesListCall) Do(opts ...googleapi.CallOption) (*FileList, error) { 9687 gensupport.SetOptions(c.urlParams_, opts...) 9688 res, err := c.doRequest("json") 9689 if res != nil && res.StatusCode == http.StatusNotModified { 9690 if res.Body != nil { 9691 res.Body.Close() 9692 } 9693 return nil, &googleapi.Error{ 9694 Code: res.StatusCode, 9695 Header: res.Header, 9696 } 9697 } 9698 if err != nil { 9699 return nil, err 9700 } 9701 defer googleapi.CloseBody(res) 9702 if err := googleapi.CheckResponse(res); err != nil { 9703 return nil, err 9704 } 9705 ret := &FileList{ 9706 ServerResponse: googleapi.ServerResponse{ 9707 Header: res.Header, 9708 HTTPStatusCode: res.StatusCode, 9709 }, 9710 } 9711 target := &ret 9712 if err := gensupport.DecodeResponse(target, res); err != nil { 9713 return nil, err 9714 } 9715 return ret, nil 9716 // { 9717 // "description": "Lists the user's files.", 9718 // "httpMethod": "GET", 9719 // "id": "drive.files.list", 9720 // "parameters": { 9721 // "corpora": { 9722 // "description": "Bodies of items (files/documents) to which the query applies. Supported bodies are 'default', 'domain', 'drive' and 'allDrives'. Prefer 'default' or 'drive' to 'allDrives' for efficiency.", 9723 // "location": "query", 9724 // "type": "string" 9725 // }, 9726 // "corpus": { 9727 // "description": "The body of items (files/documents) to which the query applies. Deprecated: use 'corpora' instead.", 9728 // "enum": [ 9729 // "DEFAULT", 9730 // "DOMAIN" 9731 // ], 9732 // "enumDescriptions": [ 9733 // "The items that the user has accessed.", 9734 // "Items shared to the user's domain." 9735 // ], 9736 // "location": "query", 9737 // "type": "string" 9738 // }, 9739 // "driveId": { 9740 // "description": "ID of the shared drive to search.", 9741 // "location": "query", 9742 // "type": "string" 9743 // }, 9744 // "includeItemsFromAllDrives": { 9745 // "default": "false", 9746 // "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.", 9747 // "location": "query", 9748 // "type": "boolean" 9749 // }, 9750 // "includeTeamDriveItems": { 9751 // "default": "false", 9752 // "description": "Deprecated use includeItemsFromAllDrives instead.", 9753 // "location": "query", 9754 // "type": "boolean" 9755 // }, 9756 // "maxResults": { 9757 // "default": "100", 9758 // "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.", 9759 // "format": "int32", 9760 // "location": "query", 9761 // "minimum": "0", 9762 // "type": "integer" 9763 // }, 9764 // "orderBy": { 9765 // "description": "A comma-separated list of sort keys. Valid keys are 'createdDate', 'folder', 'lastViewedByMeDate', 'modifiedByMeDate', 'modifiedDate', 'quotaBytesUsed', 'recency', 'sharedWithMeDate', 'starred', 'title', and 'title_natural'. Each key sorts ascending by default, but may be reversed with the 'desc' modifier. Example usage: ?orderBy=folder,modifiedDate desc,title. Please note that there is a current limitation for users with approximately one million files in which the requested sort order is ignored.", 9766 // "location": "query", 9767 // "type": "string" 9768 // }, 9769 // "pageToken": { 9770 // "description": "Page token for files.", 9771 // "location": "query", 9772 // "type": "string" 9773 // }, 9774 // "projection": { 9775 // "description": "This parameter is deprecated and has no function.", 9776 // "enum": [ 9777 // "BASIC", 9778 // "FULL" 9779 // ], 9780 // "enumDescriptions": [ 9781 // "Deprecated", 9782 // "Deprecated" 9783 // ], 9784 // "location": "query", 9785 // "type": "string" 9786 // }, 9787 // "q": { 9788 // "description": "Query string for searching files.", 9789 // "location": "query", 9790 // "type": "string" 9791 // }, 9792 // "spaces": { 9793 // "description": "A comma-separated list of spaces to query. Supported values are 'drive', 'appDataFolder' and 'photos'.", 9794 // "location": "query", 9795 // "type": "string" 9796 // }, 9797 // "supportsAllDrives": { 9798 // "default": "false", 9799 // "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.", 9800 // "location": "query", 9801 // "type": "boolean" 9802 // }, 9803 // "supportsTeamDrives": { 9804 // "default": "false", 9805 // "description": "Deprecated use supportsAllDrives instead.", 9806 // "location": "query", 9807 // "type": "boolean" 9808 // }, 9809 // "teamDriveId": { 9810 // "description": "Deprecated use driveId instead.", 9811 // "location": "query", 9812 // "type": "string" 9813 // } 9814 // }, 9815 // "path": "files", 9816 // "response": { 9817 // "$ref": "FileList" 9818 // }, 9819 // "scopes": [ 9820 // "https://www.googleapis.com/auth/drive", 9821 // "https://www.googleapis.com/auth/drive.appdata", 9822 // "https://www.googleapis.com/auth/drive.apps.readonly", 9823 // "https://www.googleapis.com/auth/drive.file", 9824 // "https://www.googleapis.com/auth/drive.metadata", 9825 // "https://www.googleapis.com/auth/drive.metadata.readonly", 9826 // "https://www.googleapis.com/auth/drive.photos.readonly", 9827 // "https://www.googleapis.com/auth/drive.readonly" 9828 // ] 9829 // } 9830 9831} 9832 9833// Pages invokes f for each page of results. 9834// A non-nil error returned from f will halt the iteration. 9835// The provided context supersedes any context provided to the Context method. 9836func (c *FilesListCall) Pages(ctx context.Context, f func(*FileList) error) error { 9837 c.ctx_ = ctx 9838 defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point 9839 for { 9840 x, err := c.Do() 9841 if err != nil { 9842 return err 9843 } 9844 if err := f(x); err != nil { 9845 return err 9846 } 9847 if x.NextPageToken == "" { 9848 return nil 9849 } 9850 c.PageToken(x.NextPageToken) 9851 } 9852} 9853 9854// method id "drive.files.patch": 9855 9856type FilesPatchCall struct { 9857 s *Service 9858 fileId string 9859 file *File 9860 urlParams_ gensupport.URLParams 9861 ctx_ context.Context 9862 header_ http.Header 9863} 9864 9865// Patch: Updates file metadata and/or content. This method supports 9866// patch semantics. 9867func (r *FilesService) Patch(fileId string, file *File) *FilesPatchCall { 9868 c := &FilesPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)} 9869 c.fileId = fileId 9870 c.file = file 9871 return c 9872} 9873 9874// AddParents sets the optional parameter "addParents": Comma-separated 9875// list of parent IDs to add. 9876func (c *FilesPatchCall) AddParents(addParents string) *FilesPatchCall { 9877 c.urlParams_.Set("addParents", addParents) 9878 return c 9879} 9880 9881// Convert sets the optional parameter "convert": This parameter is 9882// deprecated and has no function. 9883func (c *FilesPatchCall) Convert(convert bool) *FilesPatchCall { 9884 c.urlParams_.Set("convert", fmt.Sprint(convert)) 9885 return c 9886} 9887 9888// ModifiedDateBehavior sets the optional parameter 9889// "modifiedDateBehavior": Determines the behavior in which modifiedDate 9890// is updated. This overrides setModifiedDate. 9891// 9892// Possible values: 9893// "fromBody" - Set modifiedDate to the value provided in the body of 9894// the request. No change if no value was provided. 9895// "fromBodyIfNeeded" - Set modifiedDate to the value provided in the 9896// body of the request depending on other contents of the update. 9897// "fromBodyOrNow" - Set modifiedDate to the value provided in the 9898// body of the request, or to the current time if no value was provided. 9899// "noChange" - Maintain the previous value of modifiedDate. 9900// "now" - Set modifiedDate to the current time. 9901// "nowIfNeeded" - Set modifiedDate to the current time depending on 9902// contents of the update. 9903func (c *FilesPatchCall) ModifiedDateBehavior(modifiedDateBehavior string) *FilesPatchCall { 9904 c.urlParams_.Set("modifiedDateBehavior", modifiedDateBehavior) 9905 return c 9906} 9907 9908// NewRevision sets the optional parameter "newRevision": Whether a blob 9909// upload should create a new revision. If false, the blob data in the 9910// current head revision is replaced. If true or not set, a new blob is 9911// created as head revision, and previous unpinned revisions are 9912// preserved for a short period of time. Pinned revisions are stored 9913// indefinitely, using additional storage quota, up to a maximum of 200 9914// revisions. For details on how revisions are retained, see the Drive 9915// Help Center. 9916func (c *FilesPatchCall) NewRevision(newRevision bool) *FilesPatchCall { 9917 c.urlParams_.Set("newRevision", fmt.Sprint(newRevision)) 9918 return c 9919} 9920 9921// Ocr sets the optional parameter "ocr": Whether to attempt OCR on 9922// .jpg, .png, .gif, or .pdf uploads. 9923func (c *FilesPatchCall) Ocr(ocr bool) *FilesPatchCall { 9924 c.urlParams_.Set("ocr", fmt.Sprint(ocr)) 9925 return c 9926} 9927 9928// OcrLanguage sets the optional parameter "ocrLanguage": If ocr is 9929// true, hints at the language to use. Valid values are BCP 47 codes. 9930func (c *FilesPatchCall) OcrLanguage(ocrLanguage string) *FilesPatchCall { 9931 c.urlParams_.Set("ocrLanguage", ocrLanguage) 9932 return c 9933} 9934 9935// Pinned sets the optional parameter "pinned": Whether to pin the new 9936// revision. A file can have a maximum of 200 pinned revisions. 9937func (c *FilesPatchCall) Pinned(pinned bool) *FilesPatchCall { 9938 c.urlParams_.Set("pinned", fmt.Sprint(pinned)) 9939 return c 9940} 9941 9942// RemoveParents sets the optional parameter "removeParents": 9943// Comma-separated list of parent IDs to remove. 9944func (c *FilesPatchCall) RemoveParents(removeParents string) *FilesPatchCall { 9945 c.urlParams_.Set("removeParents", removeParents) 9946 return c 9947} 9948 9949// SetModifiedDate sets the optional parameter "setModifiedDate": 9950// Whether to set the modified date using the value supplied in the 9951// request body. Setting this field to true is equivalent to 9952// modifiedDateBehavior=fromBodyOrNow, and false is equivalent to 9953// modifiedDateBehavior=now. To prevent any changes to the modified date 9954// set modifiedDateBehavior=noChange. 9955func (c *FilesPatchCall) SetModifiedDate(setModifiedDate bool) *FilesPatchCall { 9956 c.urlParams_.Set("setModifiedDate", fmt.Sprint(setModifiedDate)) 9957 return c 9958} 9959 9960// SupportsAllDrives sets the optional parameter "supportsAllDrives": 9961// Deprecated - Whether the requesting application supports both My 9962// Drives and shared drives. This parameter will only be effective until 9963// June 1, 2020. Afterwards all applications are assumed to support 9964// shared drives. 9965func (c *FilesPatchCall) SupportsAllDrives(supportsAllDrives bool) *FilesPatchCall { 9966 c.urlParams_.Set("supportsAllDrives", fmt.Sprint(supportsAllDrives)) 9967 return c 9968} 9969 9970// SupportsTeamDrives sets the optional parameter "supportsTeamDrives": 9971// Deprecated use supportsAllDrives instead. 9972func (c *FilesPatchCall) SupportsTeamDrives(supportsTeamDrives bool) *FilesPatchCall { 9973 c.urlParams_.Set("supportsTeamDrives", fmt.Sprint(supportsTeamDrives)) 9974 return c 9975} 9976 9977// TimedTextLanguage sets the optional parameter "timedTextLanguage": 9978// The language of the timed text. 9979func (c *FilesPatchCall) TimedTextLanguage(timedTextLanguage string) *FilesPatchCall { 9980 c.urlParams_.Set("timedTextLanguage", timedTextLanguage) 9981 return c 9982} 9983 9984// TimedTextTrackName sets the optional parameter "timedTextTrackName": 9985// The timed text track name. 9986func (c *FilesPatchCall) TimedTextTrackName(timedTextTrackName string) *FilesPatchCall { 9987 c.urlParams_.Set("timedTextTrackName", timedTextTrackName) 9988 return c 9989} 9990 9991// UpdateViewedDate sets the optional parameter "updateViewedDate": 9992// Whether to update the view date after successfully updating the file. 9993func (c *FilesPatchCall) UpdateViewedDate(updateViewedDate bool) *FilesPatchCall { 9994 c.urlParams_.Set("updateViewedDate", fmt.Sprint(updateViewedDate)) 9995 return c 9996} 9997 9998// UseContentAsIndexableText sets the optional parameter 9999// "useContentAsIndexableText": Whether to use the content as indexable 10000// text. 10001func (c *FilesPatchCall) UseContentAsIndexableText(useContentAsIndexableText bool) *FilesPatchCall { 10002 c.urlParams_.Set("useContentAsIndexableText", fmt.Sprint(useContentAsIndexableText)) 10003 return c 10004} 10005 10006// Fields allows partial responses to be retrieved. See 10007// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 10008// for more information. 10009func (c *FilesPatchCall) Fields(s ...googleapi.Field) *FilesPatchCall { 10010 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 10011 return c 10012} 10013 10014// Context sets the context to be used in this call's Do method. Any 10015// pending HTTP request will be aborted if the provided context is 10016// canceled. 10017func (c *FilesPatchCall) Context(ctx context.Context) *FilesPatchCall { 10018 c.ctx_ = ctx 10019 return c 10020} 10021 10022// Header returns an http.Header that can be modified by the caller to 10023// add HTTP headers to the request. 10024func (c *FilesPatchCall) Header() http.Header { 10025 if c.header_ == nil { 10026 c.header_ = make(http.Header) 10027 } 10028 return c.header_ 10029} 10030 10031func (c *FilesPatchCall) doRequest(alt string) (*http.Response, error) { 10032 reqHeaders := make(http.Header) 10033 for k, v := range c.header_ { 10034 reqHeaders[k] = v 10035 } 10036 reqHeaders.Set("User-Agent", c.s.userAgent()) 10037 var body io.Reader = nil 10038 body, err := googleapi.WithoutDataWrapper.JSONReader(c.file) 10039 if err != nil { 10040 return nil, err 10041 } 10042 reqHeaders.Set("Content-Type", "application/json") 10043 c.urlParams_.Set("alt", alt) 10044 c.urlParams_.Set("prettyPrint", "false") 10045 urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}") 10046 urls += "?" + c.urlParams_.Encode() 10047 req, err := http.NewRequest("PATCH", urls, body) 10048 if err != nil { 10049 return nil, err 10050 } 10051 req.Header = reqHeaders 10052 googleapi.Expand(req.URL, map[string]string{ 10053 "fileId": c.fileId, 10054 }) 10055 return gensupport.SendRequest(c.ctx_, c.s.client, req) 10056} 10057 10058// Do executes the "drive.files.patch" call. 10059// Exactly one of *File or error will be non-nil. Any non-2xx status 10060// code is an error. Response headers are in either 10061// *File.ServerResponse.Header or (if a response was returned at all) in 10062// error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check 10063// whether the returned error was because http.StatusNotModified was 10064// returned. 10065func (c *FilesPatchCall) Do(opts ...googleapi.CallOption) (*File, error) { 10066 gensupport.SetOptions(c.urlParams_, opts...) 10067 res, err := c.doRequest("json") 10068 if res != nil && res.StatusCode == http.StatusNotModified { 10069 if res.Body != nil { 10070 res.Body.Close() 10071 } 10072 return nil, &googleapi.Error{ 10073 Code: res.StatusCode, 10074 Header: res.Header, 10075 } 10076 } 10077 if err != nil { 10078 return nil, err 10079 } 10080 defer googleapi.CloseBody(res) 10081 if err := googleapi.CheckResponse(res); err != nil { 10082 return nil, err 10083 } 10084 ret := &File{ 10085 ServerResponse: googleapi.ServerResponse{ 10086 Header: res.Header, 10087 HTTPStatusCode: res.StatusCode, 10088 }, 10089 } 10090 target := &ret 10091 if err := gensupport.DecodeResponse(target, res); err != nil { 10092 return nil, err 10093 } 10094 return ret, nil 10095 // { 10096 // "description": "Updates file metadata and/or content. This method supports patch semantics.", 10097 // "httpMethod": "PATCH", 10098 // "id": "drive.files.patch", 10099 // "parameterOrder": [ 10100 // "fileId" 10101 // ], 10102 // "parameters": { 10103 // "addParents": { 10104 // "description": "Comma-separated list of parent IDs to add.", 10105 // "location": "query", 10106 // "type": "string" 10107 // }, 10108 // "convert": { 10109 // "default": "false", 10110 // "description": "This parameter is deprecated and has no function.", 10111 // "location": "query", 10112 // "type": "boolean" 10113 // }, 10114 // "fileId": { 10115 // "description": "The ID of the file to update.", 10116 // "location": "path", 10117 // "required": true, 10118 // "type": "string" 10119 // }, 10120 // "modifiedDateBehavior": { 10121 // "description": "Determines the behavior in which modifiedDate is updated. This overrides setModifiedDate.", 10122 // "enum": [ 10123 // "fromBody", 10124 // "fromBodyIfNeeded", 10125 // "fromBodyOrNow", 10126 // "noChange", 10127 // "now", 10128 // "nowIfNeeded" 10129 // ], 10130 // "enumDescriptions": [ 10131 // "Set modifiedDate to the value provided in the body of the request. No change if no value was provided.", 10132 // "Set modifiedDate to the value provided in the body of the request depending on other contents of the update.", 10133 // "Set modifiedDate to the value provided in the body of the request, or to the current time if no value was provided.", 10134 // "Maintain the previous value of modifiedDate.", 10135 // "Set modifiedDate to the current time.", 10136 // "Set modifiedDate to the current time depending on contents of the update." 10137 // ], 10138 // "location": "query", 10139 // "type": "string" 10140 // }, 10141 // "newRevision": { 10142 // "default": "true", 10143 // "description": "Whether a blob upload should create a new revision. If false, the blob data in the current head revision is replaced. If true or not set, a new blob is created as head revision, and previous unpinned revisions are preserved for a short period of time. Pinned revisions are stored indefinitely, using additional storage quota, up to a maximum of 200 revisions. For details on how revisions are retained, see the Drive Help Center.", 10144 // "location": "query", 10145 // "type": "boolean" 10146 // }, 10147 // "ocr": { 10148 // "default": "false", 10149 // "description": "Whether to attempt OCR on .jpg, .png, .gif, or .pdf uploads.", 10150 // "location": "query", 10151 // "type": "boolean" 10152 // }, 10153 // "ocrLanguage": { 10154 // "description": "If ocr is true, hints at the language to use. Valid values are BCP 47 codes.", 10155 // "location": "query", 10156 // "type": "string" 10157 // }, 10158 // "pinned": { 10159 // "default": "false", 10160 // "description": "Whether to pin the new revision. A file can have a maximum of 200 pinned revisions.", 10161 // "location": "query", 10162 // "type": "boolean" 10163 // }, 10164 // "removeParents": { 10165 // "description": "Comma-separated list of parent IDs to remove.", 10166 // "location": "query", 10167 // "type": "string" 10168 // }, 10169 // "setModifiedDate": { 10170 // "default": "false", 10171 // "description": "Whether to set the modified date using the value supplied in the request body. Setting this field to true is equivalent to modifiedDateBehavior=fromBodyOrNow, and false is equivalent to modifiedDateBehavior=now. To prevent any changes to the modified date set modifiedDateBehavior=noChange.", 10172 // "location": "query", 10173 // "type": "boolean" 10174 // }, 10175 // "supportsAllDrives": { 10176 // "default": "false", 10177 // "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.", 10178 // "location": "query", 10179 // "type": "boolean" 10180 // }, 10181 // "supportsTeamDrives": { 10182 // "default": "false", 10183 // "description": "Deprecated use supportsAllDrives instead.", 10184 // "location": "query", 10185 // "type": "boolean" 10186 // }, 10187 // "timedTextLanguage": { 10188 // "description": "The language of the timed text.", 10189 // "location": "query", 10190 // "type": "string" 10191 // }, 10192 // "timedTextTrackName": { 10193 // "description": "The timed text track name.", 10194 // "location": "query", 10195 // "type": "string" 10196 // }, 10197 // "updateViewedDate": { 10198 // "default": "true", 10199 // "description": "Whether to update the view date after successfully updating the file.", 10200 // "location": "query", 10201 // "type": "boolean" 10202 // }, 10203 // "useContentAsIndexableText": { 10204 // "default": "false", 10205 // "description": "Whether to use the content as indexable text.", 10206 // "location": "query", 10207 // "type": "boolean" 10208 // } 10209 // }, 10210 // "path": "files/{fileId}", 10211 // "request": { 10212 // "$ref": "File" 10213 // }, 10214 // "response": { 10215 // "$ref": "File" 10216 // }, 10217 // "scopes": [ 10218 // "https://www.googleapis.com/auth/drive", 10219 // "https://www.googleapis.com/auth/drive.appdata", 10220 // "https://www.googleapis.com/auth/drive.apps.readonly", 10221 // "https://www.googleapis.com/auth/drive.file", 10222 // "https://www.googleapis.com/auth/drive.metadata", 10223 // "https://www.googleapis.com/auth/drive.scripts" 10224 // ] 10225 // } 10226 10227} 10228 10229// method id "drive.files.touch": 10230 10231type FilesTouchCall struct { 10232 s *Service 10233 fileId string 10234 urlParams_ gensupport.URLParams 10235 ctx_ context.Context 10236 header_ http.Header 10237} 10238 10239// Touch: Set the file's updated time to the current server time. 10240func (r *FilesService) Touch(fileId string) *FilesTouchCall { 10241 c := &FilesTouchCall{s: r.s, urlParams_: make(gensupport.URLParams)} 10242 c.fileId = fileId 10243 return c 10244} 10245 10246// SupportsAllDrives sets the optional parameter "supportsAllDrives": 10247// Deprecated - Whether the requesting application supports both My 10248// Drives and shared drives. This parameter will only be effective until 10249// June 1, 2020. Afterwards all applications are assumed to support 10250// shared drives. 10251func (c *FilesTouchCall) SupportsAllDrives(supportsAllDrives bool) *FilesTouchCall { 10252 c.urlParams_.Set("supportsAllDrives", fmt.Sprint(supportsAllDrives)) 10253 return c 10254} 10255 10256// SupportsTeamDrives sets the optional parameter "supportsTeamDrives": 10257// Deprecated use supportsAllDrives instead. 10258func (c *FilesTouchCall) SupportsTeamDrives(supportsTeamDrives bool) *FilesTouchCall { 10259 c.urlParams_.Set("supportsTeamDrives", fmt.Sprint(supportsTeamDrives)) 10260 return c 10261} 10262 10263// Fields allows partial responses to be retrieved. See 10264// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 10265// for more information. 10266func (c *FilesTouchCall) Fields(s ...googleapi.Field) *FilesTouchCall { 10267 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 10268 return c 10269} 10270 10271// Context sets the context to be used in this call's Do method. Any 10272// pending HTTP request will be aborted if the provided context is 10273// canceled. 10274func (c *FilesTouchCall) Context(ctx context.Context) *FilesTouchCall { 10275 c.ctx_ = ctx 10276 return c 10277} 10278 10279// Header returns an http.Header that can be modified by the caller to 10280// add HTTP headers to the request. 10281func (c *FilesTouchCall) Header() http.Header { 10282 if c.header_ == nil { 10283 c.header_ = make(http.Header) 10284 } 10285 return c.header_ 10286} 10287 10288func (c *FilesTouchCall) doRequest(alt string) (*http.Response, error) { 10289 reqHeaders := make(http.Header) 10290 for k, v := range c.header_ { 10291 reqHeaders[k] = v 10292 } 10293 reqHeaders.Set("User-Agent", c.s.userAgent()) 10294 var body io.Reader = nil 10295 c.urlParams_.Set("alt", alt) 10296 c.urlParams_.Set("prettyPrint", "false") 10297 urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/touch") 10298 urls += "?" + c.urlParams_.Encode() 10299 req, err := http.NewRequest("POST", urls, body) 10300 if err != nil { 10301 return nil, err 10302 } 10303 req.Header = reqHeaders 10304 googleapi.Expand(req.URL, map[string]string{ 10305 "fileId": c.fileId, 10306 }) 10307 return gensupport.SendRequest(c.ctx_, c.s.client, req) 10308} 10309 10310// Do executes the "drive.files.touch" call. 10311// Exactly one of *File or error will be non-nil. Any non-2xx status 10312// code is an error. Response headers are in either 10313// *File.ServerResponse.Header or (if a response was returned at all) in 10314// error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check 10315// whether the returned error was because http.StatusNotModified was 10316// returned. 10317func (c *FilesTouchCall) Do(opts ...googleapi.CallOption) (*File, error) { 10318 gensupport.SetOptions(c.urlParams_, opts...) 10319 res, err := c.doRequest("json") 10320 if res != nil && res.StatusCode == http.StatusNotModified { 10321 if res.Body != nil { 10322 res.Body.Close() 10323 } 10324 return nil, &googleapi.Error{ 10325 Code: res.StatusCode, 10326 Header: res.Header, 10327 } 10328 } 10329 if err != nil { 10330 return nil, err 10331 } 10332 defer googleapi.CloseBody(res) 10333 if err := googleapi.CheckResponse(res); err != nil { 10334 return nil, err 10335 } 10336 ret := &File{ 10337 ServerResponse: googleapi.ServerResponse{ 10338 Header: res.Header, 10339 HTTPStatusCode: res.StatusCode, 10340 }, 10341 } 10342 target := &ret 10343 if err := gensupport.DecodeResponse(target, res); err != nil { 10344 return nil, err 10345 } 10346 return ret, nil 10347 // { 10348 // "description": "Set the file's updated time to the current server time.", 10349 // "httpMethod": "POST", 10350 // "id": "drive.files.touch", 10351 // "parameterOrder": [ 10352 // "fileId" 10353 // ], 10354 // "parameters": { 10355 // "fileId": { 10356 // "description": "The ID of the file to update.", 10357 // "location": "path", 10358 // "required": true, 10359 // "type": "string" 10360 // }, 10361 // "supportsAllDrives": { 10362 // "default": "false", 10363 // "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.", 10364 // "location": "query", 10365 // "type": "boolean" 10366 // }, 10367 // "supportsTeamDrives": { 10368 // "default": "false", 10369 // "description": "Deprecated use supportsAllDrives instead.", 10370 // "location": "query", 10371 // "type": "boolean" 10372 // } 10373 // }, 10374 // "path": "files/{fileId}/touch", 10375 // "response": { 10376 // "$ref": "File" 10377 // }, 10378 // "scopes": [ 10379 // "https://www.googleapis.com/auth/drive", 10380 // "https://www.googleapis.com/auth/drive.appdata", 10381 // "https://www.googleapis.com/auth/drive.apps.readonly", 10382 // "https://www.googleapis.com/auth/drive.file", 10383 // "https://www.googleapis.com/auth/drive.metadata" 10384 // ] 10385 // } 10386 10387} 10388 10389// method id "drive.files.trash": 10390 10391type FilesTrashCall struct { 10392 s *Service 10393 fileId string 10394 urlParams_ gensupport.URLParams 10395 ctx_ context.Context 10396 header_ http.Header 10397} 10398 10399// Trash: Moves a file to the trash. The currently authenticated user 10400// must own the file or be at least a fileOrganizer on the parent for 10401// shared drive files. 10402func (r *FilesService) Trash(fileId string) *FilesTrashCall { 10403 c := &FilesTrashCall{s: r.s, urlParams_: make(gensupport.URLParams)} 10404 c.fileId = fileId 10405 return c 10406} 10407 10408// SupportsAllDrives sets the optional parameter "supportsAllDrives": 10409// Deprecated - Whether the requesting application supports both My 10410// Drives and shared drives. This parameter will only be effective until 10411// June 1, 2020. Afterwards all applications are assumed to support 10412// shared drives. 10413func (c *FilesTrashCall) SupportsAllDrives(supportsAllDrives bool) *FilesTrashCall { 10414 c.urlParams_.Set("supportsAllDrives", fmt.Sprint(supportsAllDrives)) 10415 return c 10416} 10417 10418// SupportsTeamDrives sets the optional parameter "supportsTeamDrives": 10419// Deprecated use supportsAllDrives instead. 10420func (c *FilesTrashCall) SupportsTeamDrives(supportsTeamDrives bool) *FilesTrashCall { 10421 c.urlParams_.Set("supportsTeamDrives", fmt.Sprint(supportsTeamDrives)) 10422 return c 10423} 10424 10425// Fields allows partial responses to be retrieved. See 10426// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 10427// for more information. 10428func (c *FilesTrashCall) Fields(s ...googleapi.Field) *FilesTrashCall { 10429 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 10430 return c 10431} 10432 10433// Context sets the context to be used in this call's Do method. Any 10434// pending HTTP request will be aborted if the provided context is 10435// canceled. 10436func (c *FilesTrashCall) Context(ctx context.Context) *FilesTrashCall { 10437 c.ctx_ = ctx 10438 return c 10439} 10440 10441// Header returns an http.Header that can be modified by the caller to 10442// add HTTP headers to the request. 10443func (c *FilesTrashCall) Header() http.Header { 10444 if c.header_ == nil { 10445 c.header_ = make(http.Header) 10446 } 10447 return c.header_ 10448} 10449 10450func (c *FilesTrashCall) doRequest(alt string) (*http.Response, error) { 10451 reqHeaders := make(http.Header) 10452 for k, v := range c.header_ { 10453 reqHeaders[k] = v 10454 } 10455 reqHeaders.Set("User-Agent", c.s.userAgent()) 10456 var body io.Reader = nil 10457 c.urlParams_.Set("alt", alt) 10458 c.urlParams_.Set("prettyPrint", "false") 10459 urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/trash") 10460 urls += "?" + c.urlParams_.Encode() 10461 req, err := http.NewRequest("POST", urls, body) 10462 if err != nil { 10463 return nil, err 10464 } 10465 req.Header = reqHeaders 10466 googleapi.Expand(req.URL, map[string]string{ 10467 "fileId": c.fileId, 10468 }) 10469 return gensupport.SendRequest(c.ctx_, c.s.client, req) 10470} 10471 10472// Do executes the "drive.files.trash" call. 10473// Exactly one of *File or error will be non-nil. Any non-2xx status 10474// code is an error. Response headers are in either 10475// *File.ServerResponse.Header or (if a response was returned at all) in 10476// error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check 10477// whether the returned error was because http.StatusNotModified was 10478// returned. 10479func (c *FilesTrashCall) Do(opts ...googleapi.CallOption) (*File, error) { 10480 gensupport.SetOptions(c.urlParams_, opts...) 10481 res, err := c.doRequest("json") 10482 if res != nil && res.StatusCode == http.StatusNotModified { 10483 if res.Body != nil { 10484 res.Body.Close() 10485 } 10486 return nil, &googleapi.Error{ 10487 Code: res.StatusCode, 10488 Header: res.Header, 10489 } 10490 } 10491 if err != nil { 10492 return nil, err 10493 } 10494 defer googleapi.CloseBody(res) 10495 if err := googleapi.CheckResponse(res); err != nil { 10496 return nil, err 10497 } 10498 ret := &File{ 10499 ServerResponse: googleapi.ServerResponse{ 10500 Header: res.Header, 10501 HTTPStatusCode: res.StatusCode, 10502 }, 10503 } 10504 target := &ret 10505 if err := gensupport.DecodeResponse(target, res); err != nil { 10506 return nil, err 10507 } 10508 return ret, nil 10509 // { 10510 // "description": "Moves a file to the trash. The currently authenticated user must own the file or be at least a fileOrganizer on the parent for shared drive files.", 10511 // "httpMethod": "POST", 10512 // "id": "drive.files.trash", 10513 // "parameterOrder": [ 10514 // "fileId" 10515 // ], 10516 // "parameters": { 10517 // "fileId": { 10518 // "description": "The ID of the file to trash.", 10519 // "location": "path", 10520 // "required": true, 10521 // "type": "string" 10522 // }, 10523 // "supportsAllDrives": { 10524 // "default": "false", 10525 // "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.", 10526 // "location": "query", 10527 // "type": "boolean" 10528 // }, 10529 // "supportsTeamDrives": { 10530 // "default": "false", 10531 // "description": "Deprecated use supportsAllDrives instead.", 10532 // "location": "query", 10533 // "type": "boolean" 10534 // } 10535 // }, 10536 // "path": "files/{fileId}/trash", 10537 // "response": { 10538 // "$ref": "File" 10539 // }, 10540 // "scopes": [ 10541 // "https://www.googleapis.com/auth/drive", 10542 // "https://www.googleapis.com/auth/drive.appdata", 10543 // "https://www.googleapis.com/auth/drive.apps.readonly", 10544 // "https://www.googleapis.com/auth/drive.file" 10545 // ] 10546 // } 10547 10548} 10549 10550// method id "drive.files.untrash": 10551 10552type FilesUntrashCall struct { 10553 s *Service 10554 fileId string 10555 urlParams_ gensupport.URLParams 10556 ctx_ context.Context 10557 header_ http.Header 10558} 10559 10560// Untrash: Restores a file from the trash. 10561func (r *FilesService) Untrash(fileId string) *FilesUntrashCall { 10562 c := &FilesUntrashCall{s: r.s, urlParams_: make(gensupport.URLParams)} 10563 c.fileId = fileId 10564 return c 10565} 10566 10567// SupportsAllDrives sets the optional parameter "supportsAllDrives": 10568// Deprecated - Whether the requesting application supports both My 10569// Drives and shared drives. This parameter will only be effective until 10570// June 1, 2020. Afterwards all applications are assumed to support 10571// shared drives. 10572func (c *FilesUntrashCall) SupportsAllDrives(supportsAllDrives bool) *FilesUntrashCall { 10573 c.urlParams_.Set("supportsAllDrives", fmt.Sprint(supportsAllDrives)) 10574 return c 10575} 10576 10577// SupportsTeamDrives sets the optional parameter "supportsTeamDrives": 10578// Deprecated use supportsAllDrives instead. 10579func (c *FilesUntrashCall) SupportsTeamDrives(supportsTeamDrives bool) *FilesUntrashCall { 10580 c.urlParams_.Set("supportsTeamDrives", fmt.Sprint(supportsTeamDrives)) 10581 return c 10582} 10583 10584// Fields allows partial responses to be retrieved. See 10585// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 10586// for more information. 10587func (c *FilesUntrashCall) Fields(s ...googleapi.Field) *FilesUntrashCall { 10588 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 10589 return c 10590} 10591 10592// Context sets the context to be used in this call's Do method. Any 10593// pending HTTP request will be aborted if the provided context is 10594// canceled. 10595func (c *FilesUntrashCall) Context(ctx context.Context) *FilesUntrashCall { 10596 c.ctx_ = ctx 10597 return c 10598} 10599 10600// Header returns an http.Header that can be modified by the caller to 10601// add HTTP headers to the request. 10602func (c *FilesUntrashCall) Header() http.Header { 10603 if c.header_ == nil { 10604 c.header_ = make(http.Header) 10605 } 10606 return c.header_ 10607} 10608 10609func (c *FilesUntrashCall) doRequest(alt string) (*http.Response, error) { 10610 reqHeaders := make(http.Header) 10611 for k, v := range c.header_ { 10612 reqHeaders[k] = v 10613 } 10614 reqHeaders.Set("User-Agent", c.s.userAgent()) 10615 var body io.Reader = nil 10616 c.urlParams_.Set("alt", alt) 10617 c.urlParams_.Set("prettyPrint", "false") 10618 urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/untrash") 10619 urls += "?" + c.urlParams_.Encode() 10620 req, err := http.NewRequest("POST", urls, body) 10621 if err != nil { 10622 return nil, err 10623 } 10624 req.Header = reqHeaders 10625 googleapi.Expand(req.URL, map[string]string{ 10626 "fileId": c.fileId, 10627 }) 10628 return gensupport.SendRequest(c.ctx_, c.s.client, req) 10629} 10630 10631// Do executes the "drive.files.untrash" call. 10632// Exactly one of *File or error will be non-nil. Any non-2xx status 10633// code is an error. Response headers are in either 10634// *File.ServerResponse.Header or (if a response was returned at all) in 10635// error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check 10636// whether the returned error was because http.StatusNotModified was 10637// returned. 10638func (c *FilesUntrashCall) Do(opts ...googleapi.CallOption) (*File, error) { 10639 gensupport.SetOptions(c.urlParams_, opts...) 10640 res, err := c.doRequest("json") 10641 if res != nil && res.StatusCode == http.StatusNotModified { 10642 if res.Body != nil { 10643 res.Body.Close() 10644 } 10645 return nil, &googleapi.Error{ 10646 Code: res.StatusCode, 10647 Header: res.Header, 10648 } 10649 } 10650 if err != nil { 10651 return nil, err 10652 } 10653 defer googleapi.CloseBody(res) 10654 if err := googleapi.CheckResponse(res); err != nil { 10655 return nil, err 10656 } 10657 ret := &File{ 10658 ServerResponse: googleapi.ServerResponse{ 10659 Header: res.Header, 10660 HTTPStatusCode: res.StatusCode, 10661 }, 10662 } 10663 target := &ret 10664 if err := gensupport.DecodeResponse(target, res); err != nil { 10665 return nil, err 10666 } 10667 return ret, nil 10668 // { 10669 // "description": "Restores a file from the trash.", 10670 // "httpMethod": "POST", 10671 // "id": "drive.files.untrash", 10672 // "parameterOrder": [ 10673 // "fileId" 10674 // ], 10675 // "parameters": { 10676 // "fileId": { 10677 // "description": "The ID of the file to untrash.", 10678 // "location": "path", 10679 // "required": true, 10680 // "type": "string" 10681 // }, 10682 // "supportsAllDrives": { 10683 // "default": "false", 10684 // "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.", 10685 // "location": "query", 10686 // "type": "boolean" 10687 // }, 10688 // "supportsTeamDrives": { 10689 // "default": "false", 10690 // "description": "Deprecated use supportsAllDrives instead.", 10691 // "location": "query", 10692 // "type": "boolean" 10693 // } 10694 // }, 10695 // "path": "files/{fileId}/untrash", 10696 // "response": { 10697 // "$ref": "File" 10698 // }, 10699 // "scopes": [ 10700 // "https://www.googleapis.com/auth/drive", 10701 // "https://www.googleapis.com/auth/drive.appdata", 10702 // "https://www.googleapis.com/auth/drive.apps.readonly", 10703 // "https://www.googleapis.com/auth/drive.file" 10704 // ] 10705 // } 10706 10707} 10708 10709// method id "drive.files.update": 10710 10711type FilesUpdateCall struct { 10712 s *Service 10713 fileId string 10714 file *File 10715 urlParams_ gensupport.URLParams 10716 mediaInfo_ *gensupport.MediaInfo 10717 ctx_ context.Context 10718 header_ http.Header 10719} 10720 10721// Update: Updates file metadata and/or content. 10722func (r *FilesService) Update(fileId string, file *File) *FilesUpdateCall { 10723 c := &FilesUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)} 10724 c.fileId = fileId 10725 c.file = file 10726 return c 10727} 10728 10729// AddParents sets the optional parameter "addParents": Comma-separated 10730// list of parent IDs to add. 10731func (c *FilesUpdateCall) AddParents(addParents string) *FilesUpdateCall { 10732 c.urlParams_.Set("addParents", addParents) 10733 return c 10734} 10735 10736// Convert sets the optional parameter "convert": This parameter is 10737// deprecated and has no function. 10738func (c *FilesUpdateCall) Convert(convert bool) *FilesUpdateCall { 10739 c.urlParams_.Set("convert", fmt.Sprint(convert)) 10740 return c 10741} 10742 10743// ModifiedDateBehavior sets the optional parameter 10744// "modifiedDateBehavior": Determines the behavior in which modifiedDate 10745// is updated. This overrides setModifiedDate. 10746// 10747// Possible values: 10748// "fromBody" - Set modifiedDate to the value provided in the body of 10749// the request. No change if no value was provided. 10750// "fromBodyIfNeeded" - Set modifiedDate to the value provided in the 10751// body of the request depending on other contents of the update. 10752// "fromBodyOrNow" - Set modifiedDate to the value provided in the 10753// body of the request, or to the current time if no value was provided. 10754// "noChange" - Maintain the previous value of modifiedDate. 10755// "now" - Set modifiedDate to the current time. 10756// "nowIfNeeded" - Set modifiedDate to the current time depending on 10757// contents of the update. 10758func (c *FilesUpdateCall) ModifiedDateBehavior(modifiedDateBehavior string) *FilesUpdateCall { 10759 c.urlParams_.Set("modifiedDateBehavior", modifiedDateBehavior) 10760 return c 10761} 10762 10763// NewRevision sets the optional parameter "newRevision": Whether a blob 10764// upload should create a new revision. If false, the blob data in the 10765// current head revision is replaced. If true or not set, a new blob is 10766// created as head revision, and previous unpinned revisions are 10767// preserved for a short period of time. Pinned revisions are stored 10768// indefinitely, using additional storage quota, up to a maximum of 200 10769// revisions. For details on how revisions are retained, see the Drive 10770// Help Center. 10771func (c *FilesUpdateCall) NewRevision(newRevision bool) *FilesUpdateCall { 10772 c.urlParams_.Set("newRevision", fmt.Sprint(newRevision)) 10773 return c 10774} 10775 10776// Ocr sets the optional parameter "ocr": Whether to attempt OCR on 10777// .jpg, .png, .gif, or .pdf uploads. 10778func (c *FilesUpdateCall) Ocr(ocr bool) *FilesUpdateCall { 10779 c.urlParams_.Set("ocr", fmt.Sprint(ocr)) 10780 return c 10781} 10782 10783// OcrLanguage sets the optional parameter "ocrLanguage": If ocr is 10784// true, hints at the language to use. Valid values are BCP 47 codes. 10785func (c *FilesUpdateCall) OcrLanguage(ocrLanguage string) *FilesUpdateCall { 10786 c.urlParams_.Set("ocrLanguage", ocrLanguage) 10787 return c 10788} 10789 10790// Pinned sets the optional parameter "pinned": Whether to pin the new 10791// revision. A file can have a maximum of 200 pinned revisions. 10792func (c *FilesUpdateCall) Pinned(pinned bool) *FilesUpdateCall { 10793 c.urlParams_.Set("pinned", fmt.Sprint(pinned)) 10794 return c 10795} 10796 10797// RemoveParents sets the optional parameter "removeParents": 10798// Comma-separated list of parent IDs to remove. 10799func (c *FilesUpdateCall) RemoveParents(removeParents string) *FilesUpdateCall { 10800 c.urlParams_.Set("removeParents", removeParents) 10801 return c 10802} 10803 10804// SetModifiedDate sets the optional parameter "setModifiedDate": 10805// Whether to set the modified date using the value supplied in the 10806// request body. Setting this field to true is equivalent to 10807// modifiedDateBehavior=fromBodyOrNow, and false is equivalent to 10808// modifiedDateBehavior=now. To prevent any changes to the modified date 10809// set modifiedDateBehavior=noChange. 10810func (c *FilesUpdateCall) SetModifiedDate(setModifiedDate bool) *FilesUpdateCall { 10811 c.urlParams_.Set("setModifiedDate", fmt.Sprint(setModifiedDate)) 10812 return c 10813} 10814 10815// SupportsAllDrives sets the optional parameter "supportsAllDrives": 10816// Deprecated - Whether the requesting application supports both My 10817// Drives and shared drives. This parameter will only be effective until 10818// June 1, 2020. Afterwards all applications are assumed to support 10819// shared drives. 10820func (c *FilesUpdateCall) SupportsAllDrives(supportsAllDrives bool) *FilesUpdateCall { 10821 c.urlParams_.Set("supportsAllDrives", fmt.Sprint(supportsAllDrives)) 10822 return c 10823} 10824 10825// SupportsTeamDrives sets the optional parameter "supportsTeamDrives": 10826// Deprecated use supportsAllDrives instead. 10827func (c *FilesUpdateCall) SupportsTeamDrives(supportsTeamDrives bool) *FilesUpdateCall { 10828 c.urlParams_.Set("supportsTeamDrives", fmt.Sprint(supportsTeamDrives)) 10829 return c 10830} 10831 10832// TimedTextLanguage sets the optional parameter "timedTextLanguage": 10833// The language of the timed text. 10834func (c *FilesUpdateCall) TimedTextLanguage(timedTextLanguage string) *FilesUpdateCall { 10835 c.urlParams_.Set("timedTextLanguage", timedTextLanguage) 10836 return c 10837} 10838 10839// TimedTextTrackName sets the optional parameter "timedTextTrackName": 10840// The timed text track name. 10841func (c *FilesUpdateCall) TimedTextTrackName(timedTextTrackName string) *FilesUpdateCall { 10842 c.urlParams_.Set("timedTextTrackName", timedTextTrackName) 10843 return c 10844} 10845 10846// UpdateViewedDate sets the optional parameter "updateViewedDate": 10847// Whether to update the view date after successfully updating the file. 10848func (c *FilesUpdateCall) UpdateViewedDate(updateViewedDate bool) *FilesUpdateCall { 10849 c.urlParams_.Set("updateViewedDate", fmt.Sprint(updateViewedDate)) 10850 return c 10851} 10852 10853// UseContentAsIndexableText sets the optional parameter 10854// "useContentAsIndexableText": Whether to use the content as indexable 10855// text. 10856func (c *FilesUpdateCall) UseContentAsIndexableText(useContentAsIndexableText bool) *FilesUpdateCall { 10857 c.urlParams_.Set("useContentAsIndexableText", fmt.Sprint(useContentAsIndexableText)) 10858 return c 10859} 10860 10861// Media specifies the media to upload in one or more chunks. The chunk 10862// size may be controlled by supplying a MediaOption generated by 10863// googleapi.ChunkSize. The chunk size defaults to 10864// googleapi.DefaultUploadChunkSize.The Content-Type header used in the 10865// upload request will be determined by sniffing the contents of r, 10866// unless a MediaOption generated by googleapi.ContentType is 10867// supplied. 10868// At most one of Media and ResumableMedia may be set. 10869func (c *FilesUpdateCall) Media(r io.Reader, options ...googleapi.MediaOption) *FilesUpdateCall { 10870 c.mediaInfo_ = gensupport.NewInfoFromMedia(r, options) 10871 return c 10872} 10873 10874// ResumableMedia specifies the media to upload in chunks and can be 10875// canceled with ctx. 10876// 10877// Deprecated: use Media instead. 10878// 10879// At most one of Media and ResumableMedia may be set. mediaType 10880// identifies the MIME media type of the upload, such as "image/png". If 10881// mediaType is "", it will be auto-detected. The provided ctx will 10882// supersede any context previously provided to the Context method. 10883func (c *FilesUpdateCall) ResumableMedia(ctx context.Context, r io.ReaderAt, size int64, mediaType string) *FilesUpdateCall { 10884 c.ctx_ = ctx 10885 c.mediaInfo_ = gensupport.NewInfoFromResumableMedia(r, size, mediaType) 10886 return c 10887} 10888 10889// ProgressUpdater provides a callback function that will be called 10890// after every chunk. It should be a low-latency function in order to 10891// not slow down the upload operation. This should only be called when 10892// using ResumableMedia (as opposed to Media). 10893func (c *FilesUpdateCall) ProgressUpdater(pu googleapi.ProgressUpdater) *FilesUpdateCall { 10894 c.mediaInfo_.SetProgressUpdater(pu) 10895 return c 10896} 10897 10898// Fields allows partial responses to be retrieved. See 10899// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 10900// for more information. 10901func (c *FilesUpdateCall) Fields(s ...googleapi.Field) *FilesUpdateCall { 10902 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 10903 return c 10904} 10905 10906// Context sets the context to be used in this call's Do method. Any 10907// pending HTTP request will be aborted if the provided context is 10908// canceled. 10909// This context will supersede any context previously provided to the 10910// ResumableMedia method. 10911func (c *FilesUpdateCall) Context(ctx context.Context) *FilesUpdateCall { 10912 c.ctx_ = ctx 10913 return c 10914} 10915 10916// Header returns an http.Header that can be modified by the caller to 10917// add HTTP headers to the request. 10918func (c *FilesUpdateCall) Header() http.Header { 10919 if c.header_ == nil { 10920 c.header_ = make(http.Header) 10921 } 10922 return c.header_ 10923} 10924 10925func (c *FilesUpdateCall) doRequest(alt string) (*http.Response, error) { 10926 reqHeaders := make(http.Header) 10927 for k, v := range c.header_ { 10928 reqHeaders[k] = v 10929 } 10930 reqHeaders.Set("User-Agent", c.s.userAgent()) 10931 var body io.Reader = nil 10932 body, err := googleapi.WithoutDataWrapper.JSONReader(c.file) 10933 if err != nil { 10934 return nil, err 10935 } 10936 reqHeaders.Set("Content-Type", "application/json") 10937 c.urlParams_.Set("alt", alt) 10938 c.urlParams_.Set("prettyPrint", "false") 10939 urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}") 10940 if c.mediaInfo_ != nil { 10941 urls = strings.Replace(urls, "https://www.googleapis.com/", "https://www.googleapis.com/upload/", 1) 10942 c.urlParams_.Set("uploadType", c.mediaInfo_.UploadType()) 10943 } 10944 if body == nil { 10945 body = new(bytes.Buffer) 10946 reqHeaders.Set("Content-Type", "application/json") 10947 } 10948 body, getBody, cleanup := c.mediaInfo_.UploadRequest(reqHeaders, body) 10949 defer cleanup() 10950 urls += "?" + c.urlParams_.Encode() 10951 req, err := http.NewRequest("PUT", urls, body) 10952 if err != nil { 10953 return nil, err 10954 } 10955 req.Header = reqHeaders 10956 req.GetBody = getBody 10957 googleapi.Expand(req.URL, map[string]string{ 10958 "fileId": c.fileId, 10959 }) 10960 return gensupport.SendRequest(c.ctx_, c.s.client, req) 10961} 10962 10963// Do executes the "drive.files.update" call. 10964// Exactly one of *File or error will be non-nil. Any non-2xx status 10965// code is an error. Response headers are in either 10966// *File.ServerResponse.Header or (if a response was returned at all) in 10967// error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check 10968// whether the returned error was because http.StatusNotModified was 10969// returned. 10970func (c *FilesUpdateCall) Do(opts ...googleapi.CallOption) (*File, error) { 10971 gensupport.SetOptions(c.urlParams_, opts...) 10972 res, err := c.doRequest("json") 10973 if res != nil && res.StatusCode == http.StatusNotModified { 10974 if res.Body != nil { 10975 res.Body.Close() 10976 } 10977 return nil, &googleapi.Error{ 10978 Code: res.StatusCode, 10979 Header: res.Header, 10980 } 10981 } 10982 if err != nil { 10983 return nil, err 10984 } 10985 defer googleapi.CloseBody(res) 10986 if err := googleapi.CheckResponse(res); err != nil { 10987 return nil, err 10988 } 10989 rx := c.mediaInfo_.ResumableUpload(res.Header.Get("Location")) 10990 if rx != nil { 10991 rx.Client = c.s.client 10992 rx.UserAgent = c.s.userAgent() 10993 ctx := c.ctx_ 10994 if ctx == nil { 10995 ctx = context.TODO() 10996 } 10997 res, err = rx.Upload(ctx) 10998 if err != nil { 10999 return nil, err 11000 } 11001 defer res.Body.Close() 11002 if err := googleapi.CheckResponse(res); err != nil { 11003 return nil, err 11004 } 11005 } 11006 ret := &File{ 11007 ServerResponse: googleapi.ServerResponse{ 11008 Header: res.Header, 11009 HTTPStatusCode: res.StatusCode, 11010 }, 11011 } 11012 target := &ret 11013 if err := gensupport.DecodeResponse(target, res); err != nil { 11014 return nil, err 11015 } 11016 return ret, nil 11017 // { 11018 // "description": "Updates file metadata and/or content.", 11019 // "httpMethod": "PUT", 11020 // "id": "drive.files.update", 11021 // "mediaUpload": { 11022 // "accept": [ 11023 // "*/*" 11024 // ], 11025 // "maxSize": "5120GB", 11026 // "protocols": { 11027 // "resumable": { 11028 // "multipart": true, 11029 // "path": "/resumable/upload/drive/v2/files/{fileId}" 11030 // }, 11031 // "simple": { 11032 // "multipart": true, 11033 // "path": "/upload/drive/v2/files/{fileId}" 11034 // } 11035 // } 11036 // }, 11037 // "parameterOrder": [ 11038 // "fileId" 11039 // ], 11040 // "parameters": { 11041 // "addParents": { 11042 // "description": "Comma-separated list of parent IDs to add.", 11043 // "location": "query", 11044 // "type": "string" 11045 // }, 11046 // "convert": { 11047 // "default": "false", 11048 // "description": "This parameter is deprecated and has no function.", 11049 // "location": "query", 11050 // "type": "boolean" 11051 // }, 11052 // "fileId": { 11053 // "description": "The ID of the file to update.", 11054 // "location": "path", 11055 // "required": true, 11056 // "type": "string" 11057 // }, 11058 // "modifiedDateBehavior": { 11059 // "description": "Determines the behavior in which modifiedDate is updated. This overrides setModifiedDate.", 11060 // "enum": [ 11061 // "fromBody", 11062 // "fromBodyIfNeeded", 11063 // "fromBodyOrNow", 11064 // "noChange", 11065 // "now", 11066 // "nowIfNeeded" 11067 // ], 11068 // "enumDescriptions": [ 11069 // "Set modifiedDate to the value provided in the body of the request. No change if no value was provided.", 11070 // "Set modifiedDate to the value provided in the body of the request depending on other contents of the update.", 11071 // "Set modifiedDate to the value provided in the body of the request, or to the current time if no value was provided.", 11072 // "Maintain the previous value of modifiedDate.", 11073 // "Set modifiedDate to the current time.", 11074 // "Set modifiedDate to the current time depending on contents of the update." 11075 // ], 11076 // "location": "query", 11077 // "type": "string" 11078 // }, 11079 // "newRevision": { 11080 // "default": "true", 11081 // "description": "Whether a blob upload should create a new revision. If false, the blob data in the current head revision is replaced. If true or not set, a new blob is created as head revision, and previous unpinned revisions are preserved for a short period of time. Pinned revisions are stored indefinitely, using additional storage quota, up to a maximum of 200 revisions. For details on how revisions are retained, see the Drive Help Center.", 11082 // "location": "query", 11083 // "type": "boolean" 11084 // }, 11085 // "ocr": { 11086 // "default": "false", 11087 // "description": "Whether to attempt OCR on .jpg, .png, .gif, or .pdf uploads.", 11088 // "location": "query", 11089 // "type": "boolean" 11090 // }, 11091 // "ocrLanguage": { 11092 // "description": "If ocr is true, hints at the language to use. Valid values are BCP 47 codes.", 11093 // "location": "query", 11094 // "type": "string" 11095 // }, 11096 // "pinned": { 11097 // "default": "false", 11098 // "description": "Whether to pin the new revision. A file can have a maximum of 200 pinned revisions.", 11099 // "location": "query", 11100 // "type": "boolean" 11101 // }, 11102 // "removeParents": { 11103 // "description": "Comma-separated list of parent IDs to remove.", 11104 // "location": "query", 11105 // "type": "string" 11106 // }, 11107 // "setModifiedDate": { 11108 // "default": "false", 11109 // "description": "Whether to set the modified date using the value supplied in the request body. Setting this field to true is equivalent to modifiedDateBehavior=fromBodyOrNow, and false is equivalent to modifiedDateBehavior=now. To prevent any changes to the modified date set modifiedDateBehavior=noChange.", 11110 // "location": "query", 11111 // "type": "boolean" 11112 // }, 11113 // "supportsAllDrives": { 11114 // "default": "false", 11115 // "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.", 11116 // "location": "query", 11117 // "type": "boolean" 11118 // }, 11119 // "supportsTeamDrives": { 11120 // "default": "false", 11121 // "description": "Deprecated use supportsAllDrives instead.", 11122 // "location": "query", 11123 // "type": "boolean" 11124 // }, 11125 // "timedTextLanguage": { 11126 // "description": "The language of the timed text.", 11127 // "location": "query", 11128 // "type": "string" 11129 // }, 11130 // "timedTextTrackName": { 11131 // "description": "The timed text track name.", 11132 // "location": "query", 11133 // "type": "string" 11134 // }, 11135 // "updateViewedDate": { 11136 // "default": "true", 11137 // "description": "Whether to update the view date after successfully updating the file.", 11138 // "location": "query", 11139 // "type": "boolean" 11140 // }, 11141 // "useContentAsIndexableText": { 11142 // "default": "false", 11143 // "description": "Whether to use the content as indexable text.", 11144 // "location": "query", 11145 // "type": "boolean" 11146 // } 11147 // }, 11148 // "path": "files/{fileId}", 11149 // "request": { 11150 // "$ref": "File" 11151 // }, 11152 // "response": { 11153 // "$ref": "File" 11154 // }, 11155 // "scopes": [ 11156 // "https://www.googleapis.com/auth/drive", 11157 // "https://www.googleapis.com/auth/drive.appdata", 11158 // "https://www.googleapis.com/auth/drive.apps.readonly", 11159 // "https://www.googleapis.com/auth/drive.file", 11160 // "https://www.googleapis.com/auth/drive.metadata", 11161 // "https://www.googleapis.com/auth/drive.scripts" 11162 // ], 11163 // "supportsMediaUpload": true 11164 // } 11165 11166} 11167 11168// method id "drive.files.watch": 11169 11170type FilesWatchCall struct { 11171 s *Service 11172 fileId string 11173 channel *Channel 11174 urlParams_ gensupport.URLParams 11175 ctx_ context.Context 11176 header_ http.Header 11177} 11178 11179// Watch: Subscribe to changes on a file 11180func (r *FilesService) Watch(fileId string, channel *Channel) *FilesWatchCall { 11181 c := &FilesWatchCall{s: r.s, urlParams_: make(gensupport.URLParams)} 11182 c.fileId = fileId 11183 c.channel = channel 11184 return c 11185} 11186 11187// AcknowledgeAbuse sets the optional parameter "acknowledgeAbuse": 11188// Whether the user is acknowledging the risk of downloading known 11189// malware or other abusive files. 11190func (c *FilesWatchCall) AcknowledgeAbuse(acknowledgeAbuse bool) *FilesWatchCall { 11191 c.urlParams_.Set("acknowledgeAbuse", fmt.Sprint(acknowledgeAbuse)) 11192 return c 11193} 11194 11195// Projection sets the optional parameter "projection": This parameter 11196// is deprecated and has no function. 11197// 11198// Possible values: 11199// "BASIC" - Deprecated 11200// "FULL" - Deprecated 11201func (c *FilesWatchCall) Projection(projection string) *FilesWatchCall { 11202 c.urlParams_.Set("projection", projection) 11203 return c 11204} 11205 11206// RevisionId sets the optional parameter "revisionId": Specifies the 11207// Revision ID that should be downloaded. Ignored unless alt=media is 11208// specified. 11209func (c *FilesWatchCall) RevisionId(revisionId string) *FilesWatchCall { 11210 c.urlParams_.Set("revisionId", revisionId) 11211 return c 11212} 11213 11214// SupportsAllDrives sets the optional parameter "supportsAllDrives": 11215// Deprecated - Whether the requesting application supports both My 11216// Drives and shared drives. This parameter will only be effective until 11217// June 1, 2020. Afterwards all applications are assumed to support 11218// shared drives. 11219func (c *FilesWatchCall) SupportsAllDrives(supportsAllDrives bool) *FilesWatchCall { 11220 c.urlParams_.Set("supportsAllDrives", fmt.Sprint(supportsAllDrives)) 11221 return c 11222} 11223 11224// SupportsTeamDrives sets the optional parameter "supportsTeamDrives": 11225// Deprecated use supportsAllDrives instead. 11226func (c *FilesWatchCall) SupportsTeamDrives(supportsTeamDrives bool) *FilesWatchCall { 11227 c.urlParams_.Set("supportsTeamDrives", fmt.Sprint(supportsTeamDrives)) 11228 return c 11229} 11230 11231// UpdateViewedDate sets the optional parameter "updateViewedDate": 11232// Deprecated: Use files.update with modifiedDateBehavior=noChange, 11233// updateViewedDate=true and an empty request body. 11234func (c *FilesWatchCall) UpdateViewedDate(updateViewedDate bool) *FilesWatchCall { 11235 c.urlParams_.Set("updateViewedDate", fmt.Sprint(updateViewedDate)) 11236 return c 11237} 11238 11239// Fields allows partial responses to be retrieved. See 11240// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 11241// for more information. 11242func (c *FilesWatchCall) Fields(s ...googleapi.Field) *FilesWatchCall { 11243 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 11244 return c 11245} 11246 11247// Context sets the context to be used in this call's Do and Download 11248// methods. Any pending HTTP request will be aborted if the provided 11249// context is canceled. 11250func (c *FilesWatchCall) Context(ctx context.Context) *FilesWatchCall { 11251 c.ctx_ = ctx 11252 return c 11253} 11254 11255// Header returns an http.Header that can be modified by the caller to 11256// add HTTP headers to the request. 11257func (c *FilesWatchCall) Header() http.Header { 11258 if c.header_ == nil { 11259 c.header_ = make(http.Header) 11260 } 11261 return c.header_ 11262} 11263 11264func (c *FilesWatchCall) doRequest(alt string) (*http.Response, error) { 11265 reqHeaders := make(http.Header) 11266 for k, v := range c.header_ { 11267 reqHeaders[k] = v 11268 } 11269 reqHeaders.Set("User-Agent", c.s.userAgent()) 11270 var body io.Reader = nil 11271 body, err := googleapi.WithoutDataWrapper.JSONReader(c.channel) 11272 if err != nil { 11273 return nil, err 11274 } 11275 reqHeaders.Set("Content-Type", "application/json") 11276 c.urlParams_.Set("alt", alt) 11277 c.urlParams_.Set("prettyPrint", "false") 11278 urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/watch") 11279 urls += "?" + c.urlParams_.Encode() 11280 req, err := http.NewRequest("POST", urls, body) 11281 if err != nil { 11282 return nil, err 11283 } 11284 req.Header = reqHeaders 11285 googleapi.Expand(req.URL, map[string]string{ 11286 "fileId": c.fileId, 11287 }) 11288 return gensupport.SendRequest(c.ctx_, c.s.client, req) 11289} 11290 11291// Download fetches the API endpoint's "media" value, instead of the normal 11292// API response value. If the returned error is nil, the Response is guaranteed to 11293// have a 2xx status code. Callers must close the Response.Body as usual. 11294func (c *FilesWatchCall) Download(opts ...googleapi.CallOption) (*http.Response, error) { 11295 gensupport.SetOptions(c.urlParams_, opts...) 11296 res, err := c.doRequest("media") 11297 if err != nil { 11298 return nil, err 11299 } 11300 if err := googleapi.CheckMediaResponse(res); err != nil { 11301 res.Body.Close() 11302 return nil, err 11303 } 11304 return res, nil 11305} 11306 11307// Do executes the "drive.files.watch" call. 11308// Exactly one of *Channel or error will be non-nil. Any non-2xx status 11309// code is an error. Response headers are in either 11310// *Channel.ServerResponse.Header or (if a response was returned at all) 11311// in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 11312// check whether the returned error was because http.StatusNotModified 11313// was returned. 11314func (c *FilesWatchCall) Do(opts ...googleapi.CallOption) (*Channel, error) { 11315 gensupport.SetOptions(c.urlParams_, opts...) 11316 res, err := c.doRequest("json") 11317 if res != nil && res.StatusCode == http.StatusNotModified { 11318 if res.Body != nil { 11319 res.Body.Close() 11320 } 11321 return nil, &googleapi.Error{ 11322 Code: res.StatusCode, 11323 Header: res.Header, 11324 } 11325 } 11326 if err != nil { 11327 return nil, err 11328 } 11329 defer googleapi.CloseBody(res) 11330 if err := googleapi.CheckResponse(res); err != nil { 11331 return nil, err 11332 } 11333 ret := &Channel{ 11334 ServerResponse: googleapi.ServerResponse{ 11335 Header: res.Header, 11336 HTTPStatusCode: res.StatusCode, 11337 }, 11338 } 11339 target := &ret 11340 if err := gensupport.DecodeResponse(target, res); err != nil { 11341 return nil, err 11342 } 11343 return ret, nil 11344 // { 11345 // "description": "Subscribe to changes on a file", 11346 // "httpMethod": "POST", 11347 // "id": "drive.files.watch", 11348 // "parameterOrder": [ 11349 // "fileId" 11350 // ], 11351 // "parameters": { 11352 // "acknowledgeAbuse": { 11353 // "default": "false", 11354 // "description": "Whether the user is acknowledging the risk of downloading known malware or other abusive files.", 11355 // "location": "query", 11356 // "type": "boolean" 11357 // }, 11358 // "fileId": { 11359 // "description": "The ID for the file in question.", 11360 // "location": "path", 11361 // "required": true, 11362 // "type": "string" 11363 // }, 11364 // "projection": { 11365 // "description": "This parameter is deprecated and has no function.", 11366 // "enum": [ 11367 // "BASIC", 11368 // "FULL" 11369 // ], 11370 // "enumDescriptions": [ 11371 // "Deprecated", 11372 // "Deprecated" 11373 // ], 11374 // "location": "query", 11375 // "type": "string" 11376 // }, 11377 // "revisionId": { 11378 // "description": "Specifies the Revision ID that should be downloaded. Ignored unless alt=media is specified.", 11379 // "location": "query", 11380 // "type": "string" 11381 // }, 11382 // "supportsAllDrives": { 11383 // "default": "false", 11384 // "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.", 11385 // "location": "query", 11386 // "type": "boolean" 11387 // }, 11388 // "supportsTeamDrives": { 11389 // "default": "false", 11390 // "description": "Deprecated use supportsAllDrives instead.", 11391 // "location": "query", 11392 // "type": "boolean" 11393 // }, 11394 // "updateViewedDate": { 11395 // "default": "false", 11396 // "description": "Deprecated: Use files.update with modifiedDateBehavior=noChange, updateViewedDate=true and an empty request body.", 11397 // "location": "query", 11398 // "type": "boolean" 11399 // } 11400 // }, 11401 // "path": "files/{fileId}/watch", 11402 // "request": { 11403 // "$ref": "Channel", 11404 // "parameterName": "resource" 11405 // }, 11406 // "response": { 11407 // "$ref": "Channel" 11408 // }, 11409 // "scopes": [ 11410 // "https://www.googleapis.com/auth/drive", 11411 // "https://www.googleapis.com/auth/drive.appdata", 11412 // "https://www.googleapis.com/auth/drive.file", 11413 // "https://www.googleapis.com/auth/drive.metadata", 11414 // "https://www.googleapis.com/auth/drive.metadata.readonly", 11415 // "https://www.googleapis.com/auth/drive.photos.readonly", 11416 // "https://www.googleapis.com/auth/drive.readonly" 11417 // ], 11418 // "supportsMediaDownload": true, 11419 // "supportsSubscription": true, 11420 // "useMediaDownloadService": true 11421 // } 11422 11423} 11424 11425// method id "drive.parents.delete": 11426 11427type ParentsDeleteCall struct { 11428 s *Service 11429 fileId string 11430 parentId string 11431 urlParams_ gensupport.URLParams 11432 ctx_ context.Context 11433 header_ http.Header 11434} 11435 11436// Delete: Removes a parent from a file. 11437func (r *ParentsService) Delete(fileId string, parentId string) *ParentsDeleteCall { 11438 c := &ParentsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)} 11439 c.fileId = fileId 11440 c.parentId = parentId 11441 return c 11442} 11443 11444// Fields allows partial responses to be retrieved. See 11445// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 11446// for more information. 11447func (c *ParentsDeleteCall) Fields(s ...googleapi.Field) *ParentsDeleteCall { 11448 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 11449 return c 11450} 11451 11452// Context sets the context to be used in this call's Do method. Any 11453// pending HTTP request will be aborted if the provided context is 11454// canceled. 11455func (c *ParentsDeleteCall) Context(ctx context.Context) *ParentsDeleteCall { 11456 c.ctx_ = ctx 11457 return c 11458} 11459 11460// Header returns an http.Header that can be modified by the caller to 11461// add HTTP headers to the request. 11462func (c *ParentsDeleteCall) Header() http.Header { 11463 if c.header_ == nil { 11464 c.header_ = make(http.Header) 11465 } 11466 return c.header_ 11467} 11468 11469func (c *ParentsDeleteCall) doRequest(alt string) (*http.Response, error) { 11470 reqHeaders := make(http.Header) 11471 for k, v := range c.header_ { 11472 reqHeaders[k] = v 11473 } 11474 reqHeaders.Set("User-Agent", c.s.userAgent()) 11475 var body io.Reader = nil 11476 c.urlParams_.Set("alt", alt) 11477 c.urlParams_.Set("prettyPrint", "false") 11478 urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/parents/{parentId}") 11479 urls += "?" + c.urlParams_.Encode() 11480 req, err := http.NewRequest("DELETE", urls, body) 11481 if err != nil { 11482 return nil, err 11483 } 11484 req.Header = reqHeaders 11485 googleapi.Expand(req.URL, map[string]string{ 11486 "fileId": c.fileId, 11487 "parentId": c.parentId, 11488 }) 11489 return gensupport.SendRequest(c.ctx_, c.s.client, req) 11490} 11491 11492// Do executes the "drive.parents.delete" call. 11493func (c *ParentsDeleteCall) Do(opts ...googleapi.CallOption) error { 11494 gensupport.SetOptions(c.urlParams_, opts...) 11495 res, err := c.doRequest("json") 11496 if err != nil { 11497 return err 11498 } 11499 defer googleapi.CloseBody(res) 11500 if err := googleapi.CheckResponse(res); err != nil { 11501 return err 11502 } 11503 return nil 11504 // { 11505 // "description": "Removes a parent from a file.", 11506 // "httpMethod": "DELETE", 11507 // "id": "drive.parents.delete", 11508 // "parameterOrder": [ 11509 // "fileId", 11510 // "parentId" 11511 // ], 11512 // "parameters": { 11513 // "fileId": { 11514 // "description": "The ID of the file.", 11515 // "location": "path", 11516 // "required": true, 11517 // "type": "string" 11518 // }, 11519 // "parentId": { 11520 // "description": "The ID of the parent.", 11521 // "location": "path", 11522 // "required": true, 11523 // "type": "string" 11524 // } 11525 // }, 11526 // "path": "files/{fileId}/parents/{parentId}", 11527 // "scopes": [ 11528 // "https://www.googleapis.com/auth/drive", 11529 // "https://www.googleapis.com/auth/drive.file" 11530 // ] 11531 // } 11532 11533} 11534 11535// method id "drive.parents.get": 11536 11537type ParentsGetCall struct { 11538 s *Service 11539 fileId string 11540 parentId string 11541 urlParams_ gensupport.URLParams 11542 ifNoneMatch_ string 11543 ctx_ context.Context 11544 header_ http.Header 11545} 11546 11547// Get: Gets a specific parent reference. 11548func (r *ParentsService) Get(fileId string, parentId string) *ParentsGetCall { 11549 c := &ParentsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)} 11550 c.fileId = fileId 11551 c.parentId = parentId 11552 return c 11553} 11554 11555// Fields allows partial responses to be retrieved. See 11556// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 11557// for more information. 11558func (c *ParentsGetCall) Fields(s ...googleapi.Field) *ParentsGetCall { 11559 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 11560 return c 11561} 11562 11563// IfNoneMatch sets the optional parameter which makes the operation 11564// fail if the object's ETag matches the given value. This is useful for 11565// getting updates only after the object has changed since the last 11566// request. Use googleapi.IsNotModified to check whether the response 11567// error from Do is the result of In-None-Match. 11568func (c *ParentsGetCall) IfNoneMatch(entityTag string) *ParentsGetCall { 11569 c.ifNoneMatch_ = entityTag 11570 return c 11571} 11572 11573// Context sets the context to be used in this call's Do method. Any 11574// pending HTTP request will be aborted if the provided context is 11575// canceled. 11576func (c *ParentsGetCall) Context(ctx context.Context) *ParentsGetCall { 11577 c.ctx_ = ctx 11578 return c 11579} 11580 11581// Header returns an http.Header that can be modified by the caller to 11582// add HTTP headers to the request. 11583func (c *ParentsGetCall) Header() http.Header { 11584 if c.header_ == nil { 11585 c.header_ = make(http.Header) 11586 } 11587 return c.header_ 11588} 11589 11590func (c *ParentsGetCall) doRequest(alt string) (*http.Response, error) { 11591 reqHeaders := make(http.Header) 11592 for k, v := range c.header_ { 11593 reqHeaders[k] = v 11594 } 11595 reqHeaders.Set("User-Agent", c.s.userAgent()) 11596 if c.ifNoneMatch_ != "" { 11597 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 11598 } 11599 var body io.Reader = nil 11600 c.urlParams_.Set("alt", alt) 11601 c.urlParams_.Set("prettyPrint", "false") 11602 urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/parents/{parentId}") 11603 urls += "?" + c.urlParams_.Encode() 11604 req, err := http.NewRequest("GET", urls, body) 11605 if err != nil { 11606 return nil, err 11607 } 11608 req.Header = reqHeaders 11609 googleapi.Expand(req.URL, map[string]string{ 11610 "fileId": c.fileId, 11611 "parentId": c.parentId, 11612 }) 11613 return gensupport.SendRequest(c.ctx_, c.s.client, req) 11614} 11615 11616// Do executes the "drive.parents.get" call. 11617// Exactly one of *ParentReference or error will be non-nil. Any non-2xx 11618// status code is an error. Response headers are in either 11619// *ParentReference.ServerResponse.Header or (if a response was returned 11620// at all) in error.(*googleapi.Error).Header. Use 11621// googleapi.IsNotModified to check whether the returned error was 11622// because http.StatusNotModified was returned. 11623func (c *ParentsGetCall) Do(opts ...googleapi.CallOption) (*ParentReference, error) { 11624 gensupport.SetOptions(c.urlParams_, opts...) 11625 res, err := c.doRequest("json") 11626 if res != nil && res.StatusCode == http.StatusNotModified { 11627 if res.Body != nil { 11628 res.Body.Close() 11629 } 11630 return nil, &googleapi.Error{ 11631 Code: res.StatusCode, 11632 Header: res.Header, 11633 } 11634 } 11635 if err != nil { 11636 return nil, err 11637 } 11638 defer googleapi.CloseBody(res) 11639 if err := googleapi.CheckResponse(res); err != nil { 11640 return nil, err 11641 } 11642 ret := &ParentReference{ 11643 ServerResponse: googleapi.ServerResponse{ 11644 Header: res.Header, 11645 HTTPStatusCode: res.StatusCode, 11646 }, 11647 } 11648 target := &ret 11649 if err := gensupport.DecodeResponse(target, res); err != nil { 11650 return nil, err 11651 } 11652 return ret, nil 11653 // { 11654 // "description": "Gets a specific parent reference.", 11655 // "httpMethod": "GET", 11656 // "id": "drive.parents.get", 11657 // "parameterOrder": [ 11658 // "fileId", 11659 // "parentId" 11660 // ], 11661 // "parameters": { 11662 // "fileId": { 11663 // "description": "The ID of the file.", 11664 // "location": "path", 11665 // "required": true, 11666 // "type": "string" 11667 // }, 11668 // "parentId": { 11669 // "description": "The ID of the parent.", 11670 // "location": "path", 11671 // "required": true, 11672 // "type": "string" 11673 // } 11674 // }, 11675 // "path": "files/{fileId}/parents/{parentId}", 11676 // "response": { 11677 // "$ref": "ParentReference" 11678 // }, 11679 // "scopes": [ 11680 // "https://www.googleapis.com/auth/drive", 11681 // "https://www.googleapis.com/auth/drive.appdata", 11682 // "https://www.googleapis.com/auth/drive.file", 11683 // "https://www.googleapis.com/auth/drive.metadata", 11684 // "https://www.googleapis.com/auth/drive.metadata.readonly", 11685 // "https://www.googleapis.com/auth/drive.photos.readonly", 11686 // "https://www.googleapis.com/auth/drive.readonly" 11687 // ] 11688 // } 11689 11690} 11691 11692// method id "drive.parents.insert": 11693 11694type ParentsInsertCall struct { 11695 s *Service 11696 fileId string 11697 parentreference *ParentReference 11698 urlParams_ gensupport.URLParams 11699 ctx_ context.Context 11700 header_ http.Header 11701} 11702 11703// Insert: Adds a parent folder for a file. 11704func (r *ParentsService) Insert(fileId string, parentreference *ParentReference) *ParentsInsertCall { 11705 c := &ParentsInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)} 11706 c.fileId = fileId 11707 c.parentreference = parentreference 11708 return c 11709} 11710 11711// SupportsAllDrives sets the optional parameter "supportsAllDrives": 11712// Deprecated - Whether the requesting application supports both My 11713// Drives and shared drives. This parameter will only be effective until 11714// June 1, 2020. Afterwards all applications are assumed to support 11715// shared drives. 11716func (c *ParentsInsertCall) SupportsAllDrives(supportsAllDrives bool) *ParentsInsertCall { 11717 c.urlParams_.Set("supportsAllDrives", fmt.Sprint(supportsAllDrives)) 11718 return c 11719} 11720 11721// SupportsTeamDrives sets the optional parameter "supportsTeamDrives": 11722// Deprecated use supportsAllDrives instead. 11723func (c *ParentsInsertCall) SupportsTeamDrives(supportsTeamDrives bool) *ParentsInsertCall { 11724 c.urlParams_.Set("supportsTeamDrives", fmt.Sprint(supportsTeamDrives)) 11725 return c 11726} 11727 11728// Fields allows partial responses to be retrieved. See 11729// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 11730// for more information. 11731func (c *ParentsInsertCall) Fields(s ...googleapi.Field) *ParentsInsertCall { 11732 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 11733 return c 11734} 11735 11736// Context sets the context to be used in this call's Do method. Any 11737// pending HTTP request will be aborted if the provided context is 11738// canceled. 11739func (c *ParentsInsertCall) Context(ctx context.Context) *ParentsInsertCall { 11740 c.ctx_ = ctx 11741 return c 11742} 11743 11744// Header returns an http.Header that can be modified by the caller to 11745// add HTTP headers to the request. 11746func (c *ParentsInsertCall) Header() http.Header { 11747 if c.header_ == nil { 11748 c.header_ = make(http.Header) 11749 } 11750 return c.header_ 11751} 11752 11753func (c *ParentsInsertCall) doRequest(alt string) (*http.Response, error) { 11754 reqHeaders := make(http.Header) 11755 for k, v := range c.header_ { 11756 reqHeaders[k] = v 11757 } 11758 reqHeaders.Set("User-Agent", c.s.userAgent()) 11759 var body io.Reader = nil 11760 body, err := googleapi.WithoutDataWrapper.JSONReader(c.parentreference) 11761 if err != nil { 11762 return nil, err 11763 } 11764 reqHeaders.Set("Content-Type", "application/json") 11765 c.urlParams_.Set("alt", alt) 11766 c.urlParams_.Set("prettyPrint", "false") 11767 urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/parents") 11768 urls += "?" + c.urlParams_.Encode() 11769 req, err := http.NewRequest("POST", urls, body) 11770 if err != nil { 11771 return nil, err 11772 } 11773 req.Header = reqHeaders 11774 googleapi.Expand(req.URL, map[string]string{ 11775 "fileId": c.fileId, 11776 }) 11777 return gensupport.SendRequest(c.ctx_, c.s.client, req) 11778} 11779 11780// Do executes the "drive.parents.insert" call. 11781// Exactly one of *ParentReference or error will be non-nil. Any non-2xx 11782// status code is an error. Response headers are in either 11783// *ParentReference.ServerResponse.Header or (if a response was returned 11784// at all) in error.(*googleapi.Error).Header. Use 11785// googleapi.IsNotModified to check whether the returned error was 11786// because http.StatusNotModified was returned. 11787func (c *ParentsInsertCall) Do(opts ...googleapi.CallOption) (*ParentReference, error) { 11788 gensupport.SetOptions(c.urlParams_, opts...) 11789 res, err := c.doRequest("json") 11790 if res != nil && res.StatusCode == http.StatusNotModified { 11791 if res.Body != nil { 11792 res.Body.Close() 11793 } 11794 return nil, &googleapi.Error{ 11795 Code: res.StatusCode, 11796 Header: res.Header, 11797 } 11798 } 11799 if err != nil { 11800 return nil, err 11801 } 11802 defer googleapi.CloseBody(res) 11803 if err := googleapi.CheckResponse(res); err != nil { 11804 return nil, err 11805 } 11806 ret := &ParentReference{ 11807 ServerResponse: googleapi.ServerResponse{ 11808 Header: res.Header, 11809 HTTPStatusCode: res.StatusCode, 11810 }, 11811 } 11812 target := &ret 11813 if err := gensupport.DecodeResponse(target, res); err != nil { 11814 return nil, err 11815 } 11816 return ret, nil 11817 // { 11818 // "description": "Adds a parent folder for a file.", 11819 // "httpMethod": "POST", 11820 // "id": "drive.parents.insert", 11821 // "parameterOrder": [ 11822 // "fileId" 11823 // ], 11824 // "parameters": { 11825 // "fileId": { 11826 // "description": "The ID of the file.", 11827 // "location": "path", 11828 // "required": true, 11829 // "type": "string" 11830 // }, 11831 // "supportsAllDrives": { 11832 // "default": "false", 11833 // "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.", 11834 // "location": "query", 11835 // "type": "boolean" 11836 // }, 11837 // "supportsTeamDrives": { 11838 // "default": "false", 11839 // "description": "Deprecated use supportsAllDrives instead.", 11840 // "location": "query", 11841 // "type": "boolean" 11842 // } 11843 // }, 11844 // "path": "files/{fileId}/parents", 11845 // "request": { 11846 // "$ref": "ParentReference" 11847 // }, 11848 // "response": { 11849 // "$ref": "ParentReference" 11850 // }, 11851 // "scopes": [ 11852 // "https://www.googleapis.com/auth/drive", 11853 // "https://www.googleapis.com/auth/drive.appdata", 11854 // "https://www.googleapis.com/auth/drive.file" 11855 // ] 11856 // } 11857 11858} 11859 11860// method id "drive.parents.list": 11861 11862type ParentsListCall struct { 11863 s *Service 11864 fileId string 11865 urlParams_ gensupport.URLParams 11866 ifNoneMatch_ string 11867 ctx_ context.Context 11868 header_ http.Header 11869} 11870 11871// List: Lists a file's parents. 11872func (r *ParentsService) List(fileId string) *ParentsListCall { 11873 c := &ParentsListCall{s: r.s, urlParams_: make(gensupport.URLParams)} 11874 c.fileId = fileId 11875 return c 11876} 11877 11878// Fields allows partial responses to be retrieved. See 11879// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 11880// for more information. 11881func (c *ParentsListCall) Fields(s ...googleapi.Field) *ParentsListCall { 11882 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 11883 return c 11884} 11885 11886// IfNoneMatch sets the optional parameter which makes the operation 11887// fail if the object's ETag matches the given value. This is useful for 11888// getting updates only after the object has changed since the last 11889// request. Use googleapi.IsNotModified to check whether the response 11890// error from Do is the result of In-None-Match. 11891func (c *ParentsListCall) IfNoneMatch(entityTag string) *ParentsListCall { 11892 c.ifNoneMatch_ = entityTag 11893 return c 11894} 11895 11896// Context sets the context to be used in this call's Do method. Any 11897// pending HTTP request will be aborted if the provided context is 11898// canceled. 11899func (c *ParentsListCall) Context(ctx context.Context) *ParentsListCall { 11900 c.ctx_ = ctx 11901 return c 11902} 11903 11904// Header returns an http.Header that can be modified by the caller to 11905// add HTTP headers to the request. 11906func (c *ParentsListCall) Header() http.Header { 11907 if c.header_ == nil { 11908 c.header_ = make(http.Header) 11909 } 11910 return c.header_ 11911} 11912 11913func (c *ParentsListCall) doRequest(alt string) (*http.Response, error) { 11914 reqHeaders := make(http.Header) 11915 for k, v := range c.header_ { 11916 reqHeaders[k] = v 11917 } 11918 reqHeaders.Set("User-Agent", c.s.userAgent()) 11919 if c.ifNoneMatch_ != "" { 11920 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 11921 } 11922 var body io.Reader = nil 11923 c.urlParams_.Set("alt", alt) 11924 c.urlParams_.Set("prettyPrint", "false") 11925 urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/parents") 11926 urls += "?" + c.urlParams_.Encode() 11927 req, err := http.NewRequest("GET", urls, body) 11928 if err != nil { 11929 return nil, err 11930 } 11931 req.Header = reqHeaders 11932 googleapi.Expand(req.URL, map[string]string{ 11933 "fileId": c.fileId, 11934 }) 11935 return gensupport.SendRequest(c.ctx_, c.s.client, req) 11936} 11937 11938// Do executes the "drive.parents.list" call. 11939// Exactly one of *ParentList or error will be non-nil. Any non-2xx 11940// status code is an error. Response headers are in either 11941// *ParentList.ServerResponse.Header or (if a response was returned at 11942// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 11943// to check whether the returned error was because 11944// http.StatusNotModified was returned. 11945func (c *ParentsListCall) Do(opts ...googleapi.CallOption) (*ParentList, error) { 11946 gensupport.SetOptions(c.urlParams_, opts...) 11947 res, err := c.doRequest("json") 11948 if res != nil && res.StatusCode == http.StatusNotModified { 11949 if res.Body != nil { 11950 res.Body.Close() 11951 } 11952 return nil, &googleapi.Error{ 11953 Code: res.StatusCode, 11954 Header: res.Header, 11955 } 11956 } 11957 if err != nil { 11958 return nil, err 11959 } 11960 defer googleapi.CloseBody(res) 11961 if err := googleapi.CheckResponse(res); err != nil { 11962 return nil, err 11963 } 11964 ret := &ParentList{ 11965 ServerResponse: googleapi.ServerResponse{ 11966 Header: res.Header, 11967 HTTPStatusCode: res.StatusCode, 11968 }, 11969 } 11970 target := &ret 11971 if err := gensupport.DecodeResponse(target, res); err != nil { 11972 return nil, err 11973 } 11974 return ret, nil 11975 // { 11976 // "description": "Lists a file's parents.", 11977 // "httpMethod": "GET", 11978 // "id": "drive.parents.list", 11979 // "parameterOrder": [ 11980 // "fileId" 11981 // ], 11982 // "parameters": { 11983 // "fileId": { 11984 // "description": "The ID of the file.", 11985 // "location": "path", 11986 // "required": true, 11987 // "type": "string" 11988 // } 11989 // }, 11990 // "path": "files/{fileId}/parents", 11991 // "response": { 11992 // "$ref": "ParentList" 11993 // }, 11994 // "scopes": [ 11995 // "https://www.googleapis.com/auth/drive", 11996 // "https://www.googleapis.com/auth/drive.appdata", 11997 // "https://www.googleapis.com/auth/drive.file", 11998 // "https://www.googleapis.com/auth/drive.metadata", 11999 // "https://www.googleapis.com/auth/drive.metadata.readonly", 12000 // "https://www.googleapis.com/auth/drive.photos.readonly", 12001 // "https://www.googleapis.com/auth/drive.readonly" 12002 // ] 12003 // } 12004 12005} 12006 12007// method id "drive.permissions.delete": 12008 12009type PermissionsDeleteCall struct { 12010 s *Service 12011 fileId string 12012 permissionId string 12013 urlParams_ gensupport.URLParams 12014 ctx_ context.Context 12015 header_ http.Header 12016} 12017 12018// Delete: Deletes a permission from a file or shared drive. 12019func (r *PermissionsService) Delete(fileId string, permissionId string) *PermissionsDeleteCall { 12020 c := &PermissionsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)} 12021 c.fileId = fileId 12022 c.permissionId = permissionId 12023 return c 12024} 12025 12026// SupportsAllDrives sets the optional parameter "supportsAllDrives": 12027// Deprecated - Whether the requesting application supports both My 12028// Drives and shared drives. This parameter will only be effective until 12029// June 1, 2020. Afterwards all applications are assumed to support 12030// shared drives. 12031func (c *PermissionsDeleteCall) SupportsAllDrives(supportsAllDrives bool) *PermissionsDeleteCall { 12032 c.urlParams_.Set("supportsAllDrives", fmt.Sprint(supportsAllDrives)) 12033 return c 12034} 12035 12036// SupportsTeamDrives sets the optional parameter "supportsTeamDrives": 12037// Deprecated use supportsAllDrives instead. 12038func (c *PermissionsDeleteCall) SupportsTeamDrives(supportsTeamDrives bool) *PermissionsDeleteCall { 12039 c.urlParams_.Set("supportsTeamDrives", fmt.Sprint(supportsTeamDrives)) 12040 return c 12041} 12042 12043// UseDomainAdminAccess sets the optional parameter 12044// "useDomainAdminAccess": Issue the request as a domain administrator; 12045// if set to true, then the requester will be granted access if the file 12046// ID parameter refers to a shared drive and the requester is an 12047// administrator of the domain to which the shared drive belongs. 12048func (c *PermissionsDeleteCall) UseDomainAdminAccess(useDomainAdminAccess bool) *PermissionsDeleteCall { 12049 c.urlParams_.Set("useDomainAdminAccess", fmt.Sprint(useDomainAdminAccess)) 12050 return c 12051} 12052 12053// Fields allows partial responses to be retrieved. See 12054// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 12055// for more information. 12056func (c *PermissionsDeleteCall) Fields(s ...googleapi.Field) *PermissionsDeleteCall { 12057 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 12058 return c 12059} 12060 12061// Context sets the context to be used in this call's Do method. Any 12062// pending HTTP request will be aborted if the provided context is 12063// canceled. 12064func (c *PermissionsDeleteCall) Context(ctx context.Context) *PermissionsDeleteCall { 12065 c.ctx_ = ctx 12066 return c 12067} 12068 12069// Header returns an http.Header that can be modified by the caller to 12070// add HTTP headers to the request. 12071func (c *PermissionsDeleteCall) Header() http.Header { 12072 if c.header_ == nil { 12073 c.header_ = make(http.Header) 12074 } 12075 return c.header_ 12076} 12077 12078func (c *PermissionsDeleteCall) doRequest(alt string) (*http.Response, error) { 12079 reqHeaders := make(http.Header) 12080 for k, v := range c.header_ { 12081 reqHeaders[k] = v 12082 } 12083 reqHeaders.Set("User-Agent", c.s.userAgent()) 12084 var body io.Reader = nil 12085 c.urlParams_.Set("alt", alt) 12086 c.urlParams_.Set("prettyPrint", "false") 12087 urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/permissions/{permissionId}") 12088 urls += "?" + c.urlParams_.Encode() 12089 req, err := http.NewRequest("DELETE", urls, body) 12090 if err != nil { 12091 return nil, err 12092 } 12093 req.Header = reqHeaders 12094 googleapi.Expand(req.URL, map[string]string{ 12095 "fileId": c.fileId, 12096 "permissionId": c.permissionId, 12097 }) 12098 return gensupport.SendRequest(c.ctx_, c.s.client, req) 12099} 12100 12101// Do executes the "drive.permissions.delete" call. 12102func (c *PermissionsDeleteCall) Do(opts ...googleapi.CallOption) error { 12103 gensupport.SetOptions(c.urlParams_, opts...) 12104 res, err := c.doRequest("json") 12105 if err != nil { 12106 return err 12107 } 12108 defer googleapi.CloseBody(res) 12109 if err := googleapi.CheckResponse(res); err != nil { 12110 return err 12111 } 12112 return nil 12113 // { 12114 // "description": "Deletes a permission from a file or shared drive.", 12115 // "httpMethod": "DELETE", 12116 // "id": "drive.permissions.delete", 12117 // "parameterOrder": [ 12118 // "fileId", 12119 // "permissionId" 12120 // ], 12121 // "parameters": { 12122 // "fileId": { 12123 // "description": "The ID for the file or shared drive.", 12124 // "location": "path", 12125 // "required": true, 12126 // "type": "string" 12127 // }, 12128 // "permissionId": { 12129 // "description": "The ID for the permission.", 12130 // "location": "path", 12131 // "required": true, 12132 // "type": "string" 12133 // }, 12134 // "supportsAllDrives": { 12135 // "default": "false", 12136 // "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.", 12137 // "location": "query", 12138 // "type": "boolean" 12139 // }, 12140 // "supportsTeamDrives": { 12141 // "default": "false", 12142 // "description": "Deprecated use supportsAllDrives instead.", 12143 // "location": "query", 12144 // "type": "boolean" 12145 // }, 12146 // "useDomainAdminAccess": { 12147 // "default": "false", 12148 // "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.", 12149 // "location": "query", 12150 // "type": "boolean" 12151 // } 12152 // }, 12153 // "path": "files/{fileId}/permissions/{permissionId}", 12154 // "scopes": [ 12155 // "https://www.googleapis.com/auth/drive", 12156 // "https://www.googleapis.com/auth/drive.file" 12157 // ] 12158 // } 12159 12160} 12161 12162// method id "drive.permissions.get": 12163 12164type PermissionsGetCall struct { 12165 s *Service 12166 fileId string 12167 permissionId string 12168 urlParams_ gensupport.URLParams 12169 ifNoneMatch_ string 12170 ctx_ context.Context 12171 header_ http.Header 12172} 12173 12174// Get: Gets a permission by ID. 12175func (r *PermissionsService) Get(fileId string, permissionId string) *PermissionsGetCall { 12176 c := &PermissionsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)} 12177 c.fileId = fileId 12178 c.permissionId = permissionId 12179 return c 12180} 12181 12182// SupportsAllDrives sets the optional parameter "supportsAllDrives": 12183// Deprecated - Whether the requesting application supports both My 12184// Drives and shared drives. This parameter will only be effective until 12185// June 1, 2020. Afterwards all applications are assumed to support 12186// shared drives. 12187func (c *PermissionsGetCall) SupportsAllDrives(supportsAllDrives bool) *PermissionsGetCall { 12188 c.urlParams_.Set("supportsAllDrives", fmt.Sprint(supportsAllDrives)) 12189 return c 12190} 12191 12192// SupportsTeamDrives sets the optional parameter "supportsTeamDrives": 12193// Deprecated use supportsAllDrives instead. 12194func (c *PermissionsGetCall) SupportsTeamDrives(supportsTeamDrives bool) *PermissionsGetCall { 12195 c.urlParams_.Set("supportsTeamDrives", fmt.Sprint(supportsTeamDrives)) 12196 return c 12197} 12198 12199// UseDomainAdminAccess sets the optional parameter 12200// "useDomainAdminAccess": Issue the request as a domain administrator; 12201// if set to true, then the requester will be granted access if the file 12202// ID parameter refers to a shared drive and the requester is an 12203// administrator of the domain to which the shared drive belongs. 12204func (c *PermissionsGetCall) UseDomainAdminAccess(useDomainAdminAccess bool) *PermissionsGetCall { 12205 c.urlParams_.Set("useDomainAdminAccess", fmt.Sprint(useDomainAdminAccess)) 12206 return c 12207} 12208 12209// Fields allows partial responses to be retrieved. See 12210// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 12211// for more information. 12212func (c *PermissionsGetCall) Fields(s ...googleapi.Field) *PermissionsGetCall { 12213 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 12214 return c 12215} 12216 12217// IfNoneMatch sets the optional parameter which makes the operation 12218// fail if the object's ETag matches the given value. This is useful for 12219// getting updates only after the object has changed since the last 12220// request. Use googleapi.IsNotModified to check whether the response 12221// error from Do is the result of In-None-Match. 12222func (c *PermissionsGetCall) IfNoneMatch(entityTag string) *PermissionsGetCall { 12223 c.ifNoneMatch_ = entityTag 12224 return c 12225} 12226 12227// Context sets the context to be used in this call's Do method. Any 12228// pending HTTP request will be aborted if the provided context is 12229// canceled. 12230func (c *PermissionsGetCall) Context(ctx context.Context) *PermissionsGetCall { 12231 c.ctx_ = ctx 12232 return c 12233} 12234 12235// Header returns an http.Header that can be modified by the caller to 12236// add HTTP headers to the request. 12237func (c *PermissionsGetCall) Header() http.Header { 12238 if c.header_ == nil { 12239 c.header_ = make(http.Header) 12240 } 12241 return c.header_ 12242} 12243 12244func (c *PermissionsGetCall) doRequest(alt string) (*http.Response, error) { 12245 reqHeaders := make(http.Header) 12246 for k, v := range c.header_ { 12247 reqHeaders[k] = v 12248 } 12249 reqHeaders.Set("User-Agent", c.s.userAgent()) 12250 if c.ifNoneMatch_ != "" { 12251 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 12252 } 12253 var body io.Reader = nil 12254 c.urlParams_.Set("alt", alt) 12255 c.urlParams_.Set("prettyPrint", "false") 12256 urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/permissions/{permissionId}") 12257 urls += "?" + c.urlParams_.Encode() 12258 req, err := http.NewRequest("GET", urls, body) 12259 if err != nil { 12260 return nil, err 12261 } 12262 req.Header = reqHeaders 12263 googleapi.Expand(req.URL, map[string]string{ 12264 "fileId": c.fileId, 12265 "permissionId": c.permissionId, 12266 }) 12267 return gensupport.SendRequest(c.ctx_, c.s.client, req) 12268} 12269 12270// Do executes the "drive.permissions.get" call. 12271// Exactly one of *Permission or error will be non-nil. Any non-2xx 12272// status code is an error. Response headers are in either 12273// *Permission.ServerResponse.Header or (if a response was returned at 12274// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 12275// to check whether the returned error was because 12276// http.StatusNotModified was returned. 12277func (c *PermissionsGetCall) Do(opts ...googleapi.CallOption) (*Permission, error) { 12278 gensupport.SetOptions(c.urlParams_, opts...) 12279 res, err := c.doRequest("json") 12280 if res != nil && res.StatusCode == http.StatusNotModified { 12281 if res.Body != nil { 12282 res.Body.Close() 12283 } 12284 return nil, &googleapi.Error{ 12285 Code: res.StatusCode, 12286 Header: res.Header, 12287 } 12288 } 12289 if err != nil { 12290 return nil, err 12291 } 12292 defer googleapi.CloseBody(res) 12293 if err := googleapi.CheckResponse(res); err != nil { 12294 return nil, err 12295 } 12296 ret := &Permission{ 12297 ServerResponse: googleapi.ServerResponse{ 12298 Header: res.Header, 12299 HTTPStatusCode: res.StatusCode, 12300 }, 12301 } 12302 target := &ret 12303 if err := gensupport.DecodeResponse(target, res); err != nil { 12304 return nil, err 12305 } 12306 return ret, nil 12307 // { 12308 // "description": "Gets a permission by ID.", 12309 // "httpMethod": "GET", 12310 // "id": "drive.permissions.get", 12311 // "parameterOrder": [ 12312 // "fileId", 12313 // "permissionId" 12314 // ], 12315 // "parameters": { 12316 // "fileId": { 12317 // "description": "The ID for the file or shared drive.", 12318 // "location": "path", 12319 // "required": true, 12320 // "type": "string" 12321 // }, 12322 // "permissionId": { 12323 // "description": "The ID for the permission.", 12324 // "location": "path", 12325 // "required": true, 12326 // "type": "string" 12327 // }, 12328 // "supportsAllDrives": { 12329 // "default": "false", 12330 // "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.", 12331 // "location": "query", 12332 // "type": "boolean" 12333 // }, 12334 // "supportsTeamDrives": { 12335 // "default": "false", 12336 // "description": "Deprecated use supportsAllDrives instead.", 12337 // "location": "query", 12338 // "type": "boolean" 12339 // }, 12340 // "useDomainAdminAccess": { 12341 // "default": "false", 12342 // "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.", 12343 // "location": "query", 12344 // "type": "boolean" 12345 // } 12346 // }, 12347 // "path": "files/{fileId}/permissions/{permissionId}", 12348 // "response": { 12349 // "$ref": "Permission" 12350 // }, 12351 // "scopes": [ 12352 // "https://www.googleapis.com/auth/drive", 12353 // "https://www.googleapis.com/auth/drive.file", 12354 // "https://www.googleapis.com/auth/drive.metadata", 12355 // "https://www.googleapis.com/auth/drive.metadata.readonly", 12356 // "https://www.googleapis.com/auth/drive.photos.readonly", 12357 // "https://www.googleapis.com/auth/drive.readonly" 12358 // ] 12359 // } 12360 12361} 12362 12363// method id "drive.permissions.getIdForEmail": 12364 12365type PermissionsGetIdForEmailCall struct { 12366 s *Service 12367 email string 12368 urlParams_ gensupport.URLParams 12369 ifNoneMatch_ string 12370 ctx_ context.Context 12371 header_ http.Header 12372} 12373 12374// GetIdForEmail: Returns the permission ID for an email address. 12375func (r *PermissionsService) GetIdForEmail(email string) *PermissionsGetIdForEmailCall { 12376 c := &PermissionsGetIdForEmailCall{s: r.s, urlParams_: make(gensupport.URLParams)} 12377 c.email = email 12378 return c 12379} 12380 12381// Fields allows partial responses to be retrieved. See 12382// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 12383// for more information. 12384func (c *PermissionsGetIdForEmailCall) Fields(s ...googleapi.Field) *PermissionsGetIdForEmailCall { 12385 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 12386 return c 12387} 12388 12389// IfNoneMatch sets the optional parameter which makes the operation 12390// fail if the object's ETag matches the given value. This is useful for 12391// getting updates only after the object has changed since the last 12392// request. Use googleapi.IsNotModified to check whether the response 12393// error from Do is the result of In-None-Match. 12394func (c *PermissionsGetIdForEmailCall) IfNoneMatch(entityTag string) *PermissionsGetIdForEmailCall { 12395 c.ifNoneMatch_ = entityTag 12396 return c 12397} 12398 12399// Context sets the context to be used in this call's Do method. Any 12400// pending HTTP request will be aborted if the provided context is 12401// canceled. 12402func (c *PermissionsGetIdForEmailCall) Context(ctx context.Context) *PermissionsGetIdForEmailCall { 12403 c.ctx_ = ctx 12404 return c 12405} 12406 12407// Header returns an http.Header that can be modified by the caller to 12408// add HTTP headers to the request. 12409func (c *PermissionsGetIdForEmailCall) Header() http.Header { 12410 if c.header_ == nil { 12411 c.header_ = make(http.Header) 12412 } 12413 return c.header_ 12414} 12415 12416func (c *PermissionsGetIdForEmailCall) doRequest(alt string) (*http.Response, error) { 12417 reqHeaders := make(http.Header) 12418 for k, v := range c.header_ { 12419 reqHeaders[k] = v 12420 } 12421 reqHeaders.Set("User-Agent", c.s.userAgent()) 12422 if c.ifNoneMatch_ != "" { 12423 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 12424 } 12425 var body io.Reader = nil 12426 c.urlParams_.Set("alt", alt) 12427 c.urlParams_.Set("prettyPrint", "false") 12428 urls := googleapi.ResolveRelative(c.s.BasePath, "permissionIds/{email}") 12429 urls += "?" + c.urlParams_.Encode() 12430 req, err := http.NewRequest("GET", urls, body) 12431 if err != nil { 12432 return nil, err 12433 } 12434 req.Header = reqHeaders 12435 googleapi.Expand(req.URL, map[string]string{ 12436 "email": c.email, 12437 }) 12438 return gensupport.SendRequest(c.ctx_, c.s.client, req) 12439} 12440 12441// Do executes the "drive.permissions.getIdForEmail" call. 12442// Exactly one of *PermissionId or error will be non-nil. Any non-2xx 12443// status code is an error. Response headers are in either 12444// *PermissionId.ServerResponse.Header or (if a response was returned at 12445// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 12446// to check whether the returned error was because 12447// http.StatusNotModified was returned. 12448func (c *PermissionsGetIdForEmailCall) Do(opts ...googleapi.CallOption) (*PermissionId, error) { 12449 gensupport.SetOptions(c.urlParams_, opts...) 12450 res, err := c.doRequest("json") 12451 if res != nil && res.StatusCode == http.StatusNotModified { 12452 if res.Body != nil { 12453 res.Body.Close() 12454 } 12455 return nil, &googleapi.Error{ 12456 Code: res.StatusCode, 12457 Header: res.Header, 12458 } 12459 } 12460 if err != nil { 12461 return nil, err 12462 } 12463 defer googleapi.CloseBody(res) 12464 if err := googleapi.CheckResponse(res); err != nil { 12465 return nil, err 12466 } 12467 ret := &PermissionId{ 12468 ServerResponse: googleapi.ServerResponse{ 12469 Header: res.Header, 12470 HTTPStatusCode: res.StatusCode, 12471 }, 12472 } 12473 target := &ret 12474 if err := gensupport.DecodeResponse(target, res); err != nil { 12475 return nil, err 12476 } 12477 return ret, nil 12478 // { 12479 // "description": "Returns the permission ID for an email address.", 12480 // "httpMethod": "GET", 12481 // "id": "drive.permissions.getIdForEmail", 12482 // "parameterOrder": [ 12483 // "email" 12484 // ], 12485 // "parameters": { 12486 // "email": { 12487 // "description": "The email address for which to return a permission ID", 12488 // "location": "path", 12489 // "required": true, 12490 // "type": "string" 12491 // } 12492 // }, 12493 // "path": "permissionIds/{email}", 12494 // "response": { 12495 // "$ref": "PermissionId" 12496 // }, 12497 // "scopes": [ 12498 // "https://www.googleapis.com/auth/drive", 12499 // "https://www.googleapis.com/auth/drive.appdata", 12500 // "https://www.googleapis.com/auth/drive.apps.readonly", 12501 // "https://www.googleapis.com/auth/drive.file", 12502 // "https://www.googleapis.com/auth/drive.metadata", 12503 // "https://www.googleapis.com/auth/drive.metadata.readonly", 12504 // "https://www.googleapis.com/auth/drive.photos.readonly", 12505 // "https://www.googleapis.com/auth/drive.readonly" 12506 // ] 12507 // } 12508 12509} 12510 12511// method id "drive.permissions.insert": 12512 12513type PermissionsInsertCall struct { 12514 s *Service 12515 fileId string 12516 permission *Permission 12517 urlParams_ gensupport.URLParams 12518 ctx_ context.Context 12519 header_ http.Header 12520} 12521 12522// Insert: Inserts a permission for a file or shared drive. 12523func (r *PermissionsService) Insert(fileId string, permission *Permission) *PermissionsInsertCall { 12524 c := &PermissionsInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)} 12525 c.fileId = fileId 12526 c.permission = permission 12527 return c 12528} 12529 12530// EmailMessage sets the optional parameter "emailMessage": A plain text 12531// custom message to include in notification emails. 12532func (c *PermissionsInsertCall) EmailMessage(emailMessage string) *PermissionsInsertCall { 12533 c.urlParams_.Set("emailMessage", emailMessage) 12534 return c 12535} 12536 12537// SendNotificationEmails sets the optional parameter 12538// "sendNotificationEmails": Whether to send notification emails when 12539// sharing to users or groups. This parameter is ignored and an email is 12540// sent if the role is owner. 12541func (c *PermissionsInsertCall) SendNotificationEmails(sendNotificationEmails bool) *PermissionsInsertCall { 12542 c.urlParams_.Set("sendNotificationEmails", fmt.Sprint(sendNotificationEmails)) 12543 return c 12544} 12545 12546// SupportsAllDrives sets the optional parameter "supportsAllDrives": 12547// Deprecated - Whether the requesting application supports both My 12548// Drives and shared drives. This parameter will only be effective until 12549// June 1, 2020. Afterwards all applications are assumed to support 12550// shared drives. 12551func (c *PermissionsInsertCall) SupportsAllDrives(supportsAllDrives bool) *PermissionsInsertCall { 12552 c.urlParams_.Set("supportsAllDrives", fmt.Sprint(supportsAllDrives)) 12553 return c 12554} 12555 12556// SupportsTeamDrives sets the optional parameter "supportsTeamDrives": 12557// Deprecated use supportsAllDrives instead. 12558func (c *PermissionsInsertCall) SupportsTeamDrives(supportsTeamDrives bool) *PermissionsInsertCall { 12559 c.urlParams_.Set("supportsTeamDrives", fmt.Sprint(supportsTeamDrives)) 12560 return c 12561} 12562 12563// UseDomainAdminAccess sets the optional parameter 12564// "useDomainAdminAccess": Issue the request as a domain administrator; 12565// if set to true, then the requester will be granted access if the file 12566// ID parameter refers to a shared drive and the requester is an 12567// administrator of the domain to which the shared drive belongs. 12568func (c *PermissionsInsertCall) UseDomainAdminAccess(useDomainAdminAccess bool) *PermissionsInsertCall { 12569 c.urlParams_.Set("useDomainAdminAccess", fmt.Sprint(useDomainAdminAccess)) 12570 return c 12571} 12572 12573// Fields allows partial responses to be retrieved. See 12574// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 12575// for more information. 12576func (c *PermissionsInsertCall) Fields(s ...googleapi.Field) *PermissionsInsertCall { 12577 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 12578 return c 12579} 12580 12581// Context sets the context to be used in this call's Do method. Any 12582// pending HTTP request will be aborted if the provided context is 12583// canceled. 12584func (c *PermissionsInsertCall) Context(ctx context.Context) *PermissionsInsertCall { 12585 c.ctx_ = ctx 12586 return c 12587} 12588 12589// Header returns an http.Header that can be modified by the caller to 12590// add HTTP headers to the request. 12591func (c *PermissionsInsertCall) Header() http.Header { 12592 if c.header_ == nil { 12593 c.header_ = make(http.Header) 12594 } 12595 return c.header_ 12596} 12597 12598func (c *PermissionsInsertCall) doRequest(alt string) (*http.Response, error) { 12599 reqHeaders := make(http.Header) 12600 for k, v := range c.header_ { 12601 reqHeaders[k] = v 12602 } 12603 reqHeaders.Set("User-Agent", c.s.userAgent()) 12604 var body io.Reader = nil 12605 body, err := googleapi.WithoutDataWrapper.JSONReader(c.permission) 12606 if err != nil { 12607 return nil, err 12608 } 12609 reqHeaders.Set("Content-Type", "application/json") 12610 c.urlParams_.Set("alt", alt) 12611 c.urlParams_.Set("prettyPrint", "false") 12612 urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/permissions") 12613 urls += "?" + c.urlParams_.Encode() 12614 req, err := http.NewRequest("POST", urls, body) 12615 if err != nil { 12616 return nil, err 12617 } 12618 req.Header = reqHeaders 12619 googleapi.Expand(req.URL, map[string]string{ 12620 "fileId": c.fileId, 12621 }) 12622 return gensupport.SendRequest(c.ctx_, c.s.client, req) 12623} 12624 12625// Do executes the "drive.permissions.insert" call. 12626// Exactly one of *Permission or error will be non-nil. Any non-2xx 12627// status code is an error. Response headers are in either 12628// *Permission.ServerResponse.Header or (if a response was returned at 12629// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 12630// to check whether the returned error was because 12631// http.StatusNotModified was returned. 12632func (c *PermissionsInsertCall) Do(opts ...googleapi.CallOption) (*Permission, error) { 12633 gensupport.SetOptions(c.urlParams_, opts...) 12634 res, err := c.doRequest("json") 12635 if res != nil && res.StatusCode == http.StatusNotModified { 12636 if res.Body != nil { 12637 res.Body.Close() 12638 } 12639 return nil, &googleapi.Error{ 12640 Code: res.StatusCode, 12641 Header: res.Header, 12642 } 12643 } 12644 if err != nil { 12645 return nil, err 12646 } 12647 defer googleapi.CloseBody(res) 12648 if err := googleapi.CheckResponse(res); err != nil { 12649 return nil, err 12650 } 12651 ret := &Permission{ 12652 ServerResponse: googleapi.ServerResponse{ 12653 Header: res.Header, 12654 HTTPStatusCode: res.StatusCode, 12655 }, 12656 } 12657 target := &ret 12658 if err := gensupport.DecodeResponse(target, res); err != nil { 12659 return nil, err 12660 } 12661 return ret, nil 12662 // { 12663 // "description": "Inserts a permission for a file or shared drive.", 12664 // "httpMethod": "POST", 12665 // "id": "drive.permissions.insert", 12666 // "parameterOrder": [ 12667 // "fileId" 12668 // ], 12669 // "parameters": { 12670 // "emailMessage": { 12671 // "description": "A plain text custom message to include in notification emails.", 12672 // "location": "query", 12673 // "type": "string" 12674 // }, 12675 // "fileId": { 12676 // "description": "The ID for the file or shared drive.", 12677 // "location": "path", 12678 // "required": true, 12679 // "type": "string" 12680 // }, 12681 // "sendNotificationEmails": { 12682 // "default": "true", 12683 // "description": "Whether to send notification emails when sharing to users or groups. This parameter is ignored and an email is sent if the role is owner.", 12684 // "location": "query", 12685 // "type": "boolean" 12686 // }, 12687 // "supportsAllDrives": { 12688 // "default": "false", 12689 // "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.", 12690 // "location": "query", 12691 // "type": "boolean" 12692 // }, 12693 // "supportsTeamDrives": { 12694 // "default": "false", 12695 // "description": "Deprecated use supportsAllDrives instead.", 12696 // "location": "query", 12697 // "type": "boolean" 12698 // }, 12699 // "useDomainAdminAccess": { 12700 // "default": "false", 12701 // "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.", 12702 // "location": "query", 12703 // "type": "boolean" 12704 // } 12705 // }, 12706 // "path": "files/{fileId}/permissions", 12707 // "request": { 12708 // "$ref": "Permission" 12709 // }, 12710 // "response": { 12711 // "$ref": "Permission" 12712 // }, 12713 // "scopes": [ 12714 // "https://www.googleapis.com/auth/drive", 12715 // "https://www.googleapis.com/auth/drive.file" 12716 // ] 12717 // } 12718 12719} 12720 12721// method id "drive.permissions.list": 12722 12723type PermissionsListCall struct { 12724 s *Service 12725 fileId string 12726 urlParams_ gensupport.URLParams 12727 ifNoneMatch_ string 12728 ctx_ context.Context 12729 header_ http.Header 12730} 12731 12732// List: Lists a file's or shared drive's permissions. 12733func (r *PermissionsService) List(fileId string) *PermissionsListCall { 12734 c := &PermissionsListCall{s: r.s, urlParams_: make(gensupport.URLParams)} 12735 c.fileId = fileId 12736 return c 12737} 12738 12739// MaxResults sets the optional parameter "maxResults": The maximum 12740// number of permissions to return per page. When not set for files in a 12741// shared drive, at most 100 results will be returned. When not set for 12742// files that are not in a shared drive, the entire list will be 12743// returned. 12744func (c *PermissionsListCall) MaxResults(maxResults int64) *PermissionsListCall { 12745 c.urlParams_.Set("maxResults", fmt.Sprint(maxResults)) 12746 return c 12747} 12748 12749// PageToken sets the optional parameter "pageToken": The token for 12750// continuing a previous list request on the next page. This should be 12751// set to the value of 'nextPageToken' from the previous response. 12752func (c *PermissionsListCall) PageToken(pageToken string) *PermissionsListCall { 12753 c.urlParams_.Set("pageToken", pageToken) 12754 return c 12755} 12756 12757// SupportsAllDrives sets the optional parameter "supportsAllDrives": 12758// Deprecated - Whether the requesting application supports both My 12759// Drives and shared drives. This parameter will only be effective until 12760// June 1, 2020. Afterwards all applications are assumed to support 12761// shared drives. 12762func (c *PermissionsListCall) SupportsAllDrives(supportsAllDrives bool) *PermissionsListCall { 12763 c.urlParams_.Set("supportsAllDrives", fmt.Sprint(supportsAllDrives)) 12764 return c 12765} 12766 12767// SupportsTeamDrives sets the optional parameter "supportsTeamDrives": 12768// Deprecated use supportsAllDrives instead. 12769func (c *PermissionsListCall) SupportsTeamDrives(supportsTeamDrives bool) *PermissionsListCall { 12770 c.urlParams_.Set("supportsTeamDrives", fmt.Sprint(supportsTeamDrives)) 12771 return c 12772} 12773 12774// UseDomainAdminAccess sets the optional parameter 12775// "useDomainAdminAccess": Issue the request as a domain administrator; 12776// if set to true, then the requester will be granted access if the file 12777// ID parameter refers to a shared drive and the requester is an 12778// administrator of the domain to which the shared drive belongs. 12779func (c *PermissionsListCall) UseDomainAdminAccess(useDomainAdminAccess bool) *PermissionsListCall { 12780 c.urlParams_.Set("useDomainAdminAccess", fmt.Sprint(useDomainAdminAccess)) 12781 return c 12782} 12783 12784// Fields allows partial responses to be retrieved. See 12785// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 12786// for more information. 12787func (c *PermissionsListCall) Fields(s ...googleapi.Field) *PermissionsListCall { 12788 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 12789 return c 12790} 12791 12792// IfNoneMatch sets the optional parameter which makes the operation 12793// fail if the object's ETag matches the given value. This is useful for 12794// getting updates only after the object has changed since the last 12795// request. Use googleapi.IsNotModified to check whether the response 12796// error from Do is the result of In-None-Match. 12797func (c *PermissionsListCall) IfNoneMatch(entityTag string) *PermissionsListCall { 12798 c.ifNoneMatch_ = entityTag 12799 return c 12800} 12801 12802// Context sets the context to be used in this call's Do method. Any 12803// pending HTTP request will be aborted if the provided context is 12804// canceled. 12805func (c *PermissionsListCall) Context(ctx context.Context) *PermissionsListCall { 12806 c.ctx_ = ctx 12807 return c 12808} 12809 12810// Header returns an http.Header that can be modified by the caller to 12811// add HTTP headers to the request. 12812func (c *PermissionsListCall) Header() http.Header { 12813 if c.header_ == nil { 12814 c.header_ = make(http.Header) 12815 } 12816 return c.header_ 12817} 12818 12819func (c *PermissionsListCall) doRequest(alt string) (*http.Response, error) { 12820 reqHeaders := make(http.Header) 12821 for k, v := range c.header_ { 12822 reqHeaders[k] = v 12823 } 12824 reqHeaders.Set("User-Agent", c.s.userAgent()) 12825 if c.ifNoneMatch_ != "" { 12826 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 12827 } 12828 var body io.Reader = nil 12829 c.urlParams_.Set("alt", alt) 12830 c.urlParams_.Set("prettyPrint", "false") 12831 urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/permissions") 12832 urls += "?" + c.urlParams_.Encode() 12833 req, err := http.NewRequest("GET", urls, body) 12834 if err != nil { 12835 return nil, err 12836 } 12837 req.Header = reqHeaders 12838 googleapi.Expand(req.URL, map[string]string{ 12839 "fileId": c.fileId, 12840 }) 12841 return gensupport.SendRequest(c.ctx_, c.s.client, req) 12842} 12843 12844// Do executes the "drive.permissions.list" call. 12845// Exactly one of *PermissionList or error will be non-nil. Any non-2xx 12846// status code is an error. Response headers are in either 12847// *PermissionList.ServerResponse.Header or (if a response was returned 12848// at all) in error.(*googleapi.Error).Header. Use 12849// googleapi.IsNotModified to check whether the returned error was 12850// because http.StatusNotModified was returned. 12851func (c *PermissionsListCall) Do(opts ...googleapi.CallOption) (*PermissionList, error) { 12852 gensupport.SetOptions(c.urlParams_, opts...) 12853 res, err := c.doRequest("json") 12854 if res != nil && res.StatusCode == http.StatusNotModified { 12855 if res.Body != nil { 12856 res.Body.Close() 12857 } 12858 return nil, &googleapi.Error{ 12859 Code: res.StatusCode, 12860 Header: res.Header, 12861 } 12862 } 12863 if err != nil { 12864 return nil, err 12865 } 12866 defer googleapi.CloseBody(res) 12867 if err := googleapi.CheckResponse(res); err != nil { 12868 return nil, err 12869 } 12870 ret := &PermissionList{ 12871 ServerResponse: googleapi.ServerResponse{ 12872 Header: res.Header, 12873 HTTPStatusCode: res.StatusCode, 12874 }, 12875 } 12876 target := &ret 12877 if err := gensupport.DecodeResponse(target, res); err != nil { 12878 return nil, err 12879 } 12880 return ret, nil 12881 // { 12882 // "description": "Lists a file's or shared drive's permissions.", 12883 // "httpMethod": "GET", 12884 // "id": "drive.permissions.list", 12885 // "parameterOrder": [ 12886 // "fileId" 12887 // ], 12888 // "parameters": { 12889 // "fileId": { 12890 // "description": "The ID for the file or shared drive.", 12891 // "location": "path", 12892 // "required": true, 12893 // "type": "string" 12894 // }, 12895 // "maxResults": { 12896 // "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.", 12897 // "format": "int32", 12898 // "location": "query", 12899 // "maximum": "100", 12900 // "minimum": "1", 12901 // "type": "integer" 12902 // }, 12903 // "pageToken": { 12904 // "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.", 12905 // "location": "query", 12906 // "type": "string" 12907 // }, 12908 // "supportsAllDrives": { 12909 // "default": "false", 12910 // "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.", 12911 // "location": "query", 12912 // "type": "boolean" 12913 // }, 12914 // "supportsTeamDrives": { 12915 // "default": "false", 12916 // "description": "Deprecated use supportsAllDrives instead.", 12917 // "location": "query", 12918 // "type": "boolean" 12919 // }, 12920 // "useDomainAdminAccess": { 12921 // "default": "false", 12922 // "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.", 12923 // "location": "query", 12924 // "type": "boolean" 12925 // } 12926 // }, 12927 // "path": "files/{fileId}/permissions", 12928 // "response": { 12929 // "$ref": "PermissionList" 12930 // }, 12931 // "scopes": [ 12932 // "https://www.googleapis.com/auth/drive", 12933 // "https://www.googleapis.com/auth/drive.file", 12934 // "https://www.googleapis.com/auth/drive.metadata", 12935 // "https://www.googleapis.com/auth/drive.metadata.readonly", 12936 // "https://www.googleapis.com/auth/drive.photos.readonly", 12937 // "https://www.googleapis.com/auth/drive.readonly" 12938 // ] 12939 // } 12940 12941} 12942 12943// Pages invokes f for each page of results. 12944// A non-nil error returned from f will halt the iteration. 12945// The provided context supersedes any context provided to the Context method. 12946func (c *PermissionsListCall) Pages(ctx context.Context, f func(*PermissionList) error) error { 12947 c.ctx_ = ctx 12948 defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point 12949 for { 12950 x, err := c.Do() 12951 if err != nil { 12952 return err 12953 } 12954 if err := f(x); err != nil { 12955 return err 12956 } 12957 if x.NextPageToken == "" { 12958 return nil 12959 } 12960 c.PageToken(x.NextPageToken) 12961 } 12962} 12963 12964// method id "drive.permissions.patch": 12965 12966type PermissionsPatchCall struct { 12967 s *Service 12968 fileId string 12969 permissionId string 12970 permission *Permission 12971 urlParams_ gensupport.URLParams 12972 ctx_ context.Context 12973 header_ http.Header 12974} 12975 12976// Patch: Updates a permission using patch semantics. 12977func (r *PermissionsService) Patch(fileId string, permissionId string, permission *Permission) *PermissionsPatchCall { 12978 c := &PermissionsPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)} 12979 c.fileId = fileId 12980 c.permissionId = permissionId 12981 c.permission = permission 12982 return c 12983} 12984 12985// RemoveExpiration sets the optional parameter "removeExpiration": 12986// Whether to remove the expiration date. 12987func (c *PermissionsPatchCall) RemoveExpiration(removeExpiration bool) *PermissionsPatchCall { 12988 c.urlParams_.Set("removeExpiration", fmt.Sprint(removeExpiration)) 12989 return c 12990} 12991 12992// SupportsAllDrives sets the optional parameter "supportsAllDrives": 12993// Deprecated - Whether the requesting application supports both My 12994// Drives and shared drives. This parameter will only be effective until 12995// June 1, 2020. Afterwards all applications are assumed to support 12996// shared drives. 12997func (c *PermissionsPatchCall) SupportsAllDrives(supportsAllDrives bool) *PermissionsPatchCall { 12998 c.urlParams_.Set("supportsAllDrives", fmt.Sprint(supportsAllDrives)) 12999 return c 13000} 13001 13002// SupportsTeamDrives sets the optional parameter "supportsTeamDrives": 13003// Deprecated use supportsAllDrives instead. 13004func (c *PermissionsPatchCall) SupportsTeamDrives(supportsTeamDrives bool) *PermissionsPatchCall { 13005 c.urlParams_.Set("supportsTeamDrives", fmt.Sprint(supportsTeamDrives)) 13006 return c 13007} 13008 13009// TransferOwnership sets the optional parameter "transferOwnership": 13010// Whether changing a role to 'owner' downgrades the current owners to 13011// writers. Does nothing if the specified role is not 'owner'. 13012func (c *PermissionsPatchCall) TransferOwnership(transferOwnership bool) *PermissionsPatchCall { 13013 c.urlParams_.Set("transferOwnership", fmt.Sprint(transferOwnership)) 13014 return c 13015} 13016 13017// UseDomainAdminAccess sets the optional parameter 13018// "useDomainAdminAccess": Issue the request as a domain administrator; 13019// if set to true, then the requester will be granted access if the file 13020// ID parameter refers to a shared drive and the requester is an 13021// administrator of the domain to which the shared drive belongs. 13022func (c *PermissionsPatchCall) UseDomainAdminAccess(useDomainAdminAccess bool) *PermissionsPatchCall { 13023 c.urlParams_.Set("useDomainAdminAccess", fmt.Sprint(useDomainAdminAccess)) 13024 return c 13025} 13026 13027// Fields allows partial responses to be retrieved. See 13028// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 13029// for more information. 13030func (c *PermissionsPatchCall) Fields(s ...googleapi.Field) *PermissionsPatchCall { 13031 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 13032 return c 13033} 13034 13035// Context sets the context to be used in this call's Do method. Any 13036// pending HTTP request will be aborted if the provided context is 13037// canceled. 13038func (c *PermissionsPatchCall) Context(ctx context.Context) *PermissionsPatchCall { 13039 c.ctx_ = ctx 13040 return c 13041} 13042 13043// Header returns an http.Header that can be modified by the caller to 13044// add HTTP headers to the request. 13045func (c *PermissionsPatchCall) Header() http.Header { 13046 if c.header_ == nil { 13047 c.header_ = make(http.Header) 13048 } 13049 return c.header_ 13050} 13051 13052func (c *PermissionsPatchCall) doRequest(alt string) (*http.Response, error) { 13053 reqHeaders := make(http.Header) 13054 for k, v := range c.header_ { 13055 reqHeaders[k] = v 13056 } 13057 reqHeaders.Set("User-Agent", c.s.userAgent()) 13058 var body io.Reader = nil 13059 body, err := googleapi.WithoutDataWrapper.JSONReader(c.permission) 13060 if err != nil { 13061 return nil, err 13062 } 13063 reqHeaders.Set("Content-Type", "application/json") 13064 c.urlParams_.Set("alt", alt) 13065 c.urlParams_.Set("prettyPrint", "false") 13066 urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/permissions/{permissionId}") 13067 urls += "?" + c.urlParams_.Encode() 13068 req, err := http.NewRequest("PATCH", urls, body) 13069 if err != nil { 13070 return nil, err 13071 } 13072 req.Header = reqHeaders 13073 googleapi.Expand(req.URL, map[string]string{ 13074 "fileId": c.fileId, 13075 "permissionId": c.permissionId, 13076 }) 13077 return gensupport.SendRequest(c.ctx_, c.s.client, req) 13078} 13079 13080// Do executes the "drive.permissions.patch" call. 13081// Exactly one of *Permission or error will be non-nil. Any non-2xx 13082// status code is an error. Response headers are in either 13083// *Permission.ServerResponse.Header or (if a response was returned at 13084// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 13085// to check whether the returned error was because 13086// http.StatusNotModified was returned. 13087func (c *PermissionsPatchCall) Do(opts ...googleapi.CallOption) (*Permission, error) { 13088 gensupport.SetOptions(c.urlParams_, opts...) 13089 res, err := c.doRequest("json") 13090 if res != nil && res.StatusCode == http.StatusNotModified { 13091 if res.Body != nil { 13092 res.Body.Close() 13093 } 13094 return nil, &googleapi.Error{ 13095 Code: res.StatusCode, 13096 Header: res.Header, 13097 } 13098 } 13099 if err != nil { 13100 return nil, err 13101 } 13102 defer googleapi.CloseBody(res) 13103 if err := googleapi.CheckResponse(res); err != nil { 13104 return nil, err 13105 } 13106 ret := &Permission{ 13107 ServerResponse: googleapi.ServerResponse{ 13108 Header: res.Header, 13109 HTTPStatusCode: res.StatusCode, 13110 }, 13111 } 13112 target := &ret 13113 if err := gensupport.DecodeResponse(target, res); err != nil { 13114 return nil, err 13115 } 13116 return ret, nil 13117 // { 13118 // "description": "Updates a permission using patch semantics.", 13119 // "httpMethod": "PATCH", 13120 // "id": "drive.permissions.patch", 13121 // "parameterOrder": [ 13122 // "fileId", 13123 // "permissionId" 13124 // ], 13125 // "parameters": { 13126 // "fileId": { 13127 // "description": "The ID for the file or shared drive.", 13128 // "location": "path", 13129 // "required": true, 13130 // "type": "string" 13131 // }, 13132 // "permissionId": { 13133 // "description": "The ID for the permission.", 13134 // "location": "path", 13135 // "required": true, 13136 // "type": "string" 13137 // }, 13138 // "removeExpiration": { 13139 // "default": "false", 13140 // "description": "Whether to remove the expiration date.", 13141 // "location": "query", 13142 // "type": "boolean" 13143 // }, 13144 // "supportsAllDrives": { 13145 // "default": "false", 13146 // "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.", 13147 // "location": "query", 13148 // "type": "boolean" 13149 // }, 13150 // "supportsTeamDrives": { 13151 // "default": "false", 13152 // "description": "Deprecated use supportsAllDrives instead.", 13153 // "location": "query", 13154 // "type": "boolean" 13155 // }, 13156 // "transferOwnership": { 13157 // "default": "false", 13158 // "description": "Whether changing a role to 'owner' downgrades the current owners to writers. Does nothing if the specified role is not 'owner'.", 13159 // "location": "query", 13160 // "type": "boolean" 13161 // }, 13162 // "useDomainAdminAccess": { 13163 // "default": "false", 13164 // "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.", 13165 // "location": "query", 13166 // "type": "boolean" 13167 // } 13168 // }, 13169 // "path": "files/{fileId}/permissions/{permissionId}", 13170 // "request": { 13171 // "$ref": "Permission" 13172 // }, 13173 // "response": { 13174 // "$ref": "Permission" 13175 // }, 13176 // "scopes": [ 13177 // "https://www.googleapis.com/auth/drive", 13178 // "https://www.googleapis.com/auth/drive.file" 13179 // ] 13180 // } 13181 13182} 13183 13184// method id "drive.permissions.update": 13185 13186type PermissionsUpdateCall struct { 13187 s *Service 13188 fileId string 13189 permissionId string 13190 permission *Permission 13191 urlParams_ gensupport.URLParams 13192 ctx_ context.Context 13193 header_ http.Header 13194} 13195 13196// Update: Updates a permission. 13197func (r *PermissionsService) Update(fileId string, permissionId string, permission *Permission) *PermissionsUpdateCall { 13198 c := &PermissionsUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)} 13199 c.fileId = fileId 13200 c.permissionId = permissionId 13201 c.permission = permission 13202 return c 13203} 13204 13205// RemoveExpiration sets the optional parameter "removeExpiration": 13206// Whether to remove the expiration date. 13207func (c *PermissionsUpdateCall) RemoveExpiration(removeExpiration bool) *PermissionsUpdateCall { 13208 c.urlParams_.Set("removeExpiration", fmt.Sprint(removeExpiration)) 13209 return c 13210} 13211 13212// SupportsAllDrives sets the optional parameter "supportsAllDrives": 13213// Deprecated - Whether the requesting application supports both My 13214// Drives and shared drives. This parameter will only be effective until 13215// June 1, 2020. Afterwards all applications are assumed to support 13216// shared drives. 13217func (c *PermissionsUpdateCall) SupportsAllDrives(supportsAllDrives bool) *PermissionsUpdateCall { 13218 c.urlParams_.Set("supportsAllDrives", fmt.Sprint(supportsAllDrives)) 13219 return c 13220} 13221 13222// SupportsTeamDrives sets the optional parameter "supportsTeamDrives": 13223// Deprecated use supportsAllDrives instead. 13224func (c *PermissionsUpdateCall) SupportsTeamDrives(supportsTeamDrives bool) *PermissionsUpdateCall { 13225 c.urlParams_.Set("supportsTeamDrives", fmt.Sprint(supportsTeamDrives)) 13226 return c 13227} 13228 13229// TransferOwnership sets the optional parameter "transferOwnership": 13230// Whether changing a role to 'owner' downgrades the current owners to 13231// writers. Does nothing if the specified role is not 'owner'. 13232func (c *PermissionsUpdateCall) TransferOwnership(transferOwnership bool) *PermissionsUpdateCall { 13233 c.urlParams_.Set("transferOwnership", fmt.Sprint(transferOwnership)) 13234 return c 13235} 13236 13237// UseDomainAdminAccess sets the optional parameter 13238// "useDomainAdminAccess": Issue the request as a domain administrator; 13239// if set to true, then the requester will be granted access if the file 13240// ID parameter refers to a shared drive and the requester is an 13241// administrator of the domain to which the shared drive belongs. 13242func (c *PermissionsUpdateCall) UseDomainAdminAccess(useDomainAdminAccess bool) *PermissionsUpdateCall { 13243 c.urlParams_.Set("useDomainAdminAccess", fmt.Sprint(useDomainAdminAccess)) 13244 return c 13245} 13246 13247// Fields allows partial responses to be retrieved. See 13248// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 13249// for more information. 13250func (c *PermissionsUpdateCall) Fields(s ...googleapi.Field) *PermissionsUpdateCall { 13251 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 13252 return c 13253} 13254 13255// Context sets the context to be used in this call's Do method. Any 13256// pending HTTP request will be aborted if the provided context is 13257// canceled. 13258func (c *PermissionsUpdateCall) Context(ctx context.Context) *PermissionsUpdateCall { 13259 c.ctx_ = ctx 13260 return c 13261} 13262 13263// Header returns an http.Header that can be modified by the caller to 13264// add HTTP headers to the request. 13265func (c *PermissionsUpdateCall) Header() http.Header { 13266 if c.header_ == nil { 13267 c.header_ = make(http.Header) 13268 } 13269 return c.header_ 13270} 13271 13272func (c *PermissionsUpdateCall) doRequest(alt string) (*http.Response, error) { 13273 reqHeaders := make(http.Header) 13274 for k, v := range c.header_ { 13275 reqHeaders[k] = v 13276 } 13277 reqHeaders.Set("User-Agent", c.s.userAgent()) 13278 var body io.Reader = nil 13279 body, err := googleapi.WithoutDataWrapper.JSONReader(c.permission) 13280 if err != nil { 13281 return nil, err 13282 } 13283 reqHeaders.Set("Content-Type", "application/json") 13284 c.urlParams_.Set("alt", alt) 13285 c.urlParams_.Set("prettyPrint", "false") 13286 urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/permissions/{permissionId}") 13287 urls += "?" + c.urlParams_.Encode() 13288 req, err := http.NewRequest("PUT", urls, body) 13289 if err != nil { 13290 return nil, err 13291 } 13292 req.Header = reqHeaders 13293 googleapi.Expand(req.URL, map[string]string{ 13294 "fileId": c.fileId, 13295 "permissionId": c.permissionId, 13296 }) 13297 return gensupport.SendRequest(c.ctx_, c.s.client, req) 13298} 13299 13300// Do executes the "drive.permissions.update" call. 13301// Exactly one of *Permission or error will be non-nil. Any non-2xx 13302// status code is an error. Response headers are in either 13303// *Permission.ServerResponse.Header or (if a response was returned at 13304// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 13305// to check whether the returned error was because 13306// http.StatusNotModified was returned. 13307func (c *PermissionsUpdateCall) Do(opts ...googleapi.CallOption) (*Permission, error) { 13308 gensupport.SetOptions(c.urlParams_, opts...) 13309 res, err := c.doRequest("json") 13310 if res != nil && res.StatusCode == http.StatusNotModified { 13311 if res.Body != nil { 13312 res.Body.Close() 13313 } 13314 return nil, &googleapi.Error{ 13315 Code: res.StatusCode, 13316 Header: res.Header, 13317 } 13318 } 13319 if err != nil { 13320 return nil, err 13321 } 13322 defer googleapi.CloseBody(res) 13323 if err := googleapi.CheckResponse(res); err != nil { 13324 return nil, err 13325 } 13326 ret := &Permission{ 13327 ServerResponse: googleapi.ServerResponse{ 13328 Header: res.Header, 13329 HTTPStatusCode: res.StatusCode, 13330 }, 13331 } 13332 target := &ret 13333 if err := gensupport.DecodeResponse(target, res); err != nil { 13334 return nil, err 13335 } 13336 return ret, nil 13337 // { 13338 // "description": "Updates a permission.", 13339 // "httpMethod": "PUT", 13340 // "id": "drive.permissions.update", 13341 // "parameterOrder": [ 13342 // "fileId", 13343 // "permissionId" 13344 // ], 13345 // "parameters": { 13346 // "fileId": { 13347 // "description": "The ID for the file or shared drive.", 13348 // "location": "path", 13349 // "required": true, 13350 // "type": "string" 13351 // }, 13352 // "permissionId": { 13353 // "description": "The ID for the permission.", 13354 // "location": "path", 13355 // "required": true, 13356 // "type": "string" 13357 // }, 13358 // "removeExpiration": { 13359 // "default": "false", 13360 // "description": "Whether to remove the expiration date.", 13361 // "location": "query", 13362 // "type": "boolean" 13363 // }, 13364 // "supportsAllDrives": { 13365 // "default": "false", 13366 // "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.", 13367 // "location": "query", 13368 // "type": "boolean" 13369 // }, 13370 // "supportsTeamDrives": { 13371 // "default": "false", 13372 // "description": "Deprecated use supportsAllDrives instead.", 13373 // "location": "query", 13374 // "type": "boolean" 13375 // }, 13376 // "transferOwnership": { 13377 // "default": "false", 13378 // "description": "Whether changing a role to 'owner' downgrades the current owners to writers. Does nothing if the specified role is not 'owner'.", 13379 // "location": "query", 13380 // "type": "boolean" 13381 // }, 13382 // "useDomainAdminAccess": { 13383 // "default": "false", 13384 // "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.", 13385 // "location": "query", 13386 // "type": "boolean" 13387 // } 13388 // }, 13389 // "path": "files/{fileId}/permissions/{permissionId}", 13390 // "request": { 13391 // "$ref": "Permission" 13392 // }, 13393 // "response": { 13394 // "$ref": "Permission" 13395 // }, 13396 // "scopes": [ 13397 // "https://www.googleapis.com/auth/drive", 13398 // "https://www.googleapis.com/auth/drive.file" 13399 // ] 13400 // } 13401 13402} 13403 13404// method id "drive.properties.delete": 13405 13406type PropertiesDeleteCall struct { 13407 s *Service 13408 fileId string 13409 propertyKey string 13410 urlParams_ gensupport.URLParams 13411 ctx_ context.Context 13412 header_ http.Header 13413} 13414 13415// Delete: Deletes a property. 13416func (r *PropertiesService) Delete(fileId string, propertyKey string) *PropertiesDeleteCall { 13417 c := &PropertiesDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)} 13418 c.fileId = fileId 13419 c.propertyKey = propertyKey 13420 return c 13421} 13422 13423// Visibility sets the optional parameter "visibility": The visibility 13424// of the property. 13425func (c *PropertiesDeleteCall) Visibility(visibility string) *PropertiesDeleteCall { 13426 c.urlParams_.Set("visibility", visibility) 13427 return c 13428} 13429 13430// Fields allows partial responses to be retrieved. See 13431// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 13432// for more information. 13433func (c *PropertiesDeleteCall) Fields(s ...googleapi.Field) *PropertiesDeleteCall { 13434 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 13435 return c 13436} 13437 13438// Context sets the context to be used in this call's Do method. Any 13439// pending HTTP request will be aborted if the provided context is 13440// canceled. 13441func (c *PropertiesDeleteCall) Context(ctx context.Context) *PropertiesDeleteCall { 13442 c.ctx_ = ctx 13443 return c 13444} 13445 13446// Header returns an http.Header that can be modified by the caller to 13447// add HTTP headers to the request. 13448func (c *PropertiesDeleteCall) Header() http.Header { 13449 if c.header_ == nil { 13450 c.header_ = make(http.Header) 13451 } 13452 return c.header_ 13453} 13454 13455func (c *PropertiesDeleteCall) doRequest(alt string) (*http.Response, error) { 13456 reqHeaders := make(http.Header) 13457 for k, v := range c.header_ { 13458 reqHeaders[k] = v 13459 } 13460 reqHeaders.Set("User-Agent", c.s.userAgent()) 13461 var body io.Reader = nil 13462 c.urlParams_.Set("alt", alt) 13463 c.urlParams_.Set("prettyPrint", "false") 13464 urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/properties/{propertyKey}") 13465 urls += "?" + c.urlParams_.Encode() 13466 req, err := http.NewRequest("DELETE", urls, body) 13467 if err != nil { 13468 return nil, err 13469 } 13470 req.Header = reqHeaders 13471 googleapi.Expand(req.URL, map[string]string{ 13472 "fileId": c.fileId, 13473 "propertyKey": c.propertyKey, 13474 }) 13475 return gensupport.SendRequest(c.ctx_, c.s.client, req) 13476} 13477 13478// Do executes the "drive.properties.delete" call. 13479func (c *PropertiesDeleteCall) Do(opts ...googleapi.CallOption) error { 13480 gensupport.SetOptions(c.urlParams_, opts...) 13481 res, err := c.doRequest("json") 13482 if err != nil { 13483 return err 13484 } 13485 defer googleapi.CloseBody(res) 13486 if err := googleapi.CheckResponse(res); err != nil { 13487 return err 13488 } 13489 return nil 13490 // { 13491 // "description": "Deletes a property.", 13492 // "httpMethod": "DELETE", 13493 // "id": "drive.properties.delete", 13494 // "parameterOrder": [ 13495 // "fileId", 13496 // "propertyKey" 13497 // ], 13498 // "parameters": { 13499 // "fileId": { 13500 // "description": "The ID of the file.", 13501 // "location": "path", 13502 // "required": true, 13503 // "type": "string" 13504 // }, 13505 // "propertyKey": { 13506 // "description": "The key of the property.", 13507 // "location": "path", 13508 // "required": true, 13509 // "type": "string" 13510 // }, 13511 // "visibility": { 13512 // "default": "private", 13513 // "description": "The visibility of the property.", 13514 // "location": "query", 13515 // "type": "string" 13516 // } 13517 // }, 13518 // "path": "files/{fileId}/properties/{propertyKey}", 13519 // "scopes": [ 13520 // "https://www.googleapis.com/auth/drive", 13521 // "https://www.googleapis.com/auth/drive.appdata", 13522 // "https://www.googleapis.com/auth/drive.file", 13523 // "https://www.googleapis.com/auth/drive.metadata" 13524 // ] 13525 // } 13526 13527} 13528 13529// method id "drive.properties.get": 13530 13531type PropertiesGetCall struct { 13532 s *Service 13533 fileId string 13534 propertyKey string 13535 urlParams_ gensupport.URLParams 13536 ifNoneMatch_ string 13537 ctx_ context.Context 13538 header_ http.Header 13539} 13540 13541// Get: Gets a property by its key. 13542func (r *PropertiesService) Get(fileId string, propertyKey string) *PropertiesGetCall { 13543 c := &PropertiesGetCall{s: r.s, urlParams_: make(gensupport.URLParams)} 13544 c.fileId = fileId 13545 c.propertyKey = propertyKey 13546 return c 13547} 13548 13549// Visibility sets the optional parameter "visibility": The visibility 13550// of the property. 13551func (c *PropertiesGetCall) Visibility(visibility string) *PropertiesGetCall { 13552 c.urlParams_.Set("visibility", visibility) 13553 return c 13554} 13555 13556// Fields allows partial responses to be retrieved. See 13557// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 13558// for more information. 13559func (c *PropertiesGetCall) Fields(s ...googleapi.Field) *PropertiesGetCall { 13560 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 13561 return c 13562} 13563 13564// IfNoneMatch sets the optional parameter which makes the operation 13565// fail if the object's ETag matches the given value. This is useful for 13566// getting updates only after the object has changed since the last 13567// request. Use googleapi.IsNotModified to check whether the response 13568// error from Do is the result of In-None-Match. 13569func (c *PropertiesGetCall) IfNoneMatch(entityTag string) *PropertiesGetCall { 13570 c.ifNoneMatch_ = entityTag 13571 return c 13572} 13573 13574// Context sets the context to be used in this call's Do method. Any 13575// pending HTTP request will be aborted if the provided context is 13576// canceled. 13577func (c *PropertiesGetCall) Context(ctx context.Context) *PropertiesGetCall { 13578 c.ctx_ = ctx 13579 return c 13580} 13581 13582// Header returns an http.Header that can be modified by the caller to 13583// add HTTP headers to the request. 13584func (c *PropertiesGetCall) Header() http.Header { 13585 if c.header_ == nil { 13586 c.header_ = make(http.Header) 13587 } 13588 return c.header_ 13589} 13590 13591func (c *PropertiesGetCall) doRequest(alt string) (*http.Response, error) { 13592 reqHeaders := make(http.Header) 13593 for k, v := range c.header_ { 13594 reqHeaders[k] = v 13595 } 13596 reqHeaders.Set("User-Agent", c.s.userAgent()) 13597 if c.ifNoneMatch_ != "" { 13598 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 13599 } 13600 var body io.Reader = nil 13601 c.urlParams_.Set("alt", alt) 13602 c.urlParams_.Set("prettyPrint", "false") 13603 urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/properties/{propertyKey}") 13604 urls += "?" + c.urlParams_.Encode() 13605 req, err := http.NewRequest("GET", urls, body) 13606 if err != nil { 13607 return nil, err 13608 } 13609 req.Header = reqHeaders 13610 googleapi.Expand(req.URL, map[string]string{ 13611 "fileId": c.fileId, 13612 "propertyKey": c.propertyKey, 13613 }) 13614 return gensupport.SendRequest(c.ctx_, c.s.client, req) 13615} 13616 13617// Do executes the "drive.properties.get" call. 13618// Exactly one of *Property or error will be non-nil. Any non-2xx status 13619// code is an error. Response headers are in either 13620// *Property.ServerResponse.Header or (if a response was returned at 13621// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 13622// to check whether the returned error was because 13623// http.StatusNotModified was returned. 13624func (c *PropertiesGetCall) Do(opts ...googleapi.CallOption) (*Property, error) { 13625 gensupport.SetOptions(c.urlParams_, opts...) 13626 res, err := c.doRequest("json") 13627 if res != nil && res.StatusCode == http.StatusNotModified { 13628 if res.Body != nil { 13629 res.Body.Close() 13630 } 13631 return nil, &googleapi.Error{ 13632 Code: res.StatusCode, 13633 Header: res.Header, 13634 } 13635 } 13636 if err != nil { 13637 return nil, err 13638 } 13639 defer googleapi.CloseBody(res) 13640 if err := googleapi.CheckResponse(res); err != nil { 13641 return nil, err 13642 } 13643 ret := &Property{ 13644 ServerResponse: googleapi.ServerResponse{ 13645 Header: res.Header, 13646 HTTPStatusCode: res.StatusCode, 13647 }, 13648 } 13649 target := &ret 13650 if err := gensupport.DecodeResponse(target, res); err != nil { 13651 return nil, err 13652 } 13653 return ret, nil 13654 // { 13655 // "description": "Gets a property by its key.", 13656 // "httpMethod": "GET", 13657 // "id": "drive.properties.get", 13658 // "parameterOrder": [ 13659 // "fileId", 13660 // "propertyKey" 13661 // ], 13662 // "parameters": { 13663 // "fileId": { 13664 // "description": "The ID of the file.", 13665 // "location": "path", 13666 // "required": true, 13667 // "type": "string" 13668 // }, 13669 // "propertyKey": { 13670 // "description": "The key of the property.", 13671 // "location": "path", 13672 // "required": true, 13673 // "type": "string" 13674 // }, 13675 // "visibility": { 13676 // "default": "private", 13677 // "description": "The visibility of the property.", 13678 // "location": "query", 13679 // "type": "string" 13680 // } 13681 // }, 13682 // "path": "files/{fileId}/properties/{propertyKey}", 13683 // "response": { 13684 // "$ref": "Property" 13685 // }, 13686 // "scopes": [ 13687 // "https://www.googleapis.com/auth/drive", 13688 // "https://www.googleapis.com/auth/drive.appdata", 13689 // "https://www.googleapis.com/auth/drive.file", 13690 // "https://www.googleapis.com/auth/drive.metadata", 13691 // "https://www.googleapis.com/auth/drive.metadata.readonly", 13692 // "https://www.googleapis.com/auth/drive.photos.readonly", 13693 // "https://www.googleapis.com/auth/drive.readonly" 13694 // ] 13695 // } 13696 13697} 13698 13699// method id "drive.properties.insert": 13700 13701type PropertiesInsertCall struct { 13702 s *Service 13703 fileId string 13704 property *Property 13705 urlParams_ gensupport.URLParams 13706 ctx_ context.Context 13707 header_ http.Header 13708} 13709 13710// Insert: Adds a property to a file, or updates it if it already 13711// exists. 13712func (r *PropertiesService) Insert(fileId string, property *Property) *PropertiesInsertCall { 13713 c := &PropertiesInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)} 13714 c.fileId = fileId 13715 c.property = property 13716 return c 13717} 13718 13719// Fields allows partial responses to be retrieved. See 13720// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 13721// for more information. 13722func (c *PropertiesInsertCall) Fields(s ...googleapi.Field) *PropertiesInsertCall { 13723 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 13724 return c 13725} 13726 13727// Context sets the context to be used in this call's Do method. Any 13728// pending HTTP request will be aborted if the provided context is 13729// canceled. 13730func (c *PropertiesInsertCall) Context(ctx context.Context) *PropertiesInsertCall { 13731 c.ctx_ = ctx 13732 return c 13733} 13734 13735// Header returns an http.Header that can be modified by the caller to 13736// add HTTP headers to the request. 13737func (c *PropertiesInsertCall) Header() http.Header { 13738 if c.header_ == nil { 13739 c.header_ = make(http.Header) 13740 } 13741 return c.header_ 13742} 13743 13744func (c *PropertiesInsertCall) doRequest(alt string) (*http.Response, error) { 13745 reqHeaders := make(http.Header) 13746 for k, v := range c.header_ { 13747 reqHeaders[k] = v 13748 } 13749 reqHeaders.Set("User-Agent", c.s.userAgent()) 13750 var body io.Reader = nil 13751 body, err := googleapi.WithoutDataWrapper.JSONReader(c.property) 13752 if err != nil { 13753 return nil, err 13754 } 13755 reqHeaders.Set("Content-Type", "application/json") 13756 c.urlParams_.Set("alt", alt) 13757 c.urlParams_.Set("prettyPrint", "false") 13758 urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/properties") 13759 urls += "?" + c.urlParams_.Encode() 13760 req, err := http.NewRequest("POST", urls, body) 13761 if err != nil { 13762 return nil, err 13763 } 13764 req.Header = reqHeaders 13765 googleapi.Expand(req.URL, map[string]string{ 13766 "fileId": c.fileId, 13767 }) 13768 return gensupport.SendRequest(c.ctx_, c.s.client, req) 13769} 13770 13771// Do executes the "drive.properties.insert" call. 13772// Exactly one of *Property or error will be non-nil. Any non-2xx status 13773// code is an error. Response headers are in either 13774// *Property.ServerResponse.Header or (if a response was returned at 13775// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 13776// to check whether the returned error was because 13777// http.StatusNotModified was returned. 13778func (c *PropertiesInsertCall) Do(opts ...googleapi.CallOption) (*Property, error) { 13779 gensupport.SetOptions(c.urlParams_, opts...) 13780 res, err := c.doRequest("json") 13781 if res != nil && res.StatusCode == http.StatusNotModified { 13782 if res.Body != nil { 13783 res.Body.Close() 13784 } 13785 return nil, &googleapi.Error{ 13786 Code: res.StatusCode, 13787 Header: res.Header, 13788 } 13789 } 13790 if err != nil { 13791 return nil, err 13792 } 13793 defer googleapi.CloseBody(res) 13794 if err := googleapi.CheckResponse(res); err != nil { 13795 return nil, err 13796 } 13797 ret := &Property{ 13798 ServerResponse: googleapi.ServerResponse{ 13799 Header: res.Header, 13800 HTTPStatusCode: res.StatusCode, 13801 }, 13802 } 13803 target := &ret 13804 if err := gensupport.DecodeResponse(target, res); err != nil { 13805 return nil, err 13806 } 13807 return ret, nil 13808 // { 13809 // "description": "Adds a property to a file, or updates it if it already exists.", 13810 // "httpMethod": "POST", 13811 // "id": "drive.properties.insert", 13812 // "parameterOrder": [ 13813 // "fileId" 13814 // ], 13815 // "parameters": { 13816 // "fileId": { 13817 // "description": "The ID of the file.", 13818 // "location": "path", 13819 // "required": true, 13820 // "type": "string" 13821 // } 13822 // }, 13823 // "path": "files/{fileId}/properties", 13824 // "request": { 13825 // "$ref": "Property" 13826 // }, 13827 // "response": { 13828 // "$ref": "Property" 13829 // }, 13830 // "scopes": [ 13831 // "https://www.googleapis.com/auth/drive", 13832 // "https://www.googleapis.com/auth/drive.appdata", 13833 // "https://www.googleapis.com/auth/drive.file", 13834 // "https://www.googleapis.com/auth/drive.metadata" 13835 // ] 13836 // } 13837 13838} 13839 13840// method id "drive.properties.list": 13841 13842type PropertiesListCall struct { 13843 s *Service 13844 fileId string 13845 urlParams_ gensupport.URLParams 13846 ifNoneMatch_ string 13847 ctx_ context.Context 13848 header_ http.Header 13849} 13850 13851// List: Lists a file's properties. 13852func (r *PropertiesService) List(fileId string) *PropertiesListCall { 13853 c := &PropertiesListCall{s: r.s, urlParams_: make(gensupport.URLParams)} 13854 c.fileId = fileId 13855 return c 13856} 13857 13858// Fields allows partial responses to be retrieved. See 13859// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 13860// for more information. 13861func (c *PropertiesListCall) Fields(s ...googleapi.Field) *PropertiesListCall { 13862 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 13863 return c 13864} 13865 13866// IfNoneMatch sets the optional parameter which makes the operation 13867// fail if the object's ETag matches the given value. This is useful for 13868// getting updates only after the object has changed since the last 13869// request. Use googleapi.IsNotModified to check whether the response 13870// error from Do is the result of In-None-Match. 13871func (c *PropertiesListCall) IfNoneMatch(entityTag string) *PropertiesListCall { 13872 c.ifNoneMatch_ = entityTag 13873 return c 13874} 13875 13876// Context sets the context to be used in this call's Do method. Any 13877// pending HTTP request will be aborted if the provided context is 13878// canceled. 13879func (c *PropertiesListCall) Context(ctx context.Context) *PropertiesListCall { 13880 c.ctx_ = ctx 13881 return c 13882} 13883 13884// Header returns an http.Header that can be modified by the caller to 13885// add HTTP headers to the request. 13886func (c *PropertiesListCall) Header() http.Header { 13887 if c.header_ == nil { 13888 c.header_ = make(http.Header) 13889 } 13890 return c.header_ 13891} 13892 13893func (c *PropertiesListCall) doRequest(alt string) (*http.Response, error) { 13894 reqHeaders := make(http.Header) 13895 for k, v := range c.header_ { 13896 reqHeaders[k] = v 13897 } 13898 reqHeaders.Set("User-Agent", c.s.userAgent()) 13899 if c.ifNoneMatch_ != "" { 13900 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 13901 } 13902 var body io.Reader = nil 13903 c.urlParams_.Set("alt", alt) 13904 c.urlParams_.Set("prettyPrint", "false") 13905 urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/properties") 13906 urls += "?" + c.urlParams_.Encode() 13907 req, err := http.NewRequest("GET", urls, body) 13908 if err != nil { 13909 return nil, err 13910 } 13911 req.Header = reqHeaders 13912 googleapi.Expand(req.URL, map[string]string{ 13913 "fileId": c.fileId, 13914 }) 13915 return gensupport.SendRequest(c.ctx_, c.s.client, req) 13916} 13917 13918// Do executes the "drive.properties.list" call. 13919// Exactly one of *PropertyList or error will be non-nil. Any non-2xx 13920// status code is an error. Response headers are in either 13921// *PropertyList.ServerResponse.Header or (if a response was returned at 13922// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 13923// to check whether the returned error was because 13924// http.StatusNotModified was returned. 13925func (c *PropertiesListCall) Do(opts ...googleapi.CallOption) (*PropertyList, error) { 13926 gensupport.SetOptions(c.urlParams_, opts...) 13927 res, err := c.doRequest("json") 13928 if res != nil && res.StatusCode == http.StatusNotModified { 13929 if res.Body != nil { 13930 res.Body.Close() 13931 } 13932 return nil, &googleapi.Error{ 13933 Code: res.StatusCode, 13934 Header: res.Header, 13935 } 13936 } 13937 if err != nil { 13938 return nil, err 13939 } 13940 defer googleapi.CloseBody(res) 13941 if err := googleapi.CheckResponse(res); err != nil { 13942 return nil, err 13943 } 13944 ret := &PropertyList{ 13945 ServerResponse: googleapi.ServerResponse{ 13946 Header: res.Header, 13947 HTTPStatusCode: res.StatusCode, 13948 }, 13949 } 13950 target := &ret 13951 if err := gensupport.DecodeResponse(target, res); err != nil { 13952 return nil, err 13953 } 13954 return ret, nil 13955 // { 13956 // "description": "Lists a file's properties.", 13957 // "httpMethod": "GET", 13958 // "id": "drive.properties.list", 13959 // "parameterOrder": [ 13960 // "fileId" 13961 // ], 13962 // "parameters": { 13963 // "fileId": { 13964 // "description": "The ID of the file.", 13965 // "location": "path", 13966 // "required": true, 13967 // "type": "string" 13968 // } 13969 // }, 13970 // "path": "files/{fileId}/properties", 13971 // "response": { 13972 // "$ref": "PropertyList" 13973 // }, 13974 // "scopes": [ 13975 // "https://www.googleapis.com/auth/drive", 13976 // "https://www.googleapis.com/auth/drive.appdata", 13977 // "https://www.googleapis.com/auth/drive.file", 13978 // "https://www.googleapis.com/auth/drive.metadata", 13979 // "https://www.googleapis.com/auth/drive.metadata.readonly", 13980 // "https://www.googleapis.com/auth/drive.photos.readonly", 13981 // "https://www.googleapis.com/auth/drive.readonly" 13982 // ] 13983 // } 13984 13985} 13986 13987// method id "drive.properties.patch": 13988 13989type PropertiesPatchCall struct { 13990 s *Service 13991 fileId string 13992 propertyKey string 13993 property *Property 13994 urlParams_ gensupport.URLParams 13995 ctx_ context.Context 13996 header_ http.Header 13997} 13998 13999// Patch: Updates a property. 14000func (r *PropertiesService) Patch(fileId string, propertyKey string, property *Property) *PropertiesPatchCall { 14001 c := &PropertiesPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)} 14002 c.fileId = fileId 14003 c.propertyKey = propertyKey 14004 c.property = property 14005 return c 14006} 14007 14008// Visibility sets the optional parameter "visibility": The visibility 14009// of the property. Allowed values are PRIVATE and PUBLIC. (Default: 14010// PRIVATE) 14011func (c *PropertiesPatchCall) Visibility(visibility string) *PropertiesPatchCall { 14012 c.urlParams_.Set("visibility", visibility) 14013 return c 14014} 14015 14016// Fields allows partial responses to be retrieved. See 14017// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 14018// for more information. 14019func (c *PropertiesPatchCall) Fields(s ...googleapi.Field) *PropertiesPatchCall { 14020 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 14021 return c 14022} 14023 14024// Context sets the context to be used in this call's Do method. Any 14025// pending HTTP request will be aborted if the provided context is 14026// canceled. 14027func (c *PropertiesPatchCall) Context(ctx context.Context) *PropertiesPatchCall { 14028 c.ctx_ = ctx 14029 return c 14030} 14031 14032// Header returns an http.Header that can be modified by the caller to 14033// add HTTP headers to the request. 14034func (c *PropertiesPatchCall) Header() http.Header { 14035 if c.header_ == nil { 14036 c.header_ = make(http.Header) 14037 } 14038 return c.header_ 14039} 14040 14041func (c *PropertiesPatchCall) doRequest(alt string) (*http.Response, error) { 14042 reqHeaders := make(http.Header) 14043 for k, v := range c.header_ { 14044 reqHeaders[k] = v 14045 } 14046 reqHeaders.Set("User-Agent", c.s.userAgent()) 14047 var body io.Reader = nil 14048 body, err := googleapi.WithoutDataWrapper.JSONReader(c.property) 14049 if err != nil { 14050 return nil, err 14051 } 14052 reqHeaders.Set("Content-Type", "application/json") 14053 c.urlParams_.Set("alt", alt) 14054 c.urlParams_.Set("prettyPrint", "false") 14055 urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/properties/{propertyKey}") 14056 urls += "?" + c.urlParams_.Encode() 14057 req, err := http.NewRequest("PATCH", urls, body) 14058 if err != nil { 14059 return nil, err 14060 } 14061 req.Header = reqHeaders 14062 googleapi.Expand(req.URL, map[string]string{ 14063 "fileId": c.fileId, 14064 "propertyKey": c.propertyKey, 14065 }) 14066 return gensupport.SendRequest(c.ctx_, c.s.client, req) 14067} 14068 14069// Do executes the "drive.properties.patch" call. 14070// Exactly one of *Property or error will be non-nil. Any non-2xx status 14071// code is an error. Response headers are in either 14072// *Property.ServerResponse.Header or (if a response was returned at 14073// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 14074// to check whether the returned error was because 14075// http.StatusNotModified was returned. 14076func (c *PropertiesPatchCall) Do(opts ...googleapi.CallOption) (*Property, error) { 14077 gensupport.SetOptions(c.urlParams_, opts...) 14078 res, err := c.doRequest("json") 14079 if res != nil && res.StatusCode == http.StatusNotModified { 14080 if res.Body != nil { 14081 res.Body.Close() 14082 } 14083 return nil, &googleapi.Error{ 14084 Code: res.StatusCode, 14085 Header: res.Header, 14086 } 14087 } 14088 if err != nil { 14089 return nil, err 14090 } 14091 defer googleapi.CloseBody(res) 14092 if err := googleapi.CheckResponse(res); err != nil { 14093 return nil, err 14094 } 14095 ret := &Property{ 14096 ServerResponse: googleapi.ServerResponse{ 14097 Header: res.Header, 14098 HTTPStatusCode: res.StatusCode, 14099 }, 14100 } 14101 target := &ret 14102 if err := gensupport.DecodeResponse(target, res); err != nil { 14103 return nil, err 14104 } 14105 return ret, nil 14106 // { 14107 // "description": "Updates a property.", 14108 // "httpMethod": "PATCH", 14109 // "id": "drive.properties.patch", 14110 // "parameterOrder": [ 14111 // "fileId", 14112 // "propertyKey" 14113 // ], 14114 // "parameters": { 14115 // "fileId": { 14116 // "description": "The ID of the file.", 14117 // "location": "path", 14118 // "required": true, 14119 // "type": "string" 14120 // }, 14121 // "propertyKey": { 14122 // "description": "The key of the property.", 14123 // "location": "path", 14124 // "required": true, 14125 // "type": "string" 14126 // }, 14127 // "visibility": { 14128 // "default": "private", 14129 // "description": "The visibility of the property. Allowed values are PRIVATE and PUBLIC. (Default: PRIVATE)", 14130 // "location": "query", 14131 // "type": "string" 14132 // } 14133 // }, 14134 // "path": "files/{fileId}/properties/{propertyKey}", 14135 // "request": { 14136 // "$ref": "Property" 14137 // }, 14138 // "response": { 14139 // "$ref": "Property" 14140 // }, 14141 // "scopes": [ 14142 // "https://www.googleapis.com/auth/drive", 14143 // "https://www.googleapis.com/auth/drive.appdata", 14144 // "https://www.googleapis.com/auth/drive.file", 14145 // "https://www.googleapis.com/auth/drive.metadata" 14146 // ] 14147 // } 14148 14149} 14150 14151// method id "drive.properties.update": 14152 14153type PropertiesUpdateCall struct { 14154 s *Service 14155 fileId string 14156 propertyKey string 14157 property *Property 14158 urlParams_ gensupport.URLParams 14159 ctx_ context.Context 14160 header_ http.Header 14161} 14162 14163// Update: Updates a property. 14164func (r *PropertiesService) Update(fileId string, propertyKey string, property *Property) *PropertiesUpdateCall { 14165 c := &PropertiesUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)} 14166 c.fileId = fileId 14167 c.propertyKey = propertyKey 14168 c.property = property 14169 return c 14170} 14171 14172// Visibility sets the optional parameter "visibility": The visibility 14173// of the property. Allowed values are PRIVATE and PUBLIC. (Default: 14174// PRIVATE) 14175func (c *PropertiesUpdateCall) Visibility(visibility string) *PropertiesUpdateCall { 14176 c.urlParams_.Set("visibility", visibility) 14177 return c 14178} 14179 14180// Fields allows partial responses to be retrieved. See 14181// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 14182// for more information. 14183func (c *PropertiesUpdateCall) Fields(s ...googleapi.Field) *PropertiesUpdateCall { 14184 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 14185 return c 14186} 14187 14188// Context sets the context to be used in this call's Do method. Any 14189// pending HTTP request will be aborted if the provided context is 14190// canceled. 14191func (c *PropertiesUpdateCall) Context(ctx context.Context) *PropertiesUpdateCall { 14192 c.ctx_ = ctx 14193 return c 14194} 14195 14196// Header returns an http.Header that can be modified by the caller to 14197// add HTTP headers to the request. 14198func (c *PropertiesUpdateCall) Header() http.Header { 14199 if c.header_ == nil { 14200 c.header_ = make(http.Header) 14201 } 14202 return c.header_ 14203} 14204 14205func (c *PropertiesUpdateCall) doRequest(alt string) (*http.Response, error) { 14206 reqHeaders := make(http.Header) 14207 for k, v := range c.header_ { 14208 reqHeaders[k] = v 14209 } 14210 reqHeaders.Set("User-Agent", c.s.userAgent()) 14211 var body io.Reader = nil 14212 body, err := googleapi.WithoutDataWrapper.JSONReader(c.property) 14213 if err != nil { 14214 return nil, err 14215 } 14216 reqHeaders.Set("Content-Type", "application/json") 14217 c.urlParams_.Set("alt", alt) 14218 c.urlParams_.Set("prettyPrint", "false") 14219 urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/properties/{propertyKey}") 14220 urls += "?" + c.urlParams_.Encode() 14221 req, err := http.NewRequest("PUT", urls, body) 14222 if err != nil { 14223 return nil, err 14224 } 14225 req.Header = reqHeaders 14226 googleapi.Expand(req.URL, map[string]string{ 14227 "fileId": c.fileId, 14228 "propertyKey": c.propertyKey, 14229 }) 14230 return gensupport.SendRequest(c.ctx_, c.s.client, req) 14231} 14232 14233// Do executes the "drive.properties.update" call. 14234// Exactly one of *Property or error will be non-nil. Any non-2xx status 14235// code is an error. Response headers are in either 14236// *Property.ServerResponse.Header or (if a response was returned at 14237// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 14238// to check whether the returned error was because 14239// http.StatusNotModified was returned. 14240func (c *PropertiesUpdateCall) Do(opts ...googleapi.CallOption) (*Property, error) { 14241 gensupport.SetOptions(c.urlParams_, opts...) 14242 res, err := c.doRequest("json") 14243 if res != nil && res.StatusCode == http.StatusNotModified { 14244 if res.Body != nil { 14245 res.Body.Close() 14246 } 14247 return nil, &googleapi.Error{ 14248 Code: res.StatusCode, 14249 Header: res.Header, 14250 } 14251 } 14252 if err != nil { 14253 return nil, err 14254 } 14255 defer googleapi.CloseBody(res) 14256 if err := googleapi.CheckResponse(res); err != nil { 14257 return nil, err 14258 } 14259 ret := &Property{ 14260 ServerResponse: googleapi.ServerResponse{ 14261 Header: res.Header, 14262 HTTPStatusCode: res.StatusCode, 14263 }, 14264 } 14265 target := &ret 14266 if err := gensupport.DecodeResponse(target, res); err != nil { 14267 return nil, err 14268 } 14269 return ret, nil 14270 // { 14271 // "description": "Updates a property.", 14272 // "httpMethod": "PUT", 14273 // "id": "drive.properties.update", 14274 // "parameterOrder": [ 14275 // "fileId", 14276 // "propertyKey" 14277 // ], 14278 // "parameters": { 14279 // "fileId": { 14280 // "description": "The ID of the file.", 14281 // "location": "path", 14282 // "required": true, 14283 // "type": "string" 14284 // }, 14285 // "propertyKey": { 14286 // "description": "The key of the property.", 14287 // "location": "path", 14288 // "required": true, 14289 // "type": "string" 14290 // }, 14291 // "visibility": { 14292 // "default": "private", 14293 // "description": "The visibility of the property. Allowed values are PRIVATE and PUBLIC. (Default: PRIVATE)", 14294 // "location": "query", 14295 // "type": "string" 14296 // } 14297 // }, 14298 // "path": "files/{fileId}/properties/{propertyKey}", 14299 // "request": { 14300 // "$ref": "Property" 14301 // }, 14302 // "response": { 14303 // "$ref": "Property" 14304 // }, 14305 // "scopes": [ 14306 // "https://www.googleapis.com/auth/drive", 14307 // "https://www.googleapis.com/auth/drive.appdata", 14308 // "https://www.googleapis.com/auth/drive.file", 14309 // "https://www.googleapis.com/auth/drive.metadata" 14310 // ] 14311 // } 14312 14313} 14314 14315// method id "drive.realtime.get": 14316 14317type RealtimeGetCall struct { 14318 s *Service 14319 fileId string 14320 urlParams_ gensupport.URLParams 14321 ifNoneMatch_ string 14322 ctx_ context.Context 14323 header_ http.Header 14324} 14325 14326// Get: Exports the contents of the Realtime API data model associated 14327// with this file as JSON. 14328func (r *RealtimeService) Get(fileId string) *RealtimeGetCall { 14329 c := &RealtimeGetCall{s: r.s, urlParams_: make(gensupport.URLParams)} 14330 c.fileId = fileId 14331 return c 14332} 14333 14334// Revision sets the optional parameter "revision": The revision of the 14335// Realtime API data model to export. Revisions start at 1 (the initial 14336// empty data model) and are incremented with each change. If this 14337// parameter is excluded, the most recent data model will be returned. 14338func (c *RealtimeGetCall) Revision(revision int64) *RealtimeGetCall { 14339 c.urlParams_.Set("revision", fmt.Sprint(revision)) 14340 return c 14341} 14342 14343// Fields allows partial responses to be retrieved. See 14344// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 14345// for more information. 14346func (c *RealtimeGetCall) Fields(s ...googleapi.Field) *RealtimeGetCall { 14347 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 14348 return c 14349} 14350 14351// IfNoneMatch sets the optional parameter which makes the operation 14352// fail if the object's ETag matches the given value. This is useful for 14353// getting updates only after the object has changed since the last 14354// request. Use googleapi.IsNotModified to check whether the response 14355// error from Do is the result of In-None-Match. 14356func (c *RealtimeGetCall) IfNoneMatch(entityTag string) *RealtimeGetCall { 14357 c.ifNoneMatch_ = entityTag 14358 return c 14359} 14360 14361// Context sets the context to be used in this call's Do and Download 14362// methods. Any pending HTTP request will be aborted if the provided 14363// context is canceled. 14364func (c *RealtimeGetCall) Context(ctx context.Context) *RealtimeGetCall { 14365 c.ctx_ = ctx 14366 return c 14367} 14368 14369// Header returns an http.Header that can be modified by the caller to 14370// add HTTP headers to the request. 14371func (c *RealtimeGetCall) Header() http.Header { 14372 if c.header_ == nil { 14373 c.header_ = make(http.Header) 14374 } 14375 return c.header_ 14376} 14377 14378func (c *RealtimeGetCall) doRequest(alt string) (*http.Response, error) { 14379 reqHeaders := make(http.Header) 14380 for k, v := range c.header_ { 14381 reqHeaders[k] = v 14382 } 14383 reqHeaders.Set("User-Agent", c.s.userAgent()) 14384 if c.ifNoneMatch_ != "" { 14385 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 14386 } 14387 var body io.Reader = nil 14388 c.urlParams_.Set("alt", alt) 14389 c.urlParams_.Set("prettyPrint", "false") 14390 urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/realtime") 14391 urls += "?" + c.urlParams_.Encode() 14392 req, err := http.NewRequest("GET", urls, body) 14393 if err != nil { 14394 return nil, err 14395 } 14396 req.Header = reqHeaders 14397 googleapi.Expand(req.URL, map[string]string{ 14398 "fileId": c.fileId, 14399 }) 14400 return gensupport.SendRequest(c.ctx_, c.s.client, req) 14401} 14402 14403// Download fetches the API endpoint's "media" value, instead of the normal 14404// API response value. If the returned error is nil, the Response is guaranteed to 14405// have a 2xx status code. Callers must close the Response.Body as usual. 14406func (c *RealtimeGetCall) Download(opts ...googleapi.CallOption) (*http.Response, error) { 14407 gensupport.SetOptions(c.urlParams_, opts...) 14408 res, err := c.doRequest("media") 14409 if err != nil { 14410 return nil, err 14411 } 14412 if err := googleapi.CheckMediaResponse(res); err != nil { 14413 res.Body.Close() 14414 return nil, err 14415 } 14416 return res, nil 14417} 14418 14419// Do executes the "drive.realtime.get" call. 14420func (c *RealtimeGetCall) Do(opts ...googleapi.CallOption) error { 14421 gensupport.SetOptions(c.urlParams_, opts...) 14422 res, err := c.doRequest("json") 14423 if err != nil { 14424 return err 14425 } 14426 defer googleapi.CloseBody(res) 14427 if err := googleapi.CheckResponse(res); err != nil { 14428 return err 14429 } 14430 return nil 14431 // { 14432 // "description": "Exports the contents of the Realtime API data model associated with this file as JSON.", 14433 // "httpMethod": "GET", 14434 // "id": "drive.realtime.get", 14435 // "parameterOrder": [ 14436 // "fileId" 14437 // ], 14438 // "parameters": { 14439 // "fileId": { 14440 // "description": "The ID of the file that the Realtime API data model is associated with.", 14441 // "location": "path", 14442 // "required": true, 14443 // "type": "string" 14444 // }, 14445 // "revision": { 14446 // "description": "The revision of the Realtime API data model to export. Revisions start at 1 (the initial empty data model) and are incremented with each change. If this parameter is excluded, the most recent data model will be returned.", 14447 // "format": "int32", 14448 // "location": "query", 14449 // "minimum": "1", 14450 // "type": "integer" 14451 // } 14452 // }, 14453 // "path": "files/{fileId}/realtime", 14454 // "scopes": [ 14455 // "https://www.googleapis.com/auth/drive", 14456 // "https://www.googleapis.com/auth/drive.file", 14457 // "https://www.googleapis.com/auth/drive.readonly" 14458 // ], 14459 // "supportsMediaDownload": true 14460 // } 14461 14462} 14463 14464// method id "drive.realtime.update": 14465 14466type RealtimeUpdateCall struct { 14467 s *Service 14468 fileId string 14469 urlParams_ gensupport.URLParams 14470 mediaInfo_ *gensupport.MediaInfo 14471 ctx_ context.Context 14472 header_ http.Header 14473} 14474 14475// Update: Overwrites the Realtime API data model associated with this 14476// file with the provided JSON data model. 14477func (r *RealtimeService) Update(fileId string) *RealtimeUpdateCall { 14478 c := &RealtimeUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)} 14479 c.fileId = fileId 14480 return c 14481} 14482 14483// BaseRevision sets the optional parameter "baseRevision": The revision 14484// of the model to diff the uploaded model against. If set, the uploaded 14485// model is diffed against the provided revision and those differences 14486// are merged with any changes made to the model after the provided 14487// revision. If not set, the uploaded model replaces the current model 14488// on the server. 14489func (c *RealtimeUpdateCall) BaseRevision(baseRevision string) *RealtimeUpdateCall { 14490 c.urlParams_.Set("baseRevision", baseRevision) 14491 return c 14492} 14493 14494// Media specifies the media to upload in one or more chunks. The chunk 14495// size may be controlled by supplying a MediaOption generated by 14496// googleapi.ChunkSize. The chunk size defaults to 14497// googleapi.DefaultUploadChunkSize.The Content-Type header used in the 14498// upload request will be determined by sniffing the contents of r, 14499// unless a MediaOption generated by googleapi.ContentType is 14500// supplied. 14501// At most one of Media and ResumableMedia may be set. 14502func (c *RealtimeUpdateCall) Media(r io.Reader, options ...googleapi.MediaOption) *RealtimeUpdateCall { 14503 c.mediaInfo_ = gensupport.NewInfoFromMedia(r, options) 14504 return c 14505} 14506 14507// ResumableMedia specifies the media to upload in chunks and can be 14508// canceled with ctx. 14509// 14510// Deprecated: use Media instead. 14511// 14512// At most one of Media and ResumableMedia may be set. mediaType 14513// identifies the MIME media type of the upload, such as "image/png". If 14514// mediaType is "", it will be auto-detected. The provided ctx will 14515// supersede any context previously provided to the Context method. 14516func (c *RealtimeUpdateCall) ResumableMedia(ctx context.Context, r io.ReaderAt, size int64, mediaType string) *RealtimeUpdateCall { 14517 c.ctx_ = ctx 14518 c.mediaInfo_ = gensupport.NewInfoFromResumableMedia(r, size, mediaType) 14519 return c 14520} 14521 14522// ProgressUpdater provides a callback function that will be called 14523// after every chunk. It should be a low-latency function in order to 14524// not slow down the upload operation. This should only be called when 14525// using ResumableMedia (as opposed to Media). 14526func (c *RealtimeUpdateCall) ProgressUpdater(pu googleapi.ProgressUpdater) *RealtimeUpdateCall { 14527 c.mediaInfo_.SetProgressUpdater(pu) 14528 return c 14529} 14530 14531// Fields allows partial responses to be retrieved. See 14532// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 14533// for more information. 14534func (c *RealtimeUpdateCall) Fields(s ...googleapi.Field) *RealtimeUpdateCall { 14535 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 14536 return c 14537} 14538 14539// Context sets the context to be used in this call's Do method. Any 14540// pending HTTP request will be aborted if the provided context is 14541// canceled. 14542// This context will supersede any context previously provided to the 14543// ResumableMedia method. 14544func (c *RealtimeUpdateCall) Context(ctx context.Context) *RealtimeUpdateCall { 14545 c.ctx_ = ctx 14546 return c 14547} 14548 14549// Header returns an http.Header that can be modified by the caller to 14550// add HTTP headers to the request. 14551func (c *RealtimeUpdateCall) Header() http.Header { 14552 if c.header_ == nil { 14553 c.header_ = make(http.Header) 14554 } 14555 return c.header_ 14556} 14557 14558func (c *RealtimeUpdateCall) doRequest(alt string) (*http.Response, error) { 14559 reqHeaders := make(http.Header) 14560 for k, v := range c.header_ { 14561 reqHeaders[k] = v 14562 } 14563 reqHeaders.Set("User-Agent", c.s.userAgent()) 14564 var body io.Reader = nil 14565 c.urlParams_.Set("alt", alt) 14566 c.urlParams_.Set("prettyPrint", "false") 14567 urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/realtime") 14568 if c.mediaInfo_ != nil { 14569 urls = strings.Replace(urls, "https://www.googleapis.com/", "https://www.googleapis.com/upload/", 1) 14570 c.urlParams_.Set("uploadType", c.mediaInfo_.UploadType()) 14571 } 14572 if body == nil { 14573 body = new(bytes.Buffer) 14574 reqHeaders.Set("Content-Type", "application/json") 14575 } 14576 body, getBody, cleanup := c.mediaInfo_.UploadRequest(reqHeaders, body) 14577 defer cleanup() 14578 urls += "?" + c.urlParams_.Encode() 14579 req, err := http.NewRequest("PUT", urls, body) 14580 if err != nil { 14581 return nil, err 14582 } 14583 req.Header = reqHeaders 14584 req.GetBody = getBody 14585 googleapi.Expand(req.URL, map[string]string{ 14586 "fileId": c.fileId, 14587 }) 14588 return gensupport.SendRequest(c.ctx_, c.s.client, req) 14589} 14590 14591// Do executes the "drive.realtime.update" call. 14592func (c *RealtimeUpdateCall) Do(opts ...googleapi.CallOption) error { 14593 gensupport.SetOptions(c.urlParams_, opts...) 14594 res, err := c.doRequest("json") 14595 if err != nil { 14596 return err 14597 } 14598 defer googleapi.CloseBody(res) 14599 if err := googleapi.CheckResponse(res); err != nil { 14600 return err 14601 } 14602 rx := c.mediaInfo_.ResumableUpload(res.Header.Get("Location")) 14603 if rx != nil { 14604 rx.Client = c.s.client 14605 rx.UserAgent = c.s.userAgent() 14606 ctx := c.ctx_ 14607 if ctx == nil { 14608 ctx = context.TODO() 14609 } 14610 res, err = rx.Upload(ctx) 14611 if err != nil { 14612 return err 14613 } 14614 defer res.Body.Close() 14615 if err := googleapi.CheckResponse(res); err != nil { 14616 return err 14617 } 14618 } 14619 return nil 14620 // { 14621 // "description": "Overwrites the Realtime API data model associated with this file with the provided JSON data model.", 14622 // "httpMethod": "PUT", 14623 // "id": "drive.realtime.update", 14624 // "mediaUpload": { 14625 // "accept": [ 14626 // "*/*" 14627 // ], 14628 // "maxSize": "10MB", 14629 // "protocols": { 14630 // "resumable": { 14631 // "multipart": true, 14632 // "path": "/resumable/upload/drive/v2/files/{fileId}/realtime" 14633 // }, 14634 // "simple": { 14635 // "multipart": true, 14636 // "path": "/upload/drive/v2/files/{fileId}/realtime" 14637 // } 14638 // } 14639 // }, 14640 // "parameterOrder": [ 14641 // "fileId" 14642 // ], 14643 // "parameters": { 14644 // "baseRevision": { 14645 // "description": "The revision of the model to diff the uploaded model against. If set, the uploaded model is diffed against the provided revision and those differences are merged with any changes made to the model after the provided revision. If not set, the uploaded model replaces the current model on the server.", 14646 // "location": "query", 14647 // "type": "string" 14648 // }, 14649 // "fileId": { 14650 // "description": "The ID of the file that the Realtime API data model is associated with.", 14651 // "location": "path", 14652 // "required": true, 14653 // "type": "string" 14654 // } 14655 // }, 14656 // "path": "files/{fileId}/realtime", 14657 // "scopes": [ 14658 // "https://www.googleapis.com/auth/drive", 14659 // "https://www.googleapis.com/auth/drive.file" 14660 // ], 14661 // "supportsMediaUpload": true 14662 // } 14663 14664} 14665 14666// method id "drive.replies.delete": 14667 14668type RepliesDeleteCall struct { 14669 s *Service 14670 fileId string 14671 commentId string 14672 replyId string 14673 urlParams_ gensupport.URLParams 14674 ctx_ context.Context 14675 header_ http.Header 14676} 14677 14678// Delete: Deletes a reply. 14679func (r *RepliesService) Delete(fileId string, commentId string, replyId string) *RepliesDeleteCall { 14680 c := &RepliesDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)} 14681 c.fileId = fileId 14682 c.commentId = commentId 14683 c.replyId = replyId 14684 return c 14685} 14686 14687// Fields allows partial responses to be retrieved. See 14688// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 14689// for more information. 14690func (c *RepliesDeleteCall) Fields(s ...googleapi.Field) *RepliesDeleteCall { 14691 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 14692 return c 14693} 14694 14695// Context sets the context to be used in this call's Do method. Any 14696// pending HTTP request will be aborted if the provided context is 14697// canceled. 14698func (c *RepliesDeleteCall) Context(ctx context.Context) *RepliesDeleteCall { 14699 c.ctx_ = ctx 14700 return c 14701} 14702 14703// Header returns an http.Header that can be modified by the caller to 14704// add HTTP headers to the request. 14705func (c *RepliesDeleteCall) Header() http.Header { 14706 if c.header_ == nil { 14707 c.header_ = make(http.Header) 14708 } 14709 return c.header_ 14710} 14711 14712func (c *RepliesDeleteCall) doRequest(alt string) (*http.Response, error) { 14713 reqHeaders := make(http.Header) 14714 for k, v := range c.header_ { 14715 reqHeaders[k] = v 14716 } 14717 reqHeaders.Set("User-Agent", c.s.userAgent()) 14718 var body io.Reader = nil 14719 c.urlParams_.Set("alt", alt) 14720 c.urlParams_.Set("prettyPrint", "false") 14721 urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/comments/{commentId}/replies/{replyId}") 14722 urls += "?" + c.urlParams_.Encode() 14723 req, err := http.NewRequest("DELETE", urls, body) 14724 if err != nil { 14725 return nil, err 14726 } 14727 req.Header = reqHeaders 14728 googleapi.Expand(req.URL, map[string]string{ 14729 "fileId": c.fileId, 14730 "commentId": c.commentId, 14731 "replyId": c.replyId, 14732 }) 14733 return gensupport.SendRequest(c.ctx_, c.s.client, req) 14734} 14735 14736// Do executes the "drive.replies.delete" call. 14737func (c *RepliesDeleteCall) Do(opts ...googleapi.CallOption) error { 14738 gensupport.SetOptions(c.urlParams_, opts...) 14739 res, err := c.doRequest("json") 14740 if err != nil { 14741 return err 14742 } 14743 defer googleapi.CloseBody(res) 14744 if err := googleapi.CheckResponse(res); err != nil { 14745 return err 14746 } 14747 return nil 14748 // { 14749 // "description": "Deletes a reply.", 14750 // "httpMethod": "DELETE", 14751 // "id": "drive.replies.delete", 14752 // "parameterOrder": [ 14753 // "fileId", 14754 // "commentId", 14755 // "replyId" 14756 // ], 14757 // "parameters": { 14758 // "commentId": { 14759 // "description": "The ID of the comment.", 14760 // "location": "path", 14761 // "required": true, 14762 // "type": "string" 14763 // }, 14764 // "fileId": { 14765 // "description": "The ID of the file.", 14766 // "location": "path", 14767 // "required": true, 14768 // "type": "string" 14769 // }, 14770 // "replyId": { 14771 // "description": "The ID of the reply.", 14772 // "location": "path", 14773 // "required": true, 14774 // "type": "string" 14775 // } 14776 // }, 14777 // "path": "files/{fileId}/comments/{commentId}/replies/{replyId}", 14778 // "scopes": [ 14779 // "https://www.googleapis.com/auth/drive", 14780 // "https://www.googleapis.com/auth/drive.file" 14781 // ] 14782 // } 14783 14784} 14785 14786// method id "drive.replies.get": 14787 14788type RepliesGetCall struct { 14789 s *Service 14790 fileId string 14791 commentId string 14792 replyId string 14793 urlParams_ gensupport.URLParams 14794 ifNoneMatch_ string 14795 ctx_ context.Context 14796 header_ http.Header 14797} 14798 14799// Get: Gets a reply. 14800func (r *RepliesService) Get(fileId string, commentId string, replyId string) *RepliesGetCall { 14801 c := &RepliesGetCall{s: r.s, urlParams_: make(gensupport.URLParams)} 14802 c.fileId = fileId 14803 c.commentId = commentId 14804 c.replyId = replyId 14805 return c 14806} 14807 14808// IncludeDeleted sets the optional parameter "includeDeleted": If set, 14809// this will succeed when retrieving a deleted reply. 14810func (c *RepliesGetCall) IncludeDeleted(includeDeleted bool) *RepliesGetCall { 14811 c.urlParams_.Set("includeDeleted", fmt.Sprint(includeDeleted)) 14812 return c 14813} 14814 14815// Fields allows partial responses to be retrieved. See 14816// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 14817// for more information. 14818func (c *RepliesGetCall) Fields(s ...googleapi.Field) *RepliesGetCall { 14819 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 14820 return c 14821} 14822 14823// IfNoneMatch sets the optional parameter which makes the operation 14824// fail if the object's ETag matches the given value. This is useful for 14825// getting updates only after the object has changed since the last 14826// request. Use googleapi.IsNotModified to check whether the response 14827// error from Do is the result of In-None-Match. 14828func (c *RepliesGetCall) IfNoneMatch(entityTag string) *RepliesGetCall { 14829 c.ifNoneMatch_ = entityTag 14830 return c 14831} 14832 14833// Context sets the context to be used in this call's Do method. Any 14834// pending HTTP request will be aborted if the provided context is 14835// canceled. 14836func (c *RepliesGetCall) Context(ctx context.Context) *RepliesGetCall { 14837 c.ctx_ = ctx 14838 return c 14839} 14840 14841// Header returns an http.Header that can be modified by the caller to 14842// add HTTP headers to the request. 14843func (c *RepliesGetCall) Header() http.Header { 14844 if c.header_ == nil { 14845 c.header_ = make(http.Header) 14846 } 14847 return c.header_ 14848} 14849 14850func (c *RepliesGetCall) doRequest(alt string) (*http.Response, error) { 14851 reqHeaders := make(http.Header) 14852 for k, v := range c.header_ { 14853 reqHeaders[k] = v 14854 } 14855 reqHeaders.Set("User-Agent", c.s.userAgent()) 14856 if c.ifNoneMatch_ != "" { 14857 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 14858 } 14859 var body io.Reader = nil 14860 c.urlParams_.Set("alt", alt) 14861 c.urlParams_.Set("prettyPrint", "false") 14862 urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/comments/{commentId}/replies/{replyId}") 14863 urls += "?" + c.urlParams_.Encode() 14864 req, err := http.NewRequest("GET", urls, body) 14865 if err != nil { 14866 return nil, err 14867 } 14868 req.Header = reqHeaders 14869 googleapi.Expand(req.URL, map[string]string{ 14870 "fileId": c.fileId, 14871 "commentId": c.commentId, 14872 "replyId": c.replyId, 14873 }) 14874 return gensupport.SendRequest(c.ctx_, c.s.client, req) 14875} 14876 14877// Do executes the "drive.replies.get" call. 14878// Exactly one of *CommentReply or error will be non-nil. Any non-2xx 14879// status code is an error. Response headers are in either 14880// *CommentReply.ServerResponse.Header or (if a response was returned at 14881// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 14882// to check whether the returned error was because 14883// http.StatusNotModified was returned. 14884func (c *RepliesGetCall) Do(opts ...googleapi.CallOption) (*CommentReply, error) { 14885 gensupport.SetOptions(c.urlParams_, opts...) 14886 res, err := c.doRequest("json") 14887 if res != nil && res.StatusCode == http.StatusNotModified { 14888 if res.Body != nil { 14889 res.Body.Close() 14890 } 14891 return nil, &googleapi.Error{ 14892 Code: res.StatusCode, 14893 Header: res.Header, 14894 } 14895 } 14896 if err != nil { 14897 return nil, err 14898 } 14899 defer googleapi.CloseBody(res) 14900 if err := googleapi.CheckResponse(res); err != nil { 14901 return nil, err 14902 } 14903 ret := &CommentReply{ 14904 ServerResponse: googleapi.ServerResponse{ 14905 Header: res.Header, 14906 HTTPStatusCode: res.StatusCode, 14907 }, 14908 } 14909 target := &ret 14910 if err := gensupport.DecodeResponse(target, res); err != nil { 14911 return nil, err 14912 } 14913 return ret, nil 14914 // { 14915 // "description": "Gets a reply.", 14916 // "httpMethod": "GET", 14917 // "id": "drive.replies.get", 14918 // "parameterOrder": [ 14919 // "fileId", 14920 // "commentId", 14921 // "replyId" 14922 // ], 14923 // "parameters": { 14924 // "commentId": { 14925 // "description": "The ID of the comment.", 14926 // "location": "path", 14927 // "required": true, 14928 // "type": "string" 14929 // }, 14930 // "fileId": { 14931 // "description": "The ID of the file.", 14932 // "location": "path", 14933 // "required": true, 14934 // "type": "string" 14935 // }, 14936 // "includeDeleted": { 14937 // "default": "false", 14938 // "description": "If set, this will succeed when retrieving a deleted reply.", 14939 // "location": "query", 14940 // "type": "boolean" 14941 // }, 14942 // "replyId": { 14943 // "description": "The ID of the reply.", 14944 // "location": "path", 14945 // "required": true, 14946 // "type": "string" 14947 // } 14948 // }, 14949 // "path": "files/{fileId}/comments/{commentId}/replies/{replyId}", 14950 // "response": { 14951 // "$ref": "CommentReply" 14952 // }, 14953 // "scopes": [ 14954 // "https://www.googleapis.com/auth/drive", 14955 // "https://www.googleapis.com/auth/drive.file", 14956 // "https://www.googleapis.com/auth/drive.readonly" 14957 // ] 14958 // } 14959 14960} 14961 14962// method id "drive.replies.insert": 14963 14964type RepliesInsertCall struct { 14965 s *Service 14966 fileId string 14967 commentId string 14968 commentreply *CommentReply 14969 urlParams_ gensupport.URLParams 14970 ctx_ context.Context 14971 header_ http.Header 14972} 14973 14974// Insert: Creates a new reply to the given comment. 14975func (r *RepliesService) Insert(fileId string, commentId string, commentreply *CommentReply) *RepliesInsertCall { 14976 c := &RepliesInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)} 14977 c.fileId = fileId 14978 c.commentId = commentId 14979 c.commentreply = commentreply 14980 return c 14981} 14982 14983// Fields allows partial responses to be retrieved. See 14984// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 14985// for more information. 14986func (c *RepliesInsertCall) Fields(s ...googleapi.Field) *RepliesInsertCall { 14987 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 14988 return c 14989} 14990 14991// Context sets the context to be used in this call's Do method. Any 14992// pending HTTP request will be aborted if the provided context is 14993// canceled. 14994func (c *RepliesInsertCall) Context(ctx context.Context) *RepliesInsertCall { 14995 c.ctx_ = ctx 14996 return c 14997} 14998 14999// Header returns an http.Header that can be modified by the caller to 15000// add HTTP headers to the request. 15001func (c *RepliesInsertCall) Header() http.Header { 15002 if c.header_ == nil { 15003 c.header_ = make(http.Header) 15004 } 15005 return c.header_ 15006} 15007 15008func (c *RepliesInsertCall) doRequest(alt string) (*http.Response, error) { 15009 reqHeaders := make(http.Header) 15010 for k, v := range c.header_ { 15011 reqHeaders[k] = v 15012 } 15013 reqHeaders.Set("User-Agent", c.s.userAgent()) 15014 var body io.Reader = nil 15015 body, err := googleapi.WithoutDataWrapper.JSONReader(c.commentreply) 15016 if err != nil { 15017 return nil, err 15018 } 15019 reqHeaders.Set("Content-Type", "application/json") 15020 c.urlParams_.Set("alt", alt) 15021 c.urlParams_.Set("prettyPrint", "false") 15022 urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/comments/{commentId}/replies") 15023 urls += "?" + c.urlParams_.Encode() 15024 req, err := http.NewRequest("POST", urls, body) 15025 if err != nil { 15026 return nil, err 15027 } 15028 req.Header = reqHeaders 15029 googleapi.Expand(req.URL, map[string]string{ 15030 "fileId": c.fileId, 15031 "commentId": c.commentId, 15032 }) 15033 return gensupport.SendRequest(c.ctx_, c.s.client, req) 15034} 15035 15036// Do executes the "drive.replies.insert" call. 15037// Exactly one of *CommentReply or error will be non-nil. Any non-2xx 15038// status code is an error. Response headers are in either 15039// *CommentReply.ServerResponse.Header or (if a response was returned at 15040// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 15041// to check whether the returned error was because 15042// http.StatusNotModified was returned. 15043func (c *RepliesInsertCall) Do(opts ...googleapi.CallOption) (*CommentReply, error) { 15044 gensupport.SetOptions(c.urlParams_, opts...) 15045 res, err := c.doRequest("json") 15046 if res != nil && res.StatusCode == http.StatusNotModified { 15047 if res.Body != nil { 15048 res.Body.Close() 15049 } 15050 return nil, &googleapi.Error{ 15051 Code: res.StatusCode, 15052 Header: res.Header, 15053 } 15054 } 15055 if err != nil { 15056 return nil, err 15057 } 15058 defer googleapi.CloseBody(res) 15059 if err := googleapi.CheckResponse(res); err != nil { 15060 return nil, err 15061 } 15062 ret := &CommentReply{ 15063 ServerResponse: googleapi.ServerResponse{ 15064 Header: res.Header, 15065 HTTPStatusCode: res.StatusCode, 15066 }, 15067 } 15068 target := &ret 15069 if err := gensupport.DecodeResponse(target, res); err != nil { 15070 return nil, err 15071 } 15072 return ret, nil 15073 // { 15074 // "description": "Creates a new reply to the given comment.", 15075 // "httpMethod": "POST", 15076 // "id": "drive.replies.insert", 15077 // "parameterOrder": [ 15078 // "fileId", 15079 // "commentId" 15080 // ], 15081 // "parameters": { 15082 // "commentId": { 15083 // "description": "The ID of the comment.", 15084 // "location": "path", 15085 // "required": true, 15086 // "type": "string" 15087 // }, 15088 // "fileId": { 15089 // "description": "The ID of the file.", 15090 // "location": "path", 15091 // "required": true, 15092 // "type": "string" 15093 // } 15094 // }, 15095 // "path": "files/{fileId}/comments/{commentId}/replies", 15096 // "request": { 15097 // "$ref": "CommentReply" 15098 // }, 15099 // "response": { 15100 // "$ref": "CommentReply" 15101 // }, 15102 // "scopes": [ 15103 // "https://www.googleapis.com/auth/drive", 15104 // "https://www.googleapis.com/auth/drive.file" 15105 // ] 15106 // } 15107 15108} 15109 15110// method id "drive.replies.list": 15111 15112type RepliesListCall struct { 15113 s *Service 15114 fileId string 15115 commentId string 15116 urlParams_ gensupport.URLParams 15117 ifNoneMatch_ string 15118 ctx_ context.Context 15119 header_ http.Header 15120} 15121 15122// List: Lists all of the replies to a comment. 15123func (r *RepliesService) List(fileId string, commentId string) *RepliesListCall { 15124 c := &RepliesListCall{s: r.s, urlParams_: make(gensupport.URLParams)} 15125 c.fileId = fileId 15126 c.commentId = commentId 15127 return c 15128} 15129 15130// IncludeDeleted sets the optional parameter "includeDeleted": If set, 15131// all replies, including deleted replies (with content stripped) will 15132// be returned. 15133func (c *RepliesListCall) IncludeDeleted(includeDeleted bool) *RepliesListCall { 15134 c.urlParams_.Set("includeDeleted", fmt.Sprint(includeDeleted)) 15135 return c 15136} 15137 15138// MaxResults sets the optional parameter "maxResults": The maximum 15139// number of replies to include in the response, used for paging. 15140func (c *RepliesListCall) MaxResults(maxResults int64) *RepliesListCall { 15141 c.urlParams_.Set("maxResults", fmt.Sprint(maxResults)) 15142 return c 15143} 15144 15145// PageToken sets the optional parameter "pageToken": The continuation 15146// token, used to page through large result sets. To get the next page 15147// of results, set this parameter to the value of "nextPageToken" from 15148// the previous response. 15149func (c *RepliesListCall) PageToken(pageToken string) *RepliesListCall { 15150 c.urlParams_.Set("pageToken", pageToken) 15151 return c 15152} 15153 15154// Fields allows partial responses to be retrieved. See 15155// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 15156// for more information. 15157func (c *RepliesListCall) Fields(s ...googleapi.Field) *RepliesListCall { 15158 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 15159 return c 15160} 15161 15162// IfNoneMatch sets the optional parameter which makes the operation 15163// fail if the object's ETag matches the given value. This is useful for 15164// getting updates only after the object has changed since the last 15165// request. Use googleapi.IsNotModified to check whether the response 15166// error from Do is the result of In-None-Match. 15167func (c *RepliesListCall) IfNoneMatch(entityTag string) *RepliesListCall { 15168 c.ifNoneMatch_ = entityTag 15169 return c 15170} 15171 15172// Context sets the context to be used in this call's Do method. Any 15173// pending HTTP request will be aborted if the provided context is 15174// canceled. 15175func (c *RepliesListCall) Context(ctx context.Context) *RepliesListCall { 15176 c.ctx_ = ctx 15177 return c 15178} 15179 15180// Header returns an http.Header that can be modified by the caller to 15181// add HTTP headers to the request. 15182func (c *RepliesListCall) Header() http.Header { 15183 if c.header_ == nil { 15184 c.header_ = make(http.Header) 15185 } 15186 return c.header_ 15187} 15188 15189func (c *RepliesListCall) doRequest(alt string) (*http.Response, error) { 15190 reqHeaders := make(http.Header) 15191 for k, v := range c.header_ { 15192 reqHeaders[k] = v 15193 } 15194 reqHeaders.Set("User-Agent", c.s.userAgent()) 15195 if c.ifNoneMatch_ != "" { 15196 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 15197 } 15198 var body io.Reader = nil 15199 c.urlParams_.Set("alt", alt) 15200 c.urlParams_.Set("prettyPrint", "false") 15201 urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/comments/{commentId}/replies") 15202 urls += "?" + c.urlParams_.Encode() 15203 req, err := http.NewRequest("GET", urls, body) 15204 if err != nil { 15205 return nil, err 15206 } 15207 req.Header = reqHeaders 15208 googleapi.Expand(req.URL, map[string]string{ 15209 "fileId": c.fileId, 15210 "commentId": c.commentId, 15211 }) 15212 return gensupport.SendRequest(c.ctx_, c.s.client, req) 15213} 15214 15215// Do executes the "drive.replies.list" call. 15216// Exactly one of *CommentReplyList or error will be non-nil. Any 15217// non-2xx status code is an error. Response headers are in either 15218// *CommentReplyList.ServerResponse.Header or (if a response was 15219// returned at all) in error.(*googleapi.Error).Header. Use 15220// googleapi.IsNotModified to check whether the returned error was 15221// because http.StatusNotModified was returned. 15222func (c *RepliesListCall) Do(opts ...googleapi.CallOption) (*CommentReplyList, error) { 15223 gensupport.SetOptions(c.urlParams_, opts...) 15224 res, err := c.doRequest("json") 15225 if res != nil && res.StatusCode == http.StatusNotModified { 15226 if res.Body != nil { 15227 res.Body.Close() 15228 } 15229 return nil, &googleapi.Error{ 15230 Code: res.StatusCode, 15231 Header: res.Header, 15232 } 15233 } 15234 if err != nil { 15235 return nil, err 15236 } 15237 defer googleapi.CloseBody(res) 15238 if err := googleapi.CheckResponse(res); err != nil { 15239 return nil, err 15240 } 15241 ret := &CommentReplyList{ 15242 ServerResponse: googleapi.ServerResponse{ 15243 Header: res.Header, 15244 HTTPStatusCode: res.StatusCode, 15245 }, 15246 } 15247 target := &ret 15248 if err := gensupport.DecodeResponse(target, res); err != nil { 15249 return nil, err 15250 } 15251 return ret, nil 15252 // { 15253 // "description": "Lists all of the replies to a comment.", 15254 // "httpMethod": "GET", 15255 // "id": "drive.replies.list", 15256 // "parameterOrder": [ 15257 // "fileId", 15258 // "commentId" 15259 // ], 15260 // "parameters": { 15261 // "commentId": { 15262 // "description": "The ID of the comment.", 15263 // "location": "path", 15264 // "required": true, 15265 // "type": "string" 15266 // }, 15267 // "fileId": { 15268 // "description": "The ID of the file.", 15269 // "location": "path", 15270 // "required": true, 15271 // "type": "string" 15272 // }, 15273 // "includeDeleted": { 15274 // "default": "false", 15275 // "description": "If set, all replies, including deleted replies (with content stripped) will be returned.", 15276 // "location": "query", 15277 // "type": "boolean" 15278 // }, 15279 // "maxResults": { 15280 // "default": "20", 15281 // "description": "The maximum number of replies to include in the response, used for paging.", 15282 // "format": "int32", 15283 // "location": "query", 15284 // "maximum": "100", 15285 // "minimum": "0", 15286 // "type": "integer" 15287 // }, 15288 // "pageToken": { 15289 // "description": "The continuation token, used to page through large result sets. To get the next page of results, set this parameter to the value of \"nextPageToken\" from the previous response.", 15290 // "location": "query", 15291 // "type": "string" 15292 // } 15293 // }, 15294 // "path": "files/{fileId}/comments/{commentId}/replies", 15295 // "response": { 15296 // "$ref": "CommentReplyList" 15297 // }, 15298 // "scopes": [ 15299 // "https://www.googleapis.com/auth/drive", 15300 // "https://www.googleapis.com/auth/drive.file", 15301 // "https://www.googleapis.com/auth/drive.readonly" 15302 // ] 15303 // } 15304 15305} 15306 15307// Pages invokes f for each page of results. 15308// A non-nil error returned from f will halt the iteration. 15309// The provided context supersedes any context provided to the Context method. 15310func (c *RepliesListCall) Pages(ctx context.Context, f func(*CommentReplyList) error) error { 15311 c.ctx_ = ctx 15312 defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point 15313 for { 15314 x, err := c.Do() 15315 if err != nil { 15316 return err 15317 } 15318 if err := f(x); err != nil { 15319 return err 15320 } 15321 if x.NextPageToken == "" { 15322 return nil 15323 } 15324 c.PageToken(x.NextPageToken) 15325 } 15326} 15327 15328// method id "drive.replies.patch": 15329 15330type RepliesPatchCall struct { 15331 s *Service 15332 fileId string 15333 commentId string 15334 replyId string 15335 commentreply *CommentReply 15336 urlParams_ gensupport.URLParams 15337 ctx_ context.Context 15338 header_ http.Header 15339} 15340 15341// Patch: Updates an existing reply. This method supports patch 15342// semantics. 15343func (r *RepliesService) Patch(fileId string, commentId string, replyId string, commentreply *CommentReply) *RepliesPatchCall { 15344 c := &RepliesPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)} 15345 c.fileId = fileId 15346 c.commentId = commentId 15347 c.replyId = replyId 15348 c.commentreply = commentreply 15349 return c 15350} 15351 15352// Fields allows partial responses to be retrieved. See 15353// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 15354// for more information. 15355func (c *RepliesPatchCall) Fields(s ...googleapi.Field) *RepliesPatchCall { 15356 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 15357 return c 15358} 15359 15360// Context sets the context to be used in this call's Do method. Any 15361// pending HTTP request will be aborted if the provided context is 15362// canceled. 15363func (c *RepliesPatchCall) Context(ctx context.Context) *RepliesPatchCall { 15364 c.ctx_ = ctx 15365 return c 15366} 15367 15368// Header returns an http.Header that can be modified by the caller to 15369// add HTTP headers to the request. 15370func (c *RepliesPatchCall) Header() http.Header { 15371 if c.header_ == nil { 15372 c.header_ = make(http.Header) 15373 } 15374 return c.header_ 15375} 15376 15377func (c *RepliesPatchCall) doRequest(alt string) (*http.Response, error) { 15378 reqHeaders := make(http.Header) 15379 for k, v := range c.header_ { 15380 reqHeaders[k] = v 15381 } 15382 reqHeaders.Set("User-Agent", c.s.userAgent()) 15383 var body io.Reader = nil 15384 body, err := googleapi.WithoutDataWrapper.JSONReader(c.commentreply) 15385 if err != nil { 15386 return nil, err 15387 } 15388 reqHeaders.Set("Content-Type", "application/json") 15389 c.urlParams_.Set("alt", alt) 15390 c.urlParams_.Set("prettyPrint", "false") 15391 urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/comments/{commentId}/replies/{replyId}") 15392 urls += "?" + c.urlParams_.Encode() 15393 req, err := http.NewRequest("PATCH", urls, body) 15394 if err != nil { 15395 return nil, err 15396 } 15397 req.Header = reqHeaders 15398 googleapi.Expand(req.URL, map[string]string{ 15399 "fileId": c.fileId, 15400 "commentId": c.commentId, 15401 "replyId": c.replyId, 15402 }) 15403 return gensupport.SendRequest(c.ctx_, c.s.client, req) 15404} 15405 15406// Do executes the "drive.replies.patch" call. 15407// Exactly one of *CommentReply or error will be non-nil. Any non-2xx 15408// status code is an error. Response headers are in either 15409// *CommentReply.ServerResponse.Header or (if a response was returned at 15410// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 15411// to check whether the returned error was because 15412// http.StatusNotModified was returned. 15413func (c *RepliesPatchCall) Do(opts ...googleapi.CallOption) (*CommentReply, error) { 15414 gensupport.SetOptions(c.urlParams_, opts...) 15415 res, err := c.doRequest("json") 15416 if res != nil && res.StatusCode == http.StatusNotModified { 15417 if res.Body != nil { 15418 res.Body.Close() 15419 } 15420 return nil, &googleapi.Error{ 15421 Code: res.StatusCode, 15422 Header: res.Header, 15423 } 15424 } 15425 if err != nil { 15426 return nil, err 15427 } 15428 defer googleapi.CloseBody(res) 15429 if err := googleapi.CheckResponse(res); err != nil { 15430 return nil, err 15431 } 15432 ret := &CommentReply{ 15433 ServerResponse: googleapi.ServerResponse{ 15434 Header: res.Header, 15435 HTTPStatusCode: res.StatusCode, 15436 }, 15437 } 15438 target := &ret 15439 if err := gensupport.DecodeResponse(target, res); err != nil { 15440 return nil, err 15441 } 15442 return ret, nil 15443 // { 15444 // "description": "Updates an existing reply. This method supports patch semantics.", 15445 // "httpMethod": "PATCH", 15446 // "id": "drive.replies.patch", 15447 // "parameterOrder": [ 15448 // "fileId", 15449 // "commentId", 15450 // "replyId" 15451 // ], 15452 // "parameters": { 15453 // "commentId": { 15454 // "description": "The ID of the comment.", 15455 // "location": "path", 15456 // "required": true, 15457 // "type": "string" 15458 // }, 15459 // "fileId": { 15460 // "description": "The ID of the file.", 15461 // "location": "path", 15462 // "required": true, 15463 // "type": "string" 15464 // }, 15465 // "replyId": { 15466 // "description": "The ID of the reply.", 15467 // "location": "path", 15468 // "required": true, 15469 // "type": "string" 15470 // } 15471 // }, 15472 // "path": "files/{fileId}/comments/{commentId}/replies/{replyId}", 15473 // "request": { 15474 // "$ref": "CommentReply" 15475 // }, 15476 // "response": { 15477 // "$ref": "CommentReply" 15478 // }, 15479 // "scopes": [ 15480 // "https://www.googleapis.com/auth/drive", 15481 // "https://www.googleapis.com/auth/drive.file" 15482 // ] 15483 // } 15484 15485} 15486 15487// method id "drive.replies.update": 15488 15489type RepliesUpdateCall struct { 15490 s *Service 15491 fileId string 15492 commentId string 15493 replyId string 15494 commentreply *CommentReply 15495 urlParams_ gensupport.URLParams 15496 ctx_ context.Context 15497 header_ http.Header 15498} 15499 15500// Update: Updates an existing reply. 15501func (r *RepliesService) Update(fileId string, commentId string, replyId string, commentreply *CommentReply) *RepliesUpdateCall { 15502 c := &RepliesUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)} 15503 c.fileId = fileId 15504 c.commentId = commentId 15505 c.replyId = replyId 15506 c.commentreply = commentreply 15507 return c 15508} 15509 15510// Fields allows partial responses to be retrieved. See 15511// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 15512// for more information. 15513func (c *RepliesUpdateCall) Fields(s ...googleapi.Field) *RepliesUpdateCall { 15514 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 15515 return c 15516} 15517 15518// Context sets the context to be used in this call's Do method. Any 15519// pending HTTP request will be aborted if the provided context is 15520// canceled. 15521func (c *RepliesUpdateCall) Context(ctx context.Context) *RepliesUpdateCall { 15522 c.ctx_ = ctx 15523 return c 15524} 15525 15526// Header returns an http.Header that can be modified by the caller to 15527// add HTTP headers to the request. 15528func (c *RepliesUpdateCall) Header() http.Header { 15529 if c.header_ == nil { 15530 c.header_ = make(http.Header) 15531 } 15532 return c.header_ 15533} 15534 15535func (c *RepliesUpdateCall) doRequest(alt string) (*http.Response, error) { 15536 reqHeaders := make(http.Header) 15537 for k, v := range c.header_ { 15538 reqHeaders[k] = v 15539 } 15540 reqHeaders.Set("User-Agent", c.s.userAgent()) 15541 var body io.Reader = nil 15542 body, err := googleapi.WithoutDataWrapper.JSONReader(c.commentreply) 15543 if err != nil { 15544 return nil, err 15545 } 15546 reqHeaders.Set("Content-Type", "application/json") 15547 c.urlParams_.Set("alt", alt) 15548 c.urlParams_.Set("prettyPrint", "false") 15549 urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/comments/{commentId}/replies/{replyId}") 15550 urls += "?" + c.urlParams_.Encode() 15551 req, err := http.NewRequest("PUT", urls, body) 15552 if err != nil { 15553 return nil, err 15554 } 15555 req.Header = reqHeaders 15556 googleapi.Expand(req.URL, map[string]string{ 15557 "fileId": c.fileId, 15558 "commentId": c.commentId, 15559 "replyId": c.replyId, 15560 }) 15561 return gensupport.SendRequest(c.ctx_, c.s.client, req) 15562} 15563 15564// Do executes the "drive.replies.update" call. 15565// Exactly one of *CommentReply or error will be non-nil. Any non-2xx 15566// status code is an error. Response headers are in either 15567// *CommentReply.ServerResponse.Header or (if a response was returned at 15568// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 15569// to check whether the returned error was because 15570// http.StatusNotModified was returned. 15571func (c *RepliesUpdateCall) Do(opts ...googleapi.CallOption) (*CommentReply, error) { 15572 gensupport.SetOptions(c.urlParams_, opts...) 15573 res, err := c.doRequest("json") 15574 if res != nil && res.StatusCode == http.StatusNotModified { 15575 if res.Body != nil { 15576 res.Body.Close() 15577 } 15578 return nil, &googleapi.Error{ 15579 Code: res.StatusCode, 15580 Header: res.Header, 15581 } 15582 } 15583 if err != nil { 15584 return nil, err 15585 } 15586 defer googleapi.CloseBody(res) 15587 if err := googleapi.CheckResponse(res); err != nil { 15588 return nil, err 15589 } 15590 ret := &CommentReply{ 15591 ServerResponse: googleapi.ServerResponse{ 15592 Header: res.Header, 15593 HTTPStatusCode: res.StatusCode, 15594 }, 15595 } 15596 target := &ret 15597 if err := gensupport.DecodeResponse(target, res); err != nil { 15598 return nil, err 15599 } 15600 return ret, nil 15601 // { 15602 // "description": "Updates an existing reply.", 15603 // "httpMethod": "PUT", 15604 // "id": "drive.replies.update", 15605 // "parameterOrder": [ 15606 // "fileId", 15607 // "commentId", 15608 // "replyId" 15609 // ], 15610 // "parameters": { 15611 // "commentId": { 15612 // "description": "The ID of the comment.", 15613 // "location": "path", 15614 // "required": true, 15615 // "type": "string" 15616 // }, 15617 // "fileId": { 15618 // "description": "The ID of the file.", 15619 // "location": "path", 15620 // "required": true, 15621 // "type": "string" 15622 // }, 15623 // "replyId": { 15624 // "description": "The ID of the reply.", 15625 // "location": "path", 15626 // "required": true, 15627 // "type": "string" 15628 // } 15629 // }, 15630 // "path": "files/{fileId}/comments/{commentId}/replies/{replyId}", 15631 // "request": { 15632 // "$ref": "CommentReply" 15633 // }, 15634 // "response": { 15635 // "$ref": "CommentReply" 15636 // }, 15637 // "scopes": [ 15638 // "https://www.googleapis.com/auth/drive", 15639 // "https://www.googleapis.com/auth/drive.file" 15640 // ] 15641 // } 15642 15643} 15644 15645// method id "drive.revisions.delete": 15646 15647type RevisionsDeleteCall struct { 15648 s *Service 15649 fileId string 15650 revisionId string 15651 urlParams_ gensupport.URLParams 15652 ctx_ context.Context 15653 header_ http.Header 15654} 15655 15656// Delete: Permanently deletes a file version. You can only delete 15657// revisions for files with binary content, like images or videos. 15658// Revisions for other files, like Google Docs or Sheets, and the last 15659// remaining file version can't be deleted. 15660func (r *RevisionsService) Delete(fileId string, revisionId string) *RevisionsDeleteCall { 15661 c := &RevisionsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)} 15662 c.fileId = fileId 15663 c.revisionId = revisionId 15664 return c 15665} 15666 15667// Fields allows partial responses to be retrieved. See 15668// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 15669// for more information. 15670func (c *RevisionsDeleteCall) Fields(s ...googleapi.Field) *RevisionsDeleteCall { 15671 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 15672 return c 15673} 15674 15675// Context sets the context to be used in this call's Do method. Any 15676// pending HTTP request will be aborted if the provided context is 15677// canceled. 15678func (c *RevisionsDeleteCall) Context(ctx context.Context) *RevisionsDeleteCall { 15679 c.ctx_ = ctx 15680 return c 15681} 15682 15683// Header returns an http.Header that can be modified by the caller to 15684// add HTTP headers to the request. 15685func (c *RevisionsDeleteCall) Header() http.Header { 15686 if c.header_ == nil { 15687 c.header_ = make(http.Header) 15688 } 15689 return c.header_ 15690} 15691 15692func (c *RevisionsDeleteCall) doRequest(alt string) (*http.Response, error) { 15693 reqHeaders := make(http.Header) 15694 for k, v := range c.header_ { 15695 reqHeaders[k] = v 15696 } 15697 reqHeaders.Set("User-Agent", c.s.userAgent()) 15698 var body io.Reader = nil 15699 c.urlParams_.Set("alt", alt) 15700 c.urlParams_.Set("prettyPrint", "false") 15701 urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/revisions/{revisionId}") 15702 urls += "?" + c.urlParams_.Encode() 15703 req, err := http.NewRequest("DELETE", urls, body) 15704 if err != nil { 15705 return nil, err 15706 } 15707 req.Header = reqHeaders 15708 googleapi.Expand(req.URL, map[string]string{ 15709 "fileId": c.fileId, 15710 "revisionId": c.revisionId, 15711 }) 15712 return gensupport.SendRequest(c.ctx_, c.s.client, req) 15713} 15714 15715// Do executes the "drive.revisions.delete" call. 15716func (c *RevisionsDeleteCall) Do(opts ...googleapi.CallOption) error { 15717 gensupport.SetOptions(c.urlParams_, opts...) 15718 res, err := c.doRequest("json") 15719 if err != nil { 15720 return err 15721 } 15722 defer googleapi.CloseBody(res) 15723 if err := googleapi.CheckResponse(res); err != nil { 15724 return err 15725 } 15726 return nil 15727 // { 15728 // "description": "Permanently deletes a file version. You can only delete revisions for files with binary content, like images or videos. Revisions for other files, like Google Docs or Sheets, and the last remaining file version can't be deleted.", 15729 // "httpMethod": "DELETE", 15730 // "id": "drive.revisions.delete", 15731 // "parameterOrder": [ 15732 // "fileId", 15733 // "revisionId" 15734 // ], 15735 // "parameters": { 15736 // "fileId": { 15737 // "description": "The ID of the file.", 15738 // "location": "path", 15739 // "required": true, 15740 // "type": "string" 15741 // }, 15742 // "revisionId": { 15743 // "description": "The ID of the revision.", 15744 // "location": "path", 15745 // "required": true, 15746 // "type": "string" 15747 // } 15748 // }, 15749 // "path": "files/{fileId}/revisions/{revisionId}", 15750 // "scopes": [ 15751 // "https://www.googleapis.com/auth/drive", 15752 // "https://www.googleapis.com/auth/drive.appdata", 15753 // "https://www.googleapis.com/auth/drive.file" 15754 // ] 15755 // } 15756 15757} 15758 15759// method id "drive.revisions.get": 15760 15761type RevisionsGetCall struct { 15762 s *Service 15763 fileId string 15764 revisionId string 15765 urlParams_ gensupport.URLParams 15766 ifNoneMatch_ string 15767 ctx_ context.Context 15768 header_ http.Header 15769} 15770 15771// Get: Gets a specific revision. 15772func (r *RevisionsService) Get(fileId string, revisionId string) *RevisionsGetCall { 15773 c := &RevisionsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)} 15774 c.fileId = fileId 15775 c.revisionId = revisionId 15776 return c 15777} 15778 15779// Fields allows partial responses to be retrieved. See 15780// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 15781// for more information. 15782func (c *RevisionsGetCall) Fields(s ...googleapi.Field) *RevisionsGetCall { 15783 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 15784 return c 15785} 15786 15787// IfNoneMatch sets the optional parameter which makes the operation 15788// fail if the object's ETag matches the given value. This is useful for 15789// getting updates only after the object has changed since the last 15790// request. Use googleapi.IsNotModified to check whether the response 15791// error from Do is the result of In-None-Match. 15792func (c *RevisionsGetCall) IfNoneMatch(entityTag string) *RevisionsGetCall { 15793 c.ifNoneMatch_ = entityTag 15794 return c 15795} 15796 15797// Context sets the context to be used in this call's Do method. Any 15798// pending HTTP request will be aborted if the provided context is 15799// canceled. 15800func (c *RevisionsGetCall) Context(ctx context.Context) *RevisionsGetCall { 15801 c.ctx_ = ctx 15802 return c 15803} 15804 15805// Header returns an http.Header that can be modified by the caller to 15806// add HTTP headers to the request. 15807func (c *RevisionsGetCall) Header() http.Header { 15808 if c.header_ == nil { 15809 c.header_ = make(http.Header) 15810 } 15811 return c.header_ 15812} 15813 15814func (c *RevisionsGetCall) doRequest(alt string) (*http.Response, error) { 15815 reqHeaders := make(http.Header) 15816 for k, v := range c.header_ { 15817 reqHeaders[k] = v 15818 } 15819 reqHeaders.Set("User-Agent", c.s.userAgent()) 15820 if c.ifNoneMatch_ != "" { 15821 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 15822 } 15823 var body io.Reader = nil 15824 c.urlParams_.Set("alt", alt) 15825 c.urlParams_.Set("prettyPrint", "false") 15826 urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/revisions/{revisionId}") 15827 urls += "?" + c.urlParams_.Encode() 15828 req, err := http.NewRequest("GET", urls, body) 15829 if err != nil { 15830 return nil, err 15831 } 15832 req.Header = reqHeaders 15833 googleapi.Expand(req.URL, map[string]string{ 15834 "fileId": c.fileId, 15835 "revisionId": c.revisionId, 15836 }) 15837 return gensupport.SendRequest(c.ctx_, c.s.client, req) 15838} 15839 15840// Do executes the "drive.revisions.get" call. 15841// Exactly one of *Revision or error will be non-nil. Any non-2xx status 15842// code is an error. Response headers are in either 15843// *Revision.ServerResponse.Header or (if a response was returned at 15844// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 15845// to check whether the returned error was because 15846// http.StatusNotModified was returned. 15847func (c *RevisionsGetCall) Do(opts ...googleapi.CallOption) (*Revision, error) { 15848 gensupport.SetOptions(c.urlParams_, opts...) 15849 res, err := c.doRequest("json") 15850 if res != nil && res.StatusCode == http.StatusNotModified { 15851 if res.Body != nil { 15852 res.Body.Close() 15853 } 15854 return nil, &googleapi.Error{ 15855 Code: res.StatusCode, 15856 Header: res.Header, 15857 } 15858 } 15859 if err != nil { 15860 return nil, err 15861 } 15862 defer googleapi.CloseBody(res) 15863 if err := googleapi.CheckResponse(res); err != nil { 15864 return nil, err 15865 } 15866 ret := &Revision{ 15867 ServerResponse: googleapi.ServerResponse{ 15868 Header: res.Header, 15869 HTTPStatusCode: res.StatusCode, 15870 }, 15871 } 15872 target := &ret 15873 if err := gensupport.DecodeResponse(target, res); err != nil { 15874 return nil, err 15875 } 15876 return ret, nil 15877 // { 15878 // "description": "Gets a specific revision.", 15879 // "httpMethod": "GET", 15880 // "id": "drive.revisions.get", 15881 // "parameterOrder": [ 15882 // "fileId", 15883 // "revisionId" 15884 // ], 15885 // "parameters": { 15886 // "fileId": { 15887 // "description": "The ID of the file.", 15888 // "location": "path", 15889 // "required": true, 15890 // "type": "string" 15891 // }, 15892 // "revisionId": { 15893 // "description": "The ID of the revision.", 15894 // "location": "path", 15895 // "required": true, 15896 // "type": "string" 15897 // } 15898 // }, 15899 // "path": "files/{fileId}/revisions/{revisionId}", 15900 // "response": { 15901 // "$ref": "Revision" 15902 // }, 15903 // "scopes": [ 15904 // "https://www.googleapis.com/auth/drive", 15905 // "https://www.googleapis.com/auth/drive.appdata", 15906 // "https://www.googleapis.com/auth/drive.file", 15907 // "https://www.googleapis.com/auth/drive.metadata", 15908 // "https://www.googleapis.com/auth/drive.metadata.readonly", 15909 // "https://www.googleapis.com/auth/drive.photos.readonly", 15910 // "https://www.googleapis.com/auth/drive.readonly" 15911 // ] 15912 // } 15913 15914} 15915 15916// method id "drive.revisions.list": 15917 15918type RevisionsListCall struct { 15919 s *Service 15920 fileId string 15921 urlParams_ gensupport.URLParams 15922 ifNoneMatch_ string 15923 ctx_ context.Context 15924 header_ http.Header 15925} 15926 15927// List: Lists a file's revisions. 15928func (r *RevisionsService) List(fileId string) *RevisionsListCall { 15929 c := &RevisionsListCall{s: r.s, urlParams_: make(gensupport.URLParams)} 15930 c.fileId = fileId 15931 return c 15932} 15933 15934// MaxResults sets the optional parameter "maxResults": Maximum number 15935// of revisions to return. 15936func (c *RevisionsListCall) MaxResults(maxResults int64) *RevisionsListCall { 15937 c.urlParams_.Set("maxResults", fmt.Sprint(maxResults)) 15938 return c 15939} 15940 15941// PageToken sets the optional parameter "pageToken": Page token for 15942// revisions. To get the next page of results, set this parameter to the 15943// value of "nextPageToken" from the previous response. 15944func (c *RevisionsListCall) PageToken(pageToken string) *RevisionsListCall { 15945 c.urlParams_.Set("pageToken", pageToken) 15946 return c 15947} 15948 15949// Fields allows partial responses to be retrieved. See 15950// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 15951// for more information. 15952func (c *RevisionsListCall) Fields(s ...googleapi.Field) *RevisionsListCall { 15953 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 15954 return c 15955} 15956 15957// IfNoneMatch sets the optional parameter which makes the operation 15958// fail if the object's ETag matches the given value. This is useful for 15959// getting updates only after the object has changed since the last 15960// request. Use googleapi.IsNotModified to check whether the response 15961// error from Do is the result of In-None-Match. 15962func (c *RevisionsListCall) IfNoneMatch(entityTag string) *RevisionsListCall { 15963 c.ifNoneMatch_ = entityTag 15964 return c 15965} 15966 15967// Context sets the context to be used in this call's Do method. Any 15968// pending HTTP request will be aborted if the provided context is 15969// canceled. 15970func (c *RevisionsListCall) Context(ctx context.Context) *RevisionsListCall { 15971 c.ctx_ = ctx 15972 return c 15973} 15974 15975// Header returns an http.Header that can be modified by the caller to 15976// add HTTP headers to the request. 15977func (c *RevisionsListCall) Header() http.Header { 15978 if c.header_ == nil { 15979 c.header_ = make(http.Header) 15980 } 15981 return c.header_ 15982} 15983 15984func (c *RevisionsListCall) doRequest(alt string) (*http.Response, error) { 15985 reqHeaders := make(http.Header) 15986 for k, v := range c.header_ { 15987 reqHeaders[k] = v 15988 } 15989 reqHeaders.Set("User-Agent", c.s.userAgent()) 15990 if c.ifNoneMatch_ != "" { 15991 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 15992 } 15993 var body io.Reader = nil 15994 c.urlParams_.Set("alt", alt) 15995 c.urlParams_.Set("prettyPrint", "false") 15996 urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/revisions") 15997 urls += "?" + c.urlParams_.Encode() 15998 req, err := http.NewRequest("GET", urls, body) 15999 if err != nil { 16000 return nil, err 16001 } 16002 req.Header = reqHeaders 16003 googleapi.Expand(req.URL, map[string]string{ 16004 "fileId": c.fileId, 16005 }) 16006 return gensupport.SendRequest(c.ctx_, c.s.client, req) 16007} 16008 16009// Do executes the "drive.revisions.list" call. 16010// Exactly one of *RevisionList or error will be non-nil. Any non-2xx 16011// status code is an error. Response headers are in either 16012// *RevisionList.ServerResponse.Header or (if a response was returned at 16013// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 16014// to check whether the returned error was because 16015// http.StatusNotModified was returned. 16016func (c *RevisionsListCall) Do(opts ...googleapi.CallOption) (*RevisionList, error) { 16017 gensupport.SetOptions(c.urlParams_, opts...) 16018 res, err := c.doRequest("json") 16019 if res != nil && res.StatusCode == http.StatusNotModified { 16020 if res.Body != nil { 16021 res.Body.Close() 16022 } 16023 return nil, &googleapi.Error{ 16024 Code: res.StatusCode, 16025 Header: res.Header, 16026 } 16027 } 16028 if err != nil { 16029 return nil, err 16030 } 16031 defer googleapi.CloseBody(res) 16032 if err := googleapi.CheckResponse(res); err != nil { 16033 return nil, err 16034 } 16035 ret := &RevisionList{ 16036 ServerResponse: googleapi.ServerResponse{ 16037 Header: res.Header, 16038 HTTPStatusCode: res.StatusCode, 16039 }, 16040 } 16041 target := &ret 16042 if err := gensupport.DecodeResponse(target, res); err != nil { 16043 return nil, err 16044 } 16045 return ret, nil 16046 // { 16047 // "description": "Lists a file's revisions.", 16048 // "httpMethod": "GET", 16049 // "id": "drive.revisions.list", 16050 // "parameterOrder": [ 16051 // "fileId" 16052 // ], 16053 // "parameters": { 16054 // "fileId": { 16055 // "description": "The ID of the file.", 16056 // "location": "path", 16057 // "required": true, 16058 // "type": "string" 16059 // }, 16060 // "maxResults": { 16061 // "default": "200", 16062 // "description": "Maximum number of revisions to return.", 16063 // "format": "int32", 16064 // "location": "query", 16065 // "maximum": "1000", 16066 // "minimum": "1", 16067 // "type": "integer" 16068 // }, 16069 // "pageToken": { 16070 // "description": "Page token for revisions. To get the next page of results, set this parameter to the value of \"nextPageToken\" from the previous response.", 16071 // "location": "query", 16072 // "type": "string" 16073 // } 16074 // }, 16075 // "path": "files/{fileId}/revisions", 16076 // "response": { 16077 // "$ref": "RevisionList" 16078 // }, 16079 // "scopes": [ 16080 // "https://www.googleapis.com/auth/drive", 16081 // "https://www.googleapis.com/auth/drive.appdata", 16082 // "https://www.googleapis.com/auth/drive.file", 16083 // "https://www.googleapis.com/auth/drive.metadata", 16084 // "https://www.googleapis.com/auth/drive.metadata.readonly", 16085 // "https://www.googleapis.com/auth/drive.photos.readonly", 16086 // "https://www.googleapis.com/auth/drive.readonly" 16087 // ] 16088 // } 16089 16090} 16091 16092// Pages invokes f for each page of results. 16093// A non-nil error returned from f will halt the iteration. 16094// The provided context supersedes any context provided to the Context method. 16095func (c *RevisionsListCall) Pages(ctx context.Context, f func(*RevisionList) error) error { 16096 c.ctx_ = ctx 16097 defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point 16098 for { 16099 x, err := c.Do() 16100 if err != nil { 16101 return err 16102 } 16103 if err := f(x); err != nil { 16104 return err 16105 } 16106 if x.NextPageToken == "" { 16107 return nil 16108 } 16109 c.PageToken(x.NextPageToken) 16110 } 16111} 16112 16113// method id "drive.revisions.patch": 16114 16115type RevisionsPatchCall struct { 16116 s *Service 16117 fileId string 16118 revisionId string 16119 revision *Revision 16120 urlParams_ gensupport.URLParams 16121 ctx_ context.Context 16122 header_ http.Header 16123} 16124 16125// Patch: Updates a revision. This method supports patch semantics. 16126func (r *RevisionsService) Patch(fileId string, revisionId string, revision *Revision) *RevisionsPatchCall { 16127 c := &RevisionsPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)} 16128 c.fileId = fileId 16129 c.revisionId = revisionId 16130 c.revision = revision 16131 return c 16132} 16133 16134// Fields allows partial responses to be retrieved. See 16135// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 16136// for more information. 16137func (c *RevisionsPatchCall) Fields(s ...googleapi.Field) *RevisionsPatchCall { 16138 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 16139 return c 16140} 16141 16142// Context sets the context to be used in this call's Do method. Any 16143// pending HTTP request will be aborted if the provided context is 16144// canceled. 16145func (c *RevisionsPatchCall) Context(ctx context.Context) *RevisionsPatchCall { 16146 c.ctx_ = ctx 16147 return c 16148} 16149 16150// Header returns an http.Header that can be modified by the caller to 16151// add HTTP headers to the request. 16152func (c *RevisionsPatchCall) Header() http.Header { 16153 if c.header_ == nil { 16154 c.header_ = make(http.Header) 16155 } 16156 return c.header_ 16157} 16158 16159func (c *RevisionsPatchCall) doRequest(alt string) (*http.Response, error) { 16160 reqHeaders := make(http.Header) 16161 for k, v := range c.header_ { 16162 reqHeaders[k] = v 16163 } 16164 reqHeaders.Set("User-Agent", c.s.userAgent()) 16165 var body io.Reader = nil 16166 body, err := googleapi.WithoutDataWrapper.JSONReader(c.revision) 16167 if err != nil { 16168 return nil, err 16169 } 16170 reqHeaders.Set("Content-Type", "application/json") 16171 c.urlParams_.Set("alt", alt) 16172 c.urlParams_.Set("prettyPrint", "false") 16173 urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/revisions/{revisionId}") 16174 urls += "?" + c.urlParams_.Encode() 16175 req, err := http.NewRequest("PATCH", urls, body) 16176 if err != nil { 16177 return nil, err 16178 } 16179 req.Header = reqHeaders 16180 googleapi.Expand(req.URL, map[string]string{ 16181 "fileId": c.fileId, 16182 "revisionId": c.revisionId, 16183 }) 16184 return gensupport.SendRequest(c.ctx_, c.s.client, req) 16185} 16186 16187// Do executes the "drive.revisions.patch" call. 16188// Exactly one of *Revision or error will be non-nil. Any non-2xx status 16189// code is an error. Response headers are in either 16190// *Revision.ServerResponse.Header or (if a response was returned at 16191// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 16192// to check whether the returned error was because 16193// http.StatusNotModified was returned. 16194func (c *RevisionsPatchCall) Do(opts ...googleapi.CallOption) (*Revision, error) { 16195 gensupport.SetOptions(c.urlParams_, opts...) 16196 res, err := c.doRequest("json") 16197 if res != nil && res.StatusCode == http.StatusNotModified { 16198 if res.Body != nil { 16199 res.Body.Close() 16200 } 16201 return nil, &googleapi.Error{ 16202 Code: res.StatusCode, 16203 Header: res.Header, 16204 } 16205 } 16206 if err != nil { 16207 return nil, err 16208 } 16209 defer googleapi.CloseBody(res) 16210 if err := googleapi.CheckResponse(res); err != nil { 16211 return nil, err 16212 } 16213 ret := &Revision{ 16214 ServerResponse: googleapi.ServerResponse{ 16215 Header: res.Header, 16216 HTTPStatusCode: res.StatusCode, 16217 }, 16218 } 16219 target := &ret 16220 if err := gensupport.DecodeResponse(target, res); err != nil { 16221 return nil, err 16222 } 16223 return ret, nil 16224 // { 16225 // "description": "Updates a revision. This method supports patch semantics.", 16226 // "httpMethod": "PATCH", 16227 // "id": "drive.revisions.patch", 16228 // "parameterOrder": [ 16229 // "fileId", 16230 // "revisionId" 16231 // ], 16232 // "parameters": { 16233 // "fileId": { 16234 // "description": "The ID for the file.", 16235 // "location": "path", 16236 // "required": true, 16237 // "type": "string" 16238 // }, 16239 // "revisionId": { 16240 // "description": "The ID for the revision.", 16241 // "location": "path", 16242 // "required": true, 16243 // "type": "string" 16244 // } 16245 // }, 16246 // "path": "files/{fileId}/revisions/{revisionId}", 16247 // "request": { 16248 // "$ref": "Revision" 16249 // }, 16250 // "response": { 16251 // "$ref": "Revision" 16252 // }, 16253 // "scopes": [ 16254 // "https://www.googleapis.com/auth/drive", 16255 // "https://www.googleapis.com/auth/drive.appdata", 16256 // "https://www.googleapis.com/auth/drive.file" 16257 // ] 16258 // } 16259 16260} 16261 16262// method id "drive.revisions.update": 16263 16264type RevisionsUpdateCall struct { 16265 s *Service 16266 fileId string 16267 revisionId string 16268 revision *Revision 16269 urlParams_ gensupport.URLParams 16270 ctx_ context.Context 16271 header_ http.Header 16272} 16273 16274// Update: Updates a revision. 16275func (r *RevisionsService) Update(fileId string, revisionId string, revision *Revision) *RevisionsUpdateCall { 16276 c := &RevisionsUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)} 16277 c.fileId = fileId 16278 c.revisionId = revisionId 16279 c.revision = revision 16280 return c 16281} 16282 16283// Fields allows partial responses to be retrieved. See 16284// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 16285// for more information. 16286func (c *RevisionsUpdateCall) Fields(s ...googleapi.Field) *RevisionsUpdateCall { 16287 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 16288 return c 16289} 16290 16291// Context sets the context to be used in this call's Do method. Any 16292// pending HTTP request will be aborted if the provided context is 16293// canceled. 16294func (c *RevisionsUpdateCall) Context(ctx context.Context) *RevisionsUpdateCall { 16295 c.ctx_ = ctx 16296 return c 16297} 16298 16299// Header returns an http.Header that can be modified by the caller to 16300// add HTTP headers to the request. 16301func (c *RevisionsUpdateCall) Header() http.Header { 16302 if c.header_ == nil { 16303 c.header_ = make(http.Header) 16304 } 16305 return c.header_ 16306} 16307 16308func (c *RevisionsUpdateCall) doRequest(alt string) (*http.Response, error) { 16309 reqHeaders := make(http.Header) 16310 for k, v := range c.header_ { 16311 reqHeaders[k] = v 16312 } 16313 reqHeaders.Set("User-Agent", c.s.userAgent()) 16314 var body io.Reader = nil 16315 body, err := googleapi.WithoutDataWrapper.JSONReader(c.revision) 16316 if err != nil { 16317 return nil, err 16318 } 16319 reqHeaders.Set("Content-Type", "application/json") 16320 c.urlParams_.Set("alt", alt) 16321 c.urlParams_.Set("prettyPrint", "false") 16322 urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/revisions/{revisionId}") 16323 urls += "?" + c.urlParams_.Encode() 16324 req, err := http.NewRequest("PUT", urls, body) 16325 if err != nil { 16326 return nil, err 16327 } 16328 req.Header = reqHeaders 16329 googleapi.Expand(req.URL, map[string]string{ 16330 "fileId": c.fileId, 16331 "revisionId": c.revisionId, 16332 }) 16333 return gensupport.SendRequest(c.ctx_, c.s.client, req) 16334} 16335 16336// Do executes the "drive.revisions.update" call. 16337// Exactly one of *Revision or error will be non-nil. Any non-2xx status 16338// code is an error. Response headers are in either 16339// *Revision.ServerResponse.Header or (if a response was returned at 16340// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 16341// to check whether the returned error was because 16342// http.StatusNotModified was returned. 16343func (c *RevisionsUpdateCall) Do(opts ...googleapi.CallOption) (*Revision, error) { 16344 gensupport.SetOptions(c.urlParams_, opts...) 16345 res, err := c.doRequest("json") 16346 if res != nil && res.StatusCode == http.StatusNotModified { 16347 if res.Body != nil { 16348 res.Body.Close() 16349 } 16350 return nil, &googleapi.Error{ 16351 Code: res.StatusCode, 16352 Header: res.Header, 16353 } 16354 } 16355 if err != nil { 16356 return nil, err 16357 } 16358 defer googleapi.CloseBody(res) 16359 if err := googleapi.CheckResponse(res); err != nil { 16360 return nil, err 16361 } 16362 ret := &Revision{ 16363 ServerResponse: googleapi.ServerResponse{ 16364 Header: res.Header, 16365 HTTPStatusCode: res.StatusCode, 16366 }, 16367 } 16368 target := &ret 16369 if err := gensupport.DecodeResponse(target, res); err != nil { 16370 return nil, err 16371 } 16372 return ret, nil 16373 // { 16374 // "description": "Updates a revision.", 16375 // "httpMethod": "PUT", 16376 // "id": "drive.revisions.update", 16377 // "parameterOrder": [ 16378 // "fileId", 16379 // "revisionId" 16380 // ], 16381 // "parameters": { 16382 // "fileId": { 16383 // "description": "The ID for the file.", 16384 // "location": "path", 16385 // "required": true, 16386 // "type": "string" 16387 // }, 16388 // "revisionId": { 16389 // "description": "The ID for the revision.", 16390 // "location": "path", 16391 // "required": true, 16392 // "type": "string" 16393 // } 16394 // }, 16395 // "path": "files/{fileId}/revisions/{revisionId}", 16396 // "request": { 16397 // "$ref": "Revision" 16398 // }, 16399 // "response": { 16400 // "$ref": "Revision" 16401 // }, 16402 // "scopes": [ 16403 // "https://www.googleapis.com/auth/drive", 16404 // "https://www.googleapis.com/auth/drive.appdata", 16405 // "https://www.googleapis.com/auth/drive.file" 16406 // ] 16407 // } 16408 16409} 16410 16411// method id "drive.teamdrives.delete": 16412 16413type TeamdrivesDeleteCall struct { 16414 s *Service 16415 teamDriveId string 16416 urlParams_ gensupport.URLParams 16417 ctx_ context.Context 16418 header_ http.Header 16419} 16420 16421// Delete: Deprecated use drives.delete instead. 16422func (r *TeamdrivesService) Delete(teamDriveId string) *TeamdrivesDeleteCall { 16423 c := &TeamdrivesDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)} 16424 c.teamDriveId = teamDriveId 16425 return c 16426} 16427 16428// Fields allows partial responses to be retrieved. See 16429// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 16430// for more information. 16431func (c *TeamdrivesDeleteCall) Fields(s ...googleapi.Field) *TeamdrivesDeleteCall { 16432 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 16433 return c 16434} 16435 16436// Context sets the context to be used in this call's Do method. Any 16437// pending HTTP request will be aborted if the provided context is 16438// canceled. 16439func (c *TeamdrivesDeleteCall) Context(ctx context.Context) *TeamdrivesDeleteCall { 16440 c.ctx_ = ctx 16441 return c 16442} 16443 16444// Header returns an http.Header that can be modified by the caller to 16445// add HTTP headers to the request. 16446func (c *TeamdrivesDeleteCall) Header() http.Header { 16447 if c.header_ == nil { 16448 c.header_ = make(http.Header) 16449 } 16450 return c.header_ 16451} 16452 16453func (c *TeamdrivesDeleteCall) doRequest(alt string) (*http.Response, error) { 16454 reqHeaders := make(http.Header) 16455 for k, v := range c.header_ { 16456 reqHeaders[k] = v 16457 } 16458 reqHeaders.Set("User-Agent", c.s.userAgent()) 16459 var body io.Reader = nil 16460 c.urlParams_.Set("alt", alt) 16461 c.urlParams_.Set("prettyPrint", "false") 16462 urls := googleapi.ResolveRelative(c.s.BasePath, "teamdrives/{teamDriveId}") 16463 urls += "?" + c.urlParams_.Encode() 16464 req, err := http.NewRequest("DELETE", urls, body) 16465 if err != nil { 16466 return nil, err 16467 } 16468 req.Header = reqHeaders 16469 googleapi.Expand(req.URL, map[string]string{ 16470 "teamDriveId": c.teamDriveId, 16471 }) 16472 return gensupport.SendRequest(c.ctx_, c.s.client, req) 16473} 16474 16475// Do executes the "drive.teamdrives.delete" call. 16476func (c *TeamdrivesDeleteCall) Do(opts ...googleapi.CallOption) error { 16477 gensupport.SetOptions(c.urlParams_, opts...) 16478 res, err := c.doRequest("json") 16479 if err != nil { 16480 return err 16481 } 16482 defer googleapi.CloseBody(res) 16483 if err := googleapi.CheckResponse(res); err != nil { 16484 return err 16485 } 16486 return nil 16487 // { 16488 // "description": "Deprecated use drives.delete instead.", 16489 // "httpMethod": "DELETE", 16490 // "id": "drive.teamdrives.delete", 16491 // "parameterOrder": [ 16492 // "teamDriveId" 16493 // ], 16494 // "parameters": { 16495 // "teamDriveId": { 16496 // "description": "The ID of the Team Drive", 16497 // "location": "path", 16498 // "required": true, 16499 // "type": "string" 16500 // } 16501 // }, 16502 // "path": "teamdrives/{teamDriveId}", 16503 // "scopes": [ 16504 // "https://www.googleapis.com/auth/drive" 16505 // ] 16506 // } 16507 16508} 16509 16510// method id "drive.teamdrives.get": 16511 16512type TeamdrivesGetCall struct { 16513 s *Service 16514 teamDriveId string 16515 urlParams_ gensupport.URLParams 16516 ifNoneMatch_ string 16517 ctx_ context.Context 16518 header_ http.Header 16519} 16520 16521// Get: Deprecated use drives.get instead. 16522func (r *TeamdrivesService) Get(teamDriveId string) *TeamdrivesGetCall { 16523 c := &TeamdrivesGetCall{s: r.s, urlParams_: make(gensupport.URLParams)} 16524 c.teamDriveId = teamDriveId 16525 return c 16526} 16527 16528// UseDomainAdminAccess sets the optional parameter 16529// "useDomainAdminAccess": Issue the request as a domain administrator; 16530// if set to true, then the requester will be granted access if they are 16531// an administrator of the domain to which the Team Drive belongs. 16532func (c *TeamdrivesGetCall) UseDomainAdminAccess(useDomainAdminAccess bool) *TeamdrivesGetCall { 16533 c.urlParams_.Set("useDomainAdminAccess", fmt.Sprint(useDomainAdminAccess)) 16534 return c 16535} 16536 16537// Fields allows partial responses to be retrieved. See 16538// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 16539// for more information. 16540func (c *TeamdrivesGetCall) Fields(s ...googleapi.Field) *TeamdrivesGetCall { 16541 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 16542 return c 16543} 16544 16545// IfNoneMatch sets the optional parameter which makes the operation 16546// fail if the object's ETag matches the given value. This is useful for 16547// getting updates only after the object has changed since the last 16548// request. Use googleapi.IsNotModified to check whether the response 16549// error from Do is the result of In-None-Match. 16550func (c *TeamdrivesGetCall) IfNoneMatch(entityTag string) *TeamdrivesGetCall { 16551 c.ifNoneMatch_ = entityTag 16552 return c 16553} 16554 16555// Context sets the context to be used in this call's Do method. Any 16556// pending HTTP request will be aborted if the provided context is 16557// canceled. 16558func (c *TeamdrivesGetCall) Context(ctx context.Context) *TeamdrivesGetCall { 16559 c.ctx_ = ctx 16560 return c 16561} 16562 16563// Header returns an http.Header that can be modified by the caller to 16564// add HTTP headers to the request. 16565func (c *TeamdrivesGetCall) Header() http.Header { 16566 if c.header_ == nil { 16567 c.header_ = make(http.Header) 16568 } 16569 return c.header_ 16570} 16571 16572func (c *TeamdrivesGetCall) doRequest(alt string) (*http.Response, error) { 16573 reqHeaders := make(http.Header) 16574 for k, v := range c.header_ { 16575 reqHeaders[k] = v 16576 } 16577 reqHeaders.Set("User-Agent", c.s.userAgent()) 16578 if c.ifNoneMatch_ != "" { 16579 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 16580 } 16581 var body io.Reader = nil 16582 c.urlParams_.Set("alt", alt) 16583 c.urlParams_.Set("prettyPrint", "false") 16584 urls := googleapi.ResolveRelative(c.s.BasePath, "teamdrives/{teamDriveId}") 16585 urls += "?" + c.urlParams_.Encode() 16586 req, err := http.NewRequest("GET", urls, body) 16587 if err != nil { 16588 return nil, err 16589 } 16590 req.Header = reqHeaders 16591 googleapi.Expand(req.URL, map[string]string{ 16592 "teamDriveId": c.teamDriveId, 16593 }) 16594 return gensupport.SendRequest(c.ctx_, c.s.client, req) 16595} 16596 16597// Do executes the "drive.teamdrives.get" call. 16598// Exactly one of *TeamDrive or error will be non-nil. Any non-2xx 16599// status code is an error. Response headers are in either 16600// *TeamDrive.ServerResponse.Header or (if a response was returned at 16601// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 16602// to check whether the returned error was because 16603// http.StatusNotModified was returned. 16604func (c *TeamdrivesGetCall) Do(opts ...googleapi.CallOption) (*TeamDrive, error) { 16605 gensupport.SetOptions(c.urlParams_, opts...) 16606 res, err := c.doRequest("json") 16607 if res != nil && res.StatusCode == http.StatusNotModified { 16608 if res.Body != nil { 16609 res.Body.Close() 16610 } 16611 return nil, &googleapi.Error{ 16612 Code: res.StatusCode, 16613 Header: res.Header, 16614 } 16615 } 16616 if err != nil { 16617 return nil, err 16618 } 16619 defer googleapi.CloseBody(res) 16620 if err := googleapi.CheckResponse(res); err != nil { 16621 return nil, err 16622 } 16623 ret := &TeamDrive{ 16624 ServerResponse: googleapi.ServerResponse{ 16625 Header: res.Header, 16626 HTTPStatusCode: res.StatusCode, 16627 }, 16628 } 16629 target := &ret 16630 if err := gensupport.DecodeResponse(target, res); err != nil { 16631 return nil, err 16632 } 16633 return ret, nil 16634 // { 16635 // "description": "Deprecated use drives.get instead.", 16636 // "httpMethod": "GET", 16637 // "id": "drive.teamdrives.get", 16638 // "parameterOrder": [ 16639 // "teamDriveId" 16640 // ], 16641 // "parameters": { 16642 // "teamDriveId": { 16643 // "description": "The ID of the Team Drive", 16644 // "location": "path", 16645 // "required": true, 16646 // "type": "string" 16647 // }, 16648 // "useDomainAdminAccess": { 16649 // "default": "false", 16650 // "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.", 16651 // "location": "query", 16652 // "type": "boolean" 16653 // } 16654 // }, 16655 // "path": "teamdrives/{teamDriveId}", 16656 // "response": { 16657 // "$ref": "TeamDrive" 16658 // }, 16659 // "scopes": [ 16660 // "https://www.googleapis.com/auth/drive", 16661 // "https://www.googleapis.com/auth/drive.readonly" 16662 // ] 16663 // } 16664 16665} 16666 16667// method id "drive.teamdrives.insert": 16668 16669type TeamdrivesInsertCall struct { 16670 s *Service 16671 teamdrive *TeamDrive 16672 urlParams_ gensupport.URLParams 16673 ctx_ context.Context 16674 header_ http.Header 16675} 16676 16677// Insert: Deprecated use drives.insert instead. 16678func (r *TeamdrivesService) Insert(requestId string, teamdrive *TeamDrive) *TeamdrivesInsertCall { 16679 c := &TeamdrivesInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)} 16680 c.urlParams_.Set("requestId", requestId) 16681 c.teamdrive = teamdrive 16682 return c 16683} 16684 16685// Fields allows partial responses to be retrieved. See 16686// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 16687// for more information. 16688func (c *TeamdrivesInsertCall) Fields(s ...googleapi.Field) *TeamdrivesInsertCall { 16689 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 16690 return c 16691} 16692 16693// Context sets the context to be used in this call's Do method. Any 16694// pending HTTP request will be aborted if the provided context is 16695// canceled. 16696func (c *TeamdrivesInsertCall) Context(ctx context.Context) *TeamdrivesInsertCall { 16697 c.ctx_ = ctx 16698 return c 16699} 16700 16701// Header returns an http.Header that can be modified by the caller to 16702// add HTTP headers to the request. 16703func (c *TeamdrivesInsertCall) Header() http.Header { 16704 if c.header_ == nil { 16705 c.header_ = make(http.Header) 16706 } 16707 return c.header_ 16708} 16709 16710func (c *TeamdrivesInsertCall) doRequest(alt string) (*http.Response, error) { 16711 reqHeaders := make(http.Header) 16712 for k, v := range c.header_ { 16713 reqHeaders[k] = v 16714 } 16715 reqHeaders.Set("User-Agent", c.s.userAgent()) 16716 var body io.Reader = nil 16717 body, err := googleapi.WithoutDataWrapper.JSONReader(c.teamdrive) 16718 if err != nil { 16719 return nil, err 16720 } 16721 reqHeaders.Set("Content-Type", "application/json") 16722 c.urlParams_.Set("alt", alt) 16723 c.urlParams_.Set("prettyPrint", "false") 16724 urls := googleapi.ResolveRelative(c.s.BasePath, "teamdrives") 16725 urls += "?" + c.urlParams_.Encode() 16726 req, err := http.NewRequest("POST", urls, body) 16727 if err != nil { 16728 return nil, err 16729 } 16730 req.Header = reqHeaders 16731 return gensupport.SendRequest(c.ctx_, c.s.client, req) 16732} 16733 16734// Do executes the "drive.teamdrives.insert" call. 16735// Exactly one of *TeamDrive or error will be non-nil. Any non-2xx 16736// status code is an error. Response headers are in either 16737// *TeamDrive.ServerResponse.Header or (if a response was returned at 16738// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 16739// to check whether the returned error was because 16740// http.StatusNotModified was returned. 16741func (c *TeamdrivesInsertCall) Do(opts ...googleapi.CallOption) (*TeamDrive, error) { 16742 gensupport.SetOptions(c.urlParams_, opts...) 16743 res, err := c.doRequest("json") 16744 if res != nil && res.StatusCode == http.StatusNotModified { 16745 if res.Body != nil { 16746 res.Body.Close() 16747 } 16748 return nil, &googleapi.Error{ 16749 Code: res.StatusCode, 16750 Header: res.Header, 16751 } 16752 } 16753 if err != nil { 16754 return nil, err 16755 } 16756 defer googleapi.CloseBody(res) 16757 if err := googleapi.CheckResponse(res); err != nil { 16758 return nil, err 16759 } 16760 ret := &TeamDrive{ 16761 ServerResponse: googleapi.ServerResponse{ 16762 Header: res.Header, 16763 HTTPStatusCode: res.StatusCode, 16764 }, 16765 } 16766 target := &ret 16767 if err := gensupport.DecodeResponse(target, res); err != nil { 16768 return nil, err 16769 } 16770 return ret, nil 16771 // { 16772 // "description": "Deprecated use drives.insert instead.", 16773 // "httpMethod": "POST", 16774 // "id": "drive.teamdrives.insert", 16775 // "parameterOrder": [ 16776 // "requestId" 16777 // ], 16778 // "parameters": { 16779 // "requestId": { 16780 // "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.", 16781 // "location": "query", 16782 // "required": true, 16783 // "type": "string" 16784 // } 16785 // }, 16786 // "path": "teamdrives", 16787 // "request": { 16788 // "$ref": "TeamDrive" 16789 // }, 16790 // "response": { 16791 // "$ref": "TeamDrive" 16792 // }, 16793 // "scopes": [ 16794 // "https://www.googleapis.com/auth/drive" 16795 // ] 16796 // } 16797 16798} 16799 16800// method id "drive.teamdrives.list": 16801 16802type TeamdrivesListCall struct { 16803 s *Service 16804 urlParams_ gensupport.URLParams 16805 ifNoneMatch_ string 16806 ctx_ context.Context 16807 header_ http.Header 16808} 16809 16810// List: Deprecated use drives.list instead. 16811func (r *TeamdrivesService) List() *TeamdrivesListCall { 16812 c := &TeamdrivesListCall{s: r.s, urlParams_: make(gensupport.URLParams)} 16813 return c 16814} 16815 16816// MaxResults sets the optional parameter "maxResults": Maximum number 16817// of Team Drives to return. 16818func (c *TeamdrivesListCall) MaxResults(maxResults int64) *TeamdrivesListCall { 16819 c.urlParams_.Set("maxResults", fmt.Sprint(maxResults)) 16820 return c 16821} 16822 16823// PageToken sets the optional parameter "pageToken": Page token for 16824// Team Drives. 16825func (c *TeamdrivesListCall) PageToken(pageToken string) *TeamdrivesListCall { 16826 c.urlParams_.Set("pageToken", pageToken) 16827 return c 16828} 16829 16830// Q sets the optional parameter "q": Query string for searching Team 16831// Drives. 16832func (c *TeamdrivesListCall) Q(q string) *TeamdrivesListCall { 16833 c.urlParams_.Set("q", q) 16834 return c 16835} 16836 16837// UseDomainAdminAccess sets the optional parameter 16838// "useDomainAdminAccess": Issue the request as a domain administrator; 16839// if set to true, then all Team Drives of the domain in which the 16840// requester is an administrator are returned. 16841func (c *TeamdrivesListCall) UseDomainAdminAccess(useDomainAdminAccess bool) *TeamdrivesListCall { 16842 c.urlParams_.Set("useDomainAdminAccess", fmt.Sprint(useDomainAdminAccess)) 16843 return c 16844} 16845 16846// Fields allows partial responses to be retrieved. See 16847// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 16848// for more information. 16849func (c *TeamdrivesListCall) Fields(s ...googleapi.Field) *TeamdrivesListCall { 16850 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 16851 return c 16852} 16853 16854// IfNoneMatch sets the optional parameter which makes the operation 16855// fail if the object's ETag matches the given value. This is useful for 16856// getting updates only after the object has changed since the last 16857// request. Use googleapi.IsNotModified to check whether the response 16858// error from Do is the result of In-None-Match. 16859func (c *TeamdrivesListCall) IfNoneMatch(entityTag string) *TeamdrivesListCall { 16860 c.ifNoneMatch_ = entityTag 16861 return c 16862} 16863 16864// Context sets the context to be used in this call's Do method. Any 16865// pending HTTP request will be aborted if the provided context is 16866// canceled. 16867func (c *TeamdrivesListCall) Context(ctx context.Context) *TeamdrivesListCall { 16868 c.ctx_ = ctx 16869 return c 16870} 16871 16872// Header returns an http.Header that can be modified by the caller to 16873// add HTTP headers to the request. 16874func (c *TeamdrivesListCall) Header() http.Header { 16875 if c.header_ == nil { 16876 c.header_ = make(http.Header) 16877 } 16878 return c.header_ 16879} 16880 16881func (c *TeamdrivesListCall) doRequest(alt string) (*http.Response, error) { 16882 reqHeaders := make(http.Header) 16883 for k, v := range c.header_ { 16884 reqHeaders[k] = v 16885 } 16886 reqHeaders.Set("User-Agent", c.s.userAgent()) 16887 if c.ifNoneMatch_ != "" { 16888 reqHeaders.Set("If-None-Match", c.ifNoneMatch_) 16889 } 16890 var body io.Reader = nil 16891 c.urlParams_.Set("alt", alt) 16892 c.urlParams_.Set("prettyPrint", "false") 16893 urls := googleapi.ResolveRelative(c.s.BasePath, "teamdrives") 16894 urls += "?" + c.urlParams_.Encode() 16895 req, err := http.NewRequest("GET", urls, body) 16896 if err != nil { 16897 return nil, err 16898 } 16899 req.Header = reqHeaders 16900 return gensupport.SendRequest(c.ctx_, c.s.client, req) 16901} 16902 16903// Do executes the "drive.teamdrives.list" call. 16904// Exactly one of *TeamDriveList or error will be non-nil. Any non-2xx 16905// status code is an error. Response headers are in either 16906// *TeamDriveList.ServerResponse.Header or (if a response was returned 16907// at all) in error.(*googleapi.Error).Header. Use 16908// googleapi.IsNotModified to check whether the returned error was 16909// because http.StatusNotModified was returned. 16910func (c *TeamdrivesListCall) Do(opts ...googleapi.CallOption) (*TeamDriveList, error) { 16911 gensupport.SetOptions(c.urlParams_, opts...) 16912 res, err := c.doRequest("json") 16913 if res != nil && res.StatusCode == http.StatusNotModified { 16914 if res.Body != nil { 16915 res.Body.Close() 16916 } 16917 return nil, &googleapi.Error{ 16918 Code: res.StatusCode, 16919 Header: res.Header, 16920 } 16921 } 16922 if err != nil { 16923 return nil, err 16924 } 16925 defer googleapi.CloseBody(res) 16926 if err := googleapi.CheckResponse(res); err != nil { 16927 return nil, err 16928 } 16929 ret := &TeamDriveList{ 16930 ServerResponse: googleapi.ServerResponse{ 16931 Header: res.Header, 16932 HTTPStatusCode: res.StatusCode, 16933 }, 16934 } 16935 target := &ret 16936 if err := gensupport.DecodeResponse(target, res); err != nil { 16937 return nil, err 16938 } 16939 return ret, nil 16940 // { 16941 // "description": "Deprecated use drives.list instead.", 16942 // "httpMethod": "GET", 16943 // "id": "drive.teamdrives.list", 16944 // "parameters": { 16945 // "maxResults": { 16946 // "default": "10", 16947 // "description": "Maximum number of Team Drives to return.", 16948 // "format": "int32", 16949 // "location": "query", 16950 // "maximum": "100", 16951 // "minimum": "1", 16952 // "type": "integer" 16953 // }, 16954 // "pageToken": { 16955 // "description": "Page token for Team Drives.", 16956 // "location": "query", 16957 // "type": "string" 16958 // }, 16959 // "q": { 16960 // "description": "Query string for searching Team Drives.", 16961 // "location": "query", 16962 // "type": "string" 16963 // }, 16964 // "useDomainAdminAccess": { 16965 // "default": "false", 16966 // "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.", 16967 // "location": "query", 16968 // "type": "boolean" 16969 // } 16970 // }, 16971 // "path": "teamdrives", 16972 // "response": { 16973 // "$ref": "TeamDriveList" 16974 // }, 16975 // "scopes": [ 16976 // "https://www.googleapis.com/auth/drive", 16977 // "https://www.googleapis.com/auth/drive.readonly" 16978 // ] 16979 // } 16980 16981} 16982 16983// Pages invokes f for each page of results. 16984// A non-nil error returned from f will halt the iteration. 16985// The provided context supersedes any context provided to the Context method. 16986func (c *TeamdrivesListCall) Pages(ctx context.Context, f func(*TeamDriveList) error) error { 16987 c.ctx_ = ctx 16988 defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point 16989 for { 16990 x, err := c.Do() 16991 if err != nil { 16992 return err 16993 } 16994 if err := f(x); err != nil { 16995 return err 16996 } 16997 if x.NextPageToken == "" { 16998 return nil 16999 } 17000 c.PageToken(x.NextPageToken) 17001 } 17002} 17003 17004// method id "drive.teamdrives.update": 17005 17006type TeamdrivesUpdateCall struct { 17007 s *Service 17008 teamDriveId string 17009 teamdrive *TeamDrive 17010 urlParams_ gensupport.URLParams 17011 ctx_ context.Context 17012 header_ http.Header 17013} 17014 17015// Update: Deprecated use drives.update instead. 17016func (r *TeamdrivesService) Update(teamDriveId string, teamdrive *TeamDrive) *TeamdrivesUpdateCall { 17017 c := &TeamdrivesUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)} 17018 c.teamDriveId = teamDriveId 17019 c.teamdrive = teamdrive 17020 return c 17021} 17022 17023// UseDomainAdminAccess sets the optional parameter 17024// "useDomainAdminAccess": Issue the request as a domain administrator; 17025// if set to true, then the requester will be granted access if they are 17026// an administrator of the domain to which the Team Drive belongs. 17027func (c *TeamdrivesUpdateCall) UseDomainAdminAccess(useDomainAdminAccess bool) *TeamdrivesUpdateCall { 17028 c.urlParams_.Set("useDomainAdminAccess", fmt.Sprint(useDomainAdminAccess)) 17029 return c 17030} 17031 17032// Fields allows partial responses to be retrieved. See 17033// https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 17034// for more information. 17035func (c *TeamdrivesUpdateCall) Fields(s ...googleapi.Field) *TeamdrivesUpdateCall { 17036 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 17037 return c 17038} 17039 17040// Context sets the context to be used in this call's Do method. Any 17041// pending HTTP request will be aborted if the provided context is 17042// canceled. 17043func (c *TeamdrivesUpdateCall) Context(ctx context.Context) *TeamdrivesUpdateCall { 17044 c.ctx_ = ctx 17045 return c 17046} 17047 17048// Header returns an http.Header that can be modified by the caller to 17049// add HTTP headers to the request. 17050func (c *TeamdrivesUpdateCall) Header() http.Header { 17051 if c.header_ == nil { 17052 c.header_ = make(http.Header) 17053 } 17054 return c.header_ 17055} 17056 17057func (c *TeamdrivesUpdateCall) doRequest(alt string) (*http.Response, error) { 17058 reqHeaders := make(http.Header) 17059 for k, v := range c.header_ { 17060 reqHeaders[k] = v 17061 } 17062 reqHeaders.Set("User-Agent", c.s.userAgent()) 17063 var body io.Reader = nil 17064 body, err := googleapi.WithoutDataWrapper.JSONReader(c.teamdrive) 17065 if err != nil { 17066 return nil, err 17067 } 17068 reqHeaders.Set("Content-Type", "application/json") 17069 c.urlParams_.Set("alt", alt) 17070 c.urlParams_.Set("prettyPrint", "false") 17071 urls := googleapi.ResolveRelative(c.s.BasePath, "teamdrives/{teamDriveId}") 17072 urls += "?" + c.urlParams_.Encode() 17073 req, err := http.NewRequest("PUT", urls, body) 17074 if err != nil { 17075 return nil, err 17076 } 17077 req.Header = reqHeaders 17078 googleapi.Expand(req.URL, map[string]string{ 17079 "teamDriveId": c.teamDriveId, 17080 }) 17081 return gensupport.SendRequest(c.ctx_, c.s.client, req) 17082} 17083 17084// Do executes the "drive.teamdrives.update" call. 17085// Exactly one of *TeamDrive or error will be non-nil. Any non-2xx 17086// status code is an error. Response headers are in either 17087// *TeamDrive.ServerResponse.Header or (if a response was returned at 17088// all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 17089// to check whether the returned error was because 17090// http.StatusNotModified was returned. 17091func (c *TeamdrivesUpdateCall) Do(opts ...googleapi.CallOption) (*TeamDrive, error) { 17092 gensupport.SetOptions(c.urlParams_, opts...) 17093 res, err := c.doRequest("json") 17094 if res != nil && res.StatusCode == http.StatusNotModified { 17095 if res.Body != nil { 17096 res.Body.Close() 17097 } 17098 return nil, &googleapi.Error{ 17099 Code: res.StatusCode, 17100 Header: res.Header, 17101 } 17102 } 17103 if err != nil { 17104 return nil, err 17105 } 17106 defer googleapi.CloseBody(res) 17107 if err := googleapi.CheckResponse(res); err != nil { 17108 return nil, err 17109 } 17110 ret := &TeamDrive{ 17111 ServerResponse: googleapi.ServerResponse{ 17112 Header: res.Header, 17113 HTTPStatusCode: res.StatusCode, 17114 }, 17115 } 17116 target := &ret 17117 if err := gensupport.DecodeResponse(target, res); err != nil { 17118 return nil, err 17119 } 17120 return ret, nil 17121 // { 17122 // "description": "Deprecated use drives.update instead.", 17123 // "httpMethod": "PUT", 17124 // "id": "drive.teamdrives.update", 17125 // "parameterOrder": [ 17126 // "teamDriveId" 17127 // ], 17128 // "parameters": { 17129 // "teamDriveId": { 17130 // "description": "The ID of the Team Drive", 17131 // "location": "path", 17132 // "required": true, 17133 // "type": "string" 17134 // }, 17135 // "useDomainAdminAccess": { 17136 // "default": "false", 17137 // "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.", 17138 // "location": "query", 17139 // "type": "boolean" 17140 // } 17141 // }, 17142 // "path": "teamdrives/{teamDriveId}", 17143 // "request": { 17144 // "$ref": "TeamDrive" 17145 // }, 17146 // "response": { 17147 // "$ref": "TeamDrive" 17148 // }, 17149 // "scopes": [ 17150 // "https://www.googleapis.com/auth/drive" 17151 // ] 17152 // } 17153 17154} 17155