You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

9189 lines
311 KiB

  1. // Copyright 2019 Google LLC.
  2. // Use of this source code is governed by a BSD-style
  3. // license that can be found in the LICENSE file.
  4. // Code generated file. DO NOT EDIT.
  5. // Package drive provides access to the Drive API.
  6. //
  7. // For product documentation, see: https://developers.google.com/drive/
  8. //
  9. // Creating a client
  10. //
  11. // Usage example:
  12. //
  13. // import "google.golang.org/api/drive/v3"
  14. // ...
  15. // ctx := context.Background()
  16. // driveService, err := drive.NewService(ctx)
  17. //
  18. // In this example, Google Application Default Credentials are used for authentication.
  19. //
  20. // For information on how to create and obtain Application Default Credentials, see https://developers.google.com/identity/protocols/application-default-credentials.
  21. //
  22. // Other authentication options
  23. //
  24. // By default, all available scopes (see "Constants") are used to authenticate. To restrict scopes, use option.WithScopes:
  25. //
  26. // driveService, err := drive.NewService(ctx, option.WithScopes(drive.DriveScriptsScope))
  27. //
  28. // To use an API key for authentication (note: some APIs do not support API keys), use option.WithAPIKey:
  29. //
  30. // driveService, err := drive.NewService(ctx, option.WithAPIKey("AIza..."))
  31. //
  32. // To use an OAuth token (e.g., a user token obtained via a three-legged OAuth flow), use option.WithTokenSource:
  33. //
  34. // config := &oauth2.Config{...}
  35. // // ...
  36. // token, err := config.Exchange(ctx, ...)
  37. // driveService, err := drive.NewService(ctx, option.WithTokenSource(config.TokenSource(ctx, token)))
  38. //
  39. // See https://godoc.org/google.golang.org/api/option/ for details on options.
  40. package drive // import "google.golang.org/api/drive/v3"
  41. import (
  42. "bytes"
  43. "context"
  44. "encoding/json"
  45. "errors"
  46. "fmt"
  47. "io"
  48. "net/http"
  49. "net/url"
  50. "strconv"
  51. "strings"
  52. gensupport "google.golang.org/api/gensupport"
  53. googleapi "google.golang.org/api/googleapi"
  54. option "google.golang.org/api/option"
  55. htransport "google.golang.org/api/transport/http"
  56. )
  57. // Always reference these packages, just in case the auto-generated code
  58. // below doesn't.
  59. var _ = bytes.NewBuffer
  60. var _ = strconv.Itoa
  61. var _ = fmt.Sprintf
  62. var _ = json.NewDecoder
  63. var _ = io.Copy
  64. var _ = url.Parse
  65. var _ = gensupport.MarshalJSON
  66. var _ = googleapi.Version
  67. var _ = errors.New
  68. var _ = strings.Replace
  69. var _ = context.Canceled
  70. const apiId = "drive:v3"
  71. const apiName = "drive"
  72. const apiVersion = "v3"
  73. const basePath = "https://www.googleapis.com/drive/v3/"
  74. // OAuth2 scopes used by this API.
  75. const (
  76. // See, edit, create, and delete all of your Google Drive files
  77. DriveScope = "https://www.googleapis.com/auth/drive"
  78. // View and manage its own configuration data in your Google Drive
  79. DriveAppdataScope = "https://www.googleapis.com/auth/drive.appdata"
  80. // View and manage Google Drive files and folders that you have opened
  81. // or created with this app
  82. DriveFileScope = "https://www.googleapis.com/auth/drive.file"
  83. // View and manage metadata of files in your Google Drive
  84. DriveMetadataScope = "https://www.googleapis.com/auth/drive.metadata"
  85. // View metadata for files in your Google Drive
  86. DriveMetadataReadonlyScope = "https://www.googleapis.com/auth/drive.metadata.readonly"
  87. // View the photos, videos and albums in your Google Photos
  88. DrivePhotosReadonlyScope = "https://www.googleapis.com/auth/drive.photos.readonly"
  89. // See and download all your Google Drive files
  90. DriveReadonlyScope = "https://www.googleapis.com/auth/drive.readonly"
  91. // Modify your Google Apps Script scripts' behavior
  92. DriveScriptsScope = "https://www.googleapis.com/auth/drive.scripts"
  93. )
  94. // NewService creates a new Service.
  95. func NewService(ctx context.Context, opts ...option.ClientOption) (*Service, error) {
  96. scopesOption := option.WithScopes(
  97. "https://www.googleapis.com/auth/drive",
  98. "https://www.googleapis.com/auth/drive.appdata",
  99. "https://www.googleapis.com/auth/drive.file",
  100. "https://www.googleapis.com/auth/drive.metadata",
  101. "https://www.googleapis.com/auth/drive.metadata.readonly",
  102. "https://www.googleapis.com/auth/drive.photos.readonly",
  103. "https://www.googleapis.com/auth/drive.readonly",
  104. "https://www.googleapis.com/auth/drive.scripts",
  105. )
  106. // NOTE: prepend, so we don't override user-specified scopes.
  107. opts = append([]option.ClientOption{scopesOption}, opts...)
  108. client, endpoint, err := htransport.NewClient(ctx, opts...)
  109. if err != nil {
  110. return nil, err
  111. }
  112. s, err := New(client)
  113. if err != nil {
  114. return nil, err
  115. }
  116. if endpoint != "" {
  117. s.BasePath = endpoint
  118. }
  119. return s, nil
  120. }
  121. // New creates a new Service. It uses the provided http.Client for requests.
  122. //
  123. // Deprecated: please use NewService instead.
  124. // To provide a custom HTTP client, use option.WithHTTPClient.
  125. // If you are using google.golang.org/api/googleapis/transport.APIKey, use option.WithAPIKey with NewService instead.
  126. func New(client *http.Client) (*Service, error) {
  127. if client == nil {
  128. return nil, errors.New("client is nil")
  129. }
  130. s := &Service{client: client, BasePath: basePath}
  131. s.About = NewAboutService(s)
  132. s.Changes = NewChangesService(s)
  133. s.Channels = NewChannelsService(s)
  134. s.Comments = NewCommentsService(s)
  135. s.Files = NewFilesService(s)
  136. s.Permissions = NewPermissionsService(s)
  137. s.Replies = NewRepliesService(s)
  138. s.Revisions = NewRevisionsService(s)
  139. s.Teamdrives = NewTeamdrivesService(s)
  140. return s, nil
  141. }
  142. type Service struct {
  143. client *http.Client
  144. BasePath string // API endpoint base URL
  145. UserAgent string // optional additional User-Agent fragment
  146. About *AboutService
  147. Changes *ChangesService
  148. Channels *ChannelsService
  149. Comments *CommentsService
  150. Files *FilesService
  151. Permissions *PermissionsService
  152. Replies *RepliesService
  153. Revisions *RevisionsService
  154. Teamdrives *TeamdrivesService
  155. }
  156. func (s *Service) userAgent() string {
  157. if s.UserAgent == "" {
  158. return googleapi.UserAgent
  159. }
  160. return googleapi.UserAgent + " " + s.UserAgent
  161. }
  162. func NewAboutService(s *Service) *AboutService {
  163. rs := &AboutService{s: s}
  164. return rs
  165. }
  166. type AboutService struct {
  167. s *Service
  168. }
  169. func NewChangesService(s *Service) *ChangesService {
  170. rs := &ChangesService{s: s}
  171. return rs
  172. }
  173. type ChangesService struct {
  174. s *Service
  175. }
  176. func NewChannelsService(s *Service) *ChannelsService {
  177. rs := &ChannelsService{s: s}
  178. return rs
  179. }
  180. type ChannelsService struct {
  181. s *Service
  182. }
  183. func NewCommentsService(s *Service) *CommentsService {
  184. rs := &CommentsService{s: s}
  185. return rs
  186. }
  187. type CommentsService struct {
  188. s *Service
  189. }
  190. func NewFilesService(s *Service) *FilesService {
  191. rs := &FilesService{s: s}
  192. return rs
  193. }
  194. type FilesService struct {
  195. s *Service
  196. }
  197. func NewPermissionsService(s *Service) *PermissionsService {
  198. rs := &PermissionsService{s: s}
  199. return rs
  200. }
  201. type PermissionsService struct {
  202. s *Service
  203. }
  204. func NewRepliesService(s *Service) *RepliesService {
  205. rs := &RepliesService{s: s}
  206. return rs
  207. }
  208. type RepliesService struct {
  209. s *Service
  210. }
  211. func NewRevisionsService(s *Service) *RevisionsService {
  212. rs := &RevisionsService{s: s}
  213. return rs
  214. }
  215. type RevisionsService struct {
  216. s *Service
  217. }
  218. func NewTeamdrivesService(s *Service) *TeamdrivesService {
  219. rs := &TeamdrivesService{s: s}
  220. return rs
  221. }
  222. type TeamdrivesService struct {
  223. s *Service
  224. }
  225. // About: Information about the user, the user's Drive, and system
  226. // capabilities.
  227. type About struct {
  228. // AppInstalled: Whether the user has installed the requesting app.
  229. AppInstalled bool `json:"appInstalled,omitempty"`
  230. // CanCreateTeamDrives: Whether the user can create Team Drives.
  231. CanCreateTeamDrives bool `json:"canCreateTeamDrives,omitempty"`
  232. // ExportFormats: A map of source MIME type to possible targets for all
  233. // supported exports.
  234. ExportFormats map[string][]string `json:"exportFormats,omitempty"`
  235. // FolderColorPalette: The currently supported folder colors as RGB hex
  236. // strings.
  237. FolderColorPalette []string `json:"folderColorPalette,omitempty"`
  238. // ImportFormats: A map of source MIME type to possible targets for all
  239. // supported imports.
  240. ImportFormats map[string][]string `json:"importFormats,omitempty"`
  241. // Kind: Identifies what kind of resource this is. Value: the fixed
  242. // string "drive#about".
  243. Kind string `json:"kind,omitempty"`
  244. // MaxImportSizes: A map of maximum import sizes by MIME type, in bytes.
  245. MaxImportSizes map[string]string `json:"maxImportSizes,omitempty"`
  246. // MaxUploadSize: The maximum upload size in bytes.
  247. MaxUploadSize int64 `json:"maxUploadSize,omitempty,string"`
  248. // StorageQuota: The user's storage quota limits and usage. All fields
  249. // are measured in bytes.
  250. StorageQuota *AboutStorageQuota `json:"storageQuota,omitempty"`
  251. // TeamDriveThemes: A list of themes that are supported for Team Drives.
  252. TeamDriveThemes []*AboutTeamDriveThemes `json:"teamDriveThemes,omitempty"`
  253. // User: The authenticated user.
  254. User *User `json:"user,omitempty"`
  255. // ServerResponse contains the HTTP response code and headers from the
  256. // server.
  257. googleapi.ServerResponse `json:"-"`
  258. // ForceSendFields is a list of field names (e.g. "AppInstalled") to
  259. // unconditionally include in API requests. By default, fields with
  260. // empty values are omitted from API requests. However, any non-pointer,
  261. // non-interface field appearing in ForceSendFields will be sent to the
  262. // server regardless of whether the field is empty or not. This may be
  263. // used to include empty fields in Patch requests.
  264. ForceSendFields []string `json:"-"`
  265. // NullFields is a list of field names (e.g. "AppInstalled") to include
  266. // in API requests with the JSON null value. By default, fields with
  267. // empty values are omitted from API requests. However, any field with
  268. // an empty value appearing in NullFields will be sent to the server as
  269. // null. It is an error if a field in this list has a non-empty value.
  270. // This may be used to include null fields in Patch requests.
  271. NullFields []string `json:"-"`
  272. }
  273. func (s *About) MarshalJSON() ([]byte, error) {
  274. type NoMethod About
  275. raw := NoMethod(*s)
  276. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  277. }
  278. // AboutStorageQuota: The user's storage quota limits and usage. All
  279. // fields are measured in bytes.
  280. type AboutStorageQuota struct {
  281. // Limit: The usage limit, if applicable. This will not be present if
  282. // the user has unlimited storage.
  283. Limit int64 `json:"limit,omitempty,string"`
  284. // Usage: The total usage across all services.
  285. Usage int64 `json:"usage,omitempty,string"`
  286. // UsageInDrive: The usage by all files in Google Drive.
  287. UsageInDrive int64 `json:"usageInDrive,omitempty,string"`
  288. // UsageInDriveTrash: The usage by trashed files in Google Drive.
  289. UsageInDriveTrash int64 `json:"usageInDriveTrash,omitempty,string"`
  290. // ForceSendFields is a list of field names (e.g. "Limit") to
  291. // unconditionally include in API requests. By default, fields with
  292. // empty values are omitted from API requests. However, any non-pointer,
  293. // non-interface field appearing in ForceSendFields will be sent to the
  294. // server regardless of whether the field is empty or not. This may be
  295. // used to include empty fields in Patch requests.
  296. ForceSendFields []string `json:"-"`
  297. // NullFields is a list of field names (e.g. "Limit") to include in API
  298. // requests with the JSON null value. By default, fields with empty
  299. // values are omitted from API requests. However, any field with an
  300. // empty value appearing in NullFields will be sent to the server as
  301. // null. It is an error if a field in this list has a non-empty value.
  302. // This may be used to include null fields in Patch requests.
  303. NullFields []string `json:"-"`
  304. }
  305. func (s *AboutStorageQuota) MarshalJSON() ([]byte, error) {
  306. type NoMethod AboutStorageQuota
  307. raw := NoMethod(*s)
  308. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  309. }
  310. type AboutTeamDriveThemes struct {
  311. // BackgroundImageLink: A link to this Team Drive theme's background
  312. // image.
  313. BackgroundImageLink string `json:"backgroundImageLink,omitempty"`
  314. // ColorRgb: The color of this Team Drive theme as an RGB hex string.
  315. ColorRgb string `json:"colorRgb,omitempty"`
  316. // Id: The ID of the theme.
  317. Id string `json:"id,omitempty"`
  318. // ForceSendFields is a list of field names (e.g. "BackgroundImageLink")
  319. // to unconditionally include in API requests. By default, fields with
  320. // empty values are omitted from API requests. However, any non-pointer,
  321. // non-interface field appearing in ForceSendFields will be sent to the
  322. // server regardless of whether the field is empty or not. This may be
  323. // used to include empty fields in Patch requests.
  324. ForceSendFields []string `json:"-"`
  325. // NullFields is a list of field names (e.g. "BackgroundImageLink") to
  326. // include in API requests with the JSON null value. By default, fields
  327. // with empty values are omitted from API requests. However, any field
  328. // with an empty value appearing in NullFields will be sent to the
  329. // server as null. It is an error if a field in this list has a
  330. // non-empty value. This may be used to include null fields in Patch
  331. // requests.
  332. NullFields []string `json:"-"`
  333. }
  334. func (s *AboutTeamDriveThemes) MarshalJSON() ([]byte, error) {
  335. type NoMethod AboutTeamDriveThemes
  336. raw := NoMethod(*s)
  337. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  338. }
  339. // Change: A change to a file or Team Drive.
  340. type Change struct {
  341. // File: The updated state of the file. Present if the type is file and
  342. // the file has not been removed from this list of changes.
  343. File *File `json:"file,omitempty"`
  344. // FileId: The ID of the file which has changed.
  345. FileId string `json:"fileId,omitempty"`
  346. // Kind: Identifies what kind of resource this is. Value: the fixed
  347. // string "drive#change".
  348. Kind string `json:"kind,omitempty"`
  349. // Removed: Whether the file or Team Drive has been removed from this
  350. // list of changes, for example by deletion or loss of access.
  351. Removed bool `json:"removed,omitempty"`
  352. // TeamDrive: The updated state of the Team Drive. Present if the type
  353. // is teamDrive, the user is still a member of the Team Drive, and the
  354. // Team Drive has not been removed.
  355. TeamDrive *TeamDrive `json:"teamDrive,omitempty"`
  356. // TeamDriveId: The ID of the Team Drive associated with this change.
  357. TeamDriveId string `json:"teamDriveId,omitempty"`
  358. // Time: The time of this change (RFC 3339 date-time).
  359. Time string `json:"time,omitempty"`
  360. // Type: The type of the change. Possible values are file and teamDrive.
  361. Type string `json:"type,omitempty"`
  362. // ForceSendFields is a list of field names (e.g. "File") to
  363. // unconditionally include in API requests. By default, fields with
  364. // empty values are omitted from API requests. However, any non-pointer,
  365. // non-interface field appearing in ForceSendFields will be sent to the
  366. // server regardless of whether the field is empty or not. This may be
  367. // used to include empty fields in Patch requests.
  368. ForceSendFields []string `json:"-"`
  369. // NullFields is a list of field names (e.g. "File") to include in API
  370. // requests with the JSON null value. By default, fields with empty
  371. // values are omitted from API requests. However, any field with an
  372. // empty value appearing in NullFields will be sent to the server as
  373. // null. It is an error if a field in this list has a non-empty value.
  374. // This may be used to include null fields in Patch requests.
  375. NullFields []string `json:"-"`
  376. }
  377. func (s *Change) MarshalJSON() ([]byte, error) {
  378. type NoMethod Change
  379. raw := NoMethod(*s)
  380. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  381. }
  382. // ChangeList: A list of changes for a user.
  383. type ChangeList struct {
  384. // Changes: The list of changes. If nextPageToken is populated, then
  385. // this list may be incomplete and an additional page of results should
  386. // be fetched.
  387. Changes []*Change `json:"changes,omitempty"`
  388. // Kind: Identifies what kind of resource this is. Value: the fixed
  389. // string "drive#changeList".
  390. Kind string `json:"kind,omitempty"`
  391. // NewStartPageToken: The starting page token for future changes. This
  392. // will be present only if the end of the current changes list has been
  393. // reached.
  394. NewStartPageToken string `json:"newStartPageToken,omitempty"`
  395. // NextPageToken: The page token for the next page of changes. This will
  396. // be absent if the end of the changes list has been reached. If the
  397. // token is rejected for any reason, it should be discarded, and
  398. // pagination should be restarted from the first page of results.
  399. NextPageToken string `json:"nextPageToken,omitempty"`
  400. // ServerResponse contains the HTTP response code and headers from the
  401. // server.
  402. googleapi.ServerResponse `json:"-"`
  403. // ForceSendFields is a list of field names (e.g. "Changes") to
  404. // unconditionally include in API requests. By default, fields with
  405. // empty values are omitted from API requests. However, any non-pointer,
  406. // non-interface field appearing in ForceSendFields will be sent to the
  407. // server regardless of whether the field is empty or not. This may be
  408. // used to include empty fields in Patch requests.
  409. ForceSendFields []string `json:"-"`
  410. // NullFields is a list of field names (e.g. "Changes") to include in
  411. // API requests with the JSON null value. By default, fields with empty
  412. // values are omitted from API requests. However, any field with an
  413. // empty value appearing in NullFields will be sent to the server as
  414. // null. It is an error if a field in this list has a non-empty value.
  415. // This may be used to include null fields in Patch requests.
  416. NullFields []string `json:"-"`
  417. }
  418. func (s *ChangeList) MarshalJSON() ([]byte, error) {
  419. type NoMethod ChangeList
  420. raw := NoMethod(*s)
  421. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  422. }
  423. // Channel: An notification channel used to watch for resource changes.
  424. type Channel struct {
  425. // Address: The address where notifications are delivered for this
  426. // channel.
  427. Address string `json:"address,omitempty"`
  428. // Expiration: Date and time of notification channel expiration,
  429. // expressed as a Unix timestamp, in milliseconds. Optional.
  430. Expiration int64 `json:"expiration,omitempty,string"`
  431. // Id: A UUID or similar unique string that identifies this channel.
  432. Id string `json:"id,omitempty"`
  433. // Kind: Identifies this as a notification channel used to watch for
  434. // changes to a resource. Value: the fixed string "api#channel".
  435. Kind string `json:"kind,omitempty"`
  436. // Params: Additional parameters controlling delivery channel behavior.
  437. // Optional.
  438. Params map[string]string `json:"params,omitempty"`
  439. // Payload: A Boolean value to indicate whether payload is wanted.
  440. // Optional.
  441. Payload bool `json:"payload,omitempty"`
  442. // ResourceId: An opaque ID that identifies the resource being watched
  443. // on this channel. Stable across different API versions.
  444. ResourceId string `json:"resourceId,omitempty"`
  445. // ResourceUri: A version-specific identifier for the watched resource.
  446. ResourceUri string `json:"resourceUri,omitempty"`
  447. // Token: An arbitrary string delivered to the target address with each
  448. // notification delivered over this channel. Optional.
  449. Token string `json:"token,omitempty"`
  450. // Type: The type of delivery mechanism used for this channel.
  451. Type string `json:"type,omitempty"`
  452. // ServerResponse contains the HTTP response code and headers from the
  453. // server.
  454. googleapi.ServerResponse `json:"-"`
  455. // ForceSendFields is a list of field names (e.g. "Address") to
  456. // unconditionally include in API requests. By default, fields with
  457. // empty values are omitted from API requests. However, any non-pointer,
  458. // non-interface field appearing in ForceSendFields will be sent to the
  459. // server regardless of whether the field is empty or not. This may be
  460. // used to include empty fields in Patch requests.
  461. ForceSendFields []string `json:"-"`
  462. // NullFields is a list of field names (e.g. "Address") to include in
  463. // API requests with the JSON null value. By default, fields with empty
  464. // values are omitted from API requests. However, any field with an
  465. // empty value appearing in NullFields will be sent to the server as
  466. // null. It is an error if a field in this list has a non-empty value.
  467. // This may be used to include null fields in Patch requests.
  468. NullFields []string `json:"-"`
  469. }
  470. func (s *Channel) MarshalJSON() ([]byte, error) {
  471. type NoMethod Channel
  472. raw := NoMethod(*s)
  473. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  474. }
  475. // Comment: A comment on a file.
  476. type Comment struct {
  477. // Anchor: A region of the document represented as a JSON string. See
  478. // anchor documentation for details on how to define and interpret
  479. // anchor properties.
  480. Anchor string `json:"anchor,omitempty"`
  481. // Author: The user who created the comment.
  482. Author *User `json:"author,omitempty"`
  483. // Content: The plain text content of the comment. This field is used
  484. // for setting the content, while htmlContent should be displayed.
  485. Content string `json:"content,omitempty"`
  486. // CreatedTime: The time at which the comment was created (RFC 3339
  487. // date-time).
  488. CreatedTime string `json:"createdTime,omitempty"`
  489. // Deleted: Whether the comment has been deleted. A deleted comment has
  490. // no content.
  491. Deleted bool `json:"deleted,omitempty"`
  492. // HtmlContent: The content of the comment with HTML formatting.
  493. HtmlContent string `json:"htmlContent,omitempty"`
  494. // Id: The ID of the comment.
  495. Id string `json:"id,omitempty"`
  496. // Kind: Identifies what kind of resource this is. Value: the fixed
  497. // string "drive#comment".
  498. Kind string `json:"kind,omitempty"`
  499. // ModifiedTime: The last time the comment or any of its replies was
  500. // modified (RFC 3339 date-time).
  501. ModifiedTime string `json:"modifiedTime,omitempty"`
  502. // QuotedFileContent: The file content to which the comment refers,
  503. // typically within the anchor region. For a text file, for example,
  504. // this would be the text at the location of the comment.
  505. QuotedFileContent *CommentQuotedFileContent `json:"quotedFileContent,omitempty"`
  506. // Replies: The full list of replies to the comment in chronological
  507. // order.
  508. Replies []*Reply `json:"replies,omitempty"`
  509. // Resolved: Whether the comment has been resolved by one of its
  510. // replies.
  511. Resolved bool `json:"resolved,omitempty"`
  512. // ServerResponse contains the HTTP response code and headers from the
  513. // server.
  514. googleapi.ServerResponse `json:"-"`
  515. // ForceSendFields is a list of field names (e.g. "Anchor") to
  516. // unconditionally include in API requests. By default, fields with
  517. // empty values are omitted from API requests. However, any non-pointer,
  518. // non-interface field appearing in ForceSendFields will be sent to the
  519. // server regardless of whether the field is empty or not. This may be
  520. // used to include empty fields in Patch requests.
  521. ForceSendFields []string `json:"-"`
  522. // NullFields is a list of field names (e.g. "Anchor") to include in API
  523. // requests with the JSON null value. By default, fields with empty
  524. // values are omitted from API requests. However, any field with an
  525. // empty value appearing in NullFields will be sent to the server as
  526. // null. It is an error if a field in this list has a non-empty value.
  527. // This may be used to include null fields in Patch requests.
  528. NullFields []string `json:"-"`
  529. }
  530. func (s *Comment) MarshalJSON() ([]byte, error) {
  531. type NoMethod Comment
  532. raw := NoMethod(*s)
  533. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  534. }
  535. // CommentQuotedFileContent: The file content to which the comment
  536. // refers, typically within the anchor region. For a text file, for
  537. // example, this would be the text at the location of the comment.
  538. type CommentQuotedFileContent struct {
  539. // MimeType: The MIME type of the quoted content.
  540. MimeType string `json:"mimeType,omitempty"`
  541. // Value: The quoted content itself. This is interpreted as plain text
  542. // if set through the API.
  543. Value string `json:"value,omitempty"`
  544. // ForceSendFields is a list of field names (e.g. "MimeType") to
  545. // unconditionally include in API requests. By default, fields with
  546. // empty values are omitted from API requests. However, any non-pointer,
  547. // non-interface field appearing in ForceSendFields will be sent to the
  548. // server regardless of whether the field is empty or not. This may be
  549. // used to include empty fields in Patch requests.
  550. ForceSendFields []string `json:"-"`
  551. // NullFields is a list of field names (e.g. "MimeType") to include in
  552. // API requests with the JSON null value. By default, fields with empty
  553. // values are omitted from API requests. However, any field with an
  554. // empty value appearing in NullFields will be sent to the server as
  555. // null. It is an error if a field in this list has a non-empty value.
  556. // This may be used to include null fields in Patch requests.
  557. NullFields []string `json:"-"`
  558. }
  559. func (s *CommentQuotedFileContent) MarshalJSON() ([]byte, error) {
  560. type NoMethod CommentQuotedFileContent
  561. raw := NoMethod(*s)
  562. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  563. }
  564. // CommentList: A list of comments on a file.
  565. type CommentList struct {
  566. // Comments: The list of comments. If nextPageToken is populated, then
  567. // this list may be incomplete and an additional page of results should
  568. // be fetched.
  569. Comments []*Comment `json:"comments,omitempty"`
  570. // Kind: Identifies what kind of resource this is. Value: the fixed
  571. // string "drive#commentList".
  572. Kind string `json:"kind,omitempty"`
  573. // NextPageToken: The page token for the next page of comments. This
  574. // will be absent if the end of the comments list has been reached. If
  575. // the token is rejected for any reason, it should be discarded, and
  576. // pagination should be restarted from the first page of results.
  577. NextPageToken string `json:"nextPageToken,omitempty"`
  578. // ServerResponse contains the HTTP response code and headers from the
  579. // server.
  580. googleapi.ServerResponse `json:"-"`
  581. // ForceSendFields is a list of field names (e.g. "Comments") to
  582. // unconditionally include in API requests. By default, fields with
  583. // empty values are omitted from API requests. However, any non-pointer,
  584. // non-interface field appearing in ForceSendFields will be sent to the
  585. // server regardless of whether the field is empty or not. This may be
  586. // used to include empty fields in Patch requests.
  587. ForceSendFields []string `json:"-"`
  588. // NullFields is a list of field names (e.g. "Comments") to include in
  589. // API requests with the JSON null value. By default, fields with empty
  590. // values are omitted from API requests. However, any field with an
  591. // empty value appearing in NullFields will be sent to the server as
  592. // null. It is an error if a field in this list has a non-empty value.
  593. // This may be used to include null fields in Patch requests.
  594. NullFields []string `json:"-"`
  595. }
  596. func (s *CommentList) MarshalJSON() ([]byte, error) {
  597. type NoMethod CommentList
  598. raw := NoMethod(*s)
  599. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  600. }
  601. // File: The metadata for a file.
  602. type File struct {
  603. // AppProperties: A collection of arbitrary key-value pairs which are
  604. // private to the requesting app.
  605. // Entries with null values are cleared in update and copy requests.
  606. AppProperties map[string]string `json:"appProperties,omitempty"`
  607. // Capabilities: Capabilities the current user has on this file. Each
  608. // capability corresponds to a fine-grained action that a user may take.
  609. Capabilities *FileCapabilities `json:"capabilities,omitempty"`
  610. // ContentHints: Additional information about the content of the file.
  611. // These fields are never populated in responses.
  612. ContentHints *FileContentHints `json:"contentHints,omitempty"`
  613. // CopyRequiresWriterPermission: Whether the options to copy, print, or
  614. // download this file, should be disabled for readers and commenters.
  615. CopyRequiresWriterPermission bool `json:"copyRequiresWriterPermission,omitempty"`
  616. // CreatedTime: The time at which the file was created (RFC 3339
  617. // date-time).
  618. CreatedTime string `json:"createdTime,omitempty"`
  619. // Description: A short description of the file.
  620. Description string `json:"description,omitempty"`
  621. // ExplicitlyTrashed: Whether the file has been explicitly trashed, as
  622. // opposed to recursively trashed from a parent folder.
  623. ExplicitlyTrashed bool `json:"explicitlyTrashed,omitempty"`
  624. // ExportLinks: Links for exporting Google Docs to specific formats.
  625. ExportLinks map[string]string `json:"exportLinks,omitempty"`
  626. // FileExtension: The final component of fullFileExtension. This is only
  627. // available for files with binary content in Drive.
  628. FileExtension string `json:"fileExtension,omitempty"`
  629. // FolderColorRgb: The color for a folder as an RGB hex string. The
  630. // supported colors are published in the folderColorPalette field of the
  631. // About resource.
  632. // If an unsupported color is specified, the closest color in the
  633. // palette will be used instead.
  634. FolderColorRgb string `json:"folderColorRgb,omitempty"`
  635. // FullFileExtension: The full file extension extracted from the name
  636. // field. May contain multiple concatenated extensions, such as
  637. // "tar.gz". This is only available for files with binary content in
  638. // Drive.
  639. // This is automatically updated when the name field changes, however it
  640. // is not cleared if the new name does not contain a valid extension.
  641. FullFileExtension string `json:"fullFileExtension,omitempty"`
  642. // HasAugmentedPermissions: Whether any users are granted file access
  643. // directly on this file. This field is only populated for Team Drive
  644. // files.
  645. HasAugmentedPermissions bool `json:"hasAugmentedPermissions,omitempty"`
  646. // HasThumbnail: Whether this file has a thumbnail. This does not
  647. // indicate whether the requesting app has access to the thumbnail. To
  648. // check access, look for the presence of the thumbnailLink field.
  649. HasThumbnail bool `json:"hasThumbnail,omitempty"`
  650. // HeadRevisionId: The ID of the file's head revision. This is currently
  651. // only available for files with binary content in Drive.
  652. HeadRevisionId string `json:"headRevisionId,omitempty"`
  653. // IconLink: A static, unauthenticated link to the file's icon.
  654. IconLink string `json:"iconLink,omitempty"`
  655. // Id: The ID of the file.
  656. Id string `json:"id,omitempty"`
  657. // ImageMediaMetadata: Additional metadata about image media, if
  658. // available.
  659. ImageMediaMetadata *FileImageMediaMetadata `json:"imageMediaMetadata,omitempty"`
  660. // IsAppAuthorized: Whether the file was created or opened by the
  661. // requesting app.
  662. IsAppAuthorized bool `json:"isAppAuthorized,omitempty"`
  663. // Kind: Identifies what kind of resource this is. Value: the fixed
  664. // string "drive#file".
  665. Kind string `json:"kind,omitempty"`
  666. // LastModifyingUser: The last user to modify the file.
  667. LastModifyingUser *User `json:"lastModifyingUser,omitempty"`
  668. // Md5Checksum: The MD5 checksum for the content of the file. This is
  669. // only applicable to files with binary content in Drive.
  670. Md5Checksum string `json:"md5Checksum,omitempty"`
  671. // MimeType: The MIME type of the file.
  672. // Drive will attempt to automatically detect an appropriate value from
  673. // uploaded content if no value is provided. The value cannot be changed
  674. // unless a new revision is uploaded.
  675. // If a file is created with a Google Doc MIME type, the uploaded
  676. // content will be imported if possible. The supported import formats
  677. // are published in the About resource.
  678. MimeType string `json:"mimeType,omitempty"`
  679. // ModifiedByMe: Whether the file has been modified by this user.
  680. ModifiedByMe bool `json:"modifiedByMe,omitempty"`
  681. // ModifiedByMeTime: The last time the file was modified by the user
  682. // (RFC 3339 date-time).
  683. ModifiedByMeTime string `json:"modifiedByMeTime,omitempty"`
  684. // ModifiedTime: The last time the file was modified by anyone (RFC 3339
  685. // date-time).
  686. // Note that setting modifiedTime will also update modifiedByMeTime for
  687. // the user.
  688. ModifiedTime string `json:"modifiedTime,omitempty"`
  689. // Name: The name of the file. This is not necessarily unique within a
  690. // folder. Note that for immutable items such as the top level folders
  691. // of Team Drives, My Drive root folder, and Application Data folder the
  692. // name is constant.
  693. Name string `json:"name,omitempty"`
  694. // OriginalFilename: The original filename of the uploaded content if
  695. // available, or else the original value of the name field. This is only
  696. // available for files with binary content in Drive.
  697. OriginalFilename string `json:"originalFilename,omitempty"`
  698. // OwnedByMe: Whether the user owns the file. Not populated for Team
  699. // Drive files.
  700. OwnedByMe bool `json:"ownedByMe,omitempty"`
  701. // Owners: The owners of the file. Currently, only certain legacy files
  702. // may have more than one owner. Not populated for Team Drive files.
  703. Owners []*User `json:"owners,omitempty"`
  704. // Parents: The IDs of the parent folders which contain the file.
  705. // If not specified as part of a create request, the file will be placed
  706. // directly in the user's My Drive folder. If not specified as part of a
  707. // copy request, the file will inherit any discoverable parents of the
  708. // source file. Update requests must use the addParents and
  709. // removeParents parameters to modify the parents list.
  710. Parents []string `json:"parents,omitempty"`
  711. // PermissionIds: List of permission IDs for users with access to this
  712. // file.
  713. PermissionIds []string `json:"permissionIds,omitempty"`
  714. // Permissions: The full list of permissions for the file. This is only
  715. // available if the requesting user can share the file. Not populated
  716. // for Team Drive files.
  717. Permissions []*Permission `json:"permissions,omitempty"`
  718. // Properties: A collection of arbitrary key-value pairs which are
  719. // visible to all apps.
  720. // Entries with null values are cleared in update and copy requests.
  721. Properties map[string]string `json:"properties,omitempty"`
  722. // QuotaBytesUsed: The number of storage quota bytes used by the file.
  723. // This includes the head revision as well as previous revisions with
  724. // keepForever enabled.
  725. QuotaBytesUsed int64 `json:"quotaBytesUsed,omitempty,string"`
  726. // Shared: Whether the file has been shared. Not populated for Team
  727. // Drive files.
  728. Shared bool `json:"shared,omitempty"`
  729. // SharedWithMeTime: The time at which the file was shared with the
  730. // user, if applicable (RFC 3339 date-time).
  731. SharedWithMeTime string `json:"sharedWithMeTime,omitempty"`
  732. // SharingUser: The user who shared the file with the requesting user,
  733. // if applicable.
  734. SharingUser *User `json:"sharingUser,omitempty"`
  735. // Size: The size of the file's content in bytes. This is only
  736. // applicable to files with binary content in Drive.
  737. Size int64 `json:"size,omitempty,string"`
  738. // Spaces: The list of spaces which contain the file. The currently
  739. // supported values are 'drive', 'appDataFolder' and 'photos'.
  740. Spaces []string `json:"spaces,omitempty"`
  741. // Starred: Whether the user has starred the file.
  742. Starred bool `json:"starred,omitempty"`
  743. // TeamDriveId: ID of the Team Drive the file resides in.
  744. TeamDriveId string `json:"teamDriveId,omitempty"`
  745. // ThumbnailLink: A short-lived link to the file's thumbnail, if
  746. // available. Typically lasts on the order of hours. Only populated when
  747. // the requesting app can access the file's content.
  748. ThumbnailLink string `json:"thumbnailLink,omitempty"`
  749. // ThumbnailVersion: The thumbnail version for use in thumbnail cache
  750. // invalidation.
  751. ThumbnailVersion int64 `json:"thumbnailVersion,omitempty,string"`
  752. // Trashed: Whether the file has been trashed, either explicitly or from
  753. // a trashed parent folder. Only the owner may trash a file, and other
  754. // users cannot see files in the owner's trash.
  755. Trashed bool `json:"trashed,omitempty"`
  756. // TrashedTime: The time that the item was trashed (RFC 3339 date-time).
  757. // Only populated for Team Drive files.
  758. TrashedTime string `json:"trashedTime,omitempty"`
  759. // TrashingUser: If the file has been explicitly trashed, the user who
  760. // trashed it. Only populated for Team Drive files.
  761. TrashingUser *User `json:"trashingUser,omitempty"`
  762. // Version: A monotonically increasing version number for the file. This
  763. // reflects every change made to the file on the server, even those not
  764. // visible to the user.
  765. Version int64 `json:"version,omitempty,string"`
  766. // VideoMediaMetadata: Additional metadata about video media. This may
  767. // not be available immediately upon upload.
  768. VideoMediaMetadata *FileVideoMediaMetadata `json:"videoMediaMetadata,omitempty"`
  769. // ViewedByMe: Whether the file has been viewed by this user.
  770. ViewedByMe bool `json:"viewedByMe,omitempty"`
  771. // ViewedByMeTime: The last time the file was viewed by the user (RFC
  772. // 3339 date-time).
  773. ViewedByMeTime string `json:"viewedByMeTime,omitempty"`
  774. // ViewersCanCopyContent: Deprecated - use copyRequiresWriterPermission
  775. // instead.
  776. ViewersCanCopyContent bool `json:"viewersCanCopyContent,omitempty"`
  777. // WebContentLink: A link for downloading the content of the file in a
  778. // browser. This is only available for files with binary content in
  779. // Drive.
  780. WebContentLink string `json:"webContentLink,omitempty"`
  781. // WebViewLink: A link for opening the file in a relevant Google editor
  782. // or viewer in a browser.
  783. WebViewLink string `json:"webViewLink,omitempty"`
  784. // WritersCanShare: Whether users with only writer permission can modify
  785. // the file's permissions. Not populated for Team Drive files.
  786. WritersCanShare bool `json:"writersCanShare,omitempty"`
  787. // ServerResponse contains the HTTP response code and headers from the
  788. // server.
  789. googleapi.ServerResponse `json:"-"`
  790. // ForceSendFields is a list of field names (e.g. "AppProperties") to
  791. // unconditionally include in API requests. By default, fields with
  792. // empty values are omitted from API requests. However, any non-pointer,
  793. // non-interface field appearing in ForceSendFields will be sent to the
  794. // server regardless of whether the field is empty or not. This may be
  795. // used to include empty fields in Patch requests.
  796. ForceSendFields []string `json:"-"`
  797. // NullFields is a list of field names (e.g. "AppProperties") to include
  798. // in API requests with the JSON null value. By default, fields with
  799. // empty values are omitted from API requests. However, any field with
  800. // an empty value appearing in NullFields will be sent to the server as
  801. // null. It is an error if a field in this list has a non-empty value.
  802. // This may be used to include null fields in Patch requests.
  803. NullFields []string `json:"-"`
  804. }
  805. func (s *File) MarshalJSON() ([]byte, error) {
  806. type NoMethod File
  807. raw := NoMethod(*s)
  808. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  809. }
  810. // FileCapabilities: Capabilities the current user has on this file.
  811. // Each capability corresponds to a fine-grained action that a user may
  812. // take.
  813. type FileCapabilities struct {
  814. // CanAddChildren: Whether the current user can add children to this
  815. // folder. This is always false when the item is not a folder.
  816. CanAddChildren bool `json:"canAddChildren,omitempty"`
  817. // CanChangeCopyRequiresWriterPermission: Whether the current user can
  818. // change the copyRequiresWriterPermission restriction of this file.
  819. CanChangeCopyRequiresWriterPermission bool `json:"canChangeCopyRequiresWriterPermission,omitempty"`
  820. // CanChangeViewersCanCopyContent: Deprecated
  821. CanChangeViewersCanCopyContent bool `json:"canChangeViewersCanCopyContent,omitempty"`
  822. // CanComment: Whether the current user can comment on this file.
  823. CanComment bool `json:"canComment,omitempty"`
  824. // CanCopy: Whether the current user can copy this file. For a Team
  825. // Drive item, whether the current user can copy non-folder descendants
  826. // of this item, or this item itself if it is not a folder.
  827. CanCopy bool `json:"canCopy,omitempty"`
  828. // CanDelete: Whether the current user can delete this file.
  829. CanDelete bool `json:"canDelete,omitempty"`
  830. // CanDeleteChildren: Whether the current user can delete children of
  831. // this folder. This is false when the item is not a folder. Only
  832. // populated for Team Drive items.
  833. CanDeleteChildren bool `json:"canDeleteChildren,omitempty"`
  834. // CanDownload: Whether the current user can download this file.
  835. CanDownload bool `json:"canDownload,omitempty"`
  836. // CanEdit: Whether the current user can edit this file.
  837. CanEdit bool `json:"canEdit,omitempty"`
  838. // CanListChildren: Whether the current user can list the children of
  839. // this folder. This is always false when the item is not a folder.
  840. CanListChildren bool `json:"canListChildren,omitempty"`
  841. // CanMoveChildrenOutOfTeamDrive: Whether the current user can move
  842. // children of this folder outside of the Team Drive. This is false when
  843. // the item is not a folder. Only populated for Team Drive items.
  844. CanMoveChildrenOutOfTeamDrive bool `json:"canMoveChildrenOutOfTeamDrive,omitempty"`
  845. // CanMoveChildrenWithinTeamDrive: Whether the current user can move
  846. // children of this folder within the Team Drive. This is false when the
  847. // item is not a folder. Only populated for Team Drive items.
  848. CanMoveChildrenWithinTeamDrive bool `json:"canMoveChildrenWithinTeamDrive,omitempty"`
  849. // CanMoveItemIntoTeamDrive: Whether the current user can move this item
  850. // into a Team Drive. If the item is in a Team Drive, this field is
  851. // equivalent to canMoveTeamDriveItem.
  852. CanMoveItemIntoTeamDrive bool `json:"canMoveItemIntoTeamDrive,omitempty"`
  853. // CanMoveItemOutOfTeamDrive: Whether the current user can move this
  854. // Team Drive item outside of this Team Drive by changing its parent.
  855. // Note that a request to change the parent of the item may still fail
  856. // depending on the new parent that is being added. Only populated for
  857. // Team Drive items.
  858. CanMoveItemOutOfTeamDrive bool `json:"canMoveItemOutOfTeamDrive,omitempty"`
  859. // CanMoveItemWithinTeamDrive: Whether the current user can move this
  860. // Team Drive item within this Team Drive. Note that a request to change
  861. // the parent of the item may still fail depending on the new parent
  862. // that is being added. Only populated for Team Drive items.
  863. CanMoveItemWithinTeamDrive bool `json:"canMoveItemWithinTeamDrive,omitempty"`
  864. // CanMoveTeamDriveItem: Deprecated - use canMoveItemWithinTeamDrive or
  865. // canMoveItemOutOfTeamDrive instead.
  866. CanMoveTeamDriveItem bool `json:"canMoveTeamDriveItem,omitempty"`
  867. // CanReadRevisions: Whether the current user can read the revisions
  868. // resource of this file. For a Team Drive item, whether revisions of
  869. // non-folder descendants of this item, or this item itself if it is not
  870. // a folder, can be read.
  871. CanReadRevisions bool `json:"canReadRevisions,omitempty"`
  872. // CanReadTeamDrive: Whether the current user can read the Team Drive to
  873. // which this file belongs. Only populated for Team Drive files.
  874. CanReadTeamDrive bool `json:"canReadTeamDrive,omitempty"`
  875. // CanRemoveChildren: Whether the current user can remove children from
  876. // this folder. This is always false when the item is not a folder. For
  877. // Team Drive items, use canDeleteChildren or canTrashChildren instead.
  878. CanRemoveChildren bool `json:"canRemoveChildren,omitempty"`
  879. // CanRename: Whether the current user can rename this file.
  880. CanRename bool `json:"canRename,omitempty"`
  881. // CanShare: Whether the current user can modify the sharing settings
  882. // for this file.
  883. CanShare bool `json:"canShare,omitempty"`
  884. // CanTrash: Whether the current user can move this file to trash.
  885. CanTrash bool `json:"canTrash,omitempty"`
  886. // CanTrashChildren: Whether the current user can trash children of this
  887. // folder. This is false when the item is not a folder. Only populated
  888. // for Team Drive items.
  889. CanTrashChildren bool `json:"canTrashChildren,omitempty"`
  890. // CanUntrash: Whether the current user can restore this file from
  891. // trash.
  892. CanUntrash bool `json:"canUntrash,omitempty"`
  893. // ForceSendFields is a list of field names (e.g. "CanAddChildren") to
  894. // unconditionally include in API requests. By default, fields with
  895. // empty values are omitted from API requests. However, any non-pointer,
  896. // non-interface field appearing in ForceSendFields will be sent to the
  897. // server regardless of whether the field is empty or not. This may be
  898. // used to include empty fields in Patch requests.
  899. ForceSendFields []string `json:"-"`
  900. // NullFields is a list of field names (e.g. "CanAddChildren") to
  901. // include in API requests with the JSON null value. By default, fields
  902. // with empty values are omitted from API requests. However, any field
  903. // with an empty value appearing in NullFields will be sent to the
  904. // server as null. It is an error if a field in this list has a
  905. // non-empty value. This may be used to include null fields in Patch
  906. // requests.
  907. NullFields []string `json:"-"`
  908. }
  909. func (s *FileCapabilities) MarshalJSON() ([]byte, error) {
  910. type NoMethod FileCapabilities
  911. raw := NoMethod(*s)
  912. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  913. }
  914. // FileContentHints: Additional information about the content of the
  915. // file. These fields are never populated in responses.
  916. type FileContentHints struct {
  917. // IndexableText: Text to be indexed for the file to improve fullText
  918. // queries. This is limited to 128KB in length and may contain HTML
  919. // elements.
  920. IndexableText string `json:"indexableText,omitempty"`
  921. // Thumbnail: A thumbnail for the file. This will only be used if Drive
  922. // cannot generate a standard thumbnail.
  923. Thumbnail *FileContentHintsThumbnail `json:"thumbnail,omitempty"`
  924. // ForceSendFields is a list of field names (e.g. "IndexableText") to
  925. // unconditionally include in API requests. By default, fields with
  926. // empty values are omitted from API requests. However, any non-pointer,
  927. // non-interface field appearing in ForceSendFields will be sent to the
  928. // server regardless of whether the field is empty or not. This may be
  929. // used to include empty fields in Patch requests.
  930. ForceSendFields []string `json:"-"`
  931. // NullFields is a list of field names (e.g. "IndexableText") to include
  932. // in API requests with the JSON null value. By default, fields with
  933. // empty values are omitted from API requests. However, any field with
  934. // an empty value appearing in NullFields will be sent to the server as
  935. // null. It is an error if a field in this list has a non-empty value.
  936. // This may be used to include null fields in Patch requests.
  937. NullFields []string `json:"-"`
  938. }
  939. func (s *FileContentHints) MarshalJSON() ([]byte, error) {
  940. type NoMethod FileContentHints
  941. raw := NoMethod(*s)
  942. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  943. }
  944. // FileContentHintsThumbnail: A thumbnail for the file. This will only
  945. // be used if Drive cannot generate a standard thumbnail.
  946. type FileContentHintsThumbnail struct {
  947. // Image: The thumbnail data encoded with URL-safe Base64 (RFC 4648
  948. // section 5).
  949. Image string `json:"image,omitempty"`
  950. // MimeType: The MIME type of the thumbnail.
  951. MimeType string `json:"mimeType,omitempty"`
  952. // ForceSendFields is a list of field names (e.g. "Image") to
  953. // unconditionally include in API requests. By default, fields with
  954. // empty values are omitted from API requests. However, any non-pointer,
  955. // non-interface field appearing in ForceSendFields will be sent to the
  956. // server regardless of whether the field is empty or not. This may be
  957. // used to include empty fields in Patch requests.
  958. ForceSendFields []string `json:"-"`
  959. // NullFields is a list of field names (e.g. "Image") to include in API
  960. // requests with the JSON null value. By default, fields with empty
  961. // values are omitted from API requests. However, any field with an
  962. // empty value appearing in NullFields will be sent to the server as
  963. // null. It is an error if a field in this list has a non-empty value.
  964. // This may be used to include null fields in Patch requests.
  965. NullFields []string `json:"-"`
  966. }
  967. func (s *FileContentHintsThumbnail) MarshalJSON() ([]byte, error) {
  968. type NoMethod FileContentHintsThumbnail
  969. raw := NoMethod(*s)
  970. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  971. }
  972. // FileImageMediaMetadata: Additional metadata about image media, if
  973. // available.
  974. type FileImageMediaMetadata struct {
  975. // Aperture: The aperture used to create the photo (f-number).
  976. Aperture float64 `json:"aperture,omitempty"`
  977. // CameraMake: The make of the camera used to create the photo.
  978. CameraMake string `json:"cameraMake,omitempty"`
  979. // CameraModel: The model of the camera used to create the photo.
  980. CameraModel string `json:"cameraModel,omitempty"`
  981. // ColorSpace: The color space of the photo.
  982. ColorSpace string `json:"colorSpace,omitempty"`
  983. // ExposureBias: The exposure bias of the photo (APEX value).
  984. ExposureBias float64 `json:"exposureBias,omitempty"`
  985. // ExposureMode: The exposure mode used to create the photo.
  986. ExposureMode string `json:"exposureMode,omitempty"`
  987. // ExposureTime: The length of the exposure, in seconds.
  988. ExposureTime float64 `json:"exposureTime,omitempty"`
  989. // FlashUsed: Whether a flash was used to create the photo.
  990. FlashUsed bool `json:"flashUsed,omitempty"`
  991. // FocalLength: The focal length used to create the photo, in
  992. // millimeters.
  993. FocalLength float64 `json:"focalLength,omitempty"`
  994. // Height: The height of the image in pixels.
  995. Height int64 `json:"height,omitempty"`
  996. // IsoSpeed: The ISO speed used to create the photo.
  997. IsoSpeed int64 `json:"isoSpeed,omitempty"`
  998. // Lens: The lens used to create the photo.
  999. Lens string `json:"lens,omitempty"`
  1000. // Location: Geographic location information stored in the image.
  1001. Location *FileImageMediaMetadataLocation `json:"location,omitempty"`
  1002. // MaxApertureValue: The smallest f-number of the lens at the focal
  1003. // length used to create the photo (APEX value).
  1004. MaxApertureValue float64 `json:"maxApertureValue,omitempty"`
  1005. // MeteringMode: The metering mode used to create the photo.
  1006. MeteringMode string `json:"meteringMode,omitempty"`
  1007. // Rotation: The rotation in clockwise degrees from the image's original
  1008. // orientation.
  1009. Rotation int64 `json:"rotation,omitempty"`
  1010. // Sensor: The type of sensor used to create the photo.
  1011. Sensor string `json:"sensor,omitempty"`
  1012. // SubjectDistance: The distance to the subject of the photo, in meters.
  1013. SubjectDistance int64 `json:"subjectDistance,omitempty"`
  1014. // Time: The date and time the photo was taken (EXIF DateTime).
  1015. Time string `json:"time,omitempty"`
  1016. // WhiteBalance: The white balance mode used to create the photo.
  1017. WhiteBalance string `json:"whiteBalance,omitempty"`
  1018. // Width: The width of the image in pixels.
  1019. Width int64 `json:"width,omitempty"`
  1020. // ForceSendFields is a list of field names (e.g. "Aperture") to
  1021. // unconditionally include in API requests. By default, fields with
  1022. // empty values are omitted from API requests. However, any non-pointer,
  1023. // non-interface field appearing in ForceSendFields will be sent to the
  1024. // server regardless of whether the field is empty or not. This may be
  1025. // used to include empty fields in Patch requests.
  1026. ForceSendFields []string `json:"-"`
  1027. // NullFields is a list of field names (e.g. "Aperture") to include in
  1028. // API requests with the JSON null value. By default, fields with empty
  1029. // values are omitted from API requests. However, any field with an
  1030. // empty value appearing in NullFields will be sent to the server as
  1031. // null. It is an error if a field in this list has a non-empty value.
  1032. // This may be used to include null fields in Patch requests.
  1033. NullFields []string `json:"-"`
  1034. }
  1035. func (s *FileImageMediaMetadata) MarshalJSON() ([]byte, error) {
  1036. type NoMethod FileImageMediaMetadata
  1037. raw := NoMethod(*s)
  1038. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1039. }
  1040. func (s *FileImageMediaMetadata) UnmarshalJSON(data []byte) error {
  1041. type NoMethod FileImageMediaMetadata
  1042. var s1 struct {
  1043. Aperture gensupport.JSONFloat64 `json:"aperture"`
  1044. ExposureBias gensupport.JSONFloat64 `json:"exposureBias"`
  1045. ExposureTime gensupport.JSONFloat64 `json:"exposureTime"`
  1046. FocalLength gensupport.JSONFloat64 `json:"focalLength"`
  1047. MaxApertureValue gensupport.JSONFloat64 `json:"maxApertureValue"`
  1048. *NoMethod
  1049. }
  1050. s1.NoMethod = (*NoMethod)(s)
  1051. if err := json.Unmarshal(data, &s1); err != nil {
  1052. return err
  1053. }
  1054. s.Aperture = float64(s1.Aperture)
  1055. s.ExposureBias = float64(s1.ExposureBias)
  1056. s.ExposureTime = float64(s1.ExposureTime)
  1057. s.FocalLength = float64(s1.FocalLength)
  1058. s.MaxApertureValue = float64(s1.MaxApertureValue)
  1059. return nil
  1060. }
  1061. // FileImageMediaMetadataLocation: Geographic location information
  1062. // stored in the image.
  1063. type FileImageMediaMetadataLocation struct {
  1064. // Altitude: The altitude stored in the image.
  1065. Altitude float64 `json:"altitude,omitempty"`
  1066. // Latitude: The latitude stored in the image.
  1067. Latitude float64 `json:"latitude,omitempty"`
  1068. // Longitude: The longitude stored in the image.
  1069. Longitude float64 `json:"longitude,omitempty"`
  1070. // ForceSendFields is a list of field names (e.g. "Altitude") to
  1071. // unconditionally include in API requests. By default, fields with
  1072. // empty values are omitted from API requests. However, any non-pointer,
  1073. // non-interface field appearing in ForceSendFields will be sent to the
  1074. // server regardless of whether the field is empty or not. This may be
  1075. // used to include empty fields in Patch requests.
  1076. ForceSendFields []string `json:"-"`
  1077. // NullFields is a list of field names (e.g. "Altitude") to include in
  1078. // API requests with the JSON null value. By default, fields with empty
  1079. // values are omitted from API requests. However, any field with an
  1080. // empty value appearing in NullFields will be sent to the server as
  1081. // null. It is an error if a field in this list has a non-empty value.
  1082. // This may be used to include null fields in Patch requests.
  1083. NullFields []string `json:"-"`
  1084. }
  1085. func (s *FileImageMediaMetadataLocation) MarshalJSON() ([]byte, error) {
  1086. type NoMethod FileImageMediaMetadataLocation
  1087. raw := NoMethod(*s)
  1088. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1089. }
  1090. func (s *FileImageMediaMetadataLocation) UnmarshalJSON(data []byte) error {
  1091. type NoMethod FileImageMediaMetadataLocation
  1092. var s1 struct {
  1093. Altitude gensupport.JSONFloat64 `json:"altitude"`
  1094. Latitude gensupport.JSONFloat64 `json:"latitude"`
  1095. Longitude gensupport.JSONFloat64 `json:"longitude"`
  1096. *NoMethod
  1097. }
  1098. s1.NoMethod = (*NoMethod)(s)
  1099. if err := json.Unmarshal(data, &s1); err != nil {
  1100. return err
  1101. }
  1102. s.Altitude = float64(s1.Altitude)
  1103. s.Latitude = float64(s1.Latitude)
  1104. s.Longitude = float64(s1.Longitude)
  1105. return nil
  1106. }
  1107. // FileVideoMediaMetadata: Additional metadata about video media. This
  1108. // may not be available immediately upon upload.
  1109. type FileVideoMediaMetadata struct {
  1110. // DurationMillis: The duration of the video in milliseconds.
  1111. DurationMillis int64 `json:"durationMillis,omitempty,string"`
  1112. // Height: The height of the video in pixels.
  1113. Height int64 `json:"height,omitempty"`
  1114. // Width: The width of the video in pixels.
  1115. Width int64 `json:"width,omitempty"`
  1116. // ForceSendFields is a list of field names (e.g. "DurationMillis") to
  1117. // unconditionally include in API requests. By default, fields with
  1118. // empty values are omitted from API requests. However, any non-pointer,
  1119. // non-interface field appearing in ForceSendFields will be sent to the
  1120. // server regardless of whether the field is empty or not. This may be
  1121. // used to include empty fields in Patch requests.
  1122. ForceSendFields []string `json:"-"`
  1123. // NullFields is a list of field names (e.g. "DurationMillis") to
  1124. // include in API requests with the JSON null value. By default, fields
  1125. // with empty values are omitted from API requests. However, any field
  1126. // with an empty value appearing in NullFields will be sent to the
  1127. // server as null. It is an error if a field in this list has a
  1128. // non-empty value. This may be used to include null fields in Patch
  1129. // requests.
  1130. NullFields []string `json:"-"`
  1131. }
  1132. func (s *FileVideoMediaMetadata) MarshalJSON() ([]byte, error) {
  1133. type NoMethod FileVideoMediaMetadata
  1134. raw := NoMethod(*s)
  1135. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1136. }
  1137. // FileList: A list of files.
  1138. type FileList struct {
  1139. // Files: The list of files. If nextPageToken is populated, then this
  1140. // list may be incomplete and an additional page of results should be
  1141. // fetched.
  1142. Files []*File `json:"files,omitempty"`
  1143. // IncompleteSearch: Whether the search process was incomplete. If true,
  1144. // then some search results may be missing, since all documents were not
  1145. // searched. This may occur when searching multiple Team Drives with the
  1146. // "user,allTeamDrives" corpora, but all corpora could not be searched.
  1147. // When this happens, it is suggested that clients narrow their query by
  1148. // choosing a different corpus such as "user" or "teamDrive".
  1149. IncompleteSearch bool `json:"incompleteSearch,omitempty"`
  1150. // Kind: Identifies what kind of resource this is. Value: the fixed
  1151. // string "drive#fileList".
  1152. Kind string `json:"kind,omitempty"`
  1153. // NextPageToken: The page token for the next page of files. This will
  1154. // be absent if the end of the files list has been reached. If the token
  1155. // is rejected for any reason, it should be discarded, and pagination
  1156. // should be restarted from the first page of results.
  1157. NextPageToken string `json:"nextPageToken,omitempty"`
  1158. // ServerResponse contains the HTTP response code and headers from the
  1159. // server.
  1160. googleapi.ServerResponse `json:"-"`
  1161. // ForceSendFields is a list of field names (e.g. "Files") to
  1162. // unconditionally include in API requests. By default, fields with
  1163. // empty values are omitted from API requests. However, any non-pointer,
  1164. // non-interface field appearing in ForceSendFields will be sent to the
  1165. // server regardless of whether the field is empty or not. This may be
  1166. // used to include empty fields in Patch requests.
  1167. ForceSendFields []string `json:"-"`
  1168. // NullFields is a list of field names (e.g. "Files") to include in API
  1169. // requests with the JSON null value. By default, fields with empty
  1170. // values are omitted from API requests. However, any field with an
  1171. // empty value appearing in NullFields will be sent to the server as
  1172. // null. It is an error if a field in this list has a non-empty value.
  1173. // This may be used to include null fields in Patch requests.
  1174. NullFields []string `json:"-"`
  1175. }
  1176. func (s *FileList) MarshalJSON() ([]byte, error) {
  1177. type NoMethod FileList
  1178. raw := NoMethod(*s)
  1179. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1180. }
  1181. // GeneratedIds: A list of generated file IDs which can be provided in
  1182. // create requests.
  1183. type GeneratedIds struct {
  1184. // Ids: The IDs generated for the requesting user in the specified
  1185. // space.
  1186. Ids []string `json:"ids,omitempty"`
  1187. // Kind: Identifies what kind of resource this is. Value: the fixed
  1188. // string "drive#generatedIds".
  1189. Kind string `json:"kind,omitempty"`
  1190. // Space: The type of file that can be created with these IDs.
  1191. Space string `json:"space,omitempty"`
  1192. // ServerResponse contains the HTTP response code and headers from the
  1193. // server.
  1194. googleapi.ServerResponse `json:"-"`
  1195. // ForceSendFields is a list of field names (e.g. "Ids") to
  1196. // unconditionally include in API requests. By default, fields with
  1197. // empty values are omitted from API requests. However, any non-pointer,
  1198. // non-interface field appearing in ForceSendFields will be sent to the
  1199. // server regardless of whether the field is empty or not. This may be
  1200. // used to include empty fields in Patch requests.
  1201. ForceSendFields []string `json:"-"`
  1202. // NullFields is a list of field names (e.g. "Ids") to include in API
  1203. // requests with the JSON null value. By default, fields with empty
  1204. // values are omitted from API requests. However, any field with an
  1205. // empty value appearing in NullFields will be sent to the server as
  1206. // null. It is an error if a field in this list has a non-empty value.
  1207. // This may be used to include null fields in Patch requests.
  1208. NullFields []string `json:"-"`
  1209. }
  1210. func (s *GeneratedIds) MarshalJSON() ([]byte, error) {
  1211. type NoMethod GeneratedIds
  1212. raw := NoMethod(*s)
  1213. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1214. }
  1215. // Permission: A permission for a file. A permission grants a user,
  1216. // group, domain or the world access to a file or a folder hierarchy.
  1217. type Permission struct {
  1218. // AllowFileDiscovery: Whether the permission allows the file to be
  1219. // discovered through search. This is only applicable for permissions of
  1220. // type domain or anyone.
  1221. AllowFileDiscovery bool `json:"allowFileDiscovery,omitempty"`
  1222. // Deleted: Whether the account associated with this permission has been
  1223. // deleted. This field only pertains to user and group permissions.
  1224. Deleted bool `json:"deleted,omitempty"`
  1225. // DisplayName: A displayable name for users, groups or domains.
  1226. DisplayName string `json:"displayName,omitempty"`
  1227. // Domain: The domain to which this permission refers.
  1228. Domain string `json:"domain,omitempty"`
  1229. // EmailAddress: The email address of the user or group to which this
  1230. // permission refers.
  1231. EmailAddress string `json:"emailAddress,omitempty"`
  1232. // ExpirationTime: The time at which this permission will expire (RFC
  1233. // 3339 date-time). Expiration times have the following restrictions:
  1234. //
  1235. // - They can only be set on user and group permissions
  1236. // - The time must be in the future
  1237. // - The time cannot be more than a year in the future
  1238. ExpirationTime string `json:"expirationTime,omitempty"`
  1239. // Id: The ID of this permission. This is a unique identifier for the
  1240. // grantee, and is published in User resources as permissionId.
  1241. Id string `json:"id,omitempty"`
  1242. // Kind: Identifies what kind of resource this is. Value: the fixed
  1243. // string "drive#permission".
  1244. Kind string `json:"kind,omitempty"`
  1245. // PhotoLink: A link to the user's profile photo, if available.
  1246. PhotoLink string `json:"photoLink,omitempty"`
  1247. // Role: The role granted by this permission. While new values may be
  1248. // supported in the future, the following are currently allowed:
  1249. // - owner
  1250. // - organizer
  1251. // - fileOrganizer
  1252. // - writer
  1253. // - commenter
  1254. // - reader
  1255. Role string `json:"role,omitempty"`
  1256. // TeamDrivePermissionDetails: Details of whether the permissions on
  1257. // this Team Drive item are inherited or directly on this item. This is
  1258. // an output-only field which is present only for Team Drive items.
  1259. TeamDrivePermissionDetails []*PermissionTeamDrivePermissionDetails `json:"teamDrivePermissionDetails,omitempty"`
  1260. // Type: The type of the grantee. Valid values are:
  1261. // - user
  1262. // - group
  1263. // - domain
  1264. // - anyone
  1265. Type string `json:"type,omitempty"`
  1266. // ServerResponse contains the HTTP response code and headers from the
  1267. // server.
  1268. googleapi.ServerResponse `json:"-"`
  1269. // ForceSendFields is a list of field names (e.g. "AllowFileDiscovery")
  1270. // to unconditionally include in API requests. By default, fields with
  1271. // empty values are omitted from API requests. However, any non-pointer,
  1272. // non-interface field appearing in ForceSendFields will be sent to the
  1273. // server regardless of whether the field is empty or not. This may be
  1274. // used to include empty fields in Patch requests.
  1275. ForceSendFields []string `json:"-"`
  1276. // NullFields is a list of field names (e.g. "AllowFileDiscovery") to
  1277. // include in API requests with the JSON null value. By default, fields
  1278. // with empty values are omitted from API requests. However, any field
  1279. // with an empty value appearing in NullFields will be sent to the
  1280. // server as null. It is an error if a field in this list has a
  1281. // non-empty value. This may be used to include null fields in Patch
  1282. // requests.
  1283. NullFields []string `json:"-"`
  1284. }
  1285. func (s *Permission) MarshalJSON() ([]byte, error) {
  1286. type NoMethod Permission
  1287. raw := NoMethod(*s)
  1288. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1289. }
  1290. type PermissionTeamDrivePermissionDetails struct {
  1291. // Inherited: Whether this permission is inherited. This field is always
  1292. // populated. This is an output-only field.
  1293. Inherited bool `json:"inherited,omitempty"`
  1294. // InheritedFrom: The ID of the item from which this permission is
  1295. // inherited. This is an output-only field and is only populated for
  1296. // members of the Team Drive.
  1297. InheritedFrom string `json:"inheritedFrom,omitempty"`
  1298. // Role: The primary role for this user. While new values may be added
  1299. // in the future, the following are currently possible:
  1300. // - organizer
  1301. // - fileOrganizer
  1302. // - writer
  1303. // - commenter
  1304. // - reader
  1305. Role string `json:"role,omitempty"`
  1306. // TeamDrivePermissionType: The Team Drive permission type for this
  1307. // user. While new values may be added in future, the following are
  1308. // currently possible:
  1309. // - file
  1310. // - member
  1311. TeamDrivePermissionType string `json:"teamDrivePermissionType,omitempty"`
  1312. // ForceSendFields is a list of field names (e.g. "Inherited") to
  1313. // unconditionally include in API requests. By default, fields with
  1314. // empty values are omitted from API requests. However, any non-pointer,
  1315. // non-interface field appearing in ForceSendFields will be sent to the
  1316. // server regardless of whether the field is empty or not. This may be
  1317. // used to include empty fields in Patch requests.
  1318. ForceSendFields []string `json:"-"`
  1319. // NullFields is a list of field names (e.g. "Inherited") to include in
  1320. // API requests with the JSON null value. By default, fields with empty
  1321. // values are omitted from API requests. However, any field with an
  1322. // empty value appearing in NullFields will be sent to the server as
  1323. // null. It is an error if a field in this list has a non-empty value.
  1324. // This may be used to include null fields in Patch requests.
  1325. NullFields []string `json:"-"`
  1326. }
  1327. func (s *PermissionTeamDrivePermissionDetails) MarshalJSON() ([]byte, error) {
  1328. type NoMethod PermissionTeamDrivePermissionDetails
  1329. raw := NoMethod(*s)
  1330. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1331. }
  1332. // PermissionList: A list of permissions for a file.
  1333. type PermissionList struct {
  1334. // Kind: Identifies what kind of resource this is. Value: the fixed
  1335. // string "drive#permissionList".
  1336. Kind string `json:"kind,omitempty"`
  1337. // NextPageToken: The page token for the next page of permissions. This
  1338. // field will be absent if the end of the permissions list has been
  1339. // reached. If the token is rejected for any reason, it should be
  1340. // discarded, and pagination should be restarted from the first page of
  1341. // results.
  1342. NextPageToken string `json:"nextPageToken,omitempty"`
  1343. // Permissions: The list of permissions. If nextPageToken is populated,
  1344. // then this list may be incomplete and an additional page of results
  1345. // should be fetched.
  1346. Permissions []*Permission `json:"permissions,omitempty"`
  1347. // ServerResponse contains the HTTP response code and headers from the
  1348. // server.
  1349. googleapi.ServerResponse `json:"-"`
  1350. // ForceSendFields is a list of field names (e.g. "Kind") to
  1351. // unconditionally include in API requests. By default, fields with
  1352. // empty values are omitted from API requests. However, any non-pointer,
  1353. // non-interface field appearing in ForceSendFields will be sent to the
  1354. // server regardless of whether the field is empty or not. This may be
  1355. // used to include empty fields in Patch requests.
  1356. ForceSendFields []string `json:"-"`
  1357. // NullFields is a list of field names (e.g. "Kind") to include in API
  1358. // requests with the JSON null value. By default, fields with empty
  1359. // values are omitted from API requests. However, any field with an
  1360. // empty value appearing in NullFields will be sent to the server as
  1361. // null. It is an error if a field in this list has a non-empty value.
  1362. // This may be used to include null fields in Patch requests.
  1363. NullFields []string `json:"-"`
  1364. }
  1365. func (s *PermissionList) MarshalJSON() ([]byte, error) {
  1366. type NoMethod PermissionList
  1367. raw := NoMethod(*s)
  1368. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1369. }
  1370. // Reply: A reply to a comment on a file.
  1371. type Reply struct {
  1372. // Action: The action the reply performed to the parent comment. Valid
  1373. // values are:
  1374. // - resolve
  1375. // - reopen
  1376. Action string `json:"action,omitempty"`
  1377. // Author: The user who created the reply.
  1378. Author *User `json:"author,omitempty"`
  1379. // Content: The plain text content of the reply. This field is used for
  1380. // setting the content, while htmlContent should be displayed. This is
  1381. // required on creates if no action is specified.
  1382. Content string `json:"content,omitempty"`
  1383. // CreatedTime: The time at which the reply was created (RFC 3339
  1384. // date-time).
  1385. CreatedTime string `json:"createdTime,omitempty"`
  1386. // Deleted: Whether the reply has been deleted. A deleted reply has no
  1387. // content.
  1388. Deleted bool `json:"deleted,omitempty"`
  1389. // HtmlContent: The content of the reply with HTML formatting.
  1390. HtmlContent string `json:"htmlContent,omitempty"`
  1391. // Id: The ID of the reply.
  1392. Id string `json:"id,omitempty"`
  1393. // Kind: Identifies what kind of resource this is. Value: the fixed
  1394. // string "drive#reply".
  1395. Kind string `json:"kind,omitempty"`
  1396. // ModifiedTime: The last time the reply was modified (RFC 3339
  1397. // date-time).
  1398. ModifiedTime string `json:"modifiedTime,omitempty"`
  1399. // ServerResponse contains the HTTP response code and headers from the
  1400. // server.
  1401. googleapi.ServerResponse `json:"-"`
  1402. // ForceSendFields is a list of field names (e.g. "Action") to
  1403. // unconditionally include in API requests. By default, fields with
  1404. // empty values are omitted from API requests. However, any non-pointer,
  1405. // non-interface field appearing in ForceSendFields will be sent to the
  1406. // server regardless of whether the field is empty or not. This may be
  1407. // used to include empty fields in Patch requests.
  1408. ForceSendFields []string `json:"-"`
  1409. // NullFields is a list of field names (e.g. "Action") to include in API
  1410. // requests with the JSON null value. By default, fields with empty
  1411. // values are omitted from API requests. However, any field with an
  1412. // empty value appearing in NullFields will be sent to the server as
  1413. // null. It is an error if a field in this list has a non-empty value.
  1414. // This may be used to include null fields in Patch requests.
  1415. NullFields []string `json:"-"`
  1416. }
  1417. func (s *Reply) MarshalJSON() ([]byte, error) {
  1418. type NoMethod Reply
  1419. raw := NoMethod(*s)
  1420. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1421. }
  1422. // ReplyList: A list of replies to a comment on a file.
  1423. type ReplyList struct {
  1424. // Kind: Identifies what kind of resource this is. Value: the fixed
  1425. // string "drive#replyList".
  1426. Kind string `json:"kind,omitempty"`
  1427. // NextPageToken: The page token for the next page of replies. This will
  1428. // be absent if the end of the replies list has been reached. If the
  1429. // token is rejected for any reason, it should be discarded, and
  1430. // pagination should be restarted from the first page of results.
  1431. NextPageToken string `json:"nextPageToken,omitempty"`
  1432. // Replies: The list of replies. If nextPageToken is populated, then
  1433. // this list may be incomplete and an additional page of results should
  1434. // be fetched.
  1435. Replies []*Reply `json:"replies,omitempty"`
  1436. // ServerResponse contains the HTTP response code and headers from the
  1437. // server.
  1438. googleapi.ServerResponse `json:"-"`
  1439. // ForceSendFields is a list of field names (e.g. "Kind") to
  1440. // unconditionally include in API requests. By default, fields with
  1441. // empty values are omitted from API requests. However, any non-pointer,
  1442. // non-interface field appearing in ForceSendFields will be sent to the
  1443. // server regardless of whether the field is empty or not. This may be
  1444. // used to include empty fields in Patch requests.
  1445. ForceSendFields []string `json:"-"`
  1446. // NullFields is a list of field names (e.g. "Kind") to include in API
  1447. // requests with the JSON null value. By default, fields with empty
  1448. // values are omitted from API requests. However, any field with an
  1449. // empty value appearing in NullFields will be sent to the server as
  1450. // null. It is an error if a field in this list has a non-empty value.
  1451. // This may be used to include null fields in Patch requests.
  1452. NullFields []string `json:"-"`
  1453. }
  1454. func (s *ReplyList) MarshalJSON() ([]byte, error) {
  1455. type NoMethod ReplyList
  1456. raw := NoMethod(*s)
  1457. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1458. }
  1459. // Revision: The metadata for a revision to a file.
  1460. type Revision struct {
  1461. // ExportLinks: Links for exporting Google Docs to specific formats.
  1462. ExportLinks map[string]string `json:"exportLinks,omitempty"`
  1463. // Id: The ID of the revision.
  1464. Id string `json:"id,omitempty"`
  1465. // KeepForever: Whether to keep this revision forever, even if it is no
  1466. // longer the head revision. If not set, the revision will be
  1467. // automatically purged 30 days after newer content is uploaded. This
  1468. // can be set on a maximum of 200 revisions for a file.
  1469. // This field is only applicable to files with binary content in Drive.
  1470. KeepForever bool `json:"keepForever,omitempty"`
  1471. // Kind: Identifies what kind of resource this is. Value: the fixed
  1472. // string "drive#revision".
  1473. Kind string `json:"kind,omitempty"`
  1474. // LastModifyingUser: The last user to modify this revision.
  1475. LastModifyingUser *User `json:"lastModifyingUser,omitempty"`
  1476. // Md5Checksum: The MD5 checksum of the revision's content. This is only
  1477. // applicable to files with binary content in Drive.
  1478. Md5Checksum string `json:"md5Checksum,omitempty"`
  1479. // MimeType: The MIME type of the revision.
  1480. MimeType string `json:"mimeType,omitempty"`
  1481. // ModifiedTime: The last time the revision was modified (RFC 3339
  1482. // date-time).
  1483. ModifiedTime string `json:"modifiedTime,omitempty"`
  1484. // OriginalFilename: The original filename used to create this revision.
  1485. // This is only applicable to files with binary content in Drive.
  1486. OriginalFilename string `json:"originalFilename,omitempty"`
  1487. // PublishAuto: Whether subsequent revisions will be automatically
  1488. // republished. This is only applicable to Google Docs.
  1489. PublishAuto bool `json:"publishAuto,omitempty"`
  1490. // Published: Whether this revision is published. This is only
  1491. // applicable to Google Docs.
  1492. Published bool `json:"published,omitempty"`
  1493. // PublishedOutsideDomain: Whether this revision is published outside
  1494. // the domain. This is only applicable to Google Docs.
  1495. PublishedOutsideDomain bool `json:"publishedOutsideDomain,omitempty"`
  1496. // Size: The size of the revision's content in bytes. This is only
  1497. // applicable to files with binary content in Drive.
  1498. Size int64 `json:"size,omitempty,string"`
  1499. // ServerResponse contains the HTTP response code and headers from the
  1500. // server.
  1501. googleapi.ServerResponse `json:"-"`
  1502. // ForceSendFields is a list of field names (e.g. "ExportLinks") to
  1503. // unconditionally include in API requests. By default, fields with
  1504. // empty values are omitted from API requests. However, any non-pointer,
  1505. // non-interface field appearing in ForceSendFields will be sent to the
  1506. // server regardless of whether the field is empty or not. This may be
  1507. // used to include empty fields in Patch requests.
  1508. ForceSendFields []string `json:"-"`
  1509. // NullFields is a list of field names (e.g. "ExportLinks") to include
  1510. // in API requests with the JSON null value. By default, fields with
  1511. // empty values are omitted from API requests. However, any field with
  1512. // an empty value appearing in NullFields will be sent to the server as
  1513. // null. It is an error if a field in this list has a non-empty value.
  1514. // This may be used to include null fields in Patch requests.
  1515. NullFields []string `json:"-"`
  1516. }
  1517. func (s *Revision) MarshalJSON() ([]byte, error) {
  1518. type NoMethod Revision
  1519. raw := NoMethod(*s)
  1520. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1521. }
  1522. // RevisionList: A list of revisions of a file.
  1523. type RevisionList struct {
  1524. // Kind: Identifies what kind of resource this is. Value: the fixed
  1525. // string "drive#revisionList".
  1526. Kind string `json:"kind,omitempty"`
  1527. // NextPageToken: The page token for the next page of revisions. This
  1528. // will be absent if the end of the revisions list has been reached. If
  1529. // the token is rejected for any reason, it should be discarded, and
  1530. // pagination should be restarted from the first page of results.
  1531. NextPageToken string `json:"nextPageToken,omitempty"`
  1532. // Revisions: The list of revisions. If nextPageToken is populated, then
  1533. // this list may be incomplete and an additional page of results should
  1534. // be fetched.
  1535. Revisions []*Revision `json:"revisions,omitempty"`
  1536. // ServerResponse contains the HTTP response code and headers from the
  1537. // server.
  1538. googleapi.ServerResponse `json:"-"`
  1539. // ForceSendFields is a list of field names (e.g. "Kind") to
  1540. // unconditionally include in API requests. By default, fields with
  1541. // empty values are omitted from API requests. However, any non-pointer,
  1542. // non-interface field appearing in ForceSendFields will be sent to the
  1543. // server regardless of whether the field is empty or not. This may be
  1544. // used to include empty fields in Patch requests.
  1545. ForceSendFields []string `json:"-"`
  1546. // NullFields is a list of field names (e.g. "Kind") to include in API
  1547. // requests with the JSON null value. By default, fields with empty
  1548. // values are omitted from API requests. However, any field with an
  1549. // empty value appearing in NullFields will be sent to the server as
  1550. // null. It is an error if a field in this list has a non-empty value.
  1551. // This may be used to include null fields in Patch requests.
  1552. NullFields []string `json:"-"`
  1553. }
  1554. func (s *RevisionList) MarshalJSON() ([]byte, error) {
  1555. type NoMethod RevisionList
  1556. raw := NoMethod(*s)
  1557. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1558. }
  1559. type StartPageToken struct {
  1560. // Kind: Identifies what kind of resource this is. Value: the fixed
  1561. // string "drive#startPageToken".
  1562. Kind string `json:"kind,omitempty"`
  1563. // StartPageToken: The starting page token for listing changes.
  1564. StartPageToken string `json:"startPageToken,omitempty"`
  1565. // ServerResponse contains the HTTP response code and headers from the
  1566. // server.
  1567. googleapi.ServerResponse `json:"-"`
  1568. // ForceSendFields is a list of field names (e.g. "Kind") to
  1569. // unconditionally include in API requests. By default, fields with
  1570. // empty values are omitted from API requests. However, any non-pointer,
  1571. // non-interface field appearing in ForceSendFields will be sent to the
  1572. // server regardless of whether the field is empty or not. This may be
  1573. // used to include empty fields in Patch requests.
  1574. ForceSendFields []string `json:"-"`
  1575. // NullFields is a list of field names (e.g. "Kind") to include in API
  1576. // requests with the JSON null value. By default, fields with empty
  1577. // values are omitted from API requests. However, any field with an
  1578. // empty value appearing in NullFields will be sent to the server as
  1579. // null. It is an error if a field in this list has a non-empty value.
  1580. // This may be used to include null fields in Patch requests.
  1581. NullFields []string `json:"-"`
  1582. }
  1583. func (s *StartPageToken) MarshalJSON() ([]byte, error) {
  1584. type NoMethod StartPageToken
  1585. raw := NoMethod(*s)
  1586. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1587. }
  1588. // TeamDrive: Representation of a Team Drive.
  1589. type TeamDrive struct {
  1590. // BackgroundImageFile: An image file and cropping parameters from which
  1591. // a background image for this Team Drive is set. This is a write only
  1592. // field; it can only be set on drive.teamdrives.update requests that
  1593. // don't set themeId. When specified, all fields of the
  1594. // backgroundImageFile must be set.
  1595. BackgroundImageFile *TeamDriveBackgroundImageFile `json:"backgroundImageFile,omitempty"`
  1596. // BackgroundImageLink: A short-lived link to this Team Drive's
  1597. // background image.
  1598. BackgroundImageLink string `json:"backgroundImageLink,omitempty"`
  1599. // Capabilities: Capabilities the current user has on this Team Drive.
  1600. Capabilities *TeamDriveCapabilities `json:"capabilities,omitempty"`
  1601. // ColorRgb: The color of this Team Drive as an RGB hex string. It can
  1602. // only be set on a drive.teamdrives.update request that does not set
  1603. // themeId.
  1604. ColorRgb string `json:"colorRgb,omitempty"`
  1605. // CreatedTime: The time at which the Team Drive was created (RFC 3339
  1606. // date-time).
  1607. CreatedTime string `json:"createdTime,omitempty"`
  1608. // Id: The ID of this Team Drive which is also the ID of the top level
  1609. // folder of this Team Drive.
  1610. Id string `json:"id,omitempty"`
  1611. // Kind: Identifies what kind of resource this is. Value: the fixed
  1612. // string "drive#teamDrive".
  1613. Kind string `json:"kind,omitempty"`
  1614. // Name: The name of this Team Drive.
  1615. Name string `json:"name,omitempty"`
  1616. // Restrictions: A set of restrictions that apply to this Team Drive or
  1617. // items inside this Team Drive.
  1618. Restrictions *TeamDriveRestrictions `json:"restrictions,omitempty"`
  1619. // ThemeId: The ID of the theme from which the background image and
  1620. // color will be set. The set of possible teamDriveThemes can be
  1621. // retrieved from a drive.about.get response. When not specified on a
  1622. // drive.teamdrives.create request, a random theme is chosen from which
  1623. // the background image and color are set. This is a write-only field;
  1624. // it can only be set on requests that don't set colorRgb or
  1625. // backgroundImageFile.
  1626. ThemeId string `json:"themeId,omitempty"`
  1627. // ServerResponse contains the HTTP response code and headers from the
  1628. // server.
  1629. googleapi.ServerResponse `json:"-"`
  1630. // ForceSendFields is a list of field names (e.g. "BackgroundImageFile")
  1631. // to unconditionally include in API requests. By default, fields with
  1632. // empty values are omitted from API requests. However, any non-pointer,
  1633. // non-interface field appearing in ForceSendFields will be sent to the
  1634. // server regardless of whether the field is empty or not. This may be
  1635. // used to include empty fields in Patch requests.
  1636. ForceSendFields []string `json:"-"`
  1637. // NullFields is a list of field names (e.g. "BackgroundImageFile") to
  1638. // include in API requests with the JSON null value. By default, fields
  1639. // with empty values are omitted from API requests. However, any field
  1640. // with an empty value appearing in NullFields will be sent to the
  1641. // server as null. It is an error if a field in this list has a
  1642. // non-empty value. This may be used to include null fields in Patch
  1643. // requests.
  1644. NullFields []string `json:"-"`
  1645. }
  1646. func (s *TeamDrive) MarshalJSON() ([]byte, error) {
  1647. type NoMethod TeamDrive
  1648. raw := NoMethod(*s)
  1649. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1650. }
  1651. // TeamDriveBackgroundImageFile: An image file and cropping parameters
  1652. // from which a background image for this Team Drive is set. This is a
  1653. // write only field; it can only be set on drive.teamdrives.update
  1654. // requests that don't set themeId. When specified, all fields of the
  1655. // backgroundImageFile must be set.
  1656. type TeamDriveBackgroundImageFile struct {
  1657. // Id: The ID of an image file in Drive to use for the background image.
  1658. Id string `json:"id,omitempty"`
  1659. // Width: The width of the cropped image in the closed range of 0 to 1.
  1660. // This value represents the width of the cropped image divided by the
  1661. // width of the entire image. The height is computed by applying a width
  1662. // to height aspect ratio of 80 to 9. The resulting image must be at
  1663. // least 1280 pixels wide and 144 pixels high.
  1664. Width float64 `json:"width,omitempty"`
  1665. // XCoordinate: The X coordinate of the upper left corner of the
  1666. // cropping area in the background image. This is a value in the closed
  1667. // range of 0 to 1. This value represents the horizontal distance from
  1668. // the left side of the entire image to the left side of the cropping
  1669. // area divided by the width of the entire image.
  1670. XCoordinate float64 `json:"xCoordinate,omitempty"`
  1671. // YCoordinate: The Y coordinate of the upper left corner of the
  1672. // cropping area in the background image. This is a value in the closed
  1673. // range of 0 to 1. This value represents the vertical distance from the
  1674. // top side of the entire image to the top side of the cropping area
  1675. // divided by the height of the entire image.
  1676. YCoordinate float64 `json:"yCoordinate,omitempty"`
  1677. // ForceSendFields is a list of field names (e.g. "Id") to
  1678. // unconditionally include in API requests. By default, fields with
  1679. // empty values are omitted from API requests. However, any non-pointer,
  1680. // non-interface field appearing in ForceSendFields will be sent to the
  1681. // server regardless of whether the field is empty or not. This may be
  1682. // used to include empty fields in Patch requests.
  1683. ForceSendFields []string `json:"-"`
  1684. // NullFields is a list of field names (e.g. "Id") to include in API
  1685. // requests with the JSON null value. By default, fields with empty
  1686. // values are omitted from API requests. However, any field with an
  1687. // empty value appearing in NullFields will be sent to the server as
  1688. // null. It is an error if a field in this list has a non-empty value.
  1689. // This may be used to include null fields in Patch requests.
  1690. NullFields []string `json:"-"`
  1691. }
  1692. func (s *TeamDriveBackgroundImageFile) MarshalJSON() ([]byte, error) {
  1693. type NoMethod TeamDriveBackgroundImageFile
  1694. raw := NoMethod(*s)
  1695. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1696. }
  1697. func (s *TeamDriveBackgroundImageFile) UnmarshalJSON(data []byte) error {
  1698. type NoMethod TeamDriveBackgroundImageFile
  1699. var s1 struct {
  1700. Width gensupport.JSONFloat64 `json:"width"`
  1701. XCoordinate gensupport.JSONFloat64 `json:"xCoordinate"`
  1702. YCoordinate gensupport.JSONFloat64 `json:"yCoordinate"`
  1703. *NoMethod
  1704. }
  1705. s1.NoMethod = (*NoMethod)(s)
  1706. if err := json.Unmarshal(data, &s1); err != nil {
  1707. return err
  1708. }
  1709. s.Width = float64(s1.Width)
  1710. s.XCoordinate = float64(s1.XCoordinate)
  1711. s.YCoordinate = float64(s1.YCoordinate)
  1712. return nil
  1713. }
  1714. // TeamDriveCapabilities: Capabilities the current user has on this Team
  1715. // Drive.
  1716. type TeamDriveCapabilities struct {
  1717. // CanAddChildren: Whether the current user can add children to folders
  1718. // in this Team Drive.
  1719. CanAddChildren bool `json:"canAddChildren,omitempty"`
  1720. // CanChangeCopyRequiresWriterPermissionRestriction: Whether the current
  1721. // user can change the copyRequiresWriterPermission restriction of this
  1722. // Team Drive.
  1723. CanChangeCopyRequiresWriterPermissionRestriction bool `json:"canChangeCopyRequiresWriterPermissionRestriction,omitempty"`
  1724. // CanChangeDomainUsersOnlyRestriction: Whether the current user can
  1725. // change the domainUsersOnly restriction of this Team Drive.
  1726. CanChangeDomainUsersOnlyRestriction bool `json:"canChangeDomainUsersOnlyRestriction,omitempty"`
  1727. // CanChangeTeamDriveBackground: Whether the current user can change the
  1728. // background of this Team Drive.
  1729. CanChangeTeamDriveBackground bool `json:"canChangeTeamDriveBackground,omitempty"`
  1730. // CanChangeTeamMembersOnlyRestriction: Whether the current user can
  1731. // change the teamMembersOnly restriction of this Team Drive.
  1732. CanChangeTeamMembersOnlyRestriction bool `json:"canChangeTeamMembersOnlyRestriction,omitempty"`
  1733. // CanComment: Whether the current user can comment on files in this
  1734. // Team Drive.
  1735. CanComment bool `json:"canComment,omitempty"`
  1736. // CanCopy: Whether the current user can copy files in this Team Drive.
  1737. CanCopy bool `json:"canCopy,omitempty"`
  1738. // CanDeleteChildren: Whether the current user can delete children from
  1739. // folders in this Team Drive.
  1740. CanDeleteChildren bool `json:"canDeleteChildren,omitempty"`
  1741. // CanDeleteTeamDrive: Whether the current user can delete this Team
  1742. // Drive. Attempting to delete the Team Drive may still fail if there
  1743. // are untrashed items inside the Team Drive.
  1744. CanDeleteTeamDrive bool `json:"canDeleteTeamDrive,omitempty"`
  1745. // CanDownload: Whether the current user can download files in this Team
  1746. // Drive.
  1747. CanDownload bool `json:"canDownload,omitempty"`
  1748. // CanEdit: Whether the current user can edit files in this Team Drive
  1749. CanEdit bool `json:"canEdit,omitempty"`
  1750. // CanListChildren: Whether the current user can list the children of
  1751. // folders in this Team Drive.
  1752. CanListChildren bool `json:"canListChildren,omitempty"`
  1753. // CanManageMembers: Whether the current user can add members to this
  1754. // Team Drive or remove them or change their role.
  1755. CanManageMembers bool `json:"canManageMembers,omitempty"`
  1756. // CanReadRevisions: Whether the current user can read the revisions
  1757. // resource of files in this Team Drive.
  1758. CanReadRevisions bool `json:"canReadRevisions,omitempty"`
  1759. // CanRemoveChildren: Deprecated - use canDeleteChildren or
  1760. // canTrashChildren instead.
  1761. CanRemoveChildren bool `json:"canRemoveChildren,omitempty"`
  1762. // CanRename: Whether the current user can rename files or folders in
  1763. // this Team Drive.
  1764. CanRename bool `json:"canRename,omitempty"`
  1765. // CanRenameTeamDrive: Whether the current user can rename this Team
  1766. // Drive.
  1767. CanRenameTeamDrive bool `json:"canRenameTeamDrive,omitempty"`
  1768. // CanShare: Whether the current user can share files or folders in this
  1769. // Team Drive.
  1770. CanShare bool `json:"canShare,omitempty"`
  1771. // CanTrashChildren: Whether the current user can trash children from
  1772. // folders in this Team Drive.
  1773. CanTrashChildren bool `json:"canTrashChildren,omitempty"`
  1774. // ForceSendFields is a list of field names (e.g. "CanAddChildren") to
  1775. // unconditionally include in API requests. By default, fields with
  1776. // empty values are omitted from API requests. However, any non-pointer,
  1777. // non-interface field appearing in ForceSendFields will be sent to the
  1778. // server regardless of whether the field is empty or not. This may be
  1779. // used to include empty fields in Patch requests.
  1780. ForceSendFields []string `json:"-"`
  1781. // NullFields is a list of field names (e.g. "CanAddChildren") to
  1782. // include in API requests with the JSON null value. By default, fields
  1783. // with empty values are omitted from API requests. However, any field
  1784. // with an empty value appearing in NullFields will be sent to the
  1785. // server as null. It is an error if a field in this list has a
  1786. // non-empty value. This may be used to include null fields in Patch
  1787. // requests.
  1788. NullFields []string `json:"-"`
  1789. }
  1790. func (s *TeamDriveCapabilities) MarshalJSON() ([]byte, error) {
  1791. type NoMethod TeamDriveCapabilities
  1792. raw := NoMethod(*s)
  1793. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1794. }
  1795. // TeamDriveRestrictions: A set of restrictions that apply to this Team
  1796. // Drive or items inside this Team Drive.
  1797. type TeamDriveRestrictions struct {
  1798. // AdminManagedRestrictions: Whether administrative privileges on this
  1799. // Team Drive are required to modify restrictions.
  1800. AdminManagedRestrictions bool `json:"adminManagedRestrictions,omitempty"`
  1801. // CopyRequiresWriterPermission: Whether the options to copy, print, or
  1802. // download files inside this Team Drive, should be disabled for readers
  1803. // and commenters. When this restriction is set to true, it will
  1804. // override the similarly named field to true for any file inside this
  1805. // Team Drive.
  1806. CopyRequiresWriterPermission bool `json:"copyRequiresWriterPermission,omitempty"`
  1807. // DomainUsersOnly: Whether access to this Team Drive and items inside
  1808. // this Team Drive is restricted to users of the domain to which this
  1809. // Team Drive belongs. This restriction may be overridden by other
  1810. // sharing policies controlled outside of this Team Drive.
  1811. DomainUsersOnly bool `json:"domainUsersOnly,omitempty"`
  1812. // TeamMembersOnly: Whether access to items inside this Team Drive is
  1813. // restricted to members of this Team Drive.
  1814. TeamMembersOnly bool `json:"teamMembersOnly,omitempty"`
  1815. // ForceSendFields is a list of field names (e.g.
  1816. // "AdminManagedRestrictions") to unconditionally include in API
  1817. // requests. By default, fields with empty values are omitted from API
  1818. // requests. However, any non-pointer, non-interface field appearing in
  1819. // ForceSendFields will be sent to the server regardless of whether the
  1820. // field is empty or not. This may be used to include empty fields in
  1821. // Patch requests.
  1822. ForceSendFields []string `json:"-"`
  1823. // NullFields is a list of field names (e.g. "AdminManagedRestrictions")
  1824. // to include in API requests with the JSON null value. By default,
  1825. // fields with empty values are omitted from API requests. However, any
  1826. // field with an empty value appearing in NullFields will be sent to the
  1827. // server as null. It is an error if a field in this list has a
  1828. // non-empty value. This may be used to include null fields in Patch
  1829. // requests.
  1830. NullFields []string `json:"-"`
  1831. }
  1832. func (s *TeamDriveRestrictions) MarshalJSON() ([]byte, error) {
  1833. type NoMethod TeamDriveRestrictions
  1834. raw := NoMethod(*s)
  1835. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1836. }
  1837. // TeamDriveList: A list of Team Drives.
  1838. type TeamDriveList struct {
  1839. // Kind: Identifies what kind of resource this is. Value: the fixed
  1840. // string "drive#teamDriveList".
  1841. Kind string `json:"kind,omitempty"`
  1842. // NextPageToken: The page token for the next page of Team Drives. This
  1843. // will be absent if the end of the Team Drives list has been reached.
  1844. // If the token is rejected for any reason, it should be discarded, and
  1845. // pagination should be restarted from the first page of results.
  1846. NextPageToken string `json:"nextPageToken,omitempty"`
  1847. // TeamDrives: The list of Team Drives. If nextPageToken is populated,
  1848. // then this list may be incomplete and an additional page of results
  1849. // should be fetched.
  1850. TeamDrives []*TeamDrive `json:"teamDrives,omitempty"`
  1851. // ServerResponse contains the HTTP response code and headers from the
  1852. // server.
  1853. googleapi.ServerResponse `json:"-"`
  1854. // ForceSendFields is a list of field names (e.g. "Kind") to
  1855. // unconditionally include in API requests. By default, fields with
  1856. // empty values are omitted from API requests. However, any non-pointer,
  1857. // non-interface field appearing in ForceSendFields will be sent to the
  1858. // server regardless of whether the field is empty or not. This may be
  1859. // used to include empty fields in Patch requests.
  1860. ForceSendFields []string `json:"-"`
  1861. // NullFields is a list of field names (e.g. "Kind") to include in API
  1862. // requests with the JSON null value. By default, fields with empty
  1863. // values are omitted from API requests. However, any field with an
  1864. // empty value appearing in NullFields will be sent to the server as
  1865. // null. It is an error if a field in this list has a non-empty value.
  1866. // This may be used to include null fields in Patch requests.
  1867. NullFields []string `json:"-"`
  1868. }
  1869. func (s *TeamDriveList) MarshalJSON() ([]byte, error) {
  1870. type NoMethod TeamDriveList
  1871. raw := NoMethod(*s)
  1872. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1873. }
  1874. // User: Information about a Drive user.
  1875. type User struct {
  1876. // DisplayName: A plain text displayable name for this user.
  1877. DisplayName string `json:"displayName,omitempty"`
  1878. // EmailAddress: The email address of the user. This may not be present
  1879. // in certain contexts if the user has not made their email address
  1880. // visible to the requester.
  1881. EmailAddress string `json:"emailAddress,omitempty"`
  1882. // Kind: Identifies what kind of resource this is. Value: the fixed
  1883. // string "drive#user".
  1884. Kind string `json:"kind,omitempty"`
  1885. // Me: Whether this user is the requesting user.
  1886. Me bool `json:"me,omitempty"`
  1887. // PermissionId: The user's ID as visible in Permission resources.
  1888. PermissionId string `json:"permissionId,omitempty"`
  1889. // PhotoLink: A link to the user's profile photo, if available.
  1890. PhotoLink string `json:"photoLink,omitempty"`
  1891. // ForceSendFields is a list of field names (e.g. "DisplayName") to
  1892. // unconditionally include in API requests. By default, fields with
  1893. // empty values are omitted from API requests. However, any non-pointer,
  1894. // non-interface field appearing in ForceSendFields will be sent to the
  1895. // server regardless of whether the field is empty or not. This may be
  1896. // used to include empty fields in Patch requests.
  1897. ForceSendFields []string `json:"-"`
  1898. // NullFields is a list of field names (e.g. "DisplayName") to include
  1899. // in API requests with the JSON null value. By default, fields with
  1900. // empty values are omitted from API requests. However, any field with
  1901. // an empty value appearing in NullFields will be sent to the server as
  1902. // null. It is an error if a field in this list has a non-empty value.
  1903. // This may be used to include null fields in Patch requests.
  1904. NullFields []string `json:"-"`
  1905. }
  1906. func (s *User) MarshalJSON() ([]byte, error) {
  1907. type NoMethod User
  1908. raw := NoMethod(*s)
  1909. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1910. }
  1911. // method id "drive.about.get":
  1912. type AboutGetCall struct {
  1913. s *Service
  1914. urlParams_ gensupport.URLParams
  1915. ifNoneMatch_ string
  1916. ctx_ context.Context
  1917. header_ http.Header
  1918. }
  1919. // Get: Gets information about the user, the user's Drive, and system
  1920. // capabilities.
  1921. func (r *AboutService) Get() *AboutGetCall {
  1922. c := &AboutGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  1923. return c
  1924. }
  1925. // Fields allows partial responses to be retrieved. See
  1926. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  1927. // for more information.
  1928. func (c *AboutGetCall) Fields(s ...googleapi.Field) *AboutGetCall {
  1929. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  1930. return c
  1931. }
  1932. // IfNoneMatch sets the optional parameter which makes the operation
  1933. // fail if the object's ETag matches the given value. This is useful for
  1934. // getting updates only after the object has changed since the last
  1935. // request. Use googleapi.IsNotModified to check whether the response
  1936. // error from Do is the result of In-None-Match.
  1937. func (c *AboutGetCall) IfNoneMatch(entityTag string) *AboutGetCall {
  1938. c.ifNoneMatch_ = entityTag
  1939. return c
  1940. }
  1941. // Context sets the context to be used in this call's Do method. Any
  1942. // pending HTTP request will be aborted if the provided context is
  1943. // canceled.
  1944. func (c *AboutGetCall) Context(ctx context.Context) *AboutGetCall {
  1945. c.ctx_ = ctx
  1946. return c
  1947. }
  1948. // Header returns an http.Header that can be modified by the caller to
  1949. // add HTTP headers to the request.
  1950. func (c *AboutGetCall) Header() http.Header {
  1951. if c.header_ == nil {
  1952. c.header_ = make(http.Header)
  1953. }
  1954. return c.header_
  1955. }
  1956. func (c *AboutGetCall) doRequest(alt string) (*http.Response, error) {
  1957. reqHeaders := make(http.Header)
  1958. for k, v := range c.header_ {
  1959. reqHeaders[k] = v
  1960. }
  1961. reqHeaders.Set("User-Agent", c.s.userAgent())
  1962. if c.ifNoneMatch_ != "" {
  1963. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  1964. }
  1965. var body io.Reader = nil
  1966. c.urlParams_.Set("alt", alt)
  1967. c.urlParams_.Set("prettyPrint", "false")
  1968. urls := googleapi.ResolveRelative(c.s.BasePath, "about")
  1969. urls += "?" + c.urlParams_.Encode()
  1970. req, err := http.NewRequest("GET", urls, body)
  1971. if err != nil {
  1972. return nil, err
  1973. }
  1974. req.Header = reqHeaders
  1975. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  1976. }
  1977. // Do executes the "drive.about.get" call.
  1978. // Exactly one of *About or error will be non-nil. Any non-2xx status
  1979. // code is an error. Response headers are in either
  1980. // *About.ServerResponse.Header or (if a response was returned at all)
  1981. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  1982. // check whether the returned error was because http.StatusNotModified
  1983. // was returned.
  1984. func (c *AboutGetCall) Do(opts ...googleapi.CallOption) (*About, error) {
  1985. gensupport.SetOptions(c.urlParams_, opts...)
  1986. res, err := c.doRequest("json")
  1987. if res != nil && res.StatusCode == http.StatusNotModified {
  1988. if res.Body != nil {
  1989. res.Body.Close()
  1990. }
  1991. return nil, &googleapi.Error{
  1992. Code: res.StatusCode,
  1993. Header: res.Header,
  1994. }
  1995. }
  1996. if err != nil {
  1997. return nil, err
  1998. }
  1999. defer googleapi.CloseBody(res)
  2000. if err := googleapi.CheckResponse(res); err != nil {
  2001. return nil, err
  2002. }
  2003. ret := &About{
  2004. ServerResponse: googleapi.ServerResponse{
  2005. Header: res.Header,
  2006. HTTPStatusCode: res.StatusCode,
  2007. },
  2008. }
  2009. target := &ret
  2010. if err := gensupport.DecodeResponse(target, res); err != nil {
  2011. return nil, err
  2012. }
  2013. return ret, nil
  2014. // {
  2015. // "description": "Gets information about the user, the user's Drive, and system capabilities.",
  2016. // "httpMethod": "GET",
  2017. // "id": "drive.about.get",
  2018. // "path": "about",
  2019. // "response": {
  2020. // "$ref": "About"
  2021. // },
  2022. // "scopes": [
  2023. // "https://www.googleapis.com/auth/drive",
  2024. // "https://www.googleapis.com/auth/drive.appdata",
  2025. // "https://www.googleapis.com/auth/drive.file",
  2026. // "https://www.googleapis.com/auth/drive.metadata",
  2027. // "https://www.googleapis.com/auth/drive.metadata.readonly",
  2028. // "https://www.googleapis.com/auth/drive.photos.readonly",
  2029. // "https://www.googleapis.com/auth/drive.readonly"
  2030. // ]
  2031. // }
  2032. }
  2033. // method id "drive.changes.getStartPageToken":
  2034. type ChangesGetStartPageTokenCall struct {
  2035. s *Service
  2036. urlParams_ gensupport.URLParams
  2037. ifNoneMatch_ string
  2038. ctx_ context.Context
  2039. header_ http.Header
  2040. }
  2041. // GetStartPageToken: Gets the starting pageToken for listing future
  2042. // changes.
  2043. func (r *ChangesService) GetStartPageToken() *ChangesGetStartPageTokenCall {
  2044. c := &ChangesGetStartPageTokenCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2045. return c
  2046. }
  2047. // SupportsTeamDrives sets the optional parameter "supportsTeamDrives":
  2048. // Whether the requesting application supports Team Drives.
  2049. func (c *ChangesGetStartPageTokenCall) SupportsTeamDrives(supportsTeamDrives bool) *ChangesGetStartPageTokenCall {
  2050. c.urlParams_.Set("supportsTeamDrives", fmt.Sprint(supportsTeamDrives))
  2051. return c
  2052. }
  2053. // TeamDriveId sets the optional parameter "teamDriveId": The ID of the
  2054. // Team Drive for which the starting pageToken for listing future
  2055. // changes from that Team Drive will be returned.
  2056. func (c *ChangesGetStartPageTokenCall) TeamDriveId(teamDriveId string) *ChangesGetStartPageTokenCall {
  2057. c.urlParams_.Set("teamDriveId", teamDriveId)
  2058. return c
  2059. }
  2060. // Fields allows partial responses to be retrieved. See
  2061. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2062. // for more information.
  2063. func (c *ChangesGetStartPageTokenCall) Fields(s ...googleapi.Field) *ChangesGetStartPageTokenCall {
  2064. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2065. return c
  2066. }
  2067. // IfNoneMatch sets the optional parameter which makes the operation
  2068. // fail if the object's ETag matches the given value. This is useful for
  2069. // getting updates only after the object has changed since the last
  2070. // request. Use googleapi.IsNotModified to check whether the response
  2071. // error from Do is the result of In-None-Match.
  2072. func (c *ChangesGetStartPageTokenCall) IfNoneMatch(entityTag string) *ChangesGetStartPageTokenCall {
  2073. c.ifNoneMatch_ = entityTag
  2074. return c
  2075. }
  2076. // Context sets the context to be used in this call's Do method. Any
  2077. // pending HTTP request will be aborted if the provided context is
  2078. // canceled.
  2079. func (c *ChangesGetStartPageTokenCall) Context(ctx context.Context) *ChangesGetStartPageTokenCall {
  2080. c.ctx_ = ctx
  2081. return c
  2082. }
  2083. // Header returns an http.Header that can be modified by the caller to
  2084. // add HTTP headers to the request.
  2085. func (c *ChangesGetStartPageTokenCall) Header() http.Header {
  2086. if c.header_ == nil {
  2087. c.header_ = make(http.Header)
  2088. }
  2089. return c.header_
  2090. }
  2091. func (c *ChangesGetStartPageTokenCall) doRequest(alt string) (*http.Response, error) {
  2092. reqHeaders := make(http.Header)
  2093. for k, v := range c.header_ {
  2094. reqHeaders[k] = v
  2095. }
  2096. reqHeaders.Set("User-Agent", c.s.userAgent())
  2097. if c.ifNoneMatch_ != "" {
  2098. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  2099. }
  2100. var body io.Reader = nil
  2101. c.urlParams_.Set("alt", alt)
  2102. c.urlParams_.Set("prettyPrint", "false")
  2103. urls := googleapi.ResolveRelative(c.s.BasePath, "changes/startPageToken")
  2104. urls += "?" + c.urlParams_.Encode()
  2105. req, err := http.NewRequest("GET", urls, body)
  2106. if err != nil {
  2107. return nil, err
  2108. }
  2109. req.Header = reqHeaders
  2110. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2111. }
  2112. // Do executes the "drive.changes.getStartPageToken" call.
  2113. // Exactly one of *StartPageToken or error will be non-nil. Any non-2xx
  2114. // status code is an error. Response headers are in either
  2115. // *StartPageToken.ServerResponse.Header or (if a response was returned
  2116. // at all) in error.(*googleapi.Error).Header. Use
  2117. // googleapi.IsNotModified to check whether the returned error was
  2118. // because http.StatusNotModified was returned.
  2119. func (c *ChangesGetStartPageTokenCall) Do(opts ...googleapi.CallOption) (*StartPageToken, error) {
  2120. gensupport.SetOptions(c.urlParams_, opts...)
  2121. res, err := c.doRequest("json")
  2122. if res != nil && res.StatusCode == http.StatusNotModified {
  2123. if res.Body != nil {
  2124. res.Body.Close()
  2125. }
  2126. return nil, &googleapi.Error{
  2127. Code: res.StatusCode,
  2128. Header: res.Header,
  2129. }
  2130. }
  2131. if err != nil {
  2132. return nil, err
  2133. }
  2134. defer googleapi.CloseBody(res)
  2135. if err := googleapi.CheckResponse(res); err != nil {
  2136. return nil, err
  2137. }
  2138. ret := &StartPageToken{
  2139. ServerResponse: googleapi.ServerResponse{
  2140. Header: res.Header,
  2141. HTTPStatusCode: res.StatusCode,
  2142. },
  2143. }
  2144. target := &ret
  2145. if err := gensupport.DecodeResponse(target, res); err != nil {
  2146. return nil, err
  2147. }
  2148. return ret, nil
  2149. // {
  2150. // "description": "Gets the starting pageToken for listing future changes.",
  2151. // "httpMethod": "GET",
  2152. // "id": "drive.changes.getStartPageToken",
  2153. // "parameters": {
  2154. // "supportsTeamDrives": {
  2155. // "default": "false",
  2156. // "description": "Whether the requesting application supports Team Drives.",
  2157. // "location": "query",
  2158. // "type": "boolean"
  2159. // },
  2160. // "teamDriveId": {
  2161. // "description": "The ID of the Team Drive for which the starting pageToken for listing future changes from that Team Drive will be returned.",
  2162. // "location": "query",
  2163. // "type": "string"
  2164. // }
  2165. // },
  2166. // "path": "changes/startPageToken",
  2167. // "response": {
  2168. // "$ref": "StartPageToken"
  2169. // },
  2170. // "scopes": [
  2171. // "https://www.googleapis.com/auth/drive",
  2172. // "https://www.googleapis.com/auth/drive.appdata",
  2173. // "https://www.googleapis.com/auth/drive.file",
  2174. // "https://www.googleapis.com/auth/drive.metadata",
  2175. // "https://www.googleapis.com/auth/drive.metadata.readonly",
  2176. // "https://www.googleapis.com/auth/drive.photos.readonly",
  2177. // "https://www.googleapis.com/auth/drive.readonly"
  2178. // ]
  2179. // }
  2180. }
  2181. // method id "drive.changes.list":
  2182. type ChangesListCall struct {
  2183. s *Service
  2184. urlParams_ gensupport.URLParams
  2185. ifNoneMatch_ string
  2186. ctx_ context.Context
  2187. header_ http.Header
  2188. }
  2189. // List: Lists the changes for a user or Team Drive.
  2190. func (r *ChangesService) List(pageToken string) *ChangesListCall {
  2191. c := &ChangesListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2192. c.urlParams_.Set("pageToken", pageToken)
  2193. return c
  2194. }
  2195. // IncludeCorpusRemovals sets the optional parameter
  2196. // "includeCorpusRemovals": Whether changes should include the file
  2197. // resource if the file is still accessible by the user at the time of
  2198. // the request, even when a file was removed from the list of changes
  2199. // and there will be no further change entries for this file.
  2200. func (c *ChangesListCall) IncludeCorpusRemovals(includeCorpusRemovals bool) *ChangesListCall {
  2201. c.urlParams_.Set("includeCorpusRemovals", fmt.Sprint(includeCorpusRemovals))
  2202. return c
  2203. }
  2204. // IncludeRemoved sets the optional parameter "includeRemoved": Whether
  2205. // to include changes indicating that items have been removed from the
  2206. // list of changes, for example by deletion or loss of access.
  2207. func (c *ChangesListCall) IncludeRemoved(includeRemoved bool) *ChangesListCall {
  2208. c.urlParams_.Set("includeRemoved", fmt.Sprint(includeRemoved))
  2209. return c
  2210. }
  2211. // IncludeTeamDriveItems sets the optional parameter
  2212. // "includeTeamDriveItems": Whether Team Drive files or changes should
  2213. // be included in results.
  2214. func (c *ChangesListCall) IncludeTeamDriveItems(includeTeamDriveItems bool) *ChangesListCall {
  2215. c.urlParams_.Set("includeTeamDriveItems", fmt.Sprint(includeTeamDriveItems))
  2216. return c
  2217. }
  2218. // PageSize sets the optional parameter "pageSize": The maximum number
  2219. // of changes to return per page.
  2220. func (c *ChangesListCall) PageSize(pageSize int64) *ChangesListCall {
  2221. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  2222. return c
  2223. }
  2224. // RestrictToMyDrive sets the optional parameter "restrictToMyDrive":
  2225. // Whether to restrict the results to changes inside the My Drive
  2226. // hierarchy. This omits changes to files such as those in the
  2227. // Application Data folder or shared files which have not been added to
  2228. // My Drive.
  2229. func (c *ChangesListCall) RestrictToMyDrive(restrictToMyDrive bool) *ChangesListCall {
  2230. c.urlParams_.Set("restrictToMyDrive", fmt.Sprint(restrictToMyDrive))
  2231. return c
  2232. }
  2233. // Spaces sets the optional parameter "spaces": A comma-separated list
  2234. // of spaces to query within the user corpus. Supported values are
  2235. // 'drive', 'appDataFolder' and 'photos'.
  2236. func (c *ChangesListCall) Spaces(spaces string) *ChangesListCall {
  2237. c.urlParams_.Set("spaces", spaces)
  2238. return c
  2239. }
  2240. // SupportsTeamDrives sets the optional parameter "supportsTeamDrives":
  2241. // Whether the requesting application supports Team Drives.
  2242. func (c *ChangesListCall) SupportsTeamDrives(supportsTeamDrives bool) *ChangesListCall {
  2243. c.urlParams_.Set("supportsTeamDrives", fmt.Sprint(supportsTeamDrives))
  2244. return c
  2245. }
  2246. // TeamDriveId sets the optional parameter "teamDriveId": The Team Drive
  2247. // from which changes will be returned. If specified the change IDs will
  2248. // be reflective of the Team Drive; use the combined Team Drive ID and
  2249. // change ID as an identifier.
  2250. func (c *ChangesListCall) TeamDriveId(teamDriveId string) *ChangesListCall {
  2251. c.urlParams_.Set("teamDriveId", teamDriveId)
  2252. return c
  2253. }
  2254. // Fields allows partial responses to be retrieved. See
  2255. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2256. // for more information.
  2257. func (c *ChangesListCall) Fields(s ...googleapi.Field) *ChangesListCall {
  2258. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2259. return c
  2260. }
  2261. // IfNoneMatch sets the optional parameter which makes the operation
  2262. // fail if the object's ETag matches the given value. This is useful for
  2263. // getting updates only after the object has changed since the last
  2264. // request. Use googleapi.IsNotModified to check whether the response
  2265. // error from Do is the result of In-None-Match.
  2266. func (c *ChangesListCall) IfNoneMatch(entityTag string) *ChangesListCall {
  2267. c.ifNoneMatch_ = entityTag
  2268. return c
  2269. }
  2270. // Context sets the context to be used in this call's Do method. Any
  2271. // pending HTTP request will be aborted if the provided context is
  2272. // canceled.
  2273. func (c *ChangesListCall) Context(ctx context.Context) *ChangesListCall {
  2274. c.ctx_ = ctx
  2275. return c
  2276. }
  2277. // Header returns an http.Header that can be modified by the caller to
  2278. // add HTTP headers to the request.
  2279. func (c *ChangesListCall) Header() http.Header {
  2280. if c.header_ == nil {
  2281. c.header_ = make(http.Header)
  2282. }
  2283. return c.header_
  2284. }
  2285. func (c *ChangesListCall) doRequest(alt string) (*http.Response, error) {
  2286. reqHeaders := make(http.Header)
  2287. for k, v := range c.header_ {
  2288. reqHeaders[k] = v
  2289. }
  2290. reqHeaders.Set("User-Agent", c.s.userAgent())
  2291. if c.ifNoneMatch_ != "" {
  2292. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  2293. }
  2294. var body io.Reader = nil
  2295. c.urlParams_.Set("alt", alt)
  2296. c.urlParams_.Set("prettyPrint", "false")
  2297. urls := googleapi.ResolveRelative(c.s.BasePath, "changes")
  2298. urls += "?" + c.urlParams_.Encode()
  2299. req, err := http.NewRequest("GET", urls, body)
  2300. if err != nil {
  2301. return nil, err
  2302. }
  2303. req.Header = reqHeaders
  2304. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2305. }
  2306. // Do executes the "drive.changes.list" call.
  2307. // Exactly one of *ChangeList or error will be non-nil. Any non-2xx
  2308. // status code is an error. Response headers are in either
  2309. // *ChangeList.ServerResponse.Header or (if a response was returned at
  2310. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  2311. // to check whether the returned error was because
  2312. // http.StatusNotModified was returned.
  2313. func (c *ChangesListCall) Do(opts ...googleapi.CallOption) (*ChangeList, error) {
  2314. gensupport.SetOptions(c.urlParams_, opts...)
  2315. res, err := c.doRequest("json")
  2316. if res != nil && res.StatusCode == http.StatusNotModified {
  2317. if res.Body != nil {
  2318. res.Body.Close()
  2319. }
  2320. return nil, &googleapi.Error{
  2321. Code: res.StatusCode,
  2322. Header: res.Header,
  2323. }
  2324. }
  2325. if err != nil {
  2326. return nil, err
  2327. }
  2328. defer googleapi.CloseBody(res)
  2329. if err := googleapi.CheckResponse(res); err != nil {
  2330. return nil, err
  2331. }
  2332. ret := &ChangeList{
  2333. ServerResponse: googleapi.ServerResponse{
  2334. Header: res.Header,
  2335. HTTPStatusCode: res.StatusCode,
  2336. },
  2337. }
  2338. target := &ret
  2339. if err := gensupport.DecodeResponse(target, res); err != nil {
  2340. return nil, err
  2341. }
  2342. return ret, nil
  2343. // {
  2344. // "description": "Lists the changes for a user or Team Drive.",
  2345. // "httpMethod": "GET",
  2346. // "id": "drive.changes.list",
  2347. // "parameterOrder": [
  2348. // "pageToken"
  2349. // ],
  2350. // "parameters": {
  2351. // "includeCorpusRemovals": {
  2352. // "default": "false",
  2353. // "description": "Whether changes should include the file resource if the file is still accessible by the user at the time of the request, even when a file was removed from the list of changes and there will be no further change entries for this file.",
  2354. // "location": "query",
  2355. // "type": "boolean"
  2356. // },
  2357. // "includeRemoved": {
  2358. // "default": "true",
  2359. // "description": "Whether to include changes indicating that items have been removed from the list of changes, for example by deletion or loss of access.",
  2360. // "location": "query",
  2361. // "type": "boolean"
  2362. // },
  2363. // "includeTeamDriveItems": {
  2364. // "default": "false",
  2365. // "description": "Whether Team Drive files or changes should be included in results.",
  2366. // "location": "query",
  2367. // "type": "boolean"
  2368. // },
  2369. // "pageSize": {
  2370. // "default": "100",
  2371. // "description": "The maximum number of changes to return per page.",
  2372. // "format": "int32",
  2373. // "location": "query",
  2374. // "maximum": "1000",
  2375. // "minimum": "1",
  2376. // "type": "integer"
  2377. // },
  2378. // "pageToken": {
  2379. // "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.",
  2380. // "location": "query",
  2381. // "required": true,
  2382. // "type": "string"
  2383. // },
  2384. // "restrictToMyDrive": {
  2385. // "default": "false",
  2386. // "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.",
  2387. // "location": "query",
  2388. // "type": "boolean"
  2389. // },
  2390. // "spaces": {
  2391. // "default": "drive",
  2392. // "description": "A comma-separated list of spaces to query within the user corpus. Supported values are 'drive', 'appDataFolder' and 'photos'.",
  2393. // "location": "query",
  2394. // "type": "string"
  2395. // },
  2396. // "supportsTeamDrives": {
  2397. // "default": "false",
  2398. // "description": "Whether the requesting application supports Team Drives.",
  2399. // "location": "query",
  2400. // "type": "boolean"
  2401. // },
  2402. // "teamDriveId": {
  2403. // "description": "The Team Drive from which changes will be returned. If specified the change IDs will be reflective of the Team Drive; use the combined Team Drive ID and change ID as an identifier.",
  2404. // "location": "query",
  2405. // "type": "string"
  2406. // }
  2407. // },
  2408. // "path": "changes",
  2409. // "response": {
  2410. // "$ref": "ChangeList"
  2411. // },
  2412. // "scopes": [
  2413. // "https://www.googleapis.com/auth/drive",
  2414. // "https://www.googleapis.com/auth/drive.appdata",
  2415. // "https://www.googleapis.com/auth/drive.file",
  2416. // "https://www.googleapis.com/auth/drive.metadata",
  2417. // "https://www.googleapis.com/auth/drive.metadata.readonly",
  2418. // "https://www.googleapis.com/auth/drive.photos.readonly",
  2419. // "https://www.googleapis.com/auth/drive.readonly"
  2420. // ],
  2421. // "supportsSubscription": true
  2422. // }
  2423. }
  2424. // method id "drive.changes.watch":
  2425. type ChangesWatchCall struct {
  2426. s *Service
  2427. channel *Channel
  2428. urlParams_ gensupport.URLParams
  2429. ctx_ context.Context
  2430. header_ http.Header
  2431. }
  2432. // Watch: Subscribes to changes for a user.
  2433. func (r *ChangesService) Watch(pageToken string, channel *Channel) *ChangesWatchCall {
  2434. c := &ChangesWatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2435. c.urlParams_.Set("pageToken", pageToken)
  2436. c.channel = channel
  2437. return c
  2438. }
  2439. // IncludeCorpusRemovals sets the optional parameter
  2440. // "includeCorpusRemovals": Whether changes should include the file
  2441. // resource if the file is still accessible by the user at the time of
  2442. // the request, even when a file was removed from the list of changes
  2443. // and there will be no further change entries for this file.
  2444. func (c *ChangesWatchCall) IncludeCorpusRemovals(includeCorpusRemovals bool) *ChangesWatchCall {
  2445. c.urlParams_.Set("includeCorpusRemovals", fmt.Sprint(includeCorpusRemovals))
  2446. return c
  2447. }
  2448. // IncludeRemoved sets the optional parameter "includeRemoved": Whether
  2449. // to include changes indicating that items have been removed from the
  2450. // list of changes, for example by deletion or loss of access.
  2451. func (c *ChangesWatchCall) IncludeRemoved(includeRemoved bool) *ChangesWatchCall {
  2452. c.urlParams_.Set("includeRemoved", fmt.Sprint(includeRemoved))
  2453. return c
  2454. }
  2455. // IncludeTeamDriveItems sets the optional parameter
  2456. // "includeTeamDriveItems": Whether Team Drive files or changes should
  2457. // be included in results.
  2458. func (c *ChangesWatchCall) IncludeTeamDriveItems(includeTeamDriveItems bool) *ChangesWatchCall {
  2459. c.urlParams_.Set("includeTeamDriveItems", fmt.Sprint(includeTeamDriveItems))
  2460. return c
  2461. }
  2462. // PageSize sets the optional parameter "pageSize": The maximum number
  2463. // of changes to return per page.
  2464. func (c *ChangesWatchCall) PageSize(pageSize int64) *ChangesWatchCall {
  2465. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  2466. return c
  2467. }
  2468. // RestrictToMyDrive sets the optional parameter "restrictToMyDrive":
  2469. // Whether to restrict the results to changes inside the My Drive
  2470. // hierarchy. This omits changes to files such as those in the
  2471. // Application Data folder or shared files which have not been added to
  2472. // My Drive.
  2473. func (c *ChangesWatchCall) RestrictToMyDrive(restrictToMyDrive bool) *ChangesWatchCall {
  2474. c.urlParams_.Set("restrictToMyDrive", fmt.Sprint(restrictToMyDrive))
  2475. return c
  2476. }
  2477. // Spaces sets the optional parameter "spaces": A comma-separated list
  2478. // of spaces to query within the user corpus. Supported values are
  2479. // 'drive', 'appDataFolder' and 'photos'.
  2480. func (c *ChangesWatchCall) Spaces(spaces string) *ChangesWatchCall {
  2481. c.urlParams_.Set("spaces", spaces)
  2482. return c
  2483. }
  2484. // SupportsTeamDrives sets the optional parameter "supportsTeamDrives":
  2485. // Whether the requesting application supports Team Drives.
  2486. func (c *ChangesWatchCall) SupportsTeamDrives(supportsTeamDrives bool) *ChangesWatchCall {
  2487. c.urlParams_.Set("supportsTeamDrives", fmt.Sprint(supportsTeamDrives))
  2488. return c
  2489. }
  2490. // TeamDriveId sets the optional parameter "teamDriveId": The Team Drive
  2491. // from which changes will be returned. If specified the change IDs will
  2492. // be reflective of the Team Drive; use the combined Team Drive ID and
  2493. // change ID as an identifier.
  2494. func (c *ChangesWatchCall) TeamDriveId(teamDriveId string) *ChangesWatchCall {
  2495. c.urlParams_.Set("teamDriveId", teamDriveId)
  2496. return c
  2497. }
  2498. // Fields allows partial responses to be retrieved. See
  2499. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2500. // for more information.
  2501. func (c *ChangesWatchCall) Fields(s ...googleapi.Field) *ChangesWatchCall {
  2502. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2503. return c
  2504. }
  2505. // Context sets the context to be used in this call's Do method. Any
  2506. // pending HTTP request will be aborted if the provided context is
  2507. // canceled.
  2508. func (c *ChangesWatchCall) Context(ctx context.Context) *ChangesWatchCall {
  2509. c.ctx_ = ctx
  2510. return c
  2511. }
  2512. // Header returns an http.Header that can be modified by the caller to
  2513. // add HTTP headers to the request.
  2514. func (c *ChangesWatchCall) Header() http.Header {
  2515. if c.header_ == nil {
  2516. c.header_ = make(http.Header)
  2517. }
  2518. return c.header_
  2519. }
  2520. func (c *ChangesWatchCall) doRequest(alt string) (*http.Response, error) {
  2521. reqHeaders := make(http.Header)
  2522. for k, v := range c.header_ {
  2523. reqHeaders[k] = v
  2524. }
  2525. reqHeaders.Set("User-Agent", c.s.userAgent())
  2526. var body io.Reader = nil
  2527. body, err := googleapi.WithoutDataWrapper.JSONReader(c.channel)
  2528. if err != nil {
  2529. return nil, err
  2530. }
  2531. reqHeaders.Set("Content-Type", "application/json")
  2532. c.urlParams_.Set("alt", alt)
  2533. c.urlParams_.Set("prettyPrint", "false")
  2534. urls := googleapi.ResolveRelative(c.s.BasePath, "changes/watch")
  2535. urls += "?" + c.urlParams_.Encode()
  2536. req, err := http.NewRequest("POST", urls, body)
  2537. if err != nil {
  2538. return nil, err
  2539. }
  2540. req.Header = reqHeaders
  2541. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2542. }
  2543. // Do executes the "drive.changes.watch" call.
  2544. // Exactly one of *Channel or error will be non-nil. Any non-2xx status
  2545. // code is an error. Response headers are in either
  2546. // *Channel.ServerResponse.Header or (if a response was returned at all)
  2547. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  2548. // check whether the returned error was because http.StatusNotModified
  2549. // was returned.
  2550. func (c *ChangesWatchCall) Do(opts ...googleapi.CallOption) (*Channel, error) {
  2551. gensupport.SetOptions(c.urlParams_, opts...)
  2552. res, err := c.doRequest("json")
  2553. if res != nil && res.StatusCode == http.StatusNotModified {
  2554. if res.Body != nil {
  2555. res.Body.Close()
  2556. }
  2557. return nil, &googleapi.Error{
  2558. Code: res.StatusCode,
  2559. Header: res.Header,
  2560. }
  2561. }
  2562. if err != nil {
  2563. return nil, err
  2564. }
  2565. defer googleapi.CloseBody(res)
  2566. if err := googleapi.CheckResponse(res); err != nil {
  2567. return nil, err
  2568. }
  2569. ret := &Channel{
  2570. ServerResponse: googleapi.ServerResponse{
  2571. Header: res.Header,
  2572. HTTPStatusCode: res.StatusCode,
  2573. },
  2574. }
  2575. target := &ret
  2576. if err := gensupport.DecodeResponse(target, res); err != nil {
  2577. return nil, err
  2578. }
  2579. return ret, nil
  2580. // {
  2581. // "description": "Subscribes to changes for a user.",
  2582. // "httpMethod": "POST",
  2583. // "id": "drive.changes.watch",
  2584. // "parameterOrder": [
  2585. // "pageToken"
  2586. // ],
  2587. // "parameters": {
  2588. // "includeCorpusRemovals": {
  2589. // "default": "false",
  2590. // "description": "Whether changes should include the file resource if the file is still accessible by the user at the time of the request, even when a file was removed from the list of changes and there will be no further change entries for this file.",
  2591. // "location": "query",
  2592. // "type": "boolean"
  2593. // },
  2594. // "includeRemoved": {
  2595. // "default": "true",
  2596. // "description": "Whether to include changes indicating that items have been removed from the list of changes, for example by deletion or loss of access.",
  2597. // "location": "query",
  2598. // "type": "boolean"
  2599. // },
  2600. // "includeTeamDriveItems": {
  2601. // "default": "false",
  2602. // "description": "Whether Team Drive files or changes should be included in results.",
  2603. // "location": "query",
  2604. // "type": "boolean"
  2605. // },
  2606. // "pageSize": {
  2607. // "default": "100",
  2608. // "description": "The maximum number of changes to return per page.",
  2609. // "format": "int32",
  2610. // "location": "query",
  2611. // "maximum": "1000",
  2612. // "minimum": "1",
  2613. // "type": "integer"
  2614. // },
  2615. // "pageToken": {
  2616. // "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.",
  2617. // "location": "query",
  2618. // "required": true,
  2619. // "type": "string"
  2620. // },
  2621. // "restrictToMyDrive": {
  2622. // "default": "false",
  2623. // "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.",
  2624. // "location": "query",
  2625. // "type": "boolean"
  2626. // },
  2627. // "spaces": {
  2628. // "default": "drive",
  2629. // "description": "A comma-separated list of spaces to query within the user corpus. Supported values are 'drive', 'appDataFolder' and 'photos'.",
  2630. // "location": "query",
  2631. // "type": "string"
  2632. // },
  2633. // "supportsTeamDrives": {
  2634. // "default": "false",
  2635. // "description": "Whether the requesting application supports Team Drives.",
  2636. // "location": "query",
  2637. // "type": "boolean"
  2638. // },
  2639. // "teamDriveId": {
  2640. // "description": "The Team Drive from which changes will be returned. If specified the change IDs will be reflective of the Team Drive; use the combined Team Drive ID and change ID as an identifier.",
  2641. // "location": "query",
  2642. // "type": "string"
  2643. // }
  2644. // },
  2645. // "path": "changes/watch",
  2646. // "request": {
  2647. // "$ref": "Channel",
  2648. // "parameterName": "resource"
  2649. // },
  2650. // "response": {
  2651. // "$ref": "Channel"
  2652. // },
  2653. // "scopes": [
  2654. // "https://www.googleapis.com/auth/drive",
  2655. // "https://www.googleapis.com/auth/drive.appdata",
  2656. // "https://www.googleapis.com/auth/drive.file",
  2657. // "https://www.googleapis.com/auth/drive.metadata",
  2658. // "https://www.googleapis.com/auth/drive.metadata.readonly",
  2659. // "https://www.googleapis.com/auth/drive.photos.readonly",
  2660. // "https://www.googleapis.com/auth/drive.readonly"
  2661. // ],
  2662. // "supportsSubscription": true
  2663. // }
  2664. }
  2665. // method id "drive.channels.stop":
  2666. type ChannelsStopCall struct {
  2667. s *Service
  2668. channel *Channel
  2669. urlParams_ gensupport.URLParams
  2670. ctx_ context.Context
  2671. header_ http.Header
  2672. }
  2673. // Stop: Stop watching resources through this channel
  2674. func (r *ChannelsService) Stop(channel *Channel) *ChannelsStopCall {
  2675. c := &ChannelsStopCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2676. c.channel = channel
  2677. return c
  2678. }
  2679. // Fields allows partial responses to be retrieved. See
  2680. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2681. // for more information.
  2682. func (c *ChannelsStopCall) Fields(s ...googleapi.Field) *ChannelsStopCall {
  2683. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2684. return c
  2685. }
  2686. // Context sets the context to be used in this call's Do method. Any
  2687. // pending HTTP request will be aborted if the provided context is
  2688. // canceled.
  2689. func (c *ChannelsStopCall) Context(ctx context.Context) *ChannelsStopCall {
  2690. c.ctx_ = ctx
  2691. return c
  2692. }
  2693. // Header returns an http.Header that can be modified by the caller to
  2694. // add HTTP headers to the request.
  2695. func (c *ChannelsStopCall) Header() http.Header {
  2696. if c.header_ == nil {
  2697. c.header_ = make(http.Header)
  2698. }
  2699. return c.header_
  2700. }
  2701. func (c *ChannelsStopCall) doRequest(alt string) (*http.Response, error) {
  2702. reqHeaders := make(http.Header)
  2703. for k, v := range c.header_ {
  2704. reqHeaders[k] = v
  2705. }
  2706. reqHeaders.Set("User-Agent", c.s.userAgent())
  2707. var body io.Reader = nil
  2708. body, err := googleapi.WithoutDataWrapper.JSONReader(c.channel)
  2709. if err != nil {
  2710. return nil, err
  2711. }
  2712. reqHeaders.Set("Content-Type", "application/json")
  2713. c.urlParams_.Set("alt", alt)
  2714. c.urlParams_.Set("prettyPrint", "false")
  2715. urls := googleapi.ResolveRelative(c.s.BasePath, "channels/stop")
  2716. urls += "?" + c.urlParams_.Encode()
  2717. req, err := http.NewRequest("POST", urls, body)
  2718. if err != nil {
  2719. return nil, err
  2720. }
  2721. req.Header = reqHeaders
  2722. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2723. }
  2724. // Do executes the "drive.channels.stop" call.
  2725. func (c *ChannelsStopCall) Do(opts ...googleapi.CallOption) error {
  2726. gensupport.SetOptions(c.urlParams_, opts...)
  2727. res, err := c.doRequest("json")
  2728. if err != nil {
  2729. return err
  2730. }
  2731. defer googleapi.CloseBody(res)
  2732. if err := googleapi.CheckResponse(res); err != nil {
  2733. return err
  2734. }
  2735. return nil
  2736. // {
  2737. // "description": "Stop watching resources through this channel",
  2738. // "httpMethod": "POST",
  2739. // "id": "drive.channels.stop",
  2740. // "path": "channels/stop",
  2741. // "request": {
  2742. // "$ref": "Channel",
  2743. // "parameterName": "resource"
  2744. // },
  2745. // "scopes": [
  2746. // "https://www.googleapis.com/auth/drive",
  2747. // "https://www.googleapis.com/auth/drive.appdata",
  2748. // "https://www.googleapis.com/auth/drive.file",
  2749. // "https://www.googleapis.com/auth/drive.metadata",
  2750. // "https://www.googleapis.com/auth/drive.metadata.readonly",
  2751. // "https://www.googleapis.com/auth/drive.photos.readonly",
  2752. // "https://www.googleapis.com/auth/drive.readonly"
  2753. // ]
  2754. // }
  2755. }
  2756. // method id "drive.comments.create":
  2757. type CommentsCreateCall struct {
  2758. s *Service
  2759. fileId string
  2760. comment *Comment
  2761. urlParams_ gensupport.URLParams
  2762. ctx_ context.Context
  2763. header_ http.Header
  2764. }
  2765. // Create: Creates a new comment on a file.
  2766. func (r *CommentsService) Create(fileId string, comment *Comment) *CommentsCreateCall {
  2767. c := &CommentsCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2768. c.fileId = fileId
  2769. c.comment = comment
  2770. return c
  2771. }
  2772. // Fields allows partial responses to be retrieved. See
  2773. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2774. // for more information.
  2775. func (c *CommentsCreateCall) Fields(s ...googleapi.Field) *CommentsCreateCall {
  2776. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2777. return c
  2778. }
  2779. // Context sets the context to be used in this call's Do method. Any
  2780. // pending HTTP request will be aborted if the provided context is
  2781. // canceled.
  2782. func (c *CommentsCreateCall) Context(ctx context.Context) *CommentsCreateCall {
  2783. c.ctx_ = ctx
  2784. return c
  2785. }
  2786. // Header returns an http.Header that can be modified by the caller to
  2787. // add HTTP headers to the request.
  2788. func (c *CommentsCreateCall) Header() http.Header {
  2789. if c.header_ == nil {
  2790. c.header_ = make(http.Header)
  2791. }
  2792. return c.header_
  2793. }
  2794. func (c *CommentsCreateCall) doRequest(alt string) (*http.Response, error) {
  2795. reqHeaders := make(http.Header)
  2796. for k, v := range c.header_ {
  2797. reqHeaders[k] = v
  2798. }
  2799. reqHeaders.Set("User-Agent", c.s.userAgent())
  2800. var body io.Reader = nil
  2801. body, err := googleapi.WithoutDataWrapper.JSONReader(c.comment)
  2802. if err != nil {
  2803. return nil, err
  2804. }
  2805. reqHeaders.Set("Content-Type", "application/json")
  2806. c.urlParams_.Set("alt", alt)
  2807. c.urlParams_.Set("prettyPrint", "false")
  2808. urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/comments")
  2809. urls += "?" + c.urlParams_.Encode()
  2810. req, err := http.NewRequest("POST", urls, body)
  2811. if err != nil {
  2812. return nil, err
  2813. }
  2814. req.Header = reqHeaders
  2815. googleapi.Expand(req.URL, map[string]string{
  2816. "fileId": c.fileId,
  2817. })
  2818. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2819. }
  2820. // Do executes the "drive.comments.create" call.
  2821. // Exactly one of *Comment or error will be non-nil. Any non-2xx status
  2822. // code is an error. Response headers are in either
  2823. // *Comment.ServerResponse.Header or (if a response was returned at all)
  2824. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  2825. // check whether the returned error was because http.StatusNotModified
  2826. // was returned.
  2827. func (c *CommentsCreateCall) Do(opts ...googleapi.CallOption) (*Comment, error) {
  2828. gensupport.SetOptions(c.urlParams_, opts...)
  2829. res, err := c.doRequest("json")
  2830. if res != nil && res.StatusCode == http.StatusNotModified {
  2831. if res.Body != nil {
  2832. res.Body.Close()
  2833. }
  2834. return nil, &googleapi.Error{
  2835. Code: res.StatusCode,
  2836. Header: res.Header,
  2837. }
  2838. }
  2839. if err != nil {
  2840. return nil, err
  2841. }
  2842. defer googleapi.CloseBody(res)
  2843. if err := googleapi.CheckResponse(res); err != nil {
  2844. return nil, err
  2845. }
  2846. ret := &Comment{
  2847. ServerResponse: googleapi.ServerResponse{
  2848. Header: res.Header,
  2849. HTTPStatusCode: res.StatusCode,
  2850. },
  2851. }
  2852. target := &ret
  2853. if err := gensupport.DecodeResponse(target, res); err != nil {
  2854. return nil, err
  2855. }
  2856. return ret, nil
  2857. // {
  2858. // "description": "Creates a new comment on a file.",
  2859. // "httpMethod": "POST",
  2860. // "id": "drive.comments.create",
  2861. // "parameterOrder": [
  2862. // "fileId"
  2863. // ],
  2864. // "parameters": {
  2865. // "fileId": {
  2866. // "description": "The ID of the file.",
  2867. // "location": "path",
  2868. // "required": true,
  2869. // "type": "string"
  2870. // }
  2871. // },
  2872. // "path": "files/{fileId}/comments",
  2873. // "request": {
  2874. // "$ref": "Comment"
  2875. // },
  2876. // "response": {
  2877. // "$ref": "Comment"
  2878. // },
  2879. // "scopes": [
  2880. // "https://www.googleapis.com/auth/drive",
  2881. // "https://www.googleapis.com/auth/drive.file"
  2882. // ]
  2883. // }
  2884. }
  2885. // method id "drive.comments.delete":
  2886. type CommentsDeleteCall struct {
  2887. s *Service
  2888. fileId string
  2889. commentId string
  2890. urlParams_ gensupport.URLParams
  2891. ctx_ context.Context
  2892. header_ http.Header
  2893. }
  2894. // Delete: Deletes a comment.
  2895. func (r *CommentsService) Delete(fileId string, commentId string) *CommentsDeleteCall {
  2896. c := &CommentsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2897. c.fileId = fileId
  2898. c.commentId = commentId
  2899. return c
  2900. }
  2901. // Fields allows partial responses to be retrieved. See
  2902. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2903. // for more information.
  2904. func (c *CommentsDeleteCall) Fields(s ...googleapi.Field) *CommentsDeleteCall {
  2905. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2906. return c
  2907. }
  2908. // Context sets the context to be used in this call's Do method. Any
  2909. // pending HTTP request will be aborted if the provided context is
  2910. // canceled.
  2911. func (c *CommentsDeleteCall) Context(ctx context.Context) *CommentsDeleteCall {
  2912. c.ctx_ = ctx
  2913. return c
  2914. }
  2915. // Header returns an http.Header that can be modified by the caller to
  2916. // add HTTP headers to the request.
  2917. func (c *CommentsDeleteCall) Header() http.Header {
  2918. if c.header_ == nil {
  2919. c.header_ = make(http.Header)
  2920. }
  2921. return c.header_
  2922. }
  2923. func (c *CommentsDeleteCall) doRequest(alt string) (*http.Response, error) {
  2924. reqHeaders := make(http.Header)
  2925. for k, v := range c.header_ {
  2926. reqHeaders[k] = v
  2927. }
  2928. reqHeaders.Set("User-Agent", c.s.userAgent())
  2929. var body io.Reader = nil
  2930. c.urlParams_.Set("alt", alt)
  2931. c.urlParams_.Set("prettyPrint", "false")
  2932. urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/comments/{commentId}")
  2933. urls += "?" + c.urlParams_.Encode()
  2934. req, err := http.NewRequest("DELETE", urls, body)
  2935. if err != nil {
  2936. return nil, err
  2937. }
  2938. req.Header = reqHeaders
  2939. googleapi.Expand(req.URL, map[string]string{
  2940. "fileId": c.fileId,
  2941. "commentId": c.commentId,
  2942. })
  2943. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2944. }
  2945. // Do executes the "drive.comments.delete" call.
  2946. func (c *CommentsDeleteCall) Do(opts ...googleapi.CallOption) error {
  2947. gensupport.SetOptions(c.urlParams_, opts...)
  2948. res, err := c.doRequest("json")
  2949. if err != nil {
  2950. return err
  2951. }
  2952. defer googleapi.CloseBody(res)
  2953. if err := googleapi.CheckResponse(res); err != nil {
  2954. return err
  2955. }
  2956. return nil
  2957. // {
  2958. // "description": "Deletes a comment.",
  2959. // "httpMethod": "DELETE",
  2960. // "id": "drive.comments.delete",
  2961. // "parameterOrder": [
  2962. // "fileId",
  2963. // "commentId"
  2964. // ],
  2965. // "parameters": {
  2966. // "commentId": {
  2967. // "description": "The ID of the comment.",
  2968. // "location": "path",
  2969. // "required": true,
  2970. // "type": "string"
  2971. // },
  2972. // "fileId": {
  2973. // "description": "The ID of the file.",
  2974. // "location": "path",
  2975. // "required": true,
  2976. // "type": "string"
  2977. // }
  2978. // },
  2979. // "path": "files/{fileId}/comments/{commentId}",
  2980. // "scopes": [
  2981. // "https://www.googleapis.com/auth/drive",
  2982. // "https://www.googleapis.com/auth/drive.file"
  2983. // ]
  2984. // }
  2985. }
  2986. // method id "drive.comments.get":
  2987. type CommentsGetCall struct {
  2988. s *Service
  2989. fileId string
  2990. commentId string
  2991. urlParams_ gensupport.URLParams
  2992. ifNoneMatch_ string
  2993. ctx_ context.Context
  2994. header_ http.Header
  2995. }
  2996. // Get: Gets a comment by ID.
  2997. func (r *CommentsService) Get(fileId string, commentId string) *CommentsGetCall {
  2998. c := &CommentsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2999. c.fileId = fileId
  3000. c.commentId = commentId
  3001. return c
  3002. }
  3003. // IncludeDeleted sets the optional parameter "includeDeleted": Whether
  3004. // to return deleted comments. Deleted comments will not include their
  3005. // original content.
  3006. func (c *CommentsGetCall) IncludeDeleted(includeDeleted bool) *CommentsGetCall {
  3007. c.urlParams_.Set("includeDeleted", fmt.Sprint(includeDeleted))
  3008. return c
  3009. }
  3010. // Fields allows partial responses to be retrieved. See
  3011. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3012. // for more information.
  3013. func (c *CommentsGetCall) Fields(s ...googleapi.Field) *CommentsGetCall {
  3014. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3015. return c
  3016. }
  3017. // IfNoneMatch sets the optional parameter which makes the operation
  3018. // fail if the object's ETag matches the given value. This is useful for
  3019. // getting updates only after the object has changed since the last
  3020. // request. Use googleapi.IsNotModified to check whether the response
  3021. // error from Do is the result of In-None-Match.
  3022. func (c *CommentsGetCall) IfNoneMatch(entityTag string) *CommentsGetCall {
  3023. c.ifNoneMatch_ = entityTag
  3024. return c
  3025. }
  3026. // Context sets the context to be used in this call's Do method. Any
  3027. // pending HTTP request will be aborted if the provided context is
  3028. // canceled.
  3029. func (c *CommentsGetCall) Context(ctx context.Context) *CommentsGetCall {
  3030. c.ctx_ = ctx
  3031. return c
  3032. }
  3033. // Header returns an http.Header that can be modified by the caller to
  3034. // add HTTP headers to the request.
  3035. func (c *CommentsGetCall) Header() http.Header {
  3036. if c.header_ == nil {
  3037. c.header_ = make(http.Header)
  3038. }
  3039. return c.header_
  3040. }
  3041. func (c *CommentsGetCall) doRequest(alt string) (*http.Response, error) {
  3042. reqHeaders := make(http.Header)
  3043. for k, v := range c.header_ {
  3044. reqHeaders[k] = v
  3045. }
  3046. reqHeaders.Set("User-Agent", c.s.userAgent())
  3047. if c.ifNoneMatch_ != "" {
  3048. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  3049. }
  3050. var body io.Reader = nil
  3051. c.urlParams_.Set("alt", alt)
  3052. c.urlParams_.Set("prettyPrint", "false")
  3053. urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/comments/{commentId}")
  3054. urls += "?" + c.urlParams_.Encode()
  3055. req, err := http.NewRequest("GET", urls, body)
  3056. if err != nil {
  3057. return nil, err
  3058. }
  3059. req.Header = reqHeaders
  3060. googleapi.Expand(req.URL, map[string]string{
  3061. "fileId": c.fileId,
  3062. "commentId": c.commentId,
  3063. })
  3064. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3065. }
  3066. // Do executes the "drive.comments.get" call.
  3067. // Exactly one of *Comment or error will be non-nil. Any non-2xx status
  3068. // code is an error. Response headers are in either
  3069. // *Comment.ServerResponse.Header or (if a response was returned at all)
  3070. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  3071. // check whether the returned error was because http.StatusNotModified
  3072. // was returned.
  3073. func (c *CommentsGetCall) Do(opts ...googleapi.CallOption) (*Comment, error) {
  3074. gensupport.SetOptions(c.urlParams_, opts...)
  3075. res, err := c.doRequest("json")
  3076. if res != nil && res.StatusCode == http.StatusNotModified {
  3077. if res.Body != nil {
  3078. res.Body.Close()
  3079. }
  3080. return nil, &googleapi.Error{
  3081. Code: res.StatusCode,
  3082. Header: res.Header,
  3083. }
  3084. }
  3085. if err != nil {
  3086. return nil, err
  3087. }
  3088. defer googleapi.CloseBody(res)
  3089. if err := googleapi.CheckResponse(res); err != nil {
  3090. return nil, err
  3091. }
  3092. ret := &Comment{
  3093. ServerResponse: googleapi.ServerResponse{
  3094. Header: res.Header,
  3095. HTTPStatusCode: res.StatusCode,
  3096. },
  3097. }
  3098. target := &ret
  3099. if err := gensupport.DecodeResponse(target, res); err != nil {
  3100. return nil, err
  3101. }
  3102. return ret, nil
  3103. // {
  3104. // "description": "Gets a comment by ID.",
  3105. // "httpMethod": "GET",
  3106. // "id": "drive.comments.get",
  3107. // "parameterOrder": [
  3108. // "fileId",
  3109. // "commentId"
  3110. // ],
  3111. // "parameters": {
  3112. // "commentId": {
  3113. // "description": "The ID of the comment.",
  3114. // "location": "path",
  3115. // "required": true,
  3116. // "type": "string"
  3117. // },
  3118. // "fileId": {
  3119. // "description": "The ID of the file.",
  3120. // "location": "path",
  3121. // "required": true,
  3122. // "type": "string"
  3123. // },
  3124. // "includeDeleted": {
  3125. // "default": "false",
  3126. // "description": "Whether to return deleted comments. Deleted comments will not include their original content.",
  3127. // "location": "query",
  3128. // "type": "boolean"
  3129. // }
  3130. // },
  3131. // "path": "files/{fileId}/comments/{commentId}",
  3132. // "response": {
  3133. // "$ref": "Comment"
  3134. // },
  3135. // "scopes": [
  3136. // "https://www.googleapis.com/auth/drive",
  3137. // "https://www.googleapis.com/auth/drive.file",
  3138. // "https://www.googleapis.com/auth/drive.readonly"
  3139. // ]
  3140. // }
  3141. }
  3142. // method id "drive.comments.list":
  3143. type CommentsListCall struct {
  3144. s *Service
  3145. fileId string
  3146. urlParams_ gensupport.URLParams
  3147. ifNoneMatch_ string
  3148. ctx_ context.Context
  3149. header_ http.Header
  3150. }
  3151. // List: Lists a file's comments.
  3152. func (r *CommentsService) List(fileId string) *CommentsListCall {
  3153. c := &CommentsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3154. c.fileId = fileId
  3155. return c
  3156. }
  3157. // IncludeDeleted sets the optional parameter "includeDeleted": Whether
  3158. // to include deleted comments. Deleted comments will not include their
  3159. // original content.
  3160. func (c *CommentsListCall) IncludeDeleted(includeDeleted bool) *CommentsListCall {
  3161. c.urlParams_.Set("includeDeleted", fmt.Sprint(includeDeleted))
  3162. return c
  3163. }
  3164. // PageSize sets the optional parameter "pageSize": The maximum number
  3165. // of comments to return per page.
  3166. func (c *CommentsListCall) PageSize(pageSize int64) *CommentsListCall {
  3167. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  3168. return c
  3169. }
  3170. // PageToken sets the optional parameter "pageToken": The token for
  3171. // continuing a previous list request on the next page. This should be
  3172. // set to the value of 'nextPageToken' from the previous response.
  3173. func (c *CommentsListCall) PageToken(pageToken string) *CommentsListCall {
  3174. c.urlParams_.Set("pageToken", pageToken)
  3175. return c
  3176. }
  3177. // StartModifiedTime sets the optional parameter "startModifiedTime":
  3178. // The minimum value of 'modifiedTime' for the result comments (RFC 3339
  3179. // date-time).
  3180. func (c *CommentsListCall) StartModifiedTime(startModifiedTime string) *CommentsListCall {
  3181. c.urlParams_.Set("startModifiedTime", startModifiedTime)
  3182. return c
  3183. }
  3184. // Fields allows partial responses to be retrieved. See
  3185. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3186. // for more information.
  3187. func (c *CommentsListCall) Fields(s ...googleapi.Field) *CommentsListCall {
  3188. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3189. return c
  3190. }
  3191. // IfNoneMatch sets the optional parameter which makes the operation
  3192. // fail if the object's ETag matches the given value. This is useful for
  3193. // getting updates only after the object has changed since the last
  3194. // request. Use googleapi.IsNotModified to check whether the response
  3195. // error from Do is the result of In-None-Match.
  3196. func (c *CommentsListCall) IfNoneMatch(entityTag string) *CommentsListCall {
  3197. c.ifNoneMatch_ = entityTag
  3198. return c
  3199. }
  3200. // Context sets the context to be used in this call's Do method. Any
  3201. // pending HTTP request will be aborted if the provided context is
  3202. // canceled.
  3203. func (c *CommentsListCall) Context(ctx context.Context) *CommentsListCall {
  3204. c.ctx_ = ctx
  3205. return c
  3206. }
  3207. // Header returns an http.Header that can be modified by the caller to
  3208. // add HTTP headers to the request.
  3209. func (c *CommentsListCall) Header() http.Header {
  3210. if c.header_ == nil {
  3211. c.header_ = make(http.Header)
  3212. }
  3213. return c.header_
  3214. }
  3215. func (c *CommentsListCall) doRequest(alt string) (*http.Response, error) {
  3216. reqHeaders := make(http.Header)
  3217. for k, v := range c.header_ {
  3218. reqHeaders[k] = v
  3219. }
  3220. reqHeaders.Set("User-Agent", c.s.userAgent())
  3221. if c.ifNoneMatch_ != "" {
  3222. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  3223. }
  3224. var body io.Reader = nil
  3225. c.urlParams_.Set("alt", alt)
  3226. c.urlParams_.Set("prettyPrint", "false")
  3227. urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/comments")
  3228. urls += "?" + c.urlParams_.Encode()
  3229. req, err := http.NewRequest("GET", urls, body)
  3230. if err != nil {
  3231. return nil, err
  3232. }
  3233. req.Header = reqHeaders
  3234. googleapi.Expand(req.URL, map[string]string{
  3235. "fileId": c.fileId,
  3236. })
  3237. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3238. }
  3239. // Do executes the "drive.comments.list" call.
  3240. // Exactly one of *CommentList or error will be non-nil. Any non-2xx
  3241. // status code is an error. Response headers are in either
  3242. // *CommentList.ServerResponse.Header or (if a response was returned at
  3243. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  3244. // to check whether the returned error was because
  3245. // http.StatusNotModified was returned.
  3246. func (c *CommentsListCall) Do(opts ...googleapi.CallOption) (*CommentList, error) {
  3247. gensupport.SetOptions(c.urlParams_, opts...)
  3248. res, err := c.doRequest("json")
  3249. if res != nil && res.StatusCode == http.StatusNotModified {
  3250. if res.Body != nil {
  3251. res.Body.Close()
  3252. }
  3253. return nil, &googleapi.Error{
  3254. Code: res.StatusCode,
  3255. Header: res.Header,
  3256. }
  3257. }
  3258. if err != nil {
  3259. return nil, err
  3260. }
  3261. defer googleapi.CloseBody(res)
  3262. if err := googleapi.CheckResponse(res); err != nil {
  3263. return nil, err
  3264. }
  3265. ret := &CommentList{
  3266. ServerResponse: googleapi.ServerResponse{
  3267. Header: res.Header,
  3268. HTTPStatusCode: res.StatusCode,
  3269. },
  3270. }
  3271. target := &ret
  3272. if err := gensupport.DecodeResponse(target, res); err != nil {
  3273. return nil, err
  3274. }
  3275. return ret, nil
  3276. // {
  3277. // "description": "Lists a file's comments.",
  3278. // "httpMethod": "GET",
  3279. // "id": "drive.comments.list",
  3280. // "parameterOrder": [
  3281. // "fileId"
  3282. // ],
  3283. // "parameters": {
  3284. // "fileId": {
  3285. // "description": "The ID of the file.",
  3286. // "location": "path",
  3287. // "required": true,
  3288. // "type": "string"
  3289. // },
  3290. // "includeDeleted": {
  3291. // "default": "false",
  3292. // "description": "Whether to include deleted comments. Deleted comments will not include their original content.",
  3293. // "location": "query",
  3294. // "type": "boolean"
  3295. // },
  3296. // "pageSize": {
  3297. // "default": "20",
  3298. // "description": "The maximum number of comments to return per page.",
  3299. // "format": "int32",
  3300. // "location": "query",
  3301. // "maximum": "100",
  3302. // "minimum": "1",
  3303. // "type": "integer"
  3304. // },
  3305. // "pageToken": {
  3306. // "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.",
  3307. // "location": "query",
  3308. // "type": "string"
  3309. // },
  3310. // "startModifiedTime": {
  3311. // "description": "The minimum value of 'modifiedTime' for the result comments (RFC 3339 date-time).",
  3312. // "location": "query",
  3313. // "type": "string"
  3314. // }
  3315. // },
  3316. // "path": "files/{fileId}/comments",
  3317. // "response": {
  3318. // "$ref": "CommentList"
  3319. // },
  3320. // "scopes": [
  3321. // "https://www.googleapis.com/auth/drive",
  3322. // "https://www.googleapis.com/auth/drive.file",
  3323. // "https://www.googleapis.com/auth/drive.readonly"
  3324. // ]
  3325. // }
  3326. }
  3327. // Pages invokes f for each page of results.
  3328. // A non-nil error returned from f will halt the iteration.
  3329. // The provided context supersedes any context provided to the Context method.
  3330. func (c *CommentsListCall) Pages(ctx context.Context, f func(*CommentList) error) error {
  3331. c.ctx_ = ctx
  3332. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  3333. for {
  3334. x, err := c.Do()
  3335. if err != nil {
  3336. return err
  3337. }
  3338. if err := f(x); err != nil {
  3339. return err
  3340. }
  3341. if x.NextPageToken == "" {
  3342. return nil
  3343. }
  3344. c.PageToken(x.NextPageToken)
  3345. }
  3346. }
  3347. // method id "drive.comments.update":
  3348. type CommentsUpdateCall struct {
  3349. s *Service
  3350. fileId string
  3351. commentId string
  3352. comment *Comment
  3353. urlParams_ gensupport.URLParams
  3354. ctx_ context.Context
  3355. header_ http.Header
  3356. }
  3357. // Update: Updates a comment with patch semantics.
  3358. func (r *CommentsService) Update(fileId string, commentId string, comment *Comment) *CommentsUpdateCall {
  3359. c := &CommentsUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3360. c.fileId = fileId
  3361. c.commentId = commentId
  3362. c.comment = comment
  3363. return c
  3364. }
  3365. // Fields allows partial responses to be retrieved. See
  3366. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3367. // for more information.
  3368. func (c *CommentsUpdateCall) Fields(s ...googleapi.Field) *CommentsUpdateCall {
  3369. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3370. return c
  3371. }
  3372. // Context sets the context to be used in this call's Do method. Any
  3373. // pending HTTP request will be aborted if the provided context is
  3374. // canceled.
  3375. func (c *CommentsUpdateCall) Context(ctx context.Context) *CommentsUpdateCall {
  3376. c.ctx_ = ctx
  3377. return c
  3378. }
  3379. // Header returns an http.Header that can be modified by the caller to
  3380. // add HTTP headers to the request.
  3381. func (c *CommentsUpdateCall) Header() http.Header {
  3382. if c.header_ == nil {
  3383. c.header_ = make(http.Header)
  3384. }
  3385. return c.header_
  3386. }
  3387. func (c *CommentsUpdateCall) doRequest(alt string) (*http.Response, error) {
  3388. reqHeaders := make(http.Header)
  3389. for k, v := range c.header_ {
  3390. reqHeaders[k] = v
  3391. }
  3392. reqHeaders.Set("User-Agent", c.s.userAgent())
  3393. var body io.Reader = nil
  3394. body, err := googleapi.WithoutDataWrapper.JSONReader(c.comment)
  3395. if err != nil {
  3396. return nil, err
  3397. }
  3398. reqHeaders.Set("Content-Type", "application/json")
  3399. c.urlParams_.Set("alt", alt)
  3400. c.urlParams_.Set("prettyPrint", "false")
  3401. urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/comments/{commentId}")
  3402. urls += "?" + c.urlParams_.Encode()
  3403. req, err := http.NewRequest("PATCH", urls, body)
  3404. if err != nil {
  3405. return nil, err
  3406. }
  3407. req.Header = reqHeaders
  3408. googleapi.Expand(req.URL, map[string]string{
  3409. "fileId": c.fileId,
  3410. "commentId": c.commentId,
  3411. })
  3412. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3413. }
  3414. // Do executes the "drive.comments.update" call.
  3415. // Exactly one of *Comment or error will be non-nil. Any non-2xx status
  3416. // code is an error. Response headers are in either
  3417. // *Comment.ServerResponse.Header or (if a response was returned at all)
  3418. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  3419. // check whether the returned error was because http.StatusNotModified
  3420. // was returned.
  3421. func (c *CommentsUpdateCall) Do(opts ...googleapi.CallOption) (*Comment, error) {
  3422. gensupport.SetOptions(c.urlParams_, opts...)
  3423. res, err := c.doRequest("json")
  3424. if res != nil && res.StatusCode == http.StatusNotModified {
  3425. if res.Body != nil {
  3426. res.Body.Close()
  3427. }
  3428. return nil, &googleapi.Error{
  3429. Code: res.StatusCode,
  3430. Header: res.Header,
  3431. }
  3432. }
  3433. if err != nil {
  3434. return nil, err
  3435. }
  3436. defer googleapi.CloseBody(res)
  3437. if err := googleapi.CheckResponse(res); err != nil {
  3438. return nil, err
  3439. }
  3440. ret := &Comment{
  3441. ServerResponse: googleapi.ServerResponse{
  3442. Header: res.Header,
  3443. HTTPStatusCode: res.StatusCode,
  3444. },
  3445. }
  3446. target := &ret
  3447. if err := gensupport.DecodeResponse(target, res); err != nil {
  3448. return nil, err
  3449. }
  3450. return ret, nil
  3451. // {
  3452. // "description": "Updates a comment with patch semantics.",
  3453. // "httpMethod": "PATCH",
  3454. // "id": "drive.comments.update",
  3455. // "parameterOrder": [
  3456. // "fileId",
  3457. // "commentId"
  3458. // ],
  3459. // "parameters": {
  3460. // "commentId": {
  3461. // "description": "The ID of the comment.",
  3462. // "location": "path",
  3463. // "required": true,
  3464. // "type": "string"
  3465. // },
  3466. // "fileId": {
  3467. // "description": "The ID of the file.",
  3468. // "location": "path",
  3469. // "required": true,
  3470. // "type": "string"
  3471. // }
  3472. // },
  3473. // "path": "files/{fileId}/comments/{commentId}",
  3474. // "request": {
  3475. // "$ref": "Comment"
  3476. // },
  3477. // "response": {
  3478. // "$ref": "Comment"
  3479. // },
  3480. // "scopes": [
  3481. // "https://www.googleapis.com/auth/drive",
  3482. // "https://www.googleapis.com/auth/drive.file"
  3483. // ]
  3484. // }
  3485. }
  3486. // method id "drive.files.copy":
  3487. type FilesCopyCall struct {
  3488. s *Service
  3489. fileId string
  3490. file *File
  3491. urlParams_ gensupport.URLParams
  3492. ctx_ context.Context
  3493. header_ http.Header
  3494. }
  3495. // Copy: Creates a copy of a file and applies any requested updates with
  3496. // patch semantics.
  3497. func (r *FilesService) Copy(fileId string, file *File) *FilesCopyCall {
  3498. c := &FilesCopyCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3499. c.fileId = fileId
  3500. c.file = file
  3501. return c
  3502. }
  3503. // IgnoreDefaultVisibility sets the optional parameter
  3504. // "ignoreDefaultVisibility": Whether to ignore the domain's default
  3505. // visibility settings for the created file. Domain administrators can
  3506. // choose to make all uploaded files visible to the domain by default;
  3507. // this parameter bypasses that behavior for the request. Permissions
  3508. // are still inherited from parent folders.
  3509. func (c *FilesCopyCall) IgnoreDefaultVisibility(ignoreDefaultVisibility bool) *FilesCopyCall {
  3510. c.urlParams_.Set("ignoreDefaultVisibility", fmt.Sprint(ignoreDefaultVisibility))
  3511. return c
  3512. }
  3513. // KeepRevisionForever sets the optional parameter
  3514. // "keepRevisionForever": Whether to set the 'keepForever' field in the
  3515. // new head revision. This is only applicable to files with binary
  3516. // content in Drive.
  3517. func (c *FilesCopyCall) KeepRevisionForever(keepRevisionForever bool) *FilesCopyCall {
  3518. c.urlParams_.Set("keepRevisionForever", fmt.Sprint(keepRevisionForever))
  3519. return c
  3520. }
  3521. // OcrLanguage sets the optional parameter "ocrLanguage": A language
  3522. // hint for OCR processing during image import (ISO 639-1 code).
  3523. func (c *FilesCopyCall) OcrLanguage(ocrLanguage string) *FilesCopyCall {
  3524. c.urlParams_.Set("ocrLanguage", ocrLanguage)
  3525. return c
  3526. }
  3527. // SupportsTeamDrives sets the optional parameter "supportsTeamDrives":
  3528. // Whether the requesting application supports Team Drives.
  3529. func (c *FilesCopyCall) SupportsTeamDrives(supportsTeamDrives bool) *FilesCopyCall {
  3530. c.urlParams_.Set("supportsTeamDrives", fmt.Sprint(supportsTeamDrives))
  3531. return c
  3532. }
  3533. // Fields allows partial responses to be retrieved. See
  3534. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3535. // for more information.
  3536. func (c *FilesCopyCall) Fields(s ...googleapi.Field) *FilesCopyCall {
  3537. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3538. return c
  3539. }
  3540. // Context sets the context to be used in this call's Do method. Any
  3541. // pending HTTP request will be aborted if the provided context is
  3542. // canceled.
  3543. func (c *FilesCopyCall) Context(ctx context.Context) *FilesCopyCall {
  3544. c.ctx_ = ctx
  3545. return c
  3546. }
  3547. // Header returns an http.Header that can be modified by the caller to
  3548. // add HTTP headers to the request.
  3549. func (c *FilesCopyCall) Header() http.Header {
  3550. if c.header_ == nil {
  3551. c.header_ = make(http.Header)
  3552. }
  3553. return c.header_
  3554. }
  3555. func (c *FilesCopyCall) doRequest(alt string) (*http.Response, error) {
  3556. reqHeaders := make(http.Header)
  3557. for k, v := range c.header_ {
  3558. reqHeaders[k] = v
  3559. }
  3560. reqHeaders.Set("User-Agent", c.s.userAgent())
  3561. var body io.Reader = nil
  3562. body, err := googleapi.WithoutDataWrapper.JSONReader(c.file)
  3563. if err != nil {
  3564. return nil, err
  3565. }
  3566. reqHeaders.Set("Content-Type", "application/json")
  3567. c.urlParams_.Set("alt", alt)
  3568. c.urlParams_.Set("prettyPrint", "false")
  3569. urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/copy")
  3570. urls += "?" + c.urlParams_.Encode()
  3571. req, err := http.NewRequest("POST", urls, body)
  3572. if err != nil {
  3573. return nil, err
  3574. }
  3575. req.Header = reqHeaders
  3576. googleapi.Expand(req.URL, map[string]string{
  3577. "fileId": c.fileId,
  3578. })
  3579. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3580. }
  3581. // Do executes the "drive.files.copy" call.
  3582. // Exactly one of *File or error will be non-nil. Any non-2xx status
  3583. // code is an error. Response headers are in either
  3584. // *File.ServerResponse.Header or (if a response was returned at all) in
  3585. // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  3586. // whether the returned error was because http.StatusNotModified was
  3587. // returned.
  3588. func (c *FilesCopyCall) Do(opts ...googleapi.CallOption) (*File, error) {
  3589. gensupport.SetOptions(c.urlParams_, opts...)
  3590. res, err := c.doRequest("json")
  3591. if res != nil && res.StatusCode == http.StatusNotModified {
  3592. if res.Body != nil {
  3593. res.Body.Close()
  3594. }
  3595. return nil, &googleapi.Error{
  3596. Code: res.StatusCode,
  3597. Header: res.Header,
  3598. }
  3599. }
  3600. if err != nil {
  3601. return nil, err
  3602. }
  3603. defer googleapi.CloseBody(res)
  3604. if err := googleapi.CheckResponse(res); err != nil {
  3605. return nil, err
  3606. }
  3607. ret := &File{
  3608. ServerResponse: googleapi.ServerResponse{
  3609. Header: res.Header,
  3610. HTTPStatusCode: res.StatusCode,
  3611. },
  3612. }
  3613. target := &ret
  3614. if err := gensupport.DecodeResponse(target, res); err != nil {
  3615. return nil, err
  3616. }
  3617. return ret, nil
  3618. // {
  3619. // "description": "Creates a copy of a file and applies any requested updates with patch semantics.",
  3620. // "httpMethod": "POST",
  3621. // "id": "drive.files.copy",
  3622. // "parameterOrder": [
  3623. // "fileId"
  3624. // ],
  3625. // "parameters": {
  3626. // "fileId": {
  3627. // "description": "The ID of the file.",
  3628. // "location": "path",
  3629. // "required": true,
  3630. // "type": "string"
  3631. // },
  3632. // "ignoreDefaultVisibility": {
  3633. // "default": "false",
  3634. // "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.",
  3635. // "location": "query",
  3636. // "type": "boolean"
  3637. // },
  3638. // "keepRevisionForever": {
  3639. // "default": "false",
  3640. // "description": "Whether to set the 'keepForever' field in the new head revision. This is only applicable to files with binary content in Drive.",
  3641. // "location": "query",
  3642. // "type": "boolean"
  3643. // },
  3644. // "ocrLanguage": {
  3645. // "description": "A language hint for OCR processing during image import (ISO 639-1 code).",
  3646. // "location": "query",
  3647. // "type": "string"
  3648. // },
  3649. // "supportsTeamDrives": {
  3650. // "default": "false",
  3651. // "description": "Whether the requesting application supports Team Drives.",
  3652. // "location": "query",
  3653. // "type": "boolean"
  3654. // }
  3655. // },
  3656. // "path": "files/{fileId}/copy",
  3657. // "request": {
  3658. // "$ref": "File"
  3659. // },
  3660. // "response": {
  3661. // "$ref": "File"
  3662. // },
  3663. // "scopes": [
  3664. // "https://www.googleapis.com/auth/drive",
  3665. // "https://www.googleapis.com/auth/drive.appdata",
  3666. // "https://www.googleapis.com/auth/drive.file",
  3667. // "https://www.googleapis.com/auth/drive.photos.readonly"
  3668. // ]
  3669. // }
  3670. }
  3671. // method id "drive.files.create":
  3672. type FilesCreateCall struct {
  3673. s *Service
  3674. file *File
  3675. urlParams_ gensupport.URLParams
  3676. mediaInfo_ *gensupport.MediaInfo
  3677. ctx_ context.Context
  3678. header_ http.Header
  3679. }
  3680. // Create: Creates a new file.
  3681. func (r *FilesService) Create(file *File) *FilesCreateCall {
  3682. c := &FilesCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3683. c.file = file
  3684. return c
  3685. }
  3686. // IgnoreDefaultVisibility sets the optional parameter
  3687. // "ignoreDefaultVisibility": Whether to ignore the domain's default
  3688. // visibility settings for the created file. Domain administrators can
  3689. // choose to make all uploaded files visible to the domain by default;
  3690. // this parameter bypasses that behavior for the request. Permissions
  3691. // are still inherited from parent folders.
  3692. func (c *FilesCreateCall) IgnoreDefaultVisibility(ignoreDefaultVisibility bool) *FilesCreateCall {
  3693. c.urlParams_.Set("ignoreDefaultVisibility", fmt.Sprint(ignoreDefaultVisibility))
  3694. return c
  3695. }
  3696. // KeepRevisionForever sets the optional parameter
  3697. // "keepRevisionForever": Whether to set the 'keepForever' field in the
  3698. // new head revision. This is only applicable to files with binary
  3699. // content in Drive.
  3700. func (c *FilesCreateCall) KeepRevisionForever(keepRevisionForever bool) *FilesCreateCall {
  3701. c.urlParams_.Set("keepRevisionForever", fmt.Sprint(keepRevisionForever))
  3702. return c
  3703. }
  3704. // OcrLanguage sets the optional parameter "ocrLanguage": A language
  3705. // hint for OCR processing during image import (ISO 639-1 code).
  3706. func (c *FilesCreateCall) OcrLanguage(ocrLanguage string) *FilesCreateCall {
  3707. c.urlParams_.Set("ocrLanguage", ocrLanguage)
  3708. return c
  3709. }
  3710. // SupportsTeamDrives sets the optional parameter "supportsTeamDrives":
  3711. // Whether the requesting application supports Team Drives.
  3712. func (c *FilesCreateCall) SupportsTeamDrives(supportsTeamDrives bool) *FilesCreateCall {
  3713. c.urlParams_.Set("supportsTeamDrives", fmt.Sprint(supportsTeamDrives))
  3714. return c
  3715. }
  3716. // UseContentAsIndexableText sets the optional parameter
  3717. // "useContentAsIndexableText": Whether to use the uploaded content as
  3718. // indexable text.
  3719. func (c *FilesCreateCall) UseContentAsIndexableText(useContentAsIndexableText bool) *FilesCreateCall {
  3720. c.urlParams_.Set("useContentAsIndexableText", fmt.Sprint(useContentAsIndexableText))
  3721. return c
  3722. }
  3723. // Media specifies the media to upload in one or more chunks. The chunk
  3724. // size may be controlled by supplying a MediaOption generated by
  3725. // googleapi.ChunkSize. The chunk size defaults to
  3726. // googleapi.DefaultUploadChunkSize.The Content-Type header used in the
  3727. // upload request will be determined by sniffing the contents of r,
  3728. // unless a MediaOption generated by googleapi.ContentType is
  3729. // supplied.
  3730. // At most one of Media and ResumableMedia may be set.
  3731. func (c *FilesCreateCall) Media(r io.Reader, options ...googleapi.MediaOption) *FilesCreateCall {
  3732. c.mediaInfo_ = gensupport.NewInfoFromMedia(r, options)
  3733. return c
  3734. }
  3735. // ResumableMedia specifies the media to upload in chunks and can be
  3736. // canceled with ctx.
  3737. //
  3738. // Deprecated: use Media instead.
  3739. //
  3740. // At most one of Media and ResumableMedia may be set. mediaType
  3741. // identifies the MIME media type of the upload, such as "image/png". If
  3742. // mediaType is "", it will be auto-detected. The provided ctx will
  3743. // supersede any context previously provided to the Context method.
  3744. func (c *FilesCreateCall) ResumableMedia(ctx context.Context, r io.ReaderAt, size int64, mediaType string) *FilesCreateCall {
  3745. c.ctx_ = ctx
  3746. c.mediaInfo_ = gensupport.NewInfoFromResumableMedia(r, size, mediaType)
  3747. return c
  3748. }
  3749. // ProgressUpdater provides a callback function that will be called
  3750. // after every chunk. It should be a low-latency function in order to
  3751. // not slow down the upload operation. This should only be called when
  3752. // using ResumableMedia (as opposed to Media).
  3753. func (c *FilesCreateCall) ProgressUpdater(pu googleapi.ProgressUpdater) *FilesCreateCall {
  3754. c.mediaInfo_.SetProgressUpdater(pu)
  3755. return c
  3756. }
  3757. // Fields allows partial responses to be retrieved. See
  3758. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3759. // for more information.
  3760. func (c *FilesCreateCall) Fields(s ...googleapi.Field) *FilesCreateCall {
  3761. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3762. return c
  3763. }
  3764. // Context sets the context to be used in this call's Do method. Any
  3765. // pending HTTP request will be aborted if the provided context is
  3766. // canceled.
  3767. // This context will supersede any context previously provided to the
  3768. // ResumableMedia method.
  3769. func (c *FilesCreateCall) Context(ctx context.Context) *FilesCreateCall {
  3770. c.ctx_ = ctx
  3771. return c
  3772. }
  3773. // Header returns an http.Header that can be modified by the caller to
  3774. // add HTTP headers to the request.
  3775. func (c *FilesCreateCall) Header() http.Header {
  3776. if c.header_ == nil {
  3777. c.header_ = make(http.Header)
  3778. }
  3779. return c.header_
  3780. }
  3781. func (c *FilesCreateCall) doRequest(alt string) (*http.Response, error) {
  3782. reqHeaders := make(http.Header)
  3783. for k, v := range c.header_ {
  3784. reqHeaders[k] = v
  3785. }
  3786. reqHeaders.Set("User-Agent", c.s.userAgent())
  3787. var body io.Reader = nil
  3788. body, err := googleapi.WithoutDataWrapper.JSONReader(c.file)
  3789. if err != nil {
  3790. return nil, err
  3791. }
  3792. reqHeaders.Set("Content-Type", "application/json")
  3793. c.urlParams_.Set("alt", alt)
  3794. c.urlParams_.Set("prettyPrint", "false")
  3795. urls := googleapi.ResolveRelative(c.s.BasePath, "files")
  3796. if c.mediaInfo_ != nil {
  3797. urls = strings.Replace(urls, "https://www.googleapis.com/", "https://www.googleapis.com/upload/", 1)
  3798. c.urlParams_.Set("uploadType", c.mediaInfo_.UploadType())
  3799. }
  3800. if body == nil {
  3801. body = new(bytes.Buffer)
  3802. reqHeaders.Set("Content-Type", "application/json")
  3803. }
  3804. body, getBody, cleanup := c.mediaInfo_.UploadRequest(reqHeaders, body)
  3805. defer cleanup()
  3806. urls += "?" + c.urlParams_.Encode()
  3807. req, err := http.NewRequest("POST", urls, body)
  3808. if err != nil {
  3809. return nil, err
  3810. }
  3811. req.Header = reqHeaders
  3812. req.GetBody = getBody
  3813. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3814. }
  3815. // Do executes the "drive.files.create" call.
  3816. // Exactly one of *File or error will be non-nil. Any non-2xx status
  3817. // code is an error. Response headers are in either
  3818. // *File.ServerResponse.Header or (if a response was returned at all) in
  3819. // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  3820. // whether the returned error was because http.StatusNotModified was
  3821. // returned.
  3822. func (c *FilesCreateCall) Do(opts ...googleapi.CallOption) (*File, error) {
  3823. gensupport.SetOptions(c.urlParams_, opts...)
  3824. res, err := c.doRequest("json")
  3825. if res != nil && res.StatusCode == http.StatusNotModified {
  3826. if res.Body != nil {
  3827. res.Body.Close()
  3828. }
  3829. return nil, &googleapi.Error{
  3830. Code: res.StatusCode,
  3831. Header: res.Header,
  3832. }
  3833. }
  3834. if err != nil {
  3835. return nil, err
  3836. }
  3837. defer googleapi.CloseBody(res)
  3838. if err := googleapi.CheckResponse(res); err != nil {
  3839. return nil, err
  3840. }
  3841. rx := c.mediaInfo_.ResumableUpload(res.Header.Get("Location"))
  3842. if rx != nil {
  3843. rx.Client = c.s.client
  3844. rx.UserAgent = c.s.userAgent()
  3845. ctx := c.ctx_
  3846. if ctx == nil {
  3847. ctx = context.TODO()
  3848. }
  3849. res, err = rx.Upload(ctx)
  3850. if err != nil {
  3851. return nil, err
  3852. }
  3853. defer res.Body.Close()
  3854. if err := googleapi.CheckResponse(res); err != nil {
  3855. return nil, err
  3856. }
  3857. }
  3858. ret := &File{
  3859. ServerResponse: googleapi.ServerResponse{
  3860. Header: res.Header,
  3861. HTTPStatusCode: res.StatusCode,
  3862. },
  3863. }
  3864. target := &ret
  3865. if err := gensupport.DecodeResponse(target, res); err != nil {
  3866. return nil, err
  3867. }
  3868. return ret, nil
  3869. // {
  3870. // "description": "Creates a new file.",
  3871. // "httpMethod": "POST",
  3872. // "id": "drive.files.create",
  3873. // "mediaUpload": {
  3874. // "accept": [
  3875. // "*/*"
  3876. // ],
  3877. // "maxSize": "5120GB",
  3878. // "protocols": {
  3879. // "resumable": {
  3880. // "multipart": true,
  3881. // "path": "/resumable/upload/drive/v3/files"
  3882. // },
  3883. // "simple": {
  3884. // "multipart": true,
  3885. // "path": "/upload/drive/v3/files"
  3886. // }
  3887. // }
  3888. // },
  3889. // "parameters": {
  3890. // "ignoreDefaultVisibility": {
  3891. // "default": "false",
  3892. // "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.",
  3893. // "location": "query",
  3894. // "type": "boolean"
  3895. // },
  3896. // "keepRevisionForever": {
  3897. // "default": "false",
  3898. // "description": "Whether to set the 'keepForever' field in the new head revision. This is only applicable to files with binary content in Drive.",
  3899. // "location": "query",
  3900. // "type": "boolean"
  3901. // },
  3902. // "ocrLanguage": {
  3903. // "description": "A language hint for OCR processing during image import (ISO 639-1 code).",
  3904. // "location": "query",
  3905. // "type": "string"
  3906. // },
  3907. // "supportsTeamDrives": {
  3908. // "default": "false",
  3909. // "description": "Whether the requesting application supports Team Drives.",
  3910. // "location": "query",
  3911. // "type": "boolean"
  3912. // },
  3913. // "useContentAsIndexableText": {
  3914. // "default": "false",
  3915. // "description": "Whether to use the uploaded content as indexable text.",
  3916. // "location": "query",
  3917. // "type": "boolean"
  3918. // }
  3919. // },
  3920. // "path": "files",
  3921. // "request": {
  3922. // "$ref": "File"
  3923. // },
  3924. // "response": {
  3925. // "$ref": "File"
  3926. // },
  3927. // "scopes": [
  3928. // "https://www.googleapis.com/auth/drive",
  3929. // "https://www.googleapis.com/auth/drive.appdata",
  3930. // "https://www.googleapis.com/auth/drive.file"
  3931. // ],
  3932. // "supportsMediaUpload": true,
  3933. // "supportsSubscription": true
  3934. // }
  3935. }
  3936. // method id "drive.files.delete":
  3937. type FilesDeleteCall struct {
  3938. s *Service
  3939. fileId string
  3940. urlParams_ gensupport.URLParams
  3941. ctx_ context.Context
  3942. header_ http.Header
  3943. }
  3944. // Delete: Permanently deletes a file owned by the user without moving
  3945. // it to the trash. If the file belongs to a Team Drive the user must be
  3946. // an organizer on the parent. If the target is a folder, all
  3947. // descendants owned by the user are also deleted.
  3948. func (r *FilesService) Delete(fileId string) *FilesDeleteCall {
  3949. c := &FilesDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3950. c.fileId = fileId
  3951. return c
  3952. }
  3953. // SupportsTeamDrives sets the optional parameter "supportsTeamDrives":
  3954. // Whether the requesting application supports Team Drives.
  3955. func (c *FilesDeleteCall) SupportsTeamDrives(supportsTeamDrives bool) *FilesDeleteCall {
  3956. c.urlParams_.Set("supportsTeamDrives", fmt.Sprint(supportsTeamDrives))
  3957. return c
  3958. }
  3959. // Fields allows partial responses to be retrieved. See
  3960. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3961. // for more information.
  3962. func (c *FilesDeleteCall) Fields(s ...googleapi.Field) *FilesDeleteCall {
  3963. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3964. return c
  3965. }
  3966. // Context sets the context to be used in this call's Do method. Any
  3967. // pending HTTP request will be aborted if the provided context is
  3968. // canceled.
  3969. func (c *FilesDeleteCall) Context(ctx context.Context) *FilesDeleteCall {
  3970. c.ctx_ = ctx
  3971. return c
  3972. }
  3973. // Header returns an http.Header that can be modified by the caller to
  3974. // add HTTP headers to the request.
  3975. func (c *FilesDeleteCall) Header() http.Header {
  3976. if c.header_ == nil {
  3977. c.header_ = make(http.Header)
  3978. }
  3979. return c.header_
  3980. }
  3981. func (c *FilesDeleteCall) doRequest(alt string) (*http.Response, error) {
  3982. reqHeaders := make(http.Header)
  3983. for k, v := range c.header_ {
  3984. reqHeaders[k] = v
  3985. }
  3986. reqHeaders.Set("User-Agent", c.s.userAgent())
  3987. var body io.Reader = nil
  3988. c.urlParams_.Set("alt", alt)
  3989. c.urlParams_.Set("prettyPrint", "false")
  3990. urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}")
  3991. urls += "?" + c.urlParams_.Encode()
  3992. req, err := http.NewRequest("DELETE", urls, body)
  3993. if err != nil {
  3994. return nil, err
  3995. }
  3996. req.Header = reqHeaders
  3997. googleapi.Expand(req.URL, map[string]string{
  3998. "fileId": c.fileId,
  3999. })
  4000. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4001. }
  4002. // Do executes the "drive.files.delete" call.
  4003. func (c *FilesDeleteCall) Do(opts ...googleapi.CallOption) error {
  4004. gensupport.SetOptions(c.urlParams_, opts...)
  4005. res, err := c.doRequest("json")
  4006. if err != nil {
  4007. return err
  4008. }
  4009. defer googleapi.CloseBody(res)
  4010. if err := googleapi.CheckResponse(res); err != nil {
  4011. return err
  4012. }
  4013. return nil
  4014. // {
  4015. // "description": "Permanently deletes a file owned by the user without moving it to the trash. If the file belongs to a Team Drive the user must be an organizer on the parent. If the target is a folder, all descendants owned by the user are also deleted.",
  4016. // "httpMethod": "DELETE",
  4017. // "id": "drive.files.delete",
  4018. // "parameterOrder": [
  4019. // "fileId"
  4020. // ],
  4021. // "parameters": {
  4022. // "fileId": {
  4023. // "description": "The ID of the file.",
  4024. // "location": "path",
  4025. // "required": true,
  4026. // "type": "string"
  4027. // },
  4028. // "supportsTeamDrives": {
  4029. // "default": "false",
  4030. // "description": "Whether the requesting application supports Team Drives.",
  4031. // "location": "query",
  4032. // "type": "boolean"
  4033. // }
  4034. // },
  4035. // "path": "files/{fileId}",
  4036. // "scopes": [
  4037. // "https://www.googleapis.com/auth/drive",
  4038. // "https://www.googleapis.com/auth/drive.appdata",
  4039. // "https://www.googleapis.com/auth/drive.file"
  4040. // ]
  4041. // }
  4042. }
  4043. // method id "drive.files.emptyTrash":
  4044. type FilesEmptyTrashCall struct {
  4045. s *Service
  4046. urlParams_ gensupport.URLParams
  4047. ctx_ context.Context
  4048. header_ http.Header
  4049. }
  4050. // EmptyTrash: Permanently deletes all of the user's trashed files.
  4051. func (r *FilesService) EmptyTrash() *FilesEmptyTrashCall {
  4052. c := &FilesEmptyTrashCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4053. return c
  4054. }
  4055. // Fields allows partial responses to be retrieved. See
  4056. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4057. // for more information.
  4058. func (c *FilesEmptyTrashCall) Fields(s ...googleapi.Field) *FilesEmptyTrashCall {
  4059. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4060. return c
  4061. }
  4062. // Context sets the context to be used in this call's Do method. Any
  4063. // pending HTTP request will be aborted if the provided context is
  4064. // canceled.
  4065. func (c *FilesEmptyTrashCall) Context(ctx context.Context) *FilesEmptyTrashCall {
  4066. c.ctx_ = ctx
  4067. return c
  4068. }
  4069. // Header returns an http.Header that can be modified by the caller to
  4070. // add HTTP headers to the request.
  4071. func (c *FilesEmptyTrashCall) Header() http.Header {
  4072. if c.header_ == nil {
  4073. c.header_ = make(http.Header)
  4074. }
  4075. return c.header_
  4076. }
  4077. func (c *FilesEmptyTrashCall) doRequest(alt string) (*http.Response, error) {
  4078. reqHeaders := make(http.Header)
  4079. for k, v := range c.header_ {
  4080. reqHeaders[k] = v
  4081. }
  4082. reqHeaders.Set("User-Agent", c.s.userAgent())
  4083. var body io.Reader = nil
  4084. c.urlParams_.Set("alt", alt)
  4085. c.urlParams_.Set("prettyPrint", "false")
  4086. urls := googleapi.ResolveRelative(c.s.BasePath, "files/trash")
  4087. urls += "?" + c.urlParams_.Encode()
  4088. req, err := http.NewRequest("DELETE", urls, body)
  4089. if err != nil {
  4090. return nil, err
  4091. }
  4092. req.Header = reqHeaders
  4093. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4094. }
  4095. // Do executes the "drive.files.emptyTrash" call.
  4096. func (c *FilesEmptyTrashCall) Do(opts ...googleapi.CallOption) error {
  4097. gensupport.SetOptions(c.urlParams_, opts...)
  4098. res, err := c.doRequest("json")
  4099. if err != nil {
  4100. return err
  4101. }
  4102. defer googleapi.CloseBody(res)
  4103. if err := googleapi.CheckResponse(res); err != nil {
  4104. return err
  4105. }
  4106. return nil
  4107. // {
  4108. // "description": "Permanently deletes all of the user's trashed files.",
  4109. // "httpMethod": "DELETE",
  4110. // "id": "drive.files.emptyTrash",
  4111. // "path": "files/trash",
  4112. // "scopes": [
  4113. // "https://www.googleapis.com/auth/drive"
  4114. // ]
  4115. // }
  4116. }
  4117. // method id "drive.files.export":
  4118. type FilesExportCall struct {
  4119. s *Service
  4120. fileId string
  4121. urlParams_ gensupport.URLParams
  4122. ifNoneMatch_ string
  4123. ctx_ context.Context
  4124. header_ http.Header
  4125. }
  4126. // Export: Exports a Google Doc to the requested MIME type and returns
  4127. // the exported content. Please note that the exported content is
  4128. // limited to 10MB.
  4129. func (r *FilesService) Export(fileId string, mimeType string) *FilesExportCall {
  4130. c := &FilesExportCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4131. c.fileId = fileId
  4132. c.urlParams_.Set("mimeType", mimeType)
  4133. return c
  4134. }
  4135. // Fields allows partial responses to be retrieved. See
  4136. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4137. // for more information.
  4138. func (c *FilesExportCall) Fields(s ...googleapi.Field) *FilesExportCall {
  4139. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4140. return c
  4141. }
  4142. // IfNoneMatch sets the optional parameter which makes the operation
  4143. // fail if the object's ETag matches the given value. This is useful for
  4144. // getting updates only after the object has changed since the last
  4145. // request. Use googleapi.IsNotModified to check whether the response
  4146. // error from Do is the result of In-None-Match.
  4147. func (c *FilesExportCall) IfNoneMatch(entityTag string) *FilesExportCall {
  4148. c.ifNoneMatch_ = entityTag
  4149. return c
  4150. }
  4151. // Context sets the context to be used in this call's Do and Download
  4152. // methods. Any pending HTTP request will be aborted if the provided
  4153. // context is canceled.
  4154. func (c *FilesExportCall) Context(ctx context.Context) *FilesExportCall {
  4155. c.ctx_ = ctx
  4156. return c
  4157. }
  4158. // Header returns an http.Header that can be modified by the caller to
  4159. // add HTTP headers to the request.
  4160. func (c *FilesExportCall) Header() http.Header {
  4161. if c.header_ == nil {
  4162. c.header_ = make(http.Header)
  4163. }
  4164. return c.header_
  4165. }
  4166. func (c *FilesExportCall) doRequest(alt string) (*http.Response, error) {
  4167. reqHeaders := make(http.Header)
  4168. for k, v := range c.header_ {
  4169. reqHeaders[k] = v
  4170. }
  4171. reqHeaders.Set("User-Agent", c.s.userAgent())
  4172. if c.ifNoneMatch_ != "" {
  4173. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  4174. }
  4175. var body io.Reader = nil
  4176. c.urlParams_.Set("alt", alt)
  4177. c.urlParams_.Set("prettyPrint", "false")
  4178. urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/export")
  4179. urls += "?" + c.urlParams_.Encode()
  4180. req, err := http.NewRequest("GET", urls, body)
  4181. if err != nil {
  4182. return nil, err
  4183. }
  4184. req.Header = reqHeaders
  4185. googleapi.Expand(req.URL, map[string]string{
  4186. "fileId": c.fileId,
  4187. })
  4188. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4189. }
  4190. // Download fetches the API endpoint's "media" value, instead of the normal
  4191. // API response value. If the returned error is nil, the Response is guaranteed to
  4192. // have a 2xx status code. Callers must close the Response.Body as usual.
  4193. func (c *FilesExportCall) Download(opts ...googleapi.CallOption) (*http.Response, error) {
  4194. gensupport.SetOptions(c.urlParams_, opts...)
  4195. res, err := c.doRequest("media")
  4196. if err != nil {
  4197. return nil, err
  4198. }
  4199. if err := googleapi.CheckMediaResponse(res); err != nil {
  4200. res.Body.Close()
  4201. return nil, err
  4202. }
  4203. return res, nil
  4204. }
  4205. // Do executes the "drive.files.export" call.
  4206. func (c *FilesExportCall) Do(opts ...googleapi.CallOption) error {
  4207. gensupport.SetOptions(c.urlParams_, opts...)
  4208. res, err := c.doRequest("json")
  4209. if err != nil {
  4210. return err
  4211. }
  4212. defer googleapi.CloseBody(res)
  4213. if err := googleapi.CheckResponse(res); err != nil {
  4214. return err
  4215. }
  4216. return nil
  4217. // {
  4218. // "description": "Exports a Google Doc to the requested MIME type and returns the exported content. Please note that the exported content is limited to 10MB.",
  4219. // "httpMethod": "GET",
  4220. // "id": "drive.files.export",
  4221. // "parameterOrder": [
  4222. // "fileId",
  4223. // "mimeType"
  4224. // ],
  4225. // "parameters": {
  4226. // "fileId": {
  4227. // "description": "The ID of the file.",
  4228. // "location": "path",
  4229. // "required": true,
  4230. // "type": "string"
  4231. // },
  4232. // "mimeType": {
  4233. // "description": "The MIME type of the format requested for this export.",
  4234. // "location": "query",
  4235. // "required": true,
  4236. // "type": "string"
  4237. // }
  4238. // },
  4239. // "path": "files/{fileId}/export",
  4240. // "scopes": [
  4241. // "https://www.googleapis.com/auth/drive",
  4242. // "https://www.googleapis.com/auth/drive.file",
  4243. // "https://www.googleapis.com/auth/drive.readonly"
  4244. // ],
  4245. // "supportsMediaDownload": true
  4246. // }
  4247. }
  4248. // method id "drive.files.generateIds":
  4249. type FilesGenerateIdsCall struct {
  4250. s *Service
  4251. urlParams_ gensupport.URLParams
  4252. ifNoneMatch_ string
  4253. ctx_ context.Context
  4254. header_ http.Header
  4255. }
  4256. // GenerateIds: Generates a set of file IDs which can be provided in
  4257. // create requests.
  4258. func (r *FilesService) GenerateIds() *FilesGenerateIdsCall {
  4259. c := &FilesGenerateIdsCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4260. return c
  4261. }
  4262. // Count sets the optional parameter "count": The number of IDs to
  4263. // return.
  4264. func (c *FilesGenerateIdsCall) Count(count int64) *FilesGenerateIdsCall {
  4265. c.urlParams_.Set("count", fmt.Sprint(count))
  4266. return c
  4267. }
  4268. // Space sets the optional parameter "space": The space in which the IDs
  4269. // can be used to create new files. Supported values are 'drive' and
  4270. // 'appDataFolder'.
  4271. func (c *FilesGenerateIdsCall) Space(space string) *FilesGenerateIdsCall {
  4272. c.urlParams_.Set("space", space)
  4273. return c
  4274. }
  4275. // Fields allows partial responses to be retrieved. See
  4276. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4277. // for more information.
  4278. func (c *FilesGenerateIdsCall) Fields(s ...googleapi.Field) *FilesGenerateIdsCall {
  4279. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4280. return c
  4281. }
  4282. // IfNoneMatch sets the optional parameter which makes the operation
  4283. // fail if the object's ETag matches the given value. This is useful for
  4284. // getting updates only after the object has changed since the last
  4285. // request. Use googleapi.IsNotModified to check whether the response
  4286. // error from Do is the result of In-None-Match.
  4287. func (c *FilesGenerateIdsCall) IfNoneMatch(entityTag string) *FilesGenerateIdsCall {
  4288. c.ifNoneMatch_ = entityTag
  4289. return c
  4290. }
  4291. // Context sets the context to be used in this call's Do method. Any
  4292. // pending HTTP request will be aborted if the provided context is
  4293. // canceled.
  4294. func (c *FilesGenerateIdsCall) Context(ctx context.Context) *FilesGenerateIdsCall {
  4295. c.ctx_ = ctx
  4296. return c
  4297. }
  4298. // Header returns an http.Header that can be modified by the caller to
  4299. // add HTTP headers to the request.
  4300. func (c *FilesGenerateIdsCall) Header() http.Header {
  4301. if c.header_ == nil {
  4302. c.header_ = make(http.Header)
  4303. }
  4304. return c.header_
  4305. }
  4306. func (c *FilesGenerateIdsCall) doRequest(alt string) (*http.Response, error) {
  4307. reqHeaders := make(http.Header)
  4308. for k, v := range c.header_ {
  4309. reqHeaders[k] = v
  4310. }
  4311. reqHeaders.Set("User-Agent", c.s.userAgent())
  4312. if c.ifNoneMatch_ != "" {
  4313. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  4314. }
  4315. var body io.Reader = nil
  4316. c.urlParams_.Set("alt", alt)
  4317. c.urlParams_.Set("prettyPrint", "false")
  4318. urls := googleapi.ResolveRelative(c.s.BasePath, "files/generateIds")
  4319. urls += "?" + c.urlParams_.Encode()
  4320. req, err := http.NewRequest("GET", urls, body)
  4321. if err != nil {
  4322. return nil, err
  4323. }
  4324. req.Header = reqHeaders
  4325. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4326. }
  4327. // Do executes the "drive.files.generateIds" call.
  4328. // Exactly one of *GeneratedIds or error will be non-nil. Any non-2xx
  4329. // status code is an error. Response headers are in either
  4330. // *GeneratedIds.ServerResponse.Header or (if a response was returned at
  4331. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  4332. // to check whether the returned error was because
  4333. // http.StatusNotModified was returned.
  4334. func (c *FilesGenerateIdsCall) Do(opts ...googleapi.CallOption) (*GeneratedIds, error) {
  4335. gensupport.SetOptions(c.urlParams_, opts...)
  4336. res, err := c.doRequest("json")
  4337. if res != nil && res.StatusCode == http.StatusNotModified {
  4338. if res.Body != nil {
  4339. res.Body.Close()
  4340. }
  4341. return nil, &googleapi.Error{
  4342. Code: res.StatusCode,
  4343. Header: res.Header,
  4344. }
  4345. }
  4346. if err != nil {
  4347. return nil, err
  4348. }
  4349. defer googleapi.CloseBody(res)
  4350. if err := googleapi.CheckResponse(res); err != nil {
  4351. return nil, err
  4352. }
  4353. ret := &GeneratedIds{
  4354. ServerResponse: googleapi.ServerResponse{
  4355. Header: res.Header,
  4356. HTTPStatusCode: res.StatusCode,
  4357. },
  4358. }
  4359. target := &ret
  4360. if err := gensupport.DecodeResponse(target, res); err != nil {
  4361. return nil, err
  4362. }
  4363. return ret, nil
  4364. // {
  4365. // "description": "Generates a set of file IDs which can be provided in create requests.",
  4366. // "httpMethod": "GET",
  4367. // "id": "drive.files.generateIds",
  4368. // "parameters": {
  4369. // "count": {
  4370. // "default": "10",
  4371. // "description": "The number of IDs to return.",
  4372. // "format": "int32",
  4373. // "location": "query",
  4374. // "maximum": "1000",
  4375. // "minimum": "1",
  4376. // "type": "integer"
  4377. // },
  4378. // "space": {
  4379. // "default": "drive",
  4380. // "description": "The space in which the IDs can be used to create new files. Supported values are 'drive' and 'appDataFolder'.",
  4381. // "location": "query",
  4382. // "type": "string"
  4383. // }
  4384. // },
  4385. // "path": "files/generateIds",
  4386. // "response": {
  4387. // "$ref": "GeneratedIds"
  4388. // },
  4389. // "scopes": [
  4390. // "https://www.googleapis.com/auth/drive",
  4391. // "https://www.googleapis.com/auth/drive.appdata",
  4392. // "https://www.googleapis.com/auth/drive.file"
  4393. // ]
  4394. // }
  4395. }
  4396. // method id "drive.files.get":
  4397. type FilesGetCall struct {
  4398. s *Service
  4399. fileId string
  4400. urlParams_ gensupport.URLParams
  4401. ifNoneMatch_ string
  4402. ctx_ context.Context
  4403. header_ http.Header
  4404. }
  4405. // Get: Gets a file's metadata or content by ID.
  4406. func (r *FilesService) Get(fileId string) *FilesGetCall {
  4407. c := &FilesGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4408. c.fileId = fileId
  4409. return c
  4410. }
  4411. // AcknowledgeAbuse sets the optional parameter "acknowledgeAbuse":
  4412. // Whether the user is acknowledging the risk of downloading known
  4413. // malware or other abusive files. This is only applicable when
  4414. // alt=media.
  4415. func (c *FilesGetCall) AcknowledgeAbuse(acknowledgeAbuse bool) *FilesGetCall {
  4416. c.urlParams_.Set("acknowledgeAbuse", fmt.Sprint(acknowledgeAbuse))
  4417. return c
  4418. }
  4419. // SupportsTeamDrives sets the optional parameter "supportsTeamDrives":
  4420. // Whether the requesting application supports Team Drives.
  4421. func (c *FilesGetCall) SupportsTeamDrives(supportsTeamDrives bool) *FilesGetCall {
  4422. c.urlParams_.Set("supportsTeamDrives", fmt.Sprint(supportsTeamDrives))
  4423. return c
  4424. }
  4425. // Fields allows partial responses to be retrieved. See
  4426. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4427. // for more information.
  4428. func (c *FilesGetCall) Fields(s ...googleapi.Field) *FilesGetCall {
  4429. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4430. return c
  4431. }
  4432. // IfNoneMatch sets the optional parameter which makes the operation
  4433. // fail if the object's ETag matches the given value. This is useful for
  4434. // getting updates only after the object has changed since the last
  4435. // request. Use googleapi.IsNotModified to check whether the response
  4436. // error from Do is the result of In-None-Match.
  4437. func (c *FilesGetCall) IfNoneMatch(entityTag string) *FilesGetCall {
  4438. c.ifNoneMatch_ = entityTag
  4439. return c
  4440. }
  4441. // Context sets the context to be used in this call's Do and Download
  4442. // methods. Any pending HTTP request will be aborted if the provided
  4443. // context is canceled.
  4444. func (c *FilesGetCall) Context(ctx context.Context) *FilesGetCall {
  4445. c.ctx_ = ctx
  4446. return c
  4447. }
  4448. // Header returns an http.Header that can be modified by the caller to
  4449. // add HTTP headers to the request.
  4450. func (c *FilesGetCall) Header() http.Header {
  4451. if c.header_ == nil {
  4452. c.header_ = make(http.Header)
  4453. }
  4454. return c.header_
  4455. }
  4456. func (c *FilesGetCall) doRequest(alt string) (*http.Response, error) {
  4457. reqHeaders := make(http.Header)
  4458. for k, v := range c.header_ {
  4459. reqHeaders[k] = v
  4460. }
  4461. reqHeaders.Set("User-Agent", c.s.userAgent())
  4462. if c.ifNoneMatch_ != "" {
  4463. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  4464. }
  4465. var body io.Reader = nil
  4466. c.urlParams_.Set("alt", alt)
  4467. c.urlParams_.Set("prettyPrint", "false")
  4468. urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}")
  4469. urls += "?" + c.urlParams_.Encode()
  4470. req, err := http.NewRequest("GET", urls, body)
  4471. if err != nil {
  4472. return nil, err
  4473. }
  4474. req.Header = reqHeaders
  4475. googleapi.Expand(req.URL, map[string]string{
  4476. "fileId": c.fileId,
  4477. })
  4478. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4479. }
  4480. // Download fetches the API endpoint's "media" value, instead of the normal
  4481. // API response value. If the returned error is nil, the Response is guaranteed to
  4482. // have a 2xx status code. Callers must close the Response.Body as usual.
  4483. func (c *FilesGetCall) Download(opts ...googleapi.CallOption) (*http.Response, error) {
  4484. gensupport.SetOptions(c.urlParams_, opts...)
  4485. res, err := c.doRequest("media")
  4486. if err != nil {
  4487. return nil, err
  4488. }
  4489. if err := googleapi.CheckMediaResponse(res); err != nil {
  4490. res.Body.Close()
  4491. return nil, err
  4492. }
  4493. return res, nil
  4494. }
  4495. // Do executes the "drive.files.get" call.
  4496. // Exactly one of *File or error will be non-nil. Any non-2xx status
  4497. // code is an error. Response headers are in either
  4498. // *File.ServerResponse.Header or (if a response was returned at all) in
  4499. // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  4500. // whether the returned error was because http.StatusNotModified was
  4501. // returned.
  4502. func (c *FilesGetCall) Do(opts ...googleapi.CallOption) (*File, error) {
  4503. gensupport.SetOptions(c.urlParams_, opts...)
  4504. res, err := c.doRequest("json")
  4505. if res != nil && res.StatusCode == http.StatusNotModified {
  4506. if res.Body != nil {
  4507. res.Body.Close()
  4508. }
  4509. return nil, &googleapi.Error{
  4510. Code: res.StatusCode,
  4511. Header: res.Header,
  4512. }
  4513. }
  4514. if err != nil {
  4515. return nil, err
  4516. }
  4517. defer googleapi.CloseBody(res)
  4518. if err := googleapi.CheckResponse(res); err != nil {
  4519. return nil, err
  4520. }
  4521. ret := &File{
  4522. ServerResponse: googleapi.ServerResponse{
  4523. Header: res.Header,
  4524. HTTPStatusCode: res.StatusCode,
  4525. },
  4526. }
  4527. target := &ret
  4528. if err := gensupport.DecodeResponse(target, res); err != nil {
  4529. return nil, err
  4530. }
  4531. return ret, nil
  4532. // {
  4533. // "description": "Gets a file's metadata or content by ID.",
  4534. // "httpMethod": "GET",
  4535. // "id": "drive.files.get",
  4536. // "parameterOrder": [
  4537. // "fileId"
  4538. // ],
  4539. // "parameters": {
  4540. // "acknowledgeAbuse": {
  4541. // "default": "false",
  4542. // "description": "Whether the user is acknowledging the risk of downloading known malware or other abusive files. This is only applicable when alt=media.",
  4543. // "location": "query",
  4544. // "type": "boolean"
  4545. // },
  4546. // "fileId": {
  4547. // "description": "The ID of the file.",
  4548. // "location": "path",
  4549. // "required": true,
  4550. // "type": "string"
  4551. // },
  4552. // "supportsTeamDrives": {
  4553. // "default": "false",
  4554. // "description": "Whether the requesting application supports Team Drives.",
  4555. // "location": "query",
  4556. // "type": "boolean"
  4557. // }
  4558. // },
  4559. // "path": "files/{fileId}",
  4560. // "response": {
  4561. // "$ref": "File"
  4562. // },
  4563. // "scopes": [
  4564. // "https://www.googleapis.com/auth/drive",
  4565. // "https://www.googleapis.com/auth/drive.appdata",
  4566. // "https://www.googleapis.com/auth/drive.file",
  4567. // "https://www.googleapis.com/auth/drive.metadata",
  4568. // "https://www.googleapis.com/auth/drive.metadata.readonly",
  4569. // "https://www.googleapis.com/auth/drive.photos.readonly",
  4570. // "https://www.googleapis.com/auth/drive.readonly"
  4571. // ],
  4572. // "supportsMediaDownload": true,
  4573. // "supportsSubscription": true,
  4574. // "useMediaDownloadService": true
  4575. // }
  4576. }
  4577. // method id "drive.files.list":
  4578. type FilesListCall struct {
  4579. s *Service
  4580. urlParams_ gensupport.URLParams
  4581. ifNoneMatch_ string
  4582. ctx_ context.Context
  4583. header_ http.Header
  4584. }
  4585. // List: Lists or searches files.
  4586. func (r *FilesService) List() *FilesListCall {
  4587. c := &FilesListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4588. return c
  4589. }
  4590. // Corpora sets the optional parameter "corpora": Comma-separated list
  4591. // of bodies of items (files/documents) to which the query applies.
  4592. // Supported bodies are 'user', 'domain', 'teamDrive' and
  4593. // 'allTeamDrives'. 'allTeamDrives' must be combined with 'user'; all
  4594. // other values must be used in isolation. Prefer 'user' or 'teamDrive'
  4595. // to 'allTeamDrives' for efficiency.
  4596. func (c *FilesListCall) Corpora(corpora string) *FilesListCall {
  4597. c.urlParams_.Set("corpora", corpora)
  4598. return c
  4599. }
  4600. // Corpus sets the optional parameter "corpus": The source of files to
  4601. // list. Deprecated: use 'corpora' instead.
  4602. //
  4603. // Possible values:
  4604. // "domain" - Files shared to the user's domain.
  4605. // "user" - Files owned by or shared to the user.
  4606. func (c *FilesListCall) Corpus(corpus string) *FilesListCall {
  4607. c.urlParams_.Set("corpus", corpus)
  4608. return c
  4609. }
  4610. // IncludeTeamDriveItems sets the optional parameter
  4611. // "includeTeamDriveItems": Whether Team Drive items should be included
  4612. // in results.
  4613. func (c *FilesListCall) IncludeTeamDriveItems(includeTeamDriveItems bool) *FilesListCall {
  4614. c.urlParams_.Set("includeTeamDriveItems", fmt.Sprint(includeTeamDriveItems))
  4615. return c
  4616. }
  4617. // OrderBy sets the optional parameter "orderBy": A comma-separated list
  4618. // of sort keys. Valid keys are 'createdTime', 'folder',
  4619. // 'modifiedByMeTime', 'modifiedTime', 'name', 'name_natural',
  4620. // 'quotaBytesUsed', 'recency', 'sharedWithMeTime', 'starred', and
  4621. // 'viewedByMeTime'. Each key sorts ascending by default, but may be
  4622. // reversed with the 'desc' modifier. Example usage:
  4623. // ?orderBy=folder,modifiedTime desc,name. Please note that there is a
  4624. // current limitation for users with approximately one million files in
  4625. // which the requested sort order is ignored.
  4626. func (c *FilesListCall) OrderBy(orderBy string) *FilesListCall {
  4627. c.urlParams_.Set("orderBy", orderBy)
  4628. return c
  4629. }
  4630. // PageSize sets the optional parameter "pageSize": The maximum number
  4631. // of files to return per page. Partial or empty result pages are
  4632. // possible even before the end of the files list has been reached.
  4633. func (c *FilesListCall) PageSize(pageSize int64) *FilesListCall {
  4634. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  4635. return c
  4636. }
  4637. // PageToken sets the optional parameter "pageToken": The token for
  4638. // continuing a previous list request on the next page. This should be
  4639. // set to the value of 'nextPageToken' from the previous response.
  4640. func (c *FilesListCall) PageToken(pageToken string) *FilesListCall {
  4641. c.urlParams_.Set("pageToken", pageToken)
  4642. return c
  4643. }
  4644. // Q sets the optional parameter "q": A query for filtering the file
  4645. // results. See the "Search for Files" guide for supported syntax.
  4646. func (c *FilesListCall) Q(q string) *FilesListCall {
  4647. c.urlParams_.Set("q", q)
  4648. return c
  4649. }
  4650. // Spaces sets the optional parameter "spaces": A comma-separated list
  4651. // of spaces to query within the corpus. Supported values are 'drive',
  4652. // 'appDataFolder' and 'photos'.
  4653. func (c *FilesListCall) Spaces(spaces string) *FilesListCall {
  4654. c.urlParams_.Set("spaces", spaces)
  4655. return c
  4656. }
  4657. // SupportsTeamDrives sets the optional parameter "supportsTeamDrives":
  4658. // Whether the requesting application supports Team Drives.
  4659. func (c *FilesListCall) SupportsTeamDrives(supportsTeamDrives bool) *FilesListCall {
  4660. c.urlParams_.Set("supportsTeamDrives", fmt.Sprint(supportsTeamDrives))
  4661. return c
  4662. }
  4663. // TeamDriveId sets the optional parameter "teamDriveId": ID of Team
  4664. // Drive to search.
  4665. func (c *FilesListCall) TeamDriveId(teamDriveId string) *FilesListCall {
  4666. c.urlParams_.Set("teamDriveId", teamDriveId)
  4667. return c
  4668. }
  4669. // Fields allows partial responses to be retrieved. See
  4670. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4671. // for more information.
  4672. func (c *FilesListCall) Fields(s ...googleapi.Field) *FilesListCall {
  4673. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4674. return c
  4675. }
  4676. // IfNoneMatch sets the optional parameter which makes the operation
  4677. // fail if the object's ETag matches the given value. This is useful for
  4678. // getting updates only after the object has changed since the last
  4679. // request. Use googleapi.IsNotModified to check whether the response
  4680. // error from Do is the result of In-None-Match.
  4681. func (c *FilesListCall) IfNoneMatch(entityTag string) *FilesListCall {
  4682. c.ifNoneMatch_ = entityTag
  4683. return c
  4684. }
  4685. // Context sets the context to be used in this call's Do method. Any
  4686. // pending HTTP request will be aborted if the provided context is
  4687. // canceled.
  4688. func (c *FilesListCall) Context(ctx context.Context) *FilesListCall {
  4689. c.ctx_ = ctx
  4690. return c
  4691. }
  4692. // Header returns an http.Header that can be modified by the caller to
  4693. // add HTTP headers to the request.
  4694. func (c *FilesListCall) Header() http.Header {
  4695. if c.header_ == nil {
  4696. c.header_ = make(http.Header)
  4697. }
  4698. return c.header_
  4699. }
  4700. func (c *FilesListCall) doRequest(alt string) (*http.Response, error) {
  4701. reqHeaders := make(http.Header)
  4702. for k, v := range c.header_ {
  4703. reqHeaders[k] = v
  4704. }
  4705. reqHeaders.Set("User-Agent", c.s.userAgent())
  4706. if c.ifNoneMatch_ != "" {
  4707. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  4708. }
  4709. var body io.Reader = nil
  4710. c.urlParams_.Set("alt", alt)
  4711. c.urlParams_.Set("prettyPrint", "false")
  4712. urls := googleapi.ResolveRelative(c.s.BasePath, "files")
  4713. urls += "?" + c.urlParams_.Encode()
  4714. req, err := http.NewRequest("GET", urls, body)
  4715. if err != nil {
  4716. return nil, err
  4717. }
  4718. req.Header = reqHeaders
  4719. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4720. }
  4721. // Do executes the "drive.files.list" call.
  4722. // Exactly one of *FileList or error will be non-nil. Any non-2xx status
  4723. // code is an error. Response headers are in either
  4724. // *FileList.ServerResponse.Header or (if a response was returned at
  4725. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  4726. // to check whether the returned error was because
  4727. // http.StatusNotModified was returned.
  4728. func (c *FilesListCall) Do(opts ...googleapi.CallOption) (*FileList, error) {
  4729. gensupport.SetOptions(c.urlParams_, opts...)
  4730. res, err := c.doRequest("json")
  4731. if res != nil && res.StatusCode == http.StatusNotModified {
  4732. if res.Body != nil {
  4733. res.Body.Close()
  4734. }
  4735. return nil, &googleapi.Error{
  4736. Code: res.StatusCode,
  4737. Header: res.Header,
  4738. }
  4739. }
  4740. if err != nil {
  4741. return nil, err
  4742. }
  4743. defer googleapi.CloseBody(res)
  4744. if err := googleapi.CheckResponse(res); err != nil {
  4745. return nil, err
  4746. }
  4747. ret := &FileList{
  4748. ServerResponse: googleapi.ServerResponse{
  4749. Header: res.Header,
  4750. HTTPStatusCode: res.StatusCode,
  4751. },
  4752. }
  4753. target := &ret
  4754. if err := gensupport.DecodeResponse(target, res); err != nil {
  4755. return nil, err
  4756. }
  4757. return ret, nil
  4758. // {
  4759. // "description": "Lists or searches files.",
  4760. // "httpMethod": "GET",
  4761. // "id": "drive.files.list",
  4762. // "parameters": {
  4763. // "corpora": {
  4764. // "description": "Comma-separated list of bodies of items (files/documents) to which the query applies. Supported bodies are 'user', 'domain', 'teamDrive' and 'allTeamDrives'. 'allTeamDrives' must be combined with 'user'; all other values must be used in isolation. Prefer 'user' or 'teamDrive' to 'allTeamDrives' for efficiency.",
  4765. // "location": "query",
  4766. // "type": "string"
  4767. // },
  4768. // "corpus": {
  4769. // "description": "The source of files to list. Deprecated: use 'corpora' instead.",
  4770. // "enum": [
  4771. // "domain",
  4772. // "user"
  4773. // ],
  4774. // "enumDescriptions": [
  4775. // "Files shared to the user's domain.",
  4776. // "Files owned by or shared to the user."
  4777. // ],
  4778. // "location": "query",
  4779. // "type": "string"
  4780. // },
  4781. // "includeTeamDriveItems": {
  4782. // "default": "false",
  4783. // "description": "Whether Team Drive items should be included in results.",
  4784. // "location": "query",
  4785. // "type": "boolean"
  4786. // },
  4787. // "orderBy": {
  4788. // "description": "A comma-separated list of sort keys. Valid keys are 'createdTime', 'folder', 'modifiedByMeTime', 'modifiedTime', 'name', 'name_natural', 'quotaBytesUsed', 'recency', 'sharedWithMeTime', 'starred', and 'viewedByMeTime'. Each key sorts ascending by default, but may be reversed with the 'desc' modifier. Example usage: ?orderBy=folder,modifiedTime desc,name. Please note that there is a current limitation for users with approximately one million files in which the requested sort order is ignored.",
  4789. // "location": "query",
  4790. // "type": "string"
  4791. // },
  4792. // "pageSize": {
  4793. // "default": "100",
  4794. // "description": "The maximum number of files to return per page. Partial or empty result pages are possible even before the end of the files list has been reached.",
  4795. // "format": "int32",
  4796. // "location": "query",
  4797. // "maximum": "1000",
  4798. // "minimum": "1",
  4799. // "type": "integer"
  4800. // },
  4801. // "pageToken": {
  4802. // "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.",
  4803. // "location": "query",
  4804. // "type": "string"
  4805. // },
  4806. // "q": {
  4807. // "description": "A query for filtering the file results. See the \"Search for Files\" guide for supported syntax.",
  4808. // "location": "query",
  4809. // "type": "string"
  4810. // },
  4811. // "spaces": {
  4812. // "default": "drive",
  4813. // "description": "A comma-separated list of spaces to query within the corpus. Supported values are 'drive', 'appDataFolder' and 'photos'.",
  4814. // "location": "query",
  4815. // "type": "string"
  4816. // },
  4817. // "supportsTeamDrives": {
  4818. // "default": "false",
  4819. // "description": "Whether the requesting application supports Team Drives.",
  4820. // "location": "query",
  4821. // "type": "boolean"
  4822. // },
  4823. // "teamDriveId": {
  4824. // "description": "ID of Team Drive to search.",
  4825. // "location": "query",
  4826. // "type": "string"
  4827. // }
  4828. // },
  4829. // "path": "files",
  4830. // "response": {
  4831. // "$ref": "FileList"
  4832. // },
  4833. // "scopes": [
  4834. // "https://www.googleapis.com/auth/drive",
  4835. // "https://www.googleapis.com/auth/drive.appdata",
  4836. // "https://www.googleapis.com/auth/drive.file",
  4837. // "https://www.googleapis.com/auth/drive.metadata",
  4838. // "https://www.googleapis.com/auth/drive.metadata.readonly",
  4839. // "https://www.googleapis.com/auth/drive.photos.readonly",
  4840. // "https://www.googleapis.com/auth/drive.readonly"
  4841. // ]
  4842. // }
  4843. }
  4844. // Pages invokes f for each page of results.
  4845. // A non-nil error returned from f will halt the iteration.
  4846. // The provided context supersedes any context provided to the Context method.
  4847. func (c *FilesListCall) Pages(ctx context.Context, f func(*FileList) error) error {
  4848. c.ctx_ = ctx
  4849. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  4850. for {
  4851. x, err := c.Do()
  4852. if err != nil {
  4853. return err
  4854. }
  4855. if err := f(x); err != nil {
  4856. return err
  4857. }
  4858. if x.NextPageToken == "" {
  4859. return nil
  4860. }
  4861. c.PageToken(x.NextPageToken)
  4862. }
  4863. }
  4864. // method id "drive.files.update":
  4865. type FilesUpdateCall struct {
  4866. s *Service
  4867. fileId string
  4868. file *File
  4869. urlParams_ gensupport.URLParams
  4870. mediaInfo_ *gensupport.MediaInfo
  4871. ctx_ context.Context
  4872. header_ http.Header
  4873. }
  4874. // Update: Updates a file's metadata and/or content with patch
  4875. // semantics.
  4876. func (r *FilesService) Update(fileId string, file *File) *FilesUpdateCall {
  4877. c := &FilesUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4878. c.fileId = fileId
  4879. c.file = file
  4880. return c
  4881. }
  4882. // AddParents sets the optional parameter "addParents": A
  4883. // comma-separated list of parent IDs to add.
  4884. func (c *FilesUpdateCall) AddParents(addParents string) *FilesUpdateCall {
  4885. c.urlParams_.Set("addParents", addParents)
  4886. return c
  4887. }
  4888. // KeepRevisionForever sets the optional parameter
  4889. // "keepRevisionForever": Whether to set the 'keepForever' field in the
  4890. // new head revision. This is only applicable to files with binary
  4891. // content in Drive.
  4892. func (c *FilesUpdateCall) KeepRevisionForever(keepRevisionForever bool) *FilesUpdateCall {
  4893. c.urlParams_.Set("keepRevisionForever", fmt.Sprint(keepRevisionForever))
  4894. return c
  4895. }
  4896. // OcrLanguage sets the optional parameter "ocrLanguage": A language
  4897. // hint for OCR processing during image import (ISO 639-1 code).
  4898. func (c *FilesUpdateCall) OcrLanguage(ocrLanguage string) *FilesUpdateCall {
  4899. c.urlParams_.Set("ocrLanguage", ocrLanguage)
  4900. return c
  4901. }
  4902. // RemoveParents sets the optional parameter "removeParents": A
  4903. // comma-separated list of parent IDs to remove.
  4904. func (c *FilesUpdateCall) RemoveParents(removeParents string) *FilesUpdateCall {
  4905. c.urlParams_.Set("removeParents", removeParents)
  4906. return c
  4907. }
  4908. // SupportsTeamDrives sets the optional parameter "supportsTeamDrives":
  4909. // Whether the requesting application supports Team Drives.
  4910. func (c *FilesUpdateCall) SupportsTeamDrives(supportsTeamDrives bool) *FilesUpdateCall {
  4911. c.urlParams_.Set("supportsTeamDrives", fmt.Sprint(supportsTeamDrives))
  4912. return c
  4913. }
  4914. // UseContentAsIndexableText sets the optional parameter
  4915. // "useContentAsIndexableText": Whether to use the uploaded content as
  4916. // indexable text.
  4917. func (c *FilesUpdateCall) UseContentAsIndexableText(useContentAsIndexableText bool) *FilesUpdateCall {
  4918. c.urlParams_.Set("useContentAsIndexableText", fmt.Sprint(useContentAsIndexableText))
  4919. return c
  4920. }
  4921. // Media specifies the media to upload in one or more chunks. The chunk
  4922. // size may be controlled by supplying a MediaOption generated by
  4923. // googleapi.ChunkSize. The chunk size defaults to
  4924. // googleapi.DefaultUploadChunkSize.The Content-Type header used in the
  4925. // upload request will be determined by sniffing the contents of r,
  4926. // unless a MediaOption generated by googleapi.ContentType is
  4927. // supplied.
  4928. // At most one of Media and ResumableMedia may be set.
  4929. func (c *FilesUpdateCall) Media(r io.Reader, options ...googleapi.MediaOption) *FilesUpdateCall {
  4930. c.mediaInfo_ = gensupport.NewInfoFromMedia(r, options)
  4931. return c
  4932. }
  4933. // ResumableMedia specifies the media to upload in chunks and can be
  4934. // canceled with ctx.
  4935. //
  4936. // Deprecated: use Media instead.
  4937. //
  4938. // At most one of Media and ResumableMedia may be set. mediaType
  4939. // identifies the MIME media type of the upload, such as "image/png". If
  4940. // mediaType is "", it will be auto-detected. The provided ctx will
  4941. // supersede any context previously provided to the Context method.
  4942. func (c *FilesUpdateCall) ResumableMedia(ctx context.Context, r io.ReaderAt, size int64, mediaType string) *FilesUpdateCall {
  4943. c.ctx_ = ctx
  4944. c.mediaInfo_ = gensupport.NewInfoFromResumableMedia(r, size, mediaType)
  4945. return c
  4946. }
  4947. // ProgressUpdater provides a callback function that will be called
  4948. // after every chunk. It should be a low-latency function in order to
  4949. // not slow down the upload operation. This should only be called when
  4950. // using ResumableMedia (as opposed to Media).
  4951. func (c *FilesUpdateCall) ProgressUpdater(pu googleapi.ProgressUpdater) *FilesUpdateCall {
  4952. c.mediaInfo_.SetProgressUpdater(pu)
  4953. return c
  4954. }
  4955. // Fields allows partial responses to be retrieved. See
  4956. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4957. // for more information.
  4958. func (c *FilesUpdateCall) Fields(s ...googleapi.Field) *FilesUpdateCall {
  4959. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4960. return c
  4961. }
  4962. // Context sets the context to be used in this call's Do method. Any
  4963. // pending HTTP request will be aborted if the provided context is
  4964. // canceled.
  4965. // This context will supersede any context previously provided to the
  4966. // ResumableMedia method.
  4967. func (c *FilesUpdateCall) Context(ctx context.Context) *FilesUpdateCall {
  4968. c.ctx_ = ctx
  4969. return c
  4970. }
  4971. // Header returns an http.Header that can be modified by the caller to
  4972. // add HTTP headers to the request.
  4973. func (c *FilesUpdateCall) Header() http.Header {
  4974. if c.header_ == nil {
  4975. c.header_ = make(http.Header)
  4976. }
  4977. return c.header_
  4978. }
  4979. func (c *FilesUpdateCall) doRequest(alt string) (*http.Response, error) {
  4980. reqHeaders := make(http.Header)
  4981. for k, v := range c.header_ {
  4982. reqHeaders[k] = v
  4983. }
  4984. reqHeaders.Set("User-Agent", c.s.userAgent())
  4985. var body io.Reader = nil
  4986. body, err := googleapi.WithoutDataWrapper.JSONReader(c.file)
  4987. if err != nil {
  4988. return nil, err
  4989. }
  4990. reqHeaders.Set("Content-Type", "application/json")
  4991. c.urlParams_.Set("alt", alt)
  4992. c.urlParams_.Set("prettyPrint", "false")
  4993. urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}")
  4994. if c.mediaInfo_ != nil {
  4995. urls = strings.Replace(urls, "https://www.googleapis.com/", "https://www.googleapis.com/upload/", 1)
  4996. c.urlParams_.Set("uploadType", c.mediaInfo_.UploadType())
  4997. }
  4998. if body == nil {
  4999. body = new(bytes.Buffer)
  5000. reqHeaders.Set("Content-Type", "application/json")
  5001. }
  5002. body, getBody, cleanup := c.mediaInfo_.UploadRequest(reqHeaders, body)
  5003. defer cleanup()
  5004. urls += "?" + c.urlParams_.Encode()
  5005. req, err := http.NewRequest("PATCH", urls, body)
  5006. if err != nil {
  5007. return nil, err
  5008. }
  5009. req.Header = reqHeaders
  5010. req.GetBody = getBody
  5011. googleapi.Expand(req.URL, map[string]string{
  5012. "fileId": c.fileId,
  5013. })
  5014. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  5015. }
  5016. // Do executes the "drive.files.update" call.
  5017. // Exactly one of *File or error will be non-nil. Any non-2xx status
  5018. // code is an error. Response headers are in either
  5019. // *File.ServerResponse.Header or (if a response was returned at all) in
  5020. // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  5021. // whether the returned error was because http.StatusNotModified was
  5022. // returned.
  5023. func (c *FilesUpdateCall) Do(opts ...googleapi.CallOption) (*File, error) {
  5024. gensupport.SetOptions(c.urlParams_, opts...)
  5025. res, err := c.doRequest("json")
  5026. if res != nil && res.StatusCode == http.StatusNotModified {
  5027. if res.Body != nil {
  5028. res.Body.Close()
  5029. }
  5030. return nil, &googleapi.Error{
  5031. Code: res.StatusCode,
  5032. Header: res.Header,
  5033. }
  5034. }
  5035. if err != nil {
  5036. return nil, err
  5037. }
  5038. defer googleapi.CloseBody(res)
  5039. if err := googleapi.CheckResponse(res); err != nil {
  5040. return nil, err
  5041. }
  5042. rx := c.mediaInfo_.ResumableUpload(res.Header.Get("Location"))
  5043. if rx != nil {
  5044. rx.Client = c.s.client
  5045. rx.UserAgent = c.s.userAgent()
  5046. ctx := c.ctx_
  5047. if ctx == nil {
  5048. ctx = context.TODO()
  5049. }
  5050. res, err = rx.Upload(ctx)
  5051. if err != nil {
  5052. return nil, err
  5053. }
  5054. defer res.Body.Close()
  5055. if err := googleapi.CheckResponse(res); err != nil {
  5056. return nil, err
  5057. }
  5058. }
  5059. ret := &File{
  5060. ServerResponse: googleapi.ServerResponse{
  5061. Header: res.Header,
  5062. HTTPStatusCode: res.StatusCode,
  5063. },
  5064. }
  5065. target := &ret
  5066. if err := gensupport.DecodeResponse(target, res); err != nil {
  5067. return nil, err
  5068. }
  5069. return ret, nil
  5070. // {
  5071. // "description": "Updates a file's metadata and/or content with patch semantics.",
  5072. // "httpMethod": "PATCH",
  5073. // "id": "drive.files.update",
  5074. // "mediaUpload": {
  5075. // "accept": [
  5076. // "*/*"
  5077. // ],
  5078. // "maxSize": "5120GB",
  5079. // "protocols": {
  5080. // "resumable": {
  5081. // "multipart": true,
  5082. // "path": "/resumable/upload/drive/v3/files/{fileId}"
  5083. // },
  5084. // "simple": {
  5085. // "multipart": true,
  5086. // "path": "/upload/drive/v3/files/{fileId}"
  5087. // }
  5088. // }
  5089. // },
  5090. // "parameterOrder": [
  5091. // "fileId"
  5092. // ],
  5093. // "parameters": {
  5094. // "addParents": {
  5095. // "description": "A comma-separated list of parent IDs to add.",
  5096. // "location": "query",
  5097. // "type": "string"
  5098. // },
  5099. // "fileId": {
  5100. // "description": "The ID of the file.",
  5101. // "location": "path",
  5102. // "required": true,
  5103. // "type": "string"
  5104. // },
  5105. // "keepRevisionForever": {
  5106. // "default": "false",
  5107. // "description": "Whether to set the 'keepForever' field in the new head revision. This is only applicable to files with binary content in Drive.",
  5108. // "location": "query",
  5109. // "type": "boolean"
  5110. // },
  5111. // "ocrLanguage": {
  5112. // "description": "A language hint for OCR processing during image import (ISO 639-1 code).",
  5113. // "location": "query",
  5114. // "type": "string"
  5115. // },
  5116. // "removeParents": {
  5117. // "description": "A comma-separated list of parent IDs to remove.",
  5118. // "location": "query",
  5119. // "type": "string"
  5120. // },
  5121. // "supportsTeamDrives": {
  5122. // "default": "false",
  5123. // "description": "Whether the requesting application supports Team Drives.",
  5124. // "location": "query",
  5125. // "type": "boolean"
  5126. // },
  5127. // "useContentAsIndexableText": {
  5128. // "default": "false",
  5129. // "description": "Whether to use the uploaded content as indexable text.",
  5130. // "location": "query",
  5131. // "type": "boolean"
  5132. // }
  5133. // },
  5134. // "path": "files/{fileId}",
  5135. // "request": {
  5136. // "$ref": "File"
  5137. // },
  5138. // "response": {
  5139. // "$ref": "File"
  5140. // },
  5141. // "scopes": [
  5142. // "https://www.googleapis.com/auth/drive",
  5143. // "https://www.googleapis.com/auth/drive.appdata",
  5144. // "https://www.googleapis.com/auth/drive.file",
  5145. // "https://www.googleapis.com/auth/drive.metadata",
  5146. // "https://www.googleapis.com/auth/drive.scripts"
  5147. // ],
  5148. // "supportsMediaUpload": true
  5149. // }
  5150. }
  5151. // method id "drive.files.watch":
  5152. type FilesWatchCall struct {
  5153. s *Service
  5154. fileId string
  5155. channel *Channel
  5156. urlParams_ gensupport.URLParams
  5157. ctx_ context.Context
  5158. header_ http.Header
  5159. }
  5160. // Watch: Subscribes to changes to a file
  5161. func (r *FilesService) Watch(fileId string, channel *Channel) *FilesWatchCall {
  5162. c := &FilesWatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5163. c.fileId = fileId
  5164. c.channel = channel
  5165. return c
  5166. }
  5167. // AcknowledgeAbuse sets the optional parameter "acknowledgeAbuse":
  5168. // Whether the user is acknowledging the risk of downloading known
  5169. // malware or other abusive files. This is only applicable when
  5170. // alt=media.
  5171. func (c *FilesWatchCall) AcknowledgeAbuse(acknowledgeAbuse bool) *FilesWatchCall {
  5172. c.urlParams_.Set("acknowledgeAbuse", fmt.Sprint(acknowledgeAbuse))
  5173. return c
  5174. }
  5175. // SupportsTeamDrives sets the optional parameter "supportsTeamDrives":
  5176. // Whether the requesting application supports Team Drives.
  5177. func (c *FilesWatchCall) SupportsTeamDrives(supportsTeamDrives bool) *FilesWatchCall {
  5178. c.urlParams_.Set("supportsTeamDrives", fmt.Sprint(supportsTeamDrives))
  5179. return c
  5180. }
  5181. // Fields allows partial responses to be retrieved. See
  5182. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5183. // for more information.
  5184. func (c *FilesWatchCall) Fields(s ...googleapi.Field) *FilesWatchCall {
  5185. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5186. return c
  5187. }
  5188. // Context sets the context to be used in this call's Do and Download
  5189. // methods. Any pending HTTP request will be aborted if the provided
  5190. // context is canceled.
  5191. func (c *FilesWatchCall) Context(ctx context.Context) *FilesWatchCall {
  5192. c.ctx_ = ctx
  5193. return c
  5194. }
  5195. // Header returns an http.Header that can be modified by the caller to
  5196. // add HTTP headers to the request.
  5197. func (c *FilesWatchCall) Header() http.Header {
  5198. if c.header_ == nil {
  5199. c.header_ = make(http.Header)
  5200. }
  5201. return c.header_
  5202. }
  5203. func (c *FilesWatchCall) doRequest(alt string) (*http.Response, error) {
  5204. reqHeaders := make(http.Header)
  5205. for k, v := range c.header_ {
  5206. reqHeaders[k] = v
  5207. }
  5208. reqHeaders.Set("User-Agent", c.s.userAgent())
  5209. var body io.Reader = nil
  5210. body, err := googleapi.WithoutDataWrapper.JSONReader(c.channel)
  5211. if err != nil {
  5212. return nil, err
  5213. }
  5214. reqHeaders.Set("Content-Type", "application/json")
  5215. c.urlParams_.Set("alt", alt)
  5216. c.urlParams_.Set("prettyPrint", "false")
  5217. urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/watch")
  5218. urls += "?" + c.urlParams_.Encode()
  5219. req, err := http.NewRequest("POST", urls, body)
  5220. if err != nil {
  5221. return nil, err
  5222. }
  5223. req.Header = reqHeaders
  5224. googleapi.Expand(req.URL, map[string]string{
  5225. "fileId": c.fileId,
  5226. })
  5227. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  5228. }
  5229. // Download fetches the API endpoint's "media" value, instead of the normal
  5230. // API response value. If the returned error is nil, the Response is guaranteed to
  5231. // have a 2xx status code. Callers must close the Response.Body as usual.
  5232. func (c *FilesWatchCall) Download(opts ...googleapi.CallOption) (*http.Response, error) {
  5233. gensupport.SetOptions(c.urlParams_, opts...)
  5234. res, err := c.doRequest("media")
  5235. if err != nil {
  5236. return nil, err
  5237. }
  5238. if err := googleapi.CheckMediaResponse(res); err != nil {
  5239. res.Body.Close()
  5240. return nil, err
  5241. }
  5242. return res, nil
  5243. }
  5244. // Do executes the "drive.files.watch" call.
  5245. // Exactly one of *Channel or error will be non-nil. Any non-2xx status
  5246. // code is an error. Response headers are in either
  5247. // *Channel.ServerResponse.Header or (if a response was returned at all)
  5248. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  5249. // check whether the returned error was because http.StatusNotModified
  5250. // was returned.
  5251. func (c *FilesWatchCall) Do(opts ...googleapi.CallOption) (*Channel, error) {
  5252. gensupport.SetOptions(c.urlParams_, opts...)
  5253. res, err := c.doRequest("json")
  5254. if res != nil && res.StatusCode == http.StatusNotModified {
  5255. if res.Body != nil {
  5256. res.Body.Close()
  5257. }
  5258. return nil, &googleapi.Error{
  5259. Code: res.StatusCode,
  5260. Header: res.Header,
  5261. }
  5262. }
  5263. if err != nil {
  5264. return nil, err
  5265. }
  5266. defer googleapi.CloseBody(res)
  5267. if err := googleapi.CheckResponse(res); err != nil {
  5268. return nil, err
  5269. }
  5270. ret := &Channel{
  5271. ServerResponse: googleapi.ServerResponse{
  5272. Header: res.Header,
  5273. HTTPStatusCode: res.StatusCode,
  5274. },
  5275. }
  5276. target := &ret
  5277. if err := gensupport.DecodeResponse(target, res); err != nil {
  5278. return nil, err
  5279. }
  5280. return ret, nil
  5281. // {
  5282. // "description": "Subscribes to changes to a file",
  5283. // "httpMethod": "POST",
  5284. // "id": "drive.files.watch",
  5285. // "parameterOrder": [
  5286. // "fileId"
  5287. // ],
  5288. // "parameters": {
  5289. // "acknowledgeAbuse": {
  5290. // "default": "false",
  5291. // "description": "Whether the user is acknowledging the risk of downloading known malware or other abusive files. This is only applicable when alt=media.",
  5292. // "location": "query",
  5293. // "type": "boolean"
  5294. // },
  5295. // "fileId": {
  5296. // "description": "The ID of the file.",
  5297. // "location": "path",
  5298. // "required": true,
  5299. // "type": "string"
  5300. // },
  5301. // "supportsTeamDrives": {
  5302. // "default": "false",
  5303. // "description": "Whether the requesting application supports Team Drives.",
  5304. // "location": "query",
  5305. // "type": "boolean"
  5306. // }
  5307. // },
  5308. // "path": "files/{fileId}/watch",
  5309. // "request": {
  5310. // "$ref": "Channel",
  5311. // "parameterName": "resource"
  5312. // },
  5313. // "response": {
  5314. // "$ref": "Channel"
  5315. // },
  5316. // "scopes": [
  5317. // "https://www.googleapis.com/auth/drive",
  5318. // "https://www.googleapis.com/auth/drive.appdata",
  5319. // "https://www.googleapis.com/auth/drive.file",
  5320. // "https://www.googleapis.com/auth/drive.metadata",
  5321. // "https://www.googleapis.com/auth/drive.metadata.readonly",
  5322. // "https://www.googleapis.com/auth/drive.photos.readonly",
  5323. // "https://www.googleapis.com/auth/drive.readonly"
  5324. // ],
  5325. // "supportsMediaDownload": true,
  5326. // "supportsSubscription": true,
  5327. // "useMediaDownloadService": true
  5328. // }
  5329. }
  5330. // method id "drive.permissions.create":
  5331. type PermissionsCreateCall struct {
  5332. s *Service
  5333. fileId string
  5334. permission *Permission
  5335. urlParams_ gensupport.URLParams
  5336. ctx_ context.Context
  5337. header_ http.Header
  5338. }
  5339. // Create: Creates a permission for a file or Team Drive.
  5340. func (r *PermissionsService) Create(fileId string, permission *Permission) *PermissionsCreateCall {
  5341. c := &PermissionsCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5342. c.fileId = fileId
  5343. c.permission = permission
  5344. return c
  5345. }
  5346. // EmailMessage sets the optional parameter "emailMessage": A plain text
  5347. // custom message to include in the notification email.
  5348. func (c *PermissionsCreateCall) EmailMessage(emailMessage string) *PermissionsCreateCall {
  5349. c.urlParams_.Set("emailMessage", emailMessage)
  5350. return c
  5351. }
  5352. // SendNotificationEmail sets the optional parameter
  5353. // "sendNotificationEmail": Whether to send a notification email when
  5354. // sharing to users or groups. This defaults to true for users and
  5355. // groups, and is not allowed for other requests. It must not be
  5356. // disabled for ownership transfers.
  5357. func (c *PermissionsCreateCall) SendNotificationEmail(sendNotificationEmail bool) *PermissionsCreateCall {
  5358. c.urlParams_.Set("sendNotificationEmail", fmt.Sprint(sendNotificationEmail))
  5359. return c
  5360. }
  5361. // SupportsTeamDrives sets the optional parameter "supportsTeamDrives":
  5362. // Whether the requesting application supports Team Drives.
  5363. func (c *PermissionsCreateCall) SupportsTeamDrives(supportsTeamDrives bool) *PermissionsCreateCall {
  5364. c.urlParams_.Set("supportsTeamDrives", fmt.Sprint(supportsTeamDrives))
  5365. return c
  5366. }
  5367. // TransferOwnership sets the optional parameter "transferOwnership":
  5368. // Whether to transfer ownership to the specified user and downgrade the
  5369. // current owner to a writer. This parameter is required as an
  5370. // acknowledgement of the side effect.
  5371. func (c *PermissionsCreateCall) TransferOwnership(transferOwnership bool) *PermissionsCreateCall {
  5372. c.urlParams_.Set("transferOwnership", fmt.Sprint(transferOwnership))
  5373. return c
  5374. }
  5375. // UseDomainAdminAccess sets the optional parameter
  5376. // "useDomainAdminAccess": Issue the request as a domain administrator;
  5377. // if set to true, then the requester will be granted access if they are
  5378. // an administrator of the domain to which the item belongs.
  5379. func (c *PermissionsCreateCall) UseDomainAdminAccess(useDomainAdminAccess bool) *PermissionsCreateCall {
  5380. c.urlParams_.Set("useDomainAdminAccess", fmt.Sprint(useDomainAdminAccess))
  5381. return c
  5382. }
  5383. // Fields allows partial responses to be retrieved. See
  5384. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5385. // for more information.
  5386. func (c *PermissionsCreateCall) Fields(s ...googleapi.Field) *PermissionsCreateCall {
  5387. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5388. return c
  5389. }
  5390. // Context sets the context to be used in this call's Do method. Any
  5391. // pending HTTP request will be aborted if the provided context is
  5392. // canceled.
  5393. func (c *PermissionsCreateCall) Context(ctx context.Context) *PermissionsCreateCall {
  5394. c.ctx_ = ctx
  5395. return c
  5396. }
  5397. // Header returns an http.Header that can be modified by the caller to
  5398. // add HTTP headers to the request.
  5399. func (c *PermissionsCreateCall) Header() http.Header {
  5400. if c.header_ == nil {
  5401. c.header_ = make(http.Header)
  5402. }
  5403. return c.header_
  5404. }
  5405. func (c *PermissionsCreateCall) doRequest(alt string) (*http.Response, error) {
  5406. reqHeaders := make(http.Header)
  5407. for k, v := range c.header_ {
  5408. reqHeaders[k] = v
  5409. }
  5410. reqHeaders.Set("User-Agent", c.s.userAgent())
  5411. var body io.Reader = nil
  5412. body, err := googleapi.WithoutDataWrapper.JSONReader(c.permission)
  5413. if err != nil {
  5414. return nil, err
  5415. }
  5416. reqHeaders.Set("Content-Type", "application/json")
  5417. c.urlParams_.Set("alt", alt)
  5418. c.urlParams_.Set("prettyPrint", "false")
  5419. urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/permissions")
  5420. urls += "?" + c.urlParams_.Encode()
  5421. req, err := http.NewRequest("POST", urls, body)
  5422. if err != nil {
  5423. return nil, err
  5424. }
  5425. req.Header = reqHeaders
  5426. googleapi.Expand(req.URL, map[string]string{
  5427. "fileId": c.fileId,
  5428. })
  5429. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  5430. }
  5431. // Do executes the "drive.permissions.create" call.
  5432. // Exactly one of *Permission or error will be non-nil. Any non-2xx
  5433. // status code is an error. Response headers are in either
  5434. // *Permission.ServerResponse.Header or (if a response was returned at
  5435. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  5436. // to check whether the returned error was because
  5437. // http.StatusNotModified was returned.
  5438. func (c *PermissionsCreateCall) Do(opts ...googleapi.CallOption) (*Permission, error) {
  5439. gensupport.SetOptions(c.urlParams_, opts...)
  5440. res, err := c.doRequest("json")
  5441. if res != nil && res.StatusCode == http.StatusNotModified {
  5442. if res.Body != nil {
  5443. res.Body.Close()
  5444. }
  5445. return nil, &googleapi.Error{
  5446. Code: res.StatusCode,
  5447. Header: res.Header,
  5448. }
  5449. }
  5450. if err != nil {
  5451. return nil, err
  5452. }
  5453. defer googleapi.CloseBody(res)
  5454. if err := googleapi.CheckResponse(res); err != nil {
  5455. return nil, err
  5456. }
  5457. ret := &Permission{
  5458. ServerResponse: googleapi.ServerResponse{
  5459. Header: res.Header,
  5460. HTTPStatusCode: res.StatusCode,
  5461. },
  5462. }
  5463. target := &ret
  5464. if err := gensupport.DecodeResponse(target, res); err != nil {
  5465. return nil, err
  5466. }
  5467. return ret, nil
  5468. // {
  5469. // "description": "Creates a permission for a file or Team Drive.",
  5470. // "httpMethod": "POST",
  5471. // "id": "drive.permissions.create",
  5472. // "parameterOrder": [
  5473. // "fileId"
  5474. // ],
  5475. // "parameters": {
  5476. // "emailMessage": {
  5477. // "description": "A plain text custom message to include in the notification email.",
  5478. // "location": "query",
  5479. // "type": "string"
  5480. // },
  5481. // "fileId": {
  5482. // "description": "The ID of the file or Team Drive.",
  5483. // "location": "path",
  5484. // "required": true,
  5485. // "type": "string"
  5486. // },
  5487. // "sendNotificationEmail": {
  5488. // "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.",
  5489. // "location": "query",
  5490. // "type": "boolean"
  5491. // },
  5492. // "supportsTeamDrives": {
  5493. // "default": "false",
  5494. // "description": "Whether the requesting application supports Team Drives.",
  5495. // "location": "query",
  5496. // "type": "boolean"
  5497. // },
  5498. // "transferOwnership": {
  5499. // "default": "false",
  5500. // "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.",
  5501. // "location": "query",
  5502. // "type": "boolean"
  5503. // },
  5504. // "useDomainAdminAccess": {
  5505. // "default": "false",
  5506. // "description": "Issue the request as a domain administrator; if set to true, then the requester will be granted access if they are an administrator of the domain to which the item belongs.",
  5507. // "location": "query",
  5508. // "type": "boolean"
  5509. // }
  5510. // },
  5511. // "path": "files/{fileId}/permissions",
  5512. // "request": {
  5513. // "$ref": "Permission"
  5514. // },
  5515. // "response": {
  5516. // "$ref": "Permission"
  5517. // },
  5518. // "scopes": [
  5519. // "https://www.googleapis.com/auth/drive",
  5520. // "https://www.googleapis.com/auth/drive.file"
  5521. // ]
  5522. // }
  5523. }
  5524. // method id "drive.permissions.delete":
  5525. type PermissionsDeleteCall struct {
  5526. s *Service
  5527. fileId string
  5528. permissionId string
  5529. urlParams_ gensupport.URLParams
  5530. ctx_ context.Context
  5531. header_ http.Header
  5532. }
  5533. // Delete: Deletes a permission.
  5534. func (r *PermissionsService) Delete(fileId string, permissionId string) *PermissionsDeleteCall {
  5535. c := &PermissionsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5536. c.fileId = fileId
  5537. c.permissionId = permissionId
  5538. return c
  5539. }
  5540. // SupportsTeamDrives sets the optional parameter "supportsTeamDrives":
  5541. // Whether the requesting application supports Team Drives.
  5542. func (c *PermissionsDeleteCall) SupportsTeamDrives(supportsTeamDrives bool) *PermissionsDeleteCall {
  5543. c.urlParams_.Set("supportsTeamDrives", fmt.Sprint(supportsTeamDrives))
  5544. return c
  5545. }
  5546. // UseDomainAdminAccess sets the optional parameter
  5547. // "useDomainAdminAccess": Issue the request as a domain administrator;
  5548. // if set to true, then the requester will be granted access if they are
  5549. // an administrator of the domain to which the item belongs.
  5550. func (c *PermissionsDeleteCall) UseDomainAdminAccess(useDomainAdminAccess bool) *PermissionsDeleteCall {
  5551. c.urlParams_.Set("useDomainAdminAccess", fmt.Sprint(useDomainAdminAccess))
  5552. return c
  5553. }
  5554. // Fields allows partial responses to be retrieved. See
  5555. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5556. // for more information.
  5557. func (c *PermissionsDeleteCall) Fields(s ...googleapi.Field) *PermissionsDeleteCall {
  5558. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5559. return c
  5560. }
  5561. // Context sets the context to be used in this call's Do method. Any
  5562. // pending HTTP request will be aborted if the provided context is
  5563. // canceled.
  5564. func (c *PermissionsDeleteCall) Context(ctx context.Context) *PermissionsDeleteCall {
  5565. c.ctx_ = ctx
  5566. return c
  5567. }
  5568. // Header returns an http.Header that can be modified by the caller to
  5569. // add HTTP headers to the request.
  5570. func (c *PermissionsDeleteCall) Header() http.Header {
  5571. if c.header_ == nil {
  5572. c.header_ = make(http.Header)
  5573. }
  5574. return c.header_
  5575. }
  5576. func (c *PermissionsDeleteCall) doRequest(alt string) (*http.Response, error) {
  5577. reqHeaders := make(http.Header)
  5578. for k, v := range c.header_ {
  5579. reqHeaders[k] = v
  5580. }
  5581. reqHeaders.Set("User-Agent", c.s.userAgent())
  5582. var body io.Reader = nil
  5583. c.urlParams_.Set("alt", alt)
  5584. c.urlParams_.Set("prettyPrint", "false")
  5585. urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/permissions/{permissionId}")
  5586. urls += "?" + c.urlParams_.Encode()
  5587. req, err := http.NewRequest("DELETE", urls, body)
  5588. if err != nil {
  5589. return nil, err
  5590. }
  5591. req.Header = reqHeaders
  5592. googleapi.Expand(req.URL, map[string]string{
  5593. "fileId": c.fileId,
  5594. "permissionId": c.permissionId,
  5595. })
  5596. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  5597. }
  5598. // Do executes the "drive.permissions.delete" call.
  5599. func (c *PermissionsDeleteCall) Do(opts ...googleapi.CallOption) error {
  5600. gensupport.SetOptions(c.urlParams_, opts...)
  5601. res, err := c.doRequest("json")
  5602. if err != nil {
  5603. return err
  5604. }
  5605. defer googleapi.CloseBody(res)
  5606. if err := googleapi.CheckResponse(res); err != nil {
  5607. return err
  5608. }
  5609. return nil
  5610. // {
  5611. // "description": "Deletes a permission.",
  5612. // "httpMethod": "DELETE",
  5613. // "id": "drive.permissions.delete",
  5614. // "parameterOrder": [
  5615. // "fileId",
  5616. // "permissionId"
  5617. // ],
  5618. // "parameters": {
  5619. // "fileId": {
  5620. // "description": "The ID of the file or Team Drive.",
  5621. // "location": "path",
  5622. // "required": true,
  5623. // "type": "string"
  5624. // },
  5625. // "permissionId": {
  5626. // "description": "The ID of the permission.",
  5627. // "location": "path",
  5628. // "required": true,
  5629. // "type": "string"
  5630. // },
  5631. // "supportsTeamDrives": {
  5632. // "default": "false",
  5633. // "description": "Whether the requesting application supports Team Drives.",
  5634. // "location": "query",
  5635. // "type": "boolean"
  5636. // },
  5637. // "useDomainAdminAccess": {
  5638. // "default": "false",
  5639. // "description": "Issue the request as a domain administrator; if set to true, then the requester will be granted access if they are an administrator of the domain to which the item belongs.",
  5640. // "location": "query",
  5641. // "type": "boolean"
  5642. // }
  5643. // },
  5644. // "path": "files/{fileId}/permissions/{permissionId}",
  5645. // "scopes": [
  5646. // "https://www.googleapis.com/auth/drive",
  5647. // "https://www.googleapis.com/auth/drive.file"
  5648. // ]
  5649. // }
  5650. }
  5651. // method id "drive.permissions.get":
  5652. type PermissionsGetCall struct {
  5653. s *Service
  5654. fileId string
  5655. permissionId string
  5656. urlParams_ gensupport.URLParams
  5657. ifNoneMatch_ string
  5658. ctx_ context.Context
  5659. header_ http.Header
  5660. }
  5661. // Get: Gets a permission by ID.
  5662. func (r *PermissionsService) Get(fileId string, permissionId string) *PermissionsGetCall {
  5663. c := &PermissionsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5664. c.fileId = fileId
  5665. c.permissionId = permissionId
  5666. return c
  5667. }
  5668. // SupportsTeamDrives sets the optional parameter "supportsTeamDrives":
  5669. // Whether the requesting application supports Team Drives.
  5670. func (c *PermissionsGetCall) SupportsTeamDrives(supportsTeamDrives bool) *PermissionsGetCall {
  5671. c.urlParams_.Set("supportsTeamDrives", fmt.Sprint(supportsTeamDrives))
  5672. return c
  5673. }
  5674. // UseDomainAdminAccess sets the optional parameter
  5675. // "useDomainAdminAccess": Issue the request as a domain administrator;
  5676. // if set to true, then the requester will be granted access if they are
  5677. // an administrator of the domain to which the item belongs.
  5678. func (c *PermissionsGetCall) UseDomainAdminAccess(useDomainAdminAccess bool) *PermissionsGetCall {
  5679. c.urlParams_.Set("useDomainAdminAccess", fmt.Sprint(useDomainAdminAccess))
  5680. return c
  5681. }
  5682. // Fields allows partial responses to be retrieved. See
  5683. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5684. // for more information.
  5685. func (c *PermissionsGetCall) Fields(s ...googleapi.Field) *PermissionsGetCall {
  5686. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5687. return c
  5688. }
  5689. // IfNoneMatch sets the optional parameter which makes the operation
  5690. // fail if the object's ETag matches the given value. This is useful for
  5691. // getting updates only after the object has changed since the last
  5692. // request. Use googleapi.IsNotModified to check whether the response
  5693. // error from Do is the result of In-None-Match.
  5694. func (c *PermissionsGetCall) IfNoneMatch(entityTag string) *PermissionsGetCall {
  5695. c.ifNoneMatch_ = entityTag
  5696. return c
  5697. }
  5698. // Context sets the context to be used in this call's Do method. Any
  5699. // pending HTTP request will be aborted if the provided context is
  5700. // canceled.
  5701. func (c *PermissionsGetCall) Context(ctx context.Context) *PermissionsGetCall {
  5702. c.ctx_ = ctx
  5703. return c
  5704. }
  5705. // Header returns an http.Header that can be modified by the caller to
  5706. // add HTTP headers to the request.
  5707. func (c *PermissionsGetCall) Header() http.Header {
  5708. if c.header_ == nil {
  5709. c.header_ = make(http.Header)
  5710. }
  5711. return c.header_
  5712. }
  5713. func (c *PermissionsGetCall) doRequest(alt string) (*http.Response, error) {
  5714. reqHeaders := make(http.Header)
  5715. for k, v := range c.header_ {
  5716. reqHeaders[k] = v
  5717. }
  5718. reqHeaders.Set("User-Agent", c.s.userAgent())
  5719. if c.ifNoneMatch_ != "" {
  5720. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  5721. }
  5722. var body io.Reader = nil
  5723. c.urlParams_.Set("alt", alt)
  5724. c.urlParams_.Set("prettyPrint", "false")
  5725. urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/permissions/{permissionId}")
  5726. urls += "?" + c.urlParams_.Encode()
  5727. req, err := http.NewRequest("GET", urls, body)
  5728. if err != nil {
  5729. return nil, err
  5730. }
  5731. req.Header = reqHeaders
  5732. googleapi.Expand(req.URL, map[string]string{
  5733. "fileId": c.fileId,
  5734. "permissionId": c.permissionId,
  5735. })
  5736. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  5737. }
  5738. // Do executes the "drive.permissions.get" call.
  5739. // Exactly one of *Permission or error will be non-nil. Any non-2xx
  5740. // status code is an error. Response headers are in either
  5741. // *Permission.ServerResponse.Header or (if a response was returned at
  5742. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  5743. // to check whether the returned error was because
  5744. // http.StatusNotModified was returned.
  5745. func (c *PermissionsGetCall) Do(opts ...googleapi.CallOption) (*Permission, error) {
  5746. gensupport.SetOptions(c.urlParams_, opts...)
  5747. res, err := c.doRequest("json")
  5748. if res != nil && res.StatusCode == http.StatusNotModified {
  5749. if res.Body != nil {
  5750. res.Body.Close()
  5751. }
  5752. return nil, &googleapi.Error{
  5753. Code: res.StatusCode,
  5754. Header: res.Header,
  5755. }
  5756. }
  5757. if err != nil {
  5758. return nil, err
  5759. }
  5760. defer googleapi.CloseBody(res)
  5761. if err := googleapi.CheckResponse(res); err != nil {
  5762. return nil, err
  5763. }
  5764. ret := &Permission{
  5765. ServerResponse: googleapi.ServerResponse{
  5766. Header: res.Header,
  5767. HTTPStatusCode: res.StatusCode,
  5768. },
  5769. }
  5770. target := &ret
  5771. if err := gensupport.DecodeResponse(target, res); err != nil {
  5772. return nil, err
  5773. }
  5774. return ret, nil
  5775. // {
  5776. // "description": "Gets a permission by ID.",
  5777. // "httpMethod": "GET",
  5778. // "id": "drive.permissions.get",
  5779. // "parameterOrder": [
  5780. // "fileId",
  5781. // "permissionId"
  5782. // ],
  5783. // "parameters": {
  5784. // "fileId": {
  5785. // "description": "The ID of the file.",
  5786. // "location": "path",
  5787. // "required": true,
  5788. // "type": "string"
  5789. // },
  5790. // "permissionId": {
  5791. // "description": "The ID of the permission.",
  5792. // "location": "path",
  5793. // "required": true,
  5794. // "type": "string"
  5795. // },
  5796. // "supportsTeamDrives": {
  5797. // "default": "false",
  5798. // "description": "Whether the requesting application supports Team Drives.",
  5799. // "location": "query",
  5800. // "type": "boolean"
  5801. // },
  5802. // "useDomainAdminAccess": {
  5803. // "default": "false",
  5804. // "description": "Issue the request as a domain administrator; if set to true, then the requester will be granted access if they are an administrator of the domain to which the item belongs.",
  5805. // "location": "query",
  5806. // "type": "boolean"
  5807. // }
  5808. // },
  5809. // "path": "files/{fileId}/permissions/{permissionId}",
  5810. // "response": {
  5811. // "$ref": "Permission"
  5812. // },
  5813. // "scopes": [
  5814. // "https://www.googleapis.com/auth/drive",
  5815. // "https://www.googleapis.com/auth/drive.file",
  5816. // "https://www.googleapis.com/auth/drive.metadata",
  5817. // "https://www.googleapis.com/auth/drive.metadata.readonly",
  5818. // "https://www.googleapis.com/auth/drive.photos.readonly",
  5819. // "https://www.googleapis.com/auth/drive.readonly"
  5820. // ]
  5821. // }
  5822. }
  5823. // method id "drive.permissions.list":
  5824. type PermissionsListCall struct {
  5825. s *Service
  5826. fileId string
  5827. urlParams_ gensupport.URLParams
  5828. ifNoneMatch_ string
  5829. ctx_ context.Context
  5830. header_ http.Header
  5831. }
  5832. // List: Lists a file's or Team Drive's permissions.
  5833. func (r *PermissionsService) List(fileId string) *PermissionsListCall {
  5834. c := &PermissionsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5835. c.fileId = fileId
  5836. return c
  5837. }
  5838. // PageSize sets the optional parameter "pageSize": The maximum number
  5839. // of permissions to return per page. When not set for files in a Team
  5840. // Drive, at most 100 results will be returned. When not set for files
  5841. // that are not in a Team Drive, the entire list will be returned.
  5842. func (c *PermissionsListCall) PageSize(pageSize int64) *PermissionsListCall {
  5843. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  5844. return c
  5845. }
  5846. // PageToken sets the optional parameter "pageToken": The token for
  5847. // continuing a previous list request on the next page. This should be
  5848. // set to the value of 'nextPageToken' from the previous response.
  5849. func (c *PermissionsListCall) PageToken(pageToken string) *PermissionsListCall {
  5850. c.urlParams_.Set("pageToken", pageToken)
  5851. return c
  5852. }
  5853. // SupportsTeamDrives sets the optional parameter "supportsTeamDrives":
  5854. // Whether the requesting application supports Team Drives.
  5855. func (c *PermissionsListCall) SupportsTeamDrives(supportsTeamDrives bool) *PermissionsListCall {
  5856. c.urlParams_.Set("supportsTeamDrives", fmt.Sprint(supportsTeamDrives))
  5857. return c
  5858. }
  5859. // UseDomainAdminAccess sets the optional parameter
  5860. // "useDomainAdminAccess": Issue the request as a domain administrator;
  5861. // if set to true, then the requester will be granted access if they are
  5862. // an administrator of the domain to which the item belongs.
  5863. func (c *PermissionsListCall) UseDomainAdminAccess(useDomainAdminAccess bool) *PermissionsListCall {
  5864. c.urlParams_.Set("useDomainAdminAccess", fmt.Sprint(useDomainAdminAccess))
  5865. return c
  5866. }
  5867. // Fields allows partial responses to be retrieved. See
  5868. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5869. // for more information.
  5870. func (c *PermissionsListCall) Fields(s ...googleapi.Field) *PermissionsListCall {
  5871. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5872. return c
  5873. }
  5874. // IfNoneMatch sets the optional parameter which makes the operation
  5875. // fail if the object's ETag matches the given value. This is useful for
  5876. // getting updates only after the object has changed since the last
  5877. // request. Use googleapi.IsNotModified to check whether the response
  5878. // error from Do is the result of In-None-Match.
  5879. func (c *PermissionsListCall) IfNoneMatch(entityTag string) *PermissionsListCall {
  5880. c.ifNoneMatch_ = entityTag
  5881. return c
  5882. }
  5883. // Context sets the context to be used in this call's Do method. Any
  5884. // pending HTTP request will be aborted if the provided context is
  5885. // canceled.
  5886. func (c *PermissionsListCall) Context(ctx context.Context) *PermissionsListCall {
  5887. c.ctx_ = ctx
  5888. return c
  5889. }
  5890. // Header returns an http.Header that can be modified by the caller to
  5891. // add HTTP headers to the request.
  5892. func (c *PermissionsListCall) Header() http.Header {
  5893. if c.header_ == nil {
  5894. c.header_ = make(http.Header)
  5895. }
  5896. return c.header_
  5897. }
  5898. func (c *PermissionsListCall) doRequest(alt string) (*http.Response, error) {
  5899. reqHeaders := make(http.Header)
  5900. for k, v := range c.header_ {
  5901. reqHeaders[k] = v
  5902. }
  5903. reqHeaders.Set("User-Agent", c.s.userAgent())
  5904. if c.ifNoneMatch_ != "" {
  5905. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  5906. }
  5907. var body io.Reader = nil
  5908. c.urlParams_.Set("alt", alt)
  5909. c.urlParams_.Set("prettyPrint", "false")
  5910. urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/permissions")
  5911. urls += "?" + c.urlParams_.Encode()
  5912. req, err := http.NewRequest("GET", urls, body)
  5913. if err != nil {
  5914. return nil, err
  5915. }
  5916. req.Header = reqHeaders
  5917. googleapi.Expand(req.URL, map[string]string{
  5918. "fileId": c.fileId,
  5919. })
  5920. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  5921. }
  5922. // Do executes the "drive.permissions.list" call.
  5923. // Exactly one of *PermissionList or error will be non-nil. Any non-2xx
  5924. // status code is an error. Response headers are in either
  5925. // *PermissionList.ServerResponse.Header or (if a response was returned
  5926. // at all) in error.(*googleapi.Error).Header. Use
  5927. // googleapi.IsNotModified to check whether the returned error was
  5928. // because http.StatusNotModified was returned.
  5929. func (c *PermissionsListCall) Do(opts ...googleapi.CallOption) (*PermissionList, error) {
  5930. gensupport.SetOptions(c.urlParams_, opts...)
  5931. res, err := c.doRequest("json")
  5932. if res != nil && res.StatusCode == http.StatusNotModified {
  5933. if res.Body != nil {
  5934. res.Body.Close()
  5935. }
  5936. return nil, &googleapi.Error{
  5937. Code: res.StatusCode,
  5938. Header: res.Header,
  5939. }
  5940. }
  5941. if err != nil {
  5942. return nil, err
  5943. }
  5944. defer googleapi.CloseBody(res)
  5945. if err := googleapi.CheckResponse(res); err != nil {
  5946. return nil, err
  5947. }
  5948. ret := &PermissionList{
  5949. ServerResponse: googleapi.ServerResponse{
  5950. Header: res.Header,
  5951. HTTPStatusCode: res.StatusCode,
  5952. },
  5953. }
  5954. target := &ret
  5955. if err := gensupport.DecodeResponse(target, res); err != nil {
  5956. return nil, err
  5957. }
  5958. return ret, nil
  5959. // {
  5960. // "description": "Lists a file's or Team Drive's permissions.",
  5961. // "httpMethod": "GET",
  5962. // "id": "drive.permissions.list",
  5963. // "parameterOrder": [
  5964. // "fileId"
  5965. // ],
  5966. // "parameters": {
  5967. // "fileId": {
  5968. // "description": "The ID of the file or Team Drive.",
  5969. // "location": "path",
  5970. // "required": true,
  5971. // "type": "string"
  5972. // },
  5973. // "pageSize": {
  5974. // "description": "The maximum number of permissions to return per page. When not set for files in a Team Drive, at most 100 results will be returned. When not set for files that are not in a Team Drive, the entire list will be returned.",
  5975. // "format": "int32",
  5976. // "location": "query",
  5977. // "maximum": "100",
  5978. // "minimum": "1",
  5979. // "type": "integer"
  5980. // },
  5981. // "pageToken": {
  5982. // "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.",
  5983. // "location": "query",
  5984. // "type": "string"
  5985. // },
  5986. // "supportsTeamDrives": {
  5987. // "default": "false",
  5988. // "description": "Whether the requesting application supports Team Drives.",
  5989. // "location": "query",
  5990. // "type": "boolean"
  5991. // },
  5992. // "useDomainAdminAccess": {
  5993. // "default": "false",
  5994. // "description": "Issue the request as a domain administrator; if set to true, then the requester will be granted access if they are an administrator of the domain to which the item belongs.",
  5995. // "location": "query",
  5996. // "type": "boolean"
  5997. // }
  5998. // },
  5999. // "path": "files/{fileId}/permissions",
  6000. // "response": {
  6001. // "$ref": "PermissionList"
  6002. // },
  6003. // "scopes": [
  6004. // "https://www.googleapis.com/auth/drive",
  6005. // "https://www.googleapis.com/auth/drive.file",
  6006. // "https://www.googleapis.com/auth/drive.metadata",
  6007. // "https://www.googleapis.com/auth/drive.metadata.readonly",
  6008. // "https://www.googleapis.com/auth/drive.photos.readonly",
  6009. // "https://www.googleapis.com/auth/drive.readonly"
  6010. // ]
  6011. // }
  6012. }
  6013. // Pages invokes f for each page of results.
  6014. // A non-nil error returned from f will halt the iteration.
  6015. // The provided context supersedes any context provided to the Context method.
  6016. func (c *PermissionsListCall) Pages(ctx context.Context, f func(*PermissionList) error) error {
  6017. c.ctx_ = ctx
  6018. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  6019. for {
  6020. x, err := c.Do()
  6021. if err != nil {
  6022. return err
  6023. }
  6024. if err := f(x); err != nil {
  6025. return err
  6026. }
  6027. if x.NextPageToken == "" {
  6028. return nil
  6029. }
  6030. c.PageToken(x.NextPageToken)
  6031. }
  6032. }
  6033. // method id "drive.permissions.update":
  6034. type PermissionsUpdateCall struct {
  6035. s *Service
  6036. fileId string
  6037. permissionId string
  6038. permission *Permission
  6039. urlParams_ gensupport.URLParams
  6040. ctx_ context.Context
  6041. header_ http.Header
  6042. }
  6043. // Update: Updates a permission with patch semantics.
  6044. func (r *PermissionsService) Update(fileId string, permissionId string, permission *Permission) *PermissionsUpdateCall {
  6045. c := &PermissionsUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  6046. c.fileId = fileId
  6047. c.permissionId = permissionId
  6048. c.permission = permission
  6049. return c
  6050. }
  6051. // RemoveExpiration sets the optional parameter "removeExpiration":
  6052. // Whether to remove the expiration date.
  6053. func (c *PermissionsUpdateCall) RemoveExpiration(removeExpiration bool) *PermissionsUpdateCall {
  6054. c.urlParams_.Set("removeExpiration", fmt.Sprint(removeExpiration))
  6055. return c
  6056. }
  6057. // SupportsTeamDrives sets the optional parameter "supportsTeamDrives":
  6058. // Whether the requesting application supports Team Drives.
  6059. func (c *PermissionsUpdateCall) SupportsTeamDrives(supportsTeamDrives bool) *PermissionsUpdateCall {
  6060. c.urlParams_.Set("supportsTeamDrives", fmt.Sprint(supportsTeamDrives))
  6061. return c
  6062. }
  6063. // TransferOwnership sets the optional parameter "transferOwnership":
  6064. // Whether to transfer ownership to the specified user and downgrade the
  6065. // current owner to a writer. This parameter is required as an
  6066. // acknowledgement of the side effect.
  6067. func (c *PermissionsUpdateCall) TransferOwnership(transferOwnership bool) *PermissionsUpdateCall {
  6068. c.urlParams_.Set("transferOwnership", fmt.Sprint(transferOwnership))
  6069. return c
  6070. }
  6071. // UseDomainAdminAccess sets the optional parameter
  6072. // "useDomainAdminAccess": Issue the request as a domain administrator;
  6073. // if set to true, then the requester will be granted access if they are
  6074. // an administrator of the domain to which the item belongs.
  6075. func (c *PermissionsUpdateCall) UseDomainAdminAccess(useDomainAdminAccess bool) *PermissionsUpdateCall {
  6076. c.urlParams_.Set("useDomainAdminAccess", fmt.Sprint(useDomainAdminAccess))
  6077. return c
  6078. }
  6079. // Fields allows partial responses to be retrieved. See
  6080. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  6081. // for more information.
  6082. func (c *PermissionsUpdateCall) Fields(s ...googleapi.Field) *PermissionsUpdateCall {
  6083. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  6084. return c
  6085. }
  6086. // Context sets the context to be used in this call's Do method. Any
  6087. // pending HTTP request will be aborted if the provided context is
  6088. // canceled.
  6089. func (c *PermissionsUpdateCall) Context(ctx context.Context) *PermissionsUpdateCall {
  6090. c.ctx_ = ctx
  6091. return c
  6092. }
  6093. // Header returns an http.Header that can be modified by the caller to
  6094. // add HTTP headers to the request.
  6095. func (c *PermissionsUpdateCall) Header() http.Header {
  6096. if c.header_ == nil {
  6097. c.header_ = make(http.Header)
  6098. }
  6099. return c.header_
  6100. }
  6101. func (c *PermissionsUpdateCall) doRequest(alt string) (*http.Response, error) {
  6102. reqHeaders := make(http.Header)
  6103. for k, v := range c.header_ {
  6104. reqHeaders[k] = v
  6105. }
  6106. reqHeaders.Set("User-Agent", c.s.userAgent())
  6107. var body io.Reader = nil
  6108. body, err := googleapi.WithoutDataWrapper.JSONReader(c.permission)
  6109. if err != nil {
  6110. return nil, err
  6111. }
  6112. reqHeaders.Set("Content-Type", "application/json")
  6113. c.urlParams_.Set("alt", alt)
  6114. c.urlParams_.Set("prettyPrint", "false")
  6115. urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/permissions/{permissionId}")
  6116. urls += "?" + c.urlParams_.Encode()
  6117. req, err := http.NewRequest("PATCH", urls, body)
  6118. if err != nil {
  6119. return nil, err
  6120. }
  6121. req.Header = reqHeaders
  6122. googleapi.Expand(req.URL, map[string]string{
  6123. "fileId": c.fileId,
  6124. "permissionId": c.permissionId,
  6125. })
  6126. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  6127. }
  6128. // Do executes the "drive.permissions.update" call.
  6129. // Exactly one of *Permission or error will be non-nil. Any non-2xx
  6130. // status code is an error. Response headers are in either
  6131. // *Permission.ServerResponse.Header or (if a response was returned at
  6132. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  6133. // to check whether the returned error was because
  6134. // http.StatusNotModified was returned.
  6135. func (c *PermissionsUpdateCall) Do(opts ...googleapi.CallOption) (*Permission, error) {
  6136. gensupport.SetOptions(c.urlParams_, opts...)
  6137. res, err := c.doRequest("json")
  6138. if res != nil && res.StatusCode == http.StatusNotModified {
  6139. if res.Body != nil {
  6140. res.Body.Close()
  6141. }
  6142. return nil, &googleapi.Error{
  6143. Code: res.StatusCode,
  6144. Header: res.Header,
  6145. }
  6146. }
  6147. if err != nil {
  6148. return nil, err
  6149. }
  6150. defer googleapi.CloseBody(res)
  6151. if err := googleapi.CheckResponse(res); err != nil {
  6152. return nil, err
  6153. }
  6154. ret := &Permission{
  6155. ServerResponse: googleapi.ServerResponse{
  6156. Header: res.Header,
  6157. HTTPStatusCode: res.StatusCode,
  6158. },
  6159. }
  6160. target := &ret
  6161. if err := gensupport.DecodeResponse(target, res); err != nil {
  6162. return nil, err
  6163. }
  6164. return ret, nil
  6165. // {
  6166. // "description": "Updates a permission with patch semantics.",
  6167. // "httpMethod": "PATCH",
  6168. // "id": "drive.permissions.update",
  6169. // "parameterOrder": [
  6170. // "fileId",
  6171. // "permissionId"
  6172. // ],
  6173. // "parameters": {
  6174. // "fileId": {
  6175. // "description": "The ID of the file or Team Drive.",
  6176. // "location": "path",
  6177. // "required": true,
  6178. // "type": "string"
  6179. // },
  6180. // "permissionId": {
  6181. // "description": "The ID of the permission.",
  6182. // "location": "path",
  6183. // "required": true,
  6184. // "type": "string"
  6185. // },
  6186. // "removeExpiration": {
  6187. // "default": "false",
  6188. // "description": "Whether to remove the expiration date.",
  6189. // "location": "query",
  6190. // "type": "boolean"
  6191. // },
  6192. // "supportsTeamDrives": {
  6193. // "default": "false",
  6194. // "description": "Whether the requesting application supports Team Drives.",
  6195. // "location": "query",
  6196. // "type": "boolean"
  6197. // },
  6198. // "transferOwnership": {
  6199. // "default": "false",
  6200. // "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.",
  6201. // "location": "query",
  6202. // "type": "boolean"
  6203. // },
  6204. // "useDomainAdminAccess": {
  6205. // "default": "false",
  6206. // "description": "Issue the request as a domain administrator; if set to true, then the requester will be granted access if they are an administrator of the domain to which the item belongs.",
  6207. // "location": "query",
  6208. // "type": "boolean"
  6209. // }
  6210. // },
  6211. // "path": "files/{fileId}/permissions/{permissionId}",
  6212. // "request": {
  6213. // "$ref": "Permission"
  6214. // },
  6215. // "response": {
  6216. // "$ref": "Permission"
  6217. // },
  6218. // "scopes": [
  6219. // "https://www.googleapis.com/auth/drive",
  6220. // "https://www.googleapis.com/auth/drive.file"
  6221. // ]
  6222. // }
  6223. }
  6224. // method id "drive.replies.create":
  6225. type RepliesCreateCall struct {
  6226. s *Service
  6227. fileId string
  6228. commentId string
  6229. reply *Reply
  6230. urlParams_ gensupport.URLParams
  6231. ctx_ context.Context
  6232. header_ http.Header
  6233. }
  6234. // Create: Creates a new reply to a comment.
  6235. func (r *RepliesService) Create(fileId string, commentId string, reply *Reply) *RepliesCreateCall {
  6236. c := &RepliesCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  6237. c.fileId = fileId
  6238. c.commentId = commentId
  6239. c.reply = reply
  6240. return c
  6241. }
  6242. // Fields allows partial responses to be retrieved. See
  6243. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  6244. // for more information.
  6245. func (c *RepliesCreateCall) Fields(s ...googleapi.Field) *RepliesCreateCall {
  6246. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  6247. return c
  6248. }
  6249. // Context sets the context to be used in this call's Do method. Any
  6250. // pending HTTP request will be aborted if the provided context is
  6251. // canceled.
  6252. func (c *RepliesCreateCall) Context(ctx context.Context) *RepliesCreateCall {
  6253. c.ctx_ = ctx
  6254. return c
  6255. }
  6256. // Header returns an http.Header that can be modified by the caller to
  6257. // add HTTP headers to the request.
  6258. func (c *RepliesCreateCall) Header() http.Header {
  6259. if c.header_ == nil {
  6260. c.header_ = make(http.Header)
  6261. }
  6262. return c.header_
  6263. }
  6264. func (c *RepliesCreateCall) doRequest(alt string) (*http.Response, error) {
  6265. reqHeaders := make(http.Header)
  6266. for k, v := range c.header_ {
  6267. reqHeaders[k] = v
  6268. }
  6269. reqHeaders.Set("User-Agent", c.s.userAgent())
  6270. var body io.Reader = nil
  6271. body, err := googleapi.WithoutDataWrapper.JSONReader(c.reply)
  6272. if err != nil {
  6273. return nil, err
  6274. }
  6275. reqHeaders.Set("Content-Type", "application/json")
  6276. c.urlParams_.Set("alt", alt)
  6277. c.urlParams_.Set("prettyPrint", "false")
  6278. urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/comments/{commentId}/replies")
  6279. urls += "?" + c.urlParams_.Encode()
  6280. req, err := http.NewRequest("POST", urls, body)
  6281. if err != nil {
  6282. return nil, err
  6283. }
  6284. req.Header = reqHeaders
  6285. googleapi.Expand(req.URL, map[string]string{
  6286. "fileId": c.fileId,
  6287. "commentId": c.commentId,
  6288. })
  6289. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  6290. }
  6291. // Do executes the "drive.replies.create" call.
  6292. // Exactly one of *Reply or error will be non-nil. Any non-2xx status
  6293. // code is an error. Response headers are in either
  6294. // *Reply.ServerResponse.Header or (if a response was returned at all)
  6295. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  6296. // check whether the returned error was because http.StatusNotModified
  6297. // was returned.
  6298. func (c *RepliesCreateCall) Do(opts ...googleapi.CallOption) (*Reply, error) {
  6299. gensupport.SetOptions(c.urlParams_, opts...)
  6300. res, err := c.doRequest("json")
  6301. if res != nil && res.StatusCode == http.StatusNotModified {
  6302. if res.Body != nil {
  6303. res.Body.Close()
  6304. }
  6305. return nil, &googleapi.Error{
  6306. Code: res.StatusCode,
  6307. Header: res.Header,
  6308. }
  6309. }
  6310. if err != nil {
  6311. return nil, err
  6312. }
  6313. defer googleapi.CloseBody(res)
  6314. if err := googleapi.CheckResponse(res); err != nil {
  6315. return nil, err
  6316. }
  6317. ret := &Reply{
  6318. ServerResponse: googleapi.ServerResponse{
  6319. Header: res.Header,
  6320. HTTPStatusCode: res.StatusCode,
  6321. },
  6322. }
  6323. target := &ret
  6324. if err := gensupport.DecodeResponse(target, res); err != nil {
  6325. return nil, err
  6326. }
  6327. return ret, nil
  6328. // {
  6329. // "description": "Creates a new reply to a comment.",
  6330. // "httpMethod": "POST",
  6331. // "id": "drive.replies.create",
  6332. // "parameterOrder": [
  6333. // "fileId",
  6334. // "commentId"
  6335. // ],
  6336. // "parameters": {
  6337. // "commentId": {
  6338. // "description": "The ID of the comment.",
  6339. // "location": "path",
  6340. // "required": true,
  6341. // "type": "string"
  6342. // },
  6343. // "fileId": {
  6344. // "description": "The ID of the file.",
  6345. // "location": "path",
  6346. // "required": true,
  6347. // "type": "string"
  6348. // }
  6349. // },
  6350. // "path": "files/{fileId}/comments/{commentId}/replies",
  6351. // "request": {
  6352. // "$ref": "Reply"
  6353. // },
  6354. // "response": {
  6355. // "$ref": "Reply"
  6356. // },
  6357. // "scopes": [
  6358. // "https://www.googleapis.com/auth/drive",
  6359. // "https://www.googleapis.com/auth/drive.file"
  6360. // ]
  6361. // }
  6362. }
  6363. // method id "drive.replies.delete":
  6364. type RepliesDeleteCall struct {
  6365. s *Service
  6366. fileId string
  6367. commentId string
  6368. replyId string
  6369. urlParams_ gensupport.URLParams
  6370. ctx_ context.Context
  6371. header_ http.Header
  6372. }
  6373. // Delete: Deletes a reply.
  6374. func (r *RepliesService) Delete(fileId string, commentId string, replyId string) *RepliesDeleteCall {
  6375. c := &RepliesDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  6376. c.fileId = fileId
  6377. c.commentId = commentId
  6378. c.replyId = replyId
  6379. return c
  6380. }
  6381. // Fields allows partial responses to be retrieved. See
  6382. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  6383. // for more information.
  6384. func (c *RepliesDeleteCall) Fields(s ...googleapi.Field) *RepliesDeleteCall {
  6385. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  6386. return c
  6387. }
  6388. // Context sets the context to be used in this call's Do method. Any
  6389. // pending HTTP request will be aborted if the provided context is
  6390. // canceled.
  6391. func (c *RepliesDeleteCall) Context(ctx context.Context) *RepliesDeleteCall {
  6392. c.ctx_ = ctx
  6393. return c
  6394. }
  6395. // Header returns an http.Header that can be modified by the caller to
  6396. // add HTTP headers to the request.
  6397. func (c *RepliesDeleteCall) Header() http.Header {
  6398. if c.header_ == nil {
  6399. c.header_ = make(http.Header)
  6400. }
  6401. return c.header_
  6402. }
  6403. func (c *RepliesDeleteCall) doRequest(alt string) (*http.Response, error) {
  6404. reqHeaders := make(http.Header)
  6405. for k, v := range c.header_ {
  6406. reqHeaders[k] = v
  6407. }
  6408. reqHeaders.Set("User-Agent", c.s.userAgent())
  6409. var body io.Reader = nil
  6410. c.urlParams_.Set("alt", alt)
  6411. c.urlParams_.Set("prettyPrint", "false")
  6412. urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/comments/{commentId}/replies/{replyId}")
  6413. urls += "?" + c.urlParams_.Encode()
  6414. req, err := http.NewRequest("DELETE", urls, body)
  6415. if err != nil {
  6416. return nil, err
  6417. }
  6418. req.Header = reqHeaders
  6419. googleapi.Expand(req.URL, map[string]string{
  6420. "fileId": c.fileId,
  6421. "commentId": c.commentId,
  6422. "replyId": c.replyId,
  6423. })
  6424. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  6425. }
  6426. // Do executes the "drive.replies.delete" call.
  6427. func (c *RepliesDeleteCall) Do(opts ...googleapi.CallOption) error {
  6428. gensupport.SetOptions(c.urlParams_, opts...)
  6429. res, err := c.doRequest("json")
  6430. if err != nil {
  6431. return err
  6432. }
  6433. defer googleapi.CloseBody(res)
  6434. if err := googleapi.CheckResponse(res); err != nil {
  6435. return err
  6436. }
  6437. return nil
  6438. // {
  6439. // "description": "Deletes a reply.",
  6440. // "httpMethod": "DELETE",
  6441. // "id": "drive.replies.delete",
  6442. // "parameterOrder": [
  6443. // "fileId",
  6444. // "commentId",
  6445. // "replyId"
  6446. // ],
  6447. // "parameters": {
  6448. // "commentId": {
  6449. // "description": "The ID of the comment.",
  6450. // "location": "path",
  6451. // "required": true,
  6452. // "type": "string"
  6453. // },
  6454. // "fileId": {
  6455. // "description": "The ID of the file.",
  6456. // "location": "path",
  6457. // "required": true,
  6458. // "type": "string"
  6459. // },
  6460. // "replyId": {
  6461. // "description": "The ID of the reply.",
  6462. // "location": "path",
  6463. // "required": true,
  6464. // "type": "string"
  6465. // }
  6466. // },
  6467. // "path": "files/{fileId}/comments/{commentId}/replies/{replyId}",
  6468. // "scopes": [
  6469. // "https://www.googleapis.com/auth/drive",
  6470. // "https://www.googleapis.com/auth/drive.file"
  6471. // ]
  6472. // }
  6473. }
  6474. // method id "drive.replies.get":
  6475. type RepliesGetCall struct {
  6476. s *Service
  6477. fileId string
  6478. commentId string
  6479. replyId string
  6480. urlParams_ gensupport.URLParams
  6481. ifNoneMatch_ string
  6482. ctx_ context.Context
  6483. header_ http.Header
  6484. }
  6485. // Get: Gets a reply by ID.
  6486. func (r *RepliesService) Get(fileId string, commentId string, replyId string) *RepliesGetCall {
  6487. c := &RepliesGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  6488. c.fileId = fileId
  6489. c.commentId = commentId
  6490. c.replyId = replyId
  6491. return c
  6492. }
  6493. // IncludeDeleted sets the optional parameter "includeDeleted": Whether
  6494. // to return deleted replies. Deleted replies will not include their
  6495. // original content.
  6496. func (c *RepliesGetCall) IncludeDeleted(includeDeleted bool) *RepliesGetCall {
  6497. c.urlParams_.Set("includeDeleted", fmt.Sprint(includeDeleted))
  6498. return c
  6499. }
  6500. // Fields allows partial responses to be retrieved. See
  6501. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  6502. // for more information.
  6503. func (c *RepliesGetCall) Fields(s ...googleapi.Field) *RepliesGetCall {
  6504. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  6505. return c
  6506. }
  6507. // IfNoneMatch sets the optional parameter which makes the operation
  6508. // fail if the object's ETag matches the given value. This is useful for
  6509. // getting updates only after the object has changed since the last
  6510. // request. Use googleapi.IsNotModified to check whether the response
  6511. // error from Do is the result of In-None-Match.
  6512. func (c *RepliesGetCall) IfNoneMatch(entityTag string) *RepliesGetCall {
  6513. c.ifNoneMatch_ = entityTag
  6514. return c
  6515. }
  6516. // Context sets the context to be used in this call's Do method. Any
  6517. // pending HTTP request will be aborted if the provided context is
  6518. // canceled.
  6519. func (c *RepliesGetCall) Context(ctx context.Context) *RepliesGetCall {
  6520. c.ctx_ = ctx
  6521. return c
  6522. }
  6523. // Header returns an http.Header that can be modified by the caller to
  6524. // add HTTP headers to the request.
  6525. func (c *RepliesGetCall) Header() http.Header {
  6526. if c.header_ == nil {
  6527. c.header_ = make(http.Header)
  6528. }
  6529. return c.header_
  6530. }
  6531. func (c *RepliesGetCall) doRequest(alt string) (*http.Response, error) {
  6532. reqHeaders := make(http.Header)
  6533. for k, v := range c.header_ {
  6534. reqHeaders[k] = v
  6535. }
  6536. reqHeaders.Set("User-Agent", c.s.userAgent())
  6537. if c.ifNoneMatch_ != "" {
  6538. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  6539. }
  6540. var body io.Reader = nil
  6541. c.urlParams_.Set("alt", alt)
  6542. c.urlParams_.Set("prettyPrint", "false")
  6543. urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/comments/{commentId}/replies/{replyId}")
  6544. urls += "?" + c.urlParams_.Encode()
  6545. req, err := http.NewRequest("GET", urls, body)
  6546. if err != nil {
  6547. return nil, err
  6548. }
  6549. req.Header = reqHeaders
  6550. googleapi.Expand(req.URL, map[string]string{
  6551. "fileId": c.fileId,
  6552. "commentId": c.commentId,
  6553. "replyId": c.replyId,
  6554. })
  6555. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  6556. }
  6557. // Do executes the "drive.replies.get" call.
  6558. // Exactly one of *Reply or error will be non-nil. Any non-2xx status
  6559. // code is an error. Response headers are in either
  6560. // *Reply.ServerResponse.Header or (if a response was returned at all)
  6561. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  6562. // check whether the returned error was because http.StatusNotModified
  6563. // was returned.
  6564. func (c *RepliesGetCall) Do(opts ...googleapi.CallOption) (*Reply, error) {
  6565. gensupport.SetOptions(c.urlParams_, opts...)
  6566. res, err := c.doRequest("json")
  6567. if res != nil && res.StatusCode == http.StatusNotModified {
  6568. if res.Body != nil {
  6569. res.Body.Close()
  6570. }
  6571. return nil, &googleapi.Error{
  6572. Code: res.StatusCode,
  6573. Header: res.Header,
  6574. }
  6575. }
  6576. if err != nil {
  6577. return nil, err
  6578. }
  6579. defer googleapi.CloseBody(res)
  6580. if err := googleapi.CheckResponse(res); err != nil {
  6581. return nil, err
  6582. }
  6583. ret := &Reply{
  6584. ServerResponse: googleapi.ServerResponse{
  6585. Header: res.Header,
  6586. HTTPStatusCode: res.StatusCode,
  6587. },
  6588. }
  6589. target := &ret
  6590. if err := gensupport.DecodeResponse(target, res); err != nil {
  6591. return nil, err
  6592. }
  6593. return ret, nil
  6594. // {
  6595. // "description": "Gets a reply by ID.",
  6596. // "httpMethod": "GET",
  6597. // "id": "drive.replies.get",
  6598. // "parameterOrder": [
  6599. // "fileId",
  6600. // "commentId",
  6601. // "replyId"
  6602. // ],
  6603. // "parameters": {
  6604. // "commentId": {
  6605. // "description": "The ID of the comment.",
  6606. // "location": "path",
  6607. // "required": true,
  6608. // "type": "string"
  6609. // },
  6610. // "fileId": {
  6611. // "description": "The ID of the file.",
  6612. // "location": "path",
  6613. // "required": true,
  6614. // "type": "string"
  6615. // },
  6616. // "includeDeleted": {
  6617. // "default": "false",
  6618. // "description": "Whether to return deleted replies. Deleted replies will not include their original content.",
  6619. // "location": "query",
  6620. // "type": "boolean"
  6621. // },
  6622. // "replyId": {
  6623. // "description": "The ID of the reply.",
  6624. // "location": "path",
  6625. // "required": true,
  6626. // "type": "string"
  6627. // }
  6628. // },
  6629. // "path": "files/{fileId}/comments/{commentId}/replies/{replyId}",
  6630. // "response": {
  6631. // "$ref": "Reply"
  6632. // },
  6633. // "scopes": [
  6634. // "https://www.googleapis.com/auth/drive",
  6635. // "https://www.googleapis.com/auth/drive.file",
  6636. // "https://www.googleapis.com/auth/drive.readonly"
  6637. // ]
  6638. // }
  6639. }
  6640. // method id "drive.replies.list":
  6641. type RepliesListCall struct {
  6642. s *Service
  6643. fileId string
  6644. commentId string
  6645. urlParams_ gensupport.URLParams
  6646. ifNoneMatch_ string
  6647. ctx_ context.Context
  6648. header_ http.Header
  6649. }
  6650. // List: Lists a comment's replies.
  6651. func (r *RepliesService) List(fileId string, commentId string) *RepliesListCall {
  6652. c := &RepliesListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  6653. c.fileId = fileId
  6654. c.commentId = commentId
  6655. return c
  6656. }
  6657. // IncludeDeleted sets the optional parameter "includeDeleted": Whether
  6658. // to include deleted replies. Deleted replies will not include their
  6659. // original content.
  6660. func (c *RepliesListCall) IncludeDeleted(includeDeleted bool) *RepliesListCall {
  6661. c.urlParams_.Set("includeDeleted", fmt.Sprint(includeDeleted))
  6662. return c
  6663. }
  6664. // PageSize sets the optional parameter "pageSize": The maximum number
  6665. // of replies to return per page.
  6666. func (c *RepliesListCall) PageSize(pageSize int64) *RepliesListCall {
  6667. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  6668. return c
  6669. }
  6670. // PageToken sets the optional parameter "pageToken": The token for
  6671. // continuing a previous list request on the next page. This should be
  6672. // set to the value of 'nextPageToken' from the previous response.
  6673. func (c *RepliesListCall) PageToken(pageToken string) *RepliesListCall {
  6674. c.urlParams_.Set("pageToken", pageToken)
  6675. return c
  6676. }
  6677. // Fields allows partial responses to be retrieved. See
  6678. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  6679. // for more information.
  6680. func (c *RepliesListCall) Fields(s ...googleapi.Field) *RepliesListCall {
  6681. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  6682. return c
  6683. }
  6684. // IfNoneMatch sets the optional parameter which makes the operation
  6685. // fail if the object's ETag matches the given value. This is useful for
  6686. // getting updates only after the object has changed since the last
  6687. // request. Use googleapi.IsNotModified to check whether the response
  6688. // error from Do is the result of In-None-Match.
  6689. func (c *RepliesListCall) IfNoneMatch(entityTag string) *RepliesListCall {
  6690. c.ifNoneMatch_ = entityTag
  6691. return c
  6692. }
  6693. // Context sets the context to be used in this call's Do method. Any
  6694. // pending HTTP request will be aborted if the provided context is
  6695. // canceled.
  6696. func (c *RepliesListCall) Context(ctx context.Context) *RepliesListCall {
  6697. c.ctx_ = ctx
  6698. return c
  6699. }
  6700. // Header returns an http.Header that can be modified by the caller to
  6701. // add HTTP headers to the request.
  6702. func (c *RepliesListCall) Header() http.Header {
  6703. if c.header_ == nil {
  6704. c.header_ = make(http.Header)
  6705. }
  6706. return c.header_
  6707. }
  6708. func (c *RepliesListCall) doRequest(alt string) (*http.Response, error) {
  6709. reqHeaders := make(http.Header)
  6710. for k, v := range c.header_ {
  6711. reqHeaders[k] = v
  6712. }
  6713. reqHeaders.Set("User-Agent", c.s.userAgent())
  6714. if c.ifNoneMatch_ != "" {
  6715. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  6716. }
  6717. var body io.Reader = nil
  6718. c.urlParams_.Set("alt", alt)
  6719. c.urlParams_.Set("prettyPrint", "false")
  6720. urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/comments/{commentId}/replies")
  6721. urls += "?" + c.urlParams_.Encode()
  6722. req, err := http.NewRequest("GET", urls, body)
  6723. if err != nil {
  6724. return nil, err
  6725. }
  6726. req.Header = reqHeaders
  6727. googleapi.Expand(req.URL, map[string]string{
  6728. "fileId": c.fileId,
  6729. "commentId": c.commentId,
  6730. })
  6731. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  6732. }
  6733. // Do executes the "drive.replies.list" call.
  6734. // Exactly one of *ReplyList or error will be non-nil. Any non-2xx
  6735. // status code is an error. Response headers are in either
  6736. // *ReplyList.ServerResponse.Header or (if a response was returned at
  6737. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  6738. // to check whether the returned error was because
  6739. // http.StatusNotModified was returned.
  6740. func (c *RepliesListCall) Do(opts ...googleapi.CallOption) (*ReplyList, error) {
  6741. gensupport.SetOptions(c.urlParams_, opts...)
  6742. res, err := c.doRequest("json")
  6743. if res != nil && res.StatusCode == http.StatusNotModified {
  6744. if res.Body != nil {
  6745. res.Body.Close()
  6746. }
  6747. return nil, &googleapi.Error{
  6748. Code: res.StatusCode,
  6749. Header: res.Header,
  6750. }
  6751. }
  6752. if err != nil {
  6753. return nil, err
  6754. }
  6755. defer googleapi.CloseBody(res)
  6756. if err := googleapi.CheckResponse(res); err != nil {
  6757. return nil, err
  6758. }
  6759. ret := &ReplyList{
  6760. ServerResponse: googleapi.ServerResponse{
  6761. Header: res.Header,
  6762. HTTPStatusCode: res.StatusCode,
  6763. },
  6764. }
  6765. target := &ret
  6766. if err := gensupport.DecodeResponse(target, res); err != nil {
  6767. return nil, err
  6768. }
  6769. return ret, nil
  6770. // {
  6771. // "description": "Lists a comment's replies.",
  6772. // "httpMethod": "GET",
  6773. // "id": "drive.replies.list",
  6774. // "parameterOrder": [
  6775. // "fileId",
  6776. // "commentId"
  6777. // ],
  6778. // "parameters": {
  6779. // "commentId": {
  6780. // "description": "The ID of the comment.",
  6781. // "location": "path",
  6782. // "required": true,
  6783. // "type": "string"
  6784. // },
  6785. // "fileId": {
  6786. // "description": "The ID of the file.",
  6787. // "location": "path",
  6788. // "required": true,
  6789. // "type": "string"
  6790. // },
  6791. // "includeDeleted": {
  6792. // "default": "false",
  6793. // "description": "Whether to include deleted replies. Deleted replies will not include their original content.",
  6794. // "location": "query",
  6795. // "type": "boolean"
  6796. // },
  6797. // "pageSize": {
  6798. // "default": "20",
  6799. // "description": "The maximum number of replies to return per page.",
  6800. // "format": "int32",
  6801. // "location": "query",
  6802. // "maximum": "100",
  6803. // "minimum": "1",
  6804. // "type": "integer"
  6805. // },
  6806. // "pageToken": {
  6807. // "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.",
  6808. // "location": "query",
  6809. // "type": "string"
  6810. // }
  6811. // },
  6812. // "path": "files/{fileId}/comments/{commentId}/replies",
  6813. // "response": {
  6814. // "$ref": "ReplyList"
  6815. // },
  6816. // "scopes": [
  6817. // "https://www.googleapis.com/auth/drive",
  6818. // "https://www.googleapis.com/auth/drive.file",
  6819. // "https://www.googleapis.com/auth/drive.readonly"
  6820. // ]
  6821. // }
  6822. }
  6823. // Pages invokes f for each page of results.
  6824. // A non-nil error returned from f will halt the iteration.
  6825. // The provided context supersedes any context provided to the Context method.
  6826. func (c *RepliesListCall) Pages(ctx context.Context, f func(*ReplyList) error) error {
  6827. c.ctx_ = ctx
  6828. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  6829. for {
  6830. x, err := c.Do()
  6831. if err != nil {
  6832. return err
  6833. }
  6834. if err := f(x); err != nil {
  6835. return err
  6836. }
  6837. if x.NextPageToken == "" {
  6838. return nil
  6839. }
  6840. c.PageToken(x.NextPageToken)
  6841. }
  6842. }
  6843. // method id "drive.replies.update":
  6844. type RepliesUpdateCall struct {
  6845. s *Service
  6846. fileId string
  6847. commentId string
  6848. replyId string
  6849. reply *Reply
  6850. urlParams_ gensupport.URLParams
  6851. ctx_ context.Context
  6852. header_ http.Header
  6853. }
  6854. // Update: Updates a reply with patch semantics.
  6855. func (r *RepliesService) Update(fileId string, commentId string, replyId string, reply *Reply) *RepliesUpdateCall {
  6856. c := &RepliesUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  6857. c.fileId = fileId
  6858. c.commentId = commentId
  6859. c.replyId = replyId
  6860. c.reply = reply
  6861. return c
  6862. }
  6863. // Fields allows partial responses to be retrieved. See
  6864. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  6865. // for more information.
  6866. func (c *RepliesUpdateCall) Fields(s ...googleapi.Field) *RepliesUpdateCall {
  6867. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  6868. return c
  6869. }
  6870. // Context sets the context to be used in this call's Do method. Any
  6871. // pending HTTP request will be aborted if the provided context is
  6872. // canceled.
  6873. func (c *RepliesUpdateCall) Context(ctx context.Context) *RepliesUpdateCall {
  6874. c.ctx_ = ctx
  6875. return c
  6876. }
  6877. // Header returns an http.Header that can be modified by the caller to
  6878. // add HTTP headers to the request.
  6879. func (c *RepliesUpdateCall) Header() http.Header {
  6880. if c.header_ == nil {
  6881. c.header_ = make(http.Header)
  6882. }
  6883. return c.header_
  6884. }
  6885. func (c *RepliesUpdateCall) doRequest(alt string) (*http.Response, error) {
  6886. reqHeaders := make(http.Header)
  6887. for k, v := range c.header_ {
  6888. reqHeaders[k] = v
  6889. }
  6890. reqHeaders.Set("User-Agent", c.s.userAgent())
  6891. var body io.Reader = nil
  6892. body, err := googleapi.WithoutDataWrapper.JSONReader(c.reply)
  6893. if err != nil {
  6894. return nil, err
  6895. }
  6896. reqHeaders.Set("Content-Type", "application/json")
  6897. c.urlParams_.Set("alt", alt)
  6898. c.urlParams_.Set("prettyPrint", "false")
  6899. urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/comments/{commentId}/replies/{replyId}")
  6900. urls += "?" + c.urlParams_.Encode()
  6901. req, err := http.NewRequest("PATCH", urls, body)
  6902. if err != nil {
  6903. return nil, err
  6904. }
  6905. req.Header = reqHeaders
  6906. googleapi.Expand(req.URL, map[string]string{
  6907. "fileId": c.fileId,
  6908. "commentId": c.commentId,
  6909. "replyId": c.replyId,
  6910. })
  6911. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  6912. }
  6913. // Do executes the "drive.replies.update" call.
  6914. // Exactly one of *Reply or error will be non-nil. Any non-2xx status
  6915. // code is an error. Response headers are in either
  6916. // *Reply.ServerResponse.Header or (if a response was returned at all)
  6917. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  6918. // check whether the returned error was because http.StatusNotModified
  6919. // was returned.
  6920. func (c *RepliesUpdateCall) Do(opts ...googleapi.CallOption) (*Reply, error) {
  6921. gensupport.SetOptions(c.urlParams_, opts...)
  6922. res, err := c.doRequest("json")
  6923. if res != nil && res.StatusCode == http.StatusNotModified {
  6924. if res.Body != nil {
  6925. res.Body.Close()
  6926. }
  6927. return nil, &googleapi.Error{
  6928. Code: res.StatusCode,
  6929. Header: res.Header,
  6930. }
  6931. }
  6932. if err != nil {
  6933. return nil, err
  6934. }
  6935. defer googleapi.CloseBody(res)
  6936. if err := googleapi.CheckResponse(res); err != nil {
  6937. return nil, err
  6938. }
  6939. ret := &Reply{
  6940. ServerResponse: googleapi.ServerResponse{
  6941. Header: res.Header,
  6942. HTTPStatusCode: res.StatusCode,
  6943. },
  6944. }
  6945. target := &ret
  6946. if err := gensupport.DecodeResponse(target, res); err != nil {
  6947. return nil, err
  6948. }
  6949. return ret, nil
  6950. // {
  6951. // "description": "Updates a reply with patch semantics.",
  6952. // "httpMethod": "PATCH",
  6953. // "id": "drive.replies.update",
  6954. // "parameterOrder": [
  6955. // "fileId",
  6956. // "commentId",
  6957. // "replyId"
  6958. // ],
  6959. // "parameters": {
  6960. // "commentId": {
  6961. // "description": "The ID of the comment.",
  6962. // "location": "path",
  6963. // "required": true,
  6964. // "type": "string"
  6965. // },
  6966. // "fileId": {
  6967. // "description": "The ID of the file.",
  6968. // "location": "path",
  6969. // "required": true,
  6970. // "type": "string"
  6971. // },
  6972. // "replyId": {
  6973. // "description": "The ID of the reply.",
  6974. // "location": "path",
  6975. // "required": true,
  6976. // "type": "string"
  6977. // }
  6978. // },
  6979. // "path": "files/{fileId}/comments/{commentId}/replies/{replyId}",
  6980. // "request": {
  6981. // "$ref": "Reply"
  6982. // },
  6983. // "response": {
  6984. // "$ref": "Reply"
  6985. // },
  6986. // "scopes": [
  6987. // "https://www.googleapis.com/auth/drive",
  6988. // "https://www.googleapis.com/auth/drive.file"
  6989. // ]
  6990. // }
  6991. }
  6992. // method id "drive.revisions.delete":
  6993. type RevisionsDeleteCall struct {
  6994. s *Service
  6995. fileId string
  6996. revisionId string
  6997. urlParams_ gensupport.URLParams
  6998. ctx_ context.Context
  6999. header_ http.Header
  7000. }
  7001. // Delete: Permanently deletes a file version. You can only delete
  7002. // revisions for files with binary content, like images or videos.
  7003. // Revisions for other files, like Google Docs or Sheets, and the last
  7004. // remaining file version can't be deleted.
  7005. func (r *RevisionsService) Delete(fileId string, revisionId string) *RevisionsDeleteCall {
  7006. c := &RevisionsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  7007. c.fileId = fileId
  7008. c.revisionId = revisionId
  7009. return c
  7010. }
  7011. // Fields allows partial responses to be retrieved. See
  7012. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  7013. // for more information.
  7014. func (c *RevisionsDeleteCall) Fields(s ...googleapi.Field) *RevisionsDeleteCall {
  7015. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  7016. return c
  7017. }
  7018. // Context sets the context to be used in this call's Do method. Any
  7019. // pending HTTP request will be aborted if the provided context is
  7020. // canceled.
  7021. func (c *RevisionsDeleteCall) Context(ctx context.Context) *RevisionsDeleteCall {
  7022. c.ctx_ = ctx
  7023. return c
  7024. }
  7025. // Header returns an http.Header that can be modified by the caller to
  7026. // add HTTP headers to the request.
  7027. func (c *RevisionsDeleteCall) Header() http.Header {
  7028. if c.header_ == nil {
  7029. c.header_ = make(http.Header)
  7030. }
  7031. return c.header_
  7032. }
  7033. func (c *RevisionsDeleteCall) doRequest(alt string) (*http.Response, error) {
  7034. reqHeaders := make(http.Header)
  7035. for k, v := range c.header_ {
  7036. reqHeaders[k] = v
  7037. }
  7038. reqHeaders.Set("User-Agent", c.s.userAgent())
  7039. var body io.Reader = nil
  7040. c.urlParams_.Set("alt", alt)
  7041. c.urlParams_.Set("prettyPrint", "false")
  7042. urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/revisions/{revisionId}")
  7043. urls += "?" + c.urlParams_.Encode()
  7044. req, err := http.NewRequest("DELETE", urls, body)
  7045. if err != nil {
  7046. return nil, err
  7047. }
  7048. req.Header = reqHeaders
  7049. googleapi.Expand(req.URL, map[string]string{
  7050. "fileId": c.fileId,
  7051. "revisionId": c.revisionId,
  7052. })
  7053. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  7054. }
  7055. // Do executes the "drive.revisions.delete" call.
  7056. func (c *RevisionsDeleteCall) Do(opts ...googleapi.CallOption) error {
  7057. gensupport.SetOptions(c.urlParams_, opts...)
  7058. res, err := c.doRequest("json")
  7059. if err != nil {
  7060. return err
  7061. }
  7062. defer googleapi.CloseBody(res)
  7063. if err := googleapi.CheckResponse(res); err != nil {
  7064. return err
  7065. }
  7066. return nil
  7067. // {
  7068. // "description": "Permanently deletes a file version. You can only delete revisions for files with binary content, like images or videos. Revisions for other files, like Google Docs or Sheets, and the last remaining file version can't be deleted.",
  7069. // "httpMethod": "DELETE",
  7070. // "id": "drive.revisions.delete",
  7071. // "parameterOrder": [
  7072. // "fileId",
  7073. // "revisionId"
  7074. // ],
  7075. // "parameters": {
  7076. // "fileId": {
  7077. // "description": "The ID of the file.",
  7078. // "location": "path",
  7079. // "required": true,
  7080. // "type": "string"
  7081. // },
  7082. // "revisionId": {
  7083. // "description": "The ID of the revision.",
  7084. // "location": "path",
  7085. // "required": true,
  7086. // "type": "string"
  7087. // }
  7088. // },
  7089. // "path": "files/{fileId}/revisions/{revisionId}",
  7090. // "scopes": [
  7091. // "https://www.googleapis.com/auth/drive",
  7092. // "https://www.googleapis.com/auth/drive.appdata",
  7093. // "https://www.googleapis.com/auth/drive.file"
  7094. // ]
  7095. // }
  7096. }
  7097. // method id "drive.revisions.get":
  7098. type RevisionsGetCall struct {
  7099. s *Service
  7100. fileId string
  7101. revisionId string
  7102. urlParams_ gensupport.URLParams
  7103. ifNoneMatch_ string
  7104. ctx_ context.Context
  7105. header_ http.Header
  7106. }
  7107. // Get: Gets a revision's metadata or content by ID.
  7108. func (r *RevisionsService) Get(fileId string, revisionId string) *RevisionsGetCall {
  7109. c := &RevisionsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  7110. c.fileId = fileId
  7111. c.revisionId = revisionId
  7112. return c
  7113. }
  7114. // AcknowledgeAbuse sets the optional parameter "acknowledgeAbuse":
  7115. // Whether the user is acknowledging the risk of downloading known
  7116. // malware or other abusive files. This is only applicable when
  7117. // alt=media.
  7118. func (c *RevisionsGetCall) AcknowledgeAbuse(acknowledgeAbuse bool) *RevisionsGetCall {
  7119. c.urlParams_.Set("acknowledgeAbuse", fmt.Sprint(acknowledgeAbuse))
  7120. return c
  7121. }
  7122. // Fields allows partial responses to be retrieved. See
  7123. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  7124. // for more information.
  7125. func (c *RevisionsGetCall) Fields(s ...googleapi.Field) *RevisionsGetCall {
  7126. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  7127. return c
  7128. }
  7129. // IfNoneMatch sets the optional parameter which makes the operation
  7130. // fail if the object's ETag matches the given value. This is useful for
  7131. // getting updates only after the object has changed since the last
  7132. // request. Use googleapi.IsNotModified to check whether the response
  7133. // error from Do is the result of In-None-Match.
  7134. func (c *RevisionsGetCall) IfNoneMatch(entityTag string) *RevisionsGetCall {
  7135. c.ifNoneMatch_ = entityTag
  7136. return c
  7137. }
  7138. // Context sets the context to be used in this call's Do and Download
  7139. // methods. Any pending HTTP request will be aborted if the provided
  7140. // context is canceled.
  7141. func (c *RevisionsGetCall) Context(ctx context.Context) *RevisionsGetCall {
  7142. c.ctx_ = ctx
  7143. return c
  7144. }
  7145. // Header returns an http.Header that can be modified by the caller to
  7146. // add HTTP headers to the request.
  7147. func (c *RevisionsGetCall) Header() http.Header {
  7148. if c.header_ == nil {
  7149. c.header_ = make(http.Header)
  7150. }
  7151. return c.header_
  7152. }
  7153. func (c *RevisionsGetCall) doRequest(alt string) (*http.Response, error) {
  7154. reqHeaders := make(http.Header)
  7155. for k, v := range c.header_ {
  7156. reqHeaders[k] = v
  7157. }
  7158. reqHeaders.Set("User-Agent", c.s.userAgent())
  7159. if c.ifNoneMatch_ != "" {
  7160. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  7161. }
  7162. var body io.Reader = nil
  7163. c.urlParams_.Set("alt", alt)
  7164. c.urlParams_.Set("prettyPrint", "false")
  7165. urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/revisions/{revisionId}")
  7166. urls += "?" + c.urlParams_.Encode()
  7167. req, err := http.NewRequest("GET", urls, body)
  7168. if err != nil {
  7169. return nil, err
  7170. }
  7171. req.Header = reqHeaders
  7172. googleapi.Expand(req.URL, map[string]string{
  7173. "fileId": c.fileId,
  7174. "revisionId": c.revisionId,
  7175. })
  7176. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  7177. }
  7178. // Download fetches the API endpoint's "media" value, instead of the normal
  7179. // API response value. If the returned error is nil, the Response is guaranteed to
  7180. // have a 2xx status code. Callers must close the Response.Body as usual.
  7181. func (c *RevisionsGetCall) Download(opts ...googleapi.CallOption) (*http.Response, error) {
  7182. gensupport.SetOptions(c.urlParams_, opts...)
  7183. res, err := c.doRequest("media")
  7184. if err != nil {
  7185. return nil, err
  7186. }
  7187. if err := googleapi.CheckMediaResponse(res); err != nil {
  7188. res.Body.Close()
  7189. return nil, err
  7190. }
  7191. return res, nil
  7192. }
  7193. // Do executes the "drive.revisions.get" call.
  7194. // Exactly one of *Revision or error will be non-nil. Any non-2xx status
  7195. // code is an error. Response headers are in either
  7196. // *Revision.ServerResponse.Header or (if a response was returned at
  7197. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  7198. // to check whether the returned error was because
  7199. // http.StatusNotModified was returned.
  7200. func (c *RevisionsGetCall) Do(opts ...googleapi.CallOption) (*Revision, error) {
  7201. gensupport.SetOptions(c.urlParams_, opts...)
  7202. res, err := c.doRequest("json")
  7203. if res != nil && res.StatusCode == http.StatusNotModified {
  7204. if res.Body != nil {
  7205. res.Body.Close()
  7206. }
  7207. return nil, &googleapi.Error{
  7208. Code: res.StatusCode,
  7209. Header: res.Header,
  7210. }
  7211. }
  7212. if err != nil {
  7213. return nil, err
  7214. }
  7215. defer googleapi.CloseBody(res)
  7216. if err := googleapi.CheckResponse(res); err != nil {
  7217. return nil, err
  7218. }
  7219. ret := &Revision{
  7220. ServerResponse: googleapi.ServerResponse{
  7221. Header: res.Header,
  7222. HTTPStatusCode: res.StatusCode,
  7223. },
  7224. }
  7225. target := &ret
  7226. if err := gensupport.DecodeResponse(target, res); err != nil {
  7227. return nil, err
  7228. }
  7229. return ret, nil
  7230. // {
  7231. // "description": "Gets a revision's metadata or content by ID.",
  7232. // "httpMethod": "GET",
  7233. // "id": "drive.revisions.get",
  7234. // "parameterOrder": [
  7235. // "fileId",
  7236. // "revisionId"
  7237. // ],
  7238. // "parameters": {
  7239. // "acknowledgeAbuse": {
  7240. // "default": "false",
  7241. // "description": "Whether the user is acknowledging the risk of downloading known malware or other abusive files. This is only applicable when alt=media.",
  7242. // "location": "query",
  7243. // "type": "boolean"
  7244. // },
  7245. // "fileId": {
  7246. // "description": "The ID of the file.",
  7247. // "location": "path",
  7248. // "required": true,
  7249. // "type": "string"
  7250. // },
  7251. // "revisionId": {
  7252. // "description": "The ID of the revision.",
  7253. // "location": "path",
  7254. // "required": true,
  7255. // "type": "string"
  7256. // }
  7257. // },
  7258. // "path": "files/{fileId}/revisions/{revisionId}",
  7259. // "response": {
  7260. // "$ref": "Revision"
  7261. // },
  7262. // "scopes": [
  7263. // "https://www.googleapis.com/auth/drive",
  7264. // "https://www.googleapis.com/auth/drive.appdata",
  7265. // "https://www.googleapis.com/auth/drive.file",
  7266. // "https://www.googleapis.com/auth/drive.metadata",
  7267. // "https://www.googleapis.com/auth/drive.metadata.readonly",
  7268. // "https://www.googleapis.com/auth/drive.photos.readonly",
  7269. // "https://www.googleapis.com/auth/drive.readonly"
  7270. // ],
  7271. // "supportsMediaDownload": true,
  7272. // "useMediaDownloadService": true
  7273. // }
  7274. }
  7275. // method id "drive.revisions.list":
  7276. type RevisionsListCall struct {
  7277. s *Service
  7278. fileId string
  7279. urlParams_ gensupport.URLParams
  7280. ifNoneMatch_ string
  7281. ctx_ context.Context
  7282. header_ http.Header
  7283. }
  7284. // List: Lists a file's revisions.
  7285. func (r *RevisionsService) List(fileId string) *RevisionsListCall {
  7286. c := &RevisionsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  7287. c.fileId = fileId
  7288. return c
  7289. }
  7290. // PageSize sets the optional parameter "pageSize": The maximum number
  7291. // of revisions to return per page.
  7292. func (c *RevisionsListCall) PageSize(pageSize int64) *RevisionsListCall {
  7293. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  7294. return c
  7295. }
  7296. // PageToken sets the optional parameter "pageToken": The token for
  7297. // continuing a previous list request on the next page. This should be
  7298. // set to the value of 'nextPageToken' from the previous response.
  7299. func (c *RevisionsListCall) PageToken(pageToken string) *RevisionsListCall {
  7300. c.urlParams_.Set("pageToken", pageToken)
  7301. return c
  7302. }
  7303. // Fields allows partial responses to be retrieved. See
  7304. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  7305. // for more information.
  7306. func (c *RevisionsListCall) Fields(s ...googleapi.Field) *RevisionsListCall {
  7307. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  7308. return c
  7309. }
  7310. // IfNoneMatch sets the optional parameter which makes the operation
  7311. // fail if the object's ETag matches the given value. This is useful for
  7312. // getting updates only after the object has changed since the last
  7313. // request. Use googleapi.IsNotModified to check whether the response
  7314. // error from Do is the result of In-None-Match.
  7315. func (c *RevisionsListCall) IfNoneMatch(entityTag string) *RevisionsListCall {
  7316. c.ifNoneMatch_ = entityTag
  7317. return c
  7318. }
  7319. // Context sets the context to be used in this call's Do method. Any
  7320. // pending HTTP request will be aborted if the provided context is
  7321. // canceled.
  7322. func (c *RevisionsListCall) Context(ctx context.Context) *RevisionsListCall {
  7323. c.ctx_ = ctx
  7324. return c
  7325. }
  7326. // Header returns an http.Header that can be modified by the caller to
  7327. // add HTTP headers to the request.
  7328. func (c *RevisionsListCall) Header() http.Header {
  7329. if c.header_ == nil {
  7330. c.header_ = make(http.Header)
  7331. }
  7332. return c.header_
  7333. }
  7334. func (c *RevisionsListCall) doRequest(alt string) (*http.Response, error) {
  7335. reqHeaders := make(http.Header)
  7336. for k, v := range c.header_ {
  7337. reqHeaders[k] = v
  7338. }
  7339. reqHeaders.Set("User-Agent", c.s.userAgent())
  7340. if c.ifNoneMatch_ != "" {
  7341. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  7342. }
  7343. var body io.Reader = nil
  7344. c.urlParams_.Set("alt", alt)
  7345. c.urlParams_.Set("prettyPrint", "false")
  7346. urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/revisions")
  7347. urls += "?" + c.urlParams_.Encode()
  7348. req, err := http.NewRequest("GET", urls, body)
  7349. if err != nil {
  7350. return nil, err
  7351. }
  7352. req.Header = reqHeaders
  7353. googleapi.Expand(req.URL, map[string]string{
  7354. "fileId": c.fileId,
  7355. })
  7356. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  7357. }
  7358. // Do executes the "drive.revisions.list" call.
  7359. // Exactly one of *RevisionList or error will be non-nil. Any non-2xx
  7360. // status code is an error. Response headers are in either
  7361. // *RevisionList.ServerResponse.Header or (if a response was returned at
  7362. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  7363. // to check whether the returned error was because
  7364. // http.StatusNotModified was returned.
  7365. func (c *RevisionsListCall) Do(opts ...googleapi.CallOption) (*RevisionList, error) {
  7366. gensupport.SetOptions(c.urlParams_, opts...)
  7367. res, err := c.doRequest("json")
  7368. if res != nil && res.StatusCode == http.StatusNotModified {
  7369. if res.Body != nil {
  7370. res.Body.Close()
  7371. }
  7372. return nil, &googleapi.Error{
  7373. Code: res.StatusCode,
  7374. Header: res.Header,
  7375. }
  7376. }
  7377. if err != nil {
  7378. return nil, err
  7379. }
  7380. defer googleapi.CloseBody(res)
  7381. if err := googleapi.CheckResponse(res); err != nil {
  7382. return nil, err
  7383. }
  7384. ret := &RevisionList{
  7385. ServerResponse: googleapi.ServerResponse{
  7386. Header: res.Header,
  7387. HTTPStatusCode: res.StatusCode,
  7388. },
  7389. }
  7390. target := &ret
  7391. if err := gensupport.DecodeResponse(target, res); err != nil {
  7392. return nil, err
  7393. }
  7394. return ret, nil
  7395. // {
  7396. // "description": "Lists a file's revisions.",
  7397. // "httpMethod": "GET",
  7398. // "id": "drive.revisions.list",
  7399. // "parameterOrder": [
  7400. // "fileId"
  7401. // ],
  7402. // "parameters": {
  7403. // "fileId": {
  7404. // "description": "The ID of the file.",
  7405. // "location": "path",
  7406. // "required": true,
  7407. // "type": "string"
  7408. // },
  7409. // "pageSize": {
  7410. // "default": "200",
  7411. // "description": "The maximum number of revisions to return per page.",
  7412. // "format": "int32",
  7413. // "location": "query",
  7414. // "maximum": "1000",
  7415. // "minimum": "1",
  7416. // "type": "integer"
  7417. // },
  7418. // "pageToken": {
  7419. // "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.",
  7420. // "location": "query",
  7421. // "type": "string"
  7422. // }
  7423. // },
  7424. // "path": "files/{fileId}/revisions",
  7425. // "response": {
  7426. // "$ref": "RevisionList"
  7427. // },
  7428. // "scopes": [
  7429. // "https://www.googleapis.com/auth/drive",
  7430. // "https://www.googleapis.com/auth/drive.appdata",
  7431. // "https://www.googleapis.com/auth/drive.file",
  7432. // "https://www.googleapis.com/auth/drive.metadata",
  7433. // "https://www.googleapis.com/auth/drive.metadata.readonly",
  7434. // "https://www.googleapis.com/auth/drive.photos.readonly",
  7435. // "https://www.googleapis.com/auth/drive.readonly"
  7436. // ]
  7437. // }
  7438. }
  7439. // Pages invokes f for each page of results.
  7440. // A non-nil error returned from f will halt the iteration.
  7441. // The provided context supersedes any context provided to the Context method.
  7442. func (c *RevisionsListCall) Pages(ctx context.Context, f func(*RevisionList) error) error {
  7443. c.ctx_ = ctx
  7444. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  7445. for {
  7446. x, err := c.Do()
  7447. if err != nil {
  7448. return err
  7449. }
  7450. if err := f(x); err != nil {
  7451. return err
  7452. }
  7453. if x.NextPageToken == "" {
  7454. return nil
  7455. }
  7456. c.PageToken(x.NextPageToken)
  7457. }
  7458. }
  7459. // method id "drive.revisions.update":
  7460. type RevisionsUpdateCall struct {
  7461. s *Service
  7462. fileId string
  7463. revisionId string
  7464. revision *Revision
  7465. urlParams_ gensupport.URLParams
  7466. ctx_ context.Context
  7467. header_ http.Header
  7468. }
  7469. // Update: Updates a revision with patch semantics.
  7470. func (r *RevisionsService) Update(fileId string, revisionId string, revision *Revision) *RevisionsUpdateCall {
  7471. c := &RevisionsUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  7472. c.fileId = fileId
  7473. c.revisionId = revisionId
  7474. c.revision = revision
  7475. return c
  7476. }
  7477. // Fields allows partial responses to be retrieved. See
  7478. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  7479. // for more information.
  7480. func (c *RevisionsUpdateCall) Fields(s ...googleapi.Field) *RevisionsUpdateCall {
  7481. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  7482. return c
  7483. }
  7484. // Context sets the context to be used in this call's Do method. Any
  7485. // pending HTTP request will be aborted if the provided context is
  7486. // canceled.
  7487. func (c *RevisionsUpdateCall) Context(ctx context.Context) *RevisionsUpdateCall {
  7488. c.ctx_ = ctx
  7489. return c
  7490. }
  7491. // Header returns an http.Header that can be modified by the caller to
  7492. // add HTTP headers to the request.
  7493. func (c *RevisionsUpdateCall) Header() http.Header {
  7494. if c.header_ == nil {
  7495. c.header_ = make(http.Header)
  7496. }
  7497. return c.header_
  7498. }
  7499. func (c *RevisionsUpdateCall) doRequest(alt string) (*http.Response, error) {
  7500. reqHeaders := make(http.Header)
  7501. for k, v := range c.header_ {
  7502. reqHeaders[k] = v
  7503. }
  7504. reqHeaders.Set("User-Agent", c.s.userAgent())
  7505. var body io.Reader = nil
  7506. body, err := googleapi.WithoutDataWrapper.JSONReader(c.revision)
  7507. if err != nil {
  7508. return nil, err
  7509. }
  7510. reqHeaders.Set("Content-Type", "application/json")
  7511. c.urlParams_.Set("alt", alt)
  7512. c.urlParams_.Set("prettyPrint", "false")
  7513. urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/revisions/{revisionId}")
  7514. urls += "?" + c.urlParams_.Encode()
  7515. req, err := http.NewRequest("PATCH", urls, body)
  7516. if err != nil {
  7517. return nil, err
  7518. }
  7519. req.Header = reqHeaders
  7520. googleapi.Expand(req.URL, map[string]string{
  7521. "fileId": c.fileId,
  7522. "revisionId": c.revisionId,
  7523. })
  7524. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  7525. }
  7526. // Do executes the "drive.revisions.update" call.
  7527. // Exactly one of *Revision or error will be non-nil. Any non-2xx status
  7528. // code is an error. Response headers are in either
  7529. // *Revision.ServerResponse.Header or (if a response was returned at
  7530. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  7531. // to check whether the returned error was because
  7532. // http.StatusNotModified was returned.
  7533. func (c *RevisionsUpdateCall) Do(opts ...googleapi.CallOption) (*Revision, error) {
  7534. gensupport.SetOptions(c.urlParams_, opts...)
  7535. res, err := c.doRequest("json")
  7536. if res != nil && res.StatusCode == http.StatusNotModified {
  7537. if res.Body != nil {
  7538. res.Body.Close()
  7539. }
  7540. return nil, &googleapi.Error{
  7541. Code: res.StatusCode,
  7542. Header: res.Header,
  7543. }
  7544. }
  7545. if err != nil {
  7546. return nil, err
  7547. }
  7548. defer googleapi.CloseBody(res)
  7549. if err := googleapi.CheckResponse(res); err != nil {
  7550. return nil, err
  7551. }
  7552. ret := &Revision{
  7553. ServerResponse: googleapi.ServerResponse{
  7554. Header: res.Header,
  7555. HTTPStatusCode: res.StatusCode,
  7556. },
  7557. }
  7558. target := &ret
  7559. if err := gensupport.DecodeResponse(target, res); err != nil {
  7560. return nil, err
  7561. }
  7562. return ret, nil
  7563. // {
  7564. // "description": "Updates a revision with patch semantics.",
  7565. // "httpMethod": "PATCH",
  7566. // "id": "drive.revisions.update",
  7567. // "parameterOrder": [
  7568. // "fileId",
  7569. // "revisionId"
  7570. // ],
  7571. // "parameters": {
  7572. // "fileId": {
  7573. // "description": "The ID of the file.",
  7574. // "location": "path",
  7575. // "required": true,
  7576. // "type": "string"
  7577. // },
  7578. // "revisionId": {
  7579. // "description": "The ID of the revision.",
  7580. // "location": "path",
  7581. // "required": true,
  7582. // "type": "string"
  7583. // }
  7584. // },
  7585. // "path": "files/{fileId}/revisions/{revisionId}",
  7586. // "request": {
  7587. // "$ref": "Revision"
  7588. // },
  7589. // "response": {
  7590. // "$ref": "Revision"
  7591. // },
  7592. // "scopes": [
  7593. // "https://www.googleapis.com/auth/drive",
  7594. // "https://www.googleapis.com/auth/drive.appdata",
  7595. // "https://www.googleapis.com/auth/drive.file"
  7596. // ]
  7597. // }
  7598. }
  7599. // method id "drive.teamdrives.create":
  7600. type TeamdrivesCreateCall struct {
  7601. s *Service
  7602. teamdrive *TeamDrive
  7603. urlParams_ gensupport.URLParams
  7604. ctx_ context.Context
  7605. header_ http.Header
  7606. }
  7607. // Create: Creates a new Team Drive.
  7608. func (r *TeamdrivesService) Create(requestId string, teamdrive *TeamDrive) *TeamdrivesCreateCall {
  7609. c := &TeamdrivesCreateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  7610. c.urlParams_.Set("requestId", requestId)
  7611. c.teamdrive = teamdrive
  7612. return c
  7613. }
  7614. // Fields allows partial responses to be retrieved. See
  7615. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  7616. // for more information.
  7617. func (c *TeamdrivesCreateCall) Fields(s ...googleapi.Field) *TeamdrivesCreateCall {
  7618. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  7619. return c
  7620. }
  7621. // Context sets the context to be used in this call's Do method. Any
  7622. // pending HTTP request will be aborted if the provided context is
  7623. // canceled.
  7624. func (c *TeamdrivesCreateCall) Context(ctx context.Context) *TeamdrivesCreateCall {
  7625. c.ctx_ = ctx
  7626. return c
  7627. }
  7628. // Header returns an http.Header that can be modified by the caller to
  7629. // add HTTP headers to the request.
  7630. func (c *TeamdrivesCreateCall) Header() http.Header {
  7631. if c.header_ == nil {
  7632. c.header_ = make(http.Header)
  7633. }
  7634. return c.header_
  7635. }
  7636. func (c *TeamdrivesCreateCall) doRequest(alt string) (*http.Response, error) {
  7637. reqHeaders := make(http.Header)
  7638. for k, v := range c.header_ {
  7639. reqHeaders[k] = v
  7640. }
  7641. reqHeaders.Set("User-Agent", c.s.userAgent())
  7642. var body io.Reader = nil
  7643. body, err := googleapi.WithoutDataWrapper.JSONReader(c.teamdrive)
  7644. if err != nil {
  7645. return nil, err
  7646. }
  7647. reqHeaders.Set("Content-Type", "application/json")
  7648. c.urlParams_.Set("alt", alt)
  7649. c.urlParams_.Set("prettyPrint", "false")
  7650. urls := googleapi.ResolveRelative(c.s.BasePath, "teamdrives")
  7651. urls += "?" + c.urlParams_.Encode()
  7652. req, err := http.NewRequest("POST", urls, body)
  7653. if err != nil {
  7654. return nil, err
  7655. }
  7656. req.Header = reqHeaders
  7657. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  7658. }
  7659. // Do executes the "drive.teamdrives.create" call.
  7660. // Exactly one of *TeamDrive or error will be non-nil. Any non-2xx
  7661. // status code is an error. Response headers are in either
  7662. // *TeamDrive.ServerResponse.Header or (if a response was returned at
  7663. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  7664. // to check whether the returned error was because
  7665. // http.StatusNotModified was returned.
  7666. func (c *TeamdrivesCreateCall) Do(opts ...googleapi.CallOption) (*TeamDrive, error) {
  7667. gensupport.SetOptions(c.urlParams_, opts...)
  7668. res, err := c.doRequest("json")
  7669. if res != nil && res.StatusCode == http.StatusNotModified {
  7670. if res.Body != nil {
  7671. res.Body.Close()
  7672. }
  7673. return nil, &googleapi.Error{
  7674. Code: res.StatusCode,
  7675. Header: res.Header,
  7676. }
  7677. }
  7678. if err != nil {
  7679. return nil, err
  7680. }
  7681. defer googleapi.CloseBody(res)
  7682. if err := googleapi.CheckResponse(res); err != nil {
  7683. return nil, err
  7684. }
  7685. ret := &TeamDrive{
  7686. ServerResponse: googleapi.ServerResponse{
  7687. Header: res.Header,
  7688. HTTPStatusCode: res.StatusCode,
  7689. },
  7690. }
  7691. target := &ret
  7692. if err := gensupport.DecodeResponse(target, res); err != nil {
  7693. return nil, err
  7694. }
  7695. return ret, nil
  7696. // {
  7697. // "description": "Creates a new Team Drive.",
  7698. // "httpMethod": "POST",
  7699. // "id": "drive.teamdrives.create",
  7700. // "parameterOrder": [
  7701. // "requestId"
  7702. // ],
  7703. // "parameters": {
  7704. // "requestId": {
  7705. // "description": "An ID, such as a random UUID, which uniquely identifies this user's request for idempotent creation of a Team Drive. A repeated request by the same user and with the same request ID will avoid creating duplicates by attempting to create the same Team Drive. If the Team Drive already exists a 409 error will be returned.",
  7706. // "location": "query",
  7707. // "required": true,
  7708. // "type": "string"
  7709. // }
  7710. // },
  7711. // "path": "teamdrives",
  7712. // "request": {
  7713. // "$ref": "TeamDrive"
  7714. // },
  7715. // "response": {
  7716. // "$ref": "TeamDrive"
  7717. // },
  7718. // "scopes": [
  7719. // "https://www.googleapis.com/auth/drive"
  7720. // ]
  7721. // }
  7722. }
  7723. // method id "drive.teamdrives.delete":
  7724. type TeamdrivesDeleteCall struct {
  7725. s *Service
  7726. teamDriveId string
  7727. urlParams_ gensupport.URLParams
  7728. ctx_ context.Context
  7729. header_ http.Header
  7730. }
  7731. // Delete: Permanently deletes a Team Drive for which the user is an
  7732. // organizer. The Team Drive cannot contain any untrashed items.
  7733. func (r *TeamdrivesService) Delete(teamDriveId string) *TeamdrivesDeleteCall {
  7734. c := &TeamdrivesDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  7735. c.teamDriveId = teamDriveId
  7736. return c
  7737. }
  7738. // Fields allows partial responses to be retrieved. See
  7739. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  7740. // for more information.
  7741. func (c *TeamdrivesDeleteCall) Fields(s ...googleapi.Field) *TeamdrivesDeleteCall {
  7742. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  7743. return c
  7744. }
  7745. // Context sets the context to be used in this call's Do method. Any
  7746. // pending HTTP request will be aborted if the provided context is
  7747. // canceled.
  7748. func (c *TeamdrivesDeleteCall) Context(ctx context.Context) *TeamdrivesDeleteCall {
  7749. c.ctx_ = ctx
  7750. return c
  7751. }
  7752. // Header returns an http.Header that can be modified by the caller to
  7753. // add HTTP headers to the request.
  7754. func (c *TeamdrivesDeleteCall) Header() http.Header {
  7755. if c.header_ == nil {
  7756. c.header_ = make(http.Header)
  7757. }
  7758. return c.header_
  7759. }
  7760. func (c *TeamdrivesDeleteCall) doRequest(alt string) (*http.Response, error) {
  7761. reqHeaders := make(http.Header)
  7762. for k, v := range c.header_ {
  7763. reqHeaders[k] = v
  7764. }
  7765. reqHeaders.Set("User-Agent", c.s.userAgent())
  7766. var body io.Reader = nil
  7767. c.urlParams_.Set("alt", alt)
  7768. c.urlParams_.Set("prettyPrint", "false")
  7769. urls := googleapi.ResolveRelative(c.s.BasePath, "teamdrives/{teamDriveId}")
  7770. urls += "?" + c.urlParams_.Encode()
  7771. req, err := http.NewRequest("DELETE", urls, body)
  7772. if err != nil {
  7773. return nil, err
  7774. }
  7775. req.Header = reqHeaders
  7776. googleapi.Expand(req.URL, map[string]string{
  7777. "teamDriveId": c.teamDriveId,
  7778. })
  7779. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  7780. }
  7781. // Do executes the "drive.teamdrives.delete" call.
  7782. func (c *TeamdrivesDeleteCall) Do(opts ...googleapi.CallOption) error {
  7783. gensupport.SetOptions(c.urlParams_, opts...)
  7784. res, err := c.doRequest("json")
  7785. if err != nil {
  7786. return err
  7787. }
  7788. defer googleapi.CloseBody(res)
  7789. if err := googleapi.CheckResponse(res); err != nil {
  7790. return err
  7791. }
  7792. return nil
  7793. // {
  7794. // "description": "Permanently deletes a Team Drive for which the user is an organizer. The Team Drive cannot contain any untrashed items.",
  7795. // "httpMethod": "DELETE",
  7796. // "id": "drive.teamdrives.delete",
  7797. // "parameterOrder": [
  7798. // "teamDriveId"
  7799. // ],
  7800. // "parameters": {
  7801. // "teamDriveId": {
  7802. // "description": "The ID of the Team Drive",
  7803. // "location": "path",
  7804. // "required": true,
  7805. // "type": "string"
  7806. // }
  7807. // },
  7808. // "path": "teamdrives/{teamDriveId}",
  7809. // "scopes": [
  7810. // "https://www.googleapis.com/auth/drive"
  7811. // ]
  7812. // }
  7813. }
  7814. // method id "drive.teamdrives.get":
  7815. type TeamdrivesGetCall struct {
  7816. s *Service
  7817. teamDriveId string
  7818. urlParams_ gensupport.URLParams
  7819. ifNoneMatch_ string
  7820. ctx_ context.Context
  7821. header_ http.Header
  7822. }
  7823. // Get: Gets a Team Drive's metadata by ID.
  7824. func (r *TeamdrivesService) Get(teamDriveId string) *TeamdrivesGetCall {
  7825. c := &TeamdrivesGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  7826. c.teamDriveId = teamDriveId
  7827. return c
  7828. }
  7829. // UseDomainAdminAccess sets the optional parameter
  7830. // "useDomainAdminAccess": Issue the request as a domain administrator;
  7831. // if set to true, then the requester will be granted access if they are
  7832. // an administrator of the domain to which the Team Drive belongs.
  7833. func (c *TeamdrivesGetCall) UseDomainAdminAccess(useDomainAdminAccess bool) *TeamdrivesGetCall {
  7834. c.urlParams_.Set("useDomainAdminAccess", fmt.Sprint(useDomainAdminAccess))
  7835. return c
  7836. }
  7837. // Fields allows partial responses to be retrieved. See
  7838. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  7839. // for more information.
  7840. func (c *TeamdrivesGetCall) Fields(s ...googleapi.Field) *TeamdrivesGetCall {
  7841. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  7842. return c
  7843. }
  7844. // IfNoneMatch sets the optional parameter which makes the operation
  7845. // fail if the object's ETag matches the given value. This is useful for
  7846. // getting updates only after the object has changed since the last
  7847. // request. Use googleapi.IsNotModified to check whether the response
  7848. // error from Do is the result of In-None-Match.
  7849. func (c *TeamdrivesGetCall) IfNoneMatch(entityTag string) *TeamdrivesGetCall {
  7850. c.ifNoneMatch_ = entityTag
  7851. return c
  7852. }
  7853. // Context sets the context to be used in this call's Do method. Any
  7854. // pending HTTP request will be aborted if the provided context is
  7855. // canceled.
  7856. func (c *TeamdrivesGetCall) Context(ctx context.Context) *TeamdrivesGetCall {
  7857. c.ctx_ = ctx
  7858. return c
  7859. }
  7860. // Header returns an http.Header that can be modified by the caller to
  7861. // add HTTP headers to the request.
  7862. func (c *TeamdrivesGetCall) Header() http.Header {
  7863. if c.header_ == nil {
  7864. c.header_ = make(http.Header)
  7865. }
  7866. return c.header_
  7867. }
  7868. func (c *TeamdrivesGetCall) doRequest(alt string) (*http.Response, error) {
  7869. reqHeaders := make(http.Header)
  7870. for k, v := range c.header_ {
  7871. reqHeaders[k] = v
  7872. }
  7873. reqHeaders.Set("User-Agent", c.s.userAgent())
  7874. if c.ifNoneMatch_ != "" {
  7875. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  7876. }
  7877. var body io.Reader = nil
  7878. c.urlParams_.Set("alt", alt)
  7879. c.urlParams_.Set("prettyPrint", "false")
  7880. urls := googleapi.ResolveRelative(c.s.BasePath, "teamdrives/{teamDriveId}")
  7881. urls += "?" + c.urlParams_.Encode()
  7882. req, err := http.NewRequest("GET", urls, body)
  7883. if err != nil {
  7884. return nil, err
  7885. }
  7886. req.Header = reqHeaders
  7887. googleapi.Expand(req.URL, map[string]string{
  7888. "teamDriveId": c.teamDriveId,
  7889. })
  7890. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  7891. }
  7892. // Do executes the "drive.teamdrives.get" call.
  7893. // Exactly one of *TeamDrive or error will be non-nil. Any non-2xx
  7894. // status code is an error. Response headers are in either
  7895. // *TeamDrive.ServerResponse.Header or (if a response was returned at
  7896. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  7897. // to check whether the returned error was because
  7898. // http.StatusNotModified was returned.
  7899. func (c *TeamdrivesGetCall) Do(opts ...googleapi.CallOption) (*TeamDrive, error) {
  7900. gensupport.SetOptions(c.urlParams_, opts...)
  7901. res, err := c.doRequest("json")
  7902. if res != nil && res.StatusCode == http.StatusNotModified {
  7903. if res.Body != nil {
  7904. res.Body.Close()
  7905. }
  7906. return nil, &googleapi.Error{
  7907. Code: res.StatusCode,
  7908. Header: res.Header,
  7909. }
  7910. }
  7911. if err != nil {
  7912. return nil, err
  7913. }
  7914. defer googleapi.CloseBody(res)
  7915. if err := googleapi.CheckResponse(res); err != nil {
  7916. return nil, err
  7917. }
  7918. ret := &TeamDrive{
  7919. ServerResponse: googleapi.ServerResponse{
  7920. Header: res.Header,
  7921. HTTPStatusCode: res.StatusCode,
  7922. },
  7923. }
  7924. target := &ret
  7925. if err := gensupport.DecodeResponse(target, res); err != nil {
  7926. return nil, err
  7927. }
  7928. return ret, nil
  7929. // {
  7930. // "description": "Gets a Team Drive's metadata by ID.",
  7931. // "httpMethod": "GET",
  7932. // "id": "drive.teamdrives.get",
  7933. // "parameterOrder": [
  7934. // "teamDriveId"
  7935. // ],
  7936. // "parameters": {
  7937. // "teamDriveId": {
  7938. // "description": "The ID of the Team Drive",
  7939. // "location": "path",
  7940. // "required": true,
  7941. // "type": "string"
  7942. // },
  7943. // "useDomainAdminAccess": {
  7944. // "default": "false",
  7945. // "description": "Issue the request as a domain administrator; if set to true, then the requester will be granted access if they are an administrator of the domain to which the Team Drive belongs.",
  7946. // "location": "query",
  7947. // "type": "boolean"
  7948. // }
  7949. // },
  7950. // "path": "teamdrives/{teamDriveId}",
  7951. // "response": {
  7952. // "$ref": "TeamDrive"
  7953. // },
  7954. // "scopes": [
  7955. // "https://www.googleapis.com/auth/drive",
  7956. // "https://www.googleapis.com/auth/drive.readonly"
  7957. // ]
  7958. // }
  7959. }
  7960. // method id "drive.teamdrives.list":
  7961. type TeamdrivesListCall struct {
  7962. s *Service
  7963. urlParams_ gensupport.URLParams
  7964. ifNoneMatch_ string
  7965. ctx_ context.Context
  7966. header_ http.Header
  7967. }
  7968. // List: Lists the user's Team Drives.
  7969. func (r *TeamdrivesService) List() *TeamdrivesListCall {
  7970. c := &TeamdrivesListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  7971. return c
  7972. }
  7973. // PageSize sets the optional parameter "pageSize": Maximum number of
  7974. // Team Drives to return.
  7975. func (c *TeamdrivesListCall) PageSize(pageSize int64) *TeamdrivesListCall {
  7976. c.urlParams_.Set("pageSize", fmt.Sprint(pageSize))
  7977. return c
  7978. }
  7979. // PageToken sets the optional parameter "pageToken": Page token for
  7980. // Team Drives.
  7981. func (c *TeamdrivesListCall) PageToken(pageToken string) *TeamdrivesListCall {
  7982. c.urlParams_.Set("pageToken", pageToken)
  7983. return c
  7984. }
  7985. // Q sets the optional parameter "q": Query string for searching Team
  7986. // Drives.
  7987. func (c *TeamdrivesListCall) Q(q string) *TeamdrivesListCall {
  7988. c.urlParams_.Set("q", q)
  7989. return c
  7990. }
  7991. // UseDomainAdminAccess sets the optional parameter
  7992. // "useDomainAdminAccess": Issue the request as a domain administrator;
  7993. // if set to true, then all Team Drives of the domain in which the
  7994. // requester is an administrator are returned.
  7995. func (c *TeamdrivesListCall) UseDomainAdminAccess(useDomainAdminAccess bool) *TeamdrivesListCall {
  7996. c.urlParams_.Set("useDomainAdminAccess", fmt.Sprint(useDomainAdminAccess))
  7997. return c
  7998. }
  7999. // Fields allows partial responses to be retrieved. See
  8000. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  8001. // for more information.
  8002. func (c *TeamdrivesListCall) Fields(s ...googleapi.Field) *TeamdrivesListCall {
  8003. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  8004. return c
  8005. }
  8006. // IfNoneMatch sets the optional parameter which makes the operation
  8007. // fail if the object's ETag matches the given value. This is useful for
  8008. // getting updates only after the object has changed since the last
  8009. // request. Use googleapi.IsNotModified to check whether the response
  8010. // error from Do is the result of In-None-Match.
  8011. func (c *TeamdrivesListCall) IfNoneMatch(entityTag string) *TeamdrivesListCall {
  8012. c.ifNoneMatch_ = entityTag
  8013. return c
  8014. }
  8015. // Context sets the context to be used in this call's Do method. Any
  8016. // pending HTTP request will be aborted if the provided context is
  8017. // canceled.
  8018. func (c *TeamdrivesListCall) Context(ctx context.Context) *TeamdrivesListCall {
  8019. c.ctx_ = ctx
  8020. return c
  8021. }
  8022. // Header returns an http.Header that can be modified by the caller to
  8023. // add HTTP headers to the request.
  8024. func (c *TeamdrivesListCall) Header() http.Header {
  8025. if c.header_ == nil {
  8026. c.header_ = make(http.Header)
  8027. }
  8028. return c.header_
  8029. }
  8030. func (c *TeamdrivesListCall) doRequest(alt string) (*http.Response, error) {
  8031. reqHeaders := make(http.Header)
  8032. for k, v := range c.header_ {
  8033. reqHeaders[k] = v
  8034. }
  8035. reqHeaders.Set("User-Agent", c.s.userAgent())
  8036. if c.ifNoneMatch_ != "" {
  8037. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  8038. }
  8039. var body io.Reader = nil
  8040. c.urlParams_.Set("alt", alt)
  8041. c.urlParams_.Set("prettyPrint", "false")
  8042. urls := googleapi.ResolveRelative(c.s.BasePath, "teamdrives")
  8043. urls += "?" + c.urlParams_.Encode()
  8044. req, err := http.NewRequest("GET", urls, body)
  8045. if err != nil {
  8046. return nil, err
  8047. }
  8048. req.Header = reqHeaders
  8049. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  8050. }
  8051. // Do executes the "drive.teamdrives.list" call.
  8052. // Exactly one of *TeamDriveList or error will be non-nil. Any non-2xx
  8053. // status code is an error. Response headers are in either
  8054. // *TeamDriveList.ServerResponse.Header or (if a response was returned
  8055. // at all) in error.(*googleapi.Error).Header. Use
  8056. // googleapi.IsNotModified to check whether the returned error was
  8057. // because http.StatusNotModified was returned.
  8058. func (c *TeamdrivesListCall) Do(opts ...googleapi.CallOption) (*TeamDriveList, error) {
  8059. gensupport.SetOptions(c.urlParams_, opts...)
  8060. res, err := c.doRequest("json")
  8061. if res != nil && res.StatusCode == http.StatusNotModified {
  8062. if res.Body != nil {
  8063. res.Body.Close()
  8064. }
  8065. return nil, &googleapi.Error{
  8066. Code: res.StatusCode,
  8067. Header: res.Header,
  8068. }
  8069. }
  8070. if err != nil {
  8071. return nil, err
  8072. }
  8073. defer googleapi.CloseBody(res)
  8074. if err := googleapi.CheckResponse(res); err != nil {
  8075. return nil, err
  8076. }
  8077. ret := &TeamDriveList{
  8078. ServerResponse: googleapi.ServerResponse{
  8079. Header: res.Header,
  8080. HTTPStatusCode: res.StatusCode,
  8081. },
  8082. }
  8083. target := &ret
  8084. if err := gensupport.DecodeResponse(target, res); err != nil {
  8085. return nil, err
  8086. }
  8087. return ret, nil
  8088. // {
  8089. // "description": "Lists the user's Team Drives.",
  8090. // "httpMethod": "GET",
  8091. // "id": "drive.teamdrives.list",
  8092. // "parameters": {
  8093. // "pageSize": {
  8094. // "default": "10",
  8095. // "description": "Maximum number of Team Drives to return.",
  8096. // "format": "int32",
  8097. // "location": "query",
  8098. // "maximum": "100",
  8099. // "minimum": "1",
  8100. // "type": "integer"
  8101. // },
  8102. // "pageToken": {
  8103. // "description": "Page token for Team Drives.",
  8104. // "location": "query",
  8105. // "type": "string"
  8106. // },
  8107. // "q": {
  8108. // "description": "Query string for searching Team Drives.",
  8109. // "location": "query",
  8110. // "type": "string"
  8111. // },
  8112. // "useDomainAdminAccess": {
  8113. // "default": "false",
  8114. // "description": "Issue the request as a domain administrator; if set to true, then all Team Drives of the domain in which the requester is an administrator are returned.",
  8115. // "location": "query",
  8116. // "type": "boolean"
  8117. // }
  8118. // },
  8119. // "path": "teamdrives",
  8120. // "response": {
  8121. // "$ref": "TeamDriveList"
  8122. // },
  8123. // "scopes": [
  8124. // "https://www.googleapis.com/auth/drive",
  8125. // "https://www.googleapis.com/auth/drive.readonly"
  8126. // ]
  8127. // }
  8128. }
  8129. // Pages invokes f for each page of results.
  8130. // A non-nil error returned from f will halt the iteration.
  8131. // The provided context supersedes any context provided to the Context method.
  8132. func (c *TeamdrivesListCall) Pages(ctx context.Context, f func(*TeamDriveList) error) error {
  8133. c.ctx_ = ctx
  8134. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  8135. for {
  8136. x, err := c.Do()
  8137. if err != nil {
  8138. return err
  8139. }
  8140. if err := f(x); err != nil {
  8141. return err
  8142. }
  8143. if x.NextPageToken == "" {
  8144. return nil
  8145. }
  8146. c.PageToken(x.NextPageToken)
  8147. }
  8148. }
  8149. // method id "drive.teamdrives.update":
  8150. type TeamdrivesUpdateCall struct {
  8151. s *Service
  8152. teamDriveId string
  8153. teamdrive *TeamDrive
  8154. urlParams_ gensupport.URLParams
  8155. ctx_ context.Context
  8156. header_ http.Header
  8157. }
  8158. // Update: Updates a Team Drive's metadata
  8159. func (r *TeamdrivesService) Update(teamDriveId string, teamdrive *TeamDrive) *TeamdrivesUpdateCall {
  8160. c := &TeamdrivesUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  8161. c.teamDriveId = teamDriveId
  8162. c.teamdrive = teamdrive
  8163. return c
  8164. }
  8165. // UseDomainAdminAccess sets the optional parameter
  8166. // "useDomainAdminAccess": Issue the request as a domain administrator;
  8167. // if set to true, then the requester will be granted access if they are
  8168. // an administrator of the domain to which the Team Drive belongs.
  8169. func (c *TeamdrivesUpdateCall) UseDomainAdminAccess(useDomainAdminAccess bool) *TeamdrivesUpdateCall {
  8170. c.urlParams_.Set("useDomainAdminAccess", fmt.Sprint(useDomainAdminAccess))
  8171. return c
  8172. }
  8173. // Fields allows partial responses to be retrieved. See
  8174. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  8175. // for more information.
  8176. func (c *TeamdrivesUpdateCall) Fields(s ...googleapi.Field) *TeamdrivesUpdateCall {
  8177. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  8178. return c
  8179. }
  8180. // Context sets the context to be used in this call's Do method. Any
  8181. // pending HTTP request will be aborted if the provided context is
  8182. // canceled.
  8183. func (c *TeamdrivesUpdateCall) Context(ctx context.Context) *TeamdrivesUpdateCall {
  8184. c.ctx_ = ctx
  8185. return c
  8186. }
  8187. // Header returns an http.Header that can be modified by the caller to
  8188. // add HTTP headers to the request.
  8189. func (c *TeamdrivesUpdateCall) Header() http.Header {
  8190. if c.header_ == nil {
  8191. c.header_ = make(http.Header)
  8192. }
  8193. return c.header_
  8194. }
  8195. func (c *TeamdrivesUpdateCall) doRequest(alt string) (*http.Response, error) {
  8196. reqHeaders := make(http.Header)
  8197. for k, v := range c.header_ {
  8198. reqHeaders[k] = v
  8199. }
  8200. reqHeaders.Set("User-Agent", c.s.userAgent())
  8201. var body io.Reader = nil
  8202. body, err := googleapi.WithoutDataWrapper.JSONReader(c.teamdrive)
  8203. if err != nil {
  8204. return nil, err
  8205. }
  8206. reqHeaders.Set("Content-Type", "application/json")
  8207. c.urlParams_.Set("alt", alt)
  8208. c.urlParams_.Set("prettyPrint", "false")
  8209. urls := googleapi.ResolveRelative(c.s.BasePath, "teamdrives/{teamDriveId}")
  8210. urls += "?" + c.urlParams_.Encode()
  8211. req, err := http.NewRequest("PATCH", urls, body)
  8212. if err != nil {
  8213. return nil, err
  8214. }
  8215. req.Header = reqHeaders
  8216. googleapi.Expand(req.URL, map[string]string{
  8217. "teamDriveId": c.teamDriveId,
  8218. })
  8219. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  8220. }
  8221. // Do executes the "drive.teamdrives.update" call.
  8222. // Exactly one of *TeamDrive or error will be non-nil. Any non-2xx
  8223. // status code is an error. Response headers are in either
  8224. // *TeamDrive.ServerResponse.Header or (if a response was returned at
  8225. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  8226. // to check whether the returned error was because
  8227. // http.StatusNotModified was returned.
  8228. func (c *TeamdrivesUpdateCall) Do(opts ...googleapi.CallOption) (*TeamDrive, error) {
  8229. gensupport.SetOptions(c.urlParams_, opts...)
  8230. res, err := c.doRequest("json")
  8231. if res != nil && res.StatusCode == http.StatusNotModified {
  8232. if res.Body != nil {
  8233. res.Body.Close()
  8234. }
  8235. return nil, &googleapi.Error{
  8236. Code: res.StatusCode,
  8237. Header: res.Header,
  8238. }
  8239. }
  8240. if err != nil {
  8241. return nil, err
  8242. }
  8243. defer googleapi.CloseBody(res)
  8244. if err := googleapi.CheckResponse(res); err != nil {
  8245. return nil, err
  8246. }
  8247. ret := &TeamDrive{
  8248. ServerResponse: googleapi.ServerResponse{
  8249. Header: res.Header,
  8250. HTTPStatusCode: res.StatusCode,
  8251. },
  8252. }
  8253. target := &ret
  8254. if err := gensupport.DecodeResponse(target, res); err != nil {
  8255. return nil, err
  8256. }
  8257. return ret, nil
  8258. // {
  8259. // "description": "Updates a Team Drive's metadata",
  8260. // "httpMethod": "PATCH",
  8261. // "id": "drive.teamdrives.update",
  8262. // "parameterOrder": [
  8263. // "teamDriveId"
  8264. // ],
  8265. // "parameters": {
  8266. // "teamDriveId": {
  8267. // "description": "The ID of the Team Drive",
  8268. // "location": "path",
  8269. // "required": true,
  8270. // "type": "string"
  8271. // },
  8272. // "useDomainAdminAccess": {
  8273. // "default": "false",
  8274. // "description": "Issue the request as a domain administrator; if set to true, then the requester will be granted access if they are an administrator of the domain to which the Team Drive belongs.",
  8275. // "location": "query",
  8276. // "type": "boolean"
  8277. // }
  8278. // },
  8279. // "path": "teamdrives/{teamDriveId}",
  8280. // "request": {
  8281. // "$ref": "TeamDrive"
  8282. // },
  8283. // "response": {
  8284. // "$ref": "TeamDrive"
  8285. // },
  8286. // "scopes": [
  8287. // "https://www.googleapis.com/auth/drive"
  8288. // ]
  8289. // }
  8290. }