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