Skip to content

Commit 1cec45c

Browse files
committed
Add serialized names to ensure all properties are deserialized correctly
1 parent a6f37d1 commit 1cec45c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

55 files changed

+371
-10
lines changed

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ repositories {
3939
Next, add the dependency to your project's `build.gradle(.kts)` file:
4040

4141
```groovy
42-
implementation("io.appwrite:sdk-for-kotlin:0.2.4")
42+
implementation("io.appwrite:sdk-for-kotlin:0.2.5")
4343
```
4444

4545
### Maven
@@ -50,7 +50,7 @@ Add this to your project's `pom.xml` file:
5050
<dependency>
5151
<groupId>io.appwrite</groupId>
5252
<artifactId>sdk-for-kotlin</artifactId>
53-
<version>0.2.4</version>
53+
<version>0.2.5</version>
5454
</dependency>
5555
</dependencies>
5656
```

build.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ plugins {
66
ext {
77
PUBLISH_GROUP_ID = 'io.appwrite'
88
PUBLISH_ARTIFACT_ID = 'sdk-for-kotlin'
9-
PUBLISH_VERSION = '0.2.4'
9+
PUBLISH_VERSION = '0.2.5'
1010
POM_URL = 'https://github.com/appwrite/sdk-for-kotlin'
1111
POM_SCM_URL = 'https://github.com/appwrite/sdk-for-kotlin'
1212
POM_ISSUE_URL = 'https://github.com/appwrite/sdk-for-kotlin/issues'

src/main/kotlin/io/appwrite/Client.kt

+1-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ class Client @JvmOverloads constructor(
5555
init {
5656
headers = mutableMapOf(
5757
"content-type" to "application/json",
58-
"x-sdk-version" to "appwrite:kotlin:0.2.4",
58+
"x-sdk-version" to "appwrite:kotlin:0.2.5",
5959
"x-appwrite-response-format" to "0.12.0"
6060
)
6161
config = mutableMapOf()

src/main/kotlin/io/appwrite/models/AttributeBoolean.kt

+8
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
package io.appwrite.models
22

3+
import com.google.gson.annotations.SerializedName
4+
35
/**
46
* AttributeBoolean
57
*/
@@ -8,36 +10,42 @@ data class AttributeBoolean(
810
* Attribute Key.
911
*
1012
*/
13+
@SerializedName("key")
1114
val key: String,
1215

1316
/**
1417
* Attribute type.
1518
*
1619
*/
20+
@SerializedName("type")
1721
val type: String,
1822

1923
/**
2024
* Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed`
2125
*
2226
*/
27+
@SerializedName("status")
2328
val status: String,
2429

2530
/**
2631
* Is attribute required?
2732
*
2833
*/
34+
@SerializedName("required")
2935
val required: Boolean,
3036

3137
/**
3238
* Is attribute an array?
3339
*
3440
*/
41+
@SerializedName("array")
3542
var array: Boolean?,
3643

3744
/**
3845
* Default value for attribute when not provided. Cannot be set when attribute is required.
3946
*
4047
*/
48+
@SerializedName("default")
4149
var default: Boolean?
4250
) {
4351
companion object {

src/main/kotlin/io/appwrite/models/AttributeEmail.kt

+9
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
package io.appwrite.models
22

3+
import com.google.gson.annotations.SerializedName
4+
35
/**
46
* AttributeEmail
57
*/
@@ -8,42 +10,49 @@ data class AttributeEmail(
810
* Attribute Key.
911
*
1012
*/
13+
@SerializedName("key")
1114
val key: String,
1215

1316
/**
1417
* Attribute type.
1518
*
1619
*/
20+
@SerializedName("type")
1721
val type: String,
1822

1923
/**
2024
* Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed`
2125
*
2226
*/
27+
@SerializedName("status")
2328
val status: String,
2429

2530
/**
2631
* Is attribute required?
2732
*
2833
*/
34+
@SerializedName("required")
2935
val required: Boolean,
3036

3137
/**
3238
* Is attribute an array?
3339
*
3440
*/
41+
@SerializedName("array")
3542
var array: Boolean?,
3643

3744
/**
3845
* String format.
3946
*
4047
*/
48+
@SerializedName("format")
4149
val format: String,
4250

4351
/**
4452
* Default value for attribute when not provided. Cannot be set when attribute is required.
4553
*
4654
*/
55+
@SerializedName("default")
4756
var default: String?
4857
) {
4958
companion object {

src/main/kotlin/io/appwrite/models/AttributeEnum.kt

+10
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
package io.appwrite.models
22

3+
import com.google.gson.annotations.SerializedName
4+
35
/**
46
* AttributeEnum
57
*/
@@ -8,48 +10,56 @@ data class AttributeEnum(
810
* Attribute Key.
911
*
1012
*/
13+
@SerializedName("key")
1114
val key: String,
1215

1316
/**
1417
* Attribute type.
1518
*
1619
*/
20+
@SerializedName("type")
1721
val type: String,
1822

1923
/**
2024
* Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed`
2125
*
2226
*/
27+
@SerializedName("status")
2328
val status: String,
2429

2530
/**
2631
* Is attribute required?
2732
*
2833
*/
34+
@SerializedName("required")
2935
val required: Boolean,
3036

3137
/**
3238
* Is attribute an array?
3339
*
3440
*/
41+
@SerializedName("array")
3542
var array: Boolean?,
3643

3744
/**
3845
* Array of elements in enumerated type.
3946
*
4047
*/
48+
@SerializedName("elements")
4149
val elements: List<Any>,
4250

4351
/**
4452
* String format.
4553
*
4654
*/
55+
@SerializedName("format")
4756
val format: String,
4857

4958
/**
5059
* Default value for attribute when not provided. Cannot be set when attribute is required.
5160
*
5261
*/
62+
@SerializedName("default")
5363
var default: String?
5464
) {
5565
companion object {

src/main/kotlin/io/appwrite/models/AttributeFloat.kt

+13-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
package io.appwrite.models
22

3+
import com.google.gson.annotations.SerializedName
4+
35
/**
46
* AttributeFloat
57
*/
@@ -8,48 +10,56 @@ data class AttributeFloat(
810
* Attribute Key.
911
*
1012
*/
13+
@SerializedName("key")
1114
val key: String,
1215

1316
/**
1417
* Attribute type.
1518
*
1619
*/
20+
@SerializedName("type")
1721
val type: String,
1822

1923
/**
2024
* Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed`
2125
*
2226
*/
27+
@SerializedName("status")
2328
val status: String,
2429

2530
/**
2631
* Is attribute required?
2732
*
2833
*/
34+
@SerializedName("required")
2935
val required: Boolean,
3036

3137
/**
3238
* Is attribute an array?
3339
*
3440
*/
41+
@SerializedName("array")
3542
var array: Boolean?,
3643

3744
/**
3845
* Minimum value to enforce for new documents.
3946
*
4047
*/
48+
@SerializedName("min")
4149
var min: Double?,
4250

4351
/**
4452
* Maximum value to enforce for new documents.
4553
*
4654
*/
55+
@SerializedName("max")
4756
var max: Double?,
4857

4958
/**
5059
* Default value for attribute when not provided. Cannot be set when attribute is required.
5160
*
5261
*/
62+
@SerializedName("default")
5363
var default: Double?
5464
) {
5565
companion object {
@@ -60,9 +70,9 @@ data class AttributeFloat(
6070
status = map["status"] as String,
6171
required = map["required"] as Boolean,
6272
array = map["array"] as? Boolean,
63-
min = (map["min"] as Number).toDouble(),
64-
max = (map["max"] as Number).toDouble(),
65-
default = (map["default"] as Number).toDouble()
73+
min = (map["min"] as? Number)?.toDouble(),
74+
max = (map["max"] as? Number)?.toDouble(),
75+
default = (map["default"] as? Number)?.toDouble()
6676
)
6777
}
6878

src/main/kotlin/io/appwrite/models/AttributeInteger.kt

+13-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
package io.appwrite.models
22

3+
import com.google.gson.annotations.SerializedName
4+
35
/**
46
* AttributeInteger
57
*/
@@ -8,48 +10,56 @@ data class AttributeInteger(
810
* Attribute Key.
911
*
1012
*/
13+
@SerializedName("key")
1114
val key: String,
1215

1316
/**
1417
* Attribute type.
1518
*
1619
*/
20+
@SerializedName("type")
1721
val type: String,
1822

1923
/**
2024
* Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed`
2125
*
2226
*/
27+
@SerializedName("status")
2328
val status: String,
2429

2530
/**
2631
* Is attribute required?
2732
*
2833
*/
34+
@SerializedName("required")
2935
val required: Boolean,
3036

3137
/**
3238
* Is attribute an array?
3339
*
3440
*/
41+
@SerializedName("array")
3542
var array: Boolean?,
3643

3744
/**
3845
* Minimum value to enforce for new documents.
3946
*
4047
*/
48+
@SerializedName("min")
4149
var min: Long?,
4250

4351
/**
4452
* Maximum value to enforce for new documents.
4553
*
4654
*/
55+
@SerializedName("max")
4756
var max: Long?,
4857

4958
/**
5059
* Default value for attribute when not provided. Cannot be set when attribute is required.
5160
*
5261
*/
62+
@SerializedName("default")
5363
var default: Long?
5464
) {
5565
companion object {
@@ -60,9 +70,9 @@ data class AttributeInteger(
6070
status = map["status"] as String,
6171
required = map["required"] as Boolean,
6272
array = map["array"] as? Boolean,
63-
min = (map["min"] as Number).toLong(),
64-
max = (map["max"] as Number).toLong(),
65-
default = (map["default"] as Number).toLong()
73+
min = (map["min"] as? Number)?.toLong(),
74+
max = (map["max"] as? Number)?.toLong(),
75+
default = (map["default"] as? Number)?.toLong()
6676
)
6777
}
6878

0 commit comments

Comments
 (0)