Jon Wayne Parrott | 36e41bc | 2016-02-19 16:02:29 -0800 | [diff] [blame] | 1 | <html><body> |
| 2 | <style> |
| 3 | |
| 4 | body, 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 | |
| 15 | body { |
| 16 | font-size: 13px; |
| 17 | padding: 1em; |
| 18 | } |
| 19 | |
| 20 | h1 { |
| 21 | font-size: 26px; |
| 22 | margin-bottom: 1em; |
| 23 | } |
| 24 | |
| 25 | h2 { |
| 26 | font-size: 24px; |
| 27 | margin-bottom: 1em; |
| 28 | } |
| 29 | |
| 30 | h3 { |
| 31 | font-size: 20px; |
| 32 | margin-bottom: 1em; |
| 33 | margin-top: 1em; |
| 34 | } |
| 35 | |
| 36 | pre, code { |
| 37 | line-height: 1.5; |
| 38 | font-family: Monaco, 'DejaVu Sans Mono', 'Bitstream Vera Sans Mono', 'Lucida Console', monospace; |
| 39 | } |
| 40 | |
| 41 | pre { |
| 42 | margin-top: 0.5em; |
| 43 | } |
| 44 | |
| 45 | h1, h2, h3, p { |
| 46 | font-family: Arial, sans serif; |
| 47 | } |
| 48 | |
| 49 | h1, 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.revisions.html">revisions</a></h1> |
| 76 | <h2>Instance Methods</h2> |
| 77 | <p class="toc_element"> |
Dmitry Frenkel | 3e17f89 | 2020-10-06 16:46:05 -0700 | [diff] [blame] | 78 | <code><a href="#close">close()</a></code></p> |
| 79 | <p class="firstline">Close httplib2 connections.</p> |
| 80 | <p class="toc_element"> |
Jon Wayne Parrott | 36e41bc | 2016-02-19 16:02:29 -0800 | [diff] [blame] | 81 | <code><a href="#delete">delete(fileId, revisionId)</a></code></p> |
Bu Sun Kim | 715bd7f | 2019-06-14 16:50:42 -0700 | [diff] [blame] | 82 | <p class="firstline">Permanently deletes a file version. You can only delete revisions for files with binary content in Google Drive, like images or videos. Revisions for other files, like Google Docs or Sheets, and the last remaining file version can't be deleted.</p> |
Jon Wayne Parrott | 36e41bc | 2016-02-19 16:02:29 -0800 | [diff] [blame] | 83 | <p class="toc_element"> |
| 84 | <code><a href="#get">get(fileId, revisionId, acknowledgeAbuse=None)</a></code></p> |
| 85 | <p class="firstline">Gets a revision's metadata or content by ID.</p> |
| 86 | <p class="toc_element"> |
| 87 | <code><a href="#get_media">get_media(fileId, revisionId, acknowledgeAbuse=None)</a></code></p> |
| 88 | <p class="firstline">Gets a revision's metadata or content by ID.</p> |
| 89 | <p class="toc_element"> |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 90 | <code><a href="#list">list(fileId, pageSize=None, pageToken=None)</a></code></p> |
Jon Wayne Parrott | 36e41bc | 2016-02-19 16:02:29 -0800 | [diff] [blame] | 91 | <p class="firstline">Lists a file's revisions.</p> |
| 92 | <p class="toc_element"> |
Sai Cheemalapati | ea3a5e1 | 2016-10-12 14:05:53 -0700 | [diff] [blame] | 93 | <code><a href="#list_next">list_next(previous_request, previous_response)</a></code></p> |
| 94 | <p class="firstline">Retrieves the next page of results.</p> |
| 95 | <p class="toc_element"> |
Dan O'Meara | dd49464 | 2020-05-01 07:42:23 -0700 | [diff] [blame] | 96 | <code><a href="#update">update(fileId, revisionId, body=None)</a></code></p> |
Jon Wayne Parrott | 36e41bc | 2016-02-19 16:02:29 -0800 | [diff] [blame] | 97 | <p class="firstline">Updates a revision with patch semantics.</p> |
| 98 | <h3>Method Details</h3> |
| 99 | <div class="method"> |
Dmitry Frenkel | 3e17f89 | 2020-10-06 16:46:05 -0700 | [diff] [blame] | 100 | <code class="details" id="close">close()</code> |
| 101 | <pre>Close httplib2 connections.</pre> |
| 102 | </div> |
| 103 | |
| 104 | <div class="method"> |
Jon Wayne Parrott | 36e41bc | 2016-02-19 16:02:29 -0800 | [diff] [blame] | 105 | <code class="details" id="delete">delete(fileId, revisionId)</code> |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 106 | <pre>Permanently deletes a file version. You can only delete revisions for files with binary content in Google Drive, like images or videos. Revisions for other files, like Google Docs or Sheets, and the last remaining file version can't be deleted. |
Jon Wayne Parrott | 36e41bc | 2016-02-19 16:02:29 -0800 | [diff] [blame] | 107 | |
| 108 | Args: |
| 109 | fileId: string, The ID of the file. (required) |
| 110 | revisionId: string, The ID of the revision. (required) |
| 111 | </pre> |
| 112 | </div> |
| 113 | |
| 114 | <div class="method"> |
| 115 | <code class="details" id="get">get(fileId, revisionId, acknowledgeAbuse=None)</code> |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 116 | <pre>Gets a revision's metadata or content by ID. |
Jon Wayne Parrott | 36e41bc | 2016-02-19 16:02:29 -0800 | [diff] [blame] | 117 | |
| 118 | Args: |
| 119 | fileId: string, The ID of the file. (required) |
| 120 | revisionId: string, The ID of the revision. (required) |
| 121 | acknowledgeAbuse: boolean, Whether the user is acknowledging the risk of downloading known malware or other abusive files. This is only applicable when alt=media. |
| 122 | |
| 123 | Returns: |
| 124 | An object of the form: |
| 125 | |
| 126 | { # The metadata for a revision to a file. |
Yoshi Automation Bot | cc94ec8 | 2021-01-15 07:10:04 -0800 | [diff] [blame] | 127 | "exportLinks": { # Links for exporting Docs Editors files to specific formats. |
| 128 | "a_key": "A String", # A mapping from export format to URL |
| 129 | }, |
| 130 | "id": "A String", # The ID of the revision. |
| 131 | "keepForever": True or False, # Whether to keep this revision forever, even if it is no longer the head revision. If not set, the revision will be automatically purged 30 days after newer content is uploaded. This can be set on a maximum of 200 revisions for a file. |
| 132 | # This field is only applicable to files with binary content in Drive. |
| 133 | "kind": "drive#revision", # Identifies what kind of resource this is. Value: the fixed string "drive#revision". |
| 134 | "lastModifyingUser": { # Information about a Drive user. # The last user to modify this revision. |
| 135 | "displayName": "A String", # A plain text displayable name for this user. |
| 136 | "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. |
| 137 | "kind": "drive#user", # Identifies what kind of resource this is. Value: the fixed string "drive#user". |
| 138 | "me": True or False, # Whether this user is the requesting user. |
| 139 | "permissionId": "A String", # The user's ID as visible in Permission resources. |
| 140 | "photoLink": "A String", # A link to the user's profile photo, if available. |
| 141 | }, |
| 142 | "md5Checksum": "A String", # The MD5 checksum of the revision's content. This is only applicable to files with binary content in Drive. |
| 143 | "mimeType": "A String", # The MIME type of the revision. |
| 144 | "modifiedTime": "A String", # The last time the revision was modified (RFC 3339 date-time). |
| 145 | "originalFilename": "A String", # The original filename used to create this revision. This is only applicable to files with binary content in Drive. |
| 146 | "publishAuto": True or False, # Whether subsequent revisions will be automatically republished. This is only applicable to Docs Editors files. |
| 147 | "published": True or False, # Whether this revision is published. This is only applicable to Docs Editors files. |
| 148 | "publishedLink": "A String", # A link to the published revision. This is only populated for Google Sites files. |
| 149 | "publishedOutsideDomain": True or False, # Whether this revision is published outside the domain. This is only applicable to Docs Editors files. |
| 150 | "size": "A String", # The size of the revision's content in bytes. This is only applicable to files with binary content in Drive. |
| 151 | }</pre> |
Jon Wayne Parrott | 36e41bc | 2016-02-19 16:02:29 -0800 | [diff] [blame] | 152 | </div> |
| 153 | |
| 154 | <div class="method"> |
| 155 | <code class="details" id="get_media">get_media(fileId, revisionId, acknowledgeAbuse=None)</code> |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 156 | <pre>Gets a revision's metadata or content by ID. |
Jon Wayne Parrott | 36e41bc | 2016-02-19 16:02:29 -0800 | [diff] [blame] | 157 | |
| 158 | Args: |
| 159 | fileId: string, The ID of the file. (required) |
| 160 | revisionId: string, The ID of the revision. (required) |
| 161 | acknowledgeAbuse: boolean, Whether the user is acknowledging the risk of downloading known malware or other abusive files. This is only applicable when alt=media. |
| 162 | |
| 163 | Returns: |
| 164 | The media object as a string. |
| 165 | |
| 166 | </pre> |
| 167 | </div> |
| 168 | |
| 169 | <div class="method"> |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 170 | <code class="details" id="list">list(fileId, pageSize=None, pageToken=None)</code> |
| 171 | <pre>Lists a file's revisions. |
Jon Wayne Parrott | 36e41bc | 2016-02-19 16:02:29 -0800 | [diff] [blame] | 172 | |
| 173 | Args: |
| 174 | fileId: string, The ID of the file. (required) |
Sai Cheemalapati | ea3a5e1 | 2016-10-12 14:05:53 -0700 | [diff] [blame] | 175 | pageSize: integer, The maximum number of revisions to return per page. |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 176 | 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. |
Jon Wayne Parrott | 36e41bc | 2016-02-19 16:02:29 -0800 | [diff] [blame] | 177 | |
| 178 | Returns: |
| 179 | An object of the form: |
| 180 | |
| 181 | { # A list of revisions of a file. |
Yoshi Automation Bot | cc94ec8 | 2021-01-15 07:10:04 -0800 | [diff] [blame] | 182 | "kind": "drive#revisionList", # Identifies what kind of resource this is. Value: the fixed string "drive#revisionList". |
| 183 | "nextPageToken": "A String", # The page token for the next page of revisions. This will be absent if the end of the revisions list has been reached. If the token is rejected for any reason, it should be discarded, and pagination should be restarted from the first page of results. |
| 184 | "revisions": [ # The list of revisions. If nextPageToken is populated, then this list may be incomplete and an additional page of results should be fetched. |
| 185 | { # The metadata for a revision to a file. |
| 186 | "exportLinks": { # Links for exporting Docs Editors files to specific formats. |
| 187 | "a_key": "A String", # A mapping from export format to URL |
Jon Wayne Parrott | 36e41bc | 2016-02-19 16:02:29 -0800 | [diff] [blame] | 188 | }, |
Yoshi Automation Bot | cc94ec8 | 2021-01-15 07:10:04 -0800 | [diff] [blame] | 189 | "id": "A String", # The ID of the revision. |
| 190 | "keepForever": True or False, # Whether to keep this revision forever, even if it is no longer the head revision. If not set, the revision will be automatically purged 30 days after newer content is uploaded. This can be set on a maximum of 200 revisions for a file. |
| 191 | # This field is only applicable to files with binary content in Drive. |
| 192 | "kind": "drive#revision", # Identifies what kind of resource this is. Value: the fixed string "drive#revision". |
| 193 | "lastModifyingUser": { # Information about a Drive user. # The last user to modify this revision. |
| 194 | "displayName": "A String", # A plain text displayable name for this user. |
| 195 | "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. |
| 196 | "kind": "drive#user", # Identifies what kind of resource this is. Value: the fixed string "drive#user". |
| 197 | "me": True or False, # Whether this user is the requesting user. |
| 198 | "permissionId": "A String", # The user's ID as visible in Permission resources. |
| 199 | "photoLink": "A String", # A link to the user's profile photo, if available. |
| 200 | }, |
| 201 | "md5Checksum": "A String", # The MD5 checksum of the revision's content. This is only applicable to files with binary content in Drive. |
| 202 | "mimeType": "A String", # The MIME type of the revision. |
| 203 | "modifiedTime": "A String", # The last time the revision was modified (RFC 3339 date-time). |
| 204 | "originalFilename": "A String", # The original filename used to create this revision. This is only applicable to files with binary content in Drive. |
| 205 | "publishAuto": True or False, # Whether subsequent revisions will be automatically republished. This is only applicable to Docs Editors files. |
| 206 | "published": True or False, # Whether this revision is published. This is only applicable to Docs Editors files. |
| 207 | "publishedLink": "A String", # A link to the published revision. This is only populated for Google Sites files. |
| 208 | "publishedOutsideDomain": True or False, # Whether this revision is published outside the domain. This is only applicable to Docs Editors files. |
| 209 | "size": "A String", # The size of the revision's content in bytes. This is only applicable to files with binary content in Drive. |
| 210 | }, |
| 211 | ], |
| 212 | }</pre> |
Jon Wayne Parrott | 36e41bc | 2016-02-19 16:02:29 -0800 | [diff] [blame] | 213 | </div> |
| 214 | |
| 215 | <div class="method"> |
Sai Cheemalapati | ea3a5e1 | 2016-10-12 14:05:53 -0700 | [diff] [blame] | 216 | <code class="details" id="list_next">list_next(previous_request, previous_response)</code> |
| 217 | <pre>Retrieves the next page of results. |
| 218 | |
| 219 | Args: |
| 220 | previous_request: The request for the previous page. (required) |
| 221 | previous_response: The response from the request for the previous page. (required) |
| 222 | |
| 223 | Returns: |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 224 | A request object that you can call 'execute()' on to request the next |
Sai Cheemalapati | ea3a5e1 | 2016-10-12 14:05:53 -0700 | [diff] [blame] | 225 | page. Returns None if there are no more items in the collection. |
| 226 | </pre> |
| 227 | </div> |
| 228 | |
| 229 | <div class="method"> |
Dan O'Meara | dd49464 | 2020-05-01 07:42:23 -0700 | [diff] [blame] | 230 | <code class="details" id="update">update(fileId, revisionId, body=None)</code> |
Jon Wayne Parrott | 36e41bc | 2016-02-19 16:02:29 -0800 | [diff] [blame] | 231 | <pre>Updates a revision with patch semantics. |
| 232 | |
| 233 | Args: |
| 234 | fileId: string, The ID of the file. (required) |
| 235 | revisionId: string, The ID of the revision. (required) |
Dan O'Meara | dd49464 | 2020-05-01 07:42:23 -0700 | [diff] [blame] | 236 | body: object, The request body. |
Jon Wayne Parrott | 36e41bc | 2016-02-19 16:02:29 -0800 | [diff] [blame] | 237 | The object takes the form of: |
| 238 | |
| 239 | { # The metadata for a revision to a file. |
Bu Sun Kim | 673ec5c | 2020-11-16 11:05:03 -0700 | [diff] [blame] | 240 | "exportLinks": { # Links for exporting Docs Editors files to specific formats. |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 241 | "a_key": "A String", # A mapping from export format to URL |
Jon Wayne Parrott | 36e41bc | 2016-02-19 16:02:29 -0800 | [diff] [blame] | 242 | }, |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 243 | "id": "A String", # The ID of the revision. |
| 244 | "keepForever": True or False, # Whether to keep this revision forever, even if it is no longer the head revision. If not set, the revision will be automatically purged 30 days after newer content is uploaded. This can be set on a maximum of 200 revisions for a file. |
Jon Wayne Parrott | 36e41bc | 2016-02-19 16:02:29 -0800 | [diff] [blame] | 245 | # This field is only applicable to files with binary content in Drive. |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 246 | "kind": "drive#revision", # Identifies what kind of resource this is. Value: the fixed string "drive#revision". |
| 247 | "lastModifyingUser": { # Information about a Drive user. # The last user to modify this revision. |
| 248 | "displayName": "A String", # A plain text displayable name for this user. |
| 249 | "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. |
| 250 | "kind": "drive#user", # Identifies what kind of resource this is. Value: the fixed string "drive#user". |
| 251 | "me": True or False, # Whether this user is the requesting user. |
| 252 | "permissionId": "A String", # The user's ID as visible in Permission resources. |
| 253 | "photoLink": "A String", # A link to the user's profile photo, if available. |
Bu Sun Kim | 715bd7f | 2019-06-14 16:50:42 -0700 | [diff] [blame] | 254 | }, |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 255 | "md5Checksum": "A String", # The MD5 checksum of the revision's content. This is only applicable to files with binary content in Drive. |
| 256 | "mimeType": "A String", # The MIME type of the revision. |
| 257 | "modifiedTime": "A String", # The last time the revision was modified (RFC 3339 date-time). |
| 258 | "originalFilename": "A String", # The original filename used to create this revision. This is only applicable to files with binary content in Drive. |
Bu Sun Kim | 673ec5c | 2020-11-16 11:05:03 -0700 | [diff] [blame] | 259 | "publishAuto": True or False, # Whether subsequent revisions will be automatically republished. This is only applicable to Docs Editors files. |
| 260 | "published": True or False, # Whether this revision is published. This is only applicable to Docs Editors files. |
| 261 | "publishedLink": "A String", # A link to the published revision. This is only populated for Google Sites files. |
| 262 | "publishedOutsideDomain": True or False, # Whether this revision is published outside the domain. This is only applicable to Docs Editors files. |
Bu Sun Kim | 6502091 | 2020-05-20 12:08:20 -0700 | [diff] [blame] | 263 | "size": "A String", # The size of the revision's content in bytes. This is only applicable to files with binary content in Drive. |
Jon Wayne Parrott | 36e41bc | 2016-02-19 16:02:29 -0800 | [diff] [blame] | 264 | } |
| 265 | |
| 266 | |
| 267 | Returns: |
| 268 | An object of the form: |
| 269 | |
| 270 | { # The metadata for a revision to a file. |
Yoshi Automation Bot | cc94ec8 | 2021-01-15 07:10:04 -0800 | [diff] [blame] | 271 | "exportLinks": { # Links for exporting Docs Editors files to specific formats. |
| 272 | "a_key": "A String", # A mapping from export format to URL |
| 273 | }, |
| 274 | "id": "A String", # The ID of the revision. |
| 275 | "keepForever": True or False, # Whether to keep this revision forever, even if it is no longer the head revision. If not set, the revision will be automatically purged 30 days after newer content is uploaded. This can be set on a maximum of 200 revisions for a file. |
| 276 | # This field is only applicable to files with binary content in Drive. |
| 277 | "kind": "drive#revision", # Identifies what kind of resource this is. Value: the fixed string "drive#revision". |
| 278 | "lastModifyingUser": { # Information about a Drive user. # The last user to modify this revision. |
| 279 | "displayName": "A String", # A plain text displayable name for this user. |
| 280 | "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. |
| 281 | "kind": "drive#user", # Identifies what kind of resource this is. Value: the fixed string "drive#user". |
| 282 | "me": True or False, # Whether this user is the requesting user. |
| 283 | "permissionId": "A String", # The user's ID as visible in Permission resources. |
| 284 | "photoLink": "A String", # A link to the user's profile photo, if available. |
| 285 | }, |
| 286 | "md5Checksum": "A String", # The MD5 checksum of the revision's content. This is only applicable to files with binary content in Drive. |
| 287 | "mimeType": "A String", # The MIME type of the revision. |
| 288 | "modifiedTime": "A String", # The last time the revision was modified (RFC 3339 date-time). |
| 289 | "originalFilename": "A String", # The original filename used to create this revision. This is only applicable to files with binary content in Drive. |
| 290 | "publishAuto": True or False, # Whether subsequent revisions will be automatically republished. This is only applicable to Docs Editors files. |
| 291 | "published": True or False, # Whether this revision is published. This is only applicable to Docs Editors files. |
| 292 | "publishedLink": "A String", # A link to the published revision. This is only populated for Google Sites files. |
| 293 | "publishedOutsideDomain": True or False, # Whether this revision is published outside the domain. This is only applicable to Docs Editors files. |
| 294 | "size": "A String", # The size of the revision's content in bytes. This is only applicable to files with binary content in Drive. |
| 295 | }</pre> |
Jon Wayne Parrott | 36e41bc | 2016-02-19 16:02:29 -0800 | [diff] [blame] | 296 | </div> |
| 297 | |
| 298 | </body></html> |