目录

Drive.Changes.Subscribe

Class Info

public class Drive.Changes.Subscribe extends DriveRequest<Channel>

Drive.Changes.Subscribe类结构。

Protected Constructor Summary

Constructor Name

Drive.Changes.Subscribe(String cursor, Channel content)

Drive.Changes.Subscribe构造方法。

Public Method Summary

Qualifier and Type

Method Name and Description

Channel

execute()

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

String

getContainers()

获取用户要查询存储空间的类型。

String

getCursor()

获取cursor,cursor为分页游标,由前一个响应的nextCursor获取或者从getStartCursor方法获取。

Boolean

getIncludeDeleted()

获取是否包含已从更改列表中删除的项目更改,例如通过删除或失去访问权限。[default: true]。

Integer

getPageSize()

获取pageSize,pageSize为每次分页查询请求返回的changes列表数量,默认值是100,可接受值1-100,注意在到达最后的列表之前,实际有可能返回部分或者空结果。

boolean

isIncludeDeleted()

是否包括已从更改列表中删除的项目更改。

Drive.Changes.Subscribe

set(String parameterName, Object value)

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

Drive.Changes.Subscribe

setContainers(String containers)

设置用户要查询存储空间的类型。

Drive.Changes.Subscribe

setCursor(String cursor)

设置cursor,cursor为分页游标,由前一个响应的nextCursor获取或者从getStartCursor方法获取。

Drive.Changes.Subscribe

setFields(String fields)

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

Drive.Changes.Subscribe

setForm(String form)

设置响应的数据格式。

Drive.ChangesSubscribe

setIncludeDeleted(Boolean includeDeleted)

设置是否包括已从更改列表中删除的项目更改,例如通过删除或失去访问权限。

Drive.Changes.Subscribe

setPageSize(Integer pageSize)

设置pageSize,pageSize为每次分页查询请求返回的changes列表数量,默认值是100,可接受值1-100,注意在到达最后的列表之前,实际有可能返回部分或者空结果。

Drive.Changes.Subscribe

setPrettyPrint(Boolean prettyPrint)

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

Drive.Changes.Subscribe

setQuotaId(String quotaId)

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

Protected Constructors

[h2]Drive.Changes.Subscribe

Constructor

protected Drive.Changes.Subscribe(String cursor, Channel content)

Drive.Changes.Subscribe构造方法。

Parameters

Name

Description

cursor

分页游标,由前一个响应的nextCursor获取或者从getStartCursor方法获取。

content

订阅指定Channel。

Public Methods

[h2]setFields

Method

public Drive.Changes.Subscribe setFields(String fields)

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

Parameters

Name

Description

fields

希望在响应中包含的字段,支持*匹配所有字段。

Returns

Type

Description

Drive.Changes.Subscribe

返回一个Drive.Changes.Subscribe类对象。

[h2]set

Method

public Drive.Changes.Subscribe set(String parameterName, Object value)

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

Parameters

Name

Description

parameterName

参数名称。

value

参数值。

Returns

Type

Description

Drive.Changes.Subscribe

返回一个Drive.Changes.Subscribe类对象。

[h2]getCursor

Method

public String getCursor()

获取cursor。

Returns

Type

Description

String

返回cursor,cursor为分页游标,由前一个响应的nextCursor获取或者从getStartCursor方法获取。

[h2]setCursor

Method

public Drive.Changes.Subscribe setCursor(String cursor)

设置cursor。

Parameters

Name

Description

cursor

分页游标,由前一个响应的nextCursor获取或者从getStartCursor方法获取。

Returns

Type

Description

Drive.Changes.Subscribe

返回一个Drive.Changes.Subscribe类对象。

[h2]getPageSize

Method

public Integer getPageSize()

获取pageSize。

Returns

Type

Description

Integer

获取pageSize,pageSize为每次分页查询请求返回的changes列表数量,默认值是100,可接受值1-100,注意在到达最后的列表之前,实际有可能返回部分或者空结果。

[h2]setPageSize

Method

public Drive.Changes.Subscribe setPageSize(Integer pageSize)

设置pageSize。

Parameters

Name

Description

pageSize

指定每次分页查询请求返回的changes列表数量,默认值是100,可接受值1-100,注意在到达最后的列表之前,实际有可能返回部分或者空结果。

Returns

Type

Description

Drive.Changes.Subscribe

返回一个Drive.Changes.Subscribe类对象。

[h2]getContainers

Method

public String getContainers()

获取用户要查询存储空间的类型。

Returns

Type

Description

String

返回用户要查询存储空间的类型。支持的值是'drive'和'applicationData'。

[h2]setContainers

Method

public Drive.Changes.Subscribe setContainers(String containers)

设置用户要查询存储空间的类型。

Parameters

Name

Description

containers

用户要查询存储空间的类型。支持的值是“drive”和“applicationData”。

Returns

Type

Description

Drive.Changes.Subscribe

返回一个Drive.Changes.Subscribe类对象。

[h2]setForm

Method

public Drive.Changes.Subscribe setForm(String form)

设置响应的数据格式。

Parameters

Name

Description

form

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

Returns

Type

Description

Drive.Changes.Subscribe

返回一个Drive.Changes.Subscribe类对象。

[h2]setPrettyPrint

Method

public Drive.Changes.Subscribe setPrettyPrint(Boolean prettyPrint)

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

Parameters

Name

Description

prettyPrint

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

Returns

Type

Description

Drive.Changes.Subscribe

返回一个Drive.Changes.Subscribe类对象。

[h2]setQuotaId

Method

public Drive.Changes.Subscribe setQuotaId(String quotaId)

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

Parameters

Name

Description

quotaId

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

Returns

Type

Description

Drive.Changes.Subscribe

返回一个Drive.Changes.Subscribe类对象。

[h2]getIncludeDeleted

Method

public Boolean getIncludeDeleted()

获取是否包括已从更改列表中删除的项目更改,例如通过删除或失去访问权限。

Returns

Type

Description

Boolean

返回是否包括已从更改列表中删除的项目更改,例如通过删除或失去访问权限。[default: true]。

[h2]setIncludeDeleted

Method

public Drive.Changes.Subscribe setIncludeDeleted(Boolean includeDeleted)

设置是否包括已从更改列表中删除的项目更改,例如通过删除或失去访问权限。

Parameters

Name

Description

includeDeleted

是否包括已从更改列表中删除的项目更改,例如通过删除或失去访问权限。

Returns

Type

Description

Drive.Changes.Subscribe

返回一个Drive.Changes.Subscribe类对象。

[h2]isIncludeDeleted

Method

public boolean isIncludeDeleted()

是否包括已从更改列表中删除的项目更改。

Returns

Type

Description

boolean

是否包括已从更改列表中删除的项目更改。

[h2]execute

Method

public T execute() throws IOException

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

Throws

Name

Description

java.io.IOException

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

Returns

Type

Description

Channel

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

Sample Code

private void subscribeChange(Drive drive, String cursor){
    try{
        Channel channel = new Channel();
        channel.setId(HmsProxyImpl.getInstance().getDeveiceId());
        channel.setType("web_hook");
        channel.setUrl("https://...... ");
        Drive.Changes.Subscribe subscribe= drive.changes().subscribe(cursor, channel);
        Channel result = subscribe.execute();
    } catch (Exception e){
        Log.e(TAG, "subscribeChange error: " + e.getMessage());
    }
}