Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
101 changes: 77 additions & 24 deletions lib/src/main/java/io/ably/lib/realtime/ChannelBase.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
import io.ably.lib.types.ProtocolMessage.Action;
import io.ably.lib.types.ProtocolMessage.Flag;
import io.ably.lib.types.Summary;
import io.ably.lib.types.UpdateDeleteResult;
import io.ably.lib.util.CollectionUtils;
import io.ably.lib.util.EventEmitter;
import io.ably.lib.util.Log;
Expand Down Expand Up @@ -1214,9 +1215,10 @@ public void getMessageAsync(String serial, Callback<Message> callback) {
* Only non-null fields will be applied to the existing message.
* @param operation operation metadata such as clientId, description, or metadata in the version field
* @throws AblyException If the update operation fails.
* @return A {@link UpdateDeleteResult} containing the updated message version serial.
*/
public void updateMessage(Message message, MessageOperation operation) throws AblyException {
messageEditsMixin.updateMessage(ably.http, message, operation);
public UpdateDeleteResult updateMessage(Message message, MessageOperation operation) throws AblyException {
return messageEditsMixin.updateMessage(ably.http, message, operation);
}

/**
Expand All @@ -1228,34 +1230,35 @@ public void updateMessage(Message message, MessageOperation operation) throws Ab
* @param message A {@link Message} object containing the fields to update and the serial identifier.
* Only non-null fields will be applied to the existing message.
* @throws AblyException If the update operation fails.
* @return A {@link UpdateDeleteResult} containing the updated message version serial.
*/
public void updateMessage(Message message) throws AblyException {
updateMessage(message, null);
public UpdateDeleteResult updateMessage(Message message) throws AblyException {
return updateMessage(message, null);
}

/**
* Asynchronously updates an existing message.
*
* @param message A {@link Message} object containing the fields to update and the serial identifier.
* @param operation operation metadata such as clientId, description, or metadata in the version field
* @param listener A listener to be notified of the outcome of this operation.
* @param callback A callback to be notified of the outcome of this operation.
* <p>
* This listener is invoked on a background thread.
* This callback is invoked on a background thread.
*/
public void updateMessageAsync(Message message, MessageOperation operation, CompletionListener listener) {
messageEditsMixin.updateMessageAsync(ably.http, message, operation, listener);
public void updateMessageAsync(Message message, MessageOperation operation, Callback<UpdateDeleteResult> callback) {
messageEditsMixin.updateMessageAsync(ably.http, message, operation, callback);
}

/**
* Asynchronously updates an existing message.
*
* @param message A {@link Message} object containing the fields to update and the serial identifier.
* @param listener A listener to be notified of the outcome of this operation.
* @param callback A callback to be notified of the outcome of this operation.
* <p>
* This listener is invoked on a background thread.
* This callback is invoked on a background thread.
*/
public void updateMessageAsync(Message message, CompletionListener listener) {
updateMessageAsync(message, null, listener);
public void updateMessageAsync(Message message, Callback<UpdateDeleteResult> callback) {
updateMessageAsync(message, null, callback);
}

/**
Expand All @@ -1268,9 +1271,10 @@ public void updateMessageAsync(Message message, CompletionListener listener) {
* @param message A {@link Message} message containing the serial identifier.
* @param operation operation metadata such as clientId, description, or metadata in the version field
* @throws AblyException If the delete operation fails.
* @return A {@link UpdateDeleteResult} containing the deleted message version serial.
*/
public void deleteMessage(Message message, MessageOperation operation) throws AblyException {
messageEditsMixin.deleteMessage(ably.http, message, operation);
public UpdateDeleteResult deleteMessage(Message message, MessageOperation operation) throws AblyException {
return messageEditsMixin.deleteMessage(ably.http, message, operation);
}

/**
Expand All @@ -1282,34 +1286,83 @@ public void deleteMessage(Message message, MessageOperation operation) throws Ab
*
* @param message A {@link Message} message containing the serial identifier.
* @throws AblyException If the delete operation fails.
* @return A {@link UpdateDeleteResult} containing the deleted message version serial.
*/
public void deleteMessage(Message message) throws AblyException {
deleteMessage(message, null);
public UpdateDeleteResult deleteMessage(Message message) throws AblyException {
return deleteMessage(message, null);
}

/**
* Asynchronously marks a message as deleted.
*
* @param message A {@link Message} object containing the serial identifier and operation metadata.
* @param operation operation metadata such as clientId, description, or metadata in the version field
* @param listener A listener to be notified of the outcome of this operation.
* @param callback A callback to be notified of the outcome of this operation.
* <p>
* This listener is invoked on a background thread.
* This callback is invoked on a background thread.
*/
public void deleteMessageAsync(Message message, MessageOperation operation, CompletionListener listener) {
messageEditsMixin.deleteMessageAsync(ably.http, message, operation, listener);
public void deleteMessageAsync(Message message, MessageOperation operation, Callback<UpdateDeleteResult> callback) {
messageEditsMixin.deleteMessageAsync(ably.http, message, operation, callback);
}

/**
* Asynchronously marks a message as deleted.
*
* @param message A {@link Message} object containing the serial identifier and operation metadata.
* @param listener A listener to be notified of the outcome of this operation.
* @param callback A callback to be notified of the outcome of this operation.
* <p>
* This listener is invoked on a background thread.
* This callback is invoked on a background thread.
*/
public void deleteMessageAsync(Message message, Callback<UpdateDeleteResult> callback) {
deleteMessageAsync(message, null, callback);
}

/**
* Appends message text to the end of the message.
*
* @param message A {@link Message} object containing the serial identifier and data to append.
* @param operation operation details such as clientId, description, or metadata
* @return A {@link UpdateDeleteResult} containing the updated message version serial.
* @throws AblyException If the append operation fails.
*/
public UpdateDeleteResult appendMessage(Message message, MessageOperation operation) throws AblyException {
return messageEditsMixin.appendMessage(ably.http, message, operation);
}

/**
* Appends message text to the end of the message.
*
* @param message A {@link Message} object containing the serial identifier and data to append.
* @return A {@link UpdateDeleteResult} containing the updated message version serial.
* @throws AblyException If the append operation fails.
*/
public UpdateDeleteResult appendMessage(Message message) throws AblyException {
return appendMessage(message, null);
}

/**
* Asynchronously appends message text to the end of the message.
*
* @param message A {@link Message} object containing the serial identifier and data to append.
* @param operation operation details such as clientId, description, or metadata
* @param callback A callback to be notified of the outcome of this operation.
* <p>
* This callback is invoked on a background thread.
*/
public void appendMessageAsync(Message message, MessageOperation operation, Callback<UpdateDeleteResult> callback) {
messageEditsMixin.appendMessageAsync(ably.http, message, operation, callback);
}

/**
* Asynchronously appends message text to the end of the message.
*
* @param message A {@link Message} object containing the serial identifier and data to append.
* @param callback A callback to be notified of the outcome of this operation.
* <p>
* This callback is invoked on a background thread.
*/
public void deleteMessageAsync(Message message, CompletionListener listener) {
deleteMessageAsync(message, null, listener);
public void appendMessageAsync(Message message, Callback<UpdateDeleteResult> callback) {
appendMessageAsync(message, null, callback);
}

/**
Expand Down
101 changes: 77 additions & 24 deletions lib/src/main/java/io/ably/lib/rest/ChannelBase.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import io.ably.lib.types.Param;
import io.ably.lib.types.PresenceMessage;
import io.ably.lib.types.PresenceSerializer;
import io.ably.lib.types.UpdateDeleteResult;
import io.ably.lib.util.Crypto;

/**
Expand Down Expand Up @@ -352,9 +353,10 @@ public void getMessageAsync(String serial, Callback<Message> callback) {
* Only non-null fields will be applied to the existing message.
* @param operation operation metadata such as clientId, description, or metadata in the version field
* @throws AblyException If the update operation fails.
* @return A {@link UpdateDeleteResult} containing the updated message version serial.
*/
public void updateMessage(Message message, MessageOperation operation) throws AblyException {
messageEditsMixin.updateMessage(ably.http, message, operation);
public UpdateDeleteResult updateMessage(Message message, MessageOperation operation) throws AblyException {
return messageEditsMixin.updateMessage(ably.http, message, operation);
}

/**
Expand All @@ -366,34 +368,35 @@ public void updateMessage(Message message, MessageOperation operation) throws Ab
* @param message A {@link Message} object containing the fields to update and the serial identifier.
* Only non-null fields will be applied to the existing message.
* @throws AblyException If the update operation fails.
* @return A {@link UpdateDeleteResult} containing the updated message version serial.
*/
public void updateMessage(Message message) throws AblyException {
updateMessage(message, null);
public UpdateDeleteResult updateMessage(Message message) throws AblyException {
return updateMessage(message, null);
}

/**
* Asynchronously updates an existing message.
*
* @param message A {@link Message} object containing the fields to update and the serial identifier.
* @param operation operation metadata such as clientId, description, or metadata in the version field
* @param listener A listener to be notified of the outcome of this operation.
* @param callback A callback to be notified of the outcome of this operation.
* <p>
* This listener is invoked on a background thread.
* This callback is invoked on a background thread.
*/
public void updateMessageAsync(Message message, MessageOperation operation, CompletionListener listener) {
messageEditsMixin.updateMessageAsync(ably.http, message, operation, listener);
public void updateMessageAsync(Message message, MessageOperation operation, Callback<UpdateDeleteResult> callback) {
messageEditsMixin.updateMessageAsync(ably.http, message, operation, callback);
}

/**
* Asynchronously updates an existing message.
*
* @param message A {@link Message} object containing the fields to update and the serial identifier.
* @param listener A listener to be notified of the outcome of this operation.
* @param callback A callback to be notified of the outcome of this operation.
* <p>
* This listener is invoked on a background thread.
* This callback is invoked on a background thread.
*/
public void updateMessageAsync(Message message, CompletionListener listener) {
updateMessageAsync(message, null, listener);
public void updateMessageAsync(Message message, Callback<UpdateDeleteResult> callback) {
updateMessageAsync(message, null, callback);
}

/**
Expand All @@ -406,9 +409,10 @@ public void updateMessageAsync(Message message, CompletionListener listener) {
* @param message A {@link Message} message containing the serial identifier.
* @param operation operation metadata such as clientId, description, or metadata in the version field
* @throws AblyException If the delete operation fails.
* @return A {@link UpdateDeleteResult} containing the deleted message version serial.
*/
public void deleteMessage(Message message, MessageOperation operation) throws AblyException {
messageEditsMixin.deleteMessage(ably.http, message, operation);
public UpdateDeleteResult deleteMessage(Message message, MessageOperation operation) throws AblyException {
return messageEditsMixin.deleteMessage(ably.http, message, operation);
}

/**
Expand All @@ -420,34 +424,83 @@ public void deleteMessage(Message message, MessageOperation operation) throws Ab
*
* @param message A {@link Message} message containing the serial identifier.
* @throws AblyException If the delete operation fails.
* @return A {@link UpdateDeleteResult} containing the deleted message version serial.
*/
public void deleteMessage(Message message) throws AblyException {
deleteMessage(message, null);
public UpdateDeleteResult deleteMessage(Message message) throws AblyException {
return deleteMessage(message, null);
}

/**
* Asynchronously marks a message as deleted.
*
* @param message A {@link Message} object containing the serial identifier and operation metadata.
* @param operation operation metadata such as clientId, description, or metadata in the version field
* @param listener A listener to be notified of the outcome of this operation.
* @param callback A callback to be notified of the outcome of this operation.
* <p>
* This listener is invoked on a background thread.
* This callback is invoked on a background thread.
*/
public void deleteMessageAsync(Message message, MessageOperation operation, CompletionListener listener) {
messageEditsMixin.deleteMessageAsync(ably.http, message, operation, listener);
public void deleteMessageAsync(Message message, MessageOperation operation, Callback<UpdateDeleteResult> callback) {
messageEditsMixin.deleteMessageAsync(ably.http, message, operation, callback);
}

/**
* Asynchronously marks a message as deleted.
*
* @param message A {@link Message} object containing the serial identifier and operation metadata.
* @param listener A listener to be notified of the outcome of this operation.
* @param callback A callback to be notified of the outcome of this operation.
* <p>
* This listener is invoked on a background thread.
* This callback is invoked on a background thread.
*/
public void deleteMessageAsync(Message message, Callback<UpdateDeleteResult> callback) {
deleteMessageAsync(message, null, callback);
}

/**
* Appends message text to the end of the message.
*
* @param message A {@link Message} object containing the serial identifier and data to append.
* @param operation operation details such as clientId, description, or metadata
* @return A {@link UpdateDeleteResult} containing the updated message version serial.
* @throws AblyException If the append operation fails.
*/
public UpdateDeleteResult appendMessage(Message message, MessageOperation operation) throws AblyException {
return messageEditsMixin.appendMessage(ably.http, message, operation);
}

/**
* Appends message text to the end of the message.
*
* @param message A {@link Message} object containing the serial identifier and data to append.
* @return A {@link UpdateDeleteResult} containing the updated message version serial.
* @throws AblyException If the append operation fails.
*/
public UpdateDeleteResult appendMessage(Message message) throws AblyException {
return appendMessage(message, null);
}

/**
* Asynchronously appends message text to the end of the message.
*
* @param message A {@link Message} object containing the serial identifier and data to append.
* @param operation operation details such as clientId, description, or metadata
* @param callback A callback to be notified of the outcome of this operation.
* <p>
* This callback is invoked on a background thread.
*/
public void appendMessageAsync(Message message, MessageOperation operation, Callback<UpdateDeleteResult> callback) {
messageEditsMixin.appendMessageAsync(ably.http, message, operation, callback);
}

/**
* Asynchronously appends message text to the end of the message.
*
* @param message A {@link Message} object containing the serial identifier and data to append.
* @param callback A callback to be notified of the outcome of this operation.
* <p>
* This callback is invoked on a background thread.
*/
public void deleteMessageAsync(Message message, CompletionListener listener) {
deleteMessageAsync(message, null, listener);
public void appendMessageAsync(Message message, Callback<UpdateDeleteResult> callback) {
appendMessageAsync(message, null, callback);
}

/**
Expand Down
Loading
Loading