# Google Drive API . revisions

## Instance Methods

Close httplib2 connections.

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.

Gets a revision's metadata or content by ID.

Gets a revision's metadata or content by ID.

Lists a file's revisions.

Retrieves the next page of results.

Updates a revision with patch semantics.

### Method Details

`close()`

    Close httplib2 connections.

`delete(fileId, revisionId, x__xgafv=None)`

    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.

    Args:
      fileId: string, The ID of the file. (required)
      revisionId: string, The ID of the revision. (required)
      x__xgafv: string, V1 error format.
        Allowed values
          1 - v1 error format
          2 - v2 error format

`get(fileId, revisionId, acknowledgeAbuse=None, x__xgafv=None)`

    Gets a revision's metadata or content by ID.

    Args:
      fileId: string, The ID of the file. (required)
      revisionId: string, The ID of the revision. (required)
      acknowledgeAbuse: boolean, Whether the user is acknowledging the risk of downloading known malware or other abusive files. This is only applicable when the `alt` parameter is set to `media` and the user is the owner of the file or an organizer of the shared drive in which the file resides.
      x__xgafv: string, V1 error format.
        Allowed values
          1 - v1 error format
          2 - v2 error format

    Returns:
      An object of the form:

        { # The metadata for a revision to a file. Some resource methods (such as `revisions.update`) require a `revisionId`. Use the `revisions.list` method to retrieve the ID for a revision.
      "exportLinks": { # Output only. Links for exporting Docs Editors files to specific formats.
        "a_key": "A String",
      },
      "id": "A String", # Output only. The ID of the revision.
      "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. This field is only applicable to files with binary content in Drive.
      "kind": "drive#revision", # Output only. Identifies what kind of resource this is. Value: the fixed string `"drive#revision"`.
      "lastModifyingUser": { # Information about a Drive user. # Output only. The last user to modify this revision. This field is only populated when the last modification was performed by a signed-in user.
        "displayName": "A String", # Output only. A plain text displayable name for this user.
        "emailAddress": "A String", # Output only. 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.
        "kind": "drive#user", # Output only. Identifies what kind of resource this is. Value: the fixed string `"drive#user"`.
        "me": True or False, # Output only. Whether this user is the requesting user.
        "permissionId": "A String", # Output only. The user's ID as visible in Permission resources.
        "photoLink": "A String", # Output only. A link to the user's profile photo, if available.
      },
      "md5Checksum": "A String", # Output only. The MD5 checksum of the revision's content. This is only applicable to files with binary content in Drive.
      "mimeType": "A String", # Output only. The MIME type of the revision.
      "modifiedTime": "A String", # The last time the revision was modified (RFC 3339 date-time).
      "originalFilename": "A String", # Output only. The original filename used to create this revision. This is only applicable to files with binary content in Drive.
      "publishAuto": True or False, # Whether subsequent revisions will be automatically republished. This is only applicable to Docs Editors files.
      "published": True or False, # Whether this revision is published. This is only applicable to Docs Editors files.
      "publishedLink": "A String", # Output only. A link to the published revision. This is only populated for Docs Editors files.
      "publishedOutsideDomain": True or False, # Whether this revision is published outside the domain. This is only applicable to Docs Editors files.
      "size": "A String", # Output only. The size of the revision's content in bytes. This is only applicable to files with binary content in Drive.
    }

`get_media(fileId, revisionId, acknowledgeAbuse=None, x__xgafv=None)`

    Gets a revision's metadata or content by ID.

    Args:
      fileId: string, The ID of the file. (required)
      revisionId: string, The ID of the revision. (required)
      acknowledgeAbuse: boolean, Whether the user is acknowledging the risk of downloading known malware or other abusive files. This is only applicable when the `alt` parameter is set to `media` and the user is the owner of the file or an organizer of the shared drive in which the file resides.
      x__xgafv: string, V1 error format.
        Allowed values
          1 - v1 error format
          2 - v2 error format

    Returns:
      The media object as a string.

`list(fileId, pageSize=None, pageToken=None, x__xgafv=None)`

    Lists a file's revisions.

    Args:
      fileId: string, The ID of the file. (required)
      pageSize: integer, The maximum number of revisions to return per page.
      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.
      x__xgafv: string, V1 error format.
        Allowed values
          1 - v1 error format
          2 - v2 error format

    Returns:
      An object of the form:

        { # A list of revisions of a file.
      "kind": "drive#revisionList", # Identifies what kind of resource this is. Value: the fixed string `"drive#revisionList"`.
      "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. The page token is typically valid for several hours. However, if new items are added or removed, your expected results might differ.
      "revisions": [ # The list of revisions. If nextPageToken is populated, then this list may be incomplete and an additional page of results should be fetched.
        { # The metadata for a revision to a file. Some resource methods (such as `revisions.update`) require a `revisionId`. Use the `revisions.list` method to retrieve the ID for a revision.
          "exportLinks": { # Output only. Links for exporting Docs Editors files to specific formats.
            "a_key": "A String",
          },
          "id": "A String", # Output only. The ID of the revision.
          "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. This field is only applicable to files with binary content in Drive.
          "kind": "drive#revision", # Output only. Identifies what kind of resource this is. Value: the fixed string `"drive#revision"`.
          "lastModifyingUser": { # Information about a Drive user. # Output only. The last user to modify this revision. This field is only populated when the last modification was performed by a signed-in user.
            "displayName": "A String", # Output only. A plain text displayable name for this user.
            "emailAddress": "A String", # Output only. 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.
            "kind": "drive#user", # Output only. Identifies what kind of resource this is. Value: the fixed string `"drive#user"`.
            "me": True or False, # Output only. Whether this user is the requesting user.
            "permissionId": "A String", # Output only. The user's ID as visible in Permission resources.
            "photoLink": "A String", # Output only. A link to the user's profile photo, if available.
          },
          "md5Checksum": "A String", # Output only. The MD5 checksum of the revision's content. This is only applicable to files with binary content in Drive.
          "mimeType": "A String", # Output only. The MIME type of the revision.
          "modifiedTime": "A String", # The last time the revision was modified (RFC 3339 date-time).
          "originalFilename": "A String", # Output only. The original filename used to create this revision. This is only applicable to files with binary content in Drive.
          "publishAuto": True or False, # Whether subsequent revisions will be automatically republished. This is only applicable to Docs Editors files.
          "published": True or False, # Whether this revision is published. This is only applicable to Docs Editors files.
          "publishedLink": "A String", # Output only. A link to the published revision. This is only populated for Docs Editors files.
          "publishedOutsideDomain": True or False, # Whether this revision is published outside the domain. This is only applicable to Docs Editors files.
          "size": "A String", # Output only. The size of the revision's content in bytes. This is only applicable to files with binary content in Drive.
        },
      ],
    }

`list_next()`

    Retrieves the next page of results.

            Args:
              previous_request: The request for the previous page. (required)
              previous_response: The response from the request for the previous page. (required)

            Returns:
              A request object that you can call 'execute()' on to request the next
              page. Returns None if there are no more items in the collection.

`update(fileId, revisionId, body=None, x__xgafv=None)`

    Updates a revision with patch semantics.

    Args:
      fileId: string, The ID of the file. (required)
      revisionId: string, The ID of the revision. (required)
      body: object, The request body.
        The object takes the form of:

    { # The metadata for a revision to a file. Some resource methods (such as `revisions.update`) require a `revisionId`. Use the `revisions.list` method to retrieve the ID for a revision.
      "exportLinks": { # Output only. Links for exporting Docs Editors files to specific formats.
        "a_key": "A String",
      },
      "id": "A String", # Output only. The ID of the revision.
      "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. This field is only applicable to files with binary content in Drive.
      "kind": "drive#revision", # Output only. Identifies what kind of resource this is. Value: the fixed string `"drive#revision"`.
      "lastModifyingUser": { # Information about a Drive user. # Output only. The last user to modify this revision. This field is only populated when the last modification was performed by a signed-in user.
        "displayName": "A String", # Output only. A plain text displayable name for this user.
        "emailAddress": "A String", # Output only. 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.
        "kind": "drive#user", # Output only. Identifies what kind of resource this is. Value: the fixed string `"drive#user"`.
        "me": True or False, # Output only. Whether this user is the requesting user.
        "permissionId": "A String", # Output only. The user's ID as visible in Permission resources.
        "photoLink": "A String", # Output only. A link to the user's profile photo, if available.
      },
      "md5Checksum": "A String", # Output only. The MD5 checksum of the revision's content. This is only applicable to files with binary content in Drive.
      "mimeType": "A String", # Output only. The MIME type of the revision.
      "modifiedTime": "A String", # The last time the revision was modified (RFC 3339 date-time).
      "originalFilename": "A String", # Output only. The original filename used to create this revision. This is only applicable to files with binary content in Drive.
      "publishAuto": True or False, # Whether subsequent revisions will be automatically republished. This is only applicable to Docs Editors files.
      "published": True or False, # Whether this revision is published. This is only applicable to Docs Editors files.
      "publishedLink": "A String", # Output only. A link to the published revision. This is only populated for Docs Editors files.
      "publishedOutsideDomain": True or False, # Whether this revision is published outside the domain. This is only applicable to Docs Editors files.
      "size": "A String", # Output only. The size of the revision's content in bytes. This is only applicable to files with binary content in Drive.
    }

      x__xgafv: string, V1 error format.
        Allowed values
          1 - v1 error format
          2 - v2 error format

    Returns:
      An object of the form:

        { # The metadata for a revision to a file. Some resource methods (such as `revisions.update`) require a `revisionId`. Use the `revisions.list` method to retrieve the ID for a revision.
      "exportLinks": { # Output only. Links for exporting Docs Editors files to specific formats.
        "a_key": "A String",
      },
      "id": "A String", # Output only. The ID of the revision.
      "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. This field is only applicable to files with binary content in Drive.
      "kind": "drive#revision", # Output only. Identifies what kind of resource this is. Value: the fixed string `"drive#revision"`.
      "lastModifyingUser": { # Information about a Drive user. # Output only. The last user to modify this revision. This field is only populated when the last modification was performed by a signed-in user.
        "displayName": "A String", # Output only. A plain text displayable name for this user.
        "emailAddress": "A String", # Output only. 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.
        "kind": "drive#user", # Output only. Identifies what kind of resource this is. Value: the fixed string `"drive#user"`.
        "me": True or False, # Output only. Whether this user is the requesting user.
        "permissionId": "A String", # Output only. The user's ID as visible in Permission resources.
        "photoLink": "A String", # Output only. A link to the user's profile photo, if available.
      },
      "md5Checksum": "A String", # Output only. The MD5 checksum of the revision's content. This is only applicable to files with binary content in Drive.
      "mimeType": "A String", # Output only. The MIME type of the revision.
      "modifiedTime": "A String", # The last time the revision was modified (RFC 3339 date-time).
      "originalFilename": "A String", # Output only. The original filename used to create this revision. This is only applicable to files with binary content in Drive.
      "publishAuto": True or False, # Whether subsequent revisions will be automatically republished. This is only applicable to Docs Editors files.
      "published": True or False, # Whether this revision is published. This is only applicable to Docs Editors files.
      "publishedLink": "A String", # Output only. A link to the published revision. This is only populated for Docs Editors files.
      "publishedOutsideDomain": True or False, # Whether this revision is published outside the domain. This is only applicable to Docs Editors files.
      "size": "A String", # Output only. The size of the revision's content in bytes. This is only applicable to files with binary content in Drive.
    }