pub struct Comments { /* private fields */ }Expand description
Comments on a file.
Some resource methods (such as comments.update)
require a comment_id. Use the comments.list method
to retrieve the ID for a comment in a file.
§Examples:
List the comments in a file
let file_id = "some-file-id";
let comment_list = drive.comments.list(&file_id)
.fields("*") // You must set the fields
.page_size(10)
.execute()?;
if let Some(comments) = comment_list.comments {
for comment in comments {
println!("{}", comment);
}
}Implementations§
Source§impl Comments
impl Comments
Sourcepub fn new(credentials: &Credentials) -> Self
pub fn new(credentials: &Credentials) -> Self
Creates a new Comments resource with the given Credentials.
Sourcepub fn create<T: AsRef<str>>(&self, file_id: T) -> CreateRequest
pub fn create<T: AsRef<str>>(&self, file_id: T) -> CreateRequest
Creates a comment on a file.
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.file
§Examples:
use drive_v3::objects::Comment;
let comment = Comment {
content: Some( "this is my comment".to_string() ),
..Default::default()
};
let file_id = "some-file-id";
let created_comment = drive.comments.create(&file_id)
.fields("*")
.comment(&comment)
.execute()?;
assert_eq!(created_comment.content, comment.content);Sourcepub fn delete<T, U>(&self, file_id: T, comment_id: U) -> DeleteRequest
pub fn delete<T, U>(&self, file_id: T, comment_id: U) -> DeleteRequest
Deletes a comment.
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.file
§Examples:
let file_id = "some-file-id";
let comment_id = "some-comment-id";
let response = drive.comments.delete(&file_id, &comment_id).execute();
assert!( response.is_ok() );Sourcepub fn get<T, U>(&self, file_id: T, comment_id: U) -> GetRequest
pub fn get<T, U>(&self, file_id: T, comment_id: U) -> GetRequest
Gets a comment by ID.
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.filehttps://www.googleapis.com/auth/drive.readonly
§Examples:
let file_id = "some-file-id";
let comment_id = "some-comment-id";
let created_comment = drive.comments.get(&file_id, &comment_id)
.fields("id, author, createdTime, content") // You must set the fields
.execute()?;
println!("This is the comment:\n{}", created_comment);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 comments.
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.filehttps://www.googleapis.com/auth/drive.readonly
§Examples:
let file_id = "some-file-id";
let comment_list = drive.comments.list(&file_id)
.fields("*") // You must set the fields
.page_size(10)
.execute()?;
if let Some(comments) = comment_list.comments {
for comment in comments {
println!("{}", comment);
}
}Sourcepub fn update<T, U>(&self, file_id: T, comment_id: U) -> UpdateRequest
pub fn update<T, U>(&self, file_id: T, comment_id: U) -> UpdateRequest
Updates a comment with patch semantics.
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.file
§Examples:
use drive_v3::objects::Comment;
let updated_comment = Comment {
content: Some( "this is the updated content of my comment".to_string() ),
..Default::default()
};
let file_id = "some-file-id";
let comment_id = "some-comment-id";
let modified_comment = drive.comments.update(&file_id, &comment_id)
.fields("*")
.comment(&updated_comment)
.execute()?;
assert_eq!(modified_comment.content, updated_comment.content);Trait Implementations§
impl Eq for Comments
impl StructuralPartialEq for Comments
Auto Trait Implementations§
impl Freeze for Comments
impl RefUnwindSafe for Comments
impl Send for Comments
impl Sync for Comments
impl Unpin for Comments
impl UnwindSafe for Comments
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
Mutably borrows from an owned value. Read more
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
Compare self to
key and return true if they are equal.