-
Notifications
You must be signed in to change notification settings - Fork 42
[AIT-99] feat: protocol v5 + message appends #1182
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -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; | ||||||
|
|
@@ -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); | ||||||
| } | ||||||
|
|
||||||
| /** | ||||||
|
|
@@ -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) { | ||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This can be marked as |
||||||
| 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); | ||||||
| } | ||||||
|
|
||||||
| /** | ||||||
|
|
@@ -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); | ||||||
| } | ||||||
|
|
||||||
| /** | ||||||
|
|
@@ -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. | ||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same goes for other |
||||||
| * | ||||||
| * @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); | ||||||
| } | ||||||
|
|
||||||
| /** | ||||||
|
|
||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This seems like a blocking method. Was this a blocking method before as well?
If so, we can mark it as
@Blockingfor users wdyt?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similarly goes for
updateMessageand similar methodsThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We are already using
org.jetbrains.annotationsinliveobjectspublic API, so we can use them here as well wdyt? This will be reflected in the API documentation and will be helpful for LLMs to choose right public API depending on the use-caseThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm.. we are also using them in
lib/src/main/java/io/ably/lib/types/UpdateDeleteResult.java