目录

class info
public class Drive.Comments.Create extends DriveRequest<Comment>
Drive.Comments.Create class.

Protected Constructor Summary

Constructor name

Drive.Comments.Create (String fileId, Comment content)

Constructor for the Drive Comments.Create class.

Public Method Summary

Return typeMethod name
String

getFileId()

Obtains a file ID.

Drive.Comments.Create

set(String parameterName, Object value)

Sets the given parameter value for the given parameter name.

Drive.Comments.Create

setForm(String form)

Sets the response data format.

Drive.Comments.Create

setFields(String fields)

Sets the fields to be contained in a response.

Drive.Comments.Create

setFileId(String fileId)

Sets a file ID.

Drive.Comments.Create

setPrettyPrint(Boolean prettyPrint)

Sets whether to return a response containing indentations and line-wrapping breaks.

Drive.Comments.Create

setQuotaId(String quotaId)

Sets a string of less than 40 characters to identify a user. The string is used by the server to restrict the user’s API calls.

Comment

execute()

Sends an HTTP request and returns the object to be converted.

Protected Constructors

constructor
protected Drive.Comments.Create (String fileId, Comment content)
Constructs a Drive.Comments.Create object.

Parameters

Parameter nameParameter desc
fileIdFile ID.
contentComments object.

Public Methods

Method
public String getFileId()
Obtains a file ID.

Return

typedesc
StringFile ID.
Method


public Drive.Comments.Create set(String parameterName, Object value)

Sets the given parameter value for the given parameter name.

Parameters

Parameter nameParameter desc
parameterNameParameter name.
valueParameter value.

Return

typedesc
Drive.Comments.CreateA Drive.Comments.Create object.
Method


public Drive.Comments.Create setForm(String form)

Sets the response data format.

Parameters

Parameter nameParameter desc
formResponse data format. The default data format is JSON, and only this format is supported currently.

Return

typedesc
Drive.Comments.CreateA Drive.Comments.Create object.
Method


public Drive.Comments.Create setFields(String fields)

Sets the fields to be contained in a response.

Parameters

Parameter nameParameter desc
fieldsFields to be contained in a response. An asterisk (*) can be used to match all related fields.

Return

typedesc
Drive.Comments.CreateA Drive.Comments.Create object.
Method


public Drive.Comments.Create setFileId(String fileId)

Sets a file ID.

Parameters

Parameter nameParameter desc
fileIdFile ID.

Return

typedesc
Drive.Comments.CreateA Drive.Comments.Create object.
Method


public Drive.Comments.Create setPrettyPrint(Boolean prettyPrint)

Sets whether to return a response containing indentations and line-wrapping breaks.

Parameters

Parameter nameParameter desc
prettyPrintIndicates whether to return a response containing indentations and line-wrapping breaks. The value is a Boolean value.

Return

typedesc
Drive.Comments.CreateA Drive.Comments.Create object.
Method


public Drive.Comments.Create setQuotaId(String quotaId)

Sets a string of less than 40 characters to identify a user. The string is used by the server to restrict the user’s API calls.

Parameters

Parameter nameParameter desc
quotaIdA string of less than 40 characters to identify a user. The string is used by the server to restrict the user’s API calls.

Return

typedesc
Drive.Comments.CreateA Drive.Comments.Create object.

Method


public T execute() throws IOException

Sends an HTTP request and returns the object to be converted.

Throws

Parameter nameParameter desc
java.io.IOExceptionI/O exception thrown upon an API call failure. You can use the getMessage() method to obtain the error description.

Return

typedesc
CommentThe Drive.Comments.Create class extends DriveRequest<Comment>. Therefore, the return result of the execute() method is encapsulated as a Comment object.


Sample Code

  1. private void createComments(Drive drive, File file){
  2.      try{
  3.           Comment comment = new Comment();
  4.           comment.setDescription("interface test");
  5.           Comment mComment = drive.comments().create(file.getId(), comment).execute();
  6.        } catch (Exception e){
  7.            Log.e(TAG, "createComments error: " + e.toString());
  8.        }
  9. }