Class Info |
|---|
public class Drive.Changes.Subscribe extends DriveRequest<Channel> Drive.Changes.Subscribe class. |
Constructor Name |
|---|
Drive.Changes.Subscribe(String cursor, Channel content) Constructs a Drive.Changes.Subscribe object. |
Qualifier and Type | Method Name and Description |
|---|---|
execute() Sends an HTTP request and returns the object to be converted. | |
String | Obtains the types of space to query. |
String | Obtains the value of cursor from nextCursor in the previous response or using the getStartCursor method. |
Boolean | 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 | 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 | Checks whether the changes that have been deleted are included in the returned change list. |
set(String parameterName, Object value) Sets the given parameter value for the given parameter name. | |
setContainers(String containers) Sets the types of space to query. | |
setCursor(String cursor) Sets cursor. The value is obtained from nextCursor in the previous response or using the getStartCursor method. | |
setFields(String fields) Sets the fields to be contained in a response. | |
setForm(String form) Sets the response data format. | |
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. | |
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. | |
setPrettyPrint(Boolean prettyPrint) Sets whether to return a response containing indentations and newline characters. | |
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. |
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. |
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. |
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. |
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. |
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. |
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. |
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. |
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. |
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. |
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. |
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. |
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. |
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. |
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. |
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. |
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. |
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());
}
}