Skip to content

Commit

Permalink
fix: add missing field
Browse files Browse the repository at this point in the history
  • Loading branch information
shaljam committed Jan 15, 2025
1 parent 56d6990 commit 13d903e
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/main/java/io/getstream/chat/java/models/App.java
Original file line number Diff line number Diff line change
Expand Up @@ -406,6 +406,10 @@ public static class FileUploadConfig {
@Nullable
@JsonProperty("blocked_mime_types")
private List<String> blockedMimeTypes;

@Nullable
@JsonProperty("size_limit")
private Integer sizeLimit;
}

@Data
Expand Down Expand Up @@ -468,6 +472,10 @@ public static class FileUploadConfigRequestObject {
@JsonProperty("blocked_mime_types")
private List<String> blockedMimeTypes;

@Nullable
@JsonProperty("size_limit")
private Integer sizeLimit;

@Nullable
public static FileUploadConfigRequestObject buildFrom(
@Nullable FileUploadConfig fileUploadConfig) {
Expand Down
18 changes: 18 additions & 0 deletions src/test/java/io/getstream/chat/java/AppTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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());
}
}

0 comments on commit 13d903e

Please sign in to comment.