Merge pull request #57 from appwrite/dev

feat: Kotlin SDK update for version 12.0.0
This commit is contained in:
Jake Barnby
2025-10-03 17:06:34 +13:00
committed by GitHub
52 changed files with 361 additions and 169 deletions
+2 -2
View File
@@ -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:
<dependency>
<groupId>io.appwrite</groupId>
<artifactId>sdk-for-kotlin</artifactId>
<version>11.1.0</version>
<version>12.0.0</version>
</dependency>
</dependencies>
```
+3 -3
View File
@@ -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")
}
}
@@ -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
}
@@ -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
}
@@ -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
}
@@ -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
}
@@ -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
}
@@ -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
}
@@ -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
}
@@ -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
}
@@ -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
}
@@ -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
}
@@ -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<String, Any> = 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,
)
}
}
@@ -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<String, Any> = 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,
)
}
}
@@ -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<String, Any> = 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,
)
}
}
@@ -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<String, Any> = 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<String>,
format = map["format"] as String,
default = map["default"] as? String?,
default = map["default"] as? String,
)
}
}
@@ -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<String, Any> = 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(),
@@ -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<String, Any> = 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(),
@@ -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<String, Any> = 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,
)
}
}
@@ -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<String, Any> = 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<Any>?,
default = map["default"] as? List<Any>,
)
}
}
@@ -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<String, Any> = 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<Any>?,
default = map["default"] as? List<Any>,
)
}
}
@@ -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<String, Any> = 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<Any>?,
default = map["default"] as? List<Any>,
)
}
}
@@ -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<String, Any> = 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,
@@ -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<String, Any> = 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,
)
}
}
@@ -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<String, Any> = 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,
)
}
}
@@ -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<String, Any> = 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,
)
}
}
@@ -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<String, Any> = 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,
)
}
}
@@ -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<String, Any> = 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,
)
}
}
@@ -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<String, Any> = 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<String>,
format = map["format"] as String,
default = map["default"] as? String?,
default = map["default"] as? String,
)
}
}
@@ -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<String, Any> = 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(),
@@ -96,7 +96,7 @@ data class ColumnIndex(
error = map["error"] as String,
columns = map["columns"] as List<String>,
lengths = map["lengths"] as List<Long>,
orders = map["orders"] as? List<String>?,
orders = map["orders"] as? List<String>,
)
}
}
@@ -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<String, Any> = 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(),
@@ -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<String, Any> = 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,
)
}
}
@@ -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<String, Any> = 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<Any>?,
default = map["default"] as? List<Any>,
)
}
}
@@ -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<String, Any> = 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<Any>?,
default = map["default"] as? List<Any>,
)
}
}
@@ -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<String, Any> = 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<Any>?,
default = map["default"] as? List<Any>,
)
}
}
@@ -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<String, Any> = 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,
@@ -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<String, Any> = 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,
)
}
}
@@ -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<String, Any> = 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,
)
}
}
@@ -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<String, Any> = 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 }!!,
)
}
}
@@ -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,
@@ -99,7 +99,7 @@ data class Document<T>(
createdAt = map["\$createdAt"] as String,
updatedAt = map["\$updatedAt"] as String,
permissions = map["\$permissions"] as List<String>,
data = map.jsonCast(to = nestedType)
data = map["data"]?.jsonCast(to = nestedType) ?: map.jsonCast(to = nestedType)
)
}
}
@@ -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<String>,
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<String, Any>>).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,
)
}
}
@@ -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<String, Any> = 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<String, Any>,
) = HealthAntivirus(
version = map["version"] as String,
status = map["status"] as String,
status = HealthAntivirusStatus.values().find { it.value == map["status"] as String }!!,
)
}
}
@@ -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<String, Any> = 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 }!!,
)
}
}
+5 -4
View File
@@ -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<String>,
lengths = map["lengths"] as List<Long>,
orders = map["orders"] as? List<String>?,
orders = map["orders"] as? List<String>,
)
}
}
@@ -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<String, Any> = 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<String>,
users = map["users"] as List<String>,
targets = map["targets"] as List<String>,
scheduledAt = map["scheduledAt"] as? String?,
deliveredAt = map["deliveredAt"] as? String?,
deliveryErrors = map["deliveryErrors"] as? List<String>?,
scheduledAt = map["scheduledAt"] as? String,
deliveredAt = map["deliveredAt"] as? String,
deliveryErrors = map["deliveryErrors"] as? List<String>,
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 }!!,
)
}
}
@@ -29,7 +29,7 @@ data class Preferences<T>(
map: Map<String, Any>,
nestedType: Class<T>
) = Preferences<T>(
data = map.jsonCast(to = nestedType)
data = map["data"]?.jsonCast(to = nestedType) ?: map.jsonCast(to = nestedType)
)
}
}
@@ -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,
)
}
}
+1 -1
View File
@@ -99,7 +99,7 @@ data class Row<T>(
createdAt = map["\$createdAt"] as String,
updatedAt = map["\$updatedAt"] as String,
permissions = map["\$permissions"] as List<String>,
data = map.jsonCast(to = nestedType)
data = map["data"]?.jsonCast(to = nestedType) ?: map.jsonCast(to = nestedType)
)
}
}
+1 -1
View File
@@ -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,
+3 -3
View File
@@ -196,9 +196,9 @@ data class User<T>(
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<String>,