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.
 
 
 

8837 lines
299 KiB

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