pub struct Revisions { /* private fields */ }Expand description
The metadata for a revision to a file.
Some resource methods (such as revisions.update)
require a permission_id. Use the revisions.list
method to retrieve the ID for a file, folder, or shared drive.
§Examples:
List the revisions in a file
let file_id = "some-file-id";
let revision_list = drive.revisions.list(&file_id)
.execute()?;
if let Some(revisions) = revision_list.revisions {
for revision in revisions {
println!("{}", revision);
}
}Implementations§
Source§impl Revisions
impl Revisions
Sourcepub fn new(credentials: &Credentials) -> Self
pub fn new(credentials: &Credentials) -> Self
Creates a new Revisions resource with the given Credentials.
Sourcepub fn delete<T, U>(&self, file_id: T, revision_id: U) -> DeleteRequest
pub fn delete<T, U>(&self, file_id: T, revision_id: U) -> DeleteRequest
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.
See Google’s documentation for more information.
§Requires one of the following OAuth scopes:
https://www.googleapis.com/auth/drivehttps://www.googleapis.com/auth/drive.appdatahttps://www.googleapis.com/auth/drive.file
§Examples:
let file_id = "some-file-id";
let revision_id = "some-revision-id";
let response = drive.revisions.delete(&file_id, &revision_id).execute();
assert!( response.is_ok() );Sourcepub fn get<T, U>(&self, file_id: T, revision_id: U) -> GetRequest
pub fn get<T, U>(&self, file_id: T, revision_id: U) -> GetRequest
Gets a revision’s metadata by ID.
See Google’s documentation for more information.
§Requires one of the following OAuth scopes:
https://www.googleapis.com/auth/drivehttps://www.googleapis.com/auth/drive.appdatahttps://www.googleapis.com/auth/drive.filehttps://www.googleapis.com/auth/drive.metadatahttps://www.googleapis.com/auth/drive.metadata.readonlyhttps://www.googleapis.com/auth/drive.photos.readonlyhttps://www.googleapis.com/auth/drive.readonly
§Examples:
let file_id = "some-file-id";
let revision_id = "some-revision-id";
let revision = drive.revisions.get(&file_id, &revision_id)
.fields("*")
.execute()?;
println!("This is the file's revision metadata:\n{}", revision);Sourcepub fn get_media<T, U>(&self, file_id: T, revision_id: U) -> GetMediaRequest
pub fn get_media<T, U>(&self, file_id: T, revision_id: U) -> GetMediaRequest
Gets a revision’s content by ID.
See Google’s documentation for more information.
§Requires one of the following OAuth scopes:
https://www.googleapis.com/auth/drivehttps://www.googleapis.com/auth/drive.appdatahttps://www.googleapis.com/auth/drive.filehttps://www.googleapis.com/auth/drive.metadatahttps://www.googleapis.com/auth/drive.metadata.readonlyhttps://www.googleapis.com/auth/drive.photos.readonlyhttps://www.googleapis.com/auth/drive.readonly
§Examples:
let file_id = "some-file-id";
let revision_id = "some-revision-id";
let file_bytes = drive.revisions.get_media(&file_id, &revision_id)
// .save_to("my_downloaded_file.txt") // Save the contents to a path
.execute()?;
let content = String::from_utf8_lossy(&file_bytes);
println!("content: {}", content);Sourcepub fn list<T: AsRef<str>>(&self, file_id: T) -> ListRequest
pub fn list<T: AsRef<str>>(&self, file_id: T) -> ListRequest
Lists a file’s revisions.
See Google’s documentation for more information.
§Requires one of the following OAuth scopes:
https://www.googleapis.com/auth/drivehttps://www.googleapis.com/auth/drive.appdatahttps://www.googleapis.com/auth/drive.filehttps://www.googleapis.com/auth/drive.metadatahttps://www.googleapis.com/auth/drive.metadata.readonlyhttps://www.googleapis.com/auth/drive.photos.readonlyhttps://www.googleapis.com/auth/drive.readonly
§Examples:
let file_id = "some-file-id";
let revision_list = drive.revisions.list(&file_id)
.execute()?;
if let Some(revisions) = revision_list.revisions {
for revision in revisions {
println!("{}", revision);
}
}Sourcepub fn update<T, U>(&self, file_id: T, revision_id: U) -> UpdateRequest
pub fn update<T, U>(&self, file_id: T, revision_id: U) -> UpdateRequest
Updates a reply with patch semantics.
See Google’s documentation for more information.
§Note:
This request requires you to set the fields
parameter.
§Requires one of the following OAuth scopes:
https://www.googleapis.com/auth/drivehttps://www.googleapis.com/auth/drive.file
§Examples:
use drive_v3::objects::Revision;
let updated_revision = Revision {
published: Some(false),
..Default::default()
};
let file_id = "some-file-id";
let revision_id = "some-revision-id";
let revision = drive.revisions.update(&file_id, &revision_id)
.fields("*")
.revision(&updated_revision)
.execute()?;
assert_eq!(revision.published, updated_revision.published);Trait Implementations§
impl Eq for Revisions
impl StructuralPartialEq for Revisions
Auto Trait Implementations§
impl Freeze for Revisions
impl RefUnwindSafe for Revisions
impl Send for Revisions
impl Sync for Revisions
impl Unpin for Revisions
impl UnwindSafe for Revisions
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.