From 13d903e5f01b481f73faf06dbdbd90839d98e829 Mon Sep 17 00:00:00 2001 From: Ali Momen Sani Date: Wed, 15 Jan 2025 15:59:53 +0100 Subject: [PATCH] fix: add missing field --- .../io/getstream/chat/java/models/App.java | 8 ++++++++ .../java/io/getstream/chat/java/AppTest.java | 18 ++++++++++++++++++ 2 files changed, 26 insertions(+) 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 d360a47e..15df8742 100644 --- a/src/main/java/io/getstream/chat/java/models/App.java +++ b/src/main/java/io/getstream/chat/java/models/App.java @@ -406,6 +406,10 @@ public static class FileUploadConfig { @Nullable @JsonProperty("blocked_mime_types") private List blockedMimeTypes; + + @Nullable + @JsonProperty("size_limit") + private Integer sizeLimit; } @Data @@ -468,6 +472,10 @@ public static class FileUploadConfigRequestObject { @JsonProperty("blocked_mime_types") private List blockedMimeTypes; + @Nullable + @JsonProperty("size_limit") + private Integer sizeLimit; + @Nullable public static FileUploadConfigRequestObject buildFrom( @Nullable FileUploadConfig fileUploadConfig) { diff --git a/src/test/java/io/getstream/chat/java/AppTest.java b/src/test/java/io/getstream/chat/java/AppTest.java index 07161ae5..a3df12ce 100644 --- a/src/test/java/io/getstream/chat/java/AppTest.java +++ b/src/test/java/io/getstream/chat/java/AppTest.java @@ -4,6 +4,7 @@ import io.getstream.chat.java.models.App; import io.getstream.chat.java.models.App.AppCheckSnsResponse; import io.getstream.chat.java.models.App.AppCheckSqsResponse; +import io.getstream.chat.java.models.App.AppConfig; import io.getstream.chat.java.models.App.PushConfigRequestObject; import io.getstream.chat.java.models.App.PushVersion; import io.getstream.chat.java.models.Message; @@ -12,6 +13,7 @@ import java.util.Calendar; import java.util.GregorianCalendar; import java.util.Properties; +import java.util.Random; import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.DisplayName; import org.junit.jupiter.api.Test; @@ -158,4 +160,20 @@ void whenRevokingTokens_thenNoException() { calendar.add(Calendar.DAY_OF_MONTH, -1); Assertions.assertDoesNotThrow(() -> App.revokeTokens(calendar.getTime()).request()); } + + @DisplayName("App Settings update size limit does not throw Exception") + @Test + void whenUpdatingAppSettingsSizeLimit_thenNoException() { + AppConfig appConfig = Assertions.assertDoesNotThrow(() -> App.get().request()).getApp(); + int newSizeLimit = (new Random()).nextInt(100 * 1024 * 1024); + Assertions.assertDoesNotThrow( + () -> + App.update() + .fileUploadConfig( + App.FileUploadConfigRequestObject.builder().sizeLimit(newSizeLimit).build()) + .request()); + + appConfig = Assertions.assertDoesNotThrow(() -> App.get().request()).getApp(); + Assertions.assertEquals(newSizeLimit, appConfig.getFileUploadConfig().getSizeLimit()); + } }