blob: fba0cd7e7e2ae170fbdd5e04faf1e0ed6c1315c7 [file] [log] [blame]
Jon Wayne Parrott36e41bc2016-02-19 16:02:29 -08001<html><body>
2<style>
3
4body, h1, h2, h3, div, span, p, pre, a {
5 margin: 0;
6 padding: 0;
7 border: 0;
8 font-weight: inherit;
9 font-style: inherit;
10 font-size: 100%;
11 font-family: inherit;
12 vertical-align: baseline;
13}
14
15body {
16 font-size: 13px;
17 padding: 1em;
18}
19
20h1 {
21 font-size: 26px;
22 margin-bottom: 1em;
23}
24
25h2 {
26 font-size: 24px;
27 margin-bottom: 1em;
28}
29
30h3 {
31 font-size: 20px;
32 margin-bottom: 1em;
33 margin-top: 1em;
34}
35
36pre, code {
37 line-height: 1.5;
38 font-family: Monaco, 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Lucida Console', monospace;
39}
40
41pre {
42 margin-top: 0.5em;
43}
44
45h1, h2, h3, p {
46 font-family: Arial, sans serif;
47}
48
49h1, h2, h3 {
50 border-bottom: solid #CCC 1px;
51}
52
53.toc_element {
54 margin-top: 0.5em;
55}
56
57.firstline {
58 margin-left: 2 em;
59}
60
61.method {
62 margin-top: 1em;
63 border: solid 1px #CCC;
64 padding: 1em;
65 background: #EEE;
66}
67
68.details {
69 font-weight: bold;
70 font-size: 14px;
71}
72
73</style>
74
75<h1><a href="drive_v3.html">Drive API</a> . <a href="drive_v3.files.html">files</a></h1>
76<h2>Instance Methods</h2>
77<p class="toc_element">
78 <code><a href="#copy">copy(fileId, body, keepRevisionForever=None, ignoreDefaultVisibility=None, ocrLanguage=None)</a></code></p>
79<p class="firstline">Creates a copy of a file and applies any requested updates with patch semantics.</p>
80<p class="toc_element">
81 <code><a href="#create">create(body=None, media_body=None, keepRevisionForever=None, useContentAsIndexableText=None, ignoreDefaultVisibility=None, ocrLanguage=None)</a></code></p>
82<p class="firstline">Creates a new file.</p>
83<p class="toc_element">
84 <code><a href="#delete">delete(fileId)</a></code></p>
85<p class="firstline">Permanently deletes a file owned by the user without moving it to the trash. If the target is a folder, all descendants owned by the user are also deleted.</p>
86<p class="toc_element">
87 <code><a href="#emptyTrash">emptyTrash()</a></code></p>
88<p class="firstline">Permanently deletes all of the user's trashed files.</p>
89<p class="toc_element">
90 <code><a href="#export">export(fileId, mimeType)</a></code></p>
91<p class="firstline">Exports a Google Doc to the requested MIME type and returns the exported content.</p>
92<p class="toc_element">
93 <code><a href="#export_media">export_media(fileId, mimeType)</a></code></p>
94<p class="firstline">Exports a Google Doc to the requested MIME type and returns the exported content.</p>
95<p class="toc_element">
96 <code><a href="#generateIds">generateIds(count=None, space=None)</a></code></p>
97<p class="firstline">Generates a set of file IDs which can be provided in create requests.</p>
98<p class="toc_element">
99 <code><a href="#get">get(fileId, acknowledgeAbuse=None)</a></code></p>
100<p class="firstline">Gets a file's metadata or content by ID.</p>
101<p class="toc_element">
102 <code><a href="#get_media">get_media(fileId, acknowledgeAbuse=None)</a></code></p>
103<p class="firstline">Gets a file's metadata or content by ID.</p>
104<p class="toc_element">
105 <code><a href="#list">list(orderBy=None, q=None, pageSize=None, pageToken=None, spaces=None, corpus=None)</a></code></p>
106<p class="firstline">Lists or searches files.</p>
107<p class="toc_element">
108 <code><a href="#list_next">list_next(previous_request, previous_response)</a></code></p>
109<p class="firstline">Retrieves the next page of results.</p>
110<p class="toc_element">
111 <code><a href="#update">update(fileId, body=None, media_body=None, addParents=None, removeParents=None, useContentAsIndexableText=None, keepRevisionForever=None, ocrLanguage=None)</a></code></p>
112<p class="firstline">Updates a file's metadata and/or content with patch semantics.</p>
113<p class="toc_element">
114 <code><a href="#watch">watch(fileId, body, acknowledgeAbuse=None)</a></code></p>
115<p class="firstline">Subscribes to changes to a file</p>
116<p class="toc_element">
117 <code><a href="#watch_media">watch_media(fileId, body, acknowledgeAbuse=None)</a></code></p>
118<p class="firstline">Subscribes to changes to a file</p>
119<h3>Method Details</h3>
120<div class="method">
121 <code class="details" id="copy">copy(fileId, body, keepRevisionForever=None, ignoreDefaultVisibility=None, ocrLanguage=None)</code>
122 <pre>Creates a copy of a file and applies any requested updates with patch semantics.
123
124Args:
125 fileId: string, The ID of the file. (required)
126 body: object, The request body. (required)
127 The object takes the form of:
128
129{ # The metadata for a file.
130 "mimeType": "A String", # The MIME type of the file.
131 # Drive will attempt to automatically detect an appropriate value from uploaded content if no value is provided. The value cannot be changed unless a new revision is uploaded.
132 # If a file is created with a Google Doc MIME type, the uploaded content will be imported if possible. The supported import formats are published in the About resource.
133 "modifiedByMeTime": "A String", # The last time the file was modified by the user (RFC 3339 date-time).
134 "thumbnailLink": "A String", # A short-lived link to the file's thumbnail, if available. Typically lasts on the order of hours.
135 "explicitlyTrashed": True or False, # Whether the file has been explicitly trashed, as opposed to recursively trashed from a parent folder.
136 "writersCanShare": True or False, # Whether users with only writer permission can modify the file's permissions.
137 "ownedByMe": True or False, # Whether the user owns the file.
138 "viewedByMeTime": "A String", # The last time the file was viewed by the user (RFC 3339 date-time).
139 "id": "A String", # The ID of the file.
140 "sharingUser": { # Information about a Drive user. # The user who shared the file with the requesting user, if applicable.
141 "me": True or False, # Whether this user is the requesting user.
142 "kind": "drive#user", # This is always drive#user.
143 "displayName": "A String", # A plain text displayable name for this user.
144 "permissionId": "A String", # The user's ID as visible in Permission resources.
145 "emailAddress": "A String", # The email address of the user. This may not be present in certain contexts if the user has not made their email address visible to the requester.
146 "photoLink": "A String", # A link to the user's profile photo, if available.
147 },
148 "size": "A String", # The size of the file's content in bytes. This is only applicable to files with binary content in Drive.
149 "videoMediaMetadata": { # Additional metadata about video media. This may not be available immediately upon upload.
150 "width": 42, # The width of the video in pixels.
151 "durationMillis": "A String", # The duration of the video in milliseconds.
152 "height": 42, # The height of the video in pixels.
153 },
154 "lastModifyingUser": { # Information about a Drive user. # The last user to modify the file.
155 "me": True or False, # Whether this user is the requesting user.
156 "kind": "drive#user", # This is always drive#user.
157 "displayName": "A String", # A plain text displayable name for this user.
158 "permissionId": "A String", # The user's ID as visible in Permission resources.
159 "emailAddress": "A String", # The email address of the user. This may not be present in certain contexts if the user has not made their email address visible to the requester.
160 "photoLink": "A String", # A link to the user's profile photo, if available.
161 },
162 "folderColorRgb": "A String", # The color for a folder as an RGB hex string. The supported colors are published in the folderColorPalette field of the About resource.
163 # If an unsupported color is specified, the closest color in the palette will be used instead.
164 "appProperties": { # A collection of arbitrary key-value pairs which are private to the requesting app.
165 # Entries with null values are cleared in update and copy requests.
166 "a_key": "A String",
167 },
168 "capabilities": { # Capabilities the current user has on the file.
169 "canReadRevisions": True or False, # Whether the current user has read access to the Revisions resource of the file.
170 "canCopy": True or False, # Whether the user can copy the file.
171 "canShare": True or False, # Whether the user can modify the file's permissions and sharing settings.
172 "canEdit": True or False, # Whether the user can edit the file's content.
173 "canComment": True or False, # Whether the user can comment on the file.
174 },
175 "webViewLink": "A String", # A link for opening the file in a relevant Google editor or viewer in a browser.
176 "version": "A String", # A monotonically increasing version number for the file. This reflects every change made to the file on the server, even those not visible to the user.
177 "parents": [ # The IDs of the parent folders which contain the file.
178 # If not specified as part of a create request, the file will be placed directly in the My Drive folder. Update requests must use the addParents and removeParents parameters to modify the values.
179 "A String",
180 ],
181 "sharedWithMeTime": "A String", # The time at which the file was shared with the user, if applicable (RFC 3339 date-time).
182 "shared": True or False, # Whether the file has been shared.
183 "permissions": [ # The full list of permissions for the file. This is only available if the requesting user can share the file.
184 { # A permission for a file. A permission grants a user, group, domain or the world access to a file or a folder hierarchy.
185 "domain": "A String", # The domain to which this permission refers.
186 "displayName": "A String", # A displayable name for users, groups or domains.
187 "allowFileDiscovery": True or False, # Whether the permission allows the file to be discovered through search. This is only applicable for permissions of type domain or anyone.
188 "kind": "drive#permission", # This is always drive#permission.
189 "emailAddress": "A String", # The email address of the user or group to which this permission refers.
190 "photoLink": "A String", # A link to the user's profile photo, if available.
191 "role": "A String", # The role granted by this permission. Valid values are:
192 # - owner
193 # - writer
194 # - commenter
195 # - reader
196 "type": "A String", # The type of the grantee. Valid values are:
197 # - user
198 # - group
199 # - domain
200 # - anyone
201 "id": "A String", # The ID of this permission. This is a unique identifier for the grantee, and is published in User resources as permissionId.
202 },
203 ],
204 "fullFileExtension": "A String", # The full file extension extracted from the name field. May contain multiple concatenated extensions, such as "tar.gz". This is only available for files with binary content in Drive.
205 # This is automatically updated when the name field changes, however it is not cleared if the new name does not contain a valid extension.
206 "originalFilename": "A String", # The original filename of the uploaded content if available, or else the original value of the name field. This is only available for files with binary content in Drive.
207 "viewersCanCopyContent": True or False, # Whether users with only reader or commenter permission can copy the file's content. This affects copy, download, and print operations.
208 "description": "A String", # A short description of the file.
209 "modifiedTime": "A String", # The last time the file was modified by anyone (RFC 3339 date-time).
210 # Note that setting modifiedTime will also update modifiedByMeTime for the user.
211 "viewedByMe": True or False, # Whether the file has been viewed by this user.
212 "owners": [ # The owners of the file. Currently, only certain legacy files may have more than one owner.
213 { # Information about a Drive user.
214 "me": True or False, # Whether this user is the requesting user.
215 "kind": "drive#user", # This is always drive#user.
216 "displayName": "A String", # A plain text displayable name for this user.
217 "permissionId": "A String", # The user's ID as visible in Permission resources.
218 "emailAddress": "A String", # The email address of the user. This may not be present in certain contexts if the user has not made their email address visible to the requester.
219 "photoLink": "A String", # A link to the user's profile photo, if available.
220 },
221 ],
222 "createdTime": "A String", # The time at which the file was created (RFC 3339 date-time).
223 "quotaBytesUsed": "A String", # The number of storage quota bytes used by the file. This includes the head revision as well as previous revisions with keepForever enabled.
224 "properties": { # A collection of arbitrary key-value pairs which are visible to all apps.
225 # Entries with null values are cleared in update and copy requests.
226 "a_key": "A String",
227 },
228 "md5Checksum": "A String", # The MD5 checksum for the content of the file. This is only applicable to files with binary content in Drive.
229 "iconLink": "A String", # A static, unauthenticated link to the file's icon.
230 "imageMediaMetadata": { # Additional metadata about image media, if available.
231 "exposureBias": 3.14, # The exposure bias of the photo (APEX value).
232 "exposureTime": 3.14, # The length of the exposure, in seconds.
233 "cameraMake": "A String", # The make of the camera used to create the photo.
234 "maxApertureValue": 3.14, # The smallest f-number of the lens at the focal length used to create the photo (APEX value).
235 "width": 42, # The width of the image in pixels.
236 "focalLength": 3.14, # The focal length used to create the photo, in millimeters.
237 "exposureMode": "A String", # The exposure mode used to create the photo.
238 "colorSpace": "A String", # The color space of the photo.
239 "location": { # Geographic location information stored in the image.
240 "latitude": 3.14, # The latitude stored in the image.
241 "altitude": 3.14, # The altitude stored in the image.
242 "longitude": 3.14, # The longitude stored in the image.
243 },
244 "subjectDistance": 42, # The distance to the subject of the photo, in meters.
245 "height": 42, # The height of the image in pixels.
246 "lens": "A String", # The lens used to create the photo.
247 "isoSpeed": 42, # The ISO speed used to create the photo.
248 "meteringMode": "A String", # The metering mode used to create the photo.
249 "flashUsed": True or False, # Whether a flash was used to create the photo.
250 "time": "A String", # The date and time the photo was taken (EXIF DateTime).
251 "aperture": 3.14, # The aperture used to create the photo (f-number).
252 "rotation": 42, # The rotation in clockwise degrees from the image's original orientation.
253 "sensor": "A String", # The type of sensor used to create the photo.
254 "whiteBalance": "A String", # The white balance mode used to create the photo.
255 "cameraModel": "A String", # The model of the camera used to create the photo.
256 },
257 "kind": "drive#file", # This is always drive#file.
258 "name": "A String", # The name of the file. This is not necessarily unique within a folder.
259 "webContentLink": "A String", # A link for downloading the content of the file in a browser. This is only available for files with binary content in Drive.
260 "spaces": [ # The list of spaces which contain the file. The currently supported values are 'drive', 'appDataFolder' and 'photos'.
261 "A String",
262 ],
263 "trashed": True or False, # Whether the file has been trashed, either explicitly or from a trashed parent folder. Only the owner may trash a file, and other users cannot see files in the owner's trash.
264 "contentHints": { # Additional information about the content of the file. These fields are never populated in responses.
265 "indexableText": "A String", # Text to be indexed for the file to improve fullText queries. This is limited to 128KB in length and may contain HTML elements.
266 "thumbnail": { # A thumbnail for the file. This will only be used if Drive cannot generate a standard thumbnail.
267 "mimeType": "A String", # The MIME type of the thumbnail.
268 "image": "A String", # The thumbnail data encoded with URL-safe Base64 (RFC 4648 section 5).
269 },
270 },
271 "fileExtension": "A String", # The final component of fullFileExtension. This is only available for files with binary content in Drive.
272 "starred": True or False, # Whether the user has starred the file.
273 "headRevisionId": "A String", # The ID of the file's head revision. This is currently only available for files with binary content in Drive.
274}
275
276 keepRevisionForever: boolean, Whether to set the 'keepForever' field in the new head revision. This is only applicable to files with binary content in Drive.
277 ignoreDefaultVisibility: boolean, Whether to ignore the domain's default visibility settings for the created file. Domain administrators can choose to make all uploaded files visible to the domain by default; this parameter bypasses that behavior for the request. Permissions are still inherited from parent folders.
278 ocrLanguage: string, A language hint for OCR processing during image import (ISO 639-1 code).
279
280Returns:
281 An object of the form:
282
283 { # The metadata for a file.
284 "mimeType": "A String", # The MIME type of the file.
285 # Drive will attempt to automatically detect an appropriate value from uploaded content if no value is provided. The value cannot be changed unless a new revision is uploaded.
286 # If a file is created with a Google Doc MIME type, the uploaded content will be imported if possible. The supported import formats are published in the About resource.
287 "modifiedByMeTime": "A String", # The last time the file was modified by the user (RFC 3339 date-time).
288 "thumbnailLink": "A String", # A short-lived link to the file's thumbnail, if available. Typically lasts on the order of hours.
289 "explicitlyTrashed": True or False, # Whether the file has been explicitly trashed, as opposed to recursively trashed from a parent folder.
290 "writersCanShare": True or False, # Whether users with only writer permission can modify the file's permissions.
291 "ownedByMe": True or False, # Whether the user owns the file.
292 "viewedByMeTime": "A String", # The last time the file was viewed by the user (RFC 3339 date-time).
293 "id": "A String", # The ID of the file.
294 "sharingUser": { # Information about a Drive user. # The user who shared the file with the requesting user, if applicable.
295 "me": True or False, # Whether this user is the requesting user.
296 "kind": "drive#user", # This is always drive#user.
297 "displayName": "A String", # A plain text displayable name for this user.
298 "permissionId": "A String", # The user's ID as visible in Permission resources.
299 "emailAddress": "A String", # The email address of the user. This may not be present in certain contexts if the user has not made their email address visible to the requester.
300 "photoLink": "A String", # A link to the user's profile photo, if available.
301 },
302 "size": "A String", # The size of the file's content in bytes. This is only applicable to files with binary content in Drive.
303 "videoMediaMetadata": { # Additional metadata about video media. This may not be available immediately upon upload.
304 "width": 42, # The width of the video in pixels.
305 "durationMillis": "A String", # The duration of the video in milliseconds.
306 "height": 42, # The height of the video in pixels.
307 },
308 "lastModifyingUser": { # Information about a Drive user. # The last user to modify the file.
309 "me": True or False, # Whether this user is the requesting user.
310 "kind": "drive#user", # This is always drive#user.
311 "displayName": "A String", # A plain text displayable name for this user.
312 "permissionId": "A String", # The user's ID as visible in Permission resources.
313 "emailAddress": "A String", # The email address of the user. This may not be present in certain contexts if the user has not made their email address visible to the requester.
314 "photoLink": "A String", # A link to the user's profile photo, if available.
315 },
316 "folderColorRgb": "A String", # The color for a folder as an RGB hex string. The supported colors are published in the folderColorPalette field of the About resource.
317 # If an unsupported color is specified, the closest color in the palette will be used instead.
318 "appProperties": { # A collection of arbitrary key-value pairs which are private to the requesting app.
319 # Entries with null values are cleared in update and copy requests.
320 "a_key": "A String",
321 },
322 "capabilities": { # Capabilities the current user has on the file.
323 "canReadRevisions": True or False, # Whether the current user has read access to the Revisions resource of the file.
324 "canCopy": True or False, # Whether the user can copy the file.
325 "canShare": True or False, # Whether the user can modify the file's permissions and sharing settings.
326 "canEdit": True or False, # Whether the user can edit the file's content.
327 "canComment": True or False, # Whether the user can comment on the file.
328 },
329 "webViewLink": "A String", # A link for opening the file in a relevant Google editor or viewer in a browser.
330 "version": "A String", # A monotonically increasing version number for the file. This reflects every change made to the file on the server, even those not visible to the user.
331 "parents": [ # The IDs of the parent folders which contain the file.
332 # If not specified as part of a create request, the file will be placed directly in the My Drive folder. Update requests must use the addParents and removeParents parameters to modify the values.
333 "A String",
334 ],
335 "sharedWithMeTime": "A String", # The time at which the file was shared with the user, if applicable (RFC 3339 date-time).
336 "shared": True or False, # Whether the file has been shared.
337 "permissions": [ # The full list of permissions for the file. This is only available if the requesting user can share the file.
338 { # A permission for a file. A permission grants a user, group, domain or the world access to a file or a folder hierarchy.
339 "domain": "A String", # The domain to which this permission refers.
340 "displayName": "A String", # A displayable name for users, groups or domains.
341 "allowFileDiscovery": True or False, # Whether the permission allows the file to be discovered through search. This is only applicable for permissions of type domain or anyone.
342 "kind": "drive#permission", # This is always drive#permission.
343 "emailAddress": "A String", # The email address of the user or group to which this permission refers.
344 "photoLink": "A String", # A link to the user's profile photo, if available.
345 "role": "A String", # The role granted by this permission. Valid values are:
346 # - owner
347 # - writer
348 # - commenter
349 # - reader
350 "type": "A String", # The type of the grantee. Valid values are:
351 # - user
352 # - group
353 # - domain
354 # - anyone
355 "id": "A String", # The ID of this permission. This is a unique identifier for the grantee, and is published in User resources as permissionId.
356 },
357 ],
358 "fullFileExtension": "A String", # The full file extension extracted from the name field. May contain multiple concatenated extensions, such as "tar.gz". This is only available for files with binary content in Drive.
359 # This is automatically updated when the name field changes, however it is not cleared if the new name does not contain a valid extension.
360 "originalFilename": "A String", # The original filename of the uploaded content if available, or else the original value of the name field. This is only available for files with binary content in Drive.
361 "viewersCanCopyContent": True or False, # Whether users with only reader or commenter permission can copy the file's content. This affects copy, download, and print operations.
362 "description": "A String", # A short description of the file.
363 "modifiedTime": "A String", # The last time the file was modified by anyone (RFC 3339 date-time).
364 # Note that setting modifiedTime will also update modifiedByMeTime for the user.
365 "viewedByMe": True or False, # Whether the file has been viewed by this user.
366 "owners": [ # The owners of the file. Currently, only certain legacy files may have more than one owner.
367 { # Information about a Drive user.
368 "me": True or False, # Whether this user is the requesting user.
369 "kind": "drive#user", # This is always drive#user.
370 "displayName": "A String", # A plain text displayable name for this user.
371 "permissionId": "A String", # The user's ID as visible in Permission resources.
372 "emailAddress": "A String", # The email address of the user. This may not be present in certain contexts if the user has not made their email address visible to the requester.
373 "photoLink": "A String", # A link to the user's profile photo, if available.
374 },
375 ],
376 "createdTime": "A String", # The time at which the file was created (RFC 3339 date-time).
377 "quotaBytesUsed": "A String", # The number of storage quota bytes used by the file. This includes the head revision as well as previous revisions with keepForever enabled.
378 "properties": { # A collection of arbitrary key-value pairs which are visible to all apps.
379 # Entries with null values are cleared in update and copy requests.
380 "a_key": "A String",
381 },
382 "md5Checksum": "A String", # The MD5 checksum for the content of the file. This is only applicable to files with binary content in Drive.
383 "iconLink": "A String", # A static, unauthenticated link to the file's icon.
384 "imageMediaMetadata": { # Additional metadata about image media, if available.
385 "exposureBias": 3.14, # The exposure bias of the photo (APEX value).
386 "exposureTime": 3.14, # The length of the exposure, in seconds.
387 "cameraMake": "A String", # The make of the camera used to create the photo.
388 "maxApertureValue": 3.14, # The smallest f-number of the lens at the focal length used to create the photo (APEX value).
389 "width": 42, # The width of the image in pixels.
390 "focalLength": 3.14, # The focal length used to create the photo, in millimeters.
391 "exposureMode": "A String", # The exposure mode used to create the photo.
392 "colorSpace": "A String", # The color space of the photo.
393 "location": { # Geographic location information stored in the image.
394 "latitude": 3.14, # The latitude stored in the image.
395 "altitude": 3.14, # The altitude stored in the image.
396 "longitude": 3.14, # The longitude stored in the image.
397 },
398 "subjectDistance": 42, # The distance to the subject of the photo, in meters.
399 "height": 42, # The height of the image in pixels.
400 "lens": "A String", # The lens used to create the photo.
401 "isoSpeed": 42, # The ISO speed used to create the photo.
402 "meteringMode": "A String", # The metering mode used to create the photo.
403 "flashUsed": True or False, # Whether a flash was used to create the photo.
404 "time": "A String", # The date and time the photo was taken (EXIF DateTime).
405 "aperture": 3.14, # The aperture used to create the photo (f-number).
406 "rotation": 42, # The rotation in clockwise degrees from the image's original orientation.
407 "sensor": "A String", # The type of sensor used to create the photo.
408 "whiteBalance": "A String", # The white balance mode used to create the photo.
409 "cameraModel": "A String", # The model of the camera used to create the photo.
410 },
411 "kind": "drive#file", # This is always drive#file.
412 "name": "A String", # The name of the file. This is not necessarily unique within a folder.
413 "webContentLink": "A String", # A link for downloading the content of the file in a browser. This is only available for files with binary content in Drive.
414 "spaces": [ # The list of spaces which contain the file. The currently supported values are 'drive', 'appDataFolder' and 'photos'.
415 "A String",
416 ],
417 "trashed": True or False, # Whether the file has been trashed, either explicitly or from a trashed parent folder. Only the owner may trash a file, and other users cannot see files in the owner's trash.
418 "contentHints": { # Additional information about the content of the file. These fields are never populated in responses.
419 "indexableText": "A String", # Text to be indexed for the file to improve fullText queries. This is limited to 128KB in length and may contain HTML elements.
420 "thumbnail": { # A thumbnail for the file. This will only be used if Drive cannot generate a standard thumbnail.
421 "mimeType": "A String", # The MIME type of the thumbnail.
422 "image": "A String", # The thumbnail data encoded with URL-safe Base64 (RFC 4648 section 5).
423 },
424 },
425 "fileExtension": "A String", # The final component of fullFileExtension. This is only available for files with binary content in Drive.
426 "starred": True or False, # Whether the user has starred the file.
427 "headRevisionId": "A String", # The ID of the file's head revision. This is currently only available for files with binary content in Drive.
428 }</pre>
429</div>
430
431<div class="method">
432 <code class="details" id="create">create(body=None, media_body=None, keepRevisionForever=None, useContentAsIndexableText=None, ignoreDefaultVisibility=None, ocrLanguage=None)</code>
433 <pre>Creates a new file.
434
435Args:
436 body: object, The request body.
437 The object takes the form of:
438
439{ # The metadata for a file.
440 "mimeType": "A String", # The MIME type of the file.
441 # Drive will attempt to automatically detect an appropriate value from uploaded content if no value is provided. The value cannot be changed unless a new revision is uploaded.
442 # If a file is created with a Google Doc MIME type, the uploaded content will be imported if possible. The supported import formats are published in the About resource.
443 "modifiedByMeTime": "A String", # The last time the file was modified by the user (RFC 3339 date-time).
444 "thumbnailLink": "A String", # A short-lived link to the file's thumbnail, if available. Typically lasts on the order of hours.
445 "explicitlyTrashed": True or False, # Whether the file has been explicitly trashed, as opposed to recursively trashed from a parent folder.
446 "writersCanShare": True or False, # Whether users with only writer permission can modify the file's permissions.
447 "ownedByMe": True or False, # Whether the user owns the file.
448 "viewedByMeTime": "A String", # The last time the file was viewed by the user (RFC 3339 date-time).
449 "id": "A String", # The ID of the file.
450 "sharingUser": { # Information about a Drive user. # The user who shared the file with the requesting user, if applicable.
451 "me": True or False, # Whether this user is the requesting user.
452 "kind": "drive#user", # This is always drive#user.
453 "displayName": "A String", # A plain text displayable name for this user.
454 "permissionId": "A String", # The user's ID as visible in Permission resources.
455 "emailAddress": "A String", # The email address of the user. This may not be present in certain contexts if the user has not made their email address visible to the requester.
456 "photoLink": "A String", # A link to the user's profile photo, if available.
457 },
458 "size": "A String", # The size of the file's content in bytes. This is only applicable to files with binary content in Drive.
459 "videoMediaMetadata": { # Additional metadata about video media. This may not be available immediately upon upload.
460 "width": 42, # The width of the video in pixels.
461 "durationMillis": "A String", # The duration of the video in milliseconds.
462 "height": 42, # The height of the video in pixels.
463 },
464 "lastModifyingUser": { # Information about a Drive user. # The last user to modify the file.
465 "me": True or False, # Whether this user is the requesting user.
466 "kind": "drive#user", # This is always drive#user.
467 "displayName": "A String", # A plain text displayable name for this user.
468 "permissionId": "A String", # The user's ID as visible in Permission resources.
469 "emailAddress": "A String", # The email address of the user. This may not be present in certain contexts if the user has not made their email address visible to the requester.
470 "photoLink": "A String", # A link to the user's profile photo, if available.
471 },
472 "folderColorRgb": "A String", # The color for a folder as an RGB hex string. The supported colors are published in the folderColorPalette field of the About resource.
473 # If an unsupported color is specified, the closest color in the palette will be used instead.
474 "appProperties": { # A collection of arbitrary key-value pairs which are private to the requesting app.
475 # Entries with null values are cleared in update and copy requests.
476 "a_key": "A String",
477 },
478 "capabilities": { # Capabilities the current user has on the file.
479 "canReadRevisions": True or False, # Whether the current user has read access to the Revisions resource of the file.
480 "canCopy": True or False, # Whether the user can copy the file.
481 "canShare": True or False, # Whether the user can modify the file's permissions and sharing settings.
482 "canEdit": True or False, # Whether the user can edit the file's content.
483 "canComment": True or False, # Whether the user can comment on the file.
484 },
485 "webViewLink": "A String", # A link for opening the file in a relevant Google editor or viewer in a browser.
486 "version": "A String", # A monotonically increasing version number for the file. This reflects every change made to the file on the server, even those not visible to the user.
487 "parents": [ # The IDs of the parent folders which contain the file.
488 # If not specified as part of a create request, the file will be placed directly in the My Drive folder. Update requests must use the addParents and removeParents parameters to modify the values.
489 "A String",
490 ],
491 "sharedWithMeTime": "A String", # The time at which the file was shared with the user, if applicable (RFC 3339 date-time).
492 "shared": True or False, # Whether the file has been shared.
493 "permissions": [ # The full list of permissions for the file. This is only available if the requesting user can share the file.
494 { # A permission for a file. A permission grants a user, group, domain or the world access to a file or a folder hierarchy.
495 "domain": "A String", # The domain to which this permission refers.
496 "displayName": "A String", # A displayable name for users, groups or domains.
497 "allowFileDiscovery": True or False, # Whether the permission allows the file to be discovered through search. This is only applicable for permissions of type domain or anyone.
498 "kind": "drive#permission", # This is always drive#permission.
499 "emailAddress": "A String", # The email address of the user or group to which this permission refers.
500 "photoLink": "A String", # A link to the user's profile photo, if available.
501 "role": "A String", # The role granted by this permission. Valid values are:
502 # - owner
503 # - writer
504 # - commenter
505 # - reader
506 "type": "A String", # The type of the grantee. Valid values are:
507 # - user
508 # - group
509 # - domain
510 # - anyone
511 "id": "A String", # The ID of this permission. This is a unique identifier for the grantee, and is published in User resources as permissionId.
512 },
513 ],
514 "fullFileExtension": "A String", # The full file extension extracted from the name field. May contain multiple concatenated extensions, such as "tar.gz". This is only available for files with binary content in Drive.
515 # This is automatically updated when the name field changes, however it is not cleared if the new name does not contain a valid extension.
516 "originalFilename": "A String", # The original filename of the uploaded content if available, or else the original value of the name field. This is only available for files with binary content in Drive.
517 "viewersCanCopyContent": True or False, # Whether users with only reader or commenter permission can copy the file's content. This affects copy, download, and print operations.
518 "description": "A String", # A short description of the file.
519 "modifiedTime": "A String", # The last time the file was modified by anyone (RFC 3339 date-time).
520 # Note that setting modifiedTime will also update modifiedByMeTime for the user.
521 "viewedByMe": True or False, # Whether the file has been viewed by this user.
522 "owners": [ # The owners of the file. Currently, only certain legacy files may have more than one owner.
523 { # Information about a Drive user.
524 "me": True or False, # Whether this user is the requesting user.
525 "kind": "drive#user", # This is always drive#user.
526 "displayName": "A String", # A plain text displayable name for this user.
527 "permissionId": "A String", # The user's ID as visible in Permission resources.
528 "emailAddress": "A String", # The email address of the user. This may not be present in certain contexts if the user has not made their email address visible to the requester.
529 "photoLink": "A String", # A link to the user's profile photo, if available.
530 },
531 ],
532 "createdTime": "A String", # The time at which the file was created (RFC 3339 date-time).
533 "quotaBytesUsed": "A String", # The number of storage quota bytes used by the file. This includes the head revision as well as previous revisions with keepForever enabled.
534 "properties": { # A collection of arbitrary key-value pairs which are visible to all apps.
535 # Entries with null values are cleared in update and copy requests.
536 "a_key": "A String",
537 },
538 "md5Checksum": "A String", # The MD5 checksum for the content of the file. This is only applicable to files with binary content in Drive.
539 "iconLink": "A String", # A static, unauthenticated link to the file's icon.
540 "imageMediaMetadata": { # Additional metadata about image media, if available.
541 "exposureBias": 3.14, # The exposure bias of the photo (APEX value).
542 "exposureTime": 3.14, # The length of the exposure, in seconds.
543 "cameraMake": "A String", # The make of the camera used to create the photo.
544 "maxApertureValue": 3.14, # The smallest f-number of the lens at the focal length used to create the photo (APEX value).
545 "width": 42, # The width of the image in pixels.
546 "focalLength": 3.14, # The focal length used to create the photo, in millimeters.
547 "exposureMode": "A String", # The exposure mode used to create the photo.
548 "colorSpace": "A String", # The color space of the photo.
549 "location": { # Geographic location information stored in the image.
550 "latitude": 3.14, # The latitude stored in the image.
551 "altitude": 3.14, # The altitude stored in the image.
552 "longitude": 3.14, # The longitude stored in the image.
553 },
554 "subjectDistance": 42, # The distance to the subject of the photo, in meters.
555 "height": 42, # The height of the image in pixels.
556 "lens": "A String", # The lens used to create the photo.
557 "isoSpeed": 42, # The ISO speed used to create the photo.
558 "meteringMode": "A String", # The metering mode used to create the photo.
559 "flashUsed": True or False, # Whether a flash was used to create the photo.
560 "time": "A String", # The date and time the photo was taken (EXIF DateTime).
561 "aperture": 3.14, # The aperture used to create the photo (f-number).
562 "rotation": 42, # The rotation in clockwise degrees from the image's original orientation.
563 "sensor": "A String", # The type of sensor used to create the photo.
564 "whiteBalance": "A String", # The white balance mode used to create the photo.
565 "cameraModel": "A String", # The model of the camera used to create the photo.
566 },
567 "kind": "drive#file", # This is always drive#file.
568 "name": "A String", # The name of the file. This is not necessarily unique within a folder.
569 "webContentLink": "A String", # A link for downloading the content of the file in a browser. This is only available for files with binary content in Drive.
570 "spaces": [ # The list of spaces which contain the file. The currently supported values are 'drive', 'appDataFolder' and 'photos'.
571 "A String",
572 ],
573 "trashed": True or False, # Whether the file has been trashed, either explicitly or from a trashed parent folder. Only the owner may trash a file, and other users cannot see files in the owner's trash.
574 "contentHints": { # Additional information about the content of the file. These fields are never populated in responses.
575 "indexableText": "A String", # Text to be indexed for the file to improve fullText queries. This is limited to 128KB in length and may contain HTML elements.
576 "thumbnail": { # A thumbnail for the file. This will only be used if Drive cannot generate a standard thumbnail.
577 "mimeType": "A String", # The MIME type of the thumbnail.
578 "image": "A String", # The thumbnail data encoded with URL-safe Base64 (RFC 4648 section 5).
579 },
580 },
581 "fileExtension": "A String", # The final component of fullFileExtension. This is only available for files with binary content in Drive.
582 "starred": True or False, # Whether the user has starred the file.
583 "headRevisionId": "A String", # The ID of the file's head revision. This is currently only available for files with binary content in Drive.
584}
585
586 media_body: string, The filename of the media request body, or an instance of a MediaUpload object.
587 keepRevisionForever: boolean, Whether to set the 'keepForever' field in the new head revision. This is only applicable to files with binary content in Drive.
588 useContentAsIndexableText: boolean, Whether to use the uploaded content as indexable text.
589 ignoreDefaultVisibility: boolean, Whether to ignore the domain's default visibility settings for the created file. Domain administrators can choose to make all uploaded files visible to the domain by default; this parameter bypasses that behavior for the request. Permissions are still inherited from parent folders.
590 ocrLanguage: string, A language hint for OCR processing during image import (ISO 639-1 code).
591
592Returns:
593 An object of the form:
594
595 { # The metadata for a file.
596 "mimeType": "A String", # The MIME type of the file.
597 # Drive will attempt to automatically detect an appropriate value from uploaded content if no value is provided. The value cannot be changed unless a new revision is uploaded.
598 # If a file is created with a Google Doc MIME type, the uploaded content will be imported if possible. The supported import formats are published in the About resource.
599 "modifiedByMeTime": "A String", # The last time the file was modified by the user (RFC 3339 date-time).
600 "thumbnailLink": "A String", # A short-lived link to the file's thumbnail, if available. Typically lasts on the order of hours.
601 "explicitlyTrashed": True or False, # Whether the file has been explicitly trashed, as opposed to recursively trashed from a parent folder.
602 "writersCanShare": True or False, # Whether users with only writer permission can modify the file's permissions.
603 "ownedByMe": True or False, # Whether the user owns the file.
604 "viewedByMeTime": "A String", # The last time the file was viewed by the user (RFC 3339 date-time).
605 "id": "A String", # The ID of the file.
606 "sharingUser": { # Information about a Drive user. # The user who shared the file with the requesting user, if applicable.
607 "me": True or False, # Whether this user is the requesting user.
608 "kind": "drive#user", # This is always drive#user.
609 "displayName": "A String", # A plain text displayable name for this user.
610 "permissionId": "A String", # The user's ID as visible in Permission resources.
611 "emailAddress": "A String", # The email address of the user. This may not be present in certain contexts if the user has not made their email address visible to the requester.
612 "photoLink": "A String", # A link to the user's profile photo, if available.
613 },
614 "size": "A String", # The size of the file's content in bytes. This is only applicable to files with binary content in Drive.
615 "videoMediaMetadata": { # Additional metadata about video media. This may not be available immediately upon upload.
616 "width": 42, # The width of the video in pixels.
617 "durationMillis": "A String", # The duration of the video in milliseconds.
618 "height": 42, # The height of the video in pixels.
619 },
620 "lastModifyingUser": { # Information about a Drive user. # The last user to modify the file.
621 "me": True or False, # Whether this user is the requesting user.
622 "kind": "drive#user", # This is always drive#user.
623 "displayName": "A String", # A plain text displayable name for this user.
624 "permissionId": "A String", # The user's ID as visible in Permission resources.
625 "emailAddress": "A String", # The email address of the user. This may not be present in certain contexts if the user has not made their email address visible to the requester.
626 "photoLink": "A String", # A link to the user's profile photo, if available.
627 },
628 "folderColorRgb": "A String", # The color for a folder as an RGB hex string. The supported colors are published in the folderColorPalette field of the About resource.
629 # If an unsupported color is specified, the closest color in the palette will be used instead.
630 "appProperties": { # A collection of arbitrary key-value pairs which are private to the requesting app.
631 # Entries with null values are cleared in update and copy requests.
632 "a_key": "A String",
633 },
634 "capabilities": { # Capabilities the current user has on the file.
635 "canReadRevisions": True or False, # Whether the current user has read access to the Revisions resource of the file.
636 "canCopy": True or False, # Whether the user can copy the file.
637 "canShare": True or False, # Whether the user can modify the file's permissions and sharing settings.
638 "canEdit": True or False, # Whether the user can edit the file's content.
639 "canComment": True or False, # Whether the user can comment on the file.
640 },
641 "webViewLink": "A String", # A link for opening the file in a relevant Google editor or viewer in a browser.
642 "version": "A String", # A monotonically increasing version number for the file. This reflects every change made to the file on the server, even those not visible to the user.
643 "parents": [ # The IDs of the parent folders which contain the file.
644 # If not specified as part of a create request, the file will be placed directly in the My Drive folder. Update requests must use the addParents and removeParents parameters to modify the values.
645 "A String",
646 ],
647 "sharedWithMeTime": "A String", # The time at which the file was shared with the user, if applicable (RFC 3339 date-time).
648 "shared": True or False, # Whether the file has been shared.
649 "permissions": [ # The full list of permissions for the file. This is only available if the requesting user can share the file.
650 { # A permission for a file. A permission grants a user, group, domain or the world access to a file or a folder hierarchy.
651 "domain": "A String", # The domain to which this permission refers.
652 "displayName": "A String", # A displayable name for users, groups or domains.
653 "allowFileDiscovery": True or False, # Whether the permission allows the file to be discovered through search. This is only applicable for permissions of type domain or anyone.
654 "kind": "drive#permission", # This is always drive#permission.
655 "emailAddress": "A String", # The email address of the user or group to which this permission refers.
656 "photoLink": "A String", # A link to the user's profile photo, if available.
657 "role": "A String", # The role granted by this permission. Valid values are:
658 # - owner
659 # - writer
660 # - commenter
661 # - reader
662 "type": "A String", # The type of the grantee. Valid values are:
663 # - user
664 # - group
665 # - domain
666 # - anyone
667 "id": "A String", # The ID of this permission. This is a unique identifier for the grantee, and is published in User resources as permissionId.
668 },
669 ],
670 "fullFileExtension": "A String", # The full file extension extracted from the name field. May contain multiple concatenated extensions, such as "tar.gz". This is only available for files with binary content in Drive.
671 # This is automatically updated when the name field changes, however it is not cleared if the new name does not contain a valid extension.
672 "originalFilename": "A String", # The original filename of the uploaded content if available, or else the original value of the name field. This is only available for files with binary content in Drive.
673 "viewersCanCopyContent": True or False, # Whether users with only reader or commenter permission can copy the file's content. This affects copy, download, and print operations.
674 "description": "A String", # A short description of the file.
675 "modifiedTime": "A String", # The last time the file was modified by anyone (RFC 3339 date-time).
676 # Note that setting modifiedTime will also update modifiedByMeTime for the user.
677 "viewedByMe": True or False, # Whether the file has been viewed by this user.
678 "owners": [ # The owners of the file. Currently, only certain legacy files may have more than one owner.
679 { # Information about a Drive user.
680 "me": True or False, # Whether this user is the requesting user.
681 "kind": "drive#user", # This is always drive#user.
682 "displayName": "A String", # A plain text displayable name for this user.
683 "permissionId": "A String", # The user's ID as visible in Permission resources.
684 "emailAddress": "A String", # The email address of the user. This may not be present in certain contexts if the user has not made their email address visible to the requester.
685 "photoLink": "A String", # A link to the user's profile photo, if available.
686 },
687 ],
688 "createdTime": "A String", # The time at which the file was created (RFC 3339 date-time).
689 "quotaBytesUsed": "A String", # The number of storage quota bytes used by the file. This includes the head revision as well as previous revisions with keepForever enabled.
690 "properties": { # A collection of arbitrary key-value pairs which are visible to all apps.
691 # Entries with null values are cleared in update and copy requests.
692 "a_key": "A String",
693 },
694 "md5Checksum": "A String", # The MD5 checksum for the content of the file. This is only applicable to files with binary content in Drive.
695 "iconLink": "A String", # A static, unauthenticated link to the file's icon.
696 "imageMediaMetadata": { # Additional metadata about image media, if available.
697 "exposureBias": 3.14, # The exposure bias of the photo (APEX value).
698 "exposureTime": 3.14, # The length of the exposure, in seconds.
699 "cameraMake": "A String", # The make of the camera used to create the photo.
700 "maxApertureValue": 3.14, # The smallest f-number of the lens at the focal length used to create the photo (APEX value).
701 "width": 42, # The width of the image in pixels.
702 "focalLength": 3.14, # The focal length used to create the photo, in millimeters.
703 "exposureMode": "A String", # The exposure mode used to create the photo.
704 "colorSpace": "A String", # The color space of the photo.
705 "location": { # Geographic location information stored in the image.
706 "latitude": 3.14, # The latitude stored in the image.
707 "altitude": 3.14, # The altitude stored in the image.
708 "longitude": 3.14, # The longitude stored in the image.
709 },
710 "subjectDistance": 42, # The distance to the subject of the photo, in meters.
711 "height": 42, # The height of the image in pixels.
712 "lens": "A String", # The lens used to create the photo.
713 "isoSpeed": 42, # The ISO speed used to create the photo.
714 "meteringMode": "A String", # The metering mode used to create the photo.
715 "flashUsed": True or False, # Whether a flash was used to create the photo.
716 "time": "A String", # The date and time the photo was taken (EXIF DateTime).
717 "aperture": 3.14, # The aperture used to create the photo (f-number).
718 "rotation": 42, # The rotation in clockwise degrees from the image's original orientation.
719 "sensor": "A String", # The type of sensor used to create the photo.
720 "whiteBalance": "A String", # The white balance mode used to create the photo.
721 "cameraModel": "A String", # The model of the camera used to create the photo.
722 },
723 "kind": "drive#file", # This is always drive#file.
724 "name": "A String", # The name of the file. This is not necessarily unique within a folder.
725 "webContentLink": "A String", # A link for downloading the content of the file in a browser. This is only available for files with binary content in Drive.
726 "spaces": [ # The list of spaces which contain the file. The currently supported values are 'drive', 'appDataFolder' and 'photos'.
727 "A String",
728 ],
729 "trashed": True or False, # Whether the file has been trashed, either explicitly or from a trashed parent folder. Only the owner may trash a file, and other users cannot see files in the owner's trash.
730 "contentHints": { # Additional information about the content of the file. These fields are never populated in responses.
731 "indexableText": "A String", # Text to be indexed for the file to improve fullText queries. This is limited to 128KB in length and may contain HTML elements.
732 "thumbnail": { # A thumbnail for the file. This will only be used if Drive cannot generate a standard thumbnail.
733 "mimeType": "A String", # The MIME type of the thumbnail.
734 "image": "A String", # The thumbnail data encoded with URL-safe Base64 (RFC 4648 section 5).
735 },
736 },
737 "fileExtension": "A String", # The final component of fullFileExtension. This is only available for files with binary content in Drive.
738 "starred": True or False, # Whether the user has starred the file.
739 "headRevisionId": "A String", # The ID of the file's head revision. This is currently only available for files with binary content in Drive.
740 }</pre>
741</div>
742
743<div class="method">
744 <code class="details" id="delete">delete(fileId)</code>
745 <pre>Permanently deletes a file owned by the user without moving it to the trash. If the target is a folder, all descendants owned by the user are also deleted.
746
747Args:
748 fileId: string, The ID of the file. (required)
749</pre>
750</div>
751
752<div class="method">
753 <code class="details" id="emptyTrash">emptyTrash()</code>
754 <pre>Permanently deletes all of the user's trashed files.
755
756Args:
757</pre>
758</div>
759
760<div class="method">
761 <code class="details" id="export">export(fileId, mimeType)</code>
762 <pre>Exports a Google Doc to the requested MIME type and returns the exported content.
763
764Args:
765 fileId: string, The ID of the file. (required)
766 mimeType: string, The MIME type of the format requested for this export. (required)
767</pre>
768</div>
769
770<div class="method">
771 <code class="details" id="export_media">export_media(fileId, mimeType)</code>
772 <pre>Exports a Google Doc to the requested MIME type and returns the exported content.
773
774Args:
775 fileId: string, The ID of the file. (required)
776 mimeType: string, The MIME type of the format requested for this export. (required)
777</pre>
778</div>
779
780<div class="method">
781 <code class="details" id="generateIds">generateIds(count=None, space=None)</code>
782 <pre>Generates a set of file IDs which can be provided in create requests.
783
784Args:
785 count: integer, The number of IDs to return.
786 space: string, The space in which the IDs can be used to create new files. Supported values are 'drive' and 'appDataFolder'.
787
788Returns:
789 An object of the form:
790
791 { # A list of generated file IDs which can be provided in create requests.
792 "kind": "drive#generatedIds", # This is always drive#generatedIds
793 "ids": [ # The IDs generated for the requesting user in the specified space.
794 "A String",
795 ],
796 "space": "A String", # The type of file that can be created with these IDs.
797 }</pre>
798</div>
799
800<div class="method">
801 <code class="details" id="get">get(fileId, acknowledgeAbuse=None)</code>
802 <pre>Gets a file's metadata or content by ID.
803
804Args:
805 fileId: string, The ID of the file. (required)
806 acknowledgeAbuse: boolean, Whether the user is acknowledging the risk of downloading known malware or other abusive files. This is only applicable when alt=media.
807
808Returns:
809 An object of the form:
810
811 { # The metadata for a file.
812 "mimeType": "A String", # The MIME type of the file.
813 # Drive will attempt to automatically detect an appropriate value from uploaded content if no value is provided. The value cannot be changed unless a new revision is uploaded.
814 # If a file is created with a Google Doc MIME type, the uploaded content will be imported if possible. The supported import formats are published in the About resource.
815 "modifiedByMeTime": "A String", # The last time the file was modified by the user (RFC 3339 date-time).
816 "thumbnailLink": "A String", # A short-lived link to the file's thumbnail, if available. Typically lasts on the order of hours.
817 "explicitlyTrashed": True or False, # Whether the file has been explicitly trashed, as opposed to recursively trashed from a parent folder.
818 "writersCanShare": True or False, # Whether users with only writer permission can modify the file's permissions.
819 "ownedByMe": True or False, # Whether the user owns the file.
820 "viewedByMeTime": "A String", # The last time the file was viewed by the user (RFC 3339 date-time).
821 "id": "A String", # The ID of the file.
822 "sharingUser": { # Information about a Drive user. # The user who shared the file with the requesting user, if applicable.
823 "me": True or False, # Whether this user is the requesting user.
824 "kind": "drive#user", # This is always drive#user.
825 "displayName": "A String", # A plain text displayable name for this user.
826 "permissionId": "A String", # The user's ID as visible in Permission resources.
827 "emailAddress": "A String", # The email address of the user. This may not be present in certain contexts if the user has not made their email address visible to the requester.
828 "photoLink": "A String", # A link to the user's profile photo, if available.
829 },
830 "size": "A String", # The size of the file's content in bytes. This is only applicable to files with binary content in Drive.
831 "videoMediaMetadata": { # Additional metadata about video media. This may not be available immediately upon upload.
832 "width": 42, # The width of the video in pixels.
833 "durationMillis": "A String", # The duration of the video in milliseconds.
834 "height": 42, # The height of the video in pixels.
835 },
836 "lastModifyingUser": { # Information about a Drive user. # The last user to modify the file.
837 "me": True or False, # Whether this user is the requesting user.
838 "kind": "drive#user", # This is always drive#user.
839 "displayName": "A String", # A plain text displayable name for this user.
840 "permissionId": "A String", # The user's ID as visible in Permission resources.
841 "emailAddress": "A String", # The email address of the user. This may not be present in certain contexts if the user has not made their email address visible to the requester.
842 "photoLink": "A String", # A link to the user's profile photo, if available.
843 },
844 "folderColorRgb": "A String", # The color for a folder as an RGB hex string. The supported colors are published in the folderColorPalette field of the About resource.
845 # If an unsupported color is specified, the closest color in the palette will be used instead.
846 "appProperties": { # A collection of arbitrary key-value pairs which are private to the requesting app.
847 # Entries with null values are cleared in update and copy requests.
848 "a_key": "A String",
849 },
850 "capabilities": { # Capabilities the current user has on the file.
851 "canReadRevisions": True or False, # Whether the current user has read access to the Revisions resource of the file.
852 "canCopy": True or False, # Whether the user can copy the file.
853 "canShare": True or False, # Whether the user can modify the file's permissions and sharing settings.
854 "canEdit": True or False, # Whether the user can edit the file's content.
855 "canComment": True or False, # Whether the user can comment on the file.
856 },
857 "webViewLink": "A String", # A link for opening the file in a relevant Google editor or viewer in a browser.
858 "version": "A String", # A monotonically increasing version number for the file. This reflects every change made to the file on the server, even those not visible to the user.
859 "parents": [ # The IDs of the parent folders which contain the file.
860 # If not specified as part of a create request, the file will be placed directly in the My Drive folder. Update requests must use the addParents and removeParents parameters to modify the values.
861 "A String",
862 ],
863 "sharedWithMeTime": "A String", # The time at which the file was shared with the user, if applicable (RFC 3339 date-time).
864 "shared": True or False, # Whether the file has been shared.
865 "permissions": [ # The full list of permissions for the file. This is only available if the requesting user can share the file.
866 { # A permission for a file. A permission grants a user, group, domain or the world access to a file or a folder hierarchy.
867 "domain": "A String", # The domain to which this permission refers.
868 "displayName": "A String", # A displayable name for users, groups or domains.
869 "allowFileDiscovery": True or False, # Whether the permission allows the file to be discovered through search. This is only applicable for permissions of type domain or anyone.
870 "kind": "drive#permission", # This is always drive#permission.
871 "emailAddress": "A String", # The email address of the user or group to which this permission refers.
872 "photoLink": "A String", # A link to the user's profile photo, if available.
873 "role": "A String", # The role granted by this permission. Valid values are:
874 # - owner
875 # - writer
876 # - commenter
877 # - reader
878 "type": "A String", # The type of the grantee. Valid values are:
879 # - user
880 # - group
881 # - domain
882 # - anyone
883 "id": "A String", # The ID of this permission. This is a unique identifier for the grantee, and is published in User resources as permissionId.
884 },
885 ],
886 "fullFileExtension": "A String", # The full file extension extracted from the name field. May contain multiple concatenated extensions, such as "tar.gz". This is only available for files with binary content in Drive.
887 # This is automatically updated when the name field changes, however it is not cleared if the new name does not contain a valid extension.
888 "originalFilename": "A String", # The original filename of the uploaded content if available, or else the original value of the name field. This is only available for files with binary content in Drive.
889 "viewersCanCopyContent": True or False, # Whether users with only reader or commenter permission can copy the file's content. This affects copy, download, and print operations.
890 "description": "A String", # A short description of the file.
891 "modifiedTime": "A String", # The last time the file was modified by anyone (RFC 3339 date-time).
892 # Note that setting modifiedTime will also update modifiedByMeTime for the user.
893 "viewedByMe": True or False, # Whether the file has been viewed by this user.
894 "owners": [ # The owners of the file. Currently, only certain legacy files may have more than one owner.
895 { # Information about a Drive user.
896 "me": True or False, # Whether this user is the requesting user.
897 "kind": "drive#user", # This is always drive#user.
898 "displayName": "A String", # A plain text displayable name for this user.
899 "permissionId": "A String", # The user's ID as visible in Permission resources.
900 "emailAddress": "A String", # The email address of the user. This may not be present in certain contexts if the user has not made their email address visible to the requester.
901 "photoLink": "A String", # A link to the user's profile photo, if available.
902 },
903 ],
904 "createdTime": "A String", # The time at which the file was created (RFC 3339 date-time).
905 "quotaBytesUsed": "A String", # The number of storage quota bytes used by the file. This includes the head revision as well as previous revisions with keepForever enabled.
906 "properties": { # A collection of arbitrary key-value pairs which are visible to all apps.
907 # Entries with null values are cleared in update and copy requests.
908 "a_key": "A String",
909 },
910 "md5Checksum": "A String", # The MD5 checksum for the content of the file. This is only applicable to files with binary content in Drive.
911 "iconLink": "A String", # A static, unauthenticated link to the file's icon.
912 "imageMediaMetadata": { # Additional metadata about image media, if available.
913 "exposureBias": 3.14, # The exposure bias of the photo (APEX value).
914 "exposureTime": 3.14, # The length of the exposure, in seconds.
915 "cameraMake": "A String", # The make of the camera used to create the photo.
916 "maxApertureValue": 3.14, # The smallest f-number of the lens at the focal length used to create the photo (APEX value).
917 "width": 42, # The width of the image in pixels.
918 "focalLength": 3.14, # The focal length used to create the photo, in millimeters.
919 "exposureMode": "A String", # The exposure mode used to create the photo.
920 "colorSpace": "A String", # The color space of the photo.
921 "location": { # Geographic location information stored in the image.
922 "latitude": 3.14, # The latitude stored in the image.
923 "altitude": 3.14, # The altitude stored in the image.
924 "longitude": 3.14, # The longitude stored in the image.
925 },
926 "subjectDistance": 42, # The distance to the subject of the photo, in meters.
927 "height": 42, # The height of the image in pixels.
928 "lens": "A String", # The lens used to create the photo.
929 "isoSpeed": 42, # The ISO speed used to create the photo.
930 "meteringMode": "A String", # The metering mode used to create the photo.
931 "flashUsed": True or False, # Whether a flash was used to create the photo.
932 "time": "A String", # The date and time the photo was taken (EXIF DateTime).
933 "aperture": 3.14, # The aperture used to create the photo (f-number).
934 "rotation": 42, # The rotation in clockwise degrees from the image's original orientation.
935 "sensor": "A String", # The type of sensor used to create the photo.
936 "whiteBalance": "A String", # The white balance mode used to create the photo.
937 "cameraModel": "A String", # The model of the camera used to create the photo.
938 },
939 "kind": "drive#file", # This is always drive#file.
940 "name": "A String", # The name of the file. This is not necessarily unique within a folder.
941 "webContentLink": "A String", # A link for downloading the content of the file in a browser. This is only available for files with binary content in Drive.
942 "spaces": [ # The list of spaces which contain the file. The currently supported values are 'drive', 'appDataFolder' and 'photos'.
943 "A String",
944 ],
945 "trashed": True or False, # Whether the file has been trashed, either explicitly or from a trashed parent folder. Only the owner may trash a file, and other users cannot see files in the owner's trash.
946 "contentHints": { # Additional information about the content of the file. These fields are never populated in responses.
947 "indexableText": "A String", # Text to be indexed for the file to improve fullText queries. This is limited to 128KB in length and may contain HTML elements.
948 "thumbnail": { # A thumbnail for the file. This will only be used if Drive cannot generate a standard thumbnail.
949 "mimeType": "A String", # The MIME type of the thumbnail.
950 "image": "A String", # The thumbnail data encoded with URL-safe Base64 (RFC 4648 section 5).
951 },
952 },
953 "fileExtension": "A String", # The final component of fullFileExtension. This is only available for files with binary content in Drive.
954 "starred": True or False, # Whether the user has starred the file.
955 "headRevisionId": "A String", # The ID of the file's head revision. This is currently only available for files with binary content in Drive.
956 }</pre>
957</div>
958
959<div class="method">
960 <code class="details" id="get_media">get_media(fileId, acknowledgeAbuse=None)</code>
961 <pre>Gets a file's metadata or content by ID.
962
963Args:
964 fileId: string, The ID of the file. (required)
965 acknowledgeAbuse: boolean, Whether the user is acknowledging the risk of downloading known malware or other abusive files. This is only applicable when alt=media.
966
967Returns:
968 The media object as a string.
969
970 </pre>
971</div>
972
973<div class="method">
974 <code class="details" id="list">list(orderBy=None, q=None, pageSize=None, pageToken=None, spaces=None, corpus=None)</code>
975 <pre>Lists or searches files.
976
977Args:
978 orderBy: string, A comma-separated list of sort keys. Valid keys are 'createdTime', 'folder', 'modifiedByMeTime', 'modifiedTime', 'name', 'quotaBytesUsed', 'recency', 'sharedWithMeTime', 'starred', and 'viewedByMeTime'. Each key sorts ascending by default, but may be reversed with the 'desc' modifier. Example usage: ?orderBy=folder,modifiedTime desc,name. Please note that there is a current limitation for users with approximately one million files in which the requested sort order is ignored.
979 q: string, A query for filtering the file results. See the "Search for Files" guide for supported syntax.
980 pageSize: integer, The maximum number of files to return per page.
981 pageToken: string, 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.
982 spaces: string, A comma-separated list of spaces to query within the corpus. Supported values are 'drive', 'appDataFolder' and 'photos'.
983 corpus: string, The source of files to list.
984 Allowed values
985 domain - Files shared to the user's domain.
986 user - Files owned by or shared to the user.
987
988Returns:
989 An object of the form:
990
991 { # A list of files.
992 "files": [ # The page of files.
993 { # The metadata for a file.
994 "mimeType": "A String", # The MIME type of the file.
995 # Drive will attempt to automatically detect an appropriate value from uploaded content if no value is provided. The value cannot be changed unless a new revision is uploaded.
996 # If a file is created with a Google Doc MIME type, the uploaded content will be imported if possible. The supported import formats are published in the About resource.
997 "modifiedByMeTime": "A String", # The last time the file was modified by the user (RFC 3339 date-time).
998 "thumbnailLink": "A String", # A short-lived link to the file's thumbnail, if available. Typically lasts on the order of hours.
999 "explicitlyTrashed": True or False, # Whether the file has been explicitly trashed, as opposed to recursively trashed from a parent folder.
1000 "writersCanShare": True or False, # Whether users with only writer permission can modify the file's permissions.
1001 "ownedByMe": True or False, # Whether the user owns the file.
1002 "viewedByMeTime": "A String", # The last time the file was viewed by the user (RFC 3339 date-time).
1003 "id": "A String", # The ID of the file.
1004 "sharingUser": { # Information about a Drive user. # The user who shared the file with the requesting user, if applicable.
1005 "me": True or False, # Whether this user is the requesting user.
1006 "kind": "drive#user", # This is always drive#user.
1007 "displayName": "A String", # A plain text displayable name for this user.
1008 "permissionId": "A String", # The user's ID as visible in Permission resources.
1009 "emailAddress": "A String", # The email address of the user. This may not be present in certain contexts if the user has not made their email address visible to the requester.
1010 "photoLink": "A String", # A link to the user's profile photo, if available.
1011 },
1012 "size": "A String", # The size of the file's content in bytes. This is only applicable to files with binary content in Drive.
1013 "videoMediaMetadata": { # Additional metadata about video media. This may not be available immediately upon upload.
1014 "width": 42, # The width of the video in pixels.
1015 "durationMillis": "A String", # The duration of the video in milliseconds.
1016 "height": 42, # The height of the video in pixels.
1017 },
1018 "lastModifyingUser": { # Information about a Drive user. # The last user to modify the file.
1019 "me": True or False, # Whether this user is the requesting user.
1020 "kind": "drive#user", # This is always drive#user.
1021 "displayName": "A String", # A plain text displayable name for this user.
1022 "permissionId": "A String", # The user's ID as visible in Permission resources.
1023 "emailAddress": "A String", # The email address of the user. This may not be present in certain contexts if the user has not made their email address visible to the requester.
1024 "photoLink": "A String", # A link to the user's profile photo, if available.
1025 },
1026 "folderColorRgb": "A String", # The color for a folder as an RGB hex string. The supported colors are published in the folderColorPalette field of the About resource.
1027 # If an unsupported color is specified, the closest color in the palette will be used instead.
1028 "appProperties": { # A collection of arbitrary key-value pairs which are private to the requesting app.
1029 # Entries with null values are cleared in update and copy requests.
1030 "a_key": "A String",
1031 },
1032 "capabilities": { # Capabilities the current user has on the file.
1033 "canReadRevisions": True or False, # Whether the current user has read access to the Revisions resource of the file.
1034 "canCopy": True or False, # Whether the user can copy the file.
1035 "canShare": True or False, # Whether the user can modify the file's permissions and sharing settings.
1036 "canEdit": True or False, # Whether the user can edit the file's content.
1037 "canComment": True or False, # Whether the user can comment on the file.
1038 },
1039 "webViewLink": "A String", # A link for opening the file in a relevant Google editor or viewer in a browser.
1040 "version": "A String", # A monotonically increasing version number for the file. This reflects every change made to the file on the server, even those not visible to the user.
1041 "parents": [ # The IDs of the parent folders which contain the file.
1042 # If not specified as part of a create request, the file will be placed directly in the My Drive folder. Update requests must use the addParents and removeParents parameters to modify the values.
1043 "A String",
1044 ],
1045 "sharedWithMeTime": "A String", # The time at which the file was shared with the user, if applicable (RFC 3339 date-time).
1046 "shared": True or False, # Whether the file has been shared.
1047 "permissions": [ # The full list of permissions for the file. This is only available if the requesting user can share the file.
1048 { # A permission for a file. A permission grants a user, group, domain or the world access to a file or a folder hierarchy.
1049 "domain": "A String", # The domain to which this permission refers.
1050 "displayName": "A String", # A displayable name for users, groups or domains.
1051 "allowFileDiscovery": True or False, # Whether the permission allows the file to be discovered through search. This is only applicable for permissions of type domain or anyone.
1052 "kind": "drive#permission", # This is always drive#permission.
1053 "emailAddress": "A String", # The email address of the user or group to which this permission refers.
1054 "photoLink": "A String", # A link to the user's profile photo, if available.
1055 "role": "A String", # The role granted by this permission. Valid values are:
1056 # - owner
1057 # - writer
1058 # - commenter
1059 # - reader
1060 "type": "A String", # The type of the grantee. Valid values are:
1061 # - user
1062 # - group
1063 # - domain
1064 # - anyone
1065 "id": "A String", # The ID of this permission. This is a unique identifier for the grantee, and is published in User resources as permissionId.
1066 },
1067 ],
1068 "fullFileExtension": "A String", # The full file extension extracted from the name field. May contain multiple concatenated extensions, such as "tar.gz". This is only available for files with binary content in Drive.
1069 # This is automatically updated when the name field changes, however it is not cleared if the new name does not contain a valid extension.
1070 "originalFilename": "A String", # The original filename of the uploaded content if available, or else the original value of the name field. This is only available for files with binary content in Drive.
1071 "viewersCanCopyContent": True or False, # Whether users with only reader or commenter permission can copy the file's content. This affects copy, download, and print operations.
1072 "description": "A String", # A short description of the file.
1073 "modifiedTime": "A String", # The last time the file was modified by anyone (RFC 3339 date-time).
1074 # Note that setting modifiedTime will also update modifiedByMeTime for the user.
1075 "viewedByMe": True or False, # Whether the file has been viewed by this user.
1076 "owners": [ # The owners of the file. Currently, only certain legacy files may have more than one owner.
1077 { # Information about a Drive user.
1078 "me": True or False, # Whether this user is the requesting user.
1079 "kind": "drive#user", # This is always drive#user.
1080 "displayName": "A String", # A plain text displayable name for this user.
1081 "permissionId": "A String", # The user's ID as visible in Permission resources.
1082 "emailAddress": "A String", # The email address of the user. This may not be present in certain contexts if the user has not made their email address visible to the requester.
1083 "photoLink": "A String", # A link to the user's profile photo, if available.
1084 },
1085 ],
1086 "createdTime": "A String", # The time at which the file was created (RFC 3339 date-time).
1087 "quotaBytesUsed": "A String", # The number of storage quota bytes used by the file. This includes the head revision as well as previous revisions with keepForever enabled.
1088 "properties": { # A collection of arbitrary key-value pairs which are visible to all apps.
1089 # Entries with null values are cleared in update and copy requests.
1090 "a_key": "A String",
1091 },
1092 "md5Checksum": "A String", # The MD5 checksum for the content of the file. This is only applicable to files with binary content in Drive.
1093 "iconLink": "A String", # A static, unauthenticated link to the file's icon.
1094 "imageMediaMetadata": { # Additional metadata about image media, if available.
1095 "exposureBias": 3.14, # The exposure bias of the photo (APEX value).
1096 "exposureTime": 3.14, # The length of the exposure, in seconds.
1097 "cameraMake": "A String", # The make of the camera used to create the photo.
1098 "maxApertureValue": 3.14, # The smallest f-number of the lens at the focal length used to create the photo (APEX value).
1099 "width": 42, # The width of the image in pixels.
1100 "focalLength": 3.14, # The focal length used to create the photo, in millimeters.
1101 "exposureMode": "A String", # The exposure mode used to create the photo.
1102 "colorSpace": "A String", # The color space of the photo.
1103 "location": { # Geographic location information stored in the image.
1104 "latitude": 3.14, # The latitude stored in the image.
1105 "altitude": 3.14, # The altitude stored in the image.
1106 "longitude": 3.14, # The longitude stored in the image.
1107 },
1108 "subjectDistance": 42, # The distance to the subject of the photo, in meters.
1109 "height": 42, # The height of the image in pixels.
1110 "lens": "A String", # The lens used to create the photo.
1111 "isoSpeed": 42, # The ISO speed used to create the photo.
1112 "meteringMode": "A String", # The metering mode used to create the photo.
1113 "flashUsed": True or False, # Whether a flash was used to create the photo.
1114 "time": "A String", # The date and time the photo was taken (EXIF DateTime).
1115 "aperture": 3.14, # The aperture used to create the photo (f-number).
1116 "rotation": 42, # The rotation in clockwise degrees from the image's original orientation.
1117 "sensor": "A String", # The type of sensor used to create the photo.
1118 "whiteBalance": "A String", # The white balance mode used to create the photo.
1119 "cameraModel": "A String", # The model of the camera used to create the photo.
1120 },
1121 "kind": "drive#file", # This is always drive#file.
1122 "name": "A String", # The name of the file. This is not necessarily unique within a folder.
1123 "webContentLink": "A String", # A link for downloading the content of the file in a browser. This is only available for files with binary content in Drive.
1124 "spaces": [ # The list of spaces which contain the file. The currently supported values are 'drive', 'appDataFolder' and 'photos'.
1125 "A String",
1126 ],
1127 "trashed": True or False, # Whether the file has been trashed, either explicitly or from a trashed parent folder. Only the owner may trash a file, and other users cannot see files in the owner's trash.
1128 "contentHints": { # Additional information about the content of the file. These fields are never populated in responses.
1129 "indexableText": "A String", # Text to be indexed for the file to improve fullText queries. This is limited to 128KB in length and may contain HTML elements.
1130 "thumbnail": { # A thumbnail for the file. This will only be used if Drive cannot generate a standard thumbnail.
1131 "mimeType": "A String", # The MIME type of the thumbnail.
1132 "image": "A String", # The thumbnail data encoded with URL-safe Base64 (RFC 4648 section 5).
1133 },
1134 },
1135 "fileExtension": "A String", # The final component of fullFileExtension. This is only available for files with binary content in Drive.
1136 "starred": True or False, # Whether the user has starred the file.
1137 "headRevisionId": "A String", # The ID of the file's head revision. This is currently only available for files with binary content in Drive.
1138 },
1139 ],
1140 "nextPageToken": "A String", # The page token for the next page of files. This will be absent if the end of the files list has been reached.
1141 "kind": "drive#fileList", # This is always drive#fileList.
1142 }</pre>
1143</div>
1144
1145<div class="method">
1146 <code class="details" id="list_next">list_next(previous_request, previous_response)</code>
1147 <pre>Retrieves the next page of results.
1148
1149Args:
1150 previous_request: The request for the previous page. (required)
1151 previous_response: The response from the request for the previous page. (required)
1152
1153Returns:
1154 A request object that you can call 'execute()' on to request the next
1155 page. Returns None if there are no more items in the collection.
1156 </pre>
1157</div>
1158
1159<div class="method">
1160 <code class="details" id="update">update(fileId, body=None, media_body=None, addParents=None, removeParents=None, useContentAsIndexableText=None, keepRevisionForever=None, ocrLanguage=None)</code>
1161 <pre>Updates a file's metadata and/or content with patch semantics.
1162
1163Args:
1164 fileId: string, The ID of the file. (required)
1165 body: object, The request body.
1166 The object takes the form of:
1167
1168{ # The metadata for a file.
1169 "mimeType": "A String", # The MIME type of the file.
1170 # Drive will attempt to automatically detect an appropriate value from uploaded content if no value is provided. The value cannot be changed unless a new revision is uploaded.
1171 # If a file is created with a Google Doc MIME type, the uploaded content will be imported if possible. The supported import formats are published in the About resource.
1172 "modifiedByMeTime": "A String", # The last time the file was modified by the user (RFC 3339 date-time).
1173 "thumbnailLink": "A String", # A short-lived link to the file's thumbnail, if available. Typically lasts on the order of hours.
1174 "explicitlyTrashed": True or False, # Whether the file has been explicitly trashed, as opposed to recursively trashed from a parent folder.
1175 "writersCanShare": True or False, # Whether users with only writer permission can modify the file's permissions.
1176 "ownedByMe": True or False, # Whether the user owns the file.
1177 "viewedByMeTime": "A String", # The last time the file was viewed by the user (RFC 3339 date-time).
1178 "id": "A String", # The ID of the file.
1179 "sharingUser": { # Information about a Drive user. # The user who shared the file with the requesting user, if applicable.
1180 "me": True or False, # Whether this user is the requesting user.
1181 "kind": "drive#user", # This is always drive#user.
1182 "displayName": "A String", # A plain text displayable name for this user.
1183 "permissionId": "A String", # The user's ID as visible in Permission resources.
1184 "emailAddress": "A String", # The email address of the user. This may not be present in certain contexts if the user has not made their email address visible to the requester.
1185 "photoLink": "A String", # A link to the user's profile photo, if available.
1186 },
1187 "size": "A String", # The size of the file's content in bytes. This is only applicable to files with binary content in Drive.
1188 "videoMediaMetadata": { # Additional metadata about video media. This may not be available immediately upon upload.
1189 "width": 42, # The width of the video in pixels.
1190 "durationMillis": "A String", # The duration of the video in milliseconds.
1191 "height": 42, # The height of the video in pixels.
1192 },
1193 "lastModifyingUser": { # Information about a Drive user. # The last user to modify the file.
1194 "me": True or False, # Whether this user is the requesting user.
1195 "kind": "drive#user", # This is always drive#user.
1196 "displayName": "A String", # A plain text displayable name for this user.
1197 "permissionId": "A String", # The user's ID as visible in Permission resources.
1198 "emailAddress": "A String", # The email address of the user. This may not be present in certain contexts if the user has not made their email address visible to the requester.
1199 "photoLink": "A String", # A link to the user's profile photo, if available.
1200 },
1201 "folderColorRgb": "A String", # The color for a folder as an RGB hex string. The supported colors are published in the folderColorPalette field of the About resource.
1202 # If an unsupported color is specified, the closest color in the palette will be used instead.
1203 "appProperties": { # A collection of arbitrary key-value pairs which are private to the requesting app.
1204 # Entries with null values are cleared in update and copy requests.
1205 "a_key": "A String",
1206 },
1207 "capabilities": { # Capabilities the current user has on the file.
1208 "canReadRevisions": True or False, # Whether the current user has read access to the Revisions resource of the file.
1209 "canCopy": True or False, # Whether the user can copy the file.
1210 "canShare": True or False, # Whether the user can modify the file's permissions and sharing settings.
1211 "canEdit": True or False, # Whether the user can edit the file's content.
1212 "canComment": True or False, # Whether the user can comment on the file.
1213 },
1214 "webViewLink": "A String", # A link for opening the file in a relevant Google editor or viewer in a browser.
1215 "version": "A String", # A monotonically increasing version number for the file. This reflects every change made to the file on the server, even those not visible to the user.
1216 "parents": [ # The IDs of the parent folders which contain the file.
1217 # If not specified as part of a create request, the file will be placed directly in the My Drive folder. Update requests must use the addParents and removeParents parameters to modify the values.
1218 "A String",
1219 ],
1220 "sharedWithMeTime": "A String", # The time at which the file was shared with the user, if applicable (RFC 3339 date-time).
1221 "shared": True or False, # Whether the file has been shared.
1222 "permissions": [ # The full list of permissions for the file. This is only available if the requesting user can share the file.
1223 { # A permission for a file. A permission grants a user, group, domain or the world access to a file or a folder hierarchy.
1224 "domain": "A String", # The domain to which this permission refers.
1225 "displayName": "A String", # A displayable name for users, groups or domains.
1226 "allowFileDiscovery": True or False, # Whether the permission allows the file to be discovered through search. This is only applicable for permissions of type domain or anyone.
1227 "kind": "drive#permission", # This is always drive#permission.
1228 "emailAddress": "A String", # The email address of the user or group to which this permission refers.
1229 "photoLink": "A String", # A link to the user's profile photo, if available.
1230 "role": "A String", # The role granted by this permission. Valid values are:
1231 # - owner
1232 # - writer
1233 # - commenter
1234 # - reader
1235 "type": "A String", # The type of the grantee. Valid values are:
1236 # - user
1237 # - group
1238 # - domain
1239 # - anyone
1240 "id": "A String", # The ID of this permission. This is a unique identifier for the grantee, and is published in User resources as permissionId.
1241 },
1242 ],
1243 "fullFileExtension": "A String", # The full file extension extracted from the name field. May contain multiple concatenated extensions, such as "tar.gz". This is only available for files with binary content in Drive.
1244 # This is automatically updated when the name field changes, however it is not cleared if the new name does not contain a valid extension.
1245 "originalFilename": "A String", # The original filename of the uploaded content if available, or else the original value of the name field. This is only available for files with binary content in Drive.
1246 "viewersCanCopyContent": True or False, # Whether users with only reader or commenter permission can copy the file's content. This affects copy, download, and print operations.
1247 "description": "A String", # A short description of the file.
1248 "modifiedTime": "A String", # The last time the file was modified by anyone (RFC 3339 date-time).
1249 # Note that setting modifiedTime will also update modifiedByMeTime for the user.
1250 "viewedByMe": True or False, # Whether the file has been viewed by this user.
1251 "owners": [ # The owners of the file. Currently, only certain legacy files may have more than one owner.
1252 { # Information about a Drive user.
1253 "me": True or False, # Whether this user is the requesting user.
1254 "kind": "drive#user", # This is always drive#user.
1255 "displayName": "A String", # A plain text displayable name for this user.
1256 "permissionId": "A String", # The user's ID as visible in Permission resources.
1257 "emailAddress": "A String", # The email address of the user. This may not be present in certain contexts if the user has not made their email address visible to the requester.
1258 "photoLink": "A String", # A link to the user's profile photo, if available.
1259 },
1260 ],
1261 "createdTime": "A String", # The time at which the file was created (RFC 3339 date-time).
1262 "quotaBytesUsed": "A String", # The number of storage quota bytes used by the file. This includes the head revision as well as previous revisions with keepForever enabled.
1263 "properties": { # A collection of arbitrary key-value pairs which are visible to all apps.
1264 # Entries with null values are cleared in update and copy requests.
1265 "a_key": "A String",
1266 },
1267 "md5Checksum": "A String", # The MD5 checksum for the content of the file. This is only applicable to files with binary content in Drive.
1268 "iconLink": "A String", # A static, unauthenticated link to the file's icon.
1269 "imageMediaMetadata": { # Additional metadata about image media, if available.
1270 "exposureBias": 3.14, # The exposure bias of the photo (APEX value).
1271 "exposureTime": 3.14, # The length of the exposure, in seconds.
1272 "cameraMake": "A String", # The make of the camera used to create the photo.
1273 "maxApertureValue": 3.14, # The smallest f-number of the lens at the focal length used to create the photo (APEX value).
1274 "width": 42, # The width of the image in pixels.
1275 "focalLength": 3.14, # The focal length used to create the photo, in millimeters.
1276 "exposureMode": "A String", # The exposure mode used to create the photo.
1277 "colorSpace": "A String", # The color space of the photo.
1278 "location": { # Geographic location information stored in the image.
1279 "latitude": 3.14, # The latitude stored in the image.
1280 "altitude": 3.14, # The altitude stored in the image.
1281 "longitude": 3.14, # The longitude stored in the image.
1282 },
1283 "subjectDistance": 42, # The distance to the subject of the photo, in meters.
1284 "height": 42, # The height of the image in pixels.
1285 "lens": "A String", # The lens used to create the photo.
1286 "isoSpeed": 42, # The ISO speed used to create the photo.
1287 "meteringMode": "A String", # The metering mode used to create the photo.
1288 "flashUsed": True or False, # Whether a flash was used to create the photo.
1289 "time": "A String", # The date and time the photo was taken (EXIF DateTime).
1290 "aperture": 3.14, # The aperture used to create the photo (f-number).
1291 "rotation": 42, # The rotation in clockwise degrees from the image's original orientation.
1292 "sensor": "A String", # The type of sensor used to create the photo.
1293 "whiteBalance": "A String", # The white balance mode used to create the photo.
1294 "cameraModel": "A String", # The model of the camera used to create the photo.
1295 },
1296 "kind": "drive#file", # This is always drive#file.
1297 "name": "A String", # The name of the file. This is not necessarily unique within a folder.
1298 "webContentLink": "A String", # A link for downloading the content of the file in a browser. This is only available for files with binary content in Drive.
1299 "spaces": [ # The list of spaces which contain the file. The currently supported values are 'drive', 'appDataFolder' and 'photos'.
1300 "A String",
1301 ],
1302 "trashed": True or False, # Whether the file has been trashed, either explicitly or from a trashed parent folder. Only the owner may trash a file, and other users cannot see files in the owner's trash.
1303 "contentHints": { # Additional information about the content of the file. These fields are never populated in responses.
1304 "indexableText": "A String", # Text to be indexed for the file to improve fullText queries. This is limited to 128KB in length and may contain HTML elements.
1305 "thumbnail": { # A thumbnail for the file. This will only be used if Drive cannot generate a standard thumbnail.
1306 "mimeType": "A String", # The MIME type of the thumbnail.
1307 "image": "A String", # The thumbnail data encoded with URL-safe Base64 (RFC 4648 section 5).
1308 },
1309 },
1310 "fileExtension": "A String", # The final component of fullFileExtension. This is only available for files with binary content in Drive.
1311 "starred": True or False, # Whether the user has starred the file.
1312 "headRevisionId": "A String", # The ID of the file's head revision. This is currently only available for files with binary content in Drive.
1313}
1314
1315 media_body: string, The filename of the media request body, or an instance of a MediaUpload object.
1316 addParents: string, A comma-separated list of parent IDs to add.
1317 removeParents: string, A comma-separated list of parent IDs to remove.
1318 useContentAsIndexableText: boolean, Whether to use the uploaded content as indexable text.
1319 keepRevisionForever: boolean, Whether to set the 'keepForever' field in the new head revision. This is only applicable to files with binary content in Drive.
1320 ocrLanguage: string, A language hint for OCR processing during image import (ISO 639-1 code).
1321
1322Returns:
1323 An object of the form:
1324
1325 { # The metadata for a file.
1326 "mimeType": "A String", # The MIME type of the file.
1327 # Drive will attempt to automatically detect an appropriate value from uploaded content if no value is provided. The value cannot be changed unless a new revision is uploaded.
1328 # If a file is created with a Google Doc MIME type, the uploaded content will be imported if possible. The supported import formats are published in the About resource.
1329 "modifiedByMeTime": "A String", # The last time the file was modified by the user (RFC 3339 date-time).
1330 "thumbnailLink": "A String", # A short-lived link to the file's thumbnail, if available. Typically lasts on the order of hours.
1331 "explicitlyTrashed": True or False, # Whether the file has been explicitly trashed, as opposed to recursively trashed from a parent folder.
1332 "writersCanShare": True or False, # Whether users with only writer permission can modify the file's permissions.
1333 "ownedByMe": True or False, # Whether the user owns the file.
1334 "viewedByMeTime": "A String", # The last time the file was viewed by the user (RFC 3339 date-time).
1335 "id": "A String", # The ID of the file.
1336 "sharingUser": { # Information about a Drive user. # The user who shared the file with the requesting user, if applicable.
1337 "me": True or False, # Whether this user is the requesting user.
1338 "kind": "drive#user", # This is always drive#user.
1339 "displayName": "A String", # A plain text displayable name for this user.
1340 "permissionId": "A String", # The user's ID as visible in Permission resources.
1341 "emailAddress": "A String", # The email address of the user. This may not be present in certain contexts if the user has not made their email address visible to the requester.
1342 "photoLink": "A String", # A link to the user's profile photo, if available.
1343 },
1344 "size": "A String", # The size of the file's content in bytes. This is only applicable to files with binary content in Drive.
1345 "videoMediaMetadata": { # Additional metadata about video media. This may not be available immediately upon upload.
1346 "width": 42, # The width of the video in pixels.
1347 "durationMillis": "A String", # The duration of the video in milliseconds.
1348 "height": 42, # The height of the video in pixels.
1349 },
1350 "lastModifyingUser": { # Information about a Drive user. # The last user to modify the file.
1351 "me": True or False, # Whether this user is the requesting user.
1352 "kind": "drive#user", # This is always drive#user.
1353 "displayName": "A String", # A plain text displayable name for this user.
1354 "permissionId": "A String", # The user's ID as visible in Permission resources.
1355 "emailAddress": "A String", # The email address of the user. This may not be present in certain contexts if the user has not made their email address visible to the requester.
1356 "photoLink": "A String", # A link to the user's profile photo, if available.
1357 },
1358 "folderColorRgb": "A String", # The color for a folder as an RGB hex string. The supported colors are published in the folderColorPalette field of the About resource.
1359 # If an unsupported color is specified, the closest color in the palette will be used instead.
1360 "appProperties": { # A collection of arbitrary key-value pairs which are private to the requesting app.
1361 # Entries with null values are cleared in update and copy requests.
1362 "a_key": "A String",
1363 },
1364 "capabilities": { # Capabilities the current user has on the file.
1365 "canReadRevisions": True or False, # Whether the current user has read access to the Revisions resource of the file.
1366 "canCopy": True or False, # Whether the user can copy the file.
1367 "canShare": True or False, # Whether the user can modify the file's permissions and sharing settings.
1368 "canEdit": True or False, # Whether the user can edit the file's content.
1369 "canComment": True or False, # Whether the user can comment on the file.
1370 },
1371 "webViewLink": "A String", # A link for opening the file in a relevant Google editor or viewer in a browser.
1372 "version": "A String", # A monotonically increasing version number for the file. This reflects every change made to the file on the server, even those not visible to the user.
1373 "parents": [ # The IDs of the parent folders which contain the file.
1374 # If not specified as part of a create request, the file will be placed directly in the My Drive folder. Update requests must use the addParents and removeParents parameters to modify the values.
1375 "A String",
1376 ],
1377 "sharedWithMeTime": "A String", # The time at which the file was shared with the user, if applicable (RFC 3339 date-time).
1378 "shared": True or False, # Whether the file has been shared.
1379 "permissions": [ # The full list of permissions for the file. This is only available if the requesting user can share the file.
1380 { # A permission for a file. A permission grants a user, group, domain or the world access to a file or a folder hierarchy.
1381 "domain": "A String", # The domain to which this permission refers.
1382 "displayName": "A String", # A displayable name for users, groups or domains.
1383 "allowFileDiscovery": True or False, # Whether the permission allows the file to be discovered through search. This is only applicable for permissions of type domain or anyone.
1384 "kind": "drive#permission", # This is always drive#permission.
1385 "emailAddress": "A String", # The email address of the user or group to which this permission refers.
1386 "photoLink": "A String", # A link to the user's profile photo, if available.
1387 "role": "A String", # The role granted by this permission. Valid values are:
1388 # - owner
1389 # - writer
1390 # - commenter
1391 # - reader
1392 "type": "A String", # The type of the grantee. Valid values are:
1393 # - user
1394 # - group
1395 # - domain
1396 # - anyone
1397 "id": "A String", # The ID of this permission. This is a unique identifier for the grantee, and is published in User resources as permissionId.
1398 },
1399 ],
1400 "fullFileExtension": "A String", # The full file extension extracted from the name field. May contain multiple concatenated extensions, such as "tar.gz". This is only available for files with binary content in Drive.
1401 # This is automatically updated when the name field changes, however it is not cleared if the new name does not contain a valid extension.
1402 "originalFilename": "A String", # The original filename of the uploaded content if available, or else the original value of the name field. This is only available for files with binary content in Drive.
1403 "viewersCanCopyContent": True or False, # Whether users with only reader or commenter permission can copy the file's content. This affects copy, download, and print operations.
1404 "description": "A String", # A short description of the file.
1405 "modifiedTime": "A String", # The last time the file was modified by anyone (RFC 3339 date-time).
1406 # Note that setting modifiedTime will also update modifiedByMeTime for the user.
1407 "viewedByMe": True or False, # Whether the file has been viewed by this user.
1408 "owners": [ # The owners of the file. Currently, only certain legacy files may have more than one owner.
1409 { # Information about a Drive user.
1410 "me": True or False, # Whether this user is the requesting user.
1411 "kind": "drive#user", # This is always drive#user.
1412 "displayName": "A String", # A plain text displayable name for this user.
1413 "permissionId": "A String", # The user's ID as visible in Permission resources.
1414 "emailAddress": "A String", # The email address of the user. This may not be present in certain contexts if the user has not made their email address visible to the requester.
1415 "photoLink": "A String", # A link to the user's profile photo, if available.
1416 },
1417 ],
1418 "createdTime": "A String", # The time at which the file was created (RFC 3339 date-time).
1419 "quotaBytesUsed": "A String", # The number of storage quota bytes used by the file. This includes the head revision as well as previous revisions with keepForever enabled.
1420 "properties": { # A collection of arbitrary key-value pairs which are visible to all apps.
1421 # Entries with null values are cleared in update and copy requests.
1422 "a_key": "A String",
1423 },
1424 "md5Checksum": "A String", # The MD5 checksum for the content of the file. This is only applicable to files with binary content in Drive.
1425 "iconLink": "A String", # A static, unauthenticated link to the file's icon.
1426 "imageMediaMetadata": { # Additional metadata about image media, if available.
1427 "exposureBias": 3.14, # The exposure bias of the photo (APEX value).
1428 "exposureTime": 3.14, # The length of the exposure, in seconds.
1429 "cameraMake": "A String", # The make of the camera used to create the photo.
1430 "maxApertureValue": 3.14, # The smallest f-number of the lens at the focal length used to create the photo (APEX value).
1431 "width": 42, # The width of the image in pixels.
1432 "focalLength": 3.14, # The focal length used to create the photo, in millimeters.
1433 "exposureMode": "A String", # The exposure mode used to create the photo.
1434 "colorSpace": "A String", # The color space of the photo.
1435 "location": { # Geographic location information stored in the image.
1436 "latitude": 3.14, # The latitude stored in the image.
1437 "altitude": 3.14, # The altitude stored in the image.
1438 "longitude": 3.14, # The longitude stored in the image.
1439 },
1440 "subjectDistance": 42, # The distance to the subject of the photo, in meters.
1441 "height": 42, # The height of the image in pixels.
1442 "lens": "A String", # The lens used to create the photo.
1443 "isoSpeed": 42, # The ISO speed used to create the photo.
1444 "meteringMode": "A String", # The metering mode used to create the photo.
1445 "flashUsed": True or False, # Whether a flash was used to create the photo.
1446 "time": "A String", # The date and time the photo was taken (EXIF DateTime).
1447 "aperture": 3.14, # The aperture used to create the photo (f-number).
1448 "rotation": 42, # The rotation in clockwise degrees from the image's original orientation.
1449 "sensor": "A String", # The type of sensor used to create the photo.
1450 "whiteBalance": "A String", # The white balance mode used to create the photo.
1451 "cameraModel": "A String", # The model of the camera used to create the photo.
1452 },
1453 "kind": "drive#file", # This is always drive#file.
1454 "name": "A String", # The name of the file. This is not necessarily unique within a folder.
1455 "webContentLink": "A String", # A link for downloading the content of the file in a browser. This is only available for files with binary content in Drive.
1456 "spaces": [ # The list of spaces which contain the file. The currently supported values are 'drive', 'appDataFolder' and 'photos'.
1457 "A String",
1458 ],
1459 "trashed": True or False, # Whether the file has been trashed, either explicitly or from a trashed parent folder. Only the owner may trash a file, and other users cannot see files in the owner's trash.
1460 "contentHints": { # Additional information about the content of the file. These fields are never populated in responses.
1461 "indexableText": "A String", # Text to be indexed for the file to improve fullText queries. This is limited to 128KB in length and may contain HTML elements.
1462 "thumbnail": { # A thumbnail for the file. This will only be used if Drive cannot generate a standard thumbnail.
1463 "mimeType": "A String", # The MIME type of the thumbnail.
1464 "image": "A String", # The thumbnail data encoded with URL-safe Base64 (RFC 4648 section 5).
1465 },
1466 },
1467 "fileExtension": "A String", # The final component of fullFileExtension. This is only available for files with binary content in Drive.
1468 "starred": True or False, # Whether the user has starred the file.
1469 "headRevisionId": "A String", # The ID of the file's head revision. This is currently only available for files with binary content in Drive.
1470 }</pre>
1471</div>
1472
1473<div class="method">
1474 <code class="details" id="watch">watch(fileId, body, acknowledgeAbuse=None)</code>
1475 <pre>Subscribes to changes to a file
1476
1477Args:
1478 fileId: string, The ID of the file. (required)
1479 body: object, The request body. (required)
1480 The object takes the form of:
1481
1482{ # An notification channel used to watch for resource changes.
1483 "resourceUri": "A String", # A version-specific identifier for the watched resource.
1484 "kind": "api#channel", # Identifies this as a notification channel used to watch for changes to a resource. Value: the fixed string "api#channel".
1485 "resourceId": "A String", # An opaque ID that identifies the resource being watched on this channel. Stable across different API versions.
1486 "payload": True or False, # A Boolean value to indicate whether payload is wanted. Optional.
1487 "token": "A String", # An arbitrary string delivered to the target address with each notification delivered over this channel. Optional.
1488 "params": { # Additional parameters controlling delivery channel behavior. Optional.
1489 "a_key": "A String", # Declares a new parameter by name.
1490 },
1491 "expiration": "A String", # Date and time of notification channel expiration, expressed as a Unix timestamp, in milliseconds. Optional.
1492 "address": "A String", # The address where notifications are delivered for this channel.
1493 "type": "A String", # The type of delivery mechanism used for this channel.
1494 "id": "A String", # A UUID or similar unique string that identifies this channel.
1495 }
1496
1497 acknowledgeAbuse: boolean, Whether the user is acknowledging the risk of downloading known malware or other abusive files. This is only applicable when alt=media.
1498
1499Returns:
1500 An object of the form:
1501
1502 { # An notification channel used to watch for resource changes.
1503 "resourceUri": "A String", # A version-specific identifier for the watched resource.
1504 "kind": "api#channel", # Identifies this as a notification channel used to watch for changes to a resource. Value: the fixed string "api#channel".
1505 "resourceId": "A String", # An opaque ID that identifies the resource being watched on this channel. Stable across different API versions.
1506 "payload": True or False, # A Boolean value to indicate whether payload is wanted. Optional.
1507 "token": "A String", # An arbitrary string delivered to the target address with each notification delivered over this channel. Optional.
1508 "params": { # Additional parameters controlling delivery channel behavior. Optional.
1509 "a_key": "A String", # Declares a new parameter by name.
1510 },
1511 "expiration": "A String", # Date and time of notification channel expiration, expressed as a Unix timestamp, in milliseconds. Optional.
1512 "address": "A String", # The address where notifications are delivered for this channel.
1513 "type": "A String", # The type of delivery mechanism used for this channel.
1514 "id": "A String", # A UUID or similar unique string that identifies this channel.
1515 }</pre>
1516</div>
1517
1518<div class="method">
1519 <code class="details" id="watch_media">watch_media(fileId, body, acknowledgeAbuse=None)</code>
1520 <pre>Subscribes to changes to a file
1521
1522Args:
1523 fileId: string, The ID of the file. (required)
1524 body: object, The request body. (required)
1525 The object takes the form of:
1526
1527{ # An notification channel used to watch for resource changes.
1528 "resourceUri": "A String", # A version-specific identifier for the watched resource.
1529 "kind": "api#channel", # Identifies this as a notification channel used to watch for changes to a resource. Value: the fixed string "api#channel".
1530 "resourceId": "A String", # An opaque ID that identifies the resource being watched on this channel. Stable across different API versions.
1531 "payload": True or False, # A Boolean value to indicate whether payload is wanted. Optional.
1532 "token": "A String", # An arbitrary string delivered to the target address with each notification delivered over this channel. Optional.
1533 "params": { # Additional parameters controlling delivery channel behavior. Optional.
1534 "a_key": "A String", # Declares a new parameter by name.
1535 },
1536 "expiration": "A String", # Date and time of notification channel expiration, expressed as a Unix timestamp, in milliseconds. Optional.
1537 "address": "A String", # The address where notifications are delivered for this channel.
1538 "type": "A String", # The type of delivery mechanism used for this channel.
1539 "id": "A String", # A UUID or similar unique string that identifies this channel.
1540 }
1541
1542 acknowledgeAbuse: boolean, Whether the user is acknowledging the risk of downloading known malware or other abusive files. This is only applicable when alt=media.
1543
1544Returns:
1545 The media object as a string.
1546
1547 </pre>
1548</div>
1549
1550</body></html>