Subscriptions can be created in bulk and you can retrieve multiple results at once. Therefore, the onSuccess and onFailure methods of the ApiResultListener instance are called as many times as there are subscriptions created.
A SubscriptionCreationResult object with the following fields is returned as a response to a successful call:
Fields
Method Name | Data Returned | Description |
---|---|---|
getRequestId(): String | Request ID | The key for the specific request. |
getPushId(): long | Push ID | The key for the specific push message. |
getSubscriptionId(): long | Subscription ID | The subscriber's unique ID number. |
A SubscriptionCreationFailure object with the following fields is returned as a response to a failure call:
Fields
Method Name | Data Returned | Description |
---|---|---|
getRequestId(): String | Request ID | The key for the specific request. |
getStatusCode(): String | API Status Code | A code that provides additional information about the status of your request. Please reference the Status_code list for details. |
getErrorData(): List<String> | Error data | Details for data that caused the error in the request. |
The following example demonstrates how handlers are registered:
ApiResultListener<SubscriptionCreationResult, SubscriptionCreationFailure> listener =
new ApiResultListener<SubscriptionCreationResult, SubscriptionCreationFailure>() {
@Override
public void onSuccess(@Nonnull SubscriptionCreationResult result) {
// Handle success result
}
@Override
public void onFailure(@Nonnull SubscriptionCreationFailure failure) {
// Handle failure result
}
};
ResultHandler resultHandler = new ResultHandler.Builder()
.listen(ApiResultTypeSpec.subscriptionCreation, listener)
.build(typeSpecFinder);
A SubscriptionResult object with the following fields is returned as a response to a successful call:
Fields
Method Name | Data Returned | Description |
---|---|---|
getRequestId(): String | Request ID | The key for the specific request. |
getPushId(): long | Push ID | The key for the specific push message. |
getSubscriptionId(): long | Subscription ID | The subscriber's unique ID number. |
A SubscriptionUpdateFailure object with the following fields is returned as a response to a failure call.
Fields
Method Name | Data Returned | Description |
---|---|---|
getRequestId(): String | Request ID | The key for the specific request. |
getPushId(): long | Push ID | The key for the specific push message. |
getStatusCode(): String | API Status Code | A code that provides additional information about the status of your request. Please reference the Status_code list for details. |
getErrorData(): List<String> | Error data | Details for data that caused the error in the request. |
The following example demonstrates how handlers are registered:
ApiResultListener<SubscriptionResult, SubscriptionUpdateFailure> listener =
new ApiResultListener<SubscriptionResult, SubscriptionUpdateFailure>() {
@Override
public void onSuccess(@Nonnull SubscriptionResult result) {
// Handle success result
}
@Override
public void onFailure(@Nonnull SubscriptionUpdateFailure failure) {
// Handle failure result
}
};
ResultHandler resultHandler = new ResultHandler.Builder()
.listen(ApiResultTypeSpec.subscriptionUpdate, listener)
.build(typeSpecFinder);
Responses to a subscription deletion request is the same as those of an update operation.
A SubscriptionResult object with the following fields is returned as a response to a successful call:
Fields
Method Name | Data Returned | Description |
---|---|---|
getRequestId(): String | Request ID | The key for the specific request. |
getPushId(): long | Push ID | The key for the specific push message. |
getSubscriptionId(): long | Subscription ID | The subscriber's unique ID number. |
A BasicFailure object with the following fields is returned as a response to a failure call:
Fields
Method Name | Data Returned | Description |
---|---|---|
getRequestId(): String | Request ID | The key for the specific request. |
getPushId(): long | Push ID | The key for the specific push message. |
getStatusCode(): String | API Status Code | A code that provides additional information about the status of your request. Please reference the Status_code list for details. |
getErrorData(): List<String> | Error data | Details for data that caused the error in the request. |
The following example demonstrates how handlers are registered:
ApiResultListener<SubscriptionResult, BasicFailure> listener =
new ApiResultListener<SubscriptionResult, BasicFailure>() {
@Override
public void onSuccess(@Nonnull SubscriptionResult result) {
// Handle success result
}
@Override
public void onFailure(@Nonnull BasicFailure failure) {
// Handle failure result
}
};
ResultHandler resultHandler = new ResultHandler.Builder()
.listen(ApiResultTypeSpec.subscriptionDeletion, listener)
.build(typeSpecFinder);