11package io.ably.lib.objects
22
33import com.fasterxml.jackson.annotation.JsonProperty
4+ import com.google.gson.JsonArray
5+ import com.google.gson.JsonObject
6+ import com.google.gson.annotations.JsonAdapter
47import com.google.gson.annotations.SerializedName
58
69/* *
@@ -28,19 +31,14 @@ internal enum class MapSemantics(val code: Int) {
2831 * An ObjectData represents a value in an object on a channel.
2932 * Spec: OD1
3033 */
34+ @JsonAdapter(ObjectDataJsonSerializer ::class )
3135internal data class ObjectData (
3236 /* *
3337 * A reference to another object, used to support composable object structures.
3438 * Spec: OD2a
3539 */
3640 val objectId : String? = null ,
3741
38- /* *
39- * Can be set by the client to indicate that value in `string` or `bytes` field have an encoding.
40- * Spec: OD2b
41- */
42- val encoding : String? = null ,
43-
4442 /* *
4543 * String, number, boolean or binary - a concrete value of the object
4644 * Spec: OD2c
@@ -49,20 +47,27 @@ internal data class ObjectData(
4947)
5048
5149/* *
52- * Represents a value that can be a String, Number, Boolean or Binary .
50+ * Represents a value that can be a String, Number, Boolean, Binary, JsonObject, or JsonArray .
5351 * Performs a type check on initialization.
5452 * Spec: OD2c
5553 */
5654internal data class ObjectValue (
5755 /* *
58- * The concrete value of the object. Can be a String, Number, Boolean or Binary .
56+ * The concrete value of the object. Can be a String, Number, Boolean, Binary, JsonObject, or JsonArray .
5957 * Spec: OD2c
6058 */
6159 val value : Any ,
6260) {
6361 init {
64- require(value is String || value is Number || value is Boolean || value is Binary ) {
65- " value must be String, Number, Boolean or Binary"
62+ require(
63+ value is String ||
64+ value is Number ||
65+ value is Boolean ||
66+ value is Binary ||
67+ value is JsonObject ||
68+ value is JsonArray
69+ ) {
70+ " value must be String, Number, Boolean, Binary, JsonObject or JsonArray"
6671 }
6772 }
6873}
@@ -204,18 +209,13 @@ internal data class ObjectOperation(
204209 val nonce : String? = null ,
205210
206211 /* *
207- * The initial value bytes for the object. These bytes should be used along with the nonce
208- * and timestamp to create the object ID. Frontdoor will use this to verify the object ID.
209- * After verification the bytes will be decoded into the Map or Counter objects and
210- * the initialValue, nonce, and initialValueEncoding will be removed.
212+ * The initial value for the object, encoded as a base64 string.
213+ * This value should be used along with the nonce and timestamp to create the object ID.
214+ * Frontdoor will use this to verify the object ID. After verification, the value will be
215+ * decoded into the Map or Counter objects and the initialValue, nonce, and initialValueEncoding will be removed.
211216 * Spec: OOP3h
212217 */
213- val initialValue : Binary ? = null ,
214-
215- /* * The initial value encoding defines how the initialValue should be interpreted.
216- * Spec: OOP3i
217- */
218- val initialValueEncoding : ProtocolMessageFormat ? = null
218+ val initialValue : String? = null ,
219219)
220220
221221/* *
0 commit comments