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.
 
 
 

14741 lines
490 KiB

  1. // Package drive provides access to the Drive API.
  2. //
  3. // See https://developers.google.com/drive/
  4. //
  5. // Usage example:
  6. //
  7. // import "google.golang.org/api/drive/v2"
  8. // ...
  9. // driveService, err := drive.New(oauthHttpClient)
  10. package drive // import "google.golang.org/api/drive/v2"
  11. import (
  12. "bytes"
  13. "encoding/json"
  14. "errors"
  15. "fmt"
  16. context "golang.org/x/net/context"
  17. ctxhttp "golang.org/x/net/context/ctxhttp"
  18. gensupport "google.golang.org/api/gensupport"
  19. googleapi "google.golang.org/api/googleapi"
  20. "io"
  21. "net/http"
  22. "net/url"
  23. "strconv"
  24. "strings"
  25. )
  26. // Always reference these packages, just in case the auto-generated code
  27. // below doesn't.
  28. var _ = bytes.NewBuffer
  29. var _ = strconv.Itoa
  30. var _ = fmt.Sprintf
  31. var _ = json.NewDecoder
  32. var _ = io.Copy
  33. var _ = url.Parse
  34. var _ = gensupport.MarshalJSON
  35. var _ = googleapi.Version
  36. var _ = errors.New
  37. var _ = strings.Replace
  38. var _ = context.Canceled
  39. var _ = ctxhttp.Do
  40. const apiId = "drive:v2"
  41. const apiName = "drive"
  42. const apiVersion = "v2"
  43. const basePath = "https://www.googleapis.com/drive/v2/"
  44. // OAuth2 scopes used by this API.
  45. const (
  46. // View and manage the files in your Google Drive
  47. DriveScope = "https://www.googleapis.com/auth/drive"
  48. // View and manage its own configuration data in your Google Drive
  49. DriveAppdataScope = "https://www.googleapis.com/auth/drive.appdata"
  50. // View your Google Drive apps
  51. DriveAppsReadonlyScope = "https://www.googleapis.com/auth/drive.apps.readonly"
  52. // View and manage Google Drive files and folders that you have opened
  53. // or created with this app
  54. DriveFileScope = "https://www.googleapis.com/auth/drive.file"
  55. // View and manage metadata of files in your Google Drive
  56. DriveMetadataScope = "https://www.googleapis.com/auth/drive.metadata"
  57. // View metadata for files in your Google Drive
  58. DriveMetadataReadonlyScope = "https://www.googleapis.com/auth/drive.metadata.readonly"
  59. // View the photos, videos and albums in your Google Photos
  60. DrivePhotosReadonlyScope = "https://www.googleapis.com/auth/drive.photos.readonly"
  61. // View the files in your Google Drive
  62. DriveReadonlyScope = "https://www.googleapis.com/auth/drive.readonly"
  63. // Modify your Google Apps Script scripts' behavior
  64. DriveScriptsScope = "https://www.googleapis.com/auth/drive.scripts"
  65. )
  66. func New(client *http.Client) (*Service, error) {
  67. if client == nil {
  68. return nil, errors.New("client is nil")
  69. }
  70. s := &Service{client: client, BasePath: basePath}
  71. s.About = NewAboutService(s)
  72. s.Apps = NewAppsService(s)
  73. s.Changes = NewChangesService(s)
  74. s.Channels = NewChannelsService(s)
  75. s.Children = NewChildrenService(s)
  76. s.Comments = NewCommentsService(s)
  77. s.Files = NewFilesService(s)
  78. s.Parents = NewParentsService(s)
  79. s.Permissions = NewPermissionsService(s)
  80. s.Properties = NewPropertiesService(s)
  81. s.Realtime = NewRealtimeService(s)
  82. s.Replies = NewRepliesService(s)
  83. s.Revisions = NewRevisionsService(s)
  84. s.Teamdrives = NewTeamdrivesService(s)
  85. return s, nil
  86. }
  87. type Service struct {
  88. client *http.Client
  89. BasePath string // API endpoint base URL
  90. UserAgent string // optional additional User-Agent fragment
  91. About *AboutService
  92. Apps *AppsService
  93. Changes *ChangesService
  94. Channels *ChannelsService
  95. Children *ChildrenService
  96. Comments *CommentsService
  97. Files *FilesService
  98. Parents *ParentsService
  99. Permissions *PermissionsService
  100. Properties *PropertiesService
  101. Realtime *RealtimeService
  102. Replies *RepliesService
  103. Revisions *RevisionsService
  104. Teamdrives *TeamdrivesService
  105. }
  106. func (s *Service) userAgent() string {
  107. if s.UserAgent == "" {
  108. return googleapi.UserAgent
  109. }
  110. return googleapi.UserAgent + " " + s.UserAgent
  111. }
  112. func NewAboutService(s *Service) *AboutService {
  113. rs := &AboutService{s: s}
  114. return rs
  115. }
  116. type AboutService struct {
  117. s *Service
  118. }
  119. func NewAppsService(s *Service) *AppsService {
  120. rs := &AppsService{s: s}
  121. return rs
  122. }
  123. type AppsService struct {
  124. s *Service
  125. }
  126. func NewChangesService(s *Service) *ChangesService {
  127. rs := &ChangesService{s: s}
  128. return rs
  129. }
  130. type ChangesService struct {
  131. s *Service
  132. }
  133. func NewChannelsService(s *Service) *ChannelsService {
  134. rs := &ChannelsService{s: s}
  135. return rs
  136. }
  137. type ChannelsService struct {
  138. s *Service
  139. }
  140. func NewChildrenService(s *Service) *ChildrenService {
  141. rs := &ChildrenService{s: s}
  142. return rs
  143. }
  144. type ChildrenService struct {
  145. s *Service
  146. }
  147. func NewCommentsService(s *Service) *CommentsService {
  148. rs := &CommentsService{s: s}
  149. return rs
  150. }
  151. type CommentsService struct {
  152. s *Service
  153. }
  154. func NewFilesService(s *Service) *FilesService {
  155. rs := &FilesService{s: s}
  156. return rs
  157. }
  158. type FilesService struct {
  159. s *Service
  160. }
  161. func NewParentsService(s *Service) *ParentsService {
  162. rs := &ParentsService{s: s}
  163. return rs
  164. }
  165. type ParentsService struct {
  166. s *Service
  167. }
  168. func NewPermissionsService(s *Service) *PermissionsService {
  169. rs := &PermissionsService{s: s}
  170. return rs
  171. }
  172. type PermissionsService struct {
  173. s *Service
  174. }
  175. func NewPropertiesService(s *Service) *PropertiesService {
  176. rs := &PropertiesService{s: s}
  177. return rs
  178. }
  179. type PropertiesService struct {
  180. s *Service
  181. }
  182. func NewRealtimeService(s *Service) *RealtimeService {
  183. rs := &RealtimeService{s: s}
  184. return rs
  185. }
  186. type RealtimeService struct {
  187. s *Service
  188. }
  189. func NewRepliesService(s *Service) *RepliesService {
  190. rs := &RepliesService{s: s}
  191. return rs
  192. }
  193. type RepliesService struct {
  194. s *Service
  195. }
  196. func NewRevisionsService(s *Service) *RevisionsService {
  197. rs := &RevisionsService{s: s}
  198. return rs
  199. }
  200. type RevisionsService struct {
  201. s *Service
  202. }
  203. func NewTeamdrivesService(s *Service) *TeamdrivesService {
  204. rs := &TeamdrivesService{s: s}
  205. return rs
  206. }
  207. type TeamdrivesService struct {
  208. s *Service
  209. }
  210. // About: An item with user information and settings.
  211. type About struct {
  212. // AdditionalRoleInfo: Information about supported additional roles per
  213. // file type. The most specific type takes precedence.
  214. AdditionalRoleInfo []*AboutAdditionalRoleInfo `json:"additionalRoleInfo,omitempty"`
  215. // CanCreateTeamDrives: Whether the user can create Team Drives.
  216. CanCreateTeamDrives bool `json:"canCreateTeamDrives,omitempty"`
  217. // DomainSharingPolicy: The domain sharing policy for the current user.
  218. // Possible values are:
  219. // - allowed
  220. // - allowedWithWarning
  221. // - incomingOnly
  222. // - disallowed
  223. DomainSharingPolicy string `json:"domainSharingPolicy,omitempty"`
  224. // Etag: The ETag of the item.
  225. Etag string `json:"etag,omitempty"`
  226. // ExportFormats: The allowable export formats.
  227. ExportFormats []*AboutExportFormats `json:"exportFormats,omitempty"`
  228. // Features: List of additional features enabled on this account.
  229. Features []*AboutFeatures `json:"features,omitempty"`
  230. // FolderColorPalette: The palette of allowable folder colors as RGB hex
  231. // strings.
  232. FolderColorPalette []string `json:"folderColorPalette,omitempty"`
  233. // ImportFormats: The allowable import formats.
  234. ImportFormats []*AboutImportFormats `json:"importFormats,omitempty"`
  235. // IsCurrentAppInstalled: A boolean indicating whether the authenticated
  236. // app is installed by the authenticated user.
  237. IsCurrentAppInstalled bool `json:"isCurrentAppInstalled,omitempty"`
  238. // Kind: This is always drive#about.
  239. Kind string `json:"kind,omitempty"`
  240. // LanguageCode: The user's language or locale code, as defined by BCP
  241. // 47, with some extensions from Unicode's LDML format
  242. // (http://www.unicode.org/reports/tr35/).
  243. LanguageCode string `json:"languageCode,omitempty"`
  244. // LargestChangeId: The largest change id.
  245. LargestChangeId int64 `json:"largestChangeId,omitempty,string"`
  246. // MaxUploadSizes: List of max upload sizes for each file type. The most
  247. // specific type takes precedence.
  248. MaxUploadSizes []*AboutMaxUploadSizes `json:"maxUploadSizes,omitempty"`
  249. // Name: The name of the current user.
  250. Name string `json:"name,omitempty"`
  251. // PermissionId: The current user's ID as visible in the permissions
  252. // collection.
  253. PermissionId string `json:"permissionId,omitempty"`
  254. // QuotaBytesByService: The amount of storage quota used by different
  255. // Google services.
  256. QuotaBytesByService []*AboutQuotaBytesByService `json:"quotaBytesByService,omitempty"`
  257. // QuotaBytesTotal: The total number of quota bytes.
  258. QuotaBytesTotal int64 `json:"quotaBytesTotal,omitempty,string"`
  259. // QuotaBytesUsed: The number of quota bytes used by Google Drive.
  260. QuotaBytesUsed int64 `json:"quotaBytesUsed,omitempty,string"`
  261. // QuotaBytesUsedAggregate: The number of quota bytes used by all Google
  262. // apps (Drive, Picasa, etc.).
  263. QuotaBytesUsedAggregate int64 `json:"quotaBytesUsedAggregate,omitempty,string"`
  264. // QuotaBytesUsedInTrash: The number of quota bytes used by trashed
  265. // items.
  266. QuotaBytesUsedInTrash int64 `json:"quotaBytesUsedInTrash,omitempty,string"`
  267. // QuotaType: The type of the user's storage quota. Possible values are:
  268. //
  269. // - LIMITED
  270. // - UNLIMITED
  271. QuotaType string `json:"quotaType,omitempty"`
  272. // RemainingChangeIds: The number of remaining change ids, limited to no
  273. // more than 2500.
  274. RemainingChangeIds int64 `json:"remainingChangeIds,omitempty,string"`
  275. // RootFolderId: The id of the root folder.
  276. RootFolderId string `json:"rootFolderId,omitempty"`
  277. // SelfLink: A link back to this item.
  278. SelfLink string `json:"selfLink,omitempty"`
  279. // TeamDriveThemes: A list of themes that are supported for Team Drives.
  280. TeamDriveThemes []*AboutTeamDriveThemes `json:"teamDriveThemes,omitempty"`
  281. // User: The authenticated user.
  282. User *User `json:"user,omitempty"`
  283. // ServerResponse contains the HTTP response code and headers from the
  284. // server.
  285. googleapi.ServerResponse `json:"-"`
  286. // ForceSendFields is a list of field names (e.g. "AdditionalRoleInfo")
  287. // to unconditionally include in API requests. By default, fields with
  288. // empty values are omitted from API requests. However, any non-pointer,
  289. // non-interface field appearing in ForceSendFields will be sent to the
  290. // server regardless of whether the field is empty or not. This may be
  291. // used to include empty fields in Patch requests.
  292. ForceSendFields []string `json:"-"`
  293. // NullFields is a list of field names (e.g. "AdditionalRoleInfo") to
  294. // include in API requests with the JSON null value. By default, fields
  295. // with empty values are omitted from API requests. However, any field
  296. // with an empty value appearing in NullFields will be sent to the
  297. // server as null. It is an error if a field in this list has a
  298. // non-empty value. This may be used to include null fields in Patch
  299. // requests.
  300. NullFields []string `json:"-"`
  301. }
  302. func (s *About) MarshalJSON() ([]byte, error) {
  303. type NoMethod About
  304. raw := NoMethod(*s)
  305. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  306. }
  307. type AboutAdditionalRoleInfo struct {
  308. // RoleSets: The supported additional roles per primary role.
  309. RoleSets []*AboutAdditionalRoleInfoRoleSets `json:"roleSets,omitempty"`
  310. // Type: The content type that this additional role info applies to.
  311. Type string `json:"type,omitempty"`
  312. // ForceSendFields is a list of field names (e.g. "RoleSets") to
  313. // unconditionally include in API requests. By default, fields with
  314. // empty values are omitted from API requests. However, any non-pointer,
  315. // non-interface field appearing in ForceSendFields will be sent to the
  316. // server regardless of whether the field is empty or not. This may be
  317. // used to include empty fields in Patch requests.
  318. ForceSendFields []string `json:"-"`
  319. // NullFields is a list of field names (e.g. "RoleSets") to include in
  320. // API requests with the JSON null value. By default, fields with empty
  321. // values are omitted from API requests. However, any field with an
  322. // empty value appearing in NullFields will be sent to the server as
  323. // null. It is an error if a field in this list has a non-empty value.
  324. // This may be used to include null fields in Patch requests.
  325. NullFields []string `json:"-"`
  326. }
  327. func (s *AboutAdditionalRoleInfo) MarshalJSON() ([]byte, error) {
  328. type NoMethod AboutAdditionalRoleInfo
  329. raw := NoMethod(*s)
  330. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  331. }
  332. type AboutAdditionalRoleInfoRoleSets struct {
  333. // AdditionalRoles: The supported additional roles with the primary
  334. // role.
  335. AdditionalRoles []string `json:"additionalRoles,omitempty"`
  336. // PrimaryRole: A primary permission role.
  337. PrimaryRole string `json:"primaryRole,omitempty"`
  338. // ForceSendFields is a list of field names (e.g. "AdditionalRoles") to
  339. // unconditionally include in API requests. By default, fields with
  340. // empty values are omitted from API requests. However, any non-pointer,
  341. // non-interface field appearing in ForceSendFields will be sent to the
  342. // server regardless of whether the field is empty or not. This may be
  343. // used to include empty fields in Patch requests.
  344. ForceSendFields []string `json:"-"`
  345. // NullFields is a list of field names (e.g. "AdditionalRoles") to
  346. // include in API requests with the JSON null value. By default, fields
  347. // with empty values are omitted from API requests. However, any field
  348. // with an empty value appearing in NullFields will be sent to the
  349. // server as null. It is an error if a field in this list has a
  350. // non-empty value. This may be used to include null fields in Patch
  351. // requests.
  352. NullFields []string `json:"-"`
  353. }
  354. func (s *AboutAdditionalRoleInfoRoleSets) MarshalJSON() ([]byte, error) {
  355. type NoMethod AboutAdditionalRoleInfoRoleSets
  356. raw := NoMethod(*s)
  357. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  358. }
  359. type AboutExportFormats struct {
  360. // Source: The content type to convert from.
  361. Source string `json:"source,omitempty"`
  362. // Targets: The possible content types to convert to.
  363. Targets []string `json:"targets,omitempty"`
  364. // ForceSendFields is a list of field names (e.g. "Source") to
  365. // unconditionally include in API requests. By default, fields with
  366. // empty values are omitted from API requests. However, any non-pointer,
  367. // non-interface field appearing in ForceSendFields will be sent to the
  368. // server regardless of whether the field is empty or not. This may be
  369. // used to include empty fields in Patch requests.
  370. ForceSendFields []string `json:"-"`
  371. // NullFields is a list of field names (e.g. "Source") to include in API
  372. // requests with the JSON null value. By default, fields with empty
  373. // values are omitted from API requests. However, any field with an
  374. // empty value appearing in NullFields will be sent to the server as
  375. // null. It is an error if a field in this list has a non-empty value.
  376. // This may be used to include null fields in Patch requests.
  377. NullFields []string `json:"-"`
  378. }
  379. func (s *AboutExportFormats) MarshalJSON() ([]byte, error) {
  380. type NoMethod AboutExportFormats
  381. raw := NoMethod(*s)
  382. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  383. }
  384. type AboutFeatures struct {
  385. // FeatureName: The name of the feature.
  386. FeatureName string `json:"featureName,omitempty"`
  387. // FeatureRate: The request limit rate for this feature, in queries per
  388. // second.
  389. FeatureRate float64 `json:"featureRate,omitempty"`
  390. // ForceSendFields is a list of field names (e.g. "FeatureName") to
  391. // unconditionally include in API requests. By default, fields with
  392. // empty values are omitted from API requests. However, any non-pointer,
  393. // non-interface field appearing in ForceSendFields will be sent to the
  394. // server regardless of whether the field is empty or not. This may be
  395. // used to include empty fields in Patch requests.
  396. ForceSendFields []string `json:"-"`
  397. // NullFields is a list of field names (e.g. "FeatureName") to include
  398. // in API requests with the JSON null value. By default, fields with
  399. // empty values are omitted from API requests. However, any field with
  400. // an empty value appearing in NullFields will be sent to the server as
  401. // null. It is an error if a field in this list has a non-empty value.
  402. // This may be used to include null fields in Patch requests.
  403. NullFields []string `json:"-"`
  404. }
  405. func (s *AboutFeatures) MarshalJSON() ([]byte, error) {
  406. type NoMethod AboutFeatures
  407. raw := NoMethod(*s)
  408. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  409. }
  410. func (s *AboutFeatures) UnmarshalJSON(data []byte) error {
  411. type NoMethod AboutFeatures
  412. var s1 struct {
  413. FeatureRate gensupport.JSONFloat64 `json:"featureRate"`
  414. *NoMethod
  415. }
  416. s1.NoMethod = (*NoMethod)(s)
  417. if err := json.Unmarshal(data, &s1); err != nil {
  418. return err
  419. }
  420. s.FeatureRate = float64(s1.FeatureRate)
  421. return nil
  422. }
  423. type AboutImportFormats struct {
  424. // Source: The imported file's content type to convert from.
  425. Source string `json:"source,omitempty"`
  426. // Targets: The possible content types to convert to.
  427. Targets []string `json:"targets,omitempty"`
  428. // ForceSendFields is a list of field names (e.g. "Source") to
  429. // unconditionally include in API requests. By default, fields with
  430. // empty values are omitted from API requests. However, any non-pointer,
  431. // non-interface field appearing in ForceSendFields will be sent to the
  432. // server regardless of whether the field is empty or not. This may be
  433. // used to include empty fields in Patch requests.
  434. ForceSendFields []string `json:"-"`
  435. // NullFields is a list of field names (e.g. "Source") to include in API
  436. // requests with the JSON null value. By default, fields with empty
  437. // values are omitted from API requests. However, any field with an
  438. // empty value appearing in NullFields will be sent to the server as
  439. // null. It is an error if a field in this list has a non-empty value.
  440. // This may be used to include null fields in Patch requests.
  441. NullFields []string `json:"-"`
  442. }
  443. func (s *AboutImportFormats) MarshalJSON() ([]byte, error) {
  444. type NoMethod AboutImportFormats
  445. raw := NoMethod(*s)
  446. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  447. }
  448. type AboutMaxUploadSizes struct {
  449. // Size: The max upload size for this type.
  450. Size int64 `json:"size,omitempty,string"`
  451. // Type: The file type.
  452. Type string `json:"type,omitempty"`
  453. // ForceSendFields is a list of field names (e.g. "Size") 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. "Size") to include in API
  461. // requests with the JSON null value. By default, fields with empty
  462. // values are omitted from API requests. However, any field with an
  463. // empty value appearing in NullFields will be sent to the server as
  464. // null. It is an error if a field in this list has a non-empty value.
  465. // This may be used to include null fields in Patch requests.
  466. NullFields []string `json:"-"`
  467. }
  468. func (s *AboutMaxUploadSizes) MarshalJSON() ([]byte, error) {
  469. type NoMethod AboutMaxUploadSizes
  470. raw := NoMethod(*s)
  471. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  472. }
  473. type AboutQuotaBytesByService struct {
  474. // BytesUsed: The storage quota bytes used by the service.
  475. BytesUsed int64 `json:"bytesUsed,omitempty,string"`
  476. // ServiceName: The service's name, e.g. DRIVE, GMAIL, or PHOTOS.
  477. ServiceName string `json:"serviceName,omitempty"`
  478. // ForceSendFields is a list of field names (e.g. "BytesUsed") to
  479. // unconditionally include in API requests. By default, fields with
  480. // empty values are omitted from API requests. However, any non-pointer,
  481. // non-interface field appearing in ForceSendFields will be sent to the
  482. // server regardless of whether the field is empty or not. This may be
  483. // used to include empty fields in Patch requests.
  484. ForceSendFields []string `json:"-"`
  485. // NullFields is a list of field names (e.g. "BytesUsed") to include in
  486. // API requests with the JSON null value. By default, fields with empty
  487. // values are omitted from API requests. However, any field with an
  488. // empty value appearing in NullFields will be sent to the server as
  489. // null. It is an error if a field in this list has a non-empty value.
  490. // This may be used to include null fields in Patch requests.
  491. NullFields []string `json:"-"`
  492. }
  493. func (s *AboutQuotaBytesByService) MarshalJSON() ([]byte, error) {
  494. type NoMethod AboutQuotaBytesByService
  495. raw := NoMethod(*s)
  496. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  497. }
  498. type AboutTeamDriveThemes struct {
  499. // BackgroundImageLink: A link to this Team Drive theme's background
  500. // image.
  501. BackgroundImageLink string `json:"backgroundImageLink,omitempty"`
  502. // ColorRgb: The color of this Team Drive theme as an RGB hex string.
  503. ColorRgb string `json:"colorRgb,omitempty"`
  504. // Id: The ID of the theme.
  505. Id string `json:"id,omitempty"`
  506. // ForceSendFields is a list of field names (e.g. "BackgroundImageLink")
  507. // to unconditionally include in API requests. By default, fields with
  508. // empty values are omitted from API requests. However, any non-pointer,
  509. // non-interface field appearing in ForceSendFields will be sent to the
  510. // server regardless of whether the field is empty or not. This may be
  511. // used to include empty fields in Patch requests.
  512. ForceSendFields []string `json:"-"`
  513. // NullFields is a list of field names (e.g. "BackgroundImageLink") to
  514. // include in API requests with the JSON null value. By default, fields
  515. // with empty values are omitted from API requests. However, any field
  516. // with an empty value appearing in NullFields will be sent to the
  517. // server as null. It is an error if a field in this list has a
  518. // non-empty value. This may be used to include null fields in Patch
  519. // requests.
  520. NullFields []string `json:"-"`
  521. }
  522. func (s *AboutTeamDriveThemes) MarshalJSON() ([]byte, error) {
  523. type NoMethod AboutTeamDriveThemes
  524. raw := NoMethod(*s)
  525. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  526. }
  527. // App: The apps resource provides a list of the apps that a user has
  528. // installed, with information about each app's supported MIME types,
  529. // file extensions, and other details.
  530. type App struct {
  531. // Authorized: Whether the app is authorized to access data on the
  532. // user's Drive.
  533. Authorized bool `json:"authorized,omitempty"`
  534. // CreateInFolderTemplate: The template url to create a new file with
  535. // this app in a given folder. The template will contain {folderId} to
  536. // be replaced by the folder to create the new file in.
  537. CreateInFolderTemplate string `json:"createInFolderTemplate,omitempty"`
  538. // CreateUrl: The url to create a new file with this app.
  539. CreateUrl string `json:"createUrl,omitempty"`
  540. // HasDriveWideScope: Whether the app has drive-wide scope. An app with
  541. // drive-wide scope can access all files in the user's drive.
  542. HasDriveWideScope bool `json:"hasDriveWideScope,omitempty"`
  543. // Icons: The various icons for the app.
  544. Icons []*AppIcons `json:"icons,omitempty"`
  545. // Id: The ID of the app.
  546. Id string `json:"id,omitempty"`
  547. // Installed: Whether the app is installed.
  548. Installed bool `json:"installed,omitempty"`
  549. // Kind: This is always drive#app.
  550. Kind string `json:"kind,omitempty"`
  551. // LongDescription: A long description of the app.
  552. LongDescription string `json:"longDescription,omitempty"`
  553. // Name: The name of the app.
  554. Name string `json:"name,omitempty"`
  555. // ObjectType: The type of object this app creates (e.g. Chart). If
  556. // empty, the app name should be used instead.
  557. ObjectType string `json:"objectType,omitempty"`
  558. // OpenUrlTemplate: The template url for opening files with this app.
  559. // The template will contain {ids} and/or {exportIds} to be replaced by
  560. // the actual file ids. See Open Files for the full documentation.
  561. OpenUrlTemplate string `json:"openUrlTemplate,omitempty"`
  562. // PrimaryFileExtensions: The list of primary file extensions.
  563. PrimaryFileExtensions []string `json:"primaryFileExtensions,omitempty"`
  564. // PrimaryMimeTypes: The list of primary mime types.
  565. PrimaryMimeTypes []string `json:"primaryMimeTypes,omitempty"`
  566. // ProductId: The ID of the product listing for this app.
  567. ProductId string `json:"productId,omitempty"`
  568. // ProductUrl: A link to the product listing for this app.
  569. ProductUrl string `json:"productUrl,omitempty"`
  570. // SecondaryFileExtensions: The list of secondary file extensions.
  571. SecondaryFileExtensions []string `json:"secondaryFileExtensions,omitempty"`
  572. // SecondaryMimeTypes: The list of secondary mime types.
  573. SecondaryMimeTypes []string `json:"secondaryMimeTypes,omitempty"`
  574. // ShortDescription: A short description of the app.
  575. ShortDescription string `json:"shortDescription,omitempty"`
  576. // SupportsCreate: Whether this app supports creating new objects.
  577. SupportsCreate bool `json:"supportsCreate,omitempty"`
  578. // SupportsImport: Whether this app supports importing Google Docs.
  579. SupportsImport bool `json:"supportsImport,omitempty"`
  580. // SupportsMultiOpen: Whether this app supports opening more than one
  581. // file.
  582. SupportsMultiOpen bool `json:"supportsMultiOpen,omitempty"`
  583. // SupportsOfflineCreate: Whether this app supports creating new files
  584. // when offline.
  585. SupportsOfflineCreate bool `json:"supportsOfflineCreate,omitempty"`
  586. // UseByDefault: Whether the app is selected as the default handler for
  587. // the types it supports.
  588. UseByDefault bool `json:"useByDefault,omitempty"`
  589. // ServerResponse contains the HTTP response code and headers from the
  590. // server.
  591. googleapi.ServerResponse `json:"-"`
  592. // ForceSendFields is a list of field names (e.g. "Authorized") to
  593. // unconditionally include in API requests. By default, fields with
  594. // empty values are omitted from API requests. However, any non-pointer,
  595. // non-interface field appearing in ForceSendFields will be sent to the
  596. // server regardless of whether the field is empty or not. This may be
  597. // used to include empty fields in Patch requests.
  598. ForceSendFields []string `json:"-"`
  599. // NullFields is a list of field names (e.g. "Authorized") to include in
  600. // API requests with the JSON null value. By default, fields with empty
  601. // values are omitted from API requests. However, any field with an
  602. // empty value appearing in NullFields will be sent to the server as
  603. // null. It is an error if a field in this list has a non-empty value.
  604. // This may be used to include null fields in Patch requests.
  605. NullFields []string `json:"-"`
  606. }
  607. func (s *App) MarshalJSON() ([]byte, error) {
  608. type NoMethod App
  609. raw := NoMethod(*s)
  610. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  611. }
  612. type AppIcons struct {
  613. // Category: Category of the icon. Allowed values are:
  614. // - application - icon for the application
  615. // - document - icon for a file associated with the app
  616. // - documentShared - icon for a shared file associated with the app
  617. Category string `json:"category,omitempty"`
  618. // IconUrl: URL for the icon.
  619. IconUrl string `json:"iconUrl,omitempty"`
  620. // Size: Size of the icon. Represented as the maximum of the width and
  621. // height.
  622. Size int64 `json:"size,omitempty"`
  623. // ForceSendFields is a list of field names (e.g. "Category") to
  624. // unconditionally include in API requests. By default, fields with
  625. // empty values are omitted from API requests. However, any non-pointer,
  626. // non-interface field appearing in ForceSendFields will be sent to the
  627. // server regardless of whether the field is empty or not. This may be
  628. // used to include empty fields in Patch requests.
  629. ForceSendFields []string `json:"-"`
  630. // NullFields is a list of field names (e.g. "Category") to include in
  631. // API requests with the JSON null value. By default, fields with empty
  632. // values are omitted from API requests. However, any field with an
  633. // empty value appearing in NullFields will be sent to the server as
  634. // null. It is an error if a field in this list has a non-empty value.
  635. // This may be used to include null fields in Patch requests.
  636. NullFields []string `json:"-"`
  637. }
  638. func (s *AppIcons) MarshalJSON() ([]byte, error) {
  639. type NoMethod AppIcons
  640. raw := NoMethod(*s)
  641. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  642. }
  643. // AppList: A list of third-party applications which the user has
  644. // installed or given access to Google Drive.
  645. type AppList struct {
  646. // DefaultAppIds: List of app IDs that the user has specified to use by
  647. // default. The list is in reverse-priority order (lowest to highest).
  648. DefaultAppIds []string `json:"defaultAppIds,omitempty"`
  649. // Etag: The ETag of the list.
  650. Etag string `json:"etag,omitempty"`
  651. // Items: The list of apps.
  652. Items []*App `json:"items,omitempty"`
  653. // Kind: This is always drive#appList.
  654. Kind string `json:"kind,omitempty"`
  655. // SelfLink: A link back to this list.
  656. SelfLink string `json:"selfLink,omitempty"`
  657. // ServerResponse contains the HTTP response code and headers from the
  658. // server.
  659. googleapi.ServerResponse `json:"-"`
  660. // ForceSendFields is a list of field names (e.g. "DefaultAppIds") to
  661. // unconditionally include in API requests. By default, fields with
  662. // empty values are omitted from API requests. However, any non-pointer,
  663. // non-interface field appearing in ForceSendFields will be sent to the
  664. // server regardless of whether the field is empty or not. This may be
  665. // used to include empty fields in Patch requests.
  666. ForceSendFields []string `json:"-"`
  667. // NullFields is a list of field names (e.g. "DefaultAppIds") to include
  668. // in API requests with the JSON null value. By default, fields with
  669. // empty values are omitted from API requests. However, any field with
  670. // an empty value appearing in NullFields will be sent to the server as
  671. // null. It is an error if a field in this list has a non-empty value.
  672. // This may be used to include null fields in Patch requests.
  673. NullFields []string `json:"-"`
  674. }
  675. func (s *AppList) MarshalJSON() ([]byte, error) {
  676. type NoMethod AppList
  677. raw := NoMethod(*s)
  678. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  679. }
  680. // Change: Representation of a change to a file or Team Drive.
  681. type Change struct {
  682. // Deleted: Whether the file or Team Drive has been removed from this
  683. // list of changes, for example by deletion or loss of access.
  684. Deleted bool `json:"deleted,omitempty"`
  685. // File: The updated state of the file. Present if the type is file and
  686. // the file has not been removed from this list of changes.
  687. File *File `json:"file,omitempty"`
  688. // FileId: The ID of the file associated with this change.
  689. FileId string `json:"fileId,omitempty"`
  690. // Id: The ID of the change.
  691. Id int64 `json:"id,omitempty,string"`
  692. // Kind: This is always drive#change.
  693. Kind string `json:"kind,omitempty"`
  694. // ModificationDate: The time of this modification.
  695. ModificationDate string `json:"modificationDate,omitempty"`
  696. // SelfLink: A link back to this change.
  697. SelfLink string `json:"selfLink,omitempty"`
  698. // TeamDrive: The updated state of the Team Drive. Present if the type
  699. // is teamDrive, the user is still a member of the Team Drive, and the
  700. // Team Drive has not been deleted.
  701. TeamDrive *TeamDrive `json:"teamDrive,omitempty"`
  702. // TeamDriveId: The ID of the Team Drive associated with this change.
  703. TeamDriveId string `json:"teamDriveId,omitempty"`
  704. // Type: The type of the change. Possible values are file and teamDrive.
  705. Type string `json:"type,omitempty"`
  706. // ServerResponse contains the HTTP response code and headers from the
  707. // server.
  708. googleapi.ServerResponse `json:"-"`
  709. // ForceSendFields is a list of field names (e.g. "Deleted") to
  710. // unconditionally include in API requests. By default, fields with
  711. // empty values are omitted from API requests. However, any non-pointer,
  712. // non-interface field appearing in ForceSendFields will be sent to the
  713. // server regardless of whether the field is empty or not. This may be
  714. // used to include empty fields in Patch requests.
  715. ForceSendFields []string `json:"-"`
  716. // NullFields is a list of field names (e.g. "Deleted") to include in
  717. // API requests with the JSON null value. By default, fields with empty
  718. // values are omitted from API requests. However, any field with an
  719. // empty value appearing in NullFields will be sent to the server as
  720. // null. It is an error if a field in this list has a non-empty value.
  721. // This may be used to include null fields in Patch requests.
  722. NullFields []string `json:"-"`
  723. }
  724. func (s *Change) MarshalJSON() ([]byte, error) {
  725. type NoMethod Change
  726. raw := NoMethod(*s)
  727. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  728. }
  729. // ChangeList: A list of changes for a user.
  730. type ChangeList struct {
  731. // Etag: The ETag of the list.
  732. Etag string `json:"etag,omitempty"`
  733. // Items: The list of changes. If nextPageToken is populated, then this
  734. // list may be incomplete and an additional page of results should be
  735. // fetched.
  736. Items []*Change `json:"items,omitempty"`
  737. // Kind: This is always drive#changeList.
  738. Kind string `json:"kind,omitempty"`
  739. // LargestChangeId: The current largest change ID.
  740. LargestChangeId int64 `json:"largestChangeId,omitempty,string"`
  741. // NewStartPageToken: The starting page token for future changes. This
  742. // will be present only if the end of the current changes list has been
  743. // reached.
  744. NewStartPageToken string `json:"newStartPageToken,omitempty"`
  745. // NextLink: A link to the next page of changes.
  746. NextLink string `json:"nextLink,omitempty"`
  747. // NextPageToken: The page token for the next page of changes. This will
  748. // be absent if the end of the changes list has been reached. If the
  749. // token is rejected for any reason, it should be discarded, and
  750. // pagination should be restarted from the first page of results.
  751. NextPageToken string `json:"nextPageToken,omitempty"`
  752. // SelfLink: A link back to this list.
  753. SelfLink string `json:"selfLink,omitempty"`
  754. // ServerResponse contains the HTTP response code and headers from the
  755. // server.
  756. googleapi.ServerResponse `json:"-"`
  757. // ForceSendFields is a list of field names (e.g. "Etag") to
  758. // unconditionally include in API requests. By default, fields with
  759. // empty values are omitted from API requests. However, any non-pointer,
  760. // non-interface field appearing in ForceSendFields will be sent to the
  761. // server regardless of whether the field is empty or not. This may be
  762. // used to include empty fields in Patch requests.
  763. ForceSendFields []string `json:"-"`
  764. // NullFields is a list of field names (e.g. "Etag") to include in API
  765. // requests with the JSON null value. By default, fields with empty
  766. // values are omitted from API requests. However, any field with an
  767. // empty value appearing in NullFields will be sent to the server as
  768. // null. It is an error if a field in this list has a non-empty value.
  769. // This may be used to include null fields in Patch requests.
  770. NullFields []string `json:"-"`
  771. }
  772. func (s *ChangeList) MarshalJSON() ([]byte, error) {
  773. type NoMethod ChangeList
  774. raw := NoMethod(*s)
  775. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  776. }
  777. // Channel: An notification channel used to watch for resource changes.
  778. type Channel struct {
  779. // Address: The address where notifications are delivered for this
  780. // channel.
  781. Address string `json:"address,omitempty"`
  782. // Expiration: Date and time of notification channel expiration,
  783. // expressed as a Unix timestamp, in milliseconds. Optional.
  784. Expiration int64 `json:"expiration,omitempty,string"`
  785. // Id: A UUID or similar unique string that identifies this channel.
  786. Id string `json:"id,omitempty"`
  787. // Kind: Identifies this as a notification channel used to watch for
  788. // changes to a resource. Value: the fixed string "api#channel".
  789. Kind string `json:"kind,omitempty"`
  790. // Params: Additional parameters controlling delivery channel behavior.
  791. // Optional.
  792. Params map[string]string `json:"params,omitempty"`
  793. // Payload: A Boolean value to indicate whether payload is wanted.
  794. // Optional.
  795. Payload bool `json:"payload,omitempty"`
  796. // ResourceId: An opaque ID that identifies the resource being watched
  797. // on this channel. Stable across different API versions.
  798. ResourceId string `json:"resourceId,omitempty"`
  799. // ResourceUri: A version-specific identifier for the watched resource.
  800. ResourceUri string `json:"resourceUri,omitempty"`
  801. // Token: An arbitrary string delivered to the target address with each
  802. // notification delivered over this channel. Optional.
  803. Token string `json:"token,omitempty"`
  804. // Type: The type of delivery mechanism used for this channel.
  805. Type string `json:"type,omitempty"`
  806. // ServerResponse contains the HTTP response code and headers from the
  807. // server.
  808. googleapi.ServerResponse `json:"-"`
  809. // ForceSendFields is a list of field names (e.g. "Address") to
  810. // unconditionally include in API requests. By default, fields with
  811. // empty values are omitted from API requests. However, any non-pointer,
  812. // non-interface field appearing in ForceSendFields will be sent to the
  813. // server regardless of whether the field is empty or not. This may be
  814. // used to include empty fields in Patch requests.
  815. ForceSendFields []string `json:"-"`
  816. // NullFields is a list of field names (e.g. "Address") to include in
  817. // API requests with the JSON null value. By default, fields with empty
  818. // values are omitted from API requests. However, any field with an
  819. // empty value appearing in NullFields will be sent to the server as
  820. // null. It is an error if a field in this list has a non-empty value.
  821. // This may be used to include null fields in Patch requests.
  822. NullFields []string `json:"-"`
  823. }
  824. func (s *Channel) MarshalJSON() ([]byte, error) {
  825. type NoMethod Channel
  826. raw := NoMethod(*s)
  827. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  828. }
  829. // ChildList: A list of children of a file.
  830. type ChildList struct {
  831. // Etag: The ETag of the list.
  832. Etag string `json:"etag,omitempty"`
  833. // Items: The list of children. If nextPageToken is populated, then this
  834. // list may be incomplete and an additional page of results should be
  835. // fetched.
  836. Items []*ChildReference `json:"items,omitempty"`
  837. // Kind: This is always drive#childList.
  838. Kind string `json:"kind,omitempty"`
  839. // NextLink: A link to the next page of children.
  840. NextLink string `json:"nextLink,omitempty"`
  841. // NextPageToken: The page token for the next page of children. This
  842. // will be absent if the end of the children list has been reached. If
  843. // the token is rejected for any reason, it should be discarded, and
  844. // pagination should be restarted from the first page of results.
  845. NextPageToken string `json:"nextPageToken,omitempty"`
  846. // SelfLink: A link back to this list.
  847. SelfLink string `json:"selfLink,omitempty"`
  848. // ServerResponse contains the HTTP response code and headers from the
  849. // server.
  850. googleapi.ServerResponse `json:"-"`
  851. // ForceSendFields is a list of field names (e.g. "Etag") to
  852. // unconditionally include in API requests. By default, fields with
  853. // empty values are omitted from API requests. However, any non-pointer,
  854. // non-interface field appearing in ForceSendFields will be sent to the
  855. // server regardless of whether the field is empty or not. This may be
  856. // used to include empty fields in Patch requests.
  857. ForceSendFields []string `json:"-"`
  858. // NullFields is a list of field names (e.g. "Etag") to include in API
  859. // requests with the JSON null value. By default, fields with empty
  860. // values are omitted from API requests. However, any field with an
  861. // empty value appearing in NullFields will be sent to the server as
  862. // null. It is an error if a field in this list has a non-empty value.
  863. // This may be used to include null fields in Patch requests.
  864. NullFields []string `json:"-"`
  865. }
  866. func (s *ChildList) MarshalJSON() ([]byte, error) {
  867. type NoMethod ChildList
  868. raw := NoMethod(*s)
  869. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  870. }
  871. // ChildReference: A reference to a folder's child.
  872. type ChildReference struct {
  873. // ChildLink: A link to the child.
  874. ChildLink string `json:"childLink,omitempty"`
  875. // Id: The ID of the child.
  876. Id string `json:"id,omitempty"`
  877. // Kind: This is always drive#childReference.
  878. Kind string `json:"kind,omitempty"`
  879. // SelfLink: A link back to this reference.
  880. SelfLink string `json:"selfLink,omitempty"`
  881. // ServerResponse contains the HTTP response code and headers from the
  882. // server.
  883. googleapi.ServerResponse `json:"-"`
  884. // ForceSendFields is a list of field names (e.g. "ChildLink") to
  885. // unconditionally include in API requests. By default, fields with
  886. // empty values are omitted from API requests. However, any non-pointer,
  887. // non-interface field appearing in ForceSendFields will be sent to the
  888. // server regardless of whether the field is empty or not. This may be
  889. // used to include empty fields in Patch requests.
  890. ForceSendFields []string `json:"-"`
  891. // NullFields is a list of field names (e.g. "ChildLink") to include in
  892. // API requests with the JSON null value. By default, fields with empty
  893. // values are omitted from API requests. However, any field with an
  894. // empty value appearing in NullFields will be sent to the server as
  895. // null. It is an error if a field in this list has a non-empty value.
  896. // This may be used to include null fields in Patch requests.
  897. NullFields []string `json:"-"`
  898. }
  899. func (s *ChildReference) MarshalJSON() ([]byte, error) {
  900. type NoMethod ChildReference
  901. raw := NoMethod(*s)
  902. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  903. }
  904. // Comment: A comment on a file in Google Drive.
  905. type Comment struct {
  906. // Anchor: A region of the document represented as a JSON string. See
  907. // anchor documentation for details on how to define and interpret
  908. // anchor properties.
  909. Anchor string `json:"anchor,omitempty"`
  910. // Author: The user who wrote this comment.
  911. Author *User `json:"author,omitempty"`
  912. // CommentId: The ID of the comment.
  913. CommentId string `json:"commentId,omitempty"`
  914. // Content: The plain text content used to create this comment. This is
  915. // not HTML safe and should only be used as a starting point to make
  916. // edits to a comment's content.
  917. Content string `json:"content,omitempty"`
  918. // Context: The context of the file which is being commented on.
  919. Context *CommentContext `json:"context,omitempty"`
  920. // CreatedDate: The date when this comment was first created.
  921. CreatedDate string `json:"createdDate,omitempty"`
  922. // Deleted: Whether this comment has been deleted. If a comment has been
  923. // deleted the content will be cleared and this will only represent a
  924. // comment that once existed.
  925. Deleted bool `json:"deleted,omitempty"`
  926. // FileId: The file which this comment is addressing.
  927. FileId string `json:"fileId,omitempty"`
  928. // FileTitle: The title of the file which this comment is addressing.
  929. FileTitle string `json:"fileTitle,omitempty"`
  930. // HtmlContent: HTML formatted content for this comment.
  931. HtmlContent string `json:"htmlContent,omitempty"`
  932. // Kind: This is always drive#comment.
  933. Kind string `json:"kind,omitempty"`
  934. // ModifiedDate: The date when this comment or any of its replies were
  935. // last modified.
  936. ModifiedDate string `json:"modifiedDate,omitempty"`
  937. // Replies: Replies to this post.
  938. Replies []*CommentReply `json:"replies,omitempty"`
  939. // SelfLink: A link back to this comment.
  940. SelfLink string `json:"selfLink,omitempty"`
  941. // Status: The status of this comment. Status can be changed by posting
  942. // a reply to a comment with the desired status.
  943. // - "open" - The comment is still open.
  944. // - "resolved" - The comment has been resolved by one of its replies.
  945. Status string `json:"status,omitempty"`
  946. // ServerResponse contains the HTTP response code and headers from the
  947. // server.
  948. googleapi.ServerResponse `json:"-"`
  949. // ForceSendFields is a list of field names (e.g. "Anchor") to
  950. // unconditionally include in API requests. By default, fields with
  951. // empty values are omitted from API requests. However, any non-pointer,
  952. // non-interface field appearing in ForceSendFields will be sent to the
  953. // server regardless of whether the field is empty or not. This may be
  954. // used to include empty fields in Patch requests.
  955. ForceSendFields []string `json:"-"`
  956. // NullFields is a list of field names (e.g. "Anchor") to include in API
  957. // requests with the JSON null value. By default, fields with empty
  958. // values are omitted from API requests. However, any field with an
  959. // empty value appearing in NullFields will be sent to the server as
  960. // null. It is an error if a field in this list has a non-empty value.
  961. // This may be used to include null fields in Patch requests.
  962. NullFields []string `json:"-"`
  963. }
  964. func (s *Comment) MarshalJSON() ([]byte, error) {
  965. type NoMethod Comment
  966. raw := NoMethod(*s)
  967. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  968. }
  969. // CommentContext: The context of the file which is being commented on.
  970. type CommentContext struct {
  971. // Type: The MIME type of the context snippet.
  972. Type string `json:"type,omitempty"`
  973. // Value: Data representation of the segment of the file being commented
  974. // on. In the case of a text file for example, this would be the actual
  975. // text that the comment is about.
  976. Value string `json:"value,omitempty"`
  977. // ForceSendFields is a list of field names (e.g. "Type") to
  978. // unconditionally include in API requests. By default, fields with
  979. // empty values are omitted from API requests. However, any non-pointer,
  980. // non-interface field appearing in ForceSendFields will be sent to the
  981. // server regardless of whether the field is empty or not. This may be
  982. // used to include empty fields in Patch requests.
  983. ForceSendFields []string `json:"-"`
  984. // NullFields is a list of field names (e.g. "Type") to include in API
  985. // requests with the JSON null value. By default, fields with empty
  986. // values are omitted from API requests. However, any field with an
  987. // empty value appearing in NullFields will be sent to the server as
  988. // null. It is an error if a field in this list has a non-empty value.
  989. // This may be used to include null fields in Patch requests.
  990. NullFields []string `json:"-"`
  991. }
  992. func (s *CommentContext) MarshalJSON() ([]byte, error) {
  993. type NoMethod CommentContext
  994. raw := NoMethod(*s)
  995. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  996. }
  997. // CommentList: A list of comments on a file in Google Drive.
  998. type CommentList struct {
  999. // Items: The list of comments. If nextPageToken is populated, then this
  1000. // list may be incomplete and an additional page of results should be
  1001. // fetched.
  1002. Items []*Comment `json:"items,omitempty"`
  1003. // Kind: This is always drive#commentList.
  1004. Kind string `json:"kind,omitempty"`
  1005. // NextLink: A link to the next page of comments.
  1006. NextLink string `json:"nextLink,omitempty"`
  1007. // NextPageToken: The page token for the next page of comments. This
  1008. // will be absent if the end of the comments list has been reached. If
  1009. // the token is rejected for any reason, it should be discarded, and
  1010. // pagination should be restarted from the first page of results.
  1011. NextPageToken string `json:"nextPageToken,omitempty"`
  1012. // SelfLink: A link back to this list.
  1013. SelfLink string `json:"selfLink,omitempty"`
  1014. // ServerResponse contains the HTTP response code and headers from the
  1015. // server.
  1016. googleapi.ServerResponse `json:"-"`
  1017. // ForceSendFields is a list of field names (e.g. "Items") to
  1018. // unconditionally include in API requests. By default, fields with
  1019. // empty values are omitted from API requests. However, any non-pointer,
  1020. // non-interface field appearing in ForceSendFields will be sent to the
  1021. // server regardless of whether the field is empty or not. This may be
  1022. // used to include empty fields in Patch requests.
  1023. ForceSendFields []string `json:"-"`
  1024. // NullFields is a list of field names (e.g. "Items") to include in API
  1025. // requests with the JSON null value. By default, fields with empty
  1026. // values are omitted from API requests. However, any field with an
  1027. // empty value appearing in NullFields will be sent to the server as
  1028. // null. It is an error if a field in this list has a non-empty value.
  1029. // This may be used to include null fields in Patch requests.
  1030. NullFields []string `json:"-"`
  1031. }
  1032. func (s *CommentList) MarshalJSON() ([]byte, error) {
  1033. type NoMethod CommentList
  1034. raw := NoMethod(*s)
  1035. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1036. }
  1037. // CommentReply: A comment on a file in Google Drive.
  1038. type CommentReply struct {
  1039. // Author: The user who wrote this reply.
  1040. Author *User `json:"author,omitempty"`
  1041. // Content: The plain text content used to create this reply. This is
  1042. // not HTML safe and should only be used as a starting point to make
  1043. // edits to a reply's content. This field is required on inserts if no
  1044. // verb is specified (resolve/reopen).
  1045. Content string `json:"content,omitempty"`
  1046. // CreatedDate: The date when this reply was first created.
  1047. CreatedDate string `json:"createdDate,omitempty"`
  1048. // Deleted: Whether this reply has been deleted. If a reply has been
  1049. // deleted the content will be cleared and this will only represent a
  1050. // reply that once existed.
  1051. Deleted bool `json:"deleted,omitempty"`
  1052. // HtmlContent: HTML formatted content for this reply.
  1053. HtmlContent string `json:"htmlContent,omitempty"`
  1054. // Kind: This is always drive#commentReply.
  1055. Kind string `json:"kind,omitempty"`
  1056. // ModifiedDate: The date when this reply was last modified.
  1057. ModifiedDate string `json:"modifiedDate,omitempty"`
  1058. // ReplyId: The ID of the reply.
  1059. ReplyId string `json:"replyId,omitempty"`
  1060. // Verb: The action this reply performed to the parent comment. When
  1061. // creating a new reply this is the action to be perform to the parent
  1062. // comment. Possible values are:
  1063. // - "resolve" - To resolve a comment.
  1064. // - "reopen" - To reopen (un-resolve) a comment.
  1065. Verb string `json:"verb,omitempty"`
  1066. // ServerResponse contains the HTTP response code and headers from the
  1067. // server.
  1068. googleapi.ServerResponse `json:"-"`
  1069. // ForceSendFields is a list of field names (e.g. "Author") to
  1070. // unconditionally include in API requests. By default, fields with
  1071. // empty values are omitted from API requests. However, any non-pointer,
  1072. // non-interface field appearing in ForceSendFields will be sent to the
  1073. // server regardless of whether the field is empty or not. This may be
  1074. // used to include empty fields in Patch requests.
  1075. ForceSendFields []string `json:"-"`
  1076. // NullFields is a list of field names (e.g. "Author") to include in API
  1077. // requests with the JSON null value. By default, fields with empty
  1078. // values are omitted from API requests. However, any field with an
  1079. // empty value appearing in NullFields will be sent to the server as
  1080. // null. It is an error if a field in this list has a non-empty value.
  1081. // This may be used to include null fields in Patch requests.
  1082. NullFields []string `json:"-"`
  1083. }
  1084. func (s *CommentReply) MarshalJSON() ([]byte, error) {
  1085. type NoMethod CommentReply
  1086. raw := NoMethod(*s)
  1087. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1088. }
  1089. // CommentReplyList: A list of replies to a comment on a file in Google
  1090. // Drive.
  1091. type CommentReplyList struct {
  1092. // Items: The list of replies. If nextPageToken is populated, then this
  1093. // list may be incomplete and an additional page of results should be
  1094. // fetched.
  1095. Items []*CommentReply `json:"items,omitempty"`
  1096. // Kind: This is always drive#commentReplyList.
  1097. Kind string `json:"kind,omitempty"`
  1098. // NextLink: A link to the next page of replies.
  1099. NextLink string `json:"nextLink,omitempty"`
  1100. // NextPageToken: The page token for the next page of replies. This will
  1101. // be absent if the end of the replies list has been reached. If the
  1102. // token is rejected for any reason, it should be discarded, and
  1103. // pagination should be restarted from the first page of results.
  1104. NextPageToken string `json:"nextPageToken,omitempty"`
  1105. // SelfLink: A link back to this list.
  1106. SelfLink string `json:"selfLink,omitempty"`
  1107. // ServerResponse contains the HTTP response code and headers from the
  1108. // server.
  1109. googleapi.ServerResponse `json:"-"`
  1110. // ForceSendFields is a list of field names (e.g. "Items") to
  1111. // unconditionally include in API requests. By default, fields with
  1112. // empty values are omitted from API requests. However, any non-pointer,
  1113. // non-interface field appearing in ForceSendFields will be sent to the
  1114. // server regardless of whether the field is empty or not. This may be
  1115. // used to include empty fields in Patch requests.
  1116. ForceSendFields []string `json:"-"`
  1117. // NullFields is a list of field names (e.g. "Items") to include in API
  1118. // requests with the JSON null value. By default, fields with empty
  1119. // values are omitted from API requests. However, any field with an
  1120. // empty value appearing in NullFields will be sent to the server as
  1121. // null. It is an error if a field in this list has a non-empty value.
  1122. // This may be used to include null fields in Patch requests.
  1123. NullFields []string `json:"-"`
  1124. }
  1125. func (s *CommentReplyList) MarshalJSON() ([]byte, error) {
  1126. type NoMethod CommentReplyList
  1127. raw := NoMethod(*s)
  1128. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1129. }
  1130. // File: The metadata for a file.
  1131. type File struct {
  1132. // AlternateLink: A link for opening the file in a relevant Google
  1133. // editor or viewer.
  1134. AlternateLink string `json:"alternateLink,omitempty"`
  1135. // AppDataContents: Whether this file is in the Application Data folder.
  1136. AppDataContents bool `json:"appDataContents,omitempty"`
  1137. // CanComment: Deprecated: use capabilities/canComment.
  1138. CanComment bool `json:"canComment,omitempty"`
  1139. // CanReadRevisions: Deprecated: use capabilities/canReadRevisions.
  1140. CanReadRevisions bool `json:"canReadRevisions,omitempty"`
  1141. // Capabilities: Capabilities the current user has on this file. Each
  1142. // capability corresponds to a fine-grained action that a user may take.
  1143. Capabilities *FileCapabilities `json:"capabilities,omitempty"`
  1144. // Copyable: Deprecated: use capabilities/canCopy.
  1145. Copyable bool `json:"copyable,omitempty"`
  1146. // CreatedDate: Create time for this file (formatted RFC 3339
  1147. // timestamp).
  1148. CreatedDate string `json:"createdDate,omitempty"`
  1149. // DefaultOpenWithLink: A link to open this file with the user's default
  1150. // app for this file. Only populated when the drive.apps.readonly scope
  1151. // is used.
  1152. DefaultOpenWithLink string `json:"defaultOpenWithLink,omitempty"`
  1153. // Description: A short description of the file.
  1154. Description string `json:"description,omitempty"`
  1155. DownloadUrl string `json:"downloadUrl,omitempty"`
  1156. // Editable: Deprecated: use capabilities/canEdit.
  1157. Editable bool `json:"editable,omitempty"`
  1158. // EmbedLink: A link for embedding the file.
  1159. EmbedLink string `json:"embedLink,omitempty"`
  1160. // Etag: ETag of the file.
  1161. Etag string `json:"etag,omitempty"`
  1162. // ExplicitlyTrashed: Whether this file has been explicitly trashed, as
  1163. // opposed to recursively trashed.
  1164. ExplicitlyTrashed bool `json:"explicitlyTrashed,omitempty"`
  1165. // ExportLinks: Links for exporting Google Docs to specific formats.
  1166. ExportLinks map[string]string `json:"exportLinks,omitempty"`
  1167. // FileExtension: The final component of fullFileExtension with trailing
  1168. // text that does not appear to be part of the extension removed. This
  1169. // field is only populated for files with content stored in Drive; it is
  1170. // not populated for Google Docs or shortcut files.
  1171. FileExtension string `json:"fileExtension,omitempty"`
  1172. // FileSize: The size of the file in bytes. This field is only populated
  1173. // for files with content stored in Drive; it is not populated for
  1174. // Google Docs or shortcut files.
  1175. FileSize int64 `json:"fileSize,omitempty,string"`
  1176. // FolderColorRgb: Folder color as an RGB hex string if the file is a
  1177. // folder. The list of supported colors is available in the
  1178. // folderColorPalette field of the About resource. If an unsupported
  1179. // color is specified, it will be changed to the closest color in the
  1180. // palette. Not populated for Team Drive files.
  1181. FolderColorRgb string `json:"folderColorRgb,omitempty"`
  1182. // FullFileExtension: The full file extension; extracted from the title.
  1183. // May contain multiple concatenated extensions, such as "tar.gz".
  1184. // Removing an extension from the title does not clear this field;
  1185. // however, changing the extension on the title does update this field.
  1186. // This field is only populated for files with content stored in Drive;
  1187. // it is not populated for Google Docs or shortcut files.
  1188. FullFileExtension string `json:"fullFileExtension,omitempty"`
  1189. // HasAugmentedPermissions: Whether any users are granted file access
  1190. // directly on this file. This field is only populated for Team Drive
  1191. // files.
  1192. HasAugmentedPermissions bool `json:"hasAugmentedPermissions,omitempty"`
  1193. // HasThumbnail: Whether this file has a thumbnail. This does not
  1194. // indicate whether the requesting app has access to the thumbnail. To
  1195. // check access, look for the presence of the thumbnailLink field.
  1196. HasThumbnail bool `json:"hasThumbnail,omitempty"`
  1197. // HeadRevisionId: The ID of the file's head revision. This field is
  1198. // only populated for files with content stored in Drive; it is not
  1199. // populated for Google Docs or shortcut files.
  1200. HeadRevisionId string `json:"headRevisionId,omitempty"`
  1201. // IconLink: A link to the file's icon.
  1202. IconLink string `json:"iconLink,omitempty"`
  1203. // Id: The ID of the file.
  1204. Id string `json:"id,omitempty"`
  1205. // ImageMediaMetadata: Metadata about image media. This will only be
  1206. // present for image types, and its contents will depend on what can be
  1207. // parsed from the image content.
  1208. ImageMediaMetadata *FileImageMediaMetadata `json:"imageMediaMetadata,omitempty"`
  1209. // IndexableText: Indexable text attributes for the file (can only be
  1210. // written)
  1211. IndexableText *FileIndexableText `json:"indexableText,omitempty"`
  1212. // IsAppAuthorized: Whether the file was created or opened by the
  1213. // requesting app.
  1214. IsAppAuthorized bool `json:"isAppAuthorized,omitempty"`
  1215. // Kind: The type of file. This is always drive#file.
  1216. Kind string `json:"kind,omitempty"`
  1217. // Labels: A group of labels for the file.
  1218. Labels *FileLabels `json:"labels,omitempty"`
  1219. // LastModifyingUser: The last user to modify this file.
  1220. LastModifyingUser *User `json:"lastModifyingUser,omitempty"`
  1221. // LastModifyingUserName: Name of the last user to modify this file.
  1222. LastModifyingUserName string `json:"lastModifyingUserName,omitempty"`
  1223. // LastViewedByMeDate: Last time this file was viewed by the user
  1224. // (formatted RFC 3339 timestamp).
  1225. LastViewedByMeDate string `json:"lastViewedByMeDate,omitempty"`
  1226. // MarkedViewedByMeDate: Deprecated.
  1227. MarkedViewedByMeDate string `json:"markedViewedByMeDate,omitempty"`
  1228. // Md5Checksum: An MD5 checksum for the content of this file. This field
  1229. // is only populated for files with content stored in Drive; it is not
  1230. // populated for Google Docs or shortcut files.
  1231. Md5Checksum string `json:"md5Checksum,omitempty"`
  1232. // MimeType: The MIME type of the file. This is only mutable on update
  1233. // when uploading new content. This field can be left blank, and the
  1234. // mimetype will be determined from the uploaded content's MIME type.
  1235. MimeType string `json:"mimeType,omitempty"`
  1236. // ModifiedByMeDate: Last time this file was modified by the user
  1237. // (formatted RFC 3339 timestamp). Note that setting modifiedDate will
  1238. // also update the modifiedByMe date for the user which set the date.
  1239. ModifiedByMeDate string `json:"modifiedByMeDate,omitempty"`
  1240. // ModifiedDate: Last time this file was modified by anyone (formatted
  1241. // RFC 3339 timestamp). This is only mutable on update when the
  1242. // setModifiedDate parameter is set.
  1243. ModifiedDate string `json:"modifiedDate,omitempty"`
  1244. // OpenWithLinks: A map of the id of each of the user's apps to a link
  1245. // to open this file with that app. Only populated when the
  1246. // drive.apps.readonly scope is used.
  1247. OpenWithLinks map[string]string `json:"openWithLinks,omitempty"`
  1248. // OriginalFilename: The original filename of the uploaded content if
  1249. // available, or else the original value of the title field. This is
  1250. // only available for files with binary content in Drive.
  1251. OriginalFilename string `json:"originalFilename,omitempty"`
  1252. // OwnedByMe: Whether the file is owned by the current user. Not
  1253. // populated for Team Drive files.
  1254. OwnedByMe bool `json:"ownedByMe,omitempty"`
  1255. // OwnerNames: Name(s) of the owner(s) of this file. Not populated for
  1256. // Team Drive files.
  1257. OwnerNames []string `json:"ownerNames,omitempty"`
  1258. // Owners: The owner(s) of this file. Not populated for Team Drive
  1259. // files.
  1260. Owners []*User `json:"owners,omitempty"`
  1261. // Parents: Collection of parent folders which contain this file.
  1262. // If not specified as part of an insert request, the file will be
  1263. // placed directly in the user's My Drive folder. If not specified as
  1264. // part of a copy request, the file will inherit any discoverable
  1265. // parents of the source file. Update requests can also use the
  1266. // addParents and removeParents parameters to modify the parents list.
  1267. Parents []*ParentReference `json:"parents,omitempty"`
  1268. // PermissionIds: List of permission IDs for users with access to this
  1269. // file.
  1270. PermissionIds []string `json:"permissionIds,omitempty"`
  1271. // Permissions: The list of permissions for users with access to this
  1272. // file. Not populated for Team Drive files.
  1273. Permissions []*Permission `json:"permissions,omitempty"`
  1274. // Properties: The list of properties.
  1275. Properties []*Property `json:"properties,omitempty"`
  1276. // QuotaBytesUsed: The number of quota bytes used by this file.
  1277. QuotaBytesUsed int64 `json:"quotaBytesUsed,omitempty,string"`
  1278. // SelfLink: A link back to this file.
  1279. SelfLink string `json:"selfLink,omitempty"`
  1280. // Shareable: Deprecated: use capabilities/canShare.
  1281. Shareable bool `json:"shareable,omitempty"`
  1282. // Shared: Whether the file has been shared. Not populated for Team
  1283. // Drive files.
  1284. Shared bool `json:"shared,omitempty"`
  1285. // SharedWithMeDate: Time at which this file was shared with the user
  1286. // (formatted RFC 3339 timestamp).
  1287. SharedWithMeDate string `json:"sharedWithMeDate,omitempty"`
  1288. // SharingUser: User that shared the item with the current user, if
  1289. // available.
  1290. SharingUser *User `json:"sharingUser,omitempty"`
  1291. // Spaces: The list of spaces which contain the file. Supported values
  1292. // are 'drive', 'appDataFolder' and 'photos'.
  1293. Spaces []string `json:"spaces,omitempty"`
  1294. // TeamDriveId: ID of the Team Drive the file resides in.
  1295. TeamDriveId string `json:"teamDriveId,omitempty"`
  1296. // Thumbnail: A thumbnail for the file. This will only be used if Drive
  1297. // cannot generate a standard thumbnail.
  1298. Thumbnail *FileThumbnail `json:"thumbnail,omitempty"`
  1299. // ThumbnailLink: A short-lived link to the file's thumbnail. Typically
  1300. // lasts on the order of hours. Only populated when the requesting app
  1301. // can access the file's content.
  1302. ThumbnailLink string `json:"thumbnailLink,omitempty"`
  1303. // ThumbnailVersion: The thumbnail version for use in thumbnail cache
  1304. // invalidation.
  1305. ThumbnailVersion int64 `json:"thumbnailVersion,omitempty,string"`
  1306. // Title: The title of this file. Note that for immutable items such as
  1307. // the top level folders of Team Drives, My Drive root folder, and
  1308. // Application Data folder the title is constant.
  1309. Title string `json:"title,omitempty"`
  1310. // TrashedDate: The time that the item was trashed (formatted RFC 3339
  1311. // timestamp). Only populated for Team Drive files.
  1312. TrashedDate string `json:"trashedDate,omitempty"`
  1313. // TrashingUser: If the file has been explicitly trashed, the user who
  1314. // trashed it. Only populated for Team Drive files.
  1315. TrashingUser *User `json:"trashingUser,omitempty"`
  1316. // UserPermission: The permissions for the authenticated user on this
  1317. // file.
  1318. UserPermission *Permission `json:"userPermission,omitempty"`
  1319. // Version: A monotonically increasing version number for the file. This
  1320. // reflects every change made to the file on the server, even those not
  1321. // visible to the requesting user.
  1322. Version int64 `json:"version,omitempty,string"`
  1323. // VideoMediaMetadata: Metadata about video media. This will only be
  1324. // present for video types.
  1325. VideoMediaMetadata *FileVideoMediaMetadata `json:"videoMediaMetadata,omitempty"`
  1326. // WebContentLink: A link for downloading the content of the file in a
  1327. // browser using cookie based authentication. In cases where the content
  1328. // is shared publicly, the content can be downloaded without any
  1329. // credentials.
  1330. WebContentLink string `json:"webContentLink,omitempty"`
  1331. // WebViewLink: A link only available on public folders for viewing
  1332. // their static web assets (HTML, CSS, JS, etc) via Google Drive's
  1333. // Website Hosting.
  1334. WebViewLink string `json:"webViewLink,omitempty"`
  1335. // WritersCanShare: Whether writers can share the document with other
  1336. // users. Not populated for Team Drive files.
  1337. WritersCanShare bool `json:"writersCanShare,omitempty"`
  1338. // ServerResponse contains the HTTP response code and headers from the
  1339. // server.
  1340. googleapi.ServerResponse `json:"-"`
  1341. // ForceSendFields is a list of field names (e.g. "AlternateLink") to
  1342. // unconditionally include in API requests. By default, fields with
  1343. // empty values are omitted from API requests. However, any non-pointer,
  1344. // non-interface field appearing in ForceSendFields will be sent to the
  1345. // server regardless of whether the field is empty or not. This may be
  1346. // used to include empty fields in Patch requests.
  1347. ForceSendFields []string `json:"-"`
  1348. // NullFields is a list of field names (e.g. "AlternateLink") to include
  1349. // in API requests with the JSON null value. By default, fields with
  1350. // empty values are omitted from API requests. However, any field with
  1351. // an empty value appearing in NullFields will be sent to the server as
  1352. // null. It is an error if a field in this list has a non-empty value.
  1353. // This may be used to include null fields in Patch requests.
  1354. NullFields []string `json:"-"`
  1355. }
  1356. func (s *File) MarshalJSON() ([]byte, error) {
  1357. type NoMethod File
  1358. raw := NoMethod(*s)
  1359. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1360. }
  1361. // FileCapabilities: Capabilities the current user has on this file.
  1362. // Each capability corresponds to a fine-grained action that a user may
  1363. // take.
  1364. type FileCapabilities struct {
  1365. // CanAddChildren: Whether the current user can add children to this
  1366. // folder. This is always false when the item is not a folder.
  1367. CanAddChildren bool `json:"canAddChildren,omitempty"`
  1368. // CanChangeRestrictedDownload: Whether the current user can change the
  1369. // restricted download label of this file.
  1370. CanChangeRestrictedDownload bool `json:"canChangeRestrictedDownload,omitempty"`
  1371. // CanComment: Whether the current user can comment on this file.
  1372. CanComment bool `json:"canComment,omitempty"`
  1373. // CanCopy: Whether the current user can copy this file. For a Team
  1374. // Drive item, whether the current user can copy non-folder descendants
  1375. // of this item, or this item itself if it is not a folder.
  1376. CanCopy bool `json:"canCopy,omitempty"`
  1377. // CanDelete: Whether the current user can delete this file.
  1378. CanDelete bool `json:"canDelete,omitempty"`
  1379. // CanDownload: Whether the current user can download this file.
  1380. CanDownload bool `json:"canDownload,omitempty"`
  1381. // CanEdit: Whether the current user can edit this file.
  1382. CanEdit bool `json:"canEdit,omitempty"`
  1383. // CanListChildren: Whether the current user can list the children of
  1384. // this folder. This is always false when the item is not a folder.
  1385. CanListChildren bool `json:"canListChildren,omitempty"`
  1386. // CanMoveItemIntoTeamDrive: Whether the current user can move this item
  1387. // into a Team Drive. If the item is in a Team Drive, this field is
  1388. // equivalent to canMoveTeamDriveItem.
  1389. CanMoveItemIntoTeamDrive bool `json:"canMoveItemIntoTeamDrive,omitempty"`
  1390. // CanMoveTeamDriveItem: Whether the current user can move this Team
  1391. // Drive item by changing its parent. Note that a request to change the
  1392. // parent for this item may still fail depending on the new parent that
  1393. // is being added. Only populated for Team Drive files.
  1394. CanMoveTeamDriveItem bool `json:"canMoveTeamDriveItem,omitempty"`
  1395. // CanReadRevisions: Whether the current user can read the revisions
  1396. // resource of this file. For a Team Drive item, whether revisions of
  1397. // non-folder descendants of this item, or this item itself if it is not
  1398. // a folder, can be read.
  1399. CanReadRevisions bool `json:"canReadRevisions,omitempty"`
  1400. // CanReadTeamDrive: Whether the current user can read the Team Drive to
  1401. // which this file belongs. Only populated for Team Drive files.
  1402. CanReadTeamDrive bool `json:"canReadTeamDrive,omitempty"`
  1403. // CanRemoveChildren: Whether the current user can remove children from
  1404. // this folder. This is always false when the item is not a folder.
  1405. CanRemoveChildren bool `json:"canRemoveChildren,omitempty"`
  1406. // CanRename: Whether the current user can rename this file.
  1407. CanRename bool `json:"canRename,omitempty"`
  1408. // CanShare: Whether the current user can modify the sharing settings
  1409. // for this file.
  1410. CanShare bool `json:"canShare,omitempty"`
  1411. // CanTrash: Whether the current user can move this file to trash.
  1412. CanTrash bool `json:"canTrash,omitempty"`
  1413. // CanUntrash: Whether the current user can restore this file from
  1414. // trash.
  1415. CanUntrash bool `json:"canUntrash,omitempty"`
  1416. // ForceSendFields is a list of field names (e.g. "CanAddChildren") to
  1417. // unconditionally include in API requests. By default, fields with
  1418. // empty values are omitted from API requests. However, any non-pointer,
  1419. // non-interface field appearing in ForceSendFields will be sent to the
  1420. // server regardless of whether the field is empty or not. This may be
  1421. // used to include empty fields in Patch requests.
  1422. ForceSendFields []string `json:"-"`
  1423. // NullFields is a list of field names (e.g. "CanAddChildren") to
  1424. // include in API requests with the JSON null value. By default, fields
  1425. // with empty values are omitted from API requests. However, any field
  1426. // with an empty value appearing in NullFields will be sent to the
  1427. // server as null. It is an error if a field in this list has a
  1428. // non-empty value. This may be used to include null fields in Patch
  1429. // requests.
  1430. NullFields []string `json:"-"`
  1431. }
  1432. func (s *FileCapabilities) MarshalJSON() ([]byte, error) {
  1433. type NoMethod FileCapabilities
  1434. raw := NoMethod(*s)
  1435. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1436. }
  1437. // FileImageMediaMetadata: Metadata about image media. This will only be
  1438. // present for image types, and its contents will depend on what can be
  1439. // parsed from the image content.
  1440. type FileImageMediaMetadata struct {
  1441. // Aperture: The aperture used to create the photo (f-number).
  1442. Aperture float64 `json:"aperture,omitempty"`
  1443. // CameraMake: The make of the camera used to create the photo.
  1444. CameraMake string `json:"cameraMake,omitempty"`
  1445. // CameraModel: The model of the camera used to create the photo.
  1446. CameraModel string `json:"cameraModel,omitempty"`
  1447. // ColorSpace: The color space of the photo.
  1448. ColorSpace string `json:"colorSpace,omitempty"`
  1449. // Date: The date and time the photo was taken (EXIF format timestamp).
  1450. Date string `json:"date,omitempty"`
  1451. // ExposureBias: The exposure bias of the photo (APEX value).
  1452. ExposureBias float64 `json:"exposureBias,omitempty"`
  1453. // ExposureMode: The exposure mode used to create the photo.
  1454. ExposureMode string `json:"exposureMode,omitempty"`
  1455. // ExposureTime: The length of the exposure, in seconds.
  1456. ExposureTime float64 `json:"exposureTime,omitempty"`
  1457. // FlashUsed: Whether a flash was used to create the photo.
  1458. FlashUsed bool `json:"flashUsed,omitempty"`
  1459. // FocalLength: The focal length used to create the photo, in
  1460. // millimeters.
  1461. FocalLength float64 `json:"focalLength,omitempty"`
  1462. // Height: The height of the image in pixels.
  1463. Height int64 `json:"height,omitempty"`
  1464. // IsoSpeed: The ISO speed used to create the photo.
  1465. IsoSpeed int64 `json:"isoSpeed,omitempty"`
  1466. // Lens: The lens used to create the photo.
  1467. Lens string `json:"lens,omitempty"`
  1468. // Location: Geographic location information stored in the image.
  1469. Location *FileImageMediaMetadataLocation `json:"location,omitempty"`
  1470. // MaxApertureValue: The smallest f-number of the lens at the focal
  1471. // length used to create the photo (APEX value).
  1472. MaxApertureValue float64 `json:"maxApertureValue,omitempty"`
  1473. // MeteringMode: The metering mode used to create the photo.
  1474. MeteringMode string `json:"meteringMode,omitempty"`
  1475. // Rotation: The rotation in clockwise degrees from the image's original
  1476. // orientation.
  1477. Rotation int64 `json:"rotation,omitempty"`
  1478. // Sensor: The type of sensor used to create the photo.
  1479. Sensor string `json:"sensor,omitempty"`
  1480. // SubjectDistance: The distance to the subject of the photo, in meters.
  1481. SubjectDistance int64 `json:"subjectDistance,omitempty"`
  1482. // WhiteBalance: The white balance mode used to create the photo.
  1483. WhiteBalance string `json:"whiteBalance,omitempty"`
  1484. // Width: The width of the image in pixels.
  1485. Width int64 `json:"width,omitempty"`
  1486. // ForceSendFields is a list of field names (e.g. "Aperture") to
  1487. // unconditionally include in API requests. By default, fields with
  1488. // empty values are omitted from API requests. However, any non-pointer,
  1489. // non-interface field appearing in ForceSendFields will be sent to the
  1490. // server regardless of whether the field is empty or not. This may be
  1491. // used to include empty fields in Patch requests.
  1492. ForceSendFields []string `json:"-"`
  1493. // NullFields is a list of field names (e.g. "Aperture") to include in
  1494. // API requests with the JSON null value. By default, fields with empty
  1495. // values are omitted from API requests. However, any field with an
  1496. // empty value appearing in NullFields will be sent to the server as
  1497. // null. It is an error if a field in this list has a non-empty value.
  1498. // This may be used to include null fields in Patch requests.
  1499. NullFields []string `json:"-"`
  1500. }
  1501. func (s *FileImageMediaMetadata) MarshalJSON() ([]byte, error) {
  1502. type NoMethod FileImageMediaMetadata
  1503. raw := NoMethod(*s)
  1504. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1505. }
  1506. func (s *FileImageMediaMetadata) UnmarshalJSON(data []byte) error {
  1507. type NoMethod FileImageMediaMetadata
  1508. var s1 struct {
  1509. Aperture gensupport.JSONFloat64 `json:"aperture"`
  1510. ExposureBias gensupport.JSONFloat64 `json:"exposureBias"`
  1511. ExposureTime gensupport.JSONFloat64 `json:"exposureTime"`
  1512. FocalLength gensupport.JSONFloat64 `json:"focalLength"`
  1513. MaxApertureValue gensupport.JSONFloat64 `json:"maxApertureValue"`
  1514. *NoMethod
  1515. }
  1516. s1.NoMethod = (*NoMethod)(s)
  1517. if err := json.Unmarshal(data, &s1); err != nil {
  1518. return err
  1519. }
  1520. s.Aperture = float64(s1.Aperture)
  1521. s.ExposureBias = float64(s1.ExposureBias)
  1522. s.ExposureTime = float64(s1.ExposureTime)
  1523. s.FocalLength = float64(s1.FocalLength)
  1524. s.MaxApertureValue = float64(s1.MaxApertureValue)
  1525. return nil
  1526. }
  1527. // FileImageMediaMetadataLocation: Geographic location information
  1528. // stored in the image.
  1529. type FileImageMediaMetadataLocation struct {
  1530. // Altitude: The altitude stored in the image.
  1531. Altitude float64 `json:"altitude,omitempty"`
  1532. // Latitude: The latitude stored in the image.
  1533. Latitude float64 `json:"latitude,omitempty"`
  1534. // Longitude: The longitude stored in the image.
  1535. Longitude float64 `json:"longitude,omitempty"`
  1536. // ForceSendFields is a list of field names (e.g. "Altitude") to
  1537. // unconditionally include in API requests. By default, fields with
  1538. // empty values are omitted from API requests. However, any non-pointer,
  1539. // non-interface field appearing in ForceSendFields will be sent to the
  1540. // server regardless of whether the field is empty or not. This may be
  1541. // used to include empty fields in Patch requests.
  1542. ForceSendFields []string `json:"-"`
  1543. // NullFields is a list of field names (e.g. "Altitude") to include in
  1544. // API requests with the JSON null value. By default, fields with empty
  1545. // values are omitted from API requests. However, any field with an
  1546. // empty value appearing in NullFields will be sent to the server as
  1547. // null. It is an error if a field in this list has a non-empty value.
  1548. // This may be used to include null fields in Patch requests.
  1549. NullFields []string `json:"-"`
  1550. }
  1551. func (s *FileImageMediaMetadataLocation) MarshalJSON() ([]byte, error) {
  1552. type NoMethod FileImageMediaMetadataLocation
  1553. raw := NoMethod(*s)
  1554. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1555. }
  1556. func (s *FileImageMediaMetadataLocation) UnmarshalJSON(data []byte) error {
  1557. type NoMethod FileImageMediaMetadataLocation
  1558. var s1 struct {
  1559. Altitude gensupport.JSONFloat64 `json:"altitude"`
  1560. Latitude gensupport.JSONFloat64 `json:"latitude"`
  1561. Longitude gensupport.JSONFloat64 `json:"longitude"`
  1562. *NoMethod
  1563. }
  1564. s1.NoMethod = (*NoMethod)(s)
  1565. if err := json.Unmarshal(data, &s1); err != nil {
  1566. return err
  1567. }
  1568. s.Altitude = float64(s1.Altitude)
  1569. s.Latitude = float64(s1.Latitude)
  1570. s.Longitude = float64(s1.Longitude)
  1571. return nil
  1572. }
  1573. // FileIndexableText: Indexable text attributes for the file (can only
  1574. // be written)
  1575. type FileIndexableText struct {
  1576. // Text: The text to be indexed for this file.
  1577. Text string `json:"text,omitempty"`
  1578. // ForceSendFields is a list of field names (e.g. "Text") to
  1579. // unconditionally include in API requests. By default, fields with
  1580. // empty values are omitted from API requests. However, any non-pointer,
  1581. // non-interface field appearing in ForceSendFields will be sent to the
  1582. // server regardless of whether the field is empty or not. This may be
  1583. // used to include empty fields in Patch requests.
  1584. ForceSendFields []string `json:"-"`
  1585. // NullFields is a list of field names (e.g. "Text") to include in API
  1586. // requests with the JSON null value. By default, fields with empty
  1587. // values are omitted from API requests. However, any field with an
  1588. // empty value appearing in NullFields will be sent to the server as
  1589. // null. It is an error if a field in this list has a non-empty value.
  1590. // This may be used to include null fields in Patch requests.
  1591. NullFields []string `json:"-"`
  1592. }
  1593. func (s *FileIndexableText) MarshalJSON() ([]byte, error) {
  1594. type NoMethod FileIndexableText
  1595. raw := NoMethod(*s)
  1596. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1597. }
  1598. // FileLabels: A group of labels for the file.
  1599. type FileLabels struct {
  1600. // Hidden: Deprecated.
  1601. Hidden bool `json:"hidden,omitempty"`
  1602. // Modified: Whether the file has been modified by this user.
  1603. Modified bool `json:"modified,omitempty"`
  1604. // Restricted: Whether viewers and commenters are prevented from
  1605. // downloading, printing, and copying this file.
  1606. Restricted bool `json:"restricted,omitempty"`
  1607. // Starred: Whether this file is starred by the user.
  1608. Starred bool `json:"starred,omitempty"`
  1609. // Trashed: Whether this file has been trashed. This label applies to
  1610. // all users accessing the file; however, only owners are allowed to see
  1611. // and untrash files.
  1612. Trashed bool `json:"trashed,omitempty"`
  1613. // Viewed: Whether this file has been viewed by this user.
  1614. Viewed bool `json:"viewed,omitempty"`
  1615. // ForceSendFields is a list of field names (e.g. "Hidden") to
  1616. // unconditionally include in API requests. By default, fields with
  1617. // empty values are omitted from API requests. However, any non-pointer,
  1618. // non-interface field appearing in ForceSendFields will be sent to the
  1619. // server regardless of whether the field is empty or not. This may be
  1620. // used to include empty fields in Patch requests.
  1621. ForceSendFields []string `json:"-"`
  1622. // NullFields is a list of field names (e.g. "Hidden") to include in API
  1623. // requests with the JSON null value. By default, fields with empty
  1624. // values are omitted from API requests. However, any field with an
  1625. // empty value appearing in NullFields will be sent to the server as
  1626. // null. It is an error if a field in this list has a non-empty value.
  1627. // This may be used to include null fields in Patch requests.
  1628. NullFields []string `json:"-"`
  1629. }
  1630. func (s *FileLabels) MarshalJSON() ([]byte, error) {
  1631. type NoMethod FileLabels
  1632. raw := NoMethod(*s)
  1633. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1634. }
  1635. // FileThumbnail: A thumbnail for the file. This will only be used if
  1636. // Drive cannot generate a standard thumbnail.
  1637. type FileThumbnail struct {
  1638. // Image: The URL-safe Base64 encoded bytes of the thumbnail image. It
  1639. // should conform to RFC 4648 section 5.
  1640. Image string `json:"image,omitempty"`
  1641. // MimeType: The MIME type of the thumbnail.
  1642. MimeType string `json:"mimeType,omitempty"`
  1643. // ForceSendFields is a list of field names (e.g. "Image") to
  1644. // unconditionally include in API requests. By default, fields with
  1645. // empty values are omitted from API requests. However, any non-pointer,
  1646. // non-interface field appearing in ForceSendFields will be sent to the
  1647. // server regardless of whether the field is empty or not. This may be
  1648. // used to include empty fields in Patch requests.
  1649. ForceSendFields []string `json:"-"`
  1650. // NullFields is a list of field names (e.g. "Image") to include in API
  1651. // requests with the JSON null value. By default, fields with empty
  1652. // values are omitted from API requests. However, any field with an
  1653. // empty value appearing in NullFields will be sent to the server as
  1654. // null. It is an error if a field in this list has a non-empty value.
  1655. // This may be used to include null fields in Patch requests.
  1656. NullFields []string `json:"-"`
  1657. }
  1658. func (s *FileThumbnail) MarshalJSON() ([]byte, error) {
  1659. type NoMethod FileThumbnail
  1660. raw := NoMethod(*s)
  1661. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1662. }
  1663. // FileVideoMediaMetadata: Metadata about video media. This will only be
  1664. // present for video types.
  1665. type FileVideoMediaMetadata struct {
  1666. // DurationMillis: The duration of the video in milliseconds.
  1667. DurationMillis int64 `json:"durationMillis,omitempty,string"`
  1668. // Height: The height of the video in pixels.
  1669. Height int64 `json:"height,omitempty"`
  1670. // Width: The width of the video in pixels.
  1671. Width int64 `json:"width,omitempty"`
  1672. // ForceSendFields is a list of field names (e.g. "DurationMillis") to
  1673. // unconditionally include in API requests. By default, fields with
  1674. // empty values are omitted from API requests. However, any non-pointer,
  1675. // non-interface field appearing in ForceSendFields will be sent to the
  1676. // server regardless of whether the field is empty or not. This may be
  1677. // used to include empty fields in Patch requests.
  1678. ForceSendFields []string `json:"-"`
  1679. // NullFields is a list of field names (e.g. "DurationMillis") to
  1680. // include in API requests with the JSON null value. By default, fields
  1681. // with empty values are omitted from API requests. However, any field
  1682. // with an empty value appearing in NullFields will be sent to the
  1683. // server as null. It is an error if a field in this list has a
  1684. // non-empty value. This may be used to include null fields in Patch
  1685. // requests.
  1686. NullFields []string `json:"-"`
  1687. }
  1688. func (s *FileVideoMediaMetadata) MarshalJSON() ([]byte, error) {
  1689. type NoMethod FileVideoMediaMetadata
  1690. raw := NoMethod(*s)
  1691. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1692. }
  1693. // FileList: A list of files.
  1694. type FileList struct {
  1695. // Etag: The ETag of the list.
  1696. Etag string `json:"etag,omitempty"`
  1697. // IncompleteSearch: Whether the search process was incomplete. If true,
  1698. // then some search results may be missing, since all documents were not
  1699. // searched. This may occur when searching multiple Team Drives with the
  1700. // "default,allTeamDrives" corpora, but all corpora could not be
  1701. // searched. When this happens, it is suggested that clients narrow
  1702. // their query by choosing a different corpus such as "default" or
  1703. // "teamDrive".
  1704. IncompleteSearch bool `json:"incompleteSearch,omitempty"`
  1705. // Items: The list of files. If nextPageToken is populated, then this
  1706. // list may be incomplete and an additional page of results should be
  1707. // fetched.
  1708. Items []*File `json:"items,omitempty"`
  1709. // Kind: This is always drive#fileList.
  1710. Kind string `json:"kind,omitempty"`
  1711. // NextLink: A link to the next page of files.
  1712. NextLink string `json:"nextLink,omitempty"`
  1713. // NextPageToken: The page token for the next page of files. This will
  1714. // be absent if the end of the files list has been reached. If the token
  1715. // is rejected for any reason, it should be discarded, and pagination
  1716. // should be restarted from the first page of results.
  1717. NextPageToken string `json:"nextPageToken,omitempty"`
  1718. // SelfLink: A link back to this list.
  1719. SelfLink string `json:"selfLink,omitempty"`
  1720. // ServerResponse contains the HTTP response code and headers from the
  1721. // server.
  1722. googleapi.ServerResponse `json:"-"`
  1723. // ForceSendFields is a list of field names (e.g. "Etag") to
  1724. // unconditionally include in API requests. By default, fields with
  1725. // empty values are omitted from API requests. However, any non-pointer,
  1726. // non-interface field appearing in ForceSendFields will be sent to the
  1727. // server regardless of whether the field is empty or not. This may be
  1728. // used to include empty fields in Patch requests.
  1729. ForceSendFields []string `json:"-"`
  1730. // NullFields is a list of field names (e.g. "Etag") to include in API
  1731. // requests with the JSON null value. By default, fields with empty
  1732. // values are omitted from API requests. However, any field with an
  1733. // empty value appearing in NullFields will be sent to the server as
  1734. // null. It is an error if a field in this list has a non-empty value.
  1735. // This may be used to include null fields in Patch requests.
  1736. NullFields []string `json:"-"`
  1737. }
  1738. func (s *FileList) MarshalJSON() ([]byte, error) {
  1739. type NoMethod FileList
  1740. raw := NoMethod(*s)
  1741. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1742. }
  1743. // GeneratedIds: A list of generated IDs which can be provided in insert
  1744. // requests
  1745. type GeneratedIds struct {
  1746. // Ids: The IDs generated for the requesting user in the specified
  1747. // space.
  1748. Ids []string `json:"ids,omitempty"`
  1749. // Kind: This is always drive#generatedIds
  1750. Kind string `json:"kind,omitempty"`
  1751. // Space: The type of file that can be created with these IDs.
  1752. Space string `json:"space,omitempty"`
  1753. // ServerResponse contains the HTTP response code and headers from the
  1754. // server.
  1755. googleapi.ServerResponse `json:"-"`
  1756. // ForceSendFields is a list of field names (e.g. "Ids") to
  1757. // unconditionally include in API requests. By default, fields with
  1758. // empty values are omitted from API requests. However, any non-pointer,
  1759. // non-interface field appearing in ForceSendFields will be sent to the
  1760. // server regardless of whether the field is empty or not. This may be
  1761. // used to include empty fields in Patch requests.
  1762. ForceSendFields []string `json:"-"`
  1763. // NullFields is a list of field names (e.g. "Ids") to include in API
  1764. // requests with the JSON null value. By default, fields with empty
  1765. // values are omitted from API requests. However, any field with an
  1766. // empty value appearing in NullFields will be sent to the server as
  1767. // null. It is an error if a field in this list has a non-empty value.
  1768. // This may be used to include null fields in Patch requests.
  1769. NullFields []string `json:"-"`
  1770. }
  1771. func (s *GeneratedIds) MarshalJSON() ([]byte, error) {
  1772. type NoMethod GeneratedIds
  1773. raw := NoMethod(*s)
  1774. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1775. }
  1776. // ParentList: A list of a file's parents.
  1777. type ParentList struct {
  1778. // Etag: The ETag of the list.
  1779. Etag string `json:"etag,omitempty"`
  1780. // Items: The list of parents.
  1781. Items []*ParentReference `json:"items,omitempty"`
  1782. // Kind: This is always drive#parentList.
  1783. Kind string `json:"kind,omitempty"`
  1784. // SelfLink: A link back to this list.
  1785. SelfLink string `json:"selfLink,omitempty"`
  1786. // ServerResponse contains the HTTP response code and headers from the
  1787. // server.
  1788. googleapi.ServerResponse `json:"-"`
  1789. // ForceSendFields is a list of field names (e.g. "Etag") to
  1790. // unconditionally include in API requests. By default, fields with
  1791. // empty values are omitted from API requests. However, any non-pointer,
  1792. // non-interface field appearing in ForceSendFields will be sent to the
  1793. // server regardless of whether the field is empty or not. This may be
  1794. // used to include empty fields in Patch requests.
  1795. ForceSendFields []string `json:"-"`
  1796. // NullFields is a list of field names (e.g. "Etag") to include in API
  1797. // requests with the JSON null value. By default, fields with empty
  1798. // values are omitted from API requests. However, any field with an
  1799. // empty value appearing in NullFields will be sent to the server as
  1800. // null. It is an error if a field in this list has a non-empty value.
  1801. // This may be used to include null fields in Patch requests.
  1802. NullFields []string `json:"-"`
  1803. }
  1804. func (s *ParentList) MarshalJSON() ([]byte, error) {
  1805. type NoMethod ParentList
  1806. raw := NoMethod(*s)
  1807. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1808. }
  1809. // ParentReference: A reference to a file's parent.
  1810. type ParentReference struct {
  1811. // Id: The ID of the parent.
  1812. Id string `json:"id,omitempty"`
  1813. // IsRoot: Whether or not the parent is the root folder.
  1814. IsRoot bool `json:"isRoot,omitempty"`
  1815. // Kind: This is always drive#parentReference.
  1816. Kind string `json:"kind,omitempty"`
  1817. // ParentLink: A link to the parent.
  1818. ParentLink string `json:"parentLink,omitempty"`
  1819. // SelfLink: A link back to this reference.
  1820. SelfLink string `json:"selfLink,omitempty"`
  1821. // ServerResponse contains the HTTP response code and headers from the
  1822. // server.
  1823. googleapi.ServerResponse `json:"-"`
  1824. // ForceSendFields is a list of field names (e.g. "Id") to
  1825. // unconditionally include in API requests. By default, fields with
  1826. // empty values are omitted from API requests. However, any non-pointer,
  1827. // non-interface field appearing in ForceSendFields will be sent to the
  1828. // server regardless of whether the field is empty or not. This may be
  1829. // used to include empty fields in Patch requests.
  1830. ForceSendFields []string `json:"-"`
  1831. // NullFields is a list of field names (e.g. "Id") to include in API
  1832. // requests with the JSON null value. By default, fields with empty
  1833. // values are omitted from API requests. However, any field with an
  1834. // empty value appearing in NullFields will be sent to the server as
  1835. // null. It is an error if a field in this list has a non-empty value.
  1836. // This may be used to include null fields in Patch requests.
  1837. NullFields []string `json:"-"`
  1838. }
  1839. func (s *ParentReference) MarshalJSON() ([]byte, error) {
  1840. type NoMethod ParentReference
  1841. raw := NoMethod(*s)
  1842. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1843. }
  1844. // Permission: A permission for a file.
  1845. type Permission struct {
  1846. // AdditionalRoles: Additional roles for this user. Only commenter is
  1847. // currently allowed, though more may be supported in the future.
  1848. AdditionalRoles []string `json:"additionalRoles,omitempty"`
  1849. // AuthKey: Deprecated.
  1850. AuthKey string `json:"authKey,omitempty"`
  1851. // Deleted: Whether the account associated with this permission has been
  1852. // deleted. This field only pertains to user and group permissions.
  1853. Deleted bool `json:"deleted,omitempty"`
  1854. // Domain: The domain name of the entity this permission refers to. This
  1855. // is an output-only field which is present when the permission type is
  1856. // user, group or domain.
  1857. Domain string `json:"domain,omitempty"`
  1858. // EmailAddress: The email address of the user or group this permission
  1859. // refers to. This is an output-only field which is present when the
  1860. // permission type is user or group.
  1861. EmailAddress string `json:"emailAddress,omitempty"`
  1862. // Etag: The ETag of the permission.
  1863. Etag string `json:"etag,omitempty"`
  1864. // ExpirationDate: The time at which this permission will expire (RFC
  1865. // 3339 date-time). Expiration dates have the following restrictions:
  1866. //
  1867. // - They can only be set on user and group permissions
  1868. // - The date must be in the future
  1869. // - The date cannot be more than a year in the future
  1870. // - The date can only be set on drive.permissions.update or
  1871. // drive.permissions.patch requests
  1872. ExpirationDate string `json:"expirationDate,omitempty"`
  1873. // Id: The ID of the user this permission refers to, and identical to
  1874. // the permissionId in the About and Files resources. When making a
  1875. // drive.permissions.insert request, exactly one of the id or value
  1876. // fields must be specified unless the permission type is anyone, in
  1877. // which case both id and value are ignored.
  1878. Id string `json:"id,omitempty"`
  1879. // Kind: This is always drive#permission.
  1880. Kind string `json:"kind,omitempty"`
  1881. // Name: The name for this permission.
  1882. Name string `json:"name,omitempty"`
  1883. // PhotoLink: A link to the profile photo, if available.
  1884. PhotoLink string `json:"photoLink,omitempty"`
  1885. // Role: The primary role for this user. While new values may be
  1886. // supported in the future, the following are currently allowed:
  1887. // - organizer
  1888. // - owner
  1889. // - reader
  1890. // - writer
  1891. Role string `json:"role,omitempty"`
  1892. // SelfLink: A link back to this permission.
  1893. SelfLink string `json:"selfLink,omitempty"`
  1894. // TeamDrivePermissionDetails: Details of whether the permissions on
  1895. // this Team Drive item are inherited or directly on this item. This is
  1896. // an output-only field which is present only for Team Drive items.
  1897. TeamDrivePermissionDetails []*PermissionTeamDrivePermissionDetails `json:"teamDrivePermissionDetails,omitempty"`
  1898. // Type: The account type. Allowed values are:
  1899. // - user
  1900. // - group
  1901. // - domain
  1902. // - anyone
  1903. Type string `json:"type,omitempty"`
  1904. // Value: The email address or domain name for the entity. This is used
  1905. // during inserts and is not populated in responses. When making a
  1906. // drive.permissions.insert request, exactly one of the id or value
  1907. // fields must be specified unless the permission type is anyone, in
  1908. // which case both id and value are ignored.
  1909. Value string `json:"value,omitempty"`
  1910. // WithLink: Whether the link is required for this permission.
  1911. WithLink bool `json:"withLink,omitempty"`
  1912. // ServerResponse contains the HTTP response code and headers from the
  1913. // server.
  1914. googleapi.ServerResponse `json:"-"`
  1915. // ForceSendFields is a list of field names (e.g. "AdditionalRoles") to
  1916. // unconditionally include in API requests. By default, fields with
  1917. // empty values are omitted from API requests. However, any non-pointer,
  1918. // non-interface field appearing in ForceSendFields will be sent to the
  1919. // server regardless of whether the field is empty or not. This may be
  1920. // used to include empty fields in Patch requests.
  1921. ForceSendFields []string `json:"-"`
  1922. // NullFields is a list of field names (e.g. "AdditionalRoles") to
  1923. // include in API requests with the JSON null value. By default, fields
  1924. // with empty values are omitted from API requests. However, any field
  1925. // with an empty value appearing in NullFields will be sent to the
  1926. // server as null. It is an error if a field in this list has a
  1927. // non-empty value. This may be used to include null fields in Patch
  1928. // requests.
  1929. NullFields []string `json:"-"`
  1930. }
  1931. func (s *Permission) MarshalJSON() ([]byte, error) {
  1932. type NoMethod Permission
  1933. raw := NoMethod(*s)
  1934. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1935. }
  1936. type PermissionTeamDrivePermissionDetails struct {
  1937. // AdditionalRoles: Additional roles for this user. Only commenter is
  1938. // currently possible, though more may be supported in the future.
  1939. AdditionalRoles []string `json:"additionalRoles,omitempty"`
  1940. // Inherited: Whether this permission is inherited. This field is always
  1941. // populated. This is an output-only field.
  1942. Inherited bool `json:"inherited,omitempty"`
  1943. // InheritedFrom: The ID of the item from which this permission is
  1944. // inherited. This is an output-only field and is only populated for
  1945. // members of the Team Drive.
  1946. InheritedFrom string `json:"inheritedFrom,omitempty"`
  1947. // Role: The primary role for this user. While new values may be added
  1948. // in the future, the following are currently possible:
  1949. // - organizer
  1950. // - reader
  1951. // - writer
  1952. Role string `json:"role,omitempty"`
  1953. // TeamDrivePermissionType: The Team Drive permission type for this
  1954. // user. While new values may be added in future, the following are
  1955. // currently possible:
  1956. // - file
  1957. // - member
  1958. TeamDrivePermissionType string `json:"teamDrivePermissionType,omitempty"`
  1959. // ForceSendFields is a list of field names (e.g. "AdditionalRoles") to
  1960. // unconditionally include in API requests. By default, fields with
  1961. // empty values are omitted from API requests. However, any non-pointer,
  1962. // non-interface field appearing in ForceSendFields will be sent to the
  1963. // server regardless of whether the field is empty or not. This may be
  1964. // used to include empty fields in Patch requests.
  1965. ForceSendFields []string `json:"-"`
  1966. // NullFields is a list of field names (e.g. "AdditionalRoles") to
  1967. // include in API requests with the JSON null value. By default, fields
  1968. // with empty values are omitted from API requests. However, any field
  1969. // with an empty value appearing in NullFields will be sent to the
  1970. // server as null. It is an error if a field in this list has a
  1971. // non-empty value. This may be used to include null fields in Patch
  1972. // requests.
  1973. NullFields []string `json:"-"`
  1974. }
  1975. func (s *PermissionTeamDrivePermissionDetails) MarshalJSON() ([]byte, error) {
  1976. type NoMethod PermissionTeamDrivePermissionDetails
  1977. raw := NoMethod(*s)
  1978. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  1979. }
  1980. // PermissionId: An ID for a user or group as seen in Permission items.
  1981. type PermissionId struct {
  1982. // Id: The permission ID.
  1983. Id string `json:"id,omitempty"`
  1984. // Kind: This is always drive#permissionId.
  1985. Kind string `json:"kind,omitempty"`
  1986. // ServerResponse contains the HTTP response code and headers from the
  1987. // server.
  1988. googleapi.ServerResponse `json:"-"`
  1989. // ForceSendFields is a list of field names (e.g. "Id") to
  1990. // unconditionally include in API requests. By default, fields with
  1991. // empty values are omitted from API requests. However, any non-pointer,
  1992. // non-interface field appearing in ForceSendFields will be sent to the
  1993. // server regardless of whether the field is empty or not. This may be
  1994. // used to include empty fields in Patch requests.
  1995. ForceSendFields []string `json:"-"`
  1996. // NullFields is a list of field names (e.g. "Id") to include in API
  1997. // requests with the JSON null value. By default, fields with empty
  1998. // values are omitted from API requests. However, any field with an
  1999. // empty value appearing in NullFields will be sent to the server as
  2000. // null. It is an error if a field in this list has a non-empty value.
  2001. // This may be used to include null fields in Patch requests.
  2002. NullFields []string `json:"-"`
  2003. }
  2004. func (s *PermissionId) MarshalJSON() ([]byte, error) {
  2005. type NoMethod PermissionId
  2006. raw := NoMethod(*s)
  2007. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2008. }
  2009. // PermissionList: A list of permissions associated with a file.
  2010. type PermissionList struct {
  2011. // Etag: The ETag of the list.
  2012. Etag string `json:"etag,omitempty"`
  2013. // Items: The list of permissions.
  2014. Items []*Permission `json:"items,omitempty"`
  2015. // Kind: This is always drive#permissionList.
  2016. Kind string `json:"kind,omitempty"`
  2017. // NextPageToken: The page token for the next page of permissions. This
  2018. // field will be absent if the end of the permissions list has been
  2019. // reached. If the token is rejected for any reason, it should be
  2020. // discarded, and pagination should be restarted from the first page of
  2021. // results.
  2022. NextPageToken string `json:"nextPageToken,omitempty"`
  2023. // SelfLink: A link back to this list.
  2024. SelfLink string `json:"selfLink,omitempty"`
  2025. // ServerResponse contains the HTTP response code and headers from the
  2026. // server.
  2027. googleapi.ServerResponse `json:"-"`
  2028. // ForceSendFields is a list of field names (e.g. "Etag") to
  2029. // unconditionally include in API requests. By default, fields with
  2030. // empty values are omitted from API requests. However, any non-pointer,
  2031. // non-interface field appearing in ForceSendFields will be sent to the
  2032. // server regardless of whether the field is empty or not. This may be
  2033. // used to include empty fields in Patch requests.
  2034. ForceSendFields []string `json:"-"`
  2035. // NullFields is a list of field names (e.g. "Etag") to include in API
  2036. // requests with the JSON null value. By default, fields with empty
  2037. // values are omitted from API requests. However, any field with an
  2038. // empty value appearing in NullFields will be sent to the server as
  2039. // null. It is an error if a field in this list has a non-empty value.
  2040. // This may be used to include null fields in Patch requests.
  2041. NullFields []string `json:"-"`
  2042. }
  2043. func (s *PermissionList) MarshalJSON() ([]byte, error) {
  2044. type NoMethod PermissionList
  2045. raw := NoMethod(*s)
  2046. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2047. }
  2048. // Property: A key-value pair attached to a file that is either public
  2049. // or private to an application.
  2050. // The following limits apply to file properties:
  2051. // - Maximum of 100 properties total per file
  2052. // - Maximum of 30 private properties per app
  2053. // - Maximum of 30 public properties
  2054. // - Maximum of 124 bytes size limit on (key + value) string in UTF-8
  2055. // encoding for a single property.
  2056. type Property struct {
  2057. // Etag: ETag of the property.
  2058. Etag string `json:"etag,omitempty"`
  2059. // Key: The key of this property.
  2060. Key string `json:"key,omitempty"`
  2061. // Kind: This is always drive#property.
  2062. Kind string `json:"kind,omitempty"`
  2063. // SelfLink: The link back to this property.
  2064. SelfLink string `json:"selfLink,omitempty"`
  2065. // Value: The value of this property.
  2066. Value string `json:"value,omitempty"`
  2067. // Visibility: The visibility of this property. Allowed values are
  2068. // PRIVATE and PUBLIC. (Default: PRIVATE)
  2069. Visibility string `json:"visibility,omitempty"`
  2070. // ServerResponse contains the HTTP response code and headers from the
  2071. // server.
  2072. googleapi.ServerResponse `json:"-"`
  2073. // ForceSendFields is a list of field names (e.g. "Etag") to
  2074. // unconditionally include in API requests. By default, fields with
  2075. // empty values are omitted from API requests. However, any non-pointer,
  2076. // non-interface field appearing in ForceSendFields will be sent to the
  2077. // server regardless of whether the field is empty or not. This may be
  2078. // used to include empty fields in Patch requests.
  2079. ForceSendFields []string `json:"-"`
  2080. // NullFields is a list of field names (e.g. "Etag") to include in API
  2081. // requests with the JSON null value. By default, fields with empty
  2082. // values are omitted from API requests. However, any field with an
  2083. // empty value appearing in NullFields will be sent to the server as
  2084. // null. It is an error if a field in this list has a non-empty value.
  2085. // This may be used to include null fields in Patch requests.
  2086. NullFields []string `json:"-"`
  2087. }
  2088. func (s *Property) MarshalJSON() ([]byte, error) {
  2089. type NoMethod Property
  2090. raw := NoMethod(*s)
  2091. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2092. }
  2093. // PropertyList: A collection of properties, key-value pairs that are
  2094. // either public or private to an application.
  2095. type PropertyList struct {
  2096. // Etag: The ETag of the list.
  2097. Etag string `json:"etag,omitempty"`
  2098. // Items: The list of properties.
  2099. Items []*Property `json:"items,omitempty"`
  2100. // Kind: This is always drive#propertyList.
  2101. Kind string `json:"kind,omitempty"`
  2102. // SelfLink: The link back to this list.
  2103. SelfLink string `json:"selfLink,omitempty"`
  2104. // ServerResponse contains the HTTP response code and headers from the
  2105. // server.
  2106. googleapi.ServerResponse `json:"-"`
  2107. // ForceSendFields is a list of field names (e.g. "Etag") to
  2108. // unconditionally include in API requests. By default, fields with
  2109. // empty values are omitted from API requests. However, any non-pointer,
  2110. // non-interface field appearing in ForceSendFields will be sent to the
  2111. // server regardless of whether the field is empty or not. This may be
  2112. // used to include empty fields in Patch requests.
  2113. ForceSendFields []string `json:"-"`
  2114. // NullFields is a list of field names (e.g. "Etag") to include in API
  2115. // requests with the JSON null value. By default, fields with empty
  2116. // values are omitted from API requests. However, any field with an
  2117. // empty value appearing in NullFields will be sent to the server as
  2118. // null. It is an error if a field in this list has a non-empty value.
  2119. // This may be used to include null fields in Patch requests.
  2120. NullFields []string `json:"-"`
  2121. }
  2122. func (s *PropertyList) MarshalJSON() ([]byte, error) {
  2123. type NoMethod PropertyList
  2124. raw := NoMethod(*s)
  2125. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2126. }
  2127. // Revision: A revision of a file.
  2128. type Revision struct {
  2129. // DownloadUrl: Short term download URL for the file. This will only be
  2130. // populated on files with content stored in Drive.
  2131. DownloadUrl string `json:"downloadUrl,omitempty"`
  2132. // Etag: The ETag of the revision.
  2133. Etag string `json:"etag,omitempty"`
  2134. // ExportLinks: Links for exporting Google Docs to specific formats.
  2135. ExportLinks map[string]string `json:"exportLinks,omitempty"`
  2136. // FileSize: The size of the revision in bytes. This will only be
  2137. // populated on files with content stored in Drive.
  2138. FileSize int64 `json:"fileSize,omitempty,string"`
  2139. // Id: The ID of the revision.
  2140. Id string `json:"id,omitempty"`
  2141. // Kind: This is always drive#revision.
  2142. Kind string `json:"kind,omitempty"`
  2143. // LastModifyingUser: The last user to modify this revision.
  2144. LastModifyingUser *User `json:"lastModifyingUser,omitempty"`
  2145. // LastModifyingUserName: Name of the last user to modify this revision.
  2146. LastModifyingUserName string `json:"lastModifyingUserName,omitempty"`
  2147. // Md5Checksum: An MD5 checksum for the content of this revision. This
  2148. // will only be populated on files with content stored in Drive.
  2149. Md5Checksum string `json:"md5Checksum,omitempty"`
  2150. // MimeType: The MIME type of the revision.
  2151. MimeType string `json:"mimeType,omitempty"`
  2152. // ModifiedDate: Last time this revision was modified (formatted RFC
  2153. // 3339 timestamp).
  2154. ModifiedDate string `json:"modifiedDate,omitempty"`
  2155. // OriginalFilename: The original filename when this revision was
  2156. // created. This will only be populated on files with content stored in
  2157. // Drive.
  2158. OriginalFilename string `json:"originalFilename,omitempty"`
  2159. // Pinned: Whether this revision is pinned to prevent automatic purging.
  2160. // This will only be populated and can only be modified on files with
  2161. // content stored in Drive which are not Google Docs. Revisions can also
  2162. // be pinned when they are created through the
  2163. // drive.files.insert/update/copy by using the pinned query parameter.
  2164. Pinned bool `json:"pinned,omitempty"`
  2165. // PublishAuto: Whether subsequent revisions will be automatically
  2166. // republished. This is only populated and can only be modified for
  2167. // Google Docs.
  2168. PublishAuto bool `json:"publishAuto,omitempty"`
  2169. // Published: Whether this revision is published. This is only populated
  2170. // and can only be modified for Google Docs.
  2171. Published bool `json:"published,omitempty"`
  2172. // PublishedLink: A link to the published revision.
  2173. PublishedLink string `json:"publishedLink,omitempty"`
  2174. // PublishedOutsideDomain: Whether this revision is published outside
  2175. // the domain. This is only populated and can only be modified for
  2176. // Google Docs.
  2177. PublishedOutsideDomain bool `json:"publishedOutsideDomain,omitempty"`
  2178. // SelfLink: A link back to this revision.
  2179. SelfLink string `json:"selfLink,omitempty"`
  2180. // ServerResponse contains the HTTP response code and headers from the
  2181. // server.
  2182. googleapi.ServerResponse `json:"-"`
  2183. // ForceSendFields is a list of field names (e.g. "DownloadUrl") to
  2184. // unconditionally include in API requests. By default, fields with
  2185. // empty values are omitted from API requests. However, any non-pointer,
  2186. // non-interface field appearing in ForceSendFields will be sent to the
  2187. // server regardless of whether the field is empty or not. This may be
  2188. // used to include empty fields in Patch requests.
  2189. ForceSendFields []string `json:"-"`
  2190. // NullFields is a list of field names (e.g. "DownloadUrl") to include
  2191. // in API requests with the JSON null value. By default, fields with
  2192. // empty values are omitted from API requests. However, any field with
  2193. // an empty value appearing in NullFields will be sent to the server as
  2194. // null. It is an error if a field in this list has a non-empty value.
  2195. // This may be used to include null fields in Patch requests.
  2196. NullFields []string `json:"-"`
  2197. }
  2198. func (s *Revision) MarshalJSON() ([]byte, error) {
  2199. type NoMethod Revision
  2200. raw := NoMethod(*s)
  2201. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2202. }
  2203. // RevisionList: A list of revisions of a file.
  2204. type RevisionList struct {
  2205. // Etag: The ETag of the list.
  2206. Etag string `json:"etag,omitempty"`
  2207. // Items: The list of revisions. If nextPageToken is populated, then
  2208. // this list may be incomplete and an additional page of results should
  2209. // be fetched.
  2210. Items []*Revision `json:"items,omitempty"`
  2211. // Kind: This is always drive#revisionList.
  2212. Kind string `json:"kind,omitempty"`
  2213. // NextPageToken: The page token for the next page of revisions. This
  2214. // field will be absent if the end of the revisions list has been
  2215. // reached. If the token is rejected for any reason, it should be
  2216. // discarded and pagination should be restarted from the first page of
  2217. // results.
  2218. NextPageToken string `json:"nextPageToken,omitempty"`
  2219. // SelfLink: A link back to this list.
  2220. SelfLink string `json:"selfLink,omitempty"`
  2221. // ServerResponse contains the HTTP response code and headers from the
  2222. // server.
  2223. googleapi.ServerResponse `json:"-"`
  2224. // ForceSendFields is a list of field names (e.g. "Etag") to
  2225. // unconditionally include in API requests. By default, fields with
  2226. // empty values are omitted from API requests. However, any non-pointer,
  2227. // non-interface field appearing in ForceSendFields will be sent to the
  2228. // server regardless of whether the field is empty or not. This may be
  2229. // used to include empty fields in Patch requests.
  2230. ForceSendFields []string `json:"-"`
  2231. // NullFields is a list of field names (e.g. "Etag") to include in API
  2232. // requests with the JSON null value. By default, fields with empty
  2233. // values are omitted from API requests. However, any field with an
  2234. // empty value appearing in NullFields will be sent to the server as
  2235. // null. It is an error if a field in this list has a non-empty value.
  2236. // This may be used to include null fields in Patch requests.
  2237. NullFields []string `json:"-"`
  2238. }
  2239. func (s *RevisionList) MarshalJSON() ([]byte, error) {
  2240. type NoMethod RevisionList
  2241. raw := NoMethod(*s)
  2242. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2243. }
  2244. type StartPageToken struct {
  2245. // Kind: Identifies what kind of resource this is. Value: the fixed
  2246. // string "drive#startPageToken".
  2247. Kind string `json:"kind,omitempty"`
  2248. // StartPageToken: The starting page token for listing changes.
  2249. StartPageToken string `json:"startPageToken,omitempty"`
  2250. // ServerResponse contains the HTTP response code and headers from the
  2251. // server.
  2252. googleapi.ServerResponse `json:"-"`
  2253. // ForceSendFields is a list of field names (e.g. "Kind") to
  2254. // unconditionally include in API requests. By default, fields with
  2255. // empty values are omitted from API requests. However, any non-pointer,
  2256. // non-interface field appearing in ForceSendFields will be sent to the
  2257. // server regardless of whether the field is empty or not. This may be
  2258. // used to include empty fields in Patch requests.
  2259. ForceSendFields []string `json:"-"`
  2260. // NullFields is a list of field names (e.g. "Kind") to include in API
  2261. // requests with the JSON null value. By default, fields with empty
  2262. // values are omitted from API requests. However, any field with an
  2263. // empty value appearing in NullFields will be sent to the server as
  2264. // null. It is an error if a field in this list has a non-empty value.
  2265. // This may be used to include null fields in Patch requests.
  2266. NullFields []string `json:"-"`
  2267. }
  2268. func (s *StartPageToken) MarshalJSON() ([]byte, error) {
  2269. type NoMethod StartPageToken
  2270. raw := NoMethod(*s)
  2271. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2272. }
  2273. // TeamDrive: Representation of a Team Drive.
  2274. type TeamDrive struct {
  2275. // BackgroundImageFile: An image file and cropping parameters from which
  2276. // a background image for this Team Drive is set. This is a write only
  2277. // field; it can only be set on drive.teamdrives.update requests that
  2278. // don't set themeId. When specified, all fields of the
  2279. // backgroundImageFile must be set.
  2280. BackgroundImageFile *TeamDriveBackgroundImageFile `json:"backgroundImageFile,omitempty"`
  2281. // BackgroundImageLink: A short-lived link to this Team Drive's
  2282. // background image.
  2283. BackgroundImageLink string `json:"backgroundImageLink,omitempty"`
  2284. // Capabilities: Capabilities the current user has on this Team Drive.
  2285. Capabilities *TeamDriveCapabilities `json:"capabilities,omitempty"`
  2286. // ColorRgb: The color of this Team Drive as an RGB hex string. It can
  2287. // only be set on a drive.teamdrives.update request that does not set
  2288. // themeId.
  2289. ColorRgb string `json:"colorRgb,omitempty"`
  2290. // CreatedDate: The time at which the Team Drive was created (RFC 3339
  2291. // date-time).
  2292. CreatedDate string `json:"createdDate,omitempty"`
  2293. // Id: The ID of this Team Drive which is also the ID of the top level
  2294. // folder for this Team Drive.
  2295. Id string `json:"id,omitempty"`
  2296. // Kind: This is always drive#teamDrive
  2297. Kind string `json:"kind,omitempty"`
  2298. // Name: The name of this Team Drive.
  2299. Name string `json:"name,omitempty"`
  2300. // ThemeId: The ID of the theme from which the background image and
  2301. // color will be set. The set of possible teamDriveThemes can be
  2302. // retrieved from a drive.about.get response. When not specified on a
  2303. // drive.teamdrives.insert request, a random theme is chosen from which
  2304. // the background image and color are set. This is a write-only field;
  2305. // it can only be set on requests that don't set colorRgb or
  2306. // backgroundImageFile.
  2307. ThemeId string `json:"themeId,omitempty"`
  2308. // ServerResponse contains the HTTP response code and headers from the
  2309. // server.
  2310. googleapi.ServerResponse `json:"-"`
  2311. // ForceSendFields is a list of field names (e.g. "BackgroundImageFile")
  2312. // to unconditionally include in API requests. By default, fields with
  2313. // empty values are omitted from API requests. However, any non-pointer,
  2314. // non-interface field appearing in ForceSendFields will be sent to the
  2315. // server regardless of whether the field is empty or not. This may be
  2316. // used to include empty fields in Patch requests.
  2317. ForceSendFields []string `json:"-"`
  2318. // NullFields is a list of field names (e.g. "BackgroundImageFile") to
  2319. // include in API requests with the JSON null value. By default, fields
  2320. // with empty values are omitted from API requests. However, any field
  2321. // with an empty value appearing in NullFields will be sent to the
  2322. // server as null. It is an error if a field in this list has a
  2323. // non-empty value. This may be used to include null fields in Patch
  2324. // requests.
  2325. NullFields []string `json:"-"`
  2326. }
  2327. func (s *TeamDrive) MarshalJSON() ([]byte, error) {
  2328. type NoMethod TeamDrive
  2329. raw := NoMethod(*s)
  2330. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2331. }
  2332. // TeamDriveBackgroundImageFile: An image file and cropping parameters
  2333. // from which a background image for this Team Drive is set. This is a
  2334. // write only field; it can only be set on drive.teamdrives.update
  2335. // requests that don't set themeId. When specified, all fields of the
  2336. // backgroundImageFile must be set.
  2337. type TeamDriveBackgroundImageFile struct {
  2338. // Id: The ID of an image file in Drive to use for the background image.
  2339. Id string `json:"id,omitempty"`
  2340. // Width: The width of the cropped image in the closed range of 0 to 1.
  2341. // This value represents the width of the cropped image divided by the
  2342. // width of the entire image. The height is computed by applying a width
  2343. // to height aspect ratio of 80 to 9. The resulting image must be at
  2344. // least 1280 pixels wide and 144 pixels high.
  2345. Width float64 `json:"width,omitempty"`
  2346. // XCoordinate: The X coordinate of the upper left corner of the
  2347. // cropping area in the background image. This is a value in the closed
  2348. // range of 0 to 1. This value represents the horizontal distance from
  2349. // the left side of the entire image to the left side of the cropping
  2350. // area divided by the width of the entire image.
  2351. XCoordinate float64 `json:"xCoordinate,omitempty"`
  2352. // YCoordinate: The Y coordinate of the upper left corner of the
  2353. // cropping area in the background image. This is a value in the closed
  2354. // range of 0 to 1. This value represents the vertical distance from the
  2355. // top side of the entire image to the top side of the cropping area
  2356. // divided by the height of the entire image.
  2357. YCoordinate float64 `json:"yCoordinate,omitempty"`
  2358. // ForceSendFields is a list of field names (e.g. "Id") to
  2359. // unconditionally include in API requests. By default, fields with
  2360. // empty values are omitted from API requests. However, any non-pointer,
  2361. // non-interface field appearing in ForceSendFields will be sent to the
  2362. // server regardless of whether the field is empty or not. This may be
  2363. // used to include empty fields in Patch requests.
  2364. ForceSendFields []string `json:"-"`
  2365. // NullFields is a list of field names (e.g. "Id") to include in API
  2366. // requests with the JSON null value. By default, fields with empty
  2367. // values are omitted from API requests. However, any field with an
  2368. // empty value appearing in NullFields will be sent to the server as
  2369. // null. It is an error if a field in this list has a non-empty value.
  2370. // This may be used to include null fields in Patch requests.
  2371. NullFields []string `json:"-"`
  2372. }
  2373. func (s *TeamDriveBackgroundImageFile) MarshalJSON() ([]byte, error) {
  2374. type NoMethod TeamDriveBackgroundImageFile
  2375. raw := NoMethod(*s)
  2376. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2377. }
  2378. func (s *TeamDriveBackgroundImageFile) UnmarshalJSON(data []byte) error {
  2379. type NoMethod TeamDriveBackgroundImageFile
  2380. var s1 struct {
  2381. Width gensupport.JSONFloat64 `json:"width"`
  2382. XCoordinate gensupport.JSONFloat64 `json:"xCoordinate"`
  2383. YCoordinate gensupport.JSONFloat64 `json:"yCoordinate"`
  2384. *NoMethod
  2385. }
  2386. s1.NoMethod = (*NoMethod)(s)
  2387. if err := json.Unmarshal(data, &s1); err != nil {
  2388. return err
  2389. }
  2390. s.Width = float64(s1.Width)
  2391. s.XCoordinate = float64(s1.XCoordinate)
  2392. s.YCoordinate = float64(s1.YCoordinate)
  2393. return nil
  2394. }
  2395. // TeamDriveCapabilities: Capabilities the current user has on this Team
  2396. // Drive.
  2397. type TeamDriveCapabilities struct {
  2398. // CanAddChildren: Whether the current user can add children to folders
  2399. // in this Team Drive.
  2400. CanAddChildren bool `json:"canAddChildren,omitempty"`
  2401. // CanChangeTeamDriveBackground: Whether the current user can change the
  2402. // background of this Team Drive.
  2403. CanChangeTeamDriveBackground bool `json:"canChangeTeamDriveBackground,omitempty"`
  2404. // CanComment: Whether the current user can comment on files in this
  2405. // Team Drive.
  2406. CanComment bool `json:"canComment,omitempty"`
  2407. // CanCopy: Whether the current user can copy files in this Team Drive.
  2408. CanCopy bool `json:"canCopy,omitempty"`
  2409. // CanDeleteTeamDrive: Whether the current user can delete this Team
  2410. // Drive. Attempting to delete the Team Drive may still fail if there
  2411. // are untrashed items inside the Team Drive.
  2412. CanDeleteTeamDrive bool `json:"canDeleteTeamDrive,omitempty"`
  2413. // CanDownload: Whether the current user can download files in this Team
  2414. // Drive.
  2415. CanDownload bool `json:"canDownload,omitempty"`
  2416. // CanEdit: Whether the current user can edit files in this Team Drive
  2417. CanEdit bool `json:"canEdit,omitempty"`
  2418. // CanListChildren: Whether the current user can list the children of
  2419. // folders in this Team Drive.
  2420. CanListChildren bool `json:"canListChildren,omitempty"`
  2421. // CanManageMembers: Whether the current user can add members to this
  2422. // Team Drive or remove them or change their role.
  2423. CanManageMembers bool `json:"canManageMembers,omitempty"`
  2424. // CanReadRevisions: Whether the current user can read the revisions
  2425. // resource of files in this Team Drive.
  2426. CanReadRevisions bool `json:"canReadRevisions,omitempty"`
  2427. // CanRemoveChildren: Whether the current user can remove children from
  2428. // folders in this Team Drive.
  2429. CanRemoveChildren bool `json:"canRemoveChildren,omitempty"`
  2430. // CanRename: Whether the current user can rename files or folders in
  2431. // this Team Drive.
  2432. CanRename bool `json:"canRename,omitempty"`
  2433. // CanRenameTeamDrive: Whether the current user can rename this Team
  2434. // Drive.
  2435. CanRenameTeamDrive bool `json:"canRenameTeamDrive,omitempty"`
  2436. // CanShare: Whether the current user can share files or folders in this
  2437. // Team Drive.
  2438. CanShare bool `json:"canShare,omitempty"`
  2439. // ForceSendFields is a list of field names (e.g. "CanAddChildren") to
  2440. // unconditionally include in API requests. By default, fields with
  2441. // empty values are omitted from API requests. However, any non-pointer,
  2442. // non-interface field appearing in ForceSendFields will be sent to the
  2443. // server regardless of whether the field is empty or not. This may be
  2444. // used to include empty fields in Patch requests.
  2445. ForceSendFields []string `json:"-"`
  2446. // NullFields is a list of field names (e.g. "CanAddChildren") to
  2447. // include in API requests with the JSON null value. By default, fields
  2448. // with empty values are omitted from API requests. However, any field
  2449. // with an empty value appearing in NullFields will be sent to the
  2450. // server as null. It is an error if a field in this list has a
  2451. // non-empty value. This may be used to include null fields in Patch
  2452. // requests.
  2453. NullFields []string `json:"-"`
  2454. }
  2455. func (s *TeamDriveCapabilities) MarshalJSON() ([]byte, error) {
  2456. type NoMethod TeamDriveCapabilities
  2457. raw := NoMethod(*s)
  2458. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2459. }
  2460. // TeamDriveList: A list of Team Drives.
  2461. type TeamDriveList struct {
  2462. // Items: The list of Team Drives.
  2463. Items []*TeamDrive `json:"items,omitempty"`
  2464. // Kind: This is always drive#teamDriveList
  2465. Kind string `json:"kind,omitempty"`
  2466. // NextPageToken: The page token for the next page of Team Drives.
  2467. NextPageToken string `json:"nextPageToken,omitempty"`
  2468. // ServerResponse contains the HTTP response code and headers from the
  2469. // server.
  2470. googleapi.ServerResponse `json:"-"`
  2471. // ForceSendFields is a list of field names (e.g. "Items") to
  2472. // unconditionally include in API requests. By default, fields with
  2473. // empty values are omitted from API requests. However, any non-pointer,
  2474. // non-interface field appearing in ForceSendFields will be sent to the
  2475. // server regardless of whether the field is empty or not. This may be
  2476. // used to include empty fields in Patch requests.
  2477. ForceSendFields []string `json:"-"`
  2478. // NullFields is a list of field names (e.g. "Items") to include in API
  2479. // requests with the JSON null value. By default, fields with empty
  2480. // values are omitted from API requests. However, any field with an
  2481. // empty value appearing in NullFields will be sent to the server as
  2482. // null. It is an error if a field in this list has a non-empty value.
  2483. // This may be used to include null fields in Patch requests.
  2484. NullFields []string `json:"-"`
  2485. }
  2486. func (s *TeamDriveList) MarshalJSON() ([]byte, error) {
  2487. type NoMethod TeamDriveList
  2488. raw := NoMethod(*s)
  2489. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2490. }
  2491. // User: Information about a Drive user.
  2492. type User struct {
  2493. // DisplayName: A plain text displayable name for this user.
  2494. DisplayName string `json:"displayName,omitempty"`
  2495. // EmailAddress: The email address of the user.
  2496. EmailAddress string `json:"emailAddress,omitempty"`
  2497. // IsAuthenticatedUser: Whether this user is the same as the
  2498. // authenticated user for whom the request was made.
  2499. IsAuthenticatedUser bool `json:"isAuthenticatedUser,omitempty"`
  2500. // Kind: This is always drive#user.
  2501. Kind string `json:"kind,omitempty"`
  2502. // PermissionId: The user's ID as visible in the permissions collection.
  2503. PermissionId string `json:"permissionId,omitempty"`
  2504. // Picture: The user's profile picture.
  2505. Picture *UserPicture `json:"picture,omitempty"`
  2506. // ForceSendFields is a list of field names (e.g. "DisplayName") to
  2507. // unconditionally include in API requests. By default, fields with
  2508. // empty values are omitted from API requests. However, any non-pointer,
  2509. // non-interface field appearing in ForceSendFields will be sent to the
  2510. // server regardless of whether the field is empty or not. This may be
  2511. // used to include empty fields in Patch requests.
  2512. ForceSendFields []string `json:"-"`
  2513. // NullFields is a list of field names (e.g. "DisplayName") to include
  2514. // in API requests with the JSON null value. By default, fields with
  2515. // empty values are omitted from API requests. However, any field with
  2516. // an empty value appearing in NullFields will be sent to the server as
  2517. // null. It is an error if a field in this list has a non-empty value.
  2518. // This may be used to include null fields in Patch requests.
  2519. NullFields []string `json:"-"`
  2520. }
  2521. func (s *User) MarshalJSON() ([]byte, error) {
  2522. type NoMethod User
  2523. raw := NoMethod(*s)
  2524. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2525. }
  2526. // UserPicture: The user's profile picture.
  2527. type UserPicture struct {
  2528. // Url: A URL that points to a profile picture of this user.
  2529. Url string `json:"url,omitempty"`
  2530. // ForceSendFields is a list of field names (e.g. "Url") to
  2531. // unconditionally include in API requests. By default, fields with
  2532. // empty values are omitted from API requests. However, any non-pointer,
  2533. // non-interface field appearing in ForceSendFields will be sent to the
  2534. // server regardless of whether the field is empty or not. This may be
  2535. // used to include empty fields in Patch requests.
  2536. ForceSendFields []string `json:"-"`
  2537. // NullFields is a list of field names (e.g. "Url") to include in API
  2538. // requests with the JSON null value. By default, fields with empty
  2539. // values are omitted from API requests. However, any field with an
  2540. // empty value appearing in NullFields will be sent to the server as
  2541. // null. It is an error if a field in this list has a non-empty value.
  2542. // This may be used to include null fields in Patch requests.
  2543. NullFields []string `json:"-"`
  2544. }
  2545. func (s *UserPicture) MarshalJSON() ([]byte, error) {
  2546. type NoMethod UserPicture
  2547. raw := NoMethod(*s)
  2548. return gensupport.MarshalJSON(raw, s.ForceSendFields, s.NullFields)
  2549. }
  2550. // method id "drive.about.get":
  2551. type AboutGetCall struct {
  2552. s *Service
  2553. urlParams_ gensupport.URLParams
  2554. ifNoneMatch_ string
  2555. ctx_ context.Context
  2556. header_ http.Header
  2557. }
  2558. // Get: Gets the information about the current user along with Drive API
  2559. // settings
  2560. func (r *AboutService) Get() *AboutGetCall {
  2561. c := &AboutGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2562. return c
  2563. }
  2564. // IncludeSubscribed sets the optional parameter "includeSubscribed":
  2565. // Whether to count changes outside the My Drive hierarchy. When set to
  2566. // false, changes to files such as those in the Application Data folder
  2567. // or shared files which have not been added to My Drive will be omitted
  2568. // from the maxChangeIdCount.
  2569. func (c *AboutGetCall) IncludeSubscribed(includeSubscribed bool) *AboutGetCall {
  2570. c.urlParams_.Set("includeSubscribed", fmt.Sprint(includeSubscribed))
  2571. return c
  2572. }
  2573. // MaxChangeIdCount sets the optional parameter "maxChangeIdCount":
  2574. // Maximum number of remaining change IDs to count
  2575. func (c *AboutGetCall) MaxChangeIdCount(maxChangeIdCount int64) *AboutGetCall {
  2576. c.urlParams_.Set("maxChangeIdCount", fmt.Sprint(maxChangeIdCount))
  2577. return c
  2578. }
  2579. // StartChangeId sets the optional parameter "startChangeId": Change ID
  2580. // to start counting from when calculating number of remaining change
  2581. // IDs
  2582. func (c *AboutGetCall) StartChangeId(startChangeId int64) *AboutGetCall {
  2583. c.urlParams_.Set("startChangeId", fmt.Sprint(startChangeId))
  2584. return c
  2585. }
  2586. // Fields allows partial responses to be retrieved. See
  2587. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2588. // for more information.
  2589. func (c *AboutGetCall) Fields(s ...googleapi.Field) *AboutGetCall {
  2590. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2591. return c
  2592. }
  2593. // IfNoneMatch sets the optional parameter which makes the operation
  2594. // fail if the object's ETag matches the given value. This is useful for
  2595. // getting updates only after the object has changed since the last
  2596. // request. Use googleapi.IsNotModified to check whether the response
  2597. // error from Do is the result of In-None-Match.
  2598. func (c *AboutGetCall) IfNoneMatch(entityTag string) *AboutGetCall {
  2599. c.ifNoneMatch_ = entityTag
  2600. return c
  2601. }
  2602. // Context sets the context to be used in this call's Do method. Any
  2603. // pending HTTP request will be aborted if the provided context is
  2604. // canceled.
  2605. func (c *AboutGetCall) Context(ctx context.Context) *AboutGetCall {
  2606. c.ctx_ = ctx
  2607. return c
  2608. }
  2609. // Header returns an http.Header that can be modified by the caller to
  2610. // add HTTP headers to the request.
  2611. func (c *AboutGetCall) Header() http.Header {
  2612. if c.header_ == nil {
  2613. c.header_ = make(http.Header)
  2614. }
  2615. return c.header_
  2616. }
  2617. func (c *AboutGetCall) doRequest(alt string) (*http.Response, error) {
  2618. reqHeaders := make(http.Header)
  2619. for k, v := range c.header_ {
  2620. reqHeaders[k] = v
  2621. }
  2622. reqHeaders.Set("User-Agent", c.s.userAgent())
  2623. if c.ifNoneMatch_ != "" {
  2624. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  2625. }
  2626. var body io.Reader = nil
  2627. c.urlParams_.Set("alt", alt)
  2628. urls := googleapi.ResolveRelative(c.s.BasePath, "about")
  2629. urls += "?" + c.urlParams_.Encode()
  2630. req, _ := http.NewRequest("GET", urls, body)
  2631. req.Header = reqHeaders
  2632. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2633. }
  2634. // Do executes the "drive.about.get" call.
  2635. // Exactly one of *About or error will be non-nil. Any non-2xx status
  2636. // code is an error. Response headers are in either
  2637. // *About.ServerResponse.Header or (if a response was returned at all)
  2638. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  2639. // check whether the returned error was because http.StatusNotModified
  2640. // was returned.
  2641. func (c *AboutGetCall) Do(opts ...googleapi.CallOption) (*About, error) {
  2642. gensupport.SetOptions(c.urlParams_, opts...)
  2643. res, err := c.doRequest("json")
  2644. if res != nil && res.StatusCode == http.StatusNotModified {
  2645. if res.Body != nil {
  2646. res.Body.Close()
  2647. }
  2648. return nil, &googleapi.Error{
  2649. Code: res.StatusCode,
  2650. Header: res.Header,
  2651. }
  2652. }
  2653. if err != nil {
  2654. return nil, err
  2655. }
  2656. defer googleapi.CloseBody(res)
  2657. if err := googleapi.CheckResponse(res); err != nil {
  2658. return nil, err
  2659. }
  2660. ret := &About{
  2661. ServerResponse: googleapi.ServerResponse{
  2662. Header: res.Header,
  2663. HTTPStatusCode: res.StatusCode,
  2664. },
  2665. }
  2666. target := &ret
  2667. if err := gensupport.DecodeResponse(target, res); err != nil {
  2668. return nil, err
  2669. }
  2670. return ret, nil
  2671. // {
  2672. // "description": "Gets the information about the current user along with Drive API settings",
  2673. // "httpMethod": "GET",
  2674. // "id": "drive.about.get",
  2675. // "parameters": {
  2676. // "includeSubscribed": {
  2677. // "default": "true",
  2678. // "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.",
  2679. // "location": "query",
  2680. // "type": "boolean"
  2681. // },
  2682. // "maxChangeIdCount": {
  2683. // "default": "1",
  2684. // "description": "Maximum number of remaining change IDs to count",
  2685. // "format": "int64",
  2686. // "location": "query",
  2687. // "type": "string"
  2688. // },
  2689. // "startChangeId": {
  2690. // "description": "Change ID to start counting from when calculating number of remaining change IDs",
  2691. // "format": "int64",
  2692. // "location": "query",
  2693. // "type": "string"
  2694. // }
  2695. // },
  2696. // "path": "about",
  2697. // "response": {
  2698. // "$ref": "About"
  2699. // },
  2700. // "scopes": [
  2701. // "https://www.googleapis.com/auth/drive",
  2702. // "https://www.googleapis.com/auth/drive.appdata",
  2703. // "https://www.googleapis.com/auth/drive.file",
  2704. // "https://www.googleapis.com/auth/drive.metadata",
  2705. // "https://www.googleapis.com/auth/drive.metadata.readonly",
  2706. // "https://www.googleapis.com/auth/drive.photos.readonly",
  2707. // "https://www.googleapis.com/auth/drive.readonly"
  2708. // ]
  2709. // }
  2710. }
  2711. // method id "drive.apps.get":
  2712. type AppsGetCall struct {
  2713. s *Service
  2714. appId string
  2715. urlParams_ gensupport.URLParams
  2716. ifNoneMatch_ string
  2717. ctx_ context.Context
  2718. header_ http.Header
  2719. }
  2720. // Get: Gets a specific app.
  2721. func (r *AppsService) Get(appId string) *AppsGetCall {
  2722. c := &AppsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2723. c.appId = appId
  2724. return c
  2725. }
  2726. // Fields allows partial responses to be retrieved. See
  2727. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2728. // for more information.
  2729. func (c *AppsGetCall) Fields(s ...googleapi.Field) *AppsGetCall {
  2730. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2731. return c
  2732. }
  2733. // IfNoneMatch sets the optional parameter which makes the operation
  2734. // fail if the object's ETag matches the given value. This is useful for
  2735. // getting updates only after the object has changed since the last
  2736. // request. Use googleapi.IsNotModified to check whether the response
  2737. // error from Do is the result of In-None-Match.
  2738. func (c *AppsGetCall) IfNoneMatch(entityTag string) *AppsGetCall {
  2739. c.ifNoneMatch_ = entityTag
  2740. return c
  2741. }
  2742. // Context sets the context to be used in this call's Do method. Any
  2743. // pending HTTP request will be aborted if the provided context is
  2744. // canceled.
  2745. func (c *AppsGetCall) Context(ctx context.Context) *AppsGetCall {
  2746. c.ctx_ = ctx
  2747. return c
  2748. }
  2749. // Header returns an http.Header that can be modified by the caller to
  2750. // add HTTP headers to the request.
  2751. func (c *AppsGetCall) Header() http.Header {
  2752. if c.header_ == nil {
  2753. c.header_ = make(http.Header)
  2754. }
  2755. return c.header_
  2756. }
  2757. func (c *AppsGetCall) doRequest(alt string) (*http.Response, error) {
  2758. reqHeaders := make(http.Header)
  2759. for k, v := range c.header_ {
  2760. reqHeaders[k] = v
  2761. }
  2762. reqHeaders.Set("User-Agent", c.s.userAgent())
  2763. if c.ifNoneMatch_ != "" {
  2764. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  2765. }
  2766. var body io.Reader = nil
  2767. c.urlParams_.Set("alt", alt)
  2768. urls := googleapi.ResolveRelative(c.s.BasePath, "apps/{appId}")
  2769. urls += "?" + c.urlParams_.Encode()
  2770. req, _ := http.NewRequest("GET", urls, body)
  2771. req.Header = reqHeaders
  2772. googleapi.Expand(req.URL, map[string]string{
  2773. "appId": c.appId,
  2774. })
  2775. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2776. }
  2777. // Do executes the "drive.apps.get" call.
  2778. // Exactly one of *App or error will be non-nil. Any non-2xx status code
  2779. // is an error. Response headers are in either
  2780. // *App.ServerResponse.Header or (if a response was returned at all) in
  2781. // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  2782. // whether the returned error was because http.StatusNotModified was
  2783. // returned.
  2784. func (c *AppsGetCall) Do(opts ...googleapi.CallOption) (*App, error) {
  2785. gensupport.SetOptions(c.urlParams_, opts...)
  2786. res, err := c.doRequest("json")
  2787. if res != nil && res.StatusCode == http.StatusNotModified {
  2788. if res.Body != nil {
  2789. res.Body.Close()
  2790. }
  2791. return nil, &googleapi.Error{
  2792. Code: res.StatusCode,
  2793. Header: res.Header,
  2794. }
  2795. }
  2796. if err != nil {
  2797. return nil, err
  2798. }
  2799. defer googleapi.CloseBody(res)
  2800. if err := googleapi.CheckResponse(res); err != nil {
  2801. return nil, err
  2802. }
  2803. ret := &App{
  2804. ServerResponse: googleapi.ServerResponse{
  2805. Header: res.Header,
  2806. HTTPStatusCode: res.StatusCode,
  2807. },
  2808. }
  2809. target := &ret
  2810. if err := gensupport.DecodeResponse(target, res); err != nil {
  2811. return nil, err
  2812. }
  2813. return ret, nil
  2814. // {
  2815. // "description": "Gets a specific app.",
  2816. // "httpMethod": "GET",
  2817. // "id": "drive.apps.get",
  2818. // "parameterOrder": [
  2819. // "appId"
  2820. // ],
  2821. // "parameters": {
  2822. // "appId": {
  2823. // "description": "The ID of the app.",
  2824. // "location": "path",
  2825. // "required": true,
  2826. // "type": "string"
  2827. // }
  2828. // },
  2829. // "path": "apps/{appId}",
  2830. // "response": {
  2831. // "$ref": "App"
  2832. // },
  2833. // "scopes": [
  2834. // "https://www.googleapis.com/auth/drive",
  2835. // "https://www.googleapis.com/auth/drive.appdata",
  2836. // "https://www.googleapis.com/auth/drive.apps.readonly",
  2837. // "https://www.googleapis.com/auth/drive.file",
  2838. // "https://www.googleapis.com/auth/drive.metadata",
  2839. // "https://www.googleapis.com/auth/drive.metadata.readonly",
  2840. // "https://www.googleapis.com/auth/drive.readonly"
  2841. // ]
  2842. // }
  2843. }
  2844. // method id "drive.apps.list":
  2845. type AppsListCall struct {
  2846. s *Service
  2847. urlParams_ gensupport.URLParams
  2848. ifNoneMatch_ string
  2849. ctx_ context.Context
  2850. header_ http.Header
  2851. }
  2852. // List: Lists a user's installed apps.
  2853. func (r *AppsService) List() *AppsListCall {
  2854. c := &AppsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  2855. return c
  2856. }
  2857. // AppFilterExtensions sets the optional parameter
  2858. // "appFilterExtensions": A comma-separated list of file extensions for
  2859. // open with filtering. All apps within the given app query scope which
  2860. // can open any of the given file extensions will be included in the
  2861. // response. If appFilterMimeTypes are provided as well, the result is a
  2862. // union of the two resulting app lists.
  2863. func (c *AppsListCall) AppFilterExtensions(appFilterExtensions string) *AppsListCall {
  2864. c.urlParams_.Set("appFilterExtensions", appFilterExtensions)
  2865. return c
  2866. }
  2867. // AppFilterMimeTypes sets the optional parameter "appFilterMimeTypes":
  2868. // A comma-separated list of MIME types for open with filtering. All
  2869. // apps within the given app query scope which can open any of the given
  2870. // MIME types will be included in the response. If appFilterExtensions
  2871. // are provided as well, the result is a union of the two resulting app
  2872. // lists.
  2873. func (c *AppsListCall) AppFilterMimeTypes(appFilterMimeTypes string) *AppsListCall {
  2874. c.urlParams_.Set("appFilterMimeTypes", appFilterMimeTypes)
  2875. return c
  2876. }
  2877. // LanguageCode sets the optional parameter "languageCode": A language
  2878. // or locale code, as defined by BCP 47, with some extensions from
  2879. // Unicode's LDML format (http://www.unicode.org/reports/tr35/).
  2880. func (c *AppsListCall) LanguageCode(languageCode string) *AppsListCall {
  2881. c.urlParams_.Set("languageCode", languageCode)
  2882. return c
  2883. }
  2884. // Fields allows partial responses to be retrieved. See
  2885. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  2886. // for more information.
  2887. func (c *AppsListCall) Fields(s ...googleapi.Field) *AppsListCall {
  2888. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  2889. return c
  2890. }
  2891. // IfNoneMatch sets the optional parameter which makes the operation
  2892. // fail if the object's ETag matches the given value. This is useful for
  2893. // getting updates only after the object has changed since the last
  2894. // request. Use googleapi.IsNotModified to check whether the response
  2895. // error from Do is the result of In-None-Match.
  2896. func (c *AppsListCall) IfNoneMatch(entityTag string) *AppsListCall {
  2897. c.ifNoneMatch_ = entityTag
  2898. return c
  2899. }
  2900. // Context sets the context to be used in this call's Do method. Any
  2901. // pending HTTP request will be aborted if the provided context is
  2902. // canceled.
  2903. func (c *AppsListCall) Context(ctx context.Context) *AppsListCall {
  2904. c.ctx_ = ctx
  2905. return c
  2906. }
  2907. // Header returns an http.Header that can be modified by the caller to
  2908. // add HTTP headers to the request.
  2909. func (c *AppsListCall) Header() http.Header {
  2910. if c.header_ == nil {
  2911. c.header_ = make(http.Header)
  2912. }
  2913. return c.header_
  2914. }
  2915. func (c *AppsListCall) doRequest(alt string) (*http.Response, error) {
  2916. reqHeaders := make(http.Header)
  2917. for k, v := range c.header_ {
  2918. reqHeaders[k] = v
  2919. }
  2920. reqHeaders.Set("User-Agent", c.s.userAgent())
  2921. if c.ifNoneMatch_ != "" {
  2922. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  2923. }
  2924. var body io.Reader = nil
  2925. c.urlParams_.Set("alt", alt)
  2926. urls := googleapi.ResolveRelative(c.s.BasePath, "apps")
  2927. urls += "?" + c.urlParams_.Encode()
  2928. req, _ := http.NewRequest("GET", urls, body)
  2929. req.Header = reqHeaders
  2930. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  2931. }
  2932. // Do executes the "drive.apps.list" call.
  2933. // Exactly one of *AppList or error will be non-nil. Any non-2xx status
  2934. // code is an error. Response headers are in either
  2935. // *AppList.ServerResponse.Header or (if a response was returned at all)
  2936. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  2937. // check whether the returned error was because http.StatusNotModified
  2938. // was returned.
  2939. func (c *AppsListCall) Do(opts ...googleapi.CallOption) (*AppList, error) {
  2940. gensupport.SetOptions(c.urlParams_, opts...)
  2941. res, err := c.doRequest("json")
  2942. if res != nil && res.StatusCode == http.StatusNotModified {
  2943. if res.Body != nil {
  2944. res.Body.Close()
  2945. }
  2946. return nil, &googleapi.Error{
  2947. Code: res.StatusCode,
  2948. Header: res.Header,
  2949. }
  2950. }
  2951. if err != nil {
  2952. return nil, err
  2953. }
  2954. defer googleapi.CloseBody(res)
  2955. if err := googleapi.CheckResponse(res); err != nil {
  2956. return nil, err
  2957. }
  2958. ret := &AppList{
  2959. ServerResponse: googleapi.ServerResponse{
  2960. Header: res.Header,
  2961. HTTPStatusCode: res.StatusCode,
  2962. },
  2963. }
  2964. target := &ret
  2965. if err := gensupport.DecodeResponse(target, res); err != nil {
  2966. return nil, err
  2967. }
  2968. return ret, nil
  2969. // {
  2970. // "description": "Lists a user's installed apps.",
  2971. // "httpMethod": "GET",
  2972. // "id": "drive.apps.list",
  2973. // "parameters": {
  2974. // "appFilterExtensions": {
  2975. // "default": "",
  2976. // "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.",
  2977. // "location": "query",
  2978. // "type": "string"
  2979. // },
  2980. // "appFilterMimeTypes": {
  2981. // "default": "",
  2982. // "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.",
  2983. // "location": "query",
  2984. // "type": "string"
  2985. // },
  2986. // "languageCode": {
  2987. // "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/).",
  2988. // "location": "query",
  2989. // "type": "string"
  2990. // }
  2991. // },
  2992. // "path": "apps",
  2993. // "response": {
  2994. // "$ref": "AppList"
  2995. // },
  2996. // "scopes": [
  2997. // "https://www.googleapis.com/auth/drive.apps.readonly"
  2998. // ]
  2999. // }
  3000. }
  3001. // method id "drive.changes.get":
  3002. type ChangesGetCall struct {
  3003. s *Service
  3004. changeId string
  3005. urlParams_ gensupport.URLParams
  3006. ifNoneMatch_ string
  3007. ctx_ context.Context
  3008. header_ http.Header
  3009. }
  3010. // Get: Deprecated - Use changes.getStartPageToken and changes.list to
  3011. // retrieve recent changes.
  3012. func (r *ChangesService) Get(changeId string) *ChangesGetCall {
  3013. c := &ChangesGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3014. c.changeId = changeId
  3015. return c
  3016. }
  3017. // SupportsTeamDrives sets the optional parameter "supportsTeamDrives":
  3018. // Whether the requesting application supports Team Drives.
  3019. func (c *ChangesGetCall) SupportsTeamDrives(supportsTeamDrives bool) *ChangesGetCall {
  3020. c.urlParams_.Set("supportsTeamDrives", fmt.Sprint(supportsTeamDrives))
  3021. return c
  3022. }
  3023. // TeamDriveId sets the optional parameter "teamDriveId": The Team Drive
  3024. // from which the change will be returned.
  3025. func (c *ChangesGetCall) TeamDriveId(teamDriveId string) *ChangesGetCall {
  3026. c.urlParams_.Set("teamDriveId", teamDriveId)
  3027. return c
  3028. }
  3029. // Fields allows partial responses to be retrieved. See
  3030. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3031. // for more information.
  3032. func (c *ChangesGetCall) Fields(s ...googleapi.Field) *ChangesGetCall {
  3033. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3034. return c
  3035. }
  3036. // IfNoneMatch sets the optional parameter which makes the operation
  3037. // fail if the object's ETag matches the given value. This is useful for
  3038. // getting updates only after the object has changed since the last
  3039. // request. Use googleapi.IsNotModified to check whether the response
  3040. // error from Do is the result of In-None-Match.
  3041. func (c *ChangesGetCall) IfNoneMatch(entityTag string) *ChangesGetCall {
  3042. c.ifNoneMatch_ = entityTag
  3043. return c
  3044. }
  3045. // Context sets the context to be used in this call's Do method. Any
  3046. // pending HTTP request will be aborted if the provided context is
  3047. // canceled.
  3048. func (c *ChangesGetCall) Context(ctx context.Context) *ChangesGetCall {
  3049. c.ctx_ = ctx
  3050. return c
  3051. }
  3052. // Header returns an http.Header that can be modified by the caller to
  3053. // add HTTP headers to the request.
  3054. func (c *ChangesGetCall) Header() http.Header {
  3055. if c.header_ == nil {
  3056. c.header_ = make(http.Header)
  3057. }
  3058. return c.header_
  3059. }
  3060. func (c *ChangesGetCall) doRequest(alt string) (*http.Response, error) {
  3061. reqHeaders := make(http.Header)
  3062. for k, v := range c.header_ {
  3063. reqHeaders[k] = v
  3064. }
  3065. reqHeaders.Set("User-Agent", c.s.userAgent())
  3066. if c.ifNoneMatch_ != "" {
  3067. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  3068. }
  3069. var body io.Reader = nil
  3070. c.urlParams_.Set("alt", alt)
  3071. urls := googleapi.ResolveRelative(c.s.BasePath, "changes/{changeId}")
  3072. urls += "?" + c.urlParams_.Encode()
  3073. req, _ := http.NewRequest("GET", urls, body)
  3074. req.Header = reqHeaders
  3075. googleapi.Expand(req.URL, map[string]string{
  3076. "changeId": c.changeId,
  3077. })
  3078. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3079. }
  3080. // Do executes the "drive.changes.get" call.
  3081. // Exactly one of *Change or error will be non-nil. Any non-2xx status
  3082. // code is an error. Response headers are in either
  3083. // *Change.ServerResponse.Header or (if a response was returned at all)
  3084. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  3085. // check whether the returned error was because http.StatusNotModified
  3086. // was returned.
  3087. func (c *ChangesGetCall) Do(opts ...googleapi.CallOption) (*Change, error) {
  3088. gensupport.SetOptions(c.urlParams_, opts...)
  3089. res, err := c.doRequest("json")
  3090. if res != nil && res.StatusCode == http.StatusNotModified {
  3091. if res.Body != nil {
  3092. res.Body.Close()
  3093. }
  3094. return nil, &googleapi.Error{
  3095. Code: res.StatusCode,
  3096. Header: res.Header,
  3097. }
  3098. }
  3099. if err != nil {
  3100. return nil, err
  3101. }
  3102. defer googleapi.CloseBody(res)
  3103. if err := googleapi.CheckResponse(res); err != nil {
  3104. return nil, err
  3105. }
  3106. ret := &Change{
  3107. ServerResponse: googleapi.ServerResponse{
  3108. Header: res.Header,
  3109. HTTPStatusCode: res.StatusCode,
  3110. },
  3111. }
  3112. target := &ret
  3113. if err := gensupport.DecodeResponse(target, res); err != nil {
  3114. return nil, err
  3115. }
  3116. return ret, nil
  3117. // {
  3118. // "description": "Deprecated - Use changes.getStartPageToken and changes.list to retrieve recent changes.",
  3119. // "httpMethod": "GET",
  3120. // "id": "drive.changes.get",
  3121. // "parameterOrder": [
  3122. // "changeId"
  3123. // ],
  3124. // "parameters": {
  3125. // "changeId": {
  3126. // "description": "The ID of the change.",
  3127. // "location": "path",
  3128. // "required": true,
  3129. // "type": "string"
  3130. // },
  3131. // "supportsTeamDrives": {
  3132. // "default": "false",
  3133. // "description": "Whether the requesting application supports Team Drives.",
  3134. // "location": "query",
  3135. // "type": "boolean"
  3136. // },
  3137. // "teamDriveId": {
  3138. // "description": "The Team Drive from which the change will be returned.",
  3139. // "location": "query",
  3140. // "type": "string"
  3141. // }
  3142. // },
  3143. // "path": "changes/{changeId}",
  3144. // "response": {
  3145. // "$ref": "Change"
  3146. // },
  3147. // "scopes": [
  3148. // "https://www.googleapis.com/auth/drive",
  3149. // "https://www.googleapis.com/auth/drive.appdata",
  3150. // "https://www.googleapis.com/auth/drive.apps.readonly",
  3151. // "https://www.googleapis.com/auth/drive.file",
  3152. // "https://www.googleapis.com/auth/drive.metadata",
  3153. // "https://www.googleapis.com/auth/drive.metadata.readonly",
  3154. // "https://www.googleapis.com/auth/drive.photos.readonly",
  3155. // "https://www.googleapis.com/auth/drive.readonly"
  3156. // ]
  3157. // }
  3158. }
  3159. // method id "drive.changes.getStartPageToken":
  3160. type ChangesGetStartPageTokenCall struct {
  3161. s *Service
  3162. urlParams_ gensupport.URLParams
  3163. ifNoneMatch_ string
  3164. ctx_ context.Context
  3165. header_ http.Header
  3166. }
  3167. // GetStartPageToken: Gets the starting pageToken for listing future
  3168. // changes.
  3169. func (r *ChangesService) GetStartPageToken() *ChangesGetStartPageTokenCall {
  3170. c := &ChangesGetStartPageTokenCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3171. return c
  3172. }
  3173. // SupportsTeamDrives sets the optional parameter "supportsTeamDrives":
  3174. // Whether the requesting application supports Team Drives.
  3175. func (c *ChangesGetStartPageTokenCall) SupportsTeamDrives(supportsTeamDrives bool) *ChangesGetStartPageTokenCall {
  3176. c.urlParams_.Set("supportsTeamDrives", fmt.Sprint(supportsTeamDrives))
  3177. return c
  3178. }
  3179. // TeamDriveId sets the optional parameter "teamDriveId": The ID of the
  3180. // Team Drive for which the starting pageToken for listing future
  3181. // changes from that Team Drive will be returned.
  3182. func (c *ChangesGetStartPageTokenCall) TeamDriveId(teamDriveId string) *ChangesGetStartPageTokenCall {
  3183. c.urlParams_.Set("teamDriveId", teamDriveId)
  3184. return c
  3185. }
  3186. // Fields allows partial responses to be retrieved. See
  3187. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3188. // for more information.
  3189. func (c *ChangesGetStartPageTokenCall) Fields(s ...googleapi.Field) *ChangesGetStartPageTokenCall {
  3190. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3191. return c
  3192. }
  3193. // IfNoneMatch sets the optional parameter which makes the operation
  3194. // fail if the object's ETag matches the given value. This is useful for
  3195. // getting updates only after the object has changed since the last
  3196. // request. Use googleapi.IsNotModified to check whether the response
  3197. // error from Do is the result of In-None-Match.
  3198. func (c *ChangesGetStartPageTokenCall) IfNoneMatch(entityTag string) *ChangesGetStartPageTokenCall {
  3199. c.ifNoneMatch_ = entityTag
  3200. return c
  3201. }
  3202. // Context sets the context to be used in this call's Do method. Any
  3203. // pending HTTP request will be aborted if the provided context is
  3204. // canceled.
  3205. func (c *ChangesGetStartPageTokenCall) Context(ctx context.Context) *ChangesGetStartPageTokenCall {
  3206. c.ctx_ = ctx
  3207. return c
  3208. }
  3209. // Header returns an http.Header that can be modified by the caller to
  3210. // add HTTP headers to the request.
  3211. func (c *ChangesGetStartPageTokenCall) Header() http.Header {
  3212. if c.header_ == nil {
  3213. c.header_ = make(http.Header)
  3214. }
  3215. return c.header_
  3216. }
  3217. func (c *ChangesGetStartPageTokenCall) doRequest(alt string) (*http.Response, error) {
  3218. reqHeaders := make(http.Header)
  3219. for k, v := range c.header_ {
  3220. reqHeaders[k] = v
  3221. }
  3222. reqHeaders.Set("User-Agent", c.s.userAgent())
  3223. if c.ifNoneMatch_ != "" {
  3224. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  3225. }
  3226. var body io.Reader = nil
  3227. c.urlParams_.Set("alt", alt)
  3228. urls := googleapi.ResolveRelative(c.s.BasePath, "changes/startPageToken")
  3229. urls += "?" + c.urlParams_.Encode()
  3230. req, _ := http.NewRequest("GET", urls, body)
  3231. req.Header = reqHeaders
  3232. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3233. }
  3234. // Do executes the "drive.changes.getStartPageToken" call.
  3235. // Exactly one of *StartPageToken or error will be non-nil. Any non-2xx
  3236. // status code is an error. Response headers are in either
  3237. // *StartPageToken.ServerResponse.Header or (if a response was returned
  3238. // at all) in error.(*googleapi.Error).Header. Use
  3239. // googleapi.IsNotModified to check whether the returned error was
  3240. // because http.StatusNotModified was returned.
  3241. func (c *ChangesGetStartPageTokenCall) Do(opts ...googleapi.CallOption) (*StartPageToken, error) {
  3242. gensupport.SetOptions(c.urlParams_, opts...)
  3243. res, err := c.doRequest("json")
  3244. if res != nil && res.StatusCode == http.StatusNotModified {
  3245. if res.Body != nil {
  3246. res.Body.Close()
  3247. }
  3248. return nil, &googleapi.Error{
  3249. Code: res.StatusCode,
  3250. Header: res.Header,
  3251. }
  3252. }
  3253. if err != nil {
  3254. return nil, err
  3255. }
  3256. defer googleapi.CloseBody(res)
  3257. if err := googleapi.CheckResponse(res); err != nil {
  3258. return nil, err
  3259. }
  3260. ret := &StartPageToken{
  3261. ServerResponse: googleapi.ServerResponse{
  3262. Header: res.Header,
  3263. HTTPStatusCode: res.StatusCode,
  3264. },
  3265. }
  3266. target := &ret
  3267. if err := gensupport.DecodeResponse(target, res); err != nil {
  3268. return nil, err
  3269. }
  3270. return ret, nil
  3271. // {
  3272. // "description": "Gets the starting pageToken for listing future changes.",
  3273. // "httpMethod": "GET",
  3274. // "id": "drive.changes.getStartPageToken",
  3275. // "parameters": {
  3276. // "supportsTeamDrives": {
  3277. // "default": "false",
  3278. // "description": "Whether the requesting application supports Team Drives.",
  3279. // "location": "query",
  3280. // "type": "boolean"
  3281. // },
  3282. // "teamDriveId": {
  3283. // "description": "The ID of the Team Drive for which the starting pageToken for listing future changes from that Team Drive will be returned.",
  3284. // "location": "query",
  3285. // "type": "string"
  3286. // }
  3287. // },
  3288. // "path": "changes/startPageToken",
  3289. // "response": {
  3290. // "$ref": "StartPageToken"
  3291. // },
  3292. // "scopes": [
  3293. // "https://www.googleapis.com/auth/drive",
  3294. // "https://www.googleapis.com/auth/drive.appdata",
  3295. // "https://www.googleapis.com/auth/drive.apps.readonly",
  3296. // "https://www.googleapis.com/auth/drive.file",
  3297. // "https://www.googleapis.com/auth/drive.metadata",
  3298. // "https://www.googleapis.com/auth/drive.metadata.readonly",
  3299. // "https://www.googleapis.com/auth/drive.photos.readonly",
  3300. // "https://www.googleapis.com/auth/drive.readonly"
  3301. // ]
  3302. // }
  3303. }
  3304. // method id "drive.changes.list":
  3305. type ChangesListCall struct {
  3306. s *Service
  3307. urlParams_ gensupport.URLParams
  3308. ifNoneMatch_ string
  3309. ctx_ context.Context
  3310. header_ http.Header
  3311. }
  3312. // List: Lists the changes for a user or Team Drive.
  3313. func (r *ChangesService) List() *ChangesListCall {
  3314. c := &ChangesListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3315. return c
  3316. }
  3317. // IncludeCorpusRemovals sets the optional parameter
  3318. // "includeCorpusRemovals": Whether changes should include the file
  3319. // resource if the file is still accessible by the user at the time of
  3320. // the request, even when a file was removed from the list of changes
  3321. // and there will be no further change entries for this file.
  3322. func (c *ChangesListCall) IncludeCorpusRemovals(includeCorpusRemovals bool) *ChangesListCall {
  3323. c.urlParams_.Set("includeCorpusRemovals", fmt.Sprint(includeCorpusRemovals))
  3324. return c
  3325. }
  3326. // IncludeDeleted sets the optional parameter "includeDeleted": Whether
  3327. // to include changes indicating that items have been removed from the
  3328. // list of changes, for example by deletion or loss of access.
  3329. func (c *ChangesListCall) IncludeDeleted(includeDeleted bool) *ChangesListCall {
  3330. c.urlParams_.Set("includeDeleted", fmt.Sprint(includeDeleted))
  3331. return c
  3332. }
  3333. // IncludeSubscribed sets the optional parameter "includeSubscribed":
  3334. // Whether to include changes outside the My Drive hierarchy in the
  3335. // result. When set to false, changes to files such as those in the
  3336. // Application Data folder or shared files which have not been added to
  3337. // My Drive will be omitted from the result.
  3338. func (c *ChangesListCall) IncludeSubscribed(includeSubscribed bool) *ChangesListCall {
  3339. c.urlParams_.Set("includeSubscribed", fmt.Sprint(includeSubscribed))
  3340. return c
  3341. }
  3342. // IncludeTeamDriveItems sets the optional parameter
  3343. // "includeTeamDriveItems": Whether Team Drive files or changes should
  3344. // be included in results.
  3345. func (c *ChangesListCall) IncludeTeamDriveItems(includeTeamDriveItems bool) *ChangesListCall {
  3346. c.urlParams_.Set("includeTeamDriveItems", fmt.Sprint(includeTeamDriveItems))
  3347. return c
  3348. }
  3349. // MaxResults sets the optional parameter "maxResults": Maximum number
  3350. // of changes to return.
  3351. func (c *ChangesListCall) MaxResults(maxResults int64) *ChangesListCall {
  3352. c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
  3353. return c
  3354. }
  3355. // PageToken sets the optional parameter "pageToken": The token for
  3356. // continuing a previous list request on the next page. This should be
  3357. // set to the value of 'nextPageToken' from the previous response or to
  3358. // the response from the getStartPageToken method.
  3359. func (c *ChangesListCall) PageToken(pageToken string) *ChangesListCall {
  3360. c.urlParams_.Set("pageToken", pageToken)
  3361. return c
  3362. }
  3363. // Spaces sets the optional parameter "spaces": A comma-separated list
  3364. // of spaces to query. Supported values are 'drive', 'appDataFolder' and
  3365. // 'photos'.
  3366. func (c *ChangesListCall) Spaces(spaces string) *ChangesListCall {
  3367. c.urlParams_.Set("spaces", spaces)
  3368. return c
  3369. }
  3370. // StartChangeId sets the optional parameter "startChangeId": Deprecated
  3371. // - use pageToken instead.
  3372. func (c *ChangesListCall) StartChangeId(startChangeId int64) *ChangesListCall {
  3373. c.urlParams_.Set("startChangeId", fmt.Sprint(startChangeId))
  3374. return c
  3375. }
  3376. // SupportsTeamDrives sets the optional parameter "supportsTeamDrives":
  3377. // Whether the requesting application supports Team Drives.
  3378. func (c *ChangesListCall) SupportsTeamDrives(supportsTeamDrives bool) *ChangesListCall {
  3379. c.urlParams_.Set("supportsTeamDrives", fmt.Sprint(supportsTeamDrives))
  3380. return c
  3381. }
  3382. // TeamDriveId sets the optional parameter "teamDriveId": The Team Drive
  3383. // from which changes will be returned. If specified the change IDs will
  3384. // be reflective of the Team Drive; use the combined Team Drive ID and
  3385. // change ID as an identifier.
  3386. func (c *ChangesListCall) TeamDriveId(teamDriveId string) *ChangesListCall {
  3387. c.urlParams_.Set("teamDriveId", teamDriveId)
  3388. return c
  3389. }
  3390. // Fields allows partial responses to be retrieved. See
  3391. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3392. // for more information.
  3393. func (c *ChangesListCall) Fields(s ...googleapi.Field) *ChangesListCall {
  3394. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3395. return c
  3396. }
  3397. // IfNoneMatch sets the optional parameter which makes the operation
  3398. // fail if the object's ETag matches the given value. This is useful for
  3399. // getting updates only after the object has changed since the last
  3400. // request. Use googleapi.IsNotModified to check whether the response
  3401. // error from Do is the result of In-None-Match.
  3402. func (c *ChangesListCall) IfNoneMatch(entityTag string) *ChangesListCall {
  3403. c.ifNoneMatch_ = entityTag
  3404. return c
  3405. }
  3406. // Context sets the context to be used in this call's Do method. Any
  3407. // pending HTTP request will be aborted if the provided context is
  3408. // canceled.
  3409. func (c *ChangesListCall) Context(ctx context.Context) *ChangesListCall {
  3410. c.ctx_ = ctx
  3411. return c
  3412. }
  3413. // Header returns an http.Header that can be modified by the caller to
  3414. // add HTTP headers to the request.
  3415. func (c *ChangesListCall) Header() http.Header {
  3416. if c.header_ == nil {
  3417. c.header_ = make(http.Header)
  3418. }
  3419. return c.header_
  3420. }
  3421. func (c *ChangesListCall) doRequest(alt string) (*http.Response, error) {
  3422. reqHeaders := make(http.Header)
  3423. for k, v := range c.header_ {
  3424. reqHeaders[k] = v
  3425. }
  3426. reqHeaders.Set("User-Agent", c.s.userAgent())
  3427. if c.ifNoneMatch_ != "" {
  3428. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  3429. }
  3430. var body io.Reader = nil
  3431. c.urlParams_.Set("alt", alt)
  3432. urls := googleapi.ResolveRelative(c.s.BasePath, "changes")
  3433. urls += "?" + c.urlParams_.Encode()
  3434. req, _ := http.NewRequest("GET", urls, body)
  3435. req.Header = reqHeaders
  3436. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3437. }
  3438. // Do executes the "drive.changes.list" call.
  3439. // Exactly one of *ChangeList or error will be non-nil. Any non-2xx
  3440. // status code is an error. Response headers are in either
  3441. // *ChangeList.ServerResponse.Header or (if a response was returned at
  3442. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  3443. // to check whether the returned error was because
  3444. // http.StatusNotModified was returned.
  3445. func (c *ChangesListCall) Do(opts ...googleapi.CallOption) (*ChangeList, error) {
  3446. gensupport.SetOptions(c.urlParams_, opts...)
  3447. res, err := c.doRequest("json")
  3448. if res != nil && res.StatusCode == http.StatusNotModified {
  3449. if res.Body != nil {
  3450. res.Body.Close()
  3451. }
  3452. return nil, &googleapi.Error{
  3453. Code: res.StatusCode,
  3454. Header: res.Header,
  3455. }
  3456. }
  3457. if err != nil {
  3458. return nil, err
  3459. }
  3460. defer googleapi.CloseBody(res)
  3461. if err := googleapi.CheckResponse(res); err != nil {
  3462. return nil, err
  3463. }
  3464. ret := &ChangeList{
  3465. ServerResponse: googleapi.ServerResponse{
  3466. Header: res.Header,
  3467. HTTPStatusCode: res.StatusCode,
  3468. },
  3469. }
  3470. target := &ret
  3471. if err := gensupport.DecodeResponse(target, res); err != nil {
  3472. return nil, err
  3473. }
  3474. return ret, nil
  3475. // {
  3476. // "description": "Lists the changes for a user or Team Drive.",
  3477. // "httpMethod": "GET",
  3478. // "id": "drive.changes.list",
  3479. // "parameters": {
  3480. // "includeCorpusRemovals": {
  3481. // "default": "false",
  3482. // "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.",
  3483. // "location": "query",
  3484. // "type": "boolean"
  3485. // },
  3486. // "includeDeleted": {
  3487. // "default": "true",
  3488. // "description": "Whether to include changes indicating that items have been removed from the list of changes, for example by deletion or loss of access.",
  3489. // "location": "query",
  3490. // "type": "boolean"
  3491. // },
  3492. // "includeSubscribed": {
  3493. // "default": "true",
  3494. // "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.",
  3495. // "location": "query",
  3496. // "type": "boolean"
  3497. // },
  3498. // "includeTeamDriveItems": {
  3499. // "default": "false",
  3500. // "description": "Whether Team Drive files or changes should be included in results.",
  3501. // "location": "query",
  3502. // "type": "boolean"
  3503. // },
  3504. // "maxResults": {
  3505. // "default": "100",
  3506. // "description": "Maximum number of changes to return.",
  3507. // "format": "int32",
  3508. // "location": "query",
  3509. // "minimum": "1",
  3510. // "type": "integer"
  3511. // },
  3512. // "pageToken": {
  3513. // "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.",
  3514. // "location": "query",
  3515. // "type": "string"
  3516. // },
  3517. // "spaces": {
  3518. // "description": "A comma-separated list of spaces to query. Supported values are 'drive', 'appDataFolder' and 'photos'.",
  3519. // "location": "query",
  3520. // "type": "string"
  3521. // },
  3522. // "startChangeId": {
  3523. // "description": "Deprecated - use pageToken instead.",
  3524. // "format": "int64",
  3525. // "location": "query",
  3526. // "type": "string"
  3527. // },
  3528. // "supportsTeamDrives": {
  3529. // "default": "false",
  3530. // "description": "Whether the requesting application supports Team Drives.",
  3531. // "location": "query",
  3532. // "type": "boolean"
  3533. // },
  3534. // "teamDriveId": {
  3535. // "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.",
  3536. // "location": "query",
  3537. // "type": "string"
  3538. // }
  3539. // },
  3540. // "path": "changes",
  3541. // "response": {
  3542. // "$ref": "ChangeList"
  3543. // },
  3544. // "scopes": [
  3545. // "https://www.googleapis.com/auth/drive",
  3546. // "https://www.googleapis.com/auth/drive.appdata",
  3547. // "https://www.googleapis.com/auth/drive.apps.readonly",
  3548. // "https://www.googleapis.com/auth/drive.file",
  3549. // "https://www.googleapis.com/auth/drive.metadata",
  3550. // "https://www.googleapis.com/auth/drive.metadata.readonly",
  3551. // "https://www.googleapis.com/auth/drive.photos.readonly",
  3552. // "https://www.googleapis.com/auth/drive.readonly"
  3553. // ],
  3554. // "supportsSubscription": true
  3555. // }
  3556. }
  3557. // Pages invokes f for each page of results.
  3558. // A non-nil error returned from f will halt the iteration.
  3559. // The provided context supersedes any context provided to the Context method.
  3560. func (c *ChangesListCall) Pages(ctx context.Context, f func(*ChangeList) error) error {
  3561. c.ctx_ = ctx
  3562. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  3563. for {
  3564. x, err := c.Do()
  3565. if err != nil {
  3566. return err
  3567. }
  3568. if err := f(x); err != nil {
  3569. return err
  3570. }
  3571. if x.NextPageToken == "" {
  3572. return nil
  3573. }
  3574. c.PageToken(x.NextPageToken)
  3575. }
  3576. }
  3577. // method id "drive.changes.watch":
  3578. type ChangesWatchCall struct {
  3579. s *Service
  3580. channel *Channel
  3581. urlParams_ gensupport.URLParams
  3582. ctx_ context.Context
  3583. header_ http.Header
  3584. }
  3585. // Watch: Subscribe to changes for a user.
  3586. func (r *ChangesService) Watch(channel *Channel) *ChangesWatchCall {
  3587. c := &ChangesWatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3588. c.channel = channel
  3589. return c
  3590. }
  3591. // IncludeCorpusRemovals sets the optional parameter
  3592. // "includeCorpusRemovals": Whether changes should include the file
  3593. // resource if the file is still accessible by the user at the time of
  3594. // the request, even when a file was removed from the list of changes
  3595. // and there will be no further change entries for this file.
  3596. func (c *ChangesWatchCall) IncludeCorpusRemovals(includeCorpusRemovals bool) *ChangesWatchCall {
  3597. c.urlParams_.Set("includeCorpusRemovals", fmt.Sprint(includeCorpusRemovals))
  3598. return c
  3599. }
  3600. // IncludeDeleted sets the optional parameter "includeDeleted": Whether
  3601. // to include changes indicating that items have been removed from the
  3602. // list of changes, for example by deletion or loss of access.
  3603. func (c *ChangesWatchCall) IncludeDeleted(includeDeleted bool) *ChangesWatchCall {
  3604. c.urlParams_.Set("includeDeleted", fmt.Sprint(includeDeleted))
  3605. return c
  3606. }
  3607. // IncludeSubscribed sets the optional parameter "includeSubscribed":
  3608. // Whether to include changes outside the My Drive hierarchy in the
  3609. // result. When set to false, changes to files such as those in the
  3610. // Application Data folder or shared files which have not been added to
  3611. // My Drive will be omitted from the result.
  3612. func (c *ChangesWatchCall) IncludeSubscribed(includeSubscribed bool) *ChangesWatchCall {
  3613. c.urlParams_.Set("includeSubscribed", fmt.Sprint(includeSubscribed))
  3614. return c
  3615. }
  3616. // IncludeTeamDriveItems sets the optional parameter
  3617. // "includeTeamDriveItems": Whether Team Drive files or changes should
  3618. // be included in results.
  3619. func (c *ChangesWatchCall) IncludeTeamDriveItems(includeTeamDriveItems bool) *ChangesWatchCall {
  3620. c.urlParams_.Set("includeTeamDriveItems", fmt.Sprint(includeTeamDriveItems))
  3621. return c
  3622. }
  3623. // MaxResults sets the optional parameter "maxResults": Maximum number
  3624. // of changes to return.
  3625. func (c *ChangesWatchCall) MaxResults(maxResults int64) *ChangesWatchCall {
  3626. c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
  3627. return c
  3628. }
  3629. // PageToken sets the optional parameter "pageToken": The token for
  3630. // continuing a previous list request on the next page. This should be
  3631. // set to the value of 'nextPageToken' from the previous response or to
  3632. // the response from the getStartPageToken method.
  3633. func (c *ChangesWatchCall) PageToken(pageToken string) *ChangesWatchCall {
  3634. c.urlParams_.Set("pageToken", pageToken)
  3635. return c
  3636. }
  3637. // Spaces sets the optional parameter "spaces": A comma-separated list
  3638. // of spaces to query. Supported values are 'drive', 'appDataFolder' and
  3639. // 'photos'.
  3640. func (c *ChangesWatchCall) Spaces(spaces string) *ChangesWatchCall {
  3641. c.urlParams_.Set("spaces", spaces)
  3642. return c
  3643. }
  3644. // StartChangeId sets the optional parameter "startChangeId": Deprecated
  3645. // - use pageToken instead.
  3646. func (c *ChangesWatchCall) StartChangeId(startChangeId int64) *ChangesWatchCall {
  3647. c.urlParams_.Set("startChangeId", fmt.Sprint(startChangeId))
  3648. return c
  3649. }
  3650. // SupportsTeamDrives sets the optional parameter "supportsTeamDrives":
  3651. // Whether the requesting application supports Team Drives.
  3652. func (c *ChangesWatchCall) SupportsTeamDrives(supportsTeamDrives bool) *ChangesWatchCall {
  3653. c.urlParams_.Set("supportsTeamDrives", fmt.Sprint(supportsTeamDrives))
  3654. return c
  3655. }
  3656. // TeamDriveId sets the optional parameter "teamDriveId": The Team Drive
  3657. // from which changes will be returned. If specified the change IDs will
  3658. // be reflective of the Team Drive; use the combined Team Drive ID and
  3659. // change ID as an identifier.
  3660. func (c *ChangesWatchCall) TeamDriveId(teamDriveId string) *ChangesWatchCall {
  3661. c.urlParams_.Set("teamDriveId", teamDriveId)
  3662. return c
  3663. }
  3664. // Fields allows partial responses to be retrieved. See
  3665. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3666. // for more information.
  3667. func (c *ChangesWatchCall) Fields(s ...googleapi.Field) *ChangesWatchCall {
  3668. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3669. return c
  3670. }
  3671. // Context sets the context to be used in this call's Do method. Any
  3672. // pending HTTP request will be aborted if the provided context is
  3673. // canceled.
  3674. func (c *ChangesWatchCall) Context(ctx context.Context) *ChangesWatchCall {
  3675. c.ctx_ = ctx
  3676. return c
  3677. }
  3678. // Header returns an http.Header that can be modified by the caller to
  3679. // add HTTP headers to the request.
  3680. func (c *ChangesWatchCall) Header() http.Header {
  3681. if c.header_ == nil {
  3682. c.header_ = make(http.Header)
  3683. }
  3684. return c.header_
  3685. }
  3686. func (c *ChangesWatchCall) doRequest(alt string) (*http.Response, error) {
  3687. reqHeaders := make(http.Header)
  3688. for k, v := range c.header_ {
  3689. reqHeaders[k] = v
  3690. }
  3691. reqHeaders.Set("User-Agent", c.s.userAgent())
  3692. var body io.Reader = nil
  3693. body, err := googleapi.WithoutDataWrapper.JSONReader(c.channel)
  3694. if err != nil {
  3695. return nil, err
  3696. }
  3697. reqHeaders.Set("Content-Type", "application/json")
  3698. c.urlParams_.Set("alt", alt)
  3699. urls := googleapi.ResolveRelative(c.s.BasePath, "changes/watch")
  3700. urls += "?" + c.urlParams_.Encode()
  3701. req, _ := http.NewRequest("POST", urls, body)
  3702. req.Header = reqHeaders
  3703. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3704. }
  3705. // Do executes the "drive.changes.watch" call.
  3706. // Exactly one of *Channel or error will be non-nil. Any non-2xx status
  3707. // code is an error. Response headers are in either
  3708. // *Channel.ServerResponse.Header or (if a response was returned at all)
  3709. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  3710. // check whether the returned error was because http.StatusNotModified
  3711. // was returned.
  3712. func (c *ChangesWatchCall) Do(opts ...googleapi.CallOption) (*Channel, error) {
  3713. gensupport.SetOptions(c.urlParams_, opts...)
  3714. res, err := c.doRequest("json")
  3715. if res != nil && res.StatusCode == http.StatusNotModified {
  3716. if res.Body != nil {
  3717. res.Body.Close()
  3718. }
  3719. return nil, &googleapi.Error{
  3720. Code: res.StatusCode,
  3721. Header: res.Header,
  3722. }
  3723. }
  3724. if err != nil {
  3725. return nil, err
  3726. }
  3727. defer googleapi.CloseBody(res)
  3728. if err := googleapi.CheckResponse(res); err != nil {
  3729. return nil, err
  3730. }
  3731. ret := &Channel{
  3732. ServerResponse: googleapi.ServerResponse{
  3733. Header: res.Header,
  3734. HTTPStatusCode: res.StatusCode,
  3735. },
  3736. }
  3737. target := &ret
  3738. if err := gensupport.DecodeResponse(target, res); err != nil {
  3739. return nil, err
  3740. }
  3741. return ret, nil
  3742. // {
  3743. // "description": "Subscribe to changes for a user.",
  3744. // "httpMethod": "POST",
  3745. // "id": "drive.changes.watch",
  3746. // "parameters": {
  3747. // "includeCorpusRemovals": {
  3748. // "default": "false",
  3749. // "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.",
  3750. // "location": "query",
  3751. // "type": "boolean"
  3752. // },
  3753. // "includeDeleted": {
  3754. // "default": "true",
  3755. // "description": "Whether to include changes indicating that items have been removed from the list of changes, for example by deletion or loss of access.",
  3756. // "location": "query",
  3757. // "type": "boolean"
  3758. // },
  3759. // "includeSubscribed": {
  3760. // "default": "true",
  3761. // "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.",
  3762. // "location": "query",
  3763. // "type": "boolean"
  3764. // },
  3765. // "includeTeamDriveItems": {
  3766. // "default": "false",
  3767. // "description": "Whether Team Drive files or changes should be included in results.",
  3768. // "location": "query",
  3769. // "type": "boolean"
  3770. // },
  3771. // "maxResults": {
  3772. // "default": "100",
  3773. // "description": "Maximum number of changes to return.",
  3774. // "format": "int32",
  3775. // "location": "query",
  3776. // "minimum": "1",
  3777. // "type": "integer"
  3778. // },
  3779. // "pageToken": {
  3780. // "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.",
  3781. // "location": "query",
  3782. // "type": "string"
  3783. // },
  3784. // "spaces": {
  3785. // "description": "A comma-separated list of spaces to query. Supported values are 'drive', 'appDataFolder' and 'photos'.",
  3786. // "location": "query",
  3787. // "type": "string"
  3788. // },
  3789. // "startChangeId": {
  3790. // "description": "Deprecated - use pageToken instead.",
  3791. // "format": "int64",
  3792. // "location": "query",
  3793. // "type": "string"
  3794. // },
  3795. // "supportsTeamDrives": {
  3796. // "default": "false",
  3797. // "description": "Whether the requesting application supports Team Drives.",
  3798. // "location": "query",
  3799. // "type": "boolean"
  3800. // },
  3801. // "teamDriveId": {
  3802. // "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.",
  3803. // "location": "query",
  3804. // "type": "string"
  3805. // }
  3806. // },
  3807. // "path": "changes/watch",
  3808. // "request": {
  3809. // "$ref": "Channel",
  3810. // "parameterName": "resource"
  3811. // },
  3812. // "response": {
  3813. // "$ref": "Channel"
  3814. // },
  3815. // "scopes": [
  3816. // "https://www.googleapis.com/auth/drive",
  3817. // "https://www.googleapis.com/auth/drive.appdata",
  3818. // "https://www.googleapis.com/auth/drive.apps.readonly",
  3819. // "https://www.googleapis.com/auth/drive.file",
  3820. // "https://www.googleapis.com/auth/drive.metadata",
  3821. // "https://www.googleapis.com/auth/drive.metadata.readonly",
  3822. // "https://www.googleapis.com/auth/drive.photos.readonly",
  3823. // "https://www.googleapis.com/auth/drive.readonly"
  3824. // ],
  3825. // "supportsSubscription": true
  3826. // }
  3827. }
  3828. // method id "drive.channels.stop":
  3829. type ChannelsStopCall struct {
  3830. s *Service
  3831. channel *Channel
  3832. urlParams_ gensupport.URLParams
  3833. ctx_ context.Context
  3834. header_ http.Header
  3835. }
  3836. // Stop: Stop watching resources through this channel
  3837. func (r *ChannelsService) Stop(channel *Channel) *ChannelsStopCall {
  3838. c := &ChannelsStopCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3839. c.channel = channel
  3840. return c
  3841. }
  3842. // Fields allows partial responses to be retrieved. See
  3843. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3844. // for more information.
  3845. func (c *ChannelsStopCall) Fields(s ...googleapi.Field) *ChannelsStopCall {
  3846. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3847. return c
  3848. }
  3849. // Context sets the context to be used in this call's Do method. Any
  3850. // pending HTTP request will be aborted if the provided context is
  3851. // canceled.
  3852. func (c *ChannelsStopCall) Context(ctx context.Context) *ChannelsStopCall {
  3853. c.ctx_ = ctx
  3854. return c
  3855. }
  3856. // Header returns an http.Header that can be modified by the caller to
  3857. // add HTTP headers to the request.
  3858. func (c *ChannelsStopCall) Header() http.Header {
  3859. if c.header_ == nil {
  3860. c.header_ = make(http.Header)
  3861. }
  3862. return c.header_
  3863. }
  3864. func (c *ChannelsStopCall) doRequest(alt string) (*http.Response, error) {
  3865. reqHeaders := make(http.Header)
  3866. for k, v := range c.header_ {
  3867. reqHeaders[k] = v
  3868. }
  3869. reqHeaders.Set("User-Agent", c.s.userAgent())
  3870. var body io.Reader = nil
  3871. body, err := googleapi.WithoutDataWrapper.JSONReader(c.channel)
  3872. if err != nil {
  3873. return nil, err
  3874. }
  3875. reqHeaders.Set("Content-Type", "application/json")
  3876. c.urlParams_.Set("alt", alt)
  3877. urls := googleapi.ResolveRelative(c.s.BasePath, "channels/stop")
  3878. urls += "?" + c.urlParams_.Encode()
  3879. req, _ := http.NewRequest("POST", urls, body)
  3880. req.Header = reqHeaders
  3881. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3882. }
  3883. // Do executes the "drive.channels.stop" call.
  3884. func (c *ChannelsStopCall) Do(opts ...googleapi.CallOption) error {
  3885. gensupport.SetOptions(c.urlParams_, opts...)
  3886. res, err := c.doRequest("json")
  3887. if err != nil {
  3888. return err
  3889. }
  3890. defer googleapi.CloseBody(res)
  3891. if err := googleapi.CheckResponse(res); err != nil {
  3892. return err
  3893. }
  3894. return nil
  3895. // {
  3896. // "description": "Stop watching resources through this channel",
  3897. // "httpMethod": "POST",
  3898. // "id": "drive.channels.stop",
  3899. // "path": "channels/stop",
  3900. // "request": {
  3901. // "$ref": "Channel",
  3902. // "parameterName": "resource"
  3903. // },
  3904. // "scopes": [
  3905. // "https://www.googleapis.com/auth/drive",
  3906. // "https://www.googleapis.com/auth/drive.appdata",
  3907. // "https://www.googleapis.com/auth/drive.apps.readonly",
  3908. // "https://www.googleapis.com/auth/drive.file",
  3909. // "https://www.googleapis.com/auth/drive.metadata",
  3910. // "https://www.googleapis.com/auth/drive.metadata.readonly",
  3911. // "https://www.googleapis.com/auth/drive.photos.readonly",
  3912. // "https://www.googleapis.com/auth/drive.readonly"
  3913. // ]
  3914. // }
  3915. }
  3916. // method id "drive.children.delete":
  3917. type ChildrenDeleteCall struct {
  3918. s *Service
  3919. folderId string
  3920. childId string
  3921. urlParams_ gensupport.URLParams
  3922. ctx_ context.Context
  3923. header_ http.Header
  3924. }
  3925. // Delete: Removes a child from a folder.
  3926. func (r *ChildrenService) Delete(folderId string, childId string) *ChildrenDeleteCall {
  3927. c := &ChildrenDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  3928. c.folderId = folderId
  3929. c.childId = childId
  3930. return c
  3931. }
  3932. // Fields allows partial responses to be retrieved. See
  3933. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  3934. // for more information.
  3935. func (c *ChildrenDeleteCall) Fields(s ...googleapi.Field) *ChildrenDeleteCall {
  3936. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  3937. return c
  3938. }
  3939. // Context sets the context to be used in this call's Do method. Any
  3940. // pending HTTP request will be aborted if the provided context is
  3941. // canceled.
  3942. func (c *ChildrenDeleteCall) Context(ctx context.Context) *ChildrenDeleteCall {
  3943. c.ctx_ = ctx
  3944. return c
  3945. }
  3946. // Header returns an http.Header that can be modified by the caller to
  3947. // add HTTP headers to the request.
  3948. func (c *ChildrenDeleteCall) Header() http.Header {
  3949. if c.header_ == nil {
  3950. c.header_ = make(http.Header)
  3951. }
  3952. return c.header_
  3953. }
  3954. func (c *ChildrenDeleteCall) doRequest(alt string) (*http.Response, error) {
  3955. reqHeaders := make(http.Header)
  3956. for k, v := range c.header_ {
  3957. reqHeaders[k] = v
  3958. }
  3959. reqHeaders.Set("User-Agent", c.s.userAgent())
  3960. var body io.Reader = nil
  3961. c.urlParams_.Set("alt", alt)
  3962. urls := googleapi.ResolveRelative(c.s.BasePath, "files/{folderId}/children/{childId}")
  3963. urls += "?" + c.urlParams_.Encode()
  3964. req, _ := http.NewRequest("DELETE", urls, body)
  3965. req.Header = reqHeaders
  3966. googleapi.Expand(req.URL, map[string]string{
  3967. "folderId": c.folderId,
  3968. "childId": c.childId,
  3969. })
  3970. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  3971. }
  3972. // Do executes the "drive.children.delete" call.
  3973. func (c *ChildrenDeleteCall) Do(opts ...googleapi.CallOption) error {
  3974. gensupport.SetOptions(c.urlParams_, opts...)
  3975. res, err := c.doRequest("json")
  3976. if err != nil {
  3977. return err
  3978. }
  3979. defer googleapi.CloseBody(res)
  3980. if err := googleapi.CheckResponse(res); err != nil {
  3981. return err
  3982. }
  3983. return nil
  3984. // {
  3985. // "description": "Removes a child from a folder.",
  3986. // "httpMethod": "DELETE",
  3987. // "id": "drive.children.delete",
  3988. // "parameterOrder": [
  3989. // "folderId",
  3990. // "childId"
  3991. // ],
  3992. // "parameters": {
  3993. // "childId": {
  3994. // "description": "The ID of the child.",
  3995. // "location": "path",
  3996. // "required": true,
  3997. // "type": "string"
  3998. // },
  3999. // "folderId": {
  4000. // "description": "The ID of the folder.",
  4001. // "location": "path",
  4002. // "required": true,
  4003. // "type": "string"
  4004. // }
  4005. // },
  4006. // "path": "files/{folderId}/children/{childId}",
  4007. // "scopes": [
  4008. // "https://www.googleapis.com/auth/drive",
  4009. // "https://www.googleapis.com/auth/drive.file"
  4010. // ]
  4011. // }
  4012. }
  4013. // method id "drive.children.get":
  4014. type ChildrenGetCall struct {
  4015. s *Service
  4016. folderId string
  4017. childId string
  4018. urlParams_ gensupport.URLParams
  4019. ifNoneMatch_ string
  4020. ctx_ context.Context
  4021. header_ http.Header
  4022. }
  4023. // Get: Gets a specific child reference.
  4024. func (r *ChildrenService) Get(folderId string, childId string) *ChildrenGetCall {
  4025. c := &ChildrenGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4026. c.folderId = folderId
  4027. c.childId = childId
  4028. return c
  4029. }
  4030. // Fields allows partial responses to be retrieved. See
  4031. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4032. // for more information.
  4033. func (c *ChildrenGetCall) Fields(s ...googleapi.Field) *ChildrenGetCall {
  4034. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4035. return c
  4036. }
  4037. // IfNoneMatch sets the optional parameter which makes the operation
  4038. // fail if the object's ETag matches the given value. This is useful for
  4039. // getting updates only after the object has changed since the last
  4040. // request. Use googleapi.IsNotModified to check whether the response
  4041. // error from Do is the result of In-None-Match.
  4042. func (c *ChildrenGetCall) IfNoneMatch(entityTag string) *ChildrenGetCall {
  4043. c.ifNoneMatch_ = entityTag
  4044. return c
  4045. }
  4046. // Context sets the context to be used in this call's Do method. Any
  4047. // pending HTTP request will be aborted if the provided context is
  4048. // canceled.
  4049. func (c *ChildrenGetCall) Context(ctx context.Context) *ChildrenGetCall {
  4050. c.ctx_ = ctx
  4051. return c
  4052. }
  4053. // Header returns an http.Header that can be modified by the caller to
  4054. // add HTTP headers to the request.
  4055. func (c *ChildrenGetCall) Header() http.Header {
  4056. if c.header_ == nil {
  4057. c.header_ = make(http.Header)
  4058. }
  4059. return c.header_
  4060. }
  4061. func (c *ChildrenGetCall) doRequest(alt string) (*http.Response, error) {
  4062. reqHeaders := make(http.Header)
  4063. for k, v := range c.header_ {
  4064. reqHeaders[k] = v
  4065. }
  4066. reqHeaders.Set("User-Agent", c.s.userAgent())
  4067. if c.ifNoneMatch_ != "" {
  4068. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  4069. }
  4070. var body io.Reader = nil
  4071. c.urlParams_.Set("alt", alt)
  4072. urls := googleapi.ResolveRelative(c.s.BasePath, "files/{folderId}/children/{childId}")
  4073. urls += "?" + c.urlParams_.Encode()
  4074. req, _ := http.NewRequest("GET", urls, body)
  4075. req.Header = reqHeaders
  4076. googleapi.Expand(req.URL, map[string]string{
  4077. "folderId": c.folderId,
  4078. "childId": c.childId,
  4079. })
  4080. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4081. }
  4082. // Do executes the "drive.children.get" call.
  4083. // Exactly one of *ChildReference or error will be non-nil. Any non-2xx
  4084. // status code is an error. Response headers are in either
  4085. // *ChildReference.ServerResponse.Header or (if a response was returned
  4086. // at all) in error.(*googleapi.Error).Header. Use
  4087. // googleapi.IsNotModified to check whether the returned error was
  4088. // because http.StatusNotModified was returned.
  4089. func (c *ChildrenGetCall) Do(opts ...googleapi.CallOption) (*ChildReference, error) {
  4090. gensupport.SetOptions(c.urlParams_, opts...)
  4091. res, err := c.doRequest("json")
  4092. if res != nil && res.StatusCode == http.StatusNotModified {
  4093. if res.Body != nil {
  4094. res.Body.Close()
  4095. }
  4096. return nil, &googleapi.Error{
  4097. Code: res.StatusCode,
  4098. Header: res.Header,
  4099. }
  4100. }
  4101. if err != nil {
  4102. return nil, err
  4103. }
  4104. defer googleapi.CloseBody(res)
  4105. if err := googleapi.CheckResponse(res); err != nil {
  4106. return nil, err
  4107. }
  4108. ret := &ChildReference{
  4109. ServerResponse: googleapi.ServerResponse{
  4110. Header: res.Header,
  4111. HTTPStatusCode: res.StatusCode,
  4112. },
  4113. }
  4114. target := &ret
  4115. if err := gensupport.DecodeResponse(target, res); err != nil {
  4116. return nil, err
  4117. }
  4118. return ret, nil
  4119. // {
  4120. // "description": "Gets a specific child reference.",
  4121. // "httpMethod": "GET",
  4122. // "id": "drive.children.get",
  4123. // "parameterOrder": [
  4124. // "folderId",
  4125. // "childId"
  4126. // ],
  4127. // "parameters": {
  4128. // "childId": {
  4129. // "description": "The ID of the child.",
  4130. // "location": "path",
  4131. // "required": true,
  4132. // "type": "string"
  4133. // },
  4134. // "folderId": {
  4135. // "description": "The ID of the folder.",
  4136. // "location": "path",
  4137. // "required": true,
  4138. // "type": "string"
  4139. // }
  4140. // },
  4141. // "path": "files/{folderId}/children/{childId}",
  4142. // "response": {
  4143. // "$ref": "ChildReference"
  4144. // },
  4145. // "scopes": [
  4146. // "https://www.googleapis.com/auth/drive",
  4147. // "https://www.googleapis.com/auth/drive.appdata",
  4148. // "https://www.googleapis.com/auth/drive.file",
  4149. // "https://www.googleapis.com/auth/drive.metadata",
  4150. // "https://www.googleapis.com/auth/drive.metadata.readonly",
  4151. // "https://www.googleapis.com/auth/drive.photos.readonly",
  4152. // "https://www.googleapis.com/auth/drive.readonly"
  4153. // ]
  4154. // }
  4155. }
  4156. // method id "drive.children.insert":
  4157. type ChildrenInsertCall struct {
  4158. s *Service
  4159. folderId string
  4160. childreference *ChildReference
  4161. urlParams_ gensupport.URLParams
  4162. ctx_ context.Context
  4163. header_ http.Header
  4164. }
  4165. // Insert: Inserts a file into a folder.
  4166. func (r *ChildrenService) Insert(folderId string, childreference *ChildReference) *ChildrenInsertCall {
  4167. c := &ChildrenInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4168. c.folderId = folderId
  4169. c.childreference = childreference
  4170. return c
  4171. }
  4172. // SupportsTeamDrives sets the optional parameter "supportsTeamDrives":
  4173. // Whether the requesting application supports Team Drives.
  4174. func (c *ChildrenInsertCall) SupportsTeamDrives(supportsTeamDrives bool) *ChildrenInsertCall {
  4175. c.urlParams_.Set("supportsTeamDrives", fmt.Sprint(supportsTeamDrives))
  4176. return c
  4177. }
  4178. // Fields allows partial responses to be retrieved. See
  4179. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4180. // for more information.
  4181. func (c *ChildrenInsertCall) Fields(s ...googleapi.Field) *ChildrenInsertCall {
  4182. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4183. return c
  4184. }
  4185. // Context sets the context to be used in this call's Do method. Any
  4186. // pending HTTP request will be aborted if the provided context is
  4187. // canceled.
  4188. func (c *ChildrenInsertCall) Context(ctx context.Context) *ChildrenInsertCall {
  4189. c.ctx_ = ctx
  4190. return c
  4191. }
  4192. // Header returns an http.Header that can be modified by the caller to
  4193. // add HTTP headers to the request.
  4194. func (c *ChildrenInsertCall) Header() http.Header {
  4195. if c.header_ == nil {
  4196. c.header_ = make(http.Header)
  4197. }
  4198. return c.header_
  4199. }
  4200. func (c *ChildrenInsertCall) doRequest(alt string) (*http.Response, error) {
  4201. reqHeaders := make(http.Header)
  4202. for k, v := range c.header_ {
  4203. reqHeaders[k] = v
  4204. }
  4205. reqHeaders.Set("User-Agent", c.s.userAgent())
  4206. var body io.Reader = nil
  4207. body, err := googleapi.WithoutDataWrapper.JSONReader(c.childreference)
  4208. if err != nil {
  4209. return nil, err
  4210. }
  4211. reqHeaders.Set("Content-Type", "application/json")
  4212. c.urlParams_.Set("alt", alt)
  4213. urls := googleapi.ResolveRelative(c.s.BasePath, "files/{folderId}/children")
  4214. urls += "?" + c.urlParams_.Encode()
  4215. req, _ := http.NewRequest("POST", urls, body)
  4216. req.Header = reqHeaders
  4217. googleapi.Expand(req.URL, map[string]string{
  4218. "folderId": c.folderId,
  4219. })
  4220. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4221. }
  4222. // Do executes the "drive.children.insert" call.
  4223. // Exactly one of *ChildReference or error will be non-nil. Any non-2xx
  4224. // status code is an error. Response headers are in either
  4225. // *ChildReference.ServerResponse.Header or (if a response was returned
  4226. // at all) in error.(*googleapi.Error).Header. Use
  4227. // googleapi.IsNotModified to check whether the returned error was
  4228. // because http.StatusNotModified was returned.
  4229. func (c *ChildrenInsertCall) Do(opts ...googleapi.CallOption) (*ChildReference, error) {
  4230. gensupport.SetOptions(c.urlParams_, opts...)
  4231. res, err := c.doRequest("json")
  4232. if res != nil && res.StatusCode == http.StatusNotModified {
  4233. if res.Body != nil {
  4234. res.Body.Close()
  4235. }
  4236. return nil, &googleapi.Error{
  4237. Code: res.StatusCode,
  4238. Header: res.Header,
  4239. }
  4240. }
  4241. if err != nil {
  4242. return nil, err
  4243. }
  4244. defer googleapi.CloseBody(res)
  4245. if err := googleapi.CheckResponse(res); err != nil {
  4246. return nil, err
  4247. }
  4248. ret := &ChildReference{
  4249. ServerResponse: googleapi.ServerResponse{
  4250. Header: res.Header,
  4251. HTTPStatusCode: res.StatusCode,
  4252. },
  4253. }
  4254. target := &ret
  4255. if err := gensupport.DecodeResponse(target, res); err != nil {
  4256. return nil, err
  4257. }
  4258. return ret, nil
  4259. // {
  4260. // "description": "Inserts a file into a folder.",
  4261. // "httpMethod": "POST",
  4262. // "id": "drive.children.insert",
  4263. // "parameterOrder": [
  4264. // "folderId"
  4265. // ],
  4266. // "parameters": {
  4267. // "folderId": {
  4268. // "description": "The ID of the folder.",
  4269. // "location": "path",
  4270. // "required": true,
  4271. // "type": "string"
  4272. // },
  4273. // "supportsTeamDrives": {
  4274. // "default": "false",
  4275. // "description": "Whether the requesting application supports Team Drives.",
  4276. // "location": "query",
  4277. // "type": "boolean"
  4278. // }
  4279. // },
  4280. // "path": "files/{folderId}/children",
  4281. // "request": {
  4282. // "$ref": "ChildReference"
  4283. // },
  4284. // "response": {
  4285. // "$ref": "ChildReference"
  4286. // },
  4287. // "scopes": [
  4288. // "https://www.googleapis.com/auth/drive",
  4289. // "https://www.googleapis.com/auth/drive.appdata",
  4290. // "https://www.googleapis.com/auth/drive.file"
  4291. // ]
  4292. // }
  4293. }
  4294. // method id "drive.children.list":
  4295. type ChildrenListCall struct {
  4296. s *Service
  4297. folderId string
  4298. urlParams_ gensupport.URLParams
  4299. ifNoneMatch_ string
  4300. ctx_ context.Context
  4301. header_ http.Header
  4302. }
  4303. // List: Lists a folder's children.
  4304. func (r *ChildrenService) List(folderId string) *ChildrenListCall {
  4305. c := &ChildrenListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4306. c.folderId = folderId
  4307. return c
  4308. }
  4309. // MaxResults sets the optional parameter "maxResults": Maximum number
  4310. // of children to return.
  4311. func (c *ChildrenListCall) MaxResults(maxResults int64) *ChildrenListCall {
  4312. c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
  4313. return c
  4314. }
  4315. // OrderBy sets the optional parameter "orderBy": A comma-separated list
  4316. // of sort keys. Valid keys are 'createdDate', 'folder',
  4317. // 'lastViewedByMeDate', 'modifiedByMeDate', 'modifiedDate',
  4318. // 'quotaBytesUsed', 'recency', 'sharedWithMeDate', 'starred', and
  4319. // 'title'. Each key sorts ascending by default, but may be reversed
  4320. // with the 'desc' modifier. Example usage: ?orderBy=folder,modifiedDate
  4321. // desc,title. Please note that there is a current limitation for users
  4322. // with approximately one million files in which the requested sort
  4323. // order is ignored.
  4324. func (c *ChildrenListCall) OrderBy(orderBy string) *ChildrenListCall {
  4325. c.urlParams_.Set("orderBy", orderBy)
  4326. return c
  4327. }
  4328. // PageToken sets the optional parameter "pageToken": Page token for
  4329. // children.
  4330. func (c *ChildrenListCall) PageToken(pageToken string) *ChildrenListCall {
  4331. c.urlParams_.Set("pageToken", pageToken)
  4332. return c
  4333. }
  4334. // Q sets the optional parameter "q": Query string for searching
  4335. // children.
  4336. func (c *ChildrenListCall) Q(q string) *ChildrenListCall {
  4337. c.urlParams_.Set("q", q)
  4338. return c
  4339. }
  4340. // Fields allows partial responses to be retrieved. See
  4341. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4342. // for more information.
  4343. func (c *ChildrenListCall) Fields(s ...googleapi.Field) *ChildrenListCall {
  4344. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4345. return c
  4346. }
  4347. // IfNoneMatch sets the optional parameter which makes the operation
  4348. // fail if the object's ETag matches the given value. This is useful for
  4349. // getting updates only after the object has changed since the last
  4350. // request. Use googleapi.IsNotModified to check whether the response
  4351. // error from Do is the result of In-None-Match.
  4352. func (c *ChildrenListCall) IfNoneMatch(entityTag string) *ChildrenListCall {
  4353. c.ifNoneMatch_ = entityTag
  4354. return c
  4355. }
  4356. // Context sets the context to be used in this call's Do method. Any
  4357. // pending HTTP request will be aborted if the provided context is
  4358. // canceled.
  4359. func (c *ChildrenListCall) Context(ctx context.Context) *ChildrenListCall {
  4360. c.ctx_ = ctx
  4361. return c
  4362. }
  4363. // Header returns an http.Header that can be modified by the caller to
  4364. // add HTTP headers to the request.
  4365. func (c *ChildrenListCall) Header() http.Header {
  4366. if c.header_ == nil {
  4367. c.header_ = make(http.Header)
  4368. }
  4369. return c.header_
  4370. }
  4371. func (c *ChildrenListCall) doRequest(alt string) (*http.Response, error) {
  4372. reqHeaders := make(http.Header)
  4373. for k, v := range c.header_ {
  4374. reqHeaders[k] = v
  4375. }
  4376. reqHeaders.Set("User-Agent", c.s.userAgent())
  4377. if c.ifNoneMatch_ != "" {
  4378. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  4379. }
  4380. var body io.Reader = nil
  4381. c.urlParams_.Set("alt", alt)
  4382. urls := googleapi.ResolveRelative(c.s.BasePath, "files/{folderId}/children")
  4383. urls += "?" + c.urlParams_.Encode()
  4384. req, _ := http.NewRequest("GET", urls, body)
  4385. req.Header = reqHeaders
  4386. googleapi.Expand(req.URL, map[string]string{
  4387. "folderId": c.folderId,
  4388. })
  4389. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4390. }
  4391. // Do executes the "drive.children.list" call.
  4392. // Exactly one of *ChildList or error will be non-nil. Any non-2xx
  4393. // status code is an error. Response headers are in either
  4394. // *ChildList.ServerResponse.Header or (if a response was returned at
  4395. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  4396. // to check whether the returned error was because
  4397. // http.StatusNotModified was returned.
  4398. func (c *ChildrenListCall) Do(opts ...googleapi.CallOption) (*ChildList, error) {
  4399. gensupport.SetOptions(c.urlParams_, opts...)
  4400. res, err := c.doRequest("json")
  4401. if res != nil && res.StatusCode == http.StatusNotModified {
  4402. if res.Body != nil {
  4403. res.Body.Close()
  4404. }
  4405. return nil, &googleapi.Error{
  4406. Code: res.StatusCode,
  4407. Header: res.Header,
  4408. }
  4409. }
  4410. if err != nil {
  4411. return nil, err
  4412. }
  4413. defer googleapi.CloseBody(res)
  4414. if err := googleapi.CheckResponse(res); err != nil {
  4415. return nil, err
  4416. }
  4417. ret := &ChildList{
  4418. ServerResponse: googleapi.ServerResponse{
  4419. Header: res.Header,
  4420. HTTPStatusCode: res.StatusCode,
  4421. },
  4422. }
  4423. target := &ret
  4424. if err := gensupport.DecodeResponse(target, res); err != nil {
  4425. return nil, err
  4426. }
  4427. return ret, nil
  4428. // {
  4429. // "description": "Lists a folder's children.",
  4430. // "httpMethod": "GET",
  4431. // "id": "drive.children.list",
  4432. // "parameterOrder": [
  4433. // "folderId"
  4434. // ],
  4435. // "parameters": {
  4436. // "folderId": {
  4437. // "description": "The ID of the folder.",
  4438. // "location": "path",
  4439. // "required": true,
  4440. // "type": "string"
  4441. // },
  4442. // "maxResults": {
  4443. // "default": "100",
  4444. // "description": "Maximum number of children to return.",
  4445. // "format": "int32",
  4446. // "location": "query",
  4447. // "minimum": "0",
  4448. // "type": "integer"
  4449. // },
  4450. // "orderBy": {
  4451. // "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.",
  4452. // "location": "query",
  4453. // "type": "string"
  4454. // },
  4455. // "pageToken": {
  4456. // "description": "Page token for children.",
  4457. // "location": "query",
  4458. // "type": "string"
  4459. // },
  4460. // "q": {
  4461. // "description": "Query string for searching children.",
  4462. // "location": "query",
  4463. // "type": "string"
  4464. // }
  4465. // },
  4466. // "path": "files/{folderId}/children",
  4467. // "response": {
  4468. // "$ref": "ChildList"
  4469. // },
  4470. // "scopes": [
  4471. // "https://www.googleapis.com/auth/drive",
  4472. // "https://www.googleapis.com/auth/drive.appdata",
  4473. // "https://www.googleapis.com/auth/drive.file",
  4474. // "https://www.googleapis.com/auth/drive.metadata",
  4475. // "https://www.googleapis.com/auth/drive.metadata.readonly",
  4476. // "https://www.googleapis.com/auth/drive.photos.readonly",
  4477. // "https://www.googleapis.com/auth/drive.readonly"
  4478. // ]
  4479. // }
  4480. }
  4481. // Pages invokes f for each page of results.
  4482. // A non-nil error returned from f will halt the iteration.
  4483. // The provided context supersedes any context provided to the Context method.
  4484. func (c *ChildrenListCall) Pages(ctx context.Context, f func(*ChildList) error) error {
  4485. c.ctx_ = ctx
  4486. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  4487. for {
  4488. x, err := c.Do()
  4489. if err != nil {
  4490. return err
  4491. }
  4492. if err := f(x); err != nil {
  4493. return err
  4494. }
  4495. if x.NextPageToken == "" {
  4496. return nil
  4497. }
  4498. c.PageToken(x.NextPageToken)
  4499. }
  4500. }
  4501. // method id "drive.comments.delete":
  4502. type CommentsDeleteCall struct {
  4503. s *Service
  4504. fileId string
  4505. commentId string
  4506. urlParams_ gensupport.URLParams
  4507. ctx_ context.Context
  4508. header_ http.Header
  4509. }
  4510. // Delete: Deletes a comment.
  4511. func (r *CommentsService) Delete(fileId string, commentId string) *CommentsDeleteCall {
  4512. c := &CommentsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4513. c.fileId = fileId
  4514. c.commentId = commentId
  4515. return c
  4516. }
  4517. // Fields allows partial responses to be retrieved. See
  4518. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4519. // for more information.
  4520. func (c *CommentsDeleteCall) Fields(s ...googleapi.Field) *CommentsDeleteCall {
  4521. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4522. return c
  4523. }
  4524. // Context sets the context to be used in this call's Do method. Any
  4525. // pending HTTP request will be aborted if the provided context is
  4526. // canceled.
  4527. func (c *CommentsDeleteCall) Context(ctx context.Context) *CommentsDeleteCall {
  4528. c.ctx_ = ctx
  4529. return c
  4530. }
  4531. // Header returns an http.Header that can be modified by the caller to
  4532. // add HTTP headers to the request.
  4533. func (c *CommentsDeleteCall) Header() http.Header {
  4534. if c.header_ == nil {
  4535. c.header_ = make(http.Header)
  4536. }
  4537. return c.header_
  4538. }
  4539. func (c *CommentsDeleteCall) doRequest(alt string) (*http.Response, error) {
  4540. reqHeaders := make(http.Header)
  4541. for k, v := range c.header_ {
  4542. reqHeaders[k] = v
  4543. }
  4544. reqHeaders.Set("User-Agent", c.s.userAgent())
  4545. var body io.Reader = nil
  4546. c.urlParams_.Set("alt", alt)
  4547. urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/comments/{commentId}")
  4548. urls += "?" + c.urlParams_.Encode()
  4549. req, _ := http.NewRequest("DELETE", urls, body)
  4550. req.Header = reqHeaders
  4551. googleapi.Expand(req.URL, map[string]string{
  4552. "fileId": c.fileId,
  4553. "commentId": c.commentId,
  4554. })
  4555. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4556. }
  4557. // Do executes the "drive.comments.delete" call.
  4558. func (c *CommentsDeleteCall) Do(opts ...googleapi.CallOption) error {
  4559. gensupport.SetOptions(c.urlParams_, opts...)
  4560. res, err := c.doRequest("json")
  4561. if err != nil {
  4562. return err
  4563. }
  4564. defer googleapi.CloseBody(res)
  4565. if err := googleapi.CheckResponse(res); err != nil {
  4566. return err
  4567. }
  4568. return nil
  4569. // {
  4570. // "description": "Deletes a comment.",
  4571. // "httpMethod": "DELETE",
  4572. // "id": "drive.comments.delete",
  4573. // "parameterOrder": [
  4574. // "fileId",
  4575. // "commentId"
  4576. // ],
  4577. // "parameters": {
  4578. // "commentId": {
  4579. // "description": "The ID of the comment.",
  4580. // "location": "path",
  4581. // "required": true,
  4582. // "type": "string"
  4583. // },
  4584. // "fileId": {
  4585. // "description": "The ID of the file.",
  4586. // "location": "path",
  4587. // "required": true,
  4588. // "type": "string"
  4589. // }
  4590. // },
  4591. // "path": "files/{fileId}/comments/{commentId}",
  4592. // "scopes": [
  4593. // "https://www.googleapis.com/auth/drive",
  4594. // "https://www.googleapis.com/auth/drive.file"
  4595. // ]
  4596. // }
  4597. }
  4598. // method id "drive.comments.get":
  4599. type CommentsGetCall struct {
  4600. s *Service
  4601. fileId string
  4602. commentId string
  4603. urlParams_ gensupport.URLParams
  4604. ifNoneMatch_ string
  4605. ctx_ context.Context
  4606. header_ http.Header
  4607. }
  4608. // Get: Gets a comment by ID.
  4609. func (r *CommentsService) Get(fileId string, commentId string) *CommentsGetCall {
  4610. c := &CommentsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4611. c.fileId = fileId
  4612. c.commentId = commentId
  4613. return c
  4614. }
  4615. // IncludeDeleted sets the optional parameter "includeDeleted": If set,
  4616. // this will succeed when retrieving a deleted comment, and will include
  4617. // any deleted replies.
  4618. func (c *CommentsGetCall) IncludeDeleted(includeDeleted bool) *CommentsGetCall {
  4619. c.urlParams_.Set("includeDeleted", fmt.Sprint(includeDeleted))
  4620. return c
  4621. }
  4622. // Fields allows partial responses to be retrieved. See
  4623. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4624. // for more information.
  4625. func (c *CommentsGetCall) Fields(s ...googleapi.Field) *CommentsGetCall {
  4626. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4627. return c
  4628. }
  4629. // IfNoneMatch sets the optional parameter which makes the operation
  4630. // fail if the object's ETag matches the given value. This is useful for
  4631. // getting updates only after the object has changed since the last
  4632. // request. Use googleapi.IsNotModified to check whether the response
  4633. // error from Do is the result of In-None-Match.
  4634. func (c *CommentsGetCall) IfNoneMatch(entityTag string) *CommentsGetCall {
  4635. c.ifNoneMatch_ = entityTag
  4636. return c
  4637. }
  4638. // Context sets the context to be used in this call's Do method. Any
  4639. // pending HTTP request will be aborted if the provided context is
  4640. // canceled.
  4641. func (c *CommentsGetCall) Context(ctx context.Context) *CommentsGetCall {
  4642. c.ctx_ = ctx
  4643. return c
  4644. }
  4645. // Header returns an http.Header that can be modified by the caller to
  4646. // add HTTP headers to the request.
  4647. func (c *CommentsGetCall) Header() http.Header {
  4648. if c.header_ == nil {
  4649. c.header_ = make(http.Header)
  4650. }
  4651. return c.header_
  4652. }
  4653. func (c *CommentsGetCall) doRequest(alt string) (*http.Response, error) {
  4654. reqHeaders := make(http.Header)
  4655. for k, v := range c.header_ {
  4656. reqHeaders[k] = v
  4657. }
  4658. reqHeaders.Set("User-Agent", c.s.userAgent())
  4659. if c.ifNoneMatch_ != "" {
  4660. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  4661. }
  4662. var body io.Reader = nil
  4663. c.urlParams_.Set("alt", alt)
  4664. urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/comments/{commentId}")
  4665. urls += "?" + c.urlParams_.Encode()
  4666. req, _ := http.NewRequest("GET", urls, body)
  4667. req.Header = reqHeaders
  4668. googleapi.Expand(req.URL, map[string]string{
  4669. "fileId": c.fileId,
  4670. "commentId": c.commentId,
  4671. })
  4672. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4673. }
  4674. // Do executes the "drive.comments.get" call.
  4675. // Exactly one of *Comment or error will be non-nil. Any non-2xx status
  4676. // code is an error. Response headers are in either
  4677. // *Comment.ServerResponse.Header or (if a response was returned at all)
  4678. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  4679. // check whether the returned error was because http.StatusNotModified
  4680. // was returned.
  4681. func (c *CommentsGetCall) Do(opts ...googleapi.CallOption) (*Comment, error) {
  4682. gensupport.SetOptions(c.urlParams_, opts...)
  4683. res, err := c.doRequest("json")
  4684. if res != nil && res.StatusCode == http.StatusNotModified {
  4685. if res.Body != nil {
  4686. res.Body.Close()
  4687. }
  4688. return nil, &googleapi.Error{
  4689. Code: res.StatusCode,
  4690. Header: res.Header,
  4691. }
  4692. }
  4693. if err != nil {
  4694. return nil, err
  4695. }
  4696. defer googleapi.CloseBody(res)
  4697. if err := googleapi.CheckResponse(res); err != nil {
  4698. return nil, err
  4699. }
  4700. ret := &Comment{
  4701. ServerResponse: googleapi.ServerResponse{
  4702. Header: res.Header,
  4703. HTTPStatusCode: res.StatusCode,
  4704. },
  4705. }
  4706. target := &ret
  4707. if err := gensupport.DecodeResponse(target, res); err != nil {
  4708. return nil, err
  4709. }
  4710. return ret, nil
  4711. // {
  4712. // "description": "Gets a comment by ID.",
  4713. // "httpMethod": "GET",
  4714. // "id": "drive.comments.get",
  4715. // "parameterOrder": [
  4716. // "fileId",
  4717. // "commentId"
  4718. // ],
  4719. // "parameters": {
  4720. // "commentId": {
  4721. // "description": "The ID of the comment.",
  4722. // "location": "path",
  4723. // "required": true,
  4724. // "type": "string"
  4725. // },
  4726. // "fileId": {
  4727. // "description": "The ID of the file.",
  4728. // "location": "path",
  4729. // "required": true,
  4730. // "type": "string"
  4731. // },
  4732. // "includeDeleted": {
  4733. // "default": "false",
  4734. // "description": "If set, this will succeed when retrieving a deleted comment, and will include any deleted replies.",
  4735. // "location": "query",
  4736. // "type": "boolean"
  4737. // }
  4738. // },
  4739. // "path": "files/{fileId}/comments/{commentId}",
  4740. // "response": {
  4741. // "$ref": "Comment"
  4742. // },
  4743. // "scopes": [
  4744. // "https://www.googleapis.com/auth/drive",
  4745. // "https://www.googleapis.com/auth/drive.file",
  4746. // "https://www.googleapis.com/auth/drive.readonly"
  4747. // ]
  4748. // }
  4749. }
  4750. // method id "drive.comments.insert":
  4751. type CommentsInsertCall struct {
  4752. s *Service
  4753. fileId string
  4754. comment *Comment
  4755. urlParams_ gensupport.URLParams
  4756. ctx_ context.Context
  4757. header_ http.Header
  4758. }
  4759. // Insert: Creates a new comment on the given file.
  4760. func (r *CommentsService) Insert(fileId string, comment *Comment) *CommentsInsertCall {
  4761. c := &CommentsInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4762. c.fileId = fileId
  4763. c.comment = comment
  4764. return c
  4765. }
  4766. // Fields allows partial responses to be retrieved. See
  4767. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4768. // for more information.
  4769. func (c *CommentsInsertCall) Fields(s ...googleapi.Field) *CommentsInsertCall {
  4770. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4771. return c
  4772. }
  4773. // Context sets the context to be used in this call's Do method. Any
  4774. // pending HTTP request will be aborted if the provided context is
  4775. // canceled.
  4776. func (c *CommentsInsertCall) Context(ctx context.Context) *CommentsInsertCall {
  4777. c.ctx_ = ctx
  4778. return c
  4779. }
  4780. // Header returns an http.Header that can be modified by the caller to
  4781. // add HTTP headers to the request.
  4782. func (c *CommentsInsertCall) Header() http.Header {
  4783. if c.header_ == nil {
  4784. c.header_ = make(http.Header)
  4785. }
  4786. return c.header_
  4787. }
  4788. func (c *CommentsInsertCall) doRequest(alt string) (*http.Response, error) {
  4789. reqHeaders := make(http.Header)
  4790. for k, v := range c.header_ {
  4791. reqHeaders[k] = v
  4792. }
  4793. reqHeaders.Set("User-Agent", c.s.userAgent())
  4794. var body io.Reader = nil
  4795. body, err := googleapi.WithoutDataWrapper.JSONReader(c.comment)
  4796. if err != nil {
  4797. return nil, err
  4798. }
  4799. reqHeaders.Set("Content-Type", "application/json")
  4800. c.urlParams_.Set("alt", alt)
  4801. urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/comments")
  4802. urls += "?" + c.urlParams_.Encode()
  4803. req, _ := http.NewRequest("POST", urls, body)
  4804. req.Header = reqHeaders
  4805. googleapi.Expand(req.URL, map[string]string{
  4806. "fileId": c.fileId,
  4807. })
  4808. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4809. }
  4810. // Do executes the "drive.comments.insert" call.
  4811. // Exactly one of *Comment or error will be non-nil. Any non-2xx status
  4812. // code is an error. Response headers are in either
  4813. // *Comment.ServerResponse.Header or (if a response was returned at all)
  4814. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  4815. // check whether the returned error was because http.StatusNotModified
  4816. // was returned.
  4817. func (c *CommentsInsertCall) Do(opts ...googleapi.CallOption) (*Comment, error) {
  4818. gensupport.SetOptions(c.urlParams_, opts...)
  4819. res, err := c.doRequest("json")
  4820. if res != nil && res.StatusCode == http.StatusNotModified {
  4821. if res.Body != nil {
  4822. res.Body.Close()
  4823. }
  4824. return nil, &googleapi.Error{
  4825. Code: res.StatusCode,
  4826. Header: res.Header,
  4827. }
  4828. }
  4829. if err != nil {
  4830. return nil, err
  4831. }
  4832. defer googleapi.CloseBody(res)
  4833. if err := googleapi.CheckResponse(res); err != nil {
  4834. return nil, err
  4835. }
  4836. ret := &Comment{
  4837. ServerResponse: googleapi.ServerResponse{
  4838. Header: res.Header,
  4839. HTTPStatusCode: res.StatusCode,
  4840. },
  4841. }
  4842. target := &ret
  4843. if err := gensupport.DecodeResponse(target, res); err != nil {
  4844. return nil, err
  4845. }
  4846. return ret, nil
  4847. // {
  4848. // "description": "Creates a new comment on the given file.",
  4849. // "httpMethod": "POST",
  4850. // "id": "drive.comments.insert",
  4851. // "parameterOrder": [
  4852. // "fileId"
  4853. // ],
  4854. // "parameters": {
  4855. // "fileId": {
  4856. // "description": "The ID of the file.",
  4857. // "location": "path",
  4858. // "required": true,
  4859. // "type": "string"
  4860. // }
  4861. // },
  4862. // "path": "files/{fileId}/comments",
  4863. // "request": {
  4864. // "$ref": "Comment"
  4865. // },
  4866. // "response": {
  4867. // "$ref": "Comment"
  4868. // },
  4869. // "scopes": [
  4870. // "https://www.googleapis.com/auth/drive",
  4871. // "https://www.googleapis.com/auth/drive.file"
  4872. // ]
  4873. // }
  4874. }
  4875. // method id "drive.comments.list":
  4876. type CommentsListCall struct {
  4877. s *Service
  4878. fileId string
  4879. urlParams_ gensupport.URLParams
  4880. ifNoneMatch_ string
  4881. ctx_ context.Context
  4882. header_ http.Header
  4883. }
  4884. // List: Lists a file's comments.
  4885. func (r *CommentsService) List(fileId string) *CommentsListCall {
  4886. c := &CommentsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  4887. c.fileId = fileId
  4888. return c
  4889. }
  4890. // IncludeDeleted sets the optional parameter "includeDeleted": If set,
  4891. // all comments and replies, including deleted comments and replies
  4892. // (with content stripped) will be returned.
  4893. func (c *CommentsListCall) IncludeDeleted(includeDeleted bool) *CommentsListCall {
  4894. c.urlParams_.Set("includeDeleted", fmt.Sprint(includeDeleted))
  4895. return c
  4896. }
  4897. // MaxResults sets the optional parameter "maxResults": The maximum
  4898. // number of discussions to include in the response, used for paging.
  4899. func (c *CommentsListCall) MaxResults(maxResults int64) *CommentsListCall {
  4900. c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
  4901. return c
  4902. }
  4903. // PageToken sets the optional parameter "pageToken": The continuation
  4904. // token, used to page through large result sets. To get the next page
  4905. // of results, set this parameter to the value of "nextPageToken" from
  4906. // the previous response.
  4907. func (c *CommentsListCall) PageToken(pageToken string) *CommentsListCall {
  4908. c.urlParams_.Set("pageToken", pageToken)
  4909. return c
  4910. }
  4911. // UpdatedMin sets the optional parameter "updatedMin": Only discussions
  4912. // that were updated after this timestamp will be returned. Formatted as
  4913. // an RFC 3339 timestamp.
  4914. func (c *CommentsListCall) UpdatedMin(updatedMin string) *CommentsListCall {
  4915. c.urlParams_.Set("updatedMin", updatedMin)
  4916. return c
  4917. }
  4918. // Fields allows partial responses to be retrieved. See
  4919. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  4920. // for more information.
  4921. func (c *CommentsListCall) Fields(s ...googleapi.Field) *CommentsListCall {
  4922. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  4923. return c
  4924. }
  4925. // IfNoneMatch sets the optional parameter which makes the operation
  4926. // fail if the object's ETag matches the given value. This is useful for
  4927. // getting updates only after the object has changed since the last
  4928. // request. Use googleapi.IsNotModified to check whether the response
  4929. // error from Do is the result of In-None-Match.
  4930. func (c *CommentsListCall) IfNoneMatch(entityTag string) *CommentsListCall {
  4931. c.ifNoneMatch_ = entityTag
  4932. return c
  4933. }
  4934. // Context sets the context to be used in this call's Do method. Any
  4935. // pending HTTP request will be aborted if the provided context is
  4936. // canceled.
  4937. func (c *CommentsListCall) Context(ctx context.Context) *CommentsListCall {
  4938. c.ctx_ = ctx
  4939. return c
  4940. }
  4941. // Header returns an http.Header that can be modified by the caller to
  4942. // add HTTP headers to the request.
  4943. func (c *CommentsListCall) Header() http.Header {
  4944. if c.header_ == nil {
  4945. c.header_ = make(http.Header)
  4946. }
  4947. return c.header_
  4948. }
  4949. func (c *CommentsListCall) doRequest(alt string) (*http.Response, error) {
  4950. reqHeaders := make(http.Header)
  4951. for k, v := range c.header_ {
  4952. reqHeaders[k] = v
  4953. }
  4954. reqHeaders.Set("User-Agent", c.s.userAgent())
  4955. if c.ifNoneMatch_ != "" {
  4956. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  4957. }
  4958. var body io.Reader = nil
  4959. c.urlParams_.Set("alt", alt)
  4960. urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/comments")
  4961. urls += "?" + c.urlParams_.Encode()
  4962. req, _ := http.NewRequest("GET", urls, body)
  4963. req.Header = reqHeaders
  4964. googleapi.Expand(req.URL, map[string]string{
  4965. "fileId": c.fileId,
  4966. })
  4967. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  4968. }
  4969. // Do executes the "drive.comments.list" call.
  4970. // Exactly one of *CommentList or error will be non-nil. Any non-2xx
  4971. // status code is an error. Response headers are in either
  4972. // *CommentList.ServerResponse.Header or (if a response was returned at
  4973. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  4974. // to check whether the returned error was because
  4975. // http.StatusNotModified was returned.
  4976. func (c *CommentsListCall) Do(opts ...googleapi.CallOption) (*CommentList, error) {
  4977. gensupport.SetOptions(c.urlParams_, opts...)
  4978. res, err := c.doRequest("json")
  4979. if res != nil && res.StatusCode == http.StatusNotModified {
  4980. if res.Body != nil {
  4981. res.Body.Close()
  4982. }
  4983. return nil, &googleapi.Error{
  4984. Code: res.StatusCode,
  4985. Header: res.Header,
  4986. }
  4987. }
  4988. if err != nil {
  4989. return nil, err
  4990. }
  4991. defer googleapi.CloseBody(res)
  4992. if err := googleapi.CheckResponse(res); err != nil {
  4993. return nil, err
  4994. }
  4995. ret := &CommentList{
  4996. ServerResponse: googleapi.ServerResponse{
  4997. Header: res.Header,
  4998. HTTPStatusCode: res.StatusCode,
  4999. },
  5000. }
  5001. target := &ret
  5002. if err := gensupport.DecodeResponse(target, res); err != nil {
  5003. return nil, err
  5004. }
  5005. return ret, nil
  5006. // {
  5007. // "description": "Lists a file's comments.",
  5008. // "httpMethod": "GET",
  5009. // "id": "drive.comments.list",
  5010. // "parameterOrder": [
  5011. // "fileId"
  5012. // ],
  5013. // "parameters": {
  5014. // "fileId": {
  5015. // "description": "The ID of the file.",
  5016. // "location": "path",
  5017. // "required": true,
  5018. // "type": "string"
  5019. // },
  5020. // "includeDeleted": {
  5021. // "default": "false",
  5022. // "description": "If set, all comments and replies, including deleted comments and replies (with content stripped) will be returned.",
  5023. // "location": "query",
  5024. // "type": "boolean"
  5025. // },
  5026. // "maxResults": {
  5027. // "default": "20",
  5028. // "description": "The maximum number of discussions to include in the response, used for paging.",
  5029. // "format": "int32",
  5030. // "location": "query",
  5031. // "maximum": "100",
  5032. // "minimum": "0",
  5033. // "type": "integer"
  5034. // },
  5035. // "pageToken": {
  5036. // "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.",
  5037. // "location": "query",
  5038. // "type": "string"
  5039. // },
  5040. // "updatedMin": {
  5041. // "description": "Only discussions that were updated after this timestamp will be returned. Formatted as an RFC 3339 timestamp.",
  5042. // "location": "query",
  5043. // "type": "string"
  5044. // }
  5045. // },
  5046. // "path": "files/{fileId}/comments",
  5047. // "response": {
  5048. // "$ref": "CommentList"
  5049. // },
  5050. // "scopes": [
  5051. // "https://www.googleapis.com/auth/drive",
  5052. // "https://www.googleapis.com/auth/drive.file",
  5053. // "https://www.googleapis.com/auth/drive.readonly"
  5054. // ]
  5055. // }
  5056. }
  5057. // Pages invokes f for each page of results.
  5058. // A non-nil error returned from f will halt the iteration.
  5059. // The provided context supersedes any context provided to the Context method.
  5060. func (c *CommentsListCall) Pages(ctx context.Context, f func(*CommentList) error) error {
  5061. c.ctx_ = ctx
  5062. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  5063. for {
  5064. x, err := c.Do()
  5065. if err != nil {
  5066. return err
  5067. }
  5068. if err := f(x); err != nil {
  5069. return err
  5070. }
  5071. if x.NextPageToken == "" {
  5072. return nil
  5073. }
  5074. c.PageToken(x.NextPageToken)
  5075. }
  5076. }
  5077. // method id "drive.comments.patch":
  5078. type CommentsPatchCall struct {
  5079. s *Service
  5080. fileId string
  5081. commentId string
  5082. comment *Comment
  5083. urlParams_ gensupport.URLParams
  5084. ctx_ context.Context
  5085. header_ http.Header
  5086. }
  5087. // Patch: Updates an existing comment. This method supports patch
  5088. // semantics.
  5089. func (r *CommentsService) Patch(fileId string, commentId string, comment *Comment) *CommentsPatchCall {
  5090. c := &CommentsPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5091. c.fileId = fileId
  5092. c.commentId = commentId
  5093. c.comment = comment
  5094. return c
  5095. }
  5096. // Fields allows partial responses to be retrieved. See
  5097. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5098. // for more information.
  5099. func (c *CommentsPatchCall) Fields(s ...googleapi.Field) *CommentsPatchCall {
  5100. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5101. return c
  5102. }
  5103. // Context sets the context to be used in this call's Do method. Any
  5104. // pending HTTP request will be aborted if the provided context is
  5105. // canceled.
  5106. func (c *CommentsPatchCall) Context(ctx context.Context) *CommentsPatchCall {
  5107. c.ctx_ = ctx
  5108. return c
  5109. }
  5110. // Header returns an http.Header that can be modified by the caller to
  5111. // add HTTP headers to the request.
  5112. func (c *CommentsPatchCall) Header() http.Header {
  5113. if c.header_ == nil {
  5114. c.header_ = make(http.Header)
  5115. }
  5116. return c.header_
  5117. }
  5118. func (c *CommentsPatchCall) doRequest(alt string) (*http.Response, error) {
  5119. reqHeaders := make(http.Header)
  5120. for k, v := range c.header_ {
  5121. reqHeaders[k] = v
  5122. }
  5123. reqHeaders.Set("User-Agent", c.s.userAgent())
  5124. var body io.Reader = nil
  5125. body, err := googleapi.WithoutDataWrapper.JSONReader(c.comment)
  5126. if err != nil {
  5127. return nil, err
  5128. }
  5129. reqHeaders.Set("Content-Type", "application/json")
  5130. c.urlParams_.Set("alt", alt)
  5131. urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/comments/{commentId}")
  5132. urls += "?" + c.urlParams_.Encode()
  5133. req, _ := http.NewRequest("PATCH", urls, body)
  5134. req.Header = reqHeaders
  5135. googleapi.Expand(req.URL, map[string]string{
  5136. "fileId": c.fileId,
  5137. "commentId": c.commentId,
  5138. })
  5139. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  5140. }
  5141. // Do executes the "drive.comments.patch" call.
  5142. // Exactly one of *Comment or error will be non-nil. Any non-2xx status
  5143. // code is an error. Response headers are in either
  5144. // *Comment.ServerResponse.Header or (if a response was returned at all)
  5145. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  5146. // check whether the returned error was because http.StatusNotModified
  5147. // was returned.
  5148. func (c *CommentsPatchCall) Do(opts ...googleapi.CallOption) (*Comment, error) {
  5149. gensupport.SetOptions(c.urlParams_, opts...)
  5150. res, err := c.doRequest("json")
  5151. if res != nil && res.StatusCode == http.StatusNotModified {
  5152. if res.Body != nil {
  5153. res.Body.Close()
  5154. }
  5155. return nil, &googleapi.Error{
  5156. Code: res.StatusCode,
  5157. Header: res.Header,
  5158. }
  5159. }
  5160. if err != nil {
  5161. return nil, err
  5162. }
  5163. defer googleapi.CloseBody(res)
  5164. if err := googleapi.CheckResponse(res); err != nil {
  5165. return nil, err
  5166. }
  5167. ret := &Comment{
  5168. ServerResponse: googleapi.ServerResponse{
  5169. Header: res.Header,
  5170. HTTPStatusCode: res.StatusCode,
  5171. },
  5172. }
  5173. target := &ret
  5174. if err := gensupport.DecodeResponse(target, res); err != nil {
  5175. return nil, err
  5176. }
  5177. return ret, nil
  5178. // {
  5179. // "description": "Updates an existing comment. This method supports patch semantics.",
  5180. // "httpMethod": "PATCH",
  5181. // "id": "drive.comments.patch",
  5182. // "parameterOrder": [
  5183. // "fileId",
  5184. // "commentId"
  5185. // ],
  5186. // "parameters": {
  5187. // "commentId": {
  5188. // "description": "The ID of the comment.",
  5189. // "location": "path",
  5190. // "required": true,
  5191. // "type": "string"
  5192. // },
  5193. // "fileId": {
  5194. // "description": "The ID of the file.",
  5195. // "location": "path",
  5196. // "required": true,
  5197. // "type": "string"
  5198. // }
  5199. // },
  5200. // "path": "files/{fileId}/comments/{commentId}",
  5201. // "request": {
  5202. // "$ref": "Comment"
  5203. // },
  5204. // "response": {
  5205. // "$ref": "Comment"
  5206. // },
  5207. // "scopes": [
  5208. // "https://www.googleapis.com/auth/drive",
  5209. // "https://www.googleapis.com/auth/drive.file"
  5210. // ]
  5211. // }
  5212. }
  5213. // method id "drive.comments.update":
  5214. type CommentsUpdateCall struct {
  5215. s *Service
  5216. fileId string
  5217. commentId string
  5218. comment *Comment
  5219. urlParams_ gensupport.URLParams
  5220. ctx_ context.Context
  5221. header_ http.Header
  5222. }
  5223. // Update: Updates an existing comment.
  5224. func (r *CommentsService) Update(fileId string, commentId string, comment *Comment) *CommentsUpdateCall {
  5225. c := &CommentsUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5226. c.fileId = fileId
  5227. c.commentId = commentId
  5228. c.comment = comment
  5229. return c
  5230. }
  5231. // Fields allows partial responses to be retrieved. See
  5232. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5233. // for more information.
  5234. func (c *CommentsUpdateCall) Fields(s ...googleapi.Field) *CommentsUpdateCall {
  5235. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5236. return c
  5237. }
  5238. // Context sets the context to be used in this call's Do method. Any
  5239. // pending HTTP request will be aborted if the provided context is
  5240. // canceled.
  5241. func (c *CommentsUpdateCall) Context(ctx context.Context) *CommentsUpdateCall {
  5242. c.ctx_ = ctx
  5243. return c
  5244. }
  5245. // Header returns an http.Header that can be modified by the caller to
  5246. // add HTTP headers to the request.
  5247. func (c *CommentsUpdateCall) Header() http.Header {
  5248. if c.header_ == nil {
  5249. c.header_ = make(http.Header)
  5250. }
  5251. return c.header_
  5252. }
  5253. func (c *CommentsUpdateCall) doRequest(alt string) (*http.Response, error) {
  5254. reqHeaders := make(http.Header)
  5255. for k, v := range c.header_ {
  5256. reqHeaders[k] = v
  5257. }
  5258. reqHeaders.Set("User-Agent", c.s.userAgent())
  5259. var body io.Reader = nil
  5260. body, err := googleapi.WithoutDataWrapper.JSONReader(c.comment)
  5261. if err != nil {
  5262. return nil, err
  5263. }
  5264. reqHeaders.Set("Content-Type", "application/json")
  5265. c.urlParams_.Set("alt", alt)
  5266. urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/comments/{commentId}")
  5267. urls += "?" + c.urlParams_.Encode()
  5268. req, _ := http.NewRequest("PUT", urls, body)
  5269. req.Header = reqHeaders
  5270. googleapi.Expand(req.URL, map[string]string{
  5271. "fileId": c.fileId,
  5272. "commentId": c.commentId,
  5273. })
  5274. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  5275. }
  5276. // Do executes the "drive.comments.update" call.
  5277. // Exactly one of *Comment or error will be non-nil. Any non-2xx status
  5278. // code is an error. Response headers are in either
  5279. // *Comment.ServerResponse.Header or (if a response was returned at all)
  5280. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  5281. // check whether the returned error was because http.StatusNotModified
  5282. // was returned.
  5283. func (c *CommentsUpdateCall) Do(opts ...googleapi.CallOption) (*Comment, error) {
  5284. gensupport.SetOptions(c.urlParams_, opts...)
  5285. res, err := c.doRequest("json")
  5286. if res != nil && res.StatusCode == http.StatusNotModified {
  5287. if res.Body != nil {
  5288. res.Body.Close()
  5289. }
  5290. return nil, &googleapi.Error{
  5291. Code: res.StatusCode,
  5292. Header: res.Header,
  5293. }
  5294. }
  5295. if err != nil {
  5296. return nil, err
  5297. }
  5298. defer googleapi.CloseBody(res)
  5299. if err := googleapi.CheckResponse(res); err != nil {
  5300. return nil, err
  5301. }
  5302. ret := &Comment{
  5303. ServerResponse: googleapi.ServerResponse{
  5304. Header: res.Header,
  5305. HTTPStatusCode: res.StatusCode,
  5306. },
  5307. }
  5308. target := &ret
  5309. if err := gensupport.DecodeResponse(target, res); err != nil {
  5310. return nil, err
  5311. }
  5312. return ret, nil
  5313. // {
  5314. // "description": "Updates an existing comment.",
  5315. // "httpMethod": "PUT",
  5316. // "id": "drive.comments.update",
  5317. // "parameterOrder": [
  5318. // "fileId",
  5319. // "commentId"
  5320. // ],
  5321. // "parameters": {
  5322. // "commentId": {
  5323. // "description": "The ID of the comment.",
  5324. // "location": "path",
  5325. // "required": true,
  5326. // "type": "string"
  5327. // },
  5328. // "fileId": {
  5329. // "description": "The ID of the file.",
  5330. // "location": "path",
  5331. // "required": true,
  5332. // "type": "string"
  5333. // }
  5334. // },
  5335. // "path": "files/{fileId}/comments/{commentId}",
  5336. // "request": {
  5337. // "$ref": "Comment"
  5338. // },
  5339. // "response": {
  5340. // "$ref": "Comment"
  5341. // },
  5342. // "scopes": [
  5343. // "https://www.googleapis.com/auth/drive",
  5344. // "https://www.googleapis.com/auth/drive.file"
  5345. // ]
  5346. // }
  5347. }
  5348. // method id "drive.files.copy":
  5349. type FilesCopyCall struct {
  5350. s *Service
  5351. fileId string
  5352. file *File
  5353. urlParams_ gensupport.URLParams
  5354. ctx_ context.Context
  5355. header_ http.Header
  5356. }
  5357. // Copy: Creates a copy of the specified file.
  5358. func (r *FilesService) Copy(fileId string, file *File) *FilesCopyCall {
  5359. c := &FilesCopyCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5360. c.fileId = fileId
  5361. c.file = file
  5362. return c
  5363. }
  5364. // Convert sets the optional parameter "convert": Whether to convert
  5365. // this file to the corresponding Google Docs format.
  5366. func (c *FilesCopyCall) Convert(convert bool) *FilesCopyCall {
  5367. c.urlParams_.Set("convert", fmt.Sprint(convert))
  5368. return c
  5369. }
  5370. // Ocr sets the optional parameter "ocr": Whether to attempt OCR on
  5371. // .jpg, .png, .gif, or .pdf uploads.
  5372. func (c *FilesCopyCall) Ocr(ocr bool) *FilesCopyCall {
  5373. c.urlParams_.Set("ocr", fmt.Sprint(ocr))
  5374. return c
  5375. }
  5376. // OcrLanguage sets the optional parameter "ocrLanguage": If ocr is
  5377. // true, hints at the language to use. Valid values are BCP 47 codes.
  5378. func (c *FilesCopyCall) OcrLanguage(ocrLanguage string) *FilesCopyCall {
  5379. c.urlParams_.Set("ocrLanguage", ocrLanguage)
  5380. return c
  5381. }
  5382. // Pinned sets the optional parameter "pinned": Whether to pin the head
  5383. // revision of the new copy. A file can have a maximum of 200 pinned
  5384. // revisions.
  5385. func (c *FilesCopyCall) Pinned(pinned bool) *FilesCopyCall {
  5386. c.urlParams_.Set("pinned", fmt.Sprint(pinned))
  5387. return c
  5388. }
  5389. // SupportsTeamDrives sets the optional parameter "supportsTeamDrives":
  5390. // Whether the requesting application supports Team Drives.
  5391. func (c *FilesCopyCall) SupportsTeamDrives(supportsTeamDrives bool) *FilesCopyCall {
  5392. c.urlParams_.Set("supportsTeamDrives", fmt.Sprint(supportsTeamDrives))
  5393. return c
  5394. }
  5395. // TimedTextLanguage sets the optional parameter "timedTextLanguage":
  5396. // The language of the timed text.
  5397. func (c *FilesCopyCall) TimedTextLanguage(timedTextLanguage string) *FilesCopyCall {
  5398. c.urlParams_.Set("timedTextLanguage", timedTextLanguage)
  5399. return c
  5400. }
  5401. // TimedTextTrackName sets the optional parameter "timedTextTrackName":
  5402. // The timed text track name.
  5403. func (c *FilesCopyCall) TimedTextTrackName(timedTextTrackName string) *FilesCopyCall {
  5404. c.urlParams_.Set("timedTextTrackName", timedTextTrackName)
  5405. return c
  5406. }
  5407. // Visibility sets the optional parameter "visibility": The visibility
  5408. // of the new file. This parameter is only relevant when the source is
  5409. // not a native Google Doc and convert=false.
  5410. //
  5411. // Possible values:
  5412. // "DEFAULT" (default) - The visibility of the new file is determined
  5413. // by the user's default visibility/sharing policies.
  5414. // "PRIVATE" - The new file will be visible to only the owner.
  5415. func (c *FilesCopyCall) Visibility(visibility string) *FilesCopyCall {
  5416. c.urlParams_.Set("visibility", visibility)
  5417. return c
  5418. }
  5419. // Fields allows partial responses to be retrieved. See
  5420. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5421. // for more information.
  5422. func (c *FilesCopyCall) Fields(s ...googleapi.Field) *FilesCopyCall {
  5423. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5424. return c
  5425. }
  5426. // Context sets the context to be used in this call's Do method. Any
  5427. // pending HTTP request will be aborted if the provided context is
  5428. // canceled.
  5429. func (c *FilesCopyCall) Context(ctx context.Context) *FilesCopyCall {
  5430. c.ctx_ = ctx
  5431. return c
  5432. }
  5433. // Header returns an http.Header that can be modified by the caller to
  5434. // add HTTP headers to the request.
  5435. func (c *FilesCopyCall) Header() http.Header {
  5436. if c.header_ == nil {
  5437. c.header_ = make(http.Header)
  5438. }
  5439. return c.header_
  5440. }
  5441. func (c *FilesCopyCall) doRequest(alt string) (*http.Response, error) {
  5442. reqHeaders := make(http.Header)
  5443. for k, v := range c.header_ {
  5444. reqHeaders[k] = v
  5445. }
  5446. reqHeaders.Set("User-Agent", c.s.userAgent())
  5447. var body io.Reader = nil
  5448. body, err := googleapi.WithoutDataWrapper.JSONReader(c.file)
  5449. if err != nil {
  5450. return nil, err
  5451. }
  5452. reqHeaders.Set("Content-Type", "application/json")
  5453. c.urlParams_.Set("alt", alt)
  5454. urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/copy")
  5455. urls += "?" + c.urlParams_.Encode()
  5456. req, _ := http.NewRequest("POST", urls, body)
  5457. req.Header = reqHeaders
  5458. googleapi.Expand(req.URL, map[string]string{
  5459. "fileId": c.fileId,
  5460. })
  5461. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  5462. }
  5463. // Do executes the "drive.files.copy" call.
  5464. // Exactly one of *File or error will be non-nil. Any non-2xx status
  5465. // code is an error. Response headers are in either
  5466. // *File.ServerResponse.Header or (if a response was returned at all) in
  5467. // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  5468. // whether the returned error was because http.StatusNotModified was
  5469. // returned.
  5470. func (c *FilesCopyCall) Do(opts ...googleapi.CallOption) (*File, error) {
  5471. gensupport.SetOptions(c.urlParams_, opts...)
  5472. res, err := c.doRequest("json")
  5473. if res != nil && res.StatusCode == http.StatusNotModified {
  5474. if res.Body != nil {
  5475. res.Body.Close()
  5476. }
  5477. return nil, &googleapi.Error{
  5478. Code: res.StatusCode,
  5479. Header: res.Header,
  5480. }
  5481. }
  5482. if err != nil {
  5483. return nil, err
  5484. }
  5485. defer googleapi.CloseBody(res)
  5486. if err := googleapi.CheckResponse(res); err != nil {
  5487. return nil, err
  5488. }
  5489. ret := &File{
  5490. ServerResponse: googleapi.ServerResponse{
  5491. Header: res.Header,
  5492. HTTPStatusCode: res.StatusCode,
  5493. },
  5494. }
  5495. target := &ret
  5496. if err := gensupport.DecodeResponse(target, res); err != nil {
  5497. return nil, err
  5498. }
  5499. return ret, nil
  5500. // {
  5501. // "description": "Creates a copy of the specified file.",
  5502. // "httpMethod": "POST",
  5503. // "id": "drive.files.copy",
  5504. // "parameterOrder": [
  5505. // "fileId"
  5506. // ],
  5507. // "parameters": {
  5508. // "convert": {
  5509. // "default": "false",
  5510. // "description": "Whether to convert this file to the corresponding Google Docs format.",
  5511. // "location": "query",
  5512. // "type": "boolean"
  5513. // },
  5514. // "fileId": {
  5515. // "description": "The ID of the file to copy.",
  5516. // "location": "path",
  5517. // "required": true,
  5518. // "type": "string"
  5519. // },
  5520. // "ocr": {
  5521. // "default": "false",
  5522. // "description": "Whether to attempt OCR on .jpg, .png, .gif, or .pdf uploads.",
  5523. // "location": "query",
  5524. // "type": "boolean"
  5525. // },
  5526. // "ocrLanguage": {
  5527. // "description": "If ocr is true, hints at the language to use. Valid values are BCP 47 codes.",
  5528. // "location": "query",
  5529. // "type": "string"
  5530. // },
  5531. // "pinned": {
  5532. // "default": "false",
  5533. // "description": "Whether to pin the head revision of the new copy. A file can have a maximum of 200 pinned revisions.",
  5534. // "location": "query",
  5535. // "type": "boolean"
  5536. // },
  5537. // "supportsTeamDrives": {
  5538. // "default": "false",
  5539. // "description": "Whether the requesting application supports Team Drives.",
  5540. // "location": "query",
  5541. // "type": "boolean"
  5542. // },
  5543. // "timedTextLanguage": {
  5544. // "description": "The language of the timed text.",
  5545. // "location": "query",
  5546. // "type": "string"
  5547. // },
  5548. // "timedTextTrackName": {
  5549. // "description": "The timed text track name.",
  5550. // "location": "query",
  5551. // "type": "string"
  5552. // },
  5553. // "visibility": {
  5554. // "default": "DEFAULT",
  5555. // "description": "The visibility of the new file. This parameter is only relevant when the source is not a native Google Doc and convert=false.",
  5556. // "enum": [
  5557. // "DEFAULT",
  5558. // "PRIVATE"
  5559. // ],
  5560. // "enumDescriptions": [
  5561. // "The visibility of the new file is determined by the user's default visibility/sharing policies.",
  5562. // "The new file will be visible to only the owner."
  5563. // ],
  5564. // "location": "query",
  5565. // "type": "string"
  5566. // }
  5567. // },
  5568. // "path": "files/{fileId}/copy",
  5569. // "request": {
  5570. // "$ref": "File"
  5571. // },
  5572. // "response": {
  5573. // "$ref": "File"
  5574. // },
  5575. // "scopes": [
  5576. // "https://www.googleapis.com/auth/drive",
  5577. // "https://www.googleapis.com/auth/drive.appdata",
  5578. // "https://www.googleapis.com/auth/drive.apps.readonly",
  5579. // "https://www.googleapis.com/auth/drive.file",
  5580. // "https://www.googleapis.com/auth/drive.photos.readonly"
  5581. // ]
  5582. // }
  5583. }
  5584. // method id "drive.files.delete":
  5585. type FilesDeleteCall struct {
  5586. s *Service
  5587. fileId string
  5588. urlParams_ gensupport.URLParams
  5589. ctx_ context.Context
  5590. header_ http.Header
  5591. }
  5592. // Delete: Permanently deletes a file by ID. Skips the trash. The
  5593. // currently authenticated user must own the file or be an organizer on
  5594. // the parent for Team Drive files.
  5595. func (r *FilesService) Delete(fileId string) *FilesDeleteCall {
  5596. c := &FilesDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5597. c.fileId = fileId
  5598. return c
  5599. }
  5600. // SupportsTeamDrives sets the optional parameter "supportsTeamDrives":
  5601. // Whether the requesting application supports Team Drives.
  5602. func (c *FilesDeleteCall) SupportsTeamDrives(supportsTeamDrives bool) *FilesDeleteCall {
  5603. c.urlParams_.Set("supportsTeamDrives", fmt.Sprint(supportsTeamDrives))
  5604. return c
  5605. }
  5606. // Fields allows partial responses to be retrieved. See
  5607. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5608. // for more information.
  5609. func (c *FilesDeleteCall) Fields(s ...googleapi.Field) *FilesDeleteCall {
  5610. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5611. return c
  5612. }
  5613. // Context sets the context to be used in this call's Do method. Any
  5614. // pending HTTP request will be aborted if the provided context is
  5615. // canceled.
  5616. func (c *FilesDeleteCall) Context(ctx context.Context) *FilesDeleteCall {
  5617. c.ctx_ = ctx
  5618. return c
  5619. }
  5620. // Header returns an http.Header that can be modified by the caller to
  5621. // add HTTP headers to the request.
  5622. func (c *FilesDeleteCall) Header() http.Header {
  5623. if c.header_ == nil {
  5624. c.header_ = make(http.Header)
  5625. }
  5626. return c.header_
  5627. }
  5628. func (c *FilesDeleteCall) doRequest(alt string) (*http.Response, error) {
  5629. reqHeaders := make(http.Header)
  5630. for k, v := range c.header_ {
  5631. reqHeaders[k] = v
  5632. }
  5633. reqHeaders.Set("User-Agent", c.s.userAgent())
  5634. var body io.Reader = nil
  5635. c.urlParams_.Set("alt", alt)
  5636. urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}")
  5637. urls += "?" + c.urlParams_.Encode()
  5638. req, _ := http.NewRequest("DELETE", urls, body)
  5639. req.Header = reqHeaders
  5640. googleapi.Expand(req.URL, map[string]string{
  5641. "fileId": c.fileId,
  5642. })
  5643. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  5644. }
  5645. // Do executes the "drive.files.delete" call.
  5646. func (c *FilesDeleteCall) Do(opts ...googleapi.CallOption) error {
  5647. gensupport.SetOptions(c.urlParams_, opts...)
  5648. res, err := c.doRequest("json")
  5649. if err != nil {
  5650. return err
  5651. }
  5652. defer googleapi.CloseBody(res)
  5653. if err := googleapi.CheckResponse(res); err != nil {
  5654. return err
  5655. }
  5656. return nil
  5657. // {
  5658. // "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.",
  5659. // "httpMethod": "DELETE",
  5660. // "id": "drive.files.delete",
  5661. // "parameterOrder": [
  5662. // "fileId"
  5663. // ],
  5664. // "parameters": {
  5665. // "fileId": {
  5666. // "description": "The ID of the file to delete.",
  5667. // "location": "path",
  5668. // "required": true,
  5669. // "type": "string"
  5670. // },
  5671. // "supportsTeamDrives": {
  5672. // "default": "false",
  5673. // "description": "Whether the requesting application supports Team Drives.",
  5674. // "location": "query",
  5675. // "type": "boolean"
  5676. // }
  5677. // },
  5678. // "path": "files/{fileId}",
  5679. // "scopes": [
  5680. // "https://www.googleapis.com/auth/drive",
  5681. // "https://www.googleapis.com/auth/drive.appdata",
  5682. // "https://www.googleapis.com/auth/drive.file"
  5683. // ]
  5684. // }
  5685. }
  5686. // method id "drive.files.emptyTrash":
  5687. type FilesEmptyTrashCall struct {
  5688. s *Service
  5689. urlParams_ gensupport.URLParams
  5690. ctx_ context.Context
  5691. header_ http.Header
  5692. }
  5693. // EmptyTrash: Permanently deletes all of the user's trashed files.
  5694. func (r *FilesService) EmptyTrash() *FilesEmptyTrashCall {
  5695. c := &FilesEmptyTrashCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5696. return c
  5697. }
  5698. // Fields allows partial responses to be retrieved. See
  5699. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5700. // for more information.
  5701. func (c *FilesEmptyTrashCall) Fields(s ...googleapi.Field) *FilesEmptyTrashCall {
  5702. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5703. return c
  5704. }
  5705. // Context sets the context to be used in this call's Do method. Any
  5706. // pending HTTP request will be aborted if the provided context is
  5707. // canceled.
  5708. func (c *FilesEmptyTrashCall) Context(ctx context.Context) *FilesEmptyTrashCall {
  5709. c.ctx_ = ctx
  5710. return c
  5711. }
  5712. // Header returns an http.Header that can be modified by the caller to
  5713. // add HTTP headers to the request.
  5714. func (c *FilesEmptyTrashCall) Header() http.Header {
  5715. if c.header_ == nil {
  5716. c.header_ = make(http.Header)
  5717. }
  5718. return c.header_
  5719. }
  5720. func (c *FilesEmptyTrashCall) doRequest(alt string) (*http.Response, error) {
  5721. reqHeaders := make(http.Header)
  5722. for k, v := range c.header_ {
  5723. reqHeaders[k] = v
  5724. }
  5725. reqHeaders.Set("User-Agent", c.s.userAgent())
  5726. var body io.Reader = nil
  5727. c.urlParams_.Set("alt", alt)
  5728. urls := googleapi.ResolveRelative(c.s.BasePath, "files/trash")
  5729. urls += "?" + c.urlParams_.Encode()
  5730. req, _ := http.NewRequest("DELETE", urls, body)
  5731. req.Header = reqHeaders
  5732. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  5733. }
  5734. // Do executes the "drive.files.emptyTrash" call.
  5735. func (c *FilesEmptyTrashCall) Do(opts ...googleapi.CallOption) error {
  5736. gensupport.SetOptions(c.urlParams_, opts...)
  5737. res, err := c.doRequest("json")
  5738. if err != nil {
  5739. return err
  5740. }
  5741. defer googleapi.CloseBody(res)
  5742. if err := googleapi.CheckResponse(res); err != nil {
  5743. return err
  5744. }
  5745. return nil
  5746. // {
  5747. // "description": "Permanently deletes all of the user's trashed files.",
  5748. // "httpMethod": "DELETE",
  5749. // "id": "drive.files.emptyTrash",
  5750. // "path": "files/trash",
  5751. // "scopes": [
  5752. // "https://www.googleapis.com/auth/drive"
  5753. // ]
  5754. // }
  5755. }
  5756. // method id "drive.files.export":
  5757. type FilesExportCall struct {
  5758. s *Service
  5759. fileId string
  5760. urlParams_ gensupport.URLParams
  5761. ifNoneMatch_ string
  5762. ctx_ context.Context
  5763. header_ http.Header
  5764. }
  5765. // Export: Exports a Google Doc to the requested MIME type and returns
  5766. // the exported content. Please note that the exported content is
  5767. // limited to 10MB.
  5768. func (r *FilesService) Export(fileId string, mimeType string) *FilesExportCall {
  5769. c := &FilesExportCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5770. c.fileId = fileId
  5771. c.urlParams_.Set("mimeType", mimeType)
  5772. return c
  5773. }
  5774. // Fields allows partial responses to be retrieved. See
  5775. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5776. // for more information.
  5777. func (c *FilesExportCall) Fields(s ...googleapi.Field) *FilesExportCall {
  5778. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5779. return c
  5780. }
  5781. // IfNoneMatch sets the optional parameter which makes the operation
  5782. // fail if the object's ETag matches the given value. This is useful for
  5783. // getting updates only after the object has changed since the last
  5784. // request. Use googleapi.IsNotModified to check whether the response
  5785. // error from Do is the result of In-None-Match.
  5786. func (c *FilesExportCall) IfNoneMatch(entityTag string) *FilesExportCall {
  5787. c.ifNoneMatch_ = entityTag
  5788. return c
  5789. }
  5790. // Context sets the context to be used in this call's Do and Download
  5791. // methods. Any pending HTTP request will be aborted if the provided
  5792. // context is canceled.
  5793. func (c *FilesExportCall) Context(ctx context.Context) *FilesExportCall {
  5794. c.ctx_ = ctx
  5795. return c
  5796. }
  5797. // Header returns an http.Header that can be modified by the caller to
  5798. // add HTTP headers to the request.
  5799. func (c *FilesExportCall) Header() http.Header {
  5800. if c.header_ == nil {
  5801. c.header_ = make(http.Header)
  5802. }
  5803. return c.header_
  5804. }
  5805. func (c *FilesExportCall) doRequest(alt string) (*http.Response, error) {
  5806. reqHeaders := make(http.Header)
  5807. for k, v := range c.header_ {
  5808. reqHeaders[k] = v
  5809. }
  5810. reqHeaders.Set("User-Agent", c.s.userAgent())
  5811. if c.ifNoneMatch_ != "" {
  5812. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  5813. }
  5814. var body io.Reader = nil
  5815. c.urlParams_.Set("alt", alt)
  5816. urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/export")
  5817. urls += "?" + c.urlParams_.Encode()
  5818. req, _ := http.NewRequest("GET", urls, body)
  5819. req.Header = reqHeaders
  5820. googleapi.Expand(req.URL, map[string]string{
  5821. "fileId": c.fileId,
  5822. })
  5823. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  5824. }
  5825. // Download fetches the API endpoint's "media" value, instead of the normal
  5826. // API response value. If the returned error is nil, the Response is guaranteed to
  5827. // have a 2xx status code. Callers must close the Response.Body as usual.
  5828. func (c *FilesExportCall) Download(opts ...googleapi.CallOption) (*http.Response, error) {
  5829. gensupport.SetOptions(c.urlParams_, opts...)
  5830. res, err := c.doRequest("media")
  5831. if err != nil {
  5832. return nil, err
  5833. }
  5834. if err := googleapi.CheckMediaResponse(res); err != nil {
  5835. res.Body.Close()
  5836. return nil, err
  5837. }
  5838. return res, nil
  5839. }
  5840. // Do executes the "drive.files.export" call.
  5841. func (c *FilesExportCall) Do(opts ...googleapi.CallOption) error {
  5842. gensupport.SetOptions(c.urlParams_, opts...)
  5843. res, err := c.doRequest("json")
  5844. if err != nil {
  5845. return err
  5846. }
  5847. defer googleapi.CloseBody(res)
  5848. if err := googleapi.CheckResponse(res); err != nil {
  5849. return err
  5850. }
  5851. return nil
  5852. // {
  5853. // "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.",
  5854. // "httpMethod": "GET",
  5855. // "id": "drive.files.export",
  5856. // "parameterOrder": [
  5857. // "fileId",
  5858. // "mimeType"
  5859. // ],
  5860. // "parameters": {
  5861. // "fileId": {
  5862. // "description": "The ID of the file.",
  5863. // "location": "path",
  5864. // "required": true,
  5865. // "type": "string"
  5866. // },
  5867. // "mimeType": {
  5868. // "description": "The MIME type of the format requested for this export.",
  5869. // "location": "query",
  5870. // "required": true,
  5871. // "type": "string"
  5872. // }
  5873. // },
  5874. // "path": "files/{fileId}/export",
  5875. // "scopes": [
  5876. // "https://www.googleapis.com/auth/drive",
  5877. // "https://www.googleapis.com/auth/drive.file",
  5878. // "https://www.googleapis.com/auth/drive.readonly"
  5879. // ],
  5880. // "supportsMediaDownload": true
  5881. // }
  5882. }
  5883. // method id "drive.files.generateIds":
  5884. type FilesGenerateIdsCall struct {
  5885. s *Service
  5886. urlParams_ gensupport.URLParams
  5887. ifNoneMatch_ string
  5888. ctx_ context.Context
  5889. header_ http.Header
  5890. }
  5891. // GenerateIds: Generates a set of file IDs which can be provided in
  5892. // insert requests.
  5893. func (r *FilesService) GenerateIds() *FilesGenerateIdsCall {
  5894. c := &FilesGenerateIdsCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  5895. return c
  5896. }
  5897. // MaxResults sets the optional parameter "maxResults": Maximum number
  5898. // of IDs to return.
  5899. func (c *FilesGenerateIdsCall) MaxResults(maxResults int64) *FilesGenerateIdsCall {
  5900. c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
  5901. return c
  5902. }
  5903. // Space sets the optional parameter "space": The space in which the IDs
  5904. // can be used to create new files. Supported values are 'drive' and
  5905. // 'appDataFolder'.
  5906. func (c *FilesGenerateIdsCall) Space(space string) *FilesGenerateIdsCall {
  5907. c.urlParams_.Set("space", space)
  5908. return c
  5909. }
  5910. // Fields allows partial responses to be retrieved. See
  5911. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  5912. // for more information.
  5913. func (c *FilesGenerateIdsCall) Fields(s ...googleapi.Field) *FilesGenerateIdsCall {
  5914. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  5915. return c
  5916. }
  5917. // IfNoneMatch sets the optional parameter which makes the operation
  5918. // fail if the object's ETag matches the given value. This is useful for
  5919. // getting updates only after the object has changed since the last
  5920. // request. Use googleapi.IsNotModified to check whether the response
  5921. // error from Do is the result of In-None-Match.
  5922. func (c *FilesGenerateIdsCall) IfNoneMatch(entityTag string) *FilesGenerateIdsCall {
  5923. c.ifNoneMatch_ = entityTag
  5924. return c
  5925. }
  5926. // Context sets the context to be used in this call's Do method. Any
  5927. // pending HTTP request will be aborted if the provided context is
  5928. // canceled.
  5929. func (c *FilesGenerateIdsCall) Context(ctx context.Context) *FilesGenerateIdsCall {
  5930. c.ctx_ = ctx
  5931. return c
  5932. }
  5933. // Header returns an http.Header that can be modified by the caller to
  5934. // add HTTP headers to the request.
  5935. func (c *FilesGenerateIdsCall) Header() http.Header {
  5936. if c.header_ == nil {
  5937. c.header_ = make(http.Header)
  5938. }
  5939. return c.header_
  5940. }
  5941. func (c *FilesGenerateIdsCall) doRequest(alt string) (*http.Response, error) {
  5942. reqHeaders := make(http.Header)
  5943. for k, v := range c.header_ {
  5944. reqHeaders[k] = v
  5945. }
  5946. reqHeaders.Set("User-Agent", c.s.userAgent())
  5947. if c.ifNoneMatch_ != "" {
  5948. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  5949. }
  5950. var body io.Reader = nil
  5951. c.urlParams_.Set("alt", alt)
  5952. urls := googleapi.ResolveRelative(c.s.BasePath, "files/generateIds")
  5953. urls += "?" + c.urlParams_.Encode()
  5954. req, _ := http.NewRequest("GET", urls, body)
  5955. req.Header = reqHeaders
  5956. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  5957. }
  5958. // Do executes the "drive.files.generateIds" call.
  5959. // Exactly one of *GeneratedIds or error will be non-nil. Any non-2xx
  5960. // status code is an error. Response headers are in either
  5961. // *GeneratedIds.ServerResponse.Header or (if a response was returned at
  5962. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  5963. // to check whether the returned error was because
  5964. // http.StatusNotModified was returned.
  5965. func (c *FilesGenerateIdsCall) Do(opts ...googleapi.CallOption) (*GeneratedIds, error) {
  5966. gensupport.SetOptions(c.urlParams_, opts...)
  5967. res, err := c.doRequest("json")
  5968. if res != nil && res.StatusCode == http.StatusNotModified {
  5969. if res.Body != nil {
  5970. res.Body.Close()
  5971. }
  5972. return nil, &googleapi.Error{
  5973. Code: res.StatusCode,
  5974. Header: res.Header,
  5975. }
  5976. }
  5977. if err != nil {
  5978. return nil, err
  5979. }
  5980. defer googleapi.CloseBody(res)
  5981. if err := googleapi.CheckResponse(res); err != nil {
  5982. return nil, err
  5983. }
  5984. ret := &GeneratedIds{
  5985. ServerResponse: googleapi.ServerResponse{
  5986. Header: res.Header,
  5987. HTTPStatusCode: res.StatusCode,
  5988. },
  5989. }
  5990. target := &ret
  5991. if err := gensupport.DecodeResponse(target, res); err != nil {
  5992. return nil, err
  5993. }
  5994. return ret, nil
  5995. // {
  5996. // "description": "Generates a set of file IDs which can be provided in insert requests.",
  5997. // "httpMethod": "GET",
  5998. // "id": "drive.files.generateIds",
  5999. // "parameters": {
  6000. // "maxResults": {
  6001. // "default": "10",
  6002. // "description": "Maximum number of IDs to return.",
  6003. // "format": "int32",
  6004. // "location": "query",
  6005. // "maximum": "1000",
  6006. // "minimum": "1",
  6007. // "type": "integer"
  6008. // },
  6009. // "space": {
  6010. // "default": "drive",
  6011. // "description": "The space in which the IDs can be used to create new files. Supported values are 'drive' and 'appDataFolder'.",
  6012. // "location": "query",
  6013. // "type": "string"
  6014. // }
  6015. // },
  6016. // "path": "files/generateIds",
  6017. // "response": {
  6018. // "$ref": "GeneratedIds"
  6019. // },
  6020. // "scopes": [
  6021. // "https://www.googleapis.com/auth/drive",
  6022. // "https://www.googleapis.com/auth/drive.appdata",
  6023. // "https://www.googleapis.com/auth/drive.file"
  6024. // ]
  6025. // }
  6026. }
  6027. // method id "drive.files.get":
  6028. type FilesGetCall struct {
  6029. s *Service
  6030. fileId string
  6031. urlParams_ gensupport.URLParams
  6032. ifNoneMatch_ string
  6033. ctx_ context.Context
  6034. header_ http.Header
  6035. }
  6036. // Get: Gets a file's metadata by ID.
  6037. func (r *FilesService) Get(fileId string) *FilesGetCall {
  6038. c := &FilesGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  6039. c.fileId = fileId
  6040. return c
  6041. }
  6042. // AcknowledgeAbuse sets the optional parameter "acknowledgeAbuse":
  6043. // Whether the user is acknowledging the risk of downloading known
  6044. // malware or other abusive files.
  6045. func (c *FilesGetCall) AcknowledgeAbuse(acknowledgeAbuse bool) *FilesGetCall {
  6046. c.urlParams_.Set("acknowledgeAbuse", fmt.Sprint(acknowledgeAbuse))
  6047. return c
  6048. }
  6049. // Projection sets the optional parameter "projection": This parameter
  6050. // is deprecated and has no function.
  6051. //
  6052. // Possible values:
  6053. // "BASIC" - Deprecated
  6054. // "FULL" - Deprecated
  6055. func (c *FilesGetCall) Projection(projection string) *FilesGetCall {
  6056. c.urlParams_.Set("projection", projection)
  6057. return c
  6058. }
  6059. // RevisionId sets the optional parameter "revisionId": Specifies the
  6060. // Revision ID that should be downloaded. Ignored unless alt=media is
  6061. // specified.
  6062. func (c *FilesGetCall) RevisionId(revisionId string) *FilesGetCall {
  6063. c.urlParams_.Set("revisionId", revisionId)
  6064. return c
  6065. }
  6066. // SupportsTeamDrives sets the optional parameter "supportsTeamDrives":
  6067. // Whether the requesting application supports Team Drives.
  6068. func (c *FilesGetCall) SupportsTeamDrives(supportsTeamDrives bool) *FilesGetCall {
  6069. c.urlParams_.Set("supportsTeamDrives", fmt.Sprint(supportsTeamDrives))
  6070. return c
  6071. }
  6072. // UpdateViewedDate sets the optional parameter "updateViewedDate":
  6073. // Deprecated: Use files.update with modifiedDateBehavior=noChange,
  6074. // updateViewedDate=true and an empty request body.
  6075. func (c *FilesGetCall) UpdateViewedDate(updateViewedDate bool) *FilesGetCall {
  6076. c.urlParams_.Set("updateViewedDate", fmt.Sprint(updateViewedDate))
  6077. return c
  6078. }
  6079. // Fields allows partial responses to be retrieved. See
  6080. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  6081. // for more information.
  6082. func (c *FilesGetCall) Fields(s ...googleapi.Field) *FilesGetCall {
  6083. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  6084. return c
  6085. }
  6086. // IfNoneMatch sets the optional parameter which makes the operation
  6087. // fail if the object's ETag matches the given value. This is useful for
  6088. // getting updates only after the object has changed since the last
  6089. // request. Use googleapi.IsNotModified to check whether the response
  6090. // error from Do is the result of In-None-Match.
  6091. func (c *FilesGetCall) IfNoneMatch(entityTag string) *FilesGetCall {
  6092. c.ifNoneMatch_ = entityTag
  6093. return c
  6094. }
  6095. // Context sets the context to be used in this call's Do and Download
  6096. // methods. Any pending HTTP request will be aborted if the provided
  6097. // context is canceled.
  6098. func (c *FilesGetCall) Context(ctx context.Context) *FilesGetCall {
  6099. c.ctx_ = ctx
  6100. return c
  6101. }
  6102. // Header returns an http.Header that can be modified by the caller to
  6103. // add HTTP headers to the request.
  6104. func (c *FilesGetCall) Header() http.Header {
  6105. if c.header_ == nil {
  6106. c.header_ = make(http.Header)
  6107. }
  6108. return c.header_
  6109. }
  6110. func (c *FilesGetCall) doRequest(alt string) (*http.Response, error) {
  6111. reqHeaders := make(http.Header)
  6112. for k, v := range c.header_ {
  6113. reqHeaders[k] = v
  6114. }
  6115. reqHeaders.Set("User-Agent", c.s.userAgent())
  6116. if c.ifNoneMatch_ != "" {
  6117. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  6118. }
  6119. var body io.Reader = nil
  6120. c.urlParams_.Set("alt", alt)
  6121. urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}")
  6122. urls += "?" + c.urlParams_.Encode()
  6123. req, _ := http.NewRequest("GET", urls, body)
  6124. req.Header = reqHeaders
  6125. googleapi.Expand(req.URL, map[string]string{
  6126. "fileId": c.fileId,
  6127. })
  6128. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  6129. }
  6130. // Download fetches the API endpoint's "media" value, instead of the normal
  6131. // API response value. If the returned error is nil, the Response is guaranteed to
  6132. // have a 2xx status code. Callers must close the Response.Body as usual.
  6133. func (c *FilesGetCall) Download(opts ...googleapi.CallOption) (*http.Response, error) {
  6134. gensupport.SetOptions(c.urlParams_, opts...)
  6135. res, err := c.doRequest("media")
  6136. if err != nil {
  6137. return nil, err
  6138. }
  6139. if err := googleapi.CheckMediaResponse(res); err != nil {
  6140. res.Body.Close()
  6141. return nil, err
  6142. }
  6143. return res, nil
  6144. }
  6145. // Do executes the "drive.files.get" call.
  6146. // Exactly one of *File or error will be non-nil. Any non-2xx status
  6147. // code is an error. Response headers are in either
  6148. // *File.ServerResponse.Header or (if a response was returned at all) in
  6149. // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  6150. // whether the returned error was because http.StatusNotModified was
  6151. // returned.
  6152. func (c *FilesGetCall) Do(opts ...googleapi.CallOption) (*File, error) {
  6153. gensupport.SetOptions(c.urlParams_, opts...)
  6154. res, err := c.doRequest("json")
  6155. if res != nil && res.StatusCode == http.StatusNotModified {
  6156. if res.Body != nil {
  6157. res.Body.Close()
  6158. }
  6159. return nil, &googleapi.Error{
  6160. Code: res.StatusCode,
  6161. Header: res.Header,
  6162. }
  6163. }
  6164. if err != nil {
  6165. return nil, err
  6166. }
  6167. defer googleapi.CloseBody(res)
  6168. if err := googleapi.CheckResponse(res); err != nil {
  6169. return nil, err
  6170. }
  6171. ret := &File{
  6172. ServerResponse: googleapi.ServerResponse{
  6173. Header: res.Header,
  6174. HTTPStatusCode: res.StatusCode,
  6175. },
  6176. }
  6177. target := &ret
  6178. if err := gensupport.DecodeResponse(target, res); err != nil {
  6179. return nil, err
  6180. }
  6181. return ret, nil
  6182. // {
  6183. // "description": "Gets a file's metadata by ID.",
  6184. // "httpMethod": "GET",
  6185. // "id": "drive.files.get",
  6186. // "parameterOrder": [
  6187. // "fileId"
  6188. // ],
  6189. // "parameters": {
  6190. // "acknowledgeAbuse": {
  6191. // "default": "false",
  6192. // "description": "Whether the user is acknowledging the risk of downloading known malware or other abusive files.",
  6193. // "location": "query",
  6194. // "type": "boolean"
  6195. // },
  6196. // "fileId": {
  6197. // "description": "The ID for the file in question.",
  6198. // "location": "path",
  6199. // "required": true,
  6200. // "type": "string"
  6201. // },
  6202. // "projection": {
  6203. // "description": "This parameter is deprecated and has no function.",
  6204. // "enum": [
  6205. // "BASIC",
  6206. // "FULL"
  6207. // ],
  6208. // "enumDescriptions": [
  6209. // "Deprecated",
  6210. // "Deprecated"
  6211. // ],
  6212. // "location": "query",
  6213. // "type": "string"
  6214. // },
  6215. // "revisionId": {
  6216. // "description": "Specifies the Revision ID that should be downloaded. Ignored unless alt=media is specified.",
  6217. // "location": "query",
  6218. // "type": "string"
  6219. // },
  6220. // "supportsTeamDrives": {
  6221. // "default": "false",
  6222. // "description": "Whether the requesting application supports Team Drives.",
  6223. // "location": "query",
  6224. // "type": "boolean"
  6225. // },
  6226. // "updateViewedDate": {
  6227. // "default": "false",
  6228. // "description": "Deprecated: Use files.update with modifiedDateBehavior=noChange, updateViewedDate=true and an empty request body.",
  6229. // "location": "query",
  6230. // "type": "boolean"
  6231. // }
  6232. // },
  6233. // "path": "files/{fileId}",
  6234. // "response": {
  6235. // "$ref": "File"
  6236. // },
  6237. // "scopes": [
  6238. // "https://www.googleapis.com/auth/drive",
  6239. // "https://www.googleapis.com/auth/drive.appdata",
  6240. // "https://www.googleapis.com/auth/drive.file",
  6241. // "https://www.googleapis.com/auth/drive.metadata",
  6242. // "https://www.googleapis.com/auth/drive.metadata.readonly",
  6243. // "https://www.googleapis.com/auth/drive.photos.readonly",
  6244. // "https://www.googleapis.com/auth/drive.readonly"
  6245. // ],
  6246. // "supportsMediaDownload": true,
  6247. // "supportsSubscription": true,
  6248. // "useMediaDownloadService": true
  6249. // }
  6250. }
  6251. // method id "drive.files.insert":
  6252. type FilesInsertCall struct {
  6253. s *Service
  6254. file *File
  6255. urlParams_ gensupport.URLParams
  6256. mediaInfo_ *gensupport.MediaInfo
  6257. ctx_ context.Context
  6258. header_ http.Header
  6259. }
  6260. // Insert: Insert a new file.
  6261. func (r *FilesService) Insert(file *File) *FilesInsertCall {
  6262. c := &FilesInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  6263. c.file = file
  6264. return c
  6265. }
  6266. // Convert sets the optional parameter "convert": Whether to convert
  6267. // this file to the corresponding Google Docs format.
  6268. func (c *FilesInsertCall) Convert(convert bool) *FilesInsertCall {
  6269. c.urlParams_.Set("convert", fmt.Sprint(convert))
  6270. return c
  6271. }
  6272. // Ocr sets the optional parameter "ocr": Whether to attempt OCR on
  6273. // .jpg, .png, .gif, or .pdf uploads.
  6274. func (c *FilesInsertCall) Ocr(ocr bool) *FilesInsertCall {
  6275. c.urlParams_.Set("ocr", fmt.Sprint(ocr))
  6276. return c
  6277. }
  6278. // OcrLanguage sets the optional parameter "ocrLanguage": If ocr is
  6279. // true, hints at the language to use. Valid values are BCP 47 codes.
  6280. func (c *FilesInsertCall) OcrLanguage(ocrLanguage string) *FilesInsertCall {
  6281. c.urlParams_.Set("ocrLanguage", ocrLanguage)
  6282. return c
  6283. }
  6284. // Pinned sets the optional parameter "pinned": Whether to pin the head
  6285. // revision of the uploaded file. A file can have a maximum of 200
  6286. // pinned revisions.
  6287. func (c *FilesInsertCall) Pinned(pinned bool) *FilesInsertCall {
  6288. c.urlParams_.Set("pinned", fmt.Sprint(pinned))
  6289. return c
  6290. }
  6291. // SupportsTeamDrives sets the optional parameter "supportsTeamDrives":
  6292. // Whether the requesting application supports Team Drives.
  6293. func (c *FilesInsertCall) SupportsTeamDrives(supportsTeamDrives bool) *FilesInsertCall {
  6294. c.urlParams_.Set("supportsTeamDrives", fmt.Sprint(supportsTeamDrives))
  6295. return c
  6296. }
  6297. // TimedTextLanguage sets the optional parameter "timedTextLanguage":
  6298. // The language of the timed text.
  6299. func (c *FilesInsertCall) TimedTextLanguage(timedTextLanguage string) *FilesInsertCall {
  6300. c.urlParams_.Set("timedTextLanguage", timedTextLanguage)
  6301. return c
  6302. }
  6303. // TimedTextTrackName sets the optional parameter "timedTextTrackName":
  6304. // The timed text track name.
  6305. func (c *FilesInsertCall) TimedTextTrackName(timedTextTrackName string) *FilesInsertCall {
  6306. c.urlParams_.Set("timedTextTrackName", timedTextTrackName)
  6307. return c
  6308. }
  6309. // UseContentAsIndexableText sets the optional parameter
  6310. // "useContentAsIndexableText": Whether to use the content as indexable
  6311. // text.
  6312. func (c *FilesInsertCall) UseContentAsIndexableText(useContentAsIndexableText bool) *FilesInsertCall {
  6313. c.urlParams_.Set("useContentAsIndexableText", fmt.Sprint(useContentAsIndexableText))
  6314. return c
  6315. }
  6316. // Visibility sets the optional parameter "visibility": The visibility
  6317. // of the new file. This parameter is only relevant when convert=false.
  6318. //
  6319. // Possible values:
  6320. // "DEFAULT" (default) - The visibility of the new file is determined
  6321. // by the user's default visibility/sharing policies.
  6322. // "PRIVATE" - The new file will be visible to only the owner.
  6323. func (c *FilesInsertCall) Visibility(visibility string) *FilesInsertCall {
  6324. c.urlParams_.Set("visibility", visibility)
  6325. return c
  6326. }
  6327. // Media specifies the media to upload in one or more chunks. The chunk
  6328. // size may be controlled by supplying a MediaOption generated by
  6329. // googleapi.ChunkSize. The chunk size defaults to
  6330. // googleapi.DefaultUploadChunkSize.The Content-Type header used in the
  6331. // upload request will be determined by sniffing the contents of r,
  6332. // unless a MediaOption generated by googleapi.ContentType is
  6333. // supplied.
  6334. // At most one of Media and ResumableMedia may be set.
  6335. func (c *FilesInsertCall) Media(r io.Reader, options ...googleapi.MediaOption) *FilesInsertCall {
  6336. c.mediaInfo_ = gensupport.NewInfoFromMedia(r, options)
  6337. return c
  6338. }
  6339. // ResumableMedia specifies the media to upload in chunks and can be
  6340. // canceled with ctx.
  6341. //
  6342. // Deprecated: use Media instead.
  6343. //
  6344. // At most one of Media and ResumableMedia may be set. mediaType
  6345. // identifies the MIME media type of the upload, such as "image/png". If
  6346. // mediaType is "", it will be auto-detected. The provided ctx will
  6347. // supersede any context previously provided to the Context method.
  6348. func (c *FilesInsertCall) ResumableMedia(ctx context.Context, r io.ReaderAt, size int64, mediaType string) *FilesInsertCall {
  6349. c.ctx_ = ctx
  6350. c.mediaInfo_ = gensupport.NewInfoFromResumableMedia(r, size, mediaType)
  6351. return c
  6352. }
  6353. // ProgressUpdater provides a callback function that will be called
  6354. // after every chunk. It should be a low-latency function in order to
  6355. // not slow down the upload operation. This should only be called when
  6356. // using ResumableMedia (as opposed to Media).
  6357. func (c *FilesInsertCall) ProgressUpdater(pu googleapi.ProgressUpdater) *FilesInsertCall {
  6358. c.mediaInfo_.SetProgressUpdater(pu)
  6359. return c
  6360. }
  6361. // Fields allows partial responses to be retrieved. See
  6362. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  6363. // for more information.
  6364. func (c *FilesInsertCall) Fields(s ...googleapi.Field) *FilesInsertCall {
  6365. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  6366. return c
  6367. }
  6368. // Context sets the context to be used in this call's Do method. Any
  6369. // pending HTTP request will be aborted if the provided context is
  6370. // canceled.
  6371. // This context will supersede any context previously provided to the
  6372. // ResumableMedia method.
  6373. func (c *FilesInsertCall) Context(ctx context.Context) *FilesInsertCall {
  6374. c.ctx_ = ctx
  6375. return c
  6376. }
  6377. // Header returns an http.Header that can be modified by the caller to
  6378. // add HTTP headers to the request.
  6379. func (c *FilesInsertCall) Header() http.Header {
  6380. if c.header_ == nil {
  6381. c.header_ = make(http.Header)
  6382. }
  6383. return c.header_
  6384. }
  6385. func (c *FilesInsertCall) doRequest(alt string) (*http.Response, error) {
  6386. reqHeaders := make(http.Header)
  6387. for k, v := range c.header_ {
  6388. reqHeaders[k] = v
  6389. }
  6390. reqHeaders.Set("User-Agent", c.s.userAgent())
  6391. var body io.Reader = nil
  6392. body, err := googleapi.WithoutDataWrapper.JSONReader(c.file)
  6393. if err != nil {
  6394. return nil, err
  6395. }
  6396. reqHeaders.Set("Content-Type", "application/json")
  6397. c.urlParams_.Set("alt", alt)
  6398. urls := googleapi.ResolveRelative(c.s.BasePath, "files")
  6399. if c.mediaInfo_ != nil {
  6400. urls = strings.Replace(urls, "https://www.googleapis.com/", "https://www.googleapis.com/upload/", 1)
  6401. c.urlParams_.Set("uploadType", c.mediaInfo_.UploadType())
  6402. }
  6403. if body == nil {
  6404. body = new(bytes.Buffer)
  6405. reqHeaders.Set("Content-Type", "application/json")
  6406. }
  6407. body, getBody, cleanup := c.mediaInfo_.UploadRequest(reqHeaders, body)
  6408. defer cleanup()
  6409. urls += "?" + c.urlParams_.Encode()
  6410. req, _ := http.NewRequest("POST", urls, body)
  6411. req.Header = reqHeaders
  6412. gensupport.SetGetBody(req, getBody)
  6413. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  6414. }
  6415. // Do executes the "drive.files.insert" call.
  6416. // Exactly one of *File or error will be non-nil. Any non-2xx status
  6417. // code is an error. Response headers are in either
  6418. // *File.ServerResponse.Header or (if a response was returned at all) in
  6419. // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  6420. // whether the returned error was because http.StatusNotModified was
  6421. // returned.
  6422. func (c *FilesInsertCall) Do(opts ...googleapi.CallOption) (*File, error) {
  6423. gensupport.SetOptions(c.urlParams_, opts...)
  6424. res, err := c.doRequest("json")
  6425. if res != nil && res.StatusCode == http.StatusNotModified {
  6426. if res.Body != nil {
  6427. res.Body.Close()
  6428. }
  6429. return nil, &googleapi.Error{
  6430. Code: res.StatusCode,
  6431. Header: res.Header,
  6432. }
  6433. }
  6434. if err != nil {
  6435. return nil, err
  6436. }
  6437. defer googleapi.CloseBody(res)
  6438. if err := googleapi.CheckResponse(res); err != nil {
  6439. return nil, err
  6440. }
  6441. rx := c.mediaInfo_.ResumableUpload(res.Header.Get("Location"))
  6442. if rx != nil {
  6443. rx.Client = c.s.client
  6444. rx.UserAgent = c.s.userAgent()
  6445. ctx := c.ctx_
  6446. if ctx == nil {
  6447. ctx = context.TODO()
  6448. }
  6449. res, err = rx.Upload(ctx)
  6450. if err != nil {
  6451. return nil, err
  6452. }
  6453. defer res.Body.Close()
  6454. if err := googleapi.CheckResponse(res); err != nil {
  6455. return nil, err
  6456. }
  6457. }
  6458. ret := &File{
  6459. ServerResponse: googleapi.ServerResponse{
  6460. Header: res.Header,
  6461. HTTPStatusCode: res.StatusCode,
  6462. },
  6463. }
  6464. target := &ret
  6465. if err := gensupport.DecodeResponse(target, res); err != nil {
  6466. return nil, err
  6467. }
  6468. return ret, nil
  6469. // {
  6470. // "description": "Insert a new file.",
  6471. // "httpMethod": "POST",
  6472. // "id": "drive.files.insert",
  6473. // "mediaUpload": {
  6474. // "accept": [
  6475. // "*/*"
  6476. // ],
  6477. // "maxSize": "5120GB",
  6478. // "protocols": {
  6479. // "resumable": {
  6480. // "multipart": true,
  6481. // "path": "/resumable/upload/drive/v2/files"
  6482. // },
  6483. // "simple": {
  6484. // "multipart": true,
  6485. // "path": "/upload/drive/v2/files"
  6486. // }
  6487. // }
  6488. // },
  6489. // "parameters": {
  6490. // "convert": {
  6491. // "default": "false",
  6492. // "description": "Whether to convert this file to the corresponding Google Docs format.",
  6493. // "location": "query",
  6494. // "type": "boolean"
  6495. // },
  6496. // "ocr": {
  6497. // "default": "false",
  6498. // "description": "Whether to attempt OCR on .jpg, .png, .gif, or .pdf uploads.",
  6499. // "location": "query",
  6500. // "type": "boolean"
  6501. // },
  6502. // "ocrLanguage": {
  6503. // "description": "If ocr is true, hints at the language to use. Valid values are BCP 47 codes.",
  6504. // "location": "query",
  6505. // "type": "string"
  6506. // },
  6507. // "pinned": {
  6508. // "default": "false",
  6509. // "description": "Whether to pin the head revision of the uploaded file. A file can have a maximum of 200 pinned revisions.",
  6510. // "location": "query",
  6511. // "type": "boolean"
  6512. // },
  6513. // "supportsTeamDrives": {
  6514. // "default": "false",
  6515. // "description": "Whether the requesting application supports Team Drives.",
  6516. // "location": "query",
  6517. // "type": "boolean"
  6518. // },
  6519. // "timedTextLanguage": {
  6520. // "description": "The language of the timed text.",
  6521. // "location": "query",
  6522. // "type": "string"
  6523. // },
  6524. // "timedTextTrackName": {
  6525. // "description": "The timed text track name.",
  6526. // "location": "query",
  6527. // "type": "string"
  6528. // },
  6529. // "useContentAsIndexableText": {
  6530. // "default": "false",
  6531. // "description": "Whether to use the content as indexable text.",
  6532. // "location": "query",
  6533. // "type": "boolean"
  6534. // },
  6535. // "visibility": {
  6536. // "default": "DEFAULT",
  6537. // "description": "The visibility of the new file. This parameter is only relevant when convert=false.",
  6538. // "enum": [
  6539. // "DEFAULT",
  6540. // "PRIVATE"
  6541. // ],
  6542. // "enumDescriptions": [
  6543. // "The visibility of the new file is determined by the user's default visibility/sharing policies.",
  6544. // "The new file will be visible to only the owner."
  6545. // ],
  6546. // "location": "query",
  6547. // "type": "string"
  6548. // }
  6549. // },
  6550. // "path": "files",
  6551. // "request": {
  6552. // "$ref": "File"
  6553. // },
  6554. // "response": {
  6555. // "$ref": "File"
  6556. // },
  6557. // "scopes": [
  6558. // "https://www.googleapis.com/auth/drive",
  6559. // "https://www.googleapis.com/auth/drive.appdata",
  6560. // "https://www.googleapis.com/auth/drive.apps.readonly",
  6561. // "https://www.googleapis.com/auth/drive.file"
  6562. // ],
  6563. // "supportsMediaUpload": true,
  6564. // "supportsSubscription": true
  6565. // }
  6566. }
  6567. // method id "drive.files.list":
  6568. type FilesListCall struct {
  6569. s *Service
  6570. urlParams_ gensupport.URLParams
  6571. ifNoneMatch_ string
  6572. ctx_ context.Context
  6573. header_ http.Header
  6574. }
  6575. // List: Lists the user's files.
  6576. func (r *FilesService) List() *FilesListCall {
  6577. c := &FilesListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  6578. return c
  6579. }
  6580. // Corpora sets the optional parameter "corpora": Comma-separated list
  6581. // of bodies of items (files/documents) to which the query applies.
  6582. // Supported bodies are 'default', 'domain', 'teamDrive' and
  6583. // 'allTeamDrives'. 'allTeamDrives' must be combined with 'default'; all
  6584. // other values must be used in isolation. Prefer 'default' or
  6585. // 'teamDrive' to 'allTeamDrives' for efficiency.
  6586. func (c *FilesListCall) Corpora(corpora string) *FilesListCall {
  6587. c.urlParams_.Set("corpora", corpora)
  6588. return c
  6589. }
  6590. // Corpus sets the optional parameter "corpus": The body of items
  6591. // (files/documents) to which the query applies. Deprecated: use
  6592. // 'corpora' instead.
  6593. //
  6594. // Possible values:
  6595. // "DEFAULT" - The items that the user has accessed.
  6596. // "DOMAIN" - Items shared to the user's domain.
  6597. func (c *FilesListCall) Corpus(corpus string) *FilesListCall {
  6598. c.urlParams_.Set("corpus", corpus)
  6599. return c
  6600. }
  6601. // IncludeTeamDriveItems sets the optional parameter
  6602. // "includeTeamDriveItems": Whether Team Drive items should be included
  6603. // in results.
  6604. func (c *FilesListCall) IncludeTeamDriveItems(includeTeamDriveItems bool) *FilesListCall {
  6605. c.urlParams_.Set("includeTeamDriveItems", fmt.Sprint(includeTeamDriveItems))
  6606. return c
  6607. }
  6608. // MaxResults sets the optional parameter "maxResults": The maximum
  6609. // number of files to return per page. Partial or empty result pages are
  6610. // possible even before the end of the files list has been reached.
  6611. func (c *FilesListCall) MaxResults(maxResults int64) *FilesListCall {
  6612. c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
  6613. return c
  6614. }
  6615. // OrderBy sets the optional parameter "orderBy": A comma-separated list
  6616. // of sort keys. Valid keys are 'createdDate', 'folder',
  6617. // 'lastViewedByMeDate', 'modifiedByMeDate', 'modifiedDate',
  6618. // 'quotaBytesUsed', 'recency', 'sharedWithMeDate', 'starred', 'title',
  6619. // and 'title_natural'. Each key sorts ascending by default, but may be
  6620. // reversed with the 'desc' modifier. Example usage:
  6621. // ?orderBy=folder,modifiedDate desc,title. Please note that there is a
  6622. // current limitation for users with approximately one million files in
  6623. // which the requested sort order is ignored.
  6624. func (c *FilesListCall) OrderBy(orderBy string) *FilesListCall {
  6625. c.urlParams_.Set("orderBy", orderBy)
  6626. return c
  6627. }
  6628. // PageToken sets the optional parameter "pageToken": Page token for
  6629. // files.
  6630. func (c *FilesListCall) PageToken(pageToken string) *FilesListCall {
  6631. c.urlParams_.Set("pageToken", pageToken)
  6632. return c
  6633. }
  6634. // Projection sets the optional parameter "projection": This parameter
  6635. // is deprecated and has no function.
  6636. //
  6637. // Possible values:
  6638. // "BASIC" - Deprecated
  6639. // "FULL" - Deprecated
  6640. func (c *FilesListCall) Projection(projection string) *FilesListCall {
  6641. c.urlParams_.Set("projection", projection)
  6642. return c
  6643. }
  6644. // Q sets the optional parameter "q": Query string for searching files.
  6645. func (c *FilesListCall) Q(q string) *FilesListCall {
  6646. c.urlParams_.Set("q", q)
  6647. return c
  6648. }
  6649. // Spaces sets the optional parameter "spaces": A comma-separated list
  6650. // of spaces to query. Supported values are 'drive', 'appDataFolder' and
  6651. // 'photos'.
  6652. func (c *FilesListCall) Spaces(spaces string) *FilesListCall {
  6653. c.urlParams_.Set("spaces", spaces)
  6654. return c
  6655. }
  6656. // SupportsTeamDrives sets the optional parameter "supportsTeamDrives":
  6657. // Whether the requesting application supports Team Drives.
  6658. func (c *FilesListCall) SupportsTeamDrives(supportsTeamDrives bool) *FilesListCall {
  6659. c.urlParams_.Set("supportsTeamDrives", fmt.Sprint(supportsTeamDrives))
  6660. return c
  6661. }
  6662. // TeamDriveId sets the optional parameter "teamDriveId": ID of Team
  6663. // Drive to search.
  6664. func (c *FilesListCall) TeamDriveId(teamDriveId string) *FilesListCall {
  6665. c.urlParams_.Set("teamDriveId", teamDriveId)
  6666. return c
  6667. }
  6668. // Fields allows partial responses to be retrieved. See
  6669. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  6670. // for more information.
  6671. func (c *FilesListCall) Fields(s ...googleapi.Field) *FilesListCall {
  6672. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  6673. return c
  6674. }
  6675. // IfNoneMatch sets the optional parameter which makes the operation
  6676. // fail if the object's ETag matches the given value. This is useful for
  6677. // getting updates only after the object has changed since the last
  6678. // request. Use googleapi.IsNotModified to check whether the response
  6679. // error from Do is the result of In-None-Match.
  6680. func (c *FilesListCall) IfNoneMatch(entityTag string) *FilesListCall {
  6681. c.ifNoneMatch_ = entityTag
  6682. return c
  6683. }
  6684. // Context sets the context to be used in this call's Do method. Any
  6685. // pending HTTP request will be aborted if the provided context is
  6686. // canceled.
  6687. func (c *FilesListCall) Context(ctx context.Context) *FilesListCall {
  6688. c.ctx_ = ctx
  6689. return c
  6690. }
  6691. // Header returns an http.Header that can be modified by the caller to
  6692. // add HTTP headers to the request.
  6693. func (c *FilesListCall) Header() http.Header {
  6694. if c.header_ == nil {
  6695. c.header_ = make(http.Header)
  6696. }
  6697. return c.header_
  6698. }
  6699. func (c *FilesListCall) doRequest(alt string) (*http.Response, error) {
  6700. reqHeaders := make(http.Header)
  6701. for k, v := range c.header_ {
  6702. reqHeaders[k] = v
  6703. }
  6704. reqHeaders.Set("User-Agent", c.s.userAgent())
  6705. if c.ifNoneMatch_ != "" {
  6706. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  6707. }
  6708. var body io.Reader = nil
  6709. c.urlParams_.Set("alt", alt)
  6710. urls := googleapi.ResolveRelative(c.s.BasePath, "files")
  6711. urls += "?" + c.urlParams_.Encode()
  6712. req, _ := http.NewRequest("GET", urls, body)
  6713. req.Header = reqHeaders
  6714. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  6715. }
  6716. // Do executes the "drive.files.list" call.
  6717. // Exactly one of *FileList or error will be non-nil. Any non-2xx status
  6718. // code is an error. Response headers are in either
  6719. // *FileList.ServerResponse.Header or (if a response was returned at
  6720. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  6721. // to check whether the returned error was because
  6722. // http.StatusNotModified was returned.
  6723. func (c *FilesListCall) Do(opts ...googleapi.CallOption) (*FileList, error) {
  6724. gensupport.SetOptions(c.urlParams_, opts...)
  6725. res, err := c.doRequest("json")
  6726. if res != nil && res.StatusCode == http.StatusNotModified {
  6727. if res.Body != nil {
  6728. res.Body.Close()
  6729. }
  6730. return nil, &googleapi.Error{
  6731. Code: res.StatusCode,
  6732. Header: res.Header,
  6733. }
  6734. }
  6735. if err != nil {
  6736. return nil, err
  6737. }
  6738. defer googleapi.CloseBody(res)
  6739. if err := googleapi.CheckResponse(res); err != nil {
  6740. return nil, err
  6741. }
  6742. ret := &FileList{
  6743. ServerResponse: googleapi.ServerResponse{
  6744. Header: res.Header,
  6745. HTTPStatusCode: res.StatusCode,
  6746. },
  6747. }
  6748. target := &ret
  6749. if err := gensupport.DecodeResponse(target, res); err != nil {
  6750. return nil, err
  6751. }
  6752. return ret, nil
  6753. // {
  6754. // "description": "Lists the user's files.",
  6755. // "httpMethod": "GET",
  6756. // "id": "drive.files.list",
  6757. // "parameters": {
  6758. // "corpora": {
  6759. // "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.",
  6760. // "location": "query",
  6761. // "type": "string"
  6762. // },
  6763. // "corpus": {
  6764. // "description": "The body of items (files/documents) to which the query applies. Deprecated: use 'corpora' instead.",
  6765. // "enum": [
  6766. // "DEFAULT",
  6767. // "DOMAIN"
  6768. // ],
  6769. // "enumDescriptions": [
  6770. // "The items that the user has accessed.",
  6771. // "Items shared to the user's domain."
  6772. // ],
  6773. // "location": "query",
  6774. // "type": "string"
  6775. // },
  6776. // "includeTeamDriveItems": {
  6777. // "default": "false",
  6778. // "description": "Whether Team Drive items should be included in results.",
  6779. // "location": "query",
  6780. // "type": "boolean"
  6781. // },
  6782. // "maxResults": {
  6783. // "default": "100",
  6784. // "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.",
  6785. // "format": "int32",
  6786. // "location": "query",
  6787. // "minimum": "0",
  6788. // "type": "integer"
  6789. // },
  6790. // "orderBy": {
  6791. // "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.",
  6792. // "location": "query",
  6793. // "type": "string"
  6794. // },
  6795. // "pageToken": {
  6796. // "description": "Page token for files.",
  6797. // "location": "query",
  6798. // "type": "string"
  6799. // },
  6800. // "projection": {
  6801. // "description": "This parameter is deprecated and has no function.",
  6802. // "enum": [
  6803. // "BASIC",
  6804. // "FULL"
  6805. // ],
  6806. // "enumDescriptions": [
  6807. // "Deprecated",
  6808. // "Deprecated"
  6809. // ],
  6810. // "location": "query",
  6811. // "type": "string"
  6812. // },
  6813. // "q": {
  6814. // "description": "Query string for searching files.",
  6815. // "location": "query",
  6816. // "type": "string"
  6817. // },
  6818. // "spaces": {
  6819. // "description": "A comma-separated list of spaces to query. Supported values are 'drive', 'appDataFolder' and 'photos'.",
  6820. // "location": "query",
  6821. // "type": "string"
  6822. // },
  6823. // "supportsTeamDrives": {
  6824. // "default": "false",
  6825. // "description": "Whether the requesting application supports Team Drives.",
  6826. // "location": "query",
  6827. // "type": "boolean"
  6828. // },
  6829. // "teamDriveId": {
  6830. // "description": "ID of Team Drive to search.",
  6831. // "location": "query",
  6832. // "type": "string"
  6833. // }
  6834. // },
  6835. // "path": "files",
  6836. // "response": {
  6837. // "$ref": "FileList"
  6838. // },
  6839. // "scopes": [
  6840. // "https://www.googleapis.com/auth/drive",
  6841. // "https://www.googleapis.com/auth/drive.appdata",
  6842. // "https://www.googleapis.com/auth/drive.apps.readonly",
  6843. // "https://www.googleapis.com/auth/drive.file",
  6844. // "https://www.googleapis.com/auth/drive.metadata",
  6845. // "https://www.googleapis.com/auth/drive.metadata.readonly",
  6846. // "https://www.googleapis.com/auth/drive.photos.readonly",
  6847. // "https://www.googleapis.com/auth/drive.readonly"
  6848. // ]
  6849. // }
  6850. }
  6851. // Pages invokes f for each page of results.
  6852. // A non-nil error returned from f will halt the iteration.
  6853. // The provided context supersedes any context provided to the Context method.
  6854. func (c *FilesListCall) Pages(ctx context.Context, f func(*FileList) error) error {
  6855. c.ctx_ = ctx
  6856. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  6857. for {
  6858. x, err := c.Do()
  6859. if err != nil {
  6860. return err
  6861. }
  6862. if err := f(x); err != nil {
  6863. return err
  6864. }
  6865. if x.NextPageToken == "" {
  6866. return nil
  6867. }
  6868. c.PageToken(x.NextPageToken)
  6869. }
  6870. }
  6871. // method id "drive.files.patch":
  6872. type FilesPatchCall struct {
  6873. s *Service
  6874. fileId string
  6875. file *File
  6876. urlParams_ gensupport.URLParams
  6877. ctx_ context.Context
  6878. header_ http.Header
  6879. }
  6880. // Patch: Updates file metadata and/or content. This method supports
  6881. // patch semantics.
  6882. func (r *FilesService) Patch(fileId string, file *File) *FilesPatchCall {
  6883. c := &FilesPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  6884. c.fileId = fileId
  6885. c.file = file
  6886. return c
  6887. }
  6888. // AddParents sets the optional parameter "addParents": Comma-separated
  6889. // list of parent IDs to add.
  6890. func (c *FilesPatchCall) AddParents(addParents string) *FilesPatchCall {
  6891. c.urlParams_.Set("addParents", addParents)
  6892. return c
  6893. }
  6894. // Convert sets the optional parameter "convert": This parameter is
  6895. // deprecated and has no function.
  6896. func (c *FilesPatchCall) Convert(convert bool) *FilesPatchCall {
  6897. c.urlParams_.Set("convert", fmt.Sprint(convert))
  6898. return c
  6899. }
  6900. // ModifiedDateBehavior sets the optional parameter
  6901. // "modifiedDateBehavior": Determines the behavior in which modifiedDate
  6902. // is updated. This overrides setModifiedDate.
  6903. //
  6904. // Possible values:
  6905. // "fromBody" - Set modifiedDate to the value provided in the body of
  6906. // the request. No change if no value was provided.
  6907. // "fromBodyIfNeeded" - Set modifiedDate to the value provided in the
  6908. // body of the request depending on other contents of the update.
  6909. // "fromBodyOrNow" - Set modifiedDate to the value provided in the
  6910. // body of the request, or to the current time if no value was provided.
  6911. // "noChange" - Maintain the previous value of modifiedDate.
  6912. // "now" - Set modifiedDate to the current time.
  6913. // "nowIfNeeded" - Set modifiedDate to the current time depending on
  6914. // contents of the update.
  6915. func (c *FilesPatchCall) ModifiedDateBehavior(modifiedDateBehavior string) *FilesPatchCall {
  6916. c.urlParams_.Set("modifiedDateBehavior", modifiedDateBehavior)
  6917. return c
  6918. }
  6919. // NewRevision sets the optional parameter "newRevision": Whether a blob
  6920. // upload should create a new revision. If false, the blob data in the
  6921. // current head revision is replaced. If true or not set, a new blob is
  6922. // created as head revision, and previous unpinned revisions are
  6923. // preserved for a short period of time. Pinned revisions are stored
  6924. // indefinitely, using additional storage quota, up to a maximum of 200
  6925. // revisions. For details on how revisions are retained, see the Drive
  6926. // Help Center.
  6927. func (c *FilesPatchCall) NewRevision(newRevision bool) *FilesPatchCall {
  6928. c.urlParams_.Set("newRevision", fmt.Sprint(newRevision))
  6929. return c
  6930. }
  6931. // Ocr sets the optional parameter "ocr": Whether to attempt OCR on
  6932. // .jpg, .png, .gif, or .pdf uploads.
  6933. func (c *FilesPatchCall) Ocr(ocr bool) *FilesPatchCall {
  6934. c.urlParams_.Set("ocr", fmt.Sprint(ocr))
  6935. return c
  6936. }
  6937. // OcrLanguage sets the optional parameter "ocrLanguage": If ocr is
  6938. // true, hints at the language to use. Valid values are BCP 47 codes.
  6939. func (c *FilesPatchCall) OcrLanguage(ocrLanguage string) *FilesPatchCall {
  6940. c.urlParams_.Set("ocrLanguage", ocrLanguage)
  6941. return c
  6942. }
  6943. // Pinned sets the optional parameter "pinned": Whether to pin the new
  6944. // revision. A file can have a maximum of 200 pinned revisions.
  6945. func (c *FilesPatchCall) Pinned(pinned bool) *FilesPatchCall {
  6946. c.urlParams_.Set("pinned", fmt.Sprint(pinned))
  6947. return c
  6948. }
  6949. // RemoveParents sets the optional parameter "removeParents":
  6950. // Comma-separated list of parent IDs to remove.
  6951. func (c *FilesPatchCall) RemoveParents(removeParents string) *FilesPatchCall {
  6952. c.urlParams_.Set("removeParents", removeParents)
  6953. return c
  6954. }
  6955. // SetModifiedDate sets the optional parameter "setModifiedDate":
  6956. // Whether to set the modified date using the value supplied in the
  6957. // request body. Setting this field to true is equivalent to
  6958. // modifiedDateBehavior=fromBodyOrNow, and false is equivalent to
  6959. // modifiedDateBehavior=now. To prevent any changes to the modified date
  6960. // set modifiedDateBehavior=noChange.
  6961. func (c *FilesPatchCall) SetModifiedDate(setModifiedDate bool) *FilesPatchCall {
  6962. c.urlParams_.Set("setModifiedDate", fmt.Sprint(setModifiedDate))
  6963. return c
  6964. }
  6965. // SupportsTeamDrives sets the optional parameter "supportsTeamDrives":
  6966. // Whether the requesting application supports Team Drives.
  6967. func (c *FilesPatchCall) SupportsTeamDrives(supportsTeamDrives bool) *FilesPatchCall {
  6968. c.urlParams_.Set("supportsTeamDrives", fmt.Sprint(supportsTeamDrives))
  6969. return c
  6970. }
  6971. // TimedTextLanguage sets the optional parameter "timedTextLanguage":
  6972. // The language of the timed text.
  6973. func (c *FilesPatchCall) TimedTextLanguage(timedTextLanguage string) *FilesPatchCall {
  6974. c.urlParams_.Set("timedTextLanguage", timedTextLanguage)
  6975. return c
  6976. }
  6977. // TimedTextTrackName sets the optional parameter "timedTextTrackName":
  6978. // The timed text track name.
  6979. func (c *FilesPatchCall) TimedTextTrackName(timedTextTrackName string) *FilesPatchCall {
  6980. c.urlParams_.Set("timedTextTrackName", timedTextTrackName)
  6981. return c
  6982. }
  6983. // UpdateViewedDate sets the optional parameter "updateViewedDate":
  6984. // Whether to update the view date after successfully updating the file.
  6985. func (c *FilesPatchCall) UpdateViewedDate(updateViewedDate bool) *FilesPatchCall {
  6986. c.urlParams_.Set("updateViewedDate", fmt.Sprint(updateViewedDate))
  6987. return c
  6988. }
  6989. // UseContentAsIndexableText sets the optional parameter
  6990. // "useContentAsIndexableText": Whether to use the content as indexable
  6991. // text.
  6992. func (c *FilesPatchCall) UseContentAsIndexableText(useContentAsIndexableText bool) *FilesPatchCall {
  6993. c.urlParams_.Set("useContentAsIndexableText", fmt.Sprint(useContentAsIndexableText))
  6994. return c
  6995. }
  6996. // Fields allows partial responses to be retrieved. See
  6997. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  6998. // for more information.
  6999. func (c *FilesPatchCall) Fields(s ...googleapi.Field) *FilesPatchCall {
  7000. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  7001. return c
  7002. }
  7003. // Context sets the context to be used in this call's Do method. Any
  7004. // pending HTTP request will be aborted if the provided context is
  7005. // canceled.
  7006. func (c *FilesPatchCall) Context(ctx context.Context) *FilesPatchCall {
  7007. c.ctx_ = ctx
  7008. return c
  7009. }
  7010. // Header returns an http.Header that can be modified by the caller to
  7011. // add HTTP headers to the request.
  7012. func (c *FilesPatchCall) Header() http.Header {
  7013. if c.header_ == nil {
  7014. c.header_ = make(http.Header)
  7015. }
  7016. return c.header_
  7017. }
  7018. func (c *FilesPatchCall) doRequest(alt string) (*http.Response, error) {
  7019. reqHeaders := make(http.Header)
  7020. for k, v := range c.header_ {
  7021. reqHeaders[k] = v
  7022. }
  7023. reqHeaders.Set("User-Agent", c.s.userAgent())
  7024. var body io.Reader = nil
  7025. body, err := googleapi.WithoutDataWrapper.JSONReader(c.file)
  7026. if err != nil {
  7027. return nil, err
  7028. }
  7029. reqHeaders.Set("Content-Type", "application/json")
  7030. c.urlParams_.Set("alt", alt)
  7031. urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}")
  7032. urls += "?" + c.urlParams_.Encode()
  7033. req, _ := http.NewRequest("PATCH", urls, body)
  7034. req.Header = reqHeaders
  7035. googleapi.Expand(req.URL, map[string]string{
  7036. "fileId": c.fileId,
  7037. })
  7038. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  7039. }
  7040. // Do executes the "drive.files.patch" call.
  7041. // Exactly one of *File or error will be non-nil. Any non-2xx status
  7042. // code is an error. Response headers are in either
  7043. // *File.ServerResponse.Header or (if a response was returned at all) in
  7044. // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  7045. // whether the returned error was because http.StatusNotModified was
  7046. // returned.
  7047. func (c *FilesPatchCall) Do(opts ...googleapi.CallOption) (*File, error) {
  7048. gensupport.SetOptions(c.urlParams_, opts...)
  7049. res, err := c.doRequest("json")
  7050. if res != nil && res.StatusCode == http.StatusNotModified {
  7051. if res.Body != nil {
  7052. res.Body.Close()
  7053. }
  7054. return nil, &googleapi.Error{
  7055. Code: res.StatusCode,
  7056. Header: res.Header,
  7057. }
  7058. }
  7059. if err != nil {
  7060. return nil, err
  7061. }
  7062. defer googleapi.CloseBody(res)
  7063. if err := googleapi.CheckResponse(res); err != nil {
  7064. return nil, err
  7065. }
  7066. ret := &File{
  7067. ServerResponse: googleapi.ServerResponse{
  7068. Header: res.Header,
  7069. HTTPStatusCode: res.StatusCode,
  7070. },
  7071. }
  7072. target := &ret
  7073. if err := gensupport.DecodeResponse(target, res); err != nil {
  7074. return nil, err
  7075. }
  7076. return ret, nil
  7077. // {
  7078. // "description": "Updates file metadata and/or content. This method supports patch semantics.",
  7079. // "httpMethod": "PATCH",
  7080. // "id": "drive.files.patch",
  7081. // "parameterOrder": [
  7082. // "fileId"
  7083. // ],
  7084. // "parameters": {
  7085. // "addParents": {
  7086. // "description": "Comma-separated list of parent IDs to add.",
  7087. // "location": "query",
  7088. // "type": "string"
  7089. // },
  7090. // "convert": {
  7091. // "default": "false",
  7092. // "description": "This parameter is deprecated and has no function.",
  7093. // "location": "query",
  7094. // "type": "boolean"
  7095. // },
  7096. // "fileId": {
  7097. // "description": "The ID of the file to update.",
  7098. // "location": "path",
  7099. // "required": true,
  7100. // "type": "string"
  7101. // },
  7102. // "modifiedDateBehavior": {
  7103. // "description": "Determines the behavior in which modifiedDate is updated. This overrides setModifiedDate.",
  7104. // "enum": [
  7105. // "fromBody",
  7106. // "fromBodyIfNeeded",
  7107. // "fromBodyOrNow",
  7108. // "noChange",
  7109. // "now",
  7110. // "nowIfNeeded"
  7111. // ],
  7112. // "enumDescriptions": [
  7113. // "Set modifiedDate to the value provided in the body of the request. No change if no value was provided.",
  7114. // "Set modifiedDate to the value provided in the body of the request depending on other contents of the update.",
  7115. // "Set modifiedDate to the value provided in the body of the request, or to the current time if no value was provided.",
  7116. // "Maintain the previous value of modifiedDate.",
  7117. // "Set modifiedDate to the current time.",
  7118. // "Set modifiedDate to the current time depending on contents of the update."
  7119. // ],
  7120. // "location": "query",
  7121. // "type": "string"
  7122. // },
  7123. // "newRevision": {
  7124. // "default": "true",
  7125. // "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.",
  7126. // "location": "query",
  7127. // "type": "boolean"
  7128. // },
  7129. // "ocr": {
  7130. // "default": "false",
  7131. // "description": "Whether to attempt OCR on .jpg, .png, .gif, or .pdf uploads.",
  7132. // "location": "query",
  7133. // "type": "boolean"
  7134. // },
  7135. // "ocrLanguage": {
  7136. // "description": "If ocr is true, hints at the language to use. Valid values are BCP 47 codes.",
  7137. // "location": "query",
  7138. // "type": "string"
  7139. // },
  7140. // "pinned": {
  7141. // "default": "false",
  7142. // "description": "Whether to pin the new revision. A file can have a maximum of 200 pinned revisions.",
  7143. // "location": "query",
  7144. // "type": "boolean"
  7145. // },
  7146. // "removeParents": {
  7147. // "description": "Comma-separated list of parent IDs to remove.",
  7148. // "location": "query",
  7149. // "type": "string"
  7150. // },
  7151. // "setModifiedDate": {
  7152. // "default": "false",
  7153. // "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.",
  7154. // "location": "query",
  7155. // "type": "boolean"
  7156. // },
  7157. // "supportsTeamDrives": {
  7158. // "default": "false",
  7159. // "description": "Whether the requesting application supports Team Drives.",
  7160. // "location": "query",
  7161. // "type": "boolean"
  7162. // },
  7163. // "timedTextLanguage": {
  7164. // "description": "The language of the timed text.",
  7165. // "location": "query",
  7166. // "type": "string"
  7167. // },
  7168. // "timedTextTrackName": {
  7169. // "description": "The timed text track name.",
  7170. // "location": "query",
  7171. // "type": "string"
  7172. // },
  7173. // "updateViewedDate": {
  7174. // "default": "true",
  7175. // "description": "Whether to update the view date after successfully updating the file.",
  7176. // "location": "query",
  7177. // "type": "boolean"
  7178. // },
  7179. // "useContentAsIndexableText": {
  7180. // "default": "false",
  7181. // "description": "Whether to use the content as indexable text.",
  7182. // "location": "query",
  7183. // "type": "boolean"
  7184. // }
  7185. // },
  7186. // "path": "files/{fileId}",
  7187. // "request": {
  7188. // "$ref": "File"
  7189. // },
  7190. // "response": {
  7191. // "$ref": "File"
  7192. // },
  7193. // "scopes": [
  7194. // "https://www.googleapis.com/auth/drive",
  7195. // "https://www.googleapis.com/auth/drive.appdata",
  7196. // "https://www.googleapis.com/auth/drive.apps.readonly",
  7197. // "https://www.googleapis.com/auth/drive.file",
  7198. // "https://www.googleapis.com/auth/drive.metadata",
  7199. // "https://www.googleapis.com/auth/drive.scripts"
  7200. // ]
  7201. // }
  7202. }
  7203. // method id "drive.files.touch":
  7204. type FilesTouchCall struct {
  7205. s *Service
  7206. fileId string
  7207. urlParams_ gensupport.URLParams
  7208. ctx_ context.Context
  7209. header_ http.Header
  7210. }
  7211. // Touch: Set the file's updated time to the current server time.
  7212. func (r *FilesService) Touch(fileId string) *FilesTouchCall {
  7213. c := &FilesTouchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  7214. c.fileId = fileId
  7215. return c
  7216. }
  7217. // SupportsTeamDrives sets the optional parameter "supportsTeamDrives":
  7218. // Whether the requesting application supports Team Drives.
  7219. func (c *FilesTouchCall) SupportsTeamDrives(supportsTeamDrives bool) *FilesTouchCall {
  7220. c.urlParams_.Set("supportsTeamDrives", fmt.Sprint(supportsTeamDrives))
  7221. return c
  7222. }
  7223. // Fields allows partial responses to be retrieved. See
  7224. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  7225. // for more information.
  7226. func (c *FilesTouchCall) Fields(s ...googleapi.Field) *FilesTouchCall {
  7227. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  7228. return c
  7229. }
  7230. // Context sets the context to be used in this call's Do method. Any
  7231. // pending HTTP request will be aborted if the provided context is
  7232. // canceled.
  7233. func (c *FilesTouchCall) Context(ctx context.Context) *FilesTouchCall {
  7234. c.ctx_ = ctx
  7235. return c
  7236. }
  7237. // Header returns an http.Header that can be modified by the caller to
  7238. // add HTTP headers to the request.
  7239. func (c *FilesTouchCall) Header() http.Header {
  7240. if c.header_ == nil {
  7241. c.header_ = make(http.Header)
  7242. }
  7243. return c.header_
  7244. }
  7245. func (c *FilesTouchCall) doRequest(alt string) (*http.Response, error) {
  7246. reqHeaders := make(http.Header)
  7247. for k, v := range c.header_ {
  7248. reqHeaders[k] = v
  7249. }
  7250. reqHeaders.Set("User-Agent", c.s.userAgent())
  7251. var body io.Reader = nil
  7252. c.urlParams_.Set("alt", alt)
  7253. urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/touch")
  7254. urls += "?" + c.urlParams_.Encode()
  7255. req, _ := http.NewRequest("POST", urls, body)
  7256. req.Header = reqHeaders
  7257. googleapi.Expand(req.URL, map[string]string{
  7258. "fileId": c.fileId,
  7259. })
  7260. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  7261. }
  7262. // Do executes the "drive.files.touch" call.
  7263. // Exactly one of *File or error will be non-nil. Any non-2xx status
  7264. // code is an error. Response headers are in either
  7265. // *File.ServerResponse.Header or (if a response was returned at all) in
  7266. // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  7267. // whether the returned error was because http.StatusNotModified was
  7268. // returned.
  7269. func (c *FilesTouchCall) Do(opts ...googleapi.CallOption) (*File, error) {
  7270. gensupport.SetOptions(c.urlParams_, opts...)
  7271. res, err := c.doRequest("json")
  7272. if res != nil && res.StatusCode == http.StatusNotModified {
  7273. if res.Body != nil {
  7274. res.Body.Close()
  7275. }
  7276. return nil, &googleapi.Error{
  7277. Code: res.StatusCode,
  7278. Header: res.Header,
  7279. }
  7280. }
  7281. if err != nil {
  7282. return nil, err
  7283. }
  7284. defer googleapi.CloseBody(res)
  7285. if err := googleapi.CheckResponse(res); err != nil {
  7286. return nil, err
  7287. }
  7288. ret := &File{
  7289. ServerResponse: googleapi.ServerResponse{
  7290. Header: res.Header,
  7291. HTTPStatusCode: res.StatusCode,
  7292. },
  7293. }
  7294. target := &ret
  7295. if err := gensupport.DecodeResponse(target, res); err != nil {
  7296. return nil, err
  7297. }
  7298. return ret, nil
  7299. // {
  7300. // "description": "Set the file's updated time to the current server time.",
  7301. // "httpMethod": "POST",
  7302. // "id": "drive.files.touch",
  7303. // "parameterOrder": [
  7304. // "fileId"
  7305. // ],
  7306. // "parameters": {
  7307. // "fileId": {
  7308. // "description": "The ID of the file to update.",
  7309. // "location": "path",
  7310. // "required": true,
  7311. // "type": "string"
  7312. // },
  7313. // "supportsTeamDrives": {
  7314. // "default": "false",
  7315. // "description": "Whether the requesting application supports Team Drives.",
  7316. // "location": "query",
  7317. // "type": "boolean"
  7318. // }
  7319. // },
  7320. // "path": "files/{fileId}/touch",
  7321. // "response": {
  7322. // "$ref": "File"
  7323. // },
  7324. // "scopes": [
  7325. // "https://www.googleapis.com/auth/drive",
  7326. // "https://www.googleapis.com/auth/drive.appdata",
  7327. // "https://www.googleapis.com/auth/drive.apps.readonly",
  7328. // "https://www.googleapis.com/auth/drive.file",
  7329. // "https://www.googleapis.com/auth/drive.metadata"
  7330. // ]
  7331. // }
  7332. }
  7333. // method id "drive.files.trash":
  7334. type FilesTrashCall struct {
  7335. s *Service
  7336. fileId string
  7337. urlParams_ gensupport.URLParams
  7338. ctx_ context.Context
  7339. header_ http.Header
  7340. }
  7341. // Trash: Moves a file to the trash. The currently authenticated user
  7342. // must own the file or be an organizer on the parent for Team Drive
  7343. // files.
  7344. func (r *FilesService) Trash(fileId string) *FilesTrashCall {
  7345. c := &FilesTrashCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  7346. c.fileId = fileId
  7347. return c
  7348. }
  7349. // SupportsTeamDrives sets the optional parameter "supportsTeamDrives":
  7350. // Whether the requesting application supports Team Drives.
  7351. func (c *FilesTrashCall) SupportsTeamDrives(supportsTeamDrives bool) *FilesTrashCall {
  7352. c.urlParams_.Set("supportsTeamDrives", fmt.Sprint(supportsTeamDrives))
  7353. return c
  7354. }
  7355. // Fields allows partial responses to be retrieved. See
  7356. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  7357. // for more information.
  7358. func (c *FilesTrashCall) Fields(s ...googleapi.Field) *FilesTrashCall {
  7359. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  7360. return c
  7361. }
  7362. // Context sets the context to be used in this call's Do method. Any
  7363. // pending HTTP request will be aborted if the provided context is
  7364. // canceled.
  7365. func (c *FilesTrashCall) Context(ctx context.Context) *FilesTrashCall {
  7366. c.ctx_ = ctx
  7367. return c
  7368. }
  7369. // Header returns an http.Header that can be modified by the caller to
  7370. // add HTTP headers to the request.
  7371. func (c *FilesTrashCall) Header() http.Header {
  7372. if c.header_ == nil {
  7373. c.header_ = make(http.Header)
  7374. }
  7375. return c.header_
  7376. }
  7377. func (c *FilesTrashCall) doRequest(alt string) (*http.Response, error) {
  7378. reqHeaders := make(http.Header)
  7379. for k, v := range c.header_ {
  7380. reqHeaders[k] = v
  7381. }
  7382. reqHeaders.Set("User-Agent", c.s.userAgent())
  7383. var body io.Reader = nil
  7384. c.urlParams_.Set("alt", alt)
  7385. urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/trash")
  7386. urls += "?" + c.urlParams_.Encode()
  7387. req, _ := http.NewRequest("POST", urls, body)
  7388. req.Header = reqHeaders
  7389. googleapi.Expand(req.URL, map[string]string{
  7390. "fileId": c.fileId,
  7391. })
  7392. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  7393. }
  7394. // Do executes the "drive.files.trash" call.
  7395. // Exactly one of *File or error will be non-nil. Any non-2xx status
  7396. // code is an error. Response headers are in either
  7397. // *File.ServerResponse.Header or (if a response was returned at all) in
  7398. // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  7399. // whether the returned error was because http.StatusNotModified was
  7400. // returned.
  7401. func (c *FilesTrashCall) Do(opts ...googleapi.CallOption) (*File, error) {
  7402. gensupport.SetOptions(c.urlParams_, opts...)
  7403. res, err := c.doRequest("json")
  7404. if res != nil && res.StatusCode == http.StatusNotModified {
  7405. if res.Body != nil {
  7406. res.Body.Close()
  7407. }
  7408. return nil, &googleapi.Error{
  7409. Code: res.StatusCode,
  7410. Header: res.Header,
  7411. }
  7412. }
  7413. if err != nil {
  7414. return nil, err
  7415. }
  7416. defer googleapi.CloseBody(res)
  7417. if err := googleapi.CheckResponse(res); err != nil {
  7418. return nil, err
  7419. }
  7420. ret := &File{
  7421. ServerResponse: googleapi.ServerResponse{
  7422. Header: res.Header,
  7423. HTTPStatusCode: res.StatusCode,
  7424. },
  7425. }
  7426. target := &ret
  7427. if err := gensupport.DecodeResponse(target, res); err != nil {
  7428. return nil, err
  7429. }
  7430. return ret, nil
  7431. // {
  7432. // "description": "Moves a file to the trash. The currently authenticated user must own the file or be an organizer on the parent for Team Drive files.",
  7433. // "httpMethod": "POST",
  7434. // "id": "drive.files.trash",
  7435. // "parameterOrder": [
  7436. // "fileId"
  7437. // ],
  7438. // "parameters": {
  7439. // "fileId": {
  7440. // "description": "The ID of the file to trash.",
  7441. // "location": "path",
  7442. // "required": true,
  7443. // "type": "string"
  7444. // },
  7445. // "supportsTeamDrives": {
  7446. // "default": "false",
  7447. // "description": "Whether the requesting application supports Team Drives.",
  7448. // "location": "query",
  7449. // "type": "boolean"
  7450. // }
  7451. // },
  7452. // "path": "files/{fileId}/trash",
  7453. // "response": {
  7454. // "$ref": "File"
  7455. // },
  7456. // "scopes": [
  7457. // "https://www.googleapis.com/auth/drive",
  7458. // "https://www.googleapis.com/auth/drive.appdata",
  7459. // "https://www.googleapis.com/auth/drive.apps.readonly",
  7460. // "https://www.googleapis.com/auth/drive.file"
  7461. // ]
  7462. // }
  7463. }
  7464. // method id "drive.files.untrash":
  7465. type FilesUntrashCall struct {
  7466. s *Service
  7467. fileId string
  7468. urlParams_ gensupport.URLParams
  7469. ctx_ context.Context
  7470. header_ http.Header
  7471. }
  7472. // Untrash: Restores a file from the trash.
  7473. func (r *FilesService) Untrash(fileId string) *FilesUntrashCall {
  7474. c := &FilesUntrashCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  7475. c.fileId = fileId
  7476. return c
  7477. }
  7478. // SupportsTeamDrives sets the optional parameter "supportsTeamDrives":
  7479. // Whether the requesting application supports Team Drives.
  7480. func (c *FilesUntrashCall) SupportsTeamDrives(supportsTeamDrives bool) *FilesUntrashCall {
  7481. c.urlParams_.Set("supportsTeamDrives", fmt.Sprint(supportsTeamDrives))
  7482. return c
  7483. }
  7484. // Fields allows partial responses to be retrieved. See
  7485. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  7486. // for more information.
  7487. func (c *FilesUntrashCall) Fields(s ...googleapi.Field) *FilesUntrashCall {
  7488. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  7489. return c
  7490. }
  7491. // Context sets the context to be used in this call's Do method. Any
  7492. // pending HTTP request will be aborted if the provided context is
  7493. // canceled.
  7494. func (c *FilesUntrashCall) Context(ctx context.Context) *FilesUntrashCall {
  7495. c.ctx_ = ctx
  7496. return c
  7497. }
  7498. // Header returns an http.Header that can be modified by the caller to
  7499. // add HTTP headers to the request.
  7500. func (c *FilesUntrashCall) Header() http.Header {
  7501. if c.header_ == nil {
  7502. c.header_ = make(http.Header)
  7503. }
  7504. return c.header_
  7505. }
  7506. func (c *FilesUntrashCall) doRequest(alt string) (*http.Response, error) {
  7507. reqHeaders := make(http.Header)
  7508. for k, v := range c.header_ {
  7509. reqHeaders[k] = v
  7510. }
  7511. reqHeaders.Set("User-Agent", c.s.userAgent())
  7512. var body io.Reader = nil
  7513. c.urlParams_.Set("alt", alt)
  7514. urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/untrash")
  7515. urls += "?" + c.urlParams_.Encode()
  7516. req, _ := http.NewRequest("POST", urls, body)
  7517. req.Header = reqHeaders
  7518. googleapi.Expand(req.URL, map[string]string{
  7519. "fileId": c.fileId,
  7520. })
  7521. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  7522. }
  7523. // Do executes the "drive.files.untrash" call.
  7524. // Exactly one of *File or error will be non-nil. Any non-2xx status
  7525. // code is an error. Response headers are in either
  7526. // *File.ServerResponse.Header or (if a response was returned at all) in
  7527. // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  7528. // whether the returned error was because http.StatusNotModified was
  7529. // returned.
  7530. func (c *FilesUntrashCall) Do(opts ...googleapi.CallOption) (*File, error) {
  7531. gensupport.SetOptions(c.urlParams_, opts...)
  7532. res, err := c.doRequest("json")
  7533. if res != nil && res.StatusCode == http.StatusNotModified {
  7534. if res.Body != nil {
  7535. res.Body.Close()
  7536. }
  7537. return nil, &googleapi.Error{
  7538. Code: res.StatusCode,
  7539. Header: res.Header,
  7540. }
  7541. }
  7542. if err != nil {
  7543. return nil, err
  7544. }
  7545. defer googleapi.CloseBody(res)
  7546. if err := googleapi.CheckResponse(res); err != nil {
  7547. return nil, err
  7548. }
  7549. ret := &File{
  7550. ServerResponse: googleapi.ServerResponse{
  7551. Header: res.Header,
  7552. HTTPStatusCode: res.StatusCode,
  7553. },
  7554. }
  7555. target := &ret
  7556. if err := gensupport.DecodeResponse(target, res); err != nil {
  7557. return nil, err
  7558. }
  7559. return ret, nil
  7560. // {
  7561. // "description": "Restores a file from the trash.",
  7562. // "httpMethod": "POST",
  7563. // "id": "drive.files.untrash",
  7564. // "parameterOrder": [
  7565. // "fileId"
  7566. // ],
  7567. // "parameters": {
  7568. // "fileId": {
  7569. // "description": "The ID of the file to untrash.",
  7570. // "location": "path",
  7571. // "required": true,
  7572. // "type": "string"
  7573. // },
  7574. // "supportsTeamDrives": {
  7575. // "default": "false",
  7576. // "description": "Whether the requesting application supports Team Drives.",
  7577. // "location": "query",
  7578. // "type": "boolean"
  7579. // }
  7580. // },
  7581. // "path": "files/{fileId}/untrash",
  7582. // "response": {
  7583. // "$ref": "File"
  7584. // },
  7585. // "scopes": [
  7586. // "https://www.googleapis.com/auth/drive",
  7587. // "https://www.googleapis.com/auth/drive.appdata",
  7588. // "https://www.googleapis.com/auth/drive.apps.readonly",
  7589. // "https://www.googleapis.com/auth/drive.file"
  7590. // ]
  7591. // }
  7592. }
  7593. // method id "drive.files.update":
  7594. type FilesUpdateCall struct {
  7595. s *Service
  7596. fileId string
  7597. file *File
  7598. urlParams_ gensupport.URLParams
  7599. mediaInfo_ *gensupport.MediaInfo
  7600. ctx_ context.Context
  7601. header_ http.Header
  7602. }
  7603. // Update: Updates file metadata and/or content.
  7604. func (r *FilesService) Update(fileId string, file *File) *FilesUpdateCall {
  7605. c := &FilesUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  7606. c.fileId = fileId
  7607. c.file = file
  7608. return c
  7609. }
  7610. // AddParents sets the optional parameter "addParents": Comma-separated
  7611. // list of parent IDs to add.
  7612. func (c *FilesUpdateCall) AddParents(addParents string) *FilesUpdateCall {
  7613. c.urlParams_.Set("addParents", addParents)
  7614. return c
  7615. }
  7616. // Convert sets the optional parameter "convert": This parameter is
  7617. // deprecated and has no function.
  7618. func (c *FilesUpdateCall) Convert(convert bool) *FilesUpdateCall {
  7619. c.urlParams_.Set("convert", fmt.Sprint(convert))
  7620. return c
  7621. }
  7622. // ModifiedDateBehavior sets the optional parameter
  7623. // "modifiedDateBehavior": Determines the behavior in which modifiedDate
  7624. // is updated. This overrides setModifiedDate.
  7625. //
  7626. // Possible values:
  7627. // "fromBody" - Set modifiedDate to the value provided in the body of
  7628. // the request. No change if no value was provided.
  7629. // "fromBodyIfNeeded" - Set modifiedDate to the value provided in the
  7630. // body of the request depending on other contents of the update.
  7631. // "fromBodyOrNow" - Set modifiedDate to the value provided in the
  7632. // body of the request, or to the current time if no value was provided.
  7633. // "noChange" - Maintain the previous value of modifiedDate.
  7634. // "now" - Set modifiedDate to the current time.
  7635. // "nowIfNeeded" - Set modifiedDate to the current time depending on
  7636. // contents of the update.
  7637. func (c *FilesUpdateCall) ModifiedDateBehavior(modifiedDateBehavior string) *FilesUpdateCall {
  7638. c.urlParams_.Set("modifiedDateBehavior", modifiedDateBehavior)
  7639. return c
  7640. }
  7641. // NewRevision sets the optional parameter "newRevision": Whether a blob
  7642. // upload should create a new revision. If false, the blob data in the
  7643. // current head revision is replaced. If true or not set, a new blob is
  7644. // created as head revision, and previous unpinned revisions are
  7645. // preserved for a short period of time. Pinned revisions are stored
  7646. // indefinitely, using additional storage quota, up to a maximum of 200
  7647. // revisions. For details on how revisions are retained, see the Drive
  7648. // Help Center.
  7649. func (c *FilesUpdateCall) NewRevision(newRevision bool) *FilesUpdateCall {
  7650. c.urlParams_.Set("newRevision", fmt.Sprint(newRevision))
  7651. return c
  7652. }
  7653. // Ocr sets the optional parameter "ocr": Whether to attempt OCR on
  7654. // .jpg, .png, .gif, or .pdf uploads.
  7655. func (c *FilesUpdateCall) Ocr(ocr bool) *FilesUpdateCall {
  7656. c.urlParams_.Set("ocr", fmt.Sprint(ocr))
  7657. return c
  7658. }
  7659. // OcrLanguage sets the optional parameter "ocrLanguage": If ocr is
  7660. // true, hints at the language to use. Valid values are BCP 47 codes.
  7661. func (c *FilesUpdateCall) OcrLanguage(ocrLanguage string) *FilesUpdateCall {
  7662. c.urlParams_.Set("ocrLanguage", ocrLanguage)
  7663. return c
  7664. }
  7665. // Pinned sets the optional parameter "pinned": Whether to pin the new
  7666. // revision. A file can have a maximum of 200 pinned revisions.
  7667. func (c *FilesUpdateCall) Pinned(pinned bool) *FilesUpdateCall {
  7668. c.urlParams_.Set("pinned", fmt.Sprint(pinned))
  7669. return c
  7670. }
  7671. // RemoveParents sets the optional parameter "removeParents":
  7672. // Comma-separated list of parent IDs to remove.
  7673. func (c *FilesUpdateCall) RemoveParents(removeParents string) *FilesUpdateCall {
  7674. c.urlParams_.Set("removeParents", removeParents)
  7675. return c
  7676. }
  7677. // SetModifiedDate sets the optional parameter "setModifiedDate":
  7678. // Whether to set the modified date using the value supplied in the
  7679. // request body. Setting this field to true is equivalent to
  7680. // modifiedDateBehavior=fromBodyOrNow, and false is equivalent to
  7681. // modifiedDateBehavior=now. To prevent any changes to the modified date
  7682. // set modifiedDateBehavior=noChange.
  7683. func (c *FilesUpdateCall) SetModifiedDate(setModifiedDate bool) *FilesUpdateCall {
  7684. c.urlParams_.Set("setModifiedDate", fmt.Sprint(setModifiedDate))
  7685. return c
  7686. }
  7687. // SupportsTeamDrives sets the optional parameter "supportsTeamDrives":
  7688. // Whether the requesting application supports Team Drives.
  7689. func (c *FilesUpdateCall) SupportsTeamDrives(supportsTeamDrives bool) *FilesUpdateCall {
  7690. c.urlParams_.Set("supportsTeamDrives", fmt.Sprint(supportsTeamDrives))
  7691. return c
  7692. }
  7693. // TimedTextLanguage sets the optional parameter "timedTextLanguage":
  7694. // The language of the timed text.
  7695. func (c *FilesUpdateCall) TimedTextLanguage(timedTextLanguage string) *FilesUpdateCall {
  7696. c.urlParams_.Set("timedTextLanguage", timedTextLanguage)
  7697. return c
  7698. }
  7699. // TimedTextTrackName sets the optional parameter "timedTextTrackName":
  7700. // The timed text track name.
  7701. func (c *FilesUpdateCall) TimedTextTrackName(timedTextTrackName string) *FilesUpdateCall {
  7702. c.urlParams_.Set("timedTextTrackName", timedTextTrackName)
  7703. return c
  7704. }
  7705. // UpdateViewedDate sets the optional parameter "updateViewedDate":
  7706. // Whether to update the view date after successfully updating the file.
  7707. func (c *FilesUpdateCall) UpdateViewedDate(updateViewedDate bool) *FilesUpdateCall {
  7708. c.urlParams_.Set("updateViewedDate", fmt.Sprint(updateViewedDate))
  7709. return c
  7710. }
  7711. // UseContentAsIndexableText sets the optional parameter
  7712. // "useContentAsIndexableText": Whether to use the content as indexable
  7713. // text.
  7714. func (c *FilesUpdateCall) UseContentAsIndexableText(useContentAsIndexableText bool) *FilesUpdateCall {
  7715. c.urlParams_.Set("useContentAsIndexableText", fmt.Sprint(useContentAsIndexableText))
  7716. return c
  7717. }
  7718. // Media specifies the media to upload in one or more chunks. The chunk
  7719. // size may be controlled by supplying a MediaOption generated by
  7720. // googleapi.ChunkSize. The chunk size defaults to
  7721. // googleapi.DefaultUploadChunkSize.The Content-Type header used in the
  7722. // upload request will be determined by sniffing the contents of r,
  7723. // unless a MediaOption generated by googleapi.ContentType is
  7724. // supplied.
  7725. // At most one of Media and ResumableMedia may be set.
  7726. func (c *FilesUpdateCall) Media(r io.Reader, options ...googleapi.MediaOption) *FilesUpdateCall {
  7727. c.mediaInfo_ = gensupport.NewInfoFromMedia(r, options)
  7728. return c
  7729. }
  7730. // ResumableMedia specifies the media to upload in chunks and can be
  7731. // canceled with ctx.
  7732. //
  7733. // Deprecated: use Media instead.
  7734. //
  7735. // At most one of Media and ResumableMedia may be set. mediaType
  7736. // identifies the MIME media type of the upload, such as "image/png". If
  7737. // mediaType is "", it will be auto-detected. The provided ctx will
  7738. // supersede any context previously provided to the Context method.
  7739. func (c *FilesUpdateCall) ResumableMedia(ctx context.Context, r io.ReaderAt, size int64, mediaType string) *FilesUpdateCall {
  7740. c.ctx_ = ctx
  7741. c.mediaInfo_ = gensupport.NewInfoFromResumableMedia(r, size, mediaType)
  7742. return c
  7743. }
  7744. // ProgressUpdater provides a callback function that will be called
  7745. // after every chunk. It should be a low-latency function in order to
  7746. // not slow down the upload operation. This should only be called when
  7747. // using ResumableMedia (as opposed to Media).
  7748. func (c *FilesUpdateCall) ProgressUpdater(pu googleapi.ProgressUpdater) *FilesUpdateCall {
  7749. c.mediaInfo_.SetProgressUpdater(pu)
  7750. return c
  7751. }
  7752. // Fields allows partial responses to be retrieved. See
  7753. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  7754. // for more information.
  7755. func (c *FilesUpdateCall) Fields(s ...googleapi.Field) *FilesUpdateCall {
  7756. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  7757. return c
  7758. }
  7759. // Context sets the context to be used in this call's Do method. Any
  7760. // pending HTTP request will be aborted if the provided context is
  7761. // canceled.
  7762. // This context will supersede any context previously provided to the
  7763. // ResumableMedia method.
  7764. func (c *FilesUpdateCall) Context(ctx context.Context) *FilesUpdateCall {
  7765. c.ctx_ = ctx
  7766. return c
  7767. }
  7768. // Header returns an http.Header that can be modified by the caller to
  7769. // add HTTP headers to the request.
  7770. func (c *FilesUpdateCall) Header() http.Header {
  7771. if c.header_ == nil {
  7772. c.header_ = make(http.Header)
  7773. }
  7774. return c.header_
  7775. }
  7776. func (c *FilesUpdateCall) doRequest(alt string) (*http.Response, error) {
  7777. reqHeaders := make(http.Header)
  7778. for k, v := range c.header_ {
  7779. reqHeaders[k] = v
  7780. }
  7781. reqHeaders.Set("User-Agent", c.s.userAgent())
  7782. var body io.Reader = nil
  7783. body, err := googleapi.WithoutDataWrapper.JSONReader(c.file)
  7784. if err != nil {
  7785. return nil, err
  7786. }
  7787. reqHeaders.Set("Content-Type", "application/json")
  7788. c.urlParams_.Set("alt", alt)
  7789. urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}")
  7790. if c.mediaInfo_ != nil {
  7791. urls = strings.Replace(urls, "https://www.googleapis.com/", "https://www.googleapis.com/upload/", 1)
  7792. c.urlParams_.Set("uploadType", c.mediaInfo_.UploadType())
  7793. }
  7794. if body == nil {
  7795. body = new(bytes.Buffer)
  7796. reqHeaders.Set("Content-Type", "application/json")
  7797. }
  7798. body, getBody, cleanup := c.mediaInfo_.UploadRequest(reqHeaders, body)
  7799. defer cleanup()
  7800. urls += "?" + c.urlParams_.Encode()
  7801. req, _ := http.NewRequest("PUT", urls, body)
  7802. req.Header = reqHeaders
  7803. gensupport.SetGetBody(req, getBody)
  7804. googleapi.Expand(req.URL, map[string]string{
  7805. "fileId": c.fileId,
  7806. })
  7807. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  7808. }
  7809. // Do executes the "drive.files.update" call.
  7810. // Exactly one of *File or error will be non-nil. Any non-2xx status
  7811. // code is an error. Response headers are in either
  7812. // *File.ServerResponse.Header or (if a response was returned at all) in
  7813. // error.(*googleapi.Error).Header. Use googleapi.IsNotModified to check
  7814. // whether the returned error was because http.StatusNotModified was
  7815. // returned.
  7816. func (c *FilesUpdateCall) Do(opts ...googleapi.CallOption) (*File, error) {
  7817. gensupport.SetOptions(c.urlParams_, opts...)
  7818. res, err := c.doRequest("json")
  7819. if res != nil && res.StatusCode == http.StatusNotModified {
  7820. if res.Body != nil {
  7821. res.Body.Close()
  7822. }
  7823. return nil, &googleapi.Error{
  7824. Code: res.StatusCode,
  7825. Header: res.Header,
  7826. }
  7827. }
  7828. if err != nil {
  7829. return nil, err
  7830. }
  7831. defer googleapi.CloseBody(res)
  7832. if err := googleapi.CheckResponse(res); err != nil {
  7833. return nil, err
  7834. }
  7835. rx := c.mediaInfo_.ResumableUpload(res.Header.Get("Location"))
  7836. if rx != nil {
  7837. rx.Client = c.s.client
  7838. rx.UserAgent = c.s.userAgent()
  7839. ctx := c.ctx_
  7840. if ctx == nil {
  7841. ctx = context.TODO()
  7842. }
  7843. res, err = rx.Upload(ctx)
  7844. if err != nil {
  7845. return nil, err
  7846. }
  7847. defer res.Body.Close()
  7848. if err := googleapi.CheckResponse(res); err != nil {
  7849. return nil, err
  7850. }
  7851. }
  7852. ret := &File{
  7853. ServerResponse: googleapi.ServerResponse{
  7854. Header: res.Header,
  7855. HTTPStatusCode: res.StatusCode,
  7856. },
  7857. }
  7858. target := &ret
  7859. if err := gensupport.DecodeResponse(target, res); err != nil {
  7860. return nil, err
  7861. }
  7862. return ret, nil
  7863. // {
  7864. // "description": "Updates file metadata and/or content.",
  7865. // "httpMethod": "PUT",
  7866. // "id": "drive.files.update",
  7867. // "mediaUpload": {
  7868. // "accept": [
  7869. // "*/*"
  7870. // ],
  7871. // "maxSize": "5120GB",
  7872. // "protocols": {
  7873. // "resumable": {
  7874. // "multipart": true,
  7875. // "path": "/resumable/upload/drive/v2/files/{fileId}"
  7876. // },
  7877. // "simple": {
  7878. // "multipart": true,
  7879. // "path": "/upload/drive/v2/files/{fileId}"
  7880. // }
  7881. // }
  7882. // },
  7883. // "parameterOrder": [
  7884. // "fileId"
  7885. // ],
  7886. // "parameters": {
  7887. // "addParents": {
  7888. // "description": "Comma-separated list of parent IDs to add.",
  7889. // "location": "query",
  7890. // "type": "string"
  7891. // },
  7892. // "convert": {
  7893. // "default": "false",
  7894. // "description": "This parameter is deprecated and has no function.",
  7895. // "location": "query",
  7896. // "type": "boolean"
  7897. // },
  7898. // "fileId": {
  7899. // "description": "The ID of the file to update.",
  7900. // "location": "path",
  7901. // "required": true,
  7902. // "type": "string"
  7903. // },
  7904. // "modifiedDateBehavior": {
  7905. // "description": "Determines the behavior in which modifiedDate is updated. This overrides setModifiedDate.",
  7906. // "enum": [
  7907. // "fromBody",
  7908. // "fromBodyIfNeeded",
  7909. // "fromBodyOrNow",
  7910. // "noChange",
  7911. // "now",
  7912. // "nowIfNeeded"
  7913. // ],
  7914. // "enumDescriptions": [
  7915. // "Set modifiedDate to the value provided in the body of the request. No change if no value was provided.",
  7916. // "Set modifiedDate to the value provided in the body of the request depending on other contents of the update.",
  7917. // "Set modifiedDate to the value provided in the body of the request, or to the current time if no value was provided.",
  7918. // "Maintain the previous value of modifiedDate.",
  7919. // "Set modifiedDate to the current time.",
  7920. // "Set modifiedDate to the current time depending on contents of the update."
  7921. // ],
  7922. // "location": "query",
  7923. // "type": "string"
  7924. // },
  7925. // "newRevision": {
  7926. // "default": "true",
  7927. // "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.",
  7928. // "location": "query",
  7929. // "type": "boolean"
  7930. // },
  7931. // "ocr": {
  7932. // "default": "false",
  7933. // "description": "Whether to attempt OCR on .jpg, .png, .gif, or .pdf uploads.",
  7934. // "location": "query",
  7935. // "type": "boolean"
  7936. // },
  7937. // "ocrLanguage": {
  7938. // "description": "If ocr is true, hints at the language to use. Valid values are BCP 47 codes.",
  7939. // "location": "query",
  7940. // "type": "string"
  7941. // },
  7942. // "pinned": {
  7943. // "default": "false",
  7944. // "description": "Whether to pin the new revision. A file can have a maximum of 200 pinned revisions.",
  7945. // "location": "query",
  7946. // "type": "boolean"
  7947. // },
  7948. // "removeParents": {
  7949. // "description": "Comma-separated list of parent IDs to remove.",
  7950. // "location": "query",
  7951. // "type": "string"
  7952. // },
  7953. // "setModifiedDate": {
  7954. // "default": "false",
  7955. // "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.",
  7956. // "location": "query",
  7957. // "type": "boolean"
  7958. // },
  7959. // "supportsTeamDrives": {
  7960. // "default": "false",
  7961. // "description": "Whether the requesting application supports Team Drives.",
  7962. // "location": "query",
  7963. // "type": "boolean"
  7964. // },
  7965. // "timedTextLanguage": {
  7966. // "description": "The language of the timed text.",
  7967. // "location": "query",
  7968. // "type": "string"
  7969. // },
  7970. // "timedTextTrackName": {
  7971. // "description": "The timed text track name.",
  7972. // "location": "query",
  7973. // "type": "string"
  7974. // },
  7975. // "updateViewedDate": {
  7976. // "default": "true",
  7977. // "description": "Whether to update the view date after successfully updating the file.",
  7978. // "location": "query",
  7979. // "type": "boolean"
  7980. // },
  7981. // "useContentAsIndexableText": {
  7982. // "default": "false",
  7983. // "description": "Whether to use the content as indexable text.",
  7984. // "location": "query",
  7985. // "type": "boolean"
  7986. // }
  7987. // },
  7988. // "path": "files/{fileId}",
  7989. // "request": {
  7990. // "$ref": "File"
  7991. // },
  7992. // "response": {
  7993. // "$ref": "File"
  7994. // },
  7995. // "scopes": [
  7996. // "https://www.googleapis.com/auth/drive",
  7997. // "https://www.googleapis.com/auth/drive.appdata",
  7998. // "https://www.googleapis.com/auth/drive.apps.readonly",
  7999. // "https://www.googleapis.com/auth/drive.file",
  8000. // "https://www.googleapis.com/auth/drive.metadata",
  8001. // "https://www.googleapis.com/auth/drive.scripts"
  8002. // ],
  8003. // "supportsMediaUpload": true
  8004. // }
  8005. }
  8006. // method id "drive.files.watch":
  8007. type FilesWatchCall struct {
  8008. s *Service
  8009. fileId string
  8010. channel *Channel
  8011. urlParams_ gensupport.URLParams
  8012. ctx_ context.Context
  8013. header_ http.Header
  8014. }
  8015. // Watch: Subscribe to changes on a file
  8016. func (r *FilesService) Watch(fileId string, channel *Channel) *FilesWatchCall {
  8017. c := &FilesWatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  8018. c.fileId = fileId
  8019. c.channel = channel
  8020. return c
  8021. }
  8022. // AcknowledgeAbuse sets the optional parameter "acknowledgeAbuse":
  8023. // Whether the user is acknowledging the risk of downloading known
  8024. // malware or other abusive files.
  8025. func (c *FilesWatchCall) AcknowledgeAbuse(acknowledgeAbuse bool) *FilesWatchCall {
  8026. c.urlParams_.Set("acknowledgeAbuse", fmt.Sprint(acknowledgeAbuse))
  8027. return c
  8028. }
  8029. // Projection sets the optional parameter "projection": This parameter
  8030. // is deprecated and has no function.
  8031. //
  8032. // Possible values:
  8033. // "BASIC" - Deprecated
  8034. // "FULL" - Deprecated
  8035. func (c *FilesWatchCall) Projection(projection string) *FilesWatchCall {
  8036. c.urlParams_.Set("projection", projection)
  8037. return c
  8038. }
  8039. // RevisionId sets the optional parameter "revisionId": Specifies the
  8040. // Revision ID that should be downloaded. Ignored unless alt=media is
  8041. // specified.
  8042. func (c *FilesWatchCall) RevisionId(revisionId string) *FilesWatchCall {
  8043. c.urlParams_.Set("revisionId", revisionId)
  8044. return c
  8045. }
  8046. // SupportsTeamDrives sets the optional parameter "supportsTeamDrives":
  8047. // Whether the requesting application supports Team Drives.
  8048. func (c *FilesWatchCall) SupportsTeamDrives(supportsTeamDrives bool) *FilesWatchCall {
  8049. c.urlParams_.Set("supportsTeamDrives", fmt.Sprint(supportsTeamDrives))
  8050. return c
  8051. }
  8052. // UpdateViewedDate sets the optional parameter "updateViewedDate":
  8053. // Deprecated: Use files.update with modifiedDateBehavior=noChange,
  8054. // updateViewedDate=true and an empty request body.
  8055. func (c *FilesWatchCall) UpdateViewedDate(updateViewedDate bool) *FilesWatchCall {
  8056. c.urlParams_.Set("updateViewedDate", fmt.Sprint(updateViewedDate))
  8057. return c
  8058. }
  8059. // Fields allows partial responses to be retrieved. See
  8060. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  8061. // for more information.
  8062. func (c *FilesWatchCall) Fields(s ...googleapi.Field) *FilesWatchCall {
  8063. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  8064. return c
  8065. }
  8066. // Context sets the context to be used in this call's Do and Download
  8067. // methods. Any pending HTTP request will be aborted if the provided
  8068. // context is canceled.
  8069. func (c *FilesWatchCall) Context(ctx context.Context) *FilesWatchCall {
  8070. c.ctx_ = ctx
  8071. return c
  8072. }
  8073. // Header returns an http.Header that can be modified by the caller to
  8074. // add HTTP headers to the request.
  8075. func (c *FilesWatchCall) Header() http.Header {
  8076. if c.header_ == nil {
  8077. c.header_ = make(http.Header)
  8078. }
  8079. return c.header_
  8080. }
  8081. func (c *FilesWatchCall) doRequest(alt string) (*http.Response, error) {
  8082. reqHeaders := make(http.Header)
  8083. for k, v := range c.header_ {
  8084. reqHeaders[k] = v
  8085. }
  8086. reqHeaders.Set("User-Agent", c.s.userAgent())
  8087. var body io.Reader = nil
  8088. body, err := googleapi.WithoutDataWrapper.JSONReader(c.channel)
  8089. if err != nil {
  8090. return nil, err
  8091. }
  8092. reqHeaders.Set("Content-Type", "application/json")
  8093. c.urlParams_.Set("alt", alt)
  8094. urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/watch")
  8095. urls += "?" + c.urlParams_.Encode()
  8096. req, _ := http.NewRequest("POST", urls, body)
  8097. req.Header = reqHeaders
  8098. googleapi.Expand(req.URL, map[string]string{
  8099. "fileId": c.fileId,
  8100. })
  8101. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  8102. }
  8103. // Download fetches the API endpoint's "media" value, instead of the normal
  8104. // API response value. If the returned error is nil, the Response is guaranteed to
  8105. // have a 2xx status code. Callers must close the Response.Body as usual.
  8106. func (c *FilesWatchCall) Download(opts ...googleapi.CallOption) (*http.Response, error) {
  8107. gensupport.SetOptions(c.urlParams_, opts...)
  8108. res, err := c.doRequest("media")
  8109. if err != nil {
  8110. return nil, err
  8111. }
  8112. if err := googleapi.CheckMediaResponse(res); err != nil {
  8113. res.Body.Close()
  8114. return nil, err
  8115. }
  8116. return res, nil
  8117. }
  8118. // Do executes the "drive.files.watch" call.
  8119. // Exactly one of *Channel or error will be non-nil. Any non-2xx status
  8120. // code is an error. Response headers are in either
  8121. // *Channel.ServerResponse.Header or (if a response was returned at all)
  8122. // in error.(*googleapi.Error).Header. Use googleapi.IsNotModified to
  8123. // check whether the returned error was because http.StatusNotModified
  8124. // was returned.
  8125. func (c *FilesWatchCall) Do(opts ...googleapi.CallOption) (*Channel, error) {
  8126. gensupport.SetOptions(c.urlParams_, opts...)
  8127. res, err := c.doRequest("json")
  8128. if res != nil && res.StatusCode == http.StatusNotModified {
  8129. if res.Body != nil {
  8130. res.Body.Close()
  8131. }
  8132. return nil, &googleapi.Error{
  8133. Code: res.StatusCode,
  8134. Header: res.Header,
  8135. }
  8136. }
  8137. if err != nil {
  8138. return nil, err
  8139. }
  8140. defer googleapi.CloseBody(res)
  8141. if err := googleapi.CheckResponse(res); err != nil {
  8142. return nil, err
  8143. }
  8144. ret := &Channel{
  8145. ServerResponse: googleapi.ServerResponse{
  8146. Header: res.Header,
  8147. HTTPStatusCode: res.StatusCode,
  8148. },
  8149. }
  8150. target := &ret
  8151. if err := gensupport.DecodeResponse(target, res); err != nil {
  8152. return nil, err
  8153. }
  8154. return ret, nil
  8155. // {
  8156. // "description": "Subscribe to changes on a file",
  8157. // "httpMethod": "POST",
  8158. // "id": "drive.files.watch",
  8159. // "parameterOrder": [
  8160. // "fileId"
  8161. // ],
  8162. // "parameters": {
  8163. // "acknowledgeAbuse": {
  8164. // "default": "false",
  8165. // "description": "Whether the user is acknowledging the risk of downloading known malware or other abusive files.",
  8166. // "location": "query",
  8167. // "type": "boolean"
  8168. // },
  8169. // "fileId": {
  8170. // "description": "The ID for the file in question.",
  8171. // "location": "path",
  8172. // "required": true,
  8173. // "type": "string"
  8174. // },
  8175. // "projection": {
  8176. // "description": "This parameter is deprecated and has no function.",
  8177. // "enum": [
  8178. // "BASIC",
  8179. // "FULL"
  8180. // ],
  8181. // "enumDescriptions": [
  8182. // "Deprecated",
  8183. // "Deprecated"
  8184. // ],
  8185. // "location": "query",
  8186. // "type": "string"
  8187. // },
  8188. // "revisionId": {
  8189. // "description": "Specifies the Revision ID that should be downloaded. Ignored unless alt=media is specified.",
  8190. // "location": "query",
  8191. // "type": "string"
  8192. // },
  8193. // "supportsTeamDrives": {
  8194. // "default": "false",
  8195. // "description": "Whether the requesting application supports Team Drives.",
  8196. // "location": "query",
  8197. // "type": "boolean"
  8198. // },
  8199. // "updateViewedDate": {
  8200. // "default": "false",
  8201. // "description": "Deprecated: Use files.update with modifiedDateBehavior=noChange, updateViewedDate=true and an empty request body.",
  8202. // "location": "query",
  8203. // "type": "boolean"
  8204. // }
  8205. // },
  8206. // "path": "files/{fileId}/watch",
  8207. // "request": {
  8208. // "$ref": "Channel",
  8209. // "parameterName": "resource"
  8210. // },
  8211. // "response": {
  8212. // "$ref": "Channel"
  8213. // },
  8214. // "scopes": [
  8215. // "https://www.googleapis.com/auth/drive",
  8216. // "https://www.googleapis.com/auth/drive.appdata",
  8217. // "https://www.googleapis.com/auth/drive.file",
  8218. // "https://www.googleapis.com/auth/drive.metadata",
  8219. // "https://www.googleapis.com/auth/drive.metadata.readonly",
  8220. // "https://www.googleapis.com/auth/drive.photos.readonly",
  8221. // "https://www.googleapis.com/auth/drive.readonly"
  8222. // ],
  8223. // "supportsMediaDownload": true,
  8224. // "supportsSubscription": true,
  8225. // "useMediaDownloadService": true
  8226. // }
  8227. }
  8228. // method id "drive.parents.delete":
  8229. type ParentsDeleteCall struct {
  8230. s *Service
  8231. fileId string
  8232. parentId string
  8233. urlParams_ gensupport.URLParams
  8234. ctx_ context.Context
  8235. header_ http.Header
  8236. }
  8237. // Delete: Removes a parent from a file.
  8238. func (r *ParentsService) Delete(fileId string, parentId string) *ParentsDeleteCall {
  8239. c := &ParentsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  8240. c.fileId = fileId
  8241. c.parentId = parentId
  8242. return c
  8243. }
  8244. // Fields allows partial responses to be retrieved. See
  8245. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  8246. // for more information.
  8247. func (c *ParentsDeleteCall) Fields(s ...googleapi.Field) *ParentsDeleteCall {
  8248. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  8249. return c
  8250. }
  8251. // Context sets the context to be used in this call's Do method. Any
  8252. // pending HTTP request will be aborted if the provided context is
  8253. // canceled.
  8254. func (c *ParentsDeleteCall) Context(ctx context.Context) *ParentsDeleteCall {
  8255. c.ctx_ = ctx
  8256. return c
  8257. }
  8258. // Header returns an http.Header that can be modified by the caller to
  8259. // add HTTP headers to the request.
  8260. func (c *ParentsDeleteCall) Header() http.Header {
  8261. if c.header_ == nil {
  8262. c.header_ = make(http.Header)
  8263. }
  8264. return c.header_
  8265. }
  8266. func (c *ParentsDeleteCall) doRequest(alt string) (*http.Response, error) {
  8267. reqHeaders := make(http.Header)
  8268. for k, v := range c.header_ {
  8269. reqHeaders[k] = v
  8270. }
  8271. reqHeaders.Set("User-Agent", c.s.userAgent())
  8272. var body io.Reader = nil
  8273. c.urlParams_.Set("alt", alt)
  8274. urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/parents/{parentId}")
  8275. urls += "?" + c.urlParams_.Encode()
  8276. req, _ := http.NewRequest("DELETE", urls, body)
  8277. req.Header = reqHeaders
  8278. googleapi.Expand(req.URL, map[string]string{
  8279. "fileId": c.fileId,
  8280. "parentId": c.parentId,
  8281. })
  8282. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  8283. }
  8284. // Do executes the "drive.parents.delete" call.
  8285. func (c *ParentsDeleteCall) Do(opts ...googleapi.CallOption) error {
  8286. gensupport.SetOptions(c.urlParams_, opts...)
  8287. res, err := c.doRequest("json")
  8288. if err != nil {
  8289. return err
  8290. }
  8291. defer googleapi.CloseBody(res)
  8292. if err := googleapi.CheckResponse(res); err != nil {
  8293. return err
  8294. }
  8295. return nil
  8296. // {
  8297. // "description": "Removes a parent from a file.",
  8298. // "httpMethod": "DELETE",
  8299. // "id": "drive.parents.delete",
  8300. // "parameterOrder": [
  8301. // "fileId",
  8302. // "parentId"
  8303. // ],
  8304. // "parameters": {
  8305. // "fileId": {
  8306. // "description": "The ID of the file.",
  8307. // "location": "path",
  8308. // "required": true,
  8309. // "type": "string"
  8310. // },
  8311. // "parentId": {
  8312. // "description": "The ID of the parent.",
  8313. // "location": "path",
  8314. // "required": true,
  8315. // "type": "string"
  8316. // }
  8317. // },
  8318. // "path": "files/{fileId}/parents/{parentId}",
  8319. // "scopes": [
  8320. // "https://www.googleapis.com/auth/drive",
  8321. // "https://www.googleapis.com/auth/drive.file"
  8322. // ]
  8323. // }
  8324. }
  8325. // method id "drive.parents.get":
  8326. type ParentsGetCall struct {
  8327. s *Service
  8328. fileId string
  8329. parentId string
  8330. urlParams_ gensupport.URLParams
  8331. ifNoneMatch_ string
  8332. ctx_ context.Context
  8333. header_ http.Header
  8334. }
  8335. // Get: Gets a specific parent reference.
  8336. func (r *ParentsService) Get(fileId string, parentId string) *ParentsGetCall {
  8337. c := &ParentsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  8338. c.fileId = fileId
  8339. c.parentId = parentId
  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 *ParentsGetCall) Fields(s ...googleapi.Field) *ParentsGetCall {
  8346. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  8347. return c
  8348. }
  8349. // IfNoneMatch sets the optional parameter which makes the operation
  8350. // fail if the object's ETag matches the given value. This is useful for
  8351. // getting updates only after the object has changed since the last
  8352. // request. Use googleapi.IsNotModified to check whether the response
  8353. // error from Do is the result of In-None-Match.
  8354. func (c *ParentsGetCall) IfNoneMatch(entityTag string) *ParentsGetCall {
  8355. c.ifNoneMatch_ = entityTag
  8356. return c
  8357. }
  8358. // Context sets the context to be used in this call's Do method. Any
  8359. // pending HTTP request will be aborted if the provided context is
  8360. // canceled.
  8361. func (c *ParentsGetCall) Context(ctx context.Context) *ParentsGetCall {
  8362. c.ctx_ = ctx
  8363. return c
  8364. }
  8365. // Header returns an http.Header that can be modified by the caller to
  8366. // add HTTP headers to the request.
  8367. func (c *ParentsGetCall) Header() http.Header {
  8368. if c.header_ == nil {
  8369. c.header_ = make(http.Header)
  8370. }
  8371. return c.header_
  8372. }
  8373. func (c *ParentsGetCall) doRequest(alt string) (*http.Response, error) {
  8374. reqHeaders := make(http.Header)
  8375. for k, v := range c.header_ {
  8376. reqHeaders[k] = v
  8377. }
  8378. reqHeaders.Set("User-Agent", c.s.userAgent())
  8379. if c.ifNoneMatch_ != "" {
  8380. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  8381. }
  8382. var body io.Reader = nil
  8383. c.urlParams_.Set("alt", alt)
  8384. urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/parents/{parentId}")
  8385. urls += "?" + c.urlParams_.Encode()
  8386. req, _ := http.NewRequest("GET", urls, body)
  8387. req.Header = reqHeaders
  8388. googleapi.Expand(req.URL, map[string]string{
  8389. "fileId": c.fileId,
  8390. "parentId": c.parentId,
  8391. })
  8392. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  8393. }
  8394. // Do executes the "drive.parents.get" call.
  8395. // Exactly one of *ParentReference or error will be non-nil. Any non-2xx
  8396. // status code is an error. Response headers are in either
  8397. // *ParentReference.ServerResponse.Header or (if a response was returned
  8398. // at all) in error.(*googleapi.Error).Header. Use
  8399. // googleapi.IsNotModified to check whether the returned error was
  8400. // because http.StatusNotModified was returned.
  8401. func (c *ParentsGetCall) Do(opts ...googleapi.CallOption) (*ParentReference, error) {
  8402. gensupport.SetOptions(c.urlParams_, opts...)
  8403. res, err := c.doRequest("json")
  8404. if res != nil && res.StatusCode == http.StatusNotModified {
  8405. if res.Body != nil {
  8406. res.Body.Close()
  8407. }
  8408. return nil, &googleapi.Error{
  8409. Code: res.StatusCode,
  8410. Header: res.Header,
  8411. }
  8412. }
  8413. if err != nil {
  8414. return nil, err
  8415. }
  8416. defer googleapi.CloseBody(res)
  8417. if err := googleapi.CheckResponse(res); err != nil {
  8418. return nil, err
  8419. }
  8420. ret := &ParentReference{
  8421. ServerResponse: googleapi.ServerResponse{
  8422. Header: res.Header,
  8423. HTTPStatusCode: res.StatusCode,
  8424. },
  8425. }
  8426. target := &ret
  8427. if err := gensupport.DecodeResponse(target, res); err != nil {
  8428. return nil, err
  8429. }
  8430. return ret, nil
  8431. // {
  8432. // "description": "Gets a specific parent reference.",
  8433. // "httpMethod": "GET",
  8434. // "id": "drive.parents.get",
  8435. // "parameterOrder": [
  8436. // "fileId",
  8437. // "parentId"
  8438. // ],
  8439. // "parameters": {
  8440. // "fileId": {
  8441. // "description": "The ID of the file.",
  8442. // "location": "path",
  8443. // "required": true,
  8444. // "type": "string"
  8445. // },
  8446. // "parentId": {
  8447. // "description": "The ID of the parent.",
  8448. // "location": "path",
  8449. // "required": true,
  8450. // "type": "string"
  8451. // }
  8452. // },
  8453. // "path": "files/{fileId}/parents/{parentId}",
  8454. // "response": {
  8455. // "$ref": "ParentReference"
  8456. // },
  8457. // "scopes": [
  8458. // "https://www.googleapis.com/auth/drive",
  8459. // "https://www.googleapis.com/auth/drive.appdata",
  8460. // "https://www.googleapis.com/auth/drive.file",
  8461. // "https://www.googleapis.com/auth/drive.metadata",
  8462. // "https://www.googleapis.com/auth/drive.metadata.readonly",
  8463. // "https://www.googleapis.com/auth/drive.photos.readonly",
  8464. // "https://www.googleapis.com/auth/drive.readonly"
  8465. // ]
  8466. // }
  8467. }
  8468. // method id "drive.parents.insert":
  8469. type ParentsInsertCall struct {
  8470. s *Service
  8471. fileId string
  8472. parentreference *ParentReference
  8473. urlParams_ gensupport.URLParams
  8474. ctx_ context.Context
  8475. header_ http.Header
  8476. }
  8477. // Insert: Adds a parent folder for a file.
  8478. func (r *ParentsService) Insert(fileId string, parentreference *ParentReference) *ParentsInsertCall {
  8479. c := &ParentsInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  8480. c.fileId = fileId
  8481. c.parentreference = parentreference
  8482. return c
  8483. }
  8484. // SupportsTeamDrives sets the optional parameter "supportsTeamDrives":
  8485. // Whether the requesting application supports Team Drives.
  8486. func (c *ParentsInsertCall) SupportsTeamDrives(supportsTeamDrives bool) *ParentsInsertCall {
  8487. c.urlParams_.Set("supportsTeamDrives", fmt.Sprint(supportsTeamDrives))
  8488. return c
  8489. }
  8490. // Fields allows partial responses to be retrieved. See
  8491. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  8492. // for more information.
  8493. func (c *ParentsInsertCall) Fields(s ...googleapi.Field) *ParentsInsertCall {
  8494. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  8495. return c
  8496. }
  8497. // Context sets the context to be used in this call's Do method. Any
  8498. // pending HTTP request will be aborted if the provided context is
  8499. // canceled.
  8500. func (c *ParentsInsertCall) Context(ctx context.Context) *ParentsInsertCall {
  8501. c.ctx_ = ctx
  8502. return c
  8503. }
  8504. // Header returns an http.Header that can be modified by the caller to
  8505. // add HTTP headers to the request.
  8506. func (c *ParentsInsertCall) Header() http.Header {
  8507. if c.header_ == nil {
  8508. c.header_ = make(http.Header)
  8509. }
  8510. return c.header_
  8511. }
  8512. func (c *ParentsInsertCall) doRequest(alt string) (*http.Response, error) {
  8513. reqHeaders := make(http.Header)
  8514. for k, v := range c.header_ {
  8515. reqHeaders[k] = v
  8516. }
  8517. reqHeaders.Set("User-Agent", c.s.userAgent())
  8518. var body io.Reader = nil
  8519. body, err := googleapi.WithoutDataWrapper.JSONReader(c.parentreference)
  8520. if err != nil {
  8521. return nil, err
  8522. }
  8523. reqHeaders.Set("Content-Type", "application/json")
  8524. c.urlParams_.Set("alt", alt)
  8525. urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/parents")
  8526. urls += "?" + c.urlParams_.Encode()
  8527. req, _ := http.NewRequest("POST", urls, body)
  8528. req.Header = reqHeaders
  8529. googleapi.Expand(req.URL, map[string]string{
  8530. "fileId": c.fileId,
  8531. })
  8532. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  8533. }
  8534. // Do executes the "drive.parents.insert" call.
  8535. // Exactly one of *ParentReference or error will be non-nil. Any non-2xx
  8536. // status code is an error. Response headers are in either
  8537. // *ParentReference.ServerResponse.Header or (if a response was returned
  8538. // at all) in error.(*googleapi.Error).Header. Use
  8539. // googleapi.IsNotModified to check whether the returned error was
  8540. // because http.StatusNotModified was returned.
  8541. func (c *ParentsInsertCall) Do(opts ...googleapi.CallOption) (*ParentReference, error) {
  8542. gensupport.SetOptions(c.urlParams_, opts...)
  8543. res, err := c.doRequest("json")
  8544. if res != nil && res.StatusCode == http.StatusNotModified {
  8545. if res.Body != nil {
  8546. res.Body.Close()
  8547. }
  8548. return nil, &googleapi.Error{
  8549. Code: res.StatusCode,
  8550. Header: res.Header,
  8551. }
  8552. }
  8553. if err != nil {
  8554. return nil, err
  8555. }
  8556. defer googleapi.CloseBody(res)
  8557. if err := googleapi.CheckResponse(res); err != nil {
  8558. return nil, err
  8559. }
  8560. ret := &ParentReference{
  8561. ServerResponse: googleapi.ServerResponse{
  8562. Header: res.Header,
  8563. HTTPStatusCode: res.StatusCode,
  8564. },
  8565. }
  8566. target := &ret
  8567. if err := gensupport.DecodeResponse(target, res); err != nil {
  8568. return nil, err
  8569. }
  8570. return ret, nil
  8571. // {
  8572. // "description": "Adds a parent folder for a file.",
  8573. // "httpMethod": "POST",
  8574. // "id": "drive.parents.insert",
  8575. // "parameterOrder": [
  8576. // "fileId"
  8577. // ],
  8578. // "parameters": {
  8579. // "fileId": {
  8580. // "description": "The ID of the file.",
  8581. // "location": "path",
  8582. // "required": true,
  8583. // "type": "string"
  8584. // },
  8585. // "supportsTeamDrives": {
  8586. // "default": "false",
  8587. // "description": "Whether the requesting application supports Team Drives.",
  8588. // "location": "query",
  8589. // "type": "boolean"
  8590. // }
  8591. // },
  8592. // "path": "files/{fileId}/parents",
  8593. // "request": {
  8594. // "$ref": "ParentReference"
  8595. // },
  8596. // "response": {
  8597. // "$ref": "ParentReference"
  8598. // },
  8599. // "scopes": [
  8600. // "https://www.googleapis.com/auth/drive",
  8601. // "https://www.googleapis.com/auth/drive.appdata",
  8602. // "https://www.googleapis.com/auth/drive.file"
  8603. // ]
  8604. // }
  8605. }
  8606. // method id "drive.parents.list":
  8607. type ParentsListCall struct {
  8608. s *Service
  8609. fileId string
  8610. urlParams_ gensupport.URLParams
  8611. ifNoneMatch_ string
  8612. ctx_ context.Context
  8613. header_ http.Header
  8614. }
  8615. // List: Lists a file's parents.
  8616. func (r *ParentsService) List(fileId string) *ParentsListCall {
  8617. c := &ParentsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  8618. c.fileId = fileId
  8619. return c
  8620. }
  8621. // Fields allows partial responses to be retrieved. See
  8622. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  8623. // for more information.
  8624. func (c *ParentsListCall) Fields(s ...googleapi.Field) *ParentsListCall {
  8625. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  8626. return c
  8627. }
  8628. // IfNoneMatch sets the optional parameter which makes the operation
  8629. // fail if the object's ETag matches the given value. This is useful for
  8630. // getting updates only after the object has changed since the last
  8631. // request. Use googleapi.IsNotModified to check whether the response
  8632. // error from Do is the result of In-None-Match.
  8633. func (c *ParentsListCall) IfNoneMatch(entityTag string) *ParentsListCall {
  8634. c.ifNoneMatch_ = entityTag
  8635. return c
  8636. }
  8637. // Context sets the context to be used in this call's Do method. Any
  8638. // pending HTTP request will be aborted if the provided context is
  8639. // canceled.
  8640. func (c *ParentsListCall) Context(ctx context.Context) *ParentsListCall {
  8641. c.ctx_ = ctx
  8642. return c
  8643. }
  8644. // Header returns an http.Header that can be modified by the caller to
  8645. // add HTTP headers to the request.
  8646. func (c *ParentsListCall) Header() http.Header {
  8647. if c.header_ == nil {
  8648. c.header_ = make(http.Header)
  8649. }
  8650. return c.header_
  8651. }
  8652. func (c *ParentsListCall) doRequest(alt string) (*http.Response, error) {
  8653. reqHeaders := make(http.Header)
  8654. for k, v := range c.header_ {
  8655. reqHeaders[k] = v
  8656. }
  8657. reqHeaders.Set("User-Agent", c.s.userAgent())
  8658. if c.ifNoneMatch_ != "" {
  8659. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  8660. }
  8661. var body io.Reader = nil
  8662. c.urlParams_.Set("alt", alt)
  8663. urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/parents")
  8664. urls += "?" + c.urlParams_.Encode()
  8665. req, _ := http.NewRequest("GET", urls, body)
  8666. req.Header = reqHeaders
  8667. googleapi.Expand(req.URL, map[string]string{
  8668. "fileId": c.fileId,
  8669. })
  8670. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  8671. }
  8672. // Do executes the "drive.parents.list" call.
  8673. // Exactly one of *ParentList or error will be non-nil. Any non-2xx
  8674. // status code is an error. Response headers are in either
  8675. // *ParentList.ServerResponse.Header or (if a response was returned at
  8676. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  8677. // to check whether the returned error was because
  8678. // http.StatusNotModified was returned.
  8679. func (c *ParentsListCall) Do(opts ...googleapi.CallOption) (*ParentList, error) {
  8680. gensupport.SetOptions(c.urlParams_, opts...)
  8681. res, err := c.doRequest("json")
  8682. if res != nil && res.StatusCode == http.StatusNotModified {
  8683. if res.Body != nil {
  8684. res.Body.Close()
  8685. }
  8686. return nil, &googleapi.Error{
  8687. Code: res.StatusCode,
  8688. Header: res.Header,
  8689. }
  8690. }
  8691. if err != nil {
  8692. return nil, err
  8693. }
  8694. defer googleapi.CloseBody(res)
  8695. if err := googleapi.CheckResponse(res); err != nil {
  8696. return nil, err
  8697. }
  8698. ret := &ParentList{
  8699. ServerResponse: googleapi.ServerResponse{
  8700. Header: res.Header,
  8701. HTTPStatusCode: res.StatusCode,
  8702. },
  8703. }
  8704. target := &ret
  8705. if err := gensupport.DecodeResponse(target, res); err != nil {
  8706. return nil, err
  8707. }
  8708. return ret, nil
  8709. // {
  8710. // "description": "Lists a file's parents.",
  8711. // "httpMethod": "GET",
  8712. // "id": "drive.parents.list",
  8713. // "parameterOrder": [
  8714. // "fileId"
  8715. // ],
  8716. // "parameters": {
  8717. // "fileId": {
  8718. // "description": "The ID of the file.",
  8719. // "location": "path",
  8720. // "required": true,
  8721. // "type": "string"
  8722. // }
  8723. // },
  8724. // "path": "files/{fileId}/parents",
  8725. // "response": {
  8726. // "$ref": "ParentList"
  8727. // },
  8728. // "scopes": [
  8729. // "https://www.googleapis.com/auth/drive",
  8730. // "https://www.googleapis.com/auth/drive.appdata",
  8731. // "https://www.googleapis.com/auth/drive.file",
  8732. // "https://www.googleapis.com/auth/drive.metadata",
  8733. // "https://www.googleapis.com/auth/drive.metadata.readonly",
  8734. // "https://www.googleapis.com/auth/drive.photos.readonly",
  8735. // "https://www.googleapis.com/auth/drive.readonly"
  8736. // ]
  8737. // }
  8738. }
  8739. // method id "drive.permissions.delete":
  8740. type PermissionsDeleteCall struct {
  8741. s *Service
  8742. fileId string
  8743. permissionId string
  8744. urlParams_ gensupport.URLParams
  8745. ctx_ context.Context
  8746. header_ http.Header
  8747. }
  8748. // Delete: Deletes a permission from a file or Team Drive.
  8749. func (r *PermissionsService) Delete(fileId string, permissionId string) *PermissionsDeleteCall {
  8750. c := &PermissionsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  8751. c.fileId = fileId
  8752. c.permissionId = permissionId
  8753. return c
  8754. }
  8755. // SupportsTeamDrives sets the optional parameter "supportsTeamDrives":
  8756. // Whether the requesting application supports Team Drives.
  8757. func (c *PermissionsDeleteCall) SupportsTeamDrives(supportsTeamDrives bool) *PermissionsDeleteCall {
  8758. c.urlParams_.Set("supportsTeamDrives", fmt.Sprint(supportsTeamDrives))
  8759. return c
  8760. }
  8761. // UseDomainAdminAccess sets the optional parameter
  8762. // "useDomainAdminAccess": Whether the request should be treated as if
  8763. // it was issued by a domain administrator; if set to true, then the
  8764. // requester will be granted access if they are an administrator of the
  8765. // domain to which the item belongs.
  8766. func (c *PermissionsDeleteCall) UseDomainAdminAccess(useDomainAdminAccess bool) *PermissionsDeleteCall {
  8767. c.urlParams_.Set("useDomainAdminAccess", fmt.Sprint(useDomainAdminAccess))
  8768. return c
  8769. }
  8770. // Fields allows partial responses to be retrieved. See
  8771. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  8772. // for more information.
  8773. func (c *PermissionsDeleteCall) Fields(s ...googleapi.Field) *PermissionsDeleteCall {
  8774. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  8775. return c
  8776. }
  8777. // Context sets the context to be used in this call's Do method. Any
  8778. // pending HTTP request will be aborted if the provided context is
  8779. // canceled.
  8780. func (c *PermissionsDeleteCall) Context(ctx context.Context) *PermissionsDeleteCall {
  8781. c.ctx_ = ctx
  8782. return c
  8783. }
  8784. // Header returns an http.Header that can be modified by the caller to
  8785. // add HTTP headers to the request.
  8786. func (c *PermissionsDeleteCall) Header() http.Header {
  8787. if c.header_ == nil {
  8788. c.header_ = make(http.Header)
  8789. }
  8790. return c.header_
  8791. }
  8792. func (c *PermissionsDeleteCall) doRequest(alt string) (*http.Response, error) {
  8793. reqHeaders := make(http.Header)
  8794. for k, v := range c.header_ {
  8795. reqHeaders[k] = v
  8796. }
  8797. reqHeaders.Set("User-Agent", c.s.userAgent())
  8798. var body io.Reader = nil
  8799. c.urlParams_.Set("alt", alt)
  8800. urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/permissions/{permissionId}")
  8801. urls += "?" + c.urlParams_.Encode()
  8802. req, _ := http.NewRequest("DELETE", urls, body)
  8803. req.Header = reqHeaders
  8804. googleapi.Expand(req.URL, map[string]string{
  8805. "fileId": c.fileId,
  8806. "permissionId": c.permissionId,
  8807. })
  8808. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  8809. }
  8810. // Do executes the "drive.permissions.delete" call.
  8811. func (c *PermissionsDeleteCall) Do(opts ...googleapi.CallOption) error {
  8812. gensupport.SetOptions(c.urlParams_, opts...)
  8813. res, err := c.doRequest("json")
  8814. if err != nil {
  8815. return err
  8816. }
  8817. defer googleapi.CloseBody(res)
  8818. if err := googleapi.CheckResponse(res); err != nil {
  8819. return err
  8820. }
  8821. return nil
  8822. // {
  8823. // "description": "Deletes a permission from a file or Team Drive.",
  8824. // "httpMethod": "DELETE",
  8825. // "id": "drive.permissions.delete",
  8826. // "parameterOrder": [
  8827. // "fileId",
  8828. // "permissionId"
  8829. // ],
  8830. // "parameters": {
  8831. // "fileId": {
  8832. // "description": "The ID for the file or Team Drive.",
  8833. // "location": "path",
  8834. // "required": true,
  8835. // "type": "string"
  8836. // },
  8837. // "permissionId": {
  8838. // "description": "The ID for the permission.",
  8839. // "location": "path",
  8840. // "required": true,
  8841. // "type": "string"
  8842. // },
  8843. // "supportsTeamDrives": {
  8844. // "default": "false",
  8845. // "description": "Whether the requesting application supports Team Drives.",
  8846. // "location": "query",
  8847. // "type": "boolean"
  8848. // },
  8849. // "useDomainAdminAccess": {
  8850. // "default": "false",
  8851. // "description": "Whether the request should be treated as if it was issued by a domain administrator; if set to true, then the requester will be granted access if they are an administrator of the domain to which the item belongs.",
  8852. // "location": "query",
  8853. // "type": "boolean"
  8854. // }
  8855. // },
  8856. // "path": "files/{fileId}/permissions/{permissionId}",
  8857. // "scopes": [
  8858. // "https://www.googleapis.com/auth/drive",
  8859. // "https://www.googleapis.com/auth/drive.file"
  8860. // ]
  8861. // }
  8862. }
  8863. // method id "drive.permissions.get":
  8864. type PermissionsGetCall struct {
  8865. s *Service
  8866. fileId string
  8867. permissionId string
  8868. urlParams_ gensupport.URLParams
  8869. ifNoneMatch_ string
  8870. ctx_ context.Context
  8871. header_ http.Header
  8872. }
  8873. // Get: Gets a permission by ID.
  8874. func (r *PermissionsService) Get(fileId string, permissionId string) *PermissionsGetCall {
  8875. c := &PermissionsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  8876. c.fileId = fileId
  8877. c.permissionId = permissionId
  8878. return c
  8879. }
  8880. // SupportsTeamDrives sets the optional parameter "supportsTeamDrives":
  8881. // Whether the requesting application supports Team Drives.
  8882. func (c *PermissionsGetCall) SupportsTeamDrives(supportsTeamDrives bool) *PermissionsGetCall {
  8883. c.urlParams_.Set("supportsTeamDrives", fmt.Sprint(supportsTeamDrives))
  8884. return c
  8885. }
  8886. // UseDomainAdminAccess sets the optional parameter
  8887. // "useDomainAdminAccess": Whether the request should be treated as if
  8888. // it was issued by a domain administrator; if set to true, then the
  8889. // requester will be granted access if they are an administrator of the
  8890. // domain to which the item belongs.
  8891. func (c *PermissionsGetCall) UseDomainAdminAccess(useDomainAdminAccess bool) *PermissionsGetCall {
  8892. c.urlParams_.Set("useDomainAdminAccess", fmt.Sprint(useDomainAdminAccess))
  8893. return c
  8894. }
  8895. // Fields allows partial responses to be retrieved. See
  8896. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  8897. // for more information.
  8898. func (c *PermissionsGetCall) Fields(s ...googleapi.Field) *PermissionsGetCall {
  8899. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  8900. return c
  8901. }
  8902. // IfNoneMatch sets the optional parameter which makes the operation
  8903. // fail if the object's ETag matches the given value. This is useful for
  8904. // getting updates only after the object has changed since the last
  8905. // request. Use googleapi.IsNotModified to check whether the response
  8906. // error from Do is the result of In-None-Match.
  8907. func (c *PermissionsGetCall) IfNoneMatch(entityTag string) *PermissionsGetCall {
  8908. c.ifNoneMatch_ = entityTag
  8909. return c
  8910. }
  8911. // Context sets the context to be used in this call's Do method. Any
  8912. // pending HTTP request will be aborted if the provided context is
  8913. // canceled.
  8914. func (c *PermissionsGetCall) Context(ctx context.Context) *PermissionsGetCall {
  8915. c.ctx_ = ctx
  8916. return c
  8917. }
  8918. // Header returns an http.Header that can be modified by the caller to
  8919. // add HTTP headers to the request.
  8920. func (c *PermissionsGetCall) Header() http.Header {
  8921. if c.header_ == nil {
  8922. c.header_ = make(http.Header)
  8923. }
  8924. return c.header_
  8925. }
  8926. func (c *PermissionsGetCall) doRequest(alt string) (*http.Response, error) {
  8927. reqHeaders := make(http.Header)
  8928. for k, v := range c.header_ {
  8929. reqHeaders[k] = v
  8930. }
  8931. reqHeaders.Set("User-Agent", c.s.userAgent())
  8932. if c.ifNoneMatch_ != "" {
  8933. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  8934. }
  8935. var body io.Reader = nil
  8936. c.urlParams_.Set("alt", alt)
  8937. urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/permissions/{permissionId}")
  8938. urls += "?" + c.urlParams_.Encode()
  8939. req, _ := http.NewRequest("GET", urls, body)
  8940. req.Header = reqHeaders
  8941. googleapi.Expand(req.URL, map[string]string{
  8942. "fileId": c.fileId,
  8943. "permissionId": c.permissionId,
  8944. })
  8945. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  8946. }
  8947. // Do executes the "drive.permissions.get" call.
  8948. // Exactly one of *Permission or error will be non-nil. Any non-2xx
  8949. // status code is an error. Response headers are in either
  8950. // *Permission.ServerResponse.Header or (if a response was returned at
  8951. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  8952. // to check whether the returned error was because
  8953. // http.StatusNotModified was returned.
  8954. func (c *PermissionsGetCall) Do(opts ...googleapi.CallOption) (*Permission, error) {
  8955. gensupport.SetOptions(c.urlParams_, opts...)
  8956. res, err := c.doRequest("json")
  8957. if res != nil && res.StatusCode == http.StatusNotModified {
  8958. if res.Body != nil {
  8959. res.Body.Close()
  8960. }
  8961. return nil, &googleapi.Error{
  8962. Code: res.StatusCode,
  8963. Header: res.Header,
  8964. }
  8965. }
  8966. if err != nil {
  8967. return nil, err
  8968. }
  8969. defer googleapi.CloseBody(res)
  8970. if err := googleapi.CheckResponse(res); err != nil {
  8971. return nil, err
  8972. }
  8973. ret := &Permission{
  8974. ServerResponse: googleapi.ServerResponse{
  8975. Header: res.Header,
  8976. HTTPStatusCode: res.StatusCode,
  8977. },
  8978. }
  8979. target := &ret
  8980. if err := gensupport.DecodeResponse(target, res); err != nil {
  8981. return nil, err
  8982. }
  8983. return ret, nil
  8984. // {
  8985. // "description": "Gets a permission by ID.",
  8986. // "httpMethod": "GET",
  8987. // "id": "drive.permissions.get",
  8988. // "parameterOrder": [
  8989. // "fileId",
  8990. // "permissionId"
  8991. // ],
  8992. // "parameters": {
  8993. // "fileId": {
  8994. // "description": "The ID for the file or Team Drive.",
  8995. // "location": "path",
  8996. // "required": true,
  8997. // "type": "string"
  8998. // },
  8999. // "permissionId": {
  9000. // "description": "The ID for the permission.",
  9001. // "location": "path",
  9002. // "required": true,
  9003. // "type": "string"
  9004. // },
  9005. // "supportsTeamDrives": {
  9006. // "default": "false",
  9007. // "description": "Whether the requesting application supports Team Drives.",
  9008. // "location": "query",
  9009. // "type": "boolean"
  9010. // },
  9011. // "useDomainAdminAccess": {
  9012. // "default": "false",
  9013. // "description": "Whether the request should be treated as if it was issued by a domain administrator; if set to true, then the requester will be granted access if they are an administrator of the domain to which the item belongs.",
  9014. // "location": "query",
  9015. // "type": "boolean"
  9016. // }
  9017. // },
  9018. // "path": "files/{fileId}/permissions/{permissionId}",
  9019. // "response": {
  9020. // "$ref": "Permission"
  9021. // },
  9022. // "scopes": [
  9023. // "https://www.googleapis.com/auth/drive",
  9024. // "https://www.googleapis.com/auth/drive.file",
  9025. // "https://www.googleapis.com/auth/drive.metadata",
  9026. // "https://www.googleapis.com/auth/drive.metadata.readonly",
  9027. // "https://www.googleapis.com/auth/drive.photos.readonly",
  9028. // "https://www.googleapis.com/auth/drive.readonly"
  9029. // ]
  9030. // }
  9031. }
  9032. // method id "drive.permissions.getIdForEmail":
  9033. type PermissionsGetIdForEmailCall struct {
  9034. s *Service
  9035. email string
  9036. urlParams_ gensupport.URLParams
  9037. ifNoneMatch_ string
  9038. ctx_ context.Context
  9039. header_ http.Header
  9040. }
  9041. // GetIdForEmail: Returns the permission ID for an email address.
  9042. func (r *PermissionsService) GetIdForEmail(email string) *PermissionsGetIdForEmailCall {
  9043. c := &PermissionsGetIdForEmailCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  9044. c.email = email
  9045. return c
  9046. }
  9047. // Fields allows partial responses to be retrieved. See
  9048. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  9049. // for more information.
  9050. func (c *PermissionsGetIdForEmailCall) Fields(s ...googleapi.Field) *PermissionsGetIdForEmailCall {
  9051. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  9052. return c
  9053. }
  9054. // IfNoneMatch sets the optional parameter which makes the operation
  9055. // fail if the object's ETag matches the given value. This is useful for
  9056. // getting updates only after the object has changed since the last
  9057. // request. Use googleapi.IsNotModified to check whether the response
  9058. // error from Do is the result of In-None-Match.
  9059. func (c *PermissionsGetIdForEmailCall) IfNoneMatch(entityTag string) *PermissionsGetIdForEmailCall {
  9060. c.ifNoneMatch_ = entityTag
  9061. return c
  9062. }
  9063. // Context sets the context to be used in this call's Do method. Any
  9064. // pending HTTP request will be aborted if the provided context is
  9065. // canceled.
  9066. func (c *PermissionsGetIdForEmailCall) Context(ctx context.Context) *PermissionsGetIdForEmailCall {
  9067. c.ctx_ = ctx
  9068. return c
  9069. }
  9070. // Header returns an http.Header that can be modified by the caller to
  9071. // add HTTP headers to the request.
  9072. func (c *PermissionsGetIdForEmailCall) Header() http.Header {
  9073. if c.header_ == nil {
  9074. c.header_ = make(http.Header)
  9075. }
  9076. return c.header_
  9077. }
  9078. func (c *PermissionsGetIdForEmailCall) doRequest(alt string) (*http.Response, error) {
  9079. reqHeaders := make(http.Header)
  9080. for k, v := range c.header_ {
  9081. reqHeaders[k] = v
  9082. }
  9083. reqHeaders.Set("User-Agent", c.s.userAgent())
  9084. if c.ifNoneMatch_ != "" {
  9085. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  9086. }
  9087. var body io.Reader = nil
  9088. c.urlParams_.Set("alt", alt)
  9089. urls := googleapi.ResolveRelative(c.s.BasePath, "permissionIds/{email}")
  9090. urls += "?" + c.urlParams_.Encode()
  9091. req, _ := http.NewRequest("GET", urls, body)
  9092. req.Header = reqHeaders
  9093. googleapi.Expand(req.URL, map[string]string{
  9094. "email": c.email,
  9095. })
  9096. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  9097. }
  9098. // Do executes the "drive.permissions.getIdForEmail" call.
  9099. // Exactly one of *PermissionId or error will be non-nil. Any non-2xx
  9100. // status code is an error. Response headers are in either
  9101. // *PermissionId.ServerResponse.Header or (if a response was returned at
  9102. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  9103. // to check whether the returned error was because
  9104. // http.StatusNotModified was returned.
  9105. func (c *PermissionsGetIdForEmailCall) Do(opts ...googleapi.CallOption) (*PermissionId, error) {
  9106. gensupport.SetOptions(c.urlParams_, opts...)
  9107. res, err := c.doRequest("json")
  9108. if res != nil && res.StatusCode == http.StatusNotModified {
  9109. if res.Body != nil {
  9110. res.Body.Close()
  9111. }
  9112. return nil, &googleapi.Error{
  9113. Code: res.StatusCode,
  9114. Header: res.Header,
  9115. }
  9116. }
  9117. if err != nil {
  9118. return nil, err
  9119. }
  9120. defer googleapi.CloseBody(res)
  9121. if err := googleapi.CheckResponse(res); err != nil {
  9122. return nil, err
  9123. }
  9124. ret := &PermissionId{
  9125. ServerResponse: googleapi.ServerResponse{
  9126. Header: res.Header,
  9127. HTTPStatusCode: res.StatusCode,
  9128. },
  9129. }
  9130. target := &ret
  9131. if err := gensupport.DecodeResponse(target, res); err != nil {
  9132. return nil, err
  9133. }
  9134. return ret, nil
  9135. // {
  9136. // "description": "Returns the permission ID for an email address.",
  9137. // "httpMethod": "GET",
  9138. // "id": "drive.permissions.getIdForEmail",
  9139. // "parameterOrder": [
  9140. // "email"
  9141. // ],
  9142. // "parameters": {
  9143. // "email": {
  9144. // "description": "The email address for which to return a permission ID",
  9145. // "location": "path",
  9146. // "required": true,
  9147. // "type": "string"
  9148. // }
  9149. // },
  9150. // "path": "permissionIds/{email}",
  9151. // "response": {
  9152. // "$ref": "PermissionId"
  9153. // },
  9154. // "scopes": [
  9155. // "https://www.googleapis.com/auth/drive",
  9156. // "https://www.googleapis.com/auth/drive.appdata",
  9157. // "https://www.googleapis.com/auth/drive.apps.readonly",
  9158. // "https://www.googleapis.com/auth/drive.file",
  9159. // "https://www.googleapis.com/auth/drive.metadata",
  9160. // "https://www.googleapis.com/auth/drive.metadata.readonly",
  9161. // "https://www.googleapis.com/auth/drive.photos.readonly",
  9162. // "https://www.googleapis.com/auth/drive.readonly"
  9163. // ]
  9164. // }
  9165. }
  9166. // method id "drive.permissions.insert":
  9167. type PermissionsInsertCall struct {
  9168. s *Service
  9169. fileId string
  9170. permission *Permission
  9171. urlParams_ gensupport.URLParams
  9172. ctx_ context.Context
  9173. header_ http.Header
  9174. }
  9175. // Insert: Inserts a permission for a file or Team Drive.
  9176. func (r *PermissionsService) Insert(fileId string, permission *Permission) *PermissionsInsertCall {
  9177. c := &PermissionsInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  9178. c.fileId = fileId
  9179. c.permission = permission
  9180. return c
  9181. }
  9182. // EmailMessage sets the optional parameter "emailMessage": A plain text
  9183. // custom message to include in notification emails.
  9184. func (c *PermissionsInsertCall) EmailMessage(emailMessage string) *PermissionsInsertCall {
  9185. c.urlParams_.Set("emailMessage", emailMessage)
  9186. return c
  9187. }
  9188. // SendNotificationEmails sets the optional parameter
  9189. // "sendNotificationEmails": Whether to send notification emails when
  9190. // sharing to users or groups. This parameter is ignored and an email is
  9191. // sent if the role is owner.
  9192. func (c *PermissionsInsertCall) SendNotificationEmails(sendNotificationEmails bool) *PermissionsInsertCall {
  9193. c.urlParams_.Set("sendNotificationEmails", fmt.Sprint(sendNotificationEmails))
  9194. return c
  9195. }
  9196. // SupportsTeamDrives sets the optional parameter "supportsTeamDrives":
  9197. // Whether the requesting application supports Team Drives.
  9198. func (c *PermissionsInsertCall) SupportsTeamDrives(supportsTeamDrives bool) *PermissionsInsertCall {
  9199. c.urlParams_.Set("supportsTeamDrives", fmt.Sprint(supportsTeamDrives))
  9200. return c
  9201. }
  9202. // UseDomainAdminAccess sets the optional parameter
  9203. // "useDomainAdminAccess": Whether the request should be treated as if
  9204. // it was issued by a domain administrator; if set to true, then the
  9205. // requester will be granted access if they are an administrator of the
  9206. // domain to which the item belongs.
  9207. func (c *PermissionsInsertCall) UseDomainAdminAccess(useDomainAdminAccess bool) *PermissionsInsertCall {
  9208. c.urlParams_.Set("useDomainAdminAccess", fmt.Sprint(useDomainAdminAccess))
  9209. return c
  9210. }
  9211. // Fields allows partial responses to be retrieved. See
  9212. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  9213. // for more information.
  9214. func (c *PermissionsInsertCall) Fields(s ...googleapi.Field) *PermissionsInsertCall {
  9215. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  9216. return c
  9217. }
  9218. // Context sets the context to be used in this call's Do method. Any
  9219. // pending HTTP request will be aborted if the provided context is
  9220. // canceled.
  9221. func (c *PermissionsInsertCall) Context(ctx context.Context) *PermissionsInsertCall {
  9222. c.ctx_ = ctx
  9223. return c
  9224. }
  9225. // Header returns an http.Header that can be modified by the caller to
  9226. // add HTTP headers to the request.
  9227. func (c *PermissionsInsertCall) Header() http.Header {
  9228. if c.header_ == nil {
  9229. c.header_ = make(http.Header)
  9230. }
  9231. return c.header_
  9232. }
  9233. func (c *PermissionsInsertCall) doRequest(alt string) (*http.Response, error) {
  9234. reqHeaders := make(http.Header)
  9235. for k, v := range c.header_ {
  9236. reqHeaders[k] = v
  9237. }
  9238. reqHeaders.Set("User-Agent", c.s.userAgent())
  9239. var body io.Reader = nil
  9240. body, err := googleapi.WithoutDataWrapper.JSONReader(c.permission)
  9241. if err != nil {
  9242. return nil, err
  9243. }
  9244. reqHeaders.Set("Content-Type", "application/json")
  9245. c.urlParams_.Set("alt", alt)
  9246. urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/permissions")
  9247. urls += "?" + c.urlParams_.Encode()
  9248. req, _ := http.NewRequest("POST", urls, body)
  9249. req.Header = reqHeaders
  9250. googleapi.Expand(req.URL, map[string]string{
  9251. "fileId": c.fileId,
  9252. })
  9253. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  9254. }
  9255. // Do executes the "drive.permissions.insert" call.
  9256. // Exactly one of *Permission or error will be non-nil. Any non-2xx
  9257. // status code is an error. Response headers are in either
  9258. // *Permission.ServerResponse.Header or (if a response was returned at
  9259. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  9260. // to check whether the returned error was because
  9261. // http.StatusNotModified was returned.
  9262. func (c *PermissionsInsertCall) Do(opts ...googleapi.CallOption) (*Permission, error) {
  9263. gensupport.SetOptions(c.urlParams_, opts...)
  9264. res, err := c.doRequest("json")
  9265. if res != nil && res.StatusCode == http.StatusNotModified {
  9266. if res.Body != nil {
  9267. res.Body.Close()
  9268. }
  9269. return nil, &googleapi.Error{
  9270. Code: res.StatusCode,
  9271. Header: res.Header,
  9272. }
  9273. }
  9274. if err != nil {
  9275. return nil, err
  9276. }
  9277. defer googleapi.CloseBody(res)
  9278. if err := googleapi.CheckResponse(res); err != nil {
  9279. return nil, err
  9280. }
  9281. ret := &Permission{
  9282. ServerResponse: googleapi.ServerResponse{
  9283. Header: res.Header,
  9284. HTTPStatusCode: res.StatusCode,
  9285. },
  9286. }
  9287. target := &ret
  9288. if err := gensupport.DecodeResponse(target, res); err != nil {
  9289. return nil, err
  9290. }
  9291. return ret, nil
  9292. // {
  9293. // "description": "Inserts a permission for a file or Team Drive.",
  9294. // "httpMethod": "POST",
  9295. // "id": "drive.permissions.insert",
  9296. // "parameterOrder": [
  9297. // "fileId"
  9298. // ],
  9299. // "parameters": {
  9300. // "emailMessage": {
  9301. // "description": "A plain text custom message to include in notification emails.",
  9302. // "location": "query",
  9303. // "type": "string"
  9304. // },
  9305. // "fileId": {
  9306. // "description": "The ID for the file or Team Drive.",
  9307. // "location": "path",
  9308. // "required": true,
  9309. // "type": "string"
  9310. // },
  9311. // "sendNotificationEmails": {
  9312. // "default": "true",
  9313. // "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.",
  9314. // "location": "query",
  9315. // "type": "boolean"
  9316. // },
  9317. // "supportsTeamDrives": {
  9318. // "default": "false",
  9319. // "description": "Whether the requesting application supports Team Drives.",
  9320. // "location": "query",
  9321. // "type": "boolean"
  9322. // },
  9323. // "useDomainAdminAccess": {
  9324. // "default": "false",
  9325. // "description": "Whether the request should be treated as if it was issued by a domain administrator; if set to true, then the requester will be granted access if they are an administrator of the domain to which the item belongs.",
  9326. // "location": "query",
  9327. // "type": "boolean"
  9328. // }
  9329. // },
  9330. // "path": "files/{fileId}/permissions",
  9331. // "request": {
  9332. // "$ref": "Permission"
  9333. // },
  9334. // "response": {
  9335. // "$ref": "Permission"
  9336. // },
  9337. // "scopes": [
  9338. // "https://www.googleapis.com/auth/drive",
  9339. // "https://www.googleapis.com/auth/drive.file"
  9340. // ]
  9341. // }
  9342. }
  9343. // method id "drive.permissions.list":
  9344. type PermissionsListCall struct {
  9345. s *Service
  9346. fileId string
  9347. urlParams_ gensupport.URLParams
  9348. ifNoneMatch_ string
  9349. ctx_ context.Context
  9350. header_ http.Header
  9351. }
  9352. // List: Lists a file's or Team Drive's permissions.
  9353. func (r *PermissionsService) List(fileId string) *PermissionsListCall {
  9354. c := &PermissionsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  9355. c.fileId = fileId
  9356. return c
  9357. }
  9358. // MaxResults sets the optional parameter "maxResults": The maximum
  9359. // number of permissions to return per page. When not set for files in a
  9360. // Team Drive, at most 100 results will be returned. When not set for
  9361. // files that are not in a Team Drive, the entire list will be returned.
  9362. func (c *PermissionsListCall) MaxResults(maxResults int64) *PermissionsListCall {
  9363. c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
  9364. return c
  9365. }
  9366. // PageToken sets the optional parameter "pageToken": The token for
  9367. // continuing a previous list request on the next page. This should be
  9368. // set to the value of 'nextPageToken' from the previous response.
  9369. func (c *PermissionsListCall) PageToken(pageToken string) *PermissionsListCall {
  9370. c.urlParams_.Set("pageToken", pageToken)
  9371. return c
  9372. }
  9373. // SupportsTeamDrives sets the optional parameter "supportsTeamDrives":
  9374. // Whether the requesting application supports Team Drives.
  9375. func (c *PermissionsListCall) SupportsTeamDrives(supportsTeamDrives bool) *PermissionsListCall {
  9376. c.urlParams_.Set("supportsTeamDrives", fmt.Sprint(supportsTeamDrives))
  9377. return c
  9378. }
  9379. // UseDomainAdminAccess sets the optional parameter
  9380. // "useDomainAdminAccess": Whether the request should be treated as if
  9381. // it was issued by a domain administrator; if set to true, then the
  9382. // requester will be granted access if they are an administrator of the
  9383. // domain to which the item belongs.
  9384. func (c *PermissionsListCall) UseDomainAdminAccess(useDomainAdminAccess bool) *PermissionsListCall {
  9385. c.urlParams_.Set("useDomainAdminAccess", fmt.Sprint(useDomainAdminAccess))
  9386. return c
  9387. }
  9388. // Fields allows partial responses to be retrieved. See
  9389. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  9390. // for more information.
  9391. func (c *PermissionsListCall) Fields(s ...googleapi.Field) *PermissionsListCall {
  9392. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  9393. return c
  9394. }
  9395. // IfNoneMatch sets the optional parameter which makes the operation
  9396. // fail if the object's ETag matches the given value. This is useful for
  9397. // getting updates only after the object has changed since the last
  9398. // request. Use googleapi.IsNotModified to check whether the response
  9399. // error from Do is the result of In-None-Match.
  9400. func (c *PermissionsListCall) IfNoneMatch(entityTag string) *PermissionsListCall {
  9401. c.ifNoneMatch_ = entityTag
  9402. return c
  9403. }
  9404. // Context sets the context to be used in this call's Do method. Any
  9405. // pending HTTP request will be aborted if the provided context is
  9406. // canceled.
  9407. func (c *PermissionsListCall) Context(ctx context.Context) *PermissionsListCall {
  9408. c.ctx_ = ctx
  9409. return c
  9410. }
  9411. // Header returns an http.Header that can be modified by the caller to
  9412. // add HTTP headers to the request.
  9413. func (c *PermissionsListCall) Header() http.Header {
  9414. if c.header_ == nil {
  9415. c.header_ = make(http.Header)
  9416. }
  9417. return c.header_
  9418. }
  9419. func (c *PermissionsListCall) doRequest(alt string) (*http.Response, error) {
  9420. reqHeaders := make(http.Header)
  9421. for k, v := range c.header_ {
  9422. reqHeaders[k] = v
  9423. }
  9424. reqHeaders.Set("User-Agent", c.s.userAgent())
  9425. if c.ifNoneMatch_ != "" {
  9426. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  9427. }
  9428. var body io.Reader = nil
  9429. c.urlParams_.Set("alt", alt)
  9430. urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/permissions")
  9431. urls += "?" + c.urlParams_.Encode()
  9432. req, _ := http.NewRequest("GET", urls, body)
  9433. req.Header = reqHeaders
  9434. googleapi.Expand(req.URL, map[string]string{
  9435. "fileId": c.fileId,
  9436. })
  9437. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  9438. }
  9439. // Do executes the "drive.permissions.list" call.
  9440. // Exactly one of *PermissionList or error will be non-nil. Any non-2xx
  9441. // status code is an error. Response headers are in either
  9442. // *PermissionList.ServerResponse.Header or (if a response was returned
  9443. // at all) in error.(*googleapi.Error).Header. Use
  9444. // googleapi.IsNotModified to check whether the returned error was
  9445. // because http.StatusNotModified was returned.
  9446. func (c *PermissionsListCall) Do(opts ...googleapi.CallOption) (*PermissionList, error) {
  9447. gensupport.SetOptions(c.urlParams_, opts...)
  9448. res, err := c.doRequest("json")
  9449. if res != nil && res.StatusCode == http.StatusNotModified {
  9450. if res.Body != nil {
  9451. res.Body.Close()
  9452. }
  9453. return nil, &googleapi.Error{
  9454. Code: res.StatusCode,
  9455. Header: res.Header,
  9456. }
  9457. }
  9458. if err != nil {
  9459. return nil, err
  9460. }
  9461. defer googleapi.CloseBody(res)
  9462. if err := googleapi.CheckResponse(res); err != nil {
  9463. return nil, err
  9464. }
  9465. ret := &PermissionList{
  9466. ServerResponse: googleapi.ServerResponse{
  9467. Header: res.Header,
  9468. HTTPStatusCode: res.StatusCode,
  9469. },
  9470. }
  9471. target := &ret
  9472. if err := gensupport.DecodeResponse(target, res); err != nil {
  9473. return nil, err
  9474. }
  9475. return ret, nil
  9476. // {
  9477. // "description": "Lists a file's or Team Drive's permissions.",
  9478. // "httpMethod": "GET",
  9479. // "id": "drive.permissions.list",
  9480. // "parameterOrder": [
  9481. // "fileId"
  9482. // ],
  9483. // "parameters": {
  9484. // "fileId": {
  9485. // "description": "The ID for the file or Team Drive.",
  9486. // "location": "path",
  9487. // "required": true,
  9488. // "type": "string"
  9489. // },
  9490. // "maxResults": {
  9491. // "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.",
  9492. // "format": "int32",
  9493. // "location": "query",
  9494. // "maximum": "100",
  9495. // "minimum": "1",
  9496. // "type": "integer"
  9497. // },
  9498. // "pageToken": {
  9499. // "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.",
  9500. // "location": "query",
  9501. // "type": "string"
  9502. // },
  9503. // "supportsTeamDrives": {
  9504. // "default": "false",
  9505. // "description": "Whether the requesting application supports Team Drives.",
  9506. // "location": "query",
  9507. // "type": "boolean"
  9508. // },
  9509. // "useDomainAdminAccess": {
  9510. // "default": "false",
  9511. // "description": "Whether the request should be treated as if it was issued by a domain administrator; if set to true, then the requester will be granted access if they are an administrator of the domain to which the item belongs.",
  9512. // "location": "query",
  9513. // "type": "boolean"
  9514. // }
  9515. // },
  9516. // "path": "files/{fileId}/permissions",
  9517. // "response": {
  9518. // "$ref": "PermissionList"
  9519. // },
  9520. // "scopes": [
  9521. // "https://www.googleapis.com/auth/drive",
  9522. // "https://www.googleapis.com/auth/drive.file",
  9523. // "https://www.googleapis.com/auth/drive.metadata",
  9524. // "https://www.googleapis.com/auth/drive.metadata.readonly",
  9525. // "https://www.googleapis.com/auth/drive.photos.readonly",
  9526. // "https://www.googleapis.com/auth/drive.readonly"
  9527. // ]
  9528. // }
  9529. }
  9530. // Pages invokes f for each page of results.
  9531. // A non-nil error returned from f will halt the iteration.
  9532. // The provided context supersedes any context provided to the Context method.
  9533. func (c *PermissionsListCall) Pages(ctx context.Context, f func(*PermissionList) error) error {
  9534. c.ctx_ = ctx
  9535. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  9536. for {
  9537. x, err := c.Do()
  9538. if err != nil {
  9539. return err
  9540. }
  9541. if err := f(x); err != nil {
  9542. return err
  9543. }
  9544. if x.NextPageToken == "" {
  9545. return nil
  9546. }
  9547. c.PageToken(x.NextPageToken)
  9548. }
  9549. }
  9550. // method id "drive.permissions.patch":
  9551. type PermissionsPatchCall struct {
  9552. s *Service
  9553. fileId string
  9554. permissionId string
  9555. permission *Permission
  9556. urlParams_ gensupport.URLParams
  9557. ctx_ context.Context
  9558. header_ http.Header
  9559. }
  9560. // Patch: Updates a permission using patch semantics.
  9561. func (r *PermissionsService) Patch(fileId string, permissionId string, permission *Permission) *PermissionsPatchCall {
  9562. c := &PermissionsPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  9563. c.fileId = fileId
  9564. c.permissionId = permissionId
  9565. c.permission = permission
  9566. return c
  9567. }
  9568. // RemoveExpiration sets the optional parameter "removeExpiration":
  9569. // Whether to remove the expiration date.
  9570. func (c *PermissionsPatchCall) RemoveExpiration(removeExpiration bool) *PermissionsPatchCall {
  9571. c.urlParams_.Set("removeExpiration", fmt.Sprint(removeExpiration))
  9572. return c
  9573. }
  9574. // SupportsTeamDrives sets the optional parameter "supportsTeamDrives":
  9575. // Whether the requesting application supports Team Drives.
  9576. func (c *PermissionsPatchCall) SupportsTeamDrives(supportsTeamDrives bool) *PermissionsPatchCall {
  9577. c.urlParams_.Set("supportsTeamDrives", fmt.Sprint(supportsTeamDrives))
  9578. return c
  9579. }
  9580. // TransferOwnership sets the optional parameter "transferOwnership":
  9581. // Whether changing a role to 'owner' downgrades the current owners to
  9582. // writers. Does nothing if the specified role is not 'owner'.
  9583. func (c *PermissionsPatchCall) TransferOwnership(transferOwnership bool) *PermissionsPatchCall {
  9584. c.urlParams_.Set("transferOwnership", fmt.Sprint(transferOwnership))
  9585. return c
  9586. }
  9587. // UseDomainAdminAccess sets the optional parameter
  9588. // "useDomainAdminAccess": Whether the request should be treated as if
  9589. // it was issued by a domain administrator; if set to true, then the
  9590. // requester will be granted access if they are an administrator of the
  9591. // domain to which the item belongs.
  9592. func (c *PermissionsPatchCall) UseDomainAdminAccess(useDomainAdminAccess bool) *PermissionsPatchCall {
  9593. c.urlParams_.Set("useDomainAdminAccess", fmt.Sprint(useDomainAdminAccess))
  9594. return c
  9595. }
  9596. // Fields allows partial responses to be retrieved. See
  9597. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  9598. // for more information.
  9599. func (c *PermissionsPatchCall) Fields(s ...googleapi.Field) *PermissionsPatchCall {
  9600. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  9601. return c
  9602. }
  9603. // Context sets the context to be used in this call's Do method. Any
  9604. // pending HTTP request will be aborted if the provided context is
  9605. // canceled.
  9606. func (c *PermissionsPatchCall) Context(ctx context.Context) *PermissionsPatchCall {
  9607. c.ctx_ = ctx
  9608. return c
  9609. }
  9610. // Header returns an http.Header that can be modified by the caller to
  9611. // add HTTP headers to the request.
  9612. func (c *PermissionsPatchCall) Header() http.Header {
  9613. if c.header_ == nil {
  9614. c.header_ = make(http.Header)
  9615. }
  9616. return c.header_
  9617. }
  9618. func (c *PermissionsPatchCall) doRequest(alt string) (*http.Response, error) {
  9619. reqHeaders := make(http.Header)
  9620. for k, v := range c.header_ {
  9621. reqHeaders[k] = v
  9622. }
  9623. reqHeaders.Set("User-Agent", c.s.userAgent())
  9624. var body io.Reader = nil
  9625. body, err := googleapi.WithoutDataWrapper.JSONReader(c.permission)
  9626. if err != nil {
  9627. return nil, err
  9628. }
  9629. reqHeaders.Set("Content-Type", "application/json")
  9630. c.urlParams_.Set("alt", alt)
  9631. urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/permissions/{permissionId}")
  9632. urls += "?" + c.urlParams_.Encode()
  9633. req, _ := http.NewRequest("PATCH", urls, body)
  9634. req.Header = reqHeaders
  9635. googleapi.Expand(req.URL, map[string]string{
  9636. "fileId": c.fileId,
  9637. "permissionId": c.permissionId,
  9638. })
  9639. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  9640. }
  9641. // Do executes the "drive.permissions.patch" call.
  9642. // Exactly one of *Permission or error will be non-nil. Any non-2xx
  9643. // status code is an error. Response headers are in either
  9644. // *Permission.ServerResponse.Header or (if a response was returned at
  9645. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  9646. // to check whether the returned error was because
  9647. // http.StatusNotModified was returned.
  9648. func (c *PermissionsPatchCall) Do(opts ...googleapi.CallOption) (*Permission, error) {
  9649. gensupport.SetOptions(c.urlParams_, opts...)
  9650. res, err := c.doRequest("json")
  9651. if res != nil && res.StatusCode == http.StatusNotModified {
  9652. if res.Body != nil {
  9653. res.Body.Close()
  9654. }
  9655. return nil, &googleapi.Error{
  9656. Code: res.StatusCode,
  9657. Header: res.Header,
  9658. }
  9659. }
  9660. if err != nil {
  9661. return nil, err
  9662. }
  9663. defer googleapi.CloseBody(res)
  9664. if err := googleapi.CheckResponse(res); err != nil {
  9665. return nil, err
  9666. }
  9667. ret := &Permission{
  9668. ServerResponse: googleapi.ServerResponse{
  9669. Header: res.Header,
  9670. HTTPStatusCode: res.StatusCode,
  9671. },
  9672. }
  9673. target := &ret
  9674. if err := gensupport.DecodeResponse(target, res); err != nil {
  9675. return nil, err
  9676. }
  9677. return ret, nil
  9678. // {
  9679. // "description": "Updates a permission using patch semantics.",
  9680. // "httpMethod": "PATCH",
  9681. // "id": "drive.permissions.patch",
  9682. // "parameterOrder": [
  9683. // "fileId",
  9684. // "permissionId"
  9685. // ],
  9686. // "parameters": {
  9687. // "fileId": {
  9688. // "description": "The ID for the file or Team Drive.",
  9689. // "location": "path",
  9690. // "required": true,
  9691. // "type": "string"
  9692. // },
  9693. // "permissionId": {
  9694. // "description": "The ID for the permission.",
  9695. // "location": "path",
  9696. // "required": true,
  9697. // "type": "string"
  9698. // },
  9699. // "removeExpiration": {
  9700. // "default": "false",
  9701. // "description": "Whether to remove the expiration date.",
  9702. // "location": "query",
  9703. // "type": "boolean"
  9704. // },
  9705. // "supportsTeamDrives": {
  9706. // "default": "false",
  9707. // "description": "Whether the requesting application supports Team Drives.",
  9708. // "location": "query",
  9709. // "type": "boolean"
  9710. // },
  9711. // "transferOwnership": {
  9712. // "default": "false",
  9713. // "description": "Whether changing a role to 'owner' downgrades the current owners to writers. Does nothing if the specified role is not 'owner'.",
  9714. // "location": "query",
  9715. // "type": "boolean"
  9716. // },
  9717. // "useDomainAdminAccess": {
  9718. // "default": "false",
  9719. // "description": "Whether the request should be treated as if it was issued by a domain administrator; if set to true, then the requester will be granted access if they are an administrator of the domain to which the item belongs.",
  9720. // "location": "query",
  9721. // "type": "boolean"
  9722. // }
  9723. // },
  9724. // "path": "files/{fileId}/permissions/{permissionId}",
  9725. // "request": {
  9726. // "$ref": "Permission"
  9727. // },
  9728. // "response": {
  9729. // "$ref": "Permission"
  9730. // },
  9731. // "scopes": [
  9732. // "https://www.googleapis.com/auth/drive",
  9733. // "https://www.googleapis.com/auth/drive.file"
  9734. // ]
  9735. // }
  9736. }
  9737. // method id "drive.permissions.update":
  9738. type PermissionsUpdateCall struct {
  9739. s *Service
  9740. fileId string
  9741. permissionId string
  9742. permission *Permission
  9743. urlParams_ gensupport.URLParams
  9744. ctx_ context.Context
  9745. header_ http.Header
  9746. }
  9747. // Update: Updates a permission.
  9748. func (r *PermissionsService) Update(fileId string, permissionId string, permission *Permission) *PermissionsUpdateCall {
  9749. c := &PermissionsUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  9750. c.fileId = fileId
  9751. c.permissionId = permissionId
  9752. c.permission = permission
  9753. return c
  9754. }
  9755. // RemoveExpiration sets the optional parameter "removeExpiration":
  9756. // Whether to remove the expiration date.
  9757. func (c *PermissionsUpdateCall) RemoveExpiration(removeExpiration bool) *PermissionsUpdateCall {
  9758. c.urlParams_.Set("removeExpiration", fmt.Sprint(removeExpiration))
  9759. return c
  9760. }
  9761. // SupportsTeamDrives sets the optional parameter "supportsTeamDrives":
  9762. // Whether the requesting application supports Team Drives.
  9763. func (c *PermissionsUpdateCall) SupportsTeamDrives(supportsTeamDrives bool) *PermissionsUpdateCall {
  9764. c.urlParams_.Set("supportsTeamDrives", fmt.Sprint(supportsTeamDrives))
  9765. return c
  9766. }
  9767. // TransferOwnership sets the optional parameter "transferOwnership":
  9768. // Whether changing a role to 'owner' downgrades the current owners to
  9769. // writers. Does nothing if the specified role is not 'owner'.
  9770. func (c *PermissionsUpdateCall) TransferOwnership(transferOwnership bool) *PermissionsUpdateCall {
  9771. c.urlParams_.Set("transferOwnership", fmt.Sprint(transferOwnership))
  9772. return c
  9773. }
  9774. // UseDomainAdminAccess sets the optional parameter
  9775. // "useDomainAdminAccess": Whether the request should be treated as if
  9776. // it was issued by a domain administrator; if set to true, then the
  9777. // requester will be granted access if they are an administrator of the
  9778. // domain to which the item belongs.
  9779. func (c *PermissionsUpdateCall) UseDomainAdminAccess(useDomainAdminAccess bool) *PermissionsUpdateCall {
  9780. c.urlParams_.Set("useDomainAdminAccess", fmt.Sprint(useDomainAdminAccess))
  9781. return c
  9782. }
  9783. // Fields allows partial responses to be retrieved. See
  9784. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  9785. // for more information.
  9786. func (c *PermissionsUpdateCall) Fields(s ...googleapi.Field) *PermissionsUpdateCall {
  9787. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  9788. return c
  9789. }
  9790. // Context sets the context to be used in this call's Do method. Any
  9791. // pending HTTP request will be aborted if the provided context is
  9792. // canceled.
  9793. func (c *PermissionsUpdateCall) Context(ctx context.Context) *PermissionsUpdateCall {
  9794. c.ctx_ = ctx
  9795. return c
  9796. }
  9797. // Header returns an http.Header that can be modified by the caller to
  9798. // add HTTP headers to the request.
  9799. func (c *PermissionsUpdateCall) Header() http.Header {
  9800. if c.header_ == nil {
  9801. c.header_ = make(http.Header)
  9802. }
  9803. return c.header_
  9804. }
  9805. func (c *PermissionsUpdateCall) doRequest(alt string) (*http.Response, error) {
  9806. reqHeaders := make(http.Header)
  9807. for k, v := range c.header_ {
  9808. reqHeaders[k] = v
  9809. }
  9810. reqHeaders.Set("User-Agent", c.s.userAgent())
  9811. var body io.Reader = nil
  9812. body, err := googleapi.WithoutDataWrapper.JSONReader(c.permission)
  9813. if err != nil {
  9814. return nil, err
  9815. }
  9816. reqHeaders.Set("Content-Type", "application/json")
  9817. c.urlParams_.Set("alt", alt)
  9818. urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/permissions/{permissionId}")
  9819. urls += "?" + c.urlParams_.Encode()
  9820. req, _ := http.NewRequest("PUT", urls, body)
  9821. req.Header = reqHeaders
  9822. googleapi.Expand(req.URL, map[string]string{
  9823. "fileId": c.fileId,
  9824. "permissionId": c.permissionId,
  9825. })
  9826. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  9827. }
  9828. // Do executes the "drive.permissions.update" call.
  9829. // Exactly one of *Permission or error will be non-nil. Any non-2xx
  9830. // status code is an error. Response headers are in either
  9831. // *Permission.ServerResponse.Header or (if a response was returned at
  9832. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  9833. // to check whether the returned error was because
  9834. // http.StatusNotModified was returned.
  9835. func (c *PermissionsUpdateCall) Do(opts ...googleapi.CallOption) (*Permission, error) {
  9836. gensupport.SetOptions(c.urlParams_, opts...)
  9837. res, err := c.doRequest("json")
  9838. if res != nil && res.StatusCode == http.StatusNotModified {
  9839. if res.Body != nil {
  9840. res.Body.Close()
  9841. }
  9842. return nil, &googleapi.Error{
  9843. Code: res.StatusCode,
  9844. Header: res.Header,
  9845. }
  9846. }
  9847. if err != nil {
  9848. return nil, err
  9849. }
  9850. defer googleapi.CloseBody(res)
  9851. if err := googleapi.CheckResponse(res); err != nil {
  9852. return nil, err
  9853. }
  9854. ret := &Permission{
  9855. ServerResponse: googleapi.ServerResponse{
  9856. Header: res.Header,
  9857. HTTPStatusCode: res.StatusCode,
  9858. },
  9859. }
  9860. target := &ret
  9861. if err := gensupport.DecodeResponse(target, res); err != nil {
  9862. return nil, err
  9863. }
  9864. return ret, nil
  9865. // {
  9866. // "description": "Updates a permission.",
  9867. // "httpMethod": "PUT",
  9868. // "id": "drive.permissions.update",
  9869. // "parameterOrder": [
  9870. // "fileId",
  9871. // "permissionId"
  9872. // ],
  9873. // "parameters": {
  9874. // "fileId": {
  9875. // "description": "The ID for the file or Team Drive.",
  9876. // "location": "path",
  9877. // "required": true,
  9878. // "type": "string"
  9879. // },
  9880. // "permissionId": {
  9881. // "description": "The ID for the permission.",
  9882. // "location": "path",
  9883. // "required": true,
  9884. // "type": "string"
  9885. // },
  9886. // "removeExpiration": {
  9887. // "default": "false",
  9888. // "description": "Whether to remove the expiration date.",
  9889. // "location": "query",
  9890. // "type": "boolean"
  9891. // },
  9892. // "supportsTeamDrives": {
  9893. // "default": "false",
  9894. // "description": "Whether the requesting application supports Team Drives.",
  9895. // "location": "query",
  9896. // "type": "boolean"
  9897. // },
  9898. // "transferOwnership": {
  9899. // "default": "false",
  9900. // "description": "Whether changing a role to 'owner' downgrades the current owners to writers. Does nothing if the specified role is not 'owner'.",
  9901. // "location": "query",
  9902. // "type": "boolean"
  9903. // },
  9904. // "useDomainAdminAccess": {
  9905. // "default": "false",
  9906. // "description": "Whether the request should be treated as if it was issued by a domain administrator; if set to true, then the requester will be granted access if they are an administrator of the domain to which the item belongs.",
  9907. // "location": "query",
  9908. // "type": "boolean"
  9909. // }
  9910. // },
  9911. // "path": "files/{fileId}/permissions/{permissionId}",
  9912. // "request": {
  9913. // "$ref": "Permission"
  9914. // },
  9915. // "response": {
  9916. // "$ref": "Permission"
  9917. // },
  9918. // "scopes": [
  9919. // "https://www.googleapis.com/auth/drive",
  9920. // "https://www.googleapis.com/auth/drive.file"
  9921. // ]
  9922. // }
  9923. }
  9924. // method id "drive.properties.delete":
  9925. type PropertiesDeleteCall struct {
  9926. s *Service
  9927. fileId string
  9928. propertyKey string
  9929. urlParams_ gensupport.URLParams
  9930. ctx_ context.Context
  9931. header_ http.Header
  9932. }
  9933. // Delete: Deletes a property.
  9934. func (r *PropertiesService) Delete(fileId string, propertyKey string) *PropertiesDeleteCall {
  9935. c := &PropertiesDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  9936. c.fileId = fileId
  9937. c.propertyKey = propertyKey
  9938. return c
  9939. }
  9940. // Visibility sets the optional parameter "visibility": The visibility
  9941. // of the property.
  9942. func (c *PropertiesDeleteCall) Visibility(visibility string) *PropertiesDeleteCall {
  9943. c.urlParams_.Set("visibility", visibility)
  9944. return c
  9945. }
  9946. // Fields allows partial responses to be retrieved. See
  9947. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  9948. // for more information.
  9949. func (c *PropertiesDeleteCall) Fields(s ...googleapi.Field) *PropertiesDeleteCall {
  9950. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  9951. return c
  9952. }
  9953. // Context sets the context to be used in this call's Do method. Any
  9954. // pending HTTP request will be aborted if the provided context is
  9955. // canceled.
  9956. func (c *PropertiesDeleteCall) Context(ctx context.Context) *PropertiesDeleteCall {
  9957. c.ctx_ = ctx
  9958. return c
  9959. }
  9960. // Header returns an http.Header that can be modified by the caller to
  9961. // add HTTP headers to the request.
  9962. func (c *PropertiesDeleteCall) Header() http.Header {
  9963. if c.header_ == nil {
  9964. c.header_ = make(http.Header)
  9965. }
  9966. return c.header_
  9967. }
  9968. func (c *PropertiesDeleteCall) doRequest(alt string) (*http.Response, error) {
  9969. reqHeaders := make(http.Header)
  9970. for k, v := range c.header_ {
  9971. reqHeaders[k] = v
  9972. }
  9973. reqHeaders.Set("User-Agent", c.s.userAgent())
  9974. var body io.Reader = nil
  9975. c.urlParams_.Set("alt", alt)
  9976. urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/properties/{propertyKey}")
  9977. urls += "?" + c.urlParams_.Encode()
  9978. req, _ := http.NewRequest("DELETE", urls, body)
  9979. req.Header = reqHeaders
  9980. googleapi.Expand(req.URL, map[string]string{
  9981. "fileId": c.fileId,
  9982. "propertyKey": c.propertyKey,
  9983. })
  9984. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  9985. }
  9986. // Do executes the "drive.properties.delete" call.
  9987. func (c *PropertiesDeleteCall) Do(opts ...googleapi.CallOption) error {
  9988. gensupport.SetOptions(c.urlParams_, opts...)
  9989. res, err := c.doRequest("json")
  9990. if err != nil {
  9991. return err
  9992. }
  9993. defer googleapi.CloseBody(res)
  9994. if err := googleapi.CheckResponse(res); err != nil {
  9995. return err
  9996. }
  9997. return nil
  9998. // {
  9999. // "description": "Deletes a property.",
  10000. // "httpMethod": "DELETE",
  10001. // "id": "drive.properties.delete",
  10002. // "parameterOrder": [
  10003. // "fileId",
  10004. // "propertyKey"
  10005. // ],
  10006. // "parameters": {
  10007. // "fileId": {
  10008. // "description": "The ID of the file.",
  10009. // "location": "path",
  10010. // "required": true,
  10011. // "type": "string"
  10012. // },
  10013. // "propertyKey": {
  10014. // "description": "The key of the property.",
  10015. // "location": "path",
  10016. // "required": true,
  10017. // "type": "string"
  10018. // },
  10019. // "visibility": {
  10020. // "default": "private",
  10021. // "description": "The visibility of the property.",
  10022. // "location": "query",
  10023. // "type": "string"
  10024. // }
  10025. // },
  10026. // "path": "files/{fileId}/properties/{propertyKey}",
  10027. // "scopes": [
  10028. // "https://www.googleapis.com/auth/drive",
  10029. // "https://www.googleapis.com/auth/drive.appdata",
  10030. // "https://www.googleapis.com/auth/drive.file",
  10031. // "https://www.googleapis.com/auth/drive.metadata"
  10032. // ]
  10033. // }
  10034. }
  10035. // method id "drive.properties.get":
  10036. type PropertiesGetCall struct {
  10037. s *Service
  10038. fileId string
  10039. propertyKey string
  10040. urlParams_ gensupport.URLParams
  10041. ifNoneMatch_ string
  10042. ctx_ context.Context
  10043. header_ http.Header
  10044. }
  10045. // Get: Gets a property by its key.
  10046. func (r *PropertiesService) Get(fileId string, propertyKey string) *PropertiesGetCall {
  10047. c := &PropertiesGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  10048. c.fileId = fileId
  10049. c.propertyKey = propertyKey
  10050. return c
  10051. }
  10052. // Visibility sets the optional parameter "visibility": The visibility
  10053. // of the property.
  10054. func (c *PropertiesGetCall) Visibility(visibility string) *PropertiesGetCall {
  10055. c.urlParams_.Set("visibility", visibility)
  10056. return c
  10057. }
  10058. // Fields allows partial responses to be retrieved. See
  10059. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  10060. // for more information.
  10061. func (c *PropertiesGetCall) Fields(s ...googleapi.Field) *PropertiesGetCall {
  10062. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  10063. return c
  10064. }
  10065. // IfNoneMatch sets the optional parameter which makes the operation
  10066. // fail if the object's ETag matches the given value. This is useful for
  10067. // getting updates only after the object has changed since the last
  10068. // request. Use googleapi.IsNotModified to check whether the response
  10069. // error from Do is the result of In-None-Match.
  10070. func (c *PropertiesGetCall) IfNoneMatch(entityTag string) *PropertiesGetCall {
  10071. c.ifNoneMatch_ = entityTag
  10072. return c
  10073. }
  10074. // Context sets the context to be used in this call's Do method. Any
  10075. // pending HTTP request will be aborted if the provided context is
  10076. // canceled.
  10077. func (c *PropertiesGetCall) Context(ctx context.Context) *PropertiesGetCall {
  10078. c.ctx_ = ctx
  10079. return c
  10080. }
  10081. // Header returns an http.Header that can be modified by the caller to
  10082. // add HTTP headers to the request.
  10083. func (c *PropertiesGetCall) Header() http.Header {
  10084. if c.header_ == nil {
  10085. c.header_ = make(http.Header)
  10086. }
  10087. return c.header_
  10088. }
  10089. func (c *PropertiesGetCall) doRequest(alt string) (*http.Response, error) {
  10090. reqHeaders := make(http.Header)
  10091. for k, v := range c.header_ {
  10092. reqHeaders[k] = v
  10093. }
  10094. reqHeaders.Set("User-Agent", c.s.userAgent())
  10095. if c.ifNoneMatch_ != "" {
  10096. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  10097. }
  10098. var body io.Reader = nil
  10099. c.urlParams_.Set("alt", alt)
  10100. urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/properties/{propertyKey}")
  10101. urls += "?" + c.urlParams_.Encode()
  10102. req, _ := http.NewRequest("GET", urls, body)
  10103. req.Header = reqHeaders
  10104. googleapi.Expand(req.URL, map[string]string{
  10105. "fileId": c.fileId,
  10106. "propertyKey": c.propertyKey,
  10107. })
  10108. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  10109. }
  10110. // Do executes the "drive.properties.get" call.
  10111. // Exactly one of *Property or error will be non-nil. Any non-2xx status
  10112. // code is an error. Response headers are in either
  10113. // *Property.ServerResponse.Header or (if a response was returned at
  10114. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  10115. // to check whether the returned error was because
  10116. // http.StatusNotModified was returned.
  10117. func (c *PropertiesGetCall) Do(opts ...googleapi.CallOption) (*Property, error) {
  10118. gensupport.SetOptions(c.urlParams_, opts...)
  10119. res, err := c.doRequest("json")
  10120. if res != nil && res.StatusCode == http.StatusNotModified {
  10121. if res.Body != nil {
  10122. res.Body.Close()
  10123. }
  10124. return nil, &googleapi.Error{
  10125. Code: res.StatusCode,
  10126. Header: res.Header,
  10127. }
  10128. }
  10129. if err != nil {
  10130. return nil, err
  10131. }
  10132. defer googleapi.CloseBody(res)
  10133. if err := googleapi.CheckResponse(res); err != nil {
  10134. return nil, err
  10135. }
  10136. ret := &Property{
  10137. ServerResponse: googleapi.ServerResponse{
  10138. Header: res.Header,
  10139. HTTPStatusCode: res.StatusCode,
  10140. },
  10141. }
  10142. target := &ret
  10143. if err := gensupport.DecodeResponse(target, res); err != nil {
  10144. return nil, err
  10145. }
  10146. return ret, nil
  10147. // {
  10148. // "description": "Gets a property by its key.",
  10149. // "httpMethod": "GET",
  10150. // "id": "drive.properties.get",
  10151. // "parameterOrder": [
  10152. // "fileId",
  10153. // "propertyKey"
  10154. // ],
  10155. // "parameters": {
  10156. // "fileId": {
  10157. // "description": "The ID of the file.",
  10158. // "location": "path",
  10159. // "required": true,
  10160. // "type": "string"
  10161. // },
  10162. // "propertyKey": {
  10163. // "description": "The key of the property.",
  10164. // "location": "path",
  10165. // "required": true,
  10166. // "type": "string"
  10167. // },
  10168. // "visibility": {
  10169. // "default": "private",
  10170. // "description": "The visibility of the property.",
  10171. // "location": "query",
  10172. // "type": "string"
  10173. // }
  10174. // },
  10175. // "path": "files/{fileId}/properties/{propertyKey}",
  10176. // "response": {
  10177. // "$ref": "Property"
  10178. // },
  10179. // "scopes": [
  10180. // "https://www.googleapis.com/auth/drive",
  10181. // "https://www.googleapis.com/auth/drive.appdata",
  10182. // "https://www.googleapis.com/auth/drive.file",
  10183. // "https://www.googleapis.com/auth/drive.metadata",
  10184. // "https://www.googleapis.com/auth/drive.metadata.readonly",
  10185. // "https://www.googleapis.com/auth/drive.photos.readonly",
  10186. // "https://www.googleapis.com/auth/drive.readonly"
  10187. // ]
  10188. // }
  10189. }
  10190. // method id "drive.properties.insert":
  10191. type PropertiesInsertCall struct {
  10192. s *Service
  10193. fileId string
  10194. property *Property
  10195. urlParams_ gensupport.URLParams
  10196. ctx_ context.Context
  10197. header_ http.Header
  10198. }
  10199. // Insert: Adds a property to a file, or updates it if it already
  10200. // exists.
  10201. func (r *PropertiesService) Insert(fileId string, property *Property) *PropertiesInsertCall {
  10202. c := &PropertiesInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  10203. c.fileId = fileId
  10204. c.property = property
  10205. return c
  10206. }
  10207. // Fields allows partial responses to be retrieved. See
  10208. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  10209. // for more information.
  10210. func (c *PropertiesInsertCall) Fields(s ...googleapi.Field) *PropertiesInsertCall {
  10211. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  10212. return c
  10213. }
  10214. // Context sets the context to be used in this call's Do method. Any
  10215. // pending HTTP request will be aborted if the provided context is
  10216. // canceled.
  10217. func (c *PropertiesInsertCall) Context(ctx context.Context) *PropertiesInsertCall {
  10218. c.ctx_ = ctx
  10219. return c
  10220. }
  10221. // Header returns an http.Header that can be modified by the caller to
  10222. // add HTTP headers to the request.
  10223. func (c *PropertiesInsertCall) Header() http.Header {
  10224. if c.header_ == nil {
  10225. c.header_ = make(http.Header)
  10226. }
  10227. return c.header_
  10228. }
  10229. func (c *PropertiesInsertCall) doRequest(alt string) (*http.Response, error) {
  10230. reqHeaders := make(http.Header)
  10231. for k, v := range c.header_ {
  10232. reqHeaders[k] = v
  10233. }
  10234. reqHeaders.Set("User-Agent", c.s.userAgent())
  10235. var body io.Reader = nil
  10236. body, err := googleapi.WithoutDataWrapper.JSONReader(c.property)
  10237. if err != nil {
  10238. return nil, err
  10239. }
  10240. reqHeaders.Set("Content-Type", "application/json")
  10241. c.urlParams_.Set("alt", alt)
  10242. urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/properties")
  10243. urls += "?" + c.urlParams_.Encode()
  10244. req, _ := http.NewRequest("POST", urls, body)
  10245. req.Header = reqHeaders
  10246. googleapi.Expand(req.URL, map[string]string{
  10247. "fileId": c.fileId,
  10248. })
  10249. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  10250. }
  10251. // Do executes the "drive.properties.insert" call.
  10252. // Exactly one of *Property or error will be non-nil. Any non-2xx status
  10253. // code is an error. Response headers are in either
  10254. // *Property.ServerResponse.Header or (if a response was returned at
  10255. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  10256. // to check whether the returned error was because
  10257. // http.StatusNotModified was returned.
  10258. func (c *PropertiesInsertCall) Do(opts ...googleapi.CallOption) (*Property, error) {
  10259. gensupport.SetOptions(c.urlParams_, opts...)
  10260. res, err := c.doRequest("json")
  10261. if res != nil && res.StatusCode == http.StatusNotModified {
  10262. if res.Body != nil {
  10263. res.Body.Close()
  10264. }
  10265. return nil, &googleapi.Error{
  10266. Code: res.StatusCode,
  10267. Header: res.Header,
  10268. }
  10269. }
  10270. if err != nil {
  10271. return nil, err
  10272. }
  10273. defer googleapi.CloseBody(res)
  10274. if err := googleapi.CheckResponse(res); err != nil {
  10275. return nil, err
  10276. }
  10277. ret := &Property{
  10278. ServerResponse: googleapi.ServerResponse{
  10279. Header: res.Header,
  10280. HTTPStatusCode: res.StatusCode,
  10281. },
  10282. }
  10283. target := &ret
  10284. if err := gensupport.DecodeResponse(target, res); err != nil {
  10285. return nil, err
  10286. }
  10287. return ret, nil
  10288. // {
  10289. // "description": "Adds a property to a file, or updates it if it already exists.",
  10290. // "httpMethod": "POST",
  10291. // "id": "drive.properties.insert",
  10292. // "parameterOrder": [
  10293. // "fileId"
  10294. // ],
  10295. // "parameters": {
  10296. // "fileId": {
  10297. // "description": "The ID of the file.",
  10298. // "location": "path",
  10299. // "required": true,
  10300. // "type": "string"
  10301. // }
  10302. // },
  10303. // "path": "files/{fileId}/properties",
  10304. // "request": {
  10305. // "$ref": "Property"
  10306. // },
  10307. // "response": {
  10308. // "$ref": "Property"
  10309. // },
  10310. // "scopes": [
  10311. // "https://www.googleapis.com/auth/drive",
  10312. // "https://www.googleapis.com/auth/drive.appdata",
  10313. // "https://www.googleapis.com/auth/drive.file",
  10314. // "https://www.googleapis.com/auth/drive.metadata"
  10315. // ]
  10316. // }
  10317. }
  10318. // method id "drive.properties.list":
  10319. type PropertiesListCall struct {
  10320. s *Service
  10321. fileId string
  10322. urlParams_ gensupport.URLParams
  10323. ifNoneMatch_ string
  10324. ctx_ context.Context
  10325. header_ http.Header
  10326. }
  10327. // List: Lists a file's properties.
  10328. func (r *PropertiesService) List(fileId string) *PropertiesListCall {
  10329. c := &PropertiesListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  10330. c.fileId = fileId
  10331. return c
  10332. }
  10333. // Fields allows partial responses to be retrieved. See
  10334. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  10335. // for more information.
  10336. func (c *PropertiesListCall) Fields(s ...googleapi.Field) *PropertiesListCall {
  10337. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  10338. return c
  10339. }
  10340. // IfNoneMatch sets the optional parameter which makes the operation
  10341. // fail if the object's ETag matches the given value. This is useful for
  10342. // getting updates only after the object has changed since the last
  10343. // request. Use googleapi.IsNotModified to check whether the response
  10344. // error from Do is the result of In-None-Match.
  10345. func (c *PropertiesListCall) IfNoneMatch(entityTag string) *PropertiesListCall {
  10346. c.ifNoneMatch_ = entityTag
  10347. return c
  10348. }
  10349. // Context sets the context to be used in this call's Do method. Any
  10350. // pending HTTP request will be aborted if the provided context is
  10351. // canceled.
  10352. func (c *PropertiesListCall) Context(ctx context.Context) *PropertiesListCall {
  10353. c.ctx_ = ctx
  10354. return c
  10355. }
  10356. // Header returns an http.Header that can be modified by the caller to
  10357. // add HTTP headers to the request.
  10358. func (c *PropertiesListCall) Header() http.Header {
  10359. if c.header_ == nil {
  10360. c.header_ = make(http.Header)
  10361. }
  10362. return c.header_
  10363. }
  10364. func (c *PropertiesListCall) doRequest(alt string) (*http.Response, error) {
  10365. reqHeaders := make(http.Header)
  10366. for k, v := range c.header_ {
  10367. reqHeaders[k] = v
  10368. }
  10369. reqHeaders.Set("User-Agent", c.s.userAgent())
  10370. if c.ifNoneMatch_ != "" {
  10371. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  10372. }
  10373. var body io.Reader = nil
  10374. c.urlParams_.Set("alt", alt)
  10375. urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/properties")
  10376. urls += "?" + c.urlParams_.Encode()
  10377. req, _ := http.NewRequest("GET", urls, body)
  10378. req.Header = reqHeaders
  10379. googleapi.Expand(req.URL, map[string]string{
  10380. "fileId": c.fileId,
  10381. })
  10382. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  10383. }
  10384. // Do executes the "drive.properties.list" call.
  10385. // Exactly one of *PropertyList or error will be non-nil. Any non-2xx
  10386. // status code is an error. Response headers are in either
  10387. // *PropertyList.ServerResponse.Header or (if a response was returned at
  10388. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  10389. // to check whether the returned error was because
  10390. // http.StatusNotModified was returned.
  10391. func (c *PropertiesListCall) Do(opts ...googleapi.CallOption) (*PropertyList, error) {
  10392. gensupport.SetOptions(c.urlParams_, opts...)
  10393. res, err := c.doRequest("json")
  10394. if res != nil && res.StatusCode == http.StatusNotModified {
  10395. if res.Body != nil {
  10396. res.Body.Close()
  10397. }
  10398. return nil, &googleapi.Error{
  10399. Code: res.StatusCode,
  10400. Header: res.Header,
  10401. }
  10402. }
  10403. if err != nil {
  10404. return nil, err
  10405. }
  10406. defer googleapi.CloseBody(res)
  10407. if err := googleapi.CheckResponse(res); err != nil {
  10408. return nil, err
  10409. }
  10410. ret := &PropertyList{
  10411. ServerResponse: googleapi.ServerResponse{
  10412. Header: res.Header,
  10413. HTTPStatusCode: res.StatusCode,
  10414. },
  10415. }
  10416. target := &ret
  10417. if err := gensupport.DecodeResponse(target, res); err != nil {
  10418. return nil, err
  10419. }
  10420. return ret, nil
  10421. // {
  10422. // "description": "Lists a file's properties.",
  10423. // "httpMethod": "GET",
  10424. // "id": "drive.properties.list",
  10425. // "parameterOrder": [
  10426. // "fileId"
  10427. // ],
  10428. // "parameters": {
  10429. // "fileId": {
  10430. // "description": "The ID of the file.",
  10431. // "location": "path",
  10432. // "required": true,
  10433. // "type": "string"
  10434. // }
  10435. // },
  10436. // "path": "files/{fileId}/properties",
  10437. // "response": {
  10438. // "$ref": "PropertyList"
  10439. // },
  10440. // "scopes": [
  10441. // "https://www.googleapis.com/auth/drive",
  10442. // "https://www.googleapis.com/auth/drive.appdata",
  10443. // "https://www.googleapis.com/auth/drive.file",
  10444. // "https://www.googleapis.com/auth/drive.metadata",
  10445. // "https://www.googleapis.com/auth/drive.metadata.readonly",
  10446. // "https://www.googleapis.com/auth/drive.photos.readonly",
  10447. // "https://www.googleapis.com/auth/drive.readonly"
  10448. // ]
  10449. // }
  10450. }
  10451. // method id "drive.properties.patch":
  10452. type PropertiesPatchCall struct {
  10453. s *Service
  10454. fileId string
  10455. propertyKey string
  10456. property *Property
  10457. urlParams_ gensupport.URLParams
  10458. ctx_ context.Context
  10459. header_ http.Header
  10460. }
  10461. // Patch: Updates a property.
  10462. func (r *PropertiesService) Patch(fileId string, propertyKey string, property *Property) *PropertiesPatchCall {
  10463. c := &PropertiesPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  10464. c.fileId = fileId
  10465. c.propertyKey = propertyKey
  10466. c.property = property
  10467. return c
  10468. }
  10469. // Visibility sets the optional parameter "visibility": The visibility
  10470. // of the property. Allowed values are PRIVATE and PUBLIC. (Default:
  10471. // PRIVATE)
  10472. func (c *PropertiesPatchCall) Visibility(visibility string) *PropertiesPatchCall {
  10473. c.urlParams_.Set("visibility", visibility)
  10474. return c
  10475. }
  10476. // Fields allows partial responses to be retrieved. See
  10477. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  10478. // for more information.
  10479. func (c *PropertiesPatchCall) Fields(s ...googleapi.Field) *PropertiesPatchCall {
  10480. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  10481. return c
  10482. }
  10483. // Context sets the context to be used in this call's Do method. Any
  10484. // pending HTTP request will be aborted if the provided context is
  10485. // canceled.
  10486. func (c *PropertiesPatchCall) Context(ctx context.Context) *PropertiesPatchCall {
  10487. c.ctx_ = ctx
  10488. return c
  10489. }
  10490. // Header returns an http.Header that can be modified by the caller to
  10491. // add HTTP headers to the request.
  10492. func (c *PropertiesPatchCall) Header() http.Header {
  10493. if c.header_ == nil {
  10494. c.header_ = make(http.Header)
  10495. }
  10496. return c.header_
  10497. }
  10498. func (c *PropertiesPatchCall) doRequest(alt string) (*http.Response, error) {
  10499. reqHeaders := make(http.Header)
  10500. for k, v := range c.header_ {
  10501. reqHeaders[k] = v
  10502. }
  10503. reqHeaders.Set("User-Agent", c.s.userAgent())
  10504. var body io.Reader = nil
  10505. body, err := googleapi.WithoutDataWrapper.JSONReader(c.property)
  10506. if err != nil {
  10507. return nil, err
  10508. }
  10509. reqHeaders.Set("Content-Type", "application/json")
  10510. c.urlParams_.Set("alt", alt)
  10511. urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/properties/{propertyKey}")
  10512. urls += "?" + c.urlParams_.Encode()
  10513. req, _ := http.NewRequest("PATCH", urls, body)
  10514. req.Header = reqHeaders
  10515. googleapi.Expand(req.URL, map[string]string{
  10516. "fileId": c.fileId,
  10517. "propertyKey": c.propertyKey,
  10518. })
  10519. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  10520. }
  10521. // Do executes the "drive.properties.patch" call.
  10522. // Exactly one of *Property or error will be non-nil. Any non-2xx status
  10523. // code is an error. Response headers are in either
  10524. // *Property.ServerResponse.Header or (if a response was returned at
  10525. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  10526. // to check whether the returned error was because
  10527. // http.StatusNotModified was returned.
  10528. func (c *PropertiesPatchCall) Do(opts ...googleapi.CallOption) (*Property, error) {
  10529. gensupport.SetOptions(c.urlParams_, opts...)
  10530. res, err := c.doRequest("json")
  10531. if res != nil && res.StatusCode == http.StatusNotModified {
  10532. if res.Body != nil {
  10533. res.Body.Close()
  10534. }
  10535. return nil, &googleapi.Error{
  10536. Code: res.StatusCode,
  10537. Header: res.Header,
  10538. }
  10539. }
  10540. if err != nil {
  10541. return nil, err
  10542. }
  10543. defer googleapi.CloseBody(res)
  10544. if err := googleapi.CheckResponse(res); err != nil {
  10545. return nil, err
  10546. }
  10547. ret := &Property{
  10548. ServerResponse: googleapi.ServerResponse{
  10549. Header: res.Header,
  10550. HTTPStatusCode: res.StatusCode,
  10551. },
  10552. }
  10553. target := &ret
  10554. if err := gensupport.DecodeResponse(target, res); err != nil {
  10555. return nil, err
  10556. }
  10557. return ret, nil
  10558. // {
  10559. // "description": "Updates a property.",
  10560. // "httpMethod": "PATCH",
  10561. // "id": "drive.properties.patch",
  10562. // "parameterOrder": [
  10563. // "fileId",
  10564. // "propertyKey"
  10565. // ],
  10566. // "parameters": {
  10567. // "fileId": {
  10568. // "description": "The ID of the file.",
  10569. // "location": "path",
  10570. // "required": true,
  10571. // "type": "string"
  10572. // },
  10573. // "propertyKey": {
  10574. // "description": "The key of the property.",
  10575. // "location": "path",
  10576. // "required": true,
  10577. // "type": "string"
  10578. // },
  10579. // "visibility": {
  10580. // "default": "private",
  10581. // "description": "The visibility of the property. Allowed values are PRIVATE and PUBLIC. (Default: PRIVATE)",
  10582. // "location": "query",
  10583. // "type": "string"
  10584. // }
  10585. // },
  10586. // "path": "files/{fileId}/properties/{propertyKey}",
  10587. // "request": {
  10588. // "$ref": "Property"
  10589. // },
  10590. // "response": {
  10591. // "$ref": "Property"
  10592. // },
  10593. // "scopes": [
  10594. // "https://www.googleapis.com/auth/drive",
  10595. // "https://www.googleapis.com/auth/drive.appdata",
  10596. // "https://www.googleapis.com/auth/drive.file",
  10597. // "https://www.googleapis.com/auth/drive.metadata"
  10598. // ]
  10599. // }
  10600. }
  10601. // method id "drive.properties.update":
  10602. type PropertiesUpdateCall struct {
  10603. s *Service
  10604. fileId string
  10605. propertyKey string
  10606. property *Property
  10607. urlParams_ gensupport.URLParams
  10608. ctx_ context.Context
  10609. header_ http.Header
  10610. }
  10611. // Update: Updates a property.
  10612. func (r *PropertiesService) Update(fileId string, propertyKey string, property *Property) *PropertiesUpdateCall {
  10613. c := &PropertiesUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  10614. c.fileId = fileId
  10615. c.propertyKey = propertyKey
  10616. c.property = property
  10617. return c
  10618. }
  10619. // Visibility sets the optional parameter "visibility": The visibility
  10620. // of the property. Allowed values are PRIVATE and PUBLIC. (Default:
  10621. // PRIVATE)
  10622. func (c *PropertiesUpdateCall) Visibility(visibility string) *PropertiesUpdateCall {
  10623. c.urlParams_.Set("visibility", visibility)
  10624. return c
  10625. }
  10626. // Fields allows partial responses to be retrieved. See
  10627. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  10628. // for more information.
  10629. func (c *PropertiesUpdateCall) Fields(s ...googleapi.Field) *PropertiesUpdateCall {
  10630. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  10631. return c
  10632. }
  10633. // Context sets the context to be used in this call's Do method. Any
  10634. // pending HTTP request will be aborted if the provided context is
  10635. // canceled.
  10636. func (c *PropertiesUpdateCall) Context(ctx context.Context) *PropertiesUpdateCall {
  10637. c.ctx_ = ctx
  10638. return c
  10639. }
  10640. // Header returns an http.Header that can be modified by the caller to
  10641. // add HTTP headers to the request.
  10642. func (c *PropertiesUpdateCall) Header() http.Header {
  10643. if c.header_ == nil {
  10644. c.header_ = make(http.Header)
  10645. }
  10646. return c.header_
  10647. }
  10648. func (c *PropertiesUpdateCall) doRequest(alt string) (*http.Response, error) {
  10649. reqHeaders := make(http.Header)
  10650. for k, v := range c.header_ {
  10651. reqHeaders[k] = v
  10652. }
  10653. reqHeaders.Set("User-Agent", c.s.userAgent())
  10654. var body io.Reader = nil
  10655. body, err := googleapi.WithoutDataWrapper.JSONReader(c.property)
  10656. if err != nil {
  10657. return nil, err
  10658. }
  10659. reqHeaders.Set("Content-Type", "application/json")
  10660. c.urlParams_.Set("alt", alt)
  10661. urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/properties/{propertyKey}")
  10662. urls += "?" + c.urlParams_.Encode()
  10663. req, _ := http.NewRequest("PUT", urls, body)
  10664. req.Header = reqHeaders
  10665. googleapi.Expand(req.URL, map[string]string{
  10666. "fileId": c.fileId,
  10667. "propertyKey": c.propertyKey,
  10668. })
  10669. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  10670. }
  10671. // Do executes the "drive.properties.update" call.
  10672. // Exactly one of *Property or error will be non-nil. Any non-2xx status
  10673. // code is an error. Response headers are in either
  10674. // *Property.ServerResponse.Header or (if a response was returned at
  10675. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  10676. // to check whether the returned error was because
  10677. // http.StatusNotModified was returned.
  10678. func (c *PropertiesUpdateCall) Do(opts ...googleapi.CallOption) (*Property, error) {
  10679. gensupport.SetOptions(c.urlParams_, opts...)
  10680. res, err := c.doRequest("json")
  10681. if res != nil && res.StatusCode == http.StatusNotModified {
  10682. if res.Body != nil {
  10683. res.Body.Close()
  10684. }
  10685. return nil, &googleapi.Error{
  10686. Code: res.StatusCode,
  10687. Header: res.Header,
  10688. }
  10689. }
  10690. if err != nil {
  10691. return nil, err
  10692. }
  10693. defer googleapi.CloseBody(res)
  10694. if err := googleapi.CheckResponse(res); err != nil {
  10695. return nil, err
  10696. }
  10697. ret := &Property{
  10698. ServerResponse: googleapi.ServerResponse{
  10699. Header: res.Header,
  10700. HTTPStatusCode: res.StatusCode,
  10701. },
  10702. }
  10703. target := &ret
  10704. if err := gensupport.DecodeResponse(target, res); err != nil {
  10705. return nil, err
  10706. }
  10707. return ret, nil
  10708. // {
  10709. // "description": "Updates a property.",
  10710. // "httpMethod": "PUT",
  10711. // "id": "drive.properties.update",
  10712. // "parameterOrder": [
  10713. // "fileId",
  10714. // "propertyKey"
  10715. // ],
  10716. // "parameters": {
  10717. // "fileId": {
  10718. // "description": "The ID of the file.",
  10719. // "location": "path",
  10720. // "required": true,
  10721. // "type": "string"
  10722. // },
  10723. // "propertyKey": {
  10724. // "description": "The key of the property.",
  10725. // "location": "path",
  10726. // "required": true,
  10727. // "type": "string"
  10728. // },
  10729. // "visibility": {
  10730. // "default": "private",
  10731. // "description": "The visibility of the property. Allowed values are PRIVATE and PUBLIC. (Default: PRIVATE)",
  10732. // "location": "query",
  10733. // "type": "string"
  10734. // }
  10735. // },
  10736. // "path": "files/{fileId}/properties/{propertyKey}",
  10737. // "request": {
  10738. // "$ref": "Property"
  10739. // },
  10740. // "response": {
  10741. // "$ref": "Property"
  10742. // },
  10743. // "scopes": [
  10744. // "https://www.googleapis.com/auth/drive",
  10745. // "https://www.googleapis.com/auth/drive.appdata",
  10746. // "https://www.googleapis.com/auth/drive.file",
  10747. // "https://www.googleapis.com/auth/drive.metadata"
  10748. // ]
  10749. // }
  10750. }
  10751. // method id "drive.realtime.get":
  10752. type RealtimeGetCall struct {
  10753. s *Service
  10754. fileId string
  10755. urlParams_ gensupport.URLParams
  10756. ifNoneMatch_ string
  10757. ctx_ context.Context
  10758. header_ http.Header
  10759. }
  10760. // Get: Exports the contents of the Realtime API data model associated
  10761. // with this file as JSON.
  10762. func (r *RealtimeService) Get(fileId string) *RealtimeGetCall {
  10763. c := &RealtimeGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  10764. c.fileId = fileId
  10765. return c
  10766. }
  10767. // Revision sets the optional parameter "revision": The revision of the
  10768. // Realtime API data model to export. Revisions start at 1 (the initial
  10769. // empty data model) and are incremented with each change. If this
  10770. // parameter is excluded, the most recent data model will be returned.
  10771. func (c *RealtimeGetCall) Revision(revision int64) *RealtimeGetCall {
  10772. c.urlParams_.Set("revision", fmt.Sprint(revision))
  10773. return c
  10774. }
  10775. // Fields allows partial responses to be retrieved. See
  10776. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  10777. // for more information.
  10778. func (c *RealtimeGetCall) Fields(s ...googleapi.Field) *RealtimeGetCall {
  10779. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  10780. return c
  10781. }
  10782. // IfNoneMatch sets the optional parameter which makes the operation
  10783. // fail if the object's ETag matches the given value. This is useful for
  10784. // getting updates only after the object has changed since the last
  10785. // request. Use googleapi.IsNotModified to check whether the response
  10786. // error from Do is the result of In-None-Match.
  10787. func (c *RealtimeGetCall) IfNoneMatch(entityTag string) *RealtimeGetCall {
  10788. c.ifNoneMatch_ = entityTag
  10789. return c
  10790. }
  10791. // Context sets the context to be used in this call's Do and Download
  10792. // methods. Any pending HTTP request will be aborted if the provided
  10793. // context is canceled.
  10794. func (c *RealtimeGetCall) Context(ctx context.Context) *RealtimeGetCall {
  10795. c.ctx_ = ctx
  10796. return c
  10797. }
  10798. // Header returns an http.Header that can be modified by the caller to
  10799. // add HTTP headers to the request.
  10800. func (c *RealtimeGetCall) Header() http.Header {
  10801. if c.header_ == nil {
  10802. c.header_ = make(http.Header)
  10803. }
  10804. return c.header_
  10805. }
  10806. func (c *RealtimeGetCall) doRequest(alt string) (*http.Response, error) {
  10807. reqHeaders := make(http.Header)
  10808. for k, v := range c.header_ {
  10809. reqHeaders[k] = v
  10810. }
  10811. reqHeaders.Set("User-Agent", c.s.userAgent())
  10812. if c.ifNoneMatch_ != "" {
  10813. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  10814. }
  10815. var body io.Reader = nil
  10816. c.urlParams_.Set("alt", alt)
  10817. urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/realtime")
  10818. urls += "?" + c.urlParams_.Encode()
  10819. req, _ := http.NewRequest("GET", urls, body)
  10820. req.Header = reqHeaders
  10821. googleapi.Expand(req.URL, map[string]string{
  10822. "fileId": c.fileId,
  10823. })
  10824. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  10825. }
  10826. // Download fetches the API endpoint's "media" value, instead of the normal
  10827. // API response value. If the returned error is nil, the Response is guaranteed to
  10828. // have a 2xx status code. Callers must close the Response.Body as usual.
  10829. func (c *RealtimeGetCall) Download(opts ...googleapi.CallOption) (*http.Response, error) {
  10830. gensupport.SetOptions(c.urlParams_, opts...)
  10831. res, err := c.doRequest("media")
  10832. if err != nil {
  10833. return nil, err
  10834. }
  10835. if err := googleapi.CheckMediaResponse(res); err != nil {
  10836. res.Body.Close()
  10837. return nil, err
  10838. }
  10839. return res, nil
  10840. }
  10841. // Do executes the "drive.realtime.get" call.
  10842. func (c *RealtimeGetCall) Do(opts ...googleapi.CallOption) error {
  10843. gensupport.SetOptions(c.urlParams_, opts...)
  10844. res, err := c.doRequest("json")
  10845. if err != nil {
  10846. return err
  10847. }
  10848. defer googleapi.CloseBody(res)
  10849. if err := googleapi.CheckResponse(res); err != nil {
  10850. return err
  10851. }
  10852. return nil
  10853. // {
  10854. // "description": "Exports the contents of the Realtime API data model associated with this file as JSON.",
  10855. // "httpMethod": "GET",
  10856. // "id": "drive.realtime.get",
  10857. // "parameterOrder": [
  10858. // "fileId"
  10859. // ],
  10860. // "parameters": {
  10861. // "fileId": {
  10862. // "description": "The ID of the file that the Realtime API data model is associated with.",
  10863. // "location": "path",
  10864. // "required": true,
  10865. // "type": "string"
  10866. // },
  10867. // "revision": {
  10868. // "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.",
  10869. // "format": "int32",
  10870. // "location": "query",
  10871. // "minimum": "1",
  10872. // "type": "integer"
  10873. // }
  10874. // },
  10875. // "path": "files/{fileId}/realtime",
  10876. // "scopes": [
  10877. // "https://www.googleapis.com/auth/drive",
  10878. // "https://www.googleapis.com/auth/drive.file",
  10879. // "https://www.googleapis.com/auth/drive.readonly"
  10880. // ],
  10881. // "supportsMediaDownload": true
  10882. // }
  10883. }
  10884. // method id "drive.realtime.update":
  10885. type RealtimeUpdateCall struct {
  10886. s *Service
  10887. fileId string
  10888. urlParams_ gensupport.URLParams
  10889. mediaInfo_ *gensupport.MediaInfo
  10890. ctx_ context.Context
  10891. header_ http.Header
  10892. }
  10893. // Update: Overwrites the Realtime API data model associated with this
  10894. // file with the provided JSON data model.
  10895. func (r *RealtimeService) Update(fileId string) *RealtimeUpdateCall {
  10896. c := &RealtimeUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  10897. c.fileId = fileId
  10898. return c
  10899. }
  10900. // BaseRevision sets the optional parameter "baseRevision": The revision
  10901. // of the model to diff the uploaded model against. If set, the uploaded
  10902. // model is diffed against the provided revision and those differences
  10903. // are merged with any changes made to the model after the provided
  10904. // revision. If not set, the uploaded model replaces the current model
  10905. // on the server.
  10906. func (c *RealtimeUpdateCall) BaseRevision(baseRevision string) *RealtimeUpdateCall {
  10907. c.urlParams_.Set("baseRevision", baseRevision)
  10908. return c
  10909. }
  10910. // Media specifies the media to upload in one or more chunks. The chunk
  10911. // size may be controlled by supplying a MediaOption generated by
  10912. // googleapi.ChunkSize. The chunk size defaults to
  10913. // googleapi.DefaultUploadChunkSize.The Content-Type header used in the
  10914. // upload request will be determined by sniffing the contents of r,
  10915. // unless a MediaOption generated by googleapi.ContentType is
  10916. // supplied.
  10917. // At most one of Media and ResumableMedia may be set.
  10918. func (c *RealtimeUpdateCall) Media(r io.Reader, options ...googleapi.MediaOption) *RealtimeUpdateCall {
  10919. c.mediaInfo_ = gensupport.NewInfoFromMedia(r, options)
  10920. return c
  10921. }
  10922. // ResumableMedia specifies the media to upload in chunks and can be
  10923. // canceled with ctx.
  10924. //
  10925. // Deprecated: use Media instead.
  10926. //
  10927. // At most one of Media and ResumableMedia may be set. mediaType
  10928. // identifies the MIME media type of the upload, such as "image/png". If
  10929. // mediaType is "", it will be auto-detected. The provided ctx will
  10930. // supersede any context previously provided to the Context method.
  10931. func (c *RealtimeUpdateCall) ResumableMedia(ctx context.Context, r io.ReaderAt, size int64, mediaType string) *RealtimeUpdateCall {
  10932. c.ctx_ = ctx
  10933. c.mediaInfo_ = gensupport.NewInfoFromResumableMedia(r, size, mediaType)
  10934. return c
  10935. }
  10936. // ProgressUpdater provides a callback function that will be called
  10937. // after every chunk. It should be a low-latency function in order to
  10938. // not slow down the upload operation. This should only be called when
  10939. // using ResumableMedia (as opposed to Media).
  10940. func (c *RealtimeUpdateCall) ProgressUpdater(pu googleapi.ProgressUpdater) *RealtimeUpdateCall {
  10941. c.mediaInfo_.SetProgressUpdater(pu)
  10942. return c
  10943. }
  10944. // Fields allows partial responses to be retrieved. See
  10945. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  10946. // for more information.
  10947. func (c *RealtimeUpdateCall) Fields(s ...googleapi.Field) *RealtimeUpdateCall {
  10948. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  10949. return c
  10950. }
  10951. // Context sets the context to be used in this call's Do method. Any
  10952. // pending HTTP request will be aborted if the provided context is
  10953. // canceled.
  10954. // This context will supersede any context previously provided to the
  10955. // ResumableMedia method.
  10956. func (c *RealtimeUpdateCall) Context(ctx context.Context) *RealtimeUpdateCall {
  10957. c.ctx_ = ctx
  10958. return c
  10959. }
  10960. // Header returns an http.Header that can be modified by the caller to
  10961. // add HTTP headers to the request.
  10962. func (c *RealtimeUpdateCall) Header() http.Header {
  10963. if c.header_ == nil {
  10964. c.header_ = make(http.Header)
  10965. }
  10966. return c.header_
  10967. }
  10968. func (c *RealtimeUpdateCall) doRequest(alt string) (*http.Response, error) {
  10969. reqHeaders := make(http.Header)
  10970. for k, v := range c.header_ {
  10971. reqHeaders[k] = v
  10972. }
  10973. reqHeaders.Set("User-Agent", c.s.userAgent())
  10974. var body io.Reader = nil
  10975. c.urlParams_.Set("alt", alt)
  10976. urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/realtime")
  10977. if c.mediaInfo_ != nil {
  10978. urls = strings.Replace(urls, "https://www.googleapis.com/", "https://www.googleapis.com/upload/", 1)
  10979. c.urlParams_.Set("uploadType", c.mediaInfo_.UploadType())
  10980. }
  10981. if body == nil {
  10982. body = new(bytes.Buffer)
  10983. reqHeaders.Set("Content-Type", "application/json")
  10984. }
  10985. body, getBody, cleanup := c.mediaInfo_.UploadRequest(reqHeaders, body)
  10986. defer cleanup()
  10987. urls += "?" + c.urlParams_.Encode()
  10988. req, _ := http.NewRequest("PUT", urls, body)
  10989. req.Header = reqHeaders
  10990. gensupport.SetGetBody(req, getBody)
  10991. googleapi.Expand(req.URL, map[string]string{
  10992. "fileId": c.fileId,
  10993. })
  10994. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  10995. }
  10996. // Do executes the "drive.realtime.update" call.
  10997. func (c *RealtimeUpdateCall) Do(opts ...googleapi.CallOption) error {
  10998. gensupport.SetOptions(c.urlParams_, opts...)
  10999. res, err := c.doRequest("json")
  11000. if err != nil {
  11001. return err
  11002. }
  11003. defer googleapi.CloseBody(res)
  11004. if err := googleapi.CheckResponse(res); err != nil {
  11005. return err
  11006. }
  11007. rx := c.mediaInfo_.ResumableUpload(res.Header.Get("Location"))
  11008. if rx != nil {
  11009. rx.Client = c.s.client
  11010. rx.UserAgent = c.s.userAgent()
  11011. ctx := c.ctx_
  11012. if ctx == nil {
  11013. ctx = context.TODO()
  11014. }
  11015. res, err = rx.Upload(ctx)
  11016. if err != nil {
  11017. return err
  11018. }
  11019. defer res.Body.Close()
  11020. if err := googleapi.CheckResponse(res); err != nil {
  11021. return err
  11022. }
  11023. }
  11024. return nil
  11025. // {
  11026. // "description": "Overwrites the Realtime API data model associated with this file with the provided JSON data model.",
  11027. // "httpMethod": "PUT",
  11028. // "id": "drive.realtime.update",
  11029. // "mediaUpload": {
  11030. // "accept": [
  11031. // "*/*"
  11032. // ],
  11033. // "maxSize": "10MB",
  11034. // "protocols": {
  11035. // "resumable": {
  11036. // "multipart": true,
  11037. // "path": "/resumable/upload/drive/v2/files/{fileId}/realtime"
  11038. // },
  11039. // "simple": {
  11040. // "multipart": true,
  11041. // "path": "/upload/drive/v2/files/{fileId}/realtime"
  11042. // }
  11043. // }
  11044. // },
  11045. // "parameterOrder": [
  11046. // "fileId"
  11047. // ],
  11048. // "parameters": {
  11049. // "baseRevision": {
  11050. // "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.",
  11051. // "location": "query",
  11052. // "type": "string"
  11053. // },
  11054. // "fileId": {
  11055. // "description": "The ID of the file that the Realtime API data model is associated with.",
  11056. // "location": "path",
  11057. // "required": true,
  11058. // "type": "string"
  11059. // }
  11060. // },
  11061. // "path": "files/{fileId}/realtime",
  11062. // "scopes": [
  11063. // "https://www.googleapis.com/auth/drive",
  11064. // "https://www.googleapis.com/auth/drive.file"
  11065. // ],
  11066. // "supportsMediaUpload": true
  11067. // }
  11068. }
  11069. // method id "drive.replies.delete":
  11070. type RepliesDeleteCall struct {
  11071. s *Service
  11072. fileId string
  11073. commentId string
  11074. replyId string
  11075. urlParams_ gensupport.URLParams
  11076. ctx_ context.Context
  11077. header_ http.Header
  11078. }
  11079. // Delete: Deletes a reply.
  11080. func (r *RepliesService) Delete(fileId string, commentId string, replyId string) *RepliesDeleteCall {
  11081. c := &RepliesDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  11082. c.fileId = fileId
  11083. c.commentId = commentId
  11084. c.replyId = replyId
  11085. return c
  11086. }
  11087. // Fields allows partial responses to be retrieved. See
  11088. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  11089. // for more information.
  11090. func (c *RepliesDeleteCall) Fields(s ...googleapi.Field) *RepliesDeleteCall {
  11091. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  11092. return c
  11093. }
  11094. // Context sets the context to be used in this call's Do method. Any
  11095. // pending HTTP request will be aborted if the provided context is
  11096. // canceled.
  11097. func (c *RepliesDeleteCall) Context(ctx context.Context) *RepliesDeleteCall {
  11098. c.ctx_ = ctx
  11099. return c
  11100. }
  11101. // Header returns an http.Header that can be modified by the caller to
  11102. // add HTTP headers to the request.
  11103. func (c *RepliesDeleteCall) Header() http.Header {
  11104. if c.header_ == nil {
  11105. c.header_ = make(http.Header)
  11106. }
  11107. return c.header_
  11108. }
  11109. func (c *RepliesDeleteCall) doRequest(alt string) (*http.Response, error) {
  11110. reqHeaders := make(http.Header)
  11111. for k, v := range c.header_ {
  11112. reqHeaders[k] = v
  11113. }
  11114. reqHeaders.Set("User-Agent", c.s.userAgent())
  11115. var body io.Reader = nil
  11116. c.urlParams_.Set("alt", alt)
  11117. urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/comments/{commentId}/replies/{replyId}")
  11118. urls += "?" + c.urlParams_.Encode()
  11119. req, _ := http.NewRequest("DELETE", urls, body)
  11120. req.Header = reqHeaders
  11121. googleapi.Expand(req.URL, map[string]string{
  11122. "fileId": c.fileId,
  11123. "commentId": c.commentId,
  11124. "replyId": c.replyId,
  11125. })
  11126. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  11127. }
  11128. // Do executes the "drive.replies.delete" call.
  11129. func (c *RepliesDeleteCall) Do(opts ...googleapi.CallOption) error {
  11130. gensupport.SetOptions(c.urlParams_, opts...)
  11131. res, err := c.doRequest("json")
  11132. if err != nil {
  11133. return err
  11134. }
  11135. defer googleapi.CloseBody(res)
  11136. if err := googleapi.CheckResponse(res); err != nil {
  11137. return err
  11138. }
  11139. return nil
  11140. // {
  11141. // "description": "Deletes a reply.",
  11142. // "httpMethod": "DELETE",
  11143. // "id": "drive.replies.delete",
  11144. // "parameterOrder": [
  11145. // "fileId",
  11146. // "commentId",
  11147. // "replyId"
  11148. // ],
  11149. // "parameters": {
  11150. // "commentId": {
  11151. // "description": "The ID of the comment.",
  11152. // "location": "path",
  11153. // "required": true,
  11154. // "type": "string"
  11155. // },
  11156. // "fileId": {
  11157. // "description": "The ID of the file.",
  11158. // "location": "path",
  11159. // "required": true,
  11160. // "type": "string"
  11161. // },
  11162. // "replyId": {
  11163. // "description": "The ID of the reply.",
  11164. // "location": "path",
  11165. // "required": true,
  11166. // "type": "string"
  11167. // }
  11168. // },
  11169. // "path": "files/{fileId}/comments/{commentId}/replies/{replyId}",
  11170. // "scopes": [
  11171. // "https://www.googleapis.com/auth/drive",
  11172. // "https://www.googleapis.com/auth/drive.file"
  11173. // ]
  11174. // }
  11175. }
  11176. // method id "drive.replies.get":
  11177. type RepliesGetCall struct {
  11178. s *Service
  11179. fileId string
  11180. commentId string
  11181. replyId string
  11182. urlParams_ gensupport.URLParams
  11183. ifNoneMatch_ string
  11184. ctx_ context.Context
  11185. header_ http.Header
  11186. }
  11187. // Get: Gets a reply.
  11188. func (r *RepliesService) Get(fileId string, commentId string, replyId string) *RepliesGetCall {
  11189. c := &RepliesGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  11190. c.fileId = fileId
  11191. c.commentId = commentId
  11192. c.replyId = replyId
  11193. return c
  11194. }
  11195. // IncludeDeleted sets the optional parameter "includeDeleted": If set,
  11196. // this will succeed when retrieving a deleted reply.
  11197. func (c *RepliesGetCall) IncludeDeleted(includeDeleted bool) *RepliesGetCall {
  11198. c.urlParams_.Set("includeDeleted", fmt.Sprint(includeDeleted))
  11199. return c
  11200. }
  11201. // Fields allows partial responses to be retrieved. See
  11202. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  11203. // for more information.
  11204. func (c *RepliesGetCall) Fields(s ...googleapi.Field) *RepliesGetCall {
  11205. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  11206. return c
  11207. }
  11208. // IfNoneMatch sets the optional parameter which makes the operation
  11209. // fail if the object's ETag matches the given value. This is useful for
  11210. // getting updates only after the object has changed since the last
  11211. // request. Use googleapi.IsNotModified to check whether the response
  11212. // error from Do is the result of In-None-Match.
  11213. func (c *RepliesGetCall) IfNoneMatch(entityTag string) *RepliesGetCall {
  11214. c.ifNoneMatch_ = entityTag
  11215. return c
  11216. }
  11217. // Context sets the context to be used in this call's Do method. Any
  11218. // pending HTTP request will be aborted if the provided context is
  11219. // canceled.
  11220. func (c *RepliesGetCall) Context(ctx context.Context) *RepliesGetCall {
  11221. c.ctx_ = ctx
  11222. return c
  11223. }
  11224. // Header returns an http.Header that can be modified by the caller to
  11225. // add HTTP headers to the request.
  11226. func (c *RepliesGetCall) Header() http.Header {
  11227. if c.header_ == nil {
  11228. c.header_ = make(http.Header)
  11229. }
  11230. return c.header_
  11231. }
  11232. func (c *RepliesGetCall) doRequest(alt string) (*http.Response, error) {
  11233. reqHeaders := make(http.Header)
  11234. for k, v := range c.header_ {
  11235. reqHeaders[k] = v
  11236. }
  11237. reqHeaders.Set("User-Agent", c.s.userAgent())
  11238. if c.ifNoneMatch_ != "" {
  11239. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  11240. }
  11241. var body io.Reader = nil
  11242. c.urlParams_.Set("alt", alt)
  11243. urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/comments/{commentId}/replies/{replyId}")
  11244. urls += "?" + c.urlParams_.Encode()
  11245. req, _ := http.NewRequest("GET", urls, body)
  11246. req.Header = reqHeaders
  11247. googleapi.Expand(req.URL, map[string]string{
  11248. "fileId": c.fileId,
  11249. "commentId": c.commentId,
  11250. "replyId": c.replyId,
  11251. })
  11252. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  11253. }
  11254. // Do executes the "drive.replies.get" call.
  11255. // Exactly one of *CommentReply or error will be non-nil. Any non-2xx
  11256. // status code is an error. Response headers are in either
  11257. // *CommentReply.ServerResponse.Header or (if a response was returned at
  11258. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  11259. // to check whether the returned error was because
  11260. // http.StatusNotModified was returned.
  11261. func (c *RepliesGetCall) Do(opts ...googleapi.CallOption) (*CommentReply, error) {
  11262. gensupport.SetOptions(c.urlParams_, opts...)
  11263. res, err := c.doRequest("json")
  11264. if res != nil && res.StatusCode == http.StatusNotModified {
  11265. if res.Body != nil {
  11266. res.Body.Close()
  11267. }
  11268. return nil, &googleapi.Error{
  11269. Code: res.StatusCode,
  11270. Header: res.Header,
  11271. }
  11272. }
  11273. if err != nil {
  11274. return nil, err
  11275. }
  11276. defer googleapi.CloseBody(res)
  11277. if err := googleapi.CheckResponse(res); err != nil {
  11278. return nil, err
  11279. }
  11280. ret := &CommentReply{
  11281. ServerResponse: googleapi.ServerResponse{
  11282. Header: res.Header,
  11283. HTTPStatusCode: res.StatusCode,
  11284. },
  11285. }
  11286. target := &ret
  11287. if err := gensupport.DecodeResponse(target, res); err != nil {
  11288. return nil, err
  11289. }
  11290. return ret, nil
  11291. // {
  11292. // "description": "Gets a reply.",
  11293. // "httpMethod": "GET",
  11294. // "id": "drive.replies.get",
  11295. // "parameterOrder": [
  11296. // "fileId",
  11297. // "commentId",
  11298. // "replyId"
  11299. // ],
  11300. // "parameters": {
  11301. // "commentId": {
  11302. // "description": "The ID of the comment.",
  11303. // "location": "path",
  11304. // "required": true,
  11305. // "type": "string"
  11306. // },
  11307. // "fileId": {
  11308. // "description": "The ID of the file.",
  11309. // "location": "path",
  11310. // "required": true,
  11311. // "type": "string"
  11312. // },
  11313. // "includeDeleted": {
  11314. // "default": "false",
  11315. // "description": "If set, this will succeed when retrieving a deleted reply.",
  11316. // "location": "query",
  11317. // "type": "boolean"
  11318. // },
  11319. // "replyId": {
  11320. // "description": "The ID of the reply.",
  11321. // "location": "path",
  11322. // "required": true,
  11323. // "type": "string"
  11324. // }
  11325. // },
  11326. // "path": "files/{fileId}/comments/{commentId}/replies/{replyId}",
  11327. // "response": {
  11328. // "$ref": "CommentReply"
  11329. // },
  11330. // "scopes": [
  11331. // "https://www.googleapis.com/auth/drive",
  11332. // "https://www.googleapis.com/auth/drive.file",
  11333. // "https://www.googleapis.com/auth/drive.readonly"
  11334. // ]
  11335. // }
  11336. }
  11337. // method id "drive.replies.insert":
  11338. type RepliesInsertCall struct {
  11339. s *Service
  11340. fileId string
  11341. commentId string
  11342. commentreply *CommentReply
  11343. urlParams_ gensupport.URLParams
  11344. ctx_ context.Context
  11345. header_ http.Header
  11346. }
  11347. // Insert: Creates a new reply to the given comment.
  11348. func (r *RepliesService) Insert(fileId string, commentId string, commentreply *CommentReply) *RepliesInsertCall {
  11349. c := &RepliesInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  11350. c.fileId = fileId
  11351. c.commentId = commentId
  11352. c.commentreply = commentreply
  11353. return c
  11354. }
  11355. // Fields allows partial responses to be retrieved. See
  11356. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  11357. // for more information.
  11358. func (c *RepliesInsertCall) Fields(s ...googleapi.Field) *RepliesInsertCall {
  11359. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  11360. return c
  11361. }
  11362. // Context sets the context to be used in this call's Do method. Any
  11363. // pending HTTP request will be aborted if the provided context is
  11364. // canceled.
  11365. func (c *RepliesInsertCall) Context(ctx context.Context) *RepliesInsertCall {
  11366. c.ctx_ = ctx
  11367. return c
  11368. }
  11369. // Header returns an http.Header that can be modified by the caller to
  11370. // add HTTP headers to the request.
  11371. func (c *RepliesInsertCall) Header() http.Header {
  11372. if c.header_ == nil {
  11373. c.header_ = make(http.Header)
  11374. }
  11375. return c.header_
  11376. }
  11377. func (c *RepliesInsertCall) doRequest(alt string) (*http.Response, error) {
  11378. reqHeaders := make(http.Header)
  11379. for k, v := range c.header_ {
  11380. reqHeaders[k] = v
  11381. }
  11382. reqHeaders.Set("User-Agent", c.s.userAgent())
  11383. var body io.Reader = nil
  11384. body, err := googleapi.WithoutDataWrapper.JSONReader(c.commentreply)
  11385. if err != nil {
  11386. return nil, err
  11387. }
  11388. reqHeaders.Set("Content-Type", "application/json")
  11389. c.urlParams_.Set("alt", alt)
  11390. urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/comments/{commentId}/replies")
  11391. urls += "?" + c.urlParams_.Encode()
  11392. req, _ := http.NewRequest("POST", urls, body)
  11393. req.Header = reqHeaders
  11394. googleapi.Expand(req.URL, map[string]string{
  11395. "fileId": c.fileId,
  11396. "commentId": c.commentId,
  11397. })
  11398. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  11399. }
  11400. // Do executes the "drive.replies.insert" call.
  11401. // Exactly one of *CommentReply or error will be non-nil. Any non-2xx
  11402. // status code is an error. Response headers are in either
  11403. // *CommentReply.ServerResponse.Header or (if a response was returned at
  11404. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  11405. // to check whether the returned error was because
  11406. // http.StatusNotModified was returned.
  11407. func (c *RepliesInsertCall) Do(opts ...googleapi.CallOption) (*CommentReply, error) {
  11408. gensupport.SetOptions(c.urlParams_, opts...)
  11409. res, err := c.doRequest("json")
  11410. if res != nil && res.StatusCode == http.StatusNotModified {
  11411. if res.Body != nil {
  11412. res.Body.Close()
  11413. }
  11414. return nil, &googleapi.Error{
  11415. Code: res.StatusCode,
  11416. Header: res.Header,
  11417. }
  11418. }
  11419. if err != nil {
  11420. return nil, err
  11421. }
  11422. defer googleapi.CloseBody(res)
  11423. if err := googleapi.CheckResponse(res); err != nil {
  11424. return nil, err
  11425. }
  11426. ret := &CommentReply{
  11427. ServerResponse: googleapi.ServerResponse{
  11428. Header: res.Header,
  11429. HTTPStatusCode: res.StatusCode,
  11430. },
  11431. }
  11432. target := &ret
  11433. if err := gensupport.DecodeResponse(target, res); err != nil {
  11434. return nil, err
  11435. }
  11436. return ret, nil
  11437. // {
  11438. // "description": "Creates a new reply to the given comment.",
  11439. // "httpMethod": "POST",
  11440. // "id": "drive.replies.insert",
  11441. // "parameterOrder": [
  11442. // "fileId",
  11443. // "commentId"
  11444. // ],
  11445. // "parameters": {
  11446. // "commentId": {
  11447. // "description": "The ID of the comment.",
  11448. // "location": "path",
  11449. // "required": true,
  11450. // "type": "string"
  11451. // },
  11452. // "fileId": {
  11453. // "description": "The ID of the file.",
  11454. // "location": "path",
  11455. // "required": true,
  11456. // "type": "string"
  11457. // }
  11458. // },
  11459. // "path": "files/{fileId}/comments/{commentId}/replies",
  11460. // "request": {
  11461. // "$ref": "CommentReply"
  11462. // },
  11463. // "response": {
  11464. // "$ref": "CommentReply"
  11465. // },
  11466. // "scopes": [
  11467. // "https://www.googleapis.com/auth/drive",
  11468. // "https://www.googleapis.com/auth/drive.file"
  11469. // ]
  11470. // }
  11471. }
  11472. // method id "drive.replies.list":
  11473. type RepliesListCall struct {
  11474. s *Service
  11475. fileId string
  11476. commentId string
  11477. urlParams_ gensupport.URLParams
  11478. ifNoneMatch_ string
  11479. ctx_ context.Context
  11480. header_ http.Header
  11481. }
  11482. // List: Lists all of the replies to a comment.
  11483. func (r *RepliesService) List(fileId string, commentId string) *RepliesListCall {
  11484. c := &RepliesListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  11485. c.fileId = fileId
  11486. c.commentId = commentId
  11487. return c
  11488. }
  11489. // IncludeDeleted sets the optional parameter "includeDeleted": If set,
  11490. // all replies, including deleted replies (with content stripped) will
  11491. // be returned.
  11492. func (c *RepliesListCall) IncludeDeleted(includeDeleted bool) *RepliesListCall {
  11493. c.urlParams_.Set("includeDeleted", fmt.Sprint(includeDeleted))
  11494. return c
  11495. }
  11496. // MaxResults sets the optional parameter "maxResults": The maximum
  11497. // number of replies to include in the response, used for paging.
  11498. func (c *RepliesListCall) MaxResults(maxResults int64) *RepliesListCall {
  11499. c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
  11500. return c
  11501. }
  11502. // PageToken sets the optional parameter "pageToken": The continuation
  11503. // token, used to page through large result sets. To get the next page
  11504. // of results, set this parameter to the value of "nextPageToken" from
  11505. // the previous response.
  11506. func (c *RepliesListCall) PageToken(pageToken string) *RepliesListCall {
  11507. c.urlParams_.Set("pageToken", pageToken)
  11508. return c
  11509. }
  11510. // Fields allows partial responses to be retrieved. See
  11511. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  11512. // for more information.
  11513. func (c *RepliesListCall) Fields(s ...googleapi.Field) *RepliesListCall {
  11514. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  11515. return c
  11516. }
  11517. // IfNoneMatch sets the optional parameter which makes the operation
  11518. // fail if the object's ETag matches the given value. This is useful for
  11519. // getting updates only after the object has changed since the last
  11520. // request. Use googleapi.IsNotModified to check whether the response
  11521. // error from Do is the result of In-None-Match.
  11522. func (c *RepliesListCall) IfNoneMatch(entityTag string) *RepliesListCall {
  11523. c.ifNoneMatch_ = entityTag
  11524. return c
  11525. }
  11526. // Context sets the context to be used in this call's Do method. Any
  11527. // pending HTTP request will be aborted if the provided context is
  11528. // canceled.
  11529. func (c *RepliesListCall) Context(ctx context.Context) *RepliesListCall {
  11530. c.ctx_ = ctx
  11531. return c
  11532. }
  11533. // Header returns an http.Header that can be modified by the caller to
  11534. // add HTTP headers to the request.
  11535. func (c *RepliesListCall) Header() http.Header {
  11536. if c.header_ == nil {
  11537. c.header_ = make(http.Header)
  11538. }
  11539. return c.header_
  11540. }
  11541. func (c *RepliesListCall) doRequest(alt string) (*http.Response, error) {
  11542. reqHeaders := make(http.Header)
  11543. for k, v := range c.header_ {
  11544. reqHeaders[k] = v
  11545. }
  11546. reqHeaders.Set("User-Agent", c.s.userAgent())
  11547. if c.ifNoneMatch_ != "" {
  11548. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  11549. }
  11550. var body io.Reader = nil
  11551. c.urlParams_.Set("alt", alt)
  11552. urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/comments/{commentId}/replies")
  11553. urls += "?" + c.urlParams_.Encode()
  11554. req, _ := http.NewRequest("GET", urls, body)
  11555. req.Header = reqHeaders
  11556. googleapi.Expand(req.URL, map[string]string{
  11557. "fileId": c.fileId,
  11558. "commentId": c.commentId,
  11559. })
  11560. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  11561. }
  11562. // Do executes the "drive.replies.list" call.
  11563. // Exactly one of *CommentReplyList or error will be non-nil. Any
  11564. // non-2xx status code is an error. Response headers are in either
  11565. // *CommentReplyList.ServerResponse.Header or (if a response was
  11566. // returned at all) in error.(*googleapi.Error).Header. Use
  11567. // googleapi.IsNotModified to check whether the returned error was
  11568. // because http.StatusNotModified was returned.
  11569. func (c *RepliesListCall) Do(opts ...googleapi.CallOption) (*CommentReplyList, error) {
  11570. gensupport.SetOptions(c.urlParams_, opts...)
  11571. res, err := c.doRequest("json")
  11572. if res != nil && res.StatusCode == http.StatusNotModified {
  11573. if res.Body != nil {
  11574. res.Body.Close()
  11575. }
  11576. return nil, &googleapi.Error{
  11577. Code: res.StatusCode,
  11578. Header: res.Header,
  11579. }
  11580. }
  11581. if err != nil {
  11582. return nil, err
  11583. }
  11584. defer googleapi.CloseBody(res)
  11585. if err := googleapi.CheckResponse(res); err != nil {
  11586. return nil, err
  11587. }
  11588. ret := &CommentReplyList{
  11589. ServerResponse: googleapi.ServerResponse{
  11590. Header: res.Header,
  11591. HTTPStatusCode: res.StatusCode,
  11592. },
  11593. }
  11594. target := &ret
  11595. if err := gensupport.DecodeResponse(target, res); err != nil {
  11596. return nil, err
  11597. }
  11598. return ret, nil
  11599. // {
  11600. // "description": "Lists all of the replies to a comment.",
  11601. // "httpMethod": "GET",
  11602. // "id": "drive.replies.list",
  11603. // "parameterOrder": [
  11604. // "fileId",
  11605. // "commentId"
  11606. // ],
  11607. // "parameters": {
  11608. // "commentId": {
  11609. // "description": "The ID of the comment.",
  11610. // "location": "path",
  11611. // "required": true,
  11612. // "type": "string"
  11613. // },
  11614. // "fileId": {
  11615. // "description": "The ID of the file.",
  11616. // "location": "path",
  11617. // "required": true,
  11618. // "type": "string"
  11619. // },
  11620. // "includeDeleted": {
  11621. // "default": "false",
  11622. // "description": "If set, all replies, including deleted replies (with content stripped) will be returned.",
  11623. // "location": "query",
  11624. // "type": "boolean"
  11625. // },
  11626. // "maxResults": {
  11627. // "default": "20",
  11628. // "description": "The maximum number of replies to include in the response, used for paging.",
  11629. // "format": "int32",
  11630. // "location": "query",
  11631. // "maximum": "100",
  11632. // "minimum": "0",
  11633. // "type": "integer"
  11634. // },
  11635. // "pageToken": {
  11636. // "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.",
  11637. // "location": "query",
  11638. // "type": "string"
  11639. // }
  11640. // },
  11641. // "path": "files/{fileId}/comments/{commentId}/replies",
  11642. // "response": {
  11643. // "$ref": "CommentReplyList"
  11644. // },
  11645. // "scopes": [
  11646. // "https://www.googleapis.com/auth/drive",
  11647. // "https://www.googleapis.com/auth/drive.file",
  11648. // "https://www.googleapis.com/auth/drive.readonly"
  11649. // ]
  11650. // }
  11651. }
  11652. // Pages invokes f for each page of results.
  11653. // A non-nil error returned from f will halt the iteration.
  11654. // The provided context supersedes any context provided to the Context method.
  11655. func (c *RepliesListCall) Pages(ctx context.Context, f func(*CommentReplyList) error) error {
  11656. c.ctx_ = ctx
  11657. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  11658. for {
  11659. x, err := c.Do()
  11660. if err != nil {
  11661. return err
  11662. }
  11663. if err := f(x); err != nil {
  11664. return err
  11665. }
  11666. if x.NextPageToken == "" {
  11667. return nil
  11668. }
  11669. c.PageToken(x.NextPageToken)
  11670. }
  11671. }
  11672. // method id "drive.replies.patch":
  11673. type RepliesPatchCall struct {
  11674. s *Service
  11675. fileId string
  11676. commentId string
  11677. replyId string
  11678. commentreply *CommentReply
  11679. urlParams_ gensupport.URLParams
  11680. ctx_ context.Context
  11681. header_ http.Header
  11682. }
  11683. // Patch: Updates an existing reply. This method supports patch
  11684. // semantics.
  11685. func (r *RepliesService) Patch(fileId string, commentId string, replyId string, commentreply *CommentReply) *RepliesPatchCall {
  11686. c := &RepliesPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  11687. c.fileId = fileId
  11688. c.commentId = commentId
  11689. c.replyId = replyId
  11690. c.commentreply = commentreply
  11691. return c
  11692. }
  11693. // Fields allows partial responses to be retrieved. See
  11694. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  11695. // for more information.
  11696. func (c *RepliesPatchCall) Fields(s ...googleapi.Field) *RepliesPatchCall {
  11697. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  11698. return c
  11699. }
  11700. // Context sets the context to be used in this call's Do method. Any
  11701. // pending HTTP request will be aborted if the provided context is
  11702. // canceled.
  11703. func (c *RepliesPatchCall) Context(ctx context.Context) *RepliesPatchCall {
  11704. c.ctx_ = ctx
  11705. return c
  11706. }
  11707. // Header returns an http.Header that can be modified by the caller to
  11708. // add HTTP headers to the request.
  11709. func (c *RepliesPatchCall) Header() http.Header {
  11710. if c.header_ == nil {
  11711. c.header_ = make(http.Header)
  11712. }
  11713. return c.header_
  11714. }
  11715. func (c *RepliesPatchCall) doRequest(alt string) (*http.Response, error) {
  11716. reqHeaders := make(http.Header)
  11717. for k, v := range c.header_ {
  11718. reqHeaders[k] = v
  11719. }
  11720. reqHeaders.Set("User-Agent", c.s.userAgent())
  11721. var body io.Reader = nil
  11722. body, err := googleapi.WithoutDataWrapper.JSONReader(c.commentreply)
  11723. if err != nil {
  11724. return nil, err
  11725. }
  11726. reqHeaders.Set("Content-Type", "application/json")
  11727. c.urlParams_.Set("alt", alt)
  11728. urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/comments/{commentId}/replies/{replyId}")
  11729. urls += "?" + c.urlParams_.Encode()
  11730. req, _ := http.NewRequest("PATCH", urls, body)
  11731. req.Header = reqHeaders
  11732. googleapi.Expand(req.URL, map[string]string{
  11733. "fileId": c.fileId,
  11734. "commentId": c.commentId,
  11735. "replyId": c.replyId,
  11736. })
  11737. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  11738. }
  11739. // Do executes the "drive.replies.patch" call.
  11740. // Exactly one of *CommentReply or error will be non-nil. Any non-2xx
  11741. // status code is an error. Response headers are in either
  11742. // *CommentReply.ServerResponse.Header or (if a response was returned at
  11743. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  11744. // to check whether the returned error was because
  11745. // http.StatusNotModified was returned.
  11746. func (c *RepliesPatchCall) Do(opts ...googleapi.CallOption) (*CommentReply, error) {
  11747. gensupport.SetOptions(c.urlParams_, opts...)
  11748. res, err := c.doRequest("json")
  11749. if res != nil && res.StatusCode == http.StatusNotModified {
  11750. if res.Body != nil {
  11751. res.Body.Close()
  11752. }
  11753. return nil, &googleapi.Error{
  11754. Code: res.StatusCode,
  11755. Header: res.Header,
  11756. }
  11757. }
  11758. if err != nil {
  11759. return nil, err
  11760. }
  11761. defer googleapi.CloseBody(res)
  11762. if err := googleapi.CheckResponse(res); err != nil {
  11763. return nil, err
  11764. }
  11765. ret := &CommentReply{
  11766. ServerResponse: googleapi.ServerResponse{
  11767. Header: res.Header,
  11768. HTTPStatusCode: res.StatusCode,
  11769. },
  11770. }
  11771. target := &ret
  11772. if err := gensupport.DecodeResponse(target, res); err != nil {
  11773. return nil, err
  11774. }
  11775. return ret, nil
  11776. // {
  11777. // "description": "Updates an existing reply. This method supports patch semantics.",
  11778. // "httpMethod": "PATCH",
  11779. // "id": "drive.replies.patch",
  11780. // "parameterOrder": [
  11781. // "fileId",
  11782. // "commentId",
  11783. // "replyId"
  11784. // ],
  11785. // "parameters": {
  11786. // "commentId": {
  11787. // "description": "The ID of the comment.",
  11788. // "location": "path",
  11789. // "required": true,
  11790. // "type": "string"
  11791. // },
  11792. // "fileId": {
  11793. // "description": "The ID of the file.",
  11794. // "location": "path",
  11795. // "required": true,
  11796. // "type": "string"
  11797. // },
  11798. // "replyId": {
  11799. // "description": "The ID of the reply.",
  11800. // "location": "path",
  11801. // "required": true,
  11802. // "type": "string"
  11803. // }
  11804. // },
  11805. // "path": "files/{fileId}/comments/{commentId}/replies/{replyId}",
  11806. // "request": {
  11807. // "$ref": "CommentReply"
  11808. // },
  11809. // "response": {
  11810. // "$ref": "CommentReply"
  11811. // },
  11812. // "scopes": [
  11813. // "https://www.googleapis.com/auth/drive",
  11814. // "https://www.googleapis.com/auth/drive.file"
  11815. // ]
  11816. // }
  11817. }
  11818. // method id "drive.replies.update":
  11819. type RepliesUpdateCall struct {
  11820. s *Service
  11821. fileId string
  11822. commentId string
  11823. replyId string
  11824. commentreply *CommentReply
  11825. urlParams_ gensupport.URLParams
  11826. ctx_ context.Context
  11827. header_ http.Header
  11828. }
  11829. // Update: Updates an existing reply.
  11830. func (r *RepliesService) Update(fileId string, commentId string, replyId string, commentreply *CommentReply) *RepliesUpdateCall {
  11831. c := &RepliesUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  11832. c.fileId = fileId
  11833. c.commentId = commentId
  11834. c.replyId = replyId
  11835. c.commentreply = commentreply
  11836. return c
  11837. }
  11838. // Fields allows partial responses to be retrieved. See
  11839. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  11840. // for more information.
  11841. func (c *RepliesUpdateCall) Fields(s ...googleapi.Field) *RepliesUpdateCall {
  11842. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  11843. return c
  11844. }
  11845. // Context sets the context to be used in this call's Do method. Any
  11846. // pending HTTP request will be aborted if the provided context is
  11847. // canceled.
  11848. func (c *RepliesUpdateCall) Context(ctx context.Context) *RepliesUpdateCall {
  11849. c.ctx_ = ctx
  11850. return c
  11851. }
  11852. // Header returns an http.Header that can be modified by the caller to
  11853. // add HTTP headers to the request.
  11854. func (c *RepliesUpdateCall) Header() http.Header {
  11855. if c.header_ == nil {
  11856. c.header_ = make(http.Header)
  11857. }
  11858. return c.header_
  11859. }
  11860. func (c *RepliesUpdateCall) doRequest(alt string) (*http.Response, error) {
  11861. reqHeaders := make(http.Header)
  11862. for k, v := range c.header_ {
  11863. reqHeaders[k] = v
  11864. }
  11865. reqHeaders.Set("User-Agent", c.s.userAgent())
  11866. var body io.Reader = nil
  11867. body, err := googleapi.WithoutDataWrapper.JSONReader(c.commentreply)
  11868. if err != nil {
  11869. return nil, err
  11870. }
  11871. reqHeaders.Set("Content-Type", "application/json")
  11872. c.urlParams_.Set("alt", alt)
  11873. urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/comments/{commentId}/replies/{replyId}")
  11874. urls += "?" + c.urlParams_.Encode()
  11875. req, _ := http.NewRequest("PUT", urls, body)
  11876. req.Header = reqHeaders
  11877. googleapi.Expand(req.URL, map[string]string{
  11878. "fileId": c.fileId,
  11879. "commentId": c.commentId,
  11880. "replyId": c.replyId,
  11881. })
  11882. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  11883. }
  11884. // Do executes the "drive.replies.update" call.
  11885. // Exactly one of *CommentReply or error will be non-nil. Any non-2xx
  11886. // status code is an error. Response headers are in either
  11887. // *CommentReply.ServerResponse.Header or (if a response was returned at
  11888. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  11889. // to check whether the returned error was because
  11890. // http.StatusNotModified was returned.
  11891. func (c *RepliesUpdateCall) Do(opts ...googleapi.CallOption) (*CommentReply, error) {
  11892. gensupport.SetOptions(c.urlParams_, opts...)
  11893. res, err := c.doRequest("json")
  11894. if res != nil && res.StatusCode == http.StatusNotModified {
  11895. if res.Body != nil {
  11896. res.Body.Close()
  11897. }
  11898. return nil, &googleapi.Error{
  11899. Code: res.StatusCode,
  11900. Header: res.Header,
  11901. }
  11902. }
  11903. if err != nil {
  11904. return nil, err
  11905. }
  11906. defer googleapi.CloseBody(res)
  11907. if err := googleapi.CheckResponse(res); err != nil {
  11908. return nil, err
  11909. }
  11910. ret := &CommentReply{
  11911. ServerResponse: googleapi.ServerResponse{
  11912. Header: res.Header,
  11913. HTTPStatusCode: res.StatusCode,
  11914. },
  11915. }
  11916. target := &ret
  11917. if err := gensupport.DecodeResponse(target, res); err != nil {
  11918. return nil, err
  11919. }
  11920. return ret, nil
  11921. // {
  11922. // "description": "Updates an existing reply.",
  11923. // "httpMethod": "PUT",
  11924. // "id": "drive.replies.update",
  11925. // "parameterOrder": [
  11926. // "fileId",
  11927. // "commentId",
  11928. // "replyId"
  11929. // ],
  11930. // "parameters": {
  11931. // "commentId": {
  11932. // "description": "The ID of the comment.",
  11933. // "location": "path",
  11934. // "required": true,
  11935. // "type": "string"
  11936. // },
  11937. // "fileId": {
  11938. // "description": "The ID of the file.",
  11939. // "location": "path",
  11940. // "required": true,
  11941. // "type": "string"
  11942. // },
  11943. // "replyId": {
  11944. // "description": "The ID of the reply.",
  11945. // "location": "path",
  11946. // "required": true,
  11947. // "type": "string"
  11948. // }
  11949. // },
  11950. // "path": "files/{fileId}/comments/{commentId}/replies/{replyId}",
  11951. // "request": {
  11952. // "$ref": "CommentReply"
  11953. // },
  11954. // "response": {
  11955. // "$ref": "CommentReply"
  11956. // },
  11957. // "scopes": [
  11958. // "https://www.googleapis.com/auth/drive",
  11959. // "https://www.googleapis.com/auth/drive.file"
  11960. // ]
  11961. // }
  11962. }
  11963. // method id "drive.revisions.delete":
  11964. type RevisionsDeleteCall struct {
  11965. s *Service
  11966. fileId string
  11967. revisionId string
  11968. urlParams_ gensupport.URLParams
  11969. ctx_ context.Context
  11970. header_ http.Header
  11971. }
  11972. // Delete: Removes a revision.
  11973. func (r *RevisionsService) Delete(fileId string, revisionId string) *RevisionsDeleteCall {
  11974. c := &RevisionsDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  11975. c.fileId = fileId
  11976. c.revisionId = revisionId
  11977. return c
  11978. }
  11979. // Fields allows partial responses to be retrieved. See
  11980. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  11981. // for more information.
  11982. func (c *RevisionsDeleteCall) Fields(s ...googleapi.Field) *RevisionsDeleteCall {
  11983. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  11984. return c
  11985. }
  11986. // Context sets the context to be used in this call's Do method. Any
  11987. // pending HTTP request will be aborted if the provided context is
  11988. // canceled.
  11989. func (c *RevisionsDeleteCall) Context(ctx context.Context) *RevisionsDeleteCall {
  11990. c.ctx_ = ctx
  11991. return c
  11992. }
  11993. // Header returns an http.Header that can be modified by the caller to
  11994. // add HTTP headers to the request.
  11995. func (c *RevisionsDeleteCall) Header() http.Header {
  11996. if c.header_ == nil {
  11997. c.header_ = make(http.Header)
  11998. }
  11999. return c.header_
  12000. }
  12001. func (c *RevisionsDeleteCall) doRequest(alt string) (*http.Response, error) {
  12002. reqHeaders := make(http.Header)
  12003. for k, v := range c.header_ {
  12004. reqHeaders[k] = v
  12005. }
  12006. reqHeaders.Set("User-Agent", c.s.userAgent())
  12007. var body io.Reader = nil
  12008. c.urlParams_.Set("alt", alt)
  12009. urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/revisions/{revisionId}")
  12010. urls += "?" + c.urlParams_.Encode()
  12011. req, _ := http.NewRequest("DELETE", urls, body)
  12012. req.Header = reqHeaders
  12013. googleapi.Expand(req.URL, map[string]string{
  12014. "fileId": c.fileId,
  12015. "revisionId": c.revisionId,
  12016. })
  12017. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  12018. }
  12019. // Do executes the "drive.revisions.delete" call.
  12020. func (c *RevisionsDeleteCall) Do(opts ...googleapi.CallOption) error {
  12021. gensupport.SetOptions(c.urlParams_, opts...)
  12022. res, err := c.doRequest("json")
  12023. if err != nil {
  12024. return err
  12025. }
  12026. defer googleapi.CloseBody(res)
  12027. if err := googleapi.CheckResponse(res); err != nil {
  12028. return err
  12029. }
  12030. return nil
  12031. // {
  12032. // "description": "Removes a revision.",
  12033. // "httpMethod": "DELETE",
  12034. // "id": "drive.revisions.delete",
  12035. // "parameterOrder": [
  12036. // "fileId",
  12037. // "revisionId"
  12038. // ],
  12039. // "parameters": {
  12040. // "fileId": {
  12041. // "description": "The ID of the file.",
  12042. // "location": "path",
  12043. // "required": true,
  12044. // "type": "string"
  12045. // },
  12046. // "revisionId": {
  12047. // "description": "The ID of the revision.",
  12048. // "location": "path",
  12049. // "required": true,
  12050. // "type": "string"
  12051. // }
  12052. // },
  12053. // "path": "files/{fileId}/revisions/{revisionId}",
  12054. // "scopes": [
  12055. // "https://www.googleapis.com/auth/drive",
  12056. // "https://www.googleapis.com/auth/drive.appdata",
  12057. // "https://www.googleapis.com/auth/drive.file"
  12058. // ]
  12059. // }
  12060. }
  12061. // method id "drive.revisions.get":
  12062. type RevisionsGetCall struct {
  12063. s *Service
  12064. fileId string
  12065. revisionId string
  12066. urlParams_ gensupport.URLParams
  12067. ifNoneMatch_ string
  12068. ctx_ context.Context
  12069. header_ http.Header
  12070. }
  12071. // Get: Gets a specific revision.
  12072. func (r *RevisionsService) Get(fileId string, revisionId string) *RevisionsGetCall {
  12073. c := &RevisionsGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  12074. c.fileId = fileId
  12075. c.revisionId = revisionId
  12076. return c
  12077. }
  12078. // Fields allows partial responses to be retrieved. See
  12079. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  12080. // for more information.
  12081. func (c *RevisionsGetCall) Fields(s ...googleapi.Field) *RevisionsGetCall {
  12082. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  12083. return c
  12084. }
  12085. // IfNoneMatch sets the optional parameter which makes the operation
  12086. // fail if the object's ETag matches the given value. This is useful for
  12087. // getting updates only after the object has changed since the last
  12088. // request. Use googleapi.IsNotModified to check whether the response
  12089. // error from Do is the result of In-None-Match.
  12090. func (c *RevisionsGetCall) IfNoneMatch(entityTag string) *RevisionsGetCall {
  12091. c.ifNoneMatch_ = entityTag
  12092. return c
  12093. }
  12094. // Context sets the context to be used in this call's Do method. Any
  12095. // pending HTTP request will be aborted if the provided context is
  12096. // canceled.
  12097. func (c *RevisionsGetCall) Context(ctx context.Context) *RevisionsGetCall {
  12098. c.ctx_ = ctx
  12099. return c
  12100. }
  12101. // Header returns an http.Header that can be modified by the caller to
  12102. // add HTTP headers to the request.
  12103. func (c *RevisionsGetCall) Header() http.Header {
  12104. if c.header_ == nil {
  12105. c.header_ = make(http.Header)
  12106. }
  12107. return c.header_
  12108. }
  12109. func (c *RevisionsGetCall) doRequest(alt string) (*http.Response, error) {
  12110. reqHeaders := make(http.Header)
  12111. for k, v := range c.header_ {
  12112. reqHeaders[k] = v
  12113. }
  12114. reqHeaders.Set("User-Agent", c.s.userAgent())
  12115. if c.ifNoneMatch_ != "" {
  12116. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  12117. }
  12118. var body io.Reader = nil
  12119. c.urlParams_.Set("alt", alt)
  12120. urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/revisions/{revisionId}")
  12121. urls += "?" + c.urlParams_.Encode()
  12122. req, _ := http.NewRequest("GET", urls, body)
  12123. req.Header = reqHeaders
  12124. googleapi.Expand(req.URL, map[string]string{
  12125. "fileId": c.fileId,
  12126. "revisionId": c.revisionId,
  12127. })
  12128. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  12129. }
  12130. // Do executes the "drive.revisions.get" call.
  12131. // Exactly one of *Revision or error will be non-nil. Any non-2xx status
  12132. // code is an error. Response headers are in either
  12133. // *Revision.ServerResponse.Header or (if a response was returned at
  12134. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  12135. // to check whether the returned error was because
  12136. // http.StatusNotModified was returned.
  12137. func (c *RevisionsGetCall) Do(opts ...googleapi.CallOption) (*Revision, error) {
  12138. gensupport.SetOptions(c.urlParams_, opts...)
  12139. res, err := c.doRequest("json")
  12140. if res != nil && res.StatusCode == http.StatusNotModified {
  12141. if res.Body != nil {
  12142. res.Body.Close()
  12143. }
  12144. return nil, &googleapi.Error{
  12145. Code: res.StatusCode,
  12146. Header: res.Header,
  12147. }
  12148. }
  12149. if err != nil {
  12150. return nil, err
  12151. }
  12152. defer googleapi.CloseBody(res)
  12153. if err := googleapi.CheckResponse(res); err != nil {
  12154. return nil, err
  12155. }
  12156. ret := &Revision{
  12157. ServerResponse: googleapi.ServerResponse{
  12158. Header: res.Header,
  12159. HTTPStatusCode: res.StatusCode,
  12160. },
  12161. }
  12162. target := &ret
  12163. if err := gensupport.DecodeResponse(target, res); err != nil {
  12164. return nil, err
  12165. }
  12166. return ret, nil
  12167. // {
  12168. // "description": "Gets a specific revision.",
  12169. // "httpMethod": "GET",
  12170. // "id": "drive.revisions.get",
  12171. // "parameterOrder": [
  12172. // "fileId",
  12173. // "revisionId"
  12174. // ],
  12175. // "parameters": {
  12176. // "fileId": {
  12177. // "description": "The ID of the file.",
  12178. // "location": "path",
  12179. // "required": true,
  12180. // "type": "string"
  12181. // },
  12182. // "revisionId": {
  12183. // "description": "The ID of the revision.",
  12184. // "location": "path",
  12185. // "required": true,
  12186. // "type": "string"
  12187. // }
  12188. // },
  12189. // "path": "files/{fileId}/revisions/{revisionId}",
  12190. // "response": {
  12191. // "$ref": "Revision"
  12192. // },
  12193. // "scopes": [
  12194. // "https://www.googleapis.com/auth/drive",
  12195. // "https://www.googleapis.com/auth/drive.appdata",
  12196. // "https://www.googleapis.com/auth/drive.file",
  12197. // "https://www.googleapis.com/auth/drive.metadata",
  12198. // "https://www.googleapis.com/auth/drive.metadata.readonly",
  12199. // "https://www.googleapis.com/auth/drive.photos.readonly",
  12200. // "https://www.googleapis.com/auth/drive.readonly"
  12201. // ]
  12202. // }
  12203. }
  12204. // method id "drive.revisions.list":
  12205. type RevisionsListCall struct {
  12206. s *Service
  12207. fileId string
  12208. urlParams_ gensupport.URLParams
  12209. ifNoneMatch_ string
  12210. ctx_ context.Context
  12211. header_ http.Header
  12212. }
  12213. // List: Lists a file's revisions.
  12214. func (r *RevisionsService) List(fileId string) *RevisionsListCall {
  12215. c := &RevisionsListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  12216. c.fileId = fileId
  12217. return c
  12218. }
  12219. // MaxResults sets the optional parameter "maxResults": Maximum number
  12220. // of revisions to return.
  12221. func (c *RevisionsListCall) MaxResults(maxResults int64) *RevisionsListCall {
  12222. c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
  12223. return c
  12224. }
  12225. // PageToken sets the optional parameter "pageToken": Page token for
  12226. // revisions. To get the next page of results, set this parameter to the
  12227. // value of "nextPageToken" from the previous response.
  12228. func (c *RevisionsListCall) PageToken(pageToken string) *RevisionsListCall {
  12229. c.urlParams_.Set("pageToken", pageToken)
  12230. return c
  12231. }
  12232. // Fields allows partial responses to be retrieved. See
  12233. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  12234. // for more information.
  12235. func (c *RevisionsListCall) Fields(s ...googleapi.Field) *RevisionsListCall {
  12236. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  12237. return c
  12238. }
  12239. // IfNoneMatch sets the optional parameter which makes the operation
  12240. // fail if the object's ETag matches the given value. This is useful for
  12241. // getting updates only after the object has changed since the last
  12242. // request. Use googleapi.IsNotModified to check whether the response
  12243. // error from Do is the result of In-None-Match.
  12244. func (c *RevisionsListCall) IfNoneMatch(entityTag string) *RevisionsListCall {
  12245. c.ifNoneMatch_ = entityTag
  12246. return c
  12247. }
  12248. // Context sets the context to be used in this call's Do method. Any
  12249. // pending HTTP request will be aborted if the provided context is
  12250. // canceled.
  12251. func (c *RevisionsListCall) Context(ctx context.Context) *RevisionsListCall {
  12252. c.ctx_ = ctx
  12253. return c
  12254. }
  12255. // Header returns an http.Header that can be modified by the caller to
  12256. // add HTTP headers to the request.
  12257. func (c *RevisionsListCall) Header() http.Header {
  12258. if c.header_ == nil {
  12259. c.header_ = make(http.Header)
  12260. }
  12261. return c.header_
  12262. }
  12263. func (c *RevisionsListCall) doRequest(alt string) (*http.Response, error) {
  12264. reqHeaders := make(http.Header)
  12265. for k, v := range c.header_ {
  12266. reqHeaders[k] = v
  12267. }
  12268. reqHeaders.Set("User-Agent", c.s.userAgent())
  12269. if c.ifNoneMatch_ != "" {
  12270. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  12271. }
  12272. var body io.Reader = nil
  12273. c.urlParams_.Set("alt", alt)
  12274. urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/revisions")
  12275. urls += "?" + c.urlParams_.Encode()
  12276. req, _ := http.NewRequest("GET", urls, body)
  12277. req.Header = reqHeaders
  12278. googleapi.Expand(req.URL, map[string]string{
  12279. "fileId": c.fileId,
  12280. })
  12281. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  12282. }
  12283. // Do executes the "drive.revisions.list" call.
  12284. // Exactly one of *RevisionList or error will be non-nil. Any non-2xx
  12285. // status code is an error. Response headers are in either
  12286. // *RevisionList.ServerResponse.Header or (if a response was returned at
  12287. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  12288. // to check whether the returned error was because
  12289. // http.StatusNotModified was returned.
  12290. func (c *RevisionsListCall) Do(opts ...googleapi.CallOption) (*RevisionList, error) {
  12291. gensupport.SetOptions(c.urlParams_, opts...)
  12292. res, err := c.doRequest("json")
  12293. if res != nil && res.StatusCode == http.StatusNotModified {
  12294. if res.Body != nil {
  12295. res.Body.Close()
  12296. }
  12297. return nil, &googleapi.Error{
  12298. Code: res.StatusCode,
  12299. Header: res.Header,
  12300. }
  12301. }
  12302. if err != nil {
  12303. return nil, err
  12304. }
  12305. defer googleapi.CloseBody(res)
  12306. if err := googleapi.CheckResponse(res); err != nil {
  12307. return nil, err
  12308. }
  12309. ret := &RevisionList{
  12310. ServerResponse: googleapi.ServerResponse{
  12311. Header: res.Header,
  12312. HTTPStatusCode: res.StatusCode,
  12313. },
  12314. }
  12315. target := &ret
  12316. if err := gensupport.DecodeResponse(target, res); err != nil {
  12317. return nil, err
  12318. }
  12319. return ret, nil
  12320. // {
  12321. // "description": "Lists a file's revisions.",
  12322. // "httpMethod": "GET",
  12323. // "id": "drive.revisions.list",
  12324. // "parameterOrder": [
  12325. // "fileId"
  12326. // ],
  12327. // "parameters": {
  12328. // "fileId": {
  12329. // "description": "The ID of the file.",
  12330. // "location": "path",
  12331. // "required": true,
  12332. // "type": "string"
  12333. // },
  12334. // "maxResults": {
  12335. // "default": "200",
  12336. // "description": "Maximum number of revisions to return.",
  12337. // "format": "int32",
  12338. // "location": "query",
  12339. // "maximum": "1000",
  12340. // "minimum": "1",
  12341. // "type": "integer"
  12342. // },
  12343. // "pageToken": {
  12344. // "description": "Page token for revisions. To get the next page of results, set this parameter to the value of \"nextPageToken\" from the previous response.",
  12345. // "location": "query",
  12346. // "type": "string"
  12347. // }
  12348. // },
  12349. // "path": "files/{fileId}/revisions",
  12350. // "response": {
  12351. // "$ref": "RevisionList"
  12352. // },
  12353. // "scopes": [
  12354. // "https://www.googleapis.com/auth/drive",
  12355. // "https://www.googleapis.com/auth/drive.appdata",
  12356. // "https://www.googleapis.com/auth/drive.file",
  12357. // "https://www.googleapis.com/auth/drive.metadata",
  12358. // "https://www.googleapis.com/auth/drive.metadata.readonly",
  12359. // "https://www.googleapis.com/auth/drive.photos.readonly",
  12360. // "https://www.googleapis.com/auth/drive.readonly"
  12361. // ]
  12362. // }
  12363. }
  12364. // Pages invokes f for each page of results.
  12365. // A non-nil error returned from f will halt the iteration.
  12366. // The provided context supersedes any context provided to the Context method.
  12367. func (c *RevisionsListCall) Pages(ctx context.Context, f func(*RevisionList) error) error {
  12368. c.ctx_ = ctx
  12369. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  12370. for {
  12371. x, err := c.Do()
  12372. if err != nil {
  12373. return err
  12374. }
  12375. if err := f(x); err != nil {
  12376. return err
  12377. }
  12378. if x.NextPageToken == "" {
  12379. return nil
  12380. }
  12381. c.PageToken(x.NextPageToken)
  12382. }
  12383. }
  12384. // method id "drive.revisions.patch":
  12385. type RevisionsPatchCall struct {
  12386. s *Service
  12387. fileId string
  12388. revisionId string
  12389. revision *Revision
  12390. urlParams_ gensupport.URLParams
  12391. ctx_ context.Context
  12392. header_ http.Header
  12393. }
  12394. // Patch: Updates a revision. This method supports patch semantics.
  12395. func (r *RevisionsService) Patch(fileId string, revisionId string, revision *Revision) *RevisionsPatchCall {
  12396. c := &RevisionsPatchCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  12397. c.fileId = fileId
  12398. c.revisionId = revisionId
  12399. c.revision = revision
  12400. return c
  12401. }
  12402. // Fields allows partial responses to be retrieved. See
  12403. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  12404. // for more information.
  12405. func (c *RevisionsPatchCall) Fields(s ...googleapi.Field) *RevisionsPatchCall {
  12406. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  12407. return c
  12408. }
  12409. // Context sets the context to be used in this call's Do method. Any
  12410. // pending HTTP request will be aborted if the provided context is
  12411. // canceled.
  12412. func (c *RevisionsPatchCall) Context(ctx context.Context) *RevisionsPatchCall {
  12413. c.ctx_ = ctx
  12414. return c
  12415. }
  12416. // Header returns an http.Header that can be modified by the caller to
  12417. // add HTTP headers to the request.
  12418. func (c *RevisionsPatchCall) Header() http.Header {
  12419. if c.header_ == nil {
  12420. c.header_ = make(http.Header)
  12421. }
  12422. return c.header_
  12423. }
  12424. func (c *RevisionsPatchCall) doRequest(alt string) (*http.Response, error) {
  12425. reqHeaders := make(http.Header)
  12426. for k, v := range c.header_ {
  12427. reqHeaders[k] = v
  12428. }
  12429. reqHeaders.Set("User-Agent", c.s.userAgent())
  12430. var body io.Reader = nil
  12431. body, err := googleapi.WithoutDataWrapper.JSONReader(c.revision)
  12432. if err != nil {
  12433. return nil, err
  12434. }
  12435. reqHeaders.Set("Content-Type", "application/json")
  12436. c.urlParams_.Set("alt", alt)
  12437. urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/revisions/{revisionId}")
  12438. urls += "?" + c.urlParams_.Encode()
  12439. req, _ := http.NewRequest("PATCH", urls, body)
  12440. req.Header = reqHeaders
  12441. googleapi.Expand(req.URL, map[string]string{
  12442. "fileId": c.fileId,
  12443. "revisionId": c.revisionId,
  12444. })
  12445. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  12446. }
  12447. // Do executes the "drive.revisions.patch" call.
  12448. // Exactly one of *Revision or error will be non-nil. Any non-2xx status
  12449. // code is an error. Response headers are in either
  12450. // *Revision.ServerResponse.Header or (if a response was returned at
  12451. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  12452. // to check whether the returned error was because
  12453. // http.StatusNotModified was returned.
  12454. func (c *RevisionsPatchCall) Do(opts ...googleapi.CallOption) (*Revision, error) {
  12455. gensupport.SetOptions(c.urlParams_, opts...)
  12456. res, err := c.doRequest("json")
  12457. if res != nil && res.StatusCode == http.StatusNotModified {
  12458. if res.Body != nil {
  12459. res.Body.Close()
  12460. }
  12461. return nil, &googleapi.Error{
  12462. Code: res.StatusCode,
  12463. Header: res.Header,
  12464. }
  12465. }
  12466. if err != nil {
  12467. return nil, err
  12468. }
  12469. defer googleapi.CloseBody(res)
  12470. if err := googleapi.CheckResponse(res); err != nil {
  12471. return nil, err
  12472. }
  12473. ret := &Revision{
  12474. ServerResponse: googleapi.ServerResponse{
  12475. Header: res.Header,
  12476. HTTPStatusCode: res.StatusCode,
  12477. },
  12478. }
  12479. target := &ret
  12480. if err := gensupport.DecodeResponse(target, res); err != nil {
  12481. return nil, err
  12482. }
  12483. return ret, nil
  12484. // {
  12485. // "description": "Updates a revision. This method supports patch semantics.",
  12486. // "httpMethod": "PATCH",
  12487. // "id": "drive.revisions.patch",
  12488. // "parameterOrder": [
  12489. // "fileId",
  12490. // "revisionId"
  12491. // ],
  12492. // "parameters": {
  12493. // "fileId": {
  12494. // "description": "The ID for the file.",
  12495. // "location": "path",
  12496. // "required": true,
  12497. // "type": "string"
  12498. // },
  12499. // "revisionId": {
  12500. // "description": "The ID for the revision.",
  12501. // "location": "path",
  12502. // "required": true,
  12503. // "type": "string"
  12504. // }
  12505. // },
  12506. // "path": "files/{fileId}/revisions/{revisionId}",
  12507. // "request": {
  12508. // "$ref": "Revision"
  12509. // },
  12510. // "response": {
  12511. // "$ref": "Revision"
  12512. // },
  12513. // "scopes": [
  12514. // "https://www.googleapis.com/auth/drive",
  12515. // "https://www.googleapis.com/auth/drive.appdata",
  12516. // "https://www.googleapis.com/auth/drive.file"
  12517. // ]
  12518. // }
  12519. }
  12520. // method id "drive.revisions.update":
  12521. type RevisionsUpdateCall struct {
  12522. s *Service
  12523. fileId string
  12524. revisionId string
  12525. revision *Revision
  12526. urlParams_ gensupport.URLParams
  12527. ctx_ context.Context
  12528. header_ http.Header
  12529. }
  12530. // Update: Updates a revision.
  12531. func (r *RevisionsService) Update(fileId string, revisionId string, revision *Revision) *RevisionsUpdateCall {
  12532. c := &RevisionsUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  12533. c.fileId = fileId
  12534. c.revisionId = revisionId
  12535. c.revision = revision
  12536. return c
  12537. }
  12538. // Fields allows partial responses to be retrieved. See
  12539. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  12540. // for more information.
  12541. func (c *RevisionsUpdateCall) Fields(s ...googleapi.Field) *RevisionsUpdateCall {
  12542. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  12543. return c
  12544. }
  12545. // Context sets the context to be used in this call's Do method. Any
  12546. // pending HTTP request will be aborted if the provided context is
  12547. // canceled.
  12548. func (c *RevisionsUpdateCall) Context(ctx context.Context) *RevisionsUpdateCall {
  12549. c.ctx_ = ctx
  12550. return c
  12551. }
  12552. // Header returns an http.Header that can be modified by the caller to
  12553. // add HTTP headers to the request.
  12554. func (c *RevisionsUpdateCall) Header() http.Header {
  12555. if c.header_ == nil {
  12556. c.header_ = make(http.Header)
  12557. }
  12558. return c.header_
  12559. }
  12560. func (c *RevisionsUpdateCall) doRequest(alt string) (*http.Response, error) {
  12561. reqHeaders := make(http.Header)
  12562. for k, v := range c.header_ {
  12563. reqHeaders[k] = v
  12564. }
  12565. reqHeaders.Set("User-Agent", c.s.userAgent())
  12566. var body io.Reader = nil
  12567. body, err := googleapi.WithoutDataWrapper.JSONReader(c.revision)
  12568. if err != nil {
  12569. return nil, err
  12570. }
  12571. reqHeaders.Set("Content-Type", "application/json")
  12572. c.urlParams_.Set("alt", alt)
  12573. urls := googleapi.ResolveRelative(c.s.BasePath, "files/{fileId}/revisions/{revisionId}")
  12574. urls += "?" + c.urlParams_.Encode()
  12575. req, _ := http.NewRequest("PUT", urls, body)
  12576. req.Header = reqHeaders
  12577. googleapi.Expand(req.URL, map[string]string{
  12578. "fileId": c.fileId,
  12579. "revisionId": c.revisionId,
  12580. })
  12581. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  12582. }
  12583. // Do executes the "drive.revisions.update" call.
  12584. // Exactly one of *Revision or error will be non-nil. Any non-2xx status
  12585. // code is an error. Response headers are in either
  12586. // *Revision.ServerResponse.Header or (if a response was returned at
  12587. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  12588. // to check whether the returned error was because
  12589. // http.StatusNotModified was returned.
  12590. func (c *RevisionsUpdateCall) Do(opts ...googleapi.CallOption) (*Revision, error) {
  12591. gensupport.SetOptions(c.urlParams_, opts...)
  12592. res, err := c.doRequest("json")
  12593. if res != nil && res.StatusCode == http.StatusNotModified {
  12594. if res.Body != nil {
  12595. res.Body.Close()
  12596. }
  12597. return nil, &googleapi.Error{
  12598. Code: res.StatusCode,
  12599. Header: res.Header,
  12600. }
  12601. }
  12602. if err != nil {
  12603. return nil, err
  12604. }
  12605. defer googleapi.CloseBody(res)
  12606. if err := googleapi.CheckResponse(res); err != nil {
  12607. return nil, err
  12608. }
  12609. ret := &Revision{
  12610. ServerResponse: googleapi.ServerResponse{
  12611. Header: res.Header,
  12612. HTTPStatusCode: res.StatusCode,
  12613. },
  12614. }
  12615. target := &ret
  12616. if err := gensupport.DecodeResponse(target, res); err != nil {
  12617. return nil, err
  12618. }
  12619. return ret, nil
  12620. // {
  12621. // "description": "Updates a revision.",
  12622. // "httpMethod": "PUT",
  12623. // "id": "drive.revisions.update",
  12624. // "parameterOrder": [
  12625. // "fileId",
  12626. // "revisionId"
  12627. // ],
  12628. // "parameters": {
  12629. // "fileId": {
  12630. // "description": "The ID for the file.",
  12631. // "location": "path",
  12632. // "required": true,
  12633. // "type": "string"
  12634. // },
  12635. // "revisionId": {
  12636. // "description": "The ID for the revision.",
  12637. // "location": "path",
  12638. // "required": true,
  12639. // "type": "string"
  12640. // }
  12641. // },
  12642. // "path": "files/{fileId}/revisions/{revisionId}",
  12643. // "request": {
  12644. // "$ref": "Revision"
  12645. // },
  12646. // "response": {
  12647. // "$ref": "Revision"
  12648. // },
  12649. // "scopes": [
  12650. // "https://www.googleapis.com/auth/drive",
  12651. // "https://www.googleapis.com/auth/drive.appdata",
  12652. // "https://www.googleapis.com/auth/drive.file"
  12653. // ]
  12654. // }
  12655. }
  12656. // method id "drive.teamdrives.delete":
  12657. type TeamdrivesDeleteCall struct {
  12658. s *Service
  12659. teamDriveId string
  12660. urlParams_ gensupport.URLParams
  12661. ctx_ context.Context
  12662. header_ http.Header
  12663. }
  12664. // Delete: Permanently deletes a Team Drive for which the user is an
  12665. // organizer. The Team Drive cannot contain any untrashed items.
  12666. func (r *TeamdrivesService) Delete(teamDriveId string) *TeamdrivesDeleteCall {
  12667. c := &TeamdrivesDeleteCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  12668. c.teamDriveId = teamDriveId
  12669. return c
  12670. }
  12671. // Fields allows partial responses to be retrieved. See
  12672. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  12673. // for more information.
  12674. func (c *TeamdrivesDeleteCall) Fields(s ...googleapi.Field) *TeamdrivesDeleteCall {
  12675. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  12676. return c
  12677. }
  12678. // Context sets the context to be used in this call's Do method. Any
  12679. // pending HTTP request will be aborted if the provided context is
  12680. // canceled.
  12681. func (c *TeamdrivesDeleteCall) Context(ctx context.Context) *TeamdrivesDeleteCall {
  12682. c.ctx_ = ctx
  12683. return c
  12684. }
  12685. // Header returns an http.Header that can be modified by the caller to
  12686. // add HTTP headers to the request.
  12687. func (c *TeamdrivesDeleteCall) Header() http.Header {
  12688. if c.header_ == nil {
  12689. c.header_ = make(http.Header)
  12690. }
  12691. return c.header_
  12692. }
  12693. func (c *TeamdrivesDeleteCall) doRequest(alt string) (*http.Response, error) {
  12694. reqHeaders := make(http.Header)
  12695. for k, v := range c.header_ {
  12696. reqHeaders[k] = v
  12697. }
  12698. reqHeaders.Set("User-Agent", c.s.userAgent())
  12699. var body io.Reader = nil
  12700. c.urlParams_.Set("alt", alt)
  12701. urls := googleapi.ResolveRelative(c.s.BasePath, "teamdrives/{teamDriveId}")
  12702. urls += "?" + c.urlParams_.Encode()
  12703. req, _ := http.NewRequest("DELETE", urls, body)
  12704. req.Header = reqHeaders
  12705. googleapi.Expand(req.URL, map[string]string{
  12706. "teamDriveId": c.teamDriveId,
  12707. })
  12708. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  12709. }
  12710. // Do executes the "drive.teamdrives.delete" call.
  12711. func (c *TeamdrivesDeleteCall) Do(opts ...googleapi.CallOption) error {
  12712. gensupport.SetOptions(c.urlParams_, opts...)
  12713. res, err := c.doRequest("json")
  12714. if err != nil {
  12715. return err
  12716. }
  12717. defer googleapi.CloseBody(res)
  12718. if err := googleapi.CheckResponse(res); err != nil {
  12719. return err
  12720. }
  12721. return nil
  12722. // {
  12723. // "description": "Permanently deletes a Team Drive for which the user is an organizer. The Team Drive cannot contain any untrashed items.",
  12724. // "httpMethod": "DELETE",
  12725. // "id": "drive.teamdrives.delete",
  12726. // "parameterOrder": [
  12727. // "teamDriveId"
  12728. // ],
  12729. // "parameters": {
  12730. // "teamDriveId": {
  12731. // "description": "The ID of the Team Drive",
  12732. // "location": "path",
  12733. // "required": true,
  12734. // "type": "string"
  12735. // }
  12736. // },
  12737. // "path": "teamdrives/{teamDriveId}",
  12738. // "scopes": [
  12739. // "https://www.googleapis.com/auth/drive"
  12740. // ]
  12741. // }
  12742. }
  12743. // method id "drive.teamdrives.get":
  12744. type TeamdrivesGetCall struct {
  12745. s *Service
  12746. teamDriveId string
  12747. urlParams_ gensupport.URLParams
  12748. ifNoneMatch_ string
  12749. ctx_ context.Context
  12750. header_ http.Header
  12751. }
  12752. // Get: Gets a Team Drive's metadata by ID.
  12753. func (r *TeamdrivesService) Get(teamDriveId string) *TeamdrivesGetCall {
  12754. c := &TeamdrivesGetCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  12755. c.teamDriveId = teamDriveId
  12756. return c
  12757. }
  12758. // UseDomainAdminAccess sets the optional parameter
  12759. // "useDomainAdminAccess": Whether the request should be treated as if
  12760. // it was issued by a domain administrator; if set to true, then the
  12761. // requester will be granted access if they are an administrator of the
  12762. // domain to which the Team Drive belongs.
  12763. func (c *TeamdrivesGetCall) UseDomainAdminAccess(useDomainAdminAccess bool) *TeamdrivesGetCall {
  12764. c.urlParams_.Set("useDomainAdminAccess", fmt.Sprint(useDomainAdminAccess))
  12765. return c
  12766. }
  12767. // Fields allows partial responses to be retrieved. See
  12768. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  12769. // for more information.
  12770. func (c *TeamdrivesGetCall) Fields(s ...googleapi.Field) *TeamdrivesGetCall {
  12771. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  12772. return c
  12773. }
  12774. // IfNoneMatch sets the optional parameter which makes the operation
  12775. // fail if the object's ETag matches the given value. This is useful for
  12776. // getting updates only after the object has changed since the last
  12777. // request. Use googleapi.IsNotModified to check whether the response
  12778. // error from Do is the result of In-None-Match.
  12779. func (c *TeamdrivesGetCall) IfNoneMatch(entityTag string) *TeamdrivesGetCall {
  12780. c.ifNoneMatch_ = entityTag
  12781. return c
  12782. }
  12783. // Context sets the context to be used in this call's Do method. Any
  12784. // pending HTTP request will be aborted if the provided context is
  12785. // canceled.
  12786. func (c *TeamdrivesGetCall) Context(ctx context.Context) *TeamdrivesGetCall {
  12787. c.ctx_ = ctx
  12788. return c
  12789. }
  12790. // Header returns an http.Header that can be modified by the caller to
  12791. // add HTTP headers to the request.
  12792. func (c *TeamdrivesGetCall) Header() http.Header {
  12793. if c.header_ == nil {
  12794. c.header_ = make(http.Header)
  12795. }
  12796. return c.header_
  12797. }
  12798. func (c *TeamdrivesGetCall) doRequest(alt string) (*http.Response, error) {
  12799. reqHeaders := make(http.Header)
  12800. for k, v := range c.header_ {
  12801. reqHeaders[k] = v
  12802. }
  12803. reqHeaders.Set("User-Agent", c.s.userAgent())
  12804. if c.ifNoneMatch_ != "" {
  12805. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  12806. }
  12807. var body io.Reader = nil
  12808. c.urlParams_.Set("alt", alt)
  12809. urls := googleapi.ResolveRelative(c.s.BasePath, "teamdrives/{teamDriveId}")
  12810. urls += "?" + c.urlParams_.Encode()
  12811. req, _ := http.NewRequest("GET", urls, body)
  12812. req.Header = reqHeaders
  12813. googleapi.Expand(req.URL, map[string]string{
  12814. "teamDriveId": c.teamDriveId,
  12815. })
  12816. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  12817. }
  12818. // Do executes the "drive.teamdrives.get" call.
  12819. // Exactly one of *TeamDrive or error will be non-nil. Any non-2xx
  12820. // status code is an error. Response headers are in either
  12821. // *TeamDrive.ServerResponse.Header or (if a response was returned at
  12822. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  12823. // to check whether the returned error was because
  12824. // http.StatusNotModified was returned.
  12825. func (c *TeamdrivesGetCall) Do(opts ...googleapi.CallOption) (*TeamDrive, error) {
  12826. gensupport.SetOptions(c.urlParams_, opts...)
  12827. res, err := c.doRequest("json")
  12828. if res != nil && res.StatusCode == http.StatusNotModified {
  12829. if res.Body != nil {
  12830. res.Body.Close()
  12831. }
  12832. return nil, &googleapi.Error{
  12833. Code: res.StatusCode,
  12834. Header: res.Header,
  12835. }
  12836. }
  12837. if err != nil {
  12838. return nil, err
  12839. }
  12840. defer googleapi.CloseBody(res)
  12841. if err := googleapi.CheckResponse(res); err != nil {
  12842. return nil, err
  12843. }
  12844. ret := &TeamDrive{
  12845. ServerResponse: googleapi.ServerResponse{
  12846. Header: res.Header,
  12847. HTTPStatusCode: res.StatusCode,
  12848. },
  12849. }
  12850. target := &ret
  12851. if err := gensupport.DecodeResponse(target, res); err != nil {
  12852. return nil, err
  12853. }
  12854. return ret, nil
  12855. // {
  12856. // "description": "Gets a Team Drive's metadata by ID.",
  12857. // "httpMethod": "GET",
  12858. // "id": "drive.teamdrives.get",
  12859. // "parameterOrder": [
  12860. // "teamDriveId"
  12861. // ],
  12862. // "parameters": {
  12863. // "teamDriveId": {
  12864. // "description": "The ID of the Team Drive",
  12865. // "location": "path",
  12866. // "required": true,
  12867. // "type": "string"
  12868. // },
  12869. // "useDomainAdminAccess": {
  12870. // "default": "false",
  12871. // "description": "Whether the request should be treated as if it was issued by a domain administrator; if set to true, then the requester will be granted access if they are an administrator of the domain to which the Team Drive belongs.",
  12872. // "location": "query",
  12873. // "type": "boolean"
  12874. // }
  12875. // },
  12876. // "path": "teamdrives/{teamDriveId}",
  12877. // "response": {
  12878. // "$ref": "TeamDrive"
  12879. // },
  12880. // "scopes": [
  12881. // "https://www.googleapis.com/auth/drive",
  12882. // "https://www.googleapis.com/auth/drive.readonly"
  12883. // ]
  12884. // }
  12885. }
  12886. // method id "drive.teamdrives.insert":
  12887. type TeamdrivesInsertCall struct {
  12888. s *Service
  12889. teamdrive *TeamDrive
  12890. urlParams_ gensupport.URLParams
  12891. ctx_ context.Context
  12892. header_ http.Header
  12893. }
  12894. // Insert: Creates a new Team Drive.
  12895. func (r *TeamdrivesService) Insert(requestId string, teamdrive *TeamDrive) *TeamdrivesInsertCall {
  12896. c := &TeamdrivesInsertCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  12897. c.urlParams_.Set("requestId", requestId)
  12898. c.teamdrive = teamdrive
  12899. return c
  12900. }
  12901. // Fields allows partial responses to be retrieved. See
  12902. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  12903. // for more information.
  12904. func (c *TeamdrivesInsertCall) Fields(s ...googleapi.Field) *TeamdrivesInsertCall {
  12905. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  12906. return c
  12907. }
  12908. // Context sets the context to be used in this call's Do method. Any
  12909. // pending HTTP request will be aborted if the provided context is
  12910. // canceled.
  12911. func (c *TeamdrivesInsertCall) Context(ctx context.Context) *TeamdrivesInsertCall {
  12912. c.ctx_ = ctx
  12913. return c
  12914. }
  12915. // Header returns an http.Header that can be modified by the caller to
  12916. // add HTTP headers to the request.
  12917. func (c *TeamdrivesInsertCall) Header() http.Header {
  12918. if c.header_ == nil {
  12919. c.header_ = make(http.Header)
  12920. }
  12921. return c.header_
  12922. }
  12923. func (c *TeamdrivesInsertCall) doRequest(alt string) (*http.Response, error) {
  12924. reqHeaders := make(http.Header)
  12925. for k, v := range c.header_ {
  12926. reqHeaders[k] = v
  12927. }
  12928. reqHeaders.Set("User-Agent", c.s.userAgent())
  12929. var body io.Reader = nil
  12930. body, err := googleapi.WithoutDataWrapper.JSONReader(c.teamdrive)
  12931. if err != nil {
  12932. return nil, err
  12933. }
  12934. reqHeaders.Set("Content-Type", "application/json")
  12935. c.urlParams_.Set("alt", alt)
  12936. urls := googleapi.ResolveRelative(c.s.BasePath, "teamdrives")
  12937. urls += "?" + c.urlParams_.Encode()
  12938. req, _ := http.NewRequest("POST", urls, body)
  12939. req.Header = reqHeaders
  12940. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  12941. }
  12942. // Do executes the "drive.teamdrives.insert" call.
  12943. // Exactly one of *TeamDrive or error will be non-nil. Any non-2xx
  12944. // status code is an error. Response headers are in either
  12945. // *TeamDrive.ServerResponse.Header or (if a response was returned at
  12946. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  12947. // to check whether the returned error was because
  12948. // http.StatusNotModified was returned.
  12949. func (c *TeamdrivesInsertCall) Do(opts ...googleapi.CallOption) (*TeamDrive, error) {
  12950. gensupport.SetOptions(c.urlParams_, opts...)
  12951. res, err := c.doRequest("json")
  12952. if res != nil && res.StatusCode == http.StatusNotModified {
  12953. if res.Body != nil {
  12954. res.Body.Close()
  12955. }
  12956. return nil, &googleapi.Error{
  12957. Code: res.StatusCode,
  12958. Header: res.Header,
  12959. }
  12960. }
  12961. if err != nil {
  12962. return nil, err
  12963. }
  12964. defer googleapi.CloseBody(res)
  12965. if err := googleapi.CheckResponse(res); err != nil {
  12966. return nil, err
  12967. }
  12968. ret := &TeamDrive{
  12969. ServerResponse: googleapi.ServerResponse{
  12970. Header: res.Header,
  12971. HTTPStatusCode: res.StatusCode,
  12972. },
  12973. }
  12974. target := &ret
  12975. if err := gensupport.DecodeResponse(target, res); err != nil {
  12976. return nil, err
  12977. }
  12978. return ret, nil
  12979. // {
  12980. // "description": "Creates a new Team Drive.",
  12981. // "httpMethod": "POST",
  12982. // "id": "drive.teamdrives.insert",
  12983. // "parameterOrder": [
  12984. // "requestId"
  12985. // ],
  12986. // "parameters": {
  12987. // "requestId": {
  12988. // "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.",
  12989. // "location": "query",
  12990. // "required": true,
  12991. // "type": "string"
  12992. // }
  12993. // },
  12994. // "path": "teamdrives",
  12995. // "request": {
  12996. // "$ref": "TeamDrive"
  12997. // },
  12998. // "response": {
  12999. // "$ref": "TeamDrive"
  13000. // },
  13001. // "scopes": [
  13002. // "https://www.googleapis.com/auth/drive"
  13003. // ]
  13004. // }
  13005. }
  13006. // method id "drive.teamdrives.list":
  13007. type TeamdrivesListCall struct {
  13008. s *Service
  13009. urlParams_ gensupport.URLParams
  13010. ifNoneMatch_ string
  13011. ctx_ context.Context
  13012. header_ http.Header
  13013. }
  13014. // List: Lists the user's Team Drives.
  13015. func (r *TeamdrivesService) List() *TeamdrivesListCall {
  13016. c := &TeamdrivesListCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  13017. return c
  13018. }
  13019. // MaxResults sets the optional parameter "maxResults": Maximum number
  13020. // of Team Drives to return.
  13021. func (c *TeamdrivesListCall) MaxResults(maxResults int64) *TeamdrivesListCall {
  13022. c.urlParams_.Set("maxResults", fmt.Sprint(maxResults))
  13023. return c
  13024. }
  13025. // PageToken sets the optional parameter "pageToken": Page token for
  13026. // Team Drives.
  13027. func (c *TeamdrivesListCall) PageToken(pageToken string) *TeamdrivesListCall {
  13028. c.urlParams_.Set("pageToken", pageToken)
  13029. return c
  13030. }
  13031. // Q sets the optional parameter "q": Query string for searching Team
  13032. // Drives.
  13033. func (c *TeamdrivesListCall) Q(q string) *TeamdrivesListCall {
  13034. c.urlParams_.Set("q", q)
  13035. return c
  13036. }
  13037. // UseDomainAdminAccess sets the optional parameter
  13038. // "useDomainAdminAccess": Whether the request should be treated as if
  13039. // it was issued by a domain administrator; if set to true, then all
  13040. // Team Drives of the domain in which the requester is an administrator
  13041. // are returned.
  13042. func (c *TeamdrivesListCall) UseDomainAdminAccess(useDomainAdminAccess bool) *TeamdrivesListCall {
  13043. c.urlParams_.Set("useDomainAdminAccess", fmt.Sprint(useDomainAdminAccess))
  13044. return c
  13045. }
  13046. // Fields allows partial responses to be retrieved. See
  13047. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  13048. // for more information.
  13049. func (c *TeamdrivesListCall) Fields(s ...googleapi.Field) *TeamdrivesListCall {
  13050. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  13051. return c
  13052. }
  13053. // IfNoneMatch sets the optional parameter which makes the operation
  13054. // fail if the object's ETag matches the given value. This is useful for
  13055. // getting updates only after the object has changed since the last
  13056. // request. Use googleapi.IsNotModified to check whether the response
  13057. // error from Do is the result of In-None-Match.
  13058. func (c *TeamdrivesListCall) IfNoneMatch(entityTag string) *TeamdrivesListCall {
  13059. c.ifNoneMatch_ = entityTag
  13060. return c
  13061. }
  13062. // Context sets the context to be used in this call's Do method. Any
  13063. // pending HTTP request will be aborted if the provided context is
  13064. // canceled.
  13065. func (c *TeamdrivesListCall) Context(ctx context.Context) *TeamdrivesListCall {
  13066. c.ctx_ = ctx
  13067. return c
  13068. }
  13069. // Header returns an http.Header that can be modified by the caller to
  13070. // add HTTP headers to the request.
  13071. func (c *TeamdrivesListCall) Header() http.Header {
  13072. if c.header_ == nil {
  13073. c.header_ = make(http.Header)
  13074. }
  13075. return c.header_
  13076. }
  13077. func (c *TeamdrivesListCall) doRequest(alt string) (*http.Response, error) {
  13078. reqHeaders := make(http.Header)
  13079. for k, v := range c.header_ {
  13080. reqHeaders[k] = v
  13081. }
  13082. reqHeaders.Set("User-Agent", c.s.userAgent())
  13083. if c.ifNoneMatch_ != "" {
  13084. reqHeaders.Set("If-None-Match", c.ifNoneMatch_)
  13085. }
  13086. var body io.Reader = nil
  13087. c.urlParams_.Set("alt", alt)
  13088. urls := googleapi.ResolveRelative(c.s.BasePath, "teamdrives")
  13089. urls += "?" + c.urlParams_.Encode()
  13090. req, _ := http.NewRequest("GET", urls, body)
  13091. req.Header = reqHeaders
  13092. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  13093. }
  13094. // Do executes the "drive.teamdrives.list" call.
  13095. // Exactly one of *TeamDriveList or error will be non-nil. Any non-2xx
  13096. // status code is an error. Response headers are in either
  13097. // *TeamDriveList.ServerResponse.Header or (if a response was returned
  13098. // at all) in error.(*googleapi.Error).Header. Use
  13099. // googleapi.IsNotModified to check whether the returned error was
  13100. // because http.StatusNotModified was returned.
  13101. func (c *TeamdrivesListCall) Do(opts ...googleapi.CallOption) (*TeamDriveList, error) {
  13102. gensupport.SetOptions(c.urlParams_, opts...)
  13103. res, err := c.doRequest("json")
  13104. if res != nil && res.StatusCode == http.StatusNotModified {
  13105. if res.Body != nil {
  13106. res.Body.Close()
  13107. }
  13108. return nil, &googleapi.Error{
  13109. Code: res.StatusCode,
  13110. Header: res.Header,
  13111. }
  13112. }
  13113. if err != nil {
  13114. return nil, err
  13115. }
  13116. defer googleapi.CloseBody(res)
  13117. if err := googleapi.CheckResponse(res); err != nil {
  13118. return nil, err
  13119. }
  13120. ret := &TeamDriveList{
  13121. ServerResponse: googleapi.ServerResponse{
  13122. Header: res.Header,
  13123. HTTPStatusCode: res.StatusCode,
  13124. },
  13125. }
  13126. target := &ret
  13127. if err := gensupport.DecodeResponse(target, res); err != nil {
  13128. return nil, err
  13129. }
  13130. return ret, nil
  13131. // {
  13132. // "description": "Lists the user's Team Drives.",
  13133. // "httpMethod": "GET",
  13134. // "id": "drive.teamdrives.list",
  13135. // "parameters": {
  13136. // "maxResults": {
  13137. // "default": "10",
  13138. // "description": "Maximum number of Team Drives to return.",
  13139. // "format": "int32",
  13140. // "location": "query",
  13141. // "maximum": "100",
  13142. // "minimum": "1",
  13143. // "type": "integer"
  13144. // },
  13145. // "pageToken": {
  13146. // "description": "Page token for Team Drives.",
  13147. // "location": "query",
  13148. // "type": "string"
  13149. // },
  13150. // "q": {
  13151. // "description": "Query string for searching Team Drives.",
  13152. // "location": "query",
  13153. // "type": "string"
  13154. // },
  13155. // "useDomainAdminAccess": {
  13156. // "default": "false",
  13157. // "description": "Whether the request should be treated as if it was issued by a domain administrator; if set to true, then all Team Drives of the domain in which the requester is an administrator are returned.",
  13158. // "location": "query",
  13159. // "type": "boolean"
  13160. // }
  13161. // },
  13162. // "path": "teamdrives",
  13163. // "response": {
  13164. // "$ref": "TeamDriveList"
  13165. // },
  13166. // "scopes": [
  13167. // "https://www.googleapis.com/auth/drive",
  13168. // "https://www.googleapis.com/auth/drive.readonly"
  13169. // ]
  13170. // }
  13171. }
  13172. // Pages invokes f for each page of results.
  13173. // A non-nil error returned from f will halt the iteration.
  13174. // The provided context supersedes any context provided to the Context method.
  13175. func (c *TeamdrivesListCall) Pages(ctx context.Context, f func(*TeamDriveList) error) error {
  13176. c.ctx_ = ctx
  13177. defer c.PageToken(c.urlParams_.Get("pageToken")) // reset paging to original point
  13178. for {
  13179. x, err := c.Do()
  13180. if err != nil {
  13181. return err
  13182. }
  13183. if err := f(x); err != nil {
  13184. return err
  13185. }
  13186. if x.NextPageToken == "" {
  13187. return nil
  13188. }
  13189. c.PageToken(x.NextPageToken)
  13190. }
  13191. }
  13192. // method id "drive.teamdrives.update":
  13193. type TeamdrivesUpdateCall struct {
  13194. s *Service
  13195. teamDriveId string
  13196. teamdrive *TeamDrive
  13197. urlParams_ gensupport.URLParams
  13198. ctx_ context.Context
  13199. header_ http.Header
  13200. }
  13201. // Update: Updates a Team Drive's metadata
  13202. func (r *TeamdrivesService) Update(teamDriveId string, teamdrive *TeamDrive) *TeamdrivesUpdateCall {
  13203. c := &TeamdrivesUpdateCall{s: r.s, urlParams_: make(gensupport.URLParams)}
  13204. c.teamDriveId = teamDriveId
  13205. c.teamdrive = teamdrive
  13206. return c
  13207. }
  13208. // Fields allows partial responses to be retrieved. See
  13209. // https://developers.google.com/gdata/docs/2.0/basics#PartialResponse
  13210. // for more information.
  13211. func (c *TeamdrivesUpdateCall) Fields(s ...googleapi.Field) *TeamdrivesUpdateCall {
  13212. c.urlParams_.Set("fields", googleapi.CombineFields(s))
  13213. return c
  13214. }
  13215. // Context sets the context to be used in this call's Do method. Any
  13216. // pending HTTP request will be aborted if the provided context is
  13217. // canceled.
  13218. func (c *TeamdrivesUpdateCall) Context(ctx context.Context) *TeamdrivesUpdateCall {
  13219. c.ctx_ = ctx
  13220. return c
  13221. }
  13222. // Header returns an http.Header that can be modified by the caller to
  13223. // add HTTP headers to the request.
  13224. func (c *TeamdrivesUpdateCall) Header() http.Header {
  13225. if c.header_ == nil {
  13226. c.header_ = make(http.Header)
  13227. }
  13228. return c.header_
  13229. }
  13230. func (c *TeamdrivesUpdateCall) doRequest(alt string) (*http.Response, error) {
  13231. reqHeaders := make(http.Header)
  13232. for k, v := range c.header_ {
  13233. reqHeaders[k] = v
  13234. }
  13235. reqHeaders.Set("User-Agent", c.s.userAgent())
  13236. var body io.Reader = nil
  13237. body, err := googleapi.WithoutDataWrapper.JSONReader(c.teamdrive)
  13238. if err != nil {
  13239. return nil, err
  13240. }
  13241. reqHeaders.Set("Content-Type", "application/json")
  13242. c.urlParams_.Set("alt", alt)
  13243. urls := googleapi.ResolveRelative(c.s.BasePath, "teamdrives/{teamDriveId}")
  13244. urls += "?" + c.urlParams_.Encode()
  13245. req, _ := http.NewRequest("PUT", urls, body)
  13246. req.Header = reqHeaders
  13247. googleapi.Expand(req.URL, map[string]string{
  13248. "teamDriveId": c.teamDriveId,
  13249. })
  13250. return gensupport.SendRequest(c.ctx_, c.s.client, req)
  13251. }
  13252. // Do executes the "drive.teamdrives.update" call.
  13253. // Exactly one of *TeamDrive or error will be non-nil. Any non-2xx
  13254. // status code is an error. Response headers are in either
  13255. // *TeamDrive.ServerResponse.Header or (if a response was returned at
  13256. // all) in error.(*googleapi.Error).Header. Use googleapi.IsNotModified
  13257. // to check whether the returned error was because
  13258. // http.StatusNotModified was returned.
  13259. func (c *TeamdrivesUpdateCall) Do(opts ...googleapi.CallOption) (*TeamDrive, error) {
  13260. gensupport.SetOptions(c.urlParams_, opts...)
  13261. res, err := c.doRequest("json")
  13262. if res != nil && res.StatusCode == http.StatusNotModified {
  13263. if res.Body != nil {
  13264. res.Body.Close()
  13265. }
  13266. return nil, &googleapi.Error{
  13267. Code: res.StatusCode,
  13268. Header: res.Header,
  13269. }
  13270. }
  13271. if err != nil {
  13272. return nil, err
  13273. }
  13274. defer googleapi.CloseBody(res)
  13275. if err := googleapi.CheckResponse(res); err != nil {
  13276. return nil, err
  13277. }
  13278. ret := &TeamDrive{
  13279. ServerResponse: googleapi.ServerResponse{
  13280. Header: res.Header,
  13281. HTTPStatusCode: res.StatusCode,
  13282. },
  13283. }
  13284. target := &ret
  13285. if err := gensupport.DecodeResponse(target, res); err != nil {
  13286. return nil, err
  13287. }
  13288. return ret, nil
  13289. // {
  13290. // "description": "Updates a Team Drive's metadata",
  13291. // "httpMethod": "PUT",
  13292. // "id": "drive.teamdrives.update",
  13293. // "parameterOrder": [
  13294. // "teamDriveId"
  13295. // ],
  13296. // "parameters": {
  13297. // "teamDriveId": {
  13298. // "description": "The ID of the Team Drive",
  13299. // "location": "path",
  13300. // "required": true,
  13301. // "type": "string"
  13302. // }
  13303. // },
  13304. // "path": "teamdrives/{teamDriveId}",
  13305. // "request": {
  13306. // "$ref": "TeamDrive"
  13307. // },
  13308. // "response": {
  13309. // "$ref": "TeamDrive"
  13310. // },
  13311. // "scopes": [
  13312. // "https://www.googleapis.com/auth/drive"
  13313. // ]
  13314. // }
  13315. }