目录

Drive.Changes.Subscribe

Class Info

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

Drive.Changes.Subscribe class.

Protected Constructor Summary

Constructor Name

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

Constructs a Drive.Changes.Subscribe object.

Public Method Summary

Qualifier and Type

Method Name and Description

Channel

execute()

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

String

getContainers()

Obtains the types of space to query.

String

getCursor()

Obtains the value of cursor from nextCursor in the previous response or using the getStartCursor method.

Boolean

getIncludeDeleted()

Checks whether the changes that have been deleted are included in the returned change list. A deleted change may be one deleted by the user or one that the user no longer has the required permission. The default return value is true.

Integer

getPageSize()

Obtains the value of pageSize, indicating the number of changes returned on each page. The default value is 100. The value ranges from 1 to 100. Note: It is possible that partial or empty result pages are returned before the end of the result list has been reached.

boolean

isIncludeDeleted()

Checks whether the changes that have been deleted are included in the returned change list.

Drive.Changes.Subscribe

set(String parameterName, Object value)

Sets the given parameter value for the given parameter name.

Drive.Changes.Subscribe

setContainers(String containers)

Sets the types of space to query.

Drive.Changes.Subscribe

setCursor(String cursor)

Sets cursor. The value is obtained from nextCursor in the previous response or using the getStartCursor method.

Drive.Changes.Subscribe

setFields(String fields)

Sets the fields to be contained in a response.

Drive.Changes.Subscribe

setForm(String form)

Sets the response data format.

Drive.ChangesSubscribe

setIncludeDeleted(Boolean includeDeleted)

Sets whether the changes that have been deleted are included in the returned change list. A deleted change may be one deleted by the user or one that the user no longer has the required permission.

Drive.Changes.Subscribe

setPageSize(Integer pageSize)

Sets the value of pageSize, indicating the number of changes returned on each page. The default value is 100. The value ranges from 1 to 100. Note: It is possible that partial or empty result pages are returned before the end of the result list has been reached.

Drive.Changes.Subscribe

setPrettyPrint(Boolean prettyPrint)

Sets whether to return a response containing indentations and newline characters.

Drive.Changes.Subscribe

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.

Protected Constructors

[h2]Drive.Changes.Subscribe

Constructor

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

Constructs a Drive.Changes.Subscribe object.

Parameters

Name

Description

cursor

Cursor for the current page, which is obtained from nextCursor in the previous response or using the getStartCursor method.

content

Channel to be subscribed to.

Public Methods

[h2]setFields

Method

public Drive.Changes.Subscribe setFields(String fields)

Sets the fields to be contained in a response.

Parameters

Name

Description

fields

Fields to be contained in a response. An asterisk (*) can be used to match all related fields.

Returns

Type

Description

Drive.Changes.Subscribe

A Drive.Changes.Subscribe object.

[h2]set

Method

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

Sets the given parameter value for the given parameter name.

Parameters

Name

Description

parameterName

Parameter name.

value

Parameter value.

Returns

Type

Description

Drive.Changes.Subscribe

A Drive.Changes.Subscribe object.

[h2]getCursor

Method

public String getCursor()

Obtains the value of cursor.

Returns

Type

Description

String

Value of cursor, which is obtained from nextCursor in the previous response or using the getStartCursor method.

[h2]setCursor

Method

public Drive.Changes.Subscribe setCursor(String cursor)

Sets cursor.

Parameters

Name

Description

cursor

Cursor for the current page, which is obtained from nextCursor in the previous response or using the getStartCursor method.

Returns

Type

Description

Drive.Changes.Subscribe

A Drive.Changes.Subscribe object.

[h2]getPageSize

Method

public Integer getPageSize()

Obtains the value of pageSize.

Returns

Type

Description

Integer

Obtains the value of pageSize, indicating the number of changes returned on each page. The default value is 100. The value ranges from 1 to 100. Note: It is possible that partial or empty result pages are returned before the end of the result list has been reached.

[h2]setPageSize

Method

public Drive.Changes.Subscribe setPageSize(Integer pageSize)

Sets pageSize.

Parameters

Name

Description

pageSize

Number of changes returned on each page. The default value is 100. The value ranges from 1 to 100. Note: It is possible that partial or empty result pages are returned before the end of the result list has been reached.

Returns

Type

Description

Drive.Changes.Subscribe

A Drive.Changes.Subscribe object.

[h2]getContainers

Method

public String getContainers()

Obtains the types of space to query.

Returns

Type

Description

String

Types of space to query. The options include drive and applicationData.

[h2]setContainers

Method

public Drive.Changes.Subscribe setContainers(String containers)

Sets the types of space to query.

Parameters

Name

Description

containers

Types of space to query. The options include drive and applicationData.

Returns

Type

Description

Drive.Changes.Subscribe

A Drive.Changes.Subscribe object.

[h2]setForm

Method

public Drive.Changes.Subscribe setForm(String form)

Sets the response data format.

Parameters

Name

Description

form

Response data format. The default data format is json, and only this format is supported currently.

Returns

Type

Description

Drive.Changes.Subscribe

A Drive.Changes.Subscribe object.

[h2]setPrettyPrint

Method

public Drive.Changes.Subscribe setPrettyPrint(Boolean prettyPrint)

Sets whether to return a response containing indentations and newline characters.

Parameters

Name

Description

prettyPrint

Indicates whether to return a response containing indentations and newline characters. The value is a Boolean value.

Returns

Type

Description

Drive.Changes.Subscribe

A Drive.Changes.Subscribe object.

[h2]setQuotaId

Method

public Drive.Changes.Subscribe 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

Name

Description

quotaId

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.

Returns

Type

Description

Drive.Changes.Subscribe

A Drive.Changes.Subscribe object.

[h2]getIncludeDeleted

Method

public Boolean getIncludeDeleted()

Checks whether the changes that have been deleted are included in the returned change list. A deleted change may be one deleted by the user or one that the user no longer has the required permission.

Returns

Type

Description

Boolean

Whether the changes that have been deleted are included in the returned change list. A deleted change may be one deleted by the user or one that the user no longer has the required permission. The default return value is true.

[h2]setIncludeDeleted

Method

public Drive.Changes.Subscribe setIncludeDeleted(Boolean includeDeleted)

Sets whether the changes that have been deleted are included in the returned change list. A deleted change may be one deleted by the user or one that the user no longer has the required permission.

Parameters

Name

Description

includeDeleted

Indicates whether the changes that have been deleted are included in the returned change list. A deleted change may be one deleted by the user or one that the user no longer has the required permission.

Returns

Type

Description

Drive.Changes.Subscribe

A Drive.Changes.Subscribe object.

[h2]isIncludeDeleted

Method

public boolean isIncludeDeleted()

Checks whether the changes that have been deleted are included in the returned change list.

Returns

Type

Description

boolean

true if the changes that have been deleted are included in the returned change list; false otherwise.

[h2]execute

Method

public T execute() throws IOException

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

Throws

Name

Description

java.io.IOException

I/O exception thrown upon an API call failure. You can use the getMessage method to obtain the error description.

Returns

Type

Description

Channel

The Drive.Changes.Subscribe class inherits DriveRequest<Channel>. Therefore, the return result of the execute() method is encapsulated as a Channel object.

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());
    }
}