@@ -13,6 +13,12 @@ data class Document<T>(
1313 @SerializedName(" \$ id" )
1414 val id : String ,
1515
16+ /* *
17+ * Document automatically incrementing ID.
18+ */
19+ @SerializedName(" \$ sequence" )
20+ val sequence : Long ,
21+
1622 /* *
1723 * Collection ID.
1824 */
@@ -51,6 +57,7 @@ data class Document<T>(
5157) {
5258 fun toMap (): Map <String , Any > = mapOf (
5359 " \$ id" to id as Any ,
60+ " \$ sequence" to sequence as Any ,
5461 " \$ collectionId" to collectionId as Any ,
5562 " \$ databaseId" to databaseId as Any ,
5663 " \$ createdAt" to createdAt as Any ,
@@ -62,6 +69,7 @@ data class Document<T>(
6269 companion object {
6370 operator fun invoke (
6471 id : String ,
72+ sequence : Long ,
6573 collectionId : String ,
6674 databaseId : String ,
6775 createdAt : String ,
@@ -70,6 +78,7 @@ data class Document<T>(
7078 data : Map <String , Any >
7179 ) = Document <Map <String , Any >>(
7280 id,
81+ sequence,
7382 collectionId,
7483 databaseId,
7584 createdAt,
@@ -84,6 +93,7 @@ data class Document<T>(
8493 nestedType : Class <T >
8594 ) = Document <T >(
8695 id = map[" \$ id" ] as String ,
96+ sequence = (map[" \$ sequence" ] as Number ).toLong(),
8797 collectionId = map[" \$ collectionId" ] as String ,
8898 databaseId = map[" \$ databaseId" ] as String ,
8999 createdAt = map[" \$ createdAt" ] as String ,
0 commit comments