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.
 
 
 

15203 lines
504 KiB

  1. // Copyright 2019 Google LLC.
  2. // Use of this source code is governed by a BSD-style
  3. // license that can be found in the LICENSE file.
  4. // Code generated file. DO NOT EDIT.
  5. // Package drive provides access to the Drive API.
  6. //
  7. // For product documentation, see: https://developers.google.com/drive/
  8. //
  9. // Creating a client
  10. //
  11. // Usage example:
  12. //
  13. // import "google.golang.org/api/drive/v2"
  14. // ...
  15. // ctx := context.Background()
  16. // driveService, err := drive.NewService(ctx)
  17. //
  18. // In this example, Google Application Default Credentials are used for authentication.
  19. //
  20. // For information on how to create and obtain Application Default Credentials, see https://developers.google.com/identity/protocols/application-default-credentials.
  21. //
  22. // Other authentication options
  23. //
  24. // By default, all available scopes (see "Constants") are used to authenticate. To restrict scopes, use option.WithScopes:
  25. //
  26. // driveService, err := drive.NewService(ctx, option.WithScopes(drive.DriveScriptsScope))
  27. //
  28. // To use an API key for authentication (note: some APIs do not support API keys), use option.WithAPIKey:
  29. //
  30. // driveService, err := drive.NewService(ctx, option.WithAPIKey("AIza..."))
  31. //
  32. // To use an OAuth token (e.g., a user token obtained via a three-legged OAuth flow), use option.WithTokenSource:
  33. //
  34. // config := &oauth2.Config{...}
  35. // // ...
  36. // token, err := config.Exchange(ctx, ...)
  37. // driveService, err := drive.NewService(ctx, option.WithTokenSource(config.TokenSource(ctx, token)))
  38. //
  39. // See https://godoc.org/google.golang.org/api/option/ for details on options.
  40. package drive // import "google.golang.org/api/drive/v2"
  41. import (
  42. "bytes"
  43. "context"
  44. "encoding/json"
  45. "errors"
  46. "fmt"
  47. "io"
  48. "net/http"
  49. "net/url"
  50. "strconv"
  51. "strings"
  52. gensupport "google.golang.org/api/gensupport"
  53. googleapi "google.golang.org/api/googleapi"
  54. option "google.golang.org/api/option"
  55. htransport "google.golang.org/api/transport/http"
  56. )
  57. // Always reference these packages, just in case the auto-generated code
  58. // below doesn't.
  59. var _ = bytes.NewBuffer
  60. var _ = strconv.Itoa
  61. var _ = fmt.Sprintf
  62. var _ = json.NewDecoder
  63. var _ = io.Copy
  64. var _ = url.Parse
  65. var _ = gensupport.MarshalJSON
  66. var _ = googleapi.Version
  67. var _ = errors.New
  68. var _ = strings.Replace
  69. var _ = context.Canceled
  70. const apiId = "drive:v2"
  71. const apiName = "drive"
  72. const apiVersion = "v2"
  73. const basePath = "https://www.googleapis.com/drive/v2/"
  74. // OAuth2 scopes used by this API.
  75. const (
  76. // See, edit, create, and delete all of your Google Drive files
  77. DriveScope = "https://www.googleapis.com/auth/drive"
  78. // View and manage its own configuration data in your Google Drive
  79. DriveAppdataScope = "https://www.googleapis.com/auth/drive.appdata"
  80. // View your Google Drive apps
  81. DriveAppsReadonlyScope = "https://www.googleapis.com/auth/drive.apps.readonly"
  82. // View and manage Google Drive files and folders that you have opened
  83. // or created with this app
  84. DriveFileScope = "https://www.googleapis.com/auth/drive.file"
  85. // View and manage metadata of files in your Google Drive
  86. DriveMetadataScope = "https://www.googleapis.com/auth/drive.metadata"
  87. // View metadata for files in your Google Drive
  88. DriveMetadataReadonlyScope = "https://www.googleapis.com/auth/drive.metadata.readonly"
  89. // View the photos, videos and albums in your Google Photos
  90. DrivePhotosReadonlyScope = "https://www.googleapis.com/auth/drive.photos.readonly"
  91. // See and download all your Google Drive files
  92. DriveReadonlyScope = "https://www.googleapis.com/auth/drive.readonly"
  93. // Modify your Google Apps Script scripts' behavior
  94. DriveScriptsScope = "https://www.googleapis.com/auth/drive.scripts"
  95. )
  96. // NewService creates a new Service.
  97. func NewService(ctx context.Context, opts ...option.ClientOption) (*Service, error) {
  98. scopesOption := option.WithScopes(
  99. "https://www.googleapis.com/auth/drive",
  100. "https://www.googleapis.com/auth/drive.appdata",
  101. "https://www.googleapis.com/auth/drive.apps.readonly",
  102. "https://www.googleapis.com/auth/drive.file",
  103. "https://www.googleapis.com/auth/drive.metadata",
  104. "https://www.googleapis.com/auth/drive.metadata.readonly",
  105. "https://www.googleapis.com/auth/drive.photos.readonly",
  106. "https://www.googleapis.com/auth/drive.readonly",
  107. "https://www.googleapis.com/auth/drive.scripts",
  108. )
  109. // NOTE: prepend, so we don't override user-specified scopes.
  110. opts = append([]option.ClientOption{scopesOption}, opts...)
  111. client, endpoint, err := htransport.NewClient(ctx, opts...)
  112. if err != nil {
  113. return nil, err
  114. }
  115. s, err := New(client)
  116. if err != nil {
  117. return nil, err
  118. }
  119. if endpoint != "" {
  120. s.BasePath = endpoint
  121. }
  122. return s, nil
  123. }
  124. // New creates a new Service. It uses the provided http.Client for requests.
  125. //
  126. // Deprecated: please use NewService instead.
  127. // To provide a custom HTTP client, use option.WithHTTPClient.
  128. // If you are using google.golang.org/api/googleapis/transport.APIKey, use option.WithAPIKey with NewService instead.
  129. func New(client *http.Client) (*Service, error) {
  130. if client == nil {
  131. return nil, errors.New("client is nil")
  132. }
  133. s := &Service{client: client, BasePath: basePath}
  134. s.About = NewAboutService(s)
  135. s.Apps = NewAppsService(s)
  136. s.Changes = NewChangesService(s)
  137. s.Channels = NewChannelsService(s)
  138. s.Children = NewChildrenService(s)
  139. s.Comments = NewCommentsService(s)
  140. s.Files = NewFilesService(s)
  141. s.Parents = NewParentsService(s)
  142. s.Permissions = NewPermissionsService(s)
  143. s.Properties = NewPropertiesService(s)
  144. s.Realtime = NewRealtimeService(s)
  145. s.Replies = NewRepliesService(s)
  146. s.Revisions = NewRevisionsService(s)
  147. s.Teamdrives = NewTeamdrivesService(s)
  148. return s, nil
  149. }
  150. type Service struct {
  151. client *http.Client
  152. BasePath string // API endpoint base URL
  153. UserAgent string // optional additional User-Agent fragment
  154. About *AboutService
  155. Apps *AppsService
  156. Changes *ChangesService
  157. Channels *ChannelsService
  158. Children *ChildrenService
  159. Comments *CommentsService
  160. Files *FilesService
  161. Parents *ParentsService
  162. Permissions *PermissionsService
  163. Properties *PropertiesService
  164. Realtime *RealtimeService
  165. Replies *RepliesService
  166. Revisions *RevisionsService
  167. Teamdrives *TeamdrivesService
  168. }
  169. func (s *Service) userAgent() string {
  170. if s.UserAgent == "" {
  171. return googleapi.UserAgent
  172. }
  173. return googleapi.UserAgent + " " + s.UserAgent
  174. }
  175. func NewAboutService(s *Service) *AboutService {
  176. rs := &AboutService{s: s}
  177. return rs
  178. }
  179. type AboutService struct {
  180. s *Service
  181. }
  182. func NewAppsService(s *Service) *AppsService {
  183. rs := &AppsService{s: s}
  184. return rs
  185. }
  186. type AppsService struct {
  187. s *Service
  188. }
  189. func NewChangesService(s *Service) *ChangesService {
  190. rs := &ChangesService{s: s}
  191. return rs
  192. }
  193. type ChangesService struct {
  194. s *Service
  195. }
  196. func NewChannelsService(s *Service) *ChannelsService {
  197. rs := &ChannelsService{s: s}
  198. return rs
  199. }
  200. type ChannelsService struct {
  201. s *Service
  202. }
  203. func NewChildrenService(s *Service) *ChildrenService {
  204. rs := &ChildrenService{s: s}
  205. return rs
  206. }
  207. type ChildrenService struct {
  208. s *Service
  209. }
  210. func NewCommentsService(s *Service) *CommentsService {
  211. rs := &CommentsService{s: s}
  212. return rs
  213. }
  214. type CommentsService struct {
  215. s *Service
  216. }
  217. func NewFilesService(s *Service) *FilesService {
  218. rs := &FilesService{s: s}
  219. return rs
  220. }
  221. type FilesService struct {
  222. s *Service
  223. }
  224. func NewParentsService(s *Service) *ParentsService {
  225. rs := &ParentsService{s: s}
  226. return rs
  227. }
  228. type ParentsService struct {
  229. s *Service
  230. }
  231. func NewPermissionsService(s *Service) *PermissionsService {
  232. rs := &PermissionsService{s: s}
  233. return rs
  234. }
  235. type PermissionsService struct {
  236. s *Service
  237. }
  238. func NewPropertiesService(s *Service) *PropertiesService {
  239. rs := &PropertiesService{s: s}
  240. return rs
  241. }
  242. type PropertiesService struct {
  243. s *Service
  244. }
  245. func NewRealtimeService(s *Service) *RealtimeService {
  246. rs := &RealtimeService{s: s}
  247. return rs
  248. }
  249. type RealtimeService struct {
  250. s *Service
  251. }
  252. func NewRepliesService(s *Service) *RepliesService {
  253. rs := &RepliesService{s: s}
  254. return rs
  255. }
  256. type RepliesService struct {
  257. s *Service
  258. }
  259. func NewRevisionsService(s *Service) *RevisionsService {
  260. rs := &RevisionsService{s: s}
  261. return rs
  262. }
  263. type RevisionsService struct {
  264. s *Service
  265. }
  266. func NewTeamdrivesService(s *Service) *TeamdrivesService {
  267. rs := &TeamdrivesService{s: s}
  268. return rs
  269. }
  270. type TeamdrivesService struct {
  271. s *Service
  272. }
  273. // About: An item with user information and settings.
  274. type About struct {
  275. // AdditionalRoleInfo: Information about supported additional roles per
  276. // file type. The most specific type takes precedence.
  277. AdditionalRoleInfo []*AboutAdditionalRoleInfo `json:"additionalRoleInfo,omitempty"`
  278. // CanCreateTeamDrives: Whether the user can create Team Drives.
  279. CanCreateTeamDrives bool `json:"canCreateTeamDrives,omitempty"`
  280. // DomainSharingPolicy: The domain sharing policy for the current user.
  281. // Possible values are:
  282. // - allowed
  283. // - allowedWithWarning
  284. // - incomingOnly
  285. // - disallowed
  286. DomainSharingPolicy string `json:"domainSharingPolicy,omitempty"`
  287. // Etag: The ETag of the item.
  288. Etag string `json:"etag,omitempty"`
  289. // ExportFormats: The allowable export formats.
  290. ExportFormats []*AboutExportFormats `json:"exportFormats,omitempty"`
  291. // Features: List of additional features enabled on this account.
  292. Features []*AboutFeatures `json:"features,omitempty"`
  293. // FolderColorPalette: The palette of allowable folder colors as RGB hex
  294. // strings.
  295. FolderColorPalette []string `json:"folderColorPalette,omitempty"`
  296. // ImportFormats: The allowable import formats.
  297. ImportFormats []*AboutImportFormats `json:"importFormats,omitempty"`
  298. // IsCurrentAppInstalled: A boolean indicating whether the authenticated
  299. // app is installed by the authenticated user.
  300. IsCurrentAppInstalled bool `json:"isCurrentAppInstalled,omitempty"`
  301. // Kind: This is always drive#about.
  302. Kind string `json:"kind,omitempty"`
  303. // LanguageCode: The user's language or locale code, as defined by BCP
  304. // 47, with some extensions from Unicode's LDML format
  305. // (http://www.unicode.org/reports/tr35/).
  306. LanguageCode string `json:"languageCode,omitempty"`
  307. // LargestChangeId: The largest change id.
  308. LargestChangeId int64 `json:"largestChangeId,omitempty,string"`
  309. // MaxUploadSizes: List of max upload sizes for each file type. The most
  310. // specific type takes precedence.
  311. MaxUploadSizes []*AboutMaxUploadSizes `json:"maxUploadSizes,omitempty"`
  312. // Name: The name of the current user.
  313. Name string `json:"name,omitempty"`
  314. // PermissionId: The current user's ID as visible in the permissions
  315. // collection.
  316. PermissionId string `json:"permissionId,omitempty"`
  317. // QuotaBytesByService: The amount of storage quota used by different
  318. // Google services.
  319. QuotaBytesByService []*AboutQuotaBytesByService `json:"quotaBytesByService,omitempty"`
  320. // QuotaBytesTotal: The total number of quota bytes.
  321. QuotaBytesTotal int64 `json:"quotaBytesTotal,omitempty,string"`
  322. // QuotaBytesUsed: The number of quota bytes used by Google Drive.
  323. QuotaBytesUsed int64 `json:"quotaBytesUsed,omitempty,string"`
  324. // QuotaBytesUsedAggregate: The number of quota bytes used by all Google
  325. // apps (Drive, Picasa, etc.).
  326. QuotaBytesUsedAggregate int64 `json:"quotaBytesUsedAggregate,omitempty,string"`
  327. // QuotaBytesUsedInTrash: The number of quota bytes used by trashed
  328. // items.
  329. QuotaBytesUsedInTrash int64 `json:"quotaBytesUsedInTrash,omitempty,string"`
  330. // QuotaType: The type of the user's storage quota. Possible values are:
  331. //
  332. // - LIMITED
  333. // - UNLIMITED
  334. QuotaType string `json:"quotaType,omitempty"`
  335. // RemainingChangeIds: The number of remaining change ids, limited to no
  336. // more than 2500.
  337. RemainingChangeIds int64 `json:"remainingChangeIds,omitempty,string"`
  338. // RootFolderId: The id of the root folder.
  339. RootFolderId string `json:"rootFolderId,omitempty"`
  340. // SelfLink: A link back to this item.
  341. SelfLink string `json:"selfLink,omitempty"`
  342. // TeamDriveThemes: A list of themes that are supported for Team Drives.
  343. TeamDriveThemes []*AboutTeamDriveThemes `json:"teamDriveThemes,omitempty"`
  344. // User: The authenticated user.
  345. User *User `json:"user,omitempty"`
  346. // ServerResponse contains the HTTP response code and headers from the
  347. // server.
  348. googleapi.ServerResponse `json:"-"`
  349. // ForceSendFields is a list of field names (e.g. "AdditionalRoleInfo")
  350. // to unconditionally include in API requests. By default, fields with
  351. // empty values are omitted from API requests. However, any non-pointer,
  352. // non-interface field appearing in ForceSendFields will be sent to the
  353. // server regardless of whether the field is empty or not. This may be
  354. // used to include empty fields in Patch requests.
  355. ForceSendFields []string `json:"-"`
  356. // NullFields is a list of field names (e.g. "AdditionalRoleInfo") to
  357. // include in API requests with the JSON null value. By default, fields
  358. // with empty values are omitted from API requests. However, any field
  359. // with an empty value appearing in NullFields will be sent to the
  360. // server as null. It is an error if a field in this list has a
  361. // non-empty value. This may be used to include null fields in Patch
  362. // requests.
  363. NullFields []string `json:"-"`
  364. }
  365. func (s *About) MarshalJSON() ([]byte, error) {
  366. type NoMethod About
  367. raw := NoMethod(*s)
  368. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  369. }
  370. type AboutAdditionalRoleInfo struct {
  371. // RoleSets: The supported additional roles per primary role.
  372. RoleSets []*AboutAdditionalRoleInfoRoleSets `json:"roleSets,omitempty"`
  373. // Type: The content type that this additional role info applies to.
  374. Type string `json:"type,omitempty"`
  375. // ForceSendFields is a list of field names (e.g. "RoleSets") to
  376. // unconditionally include in API requests. By default, fields with
  377. // empty values are omitted from API requests. However, any non-pointer,
  378. // non-interface field appearing in ForceSendFields will be sent to the
  379. // server regardless of whether the field is empty or not. This may be
  380. // used to include empty fields in Patch requests.
  381. ForceSendFields []string `json:"-"`
  382. // NullFields is a list of field names (e.g. "RoleSets") to include in
  383. // API requests with the JSON null value. By default, fields with empty
  384. // values are omitted from API requests. However, any field with an
  385. // empty value appearing in NullFields will be sent to the server as
  386. // null. It is an error if a field in this list has a non-empty value.
  387. // This may be used to include null fields in Patch requests.
  388. NullFields []string `json:"-"`
  389. }
  390. func (s *AboutAdditionalRoleInfo) MarshalJSON() ([]byte, error) {
  391. type NoMethod AboutAdditionalRoleInfo
  392. raw := NoMethod(*s)
  393. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  394. }
  395. type AboutAdditionalRoleInfoRoleSets struct {
  396. // AdditionalRoles: The supported additional roles with the primary
  397. // role.
  398. AdditionalRoles []string `json:"additionalRoles,omitempty"`
  399. // PrimaryRole: A primary permission role.
  400. PrimaryRole string `json:"primaryRole,omitempty"`
  401. // ForceSendFields is a list of field names (e.g. "AdditionalRoles") to
  402. // unconditionally include in API requests. By default, fields with
  403. // empty values are omitted from API requests. However, any non-pointer,
  404. // non-interface field appearing in ForceSendFields will be sent to the
  405. // server regardless of whether the field is empty or not. This may be
  406. // used to include empty fields in Patch requests.
  407. ForceSendFields []string `json:"-"`
  408. // NullFields is a list of field names (e.g. "AdditionalRoles") to
  409. // include in API requests with the JSON null value. By default, fields
  410. // with empty values are omitted from API requests. However, any field
  411. // with an empty value appearing in NullFields will be sent to the
  412. // server as null. It is an error if a field in this list has a
  413. // non-empty value. This may be used to include null fields in Patch
  414. // requests.
  415. NullFields []string `json:"-"`
  416. }
  417. func (s *AboutAdditionalRoleInfoRoleSets) MarshalJSON() ([]byte, error) {
  418. type NoMethod AboutAdditionalRoleInfoRoleSets
  419. raw := NoMethod(*s)
  420. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  421. }
  422. type AboutExportFormats struct {
  423. // Source: The content type to convert from.
  424. Source string `json:"source,omitempty"`
  425. // Targets: The possible content types to convert to.
  426. Targets []string `json:"targets,omitempty"`
  427. // ForceSendFields is a list of field names (e.g. "Source") to
  428. // unconditionally include in API requests. By default, fields with
  429. // empty values are omitted from API requests. However, any non-pointer,
  430. // non-interface field appearing in ForceSendFields will be sent to the
  431. // server regardless of whether the field is empty or not. This may be
  432. // used to include empty fields in Patch requests.
  433. ForceSendFields []string `json:"-"`
  434. // NullFields is a list of field names (e.g. "Source") to include in API
  435. // requests with the JSON null value. By default, fields with empty
  436. // values are omitted from API requests. However, any field with an
  437. // empty value appearing in NullFields will be sent to the server as
  438. // null. It is an error if a field in this list has a non-empty value.
  439. // This may be used to include null fields in Patch requests.
  440. NullFields []string `json:"-"`
  441. }
  442. func (s *AboutExportFormats) MarshalJSON() ([]byte, error) {
  443. type NoMethod AboutExportFormats
  444. raw := NoMethod(*s)
  445. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  446. }
  447. type AboutFeatures struct {
  448. // FeatureName: The name of the feature.
  449. FeatureName string `json:"featureName,omitempty"`
  450. // FeatureRate: The request limit rate for this feature, in queries per
  451. // second.
  452. FeatureRate float64 `json:"featureRate,omitempty"`
  453. // ForceSendFields is a list of field names (e.g. "FeatureName") 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. "FeatureName") to include
  461. // in API requests with the JSON null value. By default, fields with
  462. // empty values are omitted from API requests. However, any field with
  463. // an 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 *AboutFeatures) MarshalJSON() ([]byte, error) {
  469. type NoMethod AboutFeatures
  470. raw := NoMethod(*s)
  471. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  472. }
  473. func (s *AboutFeatures) UnmarshalJSON(data []byte) error {
  474. type NoMethod AboutFeatures
  475. var s1 struct {
  476. FeatureRate gensupport.JSONFloat64 `json:"featureRate"`
  477. *NoMethod
  478. }
  479. s1.NoMethod = (*NoMethod)(s)
  480. if err := json.Unmarshal(data, &s1); err != nil {
  481. return err
  482. }
  483. s.FeatureRate = float64(s1.FeatureRate)
  484. return nil
  485. }
  486. type AboutImportFormats struct {
  487. // Source: The imported file's content type to convert from.
  488. Source string `json:"source,omitempty"`
  489. // Targets: The possible content types to convert to.
  490. Targets []string `json:"targets,omitempty"`
  491. // ForceSendFields is a list of field names (e.g. "Source") to
  492. // unconditionally include in API requests. By default, fields with
  493. // empty values are omitted from API requests. However, any non-pointer,
  494. // non-interface field appearing in ForceSendFields will be sent to the
  495. // server regardless of whether the field is empty or not. This may be
  496. // used to include empty fields in Patch requests.
  497. ForceSendFields []string `json:"-"`
  498. // NullFields is a list of field names (e.g. "Source") to include in API
  499. // requests with the JSON null value. By default, fields with empty
  500. // values are omitted from API requests. However, any field with an
  501. // empty value appearing in NullFields will be sent to the server as
  502. // null. It is an error if a field in this list has a non-empty value.
  503. // This may be used to include null fields in Patch requests.
  504. NullFields []string `json:"-"`
  505. }
  506. func (s *AboutImportFormats) MarshalJSON() ([]byte, error) {
  507. type NoMethod AboutImportFormats
  508. raw := NoMethod(*s)
  509. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  510. }
  511. type AboutMaxUploadSizes struct {
  512. // Size: The max upload size for this type.
  513. Size int64 `json:"size,omitempty,string"`
  514. // Type: The file type.
  515. Type string `json:"type,omitempty"`
  516. // ForceSendFields is a list of field names (e.g. "Size") to
  517. // unconditionally include in API requests. By default, fields with
  518. // empty values are omitted from API requests. However, any non-pointer,
  519. // non-interface field appearing in ForceSendFields will be sent to the
  520. // server regardless of whether the field is empty or not. This may be
  521. // used to include empty fields in Patch requests.
  522. ForceSendFields []string `json:"-"`
  523. // NullFields is a list of field names (e.g. "Size") to include in API
  524. // requests with the JSON null value. By default, fields with empty
  525. // values are omitted from API requests. However, any field with an
  526. // empty value appearing in NullFields will be sent to the server as
  527. // null. It is an error if a field in this list has a non-empty value.
  528. // This may be used to include null fields in Patch requests.
  529. NullFields []string `json:"-"`
  530. }
  531. func (s *AboutMaxUploadSizes) MarshalJSON() ([]byte, error) {
  532. type NoMethod AboutMaxUploadSizes
  533. raw := NoMethod(*s)
  534. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  535. }
  536. type AboutQuotaBytesByService struct {
  537. // BytesUsed: The storage quota bytes used by the service.
  538. BytesUsed int64 `json:"bytesUsed,omitempty,string"`
  539. // ServiceName: The service's name, e.g. DRIVE, GMAIL, or PHOTOS.
  540. ServiceName string `json:"serviceName,omitempty"`
  541. // ForceSendFields is a list of field names (e.g. "BytesUsed") to
  542. // unconditionally include in API requests. By default, fields with
  543. // empty values are omitted from API requests. However, any non-pointer,
  544. // non-interface field appearing in ForceSendFields will be sent to the
  545. // server regardless of whether the field is empty or not. This may be
  546. // used to include empty fields in Patch requests.
  547. ForceSendFields []string `json:"-"`
  548. // NullFields is a list of field names (e.g. "BytesUsed") to include in
  549. // API requests with the JSON null value. By default, fields with empty
  550. // values are omitted from API requests. However, any field with an
  551. // empty value appearing in NullFields will be sent to the server as
  552. // null. It is an error if a field in this list has a non-empty value.
  553. // This may be used to include null fields in Patch requests.
  554. NullFields []string `json:"-"`
  555. }
  556. func (s *AboutQuotaBytesByService) MarshalJSON() ([]byte, error) {
  557. type NoMethod AboutQuotaBytesByService
  558. raw := NoMethod(*s)
  559. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  560. }
  561. type AboutTeamDriveThemes struct {
  562. // BackgroundImageLink: A link to this Team Drive theme's background
  563. // image.
  564. BackgroundImageLink string `json:"backgroundImageLink,omitempty"`
  565. // ColorRgb: The color of this Team Drive theme as an RGB hex string.
  566. ColorRgb string `json:"colorRgb,omitempty"`
  567. // Id: The ID of the theme.
  568. Id string `json:"id,omitempty"`
  569. // ForceSendFields is a list of field names (e.g. "BackgroundImageLink")
  570. // to unconditionally include in API requests. By default, fields with
  571. // empty values are omitted from API requests. However, any non-pointer,
  572. // non-interface field appearing in ForceSendFields will be sent to the
  573. // server regardless of whether the field is empty or not. This may be
  574. // used to include empty fields in Patch requests.
  575. ForceSendFields []string `json:"-"`
  576. // NullFields is a list of field names (e.g. "BackgroundImageLink") to
  577. // include in API requests with the JSON null value. By default, fields
  578. // with empty values are omitted from API requests. However, any field
  579. // with an empty value appearing in NullFields will be sent to the
  580. // server as null. It is an error if a field in this list has a
  581. // non-empty value. This may be used to include null fields in Patch
  582. // requests.
  583. NullFields []string `json:"-"`
  584. }
  585. func (s *AboutTeamDriveThemes) MarshalJSON() ([]byte, error) {
  586. type NoMethod AboutTeamDriveThemes
  587. raw := NoMethod(*s)
  588. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  589. }
  590. // App: The apps resource provides a list of the apps that a user has
  591. // installed, with information about each app's supported MIME types,
  592. // file extensions, and other details.
  593. type App struct {
  594. // Authorized: Whether the app is authorized to access data on the
  595. // user's Drive.
  596. Authorized bool `json:"authorized,omitempty"`
  597. // CreateInFolderTemplate: The template url to create a new file with
  598. // this app in a given folder. The template will contain {folderId} to
  599. // be replaced by the folder to create the new file in.
  600. CreateInFolderTemplate string `json:"createInFolderTemplate,omitempty"`
  601. // CreateUrl: The url to create a new file with this app.
  602. CreateUrl string `json:"createUrl,omitempty"`
  603. // HasDriveWideScope: Whether the app has drive-wide scope. An app with
  604. // drive-wide scope can access all files in the user's drive.
  605. HasDriveWideScope bool `json:"hasDriveWideScope,omitempty"`
  606. // Icons: The various icons for the app.
  607. Icons []*AppIcons `json:"icons,omitempty"`
  608. // Id: The ID of the app.
  609. Id string `json:"id,omitempty"`
  610. // Installed: Whether the app is installed.
  611. Installed bool `json:"installed,omitempty"`
  612. // Kind: This is always drive#app.
  613. Kind string `json:"kind,omitempty"`
  614. // LongDescription: A long description of the app.
  615. LongDescription string `json:"longDescription,omitempty"`
  616. // Name: The name of the app.
  617. Name string `json:"name,omitempty"`
  618. // ObjectType: The type of object this app creates (e.g. Chart). If
  619. // empty, the app name should be used instead.
  620. ObjectType string `json:"objectType,omitempty"`
  621. // OpenUrlTemplate: The template url for opening files with this app.
  622. // The template will contain {ids} and/or {exportIds} to be replaced by
  623. // the actual file ids. See Open Files for the full documentation.
  624. OpenUrlTemplate string `json:"openUrlTemplate,omitempty"`
  625. // PrimaryFileExtensions: The list of primary file extensions.
  626. PrimaryFileExtensions []string `json:"primaryFileExtensions,omitempty"`
  627. // PrimaryMimeTypes: The list of primary mime types.
  628. PrimaryMimeTypes []string `json:"primaryMimeTypes,omitempty"`
  629. // ProductId: The ID of the product listing for this app.
  630. ProductId string `json:"productId,omitempty"`
  631. // ProductUrl: A link to the product listing for this app.
  632. ProductUrl string `json:"productUrl,omitempty"`
  633. // SecondaryFileExtensions: The list of secondary file extensions.
  634. SecondaryFileExtensions []string `json:"secondaryFileExtensions,omitempty"`
  635. // SecondaryMimeTypes: The list of secondary mime types.
  636. SecondaryMimeTypes []string `json:"secondaryMimeTypes,omitempty"`
  637. // ShortDescription: A short description of the app.
  638. ShortDescription string `json:"shortDescription,omitempty"`
  639. // SupportsCreate: Whether this app supports creating new objects.
  640. SupportsCreate bool `json:"supportsCreate,omitempty"`
  641. // SupportsImport: Whether this app supports importing Google Docs.
  642. SupportsImport bool `json:"supportsImport,omitempty"`
  643. // SupportsMultiOpen: Whether this app supports opening more than one
  644. // file.
  645. SupportsMultiOpen bool `json:"supportsMultiOpen,omitempty"`
  646. // SupportsOfflineCreate: Whether this app supports creating new files
  647. // when offline.
  648. SupportsOfflineCreate bool `json:"supportsOfflineCreate,omitempty"`
  649. // UseByDefault: Whether the app is selected as the default handler for
  650. // the types it supports.
  651. UseByDefault bool `json:"useByDefault,omitempty"`
  652. // ServerResponse contains the HTTP response code and headers from the
  653. // server.
  654. googleapi.ServerResponse `json:"-"`
  655. // ForceSendFields is a list of field names (e.g. "Authorized") to
  656. // unconditionally include in API requests. By default, fields with
  657. // empty values are omitted from API requests. However, any non-pointer,
  658. // non-interface field appearing in ForceSendFields will be sent to the
  659. // server regardless of whether the field is empty or not. This may be
  660. // used to include empty fields in Patch requests.
  661. ForceSendFields []string `json:"-"`
  662. // NullFields is a list of field names (e.g. "Authorized") to include in
  663. // API requests with the JSON null value. By default, fields with empty
  664. // values are omitted from API requests. However, any field with an
  665. // empty value appearing in NullFields will be sent to the server as
  666. // null. It is an error if a field in this list has a non-empty value.
  667. // This may be used to include null fields in Patch requests.
  668. NullFields []string `json:"-"`
  669. }
  670. func (s *App) MarshalJSON() ([]byte, error) {
  671. type NoMethod App
  672. raw := NoMethod(*s)
  673. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  674. }
  675. type AppIcons struct {
  676. // Category: Category of the icon. Allowed values are:
  677. // - application - icon for the application
  678. // - document - icon for a file associated with the app
  679. // - documentShared - icon for a shared file associated with the app
  680. Category string `json:"category,omitempty"`
  681. // IconUrl: URL for the icon.
  682. IconUrl string `json:"iconUrl,omitempty"`
  683. // Size: Size of the icon. Represented as the maximum of the width and
  684. // height.
  685. Size int64 `json:"size,omitempty"`
  686. // ForceSendFields is a list of field names (e.g. "Category") to
  687. // unconditionally include in API requests. By default, fields with
  688. // empty values are omitted from API requests. However, any non-pointer,
  689. // non-interface field appearing in ForceSendFields will be sent to the
  690. // server regardless of whether the field is empty or not. This may be
  691. // used to include empty fields in Patch requests.
  692. ForceSendFields []string `json:"-"`
  693. // NullFields is a list of field names (e.g. "Category") to include in
  694. // API requests with the JSON null value. By default, fields with empty
  695. // values are omitted from API requests. However, any field with an
  696. // empty value appearing in NullFields will be sent to the server as
  697. // null. It is an error if a field in this list has a non-empty value.
  698. // This may be used to include null fields in Patch requests.
  699. NullFields []string `json:"-"`
  700. }
  701. func (s *AppIcons) MarshalJSON() ([]byte, error) {
  702. type NoMethod AppIcons
  703. raw := NoMethod(*s)
  704. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  705. }
  706. // AppList: A list of third-party applications which the user has
  707. // installed or given access to Google Drive.
  708. type AppList struct {
  709. // DefaultAppIds: List of app IDs that the user has specified to use by
  710. // default. The list is in reverse-priority order (lowest to highest).
  711. DefaultAppIds []string `json:"defaultAppIds,omitempty"`
  712. // Etag: The ETag of the list.
  713. Etag string `json:"etag,omitempty"`
  714. // Items: The list of apps.
  715. Items []*App `json:"items,omitempty"`
  716. // Kind: This is always drive#appList.
  717. Kind string `json:"kind,omitempty"`
  718. // SelfLink: A link back to this list.
  719. SelfLink string `json:"selfLink,omitempty"`
  720. // ServerResponse contains the HTTP response code and headers from the
  721. // server.
  722. googleapi.ServerResponse `json:"-"`
  723. // ForceSendFields is a list of field names (e.g. "DefaultAppIds") to
  724. // unconditionally include in API requests. By default, fields with
  725. // empty values are omitted from API requests. However, any non-pointer,
  726. // non-interface field appearing in ForceSendFields will be sent to the
  727. // server regardless of whether the field is empty or not. This may be
  728. // used to include empty fields in Patch requests.
  729. ForceSendFields []string `json:"-"`
  730. // NullFields is a list of field names (e.g. "DefaultAppIds") to include
  731. // in API requests with the JSON null value. By default, fields with
  732. // empty values are omitted from API requests. However, any field with
  733. // an empty value appearing in NullFields will be sent to the server as
  734. // null. It is an error if a field in this list has a non-empty value.
  735. // This may be used to include null fields in Patch requests.
  736. NullFields []string `json:"-"`
  737. }
  738. func (s *AppList) MarshalJSON() ([]byte, error) {
  739. type NoMethod AppList
  740. raw := NoMethod(*s)
  741. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  742. }
  743. // Change: Representation of a change to a file or Team Drive.
  744. type Change struct {
  745. // Deleted: Whether the file or Team Drive has been removed from this
  746. // list of changes, for example by deletion or loss of access.
  747. Deleted bool `json:"deleted,omitempty"`
  748. // File: The updated state of the file. Present if the type is file and
  749. // the file has not been removed from this list of changes.
  750. File *File `json:"file,omitempty"`
  751. // FileId: The ID of the file associated with this change.
  752. FileId string `json:"fileId,omitempty"`
  753. // Id: The ID of the change.
  754. Id int64 `json:"id,omitempty,string"`
  755. // Kind: This is always drive#change.
  756. Kind string `json:"kind,omitempty"`
  757. // ModificationDate: The time of this modification.
  758. ModificationDate string `json:"modificationDate,omitempty"`
  759. // SelfLink: A link back to this change.
  760. SelfLink string `json:"selfLink,omitempty"`
  761. // TeamDrive: The updated state of the Team Drive. Present if the type
  762. // is teamDrive, the user is still a member of the Team Drive, and the
  763. // Team Drive has not been deleted.
  764. TeamDrive *TeamDrive `json:"teamDrive,omitempty"`
  765. // TeamDriveId: The ID of the Team Drive associated with this change.
  766. TeamDriveId string `json:"teamDriveId,omitempty"`
  767. // Type: The type of the change. Possible values are file and teamDrive.
  768. Type string `json:"type,omitempty"`
  769. // ServerResponse contains the HTTP response code and headers from the
  770. // server.
  771. googleapi.ServerResponse `json:"-"`
  772. // ForceSendFields is a list of field names (e.g. "Deleted") to
  773. // unconditionally include in API requests. By default, fields with
  774. // empty values are omitted from API requests. However, any non-pointer,
  775. // non-interface field appearing in ForceSendFields will be sent to the
  776. // server regardless of whether the field is empty or not. This may be
  777. // used to include empty fields in Patch requests.
  778. ForceSendFields []string `json:"-"`
  779. // NullFields is a list of field names (e.g. "Deleted") to include in
  780. // API requests with the JSON null value. By default, fields with empty
  781. // values are omitted from API requests. However, any field with an
  782. // empty value appearing in NullFields will be sent to the server as
  783. // null. It is an error if a field in this list has a non-empty value.
  784. // This may be used to include null fields in Patch requests.
  785. NullFields []string `json:"-"`
  786. }
  787. func (s *Change) MarshalJSON() ([]byte, error) {
  788. type NoMethod Change
  789. raw := NoMethod(*s)
  790. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  791. }
  792. // ChangeList: A list of changes for a user.
  793. type ChangeList struct {
  794. // Etag: The ETag of the list.
  795. Etag string `json:"etag,omitempty"`
  796. // Items: The list of changes. If nextPageToken is populated, then this
  797. // list may be incomplete and an additional page of results should be
  798. // fetched.
  799. Items []*Change `json:"items,omitempty"`
  800. // Kind: This is always drive#changeList.
  801. Kind string `json:"kind,omitempty"`
  802. // LargestChangeId: The current largest change ID.
  803. LargestChangeId int64 `json:"largestChangeId,omitempty,string"`
  804. // NewStartPageToken: The starting page token for future changes. This
  805. // will be present only if the end of the current changes list has been
  806. // reached.
  807. NewStartPageToken string `json:"newStartPageToken,omitempty"`
  808. // NextLink: A link to the next page of changes.
  809. NextLink string `json:"nextLink,omitempty"`
  810. // NextPageToken: The page token for the next page of changes. This will
  811. // be absent if the end of the changes list has been reached. If the
  812. // token is rejected for any reason, it should be discarded, and
  813. // pagination should be restarted from the first page of results.
  814. NextPageToken string `json:"nextPageToken,omitempty"`
  815. // SelfLink: A link back to this list.
  816. SelfLink string `json:"selfLink,omitempty"`
  817. // ServerResponse contains the HTTP response code and headers from the
  818. // server.
  819. googleapi.ServerResponse `json:"-"`
  820. // ForceSendFields is a list of field names (e.g. "Etag") to
  821. // unconditionally include in API requests. By default, fields with
  822. // empty values are omitted from API requests. However, any non-pointer,
  823. // non-interface field appearing in ForceSendFields will be sent to the
  824. // server regardless of whether the field is empty or not. This may be
  825. // used to include empty fields in Patch requests.
  826. ForceSendFields []string `json:"-"`
  827. // NullFields is a list of field names (e.g. "Etag") to include in API
  828. // requests with the JSON null value. By default, fields with empty
  829. // values are omitted from API requests. However, any field with an
  830. // empty value appearing in NullFields will be sent to the server as
  831. // null. It is an error if a field in this list has a non-empty value.
  832. // This may be used to include null fields in Patch requests.
  833. NullFields []string `json:"-"`
  834. }
  835. func (s *ChangeList) MarshalJSON() ([]byte, error) {
  836. type NoMethod ChangeList
  837. raw := NoMethod(*s)
  838. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  839. }
  840. // Channel: An notification channel used to watch for resource changes.
  841. type Channel struct {
  842. // Address: The address where notifications are delivered for this
  843. // channel.
  844. Address string `json:"address,omitempty"`
  845. // Expiration: Date and time of notification channel expiration,
  846. // expressed as a Unix timestamp, in milliseconds. Optional.
  847. Expiration int64 `json:"expiration,omitempty,string"`
  848. // Id: A UUID or similar unique string that identifies this channel.
  849. Id string `json:"id,omitempty"`
  850. // Kind: Identifies this as a notification channel used to watch for
  851. // changes to a resource. Value: the fixed string "api#channel".
  852. Kind string `json:"kind,omitempty"`
  853. // Params: Additional parameters controlling delivery channel behavior.
  854. // Optional.
  855. Params map[string]string `json:"params,omitempty"`
  856. // Payload: A Boolean value to indicate whether payload is wanted.
  857. // Optional.
  858. Payload bool `json:"payload,omitempty"`
  859. // ResourceId: An opaque ID that identifies the resource being watched
  860. // on this channel. Stable across different API versions.
  861. ResourceId string `json:"resourceId,omitempty"`
  862. // ResourceUri: A version-specific identifier for the watched resource.
  863. ResourceUri string `json:"resourceUri,omitempty"`
  864. // Token: An arbitrary string delivered to the target address with each
  865. // notification delivered over this channel. Optional.
  866. Token string `json:"token,omitempty"`
  867. // Type: The type of delivery mechanism used for this channel.
  868. Type string `json:"type,omitempty"`
  869. // ServerResponse contains the HTTP response code and headers from the
  870. // server.
  871. googleapi.ServerResponse `json:"-"`
  872. // ForceSendFields is a list of field names (e.g. "Address") to
  873. // unconditionally include in API requests. By default, fields with
  874. // empty values are omitted from API requests. However, any non-pointer,
  875. // non-interface field appearing in ForceSendFields will be sent to the
  876. // server regardless of whether the field is empty or not. This may be
  877. // used to include empty fields in Patch requests.
  878. ForceSendFields []string `json:"-"`
  879. // NullFields is a list of field names (e.g. "Address") to include in
  880. // API requests with the JSON null value. By default, fields with empty
  881. // values are omitted from API requests. However, any field with an
  882. // empty value appearing in NullFields will be sent to the server as
  883. // null. It is an error if a field in this list has a non-empty value.
  884. // This may be used to include null fields in Patch requests.
  885. NullFields []string `json:"-"`
  886. }
  887. func (s *Channel) MarshalJSON() ([]byte, error) {
  888. type NoMethod Channel
  889. raw := NoMethod(*s)
  890. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  891. }
  892. // ChildList: A list of children of a file.
  893. type ChildList struct {
  894. // Etag: The ETag of the list.
  895. Etag string `json:"etag,omitempty"`
  896. // Items: The list of children. If nextPageToken is populated, then this
  897. // list may be incomplete and an additional page of results should be
  898. // fetched.
  899. Items []*ChildReference `json:"items,omitempty"`
  900. // Kind: This is always drive#childList.
  901. Kind string `json:"kind,omitempty"`
  902. // NextLink: A link to the next page of children.
  903. NextLink string `json:"nextLink,omitempty"`
  904. // NextPageToken: The page token for the next page of children. This
  905. // will be absent if the end of the children list has been reached. If
  906. // the token is rejected for any reason, it should be discarded, and
  907. // pagination should be restarted from the first page of results.
  908. NextPageToken string `json:"nextPageToken,omitempty"`
  909. // SelfLink: A link back to this list.
  910. SelfLink string `json:"selfLink,omitempty"`
  911. // ServerResponse contains the HTTP response code and headers from the
  912. // server.
  913. googleapi.ServerResponse `json:"-"`
  914. // ForceSendFields is a list of field names (e.g. "Etag") to
  915. // unconditionally include in API requests. By default, fields with
  916. // empty values are omitted from API requests. However, any non-pointer,
  917. // non-interface field appearing in ForceSendFields will be sent to the
  918. // server regardless of whether the field is empty or not. This may be
  919. // used to include empty fields in Patch requests.
  920. ForceSendFields []string `json:"-"`
  921. // NullFields is a list of field names (e.g. "Etag") to include in API
  922. // requests with the JSON null value. By default, fields with empty
  923. // values are omitted from API requests. However, any field with an
  924. // empty value appearing in NullFields will be sent to the server as
  925. // null. It is an error if a field in this list has a non-empty value.
  926. // This may be used to include null fields in Patch requests.
  927. NullFields []string `json:"-"`
  928. }
  929. func (s *ChildList) MarshalJSON() ([]byte, error) {
  930. type NoMethod ChildList
  931. raw := NoMethod(*s)
  932. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  933. }
  934. // ChildReference: A reference to a folder's child.
  935. type ChildReference struct {
  936. // ChildLink: A link to the child.
  937. ChildLink string `json:"childLink,omitempty"`
  938. // Id: The ID of the child.
  939. Id string `json:"id,omitempty"`
  940. // Kind: This is always drive#childReference.
  941. Kind string `json:"kind,omitempty"`
  942. // SelfLink: A link back to this reference.
  943. SelfLink string `json:"selfLink,omitempty"`
  944. // ServerResponse contains the HTTP response code and headers from the
  945. // server.
  946. googleapi.ServerResponse `json:"-"`
  947. // ForceSendFields is a list of field names (e.g. "ChildLink") to
  948. // unconditionally include in API requests. By default, fields with
  949. // empty values are omitted from API requests. However, any non-pointer,
  950. // non-interface field appearing in ForceSendFields will be sent to the
  951. // server regardless of whether the field is empty or not. This may be
  952. // used to include empty fields in Patch requests.
  953. ForceSendFields []string `json:"-"`
  954. // NullFields is a list of field names (e.g. "ChildLink") to include in
  955. // API requests with the JSON null value. By default, fields with empty
  956. // values are omitted from API requests. However, any field with an
  957. // empty value appearing in NullFields will be sent to the server as
  958. // null. It is an error if a field in this list has a non-empty value.
  959. // This may be used to include null fields in Patch requests.
  960. NullFields []string `json:"-"`
  961. }
  962. func (s *ChildReference) MarshalJSON() ([]byte, error) {
  963. type NoMethod ChildReference
  964. raw := NoMethod(*s)
  965. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  966. }
  967. // Comment: A comment on a file in Google Drive.
  968. type Comment struct {
  969. // Anchor: A region of the document represented as a JSON string. See
  970. // anchor documentation for details on how to define and interpret
  971. // anchor properties.
  972. Anchor string `json:"anchor,omitempty"`
  973. // Author: The user who wrote this comment.
  974. Author *User `json:"author,omitempty"`
  975. // CommentId: The ID of the comment.
  976. CommentId string `json:"commentId,omitempty"`
  977. // Content: The plain text content used to create this comment. This is
  978. // not HTML safe and should only be used as a starting point to make
  979. // edits to a comment's content.
  980. Content string `json:"content,omitempty"`
  981. // Context: The context of the file which is being commented on.
  982. Context *CommentContext `json:"context,omitempty"`
  983. // CreatedDate: The date when this comment was first created.
  984. CreatedDate string `json:"createdDate,omitempty"`
  985. // Deleted: Whether this comment has been deleted. If a comment has been
  986. // deleted the content will be cleared and this will only represent a
  987. // comment that once existed.
  988. Deleted bool `json:"deleted,omitempty"`
  989. // FileId: The file which this comment is addressing.
  990. FileId string `json:"fileId,omitempty"`
  991. // FileTitle: The title of the file which this comment is addressing.
  992. FileTitle string `json:"fileTitle,omitempty"`
  993. // HtmlContent: HTML formatted content for this comment.
  994. HtmlContent string `json:"htmlContent,omitempty"`
  995. // Kind: This is always drive#comment.
  996. Kind string `json:"kind,omitempty"`
  997. // ModifiedDate: The date when this comment or any of its replies were
  998. // last modified.
  999. ModifiedDate string `json:"modifiedDate,omitempty"`
  1000. // Replies: Replies to this post.
  1001. Replies []*CommentReply `json:"replies,omitempty"`
  1002. // SelfLink: A link back to this comment.
  1003. SelfLink string `json:"selfLink,omitempty"`
  1004. // Status: The status of this comment. Status can be changed by posting
  1005. // a reply to a comment with the desired status.
  1006. // - "open" - The comment is still open.
  1007. // - "resolved" - The comment has been resolved by one of its replies.
  1008. Status string `json:"status,omitempty"`
  1009. // ServerResponse contains the HTTP response code and headers from the
  1010. // server.
  1011. googleapi.ServerResponse `json:"-"`
  1012. // ForceSendFields is a list of field names (e.g. "Anchor") to
  1013. // unconditionally include in API requests. By default, fields with
  1014. // empty values are omitted from API requests. However, any non-pointer,
  1015. // non-interface field appearing in ForceSendFields will be sent to the
  1016. // server regardless of whether the field is empty or not. This may be
  1017. // used to include empty fields in Patch requests.
  1018. ForceSendFields []string `json:"-"`
  1019. // NullFields is a list of field names (e.g. "Anchor") to include in API
  1020. // requests with the JSON null value. By default, fields with empty
  1021. // values are omitted from API requests. However, any field with an
  1022. // empty value appearing in NullFields will be sent to the server as
  1023. // null. It is an error if a field in this list has a non-empty value.
  1024. // This may be used to include null fields in Patch requests.
  1025. NullFields []string `json:"-"`
  1026. }
  1027. func (s *Comment) MarshalJSON() ([]byte, error) {
  1028. type NoMethod Comment
  1029. raw := NoMethod(*s)
  1030. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1031. }
  1032. // CommentContext: The context of the file which is being commented on.
  1033. type CommentContext struct {
  1034. // Type: The MIME type of the context snippet.
  1035. Type string `json:"type,omitempty"`
  1036. // Value: Data representation of the segment of the file being commented
  1037. // on. In the case of a text file for example, this would be the actual
  1038. // text that the comment is about.
  1039. Value string `json:"value,omitempty"`
  1040. // ForceSendFields is a list of field names (e.g. "Type") to
  1041. // unconditionally include in API requests. By default, fields with
  1042. // empty values are omitted from API requests. However, any non-pointer,
  1043. // non-interface field appearing in ForceSendFields will be sent to the
  1044. // server regardless of whether the field is empty or not. This may be
  1045. // used to include empty fields in Patch requests.
  1046. ForceSendFields []string `json:"-"`
  1047. // NullFields is a list of field names (e.g. "Type") to include in API
  1048. // requests with the JSON null value. By default, fields with empty
  1049. // values are omitted from API requests. However, any field with an
  1050. // empty value appearing in NullFields will be sent to the server as
  1051. // null. It is an error if a field in this list has a non-empty value.
  1052. // This may be used to include null fields in Patch requests.
  1053. NullFields []string `json:"-"`
  1054. }
  1055. func (s *CommentContext) MarshalJSON() ([]byte, error) {
  1056. type NoMethod CommentContext
  1057. raw := NoMethod(*s)
  1058. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1059. }
  1060. // CommentList: A list of comments on a file in Google Drive.
  1061. type CommentList struct {
  1062. // Items: The list of comments. If nextPageToken is populated, then this
  1063. // list may be incomplete and an additional page of results should be
  1064. // fetched.
  1065. Items []*Comment `json:"items,omitempty"`
  1066. // Kind: This is always drive#commentList.
  1067. Kind string `json:"kind,omitempty"`
  1068. // NextLink: A link to the next page of comments.
  1069. NextLink string `json:"nextLink,omitempty"`
  1070. // NextPageToken: The page token for the next page of comments. This
  1071. // will be absent if the end of the comments list has been reached. If
  1072. // the token is rejected for any reason, it should be discarded, and
  1073. // pagination should be restarted from the first page of results.
  1074. NextPageToken string `json:"nextPageToken,omitempty"`
  1075. // SelfLink: A link back to this list.
  1076. SelfLink string `json:"selfLink,omitempty"`
  1077. // ServerResponse contains the HTTP response code and headers from the
  1078. // server.
  1079. googleapi.ServerResponse `json:"-"`
  1080. // ForceSendFields is a list of field names (e.g. "Items") to
  1081. // unconditionally include in API requests. By default, fields with
  1082. // empty values are omitted from API requests. However, any non-pointer,
  1083. // non-interface field appearing in ForceSendFields will be sent to the
  1084. // server regardless of whether the field is empty or not. This may be
  1085. // used to include empty fields in Patch requests.
  1086. ForceSendFields []string `json:"-"`
  1087. // NullFields is a list of field names (e.g. "Items") to include in API
  1088. // requests with the JSON null value. By default, fields with empty
  1089. // values are omitted from API requests. However, any field with an
  1090. // empty value appearing in NullFields will be sent to the server as
  1091. // null. It is an error if a field in this list has a non-empty value.
  1092. // This may be used to include null fields in Patch requests.
  1093. NullFields []string `json:"-"`
  1094. }
  1095. func (s *CommentList) MarshalJSON() ([]byte, error) {
  1096. type NoMethod CommentList
  1097. raw := NoMethod(*s)
  1098. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1099. }
  1100. // CommentReply: A comment on a file in Google Drive.
  1101. type CommentReply struct {
  1102. // Author: The user who wrote this reply.
  1103. Author *User `json:"author,omitempty"`
  1104. // Content: The plain text content used to create this reply. This is
  1105. // not HTML safe and should only be used as a starting point to make
  1106. // edits to a reply's content. This field is required on inserts if no
  1107. // verb is specified (resolve/reopen).
  1108. Content string `json:"content,omitempty"`
  1109. // CreatedDate: The date when this reply was first created.
  1110. CreatedDate string `json:"createdDate,omitempty"`
  1111. // Deleted: Whether this reply has been deleted. If a reply has been
  1112. // deleted the content will be cleared and this will only represent a
  1113. // reply that once existed.
  1114. Deleted bool `json:"deleted,omitempty"`
  1115. // HtmlContent: HTML formatted content for this reply.
  1116. HtmlContent string `json:"htmlContent,omitempty"`
  1117. // Kind: This is always drive#commentReply.
  1118. Kind string `json:"kind,omitempty"`
  1119. // ModifiedDate: The date when this reply was last modified.
  1120. ModifiedDate string `json:"modifiedDate,omitempty"`
  1121. // ReplyId: The ID of the reply.
  1122. ReplyId string `json:"replyId,omitempty"`
  1123. // Verb: The action this reply performed to the parent comment. When
  1124. // creating a new reply this is the action to be perform to the parent
  1125. // comment. Possible values are:
  1126. // - "resolve" - To resolve a comment.
  1127. // - "reopen" - To reopen (un-resolve) a comment.
  1128. Verb string `json:"verb,omitempty"`
  1129. // ServerResponse contains the HTTP response code and headers from the
  1130. // server.
  1131. googleapi.ServerResponse `json:"-"`
  1132. // ForceSendFields is a list of field names (e.g. "Author") to
  1133. // unconditionally include in API requests. By default, fields with
  1134. // empty values are omitted from API requests. However, any non-pointer,
  1135. // non-interface field appearing in ForceSendFields will be sent to the
  1136. // server regardless of whether the field is empty or not. This may be
  1137. // used to include empty fields in Patch requests.
  1138. ForceSendFields []string `json:"-"`
  1139. // NullFields is a list of field names (e.g. "Author") to include in API
  1140. // requests with the JSON null value. By default, fields with empty
  1141. // values are omitted from API requests. However, any field with an
  1142. // empty value appearing in NullFields will be sent to the server as
  1143. // null. It is an error if a field in this list has a non-empty value.
  1144. // This may be used to include null fields in Patch requests.
  1145. NullFields []string `json:"-"`
  1146. }
  1147. func (s *CommentReply) MarshalJSON() ([]byte, error) {
  1148. type NoMethod CommentReply
  1149. raw := NoMethod(*s)
  1150. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1151. }
  1152. // CommentReplyList: A list of replies to a comment on a file in Google
  1153. // Drive.
  1154. type CommentReplyList struct {
  1155. // Items: The list of replies. If nextPageToken is populated, then this
  1156. // list may be incomplete and an additional page of results should be
  1157. // fetched.
  1158. Items []*CommentReply `json:"items,omitempty"`
  1159. // Kind: This is always drive#commentReplyList.
  1160. Kind string `json:"kind,omitempty"`
  1161. // NextLink: A link to the next page of replies.
  1162. NextLink string `json:"nextLink,omitempty"`
  1163. // NextPageToken: The page token for the next page of replies. This will
  1164. // be absent if the end of the replies list has been reached. If the
  1165. // token is rejected for any reason, it should be discarded, and
  1166. // pagination should be restarted from the first page of results.
  1167. NextPageToken string `json:"nextPageToken,omitempty"`
  1168. // SelfLink: A link back to this list.
  1169. SelfLink string `json:"selfLink,omitempty"`
  1170. // ServerResponse contains the HTTP response code and headers from the
  1171. // server.
  1172. googleapi.ServerResponse `json:"-"`
  1173. // ForceSendFields is a list of field names (e.g. "Items") to
  1174. // unconditionally include in API requests. By default, fields with
  1175. // empty values are omitted from API requests. However, any non-pointer,
  1176. // non-interface field appearing in ForceSendFields will be sent to the
  1177. // server regardless of whether the field is empty or not. This may be
  1178. // used to include empty fields in Patch requests.
  1179. ForceSendFields []string `json:"-"`
  1180. // NullFields is a list of field names (e.g. "Items") to include in API
  1181. // requests with the JSON null value. By default, fields with empty
  1182. // values are omitted from API requests. However, any field with an
  1183. // empty value appearing in NullFields will be sent to the server as
  1184. // null. It is an error if a field in this list has a non-empty value.
  1185. // This may be used to include null fields in Patch requests.
  1186. NullFields []string `json:"-"`
  1187. }
  1188. func (s *CommentReplyList) MarshalJSON() ([]byte, error) {
  1189. type NoMethod CommentReplyList
  1190. raw := NoMethod(*s)
  1191. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1192. }
  1193. // File: The metadata for a file.
  1194. type File struct {
  1195. // AlternateLink: A link for opening the file in a relevant Google
  1196. // editor or viewer.
  1197. AlternateLink string `json:"alternateLink,omitempty"`
  1198. // AppDataContents: Whether this file is in the Application Data folder.
  1199. AppDataContents bool `json:"appDataContents,omitempty"`
  1200. // CanComment: Deprecated: use capabilities/canComment.
  1201. CanComment bool `json:"canComment,omitempty"`
  1202. // CanReadRevisions: Deprecated: use capabilities/canReadRevisions.
  1203. CanReadRevisions bool `json:"canReadRevisions,omitempty"`
  1204. // Capabilities: Capabilities the current user has on this file. Each
  1205. // capability corresponds to a fine-grained action that a user may take.
  1206. Capabilities *FileCapabilities `json:"capabilities,omitempty"`
  1207. // CopyRequiresWriterPermission: Whether the options to copy, print, or
  1208. // download this file, should be disabled for readers and commenters.
  1209. CopyRequiresWriterPermission bool `json:"copyRequiresWriterPermission,omitempty"`
  1210. // Copyable: Deprecated: use capabilities/canCopy.
  1211. Copyable bool `json:"copyable,omitempty"`
  1212. // CreatedDate: Create time for this file (formatted RFC 3339
  1213. // timestamp).
  1214. CreatedDate string `json:"createdDate,omitempty"`
  1215. // DefaultOpenWithLink: A link to open this file with the user's default
  1216. // app for this file. Only populated when the drive.apps.readonly scope
  1217. // is used.
  1218. DefaultOpenWithLink string `json:"defaultOpenWithLink,omitempty"`
  1219. // Description: A short description of the file.
  1220. Description string `json:"description,omitempty"`
  1221. // DownloadUrl: Short lived download URL for the file. This field is
  1222. // only populated for files with content stored in Drive; it is not
  1223. // populated for Google Docs or shortcut files.
  1224. DownloadUrl string `json:"downloadUrl,omitempty"`
  1225. // Editable: Deprecated: use capabilities/canEdit.
  1226. Editable bool `json:"editable,omitempty"`
  1227. // EmbedLink: A link for embedding the file.
  1228. EmbedLink string `json:"embedLink,omitempty"`
  1229. // Etag: ETag of the file.
  1230. Etag string `json:"etag,omitempty"`
  1231. // ExplicitlyTrashed: Whether this file has been explicitly trashed, as
  1232. // opposed to recursively trashed.
  1233. ExplicitlyTrashed bool `json:"explicitlyTrashed,omitempty"`
  1234. // ExportLinks: Links for exporting Google Docs to specific formats.
  1235. ExportLinks map[string]string `json:"exportLinks,omitempty"`
  1236. // FileExtension: The final component of fullFileExtension with trailing
  1237. // text that does not appear to be part of the extension removed. This
  1238. // field is only populated for files with content stored in Drive; it is
  1239. // not populated for Google Docs or shortcut files.
  1240. FileExtension string `json:"fileExtension,omitempty"`
  1241. // FileSize: The size of the file in bytes. This field is only populated
  1242. // for files with content stored in Drive; it is not populated for
  1243. // Google Docs or shortcut files.
  1244. FileSize int64 `json:"fileSize,omitempty,string"`
  1245. // FolderColorRgb: Folder color as an RGB hex string if the file is a
  1246. // folder. The list of supported colors is available in the
  1247. // folderColorPalette field of the About resource. If an unsupported
  1248. // color is specified, it will be changed to the closest color in the
  1249. // palette. Not populated for Team Drive files.
  1250. FolderColorRgb string `json:"folderColorRgb,omitempty"`
  1251. // FullFileExtension: The full file extension; extracted from the title.
  1252. // May contain multiple concatenated extensions, such as "tar.gz".
  1253. // Removing an extension from the title does not clear this field;
  1254. // however, changing the extension on the title does update this field.
  1255. // This field is only populated for files with content stored in Drive;
  1256. // it is not populated for Google Docs or shortcut files.
  1257. FullFileExtension string `json:"fullFileExtension,omitempty"`
  1258. // HasAugmentedPermissions: Whether any users are granted file access
  1259. // directly on this file. This field is only populated for Team Drive
  1260. // files.
  1261. HasAugmentedPermissions bool `json:"hasAugmentedPermissions,omitempty"`
  1262. // HasThumbnail: Whether this file has a thumbnail. This does not
  1263. // indicate whether the requesting app has access to the thumbnail. To
  1264. // check access, look for the presence of the thumbnailLink field.
  1265. HasThumbnail bool `json:"hasThumbnail,omitempty"`
  1266. // HeadRevisionId: The ID of the file's head revision. This field is
  1267. // only populated for files with content stored in Drive; it is not
  1268. // populated for Google Docs or shortcut files.
  1269. HeadRevisionId string `json:"headRevisionId,omitempty"`
  1270. // IconLink: A link to the file's icon.
  1271. IconLink string `json:"iconLink,omitempty"`
  1272. // Id: The ID of the file.
  1273. Id string `json:"id,omitempty"`
  1274. // ImageMediaMetadata: Metadata about image media. This will only be
  1275. // present for image types, and its contents will depend on what can be
  1276. // parsed from the image content.
  1277. ImageMediaMetadata *FileImageMediaMetadata `json:"imageMediaMetadata,omitempty"`
  1278. // IndexableText: Indexable text attributes for the file (can only be
  1279. // written)
  1280. IndexableText *FileIndexableText `json:"indexableText,omitempty"`
  1281. // IsAppAuthorized: Whether the file was created or opened by the
  1282. // requesting app.
  1283. IsAppAuthorized bool `json:"isAppAuthorized,omitempty"`
  1284. // Kind: The type of file. This is always drive#file.
  1285. Kind string `json:"kind,omitempty"`
  1286. // Labels: A group of labels for the file.
  1287. Labels *FileLabels `json:"labels,omitempty"`
  1288. // LastModifyingUser: The last user to modify this file.
  1289. LastModifyingUser *User `json:"lastModifyingUser,omitempty"`
  1290. // LastModifyingUserName: Name of the last user to modify this file.
  1291. LastModifyingUserName string `json:"lastModifyingUserName,omitempty"`
  1292. // LastViewedByMeDate: Last time this file was viewed by the user
  1293. // (formatted RFC 3339 timestamp).
  1294. LastViewedByMeDate string `json:"lastViewedByMeDate,omitempty"`
  1295. // MarkedViewedByMeDate: Deprecated.
  1296. MarkedViewedByMeDate string `json:"markedViewedByMeDate,omitempty"`
  1297. // Md5Checksum: An MD5 checksum for the content of this file. This field
  1298. // is only populated for files with content stored in Drive; it is not
  1299. // populated for Google Docs or shortcut files.
  1300. Md5Checksum string `json:"md5Checksum,omitempty"`
  1301. // MimeType: The MIME type of the file. This is only mutable on update
  1302. // when uploading new content. This field can be left blank, and the
  1303. // mimetype will be determined from the uploaded content's MIME type.
  1304. MimeType string `json:"mimeType,omitempty"`
  1305. // ModifiedByMeDate: Last time this file was modified by the user
  1306. // (formatted RFC 3339 timestamp). Note that setting modifiedDate will
  1307. // also update the modifiedByMe date for the user which set the date.
  1308. ModifiedByMeDate string `json:"modifiedByMeDate,omitempty"`
  1309. // ModifiedDate: Last time this file was modified by anyone (formatted
  1310. // RFC 3339 timestamp). This is only mutable on update when the
  1311. // setModifiedDate parameter is set.
  1312. ModifiedDate string `json:"modifiedDate,omitempty"`
  1313. // OpenWithLinks: A map of the id of each of the user's apps to a link
  1314. // to open this file with that app. Only populated when the
  1315. // drive.apps.readonly scope is used.
  1316. OpenWithLinks map[string]string `json:"openWithLinks,omitempty"`
  1317. // OriginalFilename: The original filename of the uploaded content if
  1318. // available, or else the original value of the title field. This is
  1319. // only available for files with binary content in Drive.
  1320. OriginalFilename string `json:"originalFilename,omitempty"`
  1321. // OwnedByMe: Whether the file is owned by the current user. Not
  1322. // populated for Team Drive files.
  1323. OwnedByMe bool `json:"ownedByMe,omitempty"`
  1324. // OwnerNames: Name(s) of the owner(s) of this file. Not populated for
  1325. // Team Drive files.
  1326. OwnerNames []string `json:"ownerNames,omitempty"`
  1327. // Owners: The owner(s) of this file. Not populated for Team Drive
  1328. // files.
  1329. Owners []*User `json:"owners,omitempty"`
  1330. // Parents: Collection of parent folders which contain this file.
  1331. // If not specified as part of an insert request, the file will be
  1332. // placed directly in the user's My Drive folder. If not specified as
  1333. // part of a copy request, the file will inherit any discoverable
  1334. // parents of the source file. Update requests can also use the
  1335. // addParents and removeParents parameters to modify the parents list.
  1336. Parents []*ParentReference `json:"parents,omitempty"`
  1337. // PermissionIds: List of permission IDs for users with access to this
  1338. // file.
  1339. PermissionIds []string `json:"permissionIds,omitempty"`
  1340. // Permissions: The list of permissions for users with access to this
  1341. // file. Not populated for Team Drive files.
  1342. Permissions []*Permission `json:"permissions,omitempty"`
  1343. // Properties: The list of properties.
  1344. Properties []*Property `json:"properties,omitempty"`
  1345. // QuotaBytesUsed: The number of quota bytes used by this file.
  1346. QuotaBytesUsed int64 `json:"quotaBytesUsed,omitempty,string"`
  1347. // SelfLink: A link back to this file.
  1348. SelfLink string `json:"selfLink,omitempty"`
  1349. // Shareable: Deprecated: use capabilities/canShare.
  1350. Shareable bool `json:"shareable,omitempty"`
  1351. // Shared: Whether the file has been shared. Not populated for Team
  1352. // Drive files.
  1353. Shared bool `json:"shared,omitempty"`
  1354. // SharedWithMeDate: Time at which this file was shared with the user
  1355. // (formatted RFC 3339 timestamp).
  1356. SharedWithMeDate string `json:"sharedWithMeDate,omitempty"`
  1357. // SharingUser: User that shared the item with the current user, if
  1358. // available.
  1359. SharingUser *User `json:"sharingUser,omitempty"`
  1360. // Spaces: The list of spaces which contain the file. Supported values
  1361. // are 'drive', 'appDataFolder' and 'photos'.
  1362. Spaces []string `json:"spaces,omitempty"`
  1363. // TeamDriveId: ID of the Team Drive the file resides in.
  1364. TeamDriveId string `json:"teamDriveId,omitempty"`
  1365. // Thumbnail: A thumbnail for the file. This will only be used if Drive
  1366. // cannot generate a standard thumbnail.
  1367. Thumbnail *FileThumbnail `json:"thumbnail,omitempty"`
  1368. // ThumbnailLink: A short-lived link to the file's thumbnail. Typically
  1369. // lasts on the order of hours. Only populated when the requesting app
  1370. // can access the file's content.
  1371. ThumbnailLink string `json:"thumbnailLink,omitempty"`
  1372. // ThumbnailVersion: The thumbnail version for use in thumbnail cache
  1373. // invalidation.
  1374. ThumbnailVersion int64 `json:"thumbnailVersion,omitempty,string"`
  1375. // Title: The title of this file. Note that for immutable items such as
  1376. // the top level folders of Team Drives, My Drive root folder, and
  1377. // Application Data folder the title is constant.
  1378. Title string `json:"title,omitempty"`
  1379. // TrashedDate: The time that the item was trashed (formatted RFC 3339
  1380. // timestamp). Only populated for Team Drive files.
  1381. TrashedDate string `json:"trashedDate,omitempty"`
  1382. // TrashingUser: If the file has been explicitly trashed, the user who
  1383. // trashed it. Only populated for Team Drive files.
  1384. TrashingUser *User `json:"trashingUser,omitempty"`
  1385. // UserPermission: The permissions for the authenticated user on this
  1386. // file.
  1387. UserPermission *Permission `json:"userPermission,omitempty"`
  1388. // Version: A monotonically increasing version number for the file. This
  1389. // reflects every change made to the file on the server, even those not
  1390. // visible to the requesting user.
  1391. Version int64 `json:"version,omitempty,string"`
  1392. // VideoMediaMetadata: Metadata about video media. This will only be
  1393. // present for video types.
  1394. VideoMediaMetadata *FileVideoMediaMetadata `json:"videoMediaMetadata,omitempty"`
  1395. // WebContentLink: A link for downloading the content of the file in a
  1396. // browser using cookie based authentication. In cases where the content
  1397. // is shared publicly, the content can be downloaded without any
  1398. // credentials.
  1399. WebContentLink string `json:"webContentLink,omitempty"`
  1400. // WebViewLink: A link only available on public folders for viewing
  1401. // their static web assets (HTML, CSS, JS, etc) via Google Drive's
  1402. // Website Hosting.
  1403. WebViewLink string `json:"webViewLink,omitempty"`
  1404. // WritersCanShare: Whether writers can share the document with other
  1405. // users. Not populated for Team Drive files.
  1406. WritersCanShare bool `json:"writersCanShare,omitempty"`
  1407. // ServerResponse contains the HTTP response code and headers from the
  1408. // server.
  1409. googleapi.ServerResponse `json:"-"`
  1410. // ForceSendFields is a list of field names (e.g. "AlternateLink") to
  1411. // unconditionally include in API requests. By default, fields with
  1412. // empty values are omitted from API requests. However, any non-pointer,
  1413. // non-interface field appearing in ForceSendFields will be sent to the
  1414. // server regardless of whether the field is empty or not. This may be
  1415. // used to include empty fields in Patch requests.
  1416. ForceSendFields []string `json:"-"`
  1417. // NullFields is a list of field names (e.g. "AlternateLink") to include
  1418. // in API requests with the JSON null value. By default, fields with
  1419. // empty values are omitted from API requests. However, any field with
  1420. // an empty value appearing in NullFields will be sent to the server as
  1421. // null. It is an error if a field in this list has a non-empty value.
  1422. // This may be used to include null fields in Patch requests.
  1423. NullFields []string `json:"-"`
  1424. }
  1425. func (s *File) MarshalJSON() ([]byte, error) {
  1426. type NoMethod File
  1427. raw := NoMethod(*s)
  1428. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1429. }
  1430. // FileCapabilities: Capabilities the current user has on this file.
  1431. // Each capability corresponds to a fine-grained action that a user may
  1432. // take.
  1433. type FileCapabilities struct {
  1434. // CanAddChildren: Whether the current user can add children to this
  1435. // folder. This is always false when the item is not a folder.
  1436. CanAddChildren bool `json:"canAddChildren,omitempty"`
  1437. // CanChangeCopyRequiresWriterPermission: Whether the current user can
  1438. // change the copyRequiresWriterPermission restriction of this file.
  1439. CanChangeCopyRequiresWriterPermission bool `json:"canChangeCopyRequiresWriterPermission,omitempty"`
  1440. // CanChangeRestrictedDownload: Deprecated
  1441. CanChangeRestrictedDownload bool `json:"canChangeRestrictedDownload,omitempty"`
  1442. // CanComment: Whether the current user can comment on this file.
  1443. CanComment bool `json:"canComment,omitempty"`
  1444. // CanCopy: Whether the current user can copy this file. For a Team
  1445. // Drive item, whether the current user can copy non-folder descendants
  1446. // of this item, or this item itself if it is not a folder.
  1447. CanCopy bool `json:"canCopy,omitempty"`
  1448. // CanDelete: Whether the current user can delete this file.
  1449. CanDelete bool `json:"canDelete,omitempty"`
  1450. // CanDeleteChildren: Whether the current user can delete children of
  1451. // this folder. This is false when the item is not a folder. Only
  1452. // populated for Team Drive items.
  1453. CanDeleteChildren bool `json:"canDeleteChildren,omitempty"`
  1454. // CanDownload: Whether the current user can download this file.
  1455. CanDownload bool `json:"canDownload,omitempty"`
  1456. // CanEdit: Whether the current user can edit this file.
  1457. CanEdit bool `json:"canEdit,omitempty"`
  1458. // CanListChildren: Whether the current user can list the children of
  1459. // this folder. This is always false when the item is not a folder.
  1460. CanListChildren bool `json:"canListChildren,omitempty"`
  1461. // CanMoveChildrenOutOfTeamDrive: Whether the current user can move
  1462. // children of this folder outside of the Team Drive. This is false when
  1463. // the item is not a folder. Only populated for Team Drive items.
  1464. CanMoveChildrenOutOfTeamDrive bool `json:"canMoveChildrenOutOfTeamDrive,omitempty"`
  1465. // CanMoveChildrenWithinTeamDrive: Whether the current user can move
  1466. // children of this folder within the Team Drive. This is false when the
  1467. // item is not a folder. Only populated for Team Drive items.
  1468. CanMoveChildrenWithinTeamDrive bool `json:"canMoveChildrenWithinTeamDrive,omitempty"`
  1469. // CanMoveItemIntoTeamDrive: Whether the current user can move this item
  1470. // into a Team Drive. If the item is in a Team Drive, this field is
  1471. // equivalent to canMoveTeamDriveItem.
  1472. CanMoveItemIntoTeamDrive bool `json:"canMoveItemIntoTeamDrive,omitempty"`
  1473. // CanMoveItemOutOfTeamDrive: Whether the current user can move this
  1474. // Team Drive item outside of this Team Drive by changing its parent.
  1475. // Note that a request to change the parent of the item may still fail
  1476. // depending on the new parent that is being added. Only populated for
  1477. // Team Drive items.
  1478. CanMoveItemOutOfTeamDrive bool `json:"canMoveItemOutOfTeamDrive,omitempty"`
  1479. // CanMoveItemWithinTeamDrive: Whether the current user can move this
  1480. // Team Drive item within this Team Drive. Note that a request to change
  1481. // the parent of the item may still fail depending on the new parent
  1482. // that is being added. Only populated for Team Drive items.
  1483. CanMoveItemWithinTeamDrive bool `json:"canMoveItemWithinTeamDrive,omitempty"`
  1484. // CanMoveTeamDriveItem: Deprecated - use canMoveItemWithinTeamDrive or
  1485. // canMoveItemOutOfTeamDrive instead.
  1486. CanMoveTeamDriveItem bool `json:"canMoveTeamDriveItem,omitempty"`
  1487. // CanReadRevisions: Whether the current user can read the revisions
  1488. // resource of this file. For a Team Drive item, whether revisions of
  1489. // non-folder descendants of this item, or this item itself if it is not
  1490. // a folder, can be read.
  1491. CanReadRevisions bool `json:"canReadRevisions,omitempty"`
  1492. // CanReadTeamDrive: Whether the current user can read the Team Drive to
  1493. // which this file belongs. Only populated for Team Drive files.
  1494. CanReadTeamDrive bool `json:"canReadTeamDrive,omitempty"`
  1495. // CanRemoveChildren: Whether the current user can remove children from
  1496. // this folder. This is always false when the item is not a folder. For
  1497. // Team Drive items, use canDeleteChildren or canTrashChildren instead.
  1498. CanRemoveChildren bool `json:"canRemoveChildren,omitempty"`
  1499. // CanRename: Whether the current user can rename this file.
  1500. CanRename bool `json:"canRename,omitempty"`
  1501. // CanShare: Whether the current user can modify the sharing settings
  1502. // for this file.
  1503. CanShare bool `json:"canShare,omitempty"`
  1504. // CanTrash: Whether the current user can move this file to trash.
  1505. CanTrash bool `json:"canTrash,omitempty"`
  1506. // CanTrashChildren: Whether the current user can trash children of this
  1507. // folder. This is false when the item is not a folder. Only populated
  1508. // for Team Drive items.
  1509. CanTrashChildren bool `json:"canTrashChildren,omitempty"`
  1510. // CanUntrash: Whether the current user can restore this file from
  1511. // trash.
  1512. CanUntrash bool `json:"canUntrash,omitempty"`
  1513. // ForceSendFields is a list of field names (e.g. "CanAddChildren") to
  1514. // unconditionally include in API requests. By default, fields with
  1515. // empty values are omitted from API requests. However, any non-pointer,
  1516. // non-interface field appearing in ForceSendFields will be sent to the
  1517. // server regardless of whether the field is empty or not. This may be
  1518. // used to include empty fields in Patch requests.
  1519. ForceSendFields []string `json:"-"`
  1520. // NullFields is a list of field names (e.g. "CanAddChildren") to
  1521. // include in API requests with the JSON null value. By default, fields
  1522. // with empty values are omitted from API requests. However, any field
  1523. // with an empty value appearing in NullFields will be sent to the
  1524. // server as null. It is an error if a field in this list has a
  1525. // non-empty value. This may be used to include null fields in Patch
  1526. // requests.
  1527. NullFields []string `json:"-"`
  1528. }
  1529. func (s *FileCapabilities) MarshalJSON() ([]byte, error) {
  1530. type NoMethod FileCapabilities
  1531. raw := NoMethod(*s)
  1532. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1533. }
  1534. // FileImageMediaMetadata: Metadata about image media. This will only be
  1535. // present for image types, and its contents will depend on what can be
  1536. // parsed from the image content.
  1537. type FileImageMediaMetadata struct {
  1538. // Aperture: The aperture used to create the photo (f-number).
  1539. Aperture float64 `json:"aperture,omitempty"`
  1540. // CameraMake: The make of the camera used to create the photo.
  1541. CameraMake string `json:"cameraMake,omitempty"`
  1542. // CameraModel: The model of the camera used to create the photo.
  1543. CameraModel string `json:"cameraModel,omitempty"`
  1544. // ColorSpace: The color space of the photo.
  1545. ColorSpace string `json:"colorSpace,omitempty"`
  1546. // Date: The date and time the photo was taken (EXIF format timestamp).
  1547. Date string `json:"date,omitempty"`
  1548. // ExposureBias: The exposure bias of the photo (APEX value).
  1549. ExposureBias float64 `json:"exposureBias,omitempty"`
  1550. // ExposureMode: The exposure mode used to create the photo.
  1551. ExposureMode string `json:"exposureMode,omitempty"`
  1552. // ExposureTime: The length of the exposure, in seconds.
  1553. ExposureTime float64 `json:"exposureTime,omitempty"`
  1554. // FlashUsed: Whether a flash was used to create the photo.
  1555. FlashUsed bool `json:"flashUsed,omitempty"`
  1556. // FocalLength: The focal length used to create the photo, in
  1557. // millimeters.
  1558. FocalLength float64 `json:"focalLength,omitempty"`
  1559. // Height: The height of the image in pixels.
  1560. Height int64 `json:"height,omitempty"`
  1561. // IsoSpeed: The ISO speed used to create the photo.
  1562. IsoSpeed int64 `json:"isoSpeed,omitempty"`
  1563. // Lens: The lens used to create the photo.
  1564. Lens string `json:"lens,omitempty"`
  1565. // Location: Geographic location information stored in the image.
  1566. Location *FileImageMediaMetadataLocation `json:"location,omitempty"`
  1567. // MaxApertureValue: The smallest f-number of the lens at the focal
  1568. // length used to create the photo (APEX value).
  1569. MaxApertureValue float64 `json:"maxApertureValue,omitempty"`
  1570. // MeteringMode: The metering mode used to create the photo.
  1571. MeteringMode string `json:"meteringMode,omitempty"`
  1572. // Rotation: The rotation in clockwise degrees from the image's original
  1573. // orientation.
  1574. Rotation int64 `json:"rotation,omitempty"`
  1575. // Sensor: The type of sensor used to create the photo.
  1576. Sensor string `json:"sensor,omitempty"`
  1577. // SubjectDistance: The distance to the subject of the photo, in meters.
  1578. SubjectDistance int64 `json:"subjectDistance,omitempty"`
  1579. // WhiteBalance: The white balance mode used to create the photo.
  1580. WhiteBalance string `json:"whiteBalance,omitempty"`
  1581. // Width: The width of the image in pixels.
  1582. Width int64 `json:"width,omitempty"`
  1583. // ForceSendFields is a list of field names (e.g. "Aperture") to
  1584. // unconditionally include in API requests. By default, fields with
  1585. // empty values are omitted from API requests. However, any non-pointer,
  1586. // non-interface field appearing in ForceSendFields will be sent to the
  1587. // server regardless of whether the field is empty or not. This may be
  1588. // used to include empty fields in Patch requests.
  1589. ForceSendFields []string `json:"-"`
  1590. // NullFields is a list of field names (e.g. "Aperture") to include in
  1591. // API requests with the JSON null value. By default, fields with empty
  1592. // values are omitted from API requests. However, any field with an
  1593. // empty value appearing in NullFields will be sent to the server as
  1594. // null. It is an error if a field in this list has a non-empty value.
  1595. // This may be used to include null fields in Patch requests.
  1596. NullFields []string `json:"-"`
  1597. }
  1598. func (s *FileImageMediaMetadata) MarshalJSON() ([]byte, error) {
  1599. type NoMethod FileImageMediaMetadata
  1600. raw := NoMethod(*s)
  1601. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1602. }
  1603. func (s *FileImageMediaMetadata) UnmarshalJSON(data []byte) error {
  1604. type NoMethod FileImageMediaMetadata
  1605. var s1 struct {
  1606. Aperture gensupport.JSONFloat64 `json:"aperture"`
  1607. ExposureBias gensupport.JSONFloat64 `json:"exposureBias"`
  1608. ExposureTime gensupport.JSONFloat64 `json:"exposureTime"`
  1609. FocalLength gensupport.JSONFloat64 `json:"focalLength"`
  1610. MaxApertureValue gensupport.JSONFloat64 `json:"maxApertureValue"`
  1611. *NoMethod
  1612. }
  1613. s1.NoMethod = (*NoMethod)(s)
  1614. if err := json.Unmarshal(data, &s1); err != nil {
  1615. return err
  1616. }
  1617. s.Aperture = float64(s1.Aperture)
  1618. s.ExposureBias = float64(s1.ExposureBias)
  1619. s.ExposureTime = float64(s1.ExposureTime)
  1620. s.FocalLength = float64(s1.FocalLength)
  1621. s.MaxApertureValue = float64(s1.MaxApertureValue)
  1622. return nil
  1623. }
  1624. // FileImageMediaMetadataLocation: Geographic location information
  1625. // stored in the image.
  1626. type FileImageMediaMetadataLocation struct {
  1627. // Altitude: The altitude stored in the image.
  1628. Altitude float64 `json:"altitude,omitempty"`
  1629. // Latitude: The latitude stored in the image.
  1630. Latitude float64 `json:"latitude,omitempty"`
  1631. // Longitude: The longitude stored in the image.
  1632. Longitude float64 `json:"longitude,omitempty"`
  1633. // ForceSendFields is a list of field names (e.g. "Altitude") to
  1634. // unconditionally include in API requests. By default, fields with
  1635. // empty values are omitted from API requests. However, any non-pointer,
  1636. // non-interface field appearing in ForceSendFields will be sent to the
  1637. // server regardless of whether the field is empty or not. This may be
  1638. // used to include empty fields in Patch requests.
  1639. ForceSendFields []string `json:"-"`
  1640. // NullFields is a list of field names (e.g. "Altitude") to include in
  1641. // API requests with the JSON null value. By default, fields with empty
  1642. // values are omitted from API requests. However, any field with an
  1643. // empty value appearing in NullFields will be sent to the server as
  1644. // null. It is an error if a field in this list has a non-empty value.
  1645. // This may be used to include null fields in Patch requests.
  1646. NullFields []string `json:"-"`
  1647. }
  1648. func (s *FileImageMediaMetadataLocation) MarshalJSON() ([]byte, error) {
  1649. type NoMethod FileImageMediaMetadataLocation
  1650. raw := NoMethod(*s)
  1651. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1652. }
  1653. func (s *FileImageMediaMetadataLocation) UnmarshalJSON(data []byte) error {
  1654. type NoMethod FileImageMediaMetadataLocation
  1655. var s1 struct {
  1656. Altitude gensupport.JSONFloat64 `json:"altitude"`
  1657. Latitude gensupport.JSONFloat64 `json:"latitude"`
  1658. Longitude gensupport.JSONFloat64 `json:"longitude"`
  1659. *NoMethod
  1660. }
  1661. s1.NoMethod = (*NoMethod)(s)
  1662. if err := json.Unmarshal(data, &s1); err != nil {
  1663. return err
  1664. }
  1665. s.Altitude = float64(s1.Altitude)
  1666. s.Latitude = float64(s1.Latitude)
  1667. s.Longitude = float64(s1.Longitude)
  1668. return nil
  1669. }
  1670. // FileIndexableText: Indexable text attributes for the file (can only
  1671. // be written)
  1672. type FileIndexableText struct {
  1673. // Text: The text to be indexed for this file.
  1674. Text string `json:"text,omitempty"`
  1675. // ForceSendFields is a list of field names (e.g. "Text") to
  1676. // unconditionally include in API requests. By default, fields with
  1677. // empty values are omitted from API requests. However, any non-pointer,
  1678. // non-interface field appearing in ForceSendFields will be sent to the
  1679. // server regardless of whether the field is empty or not. This may be
  1680. // used to include empty fields in Patch requests.
  1681. ForceSendFields []string `json:"-"`
  1682. // NullFields is a list of field names (e.g. "Text") to include in API
  1683. // requests with the JSON null value. By default, fields with empty
  1684. // values are omitted from API requests. However, any field with an
  1685. // empty value appearing in NullFields will be sent to the server as
  1686. // null. It is an error if a field in this list has a non-empty value.
  1687. // This may be used to include null fields in Patch requests.
  1688. NullFields []string `json:"-"`
  1689. }
  1690. func (s *FileIndexableText) MarshalJSON() ([]byte, error) {
  1691. type NoMethod FileIndexableText
  1692. raw := NoMethod(*s)
  1693. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1694. }
  1695. // FileLabels: A group of labels for the file.
  1696. type FileLabels struct {
  1697. // Hidden: Deprecated.
  1698. Hidden bool `json:"hidden,omitempty"`
  1699. // Modified: Whether the file has been modified by this user.
  1700. Modified bool `json:"modified,omitempty"`
  1701. // Restricted: Deprecated - use copyRequiresWriterPermission instead.
  1702. Restricted bool `json:"restricted,omitempty"`
  1703. // Starred: Whether this file is starred by the user.
  1704. Starred bool `json:"starred,omitempty"`
  1705. // Trashed: Whether this file has been trashed. This label applies to
  1706. // all users accessing the file; however, only owners are allowed to see
  1707. // and untrash files.
  1708. Trashed bool `json:"trashed,omitempty"`
  1709. // Viewed: Whether this file has been viewed by this user.
  1710. Viewed bool `json:"viewed,omitempty"`
  1711. // ForceSendFields is a list of field names (e.g. "Hidden") to
  1712. // unconditionally include in API requests. By default, fields with
  1713. // empty values are omitted from API requests. However, any non-pointer,
  1714. // non-interface field appearing in ForceSendFields will be sent to the
  1715. // server regardless of whether the field is empty or not. This may be
  1716. // used to include empty fields in Patch requests.
  1717. ForceSendFields []string `json:"-"`
  1718. // NullFields is a list of field names (e.g. "Hidden") to include in API
  1719. // requests with the JSON null value. By default, fields with empty
  1720. // values are omitted from API requests. However, any field with an
  1721. // empty value appearing in NullFields will be sent to the server as
  1722. // null. It is an error if a field in this list has a non-empty value.
  1723. // This may be used to include null fields in Patch requests.
  1724. NullFields []string `json:"-"`
  1725. }
  1726. func (s *FileLabels) MarshalJSON() ([]byte, error) {
  1727. type NoMethod FileLabels
  1728. raw := NoMethod(*s)
  1729. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1730. }
  1731. // FileThumbnail: A thumbnail for the file. This will only be used if
  1732. // Drive cannot generate a standard thumbnail.
  1733. type FileThumbnail struct {
  1734. // Image: The URL-safe Base64 encoded bytes of the thumbnail image. It
  1735. // should conform to RFC 4648 section 5.
  1736. Image string `json:"image,omitempty"`
  1737. // MimeType: The MIME type of the thumbnail.
  1738. MimeType string `json:"mimeType,omitempty"`
  1739. // ForceSendFields is a list of field names (e.g. "Image") to
  1740. // unconditionally include in API requests. By default, fields with
  1741. // empty values are omitted from API requests. However, any non-pointer,
  1742. // non-interface field appearing in ForceSendFields will be sent to the
  1743. // server regardless of whether the field is empty or not. This may be
  1744. // used to include empty fields in Patch requests.
  1745. ForceSendFields []string `json:"-"`
  1746. // NullFields is a list of field names (e.g. "Image") to include in API
  1747. // requests with the JSON null value. By default, fields with empty
  1748. // values are omitted from API requests. However, any field with an
  1749. // empty value appearing in NullFields will be sent to the server as
  1750. // null. It is an error if a field in this list has a non-empty value.
  1751. // This may be used to include null fields in Patch requests.
  1752. NullFields []string `json:"-"`
  1753. }
  1754. func (s *FileThumbnail) MarshalJSON() ([]byte, error) {
  1755. type NoMethod FileThumbnail
  1756. raw := NoMethod(*s)
  1757. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1758. }
  1759. // FileVideoMediaMetadata: Metadata about video media. This will only be
  1760. // present for video types.
  1761. type FileVideoMediaMetadata struct {
  1762. // DurationMillis: The duration of the video in milliseconds.
  1763. DurationMillis int64 `json:"durationMillis,omitempty,string"`
  1764. // Height: The height of the video in pixels.
  1765. Height int64 `json:"height,omitempty"`
  1766. // Width: The width of the video in pixels.
  1767. Width int64 `json:"width,omitempty"`
  1768. // ForceSendFields is a list of field names (e.g. "DurationMillis") to
  1769. // unconditionally include in API requests. By default, fields with
  1770. // empty values are omitted from API requests. However, any non-pointer,
  1771. // non-interface field appearing in ForceSendFields will be sent to the
  1772. // server regardless of whether the field is empty or not. This may be
  1773. // used to include empty fields in Patch requests.
  1774. ForceSendFields []string `json:"-"`
  1775. // NullFields is a list of field names (e.g. "DurationMillis") to
  1776. // include in API requests with the JSON null value. By default, fields
  1777. // with empty values are omitted from API requests. However, any field
  1778. // with an empty value appearing in NullFields will be sent to the
  1779. // server as null. It is an error if a field in this list has a
  1780. // non-empty value. This may be used to include null fields in Patch
  1781. // requests.
  1782. NullFields []string `json:"-"`
  1783. }
  1784. func (s *FileVideoMediaMetadata) MarshalJSON() ([]byte, error) {
  1785. type NoMethod FileVideoMediaMetadata
  1786. raw := NoMethod(*s)
  1787. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1788. }
  1789. // FileList: A list of files.
  1790. type FileList struct {
  1791. // Etag: The ETag of the list.
  1792. Etag string `json:"etag,omitempty"`
  1793. // IncompleteSearch: Whether the search process was incomplete. If true,
  1794. // then some search results may be missing, since all documents were not
  1795. // searched. This may occur when searching multiple Team Drives with the
  1796. // "default,allTeamDrives" corpora, but all corpora could not be
  1797. // searched. When this happens, it is suggested that clients narrow
  1798. // their query by choosing a different corpus such as "default" or
  1799. // "teamDrive".
  1800. IncompleteSearch bool `json:"incompleteSearch,omitempty"`
  1801. // Items: The list of files. If nextPageToken is populated, then this
  1802. // list may be incomplete and an additional page of results should be
  1803. // fetched.
  1804. Items []*File `json:"items,omitempty"`
  1805. // Kind: This is always drive#fileList.
  1806. Kind string `json:"kind,omitempty"`
  1807. // NextLink: A link to the next page of files.
  1808. NextLink string `json:"nextLink,omitempty"`
  1809. // NextPageToken: The page token for the next page of files. This will
  1810. // be absent if the end of the files list has been reached. If the token
  1811. // is rejected for any reason, it should be discarded, and pagination
  1812. // should be restarted from the first page of results.
  1813. NextPageToken string `json:"nextPageToken,omitempty"`
  1814. // SelfLink: A link back to this list.
  1815. SelfLink string `json:"selfLink,omitempty"`
  1816. // ServerResponse contains the HTTP response code and headers from the
  1817. // server.
  1818. googleapi.ServerResponse `json:"-"`
  1819. // ForceSendFields is a list of field names (e.g. "Etag") to
  1820. // unconditionally include in API requests. By default, fields with
  1821. // empty values are omitted from API requests. However, any non-pointer,
  1822. // non-interface field appearing in ForceSendFields will be sent to the
  1823. // server regardless of whether the field is empty or not. This may be
  1824. // used to include empty fields in Patch requests.
  1825. ForceSendFields []string `json:"-"`
  1826. // NullFields is a list of field names (e.g. "Etag") to include in API
  1827. // requests with the JSON null value. By default, fields with empty
  1828. // values are omitted from API requests. However, any field with an
  1829. // empty value appearing in NullFields will be sent to the server as
  1830. // null. It is an error if a field in this list has a non-empty value.
  1831. // This may be used to include null fields in Patch requests.
  1832. NullFields []string `json:"-"`
  1833. }
  1834. func (s *FileList) MarshalJSON() ([]byte, error) {
  1835. type NoMethod FileList
  1836. raw := NoMethod(*s)
  1837. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1838. }
  1839. // GeneratedIds: A list of generated IDs which can be provided in insert
  1840. // requests
  1841. type GeneratedIds struct {
  1842. // Ids: The IDs generated for the requesting user in the specified
  1843. // space.
  1844. Ids []string `json:"ids,omitempty"`
  1845. // Kind: This is always drive#generatedIds
  1846. Kind string `json:"kind,omitempty"`
  1847. // Space: The type of file that can be created with these IDs.
  1848. Space string `json:"space,omitempty"`
  1849. // ServerResponse contains the HTTP response code and headers from the
  1850. // server.
  1851. googleapi.ServerResponse `json:"-"`
  1852. // ForceSendFields is a list of field names (e.g. "Ids") to
  1853. // unconditionally include in API requests. By default, fields with
  1854. // empty values are omitted from API requests. However, any non-pointer,
  1855. // non-interface field appearing in ForceSendFields will be sent to the
  1856. // server regardless of whether the field is empty or not. This may be
  1857. // used to include empty fields in Patch requests.
  1858. ForceSendFields []string `json:"-"`
  1859. // NullFields is a list of field names (e.g. "Ids") to include in API
  1860. // requests with the JSON null value. By default, fields with empty
  1861. // values are omitted from API requests. However, any field with an
  1862. // empty value appearing in NullFields will be sent to the server as
  1863. // null. It is an error if a field in this list has a non-empty value.
  1864. // This may be used to include null fields in Patch requests.
  1865. NullFields []string `json:"-"`
  1866. }
  1867. func (s *GeneratedIds) MarshalJSON() ([]byte, error) {
  1868. type NoMethod GeneratedIds
  1869. raw := NoMethod(*s)
  1870. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1871. }
  1872. // ParentList: A list of a file's parents.
  1873. type ParentList struct {
  1874. // Etag: The ETag of the list.
  1875. Etag string `json:"etag,omitempty"`
  1876. // Items: The list of parents.
  1877. Items []*ParentReference `json:"items,omitempty"`
  1878. // Kind: This is always drive#parentList.
  1879. Kind string `json:"kind,omitempty"`
  1880. // SelfLink: A link back to this list.
  1881. SelfLink string `json:"selfLink,omitempty"`
  1882. // ServerResponse contains the HTTP response code and headers from the
  1883. // server.
  1884. googleapi.ServerResponse `json:"-"`
  1885. // ForceSendFields is a list of field names (e.g. "Etag") to
  1886. // unconditionally include in API requests. By default, fields with
  1887. // empty values are omitted from API requests. However, any non-pointer,
  1888. // non-interface field appearing in ForceSendFields will be sent to the
  1889. // server regardless of whether the field is empty or not. This may be
  1890. // used to include empty fields in Patch requests.
  1891. ForceSendFields []string `json:"-"`
  1892. // NullFields is a list of field names (e.g. "Etag") to include in API
  1893. // requests with the JSON null value. By default, fields with empty
  1894. // values are omitted from API requests. However, any field with an
  1895. // empty value appearing in NullFields will be sent to the server as
  1896. // null. It is an error if a field in this list has a non-empty value.
  1897. // This may be used to include null fields in Patch requests.
  1898. NullFields []string `json:"-"`
  1899. }
  1900. func (s *ParentList) MarshalJSON() ([]byte, error) {
  1901. type NoMethod ParentList
  1902. raw := NoMethod(*s)
  1903. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1904. }
  1905. // ParentReference: A reference to a file's parent.
  1906. type ParentReference struct {
  1907. // Id: The ID of the parent.
  1908. Id string `json:"id,omitempty"`
  1909. // IsRoot: Whether or not the parent is the root folder.
  1910. IsRoot bool `json:"isRoot,omitempty"`
  1911. // Kind: This is always drive#parentReference.
  1912. Kind string `json:"kind,omitempty"`
  1913. // ParentLink: A link to the parent.
  1914. ParentLink string `json:"parentLink,omitempty"`
  1915. // SelfLink: A link back to this reference.
  1916. SelfLink string `json:"selfLink,omitempty"`
  1917. // ServerResponse contains the HTTP response code and headers from the
  1918. // server.
  1919. googleapi.ServerResponse `json:"-"`
  1920. // ForceSendFields is a list of field names (e.g. "Id") to
  1921. // unconditionally include in API requests. By default, fields with
  1922. // empty values are omitted from API requests. However, any non-pointer,
  1923. // non-interface field appearing in ForceSendFields will be sent to the
  1924. // server regardless of whether the field is empty or not. This may be
  1925. // used to include empty fields in Patch requests.
  1926. ForceSendFields []string `json:"-"`
  1927. // NullFields is a list of field names (e.g. "Id") to include in API
  1928. // requests with the JSON null value. By default, fields with empty
  1929. // values are omitted from API requests. However, any field with an
  1930. // empty value appearing in NullFields will be sent to the server as
  1931. // null. It is an error if a field in this list has a non-empty value.
  1932. // This may be used to include null fields in Patch requests.
  1933. NullFields []string `json:"-"`
  1934. }
  1935. func (s *ParentReference) MarshalJSON() ([]byte, error) {
  1936. type NoMethod ParentReference
  1937. raw := NoMethod(*s)
  1938. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1939. }
  1940. // Permission: A permission for a file.
  1941. type Permission struct {
  1942. // AdditionalRoles: Additional roles for this user. Only commenter is
  1943. // currently allowed, though more may be supported in the future.
  1944. AdditionalRoles []string `json:"additionalRoles,omitempty"`
  1945. // AuthKey: Deprecated.
  1946. AuthKey string `json:"authKey,omitempty"`
  1947. // Deleted: Whether the account associated with this permission has been
  1948. // deleted. This field only pertains to user and group permissions.
  1949. Deleted bool `json:"deleted,omitempty"`
  1950. // Domain: The domain name of the entity this permission refers to. This
  1951. // is an output-only field which is present when the permission type is
  1952. // user, group or domain.
  1953. Domain string `json:"domain,omitempty"`
  1954. // EmailAddress: The email address of the user or group this permission
  1955. // refers to. This is an output-only field which is present when the
  1956. // permission type is user or group.
  1957. EmailAddress string `json:"emailAddress,omitempty"`
  1958. // Etag: The ETag of the permission.
  1959. Etag string `json:"etag,omitempty"`
  1960. // ExpirationDate: The time at which this permission will expire (RFC
  1961. // 3339 date-time). Expiration dates have the following restrictions:
  1962. //
  1963. // - They can only be set on user and group permissions
  1964. // - The date must be in the future
  1965. // - The date cannot be more than a year in the future
  1966. // - The date can only be set on drive.permissions.update or
  1967. // drive.permissions.patch requests
  1968. ExpirationDate string `json:"expirationDate,omitempty"`
  1969. // Id: The ID of the user this permission refers to, and identical to
  1970. // the permissionId in the About and Files resources. When making a
  1971. // drive.permissions.insert request, exactly one of the id or value
  1972. // fields must be specified unless the permission type is anyone, in
  1973. // which case both id and value are ignored.
  1974. Id string `json:"id,omitempty"`
  1975. // Kind: This is always drive#permission.
  1976. Kind string `json:"kind,omitempty"`
  1977. // Name: The name for this permission.
  1978. Name string `json:"name,omitempty"`
  1979. // PhotoLink: A link to the profile photo, if available.
  1980. PhotoLink string `json:"photoLink,omitempty"`
  1981. // Role: The primary role for this user. While new values may be
  1982. // supported in the future, the following are currently allowed:
  1983. // - owner
  1984. // - organizer
  1985. // - fileOrganizer
  1986. // - writer
  1987. // - reader
  1988. Role string `json:"role,omitempty"`
  1989. // SelfLink: A link back to this permission.
  1990. SelfLink string `json:"selfLink,omitempty"`
  1991. // TeamDrivePermissionDetails: Details of whether the permissions on
  1992. // this Team Drive item are inherited or directly on this item. This is
  1993. // an output-only field which is present only for Team Drive items.
  1994. TeamDrivePermissionDetails []*PermissionTeamDrivePermissionDetails `json:"teamDrivePermissionDetails,omitempty"`
  1995. // Type: The account type. Allowed values are:
  1996. // - user
  1997. // - group
  1998. // - domain
  1999. // - anyone
  2000. Type string `json:"type,omitempty"`
  2001. // Value: The email address or domain name for the entity. This is used
  2002. // during inserts and is not populated in responses. When making a
  2003. // drive.permissions.insert request, exactly one of the id or value
  2004. // fields must be specified unless the permission type is anyone, in
  2005. // which case both id and value are ignored.
  2006. Value string `json:"value,omitempty"`
  2007. // WithLink: Whether the link is required for this permission.
  2008. WithLink bool `json:"withLink,omitempty"`
  2009. // ServerResponse contains the HTTP response code and headers from the
  2010. // server.
  2011. googleapi.ServerResponse `json:"-"`
  2012. // ForceSendFields is a list of field names (e.g. "AdditionalRoles") to
  2013. // unconditionally include in API requests. By default, fields with
  2014. // empty values are omitted from API requests. However, any non-pointer,
  2015. // non-interface field appearing in ForceSendFields will be sent to the
  2016. // server regardless of whether the field is empty or not. This may be
  2017. // used to include empty fields in Patch requests.
  2018. ForceSendFields []string `json:"-"`
  2019. // NullFields is a list of field names (e.g. "AdditionalRoles") to
  2020. // include in API requests with the JSON null value. By default, fields
  2021. // with empty values are omitted from API requests. However, any field
  2022. // with an empty value appearing in NullFields will be sent to the
  2023. // server as null. It is an error if a field in this list has a
  2024. // non-empty value. This may be used to include null fields in Patch
  2025. // requests.
  2026. NullFields []string `json:"-"`
  2027. }
  2028. func (s *Permission) MarshalJSON() ([]byte, error) {
  2029. type NoMethod Permission
  2030. raw := NoMethod(*s)
  2031. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2032. }
  2033. type PermissionTeamDrivePermissionDetails struct {
  2034. // AdditionalRoles: Additional roles for this user. Only commenter is
  2035. // currently possible, though more may be supported in the future.
  2036. AdditionalRoles []string `json:"additionalRoles,omitempty"`
  2037. // Inherited: Whether this permission is inherited. This field is always
  2038. // populated. This is an output-only field.
  2039. Inherited bool `json:"inherited,omitempty"`
  2040. // InheritedFrom: The ID of the item from which this permission is
  2041. // inherited. This is an output-only field and is only populated for
  2042. // members of the Team Drive.
  2043. InheritedFrom string `json:"inheritedFrom,omitempty"`
  2044. // Role: The primary role for this user. While new values may be added
  2045. // in the future, the following are currently possible:
  2046. // - organizer
  2047. // - fileOrganizer
  2048. // - writer
  2049. // - reader
  2050. Role string `json:"role,omitempty"`
  2051. // TeamDrivePermissionType: The Team Drive permission type for this
  2052. // user. While new values may be added in future, the following are
  2053. // currently possible:
  2054. // - file
  2055. // - member
  2056. TeamDrivePermissionType string `json:"teamDrivePermissionType,omitempty"`
  2057. // ForceSendFields is a list of field names (e.g. "AdditionalRoles") to
  2058. // unconditionally include in API requests. By default, fields with
  2059. // empty values are omitted from API requests. However, any non-pointer,
  2060. // non-interface field appearing in ForceSendFields will be sent to the
  2061. // server regardless of whether the field is empty or not. This may be
  2062. // used to include empty fields in Patch requests.
  2063. ForceSendFields []string `json:"-"`
  2064. // NullFields is a list of field names (e.g. "AdditionalRoles") to
  2065. // include in API requests with the JSON null value. By default, fields
  2066. // with empty values are omitted from API requests. However, any field
  2067. // with an empty value appearing in NullFields will be sent to the
  2068. // server as null. It is an error if a field in this list has a
  2069. // non-empty value. This may be used to include null fields in Patch
  2070. // requests.
  2071. NullFields []string `json:"-"`
  2072. }
  2073. func (s *PermissionTeamDrivePermissionDetails) MarshalJSON() ([]byte, error) {
  2074. type NoMethod PermissionTeamDrivePermissionDetails
  2075. raw := NoMethod(*s)
  2076. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2077. }
  2078. // PermissionId: An ID for a user or group as seen in Permission items.
  2079. type PermissionId struct {
  2080. // Id: The permission ID.
  2081. Id string `json:"id,omitempty"`
  2082. // Kind: This is always drive#permissionId.
  2083. Kind string `json:"kind,omitempty"`
  2084. // ServerResponse contains the HTTP response code and headers from the
  2085. // server.
  2086. googleapi.ServerResponse `json:"-"`
  2087. // ForceSendFields is a list of field names (e.g. "Id") to
  2088. // unconditionally include in API requests. By default, fields with
  2089. // empty values are omitted from API requests. However, any non-pointer,
  2090. // non-interface field appearing in ForceSendFields will be sent to the
  2091. // server regardless of whether the field is empty or not. This may be
  2092. // used to include empty fields in Patch requests.
  2093. ForceSendFields []string `json:"-"`
  2094. // NullFields is a list of field names (e.g. "Id") to include in API
  2095. // requests with the JSON null value. By default, fields with empty
  2096. // values are omitted from API requests. However, any field with an
  2097. // empty value appearing in NullFields will be sent to the server as
  2098. // null. It is an error if a field in this list has a non-empty value.
  2099. // This may be used to include null fields in Patch requests.
  2100. NullFields []string `json:"-"`
  2101. }
  2102. func (s *PermissionId) MarshalJSON() ([]byte, error) {
  2103. type NoMethod PermissionId
  2104. raw := NoMethod(*s)
  2105. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2106. }
  2107. // PermissionList: A list of permissions associated with a file.
  2108. type PermissionList struct {
  2109. // Etag: The ETag of the list.
  2110. Etag string `json:"etag,omitempty"`
  2111. // Items: The list of permissions.
  2112. Items []*Permission `json:"items,omitempty"`
  2113. // Kind: This is always drive#permissionList.
  2114. Kind string `json:"kind,omitempty"`
  2115. // NextPageToken: The page token for the next page of permissions. This
  2116. // field will be absent if the end of the permissions list has been
  2117. // reached. If the token is rejected for any reason, it should be
  2118. // discarded, and pagination should be restarted from the first page of
  2119. // results.
  2120. NextPageToken string `json:"nextPageToken,omitempty"`
  2121. // SelfLink: A link back to this list.
  2122. SelfLink string `json:"selfLink,omitempty"`
  2123. // ServerResponse contains the HTTP response code and headers from the
  2124. // server.
  2125. googleapi.ServerResponse `json:"-"`
  2126. // ForceSendFields is a list of field names (e.g. "Etag") to
  2127. // unconditionally include in API requests. By default, fields with
  2128. // empty values are omitted from API requests. However, any non-pointer,
  2129. // non-interface field appearing in ForceSendFields will be sent to the
  2130. // server regardless of whether the field is empty or not. This may be
  2131. // used to include empty fields in Patch requests.
  2132. ForceSendFields []string `json:"-"`
  2133. // NullFields is a list of field names (e.g. "Etag") to include in API
  2134. // requests with the JSON null value. By default, fields with empty
  2135. // values are omitted from API requests. However, any field with an
  2136. // empty value appearing in NullFields will be sent to the server as
  2137. // null. It is an error if a field in this list has a non-empty value.
  2138. // This may be used to include null fields in Patch requests.
  2139. NullFields []string `json:"-"`
  2140. }
  2141. func (s *PermissionList) MarshalJSON() ([]byte, error) {
  2142. type NoMethod PermissionList
  2143. raw := NoMethod(*s)
  2144. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2145. }
  2146. // Property: A key-value pair attached to a file that is either public
  2147. // or private to an application.
  2148. // The following limits apply to file properties:
  2149. // - Maximum of 100 properties total per file
  2150. // - Maximum of 30 private properties per app
  2151. // - Maximum of 30 public properties
  2152. // - Maximum of 124 bytes size limit on (key + value) string in UTF-8
  2153. // encoding for a single property.
  2154. type Property struct {
  2155. // Etag: ETag of the property.
  2156. Etag string `json:"etag,omitempty"`
  2157. // Key: The key of this property.
  2158. Key string `json:"key,omitempty"`
  2159. // Kind: This is always drive#property.
  2160. Kind string `json:"kind,omitempty"`
  2161. // SelfLink: The link back to this property.
  2162. SelfLink string `json:"selfLink,omitempty"`
  2163. // Value: The value of this property.
  2164. Value string `json:"value,omitempty"`
  2165. // Visibility: The visibility of this property. Allowed values are
  2166. // PRIVATE and PUBLIC. (Default: PRIVATE)
  2167. Visibility string `json:"visibility,omitempty"`
  2168. // ServerResponse contains the HTTP response code and headers from the
  2169. // server.
  2170. googleapi.ServerResponse `json:"-"`
  2171. // ForceSendFields is a list of field names (e.g. "Etag") to
  2172. // unconditionally include in API requests. By default, fields with
  2173. // empty values are omitted from API requests. However, any non-pointer,
  2174. // non-interface field appearing in ForceSendFields will be sent to the
  2175. // server regardless of whether the field is empty or not. This may be
  2176. // used to include empty fields in Patch requests.
  2177. ForceSendFields []string `json:"-"`
  2178. // NullFields is a list of field names (e.g. "Etag") to include in API
  2179. // requests with the JSON null value. By default, fields with empty
  2180. // values are omitted from API requests. However, any field with an
  2181. // empty value appearing in NullFields will be sent to the server as
  2182. // null. It is an error if a field in this list has a non-empty value.
  2183. // This may be used to include null fields in Patch requests.
  2184. NullFields []string `json:"-"`
  2185. }
  2186. func (s *Property) MarshalJSON() ([]byte, error) {
  2187. type NoMethod Property
  2188. raw := NoMethod(*s)
  2189. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2190. }
  2191. // PropertyList: A collection of properties, key-value pairs that are
  2192. // either public or private to an application.
  2193. type PropertyList struct {
  2194. // Etag: The ETag of the list.
  2195. Etag string `json:"etag,omitempty"`
  2196. // Items: The list of properties.
  2197. Items []*Property `json:"items,omitempty"`
  2198. // Kind: This is always drive#propertyList.
  2199. Kind string `json:"kind,omitempty"`
  2200. // SelfLink: The link back to this list.
  2201. SelfLink string `json:"selfLink,omitempty"`
  2202. // ServerResponse contains the HTTP response code and headers from the
  2203. // server.
  2204. googleapi.ServerResponse `json:"-"`
  2205. // ForceSendFields is a list of field names (e.g. "Etag") to
  2206. // unconditionally include in API requests. By default, fields with
  2207. // empty values are omitted from API requests. However, any non-pointer,
  2208. // non-interface field appearing in ForceSendFields will be sent to the
  2209. // server regardless of whether the field is empty or not. This may be
  2210. // used to include empty fields in Patch requests.
  2211. ForceSendFields []string `json:"-"`
  2212. // NullFields is a list of field names (e.g. "Etag") to include in API
  2213. // requests with the JSON null value. By default, fields with empty
  2214. // values are omitted from API requests. However, any field with an
  2215. // empty value appearing in NullFields will be sent to the server as
  2216. // null. It is an error if a field in this list has a non-empty value.
  2217. // This may be used to include null fields in Patch requests.
  2218. NullFields []string `json:"-"`
  2219. }
  2220. func (s *PropertyList) MarshalJSON() ([]byte, error) {
  2221. type NoMethod PropertyList
  2222. raw := NoMethod(*s)
  2223. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2224. }
  2225. // Revision: A revision of a file.
  2226. type Revision struct {
  2227. // DownloadUrl: Short term download URL for the file. This will only be
  2228. // populated on files with content stored in Drive.
  2229. DownloadUrl string `json:"downloadUrl,omitempty"`
  2230. // Etag: The ETag of the revision.
  2231. Etag string `json:"etag,omitempty"`
  2232. // ExportLinks: Links for exporting Google Docs to specific formats.
  2233. ExportLinks map[string]string `json:"exportLinks,omitempty"`
  2234. // FileSize: The size of the revision in bytes. This will only be
  2235. // populated on files with content stored in Drive.
  2236. FileSize int64 `json:"fileSize,omitempty,string"`
  2237. // Id: The ID of the revision.
  2238. Id string `json:"id,omitempty"`
  2239. // Kind: This is always drive#revision.
  2240. Kind string `json:"kind,omitempty"`
  2241. // LastModifyingUser: The last user to modify this revision.
  2242. LastModifyingUser *User `json:"lastModifyingUser,omitempty"`
  2243. // LastModifyingUserName: Name of the last user to modify this revision.
  2244. LastModifyingUserName string `json:"lastModifyingUserName,omitempty"`
  2245. // Md5Checksum: An MD5 checksum for the content of this revision. This
  2246. // will only be populated on files with content stored in Drive.
  2247. Md5Checksum string `json:"md5Checksum,omitempty"`
  2248. // MimeType: The MIME type of the revision.
  2249. MimeType string `json:"mimeType,omitempty"`
  2250. // ModifiedDate: Last time this revision was modified (formatted RFC
  2251. // 3339 timestamp).
  2252. ModifiedDate string `json:"modifiedDate,omitempty"`
  2253. // OriginalFilename: The original filename when this revision was
  2254. // created. This will only be populated on files with content stored in
  2255. // Drive.
  2256. OriginalFilename string `json:"originalFilename,omitempty"`
  2257. // Pinned: Whether this revision is pinned to prevent automatic purging.
  2258. // This will only be populated and can only be modified on files with
  2259. // content stored in Drive which are not Google Docs. Revisions can also
  2260. // be pinned when they are created through the
  2261. // drive.files.insert/update/copy by using the pinned query parameter.
  2262. Pinned bool `json:"pinned,omitempty"`
  2263. // PublishAuto: Whether subsequent revisions will be automatically
  2264. // republished. This is only populated and can only be modified for
  2265. // Google Docs.
  2266. PublishAuto bool `json:"publishAuto,omitempty"`
  2267. // Published: Whether this revision is published. This is only populated
  2268. // and can only be modified for Google Docs.
  2269. Published bool `json:"published,omitempty"`
  2270. // PublishedLink: A link to the published revision.
  2271. PublishedLink string `json:"publishedLink,omitempty"`
  2272. // PublishedOutsideDomain: Whether this revision is published outside
  2273. // the domain. This is only populated and can only be modified for
  2274. // Google Docs.
  2275. PublishedOutsideDomain bool `json:"publishedOutsideDomain,omitempty"`
  2276. // SelfLink: A link back to this revision.
  2277. SelfLink string `json:"selfLink,omitempty"`
  2278. // ServerResponse contains the HTTP response code and headers from the
  2279. // server.
  2280. googleapi.ServerResponse `json:"-"`
  2281. // ForceSendFields is a list of field names (e.g. "DownloadUrl") to
  2282. // unconditionally include in API requests. By default, fields with
  2283. // empty values are omitted from API requests. However, any non-pointer,
  2284. // non-interface field appearing in ForceSendFields will be sent to the
  2285. // server regardless of whether the field is empty or not. This may be
  2286. // used to include empty fields in Patch requests.
  2287. ForceSendFields []string `json:"-"`
  2288. // NullFields is a list of field names (e.g. "DownloadUrl") to include
  2289. // in API requests with the JSON null value. By default, fields with
  2290. // empty values are omitted from API requests. However, any field with
  2291. // an empty value appearing in NullFields will be sent to the server as
  2292. // null. It is an error if a field in this list has a non-empty value.
  2293. // This may be used to include null fields in Patch requests.
  2294. NullFields []string `json:"-"`
  2295. }
  2296. func (s *Revision) MarshalJSON() ([]byte, error) {
  2297. type NoMethod Revision
  2298. raw := NoMethod(*s)
  2299. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2300. }
  2301. // RevisionList: A list of revisions of a file.
  2302. type RevisionList struct {
  2303. // Etag: The ETag of the list.
  2304. Etag string `json:"etag,omitempty"`
  2305. // Items: The list of revisions. If nextPageToken is populated, then
  2306. // this list may be incomplete and an additional page of results should
  2307. // be fetched.
  2308. Items []*Revision `json:"items,omitempty"`
  2309. // Kind: This is always drive#revisionList.
  2310. Kind string `json:"kind,omitempty"`
  2311. // NextPageToken: The page token for the next page of revisions. This
  2312. // field will be absent if the end of the revisions list has been
  2313. // reached. If the token is rejected for any reason, it should be
  2314. // discarded and pagination should be restarted from the first page of
  2315. // results.
  2316. NextPageToken string `json:"nextPageToken,omitempty"`
  2317. // SelfLink: A link back to this list.
  2318. SelfLink string `json:"selfLink,omitempty"`
  2319. // ServerResponse contains the HTTP response code and headers from the
  2320. // server.
  2321. googleapi.ServerResponse `json:"-"`
  2322. // ForceSendFields is a list of field names (e.g. "Etag") to
  2323. // unconditionally include in API requests. By default, fields with
  2324. // empty values are omitted from API requests. However, any non-pointer,
  2325. // non-interface field appearing in ForceSendFields will be sent to the
  2326. // server regardless of whether the field is empty or not. This may be
  2327. // used to include empty fields in Patch requests.
  2328. ForceSendFields []string `json:"-"`
  2329. // NullFields is a list of field names (e.g. "Etag") to include in API
  2330. // requests with the JSON null value. By default, fields with empty
  2331. // values are omitted from API requests. However, any field with an
  2332. // empty value appearing in NullFields will be sent to the server as
  2333. // null. It is an error if a field in this list has a non-empty value.
  2334. // This may be used to include null fields in Patch requests.
  2335. NullFields []string `json:"-"`
  2336. }
  2337. func (s *RevisionList) MarshalJSON() ([]byte, error) {
  2338. type NoMethod RevisionList
  2339. raw := NoMethod(*s)
  2340. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2341. }
  2342. type StartPageToken struct {
  2343. // Kind: Identifies what kind of resource this is. Value: the fixed
  2344. // string "drive#startPageToken".
  2345. Kind string `json:"kind,omitempty"`
  2346. // StartPageToken: The starting page token for listing changes.
  2347. StartPageToken string `json:"startPageToken,omitempty"`
  2348. // ServerResponse contains the HTTP response code and headers from the
  2349. // server.
  2350. googleapi.ServerResponse `json:"-"`
  2351. // ForceSendFields is a list of field names (e.g. "Kind") to
  2352. // unconditionally include in API requests. By default, fields with
  2353. // empty values are omitted from API requests. However, any non-pointer,
  2354. // non-interface field appearing in ForceSendFields will be sent to the
  2355. // server regardless of whether the field is empty or not. This may be
  2356. // used to include empty fields in Patch requests.
  2357. ForceSendFields []string `json:"-"`
  2358. // NullFields is a list of field names (e.g. "Kind") to include in API
  2359. // requests with the JSON null value. By default, fields with empty
  2360. // values are omitted from API requests. However, any field with an
  2361. // empty value appearing in NullFields will be sent to the server as
  2362. // null. It is an error if a field in this list has a non-empty value.
  2363. // This may be used to include null fields in Patch requests.
  2364. NullFields []string `json:"-"`
  2365. }
  2366. func (s *StartPageToken) MarshalJSON() ([]byte, error) {
  2367. type NoMethod StartPageToken
  2368. raw := NoMethod(*s)
  2369. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2370. }
  2371. // TeamDrive: Representation of a Team Drive.
  2372. type TeamDrive struct {
  2373. // BackgroundImageFile: An image file and cropping parameters from which
  2374. // a background image for this Team Drive is set. This is a write only
  2375. // field; it can only be set on drive.teamdrives.update requests that
  2376. // don't set themeId. When specified, all fields of the
  2377. // backgroundImageFile must be set.
  2378. BackgroundImageFile *TeamDriveBackgroundImageFile `json:"backgroundImageFile,omitempty"`
  2379. // BackgroundImageLink: A short-lived link to this Team Drive's
  2380. // background image.
  2381. BackgroundImageLink string `json:"backgroundImageLink,omitempty"`
  2382. // Capabilities: Capabilities the current user has on this Team Drive.
  2383. Capabilities *TeamDriveCapabilities `json:"capabilities,omitempty"`
  2384. // ColorRgb: The color of this Team Drive as an RGB hex string. It can
  2385. // only be set on a drive.teamdrives.update request that does not set
  2386. // themeId.
  2387. ColorRgb string `json:"colorRgb,omitempty"`
  2388. // CreatedDate: The time at which the Team Drive was created (RFC 3339
  2389. // date-time).
  2390. CreatedDate string `json:"createdDate,omitempty"`
  2391. // Id: The ID of this Team Drive which is also the ID of the top level
  2392. // folder of this Team Drive.
  2393. Id string `json:"id,omitempty"`
  2394. // Kind: This is always drive#teamDrive
  2395. Kind string `json:"kind,omitempty"`
  2396. // Name: The name of this Team Drive.
  2397. Name string `json:"name,omitempty"`
  2398. // Restrictions: A set of restrictions that apply to this Team Drive or
  2399. // items inside this Team Drive.
  2400. Restrictions *TeamDriveRestrictions `json:"restrictions,omitempty"`
  2401. // ThemeId: The ID of the theme from which the background image and
  2402. // color will be set. The set of possible teamDriveThemes can be
  2403. // retrieved from a drive.about.get response. When not specified on a
  2404. // drive.teamdrives.insert request, a random theme is chosen from which
  2405. // the background image and color are set. This is a write-only field;
  2406. // it can only be set on requests that don't set colorRgb or
  2407. // backgroundImageFile.
  2408. ThemeId string `json:"themeId,omitempty"`
  2409. // ServerResponse contains the HTTP response code and headers from the
  2410. // server.
  2411. googleapi.ServerResponse `json:"-"`
  2412. // ForceSendFields is a list of field names (e.g. "BackgroundImageFile")
  2413. // to unconditionally include in API requests. By default, fields with
  2414. // empty values are omitted from API requests. However, any non-pointer,
  2415. // non-interface field appearing in ForceSendFields will be sent to the
  2416. // server regardless of whether the field is empty or not. This may be
  2417. // used to include empty fields in Patch requests.
  2418. ForceSendFields []string `json:"-"`
  2419. // NullFields is a list of field names (e.g. "BackgroundImageFile") to
  2420. // include in API requests with the JSON null value. By default, fields
  2421. // with empty values are omitted from API requests. However, any field
  2422. // with an empty value appearing in NullFields will be sent to the
  2423. // server as null. It is an error if a field in this list has a
  2424. // non-empty value. This may be used to include null fields in Patch
  2425. // requests.
  2426. NullFields []string `json:"-"`
  2427. }
  2428. func (s *TeamDrive) MarshalJSON() ([]byte, error) {
  2429. type NoMethod TeamDrive
  2430. raw := NoMethod(*s)
  2431. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2432. }
  2433. // TeamDriveBackgroundImageFile: An image file and cropping parameters
  2434. // from which a background image for this Team Drive is set. This is a
  2435. // write only field; it can only be set on drive.teamdrives.update
  2436. // requests that don't set themeId. When specified, all fields of the
  2437. // backgroundImageFile must be set.
  2438. type TeamDriveBackgroundImageFile struct {
  2439. // Id: The ID of an image file in Drive to use for the background image.
  2440. Id string `json:"id,omitempty"`
  2441. // Width: The width of the cropped image in the closed range of 0 to 1.
  2442. // This value represents the width of the cropped image divided by the
  2443. // width of the entire image. The height is computed by applying a width
  2444. // to height aspect ratio of 80 to 9. The resulting image must be at
  2445. // least 1280 pixels wide and 144 pixels high.
  2446. Width float64 `json:"width,omitempty"`
  2447. // XCoordinate: The X coordinate of the upper left corner of the
  2448. // cropping area in the background image. This is a value in the closed
  2449. // range of 0 to 1. This value represents the horizontal distance from
  2450. // the left side of the entire image to the left side of the cropping
  2451. // area divided by the width of the entire image.
  2452. XCoordinate float64 `json:"xCoordinate,omitempty"`
  2453. // YCoordinate: The Y coordinate of the upper left corner of the
  2454. // cropping area in the background image. This is a value in the closed
  2455. // range of 0 to 1. This value represents the vertical distance from the
  2456. // top side of the entire image to the top side of the cropping area
  2457. // divided by the height of the entire image.
  2458. YCoordinate float64 `json:"yCoordinate,omitempty"`
  2459. // ForceSendFields is a list of field names (e.g. "Id") to
  2460. // unconditionally include in API requests. By default, fields with
  2461. // empty values are omitted from API requests. However, any non-pointer,
  2462. // non-interface field appearing in ForceSendFields will be sent to the
  2463. // server regardless of whether the field is empty or not. This may be
  2464. // used to include empty fields in Patch requests.
  2465. ForceSendFields []string `json:"-"`
  2466. // NullFields is a list of field names (e.g. "Id") to include in API
  2467. // requests with the JSON null value. By default, fields with empty
  2468. // values are omitted from API requests. However, any field with an
  2469. // empty value appearing in NullFields will be sent to the server as
  2470. // null. It is an error if a field in this list has a non-empty value.
  2471. // This may be used to include null fields in Patch requests.
  2472. NullFields []string `json:"-"`
  2473. }
  2474. func (s *TeamDriveBackgroundImageFile) MarshalJSON() ([]byte, error) {
  2475. type NoMethod TeamDriveBackgroundImageFile
  2476. raw := NoMethod(*s)
  2477. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2478. }
  2479. func (s *TeamDriveBackgroundImageFile) UnmarshalJSON(data []byte) error {
  2480. type NoMethod TeamDriveBackgroundImageFile
  2481. var s1 struct {
  2482. Width gensupport.JSONFloat64 `json:"width"`
  2483. XCoordinate gensupport.JSONFloat64 `json:"xCoordinate"`
  2484. YCoordinate gensupport.JSONFloat64 `json:"yCoordinate"`
  2485. *NoMethod
  2486. }
  2487. s1.NoMethod = (*NoMethod)(s)
  2488. if err := json.Unmarshal(data, &s1); err != nil {
  2489. return err
  2490. }
  2491. s.Width = float64(s1.Width)
  2492. s.XCoordinate = float64(s1.XCoordinate)
  2493. s.YCoordinate = float64(s1.YCoordinate)
  2494. return nil
  2495. }
  2496. // TeamDriveCapabilities: Capabilities the current user has on this Team
  2497. // Drive.
  2498. type TeamDriveCapabilities struct {
  2499. // CanAddChildren: Whether the current user can add children to folders
  2500. // in this Team Drive.
  2501. CanAddChildren bool `json:"canAddChildren,omitempty"`
  2502. // CanChangeCopyRequiresWriterPermissionRestriction: Whether the current
  2503. // user can change the copyRequiresWriterPermission restriction of this
  2504. // Team Drive.
  2505. CanChangeCopyRequiresWriterPermissionRestriction bool `json:"canChangeCopyRequiresWriterPermissionRestriction,omitempty"`
  2506. // CanChangeDomainUsersOnlyRestriction: Whether the current user can
  2507. // change the domainUsersOnly restriction of this Team Drive.
  2508. CanChangeDomainUsersOnlyRestriction bool `json:"canChangeDomainUsersOnlyRestriction,omitempty"`
  2509. // CanChangeTeamDriveBackground: Whether the current user can change the
  2510. // background of this Team Drive.
  2511. CanChangeTeamDriveBackground bool `json:"canChangeTeamDriveBackground,omitempty"`
  2512. // CanChangeTeamMembersOnlyRestriction: Whether the current user can
  2513. // change the teamMembersOnly restriction of this Team Drive.
  2514. CanChangeTeamMembersOnlyRestriction bool `json:"canChangeTeamMembersOnlyRestriction,omitempty"`
  2515. // CanComment: Whether the current user can comment on files in this
  2516. // Team Drive.
  2517. CanComment bool `json:"canComment,omitempty"`
  2518. // CanCopy: Whether the current user can copy files in this Team Drive.
  2519. CanCopy bool `json:"canCopy,omitempty"`
  2520. // CanDeleteChildren: Whether the current user can delete children from
  2521. // folders in this Team Drive.
  2522. CanDeleteChildren bool `json:"canDeleteChildren,omitempty"`
  2523. // CanDeleteTeamDrive: Whether the current user can delete this Team
  2524. // Drive. Attempting to delete the Team Drive may still fail if there
  2525. // are untrashed items inside the Team Drive.
  2526. CanDeleteTeamDrive bool `json:"canDeleteTeamDrive,omitempty"`
  2527. // CanDownload: Whether the current user can download files in this Team
  2528. // Drive.
  2529. CanDownload bool `json:"canDownload,omitempty"`
  2530. // CanEdit: Whether the current user can edit files in this Team Drive
  2531. CanEdit bool `json:"canEdit,omitempty"`
  2532. // CanListChildren: Whether the current user can list the children of
  2533. // folders in this Team Drive.
  2534. CanListChildren bool `json:"canListChildren,omitempty"`
  2535. // CanManageMembers: Whether the current user can add members to this
  2536. // Team Drive or remove them or change their role.
  2537. CanManageMembers bool `json:"canManageMembers,omitempty"`
  2538. // CanReadRevisions: Whether the current user can read the revisions
  2539. // resource of files in this Team Drive.
  2540. CanReadRevisions bool `json:"canReadRevisions,omitempty"`
  2541. // CanRemoveChildren: Deprecated - use canDeleteChildren or
  2542. // canTrashChildren instead.
  2543. CanRemoveChildren bool `json:"canRemoveChildren,omitempty"`
  2544. // CanRename: Whether the current user can rename files or folders in
  2545. // this Team Drive.
  2546. CanRename bool `json:"canRename,omitempty"`
  2547. // CanRenameTeamDrive: Whether the current user can rename this Team
  2548. // Drive.
  2549. CanRenameTeamDrive bool `json:"canRenameTeamDrive,omitempty"`
  2550. // CanShare: Whether the current user can share files or folders in this
  2551. // Team Drive.
  2552. CanShare bool `json:"canShare,omitempty"`
  2553. // CanTrashChildren: Whether the current user can trash children from
  2554. // folders in this Team Drive.
  2555. CanTrashChildren bool `json:"canTrashChildren,omitempty"`
  2556. // ForceSendFields is a list of field names (e.g. "CanAddChildren") to
  2557. // unconditionally include in API requests. By default, fields with
  2558. // empty values are omitted from API requests. However, any non-pointer,
  2559. // non-interface field appearing in ForceSendFields will be sent to the
  2560. // server regardless of whether the field is empty or not. This may be
  2561. // used to include empty fields in Patch requests.
  2562. ForceSendFields []string `json:"-"`
  2563. // NullFields is a list of field names (e.g. "CanAddChildren") to
  2564. // include in API requests with the JSON null value. By default, fields
  2565. // with empty values are omitted from API requests. However, any field
  2566. // with an empty value appearing in NullFields will be sent to the
  2567. // server as null. It is an error if a field in this list has a
  2568. // non-empty value. This may be used to include null fields in Patch
  2569. // requests.
  2570. NullFields []string `json:"-"`
  2571. }
  2572. func (s *TeamDriveCapabilities) MarshalJSON() ([]byte, error) {
  2573. type NoMethod TeamDriveCapabilities
  2574. raw := NoMethod(*s)
  2575. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2576. }
  2577. // TeamDriveRestrictions: A set of restrictions that apply to this Team
  2578. // Drive or items inside this Team Drive.
  2579. type TeamDriveRestrictions struct {
  2580. // AdminManagedRestrictions: Whether administrative privileges on this
  2581. // Team Drive are required to modify restrictions.
  2582. AdminManagedRestrictions bool `json:"adminManagedRestrictions,omitempty"`
  2583. // CopyRequiresWriterPermission: Whether the options to copy, print, or
  2584. // download files inside this Team Drive, should be disabled for readers
  2585. // and commenters. When this restriction is set to true, it will
  2586. // override the similarly named field to true for any file inside this
  2587. // Team Drive.
  2588. CopyRequiresWriterPermission bool `json:"copyRequiresWriterPermission,omitempty"`
  2589. // DomainUsersOnly: Whether access to this Team Drive and items inside
  2590. // this Team Drive is restricted to users of the domain to which this
  2591. // Team Drive belongs. This restriction may be overridden by other
  2592. // sharing policies controlled outside of this Team Drive.
  2593. DomainUsersOnly bool `json:"domainUsersOnly,omitempty"`
  2594. // TeamMembersOnly: Whether access to items inside this Team Drive is
  2595. // restricted to members of this Team Drive.
  2596. TeamMembersOnly bool `json:"teamMembersOnly,omitempty"`
  2597. // ForceSendFields is a list of field names (e.g.
  2598. // "AdminManagedRestrictions") to unconditionally include in API
  2599. // requests. By default, fields with empty values are omitted from API
  2600. // requests. However, any non-pointer, non-interface field appearing in
  2601. // ForceSendFields will be sent to the server regardless of whether the
  2602. // field is empty or not. This may be used to include empty fields in
  2603. // Patch requests.
  2604. ForceSendFields []string `json:"-"`
  2605. // NullFields is a list of field names (e.g. "AdminManagedRestrictions")
  2606. // to include in API requests with the JSON null value. By default,
  2607. // fields with empty values are omitted from API requests. However, any
  2608. // field with an empty value appearing in NullFields will be sent to the
  2609. // server as null. It is an error if a field in this list has a
  2610. // non-empty value. This may be used to include null fields in Patch
  2611. // requests.
  2612. NullFields []string `json:"-"`
  2613. }
  2614. func (s *TeamDriveRestrictions) MarshalJSON() ([]byte, error) {
  2615. type NoMethod TeamDriveRestrictions
  2616. raw := NoMethod(*s)
  2617. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2618. }
  2619. // TeamDriveList: A list of Team Drives.
  2620. type TeamDriveList struct {
  2621. // Items: The list of Team Drives.
  2622. Items []*TeamDrive `json:"items,omitempty"`
  2623. // Kind: This is always drive#teamDriveList
  2624. Kind string `json:"kind,omitempty"`
  2625. // NextPageToken: The page token for the next page of Team Drives.
  2626. NextPageToken string `json:"nextPageToken,omitempty"`
  2627. // ServerResponse contains the HTTP response code and headers from the
  2628. // server.
  2629. googleapi.ServerResponse `json:"-"`
  2630. // ForceSendFields is a list of field names (e.g. "Items") to
  2631. // unconditionally include in API requests. By default, fields with
  2632. // empty values are omitted from API requests. However, any non-pointer,
  2633. // non-interface field appearing in ForceSendFields will be sent to the
  2634. // server regardless of whether the field is empty or not. This may be
  2635. // used to include empty fields in Patch requests.
  2636. ForceSendFields []string `json:"-"`
  2637. // NullFields is a list of field names (e.g. "Items") to include in API
  2638. // requests with the JSON null value. By default, fields with empty
  2639. // values are omitted from API requests. However, any field with an
  2640. // empty value appearing in NullFields will be sent to the server as
  2641. // null. It is an error if a field in this list has a non-empty value.
  2642. // This may be used to include null fields in Patch requests.
  2643. NullFields []string `json:"-"`
  2644. }
  2645. func (s *TeamDriveList) MarshalJSON() ([]byte, error) {
  2646. type NoMethod TeamDriveList
  2647. raw := NoMethod(*s)
  2648. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2649. }
  2650. // User: Information about a Drive user.
  2651. type User struct {
  2652. // DisplayName: A plain text displayable name for this user.
  2653. DisplayName string `json:"displayName,omitempty"`
  2654. // EmailAddress: The email address of the user.
  2655. EmailAddress string `json:"emailAddress,omitempty"`
  2656. // IsAuthenticatedUser: Whether this user is the same as the
  2657. // authenticated user for whom the request was made.
  2658. IsAuthenticatedUser bool `json:"isAuthenticatedUser,omitempty"`
  2659. // Kind: This is always drive#user.
  2660. Kind string `json:"kind,omitempty"`
  2661. // PermissionId: The user's ID as visible in the permissions collection.
  2662. PermissionId string `json:"permissionId,omitempty"`
  2663. // Picture: The user's profile picture.
  2664. Picture *UserPicture `json:"picture,omitempty"`
  2665. // ForceSendFields is a list of field names (e.g. "DisplayName") to
  2666. // unconditionally include in API requests. By default, fields with
  2667. // empty values are omitted from API requests. However, any non-pointer,
  2668. // non-interface field appearing in ForceSendFields will be sent to the
  2669. // server regardless of whether the field is empty or not. This may be
  2670. // used to include empty fields in Patch requests.
  2671. ForceSendFields []string `json:"-"`
  2672. // NullFields is a list of field names (e.g. "DisplayName") to include
  2673. // in API requests with the JSON null value. By default, fields with
  2674. // empty values are omitted from API requests. However, any field with
  2675. // an empty value appearing in NullFields will be sent to the server as
  2676. // null. It is an error if a field in this list has a non-empty value.
  2677. // This may be used to include null fields in Patch requests.
  2678. NullFields []string `json:"-"`
  2679. }
  2680. func (s *User) MarshalJSON() ([]byte, error) {
  2681. type NoMethod User
  2682. raw := NoMethod(*s)
  2683. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2684. }
  2685. // UserPicture: The user's profile picture.
  2686. type UserPicture struct {
  2687. // Url: A URL that points to a profile picture of this user.
  2688. Url string `json:"url,omitempty"`
  2689. // ForceSendFields is a list of field names (e.g. "Url") to
  2690. // unconditionally include in API requests. By default, fields with
  2691. // empty values are omitted from API requests. However, any non-pointer,
  2692. // non-interface field appearing in ForceSendFields will be sent to the
  2693. // server regardless of whether the field is empty or not. This may be
  2694. // used to include empty fields in Patch requests.
  2695. ForceSendFields []string `json:"-"`
  2696. // NullFields is a list of field names (e.g. "Url") to include in API
  2697. // requests with the JSON null value. By default, fields with empty
  2698. // values are omitted from API requests. However, any field with an
  2699. // empty value appearing in NullFields will be sent to the server as
  2700. // null. It is an error if a field in this list has a non-empty value.
  2701. // This may be used to include null fields in Patch requests.
  2702. NullFields []string `json:"-"`
  2703. }
  2704. func (s *UserPicture) MarshalJSON() ([]byte, error) {
  2705. type NoMethod UserPicture
  2706. raw := NoMethod(*s)
  2707. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2708. }
  2709. // method id "drive.about.get":
  2710. type AboutGetCall struct {
  2711. s *Service
  2712. urlParams_ gensupport.URLParams
  2713. ifNoneMatch_ string
  2714. ctx_ context.Context
  2715. header_ http.Header
  2716. }
  2717. // Get: Gets the information about the current user along with Drive API
  2718. // settings
  2719. func (r *AboutService) Get() *AboutGetCall {
  2720. c := &AboutGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2721. return c
  2722. }
  2723. // IncludeSubscribed sets the optional parameter "includeSubscribed":
  2724. // Whether to count changes outside the My Drive hierarchy. When set to
  2725. // false, changes to files such as those in the Application Data folder
  2726. // or shared files which have not been added to My Drive will be omitted
  2727. // from the maxChangeIdCount.
  2728. func (c *AboutGetCall) IncludeSubscribed(includeSubscribed bool) *AboutGetCall {
  2729. c.urlParams_.Set("includeSubscribed", fmt.Sprint(includeSubscribed))
  2730. return c
  2731. }
  2732. // MaxChangeIdCount sets the optional parameter "maxChangeIdCount":
  2733. // Maximum number of remaining change IDs to count
  2734. func (c *AboutGetCall) MaxChangeIdCount(maxChangeIdCount int64) *AboutGetCall {
  2735. c.urlParams_.Set("maxChangeIdCount", fmt.Sprint(maxChangeIdCount))
  2736. return c
  2737. }
  2738. // StartChangeId sets the optional parameter "startChangeId": Change ID
  2739. // to start counting from when calculating number of remaining change
  2740. // IDs
  2741. func (c *AboutGetCall) StartChangeId(startChangeId int64) *AboutGetCall {
  2742. c.urlParams_.Set("startChangeId", fmt.Sprint(startChangeId))
  2743. return c
  2744. }
  2745. // Fields allows partial responses to be retrieved. See
  2746. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2747. // for more information.
  2748. func (c *AboutGetCall) Fields(s ...googleapi.Field) *AboutGetCall {
  2749. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2750. return c
  2751. }
  2752. // IfNoneMatch sets the optional parameter which makes the operation
  2753. // fail if the object's ETag matches the given value. This is useful for
  2754. // getting updates only after the object has changed since the last
  2755. // request. Use googleapi.IsNotModified to check whether the response
  2756. // error from Do is the result of In-None-Match.
  2757. func (c *AboutGetCall) IfNoneMatch(entityTag string) *AboutGetCall {
  2758. c.ifNoneMatch_ = entityTag
  2759. return c
  2760. }
  2761. // Context sets the context to be used in this call's Do method. Any
  2762. // pending HTTP request will be aborted if the provided context is
  2763. // canceled.
  2764. func (c *AboutGetCall) Context(ctx context.Context) *AboutGetCall {
  2765. c.ctx_ = ctx
  2766. return c
  2767. }
  2768. // Header returns an http.Header that can be modified by the caller to
  2769. // add HTTP headers to the request.
  2770. func (c *AboutGetCall) Header() http.Header {
  2771. if c.header_ == nil {
  2772. c.header_ = make(http.Header)
  2773. }
  2774. return c.header_
  2775. }
  2776. func (c *AboutGetCall) doRequest(alt string) (*http.Response, error) {
  2777. reqHeaders := make(http.Header)
  2778. for k, v := range c.header_ {
  2779. reqHeaders[k] = v
  2780. }
  2781. reqHeaders.Set("User-Agent", c.s.userAgent())
  2782. if c.ifNoneMatch_ != "" {
  2783. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  2784. }
  2785. var body io.Reader = nil
  2786. c.urlParams_.Set("alt", alt)
  2787. c.urlParams_.Set("prettyPrint", "false")
  2788. urls := googleapi.ResolveRelative(c.s.BasePath, "about")
  2789. urls += "?" + c.urlParams_.Encode()
  2790. req, err := http.NewRequest("GET", urls, body)
  2791. if err != nil {
  2792. return nil, err
  2793. }
  2794. req.Header = reqHeaders
  2795. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2796. }
  2797. // Do executes the "drive.about.get" call.
  2798. // Exactly one of *About or error will be non-nil. Any non-2xx status
  2799. // code is an error. Response headers are in either
  2800. // *About.ServerResponse.Header or (if a response was returned at all)
  2801. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  2802. // check whether the returned error was because http.StatusNotModified
  2803. // was returned.
  2804. func (c *AboutGetCall) Do(opts ...googleapi.CallOption) (*About, error) {
  2805. gensupport.SetOptions(c.urlParams_, opts...)
  2806. res, err := c.doRequest("json")
  2807. if res != nil && res.StatusCode == http.StatusNotModified {
  2808. if res.Body != nil {
  2809. res.Body.Close()
  2810. }
  2811. return nil, &googleapi.Error{
  2812. Code: res.StatusCode,
  2813. Header: res.Header,
  2814. }
  2815. }
  2816. if err != nil {
  2817. return nil, err
  2818. }
  2819. defer googleapi.CloseBody(res)
  2820. if err := googleapi.CheckResponse(res); err != nil {
  2821. return nil, err
  2822. }
  2823. ret := &About{
  2824. ServerResponse: googleapi.ServerResponse{
  2825. Header: res.Header,
  2826. HTTPStatusCode: res.StatusCode,
  2827. },
  2828. }
  2829. target := &ret
  2830. if err := gensupport.DecodeResponse(target, res); err != nil {
  2831. return nil, err
  2832. }
  2833. return ret, nil
  2834. // {
  2835. // "description": "Gets the information about the current user along with Drive API settings",
  2836. // "httpMethod": "GET",
  2837. // "id": "drive.about.get",
  2838. // "parameters": {
  2839. // "includeSubscribed": {
  2840. // "default": "true",
  2841. // "description": "Whether to count changes outside the My Drive hierarchy. When set to false, changes to files such as those in the Application Data folder or shared files which have not been added to My Drive will be omitted from the maxChangeIdCount.",
  2842. // "location": "query",
  2843. // "type": "boolean"
  2844. // },
  2845. // "maxChangeIdCount": {
  2846. // "default": "1",
  2847. // "description": "Maximum number of remaining change IDs to count",
  2848. // "format": "int64",
  2849. // "location": "query",
  2850. // "type": "string"
  2851. // },
  2852. // "startChangeId": {
  2853. // "description": "Change ID to start counting from when calculating number of remaining change IDs",
  2854. // "format": "int64",
  2855. // "location": "query",
  2856. // "type": "string"
  2857. // }
  2858. // },
  2859. // "path": "about",
  2860. // "response": {
  2861. // "$ref": "About"
  2862. // },
  2863. // "scopes": [
  2864. // "https://www.googleapis.com/auth/drive",
  2865. // "https://www.googleapis.com/auth/drive.appdata",
  2866. // "https://www.googleapis.com/auth/drive.file",
  2867. // "https://www.googleapis.com/auth/drive.metadata",
  2868. // "https://www.googleapis.com/auth/drive.metadata.readonly",
  2869. // "https://www.googleapis.com/auth/drive.photos.readonly",
  2870. // "https://www.googleapis.com/auth/drive.readonly"
  2871. // ]
  2872. // }
  2873. }
  2874. // method id "drive.apps.get":
  2875. type AppsGetCall struct {
  2876. s *Service
  2877. appId string
  2878. urlParams_ gensupport.URLParams
  2879. ifNoneMatch_ string
  2880. ctx_ context.Context
  2881. header_ http.Header
  2882. }
  2883. // Get: Gets a specific app.
  2884. func (r *AppsService) Get(appId string) *AppsGetCall {
  2885. c := &AppsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2886. c.appId = appId
  2887. return c
  2888. }
  2889. // Fields allows partial responses to be retrieved. See
  2890. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2891. // for more information.
  2892. func (c *AppsGetCall) Fields(s ...googleapi.Field) *AppsGetCall {
  2893. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2894. return c
  2895. }
  2896. // IfNoneMatch sets the optional parameter which makes the operation
  2897. // fail if the object's ETag matches the given value. This is useful for
  2898. // getting updates only after the object has changed since the last
  2899. // request. Use googleapi.IsNotModified to check whether the response
  2900. // error from Do is the result of In-None-Match.
  2901. func (c *AppsGetCall) IfNoneMatch(entityTag string) *AppsGetCall {
  2902. c.ifNoneMatch_ = entityTag
  2903. return c
  2904. }
  2905. // Context sets the context to be used in this call's Do method. Any
  2906. // pending HTTP request will be aborted if the provided context is
  2907. // canceled.
  2908. func (c *AppsGetCall) Context(ctx context.Context) *AppsGetCall {
  2909. c.ctx_ = ctx
  2910. return c
  2911. }
  2912. // Header returns an http.Header that can be modified by the caller to
  2913. // add HTTP headers to the request.
  2914. func (c *AppsGetCall) Header() http.Header {
  2915. if c.header_ == nil {
  2916. c.header_ = make(http.Header)
  2917. }
  2918. return c.header_
  2919. }
  2920. func (c *AppsGetCall) doRequest(alt string) (*http.Response, error) {
  2921. reqHeaders := make(http.Header)
  2922. for k, v := range c.header_ {
  2923. reqHeaders[k] = v
  2924. }
  2925. reqHeaders.Set("User-Agent", c.s.userAgent())
  2926. if c.ifNoneMatch_ != "" {
  2927. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  2928. }
  2929. var body io.Reader = nil
  2930. c.urlParams_.Set("alt", alt)
  2931. c.urlParams_.Set("prettyPrint", "false")
  2932. urls := googleapi.ResolveRelative(c.s.BasePath, "apps/{appId}")
  2933. urls += "?" + c.urlParams_.Encode()
  2934. req, err := http.NewRequest("GET", urls, body)
  2935. if err != nil {
  2936. return nil, err
  2937. }
  2938. req.Header = reqHeaders
  2939. googleapi.Expand(req.URL, map[string]string{
  2940. "appId": c.appId,
  2941. })
  2942. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2943. }
  2944. // Do executes the "drive.apps.get" call.
  2945. // Exactly one of *App or error will be non-nil. Any non-2xx status code
  2946. // is an error. Response headers are in either
  2947. // *App.ServerResponse.Header or (if a response was returned at all) in
  2948. // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  2949. // whether the returned error was because http.StatusNotModified was
  2950. // returned.
  2951. func (c *AppsGetCall) Do(opts ...googleapi.CallOption) (*App, error) {
  2952. gensupport.SetOptions(c.urlParams_, opts...)
  2953. res, err := c.doRequest("json")
  2954. if res != nil && res.StatusCode == http.StatusNotModified {
  2955. if res.Body != nil {
  2956. res.Body.Close()
  2957. }
  2958. return nil, &googleapi.Error{
  2959. Code: res.StatusCode,
  2960. Header: res.Header,
  2961. }
  2962. }
  2963. if err != nil {
  2964. return nil, err
  2965. }
  2966. defer googleapi.CloseBody(res)
  2967. if err := googleapi.CheckResponse(res); err != nil {
  2968. return nil, err
  2969. }
  2970. ret := &App{
  2971. ServerResponse: googleapi.ServerResponse{
  2972. Header: res.Header,
  2973. HTTPStatusCode: res.StatusCode,
  2974. },
  2975. }
  2976. target := &ret
  2977. if err := gensupport.DecodeResponse(target, res); err != nil {
  2978. return nil, err
  2979. }
  2980. return ret, nil
  2981. // {
  2982. // "description": "Gets a specific app.",
  2983. // "httpMethod": "GET",
  2984. // "id": "drive.apps.get",
  2985. // "parameterOrder": [
  2986. // "appId"
  2987. // ],
  2988. // "parameters": {
  2989. // "appId": {
  2990. // "description": "The ID of the app.",
  2991. // "location": "path",
  2992. // "required": true,
  2993. // "type": "string"
  2994. // }
  2995. // },
  2996. // "path": "apps/{appId}",
  2997. // "response": {
  2998. // "$ref": "App"
  2999. // },
  3000. // "scopes": [
  3001. // "https://www.googleapis.com/auth/drive",
  3002. // "https://www.googleapis.com/auth/drive.appdata",
  3003. // "https://www.googleapis.com/auth/drive.apps.readonly",
  3004. // "https://www.googleapis.com/auth/drive.file",
  3005. // "https://www.googleapis.com/auth/drive.metadata",
  3006. // "https://www.googleapis.com/auth/drive.metadata.readonly",
  3007. // "https://www.googleapis.com/auth/drive.readonly"
  3008. // ]
  3009. // }
  3010. }
  3011. // method id "drive.apps.list":
  3012. type AppsListCall struct {
  3013. s *Service
  3014. urlParams_ gensupport.URLParams
  3015. ifNoneMatch_ string
  3016. ctx_ context.Context
  3017. header_ http.Header
  3018. }
  3019. // List: Lists a user's installed apps.
  3020. func (r *AppsService) List() *AppsListCall {
  3021. c := &AppsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3022. return c
  3023. }
  3024. // AppFilterExtensions sets the optional parameter
  3025. // "appFilterExtensions": A comma-separated list of file extensions for
  3026. // open with filtering. All apps within the given app query scope which
  3027. // can open any of the given file extensions will be included in the
  3028. // response. If appFilterMimeTypes are provided as well, the result is a
  3029. // union of the two resulting app lists.
  3030. func (c *AppsListCall) AppFilterExtensions(appFilterExtensions string) *AppsListCall {
  3031. c.urlParams_.Set("appFilterExtensions", appFilterExtensions)
  3032. return c
  3033. }
  3034. // AppFilterMimeTypes sets the optional parameter "appFilterMimeTypes":
  3035. // A comma-separated list of MIME types for open with filtering. All
  3036. // apps within the given app query scope which can open any of the given
  3037. // MIME types will be included in the response. If appFilterExtensions
  3038. // are provided as well, the result is a union of the two resulting app
  3039. // lists.
  3040. func (c *AppsListCall) AppFilterMimeTypes(appFilterMimeTypes string) *AppsListCall {
  3041. c.urlParams_.Set("appFilterMimeTypes", appFilterMimeTypes)
  3042. return c
  3043. }
  3044. // LanguageCode sets the optional parameter "languageCode": A language
  3045. // or locale code, as defined by BCP 47, with some extensions from
  3046. // Unicode's LDML format (http://www.unicode.org/reports/tr35/).
  3047. func (c *AppsListCall) LanguageCode(languageCode string) *AppsListCall {
  3048. c.urlParams_.Set("languageCode", languageCode)
  3049. return c
  3050. }
  3051. // Fields allows partial responses to be retrieved. See
  3052. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3053. // for more information.
  3054. func (c *AppsListCall) Fields(s ...googleapi.Field) *AppsListCall {
  3055. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3056. return c
  3057. }
  3058. // IfNoneMatch sets the optional parameter which makes the operation
  3059. // fail if the object's ETag matches the given value. This is useful for
  3060. // getting updates only after the object has changed since the last
  3061. // request. Use googleapi.IsNotModified to check whether the response
  3062. // error from Do is the result of In-None-Match.
  3063. func (c *AppsListCall) IfNoneMatch(entityTag string) *AppsListCall {
  3064. c.ifNoneMatch_ = entityTag
  3065. return c
  3066. }
  3067. // Context sets the context to be used in this call's Do method. Any
  3068. // pending HTTP request will be aborted if the provided context is
  3069. // canceled.
  3070. func (c *AppsListCall) Context(ctx context.Context) *AppsListCall {
  3071. c.ctx_ = ctx
  3072. return c
  3073. }
  3074. // Header returns an http.Header that can be modified by the caller to
  3075. // add HTTP headers to the request.
  3076. func (c *AppsListCall) Header() http.Header {
  3077. if c.header_ == nil {
  3078. c.header_ = make(http.Header)
  3079. }
  3080. return c.header_
  3081. }
  3082. func (c *AppsListCall) doRequest(alt string) (*http.Response, error) {
  3083. reqHeaders := make(http.Header)
  3084. for k, v := range c.header_ {
  3085. reqHeaders[k] = v
  3086. }
  3087. reqHeaders.Set("User-Agent", c.s.userAgent())
  3088. if c.ifNoneMatch_ != "" {
  3089. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  3090. }
  3091. var body io.Reader = nil
  3092. c.urlParams_.Set("alt", alt)
  3093. c.urlParams_.Set("prettyPrint", "false")
  3094. urls := googleapi.ResolveRelative(c.s.BasePath, "apps")
  3095. urls += "?" + c.urlParams_.Encode()
  3096. req, err := http.NewRequest("GET", urls, body)
  3097. if err != nil {
  3098. return nil, err
  3099. }
  3100. req.Header = reqHeaders
  3101. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3102. }
  3103. // Do executes the "drive.apps.list" call.
  3104. // Exactly one of *AppList or error will be non-nil. Any non-2xx status
  3105. // code is an error. Response headers are in either
  3106. // *AppList.ServerResponse.Header or (if a response was returned at all)
  3107. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  3108. // check whether the returned error was because http.StatusNotModified
  3109. // was returned.
  3110. func (c *AppsListCall) Do(opts ...googleapi.CallOption) (*AppList, error) {
  3111. gensupport.SetOptions(c.urlParams_, opts...)
  3112. res, err := c.doRequest("json")
  3113. if res != nil && res.StatusCode == http.StatusNotModified {
  3114. if res.Body != nil {
  3115. res.Body.Close()
  3116. }
  3117. return nil, &googleapi.Error{
  3118. Code: res.StatusCode,
  3119. Header: res.Header,
  3120. }
  3121. }
  3122. if err != nil {
  3123. return nil, err
  3124. }
  3125. defer googleapi.CloseBody(res)
  3126. if err := googleapi.CheckResponse(res); err != nil {
  3127. return nil, err
  3128. }
  3129. ret := &AppList{
  3130. ServerResponse: googleapi.ServerResponse{
  3131. Header: res.Header,
  3132. HTTPStatusCode: res.StatusCode,
  3133. },
  3134. }
  3135. target := &ret
  3136. if err := gensupport.DecodeResponse(target, res); err != nil {
  3137. return nil, err
  3138. }
  3139. return ret, nil
  3140. // {
  3141. // "description": "Lists a user's installed apps.",
  3142. // "httpMethod": "GET",
  3143. // "id": "drive.apps.list",
  3144. // "parameters": {
  3145. // "appFilterExtensions": {
  3146. // "default": "",
  3147. // "description": "A comma-separated list of file extensions for open with filtering. All apps within the given app query scope which can open any of the given file extensions will be included in the response. If appFilterMimeTypes are provided as well, the result is a union of the two resulting app lists.",
  3148. // "location": "query",
  3149. // "type": "string"
  3150. // },
  3151. // "appFilterMimeTypes": {
  3152. // "default": "",
  3153. // "description": "A comma-separated list of MIME types for open with filtering. All apps within the given app query scope which can open any of the given MIME types will be included in the response. If appFilterExtensions are provided as well, the result is a union of the two resulting app lists.",
  3154. // "location": "query",
  3155. // "type": "string"
  3156. // },
  3157. // "languageCode": {
  3158. // "description": "A language or locale code, as defined by BCP 47, with some extensions from Unicode's LDML format (http://www.unicode.org/reports/tr35/).",
  3159. // "location": "query",
  3160. // "type": "string"
  3161. // }
  3162. // },
  3163. // "path": "apps",
  3164. // "response": {
  3165. // "$ref": "AppList"
  3166. // },
  3167. // "scopes": [
  3168. // "https://www.googleapis.com/auth/drive.apps.readonly"
  3169. // ]
  3170. // }
  3171. }
  3172. // method id "drive.changes.get":
  3173. type ChangesGetCall struct {
  3174. s *Service
  3175. changeId string
  3176. urlParams_ gensupport.URLParams
  3177. ifNoneMatch_ string
  3178. ctx_ context.Context
  3179. header_ http.Header
  3180. }
  3181. // Get: Deprecated - Use changes.getStartPageToken and changes.list to
  3182. // retrieve recent changes.
  3183. func (r *ChangesService) Get(changeId string) *ChangesGetCall {
  3184. c := &ChangesGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3185. c.changeId = changeId
  3186. return c
  3187. }
  3188. // SupportsTeamDrives sets the optional parameter "supportsTeamDrives":
  3189. // Whether the requesting application supports Team Drives.
  3190. func (c *ChangesGetCall) SupportsTeamDrives(supportsTeamDrives bool) *ChangesGetCall {
  3191. c.urlParams_.Set("supportsTeamDrives", fmt.Sprint(supportsTeamDrives))
  3192. return c
  3193. }
  3194. // TeamDriveId sets the optional parameter "teamDriveId": The Team Drive
  3195. // from which the change will be returned.
  3196. func (c *ChangesGetCall) TeamDriveId(teamDriveId string) *ChangesGetCall {
  3197. c.urlParams_.Set("teamDriveId", teamDriveId)
  3198. return c
  3199. }
  3200. // Fields allows partial responses to be retrieved. See
  3201. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3202. // for more information.
  3203. func (c *ChangesGetCall) Fields(s ...googleapi.Field) *ChangesGetCall {
  3204. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3205. return c
  3206. }
  3207. // IfNoneMatch sets the optional parameter which makes the operation
  3208. // fail if the object's ETag matches the given value. This is useful for
  3209. // getting updates only after the object has changed since the last
  3210. // request. Use googleapi.IsNotModified to check whether the response
  3211. // error from Do is the result of In-None-Match.
  3212. func (c *ChangesGetCall) IfNoneMatch(entityTag string) *ChangesGetCall {
  3213. c.ifNoneMatch_ = entityTag
  3214. return c
  3215. }
  3216. // Context sets the context to be used in this call's Do method. Any
  3217. // pending HTTP request will be aborted if the provided context is
  3218. // canceled.
  3219. func (c *ChangesGetCall) Context(ctx context.Context) *ChangesGetCall {
  3220. c.ctx_ = ctx
  3221. return c
  3222. }
  3223. // Header returns an http.Header that can be modified by the caller to
  3224. // add HTTP headers to the request.
  3225. func (c *ChangesGetCall) Header() http.Header {
  3226. if c.header_ == nil {
  3227. c.header_ = make(http.Header)
  3228. }
  3229. return c.header_
  3230. }
  3231. func (c *ChangesGetCall) doRequest(alt string) (*http.Response, error) {
  3232. reqHeaders := make(http.Header)
  3233. for k, v := range c.header_ {
  3234. reqHeaders[k] = v
  3235. }
  3236. reqHeaders.Set("User-Agent", c.s.userAgent())
  3237. if c.ifNoneMatch_ != "" {
  3238. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  3239. }
  3240. var body io.Reader = nil
  3241. c.urlParams_.Set("alt", alt)
  3242. c.urlParams_.Set("prettyPrint", "false")
  3243. urls := googleapi.ResolveRelative(c.s.BasePath, "changes/{changeId}")
  3244. urls += "?" + c.urlParams_.Encode()
  3245. req, err := http.NewRequest("GET", urls, body)
  3246. if err != nil {
  3247. return nil, err
  3248. }
  3249. req.Header = reqHeaders
  3250. googleapi.Expand(req.URL, map[string]string{
  3251. "changeId": c.changeId,
  3252. })
  3253. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3254. }
  3255. // Do executes the "drive.changes.get" call.
  3256. // Exactly one of *Change or error will be non-nil. Any non-2xx status
  3257. // code is an error. Response headers are in either
  3258. // *Change.ServerResponse.Header or (if a response was returned at all)
  3259. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  3260. // check whether the returned error was because http.StatusNotModified
  3261. // was returned.
  3262. func (c *ChangesGetCall) Do(opts ...googleapi.CallOption) (*Change, error) {
  3263. gensupport.SetOptions(c.urlParams_, opts...)
  3264. res, err := c.doRequest("json")
  3265. if res != nil && res.StatusCode == http.StatusNotModified {
  3266. if res.Body != nil {
  3267. res.Body.Close()
  3268. }
  3269. return nil, &googleapi.Error{
  3270. Code: res.StatusCode,
  3271. Header: res.Header,
  3272. }
  3273. }
  3274. if err != nil {
  3275. return nil, err
  3276. }
  3277. defer googleapi.CloseBody(res)
  3278. if err := googleapi.CheckResponse(res); err != nil {
  3279. return nil, err
  3280. }
  3281. ret := &Change{
  3282. ServerResponse: googleapi.ServerResponse{
  3283. Header: res.Header,
  3284. HTTPStatusCode: res.StatusCode,
  3285. },
  3286. }
  3287. target := &ret
  3288. if err := gensupport.DecodeResponse(target, res); err != nil {
  3289. return nil, err
  3290. }
  3291. return ret, nil
  3292. // {
  3293. // "description": "Deprecated - Use changes.getStartPageToken and changes.list to retrieve recent changes.",
  3294. // "httpMethod": "GET",
  3295. // "id": "drive.changes.get",
  3296. // "parameterOrder": [
  3297. // "changeId"
  3298. // ],
  3299. // "parameters": {
  3300. // "changeId": {
  3301. // "description": "The ID of the change.",
  3302. // "location": "path",
  3303. // "required": true,
  3304. // "type": "string"
  3305. // },
  3306. // "supportsTeamDrives": {
  3307. // "default": "false",
  3308. // "description": "Whether the requesting application supports Team Drives.",
  3309. // "location": "query",
  3310. // "type": "boolean"
  3311. // },
  3312. // "teamDriveId": {
  3313. // "description": "The Team Drive from which the change will be returned.",
  3314. // "location": "query",
  3315. // "type": "string"
  3316. // }
  3317. // },
  3318. // "path": "changes/{changeId}",
  3319. // "response": {
  3320. // "$ref": "Change"
  3321. // },
  3322. // "scopes": [
  3323. // "https://www.googleapis.com/auth/drive",
  3324. // "https://www.googleapis.com/auth/drive.appdata",
  3325. // "https://www.googleapis.com/auth/drive.apps.readonly",
  3326. // "https://www.googleapis.com/auth/drive.file",
  3327. // "https://www.googleapis.com/auth/drive.metadata",
  3328. // "https://www.googleapis.com/auth/drive.metadata.readonly",
  3329. // "https://www.googleapis.com/auth/drive.photos.readonly",
  3330. // "https://www.googleapis.com/auth/drive.readonly"
  3331. // ]
  3332. // }
  3333. }
  3334. // method id "drive.changes.getStartPageToken":
  3335. type ChangesGetStartPageTokenCall struct {
  3336. s *Service
  3337. urlParams_ gensupport.URLParams
  3338. ifNoneMatch_ string
  3339. ctx_ context.Context
  3340. header_ http.Header
  3341. }
  3342. // GetStartPageToken: Gets the starting pageToken for listing future
  3343. // changes.
  3344. func (r *ChangesService) GetStartPageToken() *ChangesGetStartPageTokenCall {
  3345. c := &ChangesGetStartPageTokenCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3346. return c
  3347. }
  3348. // SupportsTeamDrives sets the optional parameter "supportsTeamDrives":
  3349. // Whether the requesting application supports Team Drives.
  3350. func (c *ChangesGetStartPageTokenCall) SupportsTeamDrives(supportsTeamDrives bool) *ChangesGetStartPageTokenCall {
  3351. c.urlParams_.Set("supportsTeamDrives", fmt.Sprint(supportsTeamDrives))
  3352. return c
  3353. }
  3354. // TeamDriveId sets the optional parameter "teamDriveId": The ID of the
  3355. // Team Drive for which the starting pageToken for listing future
  3356. // changes from that Team Drive will be returned.
  3357. func (c *ChangesGetStartPageTokenCall) TeamDriveId(teamDriveId string) *ChangesGetStartPageTokenCall {
  3358. c.urlParams_.Set("teamDriveId", teamDriveId)
  3359. return c
  3360. }
  3361. // Fields allows partial responses to be retrieved. See
  3362. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3363. // for more information.
  3364. func (c *ChangesGetStartPageTokenCall) Fields(s ...googleapi.Field) *ChangesGetStartPageTokenCall {
  3365. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3366. return c
  3367. }
  3368. // IfNoneMatch sets the optional parameter which makes the operation
  3369. // fail if the object's ETag matches the given value. This is useful for
  3370. // getting updates only after the object has changed since the last
  3371. // request. Use googleapi.IsNotModified to check whether the response
  3372. // error from Do is the result of In-None-Match.
  3373. func (c *ChangesGetStartPageTokenCall) IfNoneMatch(entityTag string) *ChangesGetStartPageTokenCall {
  3374. c.ifNoneMatch_ = entityTag
  3375. return c
  3376. }
  3377. // Context sets the context to be used in this call's Do method. Any
  3378. // pending HTTP request will be aborted if the provided context is
  3379. // canceled.
  3380. func (c *ChangesGetStartPageTokenCall) Context(ctx context.Context) *ChangesGetStartPageTokenCall {
  3381. c.ctx_ = ctx
  3382. return c
  3383. }
  3384. // Header returns an http.Header that can be modified by the caller to
  3385. // add HTTP headers to the request.
  3386. func (c *ChangesGetStartPageTokenCall) Header() http.Header {
  3387. if c.header_ == nil {
  3388. c.header_ = make(http.Header)
  3389. }
  3390. return c.header_
  3391. }
  3392. func (c *ChangesGetStartPageTokenCall) doRequest(alt string) (*http.Response, error) {
  3393. reqHeaders := make(http.Header)
  3394. for k, v := range c.header_ {
  3395. reqHeaders[k] = v
  3396. }
  3397. reqHeaders.Set("User-Agent", c.s.userAgent())
  3398. if c.ifNoneMatch_ != "" {
  3399. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  3400. }
  3401. var body io.Reader = nil
  3402. c.urlParams_.Set("alt", alt)
  3403. c.urlParams_.Set("prettyPrint", "false")
  3404. urls := googleapi.ResolveRelative(c.s.BasePath, "changes/startPageToken")
  3405. urls += "?" + c.urlParams_.Encode()
  3406. req, err := http.NewRequest("GET", urls, body)
  3407. if err != nil {
  3408. return nil, err
  3409. }
  3410. req.Header = reqHeaders
  3411. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3412. }
  3413. // Do executes the "drive.changes.getStartPageToken" call.
  3414. // Exactly one of *StartPageToken or error will be non-nil. Any non-2xx
  3415. // status code is an error. Response headers are in either
  3416. // *StartPageToken.ServerResponse.Header or (if a response was returned
  3417. // at all) in error.(*googleapi.Error).Header. Use
  3418. // googleapi.IsNotModified to check whether the returned error was
  3419. // because http.StatusNotModified was returned.
  3420. func (c *ChangesGetStartPageTokenCall) Do(opts ...googleapi.CallOption) (*StartPageToken, error) {
  3421. gensupport.SetOptions(c.urlParams_, opts...)
  3422. res, err := c.doRequest("json")
  3423. if res != nil && res.StatusCode == http.StatusNotModified {
  3424. if res.Body != nil {
  3425. res.Body.Close()
  3426. }
  3427. return nil, &googleapi.Error{
  3428. Code: res.StatusCode,
  3429. Header: res.Header,
  3430. }
  3431. }
  3432. if err != nil {
  3433. return nil, err
  3434. }
  3435. defer googleapi.CloseBody(res)
  3436. if err := googleapi.CheckResponse(res); err != nil {
  3437. return nil, err
  3438. }
  3439. ret := &StartPageToken{
  3440. ServerResponse: googleapi.ServerResponse{
  3441. Header: res.Header,
  3442. HTTPStatusCode: res.StatusCode,
  3443. },
  3444. }
  3445. target := &ret
  3446. if err := gensupport.DecodeResponse(target, res); err != nil {
  3447. return nil, err
  3448. }
  3449. return ret, nil
  3450. // {
  3451. // "description": "Gets the starting pageToken for listing future changes.",
  3452. // "httpMethod": "GET",
  3453. // "id": "drive.changes.getStartPageToken",
  3454. // "parameters": {
  3455. // "supportsTeamDrives": {
  3456. // "default": "false",
  3457. // "description": "Whether the requesting application supports Team Drives.",
  3458. // "location": "query",
  3459. // "type": "boolean"
  3460. // },
  3461. // "teamDriveId": {
  3462. // "description": "The ID of the Team Drive for which the starting pageToken for listing future changes from that Team Drive will be returned.",
  3463. // "location": "query",
  3464. // "type": "string"
  3465. // }
  3466. // },
  3467. // "path": "changes/startPageToken",
  3468. // "response": {
  3469. // "$ref": "StartPageToken"
  3470. // },
  3471. // "scopes": [
  3472. // "https://www.googleapis.com/auth/drive",
  3473. // "https://www.googleapis.com/auth/drive.appdata",
  3474. // "https://www.googleapis.com/auth/drive.apps.readonly",
  3475. // "https://www.googleapis.com/auth/drive.file",
  3476. // "https://www.googleapis.com/auth/drive.metadata",
  3477. // "https://www.googleapis.com/auth/drive.metadata.readonly",
  3478. // "https://www.googleapis.com/auth/drive.photos.readonly",
  3479. // "https://www.googleapis.com/auth/drive.readonly"
  3480. // ]
  3481. // }
  3482. }
  3483. // method id "drive.changes.list":
  3484. type ChangesListCall struct {
  3485. s *Service
  3486. urlParams_ gensupport.URLParams
  3487. ifNoneMatch_ string
  3488. ctx_ context.Context
  3489. header_ http.Header
  3490. }
  3491. // List: Lists the changes for a user or Team Drive.
  3492. func (r *ChangesService) List() *ChangesListCall {
  3493. c := &ChangesListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3494. return c
  3495. }
  3496. // IncludeCorpusRemovals sets the optional parameter
  3497. // "includeCorpusRemovals": Whether changes should include the file
  3498. // resource if the file is still accessible by the user at the time of
  3499. // the request, even when a file was removed from the list of changes
  3500. // and there will be no further change entries for this file.
  3501. func (c *ChangesListCall) IncludeCorpusRemovals(includeCorpusRemovals bool) *ChangesListCall {
  3502. c.urlParams_.Set("includeCorpusRemovals", fmt.Sprint(includeCorpusRemovals))
  3503. return c
  3504. }
  3505. // IncludeDeleted sets the optional parameter "includeDeleted": Whether
  3506. // to include changes indicating that items have been removed from the
  3507. // list of changes, for example by deletion or loss of access.
  3508. func (c *ChangesListCall) IncludeDeleted(includeDeleted bool) *ChangesListCall {
  3509. c.urlParams_.Set("includeDeleted", fmt.Sprint(includeDeleted))
  3510. return c
  3511. }
  3512. // IncludeSubscribed sets the optional parameter "includeSubscribed":
  3513. // Whether to include changes outside the My Drive hierarchy in the
  3514. // result. When set to false, changes to files such as those in the
  3515. // Application Data folder or shared files which have not been added to
  3516. // My Drive will be omitted from the result.
  3517. func (c *ChangesListCall) IncludeSubscribed(includeSubscribed bool) *ChangesListCall {
  3518. c.urlParams_.Set("includeSubscribed", fmt.Sprint(includeSubscribed))
  3519. return c
  3520. }
  3521. // IncludeTeamDriveItems sets the optional parameter
  3522. // "includeTeamDriveItems": Whether Team Drive files or changes should
  3523. // be included in results.
  3524. func (c *ChangesListCall) IncludeTeamDriveItems(includeTeamDriveItems bool) *ChangesListCall {
  3525. c.urlParams_.Set("includeTeamDriveItems", fmt.Sprint(includeTeamDriveItems))
  3526. return c
  3527. }
  3528. // MaxResults sets the optional parameter "maxResults": Maximum number
  3529. // of changes to return.
  3530. func (c *ChangesListCall) MaxResults(maxResults int64) *ChangesListCall {
  3531. c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
  3532. return c
  3533. }
  3534. // PageToken sets the optional parameter "pageToken": The token for
  3535. // continuing a previous list request on the next page. This should be
  3536. // set to the value of 'nextPageToken' from the previous response or to
  3537. // the response from the getStartPageToken method.
  3538. func (c *ChangesListCall) PageToken(pageToken string) *ChangesListCall {
  3539. c.urlParams_.Set("pageToken", pageToken)
  3540. return c
  3541. }
  3542. // Spaces sets the optional parameter "spaces": A comma-separated list
  3543. // of spaces to query. Supported values are 'drive', 'appDataFolder' and
  3544. // 'photos'.
  3545. func (c *ChangesListCall) Spaces(spaces string) *ChangesListCall {
  3546. c.urlParams_.Set("spaces", spaces)
  3547. return c
  3548. }
  3549. // StartChangeId sets the optional parameter "startChangeId": Deprecated
  3550. // - use pageToken instead.
  3551. func (c *ChangesListCall) StartChangeId(startChangeId int64) *ChangesListCall {
  3552. c.urlParams_.Set("startChangeId", fmt.Sprint(startChangeId))
  3553. return c
  3554. }
  3555. // SupportsTeamDrives sets the optional parameter "supportsTeamDrives":
  3556. // Whether the requesting application supports Team Drives.
  3557. func (c *ChangesListCall) SupportsTeamDrives(supportsTeamDrives bool) *ChangesListCall {
  3558. c.urlParams_.Set("supportsTeamDrives", fmt.Sprint(supportsTeamDrives))
  3559. return c
  3560. }
  3561. // TeamDriveId sets the optional parameter "teamDriveId": The Team Drive
  3562. // from which changes will be returned. If specified the change IDs will
  3563. // be reflective of the Team Drive; use the combined Team Drive ID and
  3564. // change ID as an identifier.
  3565. func (c *ChangesListCall) TeamDriveId(teamDriveId string) *ChangesListCall {
  3566. c.urlParams_.Set("teamDriveId", teamDriveId)
  3567. return c
  3568. }
  3569. // Fields allows partial responses to be retrieved. See
  3570. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3571. // for more information.
  3572. func (c *ChangesListCall) Fields(s ...googleapi.Field) *ChangesListCall {
  3573. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3574. return c
  3575. }
  3576. // IfNoneMatch sets the optional parameter which makes the operation
  3577. // fail if the object's ETag matches the given value. This is useful for
  3578. // getting updates only after the object has changed since the last
  3579. // request. Use googleapi.IsNotModified to check whether the response
  3580. // error from Do is the result of In-None-Match.
  3581. func (c *ChangesListCall) IfNoneMatch(entityTag string) *ChangesListCall {
  3582. c.ifNoneMatch_ = entityTag
  3583. return c
  3584. }
  3585. // Context sets the context to be used in this call's Do method. Any
  3586. // pending HTTP request will be aborted if the provided context is
  3587. // canceled.
  3588. func (c *ChangesListCall) Context(ctx context.Context) *ChangesListCall {
  3589. c.ctx_ = ctx
  3590. return c
  3591. }
  3592. // Header returns an http.Header that can be modified by the caller to
  3593. // add HTTP headers to the request.
  3594. func (c *ChangesListCall) Header() http.Header {
  3595. if c.header_ == nil {
  3596. c.header_ = make(http.Header)
  3597. }
  3598. return c.header_
  3599. }
  3600. func (c *ChangesListCall) doRequest(alt string) (*http.Response, error) {
  3601. reqHeaders := make(http.Header)
  3602. for k, v := range c.header_ {
  3603. reqHeaders[k] = v
  3604. }
  3605. reqHeaders.Set("User-Agent", c.s.userAgent())
  3606. if c.ifNoneMatch_ != "" {
  3607. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  3608. }
  3609. var body io.Reader = nil
  3610. c.urlParams_.Set("alt", alt)
  3611. c.urlParams_.Set("prettyPrint", "false")
  3612. urls := googleapi.ResolveRelative(c.s.BasePath, "changes")
  3613. urls += "?" + c.urlParams_.Encode()
  3614. req, err := http.NewRequest("GET", urls, body)
  3615. if err != nil {
  3616. return nil, err
  3617. }
  3618. req.Header = reqHeaders
  3619. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3620. }
  3621. // Do executes the "drive.changes.list" call.
  3622. // Exactly one of *ChangeList or error will be non-nil. Any non-2xx
  3623. // status code is an error. Response headers are in either
  3624. // *ChangeList.ServerResponse.Header or (if a response was returned at
  3625. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  3626. // to check whether the returned error was because
  3627. // http.StatusNotModified was returned.
  3628. func (c *ChangesListCall) Do(opts ...googleapi.CallOption) (*ChangeList, error) {
  3629. gensupport.SetOptions(c.urlParams_, opts...)
  3630. res, err := c.doRequest("json")
  3631. if res != nil && res.StatusCode == http.StatusNotModified {
  3632. if res.Body != nil {
  3633. res.Body.Close()
  3634. }
  3635. return nil, &googleapi.Error{
  3636. Code: res.StatusCode,
  3637. Header: res.Header,
  3638. }
  3639. }
  3640. if err != nil {
  3641. return nil, err
  3642. }
  3643. defer googleapi.CloseBody(res)
  3644. if err := googleapi.CheckResponse(res); err != nil {
  3645. return nil, err
  3646. }
  3647. ret := &ChangeList{
  3648. ServerResponse: googleapi.ServerResponse{
  3649. Header: res.Header,
  3650. HTTPStatusCode: res.StatusCode,
  3651. },
  3652. }
  3653. target := &ret
  3654. if err := gensupport.DecodeResponse(target, res); err != nil {
  3655. return nil, err
  3656. }
  3657. return ret, nil
  3658. // {
  3659. // "description": "Lists the changes for a user or Team Drive.",
  3660. // "httpMethod": "GET",
  3661. // "id": "drive.changes.list",
  3662. // "parameters": {
  3663. // "includeCorpusRemovals": {
  3664. // "default": "false",
  3665. // "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.",
  3666. // "location": "query",
  3667. // "type": "boolean"
  3668. // },
  3669. // "includeDeleted": {
  3670. // "default": "true",
  3671. // "description": "Whether to include changes indicating that items have been removed from the list of changes, for example by deletion or loss of access.",
  3672. // "location": "query",
  3673. // "type": "boolean"
  3674. // },
  3675. // "includeSubscribed": {
  3676. // "default": "true",
  3677. // "description": "Whether to include changes outside the My Drive hierarchy in the result. When set to false, changes to files such as those in the Application Data folder or shared files which have not been added to My Drive will be omitted from the result.",
  3678. // "location": "query",
  3679. // "type": "boolean"
  3680. // },
  3681. // "includeTeamDriveItems": {
  3682. // "default": "false",
  3683. // "description": "Whether Team Drive files or changes should be included in results.",
  3684. // "location": "query",
  3685. // "type": "boolean"
  3686. // },
  3687. // "maxResults": {
  3688. // "default": "100",
  3689. // "description": "Maximum number of changes to return.",
  3690. // "format": "int32",
  3691. // "location": "query",
  3692. // "minimum": "1",
  3693. // "type": "integer"
  3694. // },
  3695. // "pageToken": {
  3696. // "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.",
  3697. // "location": "query",
  3698. // "type": "string"
  3699. // },
  3700. // "spaces": {
  3701. // "description": "A comma-separated list of spaces to query. Supported values are 'drive', 'appDataFolder' and 'photos'.",
  3702. // "location": "query",
  3703. // "type": "string"
  3704. // },
  3705. // "startChangeId": {
  3706. // "description": "Deprecated - use pageToken instead.",
  3707. // "format": "int64",
  3708. // "location": "query",
  3709. // "type": "string"
  3710. // },
  3711. // "supportsTeamDrives": {
  3712. // "default": "false",
  3713. // "description": "Whether the requesting application supports Team Drives.",
  3714. // "location": "query",
  3715. // "type": "boolean"
  3716. // },
  3717. // "teamDriveId": {
  3718. // "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.",
  3719. // "location": "query",
  3720. // "type": "string"
  3721. // }
  3722. // },
  3723. // "path": "changes",
  3724. // "response": {
  3725. // "$ref": "ChangeList"
  3726. // },
  3727. // "scopes": [
  3728. // "https://www.googleapis.com/auth/drive",
  3729. // "https://www.googleapis.com/auth/drive.appdata",
  3730. // "https://www.googleapis.com/auth/drive.apps.readonly",
  3731. // "https://www.googleapis.com/auth/drive.file",
  3732. // "https://www.googleapis.com/auth/drive.metadata",
  3733. // "https://www.googleapis.com/auth/drive.metadata.readonly",
  3734. // "https://www.googleapis.com/auth/drive.photos.readonly",
  3735. // "https://www.googleapis.com/auth/drive.readonly"
  3736. // ],
  3737. // "supportsSubscription": true
  3738. // }
  3739. }
  3740. // Pages invokes f for each page of results.
  3741. // A non-nil error returned from f will halt the iteration.
  3742. // The provided context supersedes any context provided to the Context method.
  3743. func (c *ChangesListCall) Pages(ctx context.Context, f func(*ChangeList) error) error {
  3744. c.ctx_ = ctx
  3745. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  3746. for {
  3747. x, err := c.Do()
  3748. if err != nil {
  3749. return err
  3750. }
  3751. if err := f(x); err != nil {
  3752. return err
  3753. }
  3754. if x.NextPageToken == "" {
  3755. return nil
  3756. }
  3757. c.PageToken(x.NextPageToken)
  3758. }
  3759. }
  3760. // method id "drive.changes.watch":
  3761. type ChangesWatchCall struct {
  3762. s *Service
  3763. channel *Channel
  3764. urlParams_ gensupport.URLParams
  3765. ctx_ context.Context
  3766. header_ http.Header
  3767. }
  3768. // Watch: Subscribe to changes for a user.
  3769. func (r *ChangesService) Watch(channel *Channel) *ChangesWatchCall {
  3770. c := &ChangesWatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3771. c.channel = channel
  3772. return c
  3773. }
  3774. // IncludeCorpusRemovals sets the optional parameter
  3775. // "includeCorpusRemovals": Whether changes should include the file
  3776. // resource if the file is still accessible by the user at the time of
  3777. // the request, even when a file was removed from the list of changes
  3778. // and there will be no further change entries for this file.
  3779. func (c *ChangesWatchCall) IncludeCorpusRemovals(includeCorpusRemovals bool) *ChangesWatchCall {
  3780. c.urlParams_.Set("includeCorpusRemovals", fmt.Sprint(includeCorpusRemovals))
  3781. return c
  3782. }
  3783. // IncludeDeleted sets the optional parameter "includeDeleted": Whether
  3784. // to include changes indicating that items have been removed from the
  3785. // list of changes, for example by deletion or loss of access.
  3786. func (c *ChangesWatchCall) IncludeDeleted(includeDeleted bool) *ChangesWatchCall {
  3787. c.urlParams_.Set("includeDeleted", fmt.Sprint(includeDeleted))
  3788. return c
  3789. }
  3790. // IncludeSubscribed sets the optional parameter "includeSubscribed":
  3791. // Whether to include changes outside the My Drive hierarchy in the
  3792. // result. When set to false, changes to files such as those in the
  3793. // Application Data folder or shared files which have not been added to
  3794. // My Drive will be omitted from the result.
  3795. func (c *ChangesWatchCall) IncludeSubscribed(includeSubscribed bool) *ChangesWatchCall {
  3796. c.urlParams_.Set("includeSubscribed", fmt.Sprint(includeSubscribed))
  3797. return c
  3798. }
  3799. // IncludeTeamDriveItems sets the optional parameter
  3800. // "includeTeamDriveItems": Whether Team Drive files or changes should
  3801. // be included in results.
  3802. func (c *ChangesWatchCall) IncludeTeamDriveItems(includeTeamDriveItems bool) *ChangesWatchCall {
  3803. c.urlParams_.Set("includeTeamDriveItems", fmt.Sprint(includeTeamDriveItems))
  3804. return c
  3805. }
  3806. // MaxResults sets the optional parameter "maxResults": Maximum number
  3807. // of changes to return.
  3808. func (c *ChangesWatchCall) MaxResults(maxResults int64) *ChangesWatchCall {
  3809. c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
  3810. return c
  3811. }
  3812. // PageToken sets the optional parameter "pageToken": The token for
  3813. // continuing a previous list request on the next page. This should be
  3814. // set to the value of 'nextPageToken' from the previous response or to
  3815. // the response from the getStartPageToken method.
  3816. func (c *ChangesWatchCall) PageToken(pageToken string) *ChangesWatchCall {
  3817. c.urlParams_.Set("pageToken", pageToken)
  3818. return c
  3819. }
  3820. // Spaces sets the optional parameter "spaces": A comma-separated list
  3821. // of spaces to query. Supported values are 'drive', 'appDataFolder' and
  3822. // 'photos'.
  3823. func (c *ChangesWatchCall) Spaces(spaces string) *ChangesWatchCall {
  3824. c.urlParams_.Set("spaces", spaces)
  3825. return c
  3826. }
  3827. // StartChangeId sets the optional parameter "startChangeId": Deprecated
  3828. // - use pageToken instead.
  3829. func (c *ChangesWatchCall) StartChangeId(startChangeId int64) *ChangesWatchCall {
  3830. c.urlParams_.Set("startChangeId", fmt.Sprint(startChangeId))
  3831. return c
  3832. }
  3833. // SupportsTeamDrives sets the optional parameter "supportsTeamDrives":
  3834. // Whether the requesting application supports Team Drives.
  3835. func (c *ChangesWatchCall) SupportsTeamDrives(supportsTeamDrives bool) *ChangesWatchCall {
  3836. c.urlParams_.Set("supportsTeamDrives", fmt.Sprint(supportsTeamDrives))
  3837. return c
  3838. }
  3839. // TeamDriveId sets the optional parameter "teamDriveId": The Team Drive
  3840. // from which changes will be returned. If specified the change IDs will
  3841. // be reflective of the Team Drive; use the combined Team Drive ID and
  3842. // change ID as an identifier.
  3843. func (c *ChangesWatchCall) TeamDriveId(teamDriveId string) *ChangesWatchCall {
  3844. c.urlParams_.Set("teamDriveId", teamDriveId)
  3845. return c
  3846. }
  3847. // Fields allows partial responses to be retrieved. See
  3848. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3849. // for more information.
  3850. func (c *ChangesWatchCall) Fields(s ...googleapi.Field) *ChangesWatchCall {
  3851. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3852. return c
  3853. }
  3854. // Context sets the context to be used in this call's Do method. Any
  3855. // pending HTTP request will be aborted if the provided context is
  3856. // canceled.
  3857. func (c *ChangesWatchCall) Context(ctx context.Context) *ChangesWatchCall {
  3858. c.ctx_ = ctx
  3859. return c
  3860. }
  3861. // Header returns an http.Header that can be modified by the caller to
  3862. // add HTTP headers to the request.
  3863. func (c *ChangesWatchCall) Header() http.Header {
  3864. if c.header_ == nil {
  3865. c.header_ = make(http.Header)
  3866. }
  3867. return c.header_
  3868. }
  3869. func (c *ChangesWatchCall) doRequest(alt string) (*http.Response, error) {
  3870. reqHeaders := make(http.Header)
  3871. for k, v := range c.header_ {
  3872. reqHeaders[k] = v
  3873. }
  3874. reqHeaders.Set("User-Agent", c.s.userAgent())
  3875. var body io.Reader = nil
  3876. body, err := googleapi.WithoutDataWrapper.JSONReader(c.channel)
  3877. if err != nil {
  3878. return nil, err
  3879. }
  3880. reqHeaders.Set("Content-Type", "application/json")
  3881. c.urlParams_.Set("alt", alt)
  3882. c.urlParams_.Set("prettyPrint", "false")
  3883. urls := googleapi.ResolveRelative(c.s.BasePath, "changes/watch")
  3884. urls += "?" + c.urlParams_.Encode()
  3885. req, err := http.NewRequest("POST", urls, body)
  3886. if err != nil {
  3887. return nil, err
  3888. }
  3889. req.Header = reqHeaders
  3890. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3891. }
  3892. // Do executes the "drive.changes.watch" call.
  3893. // Exactly one of *Channel or error will be non-nil. Any non-2xx status
  3894. // code is an error. Response headers are in either
  3895. // *Channel.ServerResponse.Header or (if a response was returned at all)
  3896. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  3897. // check whether the returned error was because http.StatusNotModified
  3898. // was returned.
  3899. func (c *ChangesWatchCall) Do(opts ...googleapi.CallOption) (*Channel, error) {
  3900. gensupport.SetOptions(c.urlParams_, opts...)
  3901. res, err := c.doRequest("json")
  3902. if res != nil && res.StatusCode == http.StatusNotModified {
  3903. if res.Body != nil {
  3904. res.Body.Close()
  3905. }
  3906. return nil, &googleapi.Error{
  3907. Code: res.StatusCode,
  3908. Header: res.Header,
  3909. }
  3910. }
  3911. if err != nil {
  3912. return nil, err
  3913. }
  3914. defer googleapi.CloseBody(res)
  3915. if err := googleapi.CheckResponse(res); err != nil {
  3916. return nil, err
  3917. }
  3918. ret := &Channel{
  3919. ServerResponse: googleapi.ServerResponse{
  3920. Header: res.Header,
  3921. HTTPStatusCode: res.StatusCode,
  3922. },
  3923. }
  3924. target := &ret
  3925. if err := gensupport.DecodeResponse(target, res); err != nil {
  3926. return nil, err
  3927. }
  3928. return ret, nil
  3929. // {
  3930. // "description": "Subscribe to changes for a user.",
  3931. // "httpMethod": "POST",
  3932. // "id": "drive.changes.watch",
  3933. // "parameters": {
  3934. // "includeCorpusRemovals": {
  3935. // "default": "false",
  3936. // "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.",
  3937. // "location": "query",
  3938. // "type": "boolean"
  3939. // },
  3940. // "includeDeleted": {
  3941. // "default": "true",
  3942. // "description": "Whether to include changes indicating that items have been removed from the list of changes, for example by deletion or loss of access.",
  3943. // "location": "query",
  3944. // "type": "boolean"
  3945. // },
  3946. // "includeSubscribed": {
  3947. // "default": "true",
  3948. // "description": "Whether to include changes outside the My Drive hierarchy in the result. When set to false, changes to files such as those in the Application Data folder or shared files which have not been added to My Drive will be omitted from the result.",
  3949. // "location": "query",
  3950. // "type": "boolean"
  3951. // },
  3952. // "includeTeamDriveItems": {
  3953. // "default": "false",
  3954. // "description": "Whether Team Drive files or changes should be included in results.",
  3955. // "location": "query",
  3956. // "type": "boolean"
  3957. // },
  3958. // "maxResults": {
  3959. // "default": "100",
  3960. // "description": "Maximum number of changes to return.",
  3961. // "format": "int32",
  3962. // "location": "query",
  3963. // "minimum": "1",
  3964. // "type": "integer"
  3965. // },
  3966. // "pageToken": {
  3967. // "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.",
  3968. // "location": "query",
  3969. // "type": "string"
  3970. // },
  3971. // "spaces": {
  3972. // "description": "A comma-separated list of spaces to query. Supported values are 'drive', 'appDataFolder' and 'photos'.",
  3973. // "location": "query",
  3974. // "type": "string"
  3975. // },
  3976. // "startChangeId": {
  3977. // "description": "Deprecated - use pageToken instead.",
  3978. // "format": "int64",
  3979. // "location": "query",
  3980. // "type": "string"
  3981. // },
  3982. // "supportsTeamDrives": {
  3983. // "default": "false",
  3984. // "description": "Whether the requesting application supports Team Drives.",
  3985. // "location": "query",
  3986. // "type": "boolean"
  3987. // },
  3988. // "teamDriveId": {
  3989. // "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.",
  3990. // "location": "query",
  3991. // "type": "string"
  3992. // }
  3993. // },
  3994. // "path": "changes/watch",
  3995. // "request": {
  3996. // "$ref": "Channel",
  3997. // "parameterName": "resource"
  3998. // },
  3999. // "response": {
  4000. // "$ref": "Channel"
  4001. // },
  4002. // "scopes": [
  4003. // "https://www.googleapis.com/auth/drive",
  4004. // "https://www.googleapis.com/auth/drive.appdata",
  4005. // "https://www.googleapis.com/auth/drive.apps.readonly",
  4006. // "https://www.googleapis.com/auth/drive.file",
  4007. // "https://www.googleapis.com/auth/drive.metadata",
  4008. // "https://www.googleapis.com/auth/drive.metadata.readonly",
  4009. // "https://www.googleapis.com/auth/drive.photos.readonly",
  4010. // "https://www.googleapis.com/auth/drive.readonly"
  4011. // ],
  4012. // "supportsSubscription": true
  4013. // }
  4014. }
  4015. // method id "drive.channels.stop":
  4016. type ChannelsStopCall struct {
  4017. s *Service
  4018. channel *Channel
  4019. urlParams_ gensupport.URLParams
  4020. ctx_ context.Context
  4021. header_ http.Header
  4022. }
  4023. // Stop: Stop watching resources through this channel
  4024. func (r *ChannelsService) Stop(channel *Channel) *ChannelsStopCall {
  4025. c := &ChannelsStopCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4026. c.channel = channel
  4027. return c
  4028. }
  4029. // Fields allows partial responses to be retrieved. See
  4030. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4031. // for more information.
  4032. func (c *ChannelsStopCall) Fields(s ...googleapi.Field) *ChannelsStopCall {
  4033. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4034. return c
  4035. }
  4036. // Context sets the context to be used in this call's Do method. Any
  4037. // pending HTTP request will be aborted if the provided context is
  4038. // canceled.
  4039. func (c *ChannelsStopCall) Context(ctx context.Context) *ChannelsStopCall {
  4040. c.ctx_ = ctx
  4041. return c
  4042. }
  4043. // Header returns an http.Header that can be modified by the caller to
  4044. // add HTTP headers to the request.
  4045. func (c *ChannelsStopCall) Header() http.Header {
  4046. if c.header_ == nil {
  4047. c.header_ = make(http.Header)
  4048. }
  4049. return c.header_
  4050. }
  4051. func (c *ChannelsStopCall) doRequest(alt string) (*http.Response, error) {
  4052. reqHeaders := make(http.Header)
  4053. for k, v := range c.header_ {
  4054. reqHeaders[k] = v
  4055. }
  4056. reqHeaders.Set("User-Agent", c.s.userAgent())
  4057. var body io.Reader = nil
  4058. body, err := googleapi.WithoutDataWrapper.JSONReader(c.channel)
  4059. if err != nil {
  4060. return nil, err
  4061. }
  4062. reqHeaders.Set("Content-Type", "application/json")
  4063. c.urlParams_.Set("alt", alt)
  4064. c.urlParams_.Set("prettyPrint", "false")
  4065. urls := googleapi.ResolveRelative(c.s.BasePath, "channels/stop")
  4066. urls += "?" + c.urlParams_.Encode()
  4067. req, err := http.NewRequest("POST", urls, body)
  4068. if err != nil {
  4069. return nil, err
  4070. }
  4071. req.Header = reqHeaders
  4072. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4073. }
  4074. // Do executes the "drive.channels.stop" call.
  4075. func (c *ChannelsStopCall) Do(opts ...googleapi.CallOption) error {
  4076. gensupport.SetOptions(c.urlParams_, opts...)
  4077. res, err := c.doRequest("json")
  4078. if err != nil {
  4079. return err
  4080. }
  4081. defer googleapi.CloseBody(res)
  4082. if err := googleapi.CheckResponse(res); err != nil {
  4083. return err
  4084. }
  4085. return nil
  4086. // {
  4087. // "description": "Stop watching resources through this channel",
  4088. // "httpMethod": "POST",
  4089. // "id": "drive.channels.stop",
  4090. // "path": "channels/stop",
  4091. // "request": {
  4092. // "$ref": "Channel",
  4093. // "parameterName": "resource"
  4094. // },
  4095. // "scopes": [
  4096. // "https://www.googleapis.com/auth/drive",
  4097. // "https://www.googleapis.com/auth/drive.appdata",
  4098. // "https://www.googleapis.com/auth/drive.apps.readonly",
  4099. // "https://www.googleapis.com/auth/drive.file",
  4100. // "https://www.googleapis.com/auth/drive.metadata",
  4101. // "https://www.googleapis.com/auth/drive.metadata.readonly",
  4102. // "https://www.googleapis.com/auth/drive.photos.readonly",
  4103. // "https://www.googleapis.com/auth/drive.readonly"
  4104. // ]
  4105. // }
  4106. }
  4107. // method id "drive.children.delete":
  4108. type ChildrenDeleteCall struct {
  4109. s *Service
  4110. folderId string
  4111. childId string
  4112. urlParams_ gensupport.URLParams
  4113. ctx_ context.Context
  4114. header_ http.Header
  4115. }
  4116. // Delete: Removes a child from a folder.
  4117. func (r *ChildrenService) Delete(folderId string, childId string) *ChildrenDeleteCall {
  4118. c := &ChildrenDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4119. c.folderId = folderId
  4120. c.childId = childId
  4121. return c
  4122. }
  4123. // Fields allows partial responses to be retrieved. See
  4124. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4125. // for more information.
  4126. func (c *ChildrenDeleteCall) Fields(s ...googleapi.Field) *ChildrenDeleteCall {
  4127. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4128. return c
  4129. }
  4130. // Context sets the context to be used in this call's Do method. Any
  4131. // pending HTTP request will be aborted if the provided context is
  4132. // canceled.
  4133. func (c *ChildrenDeleteCall) Context(ctx context.Context) *ChildrenDeleteCall {
  4134. c.ctx_ = ctx
  4135. return c
  4136. }
  4137. // Header returns an http.Header that can be modified by the caller to
  4138. // add HTTP headers to the request.
  4139. func (c *ChildrenDeleteCall) Header() http.Header {
  4140. if c.header_ == nil {
  4141. c.header_ = make(http.Header)
  4142. }
  4143. return c.header_
  4144. }
  4145. func (c *ChildrenDeleteCall) doRequest(alt string) (*http.Response, error) {
  4146. reqHeaders := make(http.Header)
  4147. for k, v := range c.header_ {
  4148. reqHeaders[k] = v
  4149. }
  4150. reqHeaders.Set("User-Agent", c.s.userAgent())
  4151. var body io.Reader = nil
  4152. c.urlParams_.Set("alt", alt)
  4153. c.urlParams_.Set("prettyPrint", "false")
  4154. urls := googleapi.ResolveRelative(c.s.BasePath, "files/{folderId}/children/{childId}")
  4155. urls += "?" + c.urlParams_.Encode()
  4156. req, err := http.NewRequest("DELETE", urls, body)
  4157. if err != nil {
  4158. return nil, err
  4159. }
  4160. req.Header = reqHeaders
  4161. googleapi.Expand(req.URL, map[string]string{
  4162. "folderId": c.folderId,
  4163. "childId": c.childId,
  4164. })
  4165. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4166. }
  4167. // Do executes the "drive.children.delete" call.
  4168. func (c *ChildrenDeleteCall) Do(opts ...googleapi.CallOption) error {
  4169. gensupport.SetOptions(c.urlParams_, opts...)
  4170. res, err := c.doRequest("json")
  4171. if err != nil {
  4172. return err
  4173. }
  4174. defer googleapi.CloseBody(res)
  4175. if err := googleapi.CheckResponse(res); err != nil {
  4176. return err
  4177. }
  4178. return nil
  4179. // {
  4180. // "description": "Removes a child from a folder.",
  4181. // "httpMethod": "DELETE",
  4182. // "id": "drive.children.delete",
  4183. // "parameterOrder": [
  4184. // "folderId",
  4185. // "childId"
  4186. // ],
  4187. // "parameters": {
  4188. // "childId": {
  4189. // "description": "The ID of the child.",
  4190. // "location": "path",
  4191. // "required": true,
  4192. // "type": "string"
  4193. // },
  4194. // "folderId": {
  4195. // "description": "The ID of the folder.",
  4196. // "location": "path",
  4197. // "required": true,
  4198. // "type": "string"
  4199. // }
  4200. // },
  4201. // "path": "files/{folderId}/children/{childId}",
  4202. // "scopes": [
  4203. // "https://www.googleapis.com/auth/drive",
  4204. // "https://www.googleapis.com/auth/drive.file"
  4205. // ]
  4206. // }
  4207. }
  4208. // method id "drive.children.get":
  4209. type ChildrenGetCall struct {
  4210. s *Service
  4211. folderId string
  4212. childId string
  4213. urlParams_ gensupport.URLParams
  4214. ifNoneMatch_ string
  4215. ctx_ context.Context
  4216. header_ http.Header
  4217. }
  4218. // Get: Gets a specific child reference.
  4219. func (r *ChildrenService) Get(folderId string, childId string) *ChildrenGetCall {
  4220. c := &ChildrenGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4221. c.folderId = folderId
  4222. c.childId = childId
  4223. return c
  4224. }
  4225. // Fields allows partial responses to be retrieved. See
  4226. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4227. // for more information.
  4228. func (c *ChildrenGetCall) Fields(s ...googleapi.Field) *ChildrenGetCall {
  4229. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4230. return c
  4231. }
  4232. // IfNoneMatch sets the optional parameter which makes the operation
  4233. // fail if the object's ETag matches the given value. This is useful for
  4234. // getting updates only after the object has changed since the last
  4235. // request. Use googleapi.IsNotModified to check whether the response
  4236. // error from Do is the result of In-None-Match.
  4237. func (c *ChildrenGetCall) IfNoneMatch(entityTag string) *ChildrenGetCall {
  4238. c.ifNoneMatch_ = entityTag
  4239. return c
  4240. }
  4241. // Context sets the context to be used in this call's Do method. Any
  4242. // pending HTTP request will be aborted if the provided context is
  4243. // canceled.
  4244. func (c *ChildrenGetCall) Context(ctx context.Context) *ChildrenGetCall {
  4245. c.ctx_ = ctx
  4246. return c
  4247. }
  4248. // Header returns an http.Header that can be modified by the caller to
  4249. // add HTTP headers to the request.
  4250. func (c *ChildrenGetCall) Header() http.Header {
  4251. if c.header_ == nil {
  4252. c.header_ = make(http.Header)
  4253. }
  4254. return c.header_
  4255. }
  4256. func (c *ChildrenGetCall) doRequest(alt string) (*http.Response, error) {
  4257. reqHeaders := make(http.Header)
  4258. for k, v := range c.header_ {
  4259. reqHeaders[k] = v
  4260. }
  4261. reqHeaders.Set("User-Agent", c.s.userAgent())
  4262. if c.ifNoneMatch_ != "" {
  4263. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  4264. }
  4265. var body io.Reader = nil
  4266. c.urlParams_.Set("alt", alt)
  4267. c.urlParams_.Set("prettyPrint", "false")
  4268. urls := googleapi.ResolveRelative(c.s.BasePath, "files/{folderId}/children/{childId}")
  4269. urls += "?" + c.urlParams_.Encode()
  4270. req, err := http.NewRequest("GET", urls, body)
  4271. if err != nil {
  4272. return nil, err
  4273. }
  4274. req.Header = reqHeaders
  4275. googleapi.Expand(req.URL, map[string]string{
  4276. "folderId": c.folderId,
  4277. "childId": c.childId,
  4278. })
  4279. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4280. }
  4281. // Do executes the "drive.children.get" call.
  4282. // Exactly one of *ChildReference or error will be non-nil. Any non-2xx
  4283. // status code is an error. Response headers are in either
  4284. // *ChildReference.ServerResponse.Header or (if a response was returned
  4285. // at all) in error.(*googleapi.Error).Header. Use
  4286. // googleapi.IsNotModified to check whether the returned error was
  4287. // because http.StatusNotModified was returned.
  4288. func (c *ChildrenGetCall) Do(opts ...googleapi.CallOption) (*ChildReference, error) {
  4289. gensupport.SetOptions(c.urlParams_, opts...)
  4290. res, err := c.doRequest("json")
  4291. if res != nil && res.StatusCode == http.StatusNotModified {
  4292. if res.Body != nil {
  4293. res.Body.Close()
  4294. }
  4295. return nil, &googleapi.Error{
  4296. Code: res.StatusCode,
  4297. Header: res.Header,
  4298. }
  4299. }
  4300. if err != nil {
  4301. return nil, err
  4302. }
  4303. defer googleapi.CloseBody(res)
  4304. if err := googleapi.CheckResponse(res); err != nil {
  4305. return nil, err
  4306. }
  4307. ret := &ChildReference{
  4308. ServerResponse: googleapi.ServerResponse{
  4309. Header: res.Header,
  4310. HTTPStatusCode: res.StatusCode,
  4311. },
  4312. }
  4313. target := &ret
  4314. if err := gensupport.DecodeResponse(target, res); err != nil {
  4315. return nil, err
  4316. }
  4317. return ret, nil
  4318. // {
  4319. // "description": "Gets a specific child reference.",
  4320. // "httpMethod": "GET",
  4321. // "id": "drive.children.get",
  4322. // "parameterOrder": [
  4323. // "folderId",
  4324. // "childId"
  4325. // ],
  4326. // "parameters": {
  4327. // "childId": {
  4328. // "description": "The ID of the child.",
  4329. // "location": "path",
  4330. // "required": true,
  4331. // "type": "string"
  4332. // },
  4333. // "folderId": {
  4334. // "description": "The ID of the folder.",
  4335. // "location": "path",
  4336. // "required": true,
  4337. // "type": "string"
  4338. // }
  4339. // },
  4340. // "path": "files/{folderId}/children/{childId}",
  4341. // "response": {
  4342. // "$ref": "ChildReference"
  4343. // },
  4344. // "scopes": [
  4345. // "https://www.googleapis.com/auth/drive",
  4346. // "https://www.googleapis.com/auth/drive.appdata",
  4347. // "https://www.googleapis.com/auth/drive.file",
  4348. // "https://www.googleapis.com/auth/drive.metadata",
  4349. // "https://www.googleapis.com/auth/drive.metadata.readonly",
  4350. // "https://www.googleapis.com/auth/drive.photos.readonly",
  4351. // "https://www.googleapis.com/auth/drive.readonly"
  4352. // ]
  4353. // }
  4354. }
  4355. // method id "drive.children.insert":
  4356. type ChildrenInsertCall struct {
  4357. s *Service
  4358. folderId string
  4359. childreference *ChildReference
  4360. urlParams_ gensupport.URLParams
  4361. ctx_ context.Context
  4362. header_ http.Header
  4363. }
  4364. // Insert: Inserts a file into a folder.
  4365. func (r *ChildrenService) Insert(folderId string, childreference *ChildReference) *ChildrenInsertCall {
  4366. c := &ChildrenInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4367. c.folderId = folderId
  4368. c.childreference = childreference
  4369. return c
  4370. }
  4371. // SupportsTeamDrives sets the optional parameter "supportsTeamDrives":
  4372. // Whether the requesting application supports Team Drives.
  4373. func (c *ChildrenInsertCall) SupportsTeamDrives(supportsTeamDrives bool) *ChildrenInsertCall {
  4374. c.urlParams_.Set("supportsTeamDrives", fmt.Sprint(supportsTeamDrives))
  4375. return c
  4376. }
  4377. // Fields allows partial responses to be retrieved. See
  4378. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4379. // for more information.
  4380. func (c *ChildrenInsertCall) Fields(s ...googleapi.Field) *ChildrenInsertCall {
  4381. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4382. return c
  4383. }
  4384. // Context sets the context to be used in this call's Do method. Any
  4385. // pending HTTP request will be aborted if the provided context is
  4386. // canceled.
  4387. func (c *ChildrenInsertCall) Context(ctx context.Context) *ChildrenInsertCall {
  4388. c.ctx_ = ctx
  4389. return c
  4390. }
  4391. // Header returns an http.Header that can be modified by the caller to
  4392. // add HTTP headers to the request.
  4393. func (c *ChildrenInsertCall) Header() http.Header {
  4394. if c.header_ == nil {
  4395. c.header_ = make(http.Header)
  4396. }
  4397. return c.header_
  4398. }
  4399. func (c *ChildrenInsertCall) doRequest(alt string) (*http.Response, error) {
  4400. reqHeaders := make(http.Header)
  4401. for k, v := range c.header_ {
  4402. reqHeaders[k] = v
  4403. }
  4404. reqHeaders.Set("User-Agent", c.s.userAgent())
  4405. var body io.Reader = nil
  4406. body, err := googleapi.WithoutDataWrapper.JSONReader(c.childreference)
  4407. if err != nil {
  4408. return nil, err
  4409. }
  4410. reqHeaders.Set("Content-Type", "application/json")
  4411. c.urlParams_.Set("alt", alt)
  4412. c.urlParams_.Set("prettyPrint", "false")
  4413. urls := googleapi.ResolveRelative(c.s.BasePath, "files/{folderId}/children")
  4414. urls += "?" + c.urlParams_.Encode()
  4415. req, err := http.NewRequest("POST", urls, body)
  4416. if err != nil {
  4417. return nil, err
  4418. }
  4419. req.Header = reqHeaders
  4420. googleapi.Expand(req.URL, map[string]string{
  4421. "folderId": c.folderId,
  4422. })
  4423. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4424. }
  4425. // Do executes the "drive.children.insert" call.
  4426. // Exactly one of *ChildReference or error will be non-nil. Any non-2xx
  4427. // status code is an error. Response headers are in either
  4428. // *ChildReference.ServerResponse.Header or (if a response was returned
  4429. // at all) in error.(*googleapi.Error).Header. Use
  4430. // googleapi.IsNotModified to check whether the returned error was
  4431. // because http.StatusNotModified was returned.
  4432. func (c *ChildrenInsertCall) Do(opts ...googleapi.CallOption) (*ChildReference, error) {
  4433. gensupport.SetOptions(c.urlParams_, opts...)
  4434. res, err := c.doRequest("json")
  4435. if res != nil && res.StatusCode == http.StatusNotModified {
  4436. if res.Body != nil {
  4437. res.Body.Close()
  4438. }
  4439. return nil, &googleapi.Error{
  4440. Code: res.StatusCode,
  4441. Header: res.Header,
  4442. }
  4443. }
  4444. if err != nil {
  4445. return nil, err
  4446. }
  4447. defer googleapi.CloseBody(res)
  4448. if err := googleapi.CheckResponse(res); err != nil {
  4449. return nil, err
  4450. }
  4451. ret := &ChildReference{
  4452. ServerResponse: googleapi.ServerResponse{
  4453. Header: res.Header,
  4454. HTTPStatusCode: res.StatusCode,
  4455. },
  4456. }
  4457. target := &ret
  4458. if err := gensupport.DecodeResponse(target, res); err != nil {
  4459. return nil, err
  4460. }
  4461. return ret, nil
  4462. // {
  4463. // "description": "Inserts a file into a folder.",
  4464. // "httpMethod": "POST",
  4465. // "id": "drive.children.insert",
  4466. // "parameterOrder": [
  4467. // "folderId"
  4468. // ],
  4469. // "parameters": {
  4470. // "folderId": {
  4471. // "description": "The ID of the folder.",
  4472. // "location": "path",
  4473. // "required": true,
  4474. // "type": "string"
  4475. // },
  4476. // "supportsTeamDrives": {
  4477. // "default": "false",
  4478. // "description": "Whether the requesting application supports Team Drives.",
  4479. // "location": "query",
  4480. // "type": "boolean"
  4481. // }
  4482. // },
  4483. // "path": "files/{folderId}/children",
  4484. // "request": {
  4485. // "$ref": "ChildReference"
  4486. // },
  4487. // "response": {
  4488. // "$ref": "ChildReference"
  4489. // },
  4490. // "scopes": [
  4491. // "https://www.googleapis.com/auth/drive",
  4492. // "https://www.googleapis.com/auth/drive.appdata",
  4493. // "https://www.googleapis.com/auth/drive.file"
  4494. // ]
  4495. // }
  4496. }
  4497. // method id "drive.children.list":
  4498. type ChildrenListCall struct {
  4499. s *Service
  4500. folderId string
  4501. urlParams_ gensupport.URLParams
  4502. ifNoneMatch_ string
  4503. ctx_ context.Context
  4504. header_ http.Header
  4505. }
  4506. // List: Lists a folder's children.
  4507. func (r *ChildrenService) List(folderId string) *ChildrenListCall {
  4508. c := &ChildrenListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4509. c.folderId = folderId
  4510. return c
  4511. }
  4512. // MaxResults sets the optional parameter "maxResults": Maximum number
  4513. // of children to return.
  4514. func (c *ChildrenListCall) MaxResults(maxResults int64) *ChildrenListCall {
  4515. c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
  4516. return c
  4517. }
  4518. // OrderBy sets the optional parameter "orderBy": A comma-separated list
  4519. // of sort keys. Valid keys are 'createdDate', 'folder',
  4520. // 'lastViewedByMeDate', 'modifiedByMeDate', 'modifiedDate',
  4521. // 'quotaBytesUsed', 'recency', 'sharedWithMeDate', 'starred', and
  4522. // 'title'. Each key sorts ascending by default, but may be reversed
  4523. // with the 'desc' modifier. Example usage: ?orderBy=folder,modifiedDate
  4524. // desc,title. Please note that there is a current limitation for users
  4525. // with approximately one million files in which the requested sort
  4526. // order is ignored.
  4527. func (c *ChildrenListCall) OrderBy(orderBy string) *ChildrenListCall {
  4528. c.urlParams_.Set("orderBy", orderBy)
  4529. return c
  4530. }
  4531. // PageToken sets the optional parameter "pageToken": Page token for
  4532. // children.
  4533. func (c *ChildrenListCall) PageToken(pageToken string) *ChildrenListCall {
  4534. c.urlParams_.Set("pageToken", pageToken)
  4535. return c
  4536. }
  4537. // Q sets the optional parameter "q": Query string for searching
  4538. // children.
  4539. func (c *ChildrenListCall) Q(q string) *ChildrenListCall {
  4540. c.urlParams_.Set("q", q)
  4541. return c
  4542. }
  4543. // Fields allows partial responses to be retrieved. See
  4544. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4545. // for more information.
  4546. func (c *ChildrenListCall) Fields(s ...googleapi.Field) *ChildrenListCall {
  4547. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4548. return c
  4549. }
  4550. // IfNoneMatch sets the optional parameter which makes the operation
  4551. // fail if the object's ETag matches the given value. This is useful for
  4552. // getting updates only after the object has changed since the last
  4553. // request. Use googleapi.IsNotModified to check whether the response
  4554. // error from Do is the result of In-None-Match.
  4555. func (c *ChildrenListCall) IfNoneMatch(entityTag string) *ChildrenListCall {
  4556. c.ifNoneMatch_ = entityTag
  4557. return c
  4558. }
  4559. // Context sets the context to be used in this call's Do method. Any
  4560. // pending HTTP request will be aborted if the provided context is
  4561. // canceled.
  4562. func (c *ChildrenListCall) Context(ctx context.Context) *ChildrenListCall {
  4563. c.ctx_ = ctx
  4564. return c
  4565. }
  4566. // Header returns an http.Header that can be modified by the caller to
  4567. // add HTTP headers to the request.
  4568. func (c *ChildrenListCall) Header() http.Header {
  4569. if c.header_ == nil {
  4570. c.header_ = make(http.Header)
  4571. }
  4572. return c.header_
  4573. }
  4574. func (c *ChildrenListCall) doRequest(alt string) (*http.Response, error) {
  4575. reqHeaders := make(http.Header)
  4576. for k, v := range c.header_ {
  4577. reqHeaders[k] = v
  4578. }
  4579. reqHeaders.Set("User-Agent", c.s.userAgent())
  4580. if c.ifNoneMatch_ != "" {
  4581. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  4582. }
  4583. var body io.Reader = nil
  4584. c.urlParams_.Set("alt", alt)
  4585. c.urlParams_.Set("prettyPrint", "false")
  4586. urls := googleapi.ResolveRelative(c.s.BasePath, "files/{folderId}/children")
  4587. urls += "?" + c.urlParams_.Encode()
  4588. req, err := http.NewRequest("GET", urls, body)
  4589. if err != nil {
  4590. return nil, err
  4591. }
  4592. req.Header = reqHeaders
  4593. googleapi.Expand(req.URL, map[string]string{
  4594. "folderId": c.folderId,
  4595. })
  4596. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4597. }
  4598. // Do executes the "drive.children.list" call.
  4599. // Exactly one of *ChildList or error will be non-nil. Any non-2xx
  4600. // status code is an error. Response headers are in either
  4601. // *ChildList.ServerResponse.Header or (if a response was returned at
  4602. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  4603. // to check whether the returned error was because
  4604. // http.StatusNotModified was returned.
  4605. func (c *ChildrenListCall) Do(opts ...googleapi.CallOption) (*ChildList, error) {
  4606. gensupport.SetOptions(c.urlParams_, opts...)
  4607. res, err := c.doRequest("json")
  4608. if res != nil && res.StatusCode == http.StatusNotModified {
  4609. if res.Body != nil {
  4610. res.Body.Close()
  4611. }
  4612. return nil, &googleapi.Error{
  4613. Code: res.StatusCode,
  4614. Header: res.Header,
  4615. }
  4616. }
  4617. if err != nil {
  4618. return nil, err
  4619. }
  4620. defer googleapi.CloseBody(res)
  4621. if err := googleapi.CheckResponse(res); err != nil {
  4622. return nil, err
  4623. }
  4624. ret := &ChildList{
  4625. ServerResponse: googleapi.ServerResponse{
  4626. Header: res.Header,
  4627. HTTPStatusCode: res.StatusCode,
  4628. },
  4629. }
  4630. target := &ret
  4631. if err := gensupport.DecodeResponse(target, res); err != nil {
  4632. return nil, err
  4633. }
  4634. return ret, nil
  4635. // {
  4636. // "description": "Lists a folder's children.",
  4637. // "httpMethod": "GET",
  4638. // "id": "drive.children.list",
  4639. // "parameterOrder": [
  4640. // "folderId"
  4641. // ],
  4642. // "parameters": {
  4643. // "folderId": {
  4644. // "description": "The ID of the folder.",
  4645. // "location": "path",
  4646. // "required": true,
  4647. // "type": "string"
  4648. // },
  4649. // "maxResults": {
  4650. // "default": "100",
  4651. // "description": "Maximum number of children to return.",
  4652. // "format": "int32",
  4653. // "location": "query",
  4654. // "minimum": "0",
  4655. // "type": "integer"
  4656. // },
  4657. // "orderBy": {
  4658. // "description": "A comma-separated list of sort keys. Valid keys are 'createdDate', 'folder', 'lastViewedByMeDate', 'modifiedByMeDate', 'modifiedDate', 'quotaBytesUsed', 'recency', 'sharedWithMeDate', 'starred', and 'title'. Each key sorts ascending by default, but may be reversed with the 'desc' modifier. Example usage: ?orderBy=folder,modifiedDate desc,title. Please note that there is a current limitation for users with approximately one million files in which the requested sort order is ignored.",
  4659. // "location": "query",
  4660. // "type": "string"
  4661. // },
  4662. // "pageToken": {
  4663. // "description": "Page token for children.",
  4664. // "location": "query",
  4665. // "type": "string"
  4666. // },
  4667. // "q": {
  4668. // "description": "Query string for searching children.",
  4669. // "location": "query",
  4670. // "type": "string"
  4671. // }
  4672. // },
  4673. // "path": "files/{folderId}/children",
  4674. // "response": {
  4675. // "$ref": "ChildList"
  4676. // },
  4677. // "scopes": [
  4678. // "https://www.googleapis.com/auth/drive",
  4679. // "https://www.googleapis.com/auth/drive.appdata",
  4680. // "https://www.googleapis.com/auth/drive.file",
  4681. // "https://www.googleapis.com/auth/drive.metadata",
  4682. // "https://www.googleapis.com/auth/drive.metadata.readonly",
  4683. // "https://www.googleapis.com/auth/drive.photos.readonly",
  4684. // "https://www.googleapis.com/auth/drive.readonly"
  4685. // ]
  4686. // }
  4687. }
  4688. // Pages invokes f for each page of results.
  4689. // A non-nil error returned from f will halt the iteration.
  4690. // The provided context supersedes any context provided to the Context method.
  4691. func (c *ChildrenListCall) Pages(ctx context.Context, f func(*ChildList) error) error {
  4692. c.ctx_ = ctx
  4693. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  4694. for {
  4695. x, err := c.Do()
  4696. if err != nil {
  4697. return err
  4698. }
  4699. if err := f(x); err != nil {
  4700. return err
  4701. }
  4702. if x.NextPageToken == "" {
  4703. return nil
  4704. }
  4705. c.PageToken(x.NextPageToken)
  4706. }
  4707. }
  4708. // method id "drive.comments.delete":
  4709. type CommentsDeleteCall struct {
  4710. s *Service
  4711. fileId string
  4712. commentId string
  4713. urlParams_ gensupport.URLParams
  4714. ctx_ context.Context
  4715. header_ http.Header
  4716. }
  4717. // Delete: Deletes a comment.
  4718. func (r *CommentsService) Delete(fileId string, commentId string) *CommentsDeleteCall {
  4719. c := &CommentsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4720. c.fileId = fileId
  4721. c.commentId = commentId
  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 *CommentsDeleteCall) Fields(s ...googleapi.Field) *CommentsDeleteCall {
  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. func (c *CommentsDeleteCall) Context(ctx context.Context) *CommentsDeleteCall {
  4735. c.ctx_ = ctx
  4736. return c
  4737. }
  4738. // Header returns an http.Header that can be modified by the caller to
  4739. // add HTTP headers to the request.
  4740. func (c *CommentsDeleteCall) Header() http.Header {
  4741. if c.header_ == nil {
  4742. c.header_ = make(http.Header)
  4743. }
  4744. return c.header_
  4745. }
  4746. func (c *CommentsDeleteCall) doRequest(alt string) (*http.Response, error) {
  4747. reqHeaders := make(http.Header)
  4748. for k, v := range c.header_ {
  4749. reqHeaders[k] = v
  4750. }
  4751. reqHeaders.Set("User-Agent", c.s.userAgent())
  4752. var body io.Reader = nil
  4753. c.urlParams_.Set("alt", alt)
  4754. c.urlParams_.Set("prettyPrint", "false")
  4755. urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/comments/{commentId}")
  4756. urls += "?" + c.urlParams_.Encode()
  4757. req, err := http.NewRequest("DELETE", urls, body)
  4758. if err != nil {
  4759. return nil, err
  4760. }
  4761. req.Header = reqHeaders
  4762. googleapi.Expand(req.URL, map[string]string{
  4763. "fileId": c.fileId,
  4764. "commentId": c.commentId,
  4765. })
  4766. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4767. }
  4768. // Do executes the "drive.comments.delete" call.
  4769. func (c *CommentsDeleteCall) Do(opts ...googleapi.CallOption) error {
  4770. gensupport.SetOptions(c.urlParams_, opts...)
  4771. res, err := c.doRequest("json")
  4772. if err != nil {
  4773. return err
  4774. }
  4775. defer googleapi.CloseBody(res)
  4776. if err := googleapi.CheckResponse(res); err != nil {
  4777. return err
  4778. }
  4779. return nil
  4780. // {
  4781. // "description": "Deletes a comment.",
  4782. // "httpMethod": "DELETE",
  4783. // "id": "drive.comments.delete",
  4784. // "parameterOrder": [
  4785. // "fileId",
  4786. // "commentId"
  4787. // ],
  4788. // "parameters": {
  4789. // "commentId": {
  4790. // "description": "The ID of the comment.",
  4791. // "location": "path",
  4792. // "required": true,
  4793. // "type": "string"
  4794. // },
  4795. // "fileId": {
  4796. // "description": "The ID of the file.",
  4797. // "location": "path",
  4798. // "required": true,
  4799. // "type": "string"
  4800. // }
  4801. // },
  4802. // "path": "files/{fileId}/comments/{commentId}",
  4803. // "scopes": [
  4804. // "https://www.googleapis.com/auth/drive",
  4805. // "https://www.googleapis.com/auth/drive.file"
  4806. // ]
  4807. // }
  4808. }
  4809. // method id "drive.comments.get":
  4810. type CommentsGetCall struct {
  4811. s *Service
  4812. fileId string
  4813. commentId string
  4814. urlParams_ gensupport.URLParams
  4815. ifNoneMatch_ string
  4816. ctx_ context.Context
  4817. header_ http.Header
  4818. }
  4819. // Get: Gets a comment by ID.
  4820. func (r *CommentsService) Get(fileId string, commentId string) *CommentsGetCall {
  4821. c := &CommentsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4822. c.fileId = fileId
  4823. c.commentId = commentId
  4824. return c
  4825. }
  4826. // IncludeDeleted sets the optional parameter "includeDeleted": If set,
  4827. // this will succeed when retrieving a deleted comment, and will include
  4828. // any deleted replies.
  4829. func (c *CommentsGetCall) IncludeDeleted(includeDeleted bool) *CommentsGetCall {
  4830. c.urlParams_.Set("includeDeleted", fmt.Sprint(includeDeleted))
  4831. return c
  4832. }
  4833. // Fields allows partial responses to be retrieved. See
  4834. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4835. // for more information.
  4836. func (c *CommentsGetCall) Fields(s ...googleapi.Field) *CommentsGetCall {
  4837. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4838. return c
  4839. }
  4840. // IfNoneMatch sets the optional parameter which makes the operation
  4841. // fail if the object's ETag matches the given value. This is useful for
  4842. // getting updates only after the object has changed since the last
  4843. // request. Use googleapi.IsNotModified to check whether the response
  4844. // error from Do is the result of In-None-Match.
  4845. func (c *CommentsGetCall) IfNoneMatch(entityTag string) *CommentsGetCall {
  4846. c.ifNoneMatch_ = entityTag
  4847. return c
  4848. }
  4849. // Context sets the context to be used in this call's Do method. Any
  4850. // pending HTTP request will be aborted if the provided context is
  4851. // canceled.
  4852. func (c *CommentsGetCall) Context(ctx context.Context) *CommentsGetCall {
  4853. c.ctx_ = ctx
  4854. return c
  4855. }
  4856. // Header returns an http.Header that can be modified by the caller to
  4857. // add HTTP headers to the request.
  4858. func (c *CommentsGetCall) Header() http.Header {
  4859. if c.header_ == nil {
  4860. c.header_ = make(http.Header)
  4861. }
  4862. return c.header_
  4863. }
  4864. func (c *CommentsGetCall) doRequest(alt string) (*http.Response, error) {
  4865. reqHeaders := make(http.Header)
  4866. for k, v := range c.header_ {
  4867. reqHeaders[k] = v
  4868. }
  4869. reqHeaders.Set("User-Agent", c.s.userAgent())
  4870. if c.ifNoneMatch_ != "" {
  4871. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  4872. }
  4873. var body io.Reader = nil
  4874. c.urlParams_.Set("alt", alt)
  4875. c.urlParams_.Set("prettyPrint", "false")
  4876. urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/comments/{commentId}")
  4877. urls += "?" + c.urlParams_.Encode()
  4878. req, err := http.NewRequest("GET", urls, body)
  4879. if err != nil {
  4880. return nil, err
  4881. }
  4882. req.Header = reqHeaders
  4883. googleapi.Expand(req.URL, map[string]string{
  4884. "fileId": c.fileId,
  4885. "commentId": c.commentId,
  4886. })
  4887. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4888. }
  4889. // Do executes the "drive.comments.get" call.
  4890. // Exactly one of *Comment or error will be non-nil. Any non-2xx status
  4891. // code is an error. Response headers are in either
  4892. // *Comment.ServerResponse.Header or (if a response was returned at all)
  4893. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  4894. // check whether the returned error was because http.StatusNotModified
  4895. // was returned.
  4896. func (c *CommentsGetCall) Do(opts ...googleapi.CallOption) (*Comment, error) {
  4897. gensupport.SetOptions(c.urlParams_, opts...)
  4898. res, err := c.doRequest("json")
  4899. if res != nil && res.StatusCode == http.StatusNotModified {
  4900. if res.Body != nil {
  4901. res.Body.Close()
  4902. }
  4903. return nil, &googleapi.Error{
  4904. Code: res.StatusCode,
  4905. Header: res.Header,
  4906. }
  4907. }
  4908. if err != nil {
  4909. return nil, err
  4910. }
  4911. defer googleapi.CloseBody(res)
  4912. if err := googleapi.CheckResponse(res); err != nil {
  4913. return nil, err
  4914. }
  4915. ret := &Comment{
  4916. ServerResponse: googleapi.ServerResponse{
  4917. Header: res.Header,
  4918. HTTPStatusCode: res.StatusCode,
  4919. },
  4920. }
  4921. target := &ret
  4922. if err := gensupport.DecodeResponse(target, res); err != nil {
  4923. return nil, err
  4924. }
  4925. return ret, nil
  4926. // {
  4927. // "description": "Gets a comment by ID.",
  4928. // "httpMethod": "GET",
  4929. // "id": "drive.comments.get",
  4930. // "parameterOrder": [
  4931. // "fileId",
  4932. // "commentId"
  4933. // ],
  4934. // "parameters": {
  4935. // "commentId": {
  4936. // "description": "The ID of the comment.",
  4937. // "location": "path",
  4938. // "required": true,
  4939. // "type": "string"
  4940. // },
  4941. // "fileId": {
  4942. // "description": "The ID of the file.",
  4943. // "location": "path",
  4944. // "required": true,
  4945. // "type": "string"
  4946. // },
  4947. // "includeDeleted": {
  4948. // "default": "false",
  4949. // "description": "If set, this will succeed when retrieving a deleted comment, and will include any deleted replies.",
  4950. // "location": "query",
  4951. // "type": "boolean"
  4952. // }
  4953. // },
  4954. // "path": "files/{fileId}/comments/{commentId}",
  4955. // "response": {
  4956. // "$ref": "Comment"
  4957. // },
  4958. // "scopes": [
  4959. // "https://www.googleapis.com/auth/drive",
  4960. // "https://www.googleapis.com/auth/drive.file",
  4961. // "https://www.googleapis.com/auth/drive.readonly"
  4962. // ]
  4963. // }
  4964. }
  4965. // method id "drive.comments.insert":
  4966. type CommentsInsertCall struct {
  4967. s *Service
  4968. fileId string
  4969. comment *Comment
  4970. urlParams_ gensupport.URLParams
  4971. ctx_ context.Context
  4972. header_ http.Header
  4973. }
  4974. // Insert: Creates a new comment on the given file.
  4975. func (r *CommentsService) Insert(fileId string, comment *Comment) *CommentsInsertCall {
  4976. c := &CommentsInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4977. c.fileId = fileId
  4978. c.comment = comment
  4979. return c
  4980. }
  4981. // Fields allows partial responses to be retrieved. See
  4982. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4983. // for more information.
  4984. func (c *CommentsInsertCall) Fields(s ...googleapi.Field) *CommentsInsertCall {
  4985. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4986. return c
  4987. }
  4988. // Context sets the context to be used in this call's Do method. Any
  4989. // pending HTTP request will be aborted if the provided context is
  4990. // canceled.
  4991. func (c *CommentsInsertCall) Context(ctx context.Context) *CommentsInsertCall {
  4992. c.ctx_ = ctx
  4993. return c
  4994. }
  4995. // Header returns an http.Header that can be modified by the caller to
  4996. // add HTTP headers to the request.
  4997. func (c *CommentsInsertCall) Header() http.Header {
  4998. if c.header_ == nil {
  4999. c.header_ = make(http.Header)
  5000. }
  5001. return c.header_
  5002. }
  5003. func (c *CommentsInsertCall) doRequest(alt string) (*http.Response, error) {
  5004. reqHeaders := make(http.Header)
  5005. for k, v := range c.header_ {
  5006. reqHeaders[k] = v
  5007. }
  5008. reqHeaders.Set("User-Agent", c.s.userAgent())
  5009. var body io.Reader = nil
  5010. body, err := googleapi.WithoutDataWrapper.JSONReader(c.comment)
  5011. if err != nil {
  5012. return nil, err
  5013. }
  5014. reqHeaders.Set("Content-Type", "application/json")
  5015. c.urlParams_.Set("alt", alt)
  5016. c.urlParams_.Set("prettyPrint", "false")
  5017. urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/comments")
  5018. urls += "?" + c.urlParams_.Encode()
  5019. req, err := http.NewRequest("POST", urls, body)
  5020. if err != nil {
  5021. return nil, err
  5022. }
  5023. req.Header = reqHeaders
  5024. googleapi.Expand(req.URL, map[string]string{
  5025. "fileId": c.fileId,
  5026. })
  5027. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  5028. }
  5029. // Do executes the "drive.comments.insert" call.
  5030. // Exactly one of *Comment or error will be non-nil. Any non-2xx status
  5031. // code is an error. Response headers are in either
  5032. // *Comment.ServerResponse.Header or (if a response was returned at all)
  5033. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  5034. // check whether the returned error was because http.StatusNotModified
  5035. // was returned.
  5036. func (c *CommentsInsertCall) Do(opts ...googleapi.CallOption) (*Comment, error) {
  5037. gensupport.SetOptions(c.urlParams_, opts...)
  5038. res, err := c.doRequest("json")
  5039. if res != nil && res.StatusCode == http.StatusNotModified {
  5040. if res.Body != nil {
  5041. res.Body.Close()
  5042. }
  5043. return nil, &googleapi.Error{
  5044. Code: res.StatusCode,
  5045. Header: res.Header,
  5046. }
  5047. }
  5048. if err != nil {
  5049. return nil, err
  5050. }
  5051. defer googleapi.CloseBody(res)
  5052. if err := googleapi.CheckResponse(res); err != nil {
  5053. return nil, err
  5054. }
  5055. ret := &Comment{
  5056. ServerResponse: googleapi.ServerResponse{
  5057. Header: res.Header,
  5058. HTTPStatusCode: res.StatusCode,
  5059. },
  5060. }
  5061. target := &ret
  5062. if err := gensupport.DecodeResponse(target, res); err != nil {
  5063. return nil, err
  5064. }
  5065. return ret, nil
  5066. // {
  5067. // "description": "Creates a new comment on the given file.",
  5068. // "httpMethod": "POST",
  5069. // "id": "drive.comments.insert",
  5070. // "parameterOrder": [
  5071. // "fileId"
  5072. // ],
  5073. // "parameters": {
  5074. // "fileId": {
  5075. // "description": "The ID of the file.",
  5076. // "location": "path",
  5077. // "required": true,
  5078. // "type": "string"
  5079. // }
  5080. // },
  5081. // "path": "files/{fileId}/comments",
  5082. // "request": {
  5083. // "$ref": "Comment"
  5084. // },
  5085. // "response": {
  5086. // "$ref": "Comment"
  5087. // },
  5088. // "scopes": [
  5089. // "https://www.googleapis.com/auth/drive",
  5090. // "https://www.googleapis.com/auth/drive.file"
  5091. // ]
  5092. // }
  5093. }
  5094. // method id "drive.comments.list":
  5095. type CommentsListCall struct {
  5096. s *Service
  5097. fileId string
  5098. urlParams_ gensupport.URLParams
  5099. ifNoneMatch_ string
  5100. ctx_ context.Context
  5101. header_ http.Header
  5102. }
  5103. // List: Lists a file's comments.
  5104. func (r *CommentsService) List(fileId string) *CommentsListCall {
  5105. c := &CommentsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5106. c.fileId = fileId
  5107. return c
  5108. }
  5109. // IncludeDeleted sets the optional parameter "includeDeleted": If set,
  5110. // all comments and replies, including deleted comments and replies
  5111. // (with content stripped) will be returned.
  5112. func (c *CommentsListCall) IncludeDeleted(includeDeleted bool) *CommentsListCall {
  5113. c.urlParams_.Set("includeDeleted", fmt.Sprint(includeDeleted))
  5114. return c
  5115. }
  5116. // MaxResults sets the optional parameter "maxResults": The maximum
  5117. // number of discussions to include in the response, used for paging.
  5118. func (c *CommentsListCall) MaxResults(maxResults int64) *CommentsListCall {
  5119. c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
  5120. return c
  5121. }
  5122. // PageToken sets the optional parameter "pageToken": The continuation
  5123. // token, used to page through large result sets. To get the next page
  5124. // of results, set this parameter to the value of "nextPageToken" from
  5125. // the previous response.
  5126. func (c *CommentsListCall) PageToken(pageToken string) *CommentsListCall {
  5127. c.urlParams_.Set("pageToken", pageToken)
  5128. return c
  5129. }
  5130. // UpdatedMin sets the optional parameter "updatedMin": Only discussions
  5131. // that were updated after this timestamp will be returned. Formatted as
  5132. // an RFC 3339 timestamp.
  5133. func (c *CommentsListCall) UpdatedMin(updatedMin string) *CommentsListCall {
  5134. c.urlParams_.Set("updatedMin", updatedMin)
  5135. return c
  5136. }
  5137. // Fields allows partial responses to be retrieved. See
  5138. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5139. // for more information.
  5140. func (c *CommentsListCall) Fields(s ...googleapi.Field) *CommentsListCall {
  5141. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5142. return c
  5143. }
  5144. // IfNoneMatch sets the optional parameter which makes the operation
  5145. // fail if the object's ETag matches the given value. This is useful for
  5146. // getting updates only after the object has changed since the last
  5147. // request. Use googleapi.IsNotModified to check whether the response
  5148. // error from Do is the result of In-None-Match.
  5149. func (c *CommentsListCall) IfNoneMatch(entityTag string) *CommentsListCall {
  5150. c.ifNoneMatch_ = entityTag
  5151. return c
  5152. }
  5153. // Context sets the context to be used in this call's Do method. Any
  5154. // pending HTTP request will be aborted if the provided context is
  5155. // canceled.
  5156. func (c *CommentsListCall) Context(ctx context.Context) *CommentsListCall {
  5157. c.ctx_ = ctx
  5158. return c
  5159. }
  5160. // Header returns an http.Header that can be modified by the caller to
  5161. // add HTTP headers to the request.
  5162. func (c *CommentsListCall) Header() http.Header {
  5163. if c.header_ == nil {
  5164. c.header_ = make(http.Header)
  5165. }
  5166. return c.header_
  5167. }
  5168. func (c *CommentsListCall) doRequest(alt string) (*http.Response, error) {
  5169. reqHeaders := make(http.Header)
  5170. for k, v := range c.header_ {
  5171. reqHeaders[k] = v
  5172. }
  5173. reqHeaders.Set("User-Agent", c.s.userAgent())
  5174. if c.ifNoneMatch_ != "" {
  5175. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  5176. }
  5177. var body io.Reader = nil
  5178. c.urlParams_.Set("alt", alt)
  5179. c.urlParams_.Set("prettyPrint", "false")
  5180. urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/comments")
  5181. urls += "?" + c.urlParams_.Encode()
  5182. req, err := http.NewRequest("GET", urls, body)
  5183. if err != nil {
  5184. return nil, err
  5185. }
  5186. req.Header = reqHeaders
  5187. googleapi.Expand(req.URL, map[string]string{
  5188. "fileId": c.fileId,
  5189. })
  5190. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  5191. }
  5192. // Do executes the "drive.comments.list" call.
  5193. // Exactly one of *CommentList or error will be non-nil. Any non-2xx
  5194. // status code is an error. Response headers are in either
  5195. // *CommentList.ServerResponse.Header or (if a response was returned at
  5196. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  5197. // to check whether the returned error was because
  5198. // http.StatusNotModified was returned.
  5199. func (c *CommentsListCall) Do(opts ...googleapi.CallOption) (*CommentList, error) {
  5200. gensupport.SetOptions(c.urlParams_, opts...)
  5201. res, err := c.doRequest("json")
  5202. if res != nil && res.StatusCode == http.StatusNotModified {
  5203. if res.Body != nil {
  5204. res.Body.Close()
  5205. }
  5206. return nil, &googleapi.Error{
  5207. Code: res.StatusCode,
  5208. Header: res.Header,
  5209. }
  5210. }
  5211. if err != nil {
  5212. return nil, err
  5213. }
  5214. defer googleapi.CloseBody(res)
  5215. if err := googleapi.CheckResponse(res); err != nil {
  5216. return nil, err
  5217. }
  5218. ret := &CommentList{
  5219. ServerResponse: googleapi.ServerResponse{
  5220. Header: res.Header,
  5221. HTTPStatusCode: res.StatusCode,
  5222. },
  5223. }
  5224. target := &ret
  5225. if err := gensupport.DecodeResponse(target, res); err != nil {
  5226. return nil, err
  5227. }
  5228. return ret, nil
  5229. // {
  5230. // "description": "Lists a file's comments.",
  5231. // "httpMethod": "GET",
  5232. // "id": "drive.comments.list",
  5233. // "parameterOrder": [
  5234. // "fileId"
  5235. // ],
  5236. // "parameters": {
  5237. // "fileId": {
  5238. // "description": "The ID of the file.",
  5239. // "location": "path",
  5240. // "required": true,
  5241. // "type": "string"
  5242. // },
  5243. // "includeDeleted": {
  5244. // "default": "false",
  5245. // "description": "If set, all comments and replies, including deleted comments and replies (with content stripped) will be returned.",
  5246. // "location": "query",
  5247. // "type": "boolean"
  5248. // },
  5249. // "maxResults": {
  5250. // "default": "20",
  5251. // "description": "The maximum number of discussions to include in the response, used for paging.",
  5252. // "format": "int32",
  5253. // "location": "query",
  5254. // "maximum": "100",
  5255. // "minimum": "0",
  5256. // "type": "integer"
  5257. // },
  5258. // "pageToken": {
  5259. // "description": "The continuation token, used to page through large result sets. To get the next page of results, set this parameter to the value of \"nextPageToken\" from the previous response.",
  5260. // "location": "query",
  5261. // "type": "string"
  5262. // },
  5263. // "updatedMin": {
  5264. // "description": "Only discussions that were updated after this timestamp will be returned. Formatted as an RFC 3339 timestamp.",
  5265. // "location": "query",
  5266. // "type": "string"
  5267. // }
  5268. // },
  5269. // "path": "files/{fileId}/comments",
  5270. // "response": {
  5271. // "$ref": "CommentList"
  5272. // },
  5273. // "scopes": [
  5274. // "https://www.googleapis.com/auth/drive",
  5275. // "https://www.googleapis.com/auth/drive.file",
  5276. // "https://www.googleapis.com/auth/drive.readonly"
  5277. // ]
  5278. // }
  5279. }
  5280. // Pages invokes f for each page of results.
  5281. // A non-nil error returned from f will halt the iteration.
  5282. // The provided context supersedes any context provided to the Context method.
  5283. func (c *CommentsListCall) Pages(ctx context.Context, f func(*CommentList) error) error {
  5284. c.ctx_ = ctx
  5285. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  5286. for {
  5287. x, err := c.Do()
  5288. if err != nil {
  5289. return err
  5290. }
  5291. if err := f(x); err != nil {
  5292. return err
  5293. }
  5294. if x.NextPageToken == "" {
  5295. return nil
  5296. }
  5297. c.PageToken(x.NextPageToken)
  5298. }
  5299. }
  5300. // method id "drive.comments.patch":
  5301. type CommentsPatchCall struct {
  5302. s *Service
  5303. fileId string
  5304. commentId string
  5305. comment *Comment
  5306. urlParams_ gensupport.URLParams
  5307. ctx_ context.Context
  5308. header_ http.Header
  5309. }
  5310. // Patch: Updates an existing comment. This method supports patch
  5311. // semantics.
  5312. func (r *CommentsService) Patch(fileId string, commentId string, comment *Comment) *CommentsPatchCall {
  5313. c := &CommentsPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5314. c.fileId = fileId
  5315. c.commentId = commentId
  5316. c.comment = comment
  5317. return c
  5318. }
  5319. // Fields allows partial responses to be retrieved. See
  5320. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5321. // for more information.
  5322. func (c *CommentsPatchCall) Fields(s ...googleapi.Field) *CommentsPatchCall {
  5323. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5324. return c
  5325. }
  5326. // Context sets the context to be used in this call's Do method. Any
  5327. // pending HTTP request will be aborted if the provided context is
  5328. // canceled.
  5329. func (c *CommentsPatchCall) Context(ctx context.Context) *CommentsPatchCall {
  5330. c.ctx_ = ctx
  5331. return c
  5332. }
  5333. // Header returns an http.Header that can be modified by the caller to
  5334. // add HTTP headers to the request.
  5335. func (c *CommentsPatchCall) Header() http.Header {
  5336. if c.header_ == nil {
  5337. c.header_ = make(http.Header)
  5338. }
  5339. return c.header_
  5340. }
  5341. func (c *CommentsPatchCall) doRequest(alt string) (*http.Response, error) {
  5342. reqHeaders := make(http.Header)
  5343. for k, v := range c.header_ {
  5344. reqHeaders[k] = v
  5345. }
  5346. reqHeaders.Set("User-Agent", c.s.userAgent())
  5347. var body io.Reader = nil
  5348. body, err := googleapi.WithoutDataWrapper.JSONReader(c.comment)
  5349. if err != nil {
  5350. return nil, err
  5351. }
  5352. reqHeaders.Set("Content-Type", "application/json")
  5353. c.urlParams_.Set("alt", alt)
  5354. c.urlParams_.Set("prettyPrint", "false")
  5355. urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/comments/{commentId}")
  5356. urls += "?" + c.urlParams_.Encode()
  5357. req, err := http.NewRequest("PATCH", urls, body)
  5358. if err != nil {
  5359. return nil, err
  5360. }
  5361. req.Header = reqHeaders
  5362. googleapi.Expand(req.URL, map[string]string{
  5363. "fileId": c.fileId,
  5364. "commentId": c.commentId,
  5365. })
  5366. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  5367. }
  5368. // Do executes the "drive.comments.patch" call.
  5369. // Exactly one of *Comment or error will be non-nil. Any non-2xx status
  5370. // code is an error. Response headers are in either
  5371. // *Comment.ServerResponse.Header or (if a response was returned at all)
  5372. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  5373. // check whether the returned error was because http.StatusNotModified
  5374. // was returned.
  5375. func (c *CommentsPatchCall) Do(opts ...googleapi.CallOption) (*Comment, error) {
  5376. gensupport.SetOptions(c.urlParams_, opts...)
  5377. res, err := c.doRequest("json")
  5378. if res != nil && res.StatusCode == http.StatusNotModified {
  5379. if res.Body != nil {
  5380. res.Body.Close()
  5381. }
  5382. return nil, &googleapi.Error{
  5383. Code: res.StatusCode,
  5384. Header: res.Header,
  5385. }
  5386. }
  5387. if err != nil {
  5388. return nil, err
  5389. }
  5390. defer googleapi.CloseBody(res)
  5391. if err := googleapi.CheckResponse(res); err != nil {
  5392. return nil, err
  5393. }
  5394. ret := &Comment{
  5395. ServerResponse: googleapi.ServerResponse{
  5396. Header: res.Header,
  5397. HTTPStatusCode: res.StatusCode,
  5398. },
  5399. }
  5400. target := &ret
  5401. if err := gensupport.DecodeResponse(target, res); err != nil {
  5402. return nil, err
  5403. }
  5404. return ret, nil
  5405. // {
  5406. // "description": "Updates an existing comment. This method supports patch semantics.",
  5407. // "httpMethod": "PATCH",
  5408. // "id": "drive.comments.patch",
  5409. // "parameterOrder": [
  5410. // "fileId",
  5411. // "commentId"
  5412. // ],
  5413. // "parameters": {
  5414. // "commentId": {
  5415. // "description": "The ID of the comment.",
  5416. // "location": "path",
  5417. // "required": true,
  5418. // "type": "string"
  5419. // },
  5420. // "fileId": {
  5421. // "description": "The ID of the file.",
  5422. // "location": "path",
  5423. // "required": true,
  5424. // "type": "string"
  5425. // }
  5426. // },
  5427. // "path": "files/{fileId}/comments/{commentId}",
  5428. // "request": {
  5429. // "$ref": "Comment"
  5430. // },
  5431. // "response": {
  5432. // "$ref": "Comment"
  5433. // },
  5434. // "scopes": [
  5435. // "https://www.googleapis.com/auth/drive",
  5436. // "https://www.googleapis.com/auth/drive.file"
  5437. // ]
  5438. // }
  5439. }
  5440. // method id "drive.comments.update":
  5441. type CommentsUpdateCall struct {
  5442. s *Service
  5443. fileId string
  5444. commentId string
  5445. comment *Comment
  5446. urlParams_ gensupport.URLParams
  5447. ctx_ context.Context
  5448. header_ http.Header
  5449. }
  5450. // Update: Updates an existing comment.
  5451. func (r *CommentsService) Update(fileId string, commentId string, comment *Comment) *CommentsUpdateCall {
  5452. c := &CommentsUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5453. c.fileId = fileId
  5454. c.commentId = commentId
  5455. c.comment = comment
  5456. return c
  5457. }
  5458. // Fields allows partial responses to be retrieved. See
  5459. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5460. // for more information.
  5461. func (c *CommentsUpdateCall) Fields(s ...googleapi.Field) *CommentsUpdateCall {
  5462. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5463. return c
  5464. }
  5465. // Context sets the context to be used in this call's Do method. Any
  5466. // pending HTTP request will be aborted if the provided context is
  5467. // canceled.
  5468. func (c *CommentsUpdateCall) Context(ctx context.Context) *CommentsUpdateCall {
  5469. c.ctx_ = ctx
  5470. return c
  5471. }
  5472. // Header returns an http.Header that can be modified by the caller to
  5473. // add HTTP headers to the request.
  5474. func (c *CommentsUpdateCall) Header() http.Header {
  5475. if c.header_ == nil {
  5476. c.header_ = make(http.Header)
  5477. }
  5478. return c.header_
  5479. }
  5480. func (c *CommentsUpdateCall) doRequest(alt string) (*http.Response, error) {
  5481. reqHeaders := make(http.Header)
  5482. for k, v := range c.header_ {
  5483. reqHeaders[k] = v
  5484. }
  5485. reqHeaders.Set("User-Agent", c.s.userAgent())
  5486. var body io.Reader = nil
  5487. body, err := googleapi.WithoutDataWrapper.JSONReader(c.comment)
  5488. if err != nil {
  5489. return nil, err
  5490. }
  5491. reqHeaders.Set("Content-Type", "application/json")
  5492. c.urlParams_.Set("alt", alt)
  5493. c.urlParams_.Set("prettyPrint", "false")
  5494. urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/comments/{commentId}")
  5495. urls += "?" + c.urlParams_.Encode()
  5496. req, err := http.NewRequest("PUT", urls, body)
  5497. if err != nil {
  5498. return nil, err
  5499. }
  5500. req.Header = reqHeaders
  5501. googleapi.Expand(req.URL, map[string]string{
  5502. "fileId": c.fileId,
  5503. "commentId": c.commentId,
  5504. })
  5505. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  5506. }
  5507. // Do executes the "drive.comments.update" call.
  5508. // Exactly one of *Comment or error will be non-nil. Any non-2xx status
  5509. // code is an error. Response headers are in either
  5510. // *Comment.ServerResponse.Header or (if a response was returned at all)
  5511. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  5512. // check whether the returned error was because http.StatusNotModified
  5513. // was returned.
  5514. func (c *CommentsUpdateCall) Do(opts ...googleapi.CallOption) (*Comment, error) {
  5515. gensupport.SetOptions(c.urlParams_, opts...)
  5516. res, err := c.doRequest("json")
  5517. if res != nil && res.StatusCode == http.StatusNotModified {
  5518. if res.Body != nil {
  5519. res.Body.Close()
  5520. }
  5521. return nil, &googleapi.Error{
  5522. Code: res.StatusCode,
  5523. Header: res.Header,
  5524. }
  5525. }
  5526. if err != nil {
  5527. return nil, err
  5528. }
  5529. defer googleapi.CloseBody(res)
  5530. if err := googleapi.CheckResponse(res); err != nil {
  5531. return nil, err
  5532. }
  5533. ret := &Comment{
  5534. ServerResponse: googleapi.ServerResponse{
  5535. Header: res.Header,
  5536. HTTPStatusCode: res.StatusCode,
  5537. },
  5538. }
  5539. target := &ret
  5540. if err := gensupport.DecodeResponse(target, res); err != nil {
  5541. return nil, err
  5542. }
  5543. return ret, nil
  5544. // {
  5545. // "description": "Updates an existing comment.",
  5546. // "httpMethod": "PUT",
  5547. // "id": "drive.comments.update",
  5548. // "parameterOrder": [
  5549. // "fileId",
  5550. // "commentId"
  5551. // ],
  5552. // "parameters": {
  5553. // "commentId": {
  5554. // "description": "The ID of the comment.",
  5555. // "location": "path",
  5556. // "required": true,
  5557. // "type": "string"
  5558. // },
  5559. // "fileId": {
  5560. // "description": "The ID of the file.",
  5561. // "location": "path",
  5562. // "required": true,
  5563. // "type": "string"
  5564. // }
  5565. // },
  5566. // "path": "files/{fileId}/comments/{commentId}",
  5567. // "request": {
  5568. // "$ref": "Comment"
  5569. // },
  5570. // "response": {
  5571. // "$ref": "Comment"
  5572. // },
  5573. // "scopes": [
  5574. // "https://www.googleapis.com/auth/drive",
  5575. // "https://www.googleapis.com/auth/drive.file"
  5576. // ]
  5577. // }
  5578. }
  5579. // method id "drive.files.copy":
  5580. type FilesCopyCall struct {
  5581. s *Service
  5582. fileId string
  5583. file *File
  5584. urlParams_ gensupport.URLParams
  5585. ctx_ context.Context
  5586. header_ http.Header
  5587. }
  5588. // Copy: Creates a copy of the specified file.
  5589. func (r *FilesService) Copy(fileId string, file *File) *FilesCopyCall {
  5590. c := &FilesCopyCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5591. c.fileId = fileId
  5592. c.file = file
  5593. return c
  5594. }
  5595. // Convert sets the optional parameter "convert": Whether to convert
  5596. // this file to the corresponding Google Docs format.
  5597. func (c *FilesCopyCall) Convert(convert bool) *FilesCopyCall {
  5598. c.urlParams_.Set("convert", fmt.Sprint(convert))
  5599. return c
  5600. }
  5601. // Ocr sets the optional parameter "ocr": Whether to attempt OCR on
  5602. // .jpg, .png, .gif, or .pdf uploads.
  5603. func (c *FilesCopyCall) Ocr(ocr bool) *FilesCopyCall {
  5604. c.urlParams_.Set("ocr", fmt.Sprint(ocr))
  5605. return c
  5606. }
  5607. // OcrLanguage sets the optional parameter "ocrLanguage": If ocr is
  5608. // true, hints at the language to use. Valid values are BCP 47 codes.
  5609. func (c *FilesCopyCall) OcrLanguage(ocrLanguage string) *FilesCopyCall {
  5610. c.urlParams_.Set("ocrLanguage", ocrLanguage)
  5611. return c
  5612. }
  5613. // Pinned sets the optional parameter "pinned": Whether to pin the head
  5614. // revision of the new copy. A file can have a maximum of 200 pinned
  5615. // revisions.
  5616. func (c *FilesCopyCall) Pinned(pinned bool) *FilesCopyCall {
  5617. c.urlParams_.Set("pinned", fmt.Sprint(pinned))
  5618. return c
  5619. }
  5620. // SupportsTeamDrives sets the optional parameter "supportsTeamDrives":
  5621. // Whether the requesting application supports Team Drives.
  5622. func (c *FilesCopyCall) SupportsTeamDrives(supportsTeamDrives bool) *FilesCopyCall {
  5623. c.urlParams_.Set("supportsTeamDrives", fmt.Sprint(supportsTeamDrives))
  5624. return c
  5625. }
  5626. // TimedTextLanguage sets the optional parameter "timedTextLanguage":
  5627. // The language of the timed text.
  5628. func (c *FilesCopyCall) TimedTextLanguage(timedTextLanguage string) *FilesCopyCall {
  5629. c.urlParams_.Set("timedTextLanguage", timedTextLanguage)
  5630. return c
  5631. }
  5632. // TimedTextTrackName sets the optional parameter "timedTextTrackName":
  5633. // The timed text track name.
  5634. func (c *FilesCopyCall) TimedTextTrackName(timedTextTrackName string) *FilesCopyCall {
  5635. c.urlParams_.Set("timedTextTrackName", timedTextTrackName)
  5636. return c
  5637. }
  5638. // Visibility sets the optional parameter "visibility": The visibility
  5639. // of the new file. This parameter is only relevant when the source is
  5640. // not a native Google Doc and convert=false.
  5641. //
  5642. // Possible values:
  5643. // "DEFAULT" (default) - The visibility of the new file is determined
  5644. // by the user's default visibility/sharing policies.
  5645. // "PRIVATE" - The new file will be visible to only the owner.
  5646. func (c *FilesCopyCall) Visibility(visibility string) *FilesCopyCall {
  5647. c.urlParams_.Set("visibility", visibility)
  5648. return c
  5649. }
  5650. // Fields allows partial responses to be retrieved. See
  5651. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5652. // for more information.
  5653. func (c *FilesCopyCall) Fields(s ...googleapi.Field) *FilesCopyCall {
  5654. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5655. return c
  5656. }
  5657. // Context sets the context to be used in this call's Do method. Any
  5658. // pending HTTP request will be aborted if the provided context is
  5659. // canceled.
  5660. func (c *FilesCopyCall) Context(ctx context.Context) *FilesCopyCall {
  5661. c.ctx_ = ctx
  5662. return c
  5663. }
  5664. // Header returns an http.Header that can be modified by the caller to
  5665. // add HTTP headers to the request.
  5666. func (c *FilesCopyCall) Header() http.Header {
  5667. if c.header_ == nil {
  5668. c.header_ = make(http.Header)
  5669. }
  5670. return c.header_
  5671. }
  5672. func (c *FilesCopyCall) doRequest(alt string) (*http.Response, error) {
  5673. reqHeaders := make(http.Header)
  5674. for k, v := range c.header_ {
  5675. reqHeaders[k] = v
  5676. }
  5677. reqHeaders.Set("User-Agent", c.s.userAgent())
  5678. var body io.Reader = nil
  5679. body, err := googleapi.WithoutDataWrapper.JSONReader(c.file)
  5680. if err != nil {
  5681. return nil, err
  5682. }
  5683. reqHeaders.Set("Content-Type", "application/json")
  5684. c.urlParams_.Set("alt", alt)
  5685. c.urlParams_.Set("prettyPrint", "false")
  5686. urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/copy")
  5687. urls += "?" + c.urlParams_.Encode()
  5688. req, err := http.NewRequest("POST", urls, body)
  5689. if err != nil {
  5690. return nil, err
  5691. }
  5692. req.Header = reqHeaders
  5693. googleapi.Expand(req.URL, map[string]string{
  5694. "fileId": c.fileId,
  5695. })
  5696. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  5697. }
  5698. // Do executes the "drive.files.copy" call.
  5699. // Exactly one of *File or error will be non-nil. Any non-2xx status
  5700. // code is an error. Response headers are in either
  5701. // *File.ServerResponse.Header or (if a response was returned at all) in
  5702. // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  5703. // whether the returned error was because http.StatusNotModified was
  5704. // returned.
  5705. func (c *FilesCopyCall) Do(opts ...googleapi.CallOption) (*File, error) {
  5706. gensupport.SetOptions(c.urlParams_, opts...)
  5707. res, err := c.doRequest("json")
  5708. if res != nil && res.StatusCode == http.StatusNotModified {
  5709. if res.Body != nil {
  5710. res.Body.Close()
  5711. }
  5712. return nil, &googleapi.Error{
  5713. Code: res.StatusCode,
  5714. Header: res.Header,
  5715. }
  5716. }
  5717. if err != nil {
  5718. return nil, err
  5719. }
  5720. defer googleapi.CloseBody(res)
  5721. if err := googleapi.CheckResponse(res); err != nil {
  5722. return nil, err
  5723. }
  5724. ret := &File{
  5725. ServerResponse: googleapi.ServerResponse{
  5726. Header: res.Header,
  5727. HTTPStatusCode: res.StatusCode,
  5728. },
  5729. }
  5730. target := &ret
  5731. if err := gensupport.DecodeResponse(target, res); err != nil {
  5732. return nil, err
  5733. }
  5734. return ret, nil
  5735. // {
  5736. // "description": "Creates a copy of the specified file.",
  5737. // "httpMethod": "POST",
  5738. // "id": "drive.files.copy",
  5739. // "parameterOrder": [
  5740. // "fileId"
  5741. // ],
  5742. // "parameters": {
  5743. // "convert": {
  5744. // "default": "false",
  5745. // "description": "Whether to convert this file to the corresponding Google Docs format.",
  5746. // "location": "query",
  5747. // "type": "boolean"
  5748. // },
  5749. // "fileId": {
  5750. // "description": "The ID of the file to copy.",
  5751. // "location": "path",
  5752. // "required": true,
  5753. // "type": "string"
  5754. // },
  5755. // "ocr": {
  5756. // "default": "false",
  5757. // "description": "Whether to attempt OCR on .jpg, .png, .gif, or .pdf uploads.",
  5758. // "location": "query",
  5759. // "type": "boolean"
  5760. // },
  5761. // "ocrLanguage": {
  5762. // "description": "If ocr is true, hints at the language to use. Valid values are BCP 47 codes.",
  5763. // "location": "query",
  5764. // "type": "string"
  5765. // },
  5766. // "pinned": {
  5767. // "default": "false",
  5768. // "description": "Whether to pin the head revision of the new copy. A file can have a maximum of 200 pinned revisions.",
  5769. // "location": "query",
  5770. // "type": "boolean"
  5771. // },
  5772. // "supportsTeamDrives": {
  5773. // "default": "false",
  5774. // "description": "Whether the requesting application supports Team Drives.",
  5775. // "location": "query",
  5776. // "type": "boolean"
  5777. // },
  5778. // "timedTextLanguage": {
  5779. // "description": "The language of the timed text.",
  5780. // "location": "query",
  5781. // "type": "string"
  5782. // },
  5783. // "timedTextTrackName": {
  5784. // "description": "The timed text track name.",
  5785. // "location": "query",
  5786. // "type": "string"
  5787. // },
  5788. // "visibility": {
  5789. // "default": "DEFAULT",
  5790. // "description": "The visibility of the new file. This parameter is only relevant when the source is not a native Google Doc and convert=false.",
  5791. // "enum": [
  5792. // "DEFAULT",
  5793. // "PRIVATE"
  5794. // ],
  5795. // "enumDescriptions": [
  5796. // "The visibility of the new file is determined by the user's default visibility/sharing policies.",
  5797. // "The new file will be visible to only the owner."
  5798. // ],
  5799. // "location": "query",
  5800. // "type": "string"
  5801. // }
  5802. // },
  5803. // "path": "files/{fileId}/copy",
  5804. // "request": {
  5805. // "$ref": "File"
  5806. // },
  5807. // "response": {
  5808. // "$ref": "File"
  5809. // },
  5810. // "scopes": [
  5811. // "https://www.googleapis.com/auth/drive",
  5812. // "https://www.googleapis.com/auth/drive.appdata",
  5813. // "https://www.googleapis.com/auth/drive.apps.readonly",
  5814. // "https://www.googleapis.com/auth/drive.file",
  5815. // "https://www.googleapis.com/auth/drive.photos.readonly"
  5816. // ]
  5817. // }
  5818. }
  5819. // method id "drive.files.delete":
  5820. type FilesDeleteCall struct {
  5821. s *Service
  5822. fileId string
  5823. urlParams_ gensupport.URLParams
  5824. ctx_ context.Context
  5825. header_ http.Header
  5826. }
  5827. // Delete: Permanently deletes a file by ID. Skips the trash. The
  5828. // currently authenticated user must own the file or be an organizer on
  5829. // the parent for Team Drive files.
  5830. func (r *FilesService) Delete(fileId string) *FilesDeleteCall {
  5831. c := &FilesDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5832. c.fileId = fileId
  5833. return c
  5834. }
  5835. // SupportsTeamDrives sets the optional parameter "supportsTeamDrives":
  5836. // Whether the requesting application supports Team Drives.
  5837. func (c *FilesDeleteCall) SupportsTeamDrives(supportsTeamDrives bool) *FilesDeleteCall {
  5838. c.urlParams_.Set("supportsTeamDrives", fmt.Sprint(supportsTeamDrives))
  5839. return c
  5840. }
  5841. // Fields allows partial responses to be retrieved. See
  5842. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5843. // for more information.
  5844. func (c *FilesDeleteCall) Fields(s ...googleapi.Field) *FilesDeleteCall {
  5845. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5846. return c
  5847. }
  5848. // Context sets the context to be used in this call's Do method. Any
  5849. // pending HTTP request will be aborted if the provided context is
  5850. // canceled.
  5851. func (c *FilesDeleteCall) Context(ctx context.Context) *FilesDeleteCall {
  5852. c.ctx_ = ctx
  5853. return c
  5854. }
  5855. // Header returns an http.Header that can be modified by the caller to
  5856. // add HTTP headers to the request.
  5857. func (c *FilesDeleteCall) Header() http.Header {
  5858. if c.header_ == nil {
  5859. c.header_ = make(http.Header)
  5860. }
  5861. return c.header_
  5862. }
  5863. func (c *FilesDeleteCall) doRequest(alt string) (*http.Response, error) {
  5864. reqHeaders := make(http.Header)
  5865. for k, v := range c.header_ {
  5866. reqHeaders[k] = v
  5867. }
  5868. reqHeaders.Set("User-Agent", c.s.userAgent())
  5869. var body io.Reader = nil
  5870. c.urlParams_.Set("alt", alt)
  5871. c.urlParams_.Set("prettyPrint", "false")
  5872. urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}")
  5873. urls += "?" + c.urlParams_.Encode()
  5874. req, err := http.NewRequest("DELETE", urls, body)
  5875. if err != nil {
  5876. return nil, err
  5877. }
  5878. req.Header = reqHeaders
  5879. googleapi.Expand(req.URL, map[string]string{
  5880. "fileId": c.fileId,
  5881. })
  5882. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  5883. }
  5884. // Do executes the "drive.files.delete" call.
  5885. func (c *FilesDeleteCall) Do(opts ...googleapi.CallOption) error {
  5886. gensupport.SetOptions(c.urlParams_, opts...)
  5887. res, err := c.doRequest("json")
  5888. if err != nil {
  5889. return err
  5890. }
  5891. defer googleapi.CloseBody(res)
  5892. if err := googleapi.CheckResponse(res); err != nil {
  5893. return err
  5894. }
  5895. return nil
  5896. // {
  5897. // "description": "Permanently deletes a file by ID. Skips the trash. The currently authenticated user must own the file or be an organizer on the parent for Team Drive files.",
  5898. // "httpMethod": "DELETE",
  5899. // "id": "drive.files.delete",
  5900. // "parameterOrder": [
  5901. // "fileId"
  5902. // ],
  5903. // "parameters": {
  5904. // "fileId": {
  5905. // "description": "The ID of the file to delete.",
  5906. // "location": "path",
  5907. // "required": true,
  5908. // "type": "string"
  5909. // },
  5910. // "supportsTeamDrives": {
  5911. // "default": "false",
  5912. // "description": "Whether the requesting application supports Team Drives.",
  5913. // "location": "query",
  5914. // "type": "boolean"
  5915. // }
  5916. // },
  5917. // "path": "files/{fileId}",
  5918. // "scopes": [
  5919. // "https://www.googleapis.com/auth/drive",
  5920. // "https://www.googleapis.com/auth/drive.appdata",
  5921. // "https://www.googleapis.com/auth/drive.file"
  5922. // ]
  5923. // }
  5924. }
  5925. // method id "drive.files.emptyTrash":
  5926. type FilesEmptyTrashCall struct {
  5927. s *Service
  5928. urlParams_ gensupport.URLParams
  5929. ctx_ context.Context
  5930. header_ http.Header
  5931. }
  5932. // EmptyTrash: Permanently deletes all of the user's trashed files.
  5933. func (r *FilesService) EmptyTrash() *FilesEmptyTrashCall {
  5934. c := &FilesEmptyTrashCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5935. return c
  5936. }
  5937. // Fields allows partial responses to be retrieved. See
  5938. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5939. // for more information.
  5940. func (c *FilesEmptyTrashCall) Fields(s ...googleapi.Field) *FilesEmptyTrashCall {
  5941. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5942. return c
  5943. }
  5944. // Context sets the context to be used in this call's Do method. Any
  5945. // pending HTTP request will be aborted if the provided context is
  5946. // canceled.
  5947. func (c *FilesEmptyTrashCall) Context(ctx context.Context) *FilesEmptyTrashCall {
  5948. c.ctx_ = ctx
  5949. return c
  5950. }
  5951. // Header returns an http.Header that can be modified by the caller to
  5952. // add HTTP headers to the request.
  5953. func (c *FilesEmptyTrashCall) Header() http.Header {
  5954. if c.header_ == nil {
  5955. c.header_ = make(http.Header)
  5956. }
  5957. return c.header_
  5958. }
  5959. func (c *FilesEmptyTrashCall) doRequest(alt string) (*http.Response, error) {
  5960. reqHeaders := make(http.Header)
  5961. for k, v := range c.header_ {
  5962. reqHeaders[k] = v
  5963. }
  5964. reqHeaders.Set("User-Agent", c.s.userAgent())
  5965. var body io.Reader = nil
  5966. c.urlParams_.Set("alt", alt)
  5967. c.urlParams_.Set("prettyPrint", "false")
  5968. urls := googleapi.ResolveRelative(c.s.BasePath, "files/trash")
  5969. urls += "?" + c.urlParams_.Encode()
  5970. req, err := http.NewRequest("DELETE", urls, body)
  5971. if err != nil {
  5972. return nil, err
  5973. }
  5974. req.Header = reqHeaders
  5975. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  5976. }
  5977. // Do executes the "drive.files.emptyTrash" call.
  5978. func (c *FilesEmptyTrashCall) Do(opts ...googleapi.CallOption) error {
  5979. gensupport.SetOptions(c.urlParams_, opts...)
  5980. res, err := c.doRequest("json")
  5981. if err != nil {
  5982. return err
  5983. }
  5984. defer googleapi.CloseBody(res)
  5985. if err := googleapi.CheckResponse(res); err != nil {
  5986. return err
  5987. }
  5988. return nil
  5989. // {
  5990. // "description": "Permanently deletes all of the user's trashed files.",
  5991. // "httpMethod": "DELETE",
  5992. // "id": "drive.files.emptyTrash",
  5993. // "path": "files/trash",
  5994. // "scopes": [
  5995. // "https://www.googleapis.com/auth/drive"
  5996. // ]
  5997. // }
  5998. }
  5999. // method id "drive.files.export":
  6000. type FilesExportCall struct {
  6001. s *Service
  6002. fileId string
  6003. urlParams_ gensupport.URLParams
  6004. ifNoneMatch_ string
  6005. ctx_ context.Context
  6006. header_ http.Header
  6007. }
  6008. // Export: Exports a Google Doc to the requested MIME type and returns
  6009. // the exported content. Please note that the exported content is
  6010. // limited to 10MB.
  6011. func (r *FilesService) Export(fileId string, mimeType string) *FilesExportCall {
  6012. c := &FilesExportCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  6013. c.fileId = fileId
  6014. c.urlParams_.Set("mimeType", mimeType)
  6015. return c
  6016. }
  6017. // Fields allows partial responses to be retrieved. See
  6018. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  6019. // for more information.
  6020. func (c *FilesExportCall) Fields(s ...googleapi.Field) *FilesExportCall {
  6021. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  6022. return c
  6023. }
  6024. // IfNoneMatch sets the optional parameter which makes the operation
  6025. // fail if the object's ETag matches the given value. This is useful for
  6026. // getting updates only after the object has changed since the last
  6027. // request. Use googleapi.IsNotModified to check whether the response
  6028. // error from Do is the result of In-None-Match.
  6029. func (c *FilesExportCall) IfNoneMatch(entityTag string) *FilesExportCall {
  6030. c.ifNoneMatch_ = entityTag
  6031. return c
  6032. }
  6033. // Context sets the context to be used in this call's Do and Download
  6034. // methods. Any pending HTTP request will be aborted if the provided
  6035. // context is canceled.
  6036. func (c *FilesExportCall) Context(ctx context.Context) *FilesExportCall {
  6037. c.ctx_ = ctx
  6038. return c
  6039. }
  6040. // Header returns an http.Header that can be modified by the caller to
  6041. // add HTTP headers to the request.
  6042. func (c *FilesExportCall) Header() http.Header {
  6043. if c.header_ == nil {
  6044. c.header_ = make(http.Header)
  6045. }
  6046. return c.header_
  6047. }
  6048. func (c *FilesExportCall) doRequest(alt string) (*http.Response, error) {
  6049. reqHeaders := make(http.Header)
  6050. for k, v := range c.header_ {
  6051. reqHeaders[k] = v
  6052. }
  6053. reqHeaders.Set("User-Agent", c.s.userAgent())
  6054. if c.ifNoneMatch_ != "" {
  6055. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  6056. }
  6057. var body io.Reader = nil
  6058. c.urlParams_.Set("alt", alt)
  6059. c.urlParams_.Set("prettyPrint", "false")
  6060. urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/export")
  6061. urls += "?" + c.urlParams_.Encode()
  6062. req, err := http.NewRequest("GET", urls, body)
  6063. if err != nil {
  6064. return nil, err
  6065. }
  6066. req.Header = reqHeaders
  6067. googleapi.Expand(req.URL, map[string]string{
  6068. "fileId": c.fileId,
  6069. })
  6070. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  6071. }
  6072. // Download fetches the API endpoint's "media" value, instead of the normal
  6073. // API response value. If the returned error is nil, the Response is guaranteed to
  6074. // have a 2xx status code. Callers must close the Response.Body as usual.
  6075. func (c *FilesExportCall) Download(opts ...googleapi.CallOption) (*http.Response, error) {
  6076. gensupport.SetOptions(c.urlParams_, opts...)
  6077. res, err := c.doRequest("media")
  6078. if err != nil {
  6079. return nil, err
  6080. }
  6081. if err := googleapi.CheckMediaResponse(res); err != nil {
  6082. res.Body.Close()
  6083. return nil, err
  6084. }
  6085. return res, nil
  6086. }
  6087. // Do executes the "drive.files.export" call.
  6088. func (c *FilesExportCall) Do(opts ...googleapi.CallOption) error {
  6089. gensupport.SetOptions(c.urlParams_, opts...)
  6090. res, err := c.doRequest("json")
  6091. if err != nil {
  6092. return err
  6093. }
  6094. defer googleapi.CloseBody(res)
  6095. if err := googleapi.CheckResponse(res); err != nil {
  6096. return err
  6097. }
  6098. return nil
  6099. // {
  6100. // "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.",
  6101. // "httpMethod": "GET",
  6102. // "id": "drive.files.export",
  6103. // "parameterOrder": [
  6104. // "fileId",
  6105. // "mimeType"
  6106. // ],
  6107. // "parameters": {
  6108. // "fileId": {
  6109. // "description": "The ID of the file.",
  6110. // "location": "path",
  6111. // "required": true,
  6112. // "type": "string"
  6113. // },
  6114. // "mimeType": {
  6115. // "description": "The MIME type of the format requested for this export.",
  6116. // "location": "query",
  6117. // "required": true,
  6118. // "type": "string"
  6119. // }
  6120. // },
  6121. // "path": "files/{fileId}/export",
  6122. // "scopes": [
  6123. // "https://www.googleapis.com/auth/drive",
  6124. // "https://www.googleapis.com/auth/drive.file",
  6125. // "https://www.googleapis.com/auth/drive.readonly"
  6126. // ],
  6127. // "supportsMediaDownload": true
  6128. // }
  6129. }
  6130. // method id "drive.files.generateIds":
  6131. type FilesGenerateIdsCall struct {
  6132. s *Service
  6133. urlParams_ gensupport.URLParams
  6134. ifNoneMatch_ string
  6135. ctx_ context.Context
  6136. header_ http.Header
  6137. }
  6138. // GenerateIds: Generates a set of file IDs which can be provided in
  6139. // insert requests.
  6140. func (r *FilesService) GenerateIds() *FilesGenerateIdsCall {
  6141. c := &FilesGenerateIdsCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  6142. return c
  6143. }
  6144. // MaxResults sets the optional parameter "maxResults": Maximum number
  6145. // of IDs to return.
  6146. func (c *FilesGenerateIdsCall) MaxResults(maxResults int64) *FilesGenerateIdsCall {
  6147. c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
  6148. return c
  6149. }
  6150. // Space sets the optional parameter "space": The space in which the IDs
  6151. // can be used to create new files. Supported values are 'drive' and
  6152. // 'appDataFolder'.
  6153. func (c *FilesGenerateIdsCall) Space(space string) *FilesGenerateIdsCall {
  6154. c.urlParams_.Set("space", space)
  6155. return c
  6156. }
  6157. // Fields allows partial responses to be retrieved. See
  6158. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  6159. // for more information.
  6160. func (c *FilesGenerateIdsCall) Fields(s ...googleapi.Field) *FilesGenerateIdsCall {
  6161. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  6162. return c
  6163. }
  6164. // IfNoneMatch sets the optional parameter which makes the operation
  6165. // fail if the object's ETag matches the given value. This is useful for
  6166. // getting updates only after the object has changed since the last
  6167. // request. Use googleapi.IsNotModified to check whether the response
  6168. // error from Do is the result of In-None-Match.
  6169. func (c *FilesGenerateIdsCall) IfNoneMatch(entityTag string) *FilesGenerateIdsCall {
  6170. c.ifNoneMatch_ = entityTag
  6171. return c
  6172. }
  6173. // Context sets the context to be used in this call's Do method. Any
  6174. // pending HTTP request will be aborted if the provided context is
  6175. // canceled.
  6176. func (c *FilesGenerateIdsCall) Context(ctx context.Context) *FilesGenerateIdsCall {
  6177. c.ctx_ = ctx
  6178. return c
  6179. }
  6180. // Header returns an http.Header that can be modified by the caller to
  6181. // add HTTP headers to the request.
  6182. func (c *FilesGenerateIdsCall) Header() http.Header {
  6183. if c.header_ == nil {
  6184. c.header_ = make(http.Header)
  6185. }
  6186. return c.header_
  6187. }
  6188. func (c *FilesGenerateIdsCall) doRequest(alt string) (*http.Response, error) {
  6189. reqHeaders := make(http.Header)
  6190. for k, v := range c.header_ {
  6191. reqHeaders[k] = v
  6192. }
  6193. reqHeaders.Set("User-Agent", c.s.userAgent())
  6194. if c.ifNoneMatch_ != "" {
  6195. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  6196. }
  6197. var body io.Reader = nil
  6198. c.urlParams_.Set("alt", alt)
  6199. c.urlParams_.Set("prettyPrint", "false")
  6200. urls := googleapi.ResolveRelative(c.s.BasePath, "files/generateIds")
  6201. urls += "?" + c.urlParams_.Encode()
  6202. req, err := http.NewRequest("GET", urls, body)
  6203. if err != nil {
  6204. return nil, err
  6205. }
  6206. req.Header = reqHeaders
  6207. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  6208. }
  6209. // Do executes the "drive.files.generateIds" call.
  6210. // Exactly one of *GeneratedIds or error will be non-nil. Any non-2xx
  6211. // status code is an error. Response headers are in either
  6212. // *GeneratedIds.ServerResponse.Header or (if a response was returned at
  6213. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  6214. // to check whether the returned error was because
  6215. // http.StatusNotModified was returned.
  6216. func (c *FilesGenerateIdsCall) Do(opts ...googleapi.CallOption) (*GeneratedIds, error) {
  6217. gensupport.SetOptions(c.urlParams_, opts...)
  6218. res, err := c.doRequest("json")
  6219. if res != nil && res.StatusCode == http.StatusNotModified {
  6220. if res.Body != nil {
  6221. res.Body.Close()
  6222. }
  6223. return nil, &googleapi.Error{
  6224. Code: res.StatusCode,
  6225. Header: res.Header,
  6226. }
  6227. }
  6228. if err != nil {
  6229. return nil, err
  6230. }
  6231. defer googleapi.CloseBody(res)
  6232. if err := googleapi.CheckResponse(res); err != nil {
  6233. return nil, err
  6234. }
  6235. ret := &GeneratedIds{
  6236. ServerResponse: googleapi.ServerResponse{
  6237. Header: res.Header,
  6238. HTTPStatusCode: res.StatusCode,
  6239. },
  6240. }
  6241. target := &ret
  6242. if err := gensupport.DecodeResponse(target, res); err != nil {
  6243. return nil, err
  6244. }
  6245. return ret, nil
  6246. // {
  6247. // "description": "Generates a set of file IDs which can be provided in insert requests.",
  6248. // "httpMethod": "GET",
  6249. // "id": "drive.files.generateIds",
  6250. // "parameters": {
  6251. // "maxResults": {
  6252. // "default": "10",
  6253. // "description": "Maximum number of IDs to return.",
  6254. // "format": "int32",
  6255. // "location": "query",
  6256. // "maximum": "1000",
  6257. // "minimum": "1",
  6258. // "type": "integer"
  6259. // },
  6260. // "space": {
  6261. // "default": "drive",
  6262. // "description": "The space in which the IDs can be used to create new files. Supported values are 'drive' and 'appDataFolder'.",
  6263. // "location": "query",
  6264. // "type": "string"
  6265. // }
  6266. // },
  6267. // "path": "files/generateIds",
  6268. // "response": {
  6269. // "$ref": "GeneratedIds"
  6270. // },
  6271. // "scopes": [
  6272. // "https://www.googleapis.com/auth/drive",
  6273. // "https://www.googleapis.com/auth/drive.appdata",
  6274. // "https://www.googleapis.com/auth/drive.file"
  6275. // ]
  6276. // }
  6277. }
  6278. // method id "drive.files.get":
  6279. type FilesGetCall struct {
  6280. s *Service
  6281. fileId string
  6282. urlParams_ gensupport.URLParams
  6283. ifNoneMatch_ string
  6284. ctx_ context.Context
  6285. header_ http.Header
  6286. }
  6287. // Get: Gets a file's metadata by ID.
  6288. func (r *FilesService) Get(fileId string) *FilesGetCall {
  6289. c := &FilesGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  6290. c.fileId = fileId
  6291. return c
  6292. }
  6293. // AcknowledgeAbuse sets the optional parameter "acknowledgeAbuse":
  6294. // Whether the user is acknowledging the risk of downloading known
  6295. // malware or other abusive files.
  6296. func (c *FilesGetCall) AcknowledgeAbuse(acknowledgeAbuse bool) *FilesGetCall {
  6297. c.urlParams_.Set("acknowledgeAbuse", fmt.Sprint(acknowledgeAbuse))
  6298. return c
  6299. }
  6300. // Projection sets the optional parameter "projection": This parameter
  6301. // is deprecated and has no function.
  6302. //
  6303. // Possible values:
  6304. // "BASIC" - Deprecated
  6305. // "FULL" - Deprecated
  6306. func (c *FilesGetCall) Projection(projection string) *FilesGetCall {
  6307. c.urlParams_.Set("projection", projection)
  6308. return c
  6309. }
  6310. // RevisionId sets the optional parameter "revisionId": Specifies the
  6311. // Revision ID that should be downloaded. Ignored unless alt=media is
  6312. // specified.
  6313. func (c *FilesGetCall) RevisionId(revisionId string) *FilesGetCall {
  6314. c.urlParams_.Set("revisionId", revisionId)
  6315. return c
  6316. }
  6317. // SupportsTeamDrives sets the optional parameter "supportsTeamDrives":
  6318. // Whether the requesting application supports Team Drives.
  6319. func (c *FilesGetCall) SupportsTeamDrives(supportsTeamDrives bool) *FilesGetCall {
  6320. c.urlParams_.Set("supportsTeamDrives", fmt.Sprint(supportsTeamDrives))
  6321. return c
  6322. }
  6323. // UpdateViewedDate sets the optional parameter "updateViewedDate":
  6324. // Deprecated: Use files.update with modifiedDateBehavior=noChange,
  6325. // updateViewedDate=true and an empty request body.
  6326. func (c *FilesGetCall) UpdateViewedDate(updateViewedDate bool) *FilesGetCall {
  6327. c.urlParams_.Set("updateViewedDate", fmt.Sprint(updateViewedDate))
  6328. return c
  6329. }
  6330. // Fields allows partial responses to be retrieved. See
  6331. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  6332. // for more information.
  6333. func (c *FilesGetCall) Fields(s ...googleapi.Field) *FilesGetCall {
  6334. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  6335. return c
  6336. }
  6337. // IfNoneMatch sets the optional parameter which makes the operation
  6338. // fail if the object's ETag matches the given value. This is useful for
  6339. // getting updates only after the object has changed since the last
  6340. // request. Use googleapi.IsNotModified to check whether the response
  6341. // error from Do is the result of In-None-Match.
  6342. func (c *FilesGetCall) IfNoneMatch(entityTag string) *FilesGetCall {
  6343. c.ifNoneMatch_ = entityTag
  6344. return c
  6345. }
  6346. // Context sets the context to be used in this call's Do and Download
  6347. // methods. Any pending HTTP request will be aborted if the provided
  6348. // context is canceled.
  6349. func (c *FilesGetCall) Context(ctx context.Context) *FilesGetCall {
  6350. c.ctx_ = ctx
  6351. return c
  6352. }
  6353. // Header returns an http.Header that can be modified by the caller to
  6354. // add HTTP headers to the request.
  6355. func (c *FilesGetCall) Header() http.Header {
  6356. if c.header_ == nil {
  6357. c.header_ = make(http.Header)
  6358. }
  6359. return c.header_
  6360. }
  6361. func (c *FilesGetCall) doRequest(alt string) (*http.Response, error) {
  6362. reqHeaders := make(http.Header)
  6363. for k, v := range c.header_ {
  6364. reqHeaders[k] = v
  6365. }
  6366. reqHeaders.Set("User-Agent", c.s.userAgent())
  6367. if c.ifNoneMatch_ != "" {
  6368. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  6369. }
  6370. var body io.Reader = nil
  6371. c.urlParams_.Set("alt", alt)
  6372. c.urlParams_.Set("prettyPrint", "false")
  6373. urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}")
  6374. urls += "?" + c.urlParams_.Encode()
  6375. req, err := http.NewRequest("GET", urls, body)
  6376. if err != nil {
  6377. return nil, err
  6378. }
  6379. req.Header = reqHeaders
  6380. googleapi.Expand(req.URL, map[string]string{
  6381. "fileId": c.fileId,
  6382. })
  6383. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  6384. }
  6385. // Download fetches the API endpoint's "media" value, instead of the normal
  6386. // API response value. If the returned error is nil, the Response is guaranteed to
  6387. // have a 2xx status code. Callers must close the Response.Body as usual.
  6388. func (c *FilesGetCall) Download(opts ...googleapi.CallOption) (*http.Response, error) {
  6389. gensupport.SetOptions(c.urlParams_, opts...)
  6390. res, err := c.doRequest("media")
  6391. if err != nil {
  6392. return nil, err
  6393. }
  6394. if err := googleapi.CheckMediaResponse(res); err != nil {
  6395. res.Body.Close()
  6396. return nil, err
  6397. }
  6398. return res, nil
  6399. }
  6400. // Do executes the "drive.files.get" call.
  6401. // Exactly one of *File or error will be non-nil. Any non-2xx status
  6402. // code is an error. Response headers are in either
  6403. // *File.ServerResponse.Header or (if a response was returned at all) in
  6404. // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  6405. // whether the returned error was because http.StatusNotModified was
  6406. // returned.
  6407. func (c *FilesGetCall) Do(opts ...googleapi.CallOption) (*File, error) {
  6408. gensupport.SetOptions(c.urlParams_, opts...)
  6409. res, err := c.doRequest("json")
  6410. if res != nil && res.StatusCode == http.StatusNotModified {
  6411. if res.Body != nil {
  6412. res.Body.Close()
  6413. }
  6414. return nil, &googleapi.Error{
  6415. Code: res.StatusCode,
  6416. Header: res.Header,
  6417. }
  6418. }
  6419. if err != nil {
  6420. return nil, err
  6421. }
  6422. defer googleapi.CloseBody(res)
  6423. if err := googleapi.CheckResponse(res); err != nil {
  6424. return nil, err
  6425. }
  6426. ret := &File{
  6427. ServerResponse: googleapi.ServerResponse{
  6428. Header: res.Header,
  6429. HTTPStatusCode: res.StatusCode,
  6430. },
  6431. }
  6432. target := &ret
  6433. if err := gensupport.DecodeResponse(target, res); err != nil {
  6434. return nil, err
  6435. }
  6436. return ret, nil
  6437. // {
  6438. // "description": "Gets a file's metadata by ID.",
  6439. // "httpMethod": "GET",
  6440. // "id": "drive.files.get",
  6441. // "parameterOrder": [
  6442. // "fileId"
  6443. // ],
  6444. // "parameters": {
  6445. // "acknowledgeAbuse": {
  6446. // "default": "false",
  6447. // "description": "Whether the user is acknowledging the risk of downloading known malware or other abusive files.",
  6448. // "location": "query",
  6449. // "type": "boolean"
  6450. // },
  6451. // "fileId": {
  6452. // "description": "The ID for the file in question.",
  6453. // "location": "path",
  6454. // "required": true,
  6455. // "type": "string"
  6456. // },
  6457. // "projection": {
  6458. // "description": "This parameter is deprecated and has no function.",
  6459. // "enum": [
  6460. // "BASIC",
  6461. // "FULL"
  6462. // ],
  6463. // "enumDescriptions": [
  6464. // "Deprecated",
  6465. // "Deprecated"
  6466. // ],
  6467. // "location": "query",
  6468. // "type": "string"
  6469. // },
  6470. // "revisionId": {
  6471. // "description": "Specifies the Revision ID that should be downloaded. Ignored unless alt=media is specified.",
  6472. // "location": "query",
  6473. // "type": "string"
  6474. // },
  6475. // "supportsTeamDrives": {
  6476. // "default": "false",
  6477. // "description": "Whether the requesting application supports Team Drives.",
  6478. // "location": "query",
  6479. // "type": "boolean"
  6480. // },
  6481. // "updateViewedDate": {
  6482. // "default": "false",
  6483. // "description": "Deprecated: Use files.update with modifiedDateBehavior=noChange, updateViewedDate=true and an empty request body.",
  6484. // "location": "query",
  6485. // "type": "boolean"
  6486. // }
  6487. // },
  6488. // "path": "files/{fileId}",
  6489. // "response": {
  6490. // "$ref": "File"
  6491. // },
  6492. // "scopes": [
  6493. // "https://www.googleapis.com/auth/drive",
  6494. // "https://www.googleapis.com/auth/drive.appdata",
  6495. // "https://www.googleapis.com/auth/drive.file",
  6496. // "https://www.googleapis.com/auth/drive.metadata",
  6497. // "https://www.googleapis.com/auth/drive.metadata.readonly",
  6498. // "https://www.googleapis.com/auth/drive.photos.readonly",
  6499. // "https://www.googleapis.com/auth/drive.readonly"
  6500. // ],
  6501. // "supportsMediaDownload": true,
  6502. // "supportsSubscription": true,
  6503. // "useMediaDownloadService": true
  6504. // }
  6505. }
  6506. // method id "drive.files.insert":
  6507. type FilesInsertCall struct {
  6508. s *Service
  6509. file *File
  6510. urlParams_ gensupport.URLParams
  6511. mediaInfo_ *gensupport.MediaInfo
  6512. ctx_ context.Context
  6513. header_ http.Header
  6514. }
  6515. // Insert: Insert a new file.
  6516. func (r *FilesService) Insert(file *File) *FilesInsertCall {
  6517. c := &FilesInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  6518. c.file = file
  6519. return c
  6520. }
  6521. // Convert sets the optional parameter "convert": Whether to convert
  6522. // this file to the corresponding Google Docs format.
  6523. func (c *FilesInsertCall) Convert(convert bool) *FilesInsertCall {
  6524. c.urlParams_.Set("convert", fmt.Sprint(convert))
  6525. return c
  6526. }
  6527. // Ocr sets the optional parameter "ocr": Whether to attempt OCR on
  6528. // .jpg, .png, .gif, or .pdf uploads.
  6529. func (c *FilesInsertCall) Ocr(ocr bool) *FilesInsertCall {
  6530. c.urlParams_.Set("ocr", fmt.Sprint(ocr))
  6531. return c
  6532. }
  6533. // OcrLanguage sets the optional parameter "ocrLanguage": If ocr is
  6534. // true, hints at the language to use. Valid values are BCP 47 codes.
  6535. func (c *FilesInsertCall) OcrLanguage(ocrLanguage string) *FilesInsertCall {
  6536. c.urlParams_.Set("ocrLanguage", ocrLanguage)
  6537. return c
  6538. }
  6539. // Pinned sets the optional parameter "pinned": Whether to pin the head
  6540. // revision of the uploaded file. A file can have a maximum of 200
  6541. // pinned revisions.
  6542. func (c *FilesInsertCall) Pinned(pinned bool) *FilesInsertCall {
  6543. c.urlParams_.Set("pinned", fmt.Sprint(pinned))
  6544. return c
  6545. }
  6546. // SupportsTeamDrives sets the optional parameter "supportsTeamDrives":
  6547. // Whether the requesting application supports Team Drives.
  6548. func (c *FilesInsertCall) SupportsTeamDrives(supportsTeamDrives bool) *FilesInsertCall {
  6549. c.urlParams_.Set("supportsTeamDrives", fmt.Sprint(supportsTeamDrives))
  6550. return c
  6551. }
  6552. // TimedTextLanguage sets the optional parameter "timedTextLanguage":
  6553. // The language of the timed text.
  6554. func (c *FilesInsertCall) TimedTextLanguage(timedTextLanguage string) *FilesInsertCall {
  6555. c.urlParams_.Set("timedTextLanguage", timedTextLanguage)
  6556. return c
  6557. }
  6558. // TimedTextTrackName sets the optional parameter "timedTextTrackName":
  6559. // The timed text track name.
  6560. func (c *FilesInsertCall) TimedTextTrackName(timedTextTrackName string) *FilesInsertCall {
  6561. c.urlParams_.Set("timedTextTrackName", timedTextTrackName)
  6562. return c
  6563. }
  6564. // UseContentAsIndexableText sets the optional parameter
  6565. // "useContentAsIndexableText": Whether to use the content as indexable
  6566. // text.
  6567. func (c *FilesInsertCall) UseContentAsIndexableText(useContentAsIndexableText bool) *FilesInsertCall {
  6568. c.urlParams_.Set("useContentAsIndexableText", fmt.Sprint(useContentAsIndexableText))
  6569. return c
  6570. }
  6571. // Visibility sets the optional parameter "visibility": The visibility
  6572. // of the new file. This parameter is only relevant when convert=false.
  6573. //
  6574. // Possible values:
  6575. // "DEFAULT" (default) - The visibility of the new file is determined
  6576. // by the user's default visibility/sharing policies.
  6577. // "PRIVATE" - The new file will be visible to only the owner.
  6578. func (c *FilesInsertCall) Visibility(visibility string) *FilesInsertCall {
  6579. c.urlParams_.Set("visibility", visibility)
  6580. return c
  6581. }
  6582. // Media specifies the media to upload in one or more chunks. The chunk
  6583. // size may be controlled by supplying a MediaOption generated by
  6584. // googleapi.ChunkSize. The chunk size defaults to
  6585. // googleapi.DefaultUploadChunkSize.The Content-Type header used in the
  6586. // upload request will be determined by sniffing the contents of r,
  6587. // unless a MediaOption generated by googleapi.ContentType is
  6588. // supplied.
  6589. // At most one of Media and ResumableMedia may be set.
  6590. func (c *FilesInsertCall) Media(r io.Reader, options ...googleapi.MediaOption) *FilesInsertCall {
  6591. c.mediaInfo_ = gensupport.NewInfoFromMedia(r, options)
  6592. return c
  6593. }
  6594. // ResumableMedia specifies the media to upload in chunks and can be
  6595. // canceled with ctx.
  6596. //
  6597. // Deprecated: use Media instead.
  6598. //
  6599. // At most one of Media and ResumableMedia may be set. mediaType
  6600. // identifies the MIME media type of the upload, such as "image/png". If
  6601. // mediaType is "", it will be auto-detected. The provided ctx will
  6602. // supersede any context previously provided to the Context method.
  6603. func (c *FilesInsertCall) ResumableMedia(ctx context.Context, r io.ReaderAt, size int64, mediaType string) *FilesInsertCall {
  6604. c.ctx_ = ctx
  6605. c.mediaInfo_ = gensupport.NewInfoFromResumableMedia(r, size, mediaType)
  6606. return c
  6607. }
  6608. // ProgressUpdater provides a callback function that will be called
  6609. // after every chunk. It should be a low-latency function in order to
  6610. // not slow down the upload operation. This should only be called when
  6611. // using ResumableMedia (as opposed to Media).
  6612. func (c *FilesInsertCall) ProgressUpdater(pu googleapi.ProgressUpdater) *FilesInsertCall {
  6613. c.mediaInfo_.SetProgressUpdater(pu)
  6614. return c
  6615. }
  6616. // Fields allows partial responses to be retrieved. See
  6617. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  6618. // for more information.
  6619. func (c *FilesInsertCall) Fields(s ...googleapi.Field) *FilesInsertCall {
  6620. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  6621. return c
  6622. }
  6623. // Context sets the context to be used in this call's Do method. Any
  6624. // pending HTTP request will be aborted if the provided context is
  6625. // canceled.
  6626. // This context will supersede any context previously provided to the
  6627. // ResumableMedia method.
  6628. func (c *FilesInsertCall) Context(ctx context.Context) *FilesInsertCall {
  6629. c.ctx_ = ctx
  6630. return c
  6631. }
  6632. // Header returns an http.Header that can be modified by the caller to
  6633. // add HTTP headers to the request.
  6634. func (c *FilesInsertCall) Header() http.Header {
  6635. if c.header_ == nil {
  6636. c.header_ = make(http.Header)
  6637. }
  6638. return c.header_
  6639. }
  6640. func (c *FilesInsertCall) doRequest(alt string) (*http.Response, error) {
  6641. reqHeaders := make(http.Header)
  6642. for k, v := range c.header_ {
  6643. reqHeaders[k] = v
  6644. }
  6645. reqHeaders.Set("User-Agent", c.s.userAgent())
  6646. var body io.Reader = nil
  6647. body, err := googleapi.WithoutDataWrapper.JSONReader(c.file)
  6648. if err != nil {
  6649. return nil, err
  6650. }
  6651. reqHeaders.Set("Content-Type", "application/json")
  6652. c.urlParams_.Set("alt", alt)
  6653. c.urlParams_.Set("prettyPrint", "false")
  6654. urls := googleapi.ResolveRelative(c.s.BasePath, "files")
  6655. if c.mediaInfo_ != nil {
  6656. urls = strings.Replace(urls, "https://www.googleapis.com/", "https://www.googleapis.com/upload/", 1)
  6657. c.urlParams_.Set("uploadType", c.mediaInfo_.UploadType())
  6658. }
  6659. if body == nil {
  6660. body = new(bytes.Buffer)
  6661. reqHeaders.Set("Content-Type", "application/json")
  6662. }
  6663. body, getBody, cleanup := c.mediaInfo_.UploadRequest(reqHeaders, body)
  6664. defer cleanup()
  6665. urls += "?" + c.urlParams_.Encode()
  6666. req, err := http.NewRequest("POST", urls, body)
  6667. if err != nil {
  6668. return nil, err
  6669. }
  6670. req.Header = reqHeaders
  6671. req.GetBody = getBody
  6672. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  6673. }
  6674. // Do executes the "drive.files.insert" call.
  6675. // Exactly one of *File or error will be non-nil. Any non-2xx status
  6676. // code is an error. Response headers are in either
  6677. // *File.ServerResponse.Header or (if a response was returned at all) in
  6678. // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  6679. // whether the returned error was because http.StatusNotModified was
  6680. // returned.
  6681. func (c *FilesInsertCall) Do(opts ...googleapi.CallOption) (*File, error) {
  6682. gensupport.SetOptions(c.urlParams_, opts...)
  6683. res, err := c.doRequest("json")
  6684. if res != nil && res.StatusCode == http.StatusNotModified {
  6685. if res.Body != nil {
  6686. res.Body.Close()
  6687. }
  6688. return nil, &googleapi.Error{
  6689. Code: res.StatusCode,
  6690. Header: res.Header,
  6691. }
  6692. }
  6693. if err != nil {
  6694. return nil, err
  6695. }
  6696. defer googleapi.CloseBody(res)
  6697. if err := googleapi.CheckResponse(res); err != nil {
  6698. return nil, err
  6699. }
  6700. rx := c.mediaInfo_.ResumableUpload(res.Header.Get("Location"))
  6701. if rx != nil {
  6702. rx.Client = c.s.client
  6703. rx.UserAgent = c.s.userAgent()
  6704. ctx := c.ctx_
  6705. if ctx == nil {
  6706. ctx = context.TODO()
  6707. }
  6708. res, err = rx.Upload(ctx)
  6709. if err != nil {
  6710. return nil, err
  6711. }
  6712. defer res.Body.Close()
  6713. if err := googleapi.CheckResponse(res); err != nil {
  6714. return nil, err
  6715. }
  6716. }
  6717. ret := &File{
  6718. ServerResponse: googleapi.ServerResponse{
  6719. Header: res.Header,
  6720. HTTPStatusCode: res.StatusCode,
  6721. },
  6722. }
  6723. target := &ret
  6724. if err := gensupport.DecodeResponse(target, res); err != nil {
  6725. return nil, err
  6726. }
  6727. return ret, nil
  6728. // {
  6729. // "description": "Insert a new file.",
  6730. // "httpMethod": "POST",
  6731. // "id": "drive.files.insert",
  6732. // "mediaUpload": {
  6733. // "accept": [
  6734. // "*/*"
  6735. // ],
  6736. // "maxSize": "5120GB",
  6737. // "protocols": {
  6738. // "resumable": {
  6739. // "multipart": true,
  6740. // "path": "/resumable/upload/drive/v2/files"
  6741. // },
  6742. // "simple": {
  6743. // "multipart": true,
  6744. // "path": "/upload/drive/v2/files"
  6745. // }
  6746. // }
  6747. // },
  6748. // "parameters": {
  6749. // "convert": {
  6750. // "default": "false",
  6751. // "description": "Whether to convert this file to the corresponding Google Docs format.",
  6752. // "location": "query",
  6753. // "type": "boolean"
  6754. // },
  6755. // "ocr": {
  6756. // "default": "false",
  6757. // "description": "Whether to attempt OCR on .jpg, .png, .gif, or .pdf uploads.",
  6758. // "location": "query",
  6759. // "type": "boolean"
  6760. // },
  6761. // "ocrLanguage": {
  6762. // "description": "If ocr is true, hints at the language to use. Valid values are BCP 47 codes.",
  6763. // "location": "query",
  6764. // "type": "string"
  6765. // },
  6766. // "pinned": {
  6767. // "default": "false",
  6768. // "description": "Whether to pin the head revision of the uploaded file. A file can have a maximum of 200 pinned revisions.",
  6769. // "location": "query",
  6770. // "type": "boolean"
  6771. // },
  6772. // "supportsTeamDrives": {
  6773. // "default": "false",
  6774. // "description": "Whether the requesting application supports Team Drives.",
  6775. // "location": "query",
  6776. // "type": "boolean"
  6777. // },
  6778. // "timedTextLanguage": {
  6779. // "description": "The language of the timed text.",
  6780. // "location": "query",
  6781. // "type": "string"
  6782. // },
  6783. // "timedTextTrackName": {
  6784. // "description": "The timed text track name.",
  6785. // "location": "query",
  6786. // "type": "string"
  6787. // },
  6788. // "useContentAsIndexableText": {
  6789. // "default": "false",
  6790. // "description": "Whether to use the content as indexable text.",
  6791. // "location": "query",
  6792. // "type": "boolean"
  6793. // },
  6794. // "visibility": {
  6795. // "default": "DEFAULT",
  6796. // "description": "The visibility of the new file. This parameter is only relevant when convert=false.",
  6797. // "enum": [
  6798. // "DEFAULT",
  6799. // "PRIVATE"
  6800. // ],
  6801. // "enumDescriptions": [
  6802. // "The visibility of the new file is determined by the user's default visibility/sharing policies.",
  6803. // "The new file will be visible to only the owner."
  6804. // ],
  6805. // "location": "query",
  6806. // "type": "string"
  6807. // }
  6808. // },
  6809. // "path": "files",
  6810. // "request": {
  6811. // "$ref": "File"
  6812. // },
  6813. // "response": {
  6814. // "$ref": "File"
  6815. // },
  6816. // "scopes": [
  6817. // "https://www.googleapis.com/auth/drive",
  6818. // "https://www.googleapis.com/auth/drive.appdata",
  6819. // "https://www.googleapis.com/auth/drive.apps.readonly",
  6820. // "https://www.googleapis.com/auth/drive.file"
  6821. // ],
  6822. // "supportsMediaUpload": true,
  6823. // "supportsSubscription": true
  6824. // }
  6825. }
  6826. // method id "drive.files.list":
  6827. type FilesListCall struct {
  6828. s *Service
  6829. urlParams_ gensupport.URLParams
  6830. ifNoneMatch_ string
  6831. ctx_ context.Context
  6832. header_ http.Header
  6833. }
  6834. // List: Lists the user's files.
  6835. func (r *FilesService) List() *FilesListCall {
  6836. c := &FilesListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  6837. return c
  6838. }
  6839. // Corpora sets the optional parameter "corpora": Comma-separated list
  6840. // of bodies of items (files/documents) to which the query applies.
  6841. // Supported bodies are 'default', 'domain', 'teamDrive' and
  6842. // 'allTeamDrives'. 'allTeamDrives' must be combined with 'default'; all
  6843. // other values must be used in isolation. Prefer 'default' or
  6844. // 'teamDrive' to 'allTeamDrives' for efficiency.
  6845. func (c *FilesListCall) Corpora(corpora string) *FilesListCall {
  6846. c.urlParams_.Set("corpora", corpora)
  6847. return c
  6848. }
  6849. // Corpus sets the optional parameter "corpus": The body of items
  6850. // (files/documents) to which the query applies. Deprecated: use
  6851. // 'corpora' instead.
  6852. //
  6853. // Possible values:
  6854. // "DEFAULT" - The items that the user has accessed.
  6855. // "DOMAIN" - Items shared to the user's domain.
  6856. func (c *FilesListCall) Corpus(corpus string) *FilesListCall {
  6857. c.urlParams_.Set("corpus", corpus)
  6858. return c
  6859. }
  6860. // IncludeTeamDriveItems sets the optional parameter
  6861. // "includeTeamDriveItems": Whether Team Drive items should be included
  6862. // in results.
  6863. func (c *FilesListCall) IncludeTeamDriveItems(includeTeamDriveItems bool) *FilesListCall {
  6864. c.urlParams_.Set("includeTeamDriveItems", fmt.Sprint(includeTeamDriveItems))
  6865. return c
  6866. }
  6867. // MaxResults sets the optional parameter "maxResults": The maximum
  6868. // number of files to return per page. Partial or empty result pages are
  6869. // possible even before the end of the files list has been reached.
  6870. func (c *FilesListCall) MaxResults(maxResults int64) *FilesListCall {
  6871. c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
  6872. return c
  6873. }
  6874. // OrderBy sets the optional parameter "orderBy": A comma-separated list
  6875. // of sort keys. Valid keys are 'createdDate', 'folder',
  6876. // 'lastViewedByMeDate', 'modifiedByMeDate', 'modifiedDate',
  6877. // 'quotaBytesUsed', 'recency', 'sharedWithMeDate', 'starred', 'title',
  6878. // and 'title_natural'. Each key sorts ascending by default, but may be
  6879. // reversed with the 'desc' modifier. Example usage:
  6880. // ?orderBy=folder,modifiedDate desc,title. Please note that there is a
  6881. // current limitation for users with approximately one million files in
  6882. // which the requested sort order is ignored.
  6883. func (c *FilesListCall) OrderBy(orderBy string) *FilesListCall {
  6884. c.urlParams_.Set("orderBy", orderBy)
  6885. return c
  6886. }
  6887. // PageToken sets the optional parameter "pageToken": Page token for
  6888. // files.
  6889. func (c *FilesListCall) PageToken(pageToken string) *FilesListCall {
  6890. c.urlParams_.Set("pageToken", pageToken)
  6891. return c
  6892. }
  6893. // Projection sets the optional parameter "projection": This parameter
  6894. // is deprecated and has no function.
  6895. //
  6896. // Possible values:
  6897. // "BASIC" - Deprecated
  6898. // "FULL" - Deprecated
  6899. func (c *FilesListCall) Projection(projection string) *FilesListCall {
  6900. c.urlParams_.Set("projection", projection)
  6901. return c
  6902. }
  6903. // Q sets the optional parameter "q": Query string for searching files.
  6904. func (c *FilesListCall) Q(q string) *FilesListCall {
  6905. c.urlParams_.Set("q", q)
  6906. return c
  6907. }
  6908. // Spaces sets the optional parameter "spaces": A comma-separated list
  6909. // of spaces to query. Supported values are 'drive', 'appDataFolder' and
  6910. // 'photos'.
  6911. func (c *FilesListCall) Spaces(spaces string) *FilesListCall {
  6912. c.urlParams_.Set("spaces", spaces)
  6913. return c
  6914. }
  6915. // SupportsTeamDrives sets the optional parameter "supportsTeamDrives":
  6916. // Whether the requesting application supports Team Drives.
  6917. func (c *FilesListCall) SupportsTeamDrives(supportsTeamDrives bool) *FilesListCall {
  6918. c.urlParams_.Set("supportsTeamDrives", fmt.Sprint(supportsTeamDrives))
  6919. return c
  6920. }
  6921. // TeamDriveId sets the optional parameter "teamDriveId": ID of Team
  6922. // Drive to search.
  6923. func (c *FilesListCall) TeamDriveId(teamDriveId string) *FilesListCall {
  6924. c.urlParams_.Set("teamDriveId", teamDriveId)
  6925. return c
  6926. }
  6927. // Fields allows partial responses to be retrieved. See
  6928. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  6929. // for more information.
  6930. func (c *FilesListCall) Fields(s ...googleapi.Field) *FilesListCall {
  6931. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  6932. return c
  6933. }
  6934. // IfNoneMatch sets the optional parameter which makes the operation
  6935. // fail if the object's ETag matches the given value. This is useful for
  6936. // getting updates only after the object has changed since the last
  6937. // request. Use googleapi.IsNotModified to check whether the response
  6938. // error from Do is the result of In-None-Match.
  6939. func (c *FilesListCall) IfNoneMatch(entityTag string) *FilesListCall {
  6940. c.ifNoneMatch_ = entityTag
  6941. return c
  6942. }
  6943. // Context sets the context to be used in this call's Do method. Any
  6944. // pending HTTP request will be aborted if the provided context is
  6945. // canceled.
  6946. func (c *FilesListCall) Context(ctx context.Context) *FilesListCall {
  6947. c.ctx_ = ctx
  6948. return c
  6949. }
  6950. // Header returns an http.Header that can be modified by the caller to
  6951. // add HTTP headers to the request.
  6952. func (c *FilesListCall) Header() http.Header {
  6953. if c.header_ == nil {
  6954. c.header_ = make(http.Header)
  6955. }
  6956. return c.header_
  6957. }
  6958. func (c *FilesListCall) doRequest(alt string) (*http.Response, error) {
  6959. reqHeaders := make(http.Header)
  6960. for k, v := range c.header_ {
  6961. reqHeaders[k] = v
  6962. }
  6963. reqHeaders.Set("User-Agent", c.s.userAgent())
  6964. if c.ifNoneMatch_ != "" {
  6965. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  6966. }
  6967. var body io.Reader = nil
  6968. c.urlParams_.Set("alt", alt)
  6969. c.urlParams_.Set("prettyPrint", "false")
  6970. urls := googleapi.ResolveRelative(c.s.BasePath, "files")
  6971. urls += "?" + c.urlParams_.Encode()
  6972. req, err := http.NewRequest("GET", urls, body)
  6973. if err != nil {
  6974. return nil, err
  6975. }
  6976. req.Header = reqHeaders
  6977. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  6978. }
  6979. // Do executes the "drive.files.list" call.
  6980. // Exactly one of *FileList or error will be non-nil. Any non-2xx status
  6981. // code is an error. Response headers are in either
  6982. // *FileList.ServerResponse.Header or (if a response was returned at
  6983. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  6984. // to check whether the returned error was because
  6985. // http.StatusNotModified was returned.
  6986. func (c *FilesListCall) Do(opts ...googleapi.CallOption) (*FileList, error) {
  6987. gensupport.SetOptions(c.urlParams_, opts...)
  6988. res, err := c.doRequest("json")
  6989. if res != nil && res.StatusCode == http.StatusNotModified {
  6990. if res.Body != nil {
  6991. res.Body.Close()
  6992. }
  6993. return nil, &googleapi.Error{
  6994. Code: res.StatusCode,
  6995. Header: res.Header,
  6996. }
  6997. }
  6998. if err != nil {
  6999. return nil, err
  7000. }
  7001. defer googleapi.CloseBody(res)
  7002. if err := googleapi.CheckResponse(res); err != nil {
  7003. return nil, err
  7004. }
  7005. ret := &FileList{
  7006. ServerResponse: googleapi.ServerResponse{
  7007. Header: res.Header,
  7008. HTTPStatusCode: res.StatusCode,
  7009. },
  7010. }
  7011. target := &ret
  7012. if err := gensupport.DecodeResponse(target, res); err != nil {
  7013. return nil, err
  7014. }
  7015. return ret, nil
  7016. // {
  7017. // "description": "Lists the user's files.",
  7018. // "httpMethod": "GET",
  7019. // "id": "drive.files.list",
  7020. // "parameters": {
  7021. // "corpora": {
  7022. // "description": "Comma-separated list of bodies of items (files/documents) to which the query applies. Supported bodies are 'default', 'domain', 'teamDrive' and 'allTeamDrives'. 'allTeamDrives' must be combined with 'default'; all other values must be used in isolation. Prefer 'default' or 'teamDrive' to 'allTeamDrives' for efficiency.",
  7023. // "location": "query",
  7024. // "type": "string"
  7025. // },
  7026. // "corpus": {
  7027. // "description": "The body of items (files/documents) to which the query applies. Deprecated: use 'corpora' instead.",
  7028. // "enum": [
  7029. // "DEFAULT",
  7030. // "DOMAIN"
  7031. // ],
  7032. // "enumDescriptions": [
  7033. // "The items that the user has accessed.",
  7034. // "Items shared to the user's domain."
  7035. // ],
  7036. // "location": "query",
  7037. // "type": "string"
  7038. // },
  7039. // "includeTeamDriveItems": {
  7040. // "default": "false",
  7041. // "description": "Whether Team Drive items should be included in results.",
  7042. // "location": "query",
  7043. // "type": "boolean"
  7044. // },
  7045. // "maxResults": {
  7046. // "default": "100",
  7047. // "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.",
  7048. // "format": "int32",
  7049. // "location": "query",
  7050. // "minimum": "0",
  7051. // "type": "integer"
  7052. // },
  7053. // "orderBy": {
  7054. // "description": "A comma-separated list of sort keys. Valid keys are 'createdDate', 'folder', 'lastViewedByMeDate', 'modifiedByMeDate', 'modifiedDate', 'quotaBytesUsed', 'recency', 'sharedWithMeDate', 'starred', 'title', and 'title_natural'. Each key sorts ascending by default, but may be reversed with the 'desc' modifier. Example usage: ?orderBy=folder,modifiedDate desc,title. Please note that there is a current limitation for users with approximately one million files in which the requested sort order is ignored.",
  7055. // "location": "query",
  7056. // "type": "string"
  7057. // },
  7058. // "pageToken": {
  7059. // "description": "Page token for files.",
  7060. // "location": "query",
  7061. // "type": "string"
  7062. // },
  7063. // "projection": {
  7064. // "description": "This parameter is deprecated and has no function.",
  7065. // "enum": [
  7066. // "BASIC",
  7067. // "FULL"
  7068. // ],
  7069. // "enumDescriptions": [
  7070. // "Deprecated",
  7071. // "Deprecated"
  7072. // ],
  7073. // "location": "query",
  7074. // "type": "string"
  7075. // },
  7076. // "q": {
  7077. // "description": "Query string for searching files.",
  7078. // "location": "query",
  7079. // "type": "string"
  7080. // },
  7081. // "spaces": {
  7082. // "description": "A comma-separated list of spaces to query. Supported values are 'drive', 'appDataFolder' and 'photos'.",
  7083. // "location": "query",
  7084. // "type": "string"
  7085. // },
  7086. // "supportsTeamDrives": {
  7087. // "default": "false",
  7088. // "description": "Whether the requesting application supports Team Drives.",
  7089. // "location": "query",
  7090. // "type": "boolean"
  7091. // },
  7092. // "teamDriveId": {
  7093. // "description": "ID of Team Drive to search.",
  7094. // "location": "query",
  7095. // "type": "string"
  7096. // }
  7097. // },
  7098. // "path": "files",
  7099. // "response": {
  7100. // "$ref": "FileList"
  7101. // },
  7102. // "scopes": [
  7103. // "https://www.googleapis.com/auth/drive",
  7104. // "https://www.googleapis.com/auth/drive.appdata",
  7105. // "https://www.googleapis.com/auth/drive.apps.readonly",
  7106. // "https://www.googleapis.com/auth/drive.file",
  7107. // "https://www.googleapis.com/auth/drive.metadata",
  7108. // "https://www.googleapis.com/auth/drive.metadata.readonly",
  7109. // "https://www.googleapis.com/auth/drive.photos.readonly",
  7110. // "https://www.googleapis.com/auth/drive.readonly"
  7111. // ]
  7112. // }
  7113. }
  7114. // Pages invokes f for each page of results.
  7115. // A non-nil error returned from f will halt the iteration.
  7116. // The provided context supersedes any context provided to the Context method.
  7117. func (c *FilesListCall) Pages(ctx context.Context, f func(*FileList) error) error {
  7118. c.ctx_ = ctx
  7119. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  7120. for {
  7121. x, err := c.Do()
  7122. if err != nil {
  7123. return err
  7124. }
  7125. if err := f(x); err != nil {
  7126. return err
  7127. }
  7128. if x.NextPageToken == "" {
  7129. return nil
  7130. }
  7131. c.PageToken(x.NextPageToken)
  7132. }
  7133. }
  7134. // method id "drive.files.patch":
  7135. type FilesPatchCall struct {
  7136. s *Service
  7137. fileId string
  7138. file *File
  7139. urlParams_ gensupport.URLParams
  7140. ctx_ context.Context
  7141. header_ http.Header
  7142. }
  7143. // Patch: Updates file metadata and/or content. This method supports
  7144. // patch semantics.
  7145. func (r *FilesService) Patch(fileId string, file *File) *FilesPatchCall {
  7146. c := &FilesPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  7147. c.fileId = fileId
  7148. c.file = file
  7149. return c
  7150. }
  7151. // AddParents sets the optional parameter "addParents": Comma-separated
  7152. // list of parent IDs to add.
  7153. func (c *FilesPatchCall) AddParents(addParents string) *FilesPatchCall {
  7154. c.urlParams_.Set("addParents", addParents)
  7155. return c
  7156. }
  7157. // Convert sets the optional parameter "convert": This parameter is
  7158. // deprecated and has no function.
  7159. func (c *FilesPatchCall) Convert(convert bool) *FilesPatchCall {
  7160. c.urlParams_.Set("convert", fmt.Sprint(convert))
  7161. return c
  7162. }
  7163. // ModifiedDateBehavior sets the optional parameter
  7164. // "modifiedDateBehavior": Determines the behavior in which modifiedDate
  7165. // is updated. This overrides setModifiedDate.
  7166. //
  7167. // Possible values:
  7168. // "fromBody" - Set modifiedDate to the value provided in the body of
  7169. // the request. No change if no value was provided.
  7170. // "fromBodyIfNeeded" - Set modifiedDate to the value provided in the
  7171. // body of the request depending on other contents of the update.
  7172. // "fromBodyOrNow" - Set modifiedDate to the value provided in the
  7173. // body of the request, or to the current time if no value was provided.
  7174. // "noChange" - Maintain the previous value of modifiedDate.
  7175. // "now" - Set modifiedDate to the current time.
  7176. // "nowIfNeeded" - Set modifiedDate to the current time depending on
  7177. // contents of the update.
  7178. func (c *FilesPatchCall) ModifiedDateBehavior(modifiedDateBehavior string) *FilesPatchCall {
  7179. c.urlParams_.Set("modifiedDateBehavior", modifiedDateBehavior)
  7180. return c
  7181. }
  7182. // NewRevision sets the optional parameter "newRevision": Whether a blob
  7183. // upload should create a new revision. If false, the blob data in the
  7184. // current head revision is replaced. If true or not set, a new blob is
  7185. // created as head revision, and previous unpinned revisions are
  7186. // preserved for a short period of time. Pinned revisions are stored
  7187. // indefinitely, using additional storage quota, up to a maximum of 200
  7188. // revisions. For details on how revisions are retained, see the Drive
  7189. // Help Center.
  7190. func (c *FilesPatchCall) NewRevision(newRevision bool) *FilesPatchCall {
  7191. c.urlParams_.Set("newRevision", fmt.Sprint(newRevision))
  7192. return c
  7193. }
  7194. // Ocr sets the optional parameter "ocr": Whether to attempt OCR on
  7195. // .jpg, .png, .gif, or .pdf uploads.
  7196. func (c *FilesPatchCall) Ocr(ocr bool) *FilesPatchCall {
  7197. c.urlParams_.Set("ocr", fmt.Sprint(ocr))
  7198. return c
  7199. }
  7200. // OcrLanguage sets the optional parameter "ocrLanguage": If ocr is
  7201. // true, hints at the language to use. Valid values are BCP 47 codes.
  7202. func (c *FilesPatchCall) OcrLanguage(ocrLanguage string) *FilesPatchCall {
  7203. c.urlParams_.Set("ocrLanguage", ocrLanguage)
  7204. return c
  7205. }
  7206. // Pinned sets the optional parameter "pinned": Whether to pin the new
  7207. // revision. A file can have a maximum of 200 pinned revisions.
  7208. func (c *FilesPatchCall) Pinned(pinned bool) *FilesPatchCall {
  7209. c.urlParams_.Set("pinned", fmt.Sprint(pinned))
  7210. return c
  7211. }
  7212. // RemoveParents sets the optional parameter "removeParents":
  7213. // Comma-separated list of parent IDs to remove.
  7214. func (c *FilesPatchCall) RemoveParents(removeParents string) *FilesPatchCall {
  7215. c.urlParams_.Set("removeParents", removeParents)
  7216. return c
  7217. }
  7218. // SetModifiedDate sets the optional parameter "setModifiedDate":
  7219. // Whether to set the modified date using the value supplied in the
  7220. // request body. Setting this field to true is equivalent to
  7221. // modifiedDateBehavior=fromBodyOrNow, and false is equivalent to
  7222. // modifiedDateBehavior=now. To prevent any changes to the modified date
  7223. // set modifiedDateBehavior=noChange.
  7224. func (c *FilesPatchCall) SetModifiedDate(setModifiedDate bool) *FilesPatchCall {
  7225. c.urlParams_.Set("setModifiedDate", fmt.Sprint(setModifiedDate))
  7226. return c
  7227. }
  7228. // SupportsTeamDrives sets the optional parameter "supportsTeamDrives":
  7229. // Whether the requesting application supports Team Drives.
  7230. func (c *FilesPatchCall) SupportsTeamDrives(supportsTeamDrives bool) *FilesPatchCall {
  7231. c.urlParams_.Set("supportsTeamDrives", fmt.Sprint(supportsTeamDrives))
  7232. return c
  7233. }
  7234. // TimedTextLanguage sets the optional parameter "timedTextLanguage":
  7235. // The language of the timed text.
  7236. func (c *FilesPatchCall) TimedTextLanguage(timedTextLanguage string) *FilesPatchCall {
  7237. c.urlParams_.Set("timedTextLanguage", timedTextLanguage)
  7238. return c
  7239. }
  7240. // TimedTextTrackName sets the optional parameter "timedTextTrackName":
  7241. // The timed text track name.
  7242. func (c *FilesPatchCall) TimedTextTrackName(timedTextTrackName string) *FilesPatchCall {
  7243. c.urlParams_.Set("timedTextTrackName", timedTextTrackName)
  7244. return c
  7245. }
  7246. // UpdateViewedDate sets the optional parameter "updateViewedDate":
  7247. // Whether to update the view date after successfully updating the file.
  7248. func (c *FilesPatchCall) UpdateViewedDate(updateViewedDate bool) *FilesPatchCall {
  7249. c.urlParams_.Set("updateViewedDate", fmt.Sprint(updateViewedDate))
  7250. return c
  7251. }
  7252. // UseContentAsIndexableText sets the optional parameter
  7253. // "useContentAsIndexableText": Whether to use the content as indexable
  7254. // text.
  7255. func (c *FilesPatchCall) UseContentAsIndexableText(useContentAsIndexableText bool) *FilesPatchCall {
  7256. c.urlParams_.Set("useContentAsIndexableText", fmt.Sprint(useContentAsIndexableText))
  7257. return c
  7258. }
  7259. // Fields allows partial responses to be retrieved. See
  7260. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  7261. // for more information.
  7262. func (c *FilesPatchCall) Fields(s ...googleapi.Field) *FilesPatchCall {
  7263. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  7264. return c
  7265. }
  7266. // Context sets the context to be used in this call's Do method. Any
  7267. // pending HTTP request will be aborted if the provided context is
  7268. // canceled.
  7269. func (c *FilesPatchCall) Context(ctx context.Context) *FilesPatchCall {
  7270. c.ctx_ = ctx
  7271. return c
  7272. }
  7273. // Header returns an http.Header that can be modified by the caller to
  7274. // add HTTP headers to the request.
  7275. func (c *FilesPatchCall) Header() http.Header {
  7276. if c.header_ == nil {
  7277. c.header_ = make(http.Header)
  7278. }
  7279. return c.header_
  7280. }
  7281. func (c *FilesPatchCall) doRequest(alt string) (*http.Response, error) {
  7282. reqHeaders := make(http.Header)
  7283. for k, v := range c.header_ {
  7284. reqHeaders[k] = v
  7285. }
  7286. reqHeaders.Set("User-Agent", c.s.userAgent())
  7287. var body io.Reader = nil
  7288. body, err := googleapi.WithoutDataWrapper.JSONReader(c.file)
  7289. if err != nil {
  7290. return nil, err
  7291. }
  7292. reqHeaders.Set("Content-Type", "application/json")
  7293. c.urlParams_.Set("alt", alt)
  7294. c.urlParams_.Set("prettyPrint", "false")
  7295. urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}")
  7296. urls += "?" + c.urlParams_.Encode()
  7297. req, err := http.NewRequest("PATCH", urls, body)
  7298. if err != nil {
  7299. return nil, err
  7300. }
  7301. req.Header = reqHeaders
  7302. googleapi.Expand(req.URL, map[string]string{
  7303. "fileId": c.fileId,
  7304. })
  7305. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  7306. }
  7307. // Do executes the "drive.files.patch" call.
  7308. // Exactly one of *File or error will be non-nil. Any non-2xx status
  7309. // code is an error. Response headers are in either
  7310. // *File.ServerResponse.Header or (if a response was returned at all) in
  7311. // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  7312. // whether the returned error was because http.StatusNotModified was
  7313. // returned.
  7314. func (c *FilesPatchCall) Do(opts ...googleapi.CallOption) (*File, error) {
  7315. gensupport.SetOptions(c.urlParams_, opts...)
  7316. res, err := c.doRequest("json")
  7317. if res != nil && res.StatusCode == http.StatusNotModified {
  7318. if res.Body != nil {
  7319. res.Body.Close()
  7320. }
  7321. return nil, &googleapi.Error{
  7322. Code: res.StatusCode,
  7323. Header: res.Header,
  7324. }
  7325. }
  7326. if err != nil {
  7327. return nil, err
  7328. }
  7329. defer googleapi.CloseBody(res)
  7330. if err := googleapi.CheckResponse(res); err != nil {
  7331. return nil, err
  7332. }
  7333. ret := &File{
  7334. ServerResponse: googleapi.ServerResponse{
  7335. Header: res.Header,
  7336. HTTPStatusCode: res.StatusCode,
  7337. },
  7338. }
  7339. target := &ret
  7340. if err := gensupport.DecodeResponse(target, res); err != nil {
  7341. return nil, err
  7342. }
  7343. return ret, nil
  7344. // {
  7345. // "description": "Updates file metadata and/or content. This method supports patch semantics.",
  7346. // "httpMethod": "PATCH",
  7347. // "id": "drive.files.patch",
  7348. // "parameterOrder": [
  7349. // "fileId"
  7350. // ],
  7351. // "parameters": {
  7352. // "addParents": {
  7353. // "description": "Comma-separated list of parent IDs to add.",
  7354. // "location": "query",
  7355. // "type": "string"
  7356. // },
  7357. // "convert": {
  7358. // "default": "false",
  7359. // "description": "This parameter is deprecated and has no function.",
  7360. // "location": "query",
  7361. // "type": "boolean"
  7362. // },
  7363. // "fileId": {
  7364. // "description": "The ID of the file to update.",
  7365. // "location": "path",
  7366. // "required": true,
  7367. // "type": "string"
  7368. // },
  7369. // "modifiedDateBehavior": {
  7370. // "description": "Determines the behavior in which modifiedDate is updated. This overrides setModifiedDate.",
  7371. // "enum": [
  7372. // "fromBody",
  7373. // "fromBodyIfNeeded",
  7374. // "fromBodyOrNow",
  7375. // "noChange",
  7376. // "now",
  7377. // "nowIfNeeded"
  7378. // ],
  7379. // "enumDescriptions": [
  7380. // "Set modifiedDate to the value provided in the body of the request. No change if no value was provided.",
  7381. // "Set modifiedDate to the value provided in the body of the request depending on other contents of the update.",
  7382. // "Set modifiedDate to the value provided in the body of the request, or to the current time if no value was provided.",
  7383. // "Maintain the previous value of modifiedDate.",
  7384. // "Set modifiedDate to the current time.",
  7385. // "Set modifiedDate to the current time depending on contents of the update."
  7386. // ],
  7387. // "location": "query",
  7388. // "type": "string"
  7389. // },
  7390. // "newRevision": {
  7391. // "default": "true",
  7392. // "description": "Whether a blob upload should create a new revision. If false, the blob data in the current head revision is replaced. If true or not set, a new blob is created as head revision, and previous unpinned revisions are preserved for a short period of time. Pinned revisions are stored indefinitely, using additional storage quota, up to a maximum of 200 revisions. For details on how revisions are retained, see the Drive Help Center.",
  7393. // "location": "query",
  7394. // "type": "boolean"
  7395. // },
  7396. // "ocr": {
  7397. // "default": "false",
  7398. // "description": "Whether to attempt OCR on .jpg, .png, .gif, or .pdf uploads.",
  7399. // "location": "query",
  7400. // "type": "boolean"
  7401. // },
  7402. // "ocrLanguage": {
  7403. // "description": "If ocr is true, hints at the language to use. Valid values are BCP 47 codes.",
  7404. // "location": "query",
  7405. // "type": "string"
  7406. // },
  7407. // "pinned": {
  7408. // "default": "false",
  7409. // "description": "Whether to pin the new revision. A file can have a maximum of 200 pinned revisions.",
  7410. // "location": "query",
  7411. // "type": "boolean"
  7412. // },
  7413. // "removeParents": {
  7414. // "description": "Comma-separated list of parent IDs to remove.",
  7415. // "location": "query",
  7416. // "type": "string"
  7417. // },
  7418. // "setModifiedDate": {
  7419. // "default": "false",
  7420. // "description": "Whether to set the modified date using the value supplied in the request body. Setting this field to true is equivalent to modifiedDateBehavior=fromBodyOrNow, and false is equivalent to modifiedDateBehavior=now. To prevent any changes to the modified date set modifiedDateBehavior=noChange.",
  7421. // "location": "query",
  7422. // "type": "boolean"
  7423. // },
  7424. // "supportsTeamDrives": {
  7425. // "default": "false",
  7426. // "description": "Whether the requesting application supports Team Drives.",
  7427. // "location": "query",
  7428. // "type": "boolean"
  7429. // },
  7430. // "timedTextLanguage": {
  7431. // "description": "The language of the timed text.",
  7432. // "location": "query",
  7433. // "type": "string"
  7434. // },
  7435. // "timedTextTrackName": {
  7436. // "description": "The timed text track name.",
  7437. // "location": "query",
  7438. // "type": "string"
  7439. // },
  7440. // "updateViewedDate": {
  7441. // "default": "true",
  7442. // "description": "Whether to update the view date after successfully updating the file.",
  7443. // "location": "query",
  7444. // "type": "boolean"
  7445. // },
  7446. // "useContentAsIndexableText": {
  7447. // "default": "false",
  7448. // "description": "Whether to use the content as indexable text.",
  7449. // "location": "query",
  7450. // "type": "boolean"
  7451. // }
  7452. // },
  7453. // "path": "files/{fileId}",
  7454. // "request": {
  7455. // "$ref": "File"
  7456. // },
  7457. // "response": {
  7458. // "$ref": "File"
  7459. // },
  7460. // "scopes": [
  7461. // "https://www.googleapis.com/auth/drive",
  7462. // "https://www.googleapis.com/auth/drive.appdata",
  7463. // "https://www.googleapis.com/auth/drive.apps.readonly",
  7464. // "https://www.googleapis.com/auth/drive.file",
  7465. // "https://www.googleapis.com/auth/drive.metadata",
  7466. // "https://www.googleapis.com/auth/drive.scripts"
  7467. // ]
  7468. // }
  7469. }
  7470. // method id "drive.files.touch":
  7471. type FilesTouchCall struct {
  7472. s *Service
  7473. fileId string
  7474. urlParams_ gensupport.URLParams
  7475. ctx_ context.Context
  7476. header_ http.Header
  7477. }
  7478. // Touch: Set the file's updated time to the current server time.
  7479. func (r *FilesService) Touch(fileId string) *FilesTouchCall {
  7480. c := &FilesTouchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  7481. c.fileId = fileId
  7482. return c
  7483. }
  7484. // SupportsTeamDrives sets the optional parameter "supportsTeamDrives":
  7485. // Whether the requesting application supports Team Drives.
  7486. func (c *FilesTouchCall) SupportsTeamDrives(supportsTeamDrives bool) *FilesTouchCall {
  7487. c.urlParams_.Set("supportsTeamDrives", fmt.Sprint(supportsTeamDrives))
  7488. return c
  7489. }
  7490. // Fields allows partial responses to be retrieved. See
  7491. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  7492. // for more information.
  7493. func (c *FilesTouchCall) Fields(s ...googleapi.Field) *FilesTouchCall {
  7494. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  7495. return c
  7496. }
  7497. // Context sets the context to be used in this call's Do method. Any
  7498. // pending HTTP request will be aborted if the provided context is
  7499. // canceled.
  7500. func (c *FilesTouchCall) Context(ctx context.Context) *FilesTouchCall {
  7501. c.ctx_ = ctx
  7502. return c
  7503. }
  7504. // Header returns an http.Header that can be modified by the caller to
  7505. // add HTTP headers to the request.
  7506. func (c *FilesTouchCall) Header() http.Header {
  7507. if c.header_ == nil {
  7508. c.header_ = make(http.Header)
  7509. }
  7510. return c.header_
  7511. }
  7512. func (c *FilesTouchCall) doRequest(alt string) (*http.Response, error) {
  7513. reqHeaders := make(http.Header)
  7514. for k, v := range c.header_ {
  7515. reqHeaders[k] = v
  7516. }
  7517. reqHeaders.Set("User-Agent", c.s.userAgent())
  7518. var body io.Reader = nil
  7519. c.urlParams_.Set("alt", alt)
  7520. c.urlParams_.Set("prettyPrint", "false")
  7521. urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/touch")
  7522. urls += "?" + c.urlParams_.Encode()
  7523. req, err := http.NewRequest("POST", urls, body)
  7524. if err != nil {
  7525. return nil, err
  7526. }
  7527. req.Header = reqHeaders
  7528. googleapi.Expand(req.URL, map[string]string{
  7529. "fileId": c.fileId,
  7530. })
  7531. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  7532. }
  7533. // Do executes the "drive.files.touch" call.
  7534. // Exactly one of *File or error will be non-nil. Any non-2xx status
  7535. // code is an error. Response headers are in either
  7536. // *File.ServerResponse.Header or (if a response was returned at all) in
  7537. // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  7538. // whether the returned error was because http.StatusNotModified was
  7539. // returned.
  7540. func (c *FilesTouchCall) Do(opts ...googleapi.CallOption) (*File, error) {
  7541. gensupport.SetOptions(c.urlParams_, opts...)
  7542. res, err := c.doRequest("json")
  7543. if res != nil && res.StatusCode == http.StatusNotModified {
  7544. if res.Body != nil {
  7545. res.Body.Close()
  7546. }
  7547. return nil, &googleapi.Error{
  7548. Code: res.StatusCode,
  7549. Header: res.Header,
  7550. }
  7551. }
  7552. if err != nil {
  7553. return nil, err
  7554. }
  7555. defer googleapi.CloseBody(res)
  7556. if err := googleapi.CheckResponse(res); err != nil {
  7557. return nil, err
  7558. }
  7559. ret := &File{
  7560. ServerResponse: googleapi.ServerResponse{
  7561. Header: res.Header,
  7562. HTTPStatusCode: res.StatusCode,
  7563. },
  7564. }
  7565. target := &ret
  7566. if err := gensupport.DecodeResponse(target, res); err != nil {
  7567. return nil, err
  7568. }
  7569. return ret, nil
  7570. // {
  7571. // "description": "Set the file's updated time to the current server time.",
  7572. // "httpMethod": "POST",
  7573. // "id": "drive.files.touch",
  7574. // "parameterOrder": [
  7575. // "fileId"
  7576. // ],
  7577. // "parameters": {
  7578. // "fileId": {
  7579. // "description": "The ID of the file to update.",
  7580. // "location": "path",
  7581. // "required": true,
  7582. // "type": "string"
  7583. // },
  7584. // "supportsTeamDrives": {
  7585. // "default": "false",
  7586. // "description": "Whether the requesting application supports Team Drives.",
  7587. // "location": "query",
  7588. // "type": "boolean"
  7589. // }
  7590. // },
  7591. // "path": "files/{fileId}/touch",
  7592. // "response": {
  7593. // "$ref": "File"
  7594. // },
  7595. // "scopes": [
  7596. // "https://www.googleapis.com/auth/drive",
  7597. // "https://www.googleapis.com/auth/drive.appdata",
  7598. // "https://www.googleapis.com/auth/drive.apps.readonly",
  7599. // "https://www.googleapis.com/auth/drive.file",
  7600. // "https://www.googleapis.com/auth/drive.metadata"
  7601. // ]
  7602. // }
  7603. }
  7604. // method id "drive.files.trash":
  7605. type FilesTrashCall struct {
  7606. s *Service
  7607. fileId string
  7608. urlParams_ gensupport.URLParams
  7609. ctx_ context.Context
  7610. header_ http.Header
  7611. }
  7612. // Trash: Moves a file to the trash. The currently authenticated user
  7613. // must own the file or be at least a fileOrganizer on the parent for
  7614. // Team Drive files.
  7615. func (r *FilesService) Trash(fileId string) *FilesTrashCall {
  7616. c := &FilesTrashCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  7617. c.fileId = fileId
  7618. return c
  7619. }
  7620. // SupportsTeamDrives sets the optional parameter "supportsTeamDrives":
  7621. // Whether the requesting application supports Team Drives.
  7622. func (c *FilesTrashCall) SupportsTeamDrives(supportsTeamDrives bool) *FilesTrashCall {
  7623. c.urlParams_.Set("supportsTeamDrives", fmt.Sprint(supportsTeamDrives))
  7624. return c
  7625. }
  7626. // Fields allows partial responses to be retrieved. See
  7627. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  7628. // for more information.
  7629. func (c *FilesTrashCall) Fields(s ...googleapi.Field) *FilesTrashCall {
  7630. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  7631. return c
  7632. }
  7633. // Context sets the context to be used in this call's Do method. Any
  7634. // pending HTTP request will be aborted if the provided context is
  7635. // canceled.
  7636. func (c *FilesTrashCall) Context(ctx context.Context) *FilesTrashCall {
  7637. c.ctx_ = ctx
  7638. return c
  7639. }
  7640. // Header returns an http.Header that can be modified by the caller to
  7641. // add HTTP headers to the request.
  7642. func (c *FilesTrashCall) Header() http.Header {
  7643. if c.header_ == nil {
  7644. c.header_ = make(http.Header)
  7645. }
  7646. return c.header_
  7647. }
  7648. func (c *FilesTrashCall) doRequest(alt string) (*http.Response, error) {
  7649. reqHeaders := make(http.Header)
  7650. for k, v := range c.header_ {
  7651. reqHeaders[k] = v
  7652. }
  7653. reqHeaders.Set("User-Agent", c.s.userAgent())
  7654. var body io.Reader = nil
  7655. c.urlParams_.Set("alt", alt)
  7656. c.urlParams_.Set("prettyPrint", "false")
  7657. urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/trash")
  7658. urls += "?" + c.urlParams_.Encode()
  7659. req, err := http.NewRequest("POST", urls, body)
  7660. if err != nil {
  7661. return nil, err
  7662. }
  7663. req.Header = reqHeaders
  7664. googleapi.Expand(req.URL, map[string]string{
  7665. "fileId": c.fileId,
  7666. })
  7667. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  7668. }
  7669. // Do executes the "drive.files.trash" call.
  7670. // Exactly one of *File or error will be non-nil. Any non-2xx status
  7671. // code is an error. Response headers are in either
  7672. // *File.ServerResponse.Header or (if a response was returned at all) in
  7673. // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  7674. // whether the returned error was because http.StatusNotModified was
  7675. // returned.
  7676. func (c *FilesTrashCall) Do(opts ...googleapi.CallOption) (*File, error) {
  7677. gensupport.SetOptions(c.urlParams_, opts...)
  7678. res, err := c.doRequest("json")
  7679. if res != nil && res.StatusCode == http.StatusNotModified {
  7680. if res.Body != nil {
  7681. res.Body.Close()
  7682. }
  7683. return nil, &googleapi.Error{
  7684. Code: res.StatusCode,
  7685. Header: res.Header,
  7686. }
  7687. }
  7688. if err != nil {
  7689. return nil, err
  7690. }
  7691. defer googleapi.CloseBody(res)
  7692. if err := googleapi.CheckResponse(res); err != nil {
  7693. return nil, err
  7694. }
  7695. ret := &File{
  7696. ServerResponse: googleapi.ServerResponse{
  7697. Header: res.Header,
  7698. HTTPStatusCode: res.StatusCode,
  7699. },
  7700. }
  7701. target := &ret
  7702. if err := gensupport.DecodeResponse(target, res); err != nil {
  7703. return nil, err
  7704. }
  7705. return ret, nil
  7706. // {
  7707. // "description": "Moves a file to the trash. The currently authenticated user must own the file or be at least a fileOrganizer on the parent for Team Drive files.",
  7708. // "httpMethod": "POST",
  7709. // "id": "drive.files.trash",
  7710. // "parameterOrder": [
  7711. // "fileId"
  7712. // ],
  7713. // "parameters": {
  7714. // "fileId": {
  7715. // "description": "The ID of the file to trash.",
  7716. // "location": "path",
  7717. // "required": true,
  7718. // "type": "string"
  7719. // },
  7720. // "supportsTeamDrives": {
  7721. // "default": "false",
  7722. // "description": "Whether the requesting application supports Team Drives.",
  7723. // "location": "query",
  7724. // "type": "boolean"
  7725. // }
  7726. // },
  7727. // "path": "files/{fileId}/trash",
  7728. // "response": {
  7729. // "$ref": "File"
  7730. // },
  7731. // "scopes": [
  7732. // "https://www.googleapis.com/auth/drive",
  7733. // "https://www.googleapis.com/auth/drive.appdata",
  7734. // "https://www.googleapis.com/auth/drive.apps.readonly",
  7735. // "https://www.googleapis.com/auth/drive.file"
  7736. // ]
  7737. // }
  7738. }
  7739. // method id "drive.files.untrash":
  7740. type FilesUntrashCall struct {
  7741. s *Service
  7742. fileId string
  7743. urlParams_ gensupport.URLParams
  7744. ctx_ context.Context
  7745. header_ http.Header
  7746. }
  7747. // Untrash: Restores a file from the trash.
  7748. func (r *FilesService) Untrash(fileId string) *FilesUntrashCall {
  7749. c := &FilesUntrashCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  7750. c.fileId = fileId
  7751. return c
  7752. }
  7753. // SupportsTeamDrives sets the optional parameter "supportsTeamDrives":
  7754. // Whether the requesting application supports Team Drives.
  7755. func (c *FilesUntrashCall) SupportsTeamDrives(supportsTeamDrives bool) *FilesUntrashCall {
  7756. c.urlParams_.Set("supportsTeamDrives", fmt.Sprint(supportsTeamDrives))
  7757. return c
  7758. }
  7759. // Fields allows partial responses to be retrieved. See
  7760. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  7761. // for more information.
  7762. func (c *FilesUntrashCall) Fields(s ...googleapi.Field) *FilesUntrashCall {
  7763. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  7764. return c
  7765. }
  7766. // Context sets the context to be used in this call's Do method. Any
  7767. // pending HTTP request will be aborted if the provided context is
  7768. // canceled.
  7769. func (c *FilesUntrashCall) Context(ctx context.Context) *FilesUntrashCall {
  7770. c.ctx_ = ctx
  7771. return c
  7772. }
  7773. // Header returns an http.Header that can be modified by the caller to
  7774. // add HTTP headers to the request.
  7775. func (c *FilesUntrashCall) Header() http.Header {
  7776. if c.header_ == nil {
  7777. c.header_ = make(http.Header)
  7778. }
  7779. return c.header_
  7780. }
  7781. func (c *FilesUntrashCall) doRequest(alt string) (*http.Response, error) {
  7782. reqHeaders := make(http.Header)
  7783. for k, v := range c.header_ {
  7784. reqHeaders[k] = v
  7785. }
  7786. reqHeaders.Set("User-Agent", c.s.userAgent())
  7787. var body io.Reader = nil
  7788. c.urlParams_.Set("alt", alt)
  7789. c.urlParams_.Set("prettyPrint", "false")
  7790. urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/untrash")
  7791. urls += "?" + c.urlParams_.Encode()
  7792. req, err := http.NewRequest("POST", urls, body)
  7793. if err != nil {
  7794. return nil, err
  7795. }
  7796. req.Header = reqHeaders
  7797. googleapi.Expand(req.URL, map[string]string{
  7798. "fileId": c.fileId,
  7799. })
  7800. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  7801. }
  7802. // Do executes the "drive.files.untrash" call.
  7803. // Exactly one of *File or error will be non-nil. Any non-2xx status
  7804. // code is an error. Response headers are in either
  7805. // *File.ServerResponse.Header or (if a response was returned at all) in
  7806. // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  7807. // whether the returned error was because http.StatusNotModified was
  7808. // returned.
  7809. func (c *FilesUntrashCall) Do(opts ...googleapi.CallOption) (*File, error) {
  7810. gensupport.SetOptions(c.urlParams_, opts...)
  7811. res, err := c.doRequest("json")
  7812. if res != nil && res.StatusCode == http.StatusNotModified {
  7813. if res.Body != nil {
  7814. res.Body.Close()
  7815. }
  7816. return nil, &googleapi.Error{
  7817. Code: res.StatusCode,
  7818. Header: res.Header,
  7819. }
  7820. }
  7821. if err != nil {
  7822. return nil, err
  7823. }
  7824. defer googleapi.CloseBody(res)
  7825. if err := googleapi.CheckResponse(res); err != nil {
  7826. return nil, err
  7827. }
  7828. ret := &File{
  7829. ServerResponse: googleapi.ServerResponse{
  7830. Header: res.Header,
  7831. HTTPStatusCode: res.StatusCode,
  7832. },
  7833. }
  7834. target := &ret
  7835. if err := gensupport.DecodeResponse(target, res); err != nil {
  7836. return nil, err
  7837. }
  7838. return ret, nil
  7839. // {
  7840. // "description": "Restores a file from the trash.",
  7841. // "httpMethod": "POST",
  7842. // "id": "drive.files.untrash",
  7843. // "parameterOrder": [
  7844. // "fileId"
  7845. // ],
  7846. // "parameters": {
  7847. // "fileId": {
  7848. // "description": "The ID of the file to untrash.",
  7849. // "location": "path",
  7850. // "required": true,
  7851. // "type": "string"
  7852. // },
  7853. // "supportsTeamDrives": {
  7854. // "default": "false",
  7855. // "description": "Whether the requesting application supports Team Drives.",
  7856. // "location": "query",
  7857. // "type": "boolean"
  7858. // }
  7859. // },
  7860. // "path": "files/{fileId}/untrash",
  7861. // "response": {
  7862. // "$ref": "File"
  7863. // },
  7864. // "scopes": [
  7865. // "https://www.googleapis.com/auth/drive",
  7866. // "https://www.googleapis.com/auth/drive.appdata",
  7867. // "https://www.googleapis.com/auth/drive.apps.readonly",
  7868. // "https://www.googleapis.com/auth/drive.file"
  7869. // ]
  7870. // }
  7871. }
  7872. // method id "drive.files.update":
  7873. type FilesUpdateCall struct {
  7874. s *Service
  7875. fileId string
  7876. file *File
  7877. urlParams_ gensupport.URLParams
  7878. mediaInfo_ *gensupport.MediaInfo
  7879. ctx_ context.Context
  7880. header_ http.Header
  7881. }
  7882. // Update: Updates file metadata and/or content.
  7883. func (r *FilesService) Update(fileId string, file *File) *FilesUpdateCall {
  7884. c := &FilesUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  7885. c.fileId = fileId
  7886. c.file = file
  7887. return c
  7888. }
  7889. // AddParents sets the optional parameter "addParents": Comma-separated
  7890. // list of parent IDs to add.
  7891. func (c *FilesUpdateCall) AddParents(addParents string) *FilesUpdateCall {
  7892. c.urlParams_.Set("addParents", addParents)
  7893. return c
  7894. }
  7895. // Convert sets the optional parameter "convert": This parameter is
  7896. // deprecated and has no function.
  7897. func (c *FilesUpdateCall) Convert(convert bool) *FilesUpdateCall {
  7898. c.urlParams_.Set("convert", fmt.Sprint(convert))
  7899. return c
  7900. }
  7901. // ModifiedDateBehavior sets the optional parameter
  7902. // "modifiedDateBehavior": Determines the behavior in which modifiedDate
  7903. // is updated. This overrides setModifiedDate.
  7904. //
  7905. // Possible values:
  7906. // "fromBody" - Set modifiedDate to the value provided in the body of
  7907. // the request. No change if no value was provided.
  7908. // "fromBodyIfNeeded" - Set modifiedDate to the value provided in the
  7909. // body of the request depending on other contents of the update.
  7910. // "fromBodyOrNow" - Set modifiedDate to the value provided in the
  7911. // body of the request, or to the current time if no value was provided.
  7912. // "noChange" - Maintain the previous value of modifiedDate.
  7913. // "now" - Set modifiedDate to the current time.
  7914. // "nowIfNeeded" - Set modifiedDate to the current time depending on
  7915. // contents of the update.
  7916. func (c *FilesUpdateCall) ModifiedDateBehavior(modifiedDateBehavior string) *FilesUpdateCall {
  7917. c.urlParams_.Set("modifiedDateBehavior", modifiedDateBehavior)
  7918. return c
  7919. }
  7920. // NewRevision sets the optional parameter "newRevision": Whether a blob
  7921. // upload should create a new revision. If false, the blob data in the
  7922. // current head revision is replaced. If true or not set, a new blob is
  7923. // created as head revision, and previous unpinned revisions are
  7924. // preserved for a short period of time. Pinned revisions are stored
  7925. // indefinitely, using additional storage quota, up to a maximum of 200
  7926. // revisions. For details on how revisions are retained, see the Drive
  7927. // Help Center.
  7928. func (c *FilesUpdateCall) NewRevision(newRevision bool) *FilesUpdateCall {
  7929. c.urlParams_.Set("newRevision", fmt.Sprint(newRevision))
  7930. return c
  7931. }
  7932. // Ocr sets the optional parameter "ocr": Whether to attempt OCR on
  7933. // .jpg, .png, .gif, or .pdf uploads.
  7934. func (c *FilesUpdateCall) Ocr(ocr bool) *FilesUpdateCall {
  7935. c.urlParams_.Set("ocr", fmt.Sprint(ocr))
  7936. return c
  7937. }
  7938. // OcrLanguage sets the optional parameter "ocrLanguage": If ocr is
  7939. // true, hints at the language to use. Valid values are BCP 47 codes.
  7940. func (c *FilesUpdateCall) OcrLanguage(ocrLanguage string) *FilesUpdateCall {
  7941. c.urlParams_.Set("ocrLanguage", ocrLanguage)
  7942. return c
  7943. }
  7944. // Pinned sets the optional parameter "pinned": Whether to pin the new
  7945. // revision. A file can have a maximum of 200 pinned revisions.
  7946. func (c *FilesUpdateCall) Pinned(pinned bool) *FilesUpdateCall {
  7947. c.urlParams_.Set("pinned", fmt.Sprint(pinned))
  7948. return c
  7949. }
  7950. // RemoveParents sets the optional parameter "removeParents":
  7951. // Comma-separated list of parent IDs to remove.
  7952. func (c *FilesUpdateCall) RemoveParents(removeParents string) *FilesUpdateCall {
  7953. c.urlParams_.Set("removeParents", removeParents)
  7954. return c
  7955. }
  7956. // SetModifiedDate sets the optional parameter "setModifiedDate":
  7957. // Whether to set the modified date using the value supplied in the
  7958. // request body. Setting this field to true is equivalent to
  7959. // modifiedDateBehavior=fromBodyOrNow, and false is equivalent to
  7960. // modifiedDateBehavior=now. To prevent any changes to the modified date
  7961. // set modifiedDateBehavior=noChange.
  7962. func (c *FilesUpdateCall) SetModifiedDate(setModifiedDate bool) *FilesUpdateCall {
  7963. c.urlParams_.Set("setModifiedDate", fmt.Sprint(setModifiedDate))
  7964. return c
  7965. }
  7966. // SupportsTeamDrives sets the optional parameter "supportsTeamDrives":
  7967. // Whether the requesting application supports Team Drives.
  7968. func (c *FilesUpdateCall) SupportsTeamDrives(supportsTeamDrives bool) *FilesUpdateCall {
  7969. c.urlParams_.Set("supportsTeamDrives", fmt.Sprint(supportsTeamDrives))
  7970. return c
  7971. }
  7972. // TimedTextLanguage sets the optional parameter "timedTextLanguage":
  7973. // The language of the timed text.
  7974. func (c *FilesUpdateCall) TimedTextLanguage(timedTextLanguage string) *FilesUpdateCall {
  7975. c.urlParams_.Set("timedTextLanguage", timedTextLanguage)
  7976. return c
  7977. }
  7978. // TimedTextTrackName sets the optional parameter "timedTextTrackName":
  7979. // The timed text track name.
  7980. func (c *FilesUpdateCall) TimedTextTrackName(timedTextTrackName string) *FilesUpdateCall {
  7981. c.urlParams_.Set("timedTextTrackName", timedTextTrackName)
  7982. return c
  7983. }
  7984. // UpdateViewedDate sets the optional parameter "updateViewedDate":
  7985. // Whether to update the view date after successfully updating the file.
  7986. func (c *FilesUpdateCall) UpdateViewedDate(updateViewedDate bool) *FilesUpdateCall {
  7987. c.urlParams_.Set("updateViewedDate", fmt.Sprint(updateViewedDate))
  7988. return c
  7989. }
  7990. // UseContentAsIndexableText sets the optional parameter
  7991. // "useContentAsIndexableText": Whether to use the content as indexable
  7992. // text.
  7993. func (c *FilesUpdateCall) UseContentAsIndexableText(useContentAsIndexableText bool) *FilesUpdateCall {
  7994. c.urlParams_.Set("useContentAsIndexableText", fmt.Sprint(useContentAsIndexableText))
  7995. return c
  7996. }
  7997. // Media specifies the media to upload in one or more chunks. The chunk
  7998. // size may be controlled by supplying a MediaOption generated by
  7999. // googleapi.ChunkSize. The chunk size defaults to
  8000. // googleapi.DefaultUploadChunkSize.The Content-Type header used in the
  8001. // upload request will be determined by sniffing the contents of r,
  8002. // unless a MediaOption generated by googleapi.ContentType is
  8003. // supplied.
  8004. // At most one of Media and ResumableMedia may be set.
  8005. func (c *FilesUpdateCall) Media(r io.Reader, options ...googleapi.MediaOption) *FilesUpdateCall {
  8006. c.mediaInfo_ = gensupport.NewInfoFromMedia(r, options)
  8007. return c
  8008. }
  8009. // ResumableMedia specifies the media to upload in chunks and can be
  8010. // canceled with ctx.
  8011. //
  8012. // Deprecated: use Media instead.
  8013. //
  8014. // At most one of Media and ResumableMedia may be set. mediaType
  8015. // identifies the MIME media type of the upload, such as "image/png". If
  8016. // mediaType is "", it will be auto-detected. The provided ctx will
  8017. // supersede any context previously provided to the Context method.
  8018. func (c *FilesUpdateCall) ResumableMedia(ctx context.Context, r io.ReaderAt, size int64, mediaType string) *FilesUpdateCall {
  8019. c.ctx_ = ctx
  8020. c.mediaInfo_ = gensupport.NewInfoFromResumableMedia(r, size, mediaType)
  8021. return c
  8022. }
  8023. // ProgressUpdater provides a callback function that will be called
  8024. // after every chunk. It should be a low-latency function in order to
  8025. // not slow down the upload operation. This should only be called when
  8026. // using ResumableMedia (as opposed to Media).
  8027. func (c *FilesUpdateCall) ProgressUpdater(pu googleapi.ProgressUpdater) *FilesUpdateCall {
  8028. c.mediaInfo_.SetProgressUpdater(pu)
  8029. return c
  8030. }
  8031. // Fields allows partial responses to be retrieved. See
  8032. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  8033. // for more information.
  8034. func (c *FilesUpdateCall) Fields(s ...googleapi.Field) *FilesUpdateCall {
  8035. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  8036. return c
  8037. }
  8038. // Context sets the context to be used in this call's Do method. Any
  8039. // pending HTTP request will be aborted if the provided context is
  8040. // canceled.
  8041. // This context will supersede any context previously provided to the
  8042. // ResumableMedia method.
  8043. func (c *FilesUpdateCall) Context(ctx context.Context) *FilesUpdateCall {
  8044. c.ctx_ = ctx
  8045. return c
  8046. }
  8047. // Header returns an http.Header that can be modified by the caller to
  8048. // add HTTP headers to the request.
  8049. func (c *FilesUpdateCall) Header() http.Header {
  8050. if c.header_ == nil {
  8051. c.header_ = make(http.Header)
  8052. }
  8053. return c.header_
  8054. }
  8055. func (c *FilesUpdateCall) doRequest(alt string) (*http.Response, error) {
  8056. reqHeaders := make(http.Header)
  8057. for k, v := range c.header_ {
  8058. reqHeaders[k] = v
  8059. }
  8060. reqHeaders.Set("User-Agent", c.s.userAgent())
  8061. var body io.Reader = nil
  8062. body, err := googleapi.WithoutDataWrapper.JSONReader(c.file)
  8063. if err != nil {
  8064. return nil, err
  8065. }
  8066. reqHeaders.Set("Content-Type", "application/json")
  8067. c.urlParams_.Set("alt", alt)
  8068. c.urlParams_.Set("prettyPrint", "false")
  8069. urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}")
  8070. if c.mediaInfo_ != nil {
  8071. urls = strings.Replace(urls, "https://www.googleapis.com/", "https://www.googleapis.com/upload/", 1)
  8072. c.urlParams_.Set("uploadType", c.mediaInfo_.UploadType())
  8073. }
  8074. if body == nil {
  8075. body = new(bytes.Buffer)
  8076. reqHeaders.Set("Content-Type", "application/json")
  8077. }
  8078. body, getBody, cleanup := c.mediaInfo_.UploadRequest(reqHeaders, body)
  8079. defer cleanup()
  8080. urls += "?" + c.urlParams_.Encode()
  8081. req, err := http.NewRequest("PUT", urls, body)
  8082. if err != nil {
  8083. return nil, err
  8084. }
  8085. req.Header = reqHeaders
  8086. req.GetBody = getBody
  8087. googleapi.Expand(req.URL, map[string]string{
  8088. "fileId": c.fileId,
  8089. })
  8090. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  8091. }
  8092. // Do executes the "drive.files.update" call.
  8093. // Exactly one of *File or error will be non-nil. Any non-2xx status
  8094. // code is an error. Response headers are in either
  8095. // *File.ServerResponse.Header or (if a response was returned at all) in
  8096. // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  8097. // whether the returned error was because http.StatusNotModified was
  8098. // returned.
  8099. func (c *FilesUpdateCall) Do(opts ...googleapi.CallOption) (*File, error) {
  8100. gensupport.SetOptions(c.urlParams_, opts...)
  8101. res, err := c.doRequest("json")
  8102. if res != nil && res.StatusCode == http.StatusNotModified {
  8103. if res.Body != nil {
  8104. res.Body.Close()
  8105. }
  8106. return nil, &googleapi.Error{
  8107. Code: res.StatusCode,
  8108. Header: res.Header,
  8109. }
  8110. }
  8111. if err != nil {
  8112. return nil, err
  8113. }
  8114. defer googleapi.CloseBody(res)
  8115. if err := googleapi.CheckResponse(res); err != nil {
  8116. return nil, err
  8117. }
  8118. rx := c.mediaInfo_.ResumableUpload(res.Header.Get("Location"))
  8119. if rx != nil {
  8120. rx.Client = c.s.client
  8121. rx.UserAgent = c.s.userAgent()
  8122. ctx := c.ctx_
  8123. if ctx == nil {
  8124. ctx = context.TODO()
  8125. }
  8126. res, err = rx.Upload(ctx)
  8127. if err != nil {
  8128. return nil, err
  8129. }
  8130. defer res.Body.Close()
  8131. if err := googleapi.CheckResponse(res); err != nil {
  8132. return nil, err
  8133. }
  8134. }
  8135. ret := &File{
  8136. ServerResponse: googleapi.ServerResponse{
  8137. Header: res.Header,
  8138. HTTPStatusCode: res.StatusCode,
  8139. },
  8140. }
  8141. target := &ret
  8142. if err := gensupport.DecodeResponse(target, res); err != nil {
  8143. return nil, err
  8144. }
  8145. return ret, nil
  8146. // {
  8147. // "description": "Updates file metadata and/or content.",
  8148. // "httpMethod": "PUT",
  8149. // "id": "drive.files.update",
  8150. // "mediaUpload": {
  8151. // "accept": [
  8152. // "*/*"
  8153. // ],
  8154. // "maxSize": "5120GB",
  8155. // "protocols": {
  8156. // "resumable": {
  8157. // "multipart": true,
  8158. // "path": "/resumable/upload/drive/v2/files/{fileId}"
  8159. // },
  8160. // "simple": {
  8161. // "multipart": true,
  8162. // "path": "/upload/drive/v2/files/{fileId}"
  8163. // }
  8164. // }
  8165. // },
  8166. // "parameterOrder": [
  8167. // "fileId"
  8168. // ],
  8169. // "parameters": {
  8170. // "addParents": {
  8171. // "description": "Comma-separated list of parent IDs to add.",
  8172. // "location": "query",
  8173. // "type": "string"
  8174. // },
  8175. // "convert": {
  8176. // "default": "false",
  8177. // "description": "This parameter is deprecated and has no function.",
  8178. // "location": "query",
  8179. // "type": "boolean"
  8180. // },
  8181. // "fileId": {
  8182. // "description": "The ID of the file to update.",
  8183. // "location": "path",
  8184. // "required": true,
  8185. // "type": "string"
  8186. // },
  8187. // "modifiedDateBehavior": {
  8188. // "description": "Determines the behavior in which modifiedDate is updated. This overrides setModifiedDate.",
  8189. // "enum": [
  8190. // "fromBody",
  8191. // "fromBodyIfNeeded",
  8192. // "fromBodyOrNow",
  8193. // "noChange",
  8194. // "now",
  8195. // "nowIfNeeded"
  8196. // ],
  8197. // "enumDescriptions": [
  8198. // "Set modifiedDate to the value provided in the body of the request. No change if no value was provided.",
  8199. // "Set modifiedDate to the value provided in the body of the request depending on other contents of the update.",
  8200. // "Set modifiedDate to the value provided in the body of the request, or to the current time if no value was provided.",
  8201. // "Maintain the previous value of modifiedDate.",
  8202. // "Set modifiedDate to the current time.",
  8203. // "Set modifiedDate to the current time depending on contents of the update."
  8204. // ],
  8205. // "location": "query",
  8206. // "type": "string"
  8207. // },
  8208. // "newRevision": {
  8209. // "default": "true",
  8210. // "description": "Whether a blob upload should create a new revision. If false, the blob data in the current head revision is replaced. If true or not set, a new blob is created as head revision, and previous unpinned revisions are preserved for a short period of time. Pinned revisions are stored indefinitely, using additional storage quota, up to a maximum of 200 revisions. For details on how revisions are retained, see the Drive Help Center.",
  8211. // "location": "query",
  8212. // "type": "boolean"
  8213. // },
  8214. // "ocr": {
  8215. // "default": "false",
  8216. // "description": "Whether to attempt OCR on .jpg, .png, .gif, or .pdf uploads.",
  8217. // "location": "query",
  8218. // "type": "boolean"
  8219. // },
  8220. // "ocrLanguage": {
  8221. // "description": "If ocr is true, hints at the language to use. Valid values are BCP 47 codes.",
  8222. // "location": "query",
  8223. // "type": "string"
  8224. // },
  8225. // "pinned": {
  8226. // "default": "false",
  8227. // "description": "Whether to pin the new revision. A file can have a maximum of 200 pinned revisions.",
  8228. // "location": "query",
  8229. // "type": "boolean"
  8230. // },
  8231. // "removeParents": {
  8232. // "description": "Comma-separated list of parent IDs to remove.",
  8233. // "location": "query",
  8234. // "type": "string"
  8235. // },
  8236. // "setModifiedDate": {
  8237. // "default": "false",
  8238. // "description": "Whether to set the modified date using the value supplied in the request body. Setting this field to true is equivalent to modifiedDateBehavior=fromBodyOrNow, and false is equivalent to modifiedDateBehavior=now. To prevent any changes to the modified date set modifiedDateBehavior=noChange.",
  8239. // "location": "query",
  8240. // "type": "boolean"
  8241. // },
  8242. // "supportsTeamDrives": {
  8243. // "default": "false",
  8244. // "description": "Whether the requesting application supports Team Drives.",
  8245. // "location": "query",
  8246. // "type": "boolean"
  8247. // },
  8248. // "timedTextLanguage": {
  8249. // "description": "The language of the timed text.",
  8250. // "location": "query",
  8251. // "type": "string"
  8252. // },
  8253. // "timedTextTrackName": {
  8254. // "description": "The timed text track name.",
  8255. // "location": "query",
  8256. // "type": "string"
  8257. // },
  8258. // "updateViewedDate": {
  8259. // "default": "true",
  8260. // "description": "Whether to update the view date after successfully updating the file.",
  8261. // "location": "query",
  8262. // "type": "boolean"
  8263. // },
  8264. // "useContentAsIndexableText": {
  8265. // "default": "false",
  8266. // "description": "Whether to use the content as indexable text.",
  8267. // "location": "query",
  8268. // "type": "boolean"
  8269. // }
  8270. // },
  8271. // "path": "files/{fileId}",
  8272. // "request": {
  8273. // "$ref": "File"
  8274. // },
  8275. // "response": {
  8276. // "$ref": "File"
  8277. // },
  8278. // "scopes": [
  8279. // "https://www.googleapis.com/auth/drive",
  8280. // "https://www.googleapis.com/auth/drive.appdata",
  8281. // "https://www.googleapis.com/auth/drive.apps.readonly",
  8282. // "https://www.googleapis.com/auth/drive.file",
  8283. // "https://www.googleapis.com/auth/drive.metadata",
  8284. // "https://www.googleapis.com/auth/drive.scripts"
  8285. // ],
  8286. // "supportsMediaUpload": true
  8287. // }
  8288. }
  8289. // method id "drive.files.watch":
  8290. type FilesWatchCall struct {
  8291. s *Service
  8292. fileId string
  8293. channel *Channel
  8294. urlParams_ gensupport.URLParams
  8295. ctx_ context.Context
  8296. header_ http.Header
  8297. }
  8298. // Watch: Subscribe to changes on a file
  8299. func (r *FilesService) Watch(fileId string, channel *Channel) *FilesWatchCall {
  8300. c := &FilesWatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  8301. c.fileId = fileId
  8302. c.channel = channel
  8303. return c
  8304. }
  8305. // AcknowledgeAbuse sets the optional parameter "acknowledgeAbuse":
  8306. // Whether the user is acknowledging the risk of downloading known
  8307. // malware or other abusive files.
  8308. func (c *FilesWatchCall) AcknowledgeAbuse(acknowledgeAbuse bool) *FilesWatchCall {
  8309. c.urlParams_.Set("acknowledgeAbuse", fmt.Sprint(acknowledgeAbuse))
  8310. return c
  8311. }
  8312. // Projection sets the optional parameter "projection": This parameter
  8313. // is deprecated and has no function.
  8314. //
  8315. // Possible values:
  8316. // "BASIC" - Deprecated
  8317. // "FULL" - Deprecated
  8318. func (c *FilesWatchCall) Projection(projection string) *FilesWatchCall {
  8319. c.urlParams_.Set("projection", projection)
  8320. return c
  8321. }
  8322. // RevisionId sets the optional parameter "revisionId": Specifies the
  8323. // Revision ID that should be downloaded. Ignored unless alt=media is
  8324. // specified.
  8325. func (c *FilesWatchCall) RevisionId(revisionId string) *FilesWatchCall {
  8326. c.urlParams_.Set("revisionId", revisionId)
  8327. return c
  8328. }
  8329. // SupportsTeamDrives sets the optional parameter "supportsTeamDrives":
  8330. // Whether the requesting application supports Team Drives.
  8331. func (c *FilesWatchCall) SupportsTeamDrives(supportsTeamDrives bool) *FilesWatchCall {
  8332. c.urlParams_.Set("supportsTeamDrives", fmt.Sprint(supportsTeamDrives))
  8333. return c
  8334. }
  8335. // UpdateViewedDate sets the optional parameter "updateViewedDate":
  8336. // Deprecated: Use files.update with modifiedDateBehavior=noChange,
  8337. // updateViewedDate=true and an empty request body.
  8338. func (c *FilesWatchCall) UpdateViewedDate(updateViewedDate bool) *FilesWatchCall {
  8339. c.urlParams_.Set("updateViewedDate", fmt.Sprint(updateViewedDate))
  8340. return c
  8341. }
  8342. // Fields allows partial responses to be retrieved. See
  8343. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  8344. // for more information.
  8345. func (c *FilesWatchCall) Fields(s ...googleapi.Field) *FilesWatchCall {
  8346. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  8347. return c
  8348. }
  8349. // Context sets the context to be used in this call's Do and Download
  8350. // methods. Any pending HTTP request will be aborted if the provided
  8351. // context is canceled.
  8352. func (c *FilesWatchCall) Context(ctx context.Context) *FilesWatchCall {
  8353. c.ctx_ = ctx
  8354. return c
  8355. }
  8356. // Header returns an http.Header that can be modified by the caller to
  8357. // add HTTP headers to the request.
  8358. func (c *FilesWatchCall) Header() http.Header {
  8359. if c.header_ == nil {
  8360. c.header_ = make(http.Header)
  8361. }
  8362. return c.header_
  8363. }
  8364. func (c *FilesWatchCall) doRequest(alt string) (*http.Response, error) {
  8365. reqHeaders := make(http.Header)
  8366. for k, v := range c.header_ {
  8367. reqHeaders[k] = v
  8368. }
  8369. reqHeaders.Set("User-Agent", c.s.userAgent())
  8370. var body io.Reader = nil
  8371. body, err := googleapi.WithoutDataWrapper.JSONReader(c.channel)
  8372. if err != nil {
  8373. return nil, err
  8374. }
  8375. reqHeaders.Set("Content-Type", "application/json")
  8376. c.urlParams_.Set("alt", alt)
  8377. c.urlParams_.Set("prettyPrint", "false")
  8378. urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/watch")
  8379. urls += "?" + c.urlParams_.Encode()
  8380. req, err := http.NewRequest("POST", urls, body)
  8381. if err != nil {
  8382. return nil, err
  8383. }
  8384. req.Header = reqHeaders
  8385. googleapi.Expand(req.URL, map[string]string{
  8386. "fileId": c.fileId,
  8387. })
  8388. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  8389. }
  8390. // Download fetches the API endpoint's "media" value, instead of the normal
  8391. // API response value. If the returned error is nil, the Response is guaranteed to
  8392. // have a 2xx status code. Callers must close the Response.Body as usual.
  8393. func (c *FilesWatchCall) Download(opts ...googleapi.CallOption) (*http.Response, error) {
  8394. gensupport.SetOptions(c.urlParams_, opts...)
  8395. res, err := c.doRequest("media")
  8396. if err != nil {
  8397. return nil, err
  8398. }
  8399. if err := googleapi.CheckMediaResponse(res); err != nil {
  8400. res.Body.Close()
  8401. return nil, err
  8402. }
  8403. return res, nil
  8404. }
  8405. // Do executes the "drive.files.watch" call.
  8406. // Exactly one of *Channel or error will be non-nil. Any non-2xx status
  8407. // code is an error. Response headers are in either
  8408. // *Channel.ServerResponse.Header or (if a response was returned at all)
  8409. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  8410. // check whether the returned error was because http.StatusNotModified
  8411. // was returned.
  8412. func (c *FilesWatchCall) Do(opts ...googleapi.CallOption) (*Channel, error) {
  8413. gensupport.SetOptions(c.urlParams_, opts...)
  8414. res, err := c.doRequest("json")
  8415. if res != nil && res.StatusCode == http.StatusNotModified {
  8416. if res.Body != nil {
  8417. res.Body.Close()
  8418. }
  8419. return nil, &googleapi.Error{
  8420. Code: res.StatusCode,
  8421. Header: res.Header,
  8422. }
  8423. }
  8424. if err != nil {
  8425. return nil, err
  8426. }
  8427. defer googleapi.CloseBody(res)
  8428. if err := googleapi.CheckResponse(res); err != nil {
  8429. return nil, err
  8430. }
  8431. ret := &Channel{
  8432. ServerResponse: googleapi.ServerResponse{
  8433. Header: res.Header,
  8434. HTTPStatusCode: res.StatusCode,
  8435. },
  8436. }
  8437. target := &ret
  8438. if err := gensupport.DecodeResponse(target, res); err != nil {
  8439. return nil, err
  8440. }
  8441. return ret, nil
  8442. // {
  8443. // "description": "Subscribe to changes on a file",
  8444. // "httpMethod": "POST",
  8445. // "id": "drive.files.watch",
  8446. // "parameterOrder": [
  8447. // "fileId"
  8448. // ],
  8449. // "parameters": {
  8450. // "acknowledgeAbuse": {
  8451. // "default": "false",
  8452. // "description": "Whether the user is acknowledging the risk of downloading known malware or other abusive files.",
  8453. // "location": "query",
  8454. // "type": "boolean"
  8455. // },
  8456. // "fileId": {
  8457. // "description": "The ID for the file in question.",
  8458. // "location": "path",
  8459. // "required": true,
  8460. // "type": "string"
  8461. // },
  8462. // "projection": {
  8463. // "description": "This parameter is deprecated and has no function.",
  8464. // "enum": [
  8465. // "BASIC",
  8466. // "FULL"
  8467. // ],
  8468. // "enumDescriptions": [
  8469. // "Deprecated",
  8470. // "Deprecated"
  8471. // ],
  8472. // "location": "query",
  8473. // "type": "string"
  8474. // },
  8475. // "revisionId": {
  8476. // "description": "Specifies the Revision ID that should be downloaded. Ignored unless alt=media is specified.",
  8477. // "location": "query",
  8478. // "type": "string"
  8479. // },
  8480. // "supportsTeamDrives": {
  8481. // "default": "false",
  8482. // "description": "Whether the requesting application supports Team Drives.",
  8483. // "location": "query",
  8484. // "type": "boolean"
  8485. // },
  8486. // "updateViewedDate": {
  8487. // "default": "false",
  8488. // "description": "Deprecated: Use files.update with modifiedDateBehavior=noChange, updateViewedDate=true and an empty request body.",
  8489. // "location": "query",
  8490. // "type": "boolean"
  8491. // }
  8492. // },
  8493. // "path": "files/{fileId}/watch",
  8494. // "request": {
  8495. // "$ref": "Channel",
  8496. // "parameterName": "resource"
  8497. // },
  8498. // "response": {
  8499. // "$ref": "Channel"
  8500. // },
  8501. // "scopes": [
  8502. // "https://www.googleapis.com/auth/drive",
  8503. // "https://www.googleapis.com/auth/drive.appdata",
  8504. // "https://www.googleapis.com/auth/drive.file",
  8505. // "https://www.googleapis.com/auth/drive.metadata",
  8506. // "https://www.googleapis.com/auth/drive.metadata.readonly",
  8507. // "https://www.googleapis.com/auth/drive.photos.readonly",
  8508. // "https://www.googleapis.com/auth/drive.readonly"
  8509. // ],
  8510. // "supportsMediaDownload": true,
  8511. // "supportsSubscription": true,
  8512. // "useMediaDownloadService": true
  8513. // }
  8514. }
  8515. // method id "drive.parents.delete":
  8516. type ParentsDeleteCall struct {
  8517. s *Service
  8518. fileId string
  8519. parentId string
  8520. urlParams_ gensupport.URLParams
  8521. ctx_ context.Context
  8522. header_ http.Header
  8523. }
  8524. // Delete: Removes a parent from a file.
  8525. func (r *ParentsService) Delete(fileId string, parentId string) *ParentsDeleteCall {
  8526. c := &ParentsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  8527. c.fileId = fileId
  8528. c.parentId = parentId
  8529. return c
  8530. }
  8531. // Fields allows partial responses to be retrieved. See
  8532. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  8533. // for more information.
  8534. func (c *ParentsDeleteCall) Fields(s ...googleapi.Field) *ParentsDeleteCall {
  8535. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  8536. return c
  8537. }
  8538. // Context sets the context to be used in this call's Do method. Any
  8539. // pending HTTP request will be aborted if the provided context is
  8540. // canceled.
  8541. func (c *ParentsDeleteCall) Context(ctx context.Context) *ParentsDeleteCall {
  8542. c.ctx_ = ctx
  8543. return c
  8544. }
  8545. // Header returns an http.Header that can be modified by the caller to
  8546. // add HTTP headers to the request.
  8547. func (c *ParentsDeleteCall) Header() http.Header {
  8548. if c.header_ == nil {
  8549. c.header_ = make(http.Header)
  8550. }
  8551. return c.header_
  8552. }
  8553. func (c *ParentsDeleteCall) doRequest(alt string) (*http.Response, error) {
  8554. reqHeaders := make(http.Header)
  8555. for k, v := range c.header_ {
  8556. reqHeaders[k] = v
  8557. }
  8558. reqHeaders.Set("User-Agent", c.s.userAgent())
  8559. var body io.Reader = nil
  8560. c.urlParams_.Set("alt", alt)
  8561. c.urlParams_.Set("prettyPrint", "false")
  8562. urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/parents/{parentId}")
  8563. urls += "?" + c.urlParams_.Encode()
  8564. req, err := http.NewRequest("DELETE", urls, body)
  8565. if err != nil {
  8566. return nil, err
  8567. }
  8568. req.Header = reqHeaders
  8569. googleapi.Expand(req.URL, map[string]string{
  8570. "fileId": c.fileId,
  8571. "parentId": c.parentId,
  8572. })
  8573. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  8574. }
  8575. // Do executes the "drive.parents.delete" call.
  8576. func (c *ParentsDeleteCall) Do(opts ...googleapi.CallOption) error {
  8577. gensupport.SetOptions(c.urlParams_, opts...)
  8578. res, err := c.doRequest("json")
  8579. if err != nil {
  8580. return err
  8581. }
  8582. defer googleapi.CloseBody(res)
  8583. if err := googleapi.CheckResponse(res); err != nil {
  8584. return err
  8585. }
  8586. return nil
  8587. // {
  8588. // "description": "Removes a parent from a file.",
  8589. // "httpMethod": "DELETE",
  8590. // "id": "drive.parents.delete",
  8591. // "parameterOrder": [
  8592. // "fileId",
  8593. // "parentId"
  8594. // ],
  8595. // "parameters": {
  8596. // "fileId": {
  8597. // "description": "The ID of the file.",
  8598. // "location": "path",
  8599. // "required": true,
  8600. // "type": "string"
  8601. // },
  8602. // "parentId": {
  8603. // "description": "The ID of the parent.",
  8604. // "location": "path",
  8605. // "required": true,
  8606. // "type": "string"
  8607. // }
  8608. // },
  8609. // "path": "files/{fileId}/parents/{parentId}",
  8610. // "scopes": [
  8611. // "https://www.googleapis.com/auth/drive",
  8612. // "https://www.googleapis.com/auth/drive.file"
  8613. // ]
  8614. // }
  8615. }
  8616. // method id "drive.parents.get":
  8617. type ParentsGetCall struct {
  8618. s *Service
  8619. fileId string
  8620. parentId string
  8621. urlParams_ gensupport.URLParams
  8622. ifNoneMatch_ string
  8623. ctx_ context.Context
  8624. header_ http.Header
  8625. }
  8626. // Get: Gets a specific parent reference.
  8627. func (r *ParentsService) Get(fileId string, parentId string) *ParentsGetCall {
  8628. c := &ParentsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  8629. c.fileId = fileId
  8630. c.parentId = parentId
  8631. return c
  8632. }
  8633. // Fields allows partial responses to be retrieved. See
  8634. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  8635. // for more information.
  8636. func (c *ParentsGetCall) Fields(s ...googleapi.Field) *ParentsGetCall {
  8637. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  8638. return c
  8639. }
  8640. // IfNoneMatch sets the optional parameter which makes the operation
  8641. // fail if the object's ETag matches the given value. This is useful for
  8642. // getting updates only after the object has changed since the last
  8643. // request. Use googleapi.IsNotModified to check whether the response
  8644. // error from Do is the result of In-None-Match.
  8645. func (c *ParentsGetCall) IfNoneMatch(entityTag string) *ParentsGetCall {
  8646. c.ifNoneMatch_ = entityTag
  8647. return c
  8648. }
  8649. // Context sets the context to be used in this call's Do method. Any
  8650. // pending HTTP request will be aborted if the provided context is
  8651. // canceled.
  8652. func (c *ParentsGetCall) Context(ctx context.Context) *ParentsGetCall {
  8653. c.ctx_ = ctx
  8654. return c
  8655. }
  8656. // Header returns an http.Header that can be modified by the caller to
  8657. // add HTTP headers to the request.
  8658. func (c *ParentsGetCall) Header() http.Header {
  8659. if c.header_ == nil {
  8660. c.header_ = make(http.Header)
  8661. }
  8662. return c.header_
  8663. }
  8664. func (c *ParentsGetCall) doRequest(alt string) (*http.Response, error) {
  8665. reqHeaders := make(http.Header)
  8666. for k, v := range c.header_ {
  8667. reqHeaders[k] = v
  8668. }
  8669. reqHeaders.Set("User-Agent", c.s.userAgent())
  8670. if c.ifNoneMatch_ != "" {
  8671. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  8672. }
  8673. var body io.Reader = nil
  8674. c.urlParams_.Set("alt", alt)
  8675. c.urlParams_.Set("prettyPrint", "false")
  8676. urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/parents/{parentId}")
  8677. urls += "?" + c.urlParams_.Encode()
  8678. req, err := http.NewRequest("GET", urls, body)
  8679. if err != nil {
  8680. return nil, err
  8681. }
  8682. req.Header = reqHeaders
  8683. googleapi.Expand(req.URL, map[string]string{
  8684. "fileId": c.fileId,
  8685. "parentId": c.parentId,
  8686. })
  8687. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  8688. }
  8689. // Do executes the "drive.parents.get" call.
  8690. // Exactly one of *ParentReference or error will be non-nil. Any non-2xx
  8691. // status code is an error. Response headers are in either
  8692. // *ParentReference.ServerResponse.Header or (if a response was returned
  8693. // at all) in error.(*googleapi.Error).Header. Use
  8694. // googleapi.IsNotModified to check whether the returned error was
  8695. // because http.StatusNotModified was returned.
  8696. func (c *ParentsGetCall) Do(opts ...googleapi.CallOption) (*ParentReference, error) {
  8697. gensupport.SetOptions(c.urlParams_, opts...)
  8698. res, err := c.doRequest("json")
  8699. if res != nil && res.StatusCode == http.StatusNotModified {
  8700. if res.Body != nil {
  8701. res.Body.Close()
  8702. }
  8703. return nil, &googleapi.Error{
  8704. Code: res.StatusCode,
  8705. Header: res.Header,
  8706. }
  8707. }
  8708. if err != nil {
  8709. return nil, err
  8710. }
  8711. defer googleapi.CloseBody(res)
  8712. if err := googleapi.CheckResponse(res); err != nil {
  8713. return nil, err
  8714. }
  8715. ret := &ParentReference{
  8716. ServerResponse: googleapi.ServerResponse{
  8717. Header: res.Header,
  8718. HTTPStatusCode: res.StatusCode,
  8719. },
  8720. }
  8721. target := &ret
  8722. if err := gensupport.DecodeResponse(target, res); err != nil {
  8723. return nil, err
  8724. }
  8725. return ret, nil
  8726. // {
  8727. // "description": "Gets a specific parent reference.",
  8728. // "httpMethod": "GET",
  8729. // "id": "drive.parents.get",
  8730. // "parameterOrder": [
  8731. // "fileId",
  8732. // "parentId"
  8733. // ],
  8734. // "parameters": {
  8735. // "fileId": {
  8736. // "description": "The ID of the file.",
  8737. // "location": "path",
  8738. // "required": true,
  8739. // "type": "string"
  8740. // },
  8741. // "parentId": {
  8742. // "description": "The ID of the parent.",
  8743. // "location": "path",
  8744. // "required": true,
  8745. // "type": "string"
  8746. // }
  8747. // },
  8748. // "path": "files/{fileId}/parents/{parentId}",
  8749. // "response": {
  8750. // "$ref": "ParentReference"
  8751. // },
  8752. // "scopes": [
  8753. // "https://www.googleapis.com/auth/drive",
  8754. // "https://www.googleapis.com/auth/drive.appdata",
  8755. // "https://www.googleapis.com/auth/drive.file",
  8756. // "https://www.googleapis.com/auth/drive.metadata",
  8757. // "https://www.googleapis.com/auth/drive.metadata.readonly",
  8758. // "https://www.googleapis.com/auth/drive.photos.readonly",
  8759. // "https://www.googleapis.com/auth/drive.readonly"
  8760. // ]
  8761. // }
  8762. }
  8763. // method id "drive.parents.insert":
  8764. type ParentsInsertCall struct {
  8765. s *Service
  8766. fileId string
  8767. parentreference *ParentReference
  8768. urlParams_ gensupport.URLParams
  8769. ctx_ context.Context
  8770. header_ http.Header
  8771. }
  8772. // Insert: Adds a parent folder for a file.
  8773. func (r *ParentsService) Insert(fileId string, parentreference *ParentReference) *ParentsInsertCall {
  8774. c := &ParentsInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  8775. c.fileId = fileId
  8776. c.parentreference = parentreference
  8777. return c
  8778. }
  8779. // SupportsTeamDrives sets the optional parameter "supportsTeamDrives":
  8780. // Whether the requesting application supports Team Drives.
  8781. func (c *ParentsInsertCall) SupportsTeamDrives(supportsTeamDrives bool) *ParentsInsertCall {
  8782. c.urlParams_.Set("supportsTeamDrives", fmt.Sprint(supportsTeamDrives))
  8783. return c
  8784. }
  8785. // Fields allows partial responses to be retrieved. See
  8786. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  8787. // for more information.
  8788. func (c *ParentsInsertCall) Fields(s ...googleapi.Field) *ParentsInsertCall {
  8789. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  8790. return c
  8791. }
  8792. // Context sets the context to be used in this call's Do method. Any
  8793. // pending HTTP request will be aborted if the provided context is
  8794. // canceled.
  8795. func (c *ParentsInsertCall) Context(ctx context.Context) *ParentsInsertCall {
  8796. c.ctx_ = ctx
  8797. return c
  8798. }
  8799. // Header returns an http.Header that can be modified by the caller to
  8800. // add HTTP headers to the request.
  8801. func (c *ParentsInsertCall) Header() http.Header {
  8802. if c.header_ == nil {
  8803. c.header_ = make(http.Header)
  8804. }
  8805. return c.header_
  8806. }
  8807. func (c *ParentsInsertCall) doRequest(alt string) (*http.Response, error) {
  8808. reqHeaders := make(http.Header)
  8809. for k, v := range c.header_ {
  8810. reqHeaders[k] = v
  8811. }
  8812. reqHeaders.Set("User-Agent", c.s.userAgent())
  8813. var body io.Reader = nil
  8814. body, err := googleapi.WithoutDataWrapper.JSONReader(c.parentreference)
  8815. if err != nil {
  8816. return nil, err
  8817. }
  8818. reqHeaders.Set("Content-Type", "application/json")
  8819. c.urlParams_.Set("alt", alt)
  8820. c.urlParams_.Set("prettyPrint", "false")
  8821. urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/parents")
  8822. urls += "?" + c.urlParams_.Encode()
  8823. req, err := http.NewRequest("POST", urls, body)
  8824. if err != nil {
  8825. return nil, err
  8826. }
  8827. req.Header = reqHeaders
  8828. googleapi.Expand(req.URL, map[string]string{
  8829. "fileId": c.fileId,
  8830. })
  8831. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  8832. }
  8833. // Do executes the "drive.parents.insert" call.
  8834. // Exactly one of *ParentReference or error will be non-nil. Any non-2xx
  8835. // status code is an error. Response headers are in either
  8836. // *ParentReference.ServerResponse.Header or (if a response was returned
  8837. // at all) in error.(*googleapi.Error).Header. Use
  8838. // googleapi.IsNotModified to check whether the returned error was
  8839. // because http.StatusNotModified was returned.
  8840. func (c *ParentsInsertCall) Do(opts ...googleapi.CallOption) (*ParentReference, error) {
  8841. gensupport.SetOptions(c.urlParams_, opts...)
  8842. res, err := c.doRequest("json")
  8843. if res != nil && res.StatusCode == http.StatusNotModified {
  8844. if res.Body != nil {
  8845. res.Body.Close()
  8846. }
  8847. return nil, &googleapi.Error{
  8848. Code: res.StatusCode,
  8849. Header: res.Header,
  8850. }
  8851. }
  8852. if err != nil {
  8853. return nil, err
  8854. }
  8855. defer googleapi.CloseBody(res)
  8856. if err := googleapi.CheckResponse(res); err != nil {
  8857. return nil, err
  8858. }
  8859. ret := &ParentReference{
  8860. ServerResponse: googleapi.ServerResponse{
  8861. Header: res.Header,
  8862. HTTPStatusCode: res.StatusCode,
  8863. },
  8864. }
  8865. target := &ret
  8866. if err := gensupport.DecodeResponse(target, res); err != nil {
  8867. return nil, err
  8868. }
  8869. return ret, nil
  8870. // {
  8871. // "description": "Adds a parent folder for a file.",
  8872. // "httpMethod": "POST",
  8873. // "id": "drive.parents.insert",
  8874. // "parameterOrder": [
  8875. // "fileId"
  8876. // ],
  8877. // "parameters": {
  8878. // "fileId": {
  8879. // "description": "The ID of the file.",
  8880. // "location": "path",
  8881. // "required": true,
  8882. // "type": "string"
  8883. // },
  8884. // "supportsTeamDrives": {
  8885. // "default": "false",
  8886. // "description": "Whether the requesting application supports Team Drives.",
  8887. // "location": "query",
  8888. // "type": "boolean"
  8889. // }
  8890. // },
  8891. // "path": "files/{fileId}/parents",
  8892. // "request": {
  8893. // "$ref": "ParentReference"
  8894. // },
  8895. // "response": {
  8896. // "$ref": "ParentReference"
  8897. // },
  8898. // "scopes": [
  8899. // "https://www.googleapis.com/auth/drive",
  8900. // "https://www.googleapis.com/auth/drive.appdata",
  8901. // "https://www.googleapis.com/auth/drive.file"
  8902. // ]
  8903. // }
  8904. }
  8905. // method id "drive.parents.list":
  8906. type ParentsListCall struct {
  8907. s *Service
  8908. fileId string
  8909. urlParams_ gensupport.URLParams
  8910. ifNoneMatch_ string
  8911. ctx_ context.Context
  8912. header_ http.Header
  8913. }
  8914. // List: Lists a file's parents.
  8915. func (r *ParentsService) List(fileId string) *ParentsListCall {
  8916. c := &ParentsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  8917. c.fileId = fileId
  8918. return c
  8919. }
  8920. // Fields allows partial responses to be retrieved. See
  8921. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  8922. // for more information.
  8923. func (c *ParentsListCall) Fields(s ...googleapi.Field) *ParentsListCall {
  8924. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  8925. return c
  8926. }
  8927. // IfNoneMatch sets the optional parameter which makes the operation
  8928. // fail if the object's ETag matches the given value. This is useful for
  8929. // getting updates only after the object has changed since the last
  8930. // request. Use googleapi.IsNotModified to check whether the response
  8931. // error from Do is the result of In-None-Match.
  8932. func (c *ParentsListCall) IfNoneMatch(entityTag string) *ParentsListCall {
  8933. c.ifNoneMatch_ = entityTag
  8934. return c
  8935. }
  8936. // Context sets the context to be used in this call's Do method. Any
  8937. // pending HTTP request will be aborted if the provided context is
  8938. // canceled.
  8939. func (c *ParentsListCall) Context(ctx context.Context) *ParentsListCall {
  8940. c.ctx_ = ctx
  8941. return c
  8942. }
  8943. // Header returns an http.Header that can be modified by the caller to
  8944. // add HTTP headers to the request.
  8945. func (c *ParentsListCall) Header() http.Header {
  8946. if c.header_ == nil {
  8947. c.header_ = make(http.Header)
  8948. }
  8949. return c.header_
  8950. }
  8951. func (c *ParentsListCall) doRequest(alt string) (*http.Response, error) {
  8952. reqHeaders := make(http.Header)
  8953. for k, v := range c.header_ {
  8954. reqHeaders[k] = v
  8955. }
  8956. reqHeaders.Set("User-Agent", c.s.userAgent())
  8957. if c.ifNoneMatch_ != "" {
  8958. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  8959. }
  8960. var body io.Reader = nil
  8961. c.urlParams_.Set("alt", alt)
  8962. c.urlParams_.Set("prettyPrint", "false")
  8963. urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/parents")
  8964. urls += "?" + c.urlParams_.Encode()
  8965. req, err := http.NewRequest("GET", urls, body)
  8966. if err != nil {
  8967. return nil, err
  8968. }
  8969. req.Header = reqHeaders
  8970. googleapi.Expand(req.URL, map[string]string{
  8971. "fileId": c.fileId,
  8972. })
  8973. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  8974. }
  8975. // Do executes the "drive.parents.list" call.
  8976. // Exactly one of *ParentList or error will be non-nil. Any non-2xx
  8977. // status code is an error. Response headers are in either
  8978. // *ParentList.ServerResponse.Header or (if a response was returned at
  8979. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  8980. // to check whether the returned error was because
  8981. // http.StatusNotModified was returned.
  8982. func (c *ParentsListCall) Do(opts ...googleapi.CallOption) (*ParentList, error) {
  8983. gensupport.SetOptions(c.urlParams_, opts...)
  8984. res, err := c.doRequest("json")
  8985. if res != nil && res.StatusCode == http.StatusNotModified {
  8986. if res.Body != nil {
  8987. res.Body.Close()
  8988. }
  8989. return nil, &googleapi.Error{
  8990. Code: res.StatusCode,
  8991. Header: res.Header,
  8992. }
  8993. }
  8994. if err != nil {
  8995. return nil, err
  8996. }
  8997. defer googleapi.CloseBody(res)
  8998. if err := googleapi.CheckResponse(res); err != nil {
  8999. return nil, err
  9000. }
  9001. ret := &ParentList{
  9002. ServerResponse: googleapi.ServerResponse{
  9003. Header: res.Header,
  9004. HTTPStatusCode: res.StatusCode,
  9005. },
  9006. }
  9007. target := &ret
  9008. if err := gensupport.DecodeResponse(target, res); err != nil {
  9009. return nil, err
  9010. }
  9011. return ret, nil
  9012. // {
  9013. // "description": "Lists a file's parents.",
  9014. // "httpMethod": "GET",
  9015. // "id": "drive.parents.list",
  9016. // "parameterOrder": [
  9017. // "fileId"
  9018. // ],
  9019. // "parameters": {
  9020. // "fileId": {
  9021. // "description": "The ID of the file.",
  9022. // "location": "path",
  9023. // "required": true,
  9024. // "type": "string"
  9025. // }
  9026. // },
  9027. // "path": "files/{fileId}/parents",
  9028. // "response": {
  9029. // "$ref": "ParentList"
  9030. // },
  9031. // "scopes": [
  9032. // "https://www.googleapis.com/auth/drive",
  9033. // "https://www.googleapis.com/auth/drive.appdata",
  9034. // "https://www.googleapis.com/auth/drive.file",
  9035. // "https://www.googleapis.com/auth/drive.metadata",
  9036. // "https://www.googleapis.com/auth/drive.metadata.readonly",
  9037. // "https://www.googleapis.com/auth/drive.photos.readonly",
  9038. // "https://www.googleapis.com/auth/drive.readonly"
  9039. // ]
  9040. // }
  9041. }
  9042. // method id "drive.permissions.delete":
  9043. type PermissionsDeleteCall struct {
  9044. s *Service
  9045. fileId string
  9046. permissionId string
  9047. urlParams_ gensupport.URLParams
  9048. ctx_ context.Context
  9049. header_ http.Header
  9050. }
  9051. // Delete: Deletes a permission from a file or Team Drive.
  9052. func (r *PermissionsService) Delete(fileId string, permissionId string) *PermissionsDeleteCall {
  9053. c := &PermissionsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  9054. c.fileId = fileId
  9055. c.permissionId = permissionId
  9056. return c
  9057. }
  9058. // SupportsTeamDrives sets the optional parameter "supportsTeamDrives":
  9059. // Whether the requesting application supports Team Drives.
  9060. func (c *PermissionsDeleteCall) SupportsTeamDrives(supportsTeamDrives bool) *PermissionsDeleteCall {
  9061. c.urlParams_.Set("supportsTeamDrives", fmt.Sprint(supportsTeamDrives))
  9062. return c
  9063. }
  9064. // UseDomainAdminAccess sets the optional parameter
  9065. // "useDomainAdminAccess": Issue the request as a domain administrator;
  9066. // if set to true, then the requester will be granted access if they are
  9067. // an administrator of the domain to which the item belongs.
  9068. func (c *PermissionsDeleteCall) UseDomainAdminAccess(useDomainAdminAccess bool) *PermissionsDeleteCall {
  9069. c.urlParams_.Set("useDomainAdminAccess", fmt.Sprint(useDomainAdminAccess))
  9070. return c
  9071. }
  9072. // Fields allows partial responses to be retrieved. See
  9073. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  9074. // for more information.
  9075. func (c *PermissionsDeleteCall) Fields(s ...googleapi.Field) *PermissionsDeleteCall {
  9076. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  9077. return c
  9078. }
  9079. // Context sets the context to be used in this call's Do method. Any
  9080. // pending HTTP request will be aborted if the provided context is
  9081. // canceled.
  9082. func (c *PermissionsDeleteCall) Context(ctx context.Context) *PermissionsDeleteCall {
  9083. c.ctx_ = ctx
  9084. return c
  9085. }
  9086. // Header returns an http.Header that can be modified by the caller to
  9087. // add HTTP headers to the request.
  9088. func (c *PermissionsDeleteCall) Header() http.Header {
  9089. if c.header_ == nil {
  9090. c.header_ = make(http.Header)
  9091. }
  9092. return c.header_
  9093. }
  9094. func (c *PermissionsDeleteCall) doRequest(alt string) (*http.Response, error) {
  9095. reqHeaders := make(http.Header)
  9096. for k, v := range c.header_ {
  9097. reqHeaders[k] = v
  9098. }
  9099. reqHeaders.Set("User-Agent", c.s.userAgent())
  9100. var body io.Reader = nil
  9101. c.urlParams_.Set("alt", alt)
  9102. c.urlParams_.Set("prettyPrint", "false")
  9103. urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/permissions/{permissionId}")
  9104. urls += "?" + c.urlParams_.Encode()
  9105. req, err := http.NewRequest("DELETE", urls, body)
  9106. if err != nil {
  9107. return nil, err
  9108. }
  9109. req.Header = reqHeaders
  9110. googleapi.Expand(req.URL, map[string]string{
  9111. "fileId": c.fileId,
  9112. "permissionId": c.permissionId,
  9113. })
  9114. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  9115. }
  9116. // Do executes the "drive.permissions.delete" call.
  9117. func (c *PermissionsDeleteCall) Do(opts ...googleapi.CallOption) error {
  9118. gensupport.SetOptions(c.urlParams_, opts...)
  9119. res, err := c.doRequest("json")
  9120. if err != nil {
  9121. return err
  9122. }
  9123. defer googleapi.CloseBody(res)
  9124. if err := googleapi.CheckResponse(res); err != nil {
  9125. return err
  9126. }
  9127. return nil
  9128. // {
  9129. // "description": "Deletes a permission from a file or Team Drive.",
  9130. // "httpMethod": "DELETE",
  9131. // "id": "drive.permissions.delete",
  9132. // "parameterOrder": [
  9133. // "fileId",
  9134. // "permissionId"
  9135. // ],
  9136. // "parameters": {
  9137. // "fileId": {
  9138. // "description": "The ID for the file or Team Drive.",
  9139. // "location": "path",
  9140. // "required": true,
  9141. // "type": "string"
  9142. // },
  9143. // "permissionId": {
  9144. // "description": "The ID for the permission.",
  9145. // "location": "path",
  9146. // "required": true,
  9147. // "type": "string"
  9148. // },
  9149. // "supportsTeamDrives": {
  9150. // "default": "false",
  9151. // "description": "Whether the requesting application supports Team Drives.",
  9152. // "location": "query",
  9153. // "type": "boolean"
  9154. // },
  9155. // "useDomainAdminAccess": {
  9156. // "default": "false",
  9157. // "description": "Issue the request as a domain administrator; if set to true, then the requester will be granted access if they are an administrator of the domain to which the item belongs.",
  9158. // "location": "query",
  9159. // "type": "boolean"
  9160. // }
  9161. // },
  9162. // "path": "files/{fileId}/permissions/{permissionId}",
  9163. // "scopes": [
  9164. // "https://www.googleapis.com/auth/drive",
  9165. // "https://www.googleapis.com/auth/drive.file"
  9166. // ]
  9167. // }
  9168. }
  9169. // method id "drive.permissions.get":
  9170. type PermissionsGetCall struct {
  9171. s *Service
  9172. fileId string
  9173. permissionId string
  9174. urlParams_ gensupport.URLParams
  9175. ifNoneMatch_ string
  9176. ctx_ context.Context
  9177. header_ http.Header
  9178. }
  9179. // Get: Gets a permission by ID.
  9180. func (r *PermissionsService) Get(fileId string, permissionId string) *PermissionsGetCall {
  9181. c := &PermissionsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  9182. c.fileId = fileId
  9183. c.permissionId = permissionId
  9184. return c
  9185. }
  9186. // SupportsTeamDrives sets the optional parameter "supportsTeamDrives":
  9187. // Whether the requesting application supports Team Drives.
  9188. func (c *PermissionsGetCall) SupportsTeamDrives(supportsTeamDrives bool) *PermissionsGetCall {
  9189. c.urlParams_.Set("supportsTeamDrives", fmt.Sprint(supportsTeamDrives))
  9190. return c
  9191. }
  9192. // UseDomainAdminAccess sets the optional parameter
  9193. // "useDomainAdminAccess": Issue the request as a domain administrator;
  9194. // if set to true, then the requester will be granted access if they are
  9195. // an administrator of the domain to which the item belongs.
  9196. func (c *PermissionsGetCall) UseDomainAdminAccess(useDomainAdminAccess bool) *PermissionsGetCall {
  9197. c.urlParams_.Set("useDomainAdminAccess", fmt.Sprint(useDomainAdminAccess))
  9198. return c
  9199. }
  9200. // Fields allows partial responses to be retrieved. See
  9201. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  9202. // for more information.
  9203. func (c *PermissionsGetCall) Fields(s ...googleapi.Field) *PermissionsGetCall {
  9204. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  9205. return c
  9206. }
  9207. // IfNoneMatch sets the optional parameter which makes the operation
  9208. // fail if the object's ETag matches the given value. This is useful for
  9209. // getting updates only after the object has changed since the last
  9210. // request. Use googleapi.IsNotModified to check whether the response
  9211. // error from Do is the result of In-None-Match.
  9212. func (c *PermissionsGetCall) IfNoneMatch(entityTag string) *PermissionsGetCall {
  9213. c.ifNoneMatch_ = entityTag
  9214. return c
  9215. }
  9216. // Context sets the context to be used in this call's Do method. Any
  9217. // pending HTTP request will be aborted if the provided context is
  9218. // canceled.
  9219. func (c *PermissionsGetCall) Context(ctx context.Context) *PermissionsGetCall {
  9220. c.ctx_ = ctx
  9221. return c
  9222. }
  9223. // Header returns an http.Header that can be modified by the caller to
  9224. // add HTTP headers to the request.
  9225. func (c *PermissionsGetCall) Header() http.Header {
  9226. if c.header_ == nil {
  9227. c.header_ = make(http.Header)
  9228. }
  9229. return c.header_
  9230. }
  9231. func (c *PermissionsGetCall) doRequest(alt string) (*http.Response, error) {
  9232. reqHeaders := make(http.Header)
  9233. for k, v := range c.header_ {
  9234. reqHeaders[k] = v
  9235. }
  9236. reqHeaders.Set("User-Agent", c.s.userAgent())
  9237. if c.ifNoneMatch_ != "" {
  9238. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  9239. }
  9240. var body io.Reader = nil
  9241. c.urlParams_.Set("alt", alt)
  9242. c.urlParams_.Set("prettyPrint", "false")
  9243. urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/permissions/{permissionId}")
  9244. urls += "?" + c.urlParams_.Encode()
  9245. req, err := http.NewRequest("GET", urls, body)
  9246. if err != nil {
  9247. return nil, err
  9248. }
  9249. req.Header = reqHeaders
  9250. googleapi.Expand(req.URL, map[string]string{
  9251. "fileId": c.fileId,
  9252. "permissionId": c.permissionId,
  9253. })
  9254. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  9255. }
  9256. // Do executes the "drive.permissions.get" call.
  9257. // Exactly one of *Permission or error will be non-nil. Any non-2xx
  9258. // status code is an error. Response headers are in either
  9259. // *Permission.ServerResponse.Header or (if a response was returned at
  9260. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  9261. // to check whether the returned error was because
  9262. // http.StatusNotModified was returned.
  9263. func (c *PermissionsGetCall) Do(opts ...googleapi.CallOption) (*Permission, error) {
  9264. gensupport.SetOptions(c.urlParams_, opts...)
  9265. res, err := c.doRequest("json")
  9266. if res != nil && res.StatusCode == http.StatusNotModified {
  9267. if res.Body != nil {
  9268. res.Body.Close()
  9269. }
  9270. return nil, &googleapi.Error{
  9271. Code: res.StatusCode,
  9272. Header: res.Header,
  9273. }
  9274. }
  9275. if err != nil {
  9276. return nil, err
  9277. }
  9278. defer googleapi.CloseBody(res)
  9279. if err := googleapi.CheckResponse(res); err != nil {
  9280. return nil, err
  9281. }
  9282. ret := &Permission{
  9283. ServerResponse: googleapi.ServerResponse{
  9284. Header: res.Header,
  9285. HTTPStatusCode: res.StatusCode,
  9286. },
  9287. }
  9288. target := &ret
  9289. if err := gensupport.DecodeResponse(target, res); err != nil {
  9290. return nil, err
  9291. }
  9292. return ret, nil
  9293. // {
  9294. // "description": "Gets a permission by ID.",
  9295. // "httpMethod": "GET",
  9296. // "id": "drive.permissions.get",
  9297. // "parameterOrder": [
  9298. // "fileId",
  9299. // "permissionId"
  9300. // ],
  9301. // "parameters": {
  9302. // "fileId": {
  9303. // "description": "The ID for the file or Team Drive.",
  9304. // "location": "path",
  9305. // "required": true,
  9306. // "type": "string"
  9307. // },
  9308. // "permissionId": {
  9309. // "description": "The ID for the permission.",
  9310. // "location": "path",
  9311. // "required": true,
  9312. // "type": "string"
  9313. // },
  9314. // "supportsTeamDrives": {
  9315. // "default": "false",
  9316. // "description": "Whether the requesting application supports Team Drives.",
  9317. // "location": "query",
  9318. // "type": "boolean"
  9319. // },
  9320. // "useDomainAdminAccess": {
  9321. // "default": "false",
  9322. // "description": "Issue the request as a domain administrator; if set to true, then the requester will be granted access if they are an administrator of the domain to which the item belongs.",
  9323. // "location": "query",
  9324. // "type": "boolean"
  9325. // }
  9326. // },
  9327. // "path": "files/{fileId}/permissions/{permissionId}",
  9328. // "response": {
  9329. // "$ref": "Permission"
  9330. // },
  9331. // "scopes": [
  9332. // "https://www.googleapis.com/auth/drive",
  9333. // "https://www.googleapis.com/auth/drive.file",
  9334. // "https://www.googleapis.com/auth/drive.metadata",
  9335. // "https://www.googleapis.com/auth/drive.metadata.readonly",
  9336. // "https://www.googleapis.com/auth/drive.photos.readonly",
  9337. // "https://www.googleapis.com/auth/drive.readonly"
  9338. // ]
  9339. // }
  9340. }
  9341. // method id "drive.permissions.getIdForEmail":
  9342. type PermissionsGetIdForEmailCall struct {
  9343. s *Service
  9344. email string
  9345. urlParams_ gensupport.URLParams
  9346. ifNoneMatch_ string
  9347. ctx_ context.Context
  9348. header_ http.Header
  9349. }
  9350. // GetIdForEmail: Returns the permission ID for an email address.
  9351. func (r *PermissionsService) GetIdForEmail(email string) *PermissionsGetIdForEmailCall {
  9352. c := &PermissionsGetIdForEmailCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  9353. c.email = email
  9354. return c
  9355. }
  9356. // Fields allows partial responses to be retrieved. See
  9357. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  9358. // for more information.
  9359. func (c *PermissionsGetIdForEmailCall) Fields(s ...googleapi.Field) *PermissionsGetIdForEmailCall {
  9360. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  9361. return c
  9362. }
  9363. // IfNoneMatch sets the optional parameter which makes the operation
  9364. // fail if the object's ETag matches the given value. This is useful for
  9365. // getting updates only after the object has changed since the last
  9366. // request. Use googleapi.IsNotModified to check whether the response
  9367. // error from Do is the result of In-None-Match.
  9368. func (c *PermissionsGetIdForEmailCall) IfNoneMatch(entityTag string) *PermissionsGetIdForEmailCall {
  9369. c.ifNoneMatch_ = entityTag
  9370. return c
  9371. }
  9372. // Context sets the context to be used in this call's Do method. Any
  9373. // pending HTTP request will be aborted if the provided context is
  9374. // canceled.
  9375. func (c *PermissionsGetIdForEmailCall) Context(ctx context.Context) *PermissionsGetIdForEmailCall {
  9376. c.ctx_ = ctx
  9377. return c
  9378. }
  9379. // Header returns an http.Header that can be modified by the caller to
  9380. // add HTTP headers to the request.
  9381. func (c *PermissionsGetIdForEmailCall) Header() http.Header {
  9382. if c.header_ == nil {
  9383. c.header_ = make(http.Header)
  9384. }
  9385. return c.header_
  9386. }
  9387. func (c *PermissionsGetIdForEmailCall) doRequest(alt string) (*http.Response, error) {
  9388. reqHeaders := make(http.Header)
  9389. for k, v := range c.header_ {
  9390. reqHeaders[k] = v
  9391. }
  9392. reqHeaders.Set("User-Agent", c.s.userAgent())
  9393. if c.ifNoneMatch_ != "" {
  9394. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  9395. }
  9396. var body io.Reader = nil
  9397. c.urlParams_.Set("alt", alt)
  9398. c.urlParams_.Set("prettyPrint", "false")
  9399. urls := googleapi.ResolveRelative(c.s.BasePath, "permissionIds/{email}")
  9400. urls += "?" + c.urlParams_.Encode()
  9401. req, err := http.NewRequest("GET", urls, body)
  9402. if err != nil {
  9403. return nil, err
  9404. }
  9405. req.Header = reqHeaders
  9406. googleapi.Expand(req.URL, map[string]string{
  9407. "email": c.email,
  9408. })
  9409. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  9410. }
  9411. // Do executes the "drive.permissions.getIdForEmail" call.
  9412. // Exactly one of *PermissionId or error will be non-nil. Any non-2xx
  9413. // status code is an error. Response headers are in either
  9414. // *PermissionId.ServerResponse.Header or (if a response was returned at
  9415. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  9416. // to check whether the returned error was because
  9417. // http.StatusNotModified was returned.
  9418. func (c *PermissionsGetIdForEmailCall) Do(opts ...googleapi.CallOption) (*PermissionId, error) {
  9419. gensupport.SetOptions(c.urlParams_, opts...)
  9420. res, err := c.doRequest("json")
  9421. if res != nil && res.StatusCode == http.StatusNotModified {
  9422. if res.Body != nil {
  9423. res.Body.Close()
  9424. }
  9425. return nil, &googleapi.Error{
  9426. Code: res.StatusCode,
  9427. Header: res.Header,
  9428. }
  9429. }
  9430. if err != nil {
  9431. return nil, err
  9432. }
  9433. defer googleapi.CloseBody(res)
  9434. if err := googleapi.CheckResponse(res); err != nil {
  9435. return nil, err
  9436. }
  9437. ret := &PermissionId{
  9438. ServerResponse: googleapi.ServerResponse{
  9439. Header: res.Header,
  9440. HTTPStatusCode: res.StatusCode,
  9441. },
  9442. }
  9443. target := &ret
  9444. if err := gensupport.DecodeResponse(target, res); err != nil {
  9445. return nil, err
  9446. }
  9447. return ret, nil
  9448. // {
  9449. // "description": "Returns the permission ID for an email address.",
  9450. // "httpMethod": "GET",
  9451. // "id": "drive.permissions.getIdForEmail",
  9452. // "parameterOrder": [
  9453. // "email"
  9454. // ],
  9455. // "parameters": {
  9456. // "email": {
  9457. // "description": "The email address for which to return a permission ID",
  9458. // "location": "path",
  9459. // "required": true,
  9460. // "type": "string"
  9461. // }
  9462. // },
  9463. // "path": "permissionIds/{email}",
  9464. // "response": {
  9465. // "$ref": "PermissionId"
  9466. // },
  9467. // "scopes": [
  9468. // "https://www.googleapis.com/auth/drive",
  9469. // "https://www.googleapis.com/auth/drive.appdata",
  9470. // "https://www.googleapis.com/auth/drive.apps.readonly",
  9471. // "https://www.googleapis.com/auth/drive.file",
  9472. // "https://www.googleapis.com/auth/drive.metadata",
  9473. // "https://www.googleapis.com/auth/drive.metadata.readonly",
  9474. // "https://www.googleapis.com/auth/drive.photos.readonly",
  9475. // "https://www.googleapis.com/auth/drive.readonly"
  9476. // ]
  9477. // }
  9478. }
  9479. // method id "drive.permissions.insert":
  9480. type PermissionsInsertCall struct {
  9481. s *Service
  9482. fileId string
  9483. permission *Permission
  9484. urlParams_ gensupport.URLParams
  9485. ctx_ context.Context
  9486. header_ http.Header
  9487. }
  9488. // Insert: Inserts a permission for a file or Team Drive.
  9489. func (r *PermissionsService) Insert(fileId string, permission *Permission) *PermissionsInsertCall {
  9490. c := &PermissionsInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  9491. c.fileId = fileId
  9492. c.permission = permission
  9493. return c
  9494. }
  9495. // EmailMessage sets the optional parameter "emailMessage": A plain text
  9496. // custom message to include in notification emails.
  9497. func (c *PermissionsInsertCall) EmailMessage(emailMessage string) *PermissionsInsertCall {
  9498. c.urlParams_.Set("emailMessage", emailMessage)
  9499. return c
  9500. }
  9501. // SendNotificationEmails sets the optional parameter
  9502. // "sendNotificationEmails": Whether to send notification emails when
  9503. // sharing to users or groups. This parameter is ignored and an email is
  9504. // sent if the role is owner.
  9505. func (c *PermissionsInsertCall) SendNotificationEmails(sendNotificationEmails bool) *PermissionsInsertCall {
  9506. c.urlParams_.Set("sendNotificationEmails", fmt.Sprint(sendNotificationEmails))
  9507. return c
  9508. }
  9509. // SupportsTeamDrives sets the optional parameter "supportsTeamDrives":
  9510. // Whether the requesting application supports Team Drives.
  9511. func (c *PermissionsInsertCall) SupportsTeamDrives(supportsTeamDrives bool) *PermissionsInsertCall {
  9512. c.urlParams_.Set("supportsTeamDrives", fmt.Sprint(supportsTeamDrives))
  9513. return c
  9514. }
  9515. // UseDomainAdminAccess sets the optional parameter
  9516. // "useDomainAdminAccess": Issue the request as a domain administrator;
  9517. // if set to true, then the requester will be granted access if they are
  9518. // an administrator of the domain to which the item belongs.
  9519. func (c *PermissionsInsertCall) UseDomainAdminAccess(useDomainAdminAccess bool) *PermissionsInsertCall {
  9520. c.urlParams_.Set("useDomainAdminAccess", fmt.Sprint(useDomainAdminAccess))
  9521. return c
  9522. }
  9523. // Fields allows partial responses to be retrieved. See
  9524. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  9525. // for more information.
  9526. func (c *PermissionsInsertCall) Fields(s ...googleapi.Field) *PermissionsInsertCall {
  9527. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  9528. return c
  9529. }
  9530. // Context sets the context to be used in this call's Do method. Any
  9531. // pending HTTP request will be aborted if the provided context is
  9532. // canceled.
  9533. func (c *PermissionsInsertCall) Context(ctx context.Context) *PermissionsInsertCall {
  9534. c.ctx_ = ctx
  9535. return c
  9536. }
  9537. // Header returns an http.Header that can be modified by the caller to
  9538. // add HTTP headers to the request.
  9539. func (c *PermissionsInsertCall) Header() http.Header {
  9540. if c.header_ == nil {
  9541. c.header_ = make(http.Header)
  9542. }
  9543. return c.header_
  9544. }
  9545. func (c *PermissionsInsertCall) doRequest(alt string) (*http.Response, error) {
  9546. reqHeaders := make(http.Header)
  9547. for k, v := range c.header_ {
  9548. reqHeaders[k] = v
  9549. }
  9550. reqHeaders.Set("User-Agent", c.s.userAgent())
  9551. var body io.Reader = nil
  9552. body, err := googleapi.WithoutDataWrapper.JSONReader(c.permission)
  9553. if err != nil {
  9554. return nil, err
  9555. }
  9556. reqHeaders.Set("Content-Type", "application/json")
  9557. c.urlParams_.Set("alt", alt)
  9558. c.urlParams_.Set("prettyPrint", "false")
  9559. urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/permissions")
  9560. urls += "?" + c.urlParams_.Encode()
  9561. req, err := http.NewRequest("POST", urls, body)
  9562. if err != nil {
  9563. return nil, err
  9564. }
  9565. req.Header = reqHeaders
  9566. googleapi.Expand(req.URL, map[string]string{
  9567. "fileId": c.fileId,
  9568. })
  9569. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  9570. }
  9571. // Do executes the "drive.permissions.insert" call.
  9572. // Exactly one of *Permission or error will be non-nil. Any non-2xx
  9573. // status code is an error. Response headers are in either
  9574. // *Permission.ServerResponse.Header or (if a response was returned at
  9575. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  9576. // to check whether the returned error was because
  9577. // http.StatusNotModified was returned.
  9578. func (c *PermissionsInsertCall) Do(opts ...googleapi.CallOption) (*Permission, error) {
  9579. gensupport.SetOptions(c.urlParams_, opts...)
  9580. res, err := c.doRequest("json")
  9581. if res != nil && res.StatusCode == http.StatusNotModified {
  9582. if res.Body != nil {
  9583. res.Body.Close()
  9584. }
  9585. return nil, &googleapi.Error{
  9586. Code: res.StatusCode,
  9587. Header: res.Header,
  9588. }
  9589. }
  9590. if err != nil {
  9591. return nil, err
  9592. }
  9593. defer googleapi.CloseBody(res)
  9594. if err := googleapi.CheckResponse(res); err != nil {
  9595. return nil, err
  9596. }
  9597. ret := &Permission{
  9598. ServerResponse: googleapi.ServerResponse{
  9599. Header: res.Header,
  9600. HTTPStatusCode: res.StatusCode,
  9601. },
  9602. }
  9603. target := &ret
  9604. if err := gensupport.DecodeResponse(target, res); err != nil {
  9605. return nil, err
  9606. }
  9607. return ret, nil
  9608. // {
  9609. // "description": "Inserts a permission for a file or Team Drive.",
  9610. // "httpMethod": "POST",
  9611. // "id": "drive.permissions.insert",
  9612. // "parameterOrder": [
  9613. // "fileId"
  9614. // ],
  9615. // "parameters": {
  9616. // "emailMessage": {
  9617. // "description": "A plain text custom message to include in notification emails.",
  9618. // "location": "query",
  9619. // "type": "string"
  9620. // },
  9621. // "fileId": {
  9622. // "description": "The ID for the file or Team Drive.",
  9623. // "location": "path",
  9624. // "required": true,
  9625. // "type": "string"
  9626. // },
  9627. // "sendNotificationEmails": {
  9628. // "default": "true",
  9629. // "description": "Whether to send notification emails when sharing to users or groups. This parameter is ignored and an email is sent if the role is owner.",
  9630. // "location": "query",
  9631. // "type": "boolean"
  9632. // },
  9633. // "supportsTeamDrives": {
  9634. // "default": "false",
  9635. // "description": "Whether the requesting application supports Team Drives.",
  9636. // "location": "query",
  9637. // "type": "boolean"
  9638. // },
  9639. // "useDomainAdminAccess": {
  9640. // "default": "false",
  9641. // "description": "Issue the request as a domain administrator; if set to true, then the requester will be granted access if they are an administrator of the domain to which the item belongs.",
  9642. // "location": "query",
  9643. // "type": "boolean"
  9644. // }
  9645. // },
  9646. // "path": "files/{fileId}/permissions",
  9647. // "request": {
  9648. // "$ref": "Permission"
  9649. // },
  9650. // "response": {
  9651. // "$ref": "Permission"
  9652. // },
  9653. // "scopes": [
  9654. // "https://www.googleapis.com/auth/drive",
  9655. // "https://www.googleapis.com/auth/drive.file"
  9656. // ]
  9657. // }
  9658. }
  9659. // method id "drive.permissions.list":
  9660. type PermissionsListCall struct {
  9661. s *Service
  9662. fileId string
  9663. urlParams_ gensupport.URLParams
  9664. ifNoneMatch_ string
  9665. ctx_ context.Context
  9666. header_ http.Header
  9667. }
  9668. // List: Lists a file's or Team Drive's permissions.
  9669. func (r *PermissionsService) List(fileId string) *PermissionsListCall {
  9670. c := &PermissionsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  9671. c.fileId = fileId
  9672. return c
  9673. }
  9674. // MaxResults sets the optional parameter "maxResults": The maximum
  9675. // number of permissions to return per page. When not set for files in a
  9676. // Team Drive, at most 100 results will be returned. When not set for
  9677. // files that are not in a Team Drive, the entire list will be returned.
  9678. func (c *PermissionsListCall) MaxResults(maxResults int64) *PermissionsListCall {
  9679. c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
  9680. return c
  9681. }
  9682. // PageToken sets the optional parameter "pageToken": The token for
  9683. // continuing a previous list request on the next page. This should be
  9684. // set to the value of 'nextPageToken' from the previous response.
  9685. func (c *PermissionsListCall) PageToken(pageToken string) *PermissionsListCall {
  9686. c.urlParams_.Set("pageToken", pageToken)
  9687. return c
  9688. }
  9689. // SupportsTeamDrives sets the optional parameter "supportsTeamDrives":
  9690. // Whether the requesting application supports Team Drives.
  9691. func (c *PermissionsListCall) SupportsTeamDrives(supportsTeamDrives bool) *PermissionsListCall {
  9692. c.urlParams_.Set("supportsTeamDrives", fmt.Sprint(supportsTeamDrives))
  9693. return c
  9694. }
  9695. // UseDomainAdminAccess sets the optional parameter
  9696. // "useDomainAdminAccess": Issue the request as a domain administrator;
  9697. // if set to true, then the requester will be granted access if they are
  9698. // an administrator of the domain to which the item belongs.
  9699. func (c *PermissionsListCall) UseDomainAdminAccess(useDomainAdminAccess bool) *PermissionsListCall {
  9700. c.urlParams_.Set("useDomainAdminAccess", fmt.Sprint(useDomainAdminAccess))
  9701. return c
  9702. }
  9703. // Fields allows partial responses to be retrieved. See
  9704. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  9705. // for more information.
  9706. func (c *PermissionsListCall) Fields(s ...googleapi.Field) *PermissionsListCall {
  9707. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  9708. return c
  9709. }
  9710. // IfNoneMatch sets the optional parameter which makes the operation
  9711. // fail if the object's ETag matches the given value. This is useful for
  9712. // getting updates only after the object has changed since the last
  9713. // request. Use googleapi.IsNotModified to check whether the response
  9714. // error from Do is the result of In-None-Match.
  9715. func (c *PermissionsListCall) IfNoneMatch(entityTag string) *PermissionsListCall {
  9716. c.ifNoneMatch_ = entityTag
  9717. return c
  9718. }
  9719. // Context sets the context to be used in this call's Do method. Any
  9720. // pending HTTP request will be aborted if the provided context is
  9721. // canceled.
  9722. func (c *PermissionsListCall) Context(ctx context.Context) *PermissionsListCall {
  9723. c.ctx_ = ctx
  9724. return c
  9725. }
  9726. // Header returns an http.Header that can be modified by the caller to
  9727. // add HTTP headers to the request.
  9728. func (c *PermissionsListCall) Header() http.Header {
  9729. if c.header_ == nil {
  9730. c.header_ = make(http.Header)
  9731. }
  9732. return c.header_
  9733. }
  9734. func (c *PermissionsListCall) doRequest(alt string) (*http.Response, error) {
  9735. reqHeaders := make(http.Header)
  9736. for k, v := range c.header_ {
  9737. reqHeaders[k] = v
  9738. }
  9739. reqHeaders.Set("User-Agent", c.s.userAgent())
  9740. if c.ifNoneMatch_ != "" {
  9741. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  9742. }
  9743. var body io.Reader = nil
  9744. c.urlParams_.Set("alt", alt)
  9745. c.urlParams_.Set("prettyPrint", "false")
  9746. urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/permissions")
  9747. urls += "?" + c.urlParams_.Encode()
  9748. req, err := http.NewRequest("GET", urls, body)
  9749. if err != nil {
  9750. return nil, err
  9751. }
  9752. req.Header = reqHeaders
  9753. googleapi.Expand(req.URL, map[string]string{
  9754. "fileId": c.fileId,
  9755. })
  9756. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  9757. }
  9758. // Do executes the "drive.permissions.list" call.
  9759. // Exactly one of *PermissionList or error will be non-nil. Any non-2xx
  9760. // status code is an error. Response headers are in either
  9761. // *PermissionList.ServerResponse.Header or (if a response was returned
  9762. // at all) in error.(*googleapi.Error).Header. Use
  9763. // googleapi.IsNotModified to check whether the returned error was
  9764. // because http.StatusNotModified was returned.
  9765. func (c *PermissionsListCall) Do(opts ...googleapi.CallOption) (*PermissionList, error) {
  9766. gensupport.SetOptions(c.urlParams_, opts...)
  9767. res, err := c.doRequest("json")
  9768. if res != nil && res.StatusCode == http.StatusNotModified {
  9769. if res.Body != nil {
  9770. res.Body.Close()
  9771. }
  9772. return nil, &googleapi.Error{
  9773. Code: res.StatusCode,
  9774. Header: res.Header,
  9775. }
  9776. }
  9777. if err != nil {
  9778. return nil, err
  9779. }
  9780. defer googleapi.CloseBody(res)
  9781. if err := googleapi.CheckResponse(res); err != nil {
  9782. return nil, err
  9783. }
  9784. ret := &PermissionList{
  9785. ServerResponse: googleapi.ServerResponse{
  9786. Header: res.Header,
  9787. HTTPStatusCode: res.StatusCode,
  9788. },
  9789. }
  9790. target := &ret
  9791. if err := gensupport.DecodeResponse(target, res); err != nil {
  9792. return nil, err
  9793. }
  9794. return ret, nil
  9795. // {
  9796. // "description": "Lists a file's or Team Drive's permissions.",
  9797. // "httpMethod": "GET",
  9798. // "id": "drive.permissions.list",
  9799. // "parameterOrder": [
  9800. // "fileId"
  9801. // ],
  9802. // "parameters": {
  9803. // "fileId": {
  9804. // "description": "The ID for the file or Team Drive.",
  9805. // "location": "path",
  9806. // "required": true,
  9807. // "type": "string"
  9808. // },
  9809. // "maxResults": {
  9810. // "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.",
  9811. // "format": "int32",
  9812. // "location": "query",
  9813. // "maximum": "100",
  9814. // "minimum": "1",
  9815. // "type": "integer"
  9816. // },
  9817. // "pageToken": {
  9818. // "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.",
  9819. // "location": "query",
  9820. // "type": "string"
  9821. // },
  9822. // "supportsTeamDrives": {
  9823. // "default": "false",
  9824. // "description": "Whether the requesting application supports Team Drives.",
  9825. // "location": "query",
  9826. // "type": "boolean"
  9827. // },
  9828. // "useDomainAdminAccess": {
  9829. // "default": "false",
  9830. // "description": "Issue the request as a domain administrator; if set to true, then the requester will be granted access if they are an administrator of the domain to which the item belongs.",
  9831. // "location": "query",
  9832. // "type": "boolean"
  9833. // }
  9834. // },
  9835. // "path": "files/{fileId}/permissions",
  9836. // "response": {
  9837. // "$ref": "PermissionList"
  9838. // },
  9839. // "scopes": [
  9840. // "https://www.googleapis.com/auth/drive",
  9841. // "https://www.googleapis.com/auth/drive.file",
  9842. // "https://www.googleapis.com/auth/drive.metadata",
  9843. // "https://www.googleapis.com/auth/drive.metadata.readonly",
  9844. // "https://www.googleapis.com/auth/drive.photos.readonly",
  9845. // "https://www.googleapis.com/auth/drive.readonly"
  9846. // ]
  9847. // }
  9848. }
  9849. // Pages invokes f for each page of results.
  9850. // A non-nil error returned from f will halt the iteration.
  9851. // The provided context supersedes any context provided to the Context method.
  9852. func (c *PermissionsListCall) Pages(ctx context.Context, f func(*PermissionList) error) error {
  9853. c.ctx_ = ctx
  9854. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  9855. for {
  9856. x, err := c.Do()
  9857. if err != nil {
  9858. return err
  9859. }
  9860. if err := f(x); err != nil {
  9861. return err
  9862. }
  9863. if x.NextPageToken == "" {
  9864. return nil
  9865. }
  9866. c.PageToken(x.NextPageToken)
  9867. }
  9868. }
  9869. // method id "drive.permissions.patch":
  9870. type PermissionsPatchCall struct {
  9871. s *Service
  9872. fileId string
  9873. permissionId string
  9874. permission *Permission
  9875. urlParams_ gensupport.URLParams
  9876. ctx_ context.Context
  9877. header_ http.Header
  9878. }
  9879. // Patch: Updates a permission using patch semantics.
  9880. func (r *PermissionsService) Patch(fileId string, permissionId string, permission *Permission) *PermissionsPatchCall {
  9881. c := &PermissionsPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  9882. c.fileId = fileId
  9883. c.permissionId = permissionId
  9884. c.permission = permission
  9885. return c
  9886. }
  9887. // RemoveExpiration sets the optional parameter "removeExpiration":
  9888. // Whether to remove the expiration date.
  9889. func (c *PermissionsPatchCall) RemoveExpiration(removeExpiration bool) *PermissionsPatchCall {
  9890. c.urlParams_.Set("removeExpiration", fmt.Sprint(removeExpiration))
  9891. return c
  9892. }
  9893. // SupportsTeamDrives sets the optional parameter "supportsTeamDrives":
  9894. // Whether the requesting application supports Team Drives.
  9895. func (c *PermissionsPatchCall) SupportsTeamDrives(supportsTeamDrives bool) *PermissionsPatchCall {
  9896. c.urlParams_.Set("supportsTeamDrives", fmt.Sprint(supportsTeamDrives))
  9897. return c
  9898. }
  9899. // TransferOwnership sets the optional parameter "transferOwnership":
  9900. // Whether changing a role to 'owner' downgrades the current owners to
  9901. // writers. Does nothing if the specified role is not 'owner'.
  9902. func (c *PermissionsPatchCall) TransferOwnership(transferOwnership bool) *PermissionsPatchCall {
  9903. c.urlParams_.Set("transferOwnership", fmt.Sprint(transferOwnership))
  9904. return c
  9905. }
  9906. // UseDomainAdminAccess sets the optional parameter
  9907. // "useDomainAdminAccess": Issue the request as a domain administrator;
  9908. // if set to true, then the requester will be granted access if they are
  9909. // an administrator of the domain to which the item belongs.
  9910. func (c *PermissionsPatchCall) UseDomainAdminAccess(useDomainAdminAccess bool) *PermissionsPatchCall {
  9911. c.urlParams_.Set("useDomainAdminAccess", fmt.Sprint(useDomainAdminAccess))
  9912. return c
  9913. }
  9914. // Fields allows partial responses to be retrieved. See
  9915. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  9916. // for more information.
  9917. func (c *PermissionsPatchCall) Fields(s ...googleapi.Field) *PermissionsPatchCall {
  9918. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  9919. return c
  9920. }
  9921. // Context sets the context to be used in this call's Do method. Any
  9922. // pending HTTP request will be aborted if the provided context is
  9923. // canceled.
  9924. func (c *PermissionsPatchCall) Context(ctx context.Context) *PermissionsPatchCall {
  9925. c.ctx_ = ctx
  9926. return c
  9927. }
  9928. // Header returns an http.Header that can be modified by the caller to
  9929. // add HTTP headers to the request.
  9930. func (c *PermissionsPatchCall) Header() http.Header {
  9931. if c.header_ == nil {
  9932. c.header_ = make(http.Header)
  9933. }
  9934. return c.header_
  9935. }
  9936. func (c *PermissionsPatchCall) doRequest(alt string) (*http.Response, error) {
  9937. reqHeaders := make(http.Header)
  9938. for k, v := range c.header_ {
  9939. reqHeaders[k] = v
  9940. }
  9941. reqHeaders.Set("User-Agent", c.s.userAgent())
  9942. var body io.Reader = nil
  9943. body, err := googleapi.WithoutDataWrapper.JSONReader(c.permission)
  9944. if err != nil {
  9945. return nil, err
  9946. }
  9947. reqHeaders.Set("Content-Type", "application/json")
  9948. c.urlParams_.Set("alt", alt)
  9949. c.urlParams_.Set("prettyPrint", "false")
  9950. urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/permissions/{permissionId}")
  9951. urls += "?" + c.urlParams_.Encode()
  9952. req, err := http.NewRequest("PATCH", urls, body)
  9953. if err != nil {
  9954. return nil, err
  9955. }
  9956. req.Header = reqHeaders
  9957. googleapi.Expand(req.URL, map[string]string{
  9958. "fileId": c.fileId,
  9959. "permissionId": c.permissionId,
  9960. })
  9961. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  9962. }
  9963. // Do executes the "drive.permissions.patch" call.
  9964. // Exactly one of *Permission or error will be non-nil. Any non-2xx
  9965. // status code is an error. Response headers are in either
  9966. // *Permission.ServerResponse.Header or (if a response was returned at
  9967. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  9968. // to check whether the returned error was because
  9969. // http.StatusNotModified was returned.
  9970. func (c *PermissionsPatchCall) Do(opts ...googleapi.CallOption) (*Permission, error) {
  9971. gensupport.SetOptions(c.urlParams_, opts...)
  9972. res, err := c.doRequest("json")
  9973. if res != nil && res.StatusCode == http.StatusNotModified {
  9974. if res.Body != nil {
  9975. res.Body.Close()
  9976. }
  9977. return nil, &googleapi.Error{
  9978. Code: res.StatusCode,
  9979. Header: res.Header,
  9980. }
  9981. }
  9982. if err != nil {
  9983. return nil, err
  9984. }
  9985. defer googleapi.CloseBody(res)
  9986. if err := googleapi.CheckResponse(res); err != nil {
  9987. return nil, err
  9988. }
  9989. ret := &Permission{
  9990. ServerResponse: googleapi.ServerResponse{
  9991. Header: res.Header,
  9992. HTTPStatusCode: res.StatusCode,
  9993. },
  9994. }
  9995. target := &ret
  9996. if err := gensupport.DecodeResponse(target, res); err != nil {
  9997. return nil, err
  9998. }
  9999. return ret, nil
  10000. // {
  10001. // "description": "Updates a permission using patch semantics.",
  10002. // "httpMethod": "PATCH",
  10003. // "id": "drive.permissions.patch",
  10004. // "parameterOrder": [
  10005. // "fileId",
  10006. // "permissionId"
  10007. // ],
  10008. // "parameters": {
  10009. // "fileId": {
  10010. // "description": "The ID for the file or Team Drive.",
  10011. // "location": "path",
  10012. // "required": true,
  10013. // "type": "string"
  10014. // },
  10015. // "permissionId": {
  10016. // "description": "The ID for the permission.",
  10017. // "location": "path",
  10018. // "required": true,
  10019. // "type": "string"
  10020. // },
  10021. // "removeExpiration": {
  10022. // "default": "false",
  10023. // "description": "Whether to remove the expiration date.",
  10024. // "location": "query",
  10025. // "type": "boolean"
  10026. // },
  10027. // "supportsTeamDrives": {
  10028. // "default": "false",
  10029. // "description": "Whether the requesting application supports Team Drives.",
  10030. // "location": "query",
  10031. // "type": "boolean"
  10032. // },
  10033. // "transferOwnership": {
  10034. // "default": "false",
  10035. // "description": "Whether changing a role to 'owner' downgrades the current owners to writers. Does nothing if the specified role is not 'owner'.",
  10036. // "location": "query",
  10037. // "type": "boolean"
  10038. // },
  10039. // "useDomainAdminAccess": {
  10040. // "default": "false",
  10041. // "description": "Issue the request as a domain administrator; if set to true, then the requester will be granted access if they are an administrator of the domain to which the item belongs.",
  10042. // "location": "query",
  10043. // "type": "boolean"
  10044. // }
  10045. // },
  10046. // "path": "files/{fileId}/permissions/{permissionId}",
  10047. // "request": {
  10048. // "$ref": "Permission"
  10049. // },
  10050. // "response": {
  10051. // "$ref": "Permission"
  10052. // },
  10053. // "scopes": [
  10054. // "https://www.googleapis.com/auth/drive",
  10055. // "https://www.googleapis.com/auth/drive.file"
  10056. // ]
  10057. // }
  10058. }
  10059. // method id "drive.permissions.update":
  10060. type PermissionsUpdateCall struct {
  10061. s *Service
  10062. fileId string
  10063. permissionId string
  10064. permission *Permission
  10065. urlParams_ gensupport.URLParams
  10066. ctx_ context.Context
  10067. header_ http.Header
  10068. }
  10069. // Update: Updates a permission.
  10070. func (r *PermissionsService) Update(fileId string, permissionId string, permission *Permission) *PermissionsUpdateCall {
  10071. c := &PermissionsUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  10072. c.fileId = fileId
  10073. c.permissionId = permissionId
  10074. c.permission = permission
  10075. return c
  10076. }
  10077. // RemoveExpiration sets the optional parameter "removeExpiration":
  10078. // Whether to remove the expiration date.
  10079. func (c *PermissionsUpdateCall) RemoveExpiration(removeExpiration bool) *PermissionsUpdateCall {
  10080. c.urlParams_.Set("removeExpiration", fmt.Sprint(removeExpiration))
  10081. return c
  10082. }
  10083. // SupportsTeamDrives sets the optional parameter "supportsTeamDrives":
  10084. // Whether the requesting application supports Team Drives.
  10085. func (c *PermissionsUpdateCall) SupportsTeamDrives(supportsTeamDrives bool) *PermissionsUpdateCall {
  10086. c.urlParams_.Set("supportsTeamDrives", fmt.Sprint(supportsTeamDrives))
  10087. return c
  10088. }
  10089. // TransferOwnership sets the optional parameter "transferOwnership":
  10090. // Whether changing a role to 'owner' downgrades the current owners to
  10091. // writers. Does nothing if the specified role is not 'owner'.
  10092. func (c *PermissionsUpdateCall) TransferOwnership(transferOwnership bool) *PermissionsUpdateCall {
  10093. c.urlParams_.Set("transferOwnership", fmt.Sprint(transferOwnership))
  10094. return c
  10095. }
  10096. // UseDomainAdminAccess sets the optional parameter
  10097. // "useDomainAdminAccess": Issue the request as a domain administrator;
  10098. // if set to true, then the requester will be granted access if they are
  10099. // an administrator of the domain to which the item belongs.
  10100. func (c *PermissionsUpdateCall) UseDomainAdminAccess(useDomainAdminAccess bool) *PermissionsUpdateCall {
  10101. c.urlParams_.Set("useDomainAdminAccess", fmt.Sprint(useDomainAdminAccess))
  10102. return c
  10103. }
  10104. // Fields allows partial responses to be retrieved. See
  10105. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  10106. // for more information.
  10107. func (c *PermissionsUpdateCall) Fields(s ...googleapi.Field) *PermissionsUpdateCall {
  10108. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  10109. return c
  10110. }
  10111. // Context sets the context to be used in this call's Do method. Any
  10112. // pending HTTP request will be aborted if the provided context is
  10113. // canceled.
  10114. func (c *PermissionsUpdateCall) Context(ctx context.Context) *PermissionsUpdateCall {
  10115. c.ctx_ = ctx
  10116. return c
  10117. }
  10118. // Header returns an http.Header that can be modified by the caller to
  10119. // add HTTP headers to the request.
  10120. func (c *PermissionsUpdateCall) Header() http.Header {
  10121. if c.header_ == nil {
  10122. c.header_ = make(http.Header)
  10123. }
  10124. return c.header_
  10125. }
  10126. func (c *PermissionsUpdateCall) doRequest(alt string) (*http.Response, error) {
  10127. reqHeaders := make(http.Header)
  10128. for k, v := range c.header_ {
  10129. reqHeaders[k] = v
  10130. }
  10131. reqHeaders.Set("User-Agent", c.s.userAgent())
  10132. var body io.Reader = nil
  10133. body, err := googleapi.WithoutDataWrapper.JSONReader(c.permission)
  10134. if err != nil {
  10135. return nil, err
  10136. }
  10137. reqHeaders.Set("Content-Type", "application/json")
  10138. c.urlParams_.Set("alt", alt)
  10139. c.urlParams_.Set("prettyPrint", "false")
  10140. urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/permissions/{permissionId}")
  10141. urls += "?" + c.urlParams_.Encode()
  10142. req, err := http.NewRequest("PUT", urls, body)
  10143. if err != nil {
  10144. return nil, err
  10145. }
  10146. req.Header = reqHeaders
  10147. googleapi.Expand(req.URL, map[string]string{
  10148. "fileId": c.fileId,
  10149. "permissionId": c.permissionId,
  10150. })
  10151. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  10152. }
  10153. // Do executes the "drive.permissions.update" call.
  10154. // Exactly one of *Permission or error will be non-nil. Any non-2xx
  10155. // status code is an error. Response headers are in either
  10156. // *Permission.ServerResponse.Header or (if a response was returned at
  10157. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  10158. // to check whether the returned error was because
  10159. // http.StatusNotModified was returned.
  10160. func (c *PermissionsUpdateCall) Do(opts ...googleapi.CallOption) (*Permission, error) {
  10161. gensupport.SetOptions(c.urlParams_, opts...)
  10162. res, err := c.doRequest("json")
  10163. if res != nil && res.StatusCode == http.StatusNotModified {
  10164. if res.Body != nil {
  10165. res.Body.Close()
  10166. }
  10167. return nil, &googleapi.Error{
  10168. Code: res.StatusCode,
  10169. Header: res.Header,
  10170. }
  10171. }
  10172. if err != nil {
  10173. return nil, err
  10174. }
  10175. defer googleapi.CloseBody(res)
  10176. if err := googleapi.CheckResponse(res); err != nil {
  10177. return nil, err
  10178. }
  10179. ret := &Permission{
  10180. ServerResponse: googleapi.ServerResponse{
  10181. Header: res.Header,
  10182. HTTPStatusCode: res.StatusCode,
  10183. },
  10184. }
  10185. target := &ret
  10186. if err := gensupport.DecodeResponse(target, res); err != nil {
  10187. return nil, err
  10188. }
  10189. return ret, nil
  10190. // {
  10191. // "description": "Updates a permission.",
  10192. // "httpMethod": "PUT",
  10193. // "id": "drive.permissions.update",
  10194. // "parameterOrder": [
  10195. // "fileId",
  10196. // "permissionId"
  10197. // ],
  10198. // "parameters": {
  10199. // "fileId": {
  10200. // "description": "The ID for the file or Team Drive.",
  10201. // "location": "path",
  10202. // "required": true,
  10203. // "type": "string"
  10204. // },
  10205. // "permissionId": {
  10206. // "description": "The ID for the permission.",
  10207. // "location": "path",
  10208. // "required": true,
  10209. // "type": "string"
  10210. // },
  10211. // "removeExpiration": {
  10212. // "default": "false",
  10213. // "description": "Whether to remove the expiration date.",
  10214. // "location": "query",
  10215. // "type": "boolean"
  10216. // },
  10217. // "supportsTeamDrives": {
  10218. // "default": "false",
  10219. // "description": "Whether the requesting application supports Team Drives.",
  10220. // "location": "query",
  10221. // "type": "boolean"
  10222. // },
  10223. // "transferOwnership": {
  10224. // "default": "false",
  10225. // "description": "Whether changing a role to 'owner' downgrades the current owners to writers. Does nothing if the specified role is not 'owner'.",
  10226. // "location": "query",
  10227. // "type": "boolean"
  10228. // },
  10229. // "useDomainAdminAccess": {
  10230. // "default": "false",
  10231. // "description": "Issue the request as a domain administrator; if set to true, then the requester will be granted access if they are an administrator of the domain to which the item belongs.",
  10232. // "location": "query",
  10233. // "type": "boolean"
  10234. // }
  10235. // },
  10236. // "path": "files/{fileId}/permissions/{permissionId}",
  10237. // "request": {
  10238. // "$ref": "Permission"
  10239. // },
  10240. // "response": {
  10241. // "$ref": "Permission"
  10242. // },
  10243. // "scopes": [
  10244. // "https://www.googleapis.com/auth/drive",
  10245. // "https://www.googleapis.com/auth/drive.file"
  10246. // ]
  10247. // }
  10248. }
  10249. // method id "drive.properties.delete":
  10250. type PropertiesDeleteCall struct {
  10251. s *Service
  10252. fileId string
  10253. propertyKey string
  10254. urlParams_ gensupport.URLParams
  10255. ctx_ context.Context
  10256. header_ http.Header
  10257. }
  10258. // Delete: Deletes a property.
  10259. func (r *PropertiesService) Delete(fileId string, propertyKey string) *PropertiesDeleteCall {
  10260. c := &PropertiesDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  10261. c.fileId = fileId
  10262. c.propertyKey = propertyKey
  10263. return c
  10264. }
  10265. // Visibility sets the optional parameter "visibility": The visibility
  10266. // of the property.
  10267. func (c *PropertiesDeleteCall) Visibility(visibility string) *PropertiesDeleteCall {
  10268. c.urlParams_.Set("visibility", visibility)
  10269. return c
  10270. }
  10271. // Fields allows partial responses to be retrieved. See
  10272. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  10273. // for more information.
  10274. func (c *PropertiesDeleteCall) Fields(s ...googleapi.Field) *PropertiesDeleteCall {
  10275. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  10276. return c
  10277. }
  10278. // Context sets the context to be used in this call's Do method. Any
  10279. // pending HTTP request will be aborted if the provided context is
  10280. // canceled.
  10281. func (c *PropertiesDeleteCall) Context(ctx context.Context) *PropertiesDeleteCall {
  10282. c.ctx_ = ctx
  10283. return c
  10284. }
  10285. // Header returns an http.Header that can be modified by the caller to
  10286. // add HTTP headers to the request.
  10287. func (c *PropertiesDeleteCall) Header() http.Header {
  10288. if c.header_ == nil {
  10289. c.header_ = make(http.Header)
  10290. }
  10291. return c.header_
  10292. }
  10293. func (c *PropertiesDeleteCall) doRequest(alt string) (*http.Response, error) {
  10294. reqHeaders := make(http.Header)
  10295. for k, v := range c.header_ {
  10296. reqHeaders[k] = v
  10297. }
  10298. reqHeaders.Set("User-Agent", c.s.userAgent())
  10299. var body io.Reader = nil
  10300. c.urlParams_.Set("alt", alt)
  10301. c.urlParams_.Set("prettyPrint", "false")
  10302. urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/properties/{propertyKey}")
  10303. urls += "?" + c.urlParams_.Encode()
  10304. req, err := http.NewRequest("DELETE", urls, body)
  10305. if err != nil {
  10306. return nil, err
  10307. }
  10308. req.Header = reqHeaders
  10309. googleapi.Expand(req.URL, map[string]string{
  10310. "fileId": c.fileId,
  10311. "propertyKey": c.propertyKey,
  10312. })
  10313. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  10314. }
  10315. // Do executes the "drive.properties.delete" call.
  10316. func (c *PropertiesDeleteCall) Do(opts ...googleapi.CallOption) error {
  10317. gensupport.SetOptions(c.urlParams_, opts...)
  10318. res, err := c.doRequest("json")
  10319. if err != nil {
  10320. return err
  10321. }
  10322. defer googleapi.CloseBody(res)
  10323. if err := googleapi.CheckResponse(res); err != nil {
  10324. return err
  10325. }
  10326. return nil
  10327. // {
  10328. // "description": "Deletes a property.",
  10329. // "httpMethod": "DELETE",
  10330. // "id": "drive.properties.delete",
  10331. // "parameterOrder": [
  10332. // "fileId",
  10333. // "propertyKey"
  10334. // ],
  10335. // "parameters": {
  10336. // "fileId": {
  10337. // "description": "The ID of the file.",
  10338. // "location": "path",
  10339. // "required": true,
  10340. // "type": "string"
  10341. // },
  10342. // "propertyKey": {
  10343. // "description": "The key of the property.",
  10344. // "location": "path",
  10345. // "required": true,
  10346. // "type": "string"
  10347. // },
  10348. // "visibility": {
  10349. // "default": "private",
  10350. // "description": "The visibility of the property.",
  10351. // "location": "query",
  10352. // "type": "string"
  10353. // }
  10354. // },
  10355. // "path": "files/{fileId}/properties/{propertyKey}",
  10356. // "scopes": [
  10357. // "https://www.googleapis.com/auth/drive",
  10358. // "https://www.googleapis.com/auth/drive.appdata",
  10359. // "https://www.googleapis.com/auth/drive.file",
  10360. // "https://www.googleapis.com/auth/drive.metadata"
  10361. // ]
  10362. // }
  10363. }
  10364. // method id "drive.properties.get":
  10365. type PropertiesGetCall struct {
  10366. s *Service
  10367. fileId string
  10368. propertyKey string
  10369. urlParams_ gensupport.URLParams
  10370. ifNoneMatch_ string
  10371. ctx_ context.Context
  10372. header_ http.Header
  10373. }
  10374. // Get: Gets a property by its key.
  10375. func (r *PropertiesService) Get(fileId string, propertyKey string) *PropertiesGetCall {
  10376. c := &PropertiesGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  10377. c.fileId = fileId
  10378. c.propertyKey = propertyKey
  10379. return c
  10380. }
  10381. // Visibility sets the optional parameter "visibility": The visibility
  10382. // of the property.
  10383. func (c *PropertiesGetCall) Visibility(visibility string) *PropertiesGetCall {
  10384. c.urlParams_.Set("visibility", visibility)
  10385. return c
  10386. }
  10387. // Fields allows partial responses to be retrieved. See
  10388. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  10389. // for more information.
  10390. func (c *PropertiesGetCall) Fields(s ...googleapi.Field) *PropertiesGetCall {
  10391. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  10392. return c
  10393. }
  10394. // IfNoneMatch sets the optional parameter which makes the operation
  10395. // fail if the object's ETag matches the given value. This is useful for
  10396. // getting updates only after the object has changed since the last
  10397. // request. Use googleapi.IsNotModified to check whether the response
  10398. // error from Do is the result of In-None-Match.
  10399. func (c *PropertiesGetCall) IfNoneMatch(entityTag string) *PropertiesGetCall {
  10400. c.ifNoneMatch_ = entityTag
  10401. return c
  10402. }
  10403. // Context sets the context to be used in this call's Do method. Any
  10404. // pending HTTP request will be aborted if the provided context is
  10405. // canceled.
  10406. func (c *PropertiesGetCall) Context(ctx context.Context) *PropertiesGetCall {
  10407. c.ctx_ = ctx
  10408. return c
  10409. }
  10410. // Header returns an http.Header that can be modified by the caller to
  10411. // add HTTP headers to the request.
  10412. func (c *PropertiesGetCall) Header() http.Header {
  10413. if c.header_ == nil {
  10414. c.header_ = make(http.Header)
  10415. }
  10416. return c.header_
  10417. }
  10418. func (c *PropertiesGetCall) doRequest(alt string) (*http.Response, error) {
  10419. reqHeaders := make(http.Header)
  10420. for k, v := range c.header_ {
  10421. reqHeaders[k] = v
  10422. }
  10423. reqHeaders.Set("User-Agent", c.s.userAgent())
  10424. if c.ifNoneMatch_ != "" {
  10425. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  10426. }
  10427. var body io.Reader = nil
  10428. c.urlParams_.Set("alt", alt)
  10429. c.urlParams_.Set("prettyPrint", "false")
  10430. urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/properties/{propertyKey}")
  10431. urls += "?" + c.urlParams_.Encode()
  10432. req, err := http.NewRequest("GET", urls, body)
  10433. if err != nil {
  10434. return nil, err
  10435. }
  10436. req.Header = reqHeaders
  10437. googleapi.Expand(req.URL, map[string]string{
  10438. "fileId": c.fileId,
  10439. "propertyKey": c.propertyKey,
  10440. })
  10441. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  10442. }
  10443. // Do executes the "drive.properties.get" call.
  10444. // Exactly one of *Property or error will be non-nil. Any non-2xx status
  10445. // code is an error. Response headers are in either
  10446. // *Property.ServerResponse.Header or (if a response was returned at
  10447. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  10448. // to check whether the returned error was because
  10449. // http.StatusNotModified was returned.
  10450. func (c *PropertiesGetCall) Do(opts ...googleapi.CallOption) (*Property, error) {
  10451. gensupport.SetOptions(c.urlParams_, opts...)
  10452. res, err := c.doRequest("json")
  10453. if res != nil && res.StatusCode == http.StatusNotModified {
  10454. if res.Body != nil {
  10455. res.Body.Close()
  10456. }
  10457. return nil, &googleapi.Error{
  10458. Code: res.StatusCode,
  10459. Header: res.Header,
  10460. }
  10461. }
  10462. if err != nil {
  10463. return nil, err
  10464. }
  10465. defer googleapi.CloseBody(res)
  10466. if err := googleapi.CheckResponse(res); err != nil {
  10467. return nil, err
  10468. }
  10469. ret := &Property{
  10470. ServerResponse: googleapi.ServerResponse{
  10471. Header: res.Header,
  10472. HTTPStatusCode: res.StatusCode,
  10473. },
  10474. }
  10475. target := &ret
  10476. if err := gensupport.DecodeResponse(target, res); err != nil {
  10477. return nil, err
  10478. }
  10479. return ret, nil
  10480. // {
  10481. // "description": "Gets a property by its key.",
  10482. // "httpMethod": "GET",
  10483. // "id": "drive.properties.get",
  10484. // "parameterOrder": [
  10485. // "fileId",
  10486. // "propertyKey"
  10487. // ],
  10488. // "parameters": {
  10489. // "fileId": {
  10490. // "description": "The ID of the file.",
  10491. // "location": "path",
  10492. // "required": true,
  10493. // "type": "string"
  10494. // },
  10495. // "propertyKey": {
  10496. // "description": "The key of the property.",
  10497. // "location": "path",
  10498. // "required": true,
  10499. // "type": "string"
  10500. // },
  10501. // "visibility": {
  10502. // "default": "private",
  10503. // "description": "The visibility of the property.",
  10504. // "location": "query",
  10505. // "type": "string"
  10506. // }
  10507. // },
  10508. // "path": "files/{fileId}/properties/{propertyKey}",
  10509. // "response": {
  10510. // "$ref": "Property"
  10511. // },
  10512. // "scopes": [
  10513. // "https://www.googleapis.com/auth/drive",
  10514. // "https://www.googleapis.com/auth/drive.appdata",
  10515. // "https://www.googleapis.com/auth/drive.file",
  10516. // "https://www.googleapis.com/auth/drive.metadata",
  10517. // "https://www.googleapis.com/auth/drive.metadata.readonly",
  10518. // "https://www.googleapis.com/auth/drive.photos.readonly",
  10519. // "https://www.googleapis.com/auth/drive.readonly"
  10520. // ]
  10521. // }
  10522. }
  10523. // method id "drive.properties.insert":
  10524. type PropertiesInsertCall struct {
  10525. s *Service
  10526. fileId string
  10527. property *Property
  10528. urlParams_ gensupport.URLParams
  10529. ctx_ context.Context
  10530. header_ http.Header
  10531. }
  10532. // Insert: Adds a property to a file, or updates it if it already
  10533. // exists.
  10534. func (r *PropertiesService) Insert(fileId string, property *Property) *PropertiesInsertCall {
  10535. c := &PropertiesInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  10536. c.fileId = fileId
  10537. c.property = property
  10538. return c
  10539. }
  10540. // Fields allows partial responses to be retrieved. See
  10541. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  10542. // for more information.
  10543. func (c *PropertiesInsertCall) Fields(s ...googleapi.Field) *PropertiesInsertCall {
  10544. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  10545. return c
  10546. }
  10547. // Context sets the context to be used in this call's Do method. Any
  10548. // pending HTTP request will be aborted if the provided context is
  10549. // canceled.
  10550. func (c *PropertiesInsertCall) Context(ctx context.Context) *PropertiesInsertCall {
  10551. c.ctx_ = ctx
  10552. return c
  10553. }
  10554. // Header returns an http.Header that can be modified by the caller to
  10555. // add HTTP headers to the request.
  10556. func (c *PropertiesInsertCall) Header() http.Header {
  10557. if c.header_ == nil {
  10558. c.header_ = make(http.Header)
  10559. }
  10560. return c.header_
  10561. }
  10562. func (c *PropertiesInsertCall) doRequest(alt string) (*http.Response, error) {
  10563. reqHeaders := make(http.Header)
  10564. for k, v := range c.header_ {
  10565. reqHeaders[k] = v
  10566. }
  10567. reqHeaders.Set("User-Agent", c.s.userAgent())
  10568. var body io.Reader = nil
  10569. body, err := googleapi.WithoutDataWrapper.JSONReader(c.property)
  10570. if err != nil {
  10571. return nil, err
  10572. }
  10573. reqHeaders.Set("Content-Type", "application/json")
  10574. c.urlParams_.Set("alt", alt)
  10575. c.urlParams_.Set("prettyPrint", "false")
  10576. urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/properties")
  10577. urls += "?" + c.urlParams_.Encode()
  10578. req, err := http.NewRequest("POST", urls, body)
  10579. if err != nil {
  10580. return nil, err
  10581. }
  10582. req.Header = reqHeaders
  10583. googleapi.Expand(req.URL, map[string]string{
  10584. "fileId": c.fileId,
  10585. })
  10586. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  10587. }
  10588. // Do executes the "drive.properties.insert" call.
  10589. // Exactly one of *Property or error will be non-nil. Any non-2xx status
  10590. // code is an error. Response headers are in either
  10591. // *Property.ServerResponse.Header or (if a response was returned at
  10592. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  10593. // to check whether the returned error was because
  10594. // http.StatusNotModified was returned.
  10595. func (c *PropertiesInsertCall) Do(opts ...googleapi.CallOption) (*Property, error) {
  10596. gensupport.SetOptions(c.urlParams_, opts...)
  10597. res, err := c.doRequest("json")
  10598. if res != nil && res.StatusCode == http.StatusNotModified {
  10599. if res.Body != nil {
  10600. res.Body.Close()
  10601. }
  10602. return nil, &googleapi.Error{
  10603. Code: res.StatusCode,
  10604. Header: res.Header,
  10605. }
  10606. }
  10607. if err != nil {
  10608. return nil, err
  10609. }
  10610. defer googleapi.CloseBody(res)
  10611. if err := googleapi.CheckResponse(res); err != nil {
  10612. return nil, err
  10613. }
  10614. ret := &Property{
  10615. ServerResponse: googleapi.ServerResponse{
  10616. Header: res.Header,
  10617. HTTPStatusCode: res.StatusCode,
  10618. },
  10619. }
  10620. target := &ret
  10621. if err := gensupport.DecodeResponse(target, res); err != nil {
  10622. return nil, err
  10623. }
  10624. return ret, nil
  10625. // {
  10626. // "description": "Adds a property to a file, or updates it if it already exists.",
  10627. // "httpMethod": "POST",
  10628. // "id": "drive.properties.insert",
  10629. // "parameterOrder": [
  10630. // "fileId"
  10631. // ],
  10632. // "parameters": {
  10633. // "fileId": {
  10634. // "description": "The ID of the file.",
  10635. // "location": "path",
  10636. // "required": true,
  10637. // "type": "string"
  10638. // }
  10639. // },
  10640. // "path": "files/{fileId}/properties",
  10641. // "request": {
  10642. // "$ref": "Property"
  10643. // },
  10644. // "response": {
  10645. // "$ref": "Property"
  10646. // },
  10647. // "scopes": [
  10648. // "https://www.googleapis.com/auth/drive",
  10649. // "https://www.googleapis.com/auth/drive.appdata",
  10650. // "https://www.googleapis.com/auth/drive.file",
  10651. // "https://www.googleapis.com/auth/drive.metadata"
  10652. // ]
  10653. // }
  10654. }
  10655. // method id "drive.properties.list":
  10656. type PropertiesListCall struct {
  10657. s *Service
  10658. fileId string
  10659. urlParams_ gensupport.URLParams
  10660. ifNoneMatch_ string
  10661. ctx_ context.Context
  10662. header_ http.Header
  10663. }
  10664. // List: Lists a file's properties.
  10665. func (r *PropertiesService) List(fileId string) *PropertiesListCall {
  10666. c := &PropertiesListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  10667. c.fileId = fileId
  10668. return c
  10669. }
  10670. // Fields allows partial responses to be retrieved. See
  10671. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  10672. // for more information.
  10673. func (c *PropertiesListCall) Fields(s ...googleapi.Field) *PropertiesListCall {
  10674. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  10675. return c
  10676. }
  10677. // IfNoneMatch sets the optional parameter which makes the operation
  10678. // fail if the object's ETag matches the given value. This is useful for
  10679. // getting updates only after the object has changed since the last
  10680. // request. Use googleapi.IsNotModified to check whether the response
  10681. // error from Do is the result of In-None-Match.
  10682. func (c *PropertiesListCall) IfNoneMatch(entityTag string) *PropertiesListCall {
  10683. c.ifNoneMatch_ = entityTag
  10684. return c
  10685. }
  10686. // Context sets the context to be used in this call's Do method. Any
  10687. // pending HTTP request will be aborted if the provided context is
  10688. // canceled.
  10689. func (c *PropertiesListCall) Context(ctx context.Context) *PropertiesListCall {
  10690. c.ctx_ = ctx
  10691. return c
  10692. }
  10693. // Header returns an http.Header that can be modified by the caller to
  10694. // add HTTP headers to the request.
  10695. func (c *PropertiesListCall) Header() http.Header {
  10696. if c.header_ == nil {
  10697. c.header_ = make(http.Header)
  10698. }
  10699. return c.header_
  10700. }
  10701. func (c *PropertiesListCall) doRequest(alt string) (*http.Response, error) {
  10702. reqHeaders := make(http.Header)
  10703. for k, v := range c.header_ {
  10704. reqHeaders[k] = v
  10705. }
  10706. reqHeaders.Set("User-Agent", c.s.userAgent())
  10707. if c.ifNoneMatch_ != "" {
  10708. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  10709. }
  10710. var body io.Reader = nil
  10711. c.urlParams_.Set("alt", alt)
  10712. c.urlParams_.Set("prettyPrint", "false")
  10713. urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/properties")
  10714. urls += "?" + c.urlParams_.Encode()
  10715. req, err := http.NewRequest("GET", urls, body)
  10716. if err != nil {
  10717. return nil, err
  10718. }
  10719. req.Header = reqHeaders
  10720. googleapi.Expand(req.URL, map[string]string{
  10721. "fileId": c.fileId,
  10722. })
  10723. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  10724. }
  10725. // Do executes the "drive.properties.list" call.
  10726. // Exactly one of *PropertyList or error will be non-nil. Any non-2xx
  10727. // status code is an error. Response headers are in either
  10728. // *PropertyList.ServerResponse.Header or (if a response was returned at
  10729. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  10730. // to check whether the returned error was because
  10731. // http.StatusNotModified was returned.
  10732. func (c *PropertiesListCall) Do(opts ...googleapi.CallOption) (*PropertyList, error) {
  10733. gensupport.SetOptions(c.urlParams_, opts...)
  10734. res, err := c.doRequest("json")
  10735. if res != nil && res.StatusCode == http.StatusNotModified {
  10736. if res.Body != nil {
  10737. res.Body.Close()
  10738. }
  10739. return nil, &googleapi.Error{
  10740. Code: res.StatusCode,
  10741. Header: res.Header,
  10742. }
  10743. }
  10744. if err != nil {
  10745. return nil, err
  10746. }
  10747. defer googleapi.CloseBody(res)
  10748. if err := googleapi.CheckResponse(res); err != nil {
  10749. return nil, err
  10750. }
  10751. ret := &PropertyList{
  10752. ServerResponse: googleapi.ServerResponse{
  10753. Header: res.Header,
  10754. HTTPStatusCode: res.StatusCode,
  10755. },
  10756. }
  10757. target := &ret
  10758. if err := gensupport.DecodeResponse(target, res); err != nil {
  10759. return nil, err
  10760. }
  10761. return ret, nil
  10762. // {
  10763. // "description": "Lists a file's properties.",
  10764. // "httpMethod": "GET",
  10765. // "id": "drive.properties.list",
  10766. // "parameterOrder": [
  10767. // "fileId"
  10768. // ],
  10769. // "parameters": {
  10770. // "fileId": {
  10771. // "description": "The ID of the file.",
  10772. // "location": "path",
  10773. // "required": true,
  10774. // "type": "string"
  10775. // }
  10776. // },
  10777. // "path": "files/{fileId}/properties",
  10778. // "response": {
  10779. // "$ref": "PropertyList"
  10780. // },
  10781. // "scopes": [
  10782. // "https://www.googleapis.com/auth/drive",
  10783. // "https://www.googleapis.com/auth/drive.appdata",
  10784. // "https://www.googleapis.com/auth/drive.file",
  10785. // "https://www.googleapis.com/auth/drive.metadata",
  10786. // "https://www.googleapis.com/auth/drive.metadata.readonly",
  10787. // "https://www.googleapis.com/auth/drive.photos.readonly",
  10788. // "https://www.googleapis.com/auth/drive.readonly"
  10789. // ]
  10790. // }
  10791. }
  10792. // method id "drive.properties.patch":
  10793. type PropertiesPatchCall struct {
  10794. s *Service
  10795. fileId string
  10796. propertyKey string
  10797. property *Property
  10798. urlParams_ gensupport.URLParams
  10799. ctx_ context.Context
  10800. header_ http.Header
  10801. }
  10802. // Patch: Updates a property.
  10803. func (r *PropertiesService) Patch(fileId string, propertyKey string, property *Property) *PropertiesPatchCall {
  10804. c := &PropertiesPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  10805. c.fileId = fileId
  10806. c.propertyKey = propertyKey
  10807. c.property = property
  10808. return c
  10809. }
  10810. // Visibility sets the optional parameter "visibility": The visibility
  10811. // of the property. Allowed values are PRIVATE and PUBLIC. (Default:
  10812. // PRIVATE)
  10813. func (c *PropertiesPatchCall) Visibility(visibility string) *PropertiesPatchCall {
  10814. c.urlParams_.Set("visibility", visibility)
  10815. return c
  10816. }
  10817. // Fields allows partial responses to be retrieved. See
  10818. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  10819. // for more information.
  10820. func (c *PropertiesPatchCall) Fields(s ...googleapi.Field) *PropertiesPatchCall {
  10821. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  10822. return c
  10823. }
  10824. // Context sets the context to be used in this call's Do method. Any
  10825. // pending HTTP request will be aborted if the provided context is
  10826. // canceled.
  10827. func (c *PropertiesPatchCall) Context(ctx context.Context) *PropertiesPatchCall {
  10828. c.ctx_ = ctx
  10829. return c
  10830. }
  10831. // Header returns an http.Header that can be modified by the caller to
  10832. // add HTTP headers to the request.
  10833. func (c *PropertiesPatchCall) Header() http.Header {
  10834. if c.header_ == nil {
  10835. c.header_ = make(http.Header)
  10836. }
  10837. return c.header_
  10838. }
  10839. func (c *PropertiesPatchCall) doRequest(alt string) (*http.Response, error) {
  10840. reqHeaders := make(http.Header)
  10841. for k, v := range c.header_ {
  10842. reqHeaders[k] = v
  10843. }
  10844. reqHeaders.Set("User-Agent", c.s.userAgent())
  10845. var body io.Reader = nil
  10846. body, err := googleapi.WithoutDataWrapper.JSONReader(c.property)
  10847. if err != nil {
  10848. return nil, err
  10849. }
  10850. reqHeaders.Set("Content-Type", "application/json")
  10851. c.urlParams_.Set("alt", alt)
  10852. c.urlParams_.Set("prettyPrint", "false")
  10853. urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/properties/{propertyKey}")
  10854. urls += "?" + c.urlParams_.Encode()
  10855. req, err := http.NewRequest("PATCH", urls, body)
  10856. if err != nil {
  10857. return nil, err
  10858. }
  10859. req.Header = reqHeaders
  10860. googleapi.Expand(req.URL, map[string]string{
  10861. "fileId": c.fileId,
  10862. "propertyKey": c.propertyKey,
  10863. })
  10864. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  10865. }
  10866. // Do executes the "drive.properties.patch" call.
  10867. // Exactly one of *Property or error will be non-nil. Any non-2xx status
  10868. // code is an error. Response headers are in either
  10869. // *Property.ServerResponse.Header or (if a response was returned at
  10870. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  10871. // to check whether the returned error was because
  10872. // http.StatusNotModified was returned.
  10873. func (c *PropertiesPatchCall) Do(opts ...googleapi.CallOption) (*Property, error) {
  10874. gensupport.SetOptions(c.urlParams_, opts...)
  10875. res, err := c.doRequest("json")
  10876. if res != nil && res.StatusCode == http.StatusNotModified {
  10877. if res.Body != nil {
  10878. res.Body.Close()
  10879. }
  10880. return nil, &googleapi.Error{
  10881. Code: res.StatusCode,
  10882. Header: res.Header,
  10883. }
  10884. }
  10885. if err != nil {
  10886. return nil, err
  10887. }
  10888. defer googleapi.CloseBody(res)
  10889. if err := googleapi.CheckResponse(res); err != nil {
  10890. return nil, err
  10891. }
  10892. ret := &Property{
  10893. ServerResponse: googleapi.ServerResponse{
  10894. Header: res.Header,
  10895. HTTPStatusCode: res.StatusCode,
  10896. },
  10897. }
  10898. target := &ret
  10899. if err := gensupport.DecodeResponse(target, res); err != nil {
  10900. return nil, err
  10901. }
  10902. return ret, nil
  10903. // {
  10904. // "description": "Updates a property.",
  10905. // "httpMethod": "PATCH",
  10906. // "id": "drive.properties.patch",
  10907. // "parameterOrder": [
  10908. // "fileId",
  10909. // "propertyKey"
  10910. // ],
  10911. // "parameters": {
  10912. // "fileId": {
  10913. // "description": "The ID of the file.",
  10914. // "location": "path",
  10915. // "required": true,
  10916. // "type": "string"
  10917. // },
  10918. // "propertyKey": {
  10919. // "description": "The key of the property.",
  10920. // "location": "path",
  10921. // "required": true,
  10922. // "type": "string"
  10923. // },
  10924. // "visibility": {
  10925. // "default": "private",
  10926. // "description": "The visibility of the property. Allowed values are PRIVATE and PUBLIC. (Default: PRIVATE)",
  10927. // "location": "query",
  10928. // "type": "string"
  10929. // }
  10930. // },
  10931. // "path": "files/{fileId}/properties/{propertyKey}",
  10932. // "request": {
  10933. // "$ref": "Property"
  10934. // },
  10935. // "response": {
  10936. // "$ref": "Property"
  10937. // },
  10938. // "scopes": [
  10939. // "https://www.googleapis.com/auth/drive",
  10940. // "https://www.googleapis.com/auth/drive.appdata",
  10941. // "https://www.googleapis.com/auth/drive.file",
  10942. // "https://www.googleapis.com/auth/drive.metadata"
  10943. // ]
  10944. // }
  10945. }
  10946. // method id "drive.properties.update":
  10947. type PropertiesUpdateCall struct {
  10948. s *Service
  10949. fileId string
  10950. propertyKey string
  10951. property *Property
  10952. urlParams_ gensupport.URLParams
  10953. ctx_ context.Context
  10954. header_ http.Header
  10955. }
  10956. // Update: Updates a property.
  10957. func (r *PropertiesService) Update(fileId string, propertyKey string, property *Property) *PropertiesUpdateCall {
  10958. c := &PropertiesUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  10959. c.fileId = fileId
  10960. c.propertyKey = propertyKey
  10961. c.property = property
  10962. return c
  10963. }
  10964. // Visibility sets the optional parameter "visibility": The visibility
  10965. // of the property. Allowed values are PRIVATE and PUBLIC. (Default:
  10966. // PRIVATE)
  10967. func (c *PropertiesUpdateCall) Visibility(visibility string) *PropertiesUpdateCall {
  10968. c.urlParams_.Set("visibility", visibility)
  10969. return c
  10970. }
  10971. // Fields allows partial responses to be retrieved. See
  10972. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  10973. // for more information.
  10974. func (c *PropertiesUpdateCall) Fields(s ...googleapi.Field) *PropertiesUpdateCall {
  10975. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  10976. return c
  10977. }
  10978. // Context sets the context to be used in this call's Do method. Any
  10979. // pending HTTP request will be aborted if the provided context is
  10980. // canceled.
  10981. func (c *PropertiesUpdateCall) Context(ctx context.Context) *PropertiesUpdateCall {
  10982. c.ctx_ = ctx
  10983. return c
  10984. }
  10985. // Header returns an http.Header that can be modified by the caller to
  10986. // add HTTP headers to the request.
  10987. func (c *PropertiesUpdateCall) Header() http.Header {
  10988. if c.header_ == nil {
  10989. c.header_ = make(http.Header)
  10990. }
  10991. return c.header_
  10992. }
  10993. func (c *PropertiesUpdateCall) doRequest(alt string) (*http.Response, error) {
  10994. reqHeaders := make(http.Header)
  10995. for k, v := range c.header_ {
  10996. reqHeaders[k] = v
  10997. }
  10998. reqHeaders.Set("User-Agent", c.s.userAgent())
  10999. var body io.Reader = nil
  11000. body, err := googleapi.WithoutDataWrapper.JSONReader(c.property)
  11001. if err != nil {
  11002. return nil, err
  11003. }
  11004. reqHeaders.Set("Content-Type", "application/json")
  11005. c.urlParams_.Set("alt", alt)
  11006. c.urlParams_.Set("prettyPrint", "false")
  11007. urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/properties/{propertyKey}")
  11008. urls += "?" + c.urlParams_.Encode()
  11009. req, err := http.NewRequest("PUT", urls, body)
  11010. if err != nil {
  11011. return nil, err
  11012. }
  11013. req.Header = reqHeaders
  11014. googleapi.Expand(req.URL, map[string]string{
  11015. "fileId": c.fileId,
  11016. "propertyKey": c.propertyKey,
  11017. })
  11018. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  11019. }
  11020. // Do executes the "drive.properties.update" call.
  11021. // Exactly one of *Property or error will be non-nil. Any non-2xx status
  11022. // code is an error. Response headers are in either
  11023. // *Property.ServerResponse.Header or (if a response was returned at
  11024. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  11025. // to check whether the returned error was because
  11026. // http.StatusNotModified was returned.
  11027. func (c *PropertiesUpdateCall) Do(opts ...googleapi.CallOption) (*Property, error) {
  11028. gensupport.SetOptions(c.urlParams_, opts...)
  11029. res, err := c.doRequest("json")
  11030. if res != nil && res.StatusCode == http.StatusNotModified {
  11031. if res.Body != nil {
  11032. res.Body.Close()
  11033. }
  11034. return nil, &googleapi.Error{
  11035. Code: res.StatusCode,
  11036. Header: res.Header,
  11037. }
  11038. }
  11039. if err != nil {
  11040. return nil, err
  11041. }
  11042. defer googleapi.CloseBody(res)
  11043. if err := googleapi.CheckResponse(res); err != nil {
  11044. return nil, err
  11045. }
  11046. ret := &Property{
  11047. ServerResponse: googleapi.ServerResponse{
  11048. Header: res.Header,
  11049. HTTPStatusCode: res.StatusCode,
  11050. },
  11051. }
  11052. target := &ret
  11053. if err := gensupport.DecodeResponse(target, res); err != nil {
  11054. return nil, err
  11055. }
  11056. return ret, nil
  11057. // {
  11058. // "description": "Updates a property.",
  11059. // "httpMethod": "PUT",
  11060. // "id": "drive.properties.update",
  11061. // "parameterOrder": [
  11062. // "fileId",
  11063. // "propertyKey"
  11064. // ],
  11065. // "parameters": {
  11066. // "fileId": {
  11067. // "description": "The ID of the file.",
  11068. // "location": "path",
  11069. // "required": true,
  11070. // "type": "string"
  11071. // },
  11072. // "propertyKey": {
  11073. // "description": "The key of the property.",
  11074. // "location": "path",
  11075. // "required": true,
  11076. // "type": "string"
  11077. // },
  11078. // "visibility": {
  11079. // "default": "private",
  11080. // "description": "The visibility of the property. Allowed values are PRIVATE and PUBLIC. (Default: PRIVATE)",
  11081. // "location": "query",
  11082. // "type": "string"
  11083. // }
  11084. // },
  11085. // "path": "files/{fileId}/properties/{propertyKey}",
  11086. // "request": {
  11087. // "$ref": "Property"
  11088. // },
  11089. // "response": {
  11090. // "$ref": "Property"
  11091. // },
  11092. // "scopes": [
  11093. // "https://www.googleapis.com/auth/drive",
  11094. // "https://www.googleapis.com/auth/drive.appdata",
  11095. // "https://www.googleapis.com/auth/drive.file",
  11096. // "https://www.googleapis.com/auth/drive.metadata"
  11097. // ]
  11098. // }
  11099. }
  11100. // method id "drive.realtime.get":
  11101. type RealtimeGetCall struct {
  11102. s *Service
  11103. fileId string
  11104. urlParams_ gensupport.URLParams
  11105. ifNoneMatch_ string
  11106. ctx_ context.Context
  11107. header_ http.Header
  11108. }
  11109. // Get: Exports the contents of the Realtime API data model associated
  11110. // with this file as JSON.
  11111. func (r *RealtimeService) Get(fileId string) *RealtimeGetCall {
  11112. c := &RealtimeGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  11113. c.fileId = fileId
  11114. return c
  11115. }
  11116. // Revision sets the optional parameter "revision": The revision of the
  11117. // Realtime API data model to export. Revisions start at 1 (the initial
  11118. // empty data model) and are incremented with each change. If this
  11119. // parameter is excluded, the most recent data model will be returned.
  11120. func (c *RealtimeGetCall) Revision(revision int64) *RealtimeGetCall {
  11121. c.urlParams_.Set("revision", fmt.Sprint(revision))
  11122. return c
  11123. }
  11124. // Fields allows partial responses to be retrieved. See
  11125. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  11126. // for more information.
  11127. func (c *RealtimeGetCall) Fields(s ...googleapi.Field) *RealtimeGetCall {
  11128. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  11129. return c
  11130. }
  11131. // IfNoneMatch sets the optional parameter which makes the operation
  11132. // fail if the object's ETag matches the given value. This is useful for
  11133. // getting updates only after the object has changed since the last
  11134. // request. Use googleapi.IsNotModified to check whether the response
  11135. // error from Do is the result of In-None-Match.
  11136. func (c *RealtimeGetCall) IfNoneMatch(entityTag string) *RealtimeGetCall {
  11137. c.ifNoneMatch_ = entityTag
  11138. return c
  11139. }
  11140. // Context sets the context to be used in this call's Do and Download
  11141. // methods. Any pending HTTP request will be aborted if the provided
  11142. // context is canceled.
  11143. func (c *RealtimeGetCall) Context(ctx context.Context) *RealtimeGetCall {
  11144. c.ctx_ = ctx
  11145. return c
  11146. }
  11147. // Header returns an http.Header that can be modified by the caller to
  11148. // add HTTP headers to the request.
  11149. func (c *RealtimeGetCall) Header() http.Header {
  11150. if c.header_ == nil {
  11151. c.header_ = make(http.Header)
  11152. }
  11153. return c.header_
  11154. }
  11155. func (c *RealtimeGetCall) doRequest(alt string) (*http.Response, error) {
  11156. reqHeaders := make(http.Header)
  11157. for k, v := range c.header_ {
  11158. reqHeaders[k] = v
  11159. }
  11160. reqHeaders.Set("User-Agent", c.s.userAgent())
  11161. if c.ifNoneMatch_ != "" {
  11162. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  11163. }
  11164. var body io.Reader = nil
  11165. c.urlParams_.Set("alt", alt)
  11166. c.urlParams_.Set("prettyPrint", "false")
  11167. urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/realtime")
  11168. urls += "?" + c.urlParams_.Encode()
  11169. req, err := http.NewRequest("GET", urls, body)
  11170. if err != nil {
  11171. return nil, err
  11172. }
  11173. req.Header = reqHeaders
  11174. googleapi.Expand(req.URL, map[string]string{
  11175. "fileId": c.fileId,
  11176. })
  11177. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  11178. }
  11179. // Download fetches the API endpoint's "media" value, instead of the normal
  11180. // API response value. If the returned error is nil, the Response is guaranteed to
  11181. // have a 2xx status code. Callers must close the Response.Body as usual.
  11182. func (c *RealtimeGetCall) Download(opts ...googleapi.CallOption) (*http.Response, error) {
  11183. gensupport.SetOptions(c.urlParams_, opts...)
  11184. res, err := c.doRequest("media")
  11185. if err != nil {
  11186. return nil, err
  11187. }
  11188. if err := googleapi.CheckMediaResponse(res); err != nil {
  11189. res.Body.Close()
  11190. return nil, err
  11191. }
  11192. return res, nil
  11193. }
  11194. // Do executes the "drive.realtime.get" call.
  11195. func (c *RealtimeGetCall) Do(opts ...googleapi.CallOption) error {
  11196. gensupport.SetOptions(c.urlParams_, opts...)
  11197. res, err := c.doRequest("json")
  11198. if err != nil {
  11199. return err
  11200. }
  11201. defer googleapi.CloseBody(res)
  11202. if err := googleapi.CheckResponse(res); err != nil {
  11203. return err
  11204. }
  11205. return nil
  11206. // {
  11207. // "description": "Exports the contents of the Realtime API data model associated with this file as JSON.",
  11208. // "httpMethod": "GET",
  11209. // "id": "drive.realtime.get",
  11210. // "parameterOrder": [
  11211. // "fileId"
  11212. // ],
  11213. // "parameters": {
  11214. // "fileId": {
  11215. // "description": "The ID of the file that the Realtime API data model is associated with.",
  11216. // "location": "path",
  11217. // "required": true,
  11218. // "type": "string"
  11219. // },
  11220. // "revision": {
  11221. // "description": "The revision of the Realtime API data model to export. Revisions start at 1 (the initial empty data model) and are incremented with each change. If this parameter is excluded, the most recent data model will be returned.",
  11222. // "format": "int32",
  11223. // "location": "query",
  11224. // "minimum": "1",
  11225. // "type": "integer"
  11226. // }
  11227. // },
  11228. // "path": "files/{fileId}/realtime",
  11229. // "scopes": [
  11230. // "https://www.googleapis.com/auth/drive",
  11231. // "https://www.googleapis.com/auth/drive.file",
  11232. // "https://www.googleapis.com/auth/drive.readonly"
  11233. // ],
  11234. // "supportsMediaDownload": true
  11235. // }
  11236. }
  11237. // method id "drive.realtime.update":
  11238. type RealtimeUpdateCall struct {
  11239. s *Service
  11240. fileId string
  11241. urlParams_ gensupport.URLParams
  11242. mediaInfo_ *gensupport.MediaInfo
  11243. ctx_ context.Context
  11244. header_ http.Header
  11245. }
  11246. // Update: Overwrites the Realtime API data model associated with this
  11247. // file with the provided JSON data model.
  11248. func (r *RealtimeService) Update(fileId string) *RealtimeUpdateCall {
  11249. c := &RealtimeUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  11250. c.fileId = fileId
  11251. return c
  11252. }
  11253. // BaseRevision sets the optional parameter "baseRevision": The revision
  11254. // of the model to diff the uploaded model against. If set, the uploaded
  11255. // model is diffed against the provided revision and those differences
  11256. // are merged with any changes made to the model after the provided
  11257. // revision. If not set, the uploaded model replaces the current model
  11258. // on the server.
  11259. func (c *RealtimeUpdateCall) BaseRevision(baseRevision string) *RealtimeUpdateCall {
  11260. c.urlParams_.Set("baseRevision", baseRevision)
  11261. return c
  11262. }
  11263. // Media specifies the media to upload in one or more chunks. The chunk
  11264. // size may be controlled by supplying a MediaOption generated by
  11265. // googleapi.ChunkSize. The chunk size defaults to
  11266. // googleapi.DefaultUploadChunkSize.The Content-Type header used in the
  11267. // upload request will be determined by sniffing the contents of r,
  11268. // unless a MediaOption generated by googleapi.ContentType is
  11269. // supplied.
  11270. // At most one of Media and ResumableMedia may be set.
  11271. func (c *RealtimeUpdateCall) Media(r io.Reader, options ...googleapi.MediaOption) *RealtimeUpdateCall {
  11272. c.mediaInfo_ = gensupport.NewInfoFromMedia(r, options)
  11273. return c
  11274. }
  11275. // ResumableMedia specifies the media to upload in chunks and can be
  11276. // canceled with ctx.
  11277. //
  11278. // Deprecated: use Media instead.
  11279. //
  11280. // At most one of Media and ResumableMedia may be set. mediaType
  11281. // identifies the MIME media type of the upload, such as "image/png". If
  11282. // mediaType is "", it will be auto-detected. The provided ctx will
  11283. // supersede any context previously provided to the Context method.
  11284. func (c *RealtimeUpdateCall) ResumableMedia(ctx context.Context, r io.ReaderAt, size int64, mediaType string) *RealtimeUpdateCall {
  11285. c.ctx_ = ctx
  11286. c.mediaInfo_ = gensupport.NewInfoFromResumableMedia(r, size, mediaType)
  11287. return c
  11288. }
  11289. // ProgressUpdater provides a callback function that will be called
  11290. // after every chunk. It should be a low-latency function in order to
  11291. // not slow down the upload operation. This should only be called when
  11292. // using ResumableMedia (as opposed to Media).
  11293. func (c *RealtimeUpdateCall) ProgressUpdater(pu googleapi.ProgressUpdater) *RealtimeUpdateCall {
  11294. c.mediaInfo_.SetProgressUpdater(pu)
  11295. return c
  11296. }
  11297. // Fields allows partial responses to be retrieved. See
  11298. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  11299. // for more information.
  11300. func (c *RealtimeUpdateCall) Fields(s ...googleapi.Field) *RealtimeUpdateCall {
  11301. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  11302. return c
  11303. }
  11304. // Context sets the context to be used in this call's Do method. Any
  11305. // pending HTTP request will be aborted if the provided context is
  11306. // canceled.
  11307. // This context will supersede any context previously provided to the
  11308. // ResumableMedia method.
  11309. func (c *RealtimeUpdateCall) Context(ctx context.Context) *RealtimeUpdateCall {
  11310. c.ctx_ = ctx
  11311. return c
  11312. }
  11313. // Header returns an http.Header that can be modified by the caller to
  11314. // add HTTP headers to the request.
  11315. func (c *RealtimeUpdateCall) Header() http.Header {
  11316. if c.header_ == nil {
  11317. c.header_ = make(http.Header)
  11318. }
  11319. return c.header_
  11320. }
  11321. func (c *RealtimeUpdateCall) doRequest(alt string) (*http.Response, error) {
  11322. reqHeaders := make(http.Header)
  11323. for k, v := range c.header_ {
  11324. reqHeaders[k] = v
  11325. }
  11326. reqHeaders.Set("User-Agent", c.s.userAgent())
  11327. var body io.Reader = nil
  11328. c.urlParams_.Set("alt", alt)
  11329. c.urlParams_.Set("prettyPrint", "false")
  11330. urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/realtime")
  11331. if c.mediaInfo_ != nil {
  11332. urls = strings.Replace(urls, "https://www.googleapis.com/", "https://www.googleapis.com/upload/", 1)
  11333. c.urlParams_.Set("uploadType", c.mediaInfo_.UploadType())
  11334. }
  11335. if body == nil {
  11336. body = new(bytes.Buffer)
  11337. reqHeaders.Set("Content-Type", "application/json")
  11338. }
  11339. body, getBody, cleanup := c.mediaInfo_.UploadRequest(reqHeaders, body)
  11340. defer cleanup()
  11341. urls += "?" + c.urlParams_.Encode()
  11342. req, err := http.NewRequest("PUT", urls, body)
  11343. if err != nil {
  11344. return nil, err
  11345. }
  11346. req.Header = reqHeaders
  11347. req.GetBody = getBody
  11348. googleapi.Expand(req.URL, map[string]string{
  11349. "fileId": c.fileId,
  11350. })
  11351. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  11352. }
  11353. // Do executes the "drive.realtime.update" call.
  11354. func (c *RealtimeUpdateCall) Do(opts ...googleapi.CallOption) error {
  11355. gensupport.SetOptions(c.urlParams_, opts...)
  11356. res, err := c.doRequest("json")
  11357. if err != nil {
  11358. return err
  11359. }
  11360. defer googleapi.CloseBody(res)
  11361. if err := googleapi.CheckResponse(res); err != nil {
  11362. return err
  11363. }
  11364. rx := c.mediaInfo_.ResumableUpload(res.Header.Get("Location"))
  11365. if rx != nil {
  11366. rx.Client = c.s.client
  11367. rx.UserAgent = c.s.userAgent()
  11368. ctx := c.ctx_
  11369. if ctx == nil {
  11370. ctx = context.TODO()
  11371. }
  11372. res, err = rx.Upload(ctx)
  11373. if err != nil {
  11374. return err
  11375. }
  11376. defer res.Body.Close()
  11377. if err := googleapi.CheckResponse(res); err != nil {
  11378. return err
  11379. }
  11380. }
  11381. return nil
  11382. // {
  11383. // "description": "Overwrites the Realtime API data model associated with this file with the provided JSON data model.",
  11384. // "httpMethod": "PUT",
  11385. // "id": "drive.realtime.update",
  11386. // "mediaUpload": {
  11387. // "accept": [
  11388. // "*/*"
  11389. // ],
  11390. // "maxSize": "10MB",
  11391. // "protocols": {
  11392. // "resumable": {
  11393. // "multipart": true,
  11394. // "path": "/resumable/upload/drive/v2/files/{fileId}/realtime"
  11395. // },
  11396. // "simple": {
  11397. // "multipart": true,
  11398. // "path": "/upload/drive/v2/files/{fileId}/realtime"
  11399. // }
  11400. // }
  11401. // },
  11402. // "parameterOrder": [
  11403. // "fileId"
  11404. // ],
  11405. // "parameters": {
  11406. // "baseRevision": {
  11407. // "description": "The revision of the model to diff the uploaded model against. If set, the uploaded model is diffed against the provided revision and those differences are merged with any changes made to the model after the provided revision. If not set, the uploaded model replaces the current model on the server.",
  11408. // "location": "query",
  11409. // "type": "string"
  11410. // },
  11411. // "fileId": {
  11412. // "description": "The ID of the file that the Realtime API data model is associated with.",
  11413. // "location": "path",
  11414. // "required": true,
  11415. // "type": "string"
  11416. // }
  11417. // },
  11418. // "path": "files/{fileId}/realtime",
  11419. // "scopes": [
  11420. // "https://www.googleapis.com/auth/drive",
  11421. // "https://www.googleapis.com/auth/drive.file"
  11422. // ],
  11423. // "supportsMediaUpload": true
  11424. // }
  11425. }
  11426. // method id "drive.replies.delete":
  11427. type RepliesDeleteCall struct {
  11428. s *Service
  11429. fileId string
  11430. commentId string
  11431. replyId string
  11432. urlParams_ gensupport.URLParams
  11433. ctx_ context.Context
  11434. header_ http.Header
  11435. }
  11436. // Delete: Deletes a reply.
  11437. func (r *RepliesService) Delete(fileId string, commentId string, replyId string) *RepliesDeleteCall {
  11438. c := &RepliesDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  11439. c.fileId = fileId
  11440. c.commentId = commentId
  11441. c.replyId = replyId
  11442. return c
  11443. }
  11444. // Fields allows partial responses to be retrieved. See
  11445. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  11446. // for more information.
  11447. func (c *RepliesDeleteCall) Fields(s ...googleapi.Field) *RepliesDeleteCall {
  11448. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  11449. return c
  11450. }
  11451. // Context sets the context to be used in this call's Do method. Any
  11452. // pending HTTP request will be aborted if the provided context is
  11453. // canceled.
  11454. func (c *RepliesDeleteCall) Context(ctx context.Context) *RepliesDeleteCall {
  11455. c.ctx_ = ctx
  11456. return c
  11457. }
  11458. // Header returns an http.Header that can be modified by the caller to
  11459. // add HTTP headers to the request.
  11460. func (c *RepliesDeleteCall) Header() http.Header {
  11461. if c.header_ == nil {
  11462. c.header_ = make(http.Header)
  11463. }
  11464. return c.header_
  11465. }
  11466. func (c *RepliesDeleteCall) doRequest(alt string) (*http.Response, error) {
  11467. reqHeaders := make(http.Header)
  11468. for k, v := range c.header_ {
  11469. reqHeaders[k] = v
  11470. }
  11471. reqHeaders.Set("User-Agent", c.s.userAgent())
  11472. var body io.Reader = nil
  11473. c.urlParams_.Set("alt", alt)
  11474. c.urlParams_.Set("prettyPrint", "false")
  11475. urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/comments/{commentId}/replies/{replyId}")
  11476. urls += "?" + c.urlParams_.Encode()
  11477. req, err := http.NewRequest("DELETE", urls, body)
  11478. if err != nil {
  11479. return nil, err
  11480. }
  11481. req.Header = reqHeaders
  11482. googleapi.Expand(req.URL, map[string]string{
  11483. "fileId": c.fileId,
  11484. "commentId": c.commentId,
  11485. "replyId": c.replyId,
  11486. })
  11487. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  11488. }
  11489. // Do executes the "drive.replies.delete" call.
  11490. func (c *RepliesDeleteCall) Do(opts ...googleapi.CallOption) error {
  11491. gensupport.SetOptions(c.urlParams_, opts...)
  11492. res, err := c.doRequest("json")
  11493. if err != nil {
  11494. return err
  11495. }
  11496. defer googleapi.CloseBody(res)
  11497. if err := googleapi.CheckResponse(res); err != nil {
  11498. return err
  11499. }
  11500. return nil
  11501. // {
  11502. // "description": "Deletes a reply.",
  11503. // "httpMethod": "DELETE",
  11504. // "id": "drive.replies.delete",
  11505. // "parameterOrder": [
  11506. // "fileId",
  11507. // "commentId",
  11508. // "replyId"
  11509. // ],
  11510. // "parameters": {
  11511. // "commentId": {
  11512. // "description": "The ID of the comment.",
  11513. // "location": "path",
  11514. // "required": true,
  11515. // "type": "string"
  11516. // },
  11517. // "fileId": {
  11518. // "description": "The ID of the file.",
  11519. // "location": "path",
  11520. // "required": true,
  11521. // "type": "string"
  11522. // },
  11523. // "replyId": {
  11524. // "description": "The ID of the reply.",
  11525. // "location": "path",
  11526. // "required": true,
  11527. // "type": "string"
  11528. // }
  11529. // },
  11530. // "path": "files/{fileId}/comments/{commentId}/replies/{replyId}",
  11531. // "scopes": [
  11532. // "https://www.googleapis.com/auth/drive",
  11533. // "https://www.googleapis.com/auth/drive.file"
  11534. // ]
  11535. // }
  11536. }
  11537. // method id "drive.replies.get":
  11538. type RepliesGetCall struct {
  11539. s *Service
  11540. fileId string
  11541. commentId string
  11542. replyId string
  11543. urlParams_ gensupport.URLParams
  11544. ifNoneMatch_ string
  11545. ctx_ context.Context
  11546. header_ http.Header
  11547. }
  11548. // Get: Gets a reply.
  11549. func (r *RepliesService) Get(fileId string, commentId string, replyId string) *RepliesGetCall {
  11550. c := &RepliesGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  11551. c.fileId = fileId
  11552. c.commentId = commentId
  11553. c.replyId = replyId
  11554. return c
  11555. }
  11556. // IncludeDeleted sets the optional parameter "includeDeleted": If set,
  11557. // this will succeed when retrieving a deleted reply.
  11558. func (c *RepliesGetCall) IncludeDeleted(includeDeleted bool) *RepliesGetCall {
  11559. c.urlParams_.Set("includeDeleted", fmt.Sprint(includeDeleted))
  11560. return c
  11561. }
  11562. // Fields allows partial responses to be retrieved. See
  11563. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  11564. // for more information.
  11565. func (c *RepliesGetCall) Fields(s ...googleapi.Field) *RepliesGetCall {
  11566. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  11567. return c
  11568. }
  11569. // IfNoneMatch sets the optional parameter which makes the operation
  11570. // fail if the object's ETag matches the given value. This is useful for
  11571. // getting updates only after the object has changed since the last
  11572. // request. Use googleapi.IsNotModified to check whether the response
  11573. // error from Do is the result of In-None-Match.
  11574. func (c *RepliesGetCall) IfNoneMatch(entityTag string) *RepliesGetCall {
  11575. c.ifNoneMatch_ = entityTag
  11576. return c
  11577. }
  11578. // Context sets the context to be used in this call's Do method. Any
  11579. // pending HTTP request will be aborted if the provided context is
  11580. // canceled.
  11581. func (c *RepliesGetCall) Context(ctx context.Context) *RepliesGetCall {
  11582. c.ctx_ = ctx
  11583. return c
  11584. }
  11585. // Header returns an http.Header that can be modified by the caller to
  11586. // add HTTP headers to the request.
  11587. func (c *RepliesGetCall) Header() http.Header {
  11588. if c.header_ == nil {
  11589. c.header_ = make(http.Header)
  11590. }
  11591. return c.header_
  11592. }
  11593. func (c *RepliesGetCall) doRequest(alt string) (*http.Response, error) {
  11594. reqHeaders := make(http.Header)
  11595. for k, v := range c.header_ {
  11596. reqHeaders[k] = v
  11597. }
  11598. reqHeaders.Set("User-Agent", c.s.userAgent())
  11599. if c.ifNoneMatch_ != "" {
  11600. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  11601. }
  11602. var body io.Reader = nil
  11603. c.urlParams_.Set("alt", alt)
  11604. c.urlParams_.Set("prettyPrint", "false")
  11605. urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/comments/{commentId}/replies/{replyId}")
  11606. urls += "?" + c.urlParams_.Encode()
  11607. req, err := http.NewRequest("GET", urls, body)
  11608. if err != nil {
  11609. return nil, err
  11610. }
  11611. req.Header = reqHeaders
  11612. googleapi.Expand(req.URL, map[string]string{
  11613. "fileId": c.fileId,
  11614. "commentId": c.commentId,
  11615. "replyId": c.replyId,
  11616. })
  11617. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  11618. }
  11619. // Do executes the "drive.replies.get" call.
  11620. // Exactly one of *CommentReply or error will be non-nil. Any non-2xx
  11621. // status code is an error. Response headers are in either
  11622. // *CommentReply.ServerResponse.Header or (if a response was returned at
  11623. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  11624. // to check whether the returned error was because
  11625. // http.StatusNotModified was returned.
  11626. func (c *RepliesGetCall) Do(opts ...googleapi.CallOption) (*CommentReply, error) {
  11627. gensupport.SetOptions(c.urlParams_, opts...)
  11628. res, err := c.doRequest("json")
  11629. if res != nil && res.StatusCode == http.StatusNotModified {
  11630. if res.Body != nil {
  11631. res.Body.Close()
  11632. }
  11633. return nil, &googleapi.Error{
  11634. Code: res.StatusCode,
  11635. Header: res.Header,
  11636. }
  11637. }
  11638. if err != nil {
  11639. return nil, err
  11640. }
  11641. defer googleapi.CloseBody(res)
  11642. if err := googleapi.CheckResponse(res); err != nil {
  11643. return nil, err
  11644. }
  11645. ret := &CommentReply{
  11646. ServerResponse: googleapi.ServerResponse{
  11647. Header: res.Header,
  11648. HTTPStatusCode: res.StatusCode,
  11649. },
  11650. }
  11651. target := &ret
  11652. if err := gensupport.DecodeResponse(target, res); err != nil {
  11653. return nil, err
  11654. }
  11655. return ret, nil
  11656. // {
  11657. // "description": "Gets a reply.",
  11658. // "httpMethod": "GET",
  11659. // "id": "drive.replies.get",
  11660. // "parameterOrder": [
  11661. // "fileId",
  11662. // "commentId",
  11663. // "replyId"
  11664. // ],
  11665. // "parameters": {
  11666. // "commentId": {
  11667. // "description": "The ID of the comment.",
  11668. // "location": "path",
  11669. // "required": true,
  11670. // "type": "string"
  11671. // },
  11672. // "fileId": {
  11673. // "description": "The ID of the file.",
  11674. // "location": "path",
  11675. // "required": true,
  11676. // "type": "string"
  11677. // },
  11678. // "includeDeleted": {
  11679. // "default": "false",
  11680. // "description": "If set, this will succeed when retrieving a deleted reply.",
  11681. // "location": "query",
  11682. // "type": "boolean"
  11683. // },
  11684. // "replyId": {
  11685. // "description": "The ID of the reply.",
  11686. // "location": "path",
  11687. // "required": true,
  11688. // "type": "string"
  11689. // }
  11690. // },
  11691. // "path": "files/{fileId}/comments/{commentId}/replies/{replyId}",
  11692. // "response": {
  11693. // "$ref": "CommentReply"
  11694. // },
  11695. // "scopes": [
  11696. // "https://www.googleapis.com/auth/drive",
  11697. // "https://www.googleapis.com/auth/drive.file",
  11698. // "https://www.googleapis.com/auth/drive.readonly"
  11699. // ]
  11700. // }
  11701. }
  11702. // method id "drive.replies.insert":
  11703. type RepliesInsertCall struct {
  11704. s *Service
  11705. fileId string
  11706. commentId string
  11707. commentreply *CommentReply
  11708. urlParams_ gensupport.URLParams
  11709. ctx_ context.Context
  11710. header_ http.Header
  11711. }
  11712. // Insert: Creates a new reply to the given comment.
  11713. func (r *RepliesService) Insert(fileId string, commentId string, commentreply *CommentReply) *RepliesInsertCall {
  11714. c := &RepliesInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  11715. c.fileId = fileId
  11716. c.commentId = commentId
  11717. c.commentreply = commentreply
  11718. return c
  11719. }
  11720. // Fields allows partial responses to be retrieved. See
  11721. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  11722. // for more information.
  11723. func (c *RepliesInsertCall) Fields(s ...googleapi.Field) *RepliesInsertCall {
  11724. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  11725. return c
  11726. }
  11727. // Context sets the context to be used in this call's Do method. Any
  11728. // pending HTTP request will be aborted if the provided context is
  11729. // canceled.
  11730. func (c *RepliesInsertCall) Context(ctx context.Context) *RepliesInsertCall {
  11731. c.ctx_ = ctx
  11732. return c
  11733. }
  11734. // Header returns an http.Header that can be modified by the caller to
  11735. // add HTTP headers to the request.
  11736. func (c *RepliesInsertCall) Header() http.Header {
  11737. if c.header_ == nil {
  11738. c.header_ = make(http.Header)
  11739. }
  11740. return c.header_
  11741. }
  11742. func (c *RepliesInsertCall) doRequest(alt string) (*http.Response, error) {
  11743. reqHeaders := make(http.Header)
  11744. for k, v := range c.header_ {
  11745. reqHeaders[k] = v
  11746. }
  11747. reqHeaders.Set("User-Agent", c.s.userAgent())
  11748. var body io.Reader = nil
  11749. body, err := googleapi.WithoutDataWrapper.JSONReader(c.commentreply)
  11750. if err != nil {
  11751. return nil, err
  11752. }
  11753. reqHeaders.Set("Content-Type", "application/json")
  11754. c.urlParams_.Set("alt", alt)
  11755. c.urlParams_.Set("prettyPrint", "false")
  11756. urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/comments/{commentId}/replies")
  11757. urls += "?" + c.urlParams_.Encode()
  11758. req, err := http.NewRequest("POST", urls, body)
  11759. if err != nil {
  11760. return nil, err
  11761. }
  11762. req.Header = reqHeaders
  11763. googleapi.Expand(req.URL, map[string]string{
  11764. "fileId": c.fileId,
  11765. "commentId": c.commentId,
  11766. })
  11767. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  11768. }
  11769. // Do executes the "drive.replies.insert" call.
  11770. // Exactly one of *CommentReply or error will be non-nil. Any non-2xx
  11771. // status code is an error. Response headers are in either
  11772. // *CommentReply.ServerResponse.Header or (if a response was returned at
  11773. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  11774. // to check whether the returned error was because
  11775. // http.StatusNotModified was returned.
  11776. func (c *RepliesInsertCall) Do(opts ...googleapi.CallOption) (*CommentReply, error) {
  11777. gensupport.SetOptions(c.urlParams_, opts...)
  11778. res, err := c.doRequest("json")
  11779. if res != nil && res.StatusCode == http.StatusNotModified {
  11780. if res.Body != nil {
  11781. res.Body.Close()
  11782. }
  11783. return nil, &googleapi.Error{
  11784. Code: res.StatusCode,
  11785. Header: res.Header,
  11786. }
  11787. }
  11788. if err != nil {
  11789. return nil, err
  11790. }
  11791. defer googleapi.CloseBody(res)
  11792. if err := googleapi.CheckResponse(res); err != nil {
  11793. return nil, err
  11794. }
  11795. ret := &CommentReply{
  11796. ServerResponse: googleapi.ServerResponse{
  11797. Header: res.Header,
  11798. HTTPStatusCode: res.StatusCode,
  11799. },
  11800. }
  11801. target := &ret
  11802. if err := gensupport.DecodeResponse(target, res); err != nil {
  11803. return nil, err
  11804. }
  11805. return ret, nil
  11806. // {
  11807. // "description": "Creates a new reply to the given comment.",
  11808. // "httpMethod": "POST",
  11809. // "id": "drive.replies.insert",
  11810. // "parameterOrder": [
  11811. // "fileId",
  11812. // "commentId"
  11813. // ],
  11814. // "parameters": {
  11815. // "commentId": {
  11816. // "description": "The ID of the comment.",
  11817. // "location": "path",
  11818. // "required": true,
  11819. // "type": "string"
  11820. // },
  11821. // "fileId": {
  11822. // "description": "The ID of the file.",
  11823. // "location": "path",
  11824. // "required": true,
  11825. // "type": "string"
  11826. // }
  11827. // },
  11828. // "path": "files/{fileId}/comments/{commentId}/replies",
  11829. // "request": {
  11830. // "$ref": "CommentReply"
  11831. // },
  11832. // "response": {
  11833. // "$ref": "CommentReply"
  11834. // },
  11835. // "scopes": [
  11836. // "https://www.googleapis.com/auth/drive",
  11837. // "https://www.googleapis.com/auth/drive.file"
  11838. // ]
  11839. // }
  11840. }
  11841. // method id "drive.replies.list":
  11842. type RepliesListCall struct {
  11843. s *Service
  11844. fileId string
  11845. commentId string
  11846. urlParams_ gensupport.URLParams
  11847. ifNoneMatch_ string
  11848. ctx_ context.Context
  11849. header_ http.Header
  11850. }
  11851. // List: Lists all of the replies to a comment.
  11852. func (r *RepliesService) List(fileId string, commentId string) *RepliesListCall {
  11853. c := &RepliesListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  11854. c.fileId = fileId
  11855. c.commentId = commentId
  11856. return c
  11857. }
  11858. // IncludeDeleted sets the optional parameter "includeDeleted": If set,
  11859. // all replies, including deleted replies (with content stripped) will
  11860. // be returned.
  11861. func (c *RepliesListCall) IncludeDeleted(includeDeleted bool) *RepliesListCall {
  11862. c.urlParams_.Set("includeDeleted", fmt.Sprint(includeDeleted))
  11863. return c
  11864. }
  11865. // MaxResults sets the optional parameter "maxResults": The maximum
  11866. // number of replies to include in the response, used for paging.
  11867. func (c *RepliesListCall) MaxResults(maxResults int64) *RepliesListCall {
  11868. c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
  11869. return c
  11870. }
  11871. // PageToken sets the optional parameter "pageToken": The continuation
  11872. // token, used to page through large result sets. To get the next page
  11873. // of results, set this parameter to the value of "nextPageToken" from
  11874. // the previous response.
  11875. func (c *RepliesListCall) PageToken(pageToken string) *RepliesListCall {
  11876. c.urlParams_.Set("pageToken", pageToken)
  11877. return c
  11878. }
  11879. // Fields allows partial responses to be retrieved. See
  11880. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  11881. // for more information.
  11882. func (c *RepliesListCall) Fields(s ...googleapi.Field) *RepliesListCall {
  11883. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  11884. return c
  11885. }
  11886. // IfNoneMatch sets the optional parameter which makes the operation
  11887. // fail if the object's ETag matches the given value. This is useful for
  11888. // getting updates only after the object has changed since the last
  11889. // request. Use googleapi.IsNotModified to check whether the response
  11890. // error from Do is the result of In-None-Match.
  11891. func (c *RepliesListCall) IfNoneMatch(entityTag string) *RepliesListCall {
  11892. c.ifNoneMatch_ = entityTag
  11893. return c
  11894. }
  11895. // Context sets the context to be used in this call's Do method. Any
  11896. // pending HTTP request will be aborted if the provided context is
  11897. // canceled.
  11898. func (c *RepliesListCall) Context(ctx context.Context) *RepliesListCall {
  11899. c.ctx_ = ctx
  11900. return c
  11901. }
  11902. // Header returns an http.Header that can be modified by the caller to
  11903. // add HTTP headers to the request.
  11904. func (c *RepliesListCall) Header() http.Header {
  11905. if c.header_ == nil {
  11906. c.header_ = make(http.Header)
  11907. }
  11908. return c.header_
  11909. }
  11910. func (c *RepliesListCall) doRequest(alt string) (*http.Response, error) {
  11911. reqHeaders := make(http.Header)
  11912. for k, v := range c.header_ {
  11913. reqHeaders[k] = v
  11914. }
  11915. reqHeaders.Set("User-Agent", c.s.userAgent())
  11916. if c.ifNoneMatch_ != "" {
  11917. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  11918. }
  11919. var body io.Reader = nil
  11920. c.urlParams_.Set("alt", alt)
  11921. c.urlParams_.Set("prettyPrint", "false")
  11922. urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/comments/{commentId}/replies")
  11923. urls += "?" + c.urlParams_.Encode()
  11924. req, err := http.NewRequest("GET", urls, body)
  11925. if err != nil {
  11926. return nil, err
  11927. }
  11928. req.Header = reqHeaders
  11929. googleapi.Expand(req.URL, map[string]string{
  11930. "fileId": c.fileId,
  11931. "commentId": c.commentId,
  11932. })
  11933. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  11934. }
  11935. // Do executes the "drive.replies.list" call.
  11936. // Exactly one of *CommentReplyList or error will be non-nil. Any
  11937. // non-2xx status code is an error. Response headers are in either
  11938. // *CommentReplyList.ServerResponse.Header or (if a response was
  11939. // returned at all) in error.(*googleapi.Error).Header. Use
  11940. // googleapi.IsNotModified to check whether the returned error was
  11941. // because http.StatusNotModified was returned.
  11942. func (c *RepliesListCall) Do(opts ...googleapi.CallOption) (*CommentReplyList, error) {
  11943. gensupport.SetOptions(c.urlParams_, opts...)
  11944. res, err := c.doRequest("json")
  11945. if res != nil && res.StatusCode == http.StatusNotModified {
  11946. if res.Body != nil {
  11947. res.Body.Close()
  11948. }
  11949. return nil, &googleapi.Error{
  11950. Code: res.StatusCode,
  11951. Header: res.Header,
  11952. }
  11953. }
  11954. if err != nil {
  11955. return nil, err
  11956. }
  11957. defer googleapi.CloseBody(res)
  11958. if err := googleapi.CheckResponse(res); err != nil {
  11959. return nil, err
  11960. }
  11961. ret := &CommentReplyList{
  11962. ServerResponse: googleapi.ServerResponse{
  11963. Header: res.Header,
  11964. HTTPStatusCode: res.StatusCode,
  11965. },
  11966. }
  11967. target := &ret
  11968. if err := gensupport.DecodeResponse(target, res); err != nil {
  11969. return nil, err
  11970. }
  11971. return ret, nil
  11972. // {
  11973. // "description": "Lists all of the replies to a comment.",
  11974. // "httpMethod": "GET",
  11975. // "id": "drive.replies.list",
  11976. // "parameterOrder": [
  11977. // "fileId",
  11978. // "commentId"
  11979. // ],
  11980. // "parameters": {
  11981. // "commentId": {
  11982. // "description": "The ID of the comment.",
  11983. // "location": "path",
  11984. // "required": true,
  11985. // "type": "string"
  11986. // },
  11987. // "fileId": {
  11988. // "description": "The ID of the file.",
  11989. // "location": "path",
  11990. // "required": true,
  11991. // "type": "string"
  11992. // },
  11993. // "includeDeleted": {
  11994. // "default": "false",
  11995. // "description": "If set, all replies, including deleted replies (with content stripped) will be returned.",
  11996. // "location": "query",
  11997. // "type": "boolean"
  11998. // },
  11999. // "maxResults": {
  12000. // "default": "20",
  12001. // "description": "The maximum number of replies to include in the response, used for paging.",
  12002. // "format": "int32",
  12003. // "location": "query",
  12004. // "maximum": "100",
  12005. // "minimum": "0",
  12006. // "type": "integer"
  12007. // },
  12008. // "pageToken": {
  12009. // "description": "The continuation token, used to page through large result sets. To get the next page of results, set this parameter to the value of \"nextPageToken\" from the previous response.",
  12010. // "location": "query",
  12011. // "type": "string"
  12012. // }
  12013. // },
  12014. // "path": "files/{fileId}/comments/{commentId}/replies",
  12015. // "response": {
  12016. // "$ref": "CommentReplyList"
  12017. // },
  12018. // "scopes": [
  12019. // "https://www.googleapis.com/auth/drive",
  12020. // "https://www.googleapis.com/auth/drive.file",
  12021. // "https://www.googleapis.com/auth/drive.readonly"
  12022. // ]
  12023. // }
  12024. }
  12025. // Pages invokes f for each page of results.
  12026. // A non-nil error returned from f will halt the iteration.
  12027. // The provided context supersedes any context provided to the Context method.
  12028. func (c *RepliesListCall) Pages(ctx context.Context, f func(*CommentReplyList) error) error {
  12029. c.ctx_ = ctx
  12030. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  12031. for {
  12032. x, err := c.Do()
  12033. if err != nil {
  12034. return err
  12035. }
  12036. if err := f(x); err != nil {
  12037. return err
  12038. }
  12039. if x.NextPageToken == "" {
  12040. return nil
  12041. }
  12042. c.PageToken(x.NextPageToken)
  12043. }
  12044. }
  12045. // method id "drive.replies.patch":
  12046. type RepliesPatchCall struct {
  12047. s *Service
  12048. fileId string
  12049. commentId string
  12050. replyId string
  12051. commentreply *CommentReply
  12052. urlParams_ gensupport.URLParams
  12053. ctx_ context.Context
  12054. header_ http.Header
  12055. }
  12056. // Patch: Updates an existing reply. This method supports patch
  12057. // semantics.
  12058. func (r *RepliesService) Patch(fileId string, commentId string, replyId string, commentreply *CommentReply) *RepliesPatchCall {
  12059. c := &RepliesPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  12060. c.fileId = fileId
  12061. c.commentId = commentId
  12062. c.replyId = replyId
  12063. c.commentreply = commentreply
  12064. return c
  12065. }
  12066. // Fields allows partial responses to be retrieved. See
  12067. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  12068. // for more information.
  12069. func (c *RepliesPatchCall) Fields(s ...googleapi.Field) *RepliesPatchCall {
  12070. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  12071. return c
  12072. }
  12073. // Context sets the context to be used in this call's Do method. Any
  12074. // pending HTTP request will be aborted if the provided context is
  12075. // canceled.
  12076. func (c *RepliesPatchCall) Context(ctx context.Context) *RepliesPatchCall {
  12077. c.ctx_ = ctx
  12078. return c
  12079. }
  12080. // Header returns an http.Header that can be modified by the caller to
  12081. // add HTTP headers to the request.
  12082. func (c *RepliesPatchCall) Header() http.Header {
  12083. if c.header_ == nil {
  12084. c.header_ = make(http.Header)
  12085. }
  12086. return c.header_
  12087. }
  12088. func (c *RepliesPatchCall) doRequest(alt string) (*http.Response, error) {
  12089. reqHeaders := make(http.Header)
  12090. for k, v := range c.header_ {
  12091. reqHeaders[k] = v
  12092. }
  12093. reqHeaders.Set("User-Agent", c.s.userAgent())
  12094. var body io.Reader = nil
  12095. body, err := googleapi.WithoutDataWrapper.JSONReader(c.commentreply)
  12096. if err != nil {
  12097. return nil, err
  12098. }
  12099. reqHeaders.Set("Content-Type", "application/json")
  12100. c.urlParams_.Set("alt", alt)
  12101. c.urlParams_.Set("prettyPrint", "false")
  12102. urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/comments/{commentId}/replies/{replyId}")
  12103. urls += "?" + c.urlParams_.Encode()
  12104. req, err := http.NewRequest("PATCH", urls, body)
  12105. if err != nil {
  12106. return nil, err
  12107. }
  12108. req.Header = reqHeaders
  12109. googleapi.Expand(req.URL, map[string]string{
  12110. "fileId": c.fileId,
  12111. "commentId": c.commentId,
  12112. "replyId": c.replyId,
  12113. })
  12114. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  12115. }
  12116. // Do executes the "drive.replies.patch" call.
  12117. // Exactly one of *CommentReply or error will be non-nil. Any non-2xx
  12118. // status code is an error. Response headers are in either
  12119. // *CommentReply.ServerResponse.Header or (if a response was returned at
  12120. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  12121. // to check whether the returned error was because
  12122. // http.StatusNotModified was returned.
  12123. func (c *RepliesPatchCall) Do(opts ...googleapi.CallOption) (*CommentReply, error) {
  12124. gensupport.SetOptions(c.urlParams_, opts...)
  12125. res, err := c.doRequest("json")
  12126. if res != nil && res.StatusCode == http.StatusNotModified {
  12127. if res.Body != nil {
  12128. res.Body.Close()
  12129. }
  12130. return nil, &googleapi.Error{
  12131. Code: res.StatusCode,
  12132. Header: res.Header,
  12133. }
  12134. }
  12135. if err != nil {
  12136. return nil, err
  12137. }
  12138. defer googleapi.CloseBody(res)
  12139. if err := googleapi.CheckResponse(res); err != nil {
  12140. return nil, err
  12141. }
  12142. ret := &CommentReply{
  12143. ServerResponse: googleapi.ServerResponse{
  12144. Header: res.Header,
  12145. HTTPStatusCode: res.StatusCode,
  12146. },
  12147. }
  12148. target := &ret
  12149. if err := gensupport.DecodeResponse(target, res); err != nil {
  12150. return nil, err
  12151. }
  12152. return ret, nil
  12153. // {
  12154. // "description": "Updates an existing reply. This method supports patch semantics.",
  12155. // "httpMethod": "PATCH",
  12156. // "id": "drive.replies.patch",
  12157. // "parameterOrder": [
  12158. // "fileId",
  12159. // "commentId",
  12160. // "replyId"
  12161. // ],
  12162. // "parameters": {
  12163. // "commentId": {
  12164. // "description": "The ID of the comment.",
  12165. // "location": "path",
  12166. // "required": true,
  12167. // "type": "string"
  12168. // },
  12169. // "fileId": {
  12170. // "description": "The ID of the file.",
  12171. // "location": "path",
  12172. // "required": true,
  12173. // "type": "string"
  12174. // },
  12175. // "replyId": {
  12176. // "description": "The ID of the reply.",
  12177. // "location": "path",
  12178. // "required": true,
  12179. // "type": "string"
  12180. // }
  12181. // },
  12182. // "path": "files/{fileId}/comments/{commentId}/replies/{replyId}",
  12183. // "request": {
  12184. // "$ref": "CommentReply"
  12185. // },
  12186. // "response": {
  12187. // "$ref": "CommentReply"
  12188. // },
  12189. // "scopes": [
  12190. // "https://www.googleapis.com/auth/drive",
  12191. // "https://www.googleapis.com/auth/drive.file"
  12192. // ]
  12193. // }
  12194. }
  12195. // method id "drive.replies.update":
  12196. type RepliesUpdateCall struct {
  12197. s *Service
  12198. fileId string
  12199. commentId string
  12200. replyId string
  12201. commentreply *CommentReply
  12202. urlParams_ gensupport.URLParams
  12203. ctx_ context.Context
  12204. header_ http.Header
  12205. }
  12206. // Update: Updates an existing reply.
  12207. func (r *RepliesService) Update(fileId string, commentId string, replyId string, commentreply *CommentReply) *RepliesUpdateCall {
  12208. c := &RepliesUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  12209. c.fileId = fileId
  12210. c.commentId = commentId
  12211. c.replyId = replyId
  12212. c.commentreply = commentreply
  12213. return c
  12214. }
  12215. // Fields allows partial responses to be retrieved. See
  12216. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  12217. // for more information.
  12218. func (c *RepliesUpdateCall) Fields(s ...googleapi.Field) *RepliesUpdateCall {
  12219. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  12220. return c
  12221. }
  12222. // Context sets the context to be used in this call's Do method. Any
  12223. // pending HTTP request will be aborted if the provided context is
  12224. // canceled.
  12225. func (c *RepliesUpdateCall) Context(ctx context.Context) *RepliesUpdateCall {
  12226. c.ctx_ = ctx
  12227. return c
  12228. }
  12229. // Header returns an http.Header that can be modified by the caller to
  12230. // add HTTP headers to the request.
  12231. func (c *RepliesUpdateCall) Header() http.Header {
  12232. if c.header_ == nil {
  12233. c.header_ = make(http.Header)
  12234. }
  12235. return c.header_
  12236. }
  12237. func (c *RepliesUpdateCall) doRequest(alt string) (*http.Response, error) {
  12238. reqHeaders := make(http.Header)
  12239. for k, v := range c.header_ {
  12240. reqHeaders[k] = v
  12241. }
  12242. reqHeaders.Set("User-Agent", c.s.userAgent())
  12243. var body io.Reader = nil
  12244. body, err := googleapi.WithoutDataWrapper.JSONReader(c.commentreply)
  12245. if err != nil {
  12246. return nil, err
  12247. }
  12248. reqHeaders.Set("Content-Type", "application/json")
  12249. c.urlParams_.Set("alt", alt)
  12250. c.urlParams_.Set("prettyPrint", "false")
  12251. urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/comments/{commentId}/replies/{replyId}")
  12252. urls += "?" + c.urlParams_.Encode()
  12253. req, err := http.NewRequest("PUT", urls, body)
  12254. if err != nil {
  12255. return nil, err
  12256. }
  12257. req.Header = reqHeaders
  12258. googleapi.Expand(req.URL, map[string]string{
  12259. "fileId": c.fileId,
  12260. "commentId": c.commentId,
  12261. "replyId": c.replyId,
  12262. })
  12263. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  12264. }
  12265. // Do executes the "drive.replies.update" call.
  12266. // Exactly one of *CommentReply or error will be non-nil. Any non-2xx
  12267. // status code is an error. Response headers are in either
  12268. // *CommentReply.ServerResponse.Header or (if a response was returned at
  12269. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  12270. // to check whether the returned error was because
  12271. // http.StatusNotModified was returned.
  12272. func (c *RepliesUpdateCall) Do(opts ...googleapi.CallOption) (*CommentReply, error) {
  12273. gensupport.SetOptions(c.urlParams_, opts...)
  12274. res, err := c.doRequest("json")
  12275. if res != nil && res.StatusCode == http.StatusNotModified {
  12276. if res.Body != nil {
  12277. res.Body.Close()
  12278. }
  12279. return nil, &googleapi.Error{
  12280. Code: res.StatusCode,
  12281. Header: res.Header,
  12282. }
  12283. }
  12284. if err != nil {
  12285. return nil, err
  12286. }
  12287. defer googleapi.CloseBody(res)
  12288. if err := googleapi.CheckResponse(res); err != nil {
  12289. return nil, err
  12290. }
  12291. ret := &CommentReply{
  12292. ServerResponse: googleapi.ServerResponse{
  12293. Header: res.Header,
  12294. HTTPStatusCode: res.StatusCode,
  12295. },
  12296. }
  12297. target := &ret
  12298. if err := gensupport.DecodeResponse(target, res); err != nil {
  12299. return nil, err
  12300. }
  12301. return ret, nil
  12302. // {
  12303. // "description": "Updates an existing reply.",
  12304. // "httpMethod": "PUT",
  12305. // "id": "drive.replies.update",
  12306. // "parameterOrder": [
  12307. // "fileId",
  12308. // "commentId",
  12309. // "replyId"
  12310. // ],
  12311. // "parameters": {
  12312. // "commentId": {
  12313. // "description": "The ID of the comment.",
  12314. // "location": "path",
  12315. // "required": true,
  12316. // "type": "string"
  12317. // },
  12318. // "fileId": {
  12319. // "description": "The ID of the file.",
  12320. // "location": "path",
  12321. // "required": true,
  12322. // "type": "string"
  12323. // },
  12324. // "replyId": {
  12325. // "description": "The ID of the reply.",
  12326. // "location": "path",
  12327. // "required": true,
  12328. // "type": "string"
  12329. // }
  12330. // },
  12331. // "path": "files/{fileId}/comments/{commentId}/replies/{replyId}",
  12332. // "request": {
  12333. // "$ref": "CommentReply"
  12334. // },
  12335. // "response": {
  12336. // "$ref": "CommentReply"
  12337. // },
  12338. // "scopes": [
  12339. // "https://www.googleapis.com/auth/drive",
  12340. // "https://www.googleapis.com/auth/drive.file"
  12341. // ]
  12342. // }
  12343. }
  12344. // method id "drive.revisions.delete":
  12345. type RevisionsDeleteCall struct {
  12346. s *Service
  12347. fileId string
  12348. revisionId string
  12349. urlParams_ gensupport.URLParams
  12350. ctx_ context.Context
  12351. header_ http.Header
  12352. }
  12353. // Delete: Permanently deletes a file version. You can only delete
  12354. // revisions for files with binary content, like images or videos.
  12355. // Revisions for other files, like Google Docs or Sheets, and the last
  12356. // remaining file version can't be deleted.
  12357. func (r *RevisionsService) Delete(fileId string, revisionId string) *RevisionsDeleteCall {
  12358. c := &RevisionsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  12359. c.fileId = fileId
  12360. c.revisionId = revisionId
  12361. return c
  12362. }
  12363. // Fields allows partial responses to be retrieved. See
  12364. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  12365. // for more information.
  12366. func (c *RevisionsDeleteCall) Fields(s ...googleapi.Field) *RevisionsDeleteCall {
  12367. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  12368. return c
  12369. }
  12370. // Context sets the context to be used in this call's Do method. Any
  12371. // pending HTTP request will be aborted if the provided context is
  12372. // canceled.
  12373. func (c *RevisionsDeleteCall) Context(ctx context.Context) *RevisionsDeleteCall {
  12374. c.ctx_ = ctx
  12375. return c
  12376. }
  12377. // Header returns an http.Header that can be modified by the caller to
  12378. // add HTTP headers to the request.
  12379. func (c *RevisionsDeleteCall) Header() http.Header {
  12380. if c.header_ == nil {
  12381. c.header_ = make(http.Header)
  12382. }
  12383. return c.header_
  12384. }
  12385. func (c *RevisionsDeleteCall) doRequest(alt string) (*http.Response, error) {
  12386. reqHeaders := make(http.Header)
  12387. for k, v := range c.header_ {
  12388. reqHeaders[k] = v
  12389. }
  12390. reqHeaders.Set("User-Agent", c.s.userAgent())
  12391. var body io.Reader = nil
  12392. c.urlParams_.Set("alt", alt)
  12393. c.urlParams_.Set("prettyPrint", "false")
  12394. urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/revisions/{revisionId}")
  12395. urls += "?" + c.urlParams_.Encode()
  12396. req, err := http.NewRequest("DELETE", urls, body)
  12397. if err != nil {
  12398. return nil, err
  12399. }
  12400. req.Header = reqHeaders
  12401. googleapi.Expand(req.URL, map[string]string{
  12402. "fileId": c.fileId,
  12403. "revisionId": c.revisionId,
  12404. })
  12405. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  12406. }
  12407. // Do executes the "drive.revisions.delete" call.
  12408. func (c *RevisionsDeleteCall) Do(opts ...googleapi.CallOption) error {
  12409. gensupport.SetOptions(c.urlParams_, opts...)
  12410. res, err := c.doRequest("json")
  12411. if err != nil {
  12412. return err
  12413. }
  12414. defer googleapi.CloseBody(res)
  12415. if err := googleapi.CheckResponse(res); err != nil {
  12416. return err
  12417. }
  12418. return nil
  12419. // {
  12420. // "description": "Permanently deletes a file version. You can only delete revisions for files with binary content, like images or videos. Revisions for other files, like Google Docs or Sheets, and the last remaining file version can't be deleted.",
  12421. // "httpMethod": "DELETE",
  12422. // "id": "drive.revisions.delete",
  12423. // "parameterOrder": [
  12424. // "fileId",
  12425. // "revisionId"
  12426. // ],
  12427. // "parameters": {
  12428. // "fileId": {
  12429. // "description": "The ID of the file.",
  12430. // "location": "path",
  12431. // "required": true,
  12432. // "type": "string"
  12433. // },
  12434. // "revisionId": {
  12435. // "description": "The ID of the revision.",
  12436. // "location": "path",
  12437. // "required": true,
  12438. // "type": "string"
  12439. // }
  12440. // },
  12441. // "path": "files/{fileId}/revisions/{revisionId}",
  12442. // "scopes": [
  12443. // "https://www.googleapis.com/auth/drive",
  12444. // "https://www.googleapis.com/auth/drive.appdata",
  12445. // "https://www.googleapis.com/auth/drive.file"
  12446. // ]
  12447. // }
  12448. }
  12449. // method id "drive.revisions.get":
  12450. type RevisionsGetCall struct {
  12451. s *Service
  12452. fileId string
  12453. revisionId string
  12454. urlParams_ gensupport.URLParams
  12455. ifNoneMatch_ string
  12456. ctx_ context.Context
  12457. header_ http.Header
  12458. }
  12459. // Get: Gets a specific revision.
  12460. func (r *RevisionsService) Get(fileId string, revisionId string) *RevisionsGetCall {
  12461. c := &RevisionsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  12462. c.fileId = fileId
  12463. c.revisionId = revisionId
  12464. return c
  12465. }
  12466. // Fields allows partial responses to be retrieved. See
  12467. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  12468. // for more information.
  12469. func (c *RevisionsGetCall) Fields(s ...googleapi.Field) *RevisionsGetCall {
  12470. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  12471. return c
  12472. }
  12473. // IfNoneMatch sets the optional parameter which makes the operation
  12474. // fail if the object's ETag matches the given value. This is useful for
  12475. // getting updates only after the object has changed since the last
  12476. // request. Use googleapi.IsNotModified to check whether the response
  12477. // error from Do is the result of In-None-Match.
  12478. func (c *RevisionsGetCall) IfNoneMatch(entityTag string) *RevisionsGetCall {
  12479. c.ifNoneMatch_ = entityTag
  12480. return c
  12481. }
  12482. // Context sets the context to be used in this call's Do method. Any
  12483. // pending HTTP request will be aborted if the provided context is
  12484. // canceled.
  12485. func (c *RevisionsGetCall) Context(ctx context.Context) *RevisionsGetCall {
  12486. c.ctx_ = ctx
  12487. return c
  12488. }
  12489. // Header returns an http.Header that can be modified by the caller to
  12490. // add HTTP headers to the request.
  12491. func (c *RevisionsGetCall) Header() http.Header {
  12492. if c.header_ == nil {
  12493. c.header_ = make(http.Header)
  12494. }
  12495. return c.header_
  12496. }
  12497. func (c *RevisionsGetCall) doRequest(alt string) (*http.Response, error) {
  12498. reqHeaders := make(http.Header)
  12499. for k, v := range c.header_ {
  12500. reqHeaders[k] = v
  12501. }
  12502. reqHeaders.Set("User-Agent", c.s.userAgent())
  12503. if c.ifNoneMatch_ != "" {
  12504. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  12505. }
  12506. var body io.Reader = nil
  12507. c.urlParams_.Set("alt", alt)
  12508. c.urlParams_.Set("prettyPrint", "false")
  12509. urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/revisions/{revisionId}")
  12510. urls += "?" + c.urlParams_.Encode()
  12511. req, err := http.NewRequest("GET", urls, body)
  12512. if err != nil {
  12513. return nil, err
  12514. }
  12515. req.Header = reqHeaders
  12516. googleapi.Expand(req.URL, map[string]string{
  12517. "fileId": c.fileId,
  12518. "revisionId": c.revisionId,
  12519. })
  12520. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  12521. }
  12522. // Do executes the "drive.revisions.get" call.
  12523. // Exactly one of *Revision or error will be non-nil. Any non-2xx status
  12524. // code is an error. Response headers are in either
  12525. // *Revision.ServerResponse.Header or (if a response was returned at
  12526. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  12527. // to check whether the returned error was because
  12528. // http.StatusNotModified was returned.
  12529. func (c *RevisionsGetCall) Do(opts ...googleapi.CallOption) (*Revision, error) {
  12530. gensupport.SetOptions(c.urlParams_, opts...)
  12531. res, err := c.doRequest("json")
  12532. if res != nil && res.StatusCode == http.StatusNotModified {
  12533. if res.Body != nil {
  12534. res.Body.Close()
  12535. }
  12536. return nil, &googleapi.Error{
  12537. Code: res.StatusCode,
  12538. Header: res.Header,
  12539. }
  12540. }
  12541. if err != nil {
  12542. return nil, err
  12543. }
  12544. defer googleapi.CloseBody(res)
  12545. if err := googleapi.CheckResponse(res); err != nil {
  12546. return nil, err
  12547. }
  12548. ret := &Revision{
  12549. ServerResponse: googleapi.ServerResponse{
  12550. Header: res.Header,
  12551. HTTPStatusCode: res.StatusCode,
  12552. },
  12553. }
  12554. target := &ret
  12555. if err := gensupport.DecodeResponse(target, res); err != nil {
  12556. return nil, err
  12557. }
  12558. return ret, nil
  12559. // {
  12560. // "description": "Gets a specific revision.",
  12561. // "httpMethod": "GET",
  12562. // "id": "drive.revisions.get",
  12563. // "parameterOrder": [
  12564. // "fileId",
  12565. // "revisionId"
  12566. // ],
  12567. // "parameters": {
  12568. // "fileId": {
  12569. // "description": "The ID of the file.",
  12570. // "location": "path",
  12571. // "required": true,
  12572. // "type": "string"
  12573. // },
  12574. // "revisionId": {
  12575. // "description": "The ID of the revision.",
  12576. // "location": "path",
  12577. // "required": true,
  12578. // "type": "string"
  12579. // }
  12580. // },
  12581. // "path": "files/{fileId}/revisions/{revisionId}",
  12582. // "response": {
  12583. // "$ref": "Revision"
  12584. // },
  12585. // "scopes": [
  12586. // "https://www.googleapis.com/auth/drive",
  12587. // "https://www.googleapis.com/auth/drive.appdata",
  12588. // "https://www.googleapis.com/auth/drive.file",
  12589. // "https://www.googleapis.com/auth/drive.metadata",
  12590. // "https://www.googleapis.com/auth/drive.metadata.readonly",
  12591. // "https://www.googleapis.com/auth/drive.photos.readonly",
  12592. // "https://www.googleapis.com/auth/drive.readonly"
  12593. // ]
  12594. // }
  12595. }
  12596. // method id "drive.revisions.list":
  12597. type RevisionsListCall struct {
  12598. s *Service
  12599. fileId string
  12600. urlParams_ gensupport.URLParams
  12601. ifNoneMatch_ string
  12602. ctx_ context.Context
  12603. header_ http.Header
  12604. }
  12605. // List: Lists a file's revisions.
  12606. func (r *RevisionsService) List(fileId string) *RevisionsListCall {
  12607. c := &RevisionsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  12608. c.fileId = fileId
  12609. return c
  12610. }
  12611. // MaxResults sets the optional parameter "maxResults": Maximum number
  12612. // of revisions to return.
  12613. func (c *RevisionsListCall) MaxResults(maxResults int64) *RevisionsListCall {
  12614. c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
  12615. return c
  12616. }
  12617. // PageToken sets the optional parameter "pageToken": Page token for
  12618. // revisions. To get the next page of results, set this parameter to the
  12619. // value of "nextPageToken" from the previous response.
  12620. func (c *RevisionsListCall) PageToken(pageToken string) *RevisionsListCall {
  12621. c.urlParams_.Set("pageToken", pageToken)
  12622. return c
  12623. }
  12624. // Fields allows partial responses to be retrieved. See
  12625. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  12626. // for more information.
  12627. func (c *RevisionsListCall) Fields(s ...googleapi.Field) *RevisionsListCall {
  12628. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  12629. return c
  12630. }
  12631. // IfNoneMatch sets the optional parameter which makes the operation
  12632. // fail if the object's ETag matches the given value. This is useful for
  12633. // getting updates only after the object has changed since the last
  12634. // request. Use googleapi.IsNotModified to check whether the response
  12635. // error from Do is the result of In-None-Match.
  12636. func (c *RevisionsListCall) IfNoneMatch(entityTag string) *RevisionsListCall {
  12637. c.ifNoneMatch_ = entityTag
  12638. return c
  12639. }
  12640. // Context sets the context to be used in this call's Do method. Any
  12641. // pending HTTP request will be aborted if the provided context is
  12642. // canceled.
  12643. func (c *RevisionsListCall) Context(ctx context.Context) *RevisionsListCall {
  12644. c.ctx_ = ctx
  12645. return c
  12646. }
  12647. // Header returns an http.Header that can be modified by the caller to
  12648. // add HTTP headers to the request.
  12649. func (c *RevisionsListCall) Header() http.Header {
  12650. if c.header_ == nil {
  12651. c.header_ = make(http.Header)
  12652. }
  12653. return c.header_
  12654. }
  12655. func (c *RevisionsListCall) doRequest(alt string) (*http.Response, error) {
  12656. reqHeaders := make(http.Header)
  12657. for k, v := range c.header_ {
  12658. reqHeaders[k] = v
  12659. }
  12660. reqHeaders.Set("User-Agent", c.s.userAgent())
  12661. if c.ifNoneMatch_ != "" {
  12662. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  12663. }
  12664. var body io.Reader = nil
  12665. c.urlParams_.Set("alt", alt)
  12666. c.urlParams_.Set("prettyPrint", "false")
  12667. urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/revisions")
  12668. urls += "?" + c.urlParams_.Encode()
  12669. req, err := http.NewRequest("GET", urls, body)
  12670. if err != nil {
  12671. return nil, err
  12672. }
  12673. req.Header = reqHeaders
  12674. googleapi.Expand(req.URL, map[string]string{
  12675. "fileId": c.fileId,
  12676. })
  12677. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  12678. }
  12679. // Do executes the "drive.revisions.list" call.
  12680. // Exactly one of *RevisionList or error will be non-nil. Any non-2xx
  12681. // status code is an error. Response headers are in either
  12682. // *RevisionList.ServerResponse.Header or (if a response was returned at
  12683. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  12684. // to check whether the returned error was because
  12685. // http.StatusNotModified was returned.
  12686. func (c *RevisionsListCall) Do(opts ...googleapi.CallOption) (*RevisionList, error) {
  12687. gensupport.SetOptions(c.urlParams_, opts...)
  12688. res, err := c.doRequest("json")
  12689. if res != nil && res.StatusCode == http.StatusNotModified {
  12690. if res.Body != nil {
  12691. res.Body.Close()
  12692. }
  12693. return nil, &googleapi.Error{
  12694. Code: res.StatusCode,
  12695. Header: res.Header,
  12696. }
  12697. }
  12698. if err != nil {
  12699. return nil, err
  12700. }
  12701. defer googleapi.CloseBody(res)
  12702. if err := googleapi.CheckResponse(res); err != nil {
  12703. return nil, err
  12704. }
  12705. ret := &RevisionList{
  12706. ServerResponse: googleapi.ServerResponse{
  12707. Header: res.Header,
  12708. HTTPStatusCode: res.StatusCode,
  12709. },
  12710. }
  12711. target := &ret
  12712. if err := gensupport.DecodeResponse(target, res); err != nil {
  12713. return nil, err
  12714. }
  12715. return ret, nil
  12716. // {
  12717. // "description": "Lists a file's revisions.",
  12718. // "httpMethod": "GET",
  12719. // "id": "drive.revisions.list",
  12720. // "parameterOrder": [
  12721. // "fileId"
  12722. // ],
  12723. // "parameters": {
  12724. // "fileId": {
  12725. // "description": "The ID of the file.",
  12726. // "location": "path",
  12727. // "required": true,
  12728. // "type": "string"
  12729. // },
  12730. // "maxResults": {
  12731. // "default": "200",
  12732. // "description": "Maximum number of revisions to return.",
  12733. // "format": "int32",
  12734. // "location": "query",
  12735. // "maximum": "1000",
  12736. // "minimum": "1",
  12737. // "type": "integer"
  12738. // },
  12739. // "pageToken": {
  12740. // "description": "Page token for revisions. To get the next page of results, set this parameter to the value of \"nextPageToken\" from the previous response.",
  12741. // "location": "query",
  12742. // "type": "string"
  12743. // }
  12744. // },
  12745. // "path": "files/{fileId}/revisions",
  12746. // "response": {
  12747. // "$ref": "RevisionList"
  12748. // },
  12749. // "scopes": [
  12750. // "https://www.googleapis.com/auth/drive",
  12751. // "https://www.googleapis.com/auth/drive.appdata",
  12752. // "https://www.googleapis.com/auth/drive.file",
  12753. // "https://www.googleapis.com/auth/drive.metadata",
  12754. // "https://www.googleapis.com/auth/drive.metadata.readonly",
  12755. // "https://www.googleapis.com/auth/drive.photos.readonly",
  12756. // "https://www.googleapis.com/auth/drive.readonly"
  12757. // ]
  12758. // }
  12759. }
  12760. // Pages invokes f for each page of results.
  12761. // A non-nil error returned from f will halt the iteration.
  12762. // The provided context supersedes any context provided to the Context method.
  12763. func (c *RevisionsListCall) Pages(ctx context.Context, f func(*RevisionList) error) error {
  12764. c.ctx_ = ctx
  12765. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  12766. for {
  12767. x, err := c.Do()
  12768. if err != nil {
  12769. return err
  12770. }
  12771. if err := f(x); err != nil {
  12772. return err
  12773. }
  12774. if x.NextPageToken == "" {
  12775. return nil
  12776. }
  12777. c.PageToken(x.NextPageToken)
  12778. }
  12779. }
  12780. // method id "drive.revisions.patch":
  12781. type RevisionsPatchCall struct {
  12782. s *Service
  12783. fileId string
  12784. revisionId string
  12785. revision *Revision
  12786. urlParams_ gensupport.URLParams
  12787. ctx_ context.Context
  12788. header_ http.Header
  12789. }
  12790. // Patch: Updates a revision. This method supports patch semantics.
  12791. func (r *RevisionsService) Patch(fileId string, revisionId string, revision *Revision) *RevisionsPatchCall {
  12792. c := &RevisionsPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  12793. c.fileId = fileId
  12794. c.revisionId = revisionId
  12795. c.revision = revision
  12796. return c
  12797. }
  12798. // Fields allows partial responses to be retrieved. See
  12799. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  12800. // for more information.
  12801. func (c *RevisionsPatchCall) Fields(s ...googleapi.Field) *RevisionsPatchCall {
  12802. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  12803. return c
  12804. }
  12805. // Context sets the context to be used in this call's Do method. Any
  12806. // pending HTTP request will be aborted if the provided context is
  12807. // canceled.
  12808. func (c *RevisionsPatchCall) Context(ctx context.Context) *RevisionsPatchCall {
  12809. c.ctx_ = ctx
  12810. return c
  12811. }
  12812. // Header returns an http.Header that can be modified by the caller to
  12813. // add HTTP headers to the request.
  12814. func (c *RevisionsPatchCall) Header() http.Header {
  12815. if c.header_ == nil {
  12816. c.header_ = make(http.Header)
  12817. }
  12818. return c.header_
  12819. }
  12820. func (c *RevisionsPatchCall) doRequest(alt string) (*http.Response, error) {
  12821. reqHeaders := make(http.Header)
  12822. for k, v := range c.header_ {
  12823. reqHeaders[k] = v
  12824. }
  12825. reqHeaders.Set("User-Agent", c.s.userAgent())
  12826. var body io.Reader = nil
  12827. body, err := googleapi.WithoutDataWrapper.JSONReader(c.revision)
  12828. if err != nil {
  12829. return nil, err
  12830. }
  12831. reqHeaders.Set("Content-Type", "application/json")
  12832. c.urlParams_.Set("alt", alt)
  12833. c.urlParams_.Set("prettyPrint", "false")
  12834. urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/revisions/{revisionId}")
  12835. urls += "?" + c.urlParams_.Encode()
  12836. req, err := http.NewRequest("PATCH", urls, body)
  12837. if err != nil {
  12838. return nil, err
  12839. }
  12840. req.Header = reqHeaders
  12841. googleapi.Expand(req.URL, map[string]string{
  12842. "fileId": c.fileId,
  12843. "revisionId": c.revisionId,
  12844. })
  12845. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  12846. }
  12847. // Do executes the "drive.revisions.patch" call.
  12848. // Exactly one of *Revision or error will be non-nil. Any non-2xx status
  12849. // code is an error. Response headers are in either
  12850. // *Revision.ServerResponse.Header or (if a response was returned at
  12851. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  12852. // to check whether the returned error was because
  12853. // http.StatusNotModified was returned.
  12854. func (c *RevisionsPatchCall) Do(opts ...googleapi.CallOption) (*Revision, error) {
  12855. gensupport.SetOptions(c.urlParams_, opts...)
  12856. res, err := c.doRequest("json")
  12857. if res != nil && res.StatusCode == http.StatusNotModified {
  12858. if res.Body != nil {
  12859. res.Body.Close()
  12860. }
  12861. return nil, &googleapi.Error{
  12862. Code: res.StatusCode,
  12863. Header: res.Header,
  12864. }
  12865. }
  12866. if err != nil {
  12867. return nil, err
  12868. }
  12869. defer googleapi.CloseBody(res)
  12870. if err := googleapi.CheckResponse(res); err != nil {
  12871. return nil, err
  12872. }
  12873. ret := &Revision{
  12874. ServerResponse: googleapi.ServerResponse{
  12875. Header: res.Header,
  12876. HTTPStatusCode: res.StatusCode,
  12877. },
  12878. }
  12879. target := &ret
  12880. if err := gensupport.DecodeResponse(target, res); err != nil {
  12881. return nil, err
  12882. }
  12883. return ret, nil
  12884. // {
  12885. // "description": "Updates a revision. This method supports patch semantics.",
  12886. // "httpMethod": "PATCH",
  12887. // "id": "drive.revisions.patch",
  12888. // "parameterOrder": [
  12889. // "fileId",
  12890. // "revisionId"
  12891. // ],
  12892. // "parameters": {
  12893. // "fileId": {
  12894. // "description": "The ID for the file.",
  12895. // "location": "path",
  12896. // "required": true,
  12897. // "type": "string"
  12898. // },
  12899. // "revisionId": {
  12900. // "description": "The ID for the revision.",
  12901. // "location": "path",
  12902. // "required": true,
  12903. // "type": "string"
  12904. // }
  12905. // },
  12906. // "path": "files/{fileId}/revisions/{revisionId}",
  12907. // "request": {
  12908. // "$ref": "Revision"
  12909. // },
  12910. // "response": {
  12911. // "$ref": "Revision"
  12912. // },
  12913. // "scopes": [
  12914. // "https://www.googleapis.com/auth/drive",
  12915. // "https://www.googleapis.com/auth/drive.appdata",
  12916. // "https://www.googleapis.com/auth/drive.file"
  12917. // ]
  12918. // }
  12919. }
  12920. // method id "drive.revisions.update":
  12921. type RevisionsUpdateCall struct {
  12922. s *Service
  12923. fileId string
  12924. revisionId string
  12925. revision *Revision
  12926. urlParams_ gensupport.URLParams
  12927. ctx_ context.Context
  12928. header_ http.Header
  12929. }
  12930. // Update: Updates a revision.
  12931. func (r *RevisionsService) Update(fileId string, revisionId string, revision *Revision) *RevisionsUpdateCall {
  12932. c := &RevisionsUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  12933. c.fileId = fileId
  12934. c.revisionId = revisionId
  12935. c.revision = revision
  12936. return c
  12937. }
  12938. // Fields allows partial responses to be retrieved. See
  12939. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  12940. // for more information.
  12941. func (c *RevisionsUpdateCall) Fields(s ...googleapi.Field) *RevisionsUpdateCall {
  12942. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  12943. return c
  12944. }
  12945. // Context sets the context to be used in this call's Do method. Any
  12946. // pending HTTP request will be aborted if the provided context is
  12947. // canceled.
  12948. func (c *RevisionsUpdateCall) Context(ctx context.Context) *RevisionsUpdateCall {
  12949. c.ctx_ = ctx
  12950. return c
  12951. }
  12952. // Header returns an http.Header that can be modified by the caller to
  12953. // add HTTP headers to the request.
  12954. func (c *RevisionsUpdateCall) Header() http.Header {
  12955. if c.header_ == nil {
  12956. c.header_ = make(http.Header)
  12957. }
  12958. return c.header_
  12959. }
  12960. func (c *RevisionsUpdateCall) doRequest(alt string) (*http.Response, error) {
  12961. reqHeaders := make(http.Header)
  12962. for k, v := range c.header_ {
  12963. reqHeaders[k] = v
  12964. }
  12965. reqHeaders.Set("User-Agent", c.s.userAgent())
  12966. var body io.Reader = nil
  12967. body, err := googleapi.WithoutDataWrapper.JSONReader(c.revision)
  12968. if err != nil {
  12969. return nil, err
  12970. }
  12971. reqHeaders.Set("Content-Type", "application/json")
  12972. c.urlParams_.Set("alt", alt)
  12973. c.urlParams_.Set("prettyPrint", "false")
  12974. urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/revisions/{revisionId}")
  12975. urls += "?" + c.urlParams_.Encode()
  12976. req, err := http.NewRequest("PUT", urls, body)
  12977. if err != nil {
  12978. return nil, err
  12979. }
  12980. req.Header = reqHeaders
  12981. googleapi.Expand(req.URL, map[string]string{
  12982. "fileId": c.fileId,
  12983. "revisionId": c.revisionId,
  12984. })
  12985. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  12986. }
  12987. // Do executes the "drive.revisions.update" call.
  12988. // Exactly one of *Revision or error will be non-nil. Any non-2xx status
  12989. // code is an error. Response headers are in either
  12990. // *Revision.ServerResponse.Header or (if a response was returned at
  12991. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  12992. // to check whether the returned error was because
  12993. // http.StatusNotModified was returned.
  12994. func (c *RevisionsUpdateCall) Do(opts ...googleapi.CallOption) (*Revision, error) {
  12995. gensupport.SetOptions(c.urlParams_, opts...)
  12996. res, err := c.doRequest("json")
  12997. if res != nil && res.StatusCode == http.StatusNotModified {
  12998. if res.Body != nil {
  12999. res.Body.Close()
  13000. }
  13001. return nil, &googleapi.Error{
  13002. Code: res.StatusCode,
  13003. Header: res.Header,
  13004. }
  13005. }
  13006. if err != nil {
  13007. return nil, err
  13008. }
  13009. defer googleapi.CloseBody(res)
  13010. if err := googleapi.CheckResponse(res); err != nil {
  13011. return nil, err
  13012. }
  13013. ret := &Revision{
  13014. ServerResponse: googleapi.ServerResponse{
  13015. Header: res.Header,
  13016. HTTPStatusCode: res.StatusCode,
  13017. },
  13018. }
  13019. target := &ret
  13020. if err := gensupport.DecodeResponse(target, res); err != nil {
  13021. return nil, err
  13022. }
  13023. return ret, nil
  13024. // {
  13025. // "description": "Updates a revision.",
  13026. // "httpMethod": "PUT",
  13027. // "id": "drive.revisions.update",
  13028. // "parameterOrder": [
  13029. // "fileId",
  13030. // "revisionId"
  13031. // ],
  13032. // "parameters": {
  13033. // "fileId": {
  13034. // "description": "The ID for the file.",
  13035. // "location": "path",
  13036. // "required": true,
  13037. // "type": "string"
  13038. // },
  13039. // "revisionId": {
  13040. // "description": "The ID for the revision.",
  13041. // "location": "path",
  13042. // "required": true,
  13043. // "type": "string"
  13044. // }
  13045. // },
  13046. // "path": "files/{fileId}/revisions/{revisionId}",
  13047. // "request": {
  13048. // "$ref": "Revision"
  13049. // },
  13050. // "response": {
  13051. // "$ref": "Revision"
  13052. // },
  13053. // "scopes": [
  13054. // "https://www.googleapis.com/auth/drive",
  13055. // "https://www.googleapis.com/auth/drive.appdata",
  13056. // "https://www.googleapis.com/auth/drive.file"
  13057. // ]
  13058. // }
  13059. }
  13060. // method id "drive.teamdrives.delete":
  13061. type TeamdrivesDeleteCall struct {
  13062. s *Service
  13063. teamDriveId string
  13064. urlParams_ gensupport.URLParams
  13065. ctx_ context.Context
  13066. header_ http.Header
  13067. }
  13068. // Delete: Permanently deletes a Team Drive for which the user is an
  13069. // organizer. The Team Drive cannot contain any untrashed items.
  13070. func (r *TeamdrivesService) Delete(teamDriveId string) *TeamdrivesDeleteCall {
  13071. c := &TeamdrivesDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  13072. c.teamDriveId = teamDriveId
  13073. return c
  13074. }
  13075. // Fields allows partial responses to be retrieved. See
  13076. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  13077. // for more information.
  13078. func (c *TeamdrivesDeleteCall) Fields(s ...googleapi.Field) *TeamdrivesDeleteCall {
  13079. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  13080. return c
  13081. }
  13082. // Context sets the context to be used in this call's Do method. Any
  13083. // pending HTTP request will be aborted if the provided context is
  13084. // canceled.
  13085. func (c *TeamdrivesDeleteCall) Context(ctx context.Context) *TeamdrivesDeleteCall {
  13086. c.ctx_ = ctx
  13087. return c
  13088. }
  13089. // Header returns an http.Header that can be modified by the caller to
  13090. // add HTTP headers to the request.
  13091. func (c *TeamdrivesDeleteCall) Header() http.Header {
  13092. if c.header_ == nil {
  13093. c.header_ = make(http.Header)
  13094. }
  13095. return c.header_
  13096. }
  13097. func (c *TeamdrivesDeleteCall) doRequest(alt string) (*http.Response, error) {
  13098. reqHeaders := make(http.Header)
  13099. for k, v := range c.header_ {
  13100. reqHeaders[k] = v
  13101. }
  13102. reqHeaders.Set("User-Agent", c.s.userAgent())
  13103. var body io.Reader = nil
  13104. c.urlParams_.Set("alt", alt)
  13105. c.urlParams_.Set("prettyPrint", "false")
  13106. urls := googleapi.ResolveRelative(c.s.BasePath, "teamdrives/{teamDriveId}")
  13107. urls += "?" + c.urlParams_.Encode()
  13108. req, err := http.NewRequest("DELETE", urls, body)
  13109. if err != nil {
  13110. return nil, err
  13111. }
  13112. req.Header = reqHeaders
  13113. googleapi.Expand(req.URL, map[string]string{
  13114. "teamDriveId": c.teamDriveId,
  13115. })
  13116. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  13117. }
  13118. // Do executes the "drive.teamdrives.delete" call.
  13119. func (c *TeamdrivesDeleteCall) Do(opts ...googleapi.CallOption) error {
  13120. gensupport.SetOptions(c.urlParams_, opts...)
  13121. res, err := c.doRequest("json")
  13122. if err != nil {
  13123. return err
  13124. }
  13125. defer googleapi.CloseBody(res)
  13126. if err := googleapi.CheckResponse(res); err != nil {
  13127. return err
  13128. }
  13129. return nil
  13130. // {
  13131. // "description": "Permanently deletes a Team Drive for which the user is an organizer. The Team Drive cannot contain any untrashed items.",
  13132. // "httpMethod": "DELETE",
  13133. // "id": "drive.teamdrives.delete",
  13134. // "parameterOrder": [
  13135. // "teamDriveId"
  13136. // ],
  13137. // "parameters": {
  13138. // "teamDriveId": {
  13139. // "description": "The ID of the Team Drive",
  13140. // "location": "path",
  13141. // "required": true,
  13142. // "type": "string"
  13143. // }
  13144. // },
  13145. // "path": "teamdrives/{teamDriveId}",
  13146. // "scopes": [
  13147. // "https://www.googleapis.com/auth/drive"
  13148. // ]
  13149. // }
  13150. }
  13151. // method id "drive.teamdrives.get":
  13152. type TeamdrivesGetCall struct {
  13153. s *Service
  13154. teamDriveId string
  13155. urlParams_ gensupport.URLParams
  13156. ifNoneMatch_ string
  13157. ctx_ context.Context
  13158. header_ http.Header
  13159. }
  13160. // Get: Gets a Team Drive's metadata by ID.
  13161. func (r *TeamdrivesService) Get(teamDriveId string) *TeamdrivesGetCall {
  13162. c := &TeamdrivesGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  13163. c.teamDriveId = teamDriveId
  13164. return c
  13165. }
  13166. // UseDomainAdminAccess sets the optional parameter
  13167. // "useDomainAdminAccess": Issue the request as a domain administrator;
  13168. // if set to true, then the requester will be granted access if they are
  13169. // an administrator of the domain to which the Team Drive belongs.
  13170. func (c *TeamdrivesGetCall) UseDomainAdminAccess(useDomainAdminAccess bool) *TeamdrivesGetCall {
  13171. c.urlParams_.Set("useDomainAdminAccess", fmt.Sprint(useDomainAdminAccess))
  13172. return c
  13173. }
  13174. // Fields allows partial responses to be retrieved. See
  13175. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  13176. // for more information.
  13177. func (c *TeamdrivesGetCall) Fields(s ...googleapi.Field) *TeamdrivesGetCall {
  13178. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  13179. return c
  13180. }
  13181. // IfNoneMatch sets the optional parameter which makes the operation
  13182. // fail if the object's ETag matches the given value. This is useful for
  13183. // getting updates only after the object has changed since the last
  13184. // request. Use googleapi.IsNotModified to check whether the response
  13185. // error from Do is the result of In-None-Match.
  13186. func (c *TeamdrivesGetCall) IfNoneMatch(entityTag string) *TeamdrivesGetCall {
  13187. c.ifNoneMatch_ = entityTag
  13188. return c
  13189. }
  13190. // Context sets the context to be used in this call's Do method. Any
  13191. // pending HTTP request will be aborted if the provided context is
  13192. // canceled.
  13193. func (c *TeamdrivesGetCall) Context(ctx context.Context) *TeamdrivesGetCall {
  13194. c.ctx_ = ctx
  13195. return c
  13196. }
  13197. // Header returns an http.Header that can be modified by the caller to
  13198. // add HTTP headers to the request.
  13199. func (c *TeamdrivesGetCall) Header() http.Header {
  13200. if c.header_ == nil {
  13201. c.header_ = make(http.Header)
  13202. }
  13203. return c.header_
  13204. }
  13205. func (c *TeamdrivesGetCall) doRequest(alt string) (*http.Response, error) {
  13206. reqHeaders := make(http.Header)
  13207. for k, v := range c.header_ {
  13208. reqHeaders[k] = v
  13209. }
  13210. reqHeaders.Set("User-Agent", c.s.userAgent())
  13211. if c.ifNoneMatch_ != "" {
  13212. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  13213. }
  13214. var body io.Reader = nil
  13215. c.urlParams_.Set("alt", alt)
  13216. c.urlParams_.Set("prettyPrint", "false")
  13217. urls := googleapi.ResolveRelative(c.s.BasePath, "teamdrives/{teamDriveId}")
  13218. urls += "?" + c.urlParams_.Encode()
  13219. req, err := http.NewRequest("GET", urls, body)
  13220. if err != nil {
  13221. return nil, err
  13222. }
  13223. req.Header = reqHeaders
  13224. googleapi.Expand(req.URL, map[string]string{
  13225. "teamDriveId": c.teamDriveId,
  13226. })
  13227. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  13228. }
  13229. // Do executes the "drive.teamdrives.get" call.
  13230. // Exactly one of *TeamDrive or error will be non-nil. Any non-2xx
  13231. // status code is an error. Response headers are in either
  13232. // *TeamDrive.ServerResponse.Header or (if a response was returned at
  13233. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  13234. // to check whether the returned error was because
  13235. // http.StatusNotModified was returned.
  13236. func (c *TeamdrivesGetCall) Do(opts ...googleapi.CallOption) (*TeamDrive, error) {
  13237. gensupport.SetOptions(c.urlParams_, opts...)
  13238. res, err := c.doRequest("json")
  13239. if res != nil && res.StatusCode == http.StatusNotModified {
  13240. if res.Body != nil {
  13241. res.Body.Close()
  13242. }
  13243. return nil, &googleapi.Error{
  13244. Code: res.StatusCode,
  13245. Header: res.Header,
  13246. }
  13247. }
  13248. if err != nil {
  13249. return nil, err
  13250. }
  13251. defer googleapi.CloseBody(res)
  13252. if err := googleapi.CheckResponse(res); err != nil {
  13253. return nil, err
  13254. }
  13255. ret := &TeamDrive{
  13256. ServerResponse: googleapi.ServerResponse{
  13257. Header: res.Header,
  13258. HTTPStatusCode: res.StatusCode,
  13259. },
  13260. }
  13261. target := &ret
  13262. if err := gensupport.DecodeResponse(target, res); err != nil {
  13263. return nil, err
  13264. }
  13265. return ret, nil
  13266. // {
  13267. // "description": "Gets a Team Drive's metadata by ID.",
  13268. // "httpMethod": "GET",
  13269. // "id": "drive.teamdrives.get",
  13270. // "parameterOrder": [
  13271. // "teamDriveId"
  13272. // ],
  13273. // "parameters": {
  13274. // "teamDriveId": {
  13275. // "description": "The ID of the Team Drive",
  13276. // "location": "path",
  13277. // "required": true,
  13278. // "type": "string"
  13279. // },
  13280. // "useDomainAdminAccess": {
  13281. // "default": "false",
  13282. // "description": "Issue the request as a domain administrator; if set to true, then the requester will be granted access if they are an administrator of the domain to which the Team Drive belongs.",
  13283. // "location": "query",
  13284. // "type": "boolean"
  13285. // }
  13286. // },
  13287. // "path": "teamdrives/{teamDriveId}",
  13288. // "response": {
  13289. // "$ref": "TeamDrive"
  13290. // },
  13291. // "scopes": [
  13292. // "https://www.googleapis.com/auth/drive",
  13293. // "https://www.googleapis.com/auth/drive.readonly"
  13294. // ]
  13295. // }
  13296. }
  13297. // method id "drive.teamdrives.insert":
  13298. type TeamdrivesInsertCall struct {
  13299. s *Service
  13300. teamdrive *TeamDrive
  13301. urlParams_ gensupport.URLParams
  13302. ctx_ context.Context
  13303. header_ http.Header
  13304. }
  13305. // Insert: Creates a new Team Drive.
  13306. func (r *TeamdrivesService) Insert(requestId string, teamdrive *TeamDrive) *TeamdrivesInsertCall {
  13307. c := &TeamdrivesInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  13308. c.urlParams_.Set("requestId", requestId)
  13309. c.teamdrive = teamdrive
  13310. return c
  13311. }
  13312. // Fields allows partial responses to be retrieved. See
  13313. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  13314. // for more information.
  13315. func (c *TeamdrivesInsertCall) Fields(s ...googleapi.Field) *TeamdrivesInsertCall {
  13316. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  13317. return c
  13318. }
  13319. // Context sets the context to be used in this call's Do method. Any
  13320. // pending HTTP request will be aborted if the provided context is
  13321. // canceled.
  13322. func (c *TeamdrivesInsertCall) Context(ctx context.Context) *TeamdrivesInsertCall {
  13323. c.ctx_ = ctx
  13324. return c
  13325. }
  13326. // Header returns an http.Header that can be modified by the caller to
  13327. // add HTTP headers to the request.
  13328. func (c *TeamdrivesInsertCall) Header() http.Header {
  13329. if c.header_ == nil {
  13330. c.header_ = make(http.Header)
  13331. }
  13332. return c.header_
  13333. }
  13334. func (c *TeamdrivesInsertCall) doRequest(alt string) (*http.Response, error) {
  13335. reqHeaders := make(http.Header)
  13336. for k, v := range c.header_ {
  13337. reqHeaders[k] = v
  13338. }
  13339. reqHeaders.Set("User-Agent", c.s.userAgent())
  13340. var body io.Reader = nil
  13341. body, err := googleapi.WithoutDataWrapper.JSONReader(c.teamdrive)
  13342. if err != nil {
  13343. return nil, err
  13344. }
  13345. reqHeaders.Set("Content-Type", "application/json")
  13346. c.urlParams_.Set("alt", alt)
  13347. c.urlParams_.Set("prettyPrint", "false")
  13348. urls := googleapi.ResolveRelative(c.s.BasePath, "teamdrives")
  13349. urls += "?" + c.urlParams_.Encode()
  13350. req, err := http.NewRequest("POST", urls, body)
  13351. if err != nil {
  13352. return nil, err
  13353. }
  13354. req.Header = reqHeaders
  13355. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  13356. }
  13357. // Do executes the "drive.teamdrives.insert" call.
  13358. // Exactly one of *TeamDrive or error will be non-nil. Any non-2xx
  13359. // status code is an error. Response headers are in either
  13360. // *TeamDrive.ServerResponse.Header or (if a response was returned at
  13361. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  13362. // to check whether the returned error was because
  13363. // http.StatusNotModified was returned.
  13364. func (c *TeamdrivesInsertCall) Do(opts ...googleapi.CallOption) (*TeamDrive, error) {
  13365. gensupport.SetOptions(c.urlParams_, opts...)
  13366. res, err := c.doRequest("json")
  13367. if res != nil && res.StatusCode == http.StatusNotModified {
  13368. if res.Body != nil {
  13369. res.Body.Close()
  13370. }
  13371. return nil, &googleapi.Error{
  13372. Code: res.StatusCode,
  13373. Header: res.Header,
  13374. }
  13375. }
  13376. if err != nil {
  13377. return nil, err
  13378. }
  13379. defer googleapi.CloseBody(res)
  13380. if err := googleapi.CheckResponse(res); err != nil {
  13381. return nil, err
  13382. }
  13383. ret := &TeamDrive{
  13384. ServerResponse: googleapi.ServerResponse{
  13385. Header: res.Header,
  13386. HTTPStatusCode: res.StatusCode,
  13387. },
  13388. }
  13389. target := &ret
  13390. if err := gensupport.DecodeResponse(target, res); err != nil {
  13391. return nil, err
  13392. }
  13393. return ret, nil
  13394. // {
  13395. // "description": "Creates a new Team Drive.",
  13396. // "httpMethod": "POST",
  13397. // "id": "drive.teamdrives.insert",
  13398. // "parameterOrder": [
  13399. // "requestId"
  13400. // ],
  13401. // "parameters": {
  13402. // "requestId": {
  13403. // "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.",
  13404. // "location": "query",
  13405. // "required": true,
  13406. // "type": "string"
  13407. // }
  13408. // },
  13409. // "path": "teamdrives",
  13410. // "request": {
  13411. // "$ref": "TeamDrive"
  13412. // },
  13413. // "response": {
  13414. // "$ref": "TeamDrive"
  13415. // },
  13416. // "scopes": [
  13417. // "https://www.googleapis.com/auth/drive"
  13418. // ]
  13419. // }
  13420. }
  13421. // method id "drive.teamdrives.list":
  13422. type TeamdrivesListCall struct {
  13423. s *Service
  13424. urlParams_ gensupport.URLParams
  13425. ifNoneMatch_ string
  13426. ctx_ context.Context
  13427. header_ http.Header
  13428. }
  13429. // List: Lists the user's Team Drives.
  13430. func (r *TeamdrivesService) List() *TeamdrivesListCall {
  13431. c := &TeamdrivesListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  13432. return c
  13433. }
  13434. // MaxResults sets the optional parameter "maxResults": Maximum number
  13435. // of Team Drives to return.
  13436. func (c *TeamdrivesListCall) MaxResults(maxResults int64) *TeamdrivesListCall {
  13437. c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
  13438. return c
  13439. }
  13440. // PageToken sets the optional parameter "pageToken": Page token for
  13441. // Team Drives.
  13442. func (c *TeamdrivesListCall) PageToken(pageToken string) *TeamdrivesListCall {
  13443. c.urlParams_.Set("pageToken", pageToken)
  13444. return c
  13445. }
  13446. // Q sets the optional parameter "q": Query string for searching Team
  13447. // Drives.
  13448. func (c *TeamdrivesListCall) Q(q string) *TeamdrivesListCall {
  13449. c.urlParams_.Set("q", q)
  13450. return c
  13451. }
  13452. // UseDomainAdminAccess sets the optional parameter
  13453. // "useDomainAdminAccess": Issue the request as a domain administrator;
  13454. // if set to true, then all Team Drives of the domain in which the
  13455. // requester is an administrator are returned.
  13456. func (c *TeamdrivesListCall) UseDomainAdminAccess(useDomainAdminAccess bool) *TeamdrivesListCall {
  13457. c.urlParams_.Set("useDomainAdminAccess", fmt.Sprint(useDomainAdminAccess))
  13458. return c
  13459. }
  13460. // Fields allows partial responses to be retrieved. See
  13461. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  13462. // for more information.
  13463. func (c *TeamdrivesListCall) Fields(s ...googleapi.Field) *TeamdrivesListCall {
  13464. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  13465. return c
  13466. }
  13467. // IfNoneMatch sets the optional parameter which makes the operation
  13468. // fail if the object's ETag matches the given value. This is useful for
  13469. // getting updates only after the object has changed since the last
  13470. // request. Use googleapi.IsNotModified to check whether the response
  13471. // error from Do is the result of In-None-Match.
  13472. func (c *TeamdrivesListCall) IfNoneMatch(entityTag string) *TeamdrivesListCall {
  13473. c.ifNoneMatch_ = entityTag
  13474. return c
  13475. }
  13476. // Context sets the context to be used in this call's Do method. Any
  13477. // pending HTTP request will be aborted if the provided context is
  13478. // canceled.
  13479. func (c *TeamdrivesListCall) Context(ctx context.Context) *TeamdrivesListCall {
  13480. c.ctx_ = ctx
  13481. return c
  13482. }
  13483. // Header returns an http.Header that can be modified by the caller to
  13484. // add HTTP headers to the request.
  13485. func (c *TeamdrivesListCall) Header() http.Header {
  13486. if c.header_ == nil {
  13487. c.header_ = make(http.Header)
  13488. }
  13489. return c.header_
  13490. }
  13491. func (c *TeamdrivesListCall) doRequest(alt string) (*http.Response, error) {
  13492. reqHeaders := make(http.Header)
  13493. for k, v := range c.header_ {
  13494. reqHeaders[k] = v
  13495. }
  13496. reqHeaders.Set("User-Agent", c.s.userAgent())
  13497. if c.ifNoneMatch_ != "" {
  13498. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  13499. }
  13500. var body io.Reader = nil
  13501. c.urlParams_.Set("alt", alt)
  13502. c.urlParams_.Set("prettyPrint", "false")
  13503. urls := googleapi.ResolveRelative(c.s.BasePath, "teamdrives")
  13504. urls += "?" + c.urlParams_.Encode()
  13505. req, err := http.NewRequest("GET", urls, body)
  13506. if err != nil {
  13507. return nil, err
  13508. }
  13509. req.Header = reqHeaders
  13510. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  13511. }
  13512. // Do executes the "drive.teamdrives.list" call.
  13513. // Exactly one of *TeamDriveList or error will be non-nil. Any non-2xx
  13514. // status code is an error. Response headers are in either
  13515. // *TeamDriveList.ServerResponse.Header or (if a response was returned
  13516. // at all) in error.(*googleapi.Error).Header. Use
  13517. // googleapi.IsNotModified to check whether the returned error was
  13518. // because http.StatusNotModified was returned.
  13519. func (c *TeamdrivesListCall) Do(opts ...googleapi.CallOption) (*TeamDriveList, error) {
  13520. gensupport.SetOptions(c.urlParams_, opts...)
  13521. res, err := c.doRequest("json")
  13522. if res != nil && res.StatusCode == http.StatusNotModified {
  13523. if res.Body != nil {
  13524. res.Body.Close()
  13525. }
  13526. return nil, &googleapi.Error{
  13527. Code: res.StatusCode,
  13528. Header: res.Header,
  13529. }
  13530. }
  13531. if err != nil {
  13532. return nil, err
  13533. }
  13534. defer googleapi.CloseBody(res)
  13535. if err := googleapi.CheckResponse(res); err != nil {
  13536. return nil, err
  13537. }
  13538. ret := &TeamDriveList{
  13539. ServerResponse: googleapi.ServerResponse{
  13540. Header: res.Header,
  13541. HTTPStatusCode: res.StatusCode,
  13542. },
  13543. }
  13544. target := &ret
  13545. if err := gensupport.DecodeResponse(target, res); err != nil {
  13546. return nil, err
  13547. }
  13548. return ret, nil
  13549. // {
  13550. // "description": "Lists the user's Team Drives.",
  13551. // "httpMethod": "GET",
  13552. // "id": "drive.teamdrives.list",
  13553. // "parameters": {
  13554. // "maxResults": {
  13555. // "default": "10",
  13556. // "description": "Maximum number of Team Drives to return.",
  13557. // "format": "int32",
  13558. // "location": "query",
  13559. // "maximum": "100",
  13560. // "minimum": "1",
  13561. // "type": "integer"
  13562. // },
  13563. // "pageToken": {
  13564. // "description": "Page token for Team Drives.",
  13565. // "location": "query",
  13566. // "type": "string"
  13567. // },
  13568. // "q": {
  13569. // "description": "Query string for searching Team Drives.",
  13570. // "location": "query",
  13571. // "type": "string"
  13572. // },
  13573. // "useDomainAdminAccess": {
  13574. // "default": "false",
  13575. // "description": "Issue the request as a domain administrator; if set to true, then all Team Drives of the domain in which the requester is an administrator are returned.",
  13576. // "location": "query",
  13577. // "type": "boolean"
  13578. // }
  13579. // },
  13580. // "path": "teamdrives",
  13581. // "response": {
  13582. // "$ref": "TeamDriveList"
  13583. // },
  13584. // "scopes": [
  13585. // "https://www.googleapis.com/auth/drive",
  13586. // "https://www.googleapis.com/auth/drive.readonly"
  13587. // ]
  13588. // }
  13589. }
  13590. // Pages invokes f for each page of results.
  13591. // A non-nil error returned from f will halt the iteration.
  13592. // The provided context supersedes any context provided to the Context method.
  13593. func (c *TeamdrivesListCall) Pages(ctx context.Context, f func(*TeamDriveList) error) error {
  13594. c.ctx_ = ctx
  13595. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  13596. for {
  13597. x, err := c.Do()
  13598. if err != nil {
  13599. return err
  13600. }
  13601. if err := f(x); err != nil {
  13602. return err
  13603. }
  13604. if x.NextPageToken == "" {
  13605. return nil
  13606. }
  13607. c.PageToken(x.NextPageToken)
  13608. }
  13609. }
  13610. // method id "drive.teamdrives.update":
  13611. type TeamdrivesUpdateCall struct {
  13612. s *Service
  13613. teamDriveId string
  13614. teamdrive *TeamDrive
  13615. urlParams_ gensupport.URLParams
  13616. ctx_ context.Context
  13617. header_ http.Header
  13618. }
  13619. // Update: Updates a Team Drive's metadata
  13620. func (r *TeamdrivesService) Update(teamDriveId string, teamdrive *TeamDrive) *TeamdrivesUpdateCall {
  13621. c := &TeamdrivesUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  13622. c.teamDriveId = teamDriveId
  13623. c.teamdrive = teamdrive
  13624. return c
  13625. }
  13626. // UseDomainAdminAccess sets the optional parameter
  13627. // "useDomainAdminAccess": Issue the request as a domain administrator;
  13628. // if set to true, then the requester will be granted access if they are
  13629. // an administrator of the domain to which the Team Drive belongs.
  13630. func (c *TeamdrivesUpdateCall) UseDomainAdminAccess(useDomainAdminAccess bool) *TeamdrivesUpdateCall {
  13631. c.urlParams_.Set("useDomainAdminAccess", fmt.Sprint(useDomainAdminAccess))
  13632. return c
  13633. }
  13634. // Fields allows partial responses to be retrieved. See
  13635. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  13636. // for more information.
  13637. func (c *TeamdrivesUpdateCall) Fields(s ...googleapi.Field) *TeamdrivesUpdateCall {
  13638. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  13639. return c
  13640. }
  13641. // Context sets the context to be used in this call's Do method. Any
  13642. // pending HTTP request will be aborted if the provided context is
  13643. // canceled.
  13644. func (c *TeamdrivesUpdateCall) Context(ctx context.Context) *TeamdrivesUpdateCall {
  13645. c.ctx_ = ctx
  13646. return c
  13647. }
  13648. // Header returns an http.Header that can be modified by the caller to
  13649. // add HTTP headers to the request.
  13650. func (c *TeamdrivesUpdateCall) Header() http.Header {
  13651. if c.header_ == nil {
  13652. c.header_ = make(http.Header)
  13653. }
  13654. return c.header_
  13655. }
  13656. func (c *TeamdrivesUpdateCall) doRequest(alt string) (*http.Response, error) {
  13657. reqHeaders := make(http.Header)
  13658. for k, v := range c.header_ {
  13659. reqHeaders[k] = v
  13660. }
  13661. reqHeaders.Set("User-Agent", c.s.userAgent())
  13662. var body io.Reader = nil
  13663. body, err := googleapi.WithoutDataWrapper.JSONReader(c.teamdrive)
  13664. if err != nil {
  13665. return nil, err
  13666. }
  13667. reqHeaders.Set("Content-Type", "application/json")
  13668. c.urlParams_.Set("alt", alt)
  13669. c.urlParams_.Set("prettyPrint", "false")
  13670. urls := googleapi.ResolveRelative(c.s.BasePath, "teamdrives/{teamDriveId}")
  13671. urls += "?" + c.urlParams_.Encode()
  13672. req, err := http.NewRequest("PUT", urls, body)
  13673. if err != nil {
  13674. return nil, err
  13675. }
  13676. req.Header = reqHeaders
  13677. googleapi.Expand(req.URL, map[string]string{
  13678. "teamDriveId": c.teamDriveId,
  13679. })
  13680. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  13681. }
  13682. // Do executes the "drive.teamdrives.update" call.
  13683. // Exactly one of *TeamDrive or error will be non-nil. Any non-2xx
  13684. // status code is an error. Response headers are in either
  13685. // *TeamDrive.ServerResponse.Header or (if a response was returned at
  13686. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  13687. // to check whether the returned error was because
  13688. // http.StatusNotModified was returned.
  13689. func (c *TeamdrivesUpdateCall) Do(opts ...googleapi.CallOption) (*TeamDrive, error) {
  13690. gensupport.SetOptions(c.urlParams_, opts...)
  13691. res, err := c.doRequest("json")
  13692. if res != nil && res.StatusCode == http.StatusNotModified {
  13693. if res.Body != nil {
  13694. res.Body.Close()
  13695. }
  13696. return nil, &googleapi.Error{
  13697. Code: res.StatusCode,
  13698. Header: res.Header,
  13699. }
  13700. }
  13701. if err != nil {
  13702. return nil, err
  13703. }
  13704. defer googleapi.CloseBody(res)
  13705. if err := googleapi.CheckResponse(res); err != nil {
  13706. return nil, err
  13707. }
  13708. ret := &TeamDrive{
  13709. ServerResponse: googleapi.ServerResponse{
  13710. Header: res.Header,
  13711. HTTPStatusCode: res.StatusCode,
  13712. },
  13713. }
  13714. target := &ret
  13715. if err := gensupport.DecodeResponse(target, res); err != nil {
  13716. return nil, err
  13717. }
  13718. return ret, nil
  13719. // {
  13720. // "description": "Updates a Team Drive's metadata",
  13721. // "httpMethod": "PUT",
  13722. // "id": "drive.teamdrives.update",
  13723. // "parameterOrder": [
  13724. // "teamDriveId"
  13725. // ],
  13726. // "parameters": {
  13727. // "teamDriveId": {
  13728. // "description": "The ID of the Team Drive",
  13729. // "location": "path",
  13730. // "required": true,
  13731. // "type": "string"
  13732. // },
  13733. // "useDomainAdminAccess": {
  13734. // "default": "false",
  13735. // "description": "Issue the request as a domain administrator; if set to true, then the requester will be granted access if they are an administrator of the domain to which the Team Drive belongs.",
  13736. // "location": "query",
  13737. // "type": "boolean"
  13738. // }
  13739. // },
  13740. // "path": "teamdrives/{teamDriveId}",
  13741. // "request": {
  13742. // "$ref": "TeamDrive"
  13743. // },
  13744. // "response": {
  13745. // "$ref": "TeamDrive"
  13746. // },
  13747. // "scopes": [
  13748. // "https://www.googleapis.com/auth/drive"
  13749. // ]
  13750. // }
  13751. }