diff --git a/README.md b/README.md index 84aa27a..7d3167b 100644 --- a/README.md +++ b/README.md @@ -39,7 +39,7 @@ repositories { Next, add the dependency to your project's `build.gradle(.kts)` file: ```groovy -implementation("io.appwrite:sdk-for-kotlin:11.1.0") +implementation("io.appwrite:sdk-for-kotlin:12.0.0") ``` ### Maven @@ -50,7 +50,7 @@ Add this to your project's `pom.xml` file: io.appwrite sdk-for-kotlin - 11.1.0 + 12.0.0 ``` diff --git a/src/main/kotlin/io/appwrite/Client.kt b/src/main/kotlin/io/appwrite/Client.kt index 2caf253..c67d473 100644 --- a/src/main/kotlin/io/appwrite/Client.kt +++ b/src/main/kotlin/io/appwrite/Client.kt @@ -58,11 +58,11 @@ class Client @JvmOverloads constructor( init { headers = mutableMapOf( "content-type" to "application/json", - "user-agent" to "AppwriteKotlinSDK/11.1.0 ${System.getProperty("http.agent")}", + "user-agent" to "AppwriteKotlinSDK/12.0.0 ${System.getProperty("http.agent")}", "x-sdk-name" to "Kotlin", "x-sdk-platform" to "server", "x-sdk-language" to "kotlin", - "x-sdk-version" to "11.1.0", + "x-sdk-version" to "12.0.0", "x-appwrite-response-format" to "1.8.0", ) @@ -617,7 +617,7 @@ class Client @JvmOverloads constructor( val warnings = response.headers["x-appwrite-warning"] if (warnings != null) { warnings.split(";").forEach { warning -> - println("Warning: $warning") + System.err.println("Warning: $warning") } } diff --git a/src/main/kotlin/io/appwrite/enums/AttributeStatus.kt b/src/main/kotlin/io/appwrite/enums/AttributeStatus.kt new file mode 100644 index 0000000..346a403 --- /dev/null +++ b/src/main/kotlin/io/appwrite/enums/AttributeStatus.kt @@ -0,0 +1,18 @@ +package io.appwrite.enums + +import com.google.gson.annotations.SerializedName + +enum class AttributeStatus(val value: String) { + @SerializedName("available") + AVAILABLE("available"), + @SerializedName("processing") + PROCESSING("processing"), + @SerializedName("deleting") + DELETING("deleting"), + @SerializedName("stuck") + STUCK("stuck"), + @SerializedName("failed") + FAILED("failed"); + + override fun toString() = value +} \ No newline at end of file diff --git a/src/main/kotlin/io/appwrite/enums/ColumnStatus.kt b/src/main/kotlin/io/appwrite/enums/ColumnStatus.kt new file mode 100644 index 0000000..906abee --- /dev/null +++ b/src/main/kotlin/io/appwrite/enums/ColumnStatus.kt @@ -0,0 +1,18 @@ +package io.appwrite.enums + +import com.google.gson.annotations.SerializedName + +enum class ColumnStatus(val value: String) { + @SerializedName("available") + AVAILABLE("available"), + @SerializedName("processing") + PROCESSING("processing"), + @SerializedName("deleting") + DELETING("deleting"), + @SerializedName("stuck") + STUCK("stuck"), + @SerializedName("failed") + FAILED("failed"); + + override fun toString() = value +} \ No newline at end of file diff --git a/src/main/kotlin/io/appwrite/enums/DatabaseType.kt b/src/main/kotlin/io/appwrite/enums/DatabaseType.kt new file mode 100644 index 0000000..8aeb0f4 --- /dev/null +++ b/src/main/kotlin/io/appwrite/enums/DatabaseType.kt @@ -0,0 +1,12 @@ +package io.appwrite.enums + +import com.google.gson.annotations.SerializedName + +enum class DatabaseType(val value: String) { + @SerializedName("legacy") + LEGACY("legacy"), + @SerializedName("tablesdb") + TABLESDB("tablesdb"); + + override fun toString() = value +} \ No newline at end of file diff --git a/src/main/kotlin/io/appwrite/enums/DeploymentStatus.kt b/src/main/kotlin/io/appwrite/enums/DeploymentStatus.kt new file mode 100644 index 0000000..56efc1f --- /dev/null +++ b/src/main/kotlin/io/appwrite/enums/DeploymentStatus.kt @@ -0,0 +1,18 @@ +package io.appwrite.enums + +import com.google.gson.annotations.SerializedName + +enum class DeploymentStatus(val value: String) { + @SerializedName("waiting") + WAITING("waiting"), + @SerializedName("processing") + PROCESSING("processing"), + @SerializedName("building") + BUILDING("building"), + @SerializedName("ready") + READY("ready"), + @SerializedName("failed") + FAILED("failed"); + + override fun toString() = value +} \ No newline at end of file diff --git a/src/main/kotlin/io/appwrite/enums/ExecutionStatus.kt b/src/main/kotlin/io/appwrite/enums/ExecutionStatus.kt new file mode 100644 index 0000000..6944c55 --- /dev/null +++ b/src/main/kotlin/io/appwrite/enums/ExecutionStatus.kt @@ -0,0 +1,16 @@ +package io.appwrite.enums + +import com.google.gson.annotations.SerializedName + +enum class ExecutionStatus(val value: String) { + @SerializedName("waiting") + WAITING("waiting"), + @SerializedName("processing") + PROCESSING("processing"), + @SerializedName("completed") + COMPLETED("completed"), + @SerializedName("failed") + FAILED("failed"); + + override fun toString() = value +} \ No newline at end of file diff --git a/src/main/kotlin/io/appwrite/enums/ExecutionTrigger.kt b/src/main/kotlin/io/appwrite/enums/ExecutionTrigger.kt new file mode 100644 index 0000000..e8bb981 --- /dev/null +++ b/src/main/kotlin/io/appwrite/enums/ExecutionTrigger.kt @@ -0,0 +1,14 @@ +package io.appwrite.enums + +import com.google.gson.annotations.SerializedName + +enum class ExecutionTrigger(val value: String) { + @SerializedName("http") + HTTP("http"), + @SerializedName("schedule") + SCHEDULE("schedule"), + @SerializedName("event") + EVENT("event"); + + override fun toString() = value +} \ No newline at end of file diff --git a/src/main/kotlin/io/appwrite/enums/HealthAntivirusStatus.kt b/src/main/kotlin/io/appwrite/enums/HealthAntivirusStatus.kt new file mode 100644 index 0000000..e2efeed --- /dev/null +++ b/src/main/kotlin/io/appwrite/enums/HealthAntivirusStatus.kt @@ -0,0 +1,14 @@ +package io.appwrite.enums + +import com.google.gson.annotations.SerializedName + +enum class HealthAntivirusStatus(val value: String) { + @SerializedName("disabled") + DISABLED("disabled"), + @SerializedName("offline") + OFFLINE("offline"), + @SerializedName("online") + ONLINE("online"); + + override fun toString() = value +} \ No newline at end of file diff --git a/src/main/kotlin/io/appwrite/enums/HealthCheckStatus.kt b/src/main/kotlin/io/appwrite/enums/HealthCheckStatus.kt new file mode 100644 index 0000000..13db083 --- /dev/null +++ b/src/main/kotlin/io/appwrite/enums/HealthCheckStatus.kt @@ -0,0 +1,12 @@ +package io.appwrite.enums + +import com.google.gson.annotations.SerializedName + +enum class HealthCheckStatus(val value: String) { + @SerializedName("pass") + PASS("pass"), + @SerializedName("fail") + FAIL("fail"); + + override fun toString() = value +} \ No newline at end of file diff --git a/src/main/kotlin/io/appwrite/enums/IndexStatus.kt b/src/main/kotlin/io/appwrite/enums/IndexStatus.kt new file mode 100644 index 0000000..1a8fcd3 --- /dev/null +++ b/src/main/kotlin/io/appwrite/enums/IndexStatus.kt @@ -0,0 +1,18 @@ +package io.appwrite.enums + +import com.google.gson.annotations.SerializedName + +enum class IndexStatus(val value: String) { + @SerializedName("available") + AVAILABLE("available"), + @SerializedName("processing") + PROCESSING("processing"), + @SerializedName("deleting") + DELETING("deleting"), + @SerializedName("stuck") + STUCK("stuck"), + @SerializedName("failed") + FAILED("failed"); + + override fun toString() = value +} \ No newline at end of file diff --git a/src/main/kotlin/io/appwrite/enums/MessageStatus.kt b/src/main/kotlin/io/appwrite/enums/MessageStatus.kt new file mode 100644 index 0000000..00e453c --- /dev/null +++ b/src/main/kotlin/io/appwrite/enums/MessageStatus.kt @@ -0,0 +1,18 @@ +package io.appwrite.enums + +import com.google.gson.annotations.SerializedName + +enum class MessageStatus(val value: String) { + @SerializedName("draft") + DRAFT("draft"), + @SerializedName("processing") + PROCESSING("processing"), + @SerializedName("scheduled") + SCHEDULED("scheduled"), + @SerializedName("sent") + SENT("sent"), + @SerializedName("failed") + FAILED("failed"); + + override fun toString() = value +} \ No newline at end of file diff --git a/src/main/kotlin/io/appwrite/models/AttributeBoolean.kt b/src/main/kotlin/io/appwrite/models/AttributeBoolean.kt index 2f8477c..7e1d100 100644 --- a/src/main/kotlin/io/appwrite/models/AttributeBoolean.kt +++ b/src/main/kotlin/io/appwrite/models/AttributeBoolean.kt @@ -2,6 +2,7 @@ package io.appwrite.models import com.google.gson.annotations.SerializedName import io.appwrite.extensions.jsonCast +import io.appwrite.enums.AttributeStatus /** * AttributeBoolean @@ -23,7 +24,7 @@ data class AttributeBoolean( * Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` */ @SerializedName("status") - val status: String, + val status: AttributeStatus, /** * Error message. Displays error generated on failure of creating or deleting an attribute. @@ -65,7 +66,7 @@ data class AttributeBoolean( fun toMap(): Map = mapOf( "key" to key as Any, "type" to type as Any, - "status" to status as Any, + "status" to status.value as Any, "error" to error as Any, "required" to required as Any, "array" to array as Any, @@ -82,13 +83,13 @@ data class AttributeBoolean( ) = AttributeBoolean( key = map["key"] as String, type = map["type"] as String, - status = map["status"] as String, + status = AttributeStatus.values().find { it.value == map["status"] as String }!!, error = map["error"] as String, required = map["required"] as Boolean, - array = map["array"] as? Boolean?, + array = map["array"] as? Boolean, createdAt = map["\$createdAt"] as String, updatedAt = map["\$updatedAt"] as String, - default = map["default"] as? Boolean?, + default = map["default"] as? Boolean, ) } } \ No newline at end of file diff --git a/src/main/kotlin/io/appwrite/models/AttributeDatetime.kt b/src/main/kotlin/io/appwrite/models/AttributeDatetime.kt index 8ae71ef..3f3a1e1 100644 --- a/src/main/kotlin/io/appwrite/models/AttributeDatetime.kt +++ b/src/main/kotlin/io/appwrite/models/AttributeDatetime.kt @@ -2,6 +2,7 @@ package io.appwrite.models import com.google.gson.annotations.SerializedName import io.appwrite.extensions.jsonCast +import io.appwrite.enums.AttributeStatus /** * AttributeDatetime @@ -23,7 +24,7 @@ data class AttributeDatetime( * Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` */ @SerializedName("status") - val status: String, + val status: AttributeStatus, /** * Error message. Displays error generated on failure of creating or deleting an attribute. @@ -71,7 +72,7 @@ data class AttributeDatetime( fun toMap(): Map = mapOf( "key" to key as Any, "type" to type as Any, - "status" to status as Any, + "status" to status.value as Any, "error" to error as Any, "required" to required as Any, "array" to array as Any, @@ -89,14 +90,14 @@ data class AttributeDatetime( ) = AttributeDatetime( key = map["key"] as String, type = map["type"] as String, - status = map["status"] as String, + status = AttributeStatus.values().find { it.value == map["status"] as String }!!, error = map["error"] as String, required = map["required"] as Boolean, - array = map["array"] as? Boolean?, + array = map["array"] as? Boolean, createdAt = map["\$createdAt"] as String, updatedAt = map["\$updatedAt"] as String, format = map["format"] as String, - default = map["default"] as? String?, + default = map["default"] as? String, ) } } \ No newline at end of file diff --git a/src/main/kotlin/io/appwrite/models/AttributeEmail.kt b/src/main/kotlin/io/appwrite/models/AttributeEmail.kt index 87bd1b3..2151802 100644 --- a/src/main/kotlin/io/appwrite/models/AttributeEmail.kt +++ b/src/main/kotlin/io/appwrite/models/AttributeEmail.kt @@ -2,6 +2,7 @@ package io.appwrite.models import com.google.gson.annotations.SerializedName import io.appwrite.extensions.jsonCast +import io.appwrite.enums.AttributeStatus /** * AttributeEmail @@ -23,7 +24,7 @@ data class AttributeEmail( * Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` */ @SerializedName("status") - val status: String, + val status: AttributeStatus, /** * Error message. Displays error generated on failure of creating or deleting an attribute. @@ -71,7 +72,7 @@ data class AttributeEmail( fun toMap(): Map = mapOf( "key" to key as Any, "type" to type as Any, - "status" to status as Any, + "status" to status.value as Any, "error" to error as Any, "required" to required as Any, "array" to array as Any, @@ -89,14 +90,14 @@ data class AttributeEmail( ) = AttributeEmail( key = map["key"] as String, type = map["type"] as String, - status = map["status"] as String, + status = AttributeStatus.values().find { it.value == map["status"] as String }!!, error = map["error"] as String, required = map["required"] as Boolean, - array = map["array"] as? Boolean?, + array = map["array"] as? Boolean, createdAt = map["\$createdAt"] as String, updatedAt = map["\$updatedAt"] as String, format = map["format"] as String, - default = map["default"] as? String?, + default = map["default"] as? String, ) } } \ No newline at end of file diff --git a/src/main/kotlin/io/appwrite/models/AttributeEnum.kt b/src/main/kotlin/io/appwrite/models/AttributeEnum.kt index c8af621..275df1f 100644 --- a/src/main/kotlin/io/appwrite/models/AttributeEnum.kt +++ b/src/main/kotlin/io/appwrite/models/AttributeEnum.kt @@ -2,6 +2,7 @@ package io.appwrite.models import com.google.gson.annotations.SerializedName import io.appwrite.extensions.jsonCast +import io.appwrite.enums.AttributeStatus /** * AttributeEnum @@ -23,7 +24,7 @@ data class AttributeEnum( * Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` */ @SerializedName("status") - val status: String, + val status: AttributeStatus, /** * Error message. Displays error generated on failure of creating or deleting an attribute. @@ -77,7 +78,7 @@ data class AttributeEnum( fun toMap(): Map = mapOf( "key" to key as Any, "type" to type as Any, - "status" to status as Any, + "status" to status.value as Any, "error" to error as Any, "required" to required as Any, "array" to array as Any, @@ -96,15 +97,15 @@ data class AttributeEnum( ) = AttributeEnum( key = map["key"] as String, type = map["type"] as String, - status = map["status"] as String, + status = AttributeStatus.values().find { it.value == map["status"] as String }!!, error = map["error"] as String, required = map["required"] as Boolean, - array = map["array"] as? Boolean?, + array = map["array"] as? Boolean, createdAt = map["\$createdAt"] as String, updatedAt = map["\$updatedAt"] as String, elements = map["elements"] as List, format = map["format"] as String, - default = map["default"] as? String?, + default = map["default"] as? String, ) } } \ No newline at end of file diff --git a/src/main/kotlin/io/appwrite/models/AttributeFloat.kt b/src/main/kotlin/io/appwrite/models/AttributeFloat.kt index 0e8d549..c2e5609 100644 --- a/src/main/kotlin/io/appwrite/models/AttributeFloat.kt +++ b/src/main/kotlin/io/appwrite/models/AttributeFloat.kt @@ -2,6 +2,7 @@ package io.appwrite.models import com.google.gson.annotations.SerializedName import io.appwrite.extensions.jsonCast +import io.appwrite.enums.AttributeStatus /** * AttributeFloat @@ -23,7 +24,7 @@ data class AttributeFloat( * Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` */ @SerializedName("status") - val status: String, + val status: AttributeStatus, /** * Error message. Displays error generated on failure of creating or deleting an attribute. @@ -77,7 +78,7 @@ data class AttributeFloat( fun toMap(): Map = mapOf( "key" to key as Any, "type" to type as Any, - "status" to status as Any, + "status" to status.value as Any, "error" to error as Any, "required" to required as Any, "array" to array as Any, @@ -96,10 +97,10 @@ data class AttributeFloat( ) = AttributeFloat( key = map["key"] as String, type = map["type"] as String, - status = map["status"] as String, + status = AttributeStatus.values().find { it.value == map["status"] as String }!!, error = map["error"] as String, required = map["required"] as Boolean, - array = map["array"] as? Boolean?, + array = map["array"] as? Boolean, createdAt = map["\$createdAt"] as String, updatedAt = map["\$updatedAt"] as String, min = (map["min"] as? Number)?.toDouble(), diff --git a/src/main/kotlin/io/appwrite/models/AttributeInteger.kt b/src/main/kotlin/io/appwrite/models/AttributeInteger.kt index 327bd9f..05e7348 100644 --- a/src/main/kotlin/io/appwrite/models/AttributeInteger.kt +++ b/src/main/kotlin/io/appwrite/models/AttributeInteger.kt @@ -2,6 +2,7 @@ package io.appwrite.models import com.google.gson.annotations.SerializedName import io.appwrite.extensions.jsonCast +import io.appwrite.enums.AttributeStatus /** * AttributeInteger @@ -23,7 +24,7 @@ data class AttributeInteger( * Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` */ @SerializedName("status") - val status: String, + val status: AttributeStatus, /** * Error message. Displays error generated on failure of creating or deleting an attribute. @@ -77,7 +78,7 @@ data class AttributeInteger( fun toMap(): Map = mapOf( "key" to key as Any, "type" to type as Any, - "status" to status as Any, + "status" to status.value as Any, "error" to error as Any, "required" to required as Any, "array" to array as Any, @@ -96,10 +97,10 @@ data class AttributeInteger( ) = AttributeInteger( key = map["key"] as String, type = map["type"] as String, - status = map["status"] as String, + status = AttributeStatus.values().find { it.value == map["status"] as String }!!, error = map["error"] as String, required = map["required"] as Boolean, - array = map["array"] as? Boolean?, + array = map["array"] as? Boolean, createdAt = map["\$createdAt"] as String, updatedAt = map["\$updatedAt"] as String, min = (map["min"] as? Number)?.toLong(), diff --git a/src/main/kotlin/io/appwrite/models/AttributeIp.kt b/src/main/kotlin/io/appwrite/models/AttributeIp.kt index b366ff2..b413339 100644 --- a/src/main/kotlin/io/appwrite/models/AttributeIp.kt +++ b/src/main/kotlin/io/appwrite/models/AttributeIp.kt @@ -2,6 +2,7 @@ package io.appwrite.models import com.google.gson.annotations.SerializedName import io.appwrite.extensions.jsonCast +import io.appwrite.enums.AttributeStatus /** * AttributeIP @@ -23,7 +24,7 @@ data class AttributeIp( * Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` */ @SerializedName("status") - val status: String, + val status: AttributeStatus, /** * Error message. Displays error generated on failure of creating or deleting an attribute. @@ -71,7 +72,7 @@ data class AttributeIp( fun toMap(): Map = mapOf( "key" to key as Any, "type" to type as Any, - "status" to status as Any, + "status" to status.value as Any, "error" to error as Any, "required" to required as Any, "array" to array as Any, @@ -89,14 +90,14 @@ data class AttributeIp( ) = AttributeIp( key = map["key"] as String, type = map["type"] as String, - status = map["status"] as String, + status = AttributeStatus.values().find { it.value == map["status"] as String }!!, error = map["error"] as String, required = map["required"] as Boolean, - array = map["array"] as? Boolean?, + array = map["array"] as? Boolean, createdAt = map["\$createdAt"] as String, updatedAt = map["\$updatedAt"] as String, format = map["format"] as String, - default = map["default"] as? String?, + default = map["default"] as? String, ) } } \ No newline at end of file diff --git a/src/main/kotlin/io/appwrite/models/AttributeLine.kt b/src/main/kotlin/io/appwrite/models/AttributeLine.kt index cd1e977..cc959f1 100644 --- a/src/main/kotlin/io/appwrite/models/AttributeLine.kt +++ b/src/main/kotlin/io/appwrite/models/AttributeLine.kt @@ -2,6 +2,7 @@ package io.appwrite.models import com.google.gson.annotations.SerializedName import io.appwrite.extensions.jsonCast +import io.appwrite.enums.AttributeStatus /** * AttributeLine @@ -23,7 +24,7 @@ data class AttributeLine( * Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` */ @SerializedName("status") - val status: String, + val status: AttributeStatus, /** * Error message. Displays error generated on failure of creating or deleting an attribute. @@ -65,7 +66,7 @@ data class AttributeLine( fun toMap(): Map = mapOf( "key" to key as Any, "type" to type as Any, - "status" to status as Any, + "status" to status.value as Any, "error" to error as Any, "required" to required as Any, "array" to array as Any, @@ -82,13 +83,13 @@ data class AttributeLine( ) = AttributeLine( key = map["key"] as String, type = map["type"] as String, - status = map["status"] as String, + status = AttributeStatus.values().find { it.value == map["status"] as String }!!, error = map["error"] as String, required = map["required"] as Boolean, - array = map["array"] as? Boolean?, + array = map["array"] as? Boolean, createdAt = map["\$createdAt"] as String, updatedAt = map["\$updatedAt"] as String, - default = map["default"] as? List?, + default = map["default"] as? List, ) } } \ No newline at end of file diff --git a/src/main/kotlin/io/appwrite/models/AttributePoint.kt b/src/main/kotlin/io/appwrite/models/AttributePoint.kt index b32c1c0..5e07194 100644 --- a/src/main/kotlin/io/appwrite/models/AttributePoint.kt +++ b/src/main/kotlin/io/appwrite/models/AttributePoint.kt @@ -2,6 +2,7 @@ package io.appwrite.models import com.google.gson.annotations.SerializedName import io.appwrite.extensions.jsonCast +import io.appwrite.enums.AttributeStatus /** * AttributePoint @@ -23,7 +24,7 @@ data class AttributePoint( * Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` */ @SerializedName("status") - val status: String, + val status: AttributeStatus, /** * Error message. Displays error generated on failure of creating or deleting an attribute. @@ -65,7 +66,7 @@ data class AttributePoint( fun toMap(): Map = mapOf( "key" to key as Any, "type" to type as Any, - "status" to status as Any, + "status" to status.value as Any, "error" to error as Any, "required" to required as Any, "array" to array as Any, @@ -82,13 +83,13 @@ data class AttributePoint( ) = AttributePoint( key = map["key"] as String, type = map["type"] as String, - status = map["status"] as String, + status = AttributeStatus.values().find { it.value == map["status"] as String }!!, error = map["error"] as String, required = map["required"] as Boolean, - array = map["array"] as? Boolean?, + array = map["array"] as? Boolean, createdAt = map["\$createdAt"] as String, updatedAt = map["\$updatedAt"] as String, - default = map["default"] as? List?, + default = map["default"] as? List, ) } } \ No newline at end of file diff --git a/src/main/kotlin/io/appwrite/models/AttributePolygon.kt b/src/main/kotlin/io/appwrite/models/AttributePolygon.kt index bcccce1..74a4070 100644 --- a/src/main/kotlin/io/appwrite/models/AttributePolygon.kt +++ b/src/main/kotlin/io/appwrite/models/AttributePolygon.kt @@ -2,6 +2,7 @@ package io.appwrite.models import com.google.gson.annotations.SerializedName import io.appwrite.extensions.jsonCast +import io.appwrite.enums.AttributeStatus /** * AttributePolygon @@ -23,7 +24,7 @@ data class AttributePolygon( * Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` */ @SerializedName("status") - val status: String, + val status: AttributeStatus, /** * Error message. Displays error generated on failure of creating or deleting an attribute. @@ -65,7 +66,7 @@ data class AttributePolygon( fun toMap(): Map = mapOf( "key" to key as Any, "type" to type as Any, - "status" to status as Any, + "status" to status.value as Any, "error" to error as Any, "required" to required as Any, "array" to array as Any, @@ -82,13 +83,13 @@ data class AttributePolygon( ) = AttributePolygon( key = map["key"] as String, type = map["type"] as String, - status = map["status"] as String, + status = AttributeStatus.values().find { it.value == map["status"] as String }!!, error = map["error"] as String, required = map["required"] as Boolean, - array = map["array"] as? Boolean?, + array = map["array"] as? Boolean, createdAt = map["\$createdAt"] as String, updatedAt = map["\$updatedAt"] as String, - default = map["default"] as? List?, + default = map["default"] as? List, ) } } \ No newline at end of file diff --git a/src/main/kotlin/io/appwrite/models/AttributeRelationship.kt b/src/main/kotlin/io/appwrite/models/AttributeRelationship.kt index a03def7..0caba0b 100644 --- a/src/main/kotlin/io/appwrite/models/AttributeRelationship.kt +++ b/src/main/kotlin/io/appwrite/models/AttributeRelationship.kt @@ -2,6 +2,7 @@ package io.appwrite.models import com.google.gson.annotations.SerializedName import io.appwrite.extensions.jsonCast +import io.appwrite.enums.AttributeStatus /** * AttributeRelationship @@ -23,7 +24,7 @@ data class AttributeRelationship( * Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` */ @SerializedName("status") - val status: String, + val status: AttributeStatus, /** * Error message. Displays error generated on failure of creating or deleting an attribute. @@ -95,7 +96,7 @@ data class AttributeRelationship( fun toMap(): Map = mapOf( "key" to key as Any, "type" to type as Any, - "status" to status as Any, + "status" to status.value as Any, "error" to error as Any, "required" to required as Any, "array" to array as Any, @@ -117,10 +118,10 @@ data class AttributeRelationship( ) = AttributeRelationship( key = map["key"] as String, type = map["type"] as String, - status = map["status"] as String, + status = AttributeStatus.values().find { it.value == map["status"] as String }!!, error = map["error"] as String, required = map["required"] as Boolean, - array = map["array"] as? Boolean?, + array = map["array"] as? Boolean, createdAt = map["\$createdAt"] as String, updatedAt = map["\$updatedAt"] as String, relatedCollection = map["relatedCollection"] as String, diff --git a/src/main/kotlin/io/appwrite/models/AttributeString.kt b/src/main/kotlin/io/appwrite/models/AttributeString.kt index 161d7b8..0de6c14 100644 --- a/src/main/kotlin/io/appwrite/models/AttributeString.kt +++ b/src/main/kotlin/io/appwrite/models/AttributeString.kt @@ -2,6 +2,7 @@ package io.appwrite.models import com.google.gson.annotations.SerializedName import io.appwrite.extensions.jsonCast +import io.appwrite.enums.AttributeStatus /** * AttributeString @@ -23,7 +24,7 @@ data class AttributeString( * Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` */ @SerializedName("status") - val status: String, + val status: AttributeStatus, /** * Error message. Displays error generated on failure of creating or deleting an attribute. @@ -77,7 +78,7 @@ data class AttributeString( fun toMap(): Map = mapOf( "key" to key as Any, "type" to type as Any, - "status" to status as Any, + "status" to status.value as Any, "error" to error as Any, "required" to required as Any, "array" to array as Any, @@ -96,15 +97,15 @@ data class AttributeString( ) = AttributeString( key = map["key"] as String, type = map["type"] as String, - status = map["status"] as String, + status = AttributeStatus.values().find { it.value == map["status"] as String }!!, error = map["error"] as String, required = map["required"] as Boolean, - array = map["array"] as? Boolean?, + array = map["array"] as? Boolean, createdAt = map["\$createdAt"] as String, updatedAt = map["\$updatedAt"] as String, size = (map["size"] as Number).toLong(), - default = map["default"] as? String?, - encrypt = map["encrypt"] as? Boolean?, + default = map["default"] as? String, + encrypt = map["encrypt"] as? Boolean, ) } } \ No newline at end of file diff --git a/src/main/kotlin/io/appwrite/models/AttributeUrl.kt b/src/main/kotlin/io/appwrite/models/AttributeUrl.kt index d29ba7e..7dacd0e 100644 --- a/src/main/kotlin/io/appwrite/models/AttributeUrl.kt +++ b/src/main/kotlin/io/appwrite/models/AttributeUrl.kt @@ -2,6 +2,7 @@ package io.appwrite.models import com.google.gson.annotations.SerializedName import io.appwrite.extensions.jsonCast +import io.appwrite.enums.AttributeStatus /** * AttributeURL @@ -23,7 +24,7 @@ data class AttributeUrl( * Attribute status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` */ @SerializedName("status") - val status: String, + val status: AttributeStatus, /** * Error message. Displays error generated on failure of creating or deleting an attribute. @@ -71,7 +72,7 @@ data class AttributeUrl( fun toMap(): Map = mapOf( "key" to key as Any, "type" to type as Any, - "status" to status as Any, + "status" to status.value as Any, "error" to error as Any, "required" to required as Any, "array" to array as Any, @@ -89,14 +90,14 @@ data class AttributeUrl( ) = AttributeUrl( key = map["key"] as String, type = map["type"] as String, - status = map["status"] as String, + status = AttributeStatus.values().find { it.value == map["status"] as String }!!, error = map["error"] as String, required = map["required"] as Boolean, - array = map["array"] as? Boolean?, + array = map["array"] as? Boolean, createdAt = map["\$createdAt"] as String, updatedAt = map["\$updatedAt"] as String, format = map["format"] as String, - default = map["default"] as? String?, + default = map["default"] as? String, ) } } \ No newline at end of file diff --git a/src/main/kotlin/io/appwrite/models/ColumnBoolean.kt b/src/main/kotlin/io/appwrite/models/ColumnBoolean.kt index e55bb22..cb1faa5 100644 --- a/src/main/kotlin/io/appwrite/models/ColumnBoolean.kt +++ b/src/main/kotlin/io/appwrite/models/ColumnBoolean.kt @@ -2,6 +2,7 @@ package io.appwrite.models import com.google.gson.annotations.SerializedName import io.appwrite.extensions.jsonCast +import io.appwrite.enums.ColumnStatus /** * ColumnBoolean @@ -23,7 +24,7 @@ data class ColumnBoolean( * Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` */ @SerializedName("status") - val status: String, + val status: ColumnStatus, /** * Error message. Displays error generated on failure of creating or deleting an column. @@ -65,7 +66,7 @@ data class ColumnBoolean( fun toMap(): Map = mapOf( "key" to key as Any, "type" to type as Any, - "status" to status as Any, + "status" to status.value as Any, "error" to error as Any, "required" to required as Any, "array" to array as Any, @@ -82,13 +83,13 @@ data class ColumnBoolean( ) = ColumnBoolean( key = map["key"] as String, type = map["type"] as String, - status = map["status"] as String, + status = ColumnStatus.values().find { it.value == map["status"] as String }!!, error = map["error"] as String, required = map["required"] as Boolean, - array = map["array"] as? Boolean?, + array = map["array"] as? Boolean, createdAt = map["\$createdAt"] as String, updatedAt = map["\$updatedAt"] as String, - default = map["default"] as? Boolean?, + default = map["default"] as? Boolean, ) } } \ No newline at end of file diff --git a/src/main/kotlin/io/appwrite/models/ColumnDatetime.kt b/src/main/kotlin/io/appwrite/models/ColumnDatetime.kt index fc35b86..5f97be1 100644 --- a/src/main/kotlin/io/appwrite/models/ColumnDatetime.kt +++ b/src/main/kotlin/io/appwrite/models/ColumnDatetime.kt @@ -2,6 +2,7 @@ package io.appwrite.models import com.google.gson.annotations.SerializedName import io.appwrite.extensions.jsonCast +import io.appwrite.enums.ColumnStatus /** * ColumnDatetime @@ -23,7 +24,7 @@ data class ColumnDatetime( * Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` */ @SerializedName("status") - val status: String, + val status: ColumnStatus, /** * Error message. Displays error generated on failure of creating or deleting an column. @@ -71,7 +72,7 @@ data class ColumnDatetime( fun toMap(): Map = mapOf( "key" to key as Any, "type" to type as Any, - "status" to status as Any, + "status" to status.value as Any, "error" to error as Any, "required" to required as Any, "array" to array as Any, @@ -89,14 +90,14 @@ data class ColumnDatetime( ) = ColumnDatetime( key = map["key"] as String, type = map["type"] as String, - status = map["status"] as String, + status = ColumnStatus.values().find { it.value == map["status"] as String }!!, error = map["error"] as String, required = map["required"] as Boolean, - array = map["array"] as? Boolean?, + array = map["array"] as? Boolean, createdAt = map["\$createdAt"] as String, updatedAt = map["\$updatedAt"] as String, format = map["format"] as String, - default = map["default"] as? String?, + default = map["default"] as? String, ) } } \ No newline at end of file diff --git a/src/main/kotlin/io/appwrite/models/ColumnEmail.kt b/src/main/kotlin/io/appwrite/models/ColumnEmail.kt index 4e190f7..a087bde 100644 --- a/src/main/kotlin/io/appwrite/models/ColumnEmail.kt +++ b/src/main/kotlin/io/appwrite/models/ColumnEmail.kt @@ -2,6 +2,7 @@ package io.appwrite.models import com.google.gson.annotations.SerializedName import io.appwrite.extensions.jsonCast +import io.appwrite.enums.ColumnStatus /** * ColumnEmail @@ -23,7 +24,7 @@ data class ColumnEmail( * Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` */ @SerializedName("status") - val status: String, + val status: ColumnStatus, /** * Error message. Displays error generated on failure of creating or deleting an column. @@ -71,7 +72,7 @@ data class ColumnEmail( fun toMap(): Map = mapOf( "key" to key as Any, "type" to type as Any, - "status" to status as Any, + "status" to status.value as Any, "error" to error as Any, "required" to required as Any, "array" to array as Any, @@ -89,14 +90,14 @@ data class ColumnEmail( ) = ColumnEmail( key = map["key"] as String, type = map["type"] as String, - status = map["status"] as String, + status = ColumnStatus.values().find { it.value == map["status"] as String }!!, error = map["error"] as String, required = map["required"] as Boolean, - array = map["array"] as? Boolean?, + array = map["array"] as? Boolean, createdAt = map["\$createdAt"] as String, updatedAt = map["\$updatedAt"] as String, format = map["format"] as String, - default = map["default"] as? String?, + default = map["default"] as? String, ) } } \ No newline at end of file diff --git a/src/main/kotlin/io/appwrite/models/ColumnEnum.kt b/src/main/kotlin/io/appwrite/models/ColumnEnum.kt index 45244b1..6bd6ef0 100644 --- a/src/main/kotlin/io/appwrite/models/ColumnEnum.kt +++ b/src/main/kotlin/io/appwrite/models/ColumnEnum.kt @@ -2,6 +2,7 @@ package io.appwrite.models import com.google.gson.annotations.SerializedName import io.appwrite.extensions.jsonCast +import io.appwrite.enums.ColumnStatus /** * ColumnEnum @@ -23,7 +24,7 @@ data class ColumnEnum( * Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` */ @SerializedName("status") - val status: String, + val status: ColumnStatus, /** * Error message. Displays error generated on failure of creating or deleting an column. @@ -77,7 +78,7 @@ data class ColumnEnum( fun toMap(): Map = mapOf( "key" to key as Any, "type" to type as Any, - "status" to status as Any, + "status" to status.value as Any, "error" to error as Any, "required" to required as Any, "array" to array as Any, @@ -96,15 +97,15 @@ data class ColumnEnum( ) = ColumnEnum( key = map["key"] as String, type = map["type"] as String, - status = map["status"] as String, + status = ColumnStatus.values().find { it.value == map["status"] as String }!!, error = map["error"] as String, required = map["required"] as Boolean, - array = map["array"] as? Boolean?, + array = map["array"] as? Boolean, createdAt = map["\$createdAt"] as String, updatedAt = map["\$updatedAt"] as String, elements = map["elements"] as List, format = map["format"] as String, - default = map["default"] as? String?, + default = map["default"] as? String, ) } } \ No newline at end of file diff --git a/src/main/kotlin/io/appwrite/models/ColumnFloat.kt b/src/main/kotlin/io/appwrite/models/ColumnFloat.kt index 77ec024..d1bc17a 100644 --- a/src/main/kotlin/io/appwrite/models/ColumnFloat.kt +++ b/src/main/kotlin/io/appwrite/models/ColumnFloat.kt @@ -2,6 +2,7 @@ package io.appwrite.models import com.google.gson.annotations.SerializedName import io.appwrite.extensions.jsonCast +import io.appwrite.enums.ColumnStatus /** * ColumnFloat @@ -23,7 +24,7 @@ data class ColumnFloat( * Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` */ @SerializedName("status") - val status: String, + val status: ColumnStatus, /** * Error message. Displays error generated on failure of creating or deleting an column. @@ -77,7 +78,7 @@ data class ColumnFloat( fun toMap(): Map = mapOf( "key" to key as Any, "type" to type as Any, - "status" to status as Any, + "status" to status.value as Any, "error" to error as Any, "required" to required as Any, "array" to array as Any, @@ -96,10 +97,10 @@ data class ColumnFloat( ) = ColumnFloat( key = map["key"] as String, type = map["type"] as String, - status = map["status"] as String, + status = ColumnStatus.values().find { it.value == map["status"] as String }!!, error = map["error"] as String, required = map["required"] as Boolean, - array = map["array"] as? Boolean?, + array = map["array"] as? Boolean, createdAt = map["\$createdAt"] as String, updatedAt = map["\$updatedAt"] as String, min = (map["min"] as? Number)?.toDouble(), diff --git a/src/main/kotlin/io/appwrite/models/ColumnIndex.kt b/src/main/kotlin/io/appwrite/models/ColumnIndex.kt index 617fbee..3ae6eca 100644 --- a/src/main/kotlin/io/appwrite/models/ColumnIndex.kt +++ b/src/main/kotlin/io/appwrite/models/ColumnIndex.kt @@ -96,7 +96,7 @@ data class ColumnIndex( error = map["error"] as String, columns = map["columns"] as List, lengths = map["lengths"] as List, - orders = map["orders"] as? List?, + orders = map["orders"] as? List, ) } } \ No newline at end of file diff --git a/src/main/kotlin/io/appwrite/models/ColumnInteger.kt b/src/main/kotlin/io/appwrite/models/ColumnInteger.kt index a827bd1..52495e7 100644 --- a/src/main/kotlin/io/appwrite/models/ColumnInteger.kt +++ b/src/main/kotlin/io/appwrite/models/ColumnInteger.kt @@ -2,6 +2,7 @@ package io.appwrite.models import com.google.gson.annotations.SerializedName import io.appwrite.extensions.jsonCast +import io.appwrite.enums.ColumnStatus /** * ColumnInteger @@ -23,7 +24,7 @@ data class ColumnInteger( * Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` */ @SerializedName("status") - val status: String, + val status: ColumnStatus, /** * Error message. Displays error generated on failure of creating or deleting an column. @@ -77,7 +78,7 @@ data class ColumnInteger( fun toMap(): Map = mapOf( "key" to key as Any, "type" to type as Any, - "status" to status as Any, + "status" to status.value as Any, "error" to error as Any, "required" to required as Any, "array" to array as Any, @@ -96,10 +97,10 @@ data class ColumnInteger( ) = ColumnInteger( key = map["key"] as String, type = map["type"] as String, - status = map["status"] as String, + status = ColumnStatus.values().find { it.value == map["status"] as String }!!, error = map["error"] as String, required = map["required"] as Boolean, - array = map["array"] as? Boolean?, + array = map["array"] as? Boolean, createdAt = map["\$createdAt"] as String, updatedAt = map["\$updatedAt"] as String, min = (map["min"] as? Number)?.toLong(), diff --git a/src/main/kotlin/io/appwrite/models/ColumnIp.kt b/src/main/kotlin/io/appwrite/models/ColumnIp.kt index b3741bb..7ce4234 100644 --- a/src/main/kotlin/io/appwrite/models/ColumnIp.kt +++ b/src/main/kotlin/io/appwrite/models/ColumnIp.kt @@ -2,6 +2,7 @@ package io.appwrite.models import com.google.gson.annotations.SerializedName import io.appwrite.extensions.jsonCast +import io.appwrite.enums.ColumnStatus /** * ColumnIP @@ -23,7 +24,7 @@ data class ColumnIp( * Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` */ @SerializedName("status") - val status: String, + val status: ColumnStatus, /** * Error message. Displays error generated on failure of creating or deleting an column. @@ -71,7 +72,7 @@ data class ColumnIp( fun toMap(): Map = mapOf( "key" to key as Any, "type" to type as Any, - "status" to status as Any, + "status" to status.value as Any, "error" to error as Any, "required" to required as Any, "array" to array as Any, @@ -89,14 +90,14 @@ data class ColumnIp( ) = ColumnIp( key = map["key"] as String, type = map["type"] as String, - status = map["status"] as String, + status = ColumnStatus.values().find { it.value == map["status"] as String }!!, error = map["error"] as String, required = map["required"] as Boolean, - array = map["array"] as? Boolean?, + array = map["array"] as? Boolean, createdAt = map["\$createdAt"] as String, updatedAt = map["\$updatedAt"] as String, format = map["format"] as String, - default = map["default"] as? String?, + default = map["default"] as? String, ) } } \ No newline at end of file diff --git a/src/main/kotlin/io/appwrite/models/ColumnLine.kt b/src/main/kotlin/io/appwrite/models/ColumnLine.kt index 6591821..616f056 100644 --- a/src/main/kotlin/io/appwrite/models/ColumnLine.kt +++ b/src/main/kotlin/io/appwrite/models/ColumnLine.kt @@ -2,6 +2,7 @@ package io.appwrite.models import com.google.gson.annotations.SerializedName import io.appwrite.extensions.jsonCast +import io.appwrite.enums.ColumnStatus /** * ColumnLine @@ -23,7 +24,7 @@ data class ColumnLine( * Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` */ @SerializedName("status") - val status: String, + val status: ColumnStatus, /** * Error message. Displays error generated on failure of creating or deleting an column. @@ -65,7 +66,7 @@ data class ColumnLine( fun toMap(): Map = mapOf( "key" to key as Any, "type" to type as Any, - "status" to status as Any, + "status" to status.value as Any, "error" to error as Any, "required" to required as Any, "array" to array as Any, @@ -82,13 +83,13 @@ data class ColumnLine( ) = ColumnLine( key = map["key"] as String, type = map["type"] as String, - status = map["status"] as String, + status = ColumnStatus.values().find { it.value == map["status"] as String }!!, error = map["error"] as String, required = map["required"] as Boolean, - array = map["array"] as? Boolean?, + array = map["array"] as? Boolean, createdAt = map["\$createdAt"] as String, updatedAt = map["\$updatedAt"] as String, - default = map["default"] as? List?, + default = map["default"] as? List, ) } } \ No newline at end of file diff --git a/src/main/kotlin/io/appwrite/models/ColumnPoint.kt b/src/main/kotlin/io/appwrite/models/ColumnPoint.kt index fd842b1..02ed7aa 100644 --- a/src/main/kotlin/io/appwrite/models/ColumnPoint.kt +++ b/src/main/kotlin/io/appwrite/models/ColumnPoint.kt @@ -2,6 +2,7 @@ package io.appwrite.models import com.google.gson.annotations.SerializedName import io.appwrite.extensions.jsonCast +import io.appwrite.enums.ColumnStatus /** * ColumnPoint @@ -23,7 +24,7 @@ data class ColumnPoint( * Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` */ @SerializedName("status") - val status: String, + val status: ColumnStatus, /** * Error message. Displays error generated on failure of creating or deleting an column. @@ -65,7 +66,7 @@ data class ColumnPoint( fun toMap(): Map = mapOf( "key" to key as Any, "type" to type as Any, - "status" to status as Any, + "status" to status.value as Any, "error" to error as Any, "required" to required as Any, "array" to array as Any, @@ -82,13 +83,13 @@ data class ColumnPoint( ) = ColumnPoint( key = map["key"] as String, type = map["type"] as String, - status = map["status"] as String, + status = ColumnStatus.values().find { it.value == map["status"] as String }!!, error = map["error"] as String, required = map["required"] as Boolean, - array = map["array"] as? Boolean?, + array = map["array"] as? Boolean, createdAt = map["\$createdAt"] as String, updatedAt = map["\$updatedAt"] as String, - default = map["default"] as? List?, + default = map["default"] as? List, ) } } \ No newline at end of file diff --git a/src/main/kotlin/io/appwrite/models/ColumnPolygon.kt b/src/main/kotlin/io/appwrite/models/ColumnPolygon.kt index e1c4268..5682070 100644 --- a/src/main/kotlin/io/appwrite/models/ColumnPolygon.kt +++ b/src/main/kotlin/io/appwrite/models/ColumnPolygon.kt @@ -2,6 +2,7 @@ package io.appwrite.models import com.google.gson.annotations.SerializedName import io.appwrite.extensions.jsonCast +import io.appwrite.enums.ColumnStatus /** * ColumnPolygon @@ -23,7 +24,7 @@ data class ColumnPolygon( * Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` */ @SerializedName("status") - val status: String, + val status: ColumnStatus, /** * Error message. Displays error generated on failure of creating or deleting an column. @@ -65,7 +66,7 @@ data class ColumnPolygon( fun toMap(): Map = mapOf( "key" to key as Any, "type" to type as Any, - "status" to status as Any, + "status" to status.value as Any, "error" to error as Any, "required" to required as Any, "array" to array as Any, @@ -82,13 +83,13 @@ data class ColumnPolygon( ) = ColumnPolygon( key = map["key"] as String, type = map["type"] as String, - status = map["status"] as String, + status = ColumnStatus.values().find { it.value == map["status"] as String }!!, error = map["error"] as String, required = map["required"] as Boolean, - array = map["array"] as? Boolean?, + array = map["array"] as? Boolean, createdAt = map["\$createdAt"] as String, updatedAt = map["\$updatedAt"] as String, - default = map["default"] as? List?, + default = map["default"] as? List, ) } } \ No newline at end of file diff --git a/src/main/kotlin/io/appwrite/models/ColumnRelationship.kt b/src/main/kotlin/io/appwrite/models/ColumnRelationship.kt index 5524b42..71a194e 100644 --- a/src/main/kotlin/io/appwrite/models/ColumnRelationship.kt +++ b/src/main/kotlin/io/appwrite/models/ColumnRelationship.kt @@ -2,6 +2,7 @@ package io.appwrite.models import com.google.gson.annotations.SerializedName import io.appwrite.extensions.jsonCast +import io.appwrite.enums.ColumnStatus /** * ColumnRelationship @@ -23,7 +24,7 @@ data class ColumnRelationship( * Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` */ @SerializedName("status") - val status: String, + val status: ColumnStatus, /** * Error message. Displays error generated on failure of creating or deleting an column. @@ -95,7 +96,7 @@ data class ColumnRelationship( fun toMap(): Map = mapOf( "key" to key as Any, "type" to type as Any, - "status" to status as Any, + "status" to status.value as Any, "error" to error as Any, "required" to required as Any, "array" to array as Any, @@ -117,10 +118,10 @@ data class ColumnRelationship( ) = ColumnRelationship( key = map["key"] as String, type = map["type"] as String, - status = map["status"] as String, + status = ColumnStatus.values().find { it.value == map["status"] as String }!!, error = map["error"] as String, required = map["required"] as Boolean, - array = map["array"] as? Boolean?, + array = map["array"] as? Boolean, createdAt = map["\$createdAt"] as String, updatedAt = map["\$updatedAt"] as String, relatedTable = map["relatedTable"] as String, diff --git a/src/main/kotlin/io/appwrite/models/ColumnString.kt b/src/main/kotlin/io/appwrite/models/ColumnString.kt index 773a8ce..4940971 100644 --- a/src/main/kotlin/io/appwrite/models/ColumnString.kt +++ b/src/main/kotlin/io/appwrite/models/ColumnString.kt @@ -2,6 +2,7 @@ package io.appwrite.models import com.google.gson.annotations.SerializedName import io.appwrite.extensions.jsonCast +import io.appwrite.enums.ColumnStatus /** * ColumnString @@ -23,7 +24,7 @@ data class ColumnString( * Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` */ @SerializedName("status") - val status: String, + val status: ColumnStatus, /** * Error message. Displays error generated on failure of creating or deleting an column. @@ -77,7 +78,7 @@ data class ColumnString( fun toMap(): Map = mapOf( "key" to key as Any, "type" to type as Any, - "status" to status as Any, + "status" to status.value as Any, "error" to error as Any, "required" to required as Any, "array" to array as Any, @@ -96,15 +97,15 @@ data class ColumnString( ) = ColumnString( key = map["key"] as String, type = map["type"] as String, - status = map["status"] as String, + status = ColumnStatus.values().find { it.value == map["status"] as String }!!, error = map["error"] as String, required = map["required"] as Boolean, - array = map["array"] as? Boolean?, + array = map["array"] as? Boolean, createdAt = map["\$createdAt"] as String, updatedAt = map["\$updatedAt"] as String, size = (map["size"] as Number).toLong(), - default = map["default"] as? String?, - encrypt = map["encrypt"] as? Boolean?, + default = map["default"] as? String, + encrypt = map["encrypt"] as? Boolean, ) } } \ No newline at end of file diff --git a/src/main/kotlin/io/appwrite/models/ColumnUrl.kt b/src/main/kotlin/io/appwrite/models/ColumnUrl.kt index 10cd5d9..e7b98a1 100644 --- a/src/main/kotlin/io/appwrite/models/ColumnUrl.kt +++ b/src/main/kotlin/io/appwrite/models/ColumnUrl.kt @@ -2,6 +2,7 @@ package io.appwrite.models import com.google.gson.annotations.SerializedName import io.appwrite.extensions.jsonCast +import io.appwrite.enums.ColumnStatus /** * ColumnURL @@ -23,7 +24,7 @@ data class ColumnUrl( * Column status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` */ @SerializedName("status") - val status: String, + val status: ColumnStatus, /** * Error message. Displays error generated on failure of creating or deleting an column. @@ -71,7 +72,7 @@ data class ColumnUrl( fun toMap(): Map = mapOf( "key" to key as Any, "type" to type as Any, - "status" to status as Any, + "status" to status.value as Any, "error" to error as Any, "required" to required as Any, "array" to array as Any, @@ -89,14 +90,14 @@ data class ColumnUrl( ) = ColumnUrl( key = map["key"] as String, type = map["type"] as String, - status = map["status"] as String, + status = ColumnStatus.values().find { it.value == map["status"] as String }!!, error = map["error"] as String, required = map["required"] as Boolean, - array = map["array"] as? Boolean?, + array = map["array"] as? Boolean, createdAt = map["\$createdAt"] as String, updatedAt = map["\$updatedAt"] as String, format = map["format"] as String, - default = map["default"] as? String?, + default = map["default"] as? String, ) } } \ No newline at end of file diff --git a/src/main/kotlin/io/appwrite/models/Database.kt b/src/main/kotlin/io/appwrite/models/Database.kt index f40c578..2ff518b 100644 --- a/src/main/kotlin/io/appwrite/models/Database.kt +++ b/src/main/kotlin/io/appwrite/models/Database.kt @@ -2,6 +2,7 @@ package io.appwrite.models import com.google.gson.annotations.SerializedName import io.appwrite.extensions.jsonCast +import io.appwrite.enums.DatabaseType /** * Database @@ -41,7 +42,7 @@ data class Database( * Database type. */ @SerializedName("type") - val type: String, + val type: DatabaseType, ) { fun toMap(): Map = mapOf( @@ -50,7 +51,7 @@ data class Database( "\$createdAt" to createdAt as Any, "\$updatedAt" to updatedAt as Any, "enabled" to enabled as Any, - "type" to type as Any, + "type" to type.value as Any, ) companion object { @@ -64,7 +65,7 @@ data class Database( createdAt = map["\$createdAt"] as String, updatedAt = map["\$updatedAt"] as String, enabled = map["enabled"] as Boolean, - type = map["type"] as String, + type = DatabaseType.values().find { it.value == map["type"] as String }!!, ) } } \ No newline at end of file diff --git a/src/main/kotlin/io/appwrite/models/Deployment.kt b/src/main/kotlin/io/appwrite/models/Deployment.kt index 4c32b31..b2749a6 100644 --- a/src/main/kotlin/io/appwrite/models/Deployment.kt +++ b/src/main/kotlin/io/appwrite/models/Deployment.kt @@ -2,6 +2,7 @@ package io.appwrite.models import com.google.gson.annotations.SerializedName import io.appwrite.extensions.jsonCast +import io.appwrite.enums.DeploymentStatus /** * Deployment @@ -95,7 +96,7 @@ data class Deployment( * The deployment status. Possible values are "waiting", "processing", "building", "ready", and "failed". */ @SerializedName("status") - val status: String, + val status: DeploymentStatus, /** * The build logs. @@ -185,7 +186,7 @@ data class Deployment( "activate" to activate as Any, "screenshotLight" to screenshotLight as Any, "screenshotDark" to screenshotDark as Any, - "status" to status as Any, + "status" to status.value as Any, "buildLogs" to buildLogs as Any, "buildDuration" to buildDuration as Any, "providerRepositoryName" to providerRepositoryName as Any, @@ -220,7 +221,7 @@ data class Deployment( activate = map["activate"] as Boolean, screenshotLight = map["screenshotLight"] as String, screenshotDark = map["screenshotDark"] as String, - status = map["status"] as String, + status = DeploymentStatus.values().find { it.value == map["status"] as String }!!, buildLogs = map["buildLogs"] as String, buildDuration = (map["buildDuration"] as Number).toLong(), providerRepositoryName = map["providerRepositoryName"] as String, diff --git a/src/main/kotlin/io/appwrite/models/Document.kt b/src/main/kotlin/io/appwrite/models/Document.kt index c0dfe61..6a2fd9c 100644 --- a/src/main/kotlin/io/appwrite/models/Document.kt +++ b/src/main/kotlin/io/appwrite/models/Document.kt @@ -99,7 +99,7 @@ data class Document( createdAt = map["\$createdAt"] as String, updatedAt = map["\$updatedAt"] as String, permissions = map["\$permissions"] as List, - data = map.jsonCast(to = nestedType) + data = map["data"]?.jsonCast(to = nestedType) ?: map.jsonCast(to = nestedType) ) } } \ No newline at end of file diff --git a/src/main/kotlin/io/appwrite/models/Execution.kt b/src/main/kotlin/io/appwrite/models/Execution.kt index 3d71082..5b9863c 100644 --- a/src/main/kotlin/io/appwrite/models/Execution.kt +++ b/src/main/kotlin/io/appwrite/models/Execution.kt @@ -2,6 +2,8 @@ package io.appwrite.models import com.google.gson.annotations.SerializedName import io.appwrite.extensions.jsonCast +import io.appwrite.enums.ExecutionTrigger +import io.appwrite.enums.ExecutionStatus /** * Execution @@ -47,13 +49,13 @@ data class Execution( * The trigger that caused the function to execute. Possible values can be: `http`, `schedule`, or `event`. */ @SerializedName("trigger") - val trigger: String, + val trigger: ExecutionTrigger, /** * The status of the function execution. Possible values can be: `waiting`, `processing`, `completed`, or `failed`. */ @SerializedName("status") - val status: String, + val status: ExecutionStatus, /** * HTTP request method type. @@ -123,8 +125,8 @@ data class Execution( "\$permissions" to permissions as Any, "functionId" to functionId as Any, "deploymentId" to deploymentId as Any, - "trigger" to trigger as Any, - "status" to status as Any, + "trigger" to trigger.value as Any, + "status" to status.value as Any, "requestMethod" to requestMethod as Any, "requestPath" to requestPath as Any, "requestHeaders" to requestHeaders.map { it.toMap() } as Any, @@ -149,8 +151,8 @@ data class Execution( permissions = map["\$permissions"] as List, functionId = map["functionId"] as String, deploymentId = map["deploymentId"] as String, - trigger = map["trigger"] as String, - status = map["status"] as String, + trigger = ExecutionTrigger.values().find { it.value == map["trigger"] as String }!!, + status = ExecutionStatus.values().find { it.value == map["status"] as String }!!, requestMethod = map["requestMethod"] as String, requestPath = map["requestPath"] as String, requestHeaders = (map["requestHeaders"] as List>).map { Headers.from(map = it) }, @@ -160,7 +162,7 @@ data class Execution( logs = map["logs"] as String, errors = map["errors"] as String, duration = (map["duration"] as Number).toDouble(), - scheduledAt = map["scheduledAt"] as? String?, + scheduledAt = map["scheduledAt"] as? String, ) } } \ No newline at end of file diff --git a/src/main/kotlin/io/appwrite/models/HealthAntivirus.kt b/src/main/kotlin/io/appwrite/models/HealthAntivirus.kt index 070a5ca..80a451d 100644 --- a/src/main/kotlin/io/appwrite/models/HealthAntivirus.kt +++ b/src/main/kotlin/io/appwrite/models/HealthAntivirus.kt @@ -2,6 +2,7 @@ package io.appwrite.models import com.google.gson.annotations.SerializedName import io.appwrite.extensions.jsonCast +import io.appwrite.enums.HealthAntivirusStatus /** * Health Antivirus @@ -17,12 +18,12 @@ data class HealthAntivirus( * Antivirus status. Possible values are: `disabled`, `offline`, `online` */ @SerializedName("status") - val status: String, + val status: HealthAntivirusStatus, ) { fun toMap(): Map = mapOf( "version" to version as Any, - "status" to status as Any, + "status" to status.value as Any, ) companion object { @@ -32,7 +33,7 @@ data class HealthAntivirus( map: Map, ) = HealthAntivirus( version = map["version"] as String, - status = map["status"] as String, + status = HealthAntivirusStatus.values().find { it.value == map["status"] as String }!!, ) } } \ No newline at end of file diff --git a/src/main/kotlin/io/appwrite/models/HealthStatus.kt b/src/main/kotlin/io/appwrite/models/HealthStatus.kt index ad309e5..6d67ed2 100644 --- a/src/main/kotlin/io/appwrite/models/HealthStatus.kt +++ b/src/main/kotlin/io/appwrite/models/HealthStatus.kt @@ -2,6 +2,7 @@ package io.appwrite.models import com.google.gson.annotations.SerializedName import io.appwrite.extensions.jsonCast +import io.appwrite.enums.HealthCheckStatus /** * Health Status @@ -23,13 +24,13 @@ data class HealthStatus( * Service status. Possible values are: `pass`, `fail` */ @SerializedName("status") - val status: String, + val status: HealthCheckStatus, ) { fun toMap(): Map = mapOf( "name" to name as Any, "ping" to ping as Any, - "status" to status as Any, + "status" to status.value as Any, ) companion object { @@ -40,7 +41,7 @@ data class HealthStatus( ) = HealthStatus( name = map["name"] as String, ping = (map["ping"] as Number).toLong(), - status = map["status"] as String, + status = HealthCheckStatus.values().find { it.value == map["status"] as String }!!, ) } } \ No newline at end of file diff --git a/src/main/kotlin/io/appwrite/models/Index.kt b/src/main/kotlin/io/appwrite/models/Index.kt index 93fe6df..e2e2d53 100644 --- a/src/main/kotlin/io/appwrite/models/Index.kt +++ b/src/main/kotlin/io/appwrite/models/Index.kt @@ -2,6 +2,7 @@ package io.appwrite.models import com.google.gson.annotations.SerializedName import io.appwrite.extensions.jsonCast +import io.appwrite.enums.IndexStatus /** * Index @@ -41,7 +42,7 @@ data class Index( * Index status. Possible values: `available`, `processing`, `deleting`, `stuck`, or `failed` */ @SerializedName("status") - val status: String, + val status: IndexStatus, /** * Error message. Displays error generated on failure of creating or deleting an index. @@ -74,7 +75,7 @@ data class Index( "\$updatedAt" to updatedAt as Any, "key" to key as Any, "type" to type as Any, - "status" to status as Any, + "status" to status.value as Any, "error" to error as Any, "attributes" to attributes as Any, "lengths" to lengths as Any, @@ -92,11 +93,11 @@ data class Index( updatedAt = map["\$updatedAt"] as String, key = map["key"] as String, type = map["type"] as String, - status = map["status"] as String, + status = IndexStatus.values().find { it.value == map["status"] as String }!!, error = map["error"] as String, attributes = map["attributes"] as List, lengths = map["lengths"] as List, - orders = map["orders"] as? List?, + orders = map["orders"] as? List, ) } } \ No newline at end of file diff --git a/src/main/kotlin/io/appwrite/models/Message.kt b/src/main/kotlin/io/appwrite/models/Message.kt index e5509c1..6c32292 100644 --- a/src/main/kotlin/io/appwrite/models/Message.kt +++ b/src/main/kotlin/io/appwrite/models/Message.kt @@ -2,6 +2,7 @@ package io.appwrite.models import com.google.gson.annotations.SerializedName import io.appwrite.extensions.jsonCast +import io.appwrite.enums.MessageStatus /** * Message @@ -83,7 +84,7 @@ data class Message( * Status of delivery. */ @SerializedName("status") - val status: String, + val status: MessageStatus, ) { fun toMap(): Map = mapOf( @@ -99,7 +100,7 @@ data class Message( "deliveryErrors" to deliveryErrors as Any, "deliveredTotal" to deliveredTotal as Any, "data" to data as Any, - "status" to status as Any, + "status" to status.value as Any, ) companion object { @@ -115,12 +116,12 @@ data class Message( topics = map["topics"] as List, users = map["users"] as List, targets = map["targets"] as List, - scheduledAt = map["scheduledAt"] as? String?, - deliveredAt = map["deliveredAt"] as? String?, - deliveryErrors = map["deliveryErrors"] as? List?, + scheduledAt = map["scheduledAt"] as? String, + deliveredAt = map["deliveredAt"] as? String, + deliveryErrors = map["deliveryErrors"] as? List, deliveredTotal = (map["deliveredTotal"] as Number).toLong(), data = map["data"] as Any, - status = map["status"] as String, + status = MessageStatus.values().find { it.value == map["status"] as String }!!, ) } } \ No newline at end of file diff --git a/src/main/kotlin/io/appwrite/models/Preferences.kt b/src/main/kotlin/io/appwrite/models/Preferences.kt index 309fb98..3d41ad1 100644 --- a/src/main/kotlin/io/appwrite/models/Preferences.kt +++ b/src/main/kotlin/io/appwrite/models/Preferences.kt @@ -29,7 +29,7 @@ data class Preferences( map: Map, nestedType: Class ) = Preferences( - data = map.jsonCast(to = nestedType) + data = map["data"]?.jsonCast(to = nestedType) ?: map.jsonCast(to = nestedType) ) } } \ No newline at end of file diff --git a/src/main/kotlin/io/appwrite/models/Provider.kt b/src/main/kotlin/io/appwrite/models/Provider.kt index 32837d0..25f070c 100644 --- a/src/main/kotlin/io/appwrite/models/Provider.kt +++ b/src/main/kotlin/io/appwrite/models/Provider.kt @@ -88,7 +88,7 @@ data class Provider( enabled = map["enabled"] as Boolean, type = map["type"] as String, credentials = map["credentials"] as Any, - options = map["options"] as? Any?, + options = map["options"] as? Any, ) } } \ No newline at end of file diff --git a/src/main/kotlin/io/appwrite/models/Row.kt b/src/main/kotlin/io/appwrite/models/Row.kt index bb5c14f..3621fc5 100644 --- a/src/main/kotlin/io/appwrite/models/Row.kt +++ b/src/main/kotlin/io/appwrite/models/Row.kt @@ -99,7 +99,7 @@ data class Row( createdAt = map["\$createdAt"] as String, updatedAt = map["\$updatedAt"] as String, permissions = map["\$permissions"] as List, - data = map.jsonCast(to = nestedType) + data = map["data"]?.jsonCast(to = nestedType) ?: map.jsonCast(to = nestedType) ) } } \ No newline at end of file diff --git a/src/main/kotlin/io/appwrite/models/Target.kt b/src/main/kotlin/io/appwrite/models/Target.kt index 54b4694..48d9650 100644 --- a/src/main/kotlin/io/appwrite/models/Target.kt +++ b/src/main/kotlin/io/appwrite/models/Target.kt @@ -85,7 +85,7 @@ data class Target( updatedAt = map["\$updatedAt"] as String, name = map["name"] as String, userId = map["userId"] as String, - providerId = map["providerId"] as? String?, + providerId = map["providerId"] as? String, providerType = map["providerType"] as String, identifier = map["identifier"] as String, expired = map["expired"] as Boolean, diff --git a/src/main/kotlin/io/appwrite/models/User.kt b/src/main/kotlin/io/appwrite/models/User.kt index fd03fc2..e9a1144 100644 --- a/src/main/kotlin/io/appwrite/models/User.kt +++ b/src/main/kotlin/io/appwrite/models/User.kt @@ -196,9 +196,9 @@ data class User( createdAt = map["\$createdAt"] as String, updatedAt = map["\$updatedAt"] as String, name = map["name"] as String, - password = map["password"] as? String?, - hash = map["hash"] as? String?, - hashOptions = map["hashOptions"] as? Any?, + password = map["password"] as? String, + hash = map["hash"] as? String, + hashOptions = map["hashOptions"] as? Any, registration = map["registration"] as String, status = map["status"] as Boolean, labels = map["labels"] as List,