目录

Drive.Comments.List

Class Info

public class Drive.Comments.List extends DriveRequest<CommentList>

Drive.Comments.List类结构。

Protected Constructor Summary

Constructor Name

Drive.Comments.List(String fileId)

Drive.Comments.List构造方法。

Public Method Summary

Qualifier and Type

Method Name and Description

String

getFileId()

获取文件ID。

Boolean

getIncludeDeleted()

获取是否返回删除的评论。

Integer

getPageSize()

获取分页查询的大小。

String

getCursor()

获取分页查询的起始游标。

String

getStartEditedTime()

获取评论的最早修改时间。

boolean

isIncludeDeleted()

获取是否返回删除的评论。

Drive.Comments.List

set(String parameterName, Object value)

设置其他参数名称和参数值。

Drive.Comments.List

setForm(String form)

设置响应的数据格式。

Drive.Comments.List

setFields(String fields)

设置希望在响应中包含的字段。说明:fields填*时,drive#comments 结构中replies不返回。

Drive.Comments.List

setFileId(String fileId)

设置文件ID。

Drive.Comments.List

setIncludeDeleted(Boolean includeDeleted)

设置是否返回删除的评论。

Drive.Comments.List

setPageSize(Integer pageSize)

设置分页查询的大小。

Drive.Comments.List

setCursor(String cursor)

设置分页查询的起始游标。

Drive.Comments.List

setPrettyPrint(Boolean prettyPrint)

设置返回带有缩进和换行符的响应(格式化,便于阅读打印)。

Drive.Comments.List

setQuotaId(String quotaId)

设置一个不超过40字符的字符串,用于代表用户,主要用于服务端基于用户限制单个用户的API访问数量,用做API访问量配额控制。

Drive.Comments.List

setStartEditedTime(String startEditedTime)

设置评论的最早修改时间。

CommentList

execute()

发送HTTP请求,返回要转换的对象。

Protected Constructors

[h2]Drive.Comments.List

Constructor

protected Drive.Comments.List(String fileId)

Drive.Comments.List构造方法。

Public Methods

[h2]getFileId

Method

public String getFileId()

获取文件ID。

Returns

Type

Description

String

文件ID。

[h2]getIncludeDeleted

Method

public Boolean getIncludeDeleted()

获取是否返回删除的评论。

Returns

Type

Description

Boolean

是否返回删除的评论。

[h2]getPageSize

Method

public Integer getPageSize()

获取分页查询的大小。

Returns

Type

Description

Integer

每次分页查询请求返回的评论数量,可接受值1-100。若不设置pageSize或者设置的pageSize超过当前服务器设置的最大值,则默认值为当前服务器设置的最大值。

[h2]getCursor

Method

public String getCursor()

获取分页查询的起始游标。

Returns

Type

Description

String

cursor,即分页游标。

[h2]getStartEditedTime

Method

public String getStartEditedTime()

获取评论的最早修改时间。

Returns

Type

Description

String

评论的最早修改时间。

[h2]isIncludeDeleted

Method

public boolean isIncludeDeleted()

获取是否返回删除的评论。

Returns

Type

Description

boolean

是否返回删除的评论。

[h2]set

Method

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

设置其他参数名称和参数值。

Parameters

Name

Description

parameterName

参数名称。

value

参数值。

Returns

Type

Description

Drive.Comments.List

返回一个Drive.Comments.List类对象。

[h2]setForm

Method

public Drive.Comments.List setForm(String form)

设置响应的数据格式。

Parameters

Name

Description

form

响应的数据格式,默认为json,只支持json。

Returns

Type

Description

Drive.Comments.List

返回一个Drive.Comments.List类对象。

[h2]setFields

Method

public Drive.Comments.List setFields(String fields)

设置希望在响应中包含的字段。

Parameters

Name

Description

fields

取值范围为响应结果中的字段,如果希望在响应中包含所有字段,支持*匹配所有字段;如果希望仅返回某些特定字段,则设置需要返回的字段名即可,示例如下:"category,nextCursor,comments/category,comments/creator"。

若不设置fields,则默认返回“category, comments.category, comments.creator.category, comments.id, nextCursor”。

Returns

Type

Description

Drive.Comments.List

返回一个Drive.Comments.List类对象。

[h2]setFileId

Method

public Drive.Comments.List setFileId(String fileId)

设置文件ID。

Parameters

Name

Description

fileId

文件ID。

Returns

Type

Description

Drive.Comments.List

返回一个Drive.Comments.List类对象。

[h2]setIncludeDeleted

Method

public Drive.Comments.List setIncludeDeleted(Boolean includeDeleted)

设置是否返回删除的评论。

Parameters

Name

Description

includeDeleted

是否返回删除的评论。

Returns

Type

Description

Drive.Comments.List

返回一个Drive.Comments.List类对象。

[h2]setPageSize

Method

public Drive.Comments.List setPageSize(Integer pageSize)

设置分页查询的大小。

Parameters

Name

Description

pageSize

指定每次分页查询请求返回的评论数量,可接受值1-100。若不设置pageSize或者设置的pageSize超过当前服务器设置的最大值,则默认值为当前服务器设置的最大值。

Returns

Type

Description

Drive.Comments.List

返回一个Drive.Comments.List类对象。

[h2]setCursor

Method

public Drive.Comments.List setCursor(String cursor)

设置分页查询的起始游标。

Parameters

Name

Description

cursor

分页游标,用于指定分页查询,由前一个响应的nextCursor获取;由于每次查询请求,服务器返回的评论数量至多为100个,如果本次待返回的评论数量大于100,则需要将响应中的nextCursor值设置为下一次查询的分页游标,再次进行遍历查询请求,直至响应结果中的nextCursor为空,才能获取到所有待查询的评论。

Returns

Type

Description

Drive.Comments.List

返回一个Drive.Comments.List类对象。

[h2]setPrettyPrint

Method

public Drive.Comments.List setPrettyPrint(Boolean prettyPrint)

设置返回带有缩进和换行符的响应(格式化,便于阅读打印)。

Parameters

Name

Description

prettyPrint

布尔值,标识响应是否带有缩进和换行符。

Returns

Type

Description

Drive.Comments.List

返回一个Drive.Comments.List类对象。

[h2]setQuotaId

Method

public Drive.Comments.List setQuotaId(String quotaId)

设置一个不超过40字符的字符串,用于代表用户,主要用于服务端基于用户限制单个用户的API访问数量,用做API访问量配额控制。

Parameters

Name

Description

quotaId

一个不超过40字符的字符串,用于代表用户,主要用于服务端基于用户限制单个用户的API访问数量,用做API访问量配额控制。

Returns

Type

Description

Drive.Comments.List

返回一个Drive.Comments.List类对象。

[h2]setStartEditedTime

Method

public Drive.Comments.List setStartEditedTime(String startEditedTime)

设置评论的最早修改时间。

Parameters

Name

Description

startEditedTime

评论的最早修改时间。

Returns

Type

Description

Drive.Comments.List

返回一个Drive.Comments.List类对象。

[h2]execute

Method

public T execute() throws IOException

发送HTTP请求,返回要转换的对象。

Throws

Name

Description

java.io.IOException

若接口调用异常,会返回IOException。您可以通过getMessage方法获取错误描述。

Returns

Type

Description

CommentList

Drive.Comments.List类继承自DriveRequest<CommentList>。调用execute方法返回,返回结果封装为CommentList对象。

Sample Code

private void listComments(Drive drive, String fileId){
    try{
        CommentList list = drive.comments().list(fileId).execute();
    } catch (Exception e){
        Log.e(TAG, "listComments error: " + e.getMessage());
    }
}