diff --git a/service/src/main/java/org/whispersystems/textsecuregcm/controllers/RemoteConfigController.java b/service/src/main/java/org/whispersystems/textsecuregcm/controllers/RemoteConfigController.java index 7b54d4e31..a0555af1b 100644 --- a/service/src/main/java/org/whispersystems/textsecuregcm/controllers/RemoteConfigController.java +++ b/service/src/main/java/org/whispersystems/textsecuregcm/controllers/RemoteConfigController.java @@ -7,6 +7,8 @@ package org.whispersystems.textsecuregcm.controllers; import com.google.common.annotations.VisibleForTesting; import io.dropwizard.auth.Auth; +import io.swagger.v3.oas.annotations.Operation; +import io.swagger.v3.oas.annotations.responses.ApiResponse; import io.swagger.v3.oas.annotations.tags.Tag; import jakarta.ws.rs.GET; import jakarta.ws.rs.Path; @@ -52,6 +54,16 @@ public class RemoteConfigController { @GET @Produces(MediaType.APPLICATION_JSON) + @Operation( + summary = "Fetch remote configuration", + description = """ + Remote configuration is a list of namespaced keys that clients may use for consistent configuration or behavior. + + Configuration values change over time, and the list should be refreshed periodically, typically at client + launch and every few hours thereafter. + """ + ) + @ApiResponse(responseCode = "200", description = "Remote configuration values for the authenticated user", useReturnTypeSchema = true) public UserRemoteConfigList getAll(@ReadOnly @Auth AuthenticatedDevice auth) { try { MessageDigest digest = MessageDigest.getInstance("SHA1"); diff --git a/service/src/main/java/org/whispersystems/textsecuregcm/entities/UserRemoteConfig.java b/service/src/main/java/org/whispersystems/textsecuregcm/entities/UserRemoteConfig.java index 276607cdd..41834fa1b 100644 --- a/service/src/main/java/org/whispersystems/textsecuregcm/entities/UserRemoteConfig.java +++ b/service/src/main/java/org/whispersystems/textsecuregcm/entities/UserRemoteConfig.java @@ -6,24 +6,29 @@ package org.whispersystems.textsecuregcm.entities; import com.fasterxml.jackson.annotation.JsonProperty; +import io.swagger.v3.oas.annotations.media.Schema; public class UserRemoteConfig { @JsonProperty - private String name; + @Schema(description = "Name of the configuration", example = "android.exampleFeature") + private String name; @JsonProperty + @Schema(description = "Whether the configuration is enabled for the user") private boolean enabled; @JsonProperty - private String value; + @Schema(description = "The value to be used for the configuration, if it is a non-boolean type") + private String value; - public UserRemoteConfig() {} + public UserRemoteConfig() { + } public UserRemoteConfig(String name, boolean enabled, String value) { - this.name = name; + this.name = name; this.enabled = enabled; - this.value = value; + this.value = value; } public String getName() { diff --git a/service/src/main/java/org/whispersystems/textsecuregcm/entities/UserRemoteConfigList.java b/service/src/main/java/org/whispersystems/textsecuregcm/entities/UserRemoteConfigList.java index e913b5e62..396e8fcaf 100644 --- a/service/src/main/java/org/whispersystems/textsecuregcm/entities/UserRemoteConfigList.java +++ b/service/src/main/java/org/whispersystems/textsecuregcm/entities/UserRemoteConfigList.java @@ -10,16 +10,22 @@ import com.fasterxml.jackson.annotation.JsonProperty; import com.fasterxml.jackson.databind.annotation.JsonSerialize; import java.time.Instant; import java.util.List; +import io.swagger.v3.oas.annotations.media.Schema; import org.whispersystems.textsecuregcm.util.InstantAdapter; public class UserRemoteConfigList { @JsonProperty + @Schema(description = "List of remote configurations applicable to the user") private List config; @JsonProperty @JsonSerialize(using = InstantAdapter.EpochSecondSerializer.class) @JsonFormat(shape = JsonFormat.Shape.NUMBER_INT) + @Schema(description = """ + Timestamp when the configuration was generated. Deprecated in favor of `X-Signal-Timestamp` response header. + """, deprecated = true) + @Deprecated private Instant serverEpochTime; public UserRemoteConfigList() {}