A hint: This file contains one or more very long lines, so maybe it is better readable using the pure text view mode that shows the contents as wrapped lines within the browser window.
1 // Package drive provides access to the Drive API. 2 // 3 // See https://developers.google.com/drive/ 4 // 5 // Usage example: 6 // 7 // import "google.golang.org/api/drive/v3" 8 // ... 9 // driveService, err := drive.New(oauthHttpClient) 10 package drive 11 12 import ( 13 "bytes" 14 "encoding/json" 15 "errors" 16 "fmt" 17 context "golang.org/x/net/context" 18 ctxhttp "golang.org/x/net/context/ctxhttp" 19 gensupport "google.golang.org/api/gensupport" 20 googleapi "google.golang.org/api/googleapi" 21 "io" 22 "net/http" 23 "net/url" 24 "strconv" 25 "strings" 26 ) 27 28 // Always reference these packages, just in case the auto-generated code 29 // below doesn't. 30 var _ = bytes.NewBuffer 31 var _ = strconv.Itoa 32 var _ = fmt.Sprintf 33 var _ = json.NewDecoder 34 var _ = io.Copy 35 var _ = url.Parse 36 var _ = gensupport.MarshalJSON 37 var _ = googleapi.Version 38 var _ = errors.New 39 var _ = strings.Replace 40 var _ = context.Canceled 41 var _ = ctxhttp.Do 42 43 const apiId = "drive:v3" 44 const apiName = "drive" 45 const apiVersion = "v3" 46 const basePath = "https://www.googleapis.com/drive/v3/" 47 48 // OAuth2 scopes used by this API. 49 const ( 50 // View and manage the files in your Google Drive 51 DriveScope = "https://www.googleapis.com/auth/drive" 52 53 // View and manage its own configuration data in your Google Drive 54 DriveAppdataScope = "https://www.googleapis.com/auth/drive.appdata" 55 56 // View and manage Google Drive files and folders that you have opened 57 // or created with this app 58 DriveFileScope = "https://www.googleapis.com/auth/drive.file" 59 60 // View and manage metadata of files in your Google Drive 61 DriveMetadataScope = "https://www.googleapis.com/auth/drive.metadata" 62 63 // View metadata for files in your Google Drive 64 DriveMetadataReadonlyScope = "https://www.googleapis.com/auth/drive.metadata.readonly" 65 66 // View the photos, videos and albums in your Google Photos 67 DrivePhotosReadonlyScope = "https://www.googleapis.com/auth/drive.photos.readonly" 68 69 // View the files in your Google Drive 70 DriveReadonlyScope = "https://www.googleapis.com/auth/drive.readonly" 71 72 // Modify your Google Apps Script scripts' behavior 73 DriveScriptsScope = "https://www.googleapis.com/auth/drive.scripts" 74 ) 75 76 func New(client *http.Client) (*Service, error) { 77 if client == nil { 78 return nil, errors.New("client is nil") 79 } 80 s := &Service{client: client, BasePath: basePath} 81 s.About = NewAboutService(s) 82 s.Changes = NewChangesService(s) 83 s.Channels = NewChannelsService(s) 84 s.Comments = NewCommentsService(s) 85 s.Files = NewFilesService(s) 86 s.Permissions = NewPermissionsService(s) 87 s.Replies = NewRepliesService(s) 88 s.Revisions = NewRevisionsService(s) 89 return s, nil 90 } 91 92 type Service struct { 93 client *http.Client 94 BasePath string // API endpoint base URL 95 UserAgent string // optional additional User-Agent fragment 96 97 About *AboutService 98 99 Changes *ChangesService 100 101 Channels *ChannelsService 102 103 Comments *CommentsService 104 105 Files *FilesService 106 107 Permissions *PermissionsService 108 109 Replies *RepliesService 110 111 Revisions *RevisionsService 112 } 113 114 func (s *Service) userAgent() string { 115 if s.UserAgent == "" { 116 return googleapi.UserAgent 117 } 118 return googleapi.UserAgent + " " + s.UserAgent 119 } 120 121 func NewAboutService(s *Service) *AboutService { 122 rs := &AboutService{s: s} 123 return rs 124 } 125 126 type AboutService struct { 127 s *Service 128 } 129 130 func NewChangesService(s *Service) *ChangesService { 131 rs := &ChangesService{s: s} 132 return rs 133 } 134 135 type ChangesService struct { 136 s *Service 137 } 138 139 func NewChannelsService(s *Service) *ChannelsService { 140 rs := &ChannelsService{s: s} 141 return rs 142 } 143 144 type ChannelsService struct { 145 s *Service 146 } 147 148 func NewCommentsService(s *Service) *CommentsService { 149 rs := &CommentsService{s: s} 150 return rs 151 } 152 153 type CommentsService struct { 154 s *Service 155 } 156 157 func NewFilesService(s *Service) *FilesService { 158 rs := &FilesService{s: s} 159 return rs 160 } 161 162 type FilesService struct { 163 s *Service 164 } 165 166 func NewPermissionsService(s *Service) *PermissionsService { 167 rs := &PermissionsService{s: s} 168 return rs 169 } 170 171 type PermissionsService struct { 172 s *Service 173 } 174 175 func NewRepliesService(s *Service) *RepliesService { 176 rs := &RepliesService{s: s} 177 return rs 178 } 179 180 type RepliesService struct { 181 s *Service 182 } 183 184 func NewRevisionsService(s *Service) *RevisionsService { 185 rs := &RevisionsService{s: s} 186 return rs 187 } 188 189 type RevisionsService struct { 190 s *Service 191 } 192 193 // About: Information about the user, the user's Drive, and system 194 // capabilities. 195 type About struct { 196 // AppInstalled: Whether the user has installed the requesting app. 197 AppInstalled bool `json:"appInstalled,omitempty"` 198 199 // ExportFormats: A map of source MIME type to possible targets for all 200 // supported exports. 201 ExportFormats map[string][]string `json:"exportFormats,omitempty"` 202 203 // FolderColorPalette: The currently supported folder colors as RGB hex 204 // strings. 205 FolderColorPalette []string `json:"folderColorPalette,omitempty"` 206 207 // ImportFormats: A map of source MIME type to possible targets for all 208 // supported imports. 209 ImportFormats map[string][]string `json:"importFormats,omitempty"` 210 211 // Kind: This is always drive#about. 212 Kind string `json:"kind,omitempty"` 213 214 // MaxImportSizes: A map of maximum import sizes by MIME type, in bytes. 215 MaxImportSizes map[string]string `json:"maxImportSizes,omitempty"` 216 217 // MaxUploadSize: The maximum upload size in bytes. 218 MaxUploadSize int64 `json:"maxUploadSize,omitempty,string"` 219 220 // StorageQuota: The user's storage quota limits and usage. All fields 221 // are measured in bytes. 222 StorageQuota *AboutStorageQuota `json:"storageQuota,omitempty"` 223 224 // User: The authenticated user. 225 User *User `json:"user,omitempty"` 226 227 // ServerResponse contains the HTTP response code and headers from the 228 // server. 229 googleapi.ServerResponse `json:"-"` 230 231 // ForceSendFields is a list of field names (e.g. "AppInstalled") to 232 // unconditionally include in API requests. By default, fields with 233 // empty values are omitted from API requests. However, any non-pointer, 234 // non-interface field appearing in ForceSendFields will be sent to the 235 // server regardless of whether the field is empty or not. This may be 236 // used to include empty fields in Patch requests. 237 ForceSendFields []string `json:"-"` 238 } 239 240 func (s *About) MarshalJSON() ([]byte, error) { 241 type noMethod About 242 raw := noMethod(*s) 243 return gensupport.MarshalJSON(raw, s.ForceSendFields) 244 } 245 246 // AboutStorageQuota: The user's storage quota limits and usage. All 247 // fields are measured in bytes. 248 type AboutStorageQuota struct { 249 // Limit: The usage limit, if applicable. This will not be present if 250 // the user has unlimited storage. 251 Limit int64 `json:"limit,omitempty,string"` 252 253 // Usage: The total usage across all services. 254 Usage int64 `json:"usage,omitempty,string"` 255 256 // UsageInDrive: The usage by all files in Google Drive. 257 UsageInDrive int64 `json:"usageInDrive,omitempty,string"` 258 259 // UsageInDriveTrash: The usage by trashed files in Google Drive. 260 UsageInDriveTrash int64 `json:"usageInDriveTrash,omitempty,string"` 261 262 // ForceSendFields is a list of field names (e.g. "Limit") to 263 // unconditionally include in API requests. By default, fields with 264 // empty values are omitted from API requests. However, any non-pointer, 265 // non-interface field appearing in ForceSendFields will be sent to the 266 // server regardless of whether the field is empty or not. This may be 267 // used to include empty fields in Patch requests. 268 ForceSendFields []string `json:"-"` 269 } 270 271 func (s *AboutStorageQuota) MarshalJSON() ([]byte, error) { 272 type noMethod AboutStorageQuota 273 raw := noMethod(*s) 274 return gensupport.MarshalJSON(raw, s.ForceSendFields) 275 } 276 277 // Change: A change to a file. 278 type Change struct { 279 // File: The updated state of the file. Present if the file has not been 280 // removed. 281 File *File `json:"file,omitempty"` 282 283 // FileId: The ID of the file which has changed. 284 FileId string `json:"fileId,omitempty"` 285 286 // Kind: This is always drive#change. 287 Kind string `json:"kind,omitempty"` 288 289 // Removed: Whether the file has been removed from the view of the 290 // changes list, for example by deletion or lost access. 291 Removed bool `json:"removed,omitempty"` 292 293 // Time: The time of this change (RFC 3339 date-time). 294 Time string `json:"time,omitempty"` 295 296 // ForceSendFields is a list of field names (e.g. "File") to 297 // unconditionally include in API requests. By default, fields with 298 // empty values are omitted from API requests. However, any non-pointer, 299 // non-interface field appearing in ForceSendFields will be sent to the 300 // server regardless of whether the field is empty or not. This may be 301 // used to include empty fields in Patch requests. 302 ForceSendFields []string `json:"-"` 303 } 304 305 func (s *Change) MarshalJSON() ([]byte, error) { 306 type noMethod Change 307 raw := noMethod(*s) 308 return gensupport.MarshalJSON(raw, s.ForceSendFields) 309 } 310 311 // ChangeList: A list of changes for a user. 312 type ChangeList struct { 313 // Changes: The page of changes. 314 Changes []*Change `json:"changes,omitempty"` 315 316 // Kind: This is always drive#changeList. 317 Kind string `json:"kind,omitempty"` 318 319 // NewStartPageToken: The starting page token for future changes. This 320 // will be present only if the end of the current changes list has been 321 // reached. 322 NewStartPageToken string `json:"newStartPageToken,omitempty"` 323 324 // NextPageToken: The page token for the next page of changes. This will 325 // be absent if the end of the current changes list has been reached. 326 NextPageToken string `json:"nextPageToken,omitempty"` 327 328 // ServerResponse contains the HTTP response code and headers from the 329 // server. 330 googleapi.ServerResponse `json:"-"` 331 332 // ForceSendFields is a list of field names (e.g. "Changes") to 333 // unconditionally include in API requests. By default, fields with 334 // empty values are omitted from API requests. However, any non-pointer, 335 // non-interface field appearing in ForceSendFields will be sent to the 336 // server regardless of whether the field is empty or not. This may be 337 // used to include empty fields in Patch requests. 338 ForceSendFields []string `json:"-"` 339 } 340 341 func (s *ChangeList) MarshalJSON() ([]byte, error) { 342 type noMethod ChangeList 343 raw := noMethod(*s) 344 return gensupport.MarshalJSON(raw, s.ForceSendFields) 345 } 346 347 // Channel: An notification channel used to watch for resource changes. 348 type Channel struct { 349 // Address: The address where notifications are delivered for this 350 // channel. 351 Address string `json:"address,omitempty"` 352 353 // Expiration: Date and time of notification channel expiration, 354 // expressed as a Unix timestamp, in milliseconds. Optional. 355 Expiration int64 `json:"expiration,omitempty,string"` 356 357 // Id: A UUID or similar unique string that identifies this channel. 358 Id string `json:"id,omitempty"` 359 360 // Kind: Identifies this as a notification channel used to watch for 361 // changes to a resource. Value: the fixed string "api#channel". 362 Kind string `json:"kind,omitempty"` 363 364 // Params: Additional parameters controlling delivery channel behavior. 365 // Optional. 366 Params map[string]string `json:"params,omitempty"` 367 368 // Payload: A Boolean value to indicate whether payload is wanted. 369 // Optional. 370 Payload bool `json:"payload,omitempty"` 371 372 // ResourceId: An opaque ID that identifies the resource being watched 373 // on this channel. Stable across different API versions. 374 ResourceId string `json:"resourceId,omitempty"` 375 376 // ResourceUri: A version-specific identifier for the watched resource. 377 ResourceUri string `json:"resourceUri,omitempty"` 378 379 // Token: An arbitrary string delivered to the target address with each 380 // notification delivered over this channel. Optional. 381 Token string `json:"token,omitempty"` 382 383 // Type: The type of delivery mechanism used for this channel. 384 Type string `json:"type,omitempty"` 385 386 // ServerResponse contains the HTTP response code and headers from the 387 // server. 388 googleapi.ServerResponse `json:"-"` 389 390 // ForceSendFields is a list of field names (e.g. "Address") to 391 // unconditionally include in API requests. By default, fields with 392 // empty values are omitted from API requests. However, any non-pointer, 393 // non-interface field appearing in ForceSendFields will be sent to the 394 // server regardless of whether the field is empty or not. This may be 395 // used to include empty fields in Patch requests. 396 ForceSendFields []string `json:"-"` 397 } 398 399 func (s *Channel) MarshalJSON() ([]byte, error) { 400 type noMethod Channel 401 raw := noMethod(*s) 402 return gensupport.MarshalJSON(raw, s.ForceSendFields) 403 } 404 405 // Comment: A comment on a file. 406 type Comment struct { 407 // Anchor: A region of the document represented as a JSON string. See 408 // anchor documentation for details on how to define and interpret 409 // anchor properties. 410 Anchor string `json:"anchor,omitempty"` 411 412 // Author: The user who created the comment. 413 Author *User `json:"author,omitempty"` 414 415 // Content: The plain text content of the comment. This field is used 416 // for setting the content, while htmlContent should be displayed. 417 Content string `json:"content,omitempty"` 418 419 // CreatedTime: The time at which the comment was created (RFC 3339 420 // date-time). 421 CreatedTime string `json:"createdTime,omitempty"` 422 423 // Deleted: Whether the comment has been deleted. A deleted comment has 424 // no content. 425 Deleted bool `json:"deleted,omitempty"` 426 427 // HtmlContent: The content of the comment with HTML formatting. 428 HtmlContent string `json:"htmlContent,omitempty"` 429 430 // Id: The ID of the comment. 431 Id string `json:"id,omitempty"` 432 433 // Kind: This is always drive#comment. 434 Kind string `json:"kind,omitempty"` 435 436 // ModifiedTime: The last time the comment or any of its replies was 437 // modified (RFC 3339 date-time). 438 ModifiedTime string `json:"modifiedTime,omitempty"` 439 440 // QuotedFileContent: The file content to which the comment refers, 441 // typically within the anchor region. For a text file, for example, 442 // this would be the text at the location of the comment. 443 QuotedFileContent *CommentQuotedFileContent `json:"quotedFileContent,omitempty"` 444 445 // Replies: The full list of replies to the comment in chronological 446 // order. 447 Replies []*Reply `json:"replies,omitempty"` 448 449 // Resolved: Whether the comment has been resolved by one of its 450 // replies. 451 Resolved bool `json:"resolved,omitempty"` 452 453 // ServerResponse contains the HTTP response code and headers from the 454 // server. 455 googleapi.ServerResponse `json:"-"` 456 457 // ForceSendFields is a list of field names (e.g. "Anchor") to 458 // unconditionally include in API requests. By default, fields with 459 // empty values are omitted from API requests. However, any non-pointer, 460 // non-interface field appearing in ForceSendFields will be sent to the 461 // server regardless of whether the field is empty or not. This may be 462 // used to include empty fields in Patch requests. 463 ForceSendFields []string `json:"-"` 464 } 465 466 func (s *Comment) MarshalJSON() ([]byte, error) { 467 type noMethod Comment 468 raw := noMethod(*s) 469 return gensupport.MarshalJSON(raw, s.ForceSendFields) 470 } 471 472 // CommentQuotedFileContent: The file content to which the comment 473 // refers, typically within the anchor region. For a text file, for 474 // example, this would be the text at the location of the comment. 475 type CommentQuotedFileContent struct { 476 // MimeType: The MIME type of the quoted content. 477 MimeType string `json:"mimeType,omitempty"` 478 479 // Value: The quoted content itself. This is interpreted as plain text 480 // if set through the API. 481 Value string `json:"value,omitempty"` 482 483 // ForceSendFields is a list of field names (e.g. "MimeType") to 484 // unconditionally include in API requests. By default, fields with 485 // empty values are omitted from API requests. However, any non-pointer, 486 // non-interface field appearing in ForceSendFields will be sent to the 487 // server regardless of whether the field is empty or not. This may be 488 // used to include empty fields in Patch requests. 489 ForceSendFields []string `json:"-"` 490 } 491 492 func (s *CommentQuotedFileContent) MarshalJSON() ([]byte, error) { 493 type noMethod CommentQuotedFileContent 494 raw := noMethod(*s) 495 return gensupport.MarshalJSON(raw, s.ForceSendFields) 496 } 497 498 // CommentList: A list of comments on a file. 499 type CommentList struct { 500 // Comments: The page of comments. 501 Comments []*Comment `json:"comments,omitempty"` 502 503 // Kind: This is always drive#commentList. 504 Kind string `json:"kind,omitempty"` 505 506 // NextPageToken: The page token for the next page of comments. This 507 // will be absent if the end of the comments list has been reached. 508 NextPageToken string `json:"nextPageToken,omitempty"` 509 510 // ServerResponse contains the HTTP response code and headers from the 511 // server. 512 googleapi.ServerResponse `json:"-"` 513 514 // ForceSendFields is a list of field names (e.g. "Comments") to 515 // unconditionally include in API requests. By default, fields with 516 // empty values are omitted from API requests. However, any non-pointer, 517 // non-interface field appearing in ForceSendFields will be sent to the 518 // server regardless of whether the field is empty or not. This may be 519 // used to include empty fields in Patch requests. 520 ForceSendFields []string `json:"-"` 521 } 522 523 func (s *CommentList) MarshalJSON() ([]byte, error) { 524 type noMethod CommentList 525 raw := noMethod(*s) 526 return gensupport.MarshalJSON(raw, s.ForceSendFields) 527 } 528 529 // File: The metadata for a file. 530 type File struct { 531 // AppProperties: A collection of arbitrary key-value pairs which are 532 // private to the requesting app. 533 // Entries with null values are cleared in update and copy requests. 534 AppProperties map[string]string `json:"appProperties,omitempty"` 535 536 // Capabilities: Capabilities the current user has on the file. 537 Capabilities *FileCapabilities `json:"capabilities,omitempty"` 538 539 // ContentHints: Additional information about the content of the file. 540 // These fields are never populated in responses. 541 ContentHints *FileContentHints `json:"contentHints,omitempty"` 542 543 // CreatedTime: The time at which the file was created (RFC 3339 544 // date-time). 545 CreatedTime string `json:"createdTime,omitempty"` 546 547 // Description: A short description of the file. 548 Description string `json:"description,omitempty"` 549 550 // ExplicitlyTrashed: Whether the file has been explicitly trashed, as 551 // opposed to recursively trashed from a parent folder. 552 ExplicitlyTrashed bool `json:"explicitlyTrashed,omitempty"` 553 554 // FileExtension: The final component of fullFileExtension. This is only 555 // available for files with binary content in Drive. 556 FileExtension string `json:"fileExtension,omitempty"` 557 558 // FolderColorRgb: The color for a folder as an RGB hex string. The 559 // supported colors are published in the folderColorPalette field of the 560 // About resource. 561 // If an unsupported color is specified, the closest color in the 562 // palette will be used instead. 563 FolderColorRgb string `json:"folderColorRgb,omitempty"` 564 565 // FullFileExtension: The full file extension extracted from the name 566 // field. May contain multiple concatenated extensions, such as 567 // "tar.gz". This is only available for files with binary content in 568 // Drive. 569 // This is automatically updated when the name field changes, however it 570 // is not cleared if the new name does not contain a valid extension. 571 FullFileExtension string `json:"fullFileExtension,omitempty"` 572 573 // HeadRevisionId: The ID of the file's head revision. This is currently 574 // only available for files with binary content in Drive. 575 HeadRevisionId string `json:"headRevisionId,omitempty"` 576 577 // IconLink: A static, unauthenticated link to the file's icon. 578 IconLink string `json:"iconLink,omitempty"` 579 580 // Id: The ID of the file. 581 Id string `json:"id,omitempty"` 582 583 // ImageMediaMetadata: Additional metadata about image media, if 584 // available. 585 ImageMediaMetadata *FileImageMediaMetadata `json:"imageMediaMetadata,omitempty"` 586 587 // Kind: This is always drive#file. 588 Kind string `json:"kind,omitempty"` 589 590 // LastModifyingUser: The last user to modify the file. 591 LastModifyingUser *User `json:"lastModifyingUser,omitempty"` 592 593 // Md5Checksum: The MD5 checksum for the content of the file. This is 594 // only applicable to files with binary content in Drive. 595 Md5Checksum string `json:"md5Checksum,omitempty"` 596 597 // MimeType: The MIME type of the file. 598 // Drive will attempt to automatically detect an appropriate value from 599 // uploaded content if no value is provided. The value cannot be changed 600 // unless a new revision is uploaded. 601 // If a file is created with a Google Doc MIME type, the uploaded 602 // content will be imported if possible. The supported import formats 603 // are published in the About resource. 604 MimeType string `json:"mimeType,omitempty"` 605 606 // ModifiedByMeTime: The last time the file was modified by the user 607 // (RFC 3339 date-time). 608 ModifiedByMeTime string `json:"modifiedByMeTime,omitempty"` 609 610 // ModifiedTime: The last time the file was modified by anyone (RFC 3339 611 // date-time). 612 // Note that setting modifiedTime will also update modifiedByMeTime for 613 // the user. 614 ModifiedTime string `json:"modifiedTime,omitempty"` 615 616 // Name: The name of the file. This is not necessarily unique within a 617 // folder. 618 Name string `json:"name,omitempty"` 619 620 // OriginalFilename: The original filename of the uploaded content if 621 // available, or else the original value of the name field. This is only 622 // available for files with binary content in Drive. 623 OriginalFilename string `json:"originalFilename,omitempty"` 624 625 // OwnedByMe: Whether the user owns the file. 626 OwnedByMe bool `json:"ownedByMe,omitempty"` 627 628 // Owners: The owners of the file. Currently, only certain legacy files 629 // may have more than one owner. 630 Owners []*User `json:"owners,omitempty"` 631 632 // Parents: The IDs of the parent folders which contain the file. 633 // If not specified as part of a create request, the file will be placed 634 // directly in the My Drive folder. Update requests must use the 635 // addParents and removeParents parameters to modify the values. 636 Parents []string `json:"parents,omitempty"` 637 638 // Permissions: The full list of permissions for the file. This is only 639 // available if the requesting user can share the file. 640 Permissions []*Permission `json:"permissions,omitempty"` 641 642 // Properties: A collection of arbitrary key-value pairs which are 643 // visible to all apps. 644 // Entries with null values are cleared in update and copy requests. 645 Properties map[string]string `json:"properties,omitempty"` 646 647 // QuotaBytesUsed: The number of storage quota bytes used by the file. 648 // This includes the head revision as well as previous revisions with 649 // keepForever enabled. 650 QuotaBytesUsed int64 `json:"quotaBytesUsed,omitempty,string"` 651 652 // Shared: Whether the file has been shared. 653 Shared bool `json:"shared,omitempty"` 654 655 // SharedWithMeTime: The time at which the file was shared with the 656 // user, if applicable (RFC 3339 date-time). 657 SharedWithMeTime string `json:"sharedWithMeTime,omitempty"` 658 659 // SharingUser: The user who shared the file with the requesting user, 660 // if applicable. 661 SharingUser *User `json:"sharingUser,omitempty"` 662 663 // Size: The size of the file's content in bytes. This is only 664 // applicable to files with binary content in Drive. 665 Size int64 `json:"size,omitempty,string"` 666 667 // Spaces: The list of spaces which contain the file. The currently 668 // supported values are 'drive', 'appDataFolder' and 'photos'. 669 Spaces []string `json:"spaces,omitempty"` 670 671 // Starred: Whether the user has starred the file. 672 Starred bool `json:"starred,omitempty"` 673 674 // ThumbnailLink: A short-lived link to the file's thumbnail, if 675 // available. Typically lasts on the order of hours. 676 ThumbnailLink string `json:"thumbnailLink,omitempty"` 677 678 // Trashed: Whether the file has been trashed, either explicitly or from 679 // a trashed parent folder. Only the owner may trash a file, and other 680 // users cannot see files in the owner's trash. 681 Trashed bool `json:"trashed,omitempty"` 682 683 // Version: A monotonically increasing version number for the file. This 684 // reflects every change made to the file on the server, even those not 685 // visible to the user. 686 Version int64 `json:"version,omitempty,string"` 687 688 // VideoMediaMetadata: Additional metadata about video media. This may 689 // not be available immediately upon upload. 690 VideoMediaMetadata *FileVideoMediaMetadata `json:"videoMediaMetadata,omitempty"` 691 692 // ViewedByMe: Whether the file has been viewed by this user. 693 ViewedByMe bool `json:"viewedByMe,omitempty"` 694 695 // ViewedByMeTime: The last time the file was viewed by the user (RFC 696 // 3339 date-time). 697 ViewedByMeTime string `json:"viewedByMeTime,omitempty"` 698 699 // ViewersCanCopyContent: Whether users with only reader or commenter 700 // permission can copy the file's content. This affects copy, download, 701 // and print operations. 702 ViewersCanCopyContent bool `json:"viewersCanCopyContent,omitempty"` 703 704 // WebContentLink: A link for downloading the content of the file in a 705 // browser. This is only available for files with binary content in 706 // Drive. 707 WebContentLink string `json:"webContentLink,omitempty"` 708 709 // WebViewLink: A link for opening the file in a relevant Google editor 710 // or viewer in a browser. 711 WebViewLink string `json:"webViewLink,omitempty"` 712 713 // WritersCanShare: Whether users with only writer permission can modify 714 // the file's permissions. 715 WritersCanShare bool `json:"writersCanShare,omitempty"` 716 717 // ServerResponse contains the HTTP response code and headers from the 718 // server. 719 googleapi.ServerResponse `json:"-"` 720 721 // ForceSendFields is a list of field names (e.g. "AppProperties") to 722 // unconditionally include in API requests. By default, fields with 723 // empty values are omitted from API requests. However, any non-pointer, 724 // non-interface field appearing in ForceSendFields will be sent to the 725 // server regardless of whether the field is empty or not. This may be 726 // used to include empty fields in Patch requests. 727 ForceSendFields []string `json:"-"` 728 } 729 730 func (s *File) MarshalJSON() ([]byte, error) { 731 type noMethod File 732 raw := noMethod(*s) 733 return gensupport.MarshalJSON(raw, s.ForceSendFields) 734 } 735 736 // FileCapabilities: Capabilities the current user has on the file. 737 type FileCapabilities struct { 738 // CanComment: Whether the user can comment on the file. 739 CanComment bool `json:"canComment,omitempty"` 740 741 // CanCopy: Whether the user can copy the file. 742 CanCopy bool `json:"canCopy,omitempty"` 743 744 // CanEdit: Whether the user can edit the file's content. 745 CanEdit bool `json:"canEdit,omitempty"` 746 747 // CanReadRevisions: Whether the current user has read access to the 748 // Revisions resource of the file. 749 CanReadRevisions bool `json:"canReadRevisions,omitempty"` 750 751 // CanShare: Whether the user can modify the file's permissions and 752 // sharing settings. 753 CanShare bool `json:"canShare,omitempty"` 754 755 // ForceSendFields is a list of field names (e.g. "CanComment") to 756 // unconditionally include in API requests. By default, fields with 757 // empty values are omitted from API requests. However, any non-pointer, 758 // non-interface field appearing in ForceSendFields will be sent to the 759 // server regardless of whether the field is empty or not. This may be 760 // used to include empty fields in Patch requests. 761 ForceSendFields []string `json:"-"` 762 } 763 764 func (s *FileCapabilities) MarshalJSON() ([]byte, error) { 765 type noMethod FileCapabilities 766 raw := noMethod(*s) 767 return gensupport.MarshalJSON(raw, s.ForceSendFields) 768 } 769 770 // FileContentHints: Additional information about the content of the 771 // file. These fields are never populated in responses. 772 type FileContentHints struct { 773 // IndexableText: Text to be indexed for the file to improve fullText 774 // queries. This is limited to 128KB in length and may contain HTML 775 // elements. 776 IndexableText string `json:"indexableText,omitempty"` 777 778 // Thumbnail: A thumbnail for the file. This will only be used if Drive 779 // cannot generate a standard thumbnail. 780 Thumbnail *FileContentHintsThumbnail `json:"thumbnail,omitempty"` 781 782 // ForceSendFields is a list of field names (e.g. "IndexableText") to 783 // unconditionally include in API requests. By default, fields with 784 // empty values are omitted from API requests. However, any non-pointer, 785 // non-interface field appearing in ForceSendFields will be sent to the 786 // server regardless of whether the field is empty or not. This may be 787 // used to include empty fields in Patch requests. 788 ForceSendFields []string `json:"-"` 789 } 790 791 func (s *FileContentHints) MarshalJSON() ([]byte, error) { 792 type noMethod FileContentHints 793 raw := noMethod(*s) 794 return gensupport.MarshalJSON(raw, s.ForceSendFields) 795 } 796 797 // FileContentHintsThumbnail: A thumbnail for the file. This will only 798 // be used if Drive cannot generate a standard thumbnail. 799 type FileContentHintsThumbnail struct { 800 // Image: The thumbnail data encoded with URL-safe Base64 (RFC 4648 801 // section 5). 802 Image string `json:"image,omitempty"` 803 804 // MimeType: The MIME type of the thumbnail. 805 MimeType string `json:"mimeType,omitempty"` 806 807 // ForceSendFields is a list of field names (e.g. "Image") to 808 // unconditionally include in API requests. By default, fields with 809 // empty values are omitted from API requests. However, any non-pointer, 810 // non-interface field appearing in ForceSendFields will be sent to the 811 // server regardless of whether the field is empty or not. This may be 812 // used to include empty fields in Patch requests. 813 ForceSendFields []string `json:"-"` 814 } 815 816 func (s *FileContentHintsThumbnail) MarshalJSON() ([]byte, error) { 817 type noMethod FileContentHintsThumbnail 818 raw := noMethod(*s) 819 return gensupport.MarshalJSON(raw, s.ForceSendFields) 820 } 821 822 // FileImageMediaMetadata: Additional metadata about image media, if 823 // available. 824 type FileImageMediaMetadata struct { 825 // Aperture: The aperture used to create the photo (f-number). 826 Aperture float64 `json:"aperture,omitempty"` 827 828 // CameraMake: The make of the camera used to create the photo. 829 CameraMake string `json:"cameraMake,omitempty"` 830 831 // CameraModel: The model of the camera used to create the photo. 832 CameraModel string `json:"cameraModel,omitempty"` 833 834 // ColorSpace: The color space of the photo. 835 ColorSpace string `json:"colorSpace,omitempty"` 836 837 // ExposureBias: The exposure bias of the photo (APEX value). 838 ExposureBias float64 `json:"exposureBias,omitempty"` 839 840 // ExposureMode: The exposure mode used to create the photo. 841 ExposureMode string `json:"exposureMode,omitempty"` 842 843 // ExposureTime: The length of the exposure, in seconds. 844 ExposureTime float64 `json:"exposureTime,omitempty"` 845 846 // FlashUsed: Whether a flash was used to create the photo. 847 FlashUsed bool `json:"flashUsed,omitempty"` 848 849 // FocalLength: The focal length used to create the photo, in 850 // millimeters. 851 FocalLength float64 `json:"focalLength,omitempty"` 852 853 // Height: The height of the image in pixels. 854 Height int64 `json:"height,omitempty"` 855 856 // IsoSpeed: The ISO speed used to create the photo. 857 IsoSpeed int64 `json:"isoSpeed,omitempty"` 858 859 // Lens: The lens used to create the photo. 860 Lens string `json:"lens,omitempty"` 861 862 // Location: Geographic location information stored in the image. 863 Location *FileImageMediaMetadataLocation `json:"location,omitempty"` 864 865 // MaxApertureValue: The smallest f-number of the lens at the focal 866 // length used to create the photo (APEX value). 867 MaxApertureValue float64 `json:"maxApertureValue,omitempty"` 868 869 // MeteringMode: The metering mode used to create the photo. 870 MeteringMode string `json:"meteringMode,omitempty"` 871 872 // Rotation: The rotation in clockwise degrees from the image's original 873 // orientation. 874 Rotation int64 `json:"rotation,omitempty"` 875 876 // Sensor: The type of sensor used to create the photo. 877 Sensor string `json:"sensor,omitempty"` 878 879 // SubjectDistance: The distance to the subject of the photo, in meters. 880 SubjectDistance int64 `json:"subjectDistance,omitempty"` 881 882 // Time: The date and time the photo was taken (EXIF DateTime). 883 Time string `json:"time,omitempty"` 884 885 // WhiteBalance: The white balance mode used to create the photo. 886 WhiteBalance string `json:"whiteBalance,omitempty"` 887 888 // Width: The width of the image in pixels. 889 Width int64 `json:"width,omitempty"` 890 891 // ForceSendFields is a list of field names (e.g. "Aperture") to 892 // unconditionally include in API requests. By default, fields with 893 // empty values are omitted from API requests. However, any non-pointer, 894 // non-interface field appearing in ForceSendFields will be sent to the 895 // server regardless of whether the field is empty or not. This may be 896 // used to include empty fields in Patch requests. 897 ForceSendFields []string `json:"-"` 898 } 899 900 func (s *FileImageMediaMetadata) MarshalJSON() ([]byte, error) { 901 type noMethod FileImageMediaMetadata 902 raw := noMethod(*s) 903 return gensupport.MarshalJSON(raw, s.ForceSendFields) 904 } 905 906 // FileImageMediaMetadataLocation: Geographic location information 907 // stored in the image. 908 type FileImageMediaMetadataLocation struct { 909 // Altitude: The altitude stored in the image. 910 Altitude float64 `json:"altitude,omitempty"` 911 912 // Latitude: The latitude stored in the image. 913 Latitude float64 `json:"latitude,omitempty"` 914 915 // Longitude: The longitude stored in the image. 916 Longitude float64 `json:"longitude,omitempty"` 917 918 // ForceSendFields is a list of field names (e.g. "Altitude") to 919 // unconditionally include in API requests. By default, fields with 920 // empty values are omitted from API requests. However, any non-pointer, 921 // non-interface field appearing in ForceSendFields will be sent to the 922 // server regardless of whether the field is empty or not. This may be 923 // used to include empty fields in Patch requests. 924 ForceSendFields []string `json:"-"` 925 } 926 927 func (s *FileImageMediaMetadataLocation) MarshalJSON() ([]byte, error) { 928 type noMethod FileImageMediaMetadataLocation 929 raw := noMethod(*s) 930 return gensupport.MarshalJSON(raw, s.ForceSendFields) 931 } 932 933 // FileVideoMediaMetadata: Additional metadata about video media. This 934 // may not be available immediately upon upload. 935 type FileVideoMediaMetadata struct { 936 // DurationMillis: The duration of the video in milliseconds. 937 DurationMillis int64 `json:"durationMillis,omitempty,string"` 938 939 // Height: The height of the video in pixels. 940 Height int64 `json:"height,omitempty"` 941 942 // Width: The width of the video in pixels. 943 Width int64 `json:"width,omitempty"` 944 945 // ForceSendFields is a list of field names (e.g. "DurationMillis") to 946 // unconditionally include in API requests. By default, fields with 947 // empty values are omitted from API requests. However, any non-pointer, 948 // non-interface field appearing in ForceSendFields will be sent to the 949 // server regardless of whether the field is empty or not. This may be 950 // used to include empty fields in Patch requests. 951 ForceSendFields []string `json:"-"` 952 } 953 954 func (s *FileVideoMediaMetadata) MarshalJSON() ([]byte, error) { 955 type noMethod FileVideoMediaMetadata 956 raw := noMethod(*s) 957 return gensupport.MarshalJSON(raw, s.ForceSendFields) 958 } 959 960 // FileList: A list of files. 961 type FileList struct { 962 // Files: The page of files. 963 Files []*File `json:"files,omitempty"` 964 965 // Kind: This is always drive#fileList. 966 Kind string `json:"kind,omitempty"` 967 968 // NextPageToken: The page token for the next page of files. This will 969 // be absent if the end of the files list has been reached. 970 NextPageToken string `json:"nextPageToken,omitempty"` 971 972 // ServerResponse contains the HTTP response code and headers from the 973 // server. 974 googleapi.ServerResponse `json:"-"` 975 976 // ForceSendFields is a list of field names (e.g. "Files") to 977 // unconditionally include in API requests. By default, fields with 978 // empty values are omitted from API requests. However, any non-pointer, 979 // non-interface field appearing in ForceSendFields will be sent to the 980 // server regardless of whether the field is empty or not. This may be 981 // used to include empty fields in Patch requests. 982 ForceSendFields []string `json:"-"` 983 } 984 985 func (s *FileList) MarshalJSON() ([]byte, error) { 986 type noMethod FileList 987 raw := noMethod(*s) 988 return gensupport.MarshalJSON(raw, s.ForceSendFields) 989 } 990 991 // GeneratedIds: A list of generated file IDs which can be provided in 992 // create requests. 993 type GeneratedIds struct { 994 // Ids: The IDs generated for the requesting user in the specified 995 // space. 996 Ids []string `json:"ids,omitempty"` 997 998 // Kind: This is always drive#generatedIds 999 Kind string `json:"kind,omitempty"` 1000 1001 // Space: The type of file that can be created with these IDs. 1002 Space string `json:"space,omitempty"` 1003 1004 // ServerResponse contains the HTTP response code and headers from the 1005 // server. 1006 googleapi.ServerResponse `json:"-"` 1007 1008 // ForceSendFields is a list of field names (e.g. "Ids") to 1009 // unconditionally include in API requests. By default, fields with 1010 // empty values are omitted from API requests. However, any non-pointer, 1011 // non-interface field appearing in ForceSendFields will be sent to the 1012 // server regardless of whether the field is empty or not. This may be 1013 // used to include empty fields in Patch requests. 1014 ForceSendFields []string `json:"-"` 1015 } 1016 1017 func (s *GeneratedIds) MarshalJSON() ([]byte, error) { 1018 type noMethod GeneratedIds 1019 raw := noMethod(*s) 1020 return gensupport.MarshalJSON(raw, s.ForceSendFields) 1021 } 1022 1023 // Permission: A permission for a file. A permission grants a user, 1024 // group, domain or the world access to a file or a folder hierarchy. 1025 type Permission struct { 1026 // AllowFileDiscovery: Whether the permission allows the file to be 1027 // discovered through search. This is only applicable for permissions of 1028 // type domain or anyone. 1029 AllowFileDiscovery bool `json:"allowFileDiscovery,omitempty"` 1030 1031 // DisplayName: A displayable name for users, groups or domains. 1032 DisplayName string `json:"displayName,omitempty"` 1033 1034 // Domain: The domain to which this permission refers. 1035 Domain string `json:"domain,omitempty"` 1036 1037 // EmailAddress: The email address of the user or group to which this 1038 // permission refers. 1039 EmailAddress string `json:"emailAddress,omitempty"` 1040 1041 // Id: The ID of this permission. This is a unique identifier for the 1042 // grantee, and is published in User resources as permissionId. 1043 Id string `json:"id,omitempty"` 1044 1045 // Kind: This is always drive#permission. 1046 Kind string `json:"kind,omitempty"` 1047 1048 // PhotoLink: A link to the user's profile photo, if available. 1049 PhotoLink string `json:"photoLink,omitempty"` 1050 1051 // Role: The role granted by this permission. Valid values are: 1052 // - owner 1053 // - writer 1054 // - commenter 1055 // - reader 1056 Role string `json:"role,omitempty"` 1057 1058 // Type: The type of the grantee. Valid values are: 1059 // - user 1060 // - group 1061 // - domain 1062 // - anyone 1063 Type string `json:"type,omitempty"` 1064 1065 // ServerResponse contains the HTTP response code and headers from the 1066 // server. 1067 googleapi.ServerResponse `json:"-"` 1068 1069 // ForceSendFields is a list of field names (e.g. "AllowFileDiscovery") 1070 // to unconditionally include in API requests. By default, fields with 1071 // empty values are omitted from API requests. However, any non-pointer, 1072 // non-interface field appearing in ForceSendFields will be sent to the 1073 // server regardless of whether the field is empty or not. This may be 1074 // used to include empty fields in Patch requests. 1075 ForceSendFields []string `json:"-"` 1076 } 1077 1078 func (s *Permission) MarshalJSON() ([]byte, error) { 1079 type noMethod Permission 1080 raw := noMethod(*s) 1081 return gensupport.MarshalJSON(raw, s.ForceSendFields) 1082 } 1083 1084 // PermissionList: A list of permissions for a file. 1085 type PermissionList struct { 1086 // Kind: This is always drive#permissionList. 1087 Kind string `json:"kind,omitempty"` 1088 1089 // Permissions: The full list of permissions. 1090 Permissions []*Permission `json:"permissions,omitempty"` 1091 1092 // ServerResponse contains the HTTP response code and headers from the 1093 // server. 1094 googleapi.ServerResponse `json:"-"` 1095 1096 // ForceSendFields is a list of field names (e.g. "Kind") to 1097 // unconditionally include in API requests. By default, fields with 1098 // empty values are omitted from API requests. However, any non-pointer, 1099 // non-interface field appearing in ForceSendFields will be sent to the 1100 // server regardless of whether the field is empty or not. This may be 1101 // used to include empty fields in Patch requests. 1102 ForceSendFields []string `json:"-"` 1103 } 1104 1105 func (s *PermissionList) MarshalJSON() ([]byte, error) { 1106 type noMethod PermissionList 1107 raw := noMethod(*s) 1108 return gensupport.MarshalJSON(raw, s.ForceSendFields) 1109 } 1110 1111 // Reply: A reply to a comment on a file. 1112 type Reply struct { 1113 // Action: The action the reply performed to the parent comment. Valid 1114 // values are: 1115 // - resolve 1116 // - reopen 1117 Action string `json:"action,omitempty"` 1118 1119 // Author: The user who created the reply. 1120 Author *User `json:"author,omitempty"` 1121 1122 // Content: The plain text content of the reply. This field is used for 1123 // setting the content, while htmlContent should be displayed. This is 1124 // required on creates if no action is specified. 1125 Content string `json:"content,omitempty"` 1126 1127 // CreatedTime: The time at which the reply was created (RFC 3339 1128 // date-time). 1129 CreatedTime string `json:"createdTime,omitempty"` 1130 1131 // Deleted: Whether the reply has been deleted. A deleted reply has no 1132 // content. 1133 Deleted bool `json:"deleted,omitempty"` 1134 1135 // HtmlContent: The content of the reply with HTML formatting. 1136 HtmlContent string `json:"htmlContent,omitempty"` 1137 1138 // Id: The ID of the reply. 1139 Id string `json:"id,omitempty"` 1140 1141 // Kind: This is always drive#reply. 1142 Kind string `json:"kind,omitempty"` 1143 1144 // ModifiedTime: The last time the reply was modified (RFC 3339 1145 // date-time). 1146 ModifiedTime string `json:"modifiedTime,omitempty"` 1147 1148 // ServerResponse contains the HTTP response code and headers from the 1149 // server. 1150 googleapi.ServerResponse `json:"-"` 1151 1152 // ForceSendFields is a list of field names (e.g. "Action") to 1153 // unconditionally include in API requests. By default, fields with 1154 // empty values are omitted from API requests. However, any non-pointer, 1155 // non-interface field appearing in ForceSendFields will be sent to the 1156 // server regardless of whether the field is empty or not. This may be 1157 // used to include empty fields in Patch requests. 1158 ForceSendFields []string `json:"-"` 1159 } 1160 1161 func (s *Reply) MarshalJSON() ([]byte, error) { 1162 type noMethod Reply 1163 raw := noMethod(*s) 1164 return gensupport.MarshalJSON(raw, s.ForceSendFields) 1165 } 1166 1167 // ReplyList: A list of replies to a comment on a file. 1168 type ReplyList struct { 1169 // Kind: This is always drive#replyList. 1170 Kind string `json:"kind,omitempty"` 1171 1172 // NextPageToken: The page token for the next page of replies. This will 1173 // be absent if the end of the replies list has been reached. 1174 NextPageToken string `json:"nextPageToken,omitempty"` 1175 1176 // Replies: The page of replies. 1177 Replies []*Reply `json:"replies,omitempty"` 1178 1179 // ServerResponse contains the HTTP response code and headers from the 1180 // server. 1181 googleapi.ServerResponse `json:"-"` 1182 1183 // ForceSendFields is a list of field names (e.g. "Kind") to 1184 // unconditionally include in API requests. By default, fields with 1185 // empty values are omitted from API requests. However, any non-pointer, 1186 // non-interface field appearing in ForceSendFields will be sent to the 1187 // server regardless of whether the field is empty or not. This may be 1188 // used to include empty fields in Patch requests. 1189 ForceSendFields []string `json:"-"` 1190 } 1191 1192 func (s *ReplyList) MarshalJSON() ([]byte, error) { 1193 type noMethod ReplyList 1194 raw := noMethod(*s) 1195 return gensupport.MarshalJSON(raw, s.ForceSendFields) 1196 } 1197 1198 // Revision: The metadata for a revision to a file. 1199 type Revision struct { 1200 // Id: The ID of the revision. 1201 Id string `json:"id,omitempty"` 1202 1203 // KeepForever: Whether to keep this revision forever, even if it is no 1204 // longer the head revision. If not set, the revision will be 1205 // automatically purged 30 days after newer content is uploaded. This 1206 // can be set on a maximum of 200 revisions for a file. 1207 // This field is only applicable to files with binary content in Drive. 1208 KeepForever bool `json:"keepForever,omitempty"` 1209 1210 // Kind: This is always drive#revision. 1211 Kind string `json:"kind,omitempty"` 1212 1213 // LastModifyingUser: The last user to modify this revision. 1214 LastModifyingUser *User `json:"lastModifyingUser,omitempty"` 1215 1216 // Md5Checksum: The MD5 checksum of the revision's content. This is only 1217 // applicable to files with binary content in Drive. 1218 Md5Checksum string `json:"md5Checksum,omitempty"` 1219 1220 // MimeType: The MIME type of the revision. 1221 MimeType string `json:"mimeType,omitempty"` 1222 1223 // ModifiedTime: The last time the revision was modified (RFC 3339 1224 // date-time). 1225 ModifiedTime string `json:"modifiedTime,omitempty"` 1226 1227 // OriginalFilename: The original filename used to create this revision. 1228 // This is only applicable to files with binary content in Drive. 1229 OriginalFilename string `json:"originalFilename,omitempty"` 1230 1231 // PublishAuto: Whether subsequent revisions will be automatically 1232 // republished. This is only applicable to Google Docs. 1233 PublishAuto bool `json:"publishAuto,omitempty"` 1234 1235 // Published: Whether this revision is published. This is only 1236 // applicable to Google Docs. 1237 Published bool `json:"published,omitempty"` 1238 1239 // PublishedOutsideDomain: Whether this revision is published outside 1240 // the domain. This is only applicable to Google Docs. 1241 PublishedOutsideDomain bool `json:"publishedOutsideDomain,omitempty"` 1242 1243 // Size: The size of the revision's content in bytes. This is only 1244 // applicable to files with binary content in Drive. 1245 Size int64 `json:"size,omitempty,string"` 1246 1247 // ServerResponse contains the HTTP response code and headers from the 1248 // server. 1249 googleapi.ServerResponse `json:"-"` 1250 1251 // ForceSendFields is a list of field names (e.g. "Id") to 1252 // unconditionally include in API requests. By default, fields with 1253 // empty values are omitted from API requests. However, any non-pointer, 1254 // non-interface field appearing in ForceSendFields will be sent to the 1255 // server regardless of whether the field is empty or not. This may be 1256 // used to include empty fields in Patch requests. 1257 ForceSendFields []string `json:"-"` 1258 } 1259 1260 func (s *Revision) MarshalJSON() ([]byte, error) { 1261 type noMethod Revision 1262 raw := noMethod(*s) 1263 return gensupport.MarshalJSON(raw, s.ForceSendFields) 1264 } 1265 1266 // RevisionList: A list of revisions of a file. 1267 type RevisionList struct { 1268 // Kind: This is always drive#revisionList. 1269 Kind string `json:"kind,omitempty"` 1270 1271 // Revisions: The full list of revisions. 1272 Revisions []*Revision `json:"revisions,omitempty"` 1273 1274 // ServerResponse contains the HTTP response code and headers from the 1275 // server. 1276 googleapi.ServerResponse `json:"-"` 1277 1278 // ForceSendFields is a list of field names (e.g. "Kind") to 1279 // unconditionally include in API requests. By default, fields with 1280 // empty values are omitted from API requests. However, any non-pointer, 1281 // non-interface field appearing in ForceSendFields will be sent to the 1282 // server regardless of whether the field is empty or not. This may be 1283 // used to include empty fields in Patch requests. 1284 ForceSendFields []string `json:"-"` 1285 } 1286 1287 func (s *RevisionList) MarshalJSON() ([]byte, error) { 1288 type noMethod RevisionList 1289 raw := noMethod(*s) 1290 return gensupport.MarshalJSON(raw, s.ForceSendFields) 1291 } 1292 1293 type StartPageToken struct { 1294 // Kind: This is always drive#startPageToken. 1295 Kind string `json:"kind,omitempty"` 1296 1297 // StartPageToken: The starting page token for listing changes. 1298 StartPageToken string `json:"startPageToken,omitempty"` 1299 1300 // ServerResponse contains the HTTP response code and headers from the 1301 // server. 1302 googleapi.ServerResponse `json:"-"` 1303 1304 // ForceSendFields is a list of field names (e.g. "Kind") to 1305 // unconditionally include in API requests. By default, fields with 1306 // empty values are omitted from API requests. However, any non-pointer, 1307 // non-interface field appearing in ForceSendFields will be sent to the 1308 // server regardless of whether the field is empty or not. This may be 1309 // used to include empty fields in Patch requests. 1310 ForceSendFields []string `json:"-"` 1311 } 1312 1313 func (s *StartPageToken) MarshalJSON() ([]byte, error) { 1314 type noMethod StartPageToken 1315 raw := noMethod(*s) 1316 return gensupport.MarshalJSON(raw, s.ForceSendFields) 1317 } 1318 1319 // User: Information about a Drive user. 1320 type User struct { 1321 // DisplayName: A plain text displayable name for this user. 1322 DisplayName string `json:"displayName,omitempty"` 1323 1324 // EmailAddress: The email address of the user. This may not be present 1325 // in certain contexts if the user has not made their email address 1326 // visible to the requester. 1327 EmailAddress string `json:"emailAddress,omitempty"` 1328 1329 // Kind: This is always drive#user. 1330 Kind string `json:"kind,omitempty"` 1331 1332 // Me: Whether this user is the requesting user. 1333 Me bool `json:"me,omitempty"` 1334 1335 // PermissionId: The user's ID as visible in Permission resources. 1336 PermissionId string `json:"permissionId,omitempty"` 1337 1338 // PhotoLink: A link to the user's profile photo, if available. 1339 PhotoLink string `json:"photoLink,omitempty"` 1340 1341 // ForceSendFields is a list of field names (e.g. "DisplayName") to 1342 // unconditionally include in API requests. By default, fields with 1343 // empty values are omitted from API requests. However, any non-pointer, 1344 // non-interface field appearing in ForceSendFields will be sent to the 1345 // server regardless of whether the field is empty or not. This may be 1346 // used to include empty fields in Patch requests. 1347 ForceSendFields []string `json:"-"` 1348 } 1349 1350 func (s *User) MarshalJSON() ([]byte, error) { 1351 type noMethod User 1352 raw := noMethod(*s) 1353 return gensupport.MarshalJSON(raw, s.ForceSendFields) 1354 } 1355 1356 // method id "drive.about.get": 1357 1358 type AboutGetCall struct { 1359 s *Service 1360 urlParams_ gensupport.URLParams 1361 ifNoneMatch_ string 1362 ctx_ context.Context 1363 } 1364 1365 // Get: Gets information about the user, the user's Drive, and system 1366 // capabilities. 1367 func (r *AboutService) Get() *AboutGetCall { 1368 c := &AboutGetCall{s: r.s, urlParams_: make(gensupport.URLParams)} 1369 return c 1370 } 1371 1372 // Fields allows partial responses to be retrieved. See 1373 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 1374 // for more information. 1375 func (c *AboutGetCall) Fields(s ...googleapi.Field) *AboutGetCall { 1376 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 1377 return c 1378 } 1379 1380 // IfNoneMatch sets the optional parameter which makes the operation 1381 // fail if the object's ETag matches the given value. This is useful for 1382 // getting updates only after the object has changed since the last 1383 // request. Use googleapi.IsNotModified to check whether the response 1384 // error from Do is the result of In-None-Match. 1385 func (c *AboutGetCall) IfNoneMatch(entityTag string) *AboutGetCall { 1386 c.ifNoneMatch_ = entityTag 1387 return c 1388 } 1389 1390 // Context sets the context to be used in this call's Do method. Any 1391 // pending HTTP request will be aborted if the provided context is 1392 // canceled. 1393 func (c *AboutGetCall) Context(ctx context.Context) *AboutGetCall { 1394 c.ctx_ = ctx 1395 return c 1396 } 1397 1398 func (c *AboutGetCall) doRequest(alt string) (*http.Response, error) { 1399 var body io.Reader = nil 1400 c.urlParams_.Set("alt", alt) 1401 urls := googleapi.ResolveRelative(c.s.BasePath, "about") 1402 urls += "?" + c.urlParams_.Encode() 1403 req, _ := http.NewRequest("GET", urls, body) 1404 googleapi.SetOpaque(req.URL) 1405 req.Header.Set("User-Agent", c.s.userAgent()) 1406 if c.ifNoneMatch_ != "" { 1407 req.Header.Set("If-None-Match", c.ifNoneMatch_) 1408 } 1409 if c.ctx_ != nil { 1410 return ctxhttp.Do(c.ctx_, c.s.client, req) 1411 } 1412 return c.s.client.Do(req) 1413 } 1414 1415 // Do executes the "drive.about.get" call. 1416 // Exactly one of *About or error will be non-nil. Any non-2xx status 1417 // code is an error. Response headers are in either 1418 // *About.ServerResponse.Header or (if a response was returned at all) 1419 // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 1420 // check whether the returned error was because http.StatusNotModified 1421 // was returned. 1422 func (c *AboutGetCall) Do(opts ...googleapi.CallOption) (*About, error) { 1423 gensupport.SetOptions(c.urlParams_, opts...) 1424 res, err := c.doRequest("json") 1425 if res != nil && res.StatusCode == http.StatusNotModified { 1426 if res.Body != nil { 1427 res.Body.Close() 1428 } 1429 return nil, &googleapi.Error{ 1430 Code: res.StatusCode, 1431 Header: res.Header, 1432 } 1433 } 1434 if err != nil { 1435 return nil, err 1436 } 1437 defer googleapi.CloseBody(res) 1438 if err := googleapi.CheckResponse(res); err != nil { 1439 return nil, err 1440 } 1441 ret := &About{ 1442 ServerResponse: googleapi.ServerResponse{ 1443 Header: res.Header, 1444 HTTPStatusCode: res.StatusCode, 1445 }, 1446 } 1447 if err := json.NewDecoder(res.Body).Decode(&ret); err != nil { 1448 return nil, err 1449 } 1450 return ret, nil 1451 // { 1452 // "description": "Gets information about the user, the user's Drive, and system capabilities.", 1453 // "httpMethod": "GET", 1454 // "id": "drive.about.get", 1455 // "path": "about", 1456 // "response": { 1457 // "$ref": "About" 1458 // }, 1459 // "scopes": [ 1460 // "https://www.googleapis.com/auth/drive", 1461 // "https://www.googleapis.com/auth/drive.appdata", 1462 // "https://www.googleapis.com/auth/drive.file", 1463 // "https://www.googleapis.com/auth/drive.metadata", 1464 // "https://www.googleapis.com/auth/drive.metadata.readonly", 1465 // "https://www.googleapis.com/auth/drive.photos.readonly", 1466 // "https://www.googleapis.com/auth/drive.readonly" 1467 // ] 1468 // } 1469 1470 } 1471 1472 // method id "drive.changes.getStartPageToken": 1473 1474 type ChangesGetStartPageTokenCall struct { 1475 s *Service 1476 urlParams_ gensupport.URLParams 1477 ifNoneMatch_ string 1478 ctx_ context.Context 1479 } 1480 1481 // GetStartPageToken: Gets the starting pageToken for listing future 1482 // changes. 1483 func (r *ChangesService) GetStartPageToken() *ChangesGetStartPageTokenCall { 1484 c := &ChangesGetStartPageTokenCall{s: r.s, urlParams_: make(gensupport.URLParams)} 1485 return c 1486 } 1487 1488 // Fields allows partial responses to be retrieved. See 1489 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 1490 // for more information. 1491 func (c *ChangesGetStartPageTokenCall) Fields(s ...googleapi.Field) *ChangesGetStartPageTokenCall { 1492 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 1493 return c 1494 } 1495 1496 // IfNoneMatch sets the optional parameter which makes the operation 1497 // fail if the object's ETag matches the given value. This is useful for 1498 // getting updates only after the object has changed since the last 1499 // request. Use googleapi.IsNotModified to check whether the response 1500 // error from Do is the result of In-None-Match. 1501 func (c *ChangesGetStartPageTokenCall) IfNoneMatch(entityTag string) *ChangesGetStartPageTokenCall { 1502 c.ifNoneMatch_ = entityTag 1503 return c 1504 } 1505 1506 // Context sets the context to be used in this call's Do method. Any 1507 // pending HTTP request will be aborted if the provided context is 1508 // canceled. 1509 func (c *ChangesGetStartPageTokenCall) Context(ctx context.Context) *ChangesGetStartPageTokenCall { 1510 c.ctx_ = ctx 1511 return c 1512 } 1513 1514 func (c *ChangesGetStartPageTokenCall) doRequest(alt string) (*http.Response, error) { 1515 var body io.Reader = nil 1516 c.urlParams_.Set("alt", alt) 1517 urls := googleapi.ResolveRelative(c.s.BasePath, "changes/startPageToken") 1518 urls += "?" + c.urlParams_.Encode() 1519 req, _ := http.NewRequest("GET", urls, body) 1520 googleapi.SetOpaque(req.URL) 1521 req.Header.Set("User-Agent", c.s.userAgent()) 1522 if c.ifNoneMatch_ != "" { 1523 req.Header.Set("If-None-Match", c.ifNoneMatch_) 1524 } 1525 if c.ctx_ != nil { 1526 return ctxhttp.Do(c.ctx_, c.s.client, req) 1527 } 1528 return c.s.client.Do(req) 1529 } 1530 1531 // Do executes the "drive.changes.getStartPageToken" call. 1532 // Exactly one of *StartPageToken or error will be non-nil. Any non-2xx 1533 // status code is an error. Response headers are in either 1534 // *StartPageToken.ServerResponse.Header or (if a response was returned 1535 // at all) in error.(*googleapi.Error).Header. Use 1536 // googleapi.IsNotModified to check whether the returned error was 1537 // because http.StatusNotModified was returned. 1538 func (c *ChangesGetStartPageTokenCall) Do(opts ...googleapi.CallOption) (*StartPageToken, error) { 1539 gensupport.SetOptions(c.urlParams_, opts...) 1540 res, err := c.doRequest("json") 1541 if res != nil && res.StatusCode == http.StatusNotModified { 1542 if res.Body != nil { 1543 res.Body.Close() 1544 } 1545 return nil, &googleapi.Error{ 1546 Code: res.StatusCode, 1547 Header: res.Header, 1548 } 1549 } 1550 if err != nil { 1551 return nil, err 1552 } 1553 defer googleapi.CloseBody(res) 1554 if err := googleapi.CheckResponse(res); err != nil { 1555 return nil, err 1556 } 1557 ret := &StartPageToken{ 1558 ServerResponse: googleapi.ServerResponse{ 1559 Header: res.Header, 1560 HTTPStatusCode: res.StatusCode, 1561 }, 1562 } 1563 if err := json.NewDecoder(res.Body).Decode(&ret); err != nil { 1564 return nil, err 1565 } 1566 return ret, nil 1567 // { 1568 // "description": "Gets the starting pageToken for listing future changes.", 1569 // "httpMethod": "GET", 1570 // "id": "drive.changes.getStartPageToken", 1571 // "path": "changes/startPageToken", 1572 // "response": { 1573 // "$ref": "StartPageToken" 1574 // }, 1575 // "scopes": [ 1576 // "https://www.googleapis.com/auth/drive", 1577 // "https://www.googleapis.com/auth/drive.appdata", 1578 // "https://www.googleapis.com/auth/drive.file", 1579 // "https://www.googleapis.com/auth/drive.metadata", 1580 // "https://www.googleapis.com/auth/drive.metadata.readonly", 1581 // "https://www.googleapis.com/auth/drive.photos.readonly", 1582 // "https://www.googleapis.com/auth/drive.readonly" 1583 // ] 1584 // } 1585 1586 } 1587 1588 // method id "drive.changes.list": 1589 1590 type ChangesListCall struct { 1591 s *Service 1592 urlParams_ gensupport.URLParams 1593 ifNoneMatch_ string 1594 ctx_ context.Context 1595 } 1596 1597 // List: Lists changes for a user. 1598 func (r *ChangesService) List(pageToken string) *ChangesListCall { 1599 c := &ChangesListCall{s: r.s, urlParams_: make(gensupport.URLParams)} 1600 c.urlParams_.Set("pageToken", pageToken) 1601 return c 1602 } 1603 1604 // IncludeRemoved sets the optional parameter "includeRemoved": Whether 1605 // to include changes indicating that items have left the view of the 1606 // changes list, for example by deletion or lost access. 1607 func (c *ChangesListCall) IncludeRemoved(includeRemoved bool) *ChangesListCall { 1608 c.urlParams_.Set("includeRemoved", fmt.Sprint(includeRemoved)) 1609 return c 1610 } 1611 1612 // PageSize sets the optional parameter "pageSize": The maximum number 1613 // of changes to return per page. 1614 func (c *ChangesListCall) PageSize(pageSize int64) *ChangesListCall { 1615 c.urlParams_.Set("pageSize", fmt.Sprint(pageSize)) 1616 return c 1617 } 1618 1619 // RestrictToMyDrive sets the optional parameter "restrictToMyDrive": 1620 // Whether to restrict the results to changes inside the My Drive 1621 // hierarchy. This omits changes to files such as those in the 1622 // Application Data folder or shared files which have not been added to 1623 // My Drive. 1624 func (c *ChangesListCall) RestrictToMyDrive(restrictToMyDrive bool) *ChangesListCall { 1625 c.urlParams_.Set("restrictToMyDrive", fmt.Sprint(restrictToMyDrive)) 1626 return c 1627 } 1628 1629 // Spaces sets the optional parameter "spaces": A comma-separated list 1630 // of spaces to query within the user corpus. Supported values are 1631 // 'drive', 'appDataFolder' and 'photos'. 1632 func (c *ChangesListCall) Spaces(spaces string) *ChangesListCall { 1633 c.urlParams_.Set("spaces", spaces) 1634 return c 1635 } 1636 1637 // Fields allows partial responses to be retrieved. See 1638 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 1639 // for more information. 1640 func (c *ChangesListCall) Fields(s ...googleapi.Field) *ChangesListCall { 1641 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 1642 return c 1643 } 1644 1645 // IfNoneMatch sets the optional parameter which makes the operation 1646 // fail if the object's ETag matches the given value. This is useful for 1647 // getting updates only after the object has changed since the last 1648 // request. Use googleapi.IsNotModified to check whether the response 1649 // error from Do is the result of In-None-Match. 1650 func (c *ChangesListCall) IfNoneMatch(entityTag string) *ChangesListCall { 1651 c.ifNoneMatch_ = entityTag 1652 return c 1653 } 1654 1655 // Context sets the context to be used in this call's Do method. Any 1656 // pending HTTP request will be aborted if the provided context is 1657 // canceled. 1658 func (c *ChangesListCall) Context(ctx context.Context) *ChangesListCall { 1659 c.ctx_ = ctx 1660 return c 1661 } 1662 1663 func (c *ChangesListCall) doRequest(alt string) (*http.Response, error) { 1664 var body io.Reader = nil 1665 c.urlParams_.Set("alt", alt) 1666 urls := googleapi.ResolveRelative(c.s.BasePath, "changes") 1667 urls += "?" + c.urlParams_.Encode() 1668 req, _ := http.NewRequest("GET", urls, body) 1669 googleapi.SetOpaque(req.URL) 1670 req.Header.Set("User-Agent", c.s.userAgent()) 1671 if c.ifNoneMatch_ != "" { 1672 req.Header.Set("If-None-Match", c.ifNoneMatch_) 1673 } 1674 if c.ctx_ != nil { 1675 return ctxhttp.Do(c.ctx_, c.s.client, req) 1676 } 1677 return c.s.client.Do(req) 1678 } 1679 1680 // Do executes the "drive.changes.list" call. 1681 // Exactly one of *ChangeList or error will be non-nil. Any non-2xx 1682 // status code is an error. Response headers are in either 1683 // *ChangeList.ServerResponse.Header or (if a response was returned at 1684 // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 1685 // to check whether the returned error was because 1686 // http.StatusNotModified was returned. 1687 func (c *ChangesListCall) Do(opts ...googleapi.CallOption) (*ChangeList, error) { 1688 gensupport.SetOptions(c.urlParams_, opts...) 1689 res, err := c.doRequest("json") 1690 if res != nil && res.StatusCode == http.StatusNotModified { 1691 if res.Body != nil { 1692 res.Body.Close() 1693 } 1694 return nil, &googleapi.Error{ 1695 Code: res.StatusCode, 1696 Header: res.Header, 1697 } 1698 } 1699 if err != nil { 1700 return nil, err 1701 } 1702 defer googleapi.CloseBody(res) 1703 if err := googleapi.CheckResponse(res); err != nil { 1704 return nil, err 1705 } 1706 ret := &ChangeList{ 1707 ServerResponse: googleapi.ServerResponse{ 1708 Header: res.Header, 1709 HTTPStatusCode: res.StatusCode, 1710 }, 1711 } 1712 if err := json.NewDecoder(res.Body).Decode(&ret); err != nil { 1713 return nil, err 1714 } 1715 return ret, nil 1716 // { 1717 // "description": "Lists changes for a user.", 1718 // "httpMethod": "GET", 1719 // "id": "drive.changes.list", 1720 // "parameterOrder": [ 1721 // "pageToken" 1722 // ], 1723 // "parameters": { 1724 // "includeRemoved": { 1725 // "default": "true", 1726 // "description": "Whether to include changes indicating that items have left the view of the changes list, for example by deletion or lost access.", 1727 // "location": "query", 1728 // "type": "boolean" 1729 // }, 1730 // "pageSize": { 1731 // "default": "100", 1732 // "description": "The maximum number of changes to return per page.", 1733 // "format": "int32", 1734 // "location": "query", 1735 // "maximum": "1000", 1736 // "minimum": "1", 1737 // "type": "integer" 1738 // }, 1739 // "pageToken": { 1740 // "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.", 1741 // "location": "query", 1742 // "required": true, 1743 // "type": "string" 1744 // }, 1745 // "restrictToMyDrive": { 1746 // "default": "false", 1747 // "description": "Whether to restrict the results to changes inside the My Drive hierarchy. This omits changes to files such as those in the Application Data folder or shared files which have not been added to My Drive.", 1748 // "location": "query", 1749 // "type": "boolean" 1750 // }, 1751 // "spaces": { 1752 // "default": "drive", 1753 // "description": "A comma-separated list of spaces to query within the user corpus. Supported values are 'drive', 'appDataFolder' and 'photos'.", 1754 // "location": "query", 1755 // "type": "string" 1756 // } 1757 // }, 1758 // "path": "changes", 1759 // "response": { 1760 // "$ref": "ChangeList" 1761 // }, 1762 // "scopes": [ 1763 // "https://www.googleapis.com/auth/drive", 1764 // "https://www.googleapis.com/auth/drive.appdata", 1765 // "https://www.googleapis.com/auth/drive.file", 1766 // "https://www.googleapis.com/auth/drive.metadata", 1767 // "https://www.googleapis.com/auth/drive.metadata.readonly", 1768 // "https://www.googleapis.com/auth/drive.photos.readonly", 1769 // "https://www.googleapis.com/auth/drive.readonly" 1770 // ], 1771 // "supportsSubscription": true 1772 // } 1773 1774 } 1775 1776 // method id "drive.changes.watch": 1777 1778 type ChangesWatchCall struct { 1779 s *Service 1780 channel *Channel 1781 urlParams_ gensupport.URLParams 1782 ctx_ context.Context 1783 } 1784 1785 // Watch: Subscribes to changes for a user. 1786 func (r *ChangesService) Watch(pageToken string, channel *Channel) *ChangesWatchCall { 1787 c := &ChangesWatchCall{s: r.s, urlParams_: make(gensupport.URLParams)} 1788 c.urlParams_.Set("pageToken", pageToken) 1789 c.channel = channel 1790 return c 1791 } 1792 1793 // IncludeRemoved sets the optional parameter "includeRemoved": Whether 1794 // to include changes indicating that items have left the view of the 1795 // changes list, for example by deletion or lost access. 1796 func (c *ChangesWatchCall) IncludeRemoved(includeRemoved bool) *ChangesWatchCall { 1797 c.urlParams_.Set("includeRemoved", fmt.Sprint(includeRemoved)) 1798 return c 1799 } 1800 1801 // PageSize sets the optional parameter "pageSize": The maximum number 1802 // of changes to return per page. 1803 func (c *ChangesWatchCall) PageSize(pageSize int64) *ChangesWatchCall { 1804 c.urlParams_.Set("pageSize", fmt.Sprint(pageSize)) 1805 return c 1806 } 1807 1808 // RestrictToMyDrive sets the optional parameter "restrictToMyDrive": 1809 // Whether to restrict the results to changes inside the My Drive 1810 // hierarchy. This omits changes to files such as those in the 1811 // Application Data folder or shared files which have not been added to 1812 // My Drive. 1813 func (c *ChangesWatchCall) RestrictToMyDrive(restrictToMyDrive bool) *ChangesWatchCall { 1814 c.urlParams_.Set("restrictToMyDrive", fmt.Sprint(restrictToMyDrive)) 1815 return c 1816 } 1817 1818 // Spaces sets the optional parameter "spaces": A comma-separated list 1819 // of spaces to query within the user corpus. Supported values are 1820 // 'drive', 'appDataFolder' and 'photos'. 1821 func (c *ChangesWatchCall) Spaces(spaces string) *ChangesWatchCall { 1822 c.urlParams_.Set("spaces", spaces) 1823 return c 1824 } 1825 1826 // Fields allows partial responses to be retrieved. See 1827 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 1828 // for more information. 1829 func (c *ChangesWatchCall) Fields(s ...googleapi.Field) *ChangesWatchCall { 1830 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 1831 return c 1832 } 1833 1834 // Context sets the context to be used in this call's Do method. Any 1835 // pending HTTP request will be aborted if the provided context is 1836 // canceled. 1837 func (c *ChangesWatchCall) Context(ctx context.Context) *ChangesWatchCall { 1838 c.ctx_ = ctx 1839 return c 1840 } 1841 1842 func (c *ChangesWatchCall) doRequest(alt string) (*http.Response, error) { 1843 var body io.Reader = nil 1844 body, err := googleapi.WithoutDataWrapper.JSONReader(c.channel) 1845 if err != nil { 1846 return nil, err 1847 } 1848 ctype := "application/json" 1849 c.urlParams_.Set("alt", alt) 1850 urls := googleapi.ResolveRelative(c.s.BasePath, "changes/watch") 1851 urls += "?" + c.urlParams_.Encode() 1852 req, _ := http.NewRequest("POST", urls, body) 1853 googleapi.SetOpaque(req.URL) 1854 req.Header.Set("Content-Type", ctype) 1855 req.Header.Set("User-Agent", c.s.userAgent()) 1856 if c.ctx_ != nil { 1857 return ctxhttp.Do(c.ctx_, c.s.client, req) 1858 } 1859 return c.s.client.Do(req) 1860 } 1861 1862 // Do executes the "drive.changes.watch" call. 1863 // Exactly one of *Channel or error will be non-nil. Any non-2xx status 1864 // code is an error. Response headers are in either 1865 // *Channel.ServerResponse.Header or (if a response was returned at all) 1866 // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 1867 // check whether the returned error was because http.StatusNotModified 1868 // was returned. 1869 func (c *ChangesWatchCall) Do(opts ...googleapi.CallOption) (*Channel, error) { 1870 gensupport.SetOptions(c.urlParams_, opts...) 1871 res, err := c.doRequest("json") 1872 if res != nil && res.StatusCode == http.StatusNotModified { 1873 if res.Body != nil { 1874 res.Body.Close() 1875 } 1876 return nil, &googleapi.Error{ 1877 Code: res.StatusCode, 1878 Header: res.Header, 1879 } 1880 } 1881 if err != nil { 1882 return nil, err 1883 } 1884 defer googleapi.CloseBody(res) 1885 if err := googleapi.CheckResponse(res); err != nil { 1886 return nil, err 1887 } 1888 ret := &Channel{ 1889 ServerResponse: googleapi.ServerResponse{ 1890 Header: res.Header, 1891 HTTPStatusCode: res.StatusCode, 1892 }, 1893 } 1894 if err := json.NewDecoder(res.Body).Decode(&ret); err != nil { 1895 return nil, err 1896 } 1897 return ret, nil 1898 // { 1899 // "description": "Subscribes to changes for a user.", 1900 // "httpMethod": "POST", 1901 // "id": "drive.changes.watch", 1902 // "parameterOrder": [ 1903 // "pageToken" 1904 // ], 1905 // "parameters": { 1906 // "includeRemoved": { 1907 // "default": "true", 1908 // "description": "Whether to include changes indicating that items have left the view of the changes list, for example by deletion or lost access.", 1909 // "location": "query", 1910 // "type": "boolean" 1911 // }, 1912 // "pageSize": { 1913 // "default": "100", 1914 // "description": "The maximum number of changes to return per page.", 1915 // "format": "int32", 1916 // "location": "query", 1917 // "maximum": "1000", 1918 // "minimum": "1", 1919 // "type": "integer" 1920 // }, 1921 // "pageToken": { 1922 // "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.", 1923 // "location": "query", 1924 // "required": true, 1925 // "type": "string" 1926 // }, 1927 // "restrictToMyDrive": { 1928 // "default": "false", 1929 // "description": "Whether to restrict the results to changes inside the My Drive hierarchy. This omits changes to files such as those in the Application Data folder or shared files which have not been added to My Drive.", 1930 // "location": "query", 1931 // "type": "boolean" 1932 // }, 1933 // "spaces": { 1934 // "default": "drive", 1935 // "description": "A comma-separated list of spaces to query within the user corpus. Supported values are 'drive', 'appDataFolder' and 'photos'.", 1936 // "location": "query", 1937 // "type": "string" 1938 // } 1939 // }, 1940 // "path": "changes/watch", 1941 // "request": { 1942 // "$ref": "Channel", 1943 // "parameterName": "resource" 1944 // }, 1945 // "response": { 1946 // "$ref": "Channel" 1947 // }, 1948 // "scopes": [ 1949 // "https://www.googleapis.com/auth/drive", 1950 // "https://www.googleapis.com/auth/drive.appdata", 1951 // "https://www.googleapis.com/auth/drive.file", 1952 // "https://www.googleapis.com/auth/drive.metadata", 1953 // "https://www.googleapis.com/auth/drive.metadata.readonly", 1954 // "https://www.googleapis.com/auth/drive.photos.readonly", 1955 // "https://www.googleapis.com/auth/drive.readonly" 1956 // ], 1957 // "supportsSubscription": true 1958 // } 1959 1960 } 1961 1962 // method id "drive.channels.stop": 1963 1964 type ChannelsStopCall struct { 1965 s *Service 1966 channel *Channel 1967 urlParams_ gensupport.URLParams 1968 ctx_ context.Context 1969 } 1970 1971 // Stop: Stop watching resources through this channel 1972 func (r *ChannelsService) Stop(channel *Channel) *ChannelsStopCall { 1973 c := &ChannelsStopCall{s: r.s, urlParams_: make(gensupport.URLParams)} 1974 c.channel = channel 1975 return c 1976 } 1977 1978 // Fields allows partial responses to be retrieved. See 1979 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 1980 // for more information. 1981 func (c *ChannelsStopCall) Fields(s ...googleapi.Field) *ChannelsStopCall { 1982 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 1983 return c 1984 } 1985 1986 // Context sets the context to be used in this call's Do method. Any 1987 // pending HTTP request will be aborted if the provided context is 1988 // canceled. 1989 func (c *ChannelsStopCall) Context(ctx context.Context) *ChannelsStopCall { 1990 c.ctx_ = ctx 1991 return c 1992 } 1993 1994 func (c *ChannelsStopCall) doRequest(alt string) (*http.Response, error) { 1995 var body io.Reader = nil 1996 body, err := googleapi.WithoutDataWrapper.JSONReader(c.channel) 1997 if err != nil { 1998 return nil, err 1999 } 2000 ctype := "application/json" 2001 c.urlParams_.Set("alt", alt) 2002 urls := googleapi.ResolveRelative(c.s.BasePath, "channels/stop") 2003 urls += "?" + c.urlParams_.Encode() 2004 req, _ := http.NewRequest("POST", urls, body) 2005 googleapi.SetOpaque(req.URL) 2006 req.Header.Set("Content-Type", ctype) 2007 req.Header.Set("User-Agent", c.s.userAgent()) 2008 if c.ctx_ != nil { 2009 return ctxhttp.Do(c.ctx_, c.s.client, req) 2010 } 2011 return c.s.client.Do(req) 2012 } 2013 2014 // Do executes the "drive.channels.stop" call. 2015 func (c *ChannelsStopCall) Do(opts ...googleapi.CallOption) error { 2016 gensupport.SetOptions(c.urlParams_, opts...) 2017 res, err := c.doRequest("json") 2018 if err != nil { 2019 return err 2020 } 2021 defer googleapi.CloseBody(res) 2022 if err := googleapi.CheckResponse(res); err != nil { 2023 return err 2024 } 2025 return nil 2026 // { 2027 // "description": "Stop watching resources through this channel", 2028 // "httpMethod": "POST", 2029 // "id": "drive.channels.stop", 2030 // "path": "channels/stop", 2031 // "request": { 2032 // "$ref": "Channel", 2033 // "parameterName": "resource" 2034 // }, 2035 // "scopes": [ 2036 // "https://www.googleapis.com/auth/drive", 2037 // "https://www.googleapis.com/auth/drive.appdata", 2038 // "https://www.googleapis.com/auth/drive.file", 2039 // "https://www.googleapis.com/auth/drive.metadata", 2040 // "https://www.googleapis.com/auth/drive.metadata.readonly", 2041 // "https://www.googleapis.com/auth/drive.photos.readonly", 2042 // "https://www.googleapis.com/auth/drive.readonly" 2043 // ] 2044 // } 2045 2046 } 2047 2048 // method id "drive.comments.create": 2049 2050 type CommentsCreateCall struct { 2051 s *Service 2052 fileId string 2053 comment *Comment 2054 urlParams_ gensupport.URLParams 2055 ctx_ context.Context 2056 } 2057 2058 // Create: Creates a new comment on a file. 2059 func (r *CommentsService) Create(fileId string, comment *Comment) *CommentsCreateCall { 2060 c := &CommentsCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)} 2061 c.fileId = fileId 2062 c.comment = comment 2063 return c 2064 } 2065 2066 // Fields allows partial responses to be retrieved. See 2067 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 2068 // for more information. 2069 func (c *CommentsCreateCall) Fields(s ...googleapi.Field) *CommentsCreateCall { 2070 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 2071 return c 2072 } 2073 2074 // Context sets the context to be used in this call's Do method. Any 2075 // pending HTTP request will be aborted if the provided context is 2076 // canceled. 2077 func (c *CommentsCreateCall) Context(ctx context.Context) *CommentsCreateCall { 2078 c.ctx_ = ctx 2079 return c 2080 } 2081 2082 func (c *CommentsCreateCall) doRequest(alt string) (*http.Response, error) { 2083 var body io.Reader = nil 2084 body, err := googleapi.WithoutDataWrapper.JSONReader(c.comment) 2085 if err != nil { 2086 return nil, err 2087 } 2088 ctype := "application/json" 2089 c.urlParams_.Set("alt", alt) 2090 urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/comments") 2091 urls += "?" + c.urlParams_.Encode() 2092 req, _ := http.NewRequest("POST", urls, body) 2093 googleapi.Expand(req.URL, map[string]string{ 2094 "fileId": c.fileId, 2095 }) 2096 req.Header.Set("Content-Type", ctype) 2097 req.Header.Set("User-Agent", c.s.userAgent()) 2098 if c.ctx_ != nil { 2099 return ctxhttp.Do(c.ctx_, c.s.client, req) 2100 } 2101 return c.s.client.Do(req) 2102 } 2103 2104 // Do executes the "drive.comments.create" call. 2105 // Exactly one of *Comment or error will be non-nil. Any non-2xx status 2106 // code is an error. Response headers are in either 2107 // *Comment.ServerResponse.Header or (if a response was returned at all) 2108 // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 2109 // check whether the returned error was because http.StatusNotModified 2110 // was returned. 2111 func (c *CommentsCreateCall) Do(opts ...googleapi.CallOption) (*Comment, error) { 2112 gensupport.SetOptions(c.urlParams_, opts...) 2113 res, err := c.doRequest("json") 2114 if res != nil && res.StatusCode == http.StatusNotModified { 2115 if res.Body != nil { 2116 res.Body.Close() 2117 } 2118 return nil, &googleapi.Error{ 2119 Code: res.StatusCode, 2120 Header: res.Header, 2121 } 2122 } 2123 if err != nil { 2124 return nil, err 2125 } 2126 defer googleapi.CloseBody(res) 2127 if err := googleapi.CheckResponse(res); err != nil { 2128 return nil, err 2129 } 2130 ret := &Comment{ 2131 ServerResponse: googleapi.ServerResponse{ 2132 Header: res.Header, 2133 HTTPStatusCode: res.StatusCode, 2134 }, 2135 } 2136 if err := json.NewDecoder(res.Body).Decode(&ret); err != nil { 2137 return nil, err 2138 } 2139 return ret, nil 2140 // { 2141 // "description": "Creates a new comment on a file.", 2142 // "httpMethod": "POST", 2143 // "id": "drive.comments.create", 2144 // "parameterOrder": [ 2145 // "fileId" 2146 // ], 2147 // "parameters": { 2148 // "fileId": { 2149 // "description": "The ID of the file.", 2150 // "location": "path", 2151 // "required": true, 2152 // "type": "string" 2153 // } 2154 // }, 2155 // "path": "files/{fileId}/comments", 2156 // "request": { 2157 // "$ref": "Comment" 2158 // }, 2159 // "response": { 2160 // "$ref": "Comment" 2161 // }, 2162 // "scopes": [ 2163 // "https://www.googleapis.com/auth/drive", 2164 // "https://www.googleapis.com/auth/drive.file" 2165 // ] 2166 // } 2167 2168 } 2169 2170 // method id "drive.comments.delete": 2171 2172 type CommentsDeleteCall struct { 2173 s *Service 2174 fileId string 2175 commentId string 2176 urlParams_ gensupport.URLParams 2177 ctx_ context.Context 2178 } 2179 2180 // Delete: Deletes a comment. 2181 func (r *CommentsService) Delete(fileId string, commentId string) *CommentsDeleteCall { 2182 c := &CommentsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)} 2183 c.fileId = fileId 2184 c.commentId = commentId 2185 return c 2186 } 2187 2188 // Fields allows partial responses to be retrieved. See 2189 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 2190 // for more information. 2191 func (c *CommentsDeleteCall) Fields(s ...googleapi.Field) *CommentsDeleteCall { 2192 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 2193 return c 2194 } 2195 2196 // Context sets the context to be used in this call's Do method. Any 2197 // pending HTTP request will be aborted if the provided context is 2198 // canceled. 2199 func (c *CommentsDeleteCall) Context(ctx context.Context) *CommentsDeleteCall { 2200 c.ctx_ = ctx 2201 return c 2202 } 2203 2204 func (c *CommentsDeleteCall) doRequest(alt string) (*http.Response, error) { 2205 var body io.Reader = nil 2206 c.urlParams_.Set("alt", alt) 2207 urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/comments/{commentId}") 2208 urls += "?" + c.urlParams_.Encode() 2209 req, _ := http.NewRequest("DELETE", urls, body) 2210 googleapi.Expand(req.URL, map[string]string{ 2211 "fileId": c.fileId, 2212 "commentId": c.commentId, 2213 }) 2214 req.Header.Set("User-Agent", c.s.userAgent()) 2215 if c.ctx_ != nil { 2216 return ctxhttp.Do(c.ctx_, c.s.client, req) 2217 } 2218 return c.s.client.Do(req) 2219 } 2220 2221 // Do executes the "drive.comments.delete" call. 2222 func (c *CommentsDeleteCall) Do(opts ...googleapi.CallOption) error { 2223 gensupport.SetOptions(c.urlParams_, opts...) 2224 res, err := c.doRequest("json") 2225 if err != nil { 2226 return err 2227 } 2228 defer googleapi.CloseBody(res) 2229 if err := googleapi.CheckResponse(res); err != nil { 2230 return err 2231 } 2232 return nil 2233 // { 2234 // "description": "Deletes a comment.", 2235 // "httpMethod": "DELETE", 2236 // "id": "drive.comments.delete", 2237 // "parameterOrder": [ 2238 // "fileId", 2239 // "commentId" 2240 // ], 2241 // "parameters": { 2242 // "commentId": { 2243 // "description": "The ID of the comment.", 2244 // "location": "path", 2245 // "required": true, 2246 // "type": "string" 2247 // }, 2248 // "fileId": { 2249 // "description": "The ID of the file.", 2250 // "location": "path", 2251 // "required": true, 2252 // "type": "string" 2253 // } 2254 // }, 2255 // "path": "files/{fileId}/comments/{commentId}", 2256 // "scopes": [ 2257 // "https://www.googleapis.com/auth/drive", 2258 // "https://www.googleapis.com/auth/drive.file" 2259 // ] 2260 // } 2261 2262 } 2263 2264 // method id "drive.comments.get": 2265 2266 type CommentsGetCall struct { 2267 s *Service 2268 fileId string 2269 commentId string 2270 urlParams_ gensupport.URLParams 2271 ifNoneMatch_ string 2272 ctx_ context.Context 2273 } 2274 2275 // Get: Gets a comment by ID. 2276 func (r *CommentsService) Get(fileId string, commentId string) *CommentsGetCall { 2277 c := &CommentsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)} 2278 c.fileId = fileId 2279 c.commentId = commentId 2280 return c 2281 } 2282 2283 // IncludeDeleted sets the optional parameter "includeDeleted": Whether 2284 // to return deleted comments. Deleted comments will not include their 2285 // original content. 2286 func (c *CommentsGetCall) IncludeDeleted(includeDeleted bool) *CommentsGetCall { 2287 c.urlParams_.Set("includeDeleted", fmt.Sprint(includeDeleted)) 2288 return c 2289 } 2290 2291 // Fields allows partial responses to be retrieved. See 2292 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 2293 // for more information. 2294 func (c *CommentsGetCall) Fields(s ...googleapi.Field) *CommentsGetCall { 2295 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 2296 return c 2297 } 2298 2299 // IfNoneMatch sets the optional parameter which makes the operation 2300 // fail if the object's ETag matches the given value. This is useful for 2301 // getting updates only after the object has changed since the last 2302 // request. Use googleapi.IsNotModified to check whether the response 2303 // error from Do is the result of In-None-Match. 2304 func (c *CommentsGetCall) IfNoneMatch(entityTag string) *CommentsGetCall { 2305 c.ifNoneMatch_ = entityTag 2306 return c 2307 } 2308 2309 // Context sets the context to be used in this call's Do method. Any 2310 // pending HTTP request will be aborted if the provided context is 2311 // canceled. 2312 func (c *CommentsGetCall) Context(ctx context.Context) *CommentsGetCall { 2313 c.ctx_ = ctx 2314 return c 2315 } 2316 2317 func (c *CommentsGetCall) doRequest(alt string) (*http.Response, error) { 2318 var body io.Reader = nil 2319 c.urlParams_.Set("alt", alt) 2320 urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/comments/{commentId}") 2321 urls += "?" + c.urlParams_.Encode() 2322 req, _ := http.NewRequest("GET", urls, body) 2323 googleapi.Expand(req.URL, map[string]string{ 2324 "fileId": c.fileId, 2325 "commentId": c.commentId, 2326 }) 2327 req.Header.Set("User-Agent", c.s.userAgent()) 2328 if c.ifNoneMatch_ != "" { 2329 req.Header.Set("If-None-Match", c.ifNoneMatch_) 2330 } 2331 if c.ctx_ != nil { 2332 return ctxhttp.Do(c.ctx_, c.s.client, req) 2333 } 2334 return c.s.client.Do(req) 2335 } 2336 2337 // Do executes the "drive.comments.get" call. 2338 // Exactly one of *Comment or error will be non-nil. Any non-2xx status 2339 // code is an error. Response headers are in either 2340 // *Comment.ServerResponse.Header or (if a response was returned at all) 2341 // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 2342 // check whether the returned error was because http.StatusNotModified 2343 // was returned. 2344 func (c *CommentsGetCall) Do(opts ...googleapi.CallOption) (*Comment, error) { 2345 gensupport.SetOptions(c.urlParams_, opts...) 2346 res, err := c.doRequest("json") 2347 if res != nil && res.StatusCode == http.StatusNotModified { 2348 if res.Body != nil { 2349 res.Body.Close() 2350 } 2351 return nil, &googleapi.Error{ 2352 Code: res.StatusCode, 2353 Header: res.Header, 2354 } 2355 } 2356 if err != nil { 2357 return nil, err 2358 } 2359 defer googleapi.CloseBody(res) 2360 if err := googleapi.CheckResponse(res); err != nil { 2361 return nil, err 2362 } 2363 ret := &Comment{ 2364 ServerResponse: googleapi.ServerResponse{ 2365 Header: res.Header, 2366 HTTPStatusCode: res.StatusCode, 2367 }, 2368 } 2369 if err := json.NewDecoder(res.Body).Decode(&ret); err != nil { 2370 return nil, err 2371 } 2372 return ret, nil 2373 // { 2374 // "description": "Gets a comment by ID.", 2375 // "httpMethod": "GET", 2376 // "id": "drive.comments.get", 2377 // "parameterOrder": [ 2378 // "fileId", 2379 // "commentId" 2380 // ], 2381 // "parameters": { 2382 // "commentId": { 2383 // "description": "The ID of the comment.", 2384 // "location": "path", 2385 // "required": true, 2386 // "type": "string" 2387 // }, 2388 // "fileId": { 2389 // "description": "The ID of the file.", 2390 // "location": "path", 2391 // "required": true, 2392 // "type": "string" 2393 // }, 2394 // "includeDeleted": { 2395 // "default": "false", 2396 // "description": "Whether to return deleted comments. Deleted comments will not include their original content.", 2397 // "location": "query", 2398 // "type": "boolean" 2399 // } 2400 // }, 2401 // "path": "files/{fileId}/comments/{commentId}", 2402 // "response": { 2403 // "$ref": "Comment" 2404 // }, 2405 // "scopes": [ 2406 // "https://www.googleapis.com/auth/drive", 2407 // "https://www.googleapis.com/auth/drive.file", 2408 // "https://www.googleapis.com/auth/drive.readonly" 2409 // ] 2410 // } 2411 2412 } 2413 2414 // method id "drive.comments.list": 2415 2416 type CommentsListCall struct { 2417 s *Service 2418 fileId string 2419 urlParams_ gensupport.URLParams 2420 ifNoneMatch_ string 2421 ctx_ context.Context 2422 } 2423 2424 // List: Lists a file's comments. 2425 func (r *CommentsService) List(fileId string) *CommentsListCall { 2426 c := &CommentsListCall{s: r.s, urlParams_: make(gensupport.URLParams)} 2427 c.fileId = fileId 2428 return c 2429 } 2430 2431 // IncludeDeleted sets the optional parameter "includeDeleted": Whether 2432 // to include deleted comments. Deleted comments will not include their 2433 // original content. 2434 func (c *CommentsListCall) IncludeDeleted(includeDeleted bool) *CommentsListCall { 2435 c.urlParams_.Set("includeDeleted", fmt.Sprint(includeDeleted)) 2436 return c 2437 } 2438 2439 // PageSize sets the optional parameter "pageSize": The maximum number 2440 // of comments to return per page. 2441 func (c *CommentsListCall) PageSize(pageSize int64) *CommentsListCall { 2442 c.urlParams_.Set("pageSize", fmt.Sprint(pageSize)) 2443 return c 2444 } 2445 2446 // PageToken sets the optional parameter "pageToken": The token for 2447 // continuing a previous list request on the next page. This should be 2448 // set to the value of 'nextPageToken' from the previous response. 2449 func (c *CommentsListCall) PageToken(pageToken string) *CommentsListCall { 2450 c.urlParams_.Set("pageToken", pageToken) 2451 return c 2452 } 2453 2454 // StartModifiedTime sets the optional parameter "startModifiedTime": 2455 // The minimum value of 'modifiedTime' for the result comments (RFC 3339 2456 // date-time). 2457 func (c *CommentsListCall) StartModifiedTime(startModifiedTime string) *CommentsListCall { 2458 c.urlParams_.Set("startModifiedTime", startModifiedTime) 2459 return c 2460 } 2461 2462 // Fields allows partial responses to be retrieved. See 2463 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 2464 // for more information. 2465 func (c *CommentsListCall) Fields(s ...googleapi.Field) *CommentsListCall { 2466 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 2467 return c 2468 } 2469 2470 // IfNoneMatch sets the optional parameter which makes the operation 2471 // fail if the object's ETag matches the given value. This is useful for 2472 // getting updates only after the object has changed since the last 2473 // request. Use googleapi.IsNotModified to check whether the response 2474 // error from Do is the result of In-None-Match. 2475 func (c *CommentsListCall) IfNoneMatch(entityTag string) *CommentsListCall { 2476 c.ifNoneMatch_ = entityTag 2477 return c 2478 } 2479 2480 // Context sets the context to be used in this call's Do method. Any 2481 // pending HTTP request will be aborted if the provided context is 2482 // canceled. 2483 func (c *CommentsListCall) Context(ctx context.Context) *CommentsListCall { 2484 c.ctx_ = ctx 2485 return c 2486 } 2487 2488 func (c *CommentsListCall) doRequest(alt string) (*http.Response, error) { 2489 var body io.Reader = nil 2490 c.urlParams_.Set("alt", alt) 2491 urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/comments") 2492 urls += "?" + c.urlParams_.Encode() 2493 req, _ := http.NewRequest("GET", urls, body) 2494 googleapi.Expand(req.URL, map[string]string{ 2495 "fileId": c.fileId, 2496 }) 2497 req.Header.Set("User-Agent", c.s.userAgent()) 2498 if c.ifNoneMatch_ != "" { 2499 req.Header.Set("If-None-Match", c.ifNoneMatch_) 2500 } 2501 if c.ctx_ != nil { 2502 return ctxhttp.Do(c.ctx_, c.s.client, req) 2503 } 2504 return c.s.client.Do(req) 2505 } 2506 2507 // Do executes the "drive.comments.list" call. 2508 // Exactly one of *CommentList or error will be non-nil. Any non-2xx 2509 // status code is an error. Response headers are in either 2510 // *CommentList.ServerResponse.Header or (if a response was returned at 2511 // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 2512 // to check whether the returned error was because 2513 // http.StatusNotModified was returned. 2514 func (c *CommentsListCall) Do(opts ...googleapi.CallOption) (*CommentList, error) { 2515 gensupport.SetOptions(c.urlParams_, opts...) 2516 res, err := c.doRequest("json") 2517 if res != nil && res.StatusCode == http.StatusNotModified { 2518 if res.Body != nil { 2519 res.Body.Close() 2520 } 2521 return nil, &googleapi.Error{ 2522 Code: res.StatusCode, 2523 Header: res.Header, 2524 } 2525 } 2526 if err != nil { 2527 return nil, err 2528 } 2529 defer googleapi.CloseBody(res) 2530 if err := googleapi.CheckResponse(res); err != nil { 2531 return nil, err 2532 } 2533 ret := &CommentList{ 2534 ServerResponse: googleapi.ServerResponse{ 2535 Header: res.Header, 2536 HTTPStatusCode: res.StatusCode, 2537 }, 2538 } 2539 if err := json.NewDecoder(res.Body).Decode(&ret); err != nil { 2540 return nil, err 2541 } 2542 return ret, nil 2543 // { 2544 // "description": "Lists a file's comments.", 2545 // "httpMethod": "GET", 2546 // "id": "drive.comments.list", 2547 // "parameterOrder": [ 2548 // "fileId" 2549 // ], 2550 // "parameters": { 2551 // "fileId": { 2552 // "description": "The ID of the file.", 2553 // "location": "path", 2554 // "required": true, 2555 // "type": "string" 2556 // }, 2557 // "includeDeleted": { 2558 // "default": "false", 2559 // "description": "Whether to include deleted comments. Deleted comments will not include their original content.", 2560 // "location": "query", 2561 // "type": "boolean" 2562 // }, 2563 // "pageSize": { 2564 // "default": "20", 2565 // "description": "The maximum number of comments to return per page.", 2566 // "format": "int32", 2567 // "location": "query", 2568 // "maximum": "100", 2569 // "minimum": "1", 2570 // "type": "integer" 2571 // }, 2572 // "pageToken": { 2573 // "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.", 2574 // "location": "query", 2575 // "type": "string" 2576 // }, 2577 // "startModifiedTime": { 2578 // "description": "The minimum value of 'modifiedTime' for the result comments (RFC 3339 date-time).", 2579 // "location": "query", 2580 // "type": "string" 2581 // } 2582 // }, 2583 // "path": "files/{fileId}/comments", 2584 // "response": { 2585 // "$ref": "CommentList" 2586 // }, 2587 // "scopes": [ 2588 // "https://www.googleapis.com/auth/drive", 2589 // "https://www.googleapis.com/auth/drive.file", 2590 // "https://www.googleapis.com/auth/drive.readonly" 2591 // ] 2592 // } 2593 2594 } 2595 2596 // Pages invokes f for each page of results. 2597 // A non-nil error returned from f will halt the iteration. 2598 // The provided context supersedes any context provided to the Context method. 2599 func (c *CommentsListCall) Pages(ctx context.Context, f func(*CommentList) error) error { 2600 c.ctx_ = ctx 2601 defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point 2602 for { 2603 x, err := c.Do() 2604 if err != nil { 2605 return err 2606 } 2607 if err := f(x); err != nil { 2608 return err 2609 } 2610 if x.NextPageToken == "" { 2611 return nil 2612 } 2613 c.PageToken(x.NextPageToken) 2614 } 2615 } 2616 2617 // method id "drive.comments.update": 2618 2619 type CommentsUpdateCall struct { 2620 s *Service 2621 fileId string 2622 commentId string 2623 comment *Comment 2624 urlParams_ gensupport.URLParams 2625 ctx_ context.Context 2626 } 2627 2628 // Update: Updates a comment with patch semantics. 2629 func (r *CommentsService) Update(fileId string, commentId string, comment *Comment) *CommentsUpdateCall { 2630 c := &CommentsUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)} 2631 c.fileId = fileId 2632 c.commentId = commentId 2633 c.comment = comment 2634 return c 2635 } 2636 2637 // Fields allows partial responses to be retrieved. See 2638 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 2639 // for more information. 2640 func (c *CommentsUpdateCall) Fields(s ...googleapi.Field) *CommentsUpdateCall { 2641 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 2642 return c 2643 } 2644 2645 // Context sets the context to be used in this call's Do method. Any 2646 // pending HTTP request will be aborted if the provided context is 2647 // canceled. 2648 func (c *CommentsUpdateCall) Context(ctx context.Context) *CommentsUpdateCall { 2649 c.ctx_ = ctx 2650 return c 2651 } 2652 2653 func (c *CommentsUpdateCall) doRequest(alt string) (*http.Response, error) { 2654 var body io.Reader = nil 2655 body, err := googleapi.WithoutDataWrapper.JSONReader(c.comment) 2656 if err != nil { 2657 return nil, err 2658 } 2659 ctype := "application/json" 2660 c.urlParams_.Set("alt", alt) 2661 urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/comments/{commentId}") 2662 urls += "?" + c.urlParams_.Encode() 2663 req, _ := http.NewRequest("PATCH", urls, body) 2664 googleapi.Expand(req.URL, map[string]string{ 2665 "fileId": c.fileId, 2666 "commentId": c.commentId, 2667 }) 2668 req.Header.Set("Content-Type", ctype) 2669 req.Header.Set("User-Agent", c.s.userAgent()) 2670 if c.ctx_ != nil { 2671 return ctxhttp.Do(c.ctx_, c.s.client, req) 2672 } 2673 return c.s.client.Do(req) 2674 } 2675 2676 // Do executes the "drive.comments.update" call. 2677 // Exactly one of *Comment or error will be non-nil. Any non-2xx status 2678 // code is an error. Response headers are in either 2679 // *Comment.ServerResponse.Header or (if a response was returned at all) 2680 // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 2681 // check whether the returned error was because http.StatusNotModified 2682 // was returned. 2683 func (c *CommentsUpdateCall) Do(opts ...googleapi.CallOption) (*Comment, error) { 2684 gensupport.SetOptions(c.urlParams_, opts...) 2685 res, err := c.doRequest("json") 2686 if res != nil && res.StatusCode == http.StatusNotModified { 2687 if res.Body != nil { 2688 res.Body.Close() 2689 } 2690 return nil, &googleapi.Error{ 2691 Code: res.StatusCode, 2692 Header: res.Header, 2693 } 2694 } 2695 if err != nil { 2696 return nil, err 2697 } 2698 defer googleapi.CloseBody(res) 2699 if err := googleapi.CheckResponse(res); err != nil { 2700 return nil, err 2701 } 2702 ret := &Comment{ 2703 ServerResponse: googleapi.ServerResponse{ 2704 Header: res.Header, 2705 HTTPStatusCode: res.StatusCode, 2706 }, 2707 } 2708 if err := json.NewDecoder(res.Body).Decode(&ret); err != nil { 2709 return nil, err 2710 } 2711 return ret, nil 2712 // { 2713 // "description": "Updates a comment with patch semantics.", 2714 // "httpMethod": "PATCH", 2715 // "id": "drive.comments.update", 2716 // "parameterOrder": [ 2717 // "fileId", 2718 // "commentId" 2719 // ], 2720 // "parameters": { 2721 // "commentId": { 2722 // "description": "The ID of the comment.", 2723 // "location": "path", 2724 // "required": true, 2725 // "type": "string" 2726 // }, 2727 // "fileId": { 2728 // "description": "The ID of the file.", 2729 // "location": "path", 2730 // "required": true, 2731 // "type": "string" 2732 // } 2733 // }, 2734 // "path": "files/{fileId}/comments/{commentId}", 2735 // "request": { 2736 // "$ref": "Comment" 2737 // }, 2738 // "response": { 2739 // "$ref": "Comment" 2740 // }, 2741 // "scopes": [ 2742 // "https://www.googleapis.com/auth/drive", 2743 // "https://www.googleapis.com/auth/drive.file" 2744 // ] 2745 // } 2746 2747 } 2748 2749 // method id "drive.files.copy": 2750 2751 type FilesCopyCall struct { 2752 s *Service 2753 fileId string 2754 file *File 2755 urlParams_ gensupport.URLParams 2756 ctx_ context.Context 2757 } 2758 2759 // Copy: Creates a copy of a file and applies any requested updates with 2760 // patch semantics. 2761 func (r *FilesService) Copy(fileId string, file *File) *FilesCopyCall { 2762 c := &FilesCopyCall{s: r.s, urlParams_: make(gensupport.URLParams)} 2763 c.fileId = fileId 2764 c.file = file 2765 return c 2766 } 2767 2768 // IgnoreDefaultVisibility sets the optional parameter 2769 // "ignoreDefaultVisibility": Whether to ignore the domain's default 2770 // visibility settings for the created file. Domain administrators can 2771 // choose to make all uploaded files visible to the domain by default; 2772 // this parameter bypasses that behavior for the request. Permissions 2773 // are still inherited from parent folders. 2774 func (c *FilesCopyCall) IgnoreDefaultVisibility(ignoreDefaultVisibility bool) *FilesCopyCall { 2775 c.urlParams_.Set("ignoreDefaultVisibility", fmt.Sprint(ignoreDefaultVisibility)) 2776 return c 2777 } 2778 2779 // KeepRevisionForever sets the optional parameter 2780 // "keepRevisionForever": Whether to set the 'keepForever' field in the 2781 // new head revision. This is only applicable to files with binary 2782 // content in Drive. 2783 func (c *FilesCopyCall) KeepRevisionForever(keepRevisionForever bool) *FilesCopyCall { 2784 c.urlParams_.Set("keepRevisionForever", fmt.Sprint(keepRevisionForever)) 2785 return c 2786 } 2787 2788 // OcrLanguage sets the optional parameter "ocrLanguage": A language 2789 // hint for OCR processing during image import (ISO 639-1 code). 2790 func (c *FilesCopyCall) OcrLanguage(ocrLanguage string) *FilesCopyCall { 2791 c.urlParams_.Set("ocrLanguage", ocrLanguage) 2792 return c 2793 } 2794 2795 // Fields allows partial responses to be retrieved. See 2796 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 2797 // for more information. 2798 func (c *FilesCopyCall) Fields(s ...googleapi.Field) *FilesCopyCall { 2799 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 2800 return c 2801 } 2802 2803 // Context sets the context to be used in this call's Do method. Any 2804 // pending HTTP request will be aborted if the provided context is 2805 // canceled. 2806 func (c *FilesCopyCall) Context(ctx context.Context) *FilesCopyCall { 2807 c.ctx_ = ctx 2808 return c 2809 } 2810 2811 func (c *FilesCopyCall) doRequest(alt string) (*http.Response, error) { 2812 var body io.Reader = nil 2813 body, err := googleapi.WithoutDataWrapper.JSONReader(c.file) 2814 if err != nil { 2815 return nil, err 2816 } 2817 ctype := "application/json" 2818 c.urlParams_.Set("alt", alt) 2819 urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/copy") 2820 urls += "?" + c.urlParams_.Encode() 2821 req, _ := http.NewRequest("POST", urls, body) 2822 googleapi.Expand(req.URL, map[string]string{ 2823 "fileId": c.fileId, 2824 }) 2825 req.Header.Set("Content-Type", ctype) 2826 req.Header.Set("User-Agent", c.s.userAgent()) 2827 if c.ctx_ != nil { 2828 return ctxhttp.Do(c.ctx_, c.s.client, req) 2829 } 2830 return c.s.client.Do(req) 2831 } 2832 2833 // Do executes the "drive.files.copy" call. 2834 // Exactly one of *File or error will be non-nil. Any non-2xx status 2835 // code is an error. Response headers are in either 2836 // *File.ServerResponse.Header or (if a response was returned at all) in 2837 // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check 2838 // whether the returned error was because http.StatusNotModified was 2839 // returned. 2840 func (c *FilesCopyCall) Do(opts ...googleapi.CallOption) (*File, error) { 2841 gensupport.SetOptions(c.urlParams_, opts...) 2842 res, err := c.doRequest("json") 2843 if res != nil && res.StatusCode == http.StatusNotModified { 2844 if res.Body != nil { 2845 res.Body.Close() 2846 } 2847 return nil, &googleapi.Error{ 2848 Code: res.StatusCode, 2849 Header: res.Header, 2850 } 2851 } 2852 if err != nil { 2853 return nil, err 2854 } 2855 defer googleapi.CloseBody(res) 2856 if err := googleapi.CheckResponse(res); err != nil { 2857 return nil, err 2858 } 2859 ret := &File{ 2860 ServerResponse: googleapi.ServerResponse{ 2861 Header: res.Header, 2862 HTTPStatusCode: res.StatusCode, 2863 }, 2864 } 2865 if err := json.NewDecoder(res.Body).Decode(&ret); err != nil { 2866 return nil, err 2867 } 2868 return ret, nil 2869 // { 2870 // "description": "Creates a copy of a file and applies any requested updates with patch semantics.", 2871 // "httpMethod": "POST", 2872 // "id": "drive.files.copy", 2873 // "parameterOrder": [ 2874 // "fileId" 2875 // ], 2876 // "parameters": { 2877 // "fileId": { 2878 // "description": "The ID of the file.", 2879 // "location": "path", 2880 // "required": true, 2881 // "type": "string" 2882 // }, 2883 // "ignoreDefaultVisibility": { 2884 // "default": "false", 2885 // "description": "Whether to ignore the domain's default visibility settings for the created file. Domain administrators can choose to make all uploaded files visible to the domain by default; this parameter bypasses that behavior for the request. Permissions are still inherited from parent folders.", 2886 // "location": "query", 2887 // "type": "boolean" 2888 // }, 2889 // "keepRevisionForever": { 2890 // "default": "false", 2891 // "description": "Whether to set the 'keepForever' field in the new head revision. This is only applicable to files with binary content in Drive.", 2892 // "location": "query", 2893 // "type": "boolean" 2894 // }, 2895 // "ocrLanguage": { 2896 // "description": "A language hint for OCR processing during image import (ISO 639-1 code).", 2897 // "location": "query", 2898 // "type": "string" 2899 // } 2900 // }, 2901 // "path": "files/{fileId}/copy", 2902 // "request": { 2903 // "$ref": "File" 2904 // }, 2905 // "response": { 2906 // "$ref": "File" 2907 // }, 2908 // "scopes": [ 2909 // "https://www.googleapis.com/auth/drive", 2910 // "https://www.googleapis.com/auth/drive.appdata", 2911 // "https://www.googleapis.com/auth/drive.file", 2912 // "https://www.googleapis.com/auth/drive.photos.readonly" 2913 // ] 2914 // } 2915 2916 } 2917 2918 // method id "drive.files.create": 2919 2920 type FilesCreateCall struct { 2921 s *Service 2922 file *File 2923 urlParams_ gensupport.URLParams 2924 media_ io.Reader 2925 resumableBuffer_ *gensupport.ResumableBuffer 2926 mediaType_ string 2927 mediaSize_ int64 // mediaSize, if known. Used only for calls to progressUpdater_. 2928 progressUpdater_ googleapi.ProgressUpdater 2929 ctx_ context.Context 2930 } 2931 2932 // Create: Creates a new file. 2933 func (r *FilesService) Create(file *File) *FilesCreateCall { 2934 c := &FilesCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)} 2935 c.file = file 2936 return c 2937 } 2938 2939 // IgnoreDefaultVisibility sets the optional parameter 2940 // "ignoreDefaultVisibility": Whether to ignore the domain's default 2941 // visibility settings for the created file. Domain administrators can 2942 // choose to make all uploaded files visible to the domain by default; 2943 // this parameter bypasses that behavior for the request. Permissions 2944 // are still inherited from parent folders. 2945 func (c *FilesCreateCall) IgnoreDefaultVisibility(ignoreDefaultVisibility bool) *FilesCreateCall { 2946 c.urlParams_.Set("ignoreDefaultVisibility", fmt.Sprint(ignoreDefaultVisibility)) 2947 return c 2948 } 2949 2950 // KeepRevisionForever sets the optional parameter 2951 // "keepRevisionForever": Whether to set the 'keepForever' field in the 2952 // new head revision. This is only applicable to files with binary 2953 // content in Drive. 2954 func (c *FilesCreateCall) KeepRevisionForever(keepRevisionForever bool) *FilesCreateCall { 2955 c.urlParams_.Set("keepRevisionForever", fmt.Sprint(keepRevisionForever)) 2956 return c 2957 } 2958 2959 // OcrLanguage sets the optional parameter "ocrLanguage": A language 2960 // hint for OCR processing during image import (ISO 639-1 code). 2961 func (c *FilesCreateCall) OcrLanguage(ocrLanguage string) *FilesCreateCall { 2962 c.urlParams_.Set("ocrLanguage", ocrLanguage) 2963 return c 2964 } 2965 2966 // UseContentAsIndexableText sets the optional parameter 2967 // "useContentAsIndexableText": Whether to use the uploaded content as 2968 // indexable text. 2969 func (c *FilesCreateCall) UseContentAsIndexableText(useContentAsIndexableText bool) *FilesCreateCall { 2970 c.urlParams_.Set("useContentAsIndexableText", fmt.Sprint(useContentAsIndexableText)) 2971 return c 2972 } 2973 2974 // Media specifies the media to upload in one or more chunks. The chunk 2975 // size may be controlled by supplying a MediaOption generated by 2976 // googleapi.ChunkSize. The chunk size defaults to 2977 // googleapi.DefaultUploadChunkSize.The Content-Type header used in the 2978 // upload request will be determined by sniffing the contents of r, 2979 // unless a MediaOption generated by googleapi.ContentType is 2980 // supplied. 2981 // At most one of Media and ResumableMedia may be set. 2982 func (c *FilesCreateCall) Media(r io.Reader, options ...googleapi.MediaOption) *FilesCreateCall { 2983 opts := googleapi.ProcessMediaOptions(options) 2984 chunkSize := opts.ChunkSize 2985 if !opts.ForceEmptyContentType { 2986 r, c.mediaType_ = gensupport.DetermineContentType(r, opts.ContentType) 2987 } 2988 c.media_, c.resumableBuffer_ = gensupport.PrepareUpload(r, chunkSize) 2989 return c 2990 } 2991 2992 // ResumableMedia specifies the media to upload in chunks and can be 2993 // canceled with ctx. 2994 // 2995 // Deprecated: use Media instead. 2996 // 2997 // At most one of Media and ResumableMedia may be set. mediaType 2998 // identifies the MIME media type of the upload, such as "image/png". If 2999 // mediaType is "", it will be auto-detected. The provided ctx will 3000 // supersede any context previously provided to the Context method. 3001 func (c *FilesCreateCall) ResumableMedia(ctx context.Context, r io.ReaderAt, size int64, mediaType string) *FilesCreateCall { 3002 c.ctx_ = ctx 3003 rdr := gensupport.ReaderAtToReader(r, size) 3004 rdr, c.mediaType_ = gensupport.DetermineContentType(rdr, mediaType) 3005 c.resumableBuffer_ = gensupport.NewResumableBuffer(rdr, googleapi.DefaultUploadChunkSize) 3006 c.media_ = nil 3007 c.mediaSize_ = size 3008 return c 3009 } 3010 3011 // ProgressUpdater provides a callback function that will be called 3012 // after every chunk. It should be a low-latency function in order to 3013 // not slow down the upload operation. This should only be called when 3014 // using ResumableMedia (as opposed to Media). 3015 func (c *FilesCreateCall) ProgressUpdater(pu googleapi.ProgressUpdater) *FilesCreateCall { 3016 c.progressUpdater_ = pu 3017 return c 3018 } 3019 3020 // Fields allows partial responses to be retrieved. See 3021 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 3022 // for more information. 3023 func (c *FilesCreateCall) Fields(s ...googleapi.Field) *FilesCreateCall { 3024 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 3025 return c 3026 } 3027 3028 // Context sets the context to be used in this call's Do method. Any 3029 // pending HTTP request will be aborted if the provided context is 3030 // canceled. 3031 // This context will supersede any context previously provided to the 3032 // ResumableMedia method. 3033 func (c *FilesCreateCall) Context(ctx context.Context) *FilesCreateCall { 3034 c.ctx_ = ctx 3035 return c 3036 } 3037 3038 func (c *FilesCreateCall) doRequest(alt string) (*http.Response, error) { 3039 var body io.Reader = nil 3040 body, err := googleapi.WithoutDataWrapper.JSONReader(c.file) 3041 if err != nil { 3042 return nil, err 3043 } 3044 ctype := "application/json" 3045 c.urlParams_.Set("alt", alt) 3046 urls := googleapi.ResolveRelative(c.s.BasePath, "files") 3047 if c.media_ != nil || c.resumableBuffer_ != nil { 3048 urls = strings.Replace(urls, "https://www.googleapis.com/", "https://www.googleapis.com/upload/", 1) 3049 protocol := "multipart" 3050 if c.resumableBuffer_ != nil { 3051 protocol = "resumable" 3052 } 3053 c.urlParams_.Set("uploadType", protocol) 3054 } 3055 urls += "?" + c.urlParams_.Encode() 3056 if c.media_ != nil { 3057 var combined io.ReadCloser 3058 combined, ctype = gensupport.CombineBodyMedia(body, ctype, c.media_, c.mediaType_) 3059 defer combined.Close() 3060 body = combined 3061 } 3062 req, _ := http.NewRequest("POST", urls, body) 3063 googleapi.SetOpaque(req.URL) 3064 if c.resumableBuffer_ != nil && c.mediaType_ != "" { 3065 req.Header.Set("X-Upload-Content-Type", c.mediaType_) 3066 } 3067 req.Header.Set("Content-Type", ctype) 3068 req.Header.Set("User-Agent", c.s.userAgent()) 3069 if c.ctx_ != nil { 3070 return ctxhttp.Do(c.ctx_, c.s.client, req) 3071 } 3072 return c.s.client.Do(req) 3073 } 3074 3075 // Do executes the "drive.files.create" call. 3076 // Exactly one of *File or error will be non-nil. Any non-2xx status 3077 // code is an error. Response headers are in either 3078 // *File.ServerResponse.Header or (if a response was returned at all) in 3079 // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check 3080 // whether the returned error was because http.StatusNotModified was 3081 // returned. 3082 func (c *FilesCreateCall) Do(opts ...googleapi.CallOption) (*File, error) { 3083 gensupport.SetOptions(c.urlParams_, opts...) 3084 res, err := c.doRequest("json") 3085 if res != nil && res.StatusCode == http.StatusNotModified { 3086 if res.Body != nil { 3087 res.Body.Close() 3088 } 3089 return nil, &googleapi.Error{ 3090 Code: res.StatusCode, 3091 Header: res.Header, 3092 } 3093 } 3094 if err != nil { 3095 return nil, err 3096 } 3097 defer googleapi.CloseBody(res) 3098 if err := googleapi.CheckResponse(res); err != nil { 3099 return nil, err 3100 } 3101 if c.resumableBuffer_ != nil { 3102 loc := res.Header.Get("Location") 3103 rx := &gensupport.ResumableUpload{ 3104 Client: c.s.client, 3105 UserAgent: c.s.userAgent(), 3106 URI: loc, 3107 Media: c.resumableBuffer_, 3108 MediaType: c.mediaType_, 3109 Callback: func(curr int64) { 3110 if c.progressUpdater_ != nil { 3111 c.progressUpdater_(curr, c.mediaSize_) 3112 } 3113 }, 3114 } 3115 ctx := c.ctx_ 3116 if ctx == nil { 3117 ctx = context.TODO() 3118 } 3119 res, err = rx.Upload(ctx) 3120 if err != nil { 3121 return nil, err 3122 } 3123 defer res.Body.Close() 3124 if err := googleapi.CheckResponse(res); err != nil { 3125 return nil, err 3126 } 3127 } 3128 ret := &File{ 3129 ServerResponse: googleapi.ServerResponse{ 3130 Header: res.Header, 3131 HTTPStatusCode: res.StatusCode, 3132 }, 3133 } 3134 if err := json.NewDecoder(res.Body).Decode(&ret); err != nil { 3135 return nil, err 3136 } 3137 return ret, nil 3138 // { 3139 // "description": "Creates a new file.", 3140 // "httpMethod": "POST", 3141 // "id": "drive.files.create", 3142 // "mediaUpload": { 3143 // "accept": [ 3144 // "*/*" 3145 // ], 3146 // "maxSize": "5120GB", 3147 // "protocols": { 3148 // "resumable": { 3149 // "multipart": true, 3150 // "path": "/resumable/upload/drive/v3/files" 3151 // }, 3152 // "simple": { 3153 // "multipart": true, 3154 // "path": "/upload/drive/v3/files" 3155 // } 3156 // } 3157 // }, 3158 // "parameters": { 3159 // "ignoreDefaultVisibility": { 3160 // "default": "false", 3161 // "description": "Whether to ignore the domain's default visibility settings for the created file. Domain administrators can choose to make all uploaded files visible to the domain by default; this parameter bypasses that behavior for the request. Permissions are still inherited from parent folders.", 3162 // "location": "query", 3163 // "type": "boolean" 3164 // }, 3165 // "keepRevisionForever": { 3166 // "default": "false", 3167 // "description": "Whether to set the 'keepForever' field in the new head revision. This is only applicable to files with binary content in Drive.", 3168 // "location": "query", 3169 // "type": "boolean" 3170 // }, 3171 // "ocrLanguage": { 3172 // "description": "A language hint for OCR processing during image import (ISO 639-1 code).", 3173 // "location": "query", 3174 // "type": "string" 3175 // }, 3176 // "useContentAsIndexableText": { 3177 // "default": "false", 3178 // "description": "Whether to use the uploaded content as indexable text.", 3179 // "location": "query", 3180 // "type": "boolean" 3181 // } 3182 // }, 3183 // "path": "files", 3184 // "request": { 3185 // "$ref": "File" 3186 // }, 3187 // "response": { 3188 // "$ref": "File" 3189 // }, 3190 // "scopes": [ 3191 // "https://www.googleapis.com/auth/drive", 3192 // "https://www.googleapis.com/auth/drive.appdata", 3193 // "https://www.googleapis.com/auth/drive.file" 3194 // ], 3195 // "supportsMediaUpload": true, 3196 // "supportsSubscription": true 3197 // } 3198 3199 } 3200 3201 // method id "drive.files.delete": 3202 3203 type FilesDeleteCall struct { 3204 s *Service 3205 fileId string 3206 urlParams_ gensupport.URLParams 3207 ctx_ context.Context 3208 } 3209 3210 // Delete: Permanently deletes a file owned by the user without moving 3211 // it to the trash. If the target is a folder, all descendants owned by 3212 // the user are also deleted. 3213 func (r *FilesService) Delete(fileId string) *FilesDeleteCall { 3214 c := &FilesDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)} 3215 c.fileId = fileId 3216 return c 3217 } 3218 3219 // Fields allows partial responses to be retrieved. See 3220 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 3221 // for more information. 3222 func (c *FilesDeleteCall) Fields(s ...googleapi.Field) *FilesDeleteCall { 3223 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 3224 return c 3225 } 3226 3227 // Context sets the context to be used in this call's Do method. Any 3228 // pending HTTP request will be aborted if the provided context is 3229 // canceled. 3230 func (c *FilesDeleteCall) Context(ctx context.Context) *FilesDeleteCall { 3231 c.ctx_ = ctx 3232 return c 3233 } 3234 3235 func (c *FilesDeleteCall) doRequest(alt string) (*http.Response, error) { 3236 var body io.Reader = nil 3237 c.urlParams_.Set("alt", alt) 3238 urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}") 3239 urls += "?" + c.urlParams_.Encode() 3240 req, _ := http.NewRequest("DELETE", urls, body) 3241 googleapi.Expand(req.URL, map[string]string{ 3242 "fileId": c.fileId, 3243 }) 3244 req.Header.Set("User-Agent", c.s.userAgent()) 3245 if c.ctx_ != nil { 3246 return ctxhttp.Do(c.ctx_, c.s.client, req) 3247 } 3248 return c.s.client.Do(req) 3249 } 3250 3251 // Do executes the "drive.files.delete" call. 3252 func (c *FilesDeleteCall) Do(opts ...googleapi.CallOption) error { 3253 gensupport.SetOptions(c.urlParams_, opts...) 3254 res, err := c.doRequest("json") 3255 if err != nil { 3256 return err 3257 } 3258 defer googleapi.CloseBody(res) 3259 if err := googleapi.CheckResponse(res); err != nil { 3260 return err 3261 } 3262 return nil 3263 // { 3264 // "description": "Permanently deletes a file owned by the user without moving it to the trash. If the target is a folder, all descendants owned by the user are also deleted.", 3265 // "httpMethod": "DELETE", 3266 // "id": "drive.files.delete", 3267 // "parameterOrder": [ 3268 // "fileId" 3269 // ], 3270 // "parameters": { 3271 // "fileId": { 3272 // "description": "The ID of the file.", 3273 // "location": "path", 3274 // "required": true, 3275 // "type": "string" 3276 // } 3277 // }, 3278 // "path": "files/{fileId}", 3279 // "scopes": [ 3280 // "https://www.googleapis.com/auth/drive", 3281 // "https://www.googleapis.com/auth/drive.appdata", 3282 // "https://www.googleapis.com/auth/drive.file" 3283 // ] 3284 // } 3285 3286 } 3287 3288 // method id "drive.files.emptyTrash": 3289 3290 type FilesEmptyTrashCall struct { 3291 s *Service 3292 urlParams_ gensupport.URLParams 3293 ctx_ context.Context 3294 } 3295 3296 // EmptyTrash: Permanently deletes all of the user's trashed files. 3297 func (r *FilesService) EmptyTrash() *FilesEmptyTrashCall { 3298 c := &FilesEmptyTrashCall{s: r.s, urlParams_: make(gensupport.URLParams)} 3299 return c 3300 } 3301 3302 // Fields allows partial responses to be retrieved. See 3303 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 3304 // for more information. 3305 func (c *FilesEmptyTrashCall) Fields(s ...googleapi.Field) *FilesEmptyTrashCall { 3306 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 3307 return c 3308 } 3309 3310 // Context sets the context to be used in this call's Do method. Any 3311 // pending HTTP request will be aborted if the provided context is 3312 // canceled. 3313 func (c *FilesEmptyTrashCall) Context(ctx context.Context) *FilesEmptyTrashCall { 3314 c.ctx_ = ctx 3315 return c 3316 } 3317 3318 func (c *FilesEmptyTrashCall) doRequest(alt string) (*http.Response, error) { 3319 var body io.Reader = nil 3320 c.urlParams_.Set("alt", alt) 3321 urls := googleapi.ResolveRelative(c.s.BasePath, "files/trash") 3322 urls += "?" + c.urlParams_.Encode() 3323 req, _ := http.NewRequest("DELETE", urls, body) 3324 googleapi.SetOpaque(req.URL) 3325 req.Header.Set("User-Agent", c.s.userAgent()) 3326 if c.ctx_ != nil { 3327 return ctxhttp.Do(c.ctx_, c.s.client, req) 3328 } 3329 return c.s.client.Do(req) 3330 } 3331 3332 // Do executes the "drive.files.emptyTrash" call. 3333 func (c *FilesEmptyTrashCall) Do(opts ...googleapi.CallOption) error { 3334 gensupport.SetOptions(c.urlParams_, opts...) 3335 res, err := c.doRequest("json") 3336 if err != nil { 3337 return err 3338 } 3339 defer googleapi.CloseBody(res) 3340 if err := googleapi.CheckResponse(res); err != nil { 3341 return err 3342 } 3343 return nil 3344 // { 3345 // "description": "Permanently deletes all of the user's trashed files.", 3346 // "httpMethod": "DELETE", 3347 // "id": "drive.files.emptyTrash", 3348 // "path": "files/trash", 3349 // "scopes": [ 3350 // "https://www.googleapis.com/auth/drive" 3351 // ] 3352 // } 3353 3354 } 3355 3356 // method id "drive.files.export": 3357 3358 type FilesExportCall struct { 3359 s *Service 3360 fileId string 3361 urlParams_ gensupport.URLParams 3362 ifNoneMatch_ string 3363 ctx_ context.Context 3364 } 3365 3366 // Export: Exports a Google Doc to the requested MIME type and returns 3367 // the exported content. 3368 func (r *FilesService) Export(fileId string, mimeType string) *FilesExportCall { 3369 c := &FilesExportCall{s: r.s, urlParams_: make(gensupport.URLParams)} 3370 c.fileId = fileId 3371 c.urlParams_.Set("mimeType", mimeType) 3372 return c 3373 } 3374 3375 // Fields allows partial responses to be retrieved. See 3376 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 3377 // for more information. 3378 func (c *FilesExportCall) Fields(s ...googleapi.Field) *FilesExportCall { 3379 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 3380 return c 3381 } 3382 3383 // IfNoneMatch sets the optional parameter which makes the operation 3384 // fail if the object's ETag matches the given value. This is useful for 3385 // getting updates only after the object has changed since the last 3386 // request. Use googleapi.IsNotModified to check whether the response 3387 // error from Do is the result of In-None-Match. 3388 func (c *FilesExportCall) IfNoneMatch(entityTag string) *FilesExportCall { 3389 c.ifNoneMatch_ = entityTag 3390 return c 3391 } 3392 3393 // Context sets the context to be used in this call's Do and Download 3394 // methods. Any pending HTTP request will be aborted if the provided 3395 // context is canceled. 3396 func (c *FilesExportCall) Context(ctx context.Context) *FilesExportCall { 3397 c.ctx_ = ctx 3398 return c 3399 } 3400 3401 func (c *FilesExportCall) doRequest(alt string) (*http.Response, error) { 3402 var body io.Reader = nil 3403 c.urlParams_.Set("alt", alt) 3404 urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/export") 3405 urls += "?" + c.urlParams_.Encode() 3406 req, _ := http.NewRequest("GET", urls, body) 3407 googleapi.Expand(req.URL, map[string]string{ 3408 "fileId": c.fileId, 3409 }) 3410 req.Header.Set("User-Agent", c.s.userAgent()) 3411 if c.ifNoneMatch_ != "" { 3412 req.Header.Set("If-None-Match", c.ifNoneMatch_) 3413 } 3414 if c.ctx_ != nil { 3415 return ctxhttp.Do(c.ctx_, c.s.client, req) 3416 } 3417 return c.s.client.Do(req) 3418 } 3419 3420 // Download fetches the API endpoint's "media" value, instead of the normal 3421 // API response value. If the returned error is nil, the Response is guaranteed to 3422 // have a 2xx status code. Callers must close the Response.Body as usual. 3423 func (c *FilesExportCall) Download(opts ...googleapi.CallOption) (*http.Response, error) { 3424 gensupport.SetOptions(c.urlParams_, opts...) 3425 res, err := c.doRequest("media") 3426 if err != nil { 3427 return nil, err 3428 } 3429 if err := googleapi.CheckMediaResponse(res); err != nil { 3430 res.Body.Close() 3431 return nil, err 3432 } 3433 return res, nil 3434 } 3435 3436 // Do executes the "drive.files.export" call. 3437 func (c *FilesExportCall) Do(opts ...googleapi.CallOption) error { 3438 gensupport.SetOptions(c.urlParams_, opts...) 3439 res, err := c.doRequest("json") 3440 if err != nil { 3441 return err 3442 } 3443 defer googleapi.CloseBody(res) 3444 if err := googleapi.CheckResponse(res); err != nil { 3445 return err 3446 } 3447 return nil 3448 // { 3449 // "description": "Exports a Google Doc to the requested MIME type and returns the exported content.", 3450 // "httpMethod": "GET", 3451 // "id": "drive.files.export", 3452 // "parameterOrder": [ 3453 // "fileId", 3454 // "mimeType" 3455 // ], 3456 // "parameters": { 3457 // "fileId": { 3458 // "description": "The ID of the file.", 3459 // "location": "path", 3460 // "required": true, 3461 // "type": "string" 3462 // }, 3463 // "mimeType": { 3464 // "description": "The MIME type of the format requested for this export.", 3465 // "location": "query", 3466 // "required": true, 3467 // "type": "string" 3468 // } 3469 // }, 3470 // "path": "files/{fileId}/export", 3471 // "scopes": [ 3472 // "https://www.googleapis.com/auth/drive", 3473 // "https://www.googleapis.com/auth/drive.file", 3474 // "https://www.googleapis.com/auth/drive.readonly" 3475 // ], 3476 // "supportsMediaDownload": true 3477 // } 3478 3479 } 3480 3481 // method id "drive.files.generateIds": 3482 3483 type FilesGenerateIdsCall struct { 3484 s *Service 3485 urlParams_ gensupport.URLParams 3486 ifNoneMatch_ string 3487 ctx_ context.Context 3488 } 3489 3490 // GenerateIds: Generates a set of file IDs which can be provided in 3491 // create requests. 3492 func (r *FilesService) GenerateIds() *FilesGenerateIdsCall { 3493 c := &FilesGenerateIdsCall{s: r.s, urlParams_: make(gensupport.URLParams)} 3494 return c 3495 } 3496 3497 // Count sets the optional parameter "count": The number of IDs to 3498 // return. 3499 func (c *FilesGenerateIdsCall) Count(count int64) *FilesGenerateIdsCall { 3500 c.urlParams_.Set("count", fmt.Sprint(count)) 3501 return c 3502 } 3503 3504 // Space sets the optional parameter "space": The space in which the IDs 3505 // can be used to create new files. Supported values are 'drive' and 3506 // 'appDataFolder'. 3507 func (c *FilesGenerateIdsCall) Space(space string) *FilesGenerateIdsCall { 3508 c.urlParams_.Set("space", space) 3509 return c 3510 } 3511 3512 // Fields allows partial responses to be retrieved. See 3513 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 3514 // for more information. 3515 func (c *FilesGenerateIdsCall) Fields(s ...googleapi.Field) *FilesGenerateIdsCall { 3516 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 3517 return c 3518 } 3519 3520 // IfNoneMatch sets the optional parameter which makes the operation 3521 // fail if the object's ETag matches the given value. This is useful for 3522 // getting updates only after the object has changed since the last 3523 // request. Use googleapi.IsNotModified to check whether the response 3524 // error from Do is the result of In-None-Match. 3525 func (c *FilesGenerateIdsCall) IfNoneMatch(entityTag string) *FilesGenerateIdsCall { 3526 c.ifNoneMatch_ = entityTag 3527 return c 3528 } 3529 3530 // Context sets the context to be used in this call's Do method. Any 3531 // pending HTTP request will be aborted if the provided context is 3532 // canceled. 3533 func (c *FilesGenerateIdsCall) Context(ctx context.Context) *FilesGenerateIdsCall { 3534 c.ctx_ = ctx 3535 return c 3536 } 3537 3538 func (c *FilesGenerateIdsCall) doRequest(alt string) (*http.Response, error) { 3539 var body io.Reader = nil 3540 c.urlParams_.Set("alt", alt) 3541 urls := googleapi.ResolveRelative(c.s.BasePath, "files/generateIds") 3542 urls += "?" + c.urlParams_.Encode() 3543 req, _ := http.NewRequest("GET", urls, body) 3544 googleapi.SetOpaque(req.URL) 3545 req.Header.Set("User-Agent", c.s.userAgent()) 3546 if c.ifNoneMatch_ != "" { 3547 req.Header.Set("If-None-Match", c.ifNoneMatch_) 3548 } 3549 if c.ctx_ != nil { 3550 return ctxhttp.Do(c.ctx_, c.s.client, req) 3551 } 3552 return c.s.client.Do(req) 3553 } 3554 3555 // Do executes the "drive.files.generateIds" call. 3556 // Exactly one of *GeneratedIds or error will be non-nil. Any non-2xx 3557 // status code is an error. Response headers are in either 3558 // *GeneratedIds.ServerResponse.Header or (if a response was returned at 3559 // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 3560 // to check whether the returned error was because 3561 // http.StatusNotModified was returned. 3562 func (c *FilesGenerateIdsCall) Do(opts ...googleapi.CallOption) (*GeneratedIds, error) { 3563 gensupport.SetOptions(c.urlParams_, opts...) 3564 res, err := c.doRequest("json") 3565 if res != nil && res.StatusCode == http.StatusNotModified { 3566 if res.Body != nil { 3567 res.Body.Close() 3568 } 3569 return nil, &googleapi.Error{ 3570 Code: res.StatusCode, 3571 Header: res.Header, 3572 } 3573 } 3574 if err != nil { 3575 return nil, err 3576 } 3577 defer googleapi.CloseBody(res) 3578 if err := googleapi.CheckResponse(res); err != nil { 3579 return nil, err 3580 } 3581 ret := &GeneratedIds{ 3582 ServerResponse: googleapi.ServerResponse{ 3583 Header: res.Header, 3584 HTTPStatusCode: res.StatusCode, 3585 }, 3586 } 3587 if err := json.NewDecoder(res.Body).Decode(&ret); err != nil { 3588 return nil, err 3589 } 3590 return ret, nil 3591 // { 3592 // "description": "Generates a set of file IDs which can be provided in create requests.", 3593 // "httpMethod": "GET", 3594 // "id": "drive.files.generateIds", 3595 // "parameters": { 3596 // "count": { 3597 // "default": "10", 3598 // "description": "The number of IDs to return.", 3599 // "format": "int32", 3600 // "location": "query", 3601 // "maximum": "1000", 3602 // "minimum": "1", 3603 // "type": "integer" 3604 // }, 3605 // "space": { 3606 // "default": "drive", 3607 // "description": "The space in which the IDs can be used to create new files. Supported values are 'drive' and 'appDataFolder'.", 3608 // "location": "query", 3609 // "type": "string" 3610 // } 3611 // }, 3612 // "path": "files/generateIds", 3613 // "response": { 3614 // "$ref": "GeneratedIds" 3615 // }, 3616 // "scopes": [ 3617 // "https://www.googleapis.com/auth/drive", 3618 // "https://www.googleapis.com/auth/drive.appdata", 3619 // "https://www.googleapis.com/auth/drive.file" 3620 // ] 3621 // } 3622 3623 } 3624 3625 // method id "drive.files.get": 3626 3627 type FilesGetCall struct { 3628 s *Service 3629 fileId string 3630 urlParams_ gensupport.URLParams 3631 ifNoneMatch_ string 3632 ctx_ context.Context 3633 } 3634 3635 // Get: Gets a file's metadata or content by ID. 3636 func (r *FilesService) Get(fileId string) *FilesGetCall { 3637 c := &FilesGetCall{s: r.s, urlParams_: make(gensupport.URLParams)} 3638 c.fileId = fileId 3639 return c 3640 } 3641 3642 // AcknowledgeAbuse sets the optional parameter "acknowledgeAbuse": 3643 // Whether the user is acknowledging the risk of downloading known 3644 // malware or other abusive files. This is only applicable when 3645 // alt=media. 3646 func (c *FilesGetCall) AcknowledgeAbuse(acknowledgeAbuse bool) *FilesGetCall { 3647 c.urlParams_.Set("acknowledgeAbuse", fmt.Sprint(acknowledgeAbuse)) 3648 return c 3649 } 3650 3651 // Fields allows partial responses to be retrieved. See 3652 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 3653 // for more information. 3654 func (c *FilesGetCall) Fields(s ...googleapi.Field) *FilesGetCall { 3655 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 3656 return c 3657 } 3658 3659 // IfNoneMatch sets the optional parameter which makes the operation 3660 // fail if the object's ETag matches the given value. This is useful for 3661 // getting updates only after the object has changed since the last 3662 // request. Use googleapi.IsNotModified to check whether the response 3663 // error from Do is the result of In-None-Match. 3664 func (c *FilesGetCall) IfNoneMatch(entityTag string) *FilesGetCall { 3665 c.ifNoneMatch_ = entityTag 3666 return c 3667 } 3668 3669 // Context sets the context to be used in this call's Do and Download 3670 // methods. Any pending HTTP request will be aborted if the provided 3671 // context is canceled. 3672 func (c *FilesGetCall) Context(ctx context.Context) *FilesGetCall { 3673 c.ctx_ = ctx 3674 return c 3675 } 3676 3677 func (c *FilesGetCall) doRequest(alt string) (*http.Response, error) { 3678 var body io.Reader = nil 3679 c.urlParams_.Set("alt", alt) 3680 urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}") 3681 urls += "?" + c.urlParams_.Encode() 3682 req, _ := http.NewRequest("GET", urls, body) 3683 googleapi.Expand(req.URL, map[string]string{ 3684 "fileId": c.fileId, 3685 }) 3686 req.Header.Set("User-Agent", c.s.userAgent()) 3687 if c.ifNoneMatch_ != "" { 3688 req.Header.Set("If-None-Match", c.ifNoneMatch_) 3689 } 3690 if c.ctx_ != nil { 3691 return ctxhttp.Do(c.ctx_, c.s.client, req) 3692 } 3693 return c.s.client.Do(req) 3694 } 3695 3696 // Download fetches the API endpoint's "media" value, instead of the normal 3697 // API response value. If the returned error is nil, the Response is guaranteed to 3698 // have a 2xx status code. Callers must close the Response.Body as usual. 3699 func (c *FilesGetCall) Download(opts ...googleapi.CallOption) (*http.Response, error) { 3700 gensupport.SetOptions(c.urlParams_, opts...) 3701 res, err := c.doRequest("media") 3702 if err != nil { 3703 return nil, err 3704 } 3705 if err := googleapi.CheckMediaResponse(res); err != nil { 3706 res.Body.Close() 3707 return nil, err 3708 } 3709 return res, nil 3710 } 3711 3712 // Do executes the "drive.files.get" call. 3713 // Exactly one of *File or error will be non-nil. Any non-2xx status 3714 // code is an error. Response headers are in either 3715 // *File.ServerResponse.Header or (if a response was returned at all) in 3716 // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check 3717 // whether the returned error was because http.StatusNotModified was 3718 // returned. 3719 func (c *FilesGetCall) Do(opts ...googleapi.CallOption) (*File, error) { 3720 gensupport.SetOptions(c.urlParams_, opts...) 3721 res, err := c.doRequest("json") 3722 if res != nil && res.StatusCode == http.StatusNotModified { 3723 if res.Body != nil { 3724 res.Body.Close() 3725 } 3726 return nil, &googleapi.Error{ 3727 Code: res.StatusCode, 3728 Header: res.Header, 3729 } 3730 } 3731 if err != nil { 3732 return nil, err 3733 } 3734 defer googleapi.CloseBody(res) 3735 if err := googleapi.CheckResponse(res); err != nil { 3736 return nil, err 3737 } 3738 ret := &File{ 3739 ServerResponse: googleapi.ServerResponse{ 3740 Header: res.Header, 3741 HTTPStatusCode: res.StatusCode, 3742 }, 3743 } 3744 if err := json.NewDecoder(res.Body).Decode(&ret); err != nil { 3745 return nil, err 3746 } 3747 return ret, nil 3748 // { 3749 // "description": "Gets a file's metadata or content by ID.", 3750 // "httpMethod": "GET", 3751 // "id": "drive.files.get", 3752 // "parameterOrder": [ 3753 // "fileId" 3754 // ], 3755 // "parameters": { 3756 // "acknowledgeAbuse": { 3757 // "default": "false", 3758 // "description": "Whether the user is acknowledging the risk of downloading known malware or other abusive files. This is only applicable when alt=media.", 3759 // "location": "query", 3760 // "type": "boolean" 3761 // }, 3762 // "fileId": { 3763 // "description": "The ID of the file.", 3764 // "location": "path", 3765 // "required": true, 3766 // "type": "string" 3767 // } 3768 // }, 3769 // "path": "files/{fileId}", 3770 // "response": { 3771 // "$ref": "File" 3772 // }, 3773 // "scopes": [ 3774 // "https://www.googleapis.com/auth/drive", 3775 // "https://www.googleapis.com/auth/drive.appdata", 3776 // "https://www.googleapis.com/auth/drive.file", 3777 // "https://www.googleapis.com/auth/drive.metadata", 3778 // "https://www.googleapis.com/auth/drive.metadata.readonly", 3779 // "https://www.googleapis.com/auth/drive.photos.readonly", 3780 // "https://www.googleapis.com/auth/drive.readonly" 3781 // ], 3782 // "supportsMediaDownload": true, 3783 // "supportsSubscription": true, 3784 // "useMediaDownloadService": true 3785 // } 3786 3787 } 3788 3789 // method id "drive.files.list": 3790 3791 type FilesListCall struct { 3792 s *Service 3793 urlParams_ gensupport.URLParams 3794 ifNoneMatch_ string 3795 ctx_ context.Context 3796 } 3797 3798 // List: Lists or searches files. 3799 func (r *FilesService) List() *FilesListCall { 3800 c := &FilesListCall{s: r.s, urlParams_: make(gensupport.URLParams)} 3801 return c 3802 } 3803 3804 // Corpus sets the optional parameter "corpus": The source of files to 3805 // list. 3806 // 3807 // Possible values: 3808 // "domain" - Files shared to the user's domain. 3809 // "user" (default) - Files owned by or shared to the user. 3810 func (c *FilesListCall) Corpus(corpus string) *FilesListCall { 3811 c.urlParams_.Set("corpus", corpus) 3812 return c 3813 } 3814 3815 // OrderBy sets the optional parameter "orderBy": A comma-separated list 3816 // of sort keys. Valid keys are 'createdTime', 'folder', 3817 // 'modifiedByMeTime', 'modifiedTime', 'name', 'quotaBytesUsed', 3818 // 'recency', 'sharedWithMeTime', 'starred', and 'viewedByMeTime'. Each 3819 // key sorts ascending by default, but may be reversed with the 'desc' 3820 // modifier. Example usage: ?orderBy=folder,modifiedTime desc,name. 3821 // Please note that there is a current limitation for users with 3822 // approximately one million files in which the requested sort order is 3823 // ignored. 3824 func (c *FilesListCall) OrderBy(orderBy string) *FilesListCall { 3825 c.urlParams_.Set("orderBy", orderBy) 3826 return c 3827 } 3828 3829 // PageSize sets the optional parameter "pageSize": The maximum number 3830 // of files to return per page. 3831 func (c *FilesListCall) PageSize(pageSize int64) *FilesListCall { 3832 c.urlParams_.Set("pageSize", fmt.Sprint(pageSize)) 3833 return c 3834 } 3835 3836 // PageToken sets the optional parameter "pageToken": The token for 3837 // continuing a previous list request on the next page. This should be 3838 // set to the value of 'nextPageToken' from the previous response. 3839 func (c *FilesListCall) PageToken(pageToken string) *FilesListCall { 3840 c.urlParams_.Set("pageToken", pageToken) 3841 return c 3842 } 3843 3844 // Q sets the optional parameter "q": A query for filtering the file 3845 // results. See the "Search for Files" guide for supported syntax. 3846 func (c *FilesListCall) Q(q string) *FilesListCall { 3847 c.urlParams_.Set("q", q) 3848 return c 3849 } 3850 3851 // Spaces sets the optional parameter "spaces": A comma-separated list 3852 // of spaces to query within the corpus. Supported values are 'drive', 3853 // 'appDataFolder' and 'photos'. 3854 func (c *FilesListCall) Spaces(spaces string) *FilesListCall { 3855 c.urlParams_.Set("spaces", spaces) 3856 return c 3857 } 3858 3859 // Fields allows partial responses to be retrieved. See 3860 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 3861 // for more information. 3862 func (c *FilesListCall) Fields(s ...googleapi.Field) *FilesListCall { 3863 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 3864 return c 3865 } 3866 3867 // IfNoneMatch sets the optional parameter which makes the operation 3868 // fail if the object's ETag matches the given value. This is useful for 3869 // getting updates only after the object has changed since the last 3870 // request. Use googleapi.IsNotModified to check whether the response 3871 // error from Do is the result of In-None-Match. 3872 func (c *FilesListCall) IfNoneMatch(entityTag string) *FilesListCall { 3873 c.ifNoneMatch_ = entityTag 3874 return c 3875 } 3876 3877 // Context sets the context to be used in this call's Do method. Any 3878 // pending HTTP request will be aborted if the provided context is 3879 // canceled. 3880 func (c *FilesListCall) Context(ctx context.Context) *FilesListCall { 3881 c.ctx_ = ctx 3882 return c 3883 } 3884 3885 func (c *FilesListCall) doRequest(alt string) (*http.Response, error) { 3886 var body io.Reader = nil 3887 c.urlParams_.Set("alt", alt) 3888 urls := googleapi.ResolveRelative(c.s.BasePath, "files") 3889 urls += "?" + c.urlParams_.Encode() 3890 req, _ := http.NewRequest("GET", urls, body) 3891 googleapi.SetOpaque(req.URL) 3892 req.Header.Set("User-Agent", c.s.userAgent()) 3893 if c.ifNoneMatch_ != "" { 3894 req.Header.Set("If-None-Match", c.ifNoneMatch_) 3895 } 3896 if c.ctx_ != nil { 3897 return ctxhttp.Do(c.ctx_, c.s.client, req) 3898 } 3899 return c.s.client.Do(req) 3900 } 3901 3902 // Do executes the "drive.files.list" call. 3903 // Exactly one of *FileList or error will be non-nil. Any non-2xx status 3904 // code is an error. Response headers are in either 3905 // *FileList.ServerResponse.Header or (if a response was returned at 3906 // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 3907 // to check whether the returned error was because 3908 // http.StatusNotModified was returned. 3909 func (c *FilesListCall) Do(opts ...googleapi.CallOption) (*FileList, error) { 3910 gensupport.SetOptions(c.urlParams_, opts...) 3911 res, err := c.doRequest("json") 3912 if res != nil && res.StatusCode == http.StatusNotModified { 3913 if res.Body != nil { 3914 res.Body.Close() 3915 } 3916 return nil, &googleapi.Error{ 3917 Code: res.StatusCode, 3918 Header: res.Header, 3919 } 3920 } 3921 if err != nil { 3922 return nil, err 3923 } 3924 defer googleapi.CloseBody(res) 3925 if err := googleapi.CheckResponse(res); err != nil { 3926 return nil, err 3927 } 3928 ret := &FileList{ 3929 ServerResponse: googleapi.ServerResponse{ 3930 Header: res.Header, 3931 HTTPStatusCode: res.StatusCode, 3932 }, 3933 } 3934 if err := json.NewDecoder(res.Body).Decode(&ret); err != nil { 3935 return nil, err 3936 } 3937 return ret, nil 3938 // { 3939 // "description": "Lists or searches files.", 3940 // "httpMethod": "GET", 3941 // "id": "drive.files.list", 3942 // "parameters": { 3943 // "corpus": { 3944 // "default": "user", 3945 // "description": "The source of files to list.", 3946 // "enum": [ 3947 // "domain", 3948 // "user" 3949 // ], 3950 // "enumDescriptions": [ 3951 // "Files shared to the user's domain.", 3952 // "Files owned by or shared to the user." 3953 // ], 3954 // "location": "query", 3955 // "type": "string" 3956 // }, 3957 // "orderBy": { 3958 // "description": "A comma-separated list of sort keys. Valid keys are 'createdTime', 'folder', 'modifiedByMeTime', 'modifiedTime', 'name', 'quotaBytesUsed', 'recency', 'sharedWithMeTime', 'starred', and 'viewedByMeTime'. Each key sorts ascending by default, but may be reversed with the 'desc' modifier. Example usage: ?orderBy=folder,modifiedTime desc,name. Please note that there is a current limitation for users with approximately one million files in which the requested sort order is ignored.", 3959 // "location": "query", 3960 // "type": "string" 3961 // }, 3962 // "pageSize": { 3963 // "default": "100", 3964 // "description": "The maximum number of files to return per page.", 3965 // "format": "int32", 3966 // "location": "query", 3967 // "maximum": "1000", 3968 // "minimum": "1", 3969 // "type": "integer" 3970 // }, 3971 // "pageToken": { 3972 // "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.", 3973 // "location": "query", 3974 // "type": "string" 3975 // }, 3976 // "q": { 3977 // "description": "A query for filtering the file results. See the \"Search for Files\" guide for supported syntax.", 3978 // "location": "query", 3979 // "type": "string" 3980 // }, 3981 // "spaces": { 3982 // "default": "drive", 3983 // "description": "A comma-separated list of spaces to query within the corpus. Supported values are 'drive', 'appDataFolder' and 'photos'.", 3984 // "location": "query", 3985 // "type": "string" 3986 // } 3987 // }, 3988 // "path": "files", 3989 // "response": { 3990 // "$ref": "FileList" 3991 // }, 3992 // "scopes": [ 3993 // "https://www.googleapis.com/auth/drive", 3994 // "https://www.googleapis.com/auth/drive.appdata", 3995 // "https://www.googleapis.com/auth/drive.file", 3996 // "https://www.googleapis.com/auth/drive.metadata", 3997 // "https://www.googleapis.com/auth/drive.metadata.readonly", 3998 // "https://www.googleapis.com/auth/drive.photos.readonly", 3999 // "https://www.googleapis.com/auth/drive.readonly" 4000 // ] 4001 // } 4002 4003 } 4004 4005 // Pages invokes f for each page of results. 4006 // A non-nil error returned from f will halt the iteration. 4007 // The provided context supersedes any context provided to the Context method. 4008 func (c *FilesListCall) Pages(ctx context.Context, f func(*FileList) error) error { 4009 c.ctx_ = ctx 4010 defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point 4011 for { 4012 x, err := c.Do() 4013 if err != nil { 4014 return err 4015 } 4016 if err := f(x); err != nil { 4017 return err 4018 } 4019 if x.NextPageToken == "" { 4020 return nil 4021 } 4022 c.PageToken(x.NextPageToken) 4023 } 4024 } 4025 4026 // method id "drive.files.update": 4027 4028 type FilesUpdateCall struct { 4029 s *Service 4030 fileId string 4031 file *File 4032 urlParams_ gensupport.URLParams 4033 media_ io.Reader 4034 resumableBuffer_ *gensupport.ResumableBuffer 4035 mediaType_ string 4036 mediaSize_ int64 // mediaSize, if known. Used only for calls to progressUpdater_. 4037 progressUpdater_ googleapi.ProgressUpdater 4038 ctx_ context.Context 4039 } 4040 4041 // Update: Updates a file's metadata and/or content with patch 4042 // semantics. 4043 func (r *FilesService) Update(fileId string, file *File) *FilesUpdateCall { 4044 c := &FilesUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)} 4045 c.fileId = fileId 4046 c.file = file 4047 return c 4048 } 4049 4050 // AddParents sets the optional parameter "addParents": A 4051 // comma-separated list of parent IDs to add. 4052 func (c *FilesUpdateCall) AddParents(addParents string) *FilesUpdateCall { 4053 c.urlParams_.Set("addParents", addParents) 4054 return c 4055 } 4056 4057 // KeepRevisionForever sets the optional parameter 4058 // "keepRevisionForever": Whether to set the 'keepForever' field in the 4059 // new head revision. This is only applicable to files with binary 4060 // content in Drive. 4061 func (c *FilesUpdateCall) KeepRevisionForever(keepRevisionForever bool) *FilesUpdateCall { 4062 c.urlParams_.Set("keepRevisionForever", fmt.Sprint(keepRevisionForever)) 4063 return c 4064 } 4065 4066 // OcrLanguage sets the optional parameter "ocrLanguage": A language 4067 // hint for OCR processing during image import (ISO 639-1 code). 4068 func (c *FilesUpdateCall) OcrLanguage(ocrLanguage string) *FilesUpdateCall { 4069 c.urlParams_.Set("ocrLanguage", ocrLanguage) 4070 return c 4071 } 4072 4073 // RemoveParents sets the optional parameter "removeParents": A 4074 // comma-separated list of parent IDs to remove. 4075 func (c *FilesUpdateCall) RemoveParents(removeParents string) *FilesUpdateCall { 4076 c.urlParams_.Set("removeParents", removeParents) 4077 return c 4078 } 4079 4080 // UseContentAsIndexableText sets the optional parameter 4081 // "useContentAsIndexableText": Whether to use the uploaded content as 4082 // indexable text. 4083 func (c *FilesUpdateCall) UseContentAsIndexableText(useContentAsIndexableText bool) *FilesUpdateCall { 4084 c.urlParams_.Set("useContentAsIndexableText", fmt.Sprint(useContentAsIndexableText)) 4085 return c 4086 } 4087 4088 // Media specifies the media to upload in one or more chunks. The chunk 4089 // size may be controlled by supplying a MediaOption generated by 4090 // googleapi.ChunkSize. The chunk size defaults to 4091 // googleapi.DefaultUploadChunkSize.The Content-Type header used in the 4092 // upload request will be determined by sniffing the contents of r, 4093 // unless a MediaOption generated by googleapi.ContentType is 4094 // supplied. 4095 // At most one of Media and ResumableMedia may be set. 4096 func (c *FilesUpdateCall) Media(r io.Reader, options ...googleapi.MediaOption) *FilesUpdateCall { 4097 opts := googleapi.ProcessMediaOptions(options) 4098 chunkSize := opts.ChunkSize 4099 if !opts.ForceEmptyContentType { 4100 r, c.mediaType_ = gensupport.DetermineContentType(r, opts.ContentType) 4101 } 4102 c.media_, c.resumableBuffer_ = gensupport.PrepareUpload(r, chunkSize) 4103 return c 4104 } 4105 4106 // ResumableMedia specifies the media to upload in chunks and can be 4107 // canceled with ctx. 4108 // 4109 // Deprecated: use Media instead. 4110 // 4111 // At most one of Media and ResumableMedia may be set. mediaType 4112 // identifies the MIME media type of the upload, such as "image/png". If 4113 // mediaType is "", it will be auto-detected. The provided ctx will 4114 // supersede any context previously provided to the Context method. 4115 func (c *FilesUpdateCall) ResumableMedia(ctx context.Context, r io.ReaderAt, size int64, mediaType string) *FilesUpdateCall { 4116 c.ctx_ = ctx 4117 rdr := gensupport.ReaderAtToReader(r, size) 4118 rdr, c.mediaType_ = gensupport.DetermineContentType(rdr, mediaType) 4119 c.resumableBuffer_ = gensupport.NewResumableBuffer(rdr, googleapi.DefaultUploadChunkSize) 4120 c.media_ = nil 4121 c.mediaSize_ = size 4122 return c 4123 } 4124 4125 // ProgressUpdater provides a callback function that will be called 4126 // after every chunk. It should be a low-latency function in order to 4127 // not slow down the upload operation. This should only be called when 4128 // using ResumableMedia (as opposed to Media). 4129 func (c *FilesUpdateCall) ProgressUpdater(pu googleapi.ProgressUpdater) *FilesUpdateCall { 4130 c.progressUpdater_ = pu 4131 return c 4132 } 4133 4134 // Fields allows partial responses to be retrieved. See 4135 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 4136 // for more information. 4137 func (c *FilesUpdateCall) Fields(s ...googleapi.Field) *FilesUpdateCall { 4138 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 4139 return c 4140 } 4141 4142 // Context sets the context to be used in this call's Do method. Any 4143 // pending HTTP request will be aborted if the provided context is 4144 // canceled. 4145 // This context will supersede any context previously provided to the 4146 // ResumableMedia method. 4147 func (c *FilesUpdateCall) Context(ctx context.Context) *FilesUpdateCall { 4148 c.ctx_ = ctx 4149 return c 4150 } 4151 4152 func (c *FilesUpdateCall) doRequest(alt string) (*http.Response, error) { 4153 var body io.Reader = nil 4154 body, err := googleapi.WithoutDataWrapper.JSONReader(c.file) 4155 if err != nil { 4156 return nil, err 4157 } 4158 ctype := "application/json" 4159 c.urlParams_.Set("alt", alt) 4160 urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}") 4161 if c.media_ != nil || c.resumableBuffer_ != nil { 4162 urls = strings.Replace(urls, "https://www.googleapis.com/", "https://www.googleapis.com/upload/", 1) 4163 protocol := "multipart" 4164 if c.resumableBuffer_ != nil { 4165 protocol = "resumable" 4166 } 4167 c.urlParams_.Set("uploadType", protocol) 4168 } 4169 urls += "?" + c.urlParams_.Encode() 4170 if c.media_ != nil { 4171 var combined io.ReadCloser 4172 combined, ctype = gensupport.CombineBodyMedia(body, ctype, c.media_, c.mediaType_) 4173 defer combined.Close() 4174 body = combined 4175 } 4176 req, _ := http.NewRequest("PATCH", urls, body) 4177 googleapi.Expand(req.URL, map[string]string{ 4178 "fileId": c.fileId, 4179 }) 4180 if c.resumableBuffer_ != nil && c.mediaType_ != "" { 4181 req.Header.Set("X-Upload-Content-Type", c.mediaType_) 4182 } 4183 req.Header.Set("Content-Type", ctype) 4184 req.Header.Set("User-Agent", c.s.userAgent()) 4185 if c.ctx_ != nil { 4186 return ctxhttp.Do(c.ctx_, c.s.client, req) 4187 } 4188 return c.s.client.Do(req) 4189 } 4190 4191 // Do executes the "drive.files.update" call. 4192 // Exactly one of *File or error will be non-nil. Any non-2xx status 4193 // code is an error. Response headers are in either 4194 // *File.ServerResponse.Header or (if a response was returned at all) in 4195 // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check 4196 // whether the returned error was because http.StatusNotModified was 4197 // returned. 4198 func (c *FilesUpdateCall) Do(opts ...googleapi.CallOption) (*File, error) { 4199 gensupport.SetOptions(c.urlParams_, opts...) 4200 res, err := c.doRequest("json") 4201 if res != nil && res.StatusCode == http.StatusNotModified { 4202 if res.Body != nil { 4203 res.Body.Close() 4204 } 4205 return nil, &googleapi.Error{ 4206 Code: res.StatusCode, 4207 Header: res.Header, 4208 } 4209 } 4210 if err != nil { 4211 return nil, err 4212 } 4213 defer googleapi.CloseBody(res) 4214 if err := googleapi.CheckResponse(res); err != nil { 4215 return nil, err 4216 } 4217 if c.resumableBuffer_ != nil { 4218 loc := res.Header.Get("Location") 4219 rx := &gensupport.ResumableUpload{ 4220 Client: c.s.client, 4221 UserAgent: c.s.userAgent(), 4222 URI: loc, 4223 Media: c.resumableBuffer_, 4224 MediaType: c.mediaType_, 4225 Callback: func(curr int64) { 4226 if c.progressUpdater_ != nil { 4227 c.progressUpdater_(curr, c.mediaSize_) 4228 } 4229 }, 4230 } 4231 ctx := c.ctx_ 4232 if ctx == nil { 4233 ctx = context.TODO() 4234 } 4235 res, err = rx.Upload(ctx) 4236 if err != nil { 4237 return nil, err 4238 } 4239 defer res.Body.Close() 4240 if err := googleapi.CheckResponse(res); err != nil { 4241 return nil, err 4242 } 4243 } 4244 ret := &File{ 4245 ServerResponse: googleapi.ServerResponse{ 4246 Header: res.Header, 4247 HTTPStatusCode: res.StatusCode, 4248 }, 4249 } 4250 if err := json.NewDecoder(res.Body).Decode(&ret); err != nil { 4251 return nil, err 4252 } 4253 return ret, nil 4254 // { 4255 // "description": "Updates a file's metadata and/or content with patch semantics.", 4256 // "httpMethod": "PATCH", 4257 // "id": "drive.files.update", 4258 // "mediaUpload": { 4259 // "accept": [ 4260 // "*/*" 4261 // ], 4262 // "maxSize": "5120GB", 4263 // "protocols": { 4264 // "resumable": { 4265 // "multipart": true, 4266 // "path": "/resumable/upload/drive/v3/files/{fileId}" 4267 // }, 4268 // "simple": { 4269 // "multipart": true, 4270 // "path": "/upload/drive/v3/files/{fileId}" 4271 // } 4272 // } 4273 // }, 4274 // "parameterOrder": [ 4275 // "fileId" 4276 // ], 4277 // "parameters": { 4278 // "addParents": { 4279 // "description": "A comma-separated list of parent IDs to add.", 4280 // "location": "query", 4281 // "type": "string" 4282 // }, 4283 // "fileId": { 4284 // "description": "The ID of the file.", 4285 // "location": "path", 4286 // "required": true, 4287 // "type": "string" 4288 // }, 4289 // "keepRevisionForever": { 4290 // "default": "false", 4291 // "description": "Whether to set the 'keepForever' field in the new head revision. This is only applicable to files with binary content in Drive.", 4292 // "location": "query", 4293 // "type": "boolean" 4294 // }, 4295 // "ocrLanguage": { 4296 // "description": "A language hint for OCR processing during image import (ISO 639-1 code).", 4297 // "location": "query", 4298 // "type": "string" 4299 // }, 4300 // "removeParents": { 4301 // "description": "A comma-separated list of parent IDs to remove.", 4302 // "location": "query", 4303 // "type": "string" 4304 // }, 4305 // "useContentAsIndexableText": { 4306 // "default": "false", 4307 // "description": "Whether to use the uploaded content as indexable text.", 4308 // "location": "query", 4309 // "type": "boolean" 4310 // } 4311 // }, 4312 // "path": "files/{fileId}", 4313 // "request": { 4314 // "$ref": "File" 4315 // }, 4316 // "response": { 4317 // "$ref": "File" 4318 // }, 4319 // "scopes": [ 4320 // "https://www.googleapis.com/auth/drive", 4321 // "https://www.googleapis.com/auth/drive.appdata", 4322 // "https://www.googleapis.com/auth/drive.file", 4323 // "https://www.googleapis.com/auth/drive.metadata", 4324 // "https://www.googleapis.com/auth/drive.scripts" 4325 // ], 4326 // "supportsMediaUpload": true 4327 // } 4328 4329 } 4330 4331 // method id "drive.files.watch": 4332 4333 type FilesWatchCall struct { 4334 s *Service 4335 fileId string 4336 channel *Channel 4337 urlParams_ gensupport.URLParams 4338 ctx_ context.Context 4339 } 4340 4341 // Watch: Subscribes to changes to a file 4342 func (r *FilesService) Watch(fileId string, channel *Channel) *FilesWatchCall { 4343 c := &FilesWatchCall{s: r.s, urlParams_: make(gensupport.URLParams)} 4344 c.fileId = fileId 4345 c.channel = channel 4346 return c 4347 } 4348 4349 // AcknowledgeAbuse sets the optional parameter "acknowledgeAbuse": 4350 // Whether the user is acknowledging the risk of downloading known 4351 // malware or other abusive files. This is only applicable when 4352 // alt=media. 4353 func (c *FilesWatchCall) AcknowledgeAbuse(acknowledgeAbuse bool) *FilesWatchCall { 4354 c.urlParams_.Set("acknowledgeAbuse", fmt.Sprint(acknowledgeAbuse)) 4355 return c 4356 } 4357 4358 // Fields allows partial responses to be retrieved. See 4359 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 4360 // for more information. 4361 func (c *FilesWatchCall) Fields(s ...googleapi.Field) *FilesWatchCall { 4362 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 4363 return c 4364 } 4365 4366 // Context sets the context to be used in this call's Do and Download 4367 // methods. Any pending HTTP request will be aborted if the provided 4368 // context is canceled. 4369 func (c *FilesWatchCall) Context(ctx context.Context) *FilesWatchCall { 4370 c.ctx_ = ctx 4371 return c 4372 } 4373 4374 func (c *FilesWatchCall) doRequest(alt string) (*http.Response, error) { 4375 var body io.Reader = nil 4376 body, err := googleapi.WithoutDataWrapper.JSONReader(c.channel) 4377 if err != nil { 4378 return nil, err 4379 } 4380 ctype := "application/json" 4381 c.urlParams_.Set("alt", alt) 4382 urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/watch") 4383 urls += "?" + c.urlParams_.Encode() 4384 req, _ := http.NewRequest("POST", urls, body) 4385 googleapi.Expand(req.URL, map[string]string{ 4386 "fileId": c.fileId, 4387 }) 4388 req.Header.Set("Content-Type", ctype) 4389 req.Header.Set("User-Agent", c.s.userAgent()) 4390 if c.ctx_ != nil { 4391 return ctxhttp.Do(c.ctx_, c.s.client, req) 4392 } 4393 return c.s.client.Do(req) 4394 } 4395 4396 // Download fetches the API endpoint's "media" value, instead of the normal 4397 // API response value. If the returned error is nil, the Response is guaranteed to 4398 // have a 2xx status code. Callers must close the Response.Body as usual. 4399 func (c *FilesWatchCall) Download(opts ...googleapi.CallOption) (*http.Response, error) { 4400 gensupport.SetOptions(c.urlParams_, opts...) 4401 res, err := c.doRequest("media") 4402 if err != nil { 4403 return nil, err 4404 } 4405 if err := googleapi.CheckMediaResponse(res); err != nil { 4406 res.Body.Close() 4407 return nil, err 4408 } 4409 return res, nil 4410 } 4411 4412 // Do executes the "drive.files.watch" call. 4413 // Exactly one of *Channel or error will be non-nil. Any non-2xx status 4414 // code is an error. Response headers are in either 4415 // *Channel.ServerResponse.Header or (if a response was returned at all) 4416 // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 4417 // check whether the returned error was because http.StatusNotModified 4418 // was returned. 4419 func (c *FilesWatchCall) Do(opts ...googleapi.CallOption) (*Channel, error) { 4420 gensupport.SetOptions(c.urlParams_, opts...) 4421 res, err := c.doRequest("json") 4422 if res != nil && res.StatusCode == http.StatusNotModified { 4423 if res.Body != nil { 4424 res.Body.Close() 4425 } 4426 return nil, &googleapi.Error{ 4427 Code: res.StatusCode, 4428 Header: res.Header, 4429 } 4430 } 4431 if err != nil { 4432 return nil, err 4433 } 4434 defer googleapi.CloseBody(res) 4435 if err := googleapi.CheckResponse(res); err != nil { 4436 return nil, err 4437 } 4438 ret := &Channel{ 4439 ServerResponse: googleapi.ServerResponse{ 4440 Header: res.Header, 4441 HTTPStatusCode: res.StatusCode, 4442 }, 4443 } 4444 if err := json.NewDecoder(res.Body).Decode(&ret); err != nil { 4445 return nil, err 4446 } 4447 return ret, nil 4448 // { 4449 // "description": "Subscribes to changes to a file", 4450 // "httpMethod": "POST", 4451 // "id": "drive.files.watch", 4452 // "parameterOrder": [ 4453 // "fileId" 4454 // ], 4455 // "parameters": { 4456 // "acknowledgeAbuse": { 4457 // "default": "false", 4458 // "description": "Whether the user is acknowledging the risk of downloading known malware or other abusive files. This is only applicable when alt=media.", 4459 // "location": "query", 4460 // "type": "boolean" 4461 // }, 4462 // "fileId": { 4463 // "description": "The ID of the file.", 4464 // "location": "path", 4465 // "required": true, 4466 // "type": "string" 4467 // } 4468 // }, 4469 // "path": "files/{fileId}/watch", 4470 // "request": { 4471 // "$ref": "Channel", 4472 // "parameterName": "resource" 4473 // }, 4474 // "response": { 4475 // "$ref": "Channel" 4476 // }, 4477 // "scopes": [ 4478 // "https://www.googleapis.com/auth/drive", 4479 // "https://www.googleapis.com/auth/drive.appdata", 4480 // "https://www.googleapis.com/auth/drive.file", 4481 // "https://www.googleapis.com/auth/drive.metadata", 4482 // "https://www.googleapis.com/auth/drive.metadata.readonly", 4483 // "https://www.googleapis.com/auth/drive.photos.readonly", 4484 // "https://www.googleapis.com/auth/drive.readonly" 4485 // ], 4486 // "supportsMediaDownload": true, 4487 // "supportsSubscription": true, 4488 // "useMediaDownloadService": true 4489 // } 4490 4491 } 4492 4493 // method id "drive.permissions.create": 4494 4495 type PermissionsCreateCall struct { 4496 s *Service 4497 fileId string 4498 permission *Permission 4499 urlParams_ gensupport.URLParams 4500 ctx_ context.Context 4501 } 4502 4503 // Create: Creates a permission for a file. 4504 func (r *PermissionsService) Create(fileId string, permission *Permission) *PermissionsCreateCall { 4505 c := &PermissionsCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)} 4506 c.fileId = fileId 4507 c.permission = permission 4508 return c 4509 } 4510 4511 // EmailMessage sets the optional parameter "emailMessage": A custom 4512 // message to include in the notification email. 4513 func (c *PermissionsCreateCall) EmailMessage(emailMessage string) *PermissionsCreateCall { 4514 c.urlParams_.Set("emailMessage", emailMessage) 4515 return c 4516 } 4517 4518 // SendNotificationEmail sets the optional parameter 4519 // "sendNotificationEmail": Whether to send a notification email when 4520 // sharing to users or groups. This defaults to true for users and 4521 // groups, and is not allowed for other requests. It must not be 4522 // disabled for ownership transfers. 4523 func (c *PermissionsCreateCall) SendNotificationEmail(sendNotificationEmail bool) *PermissionsCreateCall { 4524 c.urlParams_.Set("sendNotificationEmail", fmt.Sprint(sendNotificationEmail)) 4525 return c 4526 } 4527 4528 // TransferOwnership sets the optional parameter "transferOwnership": 4529 // Whether to transfer ownership to the specified user and downgrade the 4530 // current owner to a writer. This parameter is required as an 4531 // acknowledgement of the side effect. 4532 func (c *PermissionsCreateCall) TransferOwnership(transferOwnership bool) *PermissionsCreateCall { 4533 c.urlParams_.Set("transferOwnership", fmt.Sprint(transferOwnership)) 4534 return c 4535 } 4536 4537 // Fields allows partial responses to be retrieved. See 4538 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 4539 // for more information. 4540 func (c *PermissionsCreateCall) Fields(s ...googleapi.Field) *PermissionsCreateCall { 4541 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 4542 return c 4543 } 4544 4545 // Context sets the context to be used in this call's Do method. Any 4546 // pending HTTP request will be aborted if the provided context is 4547 // canceled. 4548 func (c *PermissionsCreateCall) Context(ctx context.Context) *PermissionsCreateCall { 4549 c.ctx_ = ctx 4550 return c 4551 } 4552 4553 func (c *PermissionsCreateCall) doRequest(alt string) (*http.Response, error) { 4554 var body io.Reader = nil 4555 body, err := googleapi.WithoutDataWrapper.JSONReader(c.permission) 4556 if err != nil { 4557 return nil, err 4558 } 4559 ctype := "application/json" 4560 c.urlParams_.Set("alt", alt) 4561 urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/permissions") 4562 urls += "?" + c.urlParams_.Encode() 4563 req, _ := http.NewRequest("POST", urls, body) 4564 googleapi.Expand(req.URL, map[string]string{ 4565 "fileId": c.fileId, 4566 }) 4567 req.Header.Set("Content-Type", ctype) 4568 req.Header.Set("User-Agent", c.s.userAgent()) 4569 if c.ctx_ != nil { 4570 return ctxhttp.Do(c.ctx_, c.s.client, req) 4571 } 4572 return c.s.client.Do(req) 4573 } 4574 4575 // Do executes the "drive.permissions.create" call. 4576 // Exactly one of *Permission or error will be non-nil. Any non-2xx 4577 // status code is an error. Response headers are in either 4578 // *Permission.ServerResponse.Header or (if a response was returned at 4579 // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 4580 // to check whether the returned error was because 4581 // http.StatusNotModified was returned. 4582 func (c *PermissionsCreateCall) Do(opts ...googleapi.CallOption) (*Permission, error) { 4583 gensupport.SetOptions(c.urlParams_, opts...) 4584 res, err := c.doRequest("json") 4585 if res != nil && res.StatusCode == http.StatusNotModified { 4586 if res.Body != nil { 4587 res.Body.Close() 4588 } 4589 return nil, &googleapi.Error{ 4590 Code: res.StatusCode, 4591 Header: res.Header, 4592 } 4593 } 4594 if err != nil { 4595 return nil, err 4596 } 4597 defer googleapi.CloseBody(res) 4598 if err := googleapi.CheckResponse(res); err != nil { 4599 return nil, err 4600 } 4601 ret := &Permission{ 4602 ServerResponse: googleapi.ServerResponse{ 4603 Header: res.Header, 4604 HTTPStatusCode: res.StatusCode, 4605 }, 4606 } 4607 if err := json.NewDecoder(res.Body).Decode(&ret); err != nil { 4608 return nil, err 4609 } 4610 return ret, nil 4611 // { 4612 // "description": "Creates a permission for a file.", 4613 // "httpMethod": "POST", 4614 // "id": "drive.permissions.create", 4615 // "parameterOrder": [ 4616 // "fileId" 4617 // ], 4618 // "parameters": { 4619 // "emailMessage": { 4620 // "description": "A custom message to include in the notification email.", 4621 // "location": "query", 4622 // "type": "string" 4623 // }, 4624 // "fileId": { 4625 // "description": "The ID of the file.", 4626 // "location": "path", 4627 // "required": true, 4628 // "type": "string" 4629 // }, 4630 // "sendNotificationEmail": { 4631 // "description": "Whether to send a notification email when sharing to users or groups. This defaults to true for users and groups, and is not allowed for other requests. It must not be disabled for ownership transfers.", 4632 // "location": "query", 4633 // "type": "boolean" 4634 // }, 4635 // "transferOwnership": { 4636 // "default": "false", 4637 // "description": "Whether to transfer ownership to the specified user and downgrade the current owner to a writer. This parameter is required as an acknowledgement of the side effect.", 4638 // "location": "query", 4639 // "type": "boolean" 4640 // } 4641 // }, 4642 // "path": "files/{fileId}/permissions", 4643 // "request": { 4644 // "$ref": "Permission" 4645 // }, 4646 // "response": { 4647 // "$ref": "Permission" 4648 // }, 4649 // "scopes": [ 4650 // "https://www.googleapis.com/auth/drive", 4651 // "https://www.googleapis.com/auth/drive.file" 4652 // ] 4653 // } 4654 4655 } 4656 4657 // method id "drive.permissions.delete": 4658 4659 type PermissionsDeleteCall struct { 4660 s *Service 4661 fileId string 4662 permissionId string 4663 urlParams_ gensupport.URLParams 4664 ctx_ context.Context 4665 } 4666 4667 // Delete: Deletes a permission. 4668 func (r *PermissionsService) Delete(fileId string, permissionId string) *PermissionsDeleteCall { 4669 c := &PermissionsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)} 4670 c.fileId = fileId 4671 c.permissionId = permissionId 4672 return c 4673 } 4674 4675 // Fields allows partial responses to be retrieved. See 4676 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 4677 // for more information. 4678 func (c *PermissionsDeleteCall) Fields(s ...googleapi.Field) *PermissionsDeleteCall { 4679 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 4680 return c 4681 } 4682 4683 // Context sets the context to be used in this call's Do method. Any 4684 // pending HTTP request will be aborted if the provided context is 4685 // canceled. 4686 func (c *PermissionsDeleteCall) Context(ctx context.Context) *PermissionsDeleteCall { 4687 c.ctx_ = ctx 4688 return c 4689 } 4690 4691 func (c *PermissionsDeleteCall) doRequest(alt string) (*http.Response, error) { 4692 var body io.Reader = nil 4693 c.urlParams_.Set("alt", alt) 4694 urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/permissions/{permissionId}") 4695 urls += "?" + c.urlParams_.Encode() 4696 req, _ := http.NewRequest("DELETE", urls, body) 4697 googleapi.Expand(req.URL, map[string]string{ 4698 "fileId": c.fileId, 4699 "permissionId": c.permissionId, 4700 }) 4701 req.Header.Set("User-Agent", c.s.userAgent()) 4702 if c.ctx_ != nil { 4703 return ctxhttp.Do(c.ctx_, c.s.client, req) 4704 } 4705 return c.s.client.Do(req) 4706 } 4707 4708 // Do executes the "drive.permissions.delete" call. 4709 func (c *PermissionsDeleteCall) Do(opts ...googleapi.CallOption) error { 4710 gensupport.SetOptions(c.urlParams_, opts...) 4711 res, err := c.doRequest("json") 4712 if err != nil { 4713 return err 4714 } 4715 defer googleapi.CloseBody(res) 4716 if err := googleapi.CheckResponse(res); err != nil { 4717 return err 4718 } 4719 return nil 4720 // { 4721 // "description": "Deletes a permission.", 4722 // "httpMethod": "DELETE", 4723 // "id": "drive.permissions.delete", 4724 // "parameterOrder": [ 4725 // "fileId", 4726 // "permissionId" 4727 // ], 4728 // "parameters": { 4729 // "fileId": { 4730 // "description": "The ID of the file.", 4731 // "location": "path", 4732 // "required": true, 4733 // "type": "string" 4734 // }, 4735 // "permissionId": { 4736 // "description": "The ID of the permission.", 4737 // "location": "path", 4738 // "required": true, 4739 // "type": "string" 4740 // } 4741 // }, 4742 // "path": "files/{fileId}/permissions/{permissionId}", 4743 // "scopes": [ 4744 // "https://www.googleapis.com/auth/drive", 4745 // "https://www.googleapis.com/auth/drive.file" 4746 // ] 4747 // } 4748 4749 } 4750 4751 // method id "drive.permissions.get": 4752 4753 type PermissionsGetCall struct { 4754 s *Service 4755 fileId string 4756 permissionId string 4757 urlParams_ gensupport.URLParams 4758 ifNoneMatch_ string 4759 ctx_ context.Context 4760 } 4761 4762 // Get: Gets a permission by ID. 4763 func (r *PermissionsService) Get(fileId string, permissionId string) *PermissionsGetCall { 4764 c := &PermissionsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)} 4765 c.fileId = fileId 4766 c.permissionId = permissionId 4767 return c 4768 } 4769 4770 // Fields allows partial responses to be retrieved. See 4771 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 4772 // for more information. 4773 func (c *PermissionsGetCall) Fields(s ...googleapi.Field) *PermissionsGetCall { 4774 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 4775 return c 4776 } 4777 4778 // IfNoneMatch sets the optional parameter which makes the operation 4779 // fail if the object's ETag matches the given value. This is useful for 4780 // getting updates only after the object has changed since the last 4781 // request. Use googleapi.IsNotModified to check whether the response 4782 // error from Do is the result of In-None-Match. 4783 func (c *PermissionsGetCall) IfNoneMatch(entityTag string) *PermissionsGetCall { 4784 c.ifNoneMatch_ = entityTag 4785 return c 4786 } 4787 4788 // Context sets the context to be used in this call's Do method. Any 4789 // pending HTTP request will be aborted if the provided context is 4790 // canceled. 4791 func (c *PermissionsGetCall) Context(ctx context.Context) *PermissionsGetCall { 4792 c.ctx_ = ctx 4793 return c 4794 } 4795 4796 func (c *PermissionsGetCall) doRequest(alt string) (*http.Response, error) { 4797 var body io.Reader = nil 4798 c.urlParams_.Set("alt", alt) 4799 urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/permissions/{permissionId}") 4800 urls += "?" + c.urlParams_.Encode() 4801 req, _ := http.NewRequest("GET", urls, body) 4802 googleapi.Expand(req.URL, map[string]string{ 4803 "fileId": c.fileId, 4804 "permissionId": c.permissionId, 4805 }) 4806 req.Header.Set("User-Agent", c.s.userAgent()) 4807 if c.ifNoneMatch_ != "" { 4808 req.Header.Set("If-None-Match", c.ifNoneMatch_) 4809 } 4810 if c.ctx_ != nil { 4811 return ctxhttp.Do(c.ctx_, c.s.client, req) 4812 } 4813 return c.s.client.Do(req) 4814 } 4815 4816 // Do executes the "drive.permissions.get" call. 4817 // Exactly one of *Permission or error will be non-nil. Any non-2xx 4818 // status code is an error. Response headers are in either 4819 // *Permission.ServerResponse.Header or (if a response was returned at 4820 // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 4821 // to check whether the returned error was because 4822 // http.StatusNotModified was returned. 4823 func (c *PermissionsGetCall) Do(opts ...googleapi.CallOption) (*Permission, error) { 4824 gensupport.SetOptions(c.urlParams_, opts...) 4825 res, err := c.doRequest("json") 4826 if res != nil && res.StatusCode == http.StatusNotModified { 4827 if res.Body != nil { 4828 res.Body.Close() 4829 } 4830 return nil, &googleapi.Error{ 4831 Code: res.StatusCode, 4832 Header: res.Header, 4833 } 4834 } 4835 if err != nil { 4836 return nil, err 4837 } 4838 defer googleapi.CloseBody(res) 4839 if err := googleapi.CheckResponse(res); err != nil { 4840 return nil, err 4841 } 4842 ret := &Permission{ 4843 ServerResponse: googleapi.ServerResponse{ 4844 Header: res.Header, 4845 HTTPStatusCode: res.StatusCode, 4846 }, 4847 } 4848 if err := json.NewDecoder(res.Body).Decode(&ret); err != nil { 4849 return nil, err 4850 } 4851 return ret, nil 4852 // { 4853 // "description": "Gets a permission by ID.", 4854 // "httpMethod": "GET", 4855 // "id": "drive.permissions.get", 4856 // "parameterOrder": [ 4857 // "fileId", 4858 // "permissionId" 4859 // ], 4860 // "parameters": { 4861 // "fileId": { 4862 // "description": "The ID of the file.", 4863 // "location": "path", 4864 // "required": true, 4865 // "type": "string" 4866 // }, 4867 // "permissionId": { 4868 // "description": "The ID of the permission.", 4869 // "location": "path", 4870 // "required": true, 4871 // "type": "string" 4872 // } 4873 // }, 4874 // "path": "files/{fileId}/permissions/{permissionId}", 4875 // "response": { 4876 // "$ref": "Permission" 4877 // }, 4878 // "scopes": [ 4879 // "https://www.googleapis.com/auth/drive", 4880 // "https://www.googleapis.com/auth/drive.file", 4881 // "https://www.googleapis.com/auth/drive.metadata", 4882 // "https://www.googleapis.com/auth/drive.metadata.readonly", 4883 // "https://www.googleapis.com/auth/drive.photos.readonly", 4884 // "https://www.googleapis.com/auth/drive.readonly" 4885 // ] 4886 // } 4887 4888 } 4889 4890 // method id "drive.permissions.list": 4891 4892 type PermissionsListCall struct { 4893 s *Service 4894 fileId string 4895 urlParams_ gensupport.URLParams 4896 ifNoneMatch_ string 4897 ctx_ context.Context 4898 } 4899 4900 // List: Lists a file's permissions. 4901 func (r *PermissionsService) List(fileId string) *PermissionsListCall { 4902 c := &PermissionsListCall{s: r.s, urlParams_: make(gensupport.URLParams)} 4903 c.fileId = fileId 4904 return c 4905 } 4906 4907 // Fields allows partial responses to be retrieved. See 4908 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 4909 // for more information. 4910 func (c *PermissionsListCall) Fields(s ...googleapi.Field) *PermissionsListCall { 4911 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 4912 return c 4913 } 4914 4915 // IfNoneMatch sets the optional parameter which makes the operation 4916 // fail if the object's ETag matches the given value. This is useful for 4917 // getting updates only after the object has changed since the last 4918 // request. Use googleapi.IsNotModified to check whether the response 4919 // error from Do is the result of In-None-Match. 4920 func (c *PermissionsListCall) IfNoneMatch(entityTag string) *PermissionsListCall { 4921 c.ifNoneMatch_ = entityTag 4922 return c 4923 } 4924 4925 // Context sets the context to be used in this call's Do method. Any 4926 // pending HTTP request will be aborted if the provided context is 4927 // canceled. 4928 func (c *PermissionsListCall) Context(ctx context.Context) *PermissionsListCall { 4929 c.ctx_ = ctx 4930 return c 4931 } 4932 4933 func (c *PermissionsListCall) doRequest(alt string) (*http.Response, error) { 4934 var body io.Reader = nil 4935 c.urlParams_.Set("alt", alt) 4936 urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/permissions") 4937 urls += "?" + c.urlParams_.Encode() 4938 req, _ := http.NewRequest("GET", urls, body) 4939 googleapi.Expand(req.URL, map[string]string{ 4940 "fileId": c.fileId, 4941 }) 4942 req.Header.Set("User-Agent", c.s.userAgent()) 4943 if c.ifNoneMatch_ != "" { 4944 req.Header.Set("If-None-Match", c.ifNoneMatch_) 4945 } 4946 if c.ctx_ != nil { 4947 return ctxhttp.Do(c.ctx_, c.s.client, req) 4948 } 4949 return c.s.client.Do(req) 4950 } 4951 4952 // Do executes the "drive.permissions.list" call. 4953 // Exactly one of *PermissionList or error will be non-nil. Any non-2xx 4954 // status code is an error. Response headers are in either 4955 // *PermissionList.ServerResponse.Header or (if a response was returned 4956 // at all) in error.(*googleapi.Error).Header. Use 4957 // googleapi.IsNotModified to check whether the returned error was 4958 // because http.StatusNotModified was returned. 4959 func (c *PermissionsListCall) Do(opts ...googleapi.CallOption) (*PermissionList, error) { 4960 gensupport.SetOptions(c.urlParams_, opts...) 4961 res, err := c.doRequest("json") 4962 if res != nil && res.StatusCode == http.StatusNotModified { 4963 if res.Body != nil { 4964 res.Body.Close() 4965 } 4966 return nil, &googleapi.Error{ 4967 Code: res.StatusCode, 4968 Header: res.Header, 4969 } 4970 } 4971 if err != nil { 4972 return nil, err 4973 } 4974 defer googleapi.CloseBody(res) 4975 if err := googleapi.CheckResponse(res); err != nil { 4976 return nil, err 4977 } 4978 ret := &PermissionList{ 4979 ServerResponse: googleapi.ServerResponse{ 4980 Header: res.Header, 4981 HTTPStatusCode: res.StatusCode, 4982 }, 4983 } 4984 if err := json.NewDecoder(res.Body).Decode(&ret); err != nil { 4985 return nil, err 4986 } 4987 return ret, nil 4988 // { 4989 // "description": "Lists a file's permissions.", 4990 // "httpMethod": "GET", 4991 // "id": "drive.permissions.list", 4992 // "parameterOrder": [ 4993 // "fileId" 4994 // ], 4995 // "parameters": { 4996 // "fileId": { 4997 // "description": "The ID of the file.", 4998 // "location": "path", 4999 // "required": true, 5000 // "type": "string" 5001 // } 5002 // }, 5003 // "path": "files/{fileId}/permissions", 5004 // "response": { 5005 // "$ref": "PermissionList" 5006 // }, 5007 // "scopes": [ 5008 // "https://www.googleapis.com/auth/drive", 5009 // "https://www.googleapis.com/auth/drive.file", 5010 // "https://www.googleapis.com/auth/drive.metadata", 5011 // "https://www.googleapis.com/auth/drive.metadata.readonly", 5012 // "https://www.googleapis.com/auth/drive.photos.readonly", 5013 // "https://www.googleapis.com/auth/drive.readonly" 5014 // ] 5015 // } 5016 5017 } 5018 5019 // method id "drive.permissions.update": 5020 5021 type PermissionsUpdateCall struct { 5022 s *Service 5023 fileId string 5024 permissionId string 5025 permission *Permission 5026 urlParams_ gensupport.URLParams 5027 ctx_ context.Context 5028 } 5029 5030 // Update: Updates a permission with patch semantics. 5031 func (r *PermissionsService) Update(fileId string, permissionId string, permission *Permission) *PermissionsUpdateCall { 5032 c := &PermissionsUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)} 5033 c.fileId = fileId 5034 c.permissionId = permissionId 5035 c.permission = permission 5036 return c 5037 } 5038 5039 // TransferOwnership sets the optional parameter "transferOwnership": 5040 // Whether to transfer ownership to the specified user and downgrade the 5041 // current owner to a writer. This parameter is required as an 5042 // acknowledgement of the side effect. 5043 func (c *PermissionsUpdateCall) TransferOwnership(transferOwnership bool) *PermissionsUpdateCall { 5044 c.urlParams_.Set("transferOwnership", fmt.Sprint(transferOwnership)) 5045 return c 5046 } 5047 5048 // Fields allows partial responses to be retrieved. See 5049 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 5050 // for more information. 5051 func (c *PermissionsUpdateCall) Fields(s ...googleapi.Field) *PermissionsUpdateCall { 5052 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 5053 return c 5054 } 5055 5056 // Context sets the context to be used in this call's Do method. Any 5057 // pending HTTP request will be aborted if the provided context is 5058 // canceled. 5059 func (c *PermissionsUpdateCall) Context(ctx context.Context) *PermissionsUpdateCall { 5060 c.ctx_ = ctx 5061 return c 5062 } 5063 5064 func (c *PermissionsUpdateCall) doRequest(alt string) (*http.Response, error) { 5065 var body io.Reader = nil 5066 body, err := googleapi.WithoutDataWrapper.JSONReader(c.permission) 5067 if err != nil { 5068 return nil, err 5069 } 5070 ctype := "application/json" 5071 c.urlParams_.Set("alt", alt) 5072 urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/permissions/{permissionId}") 5073 urls += "?" + c.urlParams_.Encode() 5074 req, _ := http.NewRequest("PATCH", urls, body) 5075 googleapi.Expand(req.URL, map[string]string{ 5076 "fileId": c.fileId, 5077 "permissionId": c.permissionId, 5078 }) 5079 req.Header.Set("Content-Type", ctype) 5080 req.Header.Set("User-Agent", c.s.userAgent()) 5081 if c.ctx_ != nil { 5082 return ctxhttp.Do(c.ctx_, c.s.client, req) 5083 } 5084 return c.s.client.Do(req) 5085 } 5086 5087 // Do executes the "drive.permissions.update" call. 5088 // Exactly one of *Permission or error will be non-nil. Any non-2xx 5089 // status code is an error. Response headers are in either 5090 // *Permission.ServerResponse.Header or (if a response was returned at 5091 // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified 5092 // to check whether the returned error was because 5093 // http.StatusNotModified was returned. 5094 func (c *PermissionsUpdateCall) Do(opts ...googleapi.CallOption) (*Permission, error) { 5095 gensupport.SetOptions(c.urlParams_, opts...) 5096 res, err := c.doRequest("json") 5097 if res != nil && res.StatusCode == http.StatusNotModified { 5098 if res.Body != nil { 5099 res.Body.Close() 5100 } 5101 return nil, &googleapi.Error{ 5102 Code: res.StatusCode, 5103 Header: res.Header, 5104 } 5105 } 5106 if err != nil { 5107 return nil, err 5108 } 5109 defer googleapi.CloseBody(res) 5110 if err := googleapi.CheckResponse(res); err != nil { 5111 return nil, err 5112 } 5113 ret := &Permission{ 5114 ServerResponse: googleapi.ServerResponse{ 5115 Header: res.Header, 5116 HTTPStatusCode: res.StatusCode, 5117 }, 5118 } 5119 if err := json.NewDecoder(res.Body).Decode(&ret); err != nil { 5120 return nil, err 5121 } 5122 return ret, nil 5123 // { 5124 // "description": "Updates a permission with patch semantics.", 5125 // "httpMethod": "PATCH", 5126 // "id": "drive.permissions.update", 5127 // "parameterOrder": [ 5128 // "fileId", 5129 // "permissionId" 5130 // ], 5131 // "parameters": { 5132 // "fileId": { 5133 // "description": "The ID of the file.", 5134 // "location": "path", 5135 // "required": true, 5136 // "type": "string" 5137 // }, 5138 // "permissionId": { 5139 // "description": "The ID of the permission.", 5140 // "location": "path", 5141 // "required": true, 5142 // "type": "string" 5143 // }, 5144 // "transferOwnership": { 5145 // "default": "false", 5146 // "description": "Whether to transfer ownership to the specified user and downgrade the current owner to a writer. This parameter is required as an acknowledgement of the side effect.", 5147 // "location": "query", 5148 // "type": "boolean" 5149 // } 5150 // }, 5151 // "path": "files/{fileId}/permissions/{permissionId}", 5152 // "request": { 5153 // "$ref": "Permission" 5154 // }, 5155 // "response": { 5156 // "$ref": "Permission" 5157 // }, 5158 // "scopes": [ 5159 // "https://www.googleapis.com/auth/drive", 5160 // "https://www.googleapis.com/auth/drive.file" 5161 // ] 5162 // } 5163 5164 } 5165 5166 // method id "drive.replies.create": 5167 5168 type RepliesCreateCall struct { 5169 s *Service 5170 fileId string 5171 commentId string 5172 reply *Reply 5173 urlParams_ gensupport.URLParams 5174 ctx_ context.Context 5175 } 5176 5177 // Create: Creates a new reply to a comment. 5178 func (r *RepliesService) Create(fileId string, commentId string, reply *Reply) *RepliesCreateCall { 5179 c := &RepliesCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)} 5180 c.fileId = fileId 5181 c.commentId = commentId 5182 c.reply = reply 5183 return c 5184 } 5185 5186 // Fields allows partial responses to be retrieved. See 5187 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 5188 // for more information. 5189 func (c *RepliesCreateCall) Fields(s ...googleapi.Field) *RepliesCreateCall { 5190 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 5191 return c 5192 } 5193 5194 // Context sets the context to be used in this call's Do method. Any 5195 // pending HTTP request will be aborted if the provided context is 5196 // canceled. 5197 func (c *RepliesCreateCall) Context(ctx context.Context) *RepliesCreateCall { 5198 c.ctx_ = ctx 5199 return c 5200 } 5201 5202 func (c *RepliesCreateCall) doRequest(alt string) (*http.Response, error) { 5203 var body io.Reader = nil 5204 body, err := googleapi.WithoutDataWrapper.JSONReader(c.reply) 5205 if err != nil { 5206 return nil, err 5207 } 5208 ctype := "application/json" 5209 c.urlParams_.Set("alt", alt) 5210 urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/comments/{commentId}/replies") 5211 urls += "?" + c.urlParams_.Encode() 5212 req, _ := http.NewRequest("POST", urls, body) 5213 googleapi.Expand(req.URL, map[string]string{ 5214 "fileId": c.fileId, 5215 "commentId": c.commentId, 5216 }) 5217 req.Header.Set("Content-Type", ctype) 5218 req.Header.Set("User-Agent", c.s.userAgent()) 5219 if c.ctx_ != nil { 5220 return ctxhttp.Do(c.ctx_, c.s.client, req) 5221 } 5222 return c.s.client.Do(req) 5223 } 5224 5225 // Do executes the "drive.replies.create" call. 5226 // Exactly one of *Reply or error will be non-nil. Any non-2xx status 5227 // code is an error. Response headers are in either 5228 // *Reply.ServerResponse.Header or (if a response was returned at all) 5229 // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 5230 // check whether the returned error was because http.StatusNotModified 5231 // was returned. 5232 func (c *RepliesCreateCall) Do(opts ...googleapi.CallOption) (*Reply, error) { 5233 gensupport.SetOptions(c.urlParams_, opts...) 5234 res, err := c.doRequest("json") 5235 if res != nil && res.StatusCode == http.StatusNotModified { 5236 if res.Body != nil { 5237 res.Body.Close() 5238 } 5239 return nil, &googleapi.Error{ 5240 Code: res.StatusCode, 5241 Header: res.Header, 5242 } 5243 } 5244 if err != nil { 5245 return nil, err 5246 } 5247 defer googleapi.CloseBody(res) 5248 if err := googleapi.CheckResponse(res); err != nil { 5249 return nil, err 5250 } 5251 ret := &Reply{ 5252 ServerResponse: googleapi.ServerResponse{ 5253 Header: res.Header, 5254 HTTPStatusCode: res.StatusCode, 5255 }, 5256 } 5257 if err := json.NewDecoder(res.Body).Decode(&ret); err != nil { 5258 return nil, err 5259 } 5260 return ret, nil 5261 // { 5262 // "description": "Creates a new reply to a comment.", 5263 // "httpMethod": "POST", 5264 // "id": "drive.replies.create", 5265 // "parameterOrder": [ 5266 // "fileId", 5267 // "commentId" 5268 // ], 5269 // "parameters": { 5270 // "commentId": { 5271 // "description": "The ID of the comment.", 5272 // "location": "path", 5273 // "required": true, 5274 // "type": "string" 5275 // }, 5276 // "fileId": { 5277 // "description": "The ID of the file.", 5278 // "location": "path", 5279 // "required": true, 5280 // "type": "string" 5281 // } 5282 // }, 5283 // "path": "files/{fileId}/comments/{commentId}/replies", 5284 // "request": { 5285 // "$ref": "Reply" 5286 // }, 5287 // "response": { 5288 // "$ref": "Reply" 5289 // }, 5290 // "scopes": [ 5291 // "https://www.googleapis.com/auth/drive", 5292 // "https://www.googleapis.com/auth/drive.file" 5293 // ] 5294 // } 5295 5296 } 5297 5298 // method id "drive.replies.delete": 5299 5300 type RepliesDeleteCall struct { 5301 s *Service 5302 fileId string 5303 commentId string 5304 replyId string 5305 urlParams_ gensupport.URLParams 5306 ctx_ context.Context 5307 } 5308 5309 // Delete: Deletes a reply. 5310 func (r *RepliesService) Delete(fileId string, commentId string, replyId string) *RepliesDeleteCall { 5311 c := &RepliesDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)} 5312 c.fileId = fileId 5313 c.commentId = commentId 5314 c.replyId = replyId 5315 return c 5316 } 5317 5318 // Fields allows partial responses to be retrieved. See 5319 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 5320 // for more information. 5321 func (c *RepliesDeleteCall) Fields(s ...googleapi.Field) *RepliesDeleteCall { 5322 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 5323 return c 5324 } 5325 5326 // Context sets the context to be used in this call's Do method. Any 5327 // pending HTTP request will be aborted if the provided context is 5328 // canceled. 5329 func (c *RepliesDeleteCall) Context(ctx context.Context) *RepliesDeleteCall { 5330 c.ctx_ = ctx 5331 return c 5332 } 5333 5334 func (c *RepliesDeleteCall) doRequest(alt string) (*http.Response, error) { 5335 var body io.Reader = nil 5336 c.urlParams_.Set("alt", alt) 5337 urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/comments/{commentId}/replies/{replyId}") 5338 urls += "?" + c.urlParams_.Encode() 5339 req, _ := http.NewRequest("DELETE", urls, body) 5340 googleapi.Expand(req.URL, map[string]string{ 5341 "fileId": c.fileId, 5342 "commentId": c.commentId, 5343 "replyId": c.replyId, 5344 }) 5345 req.Header.Set("User-Agent", c.s.userAgent()) 5346 if c.ctx_ != nil { 5347 return ctxhttp.Do(c.ctx_, c.s.client, req) 5348 } 5349 return c.s.client.Do(req) 5350 } 5351 5352 // Do executes the "drive.replies.delete" call. 5353 func (c *RepliesDeleteCall) Do(opts ...googleapi.CallOption) error { 5354 gensupport.SetOptions(c.urlParams_, opts...) 5355 res, err := c.doRequest("json") 5356 if err != nil { 5357 return err 5358 } 5359 defer googleapi.CloseBody(res) 5360 if err := googleapi.CheckResponse(res); err != nil { 5361 return err 5362 } 5363 return nil 5364 // { 5365 // "description": "Deletes a reply.", 5366 // "httpMethod": "DELETE", 5367 // "id": "drive.replies.delete", 5368 // "parameterOrder": [ 5369 // "fileId", 5370 // "commentId", 5371 // "replyId" 5372 // ], 5373 // "parameters": { 5374 // "commentId": { 5375 // "description": "The ID of the comment.", 5376 // "location": "path", 5377 // "required": true, 5378 // "type": "string" 5379 // }, 5380 // "fileId": { 5381 // "description": "The ID of the file.", 5382 // "location": "path", 5383 // "required": true, 5384 // "type": "string" 5385 // }, 5386 // "replyId": { 5387 // "description": "The ID of the reply.", 5388 // "location": "path", 5389 // "required": true, 5390 // "type": "string" 5391 // } 5392 // }, 5393 // "path": "files/{fileId}/comments/{commentId}/replies/{replyId}", 5394 // "scopes": [ 5395 // "https://www.googleapis.com/auth/drive", 5396 // "https://www.googleapis.com/auth/drive.file" 5397 // ] 5398 // } 5399 5400 } 5401 5402 // method id "drive.replies.get": 5403 5404 type RepliesGetCall struct { 5405 s *Service 5406 fileId string 5407 commentId string 5408 replyId string 5409 urlParams_ gensupport.URLParams 5410 ifNoneMatch_ string 5411 ctx_ context.Context 5412 } 5413 5414 // Get: Gets a reply by ID. 5415 func (r *RepliesService) Get(fileId string, commentId string, replyId string) *RepliesGetCall { 5416 c := &RepliesGetCall{s: r.s, urlParams_: make(gensupport.URLParams)} 5417 c.fileId = fileId 5418 c.commentId = commentId 5419 c.replyId = replyId 5420 return c 5421 } 5422 5423 // IncludeDeleted sets the optional parameter "includeDeleted": Whether 5424 // to return deleted replies. Deleted replies will not include their 5425 // original content. 5426 func (c *RepliesGetCall) IncludeDeleted(includeDeleted bool) *RepliesGetCall { 5427 c.urlParams_.Set("includeDeleted", fmt.Sprint(includeDeleted)) 5428 return c 5429 } 5430 5431 // Fields allows partial responses to be retrieved. See 5432 // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse 5433 // for more information. 5434 func (c *RepliesGetCall) Fields(s ...googleapi.Field) *RepliesGetCall { 5435 c.urlParams_.Set("fields", googleapi.CombineFields(s)) 5436 return c 5437 } 5438 5439 // IfNoneMatch sets the optional parameter which makes the operation 5440 // fail if the object's ETag matches the given value. This is useful for 5441 // getting updates only after the object has changed since the last 5442 // request. Use googleapi.IsNotModified to check whether the response 5443 // error from Do is the result of In-None-Match. 5444 func (c *RepliesGetCall) IfNoneMatch(entityTag string) *RepliesGetCall { 5445 c.ifNoneMatch_ = entityTag 5446 return c 5447 } 5448 5449 // Context sets the context to be used in this call's Do method. Any 5450 // pending HTTP request will be aborted if the provided context is 5451 // canceled. 5452 func (c *RepliesGetCall) Context(ctx context.Context) *RepliesGetCall { 5453 c.ctx_ = ctx 5454 return c 5455 } 5456 5457 func (c *RepliesGetCall) doRequest(alt string) (*http.Response, error) { 5458 var body io.Reader = nil 5459 c.urlParams_.Set("alt", alt) 5460 urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/comments/{commentId}/replies/{replyId}") 5461 urls += "?" + c.urlParams_.Encode() 5462 req, _ := http.NewRequest("GET", urls, body) 5463 googleapi.Expand(req.URL, map[string]string{ 5464 "fileId": c.fileId, 5465 "commentId": c.commentId, 5466 "replyId": c.replyId, 5467 }) 5468 req.Header.Set("User-Agent", c.s.userAgent()) 5469 if c.ifNoneMatch_ != "" { 5470 req.Header.Set("If-None-Match", c.ifNoneMatch_) 5471 } 5472 if c.ctx_ != nil { 5473 return ctxhttp.Do(c.ctx_, c.s.client, req) 5474 } 5475 return c.s.client.Do(req) 5476 } 5477 5478 // Do executes the "drive.replies.get" call. 5479 // Exactly one of *Reply or error will be non-nil. Any non-2xx status 5480 // code is an error. Response headers are in either 5481 // *Reply.ServerResponse.Header or (if a response was returned at all) 5482 // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to 5483 // check whether the returned error was because http.StatusNotModified 5484 // was returned. 5485 func (c *RepliesGetCall) Do(opts ...googleapi.CallOption) (*Reply, error) { 5486 gensupport.SetOptions(c.urlParams_, opts...) 5487 res, err := c.doRequest("json") 5488 if res != nil && res.StatusCode == http.StatusNotModified { 5489 if res.Body != nil { 5490 res.Body.Close() 5491 } 5492 return nil, &googleapi.Error{ 5493 Code: res.StatusCode, 5494 Header: res.Header, 5495 } 5496 } 5497 if err != nil { 5498 return nil, err 5499 } 5500 defer googleapi.CloseBody(res) 5501 if err := googleapi.CheckResponse(res); err != nil { 5502 return nil, err 5503 } 5504 ret := &Reply{ 5505 ServerResponse: googleapi.ServerResponse{ 5506 Header: res.Header, 5507 HTTPStatusCode: res.StatusCode, 5508 }, 5509 } 5510 if err := json.NewDecoder(res.Body).Decode(&ret); err != nil { 5511 return nil, err 5512 } 5513 return ret, nil 5514 // { 5515 // "description": "Gets a reply by ID.", 5516 // "httpMethod": "GET", 5517 // "id": "drive.replies.get", 5518 // "parameterOrder": [ 5519 // "fileId", 5520 // "commentId", 5521 // "replyId" 5522 // ], 5523 // "parameters": { 5524 // "commentId": { 5525 // "description": "The ID of the comment.", 5526 // "location": "path", 5527 // "required": true, 5528 // "type": "string" 5529 // }, 5530 // "fileId": { 5531 // "description": "The ID of the file.", 5532 // "location": "path", 5533 // "required": true, 5534 // "type": "string" 5535 // }, 5536 // "includeDeleted": { 5537 // "default": "false", 5538 // "description": "Whether to return deleted replies. Deleted replies will not include their original content.", 5539 // "location": "query", 5540 // "type": "boolean" 5541 // }, 5542 // "replyId": { 5543 // "description": "The ID of the reply.", 5544 // "location": "path", 5545 // "required": true, 5546 // "type": "string" 5547 // } 5548 // }, 5549 // "path": "files/{fileId}/comments/{commentId}/replies/{replyId}", 5550 // "response": { 5551 // "$ref": "Reply" 5552 // }, 5553 // "scopes": [ 5554 // "https://www.googleapis.com/auth/drive", 5555 // "https://www.googleapis.com/auth/drive.file", 5556 // "https://www.googleapis.com/auth/drive.readonly" 5557 // ] 5558 // } 5559 5560 } 5561 5562 // method id "drive.replies.list": 5563 5564 type RepliesListCall struct { 5565 s *Service