diff --git a/src/main/java/io/getstream/chat/java/models/App.java b/src/main/java/io/getstream/chat/java/models/App.java index 40d28979..ea7aa90a 100644 --- a/src/main/java/io/getstream/chat/java/models/App.java +++ b/src/main/java/io/getstream/chat/java/models/App.java @@ -411,6 +411,30 @@ public static class DeviceError { private String errorMessage; } + @Builder + @Setter + public static class AsyncModerationCallback { + @Nullable + @JsonProperty("mode") + private String mode; + + @Nullable + @JsonProperty("server_url") + private String serverUrl; + } + + @Builder + @Setter + public static class AsyncModerationConfigRequestObject { + @Nullable + @JsonProperty("callback") + private AsyncModerationCallback callback; + + @Nullable + @JsonProperty("timeout_ms") + private Number timeoutMs; + } + @Builder @Setter public static class FileUploadConfigRequestObject { @@ -665,6 +689,11 @@ public static class AppUpdateRequestData { @JsonInclude(Include.NON_NULL) private Boolean asyncURLEnrichEnabled; + @Nullable + @JsonProperty("async_moderation_config") + @JsonInclude(Include.NON_NULL) + private AsyncModerationConfigRequestObject asyncModerationConfig; + @Nullable @JsonProperty("sqs_url") @JsonInclude(Include.NON_NULL) diff --git a/src/main/java/io/getstream/chat/java/models/Channel.java b/src/main/java/io/getstream/chat/java/models/Channel.java index 5f0890a4..4827e9a6 100644 --- a/src/main/java/io/getstream/chat/java/models/Channel.java +++ b/src/main/java/io/getstream/chat/java/models/Channel.java @@ -1102,6 +1102,10 @@ public static class ChannelGetResponse extends StreamResponseObject { @JsonProperty("pinned_messages") private List pinnedMessages; + @Nullable + @JsonProperty("pending_messages") + private List pendingMessages; + @Nullable @JsonProperty("watcher_count") private Integer watcher_count; diff --git a/src/main/java/io/getstream/chat/java/models/Message.java b/src/main/java/io/getstream/chat/java/models/Message.java index d4f03087..ea0d64d4 100644 --- a/src/main/java/io/getstream/chat/java/models/Message.java +++ b/src/main/java/io/getstream/chat/java/models/Message.java @@ -5,6 +5,7 @@ import io.getstream.chat.java.models.Flag.FlagCreateRequestData.FlagCreateRequest; import io.getstream.chat.java.models.Flag.FlagDeleteRequestData.FlagDeleteRequest; import io.getstream.chat.java.models.Flag.FlagMessageQueryRequestData.FlagMessageQueryRequest; +import io.getstream.chat.java.models.Message.MessageCommitRequestData.MessageCommitRequest; import io.getstream.chat.java.models.Message.MessagePartialUpdateRequestData.MessagePartialUpdateRequest; import io.getstream.chat.java.models.Message.MessageRunCommandActionRequestData.MessageRunCommandActionRequest; import io.getstream.chat.java.models.Message.MessageSearchRequestData.MessageSearchRequest; @@ -695,6 +696,14 @@ public static class MessageSendRequestData { @JsonProperty("skip_push") private Boolean skipPush; + @Nullable + @JsonProperty("is_pending_message") + private Boolean isPendingMessage; + + @Nullable + @JsonProperty("pending_message_metadata") + private Map pendingMessageMetadata; + public static class MessageSendRequest extends StreamRequest { @NotNull private String channelId; @@ -1159,6 +1168,25 @@ protected Call generateCall(Client client) { } } + @Builder( + builderClassName = "MessageCommitRequest", + builderMethodName = "", + buildMethodName = "internalBuild") + public static class MessageCommitRequestData { + public static class MessageCommitRequest extends StreamRequest { + @NotNull private String messageId; + + public MessageCommitRequest(@NotNull String messageId) { + this.messageId = messageId; + } + + @Override + protected Call generateCall(Client client) { + return client.create(MessageService.class).commit(messageId, this.internalBuild()); + } + } + } + @Builder( builderClassName = "MessagePartialUpdateRequest", builderMethodName = "", @@ -1224,6 +1252,15 @@ public static class MessageUpdateResponse extends StreamResponseObject { private Message message; } + @Data + @NoArgsConstructor + @EqualsAndHashCode(callSuper = true) + public static class MessageCommitResponse extends StreamResponseObject { + @NotNull + @JsonProperty("message") + private Message message; + } + @Data @NoArgsConstructor @EqualsAndHashCode(callSuper = true) @@ -1489,6 +1526,16 @@ public static MessageTranslateRequest translate(@NotNull String messageId) { return new MessageTranslateRequest(messageId); } + /** + * Creates a commit message request + * + * @param messageId the pending message id to commit + * @return the created request + */ + @NotNull + public static MessageCommitRequest commit(@NotNull String messageId) { + return new MessageCommitRequest(messageId); + } /** * Creates a flag request * diff --git a/src/main/java/io/getstream/chat/java/services/MessageService.java b/src/main/java/io/getstream/chat/java/services/MessageService.java index 2913c8b3..bd0c4e1b 100644 --- a/src/main/java/io/getstream/chat/java/services/MessageService.java +++ b/src/main/java/io/getstream/chat/java/services/MessageService.java @@ -1,5 +1,7 @@ package io.getstream.chat.java.services; +import io.getstream.chat.java.models.Message.MessageCommitRequestData; +import io.getstream.chat.java.models.Message.MessageCommitResponse; import io.getstream.chat.java.models.Message.MessageDeleteResponse; import io.getstream.chat.java.models.Message.MessageGetManyResponse; import io.getstream.chat.java.models.Message.MessageGetRepliesResponse; @@ -53,6 +55,11 @@ Call update( Call search( @NotNull @ToJson @Query("payload") MessageSearchRequestData messageSearchRequestData); + @POST("messages/{id}/commit") + Call commit( + @NotNull @Path("id") String messageId, + @NotNull @Body MessageCommitRequestData messageCommitRequestData); + @Multipart @Headers("X-Stream-LogRequestBody: false") @POST("channels/{type}/{id}/file")